Bonjour tout le monde,
je joue sur la dernière snapshot 18w11a.
Regardez l'image jointe.
L'idée c'est de détecter un item, créditer un point, supprimer l'item et afficher un message.
A droite j'ai:
Code (cpp):
[REDSTONE_BLOCK]
[REAPEATING_COMMAND_BLOCK en REPE/INCO/REDS]
/execute as @e[x=1705,y=57,z=-897,distance=..1,nbt={Item:{id:"minecraft:enchanting_table"},OnGround:1b}] if entity @p[tag=!enchanting_table] run kill @s
[REAPEATING_COMMAND_BLOCK en REPE/COND/TACT]
execute as @p[x=1705,y=57,z=-897,distance=..2] if entity @s[tag=!enchanting_table] run tag @s add enchanting_table
[REAPEATING_COMMAND_BLOCK en REPE/COND/TACT]
scoreboard players add @p[x=1706,y=57,z=-897,distance=..2] Mission 1
[CHAIN_COMMAND_BLOCK en CHAI/INCO/TACT]
tellraw @a ["",{"selector":"@p[x=1706,y=57,z=-897,distance=..3]","color":"aqua"},{"text":" a réussit à créer une table d'enchantement.\n"},{"text":"Il gagne un point !","color":"yellow"},{"text":"\n "}]
A gauche j'ai:
Code (cpp):
[REDSTONE_BLOCK]
[REAPEATING_COMMAND_BLOCK en REPE/INCO/REDS]
/execute as @e[x=1705,y=57,z=-897,distance=..1,nbt={Item:{id:"minecraft:diamond_sword"},OnGround:1b}] if entity @p[tag=!diamond_sword] run kill @s
[REAPEATING_COMMAND_BLOCK en REPE/COND/TACT]
execute as @p[x=1705,y=57,z=-897,distance=..2] if entity @s[tag=!diamond_sword] run tag @s add diamond_sword
[REAPEATING_COMMAND_BLOCK en REPE/COND/TACT]
scoreboard players add @p[x=1706,y=57,z=-897,distance=..2] Mission 1
[CHAIN_COMMAND_BLOCK en CHAI/INCO/TACT]
tellraw @a ["",{"selector":"@p[x=1706,y=57,z=-897,distance=..3]","color":"aqua"},{"text":" a réussit à créer une epee diams.\n"},{"text":"Il gagne un point !","color":"yellow"},{"text":"\n "}]
Lorsque je pose une table d'enchantement sur le cube jaune, ça marche.
Supprime l'item, m'ajoute un point, affiche le message.
Lorsque je pose l'épée sur le cube jaune, ça marche pas, pourquoi ?.
Supprime l'item et c'est tout !
Il y a de nombreux bugs avec les command_block, j'en ai trouvé un ou pas ?.