Skip to content

Commit

Permalink
revert this as it broke rocket scanning
Browse files Browse the repository at this point in the history
  • Loading branch information
screret committed Sep 28, 2024
1 parent 5045b8f commit e402089
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e402089

Please sign in to comment.