Made permafrost generation actually respect the new snowy biomes tag, and moved ore generation to LOCAL_MODIFICATIONS to try and combat fabrics awful ordering nonsense

This commit is contained in:
2026-06-10 17:44:40 -04:00
parent 0ff11e6884
commit 19074ff139
2 changed files with 27 additions and 16 deletions
@@ -7,8 +7,11 @@ import net.cmr.jurassicrevived.entity.ModEntities;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.tags.BiomeTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.Biomes;
import net.minecraft.world.level.biome.MobSpawnSettings;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
@@ -21,7 +24,11 @@ public class ModWorldGeneration {
public static void generateWorldGen() {
for (ModWorldgenDefinitions.OreDefinition ore : ModWorldgenDefinitions.ORES) {
addOverworldOre(ore.placedFeatureKey());
if (ore.name().equals("permafrost")) {
addSurfaceModification(ore.placedFeatureKey(), ore.biomeTag());
} else {
addUndergroundOre(ore.placedFeatureKey(), ore.biomeTag());
}
}
Constants.LOG.info("Natural dinosaur spawning config loaded as: {}", JRConfigManager.get().naturallySpawning);
@@ -34,11 +41,19 @@ public class ModWorldGeneration {
}
}
private static void addOverworldOre(ResourceKey<PlacedFeature> placedFeature) {
private static void addUndergroundOre(ResourceKey<PlacedFeature> placedFeature, TagKey<Biome> biomeTag) {
BiomeModifications.addProperties(
context -> context.hasTag(BiomeTags.IS_OVERWORLD),
context -> context.hasTag(biomeTag),
(context, properties) -> properties.getGenerationProperties()
.addFeature(GenerationStep.Decoration.UNDERGROUND_ORES, placedFeature)
.addFeature(GenerationStep.Decoration.LOCAL_MODIFICATIONS, placedFeature)
);
}
private static void addSurfaceModification(ResourceKey<PlacedFeature> placedFeature, TagKey<Biome> biomeTag) {
BiomeModifications.addProperties(
context -> context.hasTag(biomeTag),
(context, properties) -> properties.getGenerationProperties()
.addFeature(GenerationStep.Decoration.TOP_LAYER_MODIFICATION, placedFeature)
);
}
@@ -1,16 +1,13 @@
package net.cmr.jurassicrevived.worldgen;
import dev.architectury.registry.registries.RegistrySupplier;
import net.cmr.jurassicrevived.Constants;
import net.cmr.jurassicrevived.block.ModBlocks;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.tags.BiomeTags; // <-- Add this import
import net.minecraft.tags.BiomeTags;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.food.FoodProperties;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.biome.Biome; // <-- Add this import
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
@@ -33,7 +30,7 @@ public final class ModWorldgenDefinitions {
20,
32,
64,
BiomeTags.IS_OVERWORLD // <-- Add biome tag
BiomeTags.IS_OVERWORLD
),
new OreDefinition(
"stone_fossil",
@@ -75,15 +72,14 @@ public final class ModWorldgenDefinitions {
0,
BiomeTags.IS_OVERWORLD
),
// Add your new Permafrost generation here!
new OreDefinition(
"permafrost",
ModBlocks.PERMAFROST,
BlockTags.DIRT,
16, // Vein Size
6, // Count
60, // Min Y
140,// Max Y
8,
3,
60,
140,
SNOWY_BIOMES
)
);
@@ -96,7 +92,7 @@ public final class ModWorldgenDefinitions {
int count,
int minY,
int maxY,
TagKey<Biome> biomeTag // <-- Add this to the record
TagKey<Biome> biomeTag
) {
public ResourceKey<ConfiguredFeature<?, ?>> configuredFeatureKey() {
return ResourceKey.create(Registries.CONFIGURED_FEATURE, Constants.rl(name));