This commit is contained in:
2025-01-04 16:54:13 -06:00
parent ab0a3a2641
commit d8a8922d1d
19 changed files with 590 additions and 510 deletions

View File

@@ -1,5 +1,9 @@
package xyz.sillyangel.nugget.worldgen;
import net.minecraft.core.HolderSet;
import net.minecraft.tags.BiomeTags;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraftforge.common.world.ForgeBiomeModifiers;
import xyz.sillyangel.nugget.NuggetMod;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.BootstrapContext;
@@ -9,11 +13,17 @@ import net.minecraftforge.common.world.BiomeModifier;
import net.minecraftforge.registries.ForgeRegistries;
public class ModBiomeModifiers {
public static final ResourceKey<BiomeModifier> ADD_NUGGET_ORE = registerKey("add_nugget_ore");
public static void bootstrap(BootstrapContext<BiomeModifier> context) {
var placedFeature = context.lookup(Registries.PLACED_FEATURE);
var biomes = context.lookup(Registries.BIOME);
context.register(ADD_NUGGET_ORE, new ForgeBiomeModifiers.AddFeaturesBiomeModifier(
biomes.getOrThrow(BiomeTags.IS_OVERWORLD),
HolderSet.direct(placedFeature.getOrThrow(ModPlacedFeatures.NUGGET_ORE_PLACED_KEY)),
GenerationStep.Decoration.UNDERGROUND_ORES));
}

View File

@@ -18,7 +18,7 @@ import java.util.List;
public class ModConfiguredFeatures {
public static final ResourceKey<ConfiguredFeature<?, ?>> OVERWORLD_NUGGET_ORE = registerKey("nugget_ore");
public static final ResourceKey<ConfiguredFeature<?, ?>> OVERWORLD_NUGGET_ORE_KEY = registerKey("nugget_ore");
public static void bootstrap(BootstrapContext<ConfiguredFeature<?, ?>> context) {
@@ -29,7 +29,7 @@ public class ModConfiguredFeatures {
OreConfiguration.target(stoneReplaceables, ModBlocks.NUGGET_ORE.get().defaultBlockState()),
OreConfiguration.target(deepslateReplaceables, ModBlocks.NUGGET_DEEPSLATE_ORE.get().defaultBlockState()));
register(context, OVERWORLD_NUGGET_ORE, Feature.ORE, new OreConfiguration(overworldNuggetOres, 9));
register(context, OVERWORLD_NUGGET_ORE_KEY, Feature.ORE, new OreConfiguration(overworldNuggetOres, 9));
}

View File

@@ -1,5 +1,7 @@
package xyz.sillyangel.nugget.worldgen;
import net.minecraft.world.level.levelgen.VerticalAnchor;
import net.minecraft.world.level.levelgen.placement.HeightRangePlacement;
import xyz.sillyangel.nugget.NuggetMod;
import net.minecraft.core.Holder;
import net.minecraft.core.registries.Registries;
@@ -14,10 +16,15 @@ import java.util.List;
public class ModPlacedFeatures {
public static final ResourceKey<PlacedFeature> NUGGET_ORE_PLACED_KEY = registerKey("nugget_ore_placed");
public static void bootstrap(BootstrapContext<PlacedFeature> context) {
var configuredFeatures = context.lookup(Registries.CONFIGURED_FEATURE);
register(context, NUGGET_ORE_PLACED_KEY, configuredFeatures.getOrThrow(ModConfiguredFeatures.OVERWORLD_NUGGET_ORE_KEY),
ModOrePlacement.commonOrePlacement(12,
HeightRangePlacement.uniform(VerticalAnchor.absolute(-64), VerticalAnchor.absolute(80))));
}
private static ResourceKey<PlacedFeature> registerKey(String name) {