From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Date: Mon, 3 Apr 2023 18:46:49 +0200 Subject: [PATCH] Fix block place logic diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java index b0204af850ee182773ad458208cccd946ad148d5..ebee8de2ed831755b6fd154f6cc77ac993839bb9 100644 --- a/src/main/java/net/minecraft/world/item/BlockItem.java +++ b/src/main/java/net/minecraft/world/item/BlockItem.java @@ -131,7 +131,7 @@ public class BlockItem extends Item { SoundType soundeffecttype = iblockdata1.getSoundType(); - // world.playSound(entityhuman, blockposition, this.getPlaceSound(iblockdata1), SoundCategory.BLOCKS, (soundeffecttype.getVolume() + 1.0F) / 2.0F, soundeffecttype.getPitch() * 0.8F); + if (entityhuman == null) world.playSound(entityhuman, blockposition, this.getPlaceSound(iblockdata1), net.minecraft.sounds.SoundSource.BLOCKS, (soundeffecttype.getVolume() + 1.0F) / 2.0F, soundeffecttype.getPitch() * 0.8F); // Paper - reintroduce this for the dispenser (i.e the shulker) world.gameEvent(GameEvent.BLOCK_PLACE, blockposition, GameEvent.Context.of(entityhuman, iblockdata1)); if ((entityhuman == null || !entityhuman.getAbilities().instabuild) && itemstack != ItemStack.EMPTY) { // CraftBukkit itemstack.shrink(1); diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java index 6a25b768ea2e99acdda781cdc0ab7bf80b45912c..5f0e01060e1d8716e7514a25cbe68b732efaa8ef 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -463,13 +463,7 @@ public final class ItemStack { if (tileentity instanceof JukeboxBlockEntity) { JukeboxBlockEntity tileentityjukebox = (JukeboxBlockEntity) tileentity; - // There can only be one - ItemStack record = this.copy(); - if (!record.isEmpty()) { - record.setCount(1); - } - - tileentityjukebox.setFirstItem(record); + tileentityjukebox.setFirstItem(this.copy()); // Paper - sync this with record item, jukebox has now an inventory world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(entityhuman, world.getBlockState(blockposition))); }