Jump to content

Recommended Posts

Posted

Hey guys,

 

I'm trying to figure a way to allow the removal of biomes via the config file.

My code so far looks like this:

 

 

package mods.B0bGary.Biomes;

import java.io.File;

import mods.B0bGary.Biomes.core.Reference;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.WorldChunkManager;
import net.minecraftforge.common.config.Configuration;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;

@Mod(modid="BiomeRemover", name="B0bGary's Biome Remover!", version=Reference.VERSION_NUMBER)


public class Base{

public static String version = Reference.VERSION_NUMBER;

@Instance("B0bGary's Biome Remover!")
public static Base instance;

public static String modid = "BiomeRemover";

public boolean doesPlainsSpawn;
public boolean doesDesertSpawn;
public boolean doesExtremeHillsSpawn;
public boolean doesForestSpawn;
public boolean doesTaigaSpawn;
public boolean doesSwampSpawn;
public boolean doesRiverSpawn;
public boolean doesFrozenOceanSpawn;
public boolean doesFrozenRiverSpawn;
public boolean doesIcePlainsSpawn;
public boolean doesIceMountainsSpawn;
public boolean doesMushroomSpawn;
public boolean doesMushroomShoreSpawn;
public boolean doesBeachSpawn;
public boolean doesDesertHillsSpawn;
public boolean doesForestHillsSpawn;
public boolean doesTaigaHillsSpawn;
public boolean doesExtremeHillsEdgeSpawn;
public boolean doesJungleSpawn;
public boolean doesJungleHillsSpawn;

public boolean doesOceanSpawn;
public boolean doesJungleEdgeSpawn;
public boolean doesDeepOceanSpawn;
public boolean doesStoneBeachSpawn;
public boolean doesColdBeachSpawn;
public boolean doesBirchForestSpawn;	
public boolean doesBirchForestHillsSpawn;
public boolean doesRoofedForestSpawn;
public boolean doesColdTaigaSpawn;
public boolean doesColdTaigaHillsSpawn;
public boolean doesMegaTaigaSpawn;
public boolean doesMegaTaigaHillsSpawn;
public boolean doesExtremeHillsPlusSpawn;
public boolean doesSavannaSpawn;
public boolean doesSavannaPlateauSpawn;
public boolean doesMesaSpawn;
public boolean doesMesaPlateau_FSpawn;
public boolean doesMesaPlateauSpawn;




public void initConfiguration(FMLInitializationEvent event){
	Configuration config = new Configuration(new File("config/Biome Remover.cfg"));
	config.load();
	doesPlainsSpawn=config.get("Biomes", "Enable Plains Biome?", true).getBoolean(true);
	doesExtremeHillsSpawn=config.get("Biomes", "Enable Extreme Hills Biome?", true).getBoolean(true);
	doesDesertSpawn=config.get("Biomes", "Enable Desert Biome?", true).getBoolean(true);
	doesForestSpawn=config.get("Biomes", "Enable Forest Biome?", true).getBoolean(true);
	doesTaigaSpawn=config.get("Biomes", "Enable Taiga Biome?", true).getBoolean(true);
	doesSwampSpawn=config.get("Biomes", "Enable Swamp Biome?", true).getBoolean(true);
	doesRiverSpawn=config.get("Biomes", "Enable River Biome?", true).getBoolean(true);
	doesFrozenOceanSpawn=config.get("Biomes", "Enable Frozen Ocean Biome?", true).getBoolean(true);
	doesFrozenRiverSpawn=config.get("Biomes", "Enable Frozen River Biome?", true).getBoolean(true);
	doesIcePlainsSpawn=config.get("Biomes", "Enable Ice Plains Biome?", true).getBoolean(true);
	doesIceMountainsSpawn=config.get("Biomes", "Enable Ice Mountains Biome?", true).getBoolean(true);
	doesMushroomSpawn=config.get("Biomes", "Enable Mushroom Island Biome?", true).getBoolean(true);
	doesMushroomShoreSpawn=config.get("Biomes", "Enable Mushroom Island Shore Biome?", true).getBoolean(true);
	doesBeachSpawn=config.get("Biomes", "Enable Beach Biome?", true).getBoolean(true);
	doesDesertHillsSpawn=config.get("Biomes", "Enable Desert Hills Biome?", true).getBoolean(true);
	doesForestHillsSpawn=config.get("Biomes", "Enable Forest Hills Biome?", true).getBoolean(true);
	doesTaigaHillsSpawn=config.get("Biomes", "Enable Taiga Hills Biome?", true).getBoolean(true);
	doesExtremeHillsEdgeSpawn=config.get("Biomes", "Enable Extreme Hills Edge Biome?", true).getBoolean(true);
	doesJungleSpawn=config.get("Biomes", "Enable Jungle Biome?", true).getBoolean(true);
	doesJungleHillsSpawn=config.get("Biomes", "Enable Jungle Hills Biome?", true).getBoolean(true);

	doesOceanSpawn=config.get("Biomes", "Enable Ocean Biome?", true).getBoolean(true);
	doesJungleEdgeSpawn=config.get("Biomes", "Enable Jungle Edge Biome?", true).getBoolean(true);
	doesDeepOceanSpawn=config.get("Biomes", "Enable Deep Ocean Biome?", true).getBoolean(true);
	doesStoneBeachSpawn=config.get("Biomes", "Enable Stone Beach Biome?", true).getBoolean(true);
	doesColdBeachSpawn=config.get("Biomes", "Enable Cold Beach Biome?", true).getBoolean(true);
	doesBirchForestSpawn=config.get("Biomes", "Enable Birch Forest Biome?", true).getBoolean(true);
	doesBirchForestHillsSpawn=config.get("Biomes", "Enable Birch Forest Hills Biome?", true).getBoolean(true);
	doesRoofedForestSpawn=config.get("Biomes", "Enable Roofed Forest Biome?", true).getBoolean(true);
	doesColdTaigaSpawn=config.get("Biomes", "Enable Cold Taiga Biome?", true).getBoolean(true);
	doesColdTaigaHillsSpawn=config.get("Biomes", "Enable Cold Taiga Hills Biome?", true).getBoolean(true);
	doesMegaTaigaSpawn=config.get("Biomes", "Enable Mega Taiga Biome?", true).getBoolean(true);
	doesMegaTaigaHillsSpawn=config.get("Biomes", "Enable Mega Taiga Hills Biome?", true).getBoolean(true);
	doesExtremeHillsPlusSpawn=config.get("Biomes", "Enable Exteme Hills Plus Biome?", true).getBoolean(true);
	doesSavannaSpawn=config.get("Biomes", "Enable Savanna Biome?", true).getBoolean(true);
	doesSavannaPlateauSpawn=config.get("Biomes", "Enable Savanna Plateau Biome?", true).getBoolean(true);
	doesMesaSpawn=config.get("Biomes", "Enable Mesa Biome?", true).getBoolean(true);
	doesMesaPlateau_FSpawn=config.get("Biomes", "Enable Mesa Plateau F Biome?", true).getBoolean(true);
	doesMesaPlateauSpawn=config.get("Biomes", "Enable Mesa Plateau Biome?", true).getBoolean(true);

	config.save();
}

//Init
    @EventHandler
public void preInit(FMLPreInitializationEvent event){
    	
	//biomes();
}
    
    @EventHandler
public void load(FMLInitializationEvent event) {
    	this.initConfiguration(event);

		biomes();


}
    @EventHandler
public void postInit(FMLPostInitializationEvent event){
    	//biomes();
}


   

public void biomes(){

	WorldChunkManager.allowedBiomes.clear();


	if(doesPlainsSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.plains);
	}
	if(doesDesertSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.desert);
	}
	if(doesExtremeHillsSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.extremeHills);
	}
	if(doesForestSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.forest);
	}
	if(doesTaigaSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.taiga);
	}
	if(doesSwampSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.swampland);
	}
	if(doesRiverSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.river);
	}
	if(doesFrozenOceanSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.frozenOcean);
	}
	if(doesFrozenRiverSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.frozenRiver);
	}
	if(doesIcePlainsSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.icePlains);
	}
	if(doesIceMountainsSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.iceMountains);
	}
	if(doesMushroomSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.mushroomIsland);
	}
	if(doesMushroomShoreSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.mushroomIslandShore);
	}
	if(doesBeachSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.beach);
	}
	if(doesDesertHillsSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.desertHills);
	}
	if(doesForestHillsSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.forestHills);
	}
	if(doesTaigaHillsSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.taigaHills);
	}
	if(doesExtremeHillsEdgeSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.extremeHillsEdge);
	}
	if(doesJungleSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.jungle);
	}
	if(doesJungleHillsSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.jungleHills);
	}

	if(doesOceanSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.ocean);
	}
	if(doesJungleEdgeSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.jungleEdge);
	}
	if(doesDeepOceanSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.deepOcean);
	}
	if(doesStoneBeachSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.stoneBeach);
	}
	if(doesColdBeachSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.coldBeach);
	}
	if(doesBirchForestSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.birchForest);
	}
	if(doesBirchForestHillsSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.birchForestHills);
	}
	if(doesRoofedForestSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.roofedForest);
	}
	if(doesColdTaigaSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.coldTaiga);
	}
	if(doesColdTaigaHillsSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.coldTaigaHills);
	}
	if(doesMegaTaigaSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.megaTaiga);
	}
	if(doesMegaTaigaHillsSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.megaTaigaHills);
	}
	if(doesExtremeHillsPlusSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.extremeHillsPlus);
	}
	if(doesSavannaSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.savanna);
	}
	if(doesSavannaPlateauSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.savannaPlateau);
	}
	if(doesMesaSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.mesa);
	}
	if(doesMesaPlateau_FSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.mesaPlateau_F);
	}
	if(doesMesaPlateauSpawn){
		WorldChunkManager.allowedBiomes.add(BiomeGenBase.mesaPlateau);
	}



   //  WorldChunkManager.allowedBiomes = new ArrayList<BiomeGenBase>(Arrays.asList(forestHills, _myBiome));
}



     
/*

private static void removeBiome(BiomeGenBase biome){
	List<BiomeEntry> biomesw = BiomeManager.warmBiomes;

	Iterator<BiomeEntry> checkw = biomesw.iterator();


	while (checkw.hasNext()){
		BiomeGenBase checkBiome = checkw.next().biome;
		if (checkBiome == biome){
			checkw.remove();
		}
	}
	List<BiomeEntry> biomesc = BiomeManager.coolBiomes;

	Iterator<BiomeEntry> checkc = biomesc.iterator();


	while (checkc.hasNext()){
		BiomeGenBase checkBiome = checkc.next().biome;
		if (checkBiome == biome){
			checkc.remove();
		}
	}
	List<BiomeEntry> biomesi = BiomeManager.icyBiomes;

	Iterator<BiomeEntry> checki = biomesi.iterator();


	while (checki.hasNext()){
		BiomeGenBase checkBiome = checki.next().biome;
		if (checkBiome == biome){
			checki.remove();
		}
	}
	/*
	List<BiomeEntry> biomesd = BiomeManager.desertBiomes;

			Iterator<BiomeEntry> checkd = biomesd.iterator();


			while (checkd.hasNext()){
				BiomeGenBase checkBiome = checkd.next().biome;
				if (checkBiome == biome){
					checkd.remove();
				}
			}
			*/


}

 

 

 

I've tried several variations, but the biomes still spawn.

Any help is greatly appreciated!

Thanks!

  • 2 weeks later...
Posted

Well, originally I had this:

 

 

private static void removeBiome(BiomeGenBase biome){
	List<BiomeEntry> biomesw = BiomeManager.warmBiomes;

	Iterator<BiomeEntry> checkw = biomesw.iterator();


	while (checkw.hasNext()){
		BiomeGenBase checkBiome = checkw.next().biome;
		if (checkBiome == biome){
			checkw.remove();
		}
	}
	List<BiomeEntry> biomesc = BiomeManager.coolBiomes;

	Iterator<BiomeEntry> checkc = biomesc.iterator();


	while (checkc.hasNext()){
		BiomeGenBase checkBiome = checkc.next().biome;
		if (checkBiome == biome){
			checkc.remove();
		}
	}
	List<BiomeEntry> biomesi = BiomeManager.icyBiomes;

	Iterator<BiomeEntry> checki = biomesi.iterator();


	while (checki.hasNext()){
		BiomeGenBase checkBiome = checki.next().biome;
		if (checkBiome == biome){
			checki.remove();
		}
	}

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.