Item parallel model loading
This commit is contained in:
parent
185da209ce
commit
05b89607a5
1 changed files with 9 additions and 11 deletions
|
@ -90,17 +90,15 @@ public abstract class ModelBakeryMixin {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Registry.ITEM.forEach(item -> {
|
Registry.ITEM.stream().filter(item -> item instanceof ItemModelProvider).parallel().forEach(item -> {
|
||||||
if (item instanceof ItemModelProvider) {
|
ResourceLocation registryID = Registry.ITEM.getKey(item);
|
||||||
ResourceLocation registryID = Registry.ITEM.getKey(item);
|
ResourceLocation storageID = new ResourceLocation(registryID.getNamespace(), "models/item/" + registryID.getPath() + ".json");
|
||||||
ResourceLocation storageID = new ResourceLocation(registryID.getNamespace(), "models/item/" + registryID.getPath() + ".json");
|
if (!resourceManager.hasResource(storageID)) {
|
||||||
if (!resourceManager.hasResource(storageID)) {
|
ResourceLocation itemID = new ModelResourceLocation(registryID.getNamespace(), registryID.getPath(), "inventory");
|
||||||
ResourceLocation itemID = new ModelResourceLocation(registryID.getNamespace(), registryID.getPath(), "inventory");
|
ItemModelProvider provider = (ItemModelProvider) item;
|
||||||
ItemModelProvider provider = (ItemModelProvider) item;
|
BlockModel model = provider.getItemModel(registryID);
|
||||||
BlockModel model = provider.getItemModel(registryID);
|
cache.put(itemID, model);
|
||||||
cache.put(itemID, model);
|
topLevel.put(itemID, model);
|
||||||
topLevel.put(itemID, model);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue