From ce8838e721dad4dd3fc8d5e273d7c1e6b6b6be38 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 20 May 2025 23:12:19 -0700 Subject: [PATCH] Fix Wood Stripping sound not playing. Fixes #10525 --- .../minecraft/world/item/AxeItem.java.patch | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/patches/minecraft/net/minecraft/world/item/AxeItem.java.patch b/patches/minecraft/net/minecraft/world/item/AxeItem.java.patch index bd9001072b..e579c1fd10 100644 --- a/patches/minecraft/net/minecraft/world/item/AxeItem.java.patch +++ b/patches/minecraft/net/minecraft/world/item/AxeItem.java.patch @@ -1,15 +1,28 @@ --- a/net/minecraft/world/item/AxeItem.java +++ b/net/minecraft/world/item/AxeItem.java -@@ -62,7 +_,8 @@ +@@ -62,7 +_,7 @@ if (playerHasBlockingItemUseIntent(p_40529_)) { return InteractionResult.PASS; } else { - Optional optional = this.evaluateNewBlockState(level, blockpos, player, level.getBlockState(blockpos)); -+ var modded = level.getBlockState(blockpos).getToolModifiedState(p_40529_, net.minecraftforge.common.ToolActions.AXE_STRIP, false); -+ Optional optional = modded != null ? Optional.of(modded) : this.evaluateNewBlockState(level, blockpos, player, level.getBlockState(blockpos)); ++ Optional optional = this.evaluateNewBlockState(level, blockpos, player, level.getBlockState(blockpos), p_40529_); if (optional.isEmpty()) { return InteractionResult.PASS; } else { +@@ -88,7 +_,12 @@ + } + + private Optional evaluateNewBlockState(Level p_312809_, BlockPos p_313114_, @Nullable Player p_312029_, BlockState p_311198_) { +- Optional optional = this.getStripped(p_311198_); ++ return this.evaluateNewBlockState(p_312809_, p_313114_, p_312029_, p_311198_, null); ++ } ++ ++ private Optional evaluateNewBlockState(Level p_312809_, BlockPos p_313114_, @Nullable Player p_312029_, BlockState p_311198_, @Nullable UseOnContext ctx) { ++ var modded = ctx == null ? null : p_311198_.getToolModifiedState(ctx, net.minecraftforge.common.ToolActions.AXE_STRIP, false); ++ Optional optional = modded != null ? Optional.of(modded) : this.getStripped(p_311198_); + if (optional.isPresent()) { + p_312809_.playSound(p_312029_, p_313114_, SoundEvents.AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F); + return optional; @@ -115,5 +_,21 @@ private Optional getStripped(BlockState p_150691_) { return Optional.ofNullable(STRIPPABLES.get(p_150691_.getBlock())) @@ -21,7 +34,7 @@ + return net.minecraftforge.common.ToolActions.DEFAULT_AXE_ACTIONS.contains(toolAction); + } + -+ @org.jetbrains.annotations.Nullable ++ @Nullable + public static BlockState getAxeStrippingState(BlockState originalState) { + Block block = STRIPPABLES.get(originalState.getBlock()); + return block != null ? block.defaultBlockState().setValue(RotatedPillarBlock.AXIS, originalState.getValue(RotatedPillarBlock.AXIS)) : null;