QuiltMC / quilt-standard-libraries

A set of libraries to assist in making Quilt mods.
Apache License 2.0
152 stars 85 forks source link

Fix NPE when non-BlockEntity calls `AbstractFurnaceBlockEntity#craftRecipe` #339

Closed Virtuoel closed 1 year ago

Virtuoel commented 1 year ago

If smelting is performed from a non-in-world "furnace" (e.g. portable furnace from PortableTables), the ThreadLocal used for remainder item overflow dropping may be null, or may correspond to the location of a different in-world furnace.

The getting of the BE from the ThreadLocal has been moved so it happens during the actual dropping of the items, to prevent accessing the ThreadLocal when items don't need dropping.

Since the position is not needed if there are no overflowing remainder items, the recipe output mixin will check if there is no BE performing the smelting and if there would be a remainder that cannot fit, and in that situation, prevents the output from accepting more items.

Draft because not sure if the additional API method is desirable or not.

EnnuiL commented 1 year ago

This PR has entered a Final Comment Period of 5 days on August 31st, with 3 days remaining now