Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different java command for data generation since 1.18 #172

Open
arvitus opened this issue Aug 30, 2022 · 0 comments
Open

Different java command for data generation since 1.18 #172

arvitus opened this issue Aug 30, 2022 · 0 comments

Comments

@arvitus
Copy link

arvitus commented Aug 30, 2022

I was trying to use the example below but got an error in the from_jar classmethod of the LookupRegistry class. After like an eternity of searching through the minecraft wiki I found out that the command for the data generation changed since 1.18 due to the server jar bundling libraries instead of merging them into a single file as stated here.

So the new command to use in the from_jar classmethod for 1.18+ is java -DbundlerMainClass=net.minecraft.data.Main -jar minecraft_server.jar --reports

Please implement it, because I can't :)

The example from the docs:

import os.path

from quarry.types.nbt import RegionFile
from quarry.types.registry import LookupRegistry
from quarry.types.chunk import BlockArray


def set_block(server_path, x, y, z, block):
    rx, x = divmod(x, 512)
    rz, z = divmod(z, 512)
    cx, x = divmod(x, 16)
    cy, y = divmod(y, 16)
    cz, z = divmod(z, 16)

    jar_path = os.path.join(server_path, "minecraft_server.jar")
    region_path = os.path.join(server_path, "world", "region", "r.%d.%d.mca" % (rx, rz))

    registry = LookupRegistry.from_jar(jar_path)
    with RegionFile(region_path) as region:
        chunk, section = region.load_chunk_section(cx, cy, cz)
        blocks = BlockArray.from_nbt(section, registry)
        blocks[256 * y + 16 * z + x] = block
        region.save_chunk(chunk)


set_block("/path/to/server", 10, 80, 40, {'name': 'minecraft:bedrock'})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant