Skip to content

Commit

Permalink
hopefully fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AViewFromTheTop committed Oct 18, 2023
1 parent e10c17e commit 728d634
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ public class NaturalSpawnerMixin {
private static BlockPos.MutableBlockPos wilderWild$findFloorPos(ServerLevel level, int x, int startY, int z, int maxSearch) {
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(x, startY, z);
BlockPos.MutableBlockPos mutableBlockPosBelow = new BlockPos.MutableBlockPos(x, startY, z);
for (int i = 0; i < maxSearch; i++) {
mutableBlockPos.move(Direction.DOWN);
mutableBlockPosBelow.set(mutableBlockPos).move(Direction.DOWN);
if (level.getBlockState(mutableBlockPosBelow).isSolid()) {
Direction moveDirection = level.getBlockState(mutableBlockPos).isSolid() ? Direction.UP : Direction.DOWN;
for (int i = 0; i < maxSearch + 1; i++) {
if (level.getBlockState(mutableBlockPosBelow).isSolid() && !level.getBlockState(mutableBlockPos).isSolid()) {
break;
}
mutableBlockPos.move(moveDirection);
mutableBlockPosBelow.set(mutableBlockPos).move(Direction.DOWN);
}
return mutableBlockPos;
}
Expand Down

0 comments on commit 728d634

Please sign in to comment.