9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-28 19:39:11 +00:00

预防未启用基于纹饰盔甲时,锁链甲产生的网络问题

This commit is contained in:
XiaoMoMi
2025-11-09 14:59:46 +08:00
parent 939db3b3b3
commit 74d20d8483
2 changed files with 12 additions and 7 deletions

View File

@@ -501,10 +501,17 @@ public class ComponentItemFactory1_20_5 extends BukkitItemFactory<ComponentItemW
if (trim == null) {
item.resetComponent(DataComponentTypes.TRIM);
} else {
item.setJavaComponent(DataComponentTypes.TRIM, Map.of(
"pattern", trim.pattern().asString(),
"material", trim.material().asString()
));
try {
item.setJavaComponent(DataComponentTypes.TRIM, Map.of(
"pattern", trim.pattern().asString(),
"material", trim.material().asString()
));
} catch (Exception e) {
// 预防未启用基于纹饰盔甲时,锁链甲可能产生的网络问题(由用户配置决定)
if (!trim.material().equals(Key.of("minecraft", "custom")) && !trim.pattern().equals(Key.of("minecraft", "chainmail"))) {
this.plugin.logger().warn("Failed to apply trim " + trim, e);
}
}
}
}

View File

@@ -2,6 +2,4 @@ author: XiaoMoMi
version: 0.0.1
description: Fix broken vanilla armor
namespace: minecraft
enable:
$$>=1.21.2: false
$$<1.21.2: true
enable: false