Skip to content

Commit

Permalink
tree generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaupenjoe committed Nov 27, 2024
1 parent 5bd4316 commit 1948fa8
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
// 1.21.1 2024-11-27T16:00:24.2446923 Registries
// 1.21.1 2024-11-27T16:30:11.7066247 Registries
3fd2de41d7f56602b24c8c3db6189289bbbe5aec data/tutorialmod/enchantment/lightning_striker.json
7f12bbcc0196a5e16c72dbee4a65a0c54ecd8131 data/tutorialmod/neoforge/biome_modifier/add_bismuth_ore.json
c04e2d2718fe82b49b71b226ced92e16b3899de5 data/tutorialmod/neoforge/biome_modifier/add_end_bismuth_ore.json
eb84ccb9c7e293c4e5e8f382dc93f15622b9a7a8 data/tutorialmod/neoforge/biome_modifier/add_nether_bismuth_ore.json
aaf11e04d11a88b56a609c7dfd1d1c1a5271ae31 data/tutorialmod/neoforge/biome_modifier/add_tree_bloodwood.json
3cd890dbde0b55f88785d874de11fa6efdf407d2 data/tutorialmod/trim_material/bismuth.json
a248f3d2ed7262ab9e3ba1194d67ffd6b2e0d1cb data/tutorialmod/trim_pattern/kaupen.json
6c8fa2cc6887e1af235ae1d6b9d047abc187bf0e data/tutorialmod/worldgen/configured_feature/bismuth_ore.json
ec29f104c0a48f205bf953be5e0cfd04b9253b1a data/tutorialmod/worldgen/configured_feature/bloodwood.json
74ca087876b83762b1419f55951e41d2424829c7 data/tutorialmod/worldgen/configured_feature/end_bismuth_ore.json
a1941ebc5c0ae20b1731e019a3aa49df359cb846 data/tutorialmod/worldgen/configured_feature/nether_bismuth_ore.json
890981b29638f9a8066156170d0b4026983cda96 data/tutorialmod/worldgen/placed_feature/bismuth_ore_placed.json
f61fa232fd30393cd5e1cf517a8b75628e27cbbf data/tutorialmod/worldgen/placed_feature/bloodwood_placed.json
d106fa3f3fddcc98dd923e8790fbe20de51b0d1a data/tutorialmod/worldgen/placed_feature/end_bismuth_ore_placed.json
c374ef899ceb43d2518c66ed45ee4915fcfd54e0 data/tutorialmod/worldgen/placed_feature/nether_bismuth_ore_placed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "neoforge:add_features",
"biomes": [
"minecraft:plains",
"minecraft:savanna"
],
"features": "tutorialmod:bloodwood_placed",
"step": "vegetal_decoration"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"feature": "tutorialmod:bloodwood",
"placement": [
{
"type": "minecraft:count",
"count": {
"type": "minecraft:weighted_list",
"distribution": [
{
"data": 3,
"weight": 9
},
{
"data": 5,
"weight": 1
}
]
}
},
{
"type": "minecraft:in_square"
},
{
"type": "minecraft:surface_water_depth_filter",
"max_water_depth": 0
},
{
"type": "minecraft:heightmap",
"heightmap": "OCEAN_FLOOR"
},
{
"type": "minecraft:biome"
},
{
"type": "minecraft:block_predicate_filter",
"predicate": {
"type": "minecraft:would_survive",
"state": {
"Name": "tutorialmod:bloodwood_sapling",
"Properties": {
"stage": "0"
}
}
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BiomeTags;
import net.minecraft.world.level.biome.Biomes;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.neoforged.neoforge.common.world.BiomeModifier;
import net.neoforged.neoforge.common.world.BiomeModifiers;
Expand All @@ -17,6 +18,8 @@ public class ModBiomeModifiers {
public static final ResourceKey<BiomeModifier> ADD_NETHER_BISMUTH_ORE = registerKey("add_nether_bismuth_ore");
public static final ResourceKey<BiomeModifier> ADD_END_BISMUTH_ORE = registerKey("add_end_bismuth_ore");

public static final ResourceKey<BiomeModifier> ADD_TREE_BLOODWOOD = registerKey("add_tree_bloodwood");

public static void bootstrap(BootstrapContext<BiomeModifier> context) {
var placedFeatures = context.lookup(Registries.PLACED_FEATURE);
var biomes = context.lookup(Registries.BIOME);
Expand All @@ -42,6 +45,11 @@ public static void bootstrap(BootstrapContext<BiomeModifier> context) {
HolderSet.direct(placedFeatures.getOrThrow(ModPlacedFeatures.END_BISMUTH_ORE_PLACED_KEY)),
GenerationStep.Decoration.UNDERGROUND_ORES));

context.register(ADD_TREE_BLOODWOOD, new BiomeModifiers.AddFeaturesBiomeModifier(
HolderSet.direct(biomes.getOrThrow(Biomes.PLAINS), biomes.getOrThrow(Biomes.SAVANNA)),
HolderSet.direct(placedFeatures.getOrThrow(ModPlacedFeatures.BLOODWOOD_PLACED_KEY)),
GenerationStep.Decoration.VEGETAL_DECORATION));

}

private static ResourceKey<BiomeModifier> registerKey(String name) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package net.kaupenjoe.tutorialmod.worldgen;

import net.kaupenjoe.tutorialmod.TutorialMod;
import net.kaupenjoe.tutorialmod.block.ModBlocks;
import net.minecraft.core.Holder;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.BootstrapContext;
import net.minecraft.data.worldgen.placement.PlacementUtils;
import net.minecraft.data.worldgen.placement.VegetationPlacements;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.levelgen.VerticalAnchor;
Expand All @@ -19,6 +22,7 @@ public class ModPlacedFeatures {
public static final ResourceKey<PlacedFeature> NETHER_BISMUTH_ORE_PLACED_KEY = registerKey("nether_bismuth_ore_placed");
public static final ResourceKey<PlacedFeature> END_BISMUTH_ORE_PLACED_KEY = registerKey("end_bismuth_ore_placed");

public static final ResourceKey<PlacedFeature> BLOODWOOD_PLACED_KEY = registerKey("bloodwood_placed");

public static void bootstrap(BootstrapContext<PlacedFeature> context) {
var configuredFeatures = context.lookup(Registries.CONFIGURED_FEATURE);
Expand All @@ -29,6 +33,10 @@ public static void bootstrap(BootstrapContext<PlacedFeature> context) {
ModOrePlacement.commonOrePlacement(9, HeightRangePlacement.uniform(VerticalAnchor.absolute(-64), VerticalAnchor.absolute(80))));
register(context, END_BISMUTH_ORE_PLACED_KEY, configuredFeatures.getOrThrow(ModConfiguredFeatures.END_BISMUTH_ORE_KEY),
ModOrePlacement.commonOrePlacement(12, HeightRangePlacement.uniform(VerticalAnchor.absolute(-64), VerticalAnchor.absolute(80))));

register(context, BLOODWOOD_PLACED_KEY, configuredFeatures.getOrThrow(ModConfiguredFeatures.BLOODWOOD_KEY),
VegetationPlacements.treePlacement(PlacementUtils.countExtra(3, 0.1f, 2),
ModBlocks.BLOODWOOD_SAPLING.get()));
}

private static ResourceKey<PlacedFeature> registerKey(String name) {
Expand Down

0 comments on commit 1948fa8

Please sign in to comment.