Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9088)
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 5efeb7bd Also update compiler version c13b867a Update some Maven plugin versions deb28d9f PR-837: Add more bell API e938d62a PR-819: Allow Player#sendBlockDamage() to specify a source entity 0e75532c PR-818: Add more Guardian API, particularly for its laser a10155aa PR-839: Add BlockData#rotate and BlockData#mirror 77e690b4 PR-836: Add missing API for explosive minecarts 60722059 PR-832: Allow getting chunks without generating them and optimize chunk data request for ungenerated chunks 0a2c4b4b PR-834: Add Player#sendHurtAnimation() CraftBukkit Changes: be8682aa8 Also update compiler version 08e305f5b Update some Maven plugin versions 187bdd463 PR-1160: Add more bell API 2f8e5bc7c PR-1145: Allow Player#sendBlockDamage() to specify a source entity bcbb61b36 PR-1144: Add more Guardian API, particularly for its laser 722ddff6d PR-1162: Add BlockData#rotate and BlockData#mirror 80998277c PR-1159: Add missing API for explosive minecarts 1fddefce1 PR-1155: Allow getting chunks without generating them and optimize chunk data request for ungenerated chunks 20e8a486f PR-1157: Add Player#sendHurtAnimation() Spigot Changes: b31949f2 Rebuild patches
This commit is contained in:
parent
ad6c14c62e
commit
29b17a892d
274 changed files with 557 additions and 771 deletions
|
@ -22,7 +22,7 @@ wants it to collect even faster, they can restore that setting back to 1 instead
|
|||
Not adding it to .getType() though to keep behavior consistent with vanilla for performance reasons.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 5b29bdd8c39bcdec81ed58b8e06ec6b6940363ab..fb98133b733b86596272609533d311633cbf9231 100644
|
||||
index 777f114e9cb0cfa3633b9a89116be1c73d552065..4056ba7e9860c8eb8ccd265d9c5ca575c1cabd24 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -369,7 +369,7 @@ public final class CraftServer implements Server {
|
||||
|
@ -44,33 +44,38 @@ index 5b29bdd8c39bcdec81ed58b8e06ec6b6940363ab..fb98133b733b86596272609533d31163
|
|||
this.printSaveWarning = false;
|
||||
console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index efa01ad6ac0757da033f2bdf7729717239e474f2..977004b4b5a294c4eab2995777df6fb1faff4625 100644
|
||||
index 0084dceef60b23fa79fadc0a3c1a06c1a3b048cd..3cf399c2e698af057e8e3c7036d8967318e0c415 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -281,8 +281,21 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -282,7 +282,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
|
||||
@Override
|
||||
public Chunk getChunkAt(int x, int z) {
|
||||
- return this.world.getChunkSource().getChunk(x, z, true).bukkitChunk;
|
||||
- net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk) this.world.getChunk(x, z, ChunkStatus.FULL, true);
|
||||
+ // Paper start - add ticket to hold chunk for a little while longer if plugin accesses it
|
||||
+ net.minecraft.world.level.chunk.LevelChunk chunk = world.getChunkSource().getChunkAtIfLoadedImmediately(x, z);
|
||||
+ net.minecraft.world.level.chunk.LevelChunk chunk = this.world.getChunkSource().getChunkAtIfLoadedImmediately(x, z);
|
||||
+ if (chunk == null) {
|
||||
+ addTicket(x, z);
|
||||
+ this.addTicket(x, z);
|
||||
+ chunk = this.world.getChunkSource().getChunk(x, z, true);
|
||||
+ }
|
||||
+ return chunk.bukkitChunk;
|
||||
+ // Paper end
|
||||
+ }
|
||||
+
|
||||
return new CraftChunk(chunk);
|
||||
}
|
||||
|
||||
@@ -296,6 +302,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
return new CraftChunk(this.getHandle(), x, z);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ private void addTicket(int x, int z) {
|
||||
+ io.papermc.paper.util.MCUtil.MAIN_EXECUTOR.execute(() -> world.getChunkSource().addRegionTicket(TicketType.PLUGIN, new ChunkPos(x, z), 0, Unit.INSTANCE)); // Paper
|
||||
}
|
||||
+ io.papermc.paper.util.MCUtil.MAIN_EXECUTOR.execute(() -> this.world.getChunkSource().addRegionTicket(TicketType.PLUGIN, new ChunkPos(x, z), 0, Unit.INSTANCE)); // Paper
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
+
|
||||
@Override
|
||||
public Chunk getChunkAt(Block block) {
|
||||
@@ -349,7 +362,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
Preconditions.checkArgument(block != null, "null block");
|
||||
@@ -361,7 +373,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
public boolean unloadChunkRequest(int x, int z) {
|
||||
org.spigotmc.AsyncCatcher.catchOp("chunk unload"); // Spigot
|
||||
if (this.isChunkLoaded(x, z)) {
|
||||
|
@ -79,7 +84,7 @@ index efa01ad6ac0757da033f2bdf7729717239e474f2..977004b4b5a294c4eab2995777df6fb1
|
|||
}
|
||||
|
||||
return true;
|
||||
@@ -435,9 +448,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -447,9 +459,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot
|
||||
// Paper start - Optimize this method
|
||||
ChunkPos chunkPos = new ChunkPos(x, z);
|
||||
|
@ -93,7 +98,7 @@ index efa01ad6ac0757da033f2bdf7729717239e474f2..977004b4b5a294c4eab2995777df6fb1
|
|||
if (immediate == null) {
|
||||
immediate = world.getChunkSource().chunkMap.getUnloadingChunk(x, z);
|
||||
}
|
||||
@@ -445,7 +461,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -457,7 +472,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
if (!(immediate instanceof ImposterProtoChunk) && !(immediate instanceof net.minecraft.world.level.chunk.LevelChunk)) {
|
||||
return false; // not full status
|
||||
}
|
||||
|
@ -102,7 +107,7 @@ index efa01ad6ac0757da033f2bdf7729717239e474f2..977004b4b5a294c4eab2995777df6fb1
|
|||
world.getChunk(x, z); // make sure we're at ticket level 32 or lower
|
||||
return true;
|
||||
}
|
||||
@@ -471,7 +487,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -483,7 +498,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
// we do this so we do not re-read the chunk data on disk
|
||||
}
|
||||
|
||||
|
@ -111,11 +116,11 @@ index efa01ad6ac0757da033f2bdf7729717239e474f2..977004b4b5a294c4eab2995777df6fb1
|
|||
world.getChunkSource().getChunk(x, z, ChunkStatus.FULL, true);
|
||||
return true;
|
||||
// Paper end
|
||||
@@ -2164,6 +2180,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -2175,6 +2190,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
io.papermc.paper.chunk.system.ChunkSystem.scheduleChunkLoad(this.getHandle(), x, z, gen, ChunkStatus.FULL, true, priority, (c) -> {
|
||||
net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> {
|
||||
net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk)c;
|
||||
+ if (chunk != null) addTicket(x, z); // Paper
|
||||
ret.complete(chunk == null ? null : chunk.getBukkitChunk());
|
||||
+ if (chunk != null) this.addTicket(x, z); // Paper
|
||||
ret.complete(chunk == null ? null : new CraftChunk(chunk));
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue