more work

This commit is contained in:
Noah van der Aa 2023-09-21 21:00:11 +02:00
parent b6e46e90cd
commit 2b72b74a36
No known key found for this signature in database
GPG key ID: 547D90BC6FF753CF
6 changed files with 430 additions and 460 deletions

View file

@ -5468,10 +5468,10 @@ index 0000000000000000000000000000000000000000..808d1449ac44ae86a650932365081fba
+ }
+}
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index 90edfea7151f2ad259288545d512af7cd1b82f19..01eb418bde1dadbbfa30954f81281199b2fec778 100644
index 092bfedfb32c38550d1cab1b696feac6df09131f..9870eccc1dc5c2201f12f8e2affe647f6b0375f8 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -117,7 +117,7 @@ public class Util {
@@ -118,7 +118,7 @@ public class Util {
}
public static long getNanos() {
@ -5501,10 +5501,10 @@ index 2bb5e51f71cbf66819d198505aa4a5ecffd246c6..1834f3efb05fd70c8c1c67733bff5148
@Override
public BlockPos immutable() {
diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java
index 29664f7f44ad7dec9cbccd276a14937ca1c4a3bb..64765dab6fed87ffdf4af197d8d5f28a04544db0 100644
index 666df22c8f847ef7152669540a3844566ef90d78..92095b494a0c4fb89b84f0b1c0376615d28e34ce 100644
--- a/src/main/java/net/minecraft/nbt/CompoundTag.java
+++ b/src/main/java/net/minecraft/nbt/CompoundTag.java
@@ -123,7 +123,7 @@ public class CompoundTag implements Tag {
@@ -160,7 +160,7 @@ public class CompoundTag implements Tag {
return "TAG_Compound";
}
};
@ -5513,7 +5513,7 @@ index 29664f7f44ad7dec9cbccd276a14937ca1c4a3bb..64765dab6fed87ffdf4af197d8d5f28a
protected CompoundTag(Map<String, Tag> entries) {
this.tags = entries;
@@ -199,6 +199,10 @@ public class CompoundTag implements Tag {
@@ -236,6 +236,10 @@ public class CompoundTag implements Tag {
this.tags.put(key, NbtUtils.createUUID(value));
}
@ -5525,23 +5525,23 @@ index 29664f7f44ad7dec9cbccd276a14937ca1c4a3bb..64765dab6fed87ffdf4af197d8d5f28a
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
index e6c4379b0fd7c1338e1713281cd9515cb54acecb..a63e7ee5c42bd51312155feab31c6ec4232e1bc7 100644
index 427959874b7f167184785a582163029ad4a66df2..344c5af75c4a66bb27f3f422937c6c427c15ed25 100644
--- a/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<?>> {
JvmProfiler.INSTANCE.onPacketSent(l, i, channelHandlerContext.channel().remoteAddress(), k);
}
} catch (Throwable var10) {
- LOGGER.error("Error receiving packet {}", i, var10);
+ LOGGER.error("Packet encoding of packet ID {} threw (skippable? {})", i, packet.isSkippable(), var10); // Paper - Give proper error message
@@ -46,7 +46,7 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
JvmProfiler.INSTANCE.onPacketSent(codecData.protocol(), i, channelHandlerContext.channel().remoteAddress(), k);
} catch (Throwable var13) {
- LOGGER.error("Error receiving packet {}", i, var13);
+ LOGGER.error("Packet encoding of packet ID {} threw (skippable? {})", i, packet.isSkippable(), var13); // Paper - Give proper error message
if (packet.isSkippable()) {
throw new SkipPacketException(var10);
} else {
throw new SkipPacketException(var13);
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8c7d762219e848387b153fb50553b7de58bc9627..e896917b3546f9d075179198c6dcd714f6cddd50 100644
index 124fad1031d6125bca233541e2d5f256da70ca44..2a7c614df7b9c9405a5dd23e6a888ede7fc86683 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -295,6 +295,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -290,6 +290,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public final double[] recentTps = new double[ 3 ];
// Spigot end
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations;
@ -5549,7 +5549,7 @@ index 8c7d762219e848387b153fb50553b7de58bc9627..e896917b3546f9d075179198c6dcd714
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference();
@@ -928,6 +929,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -910,6 +911,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
MinecraftServer.LOGGER.error("Failed to unlock level {}", this.storageSource.getLevelId(), ioexception1);
}
// Spigot start
@ -5559,7 +5559,7 @@ index 8c7d762219e848387b153fb50553b7de58bc9627..e896917b3546f9d075179198c6dcd714
if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) {
MinecraftServer.LOGGER.info("Saving usercache.json");
this.getProfileCache().save();
@@ -992,6 +996,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -974,6 +978,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.lastOverloadWarning = this.nextTickTime;
}
@ -5567,7 +5567,7 @@ index 8c7d762219e848387b153fb50553b7de58bc9627..e896917b3546f9d075179198c6dcd714
if ( tickCount++ % MinecraftServer.SAMPLE_INTERVAL == 0 )
{
double currentTps = 1E3 / ( curTime - tickSection ) * MinecraftServer.SAMPLE_INTERVAL;
@@ -1209,7 +1214,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1191,7 +1196,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
MinecraftServer.LOGGER.debug("Autosave finished");
SpigotTimings.worldSaveTimer.stopTiming(); // Spigot
}
@ -5576,7 +5576,7 @@ index 8c7d762219e848387b153fb50553b7de58bc9627..e896917b3546f9d075179198c6dcd714
this.profiler.push("tallying");
long j = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i;
@@ -1299,6 +1304,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1286,6 +1291,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
try {
worldserver.timings.doTick.startTiming(); // Spigot
worldserver.tick(shouldKeepTicking);
@ -5589,7 +5589,7 @@ index 8c7d762219e848387b153fb50553b7de58bc9627..e896917b3546f9d075179198c6dcd714
} catch (Throwable throwable) {
// Spigot Start
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1cefbd5490 100644
index 1641bdf8725df778ba91bf5cd22c1ebbb3745058..facfdbb87e89f4db33ce13233c2ba4366d35c15b 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -50,9 +50,9 @@ public class ChunkHolder {
@ -5605,9 +5605,9 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c
private CompletableFuture<ChunkAccess> chunkToSave;
@Nullable
private final DebugBuffer<ChunkHolder.ChunkSaveDebug> chunkToSaveHistory;
@@ -70,6 +70,18 @@ public class ChunkHolder {
private boolean wasAccessibleSinceLastSave;
@@ -71,6 +71,18 @@ public class ChunkHolder {
private CompletableFuture<Void> pendingFullStateConfirmation;
private CompletableFuture<?> sendSync;
+ private final ChunkMap chunkMap; // Paper
+
@ -5624,7 +5624,7 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c
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.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
@@ -90,8 +102,23 @@ public class ChunkHolder {
@@ -92,8 +104,23 @@ public class ChunkHolder {
this.queueLevel = this.oldTicketLevel;
this.setTicketLevel(level);
this.changedBlocksPerSection = new ShortSet[world.getSectionsCount()];
@ -5648,7 +5648,7 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c
// CraftBukkit start
public LevelChunk getFullChunkNow() {
// Note: We use the oldTicketLevel for isLoaded checks.
@@ -116,20 +143,20 @@ public class ChunkHolder {
@@ -118,20 +145,20 @@ public class ChunkHolder {
return ChunkLevel.generationStatus(this.ticketLevel).isOrAfter(leastStatus) ? this.getFutureIfPresentUnchecked(leastStatus) : ChunkHolder.UNLOADED_CHUNK_FUTURE;
}
@ -5673,7 +5673,7 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c
CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> completablefuture = this.getTickingChunkFuture();
Either<LevelChunk, ChunkHolder.ChunkLoadingFailure> either = (Either) completablefuture.getNow(null); // CraftBukkit - decompile error
@@ -137,7 +164,7 @@ public class ChunkHolder {
@@ -148,7 +175,7 @@ public class ChunkHolder {
}
@Nullable
@ -5682,7 +5682,7 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c
CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> completablefuture = this.getFullChunkFuture();
Either<LevelChunk, ChunkHolder.ChunkLoadingFailure> either = (Either) completablefuture.getNow(null); // CraftBukkit - decompile error
@@ -158,6 +185,21 @@ public class ChunkHolder {
@@ -169,6 +196,21 @@ public class ChunkHolder {
return null;
}
@ -5704,7 +5704,7 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c
@Nullable
public ChunkAccess getLastAvailable() {
for (int i = ChunkHolder.CHUNK_STATUSES.size() - 1; i >= 0; --i) {
@@ -176,7 +218,7 @@ public class ChunkHolder {
@@ -187,7 +229,7 @@ public class ChunkHolder {
return null;
}
@ -5713,7 +5713,7 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c
return this.chunkToSave;
}
@@ -364,11 +406,11 @@ public class ChunkHolder {
@@ -386,11 +428,11 @@ public class ChunkHolder {
return ChunkLevel.fullStatus(this.ticketLevel);
}
@ -5727,7 +5727,7 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c
return this.ticketLevel;
}
@@ -457,14 +499,31 @@ public class ChunkHolder {
@@ -479,14 +521,31 @@ public class ChunkHolder {
this.wasAccessibleSinceLastSave |= flag3;
if (!flag2 && flag3) {
@ -5759,7 +5759,7 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c
}
boolean flag4 = fullchunkstatus.isOrAfter(FullChunkStatus.BLOCK_TICKING);
@@ -473,11 +532,25 @@ public class ChunkHolder {
@@ -495,11 +554,25 @@ public class ChunkHolder {
if (!flag4 && flag5) {
this.tickingChunkFuture = chunkStorage.prepareTickingChunk(this);
this.scheduleFullChunkPromotion(chunkStorage, this.tickingChunkFuture, executor, FullChunkStatus.BLOCK_TICKING);
@ -5786,7 +5786,7 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c
this.tickingChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
}
@@ -491,11 +564,24 @@ public class ChunkHolder {
@@ -513,11 +586,24 @@ public class ChunkHolder {
this.entityTickingChunkFuture = chunkStorage.prepareEntityTickingChunk(this);
this.scheduleFullChunkPromotion(chunkStorage, this.entityTickingChunkFuture, executor, FullChunkStatus.ENTITY_TICKING);
@ -5812,7 +5812,7 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c
this.entityTickingChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE;
}
@@ -593,4 +679,18 @@ public class ChunkHolder {
@@ -615,4 +701,18 @@ public class ChunkHolder {
}
};
}
@ -5832,18 +5832,10 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a185172664c5e4 100644
index e9cf8686b59c232816b2fde92fc6616f77979a64..a7c18ca224c536b7b97d5889af321f23e637b420 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -68,6 +68,7 @@ import net.minecraft.network.protocol.game.ClientboundSetChunkCacheCenterPacket;
import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket;
import net.minecraft.network.protocol.game.ClientboundSetPassengersPacket;
import net.minecraft.network.protocol.game.DebugPackets;
+import io.papermc.paper.util.MCUtil;
import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.server.network.ServerPlayerConnection;
import net.minecraft.util.CsvOutput;
@@ -175,6 +176,56 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -167,6 +167,56 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
};
// CraftBukkit end
@ -5851,8 +5843,8 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517
+ private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>();
+
+ void addPlayerToDistanceMaps(ServerPlayer player) {
+ int chunkX = MCUtil.getChunkCoordinate(player.getX());
+ int chunkZ = MCUtil.getChunkCoordinate(player.getZ());
+ int chunkX = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getX());
+ int chunkZ = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getZ());
+ // Note: players need to be explicitly added to distance maps before they can be updated
+ }
+
@ -5861,8 +5853,8 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517
+ }
+
+ void updateMaps(ServerPlayer player) {
+ int chunkX = MCUtil.getChunkCoordinate(player.getX());
+ int chunkZ = MCUtil.getChunkCoordinate(player.getZ());
+ int chunkX = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getX());
+ int chunkZ = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getZ());
+ // Note: players need to be explicitly added to distance maps before they can be updated
+ }
+ // Paper end
@ -5900,10 +5892,10 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517
public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureTemplateManager structureTemplateManager, Executor executor, BlockableEventLoop<Runnable> mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory, int viewDistance, boolean dsync) {
super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync);
this.visibleChunkMap = this.updatingChunkMap.clone();
@@ -228,6 +279,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -220,6 +270,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.overworldDataStorage = persistentStateManagerFactory;
this.poiManager = new PoiManager(path.resolve("poi"), dataFixer, dsync, iregistrycustom, world);
this.setViewDistance(viewDistance);
this.setServerViewDistance(viewDistance);
+ // 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.regionManagers.add(this.dataRegionManager);
@ -5911,7 +5903,7 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517
}
protected ChunkGenerator generator() {
@@ -324,6 +379,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -321,6 +375,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
}
@ -5927,7 +5919,7 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517
private CompletableFuture<Either<List<ChunkAccess>, ChunkHolder.ChunkLoadingFailure>> getChunkRangeFuture(ChunkHolder centerChunk, int margin, IntFunction<ChunkStatus> distanceToStatus) {
if (margin == 0) {
ChunkStatus chunkstatus = (ChunkStatus) distanceToStatus.apply(0);
@@ -420,9 +484,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -417,9 +480,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
};
stringbuilder.append("Updating:").append(System.lineSeparator());
@ -5939,7 +5931,7 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517
CrashReport crashreport = CrashReport.forThrowable(exception, "Chunk loading");
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Chunk loading");
@@ -464,8 +528,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -461,8 +524,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
holder.setTicketLevel(level);
} else {
holder = new ChunkHolder(new ChunkPos(pos), level, this.level, this.lightEngine, this.queueSorter, this);
@ -5954,16 +5946,16 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517
this.updatingChunkMap.put(pos, holder);
this.modified = true;
}
@@ -487,7 +557,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -484,7 +553,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
protected void saveAllChunks(boolean flush) {
if (flush) {
- List<ChunkHolder> list = (List) this.visibleChunkMap.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).collect(Collectors.toList());
+ List<ChunkHolder> list = (List) io.papermc.paper.chunk.system.ChunkSystem.getVisibleChunkHolders(this.level).stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).collect(Collectors.toList()); // Paper
- List<ChunkHolder> list = this.visibleChunkMap.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).toList();
+ List<ChunkHolder> list = io.papermc.paper.chunk.system.ChunkSystem.getVisibleChunkHolders(this.level).stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).toList(); // Paper
MutableBoolean mutableboolean = new MutableBoolean();
do {
@@ -516,7 +586,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -513,7 +582,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
});
this.flushWorker();
} else {
@ -5972,7 +5964,7 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517
}
}
@@ -535,7 +605,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -532,7 +601,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public boolean hasWork() {
@ -5981,7 +5973,7 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517
}
private void processUnloads(BooleanSupplier shouldKeepTicking) {
@@ -546,6 +616,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -543,6 +612,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
ChunkHolder playerchunk = (ChunkHolder) this.updatingChunkMap.remove(j);
if (playerchunk != null) {
@ -5989,7 +5981,7 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517
this.pendingUnloads.put(j, playerchunk);
this.modified = true;
++i;
@@ -563,7 +634,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -560,7 +630,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
int l = 0;
@ -5998,7 +5990,7 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517
while (l < 20 && shouldKeepTicking.getAsBoolean() && objectiterator.hasNext()) {
if (this.saveChunkIfNeeded((ChunkHolder) objectiterator.next())) {
@@ -581,7 +652,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -578,7 +648,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (completablefuture1 != completablefuture) {
this.scheduleUnload(pos, holder);
} else {
@ -6011,7 +6003,7 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517
if (ichunkaccess instanceof LevelChunk) {
((LevelChunk) ichunkaccess).setLoaded(false);
}
@@ -597,7 +672,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -594,7 +668,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.lightEngine.tryScheduleUpdate();
this.progressListener.onStatusChange(ichunkaccess.getPos(), (ChunkStatus) null);
this.chunkSaveCooldowns.remove(ichunkaccess.getPos().toLong());
@ -6022,16 +6014,7 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517
}
};
@@ -991,7 +1068,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.viewDistance = j;
this.distanceManager.updatePlayerTickets(this.viewDistance);
- ObjectIterator objectiterator = this.updatingChunkMap.values().iterator();
+ Iterator objectiterator = io.papermc.paper.chunk.system.ChunkSystem.getUpdatingChunkHolders(this.level).iterator(); // Paper
while (objectiterator.hasNext()) {
ChunkHolder playerchunk = (ChunkHolder) objectiterator.next();
@@ -1034,7 +1111,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1037,7 +1113,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
public int size() {
@ -6040,7 +6023,7 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517
}
public DistanceManager getDistanceManager() {
@@ -1042,19 +1119,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1045,19 +1121,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
protected Iterable<ChunkHolder> getChunks() {
@ -6065,32 +6048,33 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517
Optional<ChunkAccess> optional = Optional.ofNullable(playerchunk.getLastAvailable());
Optional<LevelChunk> optional1 = optional.flatMap((ichunkaccess) -> {
return ichunkaccess instanceof LevelChunk ? Optional.of((LevelChunk) ichunkaccess) : Optional.empty();
@@ -1180,6 +1257,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (!flag1) {
this.distanceManager.addPlayer(SectionPos.of((EntityAccess) player), player);
}
@@ -1182,6 +1258,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
player.setChunkTrackingView(ChunkTrackingView.EMPTY);
this.updateChunkTracking(player);
+ this.addPlayerToDistanceMaps(player); // Paper - distance maps
} else {
SectionPos sectionposition = player.getLastSectionPos();
@@ -1187,6 +1265,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (!flag2) {
@@ -1190,6 +1267,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.distanceManager.removePlayer(sectionposition, player);
}
+ this.removePlayerFromDistanceMaps(player); // Paper - distance maps
+ }
+
this.applyChunkTrackingView(player, ChunkTrackingView.EMPTY);
}
for (int k = i - this.viewDistance - 1; k <= i + this.viewDistance + 1; ++k) {
@@ -1300,6 +1379,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
@@ -1241,6 +1321,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.updateChunkTracking(player);
}
+ this.updateMaps(player); // Paper - distance maps
+
}
@Override
@@ -1536,7 +1617,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private void updateChunkTracking(ServerPlayer player) {
@@ -1493,7 +1574,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private class ChunkDistanceManager extends DistanceManager {
protected ChunkDistanceManager(Executor workerExecutor, Executor mainThreadExecutor) {
@ -6145,7 +6129,7 @@ index 1bfa33253a154c66dc8b7e476c777b74cda8999f..d8b83c8c89143d78620f812c491a1950
while (objectiterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 2bc9afcd46f2d42e8bab1cf29defe53d00b2bc8b..5115342b51ccefe4430df47a498bc59b1d96bb0e 100644
index 6c94ffc01377e3a066771509727e62521b2cea78..f402341b95c7752a2706edd502098696f786f4ef 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -51,6 +51,7 @@ import net.minecraft.world.level.storage.LevelStorageSource;
@ -6452,7 +6436,7 @@ index 2bc9afcd46f2d42e8bab1cf29defe53d00b2bc8b..5115342b51ccefe4430df47a498bc59b
ChunkHolder playerchunk = this.getVisibleChunkIfPresent(pos);
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index ebae711991a3ae35e35c2cffa8d928677c205492..7be97441aed66fa3a21d13ad2211b3e0e08120c0 100644
index 32565740c6b013d9ad644e7c62d6721bdbd15b10..e2eff46cae9771931b2e0dfee5e73fd4842e3ab5 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -176,6 +176,7 @@ import org.bukkit.event.weather.LightningStrikeEvent;
@ -6563,21 +6547,21 @@ index ebae711991a3ae35e35c2cffa8d928677c205492..7be97441aed66fa3a21d13ad2211b3e0
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
// IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess(); // 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
index 07220c52935369555f652bdd94692eec910d0fe2..d06430d59259849715e1457a75fd4f52406a34c2 100644
index fb5043e69ef59623c51b88176914f9f8becfc9ae..084339c7da80ce21ab8405e20b76af87dbbbe8ce 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -255,6 +255,8 @@ public class ServerPlayer extends Player {
public Integer clientViewDistance;
@@ -251,6 +251,8 @@ public class ServerPlayer extends Player {
public boolean sentListPacket = false;
public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
// CraftBukkit end
+ public boolean isRealPlayer; // Paper
+ public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
@@ -319,6 +321,8 @@ public class ServerPlayer extends Player {
this.setMaxUpStep(1.0F);
this.fudgeSpawnLocation(world);
this.updateOptions(clientOptions);
+ this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper
+
@ -6628,13 +6612,13 @@ index a63d5ba706a5b8e430aedc045bdeb3a410bd0eef..e96a0ca47e4701ba187555bd92c96834
public BlockState getBlockState(BlockPos pos) {
return this.getChunk(SectionPos.blockToSectionCoord(pos.getX()), SectionPos.blockToSectionCoord(pos.getZ())).getBlockState(pos);
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index d1a94a7de19b0c46454040f7459a492e30265e9c..edf629f2e810eebf014b1565021888f96def92a1 100644
index 0fcac9b089e030b387d1b4c79c26e69ed9dcf4ed..10b263b2693a6b507c858b6550b5b98a53cea575 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -185,6 +185,7 @@ public abstract class PlayerList {
@@ -178,6 +178,7 @@ public abstract class PlayerList {
}
public void placeNewPlayer(Connection connection, ServerPlayer player) {
public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData) {
+ player.isRealPlayer = true; // Paper
GameProfile gameprofile = player.getGameProfile();
GameProfileCache usercache = this.server.getProfileCache();
@ -6658,7 +6642,7 @@ index 337e0a7b3c14e1b1a28744920e0dc0a69e0c5a87..f5829ae484d93b547a5437b85a962134
@Override
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
index 4d344101aa082c297611daa4d1b0006b85fcb7c8..78c7c779209972186b1244fb678d7208b38e30e3 100644
index 0863d7acce248895d57a4c0496881b542e4b79f1..6c5000ff3dbb7517d095e9fb2cdf555212b2c090 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -323,6 +323,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@ -6674,7 +6658,7 @@ index 4d344101aa082c297611daa4d1b0006b85fcb7c8..78c7c779209972186b1244fb678d7208
public Entity(EntityType<?> type, Level world) {
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
index d6d16f54ed22f8bc025ab6a5c7bd998ec1a44145..861f366e05af1c2bf5bbc8a4e752e3fb675747ae 100644
index 96f94f11d5d98cddf98020fdbf5ec658d6d53f38..e24e61a35fe9cffce4a2174d46b88cf934f4b69f 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -258,6 +258,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -6686,10 +6670,10 @@ index d6d16f54ed22f8bc025ab6a5c7bd998ec1a44145..861f366e05af1c2bf5bbc8a4e752e3fb
@Override
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
index 0762cdf228b8abc69125485a446d16e9482fdca2..fd7a381d6fc9436f06b5a3e3508b8a4a0f4ece66 100644
index 6041f79ad8e2b61b438b19b5569ab02936a0be99..ec841a4d9a11f0d9047c202a31f944b340da33c8 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -275,6 +275,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
@@ -276,6 +276,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
return this.target;
}
@ -6698,10 +6682,10 @@ index 0762cdf228b8abc69125485a446d16e9482fdca2..fd7a381d6fc9436f06b5a3e3508b8a4a
// CraftBukkit start - fire event
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
index 9aa82c1d8743076e7737d5b0d14ea36687e87723..d8ce7ea5fcb2785435ec1f530cb6e7114c01e4b7 100644
index 21fa43e0c3fabf74919f7e41d074ab1f7c061967..5e9cf929674888b3a143a0691dc6936b304467f1 100644
--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java
+++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
@@ -18,6 +18,8 @@ public abstract class PathfinderMob extends Mob {
@@ -20,6 +20,8 @@ public abstract class PathfinderMob extends Mob {
super(type, world);
}
@ -6723,10 +6707,10 @@ index a0b5895abc88d297045e05f25bb09527991d43f0..6e0bd0eab0b06a4ac3042496bbb91292
super(type, world);
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
index 194c67d034daf6c584e903721aaf067a243302d5..3f18fb61a47dda559a6997af9c6c043423dd206a 100644
index 099daefa53b930a9a94ed91ef3fcd9e1607bfd09..1b2c0fda262ca6d5bd2ce22bc2e934803bd6f602 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -793,6 +793,25 @@ public final class ItemStack {
@@ -798,6 +798,25 @@ public final class ItemStack {
return this.tag != null ? this.tag.getList("Enchantments", 10) : new ListTag();
}
@ -6752,7 +6736,7 @@ index 194c67d034daf6c584e903721aaf067a243302d5..3f18fb61a47dda559a6997af9c6c0434
public void setTag(@Nullable CompoundTag nbt) {
this.tag = nbt;
if (this.getItem().canBeDepleted()) {
@@ -1183,6 +1202,7 @@ public final class ItemStack {
@@ -1187,6 +1206,7 @@ public final class ItemStack {
// CraftBukkit start
@Deprecated
public void setItem(Item item) {
@ -6789,7 +6773,7 @@ index 1c71d2c1b16bdba1e14a8230787e4cb4ad530163..d6d8bbc98fc71997cb52521d59ebb59d
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
index a3040440ed34a1c2adca2d57d458504a4a48282f..2d41f619577b41d6420159668bbab70fb6c762eb 100644
index 43bb3f5a617f4a6d719b02023a71edcb12aa9d05..34457c8afb4575d2395148f0a2bde6a96ec5e797 100644
--- a/src/main/java/net/minecraft/world/level/ChunkPos.java
+++ b/src/main/java/net/minecraft/world/level/ChunkPos.java
@@ -20,6 +20,7 @@ public class ChunkPos {
@ -7010,7 +6994,7 @@ index 249b3ed33672a9a9529bd14de978722b62019314..0f1025495237aebe30132ace0832aa57
public WorldBorder getWorldBorder() {
return this.level.getWorldBorder();
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 ccb3ceddd8f60f59473cd24d6ca5282f6e51f630..88b1aabec2812252c54d0901ccd1eba0216cb7c3 100644
index fefeccaf347da1be9342df09fafabb6fcc3be4ae..2b8e88a75e9a974e1ecafe0360a9d69b79326d11 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -754,8 +754,8 @@ public abstract class BlockBehaviour implements FeatureElement {
@ -7089,7 +7073,7 @@ index 532a0cae6db0d830e720a72e9021aa7a8ed0f106..e5e562f75e7d4b6a750f192842940c5e
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
index 36c3a06a94177ec21cfc5c513d16f7168fe2fe2c..e4deb276f956c5f292ab8bf7836eeeffd6ed59d5 100644
index 4185b7528ac757a2d6ebca4da4d46e65b7a981d0..b32e1bba27c91e81b7382072c4d8230db695066c 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -114,6 +114,109 @@ public class LevelChunk extends ChunkAccess {
@ -7382,7 +7366,7 @@ index 8adac67a9315186d1ef453eae827ea7f69856f7a..153143b06fc088f3142a8fa17f153d8a
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index b5544bbfcf4449bdf588a14a9afe518f272e8261..5e8ec70a58c047969a144355782da58aee44b288 100644
index 32adc1cee4dfe49a9a0009ab39382083001e6cbe..74f431e806a4c5abb7ddd193c1b5f7ba7f321cac 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1186,4 +1186,37 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@ -7667,10 +7651,10 @@ index 0000000000000000000000000000000000000000..909b2c98e7a9117d2f737245e4661792
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index afde61e784dada8df1f34bd15b1d3b71e842bb52..6deffd223ff995d83244e941576f8286e1171c1f 100644
index d2942ef34c6d68d57caec9f1209c2dcdd277c36d..35d2a206d4a36292c16e29247c950c2a69af2879 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -104,8 +104,17 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -105,8 +105,17 @@ public final class CraftMagicNumbers implements UnsafeValues {
private static final BiMap<net.minecraft.world.level.material.Fluid, Fluid> FLUIDTYPE_FLUID = HashBiMap.create();
private static final Map<Material, Item> MATERIAL_ITEM = new HashMap<>();
private static final Map<Material, Block> MATERIAL_BLOCK = new HashMap<>();
@ -7688,7 +7672,7 @@ index afde61e784dada8df1f34bd15b1d3b71e842bb52..6deffd223ff995d83244e941576f8286
for (Block block : BuiltInRegistries.BLOCK) {
BLOCK_MATERIAL.put(block, Material.getMaterial(BuiltInRegistries.BLOCK.getKey(block).getPath().toUpperCase(Locale.ROOT)));
}
@@ -169,6 +178,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -170,6 +179,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
public static ResourceLocation key(Material mat) {
return CraftNamespacedKey.toMinecraft(mat.getKey());
}

View file

@ -605,7 +605,7 @@ index 0000000000000000000000000000000000000000..ae60bd96b5284d54676d8e7e4dd5d170
+ }
+}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 546ad678af2705e3956f5f139aa847354a6fdeae..8bce21e0d3e4ca18dcd43f9ab61387a012a5f24f 100644
index a9ec28c3cf3ed50d929c80ac21959d82603ff0aa..95a4bcd09f3a9d462ff4c92431c07e3d3f55befc 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -186,6 +186,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -617,10 +617,10 @@ index 546ad678af2705e3956f5f139aa847354a6fdeae..8bce21e0d3e4ca18dcd43f9ab61387a0
this.setPvpAllowed(dedicatedserverproperties.pvp);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 7b2fdc799b0fe776606d3890098eba58c0bdea83..c373b1929b8bd4ae5ceb899c6c5ea097a6236f8d 100644
index 4bdc0ef703b31763f879e7de7da60e0847637f9a..5e08b8368d81153cf22ef9ae605fe5250464a283 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -940,6 +940,7 @@ public final class CraftServer implements Server {
@@ -943,6 +943,7 @@ public final class CraftServer implements Server {
this.commandMap.clearCommands();
this.reloadData();
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
@ -628,7 +628,7 @@ index 7b2fdc799b0fe776606d3890098eba58c0bdea83..c373b1929b8bd4ae5ceb899c6c5ea097
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
@@ -2533,6 +2534,34 @@ public final class CraftServer implements Server {
@@ -2536,6 +2537,34 @@ public final class CraftServer implements Server {
// Paper end
// Paper start

View file

@ -698,7 +698,7 @@ index 0000000000000000000000000000000000000000..6aaed8e8bf8c721fc834da5c76ac72a4
+ }
+}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 8bce21e0d3e4ca18dcd43f9ab61387a012a5f24f..cfc4cad33d36e720f32b7ad6d1d4b3983f7aad39 100644
index 95a4bcd09f3a9d462ff4c92431c07e3d3f55befc..ff3f00cf1d5180f83b16acac5676aa22cd967c8a 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -187,6 +187,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface

View file

@ -6947,10 +6947,10 @@ index f7114d5b8f2f93f62883e24da29afaf9f74ee1a6..8bf0630c0e06950cd99b7ae9898137f7
return foundFrame.orElse(null);
diff --git a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
index baa88201c4d08fb4f32f1198e187d7ca138b0f0e..7d09adf27da249851cfc87b7916b915240a65a7e 100644
index bdd3b48e5de2afd6b7655ba6ff742a60ee9540c5..98ef159b7091e53298838ae3723909be6d38b4ba 100644
--- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
+++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
@@ -319,7 +319,13 @@ public class BuiltInRegistries {
@@ -323,7 +323,13 @@ public class BuiltInRegistries {
}
public static void bootStrap() {
@ -6982,10 +6982,10 @@ index 1eabd8b5a99850298838b11ba97e3d220f444378..8ff786c366332588a2df053438f23cc9
Bootstrap.wrapStreams();
Bootstrap.bootstrapDuration.set(Duration.between(instant, Instant.now()).toMillis());
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index ac59339d9ed4b0860de7d338e5b7610175e27165..af8afd53b5d3b34be4a5207316ce35abbcdf202d 100644
index 9cfdd5d8c1650d9c9bdfbc07980239e507ff942d..ae0b713870976d4b1e469a90cef9b2e282dbcaab 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -133,6 +133,7 @@ public class Main {
@@ -130,6 +130,7 @@ public class Main {
JvmProfiler.INSTANCE.start(Environment.SERVER);
}
@ -6994,10 +6994,10 @@ index ac59339d9ed4b0860de7d338e5b7610175e27165..af8afd53b5d3b34be4a5207316ce35ab
Bootstrap.validate();
Util.startTimerHackThread();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index c373b1929b8bd4ae5ceb899c6c5ea097a6236f8d..061b1dbb92b9ec608ed9f0e2b7d09d498730610d 100644
index 5e08b8368d81153cf22ef9ae605fe5250464a283..8c32ad9cbbe8bc9693493eee97834aaf20633ed7 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -272,7 +272,8 @@ public final class CraftServer implements Server {
@@ -275,7 +275,8 @@ public final class CraftServer implements Server {
private final CraftCommandMap commandMap = new CraftCommandMap(this);
private final SimpleHelpMap helpMap = new SimpleHelpMap(this);
private final StandardMessenger messenger = new StandardMessenger();
@ -7007,7 +7007,7 @@ index c373b1929b8bd4ae5ceb899c6c5ea097a6236f8d..061b1dbb92b9ec608ed9f0e2b7d09d49
private final StructureManager structureManager;
protected final DedicatedServer console;
protected final DedicatedPlayerList playerList;
@@ -424,24 +425,7 @@ public final class CraftServer implements Server {
@@ -427,24 +428,7 @@ public final class CraftServer implements Server {
}
public void loadPlugins() {
@ -7033,7 +7033,7 @@ index c373b1929b8bd4ae5ceb899c6c5ea097a6236f8d..061b1dbb92b9ec608ed9f0e2b7d09d49
}
public void enablePlugins(PluginLoadOrder type) {
@@ -530,15 +514,17 @@ public final class CraftServer implements Server {
@@ -533,15 +517,17 @@ public final class CraftServer implements Server {
private void enablePlugin(Plugin plugin) {
try {
List<Permission> perms = plugin.getDescription().getPermissions();
@ -7057,7 +7057,7 @@ index c373b1929b8bd4ae5ceb899c6c5ea097a6236f8d..061b1dbb92b9ec608ed9f0e2b7d09d49
this.pluginManager.enablePlugin(plugin);
} catch (Throwable ex) {
@@ -964,6 +950,7 @@ public final class CraftServer implements Server {
@@ -967,6 +953,7 @@ public final class CraftServer implements Server {
"This plugin is not properly shutting down its async tasks when it is being reloaded. This may cause conflicts with the newly loaded version of the plugin"
));
}
@ -7083,10 +7083,10 @@ index 909b2c98e7a9117d2f737245e4661792ffafb744..d96399e9bf1a58db5a4a22e58abb99e7
@Override
public FileConfiguration getConfig() {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 412dce72064533a260db591a94c8b39eb498331d..0d5202f6bc14bc0cec77f86bed2f1f590e0fffeb 100644
index 83ccadcc7139054e1ba3e1c1f0bf23c67c3c97c8..7546538312dbbd36e014677dce843433cb25d2a9 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -437,6 +437,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -438,6 +438,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
return nmsItemStack.getItem().getDescriptionId(nmsItemStack);
}

View file

@ -698,10 +698,10 @@ index 0000000000000000000000000000000000000000..2f0d9b953802dee821cfde82d22b0567
+ }
+}
diff --git a/src/main/java/net/minecraft/commands/CommandFunction.java b/src/main/java/net/minecraft/commands/CommandFunction.java
index 3ceeddf4c2898172d24db9ee1bab8d6b17e36128..8273ee1c5e513f02c9743ee38c9b7cf700e2ecad 100644
index 0e460de37ac2ae8accbd0d3da73faac6cd7df8e0..956cddf5d975b91619316b9b6779cf51575cfc0a 100644
--- a/src/main/java/net/minecraft/commands/CommandFunction.java
+++ b/src/main/java/net/minecraft/commands/CommandFunction.java
@@ -16,6 +16,15 @@ import net.minecraft.server.ServerFunctionManager;
@@ -32,6 +32,15 @@ import net.minecraft.server.ServerFunctionManager;
public class CommandFunction {
private final CommandFunction.Entry[] entries;
final ResourceLocation id;
@ -718,33 +718,33 @@ index 3ceeddf4c2898172d24db9ee1bab8d6b17e36128..8273ee1c5e513f02c9743ee38c9b7cf7
public CommandFunction(ResourceLocation id, CommandFunction.Entry[] elements) {
this.id = id;
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index fc4dcd801480fe6d89a985de411baa9a3a66f6ef..4a1148a76020089caf01f888f87afdbb35788dc0 100644
index 6f1501e13e29ce25919c23213df53248c4b454d7..047fc7206131e0f36ab45d04e98b7a235431e342 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
@@ -26,7 +26,8 @@ public class PacketUtils {
@@ -28,7 +28,8 @@ public class PacketUtils {
engine.executeIfPossible(() -> {
if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerGamePacketListenerImpl && ((ServerGamePacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590
if (listener.isAcceptingMessages()) {
if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerCommonPacketListenerImpl && ((ServerCommonPacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590
if (listener.shouldHandleMessage(packet)) {
- try {
+ co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings
+ try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings
packet.handle(listener);
} catch (Exception exception) {
if (listener.shouldPropagateHandlingExceptions()) {
if (exception instanceof ReportedException) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 58457e3493100e9726288ae7b027ab47947bd4d4..73c3070b2e300e0ab29ac1db1631023cef7970f8 100644
index b50489d7d506e0ae3e61a8d47b04cc54f95c35db..bacb6e1f1e4faa95490bf5d6d977e9d73bdacef5 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -189,7 +189,7 @@ import org.bukkit.event.player.AsyncPlayerChatPreviewEvent;
@@ -185,7 +185,7 @@ import org.bukkit.craftbukkit.Main;
import org.bukkit.event.server.ServerLoadEvent;
// CraftBukkit end
-import org.bukkit.craftbukkit.SpigotTimings; // Spigot
+import co.aikar.timings.MinecraftTimings; // Paper
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements CommandSource, AutoCloseable {
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements ServerInfo, CommandSource, AutoCloseable {
@@ -860,6 +860,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -845,6 +845,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
MinecraftServer.LOGGER.info("Stopping server");
@ -752,7 +752,7 @@ index 58457e3493100e9726288ae7b027ab47947bd4d4..73c3070b2e300e0ab29ac1db1631023c
// CraftBukkit start
if (this.server != null) {
this.server.disablePlugins();
@@ -1098,9 +1099,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1080,9 +1081,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private boolean haveTime() {
// CraftBukkit start
@ -774,8 +774,8 @@ index 58457e3493100e9726288ae7b027ab47947bd4d4..73c3070b2e300e0ab29ac1db1631023c
private void executeModerately() {
this.runAllTasks();
java.util.concurrent.locks.LockSupport.parkNanos("executing tasks", 1000L);
@@ -1108,9 +1121,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit end
@@ -1090,9 +1103,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
protected void waitUntilNextTick() {
- this.runAllTasks();
@ -786,7 +786,7 @@ index 58457e3493100e9726288ae7b027ab47947bd4d4..73c3070b2e300e0ab29ac1db1631023c
});
}
@@ -1195,9 +1208,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1177,9 +1190,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public void onServerExit() {}
public void tickServer(BooleanSupplier shouldKeepTicking) {
@ -805,7 +805,7 @@ index 58457e3493100e9726288ae7b027ab47947bd4d4..73c3070b2e300e0ab29ac1db1631023c
++this.tickCount;
this.tickChildren(shouldKeepTicking);
if (i - this.lastServerStatus >= 5000000000L) {
@@ -1206,15 +1227,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1188,15 +1209,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
if (this.autosavePeriod > 0 && this.tickCount % this.autosavePeriod == 0) { // CraftBukkit
@ -826,8 +826,8 @@ index 58457e3493100e9726288ae7b027ab47947bd4d4..73c3070b2e300e0ab29ac1db1631023c
this.profiler.push("tallying");
long j = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i;
@@ -1224,8 +1248,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.frameTimer.logFrameDuration(k - i);
@@ -1206,8 +1230,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.logTickTime(k - i);
this.profiler.pop();
org.spigotmc.WatchdogThread.tick(); // Spigot
- SpigotTimings.serverTickTimer.stopTiming(); // Spigot
@ -835,11 +835,11 @@ index 58457e3493100e9726288ae7b027ab47947bd4d4..73c3070b2e300e0ab29ac1db1631023c
+ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper
}
private ServerStatus buildServerStatus() {
@@ -1257,26 +1280,26 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void tickChildren(BooleanSupplier shouldKeepTicking) {
protected void logTickTime(long nanos) {}
@@ -1244,26 +1267,26 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getPlayerList().getPlayers().forEach((entityplayer) -> {
entityplayer.connection.suspendFlushing();
});
- SpigotTimings.schedulerTimer.startTiming(); // Spigot
+ MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Spigot // Paper
this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // CraftBukkit
@ -870,7 +870,7 @@ index 58457e3493100e9726288ae7b027ab47947bd4d4..73c3070b2e300e0ab29ac1db1631023c
// Send time updates to everyone, it will get the right time from the world the player is in.
if (this.tickCount % 20 == 0) {
for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
@@ -1284,7 +1307,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1271,7 +1294,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
}
}
@ -879,7 +879,7 @@ index 58457e3493100e9726288ae7b027ab47947bd4d4..73c3070b2e300e0ab29ac1db1631023c
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
@@ -1330,24 +1353,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1317,24 +1340,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
this.profiler.popPush("connection");
@ -908,23 +908,23 @@ index 58457e3493100e9726288ae7b027ab47947bd4d4..73c3070b2e300e0ab29ac1db1631023c
- SpigotTimings.tickablesTimer.stopTiming(); // Spigot
+ MinecraftTimings.tickablesTimer.stopTiming(); // Spigot // Paper
this.profiler.pop();
}
this.profiler.popPush("send chunks");
iterator = this.playerList.getPlayers().iterator();
diff --git a/src/main/java/net/minecraft/server/ServerFunctionManager.java b/src/main/java/net/minecraft/server/ServerFunctionManager.java
index 009ef03e520aeb57b29b5375a65634ed76aa9163..4a610b712acfe0b1b4dcf4988bc22c6a71616050 100644
index 188ac9b2879d339a268f6c100c23f1dce90c195a..d10abd28c522612934aada8124e5bb67a9b4e9da 100644
--- a/src/main/java/net/minecraft/server/ServerFunctionManager.java
+++ b/src/main/java/net/minecraft/server/ServerFunctionManager.java
@@ -89,7 +89,7 @@ public class ServerFunctionManager {
@@ -97,7 +97,7 @@ public class ServerFunctionManager {
} else {
int i;
- try {
+ try (co.aikar.timings.Timing timing = function.getTiming().startTiming()) { // Paper
this.context = new ServerFunctionManager.ExecutionContext(tracer);
i = this.context.runTopCommand(function, source);
i = this.context.runTopCommand(customfunction1, source);
} finally {
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index cfc4cad33d36e720f32b7ad6d1d4b3983f7aad39..14101c77fd9814a5d1e8e1bf0d8584f42086b051 100644
index ff3f00cf1d5180f83b16acac5676aa22cd967c8a..5aa21689e308842fe5b64689265ba45a299f7ad5 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -58,8 +58,9 @@ import org.apache.logging.log4j.Level;
@ -956,7 +956,7 @@ index cfc4cad33d36e720f32b7ad6d1d4b3983f7aad39..14101c77fd9814a5d1e8e1bf0d8584f4
}
@Override
@@ -671,7 +672,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -676,7 +677,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
}
public String runCommand(RconConsoleSource rconConsoleSource, String s) {
@ -966,7 +966,7 @@ index cfc4cad33d36e720f32b7ad6d1d4b3983f7aad39..14101c77fd9814a5d1e8e1bf0d8584f4
this.executeBlocking(() -> {
CommandSourceStack wrapper = rconConsoleSource.createCommandSourceStack();
RemoteServerCommandEvent event = new RemoteServerCommandEvent(rconConsoleSource.getBukkitSender(wrapper), s);
@@ -679,9 +682,40 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -684,9 +687,40 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
if (event.isCancelled()) {
return;
}
@ -1010,7 +1010,7 @@ index cfc4cad33d36e720f32b7ad6d1d4b3983f7aad39..14101c77fd9814a5d1e8e1bf0d8584f4
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index c943e64d70bab240f8dc733e78a185172664c5e4..a645263f148a25e5b4baeed51775eb8e7f596fe8 100644
index a7c18ca224c536b7b97d5889af321f23e637b420..092e443aa04757fea6d5f5c7b1d11899663c2eb0 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1,8 +1,10 @@
@ -1024,7 +1024,7 @@ index c943e64d70bab240f8dc733e78a185172664c5e4..a645263f148a25e5b4baeed51775eb8e
import com.google.common.collect.Lists;
import com.google.common.collect.Queues;
import com.google.common.collect.Sets;
@@ -886,6 +888,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -882,6 +884,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
ChunkStatus chunkstatus = ChunkLevel.generationStatus(chunkHolder.getTicketLevel());
return !chunkstatus.isOrAfter(ChunkStatus.FULL) ? ChunkHolder.UNLOADED_CHUNK : either.mapLeft((ichunkaccess) -> {
@ -1032,7 +1032,7 @@ index c943e64d70bab240f8dc733e78a185172664c5e4..a645263f148a25e5b4baeed51775eb8e
ChunkPos chunkcoordintpair = chunkHolder.getPos();
ProtoChunk protochunk = (ProtoChunk) ichunkaccess;
LevelChunk chunk;
@@ -910,6 +913,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -906,6 +909,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
return chunk;
@ -1040,7 +1040,7 @@ index c943e64d70bab240f8dc733e78a185172664c5e4..a645263f148a25e5b4baeed51775eb8e
});
}, (runnable) -> {
ProcessorHandle mailbox = this.mainThreadMailbox;
@@ -1465,6 +1469,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1459,6 +1463,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
List<ServerPlayer> list = Lists.newArrayList();
List<ServerPlayer> list1 = this.level.players();
ObjectIterator objectiterator = this.entityMap.values().iterator();
@ -1048,7 +1048,7 @@ index c943e64d70bab240f8dc733e78a185172664c5e4..a645263f148a25e5b4baeed51775eb8e
ChunkMap.TrackedEntity playerchunkmap_entitytracker;
@@ -1489,14 +1494,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1483,14 +1488,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
playerchunkmap_entitytracker.serverEntity.sendChanges();
}
}
@ -1067,7 +1067,7 @@ index c943e64d70bab240f8dc733e78a185172664c5e4..a645263f148a25e5b4baeed51775eb8e
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 5115342b51ccefe4430df47a498bc59b1d96bb0e..6d5a160a9fdaa04bb930afae8a0765910f631d23 100644
index f402341b95c7752a2706edd502098696f786f4ef..b1fd6118132ba38f60d2a2b15c09231fa29be8fa 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -415,13 +415,15 @@ public class ServerChunkCache extends ChunkSource {
@ -1159,7 +1159,7 @@ index 5115342b51ccefe4430df47a498bc59b1d96bb0e..6d5a160a9fdaa04bb930afae8a076591
}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 7be97441aed66fa3a21d13ad2211b3e0e08120c0..7cb5abfa89f842194325d26c6e95b49460c5968f 100644
index e2eff46cae9771931b2e0dfee5e73fd4842e3ab5..988a17cd0b960a07795d999dd125eae3a63d4227 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1,6 +1,8 @@
@ -1179,7 +1179,7 @@ index 7be97441aed66fa3a21d13ad2211b3e0e08120c0..7cb5abfa89f842194325d26c6e95b494
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.generator.CustomWorldChunkManager;
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
@@ -469,7 +470,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -461,7 +462,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.updateSkyBrightness();
this.tickTime();
gameprofilerfiller.popPush("tickPending");
@ -1188,7 +1188,7 @@ index 7be97441aed66fa3a21d13ad2211b3e0e08120c0..7cb5abfa89f842194325d26c6e95b494
if (!this.isDebug()) {
j = this.getGameTime();
gameprofilerfiller.push("blockTicks");
@@ -478,12 +479,16 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -470,12 +471,16 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.fluidTicks.tick(j, 65536, this::tickFluid);
gameprofilerfiller.pop();
}
@ -1206,7 +1206,7 @@ index 7be97441aed66fa3a21d13ad2211b3e0e08120c0..7cb5abfa89f842194325d26c6e95b494
gameprofilerfiller.popPush("blockEvents");
timings.doSounds.startTiming(); // Spigot
this.runBlockEvents();
@@ -667,6 +672,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -625,6 +630,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
gameprofilerfiller.popPush("tickBlocks");
@ -1214,7 +1214,7 @@ index 7be97441aed66fa3a21d13ad2211b3e0e08120c0..7cb5abfa89f842194325d26c6e95b494
if (randomTickSpeed > 0) {
LevelChunkSection[] achunksection = chunk.getSections();
@@ -699,6 +705,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -657,6 +663,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
@ -1222,7 +1222,7 @@ index 7be97441aed66fa3a21d13ad2211b3e0e08120c0..7cb5abfa89f842194325d26c6e95b494
gameprofilerfiller.pop();
}
@@ -933,14 +940,22 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -931,14 +938,22 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
public void tickNonPassenger(Entity entity) {
@ -1246,7 +1246,7 @@ index 7be97441aed66fa3a21d13ad2211b3e0e08120c0..7cb5abfa89f842194325d26c6e95b494
entity.setOldPosAndRot();
ProfilerFiller gameprofilerfiller = this.getProfiler();
@@ -959,7 +974,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -957,7 +972,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.tickPassenger(entity, entity1);
}
@ -1255,7 +1255,7 @@ index 7be97441aed66fa3a21d13ad2211b3e0e08120c0..7cb5abfa89f842194325d26c6e95b494
}
@@ -1001,6 +1016,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -999,6 +1014,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (!savingDisabled) {
org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit
@ -1263,7 +1263,7 @@ index 7be97441aed66fa3a21d13ad2211b3e0e08120c0..7cb5abfa89f842194325d26c6e95b494
if (progressListener != null) {
progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel"));
}
@@ -1010,7 +1026,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1008,7 +1024,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
progressListener.progressStage(Component.translatable("menu.savingChunks"));
}
@ -1275,10 +1275,10 @@ index 7be97441aed66fa3a21d13ad2211b3e0e08120c0..7cb5abfa89f842194325d26c6e95b494
this.entityManager.saveAll();
} else {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 2bcea1af243cc34f98ff3226067f8c16a9ca4010..1fa9b13831638ea2bfd5d3073dc31018083c8b6a 100644
index 92b18f382e91936aad54b083284a393684747d9d..d755ce65ffd22a7f39bb19c547f655f8539b3dbf 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -341,7 +341,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -320,7 +320,6 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void tick() {
@ -1286,7 +1286,7 @@ index 2bcea1af243cc34f98ff3226067f8c16a9ca4010..1fa9b13831638ea2bfd5d3073dc31018
if (this.ackBlockChangesUpTo > -1) {
this.send(new ClientboundBlockChangedAckPacket(this.ackBlockChangesUpTo));
this.ackBlockChangesUpTo = -1;
@@ -422,7 +421,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -387,7 +386,6 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
this.disconnect(Component.translatable("multiplayer.disconnect.idling"));
}
@ -1294,7 +1294,7 @@ index 2bcea1af243cc34f98ff3226067f8c16a9ca4010..1fa9b13831638ea2bfd5d3073dc31018
}
@@ -2143,7 +2141,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2006,7 +2004,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
private void handleCommand(String s) {
@ -1303,7 +1303,7 @@ index 2bcea1af243cc34f98ff3226067f8c16a9ca4010..1fa9b13831638ea2bfd5d3073dc31018
if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot
this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s);
@@ -2153,7 +2151,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2016,7 +2014,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.cserver.getPluginManager().callEvent(event);
if (event.isCancelled()) {
@ -1312,7 +1312,7 @@ index 2bcea1af243cc34f98ff3226067f8c16a9ca4010..1fa9b13831638ea2bfd5d3073dc31018
return;
}
@@ -2166,7 +2164,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2029,7 +2027,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
return;
} finally {
@ -1322,7 +1322,7 @@ index 2bcea1af243cc34f98ff3226067f8c16a9ca4010..1fa9b13831638ea2bfd5d3073dc31018
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index d3dc7752aadf36985660d04dcb4377a69dfeddff..b922654c0b0b1b0d03beb20bb1944b817907f929 100644
index 3b646b86f2b01306618fd2a319307cad4dde9588..b30128b77d2fe8a8c1db9b5746aab537a9a25430 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1,5 +1,6 @@
@ -1332,7 +1332,7 @@ index d3dc7752aadf36985660d04dcb4377a69dfeddff..b922654c0b0b1b0d03beb20bb1944b81
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -1046,10 +1047,11 @@ public abstract class PlayerList {
@@ -1040,10 +1041,11 @@ public abstract class PlayerList {
}
public void saveAll() {
@ -1346,7 +1346,7 @@ index d3dc7752aadf36985660d04dcb4377a69dfeddff..b922654c0b0b1b0d03beb20bb1944b81
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
index 78c7c779209972186b1244fb678d7208b38e30e3..8fdac0e7bb0b9374ebdb82673d0579fff22af5e3 100644
index 6c5000ff3dbb7517d095e9fb2cdf555212b2c090..8b3763ba7f5648c41c5bf8a72e5c801d5483e6e0 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -134,7 +134,6 @@ import org.bukkit.craftbukkit.event.CraftPortalEvent;
@ -1382,10 +1382,10 @@ index 78c7c779209972186b1244fb678d7208b38e30e3..8fdac0e7bb0b9374ebdb82673d0579ff
private boolean isStateClimbable(BlockState state) {
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 1d40d2f70ad72aa392b3699d71f20f69d3820696..93a43ef867d0961b46f9ecadc2c7be6a4b17c72b 100644
index fe7180dfc7ddaac8d60422c072d2e172d669cf57..cea1a8eaae8dfc36efd09e3ac57a7062bf536aac 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -322,6 +322,15 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@@ -323,6 +323,15 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
}
public EntityType(EntityType.EntityFactory<T> factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet<Block> canSpawnInside, EntityDimensions dimensions, int maxTrackDistance, int trackTickInterval, FeatureFlagSet requiredFeatures) {
@ -1401,7 +1401,7 @@ index 1d40d2f70ad72aa392b3699d71f20f69d3820696..93a43ef867d0961b46f9ecadc2c7be6a
this.builtInRegistryHolder = BuiltInRegistries.ENTITY_TYPE.createIntrusiveHolder(this);
this.factory = factory;
this.category = spawnGroup;
@@ -643,6 +652,12 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@@ -644,6 +653,12 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
return this.updateInterval;
}
@ -1414,7 +1414,7 @@ index 1d40d2f70ad72aa392b3699d71f20f69d3820696..93a43ef867d0961b46f9ecadc2c7be6a
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;
}
@@ -748,7 +763,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
@@ -753,7 +768,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
Util.fetchChoiceType(References.ENTITY_TREE, id);
}
@ -1424,7 +1424,7 @@ index 1d40d2f70ad72aa392b3699d71f20f69d3820696..93a43ef867d0961b46f9ecadc2c7be6a
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 861f366e05af1c2bf5bbc8a4e752e3fb675747ae..5bdebdd16939480afac536ce7aaa4fe720021e74 100644
index e24e61a35fe9cffce4a2174d46b88cf934f4b69f..cef17e8165009169f8de21915d2efc8e97aae21f 100644
--- a/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;
@ -1436,7 +1436,7 @@ index 861f366e05af1c2bf5bbc8a4e752e3fb675747ae..5bdebdd16939480afac536ce7aaa4fe7
public abstract class LivingEntity extends Entity implements Attackable {
@@ -2834,7 +2834,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2869,7 +2869,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
@Override
public void tick() {
@ -1444,7 +1444,7 @@ index 861f366e05af1c2bf5bbc8a4e752e3fb675747ae..5bdebdd16939480afac536ce7aaa4fe7
super.tick();
this.updatingUsingItem();
this.updateSwimAmount();
@@ -2876,9 +2875,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2911,9 +2910,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
if (!this.isRemoved()) {
@ -1454,24 +1454,23 @@ index 861f366e05af1c2bf5bbc8a4e752e3fb675747ae..5bdebdd16939480afac536ce7aaa4fe7
}
double d0 = this.getX() - this.xo;
@@ -2960,8 +2957,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (this.isSleeping()) {
this.setXRot(0.0F);
@@ -2997,7 +2994,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
-
this.refreshDirtyAttributes();
- SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot
}
public void detectEquipmentUpdates() {
@@ -3139,7 +3134,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3167,7 +3163,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.setDeltaMovement(d4, d5, d6);
this.setDeltaMovement(d0, d1, d2);
this.level().getProfiler().push("ai");
- SpigotTimings.timerEntityAI.startTiming(); // Spigot
if (this.isImmobile()) {
this.jumping = false;
this.xxa = 0.0F;
@@ -3149,7 +3143,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3177,7 +3172,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.serverAiStep();
this.level().getProfiler().pop();
}
@ -1479,7 +1478,7 @@ index 861f366e05af1c2bf5bbc8a4e752e3fb675747ae..5bdebdd16939480afac536ce7aaa4fe7
this.level().getProfiler().pop();
this.level().getProfiler().push("jump");
@@ -3189,7 +3182,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3217,7 +3211,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.resetFallDistance();
}
@ -1487,7 +1486,7 @@ index 861f366e05af1c2bf5bbc8a4e752e3fb675747ae..5bdebdd16939480afac536ce7aaa4fe7
label104:
{
LivingEntity entityliving = this.getControllingPassenger();
@@ -3205,7 +3197,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3233,7 +3226,6 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.travel(vec3d1);
}
@ -1495,7 +1494,7 @@ index 861f366e05af1c2bf5bbc8a4e752e3fb675747ae..5bdebdd16939480afac536ce7aaa4fe7
this.level().getProfiler().pop();
this.level().getProfiler().push("freezing");
@@ -3232,9 +3223,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3260,9 +3252,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox());
}
@ -1591,7 +1590,7 @@ index c02fa35cefc9194d1838abbe4f2dc2b226a41e41..b300d12e9e00519028b53aca9c3fb01f
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
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
index e4deb276f956c5f292ab8bf7836eeeffd6ed59d5..4185d524f61e87a469d563c938f742f63dad3c2f 100644
index b32e1bba27c91e81b7382072c4d8230db695066c..1e434faaf56f7d1501367c4371131a8da30c0421 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -682,6 +682,7 @@ public class LevelChunk extends ChunkAccess {
@ -1637,10 +1636,10 @@ index 0eb09ce5c850d85ffd7229d27cf06b3e0edda11b..cc1d7626a82881c4410d65c6a33dadae
};
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 061b1dbb92b9ec608ed9f0e2b7d09d498730610d..ccf71eba89afd2f86c6f46b6aebfe25c98f735ed 100644
index 8c32ad9cbbe8bc9693493eee97834aaf20633ed7..71a0bad7402ec1ba48dcecb875fcad294af0f70e 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -374,7 +374,7 @@ public final class CraftServer implements Server {
@@ -377,7 +377,7 @@ public final class CraftServer implements Server {
this.saveCommandsConfig();
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
@ -1649,7 +1648,7 @@ index 061b1dbb92b9ec608ed9f0e2b7d09d498730610d..ccf71eba89afd2f86c6f46b6aebfe25c
this.overrideSpawnLimits();
console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
@@ -2450,12 +2450,31 @@ public final class CraftServer implements Server {
@@ -2453,12 +2453,31 @@ public final class CraftServer implements Server {
private final org.bukkit.Server.Spigot spigot = new org.bukkit.Server.Spigot()
{
@ -1851,10 +1850,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
index 5afd9ccf2eef614da52ec82d3972a49722e46321..f76db40188007b6ab475d259b4cbe0c7ef804677 100644
index 0a945ed432b431ec6c714cccf45f4e09756c7b1a..30e77f21bfc017a6a715ea1ff0ffddea0b260ac5 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2550,6 +2550,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2566,6 +2566,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
CraftPlayer.this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(components, position == net.md_5.bungee.api.ChatMessageType.ACTION_BAR));
}
@ -2051,10 +2050,10 @@ index f97eccb6a17c7876e1e002d798eb67bbe80571a0..76effc345d362047e64d064eb64a5222
+ } // Paper
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 0d5202f6bc14bc0cec77f86bed2f1f590e0fffeb..3a7a498003d70cf9e31acffee70b23dec0be6845 100644
index 7546538312dbbd36e014677dce843433cb25d2a9..a638d67f9ab67c6564b3c44c6971d98995bdb203 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -224,6 +224,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -225,6 +225,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end
// ========================================================================
@ -2067,7 +2066,7 @@ index 0d5202f6bc14bc0cec77f86bed2f1f590e0fffeb..3a7a498003d70cf9e31acffee70b23de
public static byte toLegacyData(BlockState data) {
return CraftLegacy.toLegacyData(data);
@@ -450,6 +456,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -451,6 +457,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
return CraftFeatureFlag.getFromNMS(namespacedKey);
}