@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); } }
@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)); } }
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))