From 71b835b66ee74b225ecae623120460e3dceb6872 Mon Sep 17 00:00:00 2001 From: Jottyfan Date: Mon, 9 Jun 2025 14:19:35 +0200 Subject: [PATCH] added ore generation --- .../gta/gdp/world/ModConfiguredFeatures.java | 19 +++++++++++++ .../gta/gdp/world/ModPlacedFeatures.java | 19 +++++++++++++ .../gta/gdp/world/gen/ModOreGeneration.java | 16 +++++++++++ .../configured_feature/ruby_ore_cf.json | 27 +++++++++++++++++++ .../worldgen/placed_feature/ruby_ore_pf.json | 27 +++++++++++++++++++ 5 files changed, 108 insertions(+) create mode 100644 src/main/java/de/jottyfan/gta/gdp/world/ModConfiguredFeatures.java create mode 100644 src/main/java/de/jottyfan/gta/gdp/world/ModPlacedFeatures.java create mode 100644 src/main/java/de/jottyfan/gta/gdp/world/gen/ModOreGeneration.java create mode 100644 src/main/resources/data/gtagdp/worldgen/configured_feature/ruby_ore_cf.json create mode 100644 src/main/resources/data/gtagdp/worldgen/placed_feature/ruby_ore_pf.json diff --git a/src/main/java/de/jottyfan/gta/gdp/world/ModConfiguredFeatures.java b/src/main/java/de/jottyfan/gta/gdp/world/ModConfiguredFeatures.java new file mode 100644 index 0000000..d7b30e0 --- /dev/null +++ b/src/main/java/de/jottyfan/gta/gdp/world/ModConfiguredFeatures.java @@ -0,0 +1,19 @@ +package de.jottyfan.gta.gdp.world; + +import de.jottyfan.gta.gdp.GTAGDP; +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> RUBY_ORE_CF = registerKey("ruby_ore_cf"); + + public static RegistryKey> registerKey(String name) { + return RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, Identifier.of(GTAGDP.MOD_ID, name)); + } +} diff --git a/src/main/java/de/jottyfan/gta/gdp/world/ModPlacedFeatures.java b/src/main/java/de/jottyfan/gta/gdp/world/ModPlacedFeatures.java new file mode 100644 index 0000000..42599ce --- /dev/null +++ b/src/main/java/de/jottyfan/gta/gdp/world/ModPlacedFeatures.java @@ -0,0 +1,19 @@ +package de.jottyfan.gta.gdp.world; + +import de.jottyfan.gta.gdp.GTAGDP; +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 RUBY_ORE_PF = registerKey("ruby_ore_pf"); + + public static RegistryKey registerKey(String name) { + return RegistryKey.of(RegistryKeys.PLACED_FEATURE, Identifier.of(GTAGDP.MOD_ID, name)); + } +} diff --git a/src/main/java/de/jottyfan/gta/gdp/world/gen/ModOreGeneration.java b/src/main/java/de/jottyfan/gta/gdp/world/gen/ModOreGeneration.java new file mode 100644 index 0000000..923a00d --- /dev/null +++ b/src/main/java/de/jottyfan/gta/gdp/world/gen/ModOreGeneration.java @@ -0,0 +1,16 @@ +package de.jottyfan.gta.gdp.world.gen; + +import de.jottyfan.gta.gdp.world.ModPlacedFeatures; +import net.fabricmc.fabric.api.biome.v1.BiomeModifications; +import net.fabricmc.fabric.api.biome.v1.BiomeSelectors; +import net.minecraft.world.gen.GenerationStep; + +/** + * @author jotty + */ +public class ModOreGeneration { + public static void generateOres() { + BiomeModifications.addFeature(BiomeSelectors.foundInOverworld(), GenerationStep.Feature.UNDERGROUND_ORES, + ModPlacedFeatures.RUBY_ORE_PF); + } +} diff --git a/src/main/resources/data/gtagdp/worldgen/configured_feature/ruby_ore_cf.json b/src/main/resources/data/gtagdp/worldgen/configured_feature/ruby_ore_cf.json new file mode 100644 index 0000000..9d63d14 --- /dev/null +++ b/src/main/resources/data/gtagdp/worldgen/configured_feature/ruby_ore_cf.json @@ -0,0 +1,27 @@ +{ + "type": "minecraft:ore", + "config": { + "discard_chance_on_air_exposure": 0.0, + "size": 20, + "targets": [ + { + "state": { + "Name": "gtagdp:ruby_ore" + }, + "target": { + "predicate_type": "minecraft:tag_match", + "tag": "minecraft:stone_ore_replaceables" + } + }, + { + "state": { + "Name": "gtagdp:ruby_deepslate_ore" + }, + "target": { + "predicate_type": "minecraft:tag_match", + "tag": "minecraft:deepslate_ore_replaceables" + } + } + ] + } +} \ No newline at end of file diff --git a/src/main/resources/data/gtagdp/worldgen/placed_feature/ruby_ore_pf.json b/src/main/resources/data/gtagdp/worldgen/placed_feature/ruby_ore_pf.json new file mode 100644 index 0000000..c0ddaea --- /dev/null +++ b/src/main/resources/data/gtagdp/worldgen/placed_feature/ruby_ore_pf.json @@ -0,0 +1,27 @@ +{ + "feature": "gtagdp: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" + } + ] +} \ No newline at end of file