From 3d14eeaf892cd2b2a26e4a6df28ecb36c10c60b8 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Thu, 8 Jan 2026 13:57:31 -0500 Subject: [PATCH] Fixed barrel bottle extraction not draining liquid Fixed an issue where taking filling a water bottle from a barrel would fill the bottle but not drain the barrel. This is due to mismatched NBT values when extracting. This change moves the drain operation before the NBT operations and only modifies the item NBT if fluid NBT is present. --- .../exdeorum/blockentity/BarrelBlockEntity.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/thedarkcolour/exdeorum/blockentity/BarrelBlockEntity.java b/src/main/java/thedarkcolour/exdeorum/blockentity/BarrelBlockEntity.java index 8c7c45b4..feb42eb8 100644 --- a/src/main/java/thedarkcolour/exdeorum/blockentity/BarrelBlockEntity.java +++ b/src/main/java/thedarkcolour/exdeorum/blockentity/BarrelBlockEntity.java @@ -335,13 +335,15 @@ public class BarrelBlockEntity extends ETankBlockEntity { if (!player.getAbilities().instabuild) { playerItem.shrink(1); } + tank.drain(fluid, IFluidHandler.FluidAction.EXECUTE); var bottle = PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.WATER); - var nbt = bottle.getOrCreateTag(); - nbt.merge(fluid.getOrCreateTag()); + if (fluid.hasTag()) { + var nbt = bottle.getOrCreateTag(); + nbt.merge(fluid.getTag()); + } if (!player.addItem(bottle)) { player.drop(bottle, false); } - tank.drain(fluid, IFluidHandler.FluidAction.EXECUTE); level.playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.BOTTLE_EMPTY, SoundSource.NEUTRAL, 1.0F, 1.0F); }