/* * Detaches this block from its controller. Calls detachBlock() and clears the controller member. */ protected void detachSelf(boolean chunkUnloading) { if (this.controller != null) { // Clean part out of controller this.controller.detachBlock(this, chunkUnloading); // The above should call onDetached, but, just in case... this.controller = null; } // Clean part out of lists in the registry MultiblockRegistry.onPartRemovedFromWorld(worldObj, this); }
/** * This is called when a block is being marked as valid by the chunk, but has not yet fully been * placed into the world's TileEntity cache. this.worldObj, xCoord, yCoord and zCoord have been * initialized, but any attempts to read data about the world can cause infinite loops - if you * call getTileEntity on this TileEntity's coordinate from within validate(), you will blow your * call stack. * * <p>TL;DR: Here there be dragons. * * @see net.minecraft.tileentity.TileEntity#validate() */ @Override public void validate() { super.validate(); MultiblockRegistry.onPartAdded(this.worldObj, this); }