mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 11:44:19 +01:00
43702a9e10
By: md_5 <git@md-5.net>
32 lines
2.2 KiB
Diff
32 lines
2.2 KiB
Diff
--- a/net/minecraft/world/item/ItemFlintAndSteel.java
|
|
+++ b/net/minecraft/world/item/ItemFlintAndSteel.java
|
|
@@ -34,6 +34,14 @@
|
|
BlockPosition blockposition1 = blockposition.relative(itemactioncontext.getClickedFace());
|
|
|
|
if (BlockFireAbstract.canBePlacedAt(world, blockposition1, itemactioncontext.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()) {
|
|
+ itemactioncontext.getItemInHand().hurtAndBreak(1, entityhuman, (entityhuman1) -> {
|
|
+ entityhuman1.broadcastBreakEvent(itemactioncontext.getHand());
|
|
+ });
|
|
+ return EnumInteractionResult.PASS;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
world.playSound(entityhuman, blockposition1, SoundEffects.FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.0F, world.getRandom().nextFloat() * 0.4F + 0.8F);
|
|
IBlockData iblockdata1 = BlockFireAbstract.getState(world, blockposition1);
|
|
|
|
@@ -53,6 +61,14 @@
|
|
return EnumInteractionResult.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()) {
|
|
+ itemactioncontext.getItemInHand().hurtAndBreak(1, entityhuman, (entityhuman1) -> {
|
|
+ entityhuman1.broadcastBreakEvent(itemactioncontext.getHand());
|
|
+ });
|
|
+ return EnumInteractionResult.PASS;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
world.playSound(entityhuman, blockposition, SoundEffects.FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.0F, world.getRandom().nextFloat() * 0.4F + 0.8F);
|
|
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockProperties.LIT, true), 11);
|
|
world.gameEvent(entityhuman, GameEvent.BLOCK_PLACE, blockposition);
|