From 7cc50e8ce3b5b039824d201799f44efda2136ac7 Mon Sep 17 00:00:00 2001 From: George Paton Date: Sat, 15 Jun 2024 13:54:16 +1000 Subject: [PATCH] Deglobalize the NodeWorld nodes, dimensions were all sharing the same nodespace! --- src/main/java/api/hbm/energymk2/Nodespace.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/api/hbm/energymk2/Nodespace.java b/src/main/java/api/hbm/energymk2/Nodespace.java index 3f0888859..cdc618f51 100644 --- a/src/main/java/api/hbm/energymk2/Nodespace.java +++ b/src/main/java/api/hbm/energymk2/Nodespace.java @@ -19,8 +19,8 @@ import net.minecraft.world.World; public class Nodespace { /** Contains all "NodeWorld" instances, i.e. lists of nodes existing per world */ - public static HashMap worlds = new HashMap(); - public static Set activePowerNets = new HashSet(); + public static HashMap worlds = new HashMap<>(); + public static Set activePowerNets = new HashSet<>(); public static PowerNode getNode(World world, int x, int y, int z) { NodeWorld nodeWorld = worlds.get(world); @@ -49,6 +49,9 @@ public class Nodespace { for(World world : MinecraftServer.getServer().worldServers) { NodeWorld nodes = worlds.get(world); + + if(nodes == null) + continue; for(Entry entry : nodes.nodes.entrySet()) { PowerNode node = entry.getValue(); @@ -120,7 +123,7 @@ public class Nodespace { /** Contains a map showing where each node is, a node is every spot that a cable exists at. * Instead of the old proxy system, things like substation now create multiple nodes at their connection points */ - public static HashMap nodes = new HashMap(); + public HashMap nodes = new HashMap<>(); /** Adds a node at all its positions to the nodespace */ public void pushNode(PowerNode node) {