Jump to content

[1.12] Lid of custom chest is dark and upside down


Recommended Posts

Posted

I'm trying to use ModelChest to render a lid for my chest in a TESR. However, the lid renders dark and upside down. I don't know if calling render on a model from the overridden function is not the correct way to do it or recommended. I do know that when I tried this but while extending FastTESR, the code crashed because of some buffering issues and the crash was caused by the call of render(0.0625f) over the model. Not understanding how it works I might me doing something ridiculous here. This is my code:

 

class TileEntitySimpleBoxRenderer : TileEntitySpecialRenderer<TileEntitySimpleBox>() {

    private val TEXTURE_NORMAL = ResourceLocation("textures/entity/chest/normal.png")
    private val simpleChest = ModelChest()

    override fun render(te: TileEntitySimpleBox, x: Double, y: Double, z: Double, partialTicks: Float, destroyStage: Int, alpha: Float) {
        // Store rendering flags
        GlStateManager.pushAttrib()
        // Store the viewport
        GlStateManager.pushMatrix()

        // Bind the chest texture
        this.bindTexture(TEXTURE_NORMAL)

        // Translate the location of the lid and knob
        GlStateManager.translate(x, y + 0.9, z)

        // Render the lid
        this.simpleChest.chestLid.render(0.0625f)
        // Render the knob
        this.simpleChest.chestKnob.render(0.0625F)

        // Restore the viewport
        GlStateManager.popMatrix()
        // Restore rendering flags
        GlStateManager.popAttrib()
    }
}

 

Result:

bmPQcR.png

 

 

Is there any way to make it normally bright, like a normal chest and flip it? By flipping it I mean maybe a method that takes care of it without having to use rotate and translate. If not I suppose I will have to use rotate and translate. I'm more concerned on fixing the brightness of the model rendered.

Posted (edited)

The lightning got fixed by using this.setLightmapDisabled(true) as in the solution found here.

 

 

But I feel I'm still doing something wrong since if I place more than one block, one lid renders normally lighted, and the other dark. Perhaps I should change the model of the block below the lid to be less than 1x1x1. After all, I have read various times it is not recommended to render anything bigger than 1x1x1.

 

Edit: After a check, this doesn't solve the brightness issue. As when the chest and the player stand in a completely dark area, the lid can be seen clearly despite there being no source of light. After all, the lightmap was disabled.

Edited by ctbe

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...

×   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.

Announcements



×
×
  • Create New...

Important Information

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