Fixed pipe packet and using bitmasks
This commit is contained in:
parent
b41c1ce033
commit
77ae26235a
13 changed files with 198 additions and 191 deletions
|
@ -1,4 +1,4 @@
|
|||
package dark.lib.interfaces;
|
||||
package resonantinduction.api;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
|
@ -19,14 +19,12 @@ import resonantinduction.core.part.BlockMachinePart;
|
|||
import resonantinduction.electrical.armbot.BlockArmbot;
|
||||
import resonantinduction.electrical.armbot.TileArmbot;
|
||||
import resonantinduction.electrical.battery.BlockBattery;
|
||||
import resonantinduction.electrical.battery.ItemBlockBattery;
|
||||
import resonantinduction.electrical.battery.TileBattery;
|
||||
import resonantinduction.electrical.furnace.BlockAdvancedFurnace;
|
||||
import resonantinduction.electrical.furnace.TileAdvancedFurnace;
|
||||
import resonantinduction.electrical.generator.solar.BlockSolarPanel;
|
||||
import resonantinduction.electrical.generator.solar.TileSolarPanel;
|
||||
import resonantinduction.electrical.levitator.BlockLevitator;
|
||||
import resonantinduction.electrical.levitator.ItemBlockContractor;
|
||||
import resonantinduction.electrical.levitator.TileLevitator;
|
||||
import resonantinduction.electrical.multimeter.ItemMultimeter;
|
||||
import resonantinduction.electrical.purifier.BlockPurifier;
|
||||
|
|
|
@ -14,6 +14,8 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import resonantinduction.api.IReadOut;
|
||||
import resonantinduction.api.IReadOut.EnumTools;
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.Settings;
|
||||
import resonantinduction.core.prefab.tile.TileEntityEnergyMachine;
|
||||
|
@ -31,8 +33,6 @@ import calclavia.lib.utility.FluidHelper;
|
|||
import cofh.api.energy.IEnergyStorage;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import dark.lib.interfaces.IReadOut;
|
||||
import dark.lib.interfaces.IReadOut.EnumTools;
|
||||
|
||||
public class ItemReadoutTools extends ItemBase
|
||||
{
|
||||
|
|
|
@ -6,12 +6,12 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import resonantinduction.api.IReadOut;
|
||||
import resonantinduction.api.fluid.INetworkPipe;
|
||||
import resonantinduction.core.tilenetwork.ITileConnector;
|
||||
import resonantinduction.mechanical.fluid.network.NetworkPipes;
|
||||
import resonantinduction.mechanical.fluid.prefab.TileEntityFluidDevice;
|
||||
import calclavia.lib.utility.HelperMethods;
|
||||
import dark.lib.interfaces.IReadOut;
|
||||
|
||||
public class TileReleaseValve extends TileEntityFluidDevice implements ITileConnector, IReadOut
|
||||
{
|
||||
|
|
|
@ -37,6 +37,7 @@ public class ItemPipeRenderer implements IItemRenderer
|
|||
GL11.glRotatef(180f, 0f, 0f, 1f);
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderPipe.getTexture(item.getItemDamage()));
|
||||
int meta = item.getItemDamage();
|
||||
|
||||
if (Mechanical.blockReleaseValve != null && item.itemID == Mechanical.blockReleaseValve.blockID)
|
||||
{
|
||||
meta = FluidContainerMaterial.IRON.getMeta();
|
||||
|
@ -44,32 +45,33 @@ public class ItemPipeRenderer implements IItemRenderer
|
|||
if (type == ItemRenderType.ENTITY)
|
||||
{
|
||||
GL11.glTranslatef(-.5F, -1F, -.5F);
|
||||
RenderPipe.render(meta, new boolean[] { false, false, false, false, true, true });
|
||||
RenderPipe.render(meta, (byte) 0b000011);
|
||||
}
|
||||
else if (type == ItemRenderType.INVENTORY)
|
||||
{
|
||||
GL11.glTranslatef(0F, -1F, 0F);
|
||||
RenderPipe.render(meta, new boolean[] { false, false, false, false, true, true });
|
||||
RenderPipe.render(meta, (byte) 0b000011);
|
||||
}
|
||||
else if (type == ItemRenderType.EQUIPPED)
|
||||
{
|
||||
GL11.glTranslatef(-1F, -1.2F, 0.5F);
|
||||
RenderPipe.render(meta, new boolean[] { false, false, true, true, false, false });
|
||||
RenderPipe.render(meta, (byte) 0b001100);
|
||||
}
|
||||
else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON)
|
||||
{
|
||||
GL11.glTranslatef(-2F, -1.5F, 0.2F);
|
||||
RenderPipe.render(meta, new boolean[] { false, false, true, true, false, false });
|
||||
RenderPipe.render(meta, (byte) 0b001100);
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderPipe.render(item.getItemDamage(), new boolean[] { false, false, true, true, false, false });
|
||||
RenderPipe.render(item.getItemDamage(), (byte) 0b001100);
|
||||
}
|
||||
if (Mechanical.blockReleaseValve != null && item.itemID == Mechanical.blockReleaseValve.blockID)
|
||||
{
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(Reference.DOMAIN, Reference.MODEL_DIRECTORY + "ReleaseValve.png"));
|
||||
valve.render();
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,15 +2,19 @@ package resonantinduction.mechanical.fluid.pipe;
|
|||
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.rmi.CORBA.Tie;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.core.render.RenderFluidHelper;
|
||||
import resonantinduction.mechanical.fluid.prefab.TileFluidNetworkTile;
|
||||
import resonantinduction.old.client.model.ModelOpenTrough;
|
||||
import resonantinduction.old.client.model.ModelPipe;
|
||||
|
||||
|
@ -37,13 +41,16 @@ public class RenderPipe extends TileEntitySpecialRenderer
|
|||
{
|
||||
mat = FluidContainerMaterial.values()[te.getBlockMetadata()];
|
||||
}
|
||||
|
||||
if (te instanceof TilePipe)
|
||||
{
|
||||
boolean[] sides = ((TilePipe) te).renderConnection;
|
||||
TilePipe tile = (TilePipe) te;
|
||||
|
||||
if (mat == FluidContainerMaterial.WOOD || mat == FluidContainerMaterial.STONE)
|
||||
{
|
||||
FluidStack liquid = ((TilePipe) te).getTank().getFluid();
|
||||
int cap = ((TilePipe) te).getTankInfo()[0].capacity;
|
||||
FluidStack liquid = tile.getTank().getFluid();
|
||||
int cap = tile.getTankInfo()[0].capacity;
|
||||
|
||||
// FluidStack liquid = new FluidStack(FluidRegistry.WATER, cap);
|
||||
if (liquid != null && liquid.amount > 100)
|
||||
{
|
||||
|
@ -65,7 +72,10 @@ public class RenderPipe extends TileEntitySpecialRenderer
|
|||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
if (sides[4])
|
||||
|
||||
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS)
|
||||
{
|
||||
if (tile.canRenderSide(direction))
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
|
@ -74,24 +84,21 @@ public class RenderPipe extends TileEntitySpecialRenderer
|
|||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
switch (direction.ordinal())
|
||||
{
|
||||
case 4:
|
||||
GL11.glTranslatef((float) d + 0F, (float) d1 + 0.1F, (float) d2 + 0.3F);
|
||||
GL11.glScalef(0.3F, 0.4F, 0.4F);
|
||||
|
||||
GL11.glCallList(displayList[(int) (per * (RenderFluidHelper.DISPLAY_STAGES - 1))]);
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (sides[5])
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
break;
|
||||
case 5:
|
||||
GL11.glTranslatef((float) d + 0.7F, (float) d1 + 0.1F, (float) d2 + 0.3F);
|
||||
break;
|
||||
case 2:
|
||||
GL11.glTranslatef((float) d + 0.3F, (float) d1 + 0.1F, (float) d2 + 0F);
|
||||
break;
|
||||
case 3:
|
||||
GL11.glTranslatef((float) d + 0.3F, (float) d1 + 0.1F, (float) d2 + 0.7F);
|
||||
break;
|
||||
}
|
||||
GL11.glScalef(0.3F, 0.4F, 0.4F);
|
||||
|
||||
GL11.glCallList(displayList[(int) (per * (RenderFluidHelper.DISPLAY_STAGES - 1))]);
|
||||
|
@ -99,48 +106,15 @@ public class RenderPipe extends TileEntitySpecialRenderer
|
|||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if (sides[2])
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
GL11.glTranslatef((float) d + 0.3F, (float) d1 + 0.1F, (float) d2 + 0F);
|
||||
GL11.glScalef(0.4F, 0.4F, 0.3F);
|
||||
|
||||
GL11.glCallList(displayList[(int) (per * (RenderFluidHelper.DISPLAY_STAGES - 1))]);
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (sides[3])
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
GL11.glTranslatef((float) d + 0.3F, (float) d1 + 0.1F, (float) d2 + 0.7F);
|
||||
GL11.glScalef(0.4F, 0.4F, 0.3F);
|
||||
|
||||
GL11.glCallList(displayList[(int) (per * (RenderFluidHelper.DISPLAY_STAGES - 1))]);
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
bindTexture(RenderPipe.getTexture(mat, 0));
|
||||
RenderPipe.render(mat, ((TilePipe) te).getSubID(), sides);
|
||||
render(mat, tile.getSubID(), tile.renderSides);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else
|
||||
|
@ -148,7 +122,7 @@ public class RenderPipe extends TileEntitySpecialRenderer
|
|||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
RenderPipe.render(mat, 0, new boolean[6]);
|
||||
render(mat, 0, (byte) 0b0);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
@ -179,25 +153,51 @@ public class RenderPipe extends TileEntitySpecialRenderer
|
|||
return getTexture(FluidContainerMaterial.getFromItemMeta(meta), FluidContainerMaterial.getType(meta));
|
||||
}
|
||||
|
||||
public static void render(FluidContainerMaterial mat, int pipeID, boolean[] side)
|
||||
public static void render(FluidContainerMaterial mat, int pipeID, byte side)
|
||||
{
|
||||
if (mat == FluidContainerMaterial.WOOD)
|
||||
{
|
||||
MODEL_TROUGH_PIPE.render(side, false);
|
||||
// MODEL_TROUGH_PIPE.render(side, false);
|
||||
}
|
||||
else if (mat == FluidContainerMaterial.STONE)
|
||||
{
|
||||
MODEL_TROUGH_PIPE.render(side, true);
|
||||
// MODEL_TROUGH_PIPE.render(side, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
MODEL_PIPE.render(side);
|
||||
}
|
||||
}
|
||||
|
||||
public static void render(int meta, boolean[] bs)
|
||||
System.out.println(Integer.toBinaryString(side));
|
||||
if (TileFluidNetworkTile.canRenderSide(side,ForgeDirection.DOWN))
|
||||
{
|
||||
render(FluidContainerMaterial.getFromItemMeta(meta), FluidContainerMaterial.getType(meta), bs);
|
||||
MODEL_PIPE.renderBottom();
|
||||
}
|
||||
if (TileFluidNetworkTile.canRenderSide(side,ForgeDirection.UP))
|
||||
{
|
||||
MODEL_PIPE.renderTop();
|
||||
}
|
||||
if (TileFluidNetworkTile.canRenderSide(side,ForgeDirection.NORTH))
|
||||
{
|
||||
MODEL_PIPE.renderBack();
|
||||
}
|
||||
if (TileFluidNetworkTile.canRenderSide(side,ForgeDirection.SOUTH))
|
||||
{
|
||||
MODEL_PIPE.renderFront();
|
||||
}
|
||||
if (TileFluidNetworkTile.canRenderSide(side, ForgeDirection.WEST))
|
||||
{
|
||||
MODEL_PIPE.renderLeft();
|
||||
}
|
||||
if (TileFluidNetworkTile.canRenderSide(side, ForgeDirection.EAST))
|
||||
{
|
||||
MODEL_PIPE.renderRight();
|
||||
}
|
||||
|
||||
MODEL_PIPE.renderMiddle();
|
||||
}
|
||||
}
|
||||
|
||||
public static void render(int meta, byte sides)
|
||||
{
|
||||
render(FluidContainerMaterial.getFromItemMeta(meta), FluidContainerMaterial.getType(meta), sides);
|
||||
}
|
||||
|
||||
}
|
|
@ -64,34 +64,38 @@ public class TilePipe extends TileFluidNetworkTile implements IColorCoded, INetw
|
|||
{
|
||||
this.getTileNetwork().mergeNetwork(((INetworkPipe) tileEntity).getTileNetwork(), this);
|
||||
connectedBlocks.add(tileEntity);
|
||||
this.renderConnection[side.ordinal()] = true;
|
||||
}// Wood and stone pipes can connect to each other but not other pipe types since
|
||||
// they are more like a trough than a pipe
|
||||
setRenderSide(side, true);
|
||||
}
|
||||
else if ((pipeMat == FluidContainerMaterial.WOOD || pipeMat == FluidContainerMaterial.STONE) && (pipeMatOther == FluidContainerMaterial.WOOD || pipeMatOther == FluidContainerMaterial.STONE))
|
||||
{
|
||||
// Wood and stone pipes can connect to each other but not other pipe types since
|
||||
// they are more like a trough than a pipe
|
||||
this.getTileNetwork().mergeNetwork(((INetworkPipe) tileEntity).getTileNetwork(), this);
|
||||
connectedBlocks.add(tileEntity);
|
||||
this.renderConnection[side.ordinal()] = true;
|
||||
}// Any other pipe can connect to each other as long as the color matches except for
|
||||
// glass which only works with itself at the moment
|
||||
setRenderSide(side, true);
|
||||
}
|
||||
else if (pipeMat != FluidContainerMaterial.WOOD && pipeMat != FluidContainerMaterial.STONE && pipeMatOther != FluidContainerMaterial.WOOD && pipeMatOther != FluidContainerMaterial.STONE && pipeMat != FluidContainerMaterial.GLASS && pipeMatOther != FluidContainerMaterial.GLASS)
|
||||
{
|
||||
/*
|
||||
* Any other pipe can connect to each other as long as the color matches except
|
||||
* for glass which only works with itself at the moment
|
||||
*/
|
||||
this.getTileNetwork().mergeNetwork(((INetworkPipe) tileEntity).getTileNetwork(), this);
|
||||
connectedBlocks.add(tileEntity);
|
||||
this.renderConnection[side.ordinal()] = true;
|
||||
setRenderSide(side, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (tileEntity instanceof IFluidHandler)
|
||||
{
|
||||
connectedBlocks.add(tileEntity);
|
||||
this.renderConnection[side.ordinal()] = true;
|
||||
setRenderSide(side, true);
|
||||
this.getTileNetwork().addTank(side.getOpposite(), (IFluidHandler) tileEntity);
|
||||
}
|
||||
else if (tileEntity instanceof ITileConnector && ((ITileConnector) tileEntity).canTileConnect(Connection.FLUIDS, side.getOpposite()))
|
||||
{
|
||||
connectedBlocks.add(tileEntity);
|
||||
this.renderConnection[side.ordinal()] = true;
|
||||
setRenderSide(side, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,10 +4,10 @@ import java.util.Random;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.api.IReadOut;
|
||||
import resonantinduction.core.tilenetwork.ITileConnector;
|
||||
import resonantinduction.core.tilenetwork.prefab.NetworkTileEntities;
|
||||
import calclavia.lib.prefab.tile.TileAdvanced;
|
||||
import dark.lib.interfaces.IReadOut;
|
||||
|
||||
public abstract class TileEntityFluidDevice extends TileAdvanced implements IReadOut, ITileConnector
|
||||
{
|
||||
|
|
|
@ -17,9 +17,6 @@ import net.minecraftforge.fluids.FluidRegistry;
|
|||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import org.bouncycastle.util.Arrays;
|
||||
|
||||
import resonantinduction.api.fluid.FluidMasterList;
|
||||
import resonantinduction.api.fluid.INetworkFluidPart;
|
||||
import resonantinduction.core.ResonantInduction;
|
||||
|
@ -34,7 +31,6 @@ import calclavia.lib.network.PacketHandler;
|
|||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -57,7 +53,7 @@ public abstract class TileFluidNetworkTile extends TileEntityFluidDevice impleme
|
|||
public static final int PACKET_TANK = Mechanical.contentRegistry.getNextPacketID();
|
||||
|
||||
/** Bitmask **/
|
||||
private byte renderSides = 0b0;
|
||||
public byte renderSides = 0b0;
|
||||
|
||||
public TileFluidNetworkTile()
|
||||
{
|
||||
|
@ -234,6 +230,11 @@ public abstract class TileFluidNetworkTile extends TileEntityFluidDevice impleme
|
|||
}
|
||||
}
|
||||
|
||||
public boolean canRenderSide(ForgeDirection direction)
|
||||
{
|
||||
return (renderSides & (1 << direction.ordinal())) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkFluidTiles getTileNetwork()
|
||||
{
|
||||
|
@ -396,30 +397,26 @@ public abstract class TileFluidNetworkTile extends TileEntityFluidDevice impleme
|
|||
{
|
||||
if (this.worldObj.isRemote)
|
||||
{
|
||||
switch (data.readInt())
|
||||
{
|
||||
case PACKET_DESCRIPTION:
|
||||
int readInt = data.readInt();
|
||||
|
||||
if (readInt == PACKET_DESCRIPTION)
|
||||
{
|
||||
this.subID = data.readInt();
|
||||
this.renderSides = data.readByte();
|
||||
this.tank = new FluidTank(data.readInt());
|
||||
this.getTank().readFromNBT(PacketHandler.readNBTTagCompound(data));
|
||||
this.internalTanksInfo[0] = this.getTank().getInfo();
|
||||
break;
|
||||
}
|
||||
case PACKET_RENDER:
|
||||
else if (readInt == PACKET_RENDER)
|
||||
{
|
||||
this.subID = data.readInt();
|
||||
this.renderSides = data.readByte();
|
||||
break;
|
||||
}
|
||||
case PACKET_TANK:
|
||||
else if (readInt == PACKET_TANK)
|
||||
{
|
||||
this.tank = new FluidTank(data.readInt());
|
||||
this.getTank().readFromNBT(PacketHandler.readNBTTagCompound(data));
|
||||
this.internalTanksInfo[0] = this.getTank().getInfo();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -461,13 +458,7 @@ public abstract class TileFluidNetworkTile extends TileEntityFluidDevice impleme
|
|||
{
|
||||
if (tool == EnumTools.PIPE_GUAGE)
|
||||
{
|
||||
String out = "Debug: " + this.getTileNetwork().toString();
|
||||
out += " ";
|
||||
for (boolean b : this.renderConnection)
|
||||
{
|
||||
out += "|" + (b ? "T" : "F");
|
||||
}
|
||||
return out + " Vol: " + this.getTileNetwork().getNetworkTank().getFluidAmount();
|
||||
return "Volume: " + this.getTileNetwork().getNetworkTank().getFluidAmount();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -489,4 +480,9 @@ public abstract class TileFluidNetworkTile extends TileEntityFluidDevice impleme
|
|||
this.subID = id;
|
||||
}
|
||||
|
||||
public static boolean canRenderSide(byte renderSides, ForgeDirection direction)
|
||||
{
|
||||
return (renderSides & (1 << direction.ordinal())) != 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import resonantinduction.api.IReadOut.EnumTools;
|
||||
import resonantinduction.api.fluid.IDrain;
|
||||
import resonantinduction.api.fluid.INetworkPipe;
|
||||
import resonantinduction.core.tilenetwork.ITileConnector;
|
||||
|
|
|
@ -10,6 +10,8 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import resonantinduction.api.IReadOut;
|
||||
import resonantinduction.api.IReadOut.EnumTools;
|
||||
import resonantinduction.api.fluid.IDrain;
|
||||
import resonantinduction.core.prefab.tile.TileEntityEnergyMachine;
|
||||
import resonantinduction.core.tilenetwork.ITileConnector;
|
||||
|
@ -18,8 +20,6 @@ import calclavia.lib.utility.FluidHelper;
|
|||
|
||||
import com.builtbroken.common.Pair;
|
||||
|
||||
import dark.lib.interfaces.IReadOut;
|
||||
|
||||
public class TilePump extends TileEntityEnergyMachine implements IReadOut, ITileConnector
|
||||
{
|
||||
private int currentWorldEdits, MAX_WORLD_EDITS_PER_PROCESS;
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import resonantinduction.core.render.RenderFluidHelper;
|
||||
import resonantinduction.mechanical.fluid.prefab.TileFluidNetworkTile;
|
||||
import resonantinduction.old.client.model.ModelTankSide;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
@ -29,10 +30,11 @@ public class RenderTank extends TileEntitySpecialRenderer
|
|||
|
||||
public void renderTank(TileEntity tileEntity, double x, double y, double z, int meta, FluidStack liquid)
|
||||
{
|
||||
boolean[] render = new boolean[6];
|
||||
byte renderSudes = 0;
|
||||
|
||||
if (tileEntity instanceof TileTank)
|
||||
{
|
||||
render = ((TileTank) tileEntity).renderConnection;
|
||||
renderSudes = ((TileTank) tileEntity).renderSides;
|
||||
}
|
||||
if (liquid != null && liquid.amount > 100)
|
||||
{
|
||||
|
@ -57,16 +59,18 @@ public class RenderTank extends TileEntitySpecialRenderer
|
|||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
boolean bot = render[1];
|
||||
boolean top = render[0];
|
||||
boolean north = render[2];
|
||||
boolean south = render[3];
|
||||
boolean east = render[5];
|
||||
boolean west = render[4];
|
||||
boolean bot = TileFluidNetworkTile.canRenderSide(renderSudes, ForgeDirection.getOrientation(1));
|
||||
boolean top = TileFluidNetworkTile.canRenderSide(renderSudes, ForgeDirection.getOrientation(0));
|
||||
boolean north = TileFluidNetworkTile.canRenderSide(renderSudes, ForgeDirection.getOrientation(2));
|
||||
boolean south = TileFluidNetworkTile.canRenderSide(renderSudes, ForgeDirection.getOrientation(3));
|
||||
boolean east = TileFluidNetworkTile.canRenderSide(renderSudes, ForgeDirection.getOrientation(5));
|
||||
boolean west = TileFluidNetworkTile.canRenderSide(renderSudes, ForgeDirection.getOrientation(4));
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(i + 2);
|
||||
if (!render[dir.getOpposite().ordinal()])
|
||||
|
||||
if (!TileFluidNetworkTile.canRenderSide(renderSudes, dir.getOpposite()))
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
|
||||
|
@ -74,6 +78,7 @@ public class RenderTank extends TileEntitySpecialRenderer
|
|||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
boolean left = false;
|
||||
boolean right = false;
|
||||
|
||||
switch (dir)
|
||||
{
|
||||
case NORTH:
|
||||
|
@ -97,6 +102,7 @@ public class RenderTank extends TileEntitySpecialRenderer
|
|||
right = south;
|
||||
break;
|
||||
}
|
||||
|
||||
bindTexture(RenderTank.getTexture(tileEntity.getBlockType().blockID, tileEntity.getBlockMetadata()));
|
||||
MODEL.render(0.0625F, left, right, top, bot);
|
||||
GL11.glPopMatrix();
|
||||
|
|
|
@ -44,7 +44,7 @@ public class TileTank extends TileFluidNetworkTile
|
|||
if (this.canTileConnect(Connection.NETWORK, side.getOpposite()))
|
||||
{
|
||||
this.getTileNetwork().mergeNetwork(((INetworkFluidPart) tileEntity).getTileNetwork(), (INetworkPart) tileEntity);
|
||||
this.renderConnection[side.ordinal()] = true;
|
||||
this.setRenderSide(side, true);
|
||||
connectedBlocks.add(tileEntity);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue