mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-25 14:34:22 +00:00
Cleanup dimension blacklist.
This commit is contained in:
1 parent
e46e57c9ca
commit
f77f89e208
4 files changed
+63
-91
No files matched your search
@@ -144,9 +144,7 @@ public class TConstruct
|
||||
MinecraftForge.EVENT_BUS.register(new EventCloakRender());
|
||||
}
|
||||
|
||||
TwilightForestConfig.initProps(PHConstruct.cfglocation);
|
||||
BOPConfig.initProps(PHConstruct.cfglocation);
|
||||
DimensionBlacklist.getbaddimensions();
|
||||
DimensionBlacklist.getBadBimensions();
|
||||
GameRegistry.registerWorldGenerator(new SlimeIslandGen(TRepo.slimePool.blockID, 0));
|
||||
|
||||
PluginController.getController().init();
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
package tconstruct.util.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import tconstruct.TConstruct;
|
||||
|
||||
public class BOPConfig
|
||||
{
|
||||
public static void initProps (File location)
|
||||
{
|
||||
/* Here we will set up the config file for the mod
|
||||
* First: Create a folder inside the config folder
|
||||
* Second: Create the actual config file
|
||||
* Note: Configs are a pain, but absolutely necessary for every mod.
|
||||
*/
|
||||
|
||||
File newFile = new File(location + "/biomesoplenty/ids.cfg");
|
||||
if (newFile.exists())
|
||||
{
|
||||
|
||||
/* [Forge] Configuration class, used as config method */
|
||||
Configuration config = new Configuration(newFile);
|
||||
|
||||
/* Load the configuration file */
|
||||
config.load();
|
||||
|
||||
promisedLandDimensionID = config.get("dimension settings", "Promised Land Dimension ID", -200).getInt();
|
||||
TConstruct.logger.info("PL Dim ID: " + promisedLandDimensionID);
|
||||
}
|
||||
else
|
||||
{
|
||||
promisedLandDimensionID = -100;
|
||||
}
|
||||
}
|
||||
|
||||
public static int promisedLandDimensionID;
|
||||
}
|
||||
@@ -1,29 +1,39 @@
|
||||
package tconstruct.util.config;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import tconstruct.TConstruct;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class DimensionBlacklist
|
||||
{
|
||||
public static ArrayList<Integer> blacklist = new ArrayList<Integer>();
|
||||
public static ArrayList<Integer> nopool = new ArrayList<Integer>();
|
||||
public static ArrayList<Integer> blacklistedDims = new ArrayList<Integer>();
|
||||
public static ArrayList<Integer> noPoolDims = new ArrayList<Integer>();
|
||||
|
||||
public static void getbaddimensions ()
|
||||
public static int promisedLandDimensionID = -100;
|
||||
public static int twilightForestDimensionID = -100;
|
||||
|
||||
public static void getBadBimensions()
|
||||
{
|
||||
blacklist.add(1);
|
||||
if (TwilightForestConfig.twilightForestDimensionID != -100)
|
||||
updateModDimIDs();
|
||||
|
||||
blacklistedDims.add(1);
|
||||
if (twilightForestDimensionID != -100)
|
||||
{
|
||||
blacklist.add(TwilightForestConfig.twilightForestDimensionID);
|
||||
blacklistedDims.add(twilightForestDimensionID);
|
||||
}
|
||||
if (PHConstruct.cfgDimBlackList.length > 0)
|
||||
{
|
||||
for (int numdim = 0; numdim < PHConstruct.cfgDimBlackList.length; numdim++)
|
||||
{
|
||||
blacklist.add(PHConstruct.cfgDimBlackList[numdim]);
|
||||
blacklistedDims.add(PHConstruct.cfgDimBlackList[numdim]);
|
||||
}
|
||||
}
|
||||
if (BOPConfig.promisedLandDimensionID != -100)
|
||||
if (promisedLandDimensionID != -100)
|
||||
{
|
||||
nopool.add(BOPConfig.promisedLandDimensionID);
|
||||
noPoolDims.add(promisedLandDimensionID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,15 +43,14 @@ public class DimensionBlacklist
|
||||
return false;
|
||||
if (dim == 0)
|
||||
return PHConstruct.slimeIslGenDim0;
|
||||
if (PHConstruct.slimeIslGenDim0Only && dim != 0)
|
||||
if (PHConstruct.slimeIslGenDim0Only)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int len = 0; len < blacklist.size(); len++)
|
||||
for (int len = 0; len < blacklistedDims.size(); len++)
|
||||
{
|
||||
if (blacklist.get(len) == dim)
|
||||
if (blacklistedDims.get(len) == dim)
|
||||
return false;
|
||||
//TConstruct.logger.info("diminblist +" + blacklist.get(len));
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -49,13 +58,45 @@ public class DimensionBlacklist
|
||||
|
||||
public static boolean isDimNoPool (int dim)
|
||||
{
|
||||
for (int len = 0; len < nopool.size(); len++)
|
||||
{
|
||||
if (nopool.get(len) == dim)
|
||||
//TConstruct.logger.info("DimNoPool "+ nopool.get(len));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
return noPoolDims.contains(dim);
|
||||
}
|
||||
|
||||
private static void updateModDimIDs()
|
||||
{
|
||||
updateTwiForestID();
|
||||
updateBoPID();
|
||||
}
|
||||
|
||||
private static void updateTwiForestID()
|
||||
{
|
||||
String location = Loader.instance().getConfigDir().getPath();
|
||||
File newFile = new File(location + File.separator + "TwilightForest.cfg");
|
||||
if (newFile.exists())
|
||||
{
|
||||
Configuration config = new Configuration(newFile);
|
||||
|
||||
config.load();
|
||||
|
||||
twilightForestDimensionID = config.get("dimension", "dimensionID", -100).getInt();
|
||||
TConstruct.logger.fine("Twilight Forest Dim ID: " + twilightForestDimensionID);
|
||||
}
|
||||
else twilightForestDimensionID = -100;
|
||||
}
|
||||
|
||||
private static void updateBoPID()
|
||||
{
|
||||
String location = Loader.instance().getConfigDir().getPath();
|
||||
File newFile = new File(location + File.separator + "biomesoplenty" + File.separator + "ids.cfg");
|
||||
if (newFile.exists())
|
||||
{
|
||||
Configuration config = new Configuration(newFile);
|
||||
|
||||
config.load();
|
||||
|
||||
promisedLandDimensionID = config.get("dimension settings", "Promised Land Dimension ID", -200).getInt();
|
||||
TConstruct.logger.fine("Promised Lands Dim ID: " + promisedLandDimensionID);
|
||||
}
|
||||
else promisedLandDimensionID = -100;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package tconstruct.util.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import tconstruct.TConstruct;
|
||||
|
||||
public class TwilightForestConfig
|
||||
{
|
||||
public static void initProps (File location)
|
||||
{
|
||||
File newFile = new File(location + "/TwilightForest.cfg");
|
||||
if (newFile.exists())
|
||||
{
|
||||
Configuration config = new Configuration(newFile);
|
||||
|
||||
config.load();
|
||||
|
||||
twilightForestDimensionID = config.get("dimension", "dimensionID", -100).getInt();
|
||||
TConstruct.logger.info("TF Dim ID: " + twilightForestDimensionID);
|
||||
}
|
||||
else
|
||||
{
|
||||
twilightForestDimensionID = -100;
|
||||
}
|
||||
}
|
||||
|
||||
public static int twilightForestDimensionID;
|
||||
}
|
||||
Reference in new issue
Block a user