2

I'm trying to make an Easter egg hunt where you find 15 signs, in any order right-clicked (and then break) they display a chat message with a counter on how many signs you right-clicked (and then broke)

I need a command that is "If this player right-clicks and then breaks all 15 of the easter eggs, do this" Ex:

You found 2/15 easter eggs!

you right-click and then break the next sign:

You found 3/15 easter eggs!

and so on...

Version: 1.19.2

2
  • 1
    Welcome to Arqade! On Minecraft commands questions, please see our guide on what to do before asking a Minecraft commands question, especially the part about “what you’ve tried so far”, and edit in the requested information to your post.
    – pinckerman
    Jun 22 at 22:31
  • 1
    Does is matter in what order the signs are broken, or can any sign be found at any time? Also what Minecraft version are you on? Jun 24 at 16:56

1 Answer 1

5

You could detect when the signs break separately.

This means you would need to repeat it for every sign, but I wasn't able to figure out another way.

Minecraft 1.12.1

Make scoreboard to track the signs:

scoreboard objectives add EasterEggs dummy

You would detect when the block that the sign is in is air:

execute if block 1 56 -4 air run scoreboard players add @a EasterEggs 1

This command block is repeating and needs Redstone, it will execute at the sign when it's air, then the following command will be a conditional chain command block. This will tell the player the score:

execute as @a run title @s actionbar ["",{"text":"You Found "},{"score":{"name":"@a","objective":"EasterEggs"}},{"text":"/15 Easter Eggs!"}]

Score

The last command will be in another conditional chain command block, removing the Redstone that powers the Commandblock chain:

setblock 5 56 -4 air

The coordinates are simply next to the repeating Commandblock.

Easter Egg Command Blocks

Here is a demonstration: Demonstration


Then for the sign:

Minecraft 1.20:

I used this command to give myself a sign that replaces itself with air when clicked:

give @p oak_sign{BlockEntityTag:{front_text:{messages:['{"text":"Easter egg","clickEvent":{"action":"run_command","value":"setblock ~ ~ ~ air"}}','{"text":""}','{"text":""}','{"text":""}']}}} 1

You can change the text to your liking within the "text":"<Your text here>" parts.

Minecraft 1.19:

/give @p oak_sign{BlockEntityTag:{Text1:'{"text":"Easter Egg","clickEvent":{"action":"run_command","value":"Setblock <x> <y> <z> <block>"}}'}} 1

And for each line, you do Text<n> where n is the line you want your text to be, ex: Text1:'{"text":"","clickEvent":{}}',Text2:'{"text":""}',Text3:'{}'

5
  • +1 Great answer! How about a command that doesn't replace the sign with a block and just leaves the sign?
    – DialFrost
    Jun 24 at 23:36
  • 1
    Well, make the first command block Impulse and Need Redstone, remove the execute part of it, and leave scoreboard players add @a EasterEggs 1. Then remove the Redstone block next to the command block. Then remove the 3rd command block. The sign will then have the command: setblock <x> <y> <z> redstone, so when you click it it will place the redstone, but if you click it again it wont be able to place a redstone block. Jun 25 at 0:00
  • 1
    Then you would need to still have command blocks for each sign and change the coordinates for the sign command. Jun 25 at 0:06
  • Smart! But Im on version 1.19.2 Jun 25 at 13:30
  • Alright, I have updated the answer to also work for 1.19. because the only difference is that signs now in 1.20 can have text on both front and back, I simply included the 1.19 give command for the sign. Jun 25 at 18:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .