use of shcm.shsupercm.fabric.citresewn.pack.cits.CITItem in project CITResewn by SHsuperCM.
the class ModelLoaderMixin method linkBakedCITItemModels.
@Inject(method = "upload", at = @At("RETURN"))
public void linkBakedCITItemModels(TextureManager textureManager, Profiler profiler, CallbackInfoReturnable<SpriteAtlasManager> cir) {
if (CITResewn.INSTANCE.activeCITs == null)
return;
profiler.push("citresewn_linking");
info("Linking baked models to CITItems...");
if (CITResewn.INSTANCE.activeCITs != null) {
for (CITItem citItem : CITResewn.INSTANCE.activeCITs.citItems.values().stream().flatMap(Collection::stream).distinct().collect(Collectors.toList())) {
for (Map.Entry<List<ModelOverride.Condition>, JsonUnbakedModel> citModelEntry : citItem.unbakedAssets.entrySet()) {
if (citModelEntry.getKey() == null) {
citItem.bakedModel = this.bakedModels.get(new ResewnItemModelIdentifier(citModelEntry.getValue().id));
} else {
BakedModel bakedModel = bakedModels.get(new ResewnItemModelIdentifier(citModelEntry.getValue().id));
if (bakedModel == null)
CITResewn.logWarnLoading("Skipping sub cit: Failed loading model for \"" + citModelEntry.getValue().id + "\" in " + citItem.pack.resourcePack.getName() + " -> " + citItem.propertiesIdentifier.getPath());
else
citItem.bakedSubModels.override(citModelEntry.getKey(), bakedModel);
}
}
citItem.unbakedAssets = null;
}
}
profiler.pop();
}
Aggregations