0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git synced 2024-11-25 03:26:14 +00:00
craftbukkit/nms-patches/net/minecraft/world/item/ItemFireball.patch
2024-04-24 01:15:00 +10:00

32 lines
2.1 KiB
Diff

--- a/net/minecraft/world/item/ItemFireball.java
+++ b/net/minecraft/world/item/ItemFireball.java
@@ -40,12 +40,28 @@
if (!BlockCampfire.canLight(iblockdata) && !CandleBlock.canLight(iblockdata) && !CandleCakeBlock.canLight(iblockdata)) {
blockposition = blockposition.relative(itemactioncontext.getClickedFace());
if (BlockFireAbstract.canBePlacedAt(world, blockposition, itemactioncontext.getHorizontalDirection())) {
+ // CraftBukkit start - fire BlockIgniteEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FIREBALL, itemactioncontext.getPlayer()).isCancelled()) {
+ if (!itemactioncontext.getPlayer().getAbilities().instabuild) {
+ itemactioncontext.getItemInHand().shrink(1);
+ }
+ return EnumInteractionResult.PASS;
+ }
+ // CraftBukkit end
this.playSound(world, blockposition);
world.setBlockAndUpdate(blockposition, BlockFireAbstract.getState(world, blockposition));
world.gameEvent((Entity) itemactioncontext.getPlayer(), (Holder) GameEvent.BLOCK_PLACE, blockposition);
flag = true;
}
} else {
+ // CraftBukkit start - fire BlockIgniteEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FIREBALL, itemactioncontext.getPlayer()).isCancelled()) {
+ if (!itemactioncontext.getPlayer().getAbilities().instabuild) {
+ itemactioncontext.getItemInHand().shrink(1);
+ }
+ return EnumInteractionResult.PASS;
+ }
+ // CraftBukkit end
this.playSound(world, blockposition);
world.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.setValue(BlockProperties.LIT, true));
world.gameEvent((Entity) itemactioncontext.getPlayer(), (Holder) GameEvent.BLOCK_CHANGE, blockposition);