NeoForge icon indicating copy to clipboard operation
NeoForge copied to clipboard

Introduce `PlayerEvent.ItemSmithingEvent` alongside the cleanup of other 'crafting events'

Open Spinoscythe opened this issue 6 months ago • 4 comments

  • Adds ItemSmithingEvent updated to 1.21.7. Supersedes #1693. Closes #1569
  • Make all crafting event classes follow a pattern of having the '-ing' suffix at the end.
  • Rename the ItemStacks in the respective events to result to have more clarity.
  • Adds comments to various methods

Spinoscythe avatar Jul 08 '25 18:07 Spinoscythe

  • [ ] Publish PR to GitHub Packages

@Spinoscythe, this PR introduces breaking changes. Fortunately, this project is currently accepting breaking changes, but if they are not intentional, please revert them. Last checked commit: f2b0599b3aa8794e0cd3089106baabc949cf432f.

neoforge (:neoforge)

  • net/neoforged/neoforge/event/entity/player/PlayerEvent$ItemCraftedEvent
    • getCrafting()Lnet/minecraft/world/item/ItemStack;: ❗ API method was removed
  • net/neoforged/neoforge/event/entity/player/PlayerEvent$ItemSmeltedEvent
    • getSmelting()Lnet/minecraft/world/item/ItemStack;: ❗ API method was removed
  • net/neoforged/neoforge/event/EventHooks
    • firePlayerCraftingEvent(Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/Container;)V: ❗ API method was removed

The naming scheme of the existing events is, in my opinion, followed very loosely. For example, the method firePlayerCraftingEvent vs the class PlayerEvent.ItemCraftedEvent. For this, we have 2 options: 1. rename the firePlayerCraftingEvent, or 2. update to the new naming scheme proposed in this PR.

If you prefer, I can do the first of the 2 options rather than the second.

Spinoscythe avatar Jul 08 '25 18:07 Spinoscythe

I would prefer keeping the names of the existing events and hook methods as-is. Renaming the firePlayerCraftingEvent() method provides marginal benefits at best and the naming scheme not being followed to the full extent doesn't change anything about the proposed event names being plain wrong.

XFactHD avatar Jul 08 '25 19:07 XFactHD