Fixed more tank packet issues
This commit is contained in:
parent
77ae26235a
commit
a884d59309
10 changed files with 82 additions and 79 deletions
|
@ -14,7 +14,7 @@ import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import net.minecraftforge.fluids.FluidTankInfo;
|
import net.minecraftforge.fluids.FluidTankInfo;
|
||||||
import resonantinduction.core.prefab.block.BlockRI;
|
import resonantinduction.mechanical.fluid.prefab.BlockFluidNetwork;
|
||||||
import resonantinduction.mechanical.render.MechanicalBlockRenderingHandler;
|
import resonantinduction.mechanical.render.MechanicalBlockRenderingHandler;
|
||||||
import universalelectricity.api.vector.Vector3;
|
import universalelectricity.api.vector.Vector3;
|
||||||
import calclavia.lib.utility.FluidHelper;
|
import calclavia.lib.utility.FluidHelper;
|
||||||
|
@ -23,13 +23,13 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import dark.lib.helpers.ColorCode;
|
import dark.lib.helpers.ColorCode;
|
||||||
import dark.lib.helpers.ColorCode.IColorCoded;
|
import dark.lib.helpers.ColorCode.IColorCoded;
|
||||||
|
|
||||||
public class BlockPipe extends BlockRI
|
public class BlockPipe extends BlockFluidNetwork
|
||||||
{
|
{
|
||||||
public static int waterFlowRate = 3000;
|
public static int waterFlowRate = 3000;
|
||||||
|
|
||||||
public BlockPipe()
|
public BlockPipe()
|
||||||
{
|
{
|
||||||
super("fluidPipe", Material.iron);
|
super("fluidPipe");
|
||||||
this.setBlockBounds(0.30F, 0.30F, 0.30F, 0.70F, 0.70F, 0.70F);
|
this.setBlockBounds(0.30F, 0.30F, 0.30F, 0.70F, 0.70F, 0.70F);
|
||||||
this.setHardness(1f);
|
this.setHardness(1f);
|
||||||
this.setResistance(3f);
|
this.setResistance(3f);
|
||||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import resonantinduction.mechanical.Mechanical;
|
import resonantinduction.mechanical.Mechanical;
|
||||||
import resonantinduction.mechanical.fluid.prefab.TileFluidNetworkTile;
|
import resonantinduction.mechanical.fluid.prefab.TileFluidNetwork;
|
||||||
import dark.lib.helpers.ColorCode;
|
import dark.lib.helpers.ColorCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -160,9 +160,9 @@ public enum FluidContainerMaterial
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
TileEntity ent = world.getBlockTileEntity(x, y, z);
|
TileEntity ent = world.getBlockTileEntity(x, y, z);
|
||||||
meta *= spacing;
|
meta *= spacing;
|
||||||
if (ent instanceof TileFluidNetworkTile)
|
if (ent instanceof TileFluidNetwork)
|
||||||
{
|
{
|
||||||
meta += ((TileFluidNetworkTile) ent).getSubID();
|
meta += ((TileFluidNetwork) ent).getSubID();
|
||||||
}
|
}
|
||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import resonantinduction.mechanical.Mechanical;
|
import resonantinduction.mechanical.Mechanical;
|
||||||
import resonantinduction.mechanical.fluid.prefab.TileFluidNetworkTile;
|
import resonantinduction.mechanical.fluid.prefab.TileFluidNetwork;
|
||||||
import resonantinduction.mechanical.fluid.tank.TileTank;
|
import resonantinduction.mechanical.fluid.tank.TileTank;
|
||||||
import universalelectricity.api.energy.UnitDisplay;
|
import universalelectricity.api.energy.UnitDisplay;
|
||||||
import universalelectricity.api.energy.UnitDisplay.Unit;
|
import universalelectricity.api.energy.UnitDisplay.Unit;
|
||||||
|
@ -111,12 +111,12 @@ public class ItemBlockFluidContainer extends ItemBlock
|
||||||
if (super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, (stack.getItemDamage() / FluidContainerMaterial.spacing)))
|
if (super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, (stack.getItemDamage() / FluidContainerMaterial.spacing)))
|
||||||
{
|
{
|
||||||
TileEntity tile = world.getBlockTileEntity(x, y, z);
|
TileEntity tile = world.getBlockTileEntity(x, y, z);
|
||||||
if (tile instanceof TileFluidNetworkTile)
|
if (tile instanceof TileFluidNetwork)
|
||||||
{
|
{
|
||||||
((TileFluidNetworkTile) tile).setSubID(stack.getItemDamage());
|
((TileFluidNetwork) tile).setSubID(stack.getItemDamage());
|
||||||
if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("fluid"))
|
if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("fluid"))
|
||||||
{
|
{
|
||||||
((TileFluidNetworkTile) tile).fill(ForgeDirection.UNKNOWN, FluidStack.loadFluidStackFromNBT(stack.getTagCompound().getCompoundTag("fluid")), true);
|
((TileFluidNetwork) tile).fill(ForgeDirection.UNKNOWN, FluidStack.loadFluidStackFromNBT(stack.getTagCompound().getCompoundTag("fluid")), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import resonantinduction.core.Reference;
|
import resonantinduction.core.Reference;
|
||||||
import resonantinduction.core.render.RenderFluidHelper;
|
import resonantinduction.core.render.RenderFluidHelper;
|
||||||
import resonantinduction.mechanical.fluid.prefab.TileFluidNetworkTile;
|
import resonantinduction.mechanical.fluid.prefab.TileFluidNetwork;
|
||||||
import resonantinduction.old.client.model.ModelOpenTrough;
|
import resonantinduction.old.client.model.ModelOpenTrough;
|
||||||
import resonantinduction.old.client.model.ModelPipe;
|
import resonantinduction.old.client.model.ModelPipe;
|
||||||
|
|
||||||
|
@ -34,8 +34,6 @@ public class RenderPipe extends TileEntitySpecialRenderer
|
||||||
@Override
|
@Override
|
||||||
public void renderTileEntityAt(TileEntity te, double d, double d1, double d2, float f)
|
public void renderTileEntityAt(TileEntity te, double d, double d1, double d2, float f)
|
||||||
{
|
{
|
||||||
// Texture file
|
|
||||||
|
|
||||||
FluidContainerMaterial mat = FluidContainerMaterial.IRON;
|
FluidContainerMaterial mat = FluidContainerMaterial.IRON;
|
||||||
if (te.getBlockMetadata() < FluidContainerMaterial.values().length)
|
if (te.getBlockMetadata() < FluidContainerMaterial.values().length)
|
||||||
{
|
{
|
||||||
|
@ -165,28 +163,27 @@ public class RenderPipe extends TileEntitySpecialRenderer
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
System.out.println(Integer.toBinaryString(side));
|
if (TileFluidNetwork.canRenderSide(side, ForgeDirection.DOWN))
|
||||||
if (TileFluidNetworkTile.canRenderSide(side,ForgeDirection.DOWN))
|
|
||||||
{
|
{
|
||||||
MODEL_PIPE.renderBottom();
|
MODEL_PIPE.renderBottom();
|
||||||
}
|
}
|
||||||
if (TileFluidNetworkTile.canRenderSide(side,ForgeDirection.UP))
|
if (TileFluidNetwork.canRenderSide(side, ForgeDirection.UP))
|
||||||
{
|
{
|
||||||
MODEL_PIPE.renderTop();
|
MODEL_PIPE.renderTop();
|
||||||
}
|
}
|
||||||
if (TileFluidNetworkTile.canRenderSide(side,ForgeDirection.NORTH))
|
if (TileFluidNetwork.canRenderSide(side, ForgeDirection.NORTH))
|
||||||
{
|
{
|
||||||
MODEL_PIPE.renderBack();
|
MODEL_PIPE.renderBack();
|
||||||
}
|
}
|
||||||
if (TileFluidNetworkTile.canRenderSide(side,ForgeDirection.SOUTH))
|
if (TileFluidNetwork.canRenderSide(side, ForgeDirection.SOUTH))
|
||||||
{
|
{
|
||||||
MODEL_PIPE.renderFront();
|
MODEL_PIPE.renderFront();
|
||||||
}
|
}
|
||||||
if (TileFluidNetworkTile.canRenderSide(side, ForgeDirection.WEST))
|
if (TileFluidNetwork.canRenderSide(side, ForgeDirection.WEST))
|
||||||
{
|
{
|
||||||
MODEL_PIPE.renderLeft();
|
MODEL_PIPE.renderLeft();
|
||||||
}
|
}
|
||||||
if (TileFluidNetworkTile.canRenderSide(side, ForgeDirection.EAST))
|
if (TileFluidNetwork.canRenderSide(side, ForgeDirection.EAST))
|
||||||
{
|
{
|
||||||
MODEL_PIPE.renderRight();
|
MODEL_PIPE.renderRight();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,19 +9,19 @@ import resonantinduction.api.fluid.INetworkPipe;
|
||||||
import resonantinduction.core.tilenetwork.ITileConnector;
|
import resonantinduction.core.tilenetwork.ITileConnector;
|
||||||
import resonantinduction.core.tilenetwork.ITileNetwork;
|
import resonantinduction.core.tilenetwork.ITileNetwork;
|
||||||
import resonantinduction.mechanical.fluid.network.NetworkPipes;
|
import resonantinduction.mechanical.fluid.network.NetworkPipes;
|
||||||
import resonantinduction.mechanical.fluid.prefab.TileFluidNetworkTile;
|
import resonantinduction.mechanical.fluid.prefab.TileFluidNetwork;
|
||||||
import universalelectricity.api.vector.Vector3;
|
import universalelectricity.api.vector.Vector3;
|
||||||
import calclavia.lib.utility.FluidHelper;
|
import calclavia.lib.utility.FluidHelper;
|
||||||
import dark.lib.helpers.ColorCode;
|
import dark.lib.helpers.ColorCode;
|
||||||
import dark.lib.helpers.ColorCode.IColorCoded;
|
import dark.lib.helpers.ColorCode.IColorCoded;
|
||||||
|
|
||||||
public class TilePipe extends TileFluidNetworkTile implements IColorCoded, INetworkPipe
|
public class TilePipe extends TileFluidNetwork implements IColorCoded, INetworkPipe
|
||||||
{
|
{
|
||||||
/** gets the current color mark of the pipe */
|
/** gets the current color mark of the pipe */
|
||||||
@Override
|
@Override
|
||||||
public ColorCode getColor()
|
public ColorCode getColor()
|
||||||
{
|
{
|
||||||
return EnumPipeType.getColorCode(this.subID);
|
return EnumPipeType.getColorCode(this.colorID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** sets the current color mark of the pipe */
|
/** sets the current color mark of the pipe */
|
||||||
|
@ -30,9 +30,9 @@ public class TilePipe extends TileFluidNetworkTile implements IColorCoded, INetw
|
||||||
{
|
{
|
||||||
if (!worldObj.isRemote)
|
if (!worldObj.isRemote)
|
||||||
{
|
{
|
||||||
int p = this.subID;
|
int p = this.colorID;
|
||||||
this.subID = EnumPipeType.getUpdatedID(subID, ColorCode.get(cc));
|
this.colorID = EnumPipeType.getUpdatedID(colorID, ColorCode.get(cc));
|
||||||
return p != this.subID;
|
return p != this.colorID;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
package resonantinduction.mechanical.fluid.prefab;
|
||||||
|
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import resonantinduction.core.prefab.block.BlockRI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Calclavia
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class BlockFluidNetwork extends BlockRI
|
||||||
|
{
|
||||||
|
public BlockFluidNetwork(String name)
|
||||||
|
{
|
||||||
|
super(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNeighborBlockChange(World world, int x, int y, int z, int par5)
|
||||||
|
{
|
||||||
|
TileEntity tile = world.getBlockTileEntity(x, y, z);
|
||||||
|
|
||||||
|
if (tile instanceof TileFluidNetwork)
|
||||||
|
{
|
||||||
|
((TileFluidNetwork) tile).refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -34,7 +34,7 @@ import com.google.common.io.ByteArrayDataInput;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public abstract class TileFluidNetworkTile extends TileEntityFluidDevice implements INetworkFluidPart, IPacketReceiver
|
public abstract class TileFluidNetwork extends TileEntityFluidDevice implements INetworkFluidPart, IPacketReceiver
|
||||||
{
|
{
|
||||||
private int updateTick = 1;
|
private int updateTick = 1;
|
||||||
public static int refreshRate = 10;
|
public static int refreshRate = 10;
|
||||||
|
@ -43,7 +43,7 @@ public abstract class TileFluidNetworkTile extends TileEntityFluidDevice impleme
|
||||||
protected List<TileEntity> connectedBlocks = new ArrayList<TileEntity>();
|
protected List<TileEntity> connectedBlocks = new ArrayList<TileEntity>();
|
||||||
protected int heat = 0, maxHeat = 20000;
|
protected int heat = 0, maxHeat = 20000;
|
||||||
protected int damage = 0, maxDamage = 1000;
|
protected int damage = 0, maxDamage = 1000;
|
||||||
protected int subID = 0;
|
protected int colorID = 0;
|
||||||
protected int tankCap;
|
protected int tankCap;
|
||||||
protected FluidStack prevStack = null;
|
protected FluidStack prevStack = null;
|
||||||
protected NetworkFluidTiles network;
|
protected NetworkFluidTiles network;
|
||||||
|
@ -55,12 +55,12 @@ public abstract class TileFluidNetworkTile extends TileEntityFluidDevice impleme
|
||||||
/** Bitmask **/
|
/** Bitmask **/
|
||||||
public byte renderSides = 0b0;
|
public byte renderSides = 0b0;
|
||||||
|
|
||||||
public TileFluidNetworkTile()
|
public TileFluidNetwork()
|
||||||
{
|
{
|
||||||
this(1);
|
this(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TileFluidNetworkTile(int tankCap)
|
public TileFluidNetwork(int tankCap)
|
||||||
{
|
{
|
||||||
if (tankCap <= 0)
|
if (tankCap <= 0)
|
||||||
{
|
{
|
||||||
|
@ -85,14 +85,10 @@ public abstract class TileFluidNetworkTile extends TileEntityFluidDevice impleme
|
||||||
public void updateEntity()
|
public void updateEntity()
|
||||||
{
|
{
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
|
||||||
if (!worldObj.isRemote)
|
if (!worldObj.isRemote)
|
||||||
{
|
{
|
||||||
if (ticks % this.updateTick == 0)
|
if (ticks % TileFluidNetwork.refreshRate == 0)
|
||||||
{
|
|
||||||
this.updateTick = this.worldObj.rand.nextInt(5) * 40 + 20;
|
|
||||||
this.refresh();
|
|
||||||
}
|
|
||||||
if (ticks % TileFluidNetworkTile.refreshRate == 0)
|
|
||||||
{
|
{
|
||||||
if (this.getTank().getFluid() == null && this.prevStack == null)
|
if (this.getTank().getFluid() == null && this.prevStack == null)
|
||||||
{
|
{
|
||||||
|
@ -102,6 +98,7 @@ public abstract class TileFluidNetworkTile extends TileEntityFluidDevice impleme
|
||||||
{
|
{
|
||||||
this.sendTankUpdate(0);
|
this.sendTankUpdate(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.prevStack = this.tank.getFluid();
|
this.prevStack = this.tank.getFluid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,7 +184,7 @@ public abstract class TileFluidNetworkTile extends TileEntityFluidDevice impleme
|
||||||
|
|
||||||
}
|
}
|
||||||
/** Only send packet updates if visuallyConnected changed. */
|
/** Only send packet updates if visuallyConnected changed. */
|
||||||
if (previousConnections == renderSides)
|
if (previousConnections != renderSides)
|
||||||
{
|
{
|
||||||
this.sendRenderUpdate();
|
this.sendRenderUpdate();
|
||||||
}
|
}
|
||||||
|
@ -359,7 +356,7 @@ public abstract class TileFluidNetworkTile extends TileEntityFluidDevice impleme
|
||||||
super.readFromNBT(nbt);
|
super.readFromNBT(nbt);
|
||||||
this.damage = nbt.getInteger("damage");
|
this.damage = nbt.getInteger("damage");
|
||||||
this.heat = nbt.getInteger("heat");
|
this.heat = nbt.getInteger("heat");
|
||||||
this.subID = nbt.getInteger("subID");
|
this.colorID = nbt.getInteger("subID");
|
||||||
if (nbt.hasKey("stored"))
|
if (nbt.hasKey("stored"))
|
||||||
{
|
{
|
||||||
NBTTagCompound tag = nbt.getCompoundTag("stored");
|
NBTTagCompound tag = nbt.getCompoundTag("stored");
|
||||||
|
@ -386,7 +383,7 @@ public abstract class TileFluidNetworkTile extends TileEntityFluidDevice impleme
|
||||||
super.writeToNBT(nbt);
|
super.writeToNBT(nbt);
|
||||||
nbt.setInteger("damage", this.damage);
|
nbt.setInteger("damage", this.damage);
|
||||||
nbt.setInteger("heat", this.heat);
|
nbt.setInteger("heat", this.heat);
|
||||||
nbt.setInteger("subID", this.subID);
|
nbt.setInteger("subID", this.colorID);
|
||||||
nbt.setCompoundTag("FluidTank", this.getTank().writeToNBT(new NBTTagCompound()));
|
nbt.setCompoundTag("FluidTank", this.getTank().writeToNBT(new NBTTagCompound()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,7 +398,7 @@ public abstract class TileFluidNetworkTile extends TileEntityFluidDevice impleme
|
||||||
|
|
||||||
if (readInt == PACKET_DESCRIPTION)
|
if (readInt == PACKET_DESCRIPTION)
|
||||||
{
|
{
|
||||||
this.subID = data.readInt();
|
this.colorID = data.readInt();
|
||||||
this.renderSides = data.readByte();
|
this.renderSides = data.readByte();
|
||||||
this.tank = new FluidTank(data.readInt());
|
this.tank = new FluidTank(data.readInt());
|
||||||
this.getTank().readFromNBT(PacketHandler.readNBTTagCompound(data));
|
this.getTank().readFromNBT(PacketHandler.readNBTTagCompound(data));
|
||||||
|
@ -409,7 +406,7 @@ public abstract class TileFluidNetworkTile extends TileEntityFluidDevice impleme
|
||||||
}
|
}
|
||||||
else if (readInt == PACKET_RENDER)
|
else if (readInt == PACKET_RENDER)
|
||||||
{
|
{
|
||||||
this.subID = data.readInt();
|
this.colorID = data.readInt();
|
||||||
this.renderSides = data.readByte();
|
this.renderSides = data.readByte();
|
||||||
}
|
}
|
||||||
else if (readInt == PACKET_TANK)
|
else if (readInt == PACKET_TANK)
|
||||||
|
@ -429,27 +426,19 @@ public abstract class TileFluidNetworkTile extends TileEntityFluidDevice impleme
|
||||||
@Override
|
@Override
|
||||||
public Packet getDescriptionPacket()
|
public Packet getDescriptionPacket()
|
||||||
{
|
{
|
||||||
Object[] data = new Object[9];
|
return ResonantInduction.PACKET_TILE.getPacket(this, PACKET_DESCRIPTION, this.colorID, this.renderSides, this.getTank().getCapacity(), this.getTank().writeToNBT(new NBTTagCompound()));
|
||||||
data[0] = this.subID;
|
|
||||||
data[1] = this.renderSides;
|
|
||||||
data[7] = this.getTank().getCapacity();
|
|
||||||
data[8] = this.getTank().writeToNBT(new NBTTagCompound());
|
|
||||||
return ResonantInduction.PACKET_TILE.getPacket(this, "DescriptionPacket", data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendRenderUpdate()
|
public void sendRenderUpdate()
|
||||||
{
|
{
|
||||||
Object[] data = new Object[7];
|
PacketHandler.sendPacketToClients(ResonantInduction.PACKET_TILE.getPacket(this, PACKET_RENDER, this.colorID, this.renderSides));
|
||||||
data[0] = this.subID;
|
|
||||||
data[1] = this.renderSides;
|
|
||||||
PacketHandler.sendPacketToClients(ResonantInduction.PACKET_TILE.getPacket(this, "RenderPacket", data));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendTankUpdate(int index)
|
public void sendTankUpdate(int index)
|
||||||
{
|
{
|
||||||
if (this.getTank() != null && index == 0)
|
if (this.getTank() != null && index == 0)
|
||||||
{
|
{
|
||||||
PacketHandler.sendPacketToClients(ResonantInduction.PACKET_TILE.getPacket(this, "SingleTank", this.getTank().getCapacity(), this.getTank().writeToNBT(new NBTTagCompound())), this.worldObj, new Vector3(this), 60);
|
PacketHandler.sendPacketToClients(ResonantInduction.PACKET_TILE.getPacket(this, PACKET_TANK, this.getTank().getCapacity(), this.getTank().writeToNBT(new NBTTagCompound())), this.worldObj, new Vector3(this), 60);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,12 +461,12 @@ public abstract class TileFluidNetworkTile extends TileEntityFluidDevice impleme
|
||||||
|
|
||||||
public int getSubID()
|
public int getSubID()
|
||||||
{
|
{
|
||||||
return this.subID;
|
return this.colorID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSubID(int id)
|
public void setSubID(int id)
|
||||||
{
|
{
|
||||||
this.subID = id;
|
this.colorID = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canRenderSide(byte renderSides, ForgeDirection direction)
|
public static boolean canRenderSide(byte renderSides, ForgeDirection direction)
|
|
@ -9,10 +9,10 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import resonantinduction.core.prefab.block.BlockRI;
|
|
||||||
import resonantinduction.mechanical.fluid.pipe.FluidContainerMaterial;
|
import resonantinduction.mechanical.fluid.pipe.FluidContainerMaterial;
|
||||||
import resonantinduction.mechanical.fluid.pipe.ItemBlockFluidContainer;
|
import resonantinduction.mechanical.fluid.pipe.ItemBlockFluidContainer;
|
||||||
import resonantinduction.mechanical.fluid.pipe.TilePipe;
|
import resonantinduction.mechanical.fluid.pipe.TilePipe;
|
||||||
|
import resonantinduction.mechanical.fluid.prefab.BlockFluidNetwork;
|
||||||
import resonantinduction.mechanical.render.MechanicalBlockRenderingHandler;
|
import resonantinduction.mechanical.render.MechanicalBlockRenderingHandler;
|
||||||
import universalelectricity.api.vector.Vector3;
|
import universalelectricity.api.vector.Vector3;
|
||||||
import calclavia.lib.utility.FluidHelper;
|
import calclavia.lib.utility.FluidHelper;
|
||||||
|
@ -20,7 +20,7 @@ import calclavia.lib.utility.HelperMethods;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockTank extends BlockRI
|
public class BlockTank extends BlockFluidNetwork
|
||||||
{
|
{
|
||||||
public static int tankVolume = 16;
|
public static int tankVolume = 16;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import net.minecraftforge.fluids.FluidStack;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import resonantinduction.core.render.RenderFluidHelper;
|
import resonantinduction.core.render.RenderFluidHelper;
|
||||||
import resonantinduction.mechanical.fluid.prefab.TileFluidNetworkTile;
|
import resonantinduction.mechanical.fluid.prefab.TileFluidNetwork;
|
||||||
import resonantinduction.old.client.model.ModelTankSide;
|
import resonantinduction.old.client.model.ModelTankSide;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
@ -30,15 +30,15 @@ public class RenderTank extends TileEntitySpecialRenderer
|
||||||
|
|
||||||
public void renderTank(TileEntity tileEntity, double x, double y, double z, int meta, FluidStack liquid)
|
public void renderTank(TileEntity tileEntity, double x, double y, double z, int meta, FluidStack liquid)
|
||||||
{
|
{
|
||||||
byte renderSudes = 0;
|
byte renderSides = 0;
|
||||||
|
|
||||||
if (tileEntity instanceof TileTank)
|
if (tileEntity instanceof TileTank)
|
||||||
{
|
{
|
||||||
renderSudes = ((TileTank) tileEntity).renderSides;
|
renderSides = ((TileTank) tileEntity).renderSides;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (liquid != null && liquid.amount > 100)
|
if (liquid != null && liquid.amount > 100)
|
||||||
{
|
{
|
||||||
|
|
||||||
int[] displayList = RenderFluidHelper.getFluidDisplayLists(liquid, tileEntity.worldObj, false);
|
int[] displayList = RenderFluidHelper.getFluidDisplayLists(liquid, tileEntity.worldObj, false);
|
||||||
|
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
|
@ -59,18 +59,11 @@ public class RenderTank extends TileEntitySpecialRenderer
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
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++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
ForgeDirection dir = ForgeDirection.getOrientation(i + 2);
|
ForgeDirection dir = ForgeDirection.getOrientation(i + 2);
|
||||||
|
|
||||||
if (!TileFluidNetworkTile.canRenderSide(renderSudes, dir.getOpposite()))
|
if (!TileFluidNetwork.canRenderSide(renderSides, dir.getOpposite()))
|
||||||
{
|
{
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
|
@ -83,28 +76,23 @@ public class RenderTank extends TileEntitySpecialRenderer
|
||||||
{
|
{
|
||||||
case NORTH:
|
case NORTH:
|
||||||
GL11.glRotatef(180f, 0f, 1f, 0f);
|
GL11.glRotatef(180f, 0f, 1f, 0f);
|
||||||
left = west;
|
|
||||||
right = east;
|
|
||||||
break;
|
break;
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
GL11.glRotatef(0f, 0f, 1f, 0f);
|
GL11.glRotatef(0f, 0f, 1f, 0f);
|
||||||
left = east;
|
|
||||||
right = west;
|
|
||||||
break;
|
break;
|
||||||
case WEST:
|
case WEST:
|
||||||
GL11.glRotatef(90f, 0f, 1f, 0f);
|
GL11.glRotatef(90f, 0f, 1f, 0f);
|
||||||
left = south;
|
|
||||||
right = north;
|
|
||||||
break;
|
break;
|
||||||
case EAST:
|
case EAST:
|
||||||
GL11.glRotatef(270f, 0f, 1f, 0f);
|
GL11.glRotatef(270f, 0f, 1f, 0f);
|
||||||
left = north;
|
|
||||||
right = south;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
left = TileFluidNetwork.canRenderSide(renderSides, dir.getRotation(ForgeDirection.UP));
|
||||||
|
right = TileFluidNetwork.canRenderSide(renderSides, dir.getRotation(ForgeDirection.DOWN));
|
||||||
|
|
||||||
bindTexture(RenderTank.getTexture(tileEntity.getBlockType().blockID, tileEntity.getBlockMetadata()));
|
bindTexture(RenderTank.getTexture(tileEntity.getBlockType().blockID, tileEntity.getBlockMetadata()));
|
||||||
MODEL.render(0.0625F, left, right, top, bot);
|
MODEL.render(0.0625F, left, right, TileFluidNetwork.canRenderSide(renderSides, ForgeDirection.UP), TileFluidNetwork.canRenderSide(renderSides, ForgeDirection.DOWN));
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ import resonantinduction.api.fluid.INetworkFluidPart;
|
||||||
import resonantinduction.core.tilenetwork.INetworkPart;
|
import resonantinduction.core.tilenetwork.INetworkPart;
|
||||||
import resonantinduction.core.tilenetwork.ITileNetwork;
|
import resonantinduction.core.tilenetwork.ITileNetwork;
|
||||||
import resonantinduction.mechanical.fluid.network.NetworkFluidContainers;
|
import resonantinduction.mechanical.fluid.network.NetworkFluidContainers;
|
||||||
import resonantinduction.mechanical.fluid.prefab.TileFluidNetworkTile;
|
import resonantinduction.mechanical.fluid.prefab.TileFluidNetwork;
|
||||||
|
|
||||||
public class TileTank extends TileFluidNetworkTile
|
public class TileTank extends TileFluidNetwork
|
||||||
{
|
{
|
||||||
public TileTank()
|
public TileTank()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue