From 456621b0d702cc0e0bb24b1ac35e883646af8844 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Tue, 23 Nov 2021 12:27:39 +0100 Subject: [PATCH] More work --- .../{unapplied => }/api/0007-Adventure.patch | 0 .../0008-Player-affects-spawning-API.patch | 2 +- patches/server/0006-MC-Utils.patch | 17 +- patches/server/0010-Timings-v2.patch | 12 +- .../server/0011-Adventure.patch | 147 +++++++++--------- ...actus-bamboo-and-reed-growth-heights.patch | 22 +-- ...figurable-baby-zombie-movement-speed.patch | 6 +- ...014-Configurable-fishing-time-ranges.patch | 4 +- ...d-mobs-to-jump-and-take-water-damage.patch | 14 +- ...-despawn-distances-for-living-entiti.patch | 6 +- ...7-Allow-for-toggling-of-spawn-chunks.patch | 4 +- ...ck-and-tnt-entities-at-the-specified.patch | 6 +- ...ient-crashes-server-lists-and-Mojang.patch | 12 +- .../0020-Implement-Paper-VersionChecker.patch | 2 +- ...d-version-history-to-version-command.patch | 6 +- .../0022-Player-affects-spawning-API.patch | 30 ++-- ...ve-invalid-mob-spawner-tile-entities.patch | 22 +++ ...ve-invalid-mob-spawner-tile-entities.patch | 34 ---- todo.txt | 1 + 19 files changed, 168 insertions(+), 179 deletions(-) rename patches/{unapplied => }/api/0007-Adventure.patch (100%) rename patches/{unapplied => }/api/0008-Player-affects-spawning-API.patch (91%) rename patches/{unapplied => }/server/0011-Adventure.patch (97%) rename patches/{unapplied => }/server/0012-Configurable-cactus-bamboo-and-reed-growth-heights.patch (88%) rename patches/{unapplied => }/server/0013-Configurable-baby-zombie-movement-speed.patch (93%) rename patches/{unapplied => }/server/0014-Configurable-fishing-time-ranges.patch (91%) rename patches/{unapplied => }/server/0015-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch (86%) rename patches/{unapplied => }/server/0016-Add-configurable-despawn-distances-for-living-entiti.patch (95%) rename patches/{unapplied => }/server/0017-Allow-for-toggling-of-spawn-chunks.patch (91%) rename patches/{unapplied => }/server/0018-Drop-falling-block-and-tnt-entities-at-the-specified.patch (94%) rename patches/{unapplied => }/server/0019-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch (94%) rename patches/{unapplied => }/server/0020-Implement-Paper-VersionChecker.patch (98%) rename patches/{unapplied => }/server/0021-Add-version-history-to-version-command.patch (96%) rename patches/{unapplied => }/server/0022-Player-affects-spawning-API.patch (84%) create mode 100644 patches/server/0023-Remove-invalid-mob-spawner-tile-entities.patch delete mode 100644 patches/unapplied/server/0023-Remove-invalid-mob-spawner-tile-entities.patch diff --git a/patches/unapplied/api/0007-Adventure.patch b/patches/api/0007-Adventure.patch similarity index 100% rename from patches/unapplied/api/0007-Adventure.patch rename to patches/api/0007-Adventure.patch diff --git a/patches/unapplied/api/0008-Player-affects-spawning-API.patch b/patches/api/0008-Player-affects-spawning-API.patch similarity index 91% rename from patches/unapplied/api/0008-Player-affects-spawning-API.patch rename to patches/api/0008-Player-affects-spawning-API.patch index 1b3ace796..a2d094d22 100644 --- a/patches/unapplied/api/0008-Player-affects-spawning-API.patch +++ b/patches/api/0008-Player-affects-spawning-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Player affects spawning API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index d88613f54f368a27130675c4ea7569646dbe74d7..3fa8a69376cf6d5cc5987fea5cbbce228b1408d1 100644 +index 1140c29cffaac3c25f7d2591e5d635d070206041..6ec4b1408dbbe31f0f06e72d81f142e57b1d5cee 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -1475,6 +1475,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM diff --git a/patches/server/0006-MC-Utils.patch b/patches/server/0006-MC-Utils.patch index 6c9b8f84e..6d3bd22c5 100644 --- a/patches/server/0006-MC-Utils.patch +++ b/patches/server/0006-MC-Utils.patch @@ -724,7 +724,7 @@ index 0000000000000000000000000000000000000000..0133ea6feb1ab88f021f66855669f583 +} diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java new file mode 100644 -index 0000000000000000000000000000000000000000..4a21ec2397f57c7c2ac3659f7de96cda9182fea0 +index 0000000000000000000000000000000000000000..277cfd9d1e8fff5d9b5e534b75c3c5162d58b0b7 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java @@ -0,0 +1,128 @@ @@ -733,16 +733,16 @@ index 0000000000000000000000000000000000000000..4a21ec2397f57c7c2ac3659f7de96cda +import it.unimi.dsi.fastutil.longs.LongIterator; +import it.unimi.dsi.fastutil.shorts.Short2LongOpenHashMap; +import java.util.Arrays; ++import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.chunk.GlobalPalette; -+import net.minecraft.world.level.chunk.LevelChunkSection; + +/** + * @author Spottedleaf + */ +public final class IBlockDataList { + -+ static final GlobalPalette GLOBAL_PALETTE = (GlobalPalette) LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE; ++ static final GlobalPalette GLOBAL_PALETTE = new GlobalPalette<>(Block.BLOCK_STATE_REGISTRY); + + // map of location -> (index | (location << 16) | (palette id << 32)) + private final Short2LongOpenHashMap map = new Short2LongOpenHashMap(2, 0.8f); @@ -5374,21 +5374,22 @@ index 01b59a9c18d6f07889c3df2975cbf5594a167633..3f938d953daee7a5551a62df25f2e0fb @Override diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index a551683bc73db23d82bd2ca1e2c7c83e31e3c834..a832e6af0ce937d6e48021e3b2190ebe22bc3be5 100644 +index a551683bc73db23d82bd2ca1e2c7c83e31e3c834..fc3565c1dd1c7f09bc885f1b0c9cf71477d64543 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -46,8 +46,10 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana +@@ -46,8 +46,11 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureMana import net.minecraft.world.level.storage.DimensionDataStorage; import net.minecraft.world.level.storage.LevelData; import net.minecraft.world.level.storage.LevelStorageSource; +import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; // Paper ++import java.util.function.Function; // Paper public class ServerChunkCache extends ChunkSource { + public static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); // Paper public static final List CHUNK_STATUSES = ChunkStatus.getStatusList(); private final DistanceManager distanceManager; -@@ -67,6 +69,316 @@ public class ServerChunkCache extends ChunkSource { +@@ -67,6 +70,316 @@ public class ServerChunkCache extends ChunkSource { @Nullable @VisibleForDebug private NaturalSpawner.SpawnState lastSpawnState; @@ -5705,7 +5706,7 @@ index a551683bc73db23d82bd2ca1e2c7c83e31e3c834..a832e6af0ce937d6e48021e3b2190ebe public ServerChunkCache(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureManager structureManager, Executor workerExecutor, ChunkGenerator chunkGenerator, int viewDistance, int simulationDistance, boolean dsync, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory) { this.level = world; -@@ -127,6 +439,49 @@ public class ServerChunkCache extends ChunkSource { +@@ -127,6 +440,49 @@ public class ServerChunkCache extends ChunkSource { this.lastChunk[0] = chunk; } @@ -5755,7 +5756,7 @@ index a551683bc73db23d82bd2ca1e2c7c83e31e3c834..a832e6af0ce937d6e48021e3b2190ebe @Nullable @Override public ChunkAccess getChunk(int x, int z, ChunkStatus leastStatus, boolean create) { -@@ -441,7 +796,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -441,7 +797,7 @@ public class ServerChunkCache extends ChunkSource { gameprofilerfiller.popPush("spawnAndTick"); boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit diff --git a/patches/server/0010-Timings-v2.patch b/patches/server/0010-Timings-v2.patch index bcd3078df..67dd2c431 100644 --- a/patches/server/0010-Timings-v2.patch +++ b/patches/server/0010-Timings-v2.patch @@ -1125,10 +1125,10 @@ index 3f938d953daee7a5551a62df25f2e0fb487733ec..cab03a81a97d851db61e517cfe3a43fa } diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index a832e6af0ce937d6e48021e3b2190ebe22bc3be5..014152d5f435b34799ca5b57f6143c3e36d4b2e0 100644 +index fc3565c1dd1c7f09bc885f1b0c9cf71477d64543..28761de0a4a460f74fbf6aca3f5d5ec87684b529 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -507,13 +507,15 @@ public class ServerChunkCache extends ChunkSource { +@@ -508,13 +508,15 @@ public class ServerChunkCache extends ChunkSource { } gameprofilerfiller.incrementCounter("getChunkCacheMiss"); @@ -1146,7 +1146,7 @@ index a832e6af0ce937d6e48021e3b2190ebe22bc3be5..014152d5f435b34799ca5b57f6143c3e ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { return ichunkaccess1; }, (playerchunk_failure) -> { -@@ -711,7 +713,9 @@ public class ServerChunkCache extends ChunkSource { +@@ -712,7 +714,9 @@ public class ServerChunkCache extends ChunkSource { public void save(boolean flush) { this.runDistanceManagerUpdates(); @@ -1156,7 +1156,7 @@ index a832e6af0ce937d6e48021e3b2190ebe22bc3be5..014152d5f435b34799ca5b57f6143c3e } @Override -@@ -749,7 +753,9 @@ public class ServerChunkCache extends ChunkSource { +@@ -750,7 +754,9 @@ public class ServerChunkCache extends ChunkSource { this.runDistanceManagerUpdates(); this.level.timings.doChunkMap.stopTiming(); // Spigot this.level.getProfiler().popPush("chunks"); @@ -1166,7 +1166,7 @@ index a832e6af0ce937d6e48021e3b2190ebe22bc3be5..014152d5f435b34799ca5b57f6143c3e this.level.timings.doChunkUnload.startTiming(); // Spigot this.level.getProfiler().popPush("unload"); this.chunkMap.tick(booleansupplier); -@@ -776,13 +782,16 @@ public class ServerChunkCache extends ChunkSource { +@@ -777,13 +783,16 @@ public class ServerChunkCache extends ChunkSource { boolean flag1 = level.ticksPerAnimalSpawns != 0L && worlddata.getGameTime() % level.ticksPerAnimalSpawns == 0L; // CraftBukkit gameprofilerfiller.push("naturalSpawnCount"); @@ -1183,7 +1183,7 @@ index a832e6af0ce937d6e48021e3b2190ebe22bc3be5..014152d5f435b34799ca5b57f6143c3e while (iterator.hasNext()) { ChunkHolder playerchunk = (ChunkHolder) iterator.next(); -@@ -811,27 +820,27 @@ public class ServerChunkCache extends ChunkSource { +@@ -812,27 +821,27 @@ public class ServerChunkCache extends ChunkSource { } if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) { diff --git a/patches/unapplied/server/0011-Adventure.patch b/patches/server/0011-Adventure.patch similarity index 97% rename from patches/unapplied/server/0011-Adventure.patch rename to patches/server/0011-Adventure.patch index 755337e4b..a24058e10 100644 --- a/patches/unapplied/server/0011-Adventure.patch +++ b/patches/server/0011-Adventure.patch @@ -1028,7 +1028,7 @@ index b82b218be1bd849fa280ea1fe0336e279bebfc18..2fb444653118816f1250841cb4c6c486 public static ChatFormatting getById(int colorIndex) { if (colorIndex < 0) { diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -index ca4d629616136e3362c872c3d10cba67c8225c8c..22bc8fa039375a3205bdfdf05b6c73c856fb1b16 100644 +index d5d94ea8070ab5f66f0a3244a5a953b9c9d5c527..0053474ab7c25de6d86c16e3079feb21f75d1c11 100644 --- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java +++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java @@ -14,6 +14,7 @@ import io.netty.handler.codec.EncoderException; @@ -1036,10 +1036,10 @@ index ca4d629616136e3362c872c3d10cba67c8225c8c..22bc8fa039375a3205bdfdf05b6c73c8 import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; +import io.papermc.paper.adventure.PaperAdventure; // Paper - import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; -@@ -62,6 +63,7 @@ public class FriendlyByteBuf extends ByteBuf { + import java.io.InputStream; +@@ -61,6 +62,7 @@ public class FriendlyByteBuf extends ByteBuf { private static final int MAX_VARLONG_SIZE = 10; private static final int DEFAULT_NBT_QUOTA = 2097152; private final ByteBuf source; @@ -1047,7 +1047,7 @@ index ca4d629616136e3362c872c3d10cba67c8225c8c..22bc8fa039375a3205bdfdf05b6c73c8 public static final short MAX_STRING_LENGTH = 32767; public static final int MAX_COMPONENT_STRING_LENGTH = 262144; -@@ -351,8 +353,15 @@ public class FriendlyByteBuf extends ByteBuf { +@@ -350,8 +352,15 @@ public class FriendlyByteBuf extends ByteBuf { return Component.Serializer.fromJson(this.readUtf(262144)); } @@ -1065,7 +1065,7 @@ index ca4d629616136e3362c872c3d10cba67c8225c8c..22bc8fa039375a3205bdfdf05b6c73c8 public > T readEnum(Class enumClass) { diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java -index 8e9d685d04b93cef73b3fbebd086c970968914d5..092d8ecf8d6a7045d2fc379bc0f9ec4ee294d056 100644 +index b964121f19e6a28df7675e65441c551a55316753..dfeff0da932b0d66b70f3a5dd281c926c048f2f0 100644 --- a/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java @@ -3,6 +3,7 @@ package net.minecraft.network; @@ -1085,7 +1085,7 @@ index 8e9d685d04b93cef73b3fbebd086c970968914d5..092d8ecf8d6a7045d2fc379bc0f9ec4e try { int i = friendlyByteBuf.writerIndex(); diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java -index d9aac575213f3bda9c44ea2b3b6d1969ff82f09d..5ba1636bbb938373e43c1f3ac561368fc9cffd43 100644 +index 4d664338f3d5570fd0133ace6b297d70045b34a7..984105c226f16746b43bb2d2932e0b87f3a6a70c 100644 --- a/src/main/java/net/minecraft/network/chat/Component.java +++ b/src/main/java/net/minecraft/network/chat/Component.java @@ -1,6 +1,7 @@ @@ -1238,18 +1238,18 @@ index 762a9392ffac3042356709dddd15bb3516048bed..3544e2dc2522e9d6305d727d56e73490 buf.writeComponent(this.footer); } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 5f243953d6d9710280bd099b7560c18d30dddfa0..0e7c09c80509c83a52f32f735a1b19960bb369ee 100644 +index 925ffbddd5475be7fe00570d861b615f707434b4..a3436596d05547a60c9906c92f709bb56a9175bd 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -146,6 +146,7 @@ import net.minecraft.world.scores.Score; +@@ -145,6 +145,7 @@ import net.minecraft.world.scores.Score; import net.minecraft.world.scores.Scoreboard; import net.minecraft.world.scores.Team; import net.minecraft.world.scores.criteria.ObjectiveCriteria; +import io.papermc.paper.adventure.PaperAdventure; // Paper import org.bukkit.Bukkit; - import org.bukkit.GameMode; import org.bukkit.Location; -@@ -217,6 +218,7 @@ public class ServerPlayer extends Player { + import org.bukkit.WeatherType; +@@ -220,6 +221,7 @@ public class ServerPlayer extends Player { // CraftBukkit start public String displayName; @@ -1257,7 +1257,7 @@ index 5f243953d6d9710280bd099b7560c18d30dddfa0..0e7c09c80509c83a52f32f735a1b1996 public Component listName; public org.bukkit.Location compassTarget; public int newExp = 0; -@@ -297,6 +299,7 @@ public class ServerPlayer extends Player { +@@ -301,6 +303,7 @@ public class ServerPlayer extends Player { // CraftBukkit start this.displayName = this.getScoreboardName(); @@ -1265,7 +1265,7 @@ index 5f243953d6d9710280bd099b7560c18d30dddfa0..0e7c09c80509c83a52f32f735a1b1996 this.bukkitPickUpLoot = true; this.maxHealthCache = this.getMaxHealth(); } -@@ -734,22 +737,17 @@ public class ServerPlayer extends Player { +@@ -772,22 +775,17 @@ public class ServerPlayer extends Player { String deathmessage = defaultMessage.getString(); this.keepLevel = keepInventory; // SPIGOT-2222: pre-set keepLevel @@ -1290,17 +1290,17 @@ index 5f243953d6d9710280bd099b7560c18d30dddfa0..0e7c09c80509c83a52f32f735a1b1996 + if (deathMessage != null && deathMessage != net.kyori.adventure.text.Component.empty() && flag) { // Paper - Adventure // TODO: allow plugins to override? + Component ichatbasecomponent = PaperAdventure.asVanilla(deathMessage); // Paper - Adventure - this.connection.send((Packet) (new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent)), (future) -> { + this.connection.send(new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent), (future) -> { if (!future.isSuccess()) { -@@ -1703,6 +1701,7 @@ public class ServerPlayer extends Player { +@@ -1729,6 +1727,7 @@ public class ServerPlayer extends Player { } public String locale = "en_us"; // CraftBukkit - add, lowercase + public java.util.Locale adventure$locale = java.util.Locale.US; // Paper public void updateOptions(ServerboundClientInformationPacket packet) { // CraftBukkit start - if (getMainArm() != packet.getMainHand()) { -@@ -1714,6 +1713,10 @@ public class ServerPlayer extends Player { + if (getMainArm() != packet.mainHand()) { +@@ -1740,6 +1739,10 @@ public class ServerPlayer extends Player { this.server.server.getPluginManager().callEvent(event); } this.locale = packet.language; @@ -1310,12 +1310,12 @@ index 5f243953d6d9710280bd099b7560c18d30dddfa0..0e7c09c80509c83a52f32f735a1b1996 + // Paper end this.clientViewDistance = packet.viewDistance; // CraftBukkit end - this.chatVisibility = packet.getChatVisibility(); + this.chatVisibility = packet.chatVisibility(); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index fd4bfb2b373acec07ca77414c8527b8d416b1b49..cab69dfc5be1ebbabab5a750b6119c65a6cf0320 100644 +index 7f9b560a415eec4008d0fdcfa427c3df8f974e43..11687dc95f606750e9042b043f333e3b00eb171c 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -161,6 +161,8 @@ import org.apache.logging.log4j.LogManager; +@@ -160,6 +160,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; // CraftBukkit start @@ -1324,7 +1324,7 @@ index fd4bfb2b373acec07ca77414c8527b8d416b1b49..cab69dfc5be1ebbabab5a750b6119c65 import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicInteger; import net.minecraft.world.inventory.AbstractContainerMenu; -@@ -384,21 +386,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -383,21 +385,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser return this.server.isSingleplayerOwner(this.player.getGameProfile()); } @@ -1357,7 +1357,7 @@ index fd4bfb2b373acec07ca77414c8527b8d416b1b49..cab69dfc5be1ebbabab5a750b6119c65 if (this.cserver.getServer().isRunning()) { this.cserver.getPluginManager().callEvent(event); -@@ -409,8 +414,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -408,8 +413,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser return; } // Send the possibly modified leave message @@ -1367,22 +1367,22 @@ index fd4bfb2b373acec07ca77414c8527b8d416b1b49..cab69dfc5be1ebbabab5a750b6119c65 // CraftBukkit end this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), (future) -> { -@@ -1659,9 +1663,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1665,9 +1669,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser */ this.player.disconnect(); -- String quitMessage = this.server.getPlayerList().disconnect(this.player); +- String quitMessage = this.server.getPlayerList().remove(this.player); - if ((quitMessage != null) && (quitMessage.length() > 0)) { -- this.server.getPlayerList().sendMessage(CraftChatMessage.fromString(quitMessage)); +- this.server.getPlayerList().broadcastMessage(CraftChatMessage.fromString(quitMessage)); + // Paper start - Adventure -+ net.kyori.adventure.text.Component quitMessage = this.server.getPlayerList().disconnect(this.player); ++ net.kyori.adventure.text.Component quitMessage = this.server.getPlayerList().remove(this.player); + if ((quitMessage != null) && !quitMessage.equals(net.kyori.adventure.text.Component.empty())) { + this.server.getPlayerList().broadcastMessage(PaperAdventure.asVanilla(quitMessage), ChatType.SYSTEM, Util.NIL_UUID); + // Paper end } // CraftBukkit end this.player.getTextFilter().leave(); -@@ -1843,7 +1849,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1849,7 +1855,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.handleCommand(s); } else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) { // Do nothing, this is coming from a plugin @@ -1396,7 +1396,7 @@ index fd4bfb2b373acec07ca77414c8527b8d416b1b49..cab69dfc5be1ebbabab5a750b6119c65 Player player = this.getCraftPlayer(); AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet(this.server)); this.cserver.getPluginManager().callEvent(event); -@@ -2634,30 +2645,30 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2639,30 +2650,30 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser return; } @@ -1436,7 +1436,7 @@ index fd4bfb2b373acec07ca77414c8527b8d416b1b49..cab69dfc5be1ebbabab5a750b6119c65 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 829ebf802b377cc811bf5af8c16aaa6d3a72a51d..c8d8d766de86dc3e47b06a355b28d2279820c570 100644 +index 346061bf60fad2f20ac88f287019d813eabe259b..4ae61a810c63a259490dde53e7bdb862ed4df5ad 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -36,6 +36,7 @@ import net.minecraft.world.entity.player.Player; @@ -1447,7 +1447,7 @@ index 829ebf802b377cc811bf5af8c16aaa6d3a72a51d..c8d8d766de86dc3e47b06a355b28d227 import org.bukkit.craftbukkit.util.Waitable; import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.PlayerPreLoginEvent; -@@ -315,7 +316,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -316,7 +317,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) { final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId); if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) { @@ -1456,7 +1456,7 @@ index 829ebf802b377cc811bf5af8c16aaa6d3a72a51d..c8d8d766de86dc3e47b06a355b28d227 } Waitable waitable = new Waitable() { @Override -@@ -326,12 +327,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -327,12 +328,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener ServerLoginPacketListenerImpl.this.server.processQueue.add(waitable); if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) { @@ -1472,7 +1472,7 @@ index 829ebf802b377cc811bf5af8c16aaa6d3a72a51d..c8d8d766de86dc3e47b06a355b28d227 } } diff --git a/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java -index b632280e057ae6893bf5ebcde75cefac3ee62a09..9baa56d6da9c24706f1dbc8851fd68ca752cab26 100644 +index 50ab7ebeefc6588aca6037aaf21589e5e73aa2c0..dff7b1005f60c762ed81de5eb77e1575f07f5ce9 100644 --- a/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java @@ -55,7 +55,7 @@ public class ServerStatusPacketListenerImpl implements ServerStatusPacketListene @@ -1485,7 +1485,7 @@ index b632280e057ae6893bf5ebcde75cefac3ee62a09..9baa56d6da9c24706f1dbc8851fd68ca @Override diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 956fed13f641d87a8d117ba30e84a4138c9d1a30..9d1aac0af9c96775beee40cc907a8593a731a35d 100644 +index 6ea948d9a7e20a389f445836f8ab40986f05fcd2..1cfeaeeddbc97e28f51c79ab3082a5d387daaead 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -8,6 +8,7 @@ import com.mojang.authlib.GameProfile; @@ -1504,7 +1504,7 @@ index 956fed13f641d87a8d117ba30e84a4138c9d1a30..9d1aac0af9c96775beee40cc907a8593 import com.google.common.base.Predicate; import java.util.stream.Collectors; import net.minecraft.server.dedicated.DedicatedServer; -@@ -258,7 +260,7 @@ public abstract class PlayerList { +@@ -259,7 +261,7 @@ public abstract class PlayerList { } // CraftBukkit start chatmessage.withStyle(ChatFormatting.YELLOW); @@ -1513,7 +1513,7 @@ index 956fed13f641d87a8d117ba30e84a4138c9d1a30..9d1aac0af9c96775beee40cc907a8593 playerconnection.teleport(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot()); this.players.add(player); -@@ -272,19 +274,18 @@ public abstract class PlayerList { +@@ -273,19 +275,18 @@ public abstract class PlayerList { // Ensure that player inventory is populated with its viewer player.containerMenu.transferTo(player.containerMenu, bukkitPlayer); @@ -1538,16 +1538,16 @@ index 956fed13f641d87a8d117ba30e84a4138c9d1a30..9d1aac0af9c96775beee40cc907a8593 } // CraftBukkit end -@@ -481,7 +482,7 @@ public abstract class PlayerList { +@@ -482,7 +483,7 @@ public abstract class PlayerList { } -- public String disconnect(ServerPlayer entityplayer) { // CraftBukkit - return string -+ public net.kyori.adventure.text.Component disconnect(ServerPlayer entityplayer) { // Paper - return Component +- public String remove(ServerPlayer entityplayer) { // CraftBukkit - return string ++ public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer) { // Paper - return Component ServerLevel worldserver = entityplayer.getLevel(); entityplayer.awardStat(Stats.LEAVE_GAME); -@@ -492,7 +493,7 @@ public abstract class PlayerList { +@@ -493,7 +494,7 @@ public abstract class PlayerList { entityplayer.closeContainer(); } @@ -1556,7 +1556,7 @@ index 956fed13f641d87a8d117ba30e84a4138c9d1a30..9d1aac0af9c96775beee40cc907a8593 this.cserver.getPluginManager().callEvent(playerQuitEvent); entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); -@@ -545,7 +546,7 @@ public abstract class PlayerList { +@@ -546,7 +547,7 @@ public abstract class PlayerList { this.cserver.getScoreboardManager().removePlayer(entityplayer.getBukkitEntity()); // CraftBukkit end @@ -1565,7 +1565,7 @@ index 956fed13f641d87a8d117ba30e84a4138c9d1a30..9d1aac0af9c96775beee40cc907a8593 } // CraftBukkit start - Whole method, SocketAddress to LoginListener, added hostname to signature, return EntityPlayer -@@ -591,10 +592,10 @@ public abstract class PlayerList { +@@ -592,10 +593,10 @@ public abstract class PlayerList { } // return chatmessage; @@ -1578,14 +1578,14 @@ index 956fed13f641d87a8d117ba30e84a4138c9d1a30..9d1aac0af9c96775beee40cc907a8593 } else if (this.getIpBans().isBanned(socketaddress) && !this.getIpBans().get(socketaddress).hasExpired()) { IpBanListEntry ipbanentry = this.ipBans.get(socketaddress); -@@ -604,17 +605,17 @@ public abstract class PlayerList { +@@ -605,17 +606,17 @@ public abstract class PlayerList { } // return chatmessage; - event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(chatmessage)); + event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(chatmessage)); // Paper - Adventure } else { - // return this.players.size() >= this.maxPlayers && !this.d(gameprofile) ? new ChatMessage("multiplayer.disconnect.server_full") : null; + // return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile) ? new ChatMessage("multiplayer.disconnect.server_full") : null; if (this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile)) { - event.disallow(PlayerLoginEvent.Result.KICK_FULL, org.spigotmc.SpigotConfig.serverFullMessage); // Spigot + event.disallow(PlayerLoginEvent.Result.KICK_FULL, PaperAdventure.LEGACY_SECTION_UXRC.deserialize(org.spigotmc.SpigotConfig.serverFullMessage)); // Spigot // Paper - Adventure @@ -1599,7 +1599,7 @@ index 956fed13f641d87a8d117ba30e84a4138c9d1a30..9d1aac0af9c96775beee40cc907a8593 return null; } return entity; -@@ -1118,7 +1119,7 @@ public abstract class PlayerList { +@@ -1124,7 +1125,7 @@ public abstract class PlayerList { public void removeAll() { // CraftBukkit start - disconnect safely for (ServerPlayer player : this.players) { @@ -1697,7 +1697,7 @@ index d289e8321a62f7c8d1e5b83f038e7331a26fc24e..58716ba8f8d12a410bdc66ccef6a61c6 } diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -index 4dd30c5090c55b1b963903e510c96c88d49de16e..1fcdd5aa930afc2039356582ab56aeec7f838e4e 100644 +index 9af14095fa8dbc75fadb84c5a1d263039994e441..3b35ec1df648a3de920ea0c15962388044737bbc 100644 --- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java @@ -33,6 +33,7 @@ import org.apache.logging.log4j.LogManager; @@ -1706,9 +1706,9 @@ index 4dd30c5090c55b1b963903e510c96c88d49de16e..1fcdd5aa930afc2039356582ab56aeec // CraftBukkit start +import io.papermc.paper.adventure.PaperAdventure; // Paper import java.util.UUID; - import org.bukkit.Bukkit; -@@ -599,7 +600,7 @@ public class MapItemSavedData extends SavedData { + import org.bukkit.craftbukkit.CraftServer; +@@ -598,7 +599,7 @@ public class MapItemSavedData extends SavedData { for (org.bukkit.map.MapCursor cursor : render.cursors) { if (cursor.isVisible()) { @@ -1718,10 +1718,10 @@ index 4dd30c5090c55b1b963903e510c96c88d49de16e..1fcdd5aa930afc2039356582ab56aeec } collection = icons; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 421fbc0cf660d5d743ca34d5d759becea3fd666f..4a5031925e2fa5f646e898f65594b2a7319c9208 100644 +index 734fbbd27dc3bfed223ea03f246ebfb87a46225a..52d6814cc46dd195dbfe3ee3b79c09f523a98f94 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -588,8 +588,10 @@ public final class CraftServer implements Server { +@@ -592,8 +592,10 @@ public final class CraftServer implements Server { } @Override @@ -1732,7 +1732,7 @@ index 421fbc0cf660d5d743ca34d5d759becea3fd666f..4a5031925e2fa5f646e898f65594b2a7 } @Override -@@ -1423,7 +1425,15 @@ public final class CraftServer implements Server { +@@ -1429,7 +1431,15 @@ public final class CraftServer implements Server { return this.configuration.getInt("settings.spawn-radius", -1); } @@ -1748,7 +1748,7 @@ index 421fbc0cf660d5d743ca34d5d759becea3fd666f..4a5031925e2fa5f646e898f65594b2a7 public String getShutdownMessage() { return this.configuration.getString("settings.shutdown-message"); } -@@ -1576,7 +1586,20 @@ public final class CraftServer implements Server { +@@ -1587,7 +1597,20 @@ public final class CraftServer implements Server { } @Override @@ -1769,7 +1769,7 @@ index 421fbc0cf660d5d743ca34d5d759becea3fd666f..4a5031925e2fa5f646e898f65594b2a7 Set recipients = new HashSet<>(); for (Permissible permissible : this.getPluginManager().getPermissionSubscriptions(permission)) { if (permissible instanceof CommandSender && permissible.hasPermission(permission)) { -@@ -1584,14 +1607,14 @@ public final class CraftServer implements Server { +@@ -1595,14 +1618,14 @@ public final class CraftServer implements Server { } } @@ -1786,7 +1786,7 @@ index 421fbc0cf660d5d743ca34d5d759becea3fd666f..4a5031925e2fa5f646e898f65594b2a7 for (CommandSender recipient : recipients) { recipient.sendMessage(message); -@@ -1827,6 +1850,14 @@ public final class CraftServer implements Server { +@@ -1838,6 +1861,14 @@ public final class CraftServer implements Server { return CraftInventoryCreator.INSTANCE.createInventory(owner, type); } @@ -1801,7 +1801,7 @@ index 421fbc0cf660d5d743ca34d5d759becea3fd666f..4a5031925e2fa5f646e898f65594b2a7 @Override public Inventory createInventory(InventoryHolder owner, InventoryType type, String title) { Validate.isTrue(type.isCreatable(), "Cannot open an inventory of type ", type); -@@ -1839,13 +1870,28 @@ public final class CraftServer implements Server { +@@ -1850,13 +1881,28 @@ public final class CraftServer implements Server { return CraftInventoryCreator.INSTANCE.createInventory(owner, size); } @@ -1830,7 +1830,7 @@ index 421fbc0cf660d5d743ca34d5d759becea3fd666f..4a5031925e2fa5f646e898f65594b2a7 public Merchant createMerchant(String title) { return new CraftMerchantCustom(title == null ? InventoryType.MERCHANT.getDefaultTitle() : title); } -@@ -1894,6 +1940,12 @@ public final class CraftServer implements Server { +@@ -1905,6 +1951,12 @@ public final class CraftServer implements Server { return Thread.currentThread().equals(console.serverThread) || this.console.hasStopped() || !org.spigotmc.AsyncCatcher.enabled; // All bets are off if we have shut down (e.g. due to watchdog) } @@ -1843,7 +1843,7 @@ index 421fbc0cf660d5d743ca34d5d759becea3fd666f..4a5031925e2fa5f646e898f65594b2a7 @Override public String getMotd() { return this.console.getMotd(); -@@ -2336,5 +2388,15 @@ public final class CraftServer implements Server { +@@ -2348,5 +2400,15 @@ public final class CraftServer implements Server { return null; } } @@ -1860,7 +1860,7 @@ index 421fbc0cf660d5d743ca34d5d759becea3fd666f..4a5031925e2fa5f646e898f65594b2a7 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index e0c16ef149a7cdcb703b6f9f061cf47ce38aeefa..0b846204ba0e08ead4ca044505efe91f23c116e4 100644 +index 6bb2e87c4aa09e565c1c197548517d87f63f7fb1..277b946bec2cfd8cfb4054504133f6ab9059ba8c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -131,6 +131,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -1871,7 +1871,7 @@ index e0c16ef149a7cdcb703b6f9f061cf47ce38aeefa..0b846204ba0e08ead4ca044505efe91f private static final Random rand = new Random(); -@@ -1776,4 +1777,18 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1781,4 +1782,18 @@ public class CraftWorld extends CraftRegionAccessor implements World { return this.spigot; } // Spigot end @@ -1891,7 +1891,7 @@ index e0c16ef149a7cdcb703b6f9f061cf47ce38aeefa..0b846204ba0e08ead4ca044505efe91f + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 11d1bc56439ff867224ef1c2058aee67ba0ee332..52f78b8a3d4588f9aba10c8aea4d36cb02f1f54f 100644 +index aa4b21c9d3c4af08c4d3a309f948692cc585c9c9..b9b3e4ead357e6f9816b612d54215c7123b1310a 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -19,6 +19,12 @@ public class Main { @@ -2311,7 +2311,7 @@ index a9f02b8246c27936b6260fc4e9c83c474ef85fd1..b80b834fc35201746f5bba079aff6d95 @Override public boolean isPermissionSet(String name) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 042691349dd5659e8db526199641cbcfa21c6005..841dbf4a86b19d7c8ea41930ecb1f88c660fa117 100644 +index bc6a95e48fff620b052a4433f24ff1dadbf8a1b6..afb71ae8bd5f417f6cd99e26c3b45e5b544beb21 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -317,9 +317,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { @@ -2363,10 +2363,10 @@ index 446fdca49a5a6999626a7ee3a1d5c168b15a09dd..f9863e138994f6c7a7975a852f106faa public boolean isOp() { return true; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 654d9fd062ef8c98d87b025d48a1a9f709dd3db0..63abd7058bd770724145526a89a539f064079b81 100644 +index 74617477ce710be19c5fd76e43c72e37f3750d33..b534eae34da93b2764ac577438c49559529560ca 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -244,14 +244,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -250,14 +250,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public String getDisplayName() { @@ -2406,7 +2406,7 @@ index 654d9fd062ef8c98d87b025d48a1a9f709dd3db0..63abd7058bd770724145526a89a539f0 @Override public String getPlayerListName() { return this.getHandle().listName == null ? getName() : CraftChatMessage.fromComponent(this.getHandle().listName); -@@ -270,42 +295,42 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -276,42 +301,42 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } } @@ -2458,7 +2458,7 @@ index 654d9fd062ef8c98d87b025d48a1a9f709dd3db0..63abd7058bd770724145526a89a539f0 this.getHandle().connection.send(packet); } -@@ -337,6 +362,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -343,6 +368,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.getHandle().connection.disconnect(message == null ? "" : message); } @@ -2476,7 +2476,7 @@ index 654d9fd062ef8c98d87b025d48a1a9f709dd3db0..63abd7058bd770724145526a89a539f0 @Override public void setCompassTarget(Location loc) { if (this.getHandle().connection == null) return; -@@ -579,6 +615,33 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -585,6 +621,33 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.getHandle().connection.send(packet); } @@ -2510,7 +2510,7 @@ index 654d9fd062ef8c98d87b025d48a1a9f709dd3db0..63abd7058bd770724145526a89a539f0 @Override public void sendSignChange(Location loc, String[] lines) { this.sendSignChange(loc, lines, DyeColor.BLACK); -@@ -606,14 +669,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -612,14 +675,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } Component[] components = CraftSign.sanitizeLines(lines); @@ -2528,7 +2528,7 @@ index 654d9fd062ef8c98d87b025d48a1a9f709dd3db0..63abd7058bd770724145526a89a539f0 } @Override -@@ -1713,6 +1777,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1700,6 +1764,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return (this.getHandle().clientViewDistance == null) ? Bukkit.getViewDistance() : this.getHandle().clientViewDistance; } @@ -2541,8 +2541,8 @@ index 654d9fd062ef8c98d87b025d48a1a9f709dd3db0..63abd7058bd770724145526a89a539f0 @Override public int getPing() { return this.getHandle().latency; -@@ -1741,6 +1811,195 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - getInventory().setItemInMainHand(hand); +@@ -1733,6 +1803,194 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + return this.getHandle().allowsListing(); } + // Paper start @@ -2733,7 +2733,6 @@ index 654d9fd062ef8c98d87b025d48a1a9f709dd3db0..63abd7058bd770724145526a89a539f0 + return this.adventure$pointers; + } + // Paper end -+ // Spigot start private final Player.Spigot spigot = new Player.Spigot() { @@ -2907,7 +2906,7 @@ index ddcd4f2f1442d9e1b4d04c88f0f96841c4d5650d..69af359e0160480b77886ca35d8f8f31 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java -index b7cb3c94d88b2753fd1fc17c2842607576fd7874..f40d6a0048ad5b3f6e31d83894ee89f5ca64fb3a 100644 +index 059c84a4e50b043f2ac2a033d5d3cbf3cba3b3f9..552851cff3678d605428866999951fefd4375d7a 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java @@ -14,10 +14,17 @@ import org.apache.commons.lang.Validate; @@ -3172,7 +3171,7 @@ index 00445fc7373c70f4cecc4114f9bcfb4b6f27c0e8..b132c151e4fb6c64b633a0712100c3ae + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index a096c9f7fb459200f8d1f2c797a29bc1222c86af..86163b56d10689aa512953c8df869aa45ebac735 100644 +index 86fabf0554d853de68f5db0548ffddf1ae25d267..af2d0bfab14cf7133eeaff484895cba6b37391e8 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -746,6 +746,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -3349,7 +3348,7 @@ index 1980240d3dc0331ddf2ff56e163e2bfbd3b231ab..7a7f3f53aef601f124d474d9890e23d8 public Inventory createInventory(InventoryHolder holder, InventoryType type, String title) { // BrewingStand does not extend TileEntityLootable diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java -index c80424fa0494272900ee141eefbf2522ee66d657..2477bb1f2b37406e2c73f18956201762a61ca324 100644 +index e9bb0728ae5c16aad4acc106d332db5095db4033..6752cd9b3bc246fc2a7764df0d2b40d3e638fa62 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java @@ -30,6 +30,21 @@ final class CraftObjective extends CraftScoreboardComponent implements Objective @@ -3375,7 +3374,7 @@ index c80424fa0494272900ee141eefbf2522ee66d657..2477bb1f2b37406e2c73f18956201762 public String getDisplayName() throws IllegalStateException { CraftScoreboard scoreboard = this.checkState(); diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java -index 589cb3bebb4bb193477cc5064c66830eec3e9138..68aa66c340b7a686a353e2a15084d811a3955a0a 100644 +index afc059755ae3e7b1c0a4cf3c6b8f32ce13cc458d..59f60fcadd8767cf8698482547e8c771d970732a 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java @@ -27,6 +27,27 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard { @@ -3501,7 +3500,7 @@ index f9b7b8f7ccc95b73967a51420fd6ce88d80d75fe..0de5a46423ae0403dcbfca630dfd7c5a boolean hadFormat = false; diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 7a3ba7590249d6a3eb37f894c9cfd414a8ccf3fd..fa64a0ea5b6dd9c6031fe54c9030bdb1999ef109 100644 +index 7024e0750a10ce4325b7217c76e03603ef53faa8..bbb29440264094ecb82ec1282bdf7aa9f1f2106a 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -57,6 +57,33 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/unapplied/server/0012-Configurable-cactus-bamboo-and-reed-growth-heights.patch b/patches/server/0012-Configurable-cactus-bamboo-and-reed-growth-heights.patch similarity index 88% rename from patches/unapplied/server/0012-Configurable-cactus-bamboo-and-reed-growth-heights.patch rename to patches/server/0012-Configurable-cactus-bamboo-and-reed-growth-heights.patch index 4b4086602..074699cfa 100644 --- a/patches/unapplied/server/0012-Configurable-cactus-bamboo-and-reed-growth-heights.patch +++ b/patches/server/0012-Configurable-cactus-bamboo-and-reed-growth-heights.patch @@ -29,19 +29,19 @@ index 6cb3a37612240d4150d7c62628f4b7440c822d48..3d9a805d01cea0b414446c0540ac9a4f + } } diff --git a/src/main/java/net/minecraft/world/level/block/BambooBlock.java b/src/main/java/net/minecraft/world/level/block/BambooBlock.java -index 7f40f6206f10a78fb74c19bd62c584f9f5c3e635..878b8fb992b448f0a644f7fa2c2bded191ff8268 100644 +index 517140666109ae27177c70ca0a41b0a9f636c9c6..1f2d9ae9593193b478375b7b03d6f9fda80a8bca 100644 --- a/src/main/java/net/minecraft/world/level/block/BambooBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BambooBlock.java -@@ -137,7 +137,7 @@ public class BambooBlock extends Block implements BonemealableBlock { +@@ -136,7 +136,7 @@ public class BambooBlock extends Block implements BonemealableBlock { if (random.nextInt(Math.max(1, (int) (100.0F / world.spigotConfig.bambooModifier) * 3)) == 0 && world.isEmptyBlock(pos.above()) && world.getRawBrightness(pos.above(), 0) >= 9) { // Spigot - int i = this.getHeightBelowUpToMax((BlockGetter) world, pos) + 1; + int i = this.getHeightBelowUpToMax(world, pos) + 1; - if (i < 16) { + if (i < world.paperConfig.bambooMaxHeight) { // Paper - this.growBamboo(state, (Level) world, pos, random, i); + this.growBamboo(state, world, pos, random, i); } } -@@ -168,7 +168,7 @@ public class BambooBlock extends Block implements BonemealableBlock { +@@ -167,7 +167,7 @@ public class BambooBlock extends Block implements BonemealableBlock { int i = this.getHeightAboveUpToMax(world, pos); int j = this.getHeightBelowUpToMax(world, pos); @@ -50,7 +50,7 @@ index 7f40f6206f10a78fb74c19bd62c584f9f5c3e635..878b8fb992b448f0a644f7fa2c2bded1 } @Override -@@ -187,7 +187,7 @@ public class BambooBlock extends Block implements BonemealableBlock { +@@ -186,7 +186,7 @@ public class BambooBlock extends Block implements BonemealableBlock { BlockPos blockposition1 = pos.above(i); BlockState iblockdata1 = world.getBlockState(blockposition1); @@ -59,7 +59,7 @@ index 7f40f6206f10a78fb74c19bd62c584f9f5c3e635..878b8fb992b448f0a644f7fa2c2bded1 return; } -@@ -228,7 +228,7 @@ public class BambooBlock extends Block implements BonemealableBlock { +@@ -227,7 +227,7 @@ public class BambooBlock extends Block implements BonemealableBlock { } int j = (Integer) state.getValue(BambooBlock.AGE) != 1 && !iblockdata2.is(Blocks.BAMBOO) ? 0 : 1; @@ -68,7 +68,7 @@ index 7f40f6206f10a78fb74c19bd62c584f9f5c3e635..878b8fb992b448f0a644f7fa2c2bded1 // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, pos.above(), (BlockState) ((BlockState) ((BlockState) this.defaultBlockState().setValue(BambooBlock.AGE, j)).setValue(BambooBlock.LEAVES, blockpropertybamboosize)).setValue(BambooBlock.STAGE, k), 3)) { -@@ -243,7 +243,7 @@ public class BambooBlock extends Block implements BonemealableBlock { +@@ -242,7 +242,7 @@ public class BambooBlock extends Block implements BonemealableBlock { protected int getHeightAboveUpToMax(BlockGetter world, BlockPos pos) { int i; @@ -77,7 +77,7 @@ index 7f40f6206f10a78fb74c19bd62c584f9f5c3e635..878b8fb992b448f0a644f7fa2c2bded1 ; } -@@ -253,7 +253,7 @@ public class BambooBlock extends Block implements BonemealableBlock { +@@ -252,7 +252,7 @@ public class BambooBlock extends Block implements BonemealableBlock { protected int getHeightBelowUpToMax(BlockGetter world, BlockPos pos) { int i; @@ -87,7 +87,7 @@ index 7f40f6206f10a78fb74c19bd62c584f9f5c3e635..878b8fb992b448f0a644f7fa2c2bded1 } diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java -index d6aad164b4910f86ff613db9b337ff174e69e4d7..722f1816cd4130fa4b1e2310badedc77ab96eee6 100644 +index a851df8e25781963edb066c46ae75a87ef63a66d..00ada22889dafb7ae8e8740cd3eb8370fbb417eb 100644 --- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java @@ -56,7 +56,7 @@ public class CactusBlock extends Block { @@ -100,7 +100,7 @@ index d6aad164b4910f86ff613db9b337ff174e69e4d7..722f1816cd4130fa4b1e2310badedc77 if (j >= (byte) range(3, ((100.0F / world.spigotConfig.cactusModifier) * 15) + 0.5F, 15)) { // Spigot diff --git a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java -index 77e9c50d2c64e7c7a6e658a2dba8919953c1842c..dbd0147ad08fb825b10665859054f17c9125b621 100644 +index f57884fa5f0fbbdbf35c22e692da4f9b6f3f98cc..9b30b359f1559e5f97c3b2a7acffda5b39605e6b 100644 --- a/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SugarCaneBlock.java @@ -53,7 +53,7 @@ public class SugarCaneBlock extends Block { diff --git a/patches/unapplied/server/0013-Configurable-baby-zombie-movement-speed.patch b/patches/server/0013-Configurable-baby-zombie-movement-speed.patch similarity index 93% rename from patches/unapplied/server/0013-Configurable-baby-zombie-movement-speed.patch rename to patches/server/0013-Configurable-baby-zombie-movement-speed.patch index 0297ec242..4aade7f14 100644 --- a/patches/unapplied/server/0013-Configurable-baby-zombie-movement-speed.patch +++ b/patches/server/0013-Configurable-baby-zombie-movement-speed.patch @@ -25,10 +25,10 @@ index 3d9a805d01cea0b414446c0540ac9a4f86f1e1e3..d5a93adafc9e897b78f83102ea101d96 + } } diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index 998d11263b96f72a29787e5d58f4850e8cd5cdf7..6f990e39e696890d39c3ae94fd6a0ecf9513d710 100644 +index a58d2945beb3ed72ea0fb49c0d63c56afdafdcc8..42f3f632caba1897b762a6897923585901a63bd1 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -@@ -79,7 +79,7 @@ import org.bukkit.event.entity.EntityTransformEvent; +@@ -76,7 +76,7 @@ import org.bukkit.event.entity.EntityTransformEvent; public class Zombie extends Monster { private static final UUID SPEED_MODIFIER_BABY_UUID = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836"); @@ -37,7 +37,7 @@ index 998d11263b96f72a29787e5d58f4850e8cd5cdf7..6f990e39e696890d39c3ae94fd6a0ecf private static final EntityDataAccessor DATA_BABY_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.BOOLEAN); private static final EntityDataAccessor DATA_SPECIAL_TYPE_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.INT); public static final EntityDataAccessor DATA_DROWNED_CONVERSION_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.BOOLEAN); -@@ -187,9 +187,9 @@ public class Zombie extends Monster { +@@ -184,9 +184,9 @@ public class Zombie extends Monster { if (this.level != null && !this.level.isClientSide) { AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED); diff --git a/patches/unapplied/server/0014-Configurable-fishing-time-ranges.patch b/patches/server/0014-Configurable-fishing-time-ranges.patch similarity index 91% rename from patches/unapplied/server/0014-Configurable-fishing-time-ranges.patch rename to patches/server/0014-Configurable-fishing-time-ranges.patch index a81515675..35e6df5a3 100644 --- a/patches/unapplied/server/0014-Configurable-fishing-time-ranges.patch +++ b/patches/server/0014-Configurable-fishing-time-ranges.patch @@ -22,10 +22,10 @@ index d5a93adafc9e897b78f83102ea101d96c5bf2744..3b35d45881a041aaa7adea0ffc923792 + } } diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -index dde25bf5e4e6e6514a8141e4dee473d96eee83f5..b007efe91c0abef3e90179b67dfdaf999ced11d2 100644 +index 7a44f701c94878618963868bf63f4d6391842851..eaa3ed52a57b56fc0f260aadfd23c2fd6dfc0f51 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -@@ -83,6 +83,10 @@ public class FishingHook extends Projectile { +@@ -82,6 +82,10 @@ public class FishingHook extends Projectile { this.noCulling = true; this.luck = Math.max(0, lureLevel); this.lureSpeed = Math.max(0, luckOfTheSeaLevel); diff --git a/patches/unapplied/server/0015-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch b/patches/server/0015-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch similarity index 86% rename from patches/unapplied/server/0015-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch rename to patches/server/0015-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch index a58e654c3..9b4b9c974 100644 --- a/patches/unapplied/server/0015-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch +++ b/patches/server/0015-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch @@ -19,10 +19,10 @@ index 3b35d45881a041aaa7adea0ffc92379208a138b7..a6f0e2193f930cf4f1e38ac30e92a7f7 + } } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 70154157221dcdd0d228a934aee2213d4ea2545a..40f644f25bb0489631765f5768317e20a7997eb4 100644 +index bab72d3d0395fc6a137975982799341626626bc0..969017958ff8ea6d8efba261ce1fe6e5c3a3f518 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -1270,6 +1270,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -1299,6 +1299,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i return this.isInWater() || this.isInRain(); } @@ -31,18 +31,18 @@ index 70154157221dcdd0d228a934aee2213d4ea2545a..40f644f25bb0489631765f5768317e20 return this.isInWater() || this.isInRain() || this.isInBubbleColumn(); } diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index d0047fc5156f13c831ab4f23a429d567ed6a39ac..abaa57d9a4d222753d28801c6ab86b11c71aca6b 100644 +index f286fcc2958a02c1e480b8fcf5d049bf0de27131..9cc9c11f2ef5aa386711a0ebc70b6a2d8e5c5b97 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -104,6 +104,7 @@ public abstract class Mob extends LivingEntity { +@@ -105,6 +105,7 @@ public abstract class Mob extends LivingEntity { private final BodyRotationControl bodyRotationControl; protected PathNavigation navigation; public GoalSelector goalSelector; + @Nullable public net.minecraft.world.entity.ai.goal.FloatGoal goalFloat; // Paper public GoalSelector targetSelector; + @Nullable private LivingEntity target; - private final Sensing sensing; -@@ -799,7 +800,17 @@ public abstract class Mob extends LivingEntity { +@@ -802,7 +803,17 @@ public abstract class Mob extends LivingEntity { @Override protected final void serverAiStep() { ++this.noActionTime; @@ -62,7 +62,7 @@ index d0047fc5156f13c831ab4f23a429d567ed6a39ac..abaa57d9a4d222753d28801c6ab86b11 this.sensing.tick(); this.level.getProfiler().pop(); diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java -index 54085b104547f2fe7c08ff8aa4839b1230877bca..08bb9a723dd11be66bec2e852dc345a22d926bea 100644 +index 01950951ea06e43bedeeede489a112e577617829..0e86eb2595cf9fbf24f789e0e9b4f05929d3164c 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/FloatGoal.java @@ -9,6 +9,7 @@ public class FloatGoal extends Goal { diff --git a/patches/unapplied/server/0016-Add-configurable-despawn-distances-for-living-entiti.patch b/patches/server/0016-Add-configurable-despawn-distances-for-living-entiti.patch similarity index 95% rename from patches/unapplied/server/0016-Add-configurable-despawn-distances-for-living-entiti.patch rename to patches/server/0016-Add-configurable-despawn-distances-for-living-entiti.patch index d73ee30d7..98b524c41 100644 --- a/patches/unapplied/server/0016-Add-configurable-despawn-distances-for-living-entiti.patch +++ b/patches/server/0016-Add-configurable-despawn-distances-for-living-entiti.patch @@ -65,13 +65,13 @@ index a6f0e2193f930cf4f1e38ac30e92a7f7cafb8413..6d1a880737c90da743fd772426b40500 + } } diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index abaa57d9a4d222753d28801c6ab86b11c71aca6b..867ada6ba562d9d3db6bf97cb3fd2c5a281f915f 100644 +index 9cc9c11f2ef5aa386711a0ebc70b6a2d8e5c5b97..d5d79927aeab04d24010b53f9b527fa7b05d8a47 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -775,14 +775,14 @@ public abstract class Mob extends LivingEntity { +@@ -778,14 +778,14 @@ public abstract class Mob extends LivingEntity { if (entityhuman != null) { - double d0 = entityhuman.distanceToSqr((Entity) this); // CraftBukkit - decompile error + double d0 = entityhuman.distanceToSqr((Entity) this); - int i = this.getType().getCategory().getDespawnDistance(); + int i = this.level.paperConfig.hardDespawnDistances.getInt(this.getType().getCategory()); // Paper - custom despawn distances int j = i * i; diff --git a/patches/unapplied/server/0017-Allow-for-toggling-of-spawn-chunks.patch b/patches/server/0017-Allow-for-toggling-of-spawn-chunks.patch similarity index 91% rename from patches/unapplied/server/0017-Allow-for-toggling-of-spawn-chunks.patch rename to patches/server/0017-Allow-for-toggling-of-spawn-chunks.patch index 597d0ad05..0a35763b7 100644 --- a/patches/unapplied/server/0017-Allow-for-toggling-of-spawn-chunks.patch +++ b/patches/server/0017-Allow-for-toggling-of-spawn-chunks.patch @@ -20,10 +20,10 @@ index 6d1a880737c90da743fd772426b4050036bdb926..8521772cf6cf9716093495cb8c41dfb7 + } } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 71cbc053a23e5404a2472f5e1e56484939c8413a..e8469eaad83932024a6f817674e0a50ae7df75aa 100644 +index 99685c3ad91ca0e3bf20fb6ca100466ec14b7a0f..e112598c854a2c93a8e6b6bda3cfdd4ee4091980 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -239,6 +239,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -240,6 +240,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { }); // CraftBukkit end timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings diff --git a/patches/unapplied/server/0018-Drop-falling-block-and-tnt-entities-at-the-specified.patch b/patches/server/0018-Drop-falling-block-and-tnt-entities-at-the-specified.patch similarity index 94% rename from patches/unapplied/server/0018-Drop-falling-block-and-tnt-entities-at-the-specified.patch rename to patches/server/0018-Drop-falling-block-and-tnt-entities-at-the-specified.patch index f311dfff3..d38f08c20 100644 --- a/patches/unapplied/server/0018-Drop-falling-block-and-tnt-entities-at-the-specified.patch +++ b/patches/server/0018-Drop-falling-block-and-tnt-entities-at-the-specified.patch @@ -25,10 +25,10 @@ index 8521772cf6cf9716093495cb8c41dfb7a649e741..1cfa6ae0a2fc42cd83c1323d49151ec2 + } } diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -index 27707ccea8763dbfdfe80da45f26127e58bc7316..91c0e425de193be1e4e9779d1c92c8ea577e29e0 100644 +index a292a449deb820ce1d7cbeb5d04702b10643ee50..1cc849fadd1e1cf4ef1d1009c8e42febe92a6e28 100644 --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -127,6 +127,17 @@ public class FallingBlockEntity extends Entity { +@@ -136,6 +136,17 @@ public class FallingBlockEntity extends Entity { } this.move(MoverType.SELF, this.getDeltaMovement()); @@ -47,7 +47,7 @@ index 27707ccea8763dbfdfe80da45f26127e58bc7316..91c0e425de193be1e4e9779d1c92c8ea blockposition = this.blockPosition(); boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock; diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java -index 540fe28b16ff0208e23ecdd50fc5fa05960c0299..394164f50256ad9a167e15531a9202875abb6cb6 100644 +index 9fa752370a43f6d91c019316914a033f213e7126..1f61dcc3d6f33f69fbebaaaee0554403c3e13adf 100644 --- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java +++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java @@ -68,6 +68,12 @@ public class PrimedTnt extends Entity { diff --git a/patches/unapplied/server/0019-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/patches/server/0019-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch similarity index 94% rename from patches/unapplied/server/0019-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch rename to patches/server/0019-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index 423e9cb4e..9bed877f1 100644 --- a/patches/unapplied/server/0019-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/patches/server/0019-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -19,10 +19,10 @@ index 2c53a400611c78236c5a1c1270d27c02e94251bf..a1d5c0f8fe2adb2ee56f3217e089211e if (outputStream != null) { try { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index e6afb76adc428dc1e919a1255a43b8d96aefd79b..e6be4991f07a9cd59946d501c002fd9113b46af0 100644 +index 37ace477c170be9453ab65976085837faa312255..15163398f96b4eda94d99b4b48ab2b06622bd2af 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1444,7 +1444,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop CAN_BE_COLLIDED_WITH = EntitySelector.NO_SPECTATORS.and(Entity::canBeCollidedWith); private EntitySelector() {} + // Paper start @@ -21,10 +21,10 @@ index 195989667c7d844399a72787819f62a3fd0d9c78..d17b75ad13bbc8a38cdc2f2d77ee5d88 public static Predicate withinDistance(double x, double y, double z, double max) { double d4 = max * max; diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index c9a9a4c6ba930dedb227c1f1d4ca4bb520983854..5dbc90cf67ee88d2f7043c38eaad4fc5874606b5 100644 +index d5d79927aeab04d24010b53f9b527fa7b05d8a47..a2310dc7b045d4e4c3924d656a4dcf0a1d66c095 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -771,7 +771,7 @@ public abstract class Mob extends LivingEntity { +@@ -774,7 +774,7 @@ public abstract class Mob extends LivingEntity { if (this.level.getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) { this.discard(); } else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) { @@ -32,12 +32,12 @@ index c9a9a4c6ba930dedb227c1f1d4ca4bb520983854..5dbc90cf67ee88d2f7043c38eaad4fc5 + Player entityhuman = this.level.findNearbyPlayer(this, -1.0D, EntitySelector.affectsSpawning); // Paper if (entityhuman != null) { - double d0 = entityhuman.distanceToSqr((Entity) this); // CraftBukkit - decompile error + double d0 = entityhuman.distanceToSqr((Entity) this); diff --git a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java -index 5b028cd78fd8584568836cbd7b3ca4b62dce5af8..aec7dd2df77efeaf65d9fe08adc668030dfe08e2 100644 +index 53106d7bbfeaaf52bbe69471e70670412e8bdfd3..195cdae3f3a9fe8ecab2895a6000f6f855e9a9b8 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Silverfish.java +++ b/src/main/java/net/minecraft/world/entity/monster/Silverfish.java -@@ -123,7 +123,7 @@ public class Silverfish extends Monster { +@@ -125,7 +125,7 @@ public class Silverfish extends Monster { if (checkAnyLightMonsterSpawnRules(type, world, spawnReason, pos, random)) { Player entityhuman = world.getNearestPlayer((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, 5.0D, true); @@ -47,10 +47,10 @@ index 5b028cd78fd8584568836cbd7b3ca4b62dce5af8..aec7dd2df77efeaf65d9fe08adc66803 return false; } diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 4ba15f9cea1277939807d34b3a947f2b26d25d98..1bdaa8d1a65b11175801f47ddfe15bffee6143bf 100644 +index d149ecefb0ee379f3fa7e64e4d70bdd23adbd49b..5d37c82bd5cd20aa2d452f0214f3303768e36a3d 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -176,6 +176,9 @@ public abstract class Player extends LivingEntity { +@@ -174,6 +174,9 @@ public abstract class Player extends LivingEntity { private final ItemCooldowns cooldowns; @Nullable public FishingHook fishing; @@ -61,10 +61,10 @@ index 4ba15f9cea1277939807d34b3a947f2b26d25d98..1bdaa8d1a65b11175801f47ddfe15bff // CraftBukkit start public boolean fauxSleeping; diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 03bdbb832ff6a86f2dac9c008de45f3bb53aa688..a003e1c0d99a4d4c88269ea5bad250ba73bbc9c9 100644 +index a0ac89c6b27b2de0055e551df613247b23288b6c..b3a4c907bb15907d82e58247cb049e3f9fcf990e 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java -@@ -77,7 +77,7 @@ public abstract class BaseSpawner { +@@ -51,7 +51,7 @@ public abstract class BaseSpawner { } private boolean isNearPlayer(Level world, BlockPos pos) { @@ -74,7 +74,7 @@ index 03bdbb832ff6a86f2dac9c008de45f3bb53aa688..a003e1c0d99a4d4c88269ea5bad250ba public void clientTick(Level world, BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java -index 389985e022b82c675fb21f363422471bd15b84b0..849616d9ad140285f7aa4d2ffafd6371f3904bd5 100644 +index c65d1dc6eb0c1fc7c4a91faf0f1c6f26b3c2a76e..0dc46471f7247e5d36c3896a0c87473072362fe6 100644 --- a/src/main/java/net/minecraft/world/level/EntityGetter.java +++ b/src/main/java/net/minecraft/world/level/EntityGetter.java @@ -71,8 +71,8 @@ public interface EntityGetter { @@ -117,10 +117,10 @@ index 389985e022b82c675fb21f363422471bd15b84b0..849616d9ad140285f7aa4d2ffafd6371 for(Player player : this.players()) { if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player)) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 63abd7058bd770724145526a89a539f064079b81..b139868f1c84a97d145634d37cf0f658871f93c6 100644 +index b534eae34da93b2764ac577438c49559529560ca..6b945d22a84b77f835500ea8215748de24d5a00d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1791,8 +1791,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1778,8 +1778,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public String getLocale() { return this.getHandle().locale; diff --git a/patches/server/0023-Remove-invalid-mob-spawner-tile-entities.patch b/patches/server/0023-Remove-invalid-mob-spawner-tile-entities.patch new file mode 100644 index 000000000..f37d7e089 --- /dev/null +++ b/patches/server/0023-Remove-invalid-mob-spawner-tile-entities.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Byteflux +Date: Tue, 1 Mar 2016 15:08:03 -0600 +Subject: [PATCH] Remove invalid mob spawner tile entities + + +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 8278f85964b8a7c954a5d4746795b6870ca3cea1..3e4ece7b607d06c9d88322ce79f4888e1cc07aee 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +@@ -541,6 +541,11 @@ public class LevelChunk extends ChunkAccess { + } + + // CraftBukkit start ++ // Paper start - Remove invalid mob spawner tile entities ++ } else if (blockEntity instanceof net.minecraft.world.level.block.entity.SpawnerBlockEntity ++ && !(getBlockState(blockposition).getBlock() instanceof net.minecraft.world.level.block.SpawnerBlock)) { ++ this.removeBlockEntity(blockEntity.getBlockPos()); ++ // Paper end + } else { + System.out.println("Attempted to place a tile entity (" + blockEntity + ") at " + blockEntity.getBlockPos().getX() + "," + blockEntity.getBlockPos().getY() + "," + blockEntity.getBlockPos().getZ() + + " (" + this.getBlockState(blockposition) + ") where there was no entity tile!"); diff --git a/patches/unapplied/server/0023-Remove-invalid-mob-spawner-tile-entities.patch b/patches/unapplied/server/0023-Remove-invalid-mob-spawner-tile-entities.patch deleted file mode 100644 index 3b8417254..000000000 --- a/patches/unapplied/server/0023-Remove-invalid-mob-spawner-tile-entities.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Tue, 1 Mar 2016 15:08:03 -0600 -Subject: [PATCH] Remove invalid mob spawner tile entities - - -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 4a13b18ce609fc6a86da48b0673ccf9d3e0d8292..be1d7d2be46c746b593c3842030412940e2e57f8 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -46,10 +46,12 @@ import net.minecraft.world.level.TickList; - import net.minecraft.world.level.block.Block; - import net.minecraft.world.level.block.Blocks; - import net.minecraft.world.level.block.EntityBlock; -+import net.minecraft.world.level.block.SpawnerBlock; - import net.minecraft.world.level.block.entity.BlockEntity; - import net.minecraft.world.level.block.entity.BlockEntityTicker; - import net.minecraft.world.level.block.entity.BlockEntityType; - import net.minecraft.world.level.block.entity.TickingBlockEntity; -+import net.minecraft.world.level.block.entity.SpawnerBlockEntity; - import net.minecraft.world.level.block.state.BlockState; - import net.minecraft.world.level.gameevent.EuclideanGameEventDispatcher; - import net.minecraft.world.level.gameevent.GameEventDispatcher; -@@ -608,6 +610,10 @@ public class LevelChunk implements ChunkAccess { - } - - // CraftBukkit start -+ // Paper start - Remove invalid mob spawner tile entities -+ } else if (blockEntity instanceof SpawnerBlockEntity && !(getBlockState(blockposition).getBlock() instanceof SpawnerBlock)) { -+ this.removeBlockEntity(blockEntity.getBlockPos()); -+ // Paper end - } else { - System.out.println("Attempted to place a tile entity (" + blockEntity + ") at " + blockEntity.getBlockPos().getX() + "," + blockEntity.getBlockPos().getY() + "," + blockEntity.getBlockPos().getZ() - + " (" + this.getBlockState(blockposition) + ") where there was no entity tile!"); diff --git a/todo.txt b/todo.txt index 098ea2d92..324373e68 100644 --- a/todo.txt +++ b/todo.txt @@ -1 +1,2 @@ Add Timings to LevelTicks and EntityTickList +Check IBlockDataList#GLOBAL_PALETTE