PaperMC/paper-server/nms-patches/net/minecraft/world/item/ItemFlintAndSteel.patch

33 lines
2.2 KiB
Diff
Raw Normal View History

2021-03-15 23:00:00 +01:00
--- 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);