Skip to content

Commit

Permalink
Cleanup sending ServerboundChunkBatchReceivedPacket
Browse files Browse the repository at this point in the history
  • Loading branch information
Konicai committed Sep 18, 2023
1 parent 35f57c2 commit 6247a5b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundDelimiterPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundTabListPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundChunkBatchStartPacket;
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.level.ClientboundLightUpdatePacket;
import io.netty.channel.EventLoop;
import org.geysermc.geyser.GeyserImpl;
Expand All @@ -43,9 +44,10 @@ public class PacketTranslatorRegistry<T> extends AbstractMappedRegistry<Class<?
private static final Set<Class<?>> IGNORED_PACKETS = Collections.newSetFromMap(new IdentityHashMap<>());

static {
IGNORED_PACKETS.add(ClientboundChunkBatchStartPacket.class); // we don't track chunk batch sizes/periods
IGNORED_PACKETS.add(ClientboundDelimiterPacket.class); // Not implemented, spams logs
IGNORED_PACKETS.add(ClientboundLightUpdatePacket.class); // Light is handled on Bedrock for us
IGNORED_PACKETS.add(ClientboundTabListPacket.class); // Cant be implemented in Bedrock
IGNORED_PACKETS.add(ClientboundDelimiterPacket.class); // Not implemented, spams logs
}

protected PacketTranslatorRegistry() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public class JavaChunkBatchFinishedTranslator extends PacketTranslator<Clientbou
@Override
public void translate(GeyserSession session, ClientboundChunkBatchFinishedPacket packet) {
// server just sent a batch of LevelChunkWithLightPackets
// todo 1.20.2 maybe use ChunkBatchSizeCalculator
session.sendDownstreamPacket(new ServerboundChunkBatchReceivedPacket(10));
// the vanilla client uses a ChunkBatchSizeCalculator to calculate the desiredChunksPerTick,
// but currently we just send an arbitrary value. server clamps the value between 0.01 and 64.
session.sendDownstreamPacket(new ServerboundChunkBatchReceivedPacket(20));
}
}

This file was deleted.

0 comments on commit 6247a5b

Please sign in to comment.