Advertisement
Guest User

Guardian

a guest
Jun 28th, 2015
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.79 KB | None | 0 0
  1. public class EntityGuardian extends EntityMob
  2. {
  3. private float field_175482_b;
  4. private float field_175484_c;
  5. private float field_175483_bk;
  6. private float field_175485_bl;
  7. private float field_175486_bm;
  8. private EntityLivingBase field_175478_bn;
  9. private int field_175479_bo;
  10. private boolean field_175480_bp;
  11. private EntityAIWander wander;
  12. private static final String __OBFID = "CL_00002213";
  13.  
  14. public EntityGuardian(World worldIn)
  15. {
  16. super(worldIn);
  17. this.experienceValue = 10;
  18. this.setSize(0.85F, 0.85F);
  19. this.tasks.addTask(4, new EntityGuardian.AIGuardianAttack());
  20. EntityAIMoveTowardsRestriction entityaimovetowardsrestriction;
  21. this.tasks.addTask(5, entityaimovetowardsrestriction = new EntityAIMoveTowardsRestriction(this, 1.0D));
  22. this.tasks.addTask(7, this.wander = new EntityAIWander(this, 1.0D, 80));
  23. this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
  24. this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityGuardian.class, 12.0F, 0.01F));
  25. this.tasks.addTask(9, new EntityAILookIdle(this));
  26. this.wander.setMutexBits(3);
  27. entityaimovetowardsrestriction.setMutexBits(3);
  28. this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityLivingBase.class, 10, true, false, new EntityGuardian.GuardianTargetSelector()));
  29. this.moveHelper = new EntityGuardian.GuardianMoveHelper();
  30. this.field_175484_c = this.field_175482_b = this.rand.nextFloat();
  31. }
  32.  
  33. protected void applyEntityAttributes()
  34. {
  35. super.applyEntityAttributes();
  36. this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(6.0D);
  37. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5D);
  38. this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(16.0D);
  39. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30.0D);
  40. }
  41.  
  42. public void readEntityFromNBT(NBTTagCompound tagCompund)
  43. {
  44. super.readEntityFromNBT(tagCompund);
  45. this.func_175467_a(tagCompund.getBoolean("Elder"));
  46. }
  47.  
  48. public void writeEntityToNBT(NBTTagCompound tagCompound)
  49. {
  50. super.writeEntityToNBT(tagCompound);
  51. tagCompound.setBoolean("Elder", this.isElder());
  52. }
  53.  
  54. protected PathNavigate func_175447_b(World worldIn)
  55. {
  56. return new PathNavigateSwimmer(this, worldIn);
  57. }
  58.  
  59. protected void entityInit()
  60. {
  61. super.entityInit();
  62. this.dataWatcher.addObject(16, Integer.valueOf(0));
  63. this.dataWatcher.addObject(17, Integer.valueOf(0));
  64. }
  65.  
  66. private boolean func_175468_a(int p_175468_1_)
  67. {
  68. return (this.dataWatcher.getWatchableObjectInt(16) & p_175468_1_) != 0;
  69. }
  70.  
  71. private void func_175473_a(int p_175473_1_, boolean p_175473_2_)
  72. {
  73. int j = this.dataWatcher.getWatchableObjectInt(16);
  74.  
  75. if (p_175473_2_)
  76. {
  77. this.dataWatcher.updateObject(16, Integer.valueOf(j | p_175473_1_));
  78. }
  79. else
  80. {
  81. this.dataWatcher.updateObject(16, Integer.valueOf(j & ~p_175473_1_));
  82. }
  83. }
  84.  
  85. public boolean func_175472_n()
  86. {
  87. return this.func_175468_a(2);
  88. }
  89.  
  90. private void func_175476_l(boolean p_175476_1_)
  91. {
  92. this.func_175473_a(2, p_175476_1_);
  93. }
  94.  
  95. public int func_175464_ck()
  96. {
  97. return this.isElder() ? 60 : 80;
  98. }
  99.  
  100. public boolean isElder()
  101. {
  102. return this.func_175468_a(4);
  103. }
  104.  
  105. public void func_175467_a(boolean p_175467_1_)
  106. {
  107. this.func_175473_a(4, p_175467_1_);
  108.  
  109. if (p_175467_1_)
  110. {
  111. this.setSize(1.9975F, 1.9975F);
  112. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D);
  113. this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(8.0D);
  114. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(80.0D);
  115. this.enablePersistence();
  116. this.wander.func_179479_b(400);
  117. }
  118. }
  119.  
  120. @SideOnly(Side.CLIENT)
  121. public void func_175465_cm()
  122. {
  123. this.func_175467_a(true);
  124. this.field_175486_bm = this.field_175485_bl = 1.0F;
  125. }
  126.  
  127. private void func_175463_b(int p_175463_1_)
  128. {
  129. this.dataWatcher.updateObject(17, Integer.valueOf(p_175463_1_));
  130. }
  131.  
  132. public boolean func_175474_cn()
  133. {
  134. return this.dataWatcher.getWatchableObjectInt(17) != 0;
  135. }
  136.  
  137. public EntityLivingBase getTargetedEntity()
  138. {
  139. if (!this.func_175474_cn())
  140. {
  141. return null;
  142. }
  143. else if (this.worldObj.isRemote)
  144. {
  145. if (this.field_175478_bn != null)
  146. {
  147. return this.field_175478_bn;
  148. }
  149. else
  150. {
  151. Entity entity = this.worldObj.getEntityByID(this.dataWatcher.getWatchableObjectInt(17));
  152.  
  153. if (entity instanceof EntityLivingBase)
  154. {
  155. this.field_175478_bn = (EntityLivingBase)entity;
  156. return this.field_175478_bn;
  157. }
  158. else
  159. {
  160. return null;
  161. }
  162. }
  163. }
  164. else
  165. {
  166. return this.getAttackTarget();
  167. }
  168. }
  169.  
  170. public void func_145781_i(int p_145781_1_)
  171. {
  172. super.func_145781_i(p_145781_1_);
  173.  
  174. if (p_145781_1_ == 16)
  175. {
  176. if (this.isElder() && this.width < 1.0F)
  177. {
  178. this.setSize(1.9975F, 1.9975F);
  179. }
  180. }
  181. else if (p_145781_1_ == 17)
  182. {
  183. this.field_175479_bo = 0;
  184. this.field_175478_bn = null;
  185. }
  186. }
  187.  
  188. public int getTalkInterval()
  189. {
  190. return 160;
  191. }
  192.  
  193. protected String getLivingSound()
  194. {
  195. return !this.isInWater() ? "mob.guardian.land.idle" : (this.isElder() ? "mob.guardian.elder.idle" : "mob.guardian.idle");
  196. }
  197.  
  198. protected String getHurtSound()
  199. {
  200. return !this.isInWater() ? "mob.guardian.land.hit" : (this.isElder() ? "mob.guardian.elder.hit" : "mob.guardian.hit");
  201. }
  202.  
  203. protected String getDeathSound()
  204. {
  205. return !this.isInWater() ? "mob.guardian.land.death" : (this.isElder() ? "mob.guardian.elder.death" : "mob.guardian.death");
  206. }
  207.  
  208. protected boolean canTriggerWalking()
  209. {
  210. return false;
  211. }
  212.  
  213. public float getEyeHeight()
  214. {
  215. return this.height * 0.5F;
  216. }
  217.  
  218. public float func_180484_a(BlockPos p_180484_1_)
  219. {
  220. return this.worldObj.getBlockState(p_180484_1_).getBlock().getMaterial() == Material.water ? 10.0F + this.worldObj.getLightBrightness(p_180484_1_) - 0.5F : super.func_180484_a(p_180484_1_);
  221. }
  222.  
  223. public void onLivingUpdate()
  224. {
  225. if (this.worldObj.isRemote)
  226. {
  227. this.field_175484_c = this.field_175482_b;
  228.  
  229. if (!this.isInWater())
  230. {
  231. this.field_175483_bk = 2.0F;
  232.  
  233. if (this.motionY > 0.0D && this.field_175480_bp && !this.isSilent())
  234. {
  235. this.worldObj.playSound(this.posX, this.posY, this.posZ, "mob.guardian.flop", 1.0F, 1.0F, false);
  236. }
  237.  
  238. this.field_175480_bp = this.motionY < 0.0D && this.worldObj.isBlockNormalCube((new BlockPos(this)).down(), false);
  239. }
  240. else if (this.func_175472_n())
  241. {
  242. if (this.field_175483_bk < 0.5F)
  243. {
  244. this.field_175483_bk = 4.0F;
  245. }
  246. else
  247. {
  248. this.field_175483_bk += (0.5F - this.field_175483_bk) * 0.1F;
  249. }
  250. }
  251. else
  252. {
  253. this.field_175483_bk += (0.125F - this.field_175483_bk) * 0.2F;
  254. }
  255.  
  256. this.field_175482_b += this.field_175483_bk;
  257. this.field_175486_bm = this.field_175485_bl;
  258.  
  259. if (!this.isInWater())
  260. {
  261. this.field_175485_bl = this.rand.nextFloat();
  262. }
  263. else if (this.func_175472_n())
  264. {
  265. this.field_175485_bl += (0.0F - this.field_175485_bl) * 0.25F;
  266. }
  267. else
  268. {
  269. this.field_175485_bl += (1.0F - this.field_175485_bl) * 0.06F;
  270. }
  271.  
  272. if (this.func_175472_n() && this.isInWater())
  273. {
  274. Vec3 vec3 = this.getLook(0.0F);
  275.  
  276. for (int i = 0; i < 2; ++i)
  277. {
  278. this.worldObj.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width - vec3.xCoord * 1.5D, this.posY + this.rand.nextDouble() * (double)this.height - vec3.yCoord * 1.5D, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width - vec3.zCoord * 1.5D, 0.0D, 0.0D, 0.0D, new int[0]);
  279. }
  280. }
  281.  
  282. if (this.func_175474_cn())
  283. {
  284. if (this.field_175479_bo < this.func_175464_ck())
  285. {
  286. ++this.field_175479_bo;
  287. }
  288.  
  289. EntityLivingBase entitylivingbase = this.getTargetedEntity();
  290.  
  291. if (entitylivingbase != null)
  292. {
  293. this.getLookHelper().setLookPositionWithEntity(entitylivingbase, 90.0F, 90.0F);
  294. this.getLookHelper().onUpdateLook();
  295. double d5 = (double)this.func_175477_p(0.0F);
  296. double d0 = entitylivingbase.posX - this.posX;
  297. double d1 = entitylivingbase.posY + (double)(entitylivingbase.height * 0.5F) - (this.posY + (double)this.getEyeHeight());
  298. double d2 = entitylivingbase.posZ - this.posZ;
  299. double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
  300. d0 /= d3;
  301. d1 /= d3;
  302. d2 /= d3;
  303. double d4 = this.rand.nextDouble();
  304.  
  305. while (d4 < d3)
  306. {
  307. d4 += 1.8D - d5 + this.rand.nextDouble() * (1.7D - d5);
  308. this.worldObj.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX + d0 * d4, this.posY + d1 * d4 + (double)this.getEyeHeight(), this.posZ + d2 * d4, 0.0D, 0.0D, 0.0D, new int[0]);
  309. }
  310. }
  311. }
  312. }
  313.  
  314. if (this.inWater)
  315. {
  316. this.setAir(300);
  317. }
  318. else if (this.onGround)
  319. {
  320. this.motionY += 0.5D;
  321. this.motionX += (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 0.4F);
  322. this.motionZ += (double)((this.rand.nextFloat() * 2.0F - 1.0F) * 0.4F);
  323. this.rotationYaw = this.rand.nextFloat() * 360.0F;
  324. this.onGround = false;
  325. this.isAirBorne = true;
  326. }
  327.  
  328. if (this.func_175474_cn())
  329. {
  330. this.rotationYaw = this.rotationYawHead;
  331. }
  332.  
  333. super.onLivingUpdate();
  334. }
  335.  
  336. @SideOnly(Side.CLIENT)
  337. public float func_175471_a(float p_175471_1_)
  338. {
  339. return this.field_175484_c + (this.field_175482_b - this.field_175484_c) * p_175471_1_;
  340. }
  341.  
  342. @SideOnly(Side.CLIENT)
  343. public float func_175469_o(float p_175469_1_)
  344. {
  345. return this.field_175486_bm + (this.field_175485_bl - this.field_175486_bm) * p_175469_1_;
  346. }
  347.  
  348. public float func_175477_p(float p_175477_1_)
  349. {
  350. return ((float)this.field_175479_bo + p_175477_1_) / (float)this.func_175464_ck();
  351. }
  352.  
  353. protected void updateAITasks()
  354. {
  355. super.updateAITasks();
  356.  
  357. if (this.isElder())
  358. {
  359. boolean flag = true;
  360. boolean flag1 = true;
  361. boolean flag2 = true;
  362. boolean flag3 = true;
  363.  
  364. if ((this.ticksExisted + this.getEntityId()) % 1200 == 0)
  365. {
  366. Potion potion = Potion.digSlowdown;
  367. List list = this.worldObj.getPlayers(EntityPlayerMP.class, new Predicate()
  368. {
  369. private static final String __OBFID = "CL_00002212";
  370. public boolean func_179913_a(EntityPlayerMP p_179913_1_)
  371. {
  372. return EntityGuardian.this.getDistanceSqToEntity(p_179913_1_) < 2500.0D && p_179913_1_.theItemInWorldManager.func_180239_c();
  373. }
  374. public boolean apply(Object p_apply_1_)
  375. {
  376. return this.func_179913_a((EntityPlayerMP)p_apply_1_);
  377. }
  378. });
  379. Iterator iterator = list.iterator();
  380.  
  381. while (iterator.hasNext())
  382. {
  383. EntityPlayerMP entityplayermp = (EntityPlayerMP)iterator.next();
  384.  
  385. if (!entityplayermp.isPotionActive(potion) || entityplayermp.getActivePotionEffect(potion).getAmplifier() < 2 || entityplayermp.getActivePotionEffect(potion).getDuration() < 1200)
  386. {
  387. entityplayermp.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(10, 0.0F));
  388. entityplayermp.addPotionEffect(new PotionEffect(potion.id, 6000, 2));
  389. }
  390. }
  391. }
  392.  
  393. if (!this.hasHome())
  394. {
  395. this.func_175449_a(new BlockPos(this), 16);
  396. }
  397. }
  398. }
  399.  
  400. protected void dropFewItems(boolean p_70628_1_, int p_70628_2_)
  401. {
  402. int j = this.rand.nextInt(3) + this.rand.nextInt(p_70628_2_ + 1);
  403.  
  404. if (j > 0)
  405. {
  406. this.entityDropItem(new ItemStack(Items.prismarine_shard, j, 0), 1.0F);
  407. }
  408.  
  409. if (this.rand.nextInt(3 + p_70628_2_) > 1)
  410. {
  411. this.entityDropItem(new ItemStack(Items.fish, 1, ItemFishFood.FishType.COD.getMetadata()), 1.0F);
  412. }
  413. else if (this.rand.nextInt(3 + p_70628_2_) > 1)
  414. {
  415. this.entityDropItem(new ItemStack(Items.prismarine_crystals, 1, 0), 1.0F);
  416. }
  417.  
  418. if (p_70628_1_ && this.isElder())
  419. {
  420. this.entityDropItem(new ItemStack(Blocks.sponge, 1, 1), 1.0F);
  421. }
  422. }
  423.  
  424. protected void addRandomArmor()
  425. {
  426. ItemStack itemstack = ((WeightedRandomFishable)WeightedRandom.getRandomItem(this.rand, EntityFishHook.func_174855_j())).getItemStack(this.rand);
  427. this.entityDropItem(itemstack, 1.0F);
  428. }
  429.  
  430. protected boolean isValidLightLevel()
  431. {
  432. return true;
  433. }
  434.  
  435. public boolean handleLavaMovement()
  436. {
  437. return this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox(), this) && this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty();
  438. }
  439.  
  440. public boolean getCanSpawnHere()
  441. {
  442. return (this.rand.nextInt(20) == 0 || !this.worldObj.canBlockSeeSky(new BlockPos(this))) && super.getCanSpawnHere();
  443. }
  444.  
  445. public boolean attackEntityFrom(DamageSource source, float amount)
  446. {
  447. if (!this.func_175472_n() && !source.isMagicDamage() && source.getSourceOfDamage() instanceof EntityLivingBase)
  448. {
  449. EntityLivingBase entitylivingbase = (EntityLivingBase)source.getSourceOfDamage();
  450.  
  451. if (!source.isExplosion())
  452. {
  453. entitylivingbase.attackEntityFrom(DamageSource.causeThornsDamage(this), 2.0F);
  454. entitylivingbase.playSound("damage.thorns", 0.5F, 1.0F);
  455. }
  456. }
  457.  
  458. this.wander.func_179480_f();
  459. return super.attackEntityFrom(source, amount);
  460. }
  461.  
  462. public int getVerticalFaceSpeed()
  463. {
  464. return 180;
  465. }
  466.  
  467. public void moveEntityWithHeading(float p_70612_1_, float p_70612_2_)
  468. {
  469. if (this.isServerWorld())
  470. {
  471. if (this.isInWater())
  472. {
  473. this.moveFlying(p_70612_1_, p_70612_2_, 0.1F);
  474. this.moveEntity(this.motionX, this.motionY, this.motionZ);
  475. this.motionX *= 0.8999999761581421D;
  476. this.motionY *= 0.8999999761581421D;
  477. this.motionZ *= 0.8999999761581421D;
  478.  
  479. if (!this.func_175472_n() && this.getAttackTarget() == null)
  480. {
  481. this.motionY -= 0.005D;
  482. }
  483. }
  484. else
  485. {
  486. super.moveEntityWithHeading(p_70612_1_, p_70612_2_);
  487. }
  488. }
  489. else
  490. {
  491. super.moveEntityWithHeading(p_70612_1_, p_70612_2_);
  492. }
  493. }
  494.  
  495. class AIGuardianAttack extends EntityAIBase
  496. {
  497. private EntityGuardian field_179456_a = EntityGuardian.this;
  498. private int field_179455_b;
  499. private static final String __OBFID = "CL_00002211";
  500.  
  501. public AIGuardianAttack()
  502. {
  503. this.setMutexBits(3);
  504. }
  505.  
  506. public boolean shouldExecute()
  507. {
  508. EntityLivingBase entitylivingbase = this.field_179456_a.getAttackTarget();
  509. return entitylivingbase != null && entitylivingbase.isEntityAlive();
  510. }
  511.  
  512. public boolean continueExecuting()
  513. {
  514. return super.continueExecuting() && (this.field_179456_a.isElder() || this.field_179456_a.getDistanceSqToEntity(this.field_179456_a.getAttackTarget()) > 9.0D);
  515. }
  516.  
  517. public void startExecuting()
  518. {
  519. this.field_179455_b = -10;
  520. this.field_179456_a.getNavigator().clearPathEntity();
  521. this.field_179456_a.getLookHelper().setLookPositionWithEntity(this.field_179456_a.getAttackTarget(), 90.0F, 90.0F);
  522. this.field_179456_a.isAirBorne = true;
  523. }
  524.  
  525. public void resetTask()
  526. {
  527. this.field_179456_a.func_175463_b(0);
  528. this.field_179456_a.setAttackTarget((EntityLivingBase)null);
  529. this.field_179456_a.wander.func_179480_f();
  530. }
  531.  
  532. public void updateTask()
  533. {
  534. EntityLivingBase entitylivingbase = this.field_179456_a.getAttackTarget();
  535. this.field_179456_a.getNavigator().clearPathEntity();
  536. this.field_179456_a.getLookHelper().setLookPositionWithEntity(entitylivingbase, 90.0F, 90.0F);
  537.  
  538. if (!this.field_179456_a.canEntityBeSeen(entitylivingbase))
  539. {
  540. this.field_179456_a.setAttackTarget((EntityLivingBase)null);
  541. }
  542. else
  543. {
  544. ++this.field_179455_b;
  545.  
  546. if (this.field_179455_b == 0)
  547. {
  548. this.field_179456_a.func_175463_b(this.field_179456_a.getAttackTarget().getEntityId());
  549. this.field_179456_a.worldObj.setEntityState(this.field_179456_a, (byte)21);
  550. }
  551. else if (this.field_179455_b >= this.field_179456_a.func_175464_ck())
  552. {
  553. float f = 1.0F;
  554.  
  555. if (this.field_179456_a.worldObj.getDifficulty() == EnumDifficulty.HARD)
  556. {
  557. f += 2.0F;
  558. }
  559.  
  560. if (this.field_179456_a.isElder())
  561. {
  562. f += 2.0F;
  563. }
  564.  
  565. entitylivingbase.attackEntityFrom(DamageSource.causeIndirectMagicDamage(this.field_179456_a, this.field_179456_a), f);
  566. entitylivingbase.attackEntityFrom(DamageSource.causeMobDamage(this.field_179456_a), (float)this.field_179456_a.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue());
  567. this.field_179456_a.setAttackTarget((EntityLivingBase)null);
  568. }
  569. else if (this.field_179455_b >= 60 && this.field_179455_b % 20 == 0)
  570. {
  571. ;
  572. }
  573.  
  574. super.updateTask();
  575. }
  576. }
  577. }
  578.  
  579. class GuardianMoveHelper extends EntityMoveHelper
  580. {
  581. private EntityGuardian field_179930_g = EntityGuardian.this;
  582. private static final String __OBFID = "CL_00002209";
  583.  
  584. public GuardianMoveHelper()
  585. {
  586. super(EntityGuardian.this);
  587. }
  588.  
  589. public void onUpdateMoveHelper()
  590. {
  591. if (this.update && !this.field_179930_g.getNavigator().noPath())
  592. {
  593. double d0 = this.posX - this.field_179930_g.posX;
  594. double d1 = this.posY - this.field_179930_g.posY;
  595. double d2 = this.posZ - this.field_179930_g.posZ;
  596. double d3 = d0 * d0 + d1 * d1 + d2 * d2;
  597. d3 = (double)MathHelper.sqrt_double(d3);
  598. d1 /= d3;
  599. float f = (float)(Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F;
  600. this.field_179930_g.rotationYaw = this.limitAngle(this.field_179930_g.rotationYaw, f, 30.0F);
  601. this.field_179930_g.renderYawOffset = this.field_179930_g.rotationYaw;
  602. float f1 = (float)(this.speed * this.field_179930_g.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue());
  603. this.field_179930_g.setAIMoveSpeed(this.field_179930_g.getAIMoveSpeed() + (f1 - this.field_179930_g.getAIMoveSpeed()) * 0.125F);
  604. double d4 = Math.sin((double)(this.field_179930_g.ticksExisted + this.field_179930_g.getEntityId()) * 0.5D) * 0.05D;
  605. double d5 = Math.cos((double)(this.field_179930_g.rotationYaw * (float)Math.PI / 180.0F));
  606. double d6 = Math.sin((double)(this.field_179930_g.rotationYaw * (float)Math.PI / 180.0F));
  607. this.field_179930_g.motionX += d4 * d5;
  608. this.field_179930_g.motionZ += d4 * d6;
  609. d4 = Math.sin((double)(this.field_179930_g.ticksExisted + this.field_179930_g.getEntityId()) * 0.75D) * 0.05D;
  610. this.field_179930_g.motionY += d4 * (d6 + d5) * 0.25D;
  611. this.field_179930_g.motionY += (double)this.field_179930_g.getAIMoveSpeed() * d1 * 0.1D;
  612. EntityLookHelper entitylookhelper = this.field_179930_g.getLookHelper();
  613. double d7 = this.field_179930_g.posX + d0 / d3 * 2.0D;
  614. double d8 = (double)this.field_179930_g.getEyeHeight() + this.field_179930_g.posY + d1 / d3 * 1.0D;
  615. double d9 = this.field_179930_g.posZ + d2 / d3 * 2.0D;
  616. double d10 = entitylookhelper.func_180423_e();
  617. double d11 = entitylookhelper.func_180422_f();
  618. double d12 = entitylookhelper.func_180421_g();
  619.  
  620. if (!entitylookhelper.func_180424_b())
  621. {
  622. d10 = d7;
  623. d11 = d8;
  624. d12 = d9;
  625. }
  626.  
  627. this.field_179930_g.getLookHelper().setLookPosition(d10 + (d7 - d10) * 0.125D, d11 + (d8 - d11) * 0.125D, d12 + (d9 - d12) * 0.125D, 10.0F, 40.0F);
  628. this.field_179930_g.func_175476_l(true);
  629. }
  630. else
  631. {
  632. this.field_179930_g.setAIMoveSpeed(0.0F);
  633. this.field_179930_g.func_175476_l(false);
  634. }
  635. }
  636. }
  637.  
  638. class GuardianTargetSelector implements Predicate
  639. {
  640. private EntityGuardian field_179916_a = EntityGuardian.this;
  641. private static final String __OBFID = "CL_00002210";
  642.  
  643. public boolean func_179915_a(EntityLivingBase p_179915_1_)
  644. {
  645. return (p_179915_1_ instanceof EntityPlayer || p_179915_1_ instanceof EntitySquid) && p_179915_1_.getDistanceSqToEntity(this.field_179916_a) > 9.0D;
  646. }
  647.  
  648. public boolean apply(Object p_apply_1_)
  649. {
  650. return this.func_179915_a((EntityLivingBase)p_apply_1_);
  651. }
  652. }
  653. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement