2
1
Fork 1
mirror of https://github.com/ACGaming/Spackenmobs synced 2024-05-19 20:04:10 +02:00
Spackenmobs/src/main/java/mod/acgaming/spackenmobs/entities/EntityHolzstammhuhn.java
2022-04-12 13:23:27 +02:00

90 lines
2.6 KiB
Java

package mod.acgaming.spackenmobs.entities;
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.*;
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.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import mod.acgaming.spackenmobs.misc.ModLootTableList;
public class EntityHolzstammhuhn extends EntityChicken
{
private static final Set<Item> TEMPTATION_ITEMS = Sets.newHashSet(Items.STICK);
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);
}
@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));
}
@Override
protected SoundEvent getAmbientSound()
{
return SoundEvents.BLOCK_WOOD_PLACE;
}
@Override
protected SoundEvent getHurtSound(DamageSource damageSourceIn)
{
return SoundEvents.BLOCK_WOOD_HIT;
}
@Override
protected SoundEvent getDeathSound()
{
return SoundEvents.BLOCK_WOOD_BREAK;
}
@Override
protected void playStepSound(BlockPos pos, Block blockIn)
{
this.playSound(SoundEvents.BLOCK_WOOD_STEP, 0.15F, 1.0F);
}
@Override
protected ResourceLocation getLootTable()
{
return ModLootTableList.ENTITIES_HOLZSTAMMHUHN;
}
@Override
public EntityHolzstammhuhn createChild(EntityAgeable ageable)
{
return new EntityHolzstammhuhn(this.world);
}
@Override
public boolean isBreedingItem(ItemStack stack)
{
return TEMPTATION_ITEMS.contains(stack.getItem());
}
}