diff --git a/patches/api-unmapped/0123-EntityTransformedEvent.patch b/patches/api/0125-EntityTransformedEvent.patch similarity index 100% rename from patches/api-unmapped/0123-EntityTransformedEvent.patch rename to patches/api/0125-EntityTransformedEvent.patch diff --git a/patches/api-unmapped/0124-Allow-disabling-armour-stand-ticking.patch b/patches/api/0126-Allow-disabling-armour-stand-ticking.patch similarity index 91% rename from patches/api-unmapped/0124-Allow-disabling-armour-stand-ticking.patch rename to patches/api/0126-Allow-disabling-armour-stand-ticking.patch index 30f0bf522..bb053752f 100644 --- a/patches/api-unmapped/0124-Allow-disabling-armour-stand-ticking.patch +++ b/patches/api/0126-Allow-disabling-armour-stand-ticking.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Allow disabling armour stand ticking diff --git a/src/main/java/org/bukkit/entity/ArmorStand.java b/src/main/java/org/bukkit/entity/ArmorStand.java -index fddc063798edc8084ca695578a47485204a7f3cd..365d3a3c5fc4a47efe56225ef1eb87b5046034f4 100644 +index de9ddd2c40261486ee8de6693d118cffaa2dd793..575f48213cd8df038e41bead4c9d0fcba717f40f 100644 --- a/src/main/java/org/bukkit/entity/ArmorStand.java +++ b/src/main/java/org/bukkit/entity/ArmorStand.java @@ -360,5 +360,21 @@ public interface ArmorStand extends LivingEntity { diff --git a/patches/api-unmapped/0125-SkeletonHorse-Additions.patch b/patches/api/0127-SkeletonHorse-Additions.patch similarity index 100% rename from patches/api-unmapped/0125-SkeletonHorse-Additions.patch rename to patches/api/0127-SkeletonHorse-Additions.patch diff --git a/patches/api-unmapped/0126-Expand-Location-Manipulation-API.patch b/patches/api/0128-Expand-Location-Manipulation-API.patch similarity index 100% rename from patches/api-unmapped/0126-Expand-Location-Manipulation-API.patch rename to patches/api/0128-Expand-Location-Manipulation-API.patch diff --git a/patches/api-unmapped/0127-Expand-ArmorStand-API.patch b/patches/api/0129-Expand-ArmorStand-API.patch similarity index 97% rename from patches/api-unmapped/0127-Expand-ArmorStand-API.patch rename to patches/api/0129-Expand-ArmorStand-API.patch index 036951f69..c57b85b93 100644 --- a/patches/api-unmapped/0127-Expand-ArmorStand-API.patch +++ b/patches/api/0129-Expand-ArmorStand-API.patch @@ -8,7 +8,7 @@ Add the following: - Enable/Disable slot interactions diff --git a/src/main/java/org/bukkit/entity/ArmorStand.java b/src/main/java/org/bukkit/entity/ArmorStand.java -index 365d3a3c5fc4a47efe56225ef1eb87b5046034f4..8ca6c9eba926f436203af211c6e274a59ddb15e8 100644 +index 575f48213cd8df038e41bead4c9d0fcba717f40f..2f0c6af7fa6688a98d6aa0bd3f0e6556af8330d0 100644 --- a/src/main/java/org/bukkit/entity/ArmorStand.java +++ b/src/main/java/org/bukkit/entity/ArmorStand.java @@ -13,7 +13,7 @@ public interface ArmorStand extends LivingEntity { diff --git a/patches/api-unmapped/0128-AnvilDamageEvent.patch b/patches/api/0130-AnvilDamageEvent.patch similarity index 100% rename from patches/api-unmapped/0128-AnvilDamageEvent.patch rename to patches/api/0130-AnvilDamageEvent.patch diff --git a/patches/api-unmapped/0129-Remove-deadlock-risk-in-firing-async-events.patch b/patches/api/0131-Remove-deadlock-risk-in-firing-async-events.patch similarity index 86% rename from patches/api-unmapped/0129-Remove-deadlock-risk-in-firing-async-events.patch rename to patches/api/0131-Remove-deadlock-risk-in-firing-async-events.patch index 2725c79f2..27e5ca7df 100644 --- a/patches/api-unmapped/0129-Remove-deadlock-risk-in-firing-async-events.patch +++ b/patches/api/0131-Remove-deadlock-risk-in-firing-async-events.patch @@ -15,21 +15,8 @@ which results in a hard crash. This change removes the synchronize and adds some protection around enable/disable -diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 9b8823279524d1c1566176c589aa5794eb8aafbc..707638c327077a74c777a603b9f2392f46b51c0c 100644 ---- a/src/main/java/org/bukkit/entity/Entity.java -+++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -28,7 +28,7 @@ import org.jetbrains.annotations.Nullable; - */ - public interface Entity extends Metadatable, CommandSender, Nameable, PersistentDataHolder, net.kyori.adventure.text.event.HoverEventSource { // Paper - -- /** -+ /* - * Gets the entity's current position - * - * @return a new copy of Location containing the position of this entity diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index a7393d2830b95d7167121b02066a3f357cee6085..a1a805004941d67abb0b9aa1721e0370c45b5289 100644 +index 892ec4b43cc97a235df0819d30391a8a3770cbcb..b83637f872be5fc73500b10c917d71802976b340 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java @@ -462,7 +462,7 @@ public final class SimplePluginManager implements PluginManager { diff --git a/patches/api-unmapped/0130-Add-hand-to-bucket-events.patch b/patches/api/0132-Add-hand-to-bucket-events.patch similarity index 100% rename from patches/api-unmapped/0130-Add-hand-to-bucket-events.patch rename to patches/api/0132-Add-hand-to-bucket-events.patch diff --git a/patches/api-unmapped/0131-Add-TNTPrimeEvent.patch b/patches/api/0133-Add-TNTPrimeEvent.patch similarity index 100% rename from patches/api-unmapped/0131-Add-TNTPrimeEvent.patch rename to patches/api/0133-Add-TNTPrimeEvent.patch diff --git a/patches/api-unmapped/0132-Provide-Chunk-Coordinates-as-a-Long-API.patch b/patches/api/0134-Provide-Chunk-Coordinates-as-a-Long-API.patch similarity index 96% rename from patches/api-unmapped/0132-Provide-Chunk-Coordinates-as-a-Long-API.patch rename to patches/api/0134-Provide-Chunk-Coordinates-as-a-Long-API.patch index 3616f82f0..17690209a 100644 --- a/patches/api-unmapped/0132-Provide-Chunk-Coordinates-as-a-Long-API.patch +++ b/patches/api/0134-Provide-Chunk-Coordinates-as-a-Long-API.patch @@ -44,7 +44,7 @@ index beac1439c71fb28f1a3baecf56157237e12ccfd5..fa576096e908f8fbdbef53e1bd91215a * Gets the world containing this chunk * diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 9c4f2d9e1a4011e3a9860d913e1a718030696bed..e372b3d43960ac7df58985609ef729c68fca0533 100644 +index a7bd869fb5b8e35274eee0d8dae9dd6fe3c1c540..85c9ea1241d580386be00fb85ea1446addd376c4 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -207,6 +207,22 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad diff --git a/patches/api-unmapped/0134-Make-EnderDragon-extend-Mob.patch b/patches/api/0135-Make-EnderDragon-extend-Mob.patch similarity index 100% rename from patches/api-unmapped/0134-Make-EnderDragon-extend-Mob.patch rename to patches/api/0135-Make-EnderDragon-extend-Mob.patch diff --git a/patches/api-unmapped/0135-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch b/patches/api/0136-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch similarity index 100% rename from patches/api-unmapped/0135-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch rename to patches/api/0136-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch diff --git a/patches/api-unmapped/0136-Don-t-use-snapshots-for-Timings-Tile-Entity-reports.patch b/patches/api/0137-Don-t-use-snapshots-for-Timings-Tile-Entity-reports.patch similarity index 100% rename from patches/api-unmapped/0136-Don-t-use-snapshots-for-Timings-Tile-Entity-reports.patch rename to patches/api/0137-Don-t-use-snapshots-for-Timings-Tile-Entity-reports.patch diff --git a/patches/api-unmapped/0137-Allow-Blocks-to-be-accessed-via-a-long-key.patch b/patches/api/0138-Allow-Blocks-to-be-accessed-via-a-long-key.patch similarity index 96% rename from patches/api-unmapped/0137-Allow-Blocks-to-be-accessed-via-a-long-key.patch rename to patches/api/0138-Allow-Blocks-to-be-accessed-via-a-long-key.patch index 568d6bcd6..d9fc1f8e5 100644 --- a/patches/api-unmapped/0137-Allow-Blocks-to-be-accessed-via-a-long-key.patch +++ b/patches/api/0138-Allow-Blocks-to-be-accessed-via-a-long-key.patch @@ -48,7 +48,7 @@ index 369ce9ff6c8bb97a64a8e229115564412e6e7654..e700875beb76dadd55b585aca748338d * @return A new location where X/Y/Z are the center of the block */ diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 3f231c28842f02f80fd3136c36fe99b41726137f..d8674c773d61517f79d0fe77276392e47fd3e1e1 100644 +index 85c9ea1241d580386be00fb85ea1446addd376c4..4f563c6afc3568a5a45594bcc87790eeefc4148d 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -90,6 +90,38 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad @@ -91,7 +91,7 @@ index 3f231c28842f02f80fd3136c36fe99b41726137f..d8674c773d61517f79d0fe77276392e4 * Gets the highest non-empty (impassable) coordinate at the given * coordinates. diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index e89c8079625525667f496c06207da655fe43d749..d6f74dbcfeb153d4b17be2827e2989f2d8160d21 100644 +index 969a6cf404d99c186e73321659240195b8650ffc..b090938f883c486e703cb7c036c47925f3016704 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java @@ -153,6 +153,72 @@ public interface Block extends Metadatable { diff --git a/patches/api-unmapped/0138-Slime-Pathfinder-Events.patch b/patches/api/0139-Slime-Pathfinder-Events.patch similarity index 100% rename from patches/api-unmapped/0138-Slime-Pathfinder-Events.patch rename to patches/api/0139-Slime-Pathfinder-Events.patch diff --git a/patches/api-unmapped/0141-Add-PhantomPreSpawnEvent.patch b/patches/api/0140-Add-PhantomPreSpawnEvent.patch similarity index 100% rename from patches/api-unmapped/0141-Add-PhantomPreSpawnEvent.patch rename to patches/api/0140-Add-PhantomPreSpawnEvent.patch diff --git a/patches/api-unmapped/0140-Add-More-Creeper-API.patch b/patches/api/0141-Add-More-Creeper-API.patch similarity index 100% rename from patches/api-unmapped/0140-Add-More-Creeper-API.patch rename to patches/api/0141-Add-More-Creeper-API.patch diff --git a/patches/api-unmapped/0139-isChunkGenerated-API.patch b/patches/api/0142-isChunkGenerated-API.patch similarity index 88% rename from patches/api-unmapped/0139-isChunkGenerated-API.patch rename to patches/api/0142-isChunkGenerated-API.patch index a26301e9c..ce9303e15 100644 --- a/patches/api-unmapped/0139-isChunkGenerated-API.patch +++ b/patches/api/0142-isChunkGenerated-API.patch @@ -34,13 +34,14 @@ index e700875beb76dadd55b585aca748338def286908..9c91c49ed7302c12fcb1d8e9bc58712e /** * Sets the position of this Location and returns itself diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index d8674c773d61517f79d0fe77276392e47fd3e1e1..cf831f96efa302f789cf26a384a091df51215a76 100644 +index 4f563c6afc3568a5a45594bcc87790eeefc4148d..868e34482a3a5773dfbdc80b36adcee25239614a 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java -@@ -254,6 +254,17 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad +@@ -253,6 +253,17 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad + public default Chunk getChunkAt(long chunkKey) { return getChunkAt((int) chunkKey, (int) (chunkKey >> 32)); } - ++ + /** + * Checks if a {@link Chunk} has been generated at the specified chunk key, + * which is the X and Z packed into a long. @@ -51,7 +52,6 @@ index d8674c773d61517f79d0fe77276392e47fd3e1e1..cf831f96efa302f789cf26a384a091df + public default boolean isChunkGenerated(long chunkKey) { + return isChunkGenerated((int) chunkKey, (int) (chunkKey >> 32)); + } -+ + // Paper end + /** - * This is the Legacy API before Java 8 was supported. Java 8 Consumer is provided, - * as well as future support diff --git a/patches/api-unmapped/0142-Add-source-block-to-BlockPhysicsEvent.patch b/patches/api/0143-Add-source-block-to-BlockPhysicsEvent.patch similarity index 100% rename from patches/api-unmapped/0142-Add-source-block-to-BlockPhysicsEvent.patch rename to patches/api/0143-Add-source-block-to-BlockPhysicsEvent.patch diff --git a/patches/api-unmapped/0143-Inventory-removeItemAnySlot.patch b/patches/api/0144-Inventory-removeItemAnySlot.patch similarity index 100% rename from patches/api-unmapped/0143-Inventory-removeItemAnySlot.patch rename to patches/api/0144-Inventory-removeItemAnySlot.patch diff --git a/patches/server-remapped/0250-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch b/patches/removed/1.17/0250-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch similarity index 98% rename from patches/server-remapped/0250-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch rename to patches/removed/1.17/0250-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch index a8a2ab743..802c1e0e2 100644 --- a/patches/server-remapped/0250-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch +++ b/patches/removed/1.17/0250-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch @@ -4,6 +4,7 @@ Date: Mon, 23 Jul 2018 22:18:31 -0400 Subject: [PATCH] Mark chunk dirty anytime entities change to guarantee it saves +Useless in 1.17 - leaf 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 d69ccb1f31f31ebeee477df20ce1410f9e485eb7..bd9b19d988ecf72e099efeff6ec3483a352174ec 100644 diff --git a/patches/server-remapped/0251-Add-some-Debug-to-Chunk-Entity-slices.patch b/patches/removed/1.17/0251-Add-some-Debug-to-Chunk-Entity-slices.patch similarity index 99% rename from patches/server-remapped/0251-Add-some-Debug-to-Chunk-Entity-slices.patch rename to patches/removed/1.17/0251-Add-some-Debug-to-Chunk-Entity-slices.patch index 1978f629c..562e66310 100644 --- a/patches/server-remapped/0251-Add-some-Debug-to-Chunk-Entity-slices.patch +++ b/patches/removed/1.17/0251-Add-some-Debug-to-Chunk-Entity-slices.patch @@ -8,6 +8,8 @@ If we detect unexpected state, log and try to recover This should hopefully avoid duplicate entities ever being created if the entity was to end up in 2 different chunk slices +Useless in 1.17 + diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index a2cc3e58d59ed3d9f443b77c44d8200cc09b4da9..7847078c54154e28ab066ea8a329f929df1e1a37 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/patches/server-remapped/0253-Prevent-Saving-Bad-entities-to-chunks.patch b/patches/removed/1.17/0253-Prevent-Saving-Bad-entities-to-chunks.patch similarity index 99% rename from patches/server-remapped/0253-Prevent-Saving-Bad-entities-to-chunks.patch rename to patches/removed/1.17/0253-Prevent-Saving-Bad-entities-to-chunks.patch index 946c60832..bf9a9d15a 100644 --- a/patches/server-remapped/0253-Prevent-Saving-Bad-entities-to-chunks.patch +++ b/patches/removed/1.17/0253-Prevent-Saving-Bad-entities-to-chunks.patch @@ -17,6 +17,8 @@ an invalid entity. This should reduce log occurrences of dupe uuid messages. +1.17, not a concern anymore + diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java index a5d7781b13a6d61238d026f064512f7162e1e868..8e8e5f30c512ed7d8ee987550c22d3e9df845043 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/patches/server-remapped/0255-Ignore-Dead-Entities-in-entityList-iteration.patch b/patches/removed/1.17/0255-Ignore-Dead-Entities-in-entityList-iteration.patch similarity index 99% rename from patches/server-remapped/0255-Ignore-Dead-Entities-in-entityList-iteration.patch rename to patches/removed/1.17/0255-Ignore-Dead-Entities-in-entityList-iteration.patch index ae6ea8935..b80a13b2b 100644 --- a/patches/server-remapped/0255-Ignore-Dead-Entities-in-entityList-iteration.patch +++ b/patches/removed/1.17/0255-Ignore-Dead-Entities-in-entityList-iteration.patch @@ -10,6 +10,8 @@ methods will return dead entities that they shouldn't otherwise be doing. This will ensure that dead entities are skipped from iteration since they shouldn't of been in the list in the first place. +Not relevant in 1.17 + diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java index e95b91cefb0374bd5bb57cc090f5ecd566d7a618..8fd716bf2e1402694798b8be03fd85821153be44 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java diff --git a/patches/server-remapped/0260-Add-hand-to-bucket-events.patch b/patches/server-remapped/0260-Add-hand-to-bucket-events.patch deleted file mode 100644 index 80b6896fe..000000000 --- a/patches/server-remapped/0260-Add-hand-to-bucket-events.patch +++ /dev/null @@ -1,341 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Thu, 2 Aug 2018 08:44:35 -0500 -Subject: [PATCH] Add hand to bucket events - - -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d34da1eb172a7dcda564680afecf3dc145bf09f3..125a75576442eaa4f1ff6dd153bdb31097497a3f 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -724,7 +724,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop cachedSingleHashSet; // Paper - - public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ServerPlayerGameMode interactionManager) { -- super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile); -+ super(world, world.getSpawn(), world.getSharedSpawnAngle(), profile); - this.respawnDimension = Level.OVERWORLD; - interactionManager.player = this; - this.gameMode = interactionManager; -@@ -254,7 +254,7 @@ public class ServerPlayer extends Player implements ContainerListener { - // Yes, this doesn't match Vanilla, but it's the best we can do for now. - // If this is an issue, PRs are welcome - public final BlockPos getSpawnPoint(ServerLevel worldserver) { -- BlockPos blockposition = worldserver.getSharedSpawnPos(); -+ BlockPos blockposition = worldserver.getSpawn(); - - if (worldserver.dimensionType().hasSkyLight() && worldserver.worldDataServer.getGameType() != GameType.ADVENTURE) { - int i = Math.max(0, this.server.getSpawnRadius(worldserver)); -@@ -291,7 +291,7 @@ public class ServerPlayer extends Player implements ContainerListener { - // CraftBukkit end - - private void fudgeSpawnLocation(ServerLevel world) { -- BlockPos blockposition = world.getSharedSpawnPos(); -+ BlockPos blockposition = world.getSpawn(); - - if (world.dimensionType().hasSkyLight() && world.worldDataServer.getGameType() != GameType.ADVENTURE) { // CraftBukkit - int i = Math.max(0, this.server.getSpawnRadius(world)); -@@ -464,7 +464,7 @@ public class ServerPlayer extends Player implements ContainerListener { - } - if (world == null || position == null) { - world = ((CraftWorld) Bukkit.getServer().getWorlds().get(0)).getHandle(); -- position = Vec3.atCenterOf(((ServerLevel) world).getSharedSpawnPos()); -+ position = Vec3.atCenterOf(((ServerLevel) world).getSpawn()); - } - this.level = world; - this.setPos(position.x(), position.y(), position.z()); -diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 51b1ce465d23b971f7e08a3175319a33183d0398..0bb397407b55bd1c464ac603ec4c189045aabbb2 100644 ---- a/src/main/java/net/minecraft/server/players/PlayerList.java -+++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -808,7 +808,7 @@ public abstract class PlayerList { - entityplayer1.setShiftKeyDown(false); - - // entityplayer1.playerConnection.a(entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.yaw, entityplayer1.pitch); -- entityplayer1.connection.send(new ClientboundSetDefaultSpawnPositionPacket(worldserver1.getSharedSpawnPos(), worldserver1.getSharedSpawnAngle())); -+ entityplayer1.connection.send(new ClientboundSetDefaultSpawnPositionPacket(worldserver1.getSpawn(), worldserver1.getSharedSpawnAngle())); - entityplayer1.connection.send(new ClientboundChangeDifficultyPacket(worlddata.getDifficulty(), worlddata.isDifficultyLocked())); - entityplayer1.connection.send(new ClientboundSetExperiencePacket(entityplayer1.experienceProgress, entityplayer1.totalExperience, entityplayer1.experienceLevel)); - this.sendLevelInfo(entityplayer1, worldserver1); -@@ -1090,7 +1090,7 @@ public abstract class PlayerList { - - player.connection.send(new ClientboundSetBorderPacket(worldborder, ClientboundSetBorderPacket.Type.INITIALIZE)); - player.connection.send(new ClientboundSetTimePacket(world.getGameTime(), world.getDayTime(), world.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); -- player.connection.send(new ClientboundSetDefaultSpawnPositionPacket(world.getSharedSpawnPos(), world.getSharedSpawnAngle())); -+ player.connection.send(new ClientboundSetDefaultSpawnPositionPacket(world.getSpawn(), world.getSharedSpawnAngle())); - if (world.isRaining()) { - // CraftBukkit start - handle player weather - // entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.b, 0.0F)); -diff --git a/src/main/java/net/minecraft/server/rcon/RconConsoleSource.java b/src/main/java/net/minecraft/server/rcon/RconConsoleSource.java -index c283ea9528493fb95088870c84c6d6e3963aabb7..2633aca30601682a53b0236b94a12f0f18a87fc2 100644 ---- a/src/main/java/net/minecraft/server/rcon/RconConsoleSource.java -+++ b/src/main/java/net/minecraft/server/rcon/RconConsoleSource.java -@@ -33,7 +33,7 @@ public class RconConsoleSource implements CommandSource { - public CommandSourceStack createCommandSourceStack() { - ServerLevel worldserver = this.server.overworld(); - -- return new CommandSourceStack(this, Vec3.atLowerCornerOf((Vec3i) worldserver.getSharedSpawnPos()), Vec2.ZERO, worldserver, 4, "Rcon", RconConsoleSource.RCON_COMPONENT, this.server, (Entity) null); -+ return new CommandSourceStack(this, Vec3.atLowerCornerOf((Vec3i) worldserver.getSpawn()), Vec2.ZERO, worldserver, 4, "Rcon", RconConsoleSource.RCON_COMPONENT, this.server, (Entity) null); - } - - // CraftBukkit start - Send a String -diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 5bf6bc6a01ccde8a4d67b49293bb326cb09248d8..4503bd65b3454bad94bb7b869f4e72e3121d8a3d 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2688,7 +2688,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s - if (flag1) { - blockposition1 = ServerLevel.END_SPAWN_POINT; - } else { -- blockposition1 = destination.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, destination.getSharedSpawnPos()); -+ blockposition1 = destination.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, destination.getSpawn()); - } - // CraftBukkit start - CraftPortalEvent event = callPortalEvent(this, destination, blockposition1, PlayerTeleportEvent.TeleportCause.END_PORTAL, 0, 0); -diff --git a/src/main/java/net/minecraft/world/entity/animal/Cow.java b/src/main/java/net/minecraft/world/entity/animal/Cow.java -index 90393bb196c0895f387259c2dccbb29e2ca11c87..9c67b603d4d0ee5cb7f86b25ed8754afaf9cf7b3 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/Cow.java -+++ b/src/main/java/net/minecraft/world/entity/animal/Cow.java -@@ -87,7 +87,7 @@ public class Cow extends Animal { - - if (itemstack.getItem() == Items.BUCKET && !this.isBaby()) { - // CraftBukkit start - Got milk? -- org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) player.level, player, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET); -+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) player.level, player, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET, hand); // Paper - add enumHand - - if (event.isCancelled()) { - return InteractionResult.PASS; -diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java -index b426e155d13a1b2eb5ddb24a2d83cd7d1e92026b..d0e847e58483695d2af1c1410826bb25231cd6f6 100644 ---- a/src/main/java/net/minecraft/world/item/BucketItem.java -+++ b/src/main/java/net/minecraft/world/item/BucketItem.java -@@ -69,7 +69,7 @@ public class BucketItem extends Item { - if (iblockdata.getBlock() instanceof BucketPickup) { - // CraftBukkit start - Fluid dummyFluid = ((BucketPickup) iblockdata.getBlock()).takeLiquid(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); -- PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) world, user, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.getBucket()); -+ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) world, user, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.getBucket(), hand); // Paper - add enumhand - - if (event.isCancelled()) { - ((ServerPlayer) user).connection.send(new ClientboundBlockUpdatePacket(world, blockposition)); // SPIGOT-5163 (see PlayerInteractManager) -@@ -97,7 +97,7 @@ public class BucketItem extends Item { - iblockdata = world.getBlockState(blockposition); - BlockPos blockposition2 = iblockdata.getBlock() instanceof LiquidBlockContainer && this.content == Fluids.WATER ? blockposition : blockposition1; - -- if (this.a(user, world, blockposition2, movingobjectpositionblock1, movingobjectpositionblock1.getDirection(), blockposition, itemstack)) { // CraftBukkit -+ if (this.a(user, world, blockposition2, movingobjectpositionblock1, movingobjectpositionblock1.getDirection(), blockposition, itemstack, hand)) { // CraftBukkit // Paper - add enumhand - this.checkExtraContent(world, itemstack, blockposition2); - if (user instanceof ServerPlayer) { - CriteriaTriggers.PLACED_BLOCK.trigger((ServerPlayer) user, blockposition2, itemstack); -@@ -122,10 +122,12 @@ public class BucketItem extends Item { - public void checkExtraContent(Level world, ItemStack stack, BlockPos pos) {} - - public boolean emptyBucket(@Nullable Player player, Level world, BlockPos pos, @Nullable BlockHitResult movingobjectpositionblock) { -- return a(player, world, pos, movingobjectpositionblock, null, null, null); -+ // Paper start - add enumHand -+ return a(player, world, pos, movingobjectpositionblock, null, null, null, null); - } - -- public boolean a(Player entityhuman, Level world, BlockPos blockposition, @Nullable BlockHitResult movingobjectpositionblock, Direction enumdirection, BlockPos clicked, ItemStack itemstack) { -+ public boolean a(Player entityhuman, Level world, BlockPos blockposition, @Nullable BlockHitResult movingobjectpositionblock, Direction enumdirection, BlockPos clicked, ItemStack itemstack, InteractionHand enumhand) { -+ // Paper end - // CraftBukkit end - if (!(this.content instanceof FlowingFluid)) { - return false; -@@ -138,7 +140,7 @@ public class BucketItem extends Item { - - // CraftBukkit start - if (flag1 && entityhuman != null) { -- PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((ServerLevel) world, entityhuman, blockposition, clicked, enumdirection, itemstack); -+ PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((ServerLevel) world, entityhuman, blockposition, clicked, enumdirection, itemstack, enumhand); // Paper - add enumhand - if (event.isCancelled()) { - ((ServerPlayer) entityhuman).connection.send(new ClientboundBlockUpdatePacket(world, blockposition)); // SPIGOT-4238: needed when looking through entity - ((ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541 -@@ -147,7 +149,7 @@ public class BucketItem extends Item { - } - // CraftBukkit end - if (!flag1) { -- return movingobjectpositionblock != null && this.a(entityhuman, world, movingobjectpositionblock.getBlockPos().relative(movingobjectpositionblock.getDirection()), (BlockHitResult) null, enumdirection, clicked, itemstack); // CraftBukkit -+ return movingobjectpositionblock != null && this.a(entityhuman, world, movingobjectpositionblock.getBlockPos().relative(movingobjectpositionblock.getDirection()), (BlockHitResult) null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit // Paper - add enumhand - } else if (world.dimensionType().ultraWarm() && this.content.is((Tag) FluidTags.WATER)) { - int i = blockposition.getX(); - int j = blockposition.getY(); -diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 7a9ccd203885b9b369767d1fb8c53783201d0f0f..b75ffafb6840b6acab6e5b0ef5e222c4fa130977 100644 ---- a/src/main/java/net/minecraft/world/level/Level.java -+++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -277,6 +277,17 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - } - // Paper end - -+ // Paper start - moved up from WorldServer -+ public BlockPos getSpawn() { -+ BlockPos blockposition = new BlockPos(this.levelData.getXSpawn(), this.levelData.getYSpawn(), this.levelData.getZSpawn()); -+ -+ if (!this.getWorldBorder().isWithinBounds(blockposition)) { -+ blockposition = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, new BlockPos(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ())); -+ } -+ -+ return blockposition; -+ } -+ // Paper end - @Override - public boolean isClientSide() { - return this.isClientSide; -diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 8a71eaf2855be0d415d1f7b18dbec98353fe5b47..b90a275a0dc2913809ce16659eed445501e486de 100644 ---- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java -+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -@@ -268,7 +268,7 @@ public final class NaturalSpawner { - private static boolean isRightDistanceToPlayerAndSpawnPoint(ServerLevel world, ChunkAccess chunk, BlockPos.MutableBlockPos pos, double squaredDistance) { - if (squaredDistance <= 576.0D) { - return false; -- } else if (world.getSharedSpawnPos().closerThan((Position) (new Vec3((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D)), 24.0D)) { -+ } else if (world.getSpawn().closerThan((Position) (new Vec3((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D)), 24.0D)) { - return false; - } else { - ChunkPos chunkcoordintpair = new ChunkPos(pos); -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 9807612aed6c4393cbe1f4b6078e45bf1ba3deb2..159c32d6678e83f2d98ea6a1ad48346c9de017e1 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -327,7 +327,7 @@ public class CraftWorld implements World { - - @Override - public Location getSpawnLocation() { -- BlockPos spawn = world.getSharedSpawnPos(); -+ BlockPos spawn = world.getSpawn(); - return new Location(this, spawn.getX(), spawn.getY(), spawn.getZ()); - } - -@@ -1926,7 +1926,7 @@ public class CraftWorld implements World { - public void setKeepSpawnInMemory(boolean keepLoaded) { - world.keepSpawnInMemory = keepLoaded; - // Grab the worlds spawn chunk -- BlockPos chunkcoordinates = this.world.getSharedSpawnPos(); -+ BlockPos chunkcoordinates = this.world.getSpawn(); - if (keepLoaded) { - world.getChunkSource().addRegionTicket(TicketType.START, new ChunkPos(chunkcoordinates), 11, Unit.INSTANCE); - } else { -diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 4cd08821305590e21a01cc4dda05370c2b721ac2..1877267344df1ff5b4de6a4e0c239f488cd52c1f 100644 ---- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -222,7 +222,7 @@ public class CraftEventFactory { - public static Entity entityDamage; // For use in EntityDamageByEntityEvent - - // helper methods -- private static boolean canBuild(ServerLevel world, Player player, int x, int z) { -+ private static boolean canBuild(Level world, Player player, int x, int z) { - int spawnSize = Bukkit.getServer().getSpawnRadius(); - - if (world.dimension() != Level.OVERWORLD) return true; -@@ -230,7 +230,7 @@ public class CraftEventFactory { - if (((CraftServer) Bukkit.getServer()).getHandle().getOps().isEmpty()) return true; - if (player.isOp()) return true; - -- BlockPos chunkcoordinates = world.getSharedSpawnPos(); -+ BlockPos chunkcoordinates = world.getSpawn(); - - int distanceFromSpawn = Math.max(Math.abs(x - chunkcoordinates.getX()), Math.abs(z - chunkcoordinates.getZ())); - return distanceFromSpawn > spawnSize; -@@ -412,6 +412,20 @@ public class CraftEventFactory { - } - - private static PlayerEvent getPlayerBucketEvent(boolean isFilling, ServerLevel world, net.minecraft.world.entity.player.Player who, BlockPos changed, BlockPos clicked, Direction clickedFace, ItemStack itemstack, net.minecraft.world.item.Item item) { -+ // Paper start - add enumHand -+ return getPlayerBucketEvent(isFilling, world, who, changed, clicked, clickedFace, itemstack, item, null); -+ } -+ -+ public static PlayerBucketEmptyEvent callPlayerBucketEmptyEvent(Level world, net.minecraft.world.entity.player.Player who, BlockPos changed, BlockPos clicked, Direction clickedFace, ItemStack itemstack, InteractionHand enumHand) { -+ return (PlayerBucketEmptyEvent) getPlayerBucketEvent(false, world, who, changed, clicked, clickedFace, itemstack, Items.BUCKET, enumHand); -+ } -+ -+ public static PlayerBucketFillEvent callPlayerBucketFillEvent(Level world, net.minecraft.world.entity.player.Player who, BlockPos changed, BlockPos clicked, Direction clickedFace, ItemStack itemInHand, net.minecraft.world.item.Item bucket, InteractionHand enumHand) { -+ return (PlayerBucketFillEvent) getPlayerBucketEvent(true, world, who, clicked, changed, clickedFace, itemInHand, bucket, enumHand); -+ } -+ -+ private static PlayerEvent getPlayerBucketEvent(boolean isFilling, Level world, net.minecraft.world.entity.player.Player who, BlockPos changed, BlockPos clicked, Direction clickedFace, ItemStack itemstack, net.minecraft.world.item.Item item, InteractionHand enumHand) { -+ // Paper end - Player player = (Player) who.getBukkitEntity(); - CraftItemStack itemInHand = CraftItemStack.asNewCraftStack(item); - Material bucket = CraftMagicNumbers.getMaterial(itemstack.getItem()); -@@ -424,10 +438,10 @@ public class CraftEventFactory { - - PlayerEvent event; - if (isFilling) { -- event = new PlayerBucketFillEvent(player, block, blockClicked, blockFace, bucket, itemInHand); -+ event = new PlayerBucketFillEvent(player, block, blockClicked, blockFace, bucket, itemInHand, enumHand == null ? null : enumHand == InteractionHand.OFF_HAND ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND); // Paper - add enumHand - ((PlayerBucketFillEvent) event).setCancelled(!canBuild(world, player, changed.getX(), changed.getZ())); - } else { -- event = new PlayerBucketEmptyEvent(player, block, blockClicked, blockFace, bucket, itemInHand); -+ event = new PlayerBucketEmptyEvent(player, block, blockClicked, blockFace, bucket, itemInHand, enumHand == null ? null : enumHand == InteractionHand.OFF_HAND ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND); // Paper - add enumHand - ((PlayerBucketEmptyEvent) event).setCancelled(!canBuild(world, player, changed.getX(), changed.getZ())); - } - diff --git a/patches/server-remapped/0261-MC-135506-Experience-should-save-as-Integers.patch b/patches/server-remapped/0261-MC-135506-Experience-should-save-as-Integers.patch deleted file mode 100644 index 07dc1c1b3..000000000 --- a/patches/server-remapped/0261-MC-135506-Experience-should-save-as-Integers.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Fri, 3 Aug 2018 00:04:54 -0400 -Subject: [PATCH] MC-135506: Experience should save as Integers - - -diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -index 52b90ef3a145325209d3d903a2b7c9a44c332cbe..37758cff3c4a8406c2f1496ae827ecdc953cf9f4 100644 ---- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -@@ -217,7 +217,7 @@ public class ExperienceOrb extends Entity { - public void addAdditionalSaveData(CompoundTag tag) { - tag.putShort("Health", (short) this.health); - tag.putShort("Age", (short) this.age); -- tag.putShort("Value", (short) this.value); -+ tag.putInt("Value", this.value); // Paper - save as Integer - this.savePaperNBT(tag); // Paper - } - -@@ -225,7 +225,7 @@ public class ExperienceOrb extends Entity { - public void readAdditionalSaveData(CompoundTag tag) { - this.health = tag.getShort("Health"); - this.age = tag.getShort("Age"); -- this.value = tag.getShort("Value"); -+ this.value = tag.getInt("Value"); // Paper - load as Integer - this.loadPaperNBT(tag); // Paper - } - diff --git a/patches/server-remapped/0271-Slime-Pathfinder-Events.patch b/patches/server-remapped/0271-Slime-Pathfinder-Events.patch deleted file mode 100644 index 115607482..000000000 --- a/patches/server-remapped/0271-Slime-Pathfinder-Events.patch +++ /dev/null @@ -1,229 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Fri, 24 Aug 2018 08:18:42 -0500 -Subject: [PATCH] Slime Pathfinder Events - - -diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java -index fc8f26e988f1e4826dcfdcf071293bb356163e62..120ceb28ee3aee8a09cf67b45ac95d3d6613c133 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/Slime.java -+++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java -@@ -24,7 +24,6 @@ import net.minecraft.world.effect.MobEffects; - import net.minecraft.world.entity.Entity; - import net.minecraft.world.entity.EntityDimensions; - import net.minecraft.world.entity.EntityType; --import net.minecraft.world.entity.LivingEntity; - import net.minecraft.world.entity.Mob; - import net.minecraft.world.entity.MobSpawnType; - import net.minecraft.world.entity.Pose; -@@ -43,6 +42,13 @@ import net.minecraft.world.level.WorldGenLevel; - import net.minecraft.world.level.biome.Biomes; - import net.minecraft.world.level.levelgen.WorldgenRandom; - import net.minecraft.world.phys.Vec3; -+// Paper start -+import com.destroystokyo.paper.event.entity.SlimeChangeDirectionEvent; -+import com.destroystokyo.paper.event.entity.SlimeSwimEvent; -+import com.destroystokyo.paper.event.entity.SlimeTargetLivingEntityEvent; -+import com.destroystokyo.paper.event.entity.SlimeWanderEvent; -+import org.bukkit.entity.LivingEntity; -+// Paper end - // CraftBukkit start - import java.util.ArrayList; - import java.util.List; -@@ -103,6 +109,7 @@ public class Slime extends Mob implements Enemy { - @Override - public void addAdditionalSaveData(CompoundTag tag) { - super.addAdditionalSaveData(tag); -+ tag.putBoolean("Paper.canWander", this.canWander); // Paper - tag.putInt("Size", this.getSize() - 1); - tag.putBoolean("wasOnGround", this.wasOnGround); - } -@@ -117,6 +124,11 @@ public class Slime extends Mob implements Enemy { - - this.setSize(i + 1, false); - super.readAdditionalSaveData(tag); -+ // Paper start - check exists before loading or this will be loaded as false -+ if (tag.contains("Paper.canWander")) { -+ this.canWander = tag.getBoolean("Paper.canWander"); -+ } -+ // Paper end - this.wasOnGround = tag.getBoolean("wasOnGround"); - } - -@@ -218,7 +230,7 @@ public class Slime extends Mob implements Enemy { - super.remove(); - return; - } -- List slimes = new ArrayList<>(j); -+ List slimes = new ArrayList<>(j); - // CraftBukkit end - - for (int l = 0; l < k; ++l) { -@@ -242,7 +254,7 @@ public class Slime extends Mob implements Enemy { - if (CraftEventFactory.callEntityTransformEvent(this, slimes, EntityTransformEvent.TransformReason.SPLIT).isCancelled()) { - return; - } -- for (LivingEntity living : slimes) { -+ for (net.minecraft.world.entity.LivingEntity living : slimes) { - this.level.addEntity(living, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason - } - // CraftBukkit end -@@ -255,7 +267,7 @@ public class Slime extends Mob implements Enemy { - public void push(Entity entity) { - super.push(entity); - if (entity instanceof IronGolem && this.isDealsDamage()) { -- this.dealDamage((LivingEntity) entity); -+ this.dealDamage((net.minecraft.world.entity.LivingEntity) entity); - } - - } -@@ -263,18 +275,18 @@ public class Slime extends Mob implements Enemy { - @Override - public void playerTouch(Player player) { - if (this.isDealsDamage()) { -- this.dealDamage((LivingEntity) player); -+ this.dealDamage((net.minecraft.world.entity.LivingEntity) player); - } - - } - -- protected void dealDamage(LivingEntity target) { -+ protected void dealDamage(net.minecraft.world.entity.LivingEntity target) { - if (this.isAlive()) { - int i = this.getSize(); - - if (this.distanceToSqr((Entity) target) < 0.6D * (double) i * 0.6D * (double) i && this.canSee(target) && target.hurt(DamageSource.mobAttack(this), this.getAttackDamage())) { - this.playSound(SoundEvents.SLIME_ATTACK, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); -- this.doEnchantDamageEffects((LivingEntity) this, (Entity) target); -+ this.doEnchantDamageEffects((net.minecraft.world.entity.LivingEntity) this, (Entity) target); - } - } - -@@ -396,7 +408,7 @@ public class Slime extends Mob implements Enemy { - - @Override - public boolean canUse() { -- return !this.slime.isPassenger(); -+ return !this.slime.isPassenger() && this.slime.canWander && new SlimeWanderEvent((org.bukkit.entity.Slime) this.slime.getBukkitEntity()).callEvent(); // Paper - } - - @Override -@@ -417,7 +429,7 @@ public class Slime extends Mob implements Enemy { - - @Override - public boolean canUse() { -- return (this.slime.isInWater() || this.slime.isInLava()) && this.slime.getMoveControl() instanceof Slime.SlimeMoveControl; -+ return (this.slime.isInWater() || this.slime.isInLava()) && this.slime.getMoveControl() instanceof Slime.SlimeMoveControl && this.slime.canWander && new SlimeSwimEvent((org.bukkit.entity.Slime) this.slime.getBukkitEntity()).callEvent(); // Paper - } - - @Override -@@ -443,14 +455,18 @@ public class Slime extends Mob implements Enemy { - - @Override - public boolean canUse() { -- return this.slime.getTarget() == null && (this.slime.onGround || this.slime.isInWater() || this.slime.isInLava() || this.slime.hasEffect(MobEffects.LEVITATION)) && this.slime.getMoveControl() instanceof Slime.SlimeMoveControl; -+ return this.slime.getTarget() == null && (this.slime.onGround || this.slime.isInWater() || this.slime.isInLava() || this.slime.hasEffect(MobEffects.LEVITATION)) && this.slime.getMoveControl() instanceof Slime.SlimeMoveControl && this.slime.canWander; // Paper - add canWander - } - - @Override - public void tick() { - if (--this.nextRandomizeTime <= 0) { - this.nextRandomizeTime = 40 + this.slime.getRandom().nextInt(60); -- this.chosenDegrees = (float) this.slime.getRandom().nextInt(360); -+ // Paper start -+ SlimeChangeDirectionEvent event = new SlimeChangeDirectionEvent((org.bukkit.entity.Slime) this.slime.getBukkitEntity(), (float) this.slime.getRandom().nextInt(360)); -+ if (!this.slime.canWander || !event.callEvent()) return; -+ this.chosenDegrees = event.getNewYaw(); -+ // Paper end - } - - ((Slime.SlimeMoveControl) this.slime.getMoveControl()).setDirection(this.chosenDegrees, false); -@@ -469,9 +485,17 @@ public class Slime extends Mob implements Enemy { - - @Override - public boolean canUse() { -- LivingEntity entityliving = this.slime.getTarget(); -+ net.minecraft.world.entity.LivingEntity entityliving = this.slime.getTarget(); - -- return entityliving == null ? false : (!entityliving.isAlive() ? false : (entityliving instanceof Player && ((Player) entityliving).abilities.invulnerable ? false : this.slime.getMoveControl() instanceof Slime.SlimeMoveControl)); -+ // Paper start -+ if (entityliving == null || !entityliving.isAlive()) { -+ return false; -+ } -+ if (entityliving instanceof Player && ((Player) entityliving).abilities.invulnerable) { -+ return false; -+ } -+ return this.slime.getMoveControl() instanceof Slime.SlimeMoveControl && this.slime.canWander && new SlimeTargetLivingEntityEvent((org.bukkit.entity.Slime) this.slime.getBukkitEntity(), (LivingEntity) entityliving.getBukkitEntity()).callEvent(); -+ // Paper end - } - - @Override -@@ -482,9 +506,17 @@ public class Slime extends Mob implements Enemy { - - @Override - public boolean canContinueToUse() { -- LivingEntity entityliving = this.slime.getTarget(); -+ net.minecraft.world.entity.LivingEntity entityliving = this.slime.getTarget(); - -- return entityliving == null ? false : (!entityliving.isAlive() ? false : (entityliving instanceof Player && ((Player) entityliving).abilities.invulnerable ? false : --this.growTiredTimer > 0)); -+ // Paper start -+ if (entityliving == null || !entityliving.isAlive()) { -+ return false; -+ } -+ if (entityliving instanceof Player && ((Player) entityliving).abilities.invulnerable) { -+ return false; -+ } -+ return --this.growTiredTimer > 0 && this.slime.canWander && new SlimeTargetLivingEntityEvent((org.bukkit.entity.Slime) this.slime.getBukkitEntity(), (LivingEntity) entityliving.getBukkitEntity()).callEvent(); -+ // Paper end - } - - @Override -@@ -492,6 +524,13 @@ public class Slime extends Mob implements Enemy { - this.slime.lookAt((Entity) this.slime.getTarget(), 10.0F, 10.0F); - ((Slime.SlimeMoveControl) this.slime.getMoveControl()).setDirection(this.slime.yRot, this.slime.isDealsDamage()); - } -+ -+ // Paper start - clear timer and target when goal resets -+ public void stop() { -+ this.growTiredTimer = 0; -+ this.slime.setTarget(null); -+ } -+ // Paper end - } - - static class SlimeMoveControl extends MoveControl { -@@ -550,4 +589,15 @@ public class Slime extends Mob implements Enemy { - } - } - } -+ -+ // Paper start -+ private boolean canWander = true; -+ public boolean canWander() { -+ return canWander; -+ } -+ -+ public void setWander(boolean canWander) { -+ this.canWander = canWander; -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java -index 93af0fd9e15954d7d9f28d7dc29ee18055908348..340036135588d06e43cbd229dd3a6613b04bb9ab 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java -@@ -34,4 +34,14 @@ public class CraftSlime extends CraftMob implements Slime { - public EntityType getType() { - return EntityType.SLIME; - } -+ -+ // Paper start -+ public boolean canWander() { -+ return getHandle().canWander(); -+ } -+ -+ public void setWander(boolean canWander) { -+ getHandle().setWander(canWander); -+ } -+ // Paper end - } diff --git a/patches/server-remapped/0274-Optimize-RegistryMaterials.patch b/patches/server-remapped/0274-Optimize-RegistryMaterials.patch deleted file mode 100644 index 9ee9585d1..000000000 --- a/patches/server-remapped/0274-Optimize-RegistryMaterials.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 26 Aug 2018 20:49:50 -0400 -Subject: [PATCH] Optimize RegistryMaterials - -Use larger initial sizes to increase bucket capacity on the BiMap - -BiMap.get was seen to be using a good bit of CPU time. - -diff --git a/src/main/java/net/minecraft/core/MappedRegistry.java b/src/main/java/net/minecraft/core/MappedRegistry.java -index 928d4b980a1f703915454ffb304dc329fa4223df..da3733db4a5817673703f6c0cf37b5ee3bf91a99 100644 ---- a/src/main/java/net/minecraft/core/MappedRegistry.java -+++ b/src/main/java/net/minecraft/core/MappedRegistry.java -@@ -30,6 +30,7 @@ import net.minecraft.Util; - import net.minecraft.resources.RegistryDataPackCodec; - import net.minecraft.resources.ResourceKey; - import net.minecraft.resources.ResourceLocation; -+import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap; // Paper - import org.apache.commons.lang3.Validate; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -@@ -38,7 +39,7 @@ public class MappedRegistry extends WritableRegistry { - - protected static final Logger LOGGER = LogManager.getLogger(); - private final ObjectList byId = new ObjectArrayList(256); -- private final Object2IntMap toId = new Object2IntOpenCustomHashMap(Util.identityStrategy()); -+ private final Reference2IntOpenHashMap bg = new Reference2IntOpenHashMap(2048);// Paper - use bigger expected size to reduce collisions and direct intent for FastUtil to be identity map - private final BiMap storage; - private final BiMap, T> keyStorage; - private final Map lifecycles; -@@ -48,10 +49,10 @@ public class MappedRegistry extends WritableRegistry { - - public MappedRegistry(ResourceKey> key, Lifecycle lifecycle) { - super(key, lifecycle); -- this.toId.defaultReturnValue(-1); -- this.storage = HashBiMap.create(); -- this.keyStorage = HashBiMap.create(); -- this.lifecycles = Maps.newIdentityHashMap(); -+ this.bg.defaultReturnValue(-1); -+ this.storage = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions -+ this.keyStorage = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions -+ this.lifecycles = new java.util.IdentityHashMap<>(2048); // Paper - use bigger expected size to reduce collisions - this.elementsLifecycle = lifecycle; - } - -@@ -77,7 +78,7 @@ public class MappedRegistry extends WritableRegistry { - Validate.notNull(entry); - this.byId.size(Math.max(this.byId.size(), rawId + 1)); - this.byId.set(rawId, entry); -- this.toId.put(entry, rawId); -+ this.bg.put(entry, rawId); - this.randomCache = null; - if (checkDuplicateKeys && this.keyStorage.containsKey(key)) { - MappedRegistry.LOGGER.debug("Adding duplicate key '{}' to registry", key); -@@ -113,12 +114,12 @@ public class MappedRegistry extends WritableRegistry { - if (t0 == null) { - i = rawId.isPresent() ? rawId.getAsInt() : this.nextId; - } else { -- i = this.toId.getInt(t0); -+ i = this.bg.getInt(t0); - if (rawId.isPresent() && rawId.getAsInt() != i) { - throw new IllegalStateException("ID mismatch"); - } - -- this.toId.removeInt(t0); -+ this.bg.removeInt(t0); - this.lifecycles.remove(t0); - } - -@@ -138,7 +139,7 @@ public class MappedRegistry extends WritableRegistry { - - @Override - public int getId(@Nullable T entry) { -- return this.toId.getInt(entry); -+ return this.bg.getInt(entry); - } - - @Nullable -@@ -195,7 +196,7 @@ public class MappedRegistry extends WritableRegistry { - this.randomCache = collection.toArray(new Object[collection.size()]); - } - -- return Util.getRandom(this.randomCache, random); -+ return (T) Util.getRandom(this.randomCache, random); // Paper - Decompile fix - } - - public static Codec> networkCodec(ResourceKey> resourcekey, Lifecycle lifecycle, Codec entryCodec) { -@@ -215,7 +216,7 @@ public class MappedRegistry extends WritableRegistry { - Iterator iterator = registrymaterials.iterator(); - - while (iterator.hasNext()) { -- T t0 = iterator.next(); -+ T t0 = (T) iterator.next(); // Paper - Decompile fix - - builder.add(new MappedRegistry.RegistryEntry<>((ResourceKey) registrymaterials.getResourceKey(t0).get(), registrymaterials.getId(t0), t0)); - } diff --git a/patches/server-remapped/0268-Allow-disabling-armour-stand-ticking.patch b/patches/server/0232-Allow-disabling-armour-stand-ticking.patch similarity index 63% rename from patches/server-remapped/0268-Allow-disabling-armour-stand-ticking.patch rename to patches/server/0232-Allow-disabling-armour-stand-ticking.patch index b471e98ef..2075008fe 100644 --- a/patches/server-remapped/0268-Allow-disabling-armour-stand-ticking.patch +++ b/patches/server/0232-Allow-disabling-armour-stand-ticking.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allow disabling armour stand ticking diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 3562950df4868b1393790b1a1ff1fe0dc589c155..5ab0e7183e48134b7a0f736462516b1a8a333b04 100644 +index 1f6b37bd3cbc825abab5ad2f673200ef5061746a..8bb33e1b631c3aa99cef2a63c140f0b0e11325e0 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -384,4 +384,10 @@ public class PaperWorldConfig { +@@ -378,4 +378,10 @@ public class PaperWorldConfig { private void armorStandEntityLookups() { armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true); } @@ -20,10 +20,10 @@ index 3562950df4868b1393790b1a1ff1fe0dc589c155..5ab0e7183e48134b7a0f736462516b1a + } } diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -index 06e52a0c5decf717e35c605d6bcb46c3c7b29656..2994eee1d381af2c9ff3649dd48a2ae14c38c9d7 100644 +index 449f9b87ea6ff313f7e0e9104a641f1bf7729f24..33f1e486f3732c156289b16d973297e771da82b9 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -@@ -77,9 +77,16 @@ public class ArmorStand extends LivingEntity { +@@ -93,9 +93,16 @@ public class ArmorStand extends LivingEntity { public Rotations leftLegPose; public Rotations rightLegPose; public boolean canMove = true; // Paper @@ -37,10 +37,10 @@ index 06e52a0c5decf717e35c605d6bcb46c3c7b29656..2994eee1d381af2c9ff3649dd48a2ae1 public ArmorStand(EntityType type, Level world) { super(type, world); + if (world != null) this.canTick = world.paperConfig.armorStandTick; // Paper - armour stand ticking - this.handItems = NonNullList.a(2, ItemStack.EMPTY); - this.armorItems = NonNullList.a(4, ItemStack.EMPTY); + this.handItems = NonNullList.withSize(2, ItemStack.EMPTY); + this.armorItems = NonNullList.withSize(4, ItemStack.EMPTY); this.headPose = ArmorStand.DEFAULT_HEAD_POSE; -@@ -175,6 +182,7 @@ public class ArmorStand extends LivingEntity { +@@ -192,6 +199,7 @@ public class ArmorStand extends LivingEntity { this.armorItems.set(enumitemslot.getIndex(), itemstack); } @@ -48,28 +48,28 @@ index 06e52a0c5decf717e35c605d6bcb46c3c7b29656..2994eee1d381af2c9ff3649dd48a2ae1 } @Override -@@ -255,6 +263,7 @@ public class ArmorStand extends LivingEntity { +@@ -242,6 +250,7 @@ public class ArmorStand extends LivingEntity { } - tag.put("Pose", this.writePose()); -+ if (this.canTickSetByAPI) tag.putBoolean("Paper.CanTickOverride", this.canTick); // Paper - persist no tick setting + nbt.put("Pose", this.writePose()); ++ if (this.canTickSetByAPI) nbt.putBoolean("Paper.CanTickOverride", this.canTick); // Paper - persist no tick setting } @Override -@@ -286,6 +295,12 @@ public class ArmorStand extends LivingEntity { - this.setNoBasePlate(tag.getBoolean("NoBasePlate")); - this.setMarker(tag.getBoolean("Marker")); +@@ -273,6 +282,12 @@ public class ArmorStand extends LivingEntity { + this.setNoBasePlate(nbt.getBoolean("NoBasePlate")); + this.setMarker(nbt.getBoolean("Marker")); this.noPhysics = !this.hasPhysics(); + // Paper start - persist no tick -+ if (tag.contains("Paper.CanTickOverride")) { -+ this.canTick = tag.getBoolean("Paper.CanTickOverride"); ++ if (nbt.contains("Paper.CanTickOverride")) { ++ this.canTick = nbt.getBoolean("Paper.CanTickOverride"); + this.canTickSetByAPI = true; + } + // Paper end - CompoundTag nbttagcompound1 = tag.getCompound("Pose"); + CompoundTag nbttagcompound1 = nbt.getCompound("Pose"); this.readPose(nbttagcompound1); -@@ -641,7 +656,29 @@ public class ArmorStand extends LivingEntity { +@@ -654,7 +669,29 @@ public class ArmorStand extends LivingEntity { @Override public void tick() { @@ -99,50 +99,51 @@ index 06e52a0c5decf717e35c605d6bcb46c3c7b29656..2994eee1d381af2c9ff3649dd48a2ae1 Rotations vector3f = (Rotations) this.entityData.get(ArmorStand.DATA_HEAD_POSE); if (!this.headPose.equals(vector3f)) { -@@ -764,29 +801,36 @@ public class ArmorStand extends LivingEntity { - public void setHeadPose(Rotations vector3f) { - this.headPose = vector3f; - this.entityData.set(ArmorStand.DATA_HEAD_POSE, vector3f); +@@ -777,31 +814,37 @@ public class ArmorStand extends LivingEntity { + public void setHeadPose(Rotations angle) { + this.headPose = angle; + this.entityData.set(ArmorStand.DATA_HEAD_POSE, angle); + this.noTickPoseDirty = true; // Paper - Allow updates when not ticking } - public void setBodyPose(Rotations vector3f) { - this.bodyPose = vector3f; - this.entityData.set(ArmorStand.DATA_BODY_POSE, vector3f); + public void setBodyPose(Rotations angle) { + this.bodyPose = angle; + this.entityData.set(ArmorStand.DATA_BODY_POSE, angle); + this.noTickPoseDirty = true; // Paper - Allow updates when not ticking } - public void setLeftArmPose(Rotations vector3f) { - this.leftArmPose = vector3f; - this.entityData.set(ArmorStand.DATA_LEFT_ARM_POSE, vector3f); + public void setLeftArmPose(Rotations angle) { + this.leftArmPose = angle; + this.entityData.set(ArmorStand.DATA_LEFT_ARM_POSE, angle); + this.noTickPoseDirty = true; // Paper - Allow updates when not ticking } - public void setRightArmPose(Rotations vector3f) { - this.rightArmPose = vector3f; - this.entityData.set(ArmorStand.DATA_RIGHT_ARM_POSE, vector3f); + public void setRightArmPose(Rotations angle) { + this.rightArmPose = angle; + this.entityData.set(ArmorStand.DATA_RIGHT_ARM_POSE, angle); + this.noTickPoseDirty = true; // Paper - Allow updates when not ticking } - public void setLeftLegPose(Rotations vector3f) { + public void setLeftLegPose(Rotations angle) { + this.leftLegPose = angle; + this.entityData.set(ArmorStand.DATA_LEFT_LEG_POSE, angle); + this.noTickPoseDirty = true; // Paper - Allow updates when not ticking - this.leftLegPose = vector3f; - this.entityData.set(ArmorStand.DATA_LEFT_LEG_POSE, vector3f); -+ } - public void setRightLegPose(Rotations vector3f) { + public void setRightLegPose(Rotations angle) { + this.rightLegPose = angle; + this.entityData.set(ArmorStand.DATA_RIGHT_LEG_POSE, angle); + this.noTickPoseDirty = true; // Paper - Allow updates when not ticking - this.rightLegPose = vector3f; - this.entityData.set(ArmorStand.DATA_RIGHT_LEG_POSE, vector3f); } + + public Rotations getHeadPose() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java -index d4da5214a39b718671dcaf687cb0ff8668ce9728..8363b1b2267da30cda2fb8ea4e844598e20e1422 100644 +index 06cedeea447f53d100e32a6eba6f83b4719cb231..82b9ee993b0d2e7e0685231f7bad2b85756ec959 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java -@@ -311,5 +311,16 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand { - public boolean isSlotDisabled(org.bukkit.inventory.EquipmentSlot slot) { - return getHandle().isSlotDisabled(org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot)); +@@ -238,5 +238,16 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand { + public void setCanMove(boolean move) { + getHandle().canMove = move; } + + @Override diff --git a/patches/server-remapped/0252-SkeletonHorse-Additions.patch b/patches/server/0233-SkeletonHorse-Additions.patch similarity index 56% rename from patches/server-remapped/0252-SkeletonHorse-Additions.patch rename to patches/server/0233-SkeletonHorse-Additions.patch index 6599e0685..b4a112f8f 100644 --- a/patches/server-remapped/0252-SkeletonHorse-Additions.patch +++ b/patches/server/0233-SkeletonHorse-Additions.patch @@ -4,64 +4,32 @@ Date: Fri, 27 Jul 2018 22:36:31 -0500 Subject: [PATCH] SkeletonHorse Additions -diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java -index a3bad391a719363077740aa810c9412df34b4ae5..e92a8c4c49c452e1f3f0c06398f2a74e3432262f 100644 ---- a/src/main/java/net/minecraft/world/entity/EntitySelector.java -+++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java -@@ -25,6 +25,7 @@ public final class EntitySelector { - public static final Predicate ATTACK_ALLOWED = (entity) -> { - return !(entity instanceof Player) || !entity.isSpectator() && !((Player) entity).isCreative() && entity.level.getDifficulty() != Difficulty.PEACEFUL; - }; -+ public static Predicate notSpectator() { return NO_SPECTATORS; } // Paper - OBFHELPER - public static final Predicate NO_SPECTATORS = (entity) -> { - return !entity.isSpectator(); - }; diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonHorse.java -index 7ef99acaa24525c68b1528bd3232738baab8e1c6..eaab482ae341ddda0754e726357cd845121fb043 100644 +index b5446b417963850f25c715abe52403c731b6ef01..9c5c7ef3b915afe5fe54144f51e383a83c1eb752 100644 --- a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonHorse.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonHorse.java -@@ -26,7 +26,7 @@ public class SkeletonHorse extends AbstractHorse { - +@@ -23,7 +23,7 @@ public class SkeletonHorse extends AbstractHorse { private final SkeletonTrapGoal skeletonTrapGoal = new SkeletonTrapGoal(this); + private static final int TRAP_MAX_LIFE = 18000; private boolean isTrap; - private int trapTime; -+ private int trapTime; public int getTrapTime() { return this.trapTime; } // Paper - OBFHELPER ++ public int trapTime; // Paper private -> public public SkeletonHorse(EntityType type, Level world) { super(type, world); -@@ -145,10 +145,12 @@ public class SkeletonHorse extends AbstractHorse { - return 0.96F; - } - -+ public boolean isTrap() { return this.isTrap(); } // Paper - OBFHELPER - public boolean isTrap() { - return this.isTrap; - } - -+ public void setTrap(boolean trap) { this.setTrap(trap); } // Paper - OBFHELPER - public void setTrap(boolean trapped) { - if (trapped != this.isTrap) { - this.isTrap = trapped; diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java b/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java -index 6c2cbaae2afe076c8b7bc53ffa91fe37e423d120..7f5fb28a7deabe1b62ed21e5ed1ea1ecca0d15b8 100644 +index 67afaab789041f49407233ca8a856a3b0131fcf6..1b874f8a72f5b1ac64dd66621b039295f5dc1f18 100644 --- a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java -@@ -14,10 +14,14 @@ import net.minecraft.world.item.ItemStack; - import net.minecraft.world.item.Items; - import net.minecraft.world.item.enchantment.EnchantmentHelper; - import net.minecraft.world.level.Level; -+import org.bukkit.entity.HumanEntity; -+ -+import java.util.List; - +@@ -18,6 +18,7 @@ import net.minecraft.world.level.Level; public class SkeletonTrapGoal extends Goal { private final SkeletonHorse horse; -+ private List eligiblePlayers; // Paper ++ private java.util.List eligiblePlayers; // Paper public SkeletonTrapGoal(SkeletonHorse skeletonHorse) { this.horse = skeletonHorse; -@@ -25,12 +29,13 @@ public class SkeletonTrapGoal extends Goal { +@@ -25,12 +26,13 @@ public class SkeletonTrapGoal extends Goal { @Override public boolean canUse() { @@ -77,30 +45,20 @@ index 6c2cbaae2afe076c8b7bc53ffa91fe37e423d120..7f5fb28a7deabe1b62ed21e5ed1ea1ec this.horse.setTrap(false); diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java -index 66681b9f0e2531d3da25629e44180417b32b4d66..6a5430fe54a5c8ad119a0f3842961825a54d8d7a 100644 +index 0b6e5ee9872a73823219bff7f642375fdc4ec243..b0cafe6e0bdb3f297c13f310fdbe9e3158a6715d 100644 --- a/src/main/java/net/minecraft/world/level/EntityGetter.java +++ b/src/main/java/net/minecraft/world/level/EntityGetter.java -@@ -1,6 +1,9 @@ - package net.minecraft.world.level; - -+import com.google.common.collect.ImmutableList; - import com.google.common.collect.Lists; -+import org.bukkit.entity.HumanEntity; -+ - import java.util.Iterator; - import java.util.List; - import java.util.UUID; -@@ -115,6 +118,28 @@ public interface EntityGetter { - return entityhuman; +@@ -90,6 +90,28 @@ public interface EntityGetter { + return player; } + // Paper start -+ default List findNearbyBukkitPlayers(double x, double y, double z, double radius, boolean notSpectator) { -+ return findNearbyBukkitPlayers(x, y, z, radius, notSpectator ? EntitySelector.notSpectator() : EntitySelector.canAITarget()); ++ default List findNearbyBukkitPlayers(double x, double y, double z, double radius, boolean notSpectator) { ++ return findNearbyBukkitPlayers(x, y, z, radius, notSpectator ? EntitySelector.NO_SPECTATORS : net.minecraft.world.entity.EntitySelector.NO_CREATIVE_OR_SPECTATOR); + } + -+ default List findNearbyBukkitPlayers(double x, double y, double z, double radius, @Nullable Predicate predicate) { -+ ImmutableList.Builder builder = ImmutableList.builder(); ++ default List findNearbyBukkitPlayers(double x, double y, double z, double radius, @Nullable Predicate predicate) { ++ com.google.common.collect.ImmutableList.Builder builder = com.google.common.collect.ImmutableList.builder(); + + for (Player human : this.players()) { + if (predicate == null || predicate.test(human)) { @@ -120,7 +78,7 @@ index 66681b9f0e2531d3da25629e44180417b32b4d66..6a5430fe54a5c8ad119a0f3842961825 default Player getNearestPlayer(Entity entity, double maxDistance) { return this.getNearestPlayer(entity.getX(), entity.getY(), entity.getZ(), maxDistance, false); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java -index b52ca4a612e30542ef4029cb1340f616bc4c36e6..7f984639fc2697cad9d0393467b0cb896d1e55a4 100644 +index b52ca4a612e30542ef4029cb1340f616bc4c36e6..90a61d1472afea12637814256f91dbd2f5acb42e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java @@ -25,4 +25,26 @@ public class CraftSkeletonHorse extends CraftAbstractHorse implements SkeletonHo @@ -136,7 +94,7 @@ index b52ca4a612e30542ef4029cb1340f616bc4c36e6..7f984639fc2697cad9d0393467b0cb89 + + @Override + public int getTrapTime() { -+ return getHandle().getTrapTime(); ++ return getHandle().trapTime; + } + + @Override diff --git a/patches/server-remapped/0254-Don-t-call-getItemMeta-on-hasItemMeta.patch b/patches/server/0234-Don-t-call-getItemMeta-on-hasItemMeta.patch similarity index 79% rename from patches/server-remapped/0254-Don-t-call-getItemMeta-on-hasItemMeta.patch rename to patches/server/0234-Don-t-call-getItemMeta-on-hasItemMeta.patch index 0133184a6..de9d451a6 100644 --- a/patches/server-remapped/0254-Don-t-call-getItemMeta-on-hasItemMeta.patch +++ b/patches/server/0234-Don-t-call-getItemMeta-on-hasItemMeta.patch @@ -11,23 +11,23 @@ Returns true if getDamage() == 0 or has damage tag or other tag is set. Check the `ItemMetaTest#testTaggedButNotMeta` method to see how this method behaves. diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index 44caf00330e4f4f74745973dbe709980f0b61269..9e06912b0c13c3d61bc95e526acaa28f96b46fb9 100644 +index 3fbfe4f77c4b82d96ed022498b2d9175d548e247..383c34a611f8371dd6ebcb858c1c0ba148d0660b 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -@@ -569,7 +569,7 @@ public final class CraftItemStack extends ItemStack { +@@ -572,7 +572,7 @@ public final class CraftItemStack extends ItemStack { @Override public boolean hasItemMeta() { -- return hasItemMeta(handle) && !CraftItemFactory.instance().equals(getItemMeta(), null); -+ return hasItemMeta(handle) && (handle.getDamageValue() != 0 || (handle.getTag() != null && handle.getTag().tags.size() >= (handle.getTag().contains(CraftMetaItem.DAMAGE.NBT) ? 2 : 1))); // Paper - keep 1.12 CraftBukkit behavior without calling getItemMeta +- return CraftItemStack.hasItemMeta(this.handle) && !CraftItemFactory.instance().equals(this.getItemMeta(), null); ++ return CraftItemStack.hasItemMeta(this.handle) && (this.handle.getDamageValue() != 0 || (this.handle.getTag() != null && this.handle.getTag().tags.size() >= (this.handle.getTag().contains(CraftMetaItem.DAMAGE.NBT) ? 2 : 1))); // Paper - keep 1.12 CraftBukkit behavior without calling getItemMeta } static boolean hasItemMeta(net.minecraft.world.item.ItemStack item) { diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java -index 42f577ed3508ba5a380648461e149f16ce97c9bd..b85a0a4c4f134dd6012d9141244ecf97b4300b65 100644 +index b0bb30aebdba99a8fa929ec3c56e46b59d2467c9..34eba991c838950c16d565ef6c767bd6a6159bdc 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java -@@ -96,6 +96,34 @@ public class ItemMetaTest extends AbstractTestingBase { +@@ -97,6 +97,34 @@ public class ItemMetaTest extends AbstractTestingBase { assertThat(itemMeta.hasConflictingEnchant(null), is(false)); } diff --git a/patches/server-remapped/0256-Implement-Expanded-ArmorStand-API.patch b/patches/server/0235-Implement-Expanded-ArmorStand-API.patch similarity index 85% rename from patches/server-remapped/0256-Implement-Expanded-ArmorStand-API.patch rename to patches/server/0235-Implement-Expanded-ArmorStand-API.patch index 4909987c8..9db2b90a0 100644 --- a/patches/server-remapped/0256-Implement-Expanded-ArmorStand-API.patch +++ b/patches/server/0235-Implement-Expanded-ArmorStand-API.patch @@ -8,26 +8,26 @@ Add the following: - Enable/Disable slot interactions diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -index 7fc69adc8afa971ee3cf815c6002628ae2149a5b..06e52a0c5decf717e35c605d6bcb46c3c7b29656 100644 +index 33f1e486f3732c156289b16d973297e771da82b9..4adde11daa5ca97a2bf9c164c43c5c011a89b33d 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -@@ -426,6 +426,7 @@ public class ArmorStand extends LivingEntity { +@@ -428,7 +428,7 @@ public class ArmorStand extends LivingEntity { return enumitemslot; } -+ public final boolean isSlotDisabled(net.minecraft.world.entity.EquipmentSlot slot) { return this.isDisabled(slot); } // Paper - OBFHELPER - private boolean isDisabled(net.minecraft.world.entity.EquipmentSlot slot) { +- private boolean isDisabled(net.minecraft.world.entity.EquipmentSlot slot) { ++ public boolean isDisabled(net.minecraft.world.entity.EquipmentSlot slot) { // Paper - private -> public return (this.disabledSlots & 1 << slot.getFilterFlag()) != 0 || slot.getType() == net.minecraft.world.entity.EquipmentSlot.Type.HAND && !this.isShowArms(); } + diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java -index 16f996d505b96da8a40c7709214ebbd2a0d0d9f3..d4da5214a39b718671dcaf687cb0ff8668ce9728 100644 +index 82b9ee993b0d2e7e0685231f7bad2b85756ec959..f4065938bbfd04519d1363ee8781c316aca468ab 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java -@@ -238,5 +238,78 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand { - public void setCanMove(boolean move) { +@@ -239,6 +239,79 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand { getHandle().canMove = move; } -+ + + @Override + public ItemStack getItem(org.bukkit.inventory.EquipmentSlot slot) { + com.google.common.base.Preconditions.checkNotNull(slot, "slot"); @@ -98,7 +98,9 @@ index 16f996d505b96da8a40c7709214ebbd2a0d0d9f3..d4da5214a39b718671dcaf687cb0ff86 + + @Override + public boolean isSlotDisabled(org.bukkit.inventory.EquipmentSlot slot) { -+ return getHandle().isSlotDisabled(org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot)); ++ return getHandle().isDisabled(org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot)); + } - // Paper end - } ++ + @Override + public boolean canTick() { + return this.getHandle().canTick; diff --git a/patches/server-remapped/0257-AnvilDamageEvent.patch b/patches/server/0236-AnvilDamageEvent.patch similarity index 83% rename from patches/server-remapped/0257-AnvilDamageEvent.patch rename to patches/server/0236-AnvilDamageEvent.patch index 8e4a47418..8b6226047 100644 --- a/patches/server-remapped/0257-AnvilDamageEvent.patch +++ b/patches/server/0236-AnvilDamageEvent.patch @@ -5,14 +5,13 @@ Subject: [PATCH] AnvilDamageEvent diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java -index aa4b03dc9a0d6b3f387f081a1887672b90c60ef9..3d53edae7e3d5bb00913384ad0eb67551a65750e 100644 +index 6a9597572714706052103677bfb6142a5be2e134..1dad9577370bb58b27b32b997a505ce5145a6769 100644 --- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java -@@ -80,7 +80,16 @@ public class AnvilMenu extends ItemCombinerMenu { - - if (!player.abilities.instabuild && iblockdata.is((Tag) BlockTags.ANVIL) && player.getRandom().nextFloat() < 0.12F) { +@@ -90,6 +90,16 @@ public class AnvilMenu extends ItemCombinerMenu { + if (!player.getAbilities().instabuild && iblockdata.is((Tag) BlockTags.ANVIL) && player.getRandom().nextFloat() < 0.12F) { BlockState iblockdata1 = AnvilBlock.damage(iblockdata); -- + + // Paper start + com.destroystokyo.paper.event.block.AnvilDamagedEvent event = new com.destroystokyo.paper.event.block.AnvilDamagedEvent(getBukkitView(), iblockdata1 != null ? org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(iblockdata1) : null); + if (!event.callEvent()) { diff --git a/patches/server/0237-Add-hand-to-bucket-events.patch b/patches/server/0237-Add-hand-to-bucket-events.patch new file mode 100644 index 000000000..6bd934113 --- /dev/null +++ b/patches/server/0237-Add-hand-to-bucket-events.patch @@ -0,0 +1,196 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Thu, 2 Aug 2018 08:44:35 -0500 +Subject: [PATCH] Add hand to bucket events + + +diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java +index 5751a9318867df781568dd92ad4f51d1f40bc23c..dae19715582d75d24744d44a87f94dd86f90c1c7 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -1419,15 +1419,17 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl + this.getServer().getPlayerList().broadcastAll(new ClientboundSetDefaultSpawnPositionPacket(pos, angle)); + } + +- public BlockPos getSharedSpawnPos() { +- BlockPos blockposition = new BlockPos(this.levelData.getXSpawn(), this.levelData.getYSpawn(), this.levelData.getZSpawn()); +- +- if (!this.getWorldBorder().isWithinBounds(blockposition)) { +- blockposition = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, new BlockPos(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ())); +- } +- +- return blockposition; +- } ++ // Paper - moved up to Level ++ //public BlockPosition getSpawn() { ++ // BlockPosition blockposition = new BlockPosition(this.worldData.a(), this.worldData.b(), this.worldData.c()); ++ // ++ // if (!this.getWorldBorder().a(blockposition)) { ++ // blockposition = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ())); ++ // } ++ // ++ // return blockposition; ++ //} ++ // Paper end + + public float getSharedSpawnAngle() { + return this.levelData.getSpawnAngle(); +diff --git a/src/main/java/net/minecraft/world/entity/animal/Cow.java b/src/main/java/net/minecraft/world/entity/animal/Cow.java +index 4656c2a524bc5d397715c55799362c4b97f96009..41d5f4bf470bccbc0967df64e1630a01a5c6f27a 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/Cow.java ++++ b/src/main/java/net/minecraft/world/entity/animal/Cow.java +@@ -87,7 +87,7 @@ public class Cow extends Animal { + + if (itemstack.is(Items.BUCKET) && !this.isBaby()) { + // CraftBukkit start - Got milk? +- org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) player.level, player, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET); ++ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) player.level, player, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET, hand); // Paper - add enumHand + + if (event.isCancelled()) { + return InteractionResult.PASS; +diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java +index f6aa7ac23288c67178e22b194f831d337dd4dda0..580f3e8de2e10ddc01430e84fc42e243736c4810 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java ++++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java +@@ -166,7 +166,7 @@ public class Goat extends Animal { + + if (itemstack.is(Items.BUCKET) && !this.isBaby()) { + // CraftBukkit start - Got milk? +- org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) player.level, player, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET); ++ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) player.level, player, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET, hand); // Paper - add enumHand + + if (event.isCancelled()) { + return InteractionResult.PASS; +diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java +index 24272b384b96bb98a8231fe8583f404ad0c96de5..7c3e94c6bf8337ef660473d8ed451606d56082a5 100644 +--- a/src/main/java/net/minecraft/world/item/BucketItem.java ++++ b/src/main/java/net/minecraft/world/item/BucketItem.java +@@ -71,7 +71,7 @@ public class BucketItem extends Item implements DispensibleContainerItem { + BucketPickup ifluidsource = (BucketPickup) iblockdata.getBlock(); + // CraftBukkit start + ItemStack dummyFluid = ifluidsource.pickupBlock(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); +- PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) world, user, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.getItem()); ++ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) world, user, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.getItem(), hand); // Paper - add enumhand + + if (event.isCancelled()) { + ((ServerPlayer) user).connection.send(new ClientboundBlockUpdatePacket(world, blockposition)); // SPIGOT-5163 (see PlayerInteractManager) +@@ -102,7 +102,7 @@ public class BucketItem extends Item implements DispensibleContainerItem { + iblockdata = world.getBlockState(blockposition); + BlockPos blockposition2 = iblockdata.getBlock() instanceof LiquidBlockContainer && this.content == Fluids.WATER ? blockposition : blockposition1; + +- if (this.a(user, world, blockposition2, movingobjectpositionblock, movingobjectpositionblock.getDirection(), blockposition, itemstack)) { // CraftBukkit ++ if (this.emptyContents(user, world, blockposition2, movingobjectpositionblock, movingobjectpositionblock.getDirection(), blockposition, itemstack, hand)) { // CraftBukkit // Paper - add enumhand + this.checkExtraContent(user, world, itemstack, blockposition2); + if (user instanceof ServerPlayer) { + CriteriaTriggers.PLACED_BLOCK.trigger((ServerPlayer) user, blockposition2, itemstack); +@@ -129,10 +129,12 @@ public class BucketItem extends Item implements DispensibleContainerItem { + + @Override + public boolean emptyContents(@Nullable Player player, Level world, BlockPos pos, @Nullable BlockHitResult hitResult) { +- return this.a(player, world, pos, hitResult, null, null, null); ++ // Paper start - add enumHand ++ return emptyContents(player, world, pos, hitResult, null, null, null, null); + } + +- public boolean a(Player entityhuman, Level world, BlockPos blockposition, @Nullable BlockHitResult movingobjectpositionblock, Direction enumdirection, BlockPos clicked, ItemStack itemstack) { ++ public boolean emptyContents(Player entityhuman, Level world, BlockPos blockposition, @Nullable BlockHitResult movingobjectpositionblock, Direction enumdirection, BlockPos clicked, ItemStack itemstack, InteractionHand enumhand) { ++ // Paper end + // CraftBukkit end + if (!(this.content instanceof FlowingFluid)) { + return false; +@@ -145,7 +147,7 @@ public class BucketItem extends Item implements DispensibleContainerItem { + + // CraftBukkit start + if (flag1 && entityhuman != null) { +- PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((ServerLevel) world, entityhuman, blockposition, clicked, enumdirection, itemstack); ++ PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((ServerLevel) world, entityhuman, blockposition, clicked, enumdirection, itemstack, enumhand); // Paper - add enumhand + if (event.isCancelled()) { + ((ServerPlayer) entityhuman).connection.send(new ClientboundBlockUpdatePacket(world, blockposition)); // SPIGOT-4238: needed when looking through entity + ((ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541 +@@ -154,7 +156,7 @@ public class BucketItem extends Item implements DispensibleContainerItem { + } + // CraftBukkit end + if (!flag1) { +- return movingobjectpositionblock != null && this.a(entityhuman, world, movingobjectpositionblock.getBlockPos().relative(movingobjectpositionblock.getDirection()), (BlockHitResult) null, enumdirection, clicked, itemstack); // CraftBukkit ++ return movingobjectpositionblock != null && this.emptyContents(entityhuman, world, movingobjectpositionblock.getBlockPos().relative(movingobjectpositionblock.getDirection()), (BlockHitResult) null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit // Paper - add enumhand + } else if (world.dimensionType().ultraWarm() && this.content.is((Tag) FluidTags.WATER)) { + int i = blockposition.getX(); + int j = blockposition.getY(); +diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java +index c1cf7f5bff2878281d4a9787ea7160e984268352..8d4f8719b30a66fbb68c9407ee8484312f05b3fb 100644 +--- a/src/main/java/net/minecraft/world/level/Level.java ++++ b/src/main/java/net/minecraft/world/level/Level.java +@@ -291,6 +291,17 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + return true; + } + // Paper end ++ // Paper start - moved up from ServerLevel ++ public BlockPos getSharedSpawnPos() { ++ BlockPos blockposition = new BlockPos(this.levelData.getXSpawn(), this.levelData.getYSpawn(), this.levelData.getZSpawn()); ++ ++ if (!this.getWorldBorder().isWithinBounds(blockposition)) { ++ blockposition = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, new BlockPos(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ())); ++ } ++ ++ return blockposition; ++ } ++ // Paper end + @Override + public boolean isClientSide() { + return this.isClientSide; +diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +index 59fae60116167baf989e85596334824e9004e6fb..9c079d32e81cabfa7b8b28e3e8d5741d8d951d79 100644 +--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java ++++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java +@@ -558,3 +558,4 @@ public final class NaturalSpawner { + void run(Mob entity, ChunkAccess chunk); + } + } ++ +diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +index 966d06e2da7e6f9b4e78ca8ed02f3a6472bc8c05..a81fc5212648056766824113b372a7c772c19e5a 100644 +--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java ++++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +@@ -222,7 +222,7 @@ public class CraftEventFactory { + public static Entity entityDamage; // For use in EntityDamageByEntityEvent + + // helper methods +- private static boolean canBuild(ServerLevel world, Player player, int x, int z) { ++ private static boolean canBuild(Level world, Player player, int x, int z) { + int spawnSize = Bukkit.getServer().getSpawnRadius(); + + if (world.dimension() != Level.OVERWORLD) return true; +@@ -416,6 +416,20 @@ public class CraftEventFactory { + } + + private static PlayerEvent getPlayerBucketEvent(boolean isFilling, ServerLevel world, net.minecraft.world.entity.player.Player who, BlockPos changed, BlockPos clicked, Direction clickedFace, ItemStack itemstack, net.minecraft.world.item.Item item) { ++ // Paper start - add enumHand ++ return getPlayerBucketEvent(isFilling, world, who, changed, clicked, clickedFace, itemstack, item, null); ++ } ++ ++ public static PlayerBucketEmptyEvent callPlayerBucketEmptyEvent(Level world, net.minecraft.world.entity.player.Player who, BlockPos changed, BlockPos clicked, Direction clickedFace, ItemStack itemstack, InteractionHand enumHand) { ++ return (PlayerBucketEmptyEvent) getPlayerBucketEvent(false, world, who, changed, clicked, clickedFace, itemstack, Items.BUCKET, enumHand); ++ } ++ ++ public static PlayerBucketFillEvent callPlayerBucketFillEvent(Level world, net.minecraft.world.entity.player.Player who, BlockPos changed, BlockPos clicked, Direction clickedFace, ItemStack itemInHand, net.minecraft.world.item.Item bucket, InteractionHand enumHand) { ++ return (PlayerBucketFillEvent) getPlayerBucketEvent(true, world, who, clicked, changed, clickedFace, itemInHand, bucket, enumHand); ++ } ++ ++ private static PlayerEvent getPlayerBucketEvent(boolean isFilling, Level world, net.minecraft.world.entity.player.Player who, BlockPos changed, BlockPos clicked, Direction clickedFace, ItemStack itemstack, net.minecraft.world.item.Item item, InteractionHand enumHand) { ++ // Paper end + Player player = (Player) who.getBukkitEntity(); + CraftItemStack itemInHand = CraftItemStack.asNewCraftStack(item); + Material bucket = CraftMagicNumbers.getMaterial(itemstack.getItem()); +@@ -428,10 +442,10 @@ public class CraftEventFactory { + + PlayerEvent event; + if (isFilling) { +- event = new PlayerBucketFillEvent(player, block, blockClicked, blockFace, bucket, itemInHand); ++ event = new PlayerBucketFillEvent(player, block, blockClicked, blockFace, bucket, itemInHand, enumHand == null ? null : enumHand == InteractionHand.OFF_HAND ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND); // Paper - add enumHand + ((PlayerBucketFillEvent) event).setCancelled(!CraftEventFactory.canBuild(world, player, changed.getX(), changed.getZ())); + } else { +- event = new PlayerBucketEmptyEvent(player, block, blockClicked, blockFace, bucket, itemInHand); ++ event = new PlayerBucketEmptyEvent(player, block, blockClicked, blockFace, bucket, itemInHand, enumHand == null ? null : enumHand == InteractionHand.OFF_HAND ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND); // Paper - add enumHand + ((PlayerBucketEmptyEvent) event).setCancelled(!CraftEventFactory.canBuild(world, player, changed.getX(), changed.getZ())); + } + diff --git a/patches/server-remapped/0258-Add-TNTPrimeEvent.patch b/patches/server/0238-Add-TNTPrimeEvent.patch similarity index 56% rename from patches/server-remapped/0258-Add-TNTPrimeEvent.patch rename to patches/server/0238-Add-TNTPrimeEvent.patch index 812624262..995e6db56 100644 --- a/patches/server-remapped/0258-Add-TNTPrimeEvent.patch +++ b/patches/server/0238-Add-TNTPrimeEvent.patch @@ -5,50 +5,26 @@ Subject: [PATCH] Add TNTPrimeEvent diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -index ae3cf71f14526e1f356216dfaa899c8f5083d46d..37a9e9df7f7f816c214c37e545288bf9329626ed 100644 +index e286d4ed03eba05b862741cb98db8a031224cd98..bd61f2b3940bfba7948dbb0a52173144c9ef08bd 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -@@ -61,6 +61,7 @@ import org.bukkit.craftbukkit.block.CraftBlock; - import org.bukkit.event.entity.EntityExplodeEvent; - import org.bukkit.event.entity.EntityRegainHealthEvent; - // CraftBukkit end -+import com.destroystokyo.paper.event.block.TNTPrimeEvent; // Paper - TNTPrimeEvent - - public class EnderDragon extends Mob implements Enemy { - -@@ -515,6 +516,11 @@ public class EnderDragon extends Mob implements Enemy { +@@ -536,6 +536,11 @@ public class EnderDragon extends Mob implements Enemy { }); craftBlock.getNMS().spawnAfterBreak((ServerLevel) level, blockposition, ItemStack.EMPTY); } + // Paper start - TNTPrimeEvent + org.bukkit.block.Block tntBlock = level.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); -+ if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.EXPLOSION, explosionSource.getSourceMob().getBukkitEntity()).callEvent()) ++ if(!new com.destroystokyo.paper.event.block.TNTPrimeEvent(tntBlock, com.destroystokyo.paper.event.block.TNTPrimeEvent.PrimeReason.EXPLOSION, explosionSource.getSourceMob().getBukkitEntity()).callEvent()) + continue; + // Paper end nmsBlock.wasExploded(level, blockposition, explosionSource); this.level.removeBlock(blockposition, false); diff --git a/src/main/java/net/minecraft/world/level/block/FireBlock.java b/src/main/java/net/minecraft/world/level/block/FireBlock.java -index 85170008de6e77cfb8e4f55ae440a8428d868af4..31b6c1333c7d0af28385e804e94348cef398748b 100644 +index dd19c31360891245dbe465cf94a9f456cf71e23d..ad0b485dbc77717f16191d6950a2e91faaede94a 100644 --- a/src/main/java/net/minecraft/world/level/block/FireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java -@@ -3,6 +3,7 @@ package net.minecraft.world.level.block; - import com.google.common.collect.ImmutableMap; - import it.unimi.dsi.fastutil.objects.Object2IntMap; - import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -+import com.destroystokyo.paper.event.block.TNTPrimeEvent; // Paper - TNTPrimeEvent - import java.util.Map; - import java.util.Random; - import java.util.function.Function; -@@ -11,6 +12,7 @@ import net.minecraft.Util; - import net.minecraft.core.BlockPos; - import net.minecraft.core.Direction; - import net.minecraft.core.Vec3i; -+import net.minecraft.server.MCUtil; - import net.minecraft.server.level.ServerLevel; - import net.minecraft.world.item.context.BlockPlaceContext; - import net.minecraft.world.level.BlockGetter; -@@ -288,7 +290,7 @@ public class FireBlock extends BaseFireBlock { +@@ -290,7 +290,7 @@ public class FireBlock extends BaseFireBlock { world.setBlock(blockposition, this.getStateWithAge(world, blockposition, l), 3); } else { @@ -57,13 +33,13 @@ index 85170008de6e77cfb8e4f55ae440a8428d868af4..31b6c1333c7d0af28385e804e94348ce } Block block = iblockdata.getBlock(); -@@ -296,6 +298,13 @@ public class FireBlock extends BaseFireBlock { +@@ -298,6 +298,13 @@ public class FireBlock extends BaseFireBlock { if (block instanceof TntBlock) { TntBlock blocktnt = (TntBlock) block; + // Paper start - TNTPrimeEvent -+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition); -+ if (!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.FIRE, null).callEvent()) { ++ org.bukkit.block.Block tntBlock = net.minecraft.server.MCUtil.toBukkitBlock(world, blockposition); ++ if (!new com.destroystokyo.paper.event.block.TNTPrimeEvent(tntBlock, com.destroystokyo.paper.event.block.TNTPrimeEvent.PrimeReason.FIRE, null).callEvent()) { + return; + } + world.setAir(blockposition, false); @@ -72,77 +48,68 @@ index 85170008de6e77cfb8e4f55ae440a8428d868af4..31b6c1333c7d0af28385e804e94348ce } } diff --git a/src/main/java/net/minecraft/world/level/block/TntBlock.java b/src/main/java/net/minecraft/world/level/block/TntBlock.java -index 5c06e2f69f6c0a03f12fab6accc5f9a79ae37118..76665be4b3f2e2821c35d3d6d6407c4da4f224e7 100644 +index 390dfe9d2a148468b9ed3e3fb39fc944e7aa4d5c..151d412df2fce6e51d0297dc1c070056c31ec196 100644 --- a/src/main/java/net/minecraft/world/level/block/TntBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TntBlock.java -@@ -22,6 +22,7 @@ import net.minecraft.world.level.block.state.StateDefinition; - import net.minecraft.world.level.block.state.properties.BlockStateProperties; - import net.minecraft.world.level.block.state.properties.BooleanProperty; - import net.minecraft.world.phys.BlockHitResult; -+import com.destroystokyo.paper.event.block.TNTPrimeEvent; // Paper - TNTPrimeEvent - - public class TntBlock extends Block { - -@@ -36,6 +37,11 @@ public class TntBlock extends Block { +@@ -38,6 +38,11 @@ public class TntBlock extends Block { public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { if (!oldState.is(state.getBlock())) { if (world.hasNeighborSignal(pos)) { + // Paper start - TNTPrimeEvent + org.bukkit.block.Block tntBlock = net.minecraft.server.MCUtil.toBukkitBlock(world, pos);; -+ if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.REDSTONE, null).callEvent()) ++ if(!new com.destroystokyo.paper.event.block.TNTPrimeEvent(tntBlock, com.destroystokyo.paper.event.block.TNTPrimeEvent.PrimeReason.REDSTONE, null).callEvent()) + return; + // Paper end - explode(world, pos); + TntBlock.explode(world, pos); world.removeBlock(pos, false); } -@@ -46,6 +52,11 @@ public class TntBlock extends Block { +@@ -48,6 +53,11 @@ public class TntBlock extends Block { @Override public void neighborChanged(BlockState state, Level world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) { if (world.hasNeighborSignal(pos)) { + // Paper start - TNTPrimeEvent + org.bukkit.block.Block tntBlock = net.minecraft.server.MCUtil.toBukkitBlock(world, pos);; -+ if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.REDSTONE, null).callEvent()) ++ if(!new com.destroystokyo.paper.event.block.TNTPrimeEvent(tntBlock, com.destroystokyo.paper.event.block.TNTPrimeEvent.PrimeReason.REDSTONE, null).callEvent()) + return; + // Paper end - explode(world, pos); + TntBlock.explode(world, pos); world.removeBlock(pos, false); } -@@ -64,6 +75,12 @@ public class TntBlock extends Block { +@@ -66,6 +76,12 @@ public class TntBlock extends Block { @Override public void wasExploded(Level world, BlockPos pos, Explosion explosion) { if (!world.isClientSide) { + // Paper start - TNTPrimeEvent + org.bukkit.block.Block tntBlock = net.minecraft.server.MCUtil.toBukkitBlock(world, pos); + org.bukkit.entity.Entity source = explosion.source != null ? explosion.source.getBukkitEntity() : null; -+ if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.EXPLOSION, source).callEvent()) ++ if(!new com.destroystokyo.paper.event.block.TNTPrimeEvent(tntBlock, com.destroystokyo.paper.event.block.TNTPrimeEvent.PrimeReason.EXPLOSION, source).callEvent()) + return; + // Paper end PrimedTnt entitytntprimed = new PrimedTnt(world, (double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D, explosion.getSourceMob()); + int i = entitytntprimed.getFuse(); - entitytntprimed.setFuse((short) (world.random.nextInt(entitytntprimed.getLife() / 4) + entitytntprimed.getLife() / 8)); -@@ -92,6 +109,11 @@ public class TntBlock extends Block { - if (item != Items.FLINT_AND_STEEL && item != Items.FIRE_CHARGE) { +@@ -95,6 +111,11 @@ public class TntBlock extends Block { + if (!itemstack.is(Items.FLINT_AND_STEEL) && !itemstack.is(Items.FIRE_CHARGE)) { return super.use(state, world, pos, player, hand, hit); } else { + // Paper start - TNTPrimeEvent + org.bukkit.block.Block tntBlock = net.minecraft.server.MCUtil.toBukkitBlock(world, pos); -+ if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.ITEM, player.getBukkitEntity()).callEvent()) ++ if(!new com.destroystokyo.paper.event.block.TNTPrimeEvent(tntBlock, com.destroystokyo.paper.event.block.TNTPrimeEvent.PrimeReason.ITEM, player.getBukkitEntity()).callEvent()) + return InteractionResult.FAIL; + // Paper end - explode(world, pos, (LivingEntity) player); + TntBlock.explode(world, pos, (LivingEntity) player); world.setBlock(pos, Blocks.AIR.defaultBlockState(), 11); - if (!player.isCreative()) { -@@ -121,6 +143,13 @@ public class TntBlock extends Block { + Item item = itemstack.getItem(); +@@ -126,6 +147,12 @@ public class TntBlock extends Block { + return; } // CraftBukkit end - + // Paper start - TNTPrimeEvent + org.bukkit.block.Block tntBlock = net.minecraft.server.MCUtil.toBukkitBlock(world, blockposition); -+ if (!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.PROJECTILE, projectile.getBukkitEntity()).callEvent()) { ++ if (!new com.destroystokyo.paper.event.block.TNTPrimeEvent(tntBlock, com.destroystokyo.paper.event.block.TNTPrimeEvent.PrimeReason.PROJECTILE, projectile.getBukkitEntity()).callEvent()) { + return; + } + // Paper end -+ - explode(world, blockposition, entity instanceof LivingEntity ? (LivingEntity) entity : null); + TntBlock.explode(world, blockposition, entity instanceof LivingEntity ? (LivingEntity) entity : null); world.removeBlock(blockposition, false); } diff --git a/patches/server-remapped/0259-Break-up-and-make-tab-spam-limits-configurable.patch b/patches/server/0239-Break-up-and-make-tab-spam-limits-configurable.patch similarity index 76% rename from patches/server-remapped/0259-Break-up-and-make-tab-spam-limits-configurable.patch rename to patches/server/0239-Break-up-and-make-tab-spam-limits-configurable.patch index a6f013522..c88867bf3 100644 --- a/patches/server-remapped/0259-Break-up-and-make-tab-spam-limits-configurable.patch +++ b/patches/server/0239-Break-up-and-make-tab-spam-limits-configurable.patch @@ -45,31 +45,31 @@ index 77a03abd59db4a43f6f2d59d4c7ef176e782f205..bd508025b771424c942fd856c31d520b + } } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 645f7b7c862acf77d70ca0b05308945424bc4d32..900c9b1106a153bc386f6c3d9c11226f8ac69f86 100644 +index 902eab82912b9a7002485f73df7ae25e370b7e25..6ea367295d07c444d7cce0366261a884d299185a 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -228,6 +228,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -228,6 +228,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + private long keepAliveChallenge; // CraftBukkit start - multithreaded fields - private volatile int chatSpamTickCount; - private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(ServerGamePacketListenerImpl.class, "chatThrottle"); + private AtomicInteger chatSpamTickCount = new AtomicInteger(); + private final java.util.concurrent.atomic.AtomicInteger tabSpamLimiter = new java.util.concurrent.atomic.AtomicInteger(); // Paper - configurable tab spam limits // CraftBukkit end private int dropSpamTickCount; - private final Int2ShortMap expectedAcks = new Int2ShortOpenHashMap(); -@@ -363,6 +364,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { + private double firstGoodX; +@@ -360,6 +361,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.server.getProfiler().pop(); // CraftBukkit start - for (int spam; (spam = this.chatSpamTickCount) > 0 && !chatSpamField.compareAndSet(this, spam, spam - 1); ) ; + for (int spam; (spam = this.chatSpamTickCount.get()) > 0 && !this.chatSpamTickCount.compareAndSet(spam, spam - 1); ) ; + if (tabSpamLimiter.get() > 0) tabSpamLimiter.getAndDecrement(); // Paper - split to seperate variable /* Use thread-safe field access instead - if (this.chatThrottle > 0) { - --this.chatThrottle; -@@ -714,7 +716,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { + if (this.chatSpamTickCount > 0) { + --this.chatSpamTickCount; +@@ -706,7 +708,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) { // PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async // CraftBukkit start -- if (chatSpamField.addAndGet(this, 1) > 500 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { -+ if (tabSpamLimiter.addAndGet(com.destroystokyo.paper.PaperConfig.tabSpamIncrement) > com.destroystokyo.paper.PaperConfig.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable +- if (this.chatSpamTickCount.addAndGet(1) > 500 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { ++ if (this.chatSpamTickCount.addAndGet(com.destroystokyo.paper.PaperConfig.tabSpamIncrement) > com.destroystokyo.paper.PaperConfig.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]))); // Paper return; } diff --git a/patches/server/0240-MC-135506-Experience-should-save-as-Integers.patch b/patches/server/0240-MC-135506-Experience-should-save-as-Integers.patch new file mode 100644 index 000000000..0136141c9 --- /dev/null +++ b/patches/server/0240-MC-135506-Experience-should-save-as-Integers.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Fri, 3 Aug 2018 00:04:54 -0400 +Subject: [PATCH] MC-135506: Experience should save as Integers + + +diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +index 71fb831ed3359e7986e279c987211f39c581ab23..9c91d8453c6a1ad020ecab45775bd81302b817d3 100644 +--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java ++++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +@@ -286,7 +286,7 @@ public class ExperienceOrb extends Entity { + public void addAdditionalSaveData(CompoundTag nbt) { + nbt.putShort("Health", (short) this.health); + nbt.putShort("Age", (short) this.age); +- nbt.putShort("Value", (short) this.value); ++ nbt.putInt("Value", this.value); // Paper - save as Integer + nbt.putInt("Count", this.count); + this.savePaperNBT(nbt); // Paper + } +@@ -295,7 +295,7 @@ public class ExperienceOrb extends Entity { + public void readAdditionalSaveData(CompoundTag nbt) { + this.health = nbt.getShort("Health"); + this.age = nbt.getShort("Age"); +- this.value = nbt.getShort("Value"); ++ this.value = nbt.getInt("Value"); // Paper - load as Integer + this.count = Math.max(nbt.getInt("Count"), 1); + this.loadPaperNBT(nbt); // Paper + } diff --git a/patches/server-remapped/0262-Fix-client-rendering-skulls-from-same-user.patch b/patches/server/0241-Fix-client-rendering-skulls-from-same-user.patch similarity index 67% rename from patches/server-remapped/0262-Fix-client-rendering-skulls-from-same-user.patch rename to patches/server/0241-Fix-client-rendering-skulls-from-same-user.patch index 057731ba6..5864436e4 100644 --- a/patches/server-remapped/0262-Fix-client-rendering-skulls-from-same-user.patch +++ b/patches/server/0241-Fix-client-rendering-skulls-from-same-user.patch @@ -12,38 +12,30 @@ This allows the client to render multiple skull textures from the same user, for when different skins were used when skull was made. diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -index b4542ce6a8c37ab31e6ecaeb4cbad4742cca0f9b..10f1e3d761af83507bf71a00092641e22d0c8049 100644 +index c0966a873ea5e265936e17796bf6bbee62eea9b4..813814a09ad4c8040d9bf7fff12c8c7b88f164c2 100644 --- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java +++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -@@ -37,6 +37,7 @@ import net.minecraft.network.chat.Component; - import net.minecraft.resources.ResourceLocation; - import net.minecraft.world.item.Item; - import net.minecraft.world.item.ItemStack; -+import net.minecraft.world.level.block.entity.SkullBlockEntity; - import net.minecraft.world.phys.BlockHitResult; - import net.minecraft.world.phys.Vec3; - import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit -@@ -310,9 +311,18 @@ public class FriendlyByteBuf extends ByteBuf { +@@ -473,9 +473,18 @@ public class FriendlyByteBuf extends ByteBuf { if (item.canBeDepleted() || item.shouldOverrideMultiplayerNbt()) { // Spigot start - filter - itemstack = itemstack.copy(); -- CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack)); -+ //CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack)); // Paper - This is no longer needed due to NBT being supported + stack = stack.copy(); +- CraftItemStack.setItemMeta(stack, CraftItemStack.getItemMeta(stack)); ++ // CraftItemStack.setItemMeta(stack, CraftItemStack.getItemMeta(stack)); // Paper - This is no longer needed due to NBT being supported // Spigot end - nbttagcompound = itemstack.getTag(); + nbttagcompound = stack.getTag(); + // Paper start + if (nbttagcompound != null && nbttagcompound.contains("SkullOwner", 10)) { + CompoundTag owner = nbttagcompound.getCompound("SkullOwner"); + if (owner.hasUUID("Id")) { + nbttagcompound.setUUID("SkullOwnerOrig", owner.getUUID("Id")); -+ SkullBlockEntity.sanitizeUUID(owner); ++ net.minecraft.world.level.block.entity.SkullBlockEntity.sanitizeUUID(owner); + } + } + // Paper end } this.writeNbt(nbttagcompound); -@@ -332,7 +342,16 @@ public class FriendlyByteBuf extends ByteBuf { +@@ -495,7 +504,16 @@ public class FriendlyByteBuf extends ByteBuf { itemstack.setTag(this.readNbt()); // CraftBukkit start if (itemstack.getTag() != null) { @@ -62,30 +54,22 @@ index b4542ce6a8c37ab31e6ecaeb4cbad4742cca0f9b..10f1e3d761af83507bf71a00092641e2 // CraftBukkit end return itemstack; diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java -index e5d4363edb8c494d2db69d2e0223a2db1519f64b..4fe15aa331ca18319ca46d1b426f0d6fd24341f0 100644 +index 3bdb09ab00ec05ed532a0c26b9fd321e1f05c1a0..1451a98d69b185dd15a2d1d7681bcecb6a4f99c1 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacket.java -@@ -15,6 +15,7 @@ import net.minecraft.network.FriendlyByteBuf; - import net.minecraft.network.protocol.Packet; - import net.minecraft.world.level.ChunkPos; - import net.minecraft.world.level.block.entity.BlockEntity; -+import net.minecraft.world.level.block.entity.SkullBlockEntity; - import net.minecraft.world.level.chunk.ChunkBiomeContainer; - import net.minecraft.world.level.chunk.LevelChunk; - import net.minecraft.world.level.chunk.LevelChunkSection; -@@ -69,6 +70,7 @@ public class ClientboundLevelChunkPacket implements Packet entry2 : chunk.getBlockEntities().entrySet()) { + BlockEntity blockEntity = entry2.getValue(); + CompoundTag compoundTag = blockEntity.getUpdateTag(); ++ if (blockEntity instanceof net.minecraft.world.level.block.entity.SkullBlockEntity) { net.minecraft.world.level.block.entity.SkullBlockEntity.sanitizeTileEntityUUID(compoundTag); } // Paper + this.blockEntitiesTags.add(compoundTag); + } - if (this.isFullChunk() || (includedSectionsMask & 1 << j) != 0) { - CompoundTag nbttagcompound = tileentity.getUpdateTag(); -+ if (tileentity instanceof SkullBlockEntity) { SkullBlockEntity.sanitizeTileEntityUUID(nbttagcompound); } // Paper - - this.blockEntitiesTags.add(nbttagcompound); - } diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 34187197efd5ceff0503682dc6ce313220ca916f..79a7c37f15840dbd97510874ac12437d2b854999 100644 +index 4d4b471bbfb2d9174391c8adc6075ec11295408b..8b3cf3b882ea6c0d48df8b551f4b85b87b889c58 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -112,7 +112,7 @@ public final class ItemStack { +@@ -143,7 +143,7 @@ public final class ItemStack { private int popTime; @Deprecated private Item item; @@ -95,18 +79,18 @@ index 34187197efd5ceff0503682dc6ce313220ca916f..79a7c37f15840dbd97510874ac12437d private Entity entityRepresentation; private BlockInWorld cachedBreakBlock; diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java -index eebaeaccc3ba1a9ec089d84b8de6c9d36034868f..6a1289424421083876d1808b7328cd3f01063a7e 100644 +index eaf586eb386e13e954bc593f6ddbc45929cec204..f0192a009f6a21d1781ce709624a9187048d9a08 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java -@@ -25,6 +25,7 @@ import java.util.concurrent.Executors; - import java.util.concurrent.Future; - import java.util.concurrent.TimeUnit; +@@ -10,6 +10,7 @@ import java.util.function.Consumer; + import javax.annotation.Nullable; + import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; import net.minecraft.nbt.NbtUtils; import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; - import net.minecraft.server.MinecraftServer; -@@ -152,9 +153,37 @@ public class SkullBlockEntity extends BlockEntity /*implements ITickable*/ { // + import net.minecraft.server.players.GameProfileCache; +@@ -91,9 +92,37 @@ public class SkullBlockEntity extends BlockEntity { @Nullable @Override public ClientboundBlockEntityDataPacket getUpdatePacket() { diff --git a/patches/server-remapped/0263-Add-Early-Warning-Feature-to-WatchDog.patch b/patches/server/0242-Add-Early-Warning-Feature-to-WatchDog.patch similarity index 78% rename from patches/server-remapped/0263-Add-Early-Warning-Feature-to-WatchDog.patch rename to patches/server/0242-Add-Early-Warning-Feature-to-WatchDog.patch index 4f9ee3cc3..35278841d 100644 --- a/patches/server-remapped/0263-Add-Early-Warning-Feature-to-WatchDog.patch +++ b/patches/server/0242-Add-Early-Warning-Feature-to-WatchDog.patch @@ -36,10 +36,10 @@ index bd508025b771424c942fd856c31d520b6f548082..62621562137cba4804f0465c58d25ca2 public static int tabSpamLimit = 500; private static void tabSpamLimiters() { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 125a75576442eaa4f1ff6dd153bdb31097497a3f..5a76ca77b974ff6fe862c9e05a88b507a34b44be 100644 +index a0c436fd5e7e03a0a01e59c046e65ebdcd88021a..cf92c3275869e4a0209fd4b07ad723e11717dc86 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1017,6 +1017,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && monotonicMillis() > lastTick + timeoutTime && !Boolean.getBoolean("disable.watchdog")) // Paper - Add property to disable + // +- if ( this.lastTick != 0 && this.timeoutTime > 0 && WatchdogThread.monotonicMillis() > this.lastTick + this.timeoutTime && !Boolean.getBoolean("disable.watchdog")) // Paper - Add property to disable + // Paper start + Logger log = Bukkit.getServer().getLogger(); -+ long currentTime = monotonicMillis(); -+ if ( lastTick != 0 && timeoutTime > 0 && currentTime > lastTick + earlyWarningEvery && !Boolean.getBoolean("disable.watchdog") ) ++ long currentTime = WatchdogThread.monotonicMillis(); ++ if ( this.lastTick != 0 && this.timeoutTime > 0 && currentTime > this.lastTick + this.earlyWarningEvery && !Boolean.getBoolean("disable.watchdog")) // Paper - Add property to disable { - Logger log = Bukkit.getServer().getLogger(); + boolean isLongTimeout = currentTime > lastTick + timeoutTime; @@ -134,7 +133,7 @@ index ee0cca25ef458f2f0f7e450a2edea2b2adb7e846..16f6163bb53e73aa4ab6e22365342613 log.log( Level.SEVERE, "------------------------------" ); log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Paper bug." ); // Paper log.log( Level.SEVERE, "If you see a plugin in the Server thread dump below, then please report it to that author" ); -@@ -93,29 +108,46 @@ public class WatchdogThread extends Thread +@@ -93,29 +109,45 @@ public class WatchdogThread extends Thread } } // Paper end @@ -146,7 +145,7 @@ index ee0cca25ef458f2f0f7e450a2edea2b2adb7e846..16f6163bb53e73aa4ab6e22365342613 + // Paper end - Different message for short timeout log.log( Level.SEVERE, "------------------------------" ); log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); // Paper - dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log ); + WatchdogThread.dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log ); log.log( Level.SEVERE, "------------------------------" ); // + // Paper start - Only print full dump on long timeouts @@ -156,18 +155,17 @@ index ee0cca25ef458f2f0f7e450a2edea2b2adb7e846..16f6163bb53e73aa4ab6e22365342613 ThreadInfo[] threads = ManagementFactory.getThreadMXBean().dumpAllThreads( true, true ); for ( ThreadInfo thread : threads ) { - dumpThread( thread, log ); + WatchdogThread.dumpThread( thread, log ); } + } else { + log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH ---"); + } -+ + log.log( Level.SEVERE, "------------------------------" ); + if ( isLongTimeout ) + { - if ( restart && !MinecraftServer.getServer().hasStopped() ) + if ( this.restart && !MinecraftServer.getServer().hasStopped() ) { RestartCommand.restart(); } diff --git a/patches/server-remapped/0264-Make-EnderDragon-implement-Mob.patch b/patches/server/0243-Make-EnderDragon-implement-Mob.patch similarity index 100% rename from patches/server-remapped/0264-Make-EnderDragon-implement-Mob.patch rename to patches/server/0243-Make-EnderDragon-implement-Mob.patch diff --git a/patches/server-remapped/0265-Use-ConcurrentHashMap-in-JsonList.patch b/patches/server/0244-Use-ConcurrentHashMap-in-JsonList.patch similarity index 84% rename from patches/server-remapped/0265-Use-ConcurrentHashMap-in-JsonList.patch rename to patches/server/0244-Use-ConcurrentHashMap-in-JsonList.patch index b981b8b04..2500d0813 100644 --- a/patches/server-remapped/0265-Use-ConcurrentHashMap-in-JsonList.patch +++ b/patches/server/0244-Use-ConcurrentHashMap-in-JsonList.patch @@ -25,20 +25,20 @@ The point of this is readability, but does have a side-benefit of a small microp Finally, added a couple obfhelpers for the modified code diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 0bb397407b55bd1c464ac603ec4c189045aabbb2..7c307a16ca3962db65be09a0ddd058a4ce81c7be 100644 +index 7c5a75fb34640bb4e7ef839412dbb30b0d0fc8e8..b62aa9f934c33b4d22b985b5e56937baa8454677 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -614,7 +614,7 @@ public abstract class PlayerList { +@@ -610,7 +610,7 @@ public abstract class PlayerList { } else if (!this.isWhitelisted(gameprofile, event)) { // Paper //chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted"); // Paper //event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot // Paper - moved to isWhitelisted -- } else if (getIpBans().isBanned(socketaddress) && !getIpBans().get(socketaddress).hasExpired()) { -+ } else if (getIpBans().isBanned(socketaddress) && getIpBans().get(socketaddress) != null && !getIpBans().get(socketaddress).hasExpired()) { // Paper - fix NPE with temp ip bans +- } else if (this.getIpBans().isBanned(socketaddress) && !this.getIpBans().get(socketaddress).hasExpired()) { ++ } else if (this.getIpBans().isBanned(socketaddress) && getIpBans().get(socketaddress) != null && !this.getIpBans().get(socketaddress).hasExpired()) { // Paper - fix NPE with temp ip bans IpBanListEntry ipbanentry = this.ipBans.get(socketaddress); chatmessage = new TranslatableComponent("multiplayer.disconnect.banned_ip.reason", new Object[]{ipbanentry.getReason()}); diff --git a/src/main/java/net/minecraft/server/players/StoredUserList.java b/src/main/java/net/minecraft/server/players/StoredUserList.java -index 2cb235d695c244863a37454df22d5d94a291524d..e2982a8ac5448110378bc92247952332bdffe12c 100644 +index 00e3662e25618459447d4ce5f56f7e046bfe47e2..4b85943a704e0a5ca6b95f9cfcbfd1f9505c3b68 100644 --- a/src/main/java/net/minecraft/server/players/StoredUserList.java +++ b/src/main/java/net/minecraft/server/players/StoredUserList.java @@ -12,6 +12,8 @@ import java.io.BufferedReader; @@ -50,7 +50,7 @@ index 2cb235d695c244863a37454df22d5d94a291524d..e2982a8ac5448110378bc92247952332 import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.Iterator; -@@ -28,7 +30,22 @@ public abstract class StoredUserList> { +@@ -30,7 +32,22 @@ public abstract class StoredUserList> { protected static final Logger LOGGER = LogManager.getLogger(); private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().create(); private final File file; @@ -74,7 +74,7 @@ index 2cb235d695c244863a37454df22d5d94a291524d..e2982a8ac5448110378bc92247952332 public StoredUserList(File file) { this.file = file; -@@ -51,8 +68,13 @@ public abstract class StoredUserList> { +@@ -53,8 +70,13 @@ public abstract class StoredUserList> { @Nullable public V get(K key) { @@ -90,7 +90,7 @@ index 2cb235d695c244863a37454df22d5d94a291524d..e2982a8ac5448110378bc92247952332 } public void remove(K key) { -@@ -81,9 +103,11 @@ public abstract class StoredUserList> { +@@ -83,9 +105,11 @@ public abstract class StoredUserList> { // CraftBukkit end public boolean isEmpty() { @@ -103,7 +103,7 @@ index 2cb235d695c244863a37454df22d5d94a291524d..e2982a8ac5448110378bc92247952332 protected String getKeyForUser(K profile) { return profile.toString(); } -@@ -92,15 +116,16 @@ public abstract class StoredUserList> { +@@ -94,15 +118,16 @@ public abstract class StoredUserList> { return this.map.containsKey(this.getKeyForUser(k0)); } @@ -123,7 +123,7 @@ index 2cb235d695c244863a37454df22d5d94a291524d..e2982a8ac5448110378bc92247952332 } } -@@ -109,9 +134,11 @@ public abstract class StoredUserList> { +@@ -111,9 +136,11 @@ public abstract class StoredUserList> { while (iterator.hasNext()) { K k0 = (K) iterator.next(); // CraftBukkit - decompile error @@ -137,11 +137,11 @@ index 2cb235d695c244863a37454df22d5d94a291524d..e2982a8ac5448110378bc92247952332 } protected abstract StoredUserEntry createEntry(JsonObject json); -@@ -121,6 +148,7 @@ public abstract class StoredUserList> { +@@ -123,6 +150,7 @@ public abstract class StoredUserList> { } public void save() throws IOException { + this.removeStaleEntries(); // Paper - remove expired values before saving JsonArray jsonarray = new JsonArray(); - - this.map.values().stream().map((jsonlistentry) -> { + Stream stream = this.map.values().stream().map((jsonlistentry) -> { // CraftBukkit - decompile error + JsonObject jsonobject = new JsonObject(); diff --git a/patches/server-remapped/0266-Use-a-Queue-for-Queueing-Commands.patch b/patches/server/0245-Use-a-Queue-for-Queueing-Commands.patch similarity index 84% rename from patches/server-remapped/0266-Use-a-Queue-for-Queueing-Commands.patch rename to patches/server/0245-Use-a-Queue-for-Queueing-Commands.patch index b220fa4eb..949a91444 100644 --- a/patches/server-remapped/0266-Use-a-Queue-for-Queueing-Commands.patch +++ b/patches/server/0245-Use-a-Queue-for-Queueing-Commands.patch @@ -6,19 +6,19 @@ Subject: [PATCH] Use a Queue for Queueing Commands Lists are bad as Queues mmmkay. diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 9143fe99e43236bf65e6f098a30d522302ad78b7..4862a9519d4ba5f05b634a0335837bea9812edee 100644 +index 45ae21718df16e16b5a3835a92afbf714959950e..6f9b7c3cf22d0c44f31b81bcbfa3cb1f8c065083 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -72,7 +72,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface - - private static final Logger LOGGER = LogManager.getLogger(); +@@ -78,7 +78,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface + private static final int CONVERSION_RETRY_DELAY_MS = 5000; + private static final int CONVERSION_RETRIES = 2; private static final Pattern SHA1 = Pattern.compile("^[a-fA-F0-9]{40}$"); - private final List consoleInput = Collections.synchronizedList(Lists.newArrayList()); + private final java.util.Queue serverCommandQueue = new java.util.concurrent.ConcurrentLinkedQueue<>(); // Paper - use a proper queue private QueryThreadGs4 queryThreadGs4; public final RconConsoleSource rconConsoleSource; private RconThread rconThread; -@@ -426,13 +426,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -473,13 +473,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface } public void handleConsoleInput(String command, CommandSourceStack commandSource) { diff --git a/patches/server-remapped/0267-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch b/patches/server/0246-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch similarity index 71% rename from patches/server-remapped/0267-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch rename to patches/server/0246-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch index 52dbc8ee7..9b7b00084 100644 --- a/patches/server-remapped/0267-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch +++ b/patches/server/0246-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Ability to get Tile Entities from a chunk without snapshots diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index 93b9e9d5932764f7e946dd3f8ab8191189c5d38f..423594177fe78600755d913f169f28dd1bfa2b37 100644 +index 810fb066b76dc915a050cc1fb80b6efc7538becc..245d764d3dcc549fa8acbd7c9024a3c88d2d2a74 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -3,8 +3,10 @@ package org.bukkit.craftbukkit; @@ -19,7 +19,7 @@ index 93b9e9d5932764f7e946dd3f8ab8191189c5d38f..423594177fe78600755d913f169f28dd import java.util.function.Predicate; import net.minecraft.core.BlockPos; import net.minecraft.core.Registry; -@@ -129,9 +131,16 @@ public class CraftChunk implements Chunk { +@@ -117,6 +119,13 @@ public class CraftChunk implements Chunk { @Override public BlockState[] getTileEntities() { @@ -29,25 +29,22 @@ index 93b9e9d5932764f7e946dd3f8ab8191189c5d38f..423594177fe78600755d913f169f28dd + + @Override + public BlockState[] getTileEntities(boolean useSnapshot) { - if (!isLoaded()) { - getWorld().getChunkAt(x, z); // Transient load for this tick - } + // Paper end - int index = 0; - net.minecraft.world.level.chunk.LevelChunk chunk = getHandle(); - -@@ -143,11 +152,33 @@ public class CraftChunk implements Chunk { + if (!this.isLoaded()) { + this.getWorld().getChunkAt(x, z); // Transient load for this tick + } +@@ -131,7 +140,29 @@ public class CraftChunk implements Chunk { } BlockPos position = (BlockPos) obj; -- entities[index++] = worldServer.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()).getState(); -+ entities[index++] = worldServer.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()).getState(useSnapshot); // Paper +- entities[index++] = this.worldServer.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()).getState(); ++ // Paper start ++ entities[index++] = this.worldServer.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()).getState(useSnapshot); + } + + return entities; + } + -+ // Paper start + @Override + public Collection getTileEntities(Predicate blockPredicate, boolean useSnapshot) { + Preconditions.checkNotNull(blockPredicate, "blockPredicate"); @@ -63,11 +60,7 @@ index 93b9e9d5932764f7e946dd3f8ab8191189c5d38f..423594177fe78600755d913f169f28dd + if (blockPredicate.test(block)) { + entities.add(block.getState(useSnapshot)); + } ++ // Paper end } return entities; - } -+ // Paper end - - @Override - public boolean isLoaded() { diff --git a/patches/server-remapped/0269-Optimize-BlockPosition-helper-methods.patch b/patches/server/0247-Optimize-BlockPosition-helper-methods.patch similarity index 86% rename from patches/server-remapped/0269-Optimize-BlockPosition-helper-methods.patch rename to patches/server/0247-Optimize-BlockPosition-helper-methods.patch index fa154eb15..b31d553b3 100644 --- a/patches/server-remapped/0269-Optimize-BlockPosition-helper-methods.patch +++ b/patches/server/0247-Optimize-BlockPosition-helper-methods.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimize BlockPosition helper methods Resolves #1338 diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index c5089b0da33a68e7cadbc4841b07f9d772d224a0..b13e5d05d862ea8c6031b8071f525f00bc48f7e7 100644 +index c2309751e3798874eee6b469129121c2e317fbc3..dd1d76867ac3832ad515f304925c595c9a021c8f 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java -@@ -121,58 +121,75 @@ public class BlockPos extends Vec3i { +@@ -131,67 +131,84 @@ public class BlockPos extends Vec3i { @Override public BlockPos above() { @@ -30,53 +30,61 @@ index c5089b0da33a68e7cadbc4841b07f9d772d224a0..b13e5d05d862ea8c6031b8071f525f00 } @Override - public BlockPos below(int distance) { -- return this.relative(Direction.DOWN, distance); -+ return distance == 0 ? this : new BlockPos(this.getX(), this.getY() - distance, this.getZ()); // Paper - Optimize BlockPosition + public BlockPos below(int i) { +- return this.relative(Direction.DOWN, i); ++ return i == 0 ? this : new BlockPos(this.getX(), this.getY() - i, this.getZ()); // Paper - Optimize BlockPosition } + @Override public BlockPos north() { - return this.relative(Direction.NORTH); + return new BlockPos(this.getX(), this.getY(), this.getZ() - 1); // Paper - Optimize BlockPosition } + @Override public BlockPos north(int distance) { - return this.relative(Direction.NORTH, distance); + return distance == 0 ? this : new BlockPos(this.getX(), this.getY(), this.getZ() - distance); // Paper - Optimize BlockPosition } + @Override public BlockPos south() { - return this.relative(Direction.SOUTH); + return new BlockPos(this.getX(), this.getY(), this.getZ() + 1); // Paper - Optimize BlockPosition } + @Override public BlockPos south(int distance) { - return this.relative(Direction.SOUTH, distance); + return distance == 0 ? this : new BlockPos(this.getX(), this.getY(), this.getZ() + distance); // Paper - Optimize BlockPosition } + @Override public BlockPos west() { - return this.relative(Direction.WEST); + return new BlockPos(this.getX() - 1, this.getY(), this.getZ()); // Paper - Optimize BlockPosition } + @Override public BlockPos west(int distance) { - return this.relative(Direction.WEST, distance); + return distance == 0 ? this : new BlockPos(this.getX() - distance, this.getY(), this.getZ()); // Paper - Optimize BlockPosition } + @Override public BlockPos east() { - return this.relative(Direction.EAST); + return new BlockPos(this.getX() + 1, this.getY(), this.getZ()); // Paper - Optimize BlockPosition } + @Override public BlockPos east(int distance) { - return this.relative(Direction.EAST, distance); + return distance == 0 ? this : new BlockPos(this.getX() + distance, this.getY(), this.getZ()); // Paper - Optimize BlockPosition } + @Override public BlockPos relative(Direction direction) { -- return new BlockPos(this.getX() + direction.getStepX(), this.getY() + direction.getStepY(), this.getZ() + direction.getStepZ()); + // Paper Start - Optimize BlockPosition + switch(direction) { + case UP: @@ -92,7 +100,7 @@ index c5089b0da33a68e7cadbc4841b07f9d772d224a0..b13e5d05d862ea8c6031b8071f525f00 + case EAST: + return new BlockPos(this.getX() + 1, this.getY(), this.getZ()); + default: -+ return new BlockPos(this.getX() + direction.getStepX(), this.getY() + direction.getStepY(), this.getZ() + direction.getStepZ()); + return new BlockPos(this.getX() + direction.getStepX(), this.getY() + direction.getStepY(), this.getZ() + direction.getStepZ()); + } + // Paper End } diff --git a/patches/server-remapped/0270-Restore-vanlla-default-mob-spawn-range-and-water-ani.patch b/patches/server/0248-Restore-vanlla-default-mob-spawn-range-and-water-ani.patch similarity index 76% rename from patches/server-remapped/0270-Restore-vanlla-default-mob-spawn-range-and-water-ani.patch rename to patches/server/0248-Restore-vanlla-default-mob-spawn-range-and-water-ani.patch index 50cfc368a..84ff27f26 100644 --- a/patches/server-remapped/0270-Restore-vanlla-default-mob-spawn-range-and-water-ani.patch +++ b/patches/server/0248-Restore-vanlla-default-mob-spawn-range-and-water-ani.patch @@ -6,16 +6,16 @@ Subject: [PATCH] Restore vanlla default mob-spawn-range and water animals diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 0efcbab8f8806aeb8dd8bd6384e5a7cee375d100..34ee684901906fc2ef5f0d09680d2686b813e52b 100644 +index 9a31d8b709b28bba658603106c623560c5362947..8e6eae7cc27f66faede9a3dc74571e1814df3652 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -165,7 +165,7 @@ public class SpigotWorldConfig public byte mobSpawnRange; private void mobSpawnRange() { -- mobSpawnRange = (byte) getInt( "mob-spawn-range", 6 ); -+ mobSpawnRange = (byte) getInt( "mob-spawn-range", 8 ); // Paper - Vanilla - log( "Mob Spawn Range: " + mobSpawnRange ); +- this.mobSpawnRange = (byte) this.getInt( "mob-spawn-range", 6 ); ++ this.mobSpawnRange = (byte) getInt( "mob-spawn-range", 8 ); // Paper - Vanilla + this.log( "Mob Spawn Range: " + this.mobSpawnRange ); } diff --git a/src/main/resources/configurations/bukkit.yml b/src/main/resources/configurations/bukkit.yml diff --git a/patches/server/0249-Slime-Pathfinder-Events.patch b/patches/server/0249-Slime-Pathfinder-Events.patch new file mode 100644 index 000000000..4cb18162e --- /dev/null +++ b/patches/server/0249-Slime-Pathfinder-Events.patch @@ -0,0 +1,167 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Fri, 24 Aug 2018 08:18:42 -0500 +Subject: [PATCH] Slime Pathfinder Events + + +diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java +index 53130b34e5964acec191e1d8de6bde996f498699..6a199e148929d8df9b1f39733dd821c503380973 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/Slime.java ++++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java +@@ -44,6 +44,12 @@ import net.minecraft.world.level.biome.Biomes; + import net.minecraft.world.level.levelgen.WorldgenRandom; + import net.minecraft.world.level.storage.loot.BuiltInLootTables; + import net.minecraft.world.phys.Vec3; ++// Paper start ++import com.destroystokyo.paper.event.entity.SlimeChangeDirectionEvent; ++import com.destroystokyo.paper.event.entity.SlimeSwimEvent; ++import com.destroystokyo.paper.event.entity.SlimeTargetLivingEntityEvent; ++import com.destroystokyo.paper.event.entity.SlimeWanderEvent; ++// Paper end + // CraftBukkit start + import java.util.ArrayList; + import java.util.List; +@@ -108,6 +114,7 @@ public class Slime extends Mob implements Enemy { + @Override + public void addAdditionalSaveData(CompoundTag nbt) { + super.addAdditionalSaveData(nbt); ++ nbt.putBoolean("Paper.canWander", this.canWander); // Paper + nbt.putInt("Size", this.getSize() - 1); + nbt.putBoolean("wasOnGround", this.wasOnGround); + } +@@ -116,6 +123,11 @@ public class Slime extends Mob implements Enemy { + public void readAdditionalSaveData(CompoundTag nbt) { + this.setSize(nbt.getInt("Size") + 1, false); + super.readAdditionalSaveData(nbt); ++ // Paper start - check exists before loading or this will be loaded as false ++ if (nbt.contains("Paper.canWander")) { ++ this.canWander = nbt.getBoolean("Paper.canWander"); ++ } ++ // Paper end + this.wasOnGround = nbt.getBoolean("wasOnGround"); + } + +@@ -453,7 +465,7 @@ public class Slime extends Mob implements Enemy { + + @Override + public boolean canUse() { +- return (this.slime.isInWater() || this.slime.isInLava()) && this.slime.getMoveControl() instanceof Slime.SlimeMoveControl; ++ return (this.slime.isInWater() || this.slime.isInLava()) && this.slime.getMoveControl() instanceof Slime.SlimeMoveControl && this.slime.canWander && new SlimeSwimEvent((org.bukkit.entity.Slime) this.slime.getBukkitEntity()).callEvent(); // Paper + } + + @Override +@@ -480,7 +492,15 @@ public class Slime extends Mob implements Enemy { + public boolean canUse() { + LivingEntity entityliving = this.slime.getTarget(); + +- return entityliving == null ? false : (!this.slime.canAttack(entityliving) ? false : this.slime.getMoveControl() instanceof Slime.SlimeMoveControl); ++ // Paper start ++ if (entityliving == null || !entityliving.isAlive()) { ++ return false; ++ } ++ if (!this.slime.canAttack(entityliving)) { ++ return false; ++ } ++ return this.slime.getMoveControl() instanceof Slime.SlimeMoveControl && this.slime.canWander && new SlimeTargetLivingEntityEvent((org.bukkit.entity.Slime) this.slime.getBukkitEntity(), (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity()).callEvent(); ++ // Paper end + } + + @Override +@@ -493,7 +513,15 @@ public class Slime extends Mob implements Enemy { + public boolean canContinueToUse() { + LivingEntity entityliving = this.slime.getTarget(); + +- return entityliving == null ? false : (!this.slime.canAttack(entityliving) ? false : --this.growTiredTimer > 0); ++ // Paper start ++ if (entityliving == null || !entityliving.isAlive()) { ++ return false; ++ } ++ if (!this.slime.canAttack(entityliving)) { ++ return false; ++ } ++ return --this.growTiredTimer > 0 && this.slime.canWander && new SlimeTargetLivingEntityEvent((org.bukkit.entity.Slime) this.slime.getBukkitEntity(), (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity()).callEvent(); ++ // Paper end + } + + @Override +@@ -501,6 +529,13 @@ public class Slime extends Mob implements Enemy { + this.slime.lookAt((Entity) this.slime.getTarget(), 10.0F, 10.0F); + ((Slime.SlimeMoveControl) this.slime.getMoveControl()).setDirection(this.slime.getYRot(), this.slime.isDealsDamage()); + } ++ ++ // Paper start - clear timer and target when goal resets ++ public void stop() { ++ this.growTiredTimer = 0; ++ this.slime.setTarget(null); ++ } ++ // Paper end + } + + private static class SlimeRandomDirectionGoal extends Goal { +@@ -516,14 +551,18 @@ public class Slime extends Mob implements Enemy { + + @Override + public boolean canUse() { +- return this.slime.getTarget() == null && (this.slime.onGround || this.slime.isInWater() || this.slime.isInLava() || this.slime.hasEffect(MobEffects.LEVITATION)) && this.slime.getMoveControl() instanceof Slime.SlimeMoveControl; ++ return this.slime.getTarget() == null && (this.slime.onGround || this.slime.isInWater() || this.slime.isInLava() || this.slime.hasEffect(MobEffects.LEVITATION)) && this.slime.getMoveControl() instanceof Slime.SlimeMoveControl && this.slime.canWander; // Paper - add canWander + } + + @Override + public void tick() { + if (--this.nextRandomizeTime <= 0) { + this.nextRandomizeTime = 40 + this.slime.getRandom().nextInt(60); +- this.chosenDegrees = (float) this.slime.getRandom().nextInt(360); ++ // Paper start ++ SlimeChangeDirectionEvent event = new SlimeChangeDirectionEvent((org.bukkit.entity.Slime) this.slime.getBukkitEntity(), (float) this.slime.getRandom().nextInt(360)); ++ if (!this.slime.canWander || !event.callEvent()) return; ++ this.chosenDegrees = event.getNewYaw(); ++ // Paper end + } + + ((Slime.SlimeMoveControl) this.slime.getMoveControl()).setDirection(this.chosenDegrees, false); +@@ -541,7 +580,7 @@ public class Slime extends Mob implements Enemy { + + @Override + public boolean canUse() { +- return !this.slime.isPassenger(); ++ return !this.slime.isPassenger() && this.slime.canWander && new SlimeWanderEvent((org.bukkit.entity.Slime) this.slime.getBukkitEntity()).callEvent(); // Paper + } + + @Override +@@ -549,4 +588,15 @@ public class Slime extends Mob implements Enemy { + ((Slime.SlimeMoveControl) this.slime.getMoveControl()).setWantedMovement(1.0D); + } + } ++ ++ // Paper start ++ private boolean canWander = true; ++ public boolean canWander() { ++ return canWander; ++ } ++ ++ public void setWander(boolean canWander) { ++ this.canWander = canWander; ++ } ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java +index 67fc37f909639e1effe6034526990f10d575d14d..4d401403de2399919043651345eed91c11ac986f 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java +@@ -34,4 +34,16 @@ public class CraftSlime extends CraftMob implements Slime { + public EntityType getType() { + return EntityType.SLIME; + } ++ ++ // Paper start ++ @Override ++ public boolean canWander() { ++ return getHandle().canWander(); ++ } ++ ++ @Override ++ public void setWander(boolean canWander) { ++ getHandle().setWander(canWander); ++ } ++ // Paper end + } diff --git a/patches/server-remapped/0272-Configurable-speed-for-water-flowing-over-lava.patch b/patches/server/0250-Configurable-speed-for-water-flowing-over-lava.patch similarity index 69% rename from patches/server-remapped/0272-Configurable-speed-for-water-flowing-over-lava.patch rename to patches/server/0250-Configurable-speed-for-water-flowing-over-lava.patch index c8fef8a86..a2e8efe50 100644 --- a/patches/server-remapped/0272-Configurable-speed-for-water-flowing-over-lava.patch +++ b/patches/server/0250-Configurable-speed-for-water-flowing-over-lava.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable speed for water flowing over lava diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 5ab0e7183e48134b7a0f736462516b1a8a333b04..f280dbff4a09bc611a9ca565c6d697d08801f53b 100644 +index 8bb33e1b631c3aa99cef2a63c140f0b0e11325e0..c17c504acdc12b6ef37d6643eb98a57fa5ca40c9 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -390,4 +390,10 @@ public class PaperWorldConfig { +@@ -384,4 +384,10 @@ public class PaperWorldConfig { this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick); log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default"); } @@ -20,23 +20,23 @@ index 5ab0e7183e48134b7a0f736462516b1a8a333b04..f280dbff4a09bc611a9ca565c6d697d0 + } } diff --git a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java -index f99b90e4b3210747077f2bf3adbcf7b5fb9821ec..97f2d9082e49010fb8780c5fdd8957f71b31e43e 100644 +index db4bcb600ab43439ef65d4510fb20d770ce9dba3..087601ffdeea97ec4cbb9959607bdcbcbae7c6fa 100644 --- a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java +++ b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java -@@ -23,6 +23,7 @@ import net.minecraft.world.level.material.FlowingFluid; +@@ -26,6 +26,7 @@ import net.minecraft.world.level.block.state.properties.IntegerProperty; + import net.minecraft.world.level.material.FlowingFluid; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; - import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.level.material.Material; import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.phys.shapes.CollisionContext; -@@ -100,11 +101,28 @@ public class LiquidBlock extends Block implements BucketPickup { +@@ -109,11 +110,27 @@ public class LiquidBlock extends Block implements BucketPickup { @Override public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { if (this.shouldSpreadLiquid(world, pos, state)) { -- world.getLiquidTicks().a(pos, state.getFluidState().getType(), this.fluid.getTickDelay((LevelReader) world)); -+ world.getLiquidTicks().a(pos, state.getFluidState().getType(), this.getFlowSpeed(world, pos)); // Paper +- world.getLiquidTicks().scheduleTick(pos, state.getFluidState().getType(), this.fluid.getTickDelay((LevelReader) world)); ++ world.getLiquidTicks().scheduleTick(pos, state.getFluidState().getType(), this.getFlowSpeed(world, pos)); // Paper } } @@ -56,17 +56,16 @@ index f99b90e4b3210747077f2bf3adbcf7b5fb9821ec..97f2d9082e49010fb8780c5fdd8957f7 + return this.fluid.getTickDelay(world); + } + // Paper end -+ + @Override - public BlockState updateShape(BlockState state, Direction direction, BlockState newState, LevelAccessor world, BlockPos pos, BlockPos posFrom) { - if (state.getFluidState().isSource() || newState.getFluidState().isSource()) { -@@ -117,7 +135,7 @@ public class LiquidBlock extends Block implements BucketPickup { + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getFluidState().isSource() || neighborState.getFluidState().isSource()) { +@@ -126,7 +143,7 @@ public class LiquidBlock extends Block implements BucketPickup { @Override public void neighborChanged(BlockState state, Level world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) { if (this.shouldSpreadLiquid(world, pos, state)) { -- world.getLiquidTicks().a(pos, state.getFluidState().getType(), this.fluid.getTickDelay((LevelReader) world)); -+ world.getLiquidTicks().a(pos, state.getFluidState().getType(), this.getFlowSpeed(world, pos)); // Paper +- world.getLiquidTicks().scheduleTick(pos, state.getFluidState().getType(), this.fluid.getTickDelay((LevelReader) world)); ++ world.getLiquidTicks().scheduleTick(pos, state.getFluidState().getType(), this.getFlowSpeed(world, pos)); // Paper } } diff --git a/patches/server-remapped/0273-Optimize-CraftBlockData-Creation.patch b/patches/server/0251-Optimize-CraftBlockData-Creation.patch similarity index 84% rename from patches/server-remapped/0273-Optimize-CraftBlockData-Creation.patch rename to patches/server/0251-Optimize-CraftBlockData-Creation.patch index b9e1c45f8..ddae1a7ae 100644 --- a/patches/server-remapped/0273-Optimize-CraftBlockData-Creation.patch +++ b/patches/server/0251-Optimize-CraftBlockData-Creation.patch @@ -7,10 +7,10 @@ Avoids a hashmap lookup by cacheing a reference to the CraftBlockData and cloning it when one is needed. diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index 5d7794c9533bd37193f196bda616adaaace2bbde..57eedaeedaa24bd274fb55c6e4521f1305382645 100644 +index 549eb8a5f0f20db88abd17136f69f7bb00883011..d99ca942f5885b4d9af054547832c05ddb5634eb 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -374,6 +374,14 @@ public abstract class BlockBehaviour { +@@ -637,6 +637,14 @@ public abstract class BlockBehaviour { this.hasPostProcess = blockbase_info.hasPostProcess; this.emissiveRendering = blockbase_info.emissiveRendering; } @@ -26,10 +26,10 @@ index 5d7794c9533bd37193f196bda616adaaace2bbde..57eedaeedaa24bd274fb55c6e4521f13 public void initCache() { if (!this.getBlock().hasDynamicShape()) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -index 3a90b504ebbe86350f5fee5baa818e40d884d24f..0b6c6dfc380cea87bd88c3eb8a199e072dcbf56c 100644 +index c6a9ce2a67591205cbeb436b5043e737331c3527..3594f432a25b580173e8577bf324be954f5eddd1 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -@@ -509,7 +509,17 @@ public class CraftBlockData implements BlockData { +@@ -527,7 +527,17 @@ public class CraftBlockData implements BlockData { return craft; } @@ -44,6 +44,6 @@ index 3a90b504ebbe86350f5fee5baa818e40d884d24f..0b6c6dfc380cea87bd88c3eb8a199e07 + + public static CraftBlockData createData(BlockState data) { + // Paper end - return MAP.getOrDefault(data.getBlock().getClass(), CraftBlockData::new).apply(data); + return CraftBlockData.MAP.getOrDefault(data.getBlock().getClass(), CraftBlockData::new).apply(data); } diff --git a/patches/server/0252-Optimize-MappedRegistry.patch b/patches/server/0252-Optimize-MappedRegistry.patch new file mode 100644 index 000000000..047b65a8d --- /dev/null +++ b/patches/server/0252-Optimize-MappedRegistry.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 26 Aug 2018 20:49:50 -0400 +Subject: [PATCH] Optimize MappedRegistry + +Use larger initial sizes to increase bucket capacity on the BiMap + +BiMap.get was seen to be using a good bit of CPU time. + +diff --git a/src/main/java/net/minecraft/core/MappedRegistry.java b/src/main/java/net/minecraft/core/MappedRegistry.java +index 889c213205738ba637a28895977714df2d025b6d..87ea9b851531ac98a2dce66651f1730c5eb5e7d4 100644 +--- a/src/main/java/net/minecraft/core/MappedRegistry.java ++++ b/src/main/java/net/minecraft/core/MappedRegistry.java +@@ -37,7 +37,7 @@ import org.apache.logging.log4j.Logger; + public class MappedRegistry extends WritableRegistry { + protected static final Logger LOGGER = LogManager.getLogger(); + private final ObjectList byId = new ObjectArrayList<>(256); +- private final Object2IntMap toId = new Object2IntOpenCustomHashMap<>(Util.identityStrategy()); ++ private final it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap toId = new it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap(2048);// Paper - use bigger expected size to reduce collisions and direct intent for FastUtil to be identity map + private final BiMap storage; + private final BiMap, T> keyStorage; + private final Map lifecycles; +@@ -48,9 +48,9 @@ public class MappedRegistry extends WritableRegistry { + public MappedRegistry(ResourceKey> key, Lifecycle lifecycle) { + super(key, lifecycle); + this.toId.defaultReturnValue(-1); +- this.storage = HashBiMap.create(); +- this.keyStorage = HashBiMap.create(); +- this.lifecycles = Maps.newIdentityHashMap(); ++ this.storage = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions ++ this.keyStorage = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions ++ this.lifecycles = new java.util.IdentityHashMap<>(2048); // Paper - use bigger expected size to reduce collisions + this.elementsLifecycle = lifecycle; + } + diff --git a/patches/server-remapped/0275-Add-PhantomPreSpawnEvent.patch b/patches/server/0253-Add-PhantomPreSpawnEvent.patch similarity index 81% rename from patches/server-remapped/0275-Add-PhantomPreSpawnEvent.patch rename to patches/server/0253-Add-PhantomPreSpawnEvent.patch index a3b507be8..e68cfb61b 100644 --- a/patches/server-remapped/0275-Add-PhantomPreSpawnEvent.patch +++ b/patches/server/0253-Add-PhantomPreSpawnEvent.patch @@ -5,34 +5,34 @@ Subject: [PATCH] Add PhantomPreSpawnEvent diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java -index 4a2fecdfbda34d6360d50e2ac017907a62b4a043..e37137a2890330b92e05d6f76c46ffc99a527803 100644 +index dcfd0b107ac7bd1633f3b681cd5f5e26ce87bd63..2ddb7b4c0a75c6f41910c84c8b9341f56fcb1116 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java -@@ -161,6 +161,11 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -172,6 +172,11 @@ public class Phantom extends FlyingMob implements Enemy { } - this.setPhantomSize(tag.getInt("Size")); + this.setPhantomSize(nbt.getInt("Size")); + // Paper start -+ if (tag.hasUUID("Paper.SpawningEntity")) { -+ this.spawningEntity = tag.getUUID("Paper.SpawningEntity"); ++ if (nbt.hasUUID("Paper.SpawningEntity")) { ++ this.spawningEntity = nbt.getUUID("Paper.SpawningEntity"); + } + // Paper end } @Override -@@ -170,6 +175,11 @@ public class Phantom extends FlyingMob implements Enemy { - tag.putInt("AY", this.anchorPoint.getY()); - tag.putInt("AZ", this.anchorPoint.getZ()); - tag.putInt("Size", this.getPhantomSize()); +@@ -181,6 +186,11 @@ public class Phantom extends FlyingMob implements Enemy { + nbt.putInt("AY", this.anchorPoint.getY()); + nbt.putInt("AZ", this.anchorPoint.getZ()); + nbt.putInt("Size", this.getPhantomSize()); + // Paper start + if (this.spawningEntity != null) { -+ tag.setUUID("Paper.SpawningEntity", this.spawningEntity); ++ nbt.setUUID("Paper.SpawningEntity", this.spawningEntity); + } + // Paper end } @Override -@@ -216,6 +226,15 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -232,6 +242,14 @@ public class Phantom extends FlyingMob implements Enemy { return entitysize.scale(f); } @@ -44,10 +44,9 @@ index 4a2fecdfbda34d6360d50e2ac017907a62b4a043..e37137a2890330b92e05d6f76c46ffc9 + } + public void setSpawningEntity(java.util.UUID entity) { this.spawningEntity = entity; } + // Paper end -+ - class PhantomAttackPlayerTargetGoal extends Goal { + private static enum AttackPhase { - private final TargetingConditions attackTargeting; + CIRCLE, SWOOP; diff --git a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java index ee18e2826f6390ef5a29557b733fd00db5bc409f..42effcbd3ca7c38a4e8b1aa835543ad243112a33 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java @@ -80,15 +79,16 @@ index ee18e2826f6390ef5a29557b733fd00db5bc409f..42effcbd3ca7c38a4e8b1aa835543ad2 groupdataentity = entityphantom.finalizeSpawn(world, difficultydamagescaler, MobSpawnType.NATURAL, groupdataentity, (CompoundTag) null); world.addAllEntities(entityphantom, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java -index 15eb09595dad996314c169f9dd7d381e43f77be9..92162fa22f5e98b7837bde5830bd47c31b8b52d8 100644 +index f77b83bee6eb739220b55793a0807f0267cfc8a9..c9dab70b0b284fe1c1daafd3c1f5bd08b14fa35d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java -@@ -34,4 +34,10 @@ public class CraftPhantom extends CraftFlying implements Phantom { +@@ -34,4 +34,11 @@ public class CraftPhantom extends CraftFlying implements Phantom { public EntityType getType() { return EntityType.PHANTOM; } + + // Paper start ++ @Override + public java.util.UUID getSpawningEntity() { + return getHandle().getSpawningEntity(); + } diff --git a/patches/server-remapped/0276-Add-More-Creeper-API.patch b/patches/server/0254-Add-More-Creeper-API.patch similarity index 82% rename from patches/server-remapped/0276-Add-More-Creeper-API.patch rename to patches/server/0254-Add-More-Creeper-API.patch index 3a4091fe8..50f647dd0 100644 --- a/patches/server-remapped/0276-Add-More-Creeper-API.patch +++ b/patches/server/0254-Add-More-Creeper-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add More Creeper API diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java -index d9b5cf8ac01289801ded01d928fa7ead96551be5..336736fae0b49a05e48c1c70a225da316bb73e66 100644 +index 3bbf6c9bfbb79fd4242cf66d7ace1d8f87404636..e8c36e8541f041a0d72a86f49ced2a3ce1549be0 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java +++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java -@@ -289,7 +289,18 @@ public class Creeper extends Monster { +@@ -309,7 +309,18 @@ public class Creeper extends Monster implements PowerableMob { } public void ignite() { @@ -29,19 +29,21 @@ index d9b5cf8ac01289801ded01d928fa7ead96551be5..336736fae0b49a05e48c1c70a225da31 public boolean canDropMobsSkull() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java -index ded0b7c1619aada95492e7ec25c0e0f3d008d0ad..9f68beb8c79ed1c429ee9f9efab8b8604258293b 100644 +index 9b0079eac44b7b4e2ff45be92244ae1b81c46241..0cb5bb2d571a4b618515bc6d80935be90cbd26a8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java -@@ -100,4 +100,14 @@ public class CraftCreeper extends CraftMonster implements Creeper { +@@ -100,4 +100,16 @@ public class CraftCreeper extends CraftMonster implements Creeper { public EntityType getType() { return EntityType.CREEPER; } + + // Paper start ++ @Override + public void setIgnited(boolean ignited) { + getHandle().setIgnited(ignited); + } + ++ @Override + public boolean isIgnited() { + return getHandle().isIgnited(); + } diff --git a/patches/server-remapped/0277-Inventory-removeItemAnySlot.patch b/patches/server/0255-Inventory-removeItemAnySlot.patch similarity index 85% rename from patches/server-remapped/0277-Inventory-removeItemAnySlot.patch rename to patches/server/0255-Inventory-removeItemAnySlot.patch index b542a82e8..0582ff7e5 100644 --- a/patches/server-remapped/0277-Inventory-removeItemAnySlot.patch +++ b/patches/server/0255-Inventory-removeItemAnySlot.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Inventory#removeItemAnySlot diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java -index 9d70ef8c3967596491a804e4d66f2ec1b13992c9..ef2d18d19a86b3701855aa1ac126462e663f8fcd 100644 +index 758bbe839b71917b594fdb8c9cd66cda0aa4745c..56bd3290fdf011590594d68128eb3fe9ca71506c 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -222,10 +222,16 @@ public class CraftInventory implements Inventory { @@ -21,8 +21,8 @@ index 9d70ef8c3967596491a804e4d66f2ec1b13992c9..ef2d18d19a86b3701855aa1ac126462e if (item == null) { return -1; } -- ItemStack[] inventory = getStorageContents(); -+ //ItemStack[] inventory = getStorageContents(); // Paper - let param deal +- ItemStack[] inventory = this.getStorageContents(); ++ // ItemStack[] inventory = this.getStorageContents(); // Paper - let param deal for (int i = 0; i < inventory.length; i++) { if (inventory[i] == null) continue; @@ -48,10 +48,10 @@ index 9d70ef8c3967596491a804e4d66f2ec1b13992c9..ef2d18d19a86b3701855aa1ac126462e int toDelete = item.getAmount(); while (true) { -- int first = first(item, false); +- int first = this.first(item, false); + // Paper start - Allow searching entire contents + ItemStack[] toSearch = searchEntire ? getContents() : getStorageContents(); -+ int first = first(item, false, toSearch); ++ int first = this.first(item, false, toSearch); + // Paper end // Drat! we don't have this type in the inventory diff --git a/patches/server-remapped/0278-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch b/patches/server/0256-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch similarity index 63% rename from patches/server-remapped/0278-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch rename to patches/server/0256-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch index 3b436ea5a..5c607fe65 100644 --- a/patches/server-remapped/0278-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch +++ b/patches/server/0256-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch @@ -6,15 +6,15 @@ Subject: [PATCH] Make CraftWorld#loadChunk(int, int, false) load unconverted diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 159c32d6678e83f2d98ea6a1ad48346c9de017e1..57a2af56b53567371fdb6d0a55866e1e4e37cf3b 100644 +index e7f5cd35869790baf616e6c65f49169aa5349e89..2a9a57263ff116c1a7f51eac127292559de48b11 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -490,7 +490,7 @@ public class CraftWorld implements World { +@@ -505,7 +505,7 @@ public class CraftWorld implements World { @Override public boolean loadChunk(int x, int z, boolean generate) { org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot -- ChunkAccess chunk = world.getChunkSource().getChunk(x, z, generate ? ChunkStatus.FULL : ChunkStatus.EMPTY, true); -+ ChunkAccess chunk = world.getChunkSource().getChunk(x, z, generate || isChunkGenerated(x, z) ? ChunkStatus.FULL : ChunkStatus.EMPTY, true); // Paper +- ChunkAccess chunk = this.world.getChunkSource().getChunk(x, z, generate ? ChunkStatus.FULL : ChunkStatus.EMPTY, true); ++ ChunkAccess chunk = this.world.getChunkSource().getChunk(x, z, generate || isChunkGenerated(x, z) ? ChunkStatus.FULL : ChunkStatus.EMPTY, true); // Paper // If generate = false, but the chunk already exists, we will get this back. if (chunk instanceof ImposterProtoChunk) {