TheIllusiveC4 / Curios

Minecraft Mod: A flexible and expandable accessory/equipment API for users and developers.
https://www.curseforge.com/minecraft/mc-mods/curios
Other
182 stars 73 forks source link

[Bug]: CurioEvents #444

Open 2929762171 opened 1 month ago

2929762171 commented 1 month ago

Minecraft Version

1.19.2

What happened?

Using kubeJS. CurioDropsEvent when gamerule keepInventory=false, cancelling event will 'eat' all equipped curios. CurioUnequipEvent will fire 3 times, like this: image I need line 39~41 to make sure to skip the first time check, and set it 'allow' so it can run into the second time check. Skipping the third fire seems no problem.

How do you trigger this bug?

1. 2. 3. ...

Loader

Forge

Loader Version

forge 43.3.7

Mod Version

curios-forge-1.19.2-5.1.6.3

Relevant Log Outputs

No response

2929762171 commented 1 month ago

plus, the 3rd CurioUnequipEvent will fire CurioEquipEvent, same itemStack.

TheIllusiveC4 commented 1 month ago

CurioDropsEvent when gamerule keepInventory=false, cancelling event will 'eat' all equipped curios.

This is intended, as it works the same as the more global LivingDropsEvent. It prevents the drop behavior, not the fact that the items are removed (which is controlled by the keepInventory gamerule itself).

CurioUnequipEvent will fire 3 times, like this:

Could you clarify the nature of the bug you're reporting? Is it just the fact that the event is firing 3 times? Does your script, as you've written it, work as you intend or is it not working correctly due to a potential bug?

2929762171 commented 1 month ago

return before client check, fire many times: image image https://github.com/user-attachments/assets/000afede-5250-4dfb-83ac-a547f430ccf3 after client check, event fire 3 times: image https://github.com/user-attachments/assets/1f03f12f-1df2-41e7-aec6-2555f037b38d if I try to do something, like change player's xp, it will also change 3 times: image https://github.com/user-attachments/assets/3cda9f55-4a33-4e92-afe3-9af4258cd320

CurioDropsEvent when gamerule keepInventory=false, cancelling event will 'eat' all equipped curios.

This is intended, as it works the same as the more global LivingDropsEvent. It prevents the drop behavior, not the fact that the items are removed (which is controlled by the keepInventory gamerule itself).

CurioUnequipEvent will fire 3 times, like this:

Could you clarify the nature of the bug you're reporting? Is it just the fact that the event is firing 3 times? Does your script, as you've written it, work as you intend or is it not working correctly due to a potential bug?

2929762171 commented 1 month ago

At this situation, if I want to cost some xpLevel to unequip binding curse item from slot, I need to setResult('allow') in the first and second time, the second time is necessary.