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

  • Author

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

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.