Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

96DarkCode96
Copy link
Contributor

Updated dependencies of Adventure + added test for shadow_color.

@96DarkCode96 96DarkCode96 requested a review from a team as a code owner December 24, 2024 09:24
@kennytv kennytv added the type: feature Request for a new Feature. label Dec 24, 2024
@@ -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);
Copy link
Contributor

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)),)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix that.

Copy link
Contributor

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)

Copy link
Contributor Author

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 👍

Copy link
Contributor

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)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, will try that.

Copy link
Contributor Author

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. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature Request for a new Feature.
Projects
Status: Changes required
Development

Successfully merging this pull request may close these issues.

3 participants