Advertisement
jayhillx

ModBiomes-1.16.4

Dec 31st, 2020
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. @Mod.EventBusSubscriber(modid = MysticsBiomes.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
  2. public class ModBiomes {
  3. public static final DeferredRegister<Biome> BIOMES = DeferredRegister.create(ForgeRegistries.BIOMES, MysticsBiomes.MOD_ID);
  4.  
  5. //Biomes
  6. public static final RegistryObject<Biome> STRAWBERRY_FIELDS = BIOMES.register("strawberry_fields", StrawberryFieldsBiome::makeStrawberryFieldBiome);
  7. public static final RegistryObject<Biome> LAVENDER_MEADOW = BIOMES.register("lavender_meadow", LavenderMeadowBiome::makeLavenderMeadowBiome);
  8. public static final RegistryObject<Biome> CHERRY_BLOSSOM_FOREST = BIOMES.register("cherry_blossom_forest", CherryBlossomForestBiome::makeCherryBlossomForestBiome);
  9.  
  10. @SubscribeEvent
  11. public static void setupBiomes(final FMLCommonSetupEvent event) {
  12. event.enqueueWork(() -> {
  13. setupBiome(STRAWBERRY_FIELDS.get(), BiomeManager.BiomeType.WARM, 1, BiomeDictionary.Type.RARE, BiomeDictionary.Type.PLAINS, BiomeDictionary.Type.OVERWORLD);
  14. setupBiome(LAVENDER_MEADOW.get(), BiomeManager.BiomeType.COOL, 2, BiomeDictionary.Type.RARE, BiomeDictionary.Type.PLAINS, BiomeDictionary.Type.OVERWORLD);
  15. setupBiome(CHERRY_BLOSSOM_FOREST.get(), BiomeManager.BiomeType.COOL, 2, BiomeDictionary.Type.RARE, BiomeDictionary.Type.FOREST, BiomeDictionary.Type.OVERWORLD);
  16. });
  17. }
  18.  
  19. private static void setupBiome(final Biome biome, final BiomeManager.BiomeType biomeType, final int weight, final BiomeDictionary.Type... types) {
  20. BiomeDictionary.addTypes(key(biome), types);
  21. BiomeManager.addBiome(biomeType, new BiomeManager.BiomeEntry(key(biome), weight));
  22. }
  23.  
  24. private static RegistryKey<Biome> key(final Biome biome) {
  25. return RegistryKey.getOrCreateKey(ForgeRegistries.Keys.BIOMES, Objects.requireNonNull(ForgeRegistries.BIOMES.getKey(biome), "Biome registry name was null"));
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement