aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0872-Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch
diff options
context:
space:
mode:
authorOwen <[email protected]>2024-03-03 17:05:34 -0500
committerGitHub <[email protected]>2024-03-03 17:05:34 -0500
commit89d51d5f298cd25d6f44388970596c6780b5664b (patch)
tree07f41f4ce7bc466ea5e35faa2575d0ec6f6c4a76 /patches/server/0872-Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch
parentb21eb4d9a4d0d0bea857675e2186657592df548e (diff)
downloadPaper-89d51d5f298cd25d6f44388970596c6780b5664b.tar.gz
Paper-89d51d5f298cd25d6f44388970596c6780b5664b.zip
Allow enabling sand duping (#10191)
Because this exploit has been widely known for years and has not been fixed by Mojang, we decided that it was worth allowing people to toggle it on/off due to how easy it is to make it configurable. It should be noted that this decision does not promise all future exploits will be configurable.
Diffstat (limited to 'patches/server/0872-Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch')
-rw-r--r--patches/server/0872-Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch23
1 files changed, 23 insertions, 0 deletions
diff --git a/patches/server/0872-Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch b/patches/server/0872-Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch
new file mode 100644
index 0000000000..288b2c3711
--- /dev/null
+++ b/patches/server/0872-Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch
@@ -0,0 +1,23 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Owen1212055 <[email protected]>
+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 964d6af9eb9752b9e08f712c80b67bd9410d1554..30cf71507c45432b2b5ac636aff852acf662ce60 100644
+--- a/src/main/java/net/minecraft/world/item/ItemStack.java
++++ b/src/main/java/net/minecraft/world/item/ItemStack.java
+@@ -545,7 +545,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 - Fix spigot sound playing for BlockItem ItemStacks
++ BlockPos position = new net.minecraft.world.item.context.BlockPlaceContext(context).getClickedPos();
++ net.minecraft.world.level.block.state.BlockState blockData = world.getBlockState(position);
++ SoundType soundeffecttype = blockData.getSoundType();
++ // Paper end - Fix spigot sound playing for BlockItem ItemStacks
+ world.playSound(entityhuman, blockposition, soundeffecttype.getPlaceSound(), SoundSource.BLOCKS, (soundeffecttype.getVolume() + 1.0F) / 2.0F, soundeffecttype.getPitch() * 0.8F);
+ }
+