Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.flerponius.submechanica.entities;
- import javax.annotation.Nullable;
- import com.flerponius.submechanica.init.SubmechanicaEntityTypes;
- import net.minecraft.block.BlockState;
- import net.minecraft.entity.AgeableEntity;
- import net.minecraft.entity.EntityType;
- import net.minecraft.entity.MobEntity;
- import net.minecraft.entity.ai.attributes.AttributeModifierMap;
- import net.minecraft.entity.ai.attributes.Attributes;
- 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.ai.goal.TemptGoal;
- import net.minecraft.entity.ai.goal.WaterAvoidingRandomWalkingGoal;
- 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.DamageSource;
- import net.minecraft.util.SoundEvent;
- import net.minecraft.util.SoundEvents;
- import net.minecraft.util.math.BlockPos;
- import net.minecraft.world.World;
- public class SpineSlugEntity extends AnimalEntity
- {
- public static final Ingredient TEMPTATION_ITEMS = Ingredient.fromItems(Items.BROWN_MUSHROOM,Items.RED_MUSHROOM,Items.CRIMSON_FUNGUS);
- public SpineSlugEntity(EntityType<? extends AnimalEntity> type,World worldIn) {super(type,worldIn);}
- public static AttributeModifierMap.MutableAttribute setCustomAttributes()
- {
- // func_233666_p_ --> registerAttributes
- return MobEntity
- .func_233666_p_()
- .createMutableAttribute(Attributes.MAX_HEALTH,30.0D)
- .createMutableAttribute(Attributes.MOVEMENT_SPEED,0.01D)
- .createMutableAttribute(Attributes.FOLLOW_RANGE,10.0D);
- }
- @Override
- protected void registerGoals()
- {
- super.registerGoals();
- this.goalSelector.addGoal(0,new SwimGoal(this));
- this.goalSelector.addGoal(1,new PanicGoal(this,0.02D));
- this.goalSelector.addGoal(2,new BreedGoal(this,0.02D));
- this.goalSelector.addGoal(3,new TemptGoal(this,0.02D,TEMPTATION_ITEMS,false));
- this.goalSelector.addGoal(4,new FollowParentGoal(this,0.03D));
- this.goalSelector.addGoal(5,new WaterAvoidingRandomWalkingGoal(this,1.0D));
- this.goalSelector.addGoal(6,new LookAtGoal(this,PlayerEntity.class,5.0F));
- this.goalSelector.addGoal(7,new LookRandomlyGoal(this));
- }
- @Override
- protected SoundEvent getAmbientSound() {return SoundEvents.ENTITY_SLIME_SQUISH;}
- @Override
- protected SoundEvent getDeathSound() {return SoundEvents.ENTITY_SLIME_DEATH;}
- @Override
- protected SoundEvent getHurtSound(DamageSource damageSourceIn) {return SoundEvents.ENTITY_SLIME_DEATH;}
- @Override
- protected void playStepSound(BlockPos pos,BlockState blockIn) {this.playSound(SoundEvents.ENTITY_SLIME_JUMP,0.15F,1.0F);}
- @Nullable
- @Override
- public AgeableEntity createChild(AgeableEntity ageable) {return SubmechanicaEntityTypes.SPINE_SLUG.get().create(this.world);}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement