Interface PartRenderer<T extends MultiPart>
- All Known Subinterfaces:
PartBakedModelRenderer<T>
- All Known Implementing Classes:
MicroBlockPartRenderer
MultiPart.
Created by covers1624 on 7/11/21.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleandrawHighlight(T part, PartRayTraceResult hit, net.minecraft.client.Camera camera, com.mojang.blaze3d.vertex.PoseStack pStack, net.minecraft.client.renderer.MultiBufferSource buffers, float partialTicks) Override the drawing of the selection box around this part.default List<net.minecraft.client.renderer.block.model.BakedQuad> getQuads(T 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 toIBakedModelExtension.getQuads(BlockState, Direction, RandomSource, ModelData, RenderType)default voidrenderBreaking(T part, codechicken.lib.render.CCRenderState ccrs) Deprecated.Raw chunk buffer access is being phased out, this is known to be incompatible with many mods.default voidrenderDynamic(T 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.default voidrenderStatic(T part, @Nullable net.minecraft.client.renderer.RenderType layer, codechicken.lib.render.CCRenderState ccrs) Deprecated.Raw chunk buffer access is being phased out, this is known to be incompatible with many mods.
-
Method Details
-
getQuads
default List<net.minecraft.client.renderer.block.model.BakedQuad> getQuads(T 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) Get the static quads for this part, this is synonymous toIBakedModelExtension.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
renderStatic(T, net.minecraft.client.renderer.RenderType, codechicken.lib.render.CCRenderState)andrenderBreaking(T, codechicken.lib.render.CCRenderState). When these methods are removed, this method will turn into a no-op.- 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.nullfor un-culled.rand- TheRandomSourcefor this block position.data- AnyModelDatathis part has provided viaMultiPart.getModelData().renderType- TheRenderTypepass.nullis used for breaking overlay and other special rendering (enderman, etc). Whennull, 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 default void renderStatic(T part, @Nullable @Nullable net.minecraft.client.renderer.RenderType layer, codechicken.lib.render.CCRenderState ccrs) Deprecated.Raw chunk buffer access is being phased out, this is known to be incompatible with many mods. Parts should migrate to returningBakedQuads fromgetQuads(T, net.minecraft.core.Direction, net.minecraft.util.RandomSource, net.neoforged.neoforge.client.model.data.ModelData, net.minecraft.client.renderer.RenderType).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 toCCRenderState. - TheLightMatrixis setup and ready to use.Should you wish to not use
CCRenderStateand associated utilities. You can obtain the rawVertexConsumerfromCCRenderState.getConsumer()and theVertexFormatfromCCRenderState.getVertexFormat().If you wish to render your part as a standard
BakedModelplease seePartBakedModelRenderer.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.
- Parameters:
part- TheMultiPartbeing rendered.layer- The blockRenderTypelayer being rendered.nullforrenderBreaking(T, codechicken.lib.render.CCRenderState)ccrs- TheCCRenderStateinstance to render with.
-
renderBreaking
Deprecated.Raw chunk buffer access is being phased out, this is known to be incompatible with many mods. Parts should migrate to returningBakedQuads fromgetQuads(T, net.minecraft.core.Direction, net.minecraft.util.RandomSource, net.neoforged.neoforge.client.model.data.ModelData, net.minecraft.client.renderer.RenderType), using thenullrender type as a marker for breaking.Override how your part displays its breaking progress overlay.By default, this method will delegate to
renderStatic(MultiPart, RenderType, CCRenderState)using anullRenderType.You shouldn't need to override this, in most cases the defaults will work just fine.
The given CCRenderState is set up as follows should you wish to use it:
-
CCRenderState.reset()has been called. - The current buffer is bound toCCRenderState. - TheLightMatrixis setup and ready to use.Should you wish to not use
CCRenderStateand associated utilities. You can obtain the rawVertexConsumerfromCCRenderState.getConsumer()and theVertexFormatfromCCRenderState.getVertexFormat().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.
- Parameters:
part- TheMultiPartbeing rendered.ccrs- TheCCRenderStateinstance to render with.
-
renderDynamic
default void renderDynamic(T 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.- Parameters:
part- TheMultiPartbeing rendered.pStack- ThePoseStackto apply.buffers- TheMultiBufferSourcestorage.packedLight- The packed LightMap coords to use. SeeLightTexture.packedOverlay- The packed Overlay coords to use. SeeOverlayTexture.partialTicks- The game partial ticks.
-
drawHighlight
default boolean drawHighlight(T part, PartRayTraceResult hit, net.minecraft.client.Camera camera, com.mojang.blaze3d.vertex.PoseStack pStack, net.minecraft.client.renderer.MultiBufferSource buffers, float partialTicks) Override the drawing of the selection box around this part.This is called with the context of
RenderHighlightEvent.Block.- Parameters:
part- TheMultiPartbeing rendered.hit- ThePartRayTraceResult.camera- TheCameracamera info.pStack- ThePoseStackto apply.buffers- TheMultiBufferSourcestorage.partialTicks- The game partial ticks.- Returns:
- If any custom rendering was applied.
falsefor defaultVoxelShapebased rendering.
-