Merge pull request #1471 from dmillerw/BuildCraft-5.0.x
Fixed partially transparent facades rendering incorrectly Fixes #1468
This commit is contained in:
commit
f09da45e15
3 changed files with 28 additions and 8 deletions
|
@ -107,6 +107,11 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
return TransportProxy.pipeModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass(int pass) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
|
|
|
@ -14,6 +14,7 @@ import buildcraft.core.render.RenderUtils;
|
|||
import buildcraft.transport.ItemFacade;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
@ -47,6 +48,14 @@ public class FacadeItemRenderer implements IItemRenderer {
|
|||
|
||||
// Render Facade
|
||||
GL11.glPushMatrix();
|
||||
|
||||
// Enable glBlending for transparency
|
||||
if (block.getRenderBlockPass() > 0) {
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
}
|
||||
|
||||
block.setBlockBounds(0F, 0F, 1F - 1F / 16F, 1F, 1F, 1F);
|
||||
render.setRenderBoundsFromBlock(block);
|
||||
GL11.glTranslatef(translateX, translateY, translateZ);
|
||||
|
@ -75,6 +84,12 @@ public class FacadeItemRenderer implements IItemRenderer {
|
|||
render.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, tryGetBlockIcon(block, 5, decodedMeta));
|
||||
tessellator.draw();
|
||||
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
// Disable blending
|
||||
if (block.getRenderBlockPass() > 0) {
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
// Render StructurePipe
|
||||
|
|
|
@ -11,20 +11,14 @@ package buildcraft.transport.render;
|
|||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.core.IIconProvider;
|
||||
import buildcraft.core.CoreConstants;
|
||||
import buildcraft.transport.BlockGenericPipe;
|
||||
import buildcraft.transport.PipeIconProvider;
|
||||
import buildcraft.transport.PipeRenderState;
|
||||
import buildcraft.transport.TransportProxy;
|
||||
import buildcraft.core.utils.MatrixTranformations;
|
||||
import buildcraft.transport.TileGenericPipe;
|
||||
|
||||
import buildcraft.transport.*;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class PipeRendererWorld implements ISimpleBlockRenderingHandler {
|
||||
|
@ -168,6 +162,12 @@ public class PipeRendererWorld implements ISimpleBlockRenderingHandler {
|
|||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
// Here to prevent Minecraft from crashing when nothing renders on render pass zero
|
||||
// This is likely a bug, and has been submitted as an issue to the Forge team
|
||||
renderer.setRenderBounds(0, 0, 0, 0, 0, 0);
|
||||
renderer.renderStandardBlock(Blocks.stone, x, y, z);
|
||||
renderer.setRenderBoundsFromBlock(block);
|
||||
|
||||
if (tile instanceof TileGenericPipe) {
|
||||
TileGenericPipe pipeTile = (TileGenericPipe) tile;
|
||||
renderPipe(renderer, world, (BlockGenericPipe) block, pipeTile, x, y, z);
|
||||
|
|
Loading…
Reference in a new issue