Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.04 KB | None | 0 0
  1. package me.TomTheDeveloper.Creatures.v1_7_R4;
  2.  
  3. import net.minecraft.server.v1_7_R4.*;
  4. import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
  5.  
  6. import java.lang.reflect.Field;
  7. import java.util.List;
  8.  
  9. /**
  10. * Created by Tom on 14/08/2014.
  11. */
  12. public class FastZombie extends EntityZombie {
  13. public int damage;
  14. private float bw;
  15.  
  16.  
  17.  
  18. @SuppressWarnings("rawtypes")
  19. public FastZombie(org.bukkit.World world) {
  20. super(((CraftWorld) world).getHandle());
  21. this.bw = 1.5F; //Change this to your liking. This is were you set the speed
  22. this.damage = 15; // set the damage
  23. //There's also a ton of options of you do this. play around with it
  24.  
  25.  
  26. List goalB = (List) getPrivateField("b", PathfinderGoalSelector.class, goalSelector);
  27. goalB.clear();
  28. List goalC = (List) getPrivateField("c", PathfinderGoalSelector.class, goalSelector);
  29. goalC.clear();
  30. List targetB = (List) getPrivateField("b", PathfinderGoalSelector.class, targetSelector);
  31. targetB.clear();
  32. List targetC = (List) getPrivateField("c", PathfinderGoalSelector.class, targetSelector);
  33. targetC.clear();
  34.  
  35.  
  36. ((Navigation)getNavigation()).b(true);
  37.  
  38. this.goalSelector.a(0, new PathfinderGoalFloat(this));
  39. this.goalSelector.a(1, new PathfinderGoalBreakDoor(this));
  40. this.goalSelector.a(3, new PathfinderGoalMeleeAttack(this, EntityHuman.class, (float) (this.bw), false)); // this one to attack human
  41. this.goalSelector.a(3, new PathfinderGoalMeleeAttack(this, EntityIronGolem.class, (float) this.bw, true));
  42. this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, EntityVillager.class, (float) this.bw, true));
  43. this.goalSelector.a(4, new PathfinderGoalMoveTowardsRestriction(this, (float) this.bw));
  44. this.goalSelector.a(7, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F)); // this one to look at human
  45. this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
  46. this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true));
  47. this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class,0, true)); // this one to target human
  48. this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class,0, false));
  49. this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityIronGolem.class,0, false));
  50.  
  51.  
  52. }
  53.  
  54. public static Object getPrivateField(String fieldName, Class clazz, Object object) {
  55. Field field;
  56. Object o = null;
  57.  
  58. try {
  59. field = clazz.getDeclaredField(fieldName);
  60.  
  61. field.setAccessible(true);
  62.  
  63. o = field.get(object);
  64. } catch (NoSuchFieldException e) {
  65. e.printStackTrace();
  66. } catch (IllegalAccessException e) {
  67. e.printStackTrace();
  68. }
  69.  
  70. return o;
  71. }
  72.  
  73.  
  74. @Override
  75. public void setOnFire(int i) {
  76. // don't set on fire
  77. //super.setOnFire(i);
  78. }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement