Make the alpha pass bug fix improvements more resilient.

This commit is contained in:
Adrian Siekierka 2022-06-17 11:44:01 +02:00
parent 2ba3baf43e
commit cc1893448c
8 changed files with 38 additions and 26 deletions

View file

@ -1,5 +1,6 @@
package buildcraft.builders.render;
import buildcraft.core.render.BCSimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
@ -14,7 +15,7 @@ import buildcraft.core.CoreConstants;
import buildcraft.core.lib.render.FakeBlock;
import buildcraft.core.lib.render.RenderUtils;
public class RenderFrame implements ISimpleBlockRenderingHandler {
public class RenderFrame extends BCSimpleBlockRenderingHandler {
private void renderTwoWayBlock(RenderBlocks renderblocks, FakeBlock stateHost, int x, int y, int z, float[] dim, int mask) {
assert mask != 0;

View file

@ -1,5 +1,6 @@
package buildcraft.core.lib.render;
import buildcraft.core.render.BCSimpleBlockRenderingHandler;
import org.lwjgl.opengl.GL11;
import net.minecraft.block.Block;
@ -12,7 +13,7 @@ import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import buildcraft.BuildCraftCore;
import buildcraft.core.lib.block.BlockBuildCraft;
public class RenderBlockComplex implements ISimpleBlockRenderingHandler {
public class RenderBlockComplex extends BCSimpleBlockRenderingHandler {
private static final int[] Y_ROTATE = {3, 0, 1, 2};
@Override

View file

@ -0,0 +1,16 @@
package buildcraft.core.render;
import buildcraft.BuildCraftCore;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.client.renderer.Tessellator;
public abstract class BCSimpleBlockRenderingHandler implements ISimpleBlockRenderingHandler {
protected void fixEmptyAlphaPass(int x, int y, int z) {
if (BuildCraftCore.alphaPassBugPresent) {
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
}
}
}

View file

@ -19,7 +19,7 @@ import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import buildcraft.BuildCraftCore;
import buildcraft.core.lib.render.IInventoryRenderer;
public class RenderingEntityBlocks implements ISimpleBlockRenderingHandler {
public class RenderingEntityBlocks extends BCSimpleBlockRenderingHandler {
public static HashMap<EntityRenderIndex, IInventoryRenderer> blockByEntityRenders = new HashMap<EntityRenderIndex, IInventoryRenderer>();

View file

@ -18,7 +18,7 @@ import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import buildcraft.BuildCraftCore;
public class RenderingMarkers implements ISimpleBlockRenderingHandler {
public class RenderingMarkers extends BCSimpleBlockRenderingHandler {
/* PATH MARKER RENDERING */
public static final double[][][] frontX = new double[6][3][4];

View file

@ -8,6 +8,7 @@
*/
package buildcraft.silicon.render;
import buildcraft.core.render.BCSimpleBlockRenderingHandler;
import org.lwjgl.opengl.GL11;
import net.minecraft.block.Block;
@ -21,7 +22,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.core.lib.render.RenderUtils;
import buildcraft.silicon.SiliconProxy;
public class RenderLaserBlock implements ISimpleBlockRenderingHandler {
public class RenderLaserBlock extends BCSimpleBlockRenderingHandler {
@Override
public int getRenderId() {
return SiliconProxy.laserBlockModel;

View file

@ -1,5 +1,6 @@
package buildcraft.silicon.render;
import buildcraft.core.render.BCSimpleBlockRenderingHandler;
import org.lwjgl.opengl.GL11;
import net.minecraft.block.Block;
@ -16,13 +17,7 @@ import buildcraft.core.lib.render.RenderUtils;
import buildcraft.core.lib.render.SubIcon;
import buildcraft.silicon.SiliconProxy;
public class RenderLaserTable implements ISimpleBlockRenderingHandler {
private void workaround17(int x, int y, int z) {
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
}
public class RenderLaserTable extends BCSimpleBlockRenderingHandler {
@Override
public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {
@ -74,6 +69,9 @@ public class RenderLaserTable implements ISimpleBlockRenderingHandler {
case 5:
renderStampingTable(renderer, false, x, y, z, bcBlock);
break;
default:
fixEmptyAlphaPass(x, y, z);
break;
}
return true;
}
@ -107,7 +105,7 @@ public class RenderLaserTable implements ISimpleBlockRenderingHandler {
private void renderAssemblyTable(RenderBlocks renderer, boolean isInv, int x, int y, int z, BlockBuildCraft block) {
if (!isInv && block.getCurrentRenderPass() != 0) {
workaround17(x, y, z);
fixEmptyAlphaPass(x, y, z);
return;
}
IIcon base = block.getIcon(0, 0);
@ -118,7 +116,7 @@ public class RenderLaserTable implements ISimpleBlockRenderingHandler {
private void renderChargingTable(RenderBlocks renderer, boolean isInv, int x, int y, int z, BlockBuildCraft block) {
if (!isInv && block.getCurrentRenderPass() != 0) {
workaround17(x, y, z);
fixEmptyAlphaPass(x, y, z);
return;
}
IIcon base = block.getIcon(0, 3);
@ -163,7 +161,7 @@ public class RenderLaserTable implements ISimpleBlockRenderingHandler {
private void renderIntegrationTable(RenderBlocks renderer, boolean isInv, int x, int y, int z, BlockBuildCraft block) {
IIcon base = block.getIcon(0, 2);
if (!isInv && block.getCurrentRenderPass() != 0) {
workaround17(x, y, z);
fixEmptyAlphaPass(x, y, z);
return;
}
renderCube(renderer, isInv, x, y, z, 0, 0, 0, 16, 1, 16, 16, 21, base, 0x3f); // black bottom
@ -186,7 +184,7 @@ public class RenderLaserTable implements ISimpleBlockRenderingHandler {
private void renderAdvancedCraftingTable(RenderBlocks renderer, boolean isInv, int x, int y, int z, BlockBuildCraft block) {
if (!isInv && block.getCurrentRenderPass() != 0) {
workaround17(x, y, z);
fixEmptyAlphaPass(x, y, z);
return;
}
IIcon base = block.getIcon(0, 1);
@ -203,7 +201,7 @@ public class RenderLaserTable implements ISimpleBlockRenderingHandler {
private void renderStampingTable(RenderBlocks renderer, boolean isInv, int x, int y, int z, BlockBuildCraft block) {
if (!isInv && block.getCurrentRenderPass() != 0) {
workaround17(x, y, z);
fixEmptyAlphaPass(x, y, z);
return;
}
IIcon base = block.getIcon(0, 5);

View file

@ -9,6 +9,7 @@
package buildcraft.transport.render;
import buildcraft.BuildCraftCore;
import buildcraft.core.render.BCSimpleBlockRenderingHandler;
import net.minecraft.block.Block;
import net.minecraft.block.BlockChest;
import net.minecraft.client.Minecraft;
@ -33,7 +34,7 @@ import buildcraft.transport.TileGenericPipe;
import buildcraft.transport.TransportProxy;
import buildcraft.transport.pipes.PipeStructureCobblestone;
public class PipeRendererWorld implements ISimpleBlockRenderingHandler {
public class PipeRendererWorld extends BCSimpleBlockRenderingHandler {
public static int renderPass = -1;
public static float zFightOffset = 1F / 4096F;
@ -238,14 +239,8 @@ public class PipeRendererWorld implements ISimpleBlockRenderingHandler {
rendered = renderPipe(renderer, world, pipeTile, x, y, z);
}
if (!rendered && BuildCraftCore.alphaPassBugPresent) {
// Here to prevent Minecraft from crashing when nothing renders on a render pass
// (rarely in pass 0, often in pass 1)
// This is a 1.7 bug.
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
Tessellator.instance.addVertexWithUV(x, y, z, 0, 0);
if (!rendered) {
fixEmptyAlphaPass(x, y, z);
}
return true;