Archiviert
13
0

Fix Player#sendBlockState (#10855)

Dieser Commit ist enthalten in:
Jake Potrebic 2024-06-15 08:05:21 -07:00 committet von Nassim Jahnke
Ursprung 5bd7f4e8ae
Commit fb511c698e
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
35 geänderte Dateien mit 39 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -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 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;

Datei anzeigen

@ -42,7 +42,7 @@ index 6207c6063cd11ccb1177fe7016c49c02a3416990..cd3b952a228c09077c2e74183a34ddb3
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
index 397eb1a101bd60f49dbb2fa8eddf28f6f233167f..2c61e8d5bbab59c691f4cb003041e7e50e406b85 100644
index e28bc898786542f695017ff0a036676840eb79fe..cee3fe00cc662f095e7d726b5f1a913cd8199210 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
@@ -135,6 +135,19 @@ public abstract class CraftBlockEntityState<T extends BlockEntity> extends Craft

Datei anzeigen

@ -35,7 +35,7 @@ index 96355e1da8feb6687ea0069dda4a82fcd7e25e8a..1f696644b958538e9f5d568a2e4bba69
} else {
super.channelRead(ctx, msg);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 4a886f11b10395143879e1c1795afc269eed109d..67a715a812d700df912834874107078255d7c695 100644
index 8d697782fae536377ac29acf967c764ee8a7951a..e41b7191d0cebeb77b8d07a1b5bddc1b695cb922 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -275,6 +275,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

Datei anzeigen

@ -28628,10 +28628,10 @@ index 8f88ccec6b8947ca2738dc07c23aebe258145c83..cdc704364cf339084537d089e654f607
// Paper start - implement pointers
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 67a715a812d700df912834874107078255d7c695..545921a7e07dccc749711208f160fdbfab53c5fa 100644
index e41b7191d0cebeb77b8d07a1b5bddc1b695cb922..ecd975855d92ae5948ee926f42396cb004843aed 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3490,12 +3490,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3491,12 +3491,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public int getViewDistance() {
@ -28648,7 +28648,7 @@ index 67a715a812d700df912834874107078255d7c695..545921a7e07dccc749711208f160fdbf
}
@Override
@@ -3505,7 +3507,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3506,7 +3508,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void setSimulationDistance(final int simulationDistance) {
@ -28659,7 +28659,7 @@ index 67a715a812d700df912834874107078255d7c695..545921a7e07dccc749711208f160fdbf
}
@Override
@@ -3515,6 +3519,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3516,6 +3520,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void setSendViewDistance(final int viewDistance) {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] stubs
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 545921a7e07dccc749711208f160fdbfab53c5fa..ff2d05126d3857fa501f0b9df80e373b1811f7cf 100644
index ecd975855d92ae5948ee926f42396cb004843aed..4a613d94f40cc73a9f50b8ef2d6949fc2bd34e53 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -110,6 +110,7 @@ import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
@ -24,7 +24,7 @@ index 545921a7e07dccc749711208f160fdbfab53c5fa..ff2d05126d3857fa501f0b9df80e373b
@DelegateDeserialization(CraftOfflinePlayer.class)
public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3480,6 +3482,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3481,6 +3483,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void resetIdleDuration() {
this.getHandle().resetLastActionTime();
}