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

45 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
2025-03-26 03:05:00 +11:00
@@ -78,10 +78,20 @@
2024-10-23 02:15:00 +11:00
if (world instanceof WorldServer) {
WorldServer worldserver = (WorldServer) world;
2024-10-23 02:15:00 +11:00
- itemstack.hurtWithoutBreaking(1, entityhuman);
+ // itemstack.hurtWithoutBreaking(1, entityhuman); // CraftBukkit - moved down
if (f == 0.0F) {
+ // CraftBukkit start
2025-03-26 03:05:00 +11:00
+ EntityThrownTrident entitythrowntrident = (EntityThrownTrident) IProjectile.spawnProjectileFromRotation(EntityThrownTrident::new, worldserver, itemstack, entityhuman, 0.0F, 2.5F, 1.0F);
2024-10-23 02:15:00 +11:00
+ 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);
2025-03-26 03:05:00 +11:00
ItemStack itemstack1 = itemstack.consumeAndReturn(1, entityhuman);
- EntityThrownTrident entitythrowntrident = (EntityThrownTrident) IProjectile.spawnProjectileFromRotation(EntityThrownTrident::new, worldserver, itemstack1, entityhuman, 0.0F, 2.5F, 1.0F);
+ entitythrowntrident.pickupItemStack = itemstack1.copy(); // SPIGOT-4511 update since damage call moved
2024-10-23 02:15:00 +11:00
+ // CraftBukkit end
2024-10-23 02:15:00 +11:00
if (entityhuman.hasInfiniteMaterials()) {
entitythrowntrident.pickup = EntityArrow.PickupStatus.CREATIVE_ONLY;
2025-03-26 03:05:00 +11:00
@@ -89,6 +99,10 @@
2025-03-26 03:05:00 +11:00
world.playSound((Entity) null, (Entity) entitythrowntrident, holder.value(), SoundCategory.PLAYERS, 1.0F, 1.0F);
2024-10-23 02:15:00 +11:00
return true;
+ // CraftBukkit start - SPIGOT-5458 also need in this branch :(
+ } else {
+ itemstack.hurtWithoutBreaking(1, entityhuman);
+ // CraftBukkkit end
2021-01-31 10:08:41 +11:00
}
2024-10-23 02:15:00 +11:00
}
2018-08-02 09:38:52 +10:00
2025-03-26 03:05:00 +11:00
@@ -103,6 +117,7 @@
2024-10-23 02:15:00 +11:00
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()) {