mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-30 20:21:41 +01:00
Make fireworks call PlayerLaunchProjectileEvent (#4698)
This commit is contained in:
parent
51ed2d9d21
commit
81113bd07b
@ -157,6 +157,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
return InteractionResultWrapper.a(itemstack, world.s_());
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemFireworks.java b/src/main/java/net/minecraft/server/ItemFireworks.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemFireworks.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemFireworks.java
|
||||
@@ -0,0 +0,0 @@ public class ItemFireworks extends Item {
|
||||
EntityFireworks entityfireworks = new EntityFireworks(world, itemactioncontext.getEntity(), vec3d.x + (double) enumdirection.getAdjacentX() * 0.15D, vec3d.y + (double) enumdirection.getAdjacentY() * 0.15D, vec3d.z + (double) enumdirection.getAdjacentZ() * 0.15D, itemstack);
|
||||
entityfireworks.spawningEntity = itemactioncontext.getEntity().getUniqueID(); // Paper
|
||||
|
||||
- world.addEntity(entityfireworks);
|
||||
- itemstack.subtract(1);
|
||||
+ // Paper start - PlayerLaunchProjectileEvent
|
||||
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) itemactioncontext.getEntity().getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Firework) entityfireworks.getBukkitEntity());
|
||||
+ if (!event.callEvent() || !world.addEntity(entityfireworks)) return EnumInteractionResult.PASS;
|
||||
+ if (event.shouldConsume() && !itemactioncontext.getEntity().abilities.canInstantlyBuild) itemstack.subtract(1);
|
||||
+ else if (itemactioncontext.getEntity() instanceof EntityPlayer) ((EntityPlayer) itemactioncontext.getEntity()).getBukkitEntity().updateInventory();
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
return EnumInteractionResult.a(world.isClientSide);
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemLingeringPotion.java b/src/main/java/net/minecraft/server/ItemLingeringPotion.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemLingeringPotion.java
|
||||
|
Loading…
Reference in New Issue
Block a user