Class AbstractImmersive<I extends AbstractImmersiveInfo, R extends AbstractImmersiveRenderState, S extends NetworkStorage>

java.lang.Object
com.hammy275.immersivemc.client.immersive.AbstractImmersive<I,R,S>
All Implemented Interfaces:
Immersive<I,R,S>
Direct Known Subclasses:
ImmersiveBeacon, ImmersiveChest

public abstract class AbstractImmersive<I extends AbstractImmersiveInfo, R extends AbstractImmersiveRenderState, S extends NetworkStorage> extends Object implements Immersive<I,R,S>
  • Field Details

  • Constructor Details

    • AbstractImmersive

      public AbstractImmersive()
  • Method Details

    • getTrackedObjects

      public Collection<I> getTrackedObjects()
      Description copied from interface: Immersive
      Get the collection of ImmersiveInfos currently active for this Immersive. The contents of the list may be modified by ImmersiveMC with the intention of updating the actual set of active ImmersiveInfos.
      For example, if this Immersive represented a furnace, and the furnace was broken, ImmersiveMC would remove the ImmersiveInfo from the collection returned by this function to indicate that this Immersive should no longer handle the block, as it is no longer a furnace. As another example, if this Immersive represented a furnace, and a player placed a furnace, ImmersiveMC would add the result of Immersive.buildInfo(BlockPos, Level) to the collection returned by this function.
      In short, you should the actual collection of ImmersiveInfos used by this Immersive instead of a copy of it, unless you want to deal with a lot of extra work.
      Specified by:
      getTrackedObjects in interface Immersive<I extends AbstractImmersiveInfo, R extends AbstractImmersiveRenderState, S extends NetworkStorage>
      Returns:
      The collection of all ImmersiveInfos tied to this Immersive.
    • tick

      public void tick(I info)
      Description copied from interface: Immersive
      This method is called once per game tick. This is where you should, for example, recalculate hitboxes if needed.
      Specified by:
      tick in interface Immersive<I extends AbstractImmersiveInfo, R extends AbstractImmersiveRenderState, S extends NetworkStorage>
      Parameters:
      info - The info being ticked.
    • extractRenderState

      public void extractRenderState(I info, R renderState, float partialTicks)
      Description copied from interface: Immersive
      Extract render state from the info into the provided render state object.

      The extracted render state must be independent of the info it comes from such that mutations to the info do not affect the render state. For example, if the info contains a list of hitboxes, a modification to that list must NOT modify the list of hitboxes stored in the render state.

      Specified by:
      extractRenderState in interface Immersive<I extends AbstractImmersiveInfo, R extends AbstractImmersiveRenderState, S extends NetworkStorage>
      Parameters:
      info - Info to extract render state from.
      renderState - Render state to populate from the info. Note that the API does NOT cover the state of this object when this function is called. It only defines that this should be fully populated from the provided info for rendering. As such, it's recommended to set the values for all fields in this object based on the provided info every time this method is called.
      partialTicks - The fraction of time between the last tick and the current tick.