PrismarineJS / minecraft-data

Language independent module providing minecraft data for minecraft clients, servers and libraries.
https://prismarinejs.github.io/minecraft-data
652 stars 221 forks source link

materials.json as a concept is outdated #412

Open Archengius opened 3 years ago

Archengius commented 3 years ago

Material information is used for computing mining speed based on other parameter, but there is one fundamental problem: recent Minecraft versions just do not use materials for anything except colors on the maps. Instead, mining speed is handled either by the game's code (for swords and shears), or by tags (for all other tools)

Both of these handle blocks individually and independently of their materials, so it's practically impossible to judge mining speeds by block materials anymore. Even more, some blocks can be actually mined up to 3 different tools at once (for example, berry bushes are actually mineable by hoe, axe and sword, yet their material is just "plant").

My suggestion is to get rid of materials.json altogether for newer versions since it's pointless, and record mining speed multipliers directly in blocks.json as values for harvestTools object entries (since practically now information about block breaking speeds is shattered between 2 different files, and now it will be combined into one). Additionally, boolean indicating whenever block requires tool or not should be added explicitly in this case, instead of relying on harvestTools being absent when block is harvestable by hand.

rom1504 commented 3 years ago

Do you have a way to retrieve the block speeds in newer versions ? If yes, could you compare the values you get that way with what prismarine-block digTime computes ?

On Sun, Jun 13, 2021, 21:16 Archengius @.***> wrote:

Material information is used for computing mining speed based on other parameter, but there is one fundamental problem: recent Minecraft versions just do not use materials for anything except colors on the maps. Instead, mining speed is handled either by the game's code (for swords and shears), or by tags (for all other tools)

Both of these handle blocks individually and independently of their materials, so it's practically impossible to judge mining speeds by block materials anymore. Even more, some blocks can be actually mined up to 3 different tools at once (for example, berry bushes are actually mineable by hoe, axe and sword, yet their material is just "plant").

My suggestion is to get rid of materials.json altogether for newer versions since it's pointless, and record mining speed multipliers directly in blocks.json as values for harvestTools object entries (since practically now information about block breaking speeds is shattered between 2 different files, and now it will be combined into one). Additionally, boolean indicating whenever block requires tool or not should be added explicitly in this case, instead of relying on harvestTools being absent when block is harvestable by hand.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/minecraft-data/issues/412, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437U3VAJ7PV2VHMNFTK3TST7ZBANCNFSM46UALANA .

Archengius commented 3 years ago

Yeah, I have a way to retrieve block speeds in new versions, specifically 1.17. But I cannot do the comparison because there's simply no minecraft-data for 1.17 to use for prismarine-block.

I could use the data I PR in #411, but comparison would be pointless in that case, since material data I'm PRing is actually based on mining speed categories and not actual materials, to basically have correct mining times without rewriting prismarine-block

Archengius commented 3 years ago

Sorry, accidentally closed it. Continuing on my last comment, there's also no practical way to retrieve mining speed data on material basis at all in latest version, just because materials are NOT used for it, and you would just get incorrect values for some blocks

rom1504 commented 2 years ago

the choices for materials are

  1. https://github.com/Archengius/minecraft-data-generator/blob/master/src/main/java/me/arch/mcdatagen/generators/MaterialsDataGenerator.java
  2. https://github.com/PrismarineJS/burger-extractor + https://github.com/mcdevs/burger
  3. https://github.com/PrismarineJS/minecraft-wiki-extractor/blob/master/lib/block_extractor.js#L322 / manually writing the file choice 2 would be the cleanest, 1 or 3 probably the quickest but not easy to reuse in 1.19
  4. import from previous versions https://github.com/PrismarineJS/minecraft-data/pull/282#issue-612896577

the burger path may require to redefine the definition of material / define a new field in blocks.json like "base dig time" the goal of materials is only to get https://github.com/PrismarineJS/prismarine-block/blob/master/index.js#L266 to work any alternative property is fine as long as we can backport it to older versions