From 964c3b71f01386c02dd79e87796b06a7625fa289 Mon Sep 17 00:00:00 2001 From: TylerS1066 Date: Sun, 28 Jul 2024 08:33:44 -0500 Subject: [PATCH] Process tracked locations on all parent crafts --- .../movecraft/async/rotation/RotationTask.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Movecraft/src/main/java/net/countercraft/movecraft/async/rotation/RotationTask.java b/Movecraft/src/main/java/net/countercraft/movecraft/async/rotation/RotationTask.java index a542ea790..9cb10906a 100644 --- a/Movecraft/src/main/java/net/countercraft/movecraft/async/rotation/RotationTask.java +++ b/Movecraft/src/main/java/net/countercraft/movecraft/async/rotation/RotationTask.java @@ -27,6 +27,7 @@ import net.countercraft.movecraft.craft.Craft; import net.countercraft.movecraft.craft.CraftManager; import net.countercraft.movecraft.craft.SinkingCraft; +import net.countercraft.movecraft.craft.SubCraft; import net.countercraft.movecraft.craft.type.CraftType; import net.countercraft.movecraft.events.CraftRotateEvent; import net.countercraft.movecraft.events.CraftTeleportEntityEvent; @@ -178,11 +179,18 @@ protected void execute() { parentCraft.getFluidLocations().addAll(newFluidList); } - //Rotates the craft's tracked locations. - for (Set locations : craft.getTrackedLocations().values()) { - for (TrackedLocation location : locations) { - location.rotate(rotation, originPoint); + // Rotates the craft's tracked locations, then all parent craft's. + Craft temp = craft; + while (true) { + for (Set locations : craft.getTrackedLocations().values()) { + for (TrackedLocation location : locations) { + location.rotate(rotation, originPoint); + } } + if (!(temp instanceof SubCraft)) + break; + + temp = ((SubCraft) temp).getParent(); } updates.add(new CraftRotateCommand(getCraft(),originPoint, rotation));