Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package thelasttocraft.common.mobs;
- import java.util.ArrayList;
- import net.minecraft.entity.EntityCreature;
- import net.minecraft.entity.SharedMonsterAttributes;
- import net.minecraft.entity.ai.EntityAIAttackOnCollide;
- import net.minecraft.entity.ai.EntityAIEatGrass;
- import net.minecraft.entity.ai.EntityAIHurtByTarget;
- import net.minecraft.entity.ai.EntityAILeapAtTarget;
- import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
- import net.minecraft.entity.ai.EntityAISwimming;
- import net.minecraft.entity.ai.EntityAIWander;
- import net.minecraft.entity.monster.EntityMob;
- import net.minecraft.entity.passive.EntitySheep;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.init.Blocks;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraft.world.IBlockAccess;
- import net.minecraft.world.World;
- import net.minecraftforge.common.IShearable;
- public class EntityTLTCZombieSheep extends EntityMob implements IShearable{
- public EntityTLTCZombieSheep(World p_i1738_1_) {
- super(p_i1738_1_);
- this.setSize(0.9F, 1.3F);
- this.getNavigator().setAvoidsWater(true);
- this.tasks.addTask(0, new EntityAISwimming(this));
- this.tasks.addTask(1, new EntityAIWander(this, 1.0D));
- this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));
- this.tasks.addTask(3, new EntityAIEatGrass(this));
- this.tasks.addTask(4, new EntityAILeapAtTarget(this, 1.0F));
- this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
- this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
- }
- public boolean isAIEnable()
- {
- return true;
- }
- protected void applyEntityAttributes()
- {
- super.applyEntityAttributes();
- this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(10.0D);
- this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.7D);
- this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D);
- this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(16.0D);
- }
- protected String getLivingSound()
- {
- return "mob.sheep.say";
- }
- protected String getHurtSound()
- {
- return "mob.sheep.say";
- }
- protected String getDeathSound()
- {
- return "mob.sheep.say";
- }
- @Override
- public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) {
- return !getSheared();
- }
- public boolean getSheared()
- {
- return (this.dataWatcher.getWatchableObjectByte(16) & 16) != 0;
- }
- public void setSheared(boolean p_70893_1_)
- {
- byte b0 = this.dataWatcher.getWatchableObjectByte(16);
- if (p_70893_1_)
- {
- this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 | 16)));
- }
- else
- {
- this.dataWatcher.updateObject(16, Byte.valueOf((byte)(b0 & -17)));
- }
- }
- protected void dropFewItems(boolean p_70628_1_, int p_70628_2_)
- {
- if (!this.getSheared())
- {
- this.entityDropItem(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1), 0.0F);
- }
- }
- protected Item getDropItem()
- {
- return Item.getItemFromBlock(Blocks.wool);
- }
- @Override
- public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) {
- ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
- setSheared(true);
- int i = 1 + rand.nextInt(3);
- for (int j = 0; j < i; j++)
- {
- ret.add(new ItemStack(Blocks.wool, 1));
- }
- this.playSound("mob.sheep.shear", 1.0F, 1.0F);
- return ret;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement