Advertisement
Creepinson

Untitled

Jun 20th, 2017
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.23 KB | None | 0 0
  1. package me.creepinson.entities;
  2.  
  3. import me.creepinson.entities.ai.EntityAIAttackMelee;
  4. import net.minecraft.entity.Entity;
  5. import net.minecraft.entity.EntityCreature;
  6. import net.minecraft.entity.EntityLiving;
  7. import net.minecraft.entity.SharedMonsterAttributes;
  8. import net.minecraft.entity.ai.EntityAIHurtByTarget;
  9. import net.minecraft.entity.ai.EntityAILookIdle;
  10. import net.minecraft.entity.ai.EntityAISwimming;
  11. import net.minecraft.entity.ai.EntityAIWander;
  12. import net.minecraft.entity.effect.EntityLightningBolt;
  13. import net.minecraft.entity.player.EntityPlayer;
  14. import net.minecraft.entity.player.EntityPlayerMP;
  15. import net.minecraft.item.Item;
  16. import net.minecraft.util.DamageSource;
  17. import net.minecraft.world.World;
  18. import obsidianAPI.animation.wrapper.IEntityAnimated;
  19.  
  20. public class EntityCreepino extends EntityCreature implements IEntityAnimated
  21. {
  22. public boolean isAttacked;
  23. World world = null;
  24. public EntityCreepino(World var1)
  25. {
  26. super(var1);
  27. world = var1;
  28. experienceValue = 8;
  29. this.isImmuneToFire = false;
  30.  
  31. this.targetTasks.addTask(6, new EntityAIHurtByTarget(this, false));
  32. this.tasks.addTask(2, new EntityAIWander(this, 0.8D));
  33. this.tasks.addTask(2, new EntityAILookIdle(this));
  34. this.tasks.addTask(1, new EntityAISwimming(this));
  35. this.tasks.addTask(6, new EntityAIAttackMelee(this, EntityPlayer.class, 5, false));
  36. this.tasks.addTask(6, new EntityAIAttackMelee(this, EntityPlayerMP.class, 5, false));
  37.  
  38. this.isAttacked = false;
  39. }
  40.  
  41.  
  42.  
  43. protected void applyEntityAttributes(){
  44. super.applyEntityAttributes();
  45. this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.15D);
  46. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(14D);
  47. if(this.getEntityAttribute(SharedMonsterAttributes.attackDamage)!=null)this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D);
  48. }
  49.  
  50.  
  51.  
  52. @Override
  53. public boolean isMoving() {
  54. return limbSwingAmount > 0.02F;
  55. }
  56.  
  57.  
  58.  
  59.  
  60. public boolean isAIEnabled()
  61. {
  62. return true;
  63. }
  64.  
  65. @Override
  66. protected Item getDropItem()
  67. {
  68. return null;
  69. }
  70.  
  71. /**
  72. * Returns the sound this mob makes while it's alive.
  73. */
  74. protected String getLivingSound()
  75. {
  76. return "meepersplus:creepino.screech";
  77. }
  78.  
  79. /**
  80. * Returns the sound this mob makes when it is hurt.
  81. */
  82. protected String getHurtSound()
  83. {
  84. return "meepersplus:creepino.hurt";
  85. }
  86.  
  87. /**
  88. * Returns the sound this mob makes on death.
  89. */
  90. protected String getDeathSound()
  91. {
  92. return "meepersplus:creepino.death";
  93. }
  94.  
  95. public void onStruckByLightning(EntityLightningBolt entityLightningBolt){
  96. super.onStruckByLightning(entityLightningBolt);
  97. int i = (int)this.posX;
  98. int j = (int)this.posY;
  99. int k = (int)this.posZ;
  100. Entity entity = this;
  101.  
  102.  
  103.  
  104. motionY = 5.0D;
  105. motionY = 0.0D;
  106. }
  107. private int ticks;
  108. @Override
  109. public boolean attackEntityFrom(DamageSource p_70097_1_, float p_70097_2_) {
  110. this.isAttacked = true;
  111. if(ticks == 40){
  112.  
  113. ticks = 0;
  114. }
  115. if(ticks == 20){
  116. if(this.isAttacked){
  117. this.isAttacked = false;
  118. }
  119. }
  120.  
  121.  
  122. return super.attackEntityFrom(p_70097_1_, p_70097_2_);
  123. }
  124.  
  125. @Override
  126. public void onUpdate() {
  127. ticks++;
  128.  
  129. super.onUpdate();
  130. }
  131. protected void fall(float l){
  132. super.fall(l);
  133. int i = (int)this.posX;
  134. int j = (int)this.posY;
  135. int k = (int)this.posZ;
  136. super.fall(l);
  137. Entity entity = this;
  138.  
  139. }
  140.  
  141. public void onDeath(DamageSource dsource) {
  142. super.onDeath(dsource);
  143. int i = (int)this.posX;
  144. int j = (int)this.posY;
  145. int k = (int)this.posZ;
  146. Entity entity = this;
  147.  
  148. }
  149.  
  150. public void onKillEntity(EntityLiving entityLiving){
  151. super.onKillEntity(entityLiving);
  152. int i = (int)this.posX;
  153. int j = (int)this.posY;
  154. int k = (int)this.posZ;
  155. Entity entity = this;
  156.  
  157. }
  158.  
  159. public boolean interact(EntityPlayer entity){
  160. super.interact(entity);
  161. int i = (int)this.posX;
  162. int j = (int)this.posY;
  163. int k = (int)this.posZ;
  164.  
  165.  
  166. return true;
  167. }
  168.  
  169. public String getEntityName(){
  170. return "Creepino";
  171. }
  172.  
  173.  
  174.  
  175.  
  176. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement