Fixed tank gas rendering and itemBlock
This commit is contained in:
parent
d369aa7900
commit
6fefca72e2
2 changed files with 25 additions and 19 deletions
|
@ -124,13 +124,15 @@ public class ItemBlockFluidContainer extends ItemBlock
|
||||||
if (tile instanceof TileFluidDistribution)
|
if (tile instanceof TileFluidDistribution)
|
||||||
{
|
{
|
||||||
((TileFluidDistribution) tile).setSubID(stack.getItemDamage());
|
((TileFluidDistribution) tile).setSubID(stack.getItemDamage());
|
||||||
|
|
||||||
if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("fluid"))
|
if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("fluid"))
|
||||||
{
|
{
|
||||||
((TileFluidDistribution) tile).fill(ForgeDirection.UNKNOWN, FluidStack.loadFluidStackFromNBT(stack.getTagCompound().getCompoundTag("fluid")), true);
|
((TileFluidDistribution) tile).getInternalTank().fill(FluidStack.loadFluidStackFromNBT(stack.getTagCompound().getCompoundTag("fluid")), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,13 +55,18 @@ public class RenderTank extends TileEntitySpecialRenderer implements ISimpleItem
|
||||||
{
|
{
|
||||||
if (tileEntity instanceof TileTank)
|
if (tileEntity instanceof TileTank)
|
||||||
{
|
{
|
||||||
byte renderSides = ((TileTank) tileEntity).renderSides;
|
|
||||||
|
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
|
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
|
||||||
|
byte renderSides = ((TileTank) tileEntity).renderSides;
|
||||||
|
|
||||||
RenderUtility.renderBlockWithConnectedTextures(renderSides, Archaic.blockTank, null, ResonantInduction.blockMachinePart, null);
|
RenderUtility.renderBlockWithConnectedTextures(renderSides, Archaic.blockTank, null, ResonantInduction.blockMachinePart, null);
|
||||||
|
|
||||||
if (tileEntity.worldObj != null)
|
if (fluid != null)
|
||||||
|
{
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
|
if (tileEntity.worldObj != null && !fluid.getFluid().isGaseous())
|
||||||
{
|
{
|
||||||
GL11.glScaled(0.99, 0.99, 0.99);
|
GL11.glScaled(0.99, 0.99, 0.99);
|
||||||
FluidTank tank = ((TileTank) tileEntity).getInternalTank();
|
FluidTank tank = ((TileTank) tileEntity).getInternalTank();
|
||||||
|
@ -75,14 +80,14 @@ public class RenderTank extends TileEntitySpecialRenderer implements ISimpleItem
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (fluid != null)
|
GL11.glTranslated(-0.5, -0.5, -0.5);
|
||||||
{
|
GL11.glScaled(0.99, 0.99, 0.99);
|
||||||
int capacity = tileEntity instanceof TileTank ? ((TileTank) tileEntity).getInternalTank().getCapacity() : fluid.amount;
|
int capacity = tileEntity instanceof TileTank ? ((TileTank) tileEntity).getInternalTank().getCapacity() : fluid.amount;
|
||||||
double filledPercentage = (double) fluid.amount / (double) capacity;
|
double filledPercentage = (double) fluid.amount / (double) capacity;
|
||||||
double renderPercentage = fluid.getFluid().isGaseous() ? 1 : filledPercentage;
|
double renderPercentage = fluid.getFluid().isGaseous() ? 1 : filledPercentage;
|
||||||
|
|
||||||
int[] displayList = FluidRenderUtility.getFluidDisplayLists(fluid, tileEntity.worldObj, false);
|
int[] displayList = FluidRenderUtility.getFluidDisplayLists(fluid, tileEntity.worldObj, false);
|
||||||
|
|
||||||
GL11.glPushMatrix();
|
|
||||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
@ -94,13 +99,12 @@ public class RenderTank extends TileEntitySpecialRenderer implements ISimpleItem
|
||||||
GL11.glColor4d(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, fluid.getFluid().isGaseous() ? filledPercentage : 1);
|
GL11.glColor4d(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, fluid.getFluid().isGaseous() ? filledPercentage : 1);
|
||||||
|
|
||||||
RenderUtility.bind(FluidRenderUtility.getFluidSheet(fluid));
|
RenderUtility.bind(FluidRenderUtility.getFluidSheet(fluid));
|
||||||
// Prevent Z-fighting
|
|
||||||
GL11.glTranslatef((float) x, (float) y + 0.001f, (float) z);
|
|
||||||
GL11.glCallList(displayList[(int) (renderPercentage * (FluidRenderUtility.DISPLAY_STAGES - 1))]);
|
GL11.glCallList(displayList[(int) (renderPercentage * (FluidRenderUtility.DISPLAY_STAGES - 1))]);
|
||||||
RenderUtility.disableBlending();
|
RenderUtility.disableBlending();
|
||||||
GL11.glPopAttrib();
|
GL11.glPopAttrib();
|
||||||
GL11.glPopMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
|
|
Loading…
Reference in a new issue