TheGoldCrayon

EntityImp

Apr 2nd, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.03 KB | None | 0 0
  1. package com.TheGoldCrayon.Daemonology.entities;
  2.  
  3. import com.TheGoldCrayon.Daemonology.init.DaemonologyItems;
  4. import com.ibm.icu.impl.duration.impl.Utils;
  5.  
  6. import net.minecraft.block.Block;
  7. import net.minecraft.entity.EntityAgeable;
  8. import net.minecraft.entity.EnumCreatureType;
  9. import net.minecraft.entity.SharedMonsterAttributes;
  10. import net.minecraft.entity.ai.EntityAIFollowParent;
  11. import net.minecraft.entity.ai.EntityAILookIdle;
  12. import net.minecraft.entity.ai.EntityAIMate;
  13. import net.minecraft.entity.ai.EntityAIPanic;
  14. import net.minecraft.entity.ai.EntityAISwimming;
  15. import net.minecraft.entity.ai.EntityAITempt;
  16. import net.minecraft.entity.ai.EntityAIWander;
  17. import net.minecraft.entity.ai.EntityAIWatchClosest;
  18. import net.minecraft.entity.passive.EntityAnimal;
  19. import net.minecraft.entity.player.EntityPlayer;
  20. import net.minecraft.init.Items;
  21. import net.minecraft.item.Item;
  22. import net.minecraft.item.ItemStack;
  23. import net.minecraft.pathfinding.PathNavigateGround;
  24. import net.minecraft.util.BlockPos;
  25. import net.minecraft.world.World;
  26. import net.minecraft.world.biome.BiomeGenBase;
  27. import net.minecraftforge.fml.common.registry.EntityRegistry;
  28.  
  29. public class EntityImp extends EntityAnimal
  30. {
  31.     public EntityImp(World worldIn)
  32.     {
  33.         super(worldIn);
  34.         this.setSize(0.9F, 1.3F);
  35.         ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true);
  36.         this.tasks.addTask(0, new EntityAISwimming(this));
  37.         this.tasks.addTask(1, new EntityAIPanic(this, 1.0D));
  38.         this.tasks.addTask(2, new EntityAIMate(this, 1.0D));
  39.         this.tasks.addTask(3, new EntityAITempt(this, 1.25D, Items.wheat, false));
  40.         this.tasks.addTask(4, new EntityAIFollowParent(this, 1.25D));
  41.         this.tasks.addTask(5, new EntityAIWander(this, 0.7D));
  42.         this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
  43.         this.tasks.addTask(7, new EntityAILookIdle(this));
  44.     }
  45.  
  46.    
  47.    
  48.    
  49.     protected void applyEntityAttributes()
  50.     {
  51.         super.applyEntityAttributes();
  52.         this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D);
  53.         this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.3D);
  54.     }
  55.  
  56.     /**
  57.      * Returns the sound this mob makes while it's alive.
  58.      */
  59.     protected String getLivingSound()
  60.     {
  61.         return "mob.cow.say";
  62.     }
  63.  
  64.     /**
  65.      * Returns the sound this mob makes when it is hurt.
  66.      */
  67.     protected String getHurtSound()
  68.     {
  69.         return "mob.cow.hurt";
  70.     }
  71.  
  72.     /**
  73.      * Returns the sound this mob makes on death.
  74.      */
  75.     protected String getDeathSound()
  76.     {
  77.         return "mob.cow.hurt";
  78.     }
  79.  
  80.     protected void playStepSound(BlockPos pos, Block blockIn)
  81.     {
  82.         this.playSound("mob.cow.step", 0.15F, 1.0F);
  83.     }
  84.  
  85.     /**
  86.      * Returns the volume for the sounds this mob makes.
  87.      */
  88.     protected float getSoundVolume()
  89.     {
  90.         return 0.4F;
  91.     }
  92.  
  93.     protected Item getDropItem()
  94.     {
  95.         return Items.leather;
  96.     }
  97.  
  98.     /**
  99.      * Drop 0-2 items of this living's type
  100.      */
  101.     protected void dropFewItems(boolean p_70628_1_, int p_70628_2_)
  102.     {
  103.         int i = this.rand.nextInt(3) + this.rand.nextInt(1 + p_70628_2_);
  104.  
  105.         for (int j = 0; j < i; ++j)
  106.         {
  107.             this.dropItem(DaemonologyItems.item_sulfur, 1);
  108.         }
  109.  
  110.         i = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + p_70628_2_);
  111.  
  112.         for (int k = 0; k < i; ++k)
  113.         {
  114.             if (this.isBurning())
  115.             {
  116.                 this.dropItem(Items.cooked_beef, 1);
  117.             }
  118.             else
  119.             {
  120.                 this.dropItem(Items.beef, 1);
  121.             }
  122.         }
  123.     }
  124.  
  125.  
  126.     public EntityImp createChild(EntityAgeable ageable)
  127.     {
  128.         return new EntityImp(this.worldObj);
  129.     }
  130.  
  131.     public float getEyeHeight()
  132.     {
  133.         return this.height;
  134.     }
  135.    
  136.     public boolean getCanSpawnHere()
  137.     {
  138.         return super.getCanSpawnHere();
  139.     }
  140.    
  141.    
  142.    
  143. }
Add Comment
Please, Sign In to add comment