Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello!
I need to save the building and the coordinates of the required blocks.

For example, this is how the building looks like. And the block coordinate that I need to save looks like this.

image.png.579b1de2694cd38605aef7f435f844d8.pngimage.png.037618d8020554007b27f8ae9a57df35.png

 

I use this code to get building blocks. The first and second blocks are redstone blocks that are located at the edges of the building.

        int maxY = firstBlockXYZ[1];
        int firstBlockX = firstBlockXYZ[0];
        int firstBlockZ = firstBlockXYZ[2];
        int secondBlockX = secondBlockXYZ[0];
        int secondBlockZ = secondBlockXYZ[2];

        List<String> blocks = new ArrayList<>();

        for(int x=firstBlockX; x>=secondBlockX; x--) {
            for(int z=firstBlockZ; z>=secondBlockZ; z--) {
                BlockPos blockPos = new BlockPos(x, maxY, z);
                Block block = world.getBlockState(blockPos).getBlock();
                blocks.add(String.valueOf(block));
            }
        }

 

Further, to get the coordinates of the necessary blocks, I manually take the coordinates of the necessary blocks and subtract these coordinates from the first redstone block.

 

Finally, I save the list of blocks and the required coordinates to a json file.

{
  "name": "building",
  "blocks": [
    "Block{minecraft:redstone_block}",
    "Block{minecraft:stone}",
    ...
  ],
  "coordinates": [
    "-11 -7 -6",
    "XXX",
    "XXX"
  ]
}

 

This works great for one degree. If need to rotate the building, it won't work.

I somehow need to change the block indices in the json file and, accordingly, change the coordinates of the necessary blocks.

Maybe I should change the format for saving blocks and necessary blocks from a json file to a schematic file? But, I have never used the schematic and do not understand it.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.