Ore Generation
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"type": "minecraft:ore",
|
||||
"config": {
|
||||
"discard_chance_on_air_exposure": 0.5,
|
||||
"size": 2,
|
||||
"targets": [
|
||||
{
|
||||
"state": {
|
||||
"Name": "acesbs:deepslate_entropy_ore"
|
||||
},
|
||||
"target": {
|
||||
"predicate_type": "minecraft:tag_match",
|
||||
"tag": "minecraft:deepslate_ore_replaceables"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"type": "minecraft:ore",
|
||||
"config": {
|
||||
"discard_chance_on_air_exposure": 0.5,
|
||||
"size": 2,
|
||||
"targets": [
|
||||
{
|
||||
"state": {
|
||||
"Name": "acesbs:endtropy_ore"
|
||||
},
|
||||
"target": {
|
||||
"block": "minecraft:end_stone",
|
||||
"predicate_type": "minecraft:block_match"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"type": "minecraft:ore",
|
||||
"config": {
|
||||
"discard_chance_on_air_exposure": 0.5,
|
||||
"size": 2,
|
||||
"targets": [
|
||||
{
|
||||
"state": {
|
||||
"Name": "acesbs:entropy_ore"
|
||||
},
|
||||
"target": {
|
||||
"predicate_type": "minecraft:tag_match",
|
||||
"tag": "minecraft:stone_ore_replaceables"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"type": "minecraft:ore",
|
||||
"config": {
|
||||
"discard_chance_on_air_exposure": 0.0,
|
||||
"size": 4,
|
||||
"targets": [
|
||||
{
|
||||
"state": {
|
||||
"Name": "acesbs:infernal_ashes_ore"
|
||||
},
|
||||
"target": {
|
||||
"predicate_type": "minecraft:tag_match",
|
||||
"tag": "minecraft:base_stone_nether"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"feature": "acesbs:deepslate_entropy_ore",
|
||||
"placement": [
|
||||
{
|
||||
"type": "minecraft:count",
|
||||
"count": 12
|
||||
},
|
||||
{
|
||||
"type": "minecraft:in_square"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:height_range",
|
||||
"height": {
|
||||
"type": "minecraft:trapezoid",
|
||||
"max_inclusive": {
|
||||
"above_bottom": 80
|
||||
},
|
||||
"min_inclusive": {
|
||||
"above_bottom": -70
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "minecraft:biome"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"feature": "acesbs:endtropy_ore",
|
||||
"placement": [
|
||||
{
|
||||
"type": "minecraft:count",
|
||||
"count": 12
|
||||
},
|
||||
{
|
||||
"type": "minecraft:in_square"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:height_range",
|
||||
"height": {
|
||||
"type": "minecraft:trapezoid",
|
||||
"max_inclusive": {
|
||||
"above_bottom": 80
|
||||
},
|
||||
"min_inclusive": {
|
||||
"above_bottom": -70
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "minecraft:biome"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"feature": "acesbs:entropy_ore",
|
||||
"placement": [
|
||||
{
|
||||
"type": "minecraft:count",
|
||||
"count": 12
|
||||
},
|
||||
{
|
||||
"type": "minecraft:in_square"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:height_range",
|
||||
"height": {
|
||||
"type": "minecraft:trapezoid",
|
||||
"max_inclusive": {
|
||||
"above_bottom": 80
|
||||
},
|
||||
"min_inclusive": {
|
||||
"above_bottom": -70
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "minecraft:biome"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"feature": "acesbs:infernal_ashes_ore",
|
||||
"placement": [
|
||||
{
|
||||
"type": "minecraft:count",
|
||||
"count": 30
|
||||
},
|
||||
{
|
||||
"type": "minecraft:in_square"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:height_range",
|
||||
"height": {
|
||||
"type": "minecraft:trapezoid",
|
||||
"max_inclusive": {
|
||||
"above_bottom": 80
|
||||
},
|
||||
"min_inclusive": {
|
||||
"above_bottom": -70
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "minecraft:biome"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,13 +1,19 @@
|
||||
package com.acethewildfire.acesbs.world;
|
||||
|
||||
import com.acethewildfire.acesbs.AcesBS;
|
||||
import com.acethewildfire.acesbs.block.ModBlocks;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.registry.Registerable;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.registry.tag.BlockTags;
|
||||
import net.minecraft.structure.rule.BlockMatchRuleTest;
|
||||
import net.minecraft.structure.rule.RuleTest;
|
||||
import net.minecraft.structure.rule.TagMatchRuleTest;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.FeatureConfig;
|
||||
import net.minecraft.world.gen.feature.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ModConfiguredFeatures {
|
||||
// CF -> PF -> WG
|
||||
@@ -15,9 +21,34 @@ public class ModConfiguredFeatures {
|
||||
// PF: How is it placed
|
||||
// WG: Where it is placed
|
||||
|
||||
public static final RegistryKey<ConfiguredFeature<?, ?>> ENTROPY_ORE_KEY = registerKey("entropy_ore");
|
||||
public static final RegistryKey<ConfiguredFeature<?, ?>> DEEPSLATE_ENTROPY_ORE_KEY = registerKey("deepslate_entropy_ore");
|
||||
public static final RegistryKey<ConfiguredFeature<?, ?>> INFERNAL_ASHES_ORE_KEY = registerKey("infernal_ashes_ore");
|
||||
public static final RegistryKey<ConfiguredFeature<?, ?>> ENDTROPY_ORE_KEY = registerKey("endtropy_ore");
|
||||
|
||||
public static void bootstrap(Registerable<ConfiguredFeature<?, ?>> context) {
|
||||
RuleTest stoneReplaceables = new TagMatchRuleTest(BlockTags.STONE_ORE_REPLACEABLES);
|
||||
RuleTest deepslateReplaceables = new TagMatchRuleTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES);
|
||||
RuleTest netherReplaceables = new TagMatchRuleTest(BlockTags.BASE_STONE_NETHER);
|
||||
RuleTest endReplaceables = new BlockMatchRuleTest(Blocks.END_STONE);
|
||||
|
||||
List<OreFeatureConfig.Target> overworldEntropyOres =
|
||||
List.of(OreFeatureConfig.createTarget(stoneReplaceables, ModBlocks.ENTROPY_ORE.getDefaultState()));
|
||||
|
||||
List<OreFeatureConfig.Target> overworldDeepslateEntropyOres =
|
||||
List.of(OreFeatureConfig.createTarget(deepslateReplaceables, ModBlocks.DEEPSLATE_ENTROPY_ORE.getDefaultState()));
|
||||
|
||||
List<OreFeatureConfig.Target> netherAshesOres =
|
||||
List.of(OreFeatureConfig.createTarget(netherReplaceables, ModBlocks.INFERNAL_ASHES_ORE.getDefaultState()));
|
||||
|
||||
List<OreFeatureConfig.Target> endEndtropyOres =
|
||||
List.of(OreFeatureConfig.createTarget(endReplaceables, ModBlocks.ENDTROPY_ORE.getDefaultState()));
|
||||
|
||||
|
||||
register(context, ENTROPY_ORE_KEY, Feature.ORE, new OreFeatureConfig(overworldEntropyOres, 2, 0.5F));
|
||||
register(context, DEEPSLATE_ENTROPY_ORE_KEY, Feature.ORE, new OreFeatureConfig(overworldDeepslateEntropyOres, 2, 0.5F));
|
||||
register(context, INFERNAL_ASHES_ORE_KEY, Feature.ORE, new OreFeatureConfig(netherAshesOres, 4, 0.0F));
|
||||
register(context, ENDTROPY_ORE_KEY, Feature.ORE, new OreFeatureConfig(endEndtropyOres, 2, 0.5F));
|
||||
}
|
||||
|
||||
public static RegistryKey<ConfiguredFeature<?, ?>> registerKey(String name) {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.acethewildfire.acesbs.world;
|
||||
|
||||
import net.minecraft.world.gen.placementmodifier.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ModOrePlacement {
|
||||
public static List<PlacementModifier> modifiers(PlacementModifier countModifier, PlacementModifier heightModifier) {
|
||||
return List.of(countModifier, SquarePlacementModifier.of(), heightModifier, BiomePlacementModifier.of());
|
||||
}
|
||||
|
||||
public static List<PlacementModifier> modifiersWithCount(int count, PlacementModifier heightModifier) {
|
||||
return modifiers(CountPlacementModifier.of(count), heightModifier);
|
||||
}
|
||||
|
||||
public static List<PlacementModifier> modifiersWithRarity(int chance, PlacementModifier heightModifier) {
|
||||
return modifiers(RarityFilterPlacementModifier.of(chance), heightModifier);
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,12 @@ import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.world.gen.YOffset;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.FeatureConfig;
|
||||
import net.minecraft.world.gen.feature.PlacedFeature;
|
||||
import net.minecraft.world.gen.placementmodifier.HeightRangePlacementModifier;
|
||||
import net.minecraft.world.gen.placementmodifier.PlacementModifier;
|
||||
|
||||
import java.util.List;
|
||||
@@ -20,9 +22,32 @@ public class ModPlacedFeatures {
|
||||
// PF: How is it placed
|
||||
// WG: Where it is placed
|
||||
|
||||
public static final RegistryKey<PlacedFeature> ENTROPY_ORE_PLACED_KEY = registerKey("entropy_ore_placed");
|
||||
public static final RegistryKey<PlacedFeature> DEEPSLATE_ENTROPY_ORE_PLACED_KEY = registerKey("deepslate_entropy_ore_placed");
|
||||
public static final RegistryKey<PlacedFeature> INFERNAL_ASHES_ORE_PLACED_KEY = registerKey("infernal_ashes_ore_placed");
|
||||
public static final RegistryKey<PlacedFeature> ENDTROPY_ORE_PLACED_KEY = registerKey("endtropy_ore_placed");
|
||||
|
||||
public static void bootstrap(Registerable<PlacedFeature> context) {
|
||||
var configuredFeatures = context.getRegistryLookup(RegistryKeys.CONFIGURED_FEATURE);
|
||||
|
||||
|
||||
register(context, ENTROPY_ORE_PLACED_KEY, configuredFeatures.getOrThrow(ModConfiguredFeatures.ENTROPY_ORE_KEY),
|
||||
ModOrePlacement.modifiersWithCount(12,
|
||||
HeightRangePlacementModifier.trapezoid(YOffset.aboveBottom(-70), YOffset.aboveBottom(80)))
|
||||
);
|
||||
register(context, DEEPSLATE_ENTROPY_ORE_PLACED_KEY, configuredFeatures.getOrThrow(ModConfiguredFeatures.DEEPSLATE_ENTROPY_ORE_KEY),
|
||||
ModOrePlacement.modifiersWithCount(12,
|
||||
HeightRangePlacementModifier.trapezoid(YOffset.aboveBottom(-70), YOffset.aboveBottom(80)))
|
||||
);
|
||||
register(context, INFERNAL_ASHES_ORE_PLACED_KEY, configuredFeatures.getOrThrow(ModConfiguredFeatures.INFERNAL_ASHES_ORE_KEY),
|
||||
ModOrePlacement.modifiersWithCount(30,
|
||||
HeightRangePlacementModifier.trapezoid(YOffset.aboveBottom(-70), YOffset.aboveBottom(80)))
|
||||
);
|
||||
register(context, ENDTROPY_ORE_PLACED_KEY, configuredFeatures.getOrThrow(ModConfiguredFeatures.ENDTROPY_ORE_KEY),
|
||||
ModOrePlacement.modifiersWithCount(12,
|
||||
HeightRangePlacementModifier.trapezoid(YOffset.aboveBottom(-70), YOffset.aboveBottom(80)))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public static RegistryKey<PlacedFeature> registerKey(String name) {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.acethewildfire.acesbs.world.gen;
|
||||
|
||||
import com.acethewildfire.acesbs.world.ModPlacedFeatures;
|
||||
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
|
||||
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
|
||||
import net.minecraft.world.biome.BiomeKeys;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
|
||||
public class ModOreGeneration {
|
||||
|
||||
public static void generateOres(){
|
||||
|
||||
BiomeModifications.addFeature(BiomeSelectors.includeByKey(BiomeKeys.SNOWY_BEACH), GenerationStep.Feature.UNDERGROUND_ORES, ModPlacedFeatures.ENTROPY_ORE_PLACED_KEY);
|
||||
BiomeModifications.addFeature(BiomeSelectors.foundInOverworld(), GenerationStep.Feature.UNDERGROUND_ORES, ModPlacedFeatures.DEEPSLATE_ENTROPY_ORE_PLACED_KEY);
|
||||
BiomeModifications.addFeature(BiomeSelectors.foundInTheNether(), GenerationStep.Feature.UNDERGROUND_ORES, ModPlacedFeatures.INFERNAL_ASHES_ORE_PLACED_KEY);
|
||||
BiomeModifications.addFeature(BiomeSelectors.foundInTheEnd(), GenerationStep.Feature.UNDERGROUND_ORES, ModPlacedFeatures.ENDTROPY_ORE_PLACED_KEY);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@ public class ModWorldGeneration {
|
||||
|
||||
public static void generateModWorldGen() {
|
||||
AcesBS.LOGGER.info("Registering Mod World Gen for " + AcesBS.MOD_ID);
|
||||
|
||||
ModOreGeneration.generateOres();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user