From 26c1a58709995aa3ad82094b49c6338e8472eefa Mon Sep 17 00:00:00 2001 From: ThePlasticPotato Date: Tue, 17 Dec 2024 00:33:27 -0500 Subject: [PATCH] Less ugly --- .../mod/mixin/entity/MixinEntity.java | 18 ------------------ .../mod/common/world/POIChunkSearcher.kt | 11 ++--------- 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/common/src/main/java/org/valkyrienskies/mod/mixin/entity/MixinEntity.java b/common/src/main/java/org/valkyrienskies/mod/mixin/entity/MixinEntity.java index 9e56ba83..18268c50 100644 --- a/common/src/main/java/org/valkyrienskies/mod/mixin/entity/MixinEntity.java +++ b/common/src/main/java/org/valkyrienskies/mod/mixin/entity/MixinEntity.java @@ -108,15 +108,6 @@ private void originalCheckInside(final AABBd aABB) { private void preGetEyePosition(final float partialTicks, final CallbackInfoReturnable cir) { final ShipMountedToData shipMountedToData = VSGameUtilsKt.getShipMountedToData(Entity.class.cast(this), partialTicks); if (shipMountedToData == null) { - if (Entity.class.cast(this) instanceof final ServerPlayer sPlayer && sPlayer instanceof final IEntityDraggingInformationProvider dragProvider) { - if (dragProvider.getDraggingInformation().isEntityBeingDraggedByAShip() && dragProvider.getDraggingInformation().getServerRelativePlayerPosition() != null) { - final Ship shipDraggedBy = VSGameUtilsKt.getAllShips(level).getById(dragProvider.getDraggingInformation().getLastShipStoodOn()); - if (shipDraggedBy != null) { - final Vector3dc worldPos = shipDraggedBy.getShipToWorld().transformPosition(dragProvider.getDraggingInformation().getServerRelativePlayerPosition(), new Vector3d()); - cir.setReturnValue(new Vec3(worldPos.x(), worldPos.y(), worldPos.z())); - } - } - } return; } final LoadedShip shipMountedTo = shipMountedToData.getShipMountedTo(); @@ -143,15 +134,6 @@ private void preGetEyePosition(final float partialTicks, final CallbackInfoRetur private void preGetEyePositionServer(final CallbackInfoReturnable cir) { final ShipMountedToData shipMountedToData = VSGameUtilsKt.getShipMountedToData(Entity.class.cast(this), null); if (shipMountedToData == null) { - if (Entity.class.cast(this) instanceof final ServerPlayer sPlayer && sPlayer instanceof final IEntityDraggingInformationProvider dragProvider) { - if (dragProvider.getDraggingInformation().isEntityBeingDraggedByAShip() && dragProvider.getDraggingInformation().getServerRelativePlayerPosition() != null) { - final Ship shipDraggedBy = VSGameUtilsKt.getAllShips(level).getById(dragProvider.getDraggingInformation().getLastShipStoodOn()); - if (shipDraggedBy != null) { - final Vector3dc worldPos = shipDraggedBy.getShipToWorld().transformPosition(dragProvider.getDraggingInformation().getServerRelativePlayerPosition(), new Vector3d()); - cir.setReturnValue(new Vec3(worldPos.x(), worldPos.y(), worldPos.z())); - } - } - } return; } final LoadedShip shipMountedTo = shipMountedToData.getShipMountedTo(); diff --git a/common/src/main/kotlin/org/valkyrienskies/mod/common/world/POIChunkSearcher.kt b/common/src/main/kotlin/org/valkyrienskies/mod/common/world/POIChunkSearcher.kt index 3a7e8a0d..d58423b9 100644 --- a/common/src/main/kotlin/org/valkyrienskies/mod/common/world/POIChunkSearcher.kt +++ b/common/src/main/kotlin/org/valkyrienskies/mod/common/world/POIChunkSearcher.kt @@ -15,6 +15,7 @@ import org.valkyrienskies.core.impl.chunk_tracking.ShipActiveChunksSet import org.valkyrienskies.mod.common.dimensionId import org.valkyrienskies.mod.common.getShipObjectManagingPos import org.valkyrienskies.mod.common.shipObjectWorld +import org.valkyrienskies.mod.common.toWorldCoordinates import org.valkyrienskies.mod.common.util.toJOML import org.valkyrienskies.mod.common.util.toMinecraft @@ -34,14 +35,6 @@ object POIChunkSearcher { } fun PoiRecord.getWorldPos(level: Level): Vec3 { - val blockPos = this.pos - val vecPos = Vec3(blockPos.x.toDouble(), blockPos.y.toDouble(), blockPos.z.toDouble()) - if (level.shipObjectWorld.isBlockInShipyard(blockPos.x, blockPos.y, blockPos.z, level.dimensionId)) { - val ship = level.getShipObjectManagingPos(blockPos) - if (ship != null) { - return ship.shipToWorld.transformPosition(vecPos.toJOML()).toMinecraft() - } - } - return vecPos + return level.toWorldCoordinates(Vec3(this.pos.x.toDouble(), this.pos.y.toDouble(), this.pos.z.toDouble())) } }