Skip to content

Commit

Permalink
enable crystal generation
Browse files Browse the repository at this point in the history
  • Loading branch information
PinkGoosik committed Dec 25, 2023
1 parent 8f178ac commit 3e60b63
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 22 deletions.
38 changes: 16 additions & 22 deletions src/main/java/artifality/registry/ArtifalityFeatures.java
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
package artifality.registry;

import static artifality.ArtifalityMod.id;

import artifality.ArtifalityMod;
import artifality.worldgen.feature.CrystalFeature;
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;

import java.util.List;
import net.fabricmc.fabric.api.biome.v1.ModificationPhase;
import net.minecraft.registry.*;
import net.minecraft.registry.tag.BiomeTags;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.feature.*;

@SuppressWarnings("deprecation")
public class ArtifalityFeatures {
// public static final Feature<DefaultFeatureConfig> CRYSTAL_FEATURE = new CrystalFeature();
// public static final ConfiguredFeature<?, ?> CRYSTAL_FEATURE_CONFIG = new ConfiguredFeature<>(CRYSTAL_FEATURE, new DefaultFeatureConfig());
// public static final PlacedFeature CRYSTAL_FEATURE_PLACED = new PlacedFeature(Holder.createDirect(CRYSTAL_FEATURE_CONFIG), List.of(PlacedFeatureUtil.BOTTOM_TO_MAX_TERRAIN_HEIGHT_RANGE));
public static final Feature<DefaultFeatureConfig> CRYSTAL_FEATURE = new CrystalFeature();
public static final RegistryKey<ConfiguredFeature<?,?>> CRYSTAL_FEATURE_CONFIG = RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, ArtifalityMod.id("crystals"));
public static final RegistryKey<PlacedFeature> CRYSTAL_FEATURE_PLACED = RegistryKey.of(RegistryKeys.PLACED_FEATURE, ArtifalityMod.id("crystals"));

public static void init() {
// Registry.register(Registries.FEATURE, id("crystal_feature"), CRYSTAL_FEATURE);
// Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, id("crystal_feature"), CRYSTAL_FEATURE_CONFIG);
// Registry.register(BuiltinRegistries.PLACED_FEATURE, id("crystal_feature"), CRYSTAL_FEATURE_PLACED);
//
// BiomeModifications.addFeature(
// ctx -> {
// Biome.Category category = Biome.getCategory(ctx.getBiomeRegistryEntry());
// return !category.equals(Biome.Category.NETHER) && !category.equals(Biome.Category.THEEND);
// },
// GenerationStep.Feature.UNDERGROUND_DECORATION,
// BuiltinRegistries.PLACED_FEATURE.getKey(CRYSTAL_FEATURE_PLACED).orElseThrow()
// );
Registry.register(Registries.FEATURE, ArtifalityMod.id("crystals"), CRYSTAL_FEATURE);

BiomeModifications.create(ArtifalityMod.id("features"))
.add(ModificationPhase.ADDITIONS, ctx -> {
var entry = ctx.getBiomeRegistryEntry();
return !entry.isIn(BiomeTags.IS_NETHER) && !entry.isIn(BiomeTags.IS_END);
}, ctx -> ctx.getGenerationSettings().addFeature(GenerationStep.Feature.UNDERGROUND_DECORATION, CRYSTAL_FEATURE_PLACED));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "artifality:crystals",
"config": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"feature": "artifality:crystals",
"placement": []
}

0 comments on commit 3e60b63

Please sign in to comment.