Represent a minecraft block with its associated data
npm install prismarine-blockRepresent a minecraft block with its associated data
``js
const registry = require('prismarine-registry')('1.8')
const Block = require('prismarine-block')(registry)
const stoneBlock = new Block(registry.blocksByName.stone, registry.biomesByName.plains, / meta / 0)
console.log(stoneBlock)
// can you harvest stone with an iron pickaxe?
console.log(stoneBlock.canHarvest(257))
// how many milliseconds does it takes in usual conditions? (on ground, not in water and not in creative mode)
console.log(stoneBlock.digTime(257))
`
See doc/API.md
* Support for multi-sided signs (thanks @PondWader)
* really
* correct
* fix mcdata dep
* Effect names were normalized
* Metadata to 0 by default
* Legacy version fixes
* Add .stateId, .fromProperties, .getProps for all versions
* Change blockEntity version handling
* Add sign block entity implementation
* Updated to support prismarine-registry. To use, instead of passing a string to prismarine-biome's default function export, pass an instance of prismarine-registry.
* block entity support
* support bedrock
* use normalized enchant rather than custom format (@u9g #41)
* remove debug code
* Fix ternary operator for bedrock name check
* 1.17.0 support (thanks @Archengius and @the9g)
* added block.getProperties() type definitions.Block.fromProperties()` constructor.
* added instant breaking support
* added
* Efficiency fix on versions below 1.13
* Fix effectLevel not working in digTime. (@Naomi-alt)
* add testing for shapes, make it more robust to missing data
* fix canHarvest when no harvestTools required (thanks @Garfield100)
* Add getProperties (thanks @Karang)
* Add enchantments and effects to dig time computation (thanks @Karang)
* Make Block.fromStateId work for all versions
* Fix block metadata for 1.13+
* add block shapes (thanks @Karang)
* add typescript definitions (thanks @IdanHo)
* Prevent data from being shared to avoid conflicts across multiple versions (thanks @hornta)
* use the minStateId if passing the blockType
* add block state id feature (for >= 1.13)
* bump mcdata
* bump dependencies
* Import from mineflayer