Class TickComponent<C extends org.cyclops.cyclopscore.blockentity.CyclopsBlockEntity,T extends ITickAction<C>>

java.lang.Object
org.cyclops.evilcraft.core.blockentity.tickaction.TickComponent<C,T>
Type Parameters:
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.blockentity.CyclopsBlockEntity,T extends ITickAction<C>> extends Object
A component used in BlockEntityTickingTankInventory to support handling of ITickActions. A new instance can be created with a dictionary of (an extension of) ITickAction. It must be used like BlockEntityTickerDelayed.tick(Level, BlockPos, BlockState, BlockEntity). 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.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    TickComponent(C tile, com.google.common.collect.Multimap<Class<?>,T> tickActions, int slot)
    Make a new TickComponent that can be disabled with redstone.
    TickComponent(C tile, com.google.common.collect.Multimap<Class<?>,T> tickActions, int slot, boolean redstoneDisableable, boolean resetTickWhenCantTick)
    Make a new TickComponent.
    TickComponent(C tile, Map<Class<?>,T> tickActions, int slot)
    Make a new TickComponent that can be disabled with redstone.
    TickComponent(C tile, Map<Class<?>,T> tickActions, int slot, boolean redstoneDisableable, boolean resetTickWhenCantTick)
    Make a new TickComponent.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Get the required ticks for this ticker, will be zero if not defined.
    int
    Get the slot this ticker applies to.
    int
    The current tick progress.
    getTickAction(net.minecraft.world.item.Item item, int actionOffset)
     
    boolean
     
    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.world.item.ItemStack itemStack, int slot)
    Add one tick.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TickComponent

      public TickComponent(C tile, Map<Class<?>,T> tickActions, int slot, boolean redstoneDisableable, boolean resetTickWhenCantTick)
      Make a new TickComponent.
      Parameters:
      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.
      resetTickWhenCantTick - If the tick progress has to be reset when one of the ticks can't continue.
    • TickComponent

      public TickComponent(C tile, com.google.common.collect.Multimap<Class<?>,T> tickActions, int slot, boolean redstoneDisableable, boolean resetTickWhenCantTick)
      Make a new TickComponent.
      Parameters:
      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.
      resetTickWhenCantTick - If the tick progress has to be reset when one of the ticks can't continue.
    • TickComponent

      public TickComponent(C tile, Map<Class<?>,T> tickActions, int slot)
      Make a new TickComponent that can be disabled with redstone.
      Parameters:
      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.
    • TickComponent

      public TickComponent(C tile, com.google.common.collect.Multimap<Class<?>,T> tickActions, int slot)
      Make a new TickComponent that can be disabled with redstone.
      Parameters:
      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.
  • Method Details

    • getTickAction

      public T getTickAction(net.minecraft.world.item.Item item, int actionOffset)
    • tick

      public void tick(net.minecraft.world.item.ItemStack itemStack, int slot)
      Add one tick.
      Parameters:
      itemStack - The itemStack that is currently inside the slot for this ticker.
      slot - The slot id for the ticker.
    • getTick

      public int getTick()
      The current tick progress.
      Returns:
      Current tick.
    • setTick

      public void setTick(int tick)
      Set the current tick.
      Parameters:
      tick - New tick.
    • getRequiredTicks

      public float getRequiredTicks()
      Get the required ticks for this ticker, will be zero if not defined.
      Returns:
      Required ticks.
    • getSlot

      public int getSlot()
      Get the slot this ticker applies to.
      Returns:
      The slot.
    • setRequiredTicks

      public void setRequiredTicks(float requiredTicks)
      Set the required ticks, should only be called client side, for display purposes.
      Parameters:
      requiredTicks - The new required ticks.
    • isRedstoneDisableable

      public boolean isRedstoneDisableable()
      Returns:
      If this component is disableable with a redstone signal.