aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/item/FlintAndSteelItem.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/item/FlintAndSteelItem.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/item/FlintAndSteelItem.java.patch70
1 files changed, 70 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/item/FlintAndSteelItem.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/item/FlintAndSteelItem.java.patch
new file mode 100644
index 0000000000..33db34830e
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/item/FlintAndSteelItem.java.patch
@@ -0,0 +1,70 @@
+--- a/net/minecraft/world/item/FlintAndSteelItem.java
++++ b/net/minecraft/world/item/FlintAndSteelItem.java
+@@ -24,34 +26,47 @@
+
+ @Override
+ public InteractionResult useOn(UseOnContext context) {
+- Player player = context.getPlayer();
+- Level level = context.getLevel();
+- BlockPos clickedPos = context.getClickedPos();
+- BlockState blockState = level.getBlockState(clickedPos);
+- if (!CampfireBlock.canLight(blockState) && !CandleBlock.canLight(blockState) && !CandleCakeBlock.canLight(blockState)) {
+- BlockPos blockPos = clickedPos.relative(context.getClickedFace());
+- if (BaseFireBlock.canBePlacedAt(level, blockPos, context.getHorizontalDirection())) {
+- 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);
+- level.gameEvent(player, GameEvent.BLOCK_PLACE, clickedPos);
+- ItemStack itemInHand = context.getItemInHand();
+- if (player instanceof ServerPlayer) {
+- CriteriaTriggers.PLACED_BLOCK.trigger((ServerPlayer)player, blockPos, itemInHand);
+- itemInHand.hurtAndBreak(1, player, contextPlayer -> contextPlayer.broadcastBreakEvent(context.getHand()));
++ Player entityhuman = context.getPlayer();
++ Level world = context.getLevel();
++ BlockPos blockposition = context.getClickedPos();
++ IBlockData iblockdata = world.getBlockState(blockposition);
++
++ if (!CampfireBlock.canLight(iblockdata) && !CandleBlock.canLight(iblockdata) && !CandleCakeBlock.canLight(iblockdata)) {
++ BlockPos blockposition1 = blockposition.relative(context.getClickedFace());
++
++ if (BaseFireBlock.canBePlacedAt(world, blockposition1, context.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()) {
++ context.getItemInHand().hurtAndBreak(1, entityhuman, (entityhuman1) -> {
++ entityhuman1.broadcastBreakEvent(context.getHand());
++ });
++ return InteractionResult.PASS;
+ }
++ // CraftBukkit end
++ world.playSound(entityhuman, blockposition1, SoundEvents.FLINTANDSTEEL_USE, SoundSource.BLOCKS, 1.0F, world.getRandom().nextFloat() * 0.4F + 0.8F);
++ IBlockData iblockdata1 = BaseFireBlock.getState(world, blockposition1);
+
+ return InteractionResult.sidedSuccess(level.isClientSide());
+ } else {
+ return InteractionResult.FAIL;
+ }
+ } else {
+- 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);
+- if (player != null) {
+- context.getItemInHand().hurtAndBreak(1, player, contextPlayer -> contextPlayer.broadcastBreakEvent(context.getHand()));
++ // 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()) {
++ context.getItemInHand().hurtAndBreak(1, entityhuman, (entityhuman1) -> {
++ entityhuman1.broadcastBreakEvent(context.getHand());
++ });
++ return InteractionResult.PASS;
+ }
++ // CraftBukkit end
++ world.playSound(entityhuman, blockposition, SoundEvents.FLINTANDSTEEL_USE, SoundSource.BLOCKS, 1.0F, world.getRandom().nextFloat() * 0.4F + 0.8F);
++ world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockStateProperties.LIT, true), 11);
++ world.gameEvent((Entity) entityhuman, GameEvent.BLOCK_CHANGE, blockposition);
++ if (entityhuman != null) {
++ context.getItemInHand().hurtAndBreak(1, entityhuman, (entityhuman1) -> {
++ entityhuman1.broadcastBreakEvent(context.getHand());
++ });
++ }
+
+ return InteractionResult.sidedSuccess(level.isClientSide());
+ }