Custom EntityEnderDragon (statue)

Discussion in 'Plugin Development' started by Maximvdw, Feb 24, 2014.

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


    Dear Bukkiteers,

    I want to create a custom entityenderdragon but I can't really figgure out a good way to let it stay at his current position.

    I know I have to override the pathfinding goals.

    I have registered the custom entity, and I have this for my entity class:
    import java.lang.reflect.Field;
    import org.bukkit.craftbukkit.v1_7_R1.util.UnsafeList;
    import net.minecraft.server.v1_7_R1.EntityEnderDragon;
    import net.minecraft.server.v1_7_R1.PathfinderGoalFloat;
    import net.minecraft.server.v1_7_R1.PathfinderGoalSelector;
    import net.minecraft.server.v1_7_R1.World;
    public class DragonEntity extends EntityEnderDragon {
        public DragonEntity(World world) {
            try {
                Field gsa = PathfinderGoalSelector.class.getDeclaredField("a");
                gsa.set(this.goalSelector, new UnsafeList());
                gsa.set(this.targetSelector, new UnsafeList());
            } catch (NoSuchFieldException | SecurityException
                    | IllegalArgumentException | IllegalAccessException e) {
            this.goalSelector.a(0, new PathfinderGoalFloat(this));
    But this does not work :(

    [19:22:11 WARN]: java.lang.IllegalAccessException: Can not set static final org.
    apache.logging.log4j.Logger field net.minecraft.server.v1_7_R1.PathfinderGoalSel
    ector.a to org.bukkit.craftbukkit.v1_7_R1.util.UnsafeList

    Best Regards,
Thread Status:
Not open for further replies.

Share This Page