MCPcopy Create free account
hub / github.com/Bukkit/Bukkit / setData

Method setData

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

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

(MaterialData data)

Source from the content-addressed store, hash-verified

132 * @param data New MaterialData for this item
133 */
134 public void setData(MaterialData data) {
135 Material mat = getType();
136
137 if ((mat == null) || (mat.getData() == null)) {
138 this.data = data;
139 } else {
140 if ((data.getClass() == mat.getData()) || (data.getClass() == MaterialData.class)) {
141 this.data = data;
142 } else {
143 throw new IllegalArgumentException("Provided data is not of type " + mat.getData().getName() + ", found " + data.getClass().getName());
144 }
145 }
146 }
147
148 /**
149 * Sets the durability of this item

Callers

nothing calls this directly

Calls 3

getTypeMethod · 0.95
getDataMethod · 0.95
getNameMethod · 0.65

Tested by

no test coverage detected