net.minecraft.world.item

This commit is contained in:
Jake Potrebic
2024-12-14 12:50:20 -08:00
parent 718d970f97
commit 31913c0b0a
64 changed files with 1134 additions and 2053 deletions

View File

@@ -0,0 +1,28 @@
--- a/net/minecraft/world/item/FlintAndSteelItem.java
+++ b/net/minecraft/world/item/FlintAndSteelItem.java
@@ -32,6 +_,12 @@
if (!CampfireBlock.canLight(blockState) && !CandleBlock.canLight(blockState) && !CandleCakeBlock.canLight(blockState)) {
BlockPos blockPos = clickedPos.relative(context.getClickedFace());
if (BaseFireBlock.canBePlacedAt(level, blockPos, context.getHorizontalDirection())) {
+ // CraftBukkit start - Store the clicked block
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(level, blockPos, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, player).isCancelled()) {
+ context.getItemInHand().hurtAndBreak(1, player, LivingEntity.getSlotForHand(context.getHand()));
+ return InteractionResult.PASS;
+ }
+ // CraftBukkit end
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);
@@ -47,6 +_,12 @@
return InteractionResult.FAIL;
}
} else {
+ // CraftBukkit start - Store the clicked block
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(level, clickedPos, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, player).isCancelled()) {
+ context.getItemInHand().hurtAndBreak(1, player, LivingEntity.getSlotForHand(context.getHand()));
+ return InteractionResult.PASS;
+ }
+ // CraftBukkit end
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);