From 39e245b488dc341c1f51624e2185eab04e241e2b Mon Sep 17 00:00:00 2001 From: Firenoo <49818773+firenoo@users.noreply.github.com> Date: Sun, 30 Apr 2023 08:02:06 -0700 Subject: [PATCH] Fix FluidContainerRegistry interactions w/ Certus Quart Tank 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;