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

Hello!

 

I've been working on a block (Metamorphic Table) that converts ItemStack A -> ItemStack B when right-clicked / fed items (Using predefined recipes).

It is animated. Depending on what item you are holding, and if that item has an output in the table, it renders the output as a ghost-item, figuratively and literally.

After hours of tearing my code apart, I've managed to make it render [in world], [in inventory] & [in Hand], however, when held, the model turns dark, akin to a forgotten GL11.glDisable(GL11.GL_LIGHTING), though as far as I can see, everything is put back to it's original state before being 'popped.

 

TESR code

 

Anyone able to see why this would happen?

 

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Hi

 

For sure this has something to do with a lighting setting (eg the 'multitexturing' brightness lighting )

 

Is it your item that's dark, or does your TESR cause something else to go dark?

If the second, you could try      GL11.glPushAttrib(GL11.GL_ENABLE_BIT);

 

If the first, you could try

      OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, SKY_LIGHT_VALUE * 16.0F, BLOCK_LIGHT_VALUE * 16.0F);

before rendering your item

 

some clues here:

https://github.com/TheGreyGhost/MinecraftByExample/blob/master/src/main/java/minecraftbyexample/mbe21_tileentityspecialrenderer/TileEntitySpecialRendererMBE21.java

 

This link has some further info

http://greyminecraftcoder.blogspot.com.au/2014/12/lighting-18.html

It's 1.8 but the concepts are the same

 

-TGG

 

 

  • 2 weeks later...
  • Author

Well, seems that the rendering of the itemblock uses blending with destination factor of 0 (or equivalent outcome) as after hours and hours of debugging, I found I could replicate the dark model by rendering the placed block with blending dfactor of 0.

 

In the end, I had to compromise. Couldn't get [placed block] & [held itemblock] to ever be fully the same, so now it uses default model, and the extra is added through in-world activation.

 

For others if they have similar issues:

The actual part of the item-block rendering that had the dfactor of 0, was during the tesselator call.

Tessellator tessellator = Tessellator.getInstance();
        tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
        Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModel(
                world,
                getBakedModel(),
                world.getBlockState(te.getPos()),
                te.getPos(),
                Tessellator.getInstance().getBuffer(), false);
        tessellator.draw();

Without that, everything rendered fine, except the body of the TESR was of course missing.

The block itself had proper dfactor, just not the itemblock.

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

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.