From dcbe8f75f21e6e45aaaf032650aefa5bf362b738 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Sat, 27 Apr 2024 18:00:01 -0700 Subject: [PATCH] Updated Upstream (Bukkit/CraftBukkit) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 304e83eb PR-1002: Improve documentation and implementation of getMaxStackSize e8215ea2 SPIGOT-7638: Library loader does not seem to resolve every dependency 79c595c0 SPIGOT-7637: Bad logic in checking nullability of AttributeModifier slots CraftBukkit Changes: 91b1fc3f1 SPIGOT-7644: Fix ItemMeta#getAsString 4e77a81e1 SPIGOT-7615: PlayerLeashEntityEvent cancelled eats lead 996f660f3 Do not remove leash knot if leasing to an existing leash knot gets cancelled f70367d42 SPIGOT-7643: Fix inverted leash event cancelled usage and remove leash knot if no entity gets leashed 7ddb48294 SPIGOT-7640: Abnormal jumping height of wind charge 080c8711e SPIGOT-7639: Incoming plugin channels not working ad549847e Open a direct connection instead of pinging mojang server to check if it is reachable 38e2926c5 SPIGOT-7365: DamageCause blocked by shield should trigger invulnerableTime --- gradle.properties | 2 +- paper-api-generator/build.gradle.kts | 1 + patches/api/Add-EquipmentSlot-convenience-methods.patch | 2 +- ...ntityKnockbackByEntityEvent-and-EntityPushedByE.patch | 8 +++----- .../Fix-advancement-triggers-for-entity-damage.patch | 2 +- patches/server/Fix-inventory-desync.patch | 2 +- ...t-to-vanilla-handling-of-LivingEntity-actuallyH.patch | 9 +++------ work/Bukkit | 2 +- work/CraftBukkit | 2 +- 9 files changed, 13 insertions(+), 17 deletions(-) diff --git a/gradle.properties b/gradle.properties index 06573bcbf9..744935f5ac 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ version=1.20.5-R0.1-SNAPSHOT mcVersion=1.20.5 # Set to true while updating Minecraft version -updatingMinecraft=true +updatingMinecraft=false org.gradle.caching=true org.gradle.parallel=true diff --git a/paper-api-generator/build.gradle.kts b/paper-api-generator/build.gradle.kts index c3deae7adb..05d16d0b95 100644 --- a/paper-api-generator/build.gradle.kts +++ b/paper-api-generator/build.gradle.kts @@ -21,6 +21,7 @@ dependencies { } tasks.register("generate") { + dependsOn(tasks.check) mainClass.set("io.papermc.generator.Main") classpath(sourceSets.main.map { it.runtimeClasspath }) args(projectDir.toPath().resolve("generated").toString()) diff --git a/patches/api/Add-EquipmentSlot-convenience-methods.patch b/patches/api/Add-EquipmentSlot-convenience-methods.patch index 8cffd7d3c9..ad15663718 100644 --- a/patches/api/Add-EquipmentSlot-convenience-methods.patch +++ b/patches/api/Add-EquipmentSlot-convenience-methods.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/inventory/EquipmentSlot.java @@ -0,0 +0,0 @@ public enum EquipmentSlot { public EquipmentSlotGroup getGroup() { - return group; + return group.get(); } + // Paper start + /** diff --git a/patches/server/Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch b/patches/server/Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch index 932110843b..470e500c87 100644 --- a/patches/server/Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch +++ b/patches/server/Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch @@ -222,12 +222,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -0,0 +0,0 @@ public class Explosion { - Vec3 result = entity.getDeltaMovement().add(vec3d1); - org.bukkit.event.entity.EntityKnockbackEvent event = CraftEventFactory.callEntityKnockbackEvent((org.bukkit.craftbukkit.entity.CraftLivingEntity) entity.getBukkitEntity(), this.source, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.EXPLOSION, d13, vec3d1, result.x, result.y, result.z); - -- vec3d1 = (event.isCancelled()) ? Vec3.ZERO : new Vec3(event.getFinalKnockback().getX(), event.getFinalKnockback().getY(), event.getFinalKnockback().getZ()); + // since the code below (the setDeltaMovement call as well as the hitPlayers map) + // want the vector to be the relative velocity will the event provides the absolute velocity + vec3d1 = (event.isCancelled()) ? Vec3.ZERO : new Vec3(event.getFinalKnockback().getX(), event.getFinalKnockback().getY(), event.getFinalKnockback().getZ()).subtract(entity.getDeltaMovement()); + // Paper start - call EntityKnockbackByEntityEvent for explosions -+ vec3d1 = (event.isCancelled()) ? Vec3.ZERO : new Vec3(event.getFinalKnockback().getX(), event.getFinalKnockback().getY(), event.getFinalKnockback().getZ()).subtract(entity.getDeltaMovement()); // changes on this line fix a bug where vec3d1 wasn't reassigned with the "change", but instead the final deltaMovement + if (this.damageSource.getEntity() != null || this.source != null) { + final org.bukkit.entity.Entity hitBy = this.damageSource.getEntity() != null ? this.damageSource.getEntity().getBukkitEntity() : this.source.getBukkitEntity(); + com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent paperEvent = new com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent(((LivingEntity) entity).getBukkitLivingEntity(), hitBy, (float) event.getForce(), org.bukkit.craftbukkit.util.CraftVector.toBukkit(vec3d1)); diff --git a/patches/server/Fix-advancement-triggers-for-entity-damage.patch b/patches/server/Fix-advancement-triggers-for-entity-damage.patch index 95d8f38f6d..e52477174e 100644 --- a/patches/server/Fix-advancement-triggers-for-entity-damage.patch +++ b/patches/server/Fix-advancement-triggers-for-entity-damage.patch @@ -43,4 +43,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + CriteriaTriggers.PLAYER_HURT_ENTITY.trigger((ServerPlayer) damagesource.getEntity(), this, damagesource, originalDamage, f, true); // Paper - fix taken/dealt param order } - return false; + return true; diff --git a/patches/server/Fix-inventory-desync.patch b/patches/server/Fix-inventory-desync.patch index 70e8f50b9f..9a600e8f9a 100644 --- a/patches/server/Fix-inventory-desync.patch +++ b/patches/server/Fix-inventory-desync.patch @@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- 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 - // CraftBukkit start - fire PlayerLeashEntityEvent if (CraftEventFactory.callPlayerLeashEntityEvent(this, player, player, hand).isCancelled()) { + ((ServerPlayer) player).resendItemInHands(); // SPIGOT-7615: Resend to fix client desync with used item ((ServerPlayer) player).connection.send(new ClientboundSetEntityLinkPacket(this, this.getLeashHolder())); + player.containerMenu.sendAllDataToRemote(); // Paper - Fix inventory desync return InteractionResult.PASS; diff --git a/patches/server/Revert-to-vanilla-handling-of-LivingEntity-actuallyH.patch b/patches/server/Revert-to-vanilla-handling-of-LivingEntity-actuallyH.patch index 01c50f38c0..98740f8b2e 100644 --- a/patches/server/Revert-to-vanilla-handling-of-LivingEntity-actuallyH.patch +++ b/patches/server/Revert-to-vanilla-handling-of-LivingEntity-actuallyH.patch @@ -18,14 +18,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 final boolean human = this instanceof net.minecraft.world.entity.player.Player; float originalDamage = f; @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { - CriteriaTriggers.PLAYER_HURT_ENTITY.trigger((ServerPlayer) damagesource.getEntity(), this, damagesource, originalDamage, f, true); // Paper - fix taken/dealt param order - } -- return false; -+ return true; // Paper - return false ONLY if event was cancelled + return true; } else { -- return originalDamage > 0; -+ return originalDamage > 0 || true; // Paper - return false ONLY if event was cancelled +- return originalDamage >= 0; ++ return true; // Paper - return false ONLY if event was cancelled } // CraftBukkit end } diff --git a/work/Bukkit b/work/Bukkit index 69fa46950c..304e83eb38 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 69fa46950cc65264d4e4db9f22e58d5f57e47f46 +Subproject commit 304e83eb384c338546aa96eea51388e0e8407e26 diff --git a/work/CraftBukkit b/work/CraftBukkit index 90f1059bae..91b1fc3f1c 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 90f1059bae911966b5629b3ec1ff242d109fde7f +Subproject commit 91b1fc3f1cf89e2591367dca1fa7362fe376f289