Resources now only install client-side, added the workaround for the level-type BIOMESOP being broken in SMP

This commit is contained in:
Adubbz 2013-04-06 19:34:17 +11:00
parent bd18ea4a78
commit 872b13a632
2 changed files with 41 additions and 24 deletions

View File

@ -6,6 +6,9 @@ import static net.minecraftforge.common.Configuration.CATEGORY_GENERAL;
import java.io.File;
import java.util.logging.Level;
import tdwp_ftw.biomesop.ClientProxy;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import net.minecraftforge.common.Configuration;
import cpw.mods.fml.common.FMLLog;
@ -415,6 +418,8 @@ public class BOPConfiguration {
public static void init(File configFile)
{
boolean isClient = mod_BiomesOPlenty.proxy instanceof ClientProxy;
config = new Configuration(configFile);
try
@ -424,9 +429,17 @@ public class BOPConfiguration {
skyColors = true;
biomeSize = config.get("Biome Settings", "Biome Size", 4, null).getInt();
achievements = config.get("Achievement Settings", "Add Biomes O Plenty Achievemnets (Currently Broken)", false).getBoolean(false);
addToDefault = config.get("Biome Settings", "Add Biomes To Default World", false).getBoolean(false);
vanillaEnhanced = config.get("Biome Settings", "Enhanced Vanilla Biomes", true).getBoolean(false);
promisedLandDimID = config.get("Dimension Settings", "Promised Land Dimension ID", 20, null).getInt();
if (!isClient)
{
addToDefault = config.get("Biome Settings", "Add Biomes To Default World", true).getBoolean(true);
}
else
{
addToDefault = config.get("Biome Settings", "Add Biomes To Default World", false).getBoolean(false);
}
alpsGen = config.get("Biomes To Generate", "Alps", true).getBoolean(false);
arcticGen = config.get("Biomes To Generate", "Arctic", true).getBoolean(false);

View File

@ -74,34 +74,38 @@ public class mod_BiomesOPlenty
@PreInit
public void preInit(FMLPreInitializationEvent event)
{
boolean isClient = proxy instanceof ClientProxy;
String[] soundFiles = { "bopdisc.ogg", "bopdiscmud.ogg"};
for (String soundFile : soundFiles) try
if (isClient)
{
File file = new File("resources/mod/streaming/" + soundFile);
if (!file.exists()) {
System.out.println("[BoP] " + 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;
for (String soundFile : soundFiles) try
{
File file = new File("resources/mod/streaming/" + soundFile);
if (!file.exists()) {
System.out.println("[BoP] " + 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();
}
out.close();
istream.close();
if (size == 0) file.delete();
}
}
catch (Exception e)
{
FMLCommonHandler.instance().getFMLLogger().log(Level.WARNING, "[BoP] Failed to load sound file: " + soundFile);
e.printStackTrace();
catch (Exception e)
{
FMLCommonHandler.instance().getFMLLogger().log(Level.WARNING, "[BoP] Failed to load sound file: " + soundFile);
e.printStackTrace();
}
}
BOPConfiguration.init(event.getSuggestedConfigurationFile());