mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-22 13:09:59 +00:00
Fix circular dependency in static init of RecipeBookRegistry (#8996)
This commit is contained in:
1 parent
84d354a7dd
commit
4db9bc68d9
2 files changed
+16
-3
No files matched your search
@@ -11,6 +11,7 @@ import net.minecraft.client.RecipeBookCategories;
|
||||
import net.minecraft.world.inventory.RecipeBookType;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
@@ -20,8 +21,7 @@ import static net.minecraft.client.RecipeBookCategories.*;
|
||||
|
||||
public class RecipeBookRegistry
|
||||
{
|
||||
// The ImmutableMap is the patched out value of AGGREGATE_CATEGORIES
|
||||
private static final Map<RecipeBookCategories, List<RecipeBookCategories>> MUTABLE_AGGREGATE_CATEGORIES = new HashMap<>(ImmutableMap.of(CRAFTING_SEARCH, ImmutableList.of(CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE), FURNACE_SEARCH, ImmutableList.of(FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC), BLAST_FURNACE_SEARCH, ImmutableList.of(BLAST_FURNACE_BLOCKS, BLAST_FURNACE_MISC), SMOKER_SEARCH, ImmutableList.of(SMOKER_FOOD)));
|
||||
private static final Map<RecipeBookCategories, List<RecipeBookCategories>> MUTABLE_AGGREGATE_CATEGORIES = new HashMap<>();
|
||||
|
||||
private static final Map<RecipeBookType, List<RecipeBookCategories>> TYPE_TO_CATEGORIES = new HashMap<>();
|
||||
private static final Map<RecipeType<?>, Function<Recipe<?>, RecipeBookCategories>> FIND_CATEGORIES_FOR_TYPE = new HashMap<>();
|
||||
@@ -50,4 +50,16 @@ public class RecipeBookRegistry
|
||||
{
|
||||
return Optional.ofNullable(FIND_CATEGORIES_FOR_TYPE.get(type)).map(f -> f.apply(recipe)).orElse(null);
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static void initDefaultValues()
|
||||
{
|
||||
// The ImmutableMap is the patched out value of AGGREGATE_CATEGORIES
|
||||
MUTABLE_AGGREGATE_CATEGORIES.putAll(ImmutableMap.of(
|
||||
CRAFTING_SEARCH, ImmutableList.of(CRAFTING_EQUIPMENT, CRAFTING_BUILDING_BLOCKS, CRAFTING_MISC, CRAFTING_REDSTONE),
|
||||
FURNACE_SEARCH, ImmutableList.of(FURNACE_FOOD, FURNACE_BLOCKS, FURNACE_MISC),
|
||||
BLAST_FURNACE_SEARCH, ImmutableList.of(BLAST_FURNACE_BLOCKS, BLAST_FURNACE_MISC),
|
||||
SMOKER_SEARCH, ImmutableList.of(SMOKER_FOOD)
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user