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

[SOLVED] [1.7.10] Custom Rendered Block Lighting Bug

Recommended Posts

I'm attempting to create a custom rendered block, which will use a model from Techne. I've got everything rendering fine, except at random intervals I enccounter a weird lighting bug. I've tried using tessellator light values, disabling lighting, and nothing works. The rendered block switches between the two images seen below - the first (darker) one is the correct one.




Here's the rendering code I have at the moment:


public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
TileEntityCrystal te = ((TileEntityCrystal) tileentity);
float[] components = colors[tileentity.getBlockMetadata()];

glPushMatrix(); {
	glColor4f(components[0], components[1], components[2], 0.8F);

	double offsetX = (double) te.getOffsetX() / 512.0;
	double offsetZ = (double) te.getOffsetZ() / 512.0;

	glTranslated(d0 + 0.5 + offsetX, d1 + 1.5D, d2 + 0.5 + offsetZ);
	glRotatef(te.getRotation() / 255F * 360F, 0, 1, 0);
	glRotatef(180, 0F, 0F, 1F);
	model.render(null, 0, 0, 0, 0, 0, 0.0625F, te.getDensity()); // 1/16

Any ideas?


PS: the black variation of the block doesn't show up at all instead of becoming brighter. I assume this is linked to the same glitch...

Link to post
Share on other sites



You need to set the appropriate lighting settings otherwise you will carry over from the previous object rendered.


The two main settings to watch out for are the item model lighting and the block lighting (multitexturing).  This link explains it a bit.



This is a TESR example in 1.8 which renders reliably (uses the Tessellator):



Some further info on the steps it uses



The classes in 1.8 are slightly different to 1.7 but the logic is identical.


You might also find this tool useful to find out what the opengl settings are - dumpAllIsEnabled() for a good render, dumpAllIsEnabled() for a bad render, and spot the difference.






Link to post
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.

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.

  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Ok so apparently this bug only seems to happen in 1.16 and up... it's not present in any versions below those specific ones... but apparently, there seems to be an issue with texture stitching in the forge 1.16.4 version 35.1.37, or for that matter any 1.16+ forge version... I have an Intel Iris 1536 MB graphics card and a 2.6 GHz Dual-Core Intel Core i5 processor, and it may need to be updated, an un-updated driver might be the cause of the texture issue, I don't really know, but it seems to be on forge's end more than anything. I'll include an image showing the texture issue if that helps. Also, can someone look into this please? Note: Open the images in a new tab and zoom in ( CMD + on mac, CTRL + on Windows) to see the white lines/gaps in more detail.https://imgur.com/a/INB6g4c
    • Hello everyone!   I'm working on a tree model visualizer object, that can draw a tree dynamically to the screen regardless of how many nodes or subtrees there are. The user can move the display with dragging, and here comes the problem I have. I need every object that is outside of the object to be hidden, like on the advancement screen in vanilla, however, no matter how hard I looked at the vanilla code, I wasn't being able to figure out a way to do this. Right now, my objects are visible outside of the object. That is what I don't want to happen How would I be able to make this happen? Any help is appreciated!
    • sorry i will talk in english. there is the debug.log of server and the client debug.log debug.log
    • Aww thanks i guess... Makes sense now.
    • I showed you that code...    it was this, and your 'complained' about the deferred register name, then went on about Objectholder (which to be fair was only there because the ONLY other example of doing this wasn't exactly knowledgeable as to what was happening or why. I'm trying to figure out why the following works, and the example wasn't exactly updated, so i had to use IDE feedback to get it to work properly, and I used setRegistryName as a way to prevent it from using my own name space....    -- To be clear i'm not sure what i did that caused it to work..  but it does Just to be clear  This is sitting where the package says it's sitting.   -mine are sitting in com.dephoegon.reclaim....   package net.minecraft; import com.dephoegon.reclaim.aid.block.sand; import net.minecraft.block.AbstractBlock; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.material.MaterialColor; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraftforge.common.ToolType; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.registries.ObjectHolder; @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public class blockoverrides { public static final Block SAND = new sand(14406560, AbstractBlock.Properties.create(Material.SAND, MaterialColor.SAND) .harvestTool(ToolType.SHOVEL).harvestLevel(0) .hardnessAndResistance(0.5F).sound(SoundType.SAND) , "", "", "", true).setRegistryName("minecraft", "sand"); @SubscribeEvent public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) { blockRegistryEvent.getRegistry().registerAll ( SAND ); } public static final Item SAND_ITEM = new BlockItem(SAND, new Item.Properties().group(ItemGroup.BUILDING_BLOCKS)).setRegistryName("minecraft","sand"); @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll ( SAND_ITEM ); } }  
  • Topics

  • Who's Online (See full list)

  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.