From d127090fe2f514e177daec65cb629da3c033c8c0 Mon Sep 17 00:00:00 2001 From: iGalaxy Date: Mon, 19 Jun 2023 02:51:44 -0700 Subject: [PATCH] feat: 1.20 --- build.gradle.kts | 4 ---- libs.versions.toml | 12 +++++------- .../playerpronouns/command/PronounsCommand.java | 6 +++--- .../ashisbored/playerpronouns/data/Pronouns.java | 4 ++-- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 5105c2e..7555d7d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,10 +34,6 @@ dependencies { modImplementation(libs.placeholder.api) include(libs.placeholder.api) - // more-codecs - modImplementation(libs.more.codecs) - include(libs.more.codecs) - // fabric-api-permissions modImplementation(libs.fabric.permissions) include(libs.fabric.permissions) diff --git a/libs.versions.toml b/libs.versions.toml index fd79a7b..0a42343 100644 --- a/libs.versions.toml +++ b/libs.versions.toml @@ -1,12 +1,11 @@ [versions] -minecraft = "1.19.3" -yarn = "1.19.3+build.5" +minecraft = "1.20.1" +yarn = "1.20.1+build.2" -fabric-loader = "0.14.11" -fabric-api = "0.69.1+1.19.3" +fabric-loader = "0.14.21" +fabric-api = "0.83.1+1.20.1" -placeholder-api = "2.0.0-pre.2+1.19.3" -more-codecs = "0.3.0+1.19.3" +placeholder-api = "2.1.1+1.20" fabric-permissions = "0.1-SNAPSHOT" @@ -18,6 +17,5 @@ fabric-loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric-l fabric-api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric-api" } placeholder-api = { module = "eu.pb4:placeholder-api", version.ref = "placeholder-api" } -more-codecs = { module = "xyz.nucleoid:more-codecs", version.ref = "more-codecs" } fabric-permissions = { module = "me.lucko:fabric-permissions-api", version.ref = "fabric-permissions" } diff --git a/src/main/java/io/github/ashisbored/playerpronouns/command/PronounsCommand.java b/src/main/java/io/github/ashisbored/playerpronouns/command/PronounsCommand.java index 233a4c3..5c1da3b 100644 --- a/src/main/java/io/github/ashisbored/playerpronouns/command/PronounsCommand.java +++ b/src/main/java/io/github/ashisbored/playerpronouns/command/PronounsCommand.java @@ -41,7 +41,7 @@ public class PronounsCommand { if (!PlayerPronouns.setPronouns(player, pronouns)) { ctx.getSource().sendError(Text.literal("Failed to update pronouns, sorry")); } else { - ctx.getSource().sendFeedback(Text.literal("Updated your pronouns to ") + ctx.getSource().sendFeedback(() -> Text.literal("Updated your pronouns to ") .append(pronouns.formatted()) .formatted(Formatting.GREEN), false); } @@ -52,7 +52,7 @@ public class PronounsCommand { .requires(ctx -> Permissions.check(ctx, "playerpronouns.reload_config", 4)) .executes(ctx -> { PlayerPronouns.reloadConfig(); - ctx.getSource().sendFeedback(Text.literal("Reloaded the config!").formatted(Formatting.GREEN), true); + ctx.getSource().sendFeedback(() -> Text.literal("Reloaded the config!").formatted(Formatting.GREEN), true); return Command.SINGLE_SUCCESS; }) ).then(literal("unset") @@ -61,7 +61,7 @@ public class PronounsCommand { if (!PlayerPronouns.setPronouns(player, null)) { ctx.getSource().sendError(Text.literal("Failed to update pronouns, sorry")); } else { - ctx.getSource().sendFeedback(Text.literal("Cleared your pronouns!") + ctx.getSource().sendFeedback(() -> Text.literal("Cleared your pronouns!") .formatted(Formatting.GREEN), false); } return Command.SINGLE_SUCCESS; diff --git a/src/main/java/io/github/ashisbored/playerpronouns/data/Pronouns.java b/src/main/java/io/github/ashisbored/playerpronouns/data/Pronouns.java index a5971a9..3f73b5e 100644 --- a/src/main/java/io/github/ashisbored/playerpronouns/data/Pronouns.java +++ b/src/main/java/io/github/ashisbored/playerpronouns/data/Pronouns.java @@ -3,7 +3,7 @@ package io.github.ashisbored.playerpronouns.data; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.text.Text; -import xyz.nucleoid.codecs.MoreCodecs; +import net.minecraft.util.dynamic.Codecs; public record Pronouns( String raw, @@ -12,7 +12,7 @@ public record Pronouns( ) { public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( Codec.STRING.fieldOf("raw").forGetter(Pronouns::raw), - MoreCodecs.TEXT.fieldOf("formatted").forGetter(Pronouns::formatted), + Codecs.TEXT.fieldOf("formatted").forGetter(Pronouns::formatted), Codec.BOOL.optionalFieldOf("remote", false).forGetter(Pronouns::remote) ).apply(instance, Pronouns::new)); }