mirror of
https://github.com/TeamMidnightDust/Decorative.git
synced 2025-12-15 12:35:10 +01:00
Rocky Asphalt now generates naturally again
This commit is contained in:
25
build.gradle
25
build.gradle
@@ -19,6 +19,31 @@ repositories {
|
||||
}
|
||||
maven { url 'https://maven.nucleoid.xyz' }
|
||||
}
|
||||
loom {
|
||||
runs {
|
||||
//
|
||||
// This adds a new gradle task that runs the datagen API: "gradlew runDatagenClient"
|
||||
//
|
||||
datagenClient {
|
||||
inherit client
|
||||
name "Data Generation"
|
||||
vmArg "-Dfabric-api.datagen"
|
||||
vmArg "-Dfabric-api.datagen.output-dir=${file("src/main/generated")}"
|
||||
vmArg "-Dfabric-api.datagen.modid=decorative"
|
||||
|
||||
runDir "build/datagen"
|
||||
}
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main {
|
||||
resources {
|
||||
srcDirs += [
|
||||
'src/main/generated'
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
//to change the versions see the gradle.properties file
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
// 1.21 2024-07-31T12:19:18.555940132 Decorative/decorative
|
||||
0f026ea055880052079f9153d9bb8c0b76de000e data/decorative/worldgen/placed_feature/rocky_asphalt.json
|
||||
8dfd1b980dfd7aba3fa12e1ea506a3c9fc463929 data/decorative/worldgen/configured_feature/rocky_asphalt.json
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"type": "minecraft:ore",
|
||||
"config": {
|
||||
"discard_chance_on_air_exposure": 0.0,
|
||||
"size": 10,
|
||||
"targets": [
|
||||
{
|
||||
"state": {
|
||||
"Name": "decorative:rocky_asphalt"
|
||||
},
|
||||
"target": {
|
||||
"predicate_type": "minecraft:tag_match",
|
||||
"tag": "minecraft:stone_ore_replaceables"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"feature": {
|
||||
"type": "minecraft:ore",
|
||||
"config": {
|
||||
"discard_chance_on_air_exposure": 0.0,
|
||||
"size": 10,
|
||||
"targets": [
|
||||
{
|
||||
"state": {
|
||||
"Name": "decorative:rocky_asphalt"
|
||||
},
|
||||
"target": {
|
||||
"predicate_type": "minecraft:tag_match",
|
||||
"tag": "minecraft:stone_ore_replaceables"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"placement": [
|
||||
{
|
||||
"type": "minecraft:count",
|
||||
"count": 40
|
||||
},
|
||||
{
|
||||
"type": "minecraft:in_square"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:height_range",
|
||||
"height": {
|
||||
"type": "minecraft:uniform",
|
||||
"max_inclusive": {
|
||||
"below_top": 0
|
||||
},
|
||||
"min_inclusive": {
|
||||
"above_bottom": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package eu.midnightdust.motschen.decorative;
|
||||
|
||||
import eu.midnightdust.motschen.decorative.world.OreFeatures;
|
||||
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider;
|
||||
import net.minecraft.registry.RegistryBuilder;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.MOD_ID;
|
||||
|
||||
public class DecorativeDataGen implements DataGeneratorEntrypoint {
|
||||
@Override
|
||||
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
|
||||
FabricDataGenerator.Pack pack = fabricDataGenerator.createPack();
|
||||
pack.addProvider(WorldGenData::new);
|
||||
System.out.println("Initialized dataGen");
|
||||
}
|
||||
@Override
|
||||
public String getEffectiveModId() {
|
||||
return MOD_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildRegistry(RegistryBuilder registryBuilder) {
|
||||
System.out.println("building registry");
|
||||
registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE, OreFeatures::initConfigured);
|
||||
registryBuilder.addRegistry(RegistryKeys.PLACED_FEATURE, OreFeatures::initPlaced);
|
||||
|
||||
}
|
||||
public static class WorldGenData extends FabricDynamicRegistryProvider {
|
||||
public WorldGenData(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||
super(output, registriesFuture);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) {
|
||||
System.out.println("configure");
|
||||
entries.addAll(registries.getWrapperOrThrow(RegistryKeys.CONFIGURED_FEATURE));
|
||||
entries.addAll(registries.getWrapperOrThrow(RegistryKeys.PLACED_FEATURE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return MOD_ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,31 +2,52 @@ package eu.midnightdust.motschen.decorative.world;
|
||||
|
||||
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
|
||||
import net.minecraft.registry.Registerable;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
import net.minecraft.registry.tag.BiomeTags;
|
||||
import net.minecraft.registry.tag.BlockTags;
|
||||
import net.minecraft.structure.rule.TagMatchRuleTest;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.YOffset;
|
||||
import net.minecraft.world.gen.feature.*;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
import net.minecraft.world.gen.feature.OreFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.PlacedFeature;
|
||||
import net.minecraft.world.gen.placementmodifier.CountPlacementModifier;
|
||||
import net.minecraft.world.gen.placementmodifier.HeightRangePlacementModifier;
|
||||
import net.minecraft.world.gen.placementmodifier.SquarePlacementModifier;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.id;
|
||||
import static eu.midnightdust.motschen.decorative.util.RegistryUtil.register;
|
||||
|
||||
public class OreFeatures {
|
||||
// private static final ConfiguredFeature<?, ?> ROCKY_ASPHALT_FEATURE = new ConfiguredFeature<>(Feature.ORE, new OreFeatureConfig(
|
||||
// OreConfiguredFeatures.STONE_ORE_REPLACEABLES, DecorativeMain.RockyAsphalt.getDefaultState(),10));
|
||||
// public static PlacedFeature ROCKY_ASPHALT_PLACED_FEATURE = new PlacedFeature(
|
||||
// RegistryEntry.of(ROCKY_ASPHALT_FEATURE),
|
||||
// List.of(
|
||||
// CountPlacementModifier.of(40),
|
||||
// SquarePlacementModifier.of(),
|
||||
// HeightRangePlacementModifier.uniform(YOffset.BOTTOM, YOffset.TOP)
|
||||
// ));
|
||||
private static final ConfiguredFeature<?, ?> ROCKY_ASPHALT_FEATURE = new ConfiguredFeature<>(Feature.ORE, new OreFeatureConfig(
|
||||
new TagMatchRuleTest(BlockTags.STONE_ORE_REPLACEABLES), DecorativeMain.RockyAsphalt.getDefaultState(),10));
|
||||
public static PlacedFeature ROCKY_ASPHALT_PLACED_FEATURE = new PlacedFeature(
|
||||
RegistryEntry.of(ROCKY_ASPHALT_FEATURE),
|
||||
List.of(
|
||||
CountPlacementModifier.of(40),
|
||||
SquarePlacementModifier.of(),
|
||||
HeightRangePlacementModifier.uniform(YOffset.BOTTOM, YOffset.TOP)
|
||||
));
|
||||
|
||||
public static void init() {
|
||||
// Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new Identifier(DecorativeMain.MOD_ID, "rocky_asphalt"), ROCKY_ASPHALT_FEATURE);
|
||||
// Registry.register(BuiltinRegistries.PLACED_FEATURE, new Identifier(DecorativeMain.MOD_ID, "placed_rocky_asphalt"), ROCKY_ASPHALT_PLACED_FEATURE);
|
||||
// BiomeModifications.addFeature(biome -> (!biome.hasTag(BiomeTags.IS_NETHER) && !biome.hasTag(BiomeTags.END_CITY_HAS_STRUCTURE)),
|
||||
// GenerationStep.Feature.UNDERGROUND_ORES, BuiltinRegistries.PLACED_FEATURE.getKey(OreFeatures.ROCKY_ASPHALT_PLACED_FEATURE).get());
|
||||
BiomeModifications.addFeature(biome -> (!biome.hasTag(BiomeTags.IS_NETHER) && !biome.hasTag(BiomeTags.END_CITY_HAS_STRUCTURE)),
|
||||
GenerationStep.Feature.UNDERGROUND_ORES, getKey(id("rocky_asphalt")));
|
||||
}
|
||||
public static RegistryKey<PlacedFeature> getKey(Identifier id) {
|
||||
return RegistryKey.of(RegistryKeys.PLACED_FEATURE, id);
|
||||
}
|
||||
|
||||
public static void initConfigured(Registerable<ConfiguredFeature<?, ?>> context) {
|
||||
register(context, "rocky_asphalt", ROCKY_ASPHALT_FEATURE);
|
||||
}
|
||||
public static void initPlaced(Registerable<PlacedFeature> context) {
|
||||
register(context, "rocky_asphalt", ROCKY_ASPHALT_PLACED_FEATURE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
],
|
||||
"client": [
|
||||
"eu.midnightdust.motschen.decorative.DecorativeClient"
|
||||
],
|
||||
"fabric-datagen": [
|
||||
"eu.midnightdust.motschen.decorative.DecorativeDataGen"
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user