@Override public void setOwner(ItemPossessor newOwner) { final ItemPossessor prevOwner = super.owner; super.setOwner(newOwner); if (prevOwner != newOwner) { if (newOwner instanceof Room) circuitKey = CMLib.tech().registerElectrics(this, circuitKey); else { CMLib.tech().unregisterElectronics(this, circuitKey); circuitKey = null; } } }
@Override public void destroy() { if ((!destroyed) && (circuitKey != null)) { CMLib.tech().unregisterElectronics(this, circuitKey); circuitKey = null; } super.destroy(); }