Skip to content

Commit

Permalink
[~] Made Shovels dowse Braziers
Browse files Browse the repository at this point in the history
  • Loading branch information
crispytwig committed Jan 31, 2024
1 parent fb9abc2 commit a8f986c
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.stats.Stats;
import net.minecraft.tags.ItemTags;
import net.minecraft.util.RandomSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
Expand Down Expand Up @@ -52,6 +53,14 @@ public BrazierBlock(Properties properties) {

public InteractionResult use(BlockState blockState, Level level, BlockPos blockPos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult) {
ItemStack itemStack = player.getItemInHand(interactionHand);
if (itemStack.is(ItemTags.SHOVELS)) {
if (blockState.getValue(LIT)) {
dowse(player, level, blockPos, blockState);
level.setBlock(blockPos, blockState.setValue(LIT, false), 11);
return InteractionResult.SUCCESS;
}
}

if(itemStack.getItem() == Items.FLINT_AND_STEEL && !blockState.getValue(LIT)) {
itemStack.hurtAndBreak(1, player, (playerEntity) -> { playerEntity.broadcastBreakEvent(interactionHand); });
level.playSound(null, blockPos, SoundEvents.FLINTANDSTEEL_USE, SoundSource.BLOCKS, 1.0F, level.random.nextFloat() * 0.4F + 0.8F);
Expand Down

0 comments on commit a8f986c

Please sign in to comment.