-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForgeBiosphere.java
More file actions
58 lines (52 loc) · 1.85 KB
/
Copy pathForgeBiosphere.java
File metadata and controls
58 lines (52 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package forgebiosphere;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.world.WorldType;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.MinecraftForge;
@Mod(modid = ForgeBiosphere.modid, name = ForgeBiosphere.modid, version = "1.7.10.1")
public class ForgeBiosphere {
public static final String modid = "forgebiosphere";
public static WorldType worldTypeBiosphere;
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
Config.preInit(event.getSuggestedConfigurationFile());
}
@EventHandler
public void init(FMLInitializationEvent event) {
LanguageRegistry.instance().addStringLocalization("generator.biosphere", "Biospheres");
worldTypeBiosphere = new WorldTypeBiosphere("biosphere");
MinecraftForge.EVENT_BUS.register(new PopulateChunkEventHandler());
MinecraftForge.EVENT_BUS.register(new ChunkProviderEventHandler());
for (String s : Config.BIOMES_LIST.split(",")) {
if (s == null || s.trim().isEmpty()) {
continue;
}
String[] pair = s.trim().split(":");
if (pair.length != 2) {
continue;
}
try {
int biomeID = Integer.parseInt(pair[0]);
int rarity = Integer.parseInt(pair[1]);
BiosphereBiomeManager.addWeightedRandomBiome(biomeID, rarity);
} catch (NumberFormatException e) {
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
if (biome == null) {
continue;
}
if (pair[0].equalsIgnoreCase(biome.biomeName)) {
try {
int rarity = Integer.parseInt(pair[1]);
BiosphereBiomeManager.addWeightedRandomBiome(biome.biomeID, rarity);
} catch (NumberFormatException e2) {
}
}
}
}
}
}
}