Class BaseRenderState

java.lang.Object
net.neoforged.neoforge.client.renderstate.BaseRenderState
All Implemented Interfaces:
IRenderStateExtension

public abstract class BaseRenderState extends Object implements IRenderStateExtension
Extension class for RenderState objects (ie EntityRenderState). Allows modders to add arbitrary data onto render states for use in custom rendering.
  • Field Details

    • extensions

      protected final Map<net.minecraft.util.context.ContextKey<?>,Object> extensions
  • Constructor Details

    • BaseRenderState

      public BaseRenderState()
  • Method Details

    • getRenderData

      @Nullable public <T> T getRenderData(net.minecraft.util.context.ContextKey<T> key)
      Description copied from interface: IRenderStateExtension
      Gets the object associated with the given key.
      Specified by:
      getRenderData in interface IRenderStateExtension
      Type Parameters:
      T - Type of render data
      Parameters:
      key - Static key reference object
      Returns:
      The object associated with the key or null if the key is not present.
    • setRenderData

      public <T> void setRenderData(net.minecraft.util.context.ContextKey<T> key, @Nullable T data)
      Description copied from interface: IRenderStateExtension
      Sets the object associated with the given key. Key should be stored statically for later retrieval of the object.
      Specified by:
      setRenderData in interface IRenderStateExtension
      Type Parameters:
      T - Type of render data
      Parameters:
      key - Static key reference object
      data - Object to store for custom rendering
    • resetRenderData

      @Internal public void resetRenderData()