mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-22 13:10:13 +00:00
#44 Liquids in reservoir and conduits not always rendering correctly.
This commit is contained in:
1 parent
f9dd2debcd
commit
aec4bfc17d
3 files changed
+39
-4
No files matched your search
@@ -163,6 +163,9 @@ public class LiquidConduitNetwork extends AbstractConduitNetwork<ILiquidConduit>
|
||||
for (ILiquidConduit con : conduits) {
|
||||
if (con.getTank().getFluidAmount() < 10) {
|
||||
toEmpty.add(con);
|
||||
} else {
|
||||
//some of the conduits have fluid left in them so don't do the final drain yet
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import crazypants.render.BoundingBox;
|
||||
import crazypants.render.CubeRenderer;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.vecmath.Vector3d;
|
||||
import crazypants.vecmath.Vector3f;
|
||||
|
||||
public class ReservoirRenderer extends TileEntitySpecialRenderer {
|
||||
|
||||
@@ -35,10 +36,12 @@ public class ReservoirRenderer extends TileEntitySpecialRenderer {
|
||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
|
||||
|
||||
TileReservoir res = (TileReservoir) tileentity;
|
||||
if(res.haveRendered(tileentity.worldObj.getTotalWorldTime(), f)) {
|
||||
return;
|
||||
}
|
||||
|
||||
float fullness = res.getFilledRatio();
|
||||
if ((res.isMultiblock() && !res.isMaster() && (fullness >= 0 || res.isAutoEject())) || (!res.isMultiblock() &&
|
||||
fullness <= 0)) {
|
||||
if(fullness <= 0 && !res.isAutoEject()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -53,11 +56,14 @@ public class ReservoirRenderer extends TileEntitySpecialRenderer {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
|
||||
Vector3f offset = res.getOffsetFromController();
|
||||
|
||||
GL11.glTranslatef((float) x + offset.x, (float) y + offset.y, (float) z + offset.z);
|
||||
|
||||
BoundingBox bb = res.getLiquidRenderBounds();
|
||||
|
||||
if (res.isMultiblock() && res.isAutoEject()) {
|
||||
if(res.isAutoEject()) {
|
||||
|
||||
// switch
|
||||
RenderUtil.bindBlockTexture();
|
||||
@@ -164,4 +170,5 @@ public class ReservoirRenderer extends TileEntitySpecialRenderer {
|
||||
}
|
||||
return tex;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.PacketHandler;
|
||||
import crazypants.render.BoundingBox;
|
||||
import crazypants.util.BlockCoord;
|
||||
import crazypants.vecmath.Vector3f;
|
||||
|
||||
public class TileReservoir extends TileEntity implements IFluidHandler {
|
||||
|
||||
@@ -624,4 +625,28 @@ public class TileReservoir extends TileEntity implements IFluidHandler {
|
||||
return res;
|
||||
}
|
||||
|
||||
public Vector3f getOffsetFromController() {
|
||||
if(!isMultiblock()) {
|
||||
return new Vector3f();
|
||||
}
|
||||
BlockCoord masterBC = multiblock[0];
|
||||
BlockCoord myBC = new BlockCoord(xCoord, yCoord, zCoord);
|
||||
return new Vector3f(masterBC.x - myBC.x, masterBC.y - myBC.y, masterBC.z - myBC.z);
|
||||
}
|
||||
|
||||
long lastRenderTick;
|
||||
float lastRenderPartialTick;
|
||||
|
||||
public boolean haveRendered(long renderTick, float renderPartialTick) {
|
||||
TileReservoir c = getController();
|
||||
if(c.lastRenderTick == renderTick && renderPartialTick == c.lastRenderPartialTick) {
|
||||
return true;
|
||||
}
|
||||
|
||||
c.lastRenderTick = renderTick;
|
||||
c.lastRenderPartialTick = renderPartialTick;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user