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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidextractRenderState(I info, R renderState, float partialTicks) Extract render state from the info into the provided render state object.Get the collection of ImmersiveInfos currently active for this Immersive.voidThis method is called once per game tick.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Immersive
buildInfo, configScreenInfo, createRenderState, getDragHitbox, getHandler, globalTick, handleHitboxInteract, isInputHitbox, isVROnly, processStorageFromNetwork, render, shouldDisableRightClicksWhenVanillaInteractionsDisabled, shouldRender
-
Field Details
-
infos
-
-
Constructor Details
-
AbstractImmersive
public AbstractImmersive()
-
-
Method Details
-
getTrackedObjects
Description copied from interface:ImmersiveGet 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 ofImmersive.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:
getTrackedObjectsin interfaceImmersive<I extends AbstractImmersiveInfo, R extends AbstractImmersiveRenderState, S extends NetworkStorage>- Returns:
- The collection of all ImmersiveInfos tied to this Immersive.
-
tick
Description copied from interface:ImmersiveThis method is called once per game tick. This is where you should, for example, recalculate hitboxes if needed.- Specified by:
tickin interfaceImmersive<I extends AbstractImmersiveInfo, R extends AbstractImmersiveRenderState, S extends NetworkStorage>- Parameters:
info- The info being ticked.
-
extractRenderState
Description copied from interface:ImmersiveExtract 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:
extractRenderStatein interfaceImmersive<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.
-