PaperMC/patches/server-remapped/PlayerElytraBoostEvent.patch
MiniDigger | Martin 95d25d98e8 Move patches around
2021-06-11 14:02:28 +02:00

31 lines
2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sat, 21 Jul 2018 01:59:59 -0500
Subject: [PATCH] PlayerElytraBoostEvent
diff --git a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
+++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
@@ -0,0 +0,0 @@ public class FireworkRocketItem extends Item {
// Paper start
final FireworkRocketEntity entityfireworks = new FireworkRocketEntity(world, itemstack, user);
entityfireworks.spawningEntity = user.getUUID();
- world.addFreshEntity(entityfireworks);
- // Paper end
- if (!user.abilities.instabuild) {
- itemstack.shrink(1);
+ // Paper start
+ com.destroystokyo.paper.event.player.PlayerElytraBoostEvent event = new com.destroystokyo.paper.event.player.PlayerElytraBoostEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Firework) entityfireworks.getBukkitEntity());
+ if (event.callEvent() && world.addFreshEntity(entityfireworks)) {
+ if (event.shouldConsume() && !user.abilities.instabuild) {
+ itemstack.shrink(1);
+ } else ((EntityPlayer) user).getBukkitEntity().updateInventory();
+ } else if (user instanceof EntityPlayer) {
+ ((EntityPlayer) user).getBukkitEntity().updateInventory();
}
+ // Paper end
}
return InteractionResultHolder.sidedSuccess(user.getItemInHand(hand), world.isClientSide());