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:
parent
3d14eeaf89
commit
8ce323d70c
|
|
@ -249,6 +249,7 @@ public class BarrelBlockEntity extends ETankBlockEntity {
|
||||||
// Transfer any extra NBT tags from other mods to the fluid
|
// Transfer any extra NBT tags from other mods to the fluid
|
||||||
var nbt = playerItem.getTag().copy();
|
var nbt = playerItem.getTag().copy();
|
||||||
nbt.remove("Potion");
|
nbt.remove("Potion");
|
||||||
|
if (nbt.isEmpty()) nbt = null;
|
||||||
fluid = new FluidStack(Fluids.WATER, 250, nbt);
|
fluid = new FluidStack(Fluids.WATER, 250, nbt);
|
||||||
|
|
||||||
if (this.tank.fill(fluid, IFluidHandler.FluidAction.SIMULATE) > 0) {
|
if (this.tank.fill(fluid, IFluidHandler.FluidAction.SIMULATE) > 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user