Skip to content

Commit fc23381

Browse files
fix: PDC Clarifications (#477)
1 parent ac0f87c commit fc23381

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

docs/paper/dev/api/pdc.mdx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,14 @@ container.set(key, new UUIDDataType(), uuid);
164164

165165
## Storing on different objects
166166

167+
:::caution
168+
169+
Data is **not** copied across holders for you, and needs to be **manually** copied if 'moving' between PersistentDataHolders.
170+
171+
E.g. Placing an ItemStack as a Block (with a TileState) ***does not*** copy over PDC data.
172+
173+
:::
174+
167175
Objects that can have a PDC implement the <Javadoc name={"org.bukkit.persistence.PersistentDataHolder"}>`PersistentDataHolder`</Javadoc> interface
168176
and their PDC can be fetched with <Javadoc name={"org.bukkit.persistence.PersistentDataHolder#getPersistentDataContainer()"}>`PersistentDataHolder#getPersistentDataContainer()`</Javadoc>.
169177

@@ -174,7 +182,7 @@ and their PDC can be fetched with <Javadoc name={"org.bukkit.persistence.Persist
174182
- ##### <Javadoc name={"org.bukkit.entity.Entity"}>`Entity`</Javadoc>
175183
- `Entity#getPersistentDataContainer()`
176184
- ##### <Javadoc name={"org.bukkit.block.TileState"}>`TileState`</Javadoc>
177-
- This is slightly more complicated, as you need to cast the block to something that extends `TileState`.
185+
- This is slightly more complicated, as you need to cast the block's state to something that extends `TileState`.
178186
This does not work for all blocks, only those that have a tile entity.
179187
```java
180188
Block block = ...;
@@ -187,3 +195,7 @@ and their PDC can be fetched with <Javadoc name={"org.bukkit.persistence.Persist
187195
- `Structure#getPersistentDataContainer()`
188196
- ##### <Javadoc name={"org.bukkit.inventory.meta.ItemMeta"}>`ItemMeta`</Javadoc>
189197
- `ItemMeta#getPersistentDataContainer()`
198+
- ##### <Javadoc name={"org.bukkit.generator.structure.GeneratedStructure"}>`GeneratedStructure`</Javadoc>
199+
- `GeneratedStructure#getPersistentDataContainer()`
200+
- ##### <Javadoc name={"org.bukkit.Raid"}>`Raid`</Javadoc>
201+
- `Raid#getPersistentDataContainer()`

0 commit comments

Comments
 (0)