aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/shcm/shsupercm/fabric/citresewn
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2021-09-07 12:33:37 +0300
committerSHsuperCM <shsupercm@gmail.com>2021-09-07 12:33:37 +0300
commit197b26bcb40e337e649c7d0bf9a942b2fbcaffe6 (patch)
treee9da32a2ac70ac910de61a5349204b03d4d979f4 /src/main/java/shcm/shsupercm/fabric/citresewn
parenta69a294e7b0abaadb23989a3b24dd502e5cb6771 (diff)
downloadCITResewn-197b26bcb40e337e649c7d0bf9a942b2fbcaffe6.tar.gz
CITResewn-197b26bcb40e337e649c7d0bf9a942b2fbcaffe6.tar.bz2
CITResewn-197b26bcb40e337e649c7d0bf9a942b2fbcaffe6.zip
v0.5.0, added more log info
Diffstat (limited to 'src/main/java/shcm/shsupercm/fabric/citresewn')
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/CITResewn.java4
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ModelLoaderMixin.java41
2 files changed, 30 insertions, 15 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/CITResewn.java b/src/main/java/shcm/shsupercm/fabric/citresewn/CITResewn.java
index 68ecbe5..d96de20 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/CITResewn.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/CITResewn.java
@@ -27,6 +27,10 @@ public class CITResewn implements ClientModInitializer {
config = CITResewnConfig.read();
}
+ public static void info(String message) {
+ LOG.info(message);
+ }
+
public static void logErrorLoading(String message) {
if (CITResewnConfig.INSTANCE().mute_errors)
return;
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ModelLoaderMixin.java b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ModelLoaderMixin.java
index e01aec8..af55496 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ModelLoaderMixin.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/ModelLoaderMixin.java
@@ -34,6 +34,8 @@ import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.stream.Collectors;
+import static shcm.shsupercm.fabric.citresewn.CITResewn.info;
+
@Mixin(ModelLoader.class)
public abstract class ModelLoaderMixin {
@Shadow @Final private ResourceManager resourceManager;
@@ -46,8 +48,9 @@ public abstract class ModelLoaderMixin {
private Map<Identifier, BakedModel> citOverrideCacheMap = new HashMap<>();
@Inject(method = "addModel", at = @At("TAIL"))
- public void addCITModels(ModelIdentifier eventModelId, CallbackInfo ci) { if (eventModelId != ModelLoader.MISSING_ID) return;
+ public void loadCIT(ModelIdentifier eventModelId, CallbackInfo ci) { if (eventModelId != ModelLoader.MISSING_ID) return;
if (CITResewn.INSTANCE.activeCITs != null) {
+ info("Clearing active CITs..");
CITResewn.INSTANCE.activeCITs.dispose();
CITResewn.INSTANCE.activeCITs = null;
}
@@ -55,26 +58,33 @@ public abstract class ModelLoaderMixin {
if (!CITResewnConfig.INSTANCE().enabled)
return;
- Collection<CIT> parsed = CITParser.parse(resourceManager.streamResourcePacks().collect(Collectors.toCollection(ArrayList::new)));
+ info("Loading CIT Resewn..");
- for (CIT cit : parsed)
- if (cit instanceof CITItem citItem) {
- try {
- citItem.loadUnbakedAssets(resourceManager);
+ info("Parsing CITs...");
+ Collection<CIT> parsed = CITParser.parse(resourceManager.streamResourcePacks().collect(Collectors.toCollection(ArrayList::new)));
- for (JsonUnbakedModel unbakedModel : citItem.unbakedAssets.values()) {
- ResewnItemModelIdentifier id = new ResewnItemModelIdentifier(unbakedModel.id);
- this.unbakedModels.put(id, unbakedModel);
- this.modelsToLoad.addAll(unbakedModel.getModelDependencies());
- this.modelsToBake.put(id, unbakedModel);
+ if (parsed.size() > 0) {
+ info("Loading CITItem models..");
+ for (CIT cit : parsed)
+ if (cit instanceof CITItem citItem) {
+ try {
+ citItem.loadUnbakedAssets(resourceManager);
+
+ for (JsonUnbakedModel unbakedModel : citItem.unbakedAssets.values()) {
+ ResewnItemModelIdentifier id = new ResewnItemModelIdentifier(unbakedModel.id);
+ this.unbakedModels.put(id, unbakedModel);
+ this.modelsToLoad.addAll(unbakedModel.getModelDependencies());
+ this.modelsToBake.put(id, unbakedModel);
+ }
+ } catch (Exception e) {
+ CITResewn.logErrorLoading(e.getMessage());
}
- } catch (Exception e) {
- CITResewn.logErrorLoading(e.getMessage());
}
- }
- if (parsed.size() > 0)
+ info("Activating CITs...");
CITResewn.INSTANCE.activeCITs = new ActiveCITs(parsed);
+ } else
+ info("No cit packs found.");
}
@Inject(method = "bake", at = @At("RETURN"))
@@ -91,6 +101,7 @@ public abstract class ModelLoaderMixin {
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())) {