ore generation
Some checks failed
build / build (push) Has been cancelled

This commit is contained in:
Jottyfan
2026-01-24 15:15:48 +01:00
parent 4d6301ce95
commit 12130a9602
6 changed files with 105 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ import org.slf4j.LoggerFactory;
import de.jottyfan.minecraft.block.ModBlocks;
import de.jottyfan.minecraft.item.ModItems;
import de.jottyfan.minecraft.world.gen.ModOreGeneration;
public class Gtamfmd implements ModInitializer {
public static final String MOD_ID = "gtamfmd";
@@ -16,6 +17,7 @@ public class Gtamfmd implements ModInitializer {
public void onInitialize() {
ModItems.registerModItems();
ModBlocks.registerModBlocks();
ModOreGeneration.generateOres();
}
}

View File

@@ -0,0 +1,21 @@
package de.jottyfan.minecraft.world;
import de.jottyfan.minecraft.Gtamfmd;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;
import net.minecraft.world.gen.feature.ConfiguredFeature;
/**
*
* @author jotty
*
*/
public class ModConfiguredFeatures {
public static final RegistryKey<ConfiguredFeature<?, ?>> RUBY_ORE_CF = registerKey("ruby_ore_cf");
private static RegistryKey<ConfiguredFeature<?, ?>> registerKey(String name) {
return RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, Identifier.of(Gtamfmd.MOD_ID, name));
}
}

View File

@@ -0,0 +1,20 @@
package de.jottyfan.minecraft.world;
import de.jottyfan.minecraft.Gtamfmd;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;
import net.minecraft.world.gen.feature.PlacedFeature;
/**
*
* @author jotty
*
*/
public class ModPlacedFeatures {
public static final RegistryKey<PlacedFeature> RUBY_ORE_PF = registerKey("ruby_ore_pf");
private static RegistryKey<PlacedFeature> registerKey(String name) {
return RegistryKey.of(RegistryKeys.PLACED_FEATURE, Identifier.of(Gtamfmd.MOD_ID, name));
}
}

View File

@@ -0,0 +1,14 @@
package de.jottyfan.minecraft.world.gen;
import de.jottyfan.minecraft.world.ModPlacedFeatures;
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
import net.minecraft.world.gen.GenerationStep;
public class ModOreGeneration {
public static void generateOres() {
BiomeModifications.addFeature(BiomeSelectors.foundInOverworld(),
GenerationStep.Feature.UNDERGROUND_ORES,
ModPlacedFeatures.RUBY_ORE_PF);
}
}

View File

@@ -0,0 +1,21 @@
{ "type": "minecraft:ore",
"config": {
"discard_chance_on_air_exposure": 0.0,
"size": 20,
"targets": [
{
"state": { "Name": "gtamfmd:ruby_ore" },
"target": {
"predicate_type": "minecraft:tag_match",
"tag": "minecraft:stone_ore_replaceables"
}
}, {
"state": { "Name": "gtamfmd:ruby_deepslate_ore" },
"target": {
"predicate_type": "minecraft:tag_match",
"tag": "minecraft:deepslate_ore_replaceables"
}
}
]
}
}

View File

@@ -0,0 +1,27 @@
{
"feature": "gtamfmd:ruby_ore_cf",
"placement": [
{
"type": "minecraft:count",
"count": 16
},
{
"type": "minecraft:in_square"
},
{
"type": "minecraft:height_range",
"height": {
"type": "minecraft:trapezoid",
"max_inclusive": {
"absolute": 80
},
"min_inclusive": {
"absolute": -80
}
}
},
{
"type": "minecraft:biome"
}
]
}