Jump to content

Recommended Posts

Posted

I've been trying to get blocks from coordinates in the world.

I figured out how to get the id and metadata of a block at the coordinates, but I can't seem to figure out how to get the block itself from that.

 

I'm trying to create something to select a number of blocks in the world and save that to a file to use later as generated structures, but I don't really want to use the block ids for it if I can, since they might change.

Posted

The block ID represents the type of block, not the block itself. For example, if you have four dirt blocks, they all have the same ID.

 

I believe that you don't have to worry about the block IDs changing too much. If you call the getBlockId(x,y,z) method on dirt for example, whatever it returns will always equal Block.dirt.blockID.

Posted

Thanks.

I know they have the same id.

The thing I'm worried about is ids for mod blocks changing in config files to resolve block ids being used double.

I still want the files to be reliable when that happens.

It's supposed to be distributed with other mods for generating structures. If the block ids change to compensate between mods, you might end up with castles made out of MFSUs instead of FancyBrickX, that's kind of what I'm trying to prevent. So that's why I'm looking for a different way to identify the blocks.

Posted

the problem with this, is that the "world" in minecraft is just a 3-dimensional array that stores the ID of each block in the correct location. It's probably something like

new int[3000000][256][3000000]

but I've never seen anything that would support my thinking on that. It just seems like that's how it's stored.

it might be an array that stores 16x16x16 arrays though. I'm not really sure.

Posted


            Block blockfromlist = Block.blocksList[<BLOCKID>];

 

Will return the Block of a given id. Using this, you can get name/icon, etc anything else you could possibly need for your verification needs. This should solve your issue.

Have a modding question? PM me and hopefully I'll be able to help. Good at 2d Pixel Art? We need your help!  http://www.minecraftforum.net/topic/1806355-looking-for-2d-pixel-artist/

Posted

Endershadow: that's somewhat what it is, but it's a bit more complex than that.

but the end result is what you wrote, more or less. If you want to see how it all works take a look into how WorldObj.GetBlockID and .SetBlockID works. Their implementation should tell you how the system works :)

It's quite interesting ;)

 

Rex Dark:

Also remember that you have blocks which have TileEntities, you will also need to bring the data from those along as well.

 

A solution could be to export all the block data, metadata and tileEntity saved data per location,

then have a place where all the IDs are stored and how they relate to the block names.

 

Then you can write a small java software which can convert the IDs, so that if you want to import a structure and the IDs are different it will convert the IDs for you, to the values you are using?

If you guys dont get it.. then well ya.. try harder...

Posted

Well for chests it's no problem to get the IDs, nor to convert them.

The problem would be if one wanted to support custom mods yeah I see that one..

But for one's own mod and vanilla it's totally doable.

 

Come to think of it, isn't MC edit supporting custom mods with inventories and such? if so you could look into how it's done there :P

 

 

If you guys dont get it.. then well ya.. try harder...

Posted

Endershadow: that's somewhat what it is, but it's a bit more complex than that.

but the end result is what you wrote, more or less. If you want to see how it all works take a look into how WorldObj.GetBlockID and .SetBlockID works. Their implementation should tell you how the system works :)

It's quite interesting ;)

 

you're right! that is quite interesting! I'll have to keep that in mind if I ever decide to customize the dimensions in my mod.

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.