-
Notifications
You must be signed in to change notification settings - Fork 5
Fix: 修复历史遗留问题 #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix: 修复历史遗留问题 #14
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -27,11 +27,15 @@ public MachineRecipeType(String key, ItemStack item) { | |||||||||
| public void register(ItemStack[] recipe, ItemStack result) { | ||||||||||
| callbacks.forEach(c -> c.accept(recipe, result)); | ||||||||||
| recipes.put(recipe, result); | ||||||||||
| super.register(recipe, result); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| public void sendRecipesTo(BiConsumer<ItemStack[], ItemStack> callback) { | ||||||||||
| recipes.forEach(callback); | ||||||||||
| callbacks.add(callback); | ||||||||||
| } | ||||||||||
|
|
||||||||||
|
ybw0014 marked this conversation as resolved.
|
||||||||||
| public void unregister(ItemStack[] recipe, ItemStack result) { | ||||||||||
| recipes.remove(recipe, result); | ||||||||||
|
||||||||||
| recipes.remove(recipe, result); | |
| recipes.remove(recipe, result); | |
| callbacks.forEach(c -> c.accept(recipe, result)); | |
| super.unregister(recipe, result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
旧api没有unregister
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The success message is now sent before the actual crafting operations (
menu.pushItem()andrecipe.consume()) complete. While this may not cause functional issues due to the priormenu.fits()check, it's semantically incorrect to notify the player of success before the operation is fully completed. Consider keeping the message afterrecipe.consume(input)to ensure it's sent only after all crafting operations have successfully completed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
显然这一定会complete 而且pushItem会修改output导致最终输出的内容不正确