-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
Make event values return item stacks instead of item types if possible #4128
Make event values return item stacks instead of item types if possible #4128
Conversation
Haven't we done this in the past and it caused more issues then we could count? I have a feeling that Skript will try to convert and cause the majority of the issues. |
@Wealthyturtle would you be able to weigh in on this (because of #2510)? |
I think this change is fine since it fixes conversion between ItemStack and ItemType (so long as it doesn't break other stuff) |
Well this PR itself doesn't fix any conversion, but there is a ItemStack -> ItemType converter which should do this: Skript/src/main/java/ch/njol/skript/classes/data/DefaultConverters.java Lines 206 to 218 in d8b1d52
But I'm not sure if the converters are always checked, so it could still give issues. If this gets tested properly, it should be fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are fine to trial this out for the 2.7 alphas
Description
Makes some event values return ItemStacks instead of ItemTypes, since that is more direct.
The issue in #4109 was caused by the event-value getter first converting the ItemStack to an ItemType, and after that it got converted back to an ItemStack, where the reference got lost, as the converter called ItemType#getRandom, which clones the ItemStack.
Target Minecraft Versions: any
Requirements: none
Related Issues: #4109