Class RenderTypeHelper

java.lang.Object
dev.cammiescorner.velvet.api.util.RenderTypeHelper

@API(status=EXPERIMENTAL, since="1.4.0") public final class RenderTypeHelper extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.client.renderer.RenderType
    copy(net.minecraft.client.renderer.RenderType existing, String newName, Consumer<net.minecraft.client.renderer.RenderType.CompositeState.CompositeStateBuilder> phaseTransform)
    Copies a RenderType with all its parameters, but applies the given phaseTransform to the copied parameters.
    static net.minecraft.client.renderer.RenderType.CompositeState
    copyPhaseParameters(net.minecraft.client.renderer.RenderType existing, Consumer<net.minecraft.client.renderer.RenderType.CompositeState.CompositeStateBuilder> phaseTransform)
     
    static String
    getName(net.minecraft.client.renderer.RenderStateShard phase)
    Gets the name of a RenderStateShard
    static void
    registerBlockRenderType(net.minecraft.client.renderer.RenderType type)
    Deprecated.
    this feature is likely to cause incompatibilities.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RenderTypeHelper

      public RenderTypeHelper()
  • Method Details

    • getName

      @API(status=EXPERIMENTAL, since="1.5.0") public static String getName(net.minecraft.client.renderer.RenderStateShard phase)
      Gets the name of a RenderStateShard

      This method can be used with copy(RenderType, String, Consumer) to make unique names based on the base layer's own name.

      Parameters:
      phase - a render phase or layer
      Returns:
      the name that was passed to RenderStateShard(String, Runnable, Runnable)
    • copy

      @API(status=EXPERIMENTAL, since="1.4.0") public static net.minecraft.client.renderer.RenderType copy(net.minecraft.client.renderer.RenderType existing, String newName, Consumer<net.minecraft.client.renderer.RenderType.CompositeState.CompositeStateBuilder> phaseTransform)
      Copies a RenderType with all its parameters, but applies the given phaseTransform to the copied parameters.

      A typical use of this method is to create a new render layer with a different target (eg. a target that supports shaders). For example:

      RenderTypeHelper.copy(
            RenderType.translucent(),
            "mymod:special_layer",
            builder -> builder.target(someShaderEnablingTarget)
       );
      Parameters:
      existing - the render layer to duplicate
      newName - the name of the new render layer
      phaseTransform - a transformation operation to apply to the new layer's parameter builder
      Returns:
      a RenderType with the same base parameters as existing but modified according to phaseTransform
      Throws:
      IllegalArgumentException - if existing is not a MultiPhase render layer
    • copyPhaseParameters

      @API(status=EXPERIMENTAL, since="1.4.0") public static net.minecraft.client.renderer.RenderType.CompositeState copyPhaseParameters(net.minecraft.client.renderer.RenderType existing, Consumer<net.minecraft.client.renderer.RenderType.CompositeState.CompositeStateBuilder> phaseTransform)
    • registerBlockRenderType

      @Deprecated @API(status=EXPERIMENTAL, since="1.5.0") public static void registerBlockRenderType(net.minecraft.client.renderer.RenderType type)
      Deprecated.
      this feature is likely to cause incompatibilities. Use at your own discretion.
      Register a custom RenderType for block rendering.

      Custom block render layers are usually not supported by alternative renderers. Calling this method will have no visible effect if one of those is active.

      Throws:
      IllegalStateException - if this method is called after buffer builders have been initialized.