PaperMC/paper-server/nms-patches/net/minecraft/world/item/ItemFlintAndSteel.patch
CraftBukkit/Spigot b3a8254758 Update to Minecraft 1.17
By: md_5 <git@md-5.net>
2021-06-11 15:00:00 +10:00

32 lines
2.2 KiB
Diff

--- a/net/minecraft/world/item/ItemFlintAndSteel.java
+++ b/net/minecraft/world/item/ItemFlintAndSteel.java
@@ -36,6 +36,14 @@
BlockPosition blockposition1 = blockposition.shift(itemactioncontext.getClickedFace());
if (BlockFireAbstract.a(world, blockposition1, itemactioncontext.g())) {
+ // 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.getItemStack().damage(1, entityhuman, (entityhuman1) -> {
+ entityhuman1.broadcastItemBreak(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.a((IBlockAccess) world, blockposition1);
@@ -55,6 +63,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.getItemStack().damage(1, entityhuman, (entityhuman1) -> {
+ entityhuman1.broadcastItemBreak(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.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockProperties.LIT, true), 11);
world.a((Entity) entityhuman, GameEvent.BLOCK_PLACE, blockposition);