Skip to content

Method "setDuration" of AreaEffectCloud don't work with values higher than 2,147,483,627 (not 2,147,483,647) #9886

@buuugle

Description

@buuugle

Expected behavior

In Vanilla, we can set the Duration of an area effect cloud to the integer max value (2,147,483,647) using the following comand :

summon area_effect_cloud ~ ~ ~ {Duration:2147483647}

This allow the area effect cloud to exists for 3.4 years, wich is "forever" in most uses. So, with Paper, the following code should be equivalent to the command :

world.spawnEntity(
    location,
    EntityType.AREA_EFFECT_CLOUD,
    CreatureSpawnEvent.SpawnReason.CUSTOM,
    entity -> {
        AreaEffectCloud cloud = (AreaEffectCloud) entity;
        cloud.setDuration(Integer.MAX_VALUE);  // Set the Duration to 2147483647
        cloud.setRadius(0.0f);  // Minimise the hitbox
        cloud.setParticle(Particle.BLOCK_CRACK, Material.AIR.createBlockData());  // Disable particles
    }
);

Observed/Actual behavior

When I execute the code, the area effect cloud disappears instantly. I tried with lower values, and it worked: the area effect cloud was "eternal". After trying different values, I discovered that the highest possible value is 2,147,483,627. This is 20 less than the integer max value. So, in the game, this makes the area effect cloud disappear 20 ticks earlier than it should.
In conclusion, it isn't a big issue as nobody will complain about the area effect cloud disappearing one second earlier, but it can be confusing for the people trying to set the duration to the integer max value.

Steps/models to reproduce

Run the above code.

Plugin and Datapack List

Only my plugin with the above code.

Paper version

Paper 1.20.1 build 196

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    resolution: invalidIssue or Request has no basis.type: bugSomething doesn't work as it was intended to.

    Type

    No fields configured for Bug.

    Projects

    Status

    Invalid

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions