PrismarineJS / node-minecraft-assets

Provide minecraft assets in node.js
17 stars 13 forks source link

Easier way to access pre-1.13 colored items #20

Open imharvol opened 2 years ago

imharvol commented 2 years ago

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:


Related to mineflayer-web-inventory#28