@@ -93,15 +93,26 @@ private void onBuildButtonClick(ClickData data) {
93
93
Planet targetPlanet = PlanetIdChipBehaviour .getPlanetFromStack (idChip );
94
94
if (targetPlanet == null ) return ;
95
95
96
- boolean isNegative = this .getFrontFacing ().getAxisDirection () == Direction .AxisDirection .NEGATIVE ;
97
96
Direction back = this .getFrontFacing ().getOpposite ();
97
+ Direction left = this .getFrontFacing ().getCounterClockWise ();
98
+ Direction right = left .getOpposite ();
98
99
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 ( ));
103
104
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
+ }
105
116
106
117
AABB bounds = new AABB (startX , startY , startZ , endX , endY , endZ );
107
118
startX = (int ) bounds .minX ;
0 commit comments