From 66431e1300c26cf7d9eeb9a6a18810c92f3f3938 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke <nassim@njahnke.dev> Date: Fri, 19 Jan 2024 22:13:42 +0100 Subject: [PATCH] [ci skip] Add more identifying patch comments --- patches/api/Add-Block-isValidTool.patch | 2 +- patches/api/Add-Entity-Body-Yaw-API.patch | 2 +- ...Blocks-to-be-accessed-via-a-long-key.patch | 8 ++-- patches/api/Collision-API.patch | 4 +- patches/api/Expand-FallingBlock-API.patch | 4 +- ...Folia-scheduler-and-owned-region-API.patch | 2 +- patches/api/Freeze-Tick-Lock-API.patch | 4 +- patches/api/Item-canEntityPickup.patch | 2 +- patches/api/Missing-Entity-API.patch | 4 +- ...PlayerPickupItemEvent-setFlyAtPlayer.patch | 4 +- patches/api/Stinger-API.patch | 4 +- .../API-for-an-entity-s-scoreboard-name.patch | 2 +- ...t-Material-from-Boats-and-Minecarts.patch} | 2 +- .../Add-API-for-item-entity-health.patch | 2 +- ...nate-Current-redstone-implementation.patch | 2 +- ...tch => Add-BlockFailedDispenseEvent.patch} | 8 ++-- ....patch => Add-BlockPreDispenseEvent.patch} | 4 +- ...ent.patch => Add-DragonEggFormEvent.patch} | 13 +++--- patches/server/Add-Entity-Body-Yaw-API.patch | 2 +- .../server/Add-EntityLoadCrossbowEvent.patch | 12 +++--- ...eEvent.patch => Add-EntityMoveEvent.patch} | 10 ++--- patches/server/Add-PlayerArmSwingEvent.patch | 2 +- ...> Add-PlayerChangeBeaconEffectEvent.patch} | 11 +++-- ... Add-PlayerFlowerPotManipulateEvent.patch} | 6 +-- ...=> Add-PlayerLecternPageChangeEvent.patch} | 12 +++--- ...=> Add-PlayerLoomPatternSelectEvent.patch} | 6 +-- ....patch => Add-PlayerNameEntityEvent.patch} | 6 +-- ...-PlayerStonecutterRecipeSelectEvent.patch} | 8 ++-- ...=> Add-ServerResourcesReloadedEvent.patch} | 12 +++--- ...tch => Add-WorldGameRuleChangeEvent.patch} | 30 +++++++------- ...-configurable-height-for-slime-spawn.patch | 2 +- .../server/Add-recipe-to-cook-events.patch | 13 +++--- patches/server/Add-sendOpLevel-API.patch | 12 +++--- ...le-for-always-placing-the-dragon-egg.patch | 2 +- ...d-settings-for-mobs-picking-up-loot.patch} | 6 +-- patches/server/Add-worldborder-events.patch | 14 +++---- .../Allow-Saving-of-Oversized-Chunks.patch | 2 +- ...w-adding-items-to-BlockDropItemEvent.patch | 8 ++-- ...mob-spawner-spawn-egg-transformation.patch | 2 +- patches/server/Cache-burn-durations.patch | 4 +- patches/server/Collision-API.patch | 4 +- patches/server/Collision-optimisations.patch | 4 +- ...n-for-requiring-a-player-participant.patch | 6 +-- ...onfigurable-door-breaking-difficulty.patch | 4 +- .../Configurable-max-leash-distance.patch | 4 +- ...stom-Chat-Completion-Suggestions-API.patch | 2 +- .../Deep-clone-unhandled-nbt-tags.patch | 2 +- ...tab-completions-for-brigadier-comman.patch | 2 +- .../server/Expand-EntityUnleashEvent.patch | 40 +++++++++---------- patches/server/Expand-FallingBlock-API.patch | 4 +- ...-CauldronLevelChange-on-initial-fill.patch | 30 +++++++------- .../server/Fix-Spigot-growth-modifiers.patch | 2 +- .../server/Fix-a-bunch-of-vanilla-bugs.patch | 7 +--- ...act-event-not-being-called-sometimes.patch | 8 ++-- .../Fix-nerfed-slime-when-splitting.patch | 2 +- patches/server/Fix-this-stupid-bullshit.patch | 2 +- .../server/Fix-villager-boat-exploit.patch | 4 +- patches/server/Freeze-Tick-Lock-API.patch | 2 +- .../Further-improve-server-tick-loop.patch | 2 +- patches/server/Improve-ServerGUI.patch | 14 +++---- .../Inline-shift-direction-fields.patch | 14 +++---- patches/server/Item-canEntityPickup.patch | 8 ++-- .../server/Item-no-age-no-player-pickup.patch | 2 +- patches/server/Lag-compensation-ticks.patch | 2 +- ...st-throw-both-Spread-and-Grow-Events.patch | 2 +- .../Make-schedule-command-per-world.patch | 4 +- ...ally-inline-methods-in-BlockPosition.patch | 18 ++++----- patches/server/Missing-Entity-API.patch | 12 +++--- patches/server/More-Projectile-API.patch | 4 +- ...ptimize-BlockPosition-helper-methods.patch | 4 +- patches/server/Optimize-Hoppers.patch | 2 +- ...prevent-NBT-copy-in-smithing-recipes.patch | 2 +- patches/server/Paper-config-files.patch | 2 +- ...s-ServerLevel-for-gamerule-callbacks.patch | 12 +++--- ...PlayerPickupItemEvent-setFlyAtPlayer.patch | 4 +- ...-grindstones-from-overstacking-items.patch | 2 +- patches/server/Remove-stale-POIs.patch | 4 +- ...-shield-blocking-on-dimension-change.patch | 4 +- ...onent-with-empty-text-instead-of-thr.patch | 4 +- patches/server/Stinger-API.patch | 4 +- ...disable-pathfinding-updates-on-block.patch | 2 +- .../fix-converting-txt-to-json-file.patch | 10 ++--- ...-entity-allow-attribute-registration.patch | 12 +++--- ...rt-serverside-behavior-of-keepalives.patch | 2 +- 84 files changed, 265 insertions(+), 271 deletions(-) rename patches/server/{Implement-API-to-get-Material-from-Boats-and-Minecar.patch => API-to-get-Material-from-Boats-and-Minecarts.patch} (97%) rename patches/server/{Implemented-BlockFailedDispenseEvent.patch => Add-BlockFailedDispenseEvent.patch} (91%) rename patches/server/{Implement-BlockPreDispenseEvent.patch => Add-BlockPreDispenseEvent.patch} (95%) rename patches/server/{add-DragonEggFormEvent.patch => Add-DragonEggFormEvent.patch} (87%) rename patches/server/{EntityMoveEvent.patch => Add-EntityMoveEvent.patch} (90%) rename patches/server/{Added-firing-of-PlayerChangeBeaconEffectEvent.patch => Add-PlayerChangeBeaconEffectEvent.patch} (89%) rename patches/server/{Implement-PlayerFlowerPotManipulateEvent.patch => Add-PlayerFlowerPotManipulateEvent.patch} (91%) rename patches/server/{Added-PlayerLecternPageChangeEvent.patch => Add-PlayerLecternPageChangeEvent.patch} (87%) rename patches/server/{Added-PlayerLoomPatternSelectEvent.patch => Add-PlayerLoomPatternSelectEvent.patch} (94%) rename patches/server/{added-PlayerNameEntityEvent.patch => Add-PlayerNameEntityEvent.patch} (91%) rename patches/server/{Added-PlayerStonecutterRecipeSelectEvent.patch => Add-PlayerStonecutterRecipeSelectEvent.patch} (92%) rename patches/server/{Added-ServerResourcesReloadedEvent.patch => Add-ServerResourcesReloadedEvent.patch} (89%) rename patches/server/{Added-WorldGameRuleChangeEvent.patch => Add-WorldGameRuleChangeEvent.patch} (85%) rename patches/server/{Added-world-settings-for-mobs-picking-up-loot.patch => Add-world-settings-for-mobs-picking-up-loot.patch} (92%) diff --git a/patches/api/Add-Block-isValidTool.patch b/patches/api/Add-Block-isValidTool.patch index 348e05b224..ed3cd1481c 100644 --- a/patches/api/Add-Block-isValidTool.patch +++ b/patches/api/Add-Block-isValidTool.patch @@ -21,6 +21,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @return whether the block will drop items + */ + boolean isValidTool(@NotNull ItemStack itemStack); - // Paper End + // Paper end /** diff --git a/patches/api/Add-Entity-Body-Yaw-API.patch b/patches/api/Add-Entity-Body-Yaw-API.patch index bd6bee3823..7012064b9d 100644 --- a/patches/api/Add-Entity-Body-Yaw-API.patch +++ b/patches/api/Add-Entity-Body-Yaw-API.patch @@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + float getYaw(); // Paper end - // Paper Start - Collision API + // Paper start - Collision API diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java diff --git a/patches/api/Allow-Blocks-to-be-accessed-via-a-long-key.patch b/patches/api/Allow-Blocks-to-be-accessed-via-a-long-key.patch index f054ae628f..9fe94e7a13 100644 --- a/patches/api/Allow-Blocks-to-be-accessed-via-a-long-key.patch +++ b/patches/api/Allow-Blocks-to-be-accessed-via-a-long-key.patch @@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return blockLoc; } + -+ // Paper Start ++ // Paper start + /** + * @return The block key for this location's block location. + * @see Block#getBlockKey(int, int, int) @@ -44,7 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public long toBlockKey() { + return Block.getBlockKey(getBlockX(), getBlockY(), getBlockZ()); + } -+ // Paper End ++ // Paper end + /** * @return A new location where X/Y/Z are the center of the block @@ -103,7 +103,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 */ int getZ(); -+ // Paper Start ++ // Paper start + /** + * Returns this block's coordinates packed into a long value. + * Computed via: {@code Block.getBlockKey(this.getX(), this.getY(), this.getZ())} @@ -177,7 +177,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public static int getBlockKeyZ(long packed) { + return (int) ((packed << 10) >> 37); + } -+ // Paper End ++ // Paper end + /** * Gets the Location of the block diff --git a/patches/api/Collision-API.patch b/patches/api/Collision-API.patch index f4133df27f..d7892bb249 100644 --- a/patches/api/Collision-API.patch +++ b/patches/api/Collision-API.patch @@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 boolean isInPowderedSnow(); // Paper end + -+ // Paper Start - Collision API ++ // Paper start - Collision API + /** + * Checks for any collisions with the entity's bounding box at the provided location. + * This will check for any colliding entities (boats, shulkers) / worldborder / blocks. @@ -53,5 +53,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @return collides or not + */ + boolean wouldCollideUsing(@NotNull BoundingBox boundingBox); -+ // Paper End - Collision API ++ // Paper end - Collision API } diff --git a/patches/api/Expand-FallingBlock-API.patch b/patches/api/Expand-FallingBlock-API.patch index 521700384f..b02640ccfe 100644 --- a/patches/api/Expand-FallingBlock-API.patch +++ b/patches/api/Expand-FallingBlock-API.patch @@ -86,7 +86,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 default org.bukkit.Location getSourceLoc() { return this.getOrigin(); } -+ // Paper Start - Auto expire setting ++ // Paper start - Auto expire setting + /** + * Sets if this falling block should expire after: + * - 30 seconds @@ -104,5 +104,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param autoExpires if this behavior should occur + */ + void shouldAutoExpire(boolean autoExpires); -+ // Paper End - Auto expire setting ++ // Paper end - Auto expire setting } diff --git a/patches/api/Folia-scheduler-and-owned-region-API.patch b/patches/api/Folia-scheduler-and-owned-region-API.patch index f25507510f..0628b07c29 100644 --- a/patches/api/Folia-scheduler-and-owned-region-API.patch +++ b/patches/api/Folia-scheduler-and-owned-region-API.patch @@ -775,7 +775,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent */ boolean wouldCollideUsing(@NotNull BoundingBox boundingBox); - // Paper End - Collision API + // Paper end - Collision API + + // Paper start - Folia schedulers + /** diff --git a/patches/api/Freeze-Tick-Lock-API.patch b/patches/api/Freeze-Tick-Lock-API.patch index 4999da4e54..61d529fbe4 100644 --- a/patches/api/Freeze-Tick-Lock-API.patch +++ b/patches/api/Freeze-Tick-Lock-API.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 */ boolean isFrozen(); -+ // Paper Start - Freeze Tick Lock API ++ // Paper start - Freeze Tick Lock API + /** + * Gets if the entity currently has its freeze ticks locked + * to a set amount. @@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param locked prevent vanilla modification or not + */ + void lockFreezeTicks(boolean locked); -+ // Paper End - Freeze Tick Lock API ++ // Paper end - Freeze Tick Lock API + /** * Mark the entity's removal. diff --git a/patches/api/Item-canEntityPickup.patch b/patches/api/Item-canEntityPickup.patch index ec8b71ae5d..fce67c2124 100644 --- a/patches/api/Item-canEntityPickup.patch +++ b/patches/api/Item-canEntityPickup.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Nullable public UUID getThrower(); + -+ // Paper Start ++ // Paper start + /** + * Gets if non-player entities can pick this Item up + * diff --git a/patches/api/Missing-Entity-API.patch b/patches/api/Missing-Entity-API.patch index 19359c1e51..10b7d93383 100644 --- a/patches/api/Missing-Entity-API.patch +++ b/patches/api/Missing-Entity-API.patch @@ -318,7 +318,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } + -+ // Paper Start - More cat api ++ // Paper start - More cat api + /** + * Sets if the cat is lying down. + * This is visual and does not affect the behaviour of the cat. @@ -348,7 +348,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @return head is up + */ + public boolean isHeadUp(); -+ // Paper End - More cat api ++ // Paper end - More cat api } diff --git a/src/main/java/org/bukkit/entity/Chicken.java b/src/main/java/org/bukkit/entity/Chicken.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/patches/api/PlayerPickupItemEvent-setFlyAtPlayer.patch b/patches/api/PlayerPickupItemEvent-setFlyAtPlayer.patch index 71a965b6fc..51830b3d17 100644 --- a/patches/api/PlayerPickupItemEvent-setFlyAtPlayer.patch +++ b/patches/api/PlayerPickupItemEvent-setFlyAtPlayer.patch @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return remaining; } -+ // Paper Start ++ // Paper start + /** + * Set if the item will fly at the player + * <p>Cancelling the event will set this value to false.</p> @@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public boolean getFlyAtPlayer() { + return flyAtPlayer; + } -+ // Paper End ++ // Paper end + @Override public boolean isCancelled() { diff --git a/patches/api/Stinger-API.patch b/patches/api/Stinger-API.patch index 854eeae5c0..55649a4b21 100644 --- a/patches/api/Stinger-API.patch +++ b/patches/api/Stinger-API.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 */ void setArrowsInBody(int count, boolean fireEvent); // Paper -+ // Paper Start - Bee Stinger API ++ // Paper start - Bee Stinger API + /** + * Gets the time in ticks until the next bee stinger leaves the entity's body. + * @@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param count amount of bee stingers in entity's body + */ + public void setBeeStingersInBody(int count); -+ // Paper End - Stinger API ++ // Paper end - Stinger API + /** * Returns the living entity's current maximum no damage ticks. diff --git a/patches/server/API-for-an-entity-s-scoreboard-name.patch b/patches/server/API-for-an-entity-s-scoreboard-name.patch index 88b0f3d0ac..3a24a1e031 100644 --- a/patches/server/API-for-an-entity-s-scoreboard-name.patch +++ b/patches/server/API-for-an-entity-s-scoreboard-name.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return !this.getHandle().level().noCollision(this.getHandle(), aabb); } - // Paper End - Collision API + // Paper end - Collision API + + // Paper start - entity scoreboard name + @Override diff --git a/patches/server/Implement-API-to-get-Material-from-Boats-and-Minecar.patch b/patches/server/API-to-get-Material-from-Boats-and-Minecarts.patch similarity index 97% rename from patches/server/Implement-API-to-get-Material-from-Boats-and-Minecar.patch rename to patches/server/API-to-get-Material-from-Boats-and-Minecarts.patch index 5cf3f135fc..b5b0bcc8e3 100644 --- a/patches/server/Implement-API-to-get-Material-from-Boats-and-Minecar.patch +++ b/patches/server/API-to-get-Material-from-Boats-and-Minecarts.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Madeline Miller <mnmiller1@me.com> Date: Thu, 31 Dec 2020 12:48:19 +1000 -Subject: [PATCH] Implement API to get Material from Boats and Minecarts +Subject: [PATCH] API to get Material from Boats and Minecarts diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java diff --git a/patches/server/Add-API-for-item-entity-health.patch b/patches/server/Add-API-for-item-entity-health.patch index 1cdec0d391..a7f459fcf3 100644 --- a/patches/server/Add-API-for-item-entity-health.patch +++ b/patches/server/Add-API-for-item-entity-health.patch @@ -29,6 +29,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.getHandle().health = health; + } + } - // Paper End + // Paper end @Override diff --git a/patches/server/Add-Alternate-Current-redstone-implementation.patch b/patches/server/Add-Alternate-Current-redstone-implementation.patch index 0518221ef1..e43a3958aa 100644 --- a/patches/server/Add-Alternate-Current-redstone-implementation.patch +++ b/patches/server/Add-Alternate-Current-redstone-implementation.patch @@ -2014,7 +2014,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { public final UUID uuid; public boolean hasPhysicsEvent = true; // Paper - public boolean hasEntityMoveEvent = false; // Paper + public boolean hasEntityMoveEvent = false; // Paper - Add EntityMoveEvent + private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current) public static Throwable getAddToWorldStackTrace(Entity entity) { final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date()); diff --git a/patches/server/Implemented-BlockFailedDispenseEvent.patch b/patches/server/Add-BlockFailedDispenseEvent.patch similarity index 91% rename from patches/server/Implemented-BlockFailedDispenseEvent.patch rename to patches/server/Add-BlockFailedDispenseEvent.patch index 508c374ca7..4466e4fc54 100644 --- a/patches/server/Implemented-BlockFailedDispenseEvent.patch +++ b/patches/server/Add-BlockFailedDispenseEvent.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: TheViperShow <29604693+TheViperShow@users.noreply.github.com> Date: Wed, 22 Apr 2020 09:40:38 +0200 -Subject: [PATCH] Implemented BlockFailedDispenseEvent +Subject: [PATCH] Add BlockFailedDispenseEvent diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java @@ -12,10 +12,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int i = tileentitydispenser.getRandomSlot(world.random); if (i < 0) { -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) { // Paper - BlockFailedDispenseEvent is called here ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) { // Paper - Add BlockFailedDispenseEvent world.levelEvent(1001, pos, 0); world.gameEvent(GameEvent.BLOCK_ACTIVATE, pos, GameEvent.Context.of(tileentitydispenser.getBlockState())); -+ } // Paper ++ } // Paper - Add BlockFailedDispenseEvent } else { ItemStack itemstack = tileentitydispenser.getItem(i); DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack); @@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int i = tileentitydispenser.getRandomSlot(world.random); if (i < 0) { -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) // Paper - BlockFailedDispenseEvent is called here ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) // Paper - Add BlockFailedDispenseEvent world.levelEvent(1001, pos, 0); } else { ItemStack itemstack = tileentitydispenser.getItem(i); diff --git a/patches/server/Implement-BlockPreDispenseEvent.patch b/patches/server/Add-BlockPreDispenseEvent.patch similarity index 95% rename from patches/server/Implement-BlockPreDispenseEvent.patch rename to patches/server/Add-BlockPreDispenseEvent.patch index 52a7607482..17682ef12d 100644 --- a/patches/server/Implement-BlockPreDispenseEvent.patch +++ b/patches/server/Add-BlockPreDispenseEvent.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Madeline Miller <mnmiller1@me.com> Date: Sun, 17 Jan 2021 13:16:09 +1000 -Subject: [PATCH] Implement BlockPreDispenseEvent +Subject: [PATCH] Add BlockPreDispenseEvent diff --git a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack); if (idispensebehavior != DispenseItemBehavior.NOOP) { -+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockPreDispenseEvent(world, pos, itemstack, i)) return; // Paper - BlockPreDispenseEvent is called here ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockPreDispenseEvent(world, pos, itemstack, i)) return; // Paper - Add BlockPreDispenseEvent DispenserBlock.eventFired = false; // CraftBukkit - reset event status tileentitydispenser.setItem(i, idispensebehavior.dispense(sourceblock, itemstack)); } diff --git a/patches/server/add-DragonEggFormEvent.patch b/patches/server/Add-DragonEggFormEvent.patch similarity index 87% rename from patches/server/add-DragonEggFormEvent.patch rename to patches/server/Add-DragonEggFormEvent.patch index d38b1113c8..c07c9723fd 100644 --- a/patches/server/add-DragonEggFormEvent.patch +++ b/patches/server/Add-DragonEggFormEvent.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Trigary <trigary0@gmail.com> Date: Mon, 25 Jan 2021 14:53:57 +0100 -Subject: [PATCH] add DragonEggFormEvent +Subject: [PATCH] Add DragonEggFormEvent diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java @@ -12,24 +12,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.dragonEvent.setVisible(false); this.spawnExitPortal(true); this.spawnNewGateway(); -+ // Paper start - DragonEggFormEvent ++ // Paper start - Add DragonEggFormEvent + 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 ++ // Paper end - Add DragonEggFormEvent + if (this.level.paperConfig().entities.behavior.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - Add toggle for always placing the dragon egg - this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState()); -+ // Paper start - DragonEggFormEvent ++ // Paper start - Add DragonEggFormEvent + // this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState()); + } else { + eggEvent.setCancelled(true); + } + if (eggEvent.callEvent()) { + eggEvent.getNewState().update(true); ++ // Paper end - Add DragonEggFormEvent } -+ // Paper end - DragonEggFormEvent this.previouslyKilled = true; - this.dragonKilled = true; diff --git a/patches/server/Add-Entity-Body-Yaw-API.patch b/patches/server/Add-Entity-Body-Yaw-API.patch index a6ed4f3022..fa4422750b 100644 --- a/patches/server/Add-Entity-Body-Yaw-API.patch +++ b/patches/server/Add-Entity-Body-Yaw-API.patch @@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return this.entity.getBukkitYaw(); + } // Paper end - // Paper Start - Collision API + // Paper start - Collision API @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/patches/server/Add-EntityLoadCrossbowEvent.patch b/patches/server/Add-EntityLoadCrossbowEvent.patch index b361bbba92..7bc9ae4030 100644 --- a/patches/server/Add-EntityLoadCrossbowEvent.patch +++ b/patches/server/Add-EntityLoadCrossbowEvent.patch @@ -13,14 +13,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 float f = CrossbowItem.getPowerForTime(j, stack); - if (f >= 1.0F && !CrossbowItem.isCharged(stack) && CrossbowItem.tryLoadProjectiles(user, stack)) { -+ // Paper start - EntityLoadCrossbowEvent ++ // Paper start - Add EntityLoadCrossbowEvent + if (f >= 1.0F && !CrossbowItem.isCharged(stack) /*&& CrossbowItem.tryLoadProjectiles(entityliving, itemstack)*/) { + final io.papermc.paper.event.entity.EntityLoadCrossbowEvent event = new io.papermc.paper.event.entity.EntityLoadCrossbowEvent(user.getBukkitLivingEntity(), stack.asBukkitMirror(), user.getUsedItemHand() == InteractionHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND); + if (!event.callEvent() || !tryLoadProjectiles(user, stack, event.shouldConsumeItem())) { + if (user instanceof ServerPlayer player) player.containerMenu.sendAllDataToRemote(); + return; + } -+ // Paper end ++ // Paper end - Add EntityLoadCrossbowEvent CrossbowItem.setCharged(stack, true); SoundSource soundcategory = user instanceof Player ? SoundSource.PLAYERS : SoundSource.HOSTILE; @@ -28,17 +28,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } -+ @io.papermc.paper.annotation.DoNotUse // Paper ++ @io.papermc.paper.annotation.DoNotUse // Paper - Add EntityLoadCrossbowEvent private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack crossbow) { -+ // Paper start ++ // Paper start - Add EntityLoadCrossbowEvent + return CrossbowItem.tryLoadProjectiles(shooter, crossbow, true); + } + private static boolean tryLoadProjectiles(LivingEntity shooter, ItemStack crossbow, boolean consume) { -+ // Paper end ++ // Paper end - Add EntityLoadCrossbowEvent int i = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.MULTISHOT, crossbow); int j = i == 0 ? 1 : 3; - boolean flag = shooter instanceof Player && ((Player) shooter).getAbilities().instabuild; -+ boolean flag = !consume || shooter instanceof Player && ((Player) shooter).getAbilities().instabuild; // Paper - add consume ++ boolean flag = !consume || shooter instanceof Player && ((Player) shooter).getAbilities().instabuild; // Paper - Add EntityLoadCrossbowEvent ItemStack itemstack1 = shooter.getProjectile(crossbow); ItemStack itemstack2 = itemstack1.copy(); diff --git a/patches/server/EntityMoveEvent.patch b/patches/server/Add-EntityMoveEvent.patch similarity index 90% rename from patches/server/EntityMoveEvent.patch rename to patches/server/Add-EntityMoveEvent.patch index d3fbdef86e..67baa75558 100644 --- a/patches/server/EntityMoveEvent.patch +++ b/patches/server/Add-EntityMoveEvent.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: William Blake Galbreath <Blake.Galbreath@GMail.com> Date: Tue, 11 Feb 2020 21:56:48 -0600 -Subject: [PATCH] EntityMoveEvent +Subject: [PATCH] Add EntityMoveEvent diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 while (iterator.hasNext()) { ServerLevel worldserver = (ServerLevel) iterator.next(); worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper -+ worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper ++ worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent this.profiler.push(() -> { return worldserver + " " + worldserver.dimension().location(); @@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public final LevelStorageSource.LevelStorageAccess convertable; public final UUID uuid; public boolean hasPhysicsEvent = true; // Paper -+ public boolean hasEntityMoveEvent = false; // Paper ++ public boolean hasEntityMoveEvent = false; // Paper - Add EntityMoveEvent public static Throwable getAddToWorldStackTrace(Entity entity) { final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date()); io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(thr); @@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.pushEntities(); this.level().getProfiler().pop(); -+ // Paper start ++ // Paper start - Add EntityMoveEvent + 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); @@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + } -+ // Paper end ++ // Paper end - Add EntityMoveEvent if (!this.level().isClientSide && this.isSensitiveToWater() && this.isInWaterRainOrBubble()) { this.hurt(this.damageSources().drown(), 1.0F); } diff --git a/patches/server/Add-PlayerArmSwingEvent.patch b/patches/server/Add-PlayerArmSwingEvent.patch index 0d3b0fd870..c4195b2c65 100644 --- a/patches/server/Add-PlayerArmSwingEvent.patch +++ b/patches/server/Add-PlayerArmSwingEvent.patch @@ -9,7 +9,7 @@ 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 extends ServerCommonPacketListenerImpl - } // Paper end + } // Paper end - Call interact event // Arm swing animation - PlayerAnimationEvent event = new PlayerAnimationEvent(this.getCraftPlayer(), (packet.getHand() == InteractionHand.MAIN_HAND) ? PlayerAnimationType.ARM_SWING : PlayerAnimationType.OFF_ARM_SWING); diff --git a/patches/server/Added-firing-of-PlayerChangeBeaconEffectEvent.patch b/patches/server/Add-PlayerChangeBeaconEffectEvent.patch similarity index 89% rename from patches/server/Added-firing-of-PlayerChangeBeaconEffectEvent.patch rename to patches/server/Add-PlayerChangeBeaconEffectEvent.patch index 9265885c69..e1cd8c774d 100644 --- a/patches/server/Added-firing-of-PlayerChangeBeaconEffectEvent.patch +++ b/patches/server/Add-PlayerChangeBeaconEffectEvent.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jake Potrebic <jake.m.potrebic@gmail.com> Date: Wed, 24 Jun 2020 15:14:51 -0600 -Subject: [PATCH] Added firing of PlayerChangeBeaconEffectEvent +Subject: [PATCH] Add PlayerChangeBeaconEffectEvent diff --git a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java @@ -12,29 +12,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public MobEffect getSecondaryEffect() { return BeaconMenu.decodeEffect(this.beaconData.get(2)); } -+ // Paper start ++ // Paper start - Add PlayerChangeBeaconEffectEvent + private static @Nullable org.bukkit.potion.PotionEffectType convert(Optional<MobEffect> effect) { + return effect.flatMap(net.minecraft.core.registries.BuiltInRegistries.MOB_EFFECT::getResourceKey).map(key -> { + return org.bukkit.potion.PotionEffectType.getByKey(org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(key.location())); + }).orElse(null); + } -+ // Paper end ++ // Paper end - Add PlayerChangeBeaconEffectEvent public void updateEffects(Optional<MobEffect> primary, Optional<MobEffect> secondary) { if (this.paymentSlot.hasItem()) { - this.beaconData.set(1, BeaconMenu.encodeEffect((MobEffect) primary.orElse(null))); // CraftBukkit - decompile error - this.beaconData.set(2, BeaconMenu.encodeEffect((MobEffect) secondary.orElse(null))); // CraftBukkit - decompile error -+ // Paper start ++ // Paper start - Add PlayerChangeBeaconEffectEvent + io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent event = new io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent((org.bukkit.entity.Player) this.player.player.getBukkitEntity(), convert(primary), convert(secondary), this.access.getLocation().getBlock()); + if (event.callEvent()) { + this.beaconData.set(1, BeaconMenu.encodeEffect(event.getPrimary() == null ? null : org.bukkit.craftbukkit.potion.CraftPotionEffectType.bukkitToMinecraft(event.getPrimary()))); + this.beaconData.set(2, BeaconMenu.encodeEffect(event.getSecondary() == null ? null : org.bukkit.craftbukkit.potion.CraftPotionEffectType.bukkitToMinecraft(event.getSecondary()))); + if (event.willConsumeItem()) { -+ // Paper end this.paymentSlot.remove(1); + } this.access.execute(Level::blockEntityChanged); -+ } // Paper end ++ } // Paper end - Add PlayerChangeBeaconEffectEvent } } diff --git a/patches/server/Implement-PlayerFlowerPotManipulateEvent.patch b/patches/server/Add-PlayerFlowerPotManipulateEvent.patch similarity index 91% rename from patches/server/Implement-PlayerFlowerPotManipulateEvent.patch rename to patches/server/Add-PlayerFlowerPotManipulateEvent.patch index a3b0433659..0482075f4f 100644 --- a/patches/server/Implement-PlayerFlowerPotManipulateEvent.patch +++ b/patches/server/Add-PlayerFlowerPotManipulateEvent.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MisterVector <whizkid3000@hotmail.com> Date: Tue, 13 Aug 2019 19:45:06 -0700 -Subject: [PATCH] Implement PlayerFlowerPotManipulateEvent +Subject: [PATCH] Add PlayerFlowerPotManipulateEvent diff --git a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 boolean bl = blockState.is(Blocks.AIR); boolean bl2 = this.isEmpty(); if (bl != bl2) { -+ // Paper start ++ // Paper start - Add PlayerFlowerPotManipulateEvent + org.bukkit.entity.Player player1 = (org.bukkit.entity.Player) player.getBukkitEntity(); + boolean placing = bl2; + org.bukkit.block.Block bukkitblock = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos); @@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + return InteractionResult.PASS; + } -+ // Paper end ++ // Paper end - Add PlayerFlowerPotManipulateEvent if (bl2) { world.setBlock(pos, blockState, 3); player.awardStat(Stats.POT_FLOWER); diff --git a/patches/server/Added-PlayerLecternPageChangeEvent.patch b/patches/server/Add-PlayerLecternPageChangeEvent.patch similarity index 87% rename from patches/server/Added-PlayerLecternPageChangeEvent.patch rename to patches/server/Add-PlayerLecternPageChangeEvent.patch index 97329fa653..d60361e182 100644 --- a/patches/server/Added-PlayerLecternPageChangeEvent.patch +++ b/patches/server/Add-PlayerLecternPageChangeEvent.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jake Potrebic <jake.m.potrebic@gmail.com> Date: Mon, 23 Nov 2020 12:58:51 -0800 -Subject: [PATCH] Added PlayerLecternPageChangeEvent +Subject: [PATCH] Add PlayerLecternPageChangeEvent diff --git a/src/main/java/net/minecraft/world/inventory/LecternMenu.java b/src/main/java/net/minecraft/world/inventory/LecternMenu.java @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) { int j; -+ io.papermc.paper.event.player.PlayerLecternPageChangeEvent playerLecternPageChangeEvent; CraftInventoryLectern bukkitView; // Paper ++ io.papermc.paper.event.player.PlayerLecternPageChangeEvent playerLecternPageChangeEvent; CraftInventoryLectern bukkitView; // Paper - Add PlayerLecternPageChangeEvent if (id >= 100) { j = id - 100; @@ -21,26 +21,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 case 1: j = this.lecternData.get(0); - this.setData(0, j - 1); -+ // Paper start ++ // Paper start - Add PlayerLecternPageChangeEvent + bukkitView = (CraftInventoryLectern) getBukkitView().getTopInventory(); + playerLecternPageChangeEvent = new io.papermc.paper.event.player.PlayerLecternPageChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), bukkitView.getHolder(), bukkitView.getBook(), io.papermc.paper.event.player.PlayerLecternPageChangeEvent.PageChangeDirection.LEFT, j, j - 1); + if (!playerLecternPageChangeEvent.callEvent()) { + return false; + } + this.setData(0, playerLecternPageChangeEvent.getNewPage()); -+ // Paper end ++ // Paper end - Add PlayerLecternPageChangeEvent return true; case 2: j = this.lecternData.get(0); - this.setData(0, j + 1); -+ // Paper start ++ // Paper start - Add PlayerLecternPageChangeEvent + bukkitView = (CraftInventoryLectern) getBukkitView().getTopInventory(); + playerLecternPageChangeEvent = new io.papermc.paper.event.player.PlayerLecternPageChangeEvent((org.bukkit.entity.Player) player.getBukkitEntity(), bukkitView.getHolder(), bukkitView.getBook(), io.papermc.paper.event.player.PlayerLecternPageChangeEvent.PageChangeDirection.RIGHT, j, j + 1); + if (!playerLecternPageChangeEvent.callEvent()) { + return false; + } + this.setData(0, playerLecternPageChangeEvent.getNewPage()); -+ // Paper end ++ // Paper end - Add PlayerLecternPageChangeEvent return true; case 3: if (!player.mayBuild()) { diff --git a/patches/server/Added-PlayerLoomPatternSelectEvent.patch b/patches/server/Add-PlayerLoomPatternSelectEvent.patch similarity index 94% rename from patches/server/Added-PlayerLoomPatternSelectEvent.patch rename to patches/server/Add-PlayerLoomPatternSelectEvent.patch index 71e55dae76..9ff8a8d770 100644 --- a/patches/server/Added-PlayerLoomPatternSelectEvent.patch +++ b/patches/server/Add-PlayerLoomPatternSelectEvent.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jake Potrebic <jake.m.potrebic@gmail.com> Date: Wed, 25 Nov 2020 16:33:27 -0800 -Subject: [PATCH] Added PlayerLoomPatternSelectEvent +Subject: [PATCH] Add PlayerLoomPatternSelectEvent diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java @@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (id >= 0 && id < this.selectablePatterns.size()) { - this.selectedBannerPatternIndex.set(id); - this.setupResultSlot((Holder) this.selectablePatterns.get(id)); -+ // Paper start ++ // Paper start - Add PlayerLoomPatternSelectEvent + int selectablePatternIndex = 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(this.selectablePatterns.get(selectablePatternIndex).value().getHashname())); + if (!event.callEvent()) { @@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + ((Player) player.getBukkitEntity()).updateInventory(); + this.selectedBannerPatternIndex.set(selectablePatternIndex); + this.setupResultSlot(java.util.Objects.requireNonNull(selectedPattern, "selectedPattern was null, this is unexpected")); -+ // Paper end ++ // Paper end - Add PlayerLoomPatternSelectEvent return true; } else { return false; diff --git a/patches/server/added-PlayerNameEntityEvent.patch b/patches/server/Add-PlayerNameEntityEvent.patch similarity index 91% rename from patches/server/added-PlayerNameEntityEvent.patch rename to patches/server/Add-PlayerNameEntityEvent.patch index 049edd15fa..be82062a8f 100644 --- a/patches/server/added-PlayerNameEntityEvent.patch +++ b/patches/server/Add-PlayerNameEntityEvent.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jake Potrebic <jake.m.potrebic@gmail.com> Date: Sun, 5 Jul 2020 00:33:54 -0700 -Subject: [PATCH] added PlayerNameEntityEvent +Subject: [PATCH] Add PlayerNameEntityEvent diff --git a/src/main/java/net/minecraft/world/item/NameTagItem.java b/src/main/java/net/minecraft/world/item/NameTagItem.java @@ -15,14 +15,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - entity.setCustomName(stack.getHoverName()); - if (entity instanceof Mob) { - ((Mob)entity).setPersistenceRequired(); -+ // Paper start ++ // Paper start - Add PlayerNameEntityEvent + 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 ? io.papermc.paper.adventure.PaperAdventure.asVanilla(event.getName()) : null); + if (event.isPersistent() && newEntityLiving instanceof Mob) { + ((Mob) newEntityLiving).setPersistenceRequired(); -+ // Paper end ++ // Paper end - Add PlayerNameEntityEvent } stack.shrink(1); diff --git a/patches/server/Added-PlayerStonecutterRecipeSelectEvent.patch b/patches/server/Add-PlayerStonecutterRecipeSelectEvent.patch similarity index 92% rename from patches/server/Added-PlayerStonecutterRecipeSelectEvent.patch rename to patches/server/Add-PlayerStonecutterRecipeSelectEvent.patch index 23b072daed..b268345965 100644 --- a/patches/server/Added-PlayerStonecutterRecipeSelectEvent.patch +++ b/patches/server/Add-PlayerStonecutterRecipeSelectEvent.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jake Potrebic <jake.m.potrebic@gmail.com> Date: Fri, 27 Nov 2020 17:14:27 -0800 -Subject: [PATCH] Added PlayerStonecutterRecipeSelectEvent +Subject: [PATCH] Add PlayerStonecutterRecipeSelectEvent Co-Authored-By: MiniDigger | Martin <admin@minidigger.dev> @@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public StonecutterMenu(int syncId, Inventory playerInventory, final ContainerLevelAccess context) { super(MenuType.STONECUTTER, syncId); - this.selectedRecipeIndex = DataSlot.standalone(); -+ this.selectedRecipeIndex = DataSlot.shared(new int[1], 0); // Paper - allow replication ++ this.selectedRecipeIndex = DataSlot.shared(new int[1], 0); // Paper - Add PlayerStonecutterRecipeSelectEvent this.recipes = Lists.newArrayList(); this.input = ItemStack.EMPTY; this.slotUpdateListener = () -> { @@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) { if (this.isValidRecipeIndex(id)) { - this.selectedRecipeIndex.set(id); -+ // Paper start ++ // Paper start - Add PlayerStonecutterRecipeSelectEvent + int recipeIndex = id; + this.selectedRecipeIndex.set(recipeIndex); + this.selectedRecipeIndex.checkAndClearUpdateFlag(); // mark as changed @@ -45,7 +45,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + ((Player) player.getBukkitEntity()).updateInventory(); + this.selectedRecipeIndex.set(recipeIndex); // set new index, so that listeners can read it -+ // Paper end ++ // Paper end - Add PlayerStonecutterRecipeSelectEvent this.setupResultSlot(); } diff --git a/patches/server/Added-ServerResourcesReloadedEvent.patch b/patches/server/Add-ServerResourcesReloadedEvent.patch similarity index 89% rename from patches/server/Added-ServerResourcesReloadedEvent.patch rename to patches/server/Add-ServerResourcesReloadedEvent.patch index 1aa1b75d8c..e1c2c054f5 100644 --- a/patches/server/Added-ServerResourcesReloadedEvent.patch +++ b/patches/server/Add-ServerResourcesReloadedEvent.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jake Potrebic <jake.m.potrebic@gmail.com> Date: Wed, 2 Dec 2020 20:04:01 -0800 -Subject: [PATCH] Added ServerResourcesReloadedEvent +Subject: [PATCH] Add ServerResourcesReloadedEvent diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -12,13 +12,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return this.functionManager; } -+ // Paper start - add cause ++ // Paper start - Add ServerResourcesReloadedEvent + @Deprecated @io.papermc.paper.annotation.DoNotUse public CompletableFuture<Void> reloadResources(Collection<String> dataPacks) { + return this.reloadResources(dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.PLUGIN); + } + public CompletableFuture<Void> reloadResources(Collection<String> dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause cause) { -+ // Paper end ++ // Paper end - Add ServerResourcesReloadedEvent RegistryAccess.Frozen iregistrycustom_dimension = this.registries.getAccessForLoading(RegistryLayer.RELOADABLE); CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> { Stream<String> stream = dataPacks.stream(); // CraftBukkit - decompile error @@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary()); this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager); org.bukkit.craftbukkit.block.data.CraftBlockData.reloadCache(); // Paper - cache block data strings, they can be defined by datapacks so refresh it here -+ new io.papermc.paper.event.server.ServerResourcesReloadedEvent(cause).callEvent(); // Paper - fire after everything has been reloaded ++ new io.papermc.paper.event.server.ServerResourcesReloadedEvent(cause).callEvent(); // Paper - Add ServerResourcesReloadedEvent; fire after everything has been reloaded }, this); if (this.isSameThread()) { @@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static void reloadPacks(Collection<String> dataPacks, CommandSourceStack source) { - source.getServer().reloadResources(dataPacks).exceptionally((throwable) -> { -+ source.getServer().reloadResources(dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.COMMAND).exceptionally((throwable) -> { ++ source.getServer().reloadResources(dataPacks, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.COMMAND).exceptionally((throwable) -> { // Paper - Add ServerResourcesReloadedEvent ReloadCommand.LOGGER.warn("Failed to execute reload", throwable); source.sendFailure(Component.translatable("commands.reload.failure")); return null; @@ -48,7 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Collection<String> collection = resourcepackrepository.getSelectedIds(); Collection<String> collection1 = ReloadCommand.discoverNewPacks(resourcepackrepository, savedata, collection); - minecraftserver.reloadResources(collection1); -+ minecraftserver.reloadResources(collection1, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.PLUGIN); // Paper ++ minecraftserver.reloadResources(collection1, io.papermc.paper.event.server.ServerResourcesReloadedEvent.Cause.PLUGIN); // Paper - Add ServerResourcesReloadedEvent } // CraftBukkit end diff --git a/patches/server/Added-WorldGameRuleChangeEvent.patch b/patches/server/Add-WorldGameRuleChangeEvent.patch similarity index 85% rename from patches/server/Added-WorldGameRuleChangeEvent.patch rename to patches/server/Add-WorldGameRuleChangeEvent.patch index 28625d738f..ca5bfee4d7 100644 --- a/patches/server/Added-WorldGameRuleChangeEvent.patch +++ b/patches/server/Add-WorldGameRuleChangeEvent.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jake Potrebic <jake.m.potrebic@gmail.com> Date: Sun, 20 Dec 2020 16:41:44 -0800 -Subject: [PATCH] Added WorldGameRuleChangeEvent +Subject: [PATCH] Add WorldGameRuleChangeEvent diff --git a/src/main/java/net/minecraft/server/commands/GameRuleCommand.java b/src/main/java/net/minecraft/server/commands/GameRuleCommand.java @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 T t0 = commandlistenerwrapper.getLevel().getGameRules().getRule(key); // CraftBukkit - t0.setFromArgument(context, "value"); -+ t0.setFromArgument(context, "value", key); // Paper ++ t0.setFromArgument(context, "value", key); // Paper - Add WorldGameRuleChangeEvent commandlistenerwrapper.sendSuccess(() -> { return Component.translatable("commands.gamerule.set", key.getId(), t0.toString()); }, true); @@ -26,12 +26,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - protected abstract void updateFromArgument(CommandContext<CommandSourceStack> context, String name); -+ protected abstract void updateFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey); // Paper ++ protected abstract void updateFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey); // Paper - Add WorldGameRuleChangeEvent - public void setFromArgument(CommandContext<CommandSourceStack> context, String name) { - this.updateFromArgument(context, name); -+ public void setFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey) { // Paper -+ this.updateFromArgument(context, name, gameRuleKey); // Paper ++ public void setFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey) { // Paper - Add WorldGameRuleChangeEvent ++ this.updateFromArgument(context, name, gameRuleKey); // Paper - Add WorldGameRuleChangeEvent this.onChanged(((CommandSourceStack) context.getSource()).getServer()); } @@ -41,11 +41,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override - protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name) { - this.value = BoolArgumentType.getBool(context, name); -+ protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<BooleanValue> gameRuleKey) { // Paper start ++ protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<BooleanValue> gameRuleKey) { // Paper start - Add WorldGameRuleChangeEvent + io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(context.getSource().getBukkitWorld(), context.getSource().getBukkitSender(), (org.bukkit.GameRule<Boolean>) org.bukkit.GameRule.getByName(gameRuleKey.toString()), String.valueOf(BoolArgumentType.getBool(context, name))); + if (!event.callEvent()) return; + this.value = Boolean.parseBoolean(event.getValue()); -+ // Paper end ++ // Paper end - Add WorldGameRuleChangeEvent } public boolean get() { @@ -55,11 +55,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override - protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name) { - this.value = IntegerArgumentType.getInteger(context, name); -+ protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<IntegerValue> gameRuleKey) { // Paper start ++ protected void updateFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<IntegerValue> gameRuleKey) { // Paper start - Add WorldGameRuleChangeEvent + io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(context.getSource().getBukkitWorld(), context.getSource().getBukkitSender(), (org.bukkit.GameRule<Integer>) org.bukkit.GameRule.getByName(gameRuleKey.toString()), String.valueOf(IntegerArgumentType.getInteger(context, name))); + if (!event.callEvent()) return; + this.value = Integer.parseInt(event.getValue()); -+ // Paper end ++ // Paper end - Add WorldGameRuleChangeEvent } public int get() { @@ -71,14 +71,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!this.isGameRule(rule)) return false; -+ // Paper start ++ // Paper start - Add WorldGameRuleChangeEvent + GameRule<?> gameRule = GameRule.getByName(rule); + io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(this, null, gameRule, value); + if (!event.callEvent()) return false; -+ // Paper end ++ // Paper end - Add WorldGameRuleChangeEvent GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule)); - handle.deserialize(value); -+ handle.deserialize(event.getValue()); // Paper ++ handle.deserialize(event.getValue()); // Paper - Add WorldGameRuleChangeEvent handle.onChanged(this.getHandle().getServer()); return true; } @@ -86,13 +86,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!this.isGameRule(rule.getName())) return false; -+ // Paper start ++ // Paper start - Add WorldGameRuleChangeEvent + io.papermc.paper.event.world.WorldGameRuleChangeEvent event = new io.papermc.paper.event.world.WorldGameRuleChangeEvent(this, null, rule, String.valueOf(newValue)); + if (!event.callEvent()) return false; -+ // Paper end ++ // Paper end - Add WorldGameRuleChangeEvent GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule.getName())); - handle.deserialize(newValue.toString()); -+ handle.deserialize(event.getValue()); // Paper ++ handle.deserialize(event.getValue()); // Paper - Add WorldGameRuleChangeEvent handle.onChanged(this.getHandle().getServer()); return true; } diff --git a/patches/server/Add-configurable-height-for-slime-spawn.patch b/patches/server/Add-configurable-height-for-slime-spawn.patch index 77447dd985..800e6348ae 100644 --- a/patches/server/Add-configurable-height-for-slime-spawn.patch +++ b/patches/server/Add-configurable-height-for-slime-spawn.patch @@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - Replace rules for Height in Slime Chunks + final double maxHeightSlimeChunk = world.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.slimeChunk.maximum; + if (random.nextInt(10) == 0 && flag && pos.getY() < maxHeightSlimeChunk) { -+ // Paper end - Replace rules for Height in Swamp Biome ++ // Paper end - Replace rules for Height in Slime Chunks return checkMobSpawnRules(type, world, spawnReason, pos, random); } } diff --git a/patches/server/Add-recipe-to-cook-events.patch b/patches/server/Add-recipe-to-cook-events.patch index e5f38005ab..381ea534c0 100644 --- a/patches/server/Add-recipe-to-cook-events.patch +++ b/patches/server/Add-recipe-to-cook-events.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1); - FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(CraftBlock.at(world, blockposition), source, result); -+ FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(CraftBlock.at(world, blockposition), source, result, (org.bukkit.inventory.CookingRecipe<?>) recipeholder.toBukkitRecipe()); // Paper ++ FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(CraftBlock.at(world, blockposition), source, result, (org.bukkit.inventory.CookingRecipe<?>) recipeholder.toBukkitRecipe()); // Paper - Add recipe to cook events world.getCraftServer().getPluginManager().callEvent(furnaceSmeltEvent); if (furnaceSmeltEvent.isCancelled()) { @@ -26,20 +26,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (campfire.cookingProgress[i] >= campfire.cookingTime[i]) { SimpleContainer inventorysubcontainer = new SimpleContainer(new ItemStack[]{itemstack}); - ItemStack itemstack1 = (ItemStack) campfire.quickCheck.getRecipeFor(inventorysubcontainer, world).map((recipeholder) -> { -- return ((CampfireCookingRecipe) recipeholder.value()).assemble(inventorysubcontainer, world.registryAccess()); -+ Optional<RecipeHolder<CampfireCookingRecipe>> recipeHolderOptional = campfire.quickCheck.getRecipeFor( inventorysubcontainer, world); ++ // Paper start - Add recipe to cook events; re-use recipeHolderOptional below ++ Optional<RecipeHolder<CampfireCookingRecipe>> recipeHolderOptional = campfire.quickCheck.getRecipeFor(inventorysubcontainer, world); + ItemStack itemstack1 = (ItemStack) recipeHolderOptional.map((recipeholder) -> { -+ // Paper end -+ return recipeholder.value().assemble(inventorysubcontainer, world.registryAccess()); ++ // Paper end - Add recipe to cook events + return ((CampfireCookingRecipe) recipeholder.value()).assemble(inventorysubcontainer, world.registryAccess()); }).orElse(itemstack); - if (itemstack1.isItemEnabled(world.enabledFeatures())) { @@ -0,0 +0,0 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { CraftItemStack source = CraftItemStack.asCraftMirror(itemstack); org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1); - BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, pos), source, result); -+ BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, pos), source, result, (org.bukkit.inventory.CookingRecipe<?>) recipeHolderOptional.map(RecipeHolder::toBukkitRecipe).orElse(null)); // Paper ++ BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, pos), source, result, (org.bukkit.inventory.CookingRecipe<?>) recipeHolderOptional.map(RecipeHolder::toBukkitRecipe).orElse(null)); // Paper - Add recipe to cook events world.getCraftServer().getPluginManager().callEvent(blockCookEvent); if (blockCookEvent.isCancelled()) { diff --git a/patches/server/Add-sendOpLevel-API.patch b/patches/server/Add-sendOpLevel-API.patch index fbd590708e..052fde1631 100644 --- a/patches/server/Add-sendOpLevel-API.patch +++ b/patches/server/Add-sendOpLevel-API.patch @@ -12,11 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) { -+ // Paper start - add recalculatePermissions parameter ++ // Paper start - Add sendOpLevel API + this.sendPlayerPermissionLevel(player, permissionLevel, true); + } + public void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel, boolean recalculatePermissions) { -+ // Paper end ++ // Paper end - Add sendOpLevel API if (player.connection != null) { byte b0; @@ -24,10 +24,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 player.connection.send(new ClientboundEntityEventPacket(player, b0)); } -+ if (recalculatePermissions) { // Paper ++ if (recalculatePermissions) { // Paper - Add sendOpLevel API player.getBukkitEntity().recalculatePermissions(); // CraftBukkit this.server.getCommands().sendCommands(player); -+ } // Paper ++ } // Paper - Add sendOpLevel API } public boolean isWhiteListed(GameProfile profile) { @@ -39,14 +39,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // Paper end -+ // Paper start - sendOpLevel API ++ // Paper start - Add sendOpLevel API + @Override + public void sendOpLevel(byte level) { + Preconditions.checkArgument(level >= 0 && level <= 4, "Level must be within [0, 4]"); + + this.getHandle().getServer().getPlayerList().sendPlayerPermissionLevel(this.getHandle(), level, false); + } -+ // Paper end - sendOpLevel API ++ // Paper end - Add sendOpLevel API + @Override public void setCompassTarget(Location loc) { diff --git a/patches/server/Add-toggle-for-always-placing-the-dragon-egg.patch b/patches/server/Add-toggle-for-always-placing-the-dragon-egg.patch index 54a379467d..e135b63a54 100644 --- a/patches/server/Add-toggle-for-always-placing-the-dragon-egg.patch +++ b/patches/server/Add-toggle-for-always-placing-the-dragon-egg.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.spawnExitPortal(true); this.spawnNewGateway(); - if (!this.previouslyKilled) { -+ if (this.level.paperConfig().entities.behavior.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg ++ if (this.level.paperConfig().entities.behavior.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - Add toggle for always placing the dragon egg this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState()); } diff --git a/patches/server/Added-world-settings-for-mobs-picking-up-loot.patch b/patches/server/Add-world-settings-for-mobs-picking-up-loot.patch similarity index 92% rename from patches/server/Added-world-settings-for-mobs-picking-up-loot.patch rename to patches/server/Add-world-settings-for-mobs-picking-up-loot.patch index 88cc7c57ca..6c759e5aa8 100644 --- a/patches/server/Added-world-settings-for-mobs-picking-up-loot.patch +++ b/patches/server/Add-world-settings-for-mobs-picking-up-loot.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jake Potrebic <jake.m.potrebic@gmail.com> Date: Sat, 28 Nov 2020 18:43:52 -0800 -Subject: [PATCH] Added world settings for mobs picking up loot +Subject: [PATCH] Add world settings for mobs picking up loot diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.populateDefaultEquipmentEnchantments(randomsource, difficulty); this.reassessWeaponGoal(); - this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); -+ this.setCanPickUpLoot(this.level().paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.skeletons || randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); // Paper ++ this.setCanPickUpLoot(this.level().paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.skeletons || randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); // Paper - Add world settings for mobs picking up loot if (this.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) { LocalDate localdate = LocalDate.now(); int i = localdate.get(ChronoField.DAY_OF_MONTH); @@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 float f = difficulty.getSpecialMultiplier(); - this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * f); -+ this.setCanPickUpLoot(this.level().paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.zombies || randomsource.nextFloat() < 0.55F * f); // Paper ++ this.setCanPickUpLoot(this.level().paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.zombies || randomsource.nextFloat() < 0.55F * f); // Paper - Add world settings for mobs picking up loot if (object == null) { object = new Zombie.ZombieGroupData(Zombie.getSpawnAsBabyOdds(randomsource), true); } diff --git a/patches/server/Add-worldborder-events.patch b/patches/server/Add-worldborder-events.patch index c5ac70663f..c28b30cc73 100644 --- a/patches/server/Add-worldborder-events.patch +++ b/patches/server/Add-worldborder-events.patch @@ -12,14 +12,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public void setCenter(double x, double z) { -+ // Paper start ++ // Paper start - Add worldborder events + if (this.world != null) { + io.papermc.paper.event.world.border.WorldBorderCenterChangeEvent event = new io.papermc.paper.event.world.border.WorldBorderCenterChangeEvent(world.getWorld(), world.getWorld().getWorldBorder(), new org.bukkit.Location(world.getWorld(), this.getCenterX(), 0, this.getCenterZ()), new org.bukkit.Location(world.getWorld(), x, 0, z)); + if (!event.callEvent()) return; + x = event.getNewCenter().getX(); + z = event.getNewCenter().getZ(); + } -+ // Paper end ++ // Paper end - Add worldborder events this.centerX = x; this.centerZ = z; this.extent.onCenterChange(); @@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public void setSize(double size) { -+ // Paper start ++ // Paper start - Add worldborder events + if (this.world != null) { + io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent event = new io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent(world.getWorld(), world.getWorld().getWorldBorder(), io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent.Type.INSTANT_MOVE, getSize(), size, 0); + if (!event.callEvent()) return; @@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + size = event.getNewSize(); + } -+ // Paper end ++ // Paper end - Add worldborder events this.extent = new WorldBorder.StaticBorderExtent(size); Iterator iterator = this.getListeners().iterator(); @@ -45,7 +45,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public void lerpSizeBetween(double fromSize, double toSize, long time) { -+ // Paper start ++ // Paper start - Add worldborder events + if (this.world != null) { + io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent.Type type; + if (fromSize == toSize) { // new size = old size @@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + toSize = event.getNewSize(); + time = event.getDuration(); + } -+ // Paper end ++ // Paper end - Add worldborder events this.extent = (WorldBorder.BorderExtent) (fromSize == toSize ? new WorldBorder.StaticBorderExtent(toSize) : new WorldBorder.MovingBorderExtent(fromSize, toSize, time)); Iterator iterator = this.getListeners().iterator(); @@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public WorldBorder.BorderExtent update() { -+ if (world != null && this.getLerpRemainingTime() <= 0L) new io.papermc.paper.event.world.border.WorldBorderBoundsChangeFinishEvent(world.getWorld(), world.getWorld().getWorldBorder(), this.from, this.to, this.lerpDuration).callEvent(); // Paper ++ if (world != null && this.getLerpRemainingTime() <= 0L) new io.papermc.paper.event.world.border.WorldBorderBoundsChangeFinishEvent(world.getWorld(), world.getWorld().getWorldBorder(), this.from, this.to, this.lerpDuration).callEvent(); // Paper - Add worldborder events return (WorldBorder.BorderExtent) (this.getLerpRemainingTime() <= 0L ? WorldBorder.this.new StaticBorderExtent(this.to) : this); } diff --git a/patches/server/Allow-Saving-of-Oversized-Chunks.patch b/patches/server/Allow-Saving-of-Oversized-Chunks.patch index e56b109ec3..d0c38cce8a 100644 --- a/patches/server/Allow-Saving-of-Oversized-Chunks.patch +++ b/patches/server/Allow-Saving-of-Oversized-Chunks.patch @@ -211,7 +211,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ // Paper End ++ // Paper end + @Nullable public CompoundTag read(ChunkPos pos) throws IOException { diff --git a/patches/server/Allow-adding-items-to-BlockDropItemEvent.patch b/patches/server/Allow-adding-items-to-BlockDropItemEvent.patch index 7f5a875ace..cbdcf34bae 100644 --- a/patches/server/Allow-adding-items-to-BlockDropItemEvent.patch +++ b/patches/server/Allow-adding-items-to-BlockDropItemEvent.patch @@ -13,19 +13,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static void handleBlockDropItemEvent(Block block, BlockState state, ServerPlayer player, List<ItemEntity> items) { - BlockDropItemEvent event = new BlockDropItemEvent(block, state, player.getBukkitEntity(), Lists.transform(items, (item) -> (org.bukkit.entity.Item) item.getBukkitEntity())); -+ // Paper start ++ // Paper start - Allow adding items to BlockDropItemEvent + List<Item> list = new ArrayList<>(); + for (ItemEntity item : items) { + list.add((Item) item.getBukkitEntity()); + } + BlockDropItemEvent event = new BlockDropItemEvent(block, state, player.getBukkitEntity(), list); -+ // Paper end ++ // Paper end - Allow adding items to BlockDropItemEvent Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) { - for (ItemEntity item : items) { - item.level().addFreshEntity(item); -+ // Paper start ++ // Paper start - Allow adding items to BlockDropItemEvent + for (Item bukkit : list) { + if (!bukkit.isValid()) { + Entity item = ((org.bukkit.craftbukkit.entity.CraftItem) bukkit).getHandle(); @@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + bukkit.remove(); + } } -+ // Paper end ++ // Paper end - Allow adding items to BlockDropItemEvent } } diff --git a/patches/server/Allow-disabling-mob-spawner-spawn-egg-transformation.patch b/patches/server/Allow-disabling-mob-spawner-spawn-egg-transformation.patch index d1615a5f48..f795f09868 100644 --- a/patches/server/Allow-disabling-mob-spawner-spawn-egg-transformation.patch +++ b/patches/server/Allow-disabling-mob-spawner-spawn-egg-transformation.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 EntityType entitytypes; if (tileentity instanceof Spawner) { -+ if (world.paperConfig().entities.spawning.disableMobSpawnerSpawnEggTransformation) return InteractionResult.FAIL; // Paper ++ if (world.paperConfig().entities.spawning.disableMobSpawnerSpawnEggTransformation) return InteractionResult.FAIL; // Paper - Allow disabling mob spawner spawn egg transformation + Spawner spawner = (Spawner) tileentity; diff --git a/patches/server/Cache-burn-durations.patch b/patches/server/Cache-burn-durations.patch index 0509c3836e..2b8c49fb38 100644 --- a/patches/server/Cache-burn-durations.patch +++ b/patches/server/Cache-burn-durations.patch @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if(cachedBurnDurations != null) { + return cachedBurnDurations; + } -+ // Paper end ++ // Paper end - cache burn durations Map<Item, Integer> map = Maps.newLinkedHashMap(); AbstractFurnaceBlockEntity.add(map, (ItemLike) Items.LAVA_BUCKET, 20000); @@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - cache burn durations + cachedBurnDurations = com.google.common.collect.ImmutableMap.copyOf(map); + return cachedBurnDurations; -+ // Paper end ++ // Paper end - cache burn durations } // CraftBukkit start - add fields and methods diff --git a/patches/server/Collision-API.patch b/patches/server/Collision-API.patch index cb43d44d52..b69fd08968 100644 --- a/patches/server/Collision-API.patch +++ b/patches/server/Collision-API.patch @@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return getHandle().isInPowderSnow || getHandle().wasInPowderSnow; // depending on the location in the entity "tick" either could be needed. } // Paper end -+ // Paper Start - Collision API ++ // Paper start - Collision API + @Override + public boolean collidesAt(@org.jetbrains.annotations.NotNull Location location) { + net.minecraft.world.phys.AABB aabb = this.getHandle().getBoundingBoxAt(location.getX(), location.getY(), location.getZ()); @@ -43,5 +43,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + return !this.getHandle().level().noCollision(this.getHandle(), aabb); + } -+ // Paper End - Collision API ++ // Paper end - Collision API } diff --git a/patches/server/Collision-optimisations.patch b/patches/server/Collision-optimisations.patch index 58079e2532..089b38dd49 100644 --- a/patches/server/Collision-optimisations.patch +++ b/patches/server/Collision-optimisations.patch @@ -2159,13 +2159,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public enum Direction implements StringRepresentable { private final int adjY; private final int adjZ; - // Paper end + // Paper end - Perf: Inline shift direction fields + // Paper start - optimise collisions + private static final int RANDOM_OFFSET = 2017601568; + private Direction opposite; + static { + for (final Direction direction : VALUES) { -+ direction.opposite = from3DDataValue(direction.oppositeIndex);; ++ direction.opposite = from3DDataValue(direction.oppositeIndex); + } + } + diff --git a/patches/server/Collision-option-for-requiring-a-player-participant.patch b/patches/server/Collision-option-for-requiring-a-player-participant.patch index a24a9218a2..8b56d55cc7 100644 --- a/patches/server/Collision-option-for-requiring-a-player-participant.patch +++ b/patches/server/Collision-option-for-requiring-a-player-participant.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void push(Entity entity) { if (!this.isPassengerOfSameVehicle(entity)) { if (!entity.noPhysics && !this.noPhysics) { -+ if (this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper ++ if (this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper - Collision option for requiring a player participant double d0 = entity.getX() - this.getX(); double d1 = entity.getZ() - this.getZ(); double d2 = Mth.absMax(d0, d1); @@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void push(Entity entity) { 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.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper - Collision option for requiring a player participant if (!this.hasPassenger(entity)) { // CraftBukkit start VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent((Vehicle) this.getBukkitEntity(), entity.getBukkitEntity()); @@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public void push(Entity entity) { -+ if (!this.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper ++ if (!this.level().paperConfig().collisions.allowVehicleCollisions && this.level().paperConfig().collisions.onlyPlayersCollide && !(entity instanceof Player)) return; // Paper - Collision option for requiring a player participant if (entity instanceof Boat) { if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) { // CraftBukkit start diff --git a/patches/server/Configurable-door-breaking-difficulty.patch b/patches/server/Configurable-door-breaking-difficulty.patch index 47b8e7edc3..882e965ff8 100644 --- a/patches/server/Configurable-door-breaking-difficulty.patch +++ b/patches/server/Configurable-door-breaking-difficulty.patch @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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().entities.behavior.doorBreakingDifficulty.getOrDefault(mob.getType(), mob.level().paperConfig().entities.behavior.doorBreakingDifficulty.get(EntityType.VINDICATOR)))); // Paper ++ super(mob, 6, com.google.common.base.Predicates.in(mob.level().paperConfig().entities.behavior.doorBreakingDifficulty.getOrDefault(mob.getType(), mob.level().paperConfig().entities.behavior.doorBreakingDifficulty.get(EntityType.VINDICATOR)))); // Paper - Configurable door breaking difficulty this.setFlags(EnumSet.of(Goal.Flag.MOVE)); } @@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public Zombie(EntityType<? extends Zombie> type, Level world) { super(type, world); - this.breakDoorGoal = new BreakDoorGoal(this, Zombie.DOOR_BREAKING_PREDICATE); -+ this.breakDoorGoal = new BreakDoorGoal(this, com.google.common.base.Predicates.in(world.paperConfig().entities.behavior.doorBreakingDifficulty.getOrDefault(type, world.paperConfig().entities.behavior.doorBreakingDifficulty.get(EntityType.ZOMBIE)))); // Paper ++ this.breakDoorGoal = new BreakDoorGoal(this, com.google.common.base.Predicates.in(world.paperConfig().entities.behavior.doorBreakingDifficulty.getOrDefault(type, world.paperConfig().entities.behavior.doorBreakingDifficulty.get(EntityType.ZOMBIE)))); // Paper - Configurable door breaking difficulty } public Zombie(Level world) { diff --git a/patches/server/Configurable-max-leash-distance.patch b/patches/server/Configurable-max-leash-distance.patch index 2f6115513b..06dadcb3ea 100644 --- a/patches/server/Configurable-max-leash-distance.patch +++ b/patches/server/Configurable-max-leash-distance.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this instanceof TamableAnimal && ((TamableAnimal) this).isInSittingPose()) { - if (f > 10.0F) { -+ if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper ++ if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper - Configurable max leash distance this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit this.dropLeash(true, true); } @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.onLeashDistance(f); - if (f > 10.0F) { -+ if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper ++ if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper - Configurable max leash distance 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/server/Custom-Chat-Completion-Suggestions-API.patch b/patches/server/Custom-Chat-Completion-Suggestions-API.patch index 636081763e..abfc5e8442 100644 --- a/patches/server/Custom-Chat-Completion-Suggestions-API.patch +++ b/patches/server/Custom-Chat-Completion-Suggestions-API.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } - // Paper end - sendOpLevel API + // Paper end - Add sendOpLevel API + // Paper start - custom chat completions API + @Override diff --git a/patches/server/Deep-clone-unhandled-nbt-tags.patch b/patches/server/Deep-clone-unhandled-nbt-tags.patch index d103734127..75d4f9ca5e 100644 --- a/patches/server/Deep-clone-unhandled-nbt-tags.patch +++ b/patches/server/Deep-clone-unhandled-nbt-tags.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private CompoundTag internalTag; - final Map<String, Tag> unhandledTags = new TreeMap<String, Tag>(); // Visible for testing only // Paper -+ Map<String, Tag> unhandledTags = new TreeMap<String, Tag>(); // Visible for testing only // Paper // Paper - Deep clone unhandled nbt tags; remove final ++ Map<String, Tag> unhandledTags = new TreeMap<String, Tag>(); // Visible for testing only // Paper & Deep clone unhandled nbt tags; remove final private CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftMetaItem.DATA_TYPE_REGISTRY); private int version = CraftMagicNumbers.INSTANCE.getDataVersion(); // Internal use only diff --git a/patches/server/Enhance-console-tab-completions-for-brigadier-comman.patch b/patches/server/Enhance-console-tab-completions-for-brigadier-comman.patch index 6ff3ca5a27..c0e5432191 100644 --- a/patches/server/Enhance-console-tab-completions-for-brigadier-comman.patch +++ b/patches/server/Enhance-console-tab-completions-for-brigadier-comman.patch @@ -222,7 +222,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface this.getPlayerList().loadAndSaveFiles(); // Must be after convertNames - // Paper end - convert old users earlier after PlayerList creation but before file load/save + // Paper end - fix converting txt to json file org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread + thread.start(); // Paper - Enhance console tab completions for brigadier commands; start console thread after MinecraftServer.console & PaperConfig are initialized io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command diff --git a/patches/server/Expand-EntityUnleashEvent.patch b/patches/server/Expand-EntityUnleashEvent.patch index a1130ddb30..b3438dfb04 100644 --- a/patches/server/Expand-EntityUnleashEvent.patch +++ b/patches/server/Expand-EntityUnleashEvent.patch @@ -13,16 +13,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else if (this.getLeashHolder() == player) { // CraftBukkit start - fire PlayerUnleashEntityEvent - if (CraftEventFactory.callPlayerUnleashEntityEvent(this, player, hand).isCancelled()) { -+ // Paper start - drop leash variable ++ // Paper start - Expand EntityUnleashEvent + org.bukkit.event.player.PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(this, player, hand, !player.getAbilities().instabuild); + if (event.isCancelled()) { -+ // Paper end ++ // Paper end - Expand EntityUnleashEvent ((ServerPlayer) player).connection.send(new ClientboundSetEntityLinkPacket(this, this.getLeashHolder())); return InteractionResult.PASS; } // CraftBukkit end - this.dropLeash(true, !player.getAbilities().instabuild); -+ this.dropLeash(true, event.isDropLeash()); // Paper - drop leash variable ++ this.dropLeash(true, event.isDropLeash()); // Paper - Expand EntityUnleashEvent this.gameEvent(GameEvent.ENTITY_INTERACT, player); return InteractionResult.sidedSuccess(this.level().isClientSide); } else { @@ -32,11 +32,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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.dropLeash(true, !this.leashHolder.pluginRemoved);// CraftBukkit - SPIGOT-7487: Don't drop leash, when the holder was removed by a plugin -+ // Paper start - drop leash variable ++ // Paper start - Expand EntityUnleashEvent + EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? EntityUnleashEvent.UnleashReason.PLAYER_UNLEASH : EntityUnleashEvent.UnleashReason.HOLDER_GONE, !this.leashHolder.pluginRemoved); + this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit + this.dropLeash(true, event.isDropLeash()); -+ // Paper end ++ // Paper end - Expand EntityUnleashEvent } } @@ -46,11 +46,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (flag1 && this.isLeashed()) { - this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit - this.dropLeash(true, true); -+ // Paper start - drop leash variable ++ // Paper start - Expand EntityUnleashEvent + EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, true); + if (!event.callEvent()) { return flag1; } + this.dropLeash(true, event.isDropLeash()); -+ // Paper end ++ // Paper end - Expand EntityUnleashEvent } return flag1; @@ -60,11 +60,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 super.removeAfterChangingDimensions(); - this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit - this.dropLeash(true, false); -+ // Paper start - drop leash variable ++ // Paper start - Expand EntityUnleashEvent + EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.UNKNOWN, false); + this.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit + this.dropLeash(true, event.isDropLeash()); -+ // Paper end ++ // Paper end - Expand EntityUnleashEvent this.getAllSlots().forEach((itemstack) -> { if (!itemstack.isEmpty()) { itemstack.setCount(0); @@ -75,28 +75,28 @@ 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 + if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper - Configurable max leash distance - this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit - this.dropLeash(true, true); -+ // Paper start - drop leash variable ++ // Paper start - Expand EntityUnleashEvent + EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true); + if (!event.callEvent()) return; + this.dropLeash(true, event.isDropLeash()); -+ // Paper end ++ // Paper end - Expand EntityUnleashEvent } return; @@ -0,0 +0,0 @@ public abstract class PathfinderMob extends Mob { this.onLeashDistance(f); - if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper + if (f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper - Configurable max leash distance - this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit - this.dropLeash(true, true); -+ // Paper start - drop leash variable ++ // Paper start - Expand EntityUnleashEvent + EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE, true); + if (!event.callEvent()) return; + this.dropLeash(true, event.isDropLeash()); -+ // Paper end ++ // Paper end - Expand EntityUnleashEvent this.goalSelector.disableControlFlag(Goal.Flag.MOVE); } else if (f > 6.0F) { double d0 = (entity.getX() - this.getX()) / (double) f; @@ -109,15 +109,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (entityinsentient1.isLeashed() && entityinsentient1.getLeashHolder() == this) { // CraftBukkit start - if (CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient1, player, hand).isCancelled()) { -+ // Paper start - drop leash variable ++ // Paper start - Expand EntityUnleashEvent + org.bukkit.event.player.PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient1, player, hand, !player.getAbilities().instabuild); + if (event.isCancelled()) { -+ // Paper end ++ // Paper end - Expand EntityUnleashEvent die = false; continue; } - entityinsentient1.dropLeash(true, !player.getAbilities().instabuild); // false -> survival mode boolean -+ entityinsentient1.dropLeash(true, event.isDropLeash()); // false -> survival mode boolean // Paper - drop leash variable ++ entityinsentient1.dropLeash(true, event.isDropLeash()); // false -> survival mode boolean // Paper - Expand EntityUnleashEvent // CraftBukkit end flag1 = true; } @@ -131,10 +131,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - public static PlayerUnleashEntityEvent callPlayerUnleashEntityEvent(Mob entity, net.minecraft.world.entity.player.Player player, InteractionHand enumhand) { - PlayerUnleashEntityEvent event = new PlayerUnleashEntityEvent(entity.getBukkitEntity(), (Player) player.getBukkitEntity(), CraftEquipmentSlot.getHand(enumhand)); -+ // Paper start - drop leash variable ++ // Paper start - Expand EntityUnleashEvent + 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 ++ // Paper end - Expand EntityUnleashEvent entity.level().getCraftServer().getPluginManager().callEvent(event); return event; } diff --git a/patches/server/Expand-FallingBlock-API.patch b/patches/server/Expand-FallingBlock-API.patch index 6be8749927..0afc46fdbc 100644 --- a/patches/server/Expand-FallingBlock-API.patch +++ b/patches/server/Expand-FallingBlock-API.patch @@ -93,7 +93,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.setHurtEntities(true); } } -+ // Paper Start - Expand FallingBlock API ++ // Paper start - Expand FallingBlock API + @Override + public boolean doesAutoExpire() { + return this.getHandle().autoExpire; @@ -103,5 +103,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public void shouldAutoExpire(boolean autoExpires) { + this.getHandle().autoExpire = autoExpires; + } -+ // Paper End - Expand FallingBlock API ++ // Paper end - Expand FallingBlock API } diff --git a/patches/server/Fire-CauldronLevelChange-on-initial-fill.patch b/patches/server/Fire-CauldronLevelChange-on-initial-fill.patch index 22969b0a7a..b8b35bc2bb 100644 --- a/patches/server/Fire-CauldronLevelChange-on-initial-fill.patch +++ b/patches/server/Fire-CauldronLevelChange-on-initial-fill.patch @@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!world.isClientSide) { // CraftBukkit start - if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) { -+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY, false)) { // Paper - Call CauldronLevelChange ++ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent return InteractionResult.SUCCESS; } // CraftBukkit end @@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!world.isClientSide) { // CraftBukkit start - if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) { -+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY, false)) { // Paper - Call CauldronLevelChange ++ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent return InteractionResult.SUCCESS; } // CraftBukkit end @@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!world.isClientSide) { // CraftBukkit start - if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.CAULDRON.defaultBlockState(), player, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL)) { -+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.CAULDRON.defaultBlockState(), player, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL, false)) { // Paper - Call CauldronLevelChange ++ if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.CAULDRON.defaultBlockState(), player, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL, false)) { // Paper - Call CauldronLevelChangeEvent return InteractionResult.SUCCESS; } // CraftBukkit end @@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!world.isClientSide) { // CraftBukkit start - if (!LayeredCauldronBlock.changeLevel(state, world, pos, state, player, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY)) { -+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, state, player, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY, false)) { // Paper - Call CauldronLevelChange ++ if (!LayeredCauldronBlock.changeLevel(state, world, pos, state, player, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY, false)) { // Paper - Call CauldronLevelChangeEvent return InteractionResult.SUCCESS; } // CraftBukkit end @@ -55,19 +55,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (CauldronBlock.shouldHandlePrecipitation(world, precipitation)) { if (precipitation == Biome.Precipitation.RAIN) { - world.setBlockAndUpdate(pos, Blocks.WATER_CAULDRON.defaultBlockState()); -+ // Paper start - Call CauldronLevelChange ++ // Paper start - Call CauldronLevelChangeEvent + if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.WATER_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL, false)) { // avoid duplicate game event + return; + } -+ // Paper end - Call CauldronLevelChange ++ // Paper end - Call CauldronLevelChangeEvent world.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, pos); } else if (precipitation == Biome.Precipitation.SNOW) { - world.setBlockAndUpdate(pos, Blocks.POWDER_SNOW_CAULDRON.defaultBlockState()); -+ // Paper start - Call CauldronLevelChange ++ // Paper start - Call CauldronLevelChangeEvent + if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.POWDER_SNOW_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL, false)) { // avoid duplicate game event + return; + } -+ // Paper end - Call CauldronLevelChange ++ // Paper end - Call CauldronLevelChangeEvent world.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, pos); } @@ -76,20 +76,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (fluid == Fluids.WATER) { iblockdata1 = Blocks.WATER_CAULDRON.defaultBlockState(); - LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit -+ // Paper start - Call CauldronLevelChange; don't send level event or game event if cancelled ++ // Paper start - Call CauldronLevelChangeEvent; don't send level event or game event if cancelled + if (!LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL)) { // CraftBukkit + return; + } -+ // Paper end - Call CauldronLevelChange ++ // Paper end - Call CauldronLevelChangeEvent world.levelEvent(1047, pos, 0); } else if (fluid == Fluids.LAVA) { iblockdata1 = Blocks.LAVA_CAULDRON.defaultBlockState(); - LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit -+ // Paper start - Call CauldronLevelChange; don't send level event or game event if cancelled ++ // Paper start - Call CauldronLevelChangeEvent; don't send level event or game event if cancelled + if (!LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL)) { // CraftBukkit + return; + } -+ // Paper end - Call CauldronLevelChange ++ // Paper end - Call CauldronLevelChangeEvent world.levelEvent(1046, pos, 0); } @@ -102,13 +102,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit start - public static boolean changeLevel(BlockState iblockdata, Level world, BlockPos blockposition, BlockState newBlock, Entity entity, CauldronLevelChangeEvent.ChangeReason reason) { -+ // Paper start - Call CauldronLevelChange ++ // Paper start - Call CauldronLevelChangeEvent + public static boolean changeLevel(BlockState iblockdata, Level world, BlockPos blockposition, BlockState newBlock, @javax.annotation.Nullable Entity entity, CauldronLevelChangeEvent.ChangeReason reason) { // Paper - entity is nullable + return changeLevel(iblockdata, world, blockposition, newBlock, entity, reason, true); + } + + public static boolean changeLevel(BlockState iblockdata, Level world, BlockPos blockposition, BlockState newBlock, @javax.annotation.Nullable Entity entity, CauldronLevelChangeEvent.ChangeReason reason, boolean sendGameEvent) { // Paper - entity is nullable -+ // Paper end - Call CauldronLevelChange ++ // Paper end - Call CauldronLevelChangeEvent CraftBlockState newState = CraftBlockStates.getBlockState(world, blockposition); newState.setData(newBlock); @@ -117,7 +117,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } newState.update(true); - world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(newBlock)); -+ if (sendGameEvent) world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(newBlock)); // Paper - Call CauldronLevelChange ++ if (sendGameEvent) world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(newBlock)); // Paper - Call CauldronLevelChangeEvent return true; } // CraftBukkit end diff --git a/patches/server/Fix-Spigot-growth-modifiers.patch b/patches/server/Fix-Spigot-growth-modifiers.patch index b86b01242a..31ff9674e2 100644 --- a/patches/server/Fix-Spigot-growth-modifiers.patch +++ b/patches/server/Fix-Spigot-growth-modifiers.patch @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return to.setValue(BERRIES, from.getValue(BERRIES)); } -+ // Paper start - Fix Spigot growth modifiers ++ // Paper start - Fix Spigot growth modifiers + @Override + protected BlockState getGrowIntoState(BlockState state, RandomSource random, @javax.annotation.Nullable Level level) { + final boolean value = random.nextFloat() < (level != null ? (0.11F * (level.spigotConfig.glowBerryModifier / 100.0F)) : 0.11F); diff --git a/patches/server/Fix-a-bunch-of-vanilla-bugs.patch b/patches/server/Fix-a-bunch-of-vanilla-bugs.patch index 0e5aecd9ef..74ba10f8e2 100644 --- a/patches/server/Fix-a-bunch-of-vanilla-bugs.patch +++ b/patches/server/Fix-a-bunch-of-vanilla-bugs.patch @@ -67,9 +67,6 @@ https://bugs.mojang.com/browse/MC-200092 https://bugs.mojang.com/browse/MC-158900 Fix error when joining after tempban expired -https://bugs.mojang.com/browse/MC-259571 - Fix last gamemode not being saved on death or reload - == AT == public net/minecraft/world/entity/Mob leashInfoTag @@ -379,7 +376,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/inventory/BeaconMenu.java +++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java @@ -0,0 +0,0 @@ public class BeaconMenu extends AbstractContainerMenu { - // Paper end + // Paper end - Add PlayerChangeBeaconEffectEvent public void updateEffects(Optional<MobEffect> primary, Optional<MobEffect> secondary) { + // Paper start - fix MC-174630 - validate secondary power @@ -388,7 +385,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end if (this.paymentSlot.hasItem()) { - // Paper start + // Paper start - Add PlayerChangeBeaconEffectEvent io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent event = new io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent((org.bukkit.entity.Player) this.player.player.getBukkitEntity(), convert(primary), convert(secondary), this.access.getLocation().getBlock()); diff --git a/src/main/java/net/minecraft/world/item/BundleItem.java b/src/main/java/net/minecraft/world/item/BundleItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/patches/server/Fix-interact-event-not-being-called-sometimes.patch b/patches/server/Fix-interact-event-not-being-called-sometimes.patch index 5e66917c31..9b69bf1750 100644 --- a/patches/server/Fix-interact-event-not-being-called-sometimes.patch +++ b/patches/server/Fix-interact-event-not-being-called-sometimes.patch @@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.player.sendSystemMessage(ichatmutablecomponent, true); - } else if (enuminteractionresult.shouldSwing()) { -+ } else if (enuminteractionresult.shouldSwing() && !this.player.gameMode.interactResult) { // Paper ++ } else if (enuminteractionresult.shouldSwing() && !this.player.gameMode.interactResult) { // Paper - Call interact event this.player.swing(enumhand, true); } } @@ -28,21 +28,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time // SPIGOT-7429: Make sure to call PlayerInteractEvent for spectators and non-pickable entities - org.bukkit.util.RayTraceResult result = this.player.level().getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.1, entity -> { -+ org.bukkit.util.RayTraceResult result = this.player.level().getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.0, entity -> { // Paper - change raySize from 0.1 to 0.0 ++ org.bukkit.util.RayTraceResult result = this.player.level().getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.0, entity -> { // Paper - Call interact event; change raySize from 0.1 to 0.0 Entity handle = ((CraftEntity) entity).getHandle(); return entity != this.player.getBukkitEntity() && this.player.getBukkitEntity().canSee(entity) && !handle.isSpectator() && handle.isPickable() && !handle.isPassengerOfSameVehicle(this.player); }); if (result == null) { CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND); - } -+ } else { // Paper start - Fix interact event not being called sometimes ++ } else { // Paper start - Call interact event + GameType gameType = this.player.gameMode.getGameModeForPlayer(); + if (gameType == GameType.ADVENTURE && result.getHitBlock() != null) { + CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, ((org.bukkit.craftbukkit.block.CraftBlock) result.getHitBlock()).getPosition(), org.bukkit.craftbukkit.block.CraftBlock.blockFaceToNotch(result.getHitBlockFace()), this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND); + } else if (gameType != GameType.CREATIVE && result.getHitEntity() != null && origin.toVector().distanceSquared(result.getHitPosition()) > 3.0D * 3.0D) { + CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelected(), InteractionHand.MAIN_HAND); + } -+ } // Paper end ++ } // Paper end - Call interact event // Arm swing animation PlayerAnimationEvent event = new PlayerAnimationEvent(this.getCraftPlayer(), (packet.getHand() == InteractionHand.MAIN_HAND) ? PlayerAnimationType.ARM_SWING : PlayerAnimationType.OFF_ARM_SWING); diff --git a/patches/server/Fix-nerfed-slime-when-splitting.patch b/patches/server/Fix-nerfed-slime-when-splitting.patch index 7d20ae213b..5924b58851 100644 --- a/patches/server/Fix-nerfed-slime-when-splitting.patch +++ b/patches/server/Fix-nerfed-slime-when-splitting.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entityslime.setPersistenceRequired(); } -+ entityslime.aware = this.aware; // Paper ++ entityslime.aware = this.aware; // Paper - Fix nerfed slime when splitting entityslime.setCustomName(ichatbasecomponent); entityslime.setNoAi(flag); entityslime.setInvulnerable(this.isInvulnerable()); diff --git a/patches/server/Fix-this-stupid-bullshit.patch b/patches/server/Fix-this-stupid-bullshit.patch index 6cf977ef88..85aca2d071 100644 --- a/patches/server/Fix-this-stupid-bullshit.patch +++ b/patches/server/Fix-this-stupid-bullshit.patch @@ -46,7 +46,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - Thread.sleep(TimeUnit.SECONDS.toMillis(20)); + //System.err.println("*** Server will start in 20 seconds ***"); + //Thread.sleep(TimeUnit.SECONDS.toMillis(20)); -+ // Paper End ++ // Paper end } } diff --git a/patches/server/Fix-villager-boat-exploit.patch b/patches/server/Fix-villager-boat-exploit.patch index aa9e24ec0e..7029eb21ae 100644 --- a/patches/server/Fix-villager-boat-exploit.patch +++ b/patches/server/Fix-villager-boat-exploit.patch @@ -12,14 +12,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 PlayerList.LOGGER.debug("Removing player mount"); entityplayer.stopRiding(); entity.getPassengersAndSelf().forEach((entity1) -> { -+ // Paper start ++ // Paper start - Fix villager boat exploit + if (entity1 instanceof net.minecraft.world.entity.npc.AbstractVillager villager) { + final net.minecraft.world.entity.player.Player human = villager.getTradingPlayer(); + if (human != null) { + villager.setTradingPlayer(null); + } + } -+ // Paper end ++ // Paper end - Fix villager boat exploit entity1.setRemoved(Entity.RemovalReason.UNLOADED_WITH_PLAYER); }); } diff --git a/patches/server/Freeze-Tick-Lock-API.patch b/patches/server/Freeze-Tick-Lock-API.patch index 4458de1945..44248d2904 100644 --- a/patches/server/Freeze-Tick-Lock-API.patch +++ b/patches/server/Freeze-Tick-Lock-API.patch @@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return this.getHandle().isFullyFrozen(); } -+ // Paper Start - Freeze Tick Lock API ++ // Paper start - Freeze Tick Lock API + @Override + public boolean isFreezeTickingLocked() { + return this.entity.freezeLocked; diff --git a/patches/server/Further-improve-server-tick-loop.patch b/patches/server/Further-improve-server-tick-loop.patch index 7d9a51eb1b..8385424d77 100644 --- a/patches/server/Further-improve-server-tick-loop.patch +++ b/patches/server/Further-improve-server-tick-loop.patch @@ -87,7 +87,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + private static final java.math.BigDecimal TPS_BASE = new java.math.BigDecimal(1E9).multiply(new java.math.BigDecimal(SAMPLE_INTERVAL)); -+ // Paper End ++ // Paper end // Spigot End public static volatile RuntimeException chunkSystemCrash; // Paper - rewrite chunk system diff --git a/patches/server/Improve-ServerGUI.patch b/patches/server/Improve-ServerGUI.patch index 2a480d7ac7..a34cb89b90 100644 --- a/patches/server/Improve-ServerGUI.patch +++ b/patches/server/Improve-ServerGUI.patch @@ -46,14 +46,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 jframe.pack(); jframe.setLocationRelativeTo((Component) null); jframe.setVisible(true); -+ jframe.setName("Minecraft server"); // Paper ++ jframe.setName("Minecraft server"); // Paper - Improve ServerGUI + -+ // Paper start - Add logo as frame image ++ // Paper start - Improve ServerGUI + try { + jframe.setIconImage(javax.imageio.ImageIO.read(Objects.requireNonNull(MinecraftServerGui.class.getClassLoader().getResourceAsStream("logo.png")))); + } catch (java.io.IOException ignore) { + } -+ // Paper end ++ // Paper end - Improve ServerGUI + jframe.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent windowevent) { @@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private void tick() { long l = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); -+ // Paper start - Add tps entry ++ // Paper start - Improve ServerGUI + double[] tps = org.bukkit.Bukkit.getTPS(); + String[] tpsAvg = new String[tps.length]; + @@ -76,7 +76,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.msgs[0] = "Memory use: " + l / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)"; this.msgs[1] = "Avg tick: " + DECIMAL_FORMAT.format((double)this.server.getAverageTickTimeNanos() / (double)TimeUtil.NANOSECONDS_PER_MILLISECOND) + " ms"; + this.msgs[2] = "TPS from last 1m, 5m, 15m: " + String.join(", ", tpsAvg); -+ // Paper end ++ // Paper end - Improve ServerGUI this.values[this.vp++ & 255] = (int)(l * 100L / Runtime.getRuntime().maxMemory()); this.repaint(); } @@ -85,11 +85,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.timer.stop(); } + -+ // Paper - start Add tps entry ++ // Paper - Improve ServerGUI + private static String format(double tps) { + return (( tps > 21.0 ) ? "*" : "") + Math.min(Math.round(tps * 100.0) / 100.0, 20.0); // only print * at 21, we commonly peak to 20.02 as the tick sleep is not accurate enough, stop the noise + } -+ // Paper end ++ // Paper end - Improve ServerGUI } diff --git a/src/main/resources/logo.png b/src/main/resources/logo.png new file mode 100644 diff --git a/patches/server/Inline-shift-direction-fields.patch b/patches/server/Inline-shift-direction-fields.patch index 1634cc2e3e..e7f579cf02 100644 --- a/patches/server/Inline-shift-direction-fields.patch +++ b/patches/server/Inline-shift-direction-fields.patch @@ -14,11 +14,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 })).toArray((i) -> { return new Direction[i]; }); -+ // Paper start ++ // Paper start - Perf: Inline shift direction fields + private final int adjX; + private final int adjY; + private final int adjZ; -+ // Paper end ++ // Paper end - Perf: Inline shift direction fields private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector) { this.data3d = id; @@ -26,11 +26,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.axis = axis; this.axisDirection = direction; this.normal = vector; -+ // Paper start ++ // Paper start - Perf: Inline shift direction fields + this.adjX = vector.getX(); + this.adjY = vector.getY(); + this.adjZ = vector.getZ(); -+ // Paper end ++ // Paper end - Perf: Inline shift direction fields } public static Direction[] orderedByNearest(Entity entity) { @@ -39,17 +39,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public int getStepX() { - return this.normal.getX(); -+ return this.adjX; // Paper ++ return this.adjX; // Paper - Perf: Inline shift direction fields } public int getStepY() { - return this.normal.getY(); -+ return this.adjY; // Paper ++ return this.adjY; // Paper - Perf: Inline shift direction fields } public int getStepZ() { - return this.normal.getZ(); -+ return this.adjZ; // Paper ++ return this.adjZ; // Paper - Perf: Inline shift direction fields } public Vector3f step() { diff --git a/patches/server/Item-canEntityPickup.patch b/patches/server/Item-canEntityPickup.patch index 9b5d487b1b..fbe3e9fcbc 100644 --- a/patches/server/Item-canEntityPickup.patch +++ b/patches/server/Item-canEntityPickup.patch @@ -12,11 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ItemEntity entityitem = (ItemEntity) iterator.next(); if (!entityitem.isRemoved() && !entityitem.getItem().isEmpty() && !entityitem.hasPickUpDelay() && this.wantsToPickUp(entityitem.getItem())) { -+ // Paper Start ++ // Paper start + if (!entityitem.canMobPickup) { + continue; + } -+ // Paper End ++ // Paper end this.pickUpItem(entityitem); } } @@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -+ // Paper Start ++ // Paper start + @Override + public boolean canMobPickup() { + return this.getHandle().canMobPickup; @@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public void setCanMobPickup(boolean canMobPickup) { + this.getHandle().canMobPickup = canMobPickup; + } -+ // Paper End ++ // Paper end + @Override public void setOwner(UUID uuid) { diff --git a/patches/server/Item-no-age-no-player-pickup.patch b/patches/server/Item-no-age-no-player-pickup.patch index cd8732dd49..fc7d14858d 100644 --- a/patches/server/Item-no-age-no-player-pickup.patch +++ b/patches/server/Item-no-age-no-player-pickup.patch @@ -44,6 +44,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public void setWillAge(boolean willAge) { + this.getHandle().age = willAge ? 0 : NO_AGE_TIME; + } - // Paper End + // Paper end @Override diff --git a/patches/server/Lag-compensation-ticks.patch b/patches/server/Lag-compensation-ticks.patch index 1b7bc0500b..676cfe3680 100644 --- a/patches/server/Lag-compensation-ticks.patch +++ b/patches/server/Lag-compensation-ticks.patch @@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + worldserver.updateLagCompensationTick(); // Paper - lag compensation worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers - worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper + worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent 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 diff --git a/patches/server/Make-Amethyst-throw-both-Spread-and-Grow-Events.patch b/patches/server/Make-Amethyst-throw-both-Spread-and-Grow-Events.patch index f91d7b57c4..1b7c421543 100644 --- a/patches/server/Make-Amethyst-throw-both-Spread-and-Grow-Events.patch +++ b/patches/server/Make-Amethyst-throw-both-Spread-and-Grow-Events.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (block != null) { BlockState iblockdata2 = (BlockState) ((BlockState) block.defaultBlockState().setValue(AmethystClusterBlock.FACING, enumdirection)).setValue(AmethystClusterBlock.WATERLOGGED, iblockdata1.getFluidState().getType() == Fluids.WATER); -+ // Paper Start - Have Amethyst throw both spread and grow events ++ // Paper start - Have Amethyst throw both spread and grow events + if (block == Blocks.SMALL_AMETHYST_BUD) { org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition1, iblockdata2); // CraftBukkit + } else { diff --git a/patches/server/Make-schedule-command-per-world.patch b/patches/server/Make-schedule-command-per-world.patch index cb3d045b11..39c351332b 100644 --- a/patches/server/Make-schedule-command-per-world.patch +++ b/patches/server/Make-schedule-command-per-world.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 }); private static final SuggestionProvider<CommandSourceStack> SUGGEST_SCHEDULE = (commandcontext, suggestionsbuilder) -> { - return SharedSuggestionProvider.suggest((Iterable) ((CommandSourceStack) commandcontext.getSource()).getServer().getWorldData().overworldData().getScheduledEvents().getEventsIds(), suggestionsbuilder); -+ return SharedSuggestionProvider.suggest((Iterable) ((net.minecraft.commands.CommandSourceStack) commandcontext.getSource()).getLevel().serverLevelData.getScheduledEvents().getEventsIds(), suggestionsbuilder); // Paper ++ return SharedSuggestionProvider.suggest((Iterable) ((net.minecraft.commands.CommandSourceStack) commandcontext.getSource()).getLevel().serverLevelData.getScheduledEvents().getEventsIds(), suggestionsbuilder); // Paper - Make schedule command per-world }; public ScheduleCommand() {} @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private static int remove(CommandSourceStack source, String eventName) throws CommandSyntaxException { - int i = source.getServer().getWorldData().overworldData().getScheduledEvents().remove(eventName); -+ int i = source.getLevel().serverLevelData.getScheduledEvents().remove(eventName); // Paper ++ int i = source.getLevel().serverLevelData.getScheduledEvents().remove(eventName); // Paper - Make schedule command per-world if (i == 0) { throw ScheduleCommand.ERROR_CANT_REMOVE.create(eventName); diff --git a/patches/server/Manually-inline-methods-in-BlockPosition.patch b/patches/server/Manually-inline-methods-in-BlockPosition.patch index 724eccc78f..70e4fb4ff3 100644 --- a/patches/server/Manually-inline-methods-in-BlockPosition.patch +++ b/patches/server/Manually-inline-methods-in-BlockPosition.patch @@ -15,9 +15,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - this.setX(x); - this.setY(y); - this.setZ(z); -+ this.x = x; // Paper - force inline -+ this.y = y; // Paper - force inline -+ this.z = z; // Paper - force inline ++ this.x = x; // Paper - Perf: Manually inline methods in BlockPosition ++ this.y = y; // Paper - Perf: Manually inline methods in BlockPosition ++ this.z = z; // Paper - Perf: Manually inline methods in BlockPosition return this; } @@ -26,21 +26,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public BlockPos.MutableBlockPos setX(int i) { - super.setX(i); -+ this.x = i; // Paper - force line ++ this.x = i; // Paper - Perf: Manually inline methods in BlockPosition return this; } @Override public BlockPos.MutableBlockPos setY(int i) { - super.setY(i); -+ this.y = i; // Paper - force line ++ this.y = i; // Paper - Perf: Manually inline methods in BlockPosition return this; } @Override public BlockPos.MutableBlockPos setZ(int i) { - super.setZ(i); -+ this.z = i; // Paper - force line ++ this.z = i; // Paper - Perf: Manually inline methods in BlockPosition return this; } @@ -55,9 +55,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - private int x; - private int y; - private int z; -+ protected int x; // Paper - force line; protected -+ protected int y; // Paper - force line; protected -+ protected int z; // Paper - force line; protected ++ protected int x; // Paper - Perf: Manually inline methods in BlockPosition; protected ++ protected int y; // Paper - Perf: Manually inline methods in BlockPosition; protected ++ protected int z; // Paper - Perf: Manually inline methods in BlockPosition; protected public static Codec<Vec3i> offsetCodec(int maxAbsValue) { return ExtraCodecs.validate(CODEC, (vec) -> { diff --git a/patches/server/Missing-Entity-API.patch b/patches/server/Missing-Entity-API.patch index a2afd5aaa1..3a1787a80c 100644 --- a/patches/server/Missing-Entity-API.patch +++ b/patches/server/Missing-Entity-API.patch @@ -219,14 +219,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } -+ // Paper Start - Horse API ++ // Paper start - Horse API + public void setMouthOpen(boolean open) { + this.setFlag(FLAG_OPEN_MOUTH, open); + } + public boolean isMouthOpen() { + return this.getFlag(FLAG_OPEN_MOUTH); + } -+ // Paper End - Horse API ++ // Paper end - Horse API + @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { @@ -235,11 +235,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.setFlag(16, eatingGrass); } -+ // Paper Start - Horse API ++ // Paper start - Horse API + public void setForceStanding(boolean standing) { + this.setFlag(FLAG_STANDING, standing); + } -+ // Paper End - Horse API ++ // Paper end - Horse API public void setStanding(boolean angry) { if (angry) { this.setEating(false); @@ -519,7 +519,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } + -+ // Paper Start - More cat api ++ // Paper start - More cat api + @Override + public void setLyingDown(boolean lyingDown) { + this.getHandle().setLying(lyingDown); @@ -539,7 +539,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public boolean isHeadUp() { + return this.getHandle().isRelaxStateOne(); + } -+ // Paper End - More cat api ++ // Paper end - More cat api } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/patches/server/More-Projectile-API.patch b/patches/server/More-Projectile-API.patch index 7e1c7f8fa2..bf46fcdb2b 100644 --- a/patches/server/More-Projectile-API.patch +++ b/patches/server/More-Projectile-API.patch @@ -239,7 +239,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - if (this.item.getType() != Material.FIREWORK_ROCKET) { - this.item.setType(Material.FIREWORK_ROCKET); - } -+// Paper Start - Expose firework item directly ++// Paper start - Expose firework item directly +// ItemStack item = this.getHandle().getEntityData().get(FireworkRocketEntity.DATA_ID_FIREWORKS_ITEM); +// +// if (item.isEmpty()) { @@ -253,7 +253,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +// if (this.item.getType() != Material.FIREWORK_ROCKET) { +// this.item.setType(Material.FIREWORK_ROCKET); +// } -+ // Paper End - Expose firework item directly ++ // Paper end - Expose firework item directly } @Override diff --git a/patches/server/Optimize-BlockPosition-helper-methods.patch b/patches/server/Optimize-BlockPosition-helper-methods.patch index 202a43456c..5456be1da1 100644 --- a/patches/server/Optimize-BlockPosition-helper-methods.patch +++ b/patches/server/Optimize-BlockPosition-helper-methods.patch @@ -85,7 +85,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public BlockPos relative(Direction direction) { -+ // Paper Start - Optimize BlockPosition ++ // Paper start - Optimize BlockPosition + switch(direction) { + case UP: + return new BlockPos(this.getX(), this.getY() + 1, this.getZ()); @@ -102,7 +102,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + default: return new BlockPos(this.getX() + direction.getStepX(), this.getY() + direction.getStepY(), this.getZ() + direction.getStepZ()); + } -+ // Paper End ++ // Paper end } @Override diff --git a/patches/server/Optimize-Hoppers.patch b/patches/server/Optimize-Hoppers.patch index 0b616b1caf..cc6a0cb60b 100644 --- a/patches/server/Optimize-Hoppers.patch +++ b/patches/server/Optimize-Hoppers.patch @@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ServerLevel worldserver = (ServerLevel) iterator.next(); worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper + net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - Perf: Optimize Hoppers - worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper + worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - Add EntityMoveEvent this.profiler.push(() -> { diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java diff --git a/patches/server/Option-to-prevent-NBT-copy-in-smithing-recipes.patch b/patches/server/Option-to-prevent-NBT-copy-in-smithing-recipes.patch index b79b0db3fd..45b6810aab 100644 --- a/patches/server/Option-to-prevent-NBT-copy-in-smithing-recipes.patch +++ b/patches/server/Option-to-prevent-NBT-copy-in-smithing-recipes.patch @@ -97,7 +97,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public CraftSmithingTransformRecipe(NamespacedKey key, ItemStack result, RecipeChoice template, RecipeChoice base, RecipeChoice addition, boolean copyNbt) { + super(key, result, template, base, addition, copyNbt); + } -+ // Paper endv ++ // Paper end - Option to prevent NBT copy public static CraftSmithingTransformRecipe fromBukkitRecipe(SmithingTransformRecipe recipe) { if (recipe instanceof CraftSmithingTransformRecipe) { diff --git a/patches/server/Paper-config-files.patch b/patches/server/Paper-config-files.patch index d1e04c28ba..ba7b27468d 100644 --- a/patches/server/Paper-config-files.patch +++ b/patches/server/Paper-config-files.patch @@ -4984,7 +4984,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 .describedAs("Yml file"); // Spigot End + -+ // Paper Start ++ // Paper start + acceptsAll(asList("paper-dir", "paper-settings-directory"), "Directory for Paper settings") + .withRequiredArg() + .ofType(File.class) diff --git a/patches/server/Pass-ServerLevel-for-gamerule-callbacks.patch b/patches/server/Pass-ServerLevel-for-gamerule-callbacks.patch index ecde6ff0c8..d9f05652eb 100644 --- a/patches/server/Pass-ServerLevel-for-gamerule-callbacks.patch +++ b/patches/server/Pass-ServerLevel-for-gamerule-callbacks.patch @@ -92,8 +92,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.callback = changeCallback; @@ -0,0 +0,0 @@ public class GameRules { - public void setFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey) { // Paper - this.updateFromArgument(context, name, gameRuleKey); // Paper + public void setFromArgument(CommandContext<CommandSourceStack> context, String name, GameRules.Key<T> gameRuleKey) { // Paper - Add WorldGameRuleChangeEvent + this.updateFromArgument(context, name, gameRuleKey); // Paper - Add WorldGameRuleChangeEvent - this.onChanged(((CommandSourceStack) context.getSource()).getServer()); + this.onChanged(((CommandSourceStack) context.getSource()).getLevel()); // Paper - Pass ServerLevel for gamerule callbacks } @@ -171,18 +171,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World { - // Paper end + // Paper end - Add WorldGameRuleChangeEvent GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule)); - handle.deserialize(event.getValue()); // Paper + handle.deserialize(event.getValue()); // Paper - Add WorldGameRuleChangeEvent - handle.onChanged(this.getHandle().getServer()); + handle.onChanged(this.getHandle()); // Paper - Pass ServerLevel for gamerule callbacks return true; } @@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World { - // Paper end + // Paper end - Add WorldGameRuleChangeEvent GameRules.Value<?> handle = this.getHandle().getGameRules().getRule(CraftWorld.getGameRulesNMS().get(rule.getName())); - handle.deserialize(event.getValue()); // Paper + handle.deserialize(event.getValue()); // Paper - Add WorldGameRuleChangeEvent - handle.onChanged(this.getHandle().getServer()); + handle.onChanged(this.getHandle()); // Paper - Pass ServerLevel for gamerule callbacks return true; diff --git a/patches/server/PlayerPickupItemEvent-setFlyAtPlayer.patch b/patches/server/PlayerPickupItemEvent-setFlyAtPlayer.patch index 92a2b65edc..4e8f1fa4b7 100644 --- a/patches/server/PlayerPickupItemEvent-setFlyAtPlayer.patch +++ b/patches/server/PlayerPickupItemEvent-setFlyAtPlayer.patch @@ -23,11 +23,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + flyAtPlayer = playerEvent.getFlyAtPlayer(); // Paper if (playerEvent.isCancelled()) { itemstack.setCount(i); // SPIGOT-5294 - restore count -+ // Paper Start ++ // Paper start + if (flyAtPlayer) { + player.take(this, i); + } -+ // Paper End ++ // Paper end return; } diff --git a/patches/server/Prevent-grindstones-from-overstacking-items.patch b/patches/server/Prevent-grindstones-from-overstacking-items.patch index 6ac5afe66b..82954cf093 100644 --- a/patches/server/Prevent-grindstones-from-overstacking-items.patch +++ b/patches/server/Prevent-grindstones-from-overstacking-items.patch @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - b0 = 2; -+ b0 = 2; // Paper - the problem line for above change, causing over-stacking ++ b0 = 2; // Paper - add max stack size check & config value; the problem line for above change, causing over-stacking } } else { boolean flag3 = !itemstack.isEmpty(); diff --git a/patches/server/Remove-stale-POIs.patch b/patches/server/Remove-stale-POIs.patch index a466b72d59..72bb935e68 100644 --- a/patches/server/Remove-stale-POIs.patch +++ b/patches/server/Remove-stale-POIs.patch @@ -12,11 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 }); optional1.ifPresent((holder) -> { this.getServer().execute(() -> { -+ // Paper start ++ // Paper start - Remove stale POIs + if (optional.isEmpty() && this.getPoiManager().exists(blockposition1, poiType -> true)) { + this.getPoiManager().remove(blockposition1); + } -+ // Paper end ++ // Paper end - Remove stale POIs this.getPoiManager().add(blockposition1, holder); DebugPackets.sendPoiAddedPacket(this, blockposition1); }); diff --git a/patches/server/Reset-shield-blocking-on-dimension-change.patch b/patches/server/Reset-shield-blocking-on-dimension-change.patch index b7a9eecb5b..d7dc23b2e5 100644 --- a/patches/server/Reset-shield-blocking-on-dimension-change.patch +++ b/patches/server/Reset-shield-blocking-on-dimension-change.patch @@ -12,11 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.level().getCraftServer().getPluginManager().callEvent(changeEvent); // CraftBukkit end } -+ // Paper start ++ // Paper start - Reset shield blocking on dimension change + if (this.isBlocking()) { + this.stopUsingItem(); + } -+ // Paper end ++ // Paper end - Reset shield blocking on dimension change return this; } diff --git a/patches/server/Return-chat-component-with-empty-text-instead-of-thr.patch b/patches/server/Return-chat-component-with-empty-text-instead-of-thr.patch index e1badec63d..8930db47d0 100644 --- a/patches/server/Return-chat-component-with-empty-text-instead-of-thr.patch +++ b/patches/server/Return-chat-component-with-empty-text-instead-of-thr.patch @@ -16,10 +16,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - Preconditions.checkState(this.title != null, "Title not set"); + // Paper start - return chat component with empty text instead of throwing error + // Preconditions.checkState(this.title != null, "Title not set"); -+ if(this.title == null){ ++ if (this.title == null){ + return Component.literal(""); + } -+ // Paper end ++ // Paper end - return chat component with empty text instead of throwing error return this.title; } public final void setTitle(Component title) { diff --git a/patches/server/Stinger-API.patch b/patches/server/Stinger-API.patch index a0b14cfb94..b5b1fb3430 100644 --- a/patches/server/Stinger-API.patch +++ b/patches/server/Stinger-API.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // Paper end } -+ // Paper Start - Bee Stinger API ++ // Paper start - Bee Stinger API + @Override + public int getBeeStingerCooldown() { + return getHandle().removeStingerTime; @@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + Preconditions.checkArgument(count >= 0, "New bee stinger amount must be >= 0"); + getHandle().setStingerCount(count); + } -+ // Paper End - Bee Stinger API ++ // Paper end - Bee Stinger API @Override public void damage(double amount) { this.damage(amount, null); diff --git a/patches/server/added-option-to-disable-pathfinding-updates-on-block.patch b/patches/server/added-option-to-disable-pathfinding-updates-on-block.patch index 2121f14b8c..9871d1bf73 100644 --- a/patches/server/added-option-to-disable-pathfinding-updates-on-block.patch +++ b/patches/server/added-option-to-disable-pathfinding-updates-on-block.patch @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -+ } // Paper ++ } // Paper - option to disable pathfinding updates } @Override diff --git a/patches/server/fix-converting-txt-to-json-file.patch b/patches/server/fix-converting-txt-to-json-file.patch index 9e0c19899d..7ca9e526f5 100644 --- a/patches/server/fix-converting-txt-to-json-file.patch +++ b/patches/server/fix-converting-txt-to-json-file.patch @@ -12,11 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.setViewDistance(dedicatedServerProperties.viewDistance); this.setSimulationDistance(dedicatedServerProperties.simulationDistance); super.setUsingWhiteList(dedicatedServerProperties.whiteList.get()); -+ // Paper start - moved from constructor ++ // Paper start - fix converting txt to json file; moved from constructor + } + @Override + public void loadAndSaveFiles() { -+ // Paper end ++ // Paper end - fix converting txt to json file this.loadUserBanList(); this.saveUserBanList(); this.loadIpBanList(); @@ -28,12 +28,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess()); this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); // Paper end - initialize global and world-defaults configuration -+ // Paper start - convert old users earlier after PlayerList creation but before file load/save ++ // Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save + if (this.convertOldUsers()) { + this.getProfileCache().save(false); // Paper + } + this.getPlayerList().loadAndSaveFiles(); // Must be after convertNames -+ // Paper end - convert old users earlier after PlayerList creation but before file load/save ++ // Paper end - fix converting txt to json file org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics @@ -55,7 +55,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.maxPlayers = maxPlayers; this.playerIo = saveHandler; } -+ abstract public void loadAndSaveFiles(); // Paper - moved from DedicatedPlayerList constructor ++ abstract public void loadAndSaveFiles(); // Paper - fix converting txt to json file; moved from DedicatedPlayerList constructor public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData) { player.isRealPlayer = true; // Paper diff --git a/patches/server/living-entity-allow-attribute-registration.patch b/patches/server/living-entity-allow-attribute-registration.patch index 8b28c178da..43119db07b 100644 --- a/patches/server/living-entity-allow-attribute-registration.patch +++ b/patches/server/living-entity-allow-attribute-registration.patch @@ -13,12 +13,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + -+ // Paper - start ++ // Paper - start - living entity allow attribute registration + public void registerAttribute(Attribute attributeBase) { + AttributeInstance attributeModifiable = new AttributeInstance(attributeBase, AttributeInstance::getAttribute); + attributes.put(attributeBase, attributeModifiable); + } -+ // Paper - end ++ // Paper - end - living entity allow attribute registration + } diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java @@ -29,13 +29,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return (nms == null) ? null : new CraftAttributeInstance(nms, attribute); } -+ // Paper start ++ // Paper start - living entity allow attribute registration + @Override + public void registerAttribute(Attribute attribute) { + Preconditions.checkArgument(attribute != null, "attribute"); + handle.registerAttribute(CraftAttribute.bukkitToMinecraft(attribute)); + } -+ // Paper end ++ // Paper end - living entity allow attribute registration } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -45,12 +45,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return this.getHandle().craftAttributes.getAttribute(attribute); } -+ // Paper start ++ // Paper start - living entity allow attribute registration + @Override + public void registerAttribute(Attribute attribute) { + getHandle().craftAttributes.registerAttribute(attribute); + } -+ // Paper end ++ // Paper end - living entity allow attribute registration + @Override public void setAI(boolean ai) { diff --git a/patches/server/revert-serverside-behavior-of-keepalives.patch b/patches/server/revert-serverside-behavior-of-keepalives.patch index 2ec04dac59..5a91ac0c42 100644 --- a/patches/server/revert-serverside-behavior-of-keepalives.patch +++ b/patches/server/revert-serverside-behavior-of-keepalives.patch @@ -43,7 +43,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - - if (i - this.keepAliveTime >= 25000L) { // CraftBukkit - if (this.keepAlivePending) { -+ // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings ++ // Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings + // This should effectively place the keepalive handling back to "as it was" before 1.12.2 + long currentTime = Util.getMillis(); + long elapsedTime = currentTime - this.keepAliveTime;