diff --git a/patches/api-unmapped/Add-API-to-get-exact-interaction-point-in-PlayerInte.patch b/patches/api/Add-API-to-get-exact-interaction-point-in-PlayerInte.patch similarity index 100% rename from patches/api-unmapped/Add-API-to-get-exact-interaction-point-in-PlayerInte.patch rename to patches/api/Add-API-to-get-exact-interaction-point-in-PlayerInte.patch diff --git a/patches/api-unmapped/Add-BlockFailedDispenseEvent.patch b/patches/api/Add-BlockFailedDispenseEvent.patch similarity index 100% rename from patches/api-unmapped/Add-BlockFailedDispenseEvent.patch rename to patches/api/Add-BlockFailedDispenseEvent.patch diff --git a/patches/api-unmapped/Added-PlayerLecternPageChangeEvent.patch b/patches/api/Added-PlayerLecternPageChangeEvent.patch similarity index 100% rename from patches/api-unmapped/Added-PlayerLecternPageChangeEvent.patch rename to patches/api/Added-PlayerLecternPageChangeEvent.patch diff --git a/patches/api-unmapped/Added-PlayerLoomPatternSelectEvent.patch b/patches/api/Added-PlayerLoomPatternSelectEvent.patch similarity index 100% rename from patches/api-unmapped/Added-PlayerLoomPatternSelectEvent.patch rename to patches/api/Added-PlayerLoomPatternSelectEvent.patch diff --git a/patches/api-unmapped/Added-ServerResourcesReloadedEvent.patch b/patches/api/Added-ServerResourcesReloadedEvent.patch similarity index 100% rename from patches/api-unmapped/Added-ServerResourcesReloadedEvent.patch rename to patches/api/Added-ServerResourcesReloadedEvent.patch diff --git a/patches/api-unmapped/Better-AnnotationTest-printout.patch b/patches/api/Better-AnnotationTest-printout.patch similarity index 100% rename from patches/api-unmapped/Better-AnnotationTest-printout.patch rename to patches/api/Better-AnnotationTest-printout.patch diff --git a/patches/server-remapped/Added-PlayerLoomPatternSelectEvent.patch b/patches/server-remapped/Added-PlayerLoomPatternSelectEvent.patch deleted file mode 100644 index 4637d1fd77..0000000000 --- a/patches/server-remapped/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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java -+++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java -@@ -0,0 +0,0 @@ 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 { - -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 -@@ -0,0 +0,0 @@ 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/Added-ServerResourcesReloadedEvent.patch b/patches/server-remapped/Added-ServerResourcesReloadedEvent.patch deleted file mode 100644 index 479eb23699..0000000000 --- a/patches/server-remapped/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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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 { - -@@ -0,0 +0,0 @@ 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(); -@@ -0,0 +0,0 @@ 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; - }); - } -@@ -0,0 +0,0 @@ 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/Remove-stale-POIs.patch b/patches/server-remapped/Remove-stale-POIs.patch deleted file mode 100644 index 3aafb494d4..0000000000 --- a/patches/server-remapped/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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/level/ServerLevel.java -+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -0,0 +0,0 @@ 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); - }); -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 -@@ -0,0 +0,0 @@ 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); - } -@@ -0,0 +0,0 @@ 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/Add-warning-for-servers-not-running-on-Java-16.patch b/patches/server/Add-warning-for-servers-not-running-on-Java-16.patch deleted file mode 100644 index a6a7e93a66..0000000000 --- a/patches/server/Add-warning-for-servers-not-running-on-Java-16.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Kyle Wood -Date: Wed, 2 Dec 2020 21:58:45 -0800 -Subject: [PATCH] Add warning for servers not running on 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 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/util/PaperJvmChecker.java -@@ -0,0 +0,0 @@ -+package io.papermc.paper.util; -+ -+import org.apache.logging.log4j.LogManager; -+import org.apache.logging.log4j.Logger; -+ -+import java.util.regex.Matcher; -+import java.util.regex.Pattern; -+ -+public class PaperJvmChecker { -+ -+ private static int getJvmVersion() { -+ String javaVersion = System.getProperty("java.version"); -+ final Matcher matcher = Pattern.compile("(?:1\\.)?(\\d+)").matcher(javaVersion); -+ if (!matcher.find()) { -+ LogManager.getLogger().warn("Failed to determine Java version; Could not parse: {}", javaVersion); -+ return -1; -+ } -+ -+ final String version = matcher.group(1); -+ try { -+ return Integer.parseInt(version); -+ } catch (final NumberFormatException e) { -+ LogManager.getLogger().warn("Failed to determine Java version; Could not parse {} from {}", version, javaVersion, e); -+ return -1; -+ } -+ } -+ -+ public static void checkJvm() { -+ if (getJvmVersion() < 16) { -+ final Logger logger = LogManager.getLogger(); -+ logger.warn("************************************************************"); -+ logger.warn("* WARNING - YOU ARE RUNNING AN OUTDATED VERSION OF JAVA."); -+ logger.warn("* PAPER WILL STOP BEING COMPATIBLE WITH THIS VERSION OF"); -+ logger.warn("* JAVA WHEN MINECRAFT 1.17 IS RELEASED."); -+ logger.warn("*"); -+ logger.warn("* Please update the version of Java you use to run Paper"); -+ logger.warn("* to at least Java 16. When Paper for Minecraft 1.17 is"); -+ logger.warn("* released support for versions of Java before 16 will"); -+ logger.warn("* be dropped."); -+ logger.warn("*"); -+ logger.warn("* Current Java version: {}", System.getProperty("java.version")); -+ logger.warn("*"); -+ logger.warn("* Check this forum post for more information: "); -+ logger.warn("* https://papermc.io/java16"); -+ logger.warn("************************************************************"); -+ } -+ } -+} -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop= 100) { j = id - 100; @@ -43,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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); ++ 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; + } @@ -55,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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); ++ 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; + } diff --git a/patches/server/Added-PlayerLoomPatternSelectEvent.patch b/patches/server/Added-PlayerLoomPatternSelectEvent.patch new file mode 100644 index 0000000000..799661d6d9 --- /dev/null +++ b/patches/server/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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java ++++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java +@@ -0,0 +0,0 @@ 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/Added-ServerResourcesReloadedEvent.patch b/patches/server/Added-ServerResourcesReloadedEvent.patch new file mode 100644 index 0000000000..e35ab8dee3 --- /dev/null +++ b/patches/server/Added-ServerResourcesReloadedEvent.patch @@ -0,0 +1,54 @@ +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -0,0 +0,0 @@ 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; +@@ -0,0 +0,0 @@ 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; +@@ -0,0 +0,0 @@ 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/Added-world-settings-for-mobs-picking-up-loot.patch b/patches/server/Added-world-settings-for-mobs-picking-up-loot.patch similarity index 95% rename from patches/server-remapped/Added-world-settings-for-mobs-picking-up-loot.patch rename to patches/server/Added-world-settings-for-mobs-picking-up-loot.patch index 392708e9d9..210a3583c7 100644 --- a/patches/server-remapped/Added-world-settings-for-mobs-picking-up-loot.patch +++ b/patches/server/Added-world-settings-for-mobs-picking-up-loot.patch @@ -41,11 +41,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java @@ -0,0 +0,0 @@ public class Zombie extends Monster { - Object object = super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityTag); + 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/Configurable-door-breaking-difficulty.patch b/patches/server/Configurable-door-breaking-difficulty.patch similarity index 75% rename from patches/server-remapped/Configurable-door-breaking-difficulty.patch rename to patches/server/Configurable-door-breaking-difficulty.patch index 4aade05b65..b080c3cf0a 100644 --- a/patches/server-remapped/Configurable-door-breaking-difficulty.patch +++ b/patches/server/Configurable-door-breaking-difficulty.patch @@ -17,9 +17,35 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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; + import org.bukkit.configuration.ConfigurationSection; +@@ -0,0 +0,0 @@ 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); @@ -0,0 +0,0 @@ public class PaperWorldConfig { return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path)); } @@ -32,30 +58,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public int cactusMaxHeight; public int reedMaxHeight; public int bambooMaxHeight; -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java @@ -63,14 +65,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ 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; }; + private boolean isJohnny; public boolean isJohnny() { return this.isJohnny; } public void setJohnny(boolean johnny) { this.isJohnny = johnny; } // Paper - OBFHELPER @@ -0,0 +0,0 @@ public class Vindicator extends AbstractIllager { - static class VindicatorBreakDoorGoal extends BreakDoorGoal { + 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 @@ -82,13 +85,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java @@ -0,0 +0,0 @@ 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) -> { + 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; }; + private final BreakDoorGoal breakDoorGoal; @@ -0,0 +0,0 @@ public class Zombie extends Monster { public Zombie(EntityType type, Level world) { diff --git a/patches/server-remapped/Empty-commands-shall-not-be-dispatched.patch b/patches/server/Empty-commands-shall-not-be-dispatched.patch similarity index 100% rename from patches/server-remapped/Empty-commands-shall-not-be-dispatched.patch rename to patches/server/Empty-commands-shall-not-be-dispatched.patch diff --git a/patches/server/Guardian-beam-workaround.patch b/patches/server/Guardian-beam-workaround.patch index 7eb7fedfc4..0ef9e00956 100644 --- a/patches/server/Guardian-beam-workaround.patch +++ b/patches/server/Guardian-beam-workaround.patch @@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public ClientboundSetTimePacket(long time, long timeOfDay, boolean doDaylightCycle) { - this.gameTime = time; -+ this.gameTime = time % 192000; // Paper - fix guardian bean ++ this.gameTime = time % 192000; // Paper - fix guardian beam long l = timeOfDay; if (!doDaylightCycle) { l = -timeOfDay; diff --git a/patches/server-remapped/Implement-API-to-expose-exact-interaction-point.patch b/patches/server/Implement-API-to-expose-exact-interaction-point.patch similarity index 92% rename from patches/server-remapped/Implement-API-to-expose-exact-interaction-point.patch rename to patches/server/Implement-API-to-expose-exact-interaction-point.patch index 05aa9cc625..5571d60ecc 100644 --- a/patches/server-remapped/Implement-API-to-expose-exact-interaction-point.patch +++ b/patches/server/Implement-API-to-expose-exact-interaction-point.patch @@ -14,9 +14,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import org.bukkit.NamespacedKey; import org.bukkit.Server; @@ -0,0 +0,0 @@ public class CraftEventFactory { - return callPlayerInteractEvent(who, action, position, direction, itemstack, false, hand); + return CraftEventFactory.callPlayerInteractEvent(who, action, position, direction, itemstack, false, hand); } + // Paper start - Add interactionPoint diff --git a/patches/server-remapped/Implemented-BlockFailedDispenseEvent.patch b/patches/server/Implemented-BlockFailedDispenseEvent.patch similarity index 66% rename from patches/server-remapped/Implemented-BlockFailedDispenseEvent.patch rename to patches/server/Implemented-BlockFailedDispenseEvent.patch index 44cdb68414..1492d8bc60 100644 --- a/patches/server-remapped/Implemented-BlockFailedDispenseEvent.patch +++ b/patches/server/Implemented-BlockFailedDispenseEvent.patch @@ -12,10 +12,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/DropperBlock.java @@ -24,39 +27,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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; @@ -0,0 +0,0 @@ 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/Remove-stale-POIs.patch b/patches/server/Remove-stale-POIs.patch new file mode 100644 index 0000000000..8d02b9a5f7 --- /dev/null +++ b/patches/server/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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/ServerLevel.java ++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +@@ -0,0 +0,0 @@ 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); + });