Paper/paper-server/nms-patches/net/minecraft/world/item/ItemFireball.patch

32 lines
2.1 KiB
Diff
Raw Normal View History

2021-03-15 23:00:00 +01:00
--- a/net/minecraft/world/item/ItemFireball.java
+++ b/net/minecraft/world/item/ItemFireball.java
@@ -32,12 +32,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(itemactioncontext.getPlayer(), 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(itemactioncontext.getPlayer(), GameEvent.BLOCK_PLACE, blockposition);