1 17w17a 新成就系统JSON格式详解(翻译)
感谢Skylinerw的授权,玄素及chyx的翻译
2 概观
2.1 简介
1.12开始,成就(achievement,现在改叫advancement)已经从代码中分离出来,成为独立的json文件了。这让地图作者,modder和服主可以按照他们的喜好修改和添加advancement。
advancement有众多的选项,可以使用从玩家的物品栏到所在的生物群系的触发器。还可以设置达成后的奖励,例如解锁配方,获得物品或者经验。一个新指令/advancement也被加入来配合这些文件。
advancement使用json格式 http://json.org/ 在外部文件里保存advancement的信息。
2.2 错误
当你发现advancement因为某些原因失效的时候,你可以在log里找到错误信息,以得知因何而发生错误。
2.2.1 游戏输出窗口
你可以在正版启动器里打开游戏输出窗口。你需要在settings里打开:
这个窗口会显示错误信息以及堆棧跟踪(stacktrace):
2.2.2 Log文件
如果你不是用的正版启动器,或者游戏输出窗口因为某些原因变成空白一片,你可以查看游戏的log文件。
log文件的位置为: 游戏目录/logs/latest.log
。游戏目录一般为AppData里的.minecraft,不过也会因为不同启动器而有分别,请查看启动器的说明。
在log文件里,会有游戏从启动开始的资料。我们可以无视上方的资料,只看最下方的几个信息。里面应该会有一个信息类似这样:
[07:02:59] [Server thread/ERROR]: Parsing error loading custom advancement custom:example
com.google.gson.JsonSyntaxException: Missing description
at qe.a(SourceFile:447) ~[17w15a.jar:?]
at r.a(SourceFile:66) ~[17w15a.jar:?]
advancement的问题大约会出现 [Server thread/ERROR] 以及 Parsing error loading custom advancement。
custom advancement后面的文字就是 命名空间(namespace):advancement名称。下方第一行就是那错误的描述,然后再下方的就是堆棧跟踪了。
3 文件编辑
其实和loot table十分相近
你需要一个能用UTF-8字串编辑的编辑器,比如windows的notepad,以及其他主流编辑器。
最重要的是你用UTF-8格式储存。文件名称也应该是小写以避免不同OS的问题。
3.1 文件位置
Advancement会放在存档里面。准确来说,是存档/data/advancements/
这个文件夹里。以下是一个结构的例子,世界名称为New World。
3.1.1 命名空间(namespace)
advancements文件夹下的第一层文件夹就是里面advancement的命名空间了(注意,比如advancement是放在/advancements/a/b里面,它的命名空间是a而不是b,因为是看的第一层)。
命名空间是用来分别不同advancement集合的,比如不同mod的或者是不同地图的。
重要: 文件夹及文件名称都需要时小写(lowercase),以避免不同OS的问题。
在上面那存档的例子里, "skylinerwadvancements", "anothermod", 及"minecraft"都是命名空间。而challenges和story则不是。
minecraft命名空间只应用作覆盖原版的advancement(和原版的相同名字就能覆盖),比如要让某个advancement失效。其他advancement应该放在别的命名空间。
3.2 引用
当你需要引用advancement时,无论是从parent或是命令里引用,你都需要根据以下格式引用:
[命名空间]:[advancement文件路径(从命名空间的文件夹开始并且不需要写.json后缀)]
比如我们要引用/data/advancements/anothermod/challenges/kill_creepers.json:
anothermod:challenges/kill_creepers
如果忽略命名空间不写,则默认为minecraft命名空间
story/elytra = minecraft:story/elytra
3.3 覆盖原版advancement
你可以在minecraft命名空间里创建与原版同名的advancement以覆盖原版的。任何使用原版advancement的将会改为使用新建的那个。
比如这个/data/advancements/minecraft/story/elytra.json。这个advancement会覆盖原本会在背包内有鞘翅(Elytra)时触发的advancement。现在则会在有一个轻微损伤的鞘翅时触发(也就是刚开始飞行时能触发)。
{
"display": {
"icon": "minecraft:elytra",
"title": "Learn to Fly"
},
"parent": "minecraft:story/enter_end_gateway",
"criteria": {
"elytra": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:elytra",
"data": 1
}
]
}
}
}
}
3.3.1 原版advancement列表
注意这个列表会因版本更新而大幅改变
adventure/kill_a_mob
adventure/kill_all_mobs
adventure/root
adventure/shoot_arrow
adventure/sleep_in_bed
adventure/sniper_duel
adventure/trade
recipes/brewing/blaze_powder.json
recipes/brewing/brewing_stand.json
recipes/brewing/cauldron.json
recipes/brewing/fermented_spider_eye.json
recipes/brewing/glass_bottle.json
recipes/brewing/golden_carrot.json
recipes/brewing/magma_cream.json
recipes/brewing/speckled_melon.json
recipes/buildingBlocks/acacia_planks.json
recipes/buildingBlocks/acacia_stairs.json
recipes/buildingBlocks/acacia_wooden_slab.json
recipes/buildingBlocks/andesite.json
recipes/buildingBlocks/birch_planks.json
recipes/buildingBlocks/birch_stairs.json
recipes/buildingBlocks/birch_wooden_slab.json
recipes/buildingBlocks/black_concrete_powder.json
recipes/buildingBlocks/black_stained_glass.json
recipes/buildingBlocks/black_stained_hardened_clay.json
recipes/buildingBlocks/black_wool.json
recipes/buildingBlocks/blue_concrete_powder.json
recipes/buildingBlocks/blue_stained_glass.json
recipes/buildingBlocks/blue_stained_hardened_clay.json
recipes/buildingBlocks/blue_wool.json
recipes/buildingBlocks/bone_block.json
recipes/buildingBlocks/bookshelf.json
recipes/buildingBlocks/brick_block.json
recipes/buildingBlocks/brick_slab.json
recipes/buildingBlocks/brick_stairs.json
recipes/buildingBlocks/brown_concrete_powder.json
recipes/buildingBlocks/brown_stained_glass.json
recipes/buildingBlocks/brown_stained_hardened_clay.json
recipes/buildingBlocks/brown_wool.json
recipes/buildingBlocks/chiseled_quartz_block.json
recipes/buildingBlocks/chiseled_red_sandstone.json
recipes/buildingBlocks/chiseled_sandstone.json
recipes/buildingBlocks/chiseled_stonebrick.json
recipes/buildingBlocks/clay.json
recipes/buildingBlocks/coal_block.json
recipes/buildingBlocks/coarse_dirt.json
recipes/buildingBlocks/cobblestone_slab.json
recipes/buildingBlocks/cyan_concrete_powder.json
recipes/buildingBlocks/cyan_stained_glass.json
recipes/buildingBlocks/cyan_stained_hardened_clay.json
recipes/buildingBlocks/cyan_wool.json
recipes/buildingBlocks/dark_oak_planks.json
recipes/buildingBlocks/dark_oak_stairs.json
recipes/buildingBlocks/dark_oak_wooden_slab.json
recipes/buildingBlocks/dark_prismarine.json
recipes/buildingBlocks/diamond_block.json
recipes/buildingBlocks/diorite.json
recipes/buildingBlocks/emerald_block.json
recipes/buildingBlocks/end_bricks.json
recipes/buildingBlocks/glowstone.json
recipes/buildingBlocks/gold_block.json
recipes/buildingBlocks/granite.json
recipes/buildingBlocks/gray_concrete_powder.json
recipes/buildingBlocks/gray_stained_glass.json
recipes/buildingBlocks/gray_stained_hardened_clay.json
recipes/buildingBlocks/gray_wool.json
recipes/buildingBlocks/green_concrete_powder.json
recipes/buildingBlocks/green_stained_glass.json
recipes/buildingBlocks/green_stained_hardened_clay.json
recipes/buildingBlocks/green_wool.json
recipes/buildingBlocks/hay_block.json
recipes/buildingBlocks/iron_block.json
recipes/buildingBlocks/jungle_planks.json
recipes/buildingBlocks/jungle_stairs.json
recipes/buildingBlocks/jungle_wooden_slab.json
recipes/buildingBlocks/lapis_block.json
recipes/buildingBlocks/light_blue_concrete_powder.json
recipes/buildingBlocks/light_blue_stained_glass.json
recipes/buildingBlocks/light_blue_stained_hardened_clay.json
recipes/buildingBlocks/light_blue_wool.json
recipes/buildingBlocks/light_gray_concrete_powder.json
recipes/buildingBlocks/light_gray_stained_glass.json
recipes/buildingBlocks/light_gray_stained_hardened_clay.json
recipes/buildingBlocks/light_gray_wool.json
recipes/buildingBlocks/lime_concrete_powder.json
recipes/buildingBlocks/lime_stained_glass.json
recipes/buildingBlocks/lime_stained_hardened_clay.json
recipes/buildingBlocks/lime_wool.json
recipes/buildingBlocks/lit_pumpkin.json
recipes/buildingBlocks/magenta_concrete_powder.json
recipes/buildingBlocks/magenta_stained_glass.json
recipes/buildingBlocks/magenta_stained_hardened_clay.json
recipes/buildingBlocks/magenta_wool.json
recipes/buildingBlocks/magma.json
recipes/buildingBlocks/melon_block.json
recipes/buildingBlocks/mossy_cobblestone.json
recipes/buildingBlocks/mossy_stonebrick.json
recipes/buildingBlocks/nether_brick.json
recipes/buildingBlocks/nether_brick_slab.json
recipes/buildingBlocks/nether_brick_stairs.json
recipes/buildingBlocks/nether_wart_block.json
recipes/buildingBlocks/oak_planks.json
recipes/buildingBlocks/oak_stairs.json
recipes/buildingBlocks/oak_wooden_slab.json
recipes/buildingBlocks/orange_concrete_powder.json
recipes/buildingBlocks/orange_stained_glass.json
recipes/buildingBlocks/orange_stained_hardened_clay.json
recipes/buildingBlocks/orange_wool.json
recipes/buildingBlocks/pillar_quartz_block.json
recipes/buildingBlocks/pink_concrete_powder.json
recipes/buildingBlocks/pink_stained_glass.json
recipes/buildingBlocks/pink_stained_hardened_clay.json
recipes/buildingBlocks/pink_wool.json
recipes/buildingBlocks/polished_andesite.json
recipes/buildingBlocks/polished_diorite.json
recipes/buildingBlocks/polished_granite.json
recipes/buildingBlocks/prismarine.json
recipes/buildingBlocks/prismarine_bricks.json
recipes/buildingBlocks/purple_concrete_powder.json
recipes/buildingBlocks/purple_stained_glass.json
recipes/buildingBlocks/purple_stained_hardened_clay.json
recipes/buildingBlocks/purple_wool.json
recipes/buildingBlocks/purpur_block.json
recipes/buildingBlocks/purpur_pillar.json
recipes/buildingBlocks/purpur_slab.json
recipes/buildingBlocks/purpur_stairs.json
recipes/buildingBlocks/quartz_block.json
recipes/buildingBlocks/quartz_slab.json
recipes/buildingBlocks/quartz_stairs.json
recipes/buildingBlocks/red_concrete_powder.json
recipes/buildingBlocks/red_nether_brick.json
recipes/buildingBlocks/red_sandstone.json
recipes/buildingBlocks/red_sandstone_slab.json
recipes/buildingBlocks/red_sandstone_stairs.json
recipes/buildingBlocks/red_stained_glass.json
recipes/buildingBlocks/red_stained_hardened_clay.json
recipes/buildingBlocks/red_wool.json
recipes/buildingBlocks/sandstone.json
recipes/buildingBlocks/sandstone_slab.json
recipes/buildingBlocks/sandstone_stairs.json
recipes/buildingBlocks/sea_lantern.json
recipes/buildingBlocks/smooth_red_sandstone.json
recipes/buildingBlocks/smooth_sandstone.json
recipes/buildingBlocks/snow.json
recipes/buildingBlocks/spruce_planks.json
recipes/buildingBlocks/spruce_stairs.json
recipes/buildingBlocks/spruce_wooden_slab.json
recipes/buildingBlocks/stonebrick.json
recipes/buildingBlocks/stone_brick_slab.json
recipes/buildingBlocks/stone_brick_stairs.json
recipes/buildingBlocks/stone_slab.json
recipes/buildingBlocks/stone_stairs.json
recipes/buildingBlocks/string_to_wool.json
recipes/buildingBlocks/white_concrete_powder.json
recipes/buildingBlocks/white_stained_glass.json
recipes/buildingBlocks/white_stained_hardened_clay.json
recipes/buildingBlocks/white_wool.json
recipes/buildingBlocks/yellow_concrete_powder.json
recipes/buildingBlocks/yellow_stained_glass.json
recipes/buildingBlocks/yellow_stained_hardened_clay.json
recipes/buildingBlocks/yellow_wool.json
recipes/combat/arrow.json
recipes/combat/bow.json
recipes/combat/diamond_boots.json
recipes/combat/diamond_chestplate.json
recipes/combat/diamond_helmet.json
recipes/combat/diamond_leggings.json
recipes/combat/diamond_sword.json
recipes/combat/golden_boots.json
recipes/combat/golden_chestplate.json
recipes/combat/golden_helmet.json
recipes/combat/golden_leggings.json
recipes/combat/golden_sword.json
recipes/combat/iron_boots.json
recipes/combat/iron_chestplate.json
recipes/combat/iron_helmet.json
recipes/combat/iron_leggings.json
recipes/combat/iron_sword.json
recipes/combat/leather_boots.json
recipes/combat/leather_chestplate.json
recipes/combat/leather_helmet.json
recipes/combat/leather_leggings.json
recipes/combat/shield.json
recipes/combat/spectral_arrow.json
recipes/combat/stone_sword.json
recipes/combat/wooden_sword.json
recipes/decorations/acacia_fence.json
recipes/decorations/anvil.json
recipes/decorations/armor_stand.json
recipes/decorations/bed.json
recipes/decorations/birch_fence.json
recipes/decorations/black_banner.json
recipes/decorations/black_carpet.json
recipes/decorations/black_stained_glass_pane.json
recipes/decorations/blue_banner.json
recipes/decorations/blue_carpet.json
recipes/decorations/blue_stained_glass_pane.json
recipes/decorations/brown_banner.json
recipes/decorations/brown_carpet.json
recipes/decorations/brown_stained_glass_pane.json
recipes/decorations/chest.json
recipes/decorations/cobblestone_wall.json
recipes/decorations/crafting_table.json
recipes/decorations/cyan_banner.json
recipes/decorations/cyan_carpet.json
recipes/decorations/cyan_stained_glass_pane.json
recipes/decorations/dark_oak_fence.json
recipes/decorations/enchanting_table.json
recipes/decorations/ender_chest.json
recipes/decorations/end_crystal.json
recipes/decorations/end_rod.json
recipes/decorations/fence.json
recipes/decorations/flower_pot.json
recipes/decorations/furnace.json
recipes/decorations/glass_pane.json
recipes/decorations/gray_banner.json
recipes/decorations/gray_carpet.json
recipes/decorations/gray_stained_glass_pane.json
recipes/decorations/green_banner.json
recipes/decorations/green_carpet.json
recipes/decorations/green_stained_glass_pane.json
recipes/decorations/iron_bars.json
recipes/decorations/item_frame.json
recipes/decorations/jukebox.json
recipes/decorations/jungle_fence.json
recipes/decorations/ladder.json
recipes/decorations/light_blue_banner.json
recipes/decorations/light_blue_carpet.json
recipes/decorations/light_blue_stained_glass_pane.json
recipes/decorations/light_gray_banner.json
recipes/decorations/light_gray_carpet.json
recipes/decorations/light_gray_stained_glass_pane.json
recipes/decorations/lime_banner.json
recipes/decorations/lime_carpet.json
recipes/decorations/lime_stained_glass_pane.json
recipes/decorations/magenta_banner.json
recipes/decorations/magenta_carpet.json
recipes/decorations/magenta_stained_glass_pane.json
recipes/decorations/mossy_cobblestone_wall.json
recipes/decorations/nether_brick_fence.json
recipes/decorations/orange_banner.json
recipes/decorations/orange_carpet.json
recipes/decorations/orange_stained_glass_pane.json
recipes/decorations/painting.json
recipes/decorations/pink_banner.json
recipes/decorations/pink_carpet.json
recipes/decorations/pink_stained_glass_pane.json
recipes/decorations/purple_banner.json
recipes/decorations/purple_carpet.json
recipes/decorations/purple_shulker_box.json
recipes/decorations/purple_stained_glass_pane.json
recipes/decorations/red_banner.json
recipes/decorations/red_carpet.json
recipes/decorations/red_stained_glass_pane.json
recipes/decorations/sign.json
recipes/decorations/slime.json
recipes/decorations/snow_layer.json
recipes/decorations/spruce_fence.json
recipes/decorations/torch.json
recipes/decorations/white_banner.json
recipes/decorations/white_carpet.json
recipes/decorations/white_stained_glass_pane.json
recipes/decorations/yellow_banner.json
recipes/decorations/yellow_carpet.json
recipes/decorations/yellow_stained_glass_pane.json
recipes/food/beetroot_soup.json
recipes/food/bread.json
recipes/food/cake.json
recipes/food/cookie.json
recipes/food/golden_apple.json
recipes/food/mushroom_stew.json
recipes/food/pumpkin_pie.json
recipes/food/rabbit_stew_from_brown_mushroom.json
recipes/food/rabbit_stew_from_red_mushroom.json
recipes/misc/beacon.json
recipes/misc/bone_meal_from_block.json
recipes/misc/bone_meal_from_bone.json
recipes/misc/bowl.json
recipes/misc/bucket.json
recipes/misc/coal.json
recipes/misc/cyan_dye.json
recipes/misc/diamond.json
recipes/misc/emerald.json
recipes/misc/ender_eye.json
recipes/misc/fire_charge.json
recipes/misc/gold_ingot_from_block.json
recipes/misc/gold_ingot_from_nuggets.json
recipes/misc/gold_nugget.json
recipes/misc/gray_dye.json
recipes/misc/iron_ingot_from_block.json
recipes/misc/iron_ingot_from_nuggets.json
recipes/misc/iron_nugget.json
recipes/misc/lapis_lazuli.json
recipes/misc/leather.json
recipes/misc/light_blue_dye_from_blue_orchid.json
recipes/misc/light_blue_dye_from_lapis_bonemeal.json
recipes/misc/light_gray_dye_from_azure_bluet.json
recipes/misc/light_gray_dye_from_gray_bonemeal.json
recipes/misc/light_gray_dye_from_ink_bonemeal.json
recipes/misc/light_gray_dye_from_oxeye_daisy.json
recipes/misc/light_gray_dye_from_white_tulip.json
recipes/misc/lime_dye.json
recipes/misc/magenta_dye_from_allium.json
recipes/misc/magenta_dye_from_lapis_ink_bonemeal.json
recipes/misc/magenta_dye_from_lapis_red_pink.json
recipes/misc/magenta_dye_from_lilac.json
recipes/misc/magenta_dye_from_purple_and_pink.json
recipes/misc/map.json
recipes/misc/melon_seeds.json
recipes/misc/orange_dye_from_orange_tulip.json
recipes/misc/orange_dye_from_red_yellow.json
recipes/misc/paper.json
recipes/misc/pink_dye_from_peony.json
recipes/misc/pink_dye_from_pink_tulip.json
recipes/misc/pink_dye_from_red_bonemeal.json
recipes/misc/pumpkin_seeds.json
recipes/misc/purple_dye.json
recipes/misc/red_dye_from_beetroot.json
recipes/misc/red_dye_from_poppy.json
recipes/misc/red_dye_from_rose_bush.json
recipes/misc/red_dye_from_tulip.json
recipes/misc/slime_ball.json
recipes/misc/stick.json
recipes/misc/sugar.json
recipes/misc/wheat.json
recipes/misc/writable_book.json
recipes/misc/yellow_dye_from_dandelion.json
recipes/misc/yellow_dye_from_sunflower.json
recipes/redstone/acacia_door.json
recipes/redstone/acacia_fence_gate.json
recipes/redstone/birch_door.json
recipes/redstone/birch_fence_gate.json
recipes/redstone/comparator.json
recipes/redstone/dark_oak_door.json
recipes/redstone/dark_oak_fence_gate.json
recipes/redstone/daylight_detector.json
recipes/redstone/dispenser.json
recipes/redstone/dropper.json
recipes/redstone/fence_gate.json
recipes/redstone/heavy_weighted_pressure_plate.json
recipes/redstone/hopper.json
recipes/redstone/iron_door.json
recipes/redstone/iron_trapdoor.json
recipes/redstone/jungle_door.json
recipes/redstone/jungle_fence_gate.json
recipes/redstone/lever.json
recipes/redstone/light_weighted_pressure_plate.json
recipes/redstone/noteblock.json
recipes/redstone/observer.json
recipes/redstone/piston.json
recipes/redstone/redstone.json
recipes/redstone/redstone_block.json
recipes/redstone/redstone_lamp.json
recipes/redstone/redstone_torch.json
recipes/redstone/repeater.json
recipes/redstone/spruce_door.json
recipes/redstone/spruce_fence_gate.json
recipes/redstone/sticky_piston.json
recipes/redstone/stone_button.json
recipes/redstone/stone_pressure_plate.json
recipes/redstone/tnt.json
recipes/redstone/trapdoor.json
recipes/redstone/trapped_chest.json
recipes/redstone/tripwire_hook.json
recipes/redstone/wooden_button.json
recipes/redstone/wooden_door.json
recipes/redstone/wooden_pressure_plate.json
recipes/tools/clock.json
recipes/tools/compass.json
recipes/tools/diamond_axe.json
recipes/tools/diamond_hoe.json
recipes/tools/diamond_pickaxe.json
recipes/tools/diamond_shovel.json
recipes/tools/fishing_rod.json
recipes/tools/flint_and_steel.json
recipes/tools/golden_axe.json
recipes/tools/golden_hoe.json
recipes/tools/golden_pickaxe.json
recipes/tools/golden_shovel.json
recipes/tools/iron_axe.json
recipes/tools/iron_hoe.json
recipes/tools/iron_pickaxe.json
recipes/tools/iron_shovel.json
recipes/tools/lead.json
recipes/tools/shears.json
recipes/tools/stone_axe.json
recipes/tools/stone_hoe.json
recipes/tools/stone_pickaxe.json
recipes/tools/stone_shovel.json
recipes/tools/wooden_axe.json
recipes/tools/wooden_hoe.json
recipes/tools/wooden_pickaxe.json
recipes/tools/wooden_shovel.json
recipes/transportation/acacia_boat.json
recipes/transportation/activator_rail.json
recipes/transportation/birch_boat.json
recipes/transportation/boat.json
recipes/transportation/carrot_on_a_stick.json
recipes/transportation/chest_minecart.json
recipes/transportation/dark_oak_boat.json
recipes/transportation/detector_rail.json
recipes/transportation/furnace_minecart.json
recipes/transportation/golden_rail.json
recipes/transportation/hopper_minecart.json
recipes/transportation/jungle_boat.json
recipes/transportation/minecart.json
recipes/transportation/rail.json
recipes/transportation/spruce_boat.json
recipes/transportation/tnt_minecart.json
story/brew_weakness_potion
story/create_beacon
story/create_full_beacon
story/cure_zombie_villager
story/deflect_arrow
story/elytra
story/enchant_item
story/enter_end_gateway
story/enter_the_end
story/enter_the_nether
story/follow_ender_eye
story/form_obsidian
story/iron_tools
story/lava_bucket
story/mine_diamond
story/mine_stone
story/obtain_armor
story/obtain_blaze_rod
story/root
story/shiny_gear
story/smelt_iron
story/summon_wither
story/upgrade_tools
4 常见格式
4.1 JSON结构
以下是advancement文件里的所有可能键值(key)
{
"criteria": {
"custom_trigger_name": {
"trigger": "namespace:trigger_name",
"conditions": {
"durability": 1,
"durability": {"min":1,"max":1},
"delta": 1,
"delta": {"min":1,"max":1},
"slots": {
"occupied": 1,
"occupied": {"min":1,"max":1},
"full": 1,
"full": {"min":1,"max":1},
"empty": 1,
"empty": {"min":1,"max":1}
},
"items": [
{
"item": "minecraft:stone",
"count": 1,
"count": {"min":1,"max":1},
"data": 1,
"data": {"min":1,"max":1},
"durability": 1,
"durability": {"min":1,"max":1},
"potion": "minecraft:invisibility",
"enchantments": [
{
"enchantment": "minecraft:sharpness",
"levels": 1,
"levels": {"min":1,"max":1}
}
]
}
],
"item": {
"item": "minecraft:stone",
"count": 1,
"count": {"min":1,"max":1},
"data": 1,
"data": {"min":1,"max":1},
"durability": 1,
"durability": {"min":1,"max":1},
"potion": "minecraft:invisibility",
"enchantments": [
{
"enchantment": "minecraft:sharpness",
"levels": 1,
"levels": {"min":1,"max":1}
}
]
},
"levels": 1,
"levels": {"min":1,"max":1},
"recipe": "minecraft:chest",
"position": {
"x": 1,
"x": {"min":1,"max":1},
"y": 1,
"y": {"min":1,"max":1},
"z": 1,
"z": {"min":1,"max":1}
},
"biome": "minecraft:void",
"feature": "EndCity",
"dimension": "overworld",
"from": "overworld",
"to": "overworld",
"block": "minecraft:stone",
"state": {
"state_name": "state_value"
},
"entity": {
"type": "minecraft:creeper",
"distance": 1,
"distance": {"min":1,"max":1}
},
"killing_blow": {
"bypasses_armor": true,
"bypasses_invulnerability": true,
"bypasses_magic": true,
"is_explosion": true,
"is_fire": true,
"is_magic": true,
"is_projectile": true,
"direct_entity": {
"type": "minecraft:creeper",
"distance": 1,
"distance": {"min":1,"max":1}
},
"source_entity": {
"type": "minecraft:creeper",
"distance": 1,
"distance": {"min":1,"max":1}
}
},
"distance": 1,
"distance": {"min":1,"max":1},
"parent": {
"type": "minecraft:creeper",
"distance": 1,
"distance": {"min":1,"max":1}
},
"partner": {
"type": "minecraft:creeper",
"distance": 1,
"distance": {"min":1,"max":1}
}
"child": {
"type": "minecraft:creeper",
"distance": 1,
"distance": {"min":1,"max":1}
},
"potion": "minecraft:invisibility",
"level": 1,
"level": {"min":1,"max":1},
"damage": {
"dealt": 1,
"dealt": {"min":1,"max":1},
"taken": 1,
"taken": {"min":1,"max":1},
"blocked": true,
"type": {
"bypasses_armor": true,
"bypasses_invulnerability": true,
"bypasses_magic": true,
"is_explosion": true,
"is_fire": true,
"is_magic": true,
"is_projectile": true,
"direct_entity": {
"type": "minecraft:creeper",
"distance": 1,
"distance": {"min":1,"max":1}
},
"source_entity": {
"type": "minecraft:creeper",
"distance": 1,
"distance": {"min":1,"max":1}
}
},
"source_entity": {
"type": "minecraft:creeper",
"distance": 1,
"distance": {"min":1,"max":1}
}
}
}
}
},
"requirements": [["generic_trigger_name"]],
"parent": "namespace:path/to/parent_advancement",
"display": {
"icon": {
"item": "minecraft:stone_pickaxe",
"data": 0
},
"title": "Display title",
"description": "Display description",
"frame": "task",
"background": "minecraft:path/to/texture.png"
},
"rewards": {
"recipes": ["namespace:path/to/recipe"],
"loot": ["namespace:path/to/loot_table"],
"experience": 1,
"commands": ["/say Command to run upon completion"]
}
}
4.2 常见的类型:range
advancement大部分的特性都使用了"range"类型,这个类型会将数值(比如物品栏里有的物品数量)和指定的范围作比较。
4.2.1 指定数字
若要判断是否为一个指定的数,只需直接让range为那个数。以下是检查被比较的数是否恰好为3.
"occupied": 3
4.2.2 指定范围
若要判断是否介于两个数之间,range就应当为一个包含了"min" 和 "max"这两个数的object。以下是检查被比较的数是否在1和3之间。
注意: min和max是包含的,min <= X <= max
"occupied": {
"min": 1,
"max": 3
}
你也可单独指定上限或者下限,这将忽视对另一个界限的检测。比如这样可以检测是否有至少3个有东西的格子。玩家即使有7个有东西的格子也符合要求。
"occupied": {
"min": 3
}
相反,这样可以检测是否有至多2个有东西的格子。玩家的物品栏即使有0个有东西的格子也符合要求。
"occupied": {
"max": 2
}
4.3 常见的类型: location object
这个object能够指定一个位置或生物群系。无论在何地使用,location object的一切的选项都可以使用。
4.3.1 position
positions物件有"x", "y"和"z" range来检查玩家的位置。
你不需要检查所有轴的坐标。比如只填写y, 则只检查y坐标的数值,而对x和z坐标没有限制。
以下这个例子会检查玩家是否在y=62或更低
"location_object": {
"position": {
"y": {
"max": 62.0
}
}
}
4.3.2 biome
biome字串指定了玩家需要待在的生物群系(biome)。
生物群系id(id = 名称),填写时请在前面加上"minecraft:", 如"minecraft:desert_hills":
"ocean" = "Ocean"
"plains" = "Plains"
"desert" = "Desert"
"extreme_hills" = "Extreme Hills"
"forest" = "Forest"
"taiga" = "Taiga"
"swampland" = "Swampland"
"river" = "River"
"hell" = "Hell"
"sky" = "The End"
"frozen_ocean" = "FrozenOcean"
"frozen_river" = "FrozenRiver"
"ice_flats" = "Ice Plains"
"ice_mountains" = "Ice Mountains"
"mushroom_island" = "MushroomIsland"
"mushroom_island_shore" = "MushroomIslandShore"
"beaches" = "Beach"
"desert_hills" = "DesertHills"
"forest_hills" = "ForestHills"
"taiga_hills" = "TaigaHills"
"smaller_extreme_hills" = "Extreme Hills Edge"
"jungle" = "Jungle"
"jungle_hills" = "JungleHills"
"jungle_edge" = "JungleEdge"
"deep_ocean" = "Deep Ocean"
"stone_beach" = "Stone Beach"
"cold_beach" = "Cold Beach"
"birch_forest" = "Birch Forest"
"birch_forest_hills" = "Birch Forest Hills"
"roofed_forest" = "Roofed Forest"
"taiga_cold" = "Cold Taiga"
"taiga_cold_hills" = "Cold Taiga Hills"
"redwood_taiga" = "Mega Taiga"
"redwood_taiga_hills" = "Mega Taiga Hills"
"extreme_hills_with_trees" = "Extreme Hills+"
"savanna" = "Savanna"
"savanna_rock" = "Savanna Plateau"
"mesa" = "Mesa"
"mesa_rock" = "Mesa Plateau F"
"mesa_clear_rock" = "Mesa Plateau"
"void" = "The Void"
"mutated_plains" = "Sunflower Plains" ("plains")
"mutated_desert" = "Desert M" ("desert")
"mutated_extreme_hills" = "Extreme Hills M" ("extreme_hills")
"mutated_forest" = "Flower Forest" ("forest")
"mutated_taiga" = "Taiga M" ("taiga")
"mutated_swampland" = "Swampland M" ("swampland")
"mutated_ice_flats" = "Ice Plains Spikes" ("ice_flats")
"mutated_jungle" = "Jungle M" ("jungle")
"mutated_jungle_edge" = "JungleEdge M" ("jungle_edge")
"mutated_birch_forest" = "Birch Forest M" ("birch_forest")
"mutated_birch_forest_hills" = "Birch Forest Hills M" ("birch_forest_hills")
"mutated_roofed_forest" = "Roofed Forest M" ("roofed_forest")
"mutated_taiga_cold" = "Cold Taiga M" ("taiga_cold")
"mutated_redwood_taiga" = "Mega Spruce Taiga" ("redwood_taiga")
"mutated_redwood_taiga_hills" = "Redwood Taiga Hills M" ("redwood_taiga_hills")
"mutated_extreme_hills_with_trees" = "Extreme Hills+ M" ("extreme_hills_with_trees")
"mutated_savanna" = "Savanna M" ("savanna")
"mutated_savanna_rock" = "Savanna Plateau M" ("savanna_rock")
"mutated_mesa" = "Mesa (Bryce)" ("mesa")
"mutated_mesa_rock" = "Mesa Plateau F M" ("mesa_rock")
"mutated_mesa_clear_rock" = "Mesa Plateau M" ("mesa_clear_rock")
以下两个准则会在玩家到沙漠和平原后被激活。
"location_object": {
"biome": "minecraft:desert"
}
4.3.3 feature
指定结构(structure)的id。玩家必须站在该structure的范围内(可能是结构方块调用结构时的范围)才会触发。
这例子检查玩家是否在EndCity里
"location_object": {
"feature": "EndCity"
}
4.3.4 dimension
指定维度ID。可能数值为: "overworld", "the_nether", 及 "the_end"。
以下检查玩家是否在地狱
"location_object": {
"dimension": "the_nether"
}
4.4 常见的类型:item object
一个item object包括了几个数据来和输入的一堆叠(stack)物品作比较。无论在何地使用,item object的一切的选项都可以使用。
4.4.1 item
"item"这个字符串指定了一个物品id。这是检查物品是不是红石粉的方法。
"item_object": {
"item": "minecraft:redstone"
}
4.4.2 data
"data"这个range指定了物品的损害值/数据值(damage/data value)。这是检查物品是不是平滑的花岗岩(Polished Granite)。
"item_object": {
"item": "minecraft:stone",
"data": 2
}
4.4.3 durability
一个range物件,指定物品剩余的耐久度。
以下检查物品是否还剩余超过400点耐久度
"item_object": {
"durability": {
"min": 400
}
}
4.4.4 count
"count"这个range指定了在单独的一个堆叠里的物品个数。这个不能用于检查物品栏中所有物品个数的总和。以下是检查某个堆叠里是否至少有16个物品。
"item_object": {
"count": {
"min": 16
}
}
4.4.5 potion
"potion"字符串可以检查物品的NBT中是否有它指定的游戏自带药水效果。也就是物品的Potion tag。wiki的这里 https://minecraft.gamepedia.com/Potion#Item_data 包含了这些id。
"item_object": {
"potion": "minecraft:invisibility"
}
物品不一定是药水。只需要有Potion这个NBTtag。比如这个物品也是符合的。
/give @p minecraft:stone 1 0 {Potion:"minecraft:invisibility"}
4.4.6 enchantments
"enchantments"这个list检查物品的附魔。(也就是除了书以外的物品的 ench 标签或者书的StoredEnchantments 标签)如果只指定了一个空object,就是检查玩家的物品栏里是否存在任何一个有附魔的东西。
"item_object": {
"enchantments": [
{
}
]
}
enchantments是附魔物件的列表(list of enchantment object)。以下将会介绍enchantment的标签属性:
(i) enchantment
"enchantment"字符串指定了要检查的附魔id。这是检查锋利附魔的方法。
"item_object": {
"enchantments": [
{
"enchantment": "minecraft:sharpness"
}
]
}
(ii) levels
"levels"这个range指定了附魔等级的范围。以下是检查玩家是否有三级或以上的附魔物品的方法。
"item_object": {
"enchantments": [
{
"levels": {
"min": 3
}
}
]
}
也可以和ID组合,这就是检查有没有锋利5的方法。
"item_object": {
"enchantments": [
{
"enchantment": "minecraft:sharpness"
"levels": 5
}
]
}
4.5 常见的类型:entity object
一个entity object包含了一些用来和传入的实体比较的数据。只要是使用entity object,以下的选项都可用。
4.5.1 type
"type"字符串指定了要判断是不是它的实体id。比如以下是检查传入的是不是爬行者的方式。
"entity_object": {
"type": "minecraft:creeper"
}
4.5.2 distance
这个range检查某个位置与玩家距离。位置取决于使用的trigger,因此请看该trigger以获得更进一步的资讯。
以下这例子检查玩家是否在另外的实体的10格范围内:
(计算公式为$\sqrt{(player.x - entity.x)^2 + (player.y - entity.y)^2 + (player.z - entity.z)^2)}$
"entity_object": {
"distance": {
"max": 10
}
}
4.6 常见的类型:damage object
检查大量与伤害有关的资讯。只要是使用damage object,以下的选项都可用。
4.6.1 dealt
这个range检查原始伤害值(在计算装备/效果削减/盾牌阻挡的伤害量前)的量,也就是说和玩家的防护效果及装备对此没影响。
这例子会检查无主的箭可以对玩家造成的伤害,即使实际伤害被削减了或被盾牌阻挡了也不会改变这个值。
"damage_object": {
"dealt": {
"min": 4.0
},
"source_entity": {
"type": "minecraft:arrow"
}
}
4.6.2 taken
这个range检查实际伤害值,也就是玩家实际受到的伤害(在计算装备/效果削减/盾牌阻挡的伤害量后),故此可以和dealt的数值不同。
以下这例子会检查玩家是否受到5点或以上的伤害。
"damage_object": {
"taken": {
"min": 5.0
}
}
4.6.3 blocked
这个布尔值检查伤害是否被完全阻挡(bypasses_armor(unblockable)不会是true)。
以下这个例子检查玩家是否不能阻挡箭的伤害。
"damage_object": {
"blocked": false,
"source_entity": {
"type": "minecraft:skeleton"
}
}
4.6.4 type
一个伤害类型 object(damage tag object)会检查伤害类型(damage tag)。
以下这例子检查伤害是否来自骷髅射的箭(投射物,projectile)
"damage_object": {
"type": {
"is_projectile": true
},
"source_entity": {
"type": "minecraft:skeleton"
}
}
4.6.5 source_entity
这个entity object检查造成伤害或被伤害的实体。
注意: 如果检查玩家,那个type就需要是"minecraft:player"
如果是投射物的伤害,则需要视乎该投射物有没有"主人",也就是射出此投射物的实体。如果有,则算作该主人造成的伤害,否则则算作该投射物的伤害。
如果是中毒这类伤害,则不会被算作是实体造成的伤害(即使是由女巫扔出的药水)。
以下这个例子检查玩家是否被僵尸伤害。
"damage_object": {
"source_entity": {
"type": "minecraft:skeleton",
"distance": {
"min": 10
}
}
}
4.7 常见的类型: 伤害类型(damage flag object)
会检查造成或受到的伤害的属性。只要是使用damage flag object,以下的选项都可用。
4.7.1 bypasses_armor
这个布尔值检查伤害能否被阻挡(检查unblockable标签)。伤害来源包括: 火焰,窒息(方块及世界边界),实体挤压(范围内太多实体),溺水,饥饿,掉落,撞墙(飞行时),虚空(掉落虚空及/kill命令),重新计算血量(比如超出了上限),魔法伤害,凋零伤害。
以下这例子检查不能被阻挡的伤害
"damage_object": {
"bypasses_armor": true
}
4.7.2 bypasses_invulnerability
检查伤害是否能伤害无敌的玩家(创造模式)。伤害来源只有虚空伤害(包括掉落虚空及/kill命令)。
以下例子检查伤害是否不来自虚空或/kill命令。
"damage_object": {
"bypasses_invulnerability": false
}
4.7.3 bypasses_magic
检查伤害是否绝对(猜测是不能被装备/效果削弱,不肯定),即检查damageIsAbsolute标签。伤害来源只有饥饿。
"damage_object": {
"bypasses_magic": true
}
4.7.4 is_explosion
这个布尔值检查伤害是不是因为爆炸受到的(检查explosion标签)。伤害来源包括: 爬行者,TNT,矿车TNT,地狱幽灵火球,床(在地狱睡时会爆炸),凋灵,凋灵之首。
以下这个例子检查伤害来源是否为爆炸造成伤害。
"damage_object": {
"explosion": true
}
4.7.5 is_fire
检查伤害是否来自火焰(检查fire标签)。伤害来源包括: 站在火焰方块里,整个人着火,在熔岩里,在岩浆块上,恶魂火球,烈焰人火球。
以下这例子检查伤害是否不来自火焰
"damage_object": {
"is_fire": false
}
4.7.6 is_magic
检查伤害是否来自魔法(检查magicDamage标签)。伤害来源包括: 闪电,瞬间伤害,中毒,守卫者的部分射线伤害(部分算作生物伤害mob damage),唤魔者的尖牙攻击,无主的凋灵之首(unowned wither skulls, 透过/summon命令生成的, 因为凋灵发射的凋灵之首算作生物伤害 mob damage)
以下这例子会检查伤害是否来自魔法伤害
"damage": {
"is_magic": true
}
4.7.7 is_projectile
这个布尔值(boolean)检查伤害是否来自弹射物(projectile, 检查projectile标签)。弹射物包括: 烈焰人火球 ,末影龙火球,恶魂火球,羊驼的口水,箭(所有),射出的火焰弹,丢出的蛋,丢出的雪球,凋灵之首。
以下这个例子检查玩家受到伤害不是来自弹射物
"damage": {
"is_projectile": false
}
4.8 常见的类型: death object
会储存杀人者/被杀者(视乎被什么trigger)的资讯。只要是使用death object,以下的选项都可用。
4.8.1 entity
这个entity object检查被杀或杀人者的资讯,视乎被什么trigger。
准确来说: 不一定是 死了的实体
以下这例子检查死掉的/杀人的是不是爬行者
"death_object": {
"entity": {
"type": "minecraft:creeper"
}
}
4.8.2 killing_blow
一个伤害类型(damage flag object),记录死亡的实体的死因。
注意: 这不是damage object,所以damage object的属性(source_entity等)将不可以被使用。
以下这例子检查实体是否因爆炸而死
"death_object": {
"killing_blow": {
"is_explosion": true
}
}
5 修改advancements
5.1 Criteria(及子准则)
一个advancement必须通过"criteria"这个物件(object)来指定一组准则来激活advancement。每个物件要带有一个你起的名字,这将会用于 "requirements" 这个list或者 /advancement 指令。每当玩家符合了任何一个准则,这件事就会被记录。使得玩家可以先后完成这些准则而不必同时完成。
每一个准则应当包含一个触发器,由"trigger"字符串指定。
如果没有"requirements" ,默认需要完成所有的规则以获得advancement。
以下的advancement需要"custom_test_name"和 "take_damage" 这两个准则都成功来获得。(名字可以是任何你喜欢的名字)玩家可以喂养动物,在这之后受伤来完成advancement(或者相反的顺序)。
鉴于没有"requirements",两个准则必须都满足。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:bred_animals"
},
"take_damage": {
"trigger": "minecraft:player_damaged"
}
}
}
这些准则的自定义名字只能在这个文件里被使用,而不能在其他的文件里被调用。
5.2 Triggers(准则的属性)
有些trigger使用更小一些的判据,这些由 "conditions"这个物件(object, 准则物件的属性之一)指定。使用哪些conditions由trigger的种类决定,而且不是所有的trigger都有/必须有conditions。
以下是所有能用的trigger,和对应的额外数据。
- bred_animals
- brewed_potion
- changed_dimension
- construct_beacon
- cured_zombie_villager
- enchanted_item
- enter_block
- entity_hurt_player
- entity_killed_player
- impossible
- inventory_changed
- item_durability_changed
- levitation
- location
- player_hurt_entity
- player_killed_entity
- recipe_unlocked
- slept_in_bed
- summoned_entity
- used_ender_eye
- villager_trade
5.2.1 bred_animals
喂养动物
这个触发器在玩家成功喂了两个动物(让它们交配)后触发。比如说,以下是玩家喂了两个在一起的动物。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:bred_animals"
}
}
}
这个有三个condition:"parents", "partnert" and "child"
(i) parents, partner
"parents", "partner"这两个list允许你指定entity objects用来和(动物的)父母比对。喂养后的双方都可以是parent或partner。
比如
对于原版游戏,除了马和驴子以外,能够交配的必定具有同样的实体id。所以在这一里指定多个实体id在大多数时候会使得这个无法达成。
这个是检查父母中是否至少有一个是牛的方法。
{
"criteria": {
"custom_test_name_1": {
"trigger": "minecraft:bred_animals",
"conditions": {
"parent": {
"type": "minecraft:cow"
}
}
},
"custom_test_name_2": {
"trigger": "minecraft:bred_animals",
"conditions": {
"partner": {
"type": "minecraft:cow"
}
}
}
}
}
一般只会在检查父母是否特定组合的实体时才会同时使用parent和partner, 比如检查父母是否相同种类实体或不同种类的实体。
这个是检查父母中是否有一个是牛,另一个是羊的方法。当然在原版你做不到这一点。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:bred_animals",
"conditions": {
"parent": {
"type": "minecraft:cow"
},
"partner": {
"type": "minecraft:sheep"
}
}
}
}
}
需要检查骡子的话,则需要检查parent和partner是否马和驴子(不需要考虑次序)
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:bred_animals",
"conditions": {
"parent": {
"type": "minecraft:donkey"
},
"partner": {
"type": "minecraft:horse"
}
}
}
}
}
(ii) child
"child"这个entity object会和新生的小动物比对。
这个是检查小动物是不是牛的方法。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:bred_animals",
"conditions": {
"child": {
"type": "minecraft:cow"
}
}
}
}
}
你也可以同时指定父母和孩子。比如说,以下就是检查父母中是否有马和驴,而且孩子还要是骡。(虽然这样使得检查父母的工作没有意义了,因为骡子只能由马和驴杂交来出生)
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:bred_animals",
"conditions": {
"parent": {
"type": "minecraft:horse"
},
"partner": {
"type": "minecraft:donkey"
}
"child": {
"type": "minecraft:mule"
}
}
}
}
}
5.2.2 brewed_potion
这个触发器在玩家从酿造台输出栏中拿出任何物品时触发。注意:这不意味着玩家必须酿造过这瓶药水。把药水从随着药水一起出现的酿造台里拿出来(比如末地船里的那个)或者把药水放进输出栏再拿出来都能满足这个触发器。
比如说,这个示例将会在玩家从药水输出栏取出任何物品时激活。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:brewed_potion"
}
}
}
这只有一个condition:"potion"
(i) potion
"potion"字符串可以检查取出的物品的NBT中是否有它指定的游戏自带药水效果。wiki的这里https://minecraft.gamepedia.com/Potion#Item_data 包含了这些id。
这个示例只会在玩家从酿造台输出栏取出一个长效隐形药水时触发。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:brewed_potion",
"conditions": {
"potion": "minecraft:long_invisibility"
}
}
}
}
5.2.3 changed_dimension
当玩家从一个维度到另外一个维度时就会触发。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:changed_dimension"
}
}
}
这有两个condition: "to", "from"
(i) to
一个字串,指定前往的维度。数值为 "overworld", "the_nether" 或 "the_end"
以下例子会在玩家前往末地时触发(不管他们原先在哪个维度)
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:changed_dimension",
"conditions": {
"to": "the_end"
}
}
}
}
(ii) from
一个字串,指定来自的维度。数值为 "overworld", "the_nether" 或 "the_end"
以下例子会在玩家从地狱到末地时触发
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:changed_dimension",
"conditions": {
"to": "the_end",
"from": "the_nether"
}
}
}
}
5.2.4 construct_beacon
这个触发器每当玩家接收到一个来自于信标的药水效果更新触发,而不是在你修建金字塔时。信标不需要有任何的药水效果,但玩家必须在信标生效范围里。信标也不需要放在一个金字塔上!
比如说,接下来的这个示例将会在玩家离信标足够近时触发,不论信标是否提供效果或者有金字塔在下面。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:construct_beacon"
}
}
}
这只有一个condition:"level"。
(i) level
"level"这个range指定了信标的层数,最高是4。比如说这个检查信标在玩家受到药水更新时是否至少有两层。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:construct_beacon",
"conditions": {
"level": {"min": 2}
}
}
}
}
而这个是检查在玩家受到信标的药水更新时信标下面是不是没有金字塔(没有金字塔就触发)。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:construct_beacon",
"conditions": {
"level": 0
}
}
}
}
5.2.5 cured_zombie_villager
这个触发器会在一只僵尸村民转变回村民时触发。治疗那僵尸村民的玩家会被视作满足了这触发器。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:cured_zombie_villager"
}
}
}
这触发器有两个conditions: zombie及villager。
(i) zombie
这entity object会检查僵尸村民原先的资料,type并无任何意义,因为那必须是"minecraft:zombie_villager"
distance的原点(origin)为僵尸的位置。也就是代表了被治疗的僵尸村民与玩家之间的距离
以下这例子检查玩家是否在50格外治疗那僵尸(在治疗完成时计算)
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:cured_zombie_villager",
"conditions": {
"zombie": {
"distance": {
"min":50
}
}
}
}
}
}
(ii) villager
这entity object会检查村民转化后的资料,type并无任何意义,因为那必须是"minecraft:villager"
distance的原点(origin)为村民的位置。也就是代表了被治疗的村民与玩家之间的距离
以下这例子检查玩家是否在50格外治疗那僵尸(在治疗完成时计算)
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:cured_zombie_villager",
"conditions": {
"villager": {
"distance": {
"min":50
}
}
}
}
}
}
5.2.6 enchanted_item
这个触发器在玩家再附魔台附魔物品时触发。玩家不需要把附好魔的物品拿走,因为它是在你选择附什么魔的时候触发的。这个就是检查玩家附魔的示例。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:enchanted_item"
}
}
}
此触发器有两个condition:"item" 和"levels"。
(i) item
"item"这个item object用来和附魔的物品对比。注意这个检查是在附魔之前检查的,也就是说你无法用 (item object中的)"enchantments"来检查这次附了什么魔。以下的示例是检查附魔的物品是不是钻石镐。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:enchanted_item",
"conditions": {
"item": {
"item": "minecraft:diamond_pickaxe"
}
}
}
}
}
(ii) levels
"levels"这个range指定了在附魔时消耗的等级。比如说再有15个书架的情况下,第三个附魔选项需要30级但只消耗3级。这个condition(限制条件)检查的是消耗的3级。也就是说你无法知道在附魔之前玩家是不是30的等级,但你可以通过命令方块辅助你检查这一点。
这个示例将在你消耗3级附魔时触发。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:enchanted_item",
"conditions": {
"levels": 3
}
}
}
}
5.2.7 enter_block
这个触发器在你的碰撞箱和一个方块重叠时激活,包括空气。也就是说,下面这个永远是激活的,因为你总在方块里。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:enter_block"
}
}
}
这有两个condition: "block" 和 "state"。
(i) block
"block"这个字符串指定了检查有没有玩家在里面的方块id。比如说,接下来的示例检查玩家是不是在"minecraft:tallgrass"方块里面。也就是草,蕨和两格高草。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:enter_block",
"conditions": {
"block": "minecraft:tallgrass"
}
}
}
}
(ii) state
"state"这个object包含了一列自定义的键值(Block state, 方块状态)。对于"minecraft:tallgrass",方块状态"type"决定了这个方块是哪种植物。使用这个 condition必须有"block"。接下来这个示例检查方块是不是蕨。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:enter_block",
"conditions": {
"block": "minecraft:tallgrass",
"state": {
"type": "fern"
}
}
}
}
}
5.2.8 entity_hurt_player
这个触发器在玩家受伤时(包括0点伤害或阻挡了伤害)触发。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:entity_hurt_player"
}
}
}
只有一个condition: damage
(i) damage
一个damage object储存玩家受伤的伤害的数据。entity_source为造成伤害的实体。
比如这个检查玩家是否受到爬行者爆炸导致的10+点伤害
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:entity_hurt_player",
"conditions": {
"damage": {
"taken": {
"min": 10.0
},
"type": {
"is_explosion": true
},
"source_entity": {
"type": "minecraft:creeper"
}
}
}
}
}
}
distance的原点为造成伤害的实体的位置。所以distance就是玩家离造成伤害的实体的距离。
这例子检查玩家是否在骷髅的3格距离内受到骷髅的伤害
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:entity_hurt_player",
"conditions": {
"damage": {
"source_entity": {
"type": "minecraft:skeleton",
"distance": {
"max": 3
}
}
}
}
}
}
}
5.2.9 entity_killed_player
这个触发器会在别的实体(玩家以外的实体)杀死玩家时触发。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:entity_killed_player"
}
}
}
这触发器的conditions就是death object。
entity就是杀死玩家的entity,distance的原点就是该实体的位置,killing_blow则记录了玩家受到的伤害资料。
这例子检查玩家是否被骷髅在3格距离内杀死
{
"criteria": {
"noob": {
"trigger": "minecraft:entity_killed_player",
"conditions": {
"entity": {
"type": "minecraft:skeleton",
"distance": {
"max": 3
}
}
}
}
}
}
这例子检查玩家是否被不射箭的骷髅杀死
{
"criteria": {
"skeletal_swordsman": {
"trigger": "minecraft:entity_killed_player",
"conditions": {
"entity": {
"type": "minecraft:skeleton"
},
"killing_blow": {
"is_projectile": false
}
}
}
}
}
5.2.10 impossible
这个触发器永远不会激活。在原版中激活它的唯一方法就是使用 /advancement指令。这个极大地补充了命令机制,因为它使得更复杂的要求可以通过命令做到。
比如,如下的advancement,假设他的文件位于"custom:missions":
{
"criteria": {
"mission1": {
"trigger": "minecraft:impossible"
},
"mission2": {
"trigger": "minecraft:impossible"
}
}
}
【此处影射电影《碟中谍》(Mission Impossible)】
那么就能用以下的指令分别地完成每一个指定的准则,完成整个advancement,但只对于有"winner"的玩家。
/advancement grant @a[tag=winner] custom:missions mission1
/advancement grant @a[tag=winner] custom:missions mission2
这个trigger没有condition。
5.2.11 inventory_changed
这个触发器在玩家的物品栏更新时触发,比如增减物品栏里的东西。注意用右键或者左键拖动物品来分散物品将只被当作一次操作。下面这个将会触发任何物品栏里的东西的增减:
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:inventory_changed"
}
}
}
这个trigger有2个condition:"slots"和"items"。
(i) slots
"slots"这个object包含了物品栏的普通信息。可以有三个range:"occupied"、"full"和 "empty"。护甲栏和副手参与检查。
- "occupied"这个range和非空栏位(包括装满的栏位)个数比较
- "full" 这个range和装满的栏位个数比较(比如说一个钻石镐或者64个石头)
- "empty"这个range和空栏位个数比较。
举个例子,下面这个将会在玩家在物品栏更新时刚好有10个空物品栏的情况下激活。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"slots": {
"empty": 10
}
}
}
}
}
(ii) items
"items"这个由item object组成的list中的每一项都会在玩家物品栏里寻找和自己对应的格子。每一项都必须找到对应的格子才算达成。下面这个检查玩家是否在物品栏更新时拥有石头和泥土。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:stone",
"data": 0
},
{
"item": "minecraft:dirt"
}
]
}
}
}
}
5.2.12 item_durability_changed
在玩家任何一个背包内的物品有耐久度降低(暂时增加不算)的时候触发。
以下会在玩家背包内任何物品降低耐久度的时候触发
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:item_durability_changed"
}
}
}
这有三个conditions: "item", "durability" 及 "delta"
(i) item
一个item物件,代表耐久度降低了的物件。这个会在耐久度降低前检查,容许你在耐久度降低前检查其原先的耐久度,以及其他资料。
以下在一把曾经(也可以还拥有)有1540或以上耐久度的钻石剑耐久度下降时触发。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:item_durability_changed",
"conditions": {
"item": {
"item": "minecraft:diamond_sword",
"durability": {
"min": 1540
}
}
}
}
}
}
(ii) durability
一个range物件,检查物品剩余的耐久度。
以下检查盾是否只剩下10点耐久度或以下。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:item_durability_changed",
"conditions": {
"durability": {
"max": 10
}
}
}
}
}
(iii) delta
一个range物件,检查耐久度改变数值。($\Delta$耐久度)
以下检查物品有没有超过2点耐久度改变。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:item_durability_changed",
"conditions": {
"delta": {
"max": -2
}
}
}
}
}
5.2.13 levitation
在玩家有悬浮(levitation)效果时触发。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:levitation"
}
}
}
这有两个conditions: "duration" 及 "distance"
(i) duration
一个range物件,检测玩家悬浮的时间(而不是效果的应有持续时间)。注意这在效果失去前是不会重置的,因此在得到此advancement之后马上移除这advancement会导致这advancement马上重新获得,除非玩家的悬浮效果消失。
以下检查玩家是否已经悬浮了超过40游戏刻(2秒,如果卡顿的话则更长)
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:levitation",
"conditions": {
"duration": {
"min": 40
}
}
}
}
}
(ii) distance
range物件,检查玩家悬浮后离原先位置的距离(米,也就是多少格)。
以下检查玩家是否还在10格范围内
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:levitation",
"conditions": {
"distance": {
"max": 10
}
}
}
}
}
5.2.14 location
这个触发器每秒会触发1次(每20游戏刻一次),基本上是必须使用conditions的。
这个触发器在需要先决advancement时非常有用。
conditions就是location object。
比如这个检查玩家是否在y=0至30
{
"criteria": {
"below_sea_level": {
"trigger": "minecraft:location",
"conditions": {
"position": {
"y": {
"min": 0.0,
"max": 30.0
}
}
}
}
}
}
比如这个检查玩家是否到过沙漠和平原
{
"criteria": {
"visit_desert": {
"trigger": "minecraft:location",
"conditions": {
"biome": "minecraft:desert"
}
},
"visit_plains": {
"trigger": "minecraft:location",
"conditions": {
"biome": "minecraft:plains"
}
}
}
}
5.2.15 player_hurt_entity
这个触发器在玩家对实体造成伤害时触发,包括0点伤害(雪球)
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:player_hurt_entity"
}
}
}
这触发器有两个conditions: damage, entity
(i) damage
一个damage object储存玩家造成伤害的数据。entity_source为玩家本身。type基本上没意义,因为type必定是"minecraft:player"。
这个例子检查玩家是否造成10+点的原始投射物伤害,并且造成9+点的实际伤害。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:player_hurt_entity",
"conditions": {
"damage": {
"dealt": {
"min": 10.0
},
"taken": {
"min": 9.0
}
"type": {
"is_projectile": true
}
}
}
}
}
}
distance的原点为玩家坐标,因此distance永远是0(玩家坐标与玩家坐标的距离)。
(ii) entity
一个entity object,检查受到伤害的实体的资讯。
以下这个检查僵尸是否被玩家以投射物造成伤害
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:player_hurt_entity",
"conditions": {
"damage": {
"type": {
"is_projectile": true
}
},
"entity": {
"type": "minecraft:zombie"
}
}
}
}
}
distance的原点为该实体坐标,故distance数值为玩家与被伤害实体之间的距离。
以下例子检查玩家是否在实体的3格距离内对实体造成伤害
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:player_hurt_entity",
"conditions": {
"entity": {
"distance": {
"max": 3
}
}
}
}
}
}
5.2.16 player_killed_entity
当玩家击杀别的实体时会被触发(不包括玩家)。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:player_killed_entity"
}
}
}
这个的conditions就是一个death object。
该entity就是被杀死的entity,而distance原点就是该实体的坐标,故distance就是玩家与被杀死实体的距离。
以下这例子检查玩家是否在骷髅的50格外杀死该骷髅
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:player_killed_entity",
"conditions": {
"entity": {
"type": "minecraft:skeleton",
"distance": {
"min": 50
}
},
"killing_blow": {
"is_projectile": true
}
}
}
}
}
至于伤害类型(damage flag object)则检查玩家造成的伤害的数据。
以下这例子检查玩家是否不以投射物伤害杀死爬行者
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:player_killed_entity",
"conditions": {
"entity": {
"type": "minecraft:creeper"
},
"killing_blow": {
"is_projectile": false
}
}
}
}
}
5.2.17 recipe_unlocked
当玩家解锁指定合成配方(recipe, 不确定官方译名)时会被触发。
这trigger有一个必须的condition: recipe,指定该合成配方的文件位置。
注意这只会在收到合成配方时检查。如果玩家在这advancement存在前已经解锁了指定的合成配方,这advancement将不会理会该合成配方(也就是说那玩家无法得到这advancement)。因此你需要删除玩家解锁了的指定合成配方(使用/recipe命令)才能让该玩家能得到此advancement。
这例子会检查玩家是否解锁"minecraft:redstone"(红石)的合成配方(即使是作为另外一个advancement的奖励)。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "minecraft:redstone"
}
}
}
}
5.2.18 slept_in_bed
这触发器在玩家成功睡觉时触发(有怪物在外面/床爆炸时则不行)。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:slept_in_bed"
}
}
}
conditions为location object,检查玩家在床上的坐标(也就是床上1格)。
比如这个检查玩家是否在y<=10的地方睡觉
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:slept_in_bed",
"conditions": {
"position": {
"y": {
"max": 10
}
}
}
}
}
}
这个检查玩家是否在沙漠里睡觉
注意: 由于床爆炸时不能触发此触发器,故此没法检查在地狱睡觉
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:slept_in_bed",
"conditions": {
"biome": "minecraft:desert"
}
}
}
}
5.2.19 summoned_entity
当玩家以指定方法生成指定实体时会被触发。方法包括: 生成凋灵(放置方块),生成雪傀儡(放置方块),生成铁傀儡(放置方块),重新生成末影龙(放置水晶)。生成末影龙时,所有能够看到末影龙血量条的玩家都算作满足这条件。
以下这例子检查玩家有没有以以上方法生成实体
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:summoned_entity"
}
}
}
这trigger有1个condition: entity。
(i) entity
这个entity object会检查生成的实体。
distance的原点为生成的实体的位置,故distance为生成的实体与玩家之间的距离
以下这例子会检查生成了的实体是否末影龙。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:summoned_entity",
"conditions": {
"entity": {
"type": "minecraft:ender_dragon"
}
}
}
}
}
以下这例子检查末影龙是否在玩家10格内被生成(玩家应该要在非常高的位置)
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:summoned_entity",
"conditions": {
"entity": {
"type": "minecraft:ender_dragon",
"distance": {
"max": 10
}
}
}
}
}
}
5.2.20 used_ender_eye
当玩家使用末影之眼的时候触发。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:used_ender_eye"
}
}
}
这trigger有1个condition: distance。
(i) distance
这个range检查最近的要塞(stronghold)的中心点与玩家的x坐标与z坐标距离,不理会y坐标距离。
计算公式为: $\sqrt{(player.x - stronghold.x)^2 + (player.Z - stronghold.Z)^2}$
比如玩家在(40, 64, 10),最近的要塞在(120, 25, 400),distance就是 $\sqrt{(40-120)^2+(10-400)^2}=398$
以下这例子检查玩家距离最近的要塞398格或以内使用末影之眼。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:used_ender_eye",
"conditions": {
"distance": {
"max": 398
}
}
}
}
}
5.2.21 villager_trade
这触发器在玩家与村民交易时触发。
注意: 以shift键交易(一次过把东西全换掉)只会触发这触发器一次(第一次的时候)
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:villager_trade"
}
}
}
这触发器有两个conditions: villager, item
(i) villager
villager为一个entity object,检查交易的村民的资料。type基本上没用,因为type必定是"minecraft:villager"
distance的原点为村民坐标,故distance数值为玩家与村民的距离
这例子检查玩家是否在与村民距离为1格内时完成交易
{
"criteria": {
"shady_deal": {
"trigger": "minecraft:villager_trade",
"conditions": {
"villager": {
"distance": {
"max": 1
}
}
}
}
}
}
(ii) item
这item object检查购买了(purchased)的物品的资料。
注意: 以shift迅速多次交易时(一次过把东西全换掉),这只会计算一次的交易资料。
比如村民1个绿宝石可换2个糖,按着shift键交易获得10个糖也只会计算第一次交易的资料,也即是2个糖
因为第一次完成的交易时两个糖
以下这例子检查购买了的物品是否糖
{
"criteria": {
"shady_deal": {
"trigger": "minecraft:villager_trade",
"conditions": {
"item": {
"item": "minecraft:sugar"
}
}
}
}
5.3 Requirements
Requirements是一个list,结构为析取範式(disjunctive normal form, DNF),来容许使用布尔逻辑(boolean logic)来决定是否给予指定advancement。这list里有list(list of list),内层list为准则名称的list(list of string)。
里层的list为与(and),外层为或(or)。必须有两层list。
如果不指定requirements,则需要满足所有准则。使用这个则可以使用或(or)。
以下这个advancement需要满足trigger_1及trigger_2才会获得此advancement。(trigger_1 and trigger_2)
{
"criteria": {
"trigger_1": {
"trigger": "minecraft:player_damaged"
},
"trigger_2": {
"trigger": "minecraft:used_ender_eye"
}
},
"requirements": [
["trigger_1", "trigger_2"]
]
}
以下这个advancement则当trigger_1或trigger_2满足时即可获得。(trigger_1 or trigger_2)
{
"criteria": {
"trigger_1": {
"trigger": "minecraft:player_damaged"
},
"trigger_2": {
"trigger": "minecraft:used_ender_eye"
}
},
"requirements": [
["trigger_1"],
["trigger_2"]
]
}
5.4 display
可选对象display控制显示在Advancements菜单里的信息。如果这个对象不存在,那么此advancement将会被隐藏。
当这个对象存在时,其中必须包含一个title字串和一个icon字串。icon作为图像显示在Advancements目录里,当鼠标移动到icon上时,title的内容会被显示。这里是个例子:
5.4.1 title
title字串可以为任何文字或json格式(类似/title及/tellraw命令)。以下是一个例子使用json的title
{
"display": {
"title": {"text":"Stew","obfuscated":true},
"description": "",
"icon": "minecraft:mushroom_stew",
"background": "minecraft:textures/gui/advancements/backgrounds/stone.png"
},
"criteria": {
"trigger_1": {
"trigger": "minecraft:location"
}
}
}
5.4.2 description
description字串可以为普通字串或JSON的Text Component(和tellraw那些的类似)。description会在鼠标悬浮在advancement icon上的时候显示,但不会在完成advancement时的弹窗(popup)出现。description可以为空白(""),但这个标签本身必须存在。比如下面这个advancement:
{
"display": {
"icon": "minecraft:elytra",
"title": "Learn to Fly",
"description": "Learn how to fly using a new pair of elytra.",
"background": "minecraft:textures/gui/advancements/backgrounds/stone.png"
},
"criteria": {
"elytra": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:elytra",
"data": 1
}
]
}
}
}
}
使用json的description:
{
"display": {
"icon": "minecraft:elytra",
"title": "Learn to Fly",
"description": {"text":"Learn how to fly using a new pair of elytra.","italic":true},
"background": "minecraft:textures/gui/advancements/backgrounds/stone.png"
},
"criteria": {
"elytra": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:elytra",
"data": 1
}
]
}
}
}
}
5.4.3 icon
至于icon则只是物品id字串。icon会在advancement窗口里以及弹窗里出现。目前不能够指定数据值。
该id前必须有minecraft:
5.4.4 background
如果这个json内没有parent字段(即为整个选项卡的root项目),那么可以提供一个可选字串background。这将作为所有icon的背景显示。它的值应为一个可被解析到的图片地址。例如这个advancement将会显示金块(来自其方块材质)于背景:
{
"display": {
"title": "Stew",
"icon": "minecraft:mushroom_stew",
"background": "minecraft:textures/blocks/gold_block.png"
},
"criteria": {
"trigger_1": {
"trigger": "minecraft:inventory_changed"
}
}
}
5.4.5 frame
还有一个可选字串frame接受三个可能的值:task, goal和challenge。如果没有被定义,那么默认的值为task。这将改变icon的外框的样式。以下的advancement将会使之使用challenge的外框:
{
"display": {
"title": "Stew",
"icon": "minecraft:mushroom_stew",
"background": "minecraft:textures/blocks/gold_block.png",
"frame": "challenge"
},
"criteria": {
"trigger_1": {
"trigger": "minecraft:inventory_changed"
}
}
}
5.5 parent
parent字串指定另一个advancement的文件路径,使之作为此advancement的前置项目存在。这决定了显示于Advancements目录里面的树状图结构。注意,前置advancement并不要求一定在它们的子advancement前完成。
为了让advancement显示在成就树中,display字串必须存在。
给出如下advancement:
{
"display": {
"title": "Take damage",
"icon": "minecraft:diamond_sword"
},
"parent": "minecraft:custom/root",
"criteria": {
"trigger_1": {
"trigger": "minecraft:player_damaged"
}
}
}
上述advancement直接属于"minecraft:custom/root"的分支。这里是实际的显示效果:
你也可以让多个advancement拥有共同的parent:
5.6 Rewards
reward物件能指定玩家完成advancement时获得的奖励。
可以同时有多个奖励:
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:player_damaged"
}
},
"rewards": {
"recipes": ["minecraft:redstone", "minecraft:ladder"],
"loot": ["minecraft:entities/creeper", "minecraft:chests/simple_dungeon"],
"experience": 500
}
}
5.6.1 recipes
这列表指定了玩家完成此advancement时会获得的合成配方(recipe)。是物件名称的字串列表(list of string)。
以下这例子会给予红石及梯子的合成配方。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:player_damaged"
}
},
"rewards": {
"recipes": ["minecraft:redstone", "minecraft:ladder"]
}
}
5.6.2 loot
指定执行的可掠夺物品表(loot table),以给予玩家物品。
这例子会执行"minecraft:entities/creeper"及"minecraft:chests/simple_dungeon"的可掠夺物品表。(给予苦力怕死亡时的掉落及地牢箱子的物品)
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:player_damaged"
}
},
"rewards": {
"loot": ["minecraft:entities/creeper", "minecraft:chests/simple_dungeon"]
}
}
5.6.3 experience
这数字(不是range)指定了给予玩家的经验数量(不是等级)。
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:player_damaged"
}
},
"rewards": {
"experience": 500
}
}
5.6.4 commands
当完成advancement时执行命令列表。命令列表会马上(同一gt,当grant advancement的时候马上执行,其后执行其他命令,如果有的话)顺序执行。命令执行者为得到advancement的玩家,因此stats,执行坐标及@s会为该玩家。
可以参考玄素的帖子 http://www.mcbbs.net/thread-688979-1-1.html
被实体伤害之后说
"Myself: (玩家名)"
"The nearest non-player entity: (最近的非玩家实体名称)"
{
"criteria": {
"custom_test_name": {
"trigger": "minecraft:entity_hurt_player"
}
},
"rewards": {
"commands": [
"/say Myself: @s",
"/say The nearest non-player entity: @e[type=!player,c=1]"
]
}
}
5.7 树状显示(Tree display)
如果该advancement有display标签,它就会在advancement的目录中的一个分页里显示。根(root)advancement就是该分页的"拥有者"。每个根advancement都会有一个属于它们的分页,它们可以控制该分页的背景。
5.7.1 根(root)advancement
根advancement就是没有parent的advancement,会放在最左边。
如果该advancement没有display标签,分页将不会被显示,因此可以隐藏其他advancement。然而子advancement完成时也会有弹窗提示。
以下这个是一个会被显示的根advancement
{
"display": {
"icon": "minecraft:diamond",
"title": "A Root",
"description": "The root of this tree.",
"background": "minecraft:textures/gui/advancements/backgrounds/stone.png"
},
"criteria": {
"impossible": {
"trigger": "minecraft:impossible"
}
}
}
以下这个是一个不会被显示的根advancement
{
"criteria": {
"impossible": {
"trigger": "minecraft:impossible"
}
}
}
5.7.2 子(branches)advancement
子advancement就是有parent的advancement,会生成新枝干连着其父advancement。
一个父advancement可以有多个子advancement。
6 命令
未完成
7 结论
未完成