C - A tile that has a consume and produce slot.T - The type of tick action that this component has to tick for.public class TickComponent<C extends org.cyclops.cyclopscore.tileentity.CyclopsTileEntity,T extends ITickAction<C>>
extends java.lang.Object
TickingTankInventoryTileEntity to support handling of ITickActions.
A new instance can be created with a dictionary of (an extension of) ITickAction.
It must be used like IUpdatePlayerListBox.update().
It will then tick for the given tile and slot and check the current item inside
the given slot. It will then take the class of that item and lookup the item class inside
that map to get the correct ITickAction on which it will call the methods.ITickAction,
TickingTankInventoryTileEntity| Constructor and Description |
|---|
TickComponent(C tile,
java.util.Map<java.lang.Class<?>,T> tickActions,
int slot)
Make a new TickComponent that can be disabled with redstone.
|
TickComponent(C tile,
java.util.Map<java.lang.Class<?>,T> tickActions,
int slot,
boolean redstoneDisableable)
Make a new TickComponent.
|
| Modifier and Type | Method and Description |
|---|---|
float |
getRequiredTicks()
Get the required ticks for this ticker, will be zero if not defined.
|
int |
getSlot()
Get the slot this ticker applies to.
|
int |
getTick()
The current tick progress.
|
protected T |
getTickAction(net.minecraft.item.Item item) |
boolean |
isRedstoneDisableable() |
void |
setRequiredTicks(float requiredTicks)
Set the required ticks, should only be called client side, for display purposes.
|
void |
setTick(int tick)
Set the current tick.
|
void |
tick(net.minecraft.item.ItemStack itemStack,
int slot)
Add one tick.
|
public TickComponent(C tile, java.util.Map<java.lang.Class<?>,T> tickActions, int slot, boolean redstoneDisableable)
tile - The IConsumeProduceTile reference in which this ticker runs.tickActions - The collection of actions this ticker can perform.
It must map the item class to an extension of ITickAction.slot - The inventory slot this ticker applies to.redstoneDisableable - If this ticker can be disabled when given a redstone signal.public TickComponent(C tile, java.util.Map<java.lang.Class<?>,T> tickActions, int slot)
tile - The IConsumeProduceTile reference in which this ticker runs.tickActions - The collection of actions this ticker can perform.
It must map the item class to an extension of ITickAction.slot - The inventory slot this ticker applies to.protected T getTickAction(net.minecraft.item.Item item)
public void tick(net.minecraft.item.ItemStack itemStack,
int slot)
itemStack - The itemStack that is currently inside the slot for this ticker.slot - The slot id for the ticker.public int getTick()
public void setTick(int tick)
tick - New tick.public float getRequiredTicks()
public int getSlot()
public void setRequiredTicks(float requiredTicks)
requiredTicks - The new required ticks.public boolean isRedstoneDisableable()