Paper/paper-server/patches/sources/net/minecraft/world/item/FireChargeItem.java.patch
CraftBukkit/Spigot 30e4583dbe Remap CraftBukkit to Mojang+Yarn Mappings
By: Initial Source <noreply+automated@papermc.io>
2024-12-11 22:26:55 +01:00

32 lines
2.0 KiB
Diff

--- a/net/minecraft/world/item/FireChargeItem.java
+++ b/net/minecraft/world/item/FireChargeItem.java
@@ -40,12 +40,28 @@
if (!CampfireBlock.canLight(iblockdata) && !CandleBlock.canLight(iblockdata) && !CandleCakeBlock.canLight(iblockdata)) {
blockposition = blockposition.relative(context.getClickedFace());
if (BaseFireBlock.canBePlacedAt(world, blockposition, context.getHorizontalDirection())) {
+ // CraftBukkit start - fire BlockIgniteEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, 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(world, blockposition);
world.setBlockAndUpdate(blockposition, BaseFireBlock.getState(world, blockposition));
world.gameEvent((Entity) context.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, context.getPlayer()).isCancelled()) {
+ if (!context.getPlayer().getAbilities().instabuild) {
+ context.getItemInHand().shrink(1);
+ }
+ return InteractionResult.PASS;
+ }
+ // CraftBukkit end
this.playSound(world, blockposition);
world.setBlockAndUpdate(blockposition, (BlockState) iblockdata.setValue(BlockStateProperties.LIT, true));
world.gameEvent((Entity) context.getPlayer(), (Holder) GameEvent.BLOCK_CHANGE, blockposition);