You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pdc.set(key, PersistentDataType.STRING, "I love Tacos!");
42
+
pdc.set(key, PersistentDataType.STRING, "I love tacos!");
43
43
```
44
44
45
45
[`ItemStack`](jd:paper:org.bukkit.inventory.ItemStack) however doesn't have this method and instead requires you to use its builder-style consumer:
46
46
47
47
```java
48
-
NamespacedKey key =...;// Retrieve the key from before
48
+
NamespacedKey key =...;
49
49
50
50
// For 1.20.4 and below, use 'new ItemStack(Material.DIAMOND)' instead
51
51
ItemStack item =ItemStack.of(Material.DIAMOND);
52
52
item.editPersistentDataContainer(pdc -> {
53
-
pdc.set(key, PersistentDataType.STRING, "I love Tacos!");
53
+
pdc.set(key, PersistentDataType.STRING, "I love tacos!");
54
54
});
55
55
```
56
56
@@ -76,13 +76,14 @@ To get data from the PDC, you need to know the `NamespacedKey` and the [`Persist
76
76
Some API parts, such as Adventure's [`Component.text(String)`](https://jd.advntr.dev/api/latest/net/kyori/adventure/text/Component.html#text(java.lang.String)), require non-null values. In such cases, use the [`getOrDefault`](jd:paper:io.papermc.paper.persistence.PersistentDataContainerView#getOrDefault(org.bukkit.NamespacedKey,org.bukkit.persistence.PersistentDataType,C)) on the pdc instead of [`get`](jd:paper:io.papermc.paper.persistence.PersistentDataContainerView#get(org.bukkit.NamespacedKey,org.bukkit.persistence.PersistentDataType)), which is nullable.
77
77
78
78
```java
79
-
NamespacedKey key =...; //Retrieve the key from before
80
-
World world =...; //Retrieve the world from before
79
+
NamespacedKey key =...; //Use the same key as the adding-data example
80
+
World world =...; //Use the same world as the adding-data example
0 commit comments