Class BaseRenderState
java.lang.Object
net.neoforged.neoforge.client.renderstate.BaseRenderState
- All Implemented Interfaces:
IRenderStateExtension
- Direct Known Subclasses:
EntityRenderState, LevelRenderState, MapRenderState, MapRenderState.MapDecorationRenderState, PlayerRenderState
Extension class for RenderState objects (ie
EntityRenderState).
Allows modders to add arbitrary data onto render states for use in custom rendering.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<ContextKey<?>, Object> private static final ContextKey<it.unimi.dsi.fastutil.objects.Object2BooleanMap<String>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the model part visibility ornullif all parts have their default visibility.<T> @Nullable TgetRenderData(ContextKey<T> key) Gets the object associated with the given key.voidoverrideModelPartVisibility(String modelPart, boolean visible) Changes the visibility of a specific model part afterModel.setupAnim(java.lang.Object)is called, but before rendering is performed.void<T> voidsetRenderData(ContextKey<T> key, @Nullable T data) Sets the object associated with the given key.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IRenderStateExtension
getRenderDataOrDefault, getRenderDataOrThrow
-
Field Details
-
MODEL_PART_VISIBILITY
private static final ContextKey<it.unimi.dsi.fastutil.objects.Object2BooleanMap<String>> MODEL_PART_VISIBILITY -
extensions
-
-
Constructor Details
-
BaseRenderState
public BaseRenderState()
-
-
Method Details
-
getRenderData
Description copied from interface:IRenderStateExtensionGets the object associated with the given key.- Specified by:
getRenderDatain interfaceIRenderStateExtension- 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
Description copied from interface:IRenderStateExtensionSets the object associated with the given key. Key should be stored statically for later retrieval of the object.- Specified by:
setRenderDatain interfaceIRenderStateExtension- Type Parameters:
T- Type of render data- Parameters:
key- Static key reference objectdata- Object to store for custom rendering
-
resetRenderData
-
overrideModelPartVisibility
Changes the visibility of a specific model part afterModel.setupAnim(java.lang.Object)is called, but before rendering is performed. This allows for hiding parts that are not normally configurable by the render state, for example hiding the player's head.- Parameters:
modelPart- Name of the model part. This will be looked up fromModel.root()viaModelPart.getChild(String)visible-falseto disable rendering of the part.- See Also:
-
getModelPartVisibility
-