mojira.dev
MC-183528

Big count in /particle command makes client freeze or crash

The bug

When putting a huge amount of particle using the command /particle, the client freeze.

How to reproduce?

On singleplayer or multiplayer, type this command :

/particle minecraft:cloud ~ ~ ~ 0 0 0 1 10000000 force

On multiplayer, the server will continue to run normally. Only the clients that have to display the particles are freezing.

Possible fixes

Command argument

The argument <count> of the command /particle should have a maximum value:

IntegerArgumentType.integer(0, 16384)

Protocol

The Particle packet should have the Particle Count field with a type with lower byte count (Short instead of Int)

Client implementation

Something like this could be implement when receiving the Particle packet, before rendering:

count = Math.min(count, MAX_PARTICLE)

MAX_PARTICLE being the maximum number of particle being displayed simultaneously on the client (currently around 16000)

Linked issues

Comments 10

This isn't really fixable. If you ask the client to render a massive number of complex moving particles, it's pretty much inevitable that you will start to run out memory and computing power.

The client could do simple thing like Math.min(count, 16384) before starting to render the particles.

And how would you determine what value can be chosen for which setup? A value that works for a high- or mid-end setup can still make a toaster freeze.

Actually the number of particle is already limited to a fixed value, client side. This is visible in F3 when you summon a lot of particle (spamming fireworks or command), this is always limited to a little more than 16000 (16384 in my previous comment was a guess)

This is a feature request

I don’t agree with this.

The Minecraft client already apply a limit to the number of particle simultaneously rendered on the screen. This limit is around 16k and you can notice it in F3 when you spawn a fairly high number of particle using a /particle command or using fireworks. I didn’t find any configuration in the client interface to change that limit.
The existence of this limit implies that the calculation made by the client when trying to render 10M particles is mostly useless, even on a very powerful machine, and the resulting freeze could be avoided by the suggestions I made in the bug description.

The fix I suggest here won’t technically add any "feature" except "avoiding a freeze of the client", that is what I call a bug fix.

I am reopening this ticket for Mojang to decide, since this causes the game to freeze and as such could be a valid issue.

Can someone confirm the particle limit rendered by the client is indeed 16k? And if its, could you please provide the precise value.

i find this more of a significant issue in the context of being applied to create targeted crashes on certain clients only by using a selector at the end of the /particle command

Marc Baloup

(Unassigned)

Confirmed

Platform

Normal

Particles, Performance

1.15.2, 20w19a, 23w43b, 1.20.4, 24w13a, 24w14a, 1.21.8, 25w36b

Retrieved