So I've been trying to make the Space Stone from the Marvel universe and I would like to know whether it's possible to make it so that when I right click a block of blue glazed terra-cotta, an ender pearl can be tossed or some action can take place. If possible, I would also like the block to leave water particles behind me. Is there any way to make sure of this with command lingo?

  • 1
    You mean holding a block as item and clicking? No, that would always attempt to place the block and either do it or fail completely. But you could retexture a different item. For example… an ender pearl! – Fabian Röling Oct 17 '19 at 9:59

There is a way to have custom right-click actions. The following is taken from that answer (see that for info on how it works), except edited to be relevant to this answer and updated for 1.13:

First run the following commands once to create the scoreboard objectives used:

  1. /scoreboard objectives add holdTerracotta dummy
  2. /scoreboard objectives add rightClick dummy
  3. /scoreboard objectives add summoned dummy

Create a command block chain that runs the following commands in the correct order:

  1. scoreboard players add @a summoned 0
  2. scoreboard players set @a holdTerracotta 0
  3. scoreboard players set @a[nbt={SelectedItem:{id:"minecraft:blue_glazed_terracotta"}] holdTerracotta 1
  4. scoreboard players set @e[type=armor_stand] rightClick 0
  5. scoreboard players set @e[type=armor_stand,nbt={HandItems:[{id:"minecraft:blue_glazed_terracotta"]}] rightClick 1
  6. execute as @e[type=armor_stand,scores={rightClick=1..}] run <summon ender pearl command>
  7. execute at @e[scores={holdSword=1..,summoned=0}] run summon armor_stand ~ ~ ~ {CustomName:rightclick,Invisible:1b,Invulnerable:1b,NoBasePlate:1b,NoGravity:1b,ShowArms:1b}
  8. scoreboard players set @a[scores={holdSword=1..,summoned=0}] summoned 1
  9. execute as @a[scores={holdSword1..,summoned=1..}] at @s run tp @e[type=armor_stand,name=rightclick,distance=..1] @s
  10. execute at @a[scores={holdSword=0,summoned=1..}] kill @e[type=armor_stand,name=rightclick,distance=..1]
  11. give @a[scores={holdSword=0,summoned=1..}] blue_glazed_terracotta
  12. scoreboard players set @a[scores={holdSword=0,summoned1..}] summoned 0

I haven't tested any of this.

However, the part about summoning an ender pearl (I'm assuming so it's as if an ender pearl was thrown normally) is beyond my knowledge and capabilties. You could try looking at this Reddit post.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.