Merge remote-tracking branch 'origin/1.19.2' into 1.20
This commit is contained in:
commit
4ddac48f1e
|
|
@ -37,7 +37,7 @@ public abstract class MinecraftMixin {
|
||||||
SearchRegistry.TreeBuilderSupplier<ItemStack> tagSupplier = list -> provider.getSearchTree(true);
|
SearchRegistry.TreeBuilderSupplier<ItemStack> tagSupplier = list -> provider.getSearchTree(true);
|
||||||
this.searchRegistry.register(SearchRegistry.CREATIVE_NAMES, nameSupplier);
|
this.searchRegistry.register(SearchRegistry.CREATIVE_NAMES, nameSupplier);
|
||||||
this.searchRegistry.register(SearchRegistry.CREATIVE_TAGS, tagSupplier);
|
this.searchRegistry.register(SearchRegistry.CREATIVE_TAGS, tagSupplier);
|
||||||
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));
|
||||||
ModernFixPlatformHooks.INSTANCE.registerCreativeSearchTrees(this.searchRegistry, nameSupplier, tagSupplier, this::populateSearchTree);
|
ModernFixPlatformHooks.INSTANCE.registerCreativeSearchTrees(this.searchRegistry, nameSupplier, tagSupplier, this::populateSearchTree);
|
||||||
// grab components for all key mappings in order to prevent them from being loaded off-thread later
|
// grab components for all key mappings in order to prevent them from being loaded off-thread later
|
||||||
// this populates the LazyLoadedValues
|
// this populates the LazyLoadedValues
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,11 @@ import java.util.stream.Collectors;
|
||||||
public class RecipeBookSearchTree extends DummySearchTree<RecipeCollection> {
|
public class RecipeBookSearchTree extends DummySearchTree<RecipeCollection> {
|
||||||
private final SearchTree<ItemStack> stackCollector;
|
private final SearchTree<ItemStack> stackCollector;
|
||||||
private Map<Item, List<RecipeCollection>> collectionsByItem = null;
|
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.stackCollector = stackCollector;
|
||||||
|
this.allCollections = allCollections;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<Item, List<RecipeCollection>> populateCollectionMap() {
|
private Map<Item, List<RecipeCollection>> populateCollectionMap() {
|
||||||
|
|
@ -27,7 +28,7 @@ public class RecipeBookSearchTree extends DummySearchTree<RecipeCollection> {
|
||||||
collections = new Object2ObjectOpenHashMap<>();
|
collections = new Object2ObjectOpenHashMap<>();
|
||||||
Map<Item, List<RecipeCollection>> finalCollection = collections;
|
Map<Item, List<RecipeCollection>> finalCollection = collections;
|
||||||
for(RecipeCollection collection : allCollections) {
|
for(RecipeCollection collection : allCollections) {
|
||||||
collection.getRecipes().stream().map(recipe -> recipe.getResultItem().getItem()).distinct().forEach(item -> {
|
collection.getRecipes().stream().map(recipe -> recipe.getResultItem(collection.registryAccess()).getItem()).distinct().forEach(item -> {
|
||||||
finalCollection.computeIfAbsent(item, k -> new ArrayList<>()).add(collection);
|
finalCollection.computeIfAbsent(item, k -> new ArrayList<>()).add(collection);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -36,16 +37,6 @@ public class RecipeBookSearchTree extends DummySearchTree<RecipeCollection> {
|
||||||
return collections;
|
return collections;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void add(RecipeCollection pObj) {
|
|
||||||
this.allCollections.add(pObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clear() {
|
|
||||||
this.allCollections.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
this.collectionsByItem = null;
|
this.collectionsByItem = null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user