Jump to content

[1.19] Questions about ContainerMenus and Slot methods


Infinituum

Recommended Posts

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 by Infinituum
Link to comment
Share on other sites

  • Infinituum changed the title to [1.19] Questions about ContainerMenus and Slot methods
  • `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.
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.