| 17 | import javax.annotation.Nullable; |
| 18 | |
| 19 | public class ThiefEntity extends Animal { |
| 20 | |
| 21 | private boolean stealing = false; |
| 22 | |
| 23 | public ThiefEntity(EntityType<? extends Animal> type, Level worldIn) { |
| 24 | super(type, worldIn); |
| 25 | } |
| 26 | |
| 27 | @Override |
| 28 | protected void registerGoals() { |
| 29 | this.goalSelector.addGoal(0, new AvoidEntityGoalNoCombat<>(this, Player.class, 6.0F, 1.2, 1.2)); |
| 30 | this.goalSelector.addGoal(1, new ThiefFindChestGoal(this, 1.3)); |
| 31 | this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 0.8)); |
| 32 | this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 8.0F)); |
| 33 | this.goalSelector.addGoal(6, new RandomLookAroundGoal(this)); |
| 34 | } |
| 35 | |
| 36 | @Nullable |
| 37 | @Override |
| 38 | public AgeableMob getBreedOffspring(ServerLevel serverLevel, AgeableMob ageableMob) { |
| 39 | return null; |
| 40 | } |
| 41 | |
| 42 | @Override |
| 43 | public void load(CompoundTag tag) { |
| 44 | super.load(tag); |
| 45 | stealing = tag.getBoolean("Stealing"); |
| 46 | } |
| 47 | |
| 48 | @Override |
| 49 | public boolean save(CompoundTag tag) { |
| 50 | tag.putBoolean("Stealing", stealing); |
| 51 | return super.save(tag); |
| 52 | } |
| 53 | |
| 54 | public boolean isStealing() { |
| 55 | return stealing; |
| 56 | } |
| 57 | |
| 58 | public void setStealing(boolean stealing) { |
| 59 | this.stealing = stealing; |
| 60 | } |
| 61 | |
| 62 | // @Override |
| 63 | // public Packet<?> getAddEntityPacket() { |
| 64 | // return NetworkHooks.getEntitySpawningPacket(this); |
| 65 | // } |
| 66 | |
| 67 | public static AttributeSupplier.Builder prepareAttributes() { |
| 68 | return LivingEntity.createLivingAttributes() |
| 69 | .add(Attributes.ATTACK_DAMAGE, 3.0) |
| 70 | .add(Attributes.MAX_HEALTH, 20.0) |
| 71 | .add(Attributes.FOLLOW_RANGE, 40.0) |
| 72 | .add(Attributes.MOVEMENT_SPEED, 0.3); |
| 73 | } |
| 74 | } |
nothing calls this directly
no outgoing calls
no test coverage detected