Don't use event to get block position (#9295)

This commit is contained in:
Owen1212055 2023-06-10 02:13:42 -04:00
parent 120345dea6
commit eb317edc8a

View File

@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (this.item instanceof BlockItem) { if (this.item instanceof BlockItem) {
- SoundType soundeffecttype = ((BlockItem) this.item).getBlock().getSoundType(null); - SoundType soundeffecttype = ((BlockItem) this.item).getBlock().getSoundType(null);
+ // Paper start + // Paper start
+ BlockPos position = ((CraftBlock) placeEvent.getBlock()).getPosition(); + BlockPos position = new net.minecraft.world.item.context.BlockPlaceContext(itemactioncontext).getClickedPos();
+ net.minecraft.world.level.block.state.BlockState blockData = world.getBlockState(position); + net.minecraft.world.level.block.state.BlockState blockData = world.getBlockState(position);
+ SoundType soundeffecttype = blockData.getSoundType(); + SoundType soundeffecttype = blockData.getSoundType();
+ // Paper end + // Paper end