Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I have a tile entity renderer that renders a model. Code looks like this

 

    private static final ResourceLocation TEXTURE = ResourceHelper.createNew("block/test.png");

    private final ClockworksDoorModel model;
    private final RenderMaterial doorMaterial;

    public ClockworksDoorTileEntityRenderer(TileEntityRendererDispatcher dispatcher)
    {
        super(dispatcher);

        model = new ClockworksDoorModel();

        doorMaterial = new RenderMaterial(PlayerContainer.BLOCK_ATLAS, TEXTURE);
    }

    @Override
    public void render(ClockworksDoorTileEntity tileEntity, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer buffer, int combinedLight, int combinedOverlay)
    {
        IVertexBuilder builder = doorMaterial.buffer(buffer, RenderType::entityCutoutNoCull);

        model.renderToBuffer(matrixStack, builder, combinedLight, combinedOverlay, 1, 1, 1, 1);
    }

In game, however, it has the black and purple missing texture. When examining the log it does not report anything about missing textures if I put the path correctly, so I can only assume it's correctly finding my texture.

Please show the entire class and the ClockworksDoorModel. I'm imagining you are incorrectly binding information here. The block atlas will not hold your texture unless some block is also using it. Also, RenderMaterials do not contain the full path, just a relative ResourceLocation. I would instead follow the BoatRenderer model here since it will be much easier to use with the current data you are trying to draw.

  • Author

The code I posted was in fact the entire tile entity renderer, minus the class declaration. I have added some small stuff since for testing, but overall its the same and should be very similar to the enchanting table renderer.

public class ClockworksDoorTileEntityRenderer extends TileEntityRenderer<ClockworksDoorTileEntity>
{
    private static final ResourceLocation TEXTURE = ResourceHelper.createNew("block/test.png");

    private final ClockworksDoorModel model;
    private final RenderMaterial doorMaterial;

    public ClockworksDoorTileEntityRenderer(TileEntityRendererDispatcher dispatcher)
    {
        super(dispatcher);

        model = new ClockworksDoorModel();

        doorMaterial = new RenderMaterial(PlayerContainer.BLOCK_ATLAS, TEXTURE);
    }

    @Override
    public void render(ClockworksDoorTileEntity tileEntity, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer buffer, int combinedLight, int combinedOverlay)
    {
        matrixStack.pushPose();
        IVertexBuilder builder = doorMaterial.buffer(buffer, RenderType::entitySolid);

        model.renderToBuffer(matrixStack, builder, combinedLight, combinedOverlay, 1, 1, 1, 1);
        matrixStack.popPose();
    }
}

The model itself is just a basic model. Not much to showcase, but since I was asked I'll do it anyway.

public class ClockworksDoorModel extends Model
{
	private final ModelRenderer model;

	public ClockworksDoorModel()
	{
		super(RenderType::entitySolid);
		texWidth = 64;
		texHeight = 64;

		model = new ModelRenderer(this);
		model.setPos(8, 32, 8);
		model.texOffs(0, 0).addBox(-8.0F, -32.0F, -8.0F, 16.0F, 32.0F, 3.0F, 0.0F, false);
	}

	@Override
	public void renderToBuffer(MatrixStack matrixStack, IVertexBuilder builder, int partialLight, int partialOverlay, float red, float green, float blue, float alpha)
	{
		model.render(matrixStack, builder, partialLight, partialOverlay);
	}
}

 

  • Author

Tried several varations of the path:
Writing out the full path like Luis said above
Including and excluding "textures/"
Including and excluding the file extension

Nothing seems to be working. No error for anything either. Probably the biggest clue so far.

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.