diff --git a/Changelog.md b/Changelog.md index bcc75837..d445f817 100644 --- a/Changelog.md +++ b/Changelog.md @@ -14,6 +14,7 @@ - improved AI of baby enderdragon - can not take damage from own attacks any more (immune to own area effect clouds that do damage) - once tamed, no longer tries to shoot other players + - attack/follow range is now adjustable through the config ### Version 1.18.2 - 2.0.3 diff --git a/common/src/main/java/com/tristankechlo/livingthings/config/entity/BabyEnderDragonConfig.java b/common/src/main/java/com/tristankechlo/livingthings/config/entity/BabyEnderDragonConfig.java index a3db5481..f720d5fb 100644 --- a/common/src/main/java/com/tristankechlo/livingthings/config/entity/BabyEnderDragonConfig.java +++ b/common/src/main/java/com/tristankechlo/livingthings/config/entity/BabyEnderDragonConfig.java @@ -16,13 +16,14 @@ public final class BabyEnderDragonConfig extends EntityConfig { public final DoubleValue health = new DoubleValue("health", 10.0D, MIN_HEALTH, MAX_HEALTH); public final DoubleValue movementSpeed = new DoubleValue("movementSpeed", 0.3D, MIN_SPEED, MAX_SPEED); public final DoubleValue flyingSpeed = new DoubleValue("flyingSpeed", 0.5D, MIN_SPEED, MAX_SPEED); + public final DoubleValue followRange = new DoubleValue("followRange", 64.0D, 0.0D, 2048.0D); // twice the default FOLLOW_RANGE public final BooleanValue canSpawn = new BooleanValue("canSpawn", true); public final IntegerValue maxSpawnedInChunk = new IntegerValue("maxSpawnedInChunk", 5, 1, 15); public final IngredientValue temptationItems = new IngredientValue("temptationItems", Items.CHORUS_FRUIT); private BabyEnderDragonConfig() { super("baby_ender_dragon"); - this.registerConfigValues(canAttack, health, movementSpeed, flyingSpeed, canSpawn, maxSpawnedInChunk, temptationItems); + this.registerConfigValues(canAttack, health, movementSpeed, flyingSpeed, followRange, canSpawn, maxSpawnedInChunk, temptationItems); } public static BabyEnderDragonConfig get() { @@ -57,4 +58,8 @@ public static Ingredient temptationItems() { return INSTANCE.temptationItems.get(); } + public static double followRange() { + return INSTANCE.followRange.get(); + } + } diff --git a/common/src/main/java/com/tristankechlo/livingthings/entity/BabyEnderDragonEntity.java b/common/src/main/java/com/tristankechlo/livingthings/entity/BabyEnderDragonEntity.java index 8449c5e0..08491398 100644 --- a/common/src/main/java/com/tristankechlo/livingthings/entity/BabyEnderDragonEntity.java +++ b/common/src/main/java/com/tristankechlo/livingthings/entity/BabyEnderDragonEntity.java @@ -69,7 +69,7 @@ protected void registerGoals() { this.goalSelector.addGoal(1, new FloatGoal(this)); this.goalSelector.addGoal(2, new CustomSitWhenOrderedToSitGoal(this)); this.goalSelector.addGoal(3, new TemptGoal(this, 1.0D, BabyEnderDragonConfig.temptationItems(), false)); - this.goalSelector.addGoal(4, new RangedAttackGoal(this, 1.1D, 120, 240, 25.0F)); + this.goalSelector.addGoal(4, new RangedAttackGoal(this, 1.1D, 120, 240, (float) BabyEnderDragonConfig.followRange())); this.goalSelector.addGoal(6, new FollowOwnerGoal(this, 1.3D, 10.0F, 3.0F, true)); this.goalSelector.addGoal(8, new WaterAvoidingRandomFlyingGoal(this, 1.2D)); this.goalSelector.addGoal(10, new LookAtPlayerGoal(this, Player.class, 8.0F)); @@ -179,7 +179,8 @@ public static AttributeSupplier.Builder createAttributes() { return Mob.createMobAttributes() .add(Attributes.MAX_HEALTH, BabyEnderDragonConfig.health()) .add(Attributes.MOVEMENT_SPEED, BabyEnderDragonConfig.movementSpeed()) - .add(Attributes.FLYING_SPEED, BabyEnderDragonConfig.flyingSpeed()); + .add(Attributes.FLYING_SPEED, BabyEnderDragonConfig.flyingSpeed()) + .add(Attributes.FOLLOW_RANGE, BabyEnderDragonConfig.followRange()); } public static boolean checkBabyEnderDragonSpawnRules(EntityType entityType, LevelAccessor level, MobSpawnType spawnReason, BlockPos pos, Random random) {