craftbukkit/nms-patches/net/minecraft/world/item/ItemTrident.patch

48 lines
3.1 KiB
Diff
Raw Normal View History

2021-03-16 09:00:00 +11:00
--- a/net/minecraft/world/item/ItemTrident.java
+++ b/net/minecraft/world/item/ItemTrident.java
2024-06-14 01:05:00 +10:00
@@ -77,7 +77,7 @@
Holder<SoundEffect> holder = (Holder) EnchantmentManager.pickHighestLevel(itemstack, EnchantmentEffectComponents.TRIDENT_SOUND).orElse(SoundEffects.TRIDENT_THROW);
2024-06-14 01:05:00 +10:00
if (!world.isClientSide) {
- itemstack.hurtAndBreak(1, entityhuman, EntityLiving.getSlotForHand(entityliving.getUsedItemHand()));
+ // itemstack.hurtAndBreak(1, entityhuman, EntityLiving.getSlotForHand(entityliving.getUsedItemHand())); // CraftBukkit - moved down
if (f == 0.0F) {
EntityThrownTrident entitythrowntrident = new EntityThrownTrident(world, entityhuman, itemstack);
2024-06-14 01:05:00 +10:00
@@ -86,11 +86,26 @@
entitythrowntrident.pickup = EntityArrow.PickupStatus.CREATIVE_ONLY;
}
2024-06-14 01:05:00 +10:00
- world.addFreshEntity(entitythrowntrident);
+ // CraftBukkit start
+ if (!world.addFreshEntity(entitythrowntrident)) {
+ if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) {
+ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
+ }
+ return;
+ }
+
2024-06-14 01:05:00 +10:00
+ itemstack.hurtAndBreak(1, entityhuman, EntityLiving.getSlotForHand(entityliving.getUsedItemHand()));
+ entitythrowntrident.pickupItemStack = itemstack.copy(); // SPIGOT-4511 update since damage call moved
+ // CraftBukkit end
+
2024-06-14 01:05:00 +10:00
world.playSound((EntityHuman) null, (Entity) entitythrowntrident, (SoundEffect) holder.value(), SoundCategory.PLAYERS, 1.0F, 1.0F);
if (!entityhuman.hasInfiniteMaterials()) {
entityhuman.getInventory().removeItem(itemstack);
}
+ // CraftBukkit start - SPIGOT-5458 also need in this branch :(
+ } else {
+ itemstack.hurtAndBreak(1, entityhuman, EntityLiving.getSlotForHand(entityliving.getUsedItemHand()));
+ // CraftBukkkit end
}
2021-01-31 10:08:41 +11:00
}
2018-08-02 09:38:52 +10:00
2024-06-14 01:05:00 +10:00
@@ -106,6 +121,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()) {