Advertisement
FurPuro

Untitled

Oct 13th, 2024
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 3.68 KB | None | 0 0
  1. package ru.furpuro.mysticrealms.world
  2.  
  3. import net.fabricmc.fabric.api.biome.v1.BiomeModifications
  4. import net.fabricmc.fabric.api.biome.v1.BiomeSelectors
  5. import net.fabricmc.fabric.impl.biome.modification.BuiltInRegistryKeys
  6. import net.minecraft.core.Registry
  7. import net.minecraft.data.BuiltinRegistries
  8. import net.minecraft.data.worldgen.features.OreFeatures
  9. import net.minecraft.resources.ResourceKey
  10. import net.minecraft.server.level.WorldGenRegion
  11. import net.minecraft.world.level.levelgen.GenerationStep
  12. import net.minecraft.world.level.levelgen.VerticalAnchor
  13. import net.minecraft.world.level.levelgen.WorldGenSettings
  14. import net.minecraft.world.level.levelgen.feature.ConfiguredFeature
  15. import net.minecraft.world.level.levelgen.feature.Feature
  16. import net.minecraft.world.level.levelgen.feature.OreFeature
  17. import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration
  18. import net.minecraft.world.level.levelgen.placement.CountPlacement
  19. import net.minecraft.world.level.levelgen.placement.HeightRangePlacement
  20. import net.minecraft.world.level.levelgen.placement.InSquarePlacement
  21. import net.minecraft.world.level.levelgen.placement.PlacedFeature
  22. import ru.furpuro.mysticrealms.Mysticrealms
  23. import ru.furpuro.mysticrealms.blocks.ModBlocks
  24. import ru.hollowhorizon.hc.client.utils.rl
  25.  
  26. object ModWorldGen {
  27.     private val DEBILIUM_ORE_CONFIGURED_FEATURE:ConfiguredFeature<OreConfiguration,*> = ConfiguredFeature(
  28.         Feature.ORE,
  29.         OreConfiguration(
  30.             listOf(
  31.                 OreConfiguration.target(
  32.                     OreFeatures.STONE_ORE_REPLACEABLES,
  33.                     ModBlocks.DEBILIUM_ORE.get().defaultBlockState(),
  34.                 )
  35.             ),
  36.             4
  37.         )
  38.     )
  39.     private val DEBILIUM_ORE_PLACED_FEATURE: PlacedFeature = PlacedFeature(
  40.         BuiltinRegistries.register(
  41.             BuiltinRegistries.CONFIGURED_FEATURE,
  42.             "${Mysticrealms.MOD_ID}:debilium_ore".rl,
  43.             DEBILIUM_ORE_CONFIGURED_FEATURE
  44.         ),
  45.         listOf(
  46.             CountPlacement.of(4), // Количество жил на чанк
  47.             InSquarePlacement.spread(),
  48.             HeightRangePlacement.uniform(VerticalAnchor.absolute(0), VerticalAnchor.absolute(16))
  49.         )
  50.     )
  51.     private val DEEPSLATE_DEBILIUM_ORE_CONFIGURED_FEATURE:ConfiguredFeature<OreConfiguration,*> = ConfiguredFeature(
  52.         Feature.ORE,
  53.         OreConfiguration(
  54.             listOf(
  55.                 OreConfiguration.target(
  56.                     OreFeatures.DEEPSLATE_ORE_REPLACEABLES,
  57.                     ModBlocks.DEEPSLATE_DEBILIUM_ORE.get().defaultBlockState(),
  58.                 )
  59.             ),
  60.             4
  61.         )
  62.     )
  63.     private val DEEPSLATE_DEBILIUM_ORE_PLACED_FEATURE: PlacedFeature = PlacedFeature(
  64.         BuiltinRegistries.register(
  65.             BuiltinRegistries.CONFIGURED_FEATURE,
  66.             "${Mysticrealms.MOD_ID}:debilium_ore".rl,
  67.             DEEPSLATE_DEBILIUM_ORE_CONFIGURED_FEATURE
  68.         ),
  69.         listOf(
  70.             CountPlacement.of(4), // Количество жил на чанк
  71.             InSquarePlacement.spread(),
  72.             HeightRangePlacement.uniform(VerticalAnchor.absolute(-32), VerticalAnchor.absolute(0))
  73.         )
  74.     )
  75.  
  76.     fun registerWorldGen() {
  77.         Registry.register(
  78.             BuiltinRegistries.PLACED_FEATURE,
  79.             "${Mysticrealms.MOD_ID}:debilium_ore".rl,
  80.             DEBILIUM_ORE_PLACED_FEATURE
  81.         )
  82.         BiomeModifications.addFeature(
  83.             BiomeSelectors.all(),
  84.             GenerationStep.Decoration.UNDERGROUND_ORES,
  85.             ResourceKey.create(Registry.PLACED_FEATURE_REGISTRY, "${Mysticrealms.MOD_ID}:debilium_ore".rl)
  86.         )
  87.     }
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement