getItem() | Item | Returns the instance of the Item class associated with this ItemStackJS. |
getItemStack() | ItemStack | Returns the vanilla ItemStack that this wraps.
|
getId() | String | Returns the item id associated with this ItemStackJS in the form mod\_name:item\_name
|
getTags() | Colletion<ResourceLocation> | Returns all item tags the item has. (NOT NBT tags).
|
hasTag(ResourceLocation tag) | boolean | Returns if the item has the input tag or not.
|
copy() | ItemStackJS | Returns a copy of this ItemStackJS.
|
setCount(int count) | void | Sets the count on this ItemStackJS.
|
getCount() | int | Gets the count.
|
withCount() | ItemStackJS | Returns a copy of this ItemStackJS with a different count.
|
isEmpty() | boolean | Returns if this is an empty item or not.
|
isInvalidRecipeIngredient() | boolean | Returns if this is a valid recipe ingredient.
|
isBlock() | boolean | Returns if this item is a BlockItem, that is it can be placed and form a block.
|
@Nullable getNbt() | CompoundTag | Gets this items NBT data.
|
setNbt(@Nullable CompoundTag tag) | void | Sets this items NBT data
|
hasNBT() | boolean | Returns if this item has NBT data.
|
getNbtString() | String | Returns this items NBT data as a string. If you want to display it to the player see [Text#prettyPrintNbt](https://mods.latvian.dev/books/kubejs-legacy/page/components-kubejs-and-you#:~:text=prettyPrintNbt(Tag%20tag)).
|
removeNBT() | ItemStackJS | Returns a copy with no NBT data.
|
withNBT(CompoundTag nbt) | ItemStackJS | Returns a copy with the specified NBT data. Any tags from the original NBT are kept if not overwritten by the NBT passed in.
|
hasChance() | boolean | Returns if the ItemStackJS has a chance.
|
removeChance() | void | Removes the chance from this ItemStackJS.
|
setChance(double c) | void | Sets the chance for this ItemStackJS.
|
getChance() | double | Returns the chance.
|
withChance(double c) | ItemStackJS | Returns a copy with the chance passed in, unless the chance passed in is the same as the current chance, in which case it returns this.
|
getName() | Components | Returns this items name. Probably a Translateable Component unless its been overridden by something else (ie method below).
|
withName(@Nullable Component displayName) | ItemStackJS | Returns a copy with a different display name set.
|
toString() | String | Returns a string representing this ItemStackJS. The same method used for the `/kubejs hand` command.
|
test(ItemStackJS other) | boolean | Returns if this ItemStackJS equals another one. Tests for item type and NBT data.
|
testVanilla(ItemStack other) | boolean | Returns if this ItemStackJS equals the passed in ItemStack. Tests for item type and NBT data.
|
testVanillaItem(Item item)
| boolean | Returns if the Item passed in is the same as this ItemStackJS's Item. Basically checks they are the same item type.
|
getStacks() | Set<ItemStackJS> | Returns this ItemStackJS as the only entry in a Set.
|
getVanillaItems() | Set<Item> | Returns this ItemStackJS associated Item as the only entry in a Set.
|
getFirst() | ItemStackJS | Retuns a copy of this ItemStackJS
|
hashCode() | int | Returns a hash code of the Item and NBT data.
|
equals(Object o) | boolean | Returns if this is equal to the input object.
|
strongEquals(Object o) | boolean | Returns if this is equal to the input object. Checks count as well.
|
getEnchantments() | MapJS | Returns a MapJS of this itemStackJS enchament id's to their level.
|
hasEnchantment(Enchantment enchantment, int level) | boolean | Returns if this ItemStackJS is enchanted with a minimum of the passed in enchantment level.
|
enchant(MapJS enchantments) | ItemStackJS | Enchants a copy of this ItemStackJS with the MapJS passed in (it should be a map of enchantment ids to levels), then returns the copy.
|
enchant(Enchantment enchantment, int level) | ItemStackJS | Enchants a copy of this item with the passed in Enchantment at the specified level, then returns the copy.
|
getMod() | String | Returns the mod id of the mod this item is from.
|
ignoreNBT() | IngredientJS | Returns a new IgnoreNBTIngredientJS of this item.
|
weakNBT() | IngredientJS | Returns a new WeakNBTIngredientJS of this item.
|
areItemsEqual(ItemStackJS other) | boolean | Returns if this item type is equal to the item type of the passed in ItemStackJS
|
areItemsEqual(ItemStack other) | boolean | Returns if this item type is equal to the item type of the passed in ItemStack
|
isNBTEqual(ItemStackJS other) | boolean | Returns if the NBT of this ItemStackJS is equal to the NBT of the ItemStackJS passed in.
|
isNBTEqual(ItemStack other) | boolean | Returns if the NBT of this ItemStackJS is equal to the NBT of the ItemStack passed in.
|
getHarvestSpeed(@Nullable BlockContainerJS block) | float | Returns the mining speed of this ItemStackJS if used to mine the passed in BlockContainerJS
|
getHarvestSpeed() | float | Returns this items default mining speed
|
toJson() toResultJson()
toRawResultJson()
| JsonElement | Returns a Json representation of this ItemStackJS. They all appear to work almost identically.
|
toNBT() | CompoundTag | Returns an NBT representation of this ItemStackJS, the same sort that vanilla uses to store items in blocks.
|
onChanged(@Nullable Tag o) | void | Sets the items NBT data to the tag passed in, only if it is a CompoundTag or null.
|
getItemGroup() | String | Returns the name of the creative tab this item belongs in. An empty string if it does not exist in the creative tabs (like a jigsaw block).
|
getItemIds() | Set<String> | Returns a set with this items id as the only entry. |
getFluidStack() | FluidStackJS | Returns null, by default. Overriden by some superclasses to return the FluidStackJS that this item represents. |
getTypeData() | CompoundTag | Unknown purpose. |