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

[1.10.2] Held ItemBlock from TESR turns dark


Matryoshika
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

  • 2 weeks later...

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.

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