PaperMC/paper-server/patches/sources/net/minecraft/world/item/FlintAndSteelItem.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

28 lines
2 KiB
Diff

--- a/net/minecraft/world/item/FlintAndSteelItem.java
+++ b/net/minecraft/world/item/FlintAndSteelItem.java
@@ -37,6 +37,12 @@
BlockPos blockposition1 = blockposition.relative(context.getClickedFace());
if (BaseFireBlock.canBePlacedAt(world, blockposition1, context.getHorizontalDirection())) {
+ // CraftBukkit start - Store the clicked block
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition1, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, entityhuman).isCancelled()) {
+ context.getItemInHand().hurtAndBreak(1, entityhuman, LivingEntity.getSlotForHand(context.getHand()));
+ return InteractionResult.PASS;
+ }
+ // CraftBukkit end
world.playSound(entityhuman, blockposition1, SoundEvents.FLINTANDSTEEL_USE, SoundSource.BLOCKS, 1.0F, world.getRandom().nextFloat() * 0.4F + 0.8F);
BlockState iblockdata1 = BaseFireBlock.getState(world, blockposition1);
@@ -54,6 +60,12 @@
return InteractionResult.FAIL;
}
} else {
+ // CraftBukkit start - Store the clicked block
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, entityhuman).isCancelled()) {
+ context.getItemInHand().hurtAndBreak(1, entityhuman, LivingEntity.getSlotForHand(context.getHand()));
+ return InteractionResult.PASS;
+ }
+ // CraftBukkit end
world.playSound(entityhuman, blockposition, SoundEvents.FLINTANDSTEEL_USE, SoundSource.BLOCKS, 1.0F, world.getRandom().nextFloat() * 0.4F + 0.8F);
world.setBlock(blockposition, (BlockState) iblockdata.setValue(BlockStateProperties.LIT, true), 11);
world.gameEvent((Entity) entityhuman, (Holder) GameEvent.BLOCK_CHANGE, blockposition);