How to make a structure spawn around a player?

Started by Dave49 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make a structure spawn around a player?

I am making my own lucky block mod and when you break the lucky block there is a random chance that a structure that is supposed to trap the player in a closed chamber. I used the Entity/target-X pos - Y pos - Z pos but it doesn't spawn around the player, it spawns a few blocks away (1-3 blocks).

Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The reason is likely because…
Sat, 10/03/2020 - 23:55

The reason is likely because structures load from their corners. To counter this, you should use some of the math procedure blocks to add or subtract the coords a little bit based on the players location.

An alternative, however, could be teleporting the player into the structure when it spawns. Probably by using commands.

A bit messier and less ideal, but another alternative way could simply be building the structure to trap the player in the corner of the structure.

Something to keep in mind, is that if this is the problem, the structure spawns structure in the same way, every time. With the player being in the same corner. So I dont think there should be any difficult math. Just some simple addition or subtraction by a few blocks, depending on how far the structures part you want the player to be in is away from the corner. Hope this helps.

Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
  Something to keep in mind,…
Sun, 10/04/2020 - 00:39

 

Something to keep in mind, is that if this is the problem, the structure spawns structure in the same way, every time. With the player being in the same corner. So I dont think there should be any difficult math. Just some simple addition or subtraction by a few blocks, depending on how far the structures part you want the player to be in is away from the corner.

If I remember correctly, there is a block that says where the location of the player is. if you use that, along with the method you mentioned, it would up the chances even more of it working.