Interface ShaderEffectManager

All Known Implementing Classes:
ReloadableShaderEffectManager

public interface ShaderEffectManager
See Also:
  • Method Details

    • getInstance

      @API(status=STABLE) static ShaderEffectManager getInstance()
    • manage

      @API(status=STABLE, since="1.0.0") ManagedShaderEffect manage(net.minecraft.resources.ResourceLocation location)
      Manages a post-process PostChain loaded from a json definition file
      Parameters:
      location - the location of the json within your mod's assets
      Returns:
      a screen shader that will be automatically reloaded as needed
    • manage

      @API(status=STABLE, since="1.0.0") ManagedShaderEffect manage(net.minecraft.resources.ResourceLocation location, Consumer<ManagedShaderEffect> initCallback)
      Manages a post-process PostChain loaded from a json definition file
      Parameters:
      location - the location of the json within your mod's assets
      initCallback - a block ran once the shader effect is initialized
      Returns:
      a screen shader that will be automatically reloaded as needed
    • manageCoreShader

      @API(status=EXPERIMENTAL, since="1.6.0") ManagedCoreShader manageCoreShader(net.minecraft.resources.ResourceLocation location)
      Manages a core ShaderInstance loaded from a json definition file

      This overload forwards to manageCoreShader(ResourceLocation, VertexFormat) with DefaultVertexFormat.NEW_ENTITY, the format used by entity rendering

      The shader location must be in assets/shaders/core. Eg. to get a shader located at mymod/assets/shaders/core/myshader.json:

      ShaderEffectManager.getInstance().manageCoreShader(Identifier.of("mymod", "myshader")
      Parameters:
      location - the location of the json within your mod's assets
      Returns:
      a core render shader that will be reloaded as needed
    • manageCoreShader

      @API(status=EXPERIMENTAL, since="1.6.0") ManagedCoreShader manageCoreShader(net.minecraft.resources.ResourceLocation location, com.mojang.blaze3d.vertex.VertexFormat vertexFormat)
      Manages a core ShaderInstance loaded from a json definition file

      The shader location must be in assets/shaders/core. Eg. to get a shader located at mymod/assets/shaders/core/myshader.json:

      ShaderEffectManager.getInstance().manageCoreShader(Identifier.of("mymod", "myshader")
      Parameters:
      location - the location of the json within your mod's assets
      vertexFormat - the format expected by your shader
      Returns:
      a core render shader that will be reloaded as needed
    • manageCoreShader

      @API(status=EXPERIMENTAL, since="1.6.0") ManagedCoreShader manageCoreShader(net.minecraft.resources.ResourceLocation location, com.mojang.blaze3d.vertex.VertexFormat vertexFormat, Consumer<ManagedCoreShader> initCallback)
      Manages a core ShaderInstance loaded from a json definition file

      The shader location must be in assets/shaders/core. E.g. to get a shader located at mymod/assets/shaders/core/myshader.json:

      ShaderEffectManager.getInstance().manageCoreShader(Identifier.of("mymod", "myshader")
      Parameters:
      location - the location of the json within your mod's assets
      vertexFormat - the format expected by your shader
      initCallback - a block ran once the shader effect is initialized
      Returns:
      a core render shader that will be reloaded as needed
    • dispose

      @API(status=STABLE, since="1.0.0") void dispose(ManagedShaderEffect shader)
      Removes a shader from the global list of managed shaders, making it not respond to resource reloading and screen resizing. This also calls ManagedShaderEffect.release() to release the shader's resources. A ManagedShaderEffect object cannot be used after it has been disposed of.
      Parameters:
      shader - the shader to stop managing
      See Also:
    • dispose

      @API(status=EXPERIMENTAL, since="1.4.0") void dispose(ManagedCoreShader shader)