From 33cd2b2d7138973824948e8c501a46cd3e8cbf0f Mon Sep 17 00:00:00 2001 From: Abdiel Kavash <19243993+AbdielKavash@users.noreply.github.com> Date: Thu, 4 Jan 2024 01:46:19 -0600 Subject: [PATCH] Move structure initialization out of a loop. Oops. --- .../rituals/RitualEffectBiomeChanger.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectBiomeChanger.java b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectBiomeChanger.java index 800ecc90..e4724847 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectBiomeChanger.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/rituals/RitualEffectBiomeChanger.java @@ -85,24 +85,24 @@ public class RitualEffectBiomeChanger extends RitualEffect { BFSqueue.add(x); BFSqueue.add(z); + BiConsumer tryEnqueue = (nextX, nextZ) -> { + if (Math.abs(nextX - x) > range || Math.abs(nextZ - z) > range) return; + if (boolList[nextX - (x - range)][nextZ - (z - range)]) return; + + Block block = world.getBlock(nextX, y + 1, nextZ); + if (block == null || block.equals(ModBlocks.bloodStoneBrick) + || block.equals(ModBlocks.largeBloodStoneBrick)) + return; + + boolList[nextX - (x - range)][nextZ - (z - range)] = true; + BFSqueue.add(nextX); + BFSqueue.add(nextZ); + }; + while (!BFSqueue.isEmpty()) { Integer curX = BFSqueue.remove(); Integer curZ = BFSqueue.remove(); - BiConsumer tryEnqueue = (nextX, nextZ) -> { - if (Math.abs(nextX - x) > range || Math.abs(nextZ - z) > range) return; - if (boolList[nextX - (x - range)][nextZ - (z - range)]) return; - - Block block = world.getBlock(nextX, y + 1, nextZ); - if (block == null || block.equals(ModBlocks.bloodStoneBrick) - || block.equals(ModBlocks.largeBloodStoneBrick)) - return; - - boolList[nextX - (x - range)][nextZ - (z - range)] = true; - BFSqueue.add(nextX); - BFSqueue.add(nextZ); - }; - tryEnqueue.accept(curX + 1, curZ); tryEnqueue.accept(curX, curZ + 1); tryEnqueue.accept(curX - 1, curZ);