geforkt von Mirrors/Paper
34 Zeilen
2.3 KiB
Diff
34 Zeilen
2.3 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 3749cfca8f007973d1a2206d8f2ba15283a550e1..a9f82e37c088c6f6ae2a049fcc7acea01b8802cd 100644
|
|
--- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java
|
|
@@ -68,12 +68,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 - PlayerElytraBoostEvent
|
|
+ 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(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand));
|
|
+ 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 - PlayerElytraBoostEvent
|
|
}
|
|
|
|
- user.awardStat(Stats.ITEM_USED.get(this));
|
|
+ // user.awardStat(Stats.ITEM_USED.get(this)); // Paper - PlayerElytraBoostEvent; move up
|
|
}
|
|
|
|
return InteractionResultHolder.sidedSuccess(user.getItemInHand(hand), world.isClientSide());
|