Skip to content

Commit e9c266c

Browse files
committed
Properly port recipe book tree to 1.19.2
1 parent 099c626 commit e9c266c

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/blast_search_trees/MinecraftMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ private void replaceSearchTrees(CallbackInfo ci) {
2929
ModernFix.LOGGER.info("Replacing search trees with '{}' provider", provider.getName());
3030
this.searchRegistry.register(SearchRegistry.CREATIVE_NAMES, list -> provider.getSearchTree(false));
3131
this.searchRegistry.register(SearchRegistry.CREATIVE_TAGS, list -> provider.getSearchTree(true));
32-
this.searchRegistry.register(SearchRegistry.RECIPE_COLLECTIONS, list -> new RecipeBookSearchTree(provider.getSearchTree(false)));
32+
this.searchRegistry.register(SearchRegistry.RECIPE_COLLECTIONS, list -> new RecipeBookSearchTree(provider.getSearchTree(false), list));
3333
// grab components for all key mappings in order to prevent them from being loaded off-thread later
3434
// this populates the LazyLoadedValues
3535
// we also need to suppress GLFW errors to prevent crashes if a key is missing

common/src/main/java/org/embeddedt/modernfix/searchtree/RecipeBookSearchTree.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
public class RecipeBookSearchTree extends DummySearchTree<RecipeCollection> {
1616
private final SearchTree<ItemStack> stackCollector;
1717
private Map<Item, List<RecipeCollection>> collectionsByItem = null;
18-
private final List<RecipeCollection> allCollections = new ArrayList<>();
18+
private final List<RecipeCollection> allCollections;
1919

20-
public RecipeBookSearchTree(SearchTree<ItemStack> stackCollector) {
20+
public RecipeBookSearchTree(SearchTree<ItemStack> stackCollector, List<RecipeCollection> allCollections) {
2121
this.stackCollector = stackCollector;
22+
this.allCollections = allCollections;
2223
}
2324

2425
private Map<Item, List<RecipeCollection>> populateCollectionMap() {
@@ -36,16 +37,6 @@ private Map<Item, List<RecipeCollection>> populateCollectionMap() {
3637
return collections;
3738
}
3839

39-
@Override
40-
public void add(RecipeCollection pObj) {
41-
this.allCollections.add(pObj);
42-
}
43-
44-
@Override
45-
public void clear() {
46-
this.allCollections.clear();
47-
}
48-
4940
@Override
5041
public void refresh() {
5142
this.collectionsByItem = null;

0 commit comments

Comments
 (0)