Fixed #321 - Gutter render crash

This commit is contained in:
Calclavia 2014-02-27 15:45:37 +08:00
parent fd58124f78
commit fd9a87bf9b
4 changed files with 20 additions and 18 deletions

View file

@ -16,8 +16,8 @@ import resonantinduction.core.prefab.fluid.BlockFluidNetwork;
import resonantinduction.core.render.RIBlockRenderingHandler;
import universalelectricity.api.UniversalElectricity;
import universalelectricity.api.vector.Vector3;
import calclavia.lib.render.RenderUtility;
import calclavia.lib.utility.FluidUtility;
import calclavia.lib.utility.WorldUtility;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -45,28 +45,28 @@ public class BlockGutter extends BlockFluidNetwork
{
byte renderSides = ((TileGutter) tile).renderSides;
if (!RenderUtility.canRenderSide(renderSides, ForgeDirection.DOWN))
if (!WorldUtility.isEnabledSide(renderSides, ForgeDirection.DOWN))
{
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, thickness, 1.0F);
super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity);
}
if (!RenderUtility.canRenderSide(renderSides, ForgeDirection.WEST))
if (!WorldUtility.isEnabledSide(renderSides, ForgeDirection.WEST))
{
this.setBlockBounds(0.0F, 0.0F, 0.0F, thickness, 1.0F, 1.0F);
super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity);
}
if (!RenderUtility.canRenderSide(renderSides, ForgeDirection.NORTH))
if (!WorldUtility.isEnabledSide(renderSides, ForgeDirection.NORTH))
{
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, thickness);
super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity);
}
if (!RenderUtility.canRenderSide(renderSides, ForgeDirection.EAST))
if (!WorldUtility.isEnabledSide(renderSides, ForgeDirection.EAST))
{
this.setBlockBounds(1.0F - thickness, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity);
}
if (!RenderUtility.canRenderSide(renderSides, ForgeDirection.SOUTH))
if (!WorldUtility.isEnabledSide(renderSides, ForgeDirection.SOUTH))
{
this.setBlockBounds(0.0F, 0.0F, 1.0F - thickness, 1.0F, 1.0F, 1.0F);
super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity);

View file

@ -15,6 +15,7 @@ import resonantinduction.core.Reference;
import resonantinduction.core.render.RenderFluidHelper;
import calclavia.lib.render.RenderUtility;
import calclavia.lib.render.item.ISimpleItemRenderer;
import calclavia.lib.utility.WorldUtility;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -34,7 +35,7 @@ public class RenderGutter extends TileEntitySpecialRenderer implements ISimpleIt
{
if (dir != ForgeDirection.UP && dir != ForgeDirection.DOWN)
{
if (!RenderUtility.canRenderSide(sides, dir))
if (!WorldUtility.isEnabledSide(sides, dir))
{
GL11.glPushMatrix();
RenderUtility.rotateBlockBasedOnDirection(dir);
@ -44,7 +45,7 @@ public class RenderGutter extends TileEntitySpecialRenderer implements ISimpleIt
}
}
if (!RenderUtility.canRenderSide(sides, ForgeDirection.DOWN))
if (!WorldUtility.isEnabledSide(sides, ForgeDirection.DOWN))
MODEL.renderOnly("base");
}
@ -75,8 +76,8 @@ public class RenderGutter extends TileEntitySpecialRenderer implements ISimpleIt
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
float xScale = RenderUtility.canRenderSide(renderSides, ForgeDirection.EAST) || RenderUtility.canRenderSide(renderSides, ForgeDirection.WEST) ? 1.01f : 0.8f;
float zScale = RenderUtility.canRenderSide(renderSides, ForgeDirection.NORTH) || RenderUtility.canRenderSide(renderSides, ForgeDirection.SOUTH) ? 1.01f : 0.8f;
float xScale = WorldUtility.isEnabledSide(renderSides, ForgeDirection.EAST) || WorldUtility.isEnabledSide(renderSides, ForgeDirection.WEST) ? 1.01f : 0.8f;
float zScale = WorldUtility.isEnabledSide(renderSides, ForgeDirection.NORTH) || WorldUtility.isEnabledSide(renderSides, ForgeDirection.SOUTH) ? 1.01f : 0.8f;
GL11.glTranslatef(-xScale / 2, -0.45f, -zScale / 2);
GL11.glScalef(xScale, 0.9f, zScale);

View file

@ -3,7 +3,7 @@ package resonantinduction.mechanical.fluid.pipe;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraftforge.common.ForgeDirection;
import calclavia.lib.render.RenderUtility;
import calclavia.lib.utility.WorldUtility;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -154,17 +154,17 @@ public class ModelPipe extends ModelBase
public void render(byte side)
{
if (RenderUtility.canRenderSide(side, ForgeDirection.DOWN))
if (WorldUtility.isEnabledSide(side, ForgeDirection.DOWN))
renderBottom();
if (RenderUtility.canRenderSide(side, ForgeDirection.UP))
if (WorldUtility.isEnabledSide(side, ForgeDirection.UP))
renderUp();
if (RenderUtility.canRenderSide(side, ForgeDirection.NORTH))
if (WorldUtility.isEnabledSide(side, ForgeDirection.NORTH))
renderSouth();
if (RenderUtility.canRenderSide(side, ForgeDirection.SOUTH))
if (WorldUtility.isEnabledSide(side, ForgeDirection.SOUTH))
renderNorth();
if (RenderUtility.canRenderSide(side, ForgeDirection.WEST))
if (WorldUtility.isEnabledSide(side, ForgeDirection.WEST))
renderEast();
if (RenderUtility.canRenderSide(side, ForgeDirection.EAST))
if (WorldUtility.isEnabledSide(side, ForgeDirection.EAST))
renderWest();
renderMiddle();

View file

@ -13,6 +13,7 @@ import resonantinduction.core.Reference;
import resonantinduction.core.render.RenderFluidHelper;
import calclavia.lib.render.RenderUtility;
import calclavia.lib.render.item.ISimpleItemRenderer;
import calclavia.lib.utility.WorldUtility;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -63,7 +64,7 @@ public class RenderPipe implements ISimpleItemRenderer
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS)
{
if (RenderUtility.canRenderSide(renderSides, direction))
if (WorldUtility.isEnabledSide(renderSides, direction))
{
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);