From f13351111bf442c9986b3ea66898b600aea5ace7 Mon Sep 17 00:00:00 2001 From: TylerS1066 Date: Sun, 25 Aug 2024 20:44:14 -0500 Subject: [PATCH] Update sinking implementation --- .../movecraft/craft/CraftManager.java | 5 +++-- .../movecraft/craft/SinkingCraftImpl.java | 16 ---------------- .../craft/controller/SinkingControllerImpl.java | 4 ++++ .../craft/controller/SinkingController.java | 2 +- 4 files changed, 8 insertions(+), 19 deletions(-) delete mode 100644 Movecraft/src/main/java/net/countercraft/movecraft/craft/SinkingCraftImpl.java create mode 100644 Movecraft/src/main/java/net/countercraft/movecraft/craft/controller/SinkingControllerImpl.java diff --git a/Movecraft/src/main/java/net/countercraft/movecraft/craft/CraftManager.java b/Movecraft/src/main/java/net/countercraft/movecraft/craft/CraftManager.java index 1575ac7e7..451a9c784 100644 --- a/Movecraft/src/main/java/net/countercraft/movecraft/craft/CraftManager.java +++ b/Movecraft/src/main/java/net/countercraft/movecraft/craft/CraftManager.java @@ -21,6 +21,8 @@ import net.countercraft.movecraft.MovecraftLocation; import net.countercraft.movecraft.craft.controller.PilotController; import net.countercraft.movecraft.craft.controller.PlayerController; +import net.countercraft.movecraft.craft.controller.SinkingController; +import net.countercraft.movecraft.craft.controller.SinkingControllerImpl; import net.countercraft.movecraft.craft.type.CraftType; import net.countercraft.movecraft.events.CraftReleaseEvent; import net.countercraft.movecraft.events.CraftSinkEvent; @@ -200,11 +202,10 @@ public void sink(@NotNull Craft craft) { if (event.isCancelled()) return; - crafts.remove(craft); if (craft.getDataTag(Craft.CONTROLLER) instanceof PlayerController playerController) playerCrafts.remove(playerController.getPilot()); - crafts.add(new SinkingCraftImpl(craft)); + craft.setDataTag(Craft.CONTROLLER, new SinkingControllerImpl()); } public void release(@NotNull Craft craft, @NotNull CraftReleaseEvent.Reason reason, boolean force) { diff --git a/Movecraft/src/main/java/net/countercraft/movecraft/craft/SinkingCraftImpl.java b/Movecraft/src/main/java/net/countercraft/movecraft/craft/SinkingCraftImpl.java deleted file mode 100644 index 4f753bbdd..000000000 --- a/Movecraft/src/main/java/net/countercraft/movecraft/craft/SinkingCraftImpl.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.countercraft.movecraft.craft; - -import org.jetbrains.annotations.NotNull; - -public class SinkingCraftImpl extends BaseCraft implements SinkingCraft { - public SinkingCraftImpl(@NotNull Craft original) { - super(original.getType(), original.getWorld()); - hitBox = original.getHitBox(); - collapsedHitBox.addAll(original.getCollapsedHitBox()); - fluidLocations = original.getFluidLocations(); - setOrigBlockCount(original.getOrigBlockCount()); - setCruiseDirection(original.getCruiseDirection()); - setLastTranslation(original.getLastTranslation()); - setAudience(original.getAudience()); - } -} diff --git a/Movecraft/src/main/java/net/countercraft/movecraft/craft/controller/SinkingControllerImpl.java b/Movecraft/src/main/java/net/countercraft/movecraft/craft/controller/SinkingControllerImpl.java new file mode 100644 index 000000000..8d58b6a34 --- /dev/null +++ b/Movecraft/src/main/java/net/countercraft/movecraft/craft/controller/SinkingControllerImpl.java @@ -0,0 +1,4 @@ +package net.countercraft.movecraft.craft.controller; + +public class SinkingControllerImpl implements SinkingController { +} diff --git a/api/src/main/java/net/countercraft/movecraft/craft/controller/SinkingController.java b/api/src/main/java/net/countercraft/movecraft/craft/controller/SinkingController.java index b9a6f5e2b..84a6942f0 100644 --- a/api/src/main/java/net/countercraft/movecraft/craft/controller/SinkingController.java +++ b/api/src/main/java/net/countercraft/movecraft/craft/controller/SinkingController.java @@ -1,4 +1,4 @@ package net.countercraft.movecraft.craft.controller; -public interface SinkingController { +public interface SinkingController extends Controller { }