Search in sources :

Example 1 with BoxedChemical

use of mekanism.api.chemical.merged.BoxedChemical in project Mekanism by mekanism.

the class BoxedChemicalNetwork method onContentsChanged.

@Override
public void onContentsChanged() {
    markDirty();
    Current current = chemicalTank.getCurrent();
    BoxedChemical type = current == Current.EMPTY ? BoxedChemical.EMPTY : BoxedChemical.box(chemicalTank.getTankFromCurrent(current).getType());
    if (!lastChemical.equals(type)) {
        // If the chemical type does not match update it, and mark that we need an update
        if (!type.isEmpty()) {
            lastChemical = type;
        }
        needsUpdate = true;
    }
}
Also used : BoxedChemical(mekanism.api.chemical.merged.BoxedChemical) Current(mekanism.api.chemical.merged.MergedChemicalTank.Current)

Example 2 with BoxedChemical

use of mekanism.api.chemical.merged.BoxedChemical in project Mekanism by mekanism.

the class BoxedPressurizedTube method isValidTransmitter.

@Override
public boolean isValidTransmitter(TileEntityTransmitter transmitter, Direction side) {
    if (super.isValidTransmitter(transmitter, side) && transmitter.getTransmitter() instanceof BoxedPressurizedTube) {
        BoxedPressurizedTube other = (BoxedPressurizedTube) transmitter.getTransmitter();
        BoxedChemical buffer = getBufferWithFallback().getType();
        if (buffer.isEmpty() && hasTransmitterNetwork() && getTransmitterNetwork().getPrevTransferAmount() > 0) {
            buffer = getTransmitterNetwork().lastChemical;
        }
        BoxedChemical otherBuffer = other.getBufferWithFallback().getType();
        if (otherBuffer.isEmpty() && other.hasTransmitterNetwork() && other.getTransmitterNetwork().getPrevTransferAmount() > 0) {
            otherBuffer = other.getTransmitterNetwork().lastChemical;
        }
        return buffer.isEmpty() || otherBuffer.isEmpty() || buffer.equals(otherBuffer);
    }
    return false;
}
Also used : BoxedChemical(mekanism.api.chemical.merged.BoxedChemical)

Aggregations

BoxedChemical (mekanism.api.chemical.merged.BoxedChemical)2 Current (mekanism.api.chemical.merged.MergedChemicalTank.Current)1