mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-25 20:16:19 +01:00
69 lines
4.4 KiB
Diff
69 lines
4.4 KiB
Diff
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/HangingSignItem.java b/src/main/java/net/minecraft/world/item/HangingSignItem.java
|
|
index f8f8392ba16838449354e78f0ce69af37b0b7fed..91caa607a21bfb61849826949b59bcdac73af7ab 100644
|
|
--- a/src/main/java/net/minecraft/world/item/HangingSignItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/HangingSignItem.java
|
|
@@ -33,11 +33,14 @@ public class HangingSignItem extends StandingAndWallBlockItem {
|
|
protected boolean updateCustomBlockEntityTag(BlockPos pos, Level world, @Nullable Player player, ItemStack stack, BlockState state) {
|
|
boolean bl = super.updateCustomBlockEntityTag(pos, world, player, stack, state);
|
|
if (!world.isClientSide && !bl && player != null) {
|
|
- BlockEntity var8 = world.getBlockEntity(pos);
|
|
+ // Paper start - moved in ItemStack use handler for events cancellation
|
|
+ /*BlockEntity var8 = world.getBlockEntity(pos);
|
|
if (var8 instanceof SignBlockEntity) {
|
|
SignBlockEntity signBlockEntity = (SignBlockEntity)var8;
|
|
player.openTextEdit(signBlockEntity);
|
|
- }
|
|
+ }*/
|
|
+ SignItem.openSign = pos;
|
|
+ // Paper end
|
|
}
|
|
|
|
return bl;
|
|
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
index fd6c80d6cb83ab2dc0fca913655eea8cc68dd5a6..a7533d18fe6148d7bfd3106b9cdcb6fa3347cf7c 100644
|
|
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
@@ -458,13 +458,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)));
|
|
}
|
|
|
|
@@ -490,7 +484,7 @@ public final class ItemStack {
|
|
}
|
|
|
|
// SPIGOT-4678
|
|
- if (this.item instanceof SignItem && SignItem.openSign != null) {
|
|
+ if ((this.item instanceof SignItem || this.item instanceof HangingSignItem) && SignItem.openSign != null) { // Paper - trigger the hanging sign text editor now
|
|
try {
|
|
entityhuman.openTextEdit((SignBlockEntity) world.getBlockEntity(SignItem.openSign));
|
|
} finally {
|