From c29f8cf8468c5fdaa8a2ce3ae6614295039f9c93 Mon Sep 17 00:00:00 2001 From: firenoo <49818773+firenoo@users.noreply.github.com> Date: Mon, 1 May 2023 10:37:53 -0700 Subject: [PATCH] Fix FluidContainerRegistry interactions w/ Certus Quart Tank (#122) The Certus Quartz Tank previously did not consider the FluidContainerRegistry API for fluid containers, so fluid containers that implemented that (like ic2 cells) were voided when filling the tank. Signed-off-by: Firenoo <49818773+firenoo@users.noreply.github.com> --- .../github/common/block/BlockCertusQuartzTank.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/glodblock/github/common/block/BlockCertusQuartzTank.java b/src/main/java/com/glodblock/github/common/block/BlockCertusQuartzTank.java index 89ff8c3a..65f5ab27 100644 --- a/src/main/java/com/glodblock/github/common/block/BlockCertusQuartzTank.java +++ b/src/main/java/com/glodblock/github/common/block/BlockCertusQuartzTank.java @@ -131,12 +131,19 @@ public class BlockCertusQuartzTank extends BaseBlockContainer implements IRegist if (liquid != null) { int amountFilled = tank.fill(ForgeDirection.UNKNOWN, liquid, true); if (amountFilled != 0 && !entityplayer.capabilities.isCreativeMode && current.getItem() != null) { + ItemStack empty; + if (FluidContainerRegistry.isContainer(current)) { + empty = FluidContainerRegistry.drainFluidContainer(current); + } else { + // Try this as a fallback. + entityplayer.inventory.addItemStackToInventory(current.getItem().getContainerItem(current)); + empty = current.getItem().getContainerItem(current); + } if (current.stackSize > 1) { entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem].stackSize -= 1; - entityplayer.inventory.addItemStackToInventory(current.getItem().getContainerItem(current)); + entityplayer.inventory.addItemStackToInventory(empty); } else { - entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = current.getItem() - .getContainerItem(current); + entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = empty; } } return true;