Advertisement
Guest User

Untitled

a guest
May 31st, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.23 KB | None | 0 0
  1. package ed.enderdeath.mod.entity;
  2.  
  3. import java.util.List;
  4. import java.util.Random;
  5.  
  6. import cpw.mods.fml.relauncher.Side;
  7. import cpw.mods.fml.relauncher.SideOnly;
  8. import ed.enderdeath.mod.Food.Baie;
  9. import ed.enderdeath.mod.common.enderdeath;
  10. import net.minecraft.block.Block;
  11. import net.minecraft.block.BlockColored;
  12. import net.minecraft.entity.Entity;
  13. import net.minecraft.entity.EntityAgeable;
  14. import net.minecraft.entity.EntityCreature;
  15. import net.minecraft.entity.EntityLivingBase;
  16. import net.minecraft.entity.SharedMonsterAttributes;
  17. import net.minecraft.entity.ai.EntityAIAttackOnCollide;
  18. import net.minecraft.entity.ai.EntityAIFollowOwner;
  19. import net.minecraft.entity.ai.EntityAIHurtByTarget;
  20. import net.minecraft.entity.ai.EntityAILeapAtTarget;
  21. import net.minecraft.entity.ai.EntityAILookIdle;
  22. import net.minecraft.entity.ai.EntityAIMate;
  23. import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
  24. import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
  25. import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
  26. import net.minecraft.entity.ai.EntityAISwimming;
  27. import net.minecraft.entity.ai.EntityAITarget;
  28. import net.minecraft.entity.ai.EntityAITargetNonTamed;
  29. import net.minecraft.entity.ai.EntityAIWander;
  30. import net.minecraft.entity.ai.EntityAIWatchClosest;
  31. import net.minecraft.entity.boss.IBossDisplayData;
  32. import net.minecraft.entity.monster.EntityCreeper;
  33. import net.minecraft.entity.monster.EntityGhast;
  34. import net.minecraft.entity.monster.EntityIronGolem;
  35. import net.minecraft.entity.monster.EntityMob;
  36. import net.minecraft.entity.monster.EntitySnowman;
  37. import net.minecraft.entity.monster.EntityZombie;
  38. import net.minecraft.entity.monster.IMob;
  39. import net.minecraft.entity.passive.EntityAnimal;
  40. import net.minecraft.entity.passive.EntityHorse;
  41. import net.minecraft.entity.passive.EntitySheep;
  42. import net.minecraft.entity.passive.EntityTameable;
  43. import net.minecraft.entity.player.EntityPlayer;
  44. import net.minecraft.entity.projectile.EntityArrow;
  45. import net.minecraft.init.Items;
  46. import net.minecraft.item.ItemStack;
  47. import net.minecraft.nbt.NBTTagCompound;
  48. import net.minecraft.pathfinding.PathEntity;
  49. import net.minecraft.potion.Potion;
  50. import net.minecraft.potion.PotionEffect;
  51. import net.minecraft.util.AxisAlignedBB;
  52. import net.minecraft.util.DamageSource;
  53. import net.minecraft.util.MathHelper;
  54. import net.minecraft.world.World;
  55.  
  56. public class Familiar extends EntityTameable implements IMob, IBossDisplayData {
  57.  
  58. private float field_70926_e;
  59. private float field_70924_f;
  60. /** true is the wolf is wet else false */
  61. private boolean isShaking;
  62. private boolean field_70928_h;
  63. /**
  64. * This time increases while wolf is shaking and emitting water particles.
  65. */
  66. private float timeWolfIsShaking;
  67. private float prevTimeWolfIsShaking;
  68. private int lvl;
  69. private static final String __OBFID = "CL_00001654";
  70. private int Tamed;
  71. private World world;
  72. private int x;
  73. private int y;
  74. private int z;
  75. private Random random;
  76. private int short1;
  77. private double d3;
  78. private double d4;
  79. private double d5;
  80.  
  81. private int k;
  82.  
  83. public Familiar(World p_i1696_1_) {
  84. super(p_i1696_1_);
  85. this.setSize(0.6F, 0.8F);
  86. this.getNavigator().setAvoidsWater(true);
  87. this.tasks.addTask(1, new EntityAISwimming(this));
  88. this.tasks.addTask(2, this.aiSit);
  89.  
  90. this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
  91. this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true));
  92. this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
  93. this.tasks.addTask(6, new EntityAIMate(this, 1.0D));
  94. this.tasks.addTask(7, new EntityAIWander(this, 1.0D));
  95.  
  96. this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
  97. this.tasks.addTask(9, new EntityAILookIdle(this));
  98. this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
  99. this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
  100. this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true));
  101. this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntitySheep.class, 200, false));
  102.  
  103. this.targetTasks.addTask(6, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 3, true));
  104.  
  105. }
  106.  
  107. protected void applyEntityAttributes() {
  108. super.applyEntityAttributes();
  109. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D);
  110.  
  111. if (this.isTamed()) {
  112. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100.0D);
  113. } else {
  114. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D);
  115. }
  116. }
  117.  
  118. /**
  119. * Returns true if the newer Entity AI code should be run
  120. */
  121. public boolean isAIEnabled() {
  122. return true;
  123. }
  124.  
  125. /**
  126. * Sets the active target the Task system uses for tracking
  127. */
  128. public void setAttackTarget(EntityLivingBase p_70624_1_) {
  129. super.setAttackTarget(p_70624_1_);
  130.  
  131. if (p_70624_1_ == null) {
  132. this.setAngry(false);
  133. } else if (!this.isTamed()) {
  134. this.setAngry(true);
  135. } else if (this.Tamed == 1) {
  136. this.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 210, 1));
  137.  
  138. }
  139. }
  140.  
  141. /**
  142. * main AI tick function, replaces updateEntityActionState
  143. */
  144. protected void updateAITick() {
  145. this.dataWatcher.updateObject(18, Float.valueOf(this.getHealth()));
  146. }
  147.  
  148. protected void entityInit() {
  149. super.entityInit();
  150. this.dataWatcher.addObject(18, new Float(this.getHealth()));
  151. this.dataWatcher.addObject(19, new Byte((byte) 0));
  152. this.dataWatcher.addObject(20, new Byte((byte) BlockColored.func_150032_b(1)));
  153. }
  154.  
  155. protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) {
  156. this.playSound("mob.wolf.step", 0.15F, 1.0F);
  157. }
  158.  
  159. /**
  160. * (abstract) Protected helper method to write subclass entity data to NBT.
  161. */
  162. public void writeEntityToNBT(NBTTagCompound p_70014_1_) {
  163. super.writeEntityToNBT(p_70014_1_);
  164. p_70014_1_.setBoolean("Angry", this.isAngry());
  165. p_70014_1_.setByte("CollarColor", (byte) this.getCollarColor());
  166. }
  167.  
  168. /**
  169. * (abstract) Protected helper method to read subclass entity data from NBT.
  170. */
  171. public void readEntityFromNBT(NBTTagCompound p_70037_1_) {
  172. super.readEntityFromNBT(p_70037_1_);
  173. this.setAngry(p_70037_1_.getBoolean("Angry"));
  174.  
  175. if (p_70037_1_.hasKey("CollarColor", 99)) {
  176. this.setCollarColor(p_70037_1_.getByte("CollarColor"));
  177. }
  178. }
  179.  
  180. /**
  181. * Returns the sound this mob makes while it's alive.
  182. */
  183. public void updateEntityActionState() {
  184.  
  185. List list = worldObj.getEntitiesWithinAABB(EntityCreature.class,
  186. AxisAlignedBB.getBoundingBox(posX, posY, posZ, posX + 1, posY + 1, posZ + 1));
  187. for (int i = 0; i < list.size(); i++) {
  188. Entity entity = (Entity) list.get(i);
  189. if (!list.isEmpty()) {
  190. if (!(entity instanceof EntityPlayer)) {
  191. this.setTarget(entity);
  192. }
  193. }
  194. }
  195. super.updateEntityActionState();
  196. }
  197.  
  198. /**
  199. * Returns the volume for the sounds this mob makes.
  200. */
  201. protected float getSoundVolume() {
  202. return 0.4F;
  203. }
  204.  
  205. /**
  206. * Called frequently so the entity can update its state every tick as
  207. * required. For example, zombies and skeletons use this to react to
  208. * sunlight and start to burn.
  209. */
  210. public void onLivingUpdate() {
  211. super.onLivingUpdate();
  212.  
  213. if (!this.worldObj.isRemote && this.isShaking && !this.field_70928_h && !this.hasPath() && this.onGround) {
  214. this.field_70928_h = true;
  215. this.timeWolfIsShaking = 0.0F;
  216. this.prevTimeWolfIsShaking = 0.0F;
  217. this.worldObj.setEntityState(this, (byte) 8);
  218. }
  219. for (k = 0; k < 2; ++k) {
  220. this.worldObj.spawnParticle("enchantmenttable",
  221. this.posX + (this.rand.nextDouble() - 0.5D) * (double) this.width,
  222. this.posY + this.rand.nextDouble() * (double) this.height - 0.25D,
  223. this.posZ + (this.rand.nextDouble() - 0.5D) * (double) this.width,
  224. (this.rand.nextDouble() - 0.5D) * 2.0D, -this.rand.nextDouble(),
  225. (this.rand.nextDouble() - 0.5D) * 2.0D);
  226. }
  227. }
  228.  
  229. public void onUpdate() {
  230. super.onUpdate();
  231. this.field_70924_f = this.field_70926_e;
  232.  
  233. if (this.func_70922_bv()) {
  234. this.field_70926_e += (1.0F - this.field_70926_e) * 0.4F;
  235. } else {
  236. this.field_70926_e += (0.0F - this.field_70926_e) * 0.4F;
  237. }
  238.  
  239. if (this.func_70922_bv()) {
  240. this.numTicksToChaseTarget = 10;
  241. }
  242.  
  243. if (this.isWet()) {
  244. this.isShaking = true;
  245. this.field_70928_h = false;
  246. this.timeWolfIsShaking = 0.0F;
  247. this.prevTimeWolfIsShaking = 0.0F;
  248. } else if ((this.isShaking || this.field_70928_h) && this.field_70928_h) {
  249. if (this.timeWolfIsShaking == 0.0F) {
  250. this.playSound("mob.wolf.shake", this.getSoundVolume(),
  251. (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
  252. }
  253.  
  254. this.prevTimeWolfIsShaking = this.timeWolfIsShaking;
  255. this.timeWolfIsShaking += 0.05F;
  256.  
  257. if (this.prevTimeWolfIsShaking >= 2.0F) {
  258. this.isShaking = false;
  259. this.field_70928_h = false;
  260. this.prevTimeWolfIsShaking = 0.0F;
  261. this.timeWolfIsShaking = 0.0F;
  262. }
  263.  
  264. if (this.timeWolfIsShaking > 0.4F) {
  265. float f = (float) this.boundingBox.minY;
  266. int i = (int) (MathHelper.sin((this.timeWolfIsShaking - 0.4F) * (float) Math.PI) * 7.0F);
  267.  
  268. for (int j = 0; j < i; ++j) {
  269. float f1 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
  270. float f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
  271. this.worldObj.spawnParticle("splash", this.posX + (double) f1, (double) (f + 0.8F),
  272. this.posZ + (double) f2, this.motionX, this.motionY, this.motionZ);
  273. }
  274. }
  275. }
  276. }
  277.  
  278. @SideOnly(Side.CLIENT)
  279. public boolean getWolfShaking() {
  280. return this.isShaking;
  281. }
  282.  
  283. @SideOnly(Side.CLIENT)
  284. public float getShadingWhileShaking(float p_70915_1_) {
  285. return 0.75F + (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70915_1_)
  286. / 2.0F * 0.25F;
  287. }
  288.  
  289. @SideOnly(Side.CLIENT)
  290. public float getShakeAngle(float p_70923_1_, float p_70923_2_) {
  291. float f2 = (this.prevTimeWolfIsShaking + (this.timeWolfIsShaking - this.prevTimeWolfIsShaking) * p_70923_1_
  292. + p_70923_2_) / 1.8F;
  293.  
  294. if (f2 < 0.0F) {
  295. f2 = 0.0F;
  296. } else if (f2 > 1.0F) {
  297. f2 = 1.0F;
  298. }
  299.  
  300. return MathHelper.sin(f2 * (float) Math.PI) * MathHelper.sin(f2 * (float) Math.PI * 11.0F) * 0.15F
  301. * (float) Math.PI;
  302. }
  303.  
  304. public float getEyeHeight() {
  305. return this.height * 0.8F;
  306. }
  307.  
  308. @SideOnly(Side.CLIENT)
  309. public float getInterestedAngle(float p_70917_1_) {
  310. return (this.field_70924_f + (this.field_70926_e - this.field_70924_f) * p_70917_1_) * 0.15F * (float) Math.PI;
  311. }
  312.  
  313. /**
  314. * The speed it takes to move the entityliving's rotationPitch through the
  315. * faceEntity method. This is only currently use in wolves.
  316. */
  317. public int getVerticalFaceSpeed() {
  318. return this.isSitting() ? 20 : super.getVerticalFaceSpeed();
  319. }
  320.  
  321. public void VERIFICATION(boolean V) {
  322. System.out.println("Ligne lvl" + lvl);
  323. System.out.println("Tamed" + Tamed);
  324. }
  325.  
  326. /**
  327. * Called when the entity is attacked.
  328. */
  329. public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) {
  330. if (this.isEntityInvulnerable()) {
  331. return false;
  332. } else {
  333. Entity entity = p_70097_1_.getEntity();
  334. this.aiSit.setSitting(false);
  335.  
  336. if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) {
  337. p_70097_2_ = (p_70097_2_ + 1.0F) / 2.0F;
  338. }
  339.  
  340. return super.attackEntityFrom(p_70097_1_, p_70097_2_);
  341. }
  342. }
  343.  
  344. public boolean attackEntityAsMob(Entity p_70652_1_) {
  345. int i = this.isTamed() ? 4 : 2;
  346. return p_70652_1_.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
  347. }
  348.  
  349. public int setTamed(int p_70903_1_) {
  350.  
  351. if (this.lvl == 1) {
  352. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100.0D);
  353. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5D);
  354.  
  355. } else {
  356. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D);
  357. }
  358. if (this.lvl == 2) {
  359. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(200.0D);
  360. }
  361. return Tamed;
  362. }
  363.  
  364. /**
  365. * Called when a player interacts with a mob. e.g. gets milk from a cow,
  366. * gets into the saddle on a pig.
  367. */
  368. public boolean interact(EntityPlayer p_70085_1_) {
  369. ItemStack itemstack = p_70085_1_.inventory.getCurrentItem();
  370.  
  371. if (this.Tamed > 0 && this.lvl > 0) {
  372. if (itemstack != null) {
  373. if (itemstack.getItem() instanceof Baie) {
  374. Baie itemfood = (Baie) itemstack.getItem();
  375.  
  376. if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < 20.0F) {
  377. if (!p_70085_1_.capabilities.isCreativeMode) {
  378. --itemstack.stackSize;
  379. }
  380.  
  381. this.heal((float) itemfood.func_150905_g(itemstack));
  382.  
  383. if (itemstack.stackSize <= 0) {
  384. p_70085_1_.inventory.setInventorySlotContents(p_70085_1_.inventory.currentItem,
  385. (ItemStack) null);
  386. }
  387.  
  388. return true;
  389. }
  390. } else if (itemstack.getItem() == Items.dye) {
  391. int i = BlockColored.func_150032_b(itemstack.getItemDamage());
  392.  
  393. if (i != this.getCollarColor()) {
  394. this.setCollarColor(i);
  395.  
  396. if (!p_70085_1_.capabilities.isCreativeMode && --itemstack.stackSize <= 0) {
  397. p_70085_1_.inventory.setInventorySlotContents(p_70085_1_.inventory.currentItem,
  398. (ItemStack) null);
  399. }
  400.  
  401. return true;
  402. }
  403. }
  404. }
  405.  
  406. if (this.func_152114_e(p_70085_1_) && !this.worldObj.isRemote && !this.isBreedingItem(itemstack)) {
  407. this.aiSit.setSitting(!this.isSitting());
  408. this.isJumping = false;
  409. this.setPathToEntity((PathEntity) null);
  410. this.setTarget((Entity) null);
  411. this.setAttackTarget((EntityLivingBase) null);
  412. }
  413. } else if (itemstack != null && itemstack.getItem() == enderdeath.GoldenCroquette) {
  414. this.Tamed = 1;
  415. this.lvl = 2;
  416. this.setTamed(1);
  417. this.isTamed();
  418. this.setTamed(true);
  419.  
  420. System.out.println("je suis dans le else if ");
  421. if (!p_70085_1_.capabilities.isCreativeMode) {
  422. --itemstack.stackSize;
  423. System.out.println("je suis dans le if !p_70085_1_.capabilities.isCreativeMode");
  424. }
  425.  
  426. if (itemstack.stackSize <= 0) {
  427. p_70085_1_.inventory.setInventorySlotContents(p_70085_1_.inventory.currentItem, (ItemStack) null);
  428. System.out.println("je suis dans le if p_70085_1_.inventory.setInventorySlotContents(p_70085_1_.inventory.currentItem, (ItemStack) null); ");
  429. }
  430.  
  431. if (!this.worldObj.isRemote) {
  432. if (this.rand.nextInt(3) == 0) {
  433.  
  434. System.out.println( "TEST"+ this.isTamedA());
  435.  
  436. this.setTamed(1);
  437. this.isTamed();
  438. this.setTamed(true);
  439. this.setPathToEntity((PathEntity) null);
  440. this.setAttackTarget((EntityLivingBase) null);
  441. this.aiSit.setSitting(true);
  442. this.func_152115_b(p_70085_1_.getUniqueID().toString());
  443. this.playTameEffect(true);
  444. this.worldObj.setEntityState(this, (byte) 7);
  445.  
  446.  
  447. } else {
  448. this.playTameEffect(false);
  449. this.worldObj.setEntityState(this, (byte) 6);
  450. }
  451. } else if (itemstack != null && itemstack.getItem() == enderdeath.RubisCroquette && this.isTamed() && this.lvl == 2) {
  452. System.out.println("GAGNE");
  453. if (!p_70085_1_.capabilities.isCreativeMode) {
  454. --itemstack.stackSize;
  455. }
  456.  
  457. if (itemstack.stackSize <= 0) {
  458. p_70085_1_.inventory.setInventorySlotContents(p_70085_1_.inventory.currentItem, (ItemStack) null);
  459. }
  460.  
  461. if (!this.worldObj.isRemote) {
  462. if (this.rand.nextInt(3) == 0) {
  463.  
  464. this.setPathToEntity((PathEntity) null);
  465. this.setAttackTarget((EntityLivingBase) null);
  466. this.aiSit.setSitting(true);
  467. System.out.println("GAGNE");
  468. this.setHealth(20.0F);
  469. this.func_152115_b(p_70085_1_.getUniqueID().toString());
  470. this.playTameEffect(true);
  471. this.worldObj.setEntityState(this, (byte) 7);
  472. this.setTamed(2);
  473. } else {
  474. this.playTameEffect(false);
  475. this.worldObj.setEntityState(this, (byte) 6);
  476. }
  477. }
  478. }
  479. return true;
  480. }
  481.  
  482. return super.interact(p_70085_1_);
  483. }
  484. public boolean isTamedA()
  485. {
  486. return this.isTamed();
  487. }
  488. @SideOnly(Side.CLIENT)
  489. public void handleHealthUpdate(byte p_70103_1_) {
  490. if (p_70103_1_ == 8) {
  491. this.field_70928_h = true;
  492. this.timeWolfIsShaking = 0.0F;
  493. this.prevTimeWolfIsShaking = 0.0F;
  494. } else {
  495. super.handleHealthUpdate(p_70103_1_);
  496. }
  497. }
  498.  
  499. @SideOnly(Side.CLIENT)
  500. public float getTailRotation() {
  501. return this.isAngry() ? 1.5393804F
  502. : (this.isTamed()
  503. ? (0.55F - (20.0F - this.dataWatcher.getWatchableObjectFloat(18)) * 0.02F) * (float) Math.PI
  504. : ((float) Math.PI / 5F));
  505. }
  506.  
  507. public boolean isBreedingItem(ItemStack p_70877_1_) {
  508. return p_70877_1_ == null ? false
  509. : (!(p_70877_1_.getItem() instanceof Baie) ? false
  510. : ((Baie) p_70877_1_.getItem()).isWolfsFavoriteMeat());
  511. }
  512.  
  513. public boolean isAngry() {
  514. return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0;
  515. }
  516.  
  517. public void setAngry(boolean p_70916_1_) {
  518. byte b0 = this.dataWatcher.getWatchableObjectByte(16);
  519.  
  520. if (p_70916_1_) {
  521. this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2)));
  522. } else {
  523. this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3)));
  524. }
  525. }
  526.  
  527. public int getCollarColor() {
  528. return this.dataWatcher.getWatchableObjectByte(20) & 15;
  529. }
  530.  
  531. public void setCollarColor(int p_82185_1_) {
  532. this.dataWatcher.updateObject(20, Byte.valueOf((byte) (p_82185_1_ & 15)));
  533. }
  534.  
  535. public Familiar createChild(EntityAgeable p_90011_1_) {
  536. Familiar entitywolf = new Familiar(this.worldObj);
  537. String s = this.func_152113_b();
  538.  
  539. if (s != null && s.trim().length() > 0) {
  540. entitywolf.func_152115_b(s);
  541. if (this.Tamed >= 1)
  542. ;
  543. }
  544.  
  545. return entitywolf;
  546. }
  547.  
  548. public void func_70918_i(boolean p_70918_1_) {
  549. if (p_70918_1_) {
  550. this.dataWatcher.updateObject(19, Byte.valueOf((byte) 1));
  551. } else {
  552. this.dataWatcher.updateObject(19, Byte.valueOf((byte) 0));
  553. }
  554. }
  555.  
  556. /**
  557. * Returns true if the mob is currently able to mate with the specified mob.
  558. */
  559. public boolean canMateWith(EntityAnimal p_70878_1_) {
  560. if (p_70878_1_ == this) {
  561. return false;
  562. } else if (!this.isTamed()) {
  563. return false;
  564. } else if (!(p_70878_1_ instanceof Familiar)) {
  565. return false;
  566. } else {
  567. Familiar entitywolf = (Familiar) p_70878_1_;
  568. return !entitywolf.isTamed() ? false
  569. : (entitywolf.isSitting() ? false : this.isInLove() && entitywolf.isInLove());
  570. }
  571. }
  572.  
  573. public boolean func_70922_bv() {
  574. return this.dataWatcher.getWatchableObjectByte(19) == 1;
  575. }
  576.  
  577. /**
  578. * Determines if an entity can be despawned, used on idle far away entities
  579. */
  580. protected boolean canDespawn() {
  581. return !this.isTamed() && this.ticksExisted > 2400;
  582. }
  583.  
  584. public boolean func_142018_a(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_) {
  585. if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast)) {
  586. if (p_142018_1_ instanceof Familiar) {
  587. Familiar entitywolf = (Familiar) p_142018_1_;
  588.  
  589. if (entitywolf.isTamed() && entitywolf.getOwner() == p_142018_2_) {
  590. return false;
  591. }
  592. }
  593.  
  594. return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer
  595. && !((EntityPlayer) p_142018_2_).canAttackPlayer((EntityPlayer) p_142018_1_) ? false
  596. : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse) p_142018_1_).isTame();
  597. } else {
  598. return false;
  599. }
  600. }
  601. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement