Started by
Dave49
on
Topic category: Help with Minecraft modding (Java Edition)
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).
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.
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.