From f777faa8c12ee62987d5e2927c4ecfd4a747374d Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Mon, 14 Jun 2021 12:17:47 -0700 Subject: [PATCH] more patches & fixes to existing patches --- ...3-Added-ServerResourcesReloadedEvent.patch | 0 .../0254-Add-BlockFailedDispenseEvent.patch | 0 ...5-Added-PlayerLecternPageChangeEvent.patch | 0 ...6-Added-PlayerLoomPatternSelectEvent.patch | 0 .../0257-Better-AnnotationTest-printout.patch | 4 +- ...xact-interaction-point-in-PlayerInte.patch | 0 ...g-for-servers-not-running-on-Java-16.patch | 1 + ...6-Added-ServerResourcesReloadedEvent.patch | 90 ------------------ ...9-Added-PlayerLecternPageChangeEvent.patch | 66 ------------- ...1-Added-PlayerLoomPatternSelectEvent.patch | 63 ------------- .../0645-Remove-stale-POIs.patch | 50 ---------- ...rbose-world-setting-to-false-by-def.patch} | 0 ...ng-zombie-villager-discount-exploit.patch} | 0 ....patch => 0553-Limit-recipe-packets.patch} | 0 ...-CraftSound-backwards-compatibility.patch} | 0 ... 0555-MC-4-Fix-item-position-desync.patch} | 0 ...556-Player-Chunk-Load-Unload-Events.patch} | 0 ...7-Optimize-Dynamic-get-Missing-Keys.patch} | 0 ...-Expose-LivingEntity-hurt-direction.patch} | 0 ...OBSTRUCTED-reason-to-BedEnterResult.patch} | 0 ...-invalid-ingredient-lists-in-Villag.patch} | 0 ...atch => 0561-added-PlayerTradeEvent.patch} | 0 ...ch => 0562-Implement-TargetHitEvent.patch} | 0 ...563-Additional-Block-Material-API-s.patch} | 0 ...tch => 0564-Fix-harming-potion-dupe.patch} | 0 ...get-Material-from-Boats-and-Minecar.patch} | 0 ....patch => 0566-Cache-burn-durations.patch} | 0 ...ob-spawner-spawn-egg-transformation.patch} | 0 ...ment-PlayerFlowerPotManipulateEvent.patch} | 0 ...event-not-being-called-in-adventure.patch} | 0 ...h => 0570-Zombie-API-breaking-doors.patch} | 0 ...571-Fix-nerfed-slime-when-splitting.patch} | 0 ...=> 0572-Add-EntityLoadCrossbowEvent.patch} | 0 ...ch => 0573-Guardian-beam-workaround.patch} | 4 +- ...0574-Added-WorldGameRuleChangeEvent.patch} | 0 ...5-Added-ServerResourcesReloadedEvent.patch | 54 +++++++++++ ...d-settings-for-mobs-picking-up-loot.patch} | 16 ++-- ...mplemented-BlockFailedDispenseEvent.patch} | 43 +++------ ...8-Added-PlayerLecternPageChangeEvent.patch | 46 ++++++++++ ...9-Added-PlayerLoomPatternSelectEvent.patch | 34 +++++++ ...nfigurable-door-breaking-difficulty.patch} | 92 ++++++++++--------- ...ty-commands-shall-not-be-dispatched.patch} | 4 +- ...I-to-expose-exact-interaction-point.patch} | 20 ++-- patches/server/0583-Remove-stale-POIs.patch | 22 +++++ 44 files changed, 244 insertions(+), 365 deletions(-) rename patches/{api-unmapped => api}/0253-Added-ServerResourcesReloadedEvent.patch (100%) rename patches/{api-unmapped => api}/0254-Add-BlockFailedDispenseEvent.patch (100%) rename patches/{api-unmapped => api}/0255-Added-PlayerLecternPageChangeEvent.patch (100%) rename patches/{api-unmapped => api}/0256-Added-PlayerLoomPatternSelectEvent.patch (100%) rename patches/{api-unmapped => api}/0257-Better-AnnotationTest-printout.patch (95%) rename patches/{api-unmapped => api}/0258-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch (100%) rename patches/{server => removed/1.17}/0551-Add-warning-for-servers-not-running-on-Java-16.patch (99%) delete mode 100644 patches/server-remapped/0636-Added-ServerResourcesReloadedEvent.patch delete mode 100644 patches/server-remapped/0639-Added-PlayerLecternPageChangeEvent.patch delete mode 100644 patches/server-remapped/0641-Added-PlayerLoomPatternSelectEvent.patch delete mode 100644 patches/server-remapped/0645-Remove-stale-POIs.patch rename patches/server/{0552-Set-spigots-verbose-world-setting-to-false-by-def.patch => 0551-Set-spigots-verbose-world-setting-to-false-by-def.patch} (100%) rename patches/server/{0553-Fix-curing-zombie-villager-discount-exploit.patch => 0552-Fix-curing-zombie-villager-discount-exploit.patch} (100%) rename patches/server/{0554-Limit-recipe-packets.patch => 0553-Limit-recipe-packets.patch} (100%) rename patches/server/{0555-Fix-CraftSound-backwards-compatibility.patch => 0554-Fix-CraftSound-backwards-compatibility.patch} (100%) rename patches/server/{0556-MC-4-Fix-item-position-desync.patch => 0555-MC-4-Fix-item-position-desync.patch} (100%) rename patches/server/{0557-Player-Chunk-Load-Unload-Events.patch => 0556-Player-Chunk-Load-Unload-Events.patch} (100%) rename patches/server/{0558-Optimize-Dynamic-get-Missing-Keys.patch => 0557-Optimize-Dynamic-get-Missing-Keys.patch} (100%) rename patches/server/{0559-Expose-LivingEntity-hurt-direction.patch => 0558-Expose-LivingEntity-hurt-direction.patch} (100%) rename patches/server/{0560-Add-OBSTRUCTED-reason-to-BedEnterResult.patch => 0559-Add-OBSTRUCTED-reason-to-BedEnterResult.patch} (100%) rename patches/server/{0561-Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch => 0560-Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch} (100%) rename patches/server/{0562-added-PlayerTradeEvent.patch => 0561-added-PlayerTradeEvent.patch} (100%) rename patches/server/{0563-Implement-TargetHitEvent.patch => 0562-Implement-TargetHitEvent.patch} (100%) rename patches/server/{0564-Additional-Block-Material-API-s.patch => 0563-Additional-Block-Material-API-s.patch} (100%) rename patches/server/{0565-Fix-harming-potion-dupe.patch => 0564-Fix-harming-potion-dupe.patch} (100%) rename patches/server/{0566-Implement-API-to-get-Material-from-Boats-and-Minecar.patch => 0565-Implement-API-to-get-Material-from-Boats-and-Minecar.patch} (100%) rename patches/server/{0567-Cache-burn-durations.patch => 0566-Cache-burn-durations.patch} (100%) rename patches/server/{0568-Allow-disabling-mob-spawner-spawn-egg-transformation.patch => 0567-Allow-disabling-mob-spawner-spawn-egg-transformation.patch} (100%) rename patches/server/{0569-Implement-PlayerFlowerPotManipulateEvent.patch => 0568-Implement-PlayerFlowerPotManipulateEvent.patch} (100%) rename patches/server/{0570-Fix-interact-event-not-being-called-in-adventure.patch => 0569-Fix-interact-event-not-being-called-in-adventure.patch} (100%) rename patches/server/{0571-Zombie-API-breaking-doors.patch => 0570-Zombie-API-breaking-doors.patch} (100%) rename patches/server/{0572-Fix-nerfed-slime-when-splitting.patch => 0571-Fix-nerfed-slime-when-splitting.patch} (100%) rename patches/server/{0573-Add-EntityLoadCrossbowEvent.patch => 0572-Add-EntityLoadCrossbowEvent.patch} (100%) rename patches/server/{0574-Guardian-beam-workaround.patch => 0573-Guardian-beam-workaround.patch} (90%) rename patches/server/{0575-Added-WorldGameRuleChangeEvent.patch => 0574-Added-WorldGameRuleChangeEvent.patch} (100%) create mode 100644 patches/server/0575-Added-ServerResourcesReloadedEvent.patch rename patches/{server-remapped/0637-Added-world-settings-for-mobs-picking-up-loot.patch => server/0576-Added-world-settings-for-mobs-picking-up-loot.patch} (82%) rename patches/{server-remapped/0638-Implemented-BlockFailedDispenseEvent.patch => server/0577-Implemented-BlockFailedDispenseEvent.patch} (55%) create mode 100644 patches/server/0578-Added-PlayerLecternPageChangeEvent.patch create mode 100644 patches/server/0579-Added-PlayerLoomPatternSelectEvent.patch rename patches/{server-remapped/0642-Configurable-door-breaking-difficulty.patch => server/0580-Configurable-door-breaking-difficulty.patch} (63%) rename patches/{server-remapped/0643-Empty-commands-shall-not-be-dispatched.patch => server/0581-Empty-commands-shall-not-be-dispatched.patch} (84%) rename patches/{server-remapped/0644-Implement-API-to-expose-exact-interaction-point.patch => server/0582-Implement-API-to-expose-exact-interaction-point.patch} (82%) create mode 100644 patches/server/0583-Remove-stale-POIs.patch diff --git a/patches/api-unmapped/0253-Added-ServerResourcesReloadedEvent.patch b/patches/api/0253-Added-ServerResourcesReloadedEvent.patch similarity index 100% rename from patches/api-unmapped/0253-Added-ServerResourcesReloadedEvent.patch rename to patches/api/0253-Added-ServerResourcesReloadedEvent.patch diff --git a/patches/api-unmapped/0254-Add-BlockFailedDispenseEvent.patch b/patches/api/0254-Add-BlockFailedDispenseEvent.patch similarity index 100% rename from patches/api-unmapped/0254-Add-BlockFailedDispenseEvent.patch rename to patches/api/0254-Add-BlockFailedDispenseEvent.patch diff --git a/patches/api-unmapped/0255-Added-PlayerLecternPageChangeEvent.patch b/patches/api/0255-Added-PlayerLecternPageChangeEvent.patch similarity index 100% rename from patches/api-unmapped/0255-Added-PlayerLecternPageChangeEvent.patch rename to patches/api/0255-Added-PlayerLecternPageChangeEvent.patch diff --git a/patches/api-unmapped/0256-Added-PlayerLoomPatternSelectEvent.patch b/patches/api/0256-Added-PlayerLoomPatternSelectEvent.patch similarity index 100% rename from patches/api-unmapped/0256-Added-PlayerLoomPatternSelectEvent.patch rename to patches/api/0256-Added-PlayerLoomPatternSelectEvent.patch diff --git a/patches/api-unmapped/0257-Better-AnnotationTest-printout.patch b/patches/api/0257-Better-AnnotationTest-printout.patch similarity index 95% rename from patches/api-unmapped/0257-Better-AnnotationTest-printout.patch rename to patches/api/0257-Better-AnnotationTest-printout.patch index 2a40d2b44..557bf7adf 100644 --- a/patches/api-unmapped/0257-Better-AnnotationTest-printout.patch +++ b/patches/api/0257-Better-AnnotationTest-printout.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Better AnnotationTest printout diff --git a/pom.xml b/pom.xml -index 6b71d9a397dd5b72320402a47b8e7197d24e061c..73fbd5d5a591871a3a386fb5c455cd96a3992e7a 100644 +index aefaeec678b2f6b5ba1c15e43c4886eb9af6b143..33771618d2fd7591db020af57df358c891b11d6d 100644 --- a/pom.xml +++ b/pom.xml -@@ -257,6 +257,19 @@ +@@ -250,6 +250,19 @@ true diff --git a/patches/api-unmapped/0258-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch b/patches/api/0258-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch similarity index 100% rename from patches/api-unmapped/0258-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch rename to patches/api/0258-Add-API-to-get-exact-interaction-point-in-PlayerInte.patch diff --git a/patches/server/0551-Add-warning-for-servers-not-running-on-Java-16.patch b/patches/removed/1.17/0551-Add-warning-for-servers-not-running-on-Java-16.patch similarity index 99% rename from patches/server/0551-Add-warning-for-servers-not-running-on-Java-16.patch rename to patches/removed/1.17/0551-Add-warning-for-servers-not-running-on-Java-16.patch index 81a48dfbb..eba2d26c5 100644 --- a/patches/server/0551-Add-warning-for-servers-not-running-on-Java-16.patch +++ b/patches/removed/1.17/0551-Add-warning-for-servers-not-running-on-Java-16.patch @@ -3,6 +3,7 @@ From: Kyle Wood Date: Wed, 2 Dec 2020 21:58:45 -0800 Subject: [PATCH] Add warning for servers not running on Java 16 +1.17: game requires java 16 diff --git a/src/main/java/io/papermc/paper/util/PaperJvmChecker.java b/src/main/java/io/papermc/paper/util/PaperJvmChecker.java new file mode 100644 diff --git a/patches/server-remapped/0636-Added-ServerResourcesReloadedEvent.patch b/patches/server-remapped/0636-Added-ServerResourcesReloadedEvent.patch deleted file mode 100644 index 02aef6be6..000000000 --- a/patches/server-remapped/0636-Added-ServerResourcesReloadedEvent.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 2 Dec 2020 20:04:01 -0800 -Subject: [PATCH] Added ServerResourcesReloadedEvent - - -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c83f2636ae93d92381e019d5b13ac82c5a1d30bf..892ca65d258b0745be95d7ef4886c49899b24d92 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -2,9 +2,6 @@ package net.minecraft.server; - - import com.google.common.base.Splitter; - import com.google.common.collect.ImmutableList; --import co.aikar.timings.Timings; --import com.destroystokyo.paper.event.server.PaperServerListPingEvent; --import com.google.common.base.Stopwatch; - import com.google.common.collect.Lists; - import com.google.common.collect.Maps; - import com.google.common.collect.Sets; -@@ -181,6 +178,7 @@ import org.bukkit.event.server.ServerLoadEvent; - import co.aikar.timings.MinecraftTimings; // Paper - import org.spigotmc.SlackActivityAccountant; // Spigot - import io.papermc.paper.util.PaperJvmChecker; // Paper -+import io.papermc.paper.event.server.ServerResourcesReloadedEvent; // Paper - - public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements SnooperPopulator, CommandSource, AutoCloseable { - -@@ -1934,9 +1932,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop reloadResources(Collection datapacks) { -+ return this.reloadServerResources(datapacks, ServerResourcesReloadedEvent.Cause.PLUGIN); -+ } -+ public CompletableFuture reloadServerResources(Collection collection, ServerResourcesReloadedEvent.Cause cause) { -+ // Paper end - CompletableFuture completablefuture = CompletableFuture.supplyAsync(() -> { -- Stream stream = datapacks.stream(); // CraftBukkit - decompile error -+ Stream stream = collection.stream(); // CraftBukkit - decompile error - PackRepository resourcepackrepository = this.packRepository; - - this.packRepository.getClass(); -@@ -1947,9 +1951,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop collection, CommandSourceStack commandlistenerwrapper) { -- commandlistenerwrapper.getServer().reloadResources(collection).exceptionally((throwable) -> { -- ReloadCommand.LOGGER.warn("Failed to execute reload", throwable); -- commandlistenerwrapper.sendFailure(new TranslatableComponent("commands.reload.failure")); -+ commandlistenerwrapper.getServer().reloadServerResources(collection, ServerResourcesReloadedEvent.Cause.COMMAND).exceptionally((throwable) -> { // Paper -+ CommandReload.LOGGER.warn("Failed to execute reload", throwable); -+ commandlistenerwrapper.sendFailureMessage(new ChatMessage("commands.reload.failure")); - return null; - }); - } -@@ -48,7 +49,7 @@ public class ReloadCommand { - WorldData savedata = minecraftserver.getWorldData(); - Collection collection = resourcepackrepository.getSelectedIds(); - Collection collection1 = discoverNewPacks(resourcepackrepository, savedata, collection); -- minecraftserver.reloadResources(collection1); -+ minecraftserver.reloadServerResources(collection1, ServerResourcesReloadedEvent.Cause.PLUGIN); // Paper - } - // CraftBukkit end - diff --git a/patches/server-remapped/0639-Added-PlayerLecternPageChangeEvent.patch b/patches/server-remapped/0639-Added-PlayerLecternPageChangeEvent.patch deleted file mode 100644 index b4eacbfa3..000000000 --- a/patches/server-remapped/0639-Added-PlayerLecternPageChangeEvent.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Mon, 23 Nov 2020 12:58:51 -0800 -Subject: [PATCH] Added PlayerLecternPageChangeEvent - - -diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java -index bc39e7464646d712b085251dc0277a5b1ec0a393..b5d79635cd8b0eb6b17962450b347010aeb52654 100644 ---- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java -+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java -@@ -561,6 +561,7 @@ public abstract class AbstractContainerMenu { - this.getSlot(slot).set(stack); - } - -+ public void setData(int index, int value) { this.setData(index, value); } // Paper - OBFHELPER - public void setData(int id, int value) { - ((DataSlot) this.dataSlots.get(id)).set(value); - } -diff --git a/src/main/java/net/minecraft/world/inventory/LecternMenu.java b/src/main/java/net/minecraft/world/inventory/LecternMenu.java -index 29e8dbc6be57faf50a8ca68eed6bf2e203b7e87a..a7be91a9336065899c409526a890e55f37b98751 100644 ---- a/src/main/java/net/minecraft/world/inventory/LecternMenu.java -+++ b/src/main/java/net/minecraft/world/inventory/LecternMenu.java -@@ -11,6 +11,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView; - import org.bukkit.entity.Player; - import org.bukkit.event.player.PlayerTakeLecternBookEvent; - // CraftBukkit end -+import io.papermc.paper.event.player.PlayerLecternPageChangeEvent; // Paper - - public class LecternMenu extends AbstractContainerMenu { - -@@ -58,6 +59,7 @@ public class LecternMenu extends AbstractContainerMenu { - @Override - public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) { - int j; -+ PlayerLecternPageChangeEvent playerLecternPageChangeEvent; CraftInventoryLectern bukkitView; // Paper - - if (id >= 100) { - j = id - 100; -@@ -67,11 +69,25 @@ public class LecternMenu extends AbstractContainerMenu { - switch (id) { - case 1: - j = this.lecternData.get(0); -- this.setData(0, j - 1); -+ // Paper start -+ bukkitView = (CraftInventoryLectern) getBukkitView().getTopInventory(); -+ playerLecternPageChangeEvent = new PlayerLecternPageChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), bukkitView.getHolder(), bukkitView.getBook(), PlayerLecternPageChangeEvent.PageChangeDirection.LEFT, j, j - 1); -+ if (!playerLecternPageChangeEvent.callEvent()) { -+ return false; -+ } -+ this.setData(0, playerLecternPageChangeEvent.getNewPage()); -+ // Paper end - return true; - case 2: - j = this.lecternData.get(0); -- this.setData(0, j + 1); -+ // Paper start -+ bukkitView = (CraftInventoryLectern) getBukkitView().getTopInventory(); -+ playerLecternPageChangeEvent = new PlayerLecternPageChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), bukkitView.getHolder(), bukkitView.getBook(), PlayerLecternPageChangeEvent.PageChangeDirection.RIGHT, j, j + 1); -+ if (!playerLecternPageChangeEvent.callEvent()) { -+ return false; -+ } -+ this.setData(0, playerLecternPageChangeEvent.getNewPage()); -+ // Paper end - return true; - case 3: - if (!player.mayBuild()) { diff --git a/patches/server-remapped/0641-Added-PlayerLoomPatternSelectEvent.patch b/patches/server-remapped/0641-Added-PlayerLoomPatternSelectEvent.patch deleted file mode 100644 index 3c2cf5afe..000000000 --- a/patches/server-remapped/0641-Added-PlayerLoomPatternSelectEvent.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic -Date: Wed, 25 Nov 2020 16:33:27 -0800 -Subject: [PATCH] Added PlayerLoomPatternSelectEvent - - -diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java -index 3460fb2bb1451b8456a7fe42449ec4dbce641f40..0dc1b0b7181c0f93dcf6213c63baffcd4694d70c 100644 ---- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java -+++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java -@@ -20,6 +20,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryLoom; - import org.bukkit.craftbukkit.inventory.CraftInventoryView; - import org.bukkit.entity.Player; - // CraftBukkit end -+import io.papermc.paper.event.player.PlayerLoomPatternSelectEvent; // Paper - - public class LoomMenu extends AbstractContainerMenu { - -@@ -39,7 +40,7 @@ public class LoomMenu extends AbstractContainerMenu { - } - // CraftBukkit end - private final ContainerLevelAccess access; -- private final DataSlot selectedBannerPatternIndex; -+ private final DataSlot selectedBannerPatternIndex; public final DataSlot getSelectedBannerPattern() { return this.selectedBannerPatternIndex; }; // Paper - OBFHELPER - private Runnable slotUpdateListener; - private final Slot bannerSlot; - private final Slot dyeSlot; -@@ -158,7 +159,22 @@ public class LoomMenu extends AbstractContainerMenu { - @Override - public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) { - if (id > 0 && id <= BannerPattern.AVAILABLE_PATTERNS) { -- this.selectedBannerPatternIndex.set(id); -+ // Paper start -+ int enumBannerPatternTypeOrdinal = id; -+ PlayerLoomPatternSelectEvent event = new PlayerLoomPatternSelectEvent((Player) player.getBukkitEntity(), ((CraftInventoryLoom) getBukkitView().getTopInventory()), org.bukkit.block.banner.PatternType.getByIdentifier(BannerPattern.values()[id].getIdentifier())); -+ if (!event.callEvent()) { -+ ((Player) player.getBukkitEntity()).updateInventory(); -+ return false; -+ } -+ for (BannerPattern nms : BannerPattern.values()) { -+ if (event.getPatternType().getIdentifier().equals(nms.getIdentifier())) { -+ enumBannerPatternTypeOrdinal = nms.ordinal(); -+ break; -+ } -+ } -+ ((Player) player.getBukkitEntity()).updateInventory(); -+ this.getSelectedBannerPattern().set(enumBannerPatternTypeOrdinal); -+ // Paper end - this.setupResultSlot(); - return true; - } else { -diff --git a/src/main/java/net/minecraft/world/level/block/entity/BannerPattern.java b/src/main/java/net/minecraft/world/level/block/entity/BannerPattern.java -index 9ea01d5888a21b0dedb555d118a4dc07af2b50fd..9ee3f8bb2294fc552735a64efbddf661d39602c7 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/BannerPattern.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/BannerPattern.java -@@ -33,6 +33,7 @@ public enum BannerPattern { - this.hasPatternItem = flag; - } - -+ public String getIdentifier() { return this.getHashname(); } // Paper - OBFHELPER - public String getHashname() { - return this.hashname; - } diff --git a/patches/server-remapped/0645-Remove-stale-POIs.patch b/patches/server-remapped/0645-Remove-stale-POIs.patch deleted file mode 100644 index 561ae57f8..000000000 --- a/patches/server-remapped/0645-Remove-stale-POIs.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder -Date: Sat, 9 Jan 2021 14:17:07 +0100 -Subject: [PATCH] Remove stale POIs - - -diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index fe7b71fbb3963beafe93a5d86bebdd629c7ec8f2..9f1838d12b13d64f10871eb672ed2aec78d9936e 100644 ---- a/src/main/java/net/minecraft/server/level/ServerLevel.java -+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2071,6 +2071,11 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - }); - optional1.ifPresent((villageplacetype) -> { - this.getServer().execute(() -> { -+ // Paper start -+ if (!optional.isPresent() && this.getPoiStorage().test(blockposition1, com.google.common.base.Predicates.alwaysTrue())) { -+ this.getPoiStorage().remove(blockposition1); -+ } -+ // Paper end - this.getPoiManager().add(blockposition1, villageplacetype); - DebugPackets.sendPoiAddedPacket(this, blockposition1); - }); -@@ -2078,6 +2083,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl - } - } - -+ public final PoiManager getPoiStorage() { return this.getPoiManager(); } // Paper - OBFHELPER - public PoiManager getPoiManager() { - return this.getChunkSource().getPoiManager(); - } -diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java -index b9d32e3322c2cce1aca2a90df71b6175a6f8c548..25b26a78a55f98687ed22e986b54d5e9d47a16ea 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java -+++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java -@@ -54,6 +54,7 @@ public class PoiManager extends SectionStorage { - ((PoiSection) this.getOrCreate(SectionPos.of(pos).asLong())).add(pos, type); - } - -+ public void remove(BlockPos blockposition) { this.remove(blockposition); } // Paper - OBFHELPER - public void remove(BlockPos pos) { - ((PoiSection) this.getOrCreate(SectionPos.of(pos).asLong())).remove(pos); - } -@@ -138,6 +139,7 @@ public class PoiManager extends SectionStorage { - return ((PoiSection) this.getOrCreate(SectionPos.of(pos).asLong())).release(pos); - } - -+ public final boolean test(BlockPos blockposition, Predicate predicate) { return this.exists(blockposition, predicate); } // Paper - OBFHELPER - public boolean exists(BlockPos pos, Predicate predicate) { - return (Boolean) this.getOrLoad(SectionPos.of(pos).asLong()).map((villageplacesection) -> { - return villageplacesection.exists(pos, predicate); diff --git a/patches/server/0552-Set-spigots-verbose-world-setting-to-false-by-def.patch b/patches/server/0551-Set-spigots-verbose-world-setting-to-false-by-def.patch similarity index 100% rename from patches/server/0552-Set-spigots-verbose-world-setting-to-false-by-def.patch rename to patches/server/0551-Set-spigots-verbose-world-setting-to-false-by-def.patch diff --git a/patches/server/0553-Fix-curing-zombie-villager-discount-exploit.patch b/patches/server/0552-Fix-curing-zombie-villager-discount-exploit.patch similarity index 100% rename from patches/server/0553-Fix-curing-zombie-villager-discount-exploit.patch rename to patches/server/0552-Fix-curing-zombie-villager-discount-exploit.patch diff --git a/patches/server/0554-Limit-recipe-packets.patch b/patches/server/0553-Limit-recipe-packets.patch similarity index 100% rename from patches/server/0554-Limit-recipe-packets.patch rename to patches/server/0553-Limit-recipe-packets.patch diff --git a/patches/server/0555-Fix-CraftSound-backwards-compatibility.patch b/patches/server/0554-Fix-CraftSound-backwards-compatibility.patch similarity index 100% rename from patches/server/0555-Fix-CraftSound-backwards-compatibility.patch rename to patches/server/0554-Fix-CraftSound-backwards-compatibility.patch diff --git a/patches/server/0556-MC-4-Fix-item-position-desync.patch b/patches/server/0555-MC-4-Fix-item-position-desync.patch similarity index 100% rename from patches/server/0556-MC-4-Fix-item-position-desync.patch rename to patches/server/0555-MC-4-Fix-item-position-desync.patch diff --git a/patches/server/0557-Player-Chunk-Load-Unload-Events.patch b/patches/server/0556-Player-Chunk-Load-Unload-Events.patch similarity index 100% rename from patches/server/0557-Player-Chunk-Load-Unload-Events.patch rename to patches/server/0556-Player-Chunk-Load-Unload-Events.patch diff --git a/patches/server/0558-Optimize-Dynamic-get-Missing-Keys.patch b/patches/server/0557-Optimize-Dynamic-get-Missing-Keys.patch similarity index 100% rename from patches/server/0558-Optimize-Dynamic-get-Missing-Keys.patch rename to patches/server/0557-Optimize-Dynamic-get-Missing-Keys.patch diff --git a/patches/server/0559-Expose-LivingEntity-hurt-direction.patch b/patches/server/0558-Expose-LivingEntity-hurt-direction.patch similarity index 100% rename from patches/server/0559-Expose-LivingEntity-hurt-direction.patch rename to patches/server/0558-Expose-LivingEntity-hurt-direction.patch diff --git a/patches/server/0560-Add-OBSTRUCTED-reason-to-BedEnterResult.patch b/patches/server/0559-Add-OBSTRUCTED-reason-to-BedEnterResult.patch similarity index 100% rename from patches/server/0560-Add-OBSTRUCTED-reason-to-BedEnterResult.patch rename to patches/server/0559-Add-OBSTRUCTED-reason-to-BedEnterResult.patch diff --git a/patches/server/0561-Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch b/patches/server/0560-Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch similarity index 100% rename from patches/server/0561-Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch rename to patches/server/0560-Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch diff --git a/patches/server/0562-added-PlayerTradeEvent.patch b/patches/server/0561-added-PlayerTradeEvent.patch similarity index 100% rename from patches/server/0562-added-PlayerTradeEvent.patch rename to patches/server/0561-added-PlayerTradeEvent.patch diff --git a/patches/server/0563-Implement-TargetHitEvent.patch b/patches/server/0562-Implement-TargetHitEvent.patch similarity index 100% rename from patches/server/0563-Implement-TargetHitEvent.patch rename to patches/server/0562-Implement-TargetHitEvent.patch diff --git a/patches/server/0564-Additional-Block-Material-API-s.patch b/patches/server/0563-Additional-Block-Material-API-s.patch similarity index 100% rename from patches/server/0564-Additional-Block-Material-API-s.patch rename to patches/server/0563-Additional-Block-Material-API-s.patch diff --git a/patches/server/0565-Fix-harming-potion-dupe.patch b/patches/server/0564-Fix-harming-potion-dupe.patch similarity index 100% rename from patches/server/0565-Fix-harming-potion-dupe.patch rename to patches/server/0564-Fix-harming-potion-dupe.patch diff --git a/patches/server/0566-Implement-API-to-get-Material-from-Boats-and-Minecar.patch b/patches/server/0565-Implement-API-to-get-Material-from-Boats-and-Minecar.patch similarity index 100% rename from patches/server/0566-Implement-API-to-get-Material-from-Boats-and-Minecar.patch rename to patches/server/0565-Implement-API-to-get-Material-from-Boats-and-Minecar.patch diff --git a/patches/server/0567-Cache-burn-durations.patch b/patches/server/0566-Cache-burn-durations.patch similarity index 100% rename from patches/server/0567-Cache-burn-durations.patch rename to patches/server/0566-Cache-burn-durations.patch diff --git a/patches/server/0568-Allow-disabling-mob-spawner-spawn-egg-transformation.patch b/patches/server/0567-Allow-disabling-mob-spawner-spawn-egg-transformation.patch similarity index 100% rename from patches/server/0568-Allow-disabling-mob-spawner-spawn-egg-transformation.patch rename to patches/server/0567-Allow-disabling-mob-spawner-spawn-egg-transformation.patch diff --git a/patches/server/0569-Implement-PlayerFlowerPotManipulateEvent.patch b/patches/server/0568-Implement-PlayerFlowerPotManipulateEvent.patch similarity index 100% rename from patches/server/0569-Implement-PlayerFlowerPotManipulateEvent.patch rename to patches/server/0568-Implement-PlayerFlowerPotManipulateEvent.patch diff --git a/patches/server/0570-Fix-interact-event-not-being-called-in-adventure.patch b/patches/server/0569-Fix-interact-event-not-being-called-in-adventure.patch similarity index 100% rename from patches/server/0570-Fix-interact-event-not-being-called-in-adventure.patch rename to patches/server/0569-Fix-interact-event-not-being-called-in-adventure.patch diff --git a/patches/server/0571-Zombie-API-breaking-doors.patch b/patches/server/0570-Zombie-API-breaking-doors.patch similarity index 100% rename from patches/server/0571-Zombie-API-breaking-doors.patch rename to patches/server/0570-Zombie-API-breaking-doors.patch diff --git a/patches/server/0572-Fix-nerfed-slime-when-splitting.patch b/patches/server/0571-Fix-nerfed-slime-when-splitting.patch similarity index 100% rename from patches/server/0572-Fix-nerfed-slime-when-splitting.patch rename to patches/server/0571-Fix-nerfed-slime-when-splitting.patch diff --git a/patches/server/0573-Add-EntityLoadCrossbowEvent.patch b/patches/server/0572-Add-EntityLoadCrossbowEvent.patch similarity index 100% rename from patches/server/0573-Add-EntityLoadCrossbowEvent.patch rename to patches/server/0572-Add-EntityLoadCrossbowEvent.patch diff --git a/patches/server/0574-Guardian-beam-workaround.patch b/patches/server/0573-Guardian-beam-workaround.patch similarity index 90% rename from patches/server/0574-Guardian-beam-workaround.patch rename to patches/server/0573-Guardian-beam-workaround.patch index 536930025..fa66573d2 100644 --- a/patches/server/0574-Guardian-beam-workaround.patch +++ b/patches/server/0573-Guardian-beam-workaround.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Guardian beam workaround This patch is a workaround for MC-165595 diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java -index 9ec6145fe04ec64bbee8ec6a837719caebdbc6f5..c96b63355b38053b0f7ede313fb4bdf0e1089796 100644 +index 9ec6145fe04ec64bbee8ec6a837719caebdbc6f5..689ad22925b2561f7c8db961743eb1f821dbb25f 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetTimePacket.java @@ -8,7 +8,7 @@ public class ClientboundSetTimePacket implements Packet +Date: Wed, 2 Dec 2020 20:04:01 -0800 +Subject: [PATCH] Added ServerResourcesReloadedEvent + + +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 9bd2255d31bcfd4574f8d1caf598f9141aa9e3c1..51bbb11ff8d3da95fa6d9890be3135a34b3eafac 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -2017,7 +2017,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop reloadResources(Collection datapacks) { ++ return this.reloadResources(datapacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.PLUGIN); ++ } ++ public CompletableFuture reloadResources(Collection datapacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause cause) { ++ // Paper end + CompletableFuture completablefuture = CompletableFuture.supplyAsync(() -> { + Stream stream = datapacks.stream(); // CraftBukkit - decompile error + PackRepository resourcepackrepository = this.packRepository; +@@ -2033,6 +2039,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop dataPacks, CommandSourceStack source) { +- source.getServer().reloadResources(dataPacks).exceptionally((throwable) -> { ++ source.getServer().reloadResources(dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.COMMAND).exceptionally((throwable) -> { + ReloadCommand.LOGGER.warn("Failed to execute reload", throwable); + source.sendFailure(new TranslatableComponent("commands.reload.failure")); + return null; +@@ -50,7 +50,7 @@ public class ReloadCommand { + WorldData savedata = minecraftserver.getWorldData(); + Collection collection = resourcepackrepository.getSelectedIds(); + Collection collection1 = ReloadCommand.discoverNewPacks(resourcepackrepository, savedata, collection); +- minecraftserver.reloadResources(collection1); ++ minecraftserver.reloadResources(collection1, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.PLUGIN); // Paper + } + // CraftBukkit end + diff --git a/patches/server-remapped/0637-Added-world-settings-for-mobs-picking-up-loot.patch b/patches/server/0576-Added-world-settings-for-mobs-picking-up-loot.patch similarity index 82% rename from patches/server-remapped/0637-Added-world-settings-for-mobs-picking-up-loot.patch rename to patches/server/0576-Added-world-settings-for-mobs-picking-up-loot.patch index ead34bbc6..78f99e224 100644 --- a/patches/server-remapped/0637-Added-world-settings-for-mobs-picking-up-loot.patch +++ b/patches/server/0576-Added-world-settings-for-mobs-picking-up-loot.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Added world settings for mobs picking up loot diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index b48067c71f9de18ba40e970e2832f6245984a218..23a23e2ea133ce81d3dedc4ffd17435a995497ef 100644 +index bedadfc8835fa0c834494eb10cef13fa1cdc5cf5..b0b414a31192a2b0e5c69d00b982f883b66e77fd 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -363,6 +363,14 @@ public class PaperWorldConfig { +@@ -433,6 +433,14 @@ public class PaperWorldConfig { log("Creeper lingering effect: " + disableCreeperLingeringEffect); } @@ -24,10 +24,10 @@ index b48067c71f9de18ba40e970e2832f6245984a218..23a23e2ea133ce81d3dedc4ffd17435a private void expMergeMaxValue() { expMergeMaxValue = getInt("experience-merge-max-value", -1); 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 76027a7c9615495af64102744e264d7ba7c9b87e..68e52e3a31e70569d1a92602aff4b7b81c594757 100644 +index 3d8f3e22223e4effeaf52cb18c14c60276d4689c..6b4163f5601a0961055c8451ec7ef2204938cf69 100644 --- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java +++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java -@@ -149,7 +149,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo +@@ -148,7 +148,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo this.populateDefaultEquipmentSlots(difficulty); this.populateDefaultEquipmentEnchantments(difficulty); this.reassessWeaponGoal(); @@ -37,15 +37,15 @@ index 76027a7c9615495af64102744e264d7ba7c9b87e..68e52e3a31e70569d1a92602aff4b7b8 LocalDate localdate = LocalDate.now(); int i = localdate.get(ChronoField.DAY_OF_MONTH); diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index 77634a1e8e7539000f7db0b96f4548137af1a819..74fd175c4dc2d0d9832ee41efaf065b75a43f4b8 100644 +index 3125aad3b14a185bbd563827f07c15bbb1ef0895..03acacd30b84452733aa2bdeed515455a1f271f8 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -@@ -494,7 +494,7 @@ public class Zombie extends Monster { - Object object = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag); +@@ -497,7 +497,7 @@ public class Zombie extends Monster { + Object object = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityNbt); float f = difficulty.getSpecialMultiplier(); - this.setCanPickUpLoot(this.random.nextFloat() < 0.55F * f); + this.setCanPickUpLoot(this.level.paperConfig.zombiesAlwaysCanPickUpLoot || this.random.nextFloat() < 0.55F * f); // Paper if (object == null) { - object = new Zombie.ZombieGroupData(getSpawnAsBabyOdds(world.getRandom()), true); + object = new Zombie.ZombieGroupData(Zombie.getSpawnAsBabyOdds(world.getRandom()), true); } diff --git a/patches/server-remapped/0638-Implemented-BlockFailedDispenseEvent.patch b/patches/server/0577-Implemented-BlockFailedDispenseEvent.patch similarity index 55% rename from patches/server-remapped/0638-Implemented-BlockFailedDispenseEvent.patch rename to patches/server/0577-Implemented-BlockFailedDispenseEvent.patch index a7a4e4991..3199535c1 100644 --- a/patches/server-remapped/0638-Implemented-BlockFailedDispenseEvent.patch +++ b/patches/server/0577-Implemented-BlockFailedDispenseEvent.patch @@ -5,58 +5,45 @@ Subject: [PATCH] Implemented BlockFailedDispenseEvent diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java -index bfb2e21ccbcc67d6c9b4b329db1949d7d938bd2e..2a4cb76bdfcf55ba222b4976359c1b8efb165009 100644 +index 5812a6d601ab3552bd42dbf6e1071eff29dacc75..501a5483160dba050261bb3448317a097cdb7ef2 100644 --- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java -@@ -81,6 +81,7 @@ public class DispenserBlock extends BaseEntityBlock { +@@ -82,8 +82,10 @@ public class DispenserBlock extends BaseEntityBlock { int i = tileentitydispenser.getRandomSlot(); if (i < 0) { -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(worldserver, pos)) // Paper - BlockFailedDispenseEvent is called here - worldserver.levelEvent(1001, pos, 0); ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) {// Paper - BlockFailedDispenseEvent is called here + world.levelEvent(1001, pos, 0); + world.gameEvent(GameEvent.DISPENSE_FAIL, pos); ++ } // Paper } else { ItemStack itemstack = tileentitydispenser.getItem(i); + DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack); diff --git a/src/main/java/net/minecraft/world/level/block/DropperBlock.java b/src/main/java/net/minecraft/world/level/block/DropperBlock.java -index 154ec671e9d741e536464b794783da859e8447c1..492b19b94e2e2439f72ed9478d75641b0f50451a 100644 +index 51723c8f740c7b0bbd15acc0f1c848790c2ff299..5a95b550c767284563c124df1ff45322b37d4b4c 100644 --- a/src/main/java/net/minecraft/world/level/block/DropperBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DropperBlock.java @@ -45,6 +45,7 @@ public class DropperBlock extends DispenserBlock { int i = tileentitydispenser.getRandomSlot(); if (i < 0) { -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(worldserver, pos)) // Paper - BlockFailedDispenseEvent is called here - worldserver.levelEvent(1001, pos, 0); ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) // Paper - BlockFailedDispenseEvent is called here + world.levelEvent(1001, pos, 0); } else { ItemStack itemstack = tileentitydispenser.getItem(i); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 34c7b1213b3f83ff1a1f2d606a9c25e57fea8ef3..8829ef03d0be16d8317aaf05bcd286b74f20656a 100644 +index 0f120d72816667ef8d50502b1e7e7dc3848f0ab4..263aaf312efcc8c8bda57448710ef6eb36a3a5bd 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -4,6 +4,7 @@ import com.google.common.base.Function; - import com.google.common.base.Functions; - import com.google.common.collect.Lists; - import com.mojang.datafixers.util.Either; -+import io.papermc.paper.event.block.BlockFailedDispenseEvent; - import java.net.InetAddress; - import java.util.ArrayList; - import java.util.Collections; -@@ -111,7 +112,6 @@ import org.bukkit.entity.ThrownPotion; - import org.bukkit.entity.Vehicle; - import org.bukkit.entity.Villager; - import org.bukkit.entity.Villager.Profession; --import org.bukkit.entity.ExperienceOrb; // Paper - import org.bukkit.event.Cancellable; - import org.bukkit.event.Event; - import org.bukkit.event.Event.Result; -@@ -1784,4 +1784,12 @@ public class CraftEventFactory { +@@ -1791,4 +1791,12 @@ public class CraftEventFactory { Bukkit.getPluginManager().callEvent(event); return event; } + + // Paper start -+ public static boolean handleBlockFailedDispenseEvent(ServerLevel worldserver, BlockPos blockposition) { -+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); -+ BlockFailedDispenseEvent event = new BlockFailedDispenseEvent(block); ++ public static boolean handleBlockFailedDispenseEvent(ServerLevel serverLevel, BlockPos blockposition) { ++ org.bukkit.block.Block block = serverLevel.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); ++ io.papermc.paper.event.block.BlockFailedDispenseEvent event = new io.papermc.paper.event.block.BlockFailedDispenseEvent(block); + return event.callEvent(); + } + // Paper end diff --git a/patches/server/0578-Added-PlayerLecternPageChangeEvent.patch b/patches/server/0578-Added-PlayerLecternPageChangeEvent.patch new file mode 100644 index 000000000..cd550d08a --- /dev/null +++ b/patches/server/0578-Added-PlayerLecternPageChangeEvent.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Mon, 23 Nov 2020 12:58:51 -0800 +Subject: [PATCH] Added PlayerLecternPageChangeEvent + + +diff --git a/src/main/java/net/minecraft/world/inventory/LecternMenu.java b/src/main/java/net/minecraft/world/inventory/LecternMenu.java +index 0149b958a3bdeb529a8b7e64f4ca458d0be88998..ff79925bc6437222f9ceb133e21bbc0600cc74ed 100644 +--- a/src/main/java/net/minecraft/world/inventory/LecternMenu.java ++++ b/src/main/java/net/minecraft/world/inventory/LecternMenu.java +@@ -64,6 +64,7 @@ public class LecternMenu extends AbstractContainerMenu { + @Override + public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) { + int j; ++ io.papermc.paper.event.player.PlayerLecternPageChangeEvent playerLecternPageChangeEvent; CraftInventoryLectern bukkitView; // Paper + + if (id >= 100) { + j = id - 100; +@@ -73,11 +74,25 @@ public class LecternMenu extends AbstractContainerMenu { + switch (id) { + case 1: + j = this.lecternData.get(0); +- this.setData(0, j - 1); ++ // Paper start ++ bukkitView = (CraftInventoryLectern) getBukkitView().getTopInventory(); ++ playerLecternPageChangeEvent = new io.papermc.paper.event.player.PlayerLecternPageChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), bukkitView.getHolder(), bukkitView.getBook(), io.papermc.paper.event.player.PlayerLecternPageChangeEvent.PageChangeDirection.LEFT, j, j - 1); ++ if (!playerLecternPageChangeEvent.callEvent()) { ++ return false; ++ } ++ this.setData(0, playerLecternPageChangeEvent.getNewPage()); ++ // Paper end + return true; + case 2: + j = this.lecternData.get(0); +- this.setData(0, j + 1); ++ // Paper start ++ bukkitView = (CraftInventoryLectern) getBukkitView().getTopInventory(); ++ playerLecternPageChangeEvent = new io.papermc.paper.event.player.PlayerLecternPageChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), bukkitView.getHolder(), bukkitView.getBook(), io.papermc.paper.event.player.PlayerLecternPageChangeEvent.PageChangeDirection.RIGHT, j, j + 1); ++ if (!playerLecternPageChangeEvent.callEvent()) { ++ return false; ++ } ++ this.setData(0, playerLecternPageChangeEvent.getNewPage()); ++ // Paper end + return true; + case 3: + if (!player.mayBuild()) { diff --git a/patches/server/0579-Added-PlayerLoomPatternSelectEvent.patch b/patches/server/0579-Added-PlayerLoomPatternSelectEvent.patch new file mode 100644 index 000000000..984799513 --- /dev/null +++ b/patches/server/0579-Added-PlayerLoomPatternSelectEvent.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Wed, 25 Nov 2020 16:33:27 -0800 +Subject: [PATCH] Added PlayerLoomPatternSelectEvent + + +diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java +index 7e8b6e0e69876cb7bfd444a8dd72edf8289e6dd1..51579f642859fc99c715dfcd286482995012d84a 100644 +--- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java ++++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java +@@ -166,7 +166,22 @@ public class LoomMenu extends AbstractContainerMenu { + @Override + public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) { + if (id > 0 && id <= BannerPattern.AVAILABLE_PATTERNS) { +- this.selectedBannerPatternIndex.set(id); ++ // Paper start ++ int enumBannerPatternTypeOrdinal = id; ++ io.papermc.paper.event.player.PlayerLoomPatternSelectEvent event = new io.papermc.paper.event.player.PlayerLoomPatternSelectEvent((Player) player.getBukkitEntity(), ((CraftInventoryLoom) getBukkitView().getTopInventory()), org.bukkit.block.banner.PatternType.getByIdentifier(BannerPattern.values()[id].getHashname())); ++ if (!event.callEvent()) { ++ ((Player) player.getBukkitEntity()).updateInventory(); ++ return false; ++ } ++ for (BannerPattern nms : BannerPattern.values()) { ++ if (event.getPatternType().getIdentifier().equals(nms.getHashname())) { ++ enumBannerPatternTypeOrdinal = nms.ordinal(); ++ break; ++ } ++ } ++ ((Player) player.getBukkitEntity()).updateInventory(); ++ this.selectedBannerPatternIndex.set(enumBannerPatternTypeOrdinal); ++ // Paper end + this.setupResultSlot(); + return true; + } else { diff --git a/patches/server-remapped/0642-Configurable-door-breaking-difficulty.patch b/patches/server/0580-Configurable-door-breaking-difficulty.patch similarity index 63% rename from patches/server-remapped/0642-Configurable-door-breaking-difficulty.patch rename to patches/server/0580-Configurable-door-breaking-difficulty.patch index c1c84edf4..8b84a411c 100644 --- a/patches/server-remapped/0642-Configurable-door-breaking-difficulty.patch +++ b/patches/server/0580-Configurable-door-breaking-difficulty.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable door breaking difficulty diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 23a23e2ea133ce81d3dedc4ffd17435a995497ef..7ebc85264a2cbfb601dfe5472b561cac1a7cf8bf 100644 +index b0b414a31192a2b0e5c69d00b982f883b66e77fd..dd5c092a035a30c477fe828b58bc918fc48daa03 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -5,7 +5,10 @@ import java.util.EnumMap; +@@ -4,7 +4,10 @@ import java.util.EnumMap; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -17,10 +17,36 @@ index 23a23e2ea133ce81d3dedc4ffd17435a995497ef..7ebc85264a2cbfb601dfe5472b561cac +import net.minecraft.world.Difficulty; +import net.minecraft.world.entity.monster.Vindicator; +import net.minecraft.world.entity.monster.Zombie; - import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray.EngineMode; import org.bukkit.Bukkit; import org.bukkit.Material; -@@ -73,6 +76,11 @@ public class PaperWorldConfig { + import org.bukkit.configuration.ConfigurationSection; +@@ -92,6 +95,25 @@ public class PaperWorldConfig { + disableMobSpawnerSpawnEggTransformation = getBoolean("game-mechanics.disable-mob-spawner-spawn-egg-transformation", disableMobSpawnerSpawnEggTransformation); + } + ++ public List zombieBreakDoors; ++ public List vindicatorBreakDoors; ++ private void setupEntityBreakingDoors() { ++ zombieBreakDoors = getEnumList( ++ "door-breaking-difficulty.zombie", ++ java.util.Arrays.stream(Difficulty.values()) ++ .filter(Zombie.DOOR_BREAKING_PREDICATE) ++ .collect(Collectors.toList()), ++ Difficulty.class ++ ); ++ vindicatorBreakDoors = getEnumList( ++ "door-breaking-difficulty.vindicator", ++ java.util.Arrays.stream(Difficulty.values()) ++ .filter(Vindicator.DOOR_BREAKING_PREDICATE) ++ .collect(Collectors.toList()), ++ Difficulty.class ++ ); ++ } ++ + public short keepLoadedRange; + private void keepLoadedRange() { + keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); +@@ -143,6 +165,11 @@ public class PaperWorldConfig { return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path)); } @@ -32,45 +58,22 @@ index 23a23e2ea133ce81d3dedc4ffd17435a995497ef..7ebc85264a2cbfb601dfe5472b561cac public int cactusMaxHeight; public int reedMaxHeight; public int bambooMaxHeight; -@@ -735,4 +743,23 @@ public class PaperWorldConfig { - private void disableMobSpawnerSpawnEggTransformation() { - disableMobSpawnerSpawnEggTransformation = getBoolean("game-mechanics.disable-mob-spawner-spawn-egg-transformation", disableMobSpawnerSpawnEggTransformation); - } -+ -+ public List zombieBreakDoors; -+ public List vindicatorBreakDoors; -+ private void setupEntityBreakingDoors() { -+ zombieBreakDoors = getEnumList( -+ "door-breaking-difficulty.zombie", -+ Arrays.stream(Difficulty.values()) -+ .filter(Zombie.getDoorBreakingPredicate()) -+ .collect(Collectors.toList()), -+ Difficulty.class -+ ); -+ vindicatorBreakDoors = getEnumList( -+ "door-breaking-difficulty.vindicator", -+ Arrays.stream(Difficulty.values()) -+ .filter(Vindicator.getDoorBreakingPredicate()) -+ .collect(Collectors.toList()), -+ Difficulty.class -+ ); -+ } - } diff --git a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java -index 623de661f3b56062792e3a7dbc508637aa58aca5..48700094da6e97610ccc652593a9e229ba7b1003 100644 +index dcaec42b0756cf36da813815b4a54e4d6c4e293a..53a9e4b0fda9f5a3b23a874c53d93fbe931b0cfb 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java +++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java -@@ -48,6 +48,7 @@ import net.minecraft.world.level.ServerLevelAccessor; +@@ -48,7 +48,7 @@ import net.minecraft.world.level.ServerLevelAccessor; public class Vindicator extends AbstractIllager { - -+ public static final Predicate getDoorBreakingPredicate() { return DOOR_BREAKING_PREDICATE; } // Paper - OBFHELPER - private static final Predicate DOOR_BREAKING_PREDICATE = (enumdifficulty) -> { - return enumdifficulty == Difficulty.NORMAL || enumdifficulty == Difficulty.HARD; + private static final String TAG_JOHNNY = "Johnny"; +- static final Predicate DOOR_BREAKING_PREDICATE = (difficulty) -> { ++ public static final Predicate DOOR_BREAKING_PREDICATE = (difficulty) -> { // Paper - package private -> public + return difficulty == Difficulty.NORMAL || difficulty == Difficulty.HARD; }; -@@ -204,7 +205,7 @@ public class Vindicator extends AbstractIllager { - static class VindicatorBreakDoorGoal extends BreakDoorGoal { + private boolean isJohnny; public boolean isJohnny() { return this.isJohnny; } public void setJohnny(boolean johnny) { this.isJohnny = johnny; } // Paper - OBFHELPER +@@ -195,7 +195,7 @@ public class Vindicator extends AbstractIllager { + static class VindicatorBreakDoorGoal extends BreakDoorGoal { public VindicatorBreakDoorGoal(Mob mob) { - super(mob, 6, Vindicator.DOOR_BREAKING_PREDICATE); + super(mob, 6, com.google.common.base.Predicates.in(mob.level.paperConfig.vindicatorBreakDoors)); // Paper @@ -78,18 +81,19 @@ index 623de661f3b56062792e3a7dbc508637aa58aca5..48700094da6e97610ccc652593a9e229 } diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index 74fd175c4dc2d0d9832ee41efaf065b75a43f4b8..caa99a2737598bd74ede54f1c35ce4b99ce1e6d3 100644 +index 03acacd30b84452733aa2bdeed515455a1f271f8..9e535cf3293cf624b1e2e1b7fb40a446b888b099 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -@@ -83,6 +83,7 @@ public class Zombie extends Monster { - private static final EntityDataAccessor DATA_BABY_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.BOOLEAN); - private static final EntityDataAccessor DATA_SPECIAL_TYPE_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.INT); - public static final EntityDataAccessor DATA_DROWNED_CONVERSION_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.BOOLEAN); -+ public static final Predicate getDoorBreakingPredicate() { return DOOR_BREAKING_PREDICATE; } // Paper - OBFHELPER - private static final Predicate DOOR_BREAKING_PREDICATE = (enumdifficulty) -> { +@@ -88,7 +88,7 @@ public class Zombie extends Monster { + public static final int REINFORCEMENT_RANGE_MAX = 40; + public static final int REINFORCEMENT_RANGE_MIN = 7; + private static final float BREAK_DOOR_CHANCE = 0.1F; +- private static final Predicate DOOR_BREAKING_PREDICATE = (enumdifficulty) -> { ++ public static final Predicate DOOR_BREAKING_PREDICATE = (enumdifficulty) -> { // Paper - private -> public return enumdifficulty == Difficulty.HARD; }; -@@ -95,7 +96,7 @@ public class Zombie extends Monster { + private final BreakDoorGoal breakDoorGoal; +@@ -100,7 +100,7 @@ public class Zombie extends Monster { public Zombie(EntityType type, Level world) { super(type, world); diff --git a/patches/server-remapped/0643-Empty-commands-shall-not-be-dispatched.patch b/patches/server/0581-Empty-commands-shall-not-be-dispatched.patch similarity index 84% rename from patches/server-remapped/0643-Empty-commands-shall-not-be-dispatched.patch rename to patches/server/0581-Empty-commands-shall-not-be-dispatched.patch index a9abc78c3..23f3b5516 100644 --- a/patches/server-remapped/0643-Empty-commands-shall-not-be-dispatched.patch +++ b/patches/server/0581-Empty-commands-shall-not-be-dispatched.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Empty commands shall not be dispatched diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index c63033e3eb50423a7c32acfc0e705623cc4bec68..5ed78383ce247ceb24cda0335dbeae293958055c 100644 +index 7156dea53be828acd01734fa1f9f7b9accf30ff6..dc5d21693237ebb0b2a1ee45e92d0f191c547637 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -223,6 +223,7 @@ public class Commands { +@@ -230,6 +230,7 @@ public class Commands { command = event.getCommand(); String[] args = command.split(" "); diff --git a/patches/server-remapped/0644-Implement-API-to-expose-exact-interaction-point.patch b/patches/server/0582-Implement-API-to-expose-exact-interaction-point.patch similarity index 82% rename from patches/server-remapped/0644-Implement-API-to-expose-exact-interaction-point.patch rename to patches/server/0582-Implement-API-to-expose-exact-interaction-point.patch index 4f115620e..fcb5a17e2 100644 --- a/patches/server-remapped/0644-Implement-API-to-expose-exact-interaction-point.patch +++ b/patches/server/0582-Implement-API-to-expose-exact-interaction-point.patch @@ -5,23 +5,23 @@ Subject: [PATCH] Implement API to expose exact interaction point diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index 6269e37f2859417a80e6de16045f1c2325f9746f..37761176861027d0ee06f50d60584687fdac669b 100644 +index de4fdd46f23b2b17da752a8afc0faecc1ad8344f..2a0f313365a25c1780027f1536dbb88ccdab61e2 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -495,7 +495,7 @@ public class ServerPlayerGameMode { +@@ -498,7 +498,7 @@ public class ServerPlayerGameMode { cancelledBlock = true; } - PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, blockposition, hitResult.getDirection(), stack, cancelledBlock, hand); + PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, blockposition, hitResult.getDirection(), stack, cancelledBlock, hand, hitResult.getLocation()); // Paper - firedInteract = true; - interactResult = event.useItemInHand() == Event.Result.DENY; - interactPosition = blockposition.immutable(); + this.firedInteract = true; + this.interactResult = event.useItemInHand() == Event.Result.DENY; + this.interactPosition = blockposition.immutable(); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 8829ef03d0be16d8317aaf05bcd286b74f20656a..586d21eed8189adf696ca6d3642afebbe752d1b5 100644 +index 263aaf312efcc8c8bda57448710ef6eb36a3a5bd..f6f2856c407abe195f1dfee7f4a7e30baea585f7 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -58,7 +58,9 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams; +@@ -55,7 +55,9 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.HitResult; @@ -31,8 +31,8 @@ index 8829ef03d0be16d8317aaf05bcd286b74f20656a..586d21eed8189adf696ca6d3642afebb import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.Server; -@@ -475,7 +477,13 @@ public class CraftEventFactory { - return callPlayerInteractEvent(who, action, position, direction, itemstack, false, hand); +@@ -477,7 +479,13 @@ public class CraftEventFactory { + return CraftEventFactory.callPlayerInteractEvent(who, action, position, direction, itemstack, false, hand); } + // Paper start - Add interactionPoint @@ -45,7 +45,7 @@ index 8829ef03d0be16d8317aaf05bcd286b74f20656a..586d21eed8189adf696ca6d3642afebb Player player = (who == null) ? null : (Player) who.getBukkitEntity(); CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack); -@@ -501,7 +509,10 @@ public class CraftEventFactory { +@@ -503,7 +511,10 @@ public class CraftEventFactory { itemInHand = null; } diff --git a/patches/server/0583-Remove-stale-POIs.patch b/patches/server/0583-Remove-stale-POIs.patch new file mode 100644 index 000000000..068353298 --- /dev/null +++ b/patches/server/0583-Remove-stale-POIs.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shane Freeder +Date: Sat, 9 Jan 2021 14:17:07 +0100 +Subject: [PATCH] Remove stale POIs + + +diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java +index f1c02ae301da2a3b582d2ec1215c1a981e26ac47..0e14946284738b751790b2763bfe197c0148a54a 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -1768,6 +1768,11 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl + }); + optional1.ifPresent((villageplacetype) -> { + this.getServer().execute(() -> { ++ // Paper start ++ if (!optional.isPresent() && this.getPoiManager().exists(blockposition1, com.google.common.base.Predicates.alwaysTrue())) { ++ this.getPoiManager().remove(blockposition1); ++ } ++ // Paper end + this.getPoiManager().add(blockposition1, villageplacetype); + DebugPackets.sendPoiAddedPacket(this, blockposition1); + });