mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-25 22:44:23 +00:00
Merge pull request #166 from progwml6/master
adding dimension blacklist for slime islands, including support for twilight forest via its configs, and other dimensions via TiC config
This commit is contained in:
commit
48929c1bb0
5 files changed
+82
-4
No files matched your search
@@ -4,6 +4,8 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import tconstruct.client.event.EventCloakRender;
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.common.TProxyCommon;
|
||||
import tconstruct.compat.Tforest;
|
||||
import tconstruct.compat.dimensions.dimblacklist;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.Detailing;
|
||||
import tconstruct.library.crafting.LiquidCasting;
|
||||
@@ -73,7 +75,8 @@ public class TConstruct
|
||||
@EventHandler
|
||||
public void preInit (FMLPreInitializationEvent event)
|
||||
{
|
||||
PHConstruct.initProps(event.getModConfigurationDirectory());
|
||||
|
||||
PHConstruct.initProps(event.getModConfigurationDirectory());
|
||||
TConstructRegistry.materialTab = new TabTools("TConstructMaterials");
|
||||
TConstructRegistry.toolTab = new TabTools("TConstructTools");
|
||||
TConstructRegistry.blockTab = new TabTools("TConstructBlocks");
|
||||
@@ -136,6 +139,8 @@ public class TConstruct
|
||||
TContent.modRecipes();
|
||||
content.createEntities();
|
||||
content.modRecipes();
|
||||
Tforest.initProps(PHConstruct.cfglocation);
|
||||
dimblacklist.getbaddimensions();
|
||||
}
|
||||
|
||||
public static LiquidCasting getTableCasting ()
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package tconstruct.compat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraftforge.common.Configuration;
|
||||
|
||||
public class Tforest {
|
||||
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 file = new File(TConstruct.proxy.getLocation() + "/config");
|
||||
//file.mkdir();
|
||||
//File newFile = new File(TConstruct.proxy.getLocation() + "/config/TinkersWorkshop.txt");
|
||||
|
||||
File newFile = new File(location + "/TwilightForest.cfg");
|
||||
if( newFile.exists()){
|
||||
|
||||
/* [Forge] Configuration class, used as config method */
|
||||
Configuration config = new Configuration(newFile);
|
||||
|
||||
/* Load the configuration file */
|
||||
config.load();
|
||||
|
||||
tfdimid = config.get("Dimension", "DimensionID", true).getInt();
|
||||
}
|
||||
else {
|
||||
tfdimid = -100;
|
||||
}
|
||||
}
|
||||
public static int tfdimid;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package tconstruct.compat.dimensions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import tconstruct.compat.Tforest;
|
||||
import tconstruct.util.PHConstruct;
|
||||
|
||||
public class dimblacklist {
|
||||
public static ArrayList<Integer> blacklist = new ArrayList<Integer>();
|
||||
public static void getbaddimensions(){
|
||||
blacklist.add(1);
|
||||
if (Tforest.tfdimid != -100){
|
||||
blacklist.add(Tforest.tfdimid);
|
||||
}
|
||||
if(PHConstruct.cfgDimBlackList.length > 0){
|
||||
for (int numdim = 0; numdim< PHConstruct.cfgDimBlackList.length; numdim ++){
|
||||
blacklist.add(PHConstruct.cfgDimBlackList[numdim]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public static boolean isDimInBlacklist(int dim){
|
||||
if (dim<0)
|
||||
return false;
|
||||
for (int len = 0;len< blacklist.size(); len++){
|
||||
if (blacklist.get(len) == dim)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public class PHConstruct
|
||||
|
||||
/* [Forge] Configuration class, used as config method */
|
||||
Configuration config = new Configuration(newFile);
|
||||
|
||||
cfglocation = location;
|
||||
/* Load the configuration file */
|
||||
config.load();
|
||||
|
||||
@@ -356,7 +356,8 @@ public class PHConstruct
|
||||
Property conTexMode = config.get("Looks", "Connected Textures Enabled", true);
|
||||
conTexMode.comment = "0 = disabled, 1 = enabled, 2 = enabled + ignore stained glass meta";
|
||||
connectedTexturesMode = conTexMode.getInt(2);
|
||||
|
||||
//dimension blacklist
|
||||
cfgDimBlackList = config.get("DimBlackList", "SlimeIslandDimBlacklist",new int[]{}).getIntList();
|
||||
/* Save the configuration file */
|
||||
config.save();
|
||||
|
||||
@@ -673,4 +674,7 @@ public class PHConstruct
|
||||
|
||||
//Looks
|
||||
public static int connectedTexturesMode;
|
||||
public static File cfglocation;
|
||||
//dimensionblacklist
|
||||
public static int[] cfgDimBlackList;
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import tconstruct.common.TContent;
|
||||
import tconstruct.compat.dimensions.dimblacklist;
|
||||
import tconstruct.util.PHConstruct;
|
||||
import cpw.mods.fml.common.IWorldGenerator;
|
||||
|
||||
@@ -32,7 +33,7 @@ public class SlimeIslandGen extends WorldGenerator implements IWorldGenerator
|
||||
@Override
|
||||
public void generate (Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) //IWorldGenerator version
|
||||
{
|
||||
if (world.provider.dimensionId == 0 || world.provider.dimensionId >= 2)
|
||||
if (!dimblacklist.isDimInBlacklist(world.provider.dimensionId))
|
||||
{
|
||||
if (random.nextInt(PHConstruct.islandRarity) == 0)
|
||||
generateIsland(world, random, chunkX * 16, chunkZ * 16);
|
||||
|
||||
Reference in new issue
Block a user