aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJake Potrebic <[email protected]>2024-05-25 22:36:55 -0700
committerJake Potrebic <[email protected]>2024-05-25 22:36:55 -0700
commit4e10fadfdc8f854feeabf916c23a71e21fb0b29f (patch)
tree5400dfa89bc23a24db305ddef3ccffacced579f2
parent41bee55b53b6a446c391b01bce79c9e0440200ef (diff)
downloadPaper-4e10fadfdc8f854feeabf916c23a71e21fb0b29f.tar.gz
Paper-4e10fadfdc8f854feeabf916c23a71e21fb0b29f.zip
reset meta block state on BlockStateMeta#setBlockState
-rw-r--r--patches/server/1038-General-ItemMeta-fixes.patch7
1 files changed, 5 insertions, 2 deletions
diff --git a/patches/server/1038-General-ItemMeta-fixes.patch b/patches/server/1038-General-ItemMeta-fixes.patch
index cd69df8297..481817c6be 100644
--- a/patches/server/1038-General-ItemMeta-fixes.patch
+++ b/patches/server/1038-General-ItemMeta-fixes.patch
@@ -150,7 +150,7 @@ index 1ac3bec02fce28d5ce698305a7482a9eccbb1867..b494568f833dc21d4e2447ac3e5c5002
for (Pattern p : this.patterns) {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java
-index 12911233c01d0ac1af9adbd157d56d28361fc76f..e5c2ab243fd56ef32321cbf127ef7b9d21fad56c 100644
+index 12911233c01d0ac1af9adbd157d56d28361fc76f..322d5f19d0c156bf6e46202d2e185d8aec455492 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBlockState.java
@@ -142,9 +142,17 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
@@ -411,7 +411,7 @@ index 12911233c01d0ac1af9adbd157d56d28361fc76f..e5c2ab243fd56ef32321cbf127ef7b9d
}
private static CraftBlockEntityState<?> getBlockState(Material material, CompoundTag blockEntityTag) {
-@@ -331,7 +407,19 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
+@@ -331,7 +407,22 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
Class<?> blockStateType = CraftBlockStates.getBlockStateType(stateMaterial);
Preconditions.checkArgument(blockStateType == blockState.getClass() && blockState instanceof CraftBlockEntityState, "Invalid blockState for " + this.material);
@@ -427,6 +427,9 @@ index 12911233c01d0ac1af9adbd157d56d28361fc76f..e5c2ab243fd56ef32321cbf127ef7b9d
+ patchedMap.setAll(map);
+ final DataComponentPatch patch = patchedMap.asPatch();
+ this.updateFromPatch(patch, null);
++ // we have to reset the fields because this should be like a "new" block entity is being used
++ this.blockEntityTag = CustomData.EMPTY;
++ this.components = DataComponentMap.EMPTY;
+ this.updateBlockState(patch);
+ // Paper end
}