Advertisement
Guest User

Untitled

a guest
Feb 14th, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.96 KB | None | 0 0
  1. package NMS;
  2.  
  3. import net.minecraft.server.v1_11_R1.DamageSource;
  4. import net.minecraft.server.v1_11_R1.Entity;
  5. import net.minecraft.server.v1_11_R1.EntityAgeable;
  6. import net.minecraft.server.v1_11_R1.EntityArrow;
  7. import net.minecraft.server.v1_11_R1.EntityHuman;
  8. import net.minecraft.server.v1_11_R1.EntityTameableAnimal;
  9. import net.minecraft.server.v1_11_R1.EntityWolf;
  10. import net.minecraft.server.v1_11_R1.GenericAttributes;
  11. import net.minecraft.server.v1_11_R1.PathfinderGoalFloat;
  12. import net.minecraft.server.v1_11_R1.PathfinderGoalHurtByTarget;
  13. import net.minecraft.server.v1_11_R1.PathfinderGoalLeapAtTarget;
  14. import net.minecraft.server.v1_11_R1.PathfinderGoalLookAtPlayer;
  15. import net.minecraft.server.v1_11_R1.PathfinderGoalMeleeAttack;
  16. import net.minecraft.server.v1_11_R1.PathfinderGoalRandomLookaround;
  17. import net.minecraft.server.v1_11_R1.PathfinderGoalRandomStrollLand;
  18. import net.minecraft.server.v1_11_R1.World;
  19.  
  20.  
  21. public class sdWolf extends EntityWolf {
  22.  
  23. public sdWolf(World world) {
  24. super(world);
  25. setDefaultGoals();
  26. this.setAngry(true);
  27.  
  28.  
  29. }
  30. @Override
  31. public void r() {
  32.  
  33. }
  34.  
  35. public void setDefaultGoals() {
  36. NMSUtils.clearBehavior(goalSelector, targetSelector);
  37. this.goalSelector.a(1, new PathfinderGoalFloat(this));
  38. this.goalSelector.a(2, new sdPathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true));
  39. this.goalSelector.a(4, new PathfinderGoalLeapAtTarget(this, 0.4F));
  40. this.goalSelector.a(5, new PathfinderGoalMeleeAttack(this, 1.0D, true));
  41. this.goalSelector.a(8, new PathfinderGoalRandomStrollLand(this, 1.0D));
  42. this.goalSelector.a(10, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
  43. this.goalSelector.a(10, new PathfinderGoalRandomLookaround(this));
  44. //this.targetSelector.a(3, new PathfinderGoalHurtByTarget(this, true, new Class[0]));
  45. this.targetSelector.a(2, new sdPathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true));
  46.  
  47. }
  48.  
  49. @Override
  50. public void initAttributes() {
  51. super.initAttributes();
  52. this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.30000001192092896D);
  53. if (this.isTamed()) {
  54. this.getAttributeInstance(GenericAttributes.maxHealth).setValue(20.0D);
  55. } else {
  56. this.getAttributeInstance(GenericAttributes.maxHealth).setValue(48.0D);
  57. }
  58.  
  59. //this.getAttributeMap().b(GenericAttributes.ATTACK_DAMAGE).setValue(2.0D);
  60. }
  61.  
  62. @Override
  63. public EntityAgeable createChild(EntityAgeable arg0) {
  64. // TODO Auto-generated method stub
  65. return null;
  66. }
  67. /*
  68. @Override
  69. public boolean damageEntity(DamageSource damagesource, float f) {
  70. if(damagesource.equals(DamageSource.FALL))
  71. return false;
  72.  
  73. if (this.isInvulnerable(damagesource)) {
  74. return false;
  75. } else {
  76. Entity entity = damagesource.getEntity();
  77.  
  78. if (this.goalSit != null) {
  79. // CraftBukkit - moved into EntityLiving.d(DamageSource, float)
  80. // PAIL : checkme
  81. // this.goalSit.setSitting(false);
  82. }
  83. if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
  84. f = (f + 1.0F) / 2.0F;
  85. }
  86. if(damagesource == null)
  87. damagesource = DamageSource.GENERIC;
  88. else
  89. System.out.println("Damage source was: " + damagesource + " for: " + f);
  90. if(f <=0)
  91. f = 0.5f;
  92.  
  93. return super.damageEntity(damagesource, f);
  94. }
  95. }
  96. */
  97.  
  98. public void setAngry(boolean flag) {
  99. byte b0 = ((Byte) this.datawatcher.get(sdWolf.bw)).byteValue();
  100.  
  101. if (flag) {
  102. this.datawatcher.set(sdWolf.bw, Byte.valueOf((byte) (b0 | 2)));
  103. } else {
  104. this.datawatcher.set(sdWolf.bw, Byte.valueOf((byte) (b0 & -3)));
  105. }
  106.  
  107. }
  108.  
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement