3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 20:40:07 +01:00
Paper/nms-patches/ItemFireball.patch
2020-06-25 10:00:00 +10:00

32 Zeilen
1.8 KiB
Diff

--- a/net/minecraft/server/ItemFireball.java
+++ b/net/minecraft/server/ItemFireball.java
@@ -14,12 +14,28 @@
boolean flag = false;
if (BlockCampfire.h(iblockdata)) {
+ // CraftBukkit start - fire BlockIgniteEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FIREBALL, itemactioncontext.getEntity()).isCancelled()) {
+ if (!itemactioncontext.getEntity().abilities.canInstantlyBuild) {
+ itemactioncontext.getItemStack().subtract(1);
+ }
+ return EnumInteractionResult.PASS;
+ }
+ // CraftBukkit end
this.a(world, blockposition);
world.setTypeUpdate(blockposition, (IBlockData) iblockdata.set(BlockCampfire.b, true));
flag = true;
} else {
blockposition = blockposition.shift(itemactioncontext.getClickedFace());
if (BlockFireAbstract.a((GeneratorAccess) world, blockposition)) {
+ // CraftBukkit start - fire BlockIgniteEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FIREBALL, itemactioncontext.getEntity()).isCancelled()) {
+ if (!itemactioncontext.getEntity().abilities.canInstantlyBuild) {
+ itemactioncontext.getItemStack().subtract(1);
+ }
+ return EnumInteractionResult.PASS;
+ }
+ // CraftBukkit end
this.a(world, blockposition);
world.setTypeUpdate(blockposition, BlockFireAbstract.a((IBlockAccess) world, blockposition));
flag = true;