How to Center Particles?

Started by sephbeck1 on

Topic category: Help with Minecraft modding (Java Edition)

Joined May 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to Center Particles?
Tue, 09/24/2019 - 06:21 (edited)

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?

Edited by sephbeck1 on Tue, 09/24/2019 - 06:21
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I tried it too with spawning…
Tue, 09/24/2019 - 10:10

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?

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Incredible how you found…
Fri, 09/27/2019 - 11:46

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?

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It's clearly not a particle…
Fri, 09/27/2019 - 11:54

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.

Joined Nov 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Converting players' xz…
Fri, 09/27/2019 - 12:42

Converting players' xz coordinates to blockpos coordinates doesn't work properly at negative x or z. 

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So it has to do with which…
Fri, 09/27/2019 - 16:54

So it has to do with which position you are in inside of the world?

Joined May 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So for anyone still…
Sun, 09/29/2019 - 05:05

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

Joined May 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Nevermind, ran into the…
Mon, 09/30/2019 - 01:43

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??

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hey Sephbeck, I solved the…
Mon, 09/30/2019 - 07:15

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:

if x < 0

set varX to x - 1

else

set varX to x

if z < 0

set varZ to Z - 1

else

set varZ to Z

Then simply use varX and varZ whenever you want to get the player coordinates.

 

Joined May 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you for this! You…
Wed, 10/02/2019 - 13:22

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!