mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Fix some broken block place logic (#9094)
- The dispensed shulker will not play the place sound (due to its logic been removed) - The hanging sign text editor cannot be cancelled using the BlockPlaceEvent (not consistent with the other regular signs) - The jukebox logic hasn't been synced with the RecordItem
This commit is contained in:
parent
b87c297e3b
commit
b0f2d4916c
4 changed files with 74 additions and 4 deletions
|
@ -39,10 +39,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
// Paper
|
||||
// Paper start
|
||||
if (nbttagcompound == null) {
|
||||
player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
|
||||
+ player.fudgeSpawnLocation(worldserver1); // only move to spawn on first login, otherwise, stay where you are....
|
||||
}
|
||||
// Paper
|
||||
// Paper end
|
||||
player.setLevel(worldserver1);
|
||||
|
|
|
@ -29,11 +29,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
worldserver1 = worldserver;
|
||||
}
|
||||
|
||||
+ // Paper
|
||||
+ // Paper start
|
||||
+ if (nbttagcompound == null) {
|
||||
+ player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
|
||||
+ }
|
||||
+ // Paper
|
||||
+ // Paper end
|
||||
player.setLevel(worldserver1);
|
||||
String s1 = "local";
|
||||
|
||||
|
|
68
patches/server/Fix-block-place-logic.patch
Normal file
68
patches/server/Fix-block-place-logic.patch
Normal file
|
@ -0,0 +1,68 @@
|
|||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/HangingSignItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/HangingSignItem.java
|
||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -0,0 +0,0 @@ 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)));
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ 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 {
|
|
@ -12,9 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
|
||||
@Override
|
||||
public void gameEvent(GameEvent event, Vec3 emitterPos, GameEvent.Context emitter) {
|
||||
+ // Paper start
|
||||
+ if (this.getChunkIfLoadedImmediately((Mth.floor(emitterPos.x) >> 4), (Mth.floor(emitterPos.z) >> 4)) == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end
|
||||
this.gameEventDispatcher.post(event, emitterPos, emitter);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue