From e07671b7df84d65d57b3844c51a2ecca41949785 Mon Sep 17 00:00:00 2001 From: Jake Potrebic <jake.m.potrebic@gmail.com> Date: Thu, 13 Jun 2024 12:04:27 -0700 Subject: [PATCH] 279 --- ...lock-entities-from-a-chunk-without-s.patch | 0 ...ies-option-to-debug-dupe-uuid-issues.patch | 0 ...dd-Early-Warning-Feature-to-WatchDog.patch | 0 .../Add-LivingEntity-getTargetEntity.patch | 0 .../server/Add-More-Creeper-API.patch | 0 .../server/Add-PhantomPreSpawnEvent.patch | 0 .../Add-PlayerConnectionCloseEvent.patch | 2 +- .../server/Add-TNTPrimeEvent.patch | 0 ...to-disable-ender-dragon-legacy-check.patch | 0 .../server/Add-entity-knockback-events.patch | 86 +++++---- .../server/Add-more-Witch-API.patch | 8 +- .../server/Add-more-Zombie-API.patch | 0 ...event-players-from-moving-into-unloa.patch | 4 +- ...-ray-tracing-methods-to-LivingEntity.patch | 0 .../server/Add-sun-related-API.patch | 0 ...ow-chests-to-be-placed-with-NBT-data.patch | 0 .../Allow-disabling-armor-stand-ticking.patch | 0 .../server/AnvilDamageEvent.patch | 0 .../server/Async-command-map-building.patch | 0 .../server/BlockDestroyEvent.patch | 0 .../server/Book-Size-Limits.patch | 2 +- ...nd-make-tab-spam-limits-configurable.patch | 0 .../server/Brigadier-Mojang-API.patch | 0 ...tator-target-events-and-improve-impl.patch | 2 +- ...owned-for-Villager-Aggression-Config.patch | 0 .../Configurable-LootPool-luck-formula.patch | 0 ...ble-connection-throttle-kick-message.patch | 0 ...le-speed-for-water-flowing-over-lava.patch | 0 ...t-allow-digging-into-unloaded-chunks.patch | 0 ...-after-profile-lookups-if-not-needed.patch | 0 ...r-remove-if-the-handle-is-a-custom-p.patch | 0 .../server/EnderDragon-Events.patch | 2 +- .../server/Expand-ArmorStand-API.patch | 0 .../server/Expand-Explosions-API.patch | 0 ...e-attack-cooldown-methods-for-Player.patch | 0 .../server/Fix-CraftEntity-hashCode.patch | 0 .../server/Fix-NBT-type-issues.patch | 0 .../Fix-SpongeAbsortEvent-handling.patch | 0 .../server/Honor-EntityAgeable.ageLock.patch | 0 .../Implement-World.getEntity-UUID-API.patch | 0 ...nt-furnace-cook-speed-multiplier-API.patch | 14 +- .../Improve-BlockPosition-inlining.patch | 0 .../server/Improve-EntityShootBowEvent.patch | 0 ...er-Thread-Pool-and-Thread-Priorities.patch | 0 .../server/Improve-death-events.patch | 173 +++++++++--------- ...rove-exact-choice-recipe-ingredients.patch | 88 +++++---- .../server/Inventory-removeItemAnySlot.patch | 0 .../InventoryCloseEvent-Reason-API.patch | 8 +- .../server/LivingEntity-Active-Item-API.patch | 0 ...loadChunk-int-int-false-load-unconve.patch | 0 ...e-shield-blocking-delay-configurable.patch | 4 +- ...ault-permission-message-configurable.patch | 0 .../server/Mob-Pathfinding-API.patch | 0 ...ptimize-BlockPosition-helper-methods.patch | 0 .../Optimize-CraftBlockData-Creation.patch | 0 .../server/Optimize-MappedRegistry.patch | 0 .../server/Optimize-World-Time-Updates.patch | 0 ...t-armor-stands-from-doing-entity-loo.patch | 0 .../server/PlayerElytraBoostEvent.patch | 0 .../server/PlayerLaunchProjectileEvent.patch | 46 ++--- .../server/PlayerReadyArrowEvent.patch | 0 .../server/PreSpawnerSpawnEvent.patch | 0 ...ent-chunk-loading-from-Fluid-Flowing.patch | 0 ...wning-from-loading-generating-chunks.patch | 0 ...interactions-from-causing-chunk-load.patch | 0 ...ils-when-failing-to-save-player-data.patch | 0 .../server/RangedEntity-API.patch | 0 ...nventory-when-cancelling-PlayerInter.patch | 0 ...Remove-unnecessary-itemmeta-handling.patch | 0 .../Replace-OfflinePlayer-getLastPlayed.patch | 2 +- .../Reset-players-airTicks-on-respawn.patch | 2 +- ...store-custom-InventoryHolder-support.patch | 0 ...default-mob-spawn-range-and-water-an.patch | 0 .../server/SkeletonHorse-Additions.patch | 2 +- .../server/Slime-Pathfinder-Events.patch | 0 .../{unapplied => }/server/Turtle-API.patch | 0 ...ed-flag-on-cancel-of-Explosion-Event.patch | 0 .../Use-ConcurrentHashMap-in-JsonList.patch | 0 .../Use-a-Queue-for-Queueing-Commands.patch | 0 .../Vanished-players-don-t-have-rights.patch | 0 .../server/Vex-get-setSummoner-API.patch | 0 patches/server/WitchReadyPotionEvent.patch | 3 +- ...vehicle-tracking-issue-on-disconnect.patch | 2 +- ...-more-information-to-Entity.toString.patch | 0 ...entity-dismount-during-teleportation.patch | 2 +- ...ParseException-in-block-entity-names.patch | 27 --- 86 files changed, 231 insertions(+), 248 deletions(-) rename patches/{unapplied => }/server/Ability-to-get-block-entities-from-a-chunk-without-s.patch (100%) rename patches/{unapplied => }/server/Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch (100%) rename patches/{unapplied => }/server/Add-Early-Warning-Feature-to-WatchDog.patch (100%) rename patches/{unapplied => }/server/Add-LivingEntity-getTargetEntity.patch (100%) rename patches/{unapplied => }/server/Add-More-Creeper-API.patch (100%) rename patches/{unapplied => }/server/Add-PhantomPreSpawnEvent.patch (100%) rename patches/{unapplied => }/server/Add-PlayerConnectionCloseEvent.patch (98%) rename patches/{unapplied => }/server/Add-TNTPrimeEvent.patch (100%) rename patches/{unapplied => }/server/Add-config-to-disable-ender-dragon-legacy-check.patch (100%) rename patches/{unapplied => }/server/Add-entity-knockback-events.patch (81%) rename patches/{unapplied => }/server/Add-more-Witch-API.patch (98%) rename patches/{unapplied => }/server/Add-more-Zombie-API.patch (100%) rename patches/{unapplied => }/server/Add-option-to-prevent-players-from-moving-into-unloa.patch (98%) rename patches/{unapplied => }/server/Add-ray-tracing-methods-to-LivingEntity.patch (100%) rename patches/{unapplied => }/server/Add-sun-related-API.patch (100%) rename patches/{unapplied => }/server/Allow-chests-to-be-placed-with-NBT-data.patch (100%) rename patches/{unapplied => }/server/Allow-disabling-armor-stand-ticking.patch (100%) rename patches/{unapplied => }/server/AnvilDamageEvent.patch (100%) rename patches/{unapplied => }/server/Async-command-map-building.patch (100%) rename patches/{unapplied => }/server/BlockDestroyEvent.patch (100%) rename patches/{unapplied => }/server/Book-Size-Limits.patch (97%) rename patches/{unapplied => }/server/Break-up-and-make-tab-spam-limits-configurable.patch (100%) rename patches/{unapplied => }/server/Brigadier-Mojang-API.patch (100%) rename patches/{unapplied => }/server/Call-player-spectator-target-events-and-improve-impl.patch (96%) rename patches/{unapplied => }/server/Check-Drowned-for-Villager-Aggression-Config.patch (100%) rename patches/{unapplied => }/server/Configurable-LootPool-luck-formula.patch (100%) rename patches/{unapplied => }/server/Configurable-connection-throttle-kick-message.patch (100%) rename patches/{unapplied => }/server/Configurable-speed-for-water-flowing-over-lava.patch (100%) rename patches/{unapplied => }/server/Don-t-allow-digging-into-unloaded-chunks.patch (100%) rename patches/{unapplied => }/server/Don-t-sleep-after-profile-lookups-if-not-needed.patch (100%) rename patches/{unapplied => }/server/Dont-block-Player-remove-if-the-handle-is-a-custom-p.patch (100%) rename patches/{unapplied => }/server/EnderDragon-Events.patch (98%) rename patches/{unapplied => }/server/Expand-ArmorStand-API.patch (100%) rename patches/{unapplied => }/server/Expand-Explosions-API.patch (100%) rename patches/{unapplied => }/server/Expose-attack-cooldown-methods-for-Player.patch (100%) rename patches/{unapplied => }/server/Fix-CraftEntity-hashCode.patch (100%) rename patches/{unapplied => }/server/Fix-NBT-type-issues.patch (100%) rename patches/{unapplied => }/server/Fix-SpongeAbsortEvent-handling.patch (100%) rename patches/{unapplied => }/server/Honor-EntityAgeable.ageLock.patch (100%) rename patches/{unapplied => }/server/Implement-World.getEntity-UUID-API.patch (100%) rename patches/{unapplied => }/server/Implement-furnace-cook-speed-multiplier-API.patch (87%) rename patches/{unapplied => }/server/Improve-BlockPosition-inlining.patch (100%) rename patches/{unapplied => }/server/Improve-EntityShootBowEvent.patch (100%) rename patches/{unapplied => }/server/Improve-Server-Thread-Pool-and-Thread-Priorities.patch (100%) rename patches/{unapplied => }/server/Improve-death-events.patch (81%) rename patches/{unapplied => }/server/Improve-exact-choice-recipe-ingredients.patch (83%) rename patches/{unapplied => }/server/Inventory-removeItemAnySlot.patch (100%) rename patches/{unapplied => }/server/InventoryCloseEvent-Reason-API.patch (97%) rename patches/{unapplied => }/server/LivingEntity-Active-Item-API.patch (100%) rename patches/{unapplied => }/server/Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch (100%) rename patches/{unapplied => }/server/Make-shield-blocking-delay-configurable.patch (90%) rename patches/{unapplied => }/server/Make-the-default-permission-message-configurable.patch (100%) rename patches/{unapplied => }/server/Mob-Pathfinding-API.patch (100%) rename patches/{unapplied => }/server/Optimize-BlockPosition-helper-methods.patch (100%) rename patches/{unapplied => }/server/Optimize-CraftBlockData-Creation.patch (100%) rename patches/{unapplied => }/server/Optimize-MappedRegistry.patch (100%) rename patches/{unapplied => }/server/Optimize-World-Time-Updates.patch (100%) rename patches/{unapplied => }/server/Option-to-prevent-armor-stands-from-doing-entity-loo.patch (100%) rename patches/{unapplied => }/server/PlayerElytraBoostEvent.patch (100%) rename patches/{unapplied => }/server/PlayerLaunchProjectileEvent.patch (89%) rename patches/{unapplied => }/server/PlayerReadyArrowEvent.patch (100%) rename patches/{unapplied => }/server/PreSpawnerSpawnEvent.patch (100%) rename patches/{unapplied => }/server/Prevent-chunk-loading-from-Fluid-Flowing.patch (100%) rename patches/{unapplied => }/server/Prevent-mob-spawning-from-loading-generating-chunks.patch (100%) rename patches/{unapplied => }/server/Prevent-various-interactions-from-causing-chunk-load.patch (100%) rename patches/{unapplied => }/server/Print-Error-details-when-failing-to-save-player-data.patch (100%) rename patches/{unapplied => }/server/RangedEntity-API.patch (100%) rename patches/{unapplied => }/server/Refresh-player-inventory-when-cancelling-PlayerInter.patch (100%) rename patches/{unapplied => }/server/Remove-unnecessary-itemmeta-handling.patch (100%) rename patches/{unapplied => }/server/Replace-OfflinePlayer-getLastPlayed.patch (98%) rename patches/{unapplied => }/server/Reset-players-airTicks-on-respawn.patch (90%) rename patches/{unapplied => }/server/Restore-custom-InventoryHolder-support.patch (100%) rename patches/{unapplied => }/server/Restore-vanilla-default-mob-spawn-range-and-water-an.patch (100%) rename patches/{unapplied => }/server/SkeletonHorse-Additions.patch (97%) rename patches/{unapplied => }/server/Slime-Pathfinder-Events.patch (100%) rename patches/{unapplied => }/server/Turtle-API.patch (100%) rename patches/{unapplied => }/server/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch (100%) rename patches/{unapplied => }/server/Use-ConcurrentHashMap-in-JsonList.patch (100%) rename patches/{unapplied => }/server/Use-a-Queue-for-Queueing-Commands.patch (100%) rename patches/{unapplied => }/server/Vanished-players-don-t-have-rights.patch (100%) rename patches/{unapplied => }/server/Vex-get-setSummoner-API.patch (100%) rename patches/{unapplied => }/server/Workaround-for-vehicle-tracking-issue-on-disconnect.patch (92%) rename patches/{unapplied => }/server/add-more-information-to-Entity.toString.patch (100%) rename patches/{unapplied => }/server/force-entity-dismount-during-teleportation.patch (98%) delete mode 100644 patches/unapplied/server/Catch-JsonParseException-in-block-entity-names.patch diff --git a/patches/unapplied/server/Ability-to-get-block-entities-from-a-chunk-without-s.patch b/patches/server/Ability-to-get-block-entities-from-a-chunk-without-s.patch similarity index 100% rename from patches/unapplied/server/Ability-to-get-block-entities-from-a-chunk-without-s.patch rename to patches/server/Ability-to-get-block-entities-from-a-chunk-without-s.patch diff --git a/patches/unapplied/server/Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch b/patches/server/Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch similarity index 100% rename from patches/unapplied/server/Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch rename to patches/server/Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch diff --git a/patches/unapplied/server/Add-Early-Warning-Feature-to-WatchDog.patch b/patches/server/Add-Early-Warning-Feature-to-WatchDog.patch similarity index 100% rename from patches/unapplied/server/Add-Early-Warning-Feature-to-WatchDog.patch rename to patches/server/Add-Early-Warning-Feature-to-WatchDog.patch diff --git a/patches/unapplied/server/Add-LivingEntity-getTargetEntity.patch b/patches/server/Add-LivingEntity-getTargetEntity.patch similarity index 100% rename from patches/unapplied/server/Add-LivingEntity-getTargetEntity.patch rename to patches/server/Add-LivingEntity-getTargetEntity.patch diff --git a/patches/unapplied/server/Add-More-Creeper-API.patch b/patches/server/Add-More-Creeper-API.patch similarity index 100% rename from patches/unapplied/server/Add-More-Creeper-API.patch rename to patches/server/Add-More-Creeper-API.patch diff --git a/patches/unapplied/server/Add-PhantomPreSpawnEvent.patch b/patches/server/Add-PhantomPreSpawnEvent.patch similarity index 100% rename from patches/unapplied/server/Add-PhantomPreSpawnEvent.patch rename to patches/server/Add-PhantomPreSpawnEvent.patch diff --git a/patches/unapplied/server/Add-PlayerConnectionCloseEvent.patch b/patches/server/Add-PlayerConnectionCloseEvent.patch similarity index 98% rename from patches/unapplied/server/Add-PlayerConnectionCloseEvent.patch rename to patches/server/Add-PlayerConnectionCloseEvent.patch index 10336132a2..dc1e7f16c3 100644 --- a/patches/unapplied/server/Add-PlayerConnectionCloseEvent.patch +++ b/patches/server/Add-PlayerConnectionCloseEvent.patch @@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java @@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { - packetlistener1.onDisconnect(ichatbasecomponent); + packetlistener1.onDisconnect(disconnectiondetails); } this.pendingActions.clear(); // Free up packet queue. + // Paper start - Add PlayerConnectionCloseEvent diff --git a/patches/unapplied/server/Add-TNTPrimeEvent.patch b/patches/server/Add-TNTPrimeEvent.patch similarity index 100% rename from patches/unapplied/server/Add-TNTPrimeEvent.patch rename to patches/server/Add-TNTPrimeEvent.patch diff --git a/patches/unapplied/server/Add-config-to-disable-ender-dragon-legacy-check.patch b/patches/server/Add-config-to-disable-ender-dragon-legacy-check.patch similarity index 100% rename from patches/unapplied/server/Add-config-to-disable-ender-dragon-legacy-check.patch rename to patches/server/Add-config-to-disable-ender-dragon-legacy-check.patch diff --git a/patches/unapplied/server/Add-entity-knockback-events.patch b/patches/server/Add-entity-knockback-events.patch similarity index 81% rename from patches/unapplied/server/Add-entity-knockback-events.patch rename to patches/server/Add-entity-knockback-events.patch index c09c7f205d..80ca50a6b9 100644 --- a/patches/unapplied/server/Add-entity-knockback-events.patch +++ b/patches/server/Add-entity-knockback-events.patch @@ -15,12 +15,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - } } -- public void push(double deltaX, double deltaY, double deltaZ) { -- this.setDeltaMovement(this.getDeltaMovement().add(deltaX, deltaY, deltaZ)); -+ public final void push(double deltaX, double deltaY, double deltaZ) { // Paper - override the added overload below + public void push(double deltaX, double deltaY, double deltaZ) { + // Paper start - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent + this.push(deltaX, deltaY, deltaZ, null); + } @@ -36,15 +33,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + this.setDeltaMovement(this.getDeltaMovement().add(delta.getX(), delta.getY(), delta.getZ())); + // Paper end - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent + this.setDeltaMovement(this.getDeltaMovement().add(deltaX, deltaY, deltaZ)); this.hasImpulse = true; } - diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { - d0 = (Math.random() - Math.random()) * 0.01D; + d1 = source.getSourcePosition().z() - this.getZ(); } - this.knockback(0.4000000059604645D, d0, d1, entity1, entity1 == null ? EntityKnockbackEvent.KnockbackCause.DAMAGE : EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit @@ -74,7 +71,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 d0 *= 1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE); if (true || d0 > 0.0D) { // CraftBukkit - Call event even when force is 0 //this.hasImpulse = true; // CraftBukkit - Move down - Vec3 vec3d = this.getDeltaMovement(); +@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { + Vec3 vec3d1 = (new Vec3(d1, 0.0D, d2)).normalize().scale(d0); - EntityKnockbackEvent event = CraftEventFactory.callEntityKnockbackEvent((org.bukkit.craftbukkit.entity.CraftLivingEntity) this.getBukkitEntity(), attacker, cause, d0, vec3d1, vec3d.x / 2.0D - vec3d1.x, this.onGround() ? Math.min(0.4D, vec3d.y / 2.0D + d0) : vec3d.y, vec3d.z / 2.0D - vec3d1.z); @@ -97,12 +95,12 @@ diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/n index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti - - if (flag) { +@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab if (f1 > 0.0F && target instanceof LivingEntity) { -- ((LivingEntity) target).knockback((double) (f1 * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot())) * 0.017453292F, this, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit -+ ((LivingEntity) target).knockback((double) (f1 * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot())) * 0.017453292F, this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // CraftBukkit // Paper - knockback events + LivingEntity entityliving = (LivingEntity) target; + +- entityliving.knockback((double) (f1 * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit ++ entityliving.knockback((double) (f1 * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // CraftBukkit // Paper - knockback events this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D)); } @@ -142,19 +140,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - entity.push(d2 / d4 * 4.0D, 0.20000000298023224D, d3 / d4 * 4.0D); + entity.push(d2 / d4 * 4.0D, 0.20000000298023224D, d3 / d4 * 4.0D, this); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent - if (!this.phaseManager.getCurrentPhase().isSitting() && ((LivingEntity) entity).getLastHurtByMobTimestamp() < entity.tickCount - 2) { - entity.hurt(this.damageSources().mobAttack(this), 5.0F); - this.doEnchantDamageEffects(this, entity); -diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java + if (!this.phaseManager.getCurrentPhase().isSitting() && entityliving.getLastHurtByMobTimestamp() < entity.tickCount - 2) { + DamageSource damagesource = this.damageSources().mobAttack(this); + +diff --git a/src/main/java/net/minecraft/world/entity/decoration/BlockAttachedEntity.java b/src/main/java/net/minecraft/world/entity/decoration/BlockAttachedEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java -+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java -@@ -0,0 +0,0 @@ public abstract class HangingEntity extends Entity { +--- a/src/main/java/net/minecraft/world/entity/decoration/BlockAttachedEntity.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/BlockAttachedEntity.java +@@ -0,0 +0,0 @@ public abstract class BlockAttachedEntity extends Entity { } @Override - public void push(double deltaX, double deltaY, double deltaZ) { -+ public void push(double deltaX, double deltaY, double deltaZ, @org.jetbrains.annotations.Nullable Entity pushingEntity) { // Paper - add push source entity param ++ public void push(double deltaX, double deltaY, double deltaZ, @Nullable Entity pushingEntity) { // Paper - override correct overload if (false && !this.level().isClientSide && !this.isRemoved() && deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ > 0.0D) { // CraftBukkit - not needed this.kill(); this.dropItem((Entity) null); @@ -205,38 +203,38 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { - if (flag5) { - if (i > 0) { - if (target instanceof LivingEntity) { -- ((LivingEntity) target).knockback((double) ((float) i * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit -+ ((LivingEntity) target).knockback((double) ((float) i * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // CraftBukkit // Paper - knockback events - } else { -- target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F)); -+ target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F), this); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent - } + if (target instanceof LivingEntity) { + LivingEntity entityliving1 = (LivingEntity) target; - this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D)); +- entityliving1.knockback((double) (f5 * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F))); ++ entityliving1.knockback((double) (f5 * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // Paper - knockback events + } else { +- target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * f5 * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * f5 * 0.5F)); ++ target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * f5 * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * f5 * 0.5F), this); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent + } + + this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D)); @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { - if (entityliving != this && entityliving != target && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof ArmorStand) || !((ArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) { - // CraftBukkit start - Only apply knockback if the damage hits - if (entityliving.hurt(this.damageSources().playerAttack(this).sweep(), f4)) { -- entityliving.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, EntityKnockbackEvent.KnockbackCause.SWEEP_ATTACK); // CraftBukkit -+ entityliving.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SWEEP_ATTACK); // CraftBukkit // Paper - knockback events - } - // CraftBukkit end + + // CraftBukkit start - Only apply knockback if the damage hits + if (entityliving2.hurt(this.damageSources().playerAttack(this).sweep(), f7)) { +- entityliving2.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, EntityKnockbackEvent.KnockbackCause.SWEEP_ATTACK); // CraftBukkit ++ entityliving2.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SWEEP_ATTACK); // CraftBukkit // Paper - knockback events } + // CraftBukkit end + Level world = this.level(); diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java @@ -0,0 +0,0 @@ public abstract class AbstractArrow extends Projectile { - Vec3 vec3d = this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D).normalize().scale((double) this.knockback * 0.6D * d0); + Vec3 vec3d = this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D).normalize().scale(d0 * 0.6D * d1); - if (vec3d.lengthSqr() > 0.0D) { -- entityliving.push(vec3d.x, 0.1D, vec3d.z); -+ entityliving.push(vec3d.x, 0.1D, vec3d.z, this); // Paper - pass causing entity for knockback events - } - } + if (vec3d.lengthSqr() > 0.0D) { +- target.push(vec3d.x, 0.1D, vec3d.z); ++ target.push(vec3d.x, 0.1D, vec3d.z, this); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent + } + } diff --git a/src/main/java/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java b/src/main/java/net/minecraft/world/entity/projectile/windcharge/AbstractWindCharge.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -249,7 +247,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - public void push(double deltaX, double deltaY, double deltaZ) {} + public void push(double deltaX, double deltaY, double deltaZ, @org.jetbrains.annotations.Nullable Entity pushingEntity) {} // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent - public abstract void explode(); + public abstract void explode(Vec3 pos); diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/patches/unapplied/server/Add-more-Witch-API.patch b/patches/server/Add-more-Witch-API.patch similarity index 98% rename from patches/unapplied/server/Add-more-Witch-API.patch rename to patches/server/Add-more-Witch-API.patch index 718280d749..489def787d 100644 --- a/patches/unapplied/server/Add-more-Witch-API.patch +++ b/patches/server/Add-more-Witch-API.patch @@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - potion = org.bukkit.craftbukkit.event.CraftEventFactory.handleWitchReadyPotionEvent(this, potion); - this.setItemSlot(EquipmentSlot.MAINHAND, potion); - // Paper end -- this.usingTime = this.getMainHandItem().getUseDuration(); +- this.usingTime = this.getMainHandItem().getUseDuration(this); - this.setUsingItem(true); - if (!this.isSilent()) { - this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.WITCH_DRINK, this.getSoundSource(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F); @@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - - AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED); - -- attributemodifiable.removeModifier(Witch.SPEED_MODIFIER_DRINKING.id()); +- attributemodifiable.removeModifier(Witch.SPEED_MODIFIER_DRINKING_ID); - attributemodifiable.addTransientModifier(Witch.SPEED_MODIFIER_DRINKING); + this.setDrinkingPotion(PotionContents.createItemStack(Items.POTION, holder)); // Paper - logic moved into setDrinkingPotion, copy exact impl into the method and then comment out } @@ -41,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public void setDrinkingPotion(ItemStack potion) { + potion = org.bukkit.craftbukkit.event.CraftEventFactory.handleWitchReadyPotionEvent(this, potion); + this.setItemSlot(EquipmentSlot.MAINHAND, potion); -+ this.usingTime = this.getMainHandItem().getUseDuration(); ++ this.usingTime = this.getMainHandItem().getUseDuration(this); + this.setUsingItem(true); + if (!this.isSilent()) { + this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.WITCH_DRINK, this.getSoundSource(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F); @@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED); + -+ attributemodifiable.removeModifier(Witch.SPEED_MODIFIER_DRINKING.id()); ++ attributemodifiable.removeModifier(Witch.SPEED_MODIFIER_DRINKING_ID); + attributemodifiable.addTransientModifier(Witch.SPEED_MODIFIER_DRINKING); + } + // Paper end diff --git a/patches/unapplied/server/Add-more-Zombie-API.patch b/patches/server/Add-more-Zombie-API.patch similarity index 100% rename from patches/unapplied/server/Add-more-Zombie-API.patch rename to patches/server/Add-more-Zombie-API.patch diff --git a/patches/unapplied/server/Add-option-to-prevent-players-from-moving-into-unloa.patch b/patches/server/Add-option-to-prevent-players-from-moving-into-unloa.patch similarity index 98% rename from patches/unapplied/server/Add-option-to-prevent-players-from-moving-into-unloa.patch rename to patches/server/Add-option-to-prevent-players-from-moving-into-unloa.patch index b4260b34c1..2cd00a1e3f 100644 --- a/patches/unapplied/server/Add-option-to-prevent-players-from-moving-into-unloa.patch +++ b/patches/server/Add-option-to-prevent-players-from-moving-into-unloa.patch @@ -40,9 +40,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit end ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8}); @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + } - } else { - this.awaitingTeleportTime = this.tickCount; + if (!this.updateAwaitingTeleport()) { - double d0 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX(this.player.getX())); - double d1 = ServerGamePacketListenerImpl.clampVertical(packet.getY(this.player.getY())); - double d2 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ(this.player.getZ())); diff --git a/patches/unapplied/server/Add-ray-tracing-methods-to-LivingEntity.patch b/patches/server/Add-ray-tracing-methods-to-LivingEntity.patch similarity index 100% rename from patches/unapplied/server/Add-ray-tracing-methods-to-LivingEntity.patch rename to patches/server/Add-ray-tracing-methods-to-LivingEntity.patch diff --git a/patches/unapplied/server/Add-sun-related-API.patch b/patches/server/Add-sun-related-API.patch similarity index 100% rename from patches/unapplied/server/Add-sun-related-API.patch rename to patches/server/Add-sun-related-API.patch diff --git a/patches/unapplied/server/Allow-chests-to-be-placed-with-NBT-data.patch b/patches/server/Allow-chests-to-be-placed-with-NBT-data.patch similarity index 100% rename from patches/unapplied/server/Allow-chests-to-be-placed-with-NBT-data.patch rename to patches/server/Allow-chests-to-be-placed-with-NBT-data.patch diff --git a/patches/unapplied/server/Allow-disabling-armor-stand-ticking.patch b/patches/server/Allow-disabling-armor-stand-ticking.patch similarity index 100% rename from patches/unapplied/server/Allow-disabling-armor-stand-ticking.patch rename to patches/server/Allow-disabling-armor-stand-ticking.patch diff --git a/patches/unapplied/server/AnvilDamageEvent.patch b/patches/server/AnvilDamageEvent.patch similarity index 100% rename from patches/unapplied/server/AnvilDamageEvent.patch rename to patches/server/AnvilDamageEvent.patch diff --git a/patches/unapplied/server/Async-command-map-building.patch b/patches/server/Async-command-map-building.patch similarity index 100% rename from patches/unapplied/server/Async-command-map-building.patch rename to patches/server/Async-command-map-building.patch diff --git a/patches/unapplied/server/BlockDestroyEvent.patch b/patches/server/BlockDestroyEvent.patch similarity index 100% rename from patches/unapplied/server/BlockDestroyEvent.patch rename to patches/server/BlockDestroyEvent.patch diff --git a/patches/unapplied/server/Book-Size-Limits.patch b/patches/server/Book-Size-Limits.patch similarity index 97% rename from patches/unapplied/server/Book-Size-Limits.patch rename to patches/server/Book-Size-Limits.patch index 7861c9e0ad..e0c2ab7825 100644 --- a/patches/unapplied/server/Book-Size-Limits.patch +++ b/patches/server/Book-Size-Limits.patch @@ -54,4 +54,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end - Book size limits // CraftBukkit start if (this.lastBookTick + 20 > MinecraftServer.currentTick) { - this.disconnect("Book edited too quickly!"); + this.disconnect(Component.literal("Book edited too quickly!")); diff --git a/patches/unapplied/server/Break-up-and-make-tab-spam-limits-configurable.patch b/patches/server/Break-up-and-make-tab-spam-limits-configurable.patch similarity index 100% rename from patches/unapplied/server/Break-up-and-make-tab-spam-limits-configurable.patch rename to patches/server/Break-up-and-make-tab-spam-limits-configurable.patch diff --git a/patches/unapplied/server/Brigadier-Mojang-API.patch b/patches/server/Brigadier-Mojang-API.patch similarity index 100% rename from patches/unapplied/server/Brigadier-Mojang-API.patch rename to patches/server/Brigadier-Mojang-API.patch diff --git a/patches/unapplied/server/Call-player-spectator-target-events-and-improve-impl.patch b/patches/server/Call-player-spectator-target-events-and-improve-impl.patch similarity index 96% rename from patches/unapplied/server/Call-player-spectator-target-events-and-improve-impl.patch rename to patches/server/Call-player-spectator-target-events-and-improve-impl.patch index 32a4cadf5c..de414e6e96 100644 --- a/patches/unapplied/server/Call-player-spectator-target-events-and-improve-impl.patch +++ b/patches/server/Call-player-spectator-target-events-and-improve-impl.patch @@ -22,7 +22,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { this.camera = (Entity) (entity == null ? this : entity); if (entity1 != this.camera) { diff --git a/patches/unapplied/server/Check-Drowned-for-Villager-Aggression-Config.patch b/patches/server/Check-Drowned-for-Villager-Aggression-Config.patch similarity index 100% rename from patches/unapplied/server/Check-Drowned-for-Villager-Aggression-Config.patch rename to patches/server/Check-Drowned-for-Villager-Aggression-Config.patch diff --git a/patches/unapplied/server/Configurable-LootPool-luck-formula.patch b/patches/server/Configurable-LootPool-luck-formula.patch similarity index 100% rename from patches/unapplied/server/Configurable-LootPool-luck-formula.patch rename to patches/server/Configurable-LootPool-luck-formula.patch diff --git a/patches/unapplied/server/Configurable-connection-throttle-kick-message.patch b/patches/server/Configurable-connection-throttle-kick-message.patch similarity index 100% rename from patches/unapplied/server/Configurable-connection-throttle-kick-message.patch rename to patches/server/Configurable-connection-throttle-kick-message.patch diff --git a/patches/unapplied/server/Configurable-speed-for-water-flowing-over-lava.patch b/patches/server/Configurable-speed-for-water-flowing-over-lava.patch similarity index 100% rename from patches/unapplied/server/Configurable-speed-for-water-flowing-over-lava.patch rename to patches/server/Configurable-speed-for-water-flowing-over-lava.patch diff --git a/patches/unapplied/server/Don-t-allow-digging-into-unloaded-chunks.patch b/patches/server/Don-t-allow-digging-into-unloaded-chunks.patch similarity index 100% rename from patches/unapplied/server/Don-t-allow-digging-into-unloaded-chunks.patch rename to patches/server/Don-t-allow-digging-into-unloaded-chunks.patch diff --git a/patches/unapplied/server/Don-t-sleep-after-profile-lookups-if-not-needed.patch b/patches/server/Don-t-sleep-after-profile-lookups-if-not-needed.patch similarity index 100% rename from patches/unapplied/server/Don-t-sleep-after-profile-lookups-if-not-needed.patch rename to patches/server/Don-t-sleep-after-profile-lookups-if-not-needed.patch diff --git a/patches/unapplied/server/Dont-block-Player-remove-if-the-handle-is-a-custom-p.patch b/patches/server/Dont-block-Player-remove-if-the-handle-is-a-custom-p.patch similarity index 100% rename from patches/unapplied/server/Dont-block-Player-remove-if-the-handle-is-a-custom-p.patch rename to patches/server/Dont-block-Player-remove-if-the-handle-is-a-custom-p.patch diff --git a/patches/unapplied/server/EnderDragon-Events.patch b/patches/server/EnderDragon-Events.patch similarity index 98% rename from patches/unapplied/server/EnderDragon-Events.patch rename to patches/server/EnderDragon-Events.patch index 853f3b4f57..2b49c0c29a 100644 --- a/patches/unapplied/server/EnderDragon-Events.patch +++ b/patches/server/EnderDragon-Events.patch @@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java @@ -0,0 +0,0 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance { - DragonFireball dragonFireball = new DragonFireball(this.dragon.level(), this.dragon, r, s, t); + DragonFireball dragonFireball = new DragonFireball(this.dragon.level(), this.dragon, vec34.normalize()); dragonFireball.moveTo(o, p, q, 0.0F, 0.0F); + if (new com.destroystokyo.paper.event.entity.EnderDragonShootFireballEvent((org.bukkit.entity.EnderDragon) dragon.getBukkitEntity(), (org.bukkit.entity.DragonFireball) dragonFireball.getBukkitEntity()).callEvent()) // Paper - EnderDragon Events this.dragon.level().addFreshEntity(dragonFireball); diff --git a/patches/unapplied/server/Expand-ArmorStand-API.patch b/patches/server/Expand-ArmorStand-API.patch similarity index 100% rename from patches/unapplied/server/Expand-ArmorStand-API.patch rename to patches/server/Expand-ArmorStand-API.patch diff --git a/patches/unapplied/server/Expand-Explosions-API.patch b/patches/server/Expand-Explosions-API.patch similarity index 100% rename from patches/unapplied/server/Expand-Explosions-API.patch rename to patches/server/Expand-Explosions-API.patch diff --git a/patches/unapplied/server/Expose-attack-cooldown-methods-for-Player.patch b/patches/server/Expose-attack-cooldown-methods-for-Player.patch similarity index 100% rename from patches/unapplied/server/Expose-attack-cooldown-methods-for-Player.patch rename to patches/server/Expose-attack-cooldown-methods-for-Player.patch diff --git a/patches/unapplied/server/Fix-CraftEntity-hashCode.patch b/patches/server/Fix-CraftEntity-hashCode.patch similarity index 100% rename from patches/unapplied/server/Fix-CraftEntity-hashCode.patch rename to patches/server/Fix-CraftEntity-hashCode.patch diff --git a/patches/unapplied/server/Fix-NBT-type-issues.patch b/patches/server/Fix-NBT-type-issues.patch similarity index 100% rename from patches/unapplied/server/Fix-NBT-type-issues.patch rename to patches/server/Fix-NBT-type-issues.patch diff --git a/patches/unapplied/server/Fix-SpongeAbsortEvent-handling.patch b/patches/server/Fix-SpongeAbsortEvent-handling.patch similarity index 100% rename from patches/unapplied/server/Fix-SpongeAbsortEvent-handling.patch rename to patches/server/Fix-SpongeAbsortEvent-handling.patch diff --git a/patches/unapplied/server/Honor-EntityAgeable.ageLock.patch b/patches/server/Honor-EntityAgeable.ageLock.patch similarity index 100% rename from patches/unapplied/server/Honor-EntityAgeable.ageLock.patch rename to patches/server/Honor-EntityAgeable.ageLock.patch diff --git a/patches/unapplied/server/Implement-World.getEntity-UUID-API.patch b/patches/server/Implement-World.getEntity-UUID-API.patch similarity index 100% rename from patches/unapplied/server/Implement-World.getEntity-UUID-API.patch rename to patches/server/Implement-World.getEntity-UUID-API.patch diff --git a/patches/unapplied/server/Implement-furnace-cook-speed-multiplier-API.patch b/patches/server/Implement-furnace-cook-speed-multiplier-API.patch similarity index 87% rename from patches/unapplied/server/Implement-furnace-cook-speed-multiplier-API.patch rename to patches/server/Implement-furnace-cook-speed-multiplier-API.patch index 3a13e67e92..8f99cc1d0b 100644 --- a/patches/unapplied/server/Implement-furnace-cook-speed-multiplier-API.patch +++ b/patches/server/Implement-furnace-cook-speed-multiplier-API.patch @@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit protected final ContainerData dataAccess; public final Object2IntOpenHashMap<ResourceLocation> recipesUsed; - private final RecipeManager.CachedCheck<Container, ? extends AbstractCookingRecipe> quickCheck; + private final RecipeManager.CachedCheck<SingleRecipeInput, ? extends AbstractCookingRecipe> quickCheck; + public final RecipeType<? extends AbstractCookingRecipe> recipeType; // Paper - cook speed multiplier API protected AbstractFurnaceBlockEntity(BlockEntityType<?> blockEntityType, BlockPos pos, BlockState state, RecipeType<? extends AbstractCookingRecipe> recipeType) { @@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static void invalidateCache() { @@ -0,0 +0,0 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit - this.recipesUsed.put(new ResourceLocation(s), nbttagcompound1.getInt(s)); + this.recipesUsed.put(ResourceLocation.parse(s), nbttagcompound1.getInt(s)); } + // Paper start - cook speed multiplier API @@ -83,13 +83,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - private static int getTotalCookTime(Level world, AbstractFurnaceBlockEntity furnace) { - if (world == null) return 200; // CraftBukkit - SPIGOT-4302 -- return (Integer) furnace.quickCheck.getRecipeFor(furnace, world).map((recipeholder) -> { ++ private static int getTotalCookTime(@Nullable Level world, RecipeType<? extends AbstractCookingRecipe> recipeType, AbstractFurnaceBlockEntity furnace, double cookSpeedMultiplier) { // Paper - cook speed multiplier API + SingleRecipeInput singlerecipeinput = new SingleRecipeInput(furnace.getItem(0)); + +- return (Integer) furnace.quickCheck.getRecipeFor(singlerecipeinput, world).map((recipeholder) -> { - return ((AbstractCookingRecipe) recipeholder.value()).getCookingTime(); - }).orElse(200); -+ // Paper start - cook speed multiplier API -+ public static int getTotalCookTime(@Nullable Level world, RecipeType<? extends AbstractCookingRecipe> recipeType, AbstractFurnaceBlockEntity furnace, double cookSpeedMultiplier) { ++ // Paper start - cook speed multiplier API + /* Scale the recipe's cooking time to the current cookSpeedMultiplier */ -+ int cookTime = world != null ? furnace.quickCheck.getRecipeFor(furnace, world).map(holder -> holder.value().getCookingTime()).orElse(200) : (net.minecraft.server.MinecraftServer.getServer().getRecipeManager().getRecipeFor(recipeType, furnace, world /* passing a null level here is safe. world is only used for map extending recipes which won't happen here */).map(holder -> holder.value().getCookingTime()).orElse(200)); ++ int cookTime = world != null ? furnace.quickCheck.getRecipeFor(singlerecipeinput, world).map(holder -> holder.value().getCookingTime()).orElse(200) : (net.minecraft.server.MinecraftServer.getServer().getRecipeManager().getRecipeFor(recipeType, singlerecipeinput, world /* passing a null level here is safe. world is only used for map extending recipes which won't happen here */).map(holder -> holder.value().getCookingTime()).orElse(200)); + return (int) Math.ceil (cookTime / cookSpeedMultiplier); + // Paper end - cook speed multiplier API } diff --git a/patches/unapplied/server/Improve-BlockPosition-inlining.patch b/patches/server/Improve-BlockPosition-inlining.patch similarity index 100% rename from patches/unapplied/server/Improve-BlockPosition-inlining.patch rename to patches/server/Improve-BlockPosition-inlining.patch diff --git a/patches/unapplied/server/Improve-EntityShootBowEvent.patch b/patches/server/Improve-EntityShootBowEvent.patch similarity index 100% rename from patches/unapplied/server/Improve-EntityShootBowEvent.patch rename to patches/server/Improve-EntityShootBowEvent.patch diff --git a/patches/unapplied/server/Improve-Server-Thread-Pool-and-Thread-Priorities.patch b/patches/server/Improve-Server-Thread-Pool-and-Thread-Priorities.patch similarity index 100% rename from patches/unapplied/server/Improve-Server-Thread-Pool-and-Thread-Priorities.patch rename to patches/server/Improve-Server-Thread-Pool-and-Thread-Priorities.patch diff --git a/patches/unapplied/server/Improve-death-events.patch b/patches/server/Improve-death-events.patch similarity index 81% rename from patches/unapplied/server/Improve-death-events.patch rename to patches/server/Improve-death-events.patch index 6e1969f9d3..dc092408dc 100644 --- a/patches/unapplied/server/Improve-death-events.patch +++ b/patches/server/Improve-death-events.patch @@ -22,7 +22,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { private int containerCounter; public boolean wonGame; private int containerUpdateDelay; // Paper - Configurable container update tick rate @@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit start public CraftPlayer.TransferCookieConnection transferCookieConnection; -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @Override public void die(DamageSource damageSource) { @@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 boolean flag = this.level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES); // CraftBukkit start - fire PlayerDeathEvent if (this.isRemoved()) { -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { String deathmessage = defaultMessage.getString(); this.keepLevel = keepInventory; // SPIGOT-2222: pre-set keepLevel org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, damageSource, loot, PaperAdventure.asAdventure(defaultMessage), keepInventory); // Paper - Adventure @@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // SPIGOT-943 - only call if they have an inventory open if (this.containerMenu != this.inventoryMenu) { -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { } } } @@ -131,7 +131,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper - move below into if for onKill + + // Paper start -+ org.bukkit.event.entity.EntityDeathEvent deathEvent = this.dropAllDeathLoot(damageSource); ++ org.bukkit.event.entity.EntityDeathEvent deathEvent = this.dropAllDeathLoot(worldserver, damageSource); + if (deathEvent == null || !deathEvent.isCancelled()) { + if (this.deathScore >= 0 && entityliving != null) { + entityliving.awardKillScore(this, this.deathScore, damageSource); @@ -148,32 +148,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (this.isSleeping()) { + this.stopSleeping(); + } -+ + +- if (entity == null || entity.killedEntity(worldserver, this)) { + if (!this.level().isClientSide && this.hasCustomName()) { + if (org.spigotmc.SpigotConfig.logNamedDeaths) LivingEntity.LOGGER.info("Named entity {} died: {}", this, this.getCombatTracker().getDeathMessage().getString()); // Spigot + } - -- if (entity == null || entity.killedEntity(worldserver, this)) { ++ + this.getCombatTracker().recheckStatus(); + if (entity != null) { + entity.killedEntity((ServerLevel) this.level(), this); + } this.gameEvent(GameEvent.ENTITY_DIE); -- this.dropAllDeathLoot(damageSource); -- this.createWitherRose(entityliving); +- this.dropAllDeathLoot(worldserver, damageSource); + } else { + this.dead = false; + this.setHealth((float) deathEvent.getReviveHealth()); - } - -- this.level().broadcastEntityEvent(this, (byte) 3); ++ } + // Paper end -+ this.createWitherRose(entityliving); - } + this.createWitherRose(entityliving); + } + // Paper start + if (this.dead) { // Paper -+ this.level().broadcastEntityEvent(this, (byte) 3); + this.level().broadcastEntityEvent(this, (byte) 3); +- } + this.setPose(Pose.DYING); + } + // Paper end @@ -193,49 +192,47 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -- protected void dropAllDeathLoot(DamageSource source) { +- protected void dropAllDeathLoot(ServerLevel world, DamageSource damageSource) { + // Paper start + protected boolean clearEquipmentSlots = true; + protected Set<EquipmentSlot> clearedEquipmentSlots = new java.util.HashSet<>(); -+ protected org.bukkit.event.entity.EntityDeathEvent dropAllDeathLoot(DamageSource source) { -+ // Paper end - Entity entity = source.getEntity(); - int i; ++ protected org.bukkit.event.entity.EntityDeathEvent dropAllDeathLoot(ServerLevel world, DamageSource damageSource) { ++ // Paper end + boolean flag = this.lastHurtByPlayerTime > 0; -@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { this.dropEquipment(); // CraftBukkit - from below - if (this.shouldDropLoot() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { - this.dropFromLootTable(source, flag); + if (this.shouldDropLoot() && world.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { + this.dropFromLootTable(damageSource, flag); + // Paper start + final boolean prev = this.clearEquipmentSlots; + this.clearEquipmentSlots = false; + this.clearedEquipmentSlots.clear(); + // Paper end - this.dropCustomDeathLoot(source, i, flag); + this.dropCustomDeathLoot(world, damageSource, flag); + this.clearEquipmentSlots = prev; // Paper } // CraftBukkit start - Call death event -- CraftEventFactory.callEntityDeathEvent(this, source, this.drops); -+ org.bukkit.event.entity.EntityDeathEvent deathEvent = CraftEventFactory.callEntityDeathEvent(this, source, this.drops); // Paper +- CraftEventFactory.callEntityDeathEvent(this, damageSource, this.drops); ++ org.bukkit.event.entity.EntityDeathEvent deathEvent = CraftEventFactory.callEntityDeathEvent(this, damageSource, this.drops); // Paper + this.postDeathDropItems(deathEvent); // Paper this.drops = new ArrayList<>(); // CraftBukkit end - // this.dropInventory();// CraftBukkit - moved up - this.dropExperience(); + // this.dropEquipment();// CraftBukkit - moved up + this.dropExperience(damageSource.getEntity()); + return deathEvent; // Paper } protected void dropEquipment() {} + protected void postDeathDropItems(org.bukkit.event.entity.EntityDeathEvent event) {} // Paper - method for post death logic that cannot be ran before the event is potentially cancelled - // CraftBukkit start - public int getExpReward() { + public int getExpReward(@Nullable Entity entity) { // CraftBukkit + Level world = this.level(); diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti +@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } @@ -246,30 +243,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end + @Override - protected void dropCustomDeathLoot(DamageSource source, int lootingMultiplier, boolean allowDrops) { - super.dropCustomDeathLoot(source, lootingMultiplier, allowDrops); -@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti + protected void dropCustomDeathLoot(ServerLevel world, DamageSource source, boolean causedByPlayer) { + super.dropCustomDeathLoot(world, source, causedByPlayer); +@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab - for (int k = 0; k < j; ++k) { - EquipmentSlot enumitemslot = aenumitemslot[k]; + for (int j = 0; j < i; ++j) { + EquipmentSlot enumitemslot = aenumitemslot[j]; + if (this.shouldSkipLoot(enumitemslot)) continue; // Paper ItemStack itemstack = this.getItemBySlot(enumitemslot); float f = this.getEquipmentDropChance(enumitemslot); - boolean flag1 = f > 1.0F; -@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti - } - this.spawnAtLocation(itemstack); -+ if (this.clearEquipmentSlots) { // Paper - this.setItemSlot(enumitemslot, ItemStack.EMPTY); -+ // Paper start -+ } else { -+ this.clearedEquipmentSlots.add(enumitemslot); -+ } -+ // Paper end +@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab + } + + this.spawnAtLocation(itemstack); ++ if (this.clearEquipmentSlots) { // Paper + this.setItemSlot(enumitemslot, ItemStack.EMPTY); ++ // Paper start ++ } else { ++ this.clearedEquipmentSlots.add(enumitemslot); ++ } ++ // Paper end + } } } - diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Fox.java @@ -280,7 +277,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - handle the bitten item separately like vanilla @Override -- protected void dropAllDeathLoot(DamageSource source) { +- protected void dropAllDeathLoot(ServerLevel world, DamageSource damageSource) { + protected boolean shouldSkipLoot(EquipmentSlot slot) { + return slot == EquipmentSlot.MAINHAND; + } @@ -288,7 +285,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + @Override + // Paper start - Cancellable death event -+ protected org.bukkit.event.entity.EntityDeathEvent dropAllDeathLoot(DamageSource source) { ++ protected org.bukkit.event.entity.EntityDeathEvent dropAllDeathLoot(ServerLevel world, DamageSource damageSource) { ItemStack itemstack = this.getItemBySlot(EquipmentSlot.MAINHAND); - if (!itemstack.isEmpty()) { @@ -298,7 +295,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + releaseMouth = true; + } + -+ org.bukkit.event.entity.EntityDeathEvent deathEvent = super.dropAllDeathLoot(source); ++ org.bukkit.event.entity.EntityDeathEvent deathEvent = super.dropAllDeathLoot(world, damageSource); + + // Below is code to drop + @@ -311,7 +308,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY); } -- super.dropAllDeathLoot(source); +- super.dropAllDeathLoot(world, damageSource); + return deathEvent; // Paper - Cancellable death event } @@ -343,38 +340,38 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java @@ -0,0 +0,0 @@ public class ArmorStand extends LivingEntity { - } - // CraftBukkit end - if (source.is(DamageTypeTags.IS_EXPLOSION)) { -- this.brokenByAnything(source); -- this.kill(source); // CraftBukkit -+ // Paper start - avoid duplicate event call -+ org.bukkit.event.entity.EntityDeathEvent event = this.brokenByAnything(source); -+ if (!event.isCancelled()) this.kill(source, false); // CraftBukkit -+ // Paper end - return false; - } else if (source.is(DamageTypeTags.IGNITES_ARMOR_STANDS)) { - if (this.isOnFire()) { + } + // CraftBukkit end + if (source.is(DamageTypeTags.IS_EXPLOSION)) { +- this.brokenByAnything(worldserver, source); +- this.kill(source); // CraftBukkit ++ // Paper start - avoid duplicate event call ++ org.bukkit.event.entity.EntityDeathEvent event = this.brokenByAnything(worldserver, source); ++ if (!event.isCancelled()) this.kill(source, false); // CraftBukkit ++ // Paper end + return false; + } else if (source.is(DamageTypeTags.IGNITES_ARMOR_STANDS)) { + if (this.isOnFire()) { @@ -0,0 +0,0 @@ public class ArmorStand extends LivingEntity { - this.gameEvent(GameEvent.ENTITY_DAMAGE, source.getEntity()); - this.lastHit = i; - } else { -- this.brokenByPlayer(source); -+ org.bukkit.event.entity.EntityDeathEvent event = this.brokenByPlayer(source); // Paper - this.showBreakingParticles(); -- this.discard(EntityRemoveEvent.Cause.DEATH); // CraftBukkit - SPIGOT-4890: remain as this.discard() since above damagesource method will call death event -+ if (!event.isCancelled()) this.kill(source, false); // Paper - we still need to kill to follow vanilla logic (emit the game event etc...) - } + this.gameEvent(GameEvent.ENTITY_DAMAGE, source.getEntity()); + this.lastHit = i; + } else { +- this.brokenByPlayer(worldserver, source); ++ org.bukkit.event.entity.EntityDeathEvent event = this.brokenByPlayer(worldserver, source); // Paper + this.showBreakingParticles(); +- this.discard(EntityRemoveEvent.Cause.DEATH); // CraftBukkit - SPIGOT-4890: remain as this.discard() since above damagesource method will call death event ++ if (!event.isCancelled()) this.kill(source, false); // Paper - we still need to kill to follow vanilla logic (emit the game event etc...) + } - return true; + return true; @@ -0,0 +0,0 @@ public class ArmorStand extends LivingEntity { f1 -= amount; if (f1 <= 0.5F) { -- this.brokenByAnything(damageSource); +- this.brokenByAnything(world, damageSource); - this.kill(damageSource); // CraftBukkit + // Paper start - avoid duplicate event call -+ org.bukkit.event.entity.EntityDeathEvent event = this.brokenByAnything(damageSource); ++ org.bukkit.event.entity.EntityDeathEvent event = this.brokenByAnything(world, damageSource); + if (!event.isCancelled()) this.kill(damageSource, false); // CraftBukkit + // Paper end } else { @@ -384,27 +381,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } -- private void brokenByPlayer(DamageSource damageSource) { -+ private org.bukkit.event.entity.EntityDeathEvent brokenByPlayer(DamageSource damageSource) { // Paper +- private void brokenByPlayer(ServerLevel world, DamageSource damageSource) { ++ private org.bukkit.event.entity.EntityDeathEvent brokenByPlayer(ServerLevel world, DamageSource damageSource) { // Paper ItemStack itemstack = new ItemStack(Items.ARMOR_STAND); itemstack.set(DataComponents.CUSTOM_NAME, this.getCustomName()); this.drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops -- this.brokenByAnything(damageSource); -+ return this.brokenByAnything(damageSource); // Paper +- this.brokenByAnything(world, damageSource); ++ return this.brokenByAnything(world, damageSource); // Paper } -- private void brokenByAnything(DamageSource damageSource) { -+ private org.bukkit.event.entity.EntityDeathEvent brokenByAnything(DamageSource damageSource) { // Paper +- private void brokenByAnything(ServerLevel world, DamageSource damageSource) { ++ private org.bukkit.event.entity.EntityDeathEvent brokenByAnything(ServerLevel world, DamageSource damageSource) { // Paper this.playBrokenSound(); - // this.dropAllDeathLoot(damagesource); // CraftBukkit - moved down + // this.dropAllDeathLoot(worldserver, damagesource); // CraftBukkit - moved down @@ -0,0 +0,0 @@ public class ArmorStand extends LivingEntity { this.armorItems.set(i, ItemStack.EMPTY); } } -- this.dropAllDeathLoot(damageSource); // CraftBukkit - moved from above -+ return this.dropAllDeathLoot(damageSource); // CraftBukkit - moved from above // Paper +- this.dropAllDeathLoot(world, damageSource); // CraftBukkit - moved from above ++ return this.dropAllDeathLoot(world, damageSource); // CraftBukkit - moved from above // Paper } @@ -452,7 +449,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class CraftEventFactory { CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity(); CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource); - EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward()); + EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity())); + populateFields(victim, event); // Paper - make cancellable CraftWorld world = (CraftWorld) entity.getWorld(); Bukkit.getServer().getPluginManager().callEvent(event); @@ -467,7 +464,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 for (org.bukkit.inventory.ItemStack stack : event.getDrops()) { @@ -0,0 +0,0 @@ public class CraftEventFactory { - PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(), 0, deathMessage); + PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity()), 0, deathMessage); event.setKeepInventory(keepInventory); event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel + populateFields(victim, event); // Paper - make cancellable diff --git a/patches/unapplied/server/Improve-exact-choice-recipe-ingredients.patch b/patches/server/Improve-exact-choice-recipe-ingredients.patch similarity index 83% rename from patches/unapplied/server/Improve-exact-choice-recipe-ingredients.patch rename to patches/server/Improve-exact-choice-recipe-ingredients.patch index ff13af1719..73dadf0ca9 100644 --- a/patches/unapplied/server/Improve-exact-choice-recipe-ingredients.patch +++ b/patches/server/Improve-exact-choice-recipe-ingredients.patch @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.Recipe; + -+public abstract class RecipeBookExactChoiceRecipe<C extends Container> implements Recipe<C> { ++public abstract class RecipeBookExactChoiceRecipe<C extends net.minecraft.world.item.crafting.RecipeInput> implements Recipe<C> { + + private boolean hasExactIngredients; + @@ -146,15 +146,15 @@ diff --git a/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java b/src index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java +++ b/src/main/java/net/minecraft/recipebook/ServerPlaceRecipe.java -@@ -0,0 +0,0 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ +@@ -0,0 +0,0 @@ public class ServerPlaceRecipe<I extends RecipeInput, R extends Recipe<I>> imple this.inventory = entity.getInventory(); if (this.testClearGrid() || entity.isCreative()) { this.stackedContents.clear(); + this.stackedContents.initialize(recipe.value()); // Paper - Improve exact choice recipe ingredients entity.getInventory().fillStackedContents(this.stackedContents); this.menu.fillCraftSlotsStackedContents(this.stackedContents); - if (this.stackedContents.canCraft((Recipe<?>)recipe.value(), null)) { -@@ -0,0 +0,0 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ + if (this.stackedContents.canCraft(recipe.value(), null)) { +@@ -0,0 +0,0 @@ public class ServerPlaceRecipe<I extends RecipeInput, R extends Recipe<I>> imple int l = k; for (int m : intList) { @@ -163,46 +163,48 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!itemStack2.isEmpty()) { int n = itemStack2.getMaxStackSize(); if (n < l) { -@@ -0,0 +0,0 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ +@@ -0,0 +0,0 @@ public class ServerPlaceRecipe<I extends RecipeInput, R extends Recipe<I>> imple @Override - public void addItemToSlot(Iterator<Integer> inputs, int slot, int amount, int gridX, int gridY) { + public void addItemToSlot(Integer input, int slot, int amount, int gridX, int gridY) { Slot slot2 = this.menu.getSlot(slot); -- ItemStack itemStack = StackedContents.fromStackingIndex(inputs.next()); +- ItemStack itemStack = StackedContents.fromStackingIndex(input); + // Paper start - Improve exact choice recipe ingredients -+ final int itemId = inputs.next(); + ItemStack itemStack = null; + boolean isExact = false; -+ if (this.stackedContents.extrasMap != null && itemId >= net.minecraft.core.registries.BuiltInRegistries.ITEM.size()) { -+ itemStack = StackedContents.fromStackingIndexExtras(itemId, this.stackedContents.extrasMap).copy(); ++ if (this.stackedContents.extrasMap != null && input >= net.minecraft.core.registries.BuiltInRegistries.ITEM.size()) { ++ itemStack = StackedContents.fromStackingIndexExtras(input, this.stackedContents.extrasMap).copy(); + isExact = true; + } + if (itemStack == null) { -+ itemStack = StackedContents.fromStackingIndex(itemId); ++ itemStack = StackedContents.fromStackingIndex(input); + } + // Paper end - Improve exact choice recipe ingredients if (!itemStack.isEmpty()) { - for (int i = 0; i < amount; i++) { -- this.moveItemToGrid(slot2, itemStack); -+ this.moveItemToGrid(slot2, itemStack, isExact); // Paper - Improve exact choice recipe ingredients - } - } - } -@@ -0,0 +0,0 @@ public class ServerPlaceRecipe<C extends Container> implements PlaceRecipe<Integ + int i = amount; + + while (i > 0) { +- i = this.moveItemToGrid(slot2, itemStack, i); ++ i = this.moveItemToGrid(slot2, itemStack, i, isExact); // Paper - Improve exact choice recipe ingredients + if (i == -1) { + return; + } +@@ -0,0 +0,0 @@ public class ServerPlaceRecipe<I extends RecipeInput, R extends Recipe<I>> imple return i; } + @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - Improve exact choice recipe ingredients - protected void moveItemToGrid(Slot slot, ItemStack stack) { -- int i = this.inventory.findSlotMatchingUnusedItem(stack); ++ + protected int moveItemToGrid(Slot slot, ItemStack stack, int i) { +- int j = this.inventory.findSlotMatchingUnusedItem(stack); + // Paper start - Improve exact choice recipe ingredients -+ this.moveItemToGrid(slot, stack, false); ++ return this.moveItemToGrid(slot, stack, i, false); + } -+ protected void moveItemToGrid(Slot slot, ItemStack stack, final boolean isExact) { -+ int i = isExact ? this.inventory.findSlotMatchingItem(stack) : this.inventory.findSlotMatchingUnusedItem(stack); ++ protected int moveItemToGrid(Slot slot, ItemStack stack, int i, final boolean isExact) { ++ int j = isExact ? this.inventory.findSlotMatchingItem(stack) : this.inventory.findSlotMatchingUnusedItem(stack); + // Paper end - Improve exact choice recipe ingredients - if (i != -1) { - ItemStack itemStack = this.inventory.getItem(i); - if (!itemStack.isEmpty()) { + if (j == -1) { + return -1; + } else { diff --git a/src/main/java/net/minecraft/world/entity/player/StackedContents.java b/src/main/java/net/minecraft/world/entity/player/StackedContents.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/player/StackedContents.java @@ -299,16 +301,16 @@ diff --git a/src/main/java/net/minecraft/world/item/crafting/AbstractCookingReci index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java +++ b/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java -@@ -0,0 +0,0 @@ import net.minecraft.world.Container; +@@ -0,0 +0,0 @@ import net.minecraft.core.NonNullList; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; --public abstract class AbstractCookingRecipe implements Recipe<Container> { -+public abstract class AbstractCookingRecipe extends io.papermc.paper.inventory.recipe.RecipeBookExactChoiceRecipe<Container> implements Recipe<Container> { // Paper - improve exact recipe choices +-public abstract class AbstractCookingRecipe implements Recipe<SingleRecipeInput> { ++public abstract class AbstractCookingRecipe extends io.papermc.paper.inventory.recipe.RecipeBookExactChoiceRecipe<SingleRecipeInput> implements Recipe<SingleRecipeInput> { // Paper - improve exact recipe choices protected final RecipeType<?> type; protected final CookingBookCategory category; protected final String group; -@@ -0,0 +0,0 @@ public abstract class AbstractCookingRecipe implements Recipe<Container> { +@@ -0,0 +0,0 @@ public abstract class AbstractCookingRecipe implements Recipe<SingleRecipeInput> this.result = result; this.experience = experience; this.cookingTime = cookingTime; @@ -320,7 +322,7 @@ diff --git a/src/main/java/net/minecraft/world/item/crafting/Recipe.java b/src/m index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/crafting/Recipe.java +++ b/src/main/java/net/minecraft/world/item/crafting/Recipe.java -@@ -0,0 +0,0 @@ public interface Recipe<C extends Container> { +@@ -0,0 +0,0 @@ public interface Recipe<T extends RecipeInput> { } org.bukkit.inventory.Recipe toBukkitRecipe(org.bukkit.NamespacedKey id); // CraftBukkit @@ -340,7 +342,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit end -public class ShapedRecipe implements CraftingRecipe { -+public class ShapedRecipe extends io.papermc.paper.inventory.recipe.RecipeBookExactChoiceRecipe<CraftingContainer> implements CraftingRecipe { // Paper - improve exact recipe choices ++public class ShapedRecipe extends io.papermc.paper.inventory.recipe.RecipeBookExactChoiceRecipe<CraftingInput> implements CraftingRecipe { // Paper - improve exact recipe choices final ShapedRecipePattern pattern; final ItemStack result; @@ -361,7 +363,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit end -public class ShapelessRecipe implements CraftingRecipe { -+public class ShapelessRecipe extends io.papermc.paper.inventory.recipe.RecipeBookExactChoiceRecipe<CraftingContainer> implements CraftingRecipe { // Paper - improve exact recipe choices ++public class ShapelessRecipe extends io.papermc.paper.inventory.recipe.RecipeBookExactChoiceRecipe<CraftingInput> implements CraftingRecipe { // Paper - improve exact recipe choices final String group; final CraftingBookCategory category; @@ -374,10 +376,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit start @@ -0,0 +0,0 @@ public class ShapelessRecipe implements CraftingRecipe { + } - public boolean matches(CraftingContainer inventory, Level world) { - StackedContents autorecipestackmanager = new StackedContents(); -+ autorecipestackmanager.initialize(this); // Paper - better exact choice recipes - int i = 0; + public boolean matches(CraftingInput input, Level world) { +- return input.ingredientCount() != this.ingredients.size() ? false : (input.size() == 1 && this.ingredients.size() == 1 ? ((Ingredient) this.ingredients.getFirst()).test(input.getItem(0)) : input.stackedContents().canCraft(this, (IntList) null)); ++ // Paper start - unwrap ternary & better exact choice recipes ++ if (input.ingredientCount() != this.ingredients.size()) { ++ return false; ++ } ++ if (input.size() == 1 && this.ingredients.size() == 1) { ++ return this.ingredients.getFirst().test(input.getItem(0)); ++ } ++ input.stackedContents().initialize(this); // setup stacked contents for this recipe ++ return input.stackedContents().canCraft(this, null); ++ // Paper end - unwrap ternary & better exact choice recipes + } - for (int j = 0; j < inventory.getContainerSize(); ++j) { + public ItemStack assemble(CraftingInput input, HolderLookup.Provider lookup) { diff --git a/patches/unapplied/server/Inventory-removeItemAnySlot.patch b/patches/server/Inventory-removeItemAnySlot.patch similarity index 100% rename from patches/unapplied/server/Inventory-removeItemAnySlot.patch rename to patches/server/Inventory-removeItemAnySlot.patch diff --git a/patches/unapplied/server/InventoryCloseEvent-Reason-API.patch b/patches/server/InventoryCloseEvent-Reason-API.patch similarity index 97% rename from patches/unapplied/server/InventoryCloseEvent-Reason-API.patch rename to patches/server/InventoryCloseEvent-Reason-API.patch index f2c7abd3e0..cbebea7f83 100644 --- a/patches/unapplied/server/InventoryCloseEvent-Reason-API.patch +++ b/patches/server/InventoryCloseEvent-Reason-API.patch @@ -32,7 +32,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { } // Paper end - Configurable container update tick rate if (!this.level().isClientSide && !this.containerMenu.stillValid(this)) { @@ -41,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.containerMenu = this.inventoryMenu; } -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { // SPIGOT-943 - only call if they have an inventory open if (this.containerMenu != this.inventoryMenu) { @@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } net.kyori.adventure.text.Component deathMessage = event.deathMessage() != null ? event.deathMessage() : net.kyori.adventure.text.Component.empty(); // Paper - Adventure -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { } // CraftBukkit end if (this.containerMenu != this.inventoryMenu) { @@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // this.nextContainerCounter(); // CraftBukkit - moved up -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @Override public void closeContainer() { diff --git a/patches/unapplied/server/LivingEntity-Active-Item-API.patch b/patches/server/LivingEntity-Active-Item-API.patch similarity index 100% rename from patches/unapplied/server/LivingEntity-Active-Item-API.patch rename to patches/server/LivingEntity-Active-Item-API.patch diff --git a/patches/unapplied/server/Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch b/patches/server/Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch similarity index 100% rename from patches/unapplied/server/Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch rename to patches/server/Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch diff --git a/patches/unapplied/server/Make-shield-blocking-delay-configurable.patch b/patches/server/Make-shield-blocking-delay-configurable.patch similarity index 90% rename from patches/unapplied/server/Make-shield-blocking-delay-configurable.patch rename to patches/server/Make-shield-blocking-delay-configurable.patch index f2467f47ac..022c391eda 100644 --- a/patches/unapplied/server/Make-shield-blocking-delay-configurable.patch +++ b/patches/server/Make-shield-blocking-delay-configurable.patch @@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.isUsingItem() && !this.useItem.isEmpty()) { Item item = this.useItem.getItem(); -- return item.getUseAnimation(this.useItem) != UseAnim.BLOCK ? false : item.getUseDuration(this.useItem) - this.useItemRemaining >= 5; -+ return item.getUseAnimation(this.useItem) != UseAnim.BLOCK ? false : item.getUseDuration(this.useItem) - this.useItemRemaining >= getShieldBlockingDelay(); // Paper - Make shield blocking delay configurable +- return item.getUseAnimation(this.useItem) != UseAnim.BLOCK ? false : item.getUseDuration(this.useItem, this) - this.useItemRemaining >= 5; ++ return item.getUseAnimation(this.useItem) != UseAnim.BLOCK ? false : item.getUseDuration(this.useItem, this) - this.useItemRemaining >= getShieldBlockingDelay(); // Paper - Make shield blocking delay configurable } else { return false; } diff --git a/patches/unapplied/server/Make-the-default-permission-message-configurable.patch b/patches/server/Make-the-default-permission-message-configurable.patch similarity index 100% rename from patches/unapplied/server/Make-the-default-permission-message-configurable.patch rename to patches/server/Make-the-default-permission-message-configurable.patch diff --git a/patches/unapplied/server/Mob-Pathfinding-API.patch b/patches/server/Mob-Pathfinding-API.patch similarity index 100% rename from patches/unapplied/server/Mob-Pathfinding-API.patch rename to patches/server/Mob-Pathfinding-API.patch diff --git a/patches/unapplied/server/Optimize-BlockPosition-helper-methods.patch b/patches/server/Optimize-BlockPosition-helper-methods.patch similarity index 100% rename from patches/unapplied/server/Optimize-BlockPosition-helper-methods.patch rename to patches/server/Optimize-BlockPosition-helper-methods.patch diff --git a/patches/unapplied/server/Optimize-CraftBlockData-Creation.patch b/patches/server/Optimize-CraftBlockData-Creation.patch similarity index 100% rename from patches/unapplied/server/Optimize-CraftBlockData-Creation.patch rename to patches/server/Optimize-CraftBlockData-Creation.patch diff --git a/patches/unapplied/server/Optimize-MappedRegistry.patch b/patches/server/Optimize-MappedRegistry.patch similarity index 100% rename from patches/unapplied/server/Optimize-MappedRegistry.patch rename to patches/server/Optimize-MappedRegistry.patch diff --git a/patches/unapplied/server/Optimize-World-Time-Updates.patch b/patches/server/Optimize-World-Time-Updates.patch similarity index 100% rename from patches/unapplied/server/Optimize-World-Time-Updates.patch rename to patches/server/Optimize-World-Time-Updates.patch diff --git a/patches/unapplied/server/Option-to-prevent-armor-stands-from-doing-entity-loo.patch b/patches/server/Option-to-prevent-armor-stands-from-doing-entity-loo.patch similarity index 100% rename from patches/unapplied/server/Option-to-prevent-armor-stands-from-doing-entity-loo.patch rename to patches/server/Option-to-prevent-armor-stands-from-doing-entity-loo.patch diff --git a/patches/unapplied/server/PlayerElytraBoostEvent.patch b/patches/server/PlayerElytraBoostEvent.patch similarity index 100% rename from patches/unapplied/server/PlayerElytraBoostEvent.patch rename to patches/server/PlayerElytraBoostEvent.patch diff --git a/patches/unapplied/server/PlayerLaunchProjectileEvent.patch b/patches/server/PlayerLaunchProjectileEvent.patch similarity index 89% rename from patches/unapplied/server/PlayerLaunchProjectileEvent.patch rename to patches/server/PlayerLaunchProjectileEvent.patch index 71471ef512..239f18a044 100644 --- a/patches/unapplied/server/PlayerLaunchProjectileEvent.patch +++ b/patches/server/PlayerLaunchProjectileEvent.patch @@ -291,29 +291,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/item/TridentItem.java +++ b/src/main/java/net/minecraft/world/item/TridentItem.java @@ -0,0 +0,0 @@ public class TridentItem extends Item implements ProjectileItem { - } - - // CraftBukkit start -- if (!world.addFreshEntity(entitythrowntrident)) { -+ // Paper start - PlayerLaunchProjectileEvent -+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack), (org.bukkit.entity.Projectile) entitythrowntrident.getBukkitEntity()); -+ if (!event.callEvent() || !world.addFreshEntity(entitythrowntrident)) { -+ // Paper end - PlayerLaunchProjectileEvent - if (entityhuman instanceof net.minecraft.server.level.ServerPlayer) { - ((net.minecraft.server.level.ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); } - return; - } -+ if (event.shouldConsume()) { // Paper - PlayerLaunchProjectileEvent - stack.hurtAndBreak(1, entityhuman, LivingEntity.getSlotForHand(user.getUsedItemHand())); -+ } // Paper - PlayerLaunchProjectileEvent - entitythrowntrident.pickupItemStack = stack.copy(); // SPIGOT-4511 update since damage call moved - // CraftBukkit end + // CraftBukkit start +- if (!world.addFreshEntity(entitythrowntrident)) { ++ // Paper start - PlayerLaunchProjectileEvent ++ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack), (org.bukkit.entity.Projectile) entitythrowntrident.getBukkitEntity()); ++ if (!event.callEvent() || !world.addFreshEntity(entitythrowntrident)) { ++ // Paper end - PlayerLaunchProjectileEvent + if (entityhuman instanceof net.minecraft.server.level.ServerPlayer) { + ((net.minecraft.server.level.ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); + } + return; + } - world.playSound((Player) null, (Entity) entitythrowntrident, SoundEvents.TRIDENT_THROW, SoundSource.PLAYERS, 1.0F, 1.0F); -- if (!entityhuman.hasInfiniteMaterials()) { -+ if (event.shouldConsume() && !entityhuman.hasInfiniteMaterials()) { - entityhuman.getInventory().removeItem(stack); - } - // CraftBukkit start - SPIGOT-5458 also need in this branch :( ++ if (event.shouldConsume()) { // Paper - PlayerLaunchProjectileEvent + stack.hurtAndBreak(1, entityhuman, LivingEntity.getSlotForHand(user.getUsedItemHand())); ++ } // Paper - PlayerLaunchProjectileEvent + entitythrowntrident.pickupItemStack = stack.copy(); // SPIGOT-4511 update since damage call moved + // CraftBukkit end + + world.playSound((Player) null, (Entity) entitythrowntrident, (SoundEvent) holder.value(), SoundSource.PLAYERS, 1.0F, 1.0F); +- if (!entityhuman.hasInfiniteMaterials()) { ++ if (event.shouldConsume() && !entityhuman.hasInfiniteMaterials()) { // Paper - PlayerLaunchProjectileEvent + entityhuman.getInventory().removeItem(stack); + } + // CraftBukkit start - SPIGOT-5458 also need in this branch :( diff --git a/patches/unapplied/server/PlayerReadyArrowEvent.patch b/patches/server/PlayerReadyArrowEvent.patch similarity index 100% rename from patches/unapplied/server/PlayerReadyArrowEvent.patch rename to patches/server/PlayerReadyArrowEvent.patch diff --git a/patches/unapplied/server/PreSpawnerSpawnEvent.patch b/patches/server/PreSpawnerSpawnEvent.patch similarity index 100% rename from patches/unapplied/server/PreSpawnerSpawnEvent.patch rename to patches/server/PreSpawnerSpawnEvent.patch diff --git a/patches/unapplied/server/Prevent-chunk-loading-from-Fluid-Flowing.patch b/patches/server/Prevent-chunk-loading-from-Fluid-Flowing.patch similarity index 100% rename from patches/unapplied/server/Prevent-chunk-loading-from-Fluid-Flowing.patch rename to patches/server/Prevent-chunk-loading-from-Fluid-Flowing.patch diff --git a/patches/unapplied/server/Prevent-mob-spawning-from-loading-generating-chunks.patch b/patches/server/Prevent-mob-spawning-from-loading-generating-chunks.patch similarity index 100% rename from patches/unapplied/server/Prevent-mob-spawning-from-loading-generating-chunks.patch rename to patches/server/Prevent-mob-spawning-from-loading-generating-chunks.patch diff --git a/patches/unapplied/server/Prevent-various-interactions-from-causing-chunk-load.patch b/patches/server/Prevent-various-interactions-from-causing-chunk-load.patch similarity index 100% rename from patches/unapplied/server/Prevent-various-interactions-from-causing-chunk-load.patch rename to patches/server/Prevent-various-interactions-from-causing-chunk-load.patch diff --git a/patches/unapplied/server/Print-Error-details-when-failing-to-save-player-data.patch b/patches/server/Print-Error-details-when-failing-to-save-player-data.patch similarity index 100% rename from patches/unapplied/server/Print-Error-details-when-failing-to-save-player-data.patch rename to patches/server/Print-Error-details-when-failing-to-save-player-data.patch diff --git a/patches/unapplied/server/RangedEntity-API.patch b/patches/server/RangedEntity-API.patch similarity index 100% rename from patches/unapplied/server/RangedEntity-API.patch rename to patches/server/RangedEntity-API.patch diff --git a/patches/unapplied/server/Refresh-player-inventory-when-cancelling-PlayerInter.patch b/patches/server/Refresh-player-inventory-when-cancelling-PlayerInter.patch similarity index 100% rename from patches/unapplied/server/Refresh-player-inventory-when-cancelling-PlayerInter.patch rename to patches/server/Refresh-player-inventory-when-cancelling-PlayerInter.patch diff --git a/patches/unapplied/server/Remove-unnecessary-itemmeta-handling.patch b/patches/server/Remove-unnecessary-itemmeta-handling.patch similarity index 100% rename from patches/unapplied/server/Remove-unnecessary-itemmeta-handling.patch rename to patches/server/Remove-unnecessary-itemmeta-handling.patch diff --git a/patches/unapplied/server/Replace-OfflinePlayer-getLastPlayed.patch b/patches/server/Replace-OfflinePlayer-getLastPlayed.patch similarity index 98% rename from patches/unapplied/server/Replace-OfflinePlayer-getLastPlayed.patch rename to patches/server/Replace-OfflinePlayer-getLastPlayed.patch index 1d016ae6e5..a432c5f21f 100644 --- a/patches/unapplied/server/Replace-OfflinePlayer-getLastPlayed.patch +++ b/patches/server/Replace-OfflinePlayer-getLastPlayed.patch @@ -19,7 +19,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { private int containerCounter; public boolean wonGame; private int containerUpdateDelay; // Paper - Configurable container update tick rate diff --git a/patches/unapplied/server/Reset-players-airTicks-on-respawn.patch b/patches/server/Reset-players-airTicks-on-respawn.patch similarity index 90% rename from patches/unapplied/server/Reset-players-airTicks-on-respawn.patch rename to patches/server/Reset-players-airTicks-on-respawn.patch index 96ed4b2e22..f898307bcd 100644 --- a/patches/unapplied/server/Reset-players-airTicks-on-respawn.patch +++ b/patches/server/Reset-players-airTicks-on-respawn.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { this.setHealth(this.getMaxHealth()); this.stopUsingItem(); // CraftBukkit - SPIGOT-6682: Clear active item on reset diff --git a/patches/unapplied/server/Restore-custom-InventoryHolder-support.patch b/patches/server/Restore-custom-InventoryHolder-support.patch similarity index 100% rename from patches/unapplied/server/Restore-custom-InventoryHolder-support.patch rename to patches/server/Restore-custom-InventoryHolder-support.patch diff --git a/patches/unapplied/server/Restore-vanilla-default-mob-spawn-range-and-water-an.patch b/patches/server/Restore-vanilla-default-mob-spawn-range-and-water-an.patch similarity index 100% rename from patches/unapplied/server/Restore-vanilla-default-mob-spawn-range-and-water-an.patch rename to patches/server/Restore-vanilla-default-mob-spawn-range-and-water-an.patch diff --git a/patches/unapplied/server/SkeletonHorse-Additions.patch b/patches/server/SkeletonHorse-Additions.patch similarity index 97% rename from patches/unapplied/server/SkeletonHorse-Additions.patch rename to patches/server/SkeletonHorse-Additions.patch index 8e97dca518..f4b4e09c0f 100644 --- a/patches/unapplied/server/SkeletonHorse-Additions.patch +++ b/patches/server/SkeletonHorse-Additions.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapG index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java -@@ -0,0 +0,0 @@ import net.minecraft.world.item.enchantment.ItemEnchantments; +@@ -0,0 +0,0 @@ import net.minecraft.world.item.enchantment.providers.VanillaEnchantmentProvider public class SkeletonTrapGoal extends Goal { private final SkeletonHorse horse; diff --git a/patches/unapplied/server/Slime-Pathfinder-Events.patch b/patches/server/Slime-Pathfinder-Events.patch similarity index 100% rename from patches/unapplied/server/Slime-Pathfinder-Events.patch rename to patches/server/Slime-Pathfinder-Events.patch diff --git a/patches/unapplied/server/Turtle-API.patch b/patches/server/Turtle-API.patch similarity index 100% rename from patches/unapplied/server/Turtle-API.patch rename to patches/server/Turtle-API.patch diff --git a/patches/unapplied/server/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch b/patches/server/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch similarity index 100% rename from patches/unapplied/server/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch rename to patches/server/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch diff --git a/patches/unapplied/server/Use-ConcurrentHashMap-in-JsonList.patch b/patches/server/Use-ConcurrentHashMap-in-JsonList.patch similarity index 100% rename from patches/unapplied/server/Use-ConcurrentHashMap-in-JsonList.patch rename to patches/server/Use-ConcurrentHashMap-in-JsonList.patch diff --git a/patches/unapplied/server/Use-a-Queue-for-Queueing-Commands.patch b/patches/server/Use-a-Queue-for-Queueing-Commands.patch similarity index 100% rename from patches/unapplied/server/Use-a-Queue-for-Queueing-Commands.patch rename to patches/server/Use-a-Queue-for-Queueing-Commands.patch diff --git a/patches/unapplied/server/Vanished-players-don-t-have-rights.patch b/patches/server/Vanished-players-don-t-have-rights.patch similarity index 100% rename from patches/unapplied/server/Vanished-players-don-t-have-rights.patch rename to patches/server/Vanished-players-don-t-have-rights.patch diff --git a/patches/unapplied/server/Vex-get-setSummoner-API.patch b/patches/server/Vex-get-setSummoner-API.patch similarity index 100% rename from patches/unapplied/server/Vex-get-setSummoner-API.patch rename to patches/server/Vex-get-setSummoner-API.patch diff --git a/patches/server/WitchReadyPotionEvent.patch b/patches/server/WitchReadyPotionEvent.patch index 22abcd7e55..d78ce250a7 100644 --- a/patches/server/WitchReadyPotionEvent.patch +++ b/patches/server/WitchReadyPotionEvent.patch @@ -12,14 +12,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } if (holder != null) { +- this.setItemSlot(EquipmentSlot.MAINHAND, PotionContents.createItemStack(Items.POTION, holder)); + // Paper start + ItemStack potion = PotionContents.createItemStack(Items.POTION, holder); + potion = org.bukkit.craftbukkit.event.CraftEventFactory.handleWitchReadyPotionEvent(this, potion); + this.setItemSlot(EquipmentSlot.MAINHAND, potion); + // Paper end - this.setItemSlot(EquipmentSlot.MAINHAND, PotionContents.createItemStack(Items.POTION, holder)); this.usingTime = this.getMainHandItem().getUseDuration(this); this.setUsingItem(true); + if (!this.isSilent()) { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/patches/unapplied/server/Workaround-for-vehicle-tracking-issue-on-disconnect.patch b/patches/server/Workaround-for-vehicle-tracking-issue-on-disconnect.patch similarity index 92% rename from patches/unapplied/server/Workaround-for-vehicle-tracking-issue-on-disconnect.patch rename to patches/server/Workaround-for-vehicle-tracking-issue-on-disconnect.patch index c999e768c6..0330f899cc 100644 --- a/patches/unapplied/server/Workaround-for-vehicle-tracking-issue-on-disconnect.patch +++ b/patches/server/Workaround-for-vehicle-tracking-issue-on-disconnect.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { public void disconnect() { this.disconnected = true; this.ejectPassengers(); diff --git a/patches/unapplied/server/add-more-information-to-Entity.toString.patch b/patches/server/add-more-information-to-Entity.toString.patch similarity index 100% rename from patches/unapplied/server/add-more-information-to-Entity.toString.patch rename to patches/server/add-more-information-to-Entity.toString.patch diff --git a/patches/unapplied/server/force-entity-dismount-during-teleportation.patch b/patches/server/force-entity-dismount-during-teleportation.patch similarity index 98% rename from patches/unapplied/server/force-entity-dismount-during-teleportation.patch rename to patches/server/force-entity-dismount-during-teleportation.patch index 0cde7176ae..fbbe09533b 100644 --- a/patches/unapplied/server/force-entity-dismount-during-teleportation.patch +++ b/patches/server/force-entity-dismount-during-teleportation.patch @@ -23,7 +23,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @Override public void stopRiding() { diff --git a/patches/unapplied/server/Catch-JsonParseException-in-block-entity-names.patch b/patches/unapplied/server/Catch-JsonParseException-in-block-entity-names.patch deleted file mode 100644 index 5b5782293f..0000000000 --- a/patches/unapplied/server/Catch-JsonParseException-in-block-entity-names.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Noah van der Aa <ndvdaa@gmail.com> -Date: Mon, 29 Apr 2024 23:12:33 +0200 -Subject: [PATCH] Catch JsonParseException in block entity names - -As a result, data that no longer parses correctly will not crash the server -instead just logging the exception and continuing (and in most cases should -fix the data) - -Player data is fixed pretty much immediately but some block data (like -Shulkers) may need to be changed in order for it to re-save properly - -No more crashing though. - -diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java -@@ -0,0 +0,0 @@ public class SkullBlockEntity extends BlockEntity { - } - - if (nbt.contains("custom_name", 8)) { -- this.customName = Component.Serializer.fromJson(nbt.getString("custom_name"), registryLookup); -+ this.customName = BlockEntity.parseCustomNameSafe(nbt.getString("custom_name"), registryLookup); // Paper - } else { - this.customName = null; - }