From 728d63401a7d4cdc5c10b41243fadd51203f7fc1 Mon Sep 17 00:00:00 2001 From: AViewFromTheTop <87103914+AViewFromTheTop@users.noreply.github.com> Date: Wed, 18 Oct 2023 16:40:10 -0400 Subject: [PATCH] hopefully fix --- .../mixin/entity/crab/NaturalSpawnerMixin.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/frozenblock/wilderwild/mixin/entity/crab/NaturalSpawnerMixin.java b/src/main/java/net/frozenblock/wilderwild/mixin/entity/crab/NaturalSpawnerMixin.java index 2cd7077489..4f76817f15 100644 --- a/src/main/java/net/frozenblock/wilderwild/mixin/entity/crab/NaturalSpawnerMixin.java +++ b/src/main/java/net/frozenblock/wilderwild/mixin/entity/crab/NaturalSpawnerMixin.java @@ -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; }