Search in sources :

Example 1 with RenderInfo

use of pneumaticCraft.client.util.RenderUtils.RenderInfo in project PneumaticCraft by MineMaarten.

the class ModelPlasticMixer method renderStatic.

@Override
public void renderStatic(float size, TileEntity te) {
    Shape2.render(size);
    Shape3b.render(size);
    Shape1.render(size);
    Shape3.render(size);
    Shape4b.render(size);
    Shape4.render(size);
    if (te != null) {
        TileEntityPlasticMixer mixer = (TileEntityPlasticMixer) te;
        FluidTankInfo info = mixer.getTankInfo(null)[0];
        if (info.fluid != null && info.fluid.amount > 10) {
            float percentageFull = (float) info.fluid.amount / info.capacity;
            RenderInfo renderInfo = new RenderInfo(-6 / 16F + 0.01F, 22 / 16F - percentageFull * 13.999F / 16F, -6 / 16F + 0.01F, 6 / 16F - 0.01F, 22 / 16F, 6 / 16F - 0.01F);
            RenderUtils.INSTANCE.renderLiquid(info, renderInfo, mixer.getWorldObj());
        }
    }
}
Also used : FluidTankInfo(net.minecraftforge.fluids.FluidTankInfo) TileEntityPlasticMixer(pneumaticCraft.common.tileentity.TileEntityPlasticMixer) RenderInfo(pneumaticCraft.client.util.RenderUtils.RenderInfo)

Example 2 with RenderInfo

use of pneumaticCraft.client.util.RenderUtils.RenderInfo 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)

Example 3 with RenderInfo

use of pneumaticCraft.client.util.RenderUtils.RenderInfo in project PneumaticCraft by MineMaarten.

the class ModelThermopneumaticProcessingPlant method renderStatic.

@Override
public void renderStatic(float size, TileEntity te) {
    itemPart.render(size);
    inputTank.render(size);
    outputTank.render(size);
    pipe1.render(size);
    pipe2.render(size);
    pipe3.render(size);
    pipe4.render(size);
    airBottom.render(size);
    airBack.render(size);
    airLeft.render(size);
    airRight.render(size);
    if (te != null) {
        TileEntityThermopneumaticProcessingPlant processor = (TileEntityThermopneumaticProcessingPlant) te;
        FluidTankInfo info = processor.getTankInfo(null)[0];
        if (info.fluid != null && info.fluid.amount > 10) {
            float percentageFull = (float) info.fluid.amount / info.capacity;
            RenderInfo renderInfo = new RenderInfo(-8 / 16F + 0.01F, 24 / 16F - percentageFull * 9.999F / 16F, 1 / 16F + 0.01F, -1 / 16F - 0.01F, 24 / 16F - 0.01F, 8 / 16F - 0.01F);
            RenderUtils.INSTANCE.renderLiquid(info, renderInfo, processor.getWorldObj());
        }
        info = processor.getTankInfo(null)[1];
        if (info.fluid != null && info.fluid.amount > 10) {
            float percentageFull = (float) info.fluid.amount / info.capacity;
            RenderInfo renderInfo = new RenderInfo(1 / 16F + 0.01F, 24 / 16F - percentageFull * 9.999F / 16F, 1 / 16F + 0.01F, 8 / 16F - 0.01F, 24 / 16F - 0.01F, 8 / 16F - 0.01F);
            RenderUtils.INSTANCE.renderLiquid(info, renderInfo, processor.getWorldObj());
        }
    }
}
Also used : FluidTankInfo(net.minecraftforge.fluids.FluidTankInfo) TileEntityThermopneumaticProcessingPlant(pneumaticCraft.common.tileentity.TileEntityThermopneumaticProcessingPlant) RenderInfo(pneumaticCraft.client.util.RenderUtils.RenderInfo)

Example 4 with RenderInfo

use of pneumaticCraft.client.util.RenderUtils.RenderInfo 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);
        }
    }
}
Also used : FluidTankInfo(net.minecraftforge.fluids.FluidTankInfo) TileEntityLiquidHopper(pneumaticCraft.common.tileentity.TileEntityLiquidHopper) RenderInfo(pneumaticCraft.client.util.RenderUtils.RenderInfo)

Example 5 with RenderInfo

use of pneumaticCraft.client.util.RenderUtils.RenderInfo 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);
        }
    }
}
Also used : FluidTankInfo(net.minecraftforge.fluids.FluidTankInfo) TileEntityLiquidHopper(pneumaticCraft.common.tileentity.TileEntityLiquidHopper) RenderInfo(pneumaticCraft.client.util.RenderUtils.RenderInfo)

Aggregations

FluidTankInfo (net.minecraftforge.fluids.FluidTankInfo)6 RenderInfo (pneumaticCraft.client.util.RenderUtils.RenderInfo)6 TileEntityLiquidHopper (pneumaticCraft.common.tileentity.TileEntityLiquidHopper)2 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)1 TileEntityKeroseneLamp (pneumaticCraft.common.tileentity.TileEntityKeroseneLamp)1 TileEntityPlasticMixer (pneumaticCraft.common.tileentity.TileEntityPlasticMixer)1 TileEntityRefinery (pneumaticCraft.common.tileentity.TileEntityRefinery)1 TileEntityThermopneumaticProcessingPlant (pneumaticCraft.common.tileentity.TileEntityThermopneumaticProcessingPlant)1