9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-23 00:49:20 +00:00
This commit is contained in:
XiaoMoMi
2025-04-28 22:47:18 +08:00
parent 0c24100350
commit adb1eb832b
9 changed files with 40 additions and 91 deletions

View File

@@ -79,7 +79,7 @@ warning.config.image.lack_char: "<yellow>Issue found in file <arg:0> - The image
warning.config.image.codepoint_in_use: "<yellow>Issue found in file <arg:0> - The image '<arg:1>' is using a character[<arg:3>(<arg:4>)] in font <arg:2> that has been used by another image '<arg:5>'.</yellow>"
warning.config.image.invalid_codepoint_grid: "<yellow>Issue found in file <arg:0> - Image '<arg:1>' has an invalid 'chars' codepoint grind.</yellow>"
warning.config.image.file_not_exist: "<yellow>Issue found in file <arg:0> - PNG file '<arg:2>' not found for image '<arg:1>'.</yellow>"
warning.config.image.invalid_hex: "<yellow>Issue found in file <arg:0> - The image '<arg:1>' is using an unicode character '<arg:2>' that is not a valid hexadecimal (radix 16) value.</yellow>"
warning.config.image.invalid_hex: "<yellow>Issue found in file <arg:0> - The image '<arg:1>' is using a unicode character '<arg:2>' that is not a valid hexadecimal (radix 16) value.</yellow>"
warning.config.recipe.duplicated: "<yellow>Issue found in file <arg:0> - Duplicated recipe '<arg:1>'.</yellow>"
warning.config.recipe.lack_type: "<yellow>Issue found in file <arg:0> - The recipe '<arg:1>' is missing the required argument 'type'.</yellow>"
warning.config.recipe.invalid_type: "<yellow>Issue found in file <arg:0> - The recipe '<arg:1>' is using an invalid recipe type '<arg:2>'.</yellow>"

View File

@@ -335,24 +335,10 @@ public class BukkitBlockManager extends AbstractBlockManager {
throw new LocalizedResourceConfigException("warning.config.block.duplicated", path, id);
}
// read block settings
BlockSettings settings;
try {
settings = BlockSettings.fromMap(MiscUtils.castToMap(section.getOrDefault("settings", Map.of()), false));
} catch (LocalizedResourceConfigException e) {
e.setPath(path);
e.setId(id);
throw e;
}
BlockSettings settings = BlockSettings.fromMap(MiscUtils.castToMap(section.getOrDefault("settings", Map.of()), false));
// read loot table
LootTable<ItemStack> lootTable;
try {
lootTable = LootTable.fromMap(MiscUtils.castToMap(section.getOrDefault("loot", Map.of()), false));
} catch (LocalizedResourceConfigException e) {
e.setPath(path);
e.setId(id);
throw e;
}
LootTable<ItemStack> lootTable = LootTable.fromMap(MiscUtils.castToMap(section.getOrDefault("loot", Map.of()), false));
// read states
Map<String, Property<?>> properties;
@@ -440,9 +426,7 @@ public class BukkitBlockManager extends AbstractBlockManager {
Map<String, Object> behaviors = MiscUtils.castToMap(section.getOrDefault("behavior", Map.of()), false);
CustomBlock block;
try {
block = BukkitCustomBlock.builder(id)
CustomBlock block = BukkitCustomBlock.builder(id)
.appearances(appearances)
.variantMapper(variants)
.lootTable(lootTable)
@@ -450,11 +434,6 @@ public class BukkitBlockManager extends AbstractBlockManager {
.settings(settings)
.behavior(behaviors)
.build();
} catch (LocalizedResourceConfigException e) {
e.setPath(path);
e.setId(id);
throw e;
}
// bind appearance and real state
for (ImmutableBlockState state : block.variantProvider().states()) {

View File

@@ -157,14 +157,8 @@ public class BukkitFurnitureManager extends AbstractFurnitureManager {
List<Map<String, Object>> hitboxConfigs = (List<Map<String, Object>>) placementArguments.getOrDefault("hitboxes", List.of());
List<HitBox> hitboxes = new ArrayList<>();
for (Map<String, Object> config : hitboxConfigs) {
try {
HitBox hitBox = HitBoxTypes.fromMap(config);
hitboxes.add(hitBox);
} catch (LocalizedResourceConfigException e) {
e.setPath(path);
e.setId(id);
throw e;
}
HitBox hitBox = HitBoxTypes.fromMap(config);
hitboxes.add(hitBox);
}
if (hitboxes.isEmpty() && externalModel.isEmpty()) {
hitboxes.add(InteractionHitBox.DEFAULT);
@@ -198,24 +192,10 @@ public class BukkitFurnitureManager extends AbstractFurnitureManager {
}
// get furniture settings
FurnitureSettings settings;
try {
settings = FurnitureSettings.fromMap(settingsMap);
} catch (LocalizedResourceConfigException e) {
e.setPath(path);
e.setId(id);
throw e;
}
FurnitureSettings settings = FurnitureSettings.fromMap(settingsMap);
// get loot table
LootTable<ItemStack> lootTable;
try {
lootTable = lootMap == null ? null : LootTable.fromMap(lootMap);
} catch (LocalizedResourceConfigException e) {
e.setPath(path);
e.setId(id);
throw e;
}
LootTable<ItemStack> lootTable = lootMap == null ? null : LootTable.fromMap(lootMap);
CustomFurniture furniture = new CustomFurniture(id, settings, placements, lootTable);
byId.put(id, furniture);
}

View File

@@ -339,15 +339,7 @@ public class BukkitItemManager extends AbstractItemManager<ItemStack> {
}
}
ItemSettings itemSettings;
try {
itemSettings = ItemSettings.fromMap(MiscUtils.castToMap(section.get("settings"), true));
} catch (LocalizedResourceConfigException e) {
e.setPath(path);
e.setId(id);
throw e;
}
ItemSettings itemSettings = ItemSettings.fromMap(MiscUtils.castToMap(section.get("settings"), true));
if (isVanillaItem) {
itemSettings.canPlaceRelatedVanillaBlock(true);
}
@@ -391,15 +383,7 @@ public class BukkitItemManager extends AbstractItemManager<ItemStack> {
return;
}
ItemModel model;
try {
model = ItemModels.fromMap(modelSection);
} catch (LocalizedResourceConfigException e) {
e.setPath(path);
e.setId(id);
throw e;
}
ItemModel model = ItemModels.fromMap(modelSection);
boolean hasModel = false;
if (customModelData != 0) {
hasModel= true;