Forge Questions

CapJackH

New Member
Jul 29, 2019
70
0
1
So this may be a large post, and I'll probably be adding additional ones in comments. I'm working on a mod that modifies a lot of base features of minecraft and obviously have run into some implementation issues. I'll try to word my questions in open enough ways that the best solution can be found, rather than confirming my preconceptions or producing "hacky" results.

1) What's the max amount of metadata that can be put into items/blocks? I'm looking to have some ores and items have a saved state of what percentage of each component element and mineral it contains. Ideally there would be room for 128 sets of 10 bit numbers. Either that or I would have to code an item/block for each combination of elements I believe.

2) Are there any ways already attempted to generate worlds based on a picture, but one generated also by the game? I know ATG has some experimental features to generate height/temperature/moisture maps based on a bitmap. Not quiiite what I'm looking for, but it's on the right track. I'm looking to generate a map perhaps 10,000 x 20,000 chunks large, but only a phase to place the outlines of continents. Actual world generation would then use that outline as a template for placing biomes and height. I know that's a complicated process, but I'm looking to see if something similar has been done, or there are good handlers in forge to call to assist in this kind of generation.

3) Has anyone heard of using draw.io's xml as a way of visual modding? Some sort of parser to extract out information into pre-formatted forge code would be awesome.

4) TBC, whenever I get back to my dev environment.
 

Darkevilmac

New Member
Jul 29, 2019
7
0
0
So this may be a large post, and I'll probably be adding additional ones in comments. I'm working on a mod that modifies a lot of base features of minecraft and obviously have run into some implementation issues. I'll try to word my questions in open enough ways that the best solution can be found, rather than confirming my preconceptions or producing "hacky" results.

1) What's the max amount of metadata that can be put into items/blocks? I'm looking to have some ores and items have a saved state of what percentage of each component element and mineral it contains. Ideally there would be room for 128 sets of 10 bit numbers. Either that or I would have to code an item/block for each combination of elements I believe.

2) Are there any ways already attempted to generate worlds based on a picture, but one generated also by the game? I know ATG has some experimental features to generate height/temperature/moisture maps based on a bitmap. Not quiiite what I'm looking for, but it's on the right track. I'm looking to generate a map perhaps 10,000 x 20,000 chunks large, but only a phase to place the outlines of continents. Actual world generation would then use that outline as a template for placing biomes and height. I know that's a complicated process, but I'm looking to see if something similar has been done, or there are good handlers in forge to call to assist in this kind of generation.

3) Has anyone heard of using draw.io's xml as a way of visual modding? Some sort of parser to extract out information into pre-formatted forge code would be awesome.

4) TBC, whenever I get back to my dev environment.

1. 0-15 that's the max metadata, you're not getting around that without coremodding a lot. ItemStacks have some NBT you could utilize.

2. Unfortunately I'm not experienced in this area of Forge's API but I imagine it's possible with a lot of work by using the custom world gen settings, take a look at biomes o plenty source code and you can get some information from that.

3. Nope, and I'd stick to actually using Java directly for the programming it saves a lot of trouble in the long run and it's best to get familiar with the language then relying on other people to make xml parsing systems.
 

CapJackH

New Member
Jul 29, 2019
70
0
1
1. 0-15 that's the max metadata, you're not getting around that without coremodding a lot. ItemStacks have some NBT you could utilize.

Is there any way coremodding like that while preserving how other mods handle metadata? Or would it come down to I would have to adopt a different data type and other mods' would essentially be calling the wrong type of variable?

2. Unfortunately I'm not experienced in this area of Forge's API but I imagine it's possible with a lot of work by using the custom world gen settings, take a look at biomes o plenty source code and you can get some information from that.

Thanks, BoP's source seem to help. Not with the placing features by a continent template, but definitely with how to place features and register them internally and with forge.

3. Nope, and I'd stick to actually using Java directly for the programming it saves a lot of trouble in the long run and it's best to get familiar with the language then relying on other people to make xml parsing systems.

Oh definitely I want to just use java for the main part of the programming, I just have created a giant (200+ entries last time I checked?) flowchart which saves itself as an xml, and thought it would be great if the entry of the data could be done with a parser... I'll consider making my own, I'll just look into draw.io's api.
 

ljfa

New Member
Jul 29, 2019
2,761
-46
0
Is there any way coremodding like that while preserving how other mods handle metadata? Or would it come down to I would have to adopt a different data type and other mods' would essentially be calling the wrong type of variable?

No, forget about that. The chunk layout in memory and in the savefiles only provide 4 bits of metadata for each block. It would be too complicated to be worth it I guess.
If you want to save additional data for a block that doesn't fit into the metadata, you can use a tile entity.
 

CapJackH

New Member
Jul 29, 2019
70
0
1
No, forget about that. The chunk layout in memory and in the savefiles only provide 4 bits of metadata for each block. It would be too complicated to be worth it I guess.
If you want to save additional data for a block that doesn't fit into the metadata, you can use a tile entity.
Lol I would be worse than greg if I did that. Making EVERY ore and stone be a tile entity. Oh well. I probably will just go with hardcoding the properties of every block and then have items be the crazy ones. Do items have the same meta data limits?
 

ljfa

New Member
Jul 29, 2019
2,761
-46
0
Lol I would be worse than greg if I did that. Making EVERY ore and stone be a tile entity. Oh well. I probably will just go with hardcoding the properties of every block and then have items be the crazy ones. Do items have the same meta data limits?
No, their metadata can go up to INT_MAXSHORT_MAX I think. Mojang also utilizes that for potions.
 
Last edited:

SatanicSanta

New Member
Jul 29, 2019
4,849
-3
0
Lol I would be worse than greg if I did that. Making EVERY ore and stone be a tile entity. Oh well. I probably will just go with hardcoding the properties of every block and then have items be the crazy ones. Do items have the same meta data limits?
On the Greg tile entities: there is literally nothing wrong with having all your ores be tile entities. Greg's tes don't tick, and are actually better for performance than having hundreds of individual blocks with metadata.
 

McJty

Over-Achiever
Mod Developer
May 13, 2014
2,015
2,519
228
twitter.com
Note that for blocks you can store as much information as you want in a TileEntity. Don't use too many of them of course as it adds some overhead.
 

ljfa

New Member
Jul 29, 2019
2,761
-46
0
The C++ limits.h INT_MAX or the Java Integer.MAX_VALUE? Cuz Short.MAX_VALUE is the same number as INT_MAX.
Well we're in Java there of course, so Integer.MAX_VALUE. I get them mixed up with the constants in C limits.h sometimes ^^

However the C INT_MAX is implementation-defined, 32767 is just a minimum value.
 

Hlaaftana

New Member
Jul 29, 2019
304
0
0
Huh... I always thought item metadata went up to Short.MAX_VALUE, since enchantments have the same maximum level. If I ever knew I could have metadata up to 2 billion, my mods would actually have quality...
 

ljfa

New Member
Jul 29, 2019
2,761
-46
0
Actually I was mistaken...it really is Short.MAX_VALUE from what the internet says. Sorry...
But in any case, for item stacks you have the NBT values to store more than that.