Guest User

Untitled

a guest
Sep 5th, 2021
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. public class DarknessZombie extends MonsterEntity{
  2.  
  3. private static final DataParameter<Integer> DATA_SPECIAL_TYPE_ID = EntityDataManager.defineId(DarknessZombie.class, DataSerializers.INT);
  4.  
  5. public DarknessZombie(EntityType<? extends MonsterEntity> type, World world) {
  6. super(type,world);
  7. }
  8.  
  9. @Override
  10. protected void registerGoals() {
  11. goalSelector.addGoal(1, new SwimGoal(this));
  12. goalSelector.addGoal(2, new MeleeAttackGoal(this, 1, false));
  13. goalSelector.addGoal(7, new WaterAvoidingRandomWalkingGoal(this, 1));
  14. goalSelector.addGoal(8, new LookAtGoal(this, PlayerEntity.class, 8f));
  15. goalSelector.addGoal(8, new LookRandomlyGoal(this));
  16. targetSelector.addGoal(2, new HurtByTargetGoal(this));
  17. targetSelector.addGoal(3, new NearestAttackableTargetGoal<PlayerEntity>(this, PlayerEntity.class, true));
  18. addBehaviourGoals();
  19. }
  20.  
  21. @Override
  22. protected void defineSynchedData() {
  23. super.defineSynchedData();
  24. this.getEntityData().define(DATA_SPECIAL_TYPE_ID, 0);
  25. }
  26.  
  27. protected void addBehaviourGoals() {
  28. this.goalSelector.addGoal(7, new WaterAvoidingRandomWalkingGoal(this, 1.0D));
  29. this.targetSelector.addGoal(1, (new HurtByTargetGoal(this)).setAlertOthers(ZombifiedPiglinEntity.class));
  30. this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, PlayerEntity.class, true));
  31. this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillagerEntity.class, false));
  32. this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolemEntity.class, true));
  33. this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, TurtleEntity.class, 10, true, false, TurtleEntity.BABY_ON_LAND_SELECTOR));
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment