Cow Variants
Description
This PR aims to add support for cow variants to Skript. A bit of reflect was needed in order to set and get the variant.
Target Minecraft Versions: any Requirements: none Related Issues: none
Rather than all the reflection, that will be removed in a couple years, why not just only register the CowData class if the variant exists? (same for simple data, if the class doesn't exist, register a simple cow)
Rather than all the reflection, that will be removed in a couple years, why not just only register the CowData class if the variant exists? (same for simple data, if the class doesn't exist, register a simple cow)
Even if I made it where CowData would only be registered on 1.21.5+ it would still require the reflection.
why would it require reflection?
why would it require reflection?
I'm not entirely sure of how it works. But for some reason Cow.class was returning/redirecting to AbstractCow.class
and within #set(Cow cow) it was throwing a NoSuchMethod for the #setVariant, because for some reason cow was an AbstractCow. I asked in Paper discord couple hours ago, and it has something to do with the api-version in plugin.yml.
Before making the PR, I had changed the api-version to 1.21.5 and it worked perfectly, but since it needed to be 1.19, then that wasn't a viable option.
convo continued on Discord. Due to some silly API stuff in Paper, I guess the reflection is necessary.
Can we get a short summary of why in a comment/in the PR description? I'm curious about it too
Can we get a short summary of why in a comment/in the PR description? I'm curious about it too
Basically as Smurfy already said.
By not having api-version: "1.21.5" ... Paper is forcing the Cow class to return as AbstractCow.
So when doing Cow#setVariant its forcing AbstractCow#setVariant (which doesn't exist)
Can we get a short summary of why in a comment/in the PR description? I'm curious about it too
Basically as Smurfy already said. By not having
api-version: "1.21.5"... Paper is forcing the Cow class to return as AbstractCow. So when doingCow#setVariantits forcingAbstractCow#setVariant(which doesn't exist)
Wacky, thanks