@Override public void load(NBTTagCompound nbt) { update = true; NBTTagList nbtList = nbt.getTagList("connect", 10); connections.clear(); for (int i = 0; i < nbtList.tagCount(); i++) { NBTTagCompound tag = nbtList.getCompoundTagAt(i); InterPoleWire p = new InterPoleWire(); p.load(tag); connections.add(p); } connectionsBlocked = nbt.getInteger("mode"); }
public static void findConnections(IElectricPole pole) { pole.disconnectAll(); int rad = 16; for (int x = -rad; x <= rad; x++) { for (int z = -rad; z <= rad; z++) { for (int y = -5; y <= 5; y++) { if (x == 0 && z == 0) continue; TileEntity t = new VecInt(pole.getParent()) .add(x, y, z) .getTileEntity(pole.getParent().getWorldObj()); IElectricPole p = ElectricUtils.getElectricPole(t); if (p == null) continue; if (p.canConnectWire(0, pole, false) && pole.canConnectWire(0, p, false)) { InterPoleWire wire = new InterPoleWire(new VecInt(pole.getParent()), new VecInt(p.getParent())); wire.setWorld(p.getParent().getWorldObj()); pole.onConnect(wire); p.onConnect(wire); } } } } }