[SPIGOT-8008] Force value in spawnParticle Method not working Created: 10/Feb/25  Updated: 10/Feb/25  Resolved: 10/Feb/25

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Alphaton Assignee: Doc
Resolution: Fixed Votes: 0
Labels: 1.21.4, Particle, Spigot

Attachments: File Bug Test.mp4     File BugTest.jar    
Version: CraftBukkit version 4435-Spigot-d421948-c175d4f (MC: 1.21.4) (Implementing API version 1.21.4-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

Particles spawned with the World.spawnParticle method are created with force set to false regardless of the value of the parameter of the method.

This means, that all particles created using the spigot API are not visible to players when they are >= 32 blocks away from the particle.

 

Example to reproduce:

The following continuously spawns a particle at the location of arrows fired by the player:

 

new BukkitRunnable() {
    @Override
    public void run() {

        for (Entity entity : Bukkit.getWorlds().get(0).getEntities()) {
            if (!(entity instanceof AbstractArrow arrow)) continue;
            if (!(arrow.getShooter() instanceof Player)) continue;
            if (arrow.isInBlock()) continue;

            entity.getWorld().spawnParticle(Particle.EXPLOSION, entity.getLocation(), 1, 0, 0, 0, 0, null, true);
        }

    }
}.runTaskTimer(this, 0, 1); 

Expected Behavior:
The "force" parameter is set to true, so the particle should be visible beyond 32 blocks.

Actual Behavior:
Particles disappear after approximately 32 blocks, indicating the force parameter is ignored

Additional Evidence:
Using ProtocolLib, I intercepted the Particle Packet sent to the client and confirmed that the "force" value is always set to false, even when explicitly set to true in the spawnParticle method.
The attached video demonstrates how the particles stop appearing at a certain distance.

The attached Jar is a simple reproduction plugin. Simply shoot an arrow using a bow. The particles should stop spawning after around 32 blocks. If ProtocolLib is also installed, some debug information about the particle creation will be printed in the in-game chat.



 Comments   
Comment by Doc [ 10/Feb/25 ]

PR created for fix that: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/1535/overview

Generated at Sun Mar 30 02:41:50 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.