From ffccfd5488386d18b2e11990eba6bb3c31796a16 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Tue, 23 Apr 2024 14:04:59 -0700 Subject: [PATCH] Apply timings --- .../server/0025-Timings-v2.patch | 222 ++++++++---------- 1 file changed, 104 insertions(+), 118 deletions(-) rename patches/{unapplied => }/server/0025-Timings-v2.patch (92%) diff --git a/patches/unapplied/server/0025-Timings-v2.patch b/patches/server/0025-Timings-v2.patch similarity index 92% rename from patches/unapplied/server/0025-Timings-v2.patch rename to patches/server/0025-Timings-v2.patch index b26cda4bf9..60b6a5bb6b 100644 --- a/patches/unapplied/server/0025-Timings-v2.patch +++ b/patches/server/0025-Timings-v2.patch @@ -700,10 +700,10 @@ index 0000000000000000000000000000000000000000..2f0d9b953802dee821cfde82d22b0567 + } +} diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java -index c8134e605e2dd58c2af1cbefc5e20e91b6414d2a..b7ffab0284b0bccd79775b8d03c8b2e088f91d1d 100644 +index 73e7bb59596600df1b1953175f6da17bee54a65c..e161ad0f53a21a68e8c78575ba5d3cdbdb11fca0 100644 --- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java +++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java -@@ -29,7 +29,8 @@ public class PacketUtils { +@@ -30,7 +30,8 @@ public class PacketUtils { engine.executeIfPossible(() -> { if (listener instanceof ServerCommonPacketListenerImpl serverCommonPacketListener && serverCommonPacketListener.processedDisconnect) return; // CraftBukkit - Don't handle sync packets for kicked players if (listener.shouldHandleMessage(packet)) { @@ -712,12 +712,12 @@ index c8134e605e2dd58c2af1cbefc5e20e91b6414d2a..b7ffab0284b0bccd79775b8d03c8b2e0 + try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings packet.handle(listener); } catch (Exception exception) { - label25: + 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 00a1806720e67eb747061e0a6c2ea334dd4453ce..2be50609ccf90d3db6e572377ba63bcbad156382 100644 +index e021ac312127e0544606ab466cab781915e027d2..7ae4d4feb5c9281fa62a3f35c39eefdff1b684d8 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -186,7 +186,7 @@ import org.bukkit.craftbukkit.Main; +@@ -190,7 +190,7 @@ import org.bukkit.craftbukkit.Main; import org.bukkit.event.server.ServerLoadEvent; // CraftBukkit end @@ -726,7 +726,7 @@ index 00a1806720e67eb747061e0a6c2ea334dd4453ce..2be50609ccf90d3db6e572377ba63bcb public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements ServerInfo, CommandSource, AutoCloseable { -@@ -891,6 +891,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.ticksUntilAutosave <= 0) { this.ticksUntilAutosave = this.autosavePeriod; // CraftBukkit end @@ -808,8 +808,8 @@ index 00a1806720e67eb747061e0a6c2ea334dd4453ce..2be50609ccf90d3db6e572377ba63bcb this.profiler.push("tallying"); long j = Util.getNanos() - i; int k = this.tickCount % 100; -@@ -1277,8 +1301,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { entityplayer.connection.suspendFlushing(); }); @@ -852,7 +852,7 @@ index 00a1806720e67eb747061e0a6c2ea334dd4453ce..2be50609ccf90d3db6e572377ba63bcb // 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) { -@@ -1367,7 +1390,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { CommandSourceStack wrapper = rconConsoleSource.createCommandSourceStack(); RemoteServerCommandEvent event = new RemoteServerCommandEvent(rconConsoleSource.getBukkitSender(wrapper), s); -@@ -684,9 +687,39 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -716,9 +719,39 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface if (event.isCancelled()) { return; } @@ -976,7 +978,7 @@ index 4917aa64505870a0521bc09ce4d4d3e37c03eaae..65dbd05fa904eb8f0f0ef5d3fc3c1e88 // 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 8908511590adab6025ff02928591aa3cce4e480e..97bb0fc7e890273f2f975f137ec1194a1a83fde7 100644 +index 3eb7dfd79cdf2824b2155d02d1b4c91bab3c7b33..eaa1584a70ff79e22f7b400fb04ab37786a47467 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 @@ @@ -990,23 +992,7 @@ index 8908511590adab6025ff02928591aa3cce4e480e..97bb0fc7e890273f2f975f137ec1194a import com.google.common.collect.Lists; import com.google.common.collect.Queues; import com.google.common.collect.Sets; -@@ -892,6 +894,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) -> { -+ try (Timing ignored = level.timings.chunkPostLoad.startTimingIfSync()) { // Paper - ChunkPos chunkcoordintpair = chunkHolder.getPos(); - ProtoChunk protochunk = (ProtoChunk) ichunkaccess; - LevelChunk chunk; -@@ -916,6 +919,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - } - - return chunk; -+ } // Paper - }); - }, (runnable) -> { - ProcessorHandle mailbox = this.mainThreadMailbox; -@@ -1467,6 +1471,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1482,6 +1484,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider List list = Lists.newArrayList(); List list1 = this.level.players(); ObjectIterator objectiterator = this.entityMap.values().iterator(); @@ -1014,7 +1000,7 @@ index 8908511590adab6025ff02928591aa3cce4e480e..97bb0fc7e890273f2f975f137ec1194a ChunkMap.TrackedEntity playerchunkmap_entitytracker; -@@ -1491,14 +1496,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1506,14 +1509,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider playerchunkmap_entitytracker.serverEntity.sendChanges(); } } @@ -1033,15 +1019,15 @@ index 8908511590adab6025ff02928591aa3cce4e480e..97bb0fc7e890273f2f975f137ec1194a } diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 2c4727bf4571e1596bb0696b25104155f6302065..e0ae7274da59ff043cd423d282ed8db0382561d4 100644 +index 23c39b78486b018e222af489c8edbf4e749abff6..3f60a3289ec58d5eb3c0c5634ca62ef2fa287ce7 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -271,13 +271,15 @@ public class ServerChunkCache extends ChunkSource { +@@ -268,13 +268,15 @@ public class ServerChunkCache extends ChunkSource { } gameprofilerfiller.incrementCounter("getChunkCacheMiss"); - this.level.timings.syncChunkLoadTimer.startTiming(); // Spigot - CompletableFuture> completablefuture = this.getChunkFutureMainThread(x, z, leastStatus, create); + CompletableFuture> completablefuture = this.getChunkFutureMainThread(x, z, leastStatus, create); ServerChunkCache.MainThreadExecutor chunkproviderserver_b = this.mainThreadProcessor; Objects.requireNonNull(completablefuture); @@ -1051,10 +1037,10 @@ index 2c4727bf4571e1596bb0696b25104155f6302065..e0ae7274da59ff043cd423d282ed8db0 - this.level.timings.syncChunkLoadTimer.stopTiming(); // Spigot + this.level.timings.syncChunkLoad.stopTiming(); // Paper + } // Paper - ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { - return ichunkaccess1; - }, (playerchunk_failure) -> { -@@ -476,7 +478,9 @@ public class ServerChunkCache extends ChunkSource { + ChunkResult chunkresult = (ChunkResult) completablefuture.join(); + ChunkAccess ichunkaccess1 = (ChunkAccess) chunkresult.orElse(null); // CraftBukkit - decompile error + +@@ -463,7 +465,9 @@ public class ServerChunkCache extends ChunkSource { public void save(boolean flush) { this.runDistanceManagerUpdates(); @@ -1064,7 +1050,7 @@ index 2c4727bf4571e1596bb0696b25104155f6302065..e0ae7274da59ff043cd423d282ed8db0 } @Override -@@ -515,10 +519,10 @@ public class ServerChunkCache extends ChunkSource { +@@ -505,10 +509,10 @@ public class ServerChunkCache extends ChunkSource { this.level.timings.doChunkMap.stopTiming(); // Spigot this.level.getProfiler().popPush("chunks"); if (tickChunks) { @@ -1077,7 +1063,7 @@ index 2c4727bf4571e1596bb0696b25104155f6302065..e0ae7274da59ff043cd423d282ed8db0 } this.level.timings.doChunkUnload.startTiming(); // Spigot -@@ -541,6 +545,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -531,6 +535,7 @@ public class ServerChunkCache extends ChunkSource { gameprofilerfiller.push("filteringLoadedChunks"); List list = Lists.newArrayListWithCapacity(this.chunkMap.size()); Iterator iterator = this.chunkMap.getChunks().iterator(); @@ -1085,9 +1071,9 @@ index 2c4727bf4571e1596bb0696b25104155f6302065..e0ae7274da59ff043cd423d282ed8db0 while (iterator.hasNext()) { ChunkHolder playerchunk = (ChunkHolder) iterator.next(); -@@ -553,8 +558,10 @@ public class ServerChunkCache extends ChunkSource { +@@ -543,8 +548,10 @@ public class ServerChunkCache extends ChunkSource { - if (this.level.getServer().tickRateManager().runsNormally()) { + if (this.level.tickRateManager().runsNormally()) { gameprofilerfiller.popPush("naturalSpawnCount"); + this.level.timings.countNaturalMobs.startTiming(); // Paper - timings int k = this.distanceManager.getNaturalSpawnChunkCount(); @@ -1096,7 +1082,7 @@ index 2c4727bf4571e1596bb0696b25104155f6302065..e0ae7274da59ff043cd423d282ed8db0 this.lastSpawnState = spawnercreature_d; gameprofilerfiller.popPush("spawnAndTick"); -@@ -577,22 +584,25 @@ public class ServerChunkCache extends ChunkSource { +@@ -567,22 +574,25 @@ public class ServerChunkCache extends ChunkSource { } if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { @@ -1125,7 +1111,7 @@ index 2c4727bf4571e1596bb0696b25104155f6302065..e0ae7274da59ff043cd423d282ed8db0 gameprofilerfiller.pop(); gameprofilerfiller.pop(); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 9ea829aafa7a874a784d02da889576c80de17d0c..13725b794e923a4de0d06edcba1adf1b04611c95 100644 +index 2567f0d6060c29c75ba8d4331ec51ad0f3a51883..bbc55b349c338d07646e1449804170799bfa434b 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 @@ @@ -1137,15 +1123,15 @@ index 9ea829aafa7a874a784d02da889576c80de17d0c..13725b794e923a4de0d06edcba1adf1b import com.google.common.collect.Lists; import com.mojang.datafixers.DataFixer; import com.mojang.datafixers.util.Pair; -@@ -167,7 +169,6 @@ import org.slf4j.Logger; +@@ -172,7 +174,6 @@ import net.minecraft.world.ticks.LevelTicks; + import org.slf4j.Logger; import org.bukkit.Bukkit; - import org.bukkit.Location; import org.bukkit.WeatherType; -import org.bukkit.craftbukkit.SpigotTimings; // Spigot import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.generator.CustomWorldChunkManager; - import org.bukkit.craftbukkit.util.CraftNamespacedKey; -@@ -471,7 +472,7 @@ public class ServerLevel extends Level implements WorldGenLevel { + import org.bukkit.craftbukkit.util.WorldUUID; +@@ -477,7 +478,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } gameprofilerfiller.popPush("tickPending"); @@ -1154,7 +1140,7 @@ index 9ea829aafa7a874a784d02da889576c80de17d0c..13725b794e923a4de0d06edcba1adf1b if (!this.isDebug() && flag) { j = this.getGameTime(); gameprofilerfiller.push("blockTicks"); -@@ -480,15 +481,19 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -486,15 +487,19 @@ public class ServerLevel extends Level implements WorldGenLevel { this.fluidTicks.tick(j, 65536, this::tickFluid); gameprofilerfiller.pop(); } @@ -1175,7 +1161,7 @@ index 9ea829aafa7a874a784d02da889576c80de17d0c..13725b794e923a4de0d06edcba1adf1b gameprofilerfiller.popPush("blockEvents"); if (flag) { this.timings.doSounds.startTiming(); // Spigot -@@ -641,6 +646,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -647,6 +652,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } gameprofilerfiller.popPush("tickBlocks"); @@ -1183,7 +1169,7 @@ index 9ea829aafa7a874a784d02da889576c80de17d0c..13725b794e923a4de0d06edcba1adf1b if (randomTickSpeed > 0) { LevelChunkSection[] achunksection = chunk.getSections(); -@@ -673,6 +679,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -679,6 +685,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } } @@ -1191,7 +1177,7 @@ index 9ea829aafa7a874a784d02da889576c80de17d0c..13725b794e923a4de0d06edcba1adf1b gameprofilerfiller.pop(); } -@@ -949,14 +956,22 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -955,14 +962,22 @@ public class ServerLevel extends Level implements WorldGenLevel { } public void tickNonPassenger(Entity entity) { @@ -1215,7 +1201,7 @@ index 9ea829aafa7a874a784d02da889576c80de17d0c..13725b794e923a4de0d06edcba1adf1b entity.setOldPosAndRot(); ProfilerFiller gameprofilerfiller = this.getProfiler(); -@@ -975,7 +990,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -981,7 +996,7 @@ public class ServerLevel extends Level implements WorldGenLevel { this.tickPassenger(entity, entity1); } @@ -1224,7 +1210,7 @@ index 9ea829aafa7a874a784d02da889576c80de17d0c..13725b794e923a4de0d06edcba1adf1b } -@@ -1017,6 +1032,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1023,6 +1038,7 @@ public class ServerLevel extends Level implements WorldGenLevel { if (!savingDisabled) { org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(this.getWorld())); // CraftBukkit @@ -1232,7 +1218,7 @@ index 9ea829aafa7a874a784d02da889576c80de17d0c..13725b794e923a4de0d06edcba1adf1b if (progressListener != null) { progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel")); } -@@ -1026,7 +1042,10 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1032,7 +1048,10 @@ public class ServerLevel extends Level implements WorldGenLevel { progressListener.progressStage(Component.translatable("menu.savingChunks")); } @@ -1244,10 +1230,10 @@ index 9ea829aafa7a874a784d02da889576c80de17d0c..13725b794e923a4de0d06edcba1adf1b 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 c51e38bb683d239d6116075b5a613b5ef709056a..0b09b4adefdaba43949b1a83dc8f89af147924e9 100644 +index ad965076a31b947afc65fdf3a03972f407235e92..4a37313ea0f2253f377ea5d0d2c2d7b66c599ffe 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -322,7 +322,6 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -336,7 +336,6 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void tick() { @@ -1255,7 +1241,7 @@ index c51e38bb683d239d6116075b5a613b5ef709056a..0b09b4adefdaba43949b1a83dc8f89af if (this.ackBlockChangesUpTo > -1) { this.send(new ClientboundBlockChangedAckPacket(this.ackBlockChangesUpTo)); this.ackBlockChangesUpTo = -1; -@@ -389,7 +388,6 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -403,7 +402,6 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854 this.disconnect(Component.translatable("multiplayer.disconnect.idling")); } @@ -1263,7 +1249,7 @@ index c51e38bb683d239d6116075b5a613b5ef709056a..0b09b4adefdaba43949b1a83dc8f89af } -@@ -2020,7 +2018,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2092,7 +2090,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } private void handleCommand(String s) { @@ -1272,7 +1258,7 @@ index c51e38bb683d239d6116075b5a613b5ef709056a..0b09b4adefdaba43949b1a83dc8f89af if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s); -@@ -2030,7 +2028,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2102,7 +2100,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.cserver.getPluginManager().callEvent(event); if (event.isCancelled()) { @@ -1281,7 +1267,7 @@ index c51e38bb683d239d6116075b5a613b5ef709056a..0b09b4adefdaba43949b1a83dc8f89af return; } -@@ -2043,7 +2041,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2115,7 +2113,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); return; } finally { @@ -1291,7 +1277,7 @@ index c51e38bb683d239d6116075b5a613b5ef709056a..0b09b4adefdaba43949b1a83dc8f89af } // 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 5e00df1cd2b8a6691b2f9490b1f4c3ed4d6a988a..72488b0d499e4e0d0ccba38622cc5a3f88a9e3fa 100644 +index dbb5b333930ce401d36f7d18880d103c9ef2f98e..e8377a2301e0e6c560a304ecd93dc1f90ee474eb 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 @@ @@ -1301,7 +1287,7 @@ index 5e00df1cd2b8a6691b2f9490b1f4c3ed4d6a988a..72488b0d499e4e0d0ccba38622cc5a3f import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -@@ -1040,10 +1041,11 @@ public abstract class PlayerList { +@@ -1038,10 +1039,11 @@ public abstract class PlayerList { } public void saveAll() { @@ -1315,10 +1301,10 @@ index 5e00df1cd2b8a6691b2f9490b1f4c3ed4d6a988a..72488b0d499e4e0d0ccba38622cc5a3f 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 17e489c4650ba421a993c863426f1a2084d44fb0..360e322ee298048bd280160a49f000384d930c3a 100644 +index 9c54bc3897d1fa3c88a5a7d55224eb4cc97f4e79..09ce9511f52f7f8643fedc325c49580eba4e4645 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -135,7 +135,6 @@ import org.bukkit.craftbukkit.event.CraftPortalEvent; +@@ -138,7 +138,6 @@ import org.bukkit.craftbukkit.event.CraftPortalEvent; import org.bukkit.entity.Hanging; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Vehicle; @@ -1326,7 +1312,7 @@ index 17e489c4650ba421a993c863426f1a2084d44fb0..360e322ee298048bd280160a49f00038 import org.bukkit.event.entity.EntityCombustByEntityEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; -@@ -315,7 +314,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -317,7 +316,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess // Marks an entity, that it was removed by a plugin via Entity#remove // Main use case currently is for SPIGOT-7487, preventing dropping of leash when leash is removed public boolean pluginRemoved = false; @@ -1334,7 +1320,7 @@ index 17e489c4650ba421a993c863426f1a2084d44fb0..360e322ee298048bd280160a49f00038 // Spigot start public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; -@@ -823,7 +821,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -834,7 +832,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public void move(MoverType movementType, Vec3 movement) { @@ -1342,7 +1328,7 @@ index 17e489c4650ba421a993c863426f1a2084d44fb0..360e322ee298048bd280160a49f00038 if (this.noPhysics) { this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z); } else { -@@ -984,7 +981,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -995,7 +992,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.level().getProfiler().pop(); } } @@ -1351,17 +1337,17 @@ index 17e489c4650ba421a993c863426f1a2084d44fb0..360e322ee298048bd280160a49f00038 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 c4bc491eed487c0a7e30538b0fb46fde91cd7b31..382b55167dede435b034866bd394455f0f6f2a00 100644 +index 4bdd6529dfc7f51c8e58e93cf140025ed8a4e44f..5e31d2799c299e5c3d4c02871f785179a2422323 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -327,6 +327,15 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -339,6 +339,15 @@ public class EntityType implements FeatureElement, EntityTypeT } - public EntityType(EntityType.EntityFactory factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet canSpawnInside, EntityDimensions dimensions, int maxTrackDistance, int trackTickInterval, FeatureFlagSet requiredFeatures) { + public EntityType(EntityType.EntityFactory factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet canSpawnInside, EntityDimensions dimensions, float spawnBoxScale, int maxTrackDistance, int trackTickInterval, FeatureFlagSet requiredFeatures) { + // Paper start -+ this(factory, spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnInside, dimensions, maxTrackDistance, trackTickInterval, requiredFeatures, "custom"); ++ this(factory, spawnGroup, saveable, summonable, fireImmune, spawnableFarFromPlayer, canSpawnInside, dimensions, spawnBoxScale, maxTrackDistance, trackTickInterval, requiredFeatures, "custom"); + } -+ public EntityType(EntityType.EntityFactory factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet canSpawnInside, EntityDimensions dimensions, int maxTrackDistance, int trackTickInterval, FeatureFlagSet requiredFeatures, String id) { ++ public EntityType(EntityType.EntityFactory factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet canSpawnInside, EntityDimensions dimensions, float spawnBoxScale, int maxTrackDistance, int trackTickInterval, FeatureFlagSet requiredFeatures, String id) { + this.tickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "tick"); + this.inactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "inactiveTick"); + this.passengerTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerTick"); @@ -1370,7 +1356,7 @@ index c4bc491eed487c0a7e30538b0fb46fde91cd7b31..382b55167dede435b034866bd394455f this.builtInRegistryHolder = BuiltInRegistries.ENTITY_TYPE.createIntrusiveHolder(this); this.factory = factory; this.category = spawnGroup; -@@ -648,6 +657,12 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -654,6 +663,12 @@ public class EntityType implements FeatureElement, EntityTypeT return this.updateInterval; } @@ -1383,20 +1369,20 @@ index c4bc491eed487c0a7e30538b0fb46fde91cd7b31..382b55167dede435b034866bd394455f 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; } -@@ -757,7 +772,7 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -823,7 +838,7 @@ public class EntityType implements FeatureElement, EntityTypeT Util.fetchChoiceType(References.ENTITY_TREE, id); } -- return new EntityType<>(this.factory, this.category, this.serialize, this.summon, this.fireImmune, this.canSpawnFarFromPlayer, this.immuneTo, this.dimensions, this.clientTrackingRange, this.updateInterval, this.requiredFeatures); -+ return new EntityType<>(this.factory, this.category, this.serialize, this.summon, this.fireImmune, this.canSpawnFarFromPlayer, this.immuneTo, this.dimensions, this.clientTrackingRange, this.updateInterval, this.requiredFeatures, id); // Paper - add id +- return new EntityType<>(this.factory, this.category, this.serialize, this.summon, this.fireImmune, this.canSpawnFarFromPlayer, this.immuneTo, this.dimensions.withAttachments(this.attachments), this.spawnDimensionsScale, this.clientTrackingRange, this.updateInterval, this.requiredFeatures); ++ return new EntityType<>(this.factory, this.category, this.serialize, this.summon, this.fireImmune, this.canSpawnFarFromPlayer, this.immuneTo, this.dimensions.withAttachments(this.attachments), this.spawnDimensionsScale, this.clientTrackingRange, this.updateInterval, this.requiredFeatures, id); // Paper - add id } } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index cdac785c54e150c0886046b8d50657c0ca958438..13e8502640abad928282e4b1596f2ad97b4db765 100644 +index dcf53dbecc1873994b171cfd1eb313545d6cfdcd..e72ca3af948aa223e6ef31bb0972dd036c8f7c2d 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -142,7 +142,7 @@ import org.bukkit.event.entity.EntityTeleportEvent; +@@ -149,7 +149,7 @@ import org.bukkit.event.entity.EntityTeleportEvent; import org.bukkit.event.player.PlayerItemConsumeEvent; // CraftBukkit end @@ -1405,7 +1391,7 @@ index cdac785c54e150c0886046b8d50657c0ca958438..13e8502640abad928282e4b1596f2ad9 public abstract class LivingEntity extends Entity implements Attackable { -@@ -2887,7 +2887,6 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -2945,7 +2945,6 @@ public abstract class LivingEntity extends Entity implements Attackable { @Override public void tick() { @@ -1413,7 +1399,7 @@ index cdac785c54e150c0886046b8d50657c0ca958438..13e8502640abad928282e4b1596f2ad9 super.tick(); this.updatingUsingItem(); this.updateSwimAmount(); -@@ -2929,9 +2928,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -2987,9 +2986,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } if (!this.isRemoved()) { @@ -1423,15 +1409,15 @@ index cdac785c54e150c0886046b8d50657c0ca958438..13e8502640abad928282e4b1596f2ad9 } double d0 = this.getX() - this.xo; -@@ -3015,7 +3012,6 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3080,7 +3077,6 @@ public abstract class LivingEntity extends Entity implements Attackable { + this.refreshDimensions(); } - this.refreshDirtyAttributes(); - SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot } public void detectEquipmentUpdatesPublic() { // CraftBukkit -@@ -3190,7 +3186,6 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3279,7 +3275,6 @@ public abstract class LivingEntity extends Entity implements Attackable { this.setDeltaMovement(d0, d1, d2); this.level().getProfiler().push("ai"); @@ -1439,7 +1425,7 @@ index cdac785c54e150c0886046b8d50657c0ca958438..13e8502640abad928282e4b1596f2ad9 if (this.isImmobile()) { this.jumping = false; this.xxa = 0.0F; -@@ -3200,7 +3195,6 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3289,7 +3284,6 @@ public abstract class LivingEntity extends Entity implements Attackable { this.serverAiStep(); this.level().getProfiler().pop(); } @@ -1447,7 +1433,7 @@ index cdac785c54e150c0886046b8d50657c0ca958438..13e8502640abad928282e4b1596f2ad9 this.level().getProfiler().pop(); this.level().getProfiler().push("jump"); -@@ -3240,7 +3234,6 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3329,7 +3323,6 @@ public abstract class LivingEntity extends Entity implements Attackable { this.resetFallDistance(); } @@ -1455,7 +1441,7 @@ index cdac785c54e150c0886046b8d50657c0ca958438..13e8502640abad928282e4b1596f2ad9 label104: { LivingEntity entityliving = this.getControllingPassenger(); -@@ -3256,7 +3249,6 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3343,7 +3336,6 @@ public abstract class LivingEntity extends Entity implements Attackable { this.travel(vec3d1); } @@ -1463,7 +1449,7 @@ index cdac785c54e150c0886046b8d50657c0ca958438..13e8502640abad928282e4b1596f2ad9 this.level().getProfiler().pop(); this.level().getProfiler().push("freezing"); -@@ -3283,9 +3275,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3370,9 +3362,7 @@ public abstract class LivingEntity extends Entity implements Attackable { this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox()); } @@ -1474,18 +1460,18 @@ index cdac785c54e150c0886046b8d50657c0ca958438..13e8502640abad928282e4b1596f2ad9 if (!this.level().isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { this.hurt(this.damageSources().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 -index bede1a64e4f04aa8e87ddb44f2cc4a1ab46a3b81..d02cc220c8bd59a1289f34fd9fb70a00b0fbc07a 100644 +index 68715d9fd69addad07384efa10eeb09bc78c1e28..5f881af95bd5ee94daadfd9e5d64ee6d411255c4 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -91,7 +91,6 @@ import org.bukkit.Bukkit; - import org.bukkit.Location; +@@ -92,7 +92,6 @@ import net.minecraft.network.protocol.game.ClientboundSetBorderWarningDistancePa + import org.bukkit.Bukkit; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; -import org.bukkit.craftbukkit.SpigotTimings; // Spigot import org.bukkit.craftbukkit.block.CapturedBlockState; import org.bukkit.craftbukkit.block.CraftBlockState; import org.bukkit.craftbukkit.block.data.CraftBlockData; -@@ -166,7 +165,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -163,7 +162,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { } // Paper end - add paper world config @@ -1494,7 +1480,7 @@ index bede1a64e4f04aa8e87ddb44f2cc4a1ab46a3b81..d02cc220c8bd59a1289f34fd9fb70a00 public static BlockPos lastPhysicsProblem; // Spigot private org.spigotmc.TickLimiter entityLimiter; private org.spigotmc.TickLimiter tileLimiter; -@@ -264,7 +263,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -258,7 +257,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public void onBorderSetDamageSafeZOne(WorldBorder border, double safeZoneRadius) {} }); // CraftBukkit end @@ -1503,7 +1489,7 @@ index bede1a64e4f04aa8e87ddb44f2cc4a1ab46a3b81..d02cc220c8bd59a1289f34fd9fb70a00 this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime); } -@@ -726,15 +725,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -718,15 +717,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable { this.timings.tileEntityTick.stopTiming(); // Spigot this.tickingBlockEntities = false; @@ -1521,7 +1507,7 @@ index bede1a64e4f04aa8e87ddb44f2cc4a1ab46a3b81..d02cc220c8bd59a1289f34fd9fb70a00 CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking entity"); CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being ticked"); 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 74f380afac8a91cd1d2bbd3cd679f0eaee53fdee..756a8ae14ffc46d6ebe0a858a03fb2e89b8e118a 100644 +index 991ebf07bc0608df0a12f1f26e581cc93255ae01..946001c57c326f2d2f0677bca954e8558f1c851b 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java @@ -89,6 +89,15 @@ public class Block extends BlockBehaviour implements ItemLike { @@ -1541,10 +1527,10 @@ index 74f380afac8a91cd1d2bbd3cd679f0eaee53fdee..756a8ae14ffc46d6ebe0a858a03fb2e8 private String descriptionId; @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 -index c02fa35cefc9194d1838abbe4f2dc2b226a41e41..b300d12e9e00519028b53aca9c3fb01f589eaa91 100644 +index 09ae9c3398e77ee575636a4ebe9e31b447c9fb8e..6eef8da8ead8a044aac757693d719ceea431515e 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java -@@ -22,10 +22,12 @@ import org.bukkit.inventory.InventoryHolder; +@@ -33,10 +33,12 @@ import org.bukkit.inventory.InventoryHolder; // CraftBukkit end import org.spigotmc.CustomTimingsHandler; // Spigot @@ -1559,7 +1545,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 409007f6e6940e5ea92e3cbaa74e55cdee50325b..c2179ea2a16ae0fac0b59d81a57abf13f563843f 100644 +index bb0f16aef406bdc627e1263859dd4637bec90c63..55b24bf21dce3ab00c19a73b3af797ac1fd2ccc7 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -698,6 +698,7 @@ public class LevelChunk extends ChunkAccess { @@ -1579,10 +1565,10 @@ index 409007f6e6940e5ea92e3cbaa74e55cdee50325b..c2179ea2a16ae0fac0b59d81a57abf13 } } 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 fff1a2f2b8b5235c0c56c68264db0a914f6cb15d..ba7a816bd9dd4aec79e2560f0968374dbb28442c 100644 +index 8199fd0a50e0f7d2e1f2a14ac525bc6bd9feeac4..b0518725a2e145d29bd5bc0aa7e6998a47dcb511 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -483,13 +483,10 @@ public class ChunkSerializer { +@@ -471,13 +471,10 @@ public class ChunkSerializer { ListTag nbttaglist1 = ChunkSerializer.getListOfCompoundsOrNull(nbt, "block_entities"); return nbttaglist == null && nbttaglist1 == null ? null : (chunk) -> { @@ -1596,7 +1582,7 @@ index fff1a2f2b8b5235c0c56c68264db0a914f6cb15d..ba7a816bd9dd4aec79e2560f0968374d if (nbttaglist1 != null) { for (int i = 0; i < nbttaglist1.size(); ++i) { CompoundTag nbttagcompound1 = nbttaglist1.getCompound(i); -@@ -507,7 +504,6 @@ public class ChunkSerializer { +@@ -495,7 +492,6 @@ public class ChunkSerializer { } } } @@ -1605,7 +1591,7 @@ index fff1a2f2b8b5235c0c56c68264db0a914f6cb15d..ba7a816bd9dd4aec79e2560f0968374d }; } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 7bd9abe9166df3d120fe6580407a04f68279c55f..13b33785e13d5f9cc659dc48e5fea6451ca778fc 100644 +index 6573e72d041714ccc2bf0e3c8734bc212caf534e..7d2bb67867836e8f74b0583d36aed3966be8ed7d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -370,7 +370,7 @@ public final class CraftServer implements Server { @@ -1617,7 +1603,7 @@ index 7bd9abe9166df3d120fe6580407a04f68279c55f..13b33785e13d5f9cc659dc48e5fea645 this.overrideSpawnLimits(); console.autosavePeriod = this.configuration.getInt("ticks-per.autosave"); this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose")); -@@ -2557,12 +2557,31 @@ public final class CraftServer implements Server { +@@ -2580,12 +2580,31 @@ public final class CraftServer implements Server { private final org.bukkit.Server.Spigot spigot = new org.bukkit.Server.Spigot() { @@ -1819,10 +1805,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 e87f36d8aa86b9ac9ccc234f7b51a4a51bff2426..2da161b901189c3dcf90c95a074b8c2cbf30f282 100644 +index 906b2a900977026389ce783968d2de8709cf3b97..14f86623be9f27b4c2507a33e0bddce50c7eccf4 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2701,6 +2701,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2769,6 +2769,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)); } @@ -2019,10 +2005,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 ea994c34e1ca725eae4d05223fc09fc1308b0730..d72e6ebc8b7b002279ba61c30b5a42f8cd5b3b7b 100644 +index 29698be6e4990769cbe1c00088dfb9cfc73d966a..b1c07c945758e4cf4af86caa1dda47688feba849 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -214,6 +214,12 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -213,6 +213,12 @@ public final class CraftMagicNumbers implements UnsafeValues { } // Paper end // ======================================================================== @@ -2035,7 +2021,7 @@ index ea994c34e1ca725eae4d05223fc09fc1308b0730..d72e6ebc8b7b002279ba61c30b5a42f8 public static byte toLegacyData(BlockState data) { return CraftLegacy.toLegacyData(data); -@@ -462,6 +468,12 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -459,6 +465,12 @@ public final class CraftMagicNumbers implements UnsafeValues { public DamageSource.Builder createDamageSourceBuilder(DamageType damageType) { return new CraftDamageSourceBuilder(damageType); }