Magic Mirror

Started by 2Cool4u on

Topic category: Help with MCreator software

Last seen on 23:27, 22. Apr 2024
Joined Apr 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Magic Mirror

How do I make an item that sends the player to their spawn point???

Last seen on 14:30, 2. Aug 2022
Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I just updated my testing…
Sun, 06/27/2021 - 12:11

I just updated my testing workspace to 1.16.5, and I now see SpawnDimension in the player's NBT data (since respawn anchors were added, the spawn dimension actually matters). Unfortunately, since it is stored as a string, you can't use Minecraft's commands to transfer it into the ForgeData which MCreator can access. You may be able to access it using some custom code, but I don't know what that would be.

Last seen on 21:43, 19. Apr 2024
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hey, I see this topic has…
Tue, 08/02/2022 - 10:57

Hey, I see this topic has long been expanded upon. But could someone for whom this has worked explain to me how exactly the part works that stores the player spawn (not world spawn) coordinates? I copied every procedure block and the "teleport to world spawn"- part obviously works - but always - wether or not I set a personal player spawn via bed, etc.

thanks in advance

Last seen on 14:30, 2. Aug 2022
Joined Aug 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The purpose of the four…
Tue, 08/02/2022 - 14:26

The purpose of the four commands used in the procedure is to move information from Minecraft's NBT data to the Forge NBT data. The get/set NBT tag blocks in MCreator can actually only access the values stored under the ForgeData section. We want to use the values stored for SpawnXYZ in the vanilla NBT data, so we need to do something special to get them into the MCreator territory. I haven't looked into it very deeply and it might have been updated since I last tried, but the easiest way I found is to use the execute store command to move NBT data around.

 

Looking at the improved magic mirror procedure, the first command used is:

execute store success entity @s ForgeData.hasSpawn byte 1 run data get entity @s SpawnX

This command checks if the player has set their spawn point. If the player has a spawn point, the second part of the command (data get entity @s SpawnX) is successful and a value of true is stored into ForgeData.hasSpawn. This is used by the get (Event/target entity) data logic NBT tag ("hasSpawn") to choose between using the world spawn point or the player's stored spawn point.

The next three commands are:

execute store result entity @s ForgeData.spawnX int 1 run data get entity @s SpawnX

execute store result entity @s ForgeData.spawnY int 1 run data get entity @s SpawnY

execute store result entity @s ForgeData.spawnZ int 1 run data get entity @s SpawnZ

These commands copy the X, Y, and Z coordinates of the player's spawn position into ForgeData NBT values so they can be used for the Set location of (Event/target entity) block.

If you want to know why the commands are this way, the best explanation is that this is just how Minecraft's /execute store command works. You can read more about it here: https://minecraft.fandom.com/wiki/Commands/execute#Store_subcommand.