hmzel / ParticleSFX

A Spigot library for making special effects out of particles
https://github.com/hmzel
37 stars 4 forks source link

Cannot add Locations of differing worlds #5

Open stitchinger opened 2 months ago

stitchinger commented 2 months ago

Trying to get the spiral working with this code:

            hm.zelha.particlesfx.particles.parents.Particle cherry = new ParticleCherryLeaves(0, 0, 0, 2);
            World world = player.getWorld();
            Location loc = player.getLocation();
            LocationSafe locationSafe = new LocationSafe(world, loc.getX(), loc.getY(),loc.getZ());
            CircleInfo circle1 = new CircleInfo(locationSafe,1);
            LocationSafe locationSafe2 = new LocationSafe(world, loc.getX(), loc.getY() + 2,loc.getZ());
            CircleInfo circle2 = new CircleInfo(locationSafe2,2);

            ParticleSpiral spiral = new ParticleSpiral(cherry, 2, 10, circle1, circle2);
            spiral.display();

and getting this error. Do I use it wrong?

Caused by: java.lang.IllegalArgumentException: Cannot add Locations of differing worlds
    at org.bukkit.Location.add(Location.java:360) ~[paper-api-1.21-R0.1-SNAPSHOT.jar:?]
    at Particle-API_1.21.jar/hm.zelha.particlesfx.shapers.parents.RotationHandler.calculateCentroid(RotationHandler.java:192) ~[Particle-API_1.21.jar:?]
    at Particle-API_1.21.jar/hm.zelha.particlesfx.shapers.parents.RotationHandler.recalculateIfNeeded(RotationHandler.java:143) ~[Particle-API_1.21.jar:?]
    at Particle-API_1.21.jar/hm.zelha.particlesfx.shapers.ParticleSpiral.recalculateIfNeeded(ParticleSpiral.java:194) ~[Particle-API_1.21.jar:?]
    at Particle-API_1.21.jar/hm.zelha.particlesfx.shapers.ParticleSpiral.setWorld(ParticleSpiral.java:227) ~[Particle-API_1.21.jar:?]
    at Particle-API_1.21.jar/hm.zelha.particlesfx.shapers.ParticleSpiral.<init>(ParticleSpiral.java:37) ~[Particle-API_1.21.jar:?]
    at Particle-API_1.21.jar/hm.zelha.particlesfx.shapers.ParticleSpiral.<init>(ParticleSpiral.java:42) ~[Particle-API_1.21.jar:?]
    at Particle-API_1.21.jar/io.georgeous.particle_api.PapiCommand.onCommand(PapiCommand.java:106) ~[Particle-API_1.21.jar:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.21-R0.1-SNAPSHOT.jar:?]
    ... 26 more
KazakEz commented 2 months ago

Same exception. Solution: Replace https://github.com/hmzel/ParticleSFX/blob/master/src/main/java/hm/zelha/particlesfx/shapers/parents/RotationHandler.java#L192 to centroid.add(locations.get(i).toVector()); Explanation: this method have checks if world is not similar and all these fields can use only in default world "world" img img

stitchinger commented 2 months ago

Same exception. Solution: Replace https://github.com/hmzel/ParticleSFX/blob/master/src/main/java/hm/zelha/particlesfx/shapers/parents/RotationHandler.java#L192 to centroid.add(locations.get(i).toVector()); Explanation: this method have checks if world is not similar and all these fields can use only in default world "world" img img

Thank you very much. I cloned the repo locally, made the chage you suggested and built the jar. But how do I use it? The minecraft server says it is missing the plugin.yml