Jump to content

[1.7.2]Blocks Rendering with odd color overlay after adding a custom renderer


GyroEmpire

Recommended Posts

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.

l4OTpGk.png

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:

 

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;

    }

 

}

 

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.