mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-30 20:39:10 +00:00
add warnings
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
package net.momirealms.craftengine.core.pack.model.generation;
|
||||
|
||||
import net.momirealms.craftengine.core.pack.ResourceLocation;
|
||||
import net.momirealms.craftengine.core.plugin.CraftEngine;
|
||||
import net.momirealms.craftengine.core.plugin.locale.TranslationManager;
|
||||
import net.momirealms.craftengine.core.util.Key;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -25,16 +28,20 @@ public abstract class AbstractModelGenerator implements ModelGenerator {
|
||||
this.modelsToGenerate.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepareModelGeneration(ModelGeneration model) {
|
||||
ModelGeneration generation = this.modelsToGenerate.get(model.path());
|
||||
if (generation != null) {
|
||||
if (generation.equals(model)) {
|
||||
public void prepareModelGeneration(Path path, Key id, ModelGeneration model) {
|
||||
ModelGeneration conflict = this.modelsToGenerate.get(model.path());
|
||||
if (conflict != null) {
|
||||
if (conflict.equals(model)) {
|
||||
return;
|
||||
}
|
||||
this.plugin.logger().severe("Two or more configurations attempt to generate different json models with the same path: " + model.path());
|
||||
TranslationManager.instance().log("warning.config.model.generation.conflict", path.toString(), id.toString(), model.path().toString());
|
||||
return;
|
||||
}
|
||||
for (Map.Entry<String, String> texture : model.texturesOverride().entrySet()) {
|
||||
if (!ResourceLocation.isValid(texture.getValue())) {
|
||||
TranslationManager.instance().log("warning.config.model.generation.texture.invalid_resource_location", path.toString(), id.toString(), texture.getKey(), texture.getValue());
|
||||
}
|
||||
}
|
||||
this.modelsToGenerate.put(model.path(), model);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,4 @@ public interface ModelGenerator {
|
||||
Collection<ModelGeneration> modelsToGenerate();
|
||||
|
||||
void clearModelsToGenerate();
|
||||
|
||||
void prepareModelGeneration(ModelGeneration model);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user