Package org.moddingx.libx.render
Class ItemStackRenderer
java.lang.Object
net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer
org.moddingx.libx.render.ItemStackRenderer
- All Implemented Interfaces:
net.minecraft.server.packs.resources.PreparableReloadListener
,net.minecraft.server.packs.resources.ResourceManagerReloadListener
public class ItemStackRenderer
extends net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer
This class is meant to apply a
BlockEntityRenderer
to items. Using it is really straightforward:
- Add custom
client extensions
to your item throughItem.initializeClient(Consumer)
orBlockBase.initializeItemClient(Consumer)
- In
Registerable.registerClient(SetupContext)
calladdRenderBlock(BlockEntityType, boolean)
ItemModelProviderBase
.-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.server.packs.resources.PreparableReloadListener
net.minecraft.server.packs.resources.PreparableReloadListener.PreparationBarrier
-
Field Summary
Fields inherited from class net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer
blockEntityRenderDispatcher
-
Constructor Summary
ConstructorDescriptionItemStackRenderer
(net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher dispatcher, net.minecraft.client.model.geom.EntityModelSet modelSet) -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends net.minecraft.world.level.block.entity.BlockEntity>
voidaddRenderBlock
(net.minecraft.world.level.block.entity.BlockEntityType<T> beType, boolean readBlockEntityTag) Registers aBlockEntityType
to be rendered with the ItemStackRenderer.static net.minecraftforge.client.extensions.common.IClientItemExtensions
Creates someIClientItemExtensions
for with use theItemStackRenderer
.static ItemStackRenderer
get()
Gets the instance of the ItemStackRenderer.void
renderByItem
(net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.ItemDisplayContext ctx, com.mojang.blaze3d.vertex.PoseStack poseStack, net.minecraft.client.renderer.MultiBufferSource buffer, int light, int overlay) Methods inherited from class net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer
onResourceManagerReload
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.server.packs.resources.PreparableReloadListener
getName
Methods inherited from interface net.minecraft.server.packs.resources.ResourceManagerReloadListener
reload
-
Constructor Details
-
ItemStackRenderer
public ItemStackRenderer(net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher dispatcher, net.minecraft.client.model.geom.EntityModelSet modelSet)
-
-
Method Details
-
addRenderBlock
public static <T extends net.minecraft.world.level.block.entity.BlockEntity> void addRenderBlock(net.minecraft.world.level.block.entity.BlockEntityType<T> beType, boolean readBlockEntityTag) Registers aBlockEntityType
to be rendered with the ItemStackRenderer.- Parameters:
beType
- The Block Entity Type.readBlockEntityTag
- If this is set to true and an item has aBlockEntityTag
, the block entitiesload
method will get called before rendering.
-
renderByItem
public void renderByItem(net.minecraft.world.item.ItemStack stack, @Nonnull net.minecraft.world.item.ItemDisplayContext ctx, @Nonnull com.mojang.blaze3d.vertex.PoseStack poseStack, @Nonnull net.minecraft.client.renderer.MultiBufferSource buffer, int light, int overlay) - Overrides:
renderByItem
in classnet.minecraft.client.renderer.BlockEntityWithoutLevelRenderer
-
get
Gets the instance of the ItemStackRenderer. -
createProperties
public static net.minecraftforge.client.extensions.common.IClientItemExtensions createProperties()Creates someIClientItemExtensions
for with use theItemStackRenderer
.
-