GyroEmpire Posted May 24, 2014 Posted May 24, 2014 I was having trouble with my connected textures not rendering properly, so i added a custom renderer for the block to try to flip them back around. My new renderer was successful at fixing the connections, but i caused a weird overlay to occur on the blocks. Its very random, and i can sometimes manage to get it to place one without the overlay. The bright one on the left is the original, how i want it to look. The others are affected by the strange overlay. Here's my full source, https://github.com/PeteNorf/WorldDominationSource/tree/master/java/worlddomination The blocks being used are BlockTileConnected, BlockSolarPanel, and the renderer is found in /client/render/block. Renderer: Reveal hidden contents package worlddomination.client.render.block; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.world.IBlockAccess; import net.minecraftforge.common.util.ForgeDirection; import worlddomination.core.WDBlock; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; public class BlockConnectedRenderer implements ISimpleBlockRenderingHandler { @Override public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { } @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { block.setBlockBounds(0, 0, 0, 1, 1, 1); renderer.setRenderBoundsFromBlock(block); for (int d = 0; d < 6; d++) { ForgeDirection dir1 = ForgeDirection.getOrientation(d); if (block.shouldSideBeRendered(world, x, y, z, dir1.getOpposite().ordinal())) { if (dir1 == ForgeDirection.NORTH || dir1 == ForgeDirection.EAST) { renderer.flipTexture = true; } switch (d) { case 0: renderer.renderFaceYNeg(block, x, y, z, block.getIcon(world, x, y, z, d)); break; case 1: renderer.renderFaceYPos(block, x, y, z, block.getIcon(world, x, y, z, d)); break; case 2: renderer.renderFaceZNeg(block, x, y, z, block.getIcon(world, x, y, z, d)); break; case 3: renderer.renderFaceZPos(block, x, y, z, block.getIcon(world, x, y, z, d)); break; case 4: renderer.renderFaceXNeg(block, x, y, z, block.getIcon(world, x, y, z, d)); break; case 5: renderer.renderFaceXPos(block, x, y, z, block.getIcon(world, x, y, z, d)); break; } renderer.flipTexture = false; } } renderer.clearOverrideBlockTexture(); block.setBlockBounds(0f, 0f, 0f, 1f, 1f, 1f); renderer.setRenderBoundsFromBlock(block); return true; } @Override public boolean shouldRender3DInInventory(int modelId) { return true; } @Override public int getRenderId() { return WDBlock.BlockConnectedRenderer; } } Quote
GyroEmpire Posted May 24, 2014 Author Posted May 24, 2014 Fixed this myself, for anyone wondering, you need to create an instance of tessellator then use it to manually specify the brightness and color. Quote
Recommended Posts
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.