2424import net .minecraft .core .Holder ;
2525import net .minecraft .core .IdMap ;
2626import net .minecraft .core .Registry ;
27+ import net .minecraft .network .protocol .game .ClientboundForgetLevelChunkPacket ;
2728import net .minecraft .network .protocol .game .ClientboundLevelChunkWithLightPacket ;
2829import net .minecraft .server .MinecraftServer ;
2930import net .minecraft .server .level .ChunkHolder ;
@@ -335,7 +336,6 @@ public static void sendChunk(IntPair pair, ServerLevel nmsWorld, int chunkX, int
335336 if (chunkHolder == null ) {
336337 return ;
337338 }
338- ChunkPos coordIntPair = new ChunkPos (chunkX , chunkZ );
339339 LevelChunk levelChunk ;
340340 if (PaperLib .isPaper ()) {
341341 // getChunkAtIfLoadedImmediately is paper only
@@ -353,6 +353,10 @@ public static void sendChunk(IntPair pair, ServerLevel nmsWorld, int chunkX, int
353353 }
354354 MinecraftServer .getServer ().execute (() -> {
355355 try {
356+ ChunkPos pos = levelChunk .getPos ();
357+ // NOTE: the ClientboundForgetLevelChunkPacket packet is required on 1.21.3
358+ // as the client won't update empty -> non-empty sections properly otherwise
359+ ClientboundForgetLevelChunkPacket forget = new ClientboundForgetLevelChunkPacket (pos );
356360 ClientboundLevelChunkWithLightPacket packet ;
357361 if (PaperLib .isPaper ()) {
358362 packet = new ClientboundLevelChunkWithLightPacket (
@@ -371,7 +375,10 @@ public static void sendChunk(IntPair pair, ServerLevel nmsWorld, int chunkX, int
371375 null
372376 );
373377 }
374- nearbyPlayers (nmsWorld , coordIntPair ).forEach (p -> p .connection .send (packet ));
378+ nearbyPlayers (nmsWorld , pos ).forEach (p -> {
379+ p .connection .send (forget );
380+ p .connection .send (packet );
381+ });
375382 } finally {
376383 NMSAdapter .endChunkPacketSend (nmsWorld .getWorld ().getName (), pair , lockHolder );
377384 }
0 commit comments