Skip to content

Commit

Permalink
Prepare chunk packets only for required versions
Browse files Browse the repository at this point in the history
  • Loading branch information
wode490390 committed Aug 12, 2023
1 parent 4f88a0a commit 2596b8a
Show file tree
Hide file tree
Showing 5 changed files with 240 additions and 48 deletions.
9 changes: 9 additions & 0 deletions src/main/java/cn/nukkit/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ public class Player extends EntityHuman implements CommandSender, InventoryHolde
public int pickedXPOrb = 0;

protected int protocol;
@Nullable
protected StaticVersion blockVersion;

protected int formWindowCount = 0;
protected Int2ObjectMap<FormWindow> formWindows = new Int2ObjectOpenHashMap<>();
Expand Down Expand Up @@ -817,6 +819,8 @@ protected boolean switchLevel(Level targetLevel) {
this.unloadChunk(chunkX, chunkZ, oldLevel);
}

targetLevel.onPlayerAdd(this);

this.usedChunks = new Long2BooleanOpenHashMap();

if (this.onLevelSwitch()) {
Expand Down Expand Up @@ -6170,4 +6174,9 @@ protected void sendDeathInfo(TextContainer message) {
*/
public void sendMotionPredictionHints(long entityRuntimeId, Vector3f motion, boolean onGround) {
}

@Nullable
public StaticVersion getBlockVersion() {
return blockVersion;
}
}
Loading

0 comments on commit 2596b8a

Please sign in to comment.