architectury / architectury-api

An intermediary api aimed at easing development of multiplatform mods.
https://discord.architectury.dev/
GNU Lesser General Public License v3.0
306 stars 55 forks source link

1.20.6 FluidStack.empty() returns null (and FluidStack.EMPTY is null) #500

Closed desht closed 3 weeks ago

desht commented 2 months ago

The static init for FluidStack.EMPTY appears to be incorrect:

private static final FluidStack EMPTY = create(Fluids.EMPTY, 0);

Following the create() method call chain leads to this method:

public static FluidStack create(Fluid fluid, long amount, DataComponentPatch patch) {
    if (fluid == Fluids.EMPTY || amount <= 0) return empty();
    return create(() -> fluid, amount, patch);
}

Since the amount is 0, empty() is called, which returns EMPTY, which at this point is still null.