Advertisement
Guest User

Untitled

a guest
Jun 26th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.49 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.Item.Croquette;
  10. import ed.enderdeath.mod.common.enderdeath;
  11. import net.minecraft.block.Block;
  12. import net.minecraft.block.BlockColored;
  13. import net.minecraft.entity.Entity;
  14. import net.minecraft.entity.EntityAgeable;
  15. import net.minecraft.entity.EntityCreature;
  16. import net.minecraft.entity.EntityLivingBase;
  17. import net.minecraft.entity.SharedMonsterAttributes;
  18. import net.minecraft.entity.ai.EntityAIAttackOnCollide;
  19. import net.minecraft.entity.ai.EntityAIFollowOwner;
  20. import net.minecraft.entity.ai.EntityAIHurtByTarget;
  21. import net.minecraft.entity.ai.EntityAILeapAtTarget;
  22. import net.minecraft.entity.ai.EntityAILookIdle;
  23. import net.minecraft.entity.ai.EntityAIMate;
  24. import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
  25. import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
  26. import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
  27. import net.minecraft.entity.ai.EntityAISwimming;
  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.IMob;
  35. import net.minecraft.entity.passive.EntityAnimal;
  36. import net.minecraft.entity.passive.EntityHorse;
  37. import net.minecraft.entity.passive.EntitySheep;
  38. import net.minecraft.entity.passive.EntityTameable;
  39. import net.minecraft.entity.player.EntityPlayer;
  40. import net.minecraft.entity.projectile.EntityArrow;
  41. import net.minecraft.item.ItemStack;
  42. import net.minecraft.nbt.NBTTagCompound;
  43. import net.minecraft.pathfinding.PathEntity;
  44. import net.minecraft.potion.Potion;
  45. import net.minecraft.potion.PotionEffect;
  46. import net.minecraft.realms.RealmsAnvilLevelStorageSource;
  47. import net.minecraft.util.AxisAlignedBB;
  48. import net.minecraft.util.DamageSource;
  49. import net.minecraft.util.MathHelper;
  50. import net.minecraft.util.ResourceLocation;
  51. import net.minecraft.world.World;
  52.  
  53. public class Familiar extends EntityTameable implements IMob, IBossDisplayData {
  54.  
  55. private float field_70926_e;
  56. private float field_70924_f;
  57. /** true is the wolf is wet else false */
  58. private boolean isShaking;
  59. private boolean field_70928_h;
  60. private float timeWolfIsShaking;
  61. private float prevTimeWolfIsShaking;
  62. public int lvl = 0;
  63. private static final String __OBFID = "CL_00001654";
  64. private static RenderFamiliar render;
  65.  
  66. private World world;
  67. private int x;
  68. private int y;
  69. private int z;
  70. private Random random;
  71. private int short1;
  72. private double d3;
  73. private double d4;
  74. private double d5;
  75. private int rubis;
  76. private int k = 3;
  77. private int ultime = 5;
  78. private EntityLivingBase p_70624_1_;
  79. private EntityPlayer player;
  80.  
  81. private int fire;
  82. private int blue;
  83. private int dirt;
  84. private int ender;
  85. private EntityPlayer propietaire;
  86. private int skin;
  87.  
  88. private ResourceLocation ressource;
  89.  
  90. public Familiar(World p_i1696_1_) {
  91. super(p_i1696_1_);
  92. this.setSize(0.6F, 0.8F);
  93. this.getNavigator().setAvoidsWater(true);
  94. this.tasks.addTask(1, new EntityAISwimming(this));
  95. this.tasks.addTask(2, this.aiSit);
  96.  
  97. this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
  98. this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true));
  99. this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
  100. this.tasks.addTask(6, new EntityAIMate(this, 1.0D));
  101. this.tasks.addTask(7, new EntityAIWander(this, 1.0D));
  102.  
  103. this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
  104. this.tasks.addTask(9, new EntityAILookIdle(this));
  105. this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
  106. this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
  107. this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true));
  108. this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntitySheep.class, 200, false));
  109.  
  110. this.targetTasks.addTask(6, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 3, true));
  111.  
  112. }
  113.  
  114. protected void applyEntityAttributes() {
  115. super.applyEntityAttributes();
  116. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D);
  117.  
  118. if (this.isTamed()) {
  119. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(5.0D);
  120. } else {
  121. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D);
  122. }
  123. }
  124.  
  125. /**
  126. * Returns true if the newer Entity AI code should be run
  127. */
  128. public boolean isAIEnabled() {
  129. return true;
  130. }
  131.  
  132. /**
  133. * Sets the active target the Task system uses for tracking
  134. */
  135. public void setAttackTarget(EntityLivingBase p_70624_1_) {
  136. super.setAttackTarget(p_70624_1_);
  137.  
  138. if (p_70624_1_ == null) {
  139. this.setAngry(false);
  140. } else if (!this.isTamed()) {
  141. this.setAngry(true);
  142.  
  143. } else if (this.lvl == 0) {
  144. this.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 210, 0));
  145. this.clearActivePotions();
  146. }
  147.  
  148. }
  149.  
  150. /**
  151. * main AI tick function, replaces updateEntityActionState
  152. */
  153. protected void updateAITick() {
  154. this.dataWatcher.updateObject(18, Float.valueOf(this.getHealth()));
  155. }
  156.  
  157. protected void entityInit() {
  158. super.entityInit();
  159. this.dataWatcher.addObject(18, new Float(this.getHealth()));
  160. this.dataWatcher.addObject(19, new Byte((byte) 0));
  161. this.dataWatcher.addObject(20, new Byte((byte) BlockColored.func_150032_b(1)));
  162.  
  163. }
  164.  
  165. /**
  166. * (abstract) Protected helper method to write subclass entity data to NBT.
  167. */
  168. public void writeEntityToNBT(NBTTagCompound p_70014_1_) {
  169. super.writeEntityToNBT(p_70014_1_);
  170. p_70014_1_.setBoolean("Angry", this.isAngry());
  171. p_70014_1_.setByte("CollarColor", (byte) this.getCollarColor());
  172. }
  173.  
  174. /**
  175. * (abstract) Protected helper method to read subclass entity data from NBT.
  176. */
  177. public void readEntityFromNBT(NBTTagCompound p_70037_1_) {
  178. super.readEntityFromNBT(p_70037_1_);
  179. this.setAngry(p_70037_1_.getBoolean("Angry"));
  180.  
  181. if (p_70037_1_.hasKey("CollarColor", 99)) {
  182. this.setCollarColor(p_70037_1_.getByte("CollarColor"));
  183. }
  184. }
  185.  
  186. /**
  187. * Returns the sound this mob makes while it's alive.
  188. */
  189. public void updateEntityActionState() {
  190.  
  191. List list = worldObj.getEntitiesWithinAABB(EntityCreature.class,
  192. AxisAlignedBB.getBoundingBox(posX, posY, posZ, posX + 1, posY + 1, posZ + 1));
  193. for (int i = 0; i < list.size(); i++) {
  194. Entity entity = (Entity) list.get(i);
  195. if (!list.isEmpty()) {
  196. if (!(entity instanceof EntityPlayer)) {
  197. this.setTarget(entity);
  198. }
  199. }
  200. }
  201. super.updateEntityActionState();
  202. }
  203.  
  204. /**
  205. * Returns the volume for the sounds this mob makes.
  206. */
  207. protected float getSoundVolume() {
  208. return 0.4F;
  209. }
  210.  
  211. /**
  212. * Called frequently so the entity can update its state every tick as
  213. * required. For example, zombies and skeletons use this to react to
  214. * sunlight and start to burn.
  215. */
  216. public void onLivingUpdate() {
  217. super.onLivingUpdate();
  218.  
  219. if (!this.worldObj.isRemote && this.isShaking && !this.field_70928_h && !this.hasPath() && this.onGround) {
  220. this.field_70928_h = true;
  221. this.timeWolfIsShaking = 0.0F;
  222. this.prevTimeWolfIsShaking = 0.0F;
  223. this.worldObj.setEntityState(this, (byte) 8);
  224. }
  225. for (k = 0; k < 2; ++k) {
  226. this.worldObj.spawnParticle("enchantmenttable",
  227. this.posX + (this.rand.nextDouble() - 0.5D) * (double) this.width,
  228. this.posY + this.rand.nextDouble() * (double) this.height - 0.25D,
  229. this.posZ + (this.rand.nextDouble() - 0.5D) * (double) this.width,
  230. (this.rand.nextDouble() - 0.5D) * 2.0D, -this.rand.nextDouble(),
  231. (this.rand.nextDouble() - 0.5D) * 2.0D);
  232. }
  233. }
  234.  
  235. public void onUpdate() {
  236. super.onUpdate();
  237. this.field_70924_f = this.field_70926_e;
  238.  
  239. if (this.func_70922_bv()) {
  240. this.field_70926_e += (1.0F - this.field_70926_e) * 0.4F;
  241. } else {
  242. this.field_70926_e += (0.0F - this.field_70926_e) * 0.4F;
  243. }
  244.  
  245. if (this.func_70922_bv()) {
  246. this.numTicksToChaseTarget = 10;
  247. }
  248.  
  249. if (this.isWet()) {
  250. this.isShaking = true;
  251. this.field_70928_h = false;
  252. this.timeWolfIsShaking = 0.0F;
  253. this.prevTimeWolfIsShaking = 0.0F;
  254. } else if ((this.isShaking || this.field_70928_h) && this.field_70928_h) {
  255. if (this.timeWolfIsShaking == 0.0F) {
  256. this.playSound("mob.wolf.shake", this.getSoundVolume(),
  257. (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
  258. }
  259.  
  260. this.prevTimeWolfIsShaking = this.timeWolfIsShaking;
  261. this.timeWolfIsShaking += 0.05F;
  262.  
  263. if (this.prevTimeWolfIsShaking >= 2.0F) {
  264. this.isShaking = false;
  265. this.field_70928_h = false;
  266. this.prevTimeWolfIsShaking = 0.0F;
  267. this.timeWolfIsShaking = 0.0F;
  268. }
  269.  
  270. if (this.timeWolfIsShaking > 0.4F) {
  271. float f = (float) this.boundingBox.minY;
  272. int i = (int) (MathHelper.sin((this.timeWolfIsShaking - 0.4F) * (float) Math.PI) * 7.0F);
  273.  
  274. for (int j = 0; j < i; ++j) {
  275. float f1 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
  276. float f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
  277. this.worldObj.spawnParticle("splash", this.posX + (double) f1, (double) (f + 0.8F),
  278. this.posZ + (double) f2, this.motionX, this.motionY, this.motionZ);
  279. }
  280. }
  281. }
  282. }
  283.  
  284. /**
  285. * The speed it takes to move the entityliving's rotationPitch through the
  286. * faceEntity method. This is only currently use in wolves.
  287. */
  288. public int getVerticalFaceSpeed() {
  289. return this.isSitting() ? 20 : super.getVerticalFaceSpeed();
  290. }
  291.  
  292. /**
  293. * Called when the entity is attacked.
  294. */
  295. public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) {
  296. if (this.isEntityInvulnerable()) {
  297. return false;
  298. } else {
  299. Entity entity = p_70097_1_.getEntity();
  300. this.aiSit.setSitting(false);
  301.  
  302. if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) {
  303. p_70097_2_ = (p_70097_2_ + 1.0F) / 2.0F;
  304. }
  305.  
  306. return super.attackEntityFrom(p_70097_1_, p_70097_2_);
  307. }
  308. }
  309.  
  310. public boolean attackEntityAsMob(Entity p_70652_1_) {
  311. int i = this.isTamed() ? 4 : 2;
  312.  
  313. this.worldObj.setEntityState(this, (byte) 4);
  314.  
  315. if (this.lvl == 0) {
  316. ((net.minecraft.entity.EntityLivingBase) p_70652_1_)
  317. .addPotionEffect(new PotionEffect(Potion.poison.id, 1000, 0));
  318. }
  319. if (this.lvl == 0) {
  320. this.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 500, 0));
  321. }
  322. if (this.lvl > 10) {
  323. ((net.minecraft.entity.EntityLivingBase) p_70652_1_)
  324. .addPotionEffect(new PotionEffect(Potion.poison.id, 1000, 0));
  325. ((net.minecraft.entity.EntityLivingBase) p_70652_1_)
  326. .addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2000, 0));
  327. }
  328. if (this.lvl > 40) {
  329. ((net.minecraft.entity.EntityLivingBase) p_70652_1_)
  330. .addPotionEffect(new PotionEffect(Potion.weakness.id, 2000, 1));
  331. ((net.minecraft.entity.EntityLivingBase) p_70652_1_)
  332. .addPotionEffect(new PotionEffect(Potion.wither.id, 2000, 1));
  333. ((net.minecraft.entity.EntityLivingBase) p_70652_1_)
  334. .addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2000, 1));
  335. ((net.minecraft.entity.EntityLivingBase) p_70652_1_).setFire(10000);
  336. }
  337. if (this.lvl > 50) {
  338. this.motionY = 2.0F;
  339. ((net.minecraft.entity.EntityLivingBase) p_70652_1_)
  340. .addPotionEffect(new PotionEffect(Potion.weakness.id, 2000, 1));
  341. ((net.minecraft.entity.EntityLivingBase) p_70652_1_)
  342. .addPotionEffect(new PotionEffect(Potion.wither.id, 2000, 1));
  343. ((net.minecraft.entity.EntityLivingBase) p_70652_1_)
  344. .addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2000, 1));
  345. ((net.minecraft.entity.EntityLivingBase) p_70652_1_).setFire(10000);
  346. }
  347.  
  348. if (this.lvl > 99) {
  349. ((net.minecraft.entity.EntityLivingBase) p_70652_1_)
  350. .addPotionEffect(new PotionEffect(Potion.wither.id, 2000, 3));
  351. ((net.minecraft.entity.EntityLivingBase) p_70652_1_)
  352. .addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2000, 3));
  353. ((net.minecraft.entity.EntityLivingBase) p_70652_1_)
  354. .addPotionEffect(new PotionEffect(Potion.hunger.id, 2000, 3));
  355. ((net.minecraft.entity.EntityLivingBase) p_70652_1_)
  356. .addPotionEffect(new PotionEffect(Potion.confusion.id, 500, 3));
  357. ((net.minecraft.entity.EntityLivingBase) p_70652_1_)
  358. .addPotionEffect(new PotionEffect(Potion.blindness.id, 1000, 3));
  359. ((net.minecraft.entity.EntityLivingBase) p_70652_1_)
  360. .addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 2000, 3));
  361. this.motionY = 2.0F;
  362. ((net.minecraft.entity.EntityLivingBase) p_70652_1_).setFire(10000);
  363.  
  364. }
  365. return p_70652_1_.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
  366.  
  367. }
  368.  
  369. public void setTamed() {
  370.  
  371. if (this.lvl == 1) {
  372. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100.0D);
  373. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5D);
  374.  
  375. }
  376. if (this.lvl == 2) {
  377. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(110.0D);
  378. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.57D);
  379. }
  380. if (this.lvl == 3) {
  381. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(120.0D);
  382. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.589D);
  383. }
  384. if (this.lvl == 4) {
  385. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(130.0D);
  386. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5897D);
  387. }
  388. if (this.lvl == 5) {
  389. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(140.0D);
  390. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.58986D);
  391. }
  392. if (this.lvl == 6) {
  393. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(150.0D);
  394. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.59986D);
  395. }
  396. if (this.lvl == 7) {
  397. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(160.0D);
  398. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.59996D);
  399. }
  400. if (this.lvl == 8) {
  401. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(170.0D);
  402. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.59999D);
  403. }
  404. if (this.lvl == 9) {
  405. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(180.0D);
  406. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.59999D);
  407. }
  408. if (this.lvl == 10) {
  409. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(190.0D);
  410. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.69999D);
  411. }
  412. if (this.lvl == 11) {
  413. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(200.0D);
  414. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.699999D);
  415. }
  416. if (this.lvl == 12) {
  417. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(210.0D);
  418. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.699999D);
  419. }
  420. if (this.lvl == 13) {
  421. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(220.0D);
  422. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.6999999D);
  423. }
  424. if (this.lvl == 12) {
  425. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(230.0D);
  426. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.799999D);
  427. }
  428. if (this.lvl == 13) {
  429. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(240.0D);
  430. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
  431. }
  432. if (this.lvl == 14) {
  433. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(250.0D);
  434. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
  435. }
  436. if (this.lvl == 15) {
  437. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(260.0D);
  438. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
  439. }
  440. if (this.lvl == 16) {
  441. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(270.0D);
  442. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
  443. }
  444. if (this.lvl == 17) {
  445. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(280.0D);
  446. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
  447. }
  448. if (this.lvl == 18) {
  449. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(290.0D);
  450. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
  451. }
  452. if (this.lvl == 19) {
  453. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(300.0D);
  454. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
  455. }
  456. if (this.lvl == 20) {
  457. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(310.0D);
  458. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
  459. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  460. }
  461. if (this.lvl == 21) {
  462. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(320.0D);
  463. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
  464. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  465. }
  466. if (this.lvl == 22) {
  467. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(330.0D);
  468. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
  469. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  470. }
  471. if (this.lvl == 23) {
  472. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(340.0D);
  473. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
  474. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  475. }
  476. if (this.lvl == 24) {
  477. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(350.0D);
  478. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
  479. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  480. }
  481. if (this.lvl == 25) {
  482. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(360.0D);
  483. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
  484. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  485. }
  486. if (this.lvl == 26) {
  487. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(370.0D);
  488. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.9D);
  489. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  490. }
  491. if (this.lvl == 27) {
  492. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(380.0D);
  493. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.9D);
  494. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  495. }
  496. if (this.lvl == 28) {
  497. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(390.0D);
  498. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.9D);
  499. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  500. }
  501. if (this.lvl == 29) {
  502. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(400.0D);
  503. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.9D);
  504. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  505. }
  506. if (this.lvl == 30) {
  507. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(410.0D);
  508. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.9D);
  509. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  510. }
  511. if (this.lvl == 31) {
  512. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(420.0D);
  513. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.9D);
  514. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  515. }
  516. if (this.lvl == 32) {
  517. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(420.0D);
  518. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.9D);
  519. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  520. }
  521. if (this.lvl == 33) {
  522. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(430.0D);
  523. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.0D);
  524. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  525. }
  526. if (this.lvl == 34) {
  527. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(440.0D);
  528. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.1D);
  529. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  530. }
  531. if (this.lvl == 35) {
  532. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(450.0D);
  533. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.1D);
  534. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  535. }
  536. if (this.lvl == 36) {
  537. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(460.0D);
  538. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.2D);
  539. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  540. }
  541. if (this.lvl == 37) {
  542. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(470.0D);
  543. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.2D);
  544. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  545. }
  546.  
  547. if (this.lvl == 38) {
  548. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(480.0D);
  549. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.2D);
  550. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  551. }
  552. if (this.lvl == 39) {
  553. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(490.0D);
  554. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.3D);
  555. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  556. }
  557. if (this.lvl == 40) {
  558. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(500.0D);
  559. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.3D);
  560. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  561. }
  562. if (this.lvl == 41) {
  563. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(510.0D);
  564. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.3D);
  565. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  566. }
  567. if (this.lvl == 42) {
  568. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(520.0D);
  569. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.4D);
  570. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  571. }
  572. if (this.lvl == 43) {
  573. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(530.0D);
  574. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.4D);
  575. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  576. }
  577. if (this.lvl == 44) {
  578. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(540.0D);
  579. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.4D);
  580. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  581. }
  582. if (this.lvl == 45) {
  583. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(550.0D);
  584. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.4D);
  585. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  586. }
  587. if (this.lvl == 46) {
  588. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(560.0D);
  589. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.4D);
  590. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  591. }
  592. if (this.lvl == 47) {
  593. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(570.0D);
  594. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.5D);
  595. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  596. }
  597. if (this.lvl == 48) {
  598. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(570.0D);
  599. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.5D);
  600. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  601. }
  602. if (this.lvl == 49) {
  603. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(580.0D);
  604. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.5D);
  605. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  606. }
  607. if (this.lvl == 50) {
  608. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(580.0D);
  609. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.6D);
  610. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  611. }
  612. if (this.lvl == 51) {
  613. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(590.0D);
  614. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.6D);
  615. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  616. }
  617. if (this.lvl == 52) {
  618. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(600.0D);
  619. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.6D);
  620. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  621. }
  622. if (this.lvl == 52) {
  623. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(610.0D);
  624. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.6D);
  625. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  626. }
  627. if (this.lvl == 53) {
  628. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(620.0D);
  629. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.6D);
  630. this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(5.0D);
  631. } else if (this.lvl == 0) {
  632. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D);
  633. }
  634.  
  635. }
  636.  
  637. /**
  638. * Called when a player interacts with a mob. e.g. gets milk from a cow,
  639. * gets into the saddle on a pig.
  640. */
  641.  
  642. public boolean interact(EntityPlayer p_70085_1_) {
  643. ItemStack itemstack = p_70085_1_.inventory.getCurrentItem();
  644.  
  645. if (this.lvl > 0) {
  646. if (itemstack != null) {
  647. if (itemstack.getItem() instanceof Baie) {
  648. Baie itemfood = (Baie) itemstack.getItem();
  649.  
  650. if (itemfood.isFamiliarFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < 20.0F) {
  651. if (!p_70085_1_.capabilities.isCreativeMode) {
  652. --itemstack.stackSize;
  653. }
  654.  
  655. this.heal((float) itemfood.func_150905_g(itemstack));
  656.  
  657. if (itemstack.stackSize <= 0) {
  658. p_70085_1_.inventory.setInventorySlotContents(p_70085_1_.inventory.currentItem,
  659. (ItemStack) null);
  660. }
  661.  
  662. return true;
  663. }
  664. }
  665. }
  666. if (this.func_152114_e(p_70085_1_) && !this.worldObj.isRemote && !this.isBreedingItem(itemstack)) {
  667. this.aiSit.setSitting(!this.isSitting());
  668. this.isJumping = false;
  669. this.setPathToEntity((PathEntity) null);
  670. this.setTarget((Entity) null);
  671. this.setAttackTarget((EntityLivingBase) null);
  672. }
  673.  
  674. }
  675. if (propietaire == null) {
  676.  
  677. if (itemstack != null && itemstack.getItem() instanceof Croquette) {
  678.  
  679. if (!p_70085_1_.capabilities.isCreativeMode) {
  680. --itemstack.stackSize;
  681. }
  682.  
  683. if (itemstack.stackSize <= 0) {
  684. p_70085_1_.inventory.setInventorySlotContents(p_70085_1_.inventory.currentItem, (ItemStack) null);
  685. }
  686.  
  687. if (!this.worldObj.isRemote) {
  688. if (this.rand.nextInt(3) == 0) {
  689.  
  690. this.setPathToEntity((PathEntity) null);
  691. this.setAttackTarget((EntityLivingBase) null);
  692. this.aiSit.setSitting(true);
  693. if (this.lvl == 10) {
  694. System.out.println("lvl 10!!!");
  695.  
  696. }
  697. if (itemstack != null && itemstack.getItem() == enderdeath.RubisCroquette) {
  698. if (lvl > rubis) {
  699. this.lvl++;
  700. this.lvl++;
  701. this.lvl++;
  702. }
  703.  
  704. }
  705.  
  706. if (itemstack != null && itemstack.getItem() == enderdeath.SaphirCroquette) {
  707. if (lvl > ultime) {
  708. this.lvl++;
  709. this.lvl++;
  710. this.lvl++;
  711. this.lvl++;
  712. this.lvl++;
  713. }
  714.  
  715. }
  716.  
  717. this.lvl++;
  718. System.out.println(lvl);
  719. this.func_152115_b(p_70085_1_.getUniqueID().toString());
  720. this.playTameEffect(true);
  721. this.worldObj.setEntityState(this, (byte) 7);
  722. this.setTamed();
  723.  
  724. } else {
  725. this.playTameEffect(false);
  726. this.worldObj.setEntityState(this, (byte) 6);
  727. }
  728.  
  729. }
  730. if (itemstack != null && itemstack.getItem() == enderdeath.SkinFire) {
  731. this.skin = 1;
  732. this.onSkin();
  733. }
  734. return true;
  735. }
  736. }
  737. return super.interact(p_70085_1_);
  738. }
  739.  
  740. public void onSkin() {
  741. if (this.skin == 1) {
  742. this.render.textureSkin();
  743. }
  744. }
  745.  
  746. public void onParticuleFire() {
  747. for (k = 0; k < 2; ++k) {
  748. this.worldObj.spawnParticle("fire", this.posX + (this.rand.nextDouble() - 0.5D) * (double) this.width,
  749. this.posY + this.rand.nextDouble() * (double) this.height - 0.25D,
  750. this.posZ + (this.rand.nextDouble() - 0.5D) * (double) this.width,
  751. (this.rand.nextDouble() - 0.5D) * 2.0D, -this.rand.nextDouble(),
  752. (this.rand.nextDouble() - 0.5D) * 2.0D);
  753. }
  754. }
  755.  
  756. @SideOnly(Side.CLIENT)
  757. public float getTailRotation() {
  758. return this.isAngry() ? 1.5393804F
  759. : (this.isTamed()
  760. ? (0.55F - (20.0F - this.dataWatcher.getWatchableObjectFloat(18)) * 0.02F) * (float) Math.PI
  761. : ((float) Math.PI / 5F));
  762. }
  763.  
  764. public boolean isBreedingItem(ItemStack p_70877_1_) {
  765. return p_70877_1_ == null ? false
  766. : (!(p_70877_1_.getItem() instanceof Baie) ? false
  767. : ((Baie) p_70877_1_.getItem()).isFamiliarFavoriteMeat());
  768. }
  769.  
  770. public boolean isAngry() {
  771. return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0;
  772. }
  773.  
  774. public void setAngry(boolean p_70916_1_) {
  775. byte b0 = this.dataWatcher.getWatchableObjectByte(16);
  776.  
  777. if (p_70916_1_) {
  778. this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2)));
  779. } else {
  780. this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3)));
  781. }
  782. }
  783.  
  784. public int getCollarColor() {
  785. return this.dataWatcher.getWatchableObjectByte(20) & 15;
  786. }
  787.  
  788. public void setCollarColor(int p_82185_1_) {
  789. this.dataWatcher.updateObject(20, Byte.valueOf((byte) (p_82185_1_ & 15)));
  790. }
  791.  
  792. public Familiar createChild(EntityAgeable p_90011_1_) {
  793. Familiar entitywolf = new Familiar(this.worldObj);
  794. String s = this.func_152113_b();
  795.  
  796. if (s != null && s.trim().length() > 0) {
  797. entitywolf.func_152115_b(s);
  798. if (this.lvl >= 1)
  799. ;
  800. }
  801.  
  802. return entitywolf;
  803. }
  804.  
  805. public void func_70918_i(boolean p_70918_1_) {
  806. if (p_70918_1_) {
  807. this.dataWatcher.updateObject(19, Byte.valueOf((byte) 1));
  808. } else {
  809. this.dataWatcher.updateObject(19, Byte.valueOf((byte) 0));
  810. }
  811. }
  812.  
  813. /**
  814. * Returns true if the mob is currently able to mate with the specified mob.
  815. */
  816. public boolean canMateWith(EntityAnimal p_70878_1_) {
  817. if (p_70878_1_ == this) {
  818. return false;
  819. } else if (!this.isTamed()) {
  820. return false;
  821. } else if (!(p_70878_1_ instanceof Familiar)) {
  822. return false;
  823. } else {
  824. Familiar familiar = (Familiar) p_70878_1_;
  825. return !familiar.isTamed() ? false
  826. : (familiar.isSitting() ? false : this.isInLove() && familiar.isInLove());
  827. }
  828. }
  829.  
  830. public boolean func_70922_bv() {
  831. return this.dataWatcher.getWatchableObjectByte(19) == 1;
  832. }
  833.  
  834. /**
  835. * Determines if an entity can be despawned, used on idle far away entities
  836. */
  837. protected boolean canDespawn() {
  838. return !this.isTamed() && this.ticksExisted > 2400;
  839. }
  840.  
  841. public boolean func_142018_a(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_) {
  842. if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast)) {
  843. if (p_142018_1_ instanceof Familiar) {
  844. Familiar entitywolf = (Familiar) p_142018_1_;
  845.  
  846. if (entitywolf.isTamed() && entitywolf.getOwner() == p_142018_2_) {
  847. return false;
  848. }
  849. }
  850.  
  851. return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer
  852. && !((EntityPlayer) p_142018_2_).canAttackPlayer((EntityPlayer) p_142018_1_) ? false
  853. : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse) p_142018_1_).isTame();
  854. } else {
  855. return false;
  856. }
  857. }
  858. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement