mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-06 10:49:40 +01:00
4104545b11
"It was from a different time before books were as jank as they are now. As time has gone on they've only proven to be worse and worse."
34 lines
2.2 KiB
Diff
34 lines
2.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 10385dcb851bb435821afba322ed11f59e7ad3e6..561f98b442788814cbc6cbb7e144207d14f67ff8 100644
|
|
--- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
|
|
@@ -61,12 +61,19 @@ public class FireworkRocketItem extends Item {
|
|
if (!world.isClientSide) {
|
|
FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity(world, itemStack, user);
|
|
fireworkRocketEntity.spawningEntity = user.getUUID(); // Paper
|
|
- world.addFreshEntity(fireworkRocketEntity);
|
|
- if (!user.getAbilities().instabuild) {
|
|
+ // 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) fireworkRocketEntity.getBukkitEntity());
|
|
+ if (event.callEvent() && world.addFreshEntity(fireworkRocketEntity)) {
|
|
+ user.awardStat(Stats.ITEM_USED.get(this));
|
|
+ if (event.shouldConsume() && !user.getAbilities().instabuild) {
|
|
itemStack.shrink(1);
|
|
+ } else ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory();
|
|
+ } else if (user instanceof net.minecraft.server.level.ServerPlayer) {
|
|
+ ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory();
|
|
+ // Paper end
|
|
}
|
|
|
|
- user.awardStat(Stats.ITEM_USED.get(this));
|
|
+ // user.awardStat(Stats.ITEM_USED.get(this)); // Paper - move up
|
|
}
|
|
|
|
return InteractionResultHolder.sidedSuccess(user.getItemInHand(hand), world.isClientSide());
|