From 995377cac90db09d357987fbb9616f987faf47b7 Mon Sep 17 00:00:00 2001 From: __felix__ <134875831+felixfour@users.noreply.github.com> Date: Fri, 13 Mar 2026 23:57:37 -0400 Subject: [PATCH] move CubeIterator --- .../tileentities/TileDissEnchanter.java | 78 +------------------ 1 file changed, 1 insertion(+), 77 deletions(-) diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDissEnchanter.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDissEnchanter.java index b761d16d..f18bc365 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDissEnchanter.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileDissEnchanter.java @@ -22,6 +22,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.ForgeHooks; import com.brandon3055.draconicevolution.common.utils.ItemNBTHelper; +import com.gtnewhorizon.gtnhlib.geometry.CubeIterator; import crazypants.enderio.machine.obelisk.xp.TileExperienceObelisk; import crazypants.enderio.xp.ExperienceContainer; @@ -350,81 +351,4 @@ public class TileDissEnchanter extends TileEntity implements ISidedInventory { super.readFromNBT(compound); } - public static final class CubeIterator { - - public int range = 0; - - // wow, it's just like electron orbitals. and the spin is the sign. how beautiful - public int n = 0; - public int l = 0; - public int m = 0; - - CubeIterator(int range) { - this.range = range; - } - - // maybe i could put this in next() and make it an Iterator? - public boolean hasNext() { - return -n < range || -l < range || -m < range; - } - - public void next() { - // this shit looks like the decompile of an obfuscated assembly but i assure you it is hand written - m = -m; - if (m < 0) return; - l = -l; - if (l < 0) return; - n = -n; - if (n < 0) return; - if (l >= n || m > n) { - if (m >= l) { - if (n <= l) { - if (m > n) { - n ^= m; - m ^= n; - n ^= m; - if (l > m) { - ++m; - return; - } - m = 0; - ++l; - return; - } - l = 0; - m = 0; - ++n; - return; - } - n ^= l; - l ^= n; - n ^= l; - return; - } - if (n < m) { - n ^= m; - m ^= n; - n ^= m; - return; - } - m ^= l; - l ^= m; - m ^= l; - return; - } - if (l > m) { - m ^= l; - l ^= m; - m ^= l; - return; - } - n ^= l; - l ^= n; - n ^= l; - return; - } // i have just found out that Java has a `when` statement, but primitive pattern matching is preview - // and the syntax sucks (case boolean b when a>6) - // i genuinely would rather have written this bytecode by bytecode but here we are - } - }