From 723f984e0af31f3a20882cd05bd844b6d23882bd Mon Sep 17 00:00:00 2001 From: Josiah Glosson Date: Wed, 4 Dec 2024 16:49:17 -0600 Subject: [PATCH] Workaround absence of https://github.com/FabricMC/fabric/pull/4180 for now --- .../io/github/gaming32/bingo/data/goal/GoalManager.java | 8 +++++--- common/src/main/resources/bingo.accessWidener | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/io/github/gaming32/bingo/data/goal/GoalManager.java b/common/src/main/java/io/github/gaming32/bingo/data/goal/GoalManager.java index df3b983a..a94a34f2 100644 --- a/common/src/main/java/io/github/gaming32/bingo/data/goal/GoalManager.java +++ b/common/src/main/java/io/github/gaming32/bingo/data/goal/GoalManager.java @@ -2,10 +2,11 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import com.mojang.serialization.JsonOps; import io.github.gaming32.bingo.Bingo; -import io.github.gaming32.bingo.data.BingoRegistries; import io.github.gaming32.bingo.util.ResourceLocations; import net.minecraft.core.HolderLookup; +import net.minecraft.resources.FileToIdConverter; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener; @@ -18,7 +19,6 @@ import java.util.Map; import java.util.Set; -// FIXME: Broken on Fabric until https://github.com/FabricMC/fabric/pull/4180 is merged public class GoalManager extends SimpleJsonResourceReloadListener { public static final ResourceLocation ID = ResourceLocations.bingo("goals"); @@ -26,7 +26,9 @@ public class GoalManager extends SimpleJsonResourceReloadListener { private static Map> goalsByDifficulty = Map.of(); public GoalManager(HolderLookup.Provider registries) { - super(registries, BingoGoal.CODEC, BingoRegistries.GOAL); + // FIXME: Switch to (HolderLookup.Provider, Codec, ResourceKey) overload and remove the AW once + // https://github.com/FabricMC/fabric/pull/4180 is merged + super(registries.createSerializationContext(JsonOps.INSTANCE), BingoGoal.CODEC, FileToIdConverter.json("bingo/goal")); } public static Set getGoalIds() { diff --git a/common/src/main/resources/bingo.accessWidener b/common/src/main/resources/bingo.accessWidener index 06a46892..d6ae529b 100644 --- a/common/src/main/resources/bingo.accessWidener +++ b/common/src/main/resources/bingo.accessWidener @@ -6,6 +6,8 @@ accessible method net/minecraft/client/gui/GuiGraphics renderTooltipInternal (Ln accessible method net/minecraft/commands/arguments/ResourceKeyArgument getRegistryKey (Lcom/mojang/brigadier/context/CommandContext;Ljava/lang/String;Lnet/minecraft/resources/ResourceKey;Lcom/mojang/brigadier/exceptions/DynamicCommandExceptionType;)Lnet/minecraft/resources/ResourceKey; accessible method net/minecraft/commands/arguments/ResourceKeyArgument resolveKey (Lcom/mojang/brigadier/context/CommandContext;Ljava/lang/String;Lnet/minecraft/resources/ResourceKey;Lcom/mojang/brigadier/exceptions/DynamicCommandExceptionType;)Lnet/minecraft/core/Holder$Reference; +extendable method net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener (Lcom/mojang/serialization/DynamicOps;Lcom/mojang/serialization/Codec;Lnet/minecraft/resources/FileToIdConverter;)V + accessible method net/minecraft/world/level/storage/loot/parameters/LootContextParamSets register (Ljava/lang/String;Ljava/util/function/Consumer;)Lnet/minecraft/util/context/ContextKeySet; accessible field net/minecraft/world/inventory/GrindstoneMenu repairSlots Lnet/minecraft/world/Container;