Spout won't fill Buckets
fabien-gigante opened this issue ยท 17 comments
Describe the Bug
A spout will not fill empty buckets placed on either a depot or conveyor belt. Same behavior with all fluids.
(Empty bottles are correctly filled however.)
Reproduction Steps
- Place a spout over a depot (or over an running conveyor belt)
- Fill the spout with water (or any other appropriate liquid that a bucket can take)
- Place empty buckets on the depot (or the belt)
- Output buckets are empty
Expected Result
Output buckets should be filled with water (or any other appropriate liquid).
Screenshots and Videos
Crash Report or Log
crash-2024-02-18_15.16.11-client.txt
Operating System
Windows 10
Mod Version
0.5.1f
Minecraft Version
1.20.1
Other Mods
Removed all other mods. Same issue.
Additional Context
Using build create-fabric-0.5.1-f-build.1242+mc1.20.1.jar
Crash report attached :
crash-2024-02-18_15.16.11-client.txt
please downgrade fabric api to 0.88.1
They are using the 0.5.1f builds so they dont need to do that.
I tried anyway (forcing build.1242 to take fabric api to 0.88.1 by altering its json file). But still the same problem.
Interestingly, the recipe "empty bucket -> water bucket" doesn't show up in JEI.
I also noticed (don't know if related, but it might), that item drains are outputing buckets that are still full.
I managed to temporarilly hack my way :
public class GenericItemFilling {
public static ItemStack fillItem(Level world, long requiredAmount, ItemStack stack, FluidStack availableFluid) {
FluidStack toFill = availableFluid.copy();
Fluid fluid = toFill.getFluid();
...
t.commit();
stack.shrink(1);
ItemVariant itemVariant = ctx.getItemVariant();
ItemStack container;
if (itemVariant.getItem() == Items.BUCKET) {
if (FluidHelper.isWater(fluid)) container = new ItemStack(Items.WATER_BUCKET);
else if (FluidHelper.isLava(fluid)) container = new ItemStack(Items.LAVA_BUCKET);
else if (fluid == Milk.STILL_MILK) container = new ItemStack(Items.MILK_BUCKET);
}
else container = itemVariant.toStack((int)ctx.getAmount());
return container;
...
Not a good solution , I know. But I didn't understand what the root cause was.
I managed to temporarilly hack my way :
public class GenericItemFilling { public static ItemStack fillItem(Level world, long requiredAmount, ItemStack stack, FluidStack availableFluid) { FluidStack toFill = availableFluid.copy(); Fluid fluid = toFill.getFluid(); ... t.commit(); stack.shrink(1); ItemVariant itemVariant = ctx.getItemVariant(); ItemStack container; if (itemVariant.getItem() == Items.BUCKET) { if (FluidHelper.isWater(fluid)) container = new ItemStack(Items.WATER_BUCKET); else if (FluidHelper.isLava(fluid)) container = new ItemStack(Items.LAVA_BUCKET); else if (fluid == Milk.STILL_MILK) container = new ItemStack(Items.MILK_BUCKET); } else container = itemVariant.toStack((int)ctx.getAmount()); return container; ...Not a good solution , I know. But I didn't understand what the root cause was.
Yeah the issue is ctx.getItemVariant returns a empty bucket, need to somehow apply the filled tank to it and grab the filled bucket
Isn't the exchange in the context supposed to happen here ? Do you know why it's not happening ?
public final class EmptyItemFluidStorage implements InsertionOnlyStorage<FluidVariant> {
public long insert(FluidVariant resource, long maxAmount, TransactionContext transaction) {
...
ItemVariant newVariant = emptyToFullMapping.apply(context.getItemVariant());
if (context.exchange(newVariant, 1, transaction) == 1) {
Thanks, very clear. The latest version of porting_lib defines a MutableContainerItemContext
that would be quite useful here. Not available on 1.20.1 though.
Just confirmed that replacing
ContainerItemContext ctx = ContainerItemContext.withConstant(split);`
by
ContainerItemContext ctx = new MutableContainerItemContext(split);
works like a charm indeed !
Need to find a way to properly bring this to 1.20.1, I guess...
Just confirmed that replacing
ContainerItemContext ctx = ContainerItemContext.withConstant(split);`by
ContainerItemContext ctx = new MutableContainerItemContext(split);works like a charm indeed !
Need to find a way to properly bring this to 1.20.1, I guess...
im working on porting it to 1.19.2 & 1.20.1 already
Impressive reponsiveness !
Do you need a distinct issue to fix "Drain won't empty Buckets" ?
Same root cause, same fix, but in GenericItemEmptying
this time, I think.
Impressive reponsiveness !
Do you need a distinct issue to fix "Drain won't empty Buckets" ? Same root cause, same fix, but in
GenericItemEmptying
this time, I think.
nah its fine ill fix that aswell
To fix JEI, the same modification should be made to SpoutCategory.consumeRecipes
and ItemDrainCategory.consumeRecipes
.
(In each method, the first context creation used for test can stay constant, but the second one needs to be mutable.)
Are you including those as well, while you're at it ? Or do you prefer a distinct issue to log and fix the JEI problem separately ?
To fix JEI, the same modification should be made to
SpoutCategory.consumeRecipes
andItemDrainCategory.consumeRecipes
. (In each method, the first context creation used for test can stay constant, but the second one needs to be mutable.)Are you including those as well, while you're at it ? Or do you prefer a distinct issue to log and fix the JEI problem separately ?
Fixed that aswell