2013-05-03 13:00:44 +00:00
|
|
|
package biomesoplenty;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.io.OutputStream;
|
|
|
|
import java.util.logging.Level;
|
|
|
|
|
|
|
|
import net.minecraft.client.Minecraft;
|
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
|
|
import net.minecraftforge.common.DimensionManager;
|
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
|
|
|
import biomesoplenty.configuration.BOPBiomes;
|
|
|
|
import biomesoplenty.configuration.BOPBlocks;
|
|
|
|
import biomesoplenty.configuration.BOPConfiguration;
|
|
|
|
import biomesoplenty.configuration.BOPCrafting;
|
|
|
|
import biomesoplenty.configuration.BOPEntities;
|
|
|
|
import biomesoplenty.configuration.BOPItems;
|
2013-05-25 02:33:57 +00:00
|
|
|
import biomesoplenty.configuration.BOPLiquids;
|
2013-05-25 08:57:21 +00:00
|
|
|
import biomesoplenty.configuration.BOPPotions;
|
2013-05-03 13:00:44 +00:00
|
|
|
import biomesoplenty.configuration.BOPVanillaCompat;
|
|
|
|
import biomesoplenty.helpers.AchievementHelper;
|
2013-05-10 07:12:56 +00:00
|
|
|
import biomesoplenty.helpers.BOPCraft;
|
2013-05-25 08:57:21 +00:00
|
|
|
import biomesoplenty.helpers.BOPLiquidHelper;
|
2013-05-03 13:00:44 +00:00
|
|
|
import biomesoplenty.helpers.BonemealUse;
|
|
|
|
import biomesoplenty.helpers.CreativeTabsBOP;
|
2013-05-11 11:19:28 +00:00
|
|
|
import biomesoplenty.helpers.EntitiesHelper;
|
2013-06-09 00:39:12 +00:00
|
|
|
import biomesoplenty.helpers.Localizations;
|
2013-05-03 13:00:44 +00:00
|
|
|
import biomesoplenty.integration.BOPCrossIntegration;
|
2013-05-18 15:06:30 +00:00
|
|
|
import biomesoplenty.world.WorldProviderBOPhell;
|
2013-05-07 18:08:35 +00:00
|
|
|
import biomesoplenty.world.WorldProviderPromised;
|
|
|
|
import biomesoplenty.world.WorldTypeSize;
|
2013-05-03 13:00:44 +00:00
|
|
|
import cpw.mods.fml.common.FMLCommonHandler;
|
2013-06-01 13:36:09 +00:00
|
|
|
import cpw.mods.fml.common.Loader;
|
2013-05-03 13:00:44 +00:00
|
|
|
import cpw.mods.fml.common.Mod;
|
|
|
|
import cpw.mods.fml.common.Mod.Init;
|
|
|
|
import cpw.mods.fml.common.Mod.Instance;
|
2013-05-06 07:11:55 +00:00
|
|
|
import cpw.mods.fml.common.Mod.PostInit;
|
2013-05-03 13:00:44 +00:00
|
|
|
import cpw.mods.fml.common.Mod.PreInit;
|
|
|
|
import cpw.mods.fml.common.SidedProxy;
|
|
|
|
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
|
|
|
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
|
|
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|
|
|
import cpw.mods.fml.common.network.NetworkMod;
|
2013-05-10 07:12:56 +00:00
|
|
|
import cpw.mods.fml.common.registry.GameRegistry;
|
2013-05-03 13:00:44 +00:00
|
|
|
import cpw.mods.fml.common.registry.LanguageRegistry;
|
|
|
|
|
2013-06-04 07:44:47 +00:00
|
|
|
@Mod(modid="BiomesOPlenty", name="Biomes O' Plenty", version="0.5.5", dependencies="after:Natura")
|
2013-05-03 13:00:44 +00:00
|
|
|
@NetworkMod(clientSideRequired=true, serverSideRequired=false)
|
|
|
|
public class BiomesOPlenty
|
2013-05-31 10:34:02 +00:00
|
|
|
{
|
2013-05-03 13:00:44 +00:00
|
|
|
@Instance("BiomesOPlenty")
|
|
|
|
public static BiomesOPlenty instance;
|
|
|
|
|
|
|
|
@SidedProxy(clientSide="biomesoplenty.ClientProxy", serverSide="biomesoplenty.CommonProxy")
|
|
|
|
public static CommonProxy proxy;
|
|
|
|
|
|
|
|
public static CreativeTabs tabBiomesOPlenty;
|
|
|
|
|
|
|
|
@PreInit
|
|
|
|
public void preInit(FMLPreInitializationEvent event)
|
|
|
|
{
|
|
|
|
boolean isClient = proxy instanceof ClientProxy;
|
2013-05-06 07:11:55 +00:00
|
|
|
|
2013-05-03 13:00:44 +00:00
|
|
|
String[] soundFiles = { "bopdisc.ogg", "bopdiscmud.ogg"};
|
2013-05-06 07:11:55 +00:00
|
|
|
|
2013-05-03 13:00:44 +00:00
|
|
|
if (isClient)
|
|
|
|
{
|
2013-05-31 10:34:02 +00:00
|
|
|
for (String soundFile : soundFiles) {
|
|
|
|
try
|
|
|
|
{
|
|
|
|
File file = new File(Minecraft.getMinecraftDir().getAbsolutePath() + "/resources/mod/streaming/" + soundFile);
|
|
|
|
if (!file.exists()) {
|
|
|
|
System.out.println("[BiomesOPlenty] " + soundFile + " doesn't exist, creating...");
|
|
|
|
file.getParentFile().mkdirs();
|
|
|
|
file.createNewFile();
|
|
|
|
InputStream istream = getClass().getResourceAsStream("/mods/BiomesOPlenty/audio/" + soundFile);
|
|
|
|
OutputStream out = new FileOutputStream(file);
|
|
|
|
byte[] buf = new byte[1024];
|
|
|
|
int size = 0;
|
|
|
|
int len;
|
|
|
|
while ((len = istream.read(buf)) > 0) {
|
|
|
|
out.write(buf, 0, len);
|
|
|
|
size += len;
|
|
|
|
}
|
|
|
|
out.close();
|
|
|
|
istream.close();
|
|
|
|
if (size == 0) {
|
|
|
|
file.delete();
|
|
|
|
}
|
2013-05-03 13:00:44 +00:00
|
|
|
}
|
|
|
|
}
|
2013-05-31 10:34:02 +00:00
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
FMLCommonHandler.instance().getFMLLogger().log(Level.WARNING, "[BiomesOPlenty] Failed to load sound file: " + soundFile);
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
2013-05-03 13:00:44 +00:00
|
|
|
}
|
|
|
|
}
|
2013-05-06 07:11:55 +00:00
|
|
|
|
2013-05-03 13:00:44 +00:00
|
|
|
BOPConfiguration.init(event.getSuggestedConfigurationFile());
|
2013-05-31 10:34:02 +00:00
|
|
|
|
2013-05-03 13:00:44 +00:00
|
|
|
tabBiomesOPlenty = new CreativeTabsBOP(CreativeTabs.getNextID(),"tabBiomesOPlenty");
|
2013-05-31 10:34:02 +00:00
|
|
|
|
2013-05-25 08:57:21 +00:00
|
|
|
BOPPotions.init();
|
2013-05-06 07:11:55 +00:00
|
|
|
|
2013-05-03 13:00:44 +00:00
|
|
|
BOPBlocks.init();
|
2013-05-06 07:11:55 +00:00
|
|
|
|
2013-05-03 13:00:44 +00:00
|
|
|
BOPItems.init();
|
2013-05-31 10:34:02 +00:00
|
|
|
|
2013-05-25 02:33:57 +00:00
|
|
|
BOPLiquids.init();
|
2013-05-03 13:00:44 +00:00
|
|
|
|
|
|
|
BOPCrafting.init();
|
2013-05-06 07:11:55 +00:00
|
|
|
|
2013-05-03 13:00:44 +00:00
|
|
|
BOPBiomes.init();
|
2013-05-06 07:11:55 +00:00
|
|
|
|
2013-05-03 13:00:44 +00:00
|
|
|
BOPEntities.init();
|
2013-05-06 07:11:55 +00:00
|
|
|
|
2013-05-03 13:00:44 +00:00
|
|
|
BOPVanillaCompat.init();
|
2013-06-09 00:39:12 +00:00
|
|
|
|
|
|
|
Localizations.loadLanguages();
|
2013-05-06 07:11:55 +00:00
|
|
|
|
2013-05-03 13:00:44 +00:00
|
|
|
// Achievement declaration
|
2013-06-08 16:58:16 +00:00
|
|
|
if (BOPConfiguration.achievements)
|
2013-05-06 07:11:55 +00:00
|
|
|
{
|
|
|
|
AchievementHelper.init();
|
|
|
|
}
|
2013-05-31 10:34:02 +00:00
|
|
|
|
2013-05-10 07:12:56 +00:00
|
|
|
GameRegistry.registerCraftingHandler(new BOPCraft());
|
2013-05-03 13:00:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Init
|
|
|
|
public void load(FMLInitializationEvent event)
|
|
|
|
{
|
|
|
|
LanguageRegistry.instance().addStringLocalization("itemGroup.tabBiomesOPlenty", "en_US", "Biomes O\' Plenty");
|
|
|
|
LanguageRegistry.instance().addStringLocalization("generator.BIOMESOP", "en_US", "Biomes O\' Plenty");
|
|
|
|
|
|
|
|
// Add helpers for compatibility
|
|
|
|
MinecraftForge.TERRAIN_GEN_BUS.register(new WorldTypeSize());
|
|
|
|
MinecraftForge.EVENT_BUS.register(new AchievementHelper());
|
|
|
|
MinecraftForge.EVENT_BUS.register(new BonemealUse());
|
2013-05-11 11:19:28 +00:00
|
|
|
MinecraftForge.EVENT_BUS.register(new EntitiesHelper());
|
2013-05-25 08:57:21 +00:00
|
|
|
MinecraftForge.EVENT_BUS.register(new BOPLiquidHelper());
|
2013-05-03 13:00:44 +00:00
|
|
|
|
|
|
|
proxy.registerRenderers();
|
|
|
|
|
2013-06-08 16:58:16 +00:00
|
|
|
if (BOPConfiguration.netherOverride)
|
|
|
|
{
|
|
|
|
DimensionManager.unregisterProviderType(-1);
|
|
|
|
DimensionManager.registerProviderType(-1, WorldProviderBOPhell.class, true);
|
|
|
|
}
|
2013-05-03 13:00:44 +00:00
|
|
|
DimensionManager.registerProviderType(BOPConfiguration.promisedLandDimID, WorldProviderPromised.class, false);
|
|
|
|
DimensionManager.registerDimension(BOPConfiguration.promisedLandDimID, BOPConfiguration.promisedLandDimID);
|
2013-06-04 20:21:06 +00:00
|
|
|
|
|
|
|
BOPCrossIntegration.init();
|
2013-05-03 13:00:44 +00:00
|
|
|
}
|
2013-05-06 07:11:55 +00:00
|
|
|
|
|
|
|
@PostInit
|
2013-05-03 13:00:44 +00:00
|
|
|
public void postInit(FMLPostInitializationEvent event)
|
|
|
|
{
|
2013-06-04 20:21:06 +00:00
|
|
|
BOPCrossIntegration.postInit();
|
2013-05-03 13:00:44 +00:00
|
|
|
}
|
|
|
|
}
|