mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 04:17:44 +01:00
Revert "Revert "Remove "Implement-Chunk-Priority-Urgency-System-for-Chunks" (Fixes #5980)""
This reverts commit d2f7432e32
.
This commit is contained in:
parent
d2f7432e32
commit
746d5cb8fb
36
patches/server/ChunkMap.mainInvokingExecutor.patch
Normal file
36
patches/server/ChunkMap.mainInvokingExecutor.patch
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Shane Freeder <theboyetronic@gmail.com>
|
||||||
|
Date: Sat, 14 Aug 2021 14:49:45 +0100
|
||||||
|
Subject: [PATCH] ChunkMap.mainInvokingExecutor
|
||||||
|
|
||||||
|
This is a temp patch, this should maybe be moved to a more generic map or potentially wrapped into mcutil for the sake of this being such a generic concept
|
||||||
|
anyways
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||||
|
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
|
public final ServerLevel level;
|
||||||
|
private final ThreadedLevelLightEngine lightEngine;
|
||||||
|
private final BlockableEventLoop<Runnable> mainThreadExecutor;
|
||||||
|
+ final java.util.concurrent.Executor mainInvokingExecutor; // Paper // Paper - Move to MCUtil?
|
||||||
|
public final ChunkGenerator generator;
|
||||||
|
public final Supplier<DimensionDataStorage> overworldDataStorage;
|
||||||
|
private final PoiManager poiManager;
|
||||||
|
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||||
|
this.level = world;
|
||||||
|
this.generator = chunkGenerator;
|
||||||
|
this.mainThreadExecutor = mainThreadExecutor;
|
||||||
|
+ // Paper start
|
||||||
|
+ this.mainInvokingExecutor = (run) -> {
|
||||||
|
+ if (MCUtil.isMainThread()) {
|
||||||
|
+ run.run();
|
||||||
|
+ } else {
|
||||||
|
+ mainThreadExecutor.execute(run);
|
||||||
|
+ }
|
||||||
|
+ };
|
||||||
|
+ // Paper end
|
||||||
|
ProcessorMailbox<Runnable> threadedmailbox = ProcessorMailbox.create(executor, "worldgen");
|
||||||
|
|
||||||
|
Objects.requireNonNull(mainThreadExecutor);
|
@ -27,9 +27,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.awaitingTeleportTime = this.tickCount;
|
this.awaitingTeleportTime = this.tickCount;
|
||||||
- this.player.absMoveTo(d0, d1, d2, f, f1);
|
- this.player.absMoveTo(d0, d1, d2, f, f1);
|
||||||
+ this.player.moveTo(d0, d1, d2, f, f1); // Paper - use proper setPositionRotation for teleportation
|
+ this.player.moveTo(d0, d1, d2, f, f1); // Paper - use proper setPositionRotation for teleportation
|
||||||
this.player.forceCheckHighPriority(); // Paper
|
|
||||||
this.player.connection.send(new ClientboundPlayerPositionPacket(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport, flag));
|
this.player.connection.send(new ClientboundPlayerPositionPacket(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport, flag));
|
||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -49,6 +49,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ ChunkAccess chunk = getAvailableChunkNow();
|
+ ChunkAccess chunk = getAvailableChunkNow();
|
||||||
+ return chunk != null && (status == null || chunk.getStatus().isOrAfter(getNextStatus(status)));
|
+ return chunk != null && (status == null || chunk.getStatus().isOrAfter(getNextStatus(status)));
|
||||||
+ }
|
+ }
|
||||||
|
+ // Yanked from chunk priotisation patch - remove?
|
||||||
|
+ public static ChunkStatus getNextStatus(ChunkStatus status) {
|
||||||
|
+ if (status == ChunkStatus.FULL) {
|
||||||
|
+ return status;
|
||||||
|
+ }
|
||||||
|
+ return CHUNK_STATUSES.get(status.getIndex() + 1);
|
||||||
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
|
||||||
public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) {
|
public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) {
|
||||||
|
@ -29,13 +29,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||||
@@ -0,0 +0,0 @@ public class ChunkHolder {
|
@@ -0,0 +0,0 @@ public class ChunkHolder {
|
||||||
ioPriority = com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGH_PRIORITY;
|
|
||||||
}
|
this.onLevelChange.onLevelChange(this.pos, this::getQueueLevel, this.ticketLevel, this::setQueueLevel);
|
||||||
chunkMap.level.asyncChunkTaskManager.raisePriority(pos.x, pos.z, ioPriority);
|
this.oldTicketLevel = this.ticketLevel;
|
||||||
+ chunkMap.level.getChunkSource().getLightEngine().queue.changePriority(pos.toLong(), this.queueLevel, priority); // Paper
|
+ //chunkMap.level.getChunkSource().getLightEngine().queue.changePriority(pos.toLong(), this.queueLevel, priority); // Paper // Restore this in chunk priority later?
|
||||||
}
|
// CraftBukkit start
|
||||||
if (this.queueLevel != priority) {
|
// ChunkLoadEvent: Called after the chunk is loaded: isChunkLoaded returns true and chunk is ready to be modified by plugins.
|
||||||
this.onLevelChange.onLevelChange(this.pos, () -> this.queueLevel, priority, p -> this.queueLevel = p); // use preferred priority
|
if (!playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && playerchunk_state1.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) {
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||||
|
Loading…
Reference in New Issue
Block a user