Dynamic Tanks are now 300% better.
This commit is contained in:
parent
5ea77c0c15
commit
b950960aea
6 changed files with 23 additions and 12 deletions
|
@ -1,12 +1,12 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.common.TankUpdateProtocol;
|
||||
import mekanism.common.inventory.container.ContainerDynamicTank;
|
||||
import mekanism.common.tileentity.TileEntityDynamicTank;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -36,7 +36,7 @@ public class GuiDynamicTank extends GuiMekanism
|
|||
|
||||
fontRenderer.drawString(tileEntity.fullName, 45, 6, 0x404040);
|
||||
fontRenderer.drawString("Inventory", 8, (ySize - 94) + 2, 0x404040);
|
||||
fontRenderer.drawString("Volume: " + tileEntity.clientCapacity/16000, 53, 26, 0x00CD00);
|
||||
fontRenderer.drawString("Volume: " + tileEntity.clientCapacity/TankUpdateProtocol.FLUID_PER_TANK, 53, 26, 0x00CD00);
|
||||
fontRenderer.drawString(tileEntity.structure.fluidStored != null ? tileEntity.structure.fluidStored.getFluid().getName() + ":" : "No fluid.", 53, 44, 0x00CD00);
|
||||
|
||||
if(tileEntity.structure.fluidStored != null)
|
||||
|
|
|
@ -8,6 +8,7 @@ import mekanism.client.render.MekanismRenderer;
|
|||
import mekanism.client.render.MekanismRenderer.DisplayInteger;
|
||||
import mekanism.client.render.MekanismRenderer.Model3D;
|
||||
import mekanism.common.SynchronizedTankData.ValveData;
|
||||
import mekanism.common.TankUpdateProtocol;
|
||||
import mekanism.common.tileentity.TileEntityDynamicTank;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
|
@ -17,7 +18,6 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
@ -145,9 +145,9 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
|
|||
toReturn.minY = 0 + .01;
|
||||
toReturn.minZ = 0 + .01;
|
||||
|
||||
toReturn.maxX = data.length-2 - .01;
|
||||
toReturn.maxX = data.length - .01;
|
||||
toReturn.maxY = ((float)i/(float)stages)*(data.height-2) - .01;
|
||||
toReturn.maxZ = data.width-2 - .01;
|
||||
toReturn.maxZ = data.width - .01;
|
||||
|
||||
MekanismRenderer.renderObject(toReturn);
|
||||
GL11.glEndList();
|
||||
|
@ -275,7 +275,7 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer
|
|||
|
||||
private int getStages(int height)
|
||||
{
|
||||
return (height-2)*1600;
|
||||
return (height-2)*(TankUpdateProtocol.FLUID_PER_TANK/10);
|
||||
}
|
||||
|
||||
private double getX(int x)
|
||||
|
|
|
@ -3,6 +3,7 @@ package mekanism.common;
|
|||
import mekanism.api.Object3D;
|
||||
import mekanism.common.SynchronizedTankData.ValveData;
|
||||
import mekanism.common.tileentity.TileEntityDynamicTank;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
|
@ -25,7 +26,7 @@ public class DynamicFluidTank implements IFluidTank
|
|||
@Override
|
||||
public int getCapacity()
|
||||
{
|
||||
return dynamicTank.structure != null ? dynamicTank.structure.volume*16000 : 0;
|
||||
return dynamicTank.structure != null ? dynamicTank.structure.volume*TankUpdateProtocol.FLUID_PER_TANK : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,6 +50,7 @@ public class DynamicFluidTank implements IFluidTank
|
|||
|
||||
if(resource.amount > 0 && doFill)
|
||||
{
|
||||
MekanismUtils.saveChunk(dynamicTank);
|
||||
updateValveData(true);
|
||||
dynamicTank.sendPacketToRenderer();
|
||||
updateValveData(false);
|
||||
|
@ -65,6 +67,7 @@ public class DynamicFluidTank implements IFluidTank
|
|||
|
||||
if(getCapacity() > 0 && doFill)
|
||||
{
|
||||
MekanismUtils.saveChunk(dynamicTank);
|
||||
updateValveData(true);
|
||||
dynamicTank.sendPacketToRenderer();
|
||||
updateValveData(false);
|
||||
|
@ -90,6 +93,7 @@ public class DynamicFluidTank implements IFluidTank
|
|||
|
||||
if(resource.amount > 0 && doFill)
|
||||
{
|
||||
MekanismUtils.saveChunk(dynamicTank);
|
||||
updateValveData(true);
|
||||
dynamicTank.sendPacketToRenderer();
|
||||
updateValveData(false);
|
||||
|
@ -105,6 +109,7 @@ public class DynamicFluidTank implements IFluidTank
|
|||
|
||||
if(space > 0 && doFill)
|
||||
{
|
||||
MekanismUtils.saveChunk(dynamicTank);
|
||||
updateValveData(true);
|
||||
dynamicTank.sendPacketToRenderer();
|
||||
updateValveData(false);
|
||||
|
@ -167,6 +172,7 @@ public class DynamicFluidTank implements IFluidTank
|
|||
|
||||
if(drained.amount > 0 && doDrain)
|
||||
{
|
||||
MekanismUtils.saveChunk(dynamicTank);
|
||||
dynamicTank.sendPacketToRenderer();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
|
||||
public class TankUpdateProtocol
|
||||
{
|
||||
public static final int FLUID_PER_TANK = 32000;
|
||||
|
||||
/** The dynamic tank nodes that have already been iterated over. */
|
||||
public Set<TileEntityDynamicTank> iteratedNodes = new HashSet<TileEntityDynamicTank>();
|
||||
|
||||
|
@ -170,7 +172,9 @@ public class TankUpdateProtocol
|
|||
}
|
||||
}
|
||||
|
||||
if(volume > 0 && volume <= 4096 && locations.size() >= 9)
|
||||
volume += locations.size();
|
||||
|
||||
if(volume > 0 && volume <= 5832 && locations.size() >= 9)
|
||||
{
|
||||
if(rightBlocks && rightFrame && isHollow && isCorner)
|
||||
{
|
||||
|
@ -180,7 +184,7 @@ public class TankUpdateProtocol
|
|||
structure.volHeight = Math.abs(ymax-ymin)+1;
|
||||
structure.volWidth = Math.abs(zmax-zmin)+1;
|
||||
structure.volume = volume;
|
||||
structure.renderLocation = Object3D.get(tile).translate(1, 1, 1);
|
||||
structure.renderLocation = Object3D.get(tile).translate(0, 1, 0);
|
||||
|
||||
for(Object3D obj : structure.locations)
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@ import mekanism.common.ItemAttacher;
|
|||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.TankUpdateProtocol;
|
||||
import mekanism.common.inventory.InventoryBin;
|
||||
import mekanism.common.network.PacketTileEntity;
|
||||
import mekanism.common.tileentity.TileEntityBasicBlock;
|
||||
|
@ -419,7 +420,7 @@ public class BlockBasic extends Block
|
|||
else if(FluidContainerRegistry.isFilledContainer(itemStack))
|
||||
{
|
||||
FluidStack itemFluid = FluidContainerRegistry.getFluidForFilledItem(itemStack);
|
||||
int max = tileEntity.structure.volume*16000;
|
||||
int max = tileEntity.structure.volume*TankUpdateProtocol.FLUID_PER_TANK;
|
||||
|
||||
if(tileEntity.structure.fluidStored == null || (tileEntity.structure.fluidStored.isFluidEqual(itemFluid) && (tileEntity.structure.fluidStored.amount+itemFluid.amount <= max)))
|
||||
{
|
||||
|
|
|
@ -195,7 +195,7 @@ public class TileEntityDynamicTank extends TileEntityContainerBlock
|
|||
|
||||
public void manageInventory()
|
||||
{
|
||||
int max = structure.volume*16000;
|
||||
int max = structure.volume*TankUpdateProtocol.FLUID_PER_TANK;
|
||||
|
||||
if(structure.inventory[0] != null)
|
||||
{
|
||||
|
@ -303,7 +303,7 @@ public class TileEntityDynamicTank extends TileEntityContainerBlock
|
|||
|
||||
data.add(isRendering);
|
||||
data.add(structure != null);
|
||||
data.add(structure != null ? structure.volume*16000 : 0);
|
||||
data.add(structure != null ? structure.volume*TankUpdateProtocol.FLUID_PER_TANK : 0);
|
||||
|
||||
if(structure != null && structure.fluidStored != null)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue