Class MicroBlockPartRenderer

java.lang.Object
codechicken.microblock.client.MicroBlockPartRenderer
All Implemented Interfaces:
PartRenderer<MicroblockPart>

public class MicroBlockPartRenderer extends Object implements PartRenderer<MicroblockPart>
Created by covers1624 on 20/10/22.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    List<net.minecraft.client.renderer.block.model.BakedQuad>
    getQuads(MicroblockPart part, @Nullable net.minecraft.core.Direction side, net.minecraft.util.RandomSource rand, net.neoforged.neoforge.client.model.data.ModelData data, @Nullable net.minecraft.client.renderer.RenderType renderType)
    Get the static quads for this part, this is synonymous to IBakedModelExtension.getQuads(BlockState, Direction, RandomSource, ModelData, RenderType)
    void
    renderDynamic(MicroblockPart part, com.mojang.blaze3d.vertex.PoseStack pStack, net.minecraft.client.renderer.MultiBufferSource buffers, int packedLight, int packedOverlay, float partialTicks)
    Render the dynamic, changing faces of this part and/or other glfx.
    void
    renderStatic(MicroblockPart part, @Nullable net.minecraft.client.renderer.RenderType layer, codechicken.lib.render.CCRenderState ccrs)
    Deprecated.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface codechicken.multipart.api.part.render.PartRenderer

    drawHighlight, renderBreaking
  • Field Details

  • Constructor Details

    • MicroBlockPartRenderer

      public MicroBlockPartRenderer()
  • Method Details

    • getQuads

      public List<net.minecraft.client.renderer.block.model.BakedQuad> getQuads(MicroblockPart part, @Nullable @Nullable net.minecraft.core.Direction side, net.minecraft.util.RandomSource rand, net.neoforged.neoforge.client.model.data.ModelData data, @Nullable @Nullable net.minecraft.client.renderer.RenderType renderType)
      Description copied from interface: PartRenderer
      Get the static quads for this part, this is synonymous to IBakedModelExtension.getQuads(BlockState, Direction, RandomSource, ModelData, RenderType)

      This is method may be called on the chunk batching thread. World/state access should be performed in a thread-safe manner.

      It is highly recommended that parts do some form of caching for the data returned here.

      The current default implementation of this method delegates to PartRenderer.renderStatic(T, net.minecraft.client.renderer.RenderType, codechicken.lib.render.CCRenderState) and PartRenderer.renderBreaking(T, codechicken.lib.render.CCRenderState). When these methods are removed, this method will turn into a no-op.

      Specified by:
      getQuads in interface PartRenderer<MicroblockPart>
      Parameters:
      part - The part quads are required for.
      side - The side of the model requesting quads. Non-null sides will be culled if they are occluded. null for un-culled.
      rand - The RandomSource for this block position.
      data - Any ModelData this part has provided via MultiPart.getModelData().
      renderType - The RenderType pass. null is used for breaking overlay and other special rendering (enderman, etc). When null, if the player is currently looking at a part, only that part will be queried for quads.
      Returns:
      The quads, or an empty list.
    • renderStatic

      @Deprecated public void renderStatic(MicroblockPart part, @Nullable @Nullable net.minecraft.client.renderer.RenderType layer, codechicken.lib.render.CCRenderState ccrs)
      Deprecated.
      Description copied from interface: PartRenderer
      Render the static, unmoving faces of this part into the world renderer.

      The given CCRenderState is set up as follows should you wish to use it:

       - CCRenderState.reset() has been called.
       - The current buffer is bound to CCRenderState.
       - The LightMatrix is setup and ready to use.
       

      Should you wish to not use CCRenderState and associated utilities. You can obtain the raw VertexConsumer from CCRenderState.getConsumer() and the VertexFormat from CCRenderState.getVertexFormat().

      If you wish to render your part as a standard BakedModel please see PartBakedModelRenderer.

      This method may be called on chunk batching threads, all operations performed here must be thread aware.

      It is illegal to perform raw GL calls within this method. You will not have a valid GL context, or, a context from another thread.

      Specified by:
      renderStatic in interface PartRenderer<MicroblockPart>
      Parameters:
      part - The MultiPart being rendered.
      layer - The block RenderType layer being rendered. null for PartRenderer.renderBreaking(T, codechicken.lib.render.CCRenderState)
      ccrs - The CCRenderState instance to render with.
    • renderDynamic

      public void renderDynamic(MicroblockPart part, com.mojang.blaze3d.vertex.PoseStack pStack, net.minecraft.client.renderer.MultiBufferSource buffers, int packedLight, int packedOverlay, float partialTicks)
      Description copied from interface: PartRenderer
      Render the dynamic, changing faces of this part and/or other glfx.
      Specified by:
      renderDynamic in interface PartRenderer<MicroblockPart>
      Parameters:
      part - The MultiPart being rendered.
      pStack - The PoseStack to apply.
      buffers - The MultiBufferSource storage.
      packedLight - The packed LightMap coords to use. See LightTexture.
      packedOverlay - The packed Overlay coords to use. See OverlayTexture.
      partialTicks - The game partial ticks.