Skip to content

Commit c621e93

Browse files
committed
Merge branch 'master' of https://github.com/GeyserMC/Geyser
2 parents 835ba9e + 130b272 commit c621e93

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/src/main/java/org/geysermc/geyser/translator/protocol/java/level/JavaLevelParticlesTranslator.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060

6161
@Translator(packet = ClientboundLevelParticlesPacket.class)
6262
public class JavaLevelParticlesTranslator extends PacketTranslator<ClientboundLevelParticlesPacket> {
63+
private static final int MAX_PARTICLES = 100;
6364

6465
@Override
6566
public void translate(GeyserSession session, ClientboundLevelParticlesPacket packet) {
@@ -71,7 +72,8 @@ public void translate(GeyserSession session, ClientboundLevelParticlesPacket pac
7172
session.sendUpstreamPacket(particleCreateFunction.apply(position));
7273
} else {
7374
Random random = ThreadLocalRandom.current();
74-
for (int i = 0; i < packet.getAmount(); i++) {
75+
int amount = Math.min(MAX_PARTICLES, packet.getAmount());
76+
for (int i = 0; i < amount; i++) {
7577
double offsetX = random.nextGaussian() * (double) packet.getOffsetX();
7678
double offsetY = random.nextGaussian() * (double) packet.getOffsetY();
7779
double offsetZ = random.nextGaussian() * (double) packet.getOffsetZ();
@@ -213,4 +215,4 @@ private static NbtMap buildVec3PositionTag(Vector3f position) {
213215
.putFloat("z", position.getZ())
214216
.build();
215217
}
216-
}
218+
}

0 commit comments

Comments
 (0)