Search in sources :

Example 1 with TileEntityKeroseneLamp

use of pneumaticCraft.common.tileentity.TileEntityKeroseneLamp in project PneumaticCraft by MineMaarten.

the class ModelKeroseneLamp method renderStatic.

@Override
public void renderStatic(float size, TileEntity te) {
    ForgeDirection sideConnected = ForgeDirection.DOWN;
    if (te != null) {
        sideConnected = ((TileEntityKeroseneLamp) te).getSideConnected();
    }
    Tank.render(size);
    Holder1.render(size);
    Holder2.render(size);
    Base.render(size);
    Top.render(size);
    if (sideConnected != ForgeDirection.DOWN) {
        Support1.render(size);
        if (sideConnected != ForgeDirection.UP) {
            SupportSide.rotateAngleY = 0;
            ForgeDirection rotation = ((TileEntityKeroseneLamp) te).getRotation();
            if (rotation != ForgeDirection.UP && rotation != ForgeDirection.DOWN) {
                while (sideConnected != rotation.getOpposite()) {
                    sideConnected = sideConnected.getRotation(ForgeDirection.DOWN);
                    SupportSide.rotateAngleY += Math.toRadians(90);
                }
            }
            SupportSide2.rotateAngleY = SupportSide.rotateAngleY;
            SupportSide.render(size);
            SupportSide2.render(size);
        }
    }
    if (te != null) {
        FluidTankInfo info = ((TileEntityKeroseneLamp) te).getTankInfo(null)[0];
        if (info.fluid != null && info.fluid.amount > 10) {
            float percentageFull = (float) info.fluid.amount / info.capacity;
            RenderInfo renderInfo = new RenderInfo(-3 / 16F + 0.01F, 23 / 16F - percentageFull * 2.999F / 16F, -3 / 16F + 0.01F, 3 / 16F - 0.01F, 22.99F / 16F, 3 / 16F - 0.01F);
            RenderUtils.INSTANCE.renderLiquid(info, renderInfo, te.getWorldObj());
        }
    }
}
Also used : FluidTankInfo(net.minecraftforge.fluids.FluidTankInfo) TileEntityKeroseneLamp(pneumaticCraft.common.tileentity.TileEntityKeroseneLamp) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) RenderInfo(pneumaticCraft.client.util.RenderUtils.RenderInfo)

Aggregations

ForgeDirection (net.minecraftforge.common.util.ForgeDirection)1 FluidTankInfo (net.minecraftforge.fluids.FluidTankInfo)1 RenderInfo (pneumaticCraft.client.util.RenderUtils.RenderInfo)1 TileEntityKeroseneLamp (pneumaticCraft.common.tileentity.TileEntityKeroseneLamp)1