Skip to content

Commit

Permalink
custom structures
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaupenjoe committed Sep 26, 2022
1 parent 9b168b5 commit ba94563
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 0 deletions.
Binary file not shown.
@@ -0,0 +1,17 @@
{
"replace": false,

"_comment": " This biome tag can specify the biome directly. Or specify another biome tag by starting with # ",
"values": [
"#minecraft:is_jungle",
"#minecraft:is_forest",
"#minecraft:is_taiga",
"minecraft:desert",
"minecraft:plains",
"minecraft:snowy_plains",
"minecraft:sunflower_plains",
"minecraft:savanna",
"minecraft:savanna_plateau",
"minecraft:windswept_savanna"
]
}
@@ -0,0 +1,54 @@
{
// The base structure class to use for the behavior of the structure. (Like extra terrain checks and such)
"type": "minecraft:jigsaw",

// the path to the template pool json file to use
"start_pool": "tutorialmod:kaupen_house/start_pool",

// This is how many pieces away from the starting piece a piece of the structure can spawn
// Think of it like the length of the branch of the structure
"size": 2,

// Maximum distance away from center that pieces can spawn. Cannot be greater than 128
"max_distance_from_center": 80,

// The biome tag to use for what biomes that this structure can spawn in"
"biomes": "#tutorialmod:has_structure/kaupen_house",

// The generation step for when to generate the structure. there are 10 stages you can pick from!
// This surface structure stage places the structure before plants and ores are generated
// See GenerationStep.Feature enum for all the stages you can use and what order they are in
"step": "surface_structures",

// Where to spawn our structure at what y value if project_start_to_heightmap is not present.
// start_height can be used to spawn at a random fixed y value by doing something like: "max_inclusive": { "below_top": 10 }, "min_inclusive": { "above_bottom": 32 }
// If project_start_to_heightmap is present, the y value chosen in start_height will be added to the terrain's y value.
// So a start height that gives -5 will sink the structure 5 blocks into the terrain. Here, we will spawn this structure 60 blocks above the terrain.
"start_height": {
"absolute": -1
},

// Makes our sky fan structure take the terrain's top y value and add it to the start_height y value above.
// The final value is the y value the structures spawn at.
// WORLD_SURFACE_WG will stop at first non-air block so it spawns above oceans always instead of sunken into a deep sea.
"project_start_to_heightmap": "WORLD_SURFACE_WG",

// Keep this false. This is only for vanilla legacy villages to make it spawn properly. We don't need no hacks here!
"use_expansion_hack": false,

// What mobs can spawn over time in the structure.
// Make sure you add the mob to the right category (monster, creature, etc)
"spawn_overrides": {
"creature": {
"bounding_box": "piece",
"spawns": [
{
"type": "minecraft:parrot",
"weight": 1,
"minCount": 1,
"maxCount": 4
}
]
}
}
}
@@ -0,0 +1,24 @@
{
// What structures to pick to try and spawn if a spot passes the placement check.
// If two or more structures in this list can spawn in a biome at a spot, a random one based on weight is chosen to spawn
"structures": [
{
"structure": "tutorialmod:kaupen_house",
"weight": 1
}
],
"placement": {
// Make sure this is unique and does not match any other structure set's salt
"salt": 1642136474,

// The average distance apart in chunks for spawn attempts
"spacing": 20,

// Minimum distance apart in chunks for spawn attempts
// MUST ALWAYS BE SMALLER THAN spacing ABOVE
"separation": 6,

// The kind of placement to use. The other kind is ring based like strongholds use.
"type": "minecraft:random_spread"
}
}
@@ -0,0 +1,41 @@
{
// More info on template pools can be found here: https://minecraft.gamepedia.com/Custom_world_generation#JSON_format_8
// Yes, worldgen json files can have comments. Minecraft does "lenient" parsing of these json files.

// This is the name of the template pool itself. I tend to just put the file path and file name here with modid.
"name": "tutorialmod:kaupen_house/start_pool",

// The template pool to refer to if the entries in 'elements' fails to generate.
"fallback": "minecraft:empty",

// Here you can list as many nbt files or placed features to spawn.
// Do note that placed features needs a special element entry stuff.
"elements": [
{

// How likely out of all the element for this one to be chosen.
"weight": 1,
"element": {

// The Identifier of the nbt file itself of the structure piece.
// Note, this will automatically check into the 'structures' folder for the nbt file.
// The final path would look like 'resources/data/tutorialmod/structures/run_down_house_left_side.nbt'
// The Jigsaw block in the structure will point to side_pool.json to spawn the other half of the house.
"location": "tutorialmod:kaupen_house",

// Processor JSON files can be used to randomize or replace blocks dynamically. Here, we don't do any of that.
"processors": "minecraft:empty",

// If set to 'terrain_matching', the house would be deformed to fit the change in land.
// That's best for roads so lets stay 'rigid' for now.
"projection": "rigid",

// The kind of element we are spawning. This one is most likely what you want.
// There's 'minecraft:legacy_single_pool_element' but that swaps the behavior of
// Air and Structure Void in your piece as well as change the attachment mechanism.
// It's only for old Vanilla Jigsaw Structures so don't use it. Stick with non-legacy.
"element_type": "minecraft:single_pool_element"
}
}
]
}

0 comments on commit ba94563

Please sign in to comment.