mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-23 17:09:19 +00:00
歇一歇
This commit is contained in:
@@ -70,7 +70,7 @@ warning.config.type.float: "<yellow>Issue found in file <arg:0> - Failed to load
|
||||
warning.config.type.double: "<yellow>Issue found in file <arg:0> - Failed to load '<arg:1>': Cannot cast '<arg:2>' to double type for option '<arg:3>'.</yellow>"
|
||||
warning.config.type.quaternionf: "<yellow>Issue found in file <arg:0> - Failed to load '<arg:1>': Cannot cast '<arg:2>' to Quaternionf type for option '<arg:3>'.</yellow>"
|
||||
warning.config.type.vector3f: "<yellow>Issue found in file <arg:0> - Failed to load '<arg:1>': Cannot cast '<arg:2>' to Vector3f type for option '<arg:3>'.</yellow>"
|
||||
warning.config.structure.not_section: "<yellow>Issue found in file <arg:0> - '<arg:1>' is expected to be a config section while it's actually a(n) '<arg:2>'.</yellow>"
|
||||
warning.config.structure.not_section: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is expected to be a config section while it's actually a(n) '<arg:2>'.</yellow>"
|
||||
warning.config.image.duplicate: "<yellow>Issue found in file <arg:0> - Duplicated image '<arg:1>'.</yellow>"
|
||||
warning.config.image.missing_height: "<yellow>Issue found in file <arg:0> - The image '<arg:1>' is missing the required 'height' argument.</yellow>"
|
||||
warning.config.image.height_ascent_conflict: "<yellow>Issue found in file <arg:0> - The image '<arg:1>' violates the bitmap image rule: 'height' argument '<arg:2>' should be no lower than 'ascent' argument '<arg:3>'.</yellow>"
|
||||
@@ -100,7 +100,7 @@ warning.config.recipe.smithing_transform.post_processor.keep_component.missing_c
|
||||
warning.config.recipe.smithing_transform.post_processor.keep_component.missing_tags: "<yellow>Issue found in file <arg:0> - The smithing transform recipe '<arg:1>' is missing the required argument 'tags' for post-processors 'keep_tags'.</yellow>"
|
||||
warning.config.i18n.unknown_locale: "<yellow>Issue found in file <arg:0> - Unknown locale '<arg:1>'.</yellow>"
|
||||
warning.config.template.duplicate: "<yellow>Issue found in file <arg:0> - Duplicated template '<arg:1>'.</yellow>"
|
||||
warning.config.template.invalid_range: "<yellow>Issue found in file <arg:0> - The template '<arg:1>' has a 'from' argument '<arg:2>' larger than 'to' argument '<arg:3>'.</yellow>"
|
||||
warning.config.template.argument.self_increase_int.invalid_range: "<yellow>Issue found in file <arg:0> - The template '<arg:1>' is using a 'from' '<arg:2>' larger than 'to' '<arg:3>' in 'self_increase_int' argument.</yellow>"
|
||||
warning.config.vanilla_loot.missing_type: "<yellow>Issue found in file <arg:0> - 'type' not set for vanilla loot '<arg:1>'.</yellow>"
|
||||
warning.config.vanilla_loot.block.invalid_target: "<yellow>Issue found in file <arg:0> - Invalid block target '<arg:2>' in vanilla loot '<arg:1>'.</yellow>"
|
||||
warning.config.sound.duplicate: "<yellow>Issue found in file <arg:0> - Duplicated sound '<arg:1>'.</yellow>"
|
||||
@@ -119,7 +119,7 @@ warning.config.item.settings.unknown: "<yellow>Issue found in file <arg:0> - The
|
||||
warning.config.item.missing_material: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'material' argument.</yellow>"
|
||||
warning.config.item.invalid_material: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is using an invalid material type '<arg:2>'.</yellow>"
|
||||
warning.config.item.bad_custom_model_data: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is using a custom model data '<arg:2>' that is too large. It's recommended to use a value lower than 16,777,216.</yellow>"
|
||||
warning.config.item.custom_model_conflict: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is using a custom model data '<arg:2>' that has been occupied by item '<arg:3>'.</yellow>"
|
||||
warning.config.item.custom_model_data_conflict: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is using a custom model data '<arg:2>' that has been occupied by item '<arg:3>'.</yellow>"
|
||||
warning.config.item.missing_model_id: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'custom-model-data' or 'item-model' argument.</yellow>"
|
||||
warning.config.item.behavior.missing_type: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'type' argument for its item behavior.</yellow>"
|
||||
warning.config.item.behavior.invalid_type: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is using an invalid item behavior type '<arg:2>'.</yellow>"
|
||||
@@ -139,8 +139,8 @@ warning.config.item.model.condition.missing_property: "<yellow>Issue found in fi
|
||||
warning.config.item.model.condition.invalid_property: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is using an invalid property '<arg:2>' for model 'minecraft:condition'.</yellow>"
|
||||
warning.config.item.model.condition.missing_on_true: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'on-true' argument for model 'minecraft:condition'.</yellow>"
|
||||
warning.config.item.model.condition.missing_on_false: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'on-false' argument for model 'minecraft:condition'.</yellow>"
|
||||
warning.config.item.model.condition.keybind.missing: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'keybind' argument for 'minecraft:keybind_down' property.</yellow>"
|
||||
warning.config.item.model.condition.missing_component: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'component' argument for 'minecraft:has_component' property.</yellow>"
|
||||
warning.config.item.model.condition.keybind.missing: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'keybind' argument for property 'minecraft:keybind_down'.</yellow>"
|
||||
warning.config.item.model.condition.has_component.missing_component: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'component' argument for property 'minecraft:has_component'.</yellow>"
|
||||
warning.config.item.model.composite.missing_models: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'models' argument for 'minecraft:composite' model.</yellow>"
|
||||
warning.config.item.model.range_dispatch.missing_property: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is missing the required 'property' argument for model 'minecraft:range_dispatch'.</yellow>"
|
||||
warning.config.item.model.range_dispatch.invalid_property: "<yellow>Issue found in file <arg:0> - The item '<arg:1>' is using an invalid property '<arg:2>' for model 'minecraft:range_dispatch'.</yellow>"
|
||||
@@ -162,7 +162,7 @@ warning.config.block.missing_state: "<yellow>Issue found in file <arg:0> - The b
|
||||
warning.config.block.state.property.missing_type: "<yellow>Issue found in file <arg:0> - The block '<arg:1>' is missing the required 'type' argument for property '<arg:2>'.</yellow>"
|
||||
warning.config.block.state.property.invalid_type: "<yellow>Issue found in file <arg:0> - The block '<arg:1>' is using the invalid type argument '<arg:2>' for property '<arg:3>'.</yellow>"
|
||||
warning.config.block.state.property.integer.invalid_range: "<yellow>Issue found in file <arg:0> - The block '<arg:1>' is using the invalid 'range' argument '<arg:2>' for integer property '<arg:3>'. Correct syntax: 1~2.</yellow>"
|
||||
warning.config.block.state.missing_real_id: "<yellow>Issue found in file <arg:0> - The block '<arg:1>' is missing the required 'id' argument for 'state'.</yellow>"
|
||||
warning.config.block.state.missing_real_id: "<yellow>Issue found in file <arg:0> - The block '<arg:1>' is missing the required 'id' argument for 'state'. 'id' is the serverside block id which is unique for each type of block state. If you create a serverside side block with 'note_block' and id 30, then the real block id would be 'craftengine:note_block_30'.</yellow>"
|
||||
warning.config.block.state.missing_state: "<yellow>Issue found in file <arg:0> - The block '<arg:1>' is missing the required 'state' argument for 'state'.</yellow>"
|
||||
warning.config.block.state.missing_properties: "<yellow>Issue found in file <arg:0> - The block '<arg:1>' is missing the required 'properties' section for 'states'.</yellow>"
|
||||
warning.config.block.state.missing_appearances: "<yellow>Issue found in file <arg:0> - The block '<arg:1>' is missing the required 'appearances' section for 'states'.</yellow>"
|
||||
@@ -174,8 +174,6 @@ warning.config.block.state.unavailable_vanilla: "<yellow>Issue found in file <ar
|
||||
warning.config.block.state.invalid_vanilla_id: "<yellow>Issue found in file <arg:0> - The block '<arg:1>' is using a vanilla block state '<arg:2>' that exceeds the available slot range '0~<arg:3>'.</yellow>"
|
||||
warning.config.block.state.conflict: "<yellow>Issue found in file <arg:0> - The block '<arg:1>' is using a vanilla block state '<arg:2>' that has been occupied by '<arg:3>'.</yellow>"
|
||||
warning.config.block.state.bind_failed: "<yellow>Issue found in file <arg:0> - The block '<arg:1>' failed to bind real block state for '<arg:2>' as the state has been occupied by '<arg:3>'.</yellow>"
|
||||
warning.config.block.state.invalid_structure: "<yellow>Issue found in file <arg:0> - The block '<arg:1>' has an invalid property structure '<arg:2>'.</yellow>"
|
||||
warning.config.block.state.creation_failed: "<yellow>Issue found in file <arg:0> - Failed to create property '<arg:2>' for block '<arg:1>': <arg:3>.</yellow>"
|
||||
warning.config.block.state.missing_model: "<yellow>Issue found in file <arg:0> - The block '<arg:1>' is missing the required 'model' or 'models' argument.</yellow>"
|
||||
warning.config.block.state.invalid_real_id: "<yellow>Issue found in file <arg:0> - The block '<arg:1>' is using a real block state '<arg:2>' that exceeds the available slot range '0~<arg:3>'. Consider adding more real states in 'additional-real-blocks.yml' if the slots are used up.</yellow>"
|
||||
warning.config.block.state.model.missing_path: "<yellow>Issue found in file <arg:0> - The block '<arg:1>' is missing the required 'path' option for 'model'.</yellow>"
|
||||
@@ -218,11 +216,13 @@ warning.config.loot_table.condition.missing_type: "<yellow>Issue found in file <
|
||||
warning.config.loot_table.condition.invalid_type: "<yellow>Issue found in file <arg:0> - '<arg:1>' has a misconfigured loot table, one of the conditions is using an invalid condition type '<arg:2>'.</yellow>"
|
||||
warning.config.loot_table.condition.table_bonus.missing_enchantment: "<yellow>Issue found in file <arg:0> - '<arg:1>' has a misconfigured loot table, 'table_bonus' condition is missing the required 'enchantment' argument.</yellow>"
|
||||
warning.config.loot_table.condition.table_bonus.missing_chances: "<yellow>Issue found in file <arg:0> - '<arg:1>' has a misconfigured loot table, 'table_bonus' condition is missing the required 'chances' argument.</yellow>"
|
||||
warning.config.loot_table.number.missing_type: "<yellow>Issue found in file <arg:0> - '<arg:1>' has a misconfigured loot table, one of the numbers is missing the required 'type' argument.</yellow>"
|
||||
warning.config.loot_table.number.invalid_type: "<yellow>Issue found in file <arg:0> - '<arg:1>' has a misconfigured loot table, one of the numbers is using an invalid number type '<arg:2>'.</yellow>"
|
||||
warning.config.host.missing_type: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'type' argument for host.</yellow>"
|
||||
warning.config.host.invalid_type: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Host type '<arg:0>' is invalid. Please read https://mo-mi.gitbook.io/xiaomomi-plugins/craftengine/plugin-wiki/craftengine/resource-pack/host.</yellow>"
|
||||
warning.config.host.external.missing_url: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'url' argument for external host.</yellow>"
|
||||
warning.config.host.alist.missing_api_url: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'api-url' argument for alist host.</yellow>"
|
||||
warning.config.host.alist.missing_credentials: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'username' argument or environment variable 'CE_ALIST_USERNAME' for alist host.</yellow>"
|
||||
warning.config.host.alist.missing_username: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'username' argument or environment variable 'CE_ALIST_USERNAME' for alist host.</yellow>"
|
||||
warning.config.host.alist.missing_password: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'password' argument or environment variable 'CE_ALIST_PASSWORD' for alist host.</yellow>"
|
||||
warning.config.host.alist.missing_upload_path: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'upload-path' argument for alist host.</yellow>"
|
||||
warning.config.host.dropbox.missing_app_key: "<yellow>Issue found in config.yml at 'resource-pack.delivery.hosting' - Missing required 'app-key' argument or environment variable 'CE_DROPBOX_APP_KEY' for dropbox host.</yellow>"
|
||||
|
||||
@@ -63,57 +63,3 @@ command.upload.failure.not_supported: "<red>当前托管模式 '<arg:0>' 不支
|
||||
command.upload.on_progress: "<white>已开始上传进程. 检查控制台以获取详细信息.</white>"
|
||||
command.send_resource_pack.success.single: "<white>发送资源包给 <arg:0></white>"
|
||||
command.send_resource_pack.success.multiple: "<white>发送资源包给 <arg:0> 个玩家</white>"
|
||||
warning.config.image.duplicated: "<yellow>在文件 <arg:0> 中发现问题 - 图片 '<arg:1>' 重复定义</yellow>"
|
||||
warning.config.image.lack_height: "<yellow>在文件 <arg:0> 中发现问题 - 图片 '<arg:1>' 缺少必要的 'height' 高度参数</yellow>"
|
||||
warning.config.image.height_smaller_than_ascent: "<yellow>在文件 <arg:0> 中发现问题 - 图片 '<arg:1>' 违反位图规则:'height' 高度值[<arg:2>]不应小于 'ascent' 基准线高度[<arg:3>]</yellow>"
|
||||
warning.config.image.lack_file: "<yellow>在文件 <arg:0> 中发现问题 - 图片 '<arg:1>' 缺少必要的 'file' 文件参数</yellow>"
|
||||
warning.config.image.invalid_resource_location: "<yellow>在文件 <arg:0> 中发现问题 - 图片 '<arg:1>' 的 'file' 参数 [<arg:2>] 包含非法字符,请参考资源路径规范:https://zh.minecraft.wiki/w/%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4ID#%E5%90%88%E6%B3%95%E5%AD%97%E7%AC%A6</yellow>"
|
||||
warning.config.image.invalid_font_name: "<yellow>在文件 <arg:0> 中发现问题 - 图片 '<arg:1>' 的 'font' 字体参数 [<arg:2>] 包含非法字符,请参考资源路径规范:https://zh.minecraft.wiki/w/%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4ID#%E5%90%88%E6%B3%95%E5%AD%97%E7%AC%A6</yellow>"
|
||||
warning.config.image.lack_char: "<yellow>在文件 <arg:0> 中发现问题 - 图片 '<arg:1>' 缺少必要的 'char' 字符参数</yellow>"
|
||||
warning.config.image.codepoint_in_use: "<yellow>在文件 <arg:0> 中发现问题 - 图片 '<arg:1>' 使用的字体 <arg:2> 字符 [<arg:3>(<arg:4>)] 已被其他图片 '<arg:5>' 占用</yellow>"
|
||||
warning.config.image.invalid_codepoint_grid: "<yellow>在文件 <arg:0> 中发现问题 - 图片 '<arg:1>' 的 'chars' 码位网格配置无效</yellow>"
|
||||
warning.config.image.file_not_exist: "<yellow>在文件 <arg:0> 中发现问题 - 图片 '<arg:1>' 对应的PNG文件 <arg:2> 不存在</yellow>"
|
||||
warning.config.recipe.duplicated: "<yellow>在文件 <arg:0> 中发现问题 - 配方 '<arg:1>' 重复定义</yellow>"
|
||||
warning.config.i18n.unknown_locale: "<yellow>在文件 <arg:0> 中发现问题 - 未知的语言 '<arg:1>'</yellow>"
|
||||
warning.config.template.duplicated: "<yellow>在文件 <arg:0> 中发现问题 - 模板 '<arg:1>' 重复定义</yellow>"
|
||||
warning.config.vanilla_loot.type_not_exist: "<yellow>在文件 <arg:0> 中发现问题 - 原版战利品 '<arg:1>' 未设置 'type' 类型参数</yellow>"
|
||||
warning.config.vanilla_loot.block.invalid_target: "<yellow>在文件 <arg:0> 中发现问题 - 原版战利品 '<arg:1>' 中的方块目标 [<arg:2>] 无效</yellow>"
|
||||
warning.config.sound.duplicated: "<yellow>在文件 <arg:0> 中发现问题 - 音效 '<arg:1>' 重复定义</yellow>"
|
||||
warning.config.jukebox_song.duplicated: "<yellow>在文件 <arg:0> 中发现问题 - 唱片机歌曲 '<arg:1>' 重复定义</yellow>"
|
||||
warning.config.furniture.duplicated: "<yellow>在文件 <arg:0> 中发现问题 - 家具 '<arg:1>' 重复定义</yellow>"
|
||||
warning.config.furniture.lack_placement: "<yellow>在文件 <arg:0> 中发现问题 - 家具 '<arg:1>' 缺少必要的 'placement' 放置参数</yellow>"
|
||||
warning.config.furniture.element.lack_item: "<yellow>在文件 <arg:0> 中发现问题 - 家具 '<arg:1>' 的某个元素缺少必要的 'item' 物品参数</yellow>"
|
||||
warning.config.item.duplicated: "<yellow>在文件 <arg:0> 中发现问题 - 物品 '<arg:1>' 重复定义</yellow>"
|
||||
warning.config.item.lack_material: "<yellow>在文件 <arg:0> 中发现问题 - 物品 '<arg:1>' 缺少必要的 'material' 材料参数</yellow>"
|
||||
warning.config.item.invalid_material: "<yellow>在文件 <arg:0> 中发现问题 - 物品 '<arg:1>' 使用了无效的材料类型 '<arg:2>'</yellow>"
|
||||
warning.config.item.bad_custom_model_data_value: "<yellow>在文件 <arg:0> 中发现问题 - 物品 '<arg:1>' 的自定义模型数据值 [<arg:2>] 过大,建议使用低于16,777,216的值</yellow>"
|
||||
warning.config.item.custom_model_data_conflict: "<yellow>在文件 <arg:0> 中发现问题 - 物品 '<arg:1>' 的自定义模型数据 [<arg:2>] 与物品 '<arg:3>' 发生冲突</yellow>"
|
||||
warning.config.item.lack_model_id: "<yellow>在文件 <arg:0> 中发现问题 - 物品 '<arg:1>' 缺少必要的 'custom-model-data' 或 'item-model' 模型标识参数</yellow>"
|
||||
warning.config.block.duplicated: "<yellow>在文件 <arg:0> 中发现问题 - 方块 '<arg:1>' 重复定义</yellow>"
|
||||
warning.config.block.lack_state: "<yellow>在文件 <arg:0> 中发现问题 - 方块 '<arg:1>' 缺少必要的 'state' 状态参数</yellow>"
|
||||
warning.config.block.state.lack_real_id: "<yellow>在文件 <arg:0> 中发现问题 - 方块 '<arg:1>' 的 'state' 配置缺少必要的 'id' 标识参数</yellow>"
|
||||
warning.config.block.state.lack_state: "<yellow>在文件 <arg:0> 中发现问题 - 方块 '<arg:1>' 的 'state' 配置缺少必要的 'state' 状态参数</yellow>"
|
||||
warning.config.block.state.lack_properties: "<yellow>在文件 <arg:0> 中发现问题 - 方块 '<arg:1>' 的 'states' 配置缺少必要的 'properties' 属性配置</yellow>"
|
||||
warning.config.block.state.lack_appearances: "<yellow>在文件 <arg:0> 中发现问题 - 方块 '<arg:1>' 的 'states' 配置缺少必要的 'appearances' 外观配置</yellow>"
|
||||
warning.config.block.state.lack_variants: "<yellow>在文件 <arg:0> 中发现问题 - 方块 '<arg:1>' 的 'states' 配置缺少必要的 'variants' 变体配置</yellow>"
|
||||
warning.config.block.state.variant.lack_appearance: "<yellow>在文件 <arg:0> 中发现问题 - 方块 '<arg:1>' 的 '<arg:2>' 变体配置缺少必要的 'appearance' 外观参数</yellow>"
|
||||
warning.config.block.state.variant.invalid_appearance: "<yellow>在文件 <arg:0> 中发现问题 - 方块 '<arg:1>' 的 '<arg:2>' 变体引用了不存在的外观配置 '<arg:3>'</yellow>"
|
||||
warning.config.block.state.invalid_state: "<yellow>在文件 <arg:0> 中发现问题 - 方块 '<arg:1>' 使用了无效的原版方块状态 '<arg:2>'</yellow>"
|
||||
warning.config.block.state.unavailable_state: "<yellow>在文件 <arg:0> 中发现问题 - 方块 '<arg:1>' 使用了不可用的原版方块状态 '<arg:2>'</yellow>"
|
||||
warning.config.block.state.invalid_vanilla_state_id: "<yellow>在文件 <arg:0> 中发现问题 - 方块 '<arg:1>' 使用的原版方块状态 '<arg:2>' 超出可用槽位范围 '0~<arg:3>'</yellow>"
|
||||
warning.config.block.state.conflict: "<yellow>在文件 <arg:0> 中发现问题 - 方块 '<arg:1>' 使用的原版方块状态 '<arg:2>' 已被 '<arg:3>' 占用</yellow>"
|
||||
warning.config.block.state.bind_real_state: "<yellow>在文件 <arg:0> 中发现问题 - 方块 '<arg:1>' 未能绑定真实方块状态 '<arg:2>',该状态已被 '<arg:3>' 占用</yellow>"
|
||||
warning.config.block.state.invalid_property_structure: "<yellow>在文件 <arg:0> 中发现问题 - 方块 '<arg:1>' 的属性结构 '<arg:2>' 配置无效</yellow>"
|
||||
warning.config.block.state.invalid_property: "<yellow>在文件 <arg:0> 中发现问题 - 无法为方块 '<arg:1>' 创建属性 '<arg:2>':<arg:3></yellow>"
|
||||
warning.config.block.state.no_model_set: "<yellow>在文件 <arg:0> 中发现问题 - 方块 '<arg:1>' 缺少必要的 'model' 或 'models' 模型参数</yellow>"
|
||||
warning.config.block.state.invalid_real_state_id: "<yellow>在文件 <arg:0> 中发现问题 - 方块 '<arg:1>' 使用的真实方块状态 '<arg:2>' 超出可用槽位范围 '0~<arg:3>'。若槽位已用尽,请考虑在 additional-real-blocks.yml 中添加更多真实状态</yellow>"
|
||||
warning.config.block.state.model.lack_path: "<yellow>在文件 <arg:0> 中发现问题 - 方块 '<arg:1>' 的 'model' 配置缺少必要的 'path' 路径参数</yellow>"
|
||||
warning.config.block.state.model.invalid_resource_location: "<yellow>在文件 <arg:0> 中发现问题 - 方块 '<arg:1>' 的 'path' 路径参数 [<arg:2>] 包含非法字符,请参考资源路径规范:https://zh.minecraft.wiki/w/%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4ID#%E5%90%88%E6%B3%95%E5%AD%97%E7%AC%A6</yellow>"
|
||||
warning.config.model.generation.conflict: "<yellow>在文件 <arg:0> 中发现问题 - 无法为 '<arg:1>' 生成模型,多个配置尝试用相同路径 '<arg:2>' 生成不同的JSON模型</yellow>"
|
||||
warning.config.model.generation.texture.invalid_resource_location: "<yellow>在文件 <arg:0> 中发现问题 - 配置项 '<arg:1>' 的 '<arg:2>' 纹理参数 [<arg:3>] 包含非法字符,请参考资源路径规范:https://zh.minecraft.wiki/w/%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4ID#%E5%90%88%E6%B3%95%E5%AD%97%E7%AC%A6</yellow>"
|
||||
warning.config.model.generation.parent.invalid_resource_location: "<yellow>在文件 <arg:0> 中发现问题 - 配置项 '<arg:1>' 的父模型参数 [<arg:2>] 包含非法字符,请参考资源路径规范:https://zh.minecraft.wiki/w/%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4ID#%E5%90%88%E6%B3%95%E5%AD%97%E7%AC%A6</yellow>"
|
||||
warning.config.emoji.lack_keywords: "<yellow>在文件 <arg:0> 中发现问题 - 表情 '<arg:1>' 缺少必要的 'keywords' 配置</yellow>"
|
||||
warning.config.emoji.duplicated: "<yellow>在文件 <arg:0> 中发现问题 - 表情 '<arg:1>' 重复定义</yellow>"
|
||||
warning.config.emoji.invalid_image: "<yellow>在文件 <arg:0> 中发现问题 - 表情 '<arg:1>' 使用了无效的 'image' 图片参数 '<arg:2>'.</yellow>"
|
||||
warning.config.advancement.duplicated: "<yellow>在文件 <arg:0> 中发现问题 - 进度 '<arg:1>' 重复定义</yellow>"
|
||||
# 先不要急着汉化,目前语言改动较大
|
||||
@@ -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));
|
||||
Property<?> property = Properties.fromMap(entry.getKey(), MiscUtils.castToMap(entry.getValue(), 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());
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
||||
@@ -25,14 +25,14 @@ public class BlockBehaviors {
|
||||
|
||||
public static BlockBehavior fromMap(CustomBlock block, @Nullable Map<String, Object> map) {
|
||||
if (map == null) return EmptyBlockBehavior.INSTANCE;
|
||||
String type = (String) map.getOrDefault("type", "empty");
|
||||
Object type = map.get("type");
|
||||
if (type == null) {
|
||||
throw new NullPointerException("behavior type cannot be null");
|
||||
throw new LocalizedResourceConfigException("warning.config.block.behavior.missing_type", new NullPointerException("behavior type cannot be null"));
|
||||
}
|
||||
Key key = Key.withDefaultNamespace(type, "craftengine");
|
||||
Key key = Key.withDefaultNamespace(type.toString(), "craftengine");
|
||||
BlockBehaviorFactory factory = BuiltInRegistries.BLOCK_BEHAVIOR_FACTORY.getValue(key);
|
||||
if (factory == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.block.behavior.invalid_type", new IllegalArgumentException("Unknown block behavior type: " + type), type);
|
||||
throw new LocalizedResourceConfigException("warning.config.block.behavior.invalid_type", new IllegalArgumentException("Unknown block behavior type: " + type), type.toString());
|
||||
}
|
||||
return factory.create(block, map);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class Properties {
|
||||
public static Property<?> fromMap(String name, Map<String, Object> map) {
|
||||
Object type = map.get("type");
|
||||
if (type == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.block.state.property.lack_type", new NullPointerException("'type' cannot be null for block state property"), name);
|
||||
throw new LocalizedResourceConfigException("warning.config.block.state.property.missing_type", new NullPointerException("'type' cannot be null for block state property"), name);
|
||||
}
|
||||
Key key = Key.withDefaultNamespace(type.toString(), "craftengine");
|
||||
PropertyFactory factory = BuiltInRegistries.PROPERTY_FACTORY.getValue(key);
|
||||
|
||||
@@ -357,16 +357,16 @@ public abstract class AbstractFontManager implements FontManager {
|
||||
@Override
|
||||
public void parseSection(Pack pack, Path path, Key id, Map<String, Object> section) {
|
||||
if (emojis.containsKey(id)) {
|
||||
throw new LocalizedResourceConfigException("warning.config.emoji.duplicated", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.emoji.duplicate", path, id);
|
||||
}
|
||||
String permission = (String) section.get("permission");
|
||||
Object keywordsRaw = section.get("keywords");
|
||||
if (keywordsRaw == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.emoji.lack_keywords", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.emoji.missing_keywords", path, id);
|
||||
}
|
||||
List<String> keywords = MiscUtils.getAsStringList(keywordsRaw);
|
||||
if (keywords.isEmpty()) {
|
||||
throw new LocalizedResourceConfigException("warning.config.emoji.lack_keywords", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.emoji.missing_keywords", path, id);
|
||||
}
|
||||
String content = section.getOrDefault("content", "<arg:emoji>").toString();
|
||||
String image = null;
|
||||
@@ -418,22 +418,22 @@ public abstract class AbstractFontManager implements FontManager {
|
||||
@Override
|
||||
public void parseSection(Pack pack, Path path, Key id, Map<String, Object> section) {
|
||||
if (images.containsKey(id)) {
|
||||
throw new LocalizedResourceConfigException("warning.config.image.duplicated", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.image.duplicate", path, id);
|
||||
}
|
||||
|
||||
Object file = section.get("file");
|
||||
if (file == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.image.lack_file", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.image.missing_file", path, id);
|
||||
}
|
||||
|
||||
String resourceLocation = file.toString().replace("\\", "/");
|
||||
if (!ResourceLocation.isValid(resourceLocation)) {
|
||||
throw new LocalizedResourceConfigException("warning.config.image.invalid_resource_location", path, id, resourceLocation);
|
||||
throw new LocalizedResourceConfigException("warning.config.image.invalid_file_chars", path, id, resourceLocation);
|
||||
}
|
||||
|
||||
String fontName = (String) section.getOrDefault("font", "minecraft:default");
|
||||
if (!ResourceLocation.isValid(fontName)) {
|
||||
throw new LocalizedResourceConfigException("warning.config.image.invalid_font_name", path, id, fontName);
|
||||
throw new LocalizedResourceConfigException("warning.config.image.invalid_font_chars", path, id, fontName);
|
||||
}
|
||||
|
||||
Key fontKey = Key.withDefaultNamespace(fontName, id.namespace());
|
||||
@@ -444,7 +444,7 @@ public abstract class AbstractFontManager implements FontManager {
|
||||
charsObj = section.get("char");
|
||||
}
|
||||
if (charsObj == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.image.lack_char", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.image.missing_char", path, id);
|
||||
}
|
||||
if (charsObj instanceof List<?> list) {
|
||||
chars = MiscUtils.getAsStringList(list).stream().map(it -> {
|
||||
@@ -474,7 +474,7 @@ public abstract class AbstractFontManager implements FontManager {
|
||||
for (int codepoint : codepoints) {
|
||||
if (font.isCodepointInUse(codepoint)) {
|
||||
BitmapImage image = font.bitmapImageByCodepoint(codepoint);
|
||||
throw new LocalizedResourceConfigException("warning.config.image.codepoint_in_use", path, id,
|
||||
throw new LocalizedResourceConfigException("warning.config.image.codepoint_conflict", path, id,
|
||||
fontKey.toString(),
|
||||
CharacterUtils.encodeCharsToUnicode(Character.toChars(codepoint)),
|
||||
new String(Character.toChars(codepoint)),
|
||||
@@ -482,7 +482,7 @@ public abstract class AbstractFontManager implements FontManager {
|
||||
}
|
||||
}
|
||||
if (codepoints.length == 0) {
|
||||
throw new LocalizedResourceConfigException("warning.config.image.lack_char", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.image.missing_char", path, id);
|
||||
}
|
||||
codepointGrid[i] = codepoints;
|
||||
if (size == -1) size = codepoints.length;
|
||||
@@ -502,7 +502,7 @@ public abstract class AbstractFontManager implements FontManager {
|
||||
.resolve(namespacedPath.value());
|
||||
|
||||
if (!Files.exists(targetImagePath)) {
|
||||
TranslationManager.instance().log("warning.config.image.file_not_exist", path.toString(), id.toString(), targetImagePath.toString());
|
||||
TranslationManager.instance().log("warning.config.image.file_not_found", path.toString(), id.toString(), targetImagePath.toString());
|
||||
// DO NOT RETURN, JUST GIVE WARNINGS
|
||||
} else if (heightObj == null) {
|
||||
try (InputStream in = Files.newInputStream(targetImagePath)) {
|
||||
@@ -515,13 +515,13 @@ public abstract class AbstractFontManager implements FontManager {
|
||||
}
|
||||
|
||||
if (heightObj == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.image.lack_height", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.image.missing_height", path, id);
|
||||
}
|
||||
|
||||
int height = ResourceConfigUtils.getAsInt(heightObj, "height");
|
||||
int ascent = ResourceConfigUtils.getAsInt(section.getOrDefault("ascent", height - 1), "ascent");
|
||||
if (height < ascent) {
|
||||
throw new LocalizedResourceConfigException("warning.config.image.height_smaller_than_ascent", path, id, String.valueOf(height), String.valueOf(ascent));
|
||||
throw new LocalizedResourceConfigException("warning.config.image.height_ascent_conflict", path, id, String.valueOf(height), String.valueOf(ascent));
|
||||
}
|
||||
|
||||
BitmapImage bitmapImage = new BitmapImage(id, fontKey, height, ascent, resourceLocation, codepointGrid);
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ItemBehaviors {
|
||||
public static ItemBehavior fromMap(Pack pack, Path path, Key id, Map<String, Object> map) {
|
||||
Object type = map.get("type");
|
||||
if (type == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.behavior.lack_type", new NullPointerException("behavior type cannot be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.behavior.missing_type", new NullPointerException("behavior type cannot be null"));
|
||||
}
|
||||
Key key = Key.withDefaultNamespace(type.toString(), "craftengine");
|
||||
ItemBehaviorFactory factory = BuiltInRegistries.ITEM_BEHAVIOR_FACTORY.getValue(key);
|
||||
|
||||
@@ -38,7 +38,7 @@ public abstract class AbstractRecipeFactory<T> implements RecipeFactory<T> {
|
||||
ingredient = arguments.get("ingredients");
|
||||
}
|
||||
if (ingredient == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.recipe.lack_ingredient", new NullPointerException("'ingredient' should not be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.recipe.missing_ingredient", new NullPointerException("'ingredient' should not be null"));
|
||||
}
|
||||
return ingredient;
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ public abstract class AbstractRecipeManager<T> implements RecipeManager<T> {
|
||||
public void parseSection(Pack pack, Path path, Key id, Map<String, Object> section) {
|
||||
if (!Config.enableRecipeSystem()) return;
|
||||
if (AbstractRecipeManager.this.byId.containsKey(id)) {
|
||||
throw new LocalizedResourceConfigException("warning.config.recipe.duplicated", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.recipe.duplicate", path, id);
|
||||
}
|
||||
Recipe<T> recipe = RecipeTypes.fromMap(id, section);
|
||||
try {
|
||||
|
||||
@@ -141,7 +141,7 @@ public class CustomShapedRecipe<T> extends CustomCraftingTableRecipe<T> {
|
||||
public Recipe<A> create(Key id, Map<String, Object> arguments) {
|
||||
List<String> pattern = MiscUtils.getAsStringList(arguments.get("pattern"));
|
||||
if (pattern.isEmpty()) {
|
||||
throw new LocalizedResourceConfigException("warning.config.recipe.shaped.lack_pattern", new NullPointerException("'pattern' cannot be empty"));
|
||||
throw new LocalizedResourceConfigException("warning.config.recipe.shaped.missing_pattern", new NullPointerException("'pattern' cannot be empty"));
|
||||
}
|
||||
if (!validatePattern(pattern)) {
|
||||
throw new LocalizedResourceConfigException("warning.config.recipe.shaped.invalid_pattern", new IllegalArgumentException("Invalid pattern: " + pattern), pattern.toString());
|
||||
|
||||
@@ -182,7 +182,7 @@ public class CustomSmithingTransformRecipe<T> implements Recipe<T> {
|
||||
public static ItemDataProcessor fromMap(Map<String, Object> map) {
|
||||
String type = (String) map.get("type");
|
||||
if (type == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.recipe.smithing_transform.post_processor.lack_type", new NullPointerException("Missing required parameter 'type' for post processor"));
|
||||
throw new LocalizedResourceConfigException("warning.config.recipe.smithing_transform.post_processor.missing_type", new NullPointerException("Missing required parameter 'type' for post processor"));
|
||||
}
|
||||
Key key = Key.withDefaultNamespace(type, "craftengine");
|
||||
ItemDataProcessor.Factory factory = BuiltInRegistries.SMITHING_RESULT_PROCESSOR_FACTORY.getValue(key);
|
||||
@@ -237,7 +237,7 @@ public class CustomSmithingTransformRecipe<T> implements Recipe<T> {
|
||||
public ItemDataProcessor create(Map<String, Object> arguments) {
|
||||
Object componentsObj = arguments.get("components");
|
||||
if (componentsObj == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.recipe.smithing_transform.post_processor.keep_component.lack_components", new NullPointerException("Missing required parameter 'components' for post processor"));
|
||||
throw new LocalizedResourceConfigException("warning.config.recipe.smithing_transform.post_processor.keep_component.missing_components", new NullPointerException("Missing required parameter 'components' for post processor"));
|
||||
}
|
||||
List<String> components = MiscUtils.getAsStringList(componentsObj);
|
||||
return new KeepComponents(components.stream().map(Key::of).toList());
|
||||
@@ -274,7 +274,7 @@ public class CustomSmithingTransformRecipe<T> implements Recipe<T> {
|
||||
public ItemDataProcessor create(Map<String, Object> arguments) {
|
||||
Object tagsObj = arguments.get("tags");
|
||||
if (tagsObj == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.recipe.smithing_transform.post_processor.keep_component.lack_tags", new NullPointerException("Missing required parameter 'tags' for post processor"));
|
||||
throw new LocalizedResourceConfigException("warning.config.recipe.smithing_transform.post_processor.keep_component.missing_tags", new NullPointerException("Missing required parameter 'tags' for post processor"));
|
||||
}
|
||||
List<String> tags = MiscUtils.getAsStringList(tagsObj);
|
||||
return new KeepTags(tags.stream().map(it -> it.split("\\.")).toList());
|
||||
|
||||
@@ -16,11 +16,11 @@ public interface RecipeFactory<T> {
|
||||
default CustomRecipeResult<T> parseResult(Map<String, Object> arguments) {
|
||||
Map<String, Object> resultMap = MiscUtils.castToMap(arguments.get("result"), true);
|
||||
if (resultMap == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.recipe.lack_result", new IllegalArgumentException("result cannot be empty for recipe"));
|
||||
throw new LocalizedResourceConfigException("warning.config.recipe.missing_result", new IllegalArgumentException("result cannot be empty for recipe"));
|
||||
}
|
||||
String id = (String) resultMap.get("id");
|
||||
if (id == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.recipe.result.lack_id", new IllegalArgumentException("id cannot be empty for result"));
|
||||
throw new LocalizedResourceConfigException("warning.config.recipe.result.missing_id", new IllegalArgumentException("id cannot be empty for result"));
|
||||
}
|
||||
int count = ResourceConfigUtils.getAsInt(resultMap.getOrDefault("count", 1), "count");
|
||||
return new CustomRecipeResult(
|
||||
|
||||
@@ -42,7 +42,7 @@ public class RecipeTypes {
|
||||
public static <T> Recipe<T> fromMap(Key id, Map<String, Object> map) {
|
||||
String type = (String) map.get("type");
|
||||
if (type == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.recipe.lack_type", new NullPointerException("'type' cannot be null for recipe"));
|
||||
throw new LocalizedResourceConfigException("warning.config.recipe.missing_type", new NullPointerException("'type' cannot be null for recipe"));
|
||||
}
|
||||
Key key = Key.withDefaultNamespace(type, "minecraft");
|
||||
RecipeFactory<T> factory = (RecipeFactory<T>) BuiltInRegistries.RECIPE_FACTORY.getValue(key);
|
||||
|
||||
@@ -42,10 +42,10 @@ public class LootTable<T> {
|
||||
if (map == null || map.isEmpty()) return null;
|
||||
Object pools = map.get("pools");
|
||||
if (pools == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.lack_pools");
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.missing_pools");
|
||||
}
|
||||
if (!(pools instanceof List<?> list) || list.isEmpty()) {
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.wrong_pools_type", pools.getClass().getSimpleName());
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.invalid_pools_type", pools.getClass().getSimpleName());
|
||||
}
|
||||
List<Object> poolList = (List<Object>) map.get("pools");
|
||||
List<LootPool<T>> lootPools = new ArrayList<>();
|
||||
@@ -56,15 +56,15 @@ public class LootTable<T> {
|
||||
NumberProvider bonus_rolls = NumberProviders.fromObject(pool.getOrDefault("bonus_rolls", 0));
|
||||
List<LootCondition> conditions = Optional.ofNullable(pool.get("conditions"))
|
||||
.map(it -> LootConditions.fromMapList(castToMapListOrThrow(it,
|
||||
() -> new LocalizedResourceConfigException("warning.config.loot_table.wrong_conditions_type", new RuntimeException("'conditions' should be a map list, current type: " + it.getClass().getSimpleName()), it.getClass().getSimpleName()))))
|
||||
() -> new LocalizedResourceConfigException("warning.config.loot_table.invalid_conditions_type", new RuntimeException("'conditions' should be a map list, current type: " + it.getClass().getSimpleName()), it.getClass().getSimpleName()))))
|
||||
.orElse(Lists.newArrayList());
|
||||
List<LootEntryContainer<T>> containers = Optional.ofNullable(pool.get("entries"))
|
||||
.map(it -> (List<LootEntryContainer<T>>) new ArrayList<LootEntryContainer<T>>(LootEntryContainers.fromMapList(castToMapListOrThrow(it,
|
||||
() -> new LocalizedResourceConfigException("warning.config.loot_table.wrong_entries_type", new RuntimeException("'entries' should be a map list, current type: " + it.getClass().getSimpleName()), it.getClass().getSimpleName())))))
|
||||
() -> new LocalizedResourceConfigException("warning.config.loot_table.invalid_entries_type", new RuntimeException("'entries' should be a map list, current type: " + it.getClass().getSimpleName()), it.getClass().getSimpleName())))))
|
||||
.orElse(Lists.newArrayList());
|
||||
List<LootFunction<T>> functions = Optional.ofNullable(pool.get("functions"))
|
||||
.map(it -> (List<LootFunction<T>>) new ArrayList<LootFunction<T>>(LootFunctions.fromMapList(castToMapListOrThrow(it,
|
||||
() -> new LocalizedResourceConfigException("warning.config.loot_table.wrong_functions_type", new RuntimeException("'functions' should be a map list, current type: " + it.getClass().getSimpleName()), it.getClass().getSimpleName())))))
|
||||
() -> new LocalizedResourceConfigException("warning.config.loot_table.invalid_functions_type", new RuntimeException("'functions' should be a map list, current type: " + it.getClass().getSimpleName()), it.getClass().getSimpleName())))))
|
||||
.orElse(Lists.newArrayList());
|
||||
lootPools.add(new LootPool<>(containers, conditions, functions, rolls, bonus_rolls));
|
||||
} else if (rawPool instanceof String string) {
|
||||
@@ -76,7 +76,7 @@ public class LootTable<T> {
|
||||
return new LootTable<>(lootPools,
|
||||
Optional.ofNullable(map.get("functions"))
|
||||
.map(it -> (List<LootFunction<T>>) new ArrayList<LootFunction<T>>(LootFunctions.fromMapList(castToMapListOrThrow(it,
|
||||
() -> new LocalizedResourceConfigException("warning.config.loot_table.wrong_functions_type", new RuntimeException("'functions' should be a map list, current type: " + it.getClass().getSimpleName()), it.getClass().getSimpleName())))))
|
||||
() -> new LocalizedResourceConfigException("warning.config.loot_table.invalid_functions_type", new RuntimeException("'functions' should be a map list, current type: " + it.getClass().getSimpleName()), it.getClass().getSimpleName())))))
|
||||
.orElse(Lists.newArrayList())
|
||||
);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ public class LootConditions {
|
||||
public static LootCondition fromMap(Map<String, Object> map) {
|
||||
String type = (String) map.get("type");
|
||||
if (type == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.condition.lack_type", new NullPointerException("condition type cannot be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.condition.missing_type", new NullPointerException("condition type cannot be null"));
|
||||
}
|
||||
Key key = Key.withDefaultNamespace(type, "craftengine");
|
||||
LootConditionFactory factory = BuiltInRegistries.LOOT_CONDITION_FACTORY.getValue(key);
|
||||
|
||||
@@ -42,7 +42,7 @@ public class TableBonusCondition implements LootCondition {
|
||||
public LootCondition create(Map<String, Object> arguments) {
|
||||
Object enchantmentObj = arguments.get("enchantment");
|
||||
if (enchantmentObj == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.condition.table_bonus.lack_enchantment", new NullPointerException("'enchantment' should not be null for table bonus"));
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.condition.table_bonus.missing_enchantment");
|
||||
}
|
||||
Key enchantmentType = Key.of(enchantmentObj.toString());
|
||||
Object chances = arguments.get("chances");
|
||||
@@ -57,7 +57,7 @@ public class TableBonusCondition implements LootCondition {
|
||||
return new TableBonusCondition(enchantmentType, values);
|
||||
}
|
||||
}
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.condition.table_bonus.lack_chances", new NullPointerException("'chances' should not be null for table bonus"));
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.condition.table_bonus.missing_chances");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ExpLootEntryContainer<T> extends AbstractLootEntryContainer<T> {
|
||||
public LootEntryContainer<A> create(Map<String, Object> arguments) {
|
||||
Object value = arguments.get("count");
|
||||
if (value == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.entry.exp.lack_count", new IllegalArgumentException("'count' is required for exp entry"));
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.entry.exp.missing_count", new IllegalArgumentException("'count' is required for exp entry"));
|
||||
}
|
||||
List<LootCondition> conditions = Optional.ofNullable(arguments.get("conditions"))
|
||||
.map(it -> LootConditions.fromMapList((List<Map<String, Object>>) it))
|
||||
|
||||
@@ -42,7 +42,7 @@ public class LootEntryContainers {
|
||||
public static <T> LootEntryContainer<T> fromMap(Map<String, Object> map) {
|
||||
String type = (String) map.get("type");
|
||||
if (type == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.entry.lack_type", new NullPointerException("loot entry type cannot be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.entry.missing_type", new NullPointerException("loot entry type cannot be null"));
|
||||
}
|
||||
Key key = Key.withDefaultNamespace(type, "craftengine");
|
||||
LootEntryContainerFactory<T> factory = (LootEntryContainerFactory<T>) BuiltInRegistries.LOOT_ENTRY_CONTAINER_FACTORY.getValue(key);
|
||||
|
||||
@@ -45,7 +45,7 @@ public class SingleItemLootEntryContainer<T> extends AbstractSingleLootEntryCont
|
||||
public LootEntryContainer<A> create(Map<String, Object> arguments) {
|
||||
Object itemObj = arguments.get("item");
|
||||
if (itemObj == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.entry.item.lack_item", new IllegalArgumentException("'item' is required for item entry"));
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.entry.item.missing_item", new IllegalArgumentException("'item' is required for item entry"));
|
||||
}
|
||||
Key item = Key.from(itemObj.toString());
|
||||
int weight = (int) arguments.getOrDefault("weight", 1);
|
||||
|
||||
@@ -51,11 +51,11 @@ public class ApplyBonusCountFunction<T> extends AbstractLootConditionalFunction<
|
||||
public LootFunction<T> create(Map<String, Object> arguments) {
|
||||
String enchantment = (String) arguments.get("enchantment");
|
||||
if (enchantment == null || enchantment.isEmpty()) {
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.function.apply_bonus.lack_enchantment", new IllegalArgumentException("'enchantment' is required for apply_bonus function"));
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.function.apply_bonus.missing_enchantment", new IllegalArgumentException("'enchantment' is required for apply_bonus function"));
|
||||
}
|
||||
Map<String, Object> formulaMap = MiscUtils.castToMap(arguments.get("formula"), true);
|
||||
if (formulaMap == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.function.apply_bonus.lack_formula", new IllegalArgumentException("formula is required"));
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.function.apply_bonus.missing_formula", new IllegalArgumentException("formula is required"));
|
||||
}
|
||||
List<LootCondition> conditions = Optional.ofNullable(arguments.get("conditions"))
|
||||
.map(it -> LootConditions.fromMapList((List<Map<String, Object>>) it))
|
||||
|
||||
@@ -42,7 +42,7 @@ public class DropExpFunction<T> extends AbstractLootConditionalFunction<T> {
|
||||
public LootFunction<T> create(Map<String, Object> arguments) {
|
||||
Object value = arguments.get("count");
|
||||
if (value == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.function.drop_exp.lack_count", new IllegalArgumentException("'count' is required for drop_exp function"));
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.function.drop_exp.missing_count", new IllegalArgumentException("'count' is required for drop_exp function"));
|
||||
}
|
||||
List<LootCondition> conditions = Optional.ofNullable(arguments.get("conditions"))
|
||||
.map(it -> LootConditions.fromMapList((List<Map<String, Object>>) it))
|
||||
|
||||
@@ -70,7 +70,7 @@ public class LootFunctions {
|
||||
public static <T> LootFunction<T> fromMap(Map<String, Object> map) {
|
||||
String type = (String) map.get("type");
|
||||
if (type == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.function.lack_type", new NullPointerException("function type cannot be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.function.missing_type", new NullPointerException("function type cannot be null"));
|
||||
}
|
||||
Key key = Key.withDefaultNamespace(type, "craftengine");
|
||||
LootFunctionFactory<T> factory = (LootFunctionFactory<T>) BuiltInRegistries.LOOT_FUNCTION_FACTORY.getValue(key);
|
||||
|
||||
@@ -44,7 +44,7 @@ public class SetCountFunction<T> extends AbstractLootConditionalFunction<T> {
|
||||
public LootFunction<A> create(Map<String, Object> arguments) {
|
||||
Object value = arguments.get("count");
|
||||
if (value == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.function.set_count.lack_count", new IllegalArgumentException("'count' is required for set_count function"));
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.function.set_count.missing_count", new IllegalArgumentException("'count' is required for set_count function"));
|
||||
}
|
||||
boolean add = (boolean) arguments.getOrDefault("add", false);
|
||||
List<LootCondition> conditions = Optional.ofNullable(arguments.get("conditions"))
|
||||
|
||||
@@ -39,7 +39,7 @@ public class NumberProviders {
|
||||
public static NumberProvider fromMap(Map<String, Object> map) {
|
||||
String type = (String) map.get("type");
|
||||
if (type == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.number.lack_type", new NullPointerException("number type cannot be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.loot_table.number.missing_type", new NullPointerException("number type cannot be null"));
|
||||
}
|
||||
Key key = Key.withDefaultNamespace(type, "craftengine");
|
||||
NumberProviderFactory factory = BuiltInRegistries.NUMBER_PROVIDER_FACTORY.getValue(key);
|
||||
|
||||
@@ -460,7 +460,7 @@ public abstract class AbstractPackManager implements PackManager {
|
||||
parser.parseSection(cached.pack(), cached.filePath(), id, plugin.templateManager().applyTemplates(configSection1));
|
||||
}
|
||||
} else {
|
||||
TranslationManager.instance().log("warning.config.not_a_section", cached.filePath().toString(), cached.prefix() + "." + key, configEntry.getValue().getClass().getSimpleName());
|
||||
TranslationManager.instance().log("warning.config.structure.not_section", cached.filePath().toString(), cached.prefix() + "." + key, configEntry.getValue().getClass().getSimpleName());
|
||||
}
|
||||
}
|
||||
} catch (LocalizedException e) {
|
||||
|
||||
@@ -29,11 +29,11 @@ public class ExactPathMatcher implements PathMatcher {
|
||||
|
||||
@Override
|
||||
public PathMatcher create(Map<String, Object> arguments) {
|
||||
String path = (String) arguments.get("path");
|
||||
Object path = arguments.get("path");
|
||||
if (path == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.conflict_matcher.exact.lack_path", new IllegalArgumentException("The 'path' argument must not be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.conflict_matcher.exact.missing_path", new IllegalArgumentException("The 'path' argument must not be null"));
|
||||
}
|
||||
return new ExactPathMatcher(path);
|
||||
return new ExactPathMatcher(path.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,11 +29,11 @@ public class FilenameMatcher implements PathMatcher {
|
||||
|
||||
@Override
|
||||
public PathMatcher create(Map<String, Object> arguments) {
|
||||
String name = (String) arguments.get("name");
|
||||
Object name = arguments.get("name");
|
||||
if (name == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.conflict_matcher.filename.lack_name", new IllegalArgumentException("The 'name' argument must not be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.conflict_matcher.filename.missing_name", new IllegalArgumentException("The 'name' argument must not be null"));
|
||||
}
|
||||
return new FilenameMatcher(name);
|
||||
return new FilenameMatcher(name.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,11 +31,11 @@ public class ParentPathPrefixMatcher implements PathMatcher {
|
||||
|
||||
@Override
|
||||
public PathMatcher create(Map<String, Object> arguments) {
|
||||
String prefix = (String) arguments.get("prefix");
|
||||
Object prefix = arguments.get("prefix");
|
||||
if (prefix == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.conflict_matcher.parent_path_prefix.lack_prefix", new IllegalArgumentException("The prefix argument must not be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.conflict_matcher.parent_prefix.missing_prefix", new IllegalArgumentException("The prefix argument must not be null"));
|
||||
}
|
||||
return new ParentPathPrefixMatcher(prefix);
|
||||
return new ParentPathPrefixMatcher(prefix.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,11 +31,11 @@ public class ParentPathSuffixMatcher implements PathMatcher {
|
||||
|
||||
@Override
|
||||
public PathMatcher create(Map<String, Object> arguments) {
|
||||
String suffix = (String) arguments.get("suffix");
|
||||
Object suffix = arguments.get("suffix");
|
||||
if (suffix == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.conflict_matcher.parent_path_suffix.lack_suffix", new IllegalArgumentException("The suffix argument must not be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.conflict_matcher.parent_suffix.missing_suffix");
|
||||
}
|
||||
return new ParentPathSuffixMatcher(suffix);
|
||||
return new ParentPathSuffixMatcher(suffix.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,11 +29,11 @@ public class PathContainsMatcher implements PathMatcher {
|
||||
|
||||
@Override
|
||||
public PathMatcher create(Map<String, Object> arguments) {
|
||||
String path = (String) arguments.get("path");
|
||||
Object path = arguments.get("path");
|
||||
if (path == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.conflict_matcher.contains.lack_path", new NullPointerException("path should not be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.conflict_matcher.contains.missing_path", new NullPointerException("path should not be null"));
|
||||
}
|
||||
return new PathContainsMatcher(path);
|
||||
return new PathContainsMatcher(path.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class PathMatchers {
|
||||
public static PathMatcher fromMap(Map<String, Object> map) {
|
||||
String type = (String) map.getOrDefault("type", "empty");
|
||||
if (type == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.conflict_matcher.lack_type", new NullPointerException("path matcher type cannot be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.conflict_matcher.missing_type", new NullPointerException("path matcher type cannot be null"));
|
||||
}
|
||||
Key key = Key.withDefaultNamespace(type, "craftengine");
|
||||
PathMatcherFactory factory = BuiltInRegistries.PATH_MATCHER_FACTORY.getValue(key);
|
||||
|
||||
@@ -29,11 +29,11 @@ public class PathPatternMatcher implements PathMatcher {
|
||||
|
||||
@Override
|
||||
public PathMatcher create(Map<String, Object> arguments) {
|
||||
String pattern = (String) arguments.get("pattern");
|
||||
Object pattern = arguments.get("pattern");
|
||||
if (pattern == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.conflict_matcher.pattern.lack_pattern", new IllegalArgumentException("The pattern argument must not be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.conflict_matcher.pattern.missing_pattern", new IllegalArgumentException("The pattern argument must not be null"));
|
||||
}
|
||||
return new PathPatternMatcher(pattern);
|
||||
return new PathPatternMatcher(pattern.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,12 +33,12 @@ public class Resolutions {
|
||||
public static Resolution fromMap(Map<String, Object> map) {
|
||||
String type = (String) map.getOrDefault("type", "empty");
|
||||
if (type == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.conflict_resolution.lack_type", new NullPointerException("path matcher type cannot be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.conflict_resolution.missing_type");
|
||||
}
|
||||
Key key = Key.withDefaultNamespace(type, "craftengine");
|
||||
ResolutionFactory factory = BuiltInRegistries.RESOLUTION_FACTORY.getValue(key);
|
||||
if (factory == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.conflict_resolution.invalid_type", new IllegalArgumentException("Unknown matcher type: " + type), type);
|
||||
throw new LocalizedResourceConfigException("warning.config.conflict_resolution.invalid_type", type);
|
||||
}
|
||||
return factory.create(map);
|
||||
}
|
||||
|
||||
@@ -16,12 +16,12 @@ public interface ResourcePackHostFactory {
|
||||
if (proxySetting != null) {
|
||||
Object hostObj = proxySetting.get("host");
|
||||
if (hostObj == null) {
|
||||
throw new LocalizedException("warning.config.host.proxy.lack_host", new NullPointerException("'host' should not be null for proxy setting"));
|
||||
throw new LocalizedException("warning.config.host.proxy.missing_host", new NullPointerException("'host' should not be null for proxy setting"));
|
||||
}
|
||||
String proxyHost = hostObj.toString();
|
||||
Object portObj = proxySetting.get("port");
|
||||
if (portObj == null) {
|
||||
throw new LocalizedException("warning.config.host.proxy.lack_port", new NullPointerException("'port' should not be null for proxy setting"));
|
||||
throw new LocalizedException("warning.config.host.proxy.missing_port", new NullPointerException("'port' should not be null for proxy setting"));
|
||||
}
|
||||
int proxyPort = ResourceConfigUtils.getAsInt(portObj, "port");
|
||||
if (proxyHost == null || proxyHost.isEmpty() || proxyPort <= 0 || proxyPort > 65535) {
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ResourcePackHosts {
|
||||
public static ResourcePackHost fromMap(Map<String, Object> map) {
|
||||
String type = (String) map.get("type");
|
||||
if (type == null) {
|
||||
throw new LocalizedException("warning.config.host.external.lack_url");
|
||||
throw new LocalizedException("warning.config.host.missing_type");
|
||||
}
|
||||
Key key = Key.withDefaultNamespace(type, "craftengine");
|
||||
ResourcePackHostFactory factory = BuiltInRegistries.RESOURCE_PACK_HOST_FACTORY.getValue(key);
|
||||
|
||||
@@ -294,22 +294,22 @@ public class AlistHost implements ResourcePackHost {
|
||||
boolean useEnv = (boolean) arguments.getOrDefault("use-environment-variables", false);
|
||||
String apiUrl = (String) arguments.get("api-url");
|
||||
if (apiUrl == null || apiUrl.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.alist.lack_api_url");
|
||||
throw new LocalizedException("warning.config.host.alist.missing_api_url");
|
||||
}
|
||||
String userName = useEnv ? System.getenv("CE_ALIST_USERNAME") : (String) arguments.get("username");
|
||||
if (userName == null || userName.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.alist.lack_username");
|
||||
throw new LocalizedException("warning.config.host.alist.missing_username");
|
||||
}
|
||||
String password = useEnv ? System.getenv("CE_ALIST_PASSWORD") : (String) arguments.get("password");
|
||||
if (password == null || password.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.alist.lack_password");
|
||||
throw new LocalizedException("warning.config.host.alist.missing_password");
|
||||
}
|
||||
String filePassword = useEnv ? System.getenv("CE_ALIST_FILE_PASSWORD") : (String) arguments.getOrDefault("file-password", "");
|
||||
String otpCode = (String) arguments.get("otp-code");
|
||||
Duration jwtTokenExpiration = Duration.ofHours((int) arguments.getOrDefault("jwt-token-expiration", 48));
|
||||
String uploadPath = (String) arguments.get("upload-path");
|
||||
if (uploadPath == null || uploadPath.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.alist.lack_upload_path");
|
||||
throw new LocalizedException("warning.config.host.alist.missing_upload_path");
|
||||
}
|
||||
boolean disableUpload = (boolean) arguments.getOrDefault("disable-upload", false);
|
||||
ProxySelector proxy = getProxySelector(MiscUtils.castToMap(arguments.get("proxy"), true));
|
||||
|
||||
@@ -269,19 +269,19 @@ public class DropboxHost implements ResourcePackHost {
|
||||
boolean useEnv = (boolean) arguments.getOrDefault("use-environment-variables", false);
|
||||
String appKey = useEnv ? System.getenv("CE_DROPBOX_APP_KEY") : (String) arguments.get("app-key");
|
||||
if (appKey == null || appKey.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.dropbox.lack_app_key");
|
||||
throw new LocalizedException("warning.config.host.dropbox.missing_app_key");
|
||||
}
|
||||
String appSecret = useEnv ? System.getenv("CE_DROPBOX_APP_SECRET") : (String) arguments.get("app-secret");
|
||||
if (appSecret == null || appSecret.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.dropbox.lack_app_secret");
|
||||
throw new LocalizedException("warning.config.host.dropbox.missing_app_secret");
|
||||
}
|
||||
String refreshToken = useEnv ? System.getenv("CE_DROPBOX_REFRESH_TOKEN") : (String) arguments.get("refresh-token");
|
||||
if (refreshToken == null || refreshToken.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.dropbox.lack_refresh_token");
|
||||
throw new LocalizedException("warning.config.host.dropbox.missing_refresh_token");
|
||||
}
|
||||
String uploadPath = (String) arguments.get("upload-path");
|
||||
if (uploadPath == null || uploadPath.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.dropbox.lack_upload_path");
|
||||
throw new LocalizedException("warning.config.host.dropbox.missing_upload_path");
|
||||
}
|
||||
ProxySelector proxy = getProxySelector(MiscUtils.castToMap(arguments.get("proxy"), true));
|
||||
return new DropboxHost(appKey, appSecret, refreshToken, "/" + uploadPath, proxy);
|
||||
|
||||
@@ -47,7 +47,7 @@ public class ExternalHost implements ResourcePackHost {
|
||||
public ResourcePackHost create(Map<String, Object> arguments) {
|
||||
String url = (String) arguments.get("url");
|
||||
if (url == null || url.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.external.lack_url");
|
||||
throw new LocalizedException("warning.config.host.external.missing_url");
|
||||
}
|
||||
String uuid = (String) arguments.get("uuid");
|
||||
if (uuid == null || uuid.isEmpty()) {
|
||||
|
||||
@@ -179,18 +179,18 @@ public class GitLabHost implements ResourcePackHost {
|
||||
boolean useEnv = (boolean) arguments.getOrDefault("use-environment-variables", false);
|
||||
String gitlabUrl = (String) arguments.get("gitlab-url");
|
||||
if (gitlabUrl == null || gitlabUrl.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.gitlab.lack_url");
|
||||
throw new LocalizedException("warning.config.host.gitlab.missing_url");
|
||||
}
|
||||
if (gitlabUrl.endsWith("/")) {
|
||||
gitlabUrl = gitlabUrl.substring(0, gitlabUrl.length() - 1);
|
||||
}
|
||||
String accessToken = useEnv ? System.getenv("CE_GITLAB_ACCESS_TOKEN") : (String) arguments.get("access-token");
|
||||
if (accessToken == null || accessToken.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.gitlab.lack_access_token");
|
||||
throw new LocalizedException("warning.config.host.gitlab.missing_token");
|
||||
}
|
||||
String projectId = (String) arguments.get("project-id");
|
||||
if (projectId == null || projectId.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.gitlab.lack_project_id");
|
||||
throw new LocalizedException("warning.config.host.gitlab.missing_project");
|
||||
}
|
||||
projectId = URLEncoder.encode(projectId, StandardCharsets.UTF_8).replace("/", "%2F");
|
||||
ProxySelector proxy = getProxySelector(MiscUtils.castToMap(arguments.get("proxy"), true));
|
||||
|
||||
@@ -274,7 +274,7 @@ public class LobFileHost implements ResourcePackHost {
|
||||
boolean useEnv = (boolean) arguments.getOrDefault("use-environment-variables", false);
|
||||
String apiKey = useEnv ? System.getenv("CE_LOBFILE_API_KEY") : (String) arguments.get("api-key");
|
||||
if (apiKey == null || apiKey.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.lobfile.lack_api_key");
|
||||
throw new LocalizedException("warning.config.host.lobfile.missing_api_key");
|
||||
}
|
||||
ProxySelector proxy = getProxySelector(MiscUtils.castToMap(arguments.get("proxy"), true));
|
||||
return new LobFileHost(apiKey, proxy);
|
||||
|
||||
@@ -234,19 +234,19 @@ public class OneDriveHost implements ResourcePackHost {
|
||||
boolean useEnv = (boolean) arguments.getOrDefault("use-environment-variables", false);
|
||||
String clientId = useEnv ? System.getenv("CE_ONEDRIVE_CLIENT_ID") : (String) arguments.get("client-id");
|
||||
if (clientId == null || clientId.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.onedrive.lack_client_id");
|
||||
throw new LocalizedException("warning.config.host.onedrive.missing_client_id");
|
||||
}
|
||||
String clientSecret = useEnv ? System.getenv("CE_ONEDRIVE_CLIENT_SECRET") : (String) arguments.get("client-secret");
|
||||
if (clientSecret == null || clientSecret.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.onedrive.lack_client_secret");
|
||||
throw new LocalizedException("warning.config.host.onedrive.missing_client_secret");
|
||||
}
|
||||
String refreshToken = useEnv ? System.getenv("CE_ONEDRIVE_REFRESH_TOKEN") : (String) arguments.get("refresh-token");
|
||||
if (refreshToken == null || refreshToken.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.onedrive.lack_refresh_token");
|
||||
throw new LocalizedException("warning.config.host.onedrive.missing_refresh_token");
|
||||
}
|
||||
String uploadPath = (String) arguments.getOrDefault("upload-path", "resource_pack.zip");
|
||||
if (uploadPath == null || uploadPath.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.onedrive.lack_upload_path");
|
||||
throw new LocalizedException("warning.config.host.onedrive.missing_upload_path");
|
||||
}
|
||||
ProxySelector proxy = getProxySelector(MiscUtils.castToMap(arguments.get("proxy"), true));
|
||||
return new OneDriveHost(clientId, clientSecret, refreshToken, uploadPath, proxy);
|
||||
|
||||
@@ -160,26 +160,26 @@ public class S3Host implements ResourcePackHost {
|
||||
boolean useEnv = (boolean) arguments.getOrDefault("use-environment-variables", false);
|
||||
String endpoint = (String) arguments.get("endpoint");
|
||||
if (endpoint == null || endpoint.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.s3.lack_endpoint");
|
||||
throw new LocalizedException("warning.config.host.s3.missing_endpoint");
|
||||
}
|
||||
String protocol = (String) arguments.getOrDefault("protocol", "https");
|
||||
boolean usePathStyle = (boolean) arguments.getOrDefault("path-style", false);
|
||||
String bucket = (String) arguments.get("bucket");
|
||||
if (bucket == null || bucket.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.s3.lack_bucket");
|
||||
throw new LocalizedException("warning.config.host.s3.missing_bucket");
|
||||
}
|
||||
String region = (String) arguments.getOrDefault("region", "auto");
|
||||
String accessKeyId = useEnv ? System.getenv("CE_S3_ACCESS_KEY_ID") : (String) arguments.get("access-key-id");
|
||||
if (accessKeyId == null || accessKeyId.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.s3.lack_access_key_id");
|
||||
throw new LocalizedException("warning.config.host.s3.missing_access_key");
|
||||
}
|
||||
String accessKeySecret = useEnv ? System.getenv("CE_S3_ACCESS_KEY_SECRET") : (String) arguments.get("access-key-secret");
|
||||
if (accessKeySecret == null || accessKeySecret.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.s3.lack_access_key_secret");
|
||||
throw new LocalizedException("warning.config.host.s3.missing_secret");
|
||||
}
|
||||
String uploadPath = (String) arguments.getOrDefault("upload-path", "craftengine/resource_pack.zip");
|
||||
if (uploadPath == null || uploadPath.isEmpty()) {
|
||||
throw new LocalizedException("warning.config.host.s3.lack_upload_path");
|
||||
throw new LocalizedException("warning.config.host.s3.missing_upload_path");
|
||||
}
|
||||
boolean useLegacySignature = (boolean) arguments.getOrDefault("use-legacy-signature", true);
|
||||
Duration validity = Duration.ofSeconds((int) arguments.getOrDefault("validity", 10));
|
||||
|
||||
@@ -63,7 +63,7 @@ public class SelfHost implements ResourcePackHost {
|
||||
SelfHostHttpServer selfHostHttpServer = SelfHostHttpServer.instance();
|
||||
String ip = (String) arguments.get("ip");
|
||||
if (ip == null) {
|
||||
throw new LocalizedException("warning.config.host.self.lack_ip");
|
||||
throw new LocalizedException("warning.config.host.self.missing_ip");
|
||||
}
|
||||
int port = ResourceConfigUtils.getAsInt(arguments.getOrDefault("port", 8163), "port");
|
||||
if (port < 0 || port > 65535) {
|
||||
|
||||
@@ -71,11 +71,11 @@ public class BaseItemModel implements ItemModel {
|
||||
public ItemModel create(Map<String, Object> arguments) {
|
||||
Object path = arguments.get("path");
|
||||
if (path == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.base.lack_path", new NullPointerException("'path' is required for 'minecraft:model'"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.base.missing_path", new NullPointerException("'path' is required for 'minecraft:model'"));
|
||||
}
|
||||
String modelPath = path.toString();
|
||||
if (!ResourceLocation.isValid(modelPath)) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.base.invalid_resource_location", new IllegalArgumentException("Invalid resource location: " + modelPath), modelPath);
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.base.invalid_path", new IllegalArgumentException("Invalid resource location: " + modelPath), modelPath);
|
||||
}
|
||||
Map<String, Object> generation = MiscUtils.castToMap(arguments.get("generation"), true);
|
||||
ModelGeneration modelGeneration = null;
|
||||
|
||||
@@ -58,7 +58,7 @@ public class CompositeItemModel implements ItemModel {
|
||||
if (m instanceof List<?> list) {
|
||||
List<Map<String, Object>> models = (List<Map<String, Object>>) list;
|
||||
if (models.isEmpty()) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.composite.lack_models", new IllegalArgumentException("'models' list should not be empty for 'minecraft:composite'"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.composite.missing_models", new IllegalArgumentException("'models' list should not be empty for 'minecraft:composite'"));
|
||||
}
|
||||
List<ItemModel> modelList = new ArrayList<>();
|
||||
for (Map<String, Object> model : models) {
|
||||
@@ -68,7 +68,7 @@ public class CompositeItemModel implements ItemModel {
|
||||
} else if (m instanceof Map<?, ?> map) {
|
||||
return new CompositeItemModel(List.of(ItemModels.fromMap(MiscUtils.castToMap(map, false))));
|
||||
} else {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.composite.lack_models", new NullPointerException("'models' argument is required for 'minecraft:composite'"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.composite.missing_models", new NullPointerException("'models' argument is required for 'minecraft:composite'"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,13 +68,13 @@ public class ConditionItemModel implements ItemModel {
|
||||
if (arguments.get("on-true") instanceof Map<?,?> map1) {
|
||||
onTrue = ItemModels.fromMap(MiscUtils.castToMap(map1, false));
|
||||
} else {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.condition.lack_on_true", new NullPointerException("'on-true' is required for condition"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.condition.missing_on_true", new NullPointerException("'on-true' is required for condition"));
|
||||
}
|
||||
ItemModel onFalse;
|
||||
if (arguments.get("on-false") instanceof Map<?,?> map2) {
|
||||
onFalse = ItemModels.fromMap(MiscUtils.castToMap(map2, false));
|
||||
} else {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.condition.lack_on_false", new NullPointerException("'on-false' is required for condition"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.condition.missing_on_false", new NullPointerException("'on-false' is required for condition"));
|
||||
}
|
||||
return new ConditionItemModel(property, onTrue, onFalse);
|
||||
}
|
||||
|
||||
@@ -109,16 +109,16 @@ public class RangeDispatchItemModel implements ItemModel {
|
||||
float threshold = ResourceConfigUtils.getAsFloat(entry.getOrDefault("threshold", 1), "threshold");
|
||||
Object model = entry.getOrDefault("model", fallback);
|
||||
if (model == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.entry.lack_model", new NullPointerException("'model' is required for range_dispatch entry"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.entry.missing_model", new NullPointerException("'model' is required for range_dispatch entry"));
|
||||
}
|
||||
entryMap.put(threshold, ItemModels.fromMap(MiscUtils.castToMap(model, false)));
|
||||
}
|
||||
return new RangeDispatchItemModel(property, scale, fallback == null ? null : ItemModels.fromMap(fallback), entryMap);
|
||||
} else {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.lack_entries", new IllegalArgumentException("No entries found for range_dispatch"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.missing_entries", new IllegalArgumentException("No entries found for range_dispatch"));
|
||||
}
|
||||
} else {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.lack_entries", new NullPointerException("'entries' is required for the range_dispatch model"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.missing_entries", new NullPointerException("'entries' is required for the range_dispatch model"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ public class SelectItemModel implements ItemModel {
|
||||
for (Map<String, Object> c : cases) {
|
||||
Object when = c.get("when");
|
||||
if (when == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.select.case.lack_when", new NullPointerException("'when' should not be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.select.case.missing_when", new NullPointerException("'when' should not be null"));
|
||||
}
|
||||
Either<String, List<String>> either;
|
||||
if (when instanceof List<?> whenList) {
|
||||
@@ -120,16 +120,16 @@ public class SelectItemModel implements ItemModel {
|
||||
}
|
||||
Object model = c.get("model");
|
||||
if (model == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.select.case.lack_model", new NullPointerException("'model' should not be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.select.case.missing_model", new NullPointerException("'model' should not be null"));
|
||||
}
|
||||
whenMap.put(either, ItemModels.fromMap(MiscUtils.castToMap(model, false)));
|
||||
}
|
||||
return new SelectItemModel(property, whenMap, fallback == null ? null : ItemModels.fromMap(fallback));
|
||||
} else {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.select.lack_cases", new NullPointerException("'cases' is required for the select model"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.select.missing_cases", new NullPointerException("'cases' is required for the select model"));
|
||||
}
|
||||
} else {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.select.lack_cases", new NullPointerException("'cases' is required for the select model"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.select.missing_cases", new NullPointerException("'cases' is required for the select model"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class ConditionProperties {
|
||||
public static ConditionProperty fromMap(Map<String, Object> map) {
|
||||
String type = (String) map.get("property");
|
||||
if (type == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.condition.lack_property", new NullPointerException("property type cannot be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.condition.missing_property", new NullPointerException("property type cannot be null"));
|
||||
}
|
||||
Key key = Key.withDefaultNamespace(type, "minecraft");
|
||||
ConditionPropertyFactory factory = BuiltInRegistries.CONDITION_PROPERTY_FACTORY.getValue(key);
|
||||
|
||||
@@ -38,7 +38,7 @@ public class HasComponentConditionProperty implements ConditionProperty {
|
||||
boolean ignoreDefault = (boolean) arguments.getOrDefault("ignore-default", false);
|
||||
Object componentObj = arguments.get("component");
|
||||
if (componentObj == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.condition.has_component.lack_component", new NullPointerException("component should not be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.condition.has_component.missing_component", new NullPointerException("component should not be null"));
|
||||
}
|
||||
String component = componentObj.toString();
|
||||
return new HasComponentConditionProperty(component, ignoreDefault);
|
||||
|
||||
@@ -32,7 +32,7 @@ public class KeyBindDownConditionProperty implements ConditionProperty {
|
||||
public ConditionProperty create(Map<String, Object> arguments) {
|
||||
Object keybindObj = arguments.get("keybind");
|
||||
if (keybindObj == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.condition.keybind_down.lack_keybind", new NullPointerException("keybind should not be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.condition.keybind.missing", new NullPointerException("keybind should not be null"));
|
||||
}
|
||||
String keybind = keybindObj.toString();
|
||||
return new KeyBindDownConditionProperty(keybind);
|
||||
|
||||
@@ -2,10 +2,9 @@ package net.momirealms.craftengine.core.pack.model.generation;
|
||||
|
||||
import net.momirealms.craftengine.core.pack.ResourceLocation;
|
||||
import net.momirealms.craftengine.core.plugin.CraftEngine;
|
||||
import net.momirealms.craftengine.core.plugin.locale.TranslationManager;
|
||||
import net.momirealms.craftengine.core.plugin.locale.LocalizedResourceConfigException;
|
||||
import net.momirealms.craftengine.core.util.Key;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -28,21 +27,20 @@ public abstract class AbstractModelGenerator implements ModelGenerator {
|
||||
this.modelsToGenerate.clear();
|
||||
}
|
||||
|
||||
public void prepareModelGeneration(Path path, Key id, ModelGeneration model) {
|
||||
public void prepareModelGeneration(ModelGeneration model) {
|
||||
ModelGeneration conflict = this.modelsToGenerate.get(model.path());
|
||||
if (conflict != null) {
|
||||
if (conflict.equals(model)) {
|
||||
return;
|
||||
}
|
||||
TranslationManager.instance().log("warning.config.model.generation.conflict", path.toString(), id.toString(), model.path().toString());
|
||||
return;
|
||||
throw new LocalizedResourceConfigException("warning.config.model.generation.conflict", model.path().toString());
|
||||
}
|
||||
if (!ResourceLocation.isValid(model.parentModelPath())) {
|
||||
TranslationManager.instance().log("warning.config.model.generation.parent.invalid_resource_location", path.toString(), id.toString(), model.parentModelPath());
|
||||
throw new LocalizedResourceConfigException("warning.config.model.generation.parent.invalid", model.parentModelPath());
|
||||
}
|
||||
for (Map.Entry<String, String> texture : model.texturesOverride().entrySet()) {
|
||||
if (!ResourceLocation.isValid(texture.getValue())) {
|
||||
TranslationManager.instance().log("warning.config.model.generation.texture.invalid_resource_location", path.toString(), id.toString(), texture.getKey(), texture.getValue());
|
||||
throw new LocalizedResourceConfigException("warning.config.model.generation.texture.invalid", texture.getKey(), texture.getValue());
|
||||
}
|
||||
}
|
||||
this.modelsToGenerate.put(model.path(), model);
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ModelGeneration {
|
||||
this.path = path;
|
||||
Object parent = map.get("parent");
|
||||
if (parent == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.model.generation.lack_parent", new NullPointerException("'parent' argument is required for generation"));
|
||||
throw new LocalizedResourceConfigException("warning.config.model.generation.missing_parent", new NullPointerException("'parent' argument is required for generation"));
|
||||
}
|
||||
this.parentModelPath = parent.toString();
|
||||
Map<String, Object> texturesMap = MiscUtils.castToMap(map.get("textures"), true);
|
||||
|
||||
@@ -32,7 +32,7 @@ public class CompassRangeDispatchProperty implements RangeDispatchProperty {
|
||||
public RangeDispatchProperty create(Map<String, Object> arguments) {
|
||||
Object targetObj = arguments.get("target");
|
||||
if (targetObj == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.compass.lack_target", new NullPointerException("target should not be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.compass.missing_target", new NullPointerException("target should not be null"));
|
||||
}
|
||||
String target = targetObj.toString();
|
||||
return new CompassRangeDispatchProperty(target);
|
||||
|
||||
@@ -44,7 +44,7 @@ public class RangeDispatchProperties {
|
||||
public static RangeDispatchProperty fromMap(Map<String, Object> map) {
|
||||
String type = (String) map.get("property");
|
||||
if (type == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.lack_property", new NullPointerException("property type cannot be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.missing_property", new NullPointerException("property type cannot be null"));
|
||||
}
|
||||
Key key = Key.withDefaultNamespace(type, "minecraft");
|
||||
RangeDispatchPropertyFactory factory = BuiltInRegistries.RANGE_DISPATCH_PROPERTY_FACTORY.getValue(key);
|
||||
|
||||
@@ -37,7 +37,7 @@ public class TimeRangeDispatchProperty implements RangeDispatchProperty {
|
||||
public RangeDispatchProperty create(Map<String, Object> arguments) {
|
||||
Object sourceObj = arguments.get("source");
|
||||
if (sourceObj == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.time.lack_source", new NullPointerException("source should not be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.range_dispatch.time.missing_source", new NullPointerException("source should not be null"));
|
||||
}
|
||||
String source = sourceObj.toString();
|
||||
boolean wobble = (boolean) arguments.getOrDefault("wobble", true);
|
||||
|
||||
@@ -32,7 +32,7 @@ public class BlockStateSelectProperty implements SelectProperty {
|
||||
public SelectProperty create(Map<String, Object> arguments) {
|
||||
Object property = arguments.get("block-state-property");
|
||||
if (property == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.select.block_state.lack_block_state_property", new NullPointerException("block-state-property should not be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.select.block_state.missing_property", new NullPointerException("block-state-property should not be null"));
|
||||
}
|
||||
String blockStateProperty = property.toString();
|
||||
return new BlockStateSelectProperty(blockStateProperty);
|
||||
|
||||
@@ -45,7 +45,7 @@ public class LocalTimeSelectProperty implements SelectProperty {
|
||||
public SelectProperty create(Map<String, Object> arguments) {
|
||||
Object patternObj = arguments.get("pattern");
|
||||
if (patternObj == null) {
|
||||
throw new IllegalArgumentException("warning.config.item.model.select.local_time.lack_pattern", new NullPointerException("pattern should not be null"));
|
||||
throw new IllegalArgumentException("warning.config.item.model.select.local_time.missing_pattern", new NullPointerException("pattern should not be null"));
|
||||
}
|
||||
String pattern = patternObj.toString();
|
||||
String locale = (String) arguments.get("locale");
|
||||
|
||||
@@ -42,7 +42,7 @@ public class SelectProperties {
|
||||
public static SelectProperty fromMap(Map<String, Object> map) {
|
||||
String type = (String) map.get("property");
|
||||
if (type == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.select.lack_property", new NullPointerException("property type cannot be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.select.missing_property", new NullPointerException("property type cannot be null"));
|
||||
}
|
||||
Key key = Key.withDefaultNamespace(type, "minecraft");
|
||||
SelectPropertyFactory factory = BuiltInRegistries.SELECT_PROPERTY_FACTORY.getValue(key);
|
||||
|
||||
@@ -45,7 +45,7 @@ public class SpecialModels {
|
||||
public static SpecialModel fromMap(Map<String, Object> map) {
|
||||
String type = (String) map.get("type");
|
||||
if (type == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.special.lack_type", new NullPointerException("special model type cannot be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.special.missing_type", new NullPointerException("special model type cannot be null"));
|
||||
}
|
||||
Key key = Key.withDefaultNamespace(type, "minecraft");
|
||||
SpecialModelFactory factory = BuiltInRegistries.SPECIAL_MODEL_FACTORY.getValue(key);
|
||||
|
||||
@@ -35,7 +35,7 @@ public class ConstantTint implements Tint {
|
||||
public Tint create(Map<String, Object> arguments) {
|
||||
Object value = arguments.get("value");
|
||||
if (value == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.tint.constant.lack_value", new NullPointerException("value should not be null"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.tint.constant.missing_value", new NullPointerException("value should not be null"));
|
||||
}
|
||||
return new ConstantTint(parseTintValue(value));
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class GrassTint implements Tint {
|
||||
float temperature = ResourceConfigUtils.getAsFloat(arguments.getOrDefault("temperature", 0), "temperature");
|
||||
float downfall = ResourceConfigUtils.getAsFloat(arguments.getOrDefault("downfall", 0), "downfall");
|
||||
if (temperature > 1 || temperature < 0) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.tint.grass.invalid_temperature", new IllegalArgumentException("Invalid temperature: " + temperature + ". Valid range 0~1"), String.valueOf(temperature));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.tint.grass.invalid_temp", new IllegalArgumentException("Invalid temperature: " + temperature + ". Valid range 0~1"), String.valueOf(temperature));
|
||||
}
|
||||
if (downfall > 1 || downfall < 0) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.tint.grass.invalid_downfall", new IllegalArgumentException("Invalid downfall: " + downfall + ". Valid range 0~1"), String.valueOf(downfall));
|
||||
|
||||
@@ -40,7 +40,7 @@ public class Tints {
|
||||
public static Tint fromMap(Map<String, Object> map) {
|
||||
String type = (String) map.get("type");
|
||||
if (type == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.tint.lack_type", new NullPointerException("'type' cannot be null for tint"));
|
||||
throw new LocalizedResourceConfigException("warning.config.item.model.tint.missing_type", new NullPointerException("'type' cannot be null for tint"));
|
||||
}
|
||||
Key key = Key.withDefaultNamespace(type, "minecraft");
|
||||
TintFactory factory = BuiltInRegistries.TINT_FACTORY.getValue(key);
|
||||
|
||||
@@ -49,7 +49,7 @@ public class SelfIncreaseIntTemplateArgument implements TemplateArgument {
|
||||
public TemplateArgument create(Map<String, Object> arguments) {
|
||||
int from = ResourceConfigUtils.getAsInt(arguments.get("from"), "from");
|
||||
int to = ResourceConfigUtils.getAsInt(arguments.get("to"), "to");
|
||||
if (from > to) throw new LocalizedResourceConfigException("warning.config.template.from_larger_than_to", String.valueOf(from), String.valueOf(to));
|
||||
if (from > to) throw new LocalizedResourceConfigException("warning.config.template.argument.self_increase_int.invalid_range", String.valueOf(from), String.valueOf(to));
|
||||
return new SelfIncreaseIntTemplateArgument(from, to);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class TemplateManagerImpl implements TemplateManager {
|
||||
@Override
|
||||
public void addTemplate(Pack pack, Path path, Key id, Object obj) {
|
||||
if (this.templates.containsKey(id)) {
|
||||
throw new LocalizedResourceConfigException("warning.config.template.duplicated", path.toString(), id.toString());
|
||||
throw new LocalizedResourceConfigException("warning.config.template.duplicate", path.toString(), id.toString());
|
||||
}
|
||||
this.templates.put(id, obj);
|
||||
}
|
||||
|
||||
@@ -75,16 +75,16 @@ public abstract class AbstractSoundManager implements SoundManager {
|
||||
@Override
|
||||
public void parseSection(Pack pack, Path path, Key id, Map<String, Object> section) {
|
||||
if (AbstractSoundManager.this.songs.containsKey(id)) {
|
||||
throw new LocalizedResourceConfigException("warning.config.jukebox_song.duplicated", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.jukebox_song.duplicate", path, id);
|
||||
}
|
||||
String sound = (String) section.get("sound");
|
||||
Object sound = section.get("sound");
|
||||
if (sound == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.jukebox_song.lack_sound", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.jukebox_song.missing_sound", path, id);
|
||||
}
|
||||
Component description = AdventureHelper.miniMessage().deserialize(section.getOrDefault("description", "").toString());
|
||||
float length = ResourceConfigUtils.getAsFloat(section.get("length"), "length");
|
||||
int comparatorOutput = ResourceConfigUtils.getAsInt(section.getOrDefault("comparator-output", 15), "comparator-output");
|
||||
JukeboxSong song = new JukeboxSong(Key.of(sound), description, length, comparatorOutput, ResourceConfigUtils.getAsFloat(section.getOrDefault("range", 32f), "range"));
|
||||
JukeboxSong song = new JukeboxSong(Key.of(sound.toString()), description, length, comparatorOutput, ResourceConfigUtils.getAsFloat(section.getOrDefault("range", 32f), "range"));
|
||||
AbstractSoundManager.this.songs.put(id, song);
|
||||
}
|
||||
}
|
||||
@@ -105,13 +105,13 @@ public abstract class AbstractSoundManager implements SoundManager {
|
||||
@Override
|
||||
public void parseSection(Pack pack, Path path, Key id, Map<String, Object> section) {
|
||||
if (AbstractSoundManager.this.byId.containsKey(id)) {
|
||||
throw new LocalizedResourceConfigException("warning.config.sound.duplicated", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.sound.duplicate", path, id);
|
||||
}
|
||||
boolean replace = (boolean) section.getOrDefault("replace", false);
|
||||
String subtitle = (String) section.get("subtitle");
|
||||
List<?> soundList = (List<?>) section.get("sounds");
|
||||
if (soundList == null) {
|
||||
throw new LocalizedResourceConfigException("warning.config.sound.lack_sounds", path, id);
|
||||
throw new LocalizedResourceConfigException("warning.config.sound.missing_sounds", path, id);
|
||||
}
|
||||
List<Sound> sounds = new ArrayList<>();
|
||||
for (Object sound : soundList) {
|
||||
|
||||
@@ -53,7 +53,7 @@ public interface Sound extends Supplier<JsonElement> {
|
||||
|
||||
public static SoundFile fromMap(Map<String, Object> map) {
|
||||
Object name = map.get("name");
|
||||
if (name == null) throw new LocalizedResourceConfigException("warning.config.sound.lack_name", new NullPointerException("Missing required property 'name'"));
|
||||
if (name == null) throw new LocalizedResourceConfigException("warning.config.sound.missing_name", new NullPointerException("Missing required property 'name'"));
|
||||
Builder builder = file(name.toString());
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
Optional.ofNullable(Builder.MODIFIERS.get(entry.getKey())).ifPresent(modifier -> modifier.apply(builder, entry.getValue()));
|
||||
|
||||
@@ -23,7 +23,7 @@ public class CharacterUtils {
|
||||
chars[i] = (char) codePoint;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
throw new LocalizedResourceConfigException("warning.config.image.invalid_hex", e, hex);
|
||||
throw new LocalizedResourceConfigException("warning.config.image.invalid_hex_value", e, hex);
|
||||
}
|
||||
}
|
||||
return chars;
|
||||
|
||||
@@ -59,7 +59,7 @@ public class MiscUtils {
|
||||
} else if (split.length == 1) {
|
||||
return new Vector3f(Float.parseFloat(split[0]));
|
||||
} else {
|
||||
throw new LocalizedResourceConfigException("warning.config.cast_vector3f", new RuntimeException("Cannot convert " + o + " to Vector3f"), stringFormat, option);
|
||||
throw new LocalizedResourceConfigException("warning.config.type.vector3f", new RuntimeException("Cannot convert " + o + " to Vector3f"), stringFormat, option);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class MiscUtils {
|
||||
} else if (split.length == 1) {
|
||||
return QuaternionUtils.toQuaternionf(0, Math.toRadians(Float.parseFloat(split[0])), 0);
|
||||
} else {
|
||||
throw new LocalizedResourceConfigException("warning.config.cast_quaternionf", new RuntimeException("Cannot convert " + o + " to Quaternionf"), stringFormat, option);
|
||||
throw new LocalizedResourceConfigException("warning.config.type.quaternionf", new RuntimeException("Cannot convert " + o + " to Quaternionf"), stringFormat, option);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,13 +23,13 @@ public final class ResourceConfigUtils {
|
||||
try {
|
||||
return Integer.parseInt(s);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new LocalizedResourceConfigException("warning.config.cast_int", e, s, option);
|
||||
throw new LocalizedResourceConfigException("warning.config.type.int", e, s, option);
|
||||
}
|
||||
}
|
||||
case Boolean b -> {
|
||||
return b ? 1 : 0;
|
||||
}
|
||||
default -> throw new LocalizedResourceConfigException("warning.config.cast_int", o.toString(), option);
|
||||
default -> throw new LocalizedResourceConfigException("warning.config.type.int", o.toString(), option);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,11 +48,11 @@ public final class ResourceConfigUtils {
|
||||
try {
|
||||
return Double.parseDouble(s);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new LocalizedResourceConfigException("warning.config.cast_double", e, s, option);
|
||||
throw new LocalizedResourceConfigException("warning.config.type.double", e, s, option);
|
||||
}
|
||||
}
|
||||
default -> {
|
||||
throw new LocalizedResourceConfigException("warning.config.cast_double", o.toString(), option);
|
||||
throw new LocalizedResourceConfigException("warning.config.type.double", o.toString(), option);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,14 +69,14 @@ public final class ResourceConfigUtils {
|
||||
try {
|
||||
return Float.parseFloat(s);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new LocalizedResourceConfigException("warning.config.cast_float", e, s, option);
|
||||
throw new LocalizedResourceConfigException("warning.config.type.float", e, s, option);
|
||||
}
|
||||
}
|
||||
case Number number -> {
|
||||
return number.floatValue();
|
||||
}
|
||||
default -> {
|
||||
throw new LocalizedResourceConfigException("warning.config.cast_float", o.toString(), option);
|
||||
throw new LocalizedResourceConfigException("warning.config.type.float", o.toString(), option);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user