public abstract class MultiblockControllerBase extends java.lang.Object implements IMultiblockControllerInternal
Subordinate TileEntities implement the IMultiblockComponent class and, generally, should not have an update() loop.
| Modifier and Type | Class and Description |
|---|---|
protected static class |
MultiblockControllerBase.AssemblyState |
| Modifier and Type | Field and Description |
|---|---|
protected MultiblockControllerBase.AssemblyState |
assemblyState |
protected java.util.HashSet<IMultiblockComponent> |
connectedParts |
protected net.minecraft.world.World |
world |
| Modifier | Constructor and Description |
|---|---|
protected |
MultiblockControllerBase(net.minecraft.world.World world) |
| Modifier and Type | Method and Description |
|---|---|
void |
_onAssimilated(IMultiblockControllerInternal otherController)
Called when this machine is consumed by another controller.
|
void |
assimilate(IMultiblockControllerInternal other)
Assimilate another controller into this controller.
|
void |
attachBlock(IMultiblockComponent part)
Attach a new part to this machine.
|
void |
auditParts()
Checks all of the parts in the controller.
|
java.util.Set<IMultiblockComponent> |
checkForDisconnections()
Called when this machine may need to check for blocks that are no
longer physically connected to the reference coordinate.
|
void |
checkIfMachineIsWhole()
Check if the machine is whole or not.
|
java.util.Set<IMultiblockComponent> |
detachAllBlocks()
Detach all parts.
|
void |
detachBlock(IMultiblockComponent part,
boolean chunkUnloading)
Call to detach a block from this machine.
|
protected net.minecraft.util.math.BlockPos |
getCenterCoord() |
java.util.Collection<IMultiblockComponent> |
getComponents() |
java.lang.String |
getLastValidationError() |
net.minecraft.util.math.BlockPos |
getLastValidationErrorPosition() |
protected net.minecraft.util.math.BlockPos |
getMaximumCoord() |
protected net.minecraft.util.math.BlockPos |
getMinimumCoord() |
int |
getNumConnectedBlocks() |
java.lang.String |
getPartsListString() |
net.minecraft.util.math.BlockPos |
getReferenceCoord() |
protected int |
getTickCount() |
protected net.minecraft.util.math.BlockPos |
getTopCenterCoord() |
boolean |
isAssembled() |
protected void |
isBlockGoodForExteriorLevel(int level,
net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos) |
protected void |
isBlockGoodForInterior(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos)
The interior is any block that does not touch blocks outside the machine.
|
protected boolean |
isCoordInMultiblock(int x,
int y,
int z) |
boolean |
isEmpty() |
protected abstract void |
isMachineWhole()
Checks if a machine is whole.
|
protected abstract void |
onAssimilate(IMultiblockControllerInternal assimilated)
Callback.
|
abstract void |
onAssimilated(IMultiblockControllerInternal assimilator)
Callback.
|
protected abstract void |
onAttachedPartWithMultiblockData(IMultiblockComponent part,
net.minecraft.nbt.NBTTagCompound data)
Call when a block with cached save-delegate data is added to the multiblock.
|
protected abstract void |
onBlockAdded(IMultiblockComponent newPart)
Called when a new part is added to the machine.
|
protected abstract void |
onBlockRemoved(IMultiblockComponent oldPart)
Called when a part is removed from the machine.
|
protected void |
onMachineAssembled()
Called when a machine is assembled from a disassembled state.
|
protected void |
onMachineDisassembled()
Called when a machine is disassembled from an assembled state.
|
protected void |
onMachinePaused()
Called when a machine is paused from an assembled state
This generally only happens due to chunk-loads and other "system" events.
|
protected void |
onMachineRestored()
Called when a machine is restored to the assembled state from a paused state.
|
void |
reassemble()
Call to force the controller to check the multiblock's validity.
|
void |
recalculateMinMaxCoords()
Force this multiblock to recalculate its minimum and maximum coordinates
from the list of connected parts.
|
boolean |
shouldConsume(IMultiblockControllerInternal otherController)
Tests whether this multiblock should consume the other multiblock
and become the new multiblock master when the two multiblocks
are adjacent.
|
protected abstract void |
updateClient(int tickCount)
Client-side update loop.
|
void |
updateMultiblockEntity()
Driver for the update loop.
|
protected boolean |
updateOnInterval(int tickInterval) |
protected abstract boolean |
updateServer(int tickCount)
The server-side update loop! Use this similarly to a TileEntity's update loop.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdecodeDescriptionPacket, formatDescriptionPacket, getUnlocalizedType, getWorldObjwriteToNBTreadFromNBTgetOwnerHandlergetErrorLogicgetExactHumidity, getExactTemperature, getHumidity, getTemperaturereadGuiData, writeGuiDataprotected final net.minecraft.world.World world
protected MultiblockControllerBase.AssemblyState assemblyState
protected java.util.HashSet<IMultiblockComponent> connectedParts
protected MultiblockControllerBase(net.minecraft.world.World world)
public java.util.Collection<IMultiblockComponent> getComponents()
getComponents in interface IMultiblockControllerprotected abstract void onAttachedPartWithMultiblockData(IMultiblockComponent part, net.minecraft.nbt.NBTTagCompound data)
part - The NBT tag containing this controller's data.public void attachBlock(IMultiblockComponent part)
IMultiblockControllerInternalattachBlock in interface IMultiblockControllerInternalpart - The part to add.protected abstract void onBlockAdded(IMultiblockComponent newPart)
newPart - The part being added.protected abstract void onBlockRemoved(IMultiblockComponent oldPart)
oldPart - The part being removed.protected void onMachineAssembled()
protected void onMachineRestored()
protected void onMachinePaused()
protected void onMachineDisassembled()
public void detachBlock(IMultiblockComponent part, boolean chunkUnloading)
IMultiblockControllerInternaldetachBlock in interface IMultiblockControllerInternalpart - The part to detach from this machine.chunkUnloading - Is this entity detaching due to the chunk unloading? If true, the multiblock will be paused instead of broken.public java.lang.String getLastValidationError()
getLastValidationError in interface IMultiblockControllerpublic net.minecraft.util.math.BlockPos getLastValidationErrorPosition()
getLastValidationErrorPosition in interface IMultiblockControllerpublic void reassemble()
IMultiblockControllerreassemble in interface IMultiblockControllerprotected abstract void isMachineWhole()
throws MultiblockValidationException
MultiblockValidationExceptionpublic void checkIfMachineIsWhole()
IMultiblockControllerInternalcheckIfMachineIsWhole in interface IMultiblockControllerInternalpublic void assimilate(IMultiblockControllerInternal other)
IMultiblockControllerInternalassimilate in interface IMultiblockControllerInternalother - The controller to merge into this one.public void _onAssimilated(IMultiblockControllerInternal otherController)
_onAssimilated in interface IMultiblockControllerInternalotherController - The controller consuming this controller.protected abstract void onAssimilate(IMultiblockControllerInternal assimilated)
assimilated - The controller whose uniqueness was added to our own.public abstract void onAssimilated(IMultiblockControllerInternal assimilator)
onAssimilated in interface IMultiblockControllerInternalassimilator - The controller which has assimilated this controller.public final void updateMultiblockEntity()
IMultiblockControllerInternalupdateMultiblockEntity in interface IMultiblockControllerInternalprotected abstract boolean updateServer(int tickCount)
protected int getTickCount()
protected abstract void updateClient(int tickCount)
protected final boolean updateOnInterval(int tickInterval)
protected void isBlockGoodForExteriorLevel(int level,
net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos)
throws MultiblockValidationException
level - the level of the block on the multiblock, starting at 0 for the bottom.world - World object for the world in which this controller is located.pos - coordinate of the block being testedMultiblockValidationException - if the tested block is not allowed on the machine's side facesprotected void isBlockGoodForInterior(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos)
throws MultiblockValidationException
world - World object for the world in which this controller is located.pos - coordinate of the block being testedMultiblockValidationException - if the tested block is not allowed in the machine's interior@Nullable public net.minecraft.util.math.BlockPos getReferenceCoord()
getReferenceCoord in interface IMultiblockControllerInternalpublic int getNumConnectedBlocks()
public void recalculateMinMaxCoords()
IMultiblockControllerInternalrecalculateMinMaxCoords in interface IMultiblockControllerInternalprotected net.minecraft.util.math.BlockPos getMinimumCoord()
protected net.minecraft.util.math.BlockPos getMaximumCoord()
protected final net.minecraft.util.math.BlockPos getCenterCoord()
protected final net.minecraft.util.math.BlockPos getTopCenterCoord()
protected final boolean isCoordInMultiblock(int x,
int y,
int z)
public boolean isEmpty()
isEmpty in interface IMultiblockControllerInternalpublic boolean shouldConsume(IMultiblockControllerInternal otherController)
IMultiblockControllerInternalshouldConsume in interface IMultiblockControllerInternalotherController - The other multiblock controller.public java.lang.String getPartsListString()
getPartsListString in interface IMultiblockControllerInternalpublic void auditParts()
IMultiblockControllerInternalauditParts in interface IMultiblockControllerInternalpublic java.util.Set<IMultiblockComponent> checkForDisconnections()
IMultiblockControllerInternalcheckForDisconnections in interface IMultiblockControllerInternalpublic java.util.Set<IMultiblockComponent> detachAllBlocks()
IMultiblockControllerInternaldetachAllBlocks in interface IMultiblockControllerInternalpublic boolean isAssembled()
isAssembled in interface IMultiblockController