How to make a structure spawn around a player?

Started by Dave49 on Sat, 10/03/2020 - 22:58

Topic category: Help with modding (Java Edition)

Last seen on 17:54, 10. Nov 2020
Joined Nov 2019
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How to make a structure spawn around a player?
Sat, 10/03/2020 - 22:58

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).

Last seen on 01:36, 23. Nov 2020
Joined Jun 2019
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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.

Last seen on 21:06, 19. Nov 2020
Joined Mar 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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.