Jump to content

Proper way to read information about the block in the world


Adil Yilan

Recommended Posts

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. :)

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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. :)

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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