Class RegisterShadersEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.client.event.RegisterShadersEvent
- All Implemented Interfaces:
net.neoforged.fml.event.IModBusEvent
public class RegisterShadersEvent
extends net.neoforged.bus.api.Event
implements net.neoforged.fml.event.IModBusEvent
Fired to allow mods to register custom shaders.
This event is fired after the default Minecraft shaders have been registered.
This event is not cancellable, and does not
.invalid reference
have a result
This event is fired on the mod-specific event bus, only on the logical client.
-
Field Summary
Modifier and TypeFieldDescriptionprivate final ResourceProvider
private final List
<com.mojang.datafixers.util.Pair<ShaderInstance, Consumer<ShaderInstance>>> -
Constructor Summary
ConstructorDescriptionRegisterShadersEvent
(ResourceProvider resourceProvider, List<com.mojang.datafixers.util.Pair<ShaderInstance, Consumer<ShaderInstance>>> shaderList) -
Method Summary
Modifier and TypeMethodDescriptionReturns the client-side resource provider.void
registerShader
(ShaderInstance shaderInstance, Consumer<ShaderInstance> onLoaded) Registers a shader, and a callback for when the shader is loaded.
-
Field Details
-
resourceProvider
-
shaderList
private final List<com.mojang.datafixers.util.Pair<ShaderInstance,Consumer<ShaderInstance>>> shaderList
-
-
Constructor Details
-
RegisterShadersEvent
@Internal public RegisterShadersEvent(ResourceProvider resourceProvider, List<com.mojang.datafixers.util.Pair<ShaderInstance, Consumer<ShaderInstance>>> shaderList)
-
-
Method Details
-
getResourceProvider
Returns the client-side resource provider.- Returns:
- the client-side resource provider
-
registerShader
Registers a shader, and a callback for when the shader is loaded.When creating a
ShaderInstance
, pass in the client-side resource provider as the resource provider.Mods should not store the shader instance passed into this method. Instead, mods should store the shader passed into the registered load callback.
- Parameters:
shaderInstance
- a shaderonLoaded
- a callback for when the shader is loaded
-