Skip to content

Commit

Permalink
Log an error if some models use armor models that are missing
Browse files Browse the repository at this point in the history
  • Loading branch information
KnightMiner committed May 17, 2024
1 parent 87f8bf9 commit 1c65ba8
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

public class ArmorModelManager extends SimpleJsonResourceReloadListener {
/** Folder containing the logic */
Expand Down Expand Up @@ -78,8 +80,16 @@ protected void apply(Map<ResourceLocation,JsonElement> splashList, ResourceManag

this.models = builder.build();
// clear dispatcher model cache
Set<ResourceLocation> missing = new HashSet<>();
for (ArmorModelDispatcher dispatcher : DISPATCHERS) {
dispatcher.model = null;
ResourceLocation name = dispatcher.getName();
if (!this.models.containsKey(name)) {
missing.add(name);
}
}
if (!missing.isEmpty()) {
TConstruct.LOG.error("Missing armor models used by items: {}", missing);
}
TConstruct.LOG.info("Loaded {} armor models in {} ms", models.size(), (System.nanoTime() - time) / 1000000f);
}
Expand Down

0 comments on commit 1c65ba8

Please sign in to comment.