Guest User

Untitled

a guest
Apr 1st, 2013
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.15 KB | None | 0 0
  1. package kamigreed.mod.medival.entity;
  2.  
  3. import net.minecraft.entity.Entity;
  4. import net.minecraft.entity.EntityAgeable;
  5. import net.minecraft.entity.EnumCreatureAttribute;
  6. import net.minecraft.entity.ai.EntityAIHurtByTarget;
  7. import net.minecraft.entity.ai.EntityAILookIdle;
  8. import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
  9. import net.minecraft.entity.ai.EntityAISwimming;
  10. import net.minecraft.entity.ai.EntityAIWander;
  11. import net.minecraft.entity.ai.EntityAIWatchClosest;
  12. import net.minecraft.entity.ai.EntityJumpHelper;
  13. import net.minecraft.entity.passive.EntityAnimal;
  14. import net.minecraft.entity.player.EntityPlayer;
  15. import net.minecraft.item.Item;
  16. import net.minecraft.util.MathHelper;
  17. import net.minecraft.world.World;
  18.  
  19. public class EntityGoblin extends EntityAnimal{
  20.  
  21. public EntityGoblin(World par1World)
  22. {
  23. super(par1World);
  24. this.texture = "/mob/goblin.png";
  25. this.moveSpeed = 0.8F;
  26. this.tasks.addTask(1, new EntityAISwimming(this));
  27. this.tasks.addTask(2, new EntityAIWander(null, this.moveSpeed));
  28. this.tasks.addTask(3, new EntityAILookIdle(this));
  29.  
  30. this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
  31. this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 8.0F, 0, true));
  32. }
  33.  
  34. @Override
  35. public EntityAgeable createChild(EntityAgeable entityageable)
  36. {
  37. return null;
  38. }
  39.  
  40. @Override
  41. public int getMaxHealth()
  42. {
  43. return 14;
  44. }
  45.  
  46. public EnumCreatureAttribute getCreatureAttribute()
  47. {
  48. return EnumCreatureAttribute.UNDEFINED;
  49. }
  50.  
  51. public int getAttackStrength(Entity par1Entity)
  52. {
  53. return 2;
  54. }
  55.  
  56. protected boolean isAIEnabled()
  57. {
  58. return true;
  59. }
  60.  
  61. //public int getTotalArmorValue()
  62. //{
  63. // return 2;
  64. //}
  65.  
  66. protected Entity findPlayerToAttack()
  67. {
  68. float f = this.getBrightness(1.0F);
  69.  
  70. if (f < 0.5F)
  71. {
  72. double d0 = 16.0D;
  73. return this.worldObj.getClosestVulnerablePlayerToEntity(this, d0);
  74. }
  75. else
  76. {
  77. return null;
  78. }
  79. }
  80.  
  81. protected String getLivingSound()
  82. {
  83. return "mob.zombie.say";
  84. }
  85.  
  86. protected String getHurtSound()
  87. {
  88. return "mob.zombie.hurt";
  89. }
  90.  
  91. protected String getDeathSound()
  92. {
  93. return "mob.zombie.death";
  94. }
  95.  
  96. protected void playStepSound(int par1, int par2, int par3, int par4)
  97. {
  98. this.worldObj.playSoundAtEntity(this, "mob.zombie.step", 0.15F, 1.0F);
  99. }
  100.  
  101. protected int getDropItemId()
  102. {
  103. return Item.goldNugget.itemID;
  104. }
  105.  
  106. protected void dropRareDrop(int par1)
  107. {
  108. switch (this.rand.nextInt(2))
  109. {
  110. case 0:
  111. this.dropItem(Item.coal.itemID, 3);
  112. break;
  113. case 1:
  114. this.dropItem(Item.ingotGold.itemID, 1);
  115. break;
  116. }
  117. }
  118.  
  119. protected void dropFewItems(boolean par1, int par2)
  120. {
  121. if(this.rand.nextInt(3) == 0)
  122. {
  123. this.dropItem(Item.coal.itemID, 1);
  124. }
  125. }
  126.  
  127. }
Advertisement
Add Comment
Please, Sign In to add comment