PaperMC/paper-server/patches/sources/net/minecraft/world/item/FireChargeItem.java.patch
2024-12-14 12:50:23 -08:00

31 lines
2 KiB
Diff

--- a/net/minecraft/world/item/FireChargeItem.java
+++ b/net/minecraft/world/item/FireChargeItem.java
@@ -35,12 +_,28 @@
if (!CampfireBlock.canLight(blockState) && !CandleBlock.canLight(blockState) && !CandleCakeBlock.canLight(blockState)) {
clickedPos = clickedPos.relative(context.getClickedFace());
if (BaseFireBlock.canBePlacedAt(level, clickedPos, context.getHorizontalDirection())) {
+ // CraftBukkit start - fire BlockIgniteEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(level, clickedPos, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FIREBALL, context.getPlayer()).isCancelled()) {
+ if (!context.getPlayer().getAbilities().instabuild) {
+ context.getItemInHand().shrink(1);
+ }
+ return InteractionResult.PASS;
+ }
+ // CraftBukkit end
this.playSound(level, clickedPos);
level.setBlockAndUpdate(clickedPos, BaseFireBlock.getState(level, clickedPos));
level.gameEvent(context.getPlayer(), GameEvent.BLOCK_PLACE, clickedPos);
flag = true;
}
} else {
+ // CraftBukkit start - fire BlockIgniteEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(level, clickedPos, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FIREBALL, context.getPlayer()).isCancelled()) {
+ if (!context.getPlayer().getAbilities().instabuild) {
+ context.getItemInHand().shrink(1);
+ }
+ return InteractionResult.PASS;
+ }
+ // CraftBukkit end
this.playSound(level, clickedPos);
level.setBlockAndUpdate(clickedPos, blockState.setValue(BlockStateProperties.LIT, Boolean.valueOf(true)));
level.gameEvent(context.getPlayer(), GameEvent.BLOCK_CHANGE, clickedPos);