Skip to content

Commit fb511c6

Browse files
Machine-Makerkennytv
authored andcommitted
Fix Player#sendBlockState (#10855)
1 parent 5bd7f4e commit fb511c6

File tree

35 files changed

+39
-8
lines changed

35 files changed

+39
-8
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Jake Potrebic <jake.m.potrebic@gmail.com>
3+
Date: Tue, 4 Jun 2024 19:48:03 -0700
4+
Subject: [PATCH] Fix Player#setBlockUpdate
5+
6+
BlockEntity needs its Level set
7+
8+
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
9+
index 397eb1a101bd60f49dbb2fa8eddf28f6f233167f..e28bc898786542f695017ff0a036676840eb79fe 100644
10+
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
11+
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
12+
@@ -177,6 +177,7 @@ public abstract class CraftBlockEntityState<T extends BlockEntity> extends Craft
13+
@Nullable
14+
public Packet<ClientGamePacketListener> getUpdatePacket(@NotNull Location location) {
15+
T vanillaTileEntitiy = (T) BlockEntity.loadStatic(CraftLocation.toBlockPosition(location), this.getHandle(), this.getSnapshotNBT(), this.getRegistryAccess());
16+
+ vanillaTileEntitiy.setLevel(((org.bukkit.craftbukkit.CraftWorld) location.getWorld()).getHandle()); // Paper - set level. Required for accessing RegistryAccess
17+
return ClientboundBlockEntityDataPacket.create(vanillaTileEntitiy);
18+
}
19+
20+
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
21+
index 4a886f11b10395143879e1c1795afc269eed109d..8d697782fae536377ac29acf967c764ee8a7951a 100644
22+
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
23+
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
24+
@@ -1118,6 +1118,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
25+
public void sendBlockUpdate(@NotNull Location location, @NotNull TileState tileState) throws IllegalArgumentException {
26+
Preconditions.checkArgument(location != null, "Location can not be null");
27+
Preconditions.checkArgument(tileState != null, "TileState can not be null");
28+
+ Preconditions.checkArgument(location.getWorld() != null, "Location must have a world"); // Paper
29+
30+
if (this.getHandle().connection == null) return;
31+
File renamed without changes.
File renamed without changes.
File renamed without changes.

patches/server/0970-General-ItemMeta-fixes.patch renamed to patches/server/0971-General-ItemMeta-fixes.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ index 6207c6063cd11ccb1177fe7016c49c02a3416990..cd3b952a228c09077c2e74183a34ddb3
4242
}
4343

4444
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
45-
index 397eb1a101bd60f49dbb2fa8eddf28f6f233167f..2c61e8d5bbab59c691f4cb003041e7e50e406b85 100644
45+
index e28bc898786542f695017ff0a036676840eb79fe..cee3fe00cc662f095e7d726b5f1a913cd8199210 100644
4646
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
4747
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
4848
@@ -135,6 +135,19 @@ public abstract class CraftBlockEntityState<T extends BlockEntity> extends Craft
File renamed without changes.

patches/server/0972-Added-API-to-get-player-ha-proxy-address.patch renamed to patches/server/0973-Added-API-to-get-player-ha-proxy-address.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ index 96355e1da8feb6687ea0069dda4a82fcd7e25e8a..1f696644b958538e9f5d568a2e4bba69
3535
} else {
3636
super.channelRead(ctx, msg);
3737
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
38-
index 4a886f11b10395143879e1c1795afc269eed109d..67a715a812d700df912834874107078255d7c695 100644
38+
index 8d697782fae536377ac29acf967c764ee8a7951a..e41b7191d0cebeb77b8d07a1b5bddc1b695cb922 100644
3939
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
4040
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
4141
@@ -275,6 +275,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)