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;
}
}
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;
}
Aggregations