3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 20:40:08 +01:00
Dieser Commit ist enthalten in:
Nassim Jahnke 2021-11-23 11:51:25 +01:00 committet von MiniDigger | Martin
Ursprung 284a7fed94
Commit 31f9d01c7c
8 geänderte Dateien mit 321 neuen und 445 gelöschten Zeilen

Datei anzeigen

@ -225,19 +225,6 @@ index 2e2bc7213b7e19e945eba885ff5614f809c81db0..b4edadc980c8305613bb4277c7028e25
})); }));
RecipeManager.LOGGER.info("Loaded {} recipes", map1.size()); RecipeManager.LOGGER.info("Loaded {} recipes", map1.size());
} }
diff --git a/src/main/java/net/minecraft/world/level/TickNextTickData.java b/src/main/java/net/minecraft/world/level/TickNextTickData.java
index eb07e63f3c40fd8914cde50dfa789b1ed20b755a..3af31dc2c82c11ee78d497c5777615c17cb13c7a 100644
--- a/src/main/java/net/minecraft/world/level/TickNextTickData.java
+++ b/src/main/java/net/minecraft/world/level/TickNextTickData.java
@@ -39,7 +39,7 @@ public class TickNextTickData<T> {
}
public static <T> Comparator<TickNextTickData<T>> createTimeComparator() {
- return Comparator.comparingLong((tickNextTickData) -> {
+ return Comparator.<TickNextTickData<T>>comparingLong((tickNextTickData) -> { // Paper - decompile fix
return tickNextTickData.triggerTick;
}).thenComparing((tickNextTickData) -> {
return tickNextTickData.priority;
diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java
index 3c20bd9405f7844d92fdb42a49efd260bff7c7a0..315a6bbdfa59d85be721735cfe727d34b28fc0ad 100644 index 3c20bd9405f7844d92fdb42a49efd260bff7c7a0..315a6bbdfa59d85be721735cfe727d34b28fc0ad 100644
--- a/src/main/java/net/minecraft/world/level/biome/Biome.java --- a/src/main/java/net/minecraft/world/level/biome/Biome.java

Datei anzeigen

@ -4410,10 +4410,10 @@ index 0000000000000000000000000000000000000000..4d3dc8fba51bf5c0dceb06744781d1df
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index 771e4b72589d7117a154ab6917bd4a56d55f19db..65e0ca442980f273d2fe5f131e174cd92f80da20 100644 index 58dbe9077fc12964477d6a6fb57d67c41865412c..3ed0bf0485266c0a2b459f5cc1940f85f74e3624 100644
--- a/src/main/java/net/minecraft/Util.java --- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java
@@ -94,7 +94,7 @@ public class Util { @@ -98,7 +98,7 @@ public class Util {
} }
public static long getNanos() { public static long getNanos() {
@ -4423,10 +4423,10 @@ index 771e4b72589d7117a154ab6917bd4a56d55f19db..65e0ca442980f273d2fe5f131e174cd9
public static long getEpochMillis() { public static long getEpochMillis() {
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
index 59240bb0ce088a14f8ccb62de8b69bc7bf313975..ed52d042f41942ae512148fbba310093358ead68 100644 index 53f438b3747ff20dd18bc757b5b672aaa9db7b81..5f23b9ab6540530acac623d2cd8e9ec5d0064f39 100644
--- a/src/main/java/net/minecraft/core/BlockPos.java --- a/src/main/java/net/minecraft/core/BlockPos.java
+++ b/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java
@@ -525,6 +525,7 @@ public class BlockPos extends Vec3i { @@ -531,6 +531,7 @@ public class BlockPos extends Vec3i {
} }
} }
@ -4434,7 +4434,7 @@ index 59240bb0ce088a14f8ccb62de8b69bc7bf313975..ed52d042f41942ae512148fbba310093
@Override @Override
public BlockPos.MutableBlockPos setX(int i) { public BlockPos.MutableBlockPos setX(int i) {
super.setX(i); super.setX(i);
@@ -542,6 +543,7 @@ public class BlockPos extends Vec3i { @@ -548,6 +549,7 @@ public class BlockPos extends Vec3i {
super.setZ(i); super.setZ(i);
return this; return this;
} }
@ -4443,10 +4443,10 @@ index 59240bb0ce088a14f8ccb62de8b69bc7bf313975..ed52d042f41942ae512148fbba310093
@Override @Override
public BlockPos immutable() { public BlockPos immutable() {
diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java
index 3d374000cd61d4a29dae21035c5ee9a93a1ff0f9..e59475b7bb3e000afece0033c5d3f112d643c4f2 100644 index cbe273a012bedc3914b8cf1f5ad1fee1dfee6a7e..d0b523387a194d1649469e8d861b0b78a2f4e0b6 100644
--- a/src/main/java/net/minecraft/nbt/CompoundTag.java --- a/src/main/java/net/minecraft/nbt/CompoundTag.java
+++ b/src/main/java/net/minecraft/nbt/CompoundTag.java +++ b/src/main/java/net/minecraft/nbt/CompoundTag.java
@@ -60,7 +60,7 @@ public class CompoundTag implements Tag { @@ -122,7 +122,7 @@ public class CompoundTag implements Tag {
return "TAG_Compound"; return "TAG_Compound";
} }
}; };
@ -4455,7 +4455,7 @@ index 3d374000cd61d4a29dae21035c5ee9a93a1ff0f9..e59475b7bb3e000afece0033c5d3f112
protected CompoundTag(Map<String, Tag> entries) { protected CompoundTag(Map<String, Tag> entries) {
this.tags = entries; this.tags = entries;
@@ -123,6 +123,10 @@ public class CompoundTag implements Tag { @@ -185,6 +185,10 @@ public class CompoundTag implements Tag {
this.tags.put(key, NbtUtils.createUUID(value)); this.tags.put(key, NbtUtils.createUUID(value));
} }
@ -4467,17 +4467,17 @@ index 3d374000cd61d4a29dae21035c5ee9a93a1ff0f9..e59475b7bb3e000afece0033c5d3f112
return NbtUtils.loadUUID(this.get(key)); return NbtUtils.loadUUID(this.get(key));
} }
diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java
index 5bcfbda6fd8bb8a3793ddad18f533f4f31f0bc94..8e9d685d04b93cef73b3fbebd086c970968914d5 100644 index 4ea6c2f0ac4703a5d67137073a5da0c39d77bdce..b964121f19e6a28df7675e65441c551a55316753 100644
--- a/src/main/java/net/minecraft/network/PacketEncoder.java --- a/src/main/java/net/minecraft/network/PacketEncoder.java
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java
@@ -45,7 +45,7 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { @@ -48,7 +48,7 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
throw new IllegalArgumentException("Packet too big (is " + j + ", should be less than 8388608): " + packet); JvmProfiler.INSTANCE.onPacketSent(k, integer, channelHandlerContext.channel().remoteAddress(), j);
} }
} catch (Throwable var9) { } catch (Throwable var10) {
- LOGGER.error(var9); - LOGGER.error(var10);
+ LOGGER.error("Packet encoding of packet ID {} threw (skippable? {})", integer, packet.isSkippable(), var9); // Paper - WHAT WAS IT? WHO DID THIS TO YOU? WHAT DID YOU SEE? + LOGGER.error("Packet encoding of packet ID {} threw (skippable? {})", integer, packet.isSkippable(), var10); // Paper - Give proper error message
if (packet.isSkippable()) { if (packet.isSkippable()) {
throw new SkipPacketException(var9); throw new SkipPacketException(var10);
} else { } else {
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
new file mode 100644 new file mode 100644
@ -4987,10 +4987,10 @@ index 0000000000000000000000000000000000000000..850caa39d4875620b05c9a3cc27c65ef
+ } + }
+} +}
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 8be15a63be90720ce34a7c0cb696a59d864396f8..2c2c70e784e9c7bebc6bca1ef48e6992b12b82d5 100644 index b06105d3920f68bcedb81359b0f62925421b338d..6fc450b66d381c6453498fa18d36570ef74b124d 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
@@ -296,6 +296,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -294,6 +294,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public final double[] recentTps = new double[ 3 ]; public final double[] recentTps = new double[ 3 ];
public final SlackActivityAccountant slackActivityAccountant = new SlackActivityAccountant(); public final SlackActivityAccountant slackActivityAccountant = new SlackActivityAccountant();
// Spigot end // Spigot end
@ -4998,7 +4998,7 @@ index 8be15a63be90720ce34a7c0cb696a59d864396f8..2c2c70e784e9c7bebc6bca1ef48e6992
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();
@@ -965,6 +966,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -948,6 +949,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
MinecraftServer.LOGGER.error("Failed to unlock level {}", this.storageSource.getLevelId(), ioexception1); MinecraftServer.LOGGER.error("Failed to unlock level {}", this.storageSource.getLevelId(), ioexception1);
} }
// Spigot start // Spigot start
@ -5008,7 +5008,7 @@ index 8be15a63be90720ce34a7c0cb696a59d864396f8..2c2c70e784e9c7bebc6bca1ef48e6992
if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) { if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
MinecraftServer.LOGGER.info("Saving usercache.json"); MinecraftServer.LOGGER.info("Saving usercache.json");
this.getProfileCache().save(); this.getProfileCache().save();
@@ -1027,6 +1031,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1010,6 +1014,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.lastOverloadWarning = this.nextTickTime; this.lastOverloadWarning = this.nextTickTime;
} }
@ -5016,15 +5016,16 @@ index 8be15a63be90720ce34a7c0cb696a59d864396f8..2c2c70e784e9c7bebc6bca1ef48e6992
if ( tickCount++ % MinecraftServer.SAMPLE_INTERVAL == 0 ) if ( tickCount++ % MinecraftServer.SAMPLE_INTERVAL == 0 )
{ {
double currentTps = 1E3 / ( curTime - tickSection ) * MinecraftServer.SAMPLE_INTERVAL; double currentTps = 1E3 / ( curTime - tickSection ) * MinecraftServer.SAMPLE_INTERVAL;
@@ -1248,6 +1253,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1233,7 +1238,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.snooper.prepare(); MinecraftServer.LOGGER.debug("Autosave finished");
SpigotTimings.worldSaveTimer.stopTiming(); // Spigot
} }
-
+ io.papermc.paper.util.CachedLists.reset(); // Paper + io.papermc.paper.util.CachedLists.reset(); // Paper
this.profiler.pop();
this.profiler.push("tallying"); this.profiler.push("tallying");
long l = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i; long l = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i;
@@ -1311,6 +1317,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1296,6 +1301,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
try { try {
worldserver.timings.doTick.startTiming(); // Spigot worldserver.timings.doTick.startTiming(); // Spigot
worldserver.tick(shouldKeepTicking); worldserver.tick(shouldKeepTicking);
@ -5037,10 +5038,10 @@ index 8be15a63be90720ce34a7c0cb696a59d864396f8..2c2c70e784e9c7bebc6bca1ef48e6992
} catch (Throwable throwable) { } catch (Throwable throwable) {
// Spigot Start // Spigot Start
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 6fa6fb852cd5af2009008ac6158251ba5e8cf6fb..bbf2dee8cdd2d8239d9230b1a7fff4f07c2edaf8 100644 index d2fbb6e28db27b3207879be3027bb74410a53900..258597ff1b8c83c1377fe21db60abf84abbf431c 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -52,9 +52,9 @@ public class ChunkHolder { @@ -49,9 +49,9 @@ public class ChunkHolder {
private static final int BLOCKS_BEFORE_RESEND_FUDGE = 64; private static final int BLOCKS_BEFORE_RESEND_FUDGE = 64;
private final AtomicReferenceArray<CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>>> futures; private final AtomicReferenceArray<CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>>> futures;
private final LevelHeightAccessor levelHeightAccessor; private final LevelHeightAccessor levelHeightAccessor;
@ -5053,7 +5054,7 @@ index 6fa6fb852cd5af2009008ac6158251ba5e8cf6fb..bbf2dee8cdd2d8239d9230b1a7fff4f0
private CompletableFuture<ChunkAccess> chunkToSave; private CompletableFuture<ChunkAccess> chunkToSave;
@Nullable @Nullable
private final DebugBuffer<ChunkHolder.ChunkSaveDebug> chunkToSaveHistory; private final DebugBuffer<ChunkHolder.ChunkSaveDebug> chunkToSaveHistory;
@@ -73,6 +73,8 @@ public class ChunkHolder { @@ -70,6 +70,8 @@ public class ChunkHolder {
private boolean resendLight; private boolean resendLight;
private CompletableFuture<Void> pendingFullStateConfirmation; private CompletableFuture<Void> pendingFullStateConfirmation;
@ -5062,7 +5063,7 @@ index 6fa6fb852cd5af2009008ac6158251ba5e8cf6fb..bbf2dee8cdd2d8239d9230b1a7fff4f0
public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) { public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) {
this.futures = new AtomicReferenceArray(ChunkHolder.CHUNK_STATUSES.size()); this.futures = new AtomicReferenceArray(ChunkHolder.CHUNK_STATUSES.size());
this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE; this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
@@ -93,10 +95,11 @@ public class ChunkHolder { @@ -90,10 +92,11 @@ public class ChunkHolder {
this.queueLevel = this.oldTicketLevel; this.queueLevel = this.oldTicketLevel;
this.setTicketLevel(level); this.setTicketLevel(level);
this.changedBlocksPerSection = new ShortSet[world.getSectionsCount()]; this.changedBlocksPerSection = new ShortSet[world.getSectionsCount()];
@ -5075,7 +5076,7 @@ index 6fa6fb852cd5af2009008ac6158251ba5e8cf6fb..bbf2dee8cdd2d8239d9230b1a7fff4f0
if (!ChunkHolder.getFullChunkStatus(this.oldTicketLevel).isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) return null; // note: using oldTicketLevel for isLoaded checks if (!ChunkHolder.getFullChunkStatus(this.oldTicketLevel).isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) return null; // note: using oldTicketLevel for isLoaded checks
return this.getFullChunkUnchecked(); return this.getFullChunkUnchecked();
} }
@@ -118,20 +121,20 @@ public class ChunkHolder { @@ -115,20 +118,20 @@ public class ChunkHolder {
return ChunkHolder.getStatus(this.ticketLevel).isOrAfter(leastStatus) ? this.getFutureIfPresentUnchecked(leastStatus) : ChunkHolder.UNLOADED_CHUNK_FUTURE; return ChunkHolder.getStatus(this.ticketLevel).isOrAfter(leastStatus) ? this.getFutureIfPresentUnchecked(leastStatus) : ChunkHolder.UNLOADED_CHUNK_FUTURE;
} }
@ -5100,7 +5101,7 @@ index 6fa6fb852cd5af2009008ac6158251ba5e8cf6fb..bbf2dee8cdd2d8239d9230b1a7fff4f0
CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> completablefuture = this.getTickingChunkFuture(); CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> completablefuture = this.getTickingChunkFuture();
Either<LevelChunk, ChunkHolder.ChunkLoadingFailure> either = (Either) completablefuture.getNow(null); // CraftBukkit - decompile error Either<LevelChunk, ChunkHolder.ChunkLoadingFailure> either = (Either) completablefuture.getNow(null); // CraftBukkit - decompile error
@@ -170,7 +173,7 @@ public class ChunkHolder { @@ -167,7 +170,7 @@ public class ChunkHolder {
return null; return null;
} }
@ -5109,7 +5110,7 @@ index 6fa6fb852cd5af2009008ac6158251ba5e8cf6fb..bbf2dee8cdd2d8239d9230b1a7fff4f0
return this.chunkToSave; return this.chunkToSave;
} }
@@ -328,11 +331,11 @@ public class ChunkHolder { @@ -325,11 +328,11 @@ public class ChunkHolder {
return ChunkHolder.getFullChunkStatus(this.ticketLevel); return ChunkHolder.getFullChunkStatus(this.ticketLevel);
} }
@ -5123,7 +5124,7 @@ index 6fa6fb852cd5af2009008ac6158251ba5e8cf6fb..bbf2dee8cdd2d8239d9230b1a7fff4f0
return this.ticketLevel; return this.ticketLevel;
} }
@@ -421,14 +424,27 @@ public class ChunkHolder { @@ -418,14 +421,27 @@ public class ChunkHolder {
this.wasAccessibleSinceLastSave |= flag3; this.wasAccessibleSinceLastSave |= flag3;
if (!flag2 && flag3) { if (!flag2 && flag3) {
@ -5144,14 +5145,14 @@ index 6fa6fb852cd5af2009008ac6158251ba5e8cf6fb..bbf2dee8cdd2d8239d9230b1a7fff4f0
} }
if (flag2 && !flag3) { if (flag2 && !flag3) {
completablefuture = this.fullChunkFuture; this.fullChunkFuture.complete(ChunkHolder.UNLOADED_LEVEL_CHUNK);
this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE; this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
+ ++this.fullChunkCreateCount; // Paper - cache ticking ready status + ++this.fullChunkCreateCount; // Paper - cache ticking ready status
+ this.isFullChunkReady = false; // Paper - cache ticking ready status + this.isFullChunkReady = false; // Paper - cache ticking ready status
this.updateChunkToSave(((CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>>) completablefuture).thenApply((either1) -> { // CraftBukkit - decompile error }
Objects.requireNonNull(chunkStorage);
return either1.ifLeft(chunkStorage::packTicks); boolean flag4 = playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.TICKING);
@@ -441,12 +457,29 @@ public class ChunkHolder { @@ -434,12 +450,29 @@ public class ChunkHolder {
if (!flag4 && flag5) { if (!flag4 && flag5) {
this.tickingChunkFuture = chunkStorage.prepareTickingChunk(this); this.tickingChunkFuture = chunkStorage.prepareTickingChunk(this);
this.scheduleFullChunkPromotion(chunkStorage, this.tickingChunkFuture, executor, ChunkHolder.FullChunkStatus.TICKING); this.scheduleFullChunkPromotion(chunkStorage, this.tickingChunkFuture, executor, ChunkHolder.FullChunkStatus.TICKING);
@ -5182,7 +5183,7 @@ index 6fa6fb852cd5af2009008ac6158251ba5e8cf6fb..bbf2dee8cdd2d8239d9230b1a7fff4f0
} }
boolean flag6 = playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.ENTITY_TICKING); boolean flag6 = playerchunk_state.isOrAfter(ChunkHolder.FullChunkStatus.ENTITY_TICKING);
@@ -459,12 +492,28 @@ public class ChunkHolder { @@ -452,12 +485,28 @@ public class ChunkHolder {
this.entityTickingChunkFuture = chunkStorage.prepareEntityTickingChunk(this.pos); this.entityTickingChunkFuture = chunkStorage.prepareEntityTickingChunk(this.pos);
this.scheduleFullChunkPromotion(chunkStorage, this.entityTickingChunkFuture, executor, ChunkHolder.FullChunkStatus.ENTITY_TICKING); this.scheduleFullChunkPromotion(chunkStorage, this.entityTickingChunkFuture, executor, ChunkHolder.FullChunkStatus.ENTITY_TICKING);
@ -5213,10 +5214,10 @@ index 6fa6fb852cd5af2009008ac6158251ba5e8cf6fb..bbf2dee8cdd2d8239d9230b1a7fff4f0
if (!playerchunk_state1.isOrAfter(playerchunk_state)) { if (!playerchunk_state1.isOrAfter(playerchunk_state)) {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 6df8c7ffd48b18dc0cb0dd9ec826228282e50180..ed21bd46262ac33801c17e6135dd22f99dd78504 100644 index 01b59a9c18d6f07889c3df2975cbf5594a167633..3f938d953daee7a5551a62df25f2e0fb487733ec 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -55,6 +55,7 @@ import net.minecraft.network.protocol.game.ClientboundSetChunkCacheCenterPacket; @@ -58,6 +58,7 @@ import net.minecraft.network.protocol.game.ClientboundSetChunkCacheCenterPacket;
import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket; import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket;
import net.minecraft.network.protocol.game.ClientboundSetPassengersPacket; import net.minecraft.network.protocol.game.ClientboundSetPassengersPacket;
import net.minecraft.network.protocol.game.DebugPackets; import net.minecraft.network.protocol.game.DebugPackets;
@ -5224,7 +5225,7 @@ index 6df8c7ffd48b18dc0cb0dd9ec826228282e50180..ed21bd46262ac33801c17e6135dd22f9
import net.minecraft.server.level.progress.ChunkProgressListener; import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.server.network.ServerPlayerConnection; import net.minecraft.server.network.ServerPlayerConnection;
import net.minecraft.util.CsvOutput; import net.minecraft.util.CsvOutput;
@@ -152,6 +153,56 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -156,6 +157,56 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}; };
// CraftBukkit end // CraftBukkit end
@ -5279,11 +5280,11 @@ index 6df8c7ffd48b18dc0cb0dd9ec826228282e50180..ed21bd46262ac33801c17e6135dd22f9
+ // Paper end + // Paper end
+ +
public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor executor, BlockableEventLoop<Runnable> mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory, int viewDistance, boolean dsync) { public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor executor, BlockableEventLoop<Runnable> mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory, int viewDistance, boolean dsync) {
super(new File(session.getDimensionPath(world.dimension()), "region"), dataFixer, dsync); super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync);
this.visibleChunkMap = this.updatingChunkMap.clone(); this.visibleChunkMap = this.updatingChunkMap.clone();
@@ -187,6 +238,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -191,6 +242,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.overworldDataStorage = persistentStateManagerFactory; this.overworldDataStorage = persistentStateManagerFactory;
this.poiManager = new PoiManager(new File(file, "poi"), dataFixer, dsync, world); this.poiManager = new PoiManager(path.resolve("poi"), dataFixer, dsync, world);
this.setViewDistance(viewDistance); this.setViewDistance(viewDistance);
+ // Paper start + // Paper start
+ this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new); + this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new);
@ -5291,8 +5292,8 @@ index 6df8c7ffd48b18dc0cb0dd9ec826228282e50180..ed21bd46262ac33801c17e6135dd22f9
+ // Paper end + // Paper end
} }
private static double euclideanDistanceSquared(ChunkPos pos, Entity entity) { protected ChunkGenerator generator() {
@@ -273,6 +328,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -318,6 +373,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
} }
@ -5307,7 +5308,7 @@ index 6df8c7ffd48b18dc0cb0dd9ec826228282e50180..ed21bd46262ac33801c17e6135dd22f9
private CompletableFuture<Either<List<ChunkAccess>, ChunkHolder.ChunkLoadingFailure>> getChunkRangeFuture(ChunkPos centerChunk, int margin, IntFunction<ChunkStatus> distanceToStatus) { private CompletableFuture<Either<List<ChunkAccess>, ChunkHolder.ChunkLoadingFailure>> getChunkRangeFuture(ChunkPos centerChunk, int margin, IntFunction<ChunkStatus> distanceToStatus) {
List<CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>>> list = Lists.newArrayList(); List<CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>>> list = Lists.newArrayList();
int j = centerChunk.x; int j = centerChunk.x;
@@ -363,6 +426,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -408,6 +471,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
holder.setTicketLevel(level); holder.setTicketLevel(level);
} else { } else {
holder = new ChunkHolder(new ChunkPos(pos), level, this.level, this.lightEngine, this.queueSorter, this); holder = new ChunkHolder(new ChunkPos(pos), level, this.level, this.lightEngine, this.queueSorter, this);
@ -5319,7 +5320,7 @@ index 6df8c7ffd48b18dc0cb0dd9ec826228282e50180..ed21bd46262ac33801c17e6135dd22f9
} }
this.updatingChunkMap.put(pos, holder); this.updatingChunkMap.put(pos, holder);
@@ -484,7 +552,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -532,7 +600,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (completablefuture1 != completablefuture) { if (completablefuture1 != completablefuture) {
this.scheduleUnload(pos, holder); this.scheduleUnload(pos, holder);
} else { } else {
@ -5334,7 +5335,7 @@ index 6df8c7ffd48b18dc0cb0dd9ec826228282e50180..ed21bd46262ac33801c17e6135dd22f9
if (ichunkaccess instanceof LevelChunk) { if (ichunkaccess instanceof LevelChunk) {
((LevelChunk) ichunkaccess).setLoaded(false); ((LevelChunk) ichunkaccess).setLoaded(false);
} }
@@ -499,7 +573,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -547,7 +621,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.lightEngine.updateChunkStatus(ichunkaccess.getPos()); this.lightEngine.updateChunkStatus(ichunkaccess.getPos());
this.lightEngine.tryScheduleUpdate(); this.lightEngine.tryScheduleUpdate();
this.progressListener.onStatusChange(ichunkaccess.getPos(), (ChunkStatus) null); this.progressListener.onStatusChange(ichunkaccess.getPos(), (ChunkStatus) null);
@ -5347,7 +5348,7 @@ index 6df8c7ffd48b18dc0cb0dd9ec826228282e50180..ed21bd46262ac33801c17e6135dd22f9
} }
}; };
@@ -962,6 +1040,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1061,6 +1139,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (!flag1) { if (!flag1) {
this.distanceManager.addPlayer(SectionPos.of((Entity) player), player); this.distanceManager.addPlayer(SectionPos.of((Entity) player), player);
} }
@ -5355,7 +5356,7 @@ index 6df8c7ffd48b18dc0cb0dd9ec826228282e50180..ed21bd46262ac33801c17e6135dd22f9
} else { } else {
SectionPos sectionposition = player.getLastSectionPos(); SectionPos sectionposition = player.getLastSectionPos();
@@ -969,6 +1048,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1068,6 +1147,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (!flag2) { if (!flag2) {
this.distanceManager.removePlayer(sectionposition, player); this.distanceManager.removePlayer(sectionposition, player);
} }
@ -5363,7 +5364,7 @@ index 6df8c7ffd48b18dc0cb0dd9ec826228282e50180..ed21bd46262ac33801c17e6135dd22f9
} }
for (int k = i - this.viewDistance; k <= i + this.viewDistance; ++k) { for (int k = i - this.viewDistance; k <= i + this.viewDistance; ++k) {
@@ -1079,6 +1159,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1184,6 +1264,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
} }
@ -5373,10 +5374,10 @@ index 6df8c7ffd48b18dc0cb0dd9ec826228282e50180..ed21bd46262ac33801c17e6135dd22f9
@Override @Override
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 9591f50922343283597bad6d9ac17c175d8ae230..77d98bfa0ad9fc92a8e794b5a4e00c3e471c123a 100644 index a551683bc73db23d82bd2ca1e2c7c83e31e3c834..a832e6af0ce937d6e48021e3b2190ebe22bc3be5 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
@@ -44,8 +44,10 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana @@ -46,8 +46,10 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana
import net.minecraft.world.level.storage.DimensionDataStorage; import net.minecraft.world.level.storage.DimensionDataStorage;
import net.minecraft.world.level.storage.LevelData; import net.minecraft.world.level.storage.LevelData;
import net.minecraft.world.level.storage.LevelStorageSource; import net.minecraft.world.level.storage.LevelStorageSource;
@ -5387,7 +5388,7 @@ index 9591f50922343283597bad6d9ac17c175d8ae230..77d98bfa0ad9fc92a8e794b5a4e00c3e
public static final List<ChunkStatus> CHUNK_STATUSES = ChunkStatus.getStatusList(); public static final List<ChunkStatus> CHUNK_STATUSES = ChunkStatus.getStatusList();
private final DistanceManager distanceManager; private final DistanceManager distanceManager;
@@ -66,6 +68,316 @@ public class ServerChunkCache extends ChunkSource { @@ -67,6 +69,316 @@ public class ServerChunkCache extends ChunkSource {
@Nullable @Nullable
@VisibleForDebug @VisibleForDebug
private NaturalSpawner.SpawnState lastSpawnState; private NaturalSpawner.SpawnState lastSpawnState;
@ -5702,7 +5703,7 @@ index 9591f50922343283597bad6d9ac17c175d8ae230..77d98bfa0ad9fc92a8e794b5a4e00c3e
+ final io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet<LevelChunk> entityTickingChunks = new io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet<>(4096, 0.75f, 4096, 0.15, true); + final io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet<LevelChunk> entityTickingChunks = new io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet<>(4096, 0.75f, 4096, 0.15, true);
+ // Paper end + // Paper end
public ServerChunkCache(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor workerExecutor, ChunkGenerator chunkGenerator, int viewDistance, boolean flag, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkstatusupdatelistener, Supplier<DimensionDataStorage> supplier) { public ServerChunkCache(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor workerExecutor, ChunkGenerator chunkGenerator, int viewDistance, int simulationDistance, boolean dsync, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory) {
this.level = world; this.level = world;
@@ -127,6 +439,49 @@ public class ServerChunkCache extends ChunkSource { @@ -127,6 +439,49 @@ public class ServerChunkCache extends ChunkSource {
this.lastChunk[0] = chunk; this.lastChunk[0] = chunk;
@ -5754,17 +5755,17 @@ index 9591f50922343283597bad6d9ac17c175d8ae230..77d98bfa0ad9fc92a8e794b5a4e00c3e
@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) {
@@ -453,7 +808,7 @@ public class ServerChunkCache extends ChunkSource { @@ -441,7 +796,7 @@ public class ServerChunkCache extends ChunkSource {
} gameprofilerfiller.popPush("spawnAndTick");
boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
this.level.getProfiler().popPush("broadcast"); - Collections.shuffle(list);
- list.forEach((playerchunk) -> { + //Collections.shuffle(list); // Paper - no... just no...
+ this.chunkMap.getChunks().forEach((playerchunk) -> { // Paper - no... just no... Iterator iterator1 = list.iterator();
Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left(); // CraftBukkit - decompile error
Objects.requireNonNull(playerchunk); while (iterator1.hasNext()) {
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 eded0e6fd0030f1f01f7e2b16497be768518728e..8115e016109f560f2de78c69285342a42ebd119a 100644 index 54b4b73c05d87fc7b939a38915e62fef2405db7f..d94dca6db38207021026953ef4598756a797562c 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
@@ -9,6 +9,7 @@ import it.unimi.dsi.fastutil.longs.LongSet; @@ -9,6 +9,7 @@ import it.unimi.dsi.fastutil.longs.LongSet;
@ -5775,7 +5776,7 @@ index eded0e6fd0030f1f01f7e2b16497be768518728e..8115e016109f560f2de78c69285342a4
import it.unimi.dsi.fastutil.objects.ObjectIterator; import it.unimi.dsi.fastutil.objects.ObjectIterator;
import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet;
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
@@ -161,6 +162,7 @@ import org.bukkit.event.server.MapInitializeEvent; @@ -157,6 +158,7 @@ import org.bukkit.event.server.MapInitializeEvent;
import org.bukkit.event.weather.LightningStrikeEvent; import org.bukkit.event.weather.LightningStrikeEvent;
import org.bukkit.event.world.TimeSkipEvent; import org.bukkit.event.world.TimeSkipEvent;
// CraftBukkit end // CraftBukkit end
@ -5783,8 +5784,8 @@ index eded0e6fd0030f1f01f7e2b16497be768518728e..8115e016109f560f2de78c69285342a4
public class ServerLevel extends Level implements WorldGenLevel { public class ServerLevel extends Level implements WorldGenLevel {
@@ -200,6 +202,96 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -212,6 +214,96 @@ public class ServerLevel extends Level implements WorldGenLevel {
return this.chunkSource.getChunk(x, z, false); return convertable.dimensionType;
} }
+ // Paper start + // Paper start
@ -5881,10 +5882,10 @@ index eded0e6fd0030f1f01f7e2b16497be768518728e..8115e016109f560f2de78c69285342a4
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, ServerLevelData iworlddataserver, ResourceKey<Level> resourcekey, DimensionType dimensionmanager, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<CustomSpawner> list, boolean flag1, 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, ServerLevelData iworlddataserver, ResourceKey<Level> resourcekey, DimensionType dimensionmanager, ChunkProgressListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
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 6c7c9750d67c914afaf4ecc48facac3189eba75b..89c718e5b975a83b07a114b2b2c6fe31c75cb580 100644 index b64f9dc47d4f632624fc40bbbafd24cb5ae7cd9b..925ffbddd5475be7fe00570d861b615f707434b4 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
@@ -229,6 +229,8 @@ public class ServerPlayer extends Player { @@ -232,6 +232,8 @@ public class ServerPlayer extends Player {
public Integer clientViewDistance; public Integer clientViewDistance;
// CraftBukkit end // CraftBukkit end
@ -5893,7 +5894,7 @@ index 6c7c9750d67c914afaf4ecc48facac3189eba75b..89c718e5b975a83b07a114b2b2c6fe31
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) { public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile); super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
this.chatVisibility = ChatVisiblity.FULL; this.chatVisibility = ChatVisiblity.FULL;
@@ -291,6 +293,8 @@ public class ServerPlayer extends Player { @@ -295,6 +297,8 @@ public class ServerPlayer extends Player {
this.maxUpStep = 1.0F; this.maxUpStep = 1.0F;
this.fudgeSpawnLocation(world); this.fudgeSpawnLocation(world);
@ -5915,10 +5916,10 @@ index 3a4f026c73cdd22d30bdadabbcf24bef969b73e4..0d536d72ac918fbd403397ff369d1014
private final String name; private final String name;
private final Comparator<T> comparator; private final Comparator<T> comparator;
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 391bae98e542333a431fb48bf0675c0e8a1873ac..0f6b534a4c789a2f09f6c4624e5d58b99c7ed0e6 100644 index 1898616fa04a16983fefe8e4fa0c60de82b52f03..fea9a73b64523b8a065b37ebf8be50d5ec0faccb 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
@@ -150,6 +150,26 @@ public class WorldGenRegion implements WorldGenLevel { @@ -152,6 +152,26 @@ public class WorldGenRegion implements WorldGenLevel {
return chunkX >= this.firstPos.x && chunkX <= this.lastPos.x && chunkZ >= this.firstPos.z && chunkZ <= this.lastPos.z; return chunkX >= this.firstPos.x && chunkX <= this.lastPos.x && chunkZ >= this.firstPos.z && chunkZ <= this.lastPos.z;
} }
@ -5946,10 +5947,10 @@ index 391bae98e542333a431fb48bf0675c0e8a1873ac..0f6b534a4c789a2f09f6c4624e5d58b9
public BlockState getBlockState(BlockPos pos) { public BlockState getBlockState(BlockPos pos) {
return this.getChunk(SectionPos.blockToSectionCoord(pos.getX()), SectionPos.blockToSectionCoord(pos.getZ())).getBlockState(pos); return this.getChunk(SectionPos.blockToSectionCoord(pos.getX()), SectionPos.blockToSectionCoord(pos.getZ())).getBlockState(pos);
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 294060d48c624d77e64ddfa19607905cda1be675..2c8fa37694212f03f6c1f760078230b36b0fd1eb 100644 index cf596d49cf21f66245095753f38aebaaa680259b..0251908052d6221dc9fdab38ff8cfb3b7be8d28b 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
@@ -218,9 +218,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -217,9 +217,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
private final MinecraftServer server; private final MinecraftServer server;
public ServerPlayer player; public ServerPlayer player;
private int tickCount; private int tickCount;
@ -5960,7 +5961,7 @@ index 294060d48c624d77e64ddfa19607905cda1be675..2c8fa37694212f03f6c1f760078230b3
+ private boolean keepAlivePending; @Deprecated private void setPendingPing(boolean isPending) { this.keepAlivePending = isPending;}; @Deprecated private boolean isPendingPing() { return this.keepAlivePending;}; // Paper - OBFHELPER + private boolean keepAlivePending; @Deprecated private void setPendingPing(boolean isPending) { this.keepAlivePending = isPending;}; @Deprecated private boolean isPendingPing() { return this.keepAlivePending;}; // Paper - OBFHELPER
+ private long keepAliveChallenge; @Deprecated private void setKeepAliveID(long keepAliveID) { this.keepAliveChallenge = keepAliveID;}; @Deprecated private long getKeepAliveID() {return this.keepAliveChallenge; }; // Paper - OBFHELPER + private long keepAliveChallenge; @Deprecated private void setKeepAliveID(long keepAliveID) { this.keepAliveChallenge = keepAliveID;}; @Deprecated private long getKeepAliveID() {return this.keepAliveChallenge; }; // Paper - OBFHELPER
// CraftBukkit start - multithreaded fields // CraftBukkit start - multithreaded fields
private AtomicInteger chatSpamTickCount = new AtomicInteger(); private final AtomicInteger chatSpamTickCount = new AtomicInteger();
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
index a4c5edee297af6d68d518b77f706732b5ccbe4de..7bf4bf5cb2c1b54a7e2733091f48f3a824336d36 100644 index a4c5edee297af6d68d518b77f706732b5ccbe4de..7bf4bf5cb2c1b54a7e2733091f48f3a824336d36 100644
@ -5981,10 +5982,10 @@ index a4c5edee297af6d68d518b77f706732b5ccbe4de..7bf4bf5cb2c1b54a7e2733091f48f3a8
@Override @Override
public void tell(R runnable) { public void tell(R runnable) {
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 c57bde6b2042c0a68cb02f43c28cae0070f38111..a5f704edf4d8afdb088f3a4ac8e3957f8851842d 100644 index b40beedacba589ac2ec117d6e619730d7e072e12..371ecc33fec6b8c1a2c022196e90e6169ca1eb3b 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
@@ -298,6 +298,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -302,6 +302,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return this.level.hasChunk((int) Math.floor(this.getX()) >> 4, (int) Math.floor(this.getZ()) >> 4); return this.level.hasChunk((int) Math.floor(this.getX()) >> 4, (int) Math.floor(this.getZ()) >> 4);
} }
// CraftBukkit end // CraftBukkit end
@ -5997,10 +5998,10 @@ index c57bde6b2042c0a68cb02f43c28cae0070f38111..a5f704edf4d8afdb088f3a4ac8e3957f
public Entity(EntityType<?> type, Level world) { public Entity(EntityType<?> type, Level world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet(); this.id = Entity.ENTITY_COUNTER.incrementAndGet();
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 41e5b1a888f2fa5c7fd26095d070898c9e4489eb..fd8c35e896cc03a21c41e846dc5413ce00da47b0 100644 index dde1e84b2ff048fe96b77daa81374f0e68be4310..010d7a0dc97c7bdd3fbafe974aa73f3dba106d4d 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -259,6 +259,7 @@ public abstract class LivingEntity extends Entity { @@ -256,6 +256,7 @@ public abstract class LivingEntity extends Entity {
public boolean collides = true; public boolean collides = true;
public Set<UUID> collidableExemptions = new HashSet<>(); public Set<UUID> collidableExemptions = new HashSet<>();
public boolean bukkitPickUpLoot; public boolean bukkitPickUpLoot;
@ -6009,35 +6010,35 @@ index 41e5b1a888f2fa5c7fd26095d070898c9e4489eb..fd8c35e896cc03a21c41e846dc5413ce
@Override @Override
public float getBukkitYaw() { public float getBukkitYaw() {
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 deac6d08082b3291e748af6394235b3d18790ff2..d0047fc5156f13c831ab4f23a429d567ed6a39ac 100644 index 0651d4d661aa52171f617f1dd844a89cb2d05e20..f286fcc2958a02c1e480b8fcf5d049bf0de27131 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
@@ -235,6 +235,7 @@ public abstract class Mob extends LivingEntity { @@ -238,6 +238,7 @@ public abstract class Mob extends LivingEntity {
return this.target; return this.target;
} }
+ public org.bukkit.craftbukkit.entity.CraftMob getBukkitMob() { return (org.bukkit.craftbukkit.entity.CraftMob) super.getBukkitEntity(); } // Paper + public org.bukkit.craftbukkit.entity.CraftMob getBukkitMob() { return (org.bukkit.craftbukkit.entity.CraftMob) super.getBukkitEntity(); } // Paper
public void setTarget(@Nullable LivingEntity target) { public void setTarget(@Nullable LivingEntity target) {
// CraftBukkit start - fire event // CraftBukkit start - fire event
this.setGoalTarget(target, EntityTargetEvent.TargetReason.UNKNOWN, true); this.setTarget(target, EntityTargetEvent.TargetReason.UNKNOWN, true);
diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
index d090ffcf08e32a08d4b815b79ed58fc00bc26fd0..920ae9af8985705a0ada7da5b7085a1ed8ca7f27 100644 index 422b4730a99541b1fa64c439ec126c0cef1f3cb1..ff458abb221daaddaa734811eaaa35ea43883343 100644
--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java --- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java
+++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java +++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
@@ -12,6 +12,8 @@ import org.bukkit.event.entity.EntityUnleashEvent; @@ -18,6 +18,8 @@ public abstract class PathfinderMob extends Mob {
super(type, world);
public abstract class PathfinderMob extends Mob { }
+ public org.bukkit.craftbukkit.entity.CraftCreature getBukkitCreature() { return (org.bukkit.craftbukkit.entity.CraftCreature) super.getBukkitEntity(); } // Paper + public org.bukkit.craftbukkit.entity.CraftCreature getBukkitCreature() { return (org.bukkit.craftbukkit.entity.CraftCreature) super.getBukkitEntity(); } // Paper
+ +
protected PathfinderMob(EntityType<? extends PathfinderMob> type, Level world) { public float getWalkTargetValue(BlockPos pos) {
super(type, world); return this.getWalkTargetValue(pos, this.level);
} }
diff --git a/src/main/java/net/minecraft/world/entity/monster/Monster.java b/src/main/java/net/minecraft/world/entity/monster/Monster.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Monster.java b/src/main/java/net/minecraft/world/entity/monster/Monster.java
index 847a11383322ea67bf80dbcabe7272459392f27c..229490d3857ce9f5bba4e6bb4aedcff50b510ed9 100644 index 6c3044b6194dfd3037389d717bbe6783f58b951d..457880c9e894a83d88505cf0b7235df919eea591 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Monster.java --- a/src/main/java/net/minecraft/world/entity/monster/Monster.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Monster.java +++ b/src/main/java/net/minecraft/world/entity/monster/Monster.java
@@ -25,6 +25,7 @@ import net.minecraft.world.level.LightLayer; @@ -26,6 +26,7 @@ import net.minecraft.world.level.LightLayer;
import net.minecraft.world.level.ServerLevelAccessor; import net.minecraft.world.level.ServerLevelAccessor;
public abstract class Monster extends PathfinderMob implements Enemy { public abstract class Monster extends PathfinderMob implements Enemy {
@ -6046,10 +6047,10 @@ index 847a11383322ea67bf80dbcabe7272459392f27c..229490d3857ce9f5bba4e6bb4aedcff5
super(type, world); super(type, world);
this.xpReward = 5; this.xpReward = 5;
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index c65d1c4982c4ea950dd11d2185d7409e52a55ec5..ab9cb0bf0321e4130b5bbf2b24b7655e9327d363 100644 index 208a713ec4b7b592801eb26860b7b81a2b3f7aa2..df787c12053f799b111c539d866ff8c751e21611 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java --- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -727,6 +727,24 @@ public final class ItemStack { @@ -727,6 +727,25 @@ public final class ItemStack {
return this.tag != null ? this.tag.getList("Enchantments", 10) : new ListTag(); return this.tag != null ? this.tag.getList("Enchantments", 10) : new ListTag();
} }
@ -6071,10 +6072,11 @@ index c65d1c4982c4ea950dd11d2185d7409e52a55ec5..ab9cb0bf0321e4130b5bbf2b24b7655e
+ return bukkitStack; + return bukkitStack;
+ } + }
+ // Paper end + // Paper end
public void setTag(@Nullable CompoundTag tag) { +
this.tag = tag; public void setTag(@Nullable CompoundTag nbt) {
this.tag = nbt;
if (this.getItem().canBeDepleted()) { if (this.getItem().canBeDepleted()) {
@@ -1127,6 +1145,7 @@ public final class ItemStack { @@ -1127,6 +1146,7 @@ public final class ItemStack {
// CraftBukkit start // CraftBukkit start
@Deprecated @Deprecated
public void setItem(Item item) { public void setItem(Item item) {
@ -6083,7 +6085,7 @@ index c65d1c4982c4ea950dd11d2185d7409e52a55ec5..ab9cb0bf0321e4130b5bbf2b24b7655e
} }
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java
index 083122a2e051b23b2cb9bdb8eb70af01af9df400..e85e4a2dfceb0aa40e73b43a5e122a5906cac585 100644 index 76251b5adf41f8e5bf2c07145abe3108fcde8669..03e0254813b977d0342171a37762fec9629afbad 100644
--- a/src/main/java/net/minecraft/world/level/BlockGetter.java --- a/src/main/java/net/minecraft/world/level/BlockGetter.java
+++ b/src/main/java/net/minecraft/world/level/BlockGetter.java +++ b/src/main/java/net/minecraft/world/level/BlockGetter.java
@@ -9,10 +9,12 @@ import javax.annotation.Nullable; @@ -9,10 +9,12 @@ import javax.annotation.Nullable;
@ -6120,10 +6122,10 @@ index 083122a2e051b23b2cb9bdb8eb70af01af9df400..e85e4a2dfceb0aa40e73b43a5e122a59
FluidState getFluidState(BlockPos pos); FluidState getFluidState(BlockPos pos);
diff --git a/src/main/java/net/minecraft/world/level/ChunkPos.java b/src/main/java/net/minecraft/world/level/ChunkPos.java diff --git a/src/main/java/net/minecraft/world/level/ChunkPos.java b/src/main/java/net/minecraft/world/level/ChunkPos.java
index 3f77959c98ee6f19423105d23f69bc56a82df54b..439f82a48e6f6ce7b4773505ced32324cacb302d 100644 index 134d9a360ce32ee1bbd37a5ad51d4a593b2fc022..18c8988dcb5b475c8738a313f1775b73c9d961f4 100644
--- a/src/main/java/net/minecraft/world/level/ChunkPos.java --- a/src/main/java/net/minecraft/world/level/ChunkPos.java
+++ b/src/main/java/net/minecraft/world/level/ChunkPos.java +++ b/src/main/java/net/minecraft/world/level/ChunkPos.java
@@ -16,6 +16,7 @@ public class ChunkPos { @@ -17,6 +17,7 @@ public class ChunkPos {
private static final int REGION_MASK = 31; private static final int REGION_MASK = 31;
public final int x; public final int x;
public final int z; public final int z;
@ -6131,7 +6133,7 @@ index 3f77959c98ee6f19423105d23f69bc56a82df54b..439f82a48e6f6ce7b4773505ced32324
private static final int HASH_A = 1664525; private static final int HASH_A = 1664525;
private static final int HASH_C = 1013904223; private static final int HASH_C = 1013904223;
private static final int HASH_Z_XOR = -559038737; private static final int HASH_Z_XOR = -559038737;
@@ -23,23 +24,26 @@ public class ChunkPos { @@ -24,23 +25,26 @@ public class ChunkPos {
public ChunkPos(int x, int z) { public ChunkPos(int x, int z) {
this.x = x; this.x = x;
this.z = z; this.z = z;
@ -6184,10 +6186,10 @@ index 3c707d6674b2594b09503b959a31c1f4ad3981e6..c7d499bfc22152e0a49f50a2a8133f31
public BlockState getBlockState(BlockPos pos) { public BlockState getBlockState(BlockPos pos) {
return Blocks.AIR.defaultBlockState(); return Blocks.AIR.defaultBlockState();
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 8516eef6ba56bd81710a8ad706f0fac8e49d7a3d..8ff3b141b816599759570ae0c7bee35cca7bef11 100644 index e2b9c20a82630f1991228c6194acef5ef6a7b8b0..d449516a2aafebe3cda9810b7d1ee97e61e8f399 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
@@ -84,6 +84,7 @@ import org.bukkit.craftbukkit.CraftServer; @@ -85,6 +85,7 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.SpigotTimings; // Spigot import org.bukkit.craftbukkit.SpigotTimings; // Spigot
import org.bukkit.craftbukkit.block.CapturedBlockState; import org.bukkit.craftbukkit.block.CapturedBlockState;
@ -6195,21 +6197,7 @@ index 8516eef6ba56bd81710a8ad706f0fac8e49d7a3d..8ff3b141b816599759570ae0c7bee35c
import org.bukkit.craftbukkit.block.data.CraftBlockData; import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.util.CraftNamespacedKey; import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.block.BlockPhysicsEvent;
@@ -231,9 +232,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -271,18 +272,50 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
Level.this.getCraftServer().getHandle().sendAll(new ClientboundSetBorderWarningDistancePacket(border), border.world);
}
- public void onBorderSetDamagePerBlock(WorldBorder border, double damagePerBlock) {}
+ public void onBorderSetDamagePerBlock(WorldBorder border, double damagePerBlock) {
+ }
- public void onBorderSetDamageSafeZOne(WorldBorder border, double safeZoneRadius) {}
+ public void onBorderSetDamageSafeZOne(WorldBorder border, double safeZoneRadius) {
+ }
});
// CraftBukkit end
this.timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings
@@ -268,18 +271,50 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return y < -20000000 || y >= 20000000; return y < -20000000 || y >= 20000000;
} }
@ -6264,7 +6252,7 @@ index 8516eef6ba56bd81710a8ad706f0fac8e49d7a3d..8ff3b141b816599759570ae0c7bee35c
ChunkAccess ichunkaccess = this.getChunkSource().getChunk(chunkX, chunkZ, leastStatus, create); ChunkAccess ichunkaccess = this.getChunkSource().getChunk(chunkX, chunkZ, leastStatus, create);
if (ichunkaccess == null && create) { if (ichunkaccess == null && create) {
@@ -290,7 +325,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -293,7 +326,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
} }
@Override @Override
@ -6273,7 +6261,7 @@ index 8516eef6ba56bd81710a8ad706f0fac8e49d7a3d..8ff3b141b816599759570ae0c7bee35c
return this.setBlock(pos, state, flags, 512); return this.setBlock(pos, state, flags, 512);
} }
@@ -595,7 +630,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -598,7 +631,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
if (this.isOutsideBuildHeight(pos)) { if (this.isOutsideBuildHeight(pos)) {
return Blocks.VOID_AIR.defaultBlockState(); return Blocks.VOID_AIR.defaultBlockState();
} else { } else {
@ -6283,7 +6271,7 @@ index 8516eef6ba56bd81710a8ad706f0fac8e49d7a3d..8ff3b141b816599759570ae0c7bee35c
return chunk.getBlockState(pos); return chunk.getBlockState(pos);
} }
diff --git a/src/main/java/net/minecraft/world/level/LevelReader.java b/src/main/java/net/minecraft/world/level/LevelReader.java diff --git a/src/main/java/net/minecraft/world/level/LevelReader.java b/src/main/java/net/minecraft/world/level/LevelReader.java
index 6cf167bc60a7150a0b84188b39f5b54f741ee7ed..660c7c40e8239063cc0b775628f941af99a76073 100644 index 945fe8969eb61d13207d60e9c2a906aa9b5b6650..4fede11c074894686a9bdc18b031243af72292ad 100644
--- a/src/main/java/net/minecraft/world/level/LevelReader.java --- a/src/main/java/net/minecraft/world/level/LevelReader.java
+++ b/src/main/java/net/minecraft/world/level/LevelReader.java +++ b/src/main/java/net/minecraft/world/level/LevelReader.java
@@ -18,6 +18,7 @@ import net.minecraft.world.level.levelgen.Heightmap; @@ -18,6 +18,7 @@ import net.minecraft.world.level.levelgen.Heightmap;
@ -6295,10 +6283,10 @@ index 6cf167bc60a7150a0b84188b39f5b54f741ee7ed..660c7c40e8239063cc0b775628f941af
ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create); ChunkAccess getChunk(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create);
diff --git a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java diff --git a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java
index 00118cc80ebc31e5fac95c31c07634f0e2904263..138b6792bc6ee26e0b9aaaef7bf58fb231eae9d6 100644 index 47bd74f75f4c49a34a485d1963325a2152756c29..7c921d024205b683c3881c4db9314155359bd9c7 100644
--- a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java --- a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java
+++ b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java +++ b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java
@@ -6,6 +6,7 @@ import javax.annotation.Nullable; @@ -5,6 +5,7 @@ import javax.annotation.Nullable;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.SectionPos; import net.minecraft.core.SectionPos;
import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.util.profiling.ProfilerFiller;
@ -6306,8 +6294,8 @@ index 00118cc80ebc31e5fac95c31c07634f0e2904263..138b6792bc6ee26e0b9aaaef7bf58fb2
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
@@ -79,6 +80,29 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter { @@ -83,6 +84,29 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter {
return this.getChunk(chunkX, chunkZ); return List.of();
} }
+ // Paper start - if loaded util + // Paper start - if loaded util
@ -6337,10 +6325,10 @@ index 00118cc80ebc31e5fac95c31c07634f0e2904263..138b6792bc6ee26e0b9aaaef7bf58fb2
@Override @Override
public BlockEntity getBlockEntity(BlockPos pos) { public BlockEntity getBlockEntity(BlockPos pos) {
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 505731735126e81a4cc768311dce337385e5503f..adf1c04d34383d088a3fc8c06cdc8b55552c354f 100644 index c8d857e354b567be7bd885b3b6b4015390519af1..7d06d476d8e12bdb395488e85e34231daccbd853 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
@@ -603,14 +603,14 @@ public abstract class BlockBehaviour { @@ -602,14 +602,14 @@ public abstract class BlockBehaviour {
public abstract static class BlockStateBase extends StateHolder<Block, BlockState> { public abstract static class BlockStateBase extends StateHolder<Block, BlockState> {
@ -6358,7 +6346,7 @@ index 505731735126e81a4cc768311dce337385e5503f..adf1c04d34383d088a3fc8c06cdc8b55
private final BlockBehaviour.StatePredicate isRedstoneConductor; private final BlockBehaviour.StatePredicate isRedstoneConductor;
private final BlockBehaviour.StatePredicate isSuffocating; private final BlockBehaviour.StatePredicate isSuffocating;
private final BlockBehaviour.StatePredicate isViewBlocking; private final BlockBehaviour.StatePredicate isViewBlocking;
@@ -638,10 +638,18 @@ public abstract class BlockBehaviour { @@ -637,10 +637,18 @@ public abstract class BlockBehaviour {
this.emissiveRendering = blockbase_info.emissiveRendering; this.emissiveRendering = blockbase_info.emissiveRendering;
} }
@ -6377,7 +6365,7 @@ index 505731735126e81a4cc768311dce337385e5503f..adf1c04d34383d088a3fc8c06cdc8b55
} }
@@ -673,8 +681,8 @@ public abstract class BlockBehaviour { @@ -672,8 +680,8 @@ public abstract class BlockBehaviour {
return this.getBlock().getOcclusionShape(this.asState(), world, pos); return this.getBlock().getOcclusionShape(this.asState(), world, pos);
} }
@ -6388,38 +6376,42 @@ index 505731735126e81a4cc768311dce337385e5503f..adf1c04d34383d088a3fc8c06cdc8b55
} }
public boolean useShapeForLightOcclusion() { public boolean useShapeForLightOcclusion() {
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
index 0c04dd7f71598aeb673ccdd626d6b7f6040ae9a1..2e5619a581d18008df31f4b2a279e7418264aa4f 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
@@ -58,7 +58,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
protected final ShortList[] postProcessing;
protected volatile boolean unsaved;
private volatile boolean isLightCorrect;
- protected final ChunkPos chunkPos;
+ protected final ChunkPos chunkPos; public final long coordinateKey; public final int locX; public final int locZ; // Paper - cache coordinate key
private long inhabitedTime;
@Nullable
@Deprecated
@@ -77,7 +77,8 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
protected final LevelChunkSection[] sections;
public ChunkAccess(ChunkPos pos, UpgradeData upgradeData, LevelHeightAccessor heightLimitView, Registry<Biome> biome, long inhabitedTime, @Nullable LevelChunkSection[] sectionArrayInitializer, @Nullable BlendingData blendingData) {
- this.chunkPos = pos;
+ this.locX = pos.x; this.locZ = pos.z; // Paper - reduce need for field lookups
+ this.chunkPos = pos; this.coordinateKey = ChunkPos.asLong(locX, locZ); // Paper - cache long key
this.upgradeData = upgradeData;
this.levelHeightAccessor = heightLimitView;
this.sections = new LevelChunkSection[heightLimitView.getSectionsCount()];
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 0d117a6b319340a0f13a516a6c43501f752bc89a..e9a04017df42312e4e0e7e414c9ccc95c71ddae1 100644 index a380521593e3beff1d4ee186086b2af18cb7b4dc..4ed85501fc81de7a2262a8061ba8a38828a86817 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -33,6 +33,7 @@ import net.minecraft.core.SectionPos; @@ -24,6 +24,7 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData;
import net.minecraft.server.level.ChunkHolder; import net.minecraft.server.level.ChunkHolder;
+import net.minecraft.server.level.ServerChunkCache; +import net.minecraft.server.level.ServerChunkCache;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@@ -107,7 +108,7 @@ public class LevelChunk implements ChunkAccess { @@ -126,6 +127,110 @@ public class LevelChunk extends ChunkAccess {
private Supplier<ChunkHolder.FullChunkStatus> fullStatus;
@Nullable
private Consumer<LevelChunk> postLoad;
- private final ChunkPos chunkPos;
+ private final ChunkPos chunkPos; public final long coordinateKey; public final int locX; public final int locZ; // Paper - cache coordinate key
private volatile boolean isLightCorrect;
private final Int2ObjectMap<GameEventDispatcher> gameEventDispatcherSections;
@@ -123,7 +124,8 @@ public class LevelChunk implements ChunkAccess {
this.structureStarts = Maps.newHashMap();
this.structuresRefences = Maps.newHashMap();
this.level = (ServerLevel) world; // CraftBukkit - type
- this.chunkPos = pos;
+ this.locX = pos.x; this.locZ = pos.z; // Paper - reduce need for field look ups
+ this.chunkPos = pos; this.coordinateKey = ChunkPos.asLong(locX, locZ); // Paper - cache long key
this.upgradeData = upgradeData;
this.gameEventDispatcherSections = new Int2ObjectOpenHashMap();
Heightmap.Types[] aheightmap_type = Heightmap.Types.values();
@@ -168,6 +170,110 @@ public class LevelChunk implements ChunkAccess {
public final org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer(LevelChunk.DATA_TYPE_REGISTRY); public final org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer(LevelChunk.DATA_TYPE_REGISTRY);
// CraftBukkit end // CraftBukkit end
@ -6527,10 +6519,10 @@ index 0d117a6b319340a0f13a516a6c43501f752bc89a..e9a04017df42312e4e0e7e414c9ccc95
+ } + }
+ // Paper end + // Paper end
+ +
public LevelChunk(ServerLevel worldserver, ProtoChunk protoChunk, @Nullable Consumer<LevelChunk> consumer) { public LevelChunk(ServerLevel world, ProtoChunk protoChunk, @Nullable LevelChunk.PostLoadProcessor chunk_c) {
this(worldserver, protoChunk.getPos(), protoChunk.getBiomes(), protoChunk.getUpgradeData(), protoChunk.getBlockTicks(), protoChunk.getLiquidTicks(), protoChunk.getInhabitedTime(), protoChunk.getSections(), consumer); this(world, protoChunk.getPos(), protoChunk.getUpgradeData(), protoChunk.unpackBlockTicks(), protoChunk.unpackFluidTicks(), protoChunk.getInhabitedTime(), protoChunk.getSections(), chunk_c, protoChunk.getBlendingData());
Iterator iterator = protoChunk.getBlockEntities().values().iterator(); Iterator iterator = protoChunk.getBlockEntities().values().iterator();
@@ -271,6 +377,18 @@ public class LevelChunk implements ChunkAccess { @@ -224,6 +329,18 @@ public class LevelChunk extends ChunkAccess {
} }
} }
@ -6549,7 +6541,7 @@ index 0d117a6b319340a0f13a516a6c43501f752bc89a..e9a04017df42312e4e0e7e414c9ccc95
@Override @Override
public FluidState getFluidState(BlockPos pos) { public FluidState getFluidState(BlockPos pos) {
return this.getFluidState(pos.getX(), pos.getY(), pos.getZ()); return this.getFluidState(pos.getX(), pos.getY(), pos.getZ());
@@ -422,6 +540,7 @@ public class LevelChunk implements ChunkAccess { @@ -344,6 +461,7 @@ public class LevelChunk extends ChunkAccess {
return this.getBlockEntity(pos, LevelChunk.EntityCreationType.CHECK); return this.getBlockEntity(pos, LevelChunk.EntityCreationType.CHECK);
} }
@ -6557,7 +6549,7 @@ index 0d117a6b319340a0f13a516a6c43501f752bc89a..e9a04017df42312e4e0e7e414c9ccc95
@Nullable @Nullable
public BlockEntity getBlockEntity(BlockPos pos, LevelChunk.EntityCreationType creationType) { public BlockEntity getBlockEntity(BlockPos pos, LevelChunk.EntityCreationType creationType) {
// CraftBukkit start // CraftBukkit start
@@ -584,7 +703,25 @@ public class LevelChunk implements ChunkAccess { @@ -513,7 +631,25 @@ public class LevelChunk extends ChunkAccess {
// CraftBukkit start // CraftBukkit start
public void loadCallback() { public void loadCallback() {
@ -6583,7 +6575,7 @@ index 0d117a6b319340a0f13a516a6c43501f752bc89a..e9a04017df42312e4e0e7e414c9ccc95
if (server != null) { if (server != null) {
/* /*
* If it's a new world, the first few chunks are generated inside * If it's a new world, the first few chunks are generated inside
@@ -623,6 +760,22 @@ public class LevelChunk implements ChunkAccess { @@ -552,6 +688,22 @@ public class LevelChunk extends ChunkAccess {
server.getPluginManager().callEvent(unloadEvent); server.getPluginManager().callEvent(unloadEvent);
// note: saving can be prevented, but not forced if no saving is actually required // note: saving can be prevented, but not forced if no saving is actually required
this.mustNotSave = !unloadEvent.isSaveChunk(); this.mustNotSave = !unloadEvent.isSaveChunk();
@ -6604,36 +6596,14 @@ index 0d117a6b319340a0f13a516a6c43501f752bc89a..e9a04017df42312e4e0e7e414c9ccc95
+ this.resetNeighbours(); + this.resetNeighbours();
+ // Paper end + // Paper end
} }
// CraftBukkit end
@@ -902,19 +1055,13 @@ public class LevelChunk implements ChunkAccess {
}
public void packTicks(ServerLevel world) {
- DefaultedRegistry registryblocks;
-
if (this.blockTicks == EmptyTickList.<Block>empty()) { // CraftBukkit - decompile error
- registryblocks = Registry.BLOCK;
- Objects.requireNonNull(registryblocks);
- this.blockTicks = new ChunkTickList<>(registryblocks::getKey, world.getBlockTicks().fetchTicksInChunk(this.chunkPos, true, false), world.getGameTime());
+ this.blockTicks = new ChunkTickList<>(Registry.BLOCK::getKey, world.getBlockTicks().fetchTicksInChunk(this.chunkPos, true, false), world.getGameTime()); // Paper - decompile fix: inline Registry.BLOCK
this.setUnsaved(true);
}
if (this.liquidTicks == EmptyTickList.<Fluid>empty()) { // CraftBukkit - decompile error
- registryblocks = Registry.FLUID;
- Objects.requireNonNull(registryblocks);
- this.liquidTicks = new ChunkTickList<>(registryblocks::getKey, world.getLiquidTicks().fetchTicksInChunk(this.chunkPos, true, false), world.getGameTime());
+ this.liquidTicks = new ChunkTickList<>(Registry.FLUID::getKey, world.getLiquidTicks().fetchTicksInChunk(this.chunkPos, true, false), world.getGameTime()); // Paper - decompile fix: inline Registry.FLUID
this.setUnsaved(true);
}
@Override
diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
index c0b68bd470d245121e14b75e2c97f6616b83c92a..39fe8f64528ad08594aaaa88e5c989c82e4e29d3 100644 index 1ea0048e1ee5321a1fd1584ac5371a371de9d45f..b7dbdcb0ce7948c6f98ec67d0cf2033a8e348085 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
@@ -90,6 +90,18 @@ public class ProtoChunk implements ChunkAccess { @@ -73,6 +73,18 @@ public class ProtoChunk extends ChunkAccess {
this.postProcessing = new ShortList[world.getSectionsCount()]; return new ChunkAccess.TicksToSave(this.blockTicks, this.fluidTicks);
} }
+ // Paper start - If loaded util + // Paper start - If loaded util
@ -6874,10 +6844,10 @@ index 0000000000000000000000000000000000000000..909b2c98e7a9117d2f737245e4661792
+ } + }
+} +}
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 93d356ef2aa4d66126312fa7f2b49cb7d3b0c835..c5d132dcf70a55de041c0187ff8fb889248bdfee 100644 index af8348b7fd9495ca1e6afc6e0dc088adce0e40ef..0c275a66c9c9c8fc104fdb0e6a6ae38a42d6c2dd 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
@@ -198,7 +198,23 @@ public class DummyGeneratorAccess implements WorldGenLevel { @@ -207,7 +207,23 @@ public class DummyGeneratorAccess implements WorldGenLevel {
public FluidState getFluidState(BlockPos pos) { public FluidState getFluidState(BlockPos pos) {
return Fluids.EMPTY.defaultFluidState(); // SPIGOT-6634 return Fluids.EMPTY.defaultFluidState(); // SPIGOT-6634
} }

Datei anzeigen

@ -690,7 +690,7 @@ index 0000000000000000000000000000000000000000..e3b74dbdf8e14219a56fab939f3174e0
+ } + }
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index a632a796a3e5f2b361a521d70581b83a6839fc73..644a26bd5ac49e67a04ced0ac07097e22fe064f5 100644 index e4368db074da7b5e48b47d41875c1e63b9745c2a..ed2627f76af277c9be23da3423542d6af0bff872 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -42,6 +42,7 @@ public class PaperConfig { @@ -42,6 +42,7 @@ public class PaperConfig {

Datei anzeigen

@ -18,17 +18,16 @@ index bee2fa2bfbb61209381f24ed6508d3d1c73a344a..1fa190e098079522e0fe3593fa261c1b
MutablePair<Integer, Map<ChunkPos, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap())); MutablePair<Integer, Map<ChunkPos, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap()));
ChunkPos chunk = e.chunkPosition(); ChunkPos chunk = e.chunkPosition();
diff --git a/src/main/java/net/minecraft/server/KeyedObject.java b/src/main/java/net/minecraft/server/KeyedObject.java diff --git a/src/main/java/io/papermc/paper/util/KeyedObject.java b/src/main/java/io/papermc/paper/util/KeyedObject.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..d02bd109399d6b32cbbb5e6f9ec7e650e8299a26 index 0000000000000000000000000000000000000000..9f0c7fd903f085e70db1785fb8bcdb5456e6ca51
--- /dev/null --- /dev/null
+++ b/src/main/java/net/minecraft/server/KeyedObject.java +++ b/src/main/java/io/papermc/paper/util/KeyedObject.java
@@ -0,0 +1,12 @@ @@ -0,0 +1,11 @@
+package net.minecraft.server; +package io.papermc.paper.util;
+ +
+import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.ResourceLocation;
+ +
+// TODO(Mariell Hoversholm): Move stupid ass class
+public interface KeyedObject { +public interface KeyedObject {
+ ResourceLocation getMinecraftKey(); + ResourceLocation getMinecraftKey();
+ default String getMinecraftKeyString() { + default String getMinecraftKeyString() {
@ -37,7 +36,7 @@ index 0000000000000000000000000000000000000000..d02bd109399d6b32cbbb5e6f9ec7e650
+ } + }
+} +}
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 a5f704edf4d8afdb088f3a4ac8e3957f8851842d..264d216429c164798d5e645c044b95892b3b615e 100644 index 371ecc33fec6b8c1a2c022196e90e6169ca1eb3b..05de8dd72834c689af47628155af2f9b0084273f 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
@@ -146,7 +146,7 @@ import org.bukkit.event.player.PlayerTeleportEvent; @@ -146,7 +146,7 @@ import org.bukkit.event.player.PlayerTeleportEvent;
@ -45,11 +44,11 @@ index a5f704edf4d8afdb088f3a4ac8e3957f8851842d..264d216429c164798d5e645c044b9589
// CraftBukkit end // CraftBukkit end
-public abstract class Entity implements Nameable, EntityAccess, CommandSource { -public abstract class Entity implements Nameable, EntityAccess, CommandSource {
+public abstract class Entity implements Nameable, EntityAccess, CommandSource, net.minecraft.server.KeyedObject { // Paper +public abstract class Entity implements Nameable, EntityAccess, CommandSource, io.papermc.paper.util.KeyedObject { // Paper
// CraftBukkit start // CraftBukkit start
private static final int CURRENT_LEVEL = 2; private static final int CURRENT_LEVEL = 2;
@@ -1960,12 +1960,31 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -1989,12 +1989,32 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
return true; return true;
} }
@ -71,6 +70,7 @@ index a5f704edf4d8afdb088f3a4ac8e3957f8851842d..264d216429c164798d5e645c044b9589
+ getMinecraftKey(); // Try to load if it doesn't exists. see: https://github.com/PaperMC/Paper/issues/1280 + getMinecraftKey(); // Try to load if it doesn't exists. see: https://github.com/PaperMC/Paper/issues/1280
+ return entityKeyString; + return entityKeyString;
+ } + }
+
@Nullable @Nullable
public final String getEncodeId() { public final String getEncodeId() {
EntityType<?> entitytypes = this.getType(); EntityType<?> entitytypes = this.getType();
@ -83,20 +83,20 @@ index a5f704edf4d8afdb088f3a4ac8e3957f8851842d..264d216429c164798d5e645c044b9589
protected abstract void readAdditionalSaveData(CompoundTag nbt); protected abstract void readAdditionalSaveData(CompoundTag nbt);
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
index 33884161de688c47c90a7b86196234acc80f9434..92b042080f06fb95958ff5e824830a84f2d1f2a6 100644 index 31389ab9ac85ac14487d8715504ded2ee8754ab8..927133867393fc805b44e824f7b78fac372b0b25 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -20,7 +20,7 @@ import org.bukkit.inventory.InventoryHolder; @@ -23,7 +23,7 @@ import org.bukkit.inventory.InventoryHolder;
import org.spigotmc.CustomTimingsHandler; // Spigot import org.spigotmc.CustomTimingsHandler; // Spigot
-public abstract class BlockEntity { -public abstract class BlockEntity {
+public abstract class BlockEntity implements net.minecraft.server.KeyedObject { // Paper +public abstract class BlockEntity implements io.papermc.paper.util.KeyedObject { // Paper
public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot
// CraftBukkit start - data containers // CraftBukkit start - data containers
@@ -41,6 +41,26 @@ public abstract class BlockEntity { @@ -48,6 +48,26 @@ public abstract class BlockEntity {
this.blockState = state; return new BlockPos(nbt.getInt("x"), nbt.getInt("y"), nbt.getInt("z"));
} }
+ // Paper start + // Paper start

Datei anzeigen

@ -669,7 +669,7 @@ index 0000000000000000000000000000000000000000..0fda52841b5e1643efeda92106124998
+ } + }
+} +}
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 97cfdb625401f44e6e0c0582116cb847ac2355bc..c6a38fefbb1c0e0483a1d0468dd4e7c2b3881097 100644 index ed2627f76af277c9be23da3423542d6af0bff872..756a2ab6ad416f55fa3864cff9818473840b04fc 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -14,12 +14,15 @@ import java.util.concurrent.TimeUnit; @@ -14,12 +14,15 @@ import java.util.concurrent.TimeUnit;
@ -772,10 +772,10 @@ index b3a6aeba2363d283f03982cf749f25cfa11a5052..449f1b2f5dca350dc0912e14c8c2bf3e
PacketUtils.LOGGER.debug("Ignoring packet due to disconnection: {}", packet); PacketUtils.LOGGER.debug("Ignoring packet due to disconnection: {}", packet);
} }
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 54cd91eab5c3a6c4919844245e5bbce6b27ce687..7a553e63fb19a08a56c6342f23c515a64893b351 100644 index 6fc450b66d381c6453498fa18d36570ef74b124d..37ace477c170be9453ab65976085837faa312255 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
@@ -182,7 +182,7 @@ import org.bukkit.craftbukkit.generator.CustomWorldChunkManager; @@ -179,7 +179,7 @@ import org.bukkit.craftbukkit.generator.CustomWorldChunkManager;
import org.bukkit.event.server.ServerLoadEvent; import org.bukkit.event.server.ServerLoadEvent;
// CraftBukkit end // CraftBukkit end
@ -783,8 +783,8 @@ index 54cd91eab5c3a6c4919844245e5bbce6b27ce687..7a553e63fb19a08a56c6342f23c515a6
+import co.aikar.timings.MinecraftTimings; // Paper +import co.aikar.timings.MinecraftTimings; // Paper
import org.spigotmc.SlackActivityAccountant; // Spigot import org.spigotmc.SlackActivityAccountant; // Spigot
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements SnooperPopulator, CommandSource, AutoCloseable { public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements CommandSource, AutoCloseable {
@@ -912,6 +912,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -897,6 +897,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
// CraftBukkit end // CraftBukkit end
MinecraftServer.LOGGER.info("Stopping server"); MinecraftServer.LOGGER.info("Stopping server");
@ -792,7 +792,7 @@ index 54cd91eab5c3a6c4919844245e5bbce6b27ce687..7a553e63fb19a08a56c6342f23c515a6
// CraftBukkit start // CraftBukkit start
if (this.server != null) { if (this.server != null) {
this.server.disablePlugins(); this.server.disablePlugins();
@@ -1115,9 +1116,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1103,9 +1104,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private boolean haveTime() { private boolean haveTime() {
// CraftBukkit start // CraftBukkit start
@ -814,7 +814,7 @@ index 54cd91eab5c3a6c4919844245e5bbce6b27ce687..7a553e63fb19a08a56c6342f23c515a6
private void executeModerately() { private void executeModerately() {
this.runAllTasks(); this.runAllTasks();
java.util.concurrent.locks.LockSupport.parkNanos("executing tasks", 1000L); java.util.concurrent.locks.LockSupport.parkNanos("executing tasks", 1000L);
@@ -1125,9 +1138,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1113,9 +1126,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit end // CraftBukkit end
protected void waitUntilNextTick() { protected void waitUntilNextTick() {
@ -826,7 +826,7 @@ index 54cd91eab5c3a6c4919844245e5bbce6b27ce687..7a553e63fb19a08a56c6342f23c515a6
}); });
} }
@@ -1213,10 +1226,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1201,10 +1214,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public void onServerExit() {} public void onServerExit() {}
public void tickServer(BooleanSupplier shouldKeepTicking) { public void tickServer(BooleanSupplier shouldKeepTicking) {
@ -846,36 +846,28 @@ index 54cd91eab5c3a6c4919844245e5bbce6b27ce687..7a553e63fb19a08a56c6342f23c515a6
++this.tickCount; ++this.tickCount;
this.tickChildren(shouldKeepTicking); this.tickChildren(shouldKeepTicking);
if (i - this.lastServerStatus >= 5000000000L) { if (i - this.lastServerStatus >= 5000000000L) {
@@ -1234,14 +1255,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1230,15 +1251,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
if (this.autosavePeriod > 0 && this.tickCount % this.autosavePeriod == 0) { // CraftBukkit if (this.autosavePeriod > 0 && this.tickCount % this.autosavePeriod == 0) { // CraftBukkit
- SpigotTimings.worldSaveTimer.startTiming(); // Spigot - SpigotTimings.worldSaveTimer.startTiming(); // Spigot
MinecraftServer.LOGGER.debug("Autosave started"); MinecraftServer.LOGGER.debug("Autosave started");
this.profiler.push("save"); this.profiler.push("save");
this.playerList.saveAll(); this.saveEverything(true, false, false);
this.saveAllChunks(true, false, false);
this.profiler.pop(); this.profiler.pop();
MinecraftServer.LOGGER.debug("Autosave finished"); MinecraftServer.LOGGER.debug("Autosave finished");
- SpigotTimings.worldSaveTimer.stopTiming(); // Spigot - SpigotTimings.worldSaveTimer.stopTiming(); // Spigot
} }
this.profiler.push("snooper");
@@ -1255,6 +1274,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
io.papermc.paper.util.CachedLists.reset(); // Paper io.papermc.paper.util.CachedLists.reset(); // Paper
this.profiler.pop();
+
+ // Paper start - move executeAll() into full server tick timing + // Paper start - move executeAll() into full server tick timing
+ try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) { + try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) {
+ this.runAllTasks(); + this.runAllTasks();
+ } + }
+ // Paper end + // Paper end
+
this.profiler.push("tallying"); this.profiler.push("tallying");
long l = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i; long l = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i;
@@ -1265,30 +1291,29 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1249,30 +1273,29 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.profiler.pop(); this.profiler.pop();
org.spigotmc.WatchdogThread.tick(); // Spigot org.spigotmc.WatchdogThread.tick(); // Spigot
this.slackActivityAccountant.tickEnded(l); // Spigot this.slackActivityAccountant.tickEnded(l); // Spigot
@ -914,7 +906,7 @@ index 54cd91eab5c3a6c4919844245e5bbce6b27ce687..7a553e63fb19a08a56c6342f23c515a6
// Send time updates to everyone, it will get the right time from the world the player is in. // Send time updates to everyone, it will get the right time from the world the player is in.
if (this.tickCount % 20 == 0) { if (this.tickCount % 20 == 0) {
for (int i = 0; i < this.getPlayerList().players.size(); ++i) { for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
@@ -1296,7 +1321,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1280,7 +1303,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
entityplayer.connection.send(new ClientboundSetTimePacket(entityplayer.level.getGameTime(), entityplayer.getPlayerTime(), entityplayer.level.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); // Add support for per player time entityplayer.connection.send(new ClientboundSetTimePacket(entityplayer.level.getGameTime(), entityplayer.getPlayerTime(), entityplayer.level.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); // Add support for per player time
} }
} }
@ -923,7 +915,7 @@ index 54cd91eab5c3a6c4919844245e5bbce6b27ce687..7a553e63fb19a08a56c6342f23c515a6
while (iterator.hasNext()) { while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next(); ServerLevel worldserver = (ServerLevel) iterator.next();
@@ -1342,24 +1367,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1326,24 +1349,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
this.profiler.popPush("connection"); this.profiler.popPush("connection");
@ -955,7 +947,7 @@ index 54cd91eab5c3a6c4919844245e5bbce6b27ce687..7a553e63fb19a08a56c6342f23c515a6
this.profiler.pop(); this.profiler.pop();
} }
diff --git a/src/main/java/net/minecraft/server/ServerFunctionManager.java b/src/main/java/net/minecraft/server/ServerFunctionManager.java diff --git a/src/main/java/net/minecraft/server/ServerFunctionManager.java b/src/main/java/net/minecraft/server/ServerFunctionManager.java
index b0ff982603e61805e3a0426aa8376330c73d9cf4..cf711f7fecdab70ff2ee48c87a3a1f0845832b74 100644 index 790594a831fad56aaac445702d297da170ea4f0a..4fe2e98804e42cb308bc688486cd808f5be96f62 100644
--- a/src/main/java/net/minecraft/server/ServerFunctionManager.java --- a/src/main/java/net/minecraft/server/ServerFunctionManager.java
+++ b/src/main/java/net/minecraft/server/ServerFunctionManager.java +++ b/src/main/java/net/minecraft/server/ServerFunctionManager.java
@@ -90,7 +90,7 @@ public class ServerFunctionManager { @@ -90,7 +90,7 @@ public class ServerFunctionManager {
@ -968,10 +960,10 @@ index b0ff982603e61805e3a0426aa8376330c73d9cf4..cf711f7fecdab70ff2ee48c87a3a1f08
i = this.context.runTopCommand(function, source); i = this.context.runTopCommand(function, source);
} finally { } finally {
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 fac993d58bd6e3bb19fd69881092a863c8952c65..2b062beaad39f2e86801fdd5b0cc84b253f1348a 100644 index 4dd57007af218ba1c0e666117a49939c5884f2c6..a6cb949b6f048455acc50c897fdd93d38152b53c 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
@@ -67,8 +67,9 @@ import org.apache.logging.log4j.Logger; @@ -63,8 +63,9 @@ import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.io.IoBuilder; import org.apache.logging.log4j.io.IoBuilder;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -982,7 +974,7 @@ index fac993d58bd6e3bb19fd69881092a863c8952c65..2b062beaad39f2e86801fdd5b0cc84b2
import org.bukkit.event.server.RemoteServerCommandEvent; import org.bukkit.event.server.RemoteServerCommandEvent;
// CraftBukkit end // CraftBukkit end
@@ -467,7 +468,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -445,7 +446,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
} }
public void handleConsoleInputs() { public void handleConsoleInputs() {
@ -991,7 +983,7 @@ index fac993d58bd6e3bb19fd69881092a863c8952c65..2b062beaad39f2e86801fdd5b0cc84b2
while (!this.consoleInput.isEmpty()) { while (!this.consoleInput.isEmpty()) {
ConsoleInput servercommand = (ConsoleInput) this.consoleInput.remove(0); ConsoleInput servercommand = (ConsoleInput) this.consoleInput.remove(0);
@@ -482,7 +483,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -460,7 +461,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
// CraftBukkit end // CraftBukkit end
} }
@ -1000,7 +992,7 @@ index fac993d58bd6e3bb19fd69881092a863c8952c65..2b062beaad39f2e86801fdd5b0cc84b2
} }
@Override @Override
@@ -713,6 +714,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -696,6 +697,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@Override @Override
public String runCommand(String command) { public String runCommand(String command) {
@ -1008,7 +1000,7 @@ index fac993d58bd6e3bb19fd69881092a863c8952c65..2b062beaad39f2e86801fdd5b0cc84b2
this.rconConsoleSource.prepareForCommand(); this.rconConsoleSource.prepareForCommand();
this.executeBlocking(() -> { this.executeBlocking(() -> {
// CraftBukkit start - fire RemoteServerCommandEvent // CraftBukkit start - fire RemoteServerCommandEvent
@@ -721,10 +723,39 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -704,10 +706,39 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
if (event.isCancelled()) { if (event.isCancelled()) {
return; return;
} }
@ -1049,20 +1041,21 @@ index fac993d58bd6e3bb19fd69881092a863c8952c65..2b062beaad39f2e86801fdd5b0cc84b2
} }
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index feea5986de6b579b0da81c2c5233adbdb30f08fa..2923c90c52cc507bf312ff8d0837ad510a7b21cf 100644 index 3f938d953daee7a5551a62df25f2e0fb487733ec..cab03a81a97d851db61e517cfe3a43fa8afd32b2 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1,7 +1,9 @@ @@ -1,8 +1,10 @@
package net.minecraft.server.level; package net.minecraft.server.level;
+import co.aikar.timings.Timing; // Paper +import co.aikar.timings.Timing; // Paper
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
+import com.google.common.collect.ComparisonChain; // Paper +import com.google.common.collect.ComparisonChain; // Paper
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Queues; import com.google.common.collect.Queues;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@@ -629,11 +631,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -677,11 +679,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> scheduleChunkLoad(ChunkPos pos) { private CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> scheduleChunkLoad(ChunkPos pos) {
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supplyAsync(() -> {
@ -1077,10 +1070,10 @@ index feea5986de6b579b0da81c2c5233adbdb30f08fa..2923c90c52cc507bf312ff8d0837ad51
- if (nbttagcompound != null) { - if (nbttagcompound != null) {
+ if (nbttagcompound != null) {try (Timing ignored2 = this.level.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings + if (nbttagcompound != null) {try (Timing ignored2 = this.level.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings
boolean flag = nbttagcompound.contains("Level", 10) && nbttagcompound.getCompound("Level").contains("Status", 8); boolean flag = nbttagcompound.contains("Status", 8);
if (flag) { if (flag) {
@@ -644,7 +649,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -692,7 +697,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
ChunkMap.LOGGER.error("Chunk file at {} is missing level data, skipping", pos); ChunkMap.LOGGER.error("Chunk file at {} is missing level data, skipping", pos);
@ -1089,15 +1082,15 @@ index feea5986de6b579b0da81c2c5233adbdb30f08fa..2923c90c52cc507bf312ff8d0837ad51
} catch (ReportedException reportedexception) { } catch (ReportedException reportedexception) {
Throwable throwable = reportedexception.getCause(); Throwable throwable = reportedexception.getCause();
@@ -758,6 +763,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -806,6 +811,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
ChunkStatus chunkstatus = ChunkHolder.getStatus(playerchunk.getTicketLevel()); ChunkStatus chunkstatus = ChunkHolder.getStatus(chunkHolder.getTicketLevel());
return !chunkstatus.isOrAfter(ChunkStatus.FULL) ? ChunkHolder.UNLOADED_CHUNK : either.mapLeft((ichunkaccess) -> { return !chunkstatus.isOrAfter(ChunkStatus.FULL) ? ChunkHolder.UNLOADED_CHUNK : either.mapLeft((ichunkaccess) -> {
+ try (Timing ignored = level.timings.chunkPostLoad.startTimingIfSync()) { // Paper + try (Timing ignored = level.timings.chunkPostLoad.startTimingIfSync()) { // Paper
ChunkPos chunkcoordintpair = playerchunk.getPos(); ChunkPos chunkcoordintpair = chunkHolder.getPos();
ProtoChunk protochunk = (ProtoChunk) ichunkaccess; ProtoChunk protochunk = (ProtoChunk) ichunkaccess;
LevelChunk chunk; LevelChunk chunk;
@@ -781,6 +787,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -830,6 +836,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
return chunk; return chunk;
@ -1105,16 +1098,16 @@ index feea5986de6b579b0da81c2c5233adbdb30f08fa..2923c90c52cc507bf312ff8d0837ad51
}); });
}, (runnable) -> { }, (runnable) -> {
ProcessorHandle mailbox = this.mainThreadMailbox; ProcessorHandle mailbox = this.mainThreadMailbox;
@@ -1238,6 +1245,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1349,6 +1356,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
List<ServerPlayer> list = Lists.newArrayList();
ChunkMap.TrackedEntity playerchunkmap_entitytracker; List<ServerPlayer> list1 = this.level.players();
ObjectIterator objectiterator; ObjectIterator objectiterator = this.entityMap.values().iterator();
+ level.timings.tracker1.startTiming(); // Paper + level.timings.tracker1.startTiming(); // Paper
for (objectiterator = this.entityMap.values().iterator(); objectiterator.hasNext(); playerchunkmap_entitytracker.serverEntity.sendChanges()) { ChunkMap.TrackedEntity playerchunkmap_entitytracker;
playerchunkmap_entitytracker = (ChunkMap.TrackedEntity) objectiterator.next();
@@ -1255,14 +1263,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1373,14 +1381,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
playerchunkmap_entitytracker.lastSectionPos = sectionposition1; playerchunkmap_entitytracker.serverEntity.sendChanges();
} }
} }
+ level.timings.tracker1.stopTiming(); // Paper + level.timings.tracker1.stopTiming(); // Paper
@ -1132,7 +1125,7 @@ index feea5986de6b579b0da81c2c5233adbdb30f08fa..2923c90c52cc507bf312ff8d0837ad51
} }
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 77d98bfa0ad9fc92a8e794b5a4e00c3e471c123a..3e2a5f83afcc3b9c9fe62748895d489135af03bf 100644 index a832e6af0ce937d6e48021e3b2190ebe22bc3be5..014152d5f435b34799ca5b57f6143c3e36d4b2e0 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
@@ -507,13 +507,15 @@ public class ServerChunkCache extends ChunkSource { @@ -507,13 +507,15 @@ public class ServerChunkCache extends ChunkSource {
@ -1141,19 +1134,19 @@ index 77d98bfa0ad9fc92a8e794b5a4e00c3e471c123a..3e2a5f83afcc3b9c9fe62748895d4891
gameprofilerfiller.incrementCounter("getChunkCacheMiss"); gameprofilerfiller.incrementCounter("getChunkCacheMiss");
- level.timings.syncChunkLoadTimer.startTiming(); // Spigot - level.timings.syncChunkLoadTimer.startTiming(); // Spigot
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = this.getChunkFutureMainThread(x, z, leastStatus, create); CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> completablefuture = this.getChunkFutureMainThread(x, z, leastStatus, create);
ServerChunkCache.MainThreadExecutor chunkproviderserver_a = this.mainThreadProcessor; ServerChunkCache.MainThreadExecutor chunkproviderserver_b = this.mainThreadProcessor;
Objects.requireNonNull(completablefuture); Objects.requireNonNull(completablefuture);
+ if (!completablefuture.isDone()) { // Paper + if (!completablefuture.isDone()) { // Paper
+ this.level.timings.syncChunkLoad.startTiming(); // Paper + this.level.timings.syncChunkLoad.startTiming(); // Paper
chunkproviderserver_a.managedBlock(completablefuture::isDone); chunkproviderserver_b.managedBlock(completablefuture::isDone);
- level.timings.syncChunkLoadTimer.stopTiming(); // Spigot - level.timings.syncChunkLoadTimer.stopTiming(); // Spigot
+ 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) -> {
return ichunkaccess1; return ichunkaccess1;
}, (playerchunk_failure) -> { }, (playerchunk_failure) -> {
@@ -713,7 +715,9 @@ public class ServerChunkCache extends ChunkSource { @@ -711,7 +713,9 @@ public class ServerChunkCache extends ChunkSource {
public void save(boolean flush) { public void save(boolean flush) {
this.runDistanceManagerUpdates(); this.runDistanceManagerUpdates();
@ -1163,7 +1156,7 @@ index 77d98bfa0ad9fc92a8e794b5a4e00c3e471c123a..3e2a5f83afcc3b9c9fe62748895d4891
} }
@Override @Override
@@ -751,7 +755,9 @@ public class ServerChunkCache extends ChunkSource { @@ -749,7 +753,9 @@ public class ServerChunkCache extends ChunkSource {
this.runDistanceManagerUpdates(); this.runDistanceManagerUpdates();
this.level.timings.doChunkMap.stopTiming(); // Spigot this.level.timings.doChunkMap.stopTiming(); // Spigot
this.level.getProfiler().popPush("chunks"); this.level.getProfiler().popPush("chunks");
@ -1173,71 +1166,58 @@ index 77d98bfa0ad9fc92a8e794b5a4e00c3e471c123a..3e2a5f83afcc3b9c9fe62748895d4891
this.level.timings.doChunkUnload.startTiming(); // Spigot this.level.timings.doChunkUnload.startTiming(); // Spigot
this.level.getProfiler().popPush("unload"); this.level.getProfiler().popPush("unload");
this.chunkMap.tick(booleansupplier); this.chunkMap.tick(booleansupplier);
@@ -775,14 +781,17 @@ public class ServerChunkCache extends ChunkSource { @@ -776,13 +782,16 @@ public class ServerChunkCache extends ChunkSource {
boolean flag2 = level.ticksPerAnimalSpawns != 0L && worlddata.getGameTime() % level.ticksPerAnimalSpawns == 0L; // CraftBukkit boolean flag1 = level.ticksPerAnimalSpawns != 0L && worlddata.getGameTime() % level.ticksPerAnimalSpawns == 0L; // CraftBukkit
this.level.getProfiler().push("naturalSpawnCount"); gameprofilerfiller.push("naturalSpawnCount");
+ this.level.timings.countNaturalMobs.startTiming(); // Paper - timings + this.level.timings.countNaturalMobs.startTiming(); // Paper - timings
int l = this.distanceManager.getNaturalSpawnChunkCount(); int l = this.distanceManager.getNaturalSpawnChunkCount();
NaturalSpawner.SpawnState spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk); NaturalSpawner.SpawnState spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, new LocalMobCapCalculator(this.chunkMap));
+ this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings + this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
this.lastSpawnState = spawnercreature_d; this.lastSpawnState = spawnercreature_d;
this.level.getProfiler().pop(); gameprofilerfiller.popPush("filteringLoadedChunks");
List<ChunkHolder> list = Lists.newArrayList(this.chunkMap.getChunks()); List<ServerChunkCache.ChunkAndHolder> list = Lists.newArrayListWithCapacity(l);
Iterator iterator = this.chunkMap.getChunks().iterator();
Collections.shuffle(list);
+ this.level.timings.chunkTicks.startTiming(); // Paper + this.level.timings.chunkTicks.startTiming(); // Paper
list.forEach((playerchunk) -> {
Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left();
@@ -796,15 +805,18 @@ public class ServerChunkCache extends ChunkSource { while (iterator.hasNext()) {
NaturalSpawner.spawnForChunk(this.level, chunk, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag2); ChunkHolder playerchunk = (ChunkHolder) iterator.next();
@@ -811,27 +820,27 @@ public class ServerChunkCache extends ChunkSource {
} }
if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) {
- this.level.timings.doTickTiles.startTiming(); // Spigot - this.level.timings.doTickTiles.startTiming(); // Spigot
+ // this.level.timings.doTickTiles.startTiming(); // Spigot // Paper this.level.tickChunk(chunk1, k);
this.level.tickChunk(chunk, k);
- this.level.timings.doTickTiles.stopTiming(); // Spigot - this.level.timings.doTickTiles.stopTiming(); // Spigot
+ // this.level.timings.doTickTiles.stopTiming(); // Spigot // Paper
} }
} }
}); }
-
+ this.level.timings.chunkTicks.stopTiming(); // Paper + this.level.timings.chunkTicks.stopTiming(); // Paper
this.level.getProfiler().push("customSpawners"); gameprofilerfiller.popPush("customSpawners");
if (flag1) { if (flag2) {
+ try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings + try (co.aikar.timings.Timing ignored = this.level.timings.miscMobSpawning.startTiming()) { // Paper - timings
this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies); this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies);
+ } // Paper - timings + } // Paper - timings
} }
this.level.getProfiler().popPush("broadcast"); gameprofilerfiller.popPush("broadcast");
@@ -812,15 +824,20 @@ public class ServerChunkCache extends ChunkSource { list.forEach((chunkproviderserver_a1) -> {
Optional<LevelChunk> optional = ((Either) playerchunk.getTickingChunkFuture().getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left(); // CraftBukkit - decompile error + this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timing
chunkproviderserver_a1.holder.broadcastChanges(chunkproviderserver_a1.chunk);
Objects.requireNonNull(playerchunk); + this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing
- optional.ifPresent(playerchunk::broadcastChanges);
+
+ // Paper start - timings
+ optional.ifPresent(chunk -> {
+ this.level.timings.broadcastChunkUpdates.startTiming(); // Paper - timings
+ playerchunk.broadcastChanges(chunk);
+ this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timings
+ });
+ // Paper end
}); });
this.level.getProfiler().pop(); gameprofilerfiller.pop();
this.level.getProfiler().pop(); gameprofilerfiller.pop();
}
- this.level.timings.tracker.startTiming(); // Spigot - this.level.timings.tracker.startTiming(); // Spigot
this.chunkMap.tick(); this.chunkMap.tick();
- this.level.timings.tracker.stopTiming(); // Spigot - this.level.timings.tracker.stopTiming(); // Spigot
} }
}
private void getFullChunk(long pos, Consumer<LevelChunk> chunkConsumer) {
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 8115e016109f560f2de78c69285342a42ebd119a..53b5da62d7f869183272f3fde4dab61642f5a733 100644 index d94dca6db38207021026953ef4598756a797562c..0486dc411f7cbda85c4e02fc85512a122522e035 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
@@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@
@ -1249,7 +1229,7 @@ index 8115e016109f560f2de78c69285342a42ebd119a..53b5da62d7f869183272f3fde4dab616
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.mojang.datafixers.DataFixer; import com.mojang.datafixers.DataFixer;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
@@ -154,7 +156,6 @@ import org.apache.logging.log4j.LogManager; @@ -150,7 +152,6 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.WeatherType; import org.bukkit.WeatherType;
@ -1257,31 +1237,18 @@ index 8115e016109f560f2de78c69285342a42ebd119a..53b5da62d7f869183272f3fde4dab616
import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.util.WorldUUID; import org.bukkit.craftbukkit.util.WorldUUID;
import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent;
@@ -308,13 +309,13 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -422,7 +423,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
DefaultedRegistry registryblocks = Registry.BLOCK;
Objects.requireNonNull(registryblocks);
- this.blockTicks = new ServerTickList<>(this, predicate, Registry.BLOCK::getKey, this::tickBlock); // CraftBukkit - decompile error
+ this.blockTicks = new ServerTickList<>(this, predicate, Registry.BLOCK::getKey, this::tickBlock, "Blocks"); // CraftBukkit - decompile error // Paper - Timings
Predicate<Fluid> predicate2 = (fluidtype) -> { // CraftBukkit - decompile error
return fluidtype == null || fluidtype == Fluids.EMPTY;
};
registryblocks = Registry.FLUID;
Objects.requireNonNull(registryblocks);
- this.liquidTicks = new ServerTickList<>(this, predicate2, Registry.FLUID::getKey, this::tickLiquid); // CraftBukkit - decompile error
+ this.liquidTicks = new ServerTickList<>(this, predicate2, Registry.FLUID::getKey, this::tickLiquid, "Fluids"); // CraftBukkit - decompile error // Paper - Timings
this.navigatingMobs = new ObjectOpenHashSet();
this.blockEvents = new ObjectLinkedOpenHashSet();
this.dragonParts = new Int2ObjectOpenHashMap();
@@ -521,17 +522,21 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.updateSkyBrightness(); this.updateSkyBrightness();
this.tickTime(); this.tickTime();
gameprofilerfiller.popPush("tickPending"); gameprofilerfiller.popPush("tickPending");
- timings.doTickPending.startTiming(); // Spigot - timings.doTickPending.startTiming(); // Spigot
+ timings.scheduledBlocks.startTiming(); // Paper + timings.scheduledBlocks.startTiming(); // Paper
if (!this.isDebug()) { if (!this.isDebug()) {
this.blockTicks.tick(); j = this.getGameTime();
this.liquidTicks.tick(); gameprofilerfiller.push("blockTicks");
@@ -431,12 +432,16 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.fluidTicks.tick(j, 65536, this::tickFluid);
gameprofilerfiller.pop();
} }
- timings.doTickPending.stopTiming(); // Spigot - timings.doTickPending.stopTiming(); // Spigot
+ timings.scheduledBlocks.stopTiming(); // Paper + timings.scheduledBlocks.stopTiming(); // Paper
@ -1297,7 +1264,7 @@ index 8115e016109f560f2de78c69285342a42ebd119a..53b5da62d7f869183272f3fde4dab616
gameprofilerfiller.popPush("blockEvents"); gameprofilerfiller.popPush("blockEvents");
timings.doSounds.startTiming(); // Spigot timings.doSounds.startTiming(); // Spigot
this.runBlockEvents(); this.runBlockEvents();
@@ -689,6 +694,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -601,6 +606,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
gameprofilerfiller.popPush("tickBlocks"); gameprofilerfiller.popPush("tickBlocks");
@ -1305,7 +1272,7 @@ index 8115e016109f560f2de78c69285342a42ebd119a..53b5da62d7f869183272f3fde4dab616
if (randomTickSpeed > 0) { if (randomTickSpeed > 0) {
LevelChunkSection[] achunksection = chunk.getSections(); LevelChunkSection[] achunksection = chunk.getSections();
int l = achunksection.length; int l = achunksection.length;
@@ -721,6 +727,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -633,6 +639,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
} }
@ -1313,7 +1280,7 @@ index 8115e016109f560f2de78c69285342a42ebd119a..53b5da62d7f869183272f3fde4dab616
gameprofilerfiller.pop(); gameprofilerfiller.pop();
} }
@@ -846,14 +853,22 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -867,14 +874,22 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
public void tickNonPassenger(Entity entity) { public void tickNonPassenger(Entity entity) {
@ -1337,7 +1304,7 @@ index 8115e016109f560f2de78c69285342a42ebd119a..53b5da62d7f869183272f3fde4dab616
entity.setOldPosAndRot(); entity.setOldPosAndRot();
ProfilerFiller gameprofilerfiller = this.getProfiler(); ProfilerFiller gameprofilerfiller = this.getProfiler();
@@ -872,7 +887,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -893,7 +908,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.tickPassenger(entity, entity1); this.tickPassenger(entity, entity1);
} }
@ -1346,7 +1313,7 @@ index 8115e016109f560f2de78c69285342a42ebd119a..53b5da62d7f869183272f3fde4dab616
} }
@@ -914,6 +929,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -935,6 +950,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (!flag1) { if (!flag1) {
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit
@ -1354,7 +1321,7 @@ index 8115e016109f560f2de78c69285342a42ebd119a..53b5da62d7f869183272f3fde4dab616
if (progressListener != null) { if (progressListener != null) {
progressListener.progressStartNoAbort(new TranslatableComponent("menu.savingLevel")); progressListener.progressStartNoAbort(new TranslatableComponent("menu.savingLevel"));
} }
@@ -923,7 +939,10 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -944,7 +960,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
progressListener.progressStage(new TranslatableComponent("menu.savingChunks")); progressListener.progressStage(new TranslatableComponent("menu.savingChunks"));
} }
@ -1366,10 +1333,10 @@ index 8115e016109f560f2de78c69285342a42ebd119a..53b5da62d7f869183272f3fde4dab616
this.entityManager.saveAll(); this.entityManager.saveAll();
} else { } else {
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 eecbfe8d1dc4cdc7fc2867208f8f2de7606f390b..0ed1d4b09b4d540a0bf420d8f63eb31fcfc7b8c2 100644 index 0251908052d6221dc9fdab38ff8cfb3b7be8d28b..7f9b560a415eec4008d0fdcfa427c3df8f974e43 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
@@ -208,6 +208,7 @@ import org.bukkit.inventory.EquipmentSlot; @@ -207,6 +207,7 @@ import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.InventoryView; import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.SmithingInventory; import org.bukkit.inventory.SmithingInventory;
import org.bukkit.util.NumberConversions; import org.bukkit.util.NumberConversions;
@ -1377,7 +1344,7 @@ index eecbfe8d1dc4cdc7fc2867208f8f2de7606f390b..0ed1d4b09b4d540a0bf420d8f63eb31f
// CraftBukkit end // CraftBukkit end
public class ServerGamePacketListenerImpl implements ServerPlayerConnection, ServerGamePacketListener { public class ServerGamePacketListenerImpl implements ServerPlayerConnection, ServerGamePacketListener {
@@ -287,7 +288,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -286,7 +287,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// CraftBukkit end // CraftBukkit end
public void tick() { public void tick() {
@ -1385,7 +1352,7 @@ index eecbfe8d1dc4cdc7fc2867208f8f2de7606f390b..0ed1d4b09b4d540a0bf420d8f63eb31f
this.resetPosition(); this.resetPosition();
this.player.xo = this.player.getX(); this.player.xo = this.player.getX();
this.player.yo = this.player.getY(); this.player.yo = this.player.getY();
@@ -363,7 +363,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -362,7 +362,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854 this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
this.disconnect(new TranslatableComponent("multiplayer.disconnect.idling")); this.disconnect(new TranslatableComponent("multiplayer.disconnect.idling"));
} }
@ -1393,7 +1360,7 @@ index eecbfe8d1dc4cdc7fc2867208f8f2de7606f390b..0ed1d4b09b4d540a0bf420d8f63eb31f
} }
@@ -1909,7 +1908,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1915,7 +1914,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// CraftBukkit end // CraftBukkit end
private void handleCommand(String input) { private void handleCommand(String input) {
@ -1402,7 +1369,7 @@ index eecbfe8d1dc4cdc7fc2867208f8f2de7606f390b..0ed1d4b09b4d540a0bf420d8f63eb31f
// CraftBukkit start - whole method // CraftBukkit start - whole method
if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + input); this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + input);
@@ -1920,7 +1919,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1926,7 +1925,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.cserver.getPluginManager().callEvent(event); this.cserver.getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
@ -1411,17 +1378,17 @@ index eecbfe8d1dc4cdc7fc2867208f8f2de7606f390b..0ed1d4b09b4d540a0bf420d8f63eb31f
return; return;
} }
@@ -1933,7 +1932,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1939,7 +1938,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
return; return;
} finally { } finally {
- org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot - org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot
+ MinecraftTimings.playerCommandTimer.stopTiming(); // Paper + MinecraftTimings.playerCommandTimer.stopTiming(); // Paper
} }
// this.minecraftServer.getCommandDispatcher().a(this.player.getCommandListener(), s); // this.server.getCommands().performCommand(this.player.createCommandSourceStack(), s);
// CraftBukkit end // CraftBukkit end
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 a1aa84d408e805fe9b28f8241f23edec49adddee..956fed13f641d87a8d117ba30e84a4138c9d1a30 100644 index 966291f62b8a57be28f47d6e5643bbcda57827c6..6ea948d9a7e20a389f445836f8ab40986f05fcd2 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
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@ -1431,7 +1398,7 @@ index a1aa84d408e805fe9b28f8241f23edec49adddee..956fed13f641d87a8d117ba30e84a413
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@@ -1011,10 +1012,11 @@ public abstract class PlayerList { @@ -1012,10 +1013,11 @@ public abstract class PlayerList {
} }
public void saveAll() { public void saveAll() {
@ -1445,7 +1412,7 @@ index a1aa84d408e805fe9b28f8241f23edec49adddee..956fed13f641d87a8d117ba30e84a413
public UserWhiteList getWhiteList() { public UserWhiteList getWhiteList() {
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 110479daccf4bb64d290f1057f4caad16025060c..70154157221dcdd0d228a934aee2213d4ea2545a 100644 index 05de8dd72834c689af47628155af2f9b0084273f..bab72d3d0395fc6a137975982799341626626bc0 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
@@ -126,7 +126,6 @@ import org.bukkit.craftbukkit.event.CraftPortalEvent; @@ -126,7 +126,6 @@ import org.bukkit.craftbukkit.event.CraftPortalEvent;
@ -1456,7 +1423,7 @@ index 110479daccf4bb64d290f1057f4caad16025060c..70154157221dcdd0d228a934aee2213d
import org.bukkit.event.entity.EntityCombustByEntityEvent; import org.bukkit.event.entity.EntityCombustByEntityEvent;
import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
@@ -282,7 +281,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @@ -286,7 +285,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only
public boolean forceExplosionKnockback; // SPIGOT-949 public boolean forceExplosionKnockback; // SPIGOT-949
public boolean persistentInvisibility = false; public boolean persistentInvisibility = false;
@ -1464,7 +1431,7 @@ index 110479daccf4bb64d290f1057f4caad16025060c..70154157221dcdd0d228a934aee2213d
// Spigot start // Spigot start
public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
public final boolean defaultActivationState; public final boolean defaultActivationState;
@@ -722,7 +720,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @@ -728,7 +726,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
} }
public void move(MoverType movementType, Vec3 movement) { public void move(MoverType movementType, Vec3 movement) {
@ -1472,19 +1439,19 @@ index 110479daccf4bb64d290f1057f4caad16025060c..70154157221dcdd0d228a934aee2213d
if (this.noPhysics) { if (this.noPhysics) {
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z); this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
} else { } else {
@@ -869,7 +866,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @@ -881,7 +878,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
this.level.getProfiler().pop(); this.level.getProfiler().pop();
} }
} }
- org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot - org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot
} }
protected void tryCheckInsideBlocks() { protected boolean isHorizontalCollisionMinor(Vec3 adjustedMovement) {
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 7f3d83d3d071f6b441ad119b1c93be035e911e70..28f1a53a2b9ebe9948509dabbf1a4ae84d8e147c 100644 index e688949fc2f3031dc9c9817bc59554e9f5a436af..20cfdba68c200e87d00995a6a4e25a5fa8171f6c 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java --- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -294,7 +294,14 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> { @@ -293,7 +293,14 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
return Registry.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(id)); return Registry.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(id));
} }
@ -1499,7 +1466,7 @@ index 7f3d83d3d071f6b441ad119b1c93be035e911e70..28f1a53a2b9ebe9948509dabbf1a4ae8
this.factory = factory; this.factory = factory;
this.category = spawnGroup; this.category = spawnGroup;
this.canSpawnFarFromPlayer = spawnableFarFromPlayer; this.canSpawnFarFromPlayer = spawnableFarFromPlayer;
@@ -305,6 +312,14 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> { @@ -304,6 +311,14 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
this.dimensions = dimensions; this.dimensions = dimensions;
this.clientTrackingRange = maxTrackDistance; this.clientTrackingRange = maxTrackDistance;
this.updateInterval = trackTickInterval; this.updateInterval = trackTickInterval;
@ -1514,7 +1481,7 @@ index 7f3d83d3d071f6b441ad119b1c93be035e911e70..28f1a53a2b9ebe9948509dabbf1a4ae8
} }
@Nullable @Nullable
@@ -567,6 +582,12 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> { @@ -564,6 +579,12 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
return this.updateInterval; return this.updateInterval;
} }
@ -1527,7 +1494,7 @@ index 7f3d83d3d071f6b441ad119b1c93be035e911e70..28f1a53a2b9ebe9948509dabbf1a4ae8
public boolean trackDeltas() { public boolean trackDeltas() {
return this != EntityType.PLAYER && this != EntityType.LLAMA_SPIT && this != EntityType.WITHER && this != EntityType.BAT && this != EntityType.ITEM_FRAME && this != EntityType.GLOW_ITEM_FRAME && this != EntityType.LEASH_KNOT && this != EntityType.PAINTING && this != EntityType.END_CRYSTAL && this != EntityType.EVOKER_FANGS; return this != EntityType.PLAYER && this != EntityType.LLAMA_SPIT && this != EntityType.WITHER && this != EntityType.BAT && this != EntityType.ITEM_FRAME && this != EntityType.GLOW_ITEM_FRAME && this != EntityType.LEASH_KNOT && this != EntityType.PAINTING && this != EntityType.END_CRYSTAL && this != EntityType.EVOKER_FANGS;
} }
@@ -659,7 +680,7 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> { @@ -656,7 +677,7 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
Util.fetchChoiceType(References.ENTITY_TREE, id); Util.fetchChoiceType(References.ENTITY_TREE, id);
} }
@ -1537,10 +1504,10 @@ index 7f3d83d3d071f6b441ad119b1c93be035e911e70..28f1a53a2b9ebe9948509dabbf1a4ae8
} }
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index d6f820f50b84dd4375746d981acfb6887c90c364..2e1857e80797c9012e203f69f44d5a6126d48ea7 100644 index 010d7a0dc97c7bdd3fbafe974aa73f3dba106d4d..906c23068d1f5be76a6985b7255f6f155335b673 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -140,7 +140,7 @@ import org.bukkit.event.entity.EntityTeleportEvent; @@ -137,7 +137,7 @@ import org.bukkit.event.entity.EntityTeleportEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent; import org.bukkit.event.player.PlayerItemConsumeEvent;
// CraftBukkit end // CraftBukkit end
@ -1549,7 +1516,7 @@ index d6f820f50b84dd4375746d981acfb6887c90c364..2e1857e80797c9012e203f69f44d5a61
public abstract class LivingEntity extends Entity { public abstract class LivingEntity extends Entity {
@@ -2762,7 +2762,6 @@ public abstract class LivingEntity extends Entity { @@ -2761,7 +2761,6 @@ public abstract class LivingEntity extends Entity {
@Override @Override
public void tick() { public void tick() {
@ -1557,7 +1524,7 @@ index d6f820f50b84dd4375746d981acfb6887c90c364..2e1857e80797c9012e203f69f44d5a61
super.tick(); super.tick();
this.updatingUsingItem(); this.updatingUsingItem();
this.updateSwimAmount(); this.updateSwimAmount();
@@ -2803,9 +2802,7 @@ public abstract class LivingEntity extends Entity { @@ -2802,9 +2801,7 @@ public abstract class LivingEntity extends Entity {
} }
} }
@ -1567,7 +1534,7 @@ index d6f820f50b84dd4375746d981acfb6887c90c364..2e1857e80797c9012e203f69f44d5a61
double d0 = this.getX() - this.xo; double d0 = this.getX() - this.xo;
double d1 = this.getZ() - this.zo; double d1 = this.getZ() - this.zo;
float f = (float) (d0 * d0 + d1 * d1); float f = (float) (d0 * d0 + d1 * d1);
@@ -2885,8 +2882,6 @@ public abstract class LivingEntity extends Entity { @@ -2884,8 +2881,6 @@ public abstract class LivingEntity extends Entity {
if (this.isSleeping()) { if (this.isSleeping()) {
this.setXRot(0.0F); this.setXRot(0.0F);
} }
@ -1576,7 +1543,7 @@ index d6f820f50b84dd4375746d981acfb6887c90c364..2e1857e80797c9012e203f69f44d5a61
} }
public void detectEquipmentUpdates() { public void detectEquipmentUpdates() {
@@ -3068,7 +3063,6 @@ public abstract class LivingEntity extends Entity { @@ -3067,7 +3062,6 @@ public abstract class LivingEntity extends Entity {
this.setDeltaMovement(d4, d5, d6); this.setDeltaMovement(d4, d5, d6);
this.level.getProfiler().push("ai"); this.level.getProfiler().push("ai");
@ -1584,7 +1551,7 @@ index d6f820f50b84dd4375746d981acfb6887c90c364..2e1857e80797c9012e203f69f44d5a61
if (this.isImmobile()) { if (this.isImmobile()) {
this.jumping = false; this.jumping = false;
this.xxa = 0.0F; this.xxa = 0.0F;
@@ -3078,7 +3072,6 @@ public abstract class LivingEntity extends Entity { @@ -3077,7 +3071,6 @@ public abstract class LivingEntity extends Entity {
this.serverAiStep(); this.serverAiStep();
this.level.getProfiler().pop(); this.level.getProfiler().pop();
} }
@ -1592,7 +1559,7 @@ index d6f820f50b84dd4375746d981acfb6887c90c364..2e1857e80797c9012e203f69f44d5a61
this.level.getProfiler().pop(); this.level.getProfiler().pop();
this.level.getProfiler().push("jump"); this.level.getProfiler().push("jump");
@@ -3113,9 +3106,9 @@ public abstract class LivingEntity extends Entity { @@ -3112,9 +3105,9 @@ public abstract class LivingEntity extends Entity {
this.updateFallFlying(); this.updateFallFlying();
AABB axisalignedbb = this.getBoundingBox(); AABB axisalignedbb = this.getBoundingBox();
@ -1603,8 +1570,8 @@ index d6f820f50b84dd4375746d981acfb6887c90c364..2e1857e80797c9012e203f69f44d5a61
+ // SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot // Paper + // SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot // Paper
this.level.getProfiler().pop(); this.level.getProfiler().pop();
this.level.getProfiler().push("freezing"); this.level.getProfiler().push("freezing");
boolean flag1 = this.getType().is((Tag) EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES); boolean flag1 = this.getType().is(EntityTypeTags.FREEZE_HURTS_EXTRA_TYPES);
@@ -3144,9 +3137,7 @@ public abstract class LivingEntity extends Entity { @@ -3143,9 +3136,7 @@ public abstract class LivingEntity extends Entity {
this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox()); this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox());
} }
@ -1615,10 +1582,10 @@ index d6f820f50b84dd4375746d981acfb6887c90c364..2e1857e80797c9012e203f69f44d5a61
if (!this.level.isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { if (!this.level.isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) {
this.hurt(DamageSource.DROWN, 1.0F); this.hurt(DamageSource.DROWN, 1.0F);
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 8ff3b141b816599759570ae0c7bee35cca7bef11..71cbc053a23e5404a2472f5e1e56484939c8413a 100644 index d449516a2aafebe3cda9810b7d1ee97e61e8f399..99685c3ad91ca0e3bf20fb6ca100466ec14b7a0f 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
@@ -82,7 +82,6 @@ import org.bukkit.Bukkit; @@ -83,7 +83,6 @@ import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
@ -1626,7 +1593,7 @@ index 8ff3b141b816599759570ae0c7bee35cca7bef11..71cbc053a23e5404a2472f5e1e564849
import org.bukkit.craftbukkit.block.CapturedBlockState; import org.bukkit.craftbukkit.block.CapturedBlockState;
import org.bukkit.craftbukkit.block.CraftBlockState; import org.bukkit.craftbukkit.block.CraftBlockState;
import org.bukkit.craftbukkit.block.data.CraftBlockData; import org.bukkit.craftbukkit.block.data.CraftBlockData;
@@ -151,7 +150,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -152,7 +151,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper
@ -1635,8 +1602,8 @@ index 8ff3b141b816599759570ae0c7bee35cca7bef11..71cbc053a23e5404a2472f5e1e564849
public static BlockPos lastPhysicsProblem; // Spigot public static BlockPos lastPhysicsProblem; // Spigot
private org.spigotmc.TickLimiter entityLimiter; private org.spigotmc.TickLimiter entityLimiter;
private org.spigotmc.TickLimiter tileLimiter; private org.spigotmc.TickLimiter tileLimiter;
@@ -239,7 +238,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -240,7 +239,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
} public void onBorderSetDamageSafeZOne(WorldBorder border, double safeZoneRadius) {}
}); });
// CraftBukkit end // CraftBukkit end
- this.timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings - this.timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings
@ -1644,7 +1611,7 @@ index 8ff3b141b816599759570ae0c7bee35cca7bef11..71cbc053a23e5404a2472f5e1e564849
this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime);
this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
} }
@@ -727,15 +726,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -728,15 +727,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
timings.tileEntityTick.stopTiming(); // Spigot timings.tileEntityTick.stopTiming(); // Spigot
this.tickingBlockEntities = false; this.tickingBlockEntities = false;
@ -1661,57 +1628,11 @@ index 8ff3b141b816599759570ae0c7bee35cca7bef11..71cbc053a23e5404a2472f5e1e564849
} catch (Throwable throwable) { } catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking entity"); CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking entity");
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being ticked"); CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being ticked");
diff --git a/src/main/java/net/minecraft/world/level/ServerTickList.java b/src/main/java/net/minecraft/world/level/ServerTickList.java
index 6085d76a1774bca258de68cdace02598afd1f154..dfd41db804acde50339de9b18566b845401d7cbe 100644
--- a/src/main/java/net/minecraft/world/level/ServerTickList.java
+++ b/src/main/java/net/minecraft/world/level/ServerTickList.java
@@ -37,7 +37,14 @@ public class ServerTickList<T> implements TickList<T> {
private final List<TickNextTickData<T>> alreadyTicked = Lists.newArrayList();
private final Consumer<TickNextTickData<T>> ticker;
- public ServerTickList(ServerLevel world, Predicate<T> invalidObjPredicate, Function<T, ResourceLocation> idToName, Consumer<TickNextTickData<T>> tickConsumer) {
+ // Paper start - timings
+ private final co.aikar.timings.Timing timingCleanup; // Paper
+ private final co.aikar.timings.Timing timingTicking; // Paper
+
+ public ServerTickList(ServerLevel world, Predicate<T> invalidObjPredicate, Function<T, ResourceLocation> idToName, Consumer<TickNextTickData<T>> tickConsumer, String timingsType) {
+ this.timingCleanup = co.aikar.timings.WorldTimingsHandler.getTickList(world, timingsType + " - Cleanup");
+ this.timingTicking = co.aikar.timings.WorldTimingsHandler.getTickList(world, timingsType + " - Ticking");
+ // Paper end
this.ignore = invalidObjPredicate;
this.toId = idToName;
this.level = world;
@@ -64,6 +71,7 @@ public class ServerTickList<T> implements TickList<T> {
this.level.getProfiler().push("cleaning");
+ this.timingCleanup.startTiming(); // Paper
TickNextTickData nextticklistentry;
while (i > 0 && iterator.hasNext()) {
@@ -79,7 +87,9 @@ public class ServerTickList<T> implements TickList<T> {
--i;
}
}
+ this.timingCleanup.stopTiming(); // Paper
+ this.timingTicking.startTiming(); // Paper
this.level.getProfiler().popPush("ticking");
while ((nextticklistentry = (TickNextTickData) this.currentlyTicking.poll()) != null) {
@@ -99,6 +109,7 @@ public class ServerTickList<T> implements TickList<T> {
}
}
+ this.timingTicking.stopTiming(); // Paper
this.level.getProfiler().pop();
this.alreadyTicked.clear();
this.currentlyTicking.clear();
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index 0cd5448d93091e981374b0c11e95a3baca9defef..72ef08a59dbf72bec2ce54ab76455c4230395959 100644 index c9e6cb9f5c3eae53140236e09768ff759e27ace0..5147f67c87ba3b8912a8ae24f876a9e996504600 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java --- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -90,6 +90,15 @@ public class Block extends BlockBehaviour implements ItemLike { @@ -88,6 +88,15 @@ public class Block extends BlockBehaviour implements ItemLike {
public static final int UPDATE_LIMIT = 512; public static final int UPDATE_LIMIT = 512;
protected final StateDefinition<Block, BlockState> stateDefinition; protected final StateDefinition<Block, BlockState> stateDefinition;
private BlockState defaultBlockState; private BlockState defaultBlockState;
@ -1728,17 +1649,17 @@ index 0cd5448d93091e981374b0c11e95a3baca9defef..72ef08a59dbf72bec2ce54ab76455c42
private String descriptionId; private String descriptionId;
@Nullable @Nullable
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
index 3a7770fec4abc52b0cf51cc1df0aa1be56afdb35..5434c3770297b20e2c523684069d52d927f09e37 100644 index 927133867393fc805b44e824f7b78fac372b0b25..e1cbecc402bfc14fb9e36d5c449cd404f119752d 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -19,10 +19,12 @@ import org.bukkit.inventory.InventoryHolder; @@ -22,10 +22,12 @@ import org.bukkit.inventory.InventoryHolder;
// CraftBukkit end // CraftBukkit end
import org.spigotmc.CustomTimingsHandler; // Spigot import org.spigotmc.CustomTimingsHandler; // Spigot
+import co.aikar.timings.MinecraftTimings; // Paper +import co.aikar.timings.MinecraftTimings; // Paper
+import co.aikar.timings.Timing; // Paper +import co.aikar.timings.Timing; // Paper
public abstract class BlockEntity implements net.minecraft.server.KeyedObject { // Paper public abstract class BlockEntity implements io.papermc.paper.util.KeyedObject { // Paper
- public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot - public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot
+ public Timing tickTimer = MinecraftTimings.getTileEntityTimings(this); // Paper + public Timing tickTimer = MinecraftTimings.getTileEntityTimings(this); // Paper
@ -1746,10 +1667,10 @@ index 3a7770fec4abc52b0cf51cc1df0aa1be56afdb35..5434c3770297b20e2c523684069d52d9
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
public CraftPersistentDataContainer persistentDataContainer; public CraftPersistentDataContainer persistentDataContainer;
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index e9a04017df42312e4e0e7e414c9ccc95c71ddae1..4a13b18ce609fc6a86da48b0673ccf9d3e0d8292 100644 index 4ed85501fc81de7a2262a8061ba8a38828a86817..8278f85964b8a7c954a5d4746795b6870ca3cea1 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -731,6 +731,7 @@ public class LevelChunk implements ChunkAccess { @@ -659,6 +659,7 @@ public class LevelChunk extends ChunkAccess {
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(this.bukkitChunk, this.needsDecoration)); server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(this.bukkitChunk, this.needsDecoration));
if (this.needsDecoration) { if (this.needsDecoration) {
@ -1757,7 +1678,7 @@ index e9a04017df42312e4e0e7e414c9ccc95c71ddae1..4a13b18ce609fc6a86da48b0673ccf9d
this.needsDecoration = false; this.needsDecoration = false;
java.util.Random random = new java.util.Random(); java.util.Random random = new java.util.Random();
random.setSeed(this.level.getSeed()); random.setSeed(this.level.getSeed());
@@ -750,6 +751,7 @@ public class LevelChunk implements ChunkAccess { @@ -678,6 +679,7 @@ public class LevelChunk extends ChunkAccess {
} }
} }
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(this.bukkitChunk)); server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(this.bukkitChunk));
@ -1766,39 +1687,36 @@ index e9a04017df42312e4e0e7e414c9ccc95c71ddae1..4a13b18ce609fc6a86da48b0673ccf9d
} }
} }
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
index b645a2fc839dbf922ce73b23b7d53e9a5fe1a2ee..03190535999d30aea0428631ae576b18f5d10eb7 100644 index 3deb0b089ac9f803b728cdc5fbfb28542a2dc1c4..2fd969d1450d1251c139f3721d146fd2e191c4dd 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
@@ -433,7 +433,6 @@ public class ChunkSerializer { @@ -481,13 +481,10 @@ public class ChunkSerializer {
private static void postLoadChunk(ServerLevel world, CompoundTag nbt, LevelChunk chunk) { ListTag nbttaglist1 = ChunkSerializer.getListOfCompoundsOrNull(nbt, "block_entities");
ListTag nbttaglist;
return nbttaglist == null && nbttaglist1 == null ? null : (chunk) -> {
- world.timings.syncChunkLoadEntitiesTimer.startTiming(); // Spigot - world.timings.syncChunkLoadEntitiesTimer.startTiming(); // Spigot
if (nbt.contains("Entities", 9)) { if (nbttaglist != null) {
nbttaglist = nbt.getList("Entities", 10); world.addLegacyChunkEntities(EntityType.loadEntitiesRecursive(nbttaglist, world));
if (!nbttaglist.isEmpty()) {
@@ -441,8 +440,6 @@ public class ChunkSerializer {
} }
}
- world.timings.syncChunkLoadEntitiesTimer.stopTiming(); // Spigot - world.timings.syncChunkLoadEntitiesTimer.stopTiming(); // Spigot
- world.timings.syncChunkLoadTileEntitiesTimer.startTiming(); // Spigot
nbttaglist = nbt.getList("TileEntities", 10);
for (int i = 0; i < nbttaglist.size(); ++i) { - world.timings.syncChunkLoadTileEntitiesTimer.startTiming(); // Spigot
@@ -460,7 +457,6 @@ public class ChunkSerializer { if (nbttaglist1 != null) {
for (int i = 0; i < nbttaglist1.size(); ++i) {
CompoundTag nbttagcompound1 = nbttaglist1.getCompound(i);
@@ -505,7 +502,6 @@ public class ChunkSerializer {
} }
} }
} }
- world.timings.syncChunkLoadTileEntitiesTimer.stopTiming(); // Spigot - world.timings.syncChunkLoadTileEntitiesTimer.stopTiming(); // Spigot
} // CraftBukkit start - load chunk persistent data from nbt
net.minecraft.nbt.Tag persistentBase = nbt.get("ChunkBukkitValues");
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 fea5e7abcb5e429a3de5dd8968773fe5043a4448..421fbc0cf660d5d743ca34d5d759becea3fd666f 100644 index 0cd31f82fcaab925db6dcada3e9b42a48fe04c67..734fbbd27dc3bfed223ea03f246ebfb87a46225a 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
@@ -2256,12 +2256,31 @@ public final class CraftServer implements Server { @@ -2268,12 +2268,31 @@ public final class CraftServer implements Server {
private final org.bukkit.Server.Spigot spigot = new org.bukkit.Server.Spigot() private final org.bukkit.Server.Spigot spigot = new org.bukkit.Server.Spigot()
{ {
@ -2000,10 +1918,10 @@ index b0ffa23faf62629043dfd613315eaf9c5fcc2cfe..00000000000000000000000000000000
- } - }
-} -}
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 137889f545bc9f77a1752dd0bce4fcbc3889d665..654d9fd062ef8c98d87b025d48a1a9f709dd3db0 100644 index 8a0c4dccfc2be9e2213ffc094ed74d33e328241b..74617477ce710be19c5fd76e43c72e37f3750d33 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
@@ -1833,6 +1833,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1825,6 +1825,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
packet.components = components; packet.components = components;
CraftPlayer.this.getHandle().connection.send(packet); CraftPlayer.this.getHandle().connection.send(packet);
} }
@ -2196,7 +2114,7 @@ index e52ef47b783785dc214746b678e7b549aea9a274..3d90b3426873a3528af14f7f1ab0adae
this.value = value; this.value = value;
} }
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 67cae2e6055389e93fb4b94daf8402ec5fdc6f9a..7a3ba7590249d6a3eb37f894c9cfd414a8ccf3fd 100644 index 0596f94c6ae22fcfddd7370e1eebd71885ed0e54..7024e0750a10ce4325b7217c76e03603ef53faa8 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
@@ -156,6 +156,12 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -156,6 +156,12 @@ public final class CraftMagicNumbers implements UnsafeValues {

1
todo.txt Normale Datei
Datei anzeigen

@ -0,0 +1 @@
Add Timings to LevelTicks and EntityTickList