From 07b2143d409a4cc15e880f1919e3e50da7c49698 Mon Sep 17 00:00:00 2001 From: paulevsGitch Date: Tue, 5 Jan 2021 01:46:54 +0300 Subject: [PATCH 1/4] Search fix --- src/main/java/ru/betterend/blocks/EndPortalBlock.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/ru/betterend/blocks/EndPortalBlock.java b/src/main/java/ru/betterend/blocks/EndPortalBlock.java index 806e8165..81470d25 100644 --- a/src/main/java/ru/betterend/blocks/EndPortalBlock.java +++ b/src/main/java/ru/betterend/blocks/EndPortalBlock.java @@ -99,7 +99,7 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTypeable Direction direction = Direction.EAST; BlockPos.Mutable checkPos = basePos.mutableCopy(); for (int step = 1; step < 64; step++) { - for (int i = 0; i < step; i++) { + for (int i = 0; i < (step >> 1); i++) { checkPos.setY(5); int ceil = world.getChunk(basePos).sampleHeightmap(Heightmap.Type.WORLD_SURFACE, checkPos.getX(), checkPos.getZ()) + 1; if (ceil < 5) continue; From 3283f9763b4b31c2206295947e00a46b1864dd00 Mon Sep 17 00:00:00 2001 From: paulevsGitch Date: Tue, 5 Jan 2021 01:57:47 +0300 Subject: [PATCH 2/4] Find center fix --- .../java/ru/betterend/blocks/EndPortalBlock.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/main/java/ru/betterend/blocks/EndPortalBlock.java b/src/main/java/ru/betterend/blocks/EndPortalBlock.java index 81470d25..a6d4ba60 100644 --- a/src/main/java/ru/betterend/blocks/EndPortalBlock.java +++ b/src/main/java/ru/betterend/blocks/EndPortalBlock.java @@ -16,6 +16,7 @@ import net.minecraft.sound.SoundEvents; import net.minecraft.util.BlockRotation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.util.math.Direction.AxisDirection; import net.minecraft.util.registry.Registry; import net.minecraft.world.Heightmap; import net.minecraft.world.World; @@ -146,17 +147,10 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTypeable BlockState right, left; Direction rightDir, leftDir; - if (axis == Direction.Axis.X) { - right = world.getBlockState(pos.east()); - left = world.getBlockState(pos.west()); - rightDir = Direction.EAST; - leftDir = Direction.WEST; - } else { - right = world.getBlockState(pos.south()); - left = world.getBlockState(pos.north()); - rightDir = Direction.SOUTH; - leftDir = Direction.NORTH; - } + rightDir = Direction.from(axis, AxisDirection.POSITIVE); + leftDir = rightDir.getOpposite(); + right = world.getBlockState(pos.offset(rightDir)); + left = world.getBlockState(pos.offset(leftDir)); BlockState down = world.getBlockState(pos.down()); if (down.isOf(this)) { return findCenter(world, pos.move(Direction.DOWN), axis, ++step); From c4384c7419c850946f29056987cf0bbce85250a5 Mon Sep 17 00:00:00 2001 From: paulevsGitch Date: Tue, 5 Jan 2021 01:59:28 +0300 Subject: [PATCH 3/4] Less steps --- src/main/java/ru/betterend/blocks/EndPortalBlock.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/ru/betterend/blocks/EndPortalBlock.java b/src/main/java/ru/betterend/blocks/EndPortalBlock.java index a6d4ba60..b934b1f8 100644 --- a/src/main/java/ru/betterend/blocks/EndPortalBlock.java +++ b/src/main/java/ru/betterend/blocks/EndPortalBlock.java @@ -143,8 +143,7 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTypeable } private BlockPos.Mutable findCenter(World world, BlockPos.Mutable pos, Direction.Axis axis, int step) { - if (step > 21) return pos; - + if (step > 4) return pos; BlockState right, left; Direction rightDir, leftDir; rightDir = Direction.from(axis, AxisDirection.POSITIVE); From 2fc9418e96d95212c681b6c6e34ae47173eb8aac Mon Sep 17 00:00:00 2001 From: paulevsGitch Date: Tue, 5 Jan 2021 02:02:10 +0300 Subject: [PATCH 4/4] Corrected steps --- src/main/java/ru/betterend/blocks/EndPortalBlock.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/ru/betterend/blocks/EndPortalBlock.java b/src/main/java/ru/betterend/blocks/EndPortalBlock.java index b934b1f8..76e081c7 100644 --- a/src/main/java/ru/betterend/blocks/EndPortalBlock.java +++ b/src/main/java/ru/betterend/blocks/EndPortalBlock.java @@ -143,7 +143,7 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTypeable } private BlockPos.Mutable findCenter(World world, BlockPos.Mutable pos, Direction.Axis axis, int step) { - if (step > 4) return pos; + if (step > 8) return pos; BlockState right, left; Direction rightDir, leftDir; rightDir = Direction.from(axis, AxisDirection.POSITIVE); @@ -152,7 +152,7 @@ public class EndPortalBlock extends NetherPortalBlock implements IRenderTypeable left = world.getBlockState(pos.offset(leftDir)); BlockState down = world.getBlockState(pos.down()); if (down.isOf(this)) { - return findCenter(world, pos.move(Direction.DOWN), axis, ++step); + return findCenter(world, pos.move(Direction.DOWN), axis, step); } else if (right.isOf(this) && left.isOf(this)) { return pos; } else if (right.isOf(this)) {