Advertisement
FurPuro

Untitled

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