fromStack

@Contract(value = "null -> null")
fun fromStack(stack: ItemStack?): RebarItem?(source)

Gets a RebarItem from an ItemStack if the item is a Rebar item Returns null if the ItemStack is not a Rebar item

If you only want RebarItems of a specific type, use the class specific method for better performance, it will check the underlying RebarItemSchema.itemClass before it constructs the RebarItem instead of constructing the RebarItem and then after checking its type.


@Contract(value = "null -> null")
fun <T> fromStack(stack: ItemStack?, clazz: Class<T>): T?(source)

Converts a regular ItemStack to a RebarItem of class clazz Returns null if the ItemStack is not a Rebar item or is not of the specified clazz