Search in sources :

Example 1 with TileEntityRefinery

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

the class GuiRefinery method initGui.

@Override
public void initGui() {
    super.initGui();
    addWidget(new WidgetTemperature(-1, guiLeft + 32, guiTop + 20, 273, 673, te.getHeatExchangerLogic(ForgeDirection.UNKNOWN), 373));
    addWidget(new WidgetTank(-1, guiLeft + 8, guiTop + 13, te.getOilTank()));
    int x = guiLeft + 95;
    int y = guiTop + 17;
    addWidget(new WidgetTank(-1, x, y, te.getOutputTank()));
    refineries = new ArrayList<TileEntityRefinery>();
    refineries.add(te);
    TileEntityRefinery refinery = te;
    while (refinery.getTileCache()[ForgeDirection.UP.ordinal()].getTileEntity() instanceof TileEntityRefinery) {
        refinery = (TileEntityRefinery) refinery.getTileCache()[ForgeDirection.UP.ordinal()].getTileEntity();
        x += 20;
        y -= 4;
        if (refineries.size() < 4)
            addWidget(new WidgetTank(-1, x, y, refinery.getOutputTank()));
        refineries.add(refinery);
    }
    if (refineries.size() < 2 || refineries.size() > 4) {
        problemTab.openWindow();
    }
}
Also used : TileEntityRefinery(pneumaticCraft.common.tileentity.TileEntityRefinery) WidgetTemperature(pneumaticCraft.client.gui.widget.WidgetTemperature) WidgetTank(pneumaticCraft.client.gui.widget.WidgetTank) Point(java.awt.Point)

Example 2 with TileEntityRefinery

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

the class BlockRefinery method onBlockActivated.

@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
    TileEntityRefinery refinery = (TileEntityRefinery) world.getTileEntity(x, y, z);
    refinery = refinery.getMasterRefinery();
    return super.onBlockActivated(world, x, refinery.yCoord, z, player, par6, par7, par8, par9);
}
Also used : TileEntityRefinery(pneumaticCraft.common.tileentity.TileEntityRefinery)

Example 3 with TileEntityRefinery

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

the class ModelRefinery method renderStatic.

@Override
public void renderStatic(float size, TileEntity te) {
    outputTank.render(size);
    inputTank.render(size);
    machineLeft.render(size);
    machineRight.render(size);
    machineMiddle.render(size);
    if (te != null) {
        TileEntityRefinery refinery = (TileEntityRefinery) te;
        FluidTankInfo info = new FluidTankInfo(refinery.getOilTank());
        if (info.fluid != null && info.fluid.amount > 10) {
            float percentageFull = (float) info.fluid.amount / info.capacity;
            RenderInfo renderInfo = new RenderInfo(-4 / 16F + 0.01F, 22 / 16F - percentageFull * 13.999F / 16F, 3 / 16F + 0.01F, 4 / 16F - 0.01F, 22 / 16F, 8 / 16F - 0.01F);
            RenderUtils.INSTANCE.renderLiquid(info, renderInfo, refinery.getWorldObj());
        }
        info = refinery.getTankInfo(null)[1];
        if (info.fluid != null && info.fluid.amount > 10) {
            float percentageFull = (float) info.fluid.amount / info.capacity;
            RenderInfo renderInfo = new RenderInfo(-4 / 16F + 0.01F, 24 / 16F - percentageFull * 15.999F / 16F, -8 / 16F + 0.01F, 4 / 16F - 0.01F, 24 / 16F, -3 / 16F - 0.01F);
            RenderUtils.INSTANCE.renderLiquid(info, renderInfo, refinery.getWorldObj());
        }
    }
}
Also used : TileEntityRefinery(pneumaticCraft.common.tileentity.TileEntityRefinery) FluidTankInfo(net.minecraftforge.fluids.FluidTankInfo) RenderInfo(pneumaticCraft.client.util.RenderUtils.RenderInfo)

Aggregations

TileEntityRefinery (pneumaticCraft.common.tileentity.TileEntityRefinery)3 Point (java.awt.Point)1 FluidTankInfo (net.minecraftforge.fluids.FluidTankInfo)1 WidgetTank (pneumaticCraft.client.gui.widget.WidgetTank)1 WidgetTemperature (pneumaticCraft.client.gui.widget.WidgetTemperature)1 RenderInfo (pneumaticCraft.client.util.RenderUtils.RenderInfo)1