Interface IRenderStateExtension
- All Known Implementing Classes:
BaseRenderState
public interface IRenderStateExtension
Extension class for render state objects. Implemented by
BaseRenderState
for
simple class extension.-
Method Summary
Modifier and TypeMethodDescription<T> T
getRenderData
(net.minecraft.util.context.ContextKey<T> key) Gets the object associated with the given key.default <T> T
getRenderDataOrDefault
(net.minecraft.util.context.ContextKey<T> key, T defaultVal) Gets the value or returns the default object if an object is not presentdefault <T> T
getRenderDataOrThrow
(net.minecraft.util.context.ContextKey<T> key) Gets the value or throws an exception.<T> void
setRenderData
(net.minecraft.util.context.ContextKey<T> key, T data) Sets the object associated with the given key.
-
Method Details
-
getRenderData
@Nullable <T> T getRenderData(net.minecraft.util.context.ContextKey<T> key) Gets the object associated with the given key.- 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
<T> void setRenderData(net.minecraft.util.context.ContextKey<T> key, @Nullable T data) Sets the object associated with the given key. Key should be stored statically for later retrieval of the object.- Type Parameters:
T
- Type of render data- Parameters:
key
- Static key reference objectdata
- Object to store for custom rendering
-
getRenderDataOrThrow
default <T> T getRenderDataOrThrow(net.minecraft.util.context.ContextKey<T> key) Gets the value or throws an exception. Should be used in cases where the data must be present.- Type Parameters:
T
- Type of render data- Parameters:
key
- Static key reference object- Returns:
- The data associate with the key
-
getRenderDataOrDefault
default <T> T getRenderDataOrDefault(net.minecraft.util.context.ContextKey<T> key, T defaultVal) Gets the value or returns the default object if an object is not present- Type Parameters:
T
- Type of render data- Parameters:
key
- Static key reference objectdefaultVal
- Default value if an object is not present- Returns:
- Value from the render data or the given default value if value is not present
-