mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Fix Player#sendBlockState (#10855)
This commit is contained in:
parent
2053f3bd83
commit
87f8c7ca9b
1 changed files with 31 additions and 0 deletions
31
patches/server/Fix-Player-setBlockUpdate.patch
Normal file
31
patches/server/Fix-Player-setBlockUpdate.patch
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||||
|
Date: Tue, 4 Jun 2024 19:48:03 -0700
|
||||||
|
Subject: [PATCH] Fix Player#setBlockUpdate
|
||||||
|
|
||||||
|
BlockEntity needs its Level set
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
|
||||||
|
@@ -0,0 +0,0 @@ public abstract class CraftBlockEntityState<T extends BlockEntity> extends Craft
|
||||||
|
@Nullable
|
||||||
|
public Packet<ClientGamePacketListener> getUpdatePacket(@NotNull Location location) {
|
||||||
|
T vanillaTileEntitiy = (T) BlockEntity.loadStatic(CraftLocation.toBlockPosition(location), this.getHandle(), this.getSnapshotNBT(), this.getRegistryAccess());
|
||||||
|
+ vanillaTileEntitiy.setLevel(((org.bukkit.craftbukkit.CraftWorld) location.getWorld()).getHandle()); // Paper - set level. Required for accessing RegistryAccess
|
||||||
|
return ClientboundBlockEntityDataPacket.create(vanillaTileEntitiy);
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
|
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
|
public void sendBlockUpdate(@NotNull Location location, @NotNull TileState tileState) throws IllegalArgumentException {
|
||||||
|
Preconditions.checkArgument(location != null, "Location can not be null");
|
||||||
|
Preconditions.checkArgument(tileState != null, "TileState can not be null");
|
||||||
|
+ Preconditions.checkArgument(location.getWorld() != null, "Location must have a world"); // Paper
|
||||||
|
|
||||||
|
if (this.getHandle().connection == null) return;
|
||||||
|
|
Loading…
Reference in a new issue