-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Updated Kyori-Adventure (4.17.0 -> 4.18.0) #11809
base: main
Are you sure you want to change the base?
Conversation
@@ -79,6 +79,11 @@ public final class AdventureCodecs { | |||
public static final Codec<Component> COMPONENT_CODEC = recursive("adventure Component", AdventureCodecs::createCodec); | |||
public static final StreamCodec<RegistryFriendlyByteBuf, Component> STREAM_COMPONENT_CODEC = ByteBufCodecs.fromCodecWithRegistriesTrusted(COMPONENT_CODEC); | |||
|
|||
static final Codec<ShadowColor> SHADOW_COLOR_CODEC = Codec.INT.comapFlatMap(s -> { | |||
@Nullable ShadowColor value = ShadowColor.shadowColor(s); |
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.
Your IDE should already be screaming at you that shadow color is never null...
There is no point in a comap flat map for something that is just an xmap.
You are also using the wrong codec, see what vanilla supports for defining shadow numbers in their own codecs (ExtraCodecs.ARGB_COLOR_CODEC.optionalFieldOf("shadow_color").forGetter(serializer -> Optional.ofNullable(serializer.shadowColor)),
)
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.
Will fix that.
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.
Thank you for the fast fix 🙏 the update is super nice for us and you beat me to it by like, half an hour (sorry if my review sounded a bit salty lol)
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.
Yea, no worries. I have tried to fix it. It should be okey? Its kinda hard to make it abstract for ARGBLike cause the only implementation is ShadowColorImpl. I'm okay with any criticism 👍
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.
Looks better tho it is still the wrong codec. Just replace Codec.INT with ExtraCodecs.ARGB_COLOR_CODEC
.
It does not have to be an ARGBLike, that is only for the adventure setter. The getter returns a shadow color.
The mojang codec allows people to specify the color via an int[4] so we need to mirror that (hence the other base codec)
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.
Okay, will try that.
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.
Now it should be fine. 👍
Updated dependencies of Adventure + added test for shadow_color.