Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.leitedesnatado.examplemod.entities;
- import com.leitedesnatado.examplemod.init.ModEntityTypes;
- import net.minecraft.entity.AgeableEntity;
- import net.minecraft.entity.EntityType;
- import net.minecraft.entity.SharedMonsterAttributes;
- import net.minecraft.entity.ai.goal.BreedGoal;
- import net.minecraft.entity.ai.goal.FollowParentGoal;
- import net.minecraft.entity.ai.goal.LookAtGoal;
- import net.minecraft.entity.ai.goal.LookRandomlyGoal;
- import net.minecraft.entity.ai.goal.PanicGoal;
- import net.minecraft.entity.ai.goal.SwimGoal;
- import net.minecraft.entity.passive.AnimalEntity;
- import net.minecraft.entity.player.PlayerEntity;
- import net.minecraft.item.Items;
- import net.minecraft.item.crafting.Ingredient;
- import net.minecraft.util.SoundEvent;
- import net.minecraft.util.SoundEvents;
- import net.minecraft.world.World;
- public class PenguinEntity extends AnimalEntity {
- private int exampleTimer;
- private static final Ingredient TEMPTATION_ITEMS = Ingredient.fromItems(Items.COD, Items.SALMON);
- protected PenguinEntity(EntityType<? extends AnimalEntity> type, World worldIn) {
- super(type, worldIn);
- }
- @Override
- public AgeableEntity createChild(AgeableEntity ageable) {
- return ModEntityTypes.PENGUIN.get().create(this.world);
- }
- @Override
- protected void registerGoals() {
- super.registerGoals();
- this.goalSelector.addGoal(0, new SwimGoal(this));
- this.goalSelector.addGoal(1, new PanicGoal(this, 1.25D));
- this.goalSelector.addGoal(2, new BreedGoal(this, 1.0D));
- this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.1D));
- this.goalSelector.addGoal(7, new LookAtGoal(this, PlayerEntity.class, 6.0F));
- this.goalSelector.addGoal(8, new LookRandomlyGoal(this));
- }
- @Override
- public void livingTick() {
- if (this.world.isRemote) {
- this.exampleTimer = Math.max(0, this.exampleTimer - 1);
- }
- super.livingTick();
- }
- @Override
- protected void registerAttributes() {
- super.registerAttributes();
- this.getAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(8.0D);
- this.getAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.25D);
- }
- @Override
- protected int getExperiencePoints(PlayerEntity player) {
- return 1 + this.world.rand.nextInt(4);
- }
- @Override
- protected SoundEvent getAmbientSound() { return SoundEvents.ENTITY_POLAR_BEAR_AMBIENT; }
- @Override
- protected SoundEvent getDeathSound() { return SoundEvents.ENTITY_POLAR_BEAR_DEATH; }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement