Search in sources :

Example 1 with BiomeProperties

use of net.minecraft.world.biome.Biome.BiomeProperties in project Gaia-Dimension by Andromander.

the class GDBiomesRegister method onRegisterBiomes.

@SuppressWarnings("OverlyCoupledMethod")
@SubscribeEvent
public static void onRegisterBiomes(Register<Biome> event) {
    final BiomeRegistry biomes = new BiomeRegistry(event.getRegistry());
    biomes.register("pink_agate_forest", new GDPinkAgateForest(new BiomeProperties("Pink Agate Forest").setTemperature(0.66F).setRainfall(0).setHeightVariation(0.1F)), Type.FOREST);
    biomes.register("blue_agate_taiga", new GDBlueAgateTaiga(new BiomeProperties("Blue Agate Taiga").setTemperature(0.4F).setRainfall(0).setHeightVariation(0.2F)), Type.CONIFEROUS);
    biomes.register("green_agate_jungle", new GDGreenAgateJungle(new BiomeProperties("Green Agate Jungle").setTemperature(0.75F).setRainfall(0).setHeightVariation(0.2F)), Type.JUNGLE);
    biomes.register("purple_agate_swamp", new GDPurpleAgateSwamp(new BiomeProperties("Purple Agate Swamp").setTemperature(0.7F).setRainDisabled().setBaseHeight(-0.05F).setHeightVariation(0.05F)), Type.SWAMP, Type.MAGICAL);
    biomes.register("fossil_woodland", new GDFossilWoodland(new BiomeProperties("Fossil Woodland").setTemperature(0.66F).setRainfall(0).setHeightVariation(0.05F)), Type.SAVANNA);
    biomes.register("crystal_plains", new GDCrystalPlains(new BiomeProperties("Crystal Plains").setTemperature(0.66F).setRainDisabled().setBaseHeight(0.125F).setHeightVariation(0.05F)), Type.PLAINS);
    biomes.register("volcaniclands", new GDVolcanicLands(new BiomeProperties("Volcaniclands").setTemperature(0.9F).setRainDisabled().setBaseHeight(1F).setHeightVariation(0.7F)), Type.HOT, Type.SPARSE, Type.DRY, Type.MOUNTAIN);
    biomes.register("static_wasteland", new GDStaticWasteland(new BiomeProperties("Static Wasteland").setTemperature(0.4F).setRainDisabled().setBaseHeight(3F).setHeightVariation(0.05F)), Type.WASTELAND, Type.MOUNTAIN);
    biomes.register("goldstonelands", new GDGoldstoneLands(new BiomeProperties("Goldstonelands").setTemperature(0.55F).setRainDisabled().setBaseHeight(0.125F).setHeightVariation(0.05F)), Type.WASTELAND, Type.PLAINS);
    biomes.register("mineral_reservoir", new GDMineralReservoir(new BiomeProperties("Mineral Reservoir").setTemperature(0.66F).setRainfall(0).setBaseHeight(-1.8F).setHeightVariation(0.1F)), Type.OCEAN);
    biomes.register("mineral_river", new GDMineralRiver(new BiomeProperties("Mineral River").setTemperature(0.5F).setRainfall(0).setBaseHeight(-0.5F).setHeightVariation(0)), Type.RIVER);
}
Also used : BiomeProperties(net.minecraft.world.biome.Biome.BiomeProperties) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 2 with BiomeProperties

use of net.minecraft.world.biome.Biome.BiomeProperties in project BiomeTweaker by superckl.

the class ScriptCommandCreateBiome method perform.

@Override
public void perform() throws Exception {
    if (RegistryEventHandler.registry == null)
        throw new IllegalStateException("No biome registry avilable! Make sure you're using the biome registry script stage!");
    if (this.toCopy == null) {
        final BiomeTweakerBiome biome = new BiomeTweakerBiome(new BiomeProperties("BiomeTweaker Biome").setBaseHeight(0.125F).setHeightVariation(0.05F).setTemperature(0.8F).setRainfall(0.4F));
        if (!MinecraftForge.EVENT_BUS.post(new BiomeTweakEvent.Create(this, biome))) {
            biome.setRegistryName(ModData.MOD_ID, this.rLoc.toLowerCase());
            RegistryEventHandler.registry.register(biome);
            BiomeTweaker.getInstance().onTweak(Biome.getIdForBiome(biome));
        }
    } else {
        final Iterator<Biome> it = this.toCopy.getIterator();
        if (!it.hasNext())
            throw new IllegalStateException("No biome found to copy!");
        final Biome toCopy = it.next();
        if (it.hasNext())
            LogHelper.warn("More than one biome found to copy! Only the first one will be copied.");
        Constructor<? extends Biome> construct = null;
        try {
            // catches all vanilla biomes
            if (ScriptCommandCreateBiome.extraParameters.containsKey(toCopy.getBiomeClass())) {
                final List<? extends Property<?>> props = ScriptCommandCreateBiome.extraParameters.get(toCopy.getBiomeClass());
                final Class<?>[] types = new Class<?>[props.size() + 1];
                for (int i = 0; i < props.size(); i++) types[i] = Primitives.unwrap(props.get(i).getTypeClass());
                types[types.length - 1] = BiomeProperties.class;
                construct = toCopy.getBiomeClass().getConstructor(types);
            } else
                construct = toCopy.getBiomeClass().getConstructor(BiomeProperties.class);
        } catch (final Exception e) {
            try {
                // Catches most BOP biomes
                construct = toCopy.getBiomeClass().getConstructor();
            } catch (final Exception e1) {
            }
        }
        Biome biome;
        if (construct == null) {
            LogHelper.warn("Unable to copy biome class " + toCopy.getBiomeClass().getCanonicalName() + "! Some functionality may not be copied!");
            biome = new BiomeTweakerBiome(new BiomeProperties("BiomeTweaker Biome").setBaseHeight(0.125F).setHeightVariation(0.05F).setTemperature(0.8F).setRainfall(0.4F));
        } else
            switch(construct.getParameterCount()) {
                case 0:
                    biome = construct.newInstance();
                    break;
                case 1:
                    biome = construct.newInstance(new BiomeProperties(toCopy.getBiomeName()));
                    break;
                default:
                    final List<? extends Property<?>> props = ScriptCommandCreateBiome.extraParameters.get(toCopy.getBiomeClass());
                    final Object[] objs = new Object[props.size() + 1];
                    for (int i = 0; i < props.size(); i++) objs[i] = props.get(i).get(toCopy);
                    objs[objs.length - 1] = new BiomeProperties(toCopy.getBiomeName());
                    biome = construct.newInstance(objs);
                    break;
            }
        if (MinecraftForge.EVENT_BUS.post(new BiomeTweakEvent.Create(this, biome)))
            return;
        biome.setRegistryName(ModData.MOD_ID, this.rLoc.toLowerCase());
        RegistryEventHandler.registry.register(biome);
        // Copy props
        for (final Property<?> prop : BiomePropertyManager.getAllProperties()) if (prop.isCopyable())
            prop.copy(toCopy, biome);
        // Copy dict types
        if (BiomeDictionary.hasAnyType(toCopy))
            BiomeDictionary.addTypes(biome, BiomeDictionary.getTypes(toCopy).toArray(new BiomeDictionary.Type[0]));
        // Copy spawns
        for (final EnumCreatureType type : EnumCreatureType.values()) {
            final List<SpawnListEntry> entries = biome.getSpawnableList(type);
            entries.clear();
            entries.addAll(toCopy.getSpawnableList(type));
        }
        BiomeTweaker.getInstance().onTweak(Biome.getIdForBiome(biome));
    }
}
Also used : BiomeTweakEvent(me.superckl.api.biometweaker.event.BiomeTweakEvent) EnumCreatureType(net.minecraft.entity.EnumCreatureType) BiomeProperties(net.minecraft.world.biome.Biome.BiomeProperties) SpawnListEntry(net.minecraft.world.biome.Biome.SpawnListEntry) BiomeTweakerBiome(me.superckl.biometweaker.common.world.biome.BiomeTweakerBiome) Biome(net.minecraft.world.biome.Biome) BiomeTweakerBiome(me.superckl.biometweaker.common.world.biome.BiomeTweakerBiome) BiomeDictionary(net.minecraftforge.common.BiomeDictionary) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) Property(me.superckl.api.biometweaker.property.Property)

Example 3 with BiomeProperties

use of net.minecraft.world.biome.Biome.BiomeProperties in project Minestuck by mraof.

the class ChunkProviderLands method createBiomeGen.

public void createBiomeGen() {
    BiomeProperties properties = new BiomeProperties(((WorldProviderLands) this.landWorld.provider).getDimensionName()).setTemperature(temperature).setRainfall(rainfall).setBaseBiome("medium");
    if (temperature <= 0.1)
        properties.setSnowEnabled();
    biomeLands = new BiomeMinestuck(properties).setRegistryName("minestuck", "medium");
}
Also used : WorldProviderLands(com.mraof.minestuck.world.WorldProviderLands) BiomeProperties(net.minecraft.world.biome.Biome.BiomeProperties) BiomeMinestuck(com.mraof.minestuck.world.biome.BiomeMinestuck)

Aggregations

BiomeProperties (net.minecraft.world.biome.Biome.BiomeProperties)3 ImmutableList (com.google.common.collect.ImmutableList)1 WorldProviderLands (com.mraof.minestuck.world.WorldProviderLands)1 BiomeMinestuck (com.mraof.minestuck.world.biome.BiomeMinestuck)1 List (java.util.List)1 BiomeTweakEvent (me.superckl.api.biometweaker.event.BiomeTweakEvent)1 Property (me.superckl.api.biometweaker.property.Property)1 BiomeTweakerBiome (me.superckl.biometweaker.common.world.biome.BiomeTweakerBiome)1 EnumCreatureType (net.minecraft.entity.EnumCreatureType)1 Biome (net.minecraft.world.biome.Biome)1 SpawnListEntry (net.minecraft.world.biome.Biome.SpawnListEntry)1 BiomeDictionary (net.minecraftforge.common.BiomeDictionary)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1