-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: {slot}
placeholder for MenuItem
#61
base: main
Are you sure you want to change the base?
Conversation
{item}
placeholder for MenuItem{slot}
placeholder for MenuItem
At some point, "internal" placeholders were discussed, but nothing came of it. One concern that remains from that conversation is backward compatibility. The concern stems from the fact that the I am going to spend some time putting together a POC for internal placeholders to see if we can maybe merge this into that. |
The only solution to that would be to use a different symbol instead of |
This is what I have in mind. The problem is that there aren't many good ones we can use. I am not a fan of One other mention I have is that we might want to implement a proper "internal" placeholder system instead of just adding more parameters to the parse function whenever we want new placeholders. We can probably build upon this PR since it seems to work fine but we have to remember, that data is not always available. For example, we can't have the slot number in the menu title since the title is parsed only once. So we would have context-dependent placeholders. |
Hello,
this PR adds the feature that you have access to the current slot of the menu item via the
{slot}
placeholder when building dynamic inventories with filler items.I added a new parameter to the setPlaceholders Method. The parameter slot is filled with the value of the MenuItemOptions#slot(). In places where it doesn't make sense like opening and closing click handlers, I decided to give -1 as value. This is also the case for ClickAction via the execute command.
So the value
-1
means that it Item doesn't have anything todo with a MenuItem directly.This was commissioned work by makiil.grosnach.