2020-08-14 19:24:29 +02:00
|
|
|
package mod.acgaming.spackenmobs.entities;
|
2020-08-23 10:30:02 +02:00
|
|
|
|
2020-08-14 19:24:29 +02:00
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
import com.google.common.collect.Sets;
|
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.entity.EntityAgeable;
|
|
|
|
import net.minecraft.entity.ai.EntityAIFollowParent;
|
|
|
|
import net.minecraft.entity.ai.EntityAILookIdle;
|
|
|
|
import net.minecraft.entity.ai.EntityAIMate;
|
|
|
|
import net.minecraft.entity.ai.EntityAIPanic;
|
|
|
|
import net.minecraft.entity.ai.EntityAISwimming;
|
|
|
|
import net.minecraft.entity.ai.EntityAITempt;
|
|
|
|
import net.minecraft.entity.ai.EntityAIWanderAvoidWater;
|
|
|
|
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
|
|
|
import net.minecraft.entity.passive.EntityChicken;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.init.Items;
|
|
|
|
import net.minecraft.init.SoundEvents;
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.pathfinding.PathNodeType;
|
|
|
|
import net.minecraft.util.DamageSource;
|
|
|
|
import net.minecraft.util.SoundEvent;
|
|
|
|
import net.minecraft.util.math.BlockPos;
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
2020-08-23 15:38:40 +02:00
|
|
|
public class EntityHolzstammhuhn extends EntityChicken
|
|
|
|
{
|
|
|
|
private static final Set<Item> TEMPTATION_ITEMS = Sets.newHashSet(Items.STICK);
|
2020-08-23 10:30:02 +02:00
|
|
|
|
2020-08-23 15:38:40 +02:00
|
|
|
public EntityHolzstammhuhn(World worldIn)
|
|
|
|
{
|
|
|
|
super(worldIn);
|
|
|
|
this.setSize(0.4F, 0.7F);
|
|
|
|
this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000;
|
|
|
|
this.setPathPriority(PathNodeType.WATER, 0.0F);
|
|
|
|
}
|
2020-08-23 10:30:02 +02:00
|
|
|
|
2020-08-23 15:38:40 +02:00
|
|
|
@Override
|
|
|
|
protected void initEntityAI()
|
|
|
|
{
|
|
|
|
this.tasks.addTask(0, new EntityAISwimming(this));
|
|
|
|
this.tasks.addTask(1, new EntityAIPanic(this, 1.4D));
|
|
|
|
this.tasks.addTask(2, new EntityAIMate(this, 1.0D));
|
|
|
|
this.tasks.addTask(3, new EntityAITempt(this, 1.0D, false, TEMPTATION_ITEMS));
|
|
|
|
this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D));
|
|
|
|
this.tasks.addTask(5, new EntityAIWanderAvoidWater(this, 1.0D));
|
|
|
|
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
|
|
|
|
this.tasks.addTask(7, new EntityAILookIdle(this));
|
|
|
|
}
|
2020-08-23 10:30:02 +02:00
|
|
|
|
2020-08-23 15:38:40 +02:00
|
|
|
@Override
|
|
|
|
public boolean isBreedingItem(ItemStack stack)
|
|
|
|
{
|
|
|
|
return TEMPTATION_ITEMS.contains(stack.getItem());
|
|
|
|
}
|
2020-08-14 19:24:29 +02:00
|
|
|
|
2020-08-23 15:38:40 +02:00
|
|
|
@Override
|
|
|
|
protected SoundEvent getAmbientSound()
|
|
|
|
{
|
|
|
|
return SoundEvents.BLOCK_WOOD_PLACE;
|
|
|
|
}
|
2020-08-14 19:24:29 +02:00
|
|
|
|
2020-08-23 15:38:40 +02:00
|
|
|
@Override
|
|
|
|
protected SoundEvent getHurtSound(DamageSource damageSourceIn)
|
|
|
|
{
|
|
|
|
return SoundEvents.BLOCK_WOOD_HIT;
|
|
|
|
}
|
2020-08-14 19:24:29 +02:00
|
|
|
|
2020-08-23 15:38:40 +02:00
|
|
|
@Override
|
|
|
|
protected SoundEvent getDeathSound()
|
|
|
|
{
|
|
|
|
return SoundEvents.BLOCK_WOOD_BREAK;
|
|
|
|
}
|
2020-08-23 10:30:02 +02:00
|
|
|
|
2020-08-23 15:38:40 +02:00
|
|
|
@Override
|
|
|
|
protected void playStepSound(BlockPos pos, Block blockIn)
|
|
|
|
{
|
|
|
|
this.playSound(SoundEvents.BLOCK_WOOD_STEP, 0.15F, 1.0F);
|
|
|
|
}
|
2020-08-23 10:30:02 +02:00
|
|
|
|
2020-08-23 15:38:40 +02:00
|
|
|
@Override
|
|
|
|
public EntityHolzstammhuhn createChild(EntityAgeable ageable)
|
|
|
|
{
|
|
|
|
return new EntityHolzstammhuhn(this.world);
|
|
|
|
}
|
2020-08-14 19:24:29 +02:00
|
|
|
}
|