Code Monkey home page Code Monkey logo

prismarine-item's Introduction

prismarine-item

NPM version Build Status

Represent a minecraft item with its associated data

Usage

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));

API

Item(type, count[, metadata], nbt)

Item.toNotch(item)

Take an item in the format of the minecraft packets and return an Item instance.

Item.fromNotch(item)

Take an Item instance and return it in the format of the minecraft packets.

Item.anvil(itemOne, itemTwo, creative[, newName])

Take two seperate item instances, and makes one item using the same combining done by the vanilla anvil

Item.equal(itemOne, itemTwo[, matchStackSize])

itemOne - first item

itemTwo - second item

matchStackSize - whether to check for count equality

Checks equality between two items based on itemType, count, metadata, and stringified nbt

item.type

Numerical id.

item.count

item.metadata

Number which represents different things depending on the item. See http://www.minecraftwiki.net/wiki/Data_values#Data

item.nbt

Buffer.

item.name

item.displayName

item.stackSize

item.equal(otherItem)

Return true if items are equal.

item.durabilityUsed

A getter/setter for abstracting the underlying nbt

item.customName

A getter/setter for abstracting the underlying nbt

item.enchants

A getter/setter for abstracting the underlying nbt (does calculations)

item.repairCost

A getter/setter for abstracting the underlying nbt. See https://minecraft.gamepedia.com/Anvil_mechanics#Anvil_Uses

item.spawnEggMobName

A getter for abstracting the underlying nbt, get's the mob name from a spawn egg Item. e.g. a zombie spawn egg on 1.8 will return Zombie

History

1.10.0

  • add item.spawnEggMobName (thanks @U9G)

1.9.1

  • fix item present detection (thanks @U9G)

1.9.0

  • Revise typings (thanks @extremeheat)
  • Revise deps (thanks @rom1504)
  • Correctly identify null items in MC 1.13 (thanks @u9g)

1.8.0

  • add matchStackSize option on Item.equal (thanks @u9g)

1.7.0

  • Item.equal checks nbt equality (thanks @u9g)

1.6.0

  • Item.anvil added, along with a ton of getters & setters for Item (thanks @u9g)

1.5.0

  • 1.16 support (thanks @DrakoTrogdor)

1.4.0

  • typescripts definitions (thanks @IdanHo)

1.3.0

  • 1.15 support

1.2.0

  • 1.14 support

1.1.1

  • allow unknown items

1.1.0

  • 1.13 support

1.0.2

  • make nbt default to null
  • display the item id if it is not found in minecraft data

1.0.1

  • bump mcdata

1.0.0

  • bump dependencies

0.0.0

  • Import from mineflayer

prismarine-item's People

Contributors

rom1504 avatar u9g avatar dependabot-preview[bot] avatar idanho avatar dependabot[bot] avatar egeres avatar jecsham avatar drakotrogdor avatar extremeheat avatar griffinht avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.