#Fully Random Structures and the normal way to make them

29 messages · Page 1 of 1 (latest)

pliant sable
#

I've been making a floating Island mod and have made a way to generate structures. Since the islands are currently being spawned using an item, I have avoided Structures and World gen. An "Island" is currently just a Block[][][], which with hindsight is not a standard way of representing blocks in Minecraft.

The obvious choice seems to be NBT data. I can see that a structure is made of essentially palettes of blocks and positions of blocks, as well as the block type from the palette.

Assuming I convert my Block[][][] to NBT, do i need to do anything else with that data? Do I need to save/register that NBT data to anywhere?

I have a lot of questions, so it obvious to me I need to gain a better understanding of this, but I couldn't find any fully random structures in Vanilla Minecraft.

Hope this makes sense hahaha

strange basin
#

Yeah, they're saved in NBT. Structures go in data/modid/structures. As for worldgen, I don't know.

#

Although are these structures or features? I know there's a difference, so that may help future worldgen-knowledgeable people

pliant sable
#

I've had a bit of a look there, but it seems all structures are read from NBT files rather than generated using seeds.

Definitely think they should be structures, since features seem to be for smaller things that are decoration, and I want there to seems like biome islands in the sky

#

Like this. This is one of the Islands that was generated

strange basin
#

If they're strucutres, they will all look the same (or built out of the same blocks- procedurally generated). That's what you're going for?

pliant sable
#

I assumed there would be a way to make procedurally generated structures, like this island. I can generate the islands, but making them a structure or getting them in world gen is my end goal

strange basin
#

OK. Again, worldgen is foreign to me, I'm just asking the questions I'm pretty sure are relavent to let others help faster :)

pliant sable
#

Amazing! Thats what I'm struggling with, is knowing the right questions to ask hahaha Thanks!

serene atlas
#

Structures are Lego pieces. They can be arranged into larger things (like villages or strongholds) via predefined connectors which specify what kind of structure can connect there, and they can be partially procedurally modified, for example to create a "ruined" one where 5% of the blocks is missing. They can include entities, so "a random villager" can be a structure by itself ... as can be "one of some tree variants" in your island example.

#

You can look in data/minecraft/worldgen/structure/ for the files that define where the "seed structures" (The "start_pool" parameter determines what that is) are placed, and some additional options available.

#

Additional rules for placing them (like how often they appear) are in data/minecraft/worldgen/structure_set/.

#

There's also some bunch of more or less hard-coded versions, which are either somewhat (igloo) or fully (mineshaft) coded instead of using NBT and/or Jigsaw files. Best to head to https://misode.github.io/worldgen/structure/?version=1.20 and see the presets to try and get an overview of how Minecraft does things.

#

Unless you have specific requirements, I'd suggest trying "type": "minecraft:jigsaw" first though.

#

Features on the other hand are basically all code. Data packs can only configure them. The files in data/minecraft/worldgen/placed_feature/ determine where they can end up, and in data/minecraft/worldgen/configured_feature/ what the configuration parameters are. Those are things like ores, vegetation, but also occasionally things you'd expect to be a structure, like desert wells.

#

New features require you to code, basically, new structures - even very complex ones - can be done purely as a data pack.

pliant sable
#

Thats a lot of really good info, thank you.

I assumed that structures could be made into jigsaw pieces, but that it wasn't maditory?
The reason I wanted to use a structure was because of the size restirctions the wiki talks about, where a feature is limited to 3 chunks and structures are not limited to thast same smaller size? Since I want these islands to be somewhat substantial in size.

You have a far better understanding of what a feature vs a structure should be used for, in my mind a structure is a landmark and a surprise to see, whereas a feature is more of a decoration piece.

I'll look at the Mineshaft code, since larger islands may require the island to be split into jigsaw pieces?

One more question, does this sound possible?

serene atlas
pliant sable
#

The variation is handled by the island generation as a whole, rather than a number of jigsaw blocks at this stage. Single structure seems easier for now to me.

All ways I see of explaining structures are just NBT files, even though in the Swamp hut for example, the hut is built using add block, which is what I'd like to do, but I cant get the structure into the registry correctly.

I'm currently doing this

Identifier ISLAND_ID = new Identifier(FlyingIslands.MOD_ID, "island");

        ISLAND_GEN = registerPiece(IslandGenerator::new);
        RegistryKey.of(RegistryKeys.STRUCTURE, ISLAND_ID);
        ISLAND_STRUCTURE = Registry.register(Registries.STRUCTURE_TYPE,
                Identifier.of(FlyingIslands.MOD_ID, "island"),
                () -> IslandStructure.CODEC);

but I cant locate or place the structure. Ideas?

serene atlas
#

I have no idea why you're doing most of it. The last line should suffice to register your class, assuming IslandStructure is a Structure subclass and IslandStructure.CODEC is a Codec<IslandStructure>. That said, this won't get you anything spawned, for that you still need the structure and structure_set data entries configured appropriately.

pliant sable
#

Ok, good to know. I'll remove the other 2 registry parts, I was trying to mimic what is done to the swamp hut. The other lines were because to have a generator, like the swamp hut, you need the structure type.

It feels like I'm missing something here.

I have the structure and structure_set, but I dont know how to point from those json files to code, rather than to an nbt file defining the structure

serene atlas
#

The site's gold for that, yes. The structure/island.json just primarily needs the right type ("type": "mod_id:island") to work, along with biome and generation step settings.

pliant sable
#

Should be all sorted there

serene atlas
#

Looks good. What's the structure set that points to that?

pliant sable
#

Should be this one

serene atlas
#

For tests, I'd lower the spacing and separation values; other than that, this should work. In doubt, try putting it in data/minecraft/... instead of data/flyingisland/... , or replace some other structure set you know works (like the swamp hut).