From 222c8b752cf08184627856b7ec6ec089da7d4ac9 Mon Sep 17 00:00:00 2001 From: Ryan Fox Date: Sat, 28 Oct 2023 18:10:32 -0700 Subject: [PATCH] Fabric 1.20.2 (untested) I just did the minimum to compile it. --- .../github/flemmli97/flan/config/BuySellHandler.java | 10 ++++++++-- .../flemmli97/flan/gui/GroupPlayerScreenHandler.java | 7 +++++-- gradle.properties | 8 ++++---- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/common/src/main/java/io/github/flemmli97/flan/config/BuySellHandler.java b/common/src/main/java/io/github/flemmli97/flan/config/BuySellHandler.java index 1274892..0d9a502 100644 --- a/common/src/main/java/io/github/flemmli97/flan/config/BuySellHandler.java +++ b/common/src/main/java/io/github/flemmli97/flan/config/BuySellHandler.java @@ -2,6 +2,8 @@ package io.github.flemmli97.flan.config; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; +import com.mojang.datafixers.util.Pair; +import com.mojang.serialization.JsonOps; import io.github.flemmli97.flan.claim.PermHelper; import io.github.flemmli97.flan.platform.integration.currency.CommandCurrency; import io.github.flemmli97.flan.player.PlayerClaimData; @@ -194,7 +196,7 @@ public class BuySellHandler { obj.addProperty("sellType", this.sellType.toString()); obj.addProperty("buyValue", this.buyAmount); obj.addProperty("sellValue", this.sellAmount); - obj.add("ingredient", this.ingredient.toJson()); + obj.add("ingredient", this.ingredient.toJson(true)); return obj; } @@ -204,7 +206,11 @@ public class BuySellHandler { this.buyAmount = object.has("buyValue") ? object.get("buyValue").getAsFloat() : this.buyAmount; this.sellAmount = object.has("sellValue") ? object.get("sellValue").getAsFloat() : this.sellAmount; try { - this.ingredient = object.has("ingredient") ? Ingredient.fromJson(object.get("ingredient")) : Ingredient.EMPTY; + if (object.has("ingredient")) { + this.ingredient = Ingredient.CODEC.decode(JsonOps.INSTANCE, object.get("ingredient")).map(Pair::getFirst).result().orElseThrow(); + } else { + this.ingredient = Ingredient.EMPTY; + } } catch (JsonParseException e) { this.ingredient = Ingredient.EMPTY; } diff --git a/common/src/main/java/io/github/flemmli97/flan/gui/GroupPlayerScreenHandler.java b/common/src/main/java/io/github/flemmli97/flan/gui/GroupPlayerScreenHandler.java index c0b91db..5a4eb57 100644 --- a/common/src/main/java/io/github/flemmli97/flan/gui/GroupPlayerScreenHandler.java +++ b/common/src/main/java/io/github/flemmli97/flan/gui/GroupPlayerScreenHandler.java @@ -21,6 +21,7 @@ import net.minecraft.world.item.Items; import net.minecraft.world.level.block.entity.SkullBlockEntity; import java.util.List; +import java.util.UUID; public class GroupPlayerScreenHandler extends ServerOnlyScreenHandler { @@ -84,8 +85,10 @@ public class GroupPlayerScreenHandler extends ServerOnlyScreenHandler group.getOrCreateTag().put("SkullOwner", NbtUtils.writeGameProfile(new CompoundTag(), prof))); + GameProfile gameProfile = new GameProfile(new UUID(0, 0), players.get(id)); + CompoundTag tag = group.getOrCreateTag(); + tag.put("SkullOwner", NbtUtils.writeGameProfile(new CompoundTag(), gameProfile)); + SkullBlockEntity.resolveGameProfile(tag); inv.updateStack(i, group); } } diff --git a/gradle.properties b/gradle.properties index 52accbf..6665bfc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,10 +1,10 @@ org.gradle.jvmargs=-Xmx3G enabled_platforms=fabric -minecraft_version=1.20 -parchment_version=1.19.3:2023.03.12 +minecraft_version=1.20.2 +parchment_version=1.20.2:2023.10.08 # Fabric Properties -loader_version=0.14.21 +loader_version=0.14.22 # Mod Properties mod_version=1.8.4.3 @@ -12,7 +12,7 @@ maven_group=io.github.flemmli97 archives_base_name=flan # Dependencies -fabric_version=0.83.0+1.20 +fabric_version=0.89.1+1.20.2 fabric_permissions_api=0.2-SNAPSHOT dynmap_fabric=curse.maven:dynmap-59433:4512919 diamond_economy=curse.maven:diamondeconomy-534301:4453952