Posted December 26, 20222 yr I have a few questions about Menus and Slots: What is `slot.onQuickCraft` used for? What is `slot.onTake` used for? When do I have to use `slot.onTake` instead of `slot.setChanged`? I've already looked at the documentation but I was wondering if someone could give me a further explanation on this three methods. I'm assuming there is some kind of logic on what to do when a certain action is triggered (correct me if I'm wrong, like for example taking items from result slot and dropping exp) : how is that implemented? Edited December 26, 20222 yr by Infinituum
December 27, 20222 yr `Slot#onQuickCraft` is used whenever the result slot is shift clicked such that the result gets put into the inventory immediately. This method is implemented by the modder themselves in AbstractContainerMenu#quickMoveStack. `Slot#onTake` is used whenever the result slot is emptied. For those that are quick crafted, the method is implemented at the end of AbstractContainerMenu#quickMoveStack by the modder. `Slot#setChanged` is called whenever the slot's value has changed, so it will be used whenever that happens. See above and the forge docs for taking items from the result slot. Most of it is already implemented by default. Dropping experience is typically done in the `onTake` or `onQuickCraft` methods.
December 27, 20222 yr Author 1 hour ago, ChampionAsh5357 said: `Slot#onQuickCraft` is used whenever the result slot is shift clicked such that the result gets put into the inventory immediately. This method is implemented by the modder themselves in AbstractContainerMenu#quickMoveStack. `Slot#onTake` is used whenever the result slot is emptied. For those that are quick crafted, the method is implemented at the end of AbstractContainerMenu#quickMoveStack by the modder. `Slot#setChanged` is called whenever the slot's value has changed, so it will be used whenever that happens. See above and the forge docs for taking items from the result slot. Most of it is already implemented by default. Dropping experience is typically done in the `onTake` or `onQuickCraft` methods. Ok, now I understand, thank you so much!
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.