PrepareResultEvent is fired twice within ItemCombinerMenu#slotsChanged
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 12.7k
- Forks
- 3.5k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 11
Description
Expected behavior
I believe PrepareResultEvent only needs to be fired once per ItemCombinerMenu#slotsChanged method call.
This method calls this.createResult() which is implemented by SmithingMenu#createResult, which fires a PrepareResultEvent event, before being fired a second time immediately after within slotsChanged. It is of my assumption that the event call within SmithingMenu is not actually needed, or I'm misunderstanding why it is there.
Observed/Actual behavior
There are twice as many PrepareResultEvent events being emitted than what seems to be necessary resulting in a total of 6 calls when slotsChanged is only called 3 times.
Steps/models to reproduce
N/A
Plugin and Datapack List
N/A
Paper version
This server is running Paper version 1.20.6-137-master@bd5867a (2024-06-04T21:04:28Z) (Implementing API version 1.20.6-R0.1-SNAPSHOT)
Other
This is in regards to the "Add PrepareResultEvent" patch, seems to have been present for quite some time too. While a similar issue to #4844, I'm aware that the event is currently intended to fire multiple times, this issue is more about the duplicated calls that occur within the slotsChanged method alone.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at ItemCombinerMenu#slotsChanged and follow its call to SmithingMenu#createResult, then inspect the PrepareResultEvent patch and event call sites. Done means each slotsChanged call emits PrepareResultEvent only once without removing intentionally separate emissions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100