mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 06:25:15 +01:00
reset meta block state on BlockStateMeta#setBlockState
This commit is contained in:
parent
41bee55b53
commit
4e10fadfdc
1 changed files with 5 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue