1

I'm currently making a factions map for realms to put up on Planet Minecraft. In the map I have it so that a thrown egg teleports you to spawn (get it? spawn egg). The thing is that execute @e[type=item,name=Spawn] ~~~ doesn't seem to work right.

I obviously don't want every thrown egg to send you back to spawn, but I also like the idea of a spawn egg and it's easier for pocket edition players to throw an egg rather than have to drop something else.

Can I take the egg by some other attribute other than name?

I made it so that dropped eggs will just summon a thrown egg above it and then die themselves, but I'm hoping for a better solution to this.

  • I don't really know how Bedrock Edition commands work compared to PC, but wouldn't it be easier to execute players who have thrown eggs than to execute the eggs themselves? – SpiceWeasel Jan 30 '19 at 2:38
  • Wouldn't I still need to get the egg though? Like execute for the player throwing a specific type of egg. – gio1135 Jan 30 '19 at 6:20
1

I think it would be easier to execute players who have thrown a specific type of egg instead of executing the egg itself. Since I don't know Bedrock Edition commands, I'll use PC commands and hopefully you can edit them to your liking, or someone else can edit them in this answer.

Add an objective that tracks players who throw eggs:

/scoreboard objectives add egg minecaft.used:minecraft.egg

Then have these commands running in a repeating chain:

tp @a[tag=egg,scores={egg=1}] <write your spawnpoint coordinates here>
tag @a remove egg
tag @a[nbt={SelectedItem:{id:"minecraft:egg",tag:{display:{Name:"\"Spawnpoint\""}}}}] add egg
scoreboard players reset @a egg

What this does is:

  • Teleports all players who have thrown an egg with the egg tag to the spawnpoint.
  • Removes the egg tag of all players, then adds it for those who are holding the specific egg. In the next tick, if they had held this egg before throwing it, they will be tped. The reason why I added the tag after the tp command is because they wouldn't have had the egg anymore so tagging them would have been impossible.
  • Resets their egg score.

That system was for 1.13 commands. If you're using 1.12, use these commands instead.

tp @a[tag=egg,score_egg_min=1] <write your spawnpoint coordinates here>
tag @a remove egg
tag @a add egg {SelectedItem:{id:"minecraft:egg",tag:{display:{Name:"Spawnpoint"}}}}
scoreboard players reset @a egg
  • 1
    There's no way to get NBT data in bedrock edition. I only know commands in bedrock edition so executing for the player made no sense to me whatsoever. – gio1135 Jan 31 '19 at 8:51
  • @gio1135 But if you can't get NBT data then wouldn't it be impossible to do what you want? – SpiceWeasel Jan 31 '19 at 15:11
  • I don't know. People get pretty creative with commands. I assumed maybe someone with bedrock command experience would be able to offer a solution. I know dakonblackrose (YouTube) has a some of cool stuff with commands for instance. – gio1135 Jan 31 '19 at 20:27

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.