public final class ModuleInfrared extends AbstractModule implements net.minecraftforge.common.capabilities.ICapabilityProvider, InfraredReceiver
| Constructor and Description |
|---|
ModuleInfrared(Casing casing,
Face face) |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
getCapability(net.minecraftforge.common.capabilities.Capability<T> capability,
net.minecraft.util.EnumFacing facing) |
boolean |
hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability,
net.minecraft.util.EnumFacing facing) |
void |
onBeforeWriteComplete(Port port)
Called from a pipe this module is writing to when the data is being read.
|
void |
onDisabled()
Called when the multi-block of casings the module is installed in is
disabled, or when the module was removed from an enabled casing.
|
void |
onInfraredPacket(InfraredPacket packet,
net.minecraft.util.math.RayTraceResult hit)
Called when an infrared packet collides with this.
|
void |
onWriteComplete(Port port)
Called from a pipe this module is writing to when the data was read.
|
void |
readFromNBT(net.minecraft.nbt.NBTTagCompound nbt)
Restore the state of the module from the specified NBT compound.
|
void |
render(boolean enabled,
float partialTicks)
Called to allow the module to render dynamic content on the casing it
is installed in.
|
void |
step()
Advance the state of the module.
|
void |
writeToNBT(net.minecraft.nbt.NBTTagCompound nbt)
Save the state of the module to the specified NBT compound.
|
cancelRead, cancelWrite, getCasing, getFace, getPlayerLookAt, hitToUV, isPlayerLookingAt, isVisible, onActivate, onData, onData, onDisposed, onEnabled, onInstalled, onUninstalledpublic void step()
ModuleThis is called by the controller of the system the module is part of each tick the system is running.
step in interface Modulestep in class AbstractModulepublic void onDisabled()
ModuleModules should use this to reset their state, so that cycling power of a controller resets the whole multi-block system.
Note that this is only called on the server.
onDisabled in interface ModuleonDisabled in class AbstractModulepublic void onBeforeWriteComplete(Port port)
Module
The key difference to Module.onWriteComplete(Port) is that this is called
directly during the read operation, so this may be called before or after
the module's Module.step() for the current cycle. As such, no operations
which might influence number of required cycles for the current transfer
operation should be performed in this method. It may be used to cancel
other write operations to write a value only once, for example, or to update
some other internal state before a read operation completes (used by the
stack module for example, to ensure the correct value is being popped).
onBeforeWriteComplete in interface ModuleonBeforeWriteComplete in class AbstractModuleport - the port on which the write operation will be completed.public void onWriteComplete(Port port)
ModuleThis allows completing the operation in the same tick in which the read operation was completed. This is particularly useful when writing to multiple ports at a time but the written value may only be read once; in this case the remaining writes can be canceled in this callback.
onWriteComplete in interface ModuleonWriteComplete in class AbstractModuleport - the port on which the write operation was completed.public void render(boolean enabled,
float partialTicks)
ModuleThe render state will be adjusted to take into account the face the module is installed in, i.e. rendering from (0, 0, 0) to (1, 1, 0) will render the full quad of face of the casing the module is installed in.
Note that the enabled is the same as Casing.isEnabled(),
it is merely passed along for backwards compatibility from before the
time that getter existed.
render in interface Modulerender in class AbstractModuleenabled - whether the module is currently enabled.partialTicks - the partial time elapsed in this tick.public void readFromNBT(net.minecraft.nbt.NBTTagCompound nbt)
ModulereadFromNBT in interface ModulereadFromNBT in class AbstractModulenbt - the tag to load the state from.public void writeToNBT(net.minecraft.nbt.NBTTagCompound nbt)
ModulewriteToNBT in interface ModulewriteToNBT in class AbstractModulenbt - the tag to save the state to.public boolean hasCapability(@Nonnull
net.minecraftforge.common.capabilities.Capability<?> capability,
@Nullable
net.minecraft.util.EnumFacing facing)
hasCapability in interface net.minecraftforge.common.capabilities.ICapabilityProvider@Nullable
public <T> T getCapability(@Nonnull
net.minecraftforge.common.capabilities.Capability<T> capability,
@Nullable
net.minecraft.util.EnumFacing facing)
getCapability in interface net.minecraftforge.common.capabilities.ICapabilityProviderpublic void onInfraredPacket(InfraredPacket packet, net.minecraft.util.math.RayTraceResult hit)
InfraredReceiveronInfraredPacket in interface InfraredReceiverpacket - the packet that collided with this.hit - the information on the hit.