/** * This method should be called during the "init" FML lifecycle * because it must happen after object handler injection. */ public static void initBiomeManagerAndDictionary() { BiomeManager.addBiome(BiomeType.COOL, new BiomeEntry(cloud, 10)); BiomeManager.addSpawnBiome(cloud); BiomeManager.addStrongholdBiome(cloud); BiomeManager.addVillageBiome(cloud, true); BiomeDictionary.addTypes(cloud, BiomeDictionary.Type.COLD, BiomeDictionary.Type.DRY, BiomeDictionary.Type.MAGICAL ); } }
public void initialize() { BiomeManager.addBiome(type, entry); if (village) { BiomeManager.addVillageBiome(biome, true); } if (spawn) { BiomeManager.addSpawnBiome(biome); } } }
@Override public void set(final Object obj, final Boolean val) throws IllegalArgumentException { if(!(obj instanceof Biome)) throw new IllegalArgumentException("Passed object is not an instance of Biome!"); if(val) BiomeManager.addStrongholdBiome((Biome) obj); else BiomeManager.removeStrongholdBiome((Biome) obj); }
@Override public void set(final Object obj, final Boolean val) throws IllegalArgumentException { if(!(obj instanceof Biome)) throw new IllegalArgumentException("Passed object is not an instance of Biome!"); if(val) BiomeManager.addVillageBiome((Biome) obj, true); else BiomeManager.removeVillageBiome((Biome) obj); }
@SubscribeEvent public static void registerBiomes(RegistryEvent.Register<Biome> event) { IceAndFire.GLACIER = new BiomeGlacier().setRegistryName(IceAndFire.MODID, "Glacier"); event.getRegistry().register(IceAndFire.GLACIER); BiomeDictionary.addTypes(IceAndFire.GLACIER, BiomeDictionary.Type.SNOWY, BiomeDictionary.Type.COLD, BiomeDictionary.Type.SPARSE, BiomeDictionary.Type.DEAD, BiomeDictionary.Type.WASTELAND); if (IceAndFire.CONFIG.spawnGlaciers) { BiomeManager.addSpawnBiome(IceAndFire.GLACIER); BiomeManager.addBiome(BiomeManager.BiomeType.COOL, new BiomeManager.BiomeEntry(IceAndFire.GLACIER, IceAndFire.CONFIG.glacierSpawnChance)); } }
@Override public void perform() throws Exception { final BiomeManager.BiomeType type = BiomeManager.BiomeType.valueOf(this.type); final Iterator<Biome> it = this.pack.getIterator(); while(it.hasNext()){ final Biome biome = it.next(); final BiomeTweakEvent.AddToGeneration event = new BiomeTweakEvent.AddToGeneration(this, biome, new BiomeEntry(biome, this.weight)); if(MinecraftForge.EVENT_BUS.post(event)) continue; BiomeManager.addBiome(type, event.getEntry()); } }
@Override public void set(final Object obj, final Boolean val) throws IllegalStateException, IllegalArgumentException { if(!(obj instanceof Biome)) throw new IllegalArgumentException("Passed object is not an instance of Biome!"); if(val) BiomeManager.addSpawnBiome((Biome) obj); else{ BiomeManager.removeSpawnBiome((Biome) obj); if(!PropertySpawnBiome.loggedSpawn && (BiomeProvider.allowedBiomes.size() == 0)){ LogHelper.warn("Upon removal of biome "+Biome.getIdForBiome((Biome) obj)+" the allowed spawn list appears to be empty. If you aren't adding one later, this will cause a crash."); PropertySpawnBiome.loggedSpawn = true; } } }
@Override public void perform() throws Exception { final Iterator<Biome> it = this.pack.getIterator(); while(it.hasNext()){ final Biome gen = it.next(); for(final BiomeType type:BiomeType.values()) for(final BiomeEntry entry:BiomeManager.getBiomes(type)) if(Biome.getIdForBiome(entry.biome) == Biome.getIdForBiome(gen)) if(!MinecraftForge.EVENT_BUS.post(new BiomeTweakEvent.Remove(this, entry.biome, entry))){ BiomeManager.removeBiome(type, entry); if(BiomeManager.getBiomes(type).isEmpty()) LogHelper.warn("Viable generation biomes for type "+type+" is empty! This will cause Vanilla generation to crash! You've been warned!"); } BiomeTweaker.getInstance().onTweak(Biome.getIdForBiome(gen)); } }
@Override public void set(final Object obj, final Integer val) throws IllegalStateException, IllegalArgumentException { if(!(obj instanceof Biome)) throw new IllegalArgumentException("Passed object is not an instance of Biome!"); final int weight = val; final int id = Biome.getIdForBiome((Biome) obj); for(final BiomeType type:BiomeType.values()){ final List<BiomeEntry> entries = BiomeManager.getBiomes(type); for(final BiomeEntry entry:entries) if(Biome.getIdForBiome(entry.biome) == id) entry.itemWeight = weight; if((type != BiomeManager.BiomeType.DESERT) && !PropertyGenWeight.logged.contains(type) && (WeightedRandom.getTotalWeight(entries) <= 0)){ APIInfo.log.warn("Sum of biome generation weights for type "+type+" is zero! This will cause Vanilla generation to crash! You have been warned!"); PropertyGenWeight.logged.add(type); } } try { BiomeHelper.modTypeLists(); } catch (final Exception e) { throw new IllegalStateException("Failed to set type lists as modded!", e); } }
static void registerBiomes(IForgeRegistry<Biome> registry) { vampireForest = new BiomeGenVampireForest(); vampireForest.setRegistryName(REFERENCE.MODID, "vampireforest"); registry.register(vampireForest); BiomeDictionary.addTypes(vampireForest, BiomeDictionary.Type.FOREST, BiomeDictionary.Type.DENSE, BiomeDictionary.Type.MAGICAL, BiomeDictionary.Type.SPOOKY); if (!Configs.disable_vampireForest) { BiomeManager.addBiome(BiomeManager.BiomeType.WARM, new BiomeManager.BiomeEntry(vampireForest, Balance.general.VAMPIRE_FOREST_WEIGHT)); VampirismMod.log.d("ModBiomes", "Registered vampire forest with weight %d", Balance.general.VAMPIRE_FOREST_WEIGHT); VampirismAPI.sundamageRegistry().addNoSundamageBiome(ModBiomes.vampireForest.getBiomeClass()); } }
for(final BiomeManager.BiomeType type:BiomeManager.BiomeType.values()){ final JsonArray subArray = new JsonArray(); final List<BiomeEntry> entries = BiomeManager.getBiomes(type); for(final BiomeEntry entry:entries) if(Biome.getIdForBiome(entry.biome) == Biome.getIdForBiome(biome))
@Override public void registerBiomeDictionary() { if (spawnWeight > 0) { BiomeManager.addBiome(BiomeManager.BiomeType.COOL, new BiomeManager.BiomeEntry(getBiome(), spawnWeight)); } BiomeManager.addSpawnBiome(getBiome()); BiomeManager.addStrongholdBiome(getBiome()); BiomeManager.addVillageBiome(getBiome(), true); BiomeDictionary.addTypes(getBiome(), BiomeDictionary.Type.COLD, BiomeDictionary.Type.MAGICAL ); }