mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2026-01-06 15:52:03 +00:00
应当支持trim
This commit is contained in:
@@ -672,7 +672,7 @@ public abstract class AbstractItemManager<I> extends AbstractModelGenerator impl
|
|||||||
List<String> cases = entry.getKey().fallbackOrMapPrimary(List::of);
|
List<String> cases = entry.getKey().fallbackOrMapPrimary(List::of);
|
||||||
for (String caseValue : cases) {
|
for (String caseValue : cases) {
|
||||||
Number legacyValue = predicate.toLegacyValue(caseValue);
|
Number legacyValue = predicate.toLegacyValue(caseValue);
|
||||||
if (predicate instanceof TrimMaterialSelectProperty property && property.isArmor(materialId)) {
|
if (predicate instanceof TrimMaterialSelectProperty) {
|
||||||
if (legacyValue.floatValue() > 1f) {
|
if (legacyValue.floatValue() > 1f) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -713,7 +713,7 @@ public abstract class AbstractItemManager<I> extends AbstractModelGenerator impl
|
|||||||
materialId,
|
materialId,
|
||||||
customModelData
|
customModelData
|
||||||
);
|
);
|
||||||
} else if (predicate instanceof TrimMaterialSelectProperty property && property.isArmor(materialId)) {
|
} else if (predicate instanceof TrimMaterialSelectProperty) {
|
||||||
processModelRecursively(
|
processModelRecursively(
|
||||||
model.fallBack(),
|
model.fallBack(),
|
||||||
mergePredicates(
|
mergePredicates(
|
||||||
|
|||||||
@@ -787,6 +787,7 @@ public abstract class AbstractPackManager implements PackManager {
|
|||||||
|
|
||||||
@SuppressWarnings("DuplicatedCode")
|
@SuppressWarnings("DuplicatedCode")
|
||||||
private void validateResourcePack(Path path) {
|
private void validateResourcePack(Path path) {
|
||||||
|
long time1 = System.currentTimeMillis();
|
||||||
Path[] rootPaths;
|
Path[] rootPaths;
|
||||||
try {
|
try {
|
||||||
rootPaths = FileUtils.collectOverlays(path).toArray(new Path[0]);
|
rootPaths = FileUtils.collectOverlays(path).toArray(new Path[0]);
|
||||||
@@ -917,6 +918,9 @@ public abstract class AbstractPackManager implements PackManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long time2 = System.currentTimeMillis();
|
||||||
|
this.plugin.debug(() -> "Took " + (time2 - time1) + "ms collecting assets");
|
||||||
|
|
||||||
// 验证font的贴图是否存在
|
// 验证font的贴图是否存在
|
||||||
label: for (Map.Entry<Key, Collection<Key>> entry : imageToFonts.asMap().entrySet()) {
|
label: for (Map.Entry<Key, Collection<Key>> entry : imageToFonts.asMap().entrySet()) {
|
||||||
Key key = entry.getKey();
|
Key key = entry.getKey();
|
||||||
@@ -930,6 +934,9 @@ public abstract class AbstractPackManager implements PackManager {
|
|||||||
TranslationManager.instance().log("warning.config.resource_pack.generation.missing_font_texture", entry.getValue().stream().distinct().toList().toString(), imagePath);
|
TranslationManager.instance().log("warning.config.resource_pack.generation.missing_font_texture", entry.getValue().stream().distinct().toList().toString(), imagePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long time3 = System.currentTimeMillis();
|
||||||
|
this.plugin.debug(() -> "Took " + (time3 - time2) + "ms verifying font textures");
|
||||||
|
|
||||||
// 验证物品模型是否存在,验证的同时去收集贴图
|
// 验证物品模型是否存在,验证的同时去收集贴图
|
||||||
label: for (Map.Entry<Key, Collection<Key>> entry : modelToItems.asMap().entrySet()) {
|
label: for (Map.Entry<Key, Collection<Key>> entry : modelToItems.asMap().entrySet()) {
|
||||||
Key modelResourceLocation = entry.getKey();
|
Key modelResourceLocation = entry.getKey();
|
||||||
@@ -975,6 +982,9 @@ public abstract class AbstractPackManager implements PackManager {
|
|||||||
TranslationManager.instance().log("warning.config.resource_pack.generation.missing_block_model", entry.getValue().stream().distinct().toList().toString(), modelPath);
|
TranslationManager.instance().log("warning.config.resource_pack.generation.missing_block_model", entry.getValue().stream().distinct().toList().toString(), modelPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long time4 = System.currentTimeMillis();
|
||||||
|
this.plugin.debug(() -> "Took " + (time4 - time3) + "ms verifying models and their parents");
|
||||||
|
|
||||||
// 验证贴图是否存在
|
// 验证贴图是否存在
|
||||||
boolean enableObf = Config.enableObfuscation() && Config.enableRandomResourceLocation();
|
boolean enableObf = Config.enableObfuscation() && Config.enableRandomResourceLocation();
|
||||||
label: for (Map.Entry<Key, Collection<Key>> entry : imageToModels.asMap().entrySet()) {
|
label: for (Map.Entry<Key, Collection<Key>> entry : imageToModels.asMap().entrySet()) {
|
||||||
@@ -1007,6 +1017,9 @@ public abstract class AbstractPackManager implements PackManager {
|
|||||||
TranslationManager.instance().log("warning.config.resource_pack.generation.texture_not_in_atlas", key.toString());
|
TranslationManager.instance().log("warning.config.resource_pack.generation.texture_not_in_atlas", key.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long time5 = System.currentTimeMillis();
|
||||||
|
this.plugin.debug(() -> "Took " + (time5 - time4) + "ms verifying model textures");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyParentModelAndCollectTextures(Key sourceModelLocation, JsonObject sourceModelJson, Path[] rootPaths, Multimap<Key, Key> imageToModels, Set<Key> collected) {
|
private void verifyParentModelAndCollectTextures(Key sourceModelLocation, JsonObject sourceModelJson, Path[] rootPaths, Multimap<Key, Key> imageToModels, Set<Key> collected) {
|
||||||
|
|||||||
@@ -39,10 +39,7 @@ public class TrimMaterialSelectProperty implements SelectProperty, LegacyModelPr
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String legacyPredicateId(Key material) {
|
public String legacyPredicateId(Key material) {
|
||||||
if (isArmor(material)) {
|
return "trim_type";
|
||||||
return "trim_type";
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -54,11 +51,6 @@ public class TrimMaterialSelectProperty implements SelectProperty, LegacyModelPr
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isArmor(Key material) {
|
|
||||||
String s = material.toString();
|
|
||||||
return s.contains("helmet") || s.contains("chestplate") || s.contains("leggings") || s.contains("boots");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Factory implements SelectPropertyFactory {
|
public static class Factory implements SelectPropertyFactory {
|
||||||
@Override
|
@Override
|
||||||
public SelectProperty create(Map<String, Object> arguments) {
|
public SelectProperty create(Map<String, Object> arguments) {
|
||||||
|
|||||||
Reference in New Issue
Block a user