GithubHelp home page GithubHelp logo

pmmp / bedrockblockupgradeschema Goto Github PK

View Code? Open in Web Editor NEW
14.0 14.0 3.0 236 KB

(Mostly) auto-generated schemas for upgrading blockstates found in older Minecraft: Bedrock worlds

License: Creative Commons Zero v1.0 Universal

bedrockblockupgradeschema's People

Contributors

dependabot[bot] avatar dktapps avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

g59jpq2w5w7

bedrockblockupgradeschema's Issues

Specialize blockstate flattening

Many blocks have been getting flattened in recent versions. This results in a lot of boilerplate JSON being generated, which is fine, but not the most readable, e.g.

"minecraft:concrete": [
{
"oldState": {
"color": {
"string": "black"
}
},
"newName": "minecraft:black_concrete",
"newState": null
},
{
"oldState": {
"color": {
"string": "blue"
}
},
"newName": "minecraft:blue_concrete",
"newState": null
},
{
"oldState": {
"color": {
"string": "brown"
}
},
"newName": "minecraft:brown_concrete",
"newState": null
},
{
"oldState": {
"color": {
"string": "cyan"
}
},
"newName": "minecraft:cyan_concrete",
"newState": null
},
{
"oldState": {
"color": {
"string": "gray"
}
},
"newName": "minecraft:gray_concrete",
"newState": null
},
{
"oldState": {
"color": {
"string": "green"
}
},
"newName": "minecraft:green_concrete",
"newState": null
},
{
"oldState": {
"color": {
"string": "light_blue"
}
},
"newName": "minecraft:light_blue_concrete",
"newState": null
},
{
"oldState": {
"color": {
"string": "lime"
}
},
"newName": "minecraft:lime_concrete",
"newState": null
},
{
"oldState": {
"color": {
"string": "magenta"
}
},
"newName": "minecraft:magenta_concrete",
"newState": null
},
{
"oldState": {
"color": {
"string": "orange"
}
},
"newName": "minecraft:orange_concrete",
"newState": null
},
{
"oldState": {
"color": {
"string": "pink"
}
},
"newName": "minecraft:pink_concrete",
"newState": null
},
{
"oldState": {
"color": {
"string": "purple"
}
},
"newName": "minecraft:purple_concrete",
"newState": null
},
{
"oldState": {
"color": {
"string": "red"
}
},
"newName": "minecraft:red_concrete",
"newState": null
},
{
"oldState": {
"color": {
"string": "silver"
}
},
"newName": "minecraft:light_gray_concrete",
"newState": null
},
{
"oldState": {
"color": {
"string": "white"
}
},
"newName": "minecraft:white_concrete",
"newState": null
},
{
"oldState": {
"color": {
"string": "yellow"
}
},
"newName": "minecraft:yellow_concrete",
"newState": null
}
],

Things like this could be more efficiently represented by something like:

    "minecraft:concrete": {
        "prefix": "minecraft:",
        "flattenedProperty": "color",
        "postfix": "_concrete",
    }

reducing the amount of data needed to represent the change significantly, and vastly improving readability.

[Request] Add upgrade schema for legacy block ids and data values

Hey please add an legacy block state upgrader which upgrades blocks with the following data to the latest block state format.

The block state updater of CloudburstMC (legacy_block_data_map.json) already has this feature implemented, but im not sure if it covers all data values and its not licensed under the public domain.

So if I give the nbt:

{
  "name": "minecraft:stone",
  "val": 1
}

it should return

{
  "name": "minecraft:stone",
  "states": {
    "stone_type": "granite"
  },
  "version": 17959425
}

Allow partial matching for blockstate remapping

"oldState": {
"old_log_type": {
"string": "spruce"
},
"pillar_axis": {
"string": "y"
}
},
"newName": "minecraft:spruce_log",
"newState": {
"pillar_axis": {
"string": "y"
}
}
},

{
"oldState": {
"old_log_type": {
"string": "spruce"
},
"pillar_axis": {
"string": "x"
}
},
"newName": "minecraft:spruce_log",
"newState": {
"pillar_axis": {
"string": "x"
}
}
},

{
"oldState": {
"old_log_type": {
"string": "spruce"
},
"pillar_axis": {
"string": "z"
}
},
"newName": "minecraft:spruce_log",
"newState": {
"pillar_axis": {
"string": "z"
}
}
},

These three state mappings are all applying the exact same blockstate alteration (removing the old_log_type field and changing the ID according to the value of old_log_type. However, because the oldState must exactly match the input blockstate, it has to also generate the same mapping for every value of pillar_axis, leading to a bunch of repeated information.

This can be represented more efficiently by allowing oldState to act as a filter rather than an exact match. I'm not sure on the exact logistics of generating such data from the mapping tables generated by bds-mod-mapping, but I'm sure it can be done.

Bell is missing direction property

When running the minecraft:bell through all schemas starting from the first the resulting block state is invalid because it is missing the direction property. The attachment and toggle_bit were added properly.

1.8 id/meta -> 1.9 blockstate NBT mappings and 1.12 id/meta -> 1.13 blockstate NBT mappings

Currently, it's not possible to upgrade a world from 1.12 or earlier to any version lower than 1.18.10, because the id/meta mappings we have produce blockstates for 1.18.10.

1.8 id/meta -> 1.9 blockstate mappings are needed for upgrading saved items from <= 1.8 to 1.9 or later, as 1.9 started using blockstate NBT for stored blockitems.
1.12 id/meta -> 1.13 blockstate mappings are needed for upgrading blocks from <= 1.12 to 1.13 or later, as 1.13 started using blockstate NBT for blocks.

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.