9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-25 09:59:20 +00:00

Merge pull request #82 from jhqwqmc/dev

Dev
This commit is contained in:
XiaoMoMi
2025-04-04 16:35:15 +08:00
committed by GitHub
2 changed files with 62 additions and 24 deletions

View File

@@ -39,11 +39,11 @@ argument.parse.failure.aggregate.failure: "<red>无效的组件 '<arg:0>': <arg:
argument.parse.failure.either: "<red>无法从 '<arg:0>' 解析 <arg:1> 或 <arg:2></red>"
argument.parse.failure.namedtextcolor: "<red>'<arg:0>' 不是颜色代码</red>"
command.reload.config.success: "<white>重新加载配置完成. 耗时 <green><arg:0></green> 毫秒</white> <gray>(异步: <arg:1>ms | 同步: <arg:2>ms)</gray>"
command.reload.config.failure: "<red>重新加载配置失败,请检查控制台日志</red>"
command.reload.config.failure: "<red>重新加载配置失败,请检查控制台日志</red>"
command.reload.pack.success: "<white>资源包重新加载完成. 耗时 <green><arg:0></green> 毫秒</white>"
command.reload.pack.failure: "<red>重新加载资源包失败,请检查控制台日志</red>"
command.reload.pack.failure: "<red>重新加载资源包失败,请检查控制台日志</red>"
command.reload.all.success: "<white>全部重新加载完成. 耗时 <green><arg:0></green> 毫秒</white> <gray>(异步: <arg:1>ms | 同步: <arg:2>ms | 资源包: <arg:3>ms)</gray>"
command.reload.all.failure: "<red>重新加载失败,请检查控制台日志</red>"
command.reload.all.failure: "<red>重新加载失败,请检查控制台日志</red>"
command.item.get.success: "<white>获得<arg:0>个<arg:1></white>"
command.item.get.failure.not_exist: "<red><lang:argument.item.id.invalid:'<arg:0>'></red>"
command.item.give.success.single: "<lang:commands.give.success.single:'<arg:0>':'<arg:1>':'<arg:2>'>"
@@ -53,4 +53,39 @@ command.search_recipe.not_found: "<red>找不到此物品的配方</red>"
command.search_usage.not_found: "<red>找不到此物品的用途</red>"
command.search_recipe.no_item: "<red>请手持物品后再执行此命令</red>"
command.search_usage.no_item: "<red>请手持物品后再执行此命令</red>"
command.totem.not_totem: "<red>'<arg:0>' 不是 totem_of_undying 类型</red>"
command.totem.not_totem: "<red>'<arg:0>' 不是 totem_of_undying 类型</red>"
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' 高度值不应小于 'ascent' 基准线高度</yellow>"
warning.config.image.no_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.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>"

View File

@@ -972,28 +972,31 @@ public class PacketConsumers {
Object entity = Reflections.method$EntityLookup$get.invoke(entityLookup, id);
if (entity == null) return;
Object entityType = Reflections.method$Entity$getType.invoke(entity);
if (entityType != Reflections.instance$EntityType$BLOCK_DISPLAY) return;
List<Object> packedItems = (List<Object>) Reflections.field$ClientboundSetEntityDataPacket$packedItems.get(packet);
for (int i = 0; i < packedItems.size(); i++) {
Object packedItem = packedItems.get(i);
int entityDataId = (int) Reflections.field$SynchedEntityData$DataValue$id.get(packedItem);
if ((VersionHelper.isVersionNewerThan1_20_2() && entityDataId != 23)
|| (!VersionHelper.isVersionNewerThan1_20_2() && entityDataId != 22)) {
continue;
if (entityType == Reflections.instance$EntityType$BLOCK_DISPLAY) {
List<Object> packedItems = (List<Object>) Reflections.field$ClientboundSetEntityDataPacket$packedItems.get(packet);
for (int i = 0; i < packedItems.size(); i++) {
Object packedItem = packedItems.get(i);
int entityDataId = (int) Reflections.field$SynchedEntityData$DataValue$id.get(packedItem);
if ((VersionHelper.isVersionNewerThan1_20_2() && entityDataId != 23)
|| (!VersionHelper.isVersionNewerThan1_20_2() && entityDataId != 22)) {
continue;
}
Object blockState = Reflections.field$SynchedEntityData$DataValue$value.get(packedItem);
Object serializer = Reflections.field$SynchedEntityData$DataValue$serializer.get(packedItem);
int stateId = BlockStateUtils.blockStateToId(blockState);
int newStateId;
if (!user.clientModEnabled()) {
newStateId = remap(stateId);
} else {
newStateId = remapMOD(stateId);
}
packedItems.set(i, Reflections.constructor$SynchedEntityData$DataValue.newInstance(
entityDataId, serializer, BlockStateUtils.idToBlockState(newStateId)
));
break;
}
Object blockState = Reflections.field$SynchedEntityData$DataValue$value.get(packedItem);
Object serializer = Reflections.field$SynchedEntityData$DataValue$serializer.get(packedItem);
int stateId = BlockStateUtils.blockStateToId(blockState);
int newStateId;
if (!user.clientModEnabled()) {
newStateId = remap(stateId);
} else {
newStateId = remapMOD(stateId);
}
packedItems.set(i, Reflections.constructor$SynchedEntityData$DataValue.newInstance(
entityDataId, serializer, BlockStateUtils.idToBlockState(newStateId)
));
}
// todo修改其他实体的物品的方块谓词
} catch (Exception e) {
CraftEngine.instance().logger().warn("Failed to handle ClientboundSetEntityDataPacket", e);
}