Advertisement
DrMDGG

BeeHive

Apr 2nd, 2016
1,865
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 0 0
  1. package com.drmdgg.marijuanacraft.BeeHive;
  2.  
  3. import net.minecraft.entity.Entity;
  4. import net.minecraft.entity.SharedMonsterAttributes;
  5. import net.minecraft.entity.ai.EntityAIHurtByTarget;
  6. import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
  7. import net.minecraft.entity.effect.EntityLightningBolt;
  8. import net.minecraft.entity.monster.EntityMob;
  9. import net.minecraft.entity.player.EntityPlayer;
  10. import net.minecraft.init.Items;
  11. import net.minecraft.item.Item;
  12. import net.minecraft.item.ItemStack;
  13. import net.minecraft.util.BlockPos;
  14. import net.minecraft.util.DamageSource;
  15. import net.minecraft.world.World;
  16.  
  17. public class BeeHive extends EntityMob {
  18.  
  19.  
  20. public BeeHive(World par1World) {
  21. super(par1World);
  22. this.setSize(2.0F, 1.0F);
  23. experienceValue = 5;
  24. this.isImmuneToFire = false;
  25.  
  26. this.targetTasks.addTask(0, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
  27. this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
  28. }
  29.  
  30. public boolean isAIEnabled() {
  31. return true;
  32. }
  33.  
  34. protected void applyEntityAttributes(){
  35. super.applyEntityAttributes();
  36. this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10D);
  37. if(this.getEntityAttribute(SharedMonsterAttributes.attackDamage)!=null)this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3D);
  38. }
  39.  
  40. protected void dropRareDrop(int par1){
  41. this.dropItem(Items.bone, 1);
  42. }
  43.  
  44.  
  45. @Override
  46. protected Item getDropItem()
  47. {
  48. return new ItemStack(Items.slime_ball).getItem();
  49. }
  50.  
  51. @Override
  52. protected String getLivingSound()
  53. {
  54. return "";
  55. }
  56.  
  57. @Override
  58. protected String getHurtSound()
  59. {
  60. return "game.neutral.hurt";
  61. }
  62.  
  63. @Override
  64. protected String getDeathSound()
  65. {
  66. return "game.neutral.die";
  67. }
  68.  
  69. @Override
  70. public void onStruckByLightning(EntityLightningBolt entityLightningBolt){
  71. super.onStruckByLightning(entityLightningBolt);
  72. int i = (int)this.posX;
  73. int j = (int)this.posY;
  74. int k = (int)this.posZ;
  75. Entity entity = this;
  76.  
  77. if(true){
  78. worldObj.getBlockState(new BlockPos(i, j, k)).getBlock().dropBlockAsItem(worldObj, new BlockPos(i, j, k), worldObj.getBlockState(new BlockPos(i, j, k)), 1);
  79. worldObj.setBlockToAir(new BlockPos(i, j, k));
  80.  
  81. }
  82.  
  83. }
  84.  
  85. @Override
  86. public void fall(float l, float d){
  87. super.fall(l,d);
  88. int i = (int)this.posX;
  89. int j = (int)this.posY;
  90. int k = (int)this.posZ;
  91. super.fall(l,d);
  92. Entity entity = this;
  93.  
  94. }
  95.  
  96. @Override
  97. public void onDeath(DamageSource source){
  98. super.onDeath(source);
  99. int i = (int)this.posX;
  100. int j = (int)this.posY;
  101. int k = (int)this.posZ;
  102. Entity entity = this;
  103.  
  104. if(true){
  105. worldObj.getBlockState(new BlockPos(i, j, k)).getBlock().dropBlockAsItem(worldObj, new BlockPos(i, j, k), worldObj.getBlockState(new BlockPos(i, j, k)), 1);
  106. worldObj.setBlockToAir(new BlockPos(i, j, k));
  107.  
  108. }
  109.  
  110.  
  111. if(true){
  112. entity.attackEntityFrom(DamageSource.generic, 6);
  113. }
  114.  
  115. }
  116.  
  117. @Override
  118. public boolean interact(EntityPlayer entity){
  119. super.interact(entity);
  120. int i = (int)this.posX;
  121. int j = (int)this.posY;
  122. int k = (int)this.posZ;
  123.  
  124. return true;
  125. }
  126.  
  127. @Override
  128. protected float getSoundVolume()
  129. {
  130. return 1.0F;
  131. }
  132.  
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement