Represent a minecraft item with its associated data
const Item = require('prismarine-item')('1.8')
const ironShovelItem = new Item(256, 1)
console.log(ironShovelItem)
const notchItem = Item.toNotch(ironShovelItem)
console.log(notchItem)
console.log(Item.fromNotch(notchItem))
- sentByServer - whether this item was sent by the server to the client, so default initialization will not be done on the item. For example, tools will not have the default item NBT written to them.
Take an Item
instance and returns it in the format of the minecraft packets.
- serverAuthoritative: Whether the server is using server authoritative inventory (whether or not to write a Stack ID)
Take an item
in the format of the minecraft packets and return an Item
instance.
- stackId for bedrock items before 1.16.220
Take two seperate item
instances, and makes one item using the same combining done by the vanilla anvil
itemOne
- first item
itemTwo
- second item
matchStackSize
- whether to check for count equality
matchNbt
- wether to check for NBT equality
Checks equality between two items based on itemType, count, metadata, and stringified nbt
Numerical id.
Number which represents different things depending on the item. See http://www.minecraftwiki.net/wiki/Data_values#Data
Buffer.
The stack ID of the item, if the version supports Stack IDs.
Return true if items are equal.
A getter/setter for abstracting the underlying nbt
the item's custom name (ie. anvil name)
the item's custom lore (ie. set in give command)
Returns an array of enchants on the Item with their name and level
Updates the Item's NBT enchantments based on assigned array
In adventure mode, the list of block names (as strings) that this Item can be placed on
In adventure mode, the list of block names (as strings) that this Item can be used to break
A getter/setter for abstracting the underlying nbt. See https://minecraft.gamepedia.com/Anvil_mechanics#Anvil_Uses
If the current item is a type of Spawn Egg, the protocol name of the entity that will be spawned. For example, a zombie spawn egg on 1.8 will return Zombie
.
Max durability for the item, if it supports durability
- 1.20.5 (#118) (thanks @extremeheat)
- Bump @types/node from 20.14.15 to 22.3.0 (#117) (thanks @dependabot[bot])
- Add
maxDurability
field, fix handling item sent by server with newsentByServer
arg (#106) (thanks @extremeheat)
- Fix null item handling in toNotch (#103) (thanks @extremeheat)
- Bedrock support (#86) (thanks @CreeperG16)
- add commands workflow (#99) (thanks @extremeheat)
- Update to node 18.0.0 (#98) (thanks @rom1504)
- Fix types (thanks @TigerbyteDev and @u9g)
- Fix publish
- uses registry instead of mcData (thanks @Epirito)
- Update mcdata
- Use mcData.items instead of mcData.findItemOrBlockById()
- Use supportFeature from mcdata
- Add checks for enchantment name retrieval (#53) @firejoust
- Bump prismarine-nbt from 1.6.0 to 2.0.0 (#49)
- fix customLore
- fix typings
- add .customLore
- .customName now returns null when there is no custom name
- update typings (thanks @stzups)
- add item.spawnEggMobName (thanks @U9G)
- fix item present detection (thanks @U9G)
- Revise typings (thanks @extremeheat)
- Revise deps (thanks @rom1504)
- Correctly identify null items in MC 1.13 (thanks @u9g)
- add matchStackSize option on Item.equal (thanks @u9g)
- Item.equal checks nbt equality (thanks @u9g)
- Item.anvil added, along with a ton of getters & setters for Item (thanks @u9g)
- 1.16 support (thanks @DrakoTrogdor)
- typescripts definitions (thanks @IdanHo)
- 1.15 support
- 1.14 support
- allow unknown items
- 1.13 support
- make nbt default to null
- display the item id if it is not found in minecraft data
- bump mcdata
- bump dependencies
- Import from mineflayer