use of pneumaticCraft.common.tileentity.TileEntityLiquidHopper in project PneumaticCraft by MineMaarten.
the class ModelLiquidHopper method renderMain.
@Override
protected void renderMain(TileEntityOmnidirectionalHopper hopper) {
if (hopper != null) {
TileEntityLiquidHopper liquidHopper = (TileEntityLiquidHopper) hopper;
FluidTankInfo info = liquidHopper.getTankInfo(null)[0];
int fluidAmount = info.fluid != null ? info.fluid.amount - info.capacity / 10 : 0;
if (fluidAmount > 10) {
GL11.glDisable(GL11.GL_LIGHTING);
float percentageFull = Math.min(1, fluidAmount / (info.capacity * 0.3F));
RenderInfo renderInfo = new RenderInfo(-4 / 16F + 0.001F, 12 / 16F + 0.001F, 4 / 16F - percentageFull * 5.999F / 16F, 4 / 16F - 0.001F, 20 / 16F - 0.001F, 4 / 16F - 0.001F);
RenderUtils.INSTANCE.renderLiquid(info, renderInfo, liquidHopper.getWorldObj());
fluidAmount -= info.capacity * 0.3F;
if (fluidAmount > 10) {
percentageFull = Math.min(1, fluidAmount / (info.capacity * 0.3F));
renderInfo = new RenderInfo(-6 / 16F + 0.001F, 10 / 16F + 0.001F, -2 / 16F - percentageFull * 0.999F / 16F, 6 / 16F - 0.001F, 22 / 16F - 0.001F, -2 / 16F - 0.001F);
RenderUtils.INSTANCE.renderLiquid(info, renderInfo, liquidHopper.getWorldObj());
fluidAmount -= info.capacity * 0.3F;
if (fluidAmount > 10) {
percentageFull = Math.min(1, fluidAmount / (info.capacity * 0.3F));
renderInfo = new RenderInfo(6 / 16F + 0.001F, 8 / 16F + 0.001F, -2 / 16F - percentageFull * 5.999F / 16F, 8 / 16F - 0.001F, 24 / 16F - 0.001F, -2 / 16F - 0.001F);
RenderUtils.INSTANCE.renderLiquid(info, renderInfo, liquidHopper.getWorldObj());
renderInfo = new RenderInfo(-8 / 16F + 0.001F, 8 / 16F + 0.001F, -2 / 16F - percentageFull * 5.999F / 16F, -6 / 16F - 0.001F, 24 / 16F - 0.001F, -2 / 16F - 0.001F);
RenderUtils.INSTANCE.renderLiquid(info, renderInfo, liquidHopper.getWorldObj());
renderInfo = new RenderInfo(-6 / 16F + 0.001F, 22 / 16F + 0.001F, -2 / 16F - percentageFull * 5.999F / 16F, 6 / 16F - 0.001F, 24 / 16F - 0.001F, -2 / 16F - 0.001F);
RenderUtils.INSTANCE.renderLiquid(info, renderInfo, liquidHopper.getWorldObj());
renderInfo = new RenderInfo(-6 / 16F + 0.001F, 8 / 16F + 0.001F, -2 / 16F - percentageFull * 5.999F / 16F, 6 / 16F - 0.001F, 10 / 16F - 0.001F, -2 / 16F - 0.001F);
RenderUtils.INSTANCE.renderLiquid(info, renderInfo, liquidHopper.getWorldObj());
}
}
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(getModelTexture(hopper));
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glColor4d(1, 1, 1, 1);
}
}
}
use of pneumaticCraft.common.tileentity.TileEntityLiquidHopper in project PneumaticCraft by MineMaarten.
the class ModelLiquidHopper method renderBottom.
@Override
protected void renderBottom(TileEntityOmnidirectionalHopper hopper) {
if (hopper != null) {
TileEntityLiquidHopper liquidHopper = (TileEntityLiquidHopper) hopper;
FluidTankInfo info = liquidHopper.getTankInfo(null)[0];
if (info.fluid != null && info.fluid.amount > 10) {
GL11.glDisable(GL11.GL_LIGHTING);
float percentageFull = Math.min(1, (float) info.fluid.amount / (info.capacity / 10));
RenderInfo renderInfo = new RenderInfo(-2 / 16F + 0.001F, 14 / 16F + 0.001F, 8 / 16F - percentageFull * 3.999F / 16F, 2 / 16F - 0.001F, 18 / 16F - 0.001F, 8 / 16F - 0.001F);
RenderUtils.INSTANCE.renderLiquid(info, renderInfo, liquidHopper.getWorldObj());
GL11.glEnable(GL11.GL_LIGHTING);
}
}
}
Aggregations