Properly port recipe book tree to 1.19.2
This commit is contained in:
parent
099c62672b
commit
e9c266cd16
|
|
@ -29,7 +29,7 @@ public class MinecraftMixin {
|
|||
ModernFix.LOGGER.info("Replacing search trees with '{}' provider", provider.getName());
|
||||
this.searchRegistry.register(SearchRegistry.CREATIVE_NAMES, list -> provider.getSearchTree(false));
|
||||
this.searchRegistry.register(SearchRegistry.CREATIVE_TAGS, list -> provider.getSearchTree(true));
|
||||
this.searchRegistry.register(SearchRegistry.RECIPE_COLLECTIONS, list -> new RecipeBookSearchTree(provider.getSearchTree(false)));
|
||||
this.searchRegistry.register(SearchRegistry.RECIPE_COLLECTIONS, list -> new RecipeBookSearchTree(provider.getSearchTree(false), list));
|
||||
// grab components for all key mappings in order to prevent them from being loaded off-thread later
|
||||
// this populates the LazyLoadedValues
|
||||
// we also need to suppress GLFW errors to prevent crashes if a key is missing
|
||||
|
|
|
|||
|
|
@ -15,10 +15,11 @@ import java.util.stream.Collectors;
|
|||
public class RecipeBookSearchTree extends DummySearchTree<RecipeCollection> {
|
||||
private final SearchTree<ItemStack> stackCollector;
|
||||
private Map<Item, List<RecipeCollection>> collectionsByItem = null;
|
||||
private final List<RecipeCollection> allCollections = new ArrayList<>();
|
||||
private final List<RecipeCollection> allCollections;
|
||||
|
||||
public RecipeBookSearchTree(SearchTree<ItemStack> stackCollector) {
|
||||
public RecipeBookSearchTree(SearchTree<ItemStack> stackCollector, List<RecipeCollection> allCollections) {
|
||||
this.stackCollector = stackCollector;
|
||||
this.allCollections = allCollections;
|
||||
}
|
||||
|
||||
private Map<Item, List<RecipeCollection>> populateCollectionMap() {
|
||||
|
|
@ -36,16 +37,6 @@ public class RecipeBookSearchTree extends DummySearchTree<RecipeCollection> {
|
|||
return collections;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(RecipeCollection pObj) {
|
||||
this.allCollections.add(pObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.allCollections.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
this.collectionsByItem = null;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user