Avoid copying empty NBT when draining bottles

When filling a barrel from a bottle, ensured that empty NBT tags (ex: "{}") are replaced with null values and not transferred to the fluid unnecessarily. This ensures that water bottles placed in a barrel properly merge with the current contents of the barrel instead of not matching because {} != null.
This commit is contained in:
Jeremy 2026-01-08 13:59:23 -05:00
parent 3d14eeaf89
commit 8ce323d70c

View File

@ -249,6 +249,7 @@ public class BarrelBlockEntity extends ETankBlockEntity {
// Transfer any extra NBT tags from other mods to the fluid
var nbt = playerItem.getTag().copy();
nbt.remove("Potion");
if (nbt.isEmpty()) nbt = null;
fluid = new FluidStack(Fluids.WATER, 250, nbt);
if (this.tank.fill(fluid, IFluidHandler.FluidAction.SIMULATE) > 0) {