MCPcopy Create free account
hub / github.com/Teneted/Tenet / setData

Method setData

src/main/java/org/bukkit/inventory/ItemStack.java:186–198  ·  view source on GitHub ↗

Sets the MaterialData for this stack of items @param data New MaterialData for this item

(@Nullable MaterialData data)

Source from the content-addressed store, hash-verified

184 * @param data New MaterialData for this item
185 */
186 public void setData(@Nullable MaterialData data) {
187 if (data == null) {
188 this.data = data;
189 } else {
190 Material mat = Bukkit.getUnsafe().toLegacy(getType());
191
192 if ((data.getClass() == mat.getData()) || (data.getClass() == MaterialData.class)) {
193 this.data = data;
194 } else {
195 throw new IllegalArgumentException("Provided data is not of type " + mat.getData().getName() + ", found " + data.getClass().getName());
196 }
197 }
198 }
199
200 /**
201 * Sets the durability of this item

Callers

nothing calls this directly

Calls 5

getUnsafeMethod · 0.95
getTypeMethod · 0.95
getDataMethod · 0.95
toLegacyMethod · 0.65
getNameMethod · 0.65

Tested by

no test coverage detected