0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git synced 2024-11-25 05:46:13 +00:00
craftbukkit/nms-patches/net/minecraft/world/item/ItemFlintAndSteel.patch
2024-04-24 01:15:00 +10:00

29 lines
2.1 KiB
Diff

--- a/net/minecraft/world/item/ItemFlintAndSteel.java
+++ b/net/minecraft/world/item/ItemFlintAndSteel.java
@@ -37,6 +37,12 @@
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, EntityLiving.getSlotForHand(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);
@@ -54,6 +60,12 @@
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, EntityLiving.getSlotForHand(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((Entity) entityhuman, (Holder) GameEvent.BLOCK_CHANGE, blockposition);