diff options
author | Nassim Jahnke <[email protected]> | 2024-12-12 12:22:12 +0100 |
---|---|---|
committer | Nassim Jahnke <[email protected]> | 2024-12-12 12:30:31 +0100 |
commit | 45ddf764d96ab16c408461f59c32687f9f8df971 (patch) | |
tree | cbc8eae13c803ee6c8413b08790d85415209315e /paper-server/patches/unapplied/net/minecraft/world/item/TridentItem.java.patch | |
parent | ff75689b0802180538e6dba36d113e7529e43139 (diff) | |
download | Paper-45ddf764d96ab16c408461f59c32687f9f8df971.tar.gz Paper-45ddf764d96ab16c408461f59c32687f9f8df971.zip |
Move patches to unapplied
Diffstat (limited to 'paper-server/patches/unapplied/net/minecraft/world/item/TridentItem.java.patch')
-rw-r--r-- | paper-server/patches/unapplied/net/minecraft/world/item/TridentItem.java.patch | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/paper-server/patches/unapplied/net/minecraft/world/item/TridentItem.java.patch b/paper-server/patches/unapplied/net/minecraft/world/item/TridentItem.java.patch new file mode 100644 index 0000000000..a23995cfe3 --- /dev/null +++ b/paper-server/patches/unapplied/net/minecraft/world/item/TridentItem.java.patch @@ -0,0 +1,51 @@ +--- a/net/minecraft/world/item/TridentItem.java ++++ b/net/minecraft/world/item/TridentItem.java +@@ -86,18 +86,37 @@ + if (world instanceof ServerLevel) { + ServerLevel worldserver = (ServerLevel) world; + +- stack.hurtWithoutBreaking(1, entityhuman); ++ // itemstack.hurtWithoutBreaking(1, entityhuman); // CraftBukkit - moved down + if (f == 0.0F) { +- ThrownTrident entitythrowntrident = (ThrownTrident) Projectile.spawnProjectileFromRotation(ThrownTrident::new, worldserver, stack, entityhuman, 0.0F, 2.5F, 1.0F); ++ // Paper start - PlayerLaunchProjectileEvent ++ Projectile.Delayed<ThrownTrident> tridentDelayed = Projectile.spawnProjectileFromRotationDelayed(ThrownTrident::new, worldserver, stack, entityhuman, 0.0F, 2.5F, 1.0F); ++ // 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) tridentDelayed.projectile().getBukkitEntity()); ++ if (!event.callEvent() || !tridentDelayed.attemptSpawn()) { ++ // CraftBukkit start ++ // Paper end - PlayerLaunchProjectileEvent ++ if (entityhuman instanceof net.minecraft.server.level.ServerPlayer) { ++ ((net.minecraft.server.level.ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); ++ } ++ return false; ++ } ++ ThrownTrident entitythrowntrident = tridentDelayed.projectile(); // Paper - PlayerLaunchProjectileEvent ++ if (event.shouldConsume()) stack.hurtWithoutBreaking(1, entityhuman); // Paper - PlayerLaunchProjectileEvent ++ entitythrowntrident.pickupItemStack = stack.copy(); // SPIGOT-4511 update since damage call moved ++ // CraftBukkit end + + if (entityhuman.hasInfiniteMaterials()) { + entitythrowntrident.pickup = AbstractArrow.Pickup.CREATIVE_ONLY; +- } else { ++ } else if (event.shouldConsume()) { // Paper - PlayerLaunchProjectileEvent + entityhuman.getInventory().removeItem(stack); + } + + world.playSound((Player) null, (Entity) entitythrowntrident, (SoundEvent) holder.value(), SoundSource.PLAYERS, 1.0F, 1.0F); + return true; ++ // CraftBukkit start - SPIGOT-5458 also need in this branch :( ++ } else { ++ stack.hurtWithoutBreaking(1, entityhuman); ++ // CraftBukkkit end + } + } + +@@ -112,6 +131,7 @@ + f3 *= f / f6; + f4 *= f / f6; + f5 *= f / f6; ++ org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerRiptideEvent(entityhuman, stack, f3, f4, f5); // CraftBukkit + entityhuman.push((double) f3, (double) f4, (double) f5); + entityhuman.startAutoSpinAttack(20, 8.0F, stack); + if (entityhuman.onGround()) { |