9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-27 02:49:15 +00:00

改进铁砧修复处理

This commit is contained in:
XiaoMoMi
2025-07-07 20:27:17 +08:00
parent 251f837e64
commit 71e3337a91
3 changed files with 67 additions and 29 deletions

View File

@@ -38,6 +38,7 @@ public class ItemSettings {
List<DamageSource> invulnerable = List.of();
boolean canEnchant = true;
float compostProbability= 0.5f;
boolean respectRepairableComponent = false;
@Nullable
ItemEquipment equipment;
@@ -97,6 +98,7 @@ public class ItemSettings {
newSettings.invulnerable = settings.invulnerable;
newSettings.canEnchant = settings.canEnchant;
newSettings.compostProbability = settings.compostProbability;
newSettings.respectRepairableComponent = settings.respectRepairableComponent;
return newSettings;
}
@@ -148,6 +150,10 @@ public class ItemSettings {
return anvilRepairItems;
}
public boolean respectRepairableComponent() {
return respectRepairableComponent;
}
@Nullable
public FoodData foodData() {
return foodData;
@@ -256,6 +262,11 @@ public class ItemSettings {
return this;
}
public ItemSettings respectRepairableComponent(boolean respectRepairableComponent) {
this.respectRepairableComponent = respectRepairableComponent;
return this;
}
public ItemSettings invulnerable(List<DamageSource> invulnerable) {
this.invulnerable = invulnerable;
return this;
@@ -375,6 +386,10 @@ public class ItemSettings {
boolean bool = ResourceConfigUtils.getAsBoolean(value, "dyeable");
return settings -> settings.dyeable(bool);
}));
registerFactory("respect-repairable-component", (value -> {
boolean bool = ResourceConfigUtils.getAsBoolean(value, "respect-repairable-component");
return settings -> settings.respectRepairableComponent(bool);
}));
registerFactory("food", (value -> {
Map<String, Object> args = MiscUtils.castToMap(value, false);
FoodData data = new FoodData(