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

Method setItemMeta0

src/main/java/org/bukkit/inventory/ItemStack.java:577–597  ·  view source on GitHub ↗
(@Nullable ItemMeta itemMeta, @NotNull Material material)

Source from the content-addressed store, hash-verified

575 * Cannot be overridden, so it's safe for constructor call
576 */
577 private boolean setItemMeta0(@Nullable ItemMeta itemMeta, @NotNull Material material) {
578 if (itemMeta == null) {
579 this.meta = null;
580 return true;
581 }
582 if (!Bukkit.getItemFactory().isApplicable(itemMeta, material)) {
583 return false;
584 }
585 this.meta = Bukkit.getItemFactory().asMetaFor(itemMeta, material);
586
587 Material newType = Bukkit.getItemFactory().updateMaterial(meta, material);
588 if (this.type != newType) {
589 this.type = newType;
590 }
591
592 if (this.meta == itemMeta) {
593 this.meta = itemMeta.clone();
594 }
595
596 return true;
597 }
598}

Callers 2

ItemStackMethod · 0.95
setItemMetaMethod · 0.95

Calls 5

getItemFactoryMethod · 0.95
isApplicableMethod · 0.65
asMetaForMethod · 0.65
updateMaterialMethod · 0.65
cloneMethod · 0.65

Tested by

no test coverage detected