More more work

This commit is contained in:
Nassim Jahnke 2023-12-05 20:39:26 +01:00
parent 603b32976b
commit d7fc0c5ab2
35 changed files with 242 additions and 246 deletions

View file

@ -4851,7 +4851,7 @@ index 0d536d72ac918fbd403397ff369d10143ee9c204..6051e5f272838ef23276a90e21c2fc82
public static <T> TicketType<T> create(String name, Comparator<T> argumentComparator) { public static <T> TicketType<T> create(String name, Comparator<T> argumentComparator) {
return new TicketType<>(name, argumentComparator, 0L); return new TicketType<>(name, argumentComparator, 0L);
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
index e96a0ca47e4701ba187555bd92c968345bc85677..33091331ec742767611fad1ab2a324fa334650c5 100644 index d11741d2618976bdb51f75d823f260f32d5bafc9..23dfc741b31cdc25265fb5daffcae63417102a41 100644
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java --- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java +++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
@@ -107,6 +107,27 @@ public class WorldGenRegion implements WorldGenLevel { @@ -107,6 +107,27 @@ public class WorldGenRegion implements WorldGenLevel {
@ -4883,10 +4883,10 @@ index e96a0ca47e4701ba187555bd92c968345bc85677..33091331ec742767611fad1ab2a324fa
return this.level.getChunkSource().chunkMap.isOldChunkAround(chunkPos, checkRadius); return this.level.getChunkSource().chunkMap.isOldChunkAround(chunkPos, checkRadius);
} }
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index 2b8e88a75e9a974e1ecafe0360a9d69b79326d11..6c171199dcc30f56a6d0ab7ecf398b505d145067 100644 index 07e41b936f5f229876cf9ff5cd8d6278088eee48..bf42cead5fa040d87da28d7be521b109724da19b 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -807,6 +807,7 @@ public abstract class BlockBehaviour implements FeatureElement { @@ -874,6 +874,7 @@ public abstract class BlockBehaviour implements FeatureElement {
this.spawnTerrainParticles = blockbase_info.spawnTerrainParticles; this.spawnTerrainParticles = blockbase_info.spawnTerrainParticles;
this.instrument = blockbase_info.instrument; this.instrument = blockbase_info.instrument;
this.replaceable = blockbase_info.replaceable; this.replaceable = blockbase_info.replaceable;
@ -4894,7 +4894,7 @@ index 2b8e88a75e9a974e1ecafe0360a9d69b79326d11..6c171199dcc30f56a6d0ab7ecf398b50
} }
private boolean calculateSolid() { private boolean calculateSolid() {
@@ -835,6 +836,18 @@ public abstract class BlockBehaviour implements FeatureElement { @@ -902,6 +903,18 @@ public abstract class BlockBehaviour implements FeatureElement {
return this.shapeExceedsCube; return this.shapeExceedsCube;
} }
// Paper end // Paper end
@ -4913,7 +4913,7 @@ index 2b8e88a75e9a974e1ecafe0360a9d69b79326d11..6c171199dcc30f56a6d0ab7ecf398b50
public void initCache() { public void initCache() {
this.fluidState = ((Block) this.owner).getFluidState(this.asState()); this.fluidState = ((Block) this.owner).getFluidState(this.asState());
@@ -843,6 +856,7 @@ public abstract class BlockBehaviour implements FeatureElement { @@ -910,6 +923,7 @@ public abstract class BlockBehaviour implements FeatureElement {
this.cache = new BlockBehaviour.BlockStateBase.Cache(this.asState()); this.cache = new BlockBehaviour.BlockStateBase.Cache(this.asState());
} }
this.shapeExceedsCube = this.cache == null || this.cache.largeCollisionShape; // Paper - moved from actual method to here this.shapeExceedsCube = this.cache == null || this.cache.largeCollisionShape; // Paper - moved from actual method to here

View file

@ -16640,10 +16640,10 @@ index a5e438a834826161c52ca9db57d234d9ff80a591..b8bc1b9b8e8a33df90a963f9f9769292
@Override @Override
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index ae0b713870976d4b1e469a90cef9b2e282dbcaab..646cd39c46d86899f23c8179c0790e32d03f954f 100644 index 884731fa4ebbbdc7c06ff670941f36ef3bf384ad..360ecf561cde34b07929519a67485e0315e4676c 100644
--- a/src/main/java/net/minecraft/server/Main.java --- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java
@@ -279,6 +279,7 @@ public class Main { @@ -305,6 +305,7 @@ public class Main {
convertable_conversionsession.saveDataTag(iregistrycustom_dimension, savedata); convertable_conversionsession.saveDataTag(iregistrycustom_dimension, savedata);
*/ */
@ -16652,10 +16652,10 @@ index ae0b713870976d4b1e469a90cef9b2e282dbcaab..646cd39c46d86899f23c8179c0790e32
DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, worldLoader.get(), thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataFixers.getDataFixer(), services, LoggerChunkProgressListener::new); DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, worldLoader.get(), thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataFixers.getDataFixer(), services, LoggerChunkProgressListener::new);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 7abd42e34ce14618f4987933cdd230879b6ac804..27ab6d2749b89cc5d3fd4e22603daee95634be71 100644 index 337a1e89ba63471ea6b413cdec3e68d343a0b46b..2021526bf6b8bdc286c31aaa62ab0235fac073cd 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -294,7 +294,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -300,7 +300,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) { public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference(); AtomicReference<S> atomicreference = new AtomicReference();
@ -16664,7 +16664,7 @@ index 7abd42e34ce14618f4987933cdd230879b6ac804..27ab6d2749b89cc5d3fd4e22603daee9
((MinecraftServer) atomicreference.get()).runServer(); ((MinecraftServer) atomicreference.get()).runServer();
}, "Server thread"); }, "Server thread");
@@ -571,7 +571,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -617,7 +617,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.forceDifficulty(); this.forceDifficulty();
for (ServerLevel worldserver : this.getAllLevels()) { for (ServerLevel worldserver : this.getAllLevels()) {
this.prepareLevels(worldserver.getChunkSource().chunkMap.progressListener, worldserver); this.prepareLevels(worldserver.getChunkSource().chunkMap.progressListener, worldserver);
@ -16673,7 +16673,7 @@ index 7abd42e34ce14618f4987933cdd230879b6ac804..27ab6d2749b89cc5d3fd4e22603daee9
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld())); this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
} }
@@ -767,6 +767,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -813,6 +813,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public abstract boolean shouldRconBroadcast(); public abstract boolean shouldRconBroadcast();
public boolean saveAllChunks(boolean suppressLogs, boolean flush, boolean force) { public boolean saveAllChunks(boolean suppressLogs, boolean flush, boolean force) {
@ -16686,7 +16686,7 @@ index 7abd42e34ce14618f4987933cdd230879b6ac804..27ab6d2749b89cc5d3fd4e22603daee9
boolean flag3 = false; boolean flag3 = false;
for (Iterator iterator = this.getAllLevels().iterator(); iterator.hasNext(); flag3 = true) { for (Iterator iterator = this.getAllLevels().iterator(); iterator.hasNext(); flag3 = true) {
@@ -775,8 +781,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -821,8 +827,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (!suppressLogs) { if (!suppressLogs) {
MinecraftServer.LOGGER.info("Saving chunks for level '{}'/{}", worldserver, worldserver.dimension().location()); MinecraftServer.LOGGER.info("Saving chunks for level '{}'/{}", worldserver, worldserver.dimension().location());
} }
@ -16701,7 +16701,7 @@ index 7abd42e34ce14618f4987933cdd230879b6ac804..27ab6d2749b89cc5d3fd4e22603daee9
} }
// CraftBukkit start - moved to WorldServer.save // CraftBukkit start - moved to WorldServer.save
@@ -795,7 +805,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -841,7 +851,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
while (iterator1.hasNext()) { while (iterator1.hasNext()) {
ServerLevel worldserver2 = (ServerLevel) iterator1.next(); ServerLevel worldserver2 = (ServerLevel) iterator1.next();
@ -16710,14 +16710,14 @@ index 7abd42e34ce14618f4987933cdd230879b6ac804..27ab6d2749b89cc5d3fd4e22603daee9
} }
MinecraftServer.LOGGER.info("ThreadedAnvilChunkStorage: All dimensions are saved"); MinecraftServer.LOGGER.info("ThreadedAnvilChunkStorage: All dimensions are saved");
@@ -872,36 +882,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -918,36 +928,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
} }
- while (this.levels.values().stream().anyMatch((worldserver1) -> { - while (this.levels.values().stream().anyMatch((worldserver1) -> {
- return worldserver1.getChunkSource().chunkMap.hasWork(); - return worldserver1.getChunkSource().chunkMap.hasWork();
- })) { - })) {
- this.nextTickTime = Util.getMillis() + 1L; - this.nextTickTimeNanos = Util.getNanos() + TimeUtil.NANOSECONDS_PER_MILLISECOND;
- iterator = this.getAllLevels().iterator(); - iterator = this.getAllLevels().iterator();
- -
- while (iterator.hasNext()) { - while (iterator.hasNext()) {
@ -16748,7 +16748,7 @@ index 7abd42e34ce14618f4987933cdd230879b6ac804..27ab6d2749b89cc5d3fd4e22603daee9
this.isSaving = false; this.isSaving = false;
this.resources.close(); this.resources.close();
@@ -920,7 +901,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -966,7 +947,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getProfileCache().save(); this.getProfileCache().save();
} }
// Spigot end // Spigot end
@ -16757,7 +16757,7 @@ index 7abd42e34ce14618f4987933cdd230879b6ac804..27ab6d2749b89cc5d3fd4e22603daee9
} }
public String getLocalIp() { public String getLocalIp() {
@@ -954,6 +935,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1000,6 +981,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
// Spigot End // Spigot End
@ -16766,9 +16766,9 @@ index 7abd42e34ce14618f4987933cdd230879b6ac804..27ab6d2749b89cc5d3fd4e22603daee9
protected void runServer() { protected void runServer() {
try { try {
if (!this.initServer()) { if (!this.initServer()) {
@@ -968,6 +951,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1014,6 +997,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
Arrays.fill( this.recentTps, 20 ); Arrays.fill( this.recentTps, 20 );
long curTime, tickSection = Util.getMillis(), tickCount = 1; long tickSection = Util.getMillis(), tickCount = 1;
while (this.running) { while (this.running) {
+ // Paper start - rewrite chunk system + // Paper start - rewrite chunk system
+ // guarantee that nothing can stop the server from halting if it can at least still tick + // guarantee that nothing can stop the server from halting if it can at least still tick
@ -16776,10 +16776,10 @@ index 7abd42e34ce14618f4987933cdd230879b6ac804..27ab6d2749b89cc5d3fd4e22603daee9
+ throw this.chunkSystemCrash; + throw this.chunkSystemCrash;
+ } + }
+ // Paper end - rewrite chunk system + // Paper end - rewrite chunk system
long i = (curTime = Util.getMillis()) - this.nextTickTime; long i;
if (i > 5000L && this.nextTickTime - this.lastOverloadWarning >= 30000L) { // CraftBukkit if (!this.isPaused() && this.tickRateManager.isSprinting() && this.tickRateManager.checkShouldSprintThisTick()) {
@@ -1080,6 +1069,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1144,6 +1133,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
private boolean haveTime() { private boolean haveTime() {
@ -16790,8 +16790,8 @@ index 7abd42e34ce14618f4987933cdd230879b6ac804..27ab6d2749b89cc5d3fd4e22603daee9
+ // Paper end + // Paper end
// CraftBukkit start // CraftBukkit start
if (isOversleep) return canOversleep();// Paper - because of our changes, this logic is broken if (isOversleep) return canOversleep();// Paper - because of our changes, this logic is broken
return this.forceTicks || this.runningTask() || Util.getMillis() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTime : this.nextTickTime); return this.forceTicks || this.runningTask() || Util.getNanos() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTimeNanos : this.nextTickTimeNanos);
@@ -2243,7 +2237,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2357,7 +2351,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start // CraftBukkit start
@Override @Override
public boolean isSameThread() { public boolean isSameThread() {
@ -16801,7 +16801,7 @@ index 7abd42e34ce14618f4987933cdd230879b6ac804..27ab6d2749b89cc5d3fd4e22603daee9
public boolean isDebugging() { public boolean isDebugging() {
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 4b94b1ca21dbc0d9f993c5c9b86965f03aef75b4..64958f6cb9162de791ac90e08b19368a7fc59064 100644 index cb95818bfb5f0a9274b4e0f2530000bfca7ffc87..b6d5e0962abb62a30c1561d3b1e970884b5b13dc 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -399,7 +399,34 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -399,7 +399,34 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -19101,10 +19101,10 @@ index f3c9a3dbb6f0e6f825b7477c89ed72ed52845419..942042863f0105769c15b865d4d98a09
+ */ // Paper - rewrite chunk system + */ // Paper - rewrite chunk system
} }
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index c2db2aad2498f0be2e904d5869a9b0bd3411618c..b2367f3836689f3aa27b1b4905219e07e6173c93 100644 index d62f6ef628f591e4362c4aa7db9d38fa2304af4c..fe4fc7792ac1bfcde0980884a6369d08e81a6b65 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -141,108 +141,7 @@ public class ServerChunkCache extends ChunkSource { @@ -139,108 +139,7 @@ public class ServerChunkCache extends ChunkSource {
return (LevelChunk)this.getChunk(x, z, ChunkStatus.FULL, true); return (LevelChunk)this.getChunk(x, z, ChunkStatus.FULL, true);
} }
@ -19214,7 +19214,7 @@ index c2db2aad2498f0be2e904d5869a9b0bd3411618c..b2367f3836689f3aa27b1b4905219e07
// Paper end // Paper end
// Paper start // Paper start
@@ -256,34 +155,6 @@ public class ServerChunkCache extends ChunkSource { @@ -254,34 +153,6 @@ public class ServerChunkCache extends ChunkSource {
return holder.getLastAvailable(); return holder.getLastAvailable();
} }
@ -19249,7 +19249,7 @@ index c2db2aad2498f0be2e904d5869a9b0bd3411618c..b2367f3836689f3aa27b1b4905219e07
public <T> void addTicketAtLevel(TicketType<T> ticketType, ChunkPos chunkPos, int ticketLevel, T identifier) { public <T> void addTicketAtLevel(TicketType<T> ticketType, ChunkPos chunkPos, int ticketLevel, T identifier) {
this.distanceManager.addTicket(ticketType, chunkPos, ticketLevel, identifier); this.distanceManager.addTicket(ticketType, chunkPos, ticketLevel, identifier);
} }
@@ -367,7 +238,7 @@ public class ServerChunkCache extends ChunkSource { @@ -365,7 +236,7 @@ public class ServerChunkCache extends ChunkSource {
public LevelChunk getChunkAtIfLoadedImmediately(int x, int z) { public LevelChunk getChunkAtIfLoadedImmediately(int x, int z) {
long k = ChunkPos.asLong(x, z); long k = ChunkPos.asLong(x, z);
@ -19258,7 +19258,7 @@ index c2db2aad2498f0be2e904d5869a9b0bd3411618c..b2367f3836689f3aa27b1b4905219e07
return this.getChunkAtIfLoadedMainThread(x, z); return this.getChunkAtIfLoadedMainThread(x, z);
} }
@@ -393,7 +264,8 @@ public class ServerChunkCache extends ChunkSource { @@ -391,7 +262,8 @@ public class ServerChunkCache extends ChunkSource {
@Nullable @Nullable
@Override @Override
public ChunkAccess getChunk(int x, int z, ChunkStatus leastStatus, boolean create) { public ChunkAccess getChunk(int x, int z, ChunkStatus leastStatus, boolean create) {
@ -19268,7 +19268,7 @@ index c2db2aad2498f0be2e904d5869a9b0bd3411618c..b2367f3836689f3aa27b1b4905219e07
return (ChunkAccess) CompletableFuture.supplyAsync(() -> { return (ChunkAccess) CompletableFuture.supplyAsync(() -> {
return this.getChunk(x, z, leastStatus, create); return this.getChunk(x, z, leastStatus, create);
}, this.mainThreadProcessor).join(); }, this.mainThreadProcessor).join();
@@ -405,23 +277,20 @@ public class ServerChunkCache extends ChunkSource { @@ -403,23 +275,20 @@ public class ServerChunkCache extends ChunkSource {
ChunkAccess ichunkaccess; ChunkAccess ichunkaccess;
@ -19298,7 +19298,7 @@ index c2db2aad2498f0be2e904d5869a9b0bd3411618c..b2367f3836689f3aa27b1b4905219e07
this.level.timings.syncChunkLoad.stopTiming(); // Paper this.level.timings.syncChunkLoad.stopTiming(); // Paper
} // Paper } // Paper
ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
@@ -441,7 +310,7 @@ public class ServerChunkCache extends ChunkSource { @@ -439,7 +308,7 @@ public class ServerChunkCache extends ChunkSource {
@Nullable @Nullable
@Override @Override
public LevelChunk getChunkNow(int chunkX, int chunkZ) { public LevelChunk getChunkNow(int chunkX, int chunkZ) {
@ -19307,7 +19307,7 @@ index c2db2aad2498f0be2e904d5869a9b0bd3411618c..b2367f3836689f3aa27b1b4905219e07
return null; return null;
} else { } else {
this.level.getProfiler().incrementCounter("getChunkNow"); this.level.getProfiler().incrementCounter("getChunkNow");
@@ -487,7 +356,7 @@ public class ServerChunkCache extends ChunkSource { @@ -485,7 +354,7 @@ public class ServerChunkCache extends ChunkSource {
} }
public CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getChunkFuture(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) { public CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getChunkFuture(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) {
@ -19316,7 +19316,7 @@ index c2db2aad2498f0be2e904d5869a9b0bd3411618c..b2367f3836689f3aa27b1b4905219e07
CompletableFuture completablefuture; CompletableFuture completablefuture;
if (flag1) { if (flag1) {
@@ -508,47 +377,52 @@ public class ServerChunkCache extends ChunkSource { @@ -506,47 +375,52 @@ public class ServerChunkCache extends ChunkSource {
} }
private CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getChunkFutureMainThread(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) { private CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getChunkFutureMainThread(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) {
@ -19401,7 +19401,7 @@ index c2db2aad2498f0be2e904d5869a9b0bd3411618c..b2367f3836689f3aa27b1b4905219e07
} }
@Nullable @Nullable
@@ -560,22 +434,13 @@ public class ServerChunkCache extends ChunkSource { @@ -558,22 +432,13 @@ public class ServerChunkCache extends ChunkSource {
if (playerchunk == null) { if (playerchunk == null) {
return null; return null;
} else { } else {
@ -19430,7 +19430,7 @@ index c2db2aad2498f0be2e904d5869a9b0bd3411618c..b2367f3836689f3aa27b1b4905219e07
} }
} }
@@ -589,15 +454,7 @@ public class ServerChunkCache extends ChunkSource { @@ -587,15 +452,7 @@ public class ServerChunkCache extends ChunkSource {
} }
boolean runDistanceManagerUpdates() { boolean runDistanceManagerUpdates() {
@ -19447,7 +19447,7 @@ index c2db2aad2498f0be2e904d5869a9b0bd3411618c..b2367f3836689f3aa27b1b4905219e07
} }
// Paper start // Paper start
@@ -607,17 +464,10 @@ public class ServerChunkCache extends ChunkSource { @@ -605,17 +462,10 @@ public class ServerChunkCache extends ChunkSource {
// Paper end // Paper end
public boolean isPositionTicking(long pos) { public boolean isPositionTicking(long pos) {
@ -19469,7 +19469,7 @@ index c2db2aad2498f0be2e904d5869a9b0bd3411618c..b2367f3836689f3aa27b1b4905219e07
} }
public void save(boolean flush) { public void save(boolean flush) {
@@ -633,17 +483,13 @@ public class ServerChunkCache extends ChunkSource { @@ -631,17 +481,13 @@ public class ServerChunkCache extends ChunkSource {
this.close(true); this.close(true);
} }
@ -19490,15 +19490,15 @@ index c2db2aad2498f0be2e904d5869a9b0bd3411618c..b2367f3836689f3aa27b1b4905219e07
this.level.getProfiler().push("purge"); this.level.getProfiler().push("purge");
this.distanceManager.purgeStaleTickets(); this.distanceManager.purgeStaleTickets();
this.runDistanceManagerUpdates(); this.runDistanceManagerUpdates();
@@ -664,6 +510,7 @@ public class ServerChunkCache extends ChunkSource { @@ -662,6 +508,7 @@ public class ServerChunkCache extends ChunkSource {
this.level.getProfiler().popPush("chunks"); this.level.getProfiler().popPush("chunks");
if (tickChunks) { if (tickChunks) {
this.level.timings.chunks.startTiming(); // Paper - timings this.level.timings.chunks.startTiming(); // Paper - timings
+ this.chunkMap.level.playerChunkLoader.tick(); // Paper - replace player chunk loader - this is mostly required to account for view distance changes + this.chunkMap.level.playerChunkLoader.tick(); // Paper - replace player chunk loader - this is mostly required to account for view distance changes
this.tickChunks(); this.tickChunks();
this.level.timings.chunks.stopTiming(); // Paper - timings this.level.timings.chunks.stopTiming(); // Paper - timings
} this.chunkMap.tick();
@@ -760,7 +607,12 @@ public class ServerChunkCache extends ChunkSource { @@ -756,7 +603,12 @@ public class ServerChunkCache extends ChunkSource {
ChunkHolder playerchunk = this.getVisibleChunkIfPresent(pos); ChunkHolder playerchunk = this.getVisibleChunkIfPresent(pos);
if (playerchunk != null) { if (playerchunk != null) {
@ -19512,7 +19512,7 @@ index c2db2aad2498f0be2e904d5869a9b0bd3411618c..b2367f3836689f3aa27b1b4905219e07
} }
} }
@@ -926,17 +778,10 @@ public class ServerChunkCache extends ChunkSource { @@ -922,17 +774,10 @@ public class ServerChunkCache extends ChunkSource {
@Override @Override
// CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task // CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task
public boolean pollTask() { public boolean pollTask() {
@ -19532,10 +19532,10 @@ index c2db2aad2498f0be2e904d5869a9b0bd3411618c..b2367f3836689f3aa27b1b4905219e07
} }
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 2a3f9168d38350eb3f6d97836fea70ae3023204d..fb183bff8844b6f9db5611b9b55b641f4ec438ff 100644 index b698cdc4ef9e2bf824b9e5a4f985b6832c15f8f6..51f0705499003ea71274e1d5c8a77306fa868485 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -194,7 +194,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -196,7 +196,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
private final MinecraftServer server; private final MinecraftServer server;
public final PrimaryLevelData serverLevelData; // CraftBukkit - type public final PrimaryLevelData serverLevelData; // CraftBukkit - type
final EntityTickList entityTickList; final EntityTickList entityTickList;
@ -19544,7 +19544,7 @@ index 2a3f9168d38350eb3f6d97836fea70ae3023204d..fb183bff8844b6f9db5611b9b55b641f
private final GameEventDispatcher gameEventDispatcher; private final GameEventDispatcher gameEventDispatcher;
public boolean noSave; public boolean noSave;
private final SleepStatus sleepStatus; private final SleepStatus sleepStatus;
@@ -260,50 +260,65 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -262,50 +262,65 @@ public class ServerLevel extends Level implements WorldGenLevel {
return true; return true;
} }
@ -19637,7 +19637,7 @@ index 2a3f9168d38350eb3f6d97836fea70ae3023204d..fb183bff8844b6f9db5611b9b55b641f
chunkProvider.addTicketAtLevel(TicketType.UNKNOWN, chunkPos, ticketLevel, chunkPos); chunkProvider.addTicketAtLevel(TicketType.UNKNOWN, chunkPos, ticketLevel, chunkPos);
chunkProvider.removeTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, holderIdentifier); chunkProvider.removeTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, holderIdentifier);
@@ -315,12 +330,223 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -317,12 +332,223 @@ public class ServerLevel extends Level implements WorldGenLevel {
for (int cx = minChunkX; cx <= maxChunkX; ++cx) { for (int cx = minChunkX; cx <= maxChunkX; ++cx) {
for (int cz = minChunkZ; cz <= maxChunkZ; ++cz) { for (int cz = minChunkZ; cz <= maxChunkZ; ++cz) {
io.papermc.paper.chunk.system.ChunkSystem.scheduleChunkLoad( io.papermc.paper.chunk.system.ChunkSystem.scheduleChunkLoad(
@ -19863,7 +19863,7 @@ index 2a3f9168d38350eb3f6d97836fea70ae3023204d..fb183bff8844b6f9db5611b9b55b641f
// Add env and gen to constructor, IWorldDataServer -> WorldDataServer // Add env and gen to constructor, IWorldDataServer -> WorldDataServer
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
@@ -364,16 +590,16 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -366,16 +592,16 @@ public class ServerLevel extends Level implements WorldGenLevel {
// CraftBukkit end // CraftBukkit end
boolean flag2 = minecraftserver.forceSynchronousWrites(); boolean flag2 = minecraftserver.forceSynchronousWrites();
DataFixer datafixer = minecraftserver.getFixerUpper(); DataFixer datafixer = minecraftserver.getFixerUpper();
@ -19885,7 +19885,7 @@ index 2a3f9168d38350eb3f6d97836fea70ae3023204d..fb183bff8844b6f9db5611b9b55b641f
return minecraftserver.overworld().getDataStorage(); return minecraftserver.overworld().getDataStorage();
}); });
this.chunkSource.getGeneratorState().ensureStructuresGenerated(); this.chunkSource.getGeneratorState().ensureStructuresGenerated();
@@ -402,6 +628,9 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -404,6 +630,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
return (RandomSequences) this.getDataStorage().computeIfAbsent(RandomSequences.factory(l), "random_sequences"); return (RandomSequences) this.getDataStorage().computeIfAbsent(RandomSequences.factory(l), "random_sequences");
}); });
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
@ -19895,7 +19895,7 @@ index 2a3f9168d38350eb3f6d97836fea70ae3023204d..fb183bff8844b6f9db5611b9b55b641f
} }
/** @deprecated */ /** @deprecated */
@@ -512,7 +741,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -529,7 +758,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
gameprofilerfiller.push("checkDespawn"); gameprofilerfiller.push("checkDespawn");
entity.checkDespawn(); entity.checkDespawn();
gameprofilerfiller.pop(); gameprofilerfiller.pop();
@ -19904,7 +19904,7 @@ index 2a3f9168d38350eb3f6d97836fea70ae3023204d..fb183bff8844b6f9db5611b9b55b641f
Entity entity1 = entity.getVehicle(); Entity entity1 = entity.getVehicle();
if (entity1 != null) { if (entity1 != null) {
@@ -537,13 +766,16 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -554,13 +783,16 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
gameprofilerfiller.push("entityManagement"); gameprofilerfiller.push("entityManagement");
@ -19923,7 +19923,7 @@ index 2a3f9168d38350eb3f6d97836fea70ae3023204d..fb183bff8844b6f9db5611b9b55b641f
} }
protected void tickTime() { protected void tickTime() {
@@ -1010,6 +1242,11 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1029,6 +1261,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
public void save(@Nullable ProgressListener progressListener, boolean flush, boolean savingDisabled) { public void save(@Nullable ProgressListener progressListener, boolean flush, boolean savingDisabled) {
@ -19935,7 +19935,7 @@ index 2a3f9168d38350eb3f6d97836fea70ae3023204d..fb183bff8844b6f9db5611b9b55b641f
ServerChunkCache chunkproviderserver = this.getChunkSource(); ServerChunkCache chunkproviderserver = this.getChunkSource();
if (!savingDisabled) { if (!savingDisabled) {
@@ -1025,16 +1262,13 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1044,16 +1281,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
timings.worldSaveChunks.startTiming(); // Paper timings.worldSaveChunks.startTiming(); // Paper
@ -19956,7 +19956,7 @@ index 2a3f9168d38350eb3f6d97836fea70ae3023204d..fb183bff8844b6f9db5611b9b55b641f
// CraftBukkit start - moved from MinecraftServer.saveChunks // CraftBukkit start - moved from MinecraftServer.saveChunks
ServerLevel worldserver1 = this; ServerLevel worldserver1 = this;
@@ -1170,7 +1404,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1189,7 +1423,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.removePlayerImmediately((ServerPlayer) entity, Entity.RemovalReason.DISCARDED); this.removePlayerImmediately((ServerPlayer) entity, Entity.RemovalReason.DISCARDED);
} }
@ -19965,7 +19965,7 @@ index 2a3f9168d38350eb3f6d97836fea70ae3023204d..fb183bff8844b6f9db5611b9b55b641f
} }
// CraftBukkit start // CraftBukkit start
@@ -1186,7 +1420,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1205,7 +1439,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
// CraftBukkit end // CraftBukkit end
@ -19974,7 +19974,7 @@ index 2a3f9168d38350eb3f6d97836fea70ae3023204d..fb183bff8844b6f9db5611b9b55b641f
} }
} }
@@ -1198,10 +1432,10 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1217,10 +1451,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
public boolean tryAddFreshEntityWithPassengers(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) { public boolean tryAddFreshEntityWithPassengers(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
// CraftBukkit end // CraftBukkit end
Stream<UUID> stream = entity.getSelfAndPassengers().map(Entity::getUUID); // CraftBukkit - decompile error Stream<UUID> stream = entity.getSelfAndPassengers().map(Entity::getUUID); // CraftBukkit - decompile error
@ -19988,7 +19988,7 @@ index 2a3f9168d38350eb3f6d97836fea70ae3023204d..fb183bff8844b6f9db5611b9b55b641f
return false; return false;
} else { } else {
this.addFreshEntityWithPassengers(entity, reason); // CraftBukkit this.addFreshEntityWithPassengers(entity, reason); // CraftBukkit
@@ -1712,7 +1946,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1736,7 +1970,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
} }
@ -19997,7 +19997,7 @@ index 2a3f9168d38350eb3f6d97836fea70ae3023204d..fb183bff8844b6f9db5611b9b55b641f
bufferedwriter.write(String.format(Locale.ROOT, "block_entity_tickers: %d\n", this.blockEntityTickers.size())); bufferedwriter.write(String.format(Locale.ROOT, "block_entity_tickers: %d\n", this.blockEntityTickers.size()));
bufferedwriter.write(String.format(Locale.ROOT, "block_ticks: %d\n", this.getBlockTicks().count())); bufferedwriter.write(String.format(Locale.ROOT, "block_ticks: %d\n", this.getBlockTicks().count()));
bufferedwriter.write(String.format(Locale.ROOT, "fluid_ticks: %d\n", this.getFluidTicks().count())); bufferedwriter.write(String.format(Locale.ROOT, "fluid_ticks: %d\n", this.getFluidTicks().count()));
@@ -1761,7 +1995,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1785,7 +2019,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
BufferedWriter bufferedwriter2 = Files.newBufferedWriter(path1); BufferedWriter bufferedwriter2 = Files.newBufferedWriter(path1);
try { try {
@ -20006,7 +20006,7 @@ index 2a3f9168d38350eb3f6d97836fea70ae3023204d..fb183bff8844b6f9db5611b9b55b641f
} catch (Throwable throwable4) { } catch (Throwable throwable4) {
if (bufferedwriter2 != null) { if (bufferedwriter2 != null) {
try { try {
@@ -1782,7 +2016,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1806,7 +2040,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
BufferedWriter bufferedwriter3 = Files.newBufferedWriter(path2); BufferedWriter bufferedwriter3 = Files.newBufferedWriter(path2);
try { try {
@ -20015,7 +20015,7 @@ index 2a3f9168d38350eb3f6d97836fea70ae3023204d..fb183bff8844b6f9db5611b9b55b641f
} catch (Throwable throwable6) { } catch (Throwable throwable6) {
if (bufferedwriter3 != null) { if (bufferedwriter3 != null) {
try { try {
@@ -1924,7 +2158,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1948,7 +2182,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@VisibleForTesting @VisibleForTesting
public String getWatchdogStats() { public String getWatchdogStats() {
@ -20024,7 +20024,7 @@ index 2a3f9168d38350eb3f6d97836fea70ae3023204d..fb183bff8844b6f9db5611b9b55b641f
return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString(); return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
}), this.blockEntityTickers.size(), ServerLevel.getTypeCount(this.blockEntityTickers, TickingBlockEntity::getType), this.getBlockTicks().count(), this.getFluidTicks().count(), this.gatherChunkSourceStats()); }), this.blockEntityTickers.size(), ServerLevel.getTypeCount(this.blockEntityTickers, TickingBlockEntity::getType), this.getBlockTicks().count(), this.getFluidTicks().count(), this.gatherChunkSourceStats());
} }
@@ -1984,15 +2218,15 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2008,15 +2242,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
@Override @Override
public LevelEntityGetter<Entity> getEntities() { public LevelEntityGetter<Entity> getEntities() {
org.spigotmc.AsyncCatcher.catchOp("Chunk getEntities call"); // Spigot org.spigotmc.AsyncCatcher.catchOp("Chunk getEntities call"); // Spigot
@ -20045,7 +20045,7 @@ index 2a3f9168d38350eb3f6d97836fea70ae3023204d..fb183bff8844b6f9db5611b9b55b641f
} }
public void startTickingChunk(LevelChunk chunk) { public void startTickingChunk(LevelChunk chunk) {
@@ -2008,34 +2242,49 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2032,34 +2266,49 @@ public class ServerLevel extends Level implements WorldGenLevel {
@Override @Override
public void close() throws IOException { public void close() throws IOException {
super.close(); super.close();
@ -20103,10 +20103,10 @@ index 2a3f9168d38350eb3f6d97836fea70ae3023204d..fb183bff8844b6f9db5611b9b55b641f
@Override @Override
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 936e3e0563a2443e13eae1e8875080187420cf4e..d7c4ce86956c0461603e8d569e9bebe39f07c8a1 100644 index b403b7d585f474e2b6029404d19e756a40206f7f..b6939932a4b8800c8751125a4a6d4dcea39110c1 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -257,6 +257,50 @@ public class ServerPlayer extends Player { @@ -265,6 +265,50 @@ public class ServerPlayer extends Player {
public boolean isRealPlayer; // Paper public boolean isRealPlayer; // Paper
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
@ -20402,7 +20402,7 @@ index 6051e5f272838ef23276a90e21c2fc821ca155d1..658e63ebde81dc14c8ab5850fb246dc0
public static <T> TicketType<T> create(String name, Comparator<T> argumentComparator) { public static <T> TicketType<T> create(String name, Comparator<T> argumentComparator) {
return new TicketType<>(name, argumentComparator, 0L); return new TicketType<>(name, argumentComparator, 0L);
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
index 33091331ec742767611fad1ab2a324fa334650c5..a38e279c9b36e539c45f410da827056a80acc43c 100644 index 23dfc741b31cdc25265fb5daffcae63417102a41..3f5ba2b2f01d8cc07c4200a60b1b08cb584b170e 100644
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java --- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java +++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
@@ -525,4 +525,21 @@ public class WorldGenRegion implements WorldGenLevel { @@ -525,4 +525,21 @@ public class WorldGenRegion implements WorldGenLevel {
@ -20474,10 +20474,10 @@ index c509a1318bcef38fd4927e38b6ee9846853e2d15..5de5209e04d631bd6a50e28e8d3abebf
this.desiredChunksPerTick = Double.isNaN((double)desiredBatchSize) ? 0.01F : Mth.clamp(desiredBatchSize, 0.01F, 64.0F); this.desiredChunksPerTick = Double.isNaN((double)desiredBatchSize) ? 0.01F : Mth.clamp(desiredBatchSize, 0.01F, 64.0F);
if (this.unacknowledgedBatches == 0) { if (this.unacknowledgedBatches == 0) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 0649344ca2290446ff27cf9fa0d6f84ad0fe91c2..70fe4e973f41c2e5b12c0d96be418dd40e69c0f2 100644 index d6b9fee57d22da0eaf3dcc4abfd3995d69abef95..b41351783ea9795afaddce453c82ab32cb8134a1 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -696,6 +696,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -699,6 +699,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.disconnect(Component.translatable("disconnect.spam")); this.disconnect(Component.translatable("disconnect.spam"));
return; return;
} }
@ -20492,10 +20492,10 @@ index 0649344ca2290446ff27cf9fa0d6f84ad0fe91c2..70fe4e973f41c2e5b12c0d96be418dd4
StringReader stringreader = new StringReader(packet.getCommand()); StringReader stringreader = new StringReader(packet.getCommand());
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 8f7bc04fc32e3b9c0625d795b09ea7f2e950fc05..afaa046ff1adf717ef8356cc276a55d63abc0aba 100644 index f5a4191977e8675952fc689744c8a39e86f62a07..fdf3bf3decb14378f5e59e41bab26e965bc7be14 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -251,7 +251,7 @@ public abstract class PlayerList { @@ -250,7 +250,7 @@ public abstract class PlayerList {
boolean flag2 = gamerules.getBoolean(GameRules.RULE_LIMITED_CRAFTING); boolean flag2 = gamerules.getBoolean(GameRules.RULE_LIMITED_CRAFTING);
// Spigot - view distance // Spigot - view distance
@ -20504,7 +20504,7 @@ index 8f7bc04fc32e3b9c0625d795b09ea7f2e950fc05..afaa046ff1adf717ef8356cc276a55d6
player.getBukkitEntity().sendSupportedChannels(); // CraftBukkit player.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
playerconnection.send(new ClientboundChangeDifficultyPacket(worlddata.getDifficulty(), worlddata.isDifficultyLocked())); playerconnection.send(new ClientboundChangeDifficultyPacket(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
playerconnection.send(new ClientboundPlayerAbilitiesPacket(player.getAbilities())); playerconnection.send(new ClientboundPlayerAbilitiesPacket(player.getAbilities()));
@@ -799,8 +799,8 @@ public abstract class PlayerList { @@ -798,8 +798,8 @@ public abstract class PlayerList {
LevelData worlddata = worldserver2.getLevelData(); LevelData worlddata = worldserver2.getLevelData();
entityplayer1.connection.send(new ClientboundRespawnPacket(entityplayer1.createCommonSpawnInfo(worldserver2), (byte) i)); entityplayer1.connection.send(new ClientboundRespawnPacket(entityplayer1.createCommonSpawnInfo(worldserver2), (byte) i));
@ -20515,7 +20515,7 @@ index 8f7bc04fc32e3b9c0625d795b09ea7f2e950fc05..afaa046ff1adf717ef8356cc276a55d6
entityplayer1.connection.teleport(CraftLocation.toBukkit(entityplayer1.position(), worldserver2.getWorld(), entityplayer1.getYRot(), entityplayer1.getXRot())); // CraftBukkit entityplayer1.connection.teleport(CraftLocation.toBukkit(entityplayer1.position(), worldserver2.getWorld(), entityplayer1.getYRot(), entityplayer1.getXRot())); // CraftBukkit
entityplayer1.connection.send(new ClientboundSetDefaultSpawnPositionPacket(worldserver1.getSharedSpawnPos(), worldserver1.getSharedSpawnAngle())); entityplayer1.connection.send(new ClientboundSetDefaultSpawnPositionPacket(worldserver1.getSharedSpawnPos(), worldserver1.getSharedSpawnAngle()));
entityplayer1.connection.send(new ClientboundChangeDifficultyPacket(worlddata.getDifficulty(), worlddata.isDifficultyLocked())); entityplayer1.connection.send(new ClientboundChangeDifficultyPacket(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
@@ -1291,7 +1291,7 @@ public abstract class PlayerList { @@ -1292,7 +1292,7 @@ public abstract class PlayerList {
public void setViewDistance(int viewDistance) { public void setViewDistance(int viewDistance) {
this.viewDistance = viewDistance; this.viewDistance = viewDistance;
@ -20524,7 +20524,7 @@ index 8f7bc04fc32e3b9c0625d795b09ea7f2e950fc05..afaa046ff1adf717ef8356cc276a55d6
Iterator iterator = this.server.getAllLevels().iterator(); Iterator iterator = this.server.getAllLevels().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -1306,7 +1306,7 @@ public abstract class PlayerList { @@ -1307,7 +1307,7 @@ public abstract class PlayerList {
public void setSimulationDistance(int simulationDistance) { public void setSimulationDistance(int simulationDistance) {
this.simulationDistance = simulationDistance; this.simulationDistance = simulationDistance;
@ -20627,7 +20627,7 @@ index ca788f0dcec4a117b410fe8348969e056b138b1e..a6ac76707da39cf86113003b1f326433
public boolean remove(Object object) { public boolean remove(Object object) {
int i = this.findIndex((T)object); int i = this.findIndex((T)object);
diff --git a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java diff --git a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
index 495b52bfab14478f8285cc5471335a41244c199e..e16ef1b7c0bfe6d6194c09f6787a50fd9b28f55e 100644 index 640db9f71608310a64e09f1e3e677c01e6ccd98a..f2a7cb6ebed7a4b4019a09af2a025f624f6fe9c9 100644
--- a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java --- a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
+++ b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java +++ b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java
@@ -186,7 +186,11 @@ public class WorldUpgrader { @@ -186,7 +186,11 @@ public class WorldUpgrader {
@ -20643,10 +20643,10 @@ index 495b52bfab14478f8285cc5471335a41244c199e..e16ef1b7c0bfe6d6194c09f6787a50fd
if (flag1) { if (flag1) {
++this.converted; ++this.converted;
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 46853c3daa7f3f552632444fbf41624cfd1c8dc4..9eda990939b36c08a6f4820353942d6c8d43b42c 100644 index a1a744657f8802852c161258382c5891858ebfa6..fa3d294b36eb0c23b293466fc72bd2970a452b55 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -327,6 +327,58 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -332,6 +332,58 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
} }
// Paper end // Paper end
@ -20705,7 +20705,7 @@ index 46853c3daa7f3f552632444fbf41624cfd1c8dc4..9eda990939b36c08a6f4820353942d6c
public Entity(EntityType<?> type, Level world) { public Entity(EntityType<?> type, Level world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet(); this.id = Entity.ENTITY_COUNTER.incrementAndGet();
this.passengers = ImmutableList.of(); this.passengers = ImmutableList.of();
@@ -2264,11 +2316,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -2293,11 +2345,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return InteractionResult.PASS; return InteractionResult.PASS;
} }
@ -20719,8 +20719,8 @@ index 46853c3daa7f3f552632444fbf41624cfd1c8dc4..9eda990939b36c08a6f4820353942d6c
return false; return false;
} }
@@ -3588,6 +3640,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -3632,6 +3684,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}; }).count();
} }
+ // Paper start - rewrite chunk system + // Paper start - rewrite chunk system
@ -20734,9 +20734,9 @@ index 46853c3daa7f3f552632444fbf41624cfd1c8dc4..9eda990939b36c08a6f4820353942d6c
+ // Paper end - rewrite chunk system + // Paper end - rewrite chunk system
+ +
public boolean hasExactlyOnePlayerPassenger() { public boolean hasExactlyOnePlayerPassenger() {
return this.getIndirectPassengersStream().filter((entity) -> { return this.countPlayerPassengers() == 1;
return entity instanceof Player; }
@@ -3919,6 +3981,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -3961,6 +4023,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
} }
public final void setPosRaw(double x, double y, double z) { public final void setPosRaw(double x, double y, double z) {
@ -20749,7 +20749,7 @@ index 46853c3daa7f3f552632444fbf41624cfd1c8dc4..9eda990939b36c08a6f4820353942d6c
if (this.position.x != x || this.position.y != y || this.position.z != z) { if (this.position.x != x || this.position.y != y || this.position.z != z) {
this.position = new Vec3(x, y, z); this.position = new Vec3(x, y, z);
int i = Mth.floor(x); int i = Mth.floor(x);
@@ -4026,6 +4094,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -4068,6 +4136,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@Override @Override
public final void setRemoved(Entity.RemovalReason reason) { public final void setRemoved(Entity.RemovalReason reason) {
@ -20763,7 +20763,7 @@ index 46853c3daa7f3f552632444fbf41624cfd1c8dc4..9eda990939b36c08a6f4820353942d6c
if (this.removalReason == null) { if (this.removalReason == null) {
this.removalReason = reason; this.removalReason = reason;
} }
@@ -4034,7 +4109,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -4076,7 +4151,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
this.stopRiding(); this.stopRiding();
} }
@ -20772,7 +20772,7 @@ index 46853c3daa7f3f552632444fbf41624cfd1c8dc4..9eda990939b36c08a6f4820353942d6c
this.levelCallback.onRemove(reason); this.levelCallback.onRemove(reason);
} }
@@ -4049,7 +4124,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -4091,7 +4166,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@Override @Override
public boolean shouldBeSaved() { public boolean shouldBeSaved() {
@ -21056,10 +21056,10 @@ index b6a3c75b84d9f768afee33aa0f226207b307c1c0..2ec2b1d9d987c7f31c685aec3d3c87f4
<T extends Entity> List<T> getEntities(EntityTypeTest<Entity, T> filter, AABB box, Predicate<? super T> predicate); <T extends Entity> List<T> getEntities(EntityTypeTest<Entity, T> filter, AABB box, Predicate<? super T> predicate);
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 43b631634ff225fa007af552f51f00150892185b..ec31a60fae419fb610f216bd42558e6aa57c2e19 100644 index 26fe1603b3899f5b69980dc64d46d26d9c944fde..2922b90241e81245dbd56c53ab2eb661314c04fd 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -453,6 +453,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -456,6 +456,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
if ((i & 2) != 0 && (!this.isClientSide || (i & 4) == 0) && (this.isClientSide || chunk == null || (chunk.getFullStatus() != null && chunk.getFullStatus().isOrAfter(FullChunkStatus.BLOCK_TICKING)))) { // allow chunk to be null here as chunk.isReady() is false when we send our notification during block placement if ((i & 2) != 0 && (!this.isClientSide || (i & 4) == 0) && (this.isClientSide || chunk == null || (chunk.getFullStatus() != null && chunk.getFullStatus().isOrAfter(FullChunkStatus.BLOCK_TICKING)))) { // allow chunk to be null here as chunk.isReady() is false when we send our notification during block placement
this.sendBlockUpdated(blockposition, iblockdata1, iblockdata, i); this.sendBlockUpdated(blockposition, iblockdata1, iblockdata, i);
@ -21071,7 +21071,7 @@ index 43b631634ff225fa007af552f51f00150892185b..ec31a60fae419fb610f216bd42558e6a
} }
if ((i & 1) != 0) { if ((i & 1) != 0) {
@@ -805,7 +810,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -823,7 +828,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return this.capturedTileEntities.get(blockposition); return this.capturedTileEntities.get(blockposition);
} }
// CraftBukkit end // CraftBukkit end
@ -21080,7 +21080,7 @@ index 43b631634ff225fa007af552f51f00150892185b..ec31a60fae419fb610f216bd42558e6a
} }
public void setBlockEntity(BlockEntity blockEntity) { public void setBlockEntity(BlockEntity blockEntity) {
@@ -896,26 +901,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -914,26 +919,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public List<Entity> getEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate) { public List<Entity> getEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate) {
this.getProfiler().incrementCounter("getEntities"); this.getProfiler().incrementCounter("getEntities");
List<Entity> list = Lists.newArrayList(); List<Entity> list = Lists.newArrayList();
@ -21108,7 +21108,7 @@ index 43b631634ff225fa007af552f51f00150892185b..ec31a60fae419fb610f216bd42558e6a
return list; return list;
} }
@@ -933,34 +919,23 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -951,34 +937,23 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public <T extends Entity> void getEntities(EntityTypeTest<Entity, T> filter, AABB box, Predicate<? super T> predicate, List<? super T> result, int limit) { public <T extends Entity> void getEntities(EntityTypeTest<Entity, T> filter, AABB box, Predicate<? super T> predicate, List<? super T> result, int limit) {
this.getProfiler().incrementCounter("getEntities"); this.getProfiler().incrementCounter("getEntities");
@ -21159,7 +21159,7 @@ index 43b631634ff225fa007af552f51f00150892185b..ec31a60fae419fb610f216bd42558e6a
} }
@Nullable @Nullable
@@ -1230,4 +1205,45 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -1250,4 +1225,45 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
private ExplosionInteraction() {} private ExplosionInteraction() {}
} }
@ -22652,10 +22652,10 @@ index b1aeb021e53a233bfb0439d38f1a889ed6fc301d..7687a81bfa420e8377308fea3d673814
@Override @Override
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index e08c7af19ec142c2aa1b918ffd6cb9e1aa7f0c4d..2df4e56450535d2d3f6e83c06261fac7ee7a12dd 100644 index 0f3659d2d60426275869dec76412aecb8e407442..e411d9e821604f07e744f2457654f6ac4bb34db7 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1162,7 +1162,7 @@ public final class CraftServer implements Server { @@ -1194,7 +1194,7 @@ public final class CraftServer implements Server {
this.console.addLevel(internal); this.console.addLevel(internal);
this.getServer().prepareLevels(internal.getChunkSource().chunkMap.progressListener, internal); this.getServer().prepareLevels(internal.getChunkSource().chunkMap.progressListener, internal);
@ -22664,7 +22664,7 @@ index e08c7af19ec142c2aa1b918ffd6cb9e1aa7f0c4d..2df4e56450535d2d3f6e83c06261fac7
this.pluginManager.callEvent(new WorldLoadEvent(internal.getWorld())); this.pluginManager.callEvent(new WorldLoadEvent(internal.getWorld()));
return internal.getWorld(); return internal.getWorld();
@@ -1206,7 +1206,7 @@ public final class CraftServer implements Server { @@ -1238,7 +1238,7 @@ public final class CraftServer implements Server {
} }
handle.getChunkSource().close(save); handle.getChunkSource().close(save);
@ -22673,7 +22673,7 @@ index e08c7af19ec142c2aa1b918ffd6cb9e1aa7f0c4d..2df4e56450535d2d3f6e83c06261fac7
handle.convertable.close(); handle.convertable.close();
} catch (Exception ex) { } catch (Exception ex) {
this.getLogger().log(Level.SEVERE, null, ex); this.getLogger().log(Level.SEVERE, null, ex);
@@ -2098,7 +2098,7 @@ public final class CraftServer implements Server { @@ -2130,7 +2130,7 @@ public final class CraftServer implements Server {
@Override @Override
public boolean isPrimaryThread() { public boolean isPrimaryThread() {
@ -22683,10 +22683,10 @@ index e08c7af19ec142c2aa1b918ffd6cb9e1aa7f0c4d..2df4e56450535d2d3f6e83c06261fac7
// Paper start - Adventure // Paper start - Adventure
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 1678a5eca31033d31ea76bb8918b8d7323c884a7..10652bb6eecc9f451181747ba314eadfe6347ad1 100644 index bb60804a77ecda3c86ccf54e028e634f8d7f141d..1f160036b433c5d1fb8ed1f94adefccab7a85bc7 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -325,10 +325,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -326,10 +326,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {
ChunkHolder playerChunk = this.world.getChunkSource().chunkMap.getVisibleChunkIfPresent(ChunkPos.asLong(x, z)); ChunkHolder playerChunk = this.world.getChunkSource().chunkMap.getVisibleChunkIfPresent(ChunkPos.asLong(x, z));
if (playerChunk == null) return false; if (playerChunk == null) return false;
@ -22704,7 +22704,7 @@ index 1678a5eca31033d31ea76bb8918b8d7323c884a7..10652bb6eecc9f451181747ba314eadf
ClientboundLevelChunkWithLightPacket refreshPacket = new ClientboundLevelChunkWithLightPacket(chunk, this.world.getLightEngine(), null, null); ClientboundLevelChunkWithLightPacket refreshPacket = new ClientboundLevelChunkWithLightPacket(chunk, this.world.getLightEngine(), null, null);
for (ServerPlayer player : playersInRange) { for (ServerPlayer player : playersInRange) {
@@ -336,8 +340,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -337,8 +341,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
player.connection.send(refreshPacket); player.connection.send(refreshPacket);
} }
@ -22714,7 +22714,7 @@ index 1678a5eca31033d31ea76bb8918b8d7323c884a7..10652bb6eecc9f451181747ba314eadf
return true; return true;
} }
@@ -414,20 +417,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -415,20 +418,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public Collection<Plugin> getPluginChunkTickets(int x, int z) { public Collection<Plugin> getPluginChunkTickets(int x, int z) {
DistanceManager chunkDistanceManager = this.world.getChunkSource().chunkMap.distanceManager; DistanceManager chunkDistanceManager = this.world.getChunkSource().chunkMap.distanceManager;
@ -22736,7 +22736,7 @@ index 1678a5eca31033d31ea76bb8918b8d7323c884a7..10652bb6eecc9f451181747ba314eadf
} }
@Override @Override
@@ -435,7 +425,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -436,7 +426,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
Map<Plugin, ImmutableList.Builder<Chunk>> ret = new HashMap<>(); Map<Plugin, ImmutableList.Builder<Chunk>> ret = new HashMap<>();
DistanceManager chunkDistanceManager = this.world.getChunkSource().chunkMap.distanceManager; DistanceManager chunkDistanceManager = this.world.getChunkSource().chunkMap.distanceManager;
@ -22745,7 +22745,7 @@ index 1678a5eca31033d31ea76bb8918b8d7323c884a7..10652bb6eecc9f451181747ba314eadf
long chunkKey = chunkTickets.getLongKey(); long chunkKey = chunkTickets.getLongKey();
SortedArraySet<Ticket<?>> tickets = chunkTickets.getValue(); SortedArraySet<Ticket<?>> tickets = chunkTickets.getValue();
@@ -2018,14 +2008,53 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -2024,14 +2014,53 @@ public class CraftWorld extends CraftRegionAccessor implements World {
// Spigot start // Spigot start
@Override @Override
public int getViewDistance() { public int getViewDistance() {
@ -22802,10 +22802,10 @@ index 1678a5eca31033d31ea76bb8918b8d7323c884a7..10652bb6eecc9f451181747ba314eadf
// Spigot start // Spigot start
private final org.bukkit.World.Spigot spigot = new org.bukkit.World.Spigot() private final org.bukkit.World.Spigot spigot = new org.bukkit.World.Spigot()
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 9cec05442734dd9e08e749dc73358c045c6d3d24..5e495f89139689ca37982c7b0b79eaf50d444435 100644 index c74428dccd9db8c4d2809bbd23f3268a16d7e282..24c282c0727fa814c403716837b2d44b216c5b16 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -197,6 +197,48 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -198,6 +198,48 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.firstPlayed = System.currentTimeMillis(); this.firstPlayed = System.currentTimeMillis();
} }
@ -22868,7 +22868,7 @@ index 20592dc147f4f0b84928dabcfa349622f1de691c..d46ccc3b3aaacf937631a44a7e0f91b7
@Override @Override
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java
index 7c110a758a84c5e22f36b788dec84998e607af6c..cbedb6f002bc01daa16d349421c4ef04d4bcbcb2 100644 index e37c2d82ed606cbfe00c152b08c3ab99ac751f69..a650411e3fa7e2a045ac55502c77028be348acf1 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java --- a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java +++ b/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java
@@ -824,19 +824,39 @@ public abstract class DelegatedGeneratorAccess implements WorldGenLevel { @@ -824,19 +824,39 @@ public abstract class DelegatedGeneratorAccess implements WorldGenLevel {
@ -22915,7 +22915,7 @@ index 7c110a758a84c5e22f36b788dec84998e607af6c..cbedb6f002bc01daa16d349421c4ef04
// Paper end // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
index 629178347039893fb9de710810fe8112499bb91c..d5861dfa771c4eb217e082e3c832c3a6c603710d 100644 index 440660dfa70d57e94ae4eef1dce783aee5034f7e..187eda2dd40785eb09528c86718d6b4fd3ab252c 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java --- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java +++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
@@ -258,4 +258,20 @@ public class DummyGeneratorAccess implements WorldGenLevel { @@ -258,4 +258,20 @@ public class DummyGeneratorAccess implements WorldGenLevel {

View file

@ -7,10 +7,10 @@ Subject: [PATCH] Add command line option to load extra plugin jars not in the
ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 2df4e56450535d2d3f6e83c06261fac7ee7a12dd..66e4b4b12a38d537e8093ba1deb9489fdd56919a 100644 index e411d9e821604f07e744f2457654f6ac4bb34db7..012634a64a39cbcbb49d2c8948fac92eca15cebe 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -431,6 +431,35 @@ public final class CraftServer implements Server { @@ -426,6 +426,35 @@ public final class CraftServer implements Server {
io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.INSTANCE.enter(io.papermc.paper.plugin.entrypoint.Entrypoint.PLUGIN); // Paper - replace implementation io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.INSTANCE.enter(io.papermc.paper.plugin.entrypoint.Entrypoint.PLUGIN); // Paper - replace implementation
} }
@ -47,7 +47,7 @@ index 2df4e56450535d2d3f6e83c06261fac7ee7a12dd..66e4b4b12a38d537e8093ba1deb9489f
if (type == PluginLoadOrder.STARTUP) { if (type == PluginLoadOrder.STARTUP) {
this.helpMap.clear(); this.helpMap.clear();
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index d4b36863c55d3ffb2c71118b078c13ae95fc73d3..306fdc4111a9afeafc540dbf4f0f9dabcec3c3d9 100644 index 328118a19ce409ad9a15e75d54d70eb3be65ea6a..7285510dc618327b578b179165023414d595a354 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -160,6 +160,12 @@ public class Main { @@ -160,6 +160,12 @@ public class Main {

View file

@ -7,10 +7,10 @@ Bamboo - Both the minimum fully-grown heights and the maximum are configurable
- Machine_Maker - Machine_Maker
diff --git a/src/main/java/net/minecraft/world/level/block/BambooStalkBlock.java b/src/main/java/net/minecraft/world/level/block/BambooStalkBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/BambooStalkBlock.java b/src/main/java/net/minecraft/world/level/block/BambooStalkBlock.java
index 75754c06268d6d1b719742d127516f77ba5c1046..05a508cb457b67078ccb08bd2228a59e73701cf3 100644 index bd72deadb59289ae90afc379ee61e8198ddaf4ed..1dd85da8da9e2040d740c5f573e7438380f9a7a8 100644
--- a/src/main/java/net/minecraft/world/level/block/BambooStalkBlock.java --- a/src/main/java/net/minecraft/world/level/block/BambooStalkBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BambooStalkBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BambooStalkBlock.java
@@ -130,7 +130,7 @@ public class BambooStalkBlock extends Block implements BonemealableBlock { @@ -137,7 +137,7 @@ public class BambooStalkBlock extends Block implements BonemealableBlock {
if (random.nextFloat() < (world.spigotConfig.bambooModifier / (100.0f * 3)) && world.isEmptyBlock(pos.above()) && world.getRawBrightness(pos.above(), 0) >= 9) { // Spigot - SPIGOT-7159: Better modifier resolution if (random.nextFloat() < (world.spigotConfig.bambooModifier / (100.0f * 3)) && world.isEmptyBlock(pos.above()) && world.getRawBrightness(pos.above(), 0) >= 9) { // Spigot - SPIGOT-7159: Better modifier resolution
int i = this.getHeightBelowUpToMax(world, pos) + 1; int i = this.getHeightBelowUpToMax(world, pos) + 1;
@ -19,7 +19,7 @@ index 75754c06268d6d1b719742d127516f77ba5c1046..05a508cb457b67078ccb08bd2228a59e
this.growBamboo(state, world, pos, random, i); this.growBamboo(state, world, pos, random, i);
} }
} }
@@ -161,7 +161,7 @@ public class BambooStalkBlock extends Block implements BonemealableBlock { @@ -168,7 +168,7 @@ public class BambooStalkBlock extends Block implements BonemealableBlock {
int i = this.getHeightAboveUpToMax(world, pos); int i = this.getHeightAboveUpToMax(world, pos);
int j = this.getHeightBelowUpToMax(world, pos); int j = this.getHeightBelowUpToMax(world, pos);
@ -28,7 +28,7 @@ index 75754c06268d6d1b719742d127516f77ba5c1046..05a508cb457b67078ccb08bd2228a59e
} }
@Override @Override
@@ -180,7 +180,7 @@ public class BambooStalkBlock extends Block implements BonemealableBlock { @@ -187,7 +187,7 @@ public class BambooStalkBlock extends Block implements BonemealableBlock {
BlockPos blockposition1 = pos.above(i); BlockPos blockposition1 = pos.above(i);
BlockState iblockdata1 = world.getBlockState(blockposition1); BlockState iblockdata1 = world.getBlockState(blockposition1);
@ -37,7 +37,7 @@ index 75754c06268d6d1b719742d127516f77ba5c1046..05a508cb457b67078ccb08bd2228a59e
return; return;
} }
@@ -221,7 +221,7 @@ public class BambooStalkBlock extends Block implements BonemealableBlock { @@ -228,7 +228,7 @@ public class BambooStalkBlock extends Block implements BonemealableBlock {
} }
int j = (Integer) state.getValue(BambooStalkBlock.AGE) != 1 && !iblockdata2.is(Blocks.BAMBOO) ? 0 : 1; int j = (Integer) state.getValue(BambooStalkBlock.AGE) != 1 && !iblockdata2.is(Blocks.BAMBOO) ? 0 : 1;
@ -46,7 +46,7 @@ index 75754c06268d6d1b719742d127516f77ba5c1046..05a508cb457b67078ccb08bd2228a59e
// CraftBukkit start // CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, pos.above(), (BlockState) ((BlockState) ((BlockState) this.defaultBlockState().setValue(BambooStalkBlock.AGE, j)).setValue(BambooStalkBlock.LEAVES, blockpropertybamboosize)).setValue(BambooStalkBlock.STAGE, k), 3)) { if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, pos.above(), (BlockState) ((BlockState) ((BlockState) this.defaultBlockState().setValue(BambooStalkBlock.AGE, j)).setValue(BambooStalkBlock.LEAVES, blockpropertybamboosize)).setValue(BambooStalkBlock.STAGE, k), 3)) {
@@ -236,7 +236,7 @@ public class BambooStalkBlock extends Block implements BonemealableBlock { @@ -243,7 +243,7 @@ public class BambooStalkBlock extends Block implements BonemealableBlock {
protected int getHeightAboveUpToMax(BlockGetter world, BlockPos pos) { protected int getHeightAboveUpToMax(BlockGetter world, BlockPos pos) {
int i; int i;
@ -55,7 +55,7 @@ index 75754c06268d6d1b719742d127516f77ba5c1046..05a508cb457b67078ccb08bd2228a59e
; ;
} }
@@ -246,7 +246,7 @@ public class BambooStalkBlock extends Block implements BonemealableBlock { @@ -253,7 +253,7 @@ public class BambooStalkBlock extends Block implements BonemealableBlock {
protected int getHeightBelowUpToMax(BlockGetter world, BlockPos pos) { protected int getHeightBelowUpToMax(BlockGetter world, BlockPos pos) {
int i; int i;
@ -65,10 +65,10 @@ index 75754c06268d6d1b719742d127516f77ba5c1046..05a508cb457b67078ccb08bd2228a59e
} }
diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
index a7e8be5545ef6c2ff9a056d297d11850d07bdd1c..2c3bbe4f295be9782c11af13c2cf9c05f27313d9 100644 index fcd5b593c79aab42928cb1ddd0e6c1b03b7bafaf..3c7bbfcb3a88f23056cd0db3da2a281a81dc8c85 100644
--- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java --- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java
@@ -54,7 +54,7 @@ public class CactusBlock extends Block { @@ -61,7 +61,7 @@ public class CactusBlock extends Block {
; ;
} }
@ -78,10 +78,10 @@ index a7e8be5545ef6c2ff9a056d297d11850d07bdd1c..2c3bbe4f295be9782c11af13c2cf9c05
int modifier = world.spigotConfig.cactusModifier; // Spigot - SPIGOT-7159: Better modifier resolution int modifier = world.spigotConfig.cactusModifier; // Spigot - SPIGOT-7159: Better modifier resolution
diff --git a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java
index 7fbc511eb1cbfedc3bbf5bff7a61e8f74c294140..c3f500580d257e1397f2eb7c47b063a6fe6bb405 100644 index 47d4fc5bcf2657078abc7a2637b6337fc0ea0977..ceaec1776067b7635c3952025f00f13f4ea86c88 100644
--- a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java --- a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java
@@ -52,7 +52,7 @@ public class SugarCaneBlock extends Block { @@ -59,7 +59,7 @@ public class SugarCaneBlock extends Block {
; ;
} }

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Allow nerfed mobs to jump
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index ec841a4d9a11f0d9047c202a31f944b340da33c8..6cc544b39b62cf5be582e697a0df13f82fb73a4b 100644 index 01761d37c9e4be4e498b62c7612885648b2968a6..183866636eb67f632728a01c8e5e11b514d89f84 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -111,6 +111,7 @@ public abstract class Mob extends LivingEntity implements Targeting { @@ -112,6 +112,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
private final BodyRotationControl bodyRotationControl; private final BodyRotationControl bodyRotationControl;
protected PathNavigation navigation; protected PathNavigation navigation;
public GoalSelector goalSelector; public GoalSelector goalSelector;
@ -16,7 +16,7 @@ index ec841a4d9a11f0d9047c202a31f944b340da33c8..6cc544b39b62cf5be582e697a0df13f8
public GoalSelector targetSelector; public GoalSelector targetSelector;
@Nullable @Nullable
private LivingEntity target; private LivingEntity target;
@@ -876,7 +877,15 @@ public abstract class Mob extends LivingEntity implements Targeting { @@ -877,7 +878,15 @@ public abstract class Mob extends LivingEntity implements Targeting {
@Override @Override
protected final void serverAiStep() { protected final void serverAiStep() {
++this.noActionTime; ++this.noActionTime;

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add configurable despawn distances for living entities
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 6cc544b39b62cf5be582e697a0df13f82fb73a4b..6e4980b0e6505f8da90d1d63584ef69f899896ea 100644 index 183866636eb67f632728a01c8e5e11b514d89f84..007a5c9a6dc70ca6a215fdeb3fe77f8a8ee46818 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -852,14 +852,14 @@ public abstract class Mob extends LivingEntity implements Targeting { @@ -853,14 +853,14 @@ public abstract class Mob extends LivingEntity implements Targeting {
if (entityhuman != null) { if (entityhuman != null) {
double d0 = entityhuman.distanceToSqr((Entity) this); double d0 = entityhuman.distanceToSqr((Entity) this);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Allow for toggling of spawn chunks
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index ec31a60fae419fb610f216bd42558e6aa57c2e19..1e57df43ea47f18cc151dc8ad5fd6f18d3615462 100644 index 2922b90241e81245dbd56c53ab2eb661314c04fd..9369e0346a6b511a332d54577c781c3d2c2b5c86 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -261,6 +261,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -264,6 +264,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}); });
// CraftBukkit end // CraftBukkit end
this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings

View file

@ -6,7 +6,7 @@ Subject: [PATCH] Drop falling block and tnt entities at the specified height
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index 15d7cb338a0a1c77e999c23042f04ef3f24ede9a..5e30e7a1447503f424ec3a5aa3983826ee960fd8 100644 index d344b13e3726f0fe8a57c098769d1beea9705cdd..5d09790876c3c50d126678565001645f6aece16f 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -142,6 +142,16 @@ public class FallingBlockEntity extends Entity { @@ -142,6 +142,16 @@ public class FallingBlockEntity extends Entity {
@ -27,10 +27,10 @@ index 15d7cb338a0a1c77e999c23042f04ef3f24ede9a..5e30e7a1447503f424ec3a5aa3983826
BlockPos blockposition = this.blockPosition(); BlockPos blockposition = this.blockPosition();
boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock; boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock;
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
index a290daaeebfc110428dd8201f144c2acb06fddfc..415b8822f0dfb14d49bccb2a10ac04025891ddf7 100644 index 36d93ee421406302c05945db17d46b04b485e4c0..f08c021f867c00611139a17db48352944eb2aa99 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java --- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java +++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -69,6 +69,12 @@ public class PrimedTnt extends Entity implements TraceableEntity { @@ -77,6 +77,12 @@ public class PrimedTnt extends Entity implements TraceableEntity {
} }
this.move(MoverType.SELF, this.getDeltaMovement()); this.move(MoverType.SELF, this.getDeltaMovement());
@ -44,7 +44,7 @@ index a290daaeebfc110428dd8201f144c2acb06fddfc..415b8822f0dfb14d49bccb2a10ac0402
if (this.onGround()) { if (this.onGround()) {
this.setDeltaMovement(this.getDeltaMovement().multiply(0.7D, -0.5D, 0.7D)); this.setDeltaMovement(this.getDeltaMovement().multiply(0.7D, -0.5D, 0.7D));
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java
index 137f9052701c5b10ff03b01316ced37220dbf280..1f4031cb7a101a7f25d530380974a627cc29bb09 100644 index 0fc58f38bbd855414ad36b682e60b069d7b68cb1..9ec8821cf6571c5cc6b32212fe6f33bc4f6b949f 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java --- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartTNT.java
@@ -53,6 +53,12 @@ public class MinecartTNT extends AbstractMinecart { @@ -53,6 +53,12 @@ public class MinecartTNT extends AbstractMinecart {

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 27ab6d2749b89cc5d3fd4e22603daee95634be71..6155d6e3c361bb4a0381e7065a7b603b783a47a6 100644 index 2021526bf6b8bdc286c31aaa62ab0235fac073cd..b082e17b9fbcc0e8ee881a89df1207d26bbeda0b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1457,7 +1457,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1559,7 +1559,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate @DontObfuscate
public String getServerModName() { public String getServerModName() {
@ -19,10 +19,10 @@ index 27ab6d2749b89cc5d3fd4e22603daee95634be71..6155d6e3c361bb4a0381e7065a7b603b
public SystemReport fillSystemReport(SystemReport details) { public SystemReport fillSystemReport(SystemReport details) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 66e4b4b12a38d537e8093ba1deb9489fdd56919a..b94cc5540685989b8b42c5a5d364d33b16fe3782 100644 index 012634a64a39cbcbb49d2c8948fac92eca15cebe..d89f832288e197e6c7cf3a0eaab699b3ce1a2c0c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -266,7 +266,7 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; @@ -267,7 +267,7 @@ import org.yaml.snakeyaml.error.MarkedYAMLException;
import net.md_5.bungee.api.chat.BaseComponent; // Spigot import net.md_5.bungee.api.chat.BaseComponent; // Spigot
public final class CraftServer implements Server { public final class CraftServer implements Server {
@ -32,11 +32,11 @@ index 66e4b4b12a38d537e8093ba1deb9489fdd56919a..b94cc5540685989b8b42c5a5d364d33b
private final String bukkitVersion = Versioning.getBukkitVersion(); private final String bukkitVersion = Versioning.getBukkitVersion();
private final Logger logger = Logger.getLogger("Minecraft"); private final Logger logger = Logger.getLogger("Minecraft");
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 306fdc4111a9afeafc540dbf4f0f9dabcec3c3d9..be73d6940983672bcccc2b05a9a87b01e0a995b0 100644 index 7285510dc618327b578b179165023414d595a354..176ffe9f5007bf4bb83bfc0d1186116c98481f45 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -241,12 +241,25 @@ public class Main { @@ -241,12 +241,25 @@ public class Main {
deadline.add(Calendar.DAY_OF_YEAR, -21); deadline.add(Calendar.DAY_OF_YEAR, -3);
if (buildDate.before(deadline.getTime())) { if (buildDate.before(deadline.getTime())) {
System.err.println("*** Error, this build is outdated ***"); System.err.println("*** Error, this build is outdated ***");
- System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***"); - System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***");

View file

@ -140,10 +140,10 @@ index 0000000000000000000000000000000000000000..22a55be34fde453fedd987173d95b8b3
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 0a2a6697118833d45ffe95252cee8011b505d566..f967975d641fadce813a34a9344f6294368b797c 100644 index 677335c3888adc25fbf3c5ec4d5a6c5ecf58ea5d..e31ead0d99203a018757cb2e765b5d28dd373eef 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -456,6 +456,11 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -453,6 +453,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public String getTimingsServerName() { public String getTimingsServerName() {
return io.papermc.paper.configuration.GlobalConfiguration.get().timings.serverName; return io.papermc.paper.configuration.GlobalConfiguration.get().timings.serverName;
} }

View file

@ -209,7 +209,7 @@ index 0000000000000000000000000000000000000000..660b2ec6b63a4ceffee44ab11f54dfa7
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 64958f6cb9162de791ac90e08b19368a7fc59064..dbe57c172ed57694912ef940024f8f33577e92bd 100644 index b6d5e0962abb62a30c1561d3b1e970884b5b13dc..a267ab0b217573373d7b6a1f48cadab0f431da40 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -189,6 +189,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -189,6 +189,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Player affects spawning API
diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java
index 984a13267cc1bb960507bc9231359bb4bb837205..668a7c3f36cdbe48e472cb810b27ae4ab39a65d6 100644 index 3126e8cab3c40e3af47f4c8925e1c6a9523309ba..170fbb1d80947b9b21c2106497baae5c37bcdc0c 100644
--- a/src/main/java/net/minecraft/world/entity/EntitySelector.java --- a/src/main/java/net/minecraft/world/entity/EntitySelector.java
+++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java +++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java
@@ -29,6 +29,11 @@ public final class EntitySelector { @@ -30,6 +30,11 @@ public final class EntitySelector {
public static final Predicate<Entity> CAN_BE_COLLIDED_WITH = EntitySelector.NO_SPECTATORS.and(Entity::canBeCollidedWith); public static final Predicate<Entity> CAN_BE_COLLIDED_WITH = EntitySelector.NO_SPECTATORS.and(Entity::canBeCollidedWith);
private EntitySelector() {} private EntitySelector() {}
@ -21,10 +21,10 @@ index 984a13267cc1bb960507bc9231359bb4bb837205..668a7c3f36cdbe48e472cb810b27ae4a
public static Predicate<Entity> withinDistance(double x, double y, double z, double max) { public static Predicate<Entity> withinDistance(double x, double y, double z, double max) {
double d4 = max * max; double d4 = max * max;
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 6e4980b0e6505f8da90d1d63584ef69f899896ea..2aa3df6ef2da77fa51c11d64124ac55a3769f567 100644 index 007a5c9a6dc70ca6a215fdeb3fe77f8a8ee46818..3d054cfa5050f4b75eab4a18035655c1bfd9290b 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -848,7 +848,7 @@ public abstract class Mob extends LivingEntity implements Targeting { @@ -849,7 +849,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
if (this.level().getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) { if (this.level().getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
this.discard(); this.discard();
} else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) { } else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) {
@ -73,10 +73,10 @@ index 37824f2470c7ddb77216ffbf4da02cc10a95a171..0c9a91990376482bc16f74a8b183ebf0
entityzombie.finalizeSpawn(worldserver, this.level().getCurrentDifficultyAt(entityzombie.blockPosition()), MobSpawnType.REINFORCEMENT, (SpawnGroupData) null, (CompoundTag) null); entityzombie.finalizeSpawn(worldserver, this.level().getCurrentDifficultyAt(entityzombie.blockPosition()), MobSpawnType.REINFORCEMENT, (SpawnGroupData) null, (CompoundTag) null);
worldserver.addFreshEntityWithPassengers(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit worldserver.addFreshEntityWithPassengers(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 37629bf1193e220bcf872c714c55e0708d9fd7e0..45a5baf2f6e868fd5b41be1204bee46fb2e631b5 100644 index eed6481bc88ed15a5e3fe7056b545ab44ed81983..86d187cadb73dbe0757f9417c4549e358ff303ca 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java --- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -184,6 +184,9 @@ public abstract class Player extends LivingEntity { @@ -179,6 +179,9 @@ public abstract class Player extends LivingEntity {
@Nullable @Nullable
public FishingHook fishing; public FishingHook fishing;
protected float hurtDir; protected float hurtDir;
@ -87,10 +87,10 @@ index 37629bf1193e220bcf872c714c55e0708d9fd7e0..45a5baf2f6e868fd5b41be1204bee46f
// CraftBukkit start // CraftBukkit start
public boolean fauxSleeping; public boolean fauxSleeping;
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index ad5d8db9fb44f8e47edc82f9ba62872802bfa380..124703a7c043b6c3b651fa1a81c5ba3e99e47938 100644 index d156f7e3430685947d2b4c30aa867e8002ca70ad..e888cf862662ae6baa6d0de8188aa74a9c6a8e00 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -54,7 +54,7 @@ public abstract class BaseSpawner { @@ -56,7 +56,7 @@ public abstract class BaseSpawner {
} }
public boolean isNearPlayer(Level world, BlockPos pos) { public boolean isNearPlayer(Level world, BlockPos pos) {
@ -137,10 +137,10 @@ index 2ec2b1d9d987c7f31c685aec3d3c87f42758c94b..36d793b492d9776ee36f8285b5bab09e
for(Player player : this.players()) { for(Player player : this.players()) {
if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player)) { if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 5e495f89139689ca37982c7b0b79eaf50d444435..ed70dc4b4dfd57af877c42ff579296ce5cebadbd 100644 index 24c282c0727fa814c403716837b2d44b216c5b16..e6f67e770f97f239e545c2d4396c86b546c712e0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2251,6 +2251,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2266,6 +2266,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.getHandle().language; return this.getHandle().language;
} }

View file

@ -12,10 +12,10 @@ Previous implementation did not calculate TPS correctly.
Switch to a realistic rolling average and factor in std deviation as an extra reporting variable Switch to a realistic rolling average and factor in std deviation as an extra reporting variable
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 6155d6e3c361bb4a0381e7065a7b603b783a47a6..d13a0f5a3b95b0d0ca80c760f757087c88eceaeb 100644 index b082e17b9fbcc0e8ee881a89df1207d26bbeda0b..2955636e2afd425988e9377d4bbe93258fd4e412 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -277,7 +277,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -283,7 +283,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public OptionSet options; public OptionSet options;
public org.bukkit.command.ConsoleCommandSender console; public org.bukkit.command.ConsoleCommandSender console;
public ConsoleReader reader; public ConsoleReader reader;
@ -24,7 +24,7 @@ index 6155d6e3c361bb4a0381e7065a7b603b783a47a6..d13a0f5a3b95b0d0ca80c760f757087c
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>(); public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
public int autosavePeriod; public int autosavePeriod;
public Commands vanillaCommandDispatcher; public Commands vanillaCommandDispatcher;
@@ -286,7 +286,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -292,7 +292,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Spigot start // Spigot start
public static final int TPS = 20; public static final int TPS = 20;
public static final int TICK_TIME = 1000000000 / MinecraftServer.TPS; public static final int TICK_TIME = 1000000000 / MinecraftServer.TPS;
@ -33,7 +33,7 @@ index 6155d6e3c361bb4a0381e7065a7b603b783a47a6..d13a0f5a3b95b0d0ca80c760f757087c
public final double[] recentTps = new double[ 3 ]; public final double[] recentTps = new double[ 3 ];
// Spigot end // Spigot end
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations;
@@ -933,6 +933,57 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -979,6 +979,57 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
{ {
return ( avg * exp ) + ( tps * ( 1 - exp ) ); return ( avg * exp ) + ( tps * ( 1 - exp ) );
} }
@ -91,36 +91,29 @@ index 6155d6e3c361bb4a0381e7065a7b603b783a47a6..d13a0f5a3b95b0d0ca80c760f757087c
// Spigot End // Spigot End
public static volatile RuntimeException chunkSystemCrash; // Paper - rewrite chunk system public static volatile RuntimeException chunkSystemCrash; // Paper - rewrite chunk system
@@ -949,7 +1000,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -995,7 +1046,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Spigot start // Spigot start
Arrays.fill( this.recentTps, 20 ); Arrays.fill( this.recentTps, 20 );
- long curTime, tickSection = Util.getMillis(), tickCount = 1; - long tickSection = Util.getMillis(), tickCount = 1;
+ long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop + long tickSection = Util.getNanos(), curTime, tickCount = 1; // Paper
+ lastTick = start - TICK_TIME; // Paper
while (this.running) { while (this.running) {
// Paper start - rewrite chunk system // Paper start - rewrite chunk system
// guarantee that nothing can stop the server from halting if it can at least still tick // guarantee that nothing can stop the server from halting if it can at least still tick
@@ -957,7 +1009,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1024,15 +1075,22 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
throw this.chunkSystemCrash;
} }
// Paper end - rewrite chunk system // Spigot start
- long i = (curTime = Util.getMillis()) - this.nextTickTime;
+ long i = ((curTime = System.nanoTime()) / (1000L * 1000L)) - this.nextTickTime; // Paper
if (i > 5000L && this.nextTickTime - this.lastOverloadWarning >= 30000L) { // CraftBukkit
long j = i / 50L;
@@ -969,12 +1021,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
++MinecraftServer.currentTickLong; // Paper ++MinecraftServer.currentTickLong; // Paper
- if ( tickCount++ % MinecraftServer.SAMPLE_INTERVAL == 0 ) - if ( tickCount++ % MinecraftServer.SAMPLE_INTERVAL == 0 )
+ if ( ++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0 ) + if ( ++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0 ) // Paper
{ {
- long curTime = Util.getMillis();
- double currentTps = 1E3 / ( curTime - tickSection ) * MinecraftServer.SAMPLE_INTERVAL; - double currentTps = 1E3 / ( curTime - tickSection ) * MinecraftServer.SAMPLE_INTERVAL;
- this.recentTps[0] = MinecraftServer.calcTps( this.recentTps[0], 0.92, currentTps ); // 1/exp(5sec/1min) - this.recentTps[0] = MinecraftServer.calcTps( this.recentTps[0], 0.92, currentTps ); // 1/exp(5sec/1min)
- this.recentTps[1] = MinecraftServer.calcTps( this.recentTps[1], 0.9835, currentTps ); // 1/exp(5sec/5min) - this.recentTps[1] = MinecraftServer.calcTps( this.recentTps[1], 0.9835, currentTps ); // 1/exp(5sec/5min)
- this.recentTps[2] = MinecraftServer.calcTps( this.recentTps[2], 0.9945, currentTps ); // 1/exp(5sec/15min) - this.recentTps[2] = MinecraftServer.calcTps( this.recentTps[2], 0.9945, currentTps ); // 1/exp(5sec/15min)
+ // Paper start
+ curTime = Util.getNanos();
+ final long diff = curTime - tickSection; + final long diff = curTime - tickSection;
+ java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP); + java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP);
+ tps1.add(currentTps, diff); + tps1.add(currentTps, diff);
@ -132,23 +125,26 @@ index 6155d6e3c361bb4a0381e7065a7b603b783a47a6..d13a0f5a3b95b0d0ca80c760f757087c
+ this.recentTps[2] = tps15.getAverage(); + this.recentTps[2] = tps15.getAverage();
+ // Paper end + // Paper end
tickSection = curTime; tickSection = curTime;
} - }
+ } else curTime = Util.getNanos(); // Paper
// Spigot end // Spigot end
@@ -984,7 +1042,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
boolean flag = i == 0L;
@@ -1042,7 +1100,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.debugCommandProfiler = new MinecraftServer.TimeProfiler(Util.getNanos(), this.tickCount); this.debugCommandProfiler = new MinecraftServer.TimeProfiler(Util.getNanos(), this.tickCount);
} }
- MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit - MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
+ //MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit // Paper - don't overwrite current tick time + //MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit // Paper - don't overwrite current tick time
+ lastTick = curTime; + lastTick = curTime;
this.nextTickTime += 50L; this.nextTickTimeNanos += i;
this.startMetricsRecordingTick(); this.startMetricsRecordingTick();
this.profiler.push("tick"); this.profiler.push("tick");
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index b94cc5540685989b8b42c5a5d364d33b16fe3782..6f66f8514170e5686ed9410d1c755eeef5b61f8a 100644 index d89f832288e197e6c7cf3a0eaab699b3ce1a2c0c..7102165a09afdf6f33257f9fcd6c2c96aefd566a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2540,6 +2540,17 @@ public final class CraftServer implements Server { @@ -2572,6 +2572,17 @@ public final class CraftServer implements Server {
return CraftMagicNumbers.INSTANCE; return CraftMagicNumbers.INSTANCE;
} }

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Only refresh abilities if needed
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index ed70dc4b4dfd57af877c42ff579296ce5cebadbd..5f72f8ac8271d3a6619a708f52a42dc4b6dc5b80 100644 index e6f67e770f97f239e545c2d4396c86b546c712e0..eb0409c01d8e1259414803495c48ec14179f457b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1922,12 +1922,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1937,12 +1937,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override @Override
public void setFlying(boolean value) { public void setFlying(boolean value) {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Entity Origin API
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index fb183bff8844b6f9db5611b9b55b641f4ec438ff..79f6cdfe3e744b93007699a0da71613844c3a4c7 100644 index 51f0705499003ea71274e1d5c8a77306fa868485..0c8042a515daeeb95b14147214e0a3151ef6f5a1 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2354,6 +2354,15 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2390,6 +2390,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
entity.updateDynamicGameEventListener(DynamicGameEventListener::add); entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
entity.valid = true; // CraftBukkit entity.valid = true; // CraftBukkit
@ -25,10 +25,10 @@ index fb183bff8844b6f9db5611b9b55b641f4ec438ff..79f6cdfe3e744b93007699a0da716138
public void onTrackingEnd(Entity entity) { public void onTrackingEnd(Entity entity) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 9eda990939b36c08a6f4820353942d6c8d43b42c..679f55d1b09868a28c5ba82746968eab1000aa88 100644 index fa3d294b36eb0c23b293466fc72bd2970a452b55..9f3598371c854ec74f3b5752c9779d6c0d99ec39 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -312,7 +312,27 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -317,7 +317,27 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
public long activatedTick = Integer.MIN_VALUE; public long activatedTick = Integer.MIN_VALUE;
public void inactiveTick() { } public void inactiveTick() { }
// Spigot end // Spigot end
@ -56,23 +56,23 @@ index 9eda990939b36c08a6f4820353942d6c8d43b42c..679f55d1b09868a28c5ba82746968eab
public float getBukkitYaw() { public float getBukkitYaw() {
return this.yRot; return this.yRot;
} }
@@ -2070,6 +2090,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -2093,6 +2113,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
this.bukkitEntity.storeBukkitValues(nbt); this.bukkitEntity.storeBukkitValues(nbttagcompound);
} }
// CraftBukkit end // CraftBukkit end
+ // Paper start - Save the entity's origin location + // Paper start - Save the entity's origin location
+ if (this.origin != null) { + if (this.origin != null) {
+ UUID originWorld = this.originWorld != null ? this.originWorld : this.level != null ? this.level.getWorld().getUID() : null; + UUID originWorld = this.originWorld != null ? this.originWorld : this.level != null ? this.level.getWorld().getUID() : null;
+ if (originWorld != null) { + if (originWorld != null) {
+ nbt.putUUID("Paper.OriginWorld", originWorld); + nbttagcompound.putUUID("Paper.OriginWorld", originWorld);
+ } + }
+ nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); + nbttagcompound.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ()));
+ } + }
+ // Paper end + // Paper end
return nbt; return nbttagcompound;
} catch (Throwable throwable) { } catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT"); CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -2197,6 +2226,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -2220,6 +2249,20 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
} }
// CraftBukkit end // CraftBukkit end
@ -94,7 +94,7 @@ index 9eda990939b36c08a6f4820353942d6c8d43b42c..679f55d1b09868a28c5ba82746968eab
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT"); CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being loaded"); CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index 5e30e7a1447503f424ec3a5aa3983826ee960fd8..0e349bc8dd0c31559437dc67481d5f0f81100e3b 100644 index 5d09790876c3c50d126678565001645f6aece16f..6c4224e4752b655710c5b992d9acf9563b183483 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -343,6 +343,14 @@ public class FallingBlockEntity extends Entity { @@ -343,6 +343,14 @@ public class FallingBlockEntity extends Entity {
@ -113,13 +113,13 @@ index 5e30e7a1447503f424ec3a5aa3983826ee960fd8..0e349bc8dd0c31559437dc67481d5f0f
public void setHurtsEntities(float fallHurtAmount, int fallHurtMax) { public void setHurtsEntities(float fallHurtAmount, int fallHurtMax) {
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
index 415b8822f0dfb14d49bccb2a10ac04025891ddf7..89fd5d6b373d2705dccc2f22663048f4c2aaa60f 100644 index f08c021f867c00611139a17db48352944eb2aa99..5c3b86e2301079e775971aa4da6a8f2dc6a40d1f 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java --- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java +++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -119,6 +119,14 @@ public class PrimedTnt extends Entity implements TraceableEntity { @@ -132,6 +132,14 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@Override this.setBlockState(NbtUtils.readBlockState(this.level().holderLookup(Registries.BLOCK), nbt.getCompound("block_state")));
protected void readAdditionalSaveData(CompoundTag nbt) { }
this.setFuse(nbt.getShort("Fuse"));
+ // Paper start - Try and load origin location from the old NBT tags for backwards compatibility + // Paper start - Try and load origin location from the old NBT tags for backwards compatibility
+ if (nbt.contains("SourceLoc_x")) { + if (nbt.contains("SourceLoc_x")) {
+ int srcX = nbt.getInt("SourceLoc_x"); + int srcX = nbt.getInt("SourceLoc_x");
@ -132,10 +132,10 @@ index 415b8822f0dfb14d49bccb2a10ac04025891ddf7..89fd5d6b373d2705dccc2f22663048f4
@Nullable @Nullable
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 1f63d24ebe0563431c8f1d3f901e2816648c7a8f..402b6e5d6428c5a34d722888670f94c7fbe34fe4 100644 index 9efb4615d6d196a658940a2211c73af46e1c54b5..beae7b8cf726f61b25c5afb553da8c34dce1dd37 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1272,5 +1272,20 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -1316,5 +1316,20 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return ret; return ret;
} }

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent tile entity and entity crashes
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 1e57df43ea47f18cc151dc8ad5fd6f18d3615462..bace136d8d62a85c5de5ca9a516d4712ddd3db99 100644 index 9369e0346a6b511a332d54577c781c3d2c2b5c86..8bfab45b506aa514956a99354a7dc5009ffa9cbf 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -728,11 +728,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -739,11 +739,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
try { try {
tickConsumer.accept(entity); tickConsumer.accept(entity);
} catch (Throwable throwable) { } catch (Throwable throwable) {

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Configurable top of nether void damage
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 679f55d1b09868a28c5ba82746968eab1000aa88..5d5cdcc3d6ba9b76b083404beb532eecf3f83f50 100644 index 9f3598371c854ec74f3b5752c9779d6c0d99ec39..450a55fd1b01ac67d911d152a04a3dee3aa0a2e9 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -715,7 +715,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -720,7 +720,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
} }
public void checkBelowWorld() { public void checkBelowWorld() {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Check online mode before converting and renaming player data
diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
index e2c0ab0ab06b15dcfa6ce8c82ad4136f2be33b5c..984b75e12b5feab63767e030df925b3cbf26d559 100644 index 3d74ffc6e38b0dbe7ca6d8d84a63f78d6b1908a7..08f4cc47ec3aa4dd6980ba543219891a510b010b 100644
--- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java --- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
+++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java +++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
@@ -56,7 +56,7 @@ public class PlayerDataStorage { @@ -60,7 +60,7 @@ public class PlayerDataStorage {
File file = new File(this.playerDir, player.getStringUUID() + ".dat"); File file = new File(this.playerDir, player.getStringUUID() + ".dat");
// Spigot Start // Spigot Start
boolean usingWrongFile = false; boolean usingWrongFile = false;

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable end credits
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index d7c4ce86956c0461603e8d569e9bebe39f07c8a1..61ec0ed91457e4b04a72010199be520c9d4a9488 100644 index b6939932a4b8800c8751125a4a6d4dcea39110c1..bf89ea0f7506434848cb9c1cbfb3fe6dd2eb3212 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1069,6 +1069,7 @@ public class ServerPlayer extends Player { @@ -1074,6 +1074,7 @@ public class ServerPlayer extends Player {
this.unRide(); this.unRide();
this.serverLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); this.serverLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
if (!this.wonGame) { if (!this.wonGame) {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Fix lag from explosions processing dead entities
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 280ee4747526c05a02d556908b8a3d59a4ccad9e..4f2e06dab92085edd8f98415272cf77952e4888f 100644 index 725ea53e6143d29f9619e1045341bc30155b248e..c5d644876e0c92a444a574ee7571227e19b28482 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java --- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -203,7 +203,7 @@ public class Explosion { @@ -225,7 +225,7 @@ public class Explosion {
int i1 = Mth.floor(this.y + (double) f2 + 1.0D); int i1 = Mth.floor(this.y + (double) f2 + 1.0D);
int j1 = Mth.floor(this.z - (double) f2 - 1.0D); int j1 = Mth.floor(this.z - (double) f2 - 1.0D);
int k1 = Mth.floor(this.z + (double) f2 + 1.0D); int k1 = Mth.floor(this.z + (double) f2 + 1.0D);

View file

@ -10,10 +10,10 @@ This patch adds a per-tick cache that is used for storing and retrieving
an entity's exposure during an explosion. an entity's exposure during an explosion.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d13a0f5a3b95b0d0ca80c760f757087c88eceaeb..4627eb980d5ac1571f57756bc90f2ae6d361f522 100644 index 2955636e2afd425988e9377d4bbe93258fd4e412..6986109ca6de3c73d63c4539477997361044e64f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1390,6 +1390,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1492,6 +1492,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.profiler.pop(); this.profiler.pop();
this.profiler.pop(); this.profiler.pop();
@ -22,19 +22,19 @@ index d13a0f5a3b95b0d0ca80c760f757087c88eceaeb..4627eb980d5ac1571f57756bc90f2ae6
this.profiler.popPush("connection"); this.profiler.popPush("connection");
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 4f2e06dab92085edd8f98415272cf77952e4888f..03151b8042912882ebb969dda16cc378562a0005 100644 index c5d644876e0c92a444a574ee7571227e19b28482..4e382cfae7a3a1889bc36bad24c6ea38b7eb14a6 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java --- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -223,7 +223,7 @@ public class Explosion { @@ -279,7 +279,7 @@ public class Explosion {
d8 /= d11; // CraftBukkit end
d9 /= d11; }
d10 /= d11;
- double d12 = (double) Explosion.getSeenPercent(vec3d, entity);
+ double d12 = this.getBlockDensity(vec3d, entity); // Paper - Optimize explosions
double d13 = (1.0D - d7) * d12;
// CraftBukkit start - double d12 = (1.0D - d7) * (double) Explosion.getSeenPercent(vec3d, entity);
@@ -515,4 +515,84 @@ public class Explosion { + double d12 = (1.0D - d7) * this.getBlockDensity(vec3d, entity); // Paper - Optimize explosions
double d13;
if (entity instanceof LivingEntity) {
@@ -520,4 +520,84 @@ public class Explosion {
private BlockInteraction() {} private BlockInteraction() {}
} }
@ -120,10 +120,10 @@ index 4f2e06dab92085edd8f98415272cf77952e4888f..03151b8042912882ebb969dda16cc378
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index bace136d8d62a85c5de5ca9a516d4712ddd3db99..30a3e2586a1e75c5f146f8d19c53cabe28f61925 100644 index 8bfab45b506aa514956a99354a7dc5009ffa9cbf..cf081c6d270053b7d9a042b65495fe17f0ee4826 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -167,6 +167,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -170,6 +170,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
private org.spigotmc.TickLimiter entityLimiter; private org.spigotmc.TickLimiter entityLimiter;
private org.spigotmc.TickLimiter tileLimiter; private org.spigotmc.TickLimiter tileLimiter;
private int tileTickPosition; private int tileTickPosition;

View file

@ -5,19 +5,19 @@ Subject: [PATCH] Disable explosion knockback
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 03151b8042912882ebb969dda16cc378562a0005..aea135503da20b7c4e2c6cd2dba81998f101b0c4 100644 index 4e382cfae7a3a1889bc36bad24c6ea38b7eb14a6..e59348b849a71ff5eba5bd74a9e2819a560787db 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java --- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -264,7 +264,7 @@ public class Explosion { @@ -285,7 +285,7 @@ public class Explosion {
if (entity instanceof LivingEntity) { if (entity instanceof LivingEntity) {
LivingEntity entityliving = (LivingEntity) entity; LivingEntity entityliving = (LivingEntity) entity;
- d14 = ProtectionEnchantment.getExplosionKnockbackAfterDampener(entityliving, d13); - d13 = ProtectionEnchantment.getExplosionKnockbackAfterDampener(entityliving, d12);
+ d14 = entity instanceof Player && level.paperConfig().environment.disableExplosionKnockback ? 0 : ProtectionEnchantment.getExplosionKnockbackAfterDampener(entityliving, d13); // Paper - disable explosion knockback + d13 = entity instanceof Player && level.paperConfig().environment.disableExplosionKnockback ? 0 : ProtectionEnchantment.getExplosionKnockbackAfterDampener(entityliving, d12); // Paper - disable explosion knockback
} else { } else {
d14 = d13; d13 = d12;
} }
@@ -278,7 +278,7 @@ public class Explosion { @@ -299,7 +299,7 @@ public class Explosion {
if (entity instanceof Player) { if (entity instanceof Player) {
Player entityhuman = (Player) entity; Player entityhuman = (Player) entity;

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Disable thunder
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 79f6cdfe3e744b93007699a0da71613844c3a4c7..8cb58a39b6a352b9fb6f8876b31be5579bbfa832 100644 index 0c8042a515daeeb95b14147214e0a3151ef6f5a1..3c324ffd8300da534a9877b677294ebcd7949622 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -825,7 +825,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -842,7 +842,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
ProfilerFiller gameprofilerfiller = this.getProfiler(); ProfilerFiller gameprofilerfiller = this.getProfiler();
gameprofilerfiller.push("thunder"); gameprofilerfiller.push("thunder");

View file

@ -5,17 +5,17 @@ Subject: [PATCH] Disable ice and snow
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 8cb58a39b6a352b9fb6f8876b31be5579bbfa832..3ec4c76f8c41beb822acbb19b58e19ac2f3f2ef4 100644 index 3c324ffd8300da534a9877b677294ebcd7949622..fa6cec1933582fefeffd9382cbc24fea83b5eb13 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -855,11 +855,13 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -872,11 +872,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
gameprofilerfiller.popPush("iceandsnow"); gameprofilerfiller.popPush("iceandsnow");
+ if (!this.paperConfig().environment.disableIceAndSnow) { // Paper + if (!this.paperConfig().environment.disableIceAndSnow) { // Paper
for (int l = 0; l < randomTickSpeed; ++l) { for (int l = 0; l < randomTickSpeed; ++l) {
if (this.random.nextInt(48) == 0) { if (this.random.nextInt(48) == 0) {
this.tickIceAndSnow(flag, this.getBlockRandomPos(j, 0, k, 15)); this.tickPrecipitation(this.getBlockRandomPos(j, 0, k, 15));
} }
} }
+ } // Paper + } // Paper

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable mob spawner tick rate
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index 124703a7c043b6c3b651fa1a81c5ba3e99e47938..7ae0465091db8e8061737bf93884afa3db49feeb 100644 index e888cf862662ae6baa6d0de8188aa74a9c6a8e00..bd48f49d50709354abc5bcff155b5abb9ab20191 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -45,6 +45,7 @@ public abstract class BaseSpawner { @@ -47,6 +47,7 @@ public abstract class BaseSpawner {
public int maxNearbyEntities = 6; public int maxNearbyEntities = 6;
public int requiredPlayerRange = 16; public int requiredPlayerRange = 16;
public int spawnRange = 4; public int spawnRange = 4;
@ -16,7 +16,7 @@ index 124703a7c043b6c3b651fa1a81c5ba3e99e47938..7ae0465091db8e8061737bf93884afa3
public BaseSpawner() {} public BaseSpawner() {}
@@ -79,13 +80,18 @@ public abstract class BaseSpawner { @@ -81,13 +82,18 @@ public abstract class BaseSpawner {
} }
public void serverTick(ServerLevel world, BlockPos pos) { public void serverTick(ServerLevel world, BlockPos pos) {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Implement PlayerLocaleChangeEvent
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 61ec0ed91457e4b04a72010199be520c9d4a9488..b5a8d2505fa41c68abb1400a4269f833537b6ebe 100644 index bf89ea0f7506434848cb9c1cbfb3fe6dd2eb3212..686b42a9b4475fe3d530a9b950c1cc8f04717a65 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -214,7 +214,7 @@ public class ServerPlayer extends Player { @@ -222,7 +222,7 @@ public class ServerPlayer extends Player {
private int levitationStartTime; private int levitationStartTime;
private boolean disconnected; private boolean disconnected;
private int requestedViewDistance; private int requestedViewDistance;
@ -17,7 +17,7 @@ index 61ec0ed91457e4b04a72010199be520c9d4a9488..b5a8d2505fa41c68abb1400a4269f833
public java.util.Locale adventure$locale = java.util.Locale.US; // Paper public java.util.Locale adventure$locale = java.util.Locale.US; // Paper
@Nullable @Nullable
private Vec3 startingToFallPosition; private Vec3 startingToFallPosition;
@@ -308,7 +308,7 @@ public class ServerPlayer extends Player { @@ -316,7 +316,7 @@ public class ServerPlayer extends Player {
this.lastActionTime = Util.getMillis(); this.lastActionTime = Util.getMillis();
this.recipeBook = new ServerRecipeBook(); this.recipeBook = new ServerRecipeBook();
this.requestedViewDistance = 2; this.requestedViewDistance = 2;
@ -26,7 +26,7 @@ index 61ec0ed91457e4b04a72010199be520c9d4a9488..b5a8d2505fa41c68abb1400a4269f833
this.lastSectionPos = SectionPos.of(0, 0, 0); this.lastSectionPos = SectionPos.of(0, 0, 0);
this.chunkTrackingView = ChunkTrackingView.EMPTY; this.chunkTrackingView = ChunkTrackingView.EMPTY;
this.respawnDimension = Level.OVERWORLD; this.respawnDimension = Level.OVERWORLD;
@@ -1862,9 +1862,10 @@ public class ServerPlayer extends Player { @@ -1964,9 +1964,10 @@ public class ServerPlayer extends Player {
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), this.getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT); PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), this.getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT);
this.server.server.getPluginManager().callEvent(event); this.server.server.getPluginManager().callEvent(event);
} }
@ -39,10 +39,10 @@ index 61ec0ed91457e4b04a72010199be520c9d4a9488..b5a8d2505fa41c68abb1400a4269f833
// CraftBukkit end // CraftBukkit end
this.language = clientOptions.language(); this.language = clientOptions.language();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 5f72f8ac8271d3a6619a708f52a42dc4b6dc5b80..d0448d310fde607a006acf37e86cd3eede93a2ba 100644 index eb0409c01d8e1259414803495c48ec14179f457b..1e395d14382c79231dc81d6cf7ea864e45906add 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2249,7 +2249,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2264,7 +2264,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override @Override
public String getLocale() { public String getLocale() {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable container update tick rate
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index b5a8d2505fa41c68abb1400a4269f833537b6ebe..80b74383262ba8cc2f27882cb6a9548d1f505354 100644 index 686b42a9b4475fe3d530a9b950c1cc8f04717a65..d986c09392182335112040d4b6feae6a1a740d84 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -239,6 +239,7 @@ public class ServerPlayer extends Player { @@ -247,6 +247,7 @@ public class ServerPlayer extends Player {
private RemoteChatSession chatSession; private RemoteChatSession chatSession;
private int containerCounter; private int containerCounter;
public boolean wonGame; public boolean wonGame;
@ -16,7 +16,7 @@ index b5a8d2505fa41c68abb1400a4269f833537b6ebe..80b74383262ba8cc2f27882cb6a9548d
// CraftBukkit start // CraftBukkit start
public String displayName; public String displayName;
@@ -675,7 +676,12 @@ public class ServerPlayer extends Player { @@ -683,7 +684,12 @@ public class ServerPlayer extends Player {
--this.invulnerableTime; --this.invulnerableTime;
} }

View file

@ -5,12 +5,12 @@ Subject: [PATCH] Disable spigot tick limiters
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 30a3e2586a1e75c5f146f8d19c53cabe28f61925..c2dd635cba209962d24b43fbf0ee0e9d9e82fee0 100644 index cf081c6d270053b7d9a042b65495fe17f0ee4826..ac169632113c3d2177910723ce920cd9a4f7af66 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -694,9 +694,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -705,9 +705,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Spigot start boolean flag = this.tickRateManager().runsNormally();
// Iterator iterator = this.blockEntityTickers.iterator();
int tilesThisCycle = 0; int tilesThisCycle = 0;
- for (this.tileLimiter.initTick(); - for (this.tileLimiter.initTick();
- tilesThisCycle < this.blockEntityTickers.size() && (tilesThisCycle % 10 != 0 || this.tileLimiter.shouldContinue()); - tilesThisCycle < this.blockEntityTickers.size() && (tilesThisCycle % 10 != 0 || this.tileLimiter.shouldContinue());

View file

@ -12,10 +12,10 @@ improve setPosition to use raw
public net.minecraft.world.entity.Entity setRot(FF)V public net.minecraft.world.entity.Entity setRot(FF)V
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index afaa046ff1adf717ef8356cc276a55d63abc0aba..703f006bee56bc198f0711ad464570fca406284c 100644 index fdf3bf3decb14378f5e59e41bab26e965bc7be14..b74689297ca20efee391fe1da80377082d1758e5 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -228,7 +228,7 @@ public abstract class PlayerList { @@ -227,7 +227,7 @@ public abstract class PlayerList {
// Spigot start - spawn location event // Spigot start - spawn location event
Player spawnPlayer = player.getBukkitEntity(); Player spawnPlayer = player.getBukkitEntity();
@ -24,7 +24,7 @@ index afaa046ff1adf717ef8356cc276a55d63abc0aba..703f006bee56bc198f0711ad464570fc
this.cserver.getPluginManager().callEvent(ev); this.cserver.getPluginManager().callEvent(ev);
Location loc = ev.getSpawnLocation(); Location loc = ev.getSpawnLocation();
@@ -236,7 +236,10 @@ public abstract class PlayerList { @@ -235,7 +235,10 @@ public abstract class PlayerList {
player.spawnIn(worldserver1); player.spawnIn(worldserver1);
player.gameMode.setLevel((ServerLevel) player.level()); player.gameMode.setLevel((ServerLevel) player.level());