Updated Calclavia Core

This commit is contained in:
Calclavia 2014-02-05 23:06:16 +08:00
parent b0d97743e3
commit 8b6ce6427e
5 changed files with 21 additions and 150 deletions

View file

@ -6,10 +6,10 @@
package resonantinduction.mechanical.fluid.pipe;
import calclavia.lib.render.RenderUtility;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraftforge.common.ForgeDirection;
import resonantinduction.mechanical.fluid.prefab.TileFluidNetwork;
public class ModelOpenTrough extends ModelBase
{
@ -283,11 +283,11 @@ public class ModelOpenTrough extends ModelBase
public void render(byte side, boolean stone)
{
renderMiddle(TileFluidNetwork.canRenderSide(side, ForgeDirection.DOWN), stone);
renderBack(TileFluidNetwork.canRenderSide(side, ForgeDirection.NORTH) ? PipeType.NORMAL : stone ? PipeType.SOLID : PipeType.MID_CAP);
renderFront(TileFluidNetwork.canRenderSide(side, ForgeDirection.SOUTH) ? PipeType.NORMAL : stone ? PipeType.SOLID : PipeType.MID_CAP);
renderRight(TileFluidNetwork.canRenderSide(side, ForgeDirection.WEST) ? PipeType.NORMAL : stone ? PipeType.SOLID : PipeType.MID_CAP);
renderLeft(TileFluidNetwork.canRenderSide(side, ForgeDirection.EAST) ? PipeType.NORMAL : stone ? PipeType.SOLID : PipeType.MID_CAP);
renderMiddle(RenderUtility.canRenderSide(side, ForgeDirection.DOWN), stone);
renderBack(RenderUtility.canRenderSide(side, ForgeDirection.NORTH) ? PipeType.NORMAL : stone ? PipeType.SOLID : PipeType.MID_CAP);
renderFront(RenderUtility.canRenderSide(side, ForgeDirection.SOUTH) ? PipeType.NORMAL : stone ? PipeType.SOLID : PipeType.MID_CAP);
renderRight(RenderUtility.canRenderSide(side, ForgeDirection.WEST) ? PipeType.NORMAL : stone ? PipeType.SOLID : PipeType.MID_CAP);
renderLeft(RenderUtility.canRenderSide(side, ForgeDirection.EAST) ? PipeType.NORMAL : stone ? PipeType.SOLID : PipeType.MID_CAP);
}
public void renderMiddle(boolean bottom, boolean corners)

View file

@ -7,8 +7,8 @@ import net.minecraftforge.common.ForgeDirection;
import org.lwjgl.opengl.GL11;
import calclavia.lib.render.RenderUtility;
import resonantinduction.core.Reference;
import resonantinduction.mechanical.fluid.prefab.TileFluidNetwork;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -50,27 +50,27 @@ public class RenderPipe
public static void render(EnumPipeMaterial mat, byte side)
{
if (TileFluidNetwork.canRenderSide(side, ForgeDirection.DOWN))
if (RenderUtility.canRenderSide(side, ForgeDirection.DOWN))
{
MODEL_PIPE.renderBottom();
}
if (TileFluidNetwork.canRenderSide(side, ForgeDirection.UP))
if (RenderUtility.canRenderSide(side, ForgeDirection.UP))
{
MODEL_PIPE.renderTop();
}
if (TileFluidNetwork.canRenderSide(side, ForgeDirection.NORTH))
if (RenderUtility.canRenderSide(side, ForgeDirection.NORTH))
{
MODEL_PIPE.renderBack();
}
if (TileFluidNetwork.canRenderSide(side, ForgeDirection.SOUTH))
if (RenderUtility.canRenderSide(side, ForgeDirection.SOUTH))
{
MODEL_PIPE.renderFront();
}
if (TileFluidNetwork.canRenderSide(side, ForgeDirection.WEST))
if (RenderUtility.canRenderSide(side, ForgeDirection.WEST))
{
MODEL_PIPE.renderLeft();
}
if (TileFluidNetwork.canRenderSide(side, ForgeDirection.EAST))
if (RenderUtility.canRenderSide(side, ForgeDirection.EAST))
{
MODEL_PIPE.renderRight();
}

View file

@ -284,11 +284,6 @@ public abstract class TileFluidNetwork extends TileAdvanced implements IFluidCon
this.colorID = id;
}
public static boolean canRenderSide(byte renderSides, ForgeDirection direction)
{
return (renderSides & (1 << direction.ordinal())) != 0;
}
@Override
public boolean canConnect(ForgeDirection direction)
{

View file

@ -3,6 +3,9 @@ package resonantinduction.mechanical.fluid.tank;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -10,12 +13,16 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import resonantinduction.archaic.Archaic;
import resonantinduction.core.render.RIBlockRenderingHandler;
import resonantinduction.mechanical.Mechanical;
import resonantinduction.mechanical.fluid.pipe.EnumPipeMaterial;
import resonantinduction.mechanical.fluid.pipe.ItemBlockFluidContainer;
import resonantinduction.mechanical.fluid.prefab.BlockFluidNetwork;
import universalelectricity.api.UniversalElectricity;
import universalelectricity.api.vector.Vector3;
import calclavia.lib.render.RenderUtility;
import calclavia.lib.render.block.ICustomBlockRenderer;
import calclavia.lib.utility.FluidUtility;
import calclavia.lib.utility.inventory.InventoryUtility;
import cpw.mods.fml.relauncher.Side;

View file

@ -11,7 +11,6 @@ import org.lwjgl.opengl.GL11;
import resonantinduction.archaic.Archaic;
import resonantinduction.core.render.RenderFluidHelper;
import resonantinduction.mechanical.Mechanical;
import resonantinduction.mechanical.fluid.prefab.TileFluidNetwork;
import calclavia.lib.render.RenderUtility;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -34,139 +33,9 @@ public class RenderTank extends TileEntitySpecialRenderer
{
byte renderSides = ((TileTank) tileEntity).renderSides;
boolean down = TileFluidNetwork.canRenderSide(renderSides, ForgeDirection.DOWN);
boolean up = TileFluidNetwork.canRenderSide(renderSides, ForgeDirection.UP);
boolean north = TileFluidNetwork.canRenderSide(renderSides, ForgeDirection.NORTH);
boolean south = TileFluidNetwork.canRenderSide(renderSides, ForgeDirection.SOUTH);
boolean east = TileFluidNetwork.canRenderSide(renderSides, ForgeDirection.EAST);
boolean west = TileFluidNetwork.canRenderSide(renderSides, ForgeDirection.WEST);
bindTexture(TextureMap.locationBlocksTexture);
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
/**
* Render faces
*/
for (int i = 0; i < 6; i++)
{
ForgeDirection dir = ForgeDirection.getOrientation(i);
if (!TileFluidNetwork.canRenderSide(renderSides, dir))
{
GL11.glPushMatrix();
GL11.glScalef(0.99f, 0.99f, 0.99f);
switch (i)
{
case 0:
GL11.glRotatef(0, 0, 0, 1);
break;
case 1:
GL11.glRotatef(180, 0, 0, 1);
break;
case 2:
GL11.glRotatef(90, 1, 0, 0);
break;
case 3:
GL11.glRotatef(-90, 1, 0, 0);
break;
case 4:
GL11.glRotatef(-90, 0, 0, 1);
break;
case 5:
GL11.glRotatef(90, 0, 0, 1);
break;
}
RenderUtility.renderCube(-0.501, -0.501, -0.501, 0.501, -0.475, 0.501, Mechanical.blockTank);
GL11.glPopMatrix();
}
}
/**
* Render edges
*/
GL11.glPushMatrix();
if (!east)
{
if (!north)
{
// north east
RenderUtility.renderCube(0.475, -0.501, -0.501, 0.501, 0.501, -0.475, Archaic.blockMachinePart);
}
if (!south)
{
// south east
RenderUtility.renderCube(0.475, -0.501, 0.475, 0.501, 0.501, 0.501, Archaic.blockMachinePart);
}
if (!down)
{
// bottom east
RenderUtility.renderCube(0.475, -0.501, -0.501, 0.501, -0.475, 0.501, Archaic.blockMachinePart);
}
if (!up)
{
// top east
RenderUtility.renderCube(0.475, 0.475, -0.501, 0.501, 0.501, 0.501, Archaic.blockMachinePart);
}
}
if (!west)
{
if (!north)
{
// north west
RenderUtility.renderCube(-0.501, -0.501, -0.501, -0.475, 0.501, -0.475, Archaic.blockMachinePart);
}
if (!south)
{
// south west
RenderUtility.renderCube(-0.501, -0.501, 0.475, -0.475, 0.501, 0.501, Archaic.blockMachinePart);
}
if (!down)
{
// bottom west
RenderUtility.renderCube(-0.501, -0.501, -0.501, -0.475, -0.475, 0.501, Archaic.blockMachinePart);
}
if (!up)
{
// top west
RenderUtility.renderCube(-0.501, 0.475, -0.501, -0.475, 0.501, 0.501, Archaic.blockMachinePart);
}
}
if (!north)
{
if (!up)
{
// top north
RenderUtility.renderCube(-0.501, 0.475, -0.501, 0.501, 0.501, -0.475, Archaic.blockMachinePart);
}
if (!down)
{
// bottom north
RenderUtility.renderCube(-0.501, -0.501, -0.501, 0.501, -0.475, -0.475, Archaic.blockMachinePart);
}
}
if (!south)
{
if (!up)
{
// top south
RenderUtility.renderCube(-0.501, 0.475, 0.475, 0.501, 0.501, 0.501, Archaic.blockMachinePart);
}
if (!down)
{
// bottom south
RenderUtility.renderCube(-0.501, -0.501, 0.475, 0.501, -0.475, 0.501, Archaic.blockMachinePart);
}
}
GL11.glPopMatrix();
RenderUtility.renderBlockWithConnectedTextures(renderSides, Mechanical.blockTank, null, Archaic.blockMachinePart, null);
GL11.glPopMatrix();
if (fluid != null && fluid.amount > 100)