Topic category: Help with Minecraft modding (Java Edition)
The summon particles procedure block using default x y z spawns particles at the vertices of blocks. I set the dx, dy, and dz to 0.1. To get the x and y values to be perfectly center, i've tried every combination. x+.5 & z+.5, x-.5 & z-.5, x+.5 & z-.5, as soon as I find a combination that spawns them centered, eventually, they go off center. I found x+.5 and z-.5 to work on a world. Then made a new world, and it worked, the particles were center. Reset the client, made a new world, everything worked. I figured this was the right combination for sure, so I changed all my spawn particles at x y z and spawn gem at x y z procedures to be x -.5, y, z + .5. Hours later Im working on my mod, decide to make a new world, and they are all offset again T_T
The weirdest part is, when I go to the worlds that it worked on, it still works on those worlds. However making a new world from now on the particles are off center. Is the x y z rotation of my new worlds changing or something? Does anyone know a sure way to spawn particles directly in the center of a block?
I tried it too with spawning a gem at xyz.
If you see all vertices as 0-1x 0-1y and 0-1z then by default, it spawns it at 1, 0, 1. In that case you would've needed
x + 0.5, y + 0.5, z + 0.5. I tried adjusting my mod to replicate those "few hours of modding" in the hope that would change something, but for me all blocks and whatever worlds all work with x + 0.5, y + 0.5, z + 0.5 so far.
Do you know in which way your offset changed once it did?
Incredible how you found this issue. It's so niche and hard to spot.
I made a youtube tutorial: https://www.youtube.com/watch?v=nDoclprdfV0 in which i created an "is player underwater" check. I used z-1 and x-1 to make it work perfectly as the original coordinates got the wrong block. However, now trying to implement this in my other world, using z-1 is wrong and I only need x-1. This also has effect on a procedure that checks if player can see air which has also changed the offset over the lifetime of this workspace.
You found an incredibly annoying issue yet it's so big xD
@Klemen is this a known issue?
It's clearly not a particle issue. It has something to do with the player-coordinates which fails to measure the player location. It changes x/y/z (maybe only x and z?) based on a weird condition every so now and then, but gets it consistently right for the remained of the session.
Converting players' xz coordinates to blockpos coordinates doesn't work properly at negative x or z.
So it has to do with which position you are in inside of the world?
So for anyone still wondering, 1.9.1 actually made it pretty easy to center particles using the /particle command, which puts particles perfectly center anywhere on the map
Nevermind, ran into the issue again. A big chunk of mobs in my mod are visually centered around particles. I really need a way to summon them centered every time, anyone know mcreator mods exist that use the summon particles block, how do they get them centered??
Hey Sephbeck, I solved the issue with the following procedure: https://imgur.com/a/F9Q73ia thanks to @SomeoneElse's comment.
At a positive x or z block coordinates == player coordinates, however at a negative x or z block coordinates == player coordinates +1. Using the procedure:
Then simply use varX and varZ whenever you want to get the player coordinates.
Thank you for this! You kinda saved my mod, but it'll be a pain to replace all my particle blocks with this, but thanks again!