diff --git a/src/client/java/dev/tggamesyt/szar/client/SzarDataGenerator.java b/src/client/java/dev/tggamesyt/szar/client/SzarDataGenerator.java index 76a3a50..7583bb6 100644 --- a/src/client/java/dev/tggamesyt/szar/client/SzarDataGenerator.java +++ b/src/client/java/dev/tggamesyt/szar/client/SzarDataGenerator.java @@ -2,8 +2,11 @@ package dev.tggamesyt.szar.client; import dev.tggamesyt.szar.ModItemTagProvider; import dev.tggamesyt.szar.ModPoiTagProvider; +import dev.tggamesyt.szar.Szar; import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint; import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; +import net.minecraft.registry.RegistryBuilder; +import net.minecraft.registry.RegistryKeys; import net.minecraft.registry.RegistryWrapper; public class SzarDataGenerator implements DataGeneratorEntrypoint { @@ -11,8 +14,12 @@ public class SzarDataGenerator implements DataGeneratorEntrypoint { @Override public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) { FabricDataGenerator.Pack pack = fabricDataGenerator.createPack(); - pack.addProvider(ModPoiTagProvider::new); pack.addProvider(ModItemTagProvider::new); } + @Override + public void buildRegistry(RegistryBuilder registryBuilder) { + registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE, Szar.ModConfiguredFeatures::boostrap); + registryBuilder.addRegistry(RegistryKeys.PLACED_FEATURE, Szar.ModPlacedFeatures::boostrap); + } } diff --git a/src/main/generated/.cache/79d6404f7b0803346bb38c848032926817f10037 b/src/main/generated/.cache/79d6404f7b0803346bb38c848032926817f10037 index af8def3..83c1b0b 100644 --- a/src/main/generated/.cache/79d6404f7b0803346bb38c848032926817f10037 +++ b/src/main/generated/.cache/79d6404f7b0803346bb38c848032926817f10037 @@ -1,2 +1,2 @@ -// 1.20.1 2026-02-08T13:35:45.6214131 szar/Tags for minecraft:point_of_interest_type +// 1.20.1 2026-02-11T09:35:00.8808882 szar/Tags for minecraft:point_of_interest_type eba137b51c50a7143a3668876f41adaa1447b1d1 data\minecraft\tags\point_of_interest_type\acquirable_job_site.json diff --git a/src/main/generated/.cache/e8da7d0da6535b734ad1b062d141fd76f701db77 b/src/main/generated/.cache/e8da7d0da6535b734ad1b062d141fd76f701db77 index 74a909f..90f177c 100644 --- a/src/main/generated/.cache/e8da7d0da6535b734ad1b062d141fd76f701db77 +++ b/src/main/generated/.cache/e8da7d0da6535b734ad1b062d141fd76f701db77 @@ -1,2 +1,2 @@ -// 1.20.1 2026-02-08T13:35:45.6204179 szar/Tags for minecraft:item +// 1.20.1 2026-02-11T09:35:00.8798931 szar/Tags for minecraft:item 6995bcff12c66325bf8878f8f536d542b4b8776e data\minecraft\tags\items\music_discs.json diff --git a/src/main/java/dev/tggamesyt/szar/Szar.java b/src/main/java/dev/tggamesyt/szar/Szar.java index 40af4d2..3bed2dc 100644 --- a/src/main/java/dev/tggamesyt/szar/Szar.java +++ b/src/main/java/dev/tggamesyt/szar/Szar.java @@ -96,33 +96,14 @@ public class Szar implements ModInitializer { .strength(7.0f, 1200.0f) // very hard, bedrock-tier vibe .requiresTool() ); - public static final ConfiguredFeature URANIUM_ORE_CONFIGURED = - new ConfiguredFeature<>( - Feature.ORE, - new OreFeatureConfig( - new TagMatchRuleTest(BlockTags.STONE_ORE_REPLACEABLES), - Szar.URANIUM_BLOCK.getDefaultState(), - 4 - ) - ); - public static final PlacedFeature URANIUM_ORE_PLACED = - new PlacedFeature( - RegistryEntry.of(URANIUM_ORE_CONFIGURED), - List.of( - CountPlacementModifier.of(2), // veins per chunk - HeightRangePlacementModifier.uniform( - YOffset.fixed(-63), // 1 block above bottom - YOffset.fixed(-60) // 4 blocks above bedrock, adjust for vein height - ), - SquarePlacementModifier.of(), - BiomePlacementModifier.of() - ) - ); + // ConfiguredFeature Key + public static final RegistryKey> URANIUM_ORE_KEY = + RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, new Identifier(MOD_ID, "uranium_ore")); + + // PlacedFeature Key public static final RegistryKey URANIUM_ORE_PLACED_KEY = - RegistryKey.of( - RegistryKeys.PLACED_FEATURE, - new Identifier(MOD_ID, "uranium_ore") - ); + RegistryKey.of(RegistryKeys.PLACED_FEATURE, new Identifier(MOD_ID, "uranium_ore_placed")); + public static final TrackedData LAST_CRIME_TICK = DataTracker.registerData(PlayerEntity.class, TrackedDataHandlerRegistry.LONG); public static final Block NIGGERITEBLOCK = @@ -527,6 +508,12 @@ public class Szar implements ModInitializer { new Identifier(MOD_ID, "cannabis_patch") ) ); + // Hook generation (RegistryKey only) + BiomeModifications.addFeature( + BiomeSelectors.foundInOverworld(), + GenerationStep.Feature.UNDERGROUND_ORES, + URANIUM_ORE_PLACED_KEY + ); AttackEntityCallback.EVENT.register((player, world, hand, entity, hitResult) -> { if (!world.isClient && entity instanceof LivingEntity victim) { @@ -970,5 +957,38 @@ public class Szar implements ModInitializer { ANIMATION_TIMINGS_SECONDS.put(PlaneAnimation.LAND_STARTED, -1f); // looping ANIMATION_TIMINGS_SECONDS.put(PlaneAnimation.LIFT_UP, 1.5f); // 1.5s * 20 ticks } + // Kaupenjoe-style ConfiguredFeature bootstrap + public static class ModConfiguredFeatures { + public static void boostrap(Registerable> context) { + var stoneTag = new TagMatchRuleTest(BlockTags.STONE_ORE_REPLACEABLES); + var deepslateTag = new TagMatchRuleTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES); + + List targets = List.of( + OreFeatureConfig.createTarget(stoneTag, URANIUM_BLOCK.getDefaultState()), + OreFeatureConfig.createTarget(deepslateTag, URANIUM_BLOCK.getDefaultState()) + ); + + context.register(URANIUM_ORE_KEY, new ConfiguredFeature<>(Feature.ORE, new OreFeatureConfig(targets, 4))); + } + } + + // Kaupenjoe-style PlacedFeature bootstrap + public static class ModPlacedFeatures { + public static void boostrap(Registerable context) { + RegistryEntry> configuredEntry = + context.getRegistryLookup(RegistryKeys.CONFIGURED_FEATURE) + .getOrThrow(URANIUM_ORE_KEY); + + context.register(URANIUM_ORE_PLACED_KEY, new PlacedFeature( + configuredEntry, + List.of( + CountPlacementModifier.of(2), + SquarePlacementModifier.of(), + HeightRangePlacementModifier.uniform(YOffset.fixed(-63), YOffset.fixed(-20)), + BiomePlacementModifier.of() + ) + )); + } + } } diff --git a/src/main/resources/assets/szar/blockstates/uranium_ore.json b/src/main/resources/assets/szar/blockstates/uranium_ore.json new file mode 100644 index 0000000..1f80b03 --- /dev/null +++ b/src/main/resources/assets/szar/blockstates/uranium_ore.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "szar:block/uranium_ore" + } + } +} diff --git a/src/main/resources/assets/szar/lang/en_us.json b/src/main/resources/assets/szar/lang/en_us.json index 4abbe3c..acd1dfe 100644 --- a/src/main/resources/assets/szar/lang/en_us.json +++ b/src/main/resources/assets/szar/lang/en_us.json @@ -56,5 +56,6 @@ "item.szar.epstein_spawn_egg": "Epstein Spawn Egg", "item.szar.detonator": "Detonator", - "entity.szar.atom": "Atom" + "entity.szar.atom": "Atom", + "block.szar.uranium_ore": "Uranium Ore" } diff --git a/src/main/resources/assets/szar/models/block/uranium_ore.json b/src/main/resources/assets/szar/models/block/uranium_ore.json new file mode 100644 index 0000000..0f1723f --- /dev/null +++ b/src/main/resources/assets/szar/models/block/uranium_ore.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "szar:block/uranium_ore" + } +} diff --git a/src/main/resources/assets/szar/models/item/uranium_ore.json b/src/main/resources/assets/szar/models/item/uranium_ore.json new file mode 100644 index 0000000..58243b8 --- /dev/null +++ b/src/main/resources/assets/szar/models/item/uranium_ore.json @@ -0,0 +1,3 @@ +{ + "parent": "szar:block/uranium_ore" +} diff --git a/src/main/resources/assets/szar/textures/block/uranium_ore.png b/src/main/resources/assets/szar/textures/block/uranium_ore.png new file mode 100644 index 0000000..1a48438 Binary files /dev/null and b/src/main/resources/assets/szar/textures/block/uranium_ore.png differ diff --git a/src/main/resources/data/szar/loot_tables/blocks/uranium_ore.json b/src/main/resources/data/szar/loot_tables/blocks/uranium_ore.json new file mode 100644 index 0000000..2c2e6a3 --- /dev/null +++ b/src/main/resources/data/szar/loot_tables/blocks/uranium_ore.json @@ -0,0 +1,24 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "szar:uranium_ore" + } + ], + "conditions": [ + { + "condition": "minecraft:match_tool", + "predicate": { + "items": [ + "minecraft:netherite_pickaxe" + ] + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/szar/worldgen/configured_feature/uranium_ore.json b/src/main/resources/data/szar/worldgen/configured_feature/uranium_ore.json deleted file mode 100644 index 27024e3..0000000 --- a/src/main/resources/data/szar/worldgen/configured_feature/uranium_ore.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "type": "minecraft:ore", - "config": { - "targets": [ - { - "target": { - "predicate_type": "minecraft:tag_match", - "tag": "minecraft:stone_ore_replaceables" - }, - "state": { - "Name": "szar:uranium_block", - "Properties": {} - } - } - ], - "size": 1, - "discard_chance_on_air_exposure": 0.0 - } -} diff --git a/src/main/resources/data/szar/worldgen/placed_feature/uranium_ore.json b/src/main/resources/data/szar/worldgen/placed_feature/uranium_ore.json deleted file mode 100644 index 6732341..0000000 --- a/src/main/resources/data/szar/worldgen/placed_feature/uranium_ore.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "feature": "szar:uranium_ore", - "placement": [ - { - "type": "minecraft:count", - "count": 1 - }, - { - "type": "minecraft:in_square" - }, - { - "type": "minecraft:height_range", - "height": { - "type": "minecraft:uniform", - "min_inclusive": {"below_top": 378}, - "max_inclusive": {"below_top": 382} - } - }, - { - "type": "minecraft:biome" - } - ] -}