🚀 Add crafting inventory slots expression (result/matrix)
Description
🚀 This PR aims to add a new expression for crafting inventory slots such as the result item and matrix
Some utility methods have been added, if anyone have better way to achieve their results let me know.
NOTE: While testing I have found a potential bug when you try to change the matrix in preparing craft event that will trigger the event again and get into infinite loop, I will try to report that to spigot later when I can but for now I have disabled that behavior in Skript and sent a warning when someone try to use it.
NOTE: This PR should be merged after #4409 to be able to use event-inventory
Target Minecraft Versions: Any Requirements: None Related Issues: https://github.com/SkriptLang/Skript/issues/4908
I believe we should be using ItemStack for everything. ItemType is used as a literal. This way we can allow for named, lore, enchanted items etc.
This will also remove the need for the Utils toItemTypes method, which I personally don't believe we need to be adding.
I believe we should be using ItemStack for everything. ItemType is used as a literal. This way we can allow for named, lore, enchanted items etc.
This will also remove the need for the Utils
toItemTypesmethod, which I personally don't believe we need to be adding.
This is an important note, I remember I saw a PR about replacing ItemStacks with ItemTypes but didn't follow up with why This is the PR #2510 if itemtypes aren't the good choice we better replace them with ItemStacks probably
It really needs to be explained; So basically ItemTypes are supposed to be used as a Literal. Syntaxes such as on right click with %itemtypes% makes sense, because on rightclick with a diamond sword can be used. An ItemStack will return all the details of the item, this can be used anywhere in Spigot API, it gives the user more information about the value.
Another example can be in SkQuery recipes, it only accepted ItemTypes, which restricted the user to not allow for named, enchanted or lored items. Where as Tuske later added the ability to use ItemStacks, so you could check if the item was named. This is good for like quests or missions where the item must be named. SkQuery recipes have since been removed.
TPGamesNL also mentioned that we should be doing this for primitive number types. Returning an Integer, or a Double rather than just returning Number. But when it comes to accepting a change, you can be using Number, and just number.intValue() or whatever on it, so the output is certain, and the input can be anything avoiding the cannot understand effect error.
Same goes with EntityData and Entity. EntityData is a literal, like on spawn of a cow or a skeleton