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

I am looking for a way to read information about the block in the world and save that information to a file system.

Later on, I would like to place that block back in the world based on the information from file system.

1) I can access BlockState but I am not sure what would be the proper identifier for specific block state? E.g. if stairs are turned to the north, how would I access information about that specific state of the stairs?

2) For information about the type of block, I can use block.getRegistryName() - is that proper way to get string identifier for specific block?

3) ForgeRegistries.BLOCK.getValue accepts registry name of block. Is that a proper way to get instance of a block based on the registry name stored before?

4) Block class has stateById method that accepts Id. Is this proper way to get specific BlockState? If yes, how can I get the Id parameter?

I have been struggling with this for a while so any help would be appreciated. :)

  • Author

Thank you @diesieben07 , this was exactly what I was looking for.

Regarding to best approach to write to file system - can you please point me in the right direction, I would like to use Minecraft/Forge API if one is available. :)

My plan is to have collected information exported in JSON format to file system.

  • Author

I am trying to extract information about the specific structure into a JSON file that will be used as a template to reconstruct the structure through custom made block.

When custom block is placed in the world, it will read information from JSON file and place blocks in the same exact order so that structure is reproduced.

That's the idea. :)

This is not going to be part of any publicly distributed mod.

It's more of developer tool to export structures in a fast way.

Edited by Adil Yilan

  • Author

Because I am new to modding and I have no clue what WorldSavedData or Capability is - basically. :)

pinpointing.png

So I have this block named PinpointerBlock that should be placed on three locations.

When the block is activated on the blue position, it should read information about everything between and save it to JSON.

That's the whole idea. :)

  • Author

I need data outside of the running Minecraft instance.

If I go with WorldSavedData - where will the data be located physically - as in which files/folders on disk drive?

 

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.