diff --git a/common/src/main/java/net/creeperhost/polylib/inventory/fluid/FluidManager.java b/common/src/main/java/net/creeperhost/polylib/inventory/fluid/FluidManager.java index e8ff7571..028c95eb 100644 --- a/common/src/main/java/net/creeperhost/polylib/inventory/fluid/FluidManager.java +++ b/common/src/main/java/net/creeperhost/polylib/inventory/fluid/FluidManager.java @@ -67,6 +67,14 @@ default long convert(long milliBuckets) { //###### Fluid Utilities ###### + //TODO, work around for bug in architectury + static FluidStack copyWithAmount(FluidStack stack, long amount) { + if (stack.isEmpty()) return FluidStack.empty(); + stack = stack.copy(); + stack.setAmount(amount); + return stack; + } + //=== Get Handler === static PolyFluidHandler getHandler(BlockEntity tile, @Nullable Direction side) { diff --git a/common/src/main/java/net/creeperhost/polylib/inventory/fluid/PolyTank.java b/common/src/main/java/net/creeperhost/polylib/inventory/fluid/PolyTank.java index db003777..30c64b5b 100644 --- a/common/src/main/java/net/creeperhost/polylib/inventory/fluid/PolyTank.java +++ b/common/src/main/java/net/creeperhost/polylib/inventory/fluid/PolyTank.java @@ -103,7 +103,7 @@ public long fill(FluidStack resource, boolean simulate) { return Math.min(capacity - fluid.getAmount(), resource.getAmount()); } if (fluid.isEmpty()) { - fluid = FluidStack.create(resource, Math.min(capacity, resource.getAmount())); + fluid = FluidManager.copyWithAmount(resource, Math.min(capacity, resource.getAmount())); markDirty(); return fluid.getAmount(); } @@ -129,7 +129,7 @@ public long fill(FluidStack resource, boolean simulate) { if (fluid.getAmount() < drained) { drained = fluid.getAmount(); } - FluidStack stack = FluidStack.create(fluid, drained); + FluidStack stack = FluidManager.copyWithAmount(fluid, drained); if (!simulate && drained > 0) { fluid.shrink(drained); markDirty();