Search in sources :

Example 6 with IExtendedBiome

use of biomesoplenty.api.biome.IExtendedBiome in project BiomeTweaker by superckl.

the class ScriptCommandRemoveBOP method perform.

@Override
public void perform() throws Exception {
    final Iterator<Biome> it = this.pack.getIterator();
    while (it.hasNext()) {
        Biome biome = it.next();
        final IExtendedBiome eBiome = BOPIntegrationModule.getExtendedBiome(biome);
        biome = eBiome.getBaseBiome();
        if (this.types == null)
            for (final BOPClimates climate : BOPClimates.values()) {
                final Iterator<WeightedBiomeEntry> bit = WarningHelper.<List<WeightedBiomeEntry>>uncheckedCast(BOPBiomeProperties.LAND_BIOMES.get(climate)).iterator();
                while (bit.hasNext()) {
                    final WeightedBiomeEntry entry = bit.next();
                    if (Biome.getIdForBiome(entry.biome) == Biome.getIdForBiome(biome)) {
                        bit.remove();
                        BOPBiomeProperties.TOTAL_BIOMES_WEIGHT.set(climate, BOPBiomeProperties.TOTAL_BIOMES_WEIGHT.get(climate) - entry.weight);
                    }
                }
            }
        else
            for (final String type : this.types) {
                final BOPClimates climate = BOPClimates.valueOf(type);
                if (climate == null)
                    throw new IllegalArgumentException("No climate type found for: " + type);
                final Iterator<WeightedBiomeEntry> bit = WarningHelper.<List<WeightedBiomeEntry>>uncheckedCast(BOPBiomeProperties.LAND_BIOMES.get(climate)).iterator();
                while (bit.hasNext()) {
                    final WeightedBiomeEntry entry = bit.next();
                    if (Biome.getIdForBiome(entry.biome) == Biome.getIdForBiome(biome)) {
                        bit.remove();
                        BOPBiomeProperties.TOTAL_BIOMES_WEIGHT.set(climate, BOPBiomeProperties.TOTAL_BIOMES_WEIGHT.get(climate) - entry.weight);
                    }
                }
            }
        BiomeTweaker.getInstance().onTweak(Biome.getIdForBiome(biome));
    }
}
Also used : IExtendedBiome(biomesoplenty.api.biome.IExtendedBiome) Biome(net.minecraft.world.biome.Biome) IExtendedBiome(biomesoplenty.api.biome.IExtendedBiome) WeightedBiomeEntry(biomesoplenty.api.enums.BOPClimates.WeightedBiomeEntry) Iterator(java.util.Iterator) List(java.util.List) BOPClimates(biomesoplenty.api.enums.BOPClimates)

Example 7 with IExtendedBiome

use of biomesoplenty.api.biome.IExtendedBiome in project BiomeTweaker by superckl.

the class BOPIntegrationModule method getExtendedBiome.

public static IExtendedBiome getExtendedBiome(final Biome biome) {
    IExtendedBiome eBiome = BOPBiomes.REG_INSTANCE.getExtendedBiome(biome);
    if (eBiome == null) {
        eBiome = new ExtendedBiomeWrapper(biome);
        BOPBiomes.REG_INSTANCE.registerBiome(eBiome, eBiome.getBaseBiome().biomeName.toLowerCase());
    }
    return eBiome;
}
Also used : IExtendedBiome(biomesoplenty.api.biome.IExtendedBiome) ExtendedBiomeWrapper(biomesoplenty.common.biome.vanilla.ExtendedBiomeWrapper)

Example 8 with IExtendedBiome

use of biomesoplenty.api.biome.IExtendedBiome in project BiomesOPlenty by Glitchfiend.

the class ModBiomes method registerBiome.

@Override
public IExtendedBiome registerBiome(IExtendedBiome extendedBiome, String idName) {
    if (extendedBiome == null)
        throw new IllegalArgumentException("Extended biome to register cannot be null!");
    // Add to the set of present biomes
    presentBiomes.add(extendedBiome.getBaseBiome());
    // Extra functionality builtin, such as with BOPBiome
    if (extendedBiome instanceof Biome) {
        for (Entry<BOPClimates, Integer> entry : extendedBiome.getWeightMap().entrySet()) {
            if (entry != null) {
                BOPClimates climate = entry.getKey();
                int weight = entry.getValue();
                climate.addBiome(weight, extendedBiome.getBaseBiome());
            }
        }
    } else // extendedBiome is a wrapper
    {
        biomeWrapperMap.put(Biome.getIdForBiome(extendedBiome.getBaseBiome()), extendedBiome);
    }
    return extendedBiome;
}
Also used : BOPOverworldBiome(biomesoplenty.common.biome.overworld.BOPOverworldBiome) IExtendedBiome(biomesoplenty.api.biome.IExtendedBiome) BOPHellBiome(biomesoplenty.common.biome.nether.BOPHellBiome) Biome(net.minecraft.world.biome.Biome) BOPClimates(biomesoplenty.api.enums.BOPClimates)

Aggregations

IExtendedBiome (biomesoplenty.api.biome.IExtendedBiome)8 Biome (net.minecraft.world.biome.Biome)6 BOPClimates (biomesoplenty.api.enums.BOPClimates)4 WeightedBiomeEntry (biomesoplenty.api.enums.BOPClimates.WeightedBiomeEntry)2 IGenerationManager (biomesoplenty.api.generation.IGenerationManager)2 IGenerator (biomesoplenty.api.generation.IGenerator)2 GeneratorStage (biomesoplenty.api.generation.GeneratorStage)1 BOPHellBiome (biomesoplenty.common.biome.nether.BOPHellBiome)1 BOPOverworldBiome (biomesoplenty.common.biome.overworld.BOPOverworldBiome)1 ExtendedBiomeWrapper (biomesoplenty.common.biome.vanilla.ExtendedBiomeWrapper)1 Gson (com.google.gson.Gson)1 JsonArray (com.google.gson.JsonArray)1 JsonObject (com.google.gson.JsonObject)1 JsonPrimitive (com.google.gson.JsonPrimitive)1 Iterator (java.util.Iterator)1 List (java.util.List)1