Skip to content

Commit

Permalink
Force Centered Cleanroom Controller (#2501)
Browse files Browse the repository at this point in the history
  • Loading branch information
YoungOnionMC authored and screret committed Dec 27, 2024
1 parent 1779600 commit 182375b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ public void updateStructureDimensions() {
if (hDist != 0) break;
}

if (Math.abs(lDist - rDist) > 1 || Math.abs(bDist - fDist) > 1) {
this.isFormed = false;
return;
}

if (lDist < MIN_RADIUS || rDist < MIN_RADIUS || bDist < MIN_RADIUS || fDist < MIN_RADIUS || hDist < MIN_DEPTH) {
this.isFormed = false;
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ private TraceabilityPredicate logPredicate() {
}, null);
}

public boolean updateDimensions() {
public void updateDimensions() {
Level level = getLevel();
if (level == null) return false;
if (level == null) return;
Direction front = getFrontFacing();
Direction back = front.getOpposite();
Direction left = front.getCounterClockWise();
Expand All @@ -280,18 +280,21 @@ public boolean updateDimensions() {
if (hDist == 0 && isBlockFloor(level, hPos)) hDist = i;
}

if (Math.abs(lDist - rDist) > 1 || Math.abs(bDist - fDist) > 1) {
this.isFormed = false;
return;
}

if (lDist < MIN_RADIUS || rDist < MIN_RADIUS || fDist < MIN_RADIUS || bDist < MIN_RADIUS || hDist < MIN_DEPTH) {
onStructureInvalid();
return false;
this.isFormed = false;
return;
}

this.lDist = lDist;
this.rDist = rDist;
this.fDist = fDist;
this.bDist = bDist;
this.hDist = hDist;

return true;
}

private static boolean isBlockWall(Level level, BlockPos.MutableBlockPos pos, Direction direction) {
Expand Down

0 comments on commit 182375b

Please sign in to comment.