From e12c9ae0ed15c8dba64b1aea5af6bc6e998f929c Mon Sep 17 00:00:00 2001 From: Jake Potrebic <jake.m.potrebic@gmail.com> Date: Wed, 7 Jun 2023 17:54:54 -0700 Subject: [PATCH] some more patches --- .../server/Add-Block-isValidTool.patch | 0 .../server/Add-StructuresLocateEvent.patch | 0 ...Leash-variable-to-EntityUnleashEvent.patch | 38 +++++++++---------- ...lternative-constructor-for-Rotations.patch | 0 ...ainThreadExecutor-to-BukkitScheduler.patch | 0 .../server/Add-recipe-to-cook-events.patch | 0 ...pport-for-hex-color-codes-in-console.patch | 0 ...le-for-always-placing-the-dragon-egg.patch | 2 +- .../server/Add-worldborder-events.patch | 0 ...d-PlayerStonecutterRecipeSelectEvent.patch | 0 ...ing-of-PlayerChangeBeaconEffectEvent.patch | 0 ...w-adding-items-to-BlockDropItemEvent.patch | 4 +- ...-using-signs-inside-spawn-protection.patch | 4 +- ...n-for-requiring-a-player-participant.patch | 2 +- .../Configurable-max-leash-distance.patch | 8 ++-- ...ignore-result-of-PlayerEditBookEvent.patch | 0 ...ed-item-when-player-has-disconnected.patch | 0 ...tab-completions-for-brigadier-comman.patch | 0 .../server/EntityMoveEvent.patch | 16 ++++---- .../server/Expand-world-key-API.patch | 0 .../server/Expose-Tracked-Players.patch | 0 .../server/Expose-protocol-version.patch | 0 .../Implement-BlockPreDispenseEvent.patch | 0 .../server/Improve-ServerGUI.patch | 0 .../Inline-shift-direction-fields.patch | 6 +-- .../server/Item-Rarity-API.patch | 0 .../Make-schedule-command-per-world.patch | 0 ...ipes-should-return-an-immutable-list.patch | 0 ...-grindstones-from-overstacking-items.patch | 0 ...ileHitEvent-call-when-fireballs-dead.patch | 0 .../Remove-streams-from-SensorNearest.patch | 0 ...-shield-blocking-on-dimension-change.patch | 2 +- ...onent-with-empty-text-instead-of-thr.patch | 0 .../TODO-Registry-Modification-API.patch | 0 ...per-exception-on-empty-JsonList-file.patch | 0 .../server/add-DragonEggFormEvent.patch | 6 +-- .../server/added-PlayerNameEntityEvent.patch | 18 ++------- ...disable-pathfinding-updates-on-block.patch | 0 ...opy-TESign-isEditable-from-snapshots.patch | 2 +- .../fix-converting-txt-to-json-file.patch | 0 ...fix-dead-slime-setSize-invincibility.patch | 0 ...telist-use-configurable-kick-message.patch | 0 ...-entity-allow-attribute-registration.patch | 0 ...sure-plate-EntityInteractEvent-for-i.patch | 19 ---------- 44 files changed, 49 insertions(+), 78 deletions(-) rename patches/{unapplied => }/server/Add-Block-isValidTool.patch (100%) rename patches/{unapplied => }/server/Add-StructuresLocateEvent.patch (100%) rename patches/{unapplied => }/server/Add-dropLeash-variable-to-EntityUnleashEvent.patch (78%) rename patches/{unapplied => }/server/Add-fast-alternative-constructor-for-Rotations.patch (100%) rename patches/{unapplied => }/server/Add-getMainThreadExecutor-to-BukkitScheduler.patch (100%) rename patches/{unapplied => }/server/Add-recipe-to-cook-events.patch (100%) rename patches/{unapplied => }/server/Add-support-for-hex-color-codes-in-console.patch (100%) rename patches/{unapplied => }/server/Add-toggle-for-always-placing-the-dragon-egg.patch (89%) rename patches/{unapplied => }/server/Add-worldborder-events.patch (100%) rename patches/{unapplied => }/server/Added-PlayerStonecutterRecipeSelectEvent.patch (100%) rename patches/{unapplied => }/server/Added-firing-of-PlayerChangeBeaconEffectEvent.patch (100%) rename patches/{unapplied => }/server/Allow-adding-items-to-BlockDropItemEvent.patch (94%) rename patches/{unapplied => }/server/Allow-using-signs-inside-spawn-protection.patch (70%) rename patches/{unapplied => }/server/Collision-option-for-requiring-a-player-participant.patch (98%) rename patches/{unapplied => }/server/Configurable-max-leash-distance.patch (67%) rename patches/{unapplied => }/server/Don-t-ignore-result-of-PlayerEditBookEvent.patch (100%) rename patches/{unapplied => }/server/Drop-carried-item-when-player-has-disconnected.patch (100%) rename patches/{unapplied => }/server/Enhance-console-tab-completions-for-brigadier-comman.patch (100%) rename patches/{unapplied => }/server/EntityMoveEvent.patch (75%) rename patches/{unapplied => }/server/Expand-world-key-API.patch (100%) rename patches/{unapplied => }/server/Expose-Tracked-Players.patch (100%) rename patches/{unapplied => }/server/Expose-protocol-version.patch (100%) rename patches/{unapplied => }/server/Implement-BlockPreDispenseEvent.patch (100%) rename patches/{unapplied => }/server/Improve-ServerGUI.patch (100%) rename patches/{unapplied => }/server/Inline-shift-direction-fields.patch (93%) rename patches/{unapplied => }/server/Item-Rarity-API.patch (100%) rename patches/{unapplied => }/server/Make-schedule-command-per-world.patch (100%) rename patches/{unapplied => }/server/Merchant-getRecipes-should-return-an-immutable-list.patch (100%) rename patches/{unapplied => }/server/Prevent-grindstones-from-overstacking-items.patch (100%) rename patches/{unapplied => }/server/Remove-ProjectileHitEvent-call-when-fireballs-dead.patch (100%) rename patches/{unapplied => }/server/Remove-streams-from-SensorNearest.patch (100%) rename patches/{unapplied => }/server/Reset-shield-blocking-on-dimension-change.patch (90%) rename patches/{unapplied => }/server/Return-chat-component-with-empty-text-instead-of-thr.patch (100%) rename patches/{unapplied => }/server/TODO-Registry-Modification-API.patch (100%) rename patches/{unapplied => }/server/Throw-proper-exception-on-empty-JsonList-file.patch (100%) rename patches/{unapplied => }/server/add-DragonEggFormEvent.patch (83%) rename patches/{unapplied => }/server/added-PlayerNameEntityEvent.patch (67%) rename patches/{unapplied => }/server/added-option-to-disable-pathfinding-updates-on-block.patch (100%) rename patches/{unapplied => }/server/copy-TESign-isEditable-from-snapshots.patch (94%) rename patches/{unapplied => }/server/fix-converting-txt-to-json-file.patch (100%) rename patches/{unapplied => }/server/fix-dead-slime-setSize-invincibility.patch (100%) rename patches/{unapplied => }/server/forced-whitelist-use-configurable-kick-message.patch (100%) rename patches/{unapplied => }/server/living-entity-allow-attribute-registration.patch (100%) delete mode 100644 patches/unapplied/server/stop-firing-pressure-plate-EntityInteractEvent-for-i.patch diff --git a/patches/unapplied/server/Add-Block-isValidTool.patch b/patches/server/Add-Block-isValidTool.patch similarity index 100% rename from patches/unapplied/server/Add-Block-isValidTool.patch rename to patches/server/Add-Block-isValidTool.patch diff --git a/patches/unapplied/server/Add-StructuresLocateEvent.patch b/patches/server/Add-StructuresLocateEvent.patch similarity index 100% rename from patches/unapplied/server/Add-StructuresLocateEvent.patch rename to patches/server/Add-StructuresLocateEvent.patch diff --git a/patches/unapplied/server/Add-dropLeash-variable-to-EntityUnleashEvent.patch b/patches/server/Add-dropLeash-variable-to-EntityUnleashEvent.patch similarity index 78% rename from patches/unapplied/server/Add-dropLeash-variable-to-EntityUnleashEvent.patch rename to patches/server/Add-dropLeash-variable-to-EntityUnleashEvent.patch index 20e4212a97..0ac4d68f3e 100644 --- a/patches/unapplied/server/Add-dropLeash-variable-to-EntityUnleashEvent.patch +++ b/patches/server/Add-dropLeash-variable-to-EntityUnleashEvent.patch @@ -24,17 +24,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - this.dropLeash(true, !player.getAbilities().instabuild); + this.dropLeash(true, event.isDropLeash()); // Paper - drop leash variable this.gameEvent(GameEvent.ENTITY_INTERACT, player); - return InteractionResult.sidedSuccess(this.level.isClientSide); + return InteractionResult.sidedSuccess(this.level().isClientSide); } else { @@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements Targeting { if (this.leashHolder != null) { if (!this.isAlive() || !this.leashHolder.isAlive()) { -- this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE)); // CraftBukkit +- this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE)); // CraftBukkit - this.dropLeash(true, true); + // Paper start - drop leash variable -+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE, true); -+ this.level.getCraftServer().getPluginManager().callEvent(event); // CraftBukkit ++ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? EntityUnleashEvent.UnleashReason.PLAYER_UNLEASH : EntityUnleashEvent.UnleashReason.HOLDER_GONE, true); ++ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit + this.dropLeash(true, event.isDropLeash()); + // Paper end } @@ -44,11 +44,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 boolean flag1 = super.startRiding(entity, force); if (flag1 && this.isLeashed()) { -- this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit +- this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit - this.dropLeash(true, true); + // Paper start - drop leash variable -+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN, true); -+ this.level.getCraftServer().getPluginManager().callEvent(event); // CraftBukkit ++ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, true); ++ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit + this.dropLeash(true, event.isDropLeash()); + // Paper end } @@ -58,16 +58,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override protected void removeAfterChangingDimensions() { super.removeAfterChangingDimensions(); -- this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit +- this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit - this.dropLeash(true, false); + // Paper start - drop leash variable -+ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN, false); -+ this.level.getCraftServer().getPluginManager().callEvent(event); // CraftBukkit ++ EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, false); ++ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit + this.dropLeash(true, event.isDropLeash()); + // Paper end this.getAllSlots().forEach((itemstack) -> { - if (!itemstack.isEmpty()) itemstack.setCount(0); // CraftBukkit - }); + if (!itemstack.isEmpty()) { + itemstack.setCount(0); diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java @@ -75,12 +75,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class PathfinderMob extends Mob { if (this instanceof TamableAnimal && ((TamableAnimal) this).isInSittingPose()) { - if (f > entity.level.paperConfig().misc.maxLeashDistance) { // Paper -- this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit + if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper +- this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit - this.dropLeash(true, true); + // Paper start - drop leash variable + EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true); -+ this.level.getCraftServer().getPluginManager().callEvent(event); // CraftBukkit ++ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit + this.dropLeash(true, event.isDropLeash()); + // Paper end } @@ -89,12 +89,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class PathfinderMob extends Mob { this.onLeashDistance(f); - if (f > entity.level.paperConfig().misc.maxLeashDistance) { // Paper -- this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit + if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper +- this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit - this.dropLeash(true, true); + // Paper start - drop leash variable + EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true); -+ this.level.getCraftServer().getPluginManager().callEvent(event); // CraftBukkit ++ this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit + this.dropLeash(true, event.isDropLeash()); + // Paper end this.goalSelector.disableControlFlag(Goal.Flag.MOVE); @@ -135,6 +135,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public static PlayerUnleashEntityEvent callPlayerUnleashEntityEvent(Mob entity, net.minecraft.world.entity.player.Player player, InteractionHand enumhand, boolean dropLeash) { + PlayerUnleashEntityEvent event = new PlayerUnleashEntityEvent(entity.getBukkitEntity(), (Player) player.getBukkitEntity(), CraftEquipmentSlot.getHand(enumhand), dropLeash); + // Paper end - entity.level.getCraftServer().getPluginManager().callEvent(event); + entity.level().getCraftServer().getPluginManager().callEvent(event); return event; } diff --git a/patches/unapplied/server/Add-fast-alternative-constructor-for-Rotations.patch b/patches/server/Add-fast-alternative-constructor-for-Rotations.patch similarity index 100% rename from patches/unapplied/server/Add-fast-alternative-constructor-for-Rotations.patch rename to patches/server/Add-fast-alternative-constructor-for-Rotations.patch diff --git a/patches/unapplied/server/Add-getMainThreadExecutor-to-BukkitScheduler.patch b/patches/server/Add-getMainThreadExecutor-to-BukkitScheduler.patch similarity index 100% rename from patches/unapplied/server/Add-getMainThreadExecutor-to-BukkitScheduler.patch rename to patches/server/Add-getMainThreadExecutor-to-BukkitScheduler.patch diff --git a/patches/unapplied/server/Add-recipe-to-cook-events.patch b/patches/server/Add-recipe-to-cook-events.patch similarity index 100% rename from patches/unapplied/server/Add-recipe-to-cook-events.patch rename to patches/server/Add-recipe-to-cook-events.patch diff --git a/patches/unapplied/server/Add-support-for-hex-color-codes-in-console.patch b/patches/server/Add-support-for-hex-color-codes-in-console.patch similarity index 100% rename from patches/unapplied/server/Add-support-for-hex-color-codes-in-console.patch rename to patches/server/Add-support-for-hex-color-codes-in-console.patch diff --git a/patches/unapplied/server/Add-toggle-for-always-placing-the-dragon-egg.patch b/patches/server/Add-toggle-for-always-placing-the-dragon-egg.patch similarity index 89% rename from patches/unapplied/server/Add-toggle-for-always-placing-the-dragon-egg.patch rename to patches/server/Add-toggle-for-always-placing-the-dragon-egg.patch index 315abd2799..54a379467d 100644 --- a/patches/unapplied/server/Add-toggle-for-always-placing-the-dragon-egg.patch +++ b/patches/server/Add-toggle-for-always-placing-the-dragon-egg.patch @@ -14,6 +14,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.spawnNewGateway(); - if (!this.previouslyKilled) { + if (this.level.paperConfig().entities.behavior.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg - this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION), Blocks.DRAGON_EGG.defaultBlockState()); + this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState()); } diff --git a/patches/unapplied/server/Add-worldborder-events.patch b/patches/server/Add-worldborder-events.patch similarity index 100% rename from patches/unapplied/server/Add-worldborder-events.patch rename to patches/server/Add-worldborder-events.patch diff --git a/patches/unapplied/server/Added-PlayerStonecutterRecipeSelectEvent.patch b/patches/server/Added-PlayerStonecutterRecipeSelectEvent.patch similarity index 100% rename from patches/unapplied/server/Added-PlayerStonecutterRecipeSelectEvent.patch rename to patches/server/Added-PlayerStonecutterRecipeSelectEvent.patch diff --git a/patches/unapplied/server/Added-firing-of-PlayerChangeBeaconEffectEvent.patch b/patches/server/Added-firing-of-PlayerChangeBeaconEffectEvent.patch similarity index 100% rename from patches/unapplied/server/Added-firing-of-PlayerChangeBeaconEffectEvent.patch rename to patches/server/Added-firing-of-PlayerChangeBeaconEffectEvent.patch diff --git a/patches/unapplied/server/Allow-adding-items-to-BlockDropItemEvent.patch b/patches/server/Allow-adding-items-to-BlockDropItemEvent.patch similarity index 94% rename from patches/unapplied/server/Allow-adding-items-to-BlockDropItemEvent.patch rename to patches/server/Allow-adding-items-to-BlockDropItemEvent.patch index 4367155fda..7f5a875ace 100644 --- a/patches/unapplied/server/Allow-adding-items-to-BlockDropItemEvent.patch +++ b/patches/server/Allow-adding-items-to-BlockDropItemEvent.patch @@ -24,12 +24,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!event.isCancelled()) { - for (ItemEntity item : items) { -- item.level.addFreshEntity(item); +- item.level().addFreshEntity(item); + // Paper start + for (Item bukkit : list) { + if (!bukkit.isValid()) { + Entity item = ((org.bukkit.craftbukkit.entity.CraftItem) bukkit).getHandle(); -+ item.level.addFreshEntity(item); ++ item.level().addFreshEntity(item); + } + } + } else { diff --git a/patches/unapplied/server/Allow-using-signs-inside-spawn-protection.patch b/patches/server/Allow-using-signs-inside-spawn-protection.patch similarity index 70% rename from patches/unapplied/server/Allow-using-signs-inside-spawn-protection.patch rename to patches/server/Allow-using-signs-inside-spawn-protection.patch index 3b2b9a0495..113ff8db69 100644 --- a/patches/unapplied/server/Allow-using-signs-inside-spawn-protection.patch +++ b/patches/server/Allow-using-signs-inside-spawn-protection.patch @@ -9,11 +9,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- 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 implements ServerPlayerConnection, Tic - int i = this.player.level.getMaxBuildHeight(); + int i = this.player.level().getMaxBuildHeight(); if (blockposition.getY() < i) { - if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract(this.player, blockposition)) { -+ if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && (worldserver.mayInteract(this.player, blockposition) || (worldserver.paperConfig().spawn.allowUsingSignsInsideSpawnProtection && worldserver.getBlockState(blockposition).getBlock() instanceof net.minecraft.world.level.block.SignBlock))) { // Paper - sign check ++ if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && (worldserver.mayInteract(this.player, blockposition) || (worldserver.paperConfig().spawn.allowUsingSignsInsideSpawnProtection && worldserver.getBlockState(blockposition).getBlock() instanceof net.minecraft.world.level.block.SignBlock))) { // Paper - sign check this.player.stopUsingItem(); // CraftBukkit - SPIGOT-4706 InteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock); diff --git a/patches/unapplied/server/Collision-option-for-requiring-a-player-participant.patch b/patches/server/Collision-option-for-requiring-a-player-participant.patch similarity index 98% rename from patches/unapplied/server/Collision-option-for-requiring-a-player-participant.patch rename to patches/server/Collision-option-for-requiring-a-player-participant.patch index 294874f525..ac897b6661 100644 --- a/patches/unapplied/server/Collision-option-for-requiring-a-player-participant.patch +++ b/patches/server/Collision-option-for-requiring-a-player-participant.patch @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java @@ -0,0 +0,0 @@ public abstract class AbstractMinecart extends Entity { public void push(Entity entity) { - if (!this.level.isClientSide) { + if (!this.level().isClientSide) { if (!entity.noPhysics && !this.noPhysics) { + if (!this.level.paperConfig().collisions.allowVehicleCollisions && this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper if (!this.hasPassenger(entity)) { diff --git a/patches/unapplied/server/Configurable-max-leash-distance.patch b/patches/server/Configurable-max-leash-distance.patch similarity index 67% rename from patches/unapplied/server/Configurable-max-leash-distance.patch rename to patches/server/Configurable-max-leash-distance.patch index c7f12f5235..2f6115513b 100644 --- a/patches/unapplied/server/Configurable-max-leash-distance.patch +++ b/patches/server/Configurable-max-leash-distance.patch @@ -13,8 +13,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this instanceof TamableAnimal && ((TamableAnimal) this).isInSittingPose()) { - if (f > 10.0F) { -+ if (f > entity.level.paperConfig().misc.maxLeashDistance) { // Paper - this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit ++ if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper + this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit this.dropLeash(true, true); } @@ -0,0 +0,0 @@ public abstract class PathfinderMob extends Mob { @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.onLeashDistance(f); - if (f > 10.0F) { -+ if (f > entity.level.paperConfig().misc.maxLeashDistance) { // Paper - this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit ++ if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper + this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit this.dropLeash(true, true); this.goalSelector.disableControlFlag(Goal.Flag.MOVE); diff --git a/patches/unapplied/server/Don-t-ignore-result-of-PlayerEditBookEvent.patch b/patches/server/Don-t-ignore-result-of-PlayerEditBookEvent.patch similarity index 100% rename from patches/unapplied/server/Don-t-ignore-result-of-PlayerEditBookEvent.patch rename to patches/server/Don-t-ignore-result-of-PlayerEditBookEvent.patch diff --git a/patches/unapplied/server/Drop-carried-item-when-player-has-disconnected.patch b/patches/server/Drop-carried-item-when-player-has-disconnected.patch similarity index 100% rename from patches/unapplied/server/Drop-carried-item-when-player-has-disconnected.patch rename to patches/server/Drop-carried-item-when-player-has-disconnected.patch diff --git a/patches/unapplied/server/Enhance-console-tab-completions-for-brigadier-comman.patch b/patches/server/Enhance-console-tab-completions-for-brigadier-comman.patch similarity index 100% rename from patches/unapplied/server/Enhance-console-tab-completions-for-brigadier-comman.patch rename to patches/server/Enhance-console-tab-completions-for-brigadier-comman.patch diff --git a/patches/unapplied/server/EntityMoveEvent.patch b/patches/server/EntityMoveEvent.patch similarity index 75% rename from patches/unapplied/server/EntityMoveEvent.patch rename to patches/server/EntityMoveEvent.patch index 4bfa11d82c..d3fbdef86e 100644 --- a/patches/unapplied/server/EntityMoveEvent.patch +++ b/patches/server/EntityMoveEvent.patch @@ -35,21 +35,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { this.pushEntities(); - this.level.getProfiler().pop(); + this.level().getProfiler().pop(); + // Paper start -+ if (((ServerLevel) this.level).hasEntityMoveEvent && !(this instanceof net.minecraft.world.entity.player.Player)) { -+ if (this.xo != getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) { -+ Location from = new Location(this.level.getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO); -+ Location to = new Location (this.level.getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); ++ if (((ServerLevel) this.level()).hasEntityMoveEvent && !(this instanceof net.minecraft.world.entity.player.Player)) { ++ if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) { ++ Location from = new Location(this.level().getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO); ++ Location to = new Location (this.level().getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); + io.papermc.paper.event.entity.EntityMoveEvent event = new io.papermc.paper.event.entity.EntityMoveEvent(this.getBukkitLivingEntity(), from, to.clone()); + if (!event.callEvent()) { -+ absMoveTo(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch()); ++ this.absMoveTo(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch()); + } else if (!to.equals(event.getTo())) { -+ absMoveTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch()); ++ this.absMoveTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch()); + } + } + } + // Paper end - if (!this.level.isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { + if (!this.level().isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { this.hurt(this.damageSources().drown(), 1.0F); } diff --git a/patches/unapplied/server/Expand-world-key-API.patch b/patches/server/Expand-world-key-API.patch similarity index 100% rename from patches/unapplied/server/Expand-world-key-API.patch rename to patches/server/Expand-world-key-API.patch diff --git a/patches/unapplied/server/Expose-Tracked-Players.patch b/patches/server/Expose-Tracked-Players.patch similarity index 100% rename from patches/unapplied/server/Expose-Tracked-Players.patch rename to patches/server/Expose-Tracked-Players.patch diff --git a/patches/unapplied/server/Expose-protocol-version.patch b/patches/server/Expose-protocol-version.patch similarity index 100% rename from patches/unapplied/server/Expose-protocol-version.patch rename to patches/server/Expose-protocol-version.patch diff --git a/patches/unapplied/server/Implement-BlockPreDispenseEvent.patch b/patches/server/Implement-BlockPreDispenseEvent.patch similarity index 100% rename from patches/unapplied/server/Implement-BlockPreDispenseEvent.patch rename to patches/server/Implement-BlockPreDispenseEvent.patch diff --git a/patches/unapplied/server/Improve-ServerGUI.patch b/patches/server/Improve-ServerGUI.patch similarity index 100% rename from patches/unapplied/server/Improve-ServerGUI.patch rename to patches/server/Improve-ServerGUI.patch diff --git a/patches/unapplied/server/Inline-shift-direction-fields.patch b/patches/server/Inline-shift-direction-fields.patch similarity index 93% rename from patches/unapplied/server/Inline-shift-direction-fields.patch rename to patches/server/Inline-shift-direction-fields.patch index 2fc3f9a14a..1634cc2e3e 100644 --- a/patches/unapplied/server/Inline-shift-direction-fields.patch +++ b/patches/server/Inline-shift-direction-fields.patch @@ -11,9 +11,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/core/Direction.java +++ b/src/main/java/net/minecraft/core/Direction.java @@ -0,0 +0,0 @@ public enum Direction implements StringRepresentable { - }, (direction1, direction2) -> { - throw new IllegalArgumentException("Duplicate keys"); - }, Long2ObjectOpenHashMap::new)); + })).toArray((i) -> { + return new Direction[i]; + }); + // Paper start + private final int adjX; + private final int adjY; diff --git a/patches/unapplied/server/Item-Rarity-API.patch b/patches/server/Item-Rarity-API.patch similarity index 100% rename from patches/unapplied/server/Item-Rarity-API.patch rename to patches/server/Item-Rarity-API.patch diff --git a/patches/unapplied/server/Make-schedule-command-per-world.patch b/patches/server/Make-schedule-command-per-world.patch similarity index 100% rename from patches/unapplied/server/Make-schedule-command-per-world.patch rename to patches/server/Make-schedule-command-per-world.patch diff --git a/patches/unapplied/server/Merchant-getRecipes-should-return-an-immutable-list.patch b/patches/server/Merchant-getRecipes-should-return-an-immutable-list.patch similarity index 100% rename from patches/unapplied/server/Merchant-getRecipes-should-return-an-immutable-list.patch rename to patches/server/Merchant-getRecipes-should-return-an-immutable-list.patch diff --git a/patches/unapplied/server/Prevent-grindstones-from-overstacking-items.patch b/patches/server/Prevent-grindstones-from-overstacking-items.patch similarity index 100% rename from patches/unapplied/server/Prevent-grindstones-from-overstacking-items.patch rename to patches/server/Prevent-grindstones-from-overstacking-items.patch diff --git a/patches/unapplied/server/Remove-ProjectileHitEvent-call-when-fireballs-dead.patch b/patches/server/Remove-ProjectileHitEvent-call-when-fireballs-dead.patch similarity index 100% rename from patches/unapplied/server/Remove-ProjectileHitEvent-call-when-fireballs-dead.patch rename to patches/server/Remove-ProjectileHitEvent-call-when-fireballs-dead.patch diff --git a/patches/unapplied/server/Remove-streams-from-SensorNearest.patch b/patches/server/Remove-streams-from-SensorNearest.patch similarity index 100% rename from patches/unapplied/server/Remove-streams-from-SensorNearest.patch rename to patches/server/Remove-streams-from-SensorNearest.patch diff --git a/patches/unapplied/server/Reset-shield-blocking-on-dimension-change.patch b/patches/server/Reset-shield-blocking-on-dimension-change.patch similarity index 90% rename from patches/unapplied/server/Reset-shield-blocking-on-dimension-change.patch rename to patches/server/Reset-shield-blocking-on-dimension-change.patch index 8b932d8808..b7a9eecb5b 100644 --- a/patches/unapplied/server/Reset-shield-blocking-on-dimension-change.patch +++ b/patches/server/Reset-shield-blocking-on-dimension-change.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -0,0 +0,0 @@ public class ServerPlayer extends Player { - this.level.getCraftServer().getPluginManager().callEvent(changeEvent); + this.level().getCraftServer().getPluginManager().callEvent(changeEvent); // CraftBukkit end } + // Paper start diff --git a/patches/unapplied/server/Return-chat-component-with-empty-text-instead-of-thr.patch b/patches/server/Return-chat-component-with-empty-text-instead-of-thr.patch similarity index 100% rename from patches/unapplied/server/Return-chat-component-with-empty-text-instead-of-thr.patch rename to patches/server/Return-chat-component-with-empty-text-instead-of-thr.patch diff --git a/patches/unapplied/server/TODO-Registry-Modification-API.patch b/patches/server/TODO-Registry-Modification-API.patch similarity index 100% rename from patches/unapplied/server/TODO-Registry-Modification-API.patch rename to patches/server/TODO-Registry-Modification-API.patch diff --git a/patches/unapplied/server/Throw-proper-exception-on-empty-JsonList-file.patch b/patches/server/Throw-proper-exception-on-empty-JsonList-file.patch similarity index 100% rename from patches/unapplied/server/Throw-proper-exception-on-empty-JsonList-file.patch rename to patches/server/Throw-proper-exception-on-empty-JsonList-file.patch diff --git a/patches/unapplied/server/add-DragonEggFormEvent.patch b/patches/server/add-DragonEggFormEvent.patch similarity index 83% rename from patches/unapplied/server/add-DragonEggFormEvent.patch rename to patches/server/add-DragonEggFormEvent.patch index 7f2d18df5a..d38b1113c8 100644 --- a/patches/unapplied/server/add-DragonEggFormEvent.patch +++ b/patches/server/add-DragonEggFormEvent.patch @@ -13,16 +13,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.spawnExitPortal(true); this.spawnNewGateway(); + // Paper start - DragonEggFormEvent -+ BlockPos eggPosition = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION); ++ BlockPos eggPosition = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)); + org.bukkit.craftbukkit.block.CraftBlockState eggState = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(this.level, eggPosition); + eggState.setData(Blocks.DRAGON_EGG.defaultBlockState()); + io.papermc.paper.event.block.DragonEggFormEvent eggEvent = new io.papermc.paper.event.block.DragonEggFormEvent(org.bukkit.craftbukkit.block.CraftBlock.at(this.level, eggPosition), eggState, + new org.bukkit.craftbukkit.boss.CraftDragonBattle(this)); + // Paper end - DragonEggFormEvent if (this.level.paperConfig().entities.behavior.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg -- this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION), Blocks.DRAGON_EGG.defaultBlockState()); +- this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState()); + // Paper start - DragonEggFormEvent -+ //this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION), Blocks.DRAGON_EGG.defaultBlockState()); ++ // this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState()); + } else { + eggEvent.setCancelled(true); + } diff --git a/patches/unapplied/server/added-PlayerNameEntityEvent.patch b/patches/server/added-PlayerNameEntityEvent.patch similarity index 67% rename from patches/unapplied/server/added-PlayerNameEntityEvent.patch rename to patches/server/added-PlayerNameEntityEvent.patch index 757009a9bc..049edd15fa 100644 --- a/patches/unapplied/server/added-PlayerNameEntityEvent.patch +++ b/patches/server/added-PlayerNameEntityEvent.patch @@ -8,31 +8,21 @@ diff --git a/src/main/java/net/minecraft/world/item/NameTagItem.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/NameTagItem.java +++ b/src/main/java/net/minecraft/world/item/NameTagItem.java -@@ -0,0 +0,0 @@ - package net.minecraft.world.item; - -+// Paper start -+import io.papermc.paper.adventure.PaperAdventure; -+import io.papermc.paper.event.player.PlayerNameEntityEvent; -+// Paper end - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; - import net.minecraft.world.entity.LivingEntity; @@ -0,0 +0,0 @@ public class NameTagItem extends Item { public InteractionResult interactLivingEntity(ItemStack stack, Player user, LivingEntity entity, InteractionHand hand) { if (stack.hasCustomHoverName() && !(entity instanceof Player)) { - if (!user.level.isClientSide && entity.isAlive()) { + if (!user.level().isClientSide && entity.isAlive()) { - entity.setCustomName(stack.getHoverName()); - if (entity instanceof Mob) { - ((Mob)entity).setPersistenceRequired(); + // Paper start -+ PlayerNameEntityEvent event = new PlayerNameEntityEvent(((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity(), entity.getBukkitLivingEntity(), PaperAdventure.asAdventure(stack.getHoverName()), true); ++ io.papermc.paper.event.player.PlayerNameEntityEvent event = new io.papermc.paper.event.player.PlayerNameEntityEvent(((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity(), entity.getBukkitLivingEntity(), io.papermc.paper.adventure.PaperAdventure.asAdventure(stack.getHoverName()), true); + if (!event.callEvent()) return InteractionResult.PASS; + LivingEntity newEntityLiving = ((org.bukkit.craftbukkit.entity.CraftLivingEntity) event.getEntity()).getHandle(); -+ newEntityLiving.setCustomName(event.getName() != null ? PaperAdventure.asVanilla(event.getName()) : null); ++ newEntityLiving.setCustomName(event.getName() != null ? io.papermc.paper.adventure.PaperAdventure.asVanilla(event.getName()) : null); + if (event.isPersistent() && newEntityLiving instanceof Mob) { + ((Mob) newEntityLiving).setPersistenceRequired(); -+ // Paper end ++ // Paper end } stack.shrink(1); diff --git a/patches/unapplied/server/added-option-to-disable-pathfinding-updates-on-block.patch b/patches/server/added-option-to-disable-pathfinding-updates-on-block.patch similarity index 100% rename from patches/unapplied/server/added-option-to-disable-pathfinding-updates-on-block.patch rename to patches/server/added-option-to-disable-pathfinding-updates-on-block.patch diff --git a/patches/unapplied/server/copy-TESign-isEditable-from-snapshots.patch b/patches/server/copy-TESign-isEditable-from-snapshots.patch similarity index 94% rename from patches/unapplied/server/copy-TESign-isEditable-from-snapshots.patch rename to patches/server/copy-TESign-isEditable-from-snapshots.patch index 1ad72b53a5..309e60d5bc 100644 --- a/patches/unapplied/server/copy-TESign-isEditable-from-snapshots.patch +++ b/patches/server/copy-TESign-isEditable-from-snapshots.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java @@ -0,0 +0,0 @@ public class CraftSign<T extends SignBlockEntity> extends CraftBlockEntityState< - this.front.applyLegacyStringToSignSide(); + this.back.applyLegacyStringToSignSide(); super.applyTo(sign); + sign.isEditable = getSnapshot().isEditable; // Paper - copy manually diff --git a/patches/unapplied/server/fix-converting-txt-to-json-file.patch b/patches/server/fix-converting-txt-to-json-file.patch similarity index 100% rename from patches/unapplied/server/fix-converting-txt-to-json-file.patch rename to patches/server/fix-converting-txt-to-json-file.patch diff --git a/patches/unapplied/server/fix-dead-slime-setSize-invincibility.patch b/patches/server/fix-dead-slime-setSize-invincibility.patch similarity index 100% rename from patches/unapplied/server/fix-dead-slime-setSize-invincibility.patch rename to patches/server/fix-dead-slime-setSize-invincibility.patch diff --git a/patches/unapplied/server/forced-whitelist-use-configurable-kick-message.patch b/patches/server/forced-whitelist-use-configurable-kick-message.patch similarity index 100% rename from patches/unapplied/server/forced-whitelist-use-configurable-kick-message.patch rename to patches/server/forced-whitelist-use-configurable-kick-message.patch diff --git a/patches/unapplied/server/living-entity-allow-attribute-registration.patch b/patches/server/living-entity-allow-attribute-registration.patch similarity index 100% rename from patches/unapplied/server/living-entity-allow-attribute-registration.patch rename to patches/server/living-entity-allow-attribute-registration.patch diff --git a/patches/unapplied/server/stop-firing-pressure-plate-EntityInteractEvent-for-i.patch b/patches/unapplied/server/stop-firing-pressure-plate-EntityInteractEvent-for-i.patch deleted file mode 100644 index 69d455aeeb..0000000000 --- a/patches/unapplied/server/stop-firing-pressure-plate-EntityInteractEvent-for-i.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Trigary <trigary0@gmail.com> -Date: Tue, 2 Feb 2021 09:17:59 +0100 -Subject: [PATCH] stop firing pressure plate EntityInteractEvent for ignored - entities - - -diff --git a/src/main/java/net/minecraft/world/level/block/PressurePlateBlock.java b/src/main/java/net/minecraft/world/level/block/PressurePlateBlock.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/block/PressurePlateBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/PressurePlateBlock.java -@@ -0,0 +0,0 @@ public class PressurePlateBlock extends BasePressurePlateBlock { - - while (iterator.hasNext()) { - Entity entity = (Entity) iterator.next(); -+ if (entity.isIgnoringBlockTriggers()) continue; // Paper - don't call event for ignored entities - - // CraftBukkit start - Call interact event when turning on a pressure plate - if (this.getSignalForState(world.getBlockState(pos)) == 0) {