Search in sources :

Example 1 with ITankData

use of com.enderio.core.api.common.util.ITankAccess.ITankData in project EnderIO by SleepyTrousers.

the class TOPCompatibility method mkTankLines.

private void mkTankLines(ProbeMode mode, EioBox eiobox, TOPData data) {
    if (data.tankData != null && !data.tankData.isEmpty()) {
        if (mode != ProbeMode.NORMAL || TopConfig.showTanksByDefault.get()) {
            for (ITankData tank : data.tankData) {
                SmartTank smartTank = new SmartTank(1000);
                String content1;
                String content2;
                final FluidStack fluid = tank.getContent();
                if (fluid != null) {
                    FluidStack fluid2 = fluid.copy();
                    fluid2.amount = fluid.amount * 1000 / tank.getCapacity();
                    smartTank.setFluid(fluid2);
                    content1 = NullHelper.first(fluid.getLocalizedName(), "(???)");
                    // TODO lang-format those numbers
                    content2 = loc("top.tank.content", "" + fluid.amount, "" + tank.getCapacity());
                } else {
                    content1 = loc("top.tank.content.empty");
                    // TODO lang-format those numbers
                    content2 = loc("top.tank.content", "0", "" + tank.getCapacity());
                }
                switch(tank.getTankType()) {
                    case INPUT:
                        content1 = loc("top.tank.header.input", content1);
                        break;
                    case OUTPUT:
                        content1 = loc("top.tank.header.output", content1);
                        break;
                    case STORAGE:
                        content1 = loc("top.tank.header.storage", content1);
                        break;
                }
                // sic!
                ItemStack stack = new ItemStack(ModObject.blockFusedQuartz.getBlockNN());
                ItemTankHelper.setTank(stack, smartTank);
                NbtValue.FAKE.setBoolean(stack, true);
                eiobox.get().horizontal(eiobox.center()).item(stack).vertical(eiobox.getProbeinfo().defaultLayoutStyle().spacing(-1)).text(content1).text(content2);
            }
        } else {
            eiobox.addMore();
        }
    }
}
Also used : ITankData(com.enderio.core.api.common.util.ITankAccess.ITankData) FluidStack(net.minecraftforge.fluids.FluidStack) SmartTank(com.enderio.core.common.fluid.SmartTank) ItemStack(net.minecraft.item.ItemStack)

Aggregations

ITankData (com.enderio.core.api.common.util.ITankAccess.ITankData)1 SmartTank (com.enderio.core.common.fluid.SmartTank)1 ItemStack (net.minecraft.item.ItemStack)1 FluidStack (net.minecraftforge.fluids.FluidStack)1