Giter Site home page Giter Site logo

node-minecraft-assets's Introduction

node-minecraft-assets

NPM version Build Status Discord Gitter Irc

Try it on gitpod

Provide easy access to minecraft-assets in node.js

Example

const mcAssets=require("minecraft-assets")("1.8.8")

console.log("https://raw.githubusercontent.com/rom1504/minecraft-assets/master/data/1.8.8/"+mcAssets.getTexture("wheat_seeds")+".png")

console.log(mcAssets.textureContent["wheat_seeds"].texture)

Documentation

node-minecraft-assets's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

node-minecraft-assets's Issues

Slash in filename?

return 'data:image/png;base64,' + fs.readFileSync(path.join(__dirname, '/../minecraft-assets/data/', mcVersion, '/', texture, '.png'), 'base64')

I'm getting this error:
Error: ENOENT: no such file or directory, open '/Users/nthompson/Sites/minecraft-browser/node_modules/minecraft-assets/minecraft-assets/data/1.16.1/block/acacia_planks/.png'

Should it be texture + '.png' ?

You cannot use the new version. 1.20...

is it intentional for not adding the 1.20 support after adding the data?

  '1.20.2': {
    blocksTextures: require('./minecraft-assets/data/1.20.2/blocks_textures'),
    itemsTextures: require('./minecraft-assets/data/1.20.2/items_textures'),
    textureContent: require('./minecraft-assets/data/1.20.2/texture_content'),
    blocksStates: require('./minecraft-assets/data/1.20.2/blocks_states'),
    blocksModels: require('./minecraft-assets/data/1.20.2/blocks_models')
  }

Like any other version?

Easier way to access pre-1.13 colored items

In versions 1.12.2 and below, some colored items (wool, concrete, glass, ...) had a single type and the color was coded into the item's metadata

const metadataToColor = {
  0: 'white',
  1: 'orange',
  2: 'magenta',
  3: 'light_blue',
  4: 'yellow',
  5: 'lime',
  6: 'pink',
  7: 'gray',
  8: 'silver',
  9: 'cyan',
  10: 'purple',
  11: 'blue',
  12: 'brown',
  13: 'green',
  14: 'red',
  15: 'black'
}

Right now I'm having to access pre-1.13 colored items (wool, concrete, glass, ...) using something like this:

  const textureBase64 = fs.readFileSync(path.join(
    mcAssets.directory, 'blocks', 'wool_colored_blue.png')
  ).toString('base64')

I think there should be an easier way


Also, this is more of a minecraft-assets issue but:

  • require('minecraft-assets')('1.12.2').textureContent['glass_pane'].texture is null
  • require('minecraft-assets')('1.12.2').textureContent['concrete'].texture is null

Related to mineflayer-web-inventory#28

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.