Skip to content

Commit e402089

Browse files
committed
revert this as it broke rocket scanning
1 parent 5045b8f commit e402089

File tree

2 files changed

+34
-12
lines changed

2 files changed

+34
-12
lines changed

src/main/java/argent_matter/gcyr/common/machine/multiblock/RocketScannerMachine.java

+17-6
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,26 @@ public void setRocketBuilt(boolean rocketBuilt) {
115115
this.rocketBuilt = rocketBuilt && isFormed;
116116
if (getLevel().isClientSide || !this.isFormed) return;
117117

118-
boolean isNegative = this.getFrontFacing().getAxisDirection() == Direction.AxisDirection.NEGATIVE;
119118
Direction back = this.getFrontFacing().getOpposite();
119+
Direction left = this.getFrontFacing().getCounterClockWise();
120+
Direction right = left.getOpposite();
120121
BlockPos current = getPos().relative(back, 1);
121-
int startX = current.getX() + (isNegative ? -1 : 1);
122-
int endX = current.getX() - (isNegative ? -(bDist - 1) : (bDist - 1));
123-
int startZ = current.getZ() - (isNegative ? -(lDist + 1) : (lDist + 1));
124-
int endZ = current.getZ() - (isNegative ? (rDist - 1) : -(rDist - 1));
122+
int startX = current.get(back.getAxis());
123+
int endX = current.relative(back, bDist - 1).get(back.getAxis());
124+
int startZ = current.relative(left, lDist).get(left.getAxis());
125+
int endZ = current.relative(right, rDist).get(right.getAxis());
125126
int startY = current.getY();
126-
int endY = current.getY() + hDist;
127+
int endY = current.offset(0, hDist, 0).getY();
128+
129+
if (this.getFrontFacing().getAxis() == Direction.Axis.Z) {
130+
// swap x & z coords if we're on the Z axis
131+
int temp = startX;
132+
startX = startZ;
133+
startZ = temp;
134+
temp = endX;
135+
endX = endZ;
136+
endZ = temp;
137+
}
127138

128139
AABB bounds = new AABB(startX, startY, startZ, endX, endY, endZ);
129140
startX = (int) bounds.minX;

src/main/java/argent_matter/gcyr/common/machine/multiblock/SpaceStationPackagerMachine.java

+17-6
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,26 @@ private void onBuildButtonClick(ClickData data) {
9393
Planet targetPlanet = PlanetIdChipBehaviour.getPlanetFromStack(idChip);
9494
if (targetPlanet == null) return;
9595

96-
boolean isNegative = this.getFrontFacing().getAxisDirection() == Direction.AxisDirection.NEGATIVE;
9796
Direction back = this.getFrontFacing().getOpposite();
97+
Direction left = this.getFrontFacing().getCounterClockWise();
98+
Direction right = left.getOpposite();
9899
BlockPos current = getPos().relative(back, 1);
99-
int startX = current.getX() + (isNegative ? -1 : 1);
100-
int endX = current.getX() + (isNegative ? (bDist - 1) : -(bDist - 1));
101-
int startZ = current.getZ() + (isNegative ? (lDist + 1) : -(lDist + 1));
102-
int endZ = current.getZ() - (isNegative ? (rDist - 1) : -(rDist - 1));
100+
int startX = current.get(back.getAxis());
101+
int endX = current.relative(back, bDist - 1).get(back.getAxis());
102+
int startZ = current.relative(left, lDist).get(left.getAxis());
103+
int endZ = current.relative(right, rDist).get(right.getAxis());
103104
int startY = current.getY();
104-
int endY = current.getY() + hDist;
105+
int endY = current.offset(0, hDist, 0).getY();
106+
107+
if (this.getFrontFacing().getAxis() == Direction.Axis.Z) {
108+
// swap x & z coords if we're on the Z axis
109+
int temp = startX;
110+
startX = startZ;
111+
startZ = temp;
112+
temp = endX;
113+
endX = endZ;
114+
endZ = temp;
115+
}
105116

106117
AABB bounds = new AABB(startX, startY, startZ, endX, endY, endZ);
107118
startX = (int) bounds.minX;

0 commit comments

Comments
 (0)