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

48 lines
2.8 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-04-24 01:15:00 +10:00
@@ -72,7 +72,7 @@
2019-04-23 12:00:00 +10:00
if (k <= 0 || entityhuman.isInWaterOrRain()) {
if (!world.isClientSide) {
2024-04-24 01:15:00 +10:00
- itemstack.hurtAndBreak(1, entityhuman, EntityLiving.getSlotForHand(entityliving.getUsedItemHand()));
+ // itemstack.hurtAndBreak(1, entityhuman, EntityLiving.getSlotForHand(entityliving.getUsedItemHand())); // CraftBukkit - moved down
if (k == 0) {
EntityThrownTrident entitythrowntrident = new EntityThrownTrident(world, entityhuman, itemstack);
2024-04-24 01:15:00 +10:00
@@ -81,11 +81,26 @@
2021-06-11 15:00:00 +10:00
entitythrowntrident.pickup = EntityArrow.PickupStatus.CREATIVE_ONLY;
}
2021-11-22 09:00:00 +11:00
- world.addFreshEntity(entitythrowntrident);
+ // CraftBukkit start
2021-11-22 09:00:00 +11:00
+ if (!world.addFreshEntity(entitythrowntrident)) {
2021-03-16 09:00:00 +11:00
+ if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) {
+ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
+ }
+ return;
+ }
+
2024-04-24 01:15:00 +10:00
+ itemstack.hurtAndBreak(1, entityhuman, EntityLiving.getSlotForHand(entityliving.getUsedItemHand()));
2023-12-06 03:40:00 +11:00
+ entitythrowntrident.pickupItemStack = itemstack.copy(); // SPIGOT-4511 update since damage call moved
+ // CraftBukkit end
+
2021-06-11 15:00:00 +10:00
world.playSound((EntityHuman) null, (Entity) entitythrowntrident, SoundEffects.TRIDENT_THROW, SoundCategory.PLAYERS, 1.0F, 1.0F);
2024-04-24 01:15:00 +10:00
if (!entityhuman.hasInfiniteMaterials()) {
2021-11-22 09:00:00 +11:00
entityhuman.getInventory().removeItem(itemstack);
}
2021-01-31 10:08:41 +11:00
+ // CraftBukkit start - SPIGOT-5458 also need in this branch :(
+ } else {
2024-04-24 01:15:00 +10:00
+ itemstack.hurtAndBreak(1, entityhuman, EntityLiving.getSlotForHand(entityliving.getUsedItemHand()));
2021-01-31 10:08:41 +11:00
+ // CraftBukkkit end
}
}
2018-08-02 09:38:52 +10:00
2024-04-24 01:15:00 +10:00
@@ -102,6 +117,7 @@
f2 *= f6 / f5;
f3 *= f6 / f5;
f4 *= f6 / f5;
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerRiptideEvent(entityhuman, itemstack, f2, f3, f4); // CraftBukkit
entityhuman.push((double) f2, (double) f3, (double) f4);
entityhuman.startAutoSpinAttack(20);
if (entityhuman.onGround()) {