From e402089e054b11d17f78b040286a3162127cc0c4 Mon Sep 17 00:00:00 2001 From: screret <68943070+screret@users.noreply.github.com> Date: Sat, 28 Sep 2024 19:40:05 +0300 Subject: [PATCH] revert this as it broke rocket scanning --- .../multiblock/RocketScannerMachine.java | 23 ++++++++++++++----- .../SpaceStationPackagerMachine.java | 23 ++++++++++++++----- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/src/main/java/argent_matter/gcyr/common/machine/multiblock/RocketScannerMachine.java b/src/main/java/argent_matter/gcyr/common/machine/multiblock/RocketScannerMachine.java index 216cdb8..b6a0519 100644 --- a/src/main/java/argent_matter/gcyr/common/machine/multiblock/RocketScannerMachine.java +++ b/src/main/java/argent_matter/gcyr/common/machine/multiblock/RocketScannerMachine.java @@ -115,15 +115,26 @@ public void setRocketBuilt(boolean rocketBuilt) { this.rocketBuilt = rocketBuilt && isFormed; if (getLevel().isClientSide || !this.isFormed) return; - boolean isNegative = this.getFrontFacing().getAxisDirection() == Direction.AxisDirection.NEGATIVE; Direction back = this.getFrontFacing().getOpposite(); + Direction left = this.getFrontFacing().getCounterClockWise(); + Direction right = left.getOpposite(); BlockPos current = getPos().relative(back, 1); - int startX = current.getX() + (isNegative ? -1 : 1); - int endX = current.getX() - (isNegative ? -(bDist - 1) : (bDist - 1)); - int startZ = current.getZ() - (isNegative ? -(lDist + 1) : (lDist + 1)); - int endZ = current.getZ() - (isNegative ? (rDist - 1) : -(rDist - 1)); + int startX = current.get(back.getAxis()); + int endX = current.relative(back, bDist - 1).get(back.getAxis()); + int startZ = current.relative(left, lDist).get(left.getAxis()); + int endZ = current.relative(right, rDist).get(right.getAxis()); int startY = current.getY(); - int endY = current.getY() + hDist; + int endY = current.offset(0, hDist, 0).getY(); + + if (this.getFrontFacing().getAxis() == Direction.Axis.Z) { + // swap x & z coords if we're on the Z axis + int temp = startX; + startX = startZ; + startZ = temp; + temp = endX; + endX = endZ; + endZ = temp; + } AABB bounds = new AABB(startX, startY, startZ, endX, endY, endZ); startX = (int) bounds.minX; diff --git a/src/main/java/argent_matter/gcyr/common/machine/multiblock/SpaceStationPackagerMachine.java b/src/main/java/argent_matter/gcyr/common/machine/multiblock/SpaceStationPackagerMachine.java index 9375e82..a0f410e 100644 --- a/src/main/java/argent_matter/gcyr/common/machine/multiblock/SpaceStationPackagerMachine.java +++ b/src/main/java/argent_matter/gcyr/common/machine/multiblock/SpaceStationPackagerMachine.java @@ -93,15 +93,26 @@ private void onBuildButtonClick(ClickData data) { Planet targetPlanet = PlanetIdChipBehaviour.getPlanetFromStack(idChip); if (targetPlanet == null) return; - boolean isNegative = this.getFrontFacing().getAxisDirection() == Direction.AxisDirection.NEGATIVE; Direction back = this.getFrontFacing().getOpposite(); + Direction left = this.getFrontFacing().getCounterClockWise(); + Direction right = left.getOpposite(); BlockPos current = getPos().relative(back, 1); - int startX = current.getX() + (isNegative ? -1 : 1); - int endX = current.getX() + (isNegative ? (bDist - 1) : -(bDist - 1)); - int startZ = current.getZ() + (isNegative ? (lDist + 1) : -(lDist + 1)); - int endZ = current.getZ() - (isNegative ? (rDist - 1) : -(rDist - 1)); + int startX = current.get(back.getAxis()); + int endX = current.relative(back, bDist - 1).get(back.getAxis()); + int startZ = current.relative(left, lDist).get(left.getAxis()); + int endZ = current.relative(right, rDist).get(right.getAxis()); int startY = current.getY(); - int endY = current.getY() + hDist; + int endY = current.offset(0, hDist, 0).getY(); + + if (this.getFrontFacing().getAxis() == Direction.Axis.Z) { + // swap x & z coords if we're on the Z axis + int temp = startX; + startX = startZ; + startZ = temp; + temp = endX; + endX = endZ; + endZ = temp; + } AABB bounds = new AABB(startX, startY, startZ, endX, endY, endZ); startX = (int) bounds.minX;