diff --git a/patches/unapplied/server/Add-BellRingEvent.patch b/patches/server/Add-BellRingEvent.patch similarity index 100% rename from patches/unapplied/server/Add-BellRingEvent.patch rename to patches/server/Add-BellRingEvent.patch diff --git a/patches/unapplied/server/Add-BlockStateMeta-clearBlockState.patch b/patches/server/Add-BlockStateMeta-clearBlockState.patch similarity index 100% rename from patches/unapplied/server/Add-BlockStateMeta-clearBlockState.patch rename to patches/server/Add-BlockStateMeta-clearBlockState.patch diff --git a/patches/server/Add-PlayerRecipeBookClickEvent.patch b/patches/server/Add-PlayerRecipeBookClickEvent.patch new file mode 100644 index 0000000000..f3938773d2 --- /dev/null +++ b/patches/server/Add-PlayerRecipeBookClickEvent.patch @@ -0,0 +1,65 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Josh Roy <10731363+JRoy@users.noreply.github.com> +Date: Fri, 5 Jun 2020 18:24:06 -0400 +Subject: [PATCH] Add PlayerRecipeBookClickEvent + + +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -0,0 +0,0 @@ import net.minecraft.world.phys.Vec3; + import net.minecraft.world.phys.shapes.BooleanOp; + import net.minecraft.world.phys.shapes.Shapes; + import net.minecraft.world.phys.shapes.VoxelShape; ++import org.bukkit.NamespacedKey; + import org.slf4j.Logger; + + // CraftBukkit start +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + ServerGamePacketListenerImpl.LOGGER.debug("Player {} tried to place impossible recipe {}", this.player, recipeholder.id().location()); + return; + } ++ // Paper start - Add PlayerRecipeBookClickEvent ++ NamespacedKey recipeName = org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(recipeholder.id().location()); ++ boolean makeAll = packet.useMaxItems(); ++ com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent paperEvent = new com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent( ++ this.player.getBukkitEntity(), recipeName, makeAll ++ ); ++ if (!paperEvent.callEvent()) { ++ return; ++ } ++ recipeName = paperEvent.getRecipe(); ++ makeAll = paperEvent.isMakeAll(); ++ if (org.bukkit.event.player.PlayerRecipeBookClickEvent.getHandlerList().getRegisteredListeners().length > 0) { ++ // Paper end - Add PlayerRecipeBookClickEvent + + // CraftBukkit start - implement PlayerRecipeBookClickEvent +- org.bukkit.inventory.Recipe recipe = recipeholder.toBukkitRecipe(); ++ org.bukkit.inventory.Recipe recipe = this.cserver.getRecipe(recipeName); // Paper - Add PlayerRecipeBookClickEvent - forward to legacy event + if (recipe == null) { + return; + } +- org.bukkit.event.player.PlayerRecipeBookClickEvent event = CraftEventFactory.callRecipeBookClickEvent(this.player, recipe, packet.useMaxItems()); ++ // Paper start - Add PlayerRecipeBookClickEvent - forward to legacy event ++ org.bukkit.event.player.PlayerRecipeBookClickEvent event = CraftEventFactory.callRecipeBookClickEvent(this.player, recipe, makeAll); ++ recipeName = ((org.bukkit.Keyed) event.getRecipe()).getKey(); ++ makeAll = event.isShiftClick(); ++ } ++ if (!(this.player.containerMenu instanceof RecipeBookMenu)) { ++ return; ++ } ++ // Paper end - Add PlayerRecipeBookClickEvent - forward to legacy event + + // Cast to keyed should be safe as the recipe will never be a MerchantRecipe. +- recipeholder = this.server.getRecipeManager().byKey(CraftRecipe.toMinecraft(((org.bukkit.Keyed) event.getRecipe()).getKey())).orElse(null); ++ recipeholder = this.server.getRecipeManager().byKey(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.RECIPE, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(recipeName))).orElse(null); // Paper - Add PlayerRecipeBookClickEvent - forward to legacy event + if (recipeholder == null) { + return; + } +- +- RecipeBookMenu.PostPlaceAction containerrecipebook_a = containerrecipebook.handlePlacement(event.isShiftClick(), this.player.isCreative(), recipeholder, this.player.serverLevel(), this.player.getInventory()); ++ RecipeBookMenu.PostPlaceAction containerrecipebook_a = containerrecipebook.handlePlacement(makeAll, this.player.isCreative(), recipeholder, this.player.serverLevel(), this.player.getInventory()); + // CraftBukkit end + + if (containerrecipebook_a == RecipeBookMenu.PostPlaceAction.PLACE_GHOST_RECIPE) { diff --git a/patches/unapplied/server/Add-Plugin-Tickets-to-API-Chunk-Methods.patch b/patches/server/Add-Plugin-Tickets-to-API-Chunk-Methods.patch similarity index 100% rename from patches/unapplied/server/Add-Plugin-Tickets-to-API-Chunk-Methods.patch rename to patches/server/Add-Plugin-Tickets-to-API-Chunk-Methods.patch diff --git a/patches/unapplied/server/Add-PrepareResultEvent.patch b/patches/server/Add-PrepareResultEvent.patch similarity index 96% rename from patches/unapplied/server/Add-PrepareResultEvent.patch rename to patches/server/Add-PrepareResultEvent.patch index cef6905f49..1c68591224 100644 --- a/patches/unapplied/server/Add-PrepareResultEvent.patch +++ b/patches/server/Add-PrepareResultEvent.patch @@ -74,7 +74,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/inventory/SmithingMenu.java +++ b/src/main/java/net/minecraft/world/inventory/SmithingMenu.java @@ -0,0 +0,0 @@ public class SmithingMenu extends ItemCombinerMenu { - } + this.hasRecipeError.set(flag ? 1 : 0); } + org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper - Add PrepareResultEvent @@ -86,18 +86,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java +++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java @@ -0,0 +0,0 @@ public class StonecutterMenu extends AbstractContainerMenu { - this.setupRecipeList(inventory, itemstack); + this.setupRecipeList(itemstack); } + org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper - Add PrepareResultEvent } - private static SingleRecipeInput createRecipeInput(Container inventory) { + private void setupRecipeList(ItemStack stack) { 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 @@ public class CraftEventFactory { +@@ -0,0 +0,0 @@ populateFields(victim, event); // Paper - make cancellable } public static PrepareAnvilEvent callPrepareAnvilEvent(AnvilView view, ItemStack item) { @@ -110,7 +110,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 PrepareAnvilEvent event = new PrepareAnvilEvent(view, CraftItemStack.asCraftMirror(item).clone()); event.getView().getPlayer().getServer().getPluginManager().callEvent(event); event.getInventory().setItem(2, event.getResult()); -@@ -0,0 +0,0 @@ public class CraftEventFactory { +@@ -0,0 +0,0 @@ populateFields(victim, event); // Paper - make cancellable } public static PrepareGrindstoneEvent callPrepareGrindstoneEvent(InventoryView view, ItemStack item) { @@ -123,7 +123,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 PrepareGrindstoneEvent event = new PrepareGrindstoneEvent(view, CraftItemStack.asCraftMirror(item).clone()); event.getView().getPlayer().getServer().getPluginManager().callEvent(event); event.getInventory().setItem(2, event.getResult()); -@@ -0,0 +0,0 @@ public class CraftEventFactory { +@@ -0,0 +0,0 @@ populateFields(victim, event); // Paper - make cancellable } public static PrepareSmithingEvent callPrepareSmithingEvent(InventoryView view, ItemStack item) { diff --git a/patches/unapplied/server/Add-entity-liquid-API.patch b/patches/server/Add-entity-liquid-API.patch similarity index 100% rename from patches/unapplied/server/Add-entity-liquid-API.patch rename to patches/server/Add-entity-liquid-API.patch diff --git a/patches/unapplied/server/Add-methods-to-get-translation-keys.patch b/patches/server/Add-methods-to-get-translation-keys.patch similarity index 100% rename from patches/unapplied/server/Add-methods-to-get-translation-keys.patch rename to patches/server/Add-methods-to-get-translation-keys.patch diff --git a/patches/unapplied/server/Add-moon-phase-API.patch b/patches/server/Add-moon-phase-API.patch similarity index 100% rename from patches/unapplied/server/Add-moon-phase-API.patch rename to patches/server/Add-moon-phase-API.patch diff --git a/patches/unapplied/server/Add-more-Evoker-API.patch b/patches/server/Add-more-Evoker-API.patch similarity index 100% rename from patches/unapplied/server/Add-more-Evoker-API.patch rename to patches/server/Add-more-Evoker-API.patch diff --git a/patches/unapplied/server/Add-permission-for-command-blocks.patch b/patches/server/Add-permission-for-command-blocks.patch similarity index 98% rename from patches/unapplied/server/Add-permission-for-command-blocks.patch rename to patches/server/Add-permission-for-command-blocks.patch index c983e4c213..2a73fb894c 100644 --- a/patches/unapplied/server/Add-permission-for-command-blocks.patch +++ b/patches/server/Add-permission-for-command-blocks.patch @@ -63,7 +63,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - if (tileentity instanceof CommandBlockEntity && player.canUseGameMasterBlocks()) { + if (tileentity instanceof CommandBlockEntity && (player.canUseGameMasterBlocks() || (player.isCreative() && player.getBukkitEntity().hasPermission("minecraft.commandblock")))) { // Paper - command block permission player.openCommandBlock((CommandBlockEntity) tileentity); - return InteractionResult.sidedSuccess(world.isClientSide); + return InteractionResult.SUCCESS; } else { diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/patches/unapplied/server/Add-playPickupItemAnimation-to-LivingEntity.patch b/patches/server/Add-playPickupItemAnimation-to-LivingEntity.patch similarity index 100% rename from patches/unapplied/server/Add-playPickupItemAnimation-to-LivingEntity.patch rename to patches/server/Add-playPickupItemAnimation-to-LivingEntity.patch diff --git a/patches/unapplied/server/Add-zombie-targets-turtle-egg-config.patch b/patches/server/Add-zombie-targets-turtle-egg-config.patch similarity index 100% rename from patches/unapplied/server/Add-zombie-targets-turtle-egg-config.patch rename to patches/server/Add-zombie-targets-turtle-egg-config.patch diff --git a/patches/unapplied/server/Brand-support.patch b/patches/server/Brand-support.patch similarity index 100% rename from patches/unapplied/server/Brand-support.patch rename to patches/server/Brand-support.patch diff --git a/patches/unapplied/server/Buffer-joins-to-world.patch b/patches/server/Buffer-joins-to-world.patch similarity index 100% rename from patches/unapplied/server/Buffer-joins-to-world.patch rename to patches/server/Buffer-joins-to-world.patch diff --git a/patches/unapplied/server/Cache-block-data-strings.patch b/patches/server/Cache-block-data-strings.patch similarity index 96% rename from patches/unapplied/server/Cache-block-data-strings.patch rename to patches/server/Cache-block-data-strings.patch index 23dbb1f542..6457385335 100644 --- a/patches/unapplied/server/Cache-block-data-strings.patch +++ b/patches/server/Cache-block-data-strings.patch @@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- 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 +Date: Tue, 23 Jul 2019 20:44:47 -0500 +Subject: [PATCH] Do not let the server load chunks from newer versions + +If the server attempts to load a chunk generated by a newer version of +the game, immediately stop the server to prevent data corruption. + +You can override this functionality at your own peril. + +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java +@@ -0,0 +0,0 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun + } + // Paper end - guard against serializing mismatching coordinates + ++ // Paper start - Do not let the server load chunks from newer versions ++ private static final int CURRENT_DATA_VERSION = net.minecraft.SharedConstants.getCurrentVersion().getDataVersion().getVersion(); ++ private static final boolean JUST_CORRUPT_IT = Boolean.getBoolean("Paper.ignoreWorldDataVersion"); ++ // Paper end - Do not let the server load chunks from newer versions ++ + @Nullable + public static SerializableChunkData parse(LevelHeightAccessor world, RegistryAccess registryManager, CompoundTag nbt) { + if (!nbt.contains("Status", 8)) { + return null; + } else { ++ // Paper start - Do not let the server load chunks from newer versions ++ if (nbt.contains("DataVersion", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC)) { ++ final int dataVersion = nbt.getInt("DataVersion"); ++ if (!JUST_CORRUPT_IT && dataVersion > CURRENT_DATA_VERSION) { ++ new RuntimeException("Server attempted to load chunk saved with newer version of minecraft! " + dataVersion + " > " + CURRENT_DATA_VERSION).printStackTrace(); ++ System.exit(1); ++ } ++ } ++ // Paper end - Do not let the server load chunks from newer versions + ChunkPos chunkcoordintpair = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); // Paper - guard against serializing mismatching coordinates; diff on change, see ChunkSerializer#getChunkCoordinate + long i = nbt.getLong("LastUpdate"); + long j = nbt.getLong("InhabitedTime"); diff --git a/patches/unapplied/server/Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch b/patches/server/Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch similarity index 100% rename from patches/unapplied/server/Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch rename to patches/server/Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch diff --git a/patches/unapplied/server/Don-t-require-FACING-data.patch b/patches/server/Don-t-require-FACING-data.patch similarity index 100% rename from patches/unapplied/server/Don-t-require-FACING-data.patch rename to patches/server/Don-t-require-FACING-data.patch diff --git a/patches/unapplied/server/Ensure-Entity-position-and-AABB-are-never-invalid.patch b/patches/server/Ensure-Entity-position-and-AABB-are-never-invalid.patch similarity index 100% rename from patches/unapplied/server/Ensure-Entity-position-and-AABB-are-never-invalid.patch rename to patches/server/Ensure-Entity-position-and-AABB-are-never-invalid.patch diff --git a/patches/unapplied/server/Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch b/patches/server/Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch similarity index 100% rename from patches/unapplied/server/Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch rename to patches/server/Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch diff --git a/patches/unapplied/server/Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch b/patches/server/Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch similarity index 91% rename from patches/unapplied/server/Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch rename to patches/server/Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch index 5bc75b46de..55d3462979 100644 --- a/patches/unapplied/server/Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch +++ b/patches/server/Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch @@ -21,15 +21,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.lastGoodX = this.awaitingPositionFromClient.x; this.lastGoodY = this.awaitingPositionFromClient.y; this.lastGoodZ = this.awaitingPositionFromClient.z; -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - // CraftBukkit end - - this.awaitingTeleportTime = this.tickCount; -- this.player.absMoveTo(d0, d1, d2, f, f1); -+ this.player.moveTo(d0, d1, d2, f, f1); // Paper - Fix Entity Teleportation and cancel velocity if teleported - this.player.connection.send(new ClientboundPlayerPositionPacket(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport)); - } - diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java @@ -63,11 +54,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance { } - DragonFireball dragonFireball = new DragonFireball(this.dragon.level(), this.dragon, vec34.normalize()); + DragonFireball dragonFireball = new DragonFireball(world, this.dragon, vec34.normalize()); + dragonFireball.preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported dragonFireball.moveTo(o, p, q, 0.0F, 0.0F); if (new com.destroystokyo.paper.event.entity.EnderDragonShootFireballEvent((org.bukkit.entity.EnderDragon) dragon.getBukkitEntity(), (org.bukkit.entity.DragonFireball) dragonFireball.getBukkitEntity()).callEvent()) // Paper - EnderDragon Events - this.dragon.level().addFreshEntity(dragonFireball); + world.addFreshEntity(dragonFireball); diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java diff --git a/patches/unapplied/server/Fix-Per-World-Difficulty-Remembering-Difficulty.patch b/patches/server/Fix-Per-World-Difficulty-Remembering-Difficulty.patch similarity index 91% rename from patches/unapplied/server/Fix-Per-World-Difficulty-Remembering-Difficulty.patch rename to patches/server/Fix-Per-World-Difficulty-Remembering-Difficulty.patch index 579f6d9aed..a8facd7242 100644 --- a/patches/unapplied/server/Fix-Per-World-Difficulty-Remembering-Difficulty.patch +++ b/patches/server/Fix-Per-World-Difficulty-Remembering-Difficulty.patch @@ -15,8 +15,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 worldloadlistener.stop(); // CraftBukkit start // this.updateMobSpawningFlags(); -- worldserver.setSpawnSettings(this.isSpawningMonsters(), this.isSpawningAnimals()); -+ worldserver.setSpawnSettings(worldserver.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && ((DedicatedServer) this).settings.getProperties().spawnMonsters, this.isSpawningAnimals()); // Paper - per level difficulty (from setDifficulty(ServerLevel, Difficulty, boolean)) +- worldserver.setSpawnSettings(this.isSpawningMonsters()); ++ worldserver.setSpawnSettings(worldserver.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && ((DedicatedServer) this).settings.getProperties().spawnMonsters); // Paper - per level difficulty (from setDifficulty(ServerLevel, Difficulty, boolean)) this.forceTicks = false; // CraftBukkit end @@ -44,8 +44,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 while (iterator.hasNext()) { ServerLevel worldserver = (ServerLevel) iterator.next(); -- worldserver.setSpawnSettings(this.isSpawningMonsters(), this.isSpawningAnimals()); -+ worldserver.setSpawnSettings(worldserver.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && ((DedicatedServer) this).settings.getProperties().spawnMonsters, this.isSpawningAnimals()); // Paper - per level difficulty (from setDifficulty(ServerLevel, Difficulty, boolean)) +- worldserver.setSpawnSettings(this.isSpawningMonsters()); ++ worldserver.setSpawnSettings(worldserver.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && ((DedicatedServer) this).settings.getProperties().spawnMonsters); // Paper - per level difficulty (from setDifficulty(ServerLevel, Difficulty, boolean)) } } @@ -97,9 +97,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.console.paperConfigurations.reloadConfigs(this.console); for (ServerLevel world : this.console.getAllLevels()) { - world.serverLevelData.setDifficulty(config.difficulty); -- world.setSpawnSettings(config.spawnMonsters, config.spawnAnimals); +- world.setSpawnSettings(config.spawnMonsters); + // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty -+ world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean)) ++ world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean)) for (SpawnCategory spawnCategory : SpawnCategory.values()) { if (CraftSpawnCategory.isValidForLimits(spawnCategory)) { diff --git a/patches/unapplied/server/Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch b/patches/server/Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch similarity index 100% rename from patches/unapplied/server/Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch rename to patches/server/Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch diff --git a/patches/unapplied/server/Fix-SPIGOT-5885-Unable-to-disable-advancements.patch b/patches/server/Fix-SPIGOT-5885-Unable-to-disable-advancements.patch similarity index 100% rename from patches/unapplied/server/Fix-SPIGOT-5885-Unable-to-disable-advancements.patch rename to patches/server/Fix-SPIGOT-5885-Unable-to-disable-advancements.patch diff --git a/patches/unapplied/server/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch b/patches/server/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch similarity index 98% rename from patches/unapplied/server/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch rename to patches/server/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch index 35c710dade..d4df3383a8 100644 --- a/patches/unapplied/server/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch +++ b/patches/server/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/mai 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 Level implements WorldGenLevel { +@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe float f1 = this.levelData.getSpawnAngle(); if (!blockposition1.equals(pos) || f1 != angle) { diff --git a/patches/unapplied/server/Fix-arrows-never-despawning-MC-125757.patch b/patches/server/Fix-arrows-never-despawning-MC-125757.patch similarity index 97% rename from patches/unapplied/server/Fix-arrows-never-despawning-MC-125757.patch rename to patches/server/Fix-arrows-never-despawning-MC-125757.patch index d8dc426942..d46ef894af 100644 --- a/patches/unapplied/server/Fix-arrows-never-despawning-MC-125757.patch +++ b/patches/server/Fix-arrows-never-despawning-MC-125757.patch @@ -13,8 +13,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java @@ -0,0 +0,0 @@ public abstract class AbstractArrow extends Projectile { + } - ++this.inGroundTime; } else { + if (tickCount > 200) this.tickDespawn(); // Paper - tick despawnCounter regardless after 10 seconds this.inGroundTime = 0; diff --git a/patches/unapplied/server/Fix-hex-colors-not-working-in-some-kick-messages.patch b/patches/server/Fix-hex-colors-not-working-in-some-kick-messages.patch similarity index 100% rename from patches/unapplied/server/Fix-hex-colors-not-working-in-some-kick-messages.patch rename to patches/server/Fix-hex-colors-not-working-in-some-kick-messages.patch diff --git a/patches/unapplied/server/Fix-regex-mistake-in-CB-NBT-int-deserialization.patch b/patches/server/Fix-regex-mistake-in-CB-NBT-int-deserialization.patch similarity index 100% rename from patches/unapplied/server/Fix-regex-mistake-in-CB-NBT-int-deserialization.patch rename to patches/server/Fix-regex-mistake-in-CB-NBT-int-deserialization.patch diff --git a/patches/unapplied/server/Fix-some-rails-connecting-improperly.patch b/patches/server/Fix-some-rails-connecting-improperly.patch similarity index 98% rename from patches/unapplied/server/Fix-some-rails-connecting-improperly.patch rename to patches/server/Fix-some-rails-connecting-improperly.patch index e72949763a..e9653b698e 100644 --- a/patches/unapplied/server/Fix-some-rails-connecting-improperly.patch +++ b/patches/server/Fix-some-rails-connecting-improperly.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBl state = this.updateDir(world, pos, state, true); if (this.isStraight) { - world.neighborChanged(state, pos, this, pos, notify); + world.neighborChanged(state, pos, this, null, notify); + state = world.getBlockState(pos); // Paper - Fix some rails connecting improperly } diff --git a/patches/unapplied/server/Hide-sync-chunk-writes-behind-flag.patch b/patches/server/Hide-sync-chunk-writes-behind-flag.patch similarity index 100% rename from patches/unapplied/server/Hide-sync-chunk-writes-behind-flag.patch rename to patches/server/Hide-sync-chunk-writes-behind-flag.patch diff --git a/patches/unapplied/server/Improve-Legacy-Component-serialization-size.patch b/patches/server/Improve-Legacy-Component-serialization-size.patch similarity index 100% rename from patches/unapplied/server/Improve-Legacy-Component-serialization-size.patch rename to patches/server/Improve-Legacy-Component-serialization-size.patch diff --git a/patches/unapplied/server/Improve-fix-EntityTargetLivingEntityEvent.patch b/patches/server/Improve-fix-EntityTargetLivingEntityEvent.patch similarity index 96% rename from patches/unapplied/server/Improve-fix-EntityTargetLivingEntityEvent.patch rename to patches/server/Improve-fix-EntityTargetLivingEntityEvent.patch index 090b7a1374..1d881a26a2 100644 --- a/patches/unapplied/server/Improve-fix-EntityTargetLivingEntityEvent.patch +++ b/patches/server/Improve-fix-EntityTargetLivingEntityEvent.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java @@ -0,0 +0,0 @@ public class StopAttackingIfTargetInvalid { - if (entityinsentient.canAttack(entityliving) && (!shouldForgetIfTargetUnreachable || !StopAttackingIfTargetInvalid.isTiredOfTryingToReachTarget(entityinsentient, behaviorbuilder_b.tryGet(memoryaccessor1))) && entityliving.isAlive() && entityliving.level() == entityinsentient.level() && !alternativeCondition.test(entityliving)) { + if (entityinsentient.canAttack(entityliving) && (!shouldForgetIfTargetUnreachable || !StopAttackingIfTargetInvalid.isTiredOfTryingToReachTarget(entityinsentient, behaviorbuilder_b.tryGet(memoryaccessor1))) && entityliving.isAlive() && entityliving.level() == entityinsentient.level() && !condition.test(worldserver, entityliving)) { return true; } else { + // Paper start - better track target change reason diff --git a/patches/unapplied/server/Inventory-getHolder-method-without-block-snapshot.patch b/patches/server/Inventory-getHolder-method-without-block-snapshot.patch similarity index 100% rename from patches/unapplied/server/Inventory-getHolder-method-without-block-snapshot.patch rename to patches/server/Inventory-getHolder-method-without-block-snapshot.patch diff --git a/patches/unapplied/server/Optimize-NetworkManager-Exception-Handling.patch b/patches/server/Optimize-NetworkManager-Exception-Handling.patch similarity index 100% rename from patches/unapplied/server/Optimize-NetworkManager-Exception-Handling.patch rename to patches/server/Optimize-NetworkManager-Exception-Handling.patch diff --git a/patches/unapplied/server/Paper-dumpitem-command.patch b/patches/server/Paper-dumpitem-command.patch similarity index 100% rename from patches/unapplied/server/Paper-dumpitem-command.patch rename to patches/server/Paper-dumpitem-command.patch diff --git a/patches/unapplied/server/Prevent-headless-pistons-from-being-created.patch b/patches/server/Prevent-headless-pistons-from-being-created.patch similarity index 70% rename from patches/unapplied/server/Prevent-headless-pistons-from-being-created.patch rename to patches/server/Prevent-headless-pistons-from-being-created.patch index 755bc844da..9c3f5eef41 100644 --- a/patches/unapplied/server/Prevent-headless-pistons-from-being-created.patch +++ b/patches/server/Prevent-headless-pistons-from-being-created.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Prevent headless pistons from being created Prevent headless pistons from being created by explosions or tree/mushroom growth. -diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java +diff --git a/src/main/java/net/minecraft/world/level/ServerExplosion.java b/src/main/java/net/minecraft/world/level/ServerExplosion.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/Explosion.java -+++ b/src/main/java/net/minecraft/world/level/Explosion.java -@@ -0,0 +0,0 @@ public class Explosion { +--- a/src/main/java/net/minecraft/world/level/ServerExplosion.java ++++ b/src/main/java/net/minecraft/world/level/ServerExplosion.java +@@ -0,0 +0,0 @@ public class ServerExplosion implements Explosion { if (f > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockposition, iblockdata, f)) { set.add(blockposition); @@ -17,8 +17,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (!io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowHeadlessPistons && iblockdata.getBlock() == Blocks.MOVING_PISTON) { + net.minecraft.world.level.block.entity.BlockEntity extension = this.level.getBlockEntity(blockposition); + if (extension instanceof net.minecraft.world.level.block.piston.PistonMovingBlockEntity blockEntity && blockEntity.isSourcePiston()) { -+ net.minecraft.core.Direction direction = iblockdata.getValue(net.minecraft.world.level.block.piston.PistonHeadBlock.FACING); -+ set.add(blockposition.relative(direction.getOpposite())); ++ net.minecraft.core.Direction direction = iblockdata.getValue(net.minecraft.world.level.block.piston.PistonHeadBlock.FACING); ++ set.add(blockposition.relative(direction.getOpposite())); + } + } + // Paper end - prevent headless pistons from forming diff --git a/patches/unapplied/server/Thread-Safe-Vanilla-Command-permission-checking.patch b/patches/server/Thread-Safe-Vanilla-Command-permission-checking.patch similarity index 100% rename from patches/unapplied/server/Thread-Safe-Vanilla-Command-permission-checking.patch rename to patches/server/Thread-Safe-Vanilla-Command-permission-checking.patch diff --git a/patches/unapplied/server/Add-PlayerRecipeBookClickEvent.patch b/patches/unapplied/server/Add-PlayerRecipeBookClickEvent.patch deleted file mode 100644 index 98bfeacc03..0000000000 --- a/patches/unapplied/server/Add-PlayerRecipeBookClickEvent.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Josh Roy <10731363+JRoy@users.noreply.github.com> -Date: Fri, 5 Jun 2020 18:24:06 -0400 -Subject: [PATCH] Add PlayerRecipeBookClickEvent - - -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - if (!this.player.containerMenu.stillValid(this.player)) { - ServerGamePacketListenerImpl.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu); - } else { -+ // Paper start - Add PlayerRecipeBookClickEvent -+ ResourceLocation recipeName = packet.getRecipe(); -+ boolean makeAll = packet.isShiftDown(); -+ com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent paperEvent = new com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent( -+ this.player.getBukkitEntity(), org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(recipeName), makeAll -+ ); -+ if (!paperEvent.callEvent()) { -+ return; -+ } -+ recipeName = CraftNamespacedKey.toMinecraft(paperEvent.getRecipe()); -+ makeAll = paperEvent.isMakeAll(); -+ if (org.bukkit.event.player.PlayerRecipeBookClickEvent.getHandlerList().getRegisteredListeners().length > 0) { -+ // Paper end - Add PlayerRecipeBookClickEvent - // CraftBukkit start - implement PlayerRecipeBookClickEvent -- org.bukkit.inventory.Recipe recipe = this.cserver.getRecipe(CraftNamespacedKey.fromMinecraft(packet.getRecipe())); -+ org.bukkit.inventory.Recipe recipe = this.cserver.getRecipe(CraftNamespacedKey.fromMinecraft(recipeName)); // Paper - if (recipe == null) { - return; - } -- org.bukkit.event.player.PlayerRecipeBookClickEvent event = CraftEventFactory.callRecipeBookClickEvent(this.player, recipe, packet.isShiftDown()); -+ // Paper start - Add PlayerRecipeBookClickEvent -+ org.bukkit.event.player.PlayerRecipeBookClickEvent event = CraftEventFactory.callRecipeBookClickEvent(this.player, recipe, makeAll); -+ recipeName = CraftNamespacedKey.toMinecraft(((org.bukkit.Keyed) event.getRecipe()).getKey()); -+ makeAll = event.isShiftClick(); -+ } -+ if (!(this.player.containerMenu instanceof RecipeBookMenu recipeBookMenu)) { -+ return; -+ } -+ // Paper end - Add PlayerRecipeBookClickEvent - - // Cast to keyed should be safe as the recipe will never be a MerchantRecipe. -- this.server.getRecipeManager().byKey(CraftNamespacedKey.toMinecraft(((org.bukkit.Keyed) event.getRecipe()).getKey())).ifPresent((recipeholder) -> { -- ((RecipeBookMenu) this.player.containerMenu).handlePlacement(event.isShiftClick(), recipeholder, this.player); -+ // Paper start - Add PlayerRecipeBookClickEvent -+ final boolean finalMakeAll = makeAll; -+ this.server.getRecipeManager().byKey(recipeName).ifPresent((recipeholder) -> { -+ recipeBookMenu.handlePlacement(finalMakeAll, recipeholder, this.player); -+ // Paper end - Add PlayerRecipeBookClickEvent - }); - // CraftBukkit end - } diff --git a/patches/unapplied/server/Do-not-let-the-server-load-chunks-from-newer-version.patch b/patches/unapplied/server/Do-not-let-the-server-load-chunks-from-newer-version.patch deleted file mode 100644 index 6c8dc45228..0000000000 --- a/patches/unapplied/server/Do-not-let-the-server-load-chunks-from-newer-version.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Tue, 23 Jul 2019 20:44:47 -0500 -Subject: [PATCH] Do not let the server load chunks from newer versions - -If the server attempts to load a chunk generated by a newer version of -the game, immediately stop the server to prevent data corruption. - -You can override this functionality at your own peril. - -diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -0,0 +0,0 @@ public class ChunkSerializer { - public static final String BLOCK_LIGHT_TAG = "BlockLight"; - public static final String SKY_LIGHT_TAG = "SkyLight"; - -+ // Paper start - Do not let the server load chunks from newer versions -+ private static final int CURRENT_DATA_VERSION = net.minecraft.SharedConstants.getCurrentVersion().getDataVersion().getVersion(); -+ private static final boolean JUST_CORRUPT_IT = Boolean.getBoolean("Paper.ignoreWorldDataVersion"); -+ // Paper end - Do not let the server load chunks from newer versions - public ChunkSerializer() {} - - // Paper start - guard against serializing mismatching coordinates -@@ -0,0 +0,0 @@ public class ChunkSerializer { - // Paper end - guard against serializing mismatching coordinates - - public static ProtoChunk read(ServerLevel world, PoiManager poiStorage, RegionStorageInfo key, ChunkPos chunkPos, CompoundTag nbt) { -+ // Paper start - Do not let the server load chunks from newer versions -+ if (nbt.contains("DataVersion", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC)) { -+ final int dataVersion = nbt.getInt("DataVersion"); -+ if (!JUST_CORRUPT_IT && dataVersion > CURRENT_DATA_VERSION) { -+ new RuntimeException("Server attempted to load chunk saved with newer version of minecraft! " + dataVersion + " > " + CURRENT_DATA_VERSION).printStackTrace(); -+ System.exit(1); -+ } -+ } -+ // Paper end - Do not let the server load chunks from newer versions - ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); // Paper - guard against serializing mismatching coordinates; diff on change, see ChunkSerializer#getChunkCoordinate - - if (!Objects.equals(chunkPos, chunkcoordintpair1)) {