From b4db44985bfa99fb1e8828f126fa49baeba36065 Mon Sep 17 00:00:00 2001 From: Andreas Troelsen Date: Sun, 6 Oct 2024 14:56:09 +0200 Subject: [PATCH] Use Mob interface for on-spawn targeting. Since 1.13, we've had the Mob interface injected between Creature and LivingEntity, and it contains the targeting methods we use. Slimes were never Creatures, but they _are_ Mobs, so by swapping this interface out, we effectively patch up functionality that's been broken since the very beginning. Hopefully server owners don't actually depend on this piece of functionality being broken... --- changelog.md | 1 + .../java/com/garbagemule/MobArena/waves/MACreature.java | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index be6d1ff..8df5175 100644 --- a/changelog.md +++ b/changelog.md @@ -20,6 +20,7 @@ These changes will (most likely) be included in the next version. ### Changed - Recurrent waves can now be randomized. If two or more recurrent waves clash on wave number, frequency, _and_ priority, MobArena will now randomly pick between them. This should make it easier to create more varied and interesting wave setups without having to resort to only massively randomized default waves. - Single waves can now be randomized. If two or more single waves clash on wave number, MobArena will now randomly pick between them. This means it is now possible to make randomly selected bosses for boss waves, for instance. +- Slimes, Magma Cubes, Bats, Ghasts, Phantoms, and Ender Dragons now all target players in the same way other monsters do. ### Fixed - MobArena no longer throws errors when handling block explosions on Minecraft 1.21. diff --git a/src/main/java/com/garbagemule/MobArena/waves/MACreature.java b/src/main/java/com/garbagemule/MobArena/waves/MACreature.java index 43dcca5..abd71e8 100644 --- a/src/main/java/com/garbagemule/MobArena/waves/MACreature.java +++ b/src/main/java/com/garbagemule/MobArena/waves/MACreature.java @@ -7,11 +7,11 @@ import org.bukkit.DyeColor; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Bee; -import org.bukkit.entity.Creature; import org.bukkit.entity.Creeper; import org.bukkit.entity.EntityType; import org.bukkit.entity.Hoglin; import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Mob; import org.bukkit.entity.PigZombie; import org.bukkit.entity.PiglinAbstract; import org.bukkit.entity.Rabbit; @@ -181,9 +181,9 @@ public class MACreature { break; } - if (e instanceof Creature) { - Creature c = (Creature) e; - c.setTarget(WaveUtils.getClosestPlayer(arena, e)); + if (e instanceof Mob) { + Mob m = (Mob) e; + m.setTarget(WaveUtils.getClosestPlayer(arena, e)); } return e;