Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. package me.staticjava;
  2.  
  3. import net.minecraft.server.v1_7_R4.*;
  4. import org.bukkit.craftbukkit.v1_7_R4.util.UnsafeList;
  5.  
  6. import java.lang.reflect.Field;
  7.  
  8. /**
  9. * Created by StaticJava.
  10. */
  11. public class CustomEntityVillager extends EntityVillager {
  12. public CustomEntityVillager(World world) {
  13. super(world);
  14.  
  15. try {
  16. Field bField = PathfinderGoalSelector.class.getDeclaredField("b");
  17. bField.setAccessible(true);
  18. Field cField = PathfinderGoalSelector.class.getDeclaredField("c");
  19. cField.setAccessible(true);
  20.  
  21. bField.set(goalSelector, new UnsafeList<PathfinderGoalSelector>());
  22. bField.set(targetSelector, new UnsafeList<PathfinderGoalSelector>());
  23. cField.set(goalSelector, new UnsafeList<PathfinderGoalSelector>());
  24. cField.set(targetSelector, new UnsafeList<PathfinderGoalSelector>());
  25.  
  26. } catch (Exception e){
  27. e.printStackTrace();
  28. }
  29.  
  30. this.goalSelector.a(0, new PathfinderGoalFloat(this));
  31. this.goalSelector.a(1, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
  32.  
  33. this.getAttributeInstance(GenericAttributes.maxHealth).setValue(Double.MAX_VALUE);
  34. this.getAttributeInstance(GenericAttributes.b).setValue(0);
  35. this.getAttributeInstance(GenericAttributes.c).setValue(Double.MAX_VALUE);
  36. this.getAttributeInstance(GenericAttributes.d).setValue(0);
  37. }
  38.  
  39. @Override
  40. public EntityAgeable createChild(EntityAgeable entityAgeable) {
  41. return null;
  42. }
  43.  
  44. @Override
  45. public void move(double d0, double d1, double d2){
  46. }
  47.  
  48. @Override
  49. public boolean damageEntity(DamageSource damagesource, float f) {
  50. return false;
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement