Fixed fluid scaling issue

This commit is contained in:
aidancbrady 2016-03-26 13:28:48 -04:00
parent 42ca8c29b1
commit 25866b39f9
4 changed files with 10 additions and 11 deletions

View file

@ -62,7 +62,7 @@ public class GuiDynamicTank extends GuiMekanism
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
if(tileEntity.getScaledFluidLevel(58) > 0)
{
displayGauge(7, 14, tileEntity.getScaledFluidLevel(58), tileEntity.structure.fluidStored, 0);

View file

@ -182,7 +182,7 @@ public abstract class UpdateProtocol<T extends SynchronizedData<T>>
volume += locations.size();
if(volume >= 27 && volume <= 5832 && locations.size() >= 26)
if(Math.abs(xmax-xmin)+1 <= 18 && Math.abs(xmax-xmin)+1 <= 18 && Math.abs(zmax-zmin)+1 <= 18)
{
if(rightBlocks && rightFrame && isHollow && isCorner)
{
@ -191,7 +191,7 @@ public abstract class UpdateProtocol<T extends SynchronizedData<T>>
structure.volLength = Math.abs(xmax-xmin)+1;
structure.volHeight = Math.abs(ymax-ymin)+1;
structure.volWidth = Math.abs(zmax-zmin)+1;
structure.volume = volume;
structure.volume = structure.volLength*structure.volHeight*structure.volWidth;
structure.renderLocation = Coord4D.get(tile).translate(0, 1, 0);
structure.minLocation = Coord4D.get(tile).translate(xmin, ymin, zmin);
structure.maxLocation = Coord4D.get(tile).translate(xmax, ymax, zmax);

View file

@ -156,14 +156,14 @@ public class TileEntityBoilerCasing extends TileEntityMultiblock<SynchronizedBoi
structure.lastMaxBoil = 0;
}
structure.prevWater = structure.waterStored;
structure.prevSteam = structure.steamStored;
if(needsValveUpdate || structure.needsRenderUpdate() || needsHotUpdate)
{
sendPacketToRenderer();
}
structure.prevWater = structure.waterStored.copy();
structure.prevSteam = structure.steamStored.copy();
MekanismUtils.saveChunk(this);
}
}

View file

@ -8,7 +8,6 @@ import java.util.Set;
import mekanism.api.Coord4D;
import mekanism.api.Range4D;
import mekanism.api.util.StackUtils;
import mekanism.common.Mekanism;
import mekanism.common.base.IFluidContainerManager;
import mekanism.common.block.BlockBasic;
@ -59,7 +58,7 @@ public class TileEntityDynamicTank extends TileEntityMultiblock<SynchronizedTank
if(structure != null && clientHasStructure && isRendering)
{
float targetScale = (float)(structure.fluidStored != null ? structure.fluidStored.amount : 0)/clientCapacity;
if(Math.abs(prevScale - targetScale) > 0.01)
{
prevScale = (9*prevScale + targetScale)/10;
@ -116,7 +115,7 @@ public class TileEntityDynamicTank extends TileEntityMultiblock<SynchronizedTank
sendPacketToRenderer();
}
structure.prevFluid = structure.fluidStored;
structure.prevFluid = structure.fluidStored.copy();
manageInventory();
}
@ -289,14 +288,14 @@ public class TileEntityDynamicTank extends TileEntityMultiblock<SynchronizedTank
}
}
public int getScaledFluidLevel(int i)
public int getScaledFluidLevel(long i)
{
if(clientCapacity == 0 || structure.fluidStored == null)
{
return 0;
}
return structure.fluidStored.amount*i / clientCapacity;
return (int)(structure.fluidStored.amount*i / clientCapacity);
}
@Override