craft all: properly invoke on_crafted callbacks #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
a player reported that crafting coconut milk from moretrees using the "craft all" button resulted in the axe in the recipe being lost, instead of being worn down.
this is because the "wearing" of the tool is handled via a
minetest.register_on_craft
callback, and uip doesn't invoke those callbacks. the correct behavior, it seems, is to invokecore.on_craft
, which isn't documented, but which is how the engine invokes those callbacks.an upside of using this handler is that we no longer have to explicitly call the stamina/skyblock
on_craft
code, and we're probably now compatible w/ a number of other mods as well.while i was updating the code, i also switched from using a detached inventory to a
FakeInventory
from my futil mod. this is because every modification of a detached inventory is sent to the player, even if the inventory is destroyed before the player can interact w/ it. basically, it cuts down on the number of packets sent to a player, which can be noticeable when working w/ very large stacks.