Giter VIP home page Giter VIP logo

minecraft-data's Introduction

minecraft-data

Discord Gitter Irc Build Status

Language independent module providing minecraft data for minecraft clients, servers and libraries.

Supports

  • Minecraft PC version 0.30c (classic), 1.7.10, 1.8.8, 1.9 (15w40b, 1.9, 1.9.1-pre2, 1.9.2, 1.9.4), 1.10 (16w20a, 1.10-pre1, 1.10, 1.10.1, 1.10.2), 1.11 (16w35a, 1.11, 1.11.2), 1.12 (17w15a, 17w18b, 1.12-pre4, 1.12, 1.12.1, 1.12.2), 1.13 (17w50a, 1.13, 1.13.1, 1.13.2-pre1, 1.13.2-pre2, 1.13.2), 1.14 (1.14, 1.14.1, 1.14.3, 1.14.4), 1.15 (1.15, 1.15.1, 1.15.2), 1.16 (20w13b, 20w14a, 1.16-rc1, 1.16, 1.16.1, 1.16.2, 1.16.3, 1.16.4, 1.16.5), 1.17, 1.17.1, 1.18 (1.18, 1.18.1, 1.18.2), 1.19 (1.19, 1.19.2, 1.19.3, 1.19.4), 1.20 (1.20, 1.20.1, 1.20.2, 1.20.3, 1.20.4)
  • Minecraft bedrock version 0.14, 0.15, 1.0, 1.16.201, 1.16.210, 1.16.220, 1.17.0, 1.17.10, 1.17.30, 1.17.40, 1.18.0, 1.18.11, 1.18.30, 1.19.1, 1.19.10, 1.19.20, 1.19.21, 1.19.30, 1.19.40, 1.19.50, 1.19.60, 1.19.62, 1.19.63, 1.19.70, 1.19.80, 1.20.0, 1.20.10, 1.20.30, 1.20.40, 1.20.50, 1.20.61, 1.20.71, 1.20.80

Wrappers

Minecraft-data is language independent, you can use it with these language specific modules :

Wrapper name Language Data provided
node-minecraft-data Node.js everything
python-minecraft-data python everything
McData Elixir protocol
ProtocolGen java generated java files from protocol.json to read and write minecraft packets
mcdata Go everything
minecraft-data-rs Rust everything

If you want to use minecraft-data in a new language, we advise you to create a new wrapper

Data

Data provided:

Data Description
Biomes
Blocks
Enchantment
Effect Status/Potion effects
Entities
Language language code and their english strings
Instruments sounds emitted by blocks
Items
Map icons Provides all available map icons as used by (crafted) maps
Materials to be used with blocks data. Provides tool speed multipliers against material types.
Particles Id and names of minecraft particles
Protocol a complete description of the protocol, can be used to automatically implement the protocol, see protodef doc
Protocol Versions the whole list of minecraft protocol versions
Recipes to be used with blocks and items data
Windows the different kind of windows and their characteristics
Version
Versions all the versions supported in minecraft-data
Block collision shapes
Foods list of foods each with there id, saturation, foodpoints and more
Commands a tree structure for vanilla minecraft server commands, and some info needed to implement sub-parsers.
Legacy mappings between legacy (1.12) and post-flattening (1.13+) blocks and items ids
Skin data (bedrock edition) Skin geometry and texture data for steve skin
Features This can be used to check is a specific feature is available in the current Minecraft version. This is usually only required for handling version-specific functionality.
Sounds For versions that use a sound id over the network (1.9+) this provides mappings between network sound id and sound name.

See more information about this data in the documentation

Documentation

Projects using minecraft-data

These are the projects that use minecraft-data:

Project name Language Project type Data used
mineflayer Node.js bot library biomes, blocks, entities, instruments, items, materials, recipes
node-minecraft-protocol Node.js protocol serialization protocol
flying-squid Node.js server library biomes, blocks, materials
SpockBot Python bot library biomes, blocks, items, materials, windows, recipes
PhaseBot Java bot blocks, items, materials
McEx Elixir server blocks
VoxelGamesLib Java minigames server library blocks, items
Phpcraft PHP all-around library blocks, items, entities, protocol
MineSharp C# Bots Protocol, Blocks, Items, Entities, Biomes, Recipes, Enchantments

Extraction

The recommended way to extract the data is documented at add-data-new-version.md. Specifically, minecraft-data-auto-updater calls minecraft-data-generator-server

Projects that provide data:

Project name Language Source Data provided
minecraft-wiki-extractor Node.js minecraft wiki blocks, items, entities, recipes
mcdevs-wiki-extractor Node.js wiki.vg a partial protocol, entities
node-minecraft-extractor Node.js merge between wiki.vg and mcwiki a complete entities file
minecraft-jar-extractor Node.js minecraft server jar a very partial but completely up to date protocol
minecraft-jar-extractor in python Python minecraft server jar about the same protocol information as minecraft-jar-extractor in node.js
burger with burger-extractor Node.js minecraft server jar used to provide items, blocks, biomes and recipes
burger 1.16 --//-- --// -- --//--
command-generator Python Minecraft data generator Data used for parsing all vanilla server commands.
minecraft-data-generator Java minecraft client biomes, block collision shapes, blocks, effects, enchantments, entities, foods, items, particles, tints. Required Fabric updated to the provided minecraft version.

Pages interesting to manually update the data if necessary:

Page Data
wiki.vg Inventory page windows
wiki.vg instruments
a mineflayer PR biomes
mcwiki effects page effects
wiki.vg protocol version numbers protocolVersions

Data quality

Minecraft data provides scripts to audit the data, they can be useful to check the data is correct :

Minecraft data also provides json schemas in enums_schemas/ that are used in test/test.js to check the json file are valid relative to these schemas. These schemas can also be used to understand better how the json files are formatted in order to use it.

Contribute

Please read https://github.com/PrismarineJS/prismarine-contribute

License

MIT

Some of the data was extracted manually or automatically from wiki.vg and minecraft.gamepedia.com. If required by one of the sources the license might change to something more appropriate.

Related project

minecraft-assets which provide minecraft assets along with json files that help to use them.

minecraft-data's People

Contributors

appdevmichael avatar automatic-beyond-belief avatar beaness avatar creeperg16 avatar deathcap avatar eejit43 avatar extremeheat avatar frej4189 avatar github-actions[bot] avatar gjum avatar imharvol avatar irkmandeer avatar jonathanperret avatar kamesa7 avatar karang avatar lluiscab avatar mrdiamond64 avatar nickelpro avatar pondwader avatar rob9315 avatar roblabla avatar rom1504 avatar rom1504bot avatar stevarino avatar thedudefromci avatar thepumpkingod avatar timmyrs avatar u9g avatar uncovery avatar wgaylord avatar

Stargazers

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

Watchers

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

minecraft-data's Issues

MCPE support

It'd be interesting to have the MCPE data available here as well. I believe the two games are close enough to actually be able to support both schema types. The protocol will probably be the one file to change the most, but I believe its schema won't have to change all that much either

Replace condition with the more powerful switch

Protocols define a data-type named "switch" which seem to handle everything condition does, in a cleaner, more readable way. It looks like this :

{
  "type": "switch",
  "typeArgs": {
      "compareTo": "this.someOtherArg",
      "fields": {
        "0": "int",
        "default": "void"
      }
  }
}

Void is a new datatype that does nothing. It doesn't read, and returns nothing. It may as well not have been called.

Supporting several protocol versions

The current plan is to support minecraft 1.8.
But at some point 1.9 will be out, and supporting both version might be nice.
How could we support multiple versions ?
Different branches ? Different folders ?

(this is a long-term issue, mainly becoming relevant when 1.9 comes out)

Unindex recipes and materials

Not having an index in json files makes it easier for users to index by what they need. That means the data doesn't have to change if one index or an other becomes more pratical (id vs id:metadata vs name ,... ). It also makes it possible to consider one element as a document of a database.

All json files are now unindexed except for recipes and materials.

I think materials could have a format like this :

{
  "material":"rock",
  "multipliers":  {
    "257": 6,
    "270": 2,
    "274": 4,
    "278": 8,
    "285": 12
  }
}

I'm not sure whether multipliers should be unindexed too since it only has one value, maybe.

The recipes file is currently indexed by output id. The simplest solution might be to just remove that indexing, and to say that the recipes should be ordered by a lexicographic order on (id,metadata) in order to have a decent diff.

Block state data

There are block state files available by doing this :

mkdir /tmp/dminecraft
cp ~/.minecraft/versions/1.8.4/1.8.4.jar  /tmp/dminecraft
cd /tmp/dminecraft && unzip 1.8.4.jar
cd /tmp/dminecraft/assets/minecraft/blockstates

Example : birch_fence_gate.json :

{
    "variants": {
        "facing=south,in_wall=false,open=false": { "model": "birch_fence_gate_closed" },
        "facing=west,in_wall=false,open=false":  { "model": "birch_fence_gate_closed", "y": 90, "uvlock": true },
        "facing=north,in_wall=false,open=false": { "model": "birch_fence_gate_closed", "y": 180, "uvlock": true },
        "facing=east,in_wall=false,open=false":  { "model": "birch_fence_gate_closed", "y": 270, "uvlock": true },
        "facing=south,in_wall=false,open=true": { "model": "birch_fence_gate_open" },
        "facing=west,in_wall=false,open=true":  { "model": "birch_fence_gate_open", "y": 90, "uvlock": true },
        "facing=north,in_wall=false,open=true": { "model": "birch_fence_gate_open", "y": 180, "uvlock": true },
        "facing=east,in_wall=false,open=true":  { "model": "birch_fence_gate_open", "y": 270, "uvlock": true },
        "facing=south,in_wall=true,open=false": { "model": "birch_wall_gate_closed" },
        "facing=west,in_wall=true,open=false":  { "model": "birch_wall_gate_closed", "y": 90, "uvlock": true },
        "facing=north,in_wall=true,open=false": { "model": "birch_wall_gate_closed", "y": 180, "uvlock": true },
        "facing=east,in_wall=true,open=false":  { "model": "birch_wall_gate_closed", "y": 270, "uvlock": true },
        "facing=south,in_wall=true,open=true": { "model": "birch_wall_gate_open" },
        "facing=west,in_wall=true,open=true":  { "model": "birch_wall_gate_open", "y": 90, "uvlock": true },
        "facing=north,in_wall=true,open=true": { "model": "birch_wall_gate_open", "y": 180, "uvlock": true },
        "facing=east,in_wall=true,open=true":  { "model": "birch_wall_gate_open", "y": 270, "uvlock": true }
    }
}

Might be interesting for handling metadata/blockstate (and placing that kind of blocks)

New recipe format

Some cases are not handled by the recipes format, in particular a lot of thing related to metadata.
See https://github.com/PrismarineJS/minecraft-data/wiki/Recipe-format vs https://github.com/PrismarineJS/minecraft-data/wiki/Proposed-new-recipe-format
What should be done :

  • finish defining the new format
    • check it handles all cases
    • check it isn't too ugly
  • see how it would be implemented in mineflayer
  • update the wiki extractor scripts
  • update the resulting recipes.json file

Might also be related to PrismarineJS/mineflayer#222

It might also be a good idea to define a jsonformat for this ( see #2 ) if it's not too complicated.

Expand option type doc

Option type documentation currently doesn't show the underlying type. Need to find a simple way to do that.

Expand buffer countType field

Currently, buffer "hides" the countType field. Need to find a simple way to reveal it. A suggestion rom1504 made : make type array counted by <countType>.

Add metadata variation to items.json and blocks.json

We need to be able to know things (like the metadata id) about variation of blocks, like http://minecraft.gamepedia.com/Polished_Granite is a variation of http://minecraft.gamepedia.com/Granite

blocks.json currently looks like that :

"1": {
    "id": 1,
    "displayName": "Stone",
    "name": "stone",
    "hardness": 1.5,
    "stackSize": 64,
    "diggable": true,
    "boundingBox": "block",
    "material": "rock",
    "harvestTools": {
      "270": true,
      "274": true,
      "257": true,
      "278": true,
      "285": true
    }
  }

I propose a schema like that instead :

"1": [{
    "id": 1,
    "displayName": "Stone",
    "name": "stone",
    "hardness": 1.5,
    "stackSize": 64,
    "diggable": true,
    "boundingBox": "block",
    "material": "rock",
    "harvestTools": {
      "270": true,
      "274": true,
      "257": true,
      "278": true,
      "285": true
    }
  },
{
    "id": 1,
    "displayName": "Polished Stone",
    "name": "polishedStone",
    "hardness": 1.5,
    "stackSize": 64,
    "diggable": true,
    "boundingBox": "block",
    "material": "rock",
    "harvestTools": {
      "270": true,
      "274": true,
      "257": true,
      "278": true,
      "285": true
    }
  },

]

or similar : maybe some properties never change between two blocks only different by metadata ?

A variations.json file ?

It might be interesting to have variations of name/displayName of blocks/items, that might be useful to parse what an user is saying.
It could look like that :

{
   "variation":"unique_identifier",
}

That could be extracted from :

  • redirect pages in the wiki
  • links labels in the wiki

Internationalization ?

Mojang provides Internationalization files in the client jar (for the display names)
It might be interesting in the long term to provide that kind of data somehow.

Example in english http://hastebin.com/tisalowasa

01:13 < roblabla> > you need to open 1.8.json
01:13 < roblabla> find the asset you want (probably minecraft/lang/en_GB.json
01:13 < roblabla> and see the associated hash
01:13 < roblabla> for me it's 03f31164d234f10a3230611656332f1756e570a9
01:13 < roblabla> then it's in assets/bojects/03/03f31164d234f10a3230611656332f1756e570a9
01:13 < roblabla> something like that
01:13 < roblabla> 1.8.json is inside .minecraft/assets/index

node.js data "provider" ?

I think it would be useful to have a javascript provider for node.js users of this library.
For example it might provide indexes and function using these indexes to find blocks by name (something like this https://github.com/PrismarineJS/minecraft-data/blob/master/bin/wiki_extractor/lib/find_item_object_by_name.js)

That way users of that library wouldn't have to build the index themselves every time (see #14 (comment) )

The problem is minecraft-data should stay a language interdependent library imho. Does that mean that "data provider" should still be in this repo and other language users would just not use them or should there be a "node-minecraft-data" repo that would depend on this repo and provide these indexer and all ?

I also thought about simply putting that provider inside mineflayer, but the thing is minecraft-data will be used by projects not using mineflayer (see PrismarineJS/prismarine-server#23)

The advantage of a node-minecraft-data provider is would provide an example of how to read the data, so that other people using other languages could do that kind of providers too if they want (for example a python-minecraft-data )

What do you think ?

New data in minecraft-data

Cut documentation into tabs

I propose something like one tab by data type (block, entity, protocol, ...) and then in each tab you can choose schema or value (like http://getbootstrap.com/javascript/#tabs )

That way the schema and the value display can take as much room as they need, and it will be less confusing to point somebody to the protocol values for example.

Add some missing recipes

Some recipes are missing :

  • wool
  • banner

To do : fix the wiki recipes extractor to handle these.

Add block drops

Currently, there's no way to know what kind of blocks drops we can have. The problem with block drops is that they depend on item used to mine, among other things. Anyway, a good start would be :

{
  "id": 1,
  "name": "stone",
  // ...
  "drops": [{ "id": 4, "minAmount": 1, "maxAmount": 1 }]
}

The problem with the above : it doesn't take into account tool used to mine. Not too sure how to make the schema not too fugly otherwise...

How does this sound ?

Is indexing in items.json and blocks.json a good thing ?

Currently blocks and items are indexed by id in items.json and blocks.json.
Is that really a good idea ? As seen in #7 users sometimes need to index by name or by metadata+id.

It should probably not be the responsibility of minecraft-data to choose that indexing, but the responsibility of the reader/user.

Not doing that indexing would simply mean using json arrays instead of json objects.

define the schema of a future Windows.json

22:09 <+Gjum> it's just the window name (for protocol), readable name (although that can get set by server), named slot ranges, names for the properties, and later buttons
22:10 <+Gjum> properties are for example the smelting progress of a furnace
22:11 <+Gjum> buttons would just be list[id -> "name"]
22:12 <+Gjum> and then there are some edge cases like the horse, and the player itself
22:12 <+Gjum> horse has an entity id, player has armor and crafting, but no nameID

Packets and field names

Currently packets names are taken from https://github.com/aadnk/ProtocolLib/blob/master/ProtocolLib/src/main/java/com/comphenix/protocol/PacketType.java#L123
I don't know where the fields names are coming from (@roblabla ?)

These names are different from what is currently found in http://wiki.vg/Protocol

Can reasonable names be chosen to make protocol.json more standard ?

The packet name difference with wiki.vg can be seen here https://gist.github.com/rom1504/1b432d5e7efc278015dd/revisions?diff=split

I mapped the new names to the old and got that which show mainly the field names difference :
https://gist.github.com/rom1504/64535ed808327b78c72e/revisions?diff=split

Minecraft versions : branches or folder

Currently mc version are stored as different branches.

Problem with that is a lot of commits need to be cherry-picked from 1.8 to 1.9 because they change things common between versions : changes in the README, sometimes changes in the extractors, new data files.

I think storing version in enums/1.8 and enums/1.9 might be saner : only the data should really be different.

  • the schemas should be the same : see #49
  • the readme should be the same
  • the extractor and tools are a bit more complicated, but basically it would be better to have everything that is common in common files and to have a few functions/files specific for different mc version / revision of the wiki / java decompiled code format

I think to be really sure it can work, the best way would be to try to use the extractors for 1.9.

So I'll do that at some point and that'll give us more info into that issue.

Remove some duplicated recipes

For recipes for which any metadata in the items produce the same result (for example bed) :

  • remove the ingredients metadata (=any metadata)
  • have juste one recipe

Keeping file size reasonable and schema independance

Main issue

Currently each version has its own schema.

What would be nice is having a common schema for every version.

Problem is : new things will be added and older versions didn't have as much data.

An other problem : some files, for examples blocks.json contain too many things which is annoying when creating extraction scripts (and possibly when reading it too)

One solution : keep things meaningful, split big files.

For example we might have a blockVariation.json instead of storing all the variations in blocks.json.

That would allow to have one common schema for all the versions. Some version just wouldn't have some of the data files.

Related/ideas

The knowledge base way is close to what we are doing (for example <1,name,stone>)
and it's even possible to convert all our data to a knowledge base forma (like n triples) by using json ld (http://json-ld.org/)

Also see http://wikiba.se/

Create a blocksPhysics.json

With data like canFall , ...

Not sure what it would contain exactly and how it would be used.

The main point is we would have to build it manually though.

Use countType in array to reduce field count

Example :

{
  "name": "chunkDataLength",
  "type": "count",
  "typeArgs": {
    "type": "varint",
    "countFor": "chunkData"
  }
},
{
  "name": "chunkData",
  "type": "buffer",
  "typeArgs": {
    "count": "chunkDataLength"
  }
}

should become

{
  "name": "chunkData",
  "type": "buffer",
  "typeArgs": {
    "countType": "varint"
  }
}

This greatly simplifies the protocol.json file, and makes it more obvious that count fields should not be supplied on write. I went over the 1.8 protocol, there are no instances where the count field is far away from the data it counts.

Document better harvestTools

Currently harvestTools is interpreted by mineflayer as requiredTools : one of these tool is needed to harvest a block (see https://github.com/andrewrk/mineflayer/blob/master/lib/plugins/digging.js#L92 )

In the reality of data there are tools that improve the digging time but are not needed to dig that block. (see chest in http://minecraft.gamepedia.com/Breaking#Blocks_by_hardness for example)

I actually think that mineflayer algorithm to compute the digging time is correct (might be interesting to check that by computing a similar table than in http://minecraft.gamepedia.com/Breaking#Blocks_by_hardness using that algo) but it would be better to document that harvestTools means needed tools.

Also see http://minecraft.gamepedia.com/index.php?title=Template:Block&action=edit to understand better in which case a tool is required (=3.33 times penalty if not wearing it) or just better.

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.