Search in sources :

Example 1 with TileFluidLoader

use of mods.railcraft.common.blocks.machine.manipulator.TileFluidLoader in project Railcraft by Railcraft.

the class TESRManipulatorFluid method renderTileEntityAt.

@Override
public void renderTileEntityAt(TileFluidManipulator tile, double x, double y, double z, float partialTicks, int destroyStage) {
    StandardTank tank = tile.getTankManager().get(0);
    FluidStack fluidStack = tank.getFluid();
    if (fluidStack != null && fluidStack.amount > 0) {
        OpenGL.glPushAttrib();
        OpenGL.glPushMatrix();
        OpenGL.glTranslatef((float) x + 0.5F, (float) y + 0.06256F * 4, (float) z + 0.5F);
        OpenGL.glScalef(0.95f, 1f, 0.95f);
        OpenGL.glTranslatef(-0.5F, 0, -0.5F);
        float cap = tank.getCapacity();
        float level = Math.min(fluidStack.amount, cap) / cap;
        OpenGL.glEnable(GL11.GL_CULL_FACE);
        OpenGL.glDisable(GL11.GL_LIGHTING);
        //                OpenGL.glEnable(GL11.GL_BLEND);
        //                OpenGL.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        FluidModelRenderer.INSTANCE.renderFluid(fluidStack, Math.min(8, (int) Math.ceil(level * 8F)));
        //                OpenGL.glDisable(GL11.GL_BLEND);
        OpenGL.glEnable(GL11.GL_LIGHTING);
        OpenGL.glPopMatrix();
        OpenGL.glPopAttrib();
    }
    if (tile.getClass() == TileFluidLoader.class) {
        TileFluidLoader loader = (TileFluidLoader) tile;
        OpenGL.glPushMatrix();
        OpenGL.glTranslatef((float) x, (float) y - loader.getPipeLength(), (float) z);
        //            OpenGL.glEnable(GL11.GL_LIGHTING);
        //            OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 255F , 255F );
        //            pipe.boundingBox = AABBFactory.start().fromAABB(pipe.boundingBox).setMinY(RenderTools.PIXEL - loader.getPipeLength()).build();
        JSONModelRenderer.INSTANCE.renderModel(PIPE_MODEL);
        OpenGL.glPopMatrix();
    }
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack) TileFluidLoader(mods.railcraft.common.blocks.machine.manipulator.TileFluidLoader) StandardTank(mods.railcraft.common.fluids.tanks.StandardTank)

Aggregations

TileFluidLoader (mods.railcraft.common.blocks.machine.manipulator.TileFluidLoader)1 StandardTank (mods.railcraft.common.fluids.tanks.StandardTank)1 FluidStack (net.minecraftforge.fluids.FluidStack)1