{"name":"prismarine-item","version":"1.15.0","keywords":["minecraft","item","prismarine"],"author":{"name":"Romain Beaumont","email":"romain.rom1@gmail.com"},"license":"MIT","_id":"prismarine-item@1.15.0","maintainers":[{"name":"rom1504","email":"romain.rom1@gmail.com"}],"homepage":"https://github.com/PrismarineJS/prismarine-item#readme","bugs":{"url":"https://github.com/PrismarineJS/prismarine-item/issues"},"dist":{"shasum":"6df5ace7837d82cdf8c8d27260c51a76f1fe5812","tarball":"http://registry-npm.ywwl.com/prismarine-item/download/prismarine-item-1.15.0.tgz","fileCount":12,"integrity":"sha512-DysyiCzaI8S7PpRLFylAZnQo2CppXiBbaUp+8rhK+EzvzmMdS+D1/oETQm9ysB5Jw9eCer6iWGMgzZXxJE5+/w==","signatures":[{"sig":"MEQCIGt2gjcKMzj3nGas4CbZ25xFaq+rN3s1BGyTJ89eBitNAiBt7eondrSB1erriUL8/G7ZtMpkpgA8hbvSO4NxL0fJtw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":90724,"size":13986,"noattachment":false,"key":"/prismarine-item/-/prismarine-item-1.15.0.tgz"},"main":"index.js","types":"index.d.ts","gitHead":"9b6c8d32adb6a76307fa7133d02d6bd1caa8bace","scripts":{"fix":"standard --fix","lint":"standard","test":"mocha --reporter spec --exit","pretest":"npm run lint"},"_npmUser":{"name":"rom1504","email":"romain.rom1@gmail.com"},"repository":{"url":"git+https://github.com/PrismarineJS/prismarine-item.git","type":"git"},"_npmVersion":"8.6.0","description":"Represent a minecraft item with its associated data","directories":{},"_nodeVersion":"18.0.0","dependencies":{"prismarine-nbt":"^2.0.0","prismarine-registry":"^1.4.0"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^10.0.0","expect":"^29.1.2","standard":"^17.0.0","@types/node":"^22.3.0","prismarine-item":"file:."},"_npmOperationalInternal":{"tmp":"tmp/prismarine-item_1.15.0_1728785120239_0.7880546682087526","host":"s3://npm-registry-packages"},"readme":"# prismarine-item\n[![NPM version](https://img.shields.io/npm/v/prismarine-item.svg)](http://npmjs.com/package/prismarine-item)\n[![Build Status](https://github.com/PrismarineJS/prismarine-item/workflows/CI/badge.svg)](https://github.com/PrismarineJS/prismarine-item/actions?query=workflow%3A%22CI%22)\n\nRepresent a minecraft item with its associated data\n\n## Usage\n\n```js\nconst Item = require('prismarine-item')('1.8')\n\nconst ironShovelItem = new Item(256, 1)\nconsole.log(ironShovelItem)\n\nconst notchItem = Item.toNotch(ironShovelItem)\nconsole.log(notchItem)\nconsole.log(Item.fromNotch(notchItem))\n```\n\n## API\n\n### Item(type, count[, metadata, nbt, stackId, sentByServer])\n\n* sentByServer - whether this item was sent by the server to the client, so default \n  initialization will not be done on the item. For example, tools will not have the\n  default item NBT written to them.\n\n#### Item.toNotch(item[, serverAuthoritative])\n\nTake an `Item` instance and returns it in the format of the minecraft packets.\n- serverAuthoritative: Whether the server is using server authoritative inventory (whether or not to write a Stack ID)\n\n#### Item.fromNotch(item[, stackId])\n\nTake an `item` in the format of the minecraft packets and return an `Item` instance.\n- stackId for bedrock items before 1.16.220\n\n### Item.anvil(itemOne, itemTwo, creative[, newName])\n\nTake two seperate `item` instances, and makes one item using the same combining done by the vanilla anvil\n\n### Item.equal(itemOne, itemTwo[, matchStackSize, matchNbt])\n\n`itemOne` - first item\n\n`itemTwo` - second item\n\n`matchStackSize` - whether to check for count equality\n\n`matchNbt` - wether to check for NBT equality\n\nChecks equality between two items based on itemType, count, metadata, and stringified nbt\n\n#### item.type\n\nNumerical id.\n\n#### item.count\n\n#### item.metadata\n\nNumber which represents different things depending on the item.\nSee http://www.minecraftwiki.net/wiki/Data_values#Data\n\n#### item.nbt\n\nBuffer.\n\n#### item.stackId\n\nThe stack ID of the item, if the version supports Stack IDs.\n\n#### item.name\n\n#### item.displayName\n\n#### item.stackSize\n\n#### item.equal(otherItem)\n\nReturn true if items are equal.\n\n#### item.durabilityUsed\n\nA getter/setter for abstracting the underlying nbt\n\n#### item.customName\n\nthe item's custom name (ie. anvil name)\n\n#### item.customLore\n\nthe item's custom lore (ie. set in give command)\n\n#### item.enchants\n\n#### get item.enchants(): { name: string, lvl: number }[]\n\nReturns an array of enchants on the Item with their name and level\n\n#### set item.enchants({ name: string, lvl: number }[])\n\nUpdates the Item's NBT enchantments based on assigned array\n\n#### get item.blocksCanPlaceOn(): [name][]\n#### set item.blocksCanPlaceOn(blockNames: string[])\nIn adventure mode, the list of block names (as strings) that this Item can be placed on\n\n#### get item.blocksCanDestroy(): [name][]\n#### set item.blocksCanDestroy(blockNames: string[])\n\nIn adventure mode, the list of block names (as strings) that this Item can be used to break\n\n#### item.repairCost\n\nA getter/setter for abstracting the underlying nbt.\nSee https://minecraft.gamepedia.com/Anvil_mechanics#Anvil_Uses\n\n#### item.spawnEggMobName\n\nIf 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`.\n\n#### item.maxDurability\n\nMax durability for the item, if it supports durability\n\n## History\n\n### 1.18.0\n* [Update CI to Node 24 (#174)](https://github.com/PrismarineJS/prismarine-item/commit/7793423620c73ec00caa60650937ab9e67a91cab) (thanks @rom1504)\n* [fix: use components instead of nbt when available (fix latest versions) (#127)](https://github.com/PrismarineJS/prismarine-item/commit/029a6738402b1471831258a60aff05ecd5c753c0) (thanks @zardoy)\n* [Fix publish condition for npm-publish v4 (#173)](https://github.com/PrismarineJS/prismarine-item/commit/37126428a32694524945f7f51e0dbac32f026b07) (thanks @rom1504)\n* [Switch to trusted publishing via OIDC (#172)](https://github.com/PrismarineJS/prismarine-item/commit/07878824718d3db2643e1b379a2691a2f62b96ff) (thanks @rom1504)\n\n### 1.17.0\n* [Bump @types/node from 22.16.5 to 24.1.0 (#144)](https://github.com/PrismarineJS/prismarine-item/commit/db0c77fcd747467cd256f0786d252d617745fbe7) (thanks @dependabot[bot])\n* [support untrusted slot for 1.21.5 (#141)](https://github.com/PrismarineJS/prismarine-item/commit/9a539f79b67f750b75fc106042a4d096f9e2ede7) (thanks @rom1504)\n* [node 22 (#125)](https://github.com/PrismarineJS/prismarine-item/commit/e808e997b7aa3e017755eb9aba593d5d1924453a) (thanks @rom1504)\n\n### 1.16.0\n* [Fix durabilityUsed for items with components (#123)](https://github.com/PrismarineJS/prismarine-item/commit/70fc068ffe73706d97b5b0dced0f15056e369fa4) (thanks @rom1504)\n* [Bump mocha from 10.8.2 to 11.0.1 (#120)](https://github.com/PrismarineJS/prismarine-item/commit/5f72f300f431406fa3804b24efe06b9a84610960) (thanks @dependabot[bot])\n* [Fix typing error in loader function (#122)](https://github.com/PrismarineJS/prismarine-item/commit/7d4cd63f5ffdc50670a3a2f817653c7a58d66725) (thanks @extremeheat)\n\n### 1.15.0\n* [1.20.5 (#118)](https://github.com/PrismarineJS/prismarine-item/commit/09815d2778dec72665a16bf6d60ae75d53fb7988) (thanks @extremeheat)\n* [Bump @types/node from 20.14.15 to 22.3.0 (#117)](https://github.com/PrismarineJS/prismarine-item/commit/094e32a5b2f7c581ddea4a8d605276aa389c9285) (thanks @dependabot[bot])\n\n### 1.14.0\n* [Add `maxDurability` field, fix handling item sent by server with new `sentByServer` arg (#106)](https://github.com/PrismarineJS/prismarine-item/commit/d36111d1a754ed9a3db152465b7a930b6582474f) (thanks @extremeheat)\n\n### 1.13.1\n* [Fix null item handling in toNotch (#103)](https://github.com/PrismarineJS/prismarine-item/commit/0fd5781c1c539207aa932bb637c074e671196f60) (thanks @extremeheat)\n\n### 1.13.0\n* [Bedrock support (#86)](https://github.com/PrismarineJS/prismarine-item/commit/854c357c4835cff74d9c9812b599528103bf2976) (thanks @CreeperG16)\n\n### 1.12.3\n* [add commands workflow (#99)](https://github.com/PrismarineJS/prismarine-item/commit/a4f5d593be8a80fbe539369efe2d1127c9785583) (thanks @extremeheat)\n* [Update to node 18.0.0 (#98)](https://github.com/PrismarineJS/prismarine-item/commit/52098ca2b0a9eafa6bcde3cdfb3c2315bab258a5) (thanks @rom1504)\n\n## 1.12.2\n\n* Fix types (thanks @TigerbyteDev and @u9g)\n\n## 1.12.1\n\n* Fix publish\n\n## 1.12.0\n\n* uses registry instead of mcData (thanks @Epirito)\n\n## 1.11.5\n\n* Update mcdata\n\n## 1.11.4\n\n* Use mcData.items instead of mcData.findItemOrBlockById()\n\n## 1.11.3\n\n* Use supportFeature from mcdata\n\n## 1.11.2\n\n* Add checks for enchantment name retrieval (#53) @firejoust\n* Bump prismarine-nbt from 1.6.0 to 2.0.0 (#49)\n\n## 1.11.1\n\n* fix customLore\n\n## 1.11.0\n\n* fix typings\n* add .customLore\n* .customName now returns null when there is no custom name\n\n## 1.10.1\n\n* update typings (thanks @stzups)\n\n## 1.10.0\n\n* add item.spawnEggMobName (thanks @U9G)\n\n## 1.9.1\n\n* fix item present detection (thanks @U9G)\n\n## 1.9.0\n\n* Revise typings (thanks @extremeheat)\n* Revise deps (thanks @rom1504)\n* Correctly identify null items in MC 1.13 (thanks @u9g)\n\n## 1.8.0\n\n* add matchStackSize option on Item.equal (thanks @u9g)\n\n## 1.7.0\n\n* Item.equal checks nbt equality (thanks @u9g)\n\n## 1.6.0\n\n* Item.anvil added, along with a ton of getters & setters for Item (thanks @u9g)\n\n### 1.5.0\n\n* 1.16 support (thanks @DrakoTrogdor)\n\n### 1.4.0\n\n* typescripts definitions (thanks @IdanHo)\n\n### 1.3.0\n\n* 1.15 support\n\n### 1.2.0\n\n* 1.14 support\n\n### 1.1.1\n\n* allow unknown items\n\n### 1.1.0\n\n* 1.13 support\n\n### 1.0.2\n\n* make nbt default to null\n* display the item id if it is not found in minecraft data\n\n### 1.0.1\n\n* bump mcdata\n\n### 1.0.0\n\n* bump dependencies\n\n### 0.0.0\n\n* Import from mineflayer\n","publish_time":1728785120414,"_cnpm_publish_time":1728785120414,"dist-tags":{"latest":"1.18.0"}}