node package manager


carvable pumpkin blocks (voxel.js plugin)


Carvable pumpkin blocks, a directional block metadata demonstration (voxel.js plugin)

Uses voxel-registry metablocks for the pumpkin block orientation (registerBlocks(), getBlockMeta(), changeBlockMeta() etc.). The base pumpkin block has no face:

It can be right-clicked with the shears item to "carve" it on the clicked face (hit detection from voxel-use). By default, pumpkins can only be carved once, but the allowRecarving option can be set to allow shears to change the carved side even if it has already been carved once.

You can also "light up" or extinguish pumpkins by right-clicking with a lighter; this turns a carved pumpkin into a jack-o'-lantern or vice versa.

When a block is mined, it drops (using voxel-harvest) an item which has no direction, unlike the blocks. Using this item by right-clicking in the world (with voxel-use) places a block with an appropriate direction such that the carved side faces the player. In this way, blocks can be picked up as items and reoriented by the player.

For another, simpler, example of block metadata, see also voxel-wool.

Note: the above screenshot uses the ProgrammerArt v2.0 texture pack, but other packs can be used; for example, here are some pumpkins including a jack-o'-lantern and carved pumpkin using the Sphax 64x texture pack (not included):