Add Underground Oil Generating settings in GregTech.cfg

Add supports White and Black List (DIM ID)
Add settings generating for standart Dimension and Galacticraft Dimension - Moon and Mars
Add settings for select type Underground Fluid - for Nether default Pahoehoe Lava, for Moon - Helium 3
Add settings max Amount Generating
For generating oil in other Dimension (Twilight Forest or Mystcraft) use settings - RealDimensionEnable
This commit is contained in:
Maxime Legkiy 2017-02-09 05:38:20 +03:00
parent 6567820a9b
commit 772ec04bf3
3 changed files with 70 additions and 17 deletions

View file

@ -251,9 +251,20 @@ public class GT_Mod implements IGT_Mod {
gregtechproxy.mPollutionPoisonLimit = tMainConfig.get("Pollution", "PoisonLimit", 750000).getInt(750000);
gregtechproxy.mPollutionVegetationLimit = tMainConfig.get("Pollution", "VegetationLimit", 1000000).getInt(1000000);
gregtechproxy.mPollutionSourRainLimit = tMainConfig.get("Pollution", "SourRainLimit", 2000000).getInt(2000000);
gregtechproxy.mUndergroundOilOverworld = tMainConfig.get("UndergroundOil", "EnableOverworld", true).getBoolean(true);
gregtechproxy.mUndergroundOilInRealDimension = tMainConfig.get("UndergroundOil", "EnableInRealDimension", true).getBoolean(true);
gregtechproxy.mUndergroundOilMaxAmount = tMainConfig.get("UndergroundOil", "MaxAmount", 50).getInt(50);
gregtechproxy.mUndergroundOilOverworld = tMainConfig.get("UndergroundOil", "OverworldEnable", true, "Generate Underground Oil on Overworld").getBoolean(true);
gregtechproxy.mUndergroundOilInRealDimension = tMainConfig.get("UndergroundOil", "RealDimensionEnable", true, "Generate Underground Oil on other world (not another Planet)").getBoolean(true);
gregtechproxy.mUndergroundOilNether = tMainConfig.get("UndergroundOil", "NetherEnable", true, "Generate Underground Oil on Nether").getBoolean(true);
gregtechproxy.mUndergroundOilMoon = tMainConfig.get("UndergroundOil", "MoonEnable", true, "Generate Underground Oil on Moon").getBoolean(true);
gregtechproxy.mUndergroundOilMars = tMainConfig.get("UndergroundOil", "MarsEnable", false, "Generate Underground Oil on Mars").getBoolean(false);
gregtechproxy.mUndergroundOilMaxAmount = tMainConfig.get("UndergroundOil", "OverworldMaxAmount", 625, "Max amount on Overworld").getInt(625);
gregtechproxy.mUndergroundOilNetherMaxAmount = tMainConfig.get("UndergroundOil", "NetherMaxAmount", 625, "Max amount on Nether").getInt(625);
gregtechproxy.mUndergroundOilMoonMaxAmount = tMainConfig.get("UndergroundOil", "MoonMaxAmount", 625, "Max amount on Moon").getInt(625);
gregtechproxy.mUndergroundOilNetherResType = tMainConfig.get("UndergroundOil", "NetherResType", 1, "Type of the generated resource on Nether (0 - Oil, 1 - Basalt Lava, 2- He3)", 0, 2).getInt(1);
gregtechproxy.mUndergroundOilMoonResType = tMainConfig.get("UndergroundOil", "MoonResType", 2, "Type of the generated resource on Moon (0 - Oil, 1 - Basalt Lava, 2- He3)", 0, 2).getInt(2);
gregtechproxy.mUndergroundOilBlackList = tMainConfig.get("UndergroundOil", "DimBlackList", new int[0], "Dimension IDs Black List").getIntList();
java.util.Arrays.sort(gregtechproxy.mUndergroundOilBlackList);
gregtechproxy.mUndergroundOilWhiteList = tMainConfig.get("UndergroundOil", "DimWhiteList", new int[0], "Dimension IDs White List").getIntList();
java.util.Arrays.sort(gregtechproxy.mUndergroundOilWhiteList);
gregtechproxy.mExplosionItemDrop = tMainConfig.get("general", "ExplosionItemDrops", false).getBoolean(false);
gregtechproxy.mAddGTRecipesToIC2Machines = tMainConfig.get("general", "AddGTRecipesToIC2Machines", true).getBoolean(true);

View file

@ -1523,19 +1523,36 @@ public class GT_Utility {
return (int)Math.floor(aValue / aScale);
}
public static boolean getUndergroundOilSpawns(int aDimensionId) {
public static boolean getUndergroundOilGenerating(int aDimensionId) {
//Black list
if (DimensionManager.getProvider(aDimensionId).getClass().getName().contains("net.minecraft.world.WorldProviderHell")) return false;
if (DimensionManager.getProvider(aDimensionId).getClass().getName().contains("net.minecraft.world.WorldProviderEnd")) return false;
//Use settings
if (GT_Mod.gregtechproxy.mUndergroundOilOverworld && aDimensionId==0) return true; //Overworld
if (GT_Mod.gregtechproxy.mUndergroundOilInRealDimension && isRealDimension(aDimensionId)) return true; //Other real world
if (java.util.Arrays.binarySearch(GT_Mod.gregtechproxy.mUndergroundOilBlackList, aDimensionId) >= 0) return false; //Use BlackList Settings
if (java.util.Arrays.binarySearch(GT_Mod.gregtechproxy.mUndergroundOilWhiteList, aDimensionId) >= 0) return true; //Use WhiteList Settings
if (aDimensionId == 1) return false; //No bedrock, no oil. End.
if (aDimensionId==0) return GT_Mod.gregtechproxy.mUndergroundOilOverworld; //Overworld
if (aDimensionId == -1) return GT_Mod.gregtechproxy.mUndergroundOilNether; //Nether
if (DimensionManager.getProvider(aDimensionId).getClass().getName().contains("Moon")) return GT_Mod.gregtechproxy.mUndergroundOilMoon; //Moon
if (DimensionManager.getProvider(aDimensionId).getClass().getName().contains("Mars")) return GT_Mod.gregtechproxy.mUndergroundOilMars; //Mars
return false; //If other planets...
if (isRealDimension(aDimensionId)) return GT_Mod.gregtechproxy.mUndergroundOilInRealDimension; //Other real world
return false; //If other planets or worlds...
}
public static int getUndergroundOilType(int aType, int aOil) {
switch (aType) {
case 1:
aOil = 10;
break;
case 2:
aOil = 11;
break;
}
return aOil;
}
public static FluidStack getUndergroundOil(World aWorld, int aX, int aZ) {
return getUndergroundOil(aWorld, aX, aZ, false);
@ -1543,15 +1560,25 @@ public class GT_Utility {
public static FluidStack getUndergroundOil(World aWorld, int aX, int aZ, boolean needConsumeOil) {
if (!getUndergroundOilSpawns(aWorld.provider.dimensionId))
if (!getUndergroundOilGenerating(aWorld.provider.dimensionId))
return null;
Random tRandom = new Random((aWorld.getSeed() + aWorld.provider.dimensionId * 2 + (getScaleСoordinates(aX,96)) + (7 * (getScaleСoordinates(aZ,96)))));
int oil = tRandom.nextInt(3);
double amount = tRandom.nextInt(GT_Mod.gregtechproxy.mUndergroundOilMaxAmount) + tRandom.nextDouble();
oil = tRandom.nextInt(4);
int maxAmount;
if (aWorld.provider.dimensionId == -1){
maxAmount = GT_Mod.gregtechproxy.mUndergroundOilNetherMaxAmount;
oil=getUndergroundOilType(GT_Mod.gregtechproxy.mUndergroundOilNetherResType,oil);
} else if (DimensionManager.getProvider(aWorld.provider.dimensionId).getClass().getName().contains("Moon")){
maxAmount = GT_Mod.gregtechproxy.mUndergroundOilMoonMaxAmount;
oil=getUndergroundOilType(GT_Mod.gregtechproxy.mUndergroundOilMoonResType,oil);
}
else maxAmount = GT_Mod.gregtechproxy.mUndergroundOilMaxAmount;
maxAmount = (int)Math.round(Math.pow(maxAmount*500000.d, 0.2));
double amount = tRandom.nextInt(maxAmount) + tRandom.nextDouble();
// System.out.println("Oil: "+(getScaleСoordinates(aX,96))+" "+(getScaleСoordinates(aX,96))+" "+oil+" "+amount);
// amount = 40;
Fluid tFluid = null;
switch (oil) {
case 0:
@ -1566,6 +1593,12 @@ public class GT_Utility {
case 3:
tFluid = Materials.OilHeavy.mFluid;
break;
case 10:
tFluid = FluidRegistry.getFluid("ic2pahoehoelava");
break;
case 11:
tFluid = Materials.Helium_3.mGas;
break;
default:
tFluid = Materials.Oil.mFluid;
}

View file

@ -165,8 +165,11 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
public boolean mHideUnusedOres = true;
public boolean mHideRecyclingRecipes = true;
public boolean mPollution = true;
public boolean mUndergroundOilOverworld = true;
public boolean mUndergroundOilInRealDimension = true;
public boolean mUndergroundOilOverworld = true; //in DIM 0
public boolean mUndergroundOilInRealDimension = true; //in other
public boolean mUndergroundOilNether = true; //in DIM -1
public boolean mUndergroundOilMoon = true; //in Galacticraft Moon
public boolean mUndergroundOilMars = false; //in Galacticraft Mars
public boolean mExplosionItemDrop = false;
public int mSkeletonsShootGTArrows = 16;
public int mMaxEqualEntitiesAtOneSpot = 3;
@ -181,8 +184,14 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
public int mPollutionPoisonLimit = 750000;
public int mPollutionVegetationLimit = 1000000;
public int mPollutionSourRainLimit = 2000000;
public int mUndergroundOilMaxAmount = 50;
public int mUndergroundOilMaxAmount = 625; //mb in step
public int mUndergroundOilNetherMaxAmount = 625; //mb in step
public int mUndergroundOilNetherResType = 1; //0 - Oil; 1 - basalt lava; 3 - He3
public int mUndergroundOilMoonMaxAmount = 625; //mb in step
public int mUndergroundOilMoonResType = 2; //0 - Oil; 1 - basalt lava; 3 - He3
public int mTicksUntilNextCraftSound = 0;
public int[] mUndergroundOilBlackList;
public int[] mUndergroundOilWhiteList;
public double mMagneticraftBonusOutputPercent = 100.0d;
private World mUniverse = null;
private final String aTextThermalExpansion = "ThermalExpansion";