Started by
Wolfgalaxy
on
Topic category: Help with Minecraft modding (Java Edition)
I have an item that spawns a structure when it's right clicked on the ground, but the structure always spawns facing the same direction. I want it to spawn facing the player. Is there any way to do this? I also tried switching it to spawning the structure when the item is right clicked in the air and that didn't work either.
I will tell you how you could do this by giving you an example:
Let's say that you built your structure facing north, for simplicity's sake. In your procedure, you could simply make an if statement for every possible direction the structure can be placed in and rotate it accordingly.
So, for north, the if statement would be something like:
(if <Direction of Event/target entity> = NORTH) then place the structure with no rotation
For another direction, like east, it would look something like this:
(if <Direction of Event/target entity> = EAST) then place the structure with rotation "CLOCKWISE_90"
Do this for all 4 cardinal directions (N/S/E/W), and it should work as you want. You might have to play around with rotations to get exactly what you want. If you want rotations for UP and DOWN as well, you will unfortunately have to make custom structures for those two as Minecraft does not have support for rotating on that axis.
Hey, can you please screenshot your procedure for the item that lets you spawn the structure?