@@ -11,15 +11,12 @@ public class ClientWorld extends World {
1111 private float fractionalTickCounter = 0 ;
1212
1313 private ChunkManager chunkManager ;
14-
15- // Warteschlange für Datenpakete vom Server
14+
1615 private final ConcurrentLinkedQueue <ChunkDataPacket > incomingPackets =
1716 new ConcurrentLinkedQueue <>();
1817
19- // Container für die Netzwerk-Daten
2018 private record ChunkDataPacket (int cx , int cz , short [] blocks ) {}
2119
22- /** Wird vom Netzwerk-Thread aufgerufen, wenn ein Chunk-Paket ankommt. */
2320 public void applyChunkData (int cx , int cz , short [] blocks ) {
2421 incomingPackets .offer (new ChunkDataPacket (cx , cz , blocks ));
2522 }
@@ -34,13 +31,10 @@ public void processIncomingPackets(long budgetInNanos) {
3431 if (packet == null ) continue ;
3532
3633 Chunk chunk = chunkManager .getOrCreateChunk (packet .cx , packet .cz );
37-
38- // Referenz-Zuweisung statt Kopie (Extrem schnell!)
3934 chunk .setBlockData (packet .blocks );
40-
4135 chunk .setDataReady ();
4236 chunk .markDirty ();
43- addChunk (chunk ); // Wichtig für Raycasts/Interaktion!
37+ addChunk (chunk );
4438
4539 chunkManager .notifyNeighborsOfDataReady (packet .cx , packet .cz );
4640 }
@@ -56,22 +50,12 @@ public void setChunkManager(ChunkManager chunkManager) {
5650 }
5751
5852 public void update (float tpf ) {
59- // Wir addieren den Fortschritt auf einen float-Counter
6053 fractionalTickCounter += tpf * TICKS_PER_SECOND ;
6154
62- // Sobald der Counter >= 1 ist, schieben wir die vollen Ticks in worldTime
6355 if (fractionalTickCounter >= 1.0f ) {
6456 int fullTicks = (int ) fractionalTickCounter ;
65- // worldTime += fullTicks;
6657 tick ();
6758 fractionalTickCounter -= fullTicks ;
6859 }
6960 }
70-
71- // @Override
72- // public float getTimeOfDay() {
73- // // worldTime (ganze Ticks) + fractionalTickCounter (Nachkommastellen)
74- // float preciseTime = worldTime + fractionalTickCounter;
75- // return (preciseTime % WorldTime.DAY_LENGTH) / (float) WorldTime.DAY_LENGTH;
76- // }
7761}
0 commit comments