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 (#267)
  • Loading branch information
serenibyss authored Feb 28, 2025
1 parent 8b61980 commit 23e80c7
Showing 1 changed file with 10 additions and 6 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 = testDrainStack.copy();
emptiedTanksStack.stackSize = emptiedTanks;
}
} else {
emptiedTanksStack = null;
}
Expand Down Expand Up @@ -390,8 +395,7 @@ private void insertFluid(EntityPlayer player, int slotIndex, boolean shift) {
} else if (partialTanksStack != null) {
player.inventory.setInventorySlotContents(slotIndex, partialTanksStack);
} else {
player.inventory.setItemStack(null);
shouldSendStack = false;
player.inventory.setInventorySlotContents(slotIndex, null);
}
}
if (shouldSendStack) {
Expand Down

0 comments on commit 23e80c7

Please sign in to comment.