Skip to content

Commit ae48dec

Browse files
committed
Take lower tank's contents into account when attempting to fill stacked tanks (#8157)
1 parent 73519d3 commit ae48dec

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/main/java/mekanism/common/capabilities/chemical/StackedWasteBarrel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ protected StackedWasteBarrel(TileEntityRadioactiveWasteBarrel tile, @Nullable IC
5151
@Override
5252
public GasStack insert(GasStack stack, Action action, AutomationType automationType) {
5353
GasStack remainder = super.insert(stack, action, automationType);
54-
if (!remainder.isEmpty()) {
54+
//Ensure we have the same type of gas stored as we failed to insert, in which case we want to try to insert to the one above
55+
if (!remainder.isEmpty() && GasStack.isSameChemical(stored, remainder)) {
5556
//If we have any leftover check if we can send it to the tank that is above
5657
TileEntityRadioactiveWasteBarrel tileAbove = WorldUtils.getTileEntity(TileEntityRadioactiveWasteBarrel.class, tile.getLevel(), tile.getBlockPos().above());
5758
if (tileAbove != null) {

src/main/java/mekanism/common/capabilities/fluid/FluidTankFluidTank.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ public FluidStack insert(FluidStack stack, Action action, AutomationType automat
5757
} else {
5858
remainder = super.insert(stack, action.combine(!isCreative), automationType);
5959
}
60-
if (!remainder.isEmpty()) {
60+
//Ensure we have the same type of fluid stored as we failed to insert, in which case we want to try to insert to the one above
61+
if (!remainder.isEmpty() && FluidStack.isSameFluidSameComponents(stored, remainder)) {
6162
//If we have any leftover check if we can send it to the tank that is above
6263
TileEntityFluidTank tileAbove = WorldUtils.getTileEntity(TileEntityFluidTank.class, this.tile.getLevel(), this.tile.getBlockPos().above());
6364
if (tileAbove != null) {

0 commit comments

Comments
 (0)