Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[SLOVED][1.16.5]TileEntityRender render a full black block


tt36999
 Share

Recommended Posts

I'm trying to render item top of tileentity, but the ItemStack render a full black block

I have tried to find anyting wrong and i found when MC call TER class of my tileentity the param [combinedLightIn] is 0

I try to debugger and Evaluate

WorldRenderer.getLightColor(world, tile.getBlockPos());

other block, only position of my tileentity return 0

here are the code, does anyone know what should i do?

public class TestTileEntityRender extends TileEntityRenderer<TestTileEntity> {
    public TestTileEntityRender(TileEntityRendererDispatcher dispatcher) {
        super(dispatcher);
    }

    @Override
    public void render(TestTileEntity tile, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
      	// combinedLightIn this one is 0
        tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY).ifPresent(inv -> {
            ItemStack stack = inv.getStackInSlot(0);
            if (!stack.isEmpty()) {
                matrixStackIn.pushPose();
                matrixStackIn.translate(0.5, 1.5, 0.5);
                matrixStackIn.mulPose(Vector3f.YP.rotation(90));
                ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
                itemRenderer.renderStatic(stack, ItemCameraTransforms.TransformType.FIXED, combinedLightIn, combinedOverlayIn, matrixStackIn, bufferIn);// This line render a full black block
                matrixStackIn.popPose();
            }
        });
    }
}
Edited by tt36999
Link to comment
Share on other sites

  • 4 months later...
Posted (edited)

its to tell minecraft its not a simple full block - RenderType.solid() which is the default.

It goes in your FMLClientSetupEvent.

You don't need the enqueueWork for this, the setRenderLayer() is threadsafe.

Edited by warjort
  • Like 1
Link to comment
Share on other sites

 

13 hours ago, warjort said:

its to tell minecraft its not a simple full block - RenderType.solid() which is the default.

It goes in your FMLClientSetupEvent.

You don't need the enqueueWork for this, the setRenderLayer() is threadsafe.

 

15 hours ago, Will11690 said:
event.enqueueWork(() -> {

	RenderTypeLookup.setRenderLayer(ModBlocks.YOUR_BLOCK_HERE.get(), RenderType.cutout());

});

You need to add this to the same place you bind your TER.

Thanks! Now it works fine

Link to comment
Share on other sites

  • tt36999 changed the title to [SLOVED][1.16.5]TileEntityRender render a full black block
20 hours ago, warjort said:

its to tell minecraft its not a simple full block - RenderType.solid() which is the default.

It goes in your FMLClientSetupEvent.

You don't need the enqueueWork for this, the setRenderLayer() is threadsafe.

Thanks for the giving the explanation, I was just about to go to bed when I posted that so it was a quick and dirty copy paste just to help them out. Good tip about the setRenderLayer being thread safe. IDK why I've been doing it this way lol.

You can find my mod MechaniCraft at this link:

http://www.minecraftforge.net/forum/index.php/topic,13923.0.html

 

- Will11690

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.