9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-25 01:49:30 +00:00

refactor(core): 优化物品隐藏属性功能

This commit is contained in:
jhqwqmc
2025-07-21 22:14:13 +08:00
parent a53875f331
commit c8f786a757

View File

@@ -62,15 +62,25 @@ public class HideTooltipModifier<I> implements ItemDataModifier<I> {
} else if (VersionHelper.isOrAbove1_20_5()) {
if (components.isEmpty()) {
this.applier = new DummyApplier<>();
} else if (components.size() == 1 && COMPONENTS.contains(components.getFirst())) {
this.applier = new SemiModernApplier<>(components.getFirst());
} else if (components.size() == 1) {
if (COMPONENTS.contains(components.getFirst())) {
this.applier = new SemiModernApplier<>(components.getFirst());
} else {
this.applier = new DummyApplier<>();
}
} else {
List<Applier<I>> appliers = new ArrayList<>();
for (Key key : components) {
if (!COMPONENTS.contains(key)) continue;
appliers.add(new SemiModernApplier<>(key));
}
this.applier = new CompoundApplier<>(appliers);
if (appliers.isEmpty()) {
this.applier = new DummyApplier<>();
} else if (appliers.size() == 1) {
this.applier = new SemiModernApplier<>(components.getFirst());
} else {
this.applier = new CompoundApplier<>(appliers);
}
}
} else {
this.applier = new LegacyApplier<>(components);