geforkt von Mirrors/Paper
More more more more more more more more more more more more more more work
Dieser Commit ist enthalten in:
Ursprung
45c36e5d0c
Commit
97a4a70766
@ -5,10 +5,10 @@ Subject: [PATCH] Add #setMaxPlayers API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 51eb99fd09ab546ebdf0c5ab5a76492a31a93139..9a1da52ce6d255715e1f765f491a9e20e47da400 100644
|
||||
index 338f0938fbae7eec6cecaf3f1cd30d3e27ad40d6..899a9dbd277b755195a67b6a0c56ac266a52e4c8 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -172,6 +172,17 @@ public final class Bukkit {
|
||||
@@ -186,6 +186,17 @@ public final class Bukkit {
|
||||
return server.getMaxPlayers();
|
||||
}
|
||||
|
||||
@ -27,10 +27,10 @@ index 51eb99fd09ab546ebdf0c5ab5a76492a31a93139..9a1da52ce6d255715e1f765f491a9e20
|
||||
* Get the game port that the server runs on.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 849384a6fc7380c5344430beb08210c102c39407..8a10350c4ed5e8f3de5a1cd7fb5064b01d7dd7c2 100644
|
||||
index 5a98eaeafafc11a7f925701187fc96eb5c675efe..ad19ce0418ce3477d21583cb83c9ced639b250ff 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -145,6 +145,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -157,6 +157,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
public int getMaxPlayers();
|
||||
|
@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..df05153397b42930cd53d37b30824c7e
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index bcac107353149d0129571a3548965a407aa7640c..ef960a72bc10d43690c89ff412dc1b3edb7bdd34 100644
|
||||
index ed97f1f2566582df2c1794856caefff5bedb0fb0..9506523227af07667fe2aaa7479f87e4a79b369f 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -68,6 +68,12 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
@ -68,10 +68,10 @@ index 18ae2e2b339d357fbe0f6f2b18bc14c0dfe4c222..3b7ba9c755c82a6f086d5542d32b3567
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
index 1d469a9ea0049687d7686f88382ac14514ad3bee..14d31bc2fb19b1265ee3e72280f2aba22ec0a26d 100644
|
||||
index 2fe519d4059fac06781c30e140895b604e13104f..35949e9c15eb998aa89842d34d0999cd973590e0 100644
|
||||
--- a/src/main/java/net/minecraft/server/MCUtil.java
|
||||
+++ b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
@@ -676,6 +676,7 @@ public final class MCUtil {
|
||||
@@ -675,6 +675,7 @@ public final class MCUtil {
|
||||
chunkData.addProperty("x", playerChunk.pos.x);
|
||||
chunkData.addProperty("z", playerChunk.pos.z);
|
||||
chunkData.addProperty("ticket-level", playerChunk.getTicketLevel());
|
||||
@ -80,10 +80,10 @@ index 1d469a9ea0049687d7686f88382ac14514ad3bee..14d31bc2fb19b1265ee3e72280f2aba2
|
||||
chunkData.addProperty("queued-for-unload", chunkMap.toDrop.contains(playerChunk.pos.longKey));
|
||||
chunkData.addProperty("status", status == null ? "unloaded" : status.toString());
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
index 6923c57173ddb220e1a8af16b116ea5678a773fb..88eb25d4ffc57cfe719a5a0591c9617f78c01ec9 100644
|
||||
index 26a787864058dccc0365680b0259ddf0dad22b58..d03aeed657fc7e427d847e0b8e2d58c59e6851fa 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
|
||||
@@ -60,7 +60,7 @@ public class ChunkHolder {
|
||||
@@ -57,7 +57,7 @@ public class ChunkHolder {
|
||||
private final DebugBuffer<ChunkHolder.ChunkSaveDebug> chunkToSaveHistory;
|
||||
public int oldTicketLevel;
|
||||
private int ticketLevel;
|
||||
@ -92,18 +92,142 @@ index 6923c57173ddb220e1a8af16b116ea5678a773fb..88eb25d4ffc57cfe719a5a0591c9617f
|
||||
public final ChunkPos pos;
|
||||
private boolean hasChangedSections;
|
||||
private final ShortSet[] changedBlocksPerSection;
|
||||
@@ -75,6 +75,7 @@ public class ChunkHolder {
|
||||
@@ -70,6 +70,7 @@ public class ChunkHolder {
|
||||
private boolean resendLight;
|
||||
private CompletableFuture<Void> pendingFullStateConfirmation;
|
||||
|
||||
+ public ServerLevel getWorld() { return chunkMap.level; } // Paper
|
||||
boolean isUpdateQueued = false; // Paper
|
||||
private final ChunkMap chunkMap; // Paper
|
||||
+ public ServerLevel getWorld() { return chunkMap.level; } // Paper
|
||||
// Paper start - no-tick view distance
|
||||
public final LevelChunk getSendingChunk() {
|
||||
// it's important that we use getChunkAtIfLoadedImmediately to mirror the chunk sending logic used
|
||||
@@ -100,6 +101,136 @@ public class ChunkHolder {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@@ -394,12 +395,18 @@ public class ChunkHolder {
|
||||
});
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ private boolean loadCallbackScheduled = false;
|
||||
+ private boolean unloadCallbackScheduled = false;
|
||||
+ // Paper end
|
||||
+
|
||||
private void demoteFullChunk(ChunkMap playerchunkmap, ChunkHolder.FullChunkStatus playerchunk_state) {
|
||||
this.pendingFullStateConfirmation.cancel(false);
|
||||
playerchunkmap.onFullChunkStatusChange(this.pos, playerchunk_state);
|
||||
}
|
||||
|
||||
protected void updateFutures(ChunkMap chunkStorage, Executor executor) {
|
||||
+ io.papermc.paper.util.TickThread.ensureTickThread("Async ticket level update"); // Paper
|
||||
ChunkStatus chunkstatus = ChunkHolder.getStatus(this.oldTicketLevel);
|
||||
ChunkStatus chunkstatus1 = ChunkHolder.getStatus(this.ticketLevel);
|
||||
boolean flag = this.oldTicketLevel <= ChunkMap.MAX_CHUNK_DISTANCE;
|
||||
@@ -410,9 +417,22 @@ public class ChunkHolder {
|
||||
// ChunkUnloadEvent: Called before the chunk is unloaded: isChunkLoaded is still true and chunk can still be modified by plugins.
|
||||
if (playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && !playerchunk_state1.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) {
|
||||
this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> {
|
||||
+ io.papermc.paper.util.TickThread.ensureTickThread("Async full status chunk future completion"); // Paper
|
||||
LevelChunk chunk = (LevelChunk)either.left().orElse(null);
|
||||
- if (chunk != null) {
|
||||
+ if (chunk != null && chunk.wasLoadCallbackInvoked() && ChunkHolder.this.ticketLevel > 33) { // Paper - only invoke unload if load was called
|
||||
+ // Paper start - only schedule once, now the future is no longer completed as RIGHT if unloaded...
|
||||
+ if (ChunkHolder.this.unloadCallbackScheduled) {
|
||||
+ return;
|
||||
+ }
|
||||
+ ChunkHolder.this.unloadCallbackScheduled = true;
|
||||
+ // Paper end - only schedule once, now the future is no longer completed as RIGHT if unloaded...
|
||||
chunkStorage.callbackExecutor.execute(() -> {
|
||||
+ // Paper start - only schedule once, now the future is no longer completed as RIGHT if unloaded...
|
||||
+ ChunkHolder.this.unloadCallbackScheduled = false;
|
||||
+ if (ChunkHolder.this.ticketLevel <= 33) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end - only schedule once, now the future is no longer completed as RIGHT if unloaded...
|
||||
// Minecraft will apply the chunks tick lists to the world once the chunk got loaded, and then store the tick
|
||||
// lists again inside the chunk once the chunk becomes inaccessible and set the chunk's needsSaving flag.
|
||||
// These actions may however happen deferred, so we manually set the needsSaving flag already here.
|
||||
@@ -457,12 +477,14 @@ public class ChunkHolder {
|
||||
this.scheduleFullChunkPromotion(chunkStorage, this.fullChunkFuture, executor, ChunkHolder.FullChunkStatus.BORDER);
|
||||
// Paper start - cache ticking ready status
|
||||
this.fullChunkFuture.thenAccept(either -> {
|
||||
+ io.papermc.paper.util.TickThread.ensureTickThread("Async full chunk future completion"); // Paper
|
||||
final Optional<LevelChunk> left = either.left();
|
||||
if (left.isPresent() && ChunkHolder.this.fullChunkCreateCount == expectCreateCount) {
|
||||
// note: Here is a very good place to add callbacks to logic waiting on this.
|
||||
LevelChunk fullChunk = either.left().get();
|
||||
ChunkHolder.this.isFullChunkReady = true;
|
||||
fullChunk.playerChunk = ChunkHolder.this;
|
||||
+ this.chunkMap.distanceManager.clearPriorityTickets(pos);
|
||||
}
|
||||
});
|
||||
this.updateChunkToSave(this.fullChunkFuture, "full");
|
||||
@@ -483,6 +505,7 @@ public class ChunkHolder {
|
||||
this.scheduleFullChunkPromotion(chunkStorage, this.tickingChunkFuture, executor, ChunkHolder.FullChunkStatus.TICKING);
|
||||
// Paper start - cache ticking ready status
|
||||
this.tickingChunkFuture.thenAccept(either -> {
|
||||
+ io.papermc.paper.util.TickThread.ensureTickThread("Async full chunk future completion"); // Paper
|
||||
either.ifLeft(chunk -> {
|
||||
// note: Here is a very good place to add callbacks to logic waiting on this.
|
||||
ChunkHolder.this.isTickingReady = true;
|
||||
@@ -518,6 +541,7 @@ public class ChunkHolder {
|
||||
this.scheduleFullChunkPromotion(chunkStorage, this.entityTickingChunkFuture, executor, ChunkHolder.FullChunkStatus.ENTITY_TICKING);
|
||||
// Paper start - cache ticking ready status
|
||||
this.entityTickingChunkFuture.thenAccept(either -> {
|
||||
+ io.papermc.paper.util.TickThread.ensureTickThread("Async full chunk future completion"); // Paper
|
||||
either.ifLeft(chunk -> {
|
||||
ChunkHolder.this.isEntityTickingReady = true;
|
||||
// Paper start - entity ticking chunk set
|
||||
@@ -544,16 +568,45 @@ public class ChunkHolder {
|
||||
this.demoteFullChunk(chunkStorage, playerchunk_state1);
|
||||
}
|
||||
|
||||
- this.onLevelChange.onLevelChange(this.pos, this::getQueueLevel, this.ticketLevel, this::setQueueLevel);
|
||||
+ //this.onLevelChange.onLevelChange(this.pos, this::getQueueLevel, this.ticketLevel, this::setQueueLevel);
|
||||
+ // Paper start - raise IO/load priority if priority changes, use our preferred priority
|
||||
+ priorityBoost = chunkMap.distanceManager.getChunkPriority(pos);
|
||||
+ int currRequestedPriority = this.requestedPriority;
|
||||
+ int priority = getDemandedPriority();
|
||||
+ int newRequestedPriority = this.requestedPriority = priority;
|
||||
+ if (this.queueLevel > priority) {
|
||||
+ int ioPriority = com.destroystokyo.paper.io.PrioritizedTaskQueue.NORMAL_PRIORITY;
|
||||
+ if (priority <= 10) {
|
||||
+ ioPriority = com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY;
|
||||
+ } else if (priority <= 20) {
|
||||
+ ioPriority = com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGH_PRIORITY;
|
||||
+ }
|
||||
+ chunkMap.level.asyncChunkTaskManager.raisePriority(pos.x, pos.z, ioPriority);
|
||||
+ chunkMap.level.getChunkSource().getLightEngine().queue.changePriority(pos.toLong(), this.queueLevel, priority); // Paper // Restore this in chunk priority later?
|
||||
+ }
|
||||
+ if (currRequestedPriority != newRequestedPriority) {
|
||||
+ this.onLevelChange.onLevelChange(this.pos, () -> this.queueLevel, priority, p -> this.queueLevel = p); // use preferred priority
|
||||
+ int neighborsPriority = getNeighborsPriority();
|
||||
+ this.neighbors.forEach((neighbor, neighborDesired) -> neighbor.setNeighborPriority(this, neighborsPriority));
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.oldTicketLevel = this.ticketLevel;
|
||||
// CraftBukkit start
|
||||
// ChunkLoadEvent: Called after the chunk is loaded: isChunkLoaded returns true and chunk is ready to be modified by plugins.
|
||||
if (!playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && playerchunk_state1.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) {
|
||||
this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> {
|
||||
+ io.papermc.paper.util.TickThread.ensureTickThread("Async full status chunk future completion"); // Paper
|
||||
LevelChunk chunk = (LevelChunk)either.left().orElse(null);
|
||||
- if (chunk != null) {
|
||||
+ if (chunk != null && ChunkHolder.this.oldTicketLevel <= 33 && !chunk.wasLoadCallbackInvoked()) { // Paper - ensure ticket level is set to loaded before calling, as now this can complete with ticket level > 33
|
||||
+ // Paper start - only schedule once, now the future is no longer completed as RIGHT if unloaded...
|
||||
+ if (ChunkHolder.this.loadCallbackScheduled) {
|
||||
+ return;
|
||||
+ }
|
||||
+ ChunkHolder.this.loadCallbackScheduled = true;
|
||||
+ // Paper end - only schedule once, now the future is no longer completed as RIGHT if unloaded...
|
||||
chunkStorage.callbackExecutor.execute(() -> {
|
||||
- chunk.loadCallback();
|
||||
+ ChunkHolder.this.loadCallbackScheduled = false; // Paper - only schedule once, now the future is no longer completed as RIGHT if unloaded...
|
||||
+ if (ChunkHolder.this.oldTicketLevel <= 33) chunk.loadCallback(); // Paper "
|
||||
});
|
||||
}
|
||||
}).exceptionally((throwable) -> {
|
||||
@@ -643,4 +696,134 @@ public class ChunkHolder {
|
||||
}
|
||||
};
|
||||
}
|
||||
+
|
||||
+ // Paper start - Chunk gen/load priority system
|
||||
+ volatile int neighborPriority = -1;
|
||||
+ volatile int priorityBoost = 0;
|
||||
@ -233,146 +357,20 @@ index 6923c57173ddb220e1a8af16b116ea5678a773fb..88eb25d4ffc57cfe719a5a0591c9617f
|
||||
+ '}';
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
// Paper start - optimise isOutsideOfRange
|
||||
// cached here to avoid a map lookup
|
||||
com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> playersInMobSpawnRange;
|
||||
@@ -470,12 +601,18 @@ public class ChunkHolder {
|
||||
});
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ private boolean loadCallbackScheduled = false;
|
||||
+ private boolean unloadCallbackScheduled = false;
|
||||
+ // Paper end
|
||||
+
|
||||
private void demoteFullChunk(ChunkMap playerchunkmap, ChunkHolder.FullChunkStatus playerchunk_state) {
|
||||
this.pendingFullStateConfirmation.cancel(false);
|
||||
playerchunkmap.onFullChunkStatusChange(this.pos, playerchunk_state);
|
||||
}
|
||||
|
||||
protected void updateFutures(ChunkMap chunkStorage, Executor executor) {
|
||||
+ io.papermc.paper.util.TickThread.ensureTickThread("Async ticket level update"); // Paper
|
||||
ChunkStatus chunkstatus = ChunkHolder.getStatus(this.oldTicketLevel);
|
||||
ChunkStatus chunkstatus1 = ChunkHolder.getStatus(this.ticketLevel);
|
||||
boolean flag = this.oldTicketLevel <= ChunkMap.MAX_CHUNK_DISTANCE;
|
||||
@@ -486,9 +623,22 @@ public class ChunkHolder {
|
||||
// ChunkUnloadEvent: Called before the chunk is unloaded: isChunkLoaded is still true and chunk can still be modified by plugins.
|
||||
if (playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && !playerchunk_state1.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) {
|
||||
this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> {
|
||||
+ io.papermc.paper.util.TickThread.ensureTickThread("Async full status chunk future completion"); // Paper
|
||||
LevelChunk chunk = (LevelChunk)either.left().orElse(null);
|
||||
- if (chunk != null) {
|
||||
+ if (chunk != null && chunk.wasLoadCallbackInvoked() && ChunkHolder.this.ticketLevel > 33) { // Paper - only invoke unload if load was called
|
||||
+ // Paper start - only schedule once, now the future is no longer completed as RIGHT if unloaded...
|
||||
+ if (ChunkHolder.this.unloadCallbackScheduled) {
|
||||
+ return;
|
||||
+ }
|
||||
+ ChunkHolder.this.unloadCallbackScheduled = true;
|
||||
+ // Paper end - only schedule once, now the future is no longer completed as RIGHT if unloaded...
|
||||
chunkStorage.callbackExecutor.execute(() -> {
|
||||
+ // Paper start - only schedule once, now the future is no longer completed as RIGHT if unloaded...
|
||||
+ ChunkHolder.this.unloadCallbackScheduled = false;
|
||||
+ if (ChunkHolder.this.ticketLevel <= 33) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end - only schedule once, now the future is no longer completed as RIGHT if unloaded...
|
||||
// Minecraft will apply the chunks tick lists to the world once the chunk got loaded, and then store the tick
|
||||
// lists again inside the chunk once the chunk becomes inaccessible and set the chunk's needsSaving flag.
|
||||
// These actions may however happen deferred, so we manually set the needsSaving flag already here.
|
||||
@@ -545,12 +695,14 @@ public class ChunkHolder {
|
||||
this.scheduleFullChunkPromotion(chunkStorage, this.fullChunkFuture, executor, ChunkHolder.FullChunkStatus.BORDER);
|
||||
// Paper start - cache ticking ready status
|
||||
this.fullChunkFuture.thenAccept(either -> {
|
||||
+ io.papermc.paper.util.TickThread.ensureTickThread("Async full chunk future completion"); // Paper
|
||||
final Optional<LevelChunk> left = either.left();
|
||||
if (left.isPresent() && ChunkHolder.this.fullChunkCreateCount == expectCreateCount) {
|
||||
// note: Here is a very good place to add callbacks to logic waiting on this.
|
||||
LevelChunk fullChunk = either.left().get();
|
||||
ChunkHolder.this.isFullChunkReady = true;
|
||||
fullChunk.playerChunk = ChunkHolder.this;
|
||||
+ this.chunkMap.distanceManager.clearPriorityTickets(pos);
|
||||
}
|
||||
});
|
||||
this.updateChunkToSave(this.fullChunkFuture, "full");
|
||||
@@ -575,6 +727,7 @@ public class ChunkHolder {
|
||||
this.scheduleFullChunkPromotion(chunkStorage, this.tickingChunkFuture, executor, ChunkHolder.FullChunkStatus.TICKING);
|
||||
// Paper start - cache ticking ready status
|
||||
this.tickingChunkFuture.thenAccept(either -> {
|
||||
+ io.papermc.paper.util.TickThread.ensureTickThread("Async full chunk future completion"); // Paper
|
||||
either.ifLeft(chunk -> {
|
||||
// note: Here is a very good place to add callbacks to logic waiting on this.
|
||||
ChunkHolder.this.isTickingReady = true;
|
||||
@@ -615,6 +768,7 @@ public class ChunkHolder {
|
||||
this.scheduleFullChunkPromotion(chunkStorage, this.entityTickingChunkFuture, executor, ChunkHolder.FullChunkStatus.ENTITY_TICKING);
|
||||
// Paper start - cache ticking ready status
|
||||
this.entityTickingChunkFuture.thenAccept(either -> {
|
||||
+ io.papermc.paper.util.TickThread.ensureTickThread("Async full chunk future completion"); // Paper
|
||||
either.ifLeft(chunk -> {
|
||||
ChunkHolder.this.isEntityTickingReady = true;
|
||||
// Paper start - entity ticking chunk set
|
||||
@@ -641,16 +795,45 @@ public class ChunkHolder {
|
||||
this.demoteFullChunk(chunkStorage, playerchunk_state1);
|
||||
}
|
||||
|
||||
- this.onLevelChange.onLevelChange(this.pos, this::getQueueLevel, this.ticketLevel, this::setQueueLevel);
|
||||
+ //this.onLevelChange.onLevelChange(this.pos, this::getQueueLevel, this.ticketLevel, this::setQueueLevel);
|
||||
+ // Paper start - raise IO/load priority if priority changes, use our preferred priority
|
||||
+ priorityBoost = chunkMap.distanceManager.getChunkPriority(pos);
|
||||
+ int currRequestedPriority = this.requestedPriority;
|
||||
+ int priority = getDemandedPriority();
|
||||
+ int newRequestedPriority = this.requestedPriority = priority;
|
||||
+ if (this.queueLevel > priority) {
|
||||
+ int ioPriority = com.destroystokyo.paper.io.PrioritizedTaskQueue.NORMAL_PRIORITY;
|
||||
+ if (priority <= 10) {
|
||||
+ ioPriority = com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY;
|
||||
+ } else if (priority <= 20) {
|
||||
+ ioPriority = com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGH_PRIORITY;
|
||||
+ }
|
||||
+ chunkMap.level.asyncChunkTaskManager.raisePriority(pos.x, pos.z, ioPriority);
|
||||
+ chunkMap.level.getChunkSource().getLightEngine().queue.changePriority(pos.toLong(), this.queueLevel, priority); // Paper // Restore this in chunk priority later?
|
||||
+ }
|
||||
+ if (currRequestedPriority != newRequestedPriority) {
|
||||
+ this.onLevelChange.onLevelChange(this.pos, () -> this.queueLevel, priority, p -> this.queueLevel = p); // use preferred priority
|
||||
+ int neighborsPriority = getNeighborsPriority();
|
||||
+ this.neighbors.forEach((neighbor, neighborDesired) -> neighbor.setNeighborPriority(this, neighborsPriority));
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.oldTicketLevel = this.ticketLevel;
|
||||
// CraftBukkit start
|
||||
// ChunkLoadEvent: Called after the chunk is loaded: isChunkLoaded returns true and chunk is ready to be modified by plugins.
|
||||
if (!playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && playerchunk_state1.isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) {
|
||||
this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> {
|
||||
+ io.papermc.paper.util.TickThread.ensureTickThread("Async full status chunk future completion"); // Paper
|
||||
LevelChunk chunk = (LevelChunk)either.left().orElse(null);
|
||||
- if (chunk != null) {
|
||||
+ if (chunk != null && ChunkHolder.this.oldTicketLevel <= 33 && !chunk.wasLoadCallbackInvoked()) { // Paper - ensure ticket level is set to loaded before calling, as now this can complete with ticket level > 33
|
||||
+ // Paper start - only schedule once, now the future is no longer completed as RIGHT if unloaded...
|
||||
+ if (ChunkHolder.this.loadCallbackScheduled) {
|
||||
+ return;
|
||||
+ }
|
||||
+ ChunkHolder.this.loadCallbackScheduled = true;
|
||||
+ // Paper end - only schedule once, now the future is no longer completed as RIGHT if unloaded...
|
||||
chunkStorage.callbackExecutor.execute(() -> {
|
||||
- chunk.loadCallback();
|
||||
+ ChunkHolder.this.loadCallbackScheduled = false; // Paper - only schedule once, now the future is no longer completed as RIGHT if unloaded...
|
||||
+ if (ChunkHolder.this.oldTicketLevel <= 33) chunk.loadCallback(); // Paper "
|
||||
});
|
||||
}
|
||||
}).exceptionally((throwable) -> {
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index d77aabe4997b816b23a1f39ac353ae5bc7b8e1e4..f0154a13dbdad970042e248b3adc776573ab5d35 100644
|
||||
index 2e127a2eb9b00eabe1f5c9c966e405e280c38756..2964b9c6bcc4de9e0ce7644e15f0b0625a01b810 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -122,6 +122,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -124,6 +124,7 @@ 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
|
||||
public final ChunkGenerator generator;
|
||||
public ChunkGenerator generator;
|
||||
public final Supplier<DimensionDataStorage> overworldDataStorage;
|
||||
private final PoiManager poiManager;
|
||||
@@ -347,6 +348,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -241,6 +242,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.level = world;
|
||||
this.generator = chunkGenerator;
|
||||
this.mainThreadExecutor = mainThreadExecutor;
|
||||
@ -388,8 +386,8 @@ index d77aabe4997b816b23a1f39ac353ae5bc7b8e1e4..f0154a13dbdad970042e248b3adc7765
|
||||
ProcessorMailbox<Runnable> threadedmailbox = ProcessorMailbox.create(executor, "worldgen");
|
||||
|
||||
Objects.requireNonNull(mainThreadExecutor);
|
||||
@@ -482,6 +492,116 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Paper end - optimise PlayerChunkMap#isOutsideRange
|
||||
@@ -281,6 +291,116 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
});
|
||||
}
|
||||
|
||||
+ // Paper start - Chunk Prioritization
|
||||
@ -505,7 +503,7 @@ index d77aabe4997b816b23a1f39ac353ae5bc7b8e1e4..f0154a13dbdad970042e248b3adc7765
|
||||
// Paper start
|
||||
public void updatePlayerMobTypeMap(Entity entity) {
|
||||
if (!this.level.paperConfig.perPlayerMobSpawns) {
|
||||
@@ -597,6 +717,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -422,6 +542,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
List<CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>>> list = Lists.newArrayList();
|
||||
int j = centerChunk.x;
|
||||
int k = centerChunk.z;
|
||||
@ -513,7 +511,7 @@ index d77aabe4997b816b23a1f39ac353ae5bc7b8e1e4..f0154a13dbdad970042e248b3adc7765
|
||||
|
||||
for (int l = -margin; l <= margin; ++l) {
|
||||
for (int i1 = -margin; i1 <= margin; ++i1) {
|
||||
@@ -615,6 +736,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -440,6 +561,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
|
||||
ChunkStatus chunkstatus = (ChunkStatus) distanceToStatus.apply(j1);
|
||||
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = playerchunk.getOrScheduleFuture(chunkstatus, this);
|
||||
@ -528,7 +526,7 @@ index d77aabe4997b816b23a1f39ac353ae5bc7b8e1e4..f0154a13dbdad970042e248b3adc7765
|
||||
|
||||
list.add(completablefuture);
|
||||
}
|
||||
@@ -984,11 +1113,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -710,11 +839,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
if (requiredStatus == ChunkStatus.EMPTY) {
|
||||
return this.scheduleChunkLoad(chunkcoordintpair);
|
||||
} else {
|
||||
@ -549,7 +547,7 @@ index d77aabe4997b816b23a1f39ac353ae5bc7b8e1e4..f0154a13dbdad970042e248b3adc7765
|
||||
|
||||
if (optional.isPresent() && ((ChunkAccess) optional.get()).getStatus().isOrAfter(requiredStatus)) {
|
||||
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = requiredStatus.load(this.level, this.structureManager, this.lightEngine, (ichunkaccess) -> {
|
||||
@@ -1000,6 +1137,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -726,6 +863,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
} else {
|
||||
return this.scheduleChunkGeneration(holder, requiredStatus);
|
||||
}
|
||||
@ -557,7 +555,7 @@ index d77aabe4997b816b23a1f39ac353ae5bc7b8e1e4..f0154a13dbdad970042e248b3adc7765
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1059,14 +1197,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -782,14 +920,24 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
};
|
||||
|
||||
CompletableFuture<CompoundTag> chunkSaveFuture = this.level.asyncChunkTaskManager.getChunkSaveFuture(pos.x, pos.z);
|
||||
@ -587,7 +585,7 @@ index d77aabe4997b816b23a1f39ac353ae5bc7b8e1e4..f0154a13dbdad970042e248b3adc7765
|
||||
return ret;
|
||||
// Paper end
|
||||
}
|
||||
@@ -1115,7 +1263,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -838,7 +986,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.releaseLightTicket(chunkcoordintpair);
|
||||
return CompletableFuture.completedFuture(Either.right(playerchunk_failure));
|
||||
});
|
||||
@ -599,36 +597,36 @@ index d77aabe4997b816b23a1f39ac353ae5bc7b8e1e4..f0154a13dbdad970042e248b3adc7765
|
||||
}
|
||||
|
||||
protected void releaseLightTicket(ChunkPos pos) {
|
||||
@@ -1198,7 +1349,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
long i = playerchunk.getPos().toLong();
|
||||
@@ -922,7 +1073,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
long i = chunkHolder.getPos().toLong();
|
||||
|
||||
Objects.requireNonNull(playerchunk);
|
||||
- mailbox.tell(ChunkTaskPriorityQueueSorter.message(runnable, i, playerchunk::getTicketLevel));
|
||||
Objects.requireNonNull(chunkHolder);
|
||||
- mailbox.tell(ChunkTaskPriorityQueueSorter.message(runnable, i, chunkHolder::getTicketLevel));
|
||||
+ mailbox.tell(ChunkTaskPriorityQueueSorter.message(runnable, i, () -> 1)); // Paper - final loads are always urgent!
|
||||
});
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||
index d94241bcca4f2fd5e464a860bd356af504dc68b7..1cc4e0a1f3d8235ef88b48e01ca8b78a263d2676 100644
|
||||
index 1a6c75a33c6dfec63eabef0b8a0a5d8812aeeb4c..7f1fc9ab112903ed0f29b82baeba89bbf469c4e9 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/DistanceManager.java
|
||||
@@ -98,6 +98,7 @@ public abstract class DistanceManager {
|
||||
@@ -111,6 +111,7 @@ public abstract class DistanceManager {
|
||||
}
|
||||
|
||||
private static int getTicketLevelAt(SortedArraySet<Ticket<?>> arraysetsorted) {
|
||||
+ org.spigotmc.AsyncCatcher.catchOp("ChunkMapDistance::getLowestTicketLevel"); // Paper
|
||||
return !arraysetsorted.isEmpty() ? ((Ticket) arraysetsorted.first()).getTicketLevel() : ChunkMap.MAX_CHUNK_DISTANCE + 1;
|
||||
private static int getTicketLevelAt(SortedArraySet<Ticket<?>> tickets) {
|
||||
+ org.spigotmc.AsyncCatcher.catchOp("ChunkMapDistance::getTicketLevelAt"); // Paper
|
||||
return !tickets.isEmpty() ? ((Ticket) tickets.first()).getTicketLevel() : ChunkMap.MAX_CHUNK_DISTANCE + 1;
|
||||
}
|
||||
|
||||
@@ -111,6 +112,7 @@ public abstract class DistanceManager {
|
||||
|
||||
public boolean runAllUpdates(ChunkMap playerchunkmap) {
|
||||
//this.f.a(); // Paper - no longer used
|
||||
@@ -125,6 +126,7 @@ public abstract class DistanceManager {
|
||||
public boolean runAllUpdates(ChunkMap chunkStorage) {
|
||||
this.naturalSpawnChunkCounter.runAllUpdates();
|
||||
this.tickingTicketsTracker.runAllUpdates();
|
||||
+ org.spigotmc.AsyncCatcher.catchOp("DistanceManagerTick"); // Paper
|
||||
this.playerTicketManager.runAllUpdates();
|
||||
int i = Integer.MAX_VALUE - this.ticketTracker.runDistanceUpdates(Integer.MAX_VALUE);
|
||||
boolean flag = i != 0;
|
||||
@@ -121,11 +123,13 @@ public abstract class DistanceManager {
|
||||
@@ -135,11 +137,13 @@ public abstract class DistanceManager {
|
||||
|
||||
// Paper start
|
||||
if (!this.pendingChunkUpdates.isEmpty()) {
|
||||
@ -636,13 +634,13 @@ index d94241bcca4f2fd5e464a860bd356af504dc68b7..1cc4e0a1f3d8235ef88b48e01ca8b78a
|
||||
while(!this.pendingChunkUpdates.isEmpty()) {
|
||||
ChunkHolder remove = this.pendingChunkUpdates.remove();
|
||||
remove.isUpdateQueued = false;
|
||||
remove.updateFutures(playerchunkmap, this.mainThreadExecutor);
|
||||
remove.updateFutures(chunkStorage, this.mainThreadExecutor);
|
||||
}
|
||||
+ } finally { this.pollingPendingChunkUpdates = false; } // Paper - Chunk priority
|
||||
// Paper end
|
||||
return true;
|
||||
} else {
|
||||
@@ -161,8 +165,10 @@ public abstract class DistanceManager {
|
||||
@@ -175,8 +179,10 @@ public abstract class DistanceManager {
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
@ -652,8 +650,8 @@ index d94241bcca4f2fd5e464a860bd356af504dc68b7..1cc4e0a1f3d8235ef88b48e01ca8b78a
|
||||
+ org.spigotmc.AsyncCatcher.catchOp("ChunkMapDistance::addTicket"); // Paper
|
||||
SortedArraySet<Ticket<?>> arraysetsorted = this.getTickets(i);
|
||||
int j = DistanceManager.getTicketLevelAt(arraysetsorted);
|
||||
Ticket<?> ticket1 = (Ticket) arraysetsorted.addOrGet(ticket); // CraftBukkit - decompile error
|
||||
@@ -176,7 +182,9 @@ public abstract class DistanceManager {
|
||||
Ticket<?> ticket1 = (Ticket) arraysetsorted.addOrGet(ticket);
|
||||
@@ -190,7 +196,9 @@ public abstract class DistanceManager {
|
||||
}
|
||||
|
||||
boolean removeTicket(long i, Ticket<?> ticket) { // CraftBukkit - void -> boolean
|
||||
@ -663,7 +661,7 @@ index d94241bcca4f2fd5e464a860bd356af504dc68b7..1cc4e0a1f3d8235ef88b48e01ca8b78a
|
||||
|
||||
boolean removed = false; // CraftBukkit
|
||||
if (arraysetsorted.remove(ticket)) {
|
||||
@@ -208,7 +216,12 @@ public abstract class DistanceManager {
|
||||
@@ -201,7 +209,12 @@ public abstract class DistanceManager {
|
||||
this.tickets.remove(i);
|
||||
}
|
||||
|
||||
@ -677,7 +675,7 @@ index d94241bcca4f2fd5e464a860bd356af504dc68b7..1cc4e0a1f3d8235ef88b48e01ca8b78a
|
||||
return removed; // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -250,6 +263,136 @@ public abstract class DistanceManager {
|
||||
@@ -249,6 +262,136 @@ public abstract class DistanceManager {
|
||||
});
|
||||
}
|
||||
|
||||
@ -813,8 +811,8 @@ index d94241bcca4f2fd5e464a860bd356af504dc68b7..1cc4e0a1f3d8235ef88b48e01ca8b78a
|
||||
+
|
||||
protected void updateChunkForced(ChunkPos pos, boolean forced) {
|
||||
Ticket<ChunkPos> ticket = new Ticket<>(TicketType.FORCED, 31, pos);
|
||||
|
||||
@@ -516,41 +659,68 @@ public abstract class DistanceManager {
|
||||
long i = pos.toLong();
|
||||
@@ -536,41 +679,68 @@ public abstract class DistanceManager {
|
||||
|
||||
public void updateViewDistance(int watchDistance) {
|
||||
ObjectIterator objectiterator = this.chunks.long2ByteEntrySet().iterator();
|
||||
@ -838,9 +836,9 @@ index d94241bcca4f2fd5e464a860bd356af504dc68b7..1cc4e0a1f3d8235ef88b48e01ca8b78a
|
||||
|
||||
private void onLevelChange(long pos, int distance, boolean oldWithinViewDistance, boolean withinViewDistance) {
|
||||
if (oldWithinViewDistance != withinViewDistance) {
|
||||
- Ticket<?> ticket = new Ticket<>(TicketType.PLAYER, 33, new ChunkPos(pos)); // Paper - no-tick view distance
|
||||
- Ticket<?> ticket = new Ticket<>(TicketType.PLAYER, DistanceManager.PLAYER_TICKET_LEVEL, new ChunkPos(pos));
|
||||
+ ChunkPos coords = new ChunkPos(pos); // Paper - reuse variable
|
||||
+ Ticket<?> ticket = new Ticket<>(TicketType.PLAYER, 33, coords); // Paper - no-tick view distance
|
||||
+ Ticket<?> ticket = new Ticket<>(TicketType.PLAYER, DistanceManager.PLAYER_TICKET_LEVEL, coords); // Paper - reuse variable
|
||||
|
||||
if (withinViewDistance) {
|
||||
+ scheduleChunkLoad(pos, net.minecraft.server.MinecraftServer.currentTick, distance, (priority) -> { // Paper - smarter ticket delay based on frustum and distance
|
||||
@ -889,7 +887,7 @@ index d94241bcca4f2fd5e464a860bd356af504dc68b7..1cc4e0a1f3d8235ef88b48e01ca8b78a
|
||||
});
|
||||
}, pos, true));
|
||||
}
|
||||
@@ -592,5 +762,100 @@ public abstract class DistanceManager {
|
||||
@@ -612,5 +782,100 @@ public abstract class DistanceManager {
|
||||
private boolean haveTicketFor(int distance) {
|
||||
return distance <= this.viewDistance - 2;
|
||||
}
|
||||
@ -991,12 +989,12 @@ index d94241bcca4f2fd5e464a860bd356af504dc68b7..1cc4e0a1f3d8235ef88b48e01ca8b78a
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index 8cef8dca3971cbbb4eddf08ff47eca6874c1ac99..77a6a5883d7e9fba12d0a2c8f3e7f2565d4785b4 100644
|
||||
index d56eb5071ed3ae2b9d5636cafb3aca9b2cd71d15..1e7dce9d6d665c5c72cc929084ad3bfa3c790ca5 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -610,6 +610,26 @@ public class ServerChunkCache extends ChunkSource {
|
||||
public <T> void removeTicketAtLevel(TicketType<T> ticketType, ChunkPos chunkPos, int ticketLevel, T identifier) {
|
||||
this.distanceManager.removeTicketAtLevel(ticketType, chunkPos, ticketLevel, identifier);
|
||||
@@ -599,6 +599,26 @@ public class ServerChunkCache extends ChunkSource {
|
||||
return CompletableFuture.completedFuture(either);
|
||||
}, this.mainThreadProcessor);
|
||||
}
|
||||
+
|
||||
+ public boolean markUrgent(ChunkPos coords) {
|
||||
@ -1021,7 +1019,7 @@ index 8cef8dca3971cbbb4eddf08ff47eca6874c1ac99..77a6a5883d7e9fba12d0a2c8f3e7f256
|
||||
// Paper end - async chunk io
|
||||
|
||||
@Nullable
|
||||
@@ -650,6 +670,8 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -639,6 +659,8 @@ public class ServerChunkCache extends ChunkSource {
|
||||
Objects.requireNonNull(completablefuture);
|
||||
if (!completablefuture.isDone()) { // Paper
|
||||
// Paper start - async chunk io/loading
|
||||
@ -1030,8 +1028,8 @@ index 8cef8dca3971cbbb4eddf08ff47eca6874c1ac99..77a6a5883d7e9fba12d0a2c8f3e7f256
|
||||
this.level.asyncChunkTaskManager.raisePriority(x1, z1, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY);
|
||||
com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.level, x1, z1);
|
||||
// Paper end
|
||||
@@ -658,6 +680,8 @@ public class ServerChunkCache extends ChunkSource {
|
||||
chunkproviderserver_a.managedBlock(completablefuture::isDone);
|
||||
@@ -647,6 +669,8 @@ public class ServerChunkCache extends ChunkSource {
|
||||
chunkproviderserver_b.managedBlock(completablefuture::isDone);
|
||||
com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug
|
||||
this.level.timings.syncChunkLoad.stopTiming(); // Paper
|
||||
+ this.distanceManager.clearPriorityTickets(pair); // Paper - Chunk priority
|
||||
@ -1039,7 +1037,7 @@ index 8cef8dca3971cbbb4eddf08ff47eca6874c1ac99..77a6a5883d7e9fba12d0a2c8f3e7f256
|
||||
} // Paper
|
||||
ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
|
||||
return ichunkaccess1;
|
||||
@@ -731,10 +755,12 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -720,10 +744,12 @@ public class ServerChunkCache extends ChunkSource {
|
||||
if (create && !currentlyUnloading) {
|
||||
// CraftBukkit end
|
||||
this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
|
||||
@ -1052,7 +1050,7 @@ index 8cef8dca3971cbbb4eddf08ff47eca6874c1ac99..77a6a5883d7e9fba12d0a2c8f3e7f256
|
||||
this.runDistanceManagerUpdates();
|
||||
playerchunk = this.getVisibleChunkIfPresent(k);
|
||||
gameprofilerfiller.pop();
|
||||
@@ -744,7 +770,13 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -733,7 +759,13 @@ public class ServerChunkCache extends ChunkSource {
|
||||
}
|
||||
}
|
||||
|
||||
@ -1067,7 +1065,7 @@ index 8cef8dca3971cbbb4eddf08ff47eca6874c1ac99..77a6a5883d7e9fba12d0a2c8f3e7f256
|
||||
}
|
||||
|
||||
private boolean chunkAbsent(@Nullable ChunkHolder holder, int maxLevel) {
|
||||
@@ -796,6 +828,7 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -785,6 +817,7 @@ public class ServerChunkCache extends ChunkSource {
|
||||
}
|
||||
|
||||
public boolean runDistanceManagerUpdates() {
|
||||
@ -1076,10 +1074,10 @@ index 8cef8dca3971cbbb4eddf08ff47eca6874c1ac99..77a6a5883d7e9fba12d0a2c8f3e7f256
|
||||
boolean flag1 = this.chunkMap.promoteChunkMap();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 921a0edd8e778d34f08429c22dd410708addf36e..2ee07e5bb5b4081870ae46ba322e0ec9a4dfe0ec 100644
|
||||
index beebb7a0e6b8b1fa4e7d2f9fdf1962357cc2ebc3..3e31260a3206ffe16db2e3cbc925261f78851598 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -189,6 +189,14 @@ public class ServerPlayer extends Player {
|
||||
@@ -185,6 +185,14 @@ public class ServerPlayer extends Player {
|
||||
private int lastRecordedArmor = Integer.MIN_VALUE;
|
||||
private int lastRecordedLevel = Integer.MIN_VALUE;
|
||||
private int lastRecordedExperience = Integer.MIN_VALUE;
|
||||
@ -1094,7 +1092,7 @@ index 921a0edd8e778d34f08429c22dd410708addf36e..2ee07e5bb5b4081870ae46ba322e0ec9
|
||||
private float lastSentHealth = -1.0E8F;
|
||||
private int lastSentFood = -99999999;
|
||||
private boolean lastFoodSaturationZero = true;
|
||||
@@ -325,6 +333,21 @@ public class ServerPlayer extends Player {
|
||||
@@ -327,6 +335,21 @@ public class ServerPlayer extends Player {
|
||||
this.maxHealthCache = this.getMaxHealth();
|
||||
this.cachedSingleMobDistanceMap = new com.destroystokyo.paper.util.PooledHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper
|
||||
}
|
||||
@ -1116,7 +1114,7 @@ index 921a0edd8e778d34f08429c22dd410708addf36e..2ee07e5bb5b4081870ae46ba322e0ec9
|
||||
|
||||
// Yes, this doesn't match Vanilla, but it's the best we can do for now.
|
||||
// If this is an issue, PRs are welcome
|
||||
@@ -645,6 +668,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -649,6 +672,7 @@ public class ServerPlayer extends Player {
|
||||
if (valid && !this.isSpectator() || !this.touchingUnloadedChunk()) { // Paper - don't tick dead players that are not in the world currently (pending respawn)
|
||||
super.tick();
|
||||
}
|
||||
@ -1125,7 +1123,7 @@ index 921a0edd8e778d34f08429c22dd410708addf36e..2ee07e5bb5b4081870ae46ba322e0ec9
|
||||
for (int i = 0; i < this.getInventory().getContainerSize(); ++i) {
|
||||
ItemStack itemstack = this.getInventory().getItem(i);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java
|
||||
index 2c4aa4b66d83b6e7a104479860b7982629c63c3b..833b6b2193cf08e123aabb344f2283730aed1bcd 100644
|
||||
index 55ac6421e43a488ebb5b070babdd1071ad3950a6..bc2ac01fb4617aa6abfd6db31980d56b53a660b5 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java
|
||||
@@ -1,6 +1,7 @@
|
||||
@ -1398,19 +1396,19 @@ index 2c4aa4b66d83b6e7a104479860b7982629c63c3b..833b6b2193cf08e123aabb344f228373
|
||||
|
||||
public void setTaskPerBatch(int taskBatchSize) {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/Ticket.java b/src/main/java/net/minecraft/server/level/Ticket.java
|
||||
index f1128f0d4a9a0241ac6c9bc18dd13b431c616bb1..2b2b7851d5f68bcdb41d58bcc64740ba58bf1ef4 100644
|
||||
index ffc43e5d3d0563c9e9c171064511b2c65ddf67e1..85f41e94b555eba1c8f887ca130a7cdba7bdb056 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/Ticket.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/Ticket.java
|
||||
@@ -8,6 +8,7 @@ public final class Ticket<T> implements Comparable<Ticket<?>> {
|
||||
@@ -7,6 +7,7 @@ public final class Ticket<T> implements Comparable<Ticket<?>> {
|
||||
private final int ticketLevel;
|
||||
public final T key;
|
||||
public long createdTick;
|
||||
public long delayUnloadBy; // Paper
|
||||
+ public int priority; // Paper - Chunk priority
|
||||
|
||||
protected Ticket(TicketType<T> type, int level, T argument) {
|
||||
this.type = type;
|
||||
diff --git a/src/main/java/net/minecraft/server/level/TicketType.java b/src/main/java/net/minecraft/server/level/TicketType.java
|
||||
index 8770fe0db46b01e8b608637df4f1a669a3f4cdde..3c1698ba0d3bc412ab957777d9b5211dbc555208 100644
|
||||
index 78fbb4c3e52e900956ae0811aaf934c81ee5ea48..23d13600d6925f6746dfde08e17ba578e274010e 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/TicketType.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/TicketType.java
|
||||
@@ -9,6 +9,8 @@ import net.minecraft.world.level.ChunkPos;
|
||||
@ -1423,10 +1421,10 @@ index 8770fe0db46b01e8b608637df4f1a669a3f4cdde..3c1698ba0d3bc412ab957777d9b5211d
|
||||
private final String name;
|
||||
private final Comparator<T> comparator;
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 001167097afed95f93f54ff0e61220148849dd85..ffdba71ca4a42fee989438799d485826c9bb647a 100644
|
||||
index 0bcafeb8008bd2556bcdc556b17d00ff936d7aa9..935bdd3ece5b684cbaa14ef3211239fe9722ad2f 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1545,6 +1545,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -1551,6 +1551,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
this.player.absMoveTo(d0, d1, d2, f, f1);
|
||||
@ -1435,7 +1433,7 @@ index 001167097afed95f93f54ff0e61220148849dd85..ffdba71ca4a42fee989438799d485826
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index a5fb401e04bf194224d05020fe397e231e2f715c..0e3726495ef10717627dcf4297c944da5e0689b7 100644
|
||||
index 0ac5ba6bc7b582d1ab02a90c9418c9b899175d93..8dd698a9b0cc7b6143996c90197ebc2d4fc9951d 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -175,6 +175,7 @@ public abstract class PlayerList {
|
||||
@ -1446,7 +1444,7 @@ index a5fb401e04bf194224d05020fe397e231e2f715c..0e3726495ef10717627dcf4297c944da
|
||||
ServerPlayer prev = pendingPlayers.put(player.getUUID(), player);// Paper
|
||||
if (prev != null) {
|
||||
disconnectPendingPlayer(prev);
|
||||
@@ -286,8 +287,8 @@ public abstract class PlayerList {
|
||||
@@ -285,8 +286,8 @@ public abstract class PlayerList {
|
||||
net.minecraft.server.level.ChunkMap playerChunkMap = worldserver1.getChunkSource().chunkMap;
|
||||
net.minecraft.server.level.DistanceManager distanceManager = playerChunkMap.distanceManager;
|
||||
distanceManager.addTicketAtLevel(net.minecraft.server.level.TicketType.LOGIN, pos, 31, pos.toLong());
|
||||
@ -1457,21 +1455,21 @@ index a5fb401e04bf194224d05020fe397e231e2f715c..0e3726495ef10717627dcf4297c944da
|
||||
net.minecraft.server.level.ChunkHolder updatingChunk = playerChunkMap.getUpdatingChunkIfPresent(pos.toLong());
|
||||
if (updatingChunk != null) {
|
||||
return updatingChunk.getEntityTickingChunkFuture();
|
||||
@@ -894,6 +895,7 @@ public abstract class PlayerList {
|
||||
@@ -892,6 +893,7 @@ public abstract class PlayerList {
|
||||
entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
// CraftBukkit end
|
||||
|
||||
worldserver1.getChunkSource().addRegionTicket(net.minecraft.server.level.TicketType.POST_TELEPORT, new net.minecraft.world.level.ChunkPos(location.getBlockX() >> 4, location.getBlockZ() >> 4), 1, entityplayer.getId()); // Paper
|
||||
+ entityplayer1.forceCheckHighPriority(); // Player - Chunk priority
|
||||
while (avoidSuffocation && !worldserver1.noCollision(entityplayer1) && entityplayer1.getY() < (double) worldserver1.getMaxBuildHeight()) {
|
||||
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 2806d247e92600a592615241a6d07527f6b527e8..9aa75a9e997825c27d57eae992ca58ecbb807dfb 100644
|
||||
index 91e034f54deb2aa084527aaa001e48ddcc2e9cd1..b8db2dad1ccd1afce01fd770650fe5f0afc40bce 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -223,7 +223,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
private Vec3 position;
|
||||
@@ -222,7 +222,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
||||
private BlockPos blockPosition;
|
||||
private ChunkPos chunkPosition;
|
||||
private Vec3 deltaMovement;
|
||||
- private float yRot;
|
||||
+ public float yRot; // Paper - private->public
|
||||
@ -1479,10 +1477,10 @@ index 2806d247e92600a592615241a6d07527f6b527e8..9aa75a9e997825c27d57eae992ca58ec
|
||||
public float yRotO;
|
||||
public float xRotO;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index a84b75a53a0324fab9aeb9b80bf74eb0a84ecd2e..d580f0375cce5e995c024f1b0cd4843b5718121c 100644
|
||||
index c76e46afa685fbaa5c83aff4ef72b5fe32bc6d10..ccd12f130d32c95b191073bfd59e60223394c30b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -192,7 +192,7 @@ public class LevelChunk implements ChunkAccess {
|
||||
@@ -137,7 +137,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
return NEIGHBOUR_CACHE_RADIUS;
|
||||
}
|
||||
|
||||
@ -1491,7 +1489,7 @@ index a84b75a53a0324fab9aeb9b80bf74eb0a84ecd2e..d580f0375cce5e995c024f1b0cd4843b
|
||||
private long neighbourChunksLoadedBitset;
|
||||
private final LevelChunk[] loadedNeighbourChunks = new LevelChunk[(NEIGHBOUR_CACHE_RADIUS * 2 + 1) * (NEIGHBOUR_CACHE_RADIUS * 2 + 1)];
|
||||
|
||||
@@ -794,6 +794,7 @@ public class LevelChunk implements ChunkAccess {
|
||||
@@ -674,6 +674,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
|
||||
// CraftBukkit start
|
||||
public void loadCallback() {
|
||||
@ -1499,7 +1497,7 @@ index a84b75a53a0324fab9aeb9b80bf74eb0a84ecd2e..d580f0375cce5e995c024f1b0cd4843b
|
||||
// Paper start - neighbour cache
|
||||
int chunkX = this.chunkPos.x;
|
||||
int chunkZ = this.chunkPos.z;
|
||||
@@ -848,6 +849,7 @@ public class LevelChunk implements ChunkAccess {
|
||||
@@ -728,6 +729,7 @@ public class LevelChunk extends ChunkAccess {
|
||||
}
|
||||
|
||||
public void unloadCallback() {
|
||||
@ -1508,7 +1506,7 @@ index a84b75a53a0324fab9aeb9b80bf74eb0a84ecd2e..d580f0375cce5e995c024f1b0cd4843b
|
||||
org.bukkit.event.world.ChunkUnloadEvent unloadEvent = new org.bukkit.event.world.ChunkUnloadEvent(this.bukkitChunk, this.isUnsaved());
|
||||
server.getPluginManager().callEvent(unloadEvent);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 20d956c9a4e3b598ffebbe481a190158566343d9..228406d41c2e4d1615329752bbc9e609acbe2d36 100644
|
||||
index 3bc98586792960f50ca25929f1d91fc60a8577ce..ea4e897e04de9474abec5f6d0819bff4471b51ee 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -1928,6 +1928,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@ -1525,10 +1523,10 @@ index 20d956c9a4e3b598ffebbe481a190158566343d9..228406d41c2e4d1615329752bbc9e609
|
||||
net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk) either.left().orElse(null);
|
||||
if (chunk != null) addTicket(x, z); // Paper
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index d1bb816bd718e09614bad435c50e9c882194a85d..21a2f83aa91a41ea1f4e9e87e804d587838c0d45 100644
|
||||
index ac535aef823ebe286847dafb8b0678de5d3128a1..e8f487d8338f1ef0b68150c30dcab5f9b3140e7d 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -903,6 +903,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -907,6 +907,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
throw new UnsupportedOperationException("Cannot set rotation of players. Consider teleporting instead.");
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Optimize NetworkManager Exception Handling
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/ConnectionProtocol.java b/src/main/java/net/minecraft/network/ConnectionProtocol.java
|
||||
index 6611aebafb14b83bce3eeb87701e2edc8a0828ab..bb3b450c7e81ba47e1e8b2244d331f2ce44a7ee1 100644
|
||||
index ea69f11e3cd9775998679baaccdaf980ee8fd498..1e0e64568167f1525285abb043e93c8b4316d11c 100644
|
||||
--- a/src/main/java/net/minecraft/network/ConnectionProtocol.java
|
||||
+++ b/src/main/java/net/minecraft/network/ConnectionProtocol.java
|
||||
@@ -275,6 +275,7 @@ public enum ConnectionProtocol {
|
||||
@@ -294,6 +294,7 @@ public enum ConnectionProtocol {
|
||||
|
||||
@Nullable
|
||||
public Packet<?> createPacket(int id, FriendlyByteBuf buf) {
|
||||
@ -17,15 +17,15 @@ index 6611aebafb14b83bce3eeb87701e2edc8a0828ab..bb3b450c7e81ba47e1e8b2244d331f2c
|
||||
return function != null ? function.apply(buf) : null;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java b/src/main/java/net/minecraft/network/Varint21FrameDecoder.java
|
||||
index 5356f6484751e4b4740720aecac90bdfe044283b..ed54479b14dcfc736ac90749106557f0ff537550 100644
|
||||
index 99b581052f937b0f2d6b5d73de699008c1d51774..ed54479b14dcfc736ac90749106557f0ff537550 100644
|
||||
--- a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java
|
||||
+++ b/src/main/java/net/minecraft/network/Varint21FrameDecoder.java
|
||||
@@ -8,9 +8,20 @@ import io.netty.handler.codec.CorruptedFrameException;
|
||||
@@ -8,8 +8,20 @@ import io.netty.handler.codec.CorruptedFrameException;
|
||||
import java.util.List;
|
||||
|
||||
public class Varint21FrameDecoder extends ByteToMessageDecoder {
|
||||
+ private final byte[] lenBuf = new byte[3]; // Paper
|
||||
@Override
|
||||
+ @Override
|
||||
protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> list) {
|
||||
+ // Paper start - if channel is not active just discard the packet
|
||||
+ if (!channelHandlerContext.channel().isActive()) {
|
@ -9,7 +9,7 @@ instead of getting stuck in a never despawn state (bubble columns,
|
||||
etc).
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
index 65faf775b786f9c237ee33c1fb0f8ab9f37d738c..6636845ea044c3810e1880aad8b679134cd33668 100644
|
||||
index 91505b592e95240e0dc71a17906ab48f5eb94f34..b436103957113bff5e553dacb869c775a3f8b059 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
|
||||
@@ -198,6 +198,7 @@ public abstract class AbstractArrow extends Projectile {
|
@ -26,30 +26,19 @@ index 2b87c6eb28d4db634dd6d8ee42ff3aa78ed7cb68..f64aa22ed6fcb4af67317b99f459ee52
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||
index a59d14e61fcbca7861a5593d0717b81262ccbdc5..71e29d29ed5c2d61832e2f124967bb223708406f 100644
|
||||
index 530a09fa3c9155459c6a4519e3412408ae658145..cb0045fc4ddd738c45dee89d57b213a633b9a136 100644
|
||||
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
|
||||
@@ -9,8 +9,10 @@ import com.mojang.brigadier.suggestion.Suggestions;
|
||||
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
+import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
+import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.BinaryOperator;
|
||||
import java.util.stream.Stream;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -54,7 +56,7 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
|
||||
@@ -56,7 +56,7 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
|
||||
private final ResultConsumer<CommandSourceStack> consumer;
|
||||
private final EntityAnchorArgument.Anchor anchor;
|
||||
private final Vec2 rotation;
|
||||
- public volatile CommandNode currentCommand; // CraftBukkit
|
||||
+ public Map<Thread, CommandNode> currentCommand = new ConcurrentHashMap<>(); // CraftBukkit // Paper
|
||||
+ public java.util.Map<Thread, CommandNode> currentCommand = new java.util.concurrent.ConcurrentHashMap<>(); // CraftBukkit // Paper
|
||||
|
||||
public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) {
|
||||
this(output, pos, rot, world, level, name, displayName, server, entity, false, (commandcontext, flag, j) -> {
|
||||
@@ -175,9 +177,11 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
|
||||
@@ -177,9 +177,11 @@ public class CommandSourceStack implements SharedSuggestionProvider, com.destroy
|
||||
@Override
|
||||
public boolean hasPermission(int level) {
|
||||
// CraftBukkit start
|
@ -5,10 +5,10 @@ Subject: [PATCH] Move range check for block placing up
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 36a69fb0a9cd81ceb0f9cbe6549fc89bd643c77c..51303e89ec160f3715e538903ae98be993d59150 100644
|
||||
index 0bcafeb8008bd2556bcdc556b17d00ff936d7aa9..26bd27d3dd6e99488fd0a77257866b1eb1b191b8 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1661,6 +1661,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -1666,6 +1666,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
}
|
||||
// Spigot end
|
||||
|
||||
@ -23,7 +23,7 @@ index 36a69fb0a9cd81ceb0f9cbe6549fc89bd643c77c..51303e89ec160f3715e538903ae98be9
|
||||
@Override
|
||||
public void handleUseItemOn(ServerboundUseItemOnPacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||
@@ -1673,17 +1681,22 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -1678,17 +1686,22 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
BlockPos blockposition = movingobjectpositionblock.getBlockPos();
|
||||
Direction enumdirection = movingobjectpositionblock.getDirection();
|
||||
|
||||
@ -40,7 +40,7 @@ index 36a69fb0a9cd81ceb0f9cbe6549fc89bd643c77c..51303e89ec160f3715e538903ae98be9
|
||||
int i = this.player.level.getMaxBuildHeight();
|
||||
|
||||
if (blockposition.getY() < i) {
|
||||
if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract((net.minecraft.world.entity.player.Player) this.player, blockposition)) {
|
||||
if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract(this.player, blockposition)) {
|
||||
// CraftBukkit start - Check if we can actually do something over this large a distance
|
||||
- Location eyeLoc = this.getCraftPlayer().getEyeLocation();
|
||||
- double reachDistance = NumberConversions.square(eyeLoc.getX() - blockposition.getX()) + NumberConversions.square(eyeLoc.getY() - blockposition.getY()) + NumberConversions.square(eyeLoc.getZ() - blockposition.getZ());
|
@ -10,10 +10,10 @@ This fixes that by checking if the modified spawn location is
|
||||
still at a respawn anchor.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 0e3726495ef10717627dcf4297c944da5e0689b7..34f56db51e2c6a1c451f95d0fa3cb5c368b1ecf7 100644
|
||||
index 0ac5ba6bc7b582d1ab02a90c9418c9b899175d93..06a38986775b99faca2deddf1bcbea3c691c6521 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -79,6 +79,7 @@ import net.minecraft.world.level.GameRules;
|
||||
@@ -78,6 +78,7 @@ import net.minecraft.world.level.GameRules;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.biome.BiomeManager;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
@ -21,7 +21,7 @@ index 0e3726495ef10717627dcf4297c944da5e0689b7..34f56db51e2c6a1c451f95d0fa3cb5c3
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.border.BorderChangeListener;
|
||||
import net.minecraft.world.level.border.WorldBorder;
|
||||
@@ -830,6 +831,7 @@ public abstract class PlayerList {
|
||||
@@ -828,6 +829,7 @@ public abstract class PlayerList {
|
||||
// Paper start
|
||||
boolean isBedSpawn = false;
|
||||
boolean isRespawn = false;
|
||||
@ -29,7 +29,7 @@ index 0e3726495ef10717627dcf4297c944da5e0689b7..34f56db51e2c6a1c451f95d0fa3cb5c3
|
||||
// Paper end
|
||||
|
||||
// CraftBukkit start - fire PlayerRespawnEvent
|
||||
@@ -840,7 +842,7 @@ public abstract class PlayerList {
|
||||
@@ -838,7 +840,7 @@ public abstract class PlayerList {
|
||||
Optional optional;
|
||||
|
||||
if (blockposition != null) {
|
||||
@ -38,7 +38,7 @@ index 0e3726495ef10717627dcf4297c944da5e0689b7..34f56db51e2c6a1c451f95d0fa3cb5c3
|
||||
} else {
|
||||
optional = Optional.empty();
|
||||
}
|
||||
@@ -884,7 +886,12 @@ public abstract class PlayerList {
|
||||
@@ -882,7 +884,12 @@ public abstract class PlayerList {
|
||||
}
|
||||
// Spigot End
|
||||
|
||||
@ -52,9 +52,9 @@ index 0e3726495ef10717627dcf4297c944da5e0689b7..34f56db51e2c6a1c451f95d0fa3cb5c3
|
||||
if (!flag) entityplayer.reset(); // SPIGOT-4785
|
||||
isRespawn = true; // Paper
|
||||
} else {
|
||||
@@ -922,8 +929,12 @@ public abstract class PlayerList {
|
||||
@@ -919,8 +926,12 @@ public abstract class PlayerList {
|
||||
}
|
||||
// entityplayer1.syncInventory();
|
||||
// entityplayer1.initInventoryMenu();
|
||||
entityplayer1.setHealth(entityplayer1.getHealth());
|
||||
- if (flag2) {
|
||||
- entityplayer1.connection.send(new ClientboundSoundPacket(SoundEvents.RESPAWN_ANCHOR_DEPLETE, SoundSource.BLOCKS, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 1.0F, 1.0F));
|
@ -5,10 +5,10 @@ Subject: [PATCH] Fix SPIGOT-5824 Bukkit world-container is not used
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||
index 7ce854edba32ffcafaa5268d4bb2822a5233e40b..3d6e09a3f028e50c08cbbb6b426f5b044c7b9e67 100644
|
||||
index e0c1e4e38ff49429a587c59afb86e95c452d52a0..e2882c60621d64458a480abaceeddd0417afc5d0 100644
|
||||
--- a/src/main/java/net/minecraft/server/Main.java
|
||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||
@@ -129,11 +129,20 @@ public class Main {
|
||||
@@ -134,11 +134,20 @@ public class Main {
|
||||
return;
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ Subject: [PATCH] Fix SPIGOT-5885 Unable to disable advancements
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||
index 3d6e09a3f028e50c08cbbb6b426f5b044c7b9e67..ea136b9ad3a2a07076e12b8656c68f63aa4718c8 100644
|
||||
index e2882c60621d64458a480abaceeddd0417afc5d0..bb85bfb074830d771be8527f6c25ebb578578f18 100644
|
||||
--- a/src/main/java/net/minecraft/server/Main.java
|
||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||
@@ -129,6 +129,7 @@ public class Main {
|
||||
@@ -134,6 +134,7 @@ public class Main {
|
||||
return;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ itself, so the criterion object stores no references - and thus
|
||||
needs no cleanup.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java
|
||||
index 584f48aba7bfec07a75b5a37da4ba7439610543c..c25c1cfca010ed625b6faf310be2edeccd6667bc 100644
|
||||
index 06fc39b19385d36fd0c5bb9a7042a238eb6e8a57..bb1f0e9dbcb792d015d1cb65664a96fdd3e0489e 100644
|
||||
--- a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java
|
||||
+++ b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java
|
||||
@@ -14,22 +14,24 @@ import net.minecraft.server.level.ServerPlayer;
|
||||
@ -52,7 +52,7 @@ index 584f48aba7bfec07a75b5a37da4ba7439610543c..c25c1cfca010ed625b6faf310be2edec
|
||||
protected abstract T createInstance(JsonObject obj, EntityPredicate.Composite playerPredicate, DeserializationContext predicateDeserializer);
|
||||
@@ -50,7 +52,7 @@ public abstract class SimpleCriterionTrigger<T extends AbstractCriterionTriggerI
|
||||
|
||||
protected void trigger(ServerPlayer player, Predicate<T> tester) {
|
||||
protected void trigger(ServerPlayer player, Predicate<T> predicate) {
|
||||
PlayerAdvancements playerAdvancements = player.getAdvancements();
|
||||
- Set<CriterionTrigger.Listener<T>> set = this.players.get(playerAdvancements);
|
||||
+ Set<CriterionTrigger.Listener<T>> set = (Set) playerAdvancements.criterionData.get(this); // Paper - fix AdvancementDataPlayer leak
|
||||
@ -60,7 +60,7 @@ index 584f48aba7bfec07a75b5a37da4ba7439610543c..c25c1cfca010ed625b6faf310be2edec
|
||||
LootContext lootContext = EntityPredicate.createContext(player, player);
|
||||
List<CriterionTrigger.Listener<T>> list = null;
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
index ce02a467c1c3434f2cdb112ceb9794196069a820..e05e5710c81b7dbb648afbfe16f843e7ae310752 100644
|
||||
index bd858a9da2f2442be85f36bb2de0dac46d0c68d7..3ff6995d34914720d353fdbe1aa981bfab9f6040 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
@@ -39,6 +39,7 @@ import net.minecraft.advancements.Criterion;
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add missing strikeLighting call to
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 228406d41c2e4d1615329752bbc9e609acbe2d36..35414a944fdbff16005185a22ea845cc2f7163e7 100644
|
||||
index 3bc98586792960f50ca25929f1d91fc60a8577ce..5bf060d5b4a22d0fea0c70513d9b0914614e5bbb 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -1999,6 +1999,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -1994,6 +1994,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
lightning.moveTo( loc.getX(), loc.getY(), loc.getZ() );
|
||||
lightning.visualOnly = true;
|
||||
lightning.isSilent = isSilent;
|
@ -5,7 +5,7 @@ Subject: [PATCH] Fix some rails connecting improperly
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java
|
||||
index 41c23abf78c2ca95c26633860adb9360139b3ceb..1242eb55996bca8a63bd7b95d01d0299fb36d105 100644
|
||||
index 67ffd7f67f72a5293411688e0be1a49f204a74d4..4ed0b305015ffa0366c93306dae4a245fa8ad812 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java
|
||||
@@ -65,6 +65,7 @@ public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBl
|
||||
@ -17,7 +17,7 @@ index 41c23abf78c2ca95c26633860adb9360139b3ceb..1242eb55996bca8a63bd7b95d01d0299
|
||||
|
||||
return state;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
|
||||
index 2335e7af6bc16a0d65c7818c316f3194c680c69d..63c7f2cf530ac9562960ae5a3cbc6e511a009377 100644
|
||||
index 8284df37b6b9a937c43c14b2a0f1274e087aa3ad..b68e3ced407a9e6b386cbd379e58c86f195eb17a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java
|
||||
@@ -70,6 +70,7 @@ public class DetectorRailBlock extends BaseRailBlock {
|
@ -9,23 +9,20 @@ the game, immediately stop the server to prevent data corruption.
|
||||
You can override this functionality at your own peril.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||
index ed05a11f5038fdac90576ca33a0b710c83ab39a1..80b9f3547bc30cb470d272132e96fcce188efd91 100644
|
||||
index 5c21871c7bdfce191db499860725da769dc9caac..d44ce73ea91abd7199695c417c534b6e4ca34e6a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
|
||||
@@ -96,10 +96,25 @@ public class ChunkSerializer {
|
||||
holder.tasks.forEach(Runnable::run);
|
||||
@@ -103,9 +103,22 @@ public class ChunkSerializer {
|
||||
return holder.protoChunk;
|
||||
}
|
||||
+
|
||||
|
||||
+ // Paper start
|
||||
+ private static final int CURRENT_DATA_VERSION = SharedConstants.getCurrentVersion().getWorldVersion();
|
||||
+ private static final int CURRENT_DATA_VERSION = SharedConstants.getCurrentVersion().getDataVersion().getVersion();
|
||||
+ private static final boolean JUST_CORRUPT_IT = Boolean.getBoolean("Paper.ignoreWorldDataVersion");
|
||||
+ // Paper end
|
||||
+
|
||||
public static InProgressChunkHolder loadChunk(ServerLevel world, StructureManager structureManager, PoiManager poiStorage, ChunkPos pos, CompoundTag nbt, boolean distinguish) {
|
||||
public static InProgressChunkHolder loadChunk(ServerLevel world, PoiManager poiStorage, ChunkPos chunkPos, CompoundTag nbt, boolean distinguish) {
|
||||
java.util.ArrayDeque<Runnable> tasksToExecuteOnMain = new java.util.ArrayDeque<>();
|
||||
// Paper end
|
||||
ChunkGenerator chunkgenerator = world.getChunkSource().getGenerator();
|
||||
+ // Paper start - Do NOT attempt to load chunks saved with newer versions
|
||||
+ if (nbt.contains("DataVersion", 99)) {
|
||||
+ int dataVersion = nbt.getInt("DataVersion");
|
||||
@ -35,6 +32,6 @@ index ed05a11f5038fdac90576ca33a0b710c83ab39a1..80b9f3547bc30cb470d272132e96fcce
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
BiomeSource worldchunkmanager = chunkgenerator.getBiomeSource();
|
||||
CompoundTag nbttagcompound1 = nbt.getCompound("Level"); // Paper - diff on change, see ChunkSerializer#getChunkCoordinate
|
||||
ChunkPos chunkcoordintpair1 = new ChunkPos(nbttagcompound1.getInt("xPos"), nbttagcompound1.getInt("zPos")); // Paper - diff on change, see ChunkSerializer#getChunkCoordinate
|
||||
ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); // Paper - diff on change, see ChunkSerializer#getChunkCoordinate
|
||||
|
||||
if (!Objects.equals(chunkPos, chunkcoordintpair1)) {
|
@ -5,7 +5,7 @@ Subject: [PATCH] Brand support
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index ce4f1ab41ec2e5f656114fbd7b6f825bccf15d17..76794189454f5dd935fcd77e3c89a1ce58a9b570 100644
|
||||
index 26bd27d3dd6e99488fd0a77257866b1eb1b191b8..c5fc4a2470093202f38472df84355ba0404645c5 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
|
||||
@ -16,15 +16,15 @@ index ce4f1ab41ec2e5f656114fbd7b6f825bccf15d17..76794189454f5dd935fcd77e3c89a1ce
|
||||
import io.netty.util.concurrent.Future;
|
||||
import io.netty.util.concurrent.GenericFutureListener;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry;
|
||||
@@ -38,6 +39,7 @@ import net.minecraft.nbt.ListTag;
|
||||
@@ -37,6 +38,7 @@ import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.StringTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.network.Connection;
|
||||
+import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.chat.ChatType;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
@@ -258,6 +260,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -257,6 +259,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
private static final int MAX_SIGN_LINE_LENGTH = Integer.getInteger("Paper.maxSignLength", 80);
|
||||
private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
|
||||
|
||||
@ -33,7 +33,7 @@ index ce4f1ab41ec2e5f656114fbd7b6f825bccf15d17..76794189454f5dd935fcd77e3c89a1ce
|
||||
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
|
||||
this.server = server;
|
||||
this.connection = connection;
|
||||
@@ -2992,6 +2996,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -2996,6 +3000,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
private static final ResourceLocation CUSTOM_REGISTER = new ResourceLocation("register");
|
||||
private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister");
|
||||
|
||||
@ -42,7 +42,7 @@ index ce4f1ab41ec2e5f656114fbd7b6f825bccf15d17..76794189454f5dd935fcd77e3c89a1ce
|
||||
@Override
|
||||
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
|
||||
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
||||
@@ -3019,6 +3025,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -3023,6 +3029,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
try {
|
||||
byte[] data = new byte[packet.data.readableBytes()];
|
||||
packet.data.readBytes(data);
|
||||
@ -58,7 +58,7 @@ index ce4f1ab41ec2e5f656114fbd7b6f825bccf15d17..76794189454f5dd935fcd77e3c89a1ce
|
||||
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
|
||||
} catch (Exception ex) {
|
||||
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
|
||||
@@ -3028,6 +3043,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
@@ -3032,6 +3047,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
|
||||
}
|
||||
|
||||
@ -72,10 +72,10 @@ index ce4f1ab41ec2e5f656114fbd7b6f825bccf15d17..76794189454f5dd935fcd77e3c89a1ce
|
||||
return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 21a2f83aa91a41ea1f4e9e87e804d587838c0d45..c15d0bc8df85b81f8dec2d17b3b6eee9ef9ad1c8 100644
|
||||
index ac535aef823ebe286847dafb8b0678de5d3128a1..465961e0e21fe15c366a492a1de94c6da7bbc51c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2484,6 +2484,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2482,6 +2482,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
// Paper end
|
||||
};
|
||||
|
@ -5,23 +5,23 @@ Subject: [PATCH] Add #setMaxPlayers API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 9a73364f4d56f3a7cecb27bc8034166b8f5731b9..4d1d5dacb175e7059a6af036432ef891bcf77970 100644
|
||||
index 06a38986775b99faca2deddf1bcbea3c691c6521..9cec325fdcfd8b66bbeccb973cbe75ebd423fec4 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -145,7 +145,7 @@ public abstract class PlayerList {
|
||||
@@ -144,7 +144,7 @@ public abstract class PlayerList {
|
||||
public final PlayerDataStorage playerIo;
|
||||
private boolean doWhiteList;
|
||||
private final RegistryAccess.RegistryHolder registryHolder;
|
||||
- protected final int maxPlayers;
|
||||
+ protected int maxPlayers; public final void setMaxPlayers(int maxPlayers) { this.maxPlayers = maxPlayers; } // Paper - remove final and add setter
|
||||
private int viewDistance;
|
||||
private int simulationDistance;
|
||||
private boolean allowCheatsForAllPlayers;
|
||||
private static final boolean ALLOW_LOGOUTIVATOR = false;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 81effb4bc34d3cb4325510c1b0de39956961c427..ab7eae6483a8981f6324f9da671b3d41667c3768 100644
|
||||
index b1dfd1b13652807882e057ae4fb55f9a045d1a16..cd98fa713ecd0cb8d4bb2a9211ee9b9b89a04330 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -636,6 +636,13 @@ public final class CraftServer implements Server {
|
||||
@@ -674,6 +674,13 @@ public final class CraftServer implements Server {
|
||||
return this.playerList.getMaxPlayers();
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add playPickupItemAnimation to LivingEntity
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index e6ea5c09adbb3a20114d42ab3ac01969b64dfb28..95f08ceb8cf7ea91a6b7b53ada22b30965384083 100644
|
||||
index 639d376bf382409410e26385134d36fd6e3b5f0c..537d1a6dcf8add34e8dac8aee2fa50c50ce7e5d0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -838,5 +838,10 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
@ -5,7 +5,7 @@ Subject: [PATCH] Don't require FACING data
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java
|
||||
index 0c286d7254f653bc855b1cb329fa76e3c1669b3c..05c0f0049421bc897f8e722331e30a6756ebbeea 100644
|
||||
index 6939a6a9df7b8aa7103788285ecb5a1d4b734b55..ba6d3de82e409397a69fa95131b3a27486e3a774 100644
|
||||
--- a/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java
|
||||
+++ b/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java
|
||||
@@ -14,20 +14,22 @@ import org.bukkit.event.block.BlockDispenseEvent;
|
@ -5,10 +5,10 @@ Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 86d060691405401fe8ae8ae8ef59322ee841b196..1b13c67441c46208a9b2adde5ca109f90bbb92e2 100644
|
||||
index cdacb26699a54659d1e43ec0f73640556a743700..f9daa7183e29d203e73b242c285d10cda44aab11 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1707,6 +1707,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1688,6 +1688,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
//ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c()));
|
||||
|
||||
this.levelData.setSpawn(pos, angle);
|
||||
@ -17,7 +17,7 @@ index 86d060691405401fe8ae8ae8ef59322ee841b196..1b13c67441c46208a9b2adde5ca109f9
|
||||
// if this keepSpawnInMemory is false a plugin has already removed our tickets, do not re-add
|
||||
this.removeTicketsForSpawn(this.paperConfig.keepLoadedRange, prevSpawn);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 35414a944fdbff16005185a22ea845cc2f7163e7..60077813fabb0b26b23a051598cb03115a3afcc2 100644
|
||||
index 5bf060d5b4a22d0fea0c70513d9b0914614e5bbb..9e155f0a76014e84106d9e322016d36a2254f62a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -245,11 +245,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add moon phase API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 60077813fabb0b26b23a051598cb03115a3afcc2..c21b98fbd9b410e0e993f3073e5cbb37015776eb 100644
|
||||
index 9e155f0a76014e84106d9e322016d36a2254f62a..1f12da32b5bc10f77a5b8f4a9b32cbb89d7f2968 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -183,6 +183,11 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
@ -6,10 +6,10 @@ Subject: [PATCH] Prevent headless pistons from being created
|
||||
Prevent headless pistons from being created by explosions or tree/mushroom growth.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 64ccc906fef2c0988c30d289c392b13221b9b4c1..6b725dc2217e68255286caad6a0820bcccffb6da 100644
|
||||
index ebbbffd209c6796bc608992e293035141a122d1f..fdd8bf9eb44829c41483cf2de4c977a32face97f 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -465,6 +465,12 @@ public class PaperConfig {
|
||||
@@ -458,4 +458,9 @@ public class PaperConfig {
|
||||
set("settings.unsupported-settings.allow-tnt-duplication", null);
|
||||
}
|
||||
|
||||
@ -18,23 +18,12 @@ index 64ccc906fef2c0988c30d289c392b13221b9b4c1..6b725dc2217e68255286caad6a0820bc
|
||||
+ config.set("settings.unsupported-settings.allow-headless-pistons-readme", "This setting controls if players should be able to create headless pistons.");
|
||||
+ allowHeadlessPistons = getBoolean("settings.unsupported-settings.allow-headless-pistons", false);
|
||||
+ }
|
||||
+
|
||||
public static int playerAutoSaveRate = -1;
|
||||
public static int maxPlayerAutoSavePerTick = 10;
|
||||
private static void playerAutoSaveRate() {
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 1575fb0bbad6e11f25fb9ce51fd1f15a1b11e0fe..132140e00865fcf84ebe03ffcbc2f30ac11a0b35 100644
|
||||
index f0c789d339fe8402c9c2a684d7e0415fa298b20e..6795132318a4e8b4c7a33b6f4b89a730ea66b97f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -15,6 +15,7 @@ import java.util.Random;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.core.BlockPos;
|
||||
+import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
@@ -35,6 +36,8 @@ import net.minecraft.world.level.block.BaseFireBlock;
|
||||
@@ -34,6 +34,8 @@ import net.minecraft.world.level.block.BaseFireBlock;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
@ -43,7 +32,7 @@ index 1575fb0bbad6e11f25fb9ce51fd1f15a1b11e0fe..132140e00865fcf84ebe03ffcbc2f30a
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
@@ -189,6 +192,15 @@ public class Explosion {
|
||||
@@ -188,6 +190,15 @@ public class Explosion {
|
||||
|
||||
if (f > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockposition, iblockdata, f)) {
|
||||
set.add(blockposition);
|
||||
@ -51,7 +40,7 @@ index 1575fb0bbad6e11f25fb9ce51fd1f15a1b11e0fe..132140e00865fcf84ebe03ffcbc2f30a
|
||||
+ if (!com.destroystokyo.paper.PaperConfig.allowHeadlessPistons && iblockdata.getBlock() == Blocks.MOVING_PISTON) {
|
||||
+ BlockEntity extension = this.level.getBlockEntity(blockposition);
|
||||
+ if (extension instanceof PistonMovingBlockEntity && ((PistonMovingBlockEntity) extension).isSourcePiston()) {
|
||||
+ Direction direction = iblockdata.getValue(PistonHeadBlock.FACING);
|
||||
+ net.minecraft.core.Direction direction = iblockdata.getValue(PistonHeadBlock.FACING);
|
||||
+ set.add(blockposition.relative(direction.getOpposite()));
|
||||
+ }
|
||||
+ }
|
@ -5,10 +5,10 @@ Subject: [PATCH] Add zombie targets turtle egg config
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index f9caed53ffc10300511b576cf822864b101df83d..483f7f790173f1fc30f2b2b98e543098114c4cab 100644
|
||||
index a5361e1dba7c025667c7627b8851655bba2c9c6a..30d7e3d7c24aea43510135382bc9f482582fb7fa 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -57,6 +57,11 @@ public class PaperWorldConfig {
|
||||
@@ -55,6 +55,11 @@ public class PaperWorldConfig {
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,10 +21,10 @@ index f9caed53ffc10300511b576cf822864b101df83d..483f7f790173f1fc30f2b2b98e543098
|
||||
private void keepLoadedRange() {
|
||||
keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
index 20d8e705ea432df64917b59f8290aa5400795f4b..c210f83044ec2cddbfb776094da3d7f5f21df23b 100644
|
||||
index de140adee6679e27598ecd7fe292cd657c7af303..252a079d4867a5ce7fb6a982cf668d2348f7292f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
|
||||
@@ -109,7 +109,7 @@ public class Zombie extends Monster {
|
||||
@@ -106,7 +106,7 @@ public class Zombie extends Monster {
|
||||
|
||||
@Override
|
||||
protected void registerGoals() {
|
@ -8,21 +8,23 @@ the world per tick, this attempts to reduce the impact that join floods
|
||||
has on the server
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 6b725dc2217e68255286caad6a0820bcccffb6da..6733e78ba6bf2993bb2adde4cf9f1f6ca366679c 100644
|
||||
index fdd8bf9eb44829c41483cf2de4c977a32face97f..9a66cddbf9863aa6ff566a337153883c07c08e41 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -481,4 +481,9 @@ public class PaperConfig {
|
||||
maxPlayerAutoSavePerTick = (playerAutoSaveRate == -1 || playerAutoSaveRate > 100) ? 10 : 20;
|
||||
@@ -91,6 +91,11 @@ public class PaperConfig {
|
||||
}
|
||||
}
|
||||
+
|
||||
|
||||
+ public static int maxJoinsPerTick;
|
||||
+ private static void maxJoinsPerTick() {
|
||||
+ maxJoinsPerTick = getInt("settings.max-joins-per-tick", 3);
|
||||
+ }
|
||||
}
|
||||
+
|
||||
public static void registerCommands() {
|
||||
for (Map.Entry<String, Command> entry : commands.entrySet()) {
|
||||
MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Paper", entry.getValue());
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index 3faf9bc694016f3f46576a549814ff8e6070598a..7f6405ac44fef423dc8b21f3dbeaae26a1005077 100644
|
||||
index f13e24eede7f09ecc8f375df5e27e385f589005d..d30bc3f1da336b421d9a42070184e07169dd14e4 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -37,6 +37,7 @@ import net.minecraft.network.protocol.Packet;
|
@ -19,10 +19,10 @@ Aside from making the obvious class/function renames and obfhelpers I didn't nee
|
||||
Just added Bukkit's event system and took a few liberties with dead code and comment misspellings.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
index 483f7f790173f1fc30f2b2b98e543098114c4cab..b70be9eea934aa88a9597581dbd1fd5662876c2d 100644
|
||||
index 30d7e3d7c24aea43510135382bc9f482582fb7fa..aea942ddba54a23733cb32a0a1d0dcb82e247718 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||
@@ -62,6 +62,16 @@ public class PaperWorldConfig {
|
||||
@@ -60,6 +60,16 @@ public class PaperWorldConfig {
|
||||
zombiesTargetTurtleEggs = getBoolean("zombies-target-turtle-eggs", zombiesTargetTurtleEggs);
|
||||
}
|
||||
|
||||
@ -959,7 +959,7 @@ index 0000000000000000000000000000000000000000..d4273df8124d9d6d4a122f5ecef6f3d0
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
index 4698b567ced720946b14bd3e03a5b6e0dcf401fb..cdc040c657bfc70bd5b2a2d8251d2b2a2e94ab55 100644
|
||||
index 8472510a4614afd8e292d83aec67115b906b9adb..037330bcb10039c013b2ed5fd68dee16ede20fbe 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
@@ -1,5 +1,7 @@
|
||||
@ -970,7 +970,7 @@ index 4698b567ced720946b14bd3e03a5b6e0dcf401fb..cdc040c657bfc70bd5b2a2d8251d2b2a
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
@@ -256,6 +258,121 @@ public class RedStoneWireBlock extends Block {
|
||||
@@ -255,6 +257,121 @@ public class RedStoneWireBlock extends Block {
|
||||
return floor.isFaceSturdy(world, pos, Direction.UP) || floor.is(Blocks.HOPPER);
|
||||
}
|
||||
|
||||
@ -1092,7 +1092,7 @@ index 4698b567ced720946b14bd3e03a5b6e0dcf401fb..cdc040c657bfc70bd5b2a2d8251d2b2a
|
||||
private void updatePowerStrength(Level world, BlockPos pos, BlockState state) {
|
||||
int i = this.calculateTargetStrength(world, pos);
|
||||
|
||||
@@ -325,6 +442,7 @@ public class RedStoneWireBlock extends Block {
|
||||
@@ -324,6 +441,7 @@ public class RedStoneWireBlock extends Block {
|
||||
return Math.max(i, j - 1);
|
||||
}
|
||||
|
||||
@ -1100,7 +1100,7 @@ index 4698b567ced720946b14bd3e03a5b6e0dcf401fb..cdc040c657bfc70bd5b2a2d8251d2b2a
|
||||
private int getWireSignal(BlockState state) {
|
||||
return state.is((Block) this) ? (Integer) state.getValue(RedStoneWireBlock.POWER) : 0;
|
||||
}
|
||||
@@ -347,7 +465,7 @@ public class RedStoneWireBlock extends Block {
|
||||
@@ -346,7 +464,7 @@ public class RedStoneWireBlock extends Block {
|
||||
@Override
|
||||
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
|
||||
if (!oldState.is(state.getBlock()) && !world.isClientSide) {
|
||||
@ -1109,7 +1109,7 @@ index 4698b567ced720946b14bd3e03a5b6e0dcf401fb..cdc040c657bfc70bd5b2a2d8251d2b2a
|
||||
Iterator iterator = Direction.Plane.VERTICAL.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -374,7 +492,7 @@ public class RedStoneWireBlock extends Block {
|
||||
@@ -373,7 +491,7 @@ public class RedStoneWireBlock extends Block {
|
||||
world.updateNeighborsAt(pos.relative(enumdirection), this);
|
||||
}
|
||||
|
||||
@ -1118,7 +1118,7 @@ index 4698b567ced720946b14bd3e03a5b6e0dcf401fb..cdc040c657bfc70bd5b2a2d8251d2b2a
|
||||
this.updateNeighborsOfNeighboringWires(world, pos);
|
||||
}
|
||||
}
|
||||
@@ -409,7 +527,7 @@ public class RedStoneWireBlock extends Block {
|
||||
@@ -408,7 +526,7 @@ public class RedStoneWireBlock extends Block {
|
||||
public void neighborChanged(BlockState state, Level world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) {
|
||||
if (!world.isClientSide) {
|
||||
if (state.canSurvive(world, pos)) {
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren