Skip to content

Commit

Permalink
Workaround absence of FabricMC/fabric#4180 for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaming32 committed Dec 4, 2024
1 parent ce03ae2 commit 723f984
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -18,15 +19,16 @@
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<BingoGoal> {
public static final ResourceLocation ID = ResourceLocations.bingo("goals");

private static Map<ResourceLocation, GoalHolder> goals = Map.of();
private static Map<Integer, List<GoalHolder>> 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<ResourceLocation> getGoalIds() {
Expand Down
2 changes: 2 additions & 0 deletions common/src/main/resources/bingo.accessWidener
Original file line number Diff line number Diff line change
Expand Up @@ -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 <init> (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;
Expand Down

0 comments on commit 723f984

Please sign in to comment.