Résolu Command_blocks: détection de clique droit sur un item.

billydog132

Architecte en herbe
21 Mars 2015
98
2
120
24
merci...
Dsl si je te casse les pieds avec ça mais avec to one command block je pourrai étudier ton système
Encore merci!!!
 

Oromis

Command-blocker slimesque
Staff
Modérateur
Support
11 Février 2014
3 345
2
1 053
297
24
Bretagne
Voici la command ! Au passage, j'ai trouvé un moyen de remplacer les 9 command blocks par un seul :
Code:
summon FallingSand ~ ~1 ~ {Block:stone,Time:1,Passengers:[{id:FallingSand,Block:redstone_block,Time:1,Passengers:[{id:FallingSand,Block:activator_rail,Time:1,Passengers:[{id:MinecartCommandBlock,Command:gamerule commandBlockOutput false},{id:MinecartCommandBlock,Command:"fill ~2 ~-3 ~-1 ~8 ~-1 ~1 stained_hardened_clay 12 hollow"},{id:MinecartCommandBlock,Command:"fill ~2 ~-2 ~-1 ~8 ~-2 ~1 stained_glass 10 replace stained_hardened_clay"},{id:MinecartCommandBlock,Command:"/scoreboard objectives add tp stat.useItem.minecraft.carrot_on_a_stick"},{id:MinecartCommandBlock,Command:"/scoreboard objectives add name dummy"},{id:MinecartCommandBlock,Command:setblock ~1 ~-3 ~ wall_sign 4 replace {Text1:"{\\\"text\\\":\\\"================\\\",\\\"color\\\":\\\"black\\\"}",Text2:"{\\\"text\\\":\\\"Clic ici pour\\\",\\\"color\\\":\\\"black\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"run_command\\\",\\\"value\\\":\\\"/give @p minecraft:carrot_on_a_stick 1 0 {display:{Name:\\\\\\\"tp\\\\\\\"}}\\\"}}",Text3:"{\\\"text\\\":\\\"avoir l'objet\\\",\\\"color\\\":\\\"black\\\"}",Text4:"{\\\"text\\\":\\\"================\\\",\\\"color\\\":\\\"black\\\"}"}},{id:MinecartCommandBlock,Command:setblock ~1 ~-2 ~ wall_sign 4 replace {Text1:"{\\\"text\\\":\\\"================\\\",\\\"color\\\":\\\"black\\\"}",Text2:"{\\\"text\\\":\\\"Détruire la\\\",\\\"color\\\":\\\"black\\\"}",Text3:"{\\\"text\\\":\\\"structure\\\",\\\"color\\\":\\\"black\\\"}",Text4:"{\\\"text\\\":\\\"================\\\",\\\"color\\\":\\\"black\\\",\\\"clickEvent\\\":{\\\"action\\\":\\\"run_command\\\",\\\"value\\\":\\\"fill ~ ~-1 ~-1 ~7 ~1 ~1 air\\\"}}"}},{id:MinecartCommandBlock,Command:setblock ~7 ~-2 ~ chain_command_block 11 replace {auto:1,Command:"/command block inutil, permet juste d'éviter un bug du générateur"}},{id:MinecartCommandBlock,Command:setblock ~6 ~-2 ~ chain_command_block 13 replace {auto:1,Command:"/scoreboard players set @a[score_name_min=2] name 0"}},{id:MinecartCommandBlock,Command:setblock ~5 ~-2 ~ repeating_command_block 5 replace {auto:1,Command:"/execute @a ~ ~ ~ scoreboard players add @a name 1 {SelectedItem:{id:minecraft:carrot_on_a_stick,tag:{display:{Name:tp}}}}"}},{id:MinecartCommandBlock,Command:setblock ~4 ~-2 ~ chain_command_block 13 replace {auto:1,Command:"/scoreboard players set @e[score_tp_min=1] tp 0"}},{id:MinecartCommandBlock,Command:setblock ~3 ~-2 ~ repeating_command_block 5 replace {auto:1,Command:"/tp @e[score_tp_min=1,score_name_min=1] ~ ~10 ~"}},{id:MinecartCommandBlock,Command:setblock ~ ~ ~1 command_block 0 replace {Command:fill ~ ~-3 ~-1 ~ ~ ~ air}},{id:MinecartCommandBlock,Command:setblock ~ ~-1 ~1 redstone_block},{id:MinecartCommandBlock,Command:kill @e[type=MinecartCommandBlock,r=1]}]}]}]}
 

billydog132

Architecte en herbe
21 Mars 2015
98
2
120
24
dis comment tu as fait pour faire tout l'ensemble du système, tu as créer combien de scoreboard?
 

Oromis

Command-blocker slimesque
Staff
Modérateur
Support
11 Février 2014
3 345
2
1 053
297
24
Bretagne
Deux scoreboards seulement ont été créé. Quand tu dis l'ensemble du systèmes, c'est l'apparition, ou le système en sois ?
 

Oromis

Command-blocker slimesque
Staff
Modérateur
Support
11 Février 2014
3 345
2
1 053
297
24
Bretagne
Un scoreboard pour détecter le clic droit :
Code:
/scoreboard objectives add tp stat.useItem.minecraft.carrot_on_a_stick
Un scoreboard pour détecter la présence de l'objet renommé dans les mains du joueur :
Code:
/scoreboard objectives add name dummy

Ensuite, on incrémente d'un le score name du joueur, en boucle tant qu'il tient l'objet renommé en main :
Code:
/execute @a ~ ~ ~ scoreboard players set @a name 1 {SelectedItem:{id:minecraft:carrot_on_a_stick,tag:{display:{Name:tp}}}}
Lorsque le score dépasse 2, on le reset :
Code:
/scoreboard players set @a[score_name_min=1] name 0
Ensuite, on tp de 10 blocks en hauteur tout les joueurs qui ont un score de 1 minimum sur les deux objectifs :
Code:
/tp @e[score_tp_min=1,score_name_min=1] ~ ~10 ~
Puis on reset le score tp :
Code:
/scoreboard players set @e[score_tp_min=1] tp 0
 

billydog132

Architecte en herbe
21 Mars 2015
98
2
120
24
merci ça me sera très utile!!!

afin j'ai pas encore essayé mais je garderais le système pour mes autres inventions comme exemple.
 
Dernière édition par un modérateur:

Oromis

Command-blocker slimesque
Staff
Modérateur
Support
11 Février 2014
3 345
2
1 053
297
24
Bretagne
D'accord, de rien, n'oublie pas de mettre le post en résolu ! :p