Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-16 03:20:07 +01:00
32 Zeilen
2.1 KiB
Diff
32 Zeilen
2.1 KiB
Diff
|
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 397eb1a101bd60f49dbb2fa8eddf28f6f233167f..e28bc898786542f695017ff0a036676840eb79fe 100644
|
||
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
|
||
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
|
||
|
@@ -177,6 +177,7 @@ 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 4a886f11b10395143879e1c1795afc269eed109d..8d697782fae536377ac29acf967c764ee8a7951a 100644
|
||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||
|
@@ -1118,6 +1118,7 @@ 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;
|
||
|
|