Advertisement
Guest User

Untitled

a guest
Oct 11th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.04 KB | None | 0 0
  1. package com.flerponius.submechanica.entities;
  2.  
  3. import javax.annotation.Nullable;
  4.  
  5. import com.flerponius.submechanica.init.SubmechanicaEntityTypes;
  6.  
  7. import net.minecraft.block.BlockState;
  8. import net.minecraft.entity.AgeableEntity;
  9. import net.minecraft.entity.EntityType;
  10. import net.minecraft.entity.MobEntity;
  11. import net.minecraft.entity.ai.attributes.AttributeModifierMap;
  12. import net.minecraft.entity.ai.attributes.Attributes;
  13. import net.minecraft.entity.ai.goal.BreedGoal;
  14. import net.minecraft.entity.ai.goal.FollowParentGoal;
  15. import net.minecraft.entity.ai.goal.LookAtGoal;
  16. import net.minecraft.entity.ai.goal.LookRandomlyGoal;
  17. import net.minecraft.entity.ai.goal.PanicGoal;
  18. import net.minecraft.entity.ai.goal.SwimGoal;
  19. import net.minecraft.entity.ai.goal.TemptGoal;
  20. import net.minecraft.entity.ai.goal.WaterAvoidingRandomWalkingGoal;
  21. import net.minecraft.entity.passive.AnimalEntity;
  22. import net.minecraft.entity.player.PlayerEntity;
  23. import net.minecraft.item.Items;
  24. import net.minecraft.item.crafting.Ingredient;
  25. import net.minecraft.util.DamageSource;
  26. import net.minecraft.util.SoundEvent;
  27. import net.minecraft.util.SoundEvents;
  28. import net.minecraft.util.math.BlockPos;
  29. import net.minecraft.world.World;
  30.  
  31. public class SpineSlugEntity extends AnimalEntity
  32. {
  33. public static final Ingredient TEMPTATION_ITEMS = Ingredient.fromItems(Items.BROWN_MUSHROOM,Items.RED_MUSHROOM,Items.CRIMSON_FUNGUS);
  34.  
  35. public SpineSlugEntity(EntityType<? extends AnimalEntity> type,World worldIn) {super(type,worldIn);}
  36.  
  37. public static AttributeModifierMap.MutableAttribute setCustomAttributes()
  38. {
  39. // func_233666_p_ --> registerAttributes
  40. return MobEntity
  41. .func_233666_p_()
  42. .createMutableAttribute(Attributes.MAX_HEALTH,30.0D)
  43. .createMutableAttribute(Attributes.MOVEMENT_SPEED,0.01D)
  44. .createMutableAttribute(Attributes.FOLLOW_RANGE,10.0D);
  45. }
  46.  
  47. @Override
  48. protected void registerGoals()
  49. {
  50. super.registerGoals();
  51. this.goalSelector.addGoal(0,new SwimGoal(this));
  52. this.goalSelector.addGoal(1,new PanicGoal(this,0.02D));
  53. this.goalSelector.addGoal(2,new BreedGoal(this,0.02D));
  54. this.goalSelector.addGoal(3,new TemptGoal(this,0.02D,TEMPTATION_ITEMS,false));
  55. this.goalSelector.addGoal(4,new FollowParentGoal(this,0.03D));
  56. this.goalSelector.addGoal(5,new WaterAvoidingRandomWalkingGoal(this,1.0D));
  57. this.goalSelector.addGoal(6,new LookAtGoal(this,PlayerEntity.class,5.0F));
  58. this.goalSelector.addGoal(7,new LookRandomlyGoal(this));
  59. }
  60.  
  61. @Override
  62. protected SoundEvent getAmbientSound() {return SoundEvents.ENTITY_SLIME_SQUISH;}
  63.  
  64. @Override
  65. protected SoundEvent getDeathSound() {return SoundEvents.ENTITY_SLIME_DEATH;}
  66.  
  67. @Override
  68. protected SoundEvent getHurtSound(DamageSource damageSourceIn) {return SoundEvents.ENTITY_SLIME_DEATH;}
  69.  
  70. @Override
  71. protected void playStepSound(BlockPos pos,BlockState blockIn) {this.playSound(SoundEvents.ENTITY_SLIME_JUMP,0.15F,1.0F);}
  72.  
  73.  
  74.  
  75. @Nullable
  76. @Override
  77. public AgeableEntity createChild(AgeableEntity ageable) {return SubmechanicaEntityTypes.SPINE_SLUG.get().create(this.world);}
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement