Interface PartRenderer<T extends MultiPart,S>
- All Known Subinterfaces:
BlockStatePartBakedModelRenderer<T>
- All Known Implementing Classes:
MicroblockPartRenderer
public interface PartRenderer<T extends MultiPart,S>
Responsible for all rendering related operations of a
MultiPart.
Created by covers1624 on 7/11/21.
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiondefault voidcollectParts(net.neoforged.neoforge.model.data.ModelData modelData, net.minecraft.world.level.BlockAndTintGetter level, net.minecraft.core.BlockPos pos, net.minecraft.util.RandomSource rand, List<net.minecraft.client.renderer.block.model.BlockModelPart> parts) Get the static quads for this part, this is synonymous toBlockStateModelExtension.collectParts(BlockAndTintGetter, BlockPos, BlockState, RandomSource, List)default @Nullable SCreate the state instance used for dynamicBlockEntityRendererbased rendering.default booleanextractBlockHighlight(T part, PartRayTraceResult hit, net.minecraft.client.renderer.LevelRenderer levelRenderer, net.minecraft.client.renderer.state.LevelRenderState levelRenderState, net.minecraft.client.Camera camera, net.minecraft.world.phys.shapes.CollisionContext collisionCtx, boolean isInTranslucentPass, boolean isHighContrast, Consumer<net.neoforged.neoforge.client.CustomBlockOutlineRenderer> cons) Override the drawing of the selection box around this part.default voidextractDynamicState(PartRenderer.BEState beState, S state, T part, float partialTick, net.minecraft.world.phys.Vec3 camera, @Nullable net.minecraft.client.renderer.feature.ModelFeatureRenderer.CrumblingOverlay breakProgress) Extract any state required to render this part.default voidsubmitDynamic(PartRenderer.BEState beState, S state, com.mojang.blaze3d.vertex.PoseStack poseStack, net.minecraft.client.renderer.SubmitNodeCollector collector, net.minecraft.client.renderer.state.CameraRenderState cameraState) Submit your dynamic geometry.
-
Method Details
-
collectParts
default void collectParts(net.neoforged.neoforge.model.data.ModelData modelData, net.minecraft.world.level.BlockAndTintGetter level, net.minecraft.core.BlockPos pos, net.minecraft.util.RandomSource rand, List<net.minecraft.client.renderer.block.model.BlockModelPart> parts) Get the static quads for this part, this is synonymous toBlockStateModelExtension.collectParts(BlockAndTintGetter, BlockPos, BlockState, RandomSource, List)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.
- Parameters:
modelData- The model data you returned fromMultiPart.getModelData().level- The level.pos- The block position.rand- TheRandomSourcefor this block position.parts- The output collector.
-
createDynamicState
Create the state instance used for dynamicBlockEntityRendererbased rendering.- Returns:
- The state.
nullwill disable dynamic rendering.
-
extractDynamicState
default void extractDynamicState(PartRenderer.BEState beState, S state, T part, float partialTick, net.minecraft.world.phys.Vec3 camera, @Nullable net.minecraft.client.renderer.feature.ModelFeatureRenderer.CrumblingOverlay breakProgress) Extract any state required to render this part.You should avoid binding your Part instance directly into the state, in the future extract and submit may not always run on the same thread.
- Parameters:
beState- Useful information from the BE's own state.state- Your state to fill.part- Your part.partialTick- The current partial ticks.camera- The camera location.breakProgress- The breaking progress.
-
submitDynamic
default void submitDynamic(PartRenderer.BEState beState, S state, com.mojang.blaze3d.vertex.PoseStack poseStack, net.minecraft.client.renderer.SubmitNodeCollector collector, net.minecraft.client.renderer.state.CameraRenderState cameraState) Submit your dynamic geometry.- Parameters:
beState- Useful information from the BE's own state.state- Your state with filled data.poseStack- The current pose stack.collector- The submission collector.cameraState- The camera state.
-
extractBlockHighlight
default boolean extractBlockHighlight(T part, PartRayTraceResult hit, net.minecraft.client.renderer.LevelRenderer levelRenderer, net.minecraft.client.renderer.state.LevelRenderState levelRenderState, net.minecraft.client.Camera camera, net.minecraft.world.phys.shapes.CollisionContext collisionCtx, boolean isInTranslucentPass, boolean isHighContrast, Consumer<net.neoforged.neoforge.client.CustomBlockOutlineRenderer> cons) Override the drawing of the selection box around this part.This is called with the context of
.invalid reference
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.
-