Skip to content

Commit

Permalink
Process tracked locations on all parent crafts
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerS1066 committed Jul 28, 2024
1 parent 0ee6138 commit 964c3b7
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -178,11 +179,18 @@ protected void execute() {
parentCraft.getFluidLocations().addAll(newFluidList);
}

//Rotates the craft's tracked locations.
for (Set<TrackedLocation> 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<TrackedLocation> 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));
Expand Down

0 comments on commit 964c3b7

Please sign in to comment.