PaperMC/nms-patches/ItemFireball.patch

33 lines
1.9 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/ItemFireball.java
+++ b/net/minecraft/server/ItemFireball.java
2019-12-10 23:00:00 +01:00
@@ -15,6 +15,14 @@
2018-07-15 02:00:00 +02:00
2019-12-10 23:00:00 +01:00
if (iblockdata.getBlock() == Blocks.CAMPFIRE) {
if (!(Boolean) iblockdata.get(BlockCampfire.b) && !(Boolean) iblockdata.get(BlockCampfire.d)) {
+ // 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);
+ }
2019-12-10 23:00:00 +01:00
+ return EnumInteractionResult.PASS;
+ }
+ // CraftBukkit end
this.a(world, blockposition);
world.setTypeUpdate(blockposition, (IBlockData) iblockdata.set(BlockCampfire.b, true));
flag = true;
@@ -22,6 +30,14 @@
} else {
blockposition = blockposition.shift(itemactioncontext.getClickedFace());
if (world.getType(blockposition).isAir()) {
+ // 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);
2019-04-23 04:00:00 +02:00
+ }
2019-12-10 23:00:00 +01:00
+ return EnumInteractionResult.PASS;
+ }
+ // CraftBukkit end
this.a(world, blockposition);
world.setTypeUpdate(blockposition, ((BlockFire) Blocks.FIRE).a((IBlockAccess) world, blockposition));
flag = true;