Skip to content

Commit

Permalink
refactor: optimize AllayCHunk#tick()
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcmd committed Sep 15, 2024
1 parent 3e0d917 commit 6d9ef9b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,12 @@ public void onDisconnect(EntityPlayer player) {

if (player.isLoggedIn()) {
broadcastTr(TextFormat.YELLOW + "%" + TrKeys.M_MULTIPLAYER_PLAYER_LEFT, player.getOriginName());
playerStorage.savePlayerData(player);
players.remove(player.getUUID());
}

if (player.isSpawned()) {
player.getDimension().removePlayer(player);
playerStorage.savePlayerData(player);

var pk = new PlayerListPacket();
pk.setAction(PlayerListPacket.Action.REMOVE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,8 @@ private static void checkXYZ(int x, int y, int z) {
}

public void tick(long currentTick) {
if (!getBlockEntities().isEmpty()) {
getBlockEntities().values().forEach(blockEntity -> blockEntity.tick(currentTick));
}
if (!getEntities().isEmpty()) {
getEntities().values().forEach(entity -> entity.tick(currentTick));
}
getBlockEntities().values().forEach(blockEntity -> blockEntity.tick(currentTick));
getEntities().values().forEach(entity -> entity.tick(currentTick));
}

@Override
Expand Down

0 comments on commit 6d9ef9b

Please sign in to comment.