mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-31 12:56:28 +00:00
向外
This commit is contained in:
@@ -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()) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user