From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Date: Thu, 8 Jun 2023 20:23:13 -0400 Subject: [PATCH] Fix spigot sound playing for BlockItem ItemStacks diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java index 414167d5390baea98a9876ee4ea368c8eeee2f9f..adb7220be617d6d9f2cdd7fbe4fa2dd24cc7d142 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -513,7 +513,11 @@ public final class ItemStack { // SPIGOT-1288 - play sound stripped from ItemBlock if (this.item instanceof BlockItem) { - SoundType soundeffecttype = ((BlockItem) this.item).getBlock().defaultBlockState().getSoundType(); // TODO: not strictly correct, however currently only affects decorated pots + // Paper start + BlockPos position = new net.minecraft.world.item.context.BlockPlaceContext(itemactioncontext).getClickedPos(); + net.minecraft.world.level.block.state.BlockState blockData = world.getBlockState(position); + SoundType soundeffecttype = blockData.getSoundType(); + // Paper end world.playSound(entityhuman, blockposition, soundeffecttype.getPlaceSound(), SoundSource.BLOCKS, (soundeffecttype.getVolume() + 1.0F) / 2.0F, soundeffecttype.getPitch() * 0.8F); }