PaperMC / Paper

The most widely used, high performance Minecraft server that aims to fix gameplay and mechanics inconsistencies
https://papermc.io/
Other
9.37k stars 2.19k forks source link

PrepareResultEvent is fired twice within ItemCombinerMenu#slotsChanged #10865

Open Tencryn opened 3 weeks ago

Tencryn commented 3 weeks ago

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.