Sets the type of this item Note that in doing so you will reset the MaterialData for this stack. IMPORTANT: An Item Stack is only designed to contain items . Do not use this class to encapsulate Materials for which Material#isItem() returns false. @param type New
(@NotNull Material type)
| 132 | * @param type New type to set the items in this stack to |
| 133 | */ |
| 134 | @Utility |
| 135 | public void setType(@NotNull Material type) { |
| 136 | Validate.notNull(type, "Material cannot be null"); |
| 137 | this.type = type; |
| 138 | if (this.meta != null) { |
| 139 | this.meta = Bukkit.getItemFactory().asMetaFor(meta, type); |
| 140 | } |
| 141 | if (type.isLegacy()) { |
| 142 | createData((byte) 0); |
| 143 | } else { |
| 144 | this.data = null; |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * Gets the amount of items in this stack |
nothing calls this directly
no test coverage detected