Update Entity-Armor-Setting Class? How?

Discussion in 'Plugin Development' started by Uniclaw, Jan 9, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Uniclaw

    Hi!

    How can i make a EntityArmorSetting Class with 1.4.6? The Constructor new CraftItemStack(itemstack) is not visible -.-
     
  2. Offline

    caseif

     
  3. Offline

    Uniclaw

    And what, if i don't know the entity? Is there no possibility to make Entity.getEntityEqetc()?
     
  4. Offline

    CubixCoders

    EntitySpawnEvent? event.getEntity();?
     
  5. Offline

    Uniclaw

    CubixCoders Nope, EntityDamageByEntity -> getDamager
     
  6. Offline

    CubixCoders

    Entity attacker = e.getDamager();
    if(attacker instanceof Player){
    return;
    }
    EntityEquipment = attacker.getEntityEquipment();
     
  7. Offline

    Uniclaw

    Entity hasn't a getEntityEquipment Method.. Thats the Problem, not the getting of an entity.
     
  8. Offline

    CubixCoders

    if(event.getEntity() instanceof Zombie){
    Zombie z = (Zombie) event.getEntity();
    EntityEquipment equip = z.getEquipment();
    }
     
  9. Offline

    Uniclaw

    CubixCoders But for that i must check every existing Entity :'( Is there no way to make it like 1.4.5, so that i can getweapon of every entity - too wolfs, spiders, etc?

    I've used a a little bit changed class from stirante
     
  10. Offline

    CubixCoders

    That's the only way i could think of it D:, just do it for the mobs you want to add items to
     
  11. Offline

    Uniclaw

    Oh, thats pitty :(

    (I need it to check the weapon and replace %item in a string with the weapon..)
     
  12. Offline

    fireblast709

    Code:java
    1. if(entity instanceof LivingEntity)
    2. {
    3. EntityEquipment ee = ((LivingEntity)entity).getEntityEquipment();
    4. }
    Here you go
     
  13. Offline

    CubixCoders

  14. Offline

    Uniclaw

    Thanks!!

    Works perfectly with players :D (EDIT: Nope.. Works with nothing :( )
    But one Problem: If i let damage me a zombie for example, i become this error:

    Code:
    org.bukkit.event.EventException
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:341)
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62)
            at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:477)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:462)
            at org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerDeathEvent(C
    raftEventFactory.java:335)
            at net.minecraft.server.EntityPlayer.die(EntityPlayer.java:253)
            at net.minecraft.server.EntityLiving.damageEntity(EntityLiving.java:730)
     
            at net.minecraft.server.EntityHuman.damageEntity(EntityHuman.java:605)
            at net.minecraft.server.EntityPlayer.damageEntity(EntityPlayer.java:306)
     
            at net.minecraft.server.EntityMonster.m(EntityMonster.java:88)
            at net.minecraft.server.PathfinderGoalMeleeAttack.e(PathfinderGoalMeleeA
    ttack.java:83)
            at net.minecraft.server.PathfinderGoalSelector.a(PathfinderGoalSelector.
    java:104)
            at net.minecraft.server.EntityLiving.bl(EntityLiving.java:1422)
            at net.minecraft.server.EntityLiving.c(EntityLiving.java:1224)
            at net.minecraft.server.EntityMonster.c(EntityMonster.java:20)
            at net.minecraft.server.EntityZombie.c(EntityZombie.java:108)
            at net.minecraft.server.EntityLiving.j_(EntityLiving.java:508)
            at net.minecraft.server.EntityMonster.j_(EntityMonster.java:24)
            at net.minecraft.server.EntityZombie.j_(EntityZombie.java:121)
            at net.minecraft.server.World.tickEntity(World.java:1463)
            at net.minecraft.server.World.entityJoinedWorld(World.java:1425)
            at net.minecraft.server.WorldServer.entityJoinedWorld(WorldServer.java:5
    69)
            at net.minecraft.server.World.playerJoinedWorld(World.java:1415)
            at net.minecraft.server.World.tickEntities(World.java:1293)
            at net.minecraft.server.WorldServer.tickEntities(WorldServer.java:463)
            at net.minecraft.server.MinecraftServer.r(MinecraftServer.java:578)
            at net.minecraft.server.DedicatedServer.r(DedicatedServer.java:222)
            at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:494)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:426)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:856)
    Caused by: java.lang.NoSuchMethodError: org.bukkit.entity.LivingEntity.getEquipm
    ent()Lorg/bukkit/inventory/EntityEquipment;
            at ------------.EE.getWeapon(EE.java:10)
            at -------.-------.dmg(---.java:83)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:339)
            ... 29 more
    EE.java:10
    org.bukkit.inventory.EntityEquipment ee = ((LivingEntity)e).getEquipment();

    ---.java:83
    s = s.replaceAll("%item", (EE.getWeapon(dmgr) == null || EE.getWeapon(dmgr).getTypeId() == 0)?plugin.getConfig().getString("Hand"):uFN(EE.getWeapon(dmgr).getType().toString().toLowerCase()));

    Solved :)

    But one question.. Why the f*ck in the new update constructors are changed, and all nms/cb code are in another package?? 75% of my plugins on my server are not working cause this update.. I know 7 developer where had stop coding plugins because this update..

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 8, 2016
  15. Offline

    fireblast709

    Stopping coding plugins because of this... meh
     
Thread Status:
Not open for further replies.

Share This Page