more compile fixes

This commit is contained in:
Jake Potrebic
2023-06-08 13:56:13 -07:00
parent 180fe2a014
commit 957d248aff
24 changed files with 101 additions and 74 deletions

View File

@@ -10939,6 +10939,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import it.unimi.dsi.fastutil.objects.ReferenceLinkedOpenHashSet;
+import net.minecraft.nbt.CompoundTag;
+import net.minecraft.server.level.ChunkHolder;
+import net.minecraft.server.level.ChunkLevel;
+import net.minecraft.server.level.ChunkMap;
+import net.minecraft.server.level.FullChunkStatus;
+import net.minecraft.server.level.ServerLevel;
@@ -11520,8 +11521,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ // ticket level state
+ private int oldTicketLevel = ChunkMap.MAX_CHUNK_DISTANCE + 1;
+ private int currentTicketLevel = ChunkMap.MAX_CHUNK_DISTANCE + 1;
+ private int oldTicketLevel = ChunkLevel.MAX_LEVEL + 1;
+ private int currentTicketLevel = ChunkLevel.MAX_LEVEL + 1;
+
+ public int getTicketLevel() {
+ return this.currentTicketLevel;
@@ -11605,7 +11606,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+
+ // chunk must be marked inaccessible (i.e unloaded to plugins)
+ if (this.getChunkStatus() != ChunkHolder.FullChunkStatus.INACCESSIBLE) {
+ if (this.getChunkStatus() != FullChunkStatus.INACCESSIBLE) {
+ return "fullchunkstatus";
+ }
+
@@ -11844,8 +11845,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ this.oldTicketLevel = newLevel;
+
+ final ChunkHolder.FullChunkStatus oldState = ChunkHolder.getFullChunkStatus(oldLevel);
+ final ChunkHolder.FullChunkStatus newState = ChunkHolder.getFullChunkStatus(newLevel);
+ final FullChunkStatus oldState = ChunkHolder.getFullChunkStatus(oldLevel);
+ final FullChunkStatus newState = ChunkHolder.getFullChunkStatus(newLevel);
+ final boolean oldUnloaded = oldLevel > ChunkHolderManager.MAX_TICKET_LEVEL;
+ final boolean newUnloaded = newLevel > ChunkHolderManager.MAX_TICKET_LEVEL;
+
@@ -11853,7 +11854,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ final ChunkStatus maxGenerationStatusNew = ChunkHolder.getStatus(newLevel);
+
+ // check for cancellations from downgrading ticket level
+ if (this.requestedGenStatus != null && !newState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && newLevel > oldLevel) {
+ if (this.requestedGenStatus != null && !newState.isOrAfter(FullChunkStatus.FULL) && newLevel > oldLevel) {
+ // note: cancel() may invoke onChunkGenComplete synchronously here
+ if (newUnloaded) {
+ // need to cancel all tasks
@@ -11888,7 +11889,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (newState != oldState) {
+ if (newState.isOrAfter(oldState)) {
+ // status upgrade
+ if (!oldState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && newState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) {
+ if (!oldState.isOrAfter(FullChunkStatus.FULL) && newState.isOrAfter(FullChunkStatus.FULL)) {
+ // may need to schedule full load
+ if (this.currentGenStatus != ChunkStatus.FULL) {
+ if (this.requestedGenStatus != null) {
@@ -11905,16 +11906,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ } else {
+ // status downgrade
+ if (!newState.isOrAfter(ChunkHolder.FullChunkStatus.ENTITY_TICKING) && oldState.isOrAfter(ChunkHolder.FullChunkStatus.ENTITY_TICKING)) {
+ this.completeFullStatusConsumers(ChunkHolder.FullChunkStatus.ENTITY_TICKING, null);
+ if (!newState.isOrAfter(FullChunkStatus.ENTITY_TICKING) && oldState.isOrAfter(FullChunkStatus.ENTITY_TICKING)) {
+ this.completeFullStatusConsumers(FullChunkStatus.ENTITY_TICKING, null);
+ }
+
+ if (!newState.isOrAfter(ChunkHolder.FullChunkStatus.TICKING) && oldState.isOrAfter(ChunkHolder.FullChunkStatus.TICKING)) {
+ this.completeFullStatusConsumers(ChunkHolder.FullChunkStatus.TICKING, null);
+ if (!newState.isOrAfter(FullChunkStatus.BLOCK_TICKING) && oldState.isOrAfter(FullChunkStatus.BLOCK_TICKING)) {
+ this.completeFullStatusConsumers(FullChunkStatus.BLOCK_TICKING, null);
+ }
+
+ if (!newState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && oldState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) {
+ this.completeFullStatusConsumers(ChunkHolder.FullChunkStatus.BORDER, null);
+ if (!newState.isOrAfter(FullChunkStatus.FULL) && oldState.isOrAfter(FullChunkStatus.FULL)) {
+ this.completeFullStatusConsumers(FullChunkStatus.FULL, null);
+ }
+ }
+ }
@@ -13942,6 +13943,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import io.papermc.paper.util.MCUtil;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.ChunkHolder;
+import net.minecraft.server.level.FullChunkStatus;
+import net.minecraft.server.level.ServerLevel;
+import net.minecraft.world.level.chunk.ChunkAccess;
+import net.minecraft.world.level.chunk.ImposterProtoChunk;
@@ -14031,8 +14033,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ int total = 0;
+ int inactive = 0;
+ int border = 0;
+ int ticking = 0;
+ int full = 0;
+ int blockTicking = 0;
+ int entityTicking = 0;
+
+ for (final ChunkHolder chunk : io.papermc.paper.chunk.system.ChunkSystem.getVisibleChunkHolders(world)) {
@@ -14042,29 +14044,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+ ++total;
+
+ ChunkHolder.FullChunkStatus state = chunk.getFullStatus();
+ FullChunkStatus state = chunk.getFullStatus();
+
+ switch (state) {
+ case INACCESSIBLE -> ++inactive;
+ case BORDER -> ++border;
+ case TICKING -> ++ticking;
+ case FULL -> ++full;
+ case BLOCK_TICKING -> ++blockTicking;
+ case ENTITY_TICKING -> ++entityTicking;
+ }
+ }
+
+ accumulatedTotal += total;
+ accumulatedInactive += inactive;
+ accumulatedBorder += border;
+ accumulatedTicking += ticking;
+ accumulatedBorder += full;
+ accumulatedTicking += blockTicking;
+ accumulatedEntityTicking += entityTicking;
+
+ sender.sendMessage(text().append(text("Chunks in ", BLUE), text(bukkitWorld.getName(), GREEN), text(":")));
+ sender.sendMessage(text().color(DARK_AQUA).append(
+ text("Total: ", BLUE), text(total),
+ text(" Inactive: ", BLUE), text(inactive),
+ text(" Border: ", BLUE), text(border),
+ text(" Ticking: ", BLUE), text(ticking),
+ text(" Entity: ", BLUE), text(entityTicking)
+ text(" Full: ", BLUE), text(full),
+ text(" Block Ticking: ", BLUE), text(blockTicking),
+ text(" Entity Ticking: ", BLUE), text(entityTicking)
+ ));
+ }
+ if (worlds.size() > 1) {
@@ -14072,9 +14074,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ sender.sendMessage(text().color(DARK_AQUA).append(
+ text("Total: ", BLUE), text(accumulatedTotal),
+ text(" Inactive: ", BLUE), text(accumulatedInactive),
+ text(" Border: ", BLUE), text(accumulatedBorder),
+ text(" Ticking: ", BLUE), text(accumulatedTicking),
+ text(" Entity: ", BLUE), text(accumulatedEntityTicking)
+ text(" Full: ", BLUE), text(accumulatedBorder),
+ text(" Block Ticking: ", BLUE), text(accumulatedTicking),
+ text(" Entity Ticking: ", BLUE), text(accumulatedEntityTicking)
+ ));
+ }
+ }
@@ -14387,7 +14389,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ JsonObject playerData = new JsonObject();
+ players.add(playerData);
+
+ Level playerWorld = player.getLevel();
+ Level playerWorld = player.level();
+ org.bukkit.World craftWorld = playerWorld.getWorld();
+ Entity.RemovalReason removalReason = player.getRemovalReason();
+