mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-31 12:56:28 +00:00
歇一歇
This commit is contained in:
@@ -51,7 +51,7 @@ public class BukkitAdvancementManager extends AbstractAdvancementManager {
|
||||
@Override
|
||||
public void parseSection(Pack pack, Path path, Key id, Map<String, Object> section) {
|
||||
if (advancements.containsKey(id)) {
|
||||
throw new LocalizedResourceConfigException("warning.config.advancement.duplicated", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.advancement.duplicate", path, id);
|
||||
}
|
||||
JsonElement jsonTree = GsonHelper.get().toJsonTree(section);
|
||||
FastNMS.INSTANCE.registerAdvancement(id.decompose(), jsonTree);
|
||||
|
||||
@@ -332,7 +332,7 @@ public class BukkitBlockManager extends AbstractBlockManager {
|
||||
public void parseSection(Pack pack, Path path, Key id, Map<String, Object> section) {
|
||||
// check duplicated config
|
||||
if (byId.containsKey(id)) {
|
||||
throw new LocalizedResourceConfigException("warning.config.block.duplicated", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.block.duplicate", path, id);
|
||||
}
|
||||
// read block settings
|
||||
BlockSettings settings = BlockSettings.fromMap(MiscUtils.castToMap(section.getOrDefault("settings", Map.of()), false));
|
||||
@@ -349,7 +349,7 @@ public class BukkitBlockManager extends AbstractBlockManager {
|
||||
properties = Map.of();
|
||||
int internalId = ResourceConfigUtils.getAsInt(stateSection.getOrDefault("id", -1), "id");
|
||||
if (internalId < 0) {
|
||||
throw new LocalizedResourceConfigException("warning.config.block.state.lack_real_id", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.block.state.missing_real_id", path, id);
|
||||
}
|
||||
|
||||
Pair<Key, Integer> pair = parseAppearanceSection(pack, path, id, stateSection);
|
||||
@@ -360,7 +360,7 @@ public class BukkitBlockManager extends AbstractBlockManager {
|
||||
Key internalBlockId = Key.of(CraftEngine.NAMESPACE, internalBlock);
|
||||
int internalBlockRegistryId = Optional.ofNullable(internalId2StateId.get(internalBlockId)).orElse(-1);
|
||||
if (internalBlockRegistryId == -1) {
|
||||
throw new LocalizedResourceConfigException("warning.config.block.state.invalid_real_state_id", path, id,
|
||||
throw new LocalizedResourceConfigException("warning.config.block.state.invalid_real_id", path, id,
|
||||
internalBlock,
|
||||
String.valueOf(registeredRealBlockSlots.get(pair.left()) - 1));
|
||||
}
|
||||
@@ -369,18 +369,18 @@ public class BukkitBlockManager extends AbstractBlockManager {
|
||||
// states
|
||||
Map<String, Object> statesSection = MiscUtils.castToMap(section.get("states"), true);
|
||||
if (statesSection == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.block.lack_state", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.block.missing_state", path, id);
|
||||
}
|
||||
// properties
|
||||
Map<String, Object> propertySection = MiscUtils.castToMap(statesSection.get("properties"), true);
|
||||
if (propertySection == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.block.state.lack_properties", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.block.state.missing_properties", path, id);
|
||||
}
|
||||
properties = parseProperties(path, id, propertySection);
|
||||
properties = parseProperties(propertySection);
|
||||
// appearance
|
||||
Map<String, Object> appearancesSection = MiscUtils.castToMap(statesSection.get("appearances"), true);
|
||||
if (appearancesSection == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.block.state.lack_appearances", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.block.state.missing_appearances", path, id);
|
||||
}
|
||||
appearances = new HashMap<>();
|
||||
Map<String, Key> tempTypeMap = new HashMap<>();
|
||||
@@ -395,7 +395,7 @@ public class BukkitBlockManager extends AbstractBlockManager {
|
||||
// variants
|
||||
Map<String, Object> variantsSection = MiscUtils.castToMap(statesSection.get("variants"), true);
|
||||
if (variantsSection == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.block.state.lack_variants", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.block.state.missing_variants", path, id);
|
||||
}
|
||||
variants = new HashMap<>();
|
||||
for (Map.Entry<String, Object> variantEntry : variantsSection.entrySet()) {
|
||||
@@ -404,7 +404,7 @@ public class BukkitBlockManager extends AbstractBlockManager {
|
||||
String variantName = variantEntry.getKey();
|
||||
String appearance = (String) variantSection.get("appearance");
|
||||
if (appearance == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.block.state.variant.lack_appearance", path, id, variantName);
|
||||
throw new LocalizedResourceConfigException("warning.config.block.state.variant.missing_appearance", path, id, variantName);
|
||||
}
|
||||
if (!appearances.containsKey(appearance)) {
|
||||
throw new LocalizedResourceConfigException("warning.config.block.state.variant.invalid_appearance", path, id, variantName, appearance);
|
||||
@@ -414,7 +414,7 @@ public class BukkitBlockManager extends AbstractBlockManager {
|
||||
Key internalBlockId = Key.of(CraftEngine.NAMESPACE, baseBlock.value() + "_" + internalId);
|
||||
int internalBlockRegistryId = Optional.ofNullable(internalId2StateId.get(internalBlockId)).orElse(-1);
|
||||
if (internalBlockRegistryId == -1) {
|
||||
throw new LocalizedResourceConfigException("warning.config.block.state.invalid_real_state_id", path, id,
|
||||
throw new LocalizedResourceConfigException("warning.config.block.state.invalid_real_id", path, id,
|
||||
internalBlockId.toString(),
|
||||
String.valueOf(registeredRealBlockSlots.getOrDefault(baseBlock, 1) - 1));
|
||||
}
|
||||
@@ -439,7 +439,7 @@ public class BukkitBlockManager extends AbstractBlockManager {
|
||||
for (ImmutableBlockState state : block.variantProvider().states()) {
|
||||
ImmutableBlockState previous = stateId2ImmutableBlockStates[state.customBlockState().registryId() - BlockStateUtils.vanillaStateSize()];
|
||||
if (previous != null && !previous.isEmpty()) {
|
||||
TranslationManager.instance().log("warning.config.block.state.bind_real_state", path.toString(), id.toString(), state.toString(), previous.toString());
|
||||
TranslationManager.instance().log("warning.config.block.state.bind_failed", path.toString(), id.toString(), state.toString(), previous.toString());
|
||||
continue;
|
||||
}
|
||||
stateId2ImmutableBlockStates[state.customBlockState().registryId() - BlockStateUtils.vanillaStateSize()] = state;
|
||||
@@ -458,19 +458,11 @@ public class BukkitBlockManager extends AbstractBlockManager {
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Property<?>> parseProperties(Path path, Key id, Map<String, Object> propertiesSection) {
|
||||
private Map<String, Property<?>> parseProperties(Map<String, Object> propertiesSection) {
|
||||
Map<String, Property<?>> properties = new HashMap<>();
|
||||
for (Map.Entry<String, Object> entry : propertiesSection.entrySet()) {
|
||||
if (entry.getValue() instanceof Map<?, ?> params) {
|
||||
try {
|
||||
Property<?> property = Properties.fromMap(entry.getKey(), MiscUtils.castToMap(params, false));
|
||||
properties.put(entry.getKey(), property);
|
||||
} catch (Exception e) {
|
||||
TranslationManager.instance().log("warning.config.block.state.invalid_property", path.toString(), id.toString(), entry.getKey(), e.getMessage());
|
||||
}
|
||||
} else {
|
||||
TranslationManager.instance().log("warning.config.block.state.invalid_property_structure", path.toString(), id.toString(), entry.getKey());
|
||||
}
|
||||
Property<?> property = Properties.fromMap(entry.getKey(), MiscUtils.castToMap(entry.getValue(), false));
|
||||
properties.put(entry.getKey(), property);
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
@@ -478,15 +470,14 @@ public class BukkitBlockManager extends AbstractBlockManager {
|
||||
@Nullable
|
||||
private Pair<Key, Integer> parseAppearanceSection(Pack pack, Path path, Key id, Map<String, Object> section) {
|
||||
// require state non null
|
||||
String vanillaStateString = (String) section.get("state");
|
||||
Object vanillaStateString = section.get("state");
|
||||
if (vanillaStateString == null) {
|
||||
TranslationManager.instance().log("warning.config.block.state.lack_state", path.toString(), id.toString());
|
||||
return null;
|
||||
throw new LocalizedResourceConfigException("warning.config.block.state.missing_state", path, id);
|
||||
}
|
||||
|
||||
// get its registry id
|
||||
int vanillaStateRegistryId;
|
||||
VanillaStateParseResult parseResult = parseVanillaStateRegistryId(vanillaStateString);
|
||||
VanillaStateParseResult parseResult = parseVanillaStateRegistryId(vanillaStateString.toString());
|
||||
if (parseResult.success()) {
|
||||
vanillaStateRegistryId = parseResult.result;
|
||||
} else {
|
||||
@@ -506,10 +497,12 @@ public class BukkitBlockManager extends AbstractBlockManager {
|
||||
}
|
||||
|
||||
// require models not to be null
|
||||
Object models = section.getOrDefault("models", section.get("model"));
|
||||
Object models = section.get("models");
|
||||
if (models == null) {
|
||||
TranslationManager.instance().log("warning.config.block.state.no_model_set", path.toString(), id.toString());
|
||||
return null;
|
||||
models = section.get("model");
|
||||
}
|
||||
if (models == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.block.state.missing_model", path, id);
|
||||
}
|
||||
|
||||
List<JsonObject> variants = new ArrayList<>();
|
||||
@@ -547,12 +540,10 @@ public class BukkitBlockManager extends AbstractBlockManager {
|
||||
JsonObject json = new JsonObject();
|
||||
String modelPath = (String) singleModelMap.get("path");
|
||||
if (modelPath == null) {
|
||||
TranslationManager.instance().log("warning.config.block.state.model.lack_path", path.toString(), id.toString());
|
||||
return;
|
||||
throw new LocalizedResourceConfigException("warning.config.block.state.model.missing_path");
|
||||
}
|
||||
if (!ResourceLocation.isValid(modelPath)) {
|
||||
TranslationManager.instance().log("warning.config.block.state.model.invalid_resource_location", path.toString(), id.toString(), modelPath);
|
||||
return;
|
||||
throw new LocalizedResourceConfigException("warning.config.block.state.model.invalid_path", modelPath);
|
||||
}
|
||||
json.addProperty("model", modelPath);
|
||||
if (singleModelMap.containsKey("x")) json.addProperty("x", ResourceConfigUtils.getAsInt(singleModelMap.get("x"), "x"));
|
||||
@@ -561,7 +552,7 @@ public class BukkitBlockManager extends AbstractBlockManager {
|
||||
if (singleModelMap.containsKey("weight")) json.addProperty("weight", ResourceConfigUtils.getAsInt(singleModelMap.get("weight"), "weight"));
|
||||
Map<String, Object> generationMap = MiscUtils.castToMap(singleModelMap.get("generation"), true);
|
||||
if (generationMap != null) {
|
||||
prepareModelGeneration(path, id, new ModelGeneration(Key.of(modelPath), generationMap));
|
||||
prepareModelGeneration(new ModelGeneration(Key.of(modelPath), generationMap));
|
||||
}
|
||||
variants.add(json);
|
||||
}
|
||||
@@ -569,33 +560,33 @@ public class BukkitBlockManager extends AbstractBlockManager {
|
||||
private VanillaStateParseResult parseVanillaStateRegistryId(String blockState) {
|
||||
String[] split = blockState.split(":", 3);
|
||||
if (split.length >= 4) {
|
||||
return VanillaStateParseResult.failure("warning.config.block.state.invalid_state", new String[]{blockState});
|
||||
return VanillaStateParseResult.failure("warning.config.block.state.invalid_vanilla", new String[]{blockState});
|
||||
}
|
||||
int registryId;
|
||||
String stateOrId = split[split.length - 1];
|
||||
boolean isId = !stateOrId.contains("[") && !stateOrId.contains("]");
|
||||
if (isId) {
|
||||
if (split.length == 1) return VanillaStateParseResult.failure("warning.config.block.state.invalid_state", new String[]{blockState});
|
||||
if (split.length == 1) return VanillaStateParseResult.failure("warning.config.block.state.invalid_vanilla", new String[]{blockState});
|
||||
Key block = split.length == 2 ? Key.of(split[0]) : Key.of(split[0], split[1]);
|
||||
try {
|
||||
int id = split.length == 2 ? Integer.parseInt(split[1]) : Integer.parseInt(split[2]);
|
||||
if (id < 0) return VanillaStateParseResult.failure("warning.config.block.state.invalid_state", new String[]{blockState});
|
||||
if (id < 0) return VanillaStateParseResult.failure("warning.config.block.state.invalid_vanilla", new String[]{blockState});
|
||||
List<Integer> arranger = this.blockAppearanceArranger.get(block);
|
||||
if (arranger == null) return VanillaStateParseResult.failure("warning.config.block.state.unavailable_state", new String[]{blockState});
|
||||
if (id >= arranger.size()) return VanillaStateParseResult.failure("warning.config.block.state.invalid_vanilla_state_id", new String[]{blockState, String.valueOf(arranger.size() - 1)});
|
||||
if (arranger == null) return VanillaStateParseResult.failure("warning.config.block.state.unavailable_vanilla", new String[]{blockState});
|
||||
if (id >= arranger.size()) return VanillaStateParseResult.failure("warning.config.block.state.invalid_vanilla_id", new String[]{blockState, String.valueOf(arranger.size() - 1)});
|
||||
registryId = arranger.get(id);
|
||||
} catch (NumberFormatException e) {
|
||||
return VanillaStateParseResult.failure("warning.config.block.state.invalid_state", new String[]{blockState});
|
||||
return VanillaStateParseResult.failure("warning.config.block.state.invalid_vanilla", new String[]{blockState});
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
BlockData blockData = Bukkit.createBlockData(blockState);
|
||||
registryId = BlockStateUtils.blockDataToId(blockData);
|
||||
if (!this.blockAppearanceMapper.containsKey(registryId)) {
|
||||
return VanillaStateParseResult.failure("warning.config.block.state.unavailable_state", new String[]{blockState});
|
||||
return VanillaStateParseResult.failure("warning.config.block.state.unavailable_vanilla", new String[]{blockState});
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
return VanillaStateParseResult.failure("warning.config.block.state.invalid_state", new String[]{blockState});
|
||||
return VanillaStateParseResult.failure("warning.config.block.state.invalid_vanilla", new String[]{blockState});
|
||||
}
|
||||
}
|
||||
return VanillaStateParseResult.success(registryId);
|
||||
|
||||
@@ -157,7 +157,7 @@ public class ConcretePowderBlockBehavior extends FallingBlockBehavior {
|
||||
int hurtMax = ResourceConfigUtils.getAsInt(arguments.getOrDefault("max-hurt", -1), "max-hurt");
|
||||
String solidBlock = (String) arguments.get("solid-block");
|
||||
if (solidBlock == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.block.behavior.concrete.lack_solid_block", new NullPointerException("No `solid-block` specified for concrete powder block behavior"));
|
||||
throw new LocalizedResourceConfigException("warning.config.block.behavior.concrete.missing_solid", new NullPointerException("No `solid-block` specified for concrete powder block behavior"));
|
||||
}
|
||||
return new ConcretePowderBlockBehavior(block, hurtAmount, hurtMax, Key.of(solidBlock));
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ public class CropBlockBehavior extends BushBlockBehavior {
|
||||
Tuple<List<Object>, Set<Object>, Set<String>> tuple = readTagsAndState(arguments, false);
|
||||
Property<Integer> ageProperty = (Property<Integer>) block.getProperty("age");
|
||||
if (ageProperty == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.block.behavior.crop.lack_age", new IllegalArgumentException("age property not set for crop"));
|
||||
throw new LocalizedResourceConfigException("warning.config.block.behavior.crop.missing_age", new IllegalArgumentException("age property not set for crop"));
|
||||
}
|
||||
int minGrowLight = ResourceConfigUtils.getAsInt(arguments.getOrDefault("light-requirement", 9), "light-requirement");
|
||||
float growSpeed = ResourceConfigUtils.getAsFloat(arguments.getOrDefault("grow-speed", 0.125f), "grow-speed");
|
||||
|
||||
@@ -175,11 +175,11 @@ public class LeavesBlockBehavior extends WaterLoggedBlockBehavior {
|
||||
public BlockBehavior create(CustomBlock block, Map<String, Object> arguments) {
|
||||
Property<Boolean> persistent = (Property<Boolean>) block.getProperty("persistent");
|
||||
if (persistent == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.block.behavior.leaves.lack_persistent", new NullPointerException("persistent property not set for block " + block.id()));
|
||||
throw new LocalizedResourceConfigException("warning.config.block.behavior.leaves.missing_persistent", new NullPointerException("persistent property not set for block " + block.id()));
|
||||
}
|
||||
Property<Integer> distance = (Property<Integer>) block.getProperty("distance");
|
||||
if (distance == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.block.behavior.leaves.lack_distance", new NullPointerException("distance property not set for block " + block.id()));
|
||||
throw new LocalizedResourceConfigException("warning.config.block.behavior.leaves.missing_distance", new NullPointerException("distance property not set for block " + block.id()));
|
||||
}
|
||||
Property<Boolean> waterlogged = (Property<Boolean>) block.getProperty("waterlogged");
|
||||
int actual = distance.possibleValues().get(distance.possibleValues().size() - 1);
|
||||
|
||||
@@ -140,11 +140,11 @@ public class SaplingBlockBehavior extends BushBlockBehavior {
|
||||
public BlockBehavior create(CustomBlock block, Map<String, Object> arguments) {
|
||||
String feature = (String) arguments.get("feature");
|
||||
if (feature == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.block.behavior.sapling.lack_feature", new IllegalArgumentException("'feature' is required for sapling block behavior"));
|
||||
throw new LocalizedResourceConfigException("warning.config.block.behavior.sapling.missing_feature", new IllegalArgumentException("'feature' is required for sapling block behavior"));
|
||||
}
|
||||
Property<Integer> stageProperty = (Property<Integer>) block.getProperty("stage");
|
||||
if (stageProperty == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.block.behavior.sapling.lack_stage", new IllegalArgumentException("stage property not set for sapling"));
|
||||
throw new LocalizedResourceConfigException("warning.config.block.behavior.sapling.missing_stage", new IllegalArgumentException("stage property not set for sapling"));
|
||||
}
|
||||
double boneMealSuccessChance = ResourceConfigUtils.getAsDouble(arguments.getOrDefault("bone-meal-success-chance", 0.45), "bone-meal-success-chance");
|
||||
Tuple<List<Object>, Set<Object>, Set<String>> tuple = readTagsAndState(arguments, false);
|
||||
|
||||
@@ -27,7 +27,7 @@ public class StrippableBlockBehavior extends BukkitBlockBehavior {
|
||||
public BlockBehavior create(CustomBlock block, Map<String, Object> arguments) {
|
||||
String stripped = (String) arguments.get("stripped");
|
||||
if (stripped == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.block.behavior.strippable.lack_stripped", new IllegalArgumentException("'stripped' is required for strippable block behavior"));
|
||||
throw new LocalizedResourceConfigException("warning.config.block.behavior.strippable.missing_stripped", new IllegalArgumentException("'stripped' is required for strippable block behavior"));
|
||||
}
|
||||
return new StrippableBlockBehavior(block, Key.of(stripped));
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ public class SugarCaneBlockBehavior extends BushBlockBehavior {
|
||||
Tuple<List<Object>, Set<Object>, Set<String>> tuple = readTagsAndState(arguments, false);
|
||||
Property<Integer> ageProperty = (Property<Integer>) block.getProperty("age");
|
||||
if (ageProperty == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.block.behavior.sugar_cane.lack_age", new IllegalArgumentException("'age' property not set for sugar cane block behavior"));
|
||||
throw new LocalizedResourceConfigException("warning.config.block.behavior.sugar_cane.missing_age", new IllegalArgumentException("'age' property not set for sugar cane block behavior"));
|
||||
}
|
||||
int maxHeight = ResourceConfigUtils.getAsInt(arguments.getOrDefault("max-height", 3), "max-height");
|
||||
List<String> nearbyLiquids = MiscUtils.getAsStringList(arguments.getOrDefault("required-adjacent-liquids", List.of()));
|
||||
|
||||
@@ -107,14 +107,14 @@ public class BukkitFurnitureManager extends AbstractFurnitureManager {
|
||||
@Override
|
||||
public void parseSection(Pack pack, Path path, Key id, Map<String, Object> section) {
|
||||
if (byId.containsKey(id)) {
|
||||
throw new LocalizedResourceConfigException("warning.config.furniture.duplicated", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.furniture.duplicate", path, id);
|
||||
}
|
||||
|
||||
Map<String, Object> lootMap = MiscUtils.castToMap(section.get("loot"), true);
|
||||
Map<String, Object> settingsMap = MiscUtils.castToMap(section.get("settings"), true);
|
||||
Map<String, Object> placementMap = MiscUtils.castToMap(section.get("placement"), true);
|
||||
if (placementMap == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.furniture.lack_placement", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.furniture.missing_placement", path, id);
|
||||
}
|
||||
|
||||
EnumMap<AnchorType, CustomFurniture.Placement> placements = new EnumMap<>(AnchorType.class);
|
||||
@@ -130,7 +130,7 @@ public class BukkitFurnitureManager extends AbstractFurnitureManager {
|
||||
for (Map<String, Object> element : elementConfigs) {
|
||||
String key = (String) element.get("item");
|
||||
if (key == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.furniture.element.lack_item", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.furniture.element.missing_item", path, id);
|
||||
}
|
||||
ItemDisplayContext transform = ItemDisplayContext.valueOf(element.getOrDefault("transform", "NONE").toString().toUpperCase(Locale.ENGLISH));
|
||||
Billboard billboard = Billboard.valueOf(element.getOrDefault("billboard", "FIXED").toString().toUpperCase(Locale.ENGLISH));
|
||||
|
||||
@@ -240,7 +240,7 @@ public class BukkitItemManager extends AbstractItemManager<ItemStack> {
|
||||
@Override
|
||||
public void parseSection(Pack pack, Path path, Key id, Map<String, Object> section) {
|
||||
if (customItems.containsKey(id)) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.duplicated", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.item.duplicate", path, id);
|
||||
}
|
||||
|
||||
// register for recipes
|
||||
@@ -253,7 +253,7 @@ public class BukkitItemManager extends AbstractItemManager<ItemStack> {
|
||||
if (isVanillaItem)
|
||||
materialStringId = id.value();
|
||||
if (materialStringId == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.lack_material", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.item.missing_material", path, id);
|
||||
}
|
||||
|
||||
Material material = MaterialUtils.getMaterial(materialStringId);
|
||||
@@ -395,14 +395,14 @@ public class BukkitItemManager extends AbstractItemManager<ItemStack> {
|
||||
}
|
||||
|
||||
if (customModelData > 16_777_216) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.bad_custom_model_data_value", path, id, String.valueOf(customModelData));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.bad_custom_model_data", path, id, String.valueOf(customModelData));
|
||||
}
|
||||
|
||||
conflict.put(customModelData, id);
|
||||
|
||||
// Parse models
|
||||
for (ModelGeneration generation : model.modelsToGenerate()) {
|
||||
prepareModelGeneration(path, id, generation);
|
||||
prepareModelGeneration(generation);
|
||||
}
|
||||
|
||||
if (Config.packMaxVersion() > 21.39f) {
|
||||
@@ -420,7 +420,7 @@ public class BukkitItemManager extends AbstractItemManager<ItemStack> {
|
||||
if (itemModelKey != null) {
|
||||
hasModel = true;
|
||||
for (ModelGeneration generation : model.modelsToGenerate()) {
|
||||
prepareModelGeneration(path, id, generation);
|
||||
prepareModelGeneration(generation);
|
||||
}
|
||||
|
||||
if (Config.packMaxVersion() > 21.39f) {
|
||||
@@ -439,7 +439,7 @@ public class BukkitItemManager extends AbstractItemManager<ItemStack> {
|
||||
}
|
||||
}
|
||||
if (!hasModel) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.lack_model_id", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.item.missing_model_id", path, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ public class BlockItemBehavior extends ItemBehavior {
|
||||
public ItemBehavior create(Pack pack, Path path, Key key, Map<String, Object> arguments) {
|
||||
Object id = arguments.get("block");
|
||||
if (id == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.behavior.block.lack_block", new IllegalArgumentException("Missing required parameter 'block' for block_item behavior"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.behavior.block.missing_block", new IllegalArgumentException("Missing required parameter 'block' for block_item behavior"));
|
||||
}
|
||||
if (id instanceof Map<?, ?> map) {
|
||||
if (map.containsKey(key.toString())) {
|
||||
|
||||
@@ -155,7 +155,7 @@ public class FurnitureItemBehavior extends ItemBehavior {
|
||||
public ItemBehavior create(Pack pack, Path path, Key key, Map<String, Object> arguments) {
|
||||
Object id = arguments.get("furniture");
|
||||
if (id == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.behavior.furniture.lack_furniture", new IllegalArgumentException("Missing required parameter 'furniture' for furniture_item behavior"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.behavior.furniture.missing_furniture", new IllegalArgumentException("Missing required parameter 'furniture' for furniture_item behavior"));
|
||||
}
|
||||
if (id instanceof Map<?,?> map) {
|
||||
if (map.containsKey(key.toString())) {
|
||||
|
||||
@@ -65,7 +65,7 @@ public class LiquidCollisionBlockItemBehavior extends BlockItemBehavior {
|
||||
public ItemBehavior create(Pack pack, Path path, Key key, Map<String, Object> arguments) {
|
||||
Object id = arguments.get("block");
|
||||
if (id == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.behavior.liquid_collision_block.lack_block", new IllegalArgumentException("Missing required parameter 'block' for liquid_collision_block_item behavior"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.behavior.liquid_collision.missing_block", new IllegalArgumentException("Missing required parameter 'block' for liquid_collision_block_item behavior"));
|
||||
}
|
||||
int offset = ResourceConfigUtils.getAsInt(arguments.getOrDefault("y-offset", 1), "y-offset");
|
||||
if (id instanceof Map<?, ?> map) {
|
||||
|
||||
@@ -110,7 +110,7 @@ public class BukkitVanillaLootManager extends AbstractVanillaLootManager impleme
|
||||
public void parseSection(Pack pack, Path path, Key id, Map<String, Object> section) {
|
||||
String type = (String) section.get("type");
|
||||
if (type == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.vanilla_loot.type_not_exist", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.vanilla_loot.missing_type", path, id);
|
||||
}
|
||||
VanillaLoot.Type typeEnum = VanillaLoot.Type.valueOf(type.toUpperCase(Locale.ENGLISH));
|
||||
boolean override = (boolean) section.getOrDefault("override", false);
|
||||
|
||||
Reference in New Issue
Block a user