mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-04 18:12:09 +01:00
28 lines
2.1 KiB
Diff
28 lines
2.1 KiB
Diff
--- a/net/minecraft/world/item/FlintAndSteelItem.java
|
|
+++ b/net/minecraft/world/item/FlintAndSteelItem.java
|
|
@@ -32,6 +_,12 @@
|
|
if (!CampfireBlock.canLight(blockState) && !CandleBlock.canLight(blockState) && !CandleCakeBlock.canLight(blockState)) {
|
|
BlockPos blockPos = clickedPos.relative(context.getClickedFace());
|
|
if (BaseFireBlock.canBePlacedAt(level, blockPos, context.getHorizontalDirection())) {
|
|
+ // CraftBukkit start - Store the clicked block
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(level, blockPos, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, player).isCancelled()) {
|
|
+ context.getItemInHand().hurtAndBreak(1, player, LivingEntity.getSlotForHand(context.getHand()));
|
|
+ return InteractionResult.PASS;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
level.playSound(player, blockPos, SoundEvents.FLINTANDSTEEL_USE, SoundSource.BLOCKS, 1.0F, level.getRandom().nextFloat() * 0.4F + 0.8F);
|
|
BlockState state = BaseFireBlock.getState(level, blockPos);
|
|
level.setBlock(blockPos, state, 11);
|
|
@@ -47,6 +_,12 @@
|
|
return InteractionResult.FAIL;
|
|
}
|
|
} else {
|
|
+ // CraftBukkit start - Store the clicked block
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(level, clickedPos, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, player).isCancelled()) {
|
|
+ context.getItemInHand().hurtAndBreak(1, player, LivingEntity.getSlotForHand(context.getHand()));
|
|
+ return InteractionResult.PASS;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
level.playSound(player, clickedPos, SoundEvents.FLINTANDSTEEL_USE, SoundSource.BLOCKS, 1.0F, level.getRandom().nextFloat() * 0.4F + 0.8F);
|
|
level.setBlock(clickedPos, blockState.setValue(BlockStateProperties.LIT, Boolean.valueOf(true)), 11);
|
|
level.gameEvent(player, GameEvent.BLOCK_CHANGE, clickedPos);
|