219 lines
13 KiB
Markdown
219 lines
13 KiB
Markdown
---
|
||
front: https://nie.res.netease.com/r/pic/20210727/82dd4b1e-04e1-4a90-a4c5-1a4d5cec462a.png
|
||
hard: 入门
|
||
time: 10分钟
|
||
---
|
||
|
||
# 1.23版本物品id变更
|
||
|
||
## 简介
|
||
|
||
1.23版本与1.22版本相比,有部分物品的名称发生了变更,例如生鱼从minecraft:fish变为minecraft:cod;牛奶桶从minecraft:bucket,附加值为1,改为minecraft:milk_bucket,附加值为0。
|
||
|
||
|
||
|
||
## 处理方法
|
||
|
||
在ModSDK的接口与事件中,我们针对上述情况做了以下处理:
|
||
|
||
1. 对于接受物品名称与附加值的接口,同时兼容旧版名称与新版名称
|
||
|
||
如SetUiItem接口
|
||
|
||
2. 在物品信息字典中添加newItemName及newAuxValue字段。
|
||
|
||
* 对于返回物品信息字典的接口与事件:
|
||
|
||
新字段newItemName及newAuxValue返回新版名称与附加值。
|
||
|
||
原字段itemName及auxValue返回旧版名称与附加值。
|
||
|
||
例如GetPlayerItem接口,OnCarriedNewItemChangedServerEvent事件
|
||
|
||
* 对于接受物品信息字典的接口与事件:
|
||
|
||
当字典存在newItemName及newAuxValue时,使用这两个新字段。
|
||
|
||
不存在时,使用旧字段itemName及auxValue。
|
||
|
||
例如SpawnItemToPlayerCarried接口,EntityDieLoottableServerEvent事件
|
||
|
||
|
||
|
||
## 注意事项
|
||
|
||
* 获取配方的接口,返回值没有做兼容,例如GetRecipeResult,GetRecipesByResult,GetRecipesByInput,将返回新版名称与附加值,如果您的组件对此有依赖,则需要对这次的改动自行做兼容处理。
|
||
|
||
* 新开发或正在开发的组件,建议统一采用新的newItemName及newAuxValue字段,也不要新旧字段混用。
|
||
|
||
* 某些写法可能会失效,例如
|
||
|
||
```python
|
||
# 获取itemDict,然后在他基础上修改itemName或auxValue后再用来生成
|
||
itemdict = GetPlayerItem()
|
||
itemdict['itemName'] = 'xxx'
|
||
itemdict['auxValue'] = itemdict['auxValue']+1
|
||
SpawnItemToPlayerInv(itemdict)
|
||
```
|
||
|
||
因为GetPlayerItem返回的itemDict含有新字段,再传入SpawnItemToPlayerInv时,会读取新字段生成物品,因此对原字段的修改无效。
|
||
|
||
|
||
|
||
## 物品名称变更表
|
||
|
||
以下为1.23版本变更了名称的物品列表。表格内的名称省略了minecraft命名空间。
|
||
|
||
| 旧名称 | 旧附加值 | 新名称 |
|
||
| ------------------- | ---------- | ------------------------------- |
|
||
| carrotonastick | | carrot_on_a_stick |
|
||
| fish | | cod |
|
||
| cooked_fish | | cooked_cod |
|
||
| clownfish | | tropical_fish |
|
||
| muttoncooked | | cooked_mutton |
|
||
| appleenchanted | | enchanted_golden_apple |
|
||
| fireball | | fire_charge |
|
||
| fireworks | | firework_rocket |
|
||
| fireworkscharge | | firework_star |
|
||
| speckled_melon | | glistering_melon_slice |
|
||
| record_11 | | music_disc_11 |
|
||
| record_13 | | music_disc_13 |
|
||
| record_blocks | | music_disc_blocks |
|
||
| record_cat | | music_disc_cat |
|
||
| record_chirp | | music_disc_chirp |
|
||
| record_far | | music_disc_far |
|
||
| record_mall | | music_disc_mall |
|
||
| record_mellohi | | music_disc_mellohi |
|
||
| record_pigstep | | music_disc_pigstep |
|
||
| record_stal | | music_disc_stal |
|
||
| record_strad | | music_disc_strad |
|
||
| record_wait | | music_disc_wait |
|
||
| record_ward | | music_disc_ward |
|
||
| muttonraw | | mutton |
|
||
| netherstar | | nether_star |
|
||
| chorus_fruit_popped | | popped_chorus_fruit |
|
||
| melon | | melon_slice |
|
||
| reeds | | sugar_cane |
|
||
| horsearmorleather | | leather_horse_armor |
|
||
| horsearmoriron | | iron_horse_armor |
|
||
| horsearmorgold | | golden_horse_armor |
|
||
| horsearmordiamond | | diamond_horse_armor |
|
||
| turtle_shell_piece | | scute |
|
||
| totem | | totem_of_undying |
|
||
| lodestonecompass | | lodestone_compass |
|
||
| map | | filled_map |
|
||
| emptymap | | empty_map |
|
||
| sign | | oak_sign |
|
||
| darkoak_sign | | dark_oak_sign |
|
||
| boat | 0 | oak_boat |
|
||
| boat | 1 | spruce_boat |
|
||
| boat | 2 | birch_boat |
|
||
| boat | 3 | jungle_boat |
|
||
| boat | 4 | acacia_boat |
|
||
| boat | 5 | dark_oak_boat |
|
||
| coal | 0 | coal |
|
||
| coal | 1 | charcoal |
|
||
| bucket | 0 | bucket |
|
||
| bucket | 1 | milk_bucket |
|
||
| bucket | 2 | cod_bucket |
|
||
| bucket | 3 | salmon_bucket |
|
||
| bucket | 4 | tropical_fish_bucket |
|
||
| bucket | 5 | pufferfish_bucket |
|
||
| bucket | 8 | water_bucket |
|
||
| bucket | 10 | lava_bucket |
|
||
| dye | 0 | ink_sac |
|
||
| dye | 1 | red_dye |
|
||
| dye | 2 | green_dye |
|
||
| dye | 3 | cocoa_beans |
|
||
| dye | 4 | lapis_lazuli |
|
||
| dye | 5 | purple_dye |
|
||
| dye | 6 | cyan_dye |
|
||
| dye | 7 | light_gray_dye |
|
||
| dye | 8 | gray_dye |
|
||
| dye | 9 | pink_dye |
|
||
| dye | 10 | lime_dye |
|
||
| dye | 11 | yellow_dye |
|
||
| dye | 12 | light_blue_dye |
|
||
| dye | 13 | magenta_dye |
|
||
| dye | 14 | orange_dye |
|
||
| dye | 15 | bone_meal |
|
||
| dye | 16 | black_dye |
|
||
| dye | 17 | brown_dye |
|
||
| dye | 18 | blue_dye |
|
||
| dye | 19 | white_dye |
|
||
| banner_pattern | 0 | creeper_banner_pattern |
|
||
| banner_pattern | 1 | skull_banner_pattern |
|
||
| banner_pattern | 2 | flower_banner_pattern |
|
||
| banner_pattern | 3 | mojang_banner_pattern |
|
||
| banner_pattern | 4 | field_masoned_banner_pattern |
|
||
| banner_pattern | 5 | bordure_indented_banner_pattern |
|
||
| banner_pattern | 6 | piglin_banner_pattern |
|
||
| spawn_egg | 10 | chicken_spawn_egg |
|
||
| spawn_egg | 11 | cow_spawn_egg |
|
||
| spawn_egg | 12 | pig_spawn_egg |
|
||
| spawn_egg | 13 | sheep_spawn_egg |
|
||
| spawn_egg | 14 | wolf_spawn_egg |
|
||
| spawn_egg | 15 | villager_spawn_egg |
|
||
| spawn_egg | 16 | mooshroom_spawn_egg |
|
||
| spawn_egg | 17 | squid_spawn_egg |
|
||
| spawn_egg | 18 | rabbit_spawn_egg |
|
||
| spawn_egg | 19 | bat_spawn_egg |
|
||
| spawn_egg | 22 | ocelot_spawn_egg |
|
||
| spawn_egg | 23 | horse_spawn_egg |
|
||
| spawn_egg | 24 | donkey_spawn_egg |
|
||
| spawn_egg | 25 | mule_spawn_egg |
|
||
| spawn_egg | 26 | skeleton_horse_spawn_egg |
|
||
| spawn_egg | 27 | zombie_horse_spawn_egg |
|
||
| spawn_egg | 28 | polar_bear_spawn_egg |
|
||
| spawn_egg | 29 | llama_spawn_egg |
|
||
| spawn_egg | 30 | parrot_spawn_egg |
|
||
| spawn_egg | 31 | dolphin_spawn_egg |
|
||
| spawn_egg | 32 | zombie_spawn_egg |
|
||
| spawn_egg | 33 | creeper_spawn_egg |
|
||
| spawn_egg | 34 | skeleton_spawn_egg |
|
||
| spawn_egg | 35 | spider_spawn_egg |
|
||
| spawn_egg | 36 | zombie_pigman_spawn_egg |
|
||
| spawn_egg | 37 | slime_spawn_egg |
|
||
| spawn_egg | 38 | enderman_spawn_egg |
|
||
| spawn_egg | 39 | silverfish_spawn_egg |
|
||
| spawn_egg | 40 | cave_spider_spawn_egg |
|
||
| spawn_egg | 41 | ghast_spawn_egg |
|
||
| spawn_egg | 42 | magma_cube_spawn_egg |
|
||
| spawn_egg | 43 | blaze_spawn_egg |
|
||
| spawn_egg | 44 | zombie_villager_spawn_egg |
|
||
| spawn_egg | 45 | witch_spawn_egg |
|
||
| spawn_egg | 46 | stray_spawn_egg |
|
||
| spawn_egg | 47 | husk_spawn_egg |
|
||
| spawn_egg | 48 | wither_skeleton_spawn_egg |
|
||
| spawn_egg | 49 | guardian_spawn_egg |
|
||
| spawn_egg | 50 | elder_guardian_spawn_egg |
|
||
| spawn_egg | 51 | npc_spawn_egg |
|
||
| spawn_egg | 54 | shulker_spawn_egg |
|
||
| spawn_egg | 55 | endermite_spawn_egg |
|
||
| spawn_egg | 56 | agent_spawn_egg |
|
||
| spawn_egg | 57 | vindicator_spawn_egg |
|
||
| spawn_egg | 58 | phantom_spawn_egg |
|
||
| spawn_egg | 59 | ravager_spawn_egg |
|
||
| spawn_egg | 74 | turtle_spawn_egg |
|
||
| spawn_egg | 75 | cat_spawn_egg |
|
||
| spawn_egg | 104 | evoker_spawn_egg |
|
||
| spawn_egg | 105 | vex_spawn_egg |
|
||
| spawn_egg | 108 | pufferfish_spawn_egg |
|
||
| spawn_egg | 109 | salmon_spawn_egg |
|
||
| spawn_egg | 110 | drowned_spawn_egg |
|
||
| spawn_egg | 111 | tropical_fish_spawn_egg |
|
||
| spawn_egg | 112 | cod_spawn_egg |
|
||
| spawn_egg | 113 | panda_spawn_egg |
|
||
| spawn_egg | 114 | pillager_spawn_egg |
|
||
| spawn_egg | 115 | villager_spawn_egg |
|
||
| spawn_egg | 116 | zombie_villager_spawn_egg |
|
||
| spawn_egg | 118 | wandering_trader_spawn_egg |
|
||
| spawn_egg | 121 | fox_spawn_egg |
|
||
| spawn_egg | 122 | bee_spawn_egg |
|
||
| spawn_egg | 123 | piglin_spawn_egg |
|
||
| spawn_egg | 124 | hoglin_spawn_egg |
|
||
| spawn_egg | 125 | strider_spawn_egg |
|
||
| spawn_egg | 126 | zoglin_spawn_egg |
|
||
| spawn_egg | 127 | piglin_brute_spawn_egg |
|
||
| spawn_egg | 128 | goat_spawn_egg |
|
||
| spawn_egg | 自定义生物 | 生物identifier_spawn_egg | |