Skip to content

Commit

Permalink
Fix fluid containers with null empty items not deleting in fluid term…
Browse files Browse the repository at this point in the history
…inal
  • Loading branch information
serenibyss committed Feb 22, 2025
1 parent e88af75 commit 9e080b1
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,15 @@ private void insertFluid(EntityPlayer player, int slotIndex, boolean shift) {

if (targetStack.getItem() instanceof IFluidContainerItem fcItem) {
if (emptiedTanks > 0) {
emptiedTanksStack = targetStack.copy();
emptiedTanksStack.stackSize = 1;
fcItem.drain(emptiedTanksStack, fluidPerContainer, true);
emptiedTanksStack.stackSize = emptiedTanks;
final ItemStack testDrainStack = targetStack.copy();
testDrainStack.stackSize = 1;
fcItem.drain(testDrainStack, fluidPerContainer, true);
if (testDrainStack.stackSize == 0) {
emptiedTanksStack = null;
} else {
emptiedTanksStack = targetStack.copy();
emptiedTanksStack.stackSize = emptiedTanks;
}
} else {
emptiedTanksStack = null;
}
Expand Down Expand Up @@ -391,7 +396,11 @@ private void insertFluid(EntityPlayer player, int slotIndex, boolean shift) {
player.inventory.setInventorySlotContents(slotIndex, partialTanksStack);
} else {
player.inventory.setItemStack(null);
shouldSendStack = false;
if (shift) {
player.inventory.setInventorySlotContents(slotIndex, null);
} else {
shouldSendStack = false;
}
}
}
if (shouldSendStack) {
Expand Down

0 comments on commit 9e080b1

Please sign in to comment.