Search in sources :

Example 1 with TileEntityWoodenBarrel

use of blusunrize.immersiveengineering.common.blocks.wooden.TileEntityWoodenBarrel in project ImmersiveEngineering by BluSunrize.

the class IEWailaDataProvider method getWailaBody.

@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
    Block b = accessor.getBlock();
    TileEntity tile = accessor.getTileEntity();
    if (b instanceof BlockIECrop) {
        int meta = accessor.getMetadata();
        int min = ((BlockIECrop) b).getMinMeta(meta);
        int max = ((BlockIECrop) b).getMaxMeta(meta);
        if (min == max)
            currenttip.add(String.format("%s : %s", I18n.format("hud.msg.growth"), I18n.format("hud.msg.mature")));
        else {
            float growth = ((meta - min) / (float) (max - min)) * 100f;
            if (growth < 100.0)
                currenttip.add(String.format("%s : %.0f %%", I18n.format("hud.msg.growth"), growth));
            else
                currenttip.add(String.format("%s : %s", I18n.format("hud.msg.growth"), I18n.format("hud.msg.mature")));
        }
        return currenttip;
    } else if (tile instanceof TileEntityWoodenBarrel) {
        NBTTagCompound tank = accessor.getNBTData().getCompoundTag("tank");
        if (!tank.hasKey("Empty") && !tank.hasNoTags()) {
            FluidStack fluid = FluidStack.loadFluidStackFromNBT(tank);
            currenttip.add(String.format("%s: %d / %d mB", fluid.getLocalizedName(), Integer.valueOf(fluid.amount), 12000));
        } else
            currenttip.add(I18n.format("hud.msg.empty"));
    }
    if (accessor.getNBTData().hasKey("Energy")) {
        int cur = accessor.getNBTInteger(accessor.getNBTData(), "Energy");
        int max = accessor.getNBTInteger(accessor.getNBTData(), "MaxStorage");
        if (max > 0 && ((ITaggedList) currenttip).getEntries("IFEnergyStorage").size() == 0)
            ((ITaggedList) currenttip).add(String.format("%d / %d IF", new Object[] { cur, max }), "IFEnergyStorage");
        if (tile instanceof TileEntityTeslaCoil) {
            boolean rsInv = accessor.getNBTData().getBoolean("redstoneInverted");
            boolean lowPower = accessor.getNBTData().getBoolean("lowPower");
            currenttip.add(I18n.format(Lib.CHAT_INFO + "rsControl." + (rsInv ? "invertedOn" : "invertedOff")));
            currenttip.add(I18n.format(Lib.CHAT_INFO + "tesla." + (lowPower ? "lowPower" : "highPower")));
        }
    }
    return currenttip;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityWoodenBarrel(blusunrize.immersiveengineering.common.blocks.wooden.TileEntityWoodenBarrel) BlockIECrop(blusunrize.immersiveengineering.common.blocks.plant.BlockIECrop) TileEntityTeslaCoil(blusunrize.immersiveengineering.common.blocks.metal.TileEntityTeslaCoil) FluidStack(net.minecraftforge.fluids.FluidStack) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Block(net.minecraft.block.Block)

Aggregations

TileEntityTeslaCoil (blusunrize.immersiveengineering.common.blocks.metal.TileEntityTeslaCoil)1 BlockIECrop (blusunrize.immersiveengineering.common.blocks.plant.BlockIECrop)1 TileEntityWoodenBarrel (blusunrize.immersiveengineering.common.blocks.wooden.TileEntityWoodenBarrel)1 Block (net.minecraft.block.Block)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 TileEntity (net.minecraft.tileentity.TileEntity)1 FluidStack (net.minecraftforge.fluids.FluidStack)1