9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-30 20:39:10 +00:00

food和返还物品

This commit is contained in:
XiaoMoMi
2025-06-08 19:54:25 +08:00
parent a5d6ce8107
commit 959515d023
3 changed files with 47 additions and 2 deletions

View File

@@ -36,6 +36,7 @@ public class ItemSettings {
boolean dyeable = true;
Helmet helmet = null;
FoodData foodData = null;
Key consumeReplacement = null;
private ItemSettings() {}
@@ -72,6 +73,7 @@ public class ItemSettings {
newSettings.dyeable = settings.dyeable;
newSettings.helmet = settings.helmet;
newSettings.foodData = settings.foodData;
newSettings.consumeReplacement = settings.consumeReplacement;
return newSettings;
}
@@ -124,6 +126,11 @@ public class ItemSettings {
return foodData;
}
@Nullable
public Key consumeReplacement() {
return consumeReplacement;
}
@Nullable
public Helmet helmet() {
return helmet;
@@ -139,6 +146,11 @@ public class ItemSettings {
return this;
}
public ItemSettings consumeReplacement(Key key) {
this.consumeReplacement = key;
return this;
}
public ItemSettings canRepair(boolean canRepair) {
this.canRepair = canRepair;
return this;
@@ -228,6 +240,7 @@ public class ItemSettings {
int intValue = ResourceConfigUtils.getAsInt(value, "fuel-time");
return settings -> settings.fuelTime(intValue);
}));
registerFactory("consume-replacement", (value -> settings -> settings.consumeReplacement(Key.of(value.toString()))));
registerFactory("tags", (value -> {
List<String> tags = MiscUtils.getAsStringList(value);
return settings -> settings.tags(tags.stream().map(Key::of).collect(Collectors.toSet()));