Search in sources :

Example 11 with Current

use of mekanism.api.chemical.merged.MergedChemicalTank.Current in project Mekanism by mekanism.

the class BoxedPressurizedTube method releaseShare.

@Nonnull
@Override
public BoxedChemicalStack releaseShare() {
    BoxedChemicalStack ret;
    Current current = chemicalTank.getCurrent();
    if (current == Current.EMPTY) {
        ret = BoxedChemicalStack.EMPTY;
    } else {
        IChemicalTank<?, ?> tank = chemicalTank.getTankFromCurrent(current);
        ret = BoxedChemicalStack.box(tank.getStack());
        tank.setEmpty();
    }
    return ret;
}
Also used : Current(mekanism.api.chemical.merged.MergedChemicalTank.Current) BoxedChemicalStack(mekanism.api.chemical.merged.BoxedChemicalStack) Nonnull(javax.annotation.Nonnull)

Example 12 with Current

use of mekanism.api.chemical.merged.MergedChemicalTank.Current in project Mekanism by mekanism.

the class GuiChemicalTank method addGuiElements.

@Override
protected void addGuiElements() {
    // Add the side holder before the slots, as it holds a couple of the slots
    addButton(GuiSideHolder.armorHolder(this));
    super.addGuiElements();
    addButton(new GuiMergedChemicalBar<>(this, tile, tile.getChemicalTank(), 42, 16, 116, 10, true));
    addButton(new GuiInnerScreen(this, 42, 37, 118, 28, () -> {
        List<ITextComponent> ret = new ArrayList<>();
        Current current = tile.getChemicalTank().getCurrent();
        if (current == Current.EMPTY) {
            ret.add(MekanismLang.CHEMICAL.translate(MekanismLang.NONE));
            ret.add(MekanismLang.GENERIC_FRACTION.translate(0, tile.getTier() == ChemicalTankTier.CREATIVE ? MekanismLang.INFINITE : TextUtils.format(tile.getTier().getStorage())));
        } else if (current == Current.GAS) {
            addStored(ret, tile.getChemicalTank().getGasTank(), MekanismLang.GAS);
        } else if (current == Current.INFUSION) {
            addStored(ret, tile.getChemicalTank().getInfusionTank(), MekanismLang.INFUSE_TYPE);
        } else if (current == Current.PIGMENT) {
            addStored(ret, tile.getChemicalTank().getPigmentTank(), MekanismLang.PIGMENT);
        } else if (current == Current.SLURRY) {
            addStored(ret, tile.getChemicalTank().getSlurryTank(), MekanismLang.SLURRY);
        } else {
            throw new IllegalStateException("Unknown current type");
        }
        return ret;
    }));
    addButton(new GuiGasMode(this, 159, 72, true, () -> tile.dumping, tile.getBlockPos(), 0));
}
Also used : GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) ArrayList(java.util.ArrayList) List(java.util.List) GuiGasMode(mekanism.client.gui.element.button.GuiGasMode) Current(mekanism.api.chemical.merged.MergedChemicalTank.Current)

Aggregations

Current (mekanism.api.chemical.merged.MergedChemicalTank.Current)12 Nonnull (javax.annotation.Nonnull)2 BoxedChemicalStack (mekanism.api.chemical.merged.BoxedChemicalStack)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Objects (java.util.Objects)1 BiPredicate (java.util.function.BiPredicate)1 Predicate (java.util.function.Predicate)1 Nullable (javax.annotation.Nullable)1 IContentsListener (mekanism.api.IContentsListener)1 NonNull (mekanism.api.annotations.NonNull)1 IChemicalTank (mekanism.api.chemical.IChemicalTank)1 BoxedChemical (mekanism.api.chemical.merged.BoxedChemical)1 MergedChemicalTank (mekanism.api.chemical.merged.MergedChemicalTank)1 AutomationType (mekanism.api.inventory.AutomationType)1 GuiInnerScreen (mekanism.client.gui.element.GuiInnerScreen)1 GuiGasMode (mekanism.client.gui.element.button.GuiGasMode)1 Capabilities (mekanism.common.capabilities.Capabilities)1 CurrentType (mekanism.common.capabilities.merged.MergedTank.CurrentType)1 BoxedChemicalNetwork (mekanism.common.content.network.BoxedChemicalNetwork)1