0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git synced 2024-11-25 05:46:13 +00:00
craftbukkit/nms-patches/net/minecraft/world/item/ItemTrident.patch
2024-10-23 02:15:00 +11:00

43 lines
2.5 KiB
Diff

--- a/net/minecraft/world/item/ItemTrident.java
+++ b/net/minecraft/world/item/ItemTrident.java
@@ -85,9 +85,19 @@
if (world instanceof WorldServer) {
WorldServer worldserver = (WorldServer) world;
- itemstack.hurtWithoutBreaking(1, entityhuman);
+ // itemstack.hurtWithoutBreaking(1, entityhuman); // CraftBukkit - moved down
if (f == 0.0F) {
EntityThrownTrident entitythrowntrident = (EntityThrownTrident) IProjectile.spawnProjectileFromRotation(EntityThrownTrident::new, worldserver, itemstack, entityhuman, 0.0F, 2.5F, 1.0F);
+ // CraftBukkit start
+ if (entitythrowntrident.isRemoved()) {
+ if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) {
+ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
+ }
+ return false;
+ }
+ itemstack.hurtWithoutBreaking(1, entityhuman);
+ entitythrowntrident.pickupItemStack = itemstack.copy(); // SPIGOT-4511 update since damage call moved
+ // CraftBukkit end
if (entityhuman.hasInfiniteMaterials()) {
entitythrowntrident.pickup = EntityArrow.PickupStatus.CREATIVE_ONLY;
@@ -97,6 +107,10 @@
world.playSound((EntityHuman) null, (Entity) entitythrowntrident, (SoundEffect) holder.value(), SoundCategory.PLAYERS, 1.0F, 1.0F);
return true;
+ // CraftBukkit start - SPIGOT-5458 also need in this branch :(
+ } else {
+ itemstack.hurtWithoutBreaking(1, entityhuman);
+ // CraftBukkkit end
}
}
@@ -112,6 +126,7 @@
f3 *= f / f6;
f4 *= f / f6;
f5 *= f / f6;
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerRiptideEvent(entityhuman, itemstack, f3, f4, f5); // CraftBukkit
entityhuman.push((double) f3, (double) f4, (double) f5);
entityhuman.startAutoSpinAttack(20, 8.0F, itemstack);
if (entityhuman.onGround()) {