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

fix: FluidStackImpl#getRawFluidSupplier crashing on forge/neoforge #483

Closed desht closed 3 months ago

desht commented 3 months ago

Wrap the Holder.Reference returned from Registry#getHolderOrThrow in an actual Supplier

Holder.Reference does not implement Supplier so attempting to create a fluidstack currently crashes:

Caused by: java.lang.IncompatibleClassChangeError: Class net.minecraft.core.Holder$Reference does not implement the requested interface java.util.function.Supplier
    at dev.architectury.fluid.forge.FluidStackImpl.create(FluidStackImpl.java:52) ~[architectury-neoforge-11.1.13.jar%23177!/:?] {re:classloading}
    at dev.architectury.fluid.forge.FluidStackImpl.create(FluidStackImpl.java:33) ~[architectury-neoforge-11.1.13.jar%23177!/:?] {re:classloading}
    at dev.architectury.fluid.FluidStack.<init>(FluidStack.java:44) ~[architectury-neoforge-11.1.13.jar%23177!/:?] {re:classloading}
    at dev.architectury.fluid.FluidStack.copyWithAmount(FluidStack.java:245) ~[architectury-neoforge-11.1.13.jar%23177!/:?] {re:classloading}
    at
...
MaxNeedsSnacks commented 3 months ago

Ah, I think Neo changed that within the 1.20.4 breaking changes window; thanks for the fix!