Guten Tag, ich habe mir ein Pet Plugin geschrieben als Custom Mob d.h. dies : *This*. Nun hab ich ein Problem, dass ich dies Deaktivieren möchte :
nur es gibt die als Fehler :
ich habe keine Ahnung wie ich das zu einer EntityCreature machen soll.
Der Custom Mob Code :
HTML:
this.goalSelector.a(2, new PathfinderGoalMeleeAttack((EntityCreature) et, EntityHuman.class, (double) 0.0, false));
this.targetSelector.a(1, new PathfinderGoalHurtByTarget((EntityCreature) et, false));
HTML:
2013-10-23 15:38:50 [SEVERE] Caused by: java.lang.ClassCastException: me.oario.aPet.entitys.CustomEntitySlime cannot be cast to net.minecraft.server.v1_6_R2.EntityCreature
Der Custom Mob Code :
HTML:
public class CustomEntitySlime extends net.minecraft.server.v1_6_R2.EntitySlime {
public CustomEntitySlime(World world) {
super(world);
try {
java.lang.reflect.Field gsa = net.minecraft.server.v1_6_R2.PathfinderGoalSelector.class.getDeclaredField("a");
((AccessibleObject) gsa).setAccessible(true);
gsa.set(this.goalSelector, new UnsafeList());
gsa.set(this.targetSelector, new UnsafeList());
} catch (SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAcces***ception e) {
}
net.minecraft.server.v1_6_R2.Entity et = ((CraftEntity) this.getEntity()).getHandle();
this.goalSelector.a(2, new PathfinderGoalMeleeAttack((EntityCreature) et, EntityHuman.class, (double) 0.0, false));
this.targetSelector.a(1, new PathfinderGoalHurtByTarget((EntityCreature) et, false));
}
public Entity getEntity() {
Slime Slime = (Slime) this.getBukkitEntity();
return Slime;
}
}