diff --git a/build-data/paper.at b/build-data/paper.at index ced8ae8dfd..1afeccf82a 100644 --- a/build-data/paper.at +++ b/build-data/paper.at @@ -4,3 +4,15 @@ # This line would make the field public and remove the final modifier #public-f net.minecraft.network.protocol.game.ClientboundChatPacket sender # Leave out the member and it will apply to the class itself + +# Item Rarity API +public net.minecraft.world.item.Item rarity + +# More Enchantment API +public net.minecraft.world.item.enchantment.Enchantment slots; + +# Fix and optimise world force upgrading +public net.minecraft.util.worldupdate.WorldUpgrader REGEX; + +# More Lidded Block API +public net.minecraft.world.level.block.entity.EnderChestBlockEntity openersCounter \ No newline at end of file diff --git a/patches/api-unmapped/0270-Allow-adding-items-to-BlockDropItemEvent.patch b/patches/api/0270-Allow-adding-items-to-BlockDropItemEvent.patch similarity index 100% rename from patches/api-unmapped/0270-Allow-adding-items-to-BlockDropItemEvent.patch rename to patches/api/0270-Allow-adding-items-to-BlockDropItemEvent.patch diff --git a/patches/api-unmapped/0271-Add-getMainThreadExecutor-to-BukkitScheduler.patch b/patches/api/0271-Add-getMainThreadExecutor-to-BukkitScheduler.patch similarity index 100% rename from patches/api-unmapped/0271-Add-getMainThreadExecutor-to-BukkitScheduler.patch rename to patches/api/0271-Add-getMainThreadExecutor-to-BukkitScheduler.patch diff --git a/patches/api-unmapped/0272-living-entity-allow-attribute-registration.patch b/patches/api/0272-living-entity-allow-attribute-registration.patch similarity index 100% rename from patches/api-unmapped/0272-living-entity-allow-attribute-registration.patch rename to patches/api/0272-living-entity-allow-attribute-registration.patch diff --git a/patches/api-unmapped/0273-Add-missing-effects.patch b/patches/api/0273-Add-missing-effects.patch similarity index 100% rename from patches/api-unmapped/0273-Add-missing-effects.patch rename to patches/api/0273-Add-missing-effects.patch diff --git a/patches/api-unmapped/0274-Expose-Tracked-Players.patch b/patches/api/0274-Expose-Tracked-Players.patch similarity index 86% rename from patches/api-unmapped/0274-Expose-Tracked-Players.patch rename to patches/api/0274-Expose-Tracked-Players.patch index 1c4214897c..625e7bd3b7 100644 --- a/patches/api-unmapped/0274-Expose-Tracked-Players.patch +++ b/patches/api/0274-Expose-Tracked-Players.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expose Tracked Players diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 68a03821a5f06308a9c51fdf107d3924c44886c8..34b51466ffb281b05f531b3f7deda245ae7fd96a 100644 +index 9c7960f56733ff18b949cffe15f082c4cde28317..38003de85a8098fc78fc947dd975990d478ee908 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -1,6 +1,7 @@ @@ -16,7 +16,7 @@ index 68a03821a5f06308a9c51fdf107d3924c44886c8..34b51466ffb281b05f531b3f7deda245 import java.util.UUID; import com.destroystokyo.paper.ClientOption; // Paper import com.destroystokyo.paper.Title; // Paper -@@ -1942,6 +1943,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1969,6 +1970,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM void sendOpLevel(byte level); // Paper end diff --git a/patches/api-unmapped/0275-Cache-the-result-of-Material-isBlock.patch b/patches/api/0275-Cache-the-result-of-Material-isBlock.patch similarity index 79% rename from patches/api-unmapped/0275-Cache-the-result-of-Material-isBlock.patch rename to patches/api/0275-Cache-the-result-of-Material-isBlock.patch index 7eca03bdf5..164998f1ec 100644 --- a/patches/api-unmapped/0275-Cache-the-result-of-Material-isBlock.patch +++ b/patches/api/0275-Cache-the-result-of-Material-isBlock.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Cache the result of Material#isBlock diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index 69c85c3a1f45476f7de0a9399852d82eeb4f9c86..0f081835c0484e15fca4fadaa27e90cadd394276 100644 +index 1efc97d88c38863bcd6cd4c11c8b88a18ee06b25..5ff032f73d88dd91163ff3e6c89dcd0d1507228c 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -3935,6 +3935,7 @@ public enum Material implements Keyed { +@@ -3936,6 +3936,7 @@ public enum Material implements Keyed { public final Class data; private final boolean legacy; private final NamespacedKey key; @@ -16,7 +16,7 @@ index 69c85c3a1f45476f7de0a9399852d82eeb4f9c86..0f081835c0484e15fca4fadaa27e90ca private Material(final int id) { this(id, 64); -@@ -4132,6 +4133,11 @@ public enum Material implements Keyed { +@@ -4133,6 +4134,11 @@ public enum Material implements Keyed { * @return true if this material is a block */ public boolean isBlock() { @@ -28,7 +28,7 @@ index 69c85c3a1f45476f7de0a9399852d82eeb4f9c86..0f081835c0484e15fca4fadaa27e90ca switch (this) { // case ACACIA_BUTTON: -@@ -5213,6 +5219,7 @@ public enum Material implements Keyed { +@@ -5214,6 +5220,7 @@ public enum Material implements Keyed { static { for (Material material : values()) { BY_NAME.put(material.name(), material); diff --git a/patches/api-unmapped/0276-Add-worldborder-events.patch b/patches/api/0276-Add-worldborder-events.patch similarity index 100% rename from patches/api-unmapped/0276-Add-worldborder-events.patch rename to patches/api/0276-Add-worldborder-events.patch diff --git a/patches/api-unmapped/0277-added-PlayerNameEntityEvent.patch b/patches/api/0277-added-PlayerNameEntityEvent.patch similarity index 100% rename from patches/api-unmapped/0277-added-PlayerNameEntityEvent.patch rename to patches/api/0277-added-PlayerNameEntityEvent.patch diff --git a/patches/api-unmapped/0278-Add-recipe-to-cook-events.patch b/patches/api/0278-Add-recipe-to-cook-events.patch similarity index 100% rename from patches/api-unmapped/0278-Add-recipe-to-cook-events.patch rename to patches/api/0278-Add-recipe-to-cook-events.patch diff --git a/patches/api-unmapped/0279-Add-Block-isValidTool.patch b/patches/api/0279-Add-Block-isValidTool.patch similarity index 83% rename from patches/api-unmapped/0279-Add-Block-isValidTool.patch rename to patches/api/0279-Add-Block-isValidTool.patch index f037cf8c32..257cf003a8 100644 --- a/patches/api-unmapped/0279-Add-Block-isValidTool.patch +++ b/patches/api/0279-Add-Block-isValidTool.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add Block#isValidTool diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 181658c679d306ffc4ad45259494571ee224ef47..08e6f1741685f54506c8a4ff29bbd30f62cf8e45 100644 +index b3c127a3d4c554c08e500497a54755e626342dd3..ca488173a20bcf3427906f0a6548f06a97c9dc36 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java -@@ -218,6 +218,15 @@ public interface Block extends Metadatable { +@@ -219,6 +219,15 @@ public interface Block extends Metadatable { public static int getBlockKeyZ(long packed) { return (int) ((packed << 10) >> 37); } diff --git a/patches/api-unmapped/0280-Implement-Keyed-on-World.patch b/patches/api/0280-Implement-Keyed-on-World.patch similarity index 93% rename from patches/api-unmapped/0280-Implement-Keyed-on-World.patch rename to patches/api/0280-Implement-Keyed-on-World.patch index 75f66d5848..b8287b7ba8 100644 --- a/patches/api-unmapped/0280-Implement-Keyed-on-World.patch +++ b/patches/api/0280-Implement-Keyed-on-World.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement Keyed on World diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 68101a322ffab8ec28843386b79b8079576fa720..5f7208196684d9c8373df28b7cfb5f9e21baa41e 100644 +index bad4593447ca390b3e2f3bc71b4ea9f4dd673445..142050887ac02e36ae20e73a43ec698b6bab1947 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -639,6 +639,18 @@ public final class Bukkit { @@ -28,7 +28,7 @@ index 68101a322ffab8ec28843386b79b8079576fa720..5f7208196684d9c8373df28b7cfb5f9e /** * Gets the map from the given item ID. diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index a79fa08b9e6fb924b2da933eb6e4b365d14d938d..f3e27d2d02a9407bb1b091b8c1125ad5abf99e55 100644 +index 48c6434a6a5b1659d4cc8ddf8fe23806628c3b7e..0b3de184f7267543d693c45379bf5989303cf56a 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -541,6 +541,17 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -50,7 +50,7 @@ index a79fa08b9e6fb924b2da933eb6e4b365d14d938d..f3e27d2d02a9407bb1b091b8c1125ad5 * Gets the map from the given item ID. * diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index ced33fc6de6bfa2767123131d532e7ae9ef3a5be..98512bddbb0c8bd6a3f487c60b1ec77b274b991e 100644 +index 27d97cde0fb5f6d727656c291e34dc468200f0c0..178a0853bd8136c6a7408f5d49604ceb2479f138 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -43,7 +43,7 @@ import org.jetbrains.annotations.Nullable; @@ -62,7 +62,7 @@ index ced33fc6de6bfa2767123131d532e7ae9ef3a5be..98512bddbb0c8bd6a3f487c60b1ec77b // Paper start /** -@@ -829,6 +829,15 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad +@@ -1534,6 +1534,15 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad @NotNull java.util.concurrent.CompletableFuture getChunkAtAsync(int x, int z, boolean gen, boolean urgent); diff --git a/patches/api-unmapped/0281-fix-Inventory-getContents-null-annotations.patch b/patches/api/0281-fix-Inventory-getContents-null-annotations.patch similarity index 100% rename from patches/api-unmapped/0281-fix-Inventory-getContents-null-annotations.patch rename to patches/api/0281-fix-Inventory-getContents-null-annotations.patch diff --git a/patches/api-unmapped/0282-Item-Rarity-API.patch b/patches/api/0282-Item-Rarity-API.patch similarity index 96% rename from patches/api-unmapped/0282-Item-Rarity-API.patch rename to patches/api/0282-Item-Rarity-API.patch index 8f0f4fc977..4a41972380 100644 --- a/patches/api-unmapped/0282-Item-Rarity-API.patch +++ b/patches/api/0282-Item-Rarity-API.patch @@ -39,10 +39,10 @@ index 0000000000000000000000000000000000000000..74ef8395cc040ce488c2acaa416db202 + } +} diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index 0f081835c0484e15fca4fadaa27e90cadd394276..07b8b913434bb575df8670230d693b2d4cec2571 100644 +index 5ff032f73d88dd91163ff3e6c89dcd0d1507228c..a9bcb123526da0881728070d36aea37612db8cf2 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -4002,6 +4002,17 @@ public enum Material implements Keyed { +@@ -4003,6 +4003,17 @@ public enum Material implements Keyed { public String getTranslationKey() { return Bukkit.getUnsafe().getTranslationKey(this); } diff --git a/patches/api-unmapped/0283-Expose-protocol-version.patch b/patches/api/0283-Expose-protocol-version.patch similarity index 100% rename from patches/api-unmapped/0283-Expose-protocol-version.patch rename to patches/api/0283-Expose-protocol-version.patch diff --git a/patches/api-unmapped/0294-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch b/patches/api/0284-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch similarity index 100% rename from patches/api-unmapped/0294-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch rename to patches/api/0284-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch diff --git a/patches/api-unmapped/0284-add-isDeeplySleeping-to-HumanEntity.patch b/patches/api/0285-add-isDeeplySleeping-to-HumanEntity.patch similarity index 90% rename from patches/api-unmapped/0284-add-isDeeplySleeping-to-HumanEntity.patch rename to patches/api/0285-add-isDeeplySleeping-to-HumanEntity.patch index b0f198f0e1..cc4e80e8a0 100644 --- a/patches/api-unmapped/0284-add-isDeeplySleeping-to-HumanEntity.patch +++ b/patches/api/0285-add-isDeeplySleeping-to-HumanEntity.patch @@ -5,7 +5,7 @@ Subject: [PATCH] add isDeeplySleeping to HumanEntity diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index f0e0710fef5a3e0b722ece7ccf89c3d0f88f8f0f..2ce774c81a93260a1464183d435b4c418ed61648 100644 +index 112c891e54e8f30ac10e6865efc2a8ee8d172188..0ad7a3d4d40d58eb950e34668f9554bb73f934fb 100644 --- a/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java @@ -319,6 +319,15 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder diff --git a/patches/api-unmapped/0285-add-consumeFuel-to-FurnaceBurnEvent.patch b/patches/api/0286-add-consumeFuel-to-FurnaceBurnEvent.patch similarity index 100% rename from patches/api-unmapped/0285-add-consumeFuel-to-FurnaceBurnEvent.patch rename to patches/api/0286-add-consumeFuel-to-FurnaceBurnEvent.patch diff --git a/patches/api-unmapped/0286-add-get-set-drop-chance-to-EntityEquipment.patch b/patches/api/0287-add-get-set-drop-chance-to-EntityEquipment.patch similarity index 100% rename from patches/api-unmapped/0286-add-get-set-drop-chance-to-EntityEquipment.patch rename to patches/api/0287-add-get-set-drop-chance-to-EntityEquipment.patch diff --git a/patches/api-unmapped/0287-Added-PlayerDeepSleepEvent.patch b/patches/api/0288-Added-PlayerDeepSleepEvent.patch similarity index 100% rename from patches/api-unmapped/0287-Added-PlayerDeepSleepEvent.patch rename to patches/api/0288-Added-PlayerDeepSleepEvent.patch diff --git a/patches/api-unmapped/0288-More-World-API.patch b/patches/api/0289-More-World-API.patch similarity index 97% rename from patches/api-unmapped/0288-More-World-API.patch rename to patches/api/0289-More-World-API.patch index 1a3c73561c..0852f78c91 100644 --- a/patches/api-unmapped/0288-More-World-API.patch +++ b/patches/api/0289-More-World-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] More World API diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 98512bddbb0c8bd6a3f487c60b1ec77b274b991e..a1496fe00a2d5ba6c1af054d4327f868b2cd7344 100644 +index 178a0853bd8136c6a7408f5d49604ceb2479f138..244bb359492ae486f0610f5aea6b75997dbc4bdc 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -3482,6 +3482,120 @@ public interface World extends PluginMessageRecipient, Metadatable, net.kyori.ad diff --git a/patches/api-unmapped/0289-Added-PlayerBedFailEnterEvent.patch b/patches/api/0290-Added-PlayerBedFailEnterEvent.patch similarity index 100% rename from patches/api-unmapped/0289-Added-PlayerBedFailEnterEvent.patch rename to patches/api/0290-Added-PlayerBedFailEnterEvent.patch diff --git a/patches/api-unmapped/0290-Introduce-beacon-activation-deactivation-events.patch b/patches/api/0291-Introduce-beacon-activation-deactivation-events.patch similarity index 100% rename from patches/api-unmapped/0290-Introduce-beacon-activation-deactivation-events.patch rename to patches/api/0291-Introduce-beacon-activation-deactivation-events.patch diff --git a/patches/api-unmapped/0291-PlayerMoveEvent-Improvements.patch b/patches/api/0292-PlayerMoveEvent-Improvements.patch similarity index 100% rename from patches/api-unmapped/0291-PlayerMoveEvent-Improvements.patch rename to patches/api/0292-PlayerMoveEvent-Improvements.patch diff --git a/patches/api-unmapped/0292-add-RespawnFlags-to-PlayerRespawnEvent.patch b/patches/api/0293-add-RespawnFlags-to-PlayerRespawnEvent.patch similarity index 100% rename from patches/api-unmapped/0292-add-RespawnFlags-to-PlayerRespawnEvent.patch rename to patches/api/0293-add-RespawnFlags-to-PlayerRespawnEvent.patch diff --git a/patches/api-unmapped/0293-Add-more-WanderingTrader-API.patch b/patches/api/0294-Add-more-WanderingTrader-API.patch similarity index 100% rename from patches/api-unmapped/0293-Add-more-WanderingTrader-API.patch rename to patches/api/0294-Add-more-WanderingTrader-API.patch diff --git a/patches/api-unmapped/0295-Add-EntityBlockStorage-clearEntities.patch b/patches/api/0295-Add-EntityBlockStorage-clearEntities.patch similarity index 100% rename from patches/api-unmapped/0295-Add-EntityBlockStorage-clearEntities.patch rename to patches/api/0295-Add-EntityBlockStorage-clearEntities.patch diff --git a/patches/api-unmapped/0296-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch b/patches/api/0296-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch similarity index 100% rename from patches/api-unmapped/0296-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch rename to patches/api/0296-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch diff --git a/patches/api-unmapped/0297-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch b/patches/api/0297-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch similarity index 100% rename from patches/api-unmapped/0297-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch rename to patches/api/0297-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch diff --git a/patches/api-unmapped/0298-Inventory-close.patch b/patches/api/0298-Inventory-close.patch similarity index 100% rename from patches/api-unmapped/0298-Inventory-close.patch rename to patches/api/0298-Inventory-close.patch diff --git a/patches/api-unmapped/0299-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch b/patches/api/0299-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch similarity index 89% rename from patches/api-unmapped/0299-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch rename to patches/api/0299-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch index 9b01b30676..1f4bc96b56 100644 --- a/patches/api-unmapped/0299-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch +++ b/patches/api/0299-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch @@ -30,10 +30,10 @@ index ed4d417c2deefb78807cb61b01df5afcd334d754..a40b045f08b85e22e75459b547e7e7c0 // Paper end } diff --git a/src/main/java/org/bukkit/entity/Skeleton.java b/src/main/java/org/bukkit/entity/Skeleton.java -index 1c367f78eadf24850061a84ce63b950b79d3c435..684477b894e52ff33f9fce2edf76e58c292dd75e 100644 +index b7e424ea8a282f45fb8b91c919e4e4526c00be8b..2ca7c040270fa1b0fe623a0a779879783201a2f1 100644 --- a/src/main/java/org/bukkit/entity/Skeleton.java +++ b/src/main/java/org/bukkit/entity/Skeleton.java -@@ -46,4 +46,19 @@ public interface Skeleton extends Monster, RangedEntity { // Paper +@@ -64,4 +64,19 @@ public interface Skeleton extends AbstractSkeleton, com.destroystokyo.paper.enti */ STRAY; } diff --git a/patches/api-unmapped/0300-Add-basic-Datapack-API.patch b/patches/api/0300-Add-basic-Datapack-API.patch similarity index 93% rename from patches/api-unmapped/0300-Add-basic-Datapack-API.patch rename to patches/api/0300-Add-basic-Datapack-API.patch index ae9149d2f3..9b119b0963 100644 --- a/patches/api-unmapped/0300-Add-basic-Datapack-API.patch +++ b/patches/api/0300-Add-basic-Datapack-API.patch @@ -70,7 +70,7 @@ index 0000000000000000000000000000000000000000..58f78d5e91beacaf710f62461cf869f7 + +} diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 050ee6a6fd0b74d9bfdd9dfe88cd4cd3d17da868..a8b6cc350e85d4f1a31f30dee42feafd0edb6009 100644 +index 142050887ac02e36ae20e73a43ec698b6bab1947..e8414592b3afeb1e5db2b817b8fb7c13e073b9aa 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -1949,6 +1949,14 @@ public final class Bukkit { @@ -89,7 +89,7 @@ index 050ee6a6fd0b74d9bfdd9dfe88cd4cd3d17da868..a8b6cc350e85d4f1a31f30dee42feafd @NotNull diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index eb7f604600839618eaf27e0e5444b4830716eb07..2b400079559abd6b847782ae8480f2ae1948e22a 100644 +index 0b3de184f7267543d693c45379bf5989303cf56a..e88b47a838dc472ad64271a518ee1789f7be19fa 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -1709,5 +1709,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi diff --git a/patches/api-unmapped/0301-additions-to-PlayerGameModeChangeEvent.patch b/patches/api/0301-additions-to-PlayerGameModeChangeEvent.patch similarity index 100% rename from patches/api-unmapped/0301-additions-to-PlayerGameModeChangeEvent.patch rename to patches/api/0301-additions-to-PlayerGameModeChangeEvent.patch diff --git a/patches/api-unmapped/0302-ItemStack-repair-check-API.patch b/patches/api/0302-ItemStack-repair-check-API.patch similarity index 96% rename from patches/api-unmapped/0302-ItemStack-repair-check-API.patch rename to patches/api/0302-ItemStack-repair-check-API.patch index 2281b38541..d90207b8e3 100644 --- a/patches/api-unmapped/0302-ItemStack-repair-check-API.patch +++ b/patches/api/0302-ItemStack-repair-check-API.patch @@ -26,7 +26,7 @@ index 6dbd520182b1e7713a68baad09b7f613424ef619..e504567cf755557be8511f2c93c17157 * Returns the server's protocol version. * diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index fccfae41f53a175e1a6a670c793e464456de6b60..0f8c593ae9bca46081f0b22c2d763a2699175398 100644 +index f72d3d62d61755bbaf1950ebcb228ce95d1faf58..1bd9f7582bb907ff178fd110fdc92834885d1d78 100644 --- a/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java @@ -873,5 +873,27 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor diff --git a/patches/api-unmapped/0303-More-Enchantment-API.patch b/patches/api/0303-More-Enchantment-API.patch similarity index 100% rename from patches/api-unmapped/0303-More-Enchantment-API.patch rename to patches/api/0303-More-Enchantment-API.patch diff --git a/patches/api-unmapped/0304-Add-command-line-option-to-load-extra-plugin-jars-no.patch b/patches/api/0304-Add-command-line-option-to-load-extra-plugin-jars-no.patch similarity index 99% rename from patches/api-unmapped/0304-Add-command-line-option-to-load-extra-plugin-jars-no.patch rename to patches/api/0304-Add-command-line-option-to-load-extra-plugin-jars-no.patch index c4cd74cdbe..79e5efee21 100644 --- a/patches/api-unmapped/0304-Add-command-line-option-to-load-extra-plugin-jars-no.patch +++ b/patches/api/0304-Add-command-line-option-to-load-extra-plugin-jars-no.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Add command line option to load extra plugin jars not in the ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index 26685f59b235ea5b4c4fb7ae21acb5149edaa2b3..ca866876f2f35a1c41eb009064412423fa09e441 100644 +index 49e5d49eb09bb966e47d6a03ac08a527c963b43d..f988705a3cd3943b2f6f952b4f8b5ec014722978 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java @@ -60,6 +60,7 @@ public final class SimplePluginManager implements PluginManager { diff --git a/patches/api-unmapped/0305-List-all-missing-hard-depends-not-just-first.patch b/patches/api/0305-List-all-missing-hard-depends-not-just-first.patch similarity index 98% rename from patches/api-unmapped/0305-List-all-missing-hard-depends-not-just-first.patch rename to patches/api/0305-List-all-missing-hard-depends-not-just-first.patch index bbbab43d60..4d1ba6ef20 100644 --- a/patches/api-unmapped/0305-List-all-missing-hard-depends-not-just-first.patch +++ b/patches/api/0305-List-all-missing-hard-depends-not-just-first.patch @@ -5,7 +5,7 @@ Subject: [PATCH] List all missing hard depends not just first diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index ca866876f2f35a1c41eb009064412423fa09e441..d1c35e4cf778070f8d18bbe0af8d423334c6dfbf 100644 +index f988705a3cd3943b2f6f952b4f8b5ec014722978..0e25119564dfa9cb12f3c5dc5f653d7f2c147a9d 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java @@ -264,6 +264,7 @@ public final class SimplePluginManager implements PluginManager { diff --git a/patches/api-unmapped/0306-Add-Mob-lookAt-API.patch b/patches/api/0306-Add-Mob-lookAt-API.patch similarity index 100% rename from patches/api-unmapped/0306-Add-Mob-lookAt-API.patch rename to patches/api/0306-Add-Mob-lookAt-API.patch diff --git a/patches/api-unmapped/0307-ItemStack-editMeta.patch b/patches/api/0307-ItemStack-editMeta.patch similarity index 100% rename from patches/api-unmapped/0307-ItemStack-editMeta.patch rename to patches/api/0307-ItemStack-editMeta.patch diff --git a/patches/api-unmapped/0308-Add-EntityInsideBlockEvent.patch b/patches/api/0308-Add-EntityInsideBlockEvent.patch similarity index 100% rename from patches/api-unmapped/0308-Add-EntityInsideBlockEvent.patch rename to patches/api/0308-Add-EntityInsideBlockEvent.patch diff --git a/patches/api-unmapped/0309-Attributes-API-for-item-defaults.patch b/patches/api/0309-Attributes-API-for-item-defaults.patch similarity index 93% rename from patches/api-unmapped/0309-Attributes-API-for-item-defaults.patch rename to patches/api/0309-Attributes-API-for-item-defaults.patch index fa1b8ce93a..f3107ae522 100644 --- a/patches/api-unmapped/0309-Attributes-API-for-item-defaults.patch +++ b/patches/api/0309-Attributes-API-for-item-defaults.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Attributes API for item defaults diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index 07b8b913434bb575df8670230d693b2d4cec2571..397591da25fbb0e4d3012431df70d661d9bc9188 100644 +index a9bcb123526da0881728070d36aea37612db8cf2..d635c4fb85d3eeea3853037b2da5881c4853b193 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -4013,6 +4013,19 @@ public enum Material implements Keyed { +@@ -4014,6 +4014,19 @@ public enum Material implements Keyed { public io.papermc.paper.inventory.ItemRarity getItemRarity() { return Bukkit.getUnsafe().getItemRarity(this); } diff --git a/patches/api-unmapped/0310-Add-cause-to-Weather-ThunderChangeEvents.patch b/patches/api/0310-Add-cause-to-Weather-ThunderChangeEvents.patch similarity index 100% rename from patches/api-unmapped/0310-Add-cause-to-Weather-ThunderChangeEvents.patch rename to patches/api/0310-Add-cause-to-Weather-ThunderChangeEvents.patch diff --git a/patches/api-unmapped/0311-More-Lidded-Block-API.patch b/patches/api/0311-More-Lidded-Block-API.patch similarity index 100% rename from patches/api-unmapped/0311-More-Lidded-Block-API.patch rename to patches/api/0311-More-Lidded-Block-API.patch diff --git a/patches/api-unmapped/0313-Add-PufferFishStateChangeEvent.patch b/patches/api/0312-Add-PufferFishStateChangeEvent.patch similarity index 100% rename from patches/api-unmapped/0313-Add-PufferFishStateChangeEvent.patch rename to patches/api/0312-Add-PufferFishStateChangeEvent.patch diff --git a/patches/server-remapped/0676-Clear-SyncLoadInfo.patch b/patches/removed/1.17/0676-Clear-SyncLoadInfo.patch similarity index 98% rename from patches/server-remapped/0676-Clear-SyncLoadInfo.patch rename to patches/removed/1.17/0676-Clear-SyncLoadInfo.patch index 08d7212876..14947b5139 100644 --- a/patches/server-remapped/0676-Clear-SyncLoadInfo.patch +++ b/patches/removed/1.17/0676-Clear-SyncLoadInfo.patch @@ -5,6 +5,8 @@ Subject: [PATCH] Clear SyncLoadInfo This patch merely adds the extra argument "clear" after /paper syncloadinfo to clear currently stored syncload info. +Relies on other not-applied patches + diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java index 6fad9329213e4e8a3ef9ce7fb568ad22484a11f3..a6b2b69a5a79fb8cea81e55018ee7f57c8820e56 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java diff --git a/patches/server-remapped/0698-Make-sure-to-remove-correct-TE-during-TE-tick.patch b/patches/removed/1.17/0698-Make-sure-to-remove-correct-TE-during-TE-tick.patch similarity index 98% rename from patches/server-remapped/0698-Make-sure-to-remove-correct-TE-during-TE-tick.patch rename to patches/removed/1.17/0698-Make-sure-to-remove-correct-TE-during-TE-tick.patch index 7fbf9ba181..1998d6b9d6 100644 --- a/patches/server-remapped/0698-Make-sure-to-remove-correct-TE-during-TE-tick.patch +++ b/patches/removed/1.17/0698-Make-sure-to-remove-correct-TE-during-TE-tick.patch @@ -5,6 +5,8 @@ Subject: [PATCH] Make sure to remove correct TE during TE tick This looks like it can cause premature TE removal. +1.17: doesnt apply anymore? + diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java index b89cefc8890774dbc64fd6bddeb038d2ee36d485..4523bc1f49e7be248a47eeb599fa7b6550dbb08d 100644 --- a/src/main/java/net/minecraft/world/level/Level.java diff --git a/patches/server-remapped/0738-Fix-incorrect-status-dataconverter-for-pre-1.13-chun.patch b/patches/removed/1.17/0738-Fix-incorrect-status-dataconverter-for-pre-1.13-chun.patch similarity index 99% rename from patches/server-remapped/0738-Fix-incorrect-status-dataconverter-for-pre-1.13-chun.patch rename to patches/removed/1.17/0738-Fix-incorrect-status-dataconverter-for-pre-1.13-chun.patch index 7f7be61f7b..51967306ba 100644 --- a/patches/server-remapped/0738-Fix-incorrect-status-dataconverter-for-pre-1.13-chun.patch +++ b/patches/removed/1.17/0738-Fix-incorrect-status-dataconverter-for-pre-1.13-chun.patch @@ -34,6 +34,8 @@ This should fix some problems converting old data, as the changes here are going to prevent the chunk from being regenerated incorrectly. +SPOTTEDLEAF!!!!!!!!!!! + diff --git a/src/main/java/net/minecraft/util/datafix/fixes/ChunkToProtochunkFix.java b/src/main/java/net/minecraft/util/datafix/fixes/ChunkToProtochunkFix.java index 16f6aa39385e2d278d4883a32c11ddd119d0d85d..3d262dcf6db0e395d2fa457f7197f24013037ac1 100644 --- a/src/main/java/net/minecraft/util/datafix/fixes/ChunkToProtochunkFix.java diff --git a/patches/server-remapped/0739-Fix-MC-148809-Increase-structure-block-data-length-t.patch b/patches/removed/1.17/0739-Fix-MC-148809-Increase-structure-block-data-length-t.patch similarity index 98% rename from patches/server-remapped/0739-Fix-MC-148809-Increase-structure-block-data-length-t.patch rename to patches/removed/1.17/0739-Fix-MC-148809-Increase-structure-block-data-length-t.patch index 885e2d6ca3..ba83517560 100644 --- a/patches/server-remapped/0739-Fix-MC-148809-Increase-structure-block-data-length-t.patch +++ b/patches/removed/1.17/0739-Fix-MC-148809-Increase-structure-block-data-length-t.patch @@ -3,6 +3,7 @@ From: SamB440 Date: Fri, 21 May 2021 00:22:09 +0100 Subject: [PATCH] Fix MC-148809: Increase structure block data length to 128 +Fixed in 1.17 diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundSetStructureBlockPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundSetStructureBlockPacket.java index 4c797dd82bb1989861e350a7e628eb847b58bbd8..4792aafd8d992cd64d05f8bbef5cbf30988949ed 100644 diff --git a/patches/server-remapped/0679-do-not-create-unnecessary-copies-of-passenger-list.patch b/patches/removed/1.17/No longer needed/0679-do-not-create-unnecessary-copies-of-passenger-list.patch similarity index 99% rename from patches/server-remapped/0679-do-not-create-unnecessary-copies-of-passenger-list.patch rename to patches/removed/1.17/No longer needed/0679-do-not-create-unnecessary-copies-of-passenger-list.patch index e8d0daacfc..cb84c8997d 100644 --- a/patches/server-remapped/0679-do-not-create-unnecessary-copies-of-passenger-list.patch +++ b/patches/removed/1.17/No longer needed/0679-do-not-create-unnecessary-copies-of-passenger-list.patch @@ -3,6 +3,7 @@ From: lukas81298 Date: Sun, 13 Dec 2020 13:42:55 +0100 Subject: [PATCH] do not create unnecessary copies of passenger list +1.17: Mojang removed the copy of the passenger list from getPassengers, no longer needed diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPassengersPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPassengersPacket.java index a6ecb82d14ccab5d8229689a2a6cb67c579b1f71..cded79352dff0978e0d633eae9d9020b4dec1d4b 100644 diff --git a/patches/server-remapped/0706-don-t-throw-when-loading-invalid-TEs.patch b/patches/removed/1.17/No longer needed/0706-don-t-throw-when-loading-invalid-TEs.patch similarity index 97% rename from patches/server-remapped/0706-don-t-throw-when-loading-invalid-TEs.patch rename to patches/removed/1.17/No longer needed/0706-don-t-throw-when-loading-invalid-TEs.patch index 487cbc3ff9..da8d3dfaa5 100644 --- a/patches/server-remapped/0706-don-t-throw-when-loading-invalid-TEs.patch +++ b/patches/removed/1.17/No longer needed/0706-don-t-throw-when-loading-invalid-TEs.patch @@ -3,6 +3,7 @@ From: Shane Freeder Date: Tue, 20 Apr 2021 01:15:04 +0100 Subject: [PATCH] don't throw when loading invalid TEs +1.17: Mojang catches the exception diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java index 05fa76c02ce61e26891ad995fe89e925ea086557..b7ebb213efd759253f0042f77e11f2a8102ea6ca 100644 diff --git a/patches/server-remapped/0677-Expose-Tracked-Players.patch b/patches/server-remapped/0677-Expose-Tracked-Players.patch deleted file mode 100644 index 7997af8fee..0000000000 --- a/patches/server-remapped/0677-Expose-Tracked-Players.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Tom -Date: Fri, 26 Feb 2021 16:24:25 -0600 -Subject: [PATCH] Expose Tracked Players - - -diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 87c719caf796f54296ff7e412548062e02af270e..ec30f886585d407fbd122e05107ebca44895c585 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -170,7 +170,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s - public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper - private CraftEntity bukkitEntity; - -- ChunkMap.TrackedEntity tracker; // Paper -+ public ChunkMap.TrackedEntity tracker; // Paper package private -> public - public boolean collisionLoadChunks = false; // Paper - public Throwable addedToWorldStack; // Paper - entity debug - public CraftEntity getBukkitEntity() { -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index d2d179cdef8129653983b01d94928ba83f64f644..ec8c7499662c0a810f1337ebc0fa24d2f3ca79e7 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -16,6 +16,7 @@ import java.net.InetSocketAddress; - import java.net.SocketAddress; - import java.util.ArrayList; - import java.util.Collection; -+import java.util.Collections; // Paper - import java.util.HashMap; - import java.util.HashSet; - import java.util.LinkedHashMap; -@@ -2305,6 +2306,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - } - // Paper end - -+ // Paper start -+ @Override -+ public Set getTrackedPlayers() { -+ if (entity.tracker == null) { -+ return Collections.emptySet(); -+ } -+ -+ Set set = new HashSet<>(entity.tracker.seenBy.size()); -+ for (ServerPlayer entityPlayer : entity.tracker.seenBy) { -+ set.add(entityPlayer.getBukkitEntity().getPlayer()); -+ } -+ return set; -+ } -+ // Paper end -+ - // Spigot start - private final Player.Spigot spigot = new Player.Spigot() - { diff --git a/patches/server-remapped/0678-Remove-streams-from-SensorNearest.patch b/patches/server-remapped/0678-Remove-streams-from-SensorNearest.patch deleted file mode 100644 index f305e85937..0000000000 --- a/patches/server-remapped/0678-Remove-streams-from-SensorNearest.patch +++ /dev/null @@ -1,120 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Bjarne Koll -Date: Wed, 3 Mar 2021 12:48:48 +0100 -Subject: [PATCH] Remove streams from SensorNearest - -The behavioural nearby sensors are validated every tick on the entities -that registered the respective sensors and are therefore a good subject -to performance improvements. - -More specifically this commit replaces the Stream#filter usage with -ArrayList#removeIf as the removeIf method on an array list is heavily -optimized towards a single internal array re-allocation without any -further overhead on the removeIf call. - -The only negative of this change is the rather agressive diff these -patches introduce as the methods are basically being reimplemented -compared to the previous stream-based implementation. - -See: https://nipafx.dev/java-stream-performance/ - -diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java -index 91295b8501b1e9d60bf9a7e954ea7fbce9cdea7f..0cd5a19beeb6103dec454b9071cc2e40adf2d006 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java -+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java -@@ -27,18 +27,16 @@ public class NearestItemSensor extends Sensor { - List list = world.getEntitiesOfClass(ItemEntity.class, entity.getBoundingBox().inflate(8.0D, 4.0D, 8.0D), (entityitem) -> { - return true; - }); -- -- entity.getClass(); -+ // Paper start - remove streams in favour of lists - list.sort(Comparator.comparingDouble(entity::distanceToSqr)); -- Stream stream = list.stream().filter((entityitem) -> { -- return entity.wantsToPickUp(entityitem.getItem()); -- }).filter((entityitem) -> { -- return entityitem.closerThan((Entity) entity, 9.0D); -- }); -- -- entity.getClass(); -- Optional optional = stream.filter(entity::hasLineOfSight).findFirst(); -- -- behaviorcontroller.setMemory(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, optional); -+ ItemEntity nearest = null; -+ for (ItemEntity entityItem : list) { -+ if (entity.wantsToPickUp(entityItem.getItem()) && entityItem.closerThan(entity, 9.0D) && entity.canSee(entityItem)) { -+ nearest = entityItem; -+ break; -+ } -+ } -+ behaviorcontroller.setMemory(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, Optional.ofNullable(nearest)); -+ // Paper end - } - } -diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java -index bf38e8b465ae0f50e34b94e0d7830dfdc1be1d59..fa827377ef0ef7cb280d1d54e156e45579899e6c 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java -+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java -@@ -26,10 +26,12 @@ public class NearestLivingEntitySensor extends Sensor { - list.sort(Comparator.comparingDouble(entity::distanceToSqr)); - Brain behaviorcontroller = entity.getBrain(); - -- behaviorcontroller.setMemory(MemoryModuleType.MOBS, (Object) list); -- behaviorcontroller.setMemory(MemoryModuleType.VISIBLE_MOBS, list.stream().filter((entityliving1) -> { -- return doTick(entity, entityliving1); -- }).collect(Collectors.toList())); -+ behaviorcontroller.setMemory(MemoryModuleType.MOBS, list); // Paper - decompile error -+ // Paper start - remove streams in favour of lists -+ List visibleMobs = new java.util.ArrayList<>(list); -+ visibleMobs.removeIf(otherEntityLiving -> !Sensor.a(entity, otherEntityLiving)); -+ behaviorcontroller.setMemory(MemoryModuleType.VISIBLE_MOBS, visibleMobs); -+ // Paper end - } - - @Override -diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java -index 41a9db2cc4af26baa7072b3c4cebc5357ff43301..fe7414293f144656a938de42524841592c9f40d4 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java -+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java -@@ -26,22 +26,26 @@ public class PlayerSensor extends Sensor { - - @Override - protected void doTick(ServerLevel world, LivingEntity entity) { -- Stream stream = world.players().stream().filter(EntitySelector.NO_SPECTATORS).filter((entityplayer) -> { -- return entity.closerThan((Entity) entityplayer, 16.0D); -- }); -+ // Paper start - remove streams in favour of lists -+ List players = new java.util.ArrayList<>(world.players()); -+ players.removeIf(player -> !EntitySelector.notSpectator().test(player) || !entity.closerThan(player, 16.0D)); // Paper - removeIf only re-allocates once compared to iterator -+ players.sort(Comparator.comparingDouble(entity::distanceToSqr)); - -- entity.getClass(); -- List list = (List) stream.sorted(Comparator.comparingDouble(entity::h)).collect(Collectors.toList()); - Brain behaviorcontroller = entity.getBrain(); -- -- behaviorcontroller.setMemory(MemoryModuleType.NEAREST_PLAYERS, (Object) list); -- List list1 = (List) list.stream().filter((entityhuman) -> { -- return doTick(entity, (LivingEntity) entityhuman); -- }).collect(Collectors.toList()); -- -- behaviorcontroller.setMemory(MemoryModuleType.NEAREST_VISIBLE_PLAYER, (Object) (list1.isEmpty() ? null : (Player) list1.get(0))); -- Optional optional = list1.stream().filter(EntitySelector.ATTACK_ALLOWED).findFirst(); -- -- behaviorcontroller.setMemory(MemoryModuleType.NEAREST_VISIBLE_TARGETABLE_PLAYER, optional); -+ behaviorcontroller.setMemory(MemoryModuleType.NEAREST_PLAYERS, players); -+ -+ Player nearest = null, nearestTargetable = null; -+ for (Player player : players) { -+ if (Sensor.a(entity, player)) { -+ if (nearest == null) nearest = player; -+ if (EntitySelector.canAITarget().test(player)) { -+ nearestTargetable = player; -+ break; // Both variables are assigned, no reason to loop further -+ } -+ } -+ } -+ behaviorcontroller.setMemory(MemoryModuleType.NEAREST_VISIBLE_PLAYER, nearest); -+ behaviorcontroller.setMemory(MemoryModuleType.NEAREST_VISIBLE_TARGETABLE_PLAYER, nearestTargetable); -+ // Paper end - } - } diff --git a/patches/server-remapped/0691-Implement-Keyed-on-World.patch b/patches/server-remapped/0691-Implement-Keyed-on-World.patch deleted file mode 100644 index 94fd5a3703..0000000000 --- a/patches/server-remapped/0691-Implement-Keyed-on-World.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 6 Jan 2021 00:34:04 -0800 -Subject: [PATCH] Implement Keyed on World - - -diff --git a/src/main/java/net/minecraft/core/Registry.java b/src/main/java/net/minecraft/core/Registry.java -index 5a98bc1522c2035487ce0a048c236903dbfa816e..4924d8cd3004a6e1ce76cd5cf7520556c23fe20a 100644 ---- a/src/main/java/net/minecraft/core/Registry.java -+++ b/src/main/java/net/minecraft/core/Registry.java -@@ -130,7 +130,7 @@ public abstract class Registry implements Codec, Keyable, IdMap { - public static final ResourceKey> LOOT_FUNCTION_REGISTRY = createRegistryKey("loot_function_type"); - public static final ResourceKey> LOOT_ITEM_REGISTRY = createRegistryKey("loot_condition_type"); - public static final ResourceKey> DIMENSION_TYPE_REGISTRY = createRegistryKey("dimension_type"); -- public static final ResourceKey> DIMENSION_REGISTRY = createRegistryKey("dimension"); -+ public static final ResourceKey> DIMENSION_REGISTRY = createRegistryKey("dimension"); public static final ResourceKey> getWorldRegistry() { return DIMENSION_REGISTRY; } // Paper - OBFHELPER - public static final ResourceKey> LEVEL_STEM_REGISTRY = createRegistryKey("dimension"); - public static final Registry SOUND_EVENT = registerSimple(Registry.SOUND_EVENT_REGISTRY, () -> { - return SoundEvents.ITEM_PICKUP; -@@ -339,9 +339,9 @@ public abstract class Registry implements Codec, Keyable, IdMap { - ResourceLocation minecraftkey = resourcekey.location(); - - Registry.LOADERS.put(minecraftkey, defaultEntry); -- WritableRegistry iregistrywritable = Registry.WRITABLE_REGISTRY; -+ WritableRegistry iregistrywritable = Registry.WRITABLE_REGISTRY; // Paper - decompile fix - -- return (WritableRegistry) iregistrywritable.register(resourcekey, (Object) registry, lifecycle); -+ return (R) iregistrywritable.register(resourcekey, (Object) registry, lifecycle); // Paper - decompile fix - } - - protected Registry(ResourceKey> key, Lifecycle lifecycle) { -@@ -428,11 +428,11 @@ public abstract class Registry implements Codec, Keyable, IdMap { - } - - public static T register(Registry registry, ResourceLocation id, T entry) { -- return ((WritableRegistry) registry).register(ResourceKey.create(registry.key, id), entry, Lifecycle.stable()); -+ return ((WritableRegistry) registry).register(ResourceKey.create(registry.key, id), entry, Lifecycle.stable()); // Paper - decompile fix - } - - public static T registerMapping(Registry registry, int rawId, String id, T entry) { -- return ((WritableRegistry) registry).registerMapping(rawId, ResourceKey.create(registry.key, new ResourceLocation(id)), entry, Lifecycle.stable()); -+ return ((WritableRegistry) registry).registerMapping(rawId, ResourceKey.create(registry.key, new ResourceLocation(id)), entry, Lifecycle.stable()); // Paper - decompile fix - } - - static { -diff --git a/src/main/java/net/minecraft/resources/ResourceKey.java b/src/main/java/net/minecraft/resources/ResourceKey.java -index 2f39438ee9b23706efb2fd877fe223777b6968c7..3085ec1f20f4c945242697b809188a8c828cfb75 100644 ---- a/src/main/java/net/minecraft/resources/ResourceKey.java -+++ b/src/main/java/net/minecraft/resources/ResourceKey.java -@@ -12,6 +12,7 @@ public class ResourceKey { - private final ResourceLocation registryName; - private final ResourceLocation location; - -+ public static ResourceKey newResourceKey(ResourceKey> registryKey, ResourceLocation minecraftKey) { return create(registryKey, minecraftKey); } // Paper - OBFHELPER - public static ResourceKey create(ResourceKey> registry, ResourceLocation value) { - return create(registry.location, value); - } -@@ -41,6 +42,7 @@ public class ResourceKey { - return this.registryName.equals(registry.location()); - } - -+ public ResourceLocation getLocation() { return location(); } // Paper - OBFHELPER - public ResourceLocation location() { - return this.location; - } -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 794b894ed24636aec60de9a28ba7613d7a917324..6905256147d9bd79e5f52bf86bdb21c89b8411a7 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1156,7 +1156,7 @@ public final class CraftServer implements Server { - } else if (name.equals(levelName + "_the_end")) { - worldKey = net.minecraft.world.level.Level.END; - } else { -- worldKey = ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(name.toLowerCase(java.util.Locale.ENGLISH))); -+ worldKey = ResourceKey.newResourceKey(Registry.getWorldRegistry(), new net.minecraft.resources.ResourceLocation(creator.key().getNamespace().toLowerCase(java.util.Locale.ENGLISH), creator.key().getKey().toLowerCase(java.util.Locale.ENGLISH))); // Paper - } - - ServerLevel internal = (ServerLevel) new ServerLevel(console, console.executor, worldSession, worlddata, worldKey, dimensionmanager, getServer().progressListenerFactory.create(11), -@@ -1246,6 +1246,15 @@ public final class CraftServer implements Server { - return null; - } - -+ // Paper start -+ @Override -+ public World getWorld(NamespacedKey worldKey) { -+ ServerLevel worldServer = console.getLevel(ResourceKey.newResourceKey(Registry.getWorldRegistry(), CraftNamespacedKey.toMinecraft(worldKey))); -+ if (worldServer == null) return null; -+ return worldServer.getWorld(); -+ } -+ // Paper end -+ - public void addWorld(World world) { - // Check if a World already exists with the UID. - if (getWorld(world.getUID()) != null) { -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index f497b9e11a075a84ff0a2117eb79d0532e4a326f..b0212b2043ee5fd77c8876ef0b51ef91488712f0 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2566,6 +2566,11 @@ public class CraftWorld implements World { - return CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk()); - }, net.minecraft.server.MinecraftServer.getServer()); - } -+ -+ @Override -+ public org.bukkit.NamespacedKey getKey() { -+ return org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(world.dimension().getLocation()); -+ } - // Paper end - - // Spigot start diff --git a/patches/server-remapped/0693-Item-Rarity-API.patch b/patches/server-remapped/0693-Item-Rarity-API.patch deleted file mode 100644 index 51a841f551..0000000000 --- a/patches/server-remapped/0693-Item-Rarity-API.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Fri, 12 Mar 2021 17:09:42 -0800 -Subject: [PATCH] Item Rarity API - - -diff --git a/src/main/java/net/minecraft/world/item/Item.java b/src/main/java/net/minecraft/world/item/Item.java -index 58400e84830c93675b0a1fe632be5e217c19a932..cb079bfd5339b96ad372b0a3b483d02cd0636bfd 100644 ---- a/src/main/java/net/minecraft/world/item/Item.java -+++ b/src/main/java/net/minecraft/world/item/Item.java -@@ -45,7 +45,7 @@ public class Item implements ItemLike { - protected static final UUID BASE_ATTACK_SPEED_UUID = UUID.fromString("FA233E1C-4180-4865-B01B-BCCE9785ACA3"); - protected static final Random random = new Random(); - protected final CreativeModeTab category; -- private final Rarity rarity; -+ private final Rarity rarity; public final Rarity getItemRarity() { return rarity; } // Paper - OBFHELPER - private final int maxStackSize; - private final int maxDamage; - private final boolean isFireResistant; -@@ -209,6 +209,7 @@ public class Item implements ItemLike { - return stack.isEnchanted(); - } - -+ public Rarity getItemStackRarity(ItemStack itemStack) { return getRarity(itemStack); } // Paper - OBFHELPER - public Rarity getRarity(ItemStack stack) { - if (!stack.isEnchanted()) { - return this.rarity; -diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 25a29d997f163ce2b11330d66a691601f514a9cb..472b0615dcdc3c0c52bd377fd69752716f354262 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -470,6 +470,20 @@ public final class CraftMagicNumbers implements UnsafeValues { - public int nextEntityId() { - return net.minecraft.world.entity.Entity.nextEntityId(); - } -+ -+ @Override -+ public io.papermc.paper.inventory.ItemRarity getItemRarity(org.bukkit.Material material) { -+ Item item = getItem(material); -+ if (item == null) { -+ throw new IllegalArgumentException(material + " is not an item, and rarity does not apply to blocks"); -+ } -+ return io.papermc.paper.inventory.ItemRarity.values()[item.getItemRarity().ordinal()]; -+ } -+ -+ @Override -+ public io.papermc.paper.inventory.ItemRarity getItemStackRarity(org.bukkit.inventory.ItemStack itemStack) { -+ return io.papermc.paper.inventory.ItemRarity.values()[getItem(itemStack.getType()).getItemStackRarity(CraftItemStack.asNMSCopy(itemStack)).ordinal()]; -+ } - // Paper end - - /** diff --git a/patches/server-remapped/0699-Don-t-ignore-result-of-PlayerEditBookEvent.patch b/patches/server-remapped/0699-Don-t-ignore-result-of-PlayerEditBookEvent.patch deleted file mode 100644 index 930a7a71e6..0000000000 --- a/patches/server-remapped/0699-Don-t-ignore-result-of-PlayerEditBookEvent.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: jmp -Date: Mon, 5 Apr 2021 18:35:15 -0700 -Subject: [PATCH] Don't ignore result of PlayerEditBookEvent - - -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 1add53082ab9382cb2e90dc8305b8c71ef1c6a46..65afc23f4791aca19bff78ed86b3b0d31fa81977 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1144,7 +1144,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { - list.stream().map(StringTag::valueOf).forEach(nbttaglist::add); - ItemStack old = itemstack.copy(); // CraftBukkit - itemstack.addTagElement("pages", (Tag) nbttaglist); -- CraftEventFactory.handleEditBookEvent(player, i, old, itemstack); // CraftBukkit -+ this.player.inventory.setItem(i, CraftEventFactory.handleEditBookEvent(player, i, old, itemstack)); // CraftBukkit // Paper - Don't ignore result (see other callsite for handleEditBookEvent) - } - } - diff --git a/patches/server-remapped/0700-fix-cancelling-block-falling-causing-client-desync.patch b/patches/server-remapped/0700-fix-cancelling-block-falling-causing-client-desync.patch deleted file mode 100644 index 00cd7e5d6c..0000000000 --- a/patches/server-remapped/0700-fix-cancelling-block-falling-causing-client-desync.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Trigary -Date: Sat, 27 Mar 2021 11:13:30 +0100 -Subject: [PATCH] fix cancelling block falling causing client desync - - -diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -index 2ba81e7179c7f9e2e1add1ad6bd6b96ee12c5da1..718e20f83a9b510c095d7e12241616cdce33d2d6 100644 ---- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -13,6 +13,7 @@ import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; - import net.minecraft.network.syncher.EntityDataAccessor; - import net.minecraft.network.syncher.EntityDataSerializers; - import net.minecraft.network.syncher.SynchedEntityData; -+import net.minecraft.server.level.ServerLevel; - import net.minecraft.tags.BlockTags; - import net.minecraft.tags.FluidTags; - import net.minecraft.tags.Tag; -@@ -41,6 +42,7 @@ import net.minecraft.world.level.material.Fluids; - import net.minecraft.world.phys.BlockHitResult; - import net.minecraft.world.phys.HitResult; - import net.minecraft.world.phys.Vec3; -+import org.bukkit.craftbukkit.block.CraftBlock; - import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit - - public class FallingBlockEntity extends Entity { -@@ -114,8 +116,18 @@ public class FallingBlockEntity extends Entity { - - if (this.time++ == 0) { - blockposition = this.blockPosition(); -- if (this.level.getBlockState(blockposition).is(block) && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) { -- this.level.removeBlock(blockposition, false); -+ // Paper start - fix cancelling block falling causing client desync -+ if (this.level.getBlockState(blockposition).isSameInstance(block)) { -+ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) { -+ if (this.level.getBlockState(blockposition).isSameInstance(block)) { //if listener didn't update the block -+ ((ServerLevel) level).getChunkSource().blockChanged(blockposition); -+ } -+ this.remove(); -+ return; -+ } else { -+ this.level.setAir(blockposition, false); -+ } -+ // Paper end - fix cancelling block falling causing client desync - } else if (!this.level.isClientSide) { - this.remove(); - return; -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 17baae6b11f191f4738a107c7e62ea5bdac17a3c..32cda8c2e14cf8b218cb006a9b25330f0dab849a 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 -@@ -682,6 +682,7 @@ public abstract class BlockBehaviour { - return this.getBlock().is(tag) && predicate.test(this); - } - -+ public final boolean isSameInstance(Block block) { return is(block); } // Paper - OBFHELPER - public boolean is(Block block) { - return this.getBlock().is(block); - } diff --git a/patches/server-remapped/0709-Fix-duplicating-give-items-on-item-drop-cancel.patch b/patches/server-remapped/0709-Fix-duplicating-give-items-on-item-drop-cancel.patch deleted file mode 100644 index 0672393254..0000000000 --- a/patches/server-remapped/0709-Fix-duplicating-give-items-on-item-drop-cancel.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alphaesia -Date: Fri, 23 Apr 2021 09:57:56 +1200 -Subject: [PATCH] Fix duplicating /give items on item drop cancel - -Fixes SPIGOT-2942 (Give command fires PlayerDropItemEvent, cancelling it causes item duplication). - -For every stack of items to give, /give puts the item stack straight -into the player's inventory. However, it also summons a "fake item" -at the player's location. When the PlayerDropItemEvent for this fake -item is cancelled, the server attempts to put the item back into the -player's inventory. The result is that the fake item, which is never -meant to be obtained, is combined with the real items injected directly -into the player's inventory. This means more items than the amount -specified in /give are given to the player - one for every stack of -items given. (e.g. /give @s dirt 1 gives you 2 dirt). - -While this isn't a big issue for general building usage, it can affect -e.g. adventure maps where the number of items the player receives is -important (and you want to restrict the player from throwing items). - -If there are any overflow items that didn't make it into the inventory -(insufficient space), those items are dropped as a real item instead -of a fake one. While cancelling this drop would also result in the -server attempting to put those items into the inventory, since it is -full this has no effect. - -Just ignoring cancellation of the PlayerDropItemEvent seems like the -cleanest and least intrusive way to fix it. - -diff --git a/src/main/java/net/minecraft/server/commands/GiveCommand.java b/src/main/java/net/minecraft/server/commands/GiveCommand.java -index a6259e9160f291cf527a4ea5533a2e5530471874..3b8a7b9bdd2445afa93e4f2dc971a1d252c1463a 100644 ---- a/src/main/java/net/minecraft/server/commands/GiveCommand.java -+++ b/src/main/java/net/minecraft/server/commands/GiveCommand.java -@@ -49,7 +49,7 @@ public class GiveCommand { - - if (flag && itemstack.isEmpty()) { - itemstack.setCount(1); -- entityitem = entityplayer.drop(itemstack, false); -+ entityitem = entityplayer.drop(itemstack, false, false, true); // Paper - Fix duplicating /give items on item drop cancel - if (entityitem != null) { - entityitem.makeFakeItem(); - } -diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 4817b8ab259d348b48bc325d34ba9351ffe951df..cfb9bd6b9863a0f6f0f50181b7553adce90cfebe 100644 ---- a/src/main/java/net/minecraft/world/entity/player/Player.java -+++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -639,7 +639,14 @@ public abstract class Player extends LivingEntity { - - @Nullable - public ItemEntity drop(ItemStack stack, boolean throwRandomly, boolean retainOwnership) { -- if (stack.isEmpty()) { -+ // Paper start - Fix duplicating /give items on item drop cancel -+ return this.drop(stack, throwRandomly, retainOwnership, false); -+ } -+ -+ @Nullable -+ public ItemEntity drop(ItemStack itemstack, boolean flag, boolean flag1, boolean alwaysSucceed) { -+ // Paper end -+ if (itemstack.isEmpty()) { - return null; - } else { - if (this.level.isClientSide) { -@@ -647,17 +654,17 @@ public abstract class Player extends LivingEntity { - } - - double d0 = this.getEyeY() - 0.30000001192092896D; -- ItemEntity entityitem = new ItemEntity(this.level, this.getX(), d0, this.getZ(), stack); -+ ItemEntity entityitem = new ItemEntity(this.level, this.getX(), d0, this.getZ(), itemstack); - - entityitem.setPickUpDelay(40); -- if (retainOwnership) { -+ if (flag1) { - entityitem.setThrower(this.getUUID()); - } - - float f; - float f1; - -- if (throwRandomly) { -+ if (flag) { - f = this.random.nextFloat() * 0.5F; - f1 = this.random.nextFloat() * 6.2831855F; - entityitem.setDeltaMovement((double) (-Mth.sin(f1) * f), 0.20000000298023224D, (double) (Mth.cos(f1) * f)); -@@ -680,12 +687,12 @@ public abstract class Player extends LivingEntity { - PlayerDropItemEvent event = new PlayerDropItemEvent(player, drop); - this.level.getCraftServer().getPluginManager().callEvent(event); - -- if (event.isCancelled()) { -+ if (event.isCancelled() && !alwaysSucceed) { // Paper - Fix duplicating /give items on item drop cancel - org.bukkit.inventory.ItemStack cur = player.getInventory().getItemInHand(); -- if (retainOwnership && (cur == null || cur.getAmount() == 0)) { -+ if (flag1 && (cur == null || cur.getAmount() == 0)) { - // The complete stack was dropped - player.getInventory().setItemInHand(drop.getItemStack()); -- } else if (retainOwnership && cur.isSimilar(drop.getItemStack()) && cur.getAmount() < cur.getMaxStackSize() && drop.getItemStack().getAmount() == 1) { -+ } else if (flag1 && cur.isSimilar(drop.getItemStack()) && cur.getAmount() < cur.getMaxStackSize() && drop.getItemStack().getAmount() == 1) { - // Only one item is dropped - cur.setAmount(cur.getAmount() + 1); - player.getInventory().setItemInHand(cur); -@@ -697,9 +704,9 @@ public abstract class Player extends LivingEntity { - } - // CraftBukkit end - // Paper start - remove player from map on drop -- if (stack.getItem() == Items.FILLED_MAP) { -- MapItemSavedData worldmap = MapItem.getOrCreateSavedData(stack, this.level); -- worldmap.updateSeenPlayers(this, stack); -+ if (itemstack.getItem() == Items.FILLED_MAP) { -+ MapItemSavedData worldmap = MapItem.getOrCreateSavedData(itemstack, this.level); -+ worldmap.updateSeenPlayers(this, itemstack); - } - // Paper end - diff --git a/patches/server-remapped/0714-fix-PlayerItemHeldEvent-firing-twice.patch b/patches/server-remapped/0714-fix-PlayerItemHeldEvent-firing-twice.patch deleted file mode 100644 index 094351a8ff..0000000000 --- a/patches/server-remapped/0714-fix-PlayerItemHeldEvent-firing-twice.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: chickeneer -Date: Thu, 22 Apr 2021 19:02:07 -0700 -Subject: [PATCH] fix PlayerItemHeldEvent firing twice - - -diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCarriedItemPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCarriedItemPacket.java -index 68026536cfc26f07ca99ee9e76fd74b4ed4a995c..848fb02988b0fb319655f790112274ac2a437d25 100644 ---- a/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCarriedItemPacket.java -+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundSetCarriedItemPacket.java -@@ -24,6 +24,7 @@ public class ServerboundSetCarriedItemPacket implements Packet= 0 && packet.getSlot() < Inventory.getSelectionSize()) { -+ if (packet.getItemInHandIndex() == this.player.inventory.selected) { return; } // Paper - don't fire itemheldevent when there wasn't a slot change - PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.selected, packet.getSlot()); - this.craftServer.getPluginManager().callEvent(event); - if (event.isCancelled()) { diff --git a/patches/server-remapped/0716-More-World-API.patch b/patches/server-remapped/0716-More-World-API.patch deleted file mode 100644 index 37cb7379d4..0000000000 --- a/patches/server-remapped/0716-More-World-API.patch +++ /dev/null @@ -1,146 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Tue, 7 Jul 2020 10:52:34 -0700 -Subject: [PATCH] More World API - - -diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index a7553a856b9c99bee8f75d514b97cfab952bfd33..511e6a941d441c55a4b38660f0f7f8c47fa689dd 100644 ---- a/src/main/java/net/minecraft/server/level/ServerLevel.java -+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1863,6 +1863,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - return !this.worldDataServer.worldGenSettings().generateFeatures() ? null : this.getChunkSource().getGenerator().findNearestMapFeature(this, feature, pos, radius, skipExistingChunks); // CraftBukkit - } - -+ public BlockPos getNearestBiome(Biome biomeBase, BlockPos blockPosition, int radius, int step) { return this.findNearestBiome(biomeBase, blockPosition, radius, step); } // Paper - OBFHELPER - @Nullable - public BlockPos findNearestBiome(Biome biome, BlockPos pos, int radius, int j) { - return this.getChunkSource().getGenerator().getBiomeSource().findBiomeHorizontal(pos.getX(), pos.getY(), pos.getZ(), radius, j, (biomebase1) -> { -@@ -1885,6 +1886,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - return this.noSave; - } - -+ public RegistryAccess getWorldCustomRegistry() { return registryAccess(); } // Paper - OBFHELPER - @Override - public RegistryAccess registryAccess() { - return this.server.registryAccess(); -diff --git a/src/main/java/net/minecraft/world/level/dimension/DimensionType.java b/src/main/java/net/minecraft/world/level/dimension/DimensionType.java -index 7dead90a0d77e936816c2a54fe70c87d92dc8e5b..fb2bdfbeb44de6ce967af2deb4738972b44dcf44 100644 ---- a/src/main/java/net/minecraft/world/level/dimension/DimensionType.java -+++ b/src/main/java/net/minecraft/world/level/dimension/DimensionType.java -@@ -142,10 +142,10 @@ public class DimensionType { - public static RegistryAccess.RegistryHolder registerBuiltin(RegistryAccess.RegistryHolder registryManager) { - WritableRegistry iregistrywritable = registryManager.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY); - -- iregistrywritable.register(DimensionType.OVERWORLD_LOCATION, (Object) DimensionType.DEFAULT_OVERWORLD, Lifecycle.stable()); -- iregistrywritable.register(DimensionType.OVERWORLD_CAVES_LOCATION, (Object) DimensionType.DEFAULT_OVERWORLD_CAVES, Lifecycle.stable()); -- iregistrywritable.register(DimensionType.NETHER_LOCATION, (Object) DimensionType.DEFAULT_NETHER, Lifecycle.stable()); -- iregistrywritable.register(DimensionType.END_LOCATION, (Object) DimensionType.DEFAULT_END, Lifecycle.stable()); -+ iregistrywritable.register(DimensionType.OVERWORLD_LOCATION, DimensionType.DEFAULT_OVERWORLD, Lifecycle.stable()); // Paper - decompile fix -+ iregistrywritable.register(DimensionType.OVERWORLD_CAVES_LOCATION, DimensionType.DEFAULT_OVERWORLD_CAVES, Lifecycle.stable()); // Paper - decompile fix -+ iregistrywritable.register(DimensionType.NETHER_LOCATION, DimensionType.DEFAULT_NETHER, Lifecycle.stable()); // Paper - decompile fix -+ iregistrywritable.register(DimensionType.END_LOCATION, DimensionType.DEFAULT_END, Lifecycle.stable()); // Paper - decompile fix - return registryManager; - } - -@@ -164,10 +164,10 @@ public class DimensionType { - public static MappedRegistry defaultDimensions(Registry dimensionRegistry, Registry biomeRegistry, Registry chunkGeneratorSettingsRegistry, long seed) { - MappedRegistry registrymaterials = new MappedRegistry<>(Registry.LEVEL_STEM_REGISTRY, Lifecycle.experimental()); - -- registrymaterials.register(LevelStem.NETHER, (Object) (new LevelStem(() -> { -+ registrymaterials.register(LevelStem.NETHER, (new LevelStem(() -> { // Paper - decompile fix - return (DimensionType) dimensionRegistry.getOrThrow(DimensionType.NETHER_LOCATION); - }, defaultNetherGenerator(biomeRegistry, chunkGeneratorSettingsRegistry, seed))), Lifecycle.stable()); -- registrymaterials.register(LevelStem.END, (Object) (new LevelStem(() -> { -+ registrymaterials.register(LevelStem.END, (new LevelStem(() -> { // Paper - decompile fix - return (DimensionType) dimensionRegistry.getOrThrow(DimensionType.END_LOCATION); - }, defaultEndGenerator(biomeRegistry, chunkGeneratorSettingsRegistry, seed))), Lifecycle.stable()); - return registrymaterials; -@@ -256,6 +256,7 @@ public class DimensionType { - return this.brightnessRamp[i]; - } - -+ public Tag getInfiniburnTag() { return infiniburn(); } // Paper - OBFHELPER - public Tag infiniburn() { - Tag tag = BlockTags.getAllTags().getTag(this.infiniburn); - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index b44e83d93bba579e439b93e5093350675137b070..a1fa2d5e00bd125abd38a00e0bc3936f2fb8186f 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2515,6 +2515,75 @@ public class CraftWorld implements World { - return (nearest == null) ? null : new Location(this, nearest.getX(), nearest.getY(), nearest.getZ()); - } - -+ // Paper start -+ @Override -+ public Location locateNearestBiome(Location origin, Biome biome, int radius) { -+ return this.locateNearestBiome(origin, biome, radius, 8); -+ } -+ -+ @Override -+ public Location locateNearestBiome(Location origin, Biome biome, int radius, int step) { -+ BlockPos originPos = new BlockPos(origin.getX(), origin.getY(), origin.getZ()); -+ BlockPos nearest = getHandle().getNearestBiome(CraftBlock.biomeToBiomeBase(getHandle().getWorldCustomRegistry().registryOrThrow(Registry.BIOME_REGISTRY), biome), originPos, radius, step); -+ return (nearest == null) ? null : new Location(this, nearest.getX(), nearest.getY(), nearest.getZ()); -+ } -+ -+ @Override -+ public boolean isUltrawarm() { -+ return getHandle().dimensionType().ultraWarm(); -+ } -+ -+ @Override -+ public boolean isNatural() { -+ return getHandle().dimensionType().natural(); -+ } -+ -+ @Override -+ public double getCoordinateScale() { -+ return getHandle().dimensionType().coordinateScale(); -+ } -+ -+ @Override -+ public boolean hasSkylight() { -+ return getHandle().dimensionType().hasSkyLight(); -+ } -+ -+ @Override -+ public boolean hasBedrockCeiling() { -+ return getHandle().dimensionType().hasSkyLight(); -+ } -+ -+ @Override -+ public boolean isPiglinSafe() { -+ return getHandle().dimensionType().piglinSafe(); -+ } -+ -+ @Override -+ public boolean doesBedWork() { -+ return getHandle().dimensionType().bedWorks(); -+ } -+ -+ @Override -+ public boolean doesRespawnAnchorWork() { -+ return getHandle().dimensionType().respawnAnchorWorks(); -+ } -+ -+ @Override -+ public boolean hasRaids() { -+ return getHandle().dimensionType().hasRaids(); -+ } -+ -+ @Override -+ public boolean isFixedTime() { -+ return getHandle().dimensionType().hasFixedTime(); -+ } -+ -+ @Override -+ public Collection getInfiniburn() { -+ return com.google.common.collect.Sets.newHashSet(com.google.common.collect.Iterators.transform(getHandle().dimensionType().getInfiniburnTag().getTagged().iterator(), CraftMagicNumbers::getMaterial)); -+ } -+ // Paper end -+ - @Override - public Raid locateNearestRaid(Location location, int radius) { - Validate.notNull(location, "Location cannot be null"); diff --git a/patches/server-remapped/0726-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch b/patches/server-remapped/0726-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch deleted file mode 100644 index 9006bd8edb..0000000000 --- a/patches/server-remapped/0726-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alvinn8 <42838560+Alvinn8@users.noreply.github.com> -Date: Fri, 8 Jan 2021 20:31:13 +0100 -Subject: [PATCH] Add Adventure message to PlayerAdvancementDoneEvent - - -diff --git a/src/main/java/net/minecraft/advancements/Advancement.java b/src/main/java/net/minecraft/advancements/Advancement.java -index 9d27b658d32297337fb367bae628a1cc3a78712a..4abbe45237667c08753c040ef1281af1b2f34f88 100644 ---- a/src/main/java/net/minecraft/advancements/Advancement.java -+++ b/src/main/java/net/minecraft/advancements/Advancement.java -@@ -76,6 +76,7 @@ public class Advancement { - return this.parent; - } - -+ public final @Nullable DisplayInfo getAdvancementDisplay() { return this.getDisplay(); } // Paper - OBFHELPER - @Nullable - public DisplayInfo getDisplay() { - return this.display; -@@ -125,6 +126,7 @@ public class Advancement { - return this.requirements; - } - -+ public final Component getChatComponent() { return this.getChatComponent(); } // Paper - OBFHELPER - public Component getChatComponent() { - return this.chatComponent; - } -diff --git a/src/main/java/net/minecraft/advancements/DisplayInfo.java b/src/main/java/net/minecraft/advancements/DisplayInfo.java -index 2bcf14826ec1c6a1654246844d03184ceae55d79..1b41578fed1da6d15a806a7200e53954f608b625 100644 ---- a/src/main/java/net/minecraft/advancements/DisplayInfo.java -+++ b/src/main/java/net/minecraft/advancements/DisplayInfo.java -@@ -54,10 +54,12 @@ public class DisplayInfo { - return this.description; - } - -+ public final FrameType getFrameType() { return this.getFrame(); } // Paper - OBFHELPER - public FrameType getFrame() { - return this.frame; - } - -+ public final boolean shouldAnnounceToChat() { return this.shouldAnnounceChat(); } // Paper - OBFHELPER - public boolean shouldAnnounceChat() { - return this.announceChat; - } -diff --git a/src/main/java/net/minecraft/advancements/FrameType.java b/src/main/java/net/minecraft/advancements/FrameType.java -index 0ccac480a760259412b525e66c43de3a209543f5..f6d4b876bdd25942763780f17c8bb69ac3d56031 100644 ---- a/src/main/java/net/minecraft/advancements/FrameType.java -+++ b/src/main/java/net/minecraft/advancements/FrameType.java -@@ -20,6 +20,7 @@ public enum FrameType { - this.displayName = new TranslatableComponent("advancements.toast." + s); - } - -+ public final String getId() { return this.getName(); } // Paper - OBFHELPER - public String getName() { - return this.name; - } -diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java -index b8d3f2c59199e245e2035d6205dd1a042aa93f77..fcb59f6538e66fa43d11d4998e6eeac2e33b0393 100644 ---- a/src/main/java/net/minecraft/server/PlayerAdvancements.java -+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java -@@ -51,6 +51,7 @@ import net.minecraft.util.datafix.DataFixTypes; - import net.minecraft.world.level.GameRules; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -+import io.papermc.paper.adventure.PaperAdventure; // Paper - - public class PlayerAdvancements { - -@@ -313,10 +314,18 @@ public class PlayerAdvancements { - this.progressChanged.add(advancement); - flag = true; - if (!flag1 && advancementprogress.isDone()) { -- this.player.level.getCraftServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit)); // CraftBukkit -+ // Paper start - Add Adventure message to PlayerAdvancementDoneEvent -+ boolean announceToChat = advancement.getAdvancementDisplay() != null && advancement.getAdvancementDisplay().shouldAnnounceToChat(); -+ net.kyori.adventure.text.Component message = announceToChat ? PaperAdventure.asAdventure(new TranslatableComponent("chat.type.advancement." + advancement.getAdvancementDisplay().getFrameType().getId(), this.player.getDisplayName(), advancement.getChatComponent())) : null; -+ org.bukkit.event.player.PlayerAdvancementDoneEvent event = new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit, message); -+ this.player.level.getCraftServer().getPluginManager().callEvent(event); -+ message = event.message(); -+ // Paper end - advancement.getRewards().a(this.player); -- if (advancement.getDisplay() != null && advancement.getDisplay().shouldAnnounceChat() && this.player.level.getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) { -- this.playerList.broadcastMessage(new TranslatableComponent("chat.type.advancement." + advancement.getDisplay().getFrame().getName(), new Object[]{this.player.getDisplayName(), advancement.getChatComponent()}), ChatType.SYSTEM, Util.NIL_UUID); -+ // Paper start - Add Adventure message to PlayerAdvancementDoneEvent -+ if (message != null && this.player.level.getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) { -+ this.playerList.broadcastMessage(PaperAdventure.asVanilla(message), ChatType.SYSTEM, Util.getNullUUID()); -+ // Paper end - } - } - } diff --git a/patches/server-remapped/0732-Add-basic-Datapack-API.patch b/patches/server-remapped/0732-Add-basic-Datapack-API.patch deleted file mode 100644 index 547e7cb557..0000000000 --- a/patches/server-remapped/0732-Add-basic-Datapack-API.patch +++ /dev/null @@ -1,174 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Connor Linfoot -Date: Sun, 16 May 2021 15:07:34 +0100 -Subject: [PATCH] Add basic Datapack API - - -diff --git a/src/main/java/io/papermc/paper/datapack/PaperDatapack.java b/src/main/java/io/papermc/paper/datapack/PaperDatapack.java -new file mode 100644 -index 0000000000000000000000000000000000000000..66debefcd474e4dcc2a8889a82af6c1809c93f46 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/datapack/PaperDatapack.java -@@ -0,0 +1,51 @@ -+package io.papermc.paper.datapack; -+ -+import Compatibility; -+import io.papermc.paper.event.server.ServerResourcesReloadedEvent; -+import net.minecraft.server.MinecraftServer; -+import net.minecraft.server.packs.repository.Pack; -+import java.util.List; -+import java.util.stream.Collectors; -+ -+public class PaperDatapack implements Datapack { -+ private final String name; -+ private final Compatibility compatibility; -+ private final boolean enabled; -+ -+ PaperDatapack(Pack loader, boolean enabled) { -+ this.name = loader.getName(); -+ this.compatibility = Compatibility.valueOf(loader.getVersion().name()); -+ this.enabled = enabled; -+ } -+ -+ @Override -+ public String getName() { -+ return name; -+ } -+ -+ @Override -+ public Compatibility getCompatibility() { -+ return compatibility; -+ } -+ -+ @Override -+ public boolean isEnabled() { -+ return enabled; -+ } -+ -+ @Override -+ public void setEnabled(boolean enabled) { -+ if (enabled == this.enabled) { -+ return; -+ } -+ -+ MinecraftServer server = MinecraftServer.getServer(); -+ List enabledKeys = server.getPackRepository().getEnabledPacks().stream().map(Pack::getName).collect(Collectors.toList()); -+ if (enabled) { -+ enabledKeys.add(this.name); -+ } else { -+ enabledKeys.remove(this.name); -+ } -+ server.reloadServerResources(enabledKeys, ServerResourcesReloadedEvent.Cause.PLUGIN); -+ } -+} -diff --git a/src/main/java/io/papermc/paper/datapack/PaperDatapackManager.java b/src/main/java/io/papermc/paper/datapack/PaperDatapackManager.java -new file mode 100644 -index 0000000000000000000000000000000000000000..ec221183bef1065bda0a37e1025958df0d1f6318 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/datapack/PaperDatapackManager.java -@@ -0,0 +1,25 @@ -+package io.papermc.paper.datapack; -+ -+import java.util.Collection; -+import java.util.stream.Collectors; -+import net.minecraft.server.packs.repository.Pack; -+import net.minecraft.server.packs.repository.PackRepository; -+ -+public class PaperDatapackManager implements DatapackManager { -+ private final PackRepository repository; -+ -+ public PaperDatapackManager(PackRepository repository) { -+ this.repository = repository; -+ } -+ -+ @Override -+ public Collection getPacks() { -+ Collection enabledPacks = repository.getEnabledPacks(); -+ return repository.getPacks().stream().map(loader -> new PaperDatapack(loader, enabledPacks.contains(loader))).collect(Collectors.toList()); -+ } -+ -+ @Override -+ public Collection getEnabledPacks() { -+ return repository.getEnabledPacks().stream().map(loader -> new PaperDatapack(loader, true)).collect(Collectors.toList()); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/packs/repository/Pack.java b/src/main/java/net/minecraft/server/packs/repository/Pack.java -index df5d258b80e37077fa236e4190ad934853c88619..4120326e0d047347e5d7ab9521babe7bb6b6a7db 100644 ---- a/src/main/java/net/minecraft/server/packs/repository/Pack.java -+++ b/src/main/java/net/minecraft/server/packs/repository/Pack.java -@@ -101,6 +101,7 @@ public class Pack implements AutoCloseable { - }); - } - -+ public final PackCompatibility getVersion() { return this.getCompatibility(); } // Paper - OBFHELPER - public PackCompatibility getCompatibility() { - return this.compatibility; - } -@@ -109,6 +110,7 @@ public class Pack implements AutoCloseable { - return (PackResources) this.supplier.get(); - } - -+ public final String getName() { return this.getId(); } // Paper - OBFHELPER - public String getId() { - return this.id; - } -diff --git a/src/main/java/net/minecraft/server/packs/repository/PackRepository.java b/src/main/java/net/minecraft/server/packs/repository/PackRepository.java -index bce2fd67048bd1fd53865eef81bac262dbda2865..8d0ef3bdf9fa283f54628800768717181df28aa5 100644 ---- a/src/main/java/net/minecraft/server/packs/repository/PackRepository.java -+++ b/src/main/java/net/minecraft/server/packs/repository/PackRepository.java -@@ -88,6 +88,7 @@ public class PackRepository implements AutoCloseable { - return this.available.keySet(); - } - -+ public final Collection getPacks() { return this.getAvailablePacks(); } // Paper - OBFHELPER - public Collection getAvailablePacks() { - return this.available.values(); - } -@@ -96,6 +97,7 @@ public class PackRepository implements AutoCloseable { - return (Collection) this.selected.stream().map(Pack::getId).collect(ImmutableSet.toImmutableSet()); - } - -+ public final Collection getEnabledPacks() { return this.getSelectedPacks(); } // Paper - OBFHELPER - public Collection getSelectedPacks() { - return this.selected; - } -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 6905256147d9bd79e5f52bf86bdb21c89b8411a7..63639923f7875d76f569b8c6e958782c6462d906 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -18,6 +18,7 @@ import com.mojang.serialization.Lifecycle; - import io.netty.buffer.ByteBuf; - import io.netty.buffer.ByteBufOutputStream; - import io.netty.buffer.Unpooled; -+import io.papermc.paper.datapack.PaperDatapackManager; // Paper - import io.papermc.paper.util.TraceUtil; - import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; - import java.awt.image.BufferedImage; -@@ -264,6 +265,7 @@ public final class CraftServer implements Server { - public boolean ignoreVanillaPermissions = false; - private final List playerView; - public int reloadCount; -+ private final PaperDatapackManager datapackManager; // Paper - public static Exception excessiveVelEx; // Paper - Velocity warnings - - static { -@@ -346,6 +348,7 @@ public final class CraftServer implements Server { - TicketType.PLUGIN.timeout = Math.min(20, configuration.getInt("chunk-gc.period-in-ticks")); // Paper - cap plugin loads to 1 second - minimumAPI = configuration.getString("settings.minimum-api"); - loadIcon(); -+ datapackManager = new PaperDatapackManager(console.getPackRepository()); // Paper - } - - public boolean getCommandBlockOverride(String command) { -@@ -2496,5 +2499,11 @@ public final class CraftServer implements Server { - public com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() { - return mobGoals; - } -+ -+ @Override -+ public PaperDatapackManager getDatapackManager() { -+ return datapackManager; -+ } -+ - // Paper end - } diff --git a/patches/server-remapped/0734-additions-to-PlayerGameModeChangeEvent.patch b/patches/server-remapped/0734-additions-to-PlayerGameModeChangeEvent.patch deleted file mode 100644 index 31a8669378..0000000000 --- a/patches/server-remapped/0734-additions-to-PlayerGameModeChangeEvent.patch +++ /dev/null @@ -1,138 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Sat, 15 May 2021 10:04:43 -0700 -Subject: [PATCH] additions to PlayerGameModeChangeEvent - - -diff --git a/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java b/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java -index c0098a8f8a9fa2671ff66cbcf50ac74b057d1446..ebbd6f2b0e7236b33d136ab2218c8eca4c5df03e 100644 ---- a/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java -+++ b/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java -@@ -43,7 +43,13 @@ public class DefaultGameModeCommands { - ServerPlayer entityplayer = (ServerPlayer) iterator.next(); - - if (entityplayer.gameMode.getGameModeForPlayer() != defaultGameMode) { -- entityplayer.setGameMode(defaultGameMode); -+ // Paper start - handle event cancelling the change -+ org.bukkit.event.player.PlayerGameModeChangeEvent event = entityplayer.setGamemode(defaultGameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.DEFAULT_GAMEMODE, net.kyori.adventure.text.Component.text("Failed to set the gamemode of '" + entityplayer.getScoreboardName() + "'", net.kyori.adventure.text.format.NamedTextColor.RED)); -+ if (event != null && event.isCancelled()) { -+ source.sendSuccess(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), false); -+ continue; -+ } -+ // Paper end - ++i; - } - } -diff --git a/src/main/java/net/minecraft/server/commands/GameModeCommand.java b/src/main/java/net/minecraft/server/commands/GameModeCommand.java -index 3e999090fb3b03b996a9790c53e5b4618c8891f7..3b17c81167f8e011e7f9c09bf42eb632f5a3c2f2 100644 ---- a/src/main/java/net/minecraft/server/commands/GameModeCommand.java -+++ b/src/main/java/net/minecraft/server/commands/GameModeCommand.java -@@ -62,13 +62,13 @@ public class GameModeCommand { - ServerPlayer entityplayer = (ServerPlayer) iterator.next(); - - if (entityplayer.gameMode.getGameModeForPlayer() != gameMode) { -- entityplayer.setGameMode(gameMode); -- // CraftBukkit start - handle event cancelling the change -- if (entityplayer.gameMode.getGameModeForPlayer() != gameMode) { -- context.getSource().sendFailure(new net.minecraft.network.chat.TextComponent("Failed to set the gamemode of '" + entityplayer.getScoreboardName() + "'")); -+ // Paper start - handle event cancelling the change -+ org.bukkit.event.player.PlayerGameModeChangeEvent event = entityplayer.setGamemode(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.COMMAND, net.kyori.adventure.text.Component.text("Failed to set the gamemode of '" + entityplayer.getScoreboardName() + "'", net.kyori.adventure.text.format.NamedTextColor.RED)); -+ if (event != null && event.isCancelled()) { -+ context.getSource().sendSuccess(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), false); - continue; - } -- // CraftBukkit end -+ // Paper end - logGamemodeChange((CommandSourceStack) context.getSource(), entityplayer, gameMode); - ++i; - } -diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 5d710a1f4e0c61d4be6efe8cebd9b80789868338..779b926921fd435620cbbc69ed6f9931a422b652 100644 ---- a/src/main/java/net/minecraft/server/level/ServerPlayer.java -+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -393,7 +393,16 @@ public class ServerPlayer extends Player implements ContainerListener { - if (this.getY() > 300) this.setPosRaw(getX(), 257, getZ()); // Paper - bring down to a saner Y level if out of world - if (tag.contains("playerGameType", 99)) { - if (this.getServer().getForceGameType()) { -+ // Paper start - call PlayerGameModeChangeEvent on join for players that do not have the correct gamemode -+ if (this.getServer().getDefaultGameType() != GameType.byId(tag.getInt("playerGameType"))) { -+ if (new org.bukkit.event.player.PlayerGameModeChangeEvent(this.getBukkitEntity(), GameMode.getByValue(this.getServer().getDefaultGameType().getId()), org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.DEFAULT_GAMEMODE, null).callEvent()) { - this.gameMode.setGameModeForPlayer(this.getServer().getDefaultGameType(), GameType.NOT_SET); -+ } else { -+ this.gameMode.setGameModeForPlayer(GameType.byId(tag.getInt("playerGameType")), tag.contains("previousPlayerGameType", 3) ? GameType.byId(tag.getInt("previousPlayerGameType")) : GameType.NOT_SET); // copied from below; if cancelled, set gamemode normally -+ } -+ } else { -+ this.gameMode.setGameModeForPlayer(GameType.byId(tag.getInt("playerGameType")), tag.contains("previousPlayerGameType", 3) ? GameType.byId(tag.getInt("previousPlayerGameType")) : GameType.NOT_SET); // copied from below; if no change needed, set gamemode normally -+ } // Paper end - } else { - this.gameMode.setGameModeForPlayer(GameType.byId(tag.getInt("playerGameType")), tag.contains("previousPlayerGameType", 3) ? GameType.byId(tag.getInt("previousPlayerGameType")) : GameType.NOT_SET); - } -@@ -1789,21 +1798,27 @@ public class ServerPlayer extends Player implements ContainerListener { - - @Override - public void setGameMode(GameType gameMode) { -+ // Paper start - Add cause and nullable message to event -+ setGamemode(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.UNKNOWN, null); -+ } -+ -+ public PlayerGameModeChangeEvent setGamemode(GameType enumgamemode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause cause, net.kyori.adventure.text.Component message) { -+ // Paper end - // CraftBukkit start -- if (gameMode == this.gameMode.getGameModeForPlayer()) { -- return; -+ if (enumgamemode == this.gameMode.getGameModeForPlayer()) { -+ return null; // Paper - } - -- PlayerGameModeChangeEvent event = new PlayerGameModeChangeEvent(getBukkitEntity(), GameMode.getByValue(gameMode.getId())); -+ PlayerGameModeChangeEvent event = new PlayerGameModeChangeEvent(getBukkitEntity(), GameMode.getByValue(enumgamemode.getId()), cause, message); // Paper - level.getCraftServer().getPluginManager().callEvent(event); - if (event.isCancelled()) { -- return; -+ return event; // Paper - } - // CraftBukkit end - -- this.gameMode.setGameModeForPlayer(gameMode); -- this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, (float) gameMode.getId())); -- if (gameMode == GameType.SPECTATOR) { -+ this.gameMode.setGameModeForPlayer(enumgamemode); -+ this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, (float) enumgamemode.getId())); -+ if (enumgamemode == GameType.SPECTATOR) { - this.removeEntitiesOnShoulder(); - this.stopRiding(); - } else { -@@ -1812,6 +1827,7 @@ public class ServerPlayer extends Player implements ContainerListener { - - this.onUpdateAbilities(); - this.updateEffectVisibility(); -+ return event; // Paper - } - - @Override -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index a0e69cac7699ddc318057c8016e329850d3baa26..c454908f23a436f66f8e64fc346186f113b6eefb 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2449,7 +2449,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { - - this.player = this.server.getPlayerList().respawn(this.player, false); - if (this.server.isHardcore()) { -- this.player.setGameMode(GameType.SPECTATOR); -+ this.player.setGamemode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper - ((GameRules.BooleanValue) this.player.getLevel().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.server); - } - } -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index ec8c7499662c0a810f1337ebc0fa24d2f3ca79e7..3dbe94d9b9647f5cc1e27335b36042e50c652cea 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1189,7 +1189,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - throw new IllegalArgumentException("Mode cannot be null"); - } - -- getHandle().setGameMode(GameType.byId(mode.getValue())); -+ getHandle().setGamemode(GameType.byId(mode.getValue()), org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.PLUGIN, null); // Paper - } - - @Override diff --git a/patches/server-remapped/0741-Add-Mob-lookAt-API.patch b/patches/server-remapped/0741-Add-Mob-lookAt-API.patch deleted file mode 100644 index ce42177784..0000000000 --- a/patches/server-remapped/0741-Add-Mob-lookAt-API.patch +++ /dev/null @@ -1,127 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Fri, 14 May 2021 13:42:17 -0500 -Subject: [PATCH] Add Mob#lookAt API - - -diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index ea34306858116e5626383af408529091836c2752..5692b497875ba2ee455859bc8a88d7888afd86fc 100644 ---- a/src/main/java/net/minecraft/world/entity/Mob.java -+++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -850,14 +850,17 @@ public abstract class Mob extends LivingEntity { - - protected void customServerAiStep() {} - -+ public int getMaxHeadXRot() { return getMaxHeadXRot(); } // Paper - OBFHELPER - public int getMaxHeadXRot() { - return 40; - } - -+ public int getMaxHeadYRot() { return getMaxHeadYRot(); } // Paper - OBFHELPER - public int getMaxHeadYRot() { - return 75; - } - -+ public int getHeadRotSpeed() { return getHeadRotSpeed(); } // Paper - OBFHELPER - public int getHeadRotSpeed() { - return 10; - } -diff --git a/src/main/java/net/minecraft/world/entity/ai/control/LookControl.java b/src/main/java/net/minecraft/world/entity/ai/control/LookControl.java -index faba4a95883bb0fcfd4f65c3f62bd6f476ded249..3fe159c4bdc3ad3e95354e18e2921305af121725 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/control/LookControl.java -+++ b/src/main/java/net/minecraft/world/entity/ai/control/LookControl.java -@@ -20,18 +20,28 @@ public class LookControl { - this.mob = entity; - } - -+ public void lookAt(Vec3 vec3d) { setLookAt(vec3d); } // Paper - OBFHELPER - public void setLookAt(Vec3 direction) { - this.setLookAt(direction.x, direction.y, direction.z); - } - -+ // Paper start -+ public void lookAt(Entity entity) { -+ this.lookAt(entity.getX(), getWantedY(entity), entity.getZ()); -+ } -+ // Paper end -+ -+ public void lookAt(Entity entity, float f, float f1) { setLookAt(entity, f, f1); } // Paper - OBFHELPER - public void setLookAt(Entity entity, float yawSpeed, float pitchSpeed) { - this.setLookAt(entity.getX(), getWantedY(entity), entity.getZ(), yawSpeed, pitchSpeed); - } - -+ public void lookAt(double d0, double d1, double d2) { setLookAt(d0, d1, d2); } // Paper - OBFHELPER - public void setLookAt(double x, double y, double z) { - this.setLookAt(x, y, z, (float) this.mob.getHeadRotSpeed(), (float) this.mob.getMaxHeadXRot()); - } - -+ public void lookAt(double d0, double d1, double d2, float f, float f1) { setLookAt(d0, d1, d2, f, f1); } // Paper - OBFHELPER - public void setLookAt(double x, double y, double z, float yawSpeed, float pitchSpeed) { - this.wantedX = x; - this.wantedY = y; -@@ -103,6 +113,7 @@ public class LookControl { - return from + f4; - } - -+ public static double getWantedY(Entity entity) { return getWantedY(entity); } // Paper - OBFHELPER - private static double getWantedY(Entity entity) { - return entity instanceof LivingEntity ? entity.getEyeY() : (entity.getBoundingBox().minY + entity.getBoundingBox().maxY) / 2.0D; - } -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java -index 1e3a0851c75d8067d2699f00bb3f6621d1d739d8..f597cf70779fde265cc45868aba3ae9db898fb6e 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java -@@ -83,5 +83,53 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob { - public boolean isInDaylight() { - return getHandle().isInDaylight(); - } -+ -+ @Override -+ public void lookAt(@org.jetbrains.annotations.NotNull org.bukkit.Location location) { -+ com.google.common.base.Preconditions.checkNotNull(location, "location cannot be null"); -+ com.google.common.base.Preconditions.checkArgument(location.getWorld().equals(getWorld()), "location in a different world"); -+ getHandle().getLookControl().lookAt(location.getX(), location.getY(), location.getZ()); -+ } -+ -+ @Override -+ public void lookAt(@org.jetbrains.annotations.NotNull org.bukkit.Location location, float headRotationSpeed, float maxHeadPitch) { -+ com.google.common.base.Preconditions.checkNotNull(location, "location cannot be null"); -+ com.google.common.base.Preconditions.checkArgument(location.getWorld().equals(getWorld()), "location in a different world"); -+ getHandle().getLookControl().lookAt(location.getX(), location.getY(), location.getZ(), headRotationSpeed, maxHeadPitch); -+ } -+ -+ @Override -+ public void lookAt(@org.jetbrains.annotations.NotNull org.bukkit.entity.Entity entity) { -+ com.google.common.base.Preconditions.checkNotNull(entity, "entity cannot be null"); -+ com.google.common.base.Preconditions.checkArgument(entity.getWorld().equals(getWorld()), "entity in a different world"); -+ getHandle().getLookControl().lookAt(((CraftEntity) entity).getHandle()); -+ } -+ -+ @Override -+ public void lookAt(@org.jetbrains.annotations.NotNull org.bukkit.entity.Entity entity, float headRotationSpeed, float maxHeadPitch) { -+ com.google.common.base.Preconditions.checkNotNull(entity, "entity cannot be null"); -+ com.google.common.base.Preconditions.checkArgument(entity.getWorld().equals(getWorld()), "entity in a different world"); -+ getHandle().getLookControl().lookAt(((CraftEntity) entity).getHandle(), headRotationSpeed, maxHeadPitch); -+ } -+ -+ @Override -+ public void lookAt(double x, double y, double z) { -+ getHandle().getLookControl().lookAt(x, y, z); -+ } -+ -+ @Override -+ public void lookAt(double x, double y, double z, float headRotationSpeed, float maxHeadPitch) { -+ getHandle().getLookControl().lookAt(x, y, z, headRotationSpeed, maxHeadPitch); -+ } -+ -+ @Override -+ public int getHeadRotationSpeed() { -+ return getHandle().getHeadRotSpeed(); -+ } -+ -+ @Override -+ public int getMaxHeadPitch() { -+ return getHandle().getMaxHeadXRot(); -+ } - // Paper end - } diff --git a/patches/server/0468-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch b/patches/server/0469-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch similarity index 100% rename from patches/server/0468-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch rename to patches/server/0469-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch diff --git a/patches/server/0469-Remove-streams-from-classes-related-villager-gossip.patch b/patches/server/0470-Remove-streams-from-classes-related-villager-gossip.patch similarity index 100% rename from patches/server/0469-Remove-streams-from-classes-related-villager-gossip.patch rename to patches/server/0470-Remove-streams-from-classes-related-villager-gossip.patch diff --git a/patches/server/0470-Support-components-in-ItemMeta.patch b/patches/server/0471-Support-components-in-ItemMeta.patch similarity index 100% rename from patches/server/0470-Support-components-in-ItemMeta.patch rename to patches/server/0471-Support-components-in-ItemMeta.patch diff --git a/patches/server/0471-Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch b/patches/server/0472-Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch similarity index 100% rename from patches/server/0471-Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch rename to patches/server/0472-Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch diff --git a/patches/server/0472-Add-entity-liquid-API.patch b/patches/server/0473-Add-entity-liquid-API.patch similarity index 100% rename from patches/server/0472-Add-entity-liquid-API.patch rename to patches/server/0473-Add-entity-liquid-API.patch diff --git a/patches/server/0473-Update-itemstack-legacy-name-and-lore.patch b/patches/server/0474-Update-itemstack-legacy-name-and-lore.patch similarity index 100% rename from patches/server/0473-Update-itemstack-legacy-name-and-lore.patch rename to patches/server/0474-Update-itemstack-legacy-name-and-lore.patch diff --git a/patches/server/0474-Spawn-player-in-correct-world-on-login.patch b/patches/server/0475-Spawn-player-in-correct-world-on-login.patch similarity index 94% rename from patches/server/0474-Spawn-player-in-correct-world-on-login.patch rename to patches/server/0475-Spawn-player-in-correct-world-on-login.patch index 2de440c5aa..dbde21b12c 100644 --- a/patches/server/0474-Spawn-player-in-correct-world-on-login.patch +++ b/patches/server/0475-Spawn-player-in-correct-world-on-login.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Spawn player in correct world on login diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 7eb3088d47ff78198e01a3a12b0ce6abe9d6ca6b..66735bbc2528c5812c9df14ef7cd91cb69d903b2 100644 +index 9c13479d2a508728c10803dee719ed7ad097e019..56b33bcd93cd4e8b448271edee497b7c3c9b246a 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -193,7 +193,18 @@ public abstract class PlayerList { diff --git a/patches/server/0475-Add-PrepareResultEvent.patch b/patches/server/0476-Add-PrepareResultEvent.patch similarity index 100% rename from patches/server/0475-Add-PrepareResultEvent.patch rename to patches/server/0476-Add-PrepareResultEvent.patch diff --git a/patches/server/0476-Allow-delegation-to-vanilla-chunk-gen.patch b/patches/server/0477-Allow-delegation-to-vanilla-chunk-gen.patch similarity index 100% rename from patches/server/0476-Allow-delegation-to-vanilla-chunk-gen.patch rename to patches/server/0477-Allow-delegation-to-vanilla-chunk-gen.patch diff --git a/patches/server/0477-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch b/patches/server/0478-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch similarity index 100% rename from patches/server/0477-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch rename to patches/server/0478-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch diff --git a/patches/server/0478-Optimize-NetworkManager-Exception-Handling.patch b/patches/server/0479-Optimize-NetworkManager-Exception-Handling.patch similarity index 100% rename from patches/server/0478-Optimize-NetworkManager-Exception-Handling.patch rename to patches/server/0479-Optimize-NetworkManager-Exception-Handling.patch diff --git a/patches/server/0479-Optimize-the-advancement-data-player-iteration-to-be.patch b/patches/server/0480-Optimize-the-advancement-data-player-iteration-to-be.patch similarity index 100% rename from patches/server/0479-Optimize-the-advancement-data-player-iteration-to-be.patch rename to patches/server/0480-Optimize-the-advancement-data-player-iteration-to-be.patch diff --git a/patches/server/0480-Fix-arrows-never-despawning-MC-125757.patch b/patches/server/0481-Fix-arrows-never-despawning-MC-125757.patch similarity index 100% rename from patches/server/0480-Fix-arrows-never-despawning-MC-125757.patch rename to patches/server/0481-Fix-arrows-never-despawning-MC-125757.patch diff --git a/patches/server/0481-Thread-Safe-Vanilla-Command-permission-checking.patch b/patches/server/0482-Thread-Safe-Vanilla-Command-permission-checking.patch similarity index 100% rename from patches/server/0481-Thread-Safe-Vanilla-Command-permission-checking.patch rename to patches/server/0482-Thread-Safe-Vanilla-Command-permission-checking.patch diff --git a/patches/server/0482-Move-range-check-for-block-placing-up.patch b/patches/server/0483-Move-range-check-for-block-placing-up.patch similarity index 94% rename from patches/server/0482-Move-range-check-for-block-placing-up.patch rename to patches/server/0483-Move-range-check-for-block-placing-up.patch index 344b1912e1..4614ed8f8f 100644 --- a/patches/server/0482-Move-range-check-for-block-placing-up.patch +++ b/patches/server/0483-Move-range-check-for-block-placing-up.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Move range check for block placing up diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 39777c2b1bbb12ce3e5be3724235ea0a8072cef8..99a16a2f0c2dc227dd45db1964c2d47ffdcda73e 100644 +index 2b8a9d16add3ac81ede029a909a40feaa07c51d3..afd5f5efdd6b47811fdbc23adeacace594602046 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1693,17 +1693,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1694,17 +1694,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser BlockPos blockposition = movingobjectpositionblock.getBlockPos(); Direction enumdirection = movingobjectpositionblock.getDirection(); diff --git a/patches/server/0483-Fix-SPIGOT-5989.patch b/patches/server/0484-Fix-SPIGOT-5989.patch similarity index 91% rename from patches/server/0483-Fix-SPIGOT-5989.patch rename to patches/server/0484-Fix-SPIGOT-5989.patch index a31cd6ebb9..22c038b591 100644 --- a/patches/server/0483-Fix-SPIGOT-5989.patch +++ b/patches/server/0484-Fix-SPIGOT-5989.patch @@ -10,7 +10,7 @@ This fixes that by checking if the modified spawn location is still at a respawn anchor. diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 66735bbc2528c5812c9df14ef7cd91cb69d903b2..9c594c0f142ca10b7c1df50faf45ccb3f7468ba9 100644 +index 56b33bcd93cd4e8b448271edee497b7c3c9b246a..0528099611eca136722507cacbd8ba6a668778b8 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -77,6 +77,7 @@ import net.minecraft.world.level.GameRules; @@ -21,7 +21,7 @@ index 66735bbc2528c5812c9df14ef7cd91cb69d903b2..9c594c0f142ca10b7c1df50faf45ccb3 import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.border.BorderChangeListener; import net.minecraft.world.level.border.WorldBorder; -@@ -821,6 +822,7 @@ public abstract class PlayerList { +@@ -822,6 +823,7 @@ public abstract class PlayerList { // Paper start boolean isBedSpawn = false; boolean isRespawn = false; @@ -29,7 +29,7 @@ index 66735bbc2528c5812c9df14ef7cd91cb69d903b2..9c594c0f142ca10b7c1df50faf45ccb3 // Paper end // CraftBukkit start - fire PlayerRespawnEvent -@@ -831,7 +833,7 @@ public abstract class PlayerList { +@@ -832,7 +834,7 @@ public abstract class PlayerList { Optional optional; if (blockposition != null) { @@ -38,7 +38,7 @@ index 66735bbc2528c5812c9df14ef7cd91cb69d903b2..9c594c0f142ca10b7c1df50faf45ccb3 } else { optional = Optional.empty(); } -@@ -874,7 +876,12 @@ public abstract class PlayerList { +@@ -875,7 +877,12 @@ public abstract class PlayerList { } // Spigot End @@ -52,7 +52,7 @@ index 66735bbc2528c5812c9df14ef7cd91cb69d903b2..9c594c0f142ca10b7c1df50faf45ccb3 if (!flag) entityplayer.reset(); // SPIGOT-4785 isRespawn = true; // Paper } else { -@@ -911,8 +918,12 @@ public abstract class PlayerList { +@@ -913,8 +920,12 @@ public abstract class PlayerList { } // entityplayer1.syncInventory(); entityplayer1.setHealth(entityplayer1.getHealth()); diff --git a/patches/server/0484-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch b/patches/server/0485-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch similarity index 100% rename from patches/server/0484-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch rename to patches/server/0485-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch diff --git a/patches/server/0485-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch b/patches/server/0486-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch similarity index 100% rename from patches/server/0485-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch rename to patches/server/0486-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch diff --git a/patches/server/0486-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch b/patches/server/0487-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch similarity index 100% rename from patches/server/0486-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch rename to patches/server/0487-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch diff --git a/patches/server/0487-Add-missing-strikeLighting-call-to-World-spigot-stri.patch b/patches/server/0488-Add-missing-strikeLighting-call-to-World-spigot-stri.patch similarity index 82% rename from patches/server/0487-Add-missing-strikeLighting-call-to-World-spigot-stri.patch rename to patches/server/0488-Add-missing-strikeLighting-call-to-World-spigot-stri.patch index 9449b0adec..b1f6784ef3 100644 --- a/patches/server/0487-Add-missing-strikeLighting-call-to-World-spigot-stri.patch +++ b/patches/server/0488-Add-missing-strikeLighting-call-to-World-spigot-stri.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add missing strikeLighting call to diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index f72471ac82907a0d5112598b3289689495285944..d79a711d4080ad8acb2c240870be9d99a0b84cea 100644 +index 29b2f5d3e6fd4859fbe94ad1cd5c355be7f9d4f3..babe877022156adc224643c3d487793bfa43d5ff 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2623,6 +2623,7 @@ public class CraftWorld implements World { +@@ -2627,6 +2627,7 @@ public class CraftWorld implements World { lightning.moveTo( loc.getX(), loc.getY(), loc.getZ() ); lightning.visualOnly = true; lightning.isSilent = isSilent; diff --git a/patches/server/0488-Fix-some-rails-connecting-improperly.patch b/patches/server/0489-Fix-some-rails-connecting-improperly.patch similarity index 100% rename from patches/server/0488-Fix-some-rails-connecting-improperly.patch rename to patches/server/0489-Fix-some-rails-connecting-improperly.patch diff --git a/patches/server/0489-Incremental-player-saving.patch b/patches/server/0490-Incremental-player-saving.patch similarity index 96% rename from patches/server/0489-Incremental-player-saving.patch rename to patches/server/0490-Incremental-player-saving.patch index dae7e913d7..cc01e08383 100644 --- a/patches/server/0489-Incremental-player-saving.patch +++ b/patches/server/0490-Incremental-player-saving.patch @@ -55,7 +55,7 @@ index 1feda8b44364c748497174944b26abc4f058f354..1889de77a5e3d9371005b6bd451e2c0e } // Paper start for (ServerLevel level : this.getAllLevels()) { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index cd34b5aa61c78d8138500a93f0a9714bedd7ed86..b49fa995973f860a95d937c98e2821435262ce25 100644 +index b106a972a76e856d6cdab78dec5daef77b135f98..de50d3de98490b5620a085c1af7fb100b8b8ad99 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -169,6 +169,7 @@ public class ServerPlayer extends Player { @@ -67,7 +67,7 @@ index cd34b5aa61c78d8138500a93f0a9714bedd7ed86..b49fa995973f860a95d937c98e282143 private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10; public ServerGamePacketListenerImpl connection; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 9c594c0f142ca10b7c1df50faf45ccb3f7468ba9..8c62367888af566dd9be4bb5cd301c26e0248e46 100644 +index 0528099611eca136722507cacbd8ba6a668778b8..554da65376a1513af64fee6a958ceaa63c88b552 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -561,6 +561,7 @@ public abstract class PlayerList { @@ -78,7 +78,7 @@ index 9c594c0f142ca10b7c1df50faf45ccb3f7468ba9..8c62367888af566dd9be4bb5cd301c26 this.playerIo.save(player); ServerStatsCounter serverstatisticmanager = (ServerStatsCounter) player.getStats(); // CraftBukkit -@@ -1198,10 +1199,21 @@ public abstract class PlayerList { +@@ -1200,10 +1201,21 @@ public abstract class PlayerList { } public void saveAll() { diff --git a/patches/server/0490-Fix-MC-187716-Use-configured-height.patch b/patches/server/0491-Fix-MC-187716-Use-configured-height.patch similarity index 100% rename from patches/server/0490-Fix-MC-187716-Use-configured-height.patch rename to patches/server/0491-Fix-MC-187716-Use-configured-height.patch diff --git a/patches/server/0491-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch b/patches/server/0492-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch similarity index 100% rename from patches/server/0491-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch rename to patches/server/0492-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch diff --git a/patches/server/0492-Do-not-let-the-server-load-chunks-from-newer-version.patch b/patches/server/0493-Do-not-let-the-server-load-chunks-from-newer-version.patch similarity index 100% rename from patches/server/0492-Do-not-let-the-server-load-chunks-from-newer-version.patch rename to patches/server/0493-Do-not-let-the-server-load-chunks-from-newer-version.patch diff --git a/patches/server/0493-Brand-support.patch b/patches/server/0494-Brand-support.patch similarity index 90% rename from patches/server/0493-Brand-support.patch rename to patches/server/0494-Brand-support.patch index 4ce0bb26ce..148208218a 100644 --- a/patches/server/0493-Brand-support.patch +++ b/patches/server/0494-Brand-support.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Brand support diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 99a16a2f0c2dc227dd45db1964c2d47ffdcda73e..0176b85a031b33cb2a12bb75079f5e3111f4f2b7 100644 +index afd5f5efdd6b47811fdbc23adeacace594602046..30cdacbefb07c7b3e7d64cbb78ff821a5f6c7567 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -4,6 +4,7 @@ import com.google.common.collect.Lists; @@ -33,7 +33,7 @@ index 99a16a2f0c2dc227dd45db1964c2d47ffdcda73e..0176b85a031b33cb2a12bb75079f5e31 public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) { this.server = server; this.connection = connection; -@@ -3000,6 +3004,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3001,6 +3005,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser private static final ResourceLocation CUSTOM_REGISTER = new ResourceLocation("register"); private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister"); @@ -42,7 +42,7 @@ index 99a16a2f0c2dc227dd45db1964c2d47ffdcda73e..0176b85a031b33cb2a12bb75079f5e31 @Override public void handleCustomPayload(ServerboundCustomPayloadPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); -@@ -3027,6 +3033,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3028,6 +3034,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser try { byte[] data = new byte[packet.data.readableBytes()]; packet.data.readBytes(data); @@ -58,7 +58,7 @@ index 99a16a2f0c2dc227dd45db1964c2d47ffdcda73e..0176b85a031b33cb2a12bb75079f5e31 this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data); } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); -@@ -3036,6 +3051,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -3037,6 +3052,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } @@ -72,10 +72,10 @@ index 99a16a2f0c2dc227dd45db1964c2d47ffdcda73e..0176b85a031b33cb2a12bb75079f5e31 return (!this.player.joining && !this.connection.isConnected()) || this.processedDisconnect; // Paper } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 0a6d6ea67eaf8b2a59ec45fb3ffb85096f509997..b277c87c0834ddcefcfaebd85c9e69d8d389b59e 100644 +index e4386cf8bc6170f0c144560905ab285e44ebd5bb..a574848e34a391650efd09e5a5ec010ea5eb769e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2386,6 +2386,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2393,6 +2393,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { // Paper end }; diff --git a/patches/server/0494-Add-setMaxPlayers-API.patch b/patches/server/0495-Add-setMaxPlayers-API.patch similarity index 89% rename from patches/server/0494-Add-setMaxPlayers-API.patch rename to patches/server/0495-Add-setMaxPlayers-API.patch index 92e26244b5..1249b8a981 100644 --- a/patches/server/0494-Add-setMaxPlayers-API.patch +++ b/patches/server/0495-Add-setMaxPlayers-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add #setMaxPlayers API diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 8c62367888af566dd9be4bb5cd301c26e0248e46..2f73f1f770e5e1fa422bec9c27e5bd10e86b7538 100644 +index 554da65376a1513af64fee6a958ceaa63c88b552..c61a4e8e03996487ed3f7f39187d96a866191a41 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -142,7 +142,7 @@ public abstract class PlayerList { @@ -18,7 +18,7 @@ index 8c62367888af566dd9be4bb5cd301c26e0248e46..2f73f1f770e5e1fa422bec9c27e5bd10 private boolean allowCheatsForAllPlayers; private static final boolean ALLOW_LOGOUTIVATOR = false; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index df2c41d18377d8519d5537186d529ecc1901f58a..74de169828d7e1e55d15546eb637a87268610700 100644 +index beb8b7d06ef47c80ede95c884598fedcc7126d67..7795735e5acc3b7b6b71b4e61bdc4bdcb722a7b3 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -616,6 +616,13 @@ public final class CraftServer implements Server { diff --git a/patches/server/0495-Add-playPickupItemAnimation-to-LivingEntity.patch b/patches/server/0496-Add-playPickupItemAnimation-to-LivingEntity.patch similarity index 100% rename from patches/server/0495-Add-playPickupItemAnimation-to-LivingEntity.patch rename to patches/server/0496-Add-playPickupItemAnimation-to-LivingEntity.patch diff --git a/patches/server/0496-Don-t-require-FACING-data.patch b/patches/server/0497-Don-t-require-FACING-data.patch similarity index 100% rename from patches/server/0496-Don-t-require-FACING-data.patch rename to patches/server/0497-Don-t-require-FACING-data.patch diff --git a/patches/server/0497-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch b/patches/server/0498-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch similarity index 96% rename from patches/server/0497-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch rename to patches/server/0498-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch index f5f54e1c8c..744c5321fa 100644 --- a/patches/server/0497-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch +++ b/patches/server/0498-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch @@ -24,7 +24,7 @@ index bdabcdb60dbfb803ead13c42c8dd5e100b37dc00..4ae56444d258cdf44a02256315d6aae8 // if this keepSpawnInMemory is false a plugin has already removed our tickets, do not re-add this.removeTicketsForSpawn(this.paperConfig.keepLoadedRange, prevSpawn); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index d79a711d4080ad8acb2c240870be9d99a0b84cea..4ca674fac0e1ed354a0c49284c21ca2b117dd852 100644 +index babe877022156adc224643c3d487793bfa43d5ff..b24395160c1ea84ed44a1db07b4f024a540ca80b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -386,11 +386,13 @@ public class CraftWorld implements World { diff --git a/patches/server/0498-Add-moon-phase-API.patch b/patches/server/0499-Add-moon-phase-API.patch similarity index 89% rename from patches/server/0498-Add-moon-phase-API.patch rename to patches/server/0499-Add-moon-phase-API.patch index e6c06c4be3..884806ab13 100644 --- a/patches/server/0498-Add-moon-phase-API.patch +++ b/patches/server/0499-Add-moon-phase-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add moon phase API diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 4ca674fac0e1ed354a0c49284c21ca2b117dd852..d0b2de0f0a37554eb812aa8c7c20f1067807dc40 100644 +index b24395160c1ea84ed44a1db07b4f024a540ca80b..b373e72237cc33a628648de515b163d8ce2980fb 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -325,6 +325,11 @@ public class CraftWorld implements World { diff --git a/patches/server/0499-Prevent-headless-pistons-from-being-created.patch b/patches/server/0500-Prevent-headless-pistons-from-being-created.patch similarity index 100% rename from patches/server/0499-Prevent-headless-pistons-from-being-created.patch rename to patches/server/0500-Prevent-headless-pistons-from-being-created.patch diff --git a/patches/server/0500-Add-BellRingEvent.patch b/patches/server/0501-Add-BellRingEvent.patch similarity index 100% rename from patches/server/0500-Add-BellRingEvent.patch rename to patches/server/0501-Add-BellRingEvent.patch diff --git a/patches/server/0501-Add-zombie-targets-turtle-egg-config.patch b/patches/server/0502-Add-zombie-targets-turtle-egg-config.patch similarity index 100% rename from patches/server/0501-Add-zombie-targets-turtle-egg-config.patch rename to patches/server/0502-Add-zombie-targets-turtle-egg-config.patch diff --git a/patches/server/0502-Buffer-joins-to-world.patch b/patches/server/0503-Buffer-joins-to-world.patch similarity index 100% rename from patches/server/0502-Buffer-joins-to-world.patch rename to patches/server/0503-Buffer-joins-to-world.patch diff --git a/patches/server/0503-Optimize-redstone-algorithm.patch b/patches/server/0504-Optimize-redstone-algorithm.patch similarity index 100% rename from patches/server/0503-Optimize-redstone-algorithm.patch rename to patches/server/0504-Optimize-redstone-algorithm.patch diff --git a/patches/server/0504-Fix-hex-colors-not-working-in-some-kick-messages.patch b/patches/server/0505-Fix-hex-colors-not-working-in-some-kick-messages.patch similarity index 100% rename from patches/server/0504-Fix-hex-colors-not-working-in-some-kick-messages.patch rename to patches/server/0505-Fix-hex-colors-not-working-in-some-kick-messages.patch diff --git a/patches/server/0505-PortalCreateEvent-needs-to-know-its-entity.patch b/patches/server/0506-PortalCreateEvent-needs-to-know-its-entity.patch similarity index 100% rename from patches/server/0505-PortalCreateEvent-needs-to-know-its-entity.patch rename to patches/server/0506-PortalCreateEvent-needs-to-know-its-entity.patch diff --git a/patches/server/0506-Fix-CraftTeam-null-check.patch b/patches/server/0507-Fix-CraftTeam-null-check.patch similarity index 100% rename from patches/server/0506-Fix-CraftTeam-null-check.patch rename to patches/server/0507-Fix-CraftTeam-null-check.patch diff --git a/patches/server/0507-Add-more-Evoker-API.patch b/patches/server/0508-Add-more-Evoker-API.patch similarity index 100% rename from patches/server/0507-Add-more-Evoker-API.patch rename to patches/server/0508-Add-more-Evoker-API.patch diff --git a/patches/server/0508-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch b/patches/server/0509-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch similarity index 100% rename from patches/server/0508-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch rename to patches/server/0509-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch diff --git a/patches/server/0509-Create-HoverEvent-from-ItemStack-Entity.patch b/patches/server/0510-Create-HoverEvent-from-ItemStack-Entity.patch similarity index 100% rename from patches/server/0509-Create-HoverEvent-from-ItemStack-Entity.patch rename to patches/server/0510-Create-HoverEvent-from-ItemStack-Entity.patch diff --git a/patches/server/0510-Cache-block-data-strings.patch b/patches/server/0511-Cache-block-data-strings.patch similarity index 100% rename from patches/server/0510-Cache-block-data-strings.patch rename to patches/server/0511-Cache-block-data-strings.patch diff --git a/patches/server/0511-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch b/patches/server/0512-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch similarity index 97% rename from patches/server/0511-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch rename to patches/server/0512-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch index 403e8d2e60..dd9aef6436 100644 --- a/patches/server/0511-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch +++ b/patches/server/0512-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch @@ -9,7 +9,7 @@ as this is how Vanilla teleports entities. Cancel any pending motion when teleported. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 0176b85a031b33cb2a12bb75079f5e3111f4f2b7..e3725db7e19fe3235ec25beffca26a7eede24394 100644 +index 30cdacbefb07c7b3e7d64cbb78ff821a5f6c7567..1a085522026d6a7d549ca9975e02336bcd495aa4 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -682,7 +682,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -27,9 +27,9 @@ index 0176b85a031b33cb2a12bb75079f5e3111f4f2b7..e3725db7e19fe3235ec25beffca26a7e this.awaitingTeleportTime = this.tickCount; - this.player.absMoveTo(d0, d1, d2, f, f1); + this.player.moveTo(d0, d1, d2, f, f1); // Paper - use proper setPositionRotation for teleportation + this.player.forceCheckHighPriority(); // Paper this.player.connection.send(new ClientboundPlayerPositionPacket(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport, flag)); } - diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 466de2bbdbf0c9e3ed28ec8fee5fcfeb75c54398..a9c90e41af1cc67a88a639dc795dd8023a7acb89 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/patches/server/0512-Add-additional-open-container-api-to-HumanEntity.patch b/patches/server/0513-Add-additional-open-container-api-to-HumanEntity.patch similarity index 100% rename from patches/server/0512-Add-additional-open-container-api-to-HumanEntity.patch rename to patches/server/0513-Add-additional-open-container-api-to-HumanEntity.patch diff --git a/patches/server/0513-Cache-DataFixerUpper-Rewrite-Rules-on-demand.patch b/patches/server/0514-Cache-DataFixerUpper-Rewrite-Rules-on-demand.patch similarity index 100% rename from patches/server/0513-Cache-DataFixerUpper-Rewrite-Rules-on-demand.patch rename to patches/server/0514-Cache-DataFixerUpper-Rewrite-Rules-on-demand.patch diff --git a/patches/server/0514-Extend-block-drop-capture-to-capture-all-items-added.patch b/patches/server/0515-Extend-block-drop-capture-to-capture-all-items-added.patch similarity index 100% rename from patches/server/0514-Extend-block-drop-capture-to-capture-all-items-added.patch rename to patches/server/0515-Extend-block-drop-capture-to-capture-all-items-added.patch diff --git a/patches/server/0515-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch b/patches/server/0516-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch similarity index 84% rename from patches/server/0515-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch rename to patches/server/0516-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch index 6f969d64c5..f2b384b6a9 100644 --- a/patches/server/0515-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch +++ b/patches/server/0516-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't mark dirty in invalid locations (SPIGOT-6086) diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 1f67c9c5f7161ea687983e7ae0ec7d259da9acd3..1f5086a18b9c1c65dc2b09f44ed7c561ba96a847 100644 +index 6a1c000d693031f0c537112963cfa52e22463f1d..506b1b9d09a0e5a26fdac0192405e8b325ce97c9 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java -@@ -246,6 +246,7 @@ public class ChunkHolder { +@@ -372,6 +372,7 @@ public class ChunkHolder { } public void blockChanged(BlockPos pos) { diff --git a/patches/server/0516-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/patches/server/0517-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch similarity index 100% rename from patches/server/0516-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch rename to patches/server/0517-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch diff --git a/patches/server/0517-Lazily-track-plugin-scoreboards-by-default.patch b/patches/server/0518-Lazily-track-plugin-scoreboards-by-default.patch similarity index 100% rename from patches/server/0517-Lazily-track-plugin-scoreboards-by-default.patch rename to patches/server/0518-Lazily-track-plugin-scoreboards-by-default.patch diff --git a/patches/server/0518-Entity-isTicking.patch b/patches/server/0519-Entity-isTicking.patch similarity index 100% rename from patches/server/0518-Entity-isTicking.patch rename to patches/server/0519-Entity-isTicking.patch diff --git a/patches/server/0519-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch b/patches/server/0520-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch similarity index 100% rename from patches/server/0519-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch rename to patches/server/0520-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch diff --git a/patches/server/0520-Fix-CME-on-adding-a-passenger-in-CreatureSpawnEvent.patch b/patches/server/0521-Fix-CME-on-adding-a-passenger-in-CreatureSpawnEvent.patch similarity index 100% rename from patches/server/0520-Fix-CME-on-adding-a-passenger-in-CreatureSpawnEvent.patch rename to patches/server/0521-Fix-CME-on-adding-a-passenger-in-CreatureSpawnEvent.patch diff --git a/patches/server/0521-Reset-Ender-Crystals-on-Dragon-Spawn.patch b/patches/server/0522-Reset-Ender-Crystals-on-Dragon-Spawn.patch similarity index 100% rename from patches/server/0521-Reset-Ender-Crystals-on-Dragon-Spawn.patch rename to patches/server/0522-Reset-Ender-Crystals-on-Dragon-Spawn.patch diff --git a/patches/server/0522-Fix-for-large-move-vectors-crashing-server.patch b/patches/server/0523-Fix-for-large-move-vectors-crashing-server.patch similarity index 97% rename from patches/server/0522-Fix-for-large-move-vectors-crashing-server.patch rename to patches/server/0523-Fix-for-large-move-vectors-crashing-server.patch index 6aa61b9e81..a1a4688c67 100644 --- a/patches/server/0522-Fix-for-large-move-vectors-crashing-server.patch +++ b/patches/server/0523-Fix-for-large-move-vectors-crashing-server.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix for large move vectors crashing server Check movement distance also based on current position. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index e3725db7e19fe3235ec25beffca26a7eede24394..0e0d6d298caa1bbb6fb0dd42fd00460f7609c431 100644 +index 1a085522026d6a7d549ca9975e02336bcd495aa4..1fffa32bd193fa122c7f7b5381f57975c2e895fe 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -507,19 +507,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser diff --git a/patches/server/0523-Optimise-getType-calls.patch b/patches/server/0524-Optimise-getType-calls.patch similarity index 100% rename from patches/server/0523-Optimise-getType-calls.patch rename to patches/server/0524-Optimise-getType-calls.patch diff --git a/patches/server/0524-Villager-resetOffers.patch b/patches/server/0525-Villager-resetOffers.patch similarity index 100% rename from patches/server/0524-Villager-resetOffers.patch rename to patches/server/0525-Villager-resetOffers.patch diff --git a/patches/server/0525-Improve-inlinig-for-some-hot-IBlockData-methods.patch b/patches/server/0526-Improve-inlinig-for-some-hot-IBlockData-methods.patch similarity index 100% rename from patches/server/0525-Improve-inlinig-for-some-hot-IBlockData-methods.patch rename to patches/server/0526-Improve-inlinig-for-some-hot-IBlockData-methods.patch diff --git a/patches/server/0526-Retain-block-place-order-when-capturing-blockstates.patch b/patches/server/0527-Retain-block-place-order-when-capturing-blockstates.patch similarity index 100% rename from patches/server/0526-Retain-block-place-order-when-capturing-blockstates.patch rename to patches/server/0527-Retain-block-place-order-when-capturing-blockstates.patch diff --git a/patches/server/0527-Reduce-blockpos-allocation-from-pathfinding.patch b/patches/server/0528-Reduce-blockpos-allocation-from-pathfinding.patch similarity index 100% rename from patches/server/0527-Reduce-blockpos-allocation-from-pathfinding.patch rename to patches/server/0528-Reduce-blockpos-allocation-from-pathfinding.patch diff --git a/patches/server/0528-Fix-item-locations-dropped-from-campfires.patch b/patches/server/0529-Fix-item-locations-dropped-from-campfires.patch similarity index 100% rename from patches/server/0528-Fix-item-locations-dropped-from-campfires.patch rename to patches/server/0529-Fix-item-locations-dropped-from-campfires.patch diff --git a/patches/server/0529-Player-elytra-boost-API.patch b/patches/server/0530-Player-elytra-boost-API.patch similarity index 94% rename from patches/server/0529-Player-elytra-boost-API.patch rename to patches/server/0530-Player-elytra-boost-API.patch index 3bae46ddd3..5882c85691 100644 --- a/patches/server/0529-Player-elytra-boost-API.patch +++ b/patches/server/0530-Player-elytra-boost-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Player elytra boost API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index b277c87c0834ddcefcfaebd85c9e69d8d389b59e..41bb480e61ff98dd35b8e059356bf867406e9e5e 100644 +index a574848e34a391650efd09e5a5ec010ea5eb769e..776c79ff21ddd1e3a3644104ae91f15c119acd29 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -534,6 +534,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0530-Fixed-TileEntityBell-memory-leak.patch b/patches/server/0531-Fixed-TileEntityBell-memory-leak.patch similarity index 100% rename from patches/server/0530-Fixed-TileEntityBell-memory-leak.patch rename to patches/server/0531-Fixed-TileEntityBell-memory-leak.patch diff --git a/patches/server/0531-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch b/patches/server/0532-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch similarity index 100% rename from patches/server/0531-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch rename to patches/server/0532-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch diff --git a/patches/server/0532-Add-getOfflinePlayerIfCached-String.patch b/patches/server/0533-Add-getOfflinePlayerIfCached-String.patch similarity index 100% rename from patches/server/0532-Add-getOfflinePlayerIfCached-String.patch rename to patches/server/0533-Add-getOfflinePlayerIfCached-String.patch diff --git a/patches/server/0533-Add-ignore-discounts-API.patch b/patches/server/0534-Add-ignore-discounts-API.patch similarity index 100% rename from patches/server/0533-Add-ignore-discounts-API.patch rename to patches/server/0534-Add-ignore-discounts-API.patch diff --git a/patches/server/0534-Toggle-for-removing-existing-dragon.patch b/patches/server/0535-Toggle-for-removing-existing-dragon.patch similarity index 100% rename from patches/server/0534-Toggle-for-removing-existing-dragon.patch rename to patches/server/0535-Toggle-for-removing-existing-dragon.patch diff --git a/patches/server/0535-Fix-client-lag-on-advancement-loading.patch b/patches/server/0536-Fix-client-lag-on-advancement-loading.patch similarity index 100% rename from patches/server/0535-Fix-client-lag-on-advancement-loading.patch rename to patches/server/0536-Fix-client-lag-on-advancement-loading.patch diff --git a/patches/server/0536-Item-no-age-no-player-pickup.patch b/patches/server/0537-Item-no-age-no-player-pickup.patch similarity index 100% rename from patches/server/0536-Item-no-age-no-player-pickup.patch rename to patches/server/0537-Item-no-age-no-player-pickup.patch diff --git a/patches/server/0537-Beacon-API-custom-effect-ranges.patch b/patches/server/0538-Beacon-API-custom-effect-ranges.patch similarity index 100% rename from patches/server/0537-Beacon-API-custom-effect-ranges.patch rename to patches/server/0538-Beacon-API-custom-effect-ranges.patch diff --git a/patches/server/0538-Add-API-for-quit-reason.patch b/patches/server/0539-Add-API-for-quit-reason.patch similarity index 93% rename from patches/server/0538-Add-API-for-quit-reason.patch rename to patches/server/0539-Add-API-for-quit-reason.patch index 4e5d931b12..dd04749f87 100644 --- a/patches/server/0538-Add-API-for-quit-reason.patch +++ b/patches/server/0539-Add-API-for-quit-reason.patch @@ -25,10 +25,10 @@ index d32b96a5f51d745869cfc40c01c54de58e1eb843..759e563d1ed13249fada8a8eab6b6a10 Connection.LOGGER.debug("Failed to sent packet", throwable); ConnectionProtocol enumprotocol = this.getCurrentProtocol(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index b49fa995973f860a95d937c98e2821435262ce25..41e6164fc9f3aa54028e5db1331df743126e55e2 100644 +index de50d3de98490b5620a085c1af7fb100b8b8ad99..2be97d1024b15691fb2aaa8516d6447f47da4937 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -248,6 +248,7 @@ public class ServerPlayer extends Player { +@@ -254,6 +254,7 @@ public class ServerPlayer extends Player { public double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper boolean needsChunkCenterUpdate; // Paper - no-tick view distance @@ -37,7 +37,7 @@ index b49fa995973f860a95d937c98e2821435262ce25..41e6164fc9f3aa54028e5db1331df743 public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) { super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 0e0d6d298caa1bbb6fb0dd42fd00460f7609c431..fa57095f0ddd5685f848ade5c0ec2e90e2a07e91 100644 +index 1fffa32bd193fa122c7f7b5381f57975c2e895fe..c495525da3dda12977d70ea85c87701988aa5929 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -444,6 +444,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -49,7 +49,7 @@ index 0e0d6d298caa1bbb6fb0dd42fd00460f7609c431..fa57095f0ddd5685f848ade5c0ec2e90 this.connection.disconnect(ichatbasecomponent); }); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 2f73f1f770e5e1fa422bec9c27e5bd10e86b7538..fe548b8625a123798f8d966cb3bffd899971cb34 100644 +index c61a4e8e03996487ed3f7f39187d96a866191a41..1c61fd2c2c5cf5344f8c6dc14ae01353810de9eb 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -588,7 +588,7 @@ public abstract class PlayerList { diff --git a/patches/server/0539-Seed-based-feature-search.patch b/patches/server/0540-Seed-based-feature-search.patch similarity index 100% rename from patches/server/0539-Seed-based-feature-search.patch rename to patches/server/0540-Seed-based-feature-search.patch diff --git a/patches/server/0540-Add-Wandering-Trader-spawn-rate-config-options.patch b/patches/server/0541-Add-Wandering-Trader-spawn-rate-config-options.patch similarity index 100% rename from patches/server/0540-Add-Wandering-Trader-spawn-rate-config-options.patch rename to patches/server/0541-Add-Wandering-Trader-spawn-rate-config-options.patch diff --git a/patches/server/0541-Significantly-improve-performance-of-the-end-generat.patch b/patches/server/0542-Significantly-improve-performance-of-the-end-generat.patch similarity index 96% rename from patches/server/0541-Significantly-improve-performance-of-the-end-generat.patch rename to patches/server/0542-Significantly-improve-performance-of-the-end-generat.patch index 3117923e3f..a6386a6a1c 100644 --- a/patches/server/0541-Significantly-improve-performance-of-the-end-generat.patch +++ b/patches/server/0542-Significantly-improve-performance-of-the-end-generat.patch @@ -12,7 +12,7 @@ Co-authored-by: Dylan Xaldin Co-authored-by: pop4959 diff --git a/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java b/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java -index 9a64ab092ac8616ed8b9ea5c1e8677dda5c4333c..b4bc60b9251a141e9a276877a9be76a381ff351b 100644 +index 9a64ab092ac8616ed8b9ea5c1e8677dda5c4333c..3f7c4e0938933705ac1bcb8dd676d018088a831a 100644 --- a/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java +++ b/src/main/java/net/minecraft/world/level/biome/TheEndBiomeSource.java @@ -28,6 +28,16 @@ public class TheEndBiomeSource extends BiomeSource { @@ -44,7 +44,7 @@ index 9a64ab092ac8616ed8b9ea5c1e8677dda5c4333c..b4bc60b9251a141e9a276877a9be76a3 - if (q * q + r * r > 4096L && simplexNoise.getValue((double)q, (double)r) < (double)-0.9F) { - float g = (Mth.abs((float)q) * 3439.0F + Mth.abs((float)r) * 147.0F) % 13.0F + 9.0F; + // Paper start - Significantly improve end generation performance by using a noise cache -+ long key = net.minecraft.world.level.ChunkPos.asLong((int) q, (int) q); ++ long key = net.minecraft.world.level.ChunkPos.asLong((int) q, (int) r); + int index = (int) it.unimi.dsi.fastutil.HashCommon.mix(key) & 8191; + float g = Float.MIN_VALUE; + if (cache.keys[index] == key) { diff --git a/patches/server/0542-Expose-world-spawn-angle.patch b/patches/server/0543-Expose-world-spawn-angle.patch similarity index 88% rename from patches/server/0542-Expose-world-spawn-angle.patch rename to patches/server/0543-Expose-world-spawn-angle.patch index 419b678486..38e827eec1 100644 --- a/patches/server/0542-Expose-world-spawn-angle.patch +++ b/patches/server/0543-Expose-world-spawn-angle.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose world spawn angle diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index fe548b8625a123798f8d966cb3bffd899971cb34..ce6d9b460f0f55fc6d5544d5c8d2b78e5fcc3937 100644 +index 1c61fd2c2c5cf5344f8c6dc14ae01353810de9eb..720fa2b74d3f9257a32e4bd5d21050626d136668 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -865,7 +865,7 @@ public abstract class PlayerList { +@@ -866,7 +866,7 @@ public abstract class PlayerList { if (location == null) { worldserver1 = this.server.getLevel(Level.OVERWORLD); blockposition = entityplayer1.getSpawnPoint(worldserver1); @@ -18,7 +18,7 @@ index fe548b8625a123798f8d966cb3bffd899971cb34..ce6d9b460f0f55fc6d5544d5c8d2b78e Player respawnPlayer = this.cserver.getPlayer(entityplayer1); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index d0b2de0f0a37554eb812aa8c7c20f1067807dc40..ed8c8b7ff07a58dfaf7bbb1e630a1e68cc0c29f3 100644 +index b373e72237cc33a628648de515b163d8ce2980fb..8257e5a648eebf8ac9fa1a15656643a448cf07b6 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -377,7 +377,7 @@ public class CraftWorld implements World { diff --git a/patches/server/0543-Add-Destroy-Speed-API.patch b/patches/server/0544-Add-Destroy-Speed-API.patch similarity index 100% rename from patches/server/0543-Add-Destroy-Speed-API.patch rename to patches/server/0544-Add-Destroy-Speed-API.patch diff --git a/patches/server/0544-Fix-Player-spawnParticle-x-y-z-precision-loss.patch b/patches/server/0545-Fix-Player-spawnParticle-x-y-z-precision-loss.patch similarity index 89% rename from patches/server/0544-Fix-Player-spawnParticle-x-y-z-precision-loss.patch rename to patches/server/0545-Fix-Player-spawnParticle-x-y-z-precision-loss.patch index e4450be6cf..693e824d57 100644 --- a/patches/server/0544-Fix-Player-spawnParticle-x-y-z-precision-loss.patch +++ b/patches/server/0545-Fix-Player-spawnParticle-x-y-z-precision-loss.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix Player spawnParticle x/y/z precision loss diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 41bb480e61ff98dd35b8e059356bf867406e9e5e..9236027beb13ae4f2e35c46f6c176fd5d7d20b4f 100644 +index 776c79ff21ddd1e3a3644104ae91f15c119acd29..0f832a1cec5dbe3f4fb8638af2ea1dc129ea5970 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2047,7 +2047,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2054,7 +2054,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { if (data != null && !particle.getDataType().isInstance(data)) { throw new IllegalArgumentException("data should be " + particle.getDataType() + " got " + data.getClass()); } diff --git a/patches/server/0545-Add-LivingEntity-clearActiveItem.patch b/patches/server/0546-Add-LivingEntity-clearActiveItem.patch similarity index 100% rename from patches/server/0545-Add-LivingEntity-clearActiveItem.patch rename to patches/server/0546-Add-LivingEntity-clearActiveItem.patch diff --git a/patches/server/0546-Add-PlayerItemCooldownEvent.patch b/patches/server/0547-Add-PlayerItemCooldownEvent.patch similarity index 100% rename from patches/server/0546-Add-PlayerItemCooldownEvent.patch rename to patches/server/0547-Add-PlayerItemCooldownEvent.patch diff --git a/patches/server/0547-More-lightning-API.patch b/patches/server/0548-More-lightning-API.patch similarity index 100% rename from patches/server/0547-More-lightning-API.patch rename to patches/server/0548-More-lightning-API.patch diff --git a/patches/server/0548-Climbing-should-not-bypass-cramming-gamerule.patch b/patches/server/0549-Climbing-should-not-bypass-cramming-gamerule.patch similarity index 100% rename from patches/server/0548-Climbing-should-not-bypass-cramming-gamerule.patch rename to patches/server/0549-Climbing-should-not-bypass-cramming-gamerule.patch diff --git a/patches/server/0549-Added-missing-default-perms-for-commands.patch b/patches/server/0550-Added-missing-default-perms-for-commands.patch similarity index 100% rename from patches/server/0549-Added-missing-default-perms-for-commands.patch rename to patches/server/0550-Added-missing-default-perms-for-commands.patch diff --git a/patches/server/0550-Add-PlayerShearBlockEvent.patch b/patches/server/0551-Add-PlayerShearBlockEvent.patch similarity index 100% rename from patches/server/0550-Add-PlayerShearBlockEvent.patch rename to patches/server/0551-Add-PlayerShearBlockEvent.patch diff --git a/patches/server/0551-Set-spigots-verbose-world-setting-to-false-by-def.patch b/patches/server/0552-Set-spigots-verbose-world-setting-to-false-by-def.patch similarity index 100% rename from patches/server/0551-Set-spigots-verbose-world-setting-to-false-by-def.patch rename to patches/server/0552-Set-spigots-verbose-world-setting-to-false-by-def.patch diff --git a/patches/server/0552-Fix-curing-zombie-villager-discount-exploit.patch b/patches/server/0553-Fix-curing-zombie-villager-discount-exploit.patch similarity index 100% rename from patches/server/0552-Fix-curing-zombie-villager-discount-exploit.patch rename to patches/server/0553-Fix-curing-zombie-villager-discount-exploit.patch diff --git a/patches/server/0553-Limit-recipe-packets.patch b/patches/server/0554-Limit-recipe-packets.patch similarity index 95% rename from patches/server/0553-Limit-recipe-packets.patch rename to patches/server/0554-Limit-recipe-packets.patch index 8f746a55f1..261cfcff49 100644 --- a/patches/server/0553-Limit-recipe-packets.patch +++ b/patches/server/0554-Limit-recipe-packets.patch @@ -23,7 +23,7 @@ index 7d50aded88f5b7dfebaea1aebc86231f7b5c4e25..652d87fc5d566dba8018c81676329f0e public static boolean velocityOnlineMode; public static byte[] velocitySecretKey; diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index fa57095f0ddd5685f848ade5c0ec2e90e2a07e91..309b8e193ec67df0379d65ce77a2a095702fd024 100644 +index c495525da3dda12977d70ea85c87701988aa5929..2a1c524941e50d6a16076f57460d0cb05ed57f7c 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -232,6 +232,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -42,7 +42,7 @@ index fa57095f0ddd5685f848ade5c0ec2e90e2a07e91..309b8e193ec67df0379d65ce77a2a095 /* Use thread-safe field access instead if (this.chatSpamTickCount > 0) { --this.chatSpamTickCount; -@@ -2794,6 +2796,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2795,6 +2797,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @Override public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) { diff --git a/patches/server/0554-Fix-CraftSound-backwards-compatibility.patch b/patches/server/0555-Fix-CraftSound-backwards-compatibility.patch similarity index 100% rename from patches/server/0554-Fix-CraftSound-backwards-compatibility.patch rename to patches/server/0555-Fix-CraftSound-backwards-compatibility.patch diff --git a/patches/server/0555-MC-4-Fix-item-position-desync.patch b/patches/server/0556-MC-4-Fix-item-position-desync.patch similarity index 100% rename from patches/server/0555-MC-4-Fix-item-position-desync.patch rename to patches/server/0556-MC-4-Fix-item-position-desync.patch diff --git a/patches/server/0556-Player-Chunk-Load-Unload-Events.patch b/patches/server/0557-Player-Chunk-Load-Unload-Events.patch similarity index 90% rename from patches/server/0556-Player-Chunk-Load-Unload-Events.patch rename to patches/server/0557-Player-Chunk-Load-Unload-Events.patch index 9adb124224..54e121ece4 100644 --- a/patches/server/0556-Player-Chunk-Load-Unload-Events.patch +++ b/patches/server/0557-Player-Chunk-Load-Unload-Events.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Player Chunk Load/Unload Events diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 41e6164fc9f3aa54028e5db1331df743126e55e2..5a87875b03740053d8cde6d81c57703d0b0ef57e 100644 +index 2be97d1024b15691fb2aaa8516d6447f47da4937..f412f3b9f3af498b9ced4a808849442efad01b69 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -2065,11 +2065,21 @@ public class ServerPlayer extends Player { +@@ -2087,11 +2087,21 @@ public class ServerPlayer extends Player { public void trackChunk(ChunkPos chunkcoordintpair, Packet packet, Packet packet1) { this.connection.send(packet1); this.connection.send(packet); diff --git a/patches/server/0557-Optimize-Dynamic-get-Missing-Keys.patch b/patches/server/0558-Optimize-Dynamic-get-Missing-Keys.patch similarity index 100% rename from patches/server/0557-Optimize-Dynamic-get-Missing-Keys.patch rename to patches/server/0558-Optimize-Dynamic-get-Missing-Keys.patch diff --git a/patches/server/0558-Expose-LivingEntity-hurt-direction.patch b/patches/server/0559-Expose-LivingEntity-hurt-direction.patch similarity index 100% rename from patches/server/0558-Expose-LivingEntity-hurt-direction.patch rename to patches/server/0559-Expose-LivingEntity-hurt-direction.patch diff --git a/patches/server/0559-Add-OBSTRUCTED-reason-to-BedEnterResult.patch b/patches/server/0560-Add-OBSTRUCTED-reason-to-BedEnterResult.patch similarity index 100% rename from patches/server/0559-Add-OBSTRUCTED-reason-to-BedEnterResult.patch rename to patches/server/0560-Add-OBSTRUCTED-reason-to-BedEnterResult.patch diff --git a/patches/server/0560-Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch b/patches/server/0561-Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch similarity index 100% rename from patches/server/0560-Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch rename to patches/server/0561-Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch diff --git a/patches/server/0561-added-PlayerTradeEvent.patch b/patches/server/0562-added-PlayerTradeEvent.patch similarity index 100% rename from patches/server/0561-added-PlayerTradeEvent.patch rename to patches/server/0562-added-PlayerTradeEvent.patch diff --git a/patches/server/0562-Implement-TargetHitEvent.patch b/patches/server/0563-Implement-TargetHitEvent.patch similarity index 100% rename from patches/server/0562-Implement-TargetHitEvent.patch rename to patches/server/0563-Implement-TargetHitEvent.patch diff --git a/patches/server/0563-Additional-Block-Material-API-s.patch b/patches/server/0564-Additional-Block-Material-API-s.patch similarity index 100% rename from patches/server/0563-Additional-Block-Material-API-s.patch rename to patches/server/0564-Additional-Block-Material-API-s.patch diff --git a/patches/server/0564-Fix-harming-potion-dupe.patch b/patches/server/0565-Fix-harming-potion-dupe.patch similarity index 100% rename from patches/server/0564-Fix-harming-potion-dupe.patch rename to patches/server/0565-Fix-harming-potion-dupe.patch diff --git a/patches/server/0565-Implement-API-to-get-Material-from-Boats-and-Minecar.patch b/patches/server/0566-Implement-API-to-get-Material-from-Boats-and-Minecar.patch similarity index 100% rename from patches/server/0565-Implement-API-to-get-Material-from-Boats-and-Minecar.patch rename to patches/server/0566-Implement-API-to-get-Material-from-Boats-and-Minecar.patch diff --git a/patches/server/0566-Cache-burn-durations.patch b/patches/server/0567-Cache-burn-durations.patch similarity index 100% rename from patches/server/0566-Cache-burn-durations.patch rename to patches/server/0567-Cache-burn-durations.patch diff --git a/patches/server/0567-Allow-disabling-mob-spawner-spawn-egg-transformation.patch b/patches/server/0568-Allow-disabling-mob-spawner-spawn-egg-transformation.patch similarity index 100% rename from patches/server/0567-Allow-disabling-mob-spawner-spawn-egg-transformation.patch rename to patches/server/0568-Allow-disabling-mob-spawner-spawn-egg-transformation.patch diff --git a/patches/server/0568-Implement-PlayerFlowerPotManipulateEvent.patch b/patches/server/0569-Implement-PlayerFlowerPotManipulateEvent.patch similarity index 100% rename from patches/server/0568-Implement-PlayerFlowerPotManipulateEvent.patch rename to patches/server/0569-Implement-PlayerFlowerPotManipulateEvent.patch diff --git a/patches/server/0569-Fix-interact-event-not-being-called-in-adventure.patch b/patches/server/0570-Fix-interact-event-not-being-called-in-adventure.patch similarity index 90% rename from patches/server/0569-Fix-interact-event-not-being-called-in-adventure.patch rename to patches/server/0570-Fix-interact-event-not-being-called-in-adventure.patch index cc7e10b0fd..df7ae51e70 100644 --- a/patches/server/0569-Fix-interact-event-not-being-called-in-adventure.patch +++ b/patches/server/0570-Fix-interact-event-not-being-called-in-adventure.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix interact event not being called in adventure Call PlayerInteractEvent when left-clicking on a block in adventure mode diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 309b8e193ec67df0379d65ce77a2a095702fd024..df80023e43e7872e32e7b958ea0a5e82d86d43f7 100644 +index 2a1c524941e50d6a16076f57460d0cb05ed57f7c..8051cc5950b71f284e7ad8be685977fd098fe022 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1733,7 +1733,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -1734,7 +1734,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser MutableComponent ichatmutablecomponent = (new TranslatableComponent("build.tooHigh", new Object[]{i - 1})).withStyle(ChatFormatting.RED); this.player.sendMessage((Component) ichatmutablecomponent, ChatType.GAME_INFO, Util.NIL_UUID); @@ -18,7 +18,7 @@ index 309b8e193ec67df0379d65ce77a2a095702fd024..df80023e43e7872e32e7b958ea0a5e82 this.player.swing(enumhand, true); } } -@@ -2205,7 +2205,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2206,7 +2206,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser Vec3 vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); HitResult movingobjectposition = this.player.level.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.player)); diff --git a/patches/server/0570-Zombie-API-breaking-doors.patch b/patches/server/0571-Zombie-API-breaking-doors.patch similarity index 100% rename from patches/server/0570-Zombie-API-breaking-doors.patch rename to patches/server/0571-Zombie-API-breaking-doors.patch diff --git a/patches/server/0571-Fix-nerfed-slime-when-splitting.patch b/patches/server/0572-Fix-nerfed-slime-when-splitting.patch similarity index 100% rename from patches/server/0571-Fix-nerfed-slime-when-splitting.patch rename to patches/server/0572-Fix-nerfed-slime-when-splitting.patch diff --git a/patches/server/0572-Add-EntityLoadCrossbowEvent.patch b/patches/server/0573-Add-EntityLoadCrossbowEvent.patch similarity index 100% rename from patches/server/0572-Add-EntityLoadCrossbowEvent.patch rename to patches/server/0573-Add-EntityLoadCrossbowEvent.patch diff --git a/patches/server/0573-Guardian-beam-workaround.patch b/patches/server/0574-Guardian-beam-workaround.patch similarity index 100% rename from patches/server/0573-Guardian-beam-workaround.patch rename to patches/server/0574-Guardian-beam-workaround.patch diff --git a/patches/server/0574-Added-WorldGameRuleChangeEvent.patch b/patches/server/0575-Added-WorldGameRuleChangeEvent.patch similarity index 98% rename from patches/server/0574-Added-WorldGameRuleChangeEvent.patch rename to patches/server/0575-Added-WorldGameRuleChangeEvent.patch index ba44871043..5b055df691 100644 --- a/patches/server/0574-Added-WorldGameRuleChangeEvent.patch +++ b/patches/server/0575-Added-WorldGameRuleChangeEvent.patch @@ -64,7 +64,7 @@ index 888d812118c15c212284687ae5842a94f5715d52..e7ca5d6fb8922e7e8065864f736b0605 public int get() { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index ed8c8b7ff07a58dfaf7bbb1e630a1e68cc0c29f3..fd01fc9708a62df9483c88ffeec6a0304f3708ca 100644 +index 8257e5a648eebf8ac9fa1a15656643a448cf07b6..c36a9eedaa587d513a3be78054d15f4ad96d4d7c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -2363,8 +2363,13 @@ public class CraftWorld implements World { diff --git a/patches/server/0575-Added-ServerResourcesReloadedEvent.patch b/patches/server/0576-Added-ServerResourcesReloadedEvent.patch similarity index 100% rename from patches/server/0575-Added-ServerResourcesReloadedEvent.patch rename to patches/server/0576-Added-ServerResourcesReloadedEvent.patch diff --git a/patches/server/0576-Added-world-settings-for-mobs-picking-up-loot.patch b/patches/server/0577-Added-world-settings-for-mobs-picking-up-loot.patch similarity index 100% rename from patches/server/0576-Added-world-settings-for-mobs-picking-up-loot.patch rename to patches/server/0577-Added-world-settings-for-mobs-picking-up-loot.patch diff --git a/patches/server/0577-Implemented-BlockFailedDispenseEvent.patch b/patches/server/0578-Implemented-BlockFailedDispenseEvent.patch similarity index 100% rename from patches/server/0577-Implemented-BlockFailedDispenseEvent.patch rename to patches/server/0578-Implemented-BlockFailedDispenseEvent.patch diff --git a/patches/server/0578-Added-PlayerLecternPageChangeEvent.patch b/patches/server/0579-Added-PlayerLecternPageChangeEvent.patch similarity index 100% rename from patches/server/0578-Added-PlayerLecternPageChangeEvent.patch rename to patches/server/0579-Added-PlayerLecternPageChangeEvent.patch diff --git a/patches/server/0579-Added-PlayerLoomPatternSelectEvent.patch b/patches/server/0580-Added-PlayerLoomPatternSelectEvent.patch similarity index 100% rename from patches/server/0579-Added-PlayerLoomPatternSelectEvent.patch rename to patches/server/0580-Added-PlayerLoomPatternSelectEvent.patch diff --git a/patches/server/0580-Configurable-door-breaking-difficulty.patch b/patches/server/0581-Configurable-door-breaking-difficulty.patch similarity index 100% rename from patches/server/0580-Configurable-door-breaking-difficulty.patch rename to patches/server/0581-Configurable-door-breaking-difficulty.patch diff --git a/patches/server/0581-Empty-commands-shall-not-be-dispatched.patch b/patches/server/0582-Empty-commands-shall-not-be-dispatched.patch similarity index 100% rename from patches/server/0581-Empty-commands-shall-not-be-dispatched.patch rename to patches/server/0582-Empty-commands-shall-not-be-dispatched.patch diff --git a/patches/server/0582-Implement-API-to-expose-exact-interaction-point.patch b/patches/server/0583-Implement-API-to-expose-exact-interaction-point.patch similarity index 100% rename from patches/server/0582-Implement-API-to-expose-exact-interaction-point.patch rename to patches/server/0583-Implement-API-to-expose-exact-interaction-point.patch diff --git a/patches/server/0583-Remove-stale-POIs.patch b/patches/server/0584-Remove-stale-POIs.patch similarity index 100% rename from patches/server/0583-Remove-stale-POIs.patch rename to patches/server/0584-Remove-stale-POIs.patch diff --git a/patches/server/0584-Fix-villager-boat-exploit.patch b/patches/server/0585-Fix-villager-boat-exploit.patch similarity index 93% rename from patches/server/0584-Fix-villager-boat-exploit.patch rename to patches/server/0585-Fix-villager-boat-exploit.patch index edc990c633..5eec001adb 100644 --- a/patches/server/0584-Fix-villager-boat-exploit.patch +++ b/patches/server/0585-Fix-villager-boat-exploit.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix villager boat exploit diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index ce6d9b460f0f55fc6d5544d5c8d2b78e5fcc3937..9a37a962b141e9faecc9f6f4906a9d727d20c20a 100644 +index 720fa2b74d3f9257a32e4bd5d21050626d136668..bbb2b5d96b35328e0b6041145a3d8234fd43dd03 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -613,6 +613,15 @@ public abstract class PlayerList { diff --git a/patches/server/0585-Add-sendOpLevel-API.patch b/patches/server/0586-Add-sendOpLevel-API.patch similarity index 91% rename from patches/server/0585-Add-sendOpLevel-API.patch rename to patches/server/0586-Add-sendOpLevel-API.patch index 804eeb2787..226d9fdddc 100644 --- a/patches/server/0585-Add-sendOpLevel-API.patch +++ b/patches/server/0586-Add-sendOpLevel-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add sendOpLevel API diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 9a37a962b141e9faecc9f6f4906a9d727d20c20a..d01712cad42c078a726d6f757a4d8f0e3f186274 100644 +index bbb2b5d96b35328e0b6041145a3d8234fd43dd03..213bfc7637b649a8e578d9a122fc4fce3c9fe9ea 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1113,22 +1113,29 @@ public abstract class PlayerList { +@@ -1115,22 +1115,29 @@ public abstract class PlayerList { } private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) { @@ -46,7 +46,7 @@ index 9a37a962b141e9faecc9f6f4906a9d727d20c20a..d01712cad42c078a726d6f757a4d8f0e // Paper start diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 9236027beb13ae4f2e35c46f6c176fd5d7d20b4f..a9fdf153a9442830c7ce9e8fb6147b2c7b33db55 100644 +index 0f832a1cec5dbe3f4fb8638af2ea1dc129ea5970..79527b4806c306b9811f6e93733836e658fea0fe 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -548,6 +548,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0586-Add-StructureLocateEvent.patch b/patches/server/0587-Add-StructureLocateEvent.patch similarity index 100% rename from patches/server/0586-Add-StructureLocateEvent.patch rename to patches/server/0587-Add-StructureLocateEvent.patch diff --git a/patches/server/0587-Collision-option-for-requiring-a-player-participant.patch b/patches/server/0588-Collision-option-for-requiring-a-player-participant.patch similarity index 100% rename from patches/server/0587-Collision-option-for-requiring-a-player-participant.patch rename to patches/server/0588-Collision-option-for-requiring-a-player-participant.patch diff --git a/patches/server/0588-Remove-ProjectileHitEvent-call-when-fireballs-dead.patch b/patches/server/0589-Remove-ProjectileHitEvent-call-when-fireballs-dead.patch similarity index 100% rename from patches/server/0588-Remove-ProjectileHitEvent-call-when-fireballs-dead.patch rename to patches/server/0589-Remove-ProjectileHitEvent-call-when-fireballs-dead.patch diff --git a/patches/server/0589-Return-chat-component-with-empty-text-instead-of-thr.patch b/patches/server/0590-Return-chat-component-with-empty-text-instead-of-thr.patch similarity index 100% rename from patches/server/0589-Return-chat-component-with-empty-text-instead-of-thr.patch rename to patches/server/0590-Return-chat-component-with-empty-text-instead-of-thr.patch diff --git a/patches/server/0590-Make-schedule-command-per-world.patch b/patches/server/0591-Make-schedule-command-per-world.patch similarity index 100% rename from patches/server/0590-Make-schedule-command-per-world.patch rename to patches/server/0591-Make-schedule-command-per-world.patch diff --git a/patches/server/0591-Configurable-max-leash-distance.patch b/patches/server/0592-Configurable-max-leash-distance.patch similarity index 100% rename from patches/server/0591-Configurable-max-leash-distance.patch rename to patches/server/0592-Configurable-max-leash-distance.patch diff --git a/patches/server/0592-Implement-BlockPreDispenseEvent.patch b/patches/server/0593-Implement-BlockPreDispenseEvent.patch similarity index 100% rename from patches/server/0592-Implement-BlockPreDispenseEvent.patch rename to patches/server/0593-Implement-BlockPreDispenseEvent.patch diff --git a/patches/server/0593-Added-Vanilla-Entity-Tags.patch b/patches/server/0594-Added-Vanilla-Entity-Tags.patch similarity index 100% rename from patches/server/0593-Added-Vanilla-Entity-Tags.patch rename to patches/server/0594-Added-Vanilla-Entity-Tags.patch diff --git a/patches/server/0594-added-Wither-API.patch b/patches/server/0595-added-Wither-API.patch similarity index 100% rename from patches/server/0594-added-Wither-API.patch rename to patches/server/0595-added-Wither-API.patch diff --git a/patches/server/0595-Added-firing-of-PlayerChangeBeaconEffectEvent.patch b/patches/server/0596-Added-firing-of-PlayerChangeBeaconEffectEvent.patch similarity index 100% rename from patches/server/0595-Added-firing-of-PlayerChangeBeaconEffectEvent.patch rename to patches/server/0596-Added-firing-of-PlayerChangeBeaconEffectEvent.patch diff --git a/patches/server/0596-Fix-console-spam-when-removing-chests-in-water.patch b/patches/server/0597-Fix-console-spam-when-removing-chests-in-water.patch similarity index 100% rename from patches/server/0596-Fix-console-spam-when-removing-chests-in-water.patch rename to patches/server/0597-Fix-console-spam-when-removing-chests-in-water.patch diff --git a/patches/server/0597-Add-toggle-for-always-placing-the-dragon-egg.patch b/patches/server/0598-Add-toggle-for-always-placing-the-dragon-egg.patch similarity index 100% rename from patches/server/0597-Add-toggle-for-always-placing-the-dragon-egg.patch rename to patches/server/0598-Add-toggle-for-always-placing-the-dragon-egg.patch diff --git a/patches/server/0598-Added-PlayerStonecutterRecipeSelectEvent.patch b/patches/server/0599-Added-PlayerStonecutterRecipeSelectEvent.patch similarity index 100% rename from patches/server/0598-Added-PlayerStonecutterRecipeSelectEvent.patch rename to patches/server/0599-Added-PlayerStonecutterRecipeSelectEvent.patch diff --git a/patches/server/0599-Add-dropLeash-variable-to-EntityUnleashEvent.patch b/patches/server/0600-Add-dropLeash-variable-to-EntityUnleashEvent.patch similarity index 100% rename from patches/server/0599-Add-dropLeash-variable-to-EntityUnleashEvent.patch rename to patches/server/0600-Add-dropLeash-variable-to-EntityUnleashEvent.patch diff --git a/patches/server/0600-Skip-distance-map-update-when-spawning-disabled.patch b/patches/server/0601-Skip-distance-map-update-when-spawning-disabled.patch similarity index 87% rename from patches/server/0600-Skip-distance-map-update-when-spawning-disabled.patch rename to patches/server/0601-Skip-distance-map-update-when-spawning-disabled.patch index 40fde190b3..f68ef8f362 100644 --- a/patches/server/0600-Skip-distance-map-update-when-spawning-disabled.patch +++ b/patches/server/0601-Skip-distance-map-update-when-spawning-disabled.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Skip distance map update when spawning disabled. diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 7ab28e9bd3f785838b7fa4ac5811c0e71cddcb61..b609740fb95ccd4c9d7a2a95fad3dfbff630db5f 100644 +index d13abec908dbb756272888e9ccdedbefff719012..d013d693a94369da6df00934b986b303160f5a07 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -778,7 +778,7 @@ public class ServerChunkCache extends ChunkSource { +@@ -810,7 +810,7 @@ public class ServerChunkCache extends ChunkSource { int l = this.distanceManager.getNaturalSpawnChunkCount(); // Paper start - per player mob spawning NaturalSpawner.SpawnState spawnercreature_d; // moved down diff --git a/patches/server/0601-Reset-shield-blocking-on-dimension-change.patch b/patches/server/0602-Reset-shield-blocking-on-dimension-change.patch similarity index 83% rename from patches/server/0601-Reset-shield-blocking-on-dimension-change.patch rename to patches/server/0602-Reset-shield-blocking-on-dimension-change.patch index dac062f779..aa3eb4e6c1 100644 --- a/patches/server/0601-Reset-shield-blocking-on-dimension-change.patch +++ b/patches/server/0602-Reset-shield-blocking-on-dimension-change.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Reset shield blocking on dimension change diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 5a87875b03740053d8cde6d81c57703d0b0ef57e..f9cf0c088f4c3de0a1a7b92beb6ee0c57a0b1326 100644 +index f412f3b9f3af498b9ced4a808849442efad01b69..d0e9bbecb4b0cf980116c72b96ae8edd74f9bfd6 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1117,6 +1117,11 @@ public class ServerPlayer extends Player { +@@ -1139,6 +1139,11 @@ public class ServerPlayer extends Player { this.level.getCraftServer().getPluginManager().callEvent(changeEvent); // CraftBukkit end } diff --git a/patches/server/0602-add-DragonEggFormEvent.patch b/patches/server/0603-add-DragonEggFormEvent.patch similarity index 100% rename from patches/server/0602-add-DragonEggFormEvent.patch rename to patches/server/0603-add-DragonEggFormEvent.patch diff --git a/patches/server/0603-EntityMoveEvent.patch b/patches/server/0604-EntityMoveEvent.patch similarity index 100% rename from patches/server/0603-EntityMoveEvent.patch rename to patches/server/0604-EntityMoveEvent.patch diff --git a/patches/server-remapped/0667-added-option-to-disable-pathfinding-updates-on-block.patch b/patches/server/0605-added-option-to-disable-pathfinding-updates-on-block.patch similarity index 80% rename from patches/server-remapped/0667-added-option-to-disable-pathfinding-updates-on-block.patch rename to patches/server/0605-added-option-to-disable-pathfinding-updates-on-block.patch index ca84c216d2..176d82a83b 100644 --- a/patches/server-remapped/0667-added-option-to-disable-pathfinding-updates-on-block.patch +++ b/patches/server/0605-added-option-to-disable-pathfinding-updates-on-block.patch @@ -5,10 +5,10 @@ Subject: [PATCH] added option to disable pathfinding updates on block changes diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 40939de88b1a8169dbfc7a0cd288c2fe9b706426..bbb1d0ed9e76f414dc7d73b4f7786891425f55cd 100644 +index 7738b5959f347cb369646852e7174aa580546400..c6cbc656f2cf6b253c3dfc87b8367f11102c7e41 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -800,4 +800,9 @@ public class PaperWorldConfig { +@@ -688,5 +688,10 @@ public class PaperWorldConfig { private void enderDragonsDeathAlwaysPlacesDragonEgg() { enderDragonsDeathAlwaysPlacesDragonEgg = getBoolean("ender-dragons-death-always-places-dragon-egg", enderDragonsDeathAlwaysPlacesDragonEgg); } @@ -18,11 +18,12 @@ index 40939de88b1a8169dbfc7a0cd288c2fe9b706426..bbb1d0ed9e76f414dc7d73b4f7786891 + updatePathfindingOnBlockUpdate = getBoolean("update-pathfinding-on-block-update", this.updatePathfindingOnBlockUpdate); + } } + diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 338b4c382fb8ea349ce81f2009e96de1df7ac5e2..a7553a856b9c99bee8f75d514b97cfab952bfd33 100644 +index 5cd1fe3506b1009de9fce64c3f4f44a29f13c359..a2d9e093bf7b5ee947f1d7c3b94397cd93eedef7 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1678,6 +1678,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl +@@ -1360,6 +1360,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl @Override public void sendBlockUpdated(BlockPos pos, BlockState oldState, BlockState newState, int flags) { this.getChunkSource().blockChanged(pos); @@ -30,9 +31,9 @@ index 338b4c382fb8ea349ce81f2009e96de1df7ac5e2..a7553a856b9c99bee8f75d514b97cfab VoxelShape voxelshape = oldState.getCollisionShape(this, pos); VoxelShape voxelshape1 = newState.getCollisionShape(this, pos); -@@ -1706,6 +1707,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl +@@ -1387,6 +1388,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl + } - this.tickingEntities = wasTicking; // Paper } + } // Paper } diff --git a/patches/server-remapped/0668-Inline-shift-direction-fields.patch b/patches/server/0606-Inline-shift-direction-fields.patch similarity index 60% rename from patches/server-remapped/0668-Inline-shift-direction-fields.patch rename to patches/server/0606-Inline-shift-direction-fields.patch index bf3e677ed6..5be0e06548 100644 --- a/patches/server-remapped/0668-Inline-shift-direction-fields.patch +++ b/patches/server/0606-Inline-shift-direction-fields.patch @@ -7,11 +7,11 @@ Removes a layer of indirection for EnumDirection.getAdjacent(X|Y|Z)(), which is critical section for much of the server, including the lighting engine. diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java -index 3ebc62fe93a0cd0048e07b0343fc724f2c056010..51217f7e5288162b8e76c8717506b393cd262537 100644 +index e8e9494f7f337ee91a56fbd299da015dcda4a81b..593d6251c75ec337175d08b85000239ba7da1af2 100644 --- a/src/main/java/net/minecraft/core/Direction.java +++ b/src/main/java/net/minecraft/core/Direction.java -@@ -53,6 +53,11 @@ public enum Direction implements StringRepresentable { - }, (enumdirection, enumdirection1) -> { +@@ -62,6 +62,11 @@ public enum Direction implements StringRepresentable { + }, (direction1, direction2) -> { throw new IllegalArgumentException("Duplicate keys"); }, Long2ObjectOpenHashMap::new)); + // Paper start @@ -20,21 +20,21 @@ index 3ebc62fe93a0cd0048e07b0343fc724f2c056010..51217f7e5288162b8e76c8717506b393 + private final int adjZ; + // Paper end - private Direction(int i, int j, int k, String s, Direction.AxisDirection enumdirection_enumaxisdirection, Direction.Axis enumdirection_enumaxis, Vec3i baseblockposition) { - this.data3d = i; -@@ -62,6 +67,11 @@ public enum Direction implements StringRepresentable { - this.axis = enumdirection_enumaxis; - this.axisDirection = enumdirection_enumaxisdirection; - this.normal = baseblockposition; + private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector) { + this.data3d = id; +@@ -71,6 +76,11 @@ public enum Direction implements StringRepresentable { + this.axis = axis; + this.axisDirection = direction; + this.normal = vector; + // Paper start -+ this.adjX = baseblockposition.getX(); -+ this.adjY = baseblockposition.getY(); -+ this.adjZ = baseblockposition.getZ(); ++ this.adjX = vector.getX(); ++ this.adjY = vector.getY(); ++ this.adjZ = vector.getZ(); + // Paper end } public static Direction[] orderedByNearest(Entity entity) { -@@ -137,15 +147,15 @@ public enum Direction implements StringRepresentable { +@@ -310,15 +320,15 @@ public enum Direction implements StringRepresentable { } public int getStepX() { @@ -52,4 +52,4 @@ index 3ebc62fe93a0cd0048e07b0343fc724f2c056010..51217f7e5288162b8e76c8717506b393 + return this.adjZ; // Paper } - public String getName() { + public Vector3f step() { diff --git a/patches/server-remapped/0669-Allow-adding-items-to-BlockDropItemEvent.patch b/patches/server/0607-Allow-adding-items-to-BlockDropItemEvent.patch similarity index 92% rename from patches/server-remapped/0669-Allow-adding-items-to-BlockDropItemEvent.patch rename to patches/server/0607-Allow-adding-items-to-BlockDropItemEvent.patch index 973fb6de6c..169393cd20 100644 --- a/patches/server-remapped/0669-Allow-adding-items-to-BlockDropItemEvent.patch +++ b/patches/server/0607-Allow-adding-items-to-BlockDropItemEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allow adding items to BlockDropItemEvent diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index ea7c30ef17fc66c1fb55d5909f94651c98b181be..5145968c9c6ccabfb15b91102f82e8a3a2d3cf82 100644 +index 2b5f63c3f0ff3039fbef9afdfa46e0e715d347bc..dcd59630c9e8870128859b9022827aeefebec963 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -389,13 +389,30 @@ public class CraftEventFactory { +@@ -390,13 +390,30 @@ public class CraftEventFactory { } public static void handleBlockDropItemEvent(Block block, BlockState state, ServerPlayer player, List items) { diff --git a/patches/server-remapped/0670-Add-getMainThreadExecutor-to-BukkitScheduler.patch b/patches/server/0608-Add-getMainThreadExecutor-to-BukkitScheduler.patch similarity index 92% rename from patches/server-remapped/0670-Add-getMainThreadExecutor-to-BukkitScheduler.patch rename to patches/server/0608-Add-getMainThreadExecutor-to-BukkitScheduler.patch index f2acd9e212..63e7f01676 100644 --- a/patches/server-remapped/0670-Add-getMainThreadExecutor-to-BukkitScheduler.patch +++ b/patches/server/0608-Add-getMainThreadExecutor-to-BukkitScheduler.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add getMainThreadExecutor to BukkitScheduler diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index 13e461ffb2ee2e7d0440c0f60809ea99629b843c..0be39dac4b9dd69d7d73d86d64cf1e33e4086e81 100644 +index 33480893ddee34a1983c5f1c4b14db98ff438528..d20438fcfc2baf7c826d1723738dbad3fdd123ee 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -635,4 +635,15 @@ public class CraftScheduler implements BukkitScheduler { diff --git a/patches/server-remapped/0671-living-entity-allow-attribute-registration.patch b/patches/server/0609-living-entity-allow-attribute-registration.patch similarity index 70% rename from patches/server-remapped/0671-living-entity-allow-attribute-registration.patch rename to patches/server/0609-living-entity-allow-attribute-registration.patch index 78a2270873..2782de61f6 100644 --- a/patches/server-remapped/0671-living-entity-allow-attribute-registration.patch +++ b/patches/server/0609-living-entity-allow-attribute-registration.patch @@ -5,19 +5,10 @@ Subject: [PATCH] living entity allow attribute registration diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java -index a501f334ce0bcc606dd2bb186cf7195102cd6c09..8acd102c0778e4e546e5191b6098eacbd15bd9f9 100644 +index cb9ed449ed96474d2115a3023ff0b7b298548071..9cbfda029782385d1a7987f5be46d450bd8a758e 100644 --- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java +++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java -@@ -21,7 +21,7 @@ import org.apache.logging.log4j.Logger; - public class AttributeMap { - - private static final Logger LOGGER = LogManager.getLogger(); -- private final Map attributes = Maps.newHashMap(); -+ private final Map attributes = Maps.newHashMap(); private final Map attributeMap = attributes; // Paper - OBFHELPER - private final Set dirtyAttributes = Sets.newHashSet(); - private final AttributeSupplier supplier; - -@@ -135,4 +135,12 @@ public class AttributeMap { +@@ -132,4 +132,12 @@ public class AttributeMap { } } @@ -25,13 +16,13 @@ index a501f334ce0bcc606dd2bb186cf7195102cd6c09..8acd102c0778e4e546e5191b6098eacb + // Paper - start + public void registerAttribute(Attribute attributeBase) { + AttributeInstance attributeModifiable = new AttributeInstance(attributeBase, AttributeInstance::getAttribute); -+ attributeMap.put(attributeBase, attributeModifiable); ++ attributes.put(attributeBase, attributeModifiable); + } + // Paper - end + } diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java -index 320fd6780af2fa99e4e4f4193cbc9338d492dc6d..a57b16679889f5b20c74712651f94d6796b8c661 100644 +index 46c313d581b9af6aa0a48f97ae3cc800a88535f2..07d700382fc356837045c46d320b7b69ad13af68 100644 --- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java +++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java @@ -38,6 +38,14 @@ public class CraftAttributeMap implements Attributable { @@ -50,11 +41,11 @@ index 320fd6780af2fa99e4e4f4193cbc9338d492dc6d..a57b16679889f5b20c74712651f94d67 return net.minecraft.core.Registry.ATTRIBUTE.get(CraftNamespacedKey.toMinecraft(attribute.getKey())); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index a8d21382d5859edfd12e01a48924ce780790b4b7..eefb6bd580ea176c3a242695ab4af46e7c61b492 100644 +index 2ca223324cc079e397852c30c969a05814585cde..eed0fb2293cf1e19f2d4f4b66a9e2ef8b214141c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -663,6 +663,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { - return getHandle().craftAttributes.getAttribute(attribute); + return this.getHandle().craftAttributes.getAttribute(attribute); } + // Paper start diff --git a/patches/server-remapped/0672-fix-dead-slime-setSize-invincibility.patch b/patches/server/0610-fix-dead-slime-setSize-invincibility.patch similarity index 70% rename from patches/server-remapped/0672-fix-dead-slime-setSize-invincibility.patch rename to patches/server/0610-fix-dead-slime-setSize-invincibility.patch index 72df11355c..33ce1b72f2 100644 --- a/patches/server-remapped/0672-fix-dead-slime-setSize-invincibility.patch +++ b/patches/server/0610-fix-dead-slime-setSize-invincibility.patch @@ -5,15 +5,15 @@ Subject: [PATCH] fix dead slime setSize invincibility diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java -index 340036135588d06e43cbd229dd3a6613b04bb9ab..d1bb7e1f7f7837774512e0af0c8b855d34d5a85b 100644 +index 4d401403de2399919043651345eed91c11ac986f..3c5326b1b4b18365e06292eca447778442201176 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java @@ -17,7 +17,7 @@ public class CraftSlime extends CraftMob implements Slime { @Override public void setSize(int size) { -- getHandle().setSize(size, true); -+ getHandle().setSize(size, /* true */ getHandle().isAlive()); // Paper - fix dead slime setSize invincibility +- this.getHandle().setSize(size, true); ++ this.getHandle().setSize(size, /* true */ getHandle().isAlive()); // Paper - fix dead slime setSize invincibility } @Override diff --git a/patches/server-remapped/0673-Merchant-getRecipes-should-return-an-immutable-list.patch b/patches/server/0611-Merchant-getRecipes-should-return-an-immutable-list.patch similarity index 61% rename from patches/server-remapped/0673-Merchant-getRecipes-should-return-an-immutable-list.patch rename to patches/server/0611-Merchant-getRecipes-should-return-an-immutable-list.patch index c4baf4a043..f316582cb5 100644 --- a/patches/server-remapped/0673-Merchant-getRecipes-should-return-an-immutable-list.patch +++ b/patches/server/0611-Merchant-getRecipes-should-return-an-immutable-list.patch @@ -5,15 +5,15 @@ Subject: [PATCH] Merchant#getRecipes should return an immutable list diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java -index 3437ec2c7c1a84debb7d7b7c90283d7e25208604..b4bcbd6329c67ea3deeeb1bf38233ebd15e922b7 100644 +index 425c8de426cecc9919d03dc64325494104d1b294..fcd6574857f77d547fd8101c5ac097bc6306034c 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java @@ -24,7 +24,7 @@ public class CraftMerchant implements Merchant { @Override public List getRecipes() { -- return Collections.unmodifiableList(Lists.transform(merchant.getOffers(), new Function() { -+ return com.google.common.collect.ImmutableList.copyOf(Lists.transform(merchant.getOffers(), new Function() { // Paper - javadoc says 'an immutable list of trades' - not 'an unmodifiable view of a list of trades'. fixes issue with setRecipes(getRecipes()) +- return Collections.unmodifiableList(Lists.transform(this.merchant.getOffers(), new Function() { ++ return com.google.common.collect.ImmutableList.copyOf(Lists.transform(this.merchant.getOffers(), new Function() { // Paper - javadoc says 'an immutable list of trades' - not 'an unmodifiable view of a list of trades'. fixes issue with setRecipes(getRecipes()) @Override public MerchantRecipe apply(net.minecraft.world.item.trading.MerchantOffer recipe) { return recipe.asBukkit(); diff --git a/patches/server-remapped/0674-misc-debugging-dumps.patch b/patches/server/0612-misc-debugging-dumps.patch similarity index 59% rename from patches/server-remapped/0674-misc-debugging-dumps.patch rename to patches/server/0612-misc-debugging-dumps.patch index f56af1f8b5..3b8113783b 100644 --- a/patches/server-remapped/0674-misc-debugging-dumps.patch +++ b/patches/server/0612-misc-debugging-dumps.patch @@ -29,59 +29,43 @@ index 0000000000000000000000000000000000000000..2d5494d2813b773e60ddba6790b750a9 + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index bc44811f26076871848ba8f5c582ab26b1fd7170..9b654fed2a00740cef84cf72258abfc7aeafc0c2 100644 +index c8213692e658f6eb82d3bd843b9525ff6565cc81..f1c1d715d509aeb13e465cd57a82896db6c51838 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -14,6 +14,7 @@ import io.netty.buffer.ByteBufOutputStream; - import io.netty.buffer.Unpooled; - import io.papermc.paper.adventure.PaperAdventure; // Paper - import io.papermc.paper.event.entity.EntityMoveEvent; -+import io.papermc.paper.util.TraceUtil; - import it.unimi.dsi.fastutil.longs.LongIterator; - import java.awt.image.BufferedImage; - import java.io.BufferedWriter; -@@ -855,6 +856,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop +Date: Fri, 26 Feb 2021 16:24:25 -0600 +Subject: [PATCH] Expose Tracked Players + + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index 79527b4806c306b9811f6e93733836e658fea0fe..db920ef12e918b7dfdcc4612c4bec0b9961d9a3e 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -2312,6 +2312,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + } + // Paper end + ++ // Paper start ++ @Override ++ public Set getTrackedPlayers() { ++ if (entity.tracker == null) { ++ return java.util.Collections.emptySet(); ++ } ++ ++ Set set = new HashSet<>(entity.tracker.seenBy.size()); ++ for (net.minecraft.server.network.ServerPlayerConnection connection : entity.tracker.seenBy) { ++ set.add(connection.getPlayer().getBukkitEntity().getPlayer()); ++ } ++ return set; ++ } ++ // Paper end ++ + // Spigot start + private final Player.Spigot spigot = new Player.Spigot() + { diff --git a/patches/server/0615-Remove-streams-from-SensorNearest.patch b/patches/server/0615-Remove-streams-from-SensorNearest.patch new file mode 100644 index 0000000000..3ef5964d12 --- /dev/null +++ b/patches/server/0615-Remove-streams-from-SensorNearest.patch @@ -0,0 +1,107 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Bjarne Koll +Date: Wed, 3 Mar 2021 12:48:48 +0100 +Subject: [PATCH] Remove streams from SensorNearest + +The behavioural nearby sensors are validated every tick on the entities +that registered the respective sensors and are therefore a good subject +to performance improvements. + +More specifically this commit replaces the Stream#filter usage with +ArrayList#removeIf as the removeIf method on an array list is heavily +optimized towards a single internal array re-allocation without any +further overhead on the removeIf call. + +The only negative of this change is the rather agressive diff these +patches introduce as the methods are basically being reimplemented +compared to the previous stream-based implementation. + +See: https://nipafx.dev/java-stream-performance/ + +diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java +index 7680c269c2fe0cf2a51d0ebeb34624181826d578..49f3b25d28072b61f5cc97260df61df892a58714 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java ++++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java +@@ -28,11 +28,15 @@ public class NearestItemSensor extends Sensor { + return true; + }); + list.sort(Comparator.comparingDouble(entity::distanceToSqr)); +- Optional optional = list.stream().filter((itemEntity) -> { +- return entity.wantsToPickUp(itemEntity.getItem()); +- }).filter((itemEntity) -> { +- return itemEntity.closerThan(entity, 9.0D); +- }).filter(entity::hasLineOfSight).findFirst(); +- brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, optional); ++ // Paper start - remove streams in favour of lists ++ ItemEntity nearest = null; ++ for (ItemEntity entityItem : list) { ++ if (entity.wantsToPickUp(entityItem.getItem()) && entityItem.closerThan(entity, 9.0D) && entity.hasLineOfSight(entityItem)) { ++ nearest = entityItem; ++ break; ++ } ++ } ++ brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, Optional.ofNullable(nearest)); ++ // Paper end + } + } +diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java +index 66c90013e52170a657b1a5dbdb99748a19fe55e8..ffd83db0a419ab589e89feeddd3fb038d6ed5839 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java ++++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java +@@ -21,9 +21,11 @@ public class NearestLivingEntitySensor extends Sensor { + list.sort(Comparator.comparingDouble(entity::distanceToSqr)); + Brain brain = entity.getBrain(); + brain.setMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES, list); +- brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, list.stream().filter((livingEntity2) -> { +- return isEntityTargetable(entity, livingEntity2); +- }).collect(Collectors.toList())); ++ // Paper start - remove streams in favour of lists ++ List visibleMobs = new java.util.ArrayList<>(list); ++ visibleMobs.removeIf(otherEntityLiving -> !Sensor.isEntityTargetable(entity, otherEntityLiving)); ++ brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, visibleMobs); ++ // Paper end + } + + @Override +diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java +index b51574548b370f8a86d27835e9888ce1cd1d18be..457ea75137b8b02dc32bf1769ae8d57c470da470 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java ++++ b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java +@@ -21,18 +21,25 @@ public class PlayerSensor extends Sensor { + + @Override + protected void doTick(ServerLevel world, LivingEntity entity) { +- List list = world.players().stream().filter(EntitySelector.NO_SPECTATORS).filter((serverPlayer) -> { +- return entity.closerThan(serverPlayer, 16.0D); +- }).sorted(Comparator.comparingDouble(entity::distanceToSqr)).collect(Collectors.toList()); ++ // Paper start - remove streams in favour of lists ++ List players = new java.util.ArrayList<>(world.players()); ++ players.removeIf(player -> !EntitySelector.NO_SPECTATORS.test(player) || !entity.closerThan(player, 16.0D)); // Paper - removeIf only re-allocates once compared to iterator + Brain brain = entity.getBrain(); +- brain.setMemory(MemoryModuleType.NEAREST_PLAYERS, list); +- List list2 = list.stream().filter((player) -> { +- return isEntityTargetable(entity, player); +- }).collect(Collectors.toList()); +- brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_PLAYER, list2.isEmpty() ? null : list2.get(0)); +- Optional optional = list2.stream().filter((player) -> { +- return isEntityAttackable(entity, player); +- }).findFirst(); +- brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, optional); ++ ++ brain.setMemory(MemoryModuleType.NEAREST_PLAYERS, players); ++ ++ Player nearest = null, nearestTargetable = null; ++ for (Player player : players) { ++ if (Sensor.isEntityTargetable(entity, player)) { ++ if (nearest == null) nearest = player; ++ if (Sensor.isEntityAttackable(entity, player)) { ++ nearestTargetable = player; ++ break; // Both variables are assigned, no reason to loop further ++ } ++ } ++ } ++ brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_PLAYER, nearest); ++ brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, nearestTargetable); ++ // Paper end + } + } diff --git a/patches/server-remapped/0680-MC-29274-Fix-Wither-hostility-towards-players.patch b/patches/server/0616-MC-29274-Fix-Wither-hostility-towards-players.patch similarity index 84% rename from patches/server-remapped/0680-MC-29274-Fix-Wither-hostility-towards-players.patch rename to patches/server/0616-MC-29274-Fix-Wither-hostility-towards-players.patch index ec43d966cb..019deb51e8 100644 --- a/patches/server-remapped/0680-MC-29274-Fix-Wither-hostility-towards-players.patch +++ b/patches/server/0616-MC-29274-Fix-Wither-hostility-towards-players.patch @@ -5,10 +5,10 @@ Subject: [PATCH] MC-29274: Fix Wither hostility towards players diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index bbb1d0ed9e76f414dc7d73b4f7786891425f55cd..eb367b8feda8219a97a547c3ef6ab82d278d2f25 100644 +index c6cbc656f2cf6b253c3dfc87b8367f11102c7e41..caa15973d78e21725b5dd9e5fc91cede4cc0dac4 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -805,4 +805,10 @@ public class PaperWorldConfig { +@@ -693,5 +693,11 @@ public class PaperWorldConfig { private void setUpdatePathfindingOnBlockUpdate() { updatePathfindingOnBlockUpdate = getBoolean("update-pathfinding-on-block-update", this.updatePathfindingOnBlockUpdate); } @@ -19,11 +19,12 @@ index bbb1d0ed9e76f414dc7d73b4f7786891425f55cd..eb367b8feda8219a97a547c3ef6ab82d + log("Withers properly target players: " + fixWitherTargetingBug); + } } + diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -index fd91c80cd6337b5fa41d6060ecdb44b8fa68a16a..b364b442d4cb1f3351850140b85c62c30c888bed 100644 +index 1e479853ec239b5e970b478adb3419e400d2f1d6..1c8f6863b976cfcb559de9b3e3cf9292831166ee 100644 --- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -@@ -102,6 +102,7 @@ public class WitherBoss extends Monster implements RangedAttackMob { +@@ -105,6 +105,7 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 8.0F)); this.goalSelector.addGoal(7, new RandomLookAroundGoal(this)); this.targetSelector.addGoal(1, new HurtByTargetGoal(this, new Class[0])); diff --git a/patches/server-remapped/0681-Throw-proper-exception-on-empty-JsonList-file.patch b/patches/server/0617-Throw-proper-exception-on-empty-JsonList-file.patch similarity index 91% rename from patches/server-remapped/0681-Throw-proper-exception-on-empty-JsonList-file.patch rename to patches/server/0617-Throw-proper-exception-on-empty-JsonList-file.patch index cdc493b6d3..5350e561c4 100644 --- a/patches/server-remapped/0681-Throw-proper-exception-on-empty-JsonList-file.patch +++ b/patches/server/0617-Throw-proper-exception-on-empty-JsonList-file.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Throw proper exception on empty JsonList file diff --git a/src/main/java/net/minecraft/server/players/StoredUserList.java b/src/main/java/net/minecraft/server/players/StoredUserList.java -index e2982a8ac5448110378bc92247952332bdffe12c..71de59cadcbd214b9e3a91a6051f918d9b421b16 100644 +index 4b85943a704e0a5ca6b95f9cfcbfd1f9505c3b68..bfac2eb1ad06e82fed92574c1dd07e33f1440db7 100644 --- a/src/main/java/net/minecraft/server/players/StoredUserList.java +++ b/src/main/java/net/minecraft/server/players/StoredUserList.java @@ -189,6 +189,7 @@ public abstract class StoredUserList> { diff --git a/patches/server-remapped/0682-Improve-ServerGUI.patch b/patches/server/0618-Improve-ServerGUI.patch similarity index 92% rename from patches/server-remapped/0682-Improve-ServerGUI.patch rename to patches/server/0618-Improve-ServerGUI.patch index 46ebed8c68..2ddf152c7a 100644 --- a/patches/server-remapped/0682-Improve-ServerGUI.patch +++ b/patches/server/0618-Improve-ServerGUI.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Improve ServerGUI - Show tps in the server stats diff --git a/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java b/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java -index c0923ec75ecced2e0a1c0d3ec2c046d69af3e9a9..a3e17c1cb54938908d72d3e86e43f4655f1db194 100644 +index 23239679d6584f1088b2b94c46eb9a5c1f9ad91d..fa56cd09102a89692b42f1d14257990508c5c720 100644 --- a/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java +++ b/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java @@ -57,9 +57,18 @@ public class RAMDetails extends JList { @@ -23,27 +23,26 @@ index c0923ec75ecced2e0a1c0d3ec2c046d69af3e9a9..a3e17c1cb54938908d72d3e86e43f465 + } vector.add("Memory use: " + (data.getUsedMem() / 1024L / 1024L) + " mb (" + (data.getFree() * 100L / data.getMax()) + "% free)"); vector.add("Heap: " + (data.getTotal() / 1024L / 1024L) + " / " + (data.getMax() / 1024L / 1024L) + " mb"); - vector.add("Avg tick: " + DECIMAL_FORMAT.format(getAverage(server.getTickTimes())) + " ms"); + vector.add("Avg tick: " + DECIMAL_FORMAT.format(getAverage(server.tickTimes)) + " ms"); + vector.add("TPS from last 1m, 5m, 15m: " + String.join(", ", tpsAvg)); + setListData(vector); } -@@ -70,4 +79,9 @@ public class RAMDetails extends JList { +@@ -70,4 +79,8 @@ public class RAMDetails extends JList { } return ((double) total / (double) tickTimes.length) * 1.0E-6D; } + -+ private static String format(double tps) -+ { ++ private static String format(double tps) { + return ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 ); + } } diff --git a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java -index 2567c588a1dcf732800e6cf87352b020c7bb84d6..ad912fae191777256dd88f6c863ec92f8b6a9c13 100644 +index 703d2bb93d6ab76fc117a320f155570addcc543c..07f0c5f629741e4ecc1fcbc122ba7700174e5c9d 100644 --- a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java +++ b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java -@@ -31,6 +31,11 @@ import net.minecraft.DefaultUncaughtExceptionHandler; +@@ -32,6 +32,11 @@ import net.minecraft.DefaultUncaughtExceptionHandler; import net.minecraft.server.dedicated.DedicatedServer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -55,7 +54,7 @@ index 2567c588a1dcf732800e6cf87352b020c7bb84d6..ad912fae191777256dd88f6c863ec92f public class MinecraftServerGui extends JComponent { -@@ -56,6 +61,15 @@ public class MinecraftServerGui extends JComponent { +@@ -59,6 +64,15 @@ public class MinecraftServerGui extends JComponent { jframe.pack(); jframe.setLocationRelativeTo((Component) null); jframe.setVisible(true); @@ -72,22 +71,13 @@ index 2567c588a1dcf732800e6cf87352b020c7bb84d6..ad912fae191777256dd88f6c863ec92f public void windowClosing(WindowEvent windowevent) { if (!servergui.isClosing.getAndSet(true)) { diff --git a/src/main/java/net/minecraft/server/gui/StatsComponent.java b/src/main/java/net/minecraft/server/gui/StatsComponent.java -index 09414d04208a843f8d337569b53f61b34e64ed92..d2583c762fe655dd1d7bed1061e41cd08ac0c092 100644 +index 4c5059805715bbca53196bcabd7eda550a46c34d..88f10d729aa1e0a01790521821d691a0ecd373a2 100644 --- a/src/main/java/net/minecraft/server/gui/StatsComponent.java +++ b/src/main/java/net/minecraft/server/gui/StatsComponent.java -@@ -18,7 +18,7 @@ public class StatsComponent extends JComponent { - }); - private final int[] values = new int[256]; - private int vp; -- private final String[] msgs = new String[11]; -+ private final String[] msgs = new String[12]; public String[] getStatEntries() { return this.msgs; } // Paper - change size, OBFHELPER - private final MinecraftServer server; - private final Timer timer; +@@ -35,8 +35,17 @@ public class StatsComponent extends JComponent { -@@ -37,8 +37,18 @@ public class StatsComponent extends JComponent { private void tick() { - long i = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); - + long l = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); + // Paper start - Add tps entry + double[] tps = org.bukkit.Bukkit.getTPS(); + String[] tpsAvg = new String[tps.length]; @@ -95,22 +85,21 @@ index 09414d04208a843f8d337569b53f61b34e64ed92..d2583c762fe655dd1d7bed1061e41cd0 + for ( int g = 0; g < tps.length; g++) { + tpsAvg[g] = format( tps[g] ); + } - this.msgs[0] = "Memory use: " + i / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)"; - this.msgs[1] = "Avg tick: " + StatsComponent.DECIMAL_FORMAT.format(this.getAverage(this.server.tickTimes) * 1.0E-6D) + " ms"; -+ getStatEntries()[2] = "TPS from last 1m, 5m, 15m: " + String.join(", ", tpsAvg); + this.msgs[0] = "Memory use: " + l / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)"; + this.msgs[1] = "Avg tick: " + DECIMAL_FORMAT.format(this.getAverage(this.server.tickTimes) * 1.0E-6D) + " ms"; ++ this.msgs[2] = "TPS from last 1m, 5m, 15m: " + String.join(", ", tpsAvg); + // Paper end -+ - this.values[this.vp++ & 255] = (int) (i * 100L / Runtime.getRuntime().maxMemory()); + this.values[this.vp++ & 255] = (int)(l * 100L / Runtime.getRuntime().maxMemory()); this.repaint(); } -@@ -85,4 +95,10 @@ public class StatsComponent extends JComponent { +@@ -76,4 +85,10 @@ public class StatsComponent extends JComponent { public void close() { this.timer.stop(); } + + // Paper - start Add tps entry + private static String format(double tps) { -+ return ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 ); // only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise ++ return (( tps > 21.0 ) ? "*" : "") + Math.min(Math.round(tps * 100.0) / 100.0, 20.0); // only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise + } + // Paper end } diff --git a/patches/server-remapped/0683-stop-firing-pressure-plate-EntityInteractEvent-for-i.patch b/patches/server/0619-stop-firing-pressure-plate-EntityInteractEvent-for-i.patch similarity index 100% rename from patches/server-remapped/0683-stop-firing-pressure-plate-EntityInteractEvent-for-i.patch rename to patches/server/0619-stop-firing-pressure-plate-EntityInteractEvent-for-i.patch diff --git a/patches/server-remapped/0684-fix-converting-txt-to-json-file.patch b/patches/server/0620-fix-converting-txt-to-json-file.patch similarity index 64% rename from patches/server-remapped/0684-fix-converting-txt-to-json-file.patch rename to patches/server/0620-fix-converting-txt-to-json-file.patch index 950227fe76..2d0213dc1f 100644 --- a/patches/server-remapped/0684-fix-converting-txt-to-json-file.patch +++ b/patches/server/0620-fix-converting-txt-to-json-file.patch @@ -5,13 +5,13 @@ Subject: [PATCH] fix converting txt to json file diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java -index 603b4f841bcc276997d130f1545c4cf550dcac2d..2eafb7e27d06a975cee48cc18c7596d610483d16 100644 +index aeb91eefa0949b2a53d77f1e4a48a29b9d1bc3fe..918f5221e94cbc867349c69c83563e225d2fef1d 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java -@@ -18,6 +18,11 @@ public class DedicatedPlayerList extends PlayerList { - - this.setViewDistance(dedicatedserverproperties.viewDistance); - super.setUsingWhiteList((Boolean) dedicatedserverproperties.whiteList.get()); +@@ -16,6 +16,11 @@ public class DedicatedPlayerList extends PlayerList { + DedicatedServerProperties dedicatedServerProperties = server.getProperties(); + this.setViewDistance(dedicatedServerProperties.viewDistance); + super.setUsingWhiteList(dedicatedServerProperties.whiteList.get()); + // Paper start - moved from constructor + } + @Override @@ -21,10 +21,10 @@ index 603b4f841bcc276997d130f1545c4cf550dcac2d..2eafb7e27d06a975cee48cc18c7596d6 this.saveUserBanList(); this.loadIpBanList(); diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 95f9863bbccaa23d08c409792314df4f2397a317..c2947313cc0eda3247fb4b20ddd1d0b86c37c50a 100644 +index a5c1114f9b323e8a49c84d0e68461e473bbcd690..eadacfa8449336c024f6154f46bb514d8e1230ec 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -195,6 +195,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -204,6 +204,12 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface org.spigotmc.SpigotConfig.init((java.io.File) options.valueOf("spigot-settings")); org.spigotmc.SpigotConfig.registerCommands(); // Spigot end @@ -37,31 +37,18 @@ index 95f9863bbccaa23d08c409792314df4f2397a317..c2947313cc0eda3247fb4b20ddd1d0b8 // Paper start try { com.destroystokyo.paper.PaperConfig.init((java.io.File) options.valueOf("paper-settings")); -@@ -257,10 +263,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -265,9 +271,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file."); } - if (this.convertOldUsers()) { -- this.getProfileCache().b(false); // Paper +- this.getProfileCache().save(false); // Paper - } -- + if (!OldUsersConverter.serverReadyAfterUserconversion(this)) { return false; - } else { -diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index 941b7e356c377fd8ad4e27409cd74c0046878396..f23ca6bebf2c0b7e02dc6aa51e384cee4e3d12c3 100644 ---- a/src/main/java/net/minecraft/server/players/GameProfileCache.java -+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java -@@ -243,6 +243,7 @@ public class GameProfileCache { - return arraylist; - } - -+ public void save(boolean asyncSave) { b(asyncSave); } // Paper - OBFHELPER - public void b(boolean asyncSave) { // Paper - JsonArray jsonarray = new JsonArray(); - DateFormat dateformat = createDateFormat(); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index c962b6fc0c65dc5e2ea636220727bca63bf4b740..dd121ec8f779b3786eeb7fe85519cf9e472f5adf 100644 +index 213bfc7637b649a8e578d9a122fc4fce3c9fe9ea..12a10d6586b0b1d95e2b1a229f922286753f066c 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -171,6 +171,7 @@ public abstract class PlayerList { diff --git a/patches/server-remapped/0685-Add-worldborder-events.patch b/patches/server/0621-Add-worldborder-events.patch similarity index 52% rename from patches/server-remapped/0685-Add-worldborder-events.patch rename to patches/server/0621-Add-worldborder-events.patch index 33286aca0e..a78c112f12 100644 --- a/patches/server-remapped/0685-Add-worldborder-events.patch +++ b/patches/server/0621-Add-worldborder-events.patch @@ -5,27 +5,17 @@ Subject: [PATCH] Add worldborder events diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java -index aaa6251838483de5c46913534413151b5cb1d3fe..4ad686f4fcd3a23c4230faa03946db1f338bc904 100644 +index 4a61153eaf9cf4c8aa532f770c0e449325448107..a30cd5a649a3086b794f1cb03bc0e02846b2f558 100644 --- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java +++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java -@@ -14,6 +14,9 @@ import net.minecraft.world.phys.AABB; - import net.minecraft.world.phys.shapes.BooleanOp; - import net.minecraft.world.phys.shapes.Shapes; - import net.minecraft.world.phys.shapes.VoxelShape; -+import io.papermc.paper.event.world.border.WorldBorderBoundsChangeFinishEvent; // Paper -+import io.papermc.paper.event.world.border.WorldBorderCenterChangeEvent; // Paper -+import io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent; // Paper - - public class WorldBorder { - -@@ -102,15 +105,19 @@ public class WorldBorder { +@@ -110,15 +110,19 @@ public class WorldBorder { } public void setCenter(double x, double z) { - this.centerX = x; - this.centerZ = z; + // Paper start -+ WorldBorderCenterChangeEvent event = new WorldBorderCenterChangeEvent(world.getWorld(), world.getWorld().getWorldBorder(), new org.bukkit.Location(world.getWorld(), this.getCenterX(), 0, this.getCenterZ()), new org.bukkit.Location(world.getWorld(), x, 0, z)); ++ io.papermc.paper.event.world.border.WorldBorderCenterChangeEvent event = new io.papermc.paper.event.world.border.WorldBorderCenterChangeEvent(world.getWorld(), world.getWorld().getWorldBorder(), new org.bukkit.Location(world.getWorld(), this.getCenterX(), 0, this.getCenterZ()), new org.bukkit.Location(world.getWorld(), x, 0, z)); + if (!event.callEvent()) return; + this.centerX = event.getNewCenter().getX(); + this.centerZ = event.getNewCenter().getZ(); @@ -41,15 +31,15 @@ index aaa6251838483de5c46913534413151b5cb1d3fe..4ad686f4fcd3a23c4230faa03946db1f } } -@@ -128,25 +135,43 @@ public class WorldBorder { +@@ -136,25 +140,43 @@ public class WorldBorder { } public void setSize(double size) { - this.extent = new WorldBorder.StaticBorderExtent(size); + // Paper start -+ WorldBorderBoundsChangeEvent event = new WorldBorderBoundsChangeEvent(world.getWorld(), world.getWorld().getWorldBorder(), WorldBorderBoundsChangeEvent.Type.INSTANT_MOVE, getSize(), size, 0); ++ io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent event = new io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent(world.getWorld(), world.getWorld().getWorldBorder(), io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent.Type.INSTANT_MOVE, getSize(), size, 0); + if (!event.callEvent()) return; -+ if (event.getType() == WorldBorderBoundsChangeEvent.Type.STARTED_MOVE && event.getDuration() > 0) { // If changed to a timed transition ++ if (event.getType() == io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent.Type.STARTED_MOVE && event.getDuration() > 0) { // If changed to a timed transition + lerpSizeBetween(event.getOldSize(), event.getNewSize(), event.getDuration()); + return; + } @@ -69,13 +59,13 @@ index aaa6251838483de5c46913534413151b5cb1d3fe..4ad686f4fcd3a23c4230faa03946db1f public void lerpSizeBetween(double fromSize, double toSize, long time) { - this.extent = (WorldBorder.BorderExtent) (fromSize == toSize ? new WorldBorder.StaticBorderExtent(toSize) : new WorldBorder.MovingBorderExtent(fromSize, toSize, time)); + // Paper start -+ WorldBorderBoundsChangeEvent.Type type; ++ io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent.Type type; + if (fromSize == toSize) { // new size = old size -+ type = WorldBorderBoundsChangeEvent.Type.INSTANT_MOVE; // Use INSTANT_MOVE because below it creates a Static border if they are equal. ++ type = io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent.Type.INSTANT_MOVE; // Use INSTANT_MOVE because below it creates a Static border if they are equal. + } else { -+ type = WorldBorderBoundsChangeEvent.Type.STARTED_MOVE; ++ type = io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent.Type.STARTED_MOVE; + } -+ WorldBorderBoundsChangeEvent event = new WorldBorderBoundsChangeEvent(world.getWorld(), world.getWorld().getWorldBorder(), type, fromSize, toSize, time); ++ io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent event = new io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent(world.getWorld(), world.getWorld().getWorldBorder(), type, fromSize, toSize, time); + if (!event.callEvent()) return; + this.extent = (WorldBorder.BorderExtent) (fromSize == event.getNewSize() ? new WorldBorder.StaticBorderExtent(event.getNewSize()) : new WorldBorder.MovingBorderExtent(fromSize, event.getNewSize(), event.getDuration())); + // Paper end @@ -89,34 +79,11 @@ index aaa6251838483de5c46913534413151b5cb1d3fe..4ad686f4fcd3a23c4230faa03946db1f } } -@@ -434,11 +459,11 @@ public class WorldBorder { - - class MovingBorderExtent implements WorldBorder.BorderExtent { - -- private final double from; -- private final double to; -+ private final double from; public final double getOldSize() { return this.from; } // Paper - OBFHELPER -+ private final double to; public final double getNewSize() { return this.to; } // Paper - OBFHELPER - private final long lerpEnd; - private final long lerpBegin; -- private final double lerpDuration; -+ private final double lerpDuration; public final double getDuration() { return this.lerpDuration; } // Paper - OBFHELPER - - private MovingBorderExtent(double d0, double d1, long i) { - this.from = d0; -@@ -493,6 +518,7 @@ public class WorldBorder { +@@ -459,6 +481,7 @@ public class WorldBorder { @Override public WorldBorder.BorderExtent update() { -+ if (this.getLerpTimeRemaining() <= 0L) new WorldBorderBoundsChangeFinishEvent(world.getWorld(), world.getWorld().getWorldBorder(), getOldSize(), getNewSize(), getDuration()).callEvent(); // Paper ++ if (this.getLerpRemainingTime() <= 0L) new io.papermc.paper.event.world.border.WorldBorderBoundsChangeFinishEvent(world.getWorld(), world.getWorld().getWorldBorder(), this.from, this.to, this.lerpDuration).callEvent(); // Paper return (WorldBorder.BorderExtent) (this.getLerpRemainingTime() <= 0L ? WorldBorder.this.new StaticBorderExtent(this.to) : this); } -@@ -514,6 +540,7 @@ public class WorldBorder { - - double getSize(); - -+ default long getLerpTimeRemaining() { return getLerpRemainingTime(); } // Paper - OBFHELPER - long getLerpRemainingTime(); - - double getLerpTarget(); diff --git a/patches/server-remapped/0686-added-PlayerNameEntityEvent.patch b/patches/server/0622-added-PlayerNameEntityEvent.patch similarity index 80% rename from patches/server-remapped/0686-added-PlayerNameEntityEvent.patch rename to patches/server/0622-added-PlayerNameEntityEvent.patch index 64f85dbc14..c1df33b717 100644 --- a/patches/server-remapped/0686-added-PlayerNameEntityEvent.patch +++ b/patches/server/0622-added-PlayerNameEntityEvent.patch @@ -5,37 +5,34 @@ Subject: [PATCH] added PlayerNameEntityEvent diff --git a/src/main/java/net/minecraft/world/item/NameTagItem.java b/src/main/java/net/minecraft/world/item/NameTagItem.java -index 5e38077c3de0a40f3cfd856bf2e48f7061e39a9d..5c575798c20f15d28350f767ecf15bfc042ebc8c 100644 +index 13080fb2350d4ee2107063948dd2ef359dff8306..623f78c078fb3aa2665d7e8a37672438227bce6b 100644 --- a/src/main/java/net/minecraft/world/item/NameTagItem.java +++ b/src/main/java/net/minecraft/world/item/NameTagItem.java -@@ -1,5 +1,10 @@ +@@ -1,5 +1,9 @@ package net.minecraft.world.item; +// Paper start +import io.papermc.paper.adventure.PaperAdventure; +import io.papermc.paper.event.player.PlayerNameEntityEvent; +// Paper end -+import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.LivingEntity; -@@ -16,11 +21,15 @@ public class NameTagItem extends Item { +@@ -15,9 +19,14 @@ public class NameTagItem extends Item { public InteractionResult interactLivingEntity(ItemStack stack, Player user, LivingEntity entity, InteractionHand hand) { if (stack.hasCustomHoverName() && !(entity instanceof Player)) { if (!user.level.isClientSide && entity.isAlive()) { - entity.setCustomName(stack.getHoverName()); - if (entity instanceof Mob) { -- ((Mob) entity).setPersistenceRequired(); +- ((Mob)entity).setPersistenceRequired(); + // Paper start -+ PlayerNameEntityEvent event = new PlayerNameEntityEvent(((ServerPlayer) user).getBukkitEntity(), entity.getBukkitLivingEntity(), PaperAdventure.asAdventure(stack.getHoverName()), true); ++ PlayerNameEntityEvent event = new PlayerNameEntityEvent(((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity(), entity.getBukkitLivingEntity(), PaperAdventure.asAdventure(stack.getHoverName()), true); + if (!event.callEvent()) return InteractionResult.PASS; + LivingEntity newEntityLiving = ((org.bukkit.craftbukkit.entity.CraftLivingEntity) event.getEntity()).getHandle(); + newEntityLiving.setCustomName(event.getName() != null ? PaperAdventure.asVanilla(event.getName()) : null); + if (event.isPersistent() && newEntityLiving instanceof Mob) { + ((Mob) newEntityLiving).setPersistenceRequired(); - } -- + // Paper end - stack.shrink(1); - } + } + stack.shrink(1); diff --git a/patches/server-remapped/0687-Prevent-grindstones-from-overstacking-items.patch b/patches/server/0623-Prevent-grindstones-from-overstacking-items.patch similarity index 89% rename from patches/server-remapped/0687-Prevent-grindstones-from-overstacking-items.patch rename to patches/server/0623-Prevent-grindstones-from-overstacking-items.patch index 9f050a4e9b..1dc9e0fcf3 100644 --- a/patches/server-remapped/0687-Prevent-grindstones-from-overstacking-items.patch +++ b/patches/server/0623-Prevent-grindstones-from-overstacking-items.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent grindstones from overstacking items diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java -index 329a6d70d53c13cd554c64996f2ddc489bdc1e94..445d408963538fbc01d61902805b2e35c861e4ce 100644 +index b260216460b0bbf75edc631bb69e3e4fc94d459a..4414f59b17d3a5232dc2def1816964610fe03b68 100644 --- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java +++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java -@@ -195,13 +195,13 @@ public class GrindstoneMenu extends AbstractContainerMenu { +@@ -199,13 +199,13 @@ public class GrindstoneMenu extends AbstractContainerMenu { i = Math.max(item.getMaxDamage() - l, 0); itemstack2 = this.mergeEnchants(itemstack, itemstack1); if (!itemstack2.isDamageableItem()) { diff --git a/patches/server-remapped/0688-Add-recipe-to-cook-events.patch b/patches/server/0624-Add-recipe-to-cook-events.patch similarity index 55% rename from patches/server-remapped/0688-Add-recipe-to-cook-events.patch rename to patches/server/0624-Add-recipe-to-cook-events.patch index e43e7804ac..d8aaa16e04 100644 --- a/patches/server-remapped/0688-Add-recipe-to-cook-events.patch +++ b/patches/server/0624-Add-recipe-to-cook-events.patch @@ -5,40 +5,40 @@ Subject: [PATCH] Add recipe to cook events diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -index f47b46cebd43faa509b8139d2a51cc8f87615893..2dcabfc765cbf6341546a7e2c48156fd921fcc82 100644 +index f1e44b57f8c77ee279b4be0853923dcd95f71f0a..7b17cc405acab015d9fb1fe233875c6b17bf782d 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -@@ -393,7 +393,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -407,7 +407,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit CraftItemStack source = CraftItemStack.asCraftMirror(itemstack); org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1); -- FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(this.level.getWorld().getBlockAt(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ()), source, result); -+ FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(this.level.getWorld().getBlockAt(worldPosition.getX(), worldPosition.getY(), worldPosition.getZ()), source, result, (org.bukkit.inventory.CookingRecipe) recipe.toBukkitRecipe()); // Paper - this.level.getCraftServer().getPluginManager().callEvent(furnaceSmeltEvent); +- FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(CraftBlock.at(world, blockposition), source, result); ++ FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(CraftBlock.at(world, blockposition), source, result, (org.bukkit.inventory.CookingRecipe) irecipe.toBukkitRecipe()); // Paper + world.getCraftServer().getPluginManager().callEvent(furnaceSmeltEvent); if (furnaceSmeltEvent.isCancelled()) { diff --git a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java -index 6c38361d744eae763b6c131ad314485f5a88fcfc..39b4782df965c785be7946d6964e0b7a4381ff74 100644 +index ad35d82f03f7643507dde6adbb38c911d12ec6c1..9f00de75b6f206c11ce7d1c59ba98fafe02fa9ab 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java -@@ -73,7 +73,10 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable, Ticka +@@ -53,7 +53,10 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { - if (this.cookingProgress[i] >= this.cookingTime[i]) { + if (campfire.cookingProgress[i] >= campfire.cookingTime[i]) { SimpleContainer inventorysubcontainer = new SimpleContainer(new ItemStack[]{itemstack}); -- ItemStack itemstack1 = (ItemStack) this.level.getRecipeManager().getRecipeFor(RecipeType.CAMPFIRE_COOKING, inventorysubcontainer, this.level).map((recipecampfire) -> { +- ItemStack itemstack1 = (ItemStack) world.getRecipeManager().getRecipeFor(RecipeType.CAMPFIRE_COOKING, inventorysubcontainer, world).map((recipecampfire) -> { + // Paper start -+ Optional recipe = this.level.getRecipeManager().getRecipeFor(RecipeType.CAMPFIRE_COOKING, inventorysubcontainer, this.level); ++ Optional recipe = world.getRecipeManager().getRecipeFor(RecipeType.CAMPFIRE_COOKING, inventorysubcontainer, world); + ItemStack itemstack1 = (ItemStack) recipe.map((recipecampfire) -> { + // Paper end return recipecampfire.assemble(inventorysubcontainer); }).orElse(itemstack); - BlockPos blockposition = this.getBlockPos(); -@@ -82,7 +85,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable, Ticka + +@@ -61,7 +64,7 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { CraftItemStack source = CraftItemStack.asCraftMirror(itemstack); org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1); -- BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(this.level, this.worldPosition), source, result); -+ BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(this.level, this.worldPosition), source, result, (org.bukkit.inventory.CookingRecipe) recipe.map(CampfireCookingRecipe::toBukkitRecipe).orElse(null)); // Paper - this.level.getCraftServer().getPluginManager().callEvent(blockCookEvent); +- BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, pos), source, result); ++ BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, pos), source, result, (org.bukkit.inventory.CookingRecipe) recipe.map(CampfireCookingRecipe::toBukkitRecipe).orElse(null)); // Paper + world.getCraftServer().getPluginManager().callEvent(blockCookEvent); if (blockCookEvent.isCancelled()) { diff --git a/patches/server-remapped/0689-Add-Block-isValidTool.patch b/patches/server/0625-Add-Block-isValidTool.patch similarity index 79% rename from patches/server-remapped/0689-Add-Block-isValidTool.patch rename to patches/server/0625-Add-Block-isValidTool.patch index a9fe23e278..7a3a143aeb 100644 --- a/patches/server-remapped/0689-Add-Block-isValidTool.patch +++ b/patches/server/0625-Add-Block-isValidTool.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add Block#isValidTool diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 376b0497c28a35d7ea615397c87b2558b95c596a..def19e23996b85e1e540cd5edc6821ae0ae37f91 100644 +index f69ad3ccfe885f3acde930ea844d3bc471ce661b..2f50a731216780ee6d592370c49f3a7a4d93948a 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -@@ -803,5 +803,9 @@ public class CraftBlock implements Block { +@@ -819,5 +819,9 @@ public class CraftBlock implements Block { } return speed; } diff --git a/patches/server-remapped/0690-Allow-using-signs-inside-spawn-protection.patch b/patches/server/0626-Allow-using-signs-inside-spawn-protection.patch similarity index 68% rename from patches/server-remapped/0690-Allow-using-signs-inside-spawn-protection.patch rename to patches/server/0626-Allow-using-signs-inside-spawn-protection.patch index fa0bc9f104..1c8a0a68b4 100644 --- a/patches/server-remapped/0690-Allow-using-signs-inside-spawn-protection.patch +++ b/patches/server/0626-Allow-using-signs-inside-spawn-protection.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allow using signs inside spawn protection diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index eb367b8feda8219a97a547c3ef6ab82d278d2f25..108a005c296c4ed370de4af636163088971bed13 100644 +index caa15973d78e21725b5dd9e5fc91cede4cc0dac4..46601a98d9f06c6cfadc8120bcffab081ca7f557 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -811,4 +811,9 @@ public class PaperWorldConfig { +@@ -699,5 +699,10 @@ public class PaperWorldConfig { fixWitherTargetingBug = getBoolean("fix-wither-targeting-bug", false); log("Withers properly target players: " + fixWitherTargetingBug); } @@ -18,24 +18,17 @@ index eb367b8feda8219a97a547c3ef6ab82d278d2f25..108a005c296c4ed370de4af636163088 + allowUsingSignsInsideSpawnProtection = getBoolean("allow-using-signs-inside-spawn-protection", allowUsingSignsInsideSpawnProtection); + } } + diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index cb6568b622abeb939a1195f4656accc8a1c3f1fc..1add53082ab9382cb2e90dc8305b8c71ef1c6a46 100644 +index 8051cc5950b71f284e7ad8be685977fd098fe022..f5de1e31b62a4e04b865ab041e122d33c7efd54e 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -152,6 +152,7 @@ import net.minecraft.world.level.Level; - import net.minecraft.world.level.LevelReader; - import net.minecraft.world.level.block.Blocks; - import net.minecraft.world.level.block.CommandBlock; -+import net.minecraft.world.level.block.SignBlock; - import net.minecraft.world.level.block.entity.BlockEntity; - import net.minecraft.world.level.block.entity.CommandBlockEntity; - import net.minecraft.world.level.block.entity.JigsawBlockEntity; -@@ -1690,7 +1691,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -1723,7 +1723,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + int i = this.player.level.getMaxBuildHeight(); - this.player.resetLastActionTime(); - if (blockposition.getY() < this.server.getMaxBuildHeight()) { + if (blockposition.getY() < i) { - if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract((net.minecraft.world.entity.player.Player) this.player, blockposition)) { -+ if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && (worldserver.mayInteract((net.minecraft.world.entity.player.Player) this.player, blockposition) || (worldserver.paperConfig.allowUsingSignsInsideSpawnProtection && worldserver.getBlockState(blockposition).getBlock() instanceof SignBlock))) { // Paper ++ if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && (worldserver.mayInteract((net.minecraft.world.entity.player.Player) this.player, blockposition) || (worldserver.paperConfig.allowUsingSignsInsideSpawnProtection && worldserver.getBlockState(blockposition).getBlock() instanceof net.minecraft.world.level.block.SignBlock))) { // Paper // CraftBukkit start - Check if we can actually do something over this large a distance // Paper - move check up this.player.stopUsingItem(); // SPIGOT-4706 diff --git a/patches/server/0627-Implement-Keyed-on-World.patch b/patches/server/0627-Implement-Keyed-on-World.patch new file mode 100644 index 0000000000..8b4d4dd266 --- /dev/null +++ b/patches/server/0627-Implement-Keyed-on-World.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Wed, 6 Jan 2021 00:34:04 -0800 +Subject: [PATCH] Implement Keyed on World + + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 40496bc7b1ce71c898078f7713600ac05922dcf1..bd7db12503c3175c3bd71f8a0fe3a826eb043000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -1155,7 +1155,7 @@ public final class CraftServer implements Server { + } else if (name.equals(levelName + "_the_end")) { + worldKey = net.minecraft.world.level.Level.END; + } else { +- worldKey = ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(name.toLowerCase(java.util.Locale.ENGLISH))); ++ worldKey = ResourceKey.create(Registry.DIMENSION_REGISTRY, new net.minecraft.resources.ResourceLocation(creator.key().getNamespace().toLowerCase(java.util.Locale.ENGLISH), creator.key().getKey().toLowerCase(java.util.Locale.ENGLISH))); // Paper + } + + ServerLevel internal = (ServerLevel) new ServerLevel(this.console, console.executor, worldSession, worlddata, worldKey, dimensionmanager, this.getServer().progressListenerFactory.create(11), +@@ -1246,6 +1246,15 @@ public final class CraftServer implements Server { + return null; + } + ++ // Paper start ++ @Override ++ public World getWorld(NamespacedKey worldKey) { ++ ServerLevel worldServer = console.getLevel(ResourceKey.create(Registry.DIMENSION_REGISTRY, CraftNamespacedKey.toMinecraft(worldKey))); ++ if (worldServer == null) return null; ++ return worldServer.getWorld(); ++ } ++ // Paper end ++ + public void addWorld(World world) { + // Check if a World already exists with the UID. + if (this.getWorld(world.getUID()) != null) { +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index c36a9eedaa587d513a3be78054d15f4ad96d4d7c..c67cd478da70b4a6f97eed6e964d74dc57e07e71 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -2584,6 +2584,11 @@ public class CraftWorld implements World { + return java.util.concurrent.CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk()); + }, net.minecraft.server.MinecraftServer.getServer()); + } ++ ++ @Override ++ public org.bukkit.NamespacedKey getKey() { ++ return org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(world.dimension().location()); ++ } + // Paper end + + // Spigot start diff --git a/patches/server-remapped/0692-Add-fast-alternative-constructor-for-Vector3f.patch b/patches/server/0628-Add-fast-alternative-constructor-for-Rotations.patch similarity index 79% rename from patches/server-remapped/0692-Add-fast-alternative-constructor-for-Vector3f.patch rename to patches/server/0628-Add-fast-alternative-constructor-for-Rotations.patch index b395761137..d2a627b5b6 100644 --- a/patches/server-remapped/0692-Add-fast-alternative-constructor-for-Vector3f.patch +++ b/patches/server/0628-Add-fast-alternative-constructor-for-Rotations.patch @@ -1,12 +1,12 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Irmo van den Berge Date: Wed, 10 Mar 2021 21:26:31 +0100 -Subject: [PATCH] Add fast alternative constructor for Vector3f +Subject: [PATCH] Add fast alternative constructor for Rotations Signed-off-by: Irmo van den Berge diff --git a/src/main/java/net/minecraft/core/Rotations.java b/src/main/java/net/minecraft/core/Rotations.java -index e3c2affb5dfaf2d78139e98c9e8a40b37c92bf2f..4782cbd9d86d8246954db76993741a8a749a7fe0 100644 +index d6b192ffa208f2bfc16238933ab2af9c61607796..dd0f0a4567a7d1749e5265649e0fa816aadd6826 100644 --- a/src/main/java/net/minecraft/core/Rotations.java +++ b/src/main/java/net/minecraft/core/Rotations.java @@ -19,6 +19,18 @@ public class Rotations { @@ -26,5 +26,5 @@ index e3c2affb5dfaf2d78139e98c9e8a40b37c92bf2f..4782cbd9d86d8246954db76993741a8a + // Paper end + public ListTag save() { - ListTag nbttaglist = new ListTag(); - + ListTag listTag = new ListTag(); + listTag.add(FloatTag.valueOf(this.x)); diff --git a/patches/server/0629-Item-Rarity-API.patch b/patches/server/0629-Item-Rarity-API.patch new file mode 100644 index 0000000000..0fc250e89d --- /dev/null +++ b/patches/server/0629-Item-Rarity-API.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Fri, 12 Mar 2021 17:09:42 -0800 +Subject: [PATCH] Item Rarity API + + +diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +index f70d7b1c9b10f59b4d9c8575b9cc35409fec11e4..6816c2a5487d96e65acacef438fa43a0e3808b99 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +@@ -470,6 +470,20 @@ public final class CraftMagicNumbers implements UnsafeValues { + public int nextEntityId() { + return net.minecraft.world.entity.Entity.nextEntityId(); + } ++ ++ @Override ++ public io.papermc.paper.inventory.ItemRarity getItemRarity(org.bukkit.Material material) { ++ Item item = getItem(material); ++ if (item == null) { ++ throw new IllegalArgumentException(material + " is not an item, and rarity does not apply to blocks"); ++ } ++ return io.papermc.paper.inventory.ItemRarity.values()[item.rarity.ordinal()]; ++ } ++ ++ @Override ++ public io.papermc.paper.inventory.ItemRarity getItemStackRarity(org.bukkit.inventory.ItemStack itemStack) { ++ return io.papermc.paper.inventory.ItemRarity.values()[getItem(itemStack.getType()).getRarity(CraftItemStack.asNMSCopy(itemStack)).ordinal()]; ++ } + // Paper end + + /** diff --git a/patches/server-remapped/0694-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch b/patches/server/0630-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch similarity index 74% rename from patches/server-remapped/0694-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch rename to patches/server/0630-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch index c076df0076..dbdfe748f0 100644 --- a/patches/server-remapped/0694-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch +++ b/patches/server/0630-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Only set despawnTimer for Wandering Traders spawned by diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index d38828485d6deb08036e11d8bf16b3d63a60fbae..f6d2aca2fe3ee9b69a0b200c8b2ea35f222fb521 100644 +index b3c07e22d4e7107ca22242661fa9ecf2d81fc9e4..2b82859d4ac43036e346220333e676998742d56d 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -319,6 +319,12 @@ public class EntityType { +@@ -334,6 +334,12 @@ public class EntityType implements EntityTypeTest { @Nullable public T spawnCreature(ServerLevel worldserver, @Nullable CompoundTag nbttagcompound, @Nullable Component ichatbasecomponent, @Nullable Player entityhuman, BlockPos blockposition, MobSpawnType enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { @@ -22,7 +22,7 @@ index d38828485d6deb08036e11d8bf16b3d63a60fbae..f6d2aca2fe3ee9b69a0b200c8b2ea35f // Paper start - Call PreCreatureSpawnEvent org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(EntityType.getKey(this).getPath()); if (type != null) { -@@ -334,6 +340,7 @@ public class EntityType { +@@ -349,6 +355,7 @@ public class EntityType implements EntityTypeTest { } // Paper end T t0 = this.create(worldserver, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1); @@ -31,28 +31,28 @@ index d38828485d6deb08036e11d8bf16b3d63a60fbae..f6d2aca2fe3ee9b69a0b200c8b2ea35f if (t0 != null) { worldserver.addAllEntities(t0, spawnReason); diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java -index 69d92590d265abe8a04d8bf48bbe9a6ae606ae50..04c4cca4be8886feb59f180915977b77f9c7dde8 100644 +index 59c4ab697ef0a336ffce19d215952f3a8ff0852b..9f9b48546fd1ae23a04cad060b6996e21354efbb 100644 --- a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java +++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java -@@ -61,7 +61,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill +@@ -60,7 +60,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill + public WanderingTrader(EntityType type, Level world) { super(type, world); - this.forcedLoading = true; - this.setDespawnDelay(48000); // CraftBukkit - set default from MobSpawnerTrader + //this.setDespawnDelay(48000); // CraftBukkit - set default from MobSpawnerTrader // Paper - move back to MobSpawnerTrader - Vanilla behavior is that only traders spawned by it have this value set. } @Override diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java -index 9074d57e1576db2da3e4c76add4f7e07e5567879..f861d83affbb0b5eaf7440a909ca3b5f7a604da7 100644 +index 60f08ecd0034e8ef2965b54b3abccce582d0ca54..f8ede3588bfda9a7d4d5807311a3e9c2651fd0a3 100644 --- a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java +++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java -@@ -114,7 +114,7 @@ public class WanderingTraderSpawner implements CustomSpawner { +@@ -121,7 +121,7 @@ public class WanderingTraderSpawner implements CustomSpawner { return false; } -- WanderingTrader entityvillagertrader = (WanderingTrader) EntityType.WANDERING_TRADER.spawnCreature(worldserver, (CompoundTag) null, (Component) null, (Player) null, blockposition2, MobSpawnType.EVENT, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit -+ WanderingTrader entityvillagertrader = EntityType.WANDERING_TRADER.spawnCreature(worldserver, null, null, null, blockposition2, MobSpawnType.EVENT, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL, trader -> trader.setDespawnDelay(48000)); // CraftBukkit // Paper - set despawnTimer before spawn events called +- WanderingTrader entityvillagertrader = (WanderingTrader) EntityType.WANDERING_TRADER.spawnCreature(world, (CompoundTag) null, (Component) null, (Player) null, blockposition2, MobSpawnType.EVENT, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit ++ WanderingTrader entityvillagertrader = EntityType.WANDERING_TRADER.spawnCreature(world, null, null, null, blockposition2, MobSpawnType.EVENT, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL, trader -> trader.setDespawnDelay(48000)); // CraftBukkit // Paper - set despawnTimer before spawn events called if (entityvillagertrader != null) { for (int i = 0; i < 2; ++i) { diff --git a/patches/server-remapped/0695-copy-TESign-isEditable-from-snapshots.patch b/patches/server/0631-copy-TESign-isEditable-from-snapshots.patch similarity index 80% rename from patches/server-remapped/0695-copy-TESign-isEditable-from-snapshots.patch rename to patches/server/0631-copy-TESign-isEditable-from-snapshots.patch index 862aed64d3..d45654d7c6 100644 --- a/patches/server-remapped/0695-copy-TESign-isEditable-from-snapshots.patch +++ b/patches/server/0631-copy-TESign-isEditable-from-snapshots.patch @@ -5,10 +5,10 @@ Subject: [PATCH] copy TESign#isEditable from snapshots diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java -index 65e8a349c80a700f63dd27b11bb2099f65cbc069..eb0739c0927e821a5080d14e762225fd4936b82d 100644 +index 6e89b039479a034d98d1ec183b06d5418ab51733..924a8278ffc27f0db5f50c16ff06ddfc3042f333 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java -@@ -109,6 +109,7 @@ public class CraftSign extends CraftBlockEntityState implements +@@ -118,6 +118,7 @@ public class CraftSign extends CraftBlockEntityState implements } // Paper end } diff --git a/patches/server-remapped/0696-Drop-carried-item-when-player-has-disconnected.patch b/patches/server/0632-Drop-carried-item-when-player-has-disconnected.patch similarity index 55% rename from patches/server-remapped/0696-Drop-carried-item-when-player-has-disconnected.patch rename to patches/server/0632-Drop-carried-item-when-player-has-disconnected.patch index 4e8128fd64..e74bd6d322 100644 --- a/patches/server-remapped/0696-Drop-carried-item-when-player-has-disconnected.patch +++ b/patches/server/0632-Drop-carried-item-when-player-has-disconnected.patch @@ -7,25 +7,17 @@ Fixes disappearance of held items, when a player gets disconnected and PlayerDro Closes #5036 diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index dd121ec8f779b3786eeb7fe85519cf9e472f5adf..23cfaf5c432221f2d1afe37ba657f723d6d21a73 100644 +index 12a10d6586b0b1d95e2b1a229f922286753f066c..b744653a7508ba2aea859709e7ea3c58fbb586cf 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -79,6 +79,7 @@ import net.minecraft.world.effect.MobEffectInstance; - import net.minecraft.world.entity.Entity; - import net.minecraft.world.entity.EntityType; - import net.minecraft.world.entity.npc.AbstractVillager; -+import net.minecraft.world.item.ItemStack; - import net.minecraft.world.level.ChunkPos; - import net.minecraft.world.level.GameRules; - import net.minecraft.world.level.GameType; -@@ -605,6 +606,14 @@ public abstract class PlayerList { +@@ -606,6 +606,14 @@ public abstract class PlayerList { } // Paper end + // Paper - Drop carried item when player has disconnected -+ if (!entityplayer.inventory.getCarried().isEmpty()) { -+ ItemStack carried = entityplayer.inventory.getCarried(); -+ entityplayer.inventory.setCarried(ItemStack.NULL_ITEM); ++ if (!entityplayer.containerMenu.getCarried().isEmpty()) { ++ net.minecraft.world.item.ItemStack carried = entityplayer.containerMenu.getCarried(); ++ entityplayer.containerMenu.setCarried(net.minecraft.world.item.ItemStack.EMPTY); + entityplayer.drop(carried, false); + } + // Paper end diff --git a/patches/server-remapped/0697-forced-whitelist-use-configurable-kick-message.patch b/patches/server/0633-forced-whitelist-use-configurable-kick-message.patch similarity index 86% rename from patches/server-remapped/0697-forced-whitelist-use-configurable-kick-message.patch rename to patches/server/0633-forced-whitelist-use-configurable-kick-message.patch index 4b433dc16c..a57d85fa8d 100644 --- a/patches/server-remapped/0697-forced-whitelist-use-configurable-kick-message.patch +++ b/patches/server/0633-forced-whitelist-use-configurable-kick-message.patch @@ -5,10 +5,10 @@ Subject: [PATCH] forced whitelist: use configurable kick message diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 9b654fed2a00740cef84cf72258abfc7aeafc0c2..fd76d776c7003585c9efef44c6d7da0f6c3f574e 100644 +index f1c1d715d509aeb13e465cd57a82896db6c51838..73ac55de9059a1d0f1da5bec0688dcd4bf5c8973 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -73,7 +73,6 @@ import net.minecraft.nbt.NbtOps; +@@ -77,7 +77,6 @@ import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.Tag; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.TextComponent; @@ -16,7 +16,7 @@ index 9b654fed2a00740cef84cf72258abfc7aeafc0c2..fd76d776c7003585c9efef44c6d7da0f import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.game.ClientboundChangeDifficultyPacket; import net.minecraft.network.protocol.game.ClientboundSetTimePacket; -@@ -2040,7 +2039,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop +Date: Mon, 5 Apr 2021 18:35:15 -0700 +Subject: [PATCH] Don't ignore result of PlayerEditBookEvent + + +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index f5de1e31b62a4e04b865ab041e122d33c7efd54e..95b229081a4d51d63f477ef7894a938584d87fd0 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -1191,7 +1191,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + } + + itemstack.addTagElement("pages", (Tag) nbttaglist); +- CraftEventFactory.handleEditBookEvent(player, slot, old, itemstack); // CraftBukkit ++ this.player.containerMenu.setItem(slot, CraftEventFactory.handleEditBookEvent(player, slot, old, itemstack)); // CraftBukkit // Paper - Don't ignore result (see other callsite for handleEditBookEvent) + } + + @Override diff --git a/patches/server/0635-fix-cancelling-block-falling-causing-client-desync.patch b/patches/server/0635-fix-cancelling-block-falling-causing-client-desync.patch new file mode 100644 index 0000000000..b3b4cf1fcb --- /dev/null +++ b/patches/server/0635-fix-cancelling-block-falling-causing-client-desync.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Trigary +Date: Sat, 27 Mar 2021 11:13:30 +0100 +Subject: [PATCH] fix cancelling block falling causing client desync + + +diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +index 2fad050547242028d4ff2deb613e074190f51341..3989ed1bd5c666aa7759ebc2c57a0d5f70d85838 100644 +--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java ++++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +@@ -119,8 +119,18 @@ public class FallingBlockEntity extends Entity { + + if (this.time++ == 0) { + blockposition = this.blockPosition(); +- if (this.level.getBlockState(blockposition).is(block) && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) { +- this.level.removeBlock(blockposition, false); ++ // Paper start - fix cancelling block falling causing client desync ++ if (this.level.getBlockState(blockposition).is(block)) { ++ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) { ++ if (this.level.getBlockState(blockposition).is(block)) { //if listener didn't update the block ++ ((ServerLevel) level).getChunkSource().blockChanged(blockposition); ++ } ++ this.discard(); ++ return; ++ } else { ++ this.level.setAir(blockposition, false); ++ } ++ // Paper end - fix cancelling block falling causing client desync + } else if (!this.level.isClientSide) { + this.discard(); + return; diff --git a/patches/server-remapped/0701-Expose-protocol-version.patch b/patches/server/0636-Expose-protocol-version.patch similarity index 82% rename from patches/server-remapped/0701-Expose-protocol-version.patch rename to patches/server/0636-Expose-protocol-version.patch index 0e4392f5f9..065e44668c 100644 --- a/patches/server-remapped/0701-Expose-protocol-version.patch +++ b/patches/server/0636-Expose-protocol-version.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Expose protocol version diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 472b0615dcdc3c0c52bd377fd69752716f354262..402e5a98290a1701dd67d27c484c97e0a6067c4f 100644 +index 6816c2a5487d96e65acacef438fa43a0e3808b99..5c49c4e671b9d44c12f8d8efcf97305a41e5dbe1 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -484,6 +484,11 @@ public final class CraftMagicNumbers implements UnsafeValues { public io.papermc.paper.inventory.ItemRarity getItemStackRarity(org.bukkit.inventory.ItemStack itemStack) { - return io.papermc.paper.inventory.ItemRarity.values()[getItem(itemStack.getType()).getItemStackRarity(CraftItemStack.asNMSCopy(itemStack)).ordinal()]; + return io.papermc.paper.inventory.ItemRarity.values()[getItem(itemStack.getType()).getRarity(CraftItemStack.asNMSCopy(itemStack)).ordinal()]; } + + @Override diff --git a/patches/server-remapped/0702-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch b/patches/server/0637-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch similarity index 93% rename from patches/server-remapped/0702-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch rename to patches/server/0637-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch index 036bfe3e5a..90d013302e 100644 --- a/patches/server-remapped/0702-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch +++ b/patches/server/0637-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch @@ -6,17 +6,17 @@ Subject: [PATCH] Allow for Component suggestion tooltips in diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 65afc23f4791aca19bff78ed86b3b0d31fa81977..67defaf71752ed29fde483e8232aa358ffa53675 100644 +index 95b229081a4d51d63f477ef7894a938584d87fd0..f5c79ec1293c72b738bb6bc1d0aa9d495eefe194 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -769,12 +769,11 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -758,12 +758,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // Paper start - async tab completion com.destroystokyo.paper.event.server.AsyncTabCompleteEvent event; - java.util.List completions = new java.util.ArrayList<>(); String buffer = packet.getCommand(); -- event = new com.destroystokyo.paper.event.server.AsyncTabCompleteEvent(this.getPlayer(), completions, -+ event = new com.destroystokyo.paper.event.server.AsyncTabCompleteEvent(this.getPlayer(), +- event = new com.destroystokyo.paper.event.server.AsyncTabCompleteEvent(this.getCraftPlayer(), completions, ++ event = new com.destroystokyo.paper.event.server.AsyncTabCompleteEvent(this.getCraftPlayer(), buffer, true, null); event.callEvent(); - completions = event.isCancelled() ? com.google.common.collect.ImmutableList.of() : event.getCompletions(); @@ -24,7 +24,7 @@ index 65afc23f4791aca19bff78ed86b3b0d31fa81977..67defaf71752ed29fde483e8232aa358 // If the event isn't handled, we can assume that we have no completions, and so we'll ask the server if (!event.isHandled()) { if (!event.isCancelled()) { -@@ -793,10 +792,16 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -782,10 +781,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser }); } } else if (!completions.isEmpty()) { @@ -42,10 +42,10 @@ index 65afc23f4791aca19bff78ed86b3b0d31fa81977..67defaf71752ed29fde483e8232aa358 + } + }); com.mojang.brigadier.suggestion.Suggestions suggestions = builder.buildFuture().join(); - com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent suggestEvent = new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent(this.getPlayer(), suggestions, buffer); + com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent suggestEvent = new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent(this.getCraftPlayer(), suggestions, buffer); suggestEvent.setCancelled(suggestions.isEmpty()); diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java -index c5e00bd9e2790992202aadf8eec2002fc88c78f1..dd8e87ad192c19743577bb95253a127072ea196c 100644 +index e5af155d75f717d33c23e22ff8b96bb3ff87844d..14cd8ae69d9b25dc5edad4ff96ff4a9acb1f22cb 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java +++ b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java @@ -29,34 +29,56 @@ public class ConsoleCommandCompleter implements Completer { diff --git a/patches/server-remapped/0703-Enhance-console-tab-completions-for-brigadier-comman.patch b/patches/server/0638-Enhance-console-tab-completions-for-brigadier-comman.patch similarity index 79% rename from patches/server-remapped/0703-Enhance-console-tab-completions-for-brigadier-comman.patch rename to patches/server/0638-Enhance-console-tab-completions-for-brigadier-comman.patch index f6416177a9..0609bfa202 100644 --- a/patches/server-remapped/0703-Enhance-console-tab-completions-for-brigadier-comman.patch +++ b/patches/server/0638-Enhance-console-tab-completions-for-brigadier-comman.patch @@ -21,18 +21,10 @@ index c56e7fb18f9a56c8025eb70a524f028b5942da37..efc1e42d606e1c9feb1a4871c0714933 + } } diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java -index a4070b59e261f0f1ac4beec47b11492f4724bf27..372a459bd08f79f10ffd1391ec492e37f1e8bb50 100644 +index a4070b59e261f0f1ac4beec47b11492f4724bf27..e0b1f0671d16ddddcb6725acd25a1d1d69e42701 100644 --- a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java +++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java -@@ -1,5 +1,7 @@ - package com.destroystokyo.paper.console; - -+import com.destroystokyo.paper.PaperConfig; -+import io.papermc.paper.console.BrigadierCommandHighlighter; - import net.minecraft.server.dedicated.DedicatedServer; - import net.minecrell.terminalconsole.SimpleTerminalConsole; - import org.bukkit.craftbukkit.command.ConsoleCommandCompleter; -@@ -16,11 +18,15 @@ public final class PaperConsole extends SimpleTerminalConsole { +@@ -16,11 +16,15 @@ public final class PaperConsole extends SimpleTerminalConsole { @Override protected LineReader buildReader(LineReaderBuilder builder) { @@ -43,8 +35,8 @@ index a4070b59e261f0f1ac4beec47b11492f4724bf27..372a459bd08f79f10ffd1391ec492e37 .completer(new ConsoleCommandCompleter(this.server)) - ); + .option(LineReader.Option.COMPLETE_IN_WORD, true); -+ if (PaperConfig.enableBrigadierConsoleHighlighting) { -+ builder.highlighter(new BrigadierCommandHighlighter(this.server, this.server.createCommandSourceStack())); ++ if (com.destroystokyo.paper.PaperConfig.enableBrigadierConsoleHighlighting) { ++ builder.highlighter(new io.papermc.paper.console.BrigadierCommandHighlighter(this.server, this.server.createCommandSourceStack())); + } + return super.buildReader(builder); } @@ -52,7 +44,7 @@ index a4070b59e261f0f1ac4beec47b11492f4724bf27..372a459bd08f79f10ffd1391ec492e37 @Override diff --git a/src/main/java/io/papermc/paper/console/BrigadierCommandCompleter.java b/src/main/java/io/papermc/paper/console/BrigadierCommandCompleter.java new file mode 100644 -index 0000000000000000000000000000000000000000..2768028750fb9a95b3f3b409d047be14bb0083d5 +index 0000000000000000000000000000000000000000..d3f80b5dcd366c5b8a48cb885d825d243b01ac4c --- /dev/null +++ b/src/main/java/io/papermc/paper/console/BrigadierCommandCompleter.java @@ -0,0 +1,95 @@ @@ -92,7 +84,7 @@ index 0000000000000000000000000000000000000000..2768028750fb9a95b3f3b409d047be14 + this.addCandidates(candidates, Collections.emptyList(), existing); + return; + } -+ final CommandDispatcher dispatcher = this.server.getCommands().dispatcher(); ++ final CommandDispatcher dispatcher = this.server.getCommands().getDispatcher(); + final ParseResults results = dispatcher.parse(prepareStringReader(line.line()), this.commandSourceStack); + this.addCandidates( + candidates, @@ -153,7 +145,7 @@ index 0000000000000000000000000000000000000000..2768028750fb9a95b3f3b409d047be14 +} diff --git a/src/main/java/io/papermc/paper/console/BrigadierCommandHighlighter.java b/src/main/java/io/papermc/paper/console/BrigadierCommandHighlighter.java new file mode 100644 -index 0000000000000000000000000000000000000000..812027fb84e1b7825f2dd0fb6fa33831367c2dc0 +index 0000000000000000000000000000000000000000..f33e9376bd166ebdb3d9f8c7467cd923ea0aadeb --- /dev/null +++ b/src/main/java/io/papermc/paper/console/BrigadierCommandHighlighter.java @@ -0,0 +1,57 @@ @@ -184,7 +176,7 @@ index 0000000000000000000000000000000000000000..812027fb84e1b7825f2dd0fb6fa33831 + @Override + public AttributedString highlight(final @NonNull LineReader reader, final @NonNull String buffer) { + final AttributedStringBuilder builder = new AttributedStringBuilder(); -+ final ParseResults results = this.server.getCommands().dispatcher().parse(BrigadierCommandCompleter.prepareStringReader(buffer), this.commandSourceStack); ++ final ParseResults results = this.server.getCommands().getDispatcher().parse(BrigadierCommandCompleter.prepareStringReader(buffer), this.commandSourceStack); + int pos = 0; + if (buffer.startsWith("/")) { + builder.append("/", AttributedStyle.DEFAULT); @@ -214,43 +206,8 @@ index 0000000000000000000000000000000000000000..812027fb84e1b7825f2dd0fb6fa33831 + return builder.toAttributedString(); + } +} -diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index 5ed78383ce247ceb24cda0335dbeae293958055c..e2f18b5bf1e091fe5fd868520a6d1bcc2669c24c 100644 ---- a/src/main/java/net/minecraft/commands/Commands.java -+++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -440,7 +440,7 @@ public class Commands { - }; - } - -- public com.mojang.brigadier.CommandDispatcher getDispatcher() { -+ public com.mojang.brigadier.CommandDispatcher getDispatcher() { return this.dispatcher(); } public com.mojang.brigadier.CommandDispatcher dispatcher() { // Paper - OBFHELPER - return this.dispatcher; - } - -diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java -index b5a59aed5d5cfbe0f75a8209b058b368b1f2b595..ed90c4348ca030d678251b0f9891d00153992f89 100644 ---- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java -+++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java -@@ -90,7 +90,7 @@ public class ComponentUtils { - TextComponent chatcomponenttext = new TextComponent(""); - boolean flag = true; - -- for (Iterator iterator = elements.iterator(); iterator.hasNext(); flag = false) { -+ for (Iterator iterator = elements.iterator(); iterator.hasNext(); flag = false) { // Paper - decompile fix - T t0 = iterator.next(); - - if (!flag) { -@@ -108,7 +108,7 @@ public class ComponentUtils { - return new TranslatableComponent("chat.square_brackets", new Object[]{text}); - } - -- public static Component fromMessage(Message message) { -+ public static Component fromMessage(Message message) { return fromMessage(message); } public static Component fromMessage(final @org.checkerframework.checker.nullness.qual.NonNull Message message) { // Paper - OBFHELPER - return (Component) (message instanceof Component ? (Component) message : new TextComponent(message.getString())); - } - } diff --git a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java -index dd8e87ad192c19743577bb95253a127072ea196c..eaad328d0d15ef450bb5a305828ce413d1eab53b 100644 +index 14cd8ae69d9b25dc5edad4ff96ff4a9acb1f22cb..b3484487fa8baa4d1dd6c595586fb26a01a2153d 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java +++ b/src/main/java/org/bukkit/craftbukkit/command/ConsoleCommandCompleter.java @@ -18,9 +18,11 @@ import org.bukkit.event.server.TabCompleteEvent; diff --git a/patches/server-remapped/0704-Fix-PlayerItemConsumeEvent-cancelling-properly.patch b/patches/server/0639-Fix-PlayerItemConsumeEvent-cancelling-properly.patch similarity index 87% rename from patches/server-remapped/0704-Fix-PlayerItemConsumeEvent-cancelling-properly.patch rename to patches/server/0639-Fix-PlayerItemConsumeEvent-cancelling-properly.patch index a86a2c1b40..a990ea2e7b 100644 --- a/patches/server-remapped/0704-Fix-PlayerItemConsumeEvent-cancelling-properly.patch +++ b/patches/server/0639-Fix-PlayerItemConsumeEvent-cancelling-properly.patch @@ -9,10 +9,10 @@ till their item is switched. This patch clears the active item when the event is cancelled diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 8bc74878919ab7cf6a50d425da61f1b8a8b0ee44..37787a725725d22b0870dcab0f3bec8b94cfd130 100644 +index 8c3fb37c511ada39dafdd19fa85e21a1b458386b..b954fcfcf3bd3c55ca856126670fa6967d525fe3 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3348,6 +3348,7 @@ public abstract class LivingEntity extends Entity { +@@ -3696,6 +3696,7 @@ public abstract class LivingEntity extends Entity { level.getCraftServer().getPluginManager().callEvent(event); if (event.isCancelled()) { diff --git a/patches/server-remapped/0705-Add-bypass-host-check.patch b/patches/server/0640-Add-bypass-host-check.patch similarity index 77% rename from patches/server-remapped/0705-Add-bypass-host-check.patch rename to patches/server/0640-Add-bypass-host-check.patch index 88f6d3d8dc..80d7b918c3 100644 --- a/patches/server-remapped/0705-Add-bypass-host-check.patch +++ b/patches/server/0640-Add-bypass-host-check.patch @@ -8,13 +8,13 @@ Paper.bypassHostCheck Seriously, fix your firewalls. -.- diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -index c648b73a4c478f9d8020274205d6684f7c7c416f..4e055a41de3ee410682cc05a3b883ac8babeb290 100644 +index 2384ae5082afd01c4f28fe2f3f782cdce15ff3f2..4c44f06ba18cfa2d889d0dd57fdd7eb79971c8c6 100644 --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java @@ -30,6 +30,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL private static final Component IGNORE_STATUS_REASON = new TextComponent("Ignoring status request"); private final MinecraftServer server; - private final Connection connection; final Connection getNetworkManager() { return this.connection; } // Paper - OBFHELPER + private final Connection connection; + private static final boolean BYPASS_HOSTCHECK = Boolean.getBoolean("Paper.bypassHostCheck"); // Paper public ServerHandshakePacketListenerImpl(MinecraftServer server, Connection connection) { @@ -23,8 +23,8 @@ index c648b73a4c478f9d8020274205d6684f7c7c416f..4e055a41de3ee410682cc05a3b883ac8 // Spigot Start //if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above! String[] split = packet.hostName.split("\00"); -- if ( ( split.length == 3 || split.length == 4 ) && ( HOST_PATTERN.matcher( split[1] ).matches() ) ) { -+ if ( ( split.length == 3 || split.length == 4 ) && ( BYPASS_HOSTCHECK || HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper +- if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { ++ if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper packet.hostName = split[0]; - connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) connection.getRemoteAddress()).getPort()); + connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort()); connection.spoofedUUID = com.mojang.util.UUIDTypeAdapter.fromString( split[2] ); diff --git a/patches/server-remapped/0707-Set-area-affect-cloud-rotation.patch b/patches/server/0641-Set-area-affect-cloud-rotation.patch similarity index 73% rename from patches/server-remapped/0707-Set-area-affect-cloud-rotation.patch rename to patches/server/0641-Set-area-affect-cloud-rotation.patch index f907ad7a6b..855fa94054 100644 --- a/patches/server-remapped/0707-Set-area-affect-cloud-rotation.patch +++ b/patches/server/0641-Set-area-affect-cloud-rotation.patch @@ -5,14 +5,14 @@ Subject: [PATCH] Set area affect cloud rotation diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index b0212b2043ee5fd77c8876ef0b51ef91488712f0..b44e83d93bba579e439b93e5093350675137b070 100644 +index c67cd478da70b4a6f97eed6e964d74dc57e07e71..4f07a3385930b2f18dc642261a9d5ebe036ec932 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1959,6 +1959,7 @@ public class CraftWorld implements World { +@@ -1974,6 +1974,7 @@ public class CraftWorld implements World { entity = net.minecraft.world.entity.EntityType.LIGHTNING_BOLT.create(world); } else if (AreaEffectCloud.class.isAssignableFrom(clazz)) { - entity = new net.minecraft.world.entity.AreaEffectCloud(world, x, y, z); + entity = new net.minecraft.world.entity.AreaEffectCloud(this.world, x, y, z); + entity.moveTo(x, y, z, yaw, pitch); // Paper - Set area effect cloud Rotation } else if (EvokerFangs.class.isAssignableFrom(clazz)) { - entity = new net.minecraft.world.entity.projectile.EvokerFangs(world, x, y, z, (float) Math.toRadians(yaw), 0, null); - } + entity = new net.minecraft.world.entity.projectile.EvokerFangs(this.world, x, y, z, (float) Math.toRadians(yaw), 0, null); + } else if (Marker.class.isAssignableFrom(clazz)) { diff --git a/patches/server-remapped/0708-add-isDeeplySleeping-to-HumanEntity.patch b/patches/server/0642-add-isDeeplySleeping-to-HumanEntity.patch similarity index 78% rename from patches/server-remapped/0708-add-isDeeplySleeping-to-HumanEntity.patch rename to patches/server/0642-add-isDeeplySleeping-to-HumanEntity.patch index 75f3e9118b..4a64a4a56c 100644 --- a/patches/server-remapped/0708-add-isDeeplySleeping-to-HumanEntity.patch +++ b/patches/server/0642-add-isDeeplySleeping-to-HumanEntity.patch @@ -5,10 +5,10 @@ Subject: [PATCH] add isDeeplySleeping to HumanEntity diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index aceb57c93c91730345f49f78838780c41ce2dcef..0559f2cfab817e989c02ce2d13bcdabb8ad3b82b 100644 +index 021394a0e668d2cfccd8617d4aee79147181fa22..3ab8bd503a599a11c0d50017826cebf6765197f3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -@@ -122,6 +122,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { +@@ -121,6 +121,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { } } @@ -21,4 +21,4 @@ index aceb57c93c91730345f49f78838780c41ce2dcef..0559f2cfab817e989c02ce2d13bcdabb + @Override public int getSleepTicks() { - return getHandle().sleepCounter; + return this.getHandle().sleepCounter; diff --git a/patches/server/0643-Fix-duplicating-give-items-on-item-drop-cancel.patch b/patches/server/0643-Fix-duplicating-give-items-on-item-drop-cancel.patch new file mode 100644 index 0000000000..ee7bccc6af --- /dev/null +++ b/patches/server/0643-Fix-duplicating-give-items-on-item-drop-cancel.patch @@ -0,0 +1,70 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alphaesia +Date: Fri, 23 Apr 2021 09:57:56 +1200 +Subject: [PATCH] Fix duplicating /give items on item drop cancel + +Fixes SPIGOT-2942 (Give command fires PlayerDropItemEvent, cancelling it causes item duplication). + +For every stack of items to give, /give puts the item stack straight +into the player's inventory. However, it also summons a "fake item" +at the player's location. When the PlayerDropItemEvent for this fake +item is cancelled, the server attempts to put the item back into the +player's inventory. The result is that the fake item, which is never +meant to be obtained, is combined with the real items injected directly +into the player's inventory. This means more items than the amount +specified in /give are given to the player - one for every stack of +items given. (e.g. /give @s dirt 1 gives you 2 dirt). + +While this isn't a big issue for general building usage, it can affect +e.g. adventure maps where the number of items the player receives is +important (and you want to restrict the player from throwing items). + +If there are any overflow items that didn't make it into the inventory +(insufficient space), those items are dropped as a real item instead +of a fake one. While cancelling this drop would also result in the +server attempting to put those items into the inventory, since it is +full this has no effect. + +Just ignoring cancellation of the PlayerDropItemEvent seems like the +cleanest and least intrusive way to fix it. + +diff --git a/src/main/java/net/minecraft/server/commands/GiveCommand.java b/src/main/java/net/minecraft/server/commands/GiveCommand.java +index 58941830a4bd024fcdb97df47783c82062e9167f..a0dc380e90415de9068ea408d62a1605c82631df 100644 +--- a/src/main/java/net/minecraft/server/commands/GiveCommand.java ++++ b/src/main/java/net/minecraft/server/commands/GiveCommand.java +@@ -47,7 +47,7 @@ public class GiveCommand { + boolean bl = serverPlayer.getInventory().add(itemStack); + if (bl && itemStack.isEmpty()) { + itemStack.setCount(1); +- ItemEntity itemEntity2 = serverPlayer.drop(itemStack, false); ++ ItemEntity itemEntity2 = serverPlayer.drop(itemStack, false, false, true); // Paper - Fix duplicating /give items on item drop cancel + if (itemEntity2 != null) { + itemEntity2.makeFakeItem(); + } +diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java +index b916f629c2a0fb018cba19aaa612cbbcbb597dc1..c0b18656637cdc1ee6938c70aa281a71551e75dd 100644 +--- a/src/main/java/net/minecraft/world/entity/player/Player.java ++++ b/src/main/java/net/minecraft/world/entity/player/Player.java +@@ -689,6 +689,13 @@ public abstract class Player extends LivingEntity { + + @Nullable + public ItemEntity drop(ItemStack stack, boolean throwRandomly, boolean retainOwnership) { ++ // Paper start - Fix duplicating /give items on item drop cancel ++ return this.drop(stack, throwRandomly, retainOwnership, false); ++ } ++ ++ @Nullable ++ public ItemEntity drop(ItemStack stack, boolean throwRandomly, boolean retainOwnership, boolean alwaysSucceed) { ++ // Paper end + if (stack.isEmpty()) { + return null; + } else { +@@ -730,7 +737,7 @@ public abstract class Player extends LivingEntity { + PlayerDropItemEvent event = new PlayerDropItemEvent(player, drop); + this.level.getCraftServer().getPluginManager().callEvent(event); + +- if (event.isCancelled()) { ++ if (event.isCancelled() && !alwaysSucceed) { // Paper - Fix duplicating /give items on item drop cancel + org.bukkit.inventory.ItemStack cur = player.getInventory().getItemInHand(); + if (retainOwnership && (cur == null || cur.getAmount() == 0)) { + // The complete stack was dropped diff --git a/patches/server-remapped/0710-add-consumeFuel-to-FurnaceBurnEvent.patch b/patches/server/0644-add-consumeFuel-to-FurnaceBurnEvent.patch similarity index 51% rename from patches/server-remapped/0710-add-consumeFuel-to-FurnaceBurnEvent.patch rename to patches/server/0644-add-consumeFuel-to-FurnaceBurnEvent.patch index f9cc308842..fe66bf1885 100644 --- a/patches/server-remapped/0710-add-consumeFuel-to-FurnaceBurnEvent.patch +++ b/patches/server/0644-add-consumeFuel-to-FurnaceBurnEvent.patch @@ -5,15 +5,15 @@ Subject: [PATCH] add consumeFuel to FurnaceBurnEvent diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -index 2dcabfc765cbf6341546a7e2c48156fd921fcc82..6e4feb2280021c26dbbfb92feb08c95165e126fe 100644 +index 7b17cc405acab015d9fb1fe233875c6b17bf782d..de53c9652fd6103c4ee5bdb9304979b675cb2bd7 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -@@ -329,7 +329,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit - if (this.isLit() && furnaceBurnEvent.isBurning()) { - // CraftBukkit end - flag1 = true; -- if (!itemstack.isEmpty()) { -+ if (!itemstack.isEmpty() && furnaceBurnEvent.willConsumeFuel()) { // Paper - Item item = itemstack.getItem(); +@@ -340,7 +340,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit + if (blockEntity.isLit() && furnaceBurnEvent.isBurning()) { + // CraftBukkit end + flag1 = true; +- if (!itemstack.isEmpty()) { ++ if (!itemstack.isEmpty() && furnaceBurnEvent.willConsumeFuel()) { // Paper + Item item = itemstack.getItem(); - itemstack.shrink(1); + itemstack.shrink(1); diff --git a/patches/server-remapped/0711-add-get-set-drop-chance-to-EntityEquipment.patch b/patches/server/0645-add-get-set-drop-chance-to-EntityEquipment.patch similarity index 88% rename from patches/server-remapped/0711-add-get-set-drop-chance-to-EntityEquipment.patch rename to patches/server/0645-add-get-set-drop-chance-to-EntityEquipment.patch index c18ac532d5..db1374a99b 100644 --- a/patches/server-remapped/0711-add-get-set-drop-chance-to-EntityEquipment.patch +++ b/patches/server/0645-add-get-set-drop-chance-to-EntityEquipment.patch @@ -5,12 +5,12 @@ Subject: [PATCH] add get-set drop chance to EntityEquipment diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java -index e8d6e1abf29a5c50e1cafa01c602f36596d42ecf..9841b4ed648b95272feee45e6f1e8fd9399c322e 100644 +index cd882ef5c6b3e0e33c0caeda534928a7ee168c54..c9c85d7a7257c535e6360499893b3dd392608687 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftEntityEquipment.java @@ -244,6 +244,17 @@ public class CraftEntityEquipment implements EntityEquipment { public void setBootsDropChance(float chance) { - setDropChance(net.minecraft.world.entity.EquipmentSlot.FEET, chance); + this.setDropChance(net.minecraft.world.entity.EquipmentSlot.FEET, chance); } + // Paper start + @Override @@ -27,7 +27,7 @@ index e8d6e1abf29a5c50e1cafa01c602f36596d42ecf..9841b4ed648b95272feee45e6f1e8fd9 private void setDropChance(net.minecraft.world.entity.EquipmentSlot slot, float chance) { if (slot == net.minecraft.world.entity.EquipmentSlot.MAINHAND || slot == net.minecraft.world.entity.EquipmentSlot.OFFHAND) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java -index 7a8181f559cc3c92c3b3aa2ff8eda515719eba08..c326a75728fffbab301654afd94b6839c009fe93 100644 +index 5ae4f2b6cfa4067a0589d6f909ac6a7d9b48fd6f..3354d13f657cecfc3cc756a99accd5d481e8b1dd 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java @@ -354,4 +354,15 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i diff --git a/patches/server-remapped/0712-fix-PigZombieAngerEvent-cancellation.patch b/patches/server/0646-fix-PigZombieAngerEvent-cancellation.patch similarity index 60% rename from patches/server-remapped/0712-fix-PigZombieAngerEvent-cancellation.patch rename to patches/server/0646-fix-PigZombieAngerEvent-cancellation.patch index 5d4feaac2c..20531d6207 100644 --- a/patches/server-remapped/0712-fix-PigZombieAngerEvent-cancellation.patch +++ b/patches/server/0646-fix-PigZombieAngerEvent-cancellation.patch @@ -4,31 +4,19 @@ Date: Thu, 18 Mar 2021 21:38:01 +0100 Subject: [PATCH] fix PigZombieAngerEvent cancellation -diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java b/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java -index f85dfd8b57cf81ad7c6b12753fdd42e93f772f9e..16f4dbfd21a287bad3e10c174fa77a1cac771afa 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java -+++ b/src/main/java/net/minecraft/world/entity/ai/goal/Goal.java -@@ -28,6 +28,7 @@ public abstract class Goal { - - public void start() { this.start(); } public void start() {} // Paper - OBFHELPER - -+ public final void onTaskResetObfHelper() { stop(); } // Paper - OBFHELPER - public void stop() { - onTaskReset(); // Paper - } diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java b/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java -index d1cbbfbf9d3c5e65785aad00c2292245a5de1422..d67a50740b1c6d4ecd49a5541d24d1e4bacb8887 100644 +index 7853fbad01bea710e06bdf3198895f2492bdbd10..233b390541acddcf815db4a8f299496eaea4f758 100644 --- a/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java -@@ -49,6 +49,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { - private UUID persistentAngerTarget; - private static final IntRange ALERT_INTERVAL = TimeUtil.rangeOfSeconds(4, 6); +@@ -51,6 +51,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { + private static final int ALERT_RANGE_Y = 10; + private static final UniformInt ALERT_INTERVAL = TimeUtil.rangeOfSeconds(4, 6); private int ticksUntilNextAlert; + private HurtByTargetGoal pathfinderGoalHurtByTarget; // Paper public ZombifiedPiglin(EntityType type, Level world) { super(type, world); -@@ -69,7 +70,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { +@@ -71,7 +72,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { protected void addBehaviourGoals() { this.goalSelector.addGoal(2, new ZombieAttackGoal(this, 1.0D, false)); this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0D)); @@ -37,11 +25,11 @@ index d1cbbfbf9d3c5e65785aad00c2292245a5de1422..d67a50740b1c6d4ecd49a5541d24d1e4 this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt)); this.targetSelector.addGoal(3, new ResetUniversalAngerTargetGoal<>(this, true)); } -@@ -172,6 +173,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { +@@ -174,6 +175,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { this.level.getCraftServer().getPluginManager().callEvent(event); if (event.isCancelled()) { this.setPersistentAngerTarget(null); -+ pathfinderGoalHurtByTarget.onTaskResetObfHelper(); // Paper - clear goalTargets to fix cancellation ++ pathfinderGoalHurtByTarget.stop(); // Paper - clear goalTargets to fix cancellation return; } this.setRemainingPersistentAngerTime(event.getNewAnger()); diff --git a/patches/server-remapped/0713-Fix-checkReach-check-for-Shulker-boxes.patch b/patches/server/0647-Fix-checkReach-check-for-Shulker-boxes.patch similarity index 82% rename from patches/server-remapped/0713-Fix-checkReach-check-for-Shulker-boxes.patch rename to patches/server/0647-Fix-checkReach-check-for-Shulker-boxes.patch index 38d7d768a3..1449209449 100644 --- a/patches/server-remapped/0713-Fix-checkReach-check-for-Shulker-boxes.patch +++ b/patches/server/0647-Fix-checkReach-check-for-Shulker-boxes.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix checkReach check for Shulker boxes diff --git a/src/main/java/net/minecraft/world/inventory/ShulkerBoxMenu.java b/src/main/java/net/minecraft/world/inventory/ShulkerBoxMenu.java -index c40518b0e4ad2b043a9acc858413648d6419f3a3..4b7814a31deeef31e877cee96f0d51b348e7a281 100644 +index b6235e4fe95ba5f19d5897010bf74245336d372d..4739515ca5c8d88283f24214c74ebf4fbd203677 100644 --- a/src/main/java/net/minecraft/world/inventory/ShulkerBoxMenu.java +++ b/src/main/java/net/minecraft/world/inventory/ShulkerBoxMenu.java -@@ -65,6 +65,7 @@ public class ShulkerBoxMenu extends AbstractContainerMenu { +@@ -66,6 +66,7 @@ public class ShulkerBoxMenu extends AbstractContainerMenu { @Override public boolean stillValid(Player player) { diff --git a/patches/server/0648-fix-PlayerItemHeldEvent-firing-twice.patch b/patches/server/0648-fix-PlayerItemHeldEvent-firing-twice.patch new file mode 100644 index 0000000000..21430d3a83 --- /dev/null +++ b/patches/server/0648-fix-PlayerItemHeldEvent-firing-twice.patch @@ -0,0 +1,18 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: chickeneer +Date: Thu, 22 Apr 2021 19:02:07 -0700 +Subject: [PATCH] fix PlayerItemHeldEvent firing twice + + +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index f5c79ec1293c72b738bb6bc1d0aa9d495eefe194..b154aa2d151babbe4341c6dbaec1753d1472215c 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -1927,6 +1927,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); + if (this.player.isImmobile()) return; // CraftBukkit + if (packet.getSlot() >= 0 && packet.getSlot() < Inventory.getSelectionSize()) { ++ if (packet.getSlot() == this.player.getInventory().selected) { return; } // Paper - don't fire itemheldevent when there wasn't a slot change + PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getCraftPlayer(), this.player.getInventory().selected, packet.getSlot()); + this.cserver.getPluginManager().callEvent(event); + if (event.isCancelled()) { diff --git a/patches/server-remapped/0715-Added-PlayerDeepSleepEvent.patch b/patches/server/0649-Added-PlayerDeepSleepEvent.patch similarity index 85% rename from patches/server-remapped/0715-Added-PlayerDeepSleepEvent.patch rename to patches/server/0649-Added-PlayerDeepSleepEvent.patch index 14d231bf04..70b0dcea3c 100644 --- a/patches/server-remapped/0715-Added-PlayerDeepSleepEvent.patch +++ b/patches/server/0649-Added-PlayerDeepSleepEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Added PlayerDeepSleepEvent diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index cfb9bd6b9863a0f6f0f50181b7553adce90cfebe..c0d2ca1daca0c0c6f21334bc4d9d039440efc453 100644 +index c0b18656637cdc1ee6938c70aa281a71551e75dd..20b286fc905fa77f0d862305b73f3f74f73cfccd 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -232,6 +232,11 @@ public abstract class Player extends LivingEntity { +@@ -247,6 +247,11 @@ public abstract class Player extends LivingEntity { if (this.isSleeping()) { ++this.sleepCounter; diff --git a/patches/server/0650-More-World-API.patch b/patches/server/0650-More-World-API.patch new file mode 100644 index 0000000000..98c56ec734 --- /dev/null +++ b/patches/server/0650-More-World-API.patch @@ -0,0 +1,86 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Tue, 7 Jul 2020 10:52:34 -0700 +Subject: [PATCH] More World API + + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index 4f07a3385930b2f18dc642261a9d5ebe036ec932..8a9d367cfcf49f80f05633d16a7019798fc808ec 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -2533,6 +2533,75 @@ public class CraftWorld implements World { + return (nearest == null) ? null : new Location(this, nearest.getX(), nearest.getY(), nearest.getZ()); + } + ++ // Paper start ++ @Override ++ public Location locateNearestBiome(Location origin, Biome biome, int radius) { ++ return this.locateNearestBiome(origin, biome, radius, 8); ++ } ++ ++ @Override ++ public Location locateNearestBiome(Location origin, Biome biome, int radius, int step) { ++ BlockPos originPos = new BlockPos(origin.getX(), origin.getY(), origin.getZ()); ++ BlockPos nearest = getHandle().findNearestBiome(CraftBlock.biomeToBiomeBase(getHandle().registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), biome), originPos, radius, step); ++ return (nearest == null) ? null : new Location(this, nearest.getX(), nearest.getY(), nearest.getZ()); ++ } ++ ++ @Override ++ public boolean isUltrawarm() { ++ return getHandle().dimensionType().ultraWarm(); ++ } ++ ++ @Override ++ public boolean isNatural() { ++ return getHandle().dimensionType().natural(); ++ } ++ ++ @Override ++ public double getCoordinateScale() { ++ return getHandle().dimensionType().coordinateScale(); ++ } ++ ++ @Override ++ public boolean hasSkylight() { ++ return getHandle().dimensionType().hasSkyLight(); ++ } ++ ++ @Override ++ public boolean hasBedrockCeiling() { ++ return getHandle().dimensionType().hasSkyLight(); ++ } ++ ++ @Override ++ public boolean isPiglinSafe() { ++ return getHandle().dimensionType().piglinSafe(); ++ } ++ ++ @Override ++ public boolean doesBedWork() { ++ return getHandle().dimensionType().bedWorks(); ++ } ++ ++ @Override ++ public boolean doesRespawnAnchorWork() { ++ return getHandle().dimensionType().respawnAnchorWorks(); ++ } ++ ++ @Override ++ public boolean hasRaids() { ++ return getHandle().dimensionType().hasRaids(); ++ } ++ ++ @Override ++ public boolean isFixedTime() { ++ return getHandle().dimensionType().hasFixedTime(); ++ } ++ ++ @Override ++ public Collection getInfiniburn() { ++ return com.google.common.collect.Sets.newHashSet(com.google.common.collect.Iterators.transform(getHandle().dimensionType().infiniburn().getValues().iterator(), CraftMagicNumbers::getMaterial)); ++ } ++ // Paper end ++ + @Override + public Raid locateNearestRaid(Location location, int radius) { + Validate.notNull(location, "Location cannot be null"); diff --git a/patches/server-remapped/0717-Added-PlayerBedFailEnterEvent.patch b/patches/server/0651-Added-PlayerBedFailEnterEvent.patch similarity index 50% rename from patches/server-remapped/0717-Added-PlayerBedFailEnterEvent.patch rename to patches/server/0651-Added-PlayerBedFailEnterEvent.patch index 87c355341c..7366cdda81 100644 --- a/patches/server-remapped/0717-Added-PlayerBedFailEnterEvent.patch +++ b/patches/server/0651-Added-PlayerBedFailEnterEvent.patch @@ -4,38 +4,17 @@ Date: Thu, 24 Dec 2020 12:27:41 -0800 Subject: [PATCH] Added PlayerBedFailEnterEvent -diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index c0d2ca1daca0c0c6f21334bc4d9d039440efc453..007d9476943f5a9c75554927df941bda0f7dd6d5 100644 ---- a/src/main/java/net/minecraft/world/entity/player/Player.java -+++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -2230,6 +2230,7 @@ public abstract class Player extends LivingEntity { - this.message = ichatbasecomponent; - } - -+ public @Nullable Component getChatComponent() { return this.getMessage(); }; // Paper - OBFHELPER - @Nullable - public Component getMessage() { - return this.message; diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java -index 9dcbc0f741f5980305ae031daac70c7933bc6862..9dcf145b6d1a93785150d268828bca4bb31984c8 100644 +index dd3a4a8527b9adc5daba7540661fb88f9fbf33b2..163a7861f987c3832aac51cc6df950c768546731 100644 --- a/src/main/java/net/minecraft/world/level/block/BedBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java -@@ -43,6 +43,8 @@ import net.minecraft.world.phys.shapes.CollisionContext; - import net.minecraft.world.phys.shapes.Shapes; - import net.minecraft.world.phys.shapes.VoxelShape; - import org.apache.commons.lang3.ArrayUtils; -+import io.papermc.paper.event.player.PlayerBedFailEnterEvent; // Paper -+import io.papermc.paper.adventure.PaperAdventure; // Paper - - public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock { - -@@ -101,14 +103,23 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock +@@ -111,14 +111,23 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock BlockPos finalblockposition = pos; // CraftBukkit end player.startSleepInBed(pos).ifLeft((entityhuman_enumbedresult) -> { + // Paper start - PlayerBedFailEnterEvent + if (entityhuman_enumbedresult != null) { -+ PlayerBedFailEnterEvent event = new PlayerBedFailEnterEvent((org.bukkit.entity.Player) player.getBukkitEntity(), PlayerBedFailEnterEvent.FailReason.VALUES[entityhuman_enumbedresult.ordinal()], org.bukkit.craftbukkit.block.CraftBlock.at(world, finalblockposition), entityhuman_enumbedresult == Player.BedSleepingProblem.NOT_POSSIBLE_HERE, PaperAdventure.asAdventure(entityhuman_enumbedresult.getChatComponent())); ++ io.papermc.paper.event.player.PlayerBedFailEnterEvent event = new io.papermc.paper.event.player.PlayerBedFailEnterEvent((org.bukkit.entity.Player) player.getBukkitEntity(), io.papermc.paper.event.player.PlayerBedFailEnterEvent.FailReason.VALUES[entityhuman_enumbedresult.ordinal()], org.bukkit.craftbukkit.block.CraftBlock.at(world, finalblockposition), entityhuman_enumbedresult == Player.BedSleepingProblem.NOT_POSSIBLE_HERE, io.papermc.paper.adventure.PaperAdventure.asAdventure(entityhuman_enumbedresult.getMessage())); + if (!event.callEvent()) { + return; + } @@ -49,7 +28,7 @@ index 9dcbc0f741f5980305ae031daac70c7933bc6862..9dcf145b6d1a93785150d268828bca4b if (entityhuman_enumbedresult != null) { - player.displayClientMessage(entityhuman_enumbedresult.getMessage(), true); + final net.kyori.adventure.text.Component message = event.getMessage(); // Paper -+ if(message != null) player.displayClientMessage(PaperAdventure.asVanilla(message), true); // Paper ++ if(message != null) player.displayClientMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message), true); // Paper } + } // Paper diff --git a/patches/server-remapped/0718-Implement-methods-to-convert-between-Component-and-B.patch b/patches/server/0652-Implement-methods-to-convert-between-Component-and-B.patch similarity index 93% rename from patches/server-remapped/0718-Implement-methods-to-convert-between-Component-and-B.patch rename to patches/server/0652-Implement-methods-to-convert-between-Component-and-B.patch index e796b62074..8f31720349 100644 --- a/patches/server-remapped/0718-Implement-methods-to-convert-between-Component-and-B.patch +++ b/patches/server/0652-Implement-methods-to-convert-between-Component-and-B.patch @@ -42,10 +42,10 @@ index 0000000000000000000000000000000000000000..dd6012b6a097575b2d1471be5069ecce + } +} diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index c2947313cc0eda3247fb4b20ddd1d0b86c37c50a..0198268bc614b190cd84f625a62f6c55247a01c8 100644 +index eadacfa8449336c024f6154f46bb514d8e1230ec..f5cb59aa72dfd22ec143360a131818bef4f1b701 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -210,6 +210,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -219,6 +219,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface } com.destroystokyo.paper.PaperConfig.registerCommands(); com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // load version history now diff --git a/patches/server-remapped/0719-Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch b/patches/server/0653-Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch similarity index 79% rename from patches/server-remapped/0719-Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch rename to patches/server/0653-Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch index cf90fd18e8..3d432bc5f2 100644 --- a/patches/server-remapped/0719-Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch +++ b/patches/server/0653-Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix anchor respawn acting as a bed respawn from the end diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 23cfaf5c432221f2d1afe37ba657f723d6d21a73..a4e897171ce05736bcead319b7fda74d2b02fd2e 100644 +index b744653a7508ba2aea859709e7ea3c58fbb586cf..508fdb0b07bc4e45c630a2c4b731ffdaa3a5711a 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -867,6 +867,7 @@ public abstract class PlayerList { +@@ -841,6 +841,7 @@ public abstract class PlayerList { // Paper start boolean isBedSpawn = false; @@ -17,7 +17,7 @@ index 23cfaf5c432221f2d1afe37ba657f723d6d21a73..a4e897171ce05736bcead319b7fda74d boolean isRespawn = false; boolean isLocAltered = false; // Paper - Fix SPIGOT-5989 // Paper end -@@ -887,6 +888,7 @@ public abstract class PlayerList { +@@ -861,6 +862,7 @@ public abstract class PlayerList { if (optional.isPresent()) { BlockState iblockdata = worldserver1.getBlockState(blockposition); boolean flag3 = iblockdata.is(Blocks.RESPAWN_ANCHOR); @@ -25,12 +25,12 @@ index 23cfaf5c432221f2d1afe37ba657f723d6d21a73..a4e897171ce05736bcead319b7fda74d Vec3 vec3d = (Vec3) optional.get(); float f1; -@@ -914,7 +916,7 @@ public abstract class PlayerList { +@@ -888,7 +890,7 @@ public abstract class PlayerList { } - Player respawnPlayer = cserver.getPlayer(entityplayer1); + Player respawnPlayer = this.cserver.getPlayer(entityplayer1); - PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !flag2, flag2); + PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !isAnchorSpawn, isAnchorSpawn); // Paper - Fix anchor respawn acting as a bed respawn from the end portal - cserver.getPluginManager().callEvent(respawnEvent); + this.cserver.getPluginManager().callEvent(respawnEvent); // Spigot Start if (entityplayer.connection.isDisconnected()) { diff --git a/patches/server-remapped/0721-Introduce-beacon-activation-deactivation-events.patch b/patches/server/0654-Introduce-beacon-activation-deactivation-events.patch similarity index 63% rename from patches/server-remapped/0721-Introduce-beacon-activation-deactivation-events.patch rename to patches/server/0654-Introduce-beacon-activation-deactivation-events.patch index 57b84d6df6..45f5b0e153 100644 --- a/patches/server-remapped/0721-Introduce-beacon-activation-deactivation-events.patch +++ b/patches/server/0654-Introduce-beacon-activation-deactivation-events.patch @@ -5,26 +5,26 @@ Subject: [PATCH] Introduce beacon activation/deactivation events diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -index fed29e5707e2a7f64159d284c52647dd91e1948e..7025a27c25f8640df06a3c65c2086059769870b5 100644 +index 1df7a4a937729fc402f80021434ddf3481facd94..c1a0b0d77b8783fd127b68449a209ec0e62e6005 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -@@ -199,6 +199,15 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Tick - this.playSound(SoundEvents.BEACON_AMBIENT); +@@ -206,6 +206,15 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { + BeaconBlockEntity.playSound(world, pos, SoundEvents.BEACON_AMBIENT); } } + // Paper start - beacon activation/deactivation events -+ if (!(i1 > 0) && this.levels > 0) { -+ org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(level, worldPosition); ++ if (i1 <= 0 && blockEntity.levels > 0) { ++ org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos); + new io.papermc.paper.event.block.BeaconActivatedEvent(block).callEvent(); -+ } else if (i1 > 0 && !(this.levels > 0)) { -+ org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(level, worldPosition); ++ } else if (i1 > 0 && blockEntity.levels <= 0) { ++ org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos); + new io.papermc.paper.event.block.BeaconDeactivatedEvent(block).callEvent(); + } + // Paper end - if (this.lastCheckY >= l) { - this.lastCheckY = -1; -@@ -255,6 +264,10 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Tick + if (blockEntity.lastCheckY >= l) { + blockEntity.lastCheckY = world.getMinBuildHeight() - 1; +@@ -263,6 +272,10 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { @Override public void setRemoved() { @@ -32,6 +32,6 @@ index fed29e5707e2a7f64159d284c52647dd91e1948e..7025a27c25f8640df06a3c65c2086059 + org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(level, worldPosition); + new io.papermc.paper.event.block.BeaconDeactivatedEvent(block).callEvent(); + // Paper end - this.playSound(SoundEvents.BEACON_DEACTIVATE); + BeaconBlockEntity.playSound(this.level, this.worldPosition, SoundEvents.BEACON_DEACTIVATE); super.setRemoved(); } diff --git a/patches/server-remapped/0720-add-RespawnFlags-to-PlayerRespawnEvent.patch b/patches/server/0655-add-RespawnFlags-to-PlayerRespawnEvent.patch similarity index 81% rename from patches/server-remapped/0720-add-RespawnFlags-to-PlayerRespawnEvent.patch rename to patches/server/0655-add-RespawnFlags-to-PlayerRespawnEvent.patch index b0c5ab3263..6d960c9670 100644 --- a/patches/server-remapped/0720-add-RespawnFlags-to-PlayerRespawnEvent.patch +++ b/patches/server/0655-add-RespawnFlags-to-PlayerRespawnEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] add RespawnFlags to PlayerRespawnEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 5b0eb8744dba5df6f16bafd6d907cd1efd508fe6..a0e69cac7699ddc318057c8016e329850d3baa26 100644 +index b154aa2d151babbe4341c6dbaec1753d1472215c..e896057274434eea97d78777dcf303fd83e9cd79 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2440,7 +2440,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -2461,7 +2461,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser case PERFORM_RESPAWN: if (this.player.wonGame) { this.player.wonGame = false; @@ -18,15 +18,14 @@ index 5b0eb8744dba5df6f16bafd6d907cd1efd508fe6..a0e69cac7699ddc318057c8016e32985 } else { if (this.player.getHealth() > 0.0F) { diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index a4e897171ce05736bcead319b7fda74d2b02fd2e..6011b43ae8a858f88b8fcf6dc0bf147024a4742c 100644 +index 508fdb0b07bc4e45c630a2c4b731ffdaa3a5711a..34de9e2b0e52eb7a7e993678fd54ac1b883be4aa 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -816,7 +816,13 @@ public abstract class PlayerList { - return this.moveToWorld(player, this.server.getLevel(player.getRespawnDimension()), alive, null, true); +@@ -800,6 +800,12 @@ public abstract class PlayerList { } -+ // Paper start public ServerPlayer moveToWorld(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation) { ++ // Paper start + return moveToWorld(entityplayer, worldserver, flag, location, avoidSuffocation, new org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag[0]); + } + @@ -35,12 +34,12 @@ index a4e897171ce05736bcead319b7fda74d2b02fd2e..6011b43ae8a858f88b8fcf6dc0bf1470 entityplayer.stopRiding(); // CraftBukkit this.players.remove(entityplayer); this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot -@@ -916,7 +922,7 @@ public abstract class PlayerList { +@@ -890,7 +896,7 @@ public abstract class PlayerList { } - Player respawnPlayer = cserver.getPlayer(entityplayer1); + Player respawnPlayer = this.cserver.getPlayer(entityplayer1); - PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !isAnchorSpawn, isAnchorSpawn); // Paper - Fix anchor respawn acting as a bed respawn from the end portal + PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !isAnchorSpawn, isAnchorSpawn, com.google.common.collect.ImmutableSet.builder().add(respawnFlags)); // Paper - Fix anchor respawn acting as a bed respawn from the end portal - cserver.getPluginManager().callEvent(respawnEvent); + this.cserver.getPluginManager().callEvent(respawnEvent); // Spigot Start if (entityplayer.connection.isDisconnected()) { diff --git a/patches/server-remapped/0722-Add-Channel-initialization-listeners.patch b/patches/server/0656-Add-Channel-initialization-listeners.patch similarity index 94% rename from patches/server-remapped/0722-Add-Channel-initialization-listeners.patch rename to patches/server/0656-Add-Channel-initialization-listeners.patch index 72cbb09b5a..0fb730c943 100644 --- a/patches/server-remapped/0722-Add-Channel-initialization-listeners.patch +++ b/patches/server/0656-Add-Channel-initialization-listeners.patch @@ -106,11 +106,11 @@ index 0000000000000000000000000000000000000000..30e62719e0a83525daa33cf41cb61df3 + } +} diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index d46910cfdc0aef046a0c79731a85d381953c328a..bcc19d0a4b6c5f683dc416e27a13705b57213d21 100644 +index 8fffe354d40c5fac4daa03af87c2323e307bd3ea..9c9368628845f316e157f6ae15b89c24af082d97 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -@@ -104,6 +104,7 @@ public class ServerConnectionListener { - pending.add((Connection) object); // Paper +@@ -99,6 +99,7 @@ public class ServerConnectionListener { + ServerConnectionListener.this.connections.add((Connection) object); // CraftBukkit - decompile error channel.pipeline().addLast("packet_handler", (ChannelHandler) object); ((Connection) object).setListener(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object)); + io.papermc.paper.network.ChannelInitializeListenerHolder.callListeners(channel); // Paper diff --git a/patches/server-remapped/0723-Send-empty-commands-if-tab-completion-is-disabled.patch b/patches/server/0657-Send-empty-commands-if-tab-completion-is-disabled.patch similarity index 88% rename from patches/server-remapped/0723-Send-empty-commands-if-tab-completion-is-disabled.patch rename to patches/server/0657-Send-empty-commands-if-tab-completion-is-disabled.patch index de0a65c719..c5a368ae15 100644 --- a/patches/server-remapped/0723-Send-empty-commands-if-tab-completion-is-disabled.patch +++ b/patches/server/0657-Send-empty-commands-if-tab-completion-is-disabled.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Send empty commands if tab completion is disabled diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index e2f18b5bf1e091fe5fd868520a6d1bcc2669c24c..1d880a80348527d036b6f8b04f7dd1c4a479fcfd 100644 +index dc5d21693237ebb0b2a1ee45e92d0f191c547637..ff4f48f6646060b398e8bf90a078e7fbf84beada 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -327,7 +327,12 @@ public class Commands { +@@ -334,7 +334,12 @@ public class Commands { } public void sendCommands(ServerPlayer player) { diff --git a/patches/server-remapped/0724-Add-more-WanderingTrader-API.patch b/patches/server/0658-Add-more-WanderingTrader-API.patch similarity index 84% rename from patches/server-remapped/0724-Add-more-WanderingTrader-API.patch rename to patches/server/0658-Add-more-WanderingTrader-API.patch index b99c0c4512..f1883cfb2a 100644 --- a/patches/server-remapped/0724-Add-more-WanderingTrader-API.patch +++ b/patches/server/0658-Add-more-WanderingTrader-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add more WanderingTrader API diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java -index 04c4cca4be8886feb59f180915977b77f9c7dde8..22a695ee3f6c60d484285f1b441b809da61f2436 100644 +index 9f9b48546fd1ae23a04cad060b6996e21354efbb..c4f7c94255e4631a3c0355f9260132ba28296f50 100644 --- a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java +++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java @@ -57,6 +57,10 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill @@ -19,12 +19,12 @@ index 04c4cca4be8886feb59f180915977b77f9c7dde8..22a695ee3f6c60d484285f1b441b809d public WanderingTrader(EntityType type, Level world) { super(type, world); -@@ -68,10 +72,10 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill +@@ -67,10 +71,10 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill protected void registerGoals() { this.goalSelector.addGoal(0, new FloatGoal(this)); this.goalSelector.addGoal(0, new UseItemGoal<>(this, PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.INVISIBILITY), SoundEvents.WANDERING_TRADER_DISAPPEARED, (entityvillagertrader) -> { -- return this.world.isNight() && !entityvillagertrader.isInvisible(); -+ return canDrinkPotion && this.world.isNight() && !entityvillagertrader.isInvisible(); // Paper - Add more WanderingTrader API +- return this.level.isNight() && !entityvillagertrader.isInvisible(); ++ return this.canDrinkPotion && this.level.isNight() && !entityvillagertrader.isInvisible(); // Paper - Add more WanderingTrader API })); this.goalSelector.addGoal(0, new UseItemGoal<>(this, new ItemStack(Items.MILK_BUCKET), SoundEvents.WANDERING_TRADER_REAPPEARED, (entityvillagertrader) -> { - return this.level.isDay() && entityvillagertrader.isInvisible(); @@ -33,12 +33,12 @@ index 04c4cca4be8886feb59f180915977b77f9c7dde8..22a695ee3f6c60d484285f1b441b809d this.goalSelector.addGoal(1, new TradeWithPlayerGoal(this)); this.goalSelector.addGoal(1, new AvoidEntityGoal<>(this, Zombie.class, 8.0F, 0.5D, 0.5D)); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java -index a00b1ee5d80d3918ece2260dc1360aa90de16c8a..de58fc26bd811e87cd393bdecee796faf72e65e1 100644 +index 65b052567d1d855021d7273672b4354aba0a42a4..fa7107593b20e0151d8d67104e4a92dcc697d461 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWanderingTrader.java @@ -34,4 +34,26 @@ public class CraftWanderingTrader extends CraftAbstractVillager implements Wande public void setDespawnDelay(int despawnDelay) { - getHandle().setDespawnDelay(despawnDelay); + this.getHandle().setDespawnDelay(despawnDelay); } + + // Paper start - Add more WanderingTrader API diff --git a/patches/server-remapped/0725-Add-EntityBlockStorage-clearEntities.patch b/patches/server/0659-Add-EntityBlockStorage-clearEntities.patch similarity index 89% rename from patches/server-remapped/0725-Add-EntityBlockStorage-clearEntities.patch rename to patches/server/0659-Add-EntityBlockStorage-clearEntities.patch index 530ee44dcf..a25b644273 100644 --- a/patches/server-remapped/0725-Add-EntityBlockStorage-clearEntities.patch +++ b/patches/server/0659-Add-EntityBlockStorage-clearEntities.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add EntityBlockStorage#clearEntities() diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java -index cbd0587eeecf14b1914bdb33f7a4584bd6b5c8d0..83e5367ee1126afe31e9f704a0daedd310339d15 100644 +index 61125c1c1a6efbb3ba13a29d5e4e6bbe67df8a4e..8484e80a70129fb0358d56efab6fd54798b54e6e 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java -@@ -120,6 +120,11 @@ public class BeehiveBlockEntity extends BlockEntity implements TickableBlockEnti +@@ -135,6 +135,11 @@ public class BeehiveBlockEntity extends BlockEntity { return this.stored.size(); } diff --git a/patches/server/0660-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch b/patches/server/0660-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch new file mode 100644 index 0000000000..b63b7cfcd1 --- /dev/null +++ b/patches/server/0660-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alvinn8 <42838560+Alvinn8@users.noreply.github.com> +Date: Fri, 8 Jan 2021 20:31:13 +0100 +Subject: [PATCH] Add Adventure message to PlayerAdvancementDoneEvent + + +diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java +index 77e262f2236318e053da136037332fbe6d8bf380..d1f85b092eba829b003e39c913a4afeffc140568 100644 +--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java ++++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java +@@ -290,10 +290,18 @@ public class PlayerAdvancements { + this.progressChanged.add(advancement); + flag = true; + if (!flag1 && advancementprogress.isDone()) { +- this.player.level.getCraftServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit)); // CraftBukkit ++ // Paper start - Add Adventure message to PlayerAdvancementDoneEvent ++ boolean announceToChat = advancement.getDisplay() != null && advancement.getDisplay().shouldAnnounceChat(); ++ net.kyori.adventure.text.Component message = announceToChat ? io.papermc.paper.adventure.PaperAdventure.asAdventure(new TranslatableComponent("chat.type.advancement." + advancement.getDisplay().getFrame().getName(), this.player.getDisplayName(), advancement.getChatComponent())) : null; ++ org.bukkit.event.player.PlayerAdvancementDoneEvent event = new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit, message); ++ this.player.level.getCraftServer().getPluginManager().callEvent(event); ++ message = event.message(); ++ // Paper end + advancement.getRewards().grant(this.player); +- if (advancement.getDisplay() != null && advancement.getDisplay().shouldAnnounceChat() && this.player.level.getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) { +- this.playerList.broadcastMessage(new TranslatableComponent("chat.type.advancement." + advancement.getDisplay().getFrame().getName(), new Object[]{this.player.getDisplayName(), advancement.getChatComponent()}), ChatType.SYSTEM, Util.NIL_UUID); ++ // Paper start - Add Adventure message to PlayerAdvancementDoneEvent ++ if (message != null && this.player.level.getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) { ++ this.playerList.broadcastMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message), ChatType.SYSTEM, Util.NIL_UUID); ++ // Paper end + } + } + } diff --git a/patches/server-remapped/0727-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch b/patches/server/0661-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch similarity index 72% rename from patches/server-remapped/0727-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch rename to patches/server/0661-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch index a376cbbc19..ce5c6a07d5 100644 --- a/patches/server-remapped/0727-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch +++ b/patches/server/0661-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch @@ -5,19 +5,19 @@ Subject: [PATCH] Add raw address to AsyncPlayerPreLoginEvent diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 573963a09f15046cfcaab83aef906801ce70d75a..99275a8bc2e7bf242ff3c5b5c29924af5328327a 100644 +index 21ed58d746cb0734cc45574888ed03886e7c411a..8cc84be906fc8b50429af96c346f7114a2191535 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -325,12 +325,13 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener - // Paper end - String playerName = gameProfile.getName(); - java.net.InetAddress address = ((java.net.InetSocketAddress) connection.getRemoteAddress()).getAddress(); +@@ -346,12 +346,13 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener + // Paper end + String playerName = ServerLoginPacketListenerImpl.this.gameProfile.getName(); + java.net.InetAddress address = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.getRemoteAddress()).getAddress(); + java.net.InetAddress rawAddress = ((java.net.InetSocketAddress) connection.getRawAddress()).getAddress(); // Paper - java.util.UUID uniqueId = gameProfile.getId(); + java.util.UUID uniqueId = ServerLoginPacketListenerImpl.this.gameProfile.getId(); final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server; // Paper start - PlayerProfile profile = CraftPlayerProfile.asBukkitMirror(getGameProfile()); + PlayerProfile profile = CraftPlayerProfile.asBukkitMirror(ServerLoginPacketListenerImpl.this.gameProfile); - AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId, profile); + AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, profile); server.getPluginManager().callEvent(asyncEvent); diff --git a/patches/server-remapped/0728-Inventory-close.patch b/patches/server/0662-Inventory-close.patch similarity index 82% rename from patches/server-remapped/0728-Inventory-close.patch rename to patches/server/0662-Inventory-close.patch index f206ea0fbd..8bfd99aed9 100644 --- a/patches/server-remapped/0728-Inventory-close.patch +++ b/patches/server/0662-Inventory-close.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Inventory#close diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java -index 7ccc085228f373e6eba55d809bed480d43d5c211..16d34f44e92e26d13188417942f444952f98dfa1 100644 +index 7850dfa9130761905030856786a97a008c700687..01701e50dd0ce1c46dcc27ea7da8f51d45899a8c 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java -@@ -448,6 +448,14 @@ public class CraftInventory implements Inventory { - clear(i); +@@ -447,6 +447,14 @@ public class CraftInventory implements Inventory { + this.clear(i); } } + // Paper start diff --git a/patches/server-remapped/0729-call-PortalCreateEvent-players-and-end-platform.patch b/patches/server/0663-call-PortalCreateEvent-players-and-end-platform.patch similarity index 84% rename from patches/server-remapped/0729-call-PortalCreateEvent-players-and-end-platform.patch rename to patches/server/0663-call-PortalCreateEvent-players-and-end-platform.patch index 4776fc7a79..2488018cba 100644 --- a/patches/server-remapped/0729-call-PortalCreateEvent-players-and-end-platform.patch +++ b/patches/server/0663-call-PortalCreateEvent-players-and-end-platform.patch @@ -5,10 +5,10 @@ Subject: [PATCH] call PortalCreateEvent players and end platform diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index 727af6ac84075db87615ebac51a024e6376fa3cb..6e2a272075ead399004dabfb7d4f0ea5fd32ffc2 100644 +index fd5c22a3d281d8d913c353c8a668ec51b885066a..8c3b34b3d55af4aa8e3619a5bdf0eadb7baad029 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java -@@ -496,6 +496,7 @@ public class BlockPos extends Vec3i { +@@ -521,6 +521,7 @@ public class BlockPos extends Vec3i { return this.set(this.getX() + direction.getStepX() * distance, this.getY() + direction.getStepY() * distance, this.getZ() + direction.getStepZ() * distance); } @@ -17,10 +17,10 @@ index 727af6ac84075db87615ebac51a024e6376fa3cb..6e2a272075ead399004dabfb7d4f0ea5 return this.set(this.getX() + dx, this.getY() + dy, this.getZ() + dz); } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 314f168c9d17ab3654c9dda07e48839570f0d332..5d710a1f4e0c61d4be6efe8cebd9b80789868338 100644 +index d0e9bbecb4b0cf980116c72b96ae8edd74f9bfd6..3b5feea941eba2ee2c6d93fd5141f2f8f1dbae42 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1142,15 +1142,21 @@ public class ServerPlayer extends Player implements ContainerListener { +@@ -1166,15 +1166,21 @@ public class ServerPlayer extends Player { private void createEndPlatform(ServerLevel world, BlockPos centerPos) { BlockPos.MutableBlockPos blockposition_mutableblockposition = centerPos.mutable(); @@ -31,7 +31,7 @@ index 314f168c9d17ab3654c9dda07e48839570f0d332..5d710a1f4e0c61d4be6efe8cebd9b807 BlockState iblockdata = k == -1 ? Blocks.OBSIDIAN.defaultBlockState() : Blocks.AIR.defaultBlockState(); - world.setBlockAndUpdate(blockposition_mutableblockposition.set(centerPos).move(j, k, i), iblockdata); -+ blockList.setBlock(blockposition_mutableblockposition.setValues(centerPos).withOffset(j, k, i), iblockdata, 3); // Paper ++ blockList.setBlock(blockposition_mutableblockposition.set(centerPos).move(j, k, i), iblockdata, 3); // Paper } } } diff --git a/patches/server-remapped/0730-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch b/patches/server/0664-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch similarity index 68% rename from patches/server-remapped/0730-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch rename to patches/server/0664-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch index fb4c1ca38d..f553f149e6 100644 --- a/patches/server-remapped/0730-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch +++ b/patches/server/0664-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add a "should burn in sunlight" API for Phantoms and diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java -index 68e52e3a31e70569d1a92602aff4b7b81c594757..a8a0dba43453b7ac73e8e0faf7728445d9bcc2cd 100644 +index 6b4163f5601a0961055c8451ec7ef2204938cf69..c54a37516ef1d8a76f7161917bf448127cd98603 100644 --- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java +++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java -@@ -98,9 +98,15 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo +@@ -97,9 +97,15 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo return MobType.UNDEAD; } @@ -26,28 +26,28 @@ index 68e52e3a31e70569d1a92602aff4b7b81c594757..a8a0dba43453b7ac73e8e0faf7728445 if (flag) { ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD); -@@ -224,7 +230,16 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo - public void readAdditionalSaveData(CompoundTag tag) { - super.readAdditionalSaveData(tag); +@@ -223,7 +229,16 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo + public void readAdditionalSaveData(CompoundTag nbt) { + super.readAdditionalSaveData(nbt); this.reassessWeaponGoal(); -+ this.shouldBurnInDay = tag.getBoolean("Paper.ShouldBurnInDay"); // Paper ++ this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay"); // Paper + } + + // Paper start + @Override -+ public void addAdditionalSaveData(CompoundTag tag) { -+ super.addAdditionalSaveData(tag); -+ tag.putBoolean("Paper.ShouldBurnInDay", shouldBurnInDay); ++ public void addAdditionalSaveData(CompoundTag nbt) { ++ super.addAdditionalSaveData(nbt); ++ nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); } + // Paper end @Override public void setItemSlot(EquipmentSlot slot, ItemStack stack) { 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 a40c23e824652cff59633b7c314e27ec9a515c07..8f4dd4540330966689e71568e9e9ef77f82a786a 100644 +index 941f86b04fedaf1e3f5d04c9aa8c1cd74da9b7a2..11940597e0f9f87b5906f1d51a34e35046de1d1f 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java +++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java -@@ -134,7 +134,7 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -145,7 +145,7 @@ public class Phantom extends FlyingMob implements Enemy { @Override public void aiStep() { @@ -56,23 +56,23 @@ index a40c23e824652cff59633b7c314e27ec9a515c07..8f4dd4540330966689e71568e9e9ef77 this.setSecondsOnFire(8); } -@@ -165,6 +165,7 @@ public class Phantom extends FlyingMob implements Enemy { - if (tag.hasUUID("Paper.SpawningEntity")) { - this.spawningEntity = tag.getUUID("Paper.SpawningEntity"); +@@ -176,6 +176,7 @@ public class Phantom extends FlyingMob implements Enemy { + if (nbt.hasUUID("Paper.SpawningEntity")) { + this.spawningEntity = nbt.getUUID("Paper.SpawningEntity"); } -+ this.shouldBurnInDay = tag.getBoolean("Paper.ShouldBurnInDay"); ++ this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay"); // Paper end } -@@ -179,6 +180,7 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -190,6 +191,7 @@ public class Phantom extends FlyingMob implements Enemy { if (this.spawningEntity != null) { - tag.setUUID("Paper.SpawningEntity", this.spawningEntity); + nbt.setUUID("Paper.SpawningEntity", this.spawningEntity); } -+ tag.putBoolean("Paper.ShouldBurnInDay", shouldBurnInDay); ++ nbt.putBoolean("Paper.ShouldBurnInDay", shouldBurnInDay); // Paper end } -@@ -233,6 +235,10 @@ public class Phantom extends FlyingMob implements Enemy { +@@ -249,6 +251,10 @@ public class Phantom extends FlyingMob implements Enemy { return spawningEntity; } public void setSpawningEntity(java.util.UUID entity) { this.spawningEntity = entity; } @@ -81,13 +81,13 @@ index a40c23e824652cff59633b7c314e27ec9a515c07..8f4dd4540330966689e71568e9e9ef77 + public boolean shouldBurnInDay() { return shouldBurnInDay; } + public void setShouldBurnInDay(boolean shouldBurnInDay) { this.shouldBurnInDay = shouldBurnInDay; } // Paper end + private static enum AttackPhase { - class PhantomAttackPlayerTargetGoal extends Goal { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java -index 92162fa22f5e98b7837bde5830bd47c31b8b52d8..011ad2224a3a3a2d255b2498e406fbb047359240 100644 +index c9dab70b0b284fe1c1daafd3c1f5bd08b14fa35d..dce23f3878b1588c26b6116d80e597d08070edbc 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java -@@ -39,5 +39,15 @@ public class CraftPhantom extends CraftFlying implements Phantom { +@@ -40,5 +40,15 @@ public class CraftPhantom extends CraftFlying implements Phantom { public java.util.UUID getSpawningEntity() { return getHandle().getSpawningEntity(); } @@ -104,12 +104,12 @@ index 92162fa22f5e98b7837bde5830bd47c31b8b52d8..011ad2224a3a3a2d255b2498e406fbb0 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java -index b2d3244cca4d9d108159f3537d8a9aace3f8e77f..28dda8beb1793fad47b2c9db815c0b6cf6ed781a 100644 +index 3b19cd5a232f38d373359072925be12f6c075d4a..a248774ead0afee576af291e70a9a05d12ca203b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java -@@ -36,4 +36,16 @@ public class CraftSkeleton extends CraftMonster implements Skeleton, com.destroy - public void setSkeletonType(SkeletonType type) { - throw new UnsupportedOperationException("Not supported."); +@@ -51,4 +51,16 @@ public class CraftSkeleton extends CraftAbstractSkeleton implements Skeleton, co + public SkeletonType getSkeletonType() { + return SkeletonType.NORMAL; } + + // Paper start diff --git a/patches/server-remapped/0731-Fix-CraftPotionBrewer-cache.patch b/patches/server/0665-Fix-CraftPotionBrewer-cache.patch similarity index 72% rename from patches/server-remapped/0731-Fix-CraftPotionBrewer-cache.patch rename to patches/server/0665-Fix-CraftPotionBrewer-cache.patch index 140b30b682..2d8295382f 100644 --- a/patches/server-remapped/0731-Fix-CraftPotionBrewer-cache.patch +++ b/patches/server/0665-Fix-CraftPotionBrewer-cache.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix CraftPotionBrewer cache diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionBrewer.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionBrewer.java -index e20d96ec67dcbe935357b4de7e0e9a6984dc3303..eb28a055ba60bb1da3412cf0dbbe5ce76a779f38 100644 +index 1e4bc0d9f9d2e45157929af685f116988cbb8c03..8fdc9a3bb2f1b6bdc6c2c96f8ade7e9cd88ea4e0 100644 --- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionBrewer.java +++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionBrewer.java @@ -15,12 +15,18 @@ import org.bukkit.potion.PotionEffectType; @@ -17,15 +17,15 @@ index e20d96ec67dcbe935357b4de7e0e9a6984dc3303..eb28a055ba60bb1da3412cf0dbbe5ce7 @Override public Collection getEffects(PotionType damage, boolean upgraded, boolean extended) { -- if (cache.containsKey(damage)) -- return cache.get(damage); +- if (CraftPotionBrewer.cache.containsKey(damage)) +- return CraftPotionBrewer.cache.get(damage); + // Paper start + int key = damage.ordinal() << 2; + key |= (upgraded ? 1 : 0) << 1; + key |= extended ? 1 : 0; + -+ if (cache.containsKey(key)) -+ return cache.get(key); ++ if (CraftPotionBrewer.cache.containsKey(key)) ++ return CraftPotionBrewer.cache.get(key); + // Paper end List mcEffects = Potion.byName(CraftPotionUtil.fromBukkit(new PotionData(damage, extended, upgraded))).getEffects(); @@ -34,11 +34,11 @@ index e20d96ec67dcbe935357b4de7e0e9a6984dc3303..eb28a055ba60bb1da3412cf0dbbe5ce7 builder.add(CraftPotionUtil.toBukkit(effect)); } -- cache.put(damage, builder.build()); -+ cache.put(key, builder.build()); // Paper +- CraftPotionBrewer.cache.put(damage, builder.build()); ++ CraftPotionBrewer.cache.put(key, builder.build()); // Paper -- return cache.get(damage); -+ return cache.get(key); // Paper +- return CraftPotionBrewer.cache.get(damage); ++ return CraftPotionBrewer.cache.get(key); // Paper } @Override diff --git a/patches/server/0666-Add-basic-Datapack-API.patch b/patches/server/0666-Add-basic-Datapack-API.patch new file mode 100644 index 0000000000..5ec36d4c3b --- /dev/null +++ b/patches/server/0666-Add-basic-Datapack-API.patch @@ -0,0 +1,125 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Connor Linfoot +Date: Sun, 16 May 2021 15:07:34 +0100 +Subject: [PATCH] Add basic Datapack API + + +diff --git a/src/main/java/io/papermc/paper/datapack/PaperDatapack.java b/src/main/java/io/papermc/paper/datapack/PaperDatapack.java +new file mode 100644 +index 0000000000000000000000000000000000000000..9b7dd8a0fba4547f5268b3f99e21ddbe6b5bf566 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datapack/PaperDatapack.java +@@ -0,0 +1,50 @@ ++package io.papermc.paper.datapack; ++ ++import io.papermc.paper.event.server.ServerResourcesReloadedEvent; ++import net.minecraft.server.MinecraftServer; ++import net.minecraft.server.packs.repository.Pack; ++import java.util.List; ++import java.util.stream.Collectors; ++ ++public class PaperDatapack implements Datapack { ++ private final String name; ++ private final Compatibility compatibility; ++ private final boolean enabled; ++ ++ PaperDatapack(Pack loader, boolean enabled) { ++ this.name = loader.getId(); ++ this.compatibility = Compatibility.valueOf(loader.getCompatibility().name()); ++ this.enabled = enabled; ++ } ++ ++ @Override ++ public String getName() { ++ return name; ++ } ++ ++ @Override ++ public Compatibility getCompatibility() { ++ return compatibility; ++ } ++ ++ @Override ++ public boolean isEnabled() { ++ return enabled; ++ } ++ ++ @Override ++ public void setEnabled(boolean enabled) { ++ if (enabled == this.enabled) { ++ return; ++ } ++ ++ MinecraftServer server = MinecraftServer.getServer(); ++ List enabledKeys = server.getPackRepository().getSelectedPacks().stream().map(Pack::getId).collect(Collectors.toList()); ++ if (enabled) { ++ enabledKeys.add(this.name); ++ } else { ++ enabledKeys.remove(this.name); ++ } ++ server.reloadResources(enabledKeys, ServerResourcesReloadedEvent.Cause.PLUGIN); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/datapack/PaperDatapackManager.java b/src/main/java/io/papermc/paper/datapack/PaperDatapackManager.java +new file mode 100644 +index 0000000000000000000000000000000000000000..cf4374493c11057451a62a655514415cf6b298e0 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/datapack/PaperDatapackManager.java +@@ -0,0 +1,25 @@ ++package io.papermc.paper.datapack; ++ ++import java.util.Collection; ++import java.util.stream.Collectors; ++import net.minecraft.server.packs.repository.Pack; ++import net.minecraft.server.packs.repository.PackRepository; ++ ++public class PaperDatapackManager implements DatapackManager { ++ private final PackRepository repository; ++ ++ public PaperDatapackManager(PackRepository repository) { ++ this.repository = repository; ++ } ++ ++ @Override ++ public Collection getPacks() { ++ Collection enabledPacks = repository.getSelectedPacks(); ++ return repository.getAvailablePacks().stream().map(loader -> new PaperDatapack(loader, enabledPacks.contains(loader))).collect(Collectors.toList()); ++ } ++ ++ @Override ++ public Collection getEnabledPacks() { ++ return repository.getSelectedPacks().stream().map(loader -> new PaperDatapack(loader, true)).collect(Collectors.toList()); ++ } ++} +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index bd7db12503c3175c3bd71f8a0fe3a826eb043000..2f914ebd18764fbfd3834c0a94cedb2184f8dbb0 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -266,6 +266,7 @@ public final class CraftServer implements Server { + public boolean ignoreVanillaPermissions = false; + private final List playerView; + public int reloadCount; ++ private final io.papermc.paper.datapack.PaperDatapackManager datapackManager; // Paper + public static Exception excessiveVelEx; // Paper - Velocity warnings + + static { +@@ -349,6 +350,7 @@ public final class CraftServer implements Server { + TicketType.PLUGIN.timeout = Math.min(20, this.configuration.getInt("chunk-gc.period-in-ticks")); // Paper - cap plugin loads to 1 second + this.minimumAPI = this.configuration.getString("settings.minimum-api"); + this.loadIcon(); ++ datapackManager = new io.papermc.paper.datapack.PaperDatapackManager(console.getPackRepository()); // Paper + } + + public boolean getCommandBlockOverride(String command) { +@@ -2496,5 +2498,11 @@ public final class CraftServer implements Server { + public com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() { + return mobGoals; + } ++ ++ @Override ++ public io.papermc.paper.datapack.PaperDatapackManager getDatapackManager() { ++ return datapackManager; ++ } ++ + // Paper end + } diff --git a/patches/server-remapped/0733-Add-environment-variable-to-disable-server-gui.patch b/patches/server/0667-Add-environment-variable-to-disable-server-gui.patch similarity index 85% rename from patches/server-remapped/0733-Add-environment-variable-to-disable-server-gui.patch rename to patches/server/0667-Add-environment-variable-to-disable-server-gui.patch index a1f57cca90..875c5e6c83 100644 --- a/patches/server-remapped/0733-Add-environment-variable-to-disable-server-gui.patch +++ b/patches/server/0667-Add-environment-variable-to-disable-server-gui.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add environment variable to disable server gui diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 9dc9a5e6ad7f23c8bf3553c765ceeecd67a49ac1..ba6c17da4875c3a342da99e354c9f07cc7f17326 100644 +index ea136b9ad3a2a07076e12b8656c68f63aa4718c8..cf0a74b8a1c31d4bc493eb09a69ee2bd94cb6485 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -225,6 +225,7 @@ public class Main { +@@ -239,6 +239,7 @@ public class Main { */ boolean flag1 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui"); diff --git a/patches/server/0668-additions-to-PlayerGameModeChangeEvent.patch b/patches/server/0668-additions-to-PlayerGameModeChangeEvent.patch new file mode 100644 index 0000000000..3fa2f12096 --- /dev/null +++ b/patches/server/0668-additions-to-PlayerGameModeChangeEvent.patch @@ -0,0 +1,150 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sat, 15 May 2021 10:04:43 -0700 +Subject: [PATCH] additions to PlayerGameModeChangeEvent + + +diff --git a/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java b/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java +index d25a27f3a6775ca86092ea8bdeab4abdd8909d35..7d9ec435f3821f95d3bed893c4e46d5a2531cd58 100644 +--- a/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java ++++ b/src/main/java/net/minecraft/server/commands/DefaultGameModeCommands.java +@@ -31,9 +31,13 @@ public class DefaultGameModeCommands { + GameType gameType = minecraftServer.getForcedGameType(); + if (gameType != null) { + for(ServerPlayer serverPlayer : minecraftServer.getPlayerList().getPlayers()) { +- if (serverPlayer.setGameMode(gameType)) { +- ++i; ++ // Paper start - extend PlayerGameModeChangeEvent ++ org.bukkit.event.player.PlayerGameModeChangeEvent event = serverPlayer.setGameMode(gameType, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.DEFAULT_GAMEMODE, net.kyori.adventure.text.Component.empty()); ++ if (event != null && event.isCancelled()) { ++ source.sendSuccess(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), false); + } ++ // Paper end ++ ++i; + } + } + +diff --git a/src/main/java/net/minecraft/server/commands/GameModeCommand.java b/src/main/java/net/minecraft/server/commands/GameModeCommand.java +index d75f78d2e3fb1376e8f6a8668c98a04a693c99e1..79f6089b934124c3309c6bee2e48b36b937252e0 100644 +--- a/src/main/java/net/minecraft/server/commands/GameModeCommand.java ++++ b/src/main/java/net/minecraft/server/commands/GameModeCommand.java +@@ -52,9 +52,14 @@ public class GameModeCommand { + int i = 0; + + for(ServerPlayer serverPlayer : targets) { +- if (serverPlayer.setGameMode(gameMode)) { ++ // Paper start - extend PlayerGameModeChangeEvent ++ org.bukkit.event.player.PlayerGameModeChangeEvent event = serverPlayer.setGameMode(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.COMMAND, net.kyori.adventure.text.Component.empty()); ++ if (event != null && !event.isCancelled()) { + logGamemodeChange(context.getSource(), serverPlayer, gameMode); + ++i; ++ } else if (event != null && event.cancelMessage() != null) { ++ context.getSource().sendSuccess(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), true); ++ // Paper end + } + } + +diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java +index 3b5feea941eba2ee2c6d93fd5141f2f8f1dbae42..8d39c5314c2566d0193e10ad7c91c314fa16385a 100644 +--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java ++++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +@@ -1783,8 +1783,15 @@ public class ServerPlayer extends Player { + } + + public boolean setGameMode(GameType gameMode) { +- if (!this.gameMode.changeGameModeForPlayer(gameMode)) { +- return false; ++ // Paper start - Add cause and nullable message to event ++ PlayerGameModeChangeEvent event = this.setGameMode(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.UNKNOWN, null); ++ return event == null ? false : event.isCancelled(); ++ } ++ public PlayerGameModeChangeEvent setGameMode(GameType gameMode, PlayerGameModeChangeEvent.Cause cause, net.kyori.adventure.text.Component message) { ++ PlayerGameModeChangeEvent event = this.gameMode.changeGameModeForPlayer(gameMode, cause, message); ++ if (event == null || event.isCancelled()) { ++ // Paper end ++ return null; + } else { + this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.CHANGE_GAME_MODE, (float) gameMode.getId())); + if (gameMode == GameType.SPECTATOR) { +@@ -1796,7 +1803,7 @@ public class ServerPlayer extends Player { + + this.onUpdateAbilities(); + this.updateEffectVisibility(); +- return true; ++ return event; // Paper + } + } + +@@ -2178,6 +2185,14 @@ public class ServerPlayer extends Player { + } + + public void loadGameTypes(@Nullable CompoundTag nbt) { ++ if (this.server.getForcedGameType() != null && this.server.getForcedGameType() != ServerPlayer.readPlayerMode(nbt, "playerGameType")) { ++ if (new PlayerGameModeChangeEvent(this.getBukkitEntity(), GameMode.getByValue(this.server.getDefaultGameType().getId()), org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.DEFAULT_GAMEMODE, null).callEvent()) { ++ this.gameMode.setGameModeForPlayer(this.server.getForcedGameType(), GameType.DEFAULT_MODE); ++ } else { ++ this.gameMode.setGameModeForPlayer(ServerPlayer.readPlayerMode(nbt,"playerGameType"), ServerPlayer.readPlayerMode(nbt, "previousPlayerGameType")); ++ } ++ return; ++ } + this.gameMode.setGameModeForPlayer(this.calculateGameModeForNewPlayer(ServerPlayer.readPlayerMode(nbt, "playerGameType")), ServerPlayer.readPlayerMode(nbt, "previousPlayerGameType")); + } + +diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +index 2a0f313365a25c1780027f1536dbb88ccdab61e2..013ed10b8eca812309a2c9a10acd668ad51aac8e 100644 +--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java ++++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +@@ -74,18 +74,24 @@ public class ServerPlayerGameMode { + } + + public boolean changeGameModeForPlayer(GameType gameMode) { ++ // Paper end ++ PlayerGameModeChangeEvent event = this.changeGameModeForPlayer(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.UNKNOWN, null); ++ return event == null ? false : event.isCancelled(); ++ } ++ public PlayerGameModeChangeEvent changeGameModeForPlayer(GameType gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause cause, net.kyori.adventure.text.Component component) { ++ // Paper end + if (gameMode == this.gameModeForPlayer) { +- return false; ++ return null; // Paper + } else { + // CraftBukkit start + PlayerGameModeChangeEvent event = new PlayerGameModeChangeEvent(this.player.getBukkitEntity(), GameMode.getByValue(gameMode.getId())); + this.level.getCraftServer().getPluginManager().callEvent(event); + if (event.isCancelled()) { +- return false; ++ return event; // Paper + } + // CraftBukkit end + this.setGameModeForPlayer(gameMode, this.gameModeForPlayer); +- return true; ++ return event; // Paper + } + } + +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index e896057274434eea97d78777dcf303fd83e9cd79..b369d400e34fc8b6d161d79c57bcd26d57147ff8 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -2470,7 +2470,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + + this.player = this.server.getPlayerList().respawn(this.player, false); + if (this.server.isHardcore()) { +- this.player.setGameMode(GameType.SPECTATOR); ++ this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper + ((GameRules.BooleanValue) this.player.getLevel().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.server); + } + } +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index db920ef12e918b7dfdcc4612c4bec0b9961d9a3e..d46c2e85c845c769391af98619b9c771f13f90f7 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -1242,7 +1242,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + throw new IllegalArgumentException("Mode cannot be null"); + } + +- this.getHandle().setGameMode(GameType.byId(mode.getValue())); ++ this.getHandle().setGameMode(GameType.byId(mode.getValue()), org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.PLUGIN, null); // Paper + } + + @Override diff --git a/patches/server-remapped/0735-ItemStack-repair-check-API.patch b/patches/server/0669-ItemStack-repair-check-API.patch similarity index 74% rename from patches/server-remapped/0735-ItemStack-repair-check-API.patch rename to patches/server/0669-ItemStack-repair-check-API.patch index 74dbd3c778..b8be99842d 100644 --- a/patches/server-remapped/0735-ItemStack-repair-check-API.patch +++ b/patches/server/0669-ItemStack-repair-check-API.patch @@ -4,24 +4,12 @@ Date: Sat, 15 May 2021 22:11:11 -0700 Subject: [PATCH] ItemStack repair check API -diff --git a/src/main/java/net/minecraft/world/item/Item.java b/src/main/java/net/minecraft/world/item/Item.java -index cb079bfd5339b96ad372b0a3b483d02cd0636bfd..42085d3f4ae5c6ceecaffde79fb3187712a2af00 100644 ---- a/src/main/java/net/minecraft/world/item/Item.java -+++ b/src/main/java/net/minecraft/world/item/Item.java -@@ -269,6 +269,7 @@ public class Item implements ItemLike { - return this.category; - } - -+ public boolean canRepair(ItemStack toBeRepaired, ItemStack repairMaterial) { return isValidRepairItem(toBeRepaired, repairMaterial); } // Paper - OBFHELPER - public boolean isValidRepairItem(ItemStack stack, ItemStack ingredient) { - return false; - } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 402e5a98290a1701dd67d27c484c97e0a6067c4f..34eed57c7ed884e0d634ca403e38d25c95b6a038 100644 +index 5c49c4e671b9d44c12f8d8efcf97305a41e5dbe1..e1b1c754c4ca38331cbb524358becd64957295d0 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -485,6 +485,14 @@ public final class CraftMagicNumbers implements UnsafeValues { - return io.papermc.paper.inventory.ItemRarity.values()[getItem(itemStack.getType()).getItemStackRarity(CraftItemStack.asNMSCopy(itemStack)).ordinal()]; + return io.papermc.paper.inventory.ItemRarity.values()[getItem(itemStack.getType()).getRarity(CraftItemStack.asNMSCopy(itemStack)).ordinal()]; } + @Override @@ -29,7 +17,7 @@ index 402e5a98290a1701dd67d27c484c97e0a6067c4f..34eed57c7ed884e0d634ca403e38d25c + if (!itemToBeRepaired.getType().isItem() || !repairMaterial.getType().isItem()) { + return false; + } -+ return this.getItem(itemToBeRepaired.getType()).canRepair(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial)); ++ return CraftMagicNumbers.getItem(itemToBeRepaired.getType()).isValidRepairItem(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial)); + } + @Override diff --git a/patches/server-remapped/0736-More-Enchantment-API.patch b/patches/server/0670-More-Enchantment-API.patch similarity index 59% rename from patches/server-remapped/0736-More-Enchantment-API.patch rename to patches/server/0670-More-Enchantment-API.patch index 4bf44e22d8..a83275d8e7 100644 --- a/patches/server-remapped/0736-More-Enchantment-API.patch +++ b/patches/server/0670-More-Enchantment-API.patch @@ -4,76 +4,20 @@ Date: Thu, 6 May 2021 19:57:58 -0700 Subject: [PATCH] More Enchantment API -diff --git a/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java b/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java -index c23ec1b31950471905c65e46273ae105de853d9b..b994a7aca0ce01b5c0d44b9b126295ffcd2f795d 100644 ---- a/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java -+++ b/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java -@@ -17,7 +17,7 @@ import net.minecraft.world.item.ItemStack; - - public abstract class Enchantment { - -- private final EquipmentSlot[] slots; -+ private final EquipmentSlot[] slots; public final EquipmentSlot[] getSlots() { return this.slots; } // Paper - OBFHELPER - private final Enchantment.Rarity rarity; - public final EnchantmentCategory category; - @Nullable -@@ -46,6 +46,7 @@ public abstract class Enchantment { - return map; - } - -+ public Enchantment.Rarity getRarity() { return getRarity(); } // Paper - OBFHELPER - public Enchantment.Rarity getRarity() { - return this.rarity; - } -@@ -70,6 +71,7 @@ public abstract class Enchantment { - return 0; - } - -+ public float getDamageIncrease(int level, MobType enumMonsterType) { return getDamageBonus(level, enumMonsterType); } // Paper - OBFHELPER - public float getDamageBonus(int level, MobType group) { - return 0.0F; - } -@@ -123,14 +125,17 @@ public abstract class Enchantment { - return false; - } - -+ public boolean isCursed() { return isCurse(); } // Paper - OBFHELPER - public boolean isCurse() { - return false; - } - -+ public boolean isTradeable() { return isTradeable(); } // Paper - OBFHELPER - public boolean isTradeable() { - return true; - } - -+ public boolean isDiscoverable() { return isDiscoverable(); } // Paper - OBFHELPER - public boolean isDiscoverable() { - return true; - } diff --git a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java -index b1ffe6c7a5915f00a476e88f3a38349b740b4910..20858bb8463ff86c96b5fcdeca455c20c696870f 100644 +index a7966aa0846637efdc43df1ca97cbc5d29616953..aec59f469b77aa2184a2899e8e8d1c5b823d9263 100644 --- a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java +++ b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java -@@ -1,8 +1,6 @@ - package org.bukkit.craftbukkit.enchantments; - - import net.minecraft.core.Registry; --import net.minecraft.world.item.enchantment.BindingCurseEnchantment; --import net.minecraft.world.item.enchantment.VanishingCurseEnchantment; - import org.bukkit.craftbukkit.inventory.CraftItemStack; - import org.bukkit.craftbukkit.util.CraftNamespacedKey; - import org.bukkit.enchantments.Enchantment; -@@ -71,7 +69,7 @@ public class CraftEnchantment extends Enchantment { +@@ -71,7 +71,7 @@ public class CraftEnchantment extends Enchantment { @Override public boolean isCursed() { -- return target instanceof BindingCurseEnchantment || target instanceof VanishingCurseEnchantment; -+ return target.isCursed(); // Paper +- return this.target instanceof BindingCurseEnchantment || this.target instanceof VanishingCurseEnchantment; ++ return this.target.isCurse(); // Paper } @Override -@@ -192,6 +190,45 @@ public class CraftEnchantment extends Enchantment { +@@ -192,6 +192,45 @@ public class CraftEnchantment extends Enchantment { public net.kyori.adventure.text.Component displayName(int level) { return io.papermc.paper.adventure.PaperAdventure.asAdventure(getHandle().getTranslationComponentForLevel(level)); } @@ -95,12 +39,12 @@ index b1ffe6c7a5915f00a476e88f3a38349b740b4910..20858bb8463ff86c96b5fcdeca455c20 + + @Override + public float getDamageIncrease(int level, org.bukkit.entity.EntityCategory entityCategory) { -+ return target.getDamageIncrease(level, org.bukkit.craftbukkit.entity.CraftLivingEntity.fromBukkitEntityCategory(entityCategory)); ++ return target.getDamageBonus(level, org.bukkit.craftbukkit.entity.CraftLivingEntity.fromBukkitEntityCategory(entityCategory)); + } + + @Override + public java.util.Set getActiveSlots() { -+ return java.util.stream.Stream.of(target.getSlots()).map(org.bukkit.craftbukkit.CraftEquipmentSlot::getSlot).collect(java.util.stream.Collectors.toSet()); ++ return java.util.stream.Stream.of(target.slots).map(org.bukkit.craftbukkit.CraftEquipmentSlot::getSlot).collect(java.util.stream.Collectors.toSet()); + } + + public static io.papermc.paper.enchantments.EnchantmentRarity fromNMSRarity(net.minecraft.world.item.enchantment.Enchantment.Rarity nmsRarity) { @@ -120,12 +64,12 @@ index b1ffe6c7a5915f00a476e88f3a38349b740b4910..20858bb8463ff86c96b5fcdeca455c20 public net.minecraft.world.item.enchantment.Enchantment getHandle() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index eefb6bd580ea176c3a242695ab4af46e7c61b492..25ba7a26c951fc5e4638bdb0db36e94d3e08fb2e 100644 +index eed0fb2293cf1e19f2d4f4b66a9e2ef8b214141c..965eb5345d83661809b8b4bc644d5d9af38cf371 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -835,5 +835,21 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { public void setHurtDirection(float hurtDirection) { - getHandle().setHurtDirection(hurtDirection); + getHandle().hurtDir = hurtDirection; } + + public static MobType fromBukkitEntityCategory(EntityCategory entityCategory) { @@ -171,7 +115,7 @@ index 0000000000000000000000000000000000000000..62b56b5b43696b03fc72cac59f986d00 +} diff --git a/src/test/java/io/papermc/paper/entity/EntityCategoryTest.java b/src/test/java/io/papermc/paper/entity/EntityCategoryTest.java new file mode 100644 -index 0000000000000000000000000000000000000000..adb0e5b4268fa115b814143cf29d9a3688e4bc17 +index 0000000000000000000000000000000000000000..b9824b1f9491304ceb91be18f4f3b3068526bb33 --- /dev/null +++ b/src/test/java/io/papermc/paper/entity/EntityCategoryTest.java @@ -0,0 +1,34 @@ @@ -180,7 +124,7 @@ index 0000000000000000000000000000000000000000..adb0e5b4268fa115b814143cf29d9a36 +import com.google.common.base.Joiner; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; -+import net.minecraft.world.entity.EnumMonsterType; ++import net.minecraft.world.entity.MobType; +import org.bukkit.craftbukkit.entity.CraftLivingEntity; +import org.bukkit.entity.EntityCategory; +import org.junit.Test; @@ -196,16 +140,16 @@ index 0000000000000000000000000000000000000000..adb0e5b4268fa115b814143cf29d9a36 + @Test + public void test() throws IllegalAccessException { + -+ Map enumMonsterTypeFieldMap = Maps.newHashMap(); -+ for (Field field : EnumMonsterType.class.getDeclaredFields()) { -+ if (field.getType() == EnumMonsterType.class) { -+ enumMonsterTypeFieldMap.put( (EnumMonsterType) field.get(null), field.getName()); ++ Map enumMonsterTypeFieldMap = Maps.newHashMap(); ++ for (Field field : MobType.class.getDeclaredFields()) { ++ if (field.getType() == MobType.class) { ++ enumMonsterTypeFieldMap.put( (MobType) field.get(null), field.getName()); + } + } + + for (EntityCategory entityCategory : EntityCategory.values()) { + enumMonsterTypeFieldMap.remove(CraftLivingEntity.fromBukkitEntityCategory(entityCategory)); + } -+ assertTrue(EnumMonsterType.class.getName() + " instance(s): " + Joiner.on(", ").join(enumMonsterTypeFieldMap.values()) + " do not have bukkit equivalents", enumMonsterTypeFieldMap.size() == 0); ++ assertTrue(MobType.class.getName() + " instance(s): " + Joiner.on(", ").join(enumMonsterTypeFieldMap.values()) + " do not have bukkit equivalents", enumMonsterTypeFieldMap.size() == 0); + } +} diff --git a/patches/server-remapped/0737-Add-command-line-option-to-load-extra-plugin-jars-no.patch b/patches/server/0671-Add-command-line-option-to-load-extra-plugin-jars-no.patch similarity index 82% rename from patches/server-remapped/0737-Add-command-line-option-to-load-extra-plugin-jars-no.patch rename to patches/server/0671-Add-command-line-option-to-load-extra-plugin-jars-no.patch index 6c752cc24c..2299c257c0 100644 --- a/patches/server-remapped/0737-Add-command-line-option-to-load-extra-plugin-jars-no.patch +++ b/patches/server/0671-Add-command-line-option-to-load-extra-plugin-jars-no.patch @@ -7,26 +7,26 @@ Subject: [PATCH] Add command line option to load extra plugin jars not in the ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 63639923f7875d76f569b8c6e958782c6462d906..f1e6d0050092ad51bf233c80b6a51a121e961b07 100644 +index 2f914ebd18764fbfd3834c0a94cedb2184f8dbb0..59c352f9666ff9b828450a62f590ab637b4329b5 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -384,8 +384,13 @@ public final class CraftServer implements Server { +@@ -386,8 +386,13 @@ public final class CraftServer implements Server { File pluginFolder = (File) console.options.valueOf("plugins"); - if (pluginFolder.exists()) { -- Plugin[] plugins = pluginManager.loadPlugins(pluginFolder); +- Plugin[] plugins = this.pluginManager.loadPlugins(pluginFolder); + // Paper start + if (true || pluginFolder.exists()) { + if (!pluginFolder.exists()) { + pluginFolder.mkdirs(); + } -+ Plugin[] plugins = pluginManager.loadPlugins(pluginFolder, this.extraPluginJars()); ++ Plugin[] plugins = this.pluginManager.loadPlugins(pluginFolder, this.extraPluginJars()); + // Paper end for (Plugin plugin : plugins) { try { String message = String.format("Loading %s", plugin.getDescription().getFullName()); -@@ -400,6 +405,18 @@ public final class CraftServer implements Server { +@@ -402,6 +407,18 @@ public final class CraftServer implements Server { } } @@ -44,9 +44,9 @@ index 63639923f7875d76f569b8c6e958782c6462d906..f1e6d0050092ad51bf233c80b6a51a12 + public void enablePlugins(PluginLoadOrder type) { if (type == PluginLoadOrder.STARTUP) { - helpMap.clear(); + this.helpMap.clear(); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index bd10345cb90f98b8af1519afd603a5244f3a5ca2..521542999b25b1da448fadb3fe6531e083f93e67 100644 +index 6ebd0f6053929beb246993b5a1b682b9971baf0b..ba01312f7615d0507c1bd1cd175588197f8d122e 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -153,6 +153,12 @@ public class Main { diff --git a/patches/server-remapped/0740-Fix-and-optimise-world-force-upgrading.patch b/patches/server/0672-Fix-and-optimise-world-force-upgrading.patch similarity index 83% rename from patches/server-remapped/0740-Fix-and-optimise-world-force-upgrading.patch rename to patches/server/0672-Fix-and-optimise-world-force-upgrading.patch index 2b1a725ed2..ac29e5ed6b 100644 --- a/patches/server-remapped/0740-Fix-and-optimise-world-force-upgrading.patch +++ b/patches/server/0672-Fix-and-optimise-world-force-upgrading.patch @@ -30,7 +30,7 @@ easy to add threading, so I did. diff --git a/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java new file mode 100644 -index 0000000000000000000000000000000000000000..f476f21bcfd64d4eb2b690c9100275093c49c9d6 +index 0000000000000000000000000000000000000000..452934a7a037c8b1c5f9906c7af75ed8c449ebc0 --- /dev/null +++ b/src/main/java/io/papermc/paper/world/ThreadedWorldUpgrader.java @@ -0,0 +1,200 @@ @@ -104,7 +104,7 @@ index 0000000000000000000000000000000000000000..f476f21bcfd64d4eb2b690c910027509 + LOGGER.info("Force upgrading " + this.worldName); + LOGGER.info("Counting regionfiles for " + this.worldName); + final File[] regionFiles = regionFolder.listFiles((final File dir, final String name) -> { -+ return WorldUpgrader.getRegionfileRegex().matcher(name).matches(); ++ return WorldUpgrader.REGEX.matcher(name).matches(); + }); + if (regionFiles == null) { + LOGGER.info("Found no regionfiles to convert for world " + this.worldName); @@ -235,7 +235,7 @@ index 0000000000000000000000000000000000000000..f476f21bcfd64d4eb2b690c910027509 + } +} diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index ba6c17da4875c3a342da99e354c9f07cc7f17326..d0105061c714af4403b3e14e96e54e17a82c172b 100644 +index cf0a74b8a1c31d4bc493eb09a69ee2bd94cb6485..6fa1a7da70896d0ff34d38698769195a98c06195 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java @@ -15,6 +15,7 @@ import java.nio.file.Paths; @@ -246,7 +246,7 @@ index ba6c17da4875c3a342da99e354c9f07cc7f17326..d0105061c714af4403b3e14e96e54e17 import joptsimple.NonOptionArgumentSpec; import joptsimple.OptionParser; import joptsimple.OptionSet; -@@ -269,6 +270,15 @@ public class Main { +@@ -283,6 +284,15 @@ public class Main { } // Paper end @@ -263,15 +263,15 @@ index ba6c17da4875c3a342da99e354c9f07cc7f17326..d0105061c714af4403b3e14e96e54e17 Main.LOGGER.info("Forcing world upgrade! {}", session.getLevelId()); // CraftBukkit WorldUpgrader worldupgrader = new WorldUpgrader(session, dataFixer, worlds, eraseCache); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index fd76d776c7003585c9efef44c6d7da0f6c3f574e..9d7cebd703bd0171ca3e95d2985c1a52fdb59712 100644 +index 73ac55de9059a1d0f1da5bec0688dcd4bf5c8973..db2d6e7b2dc82c60d524dd2a018d28c2068552fa 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -512,13 +512,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { +- if (this.options.has("forceUpgrade")) { +- net.minecraft.server.Main.forceUpgrade(worldSession, DataFixers.getDataFixer(), this.options.has("eraseCache"), () -> { - return true; - }, worlddata.worldGenSettings().dimensions().entrySet().stream().map((entry1) -> { - return ResourceKey.create(Registry.DIMENSION_TYPE_REGISTRY, ((ResourceKey) entry1.getKey()).location()); @@ -281,7 +281,7 @@ index fd76d776c7003585c9efef44c6d7da0f6c3f574e..9d7cebd703bd0171ca3e95d2985c1a52 ServerLevelData iworlddataserver = worlddata; WorldGenSettings generatorsettings = worlddata.worldGenSettings(); -@@ -538,6 +532,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop worldKey = ResourceKey.create(Registry.DIMENSION_REGISTRY, dimensionKey.location()); if (dimensionKey == LevelStem.OVERWORLD) { -diff --git a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java -index 79491c5081dbc0cc479d6bc0329ff9b374559c9b..29c0fe698e91e232bcebfafdd853d222c83d5af8 100644 ---- a/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java -+++ b/src/main/java/net/minecraft/util/worldupdate/WorldUpgrader.java -@@ -52,7 +52,7 @@ public class WorldUpgrader { - private volatile int skipped; - private final Object2FloatMap> progressMap = Object2FloatMaps.synchronize(new Object2FloatOpenCustomHashMap(Util.identityStrategy())); // CraftBukkit - private volatile Component status = new TranslatableComponent("optimizeWorld.stage.counting"); -- private static final Pattern REGEX = Pattern.compile("^r\\.(-?[0-9]+)\\.(-?[0-9]+)\\.mca$"); -+ private static final Pattern REGEX = Pattern.compile("^r\\.(-?[0-9]+)\\.(-?[0-9]+)\\.mca$"); public static final Pattern getRegionfileRegex() { return REGEX; } // Paper - OBFHELPER - private final DimensionDataStorage overworldDataStorage; - - public WorldUpgrader(LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, ImmutableSet> worlds, boolean eraseCache) { // CraftBukkit diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 4523bc1f49e7be248a47eeb599fa7b6550dbb08d..d155d00abf8f423e64e6e6d80ddadbc1cfb58a64 100644 +index 31aa0c682fddb0555c2ac47f563484cfa51f2669..ad2d5b19ef23677dd6192b049fca42b9cec392a1 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -181,6 +181,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { - return typeKey; +@@ -185,6 +185,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable { + return this.typeKey; } + // Paper start - fix and optimise world upgrading + // copied from below + public static ResourceKey getDimensionKey(DimensionType manager) { -+ return ((org.bukkit.craftbukkit.CraftServer)org.bukkit.Bukkit.getServer()).getHandle().getServer().registryHolder.dimensionTypes().getResourceKey(manager).orElseThrow(() -> { ++ return ((org.bukkit.craftbukkit.CraftServer)org.bukkit.Bukkit.getServer()).getHandle().getServer().registryHolder.ownedRegistryOrThrow(net.minecraft.core.Registry.DIMENSION_TYPE_REGISTRY).getResourceKey(manager).orElseThrow(() -> { + return new IllegalStateException("Unregistered dimension type: " + manager); + }); + } + // Paper end - fix and optimise world upgrading -+ - protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, final DimensionType dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper + protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, final DimensionType dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName(), this.spigotConfig); // Paper -diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java -index 1af804c5c6fb2b20ea3f020610763c1d7dcee110..0e38f2f31d167c417b707f00aa68cacaef3d9f6c 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java -+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkStorage.java -@@ -109,6 +109,7 @@ public class ChunkStorage implements AutoCloseable { - return nbttagcompound; - } - -+ public static int getVersion(CompoundTag nbttagcompound) { return getVersion(nbttagcompound); } // Paper - OBFHELPER - public static int getVersion(CompoundTag tag) { - return tag.contains("DataVersion", 99) ? tag.getInt("DataVersion") : -1; - } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index 0498982ac14f20145d68dbf64a46bcaacf5516ef..7a01f2fbe459e36cee5416455a049b25963e257a 100644 +index 1bee455235ece8aa299a2baeede027d251e6ff57..60ae9395591c81aebaa4be1541380a8fe921ce68 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -@@ -30,6 +30,28 @@ public class RegionFileStorage implements AutoCloseable { // Paper - no final - +@@ -29,6 +29,28 @@ public class RegionFileStorage implements AutoCloseable { // Paper - no final + } // Paper start + public static ChunkPos getRegionFileCoordinates(File file) { @@ -371,17 +345,17 @@ index 0498982ac14f20145d68dbf64a46bcaacf5516ef..7a01f2fbe459e36cee5416455a049b25 + } + } + - public synchronized RegionFile getRegionFileIfLoaded(ChunkPos chunkcoordintpair) { // Paper - synchronize for async io + public synchronized RegionFile getRegionFileIfLoaded(ChunkPos chunkcoordintpair) { return this.regionCache.getAndMoveToFirst(ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ())); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index f1e6d0050092ad51bf233c80b6a51a121e961b07..831f187cde88e815c9a859e52ab45fbbe054f83e 100644 +index 59c352f9666ff9b828450a62f590ab637b4329b5..e5135b5cffc39fa63cb9a78274c026a0b5fddaf8 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1145,14 +1145,7 @@ public final class CraftServer implements Server { +@@ -1143,14 +1143,7 @@ public final class CraftServer implements Server { } worlddata.checkName(name); - worlddata.setModdedInfo(console.getServerModName(), console.getModdedStatus().isPresent()); + worlddata.setModdedInfo(this.console.getServerModName(), this.console.getModdedStatus().isPresent()); - - if (console.options.has("forceUpgrade")) { - net.minecraft.server.Main.forceUpgrade(worldSession, DataFixers.getDataFixer(), console.options.has("eraseCache"), () -> { @@ -394,7 +368,7 @@ index f1e6d0050092ad51bf233c80b6a51a121e961b07..831f187cde88e815c9a859e52ab45fbb long j = BiomeManager.obfuscateSeed(creator.seed()); List list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(worlddata)); -@@ -1169,6 +1162,14 @@ public final class CraftServer implements Server { +@@ -1167,6 +1160,14 @@ public final class CraftServer implements Server { chunkgenerator = worlddimension.generator(); } diff --git a/patches/server/0673-Add-Mob-lookAt-API.patch b/patches/server/0673-Add-Mob-lookAt-API.patch new file mode 100644 index 0000000000..b82033a43e --- /dev/null +++ b/patches/server/0673-Add-Mob-lookAt-API.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Fri, 14 May 2021 13:42:17 -0500 +Subject: [PATCH] Add Mob#lookAt API + + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java +index 317b6abd2764cf34ef5c42bdbf48ab0bc5a03d27..6549d7c40d6a0ca307fdcb6fd3ca01d2ab732b59 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java +@@ -83,5 +83,53 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob { + public boolean isInDaylight() { + return getHandle().isSunBurnTick(); + } ++ ++ @Override ++ public void lookAt(@org.jetbrains.annotations.NotNull org.bukkit.Location location) { ++ com.google.common.base.Preconditions.checkNotNull(location, "location cannot be null"); ++ com.google.common.base.Preconditions.checkArgument(location.getWorld().equals(getWorld()), "location in a different world"); ++ getHandle().getLookControl().setLookAt(location.getX(), location.getY(), location.getZ()); ++ } ++ ++ @Override ++ public void lookAt(@org.jetbrains.annotations.NotNull org.bukkit.Location location, float headRotationSpeed, float maxHeadPitch) { ++ com.google.common.base.Preconditions.checkNotNull(location, "location cannot be null"); ++ com.google.common.base.Preconditions.checkArgument(location.getWorld().equals(getWorld()), "location in a different world"); ++ getHandle().getLookControl().setLookAt(location.getX(), location.getY(), location.getZ(), headRotationSpeed, maxHeadPitch); ++ } ++ ++ @Override ++ public void lookAt(@org.jetbrains.annotations.NotNull org.bukkit.entity.Entity entity) { ++ com.google.common.base.Preconditions.checkNotNull(entity, "entity cannot be null"); ++ com.google.common.base.Preconditions.checkArgument(entity.getWorld().equals(getWorld()), "entity in a different world"); ++ getHandle().getLookControl().setLookAt(((CraftEntity) entity).getHandle()); ++ } ++ ++ @Override ++ public void lookAt(@org.jetbrains.annotations.NotNull org.bukkit.entity.Entity entity, float headRotationSpeed, float maxHeadPitch) { ++ com.google.common.base.Preconditions.checkNotNull(entity, "entity cannot be null"); ++ com.google.common.base.Preconditions.checkArgument(entity.getWorld().equals(getWorld()), "entity in a different world"); ++ getHandle().getLookControl().setLookAt(((CraftEntity) entity).getHandle(), headRotationSpeed, maxHeadPitch); ++ } ++ ++ @Override ++ public void lookAt(double x, double y, double z) { ++ getHandle().getLookControl().setLookAt(x, y, z); ++ } ++ ++ @Override ++ public void lookAt(double x, double y, double z, float headRotationSpeed, float maxHeadPitch) { ++ getHandle().getLookControl().setLookAt(x, y, z, headRotationSpeed, maxHeadPitch); ++ } ++ ++ @Override ++ public int getHeadRotationSpeed() { ++ return getHandle().getHeadRotSpeed(); ++ } ++ ++ @Override ++ public int getMaxHeadPitch() { ++ return getHandle().getMaxHeadXRot(); ++ } + // Paper end + } diff --git a/patches/server-remapped/0742-Add-Unix-domain-socket-support.patch b/patches/server/0674-Add-Unix-domain-socket-support.patch similarity index 87% rename from patches/server-remapped/0742-Add-Unix-domain-socket-support.patch rename to patches/server/0674-Add-Unix-domain-socket-support.patch index 83c74f604e..8f002d50bd 100644 --- a/patches/server-remapped/0742-Add-Unix-domain-socket-support.patch +++ b/patches/server/0674-Add-Unix-domain-socket-support.patch @@ -11,10 +11,10 @@ Tested-by: Mariell Hoversholm Reviewed-by: Mariell Hoversholm diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 3ba9c38fc44a8edba9b504112a383249052a0035..cc823a1337bea3ad552687add46706128311f26d 100644 +index 759e563d1ed13249fada8a8eab6b6a10e5ef0d37..e1ecfe280f97985fadbe22db7e420f04c38dd672 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -564,6 +564,11 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -614,6 +614,11 @@ public class Connection extends SimpleChannelInboundHandler> { // Spigot Start public SocketAddress getRawAddress() { @@ -27,12 +27,12 @@ index 3ba9c38fc44a8edba9b504112a383249052a0035..cc823a1337bea3ad552687add4670612 } // Spigot End diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 0198268bc614b190cd84f625a62f6c55247a01c8..2821fa9505d6b5adc8e776219df024713fc1a486 100644 +index f5cb59aa72dfd22ec143360a131818bef4f1b701..eeefbb86cb88bd1b132bb6e22b4a4572cfb5e22c 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -222,6 +222,20 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -230,6 +230,20 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface this.setEnforceWhitelist(dedicatedserverproperties.enforceWhitelist); - // this.saveData.setGameType(dedicatedserverproperties.gamemode); // CraftBukkit - moved to world loading + // this.worldData.setGameType(dedicatedserverproperties.gamemode); // CraftBukkit - moved to world loading DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode); + // Paper start - Unix domain socket support + java.net.SocketAddress bindAddress; @@ -51,7 +51,7 @@ index 0198268bc614b190cd84f625a62f6c55247a01c8..2821fa9505d6b5adc8e776219df02471 InetAddress inetaddress = null; if (!this.getLocalIp().isEmpty()) { -@@ -231,12 +245,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -239,12 +253,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface if (this.getPort() < 0) { this.setPort(dedicatedserverproperties.serverPort); } @@ -69,10 +69,10 @@ index 0198268bc614b190cd84f625a62f6c55247a01c8..2821fa9505d6b5adc8e776219df02471 DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!"); DedicatedServer.LOGGER.warn("The exception was: {}", ioexception.toString()); diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index bcc19d0a4b6c5f683dc416e27a13705b57213d21..67a17ced9460bc83a6f564b38fdb43b1a7f1b8a0 100644 +index 9c9368628845f316e157f6ae15b89c24af082d97..158933a67beadd7f667351d9826ba56f6cc7d781 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -@@ -70,7 +70,12 @@ public class ServerConnectionListener { +@@ -67,7 +67,12 @@ public class ServerConnectionListener { this.running = true; } @@ -85,7 +85,7 @@ index bcc19d0a4b6c5f683dc416e27a13705b57213d21..67a17ced9460bc83a6f564b38fdb43b1 List list = this.channels; synchronized (this.channels) { -@@ -78,7 +83,11 @@ public class ServerConnectionListener { +@@ -75,7 +80,11 @@ public class ServerConnectionListener { LazyLoadedValue lazyinitvar; if (Epoll.isAvailable() && this.server.isEpollEnabled()) { @@ -97,7 +97,7 @@ index bcc19d0a4b6c5f683dc416e27a13705b57213d21..67a17ced9460bc83a6f564b38fdb43b1 lazyinitvar = ServerConnectionListener.SERVER_EPOLL_EVENT_GROUP; ServerConnectionListener.LOGGER.info("Using epoll channel type"); } else { -@@ -106,7 +115,7 @@ public class ServerConnectionListener { +@@ -101,7 +110,7 @@ public class ServerConnectionListener { ((Connection) object).setListener(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object)); io.papermc.paper.network.ChannelInitializeListenerHolder.callListeners(channel); // Paper } @@ -107,7 +107,7 @@ index bcc19d0a4b6c5f683dc416e27a13705b57213d21..67a17ced9460bc83a6f564b38fdb43b1 } diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -index 4e055a41de3ee410682cc05a3b883ac8babeb290..e1fbb207d6921516c7423e9a3cded8efb5676d49 100644 +index 4c44f06ba18cfa2d889d0dd57fdd7eb79971c8c6..e0cd786f130e34b3401d40663e1548fc0076f74a 100644 --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java @@ -44,6 +44,7 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL @@ -129,11 +129,11 @@ index 4e055a41de3ee410682cc05a3b883ac8babeb290..e1fbb207d6921516c7423e9a3cded8ef @@ -120,8 +122,11 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL //if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above! String[] split = packet.hostName.split("\00"); - if ( ( split.length == 3 || split.length == 4 ) && ( BYPASS_HOSTCHECK || HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper + if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper + // Paper start - Unix domain socket support + java.net.SocketAddress socketAddress = connection.getRemoteAddress(); packet.hostName = split[0]; -- connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) connection.getRemoteAddress()).getPort()); +- connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort()); + connection.address = new java.net.InetSocketAddress(split[1], socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getPort() : 0); + // Paper end connection.spoofedUUID = com.mojang.util.UUIDTypeAdapter.fromString( split[2] ); diff --git a/patches/server-remapped/0743-Add-EntityInsideBlockEvent.patch b/patches/server/0675-Add-EntityInsideBlockEvent.patch similarity index 72% rename from patches/server-remapped/0743-Add-EntityInsideBlockEvent.patch rename to patches/server/0675-Add-EntityInsideBlockEvent.patch index 6380d78daa..31db266834 100644 --- a/patches/server-remapped/0743-Add-EntityInsideBlockEvent.patch +++ b/patches/server/0675-Add-EntityInsideBlockEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add EntityInsideBlockEvent diff --git a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java -index ad37261e716b15d62fc2083d137cdac818308cdd..58519e224a5005bf6468b99196acb7209b2e1398 100644 +index 177d1da44c83da5f99ae91891dec41dc210bd31d..d2fb4d5738919c1e7b9a7f08aad2e4b607414a53 100644 --- a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java -@@ -48,6 +48,7 @@ public abstract class BaseFireBlock extends Block { +@@ -123,6 +123,7 @@ public abstract class BaseFireBlock extends Block { @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { @@ -17,10 +17,10 @@ index ad37261e716b15d62fc2083d137cdac818308cdd..58519e224a5005bf6468b99196acb720 entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1); if (entity.getRemainingFireTicks() == 0) { diff --git a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java -index 6acb24f96591d555e550d399d2ed38036a0220fe..8d8fd646c9527852bfe9a2d3cd0a6bf1bfa9e4a2 100644 +index 94c48393e467f61cb763e8c44baccdef446be474..14de86667e9c05da95e807177d8c44cdaa765f18 100644 --- a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java -@@ -65,6 +65,7 @@ public abstract class BasePressurePlateBlock extends Block { +@@ -67,6 +67,7 @@ public abstract class BasePressurePlateBlock extends Block { @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { @@ -29,22 +29,22 @@ index 6acb24f96591d555e550d399d2ed38036a0220fe..8d8fd646c9527852bfe9a2d3cd0a6bf1 int i = this.getSignalForState(state); diff --git a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java -index f741980d0e1759e3fefe322b654760dab35200d6..faa1070aaf3fcc40bf7e36a0dda8ec7879c89dd6 100644 +index 68135caecf506a5a2ad36def1a94a83eec3abe32..17cffb3bd362dc4a69535425f7289af7ccb640eb 100644 --- a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java -@@ -33,6 +33,7 @@ public class BubbleColumnBlock extends Block implements BucketPickup { +@@ -38,6 +38,7 @@ public class BubbleColumnBlock extends Block implements BucketPickup { @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - BlockState iblockdata1 = world.getBlockState(pos.above()); - - if (iblockdata1.isAir()) { + BlockState blockState = world.getBlockState(pos.above()); + if (blockState.isAir()) { + entity.onAboveBubbleCol(state.getValue(DRAG_DOWN)); diff --git a/src/main/java/net/minecraft/world/level/block/ButtonBlock.java b/src/main/java/net/minecraft/world/level/block/ButtonBlock.java -index 52ca5dad75674b81b997f8a1cf3f5d52bf4313c1..2c4c5fc6d45225cc9f7f1c2038bd4d0ae20c9daa 100644 +index 698a80029f4410045af486f926324b3fdb98bb64..af6730322a7cea0c4f9ca92c289698554bf86b3a 100644 --- a/src/main/java/net/minecraft/world/level/block/ButtonBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ButtonBlock.java -@@ -179,6 +179,7 @@ public abstract class ButtonBlock extends FaceAttachedHorizontalDirectionalBlock +@@ -186,6 +186,7 @@ public abstract class ButtonBlock extends FaceAttachedHorizontalDirectionalBlock @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { @@ -53,10 +53,10 @@ index 52ca5dad75674b81b997f8a1cf3f5d52bf4313c1..2c4c5fc6d45225cc9f7f1c2038bd4d0a this.checkPressed(state, world, pos); } diff --git a/src/main/java/net/minecraft/world/level/block/CactusBlock.java b/src/main/java/net/minecraft/world/level/block/CactusBlock.java -index de61393e3f702554817d81ff10693ec3fb63d492..28b083a8220856723b6169b5b13677b965a4dab6 100644 +index 722f1816cd4130fa4b1e2310badedc77ab96eee6..2a02fdf58640d26b82e0ca22d0d8ff3326921b61 100644 --- a/src/main/java/net/minecraft/world/level/block/CactusBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CactusBlock.java -@@ -115,6 +115,7 @@ public class CactusBlock extends Block { +@@ -117,6 +117,7 @@ public class CactusBlock extends Block { @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { @@ -65,10 +65,10 @@ index de61393e3f702554817d81ff10693ec3fb63d492..28b083a8220856723b6169b5b13677b9 entity.hurt(DamageSource.CACTUS, 1.0F); CraftEventFactory.blockDamage = null; // CraftBukkit diff --git a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java -index 87f106ad9139157af69a0ae1602c32ed372a04be..b0c6ac74daea347f4acb5da95e6b0cb013827509 100644 +index f602ddb6fc5a9d026239c900ec800122663d6bfc..2519a0f511f0a6065459cd2fe2d9a3e68e55d222 100644 --- a/src/main/java/net/minecraft/world/level/block/CampfireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CampfireBlock.java -@@ -88,6 +88,7 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB +@@ -91,6 +91,7 @@ public class CampfireBlock extends BaseEntityBlock implements SimpleWaterloggedB @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { @@ -76,23 +76,11 @@ index 87f106ad9139157af69a0ae1602c32ed372a04be..b0c6ac74daea347f4acb5da95e6b0cb0 if (!entity.fireImmune() && (Boolean) state.getValue(CampfireBlock.LIT) && entity instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity) entity)) { entity.hurt(DamageSource.IN_FIRE, (float) this.fireDamage); } -diff --git a/src/main/java/net/minecraft/world/level/block/CauldronBlock.java b/src/main/java/net/minecraft/world/level/block/CauldronBlock.java -index 941061b50f7909278e962fb2aa080bb630862aa1..7d23adaa833c9c45708705294969fe268153b927 100644 ---- a/src/main/java/net/minecraft/world/level/block/CauldronBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/CauldronBlock.java -@@ -58,6 +58,7 @@ public class CauldronBlock extends Block { - - @Override - public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { -+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - int i = (Integer) state.getValue(CauldronBlock.LEVEL); - float f = (float) pos.getY() + (6.0F + (float) (3 * i)) / 16.0F; - diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java -index 4cd6f18e0a2ee8d0495b3c822b227e212a13b11f..8368a5911690a9abb26c0f381bda7a0633197548 100644 +index ea8047d4509632c9bc8247356f6eb3d1289db672..6dda5eeca4e310eceb2598322803bfafc184e9c7 100644 --- a/src/main/java/net/minecraft/world/level/block/CropBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java -@@ -159,6 +159,7 @@ public class CropBlock extends BushBlock implements BonemealableBlock { +@@ -163,6 +163,7 @@ public class CropBlock extends BushBlock implements BonemealableBlock { @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { @@ -101,7 +89,7 @@ index 4cd6f18e0a2ee8d0495b3c822b227e212a13b11f..8368a5911690a9abb26c0f381bda7a06 world.destroyBlock(pos, true, entity); } diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java -index 1854809e045300e84a713dc7c3a8264f53ec6c0f..d970fe7137f7dd37221b54e4025b98d15b950489 100644 +index 63c7f2cf530ac9562960ae5a3cbc6e511a009377..3705452f1b57d3bc1307411c7367529de0fa47e1 100644 --- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java @@ -44,6 +44,7 @@ public class DetectorRailBlock extends BaseRailBlock { @@ -113,10 +101,10 @@ index 1854809e045300e84a713dc7c3a8264f53ec6c0f..d970fe7137f7dd37221b54e4025b98d1 if (!(Boolean) state.getValue(DetectorRailBlock.POWERED)) { this.checkPressed(world, pos, state); diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java -index a6d793478be8e2aab1f72b68a6a96c86642ad1fc..2231680140d0e3c4c10b6722fd13fe0ee55ce294 100644 +index cc76a17492a67c1d2b97a8b6cd991db893de4414..834be24478b801d75be96ada91a4f18ccc3ee7b4 100644 --- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java +++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java -@@ -41,6 +41,7 @@ public class EndPortalBlock extends BaseEntityBlock { +@@ -44,6 +44,7 @@ public class EndPortalBlock extends BaseEntityBlock { @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { @@ -125,10 +113,10 @@ index a6d793478be8e2aab1f72b68a6a96c86642ad1fc..2231680140d0e3c4c10b6722fd13fe0e ResourceKey resourcekey = world.getTypeKey() == DimensionType.END_LOCATION ? Level.OVERWORLD : Level.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends ServerLevel worldserver = ((ServerLevel) world).getServer().getLevel(resourcekey); diff --git a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java -index 7d0206dc5ac46220970adad51863028840b4a9ad..ef74852a1677a4ec80149aa7eafca910fac5ee91 100644 +index 6f7bcf0ae17aec3e937ff52084f53681aacb9398..c6a988fdc92cd7329b4fd7c6b415fd2fe01aa8a3 100644 --- a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java +++ b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java -@@ -49,6 +49,7 @@ public class HoneyBlock extends HalfTransparentBlock { +@@ -55,6 +55,7 @@ public class HoneyBlock extends HalfTransparentBlock { @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { @@ -137,22 +125,46 @@ index 7d0206dc5ac46220970adad51863028840b4a9ad..ef74852a1677a4ec80149aa7eafca910 this.maybeDoSlideAchievement(entity, pos); this.doSlideMovement(entity); diff --git a/src/main/java/net/minecraft/world/level/block/HopperBlock.java b/src/main/java/net/minecraft/world/level/block/HopperBlock.java -index 1f50c2b4bebeb6a224eb0ac552d6ea693f7831a6..40b1bba69ae96e4cd652261e3f97850e2e7c51a3 100644 +index 9a58f017bbaa742cbb892c804011cc9396b8607c..386c3e458babc31ad3bf2b51c20d1cfde08647ac 100644 --- a/src/main/java/net/minecraft/world/level/block/HopperBlock.java +++ b/src/main/java/net/minecraft/world/level/block/HopperBlock.java -@@ -197,6 +197,7 @@ public class HopperBlock extends BaseEntityBlock { +@@ -200,6 +200,7 @@ public class HopperBlock extends BaseEntityBlock { @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - BlockEntity tileentity = world.getBlockEntity(pos); + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity instanceof HopperBlockEntity) { + HopperBlockEntity.entityInside(world, pos, state, entity, (HopperBlockEntity)blockEntity); +diff --git a/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java +index f0a3ef0529951e7732602d358ddea1782001db7e..6588b207d93d96934e72176874ba60c81e9a098c 100644 +--- a/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java +@@ -24,6 +24,7 @@ public class LavaCauldronBlock extends AbstractCauldronBlock { - if (tileentity instanceof HopperBlockEntity) { + @Override + public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper + if (this.isEntityInsideContent(state, pos, entity)) { + entity.lavaHurt(); + } +diff --git a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java +index 033b4e342d6c3978be084e65a2a7a3b23d6a7851..058f55c68ea788719b369efbe78a02dfadfcd960 100644 +--- a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java +@@ -59,6 +59,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock { + + @Override + public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper + if (!world.isClientSide && entity.isOnFire() && this.isEntityInsideContent(state, pos, entity)) { + // CraftBukkit start + if (entity.mayInteract(world, pos)) { diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java -index ae58929886921d0714bf811de92f99dc0dc120dc..53e7570cc2538e73f1cfe3d28ffc491f61cac372 100644 +index cfea29f5bf1c5e74a0292c1344baaaa49c2f4403..bc2f2c69d437e99cb965cede7dfd42228151b26c 100644 --- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java +++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java -@@ -81,6 +81,7 @@ public class NetherPortalBlock extends Block { +@@ -85,6 +85,7 @@ public class NetherPortalBlock extends Block { @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { @@ -160,11 +172,23 @@ index ae58929886921d0714bf811de92f99dc0dc120dc..53e7570cc2538e73f1cfe3d28ffc491f if (!entity.isPassenger() && !entity.isVehicle() && entity.canChangeDimensions()) { // CraftBukkit start - Entity in portal EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ())); +diff --git a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java +index ceda744e9f7e48051e046eb3171e80bded739ba8..1187a7382b8849524f99bbd8d12b43677f1053cd 100644 +--- a/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/PowderSnowBlock.java +@@ -54,6 +54,7 @@ public class PowderSnowBlock extends Block implements BucketPickup { + + @Override + public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper + if (!(entity instanceof LivingEntity) || entity.getFeetBlockState().is((Block) this)) { + entity.makeStuckInBlock(state, new Vec3(0.8999999761581421D, 1.5D, 0.8999999761581421D)); + if (world.isClientSide) { diff --git a/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java b/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java -index 09122e2031e9ddfae4544911f8c25b937b03933f..6b5e8654ddd2c268627d0244b01dadeaeb4a7de4 100644 +index 1a5590ff8e5122b5c7587347fcc38d73671c2747..71abf800e623336124bd9a955e07db4950286516 100644 --- a/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SweetBerryBushBlock.java -@@ -66,6 +66,7 @@ public class SweetBerryBushBlock extends BushBlock implements BonemealableBlock +@@ -73,6 +73,7 @@ public class SweetBerryBushBlock extends BushBlock implements BonemealableBlock @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { @@ -173,10 +197,10 @@ index 09122e2031e9ddfae4544911f8c25b937b03933f..6b5e8654ddd2c268627d0244b01dadea entity.makeStuckInBlock(state, new Vec3(0.800000011920929D, 0.75D, 0.800000011920929D)); if (!world.isClientSide && (Integer) state.getValue(SweetBerryBushBlock.AGE) > 0 && (entity.xOld != entity.getX() || entity.zOld != entity.getZ())) { diff --git a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java -index eaee409bc8fbf8c5541afd10d24975535556a7f6..a488a2a589126df617564d9278eb0496915b6f88 100644 +index baa14c23016df6687984447d1a1f071b29aa7b49..9cafee5bd1e432ed5f114c73cf616798cd71a379 100644 --- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java -@@ -118,6 +118,7 @@ public class TripWireBlock extends Block { +@@ -121,6 +121,7 @@ public class TripWireBlock extends Block { @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { @@ -197,22 +221,22 @@ index 2b2a28d0383ccc8c0e7debd90331570b02b5e65f..bd4295f8d24ca9fd8c3af31abcd13da2 world.destroyBlock(new BlockPos(pos), true, entity); } diff --git a/src/main/java/net/minecraft/world/level/block/WebBlock.java b/src/main/java/net/minecraft/world/level/block/WebBlock.java -index c368531420d464414de3661e1624e2a284976ab6..fc1c2e057e8b63048c919b5cbcc0a0e897f1dd01 100644 +index 6964308822ebf8a7027ce426062ba43a70c20c15..763fa221c562e96c2abd09c7055e91a86ac03d43 100644 --- a/src/main/java/net/minecraft/world/level/block/WebBlock.java +++ b/src/main/java/net/minecraft/world/level/block/WebBlock.java -@@ -15,6 +15,7 @@ public class WebBlock extends Block { +@@ -14,6 +14,7 @@ public class WebBlock extends Block { @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - entity.makeStuckInBlock(state, new Vec3(0.25D, 0.05000000074505806D, 0.25D)); + entity.makeStuckInBlock(state, new Vec3(0.25D, (double)0.05F, 0.25D)); } } diff --git a/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java b/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java -index c1648c28c761cdf31089d434f9cb896ddef41521..5cb4e1ec7ce3087163d2ecf26d043894310768d1 100644 +index adf1e71323ea84856ec2871b8e3227f29ff59c40..5b6fe6fa607c38e42a30d6c7c6f6fc93af93dd20 100644 --- a/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java +++ b/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java -@@ -26,6 +26,7 @@ public class WitherRoseBlock extends FlowerBlock { +@@ -46,6 +46,7 @@ public class WitherRoseBlock extends FlowerBlock { @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { diff --git a/patches/server-remapped/0744-Attributes-API-for-item-defaults.patch b/patches/server/0676-Attributes-API-for-item-defaults.patch similarity index 58% rename from patches/server-remapped/0744-Attributes-API-for-item-defaults.patch rename to patches/server/0676-Attributes-API-for-item-defaults.patch index ce7b672b14..f6dd86b8a3 100644 --- a/patches/server-remapped/0744-Attributes-API-for-item-defaults.patch +++ b/patches/server/0676-Attributes-API-for-item-defaults.patch @@ -4,34 +4,22 @@ Date: Sat, 8 May 2021 15:01:54 -0700 Subject: [PATCH] Attributes API for item defaults -diff --git a/src/main/java/net/minecraft/world/item/Item.java b/src/main/java/net/minecraft/world/item/Item.java -index 42085d3f4ae5c6ceecaffde79fb3187712a2af00..3043378c3addf959e0ccf323c1cde8b300b5f237 100644 ---- a/src/main/java/net/minecraft/world/item/Item.java -+++ b/src/main/java/net/minecraft/world/item/Item.java -@@ -274,6 +274,7 @@ public class Item implements ItemLike { - return false; - } - -+ public Multimap getAttributesForSlot(EquipmentSlot enumItemSlot) { return getDefaultAttributeModifiers(enumItemSlot); } // Paper - OBFHELPER - public Multimap getDefaultAttributeModifiers(EquipmentSlot slot) { - return ImmutableMultimap.of(); - } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 34eed57c7ed884e0d634ca403e38d25c95b6a038..824111fc74bade75ce06b1f0b57498006d0a66cd 100644 +index e1b1c754c4ca38331cbb524358becd64957295d0..e5fc463e2d2e4a1b3c394ceb21e25f1c286aeb0a 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -493,6 +493,19 @@ public final class CraftMagicNumbers implements UnsafeValues { - return this.getItem(itemToBeRepaired.getType()).canRepair(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial)); + return CraftMagicNumbers.getItem(itemToBeRepaired.getType()).isValidRepairItem(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial)); } + @Override + public com.google.common.collect.Multimap getItemAttributes(org.bukkit.Material material, org.bukkit.inventory.EquipmentSlot equipmentSlot) { -+ Item item = this.getItem(material); ++ Item item = CraftMagicNumbers.getItem(material); + if (item == null) { + throw new IllegalArgumentException(material + " is not an item and therefore does not have attributes"); + } + com.google.common.collect.ImmutableMultimap.Builder attributeMapBuilder = com.google.common.collect.ImmutableMultimap.builder(); -+ item.getAttributesForSlot(org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(equipmentSlot)).forEach((attributeBase, attributeModifier) -> { ++ item.getDefaultAttributeModifiers(org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(equipmentSlot)).forEach((attributeBase, attributeModifier) -> { + attributeMapBuilder.put(org.bukkit.Registry.ATTRIBUTE.get(CraftNamespacedKey.fromMinecraft(net.minecraft.core.Registry.ATTRIBUTE.getKey(attributeBase))), org.bukkit.craftbukkit.attribute.CraftAttributeInstance.convert(attributeModifier)); + }); + return attributeMapBuilder.build(); diff --git a/patches/server-remapped/0745-Have-CraftMerchantCustom-emit-PlayerPurchaseEvent.patch b/patches/server/0677-Have-CraftMerchantCustom-emit-PlayerPurchaseEvent.patch similarity index 76% rename from patches/server-remapped/0745-Have-CraftMerchantCustom-emit-PlayerPurchaseEvent.patch rename to patches/server/0677-Have-CraftMerchantCustom-emit-PlayerPurchaseEvent.patch index 339837dc3e..586065db50 100644 --- a/patches/server-remapped/0745-Have-CraftMerchantCustom-emit-PlayerPurchaseEvent.patch +++ b/patches/server/0677-Have-CraftMerchantCustom-emit-PlayerPurchaseEvent.patch @@ -4,21 +4,8 @@ Date: Thu, 6 May 2021 13:01:25 +0100 Subject: [PATCH] Have CraftMerchantCustom emit PlayerPurchaseEvent -diff --git a/src/main/java/net/minecraft/world/item/trading/Merchant.java b/src/main/java/net/minecraft/world/item/trading/Merchant.java -index 8298e667aa3a17d987bbc4cc2b63600af48beabc..334df355470bff98db63396b33c8db6a0abcc61a 100644 ---- a/src/main/java/net/minecraft/world/item/trading/Merchant.java -+++ b/src/main/java/net/minecraft/world/item/trading/Merchant.java -@@ -19,7 +19,7 @@ public interface Merchant { - - MerchantOffers getOffers(); - -- void notifyTrade(MerchantOffer offer); -+ void notifyTrade(MerchantOffer offer); default void handlePurchase(MerchantOffer merchantRecipe) { notifyTrade(merchantRecipe); } // Paper - OBFHELPER - - void notifyTradeUpdated(ItemStack stack); - diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java -index 306c6483708ae1b41bd16f122d36beec1916a776..d52192545c39734be3c97c7978652a54d7b9f029 100644 +index f40d6a0048ad5b3f6e31d83894ee89f5ca64fb3a..56a04cfdedfbc34be686304fc2dde59f1707d282 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java @@ -81,6 +81,35 @@ public class CraftMerchantCustom extends CraftMerchant { diff --git a/patches/server-remapped/0746-Add-cause-to-Weather-ThunderChangeEvents.patch b/patches/server/0678-Add-cause-to-Weather-ThunderChangeEvents.patch similarity index 57% rename from patches/server-remapped/0746-Add-cause-to-Weather-ThunderChangeEvents.patch rename to patches/server/0678-Add-cause-to-Weather-ThunderChangeEvents.patch index fb889a4693..b94ca80e31 100644 --- a/patches/server-remapped/0746-Add-cause-to-Weather-ThunderChangeEvents.patch +++ b/patches/server/0678-Add-cause-to-Weather-ThunderChangeEvents.patch @@ -5,53 +5,53 @@ Subject: [PATCH] Add cause to Weather/ThunderChangeEvents diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 511e6a941d441c55a4b38660f0f7f8c47fa689dd..85e62e3c52950a517c4dbae739d21d879cb467a4 100644 +index a2d9e093bf7b5ee947f1d7c3b94397cd93eedef7..985b8b9da26aba43b84e9fe363507627c625e6d3 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -413,8 +413,8 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - this.worldDataServer.setClearWeatherTime(clearDuration); - this.worldDataServer.setRainTime(rainDuration); - this.worldDataServer.setThunderTime(rainDuration); -- this.worldDataServer.setRaining(raining); -- this.worldDataServer.setThundering(thundering); -+ this.worldDataServer.setRaining(raining, org.bukkit.event.weather.WeatherChangeEvent.Cause.COMMAND); // Paper -+ this.worldDataServer.setThundering(thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause.COMMAND); // Paper +@@ -419,8 +419,8 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl + this.serverLevelData.setClearWeatherTime(clearDuration); + this.serverLevelData.setRainTime(rainDuration); + this.serverLevelData.setThunderTime(rainDuration); +- this.serverLevelData.setRaining(raining); +- this.serverLevelData.setThundering(thundering); ++ this.serverLevelData.setRaining(raining, org.bukkit.event.weather.WeatherChangeEvent.Cause.COMMAND); // Paper ++ this.serverLevelData.setThundering(thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause.COMMAND); // Paper } - public Biome getBiomeBySeed(int i, int j, int k) { return getUncachedNoiseBiome(i, j, k); } // Paper - OBFHELPER -@@ -476,8 +476,8 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - this.worldDataServer.setThunderTime(j); - this.worldDataServer.setRainTime(k); - this.worldDataServer.setClearWeatherTime(i); -- this.worldDataServer.setThundering(flag1); -- this.worldDataServer.setRaining(flag2); -+ this.worldDataServer.setThundering(flag1, org.bukkit.event.weather.ThunderChangeEvent.Cause.NATURAL); // Paper -+ this.worldDataServer.setRaining(flag2, org.bukkit.event.weather.WeatherChangeEvent.Cause.NATURAL); // Paper + @Override +@@ -483,8 +483,8 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl + this.serverLevelData.setThunderTime(j); + this.serverLevelData.setRainTime(k); + this.serverLevelData.setClearWeatherTime(i); +- this.serverLevelData.setThundering(flag1); +- this.serverLevelData.setRaining(flag2); ++ this.serverLevelData.setThundering(flag1, org.bukkit.event.weather.ThunderChangeEvent.Cause.NATURAL); // Paper ++ this.serverLevelData.setRaining(flag2, org.bukkit.event.weather.WeatherChangeEvent.Cause.NATURAL); // Paper } this.oThunderLevel = this.thunderLevel; -@@ -879,14 +879,14 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl +@@ -887,14 +887,14 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl private void stopWeather() { // CraftBukkit start -- this.worldDataServer.setRaining(false); -+ this.worldDataServer.setRaining(false, org.bukkit.event.weather.WeatherChangeEvent.Cause.SLEEP); // Paper - when passing the night +- this.serverLevelData.setRaining(false); ++ this.serverLevelData.setRaining(false, org.bukkit.event.weather.WeatherChangeEvent.Cause.SLEEP); // Paper - when passing the night // If we stop due to everyone sleeping we should reset the weather duration to some other random value. // Not that everyone ever manages to get the whole server to sleep at the same time.... - if (!this.worldDataServer.isRaining()) { - this.worldDataServer.setRainTime(0); + if (!this.serverLevelData.isRaining()) { + this.serverLevelData.setRainTime(0); } // CraftBukkit end -- this.worldDataServer.setThundering(false); -+ this.worldDataServer.setThundering(false, org.bukkit.event.weather.ThunderChangeEvent.Cause.SLEEP); // Paper - when passing the night +- this.serverLevelData.setThundering(false); ++ this.serverLevelData.setThundering(false, org.bukkit.event.weather.ThunderChangeEvent.Cause.SLEEP); // Paper - when passing the night // CraftBukkit start // If we stop due to everyone sleeping we should reset the weather duration to some other random value. // Not that everyone ever manages to get the whole server to sleep at the same time.... diff --git a/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java b/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java -index 83f2fdfa1ac2435f5199b5c33bfc409d2e94f4ed..e902534fd64f72e46feefa04f526e0dacd612627 100644 +index cd840dc4a8ca432868fb3e9c912ea928e5303e0d..4d0af984490b556a9911c3b8fdca1e168e6fe932 100644 --- a/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java +++ b/src/main/java/net/minecraft/world/level/storage/PrimaryLevelData.java -@@ -325,21 +325,26 @@ public class PrimaryLevelData implements ServerLevelData, WorldData { +@@ -330,21 +330,26 @@ public class PrimaryLevelData implements ServerLevelData, WorldData { @Override public void setThundering(boolean thundering) { @@ -66,7 +66,7 @@ index 83f2fdfa1ac2435f5199b5c33bfc409d2e94f4ed..e902534fd64f72e46feefa04f526e0da return; } - org.bukkit.World world = Bukkit.getWorld(getLevelName()); + org.bukkit.World world = Bukkit.getWorld(this.getLevelName()); if (world != null) { - ThunderChangeEvent thunder = new ThunderChangeEvent(world, thundering); + ThunderChangeEvent thunder = new ThunderChangeEvent(world, flag, cause); // Paper @@ -81,7 +81,7 @@ index 83f2fdfa1ac2435f5199b5c33bfc409d2e94f4ed..e902534fd64f72e46feefa04f526e0da } @Override -@@ -359,21 +364,27 @@ public class PrimaryLevelData implements ServerLevelData, WorldData { +@@ -364,6 +369,12 @@ public class PrimaryLevelData implements ServerLevelData, WorldData { @Override public void setRaining(boolean raining) { @@ -89,48 +89,39 @@ index 83f2fdfa1ac2435f5199b5c33bfc409d2e94f4ed..e902534fd64f72e46feefa04f526e0da + this.setRaining(raining, org.bukkit.event.weather.WeatherChangeEvent.Cause.UNKNOWN); + } + -+ public void setStorm(boolean flag, org.bukkit.event.weather.WeatherChangeEvent.Cause cause) { ++ public void setRaining(boolean raining, org.bukkit.event.weather.WeatherChangeEvent.Cause cause) { + // Paper end // CraftBukkit start -- if (this.raining == raining) { -+ if (this.raining == flag) { + if (this.raining == raining) { return; - } +@@ -371,7 +382,7 @@ public class PrimaryLevelData implements ServerLevelData, WorldData { - org.bukkit.World world = Bukkit.getWorld(getLevelName()); + org.bukkit.World world = Bukkit.getWorld(this.getLevelName()); if (world != null) { - WeatherChangeEvent weather = new WeatherChangeEvent(world, raining); -+ WeatherChangeEvent weather = new WeatherChangeEvent(world, flag, cause); // Paper ++ WeatherChangeEvent weather = new WeatherChangeEvent(world, raining, cause); // Paper Bukkit.getServer().getPluginManager().callEvent(weather); if (weather.isCancelled()) { return; - } - } - // CraftBukkit end -- this.raining = raining; -+ this.raining = flag; - } - - @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index a1fa2d5e00bd125abd38a00e0bc3936f2fb8186f..1c9321cef1a05c5e8a22dd52bc63a5103eaf7311 100644 +index 8a9d367cfcf49f80f05633d16a7019798fc808ec..fb90250f1b61c34a0a88bf50bc5b5bae09de9f0e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1452,7 +1452,7 @@ public class CraftWorld implements World { +@@ -1456,7 +1456,7 @@ public class CraftWorld implements World { @Override public void setStorm(boolean hasStorm) { - world.levelData.setRaining(hasStorm); -+ world.worldDataServer.setRaining(hasStorm, org.bukkit.event.weather.WeatherChangeEvent.Cause.PLUGIN); // Paper - setWeatherDuration(0); // Reset weather duration (legacy behaviour) - setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands) ++ world.serverLevelData.setRaining(hasStorm, org.bukkit.event.weather.WeatherChangeEvent.Cause.PLUGIN); // Paper + this.setWeatherDuration(0); // Reset weather duration (legacy behaviour) + this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands) } -@@ -1474,7 +1474,7 @@ public class CraftWorld implements World { +@@ -1478,7 +1478,7 @@ public class CraftWorld implements World { @Override public void setThundering(boolean thundering) { -- world.worldDataServer.setThundering(thundering); -+ world.worldDataServer.setThundering(thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause.PLUGIN); // Paper - setThunderDuration(0); // Reset weather duration (legacy behaviour) - setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands) +- world.serverLevelData.setThundering(thundering); ++ world.serverLevelData.setThundering(thundering, org.bukkit.event.weather.ThunderChangeEvent.Cause.PLUGIN); // Paper + this.setThunderDuration(0); // Reset weather duration (legacy behaviour) + this.setClearWeatherDuration(0); // Reset clear weather duration (reset "/weather clear" commands) } diff --git a/patches/server-remapped/0747-More-Lidded-Block-API.patch b/patches/server/0679-More-Lidded-Block-API.patch similarity index 64% rename from patches/server-remapped/0747-More-Lidded-Block-API.patch rename to patches/server/0679-More-Lidded-Block-API.patch index 5a3dcda899..946581e92d 100644 --- a/patches/server-remapped/0747-More-Lidded-Block-API.patch +++ b/patches/server/0679-More-Lidded-Block-API.patch @@ -4,70 +4,40 @@ Date: Sun, 23 May 2021 17:49:51 +0900 Subject: [PATCH] More Lidded Block API -diff --git a/src/main/java/net/minecraft/world/level/block/entity/EnderChestBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/EnderChestBlockEntity.java -index 8f0477d9620ef71e10855bbca07f9b6984d5d794..70ca456fad052ca6eeaf8c4242c78d15d81084a5 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/EnderChestBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/EnderChestBlockEntity.java -@@ -10,8 +10,9 @@ public class EnderChestBlockEntity extends BlockEntity { // Paper - Remove ITick - - public float openness; - public float oOpenness; -- public int openCount; -+ public int openCount; public int getViewerCount() { return openCount; } // Paper - OBFHELPER - private int tickInterval; -+ public boolean opened; // Paper - More Lidded Block API - - public EnderChestBlockEntity() { - super(BlockEntityType.ENDER_CHEST); -@@ -106,12 +107,14 @@ public class EnderChestBlockEntity extends BlockEntity { // Paper - Remove ITick - - public void startOpen() { - ++this.openCount; -+ if (opened) return; // Paper - More Lidded Block API - this.level.blockEvent(this.worldPosition, Blocks.ENDER_CHEST, 1, this.openCount); - doOpenLogic(); // Paper - } - - public void stopOpen() { - --this.openCount; -+ if (opened) return; // Paper - More Lidded Block API - this.level.blockEvent(this.worldPosition, Blocks.ENDER_CHEST, 1, this.openCount); - doCloseLogic(); // Paper - } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java -index a0eadcbcb2575eb18f7b4951ae9eadfbc2e8af6f..fc4397a48425a23d64e0a679ace9e58fbf9b770b 100644 +index dcae26b698d31a8b0107b0f9757efa34f53b030a..c0e7ae7ae38d55088e1b6ae6c80b849fd740cb1a 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBarrel.java @@ -59,4 +59,11 @@ public class CraftBarrel extends CraftLootable implements Bar } - getTileEntity().opened = false; + getTileEntity().openersCounter.opened = false; } + + // Paper start - More Lidded Block API + @Override + public boolean isOpen() { -+ return getTileEntity().opened; ++ return getTileEntity().openersCounter.opened; + } + // Paper end - More Lidded Block API } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java -index a821df3e13e2ddc479dc5f55540671f43563cdac..9d7af8717085ba5c170a998aa863686d72840a40 100644 +index f48b830a9ae8160388cb0d0220a44b1ec9f0d214..5045507871db402305a43430194b4c5e965300ad 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java -@@ -78,4 +78,11 @@ public class CraftChest extends CraftLootable implements Chest +@@ -79,4 +79,11 @@ public class CraftChest extends CraftLootable implements Chest } - getTileEntity().opened = false; + getTileEntity().openersCounter.opened = false; } + + // Paper start - More Lidded Block API + @Override + public boolean isOpen() { -+ return getTileEntity().opened; ++ return getTileEntity().openersCounter.opened; + } + // Paper end - More Lidded Block API } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java -index 25add8bee6ea35beeb205dd828759304346e4f48..fabcb2b8dc950fd074d65fed95d6b371dcfbf842 100644 +index 25add8bee6ea35beeb205dd828759304346e4f48..d4a5810111c81845c3b465468b470535f814889b 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java @@ -14,4 +14,33 @@ public class CraftEnderChest extends CraftBlockEntityState 0) {