Search in sources :

Example 1 with OreConfiguration

use of net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration in project assemblylinemachines by HaydenBelanger.

the class VanillaDimensionOres method registerConfiguredFeatures.

public static void registerConfiguredFeatures() {
    titaniumOreFeature = FeatureUtils.register(AssemblyLineMachines.MODID + ":ore_titanium", Feature.ORE, new OreConfiguration(List.of(OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, Registry.getBlock("titanium_ore").defaultBlockState()), OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, Registry.getBlock("deepslate_titanium_ore").defaultBlockState()), OreConfiguration.target(new BlockMatchTest(Registry.getBlock("corrupt_stone")), Registry.getBlock("corrupt_titanium_ore").defaultBlockState())), ConfigHolder.getCommonConfig().titaniumVeinSize.get()));
    BlockState state = ConfigHolder.getCommonConfig().blackGraniteSpawnsWithNaturalTag.get() ? Registry.getBlock("black_granite").defaultBlockState().setValue(BlockBlackGranite.NATURAL_GRANITE, true) : Registry.getBlock("black_granite").defaultBlockState();
    blackGraniteFeature = FeatureUtils.register(AssemblyLineMachines.MODID + ":ore_black_granite", Feature.ORE, new OreConfiguration(OreFeatures.NETHER_ORE_REPLACEABLES, state, ConfigHolder.getCommonConfig().blackGraniteVeinSize.get()));
    chromiumOreFeature = FeatureUtils.register(AssemblyLineMachines.MODID + ":ore_chromium", Feature.ORE, new OreConfiguration(new BlockMatchTest(Blocks.END_STONE), Registry.getBlock("chromium_ore").defaultBlockState(), ConfigHolder.getCommonConfig().chromiumVeinSize.get()));
}
Also used : BlockMatchTest(net.minecraft.world.level.levelgen.structure.templatesystem.BlockMatchTest) BlockState(net.minecraft.world.level.block.state.BlockState) OreConfiguration(net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration)

Example 2 with OreConfiguration

use of net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration in project Beyond-Earth by MrScautHD.

the class OreGeneration method registerFeature.

@SubscribeEvent
public static void registerFeature(RegistryEvent.Register<Feature<?>> event) {
    /**
     * MOON
     */
    moonCheeseOre = PlacementUtils.register("moon_cheese_ore", FeatureUtils.register("moon_cheese_ore", Feature.ORE, new OreConfiguration(MOON_MATCH, ModInit.MOON_CHEESE_ORE.get().defaultBlockState(), 10)), commonOrePlacement(20, HeightRangePlacement.triangle(VerticalAnchor.absolute(-80), VerticalAnchor.absolute(192))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "moon_cheese_ore"), moonCheeseOre.value());
    soulSoil = PlacementUtils.register("soul_soil", FeatureUtils.register("soul_soil", Feature.ORE, new OreConfiguration(MOON_MATCH, Blocks.SOUL_SOIL.defaultBlockState(), 60)), commonOrePlacement(22, HeightRangePlacement.triangle(VerticalAnchor.absolute(0), VerticalAnchor.absolute(100))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "soul_soil"), soulSoil.value());
    moonIceShardOre = PlacementUtils.register("moon_ice_shard_ore", FeatureUtils.register("moon_ice_shard_ore", Feature.ORE, new OreConfiguration(MOON_MATCH, ModInit.MOON_ICE_SHARD_ORE.get().defaultBlockState(), 10)), commonOrePlacement(8, HeightRangePlacement.triangle(VerticalAnchor.absolute(-32), VerticalAnchor.absolute(32))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "moon_ice_shard_ore"), moonIceShardOre.value());
    moonIronOre = PlacementUtils.register("moon_iron_ore", FeatureUtils.register("moon_iron_ore", Feature.ORE, new OreConfiguration(MOON_MATCH, ModInit.MOON_IRON_ORE.get().defaultBlockState(), 11)), commonOrePlacement(10, HeightRangePlacement.triangle(VerticalAnchor.absolute(-24), VerticalAnchor.absolute(56))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "moon_iron_ore"), moonIronOre.value());
    moonDeshOre = PlacementUtils.register("moon_desh_ore", FeatureUtils.register("moon_desh_ore", Feature.ORE, new OreConfiguration(MOON_MATCH, ModInit.MOON_DESH_ORE.get().defaultBlockState(), 9)), commonOrePlacement(7, HeightRangePlacement.triangle(VerticalAnchor.absolute(-80), VerticalAnchor.absolute(80))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "moon_desh_ore"), moonDeshOre.value());
    /**
     * MARS
     */
    marsIceShardOre = PlacementUtils.register("mars_ice_shard_ore", FeatureUtils.register("mars_ice_shard_ore", Feature.ORE, new OreConfiguration(MARS_MATCH, ModInit.MARS_ICE_SHARD_ORE.get().defaultBlockState(), 10)), commonOrePlacement(8, HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(-32), VerticalAnchor.aboveBottom(32))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "mars_ice_shard_ore"), marsIceShardOre.value());
    marsIronOre = PlacementUtils.register("mars_iron_ore", FeatureUtils.register("mars_iron_ore", Feature.ORE, new OreConfiguration(MARS_MATCH, ModInit.MARS_IRON_ORE.get().defaultBlockState(), 11)), commonOrePlacement(10, HeightRangePlacement.triangle(VerticalAnchor.absolute(-24), VerticalAnchor.absolute(56))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "mars_iron_ore"), marsIronOre.value());
    marsDiamondOre = PlacementUtils.register("mars_diamond_ore", FeatureUtils.register("mars_diamond_ore", Feature.ORE, new OreConfiguration(MARS_MATCH, ModInit.MARS_DIAMOND_ORE.get().defaultBlockState(), 7)), commonOrePlacement(7, HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(-80), VerticalAnchor.aboveBottom(80))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "mars_diamond_ore"), marsDiamondOre.value());
    marsOstrumOre = PlacementUtils.register("mars_ostrum_ore", FeatureUtils.register("mars_ostrum_ore", Feature.ORE, new OreConfiguration(MARS_MATCH, ModInit.MARS_OSTRUM_ORE.get().defaultBlockState(), 8)), commonOrePlacement(6, HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(-80), VerticalAnchor.aboveBottom(80))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "mars_ostrum_ore"), marsOstrumOre.value());
    /**
     * MERCURY
     */
    mercuryIronOre = PlacementUtils.register("mercury_iron_ore", FeatureUtils.register("mercury_iron_ore", Feature.ORE, new OreConfiguration(MERCURY_MATCH, ModInit.MERCURY_IRON_ORE.get().defaultBlockState(), 8)), commonOrePlacement(20, HeightRangePlacement.triangle(VerticalAnchor.absolute(-80), VerticalAnchor.absolute(192))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "mercury_iron_ore"), mercuryIronOre.value());
    /**
     * Venus
     */
    venusCoalOre = PlacementUtils.register("venus_coal_ore", FeatureUtils.register("venus_coal_ore", Feature.ORE, new OreConfiguration(VENUS_MATCH, ModInit.VENUS_COAL_ORE.get().defaultBlockState(), 17)), commonOrePlacement(20, HeightRangePlacement.triangle(VerticalAnchor.absolute(-80), VerticalAnchor.absolute(192))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "venus_coal_ore"), venusCoalOre.value());
    venusGoldOre = PlacementUtils.register("venus_gold_ore", FeatureUtils.register("venus_gold_ore", Feature.ORE, new OreConfiguration(VENUS_MATCH, ModInit.VENUS_GOLD_ORE.get().defaultBlockState(), 10)), commonOrePlacement(4, HeightRangePlacement.triangle(VerticalAnchor.absolute(-64), VerticalAnchor.absolute(32))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "venus_gold_ore"), venusGoldOre.value());
    venusDiamondOre = PlacementUtils.register("venus_diamond_ore", FeatureUtils.register("venus_diamond_ore", Feature.ORE, new OreConfiguration(VENUS_MATCH, ModInit.VENUS_DIAMOND_ORE.get().defaultBlockState(), 9)), commonOrePlacement(7, HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(-80), VerticalAnchor.aboveBottom(80))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "venus_diamond_ore"), venusDiamondOre.value());
    venusCaloriteOre = PlacementUtils.register("venus_calorite_ore", FeatureUtils.register("venus_calorite_ore", Feature.ORE, new OreConfiguration(VENUS_MATCH, ModInit.VENUS_CALORITE_ORE.get().defaultBlockState(), 8)), commonOrePlacement(6, HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(-80), VerticalAnchor.aboveBottom(80))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "venus_calorite_ore"), venusCaloriteOre.value());
    /**
     * Glacio
     */
    glacioIceShardOre = PlacementUtils.register("glacio_ice_shard_ore", FeatureUtils.register("glacio_ice_shard_ore", Feature.ORE, new OreConfiguration(GLACIO_MATCH, ModInit.GLACIO_ICE_SHARD_ORE.get().defaultBlockState(), 10)), commonOrePlacement(8, HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(-32), VerticalAnchor.aboveBottom(32))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "glacio_ice_shard_ore"), glacioIceShardOre.value());
    glacioCoalOre = PlacementUtils.register("glacio_coal_ore", FeatureUtils.register("glacio_coal_ore", Feature.ORE, new OreConfiguration(GLACIO_MATCH, ModInit.GLACIO_COAL_ORE.get().defaultBlockState(), 17)), commonOrePlacement(20, HeightRangePlacement.triangle(VerticalAnchor.absolute(-80), VerticalAnchor.absolute(192))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "glacio_coal_ore"), glacioCoalOre.value());
    glacioCopperOre = PlacementUtils.register("glacio_copper_ore", FeatureUtils.register("glacio_copper_ore", Feature.ORE, new OreConfiguration(GLACIO_MATCH, ModInit.GLACIO_COPPER_ORE.get().defaultBlockState(), 17)), commonOrePlacement(16, HeightRangePlacement.triangle(VerticalAnchor.absolute(-16), VerticalAnchor.absolute(112))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "glacio_copper_ore"), glacioCopperOre.value());
    glacioIronOre = PlacementUtils.register("glacio_iron_ore", FeatureUtils.register("glacio_iron_ore", Feature.ORE, new OreConfiguration(GLACIO_MATCH, ModInit.GLACIO_IRON_ORE.get().defaultBlockState(), 12)), commonOrePlacement(10, HeightRangePlacement.triangle(VerticalAnchor.absolute(-24), VerticalAnchor.absolute(56))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "glacio_iron_ore"), glacioIronOre.value());
    glacioLapisOre = PlacementUtils.register("glacio_lapis_ore", FeatureUtils.register("glacio_lapis_ore", Feature.ORE, new OreConfiguration(GLACIO_MATCH, ModInit.GLACIO_LAPIS_ORE.get().defaultBlockState(), 9)), commonOrePlacement(2, HeightRangePlacement.triangle(VerticalAnchor.absolute(-32), VerticalAnchor.absolute(32))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "glacio_lapis_ore"), glacioLapisOre.value());
    /**
     * Glacio Deepslate
     */
    deepslateCoalOre = PlacementUtils.register("deepslate_coal_ore", FeatureUtils.register("deepslate_coal_ore", Feature.ORE, new OreConfiguration(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, Blocks.DEEPSLATE_COAL_ORE.defaultBlockState(), 17)), commonOrePlacement(20, HeightRangePlacement.triangle(VerticalAnchor.absolute(-80), VerticalAnchor.absolute(192))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "deepslate_coal_ore"), deepslateCoalOre.value());
    deepslateCopperOre = PlacementUtils.register("deepslate_copper_ore", FeatureUtils.register("deepslate_copper_ore", Feature.ORE, new OreConfiguration(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, Blocks.DEEPSLATE_COPPER_ORE.defaultBlockState(), 17)), commonOrePlacement(16, HeightRangePlacement.triangle(VerticalAnchor.absolute(-80), VerticalAnchor.absolute(112))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "deepslate_copper_ore"), deepslateCopperOre.value());
    deepslateIronOre = PlacementUtils.register("deepslate_iron_ore", FeatureUtils.register("deepslate_iron_ore", Feature.ORE, new OreConfiguration(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, Blocks.DEEPSLATE_IRON_ORE.defaultBlockState(), 12)), commonOrePlacement(10, HeightRangePlacement.triangle(VerticalAnchor.absolute(-80), VerticalAnchor.absolute(20))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "deepslate_iron_ore"), deepslateIronOre.value());
    deepslateLapisOre = PlacementUtils.register("deepslate_lapis_ore", FeatureUtils.register("deepslate_lapis_ore", Feature.ORE, new OreConfiguration(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, Blocks.DEEPSLATE_LAPIS_ORE.defaultBlockState(), 9)), commonOrePlacement(2, HeightRangePlacement.triangle(VerticalAnchor.absolute(-80), VerticalAnchor.absolute(10))));
    Registry.register(BuiltinRegistries.PLACED_FEATURE, new ResourceLocation(BeyondEarthMod.MODID, "deepslate_lapis_ore"), deepslateLapisOre.value());
}
Also used : ResourceLocation(net.minecraft.resources.ResourceLocation) OreConfiguration(net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Example 3 with OreConfiguration

use of net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration in project BCLib by paulevsGitch.

the class BCLCommonFeatures method makeOreFeature.

/**
 * Will create a basic ore feature.
 *
 * @param id		{@link ResourceLocation} feature ID.
 * @param blockOre  {@link Decoration} feature step.
 * @param hostBlock {@link Block} to generate feature in.
 * @param veins	 iterations per chunk.
 * @param veinSize  size of ore vein.
 * @param airDiscardChance chance that this orge gets discarded when it is exposed to air
 * @param placement {@link net.minecraft.world.level.levelgen.placement.PlacementModifier} for the ore distribution,
 * for example {@code PlacementUtils.FULL_RANGE}, {@code PlacementUtils.RANGE_10_10}
 * @param rare	  when true, this is placed as a rare resource
 * @return new BCLFeature instance.
 */
public static BCLFeature makeOreFeature(ResourceLocation id, Block blockOre, Block hostBlock, int veins, int veinSize, float airDiscardChance, PlacementModifier placement, boolean rare) {
    BCLFeatureBuilder builder = BCLFeatureBuilder.start(id, Feature.ORE).decoration(Decoration.UNDERGROUND_ORES);
    if (rare) {
        builder.oncePerChunks(veins);
    } else {
        builder.count(veins);
    }
    builder.modifier(placement).squarePlacement().onlyInBiome();
    return builder.build(new OreConfiguration(new BlockMatchTest(hostBlock), blockOre.defaultBlockState(), veinSize, airDiscardChance));
}
Also used : BlockMatchTest(net.minecraft.world.level.levelgen.structure.templatesystem.BlockMatchTest) OreConfiguration(net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration)

Example 4 with OreConfiguration

use of net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration in project Ore-Control by DerFrZocker.

the class NMSUtil_v1_17_R1 method createFeatureConfiguration.

@Override
public Object createFeatureConfiguration(@NotNull final Object defaultFeatureConfiguration, final int veinsSize) {
    final ConfiguredFeature<OreConfiguration, ?> worldGenFeatureConfigured = (ConfiguredFeature<OreConfiguration, ?>) defaultFeatureConfiguration;
    final OreConfiguration worldGenFeatureOreConfiguration = new OreConfiguration(worldGenFeatureConfigured.config.targetStates, veinsSize, worldGenFeatureConfigured.config.discardChanceOnAirExposure);
    return new ConfiguredFeature<>(worldGenFeatureConfigured.feature, worldGenFeatureOreConfiguration);
}
Also used : ConfiguredFeature(net.minecraft.world.level.levelgen.feature.ConfiguredFeature) OreConfiguration(net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration)

Example 5 with OreConfiguration

use of net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration in project Sullys-Mod by Uraneptus.

the class SMFeatures method registerFeatures.

public static void registerFeatures() {
    OreConfiguration jade_ore = new OreConfiguration(JADE_ORE_TARGET_LIST, 10);
    JADE_ORE_PLACEMENT = register("jade_ore", new ConfiguredFeature<>(Feature.ORE, jade_ore), CountPlacement.of(16), HeightRangePlacement.triangle(VerticalAnchor.absolute(-16), VerticalAnchor.absolute(112)));
}
Also used : ConfiguredFeature(net.minecraft.world.level.levelgen.feature.ConfiguredFeature) OreConfiguration(net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration)

Aggregations

OreConfiguration (net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration)12 BlockState (net.minecraft.world.level.block.state.BlockState)4 ResourceLocation (net.minecraft.resources.ResourceLocation)3 ConfiguredFeature (net.minecraft.world.level.levelgen.feature.ConfiguredFeature)3 BlockPos (net.minecraft.core.BlockPos)2 BulkSectionAccess (net.minecraft.world.level.chunk.BulkSectionAccess)2 LevelChunkSection (net.minecraft.world.level.chunk.LevelChunkSection)2 TargetBlockState (net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration.TargetBlockState)2 BlockMatchTest (net.minecraft.world.level.levelgen.structure.templatesystem.BlockMatchTest)2 Layer (com.simibubi.create.foundation.worldgen.LayerPattern.Layer)1 SubtypeOre (electrodynamics.common.block.subtype.SubtypeOre)1 ArrayList (java.util.ArrayList)1 BitSet (java.util.BitSet)1 Random (java.util.Random)1 MutableBlockPos (net.minecraft.core.BlockPos.MutableBlockPos)1 WorldGenLevel (net.minecraft.world.level.WorldGenLevel)1 PlacedFeature (net.minecraft.world.level.levelgen.placement.PlacedFeature)1 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)1