Add new flexible configuration undeground oil
This commit is contained in:
parent
772ec04bf3
commit
901a7d66c1
6 changed files with 240 additions and 114 deletions
|
@ -46,13 +46,13 @@ import net.minecraft.util.WeightedRandomChestContent;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
|
@ -251,22 +251,9 @@ 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", "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);
|
||||
gregtechproxy.mUndergroundOil.getConfig(tMainConfig, "undergroundoil");
|
||||
|
||||
GregTech_API.mOutputRF = GregTech_API.sOPStuff.get(ConfigCategories.general, "OutputRF", true);
|
||||
GregTech_API.mInputRF = GregTech_API.sOPStuff.get(ConfigCategories.general, "InputRF", false);
|
||||
|
@ -816,6 +803,7 @@ public class GT_Mod implements IGT_Mod {
|
|||
}
|
||||
}
|
||||
achievements = new GT_Achievements();
|
||||
|
||||
GT_Log.out.println("GT_Mod: Loading finished, deallocating temporary Init Variables.");
|
||||
GregTech_API.sBeforeGTPreload = null;
|
||||
GregTech_API.sAfterGTPreload = null;
|
||||
|
@ -968,6 +956,7 @@ public class GT_Mod implements IGT_Mod {
|
|||
GT_OreDictUnificator.setStack(tOutput);
|
||||
}
|
||||
}
|
||||
|
||||
GregTech_API.mServerStarted = true;
|
||||
GT_Log.out.println("GT_Mod: ServerStarting-Phase finished!");
|
||||
GT_Log.ore.println("GT_Mod: ServerStarting-Phase finished!");
|
||||
|
|
48
src/main/java/gregtech/api/objects/GT_UO_Dimension.java
Normal file
48
src/main/java/gregtech/api/objects/GT_UO_Dimension.java
Normal file
|
@ -0,0 +1,48 @@
|
|||
package gregtech.api.objects;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
|
||||
import gregtech.api.enums.GT_Values;
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
public class GT_UO_Dimension {
|
||||
|
||||
private BiMap<String, GT_UO_Fluid> fFluids;
|
||||
private int maxChance;
|
||||
public String Dimension;
|
||||
|
||||
public GT_UO_Dimension(ConfigCategory aConfigCategory) {
|
||||
fFluids = HashBiMap.create();
|
||||
Dimension = aConfigCategory.get("Dimension").getString();
|
||||
maxChance = 0;
|
||||
//System.out.println("GT UO "+aConfigCategory.getName()+" Dimension:"+Dimension);
|
||||
for (int i = 0 ; i < aConfigCategory.getChildren().size(); i++) {
|
||||
GT_UO_Fluid fluid = new GT_UO_Fluid((ConfigCategory)aConfigCategory.getChildren().toArray()[i]);
|
||||
fFluids.put(fluid.Registry, fluid);
|
||||
maxChance += fluid.Chance;
|
||||
}
|
||||
}
|
||||
|
||||
public GT_UO_Fluid getRandomFluid (Random aRandom) {
|
||||
int random = aRandom.nextInt(3);
|
||||
random = aRandom.nextInt(1000);
|
||||
int step = 0;
|
||||
for (BiMap.Entry<String, GT_UO_Fluid> fl : fFluids.entrySet()) {
|
||||
int chance = fl.getValue().Chance*1000/maxChance;
|
||||
if (random<=chance) return fl.getValue();
|
||||
//System.out.println("GT UO "+fl.getValue().Registry+" Chance:"+chance+" Random:"+random);
|
||||
random-=chance;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
92
src/main/java/gregtech/api/objects/GT_UO_DimensionList.java
Normal file
92
src/main/java/gregtech/api/objects/GT_UO_DimensionList.java
Normal file
|
@ -0,0 +1,92 @@
|
|||
package gregtech.api.objects;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
|
||||
import gregtech.GT_Mod;
|
||||
import gregtech.api.enums.GT_Values;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
public class GT_UO_DimensionList {
|
||||
|
||||
private Configuration fConfig;
|
||||
private String fCategory;
|
||||
private BiMap<String, GT_UO_Dimension> fDimensionList;
|
||||
|
||||
public int[] BlackList;
|
||||
|
||||
public GT_UO_DimensionList() {
|
||||
fDimensionList = HashBiMap.create();
|
||||
}
|
||||
|
||||
public GT_UO_Dimension GetDimension(int aDimension) {
|
||||
if (fDimensionList.containsKey(Integer.toString(aDimension)))
|
||||
return fDimensionList.get(Integer.toString(aDimension));
|
||||
for (BiMap.Entry <String, GT_UO_Dimension> dl : fDimensionList.entrySet())
|
||||
if (DimensionManager.getProvider(aDimension).getClass().getName().contains(dl.getValue().Dimension))
|
||||
return dl.getValue();
|
||||
return fDimensionList.get("Default");
|
||||
}
|
||||
|
||||
public boolean CheckBlackList(int aDimensionId){
|
||||
try {
|
||||
if (java.util.Arrays.binarySearch(BlackList, aDimensionId) >= 0) return true;
|
||||
else return false;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetConfigValues(String aDimensionName, String aDimension, String aName, String aRegistry, int aMinAmount, int aMaxAmount, int aChance) {
|
||||
String Category = fCategory+"."+aDimensionName;
|
||||
fConfig.get(Category, "Dimension", aDimension, "Dimension ID or Class Name").getString();
|
||||
Category+="."+aName;
|
||||
fConfig.get(Category, "Registry", aRegistry, "Fluid registry").getString();
|
||||
fConfig.get(Category, "MinAmount", aMinAmount, "Min amount (Amount in step)").getInt(aMinAmount);
|
||||
fConfig.get(Category, "MaxAmount", aMaxAmount, "Max amount (Amount in step)").getInt(aMaxAmount);
|
||||
fConfig.get(Category, "Chance", aChance, "Chance generating").getInt(aChance);
|
||||
}
|
||||
|
||||
public void SetDafultValues() {
|
||||
fConfig.setCategoryComment(fCategory+".Default", "Set Default Generating");
|
||||
SetConfigValues("Default", "Default", "gas_natural_gas", "gas_natural_gas", 0, 625, 20);
|
||||
SetConfigValues("Default", "Default", "liquid_light_oil", "liquid_light_oil", 0, 625, 20);
|
||||
SetConfigValues("Default", "Default", "liquid_medium_oil", "liquid_medium_oil", 0, 625, 20);
|
||||
SetConfigValues("Default", "Default", "liquid_heavy_oil", "liquid_heavy_oil", 0, 625, 20);
|
||||
SetConfigValues("Default", "Default", "oil", "oil", 0, 625, 20);
|
||||
|
||||
fConfig.setCategoryComment(fCategory+".Overworld", "Set Overworld Generating");
|
||||
SetConfigValues("Overworld", "0", "gas_natural_gas", "gas_natural_gas", 0, 625, 20);
|
||||
SetConfigValues("Overworld", "0", "liquid_light_oil", "liquid_light_oil", 0, 625, 20);
|
||||
SetConfigValues("Overworld", "0", "liquid_medium_oil", "liquid_medium_oil", 0, 625, 20);
|
||||
SetConfigValues("Overworld", "0", "liquid_heavy_oil", "liquid_heavy_oil", 0, 625, 20);
|
||||
SetConfigValues("Overworld", "0", "oil", "oil", 0, 625, 20);
|
||||
|
||||
fConfig.setCategoryComment(fCategory+".Nether", "Set Nether Generating");
|
||||
SetConfigValues("Nether", "-1", "ic2pahoehoelava", "ic2pahoehoelava", 0, 250, 100);
|
||||
|
||||
fConfig.setCategoryComment(fCategory+".Moon", "Set Moon Generating");
|
||||
SetConfigValues("Moon", "Moon", "molten-cheese", "molten.cheese", 0, 125, 5);
|
||||
SetConfigValues("Moon", "Moon", "helium-3", "helium-3", 0, 375, 95);
|
||||
}
|
||||
|
||||
public void getConfig(Configuration aConfig, String aCategory) {
|
||||
fCategory=aCategory;
|
||||
fConfig = aConfig;
|
||||
if (!fConfig.hasCategory(fCategory))
|
||||
SetDafultValues();
|
||||
|
||||
fConfig.setCategoryComment(fCategory, "Config Undeground Fluids (Delete this Category for regenerate)");
|
||||
int[] BlackList = {1};
|
||||
BlackList = aConfig.get(fCategory, "DimBlackList", BlackList, "Dimension IDs Black List").getIntList();
|
||||
java.util.Arrays.sort(BlackList);
|
||||
|
||||
for (int i = 0 ; i < fConfig.getCategory(fCategory).getChildren().size(); i++) {
|
||||
GT_UO_Dimension Dimension = new GT_UO_Dimension((ConfigCategory)fConfig.getCategory(fCategory).getChildren().toArray()[i]);
|
||||
fDimensionList.put(Dimension.Dimension, Dimension);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
41
src/main/java/gregtech/api/objects/GT_UO_Fluid.java
Normal file
41
src/main/java/gregtech/api/objects/GT_UO_Fluid.java
Normal file
|
@ -0,0 +1,41 @@
|
|||
package gregtech.api.objects;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Random;
|
||||
|
||||
import gregtech.api.enums.GT_Values;
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
public class GT_UO_Fluid {
|
||||
public String Registry;
|
||||
public int MaxAmount;
|
||||
public int MinAmount;
|
||||
public int Chance;
|
||||
|
||||
public GT_UO_Fluid(ConfigCategory aConfigCategory) {
|
||||
Registry = aConfigCategory.get("Registry").getString();;
|
||||
MaxAmount = aConfigCategory.get("MaxAmount").getInt();
|
||||
MinAmount = aConfigCategory.get("MinAmount").getInt();
|
||||
Chance = aConfigCategory.get("Chance").getInt();
|
||||
//System.out.println("GT UO "+aConfigCategory.getName()+" Fluid:"+Registry+" Max:"+MaxAmount+" Min:"+MinAmount+" Chance:"+Chance);
|
||||
}
|
||||
|
||||
public Fluid getFluid(){
|
||||
try {
|
||||
return FluidRegistry.getFluid(this.Registry);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public int getRandomAmount(Random aRandom){
|
||||
int r1 = (int)Math.round(Math.pow((MaxAmount-MinAmount)*500000.d, 0.2));
|
||||
int r2 = (int)Math.floor(Math.pow(MinAmount*500000.d, 0.2));
|
||||
double amount = aRandom.nextInt(r1)+r2+aRandom.nextDouble();
|
||||
return (int) (Math.pow(amount, 5) / 100);
|
||||
}
|
||||
|
||||
}
|
|
@ -18,6 +18,7 @@ import gregtech.api.items.GT_EnergyArmor_Item;
|
|||
import gregtech.api.items.GT_Generic_Item;
|
||||
import gregtech.api.net.GT_Packet_Sound;
|
||||
import gregtech.api.objects.GT_ItemStack;
|
||||
import gregtech.api.objects.GT_UO_Fluid;
|
||||
import gregtech.api.objects.ItemData;
|
||||
import gregtech.api.threads.GT_Runnable_Sound;
|
||||
import gregtech.common.GT_Proxy;
|
||||
|
@ -1523,24 +1524,6 @@ public class GT_Utility {
|
|||
return (int)Math.floor(aValue / aScale);
|
||||
}
|
||||
|
||||
public static boolean getUndergroundOilGenerating(int aDimensionId) {
|
||||
|
||||
//Use settings
|
||||
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
|
||||
|
||||
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:
|
||||
|
@ -1560,64 +1543,56 @@ public class GT_Utility {
|
|||
|
||||
public static FluidStack getUndergroundOil(World aWorld, int aX, int aZ, boolean needConsumeOil) {
|
||||
|
||||
if (!getUndergroundOilGenerating(aWorld.provider.dimensionId))
|
||||
if (GT_Mod.gregtechproxy.mUndergroundOil.CheckBlackList(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);
|
||||
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);
|
||||
int tAmount = 0;
|
||||
int tFluidId = 0;
|
||||
Fluid tFluid = null;
|
||||
switch (oil) {
|
||||
case 0:
|
||||
tFluid = Materials.NatruralGas.mGas;
|
||||
break;
|
||||
case 1:
|
||||
tFluid = Materials.OilLight.mFluid;
|
||||
break;
|
||||
case 2:
|
||||
tFluid = Materials.OilMedium.mFluid;
|
||||
break;
|
||||
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;
|
||||
}
|
||||
int tAmount = (int) (Math.pow(amount, 5) / 100);
|
||||
// System.out.println("Dimension: "+GT_Mod.gregtechproxy.mUndergroundOil.GetDimension(aWorld.provider.dimensionId).Dimension);
|
||||
try {
|
||||
GT_UO_Fluid uoFluid = GT_Mod.gregtechproxy.mUndergroundOil.GetDimension(aWorld.provider.dimensionId).getRandomFluid(tRandom);
|
||||
if (uoFluid != null)
|
||||
{
|
||||
tFluid = uoFluid.getFluid();
|
||||
tAmount = uoFluid.getRandomAmount(tRandom);
|
||||
if (tFluid != null)
|
||||
tFluidId = tFluid.getID();
|
||||
//System.out.println("Fluid: ("+tFluidId+")"+tFluid.getName()+" Amount:"+tAmount);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
tAmount = 0;
|
||||
tFluidId = 0;
|
||||
}
|
||||
|
||||
ChunkPosition tPos = new ChunkPosition(getScaleСoordinates(aX,16), aWorld.provider.dimensionId+1, getScaleСoordinates(aZ,16));
|
||||
int[] tInts = new int[2];
|
||||
int[] tInts = new int[0];
|
||||
if(GT_Proxy.chunkData.containsKey(tPos)){
|
||||
tInts = GT_Proxy.chunkData.get(tPos);
|
||||
if(tInts.length>0){
|
||||
if(tInts[0]>0){tAmount = tInts[0];}
|
||||
}
|
||||
if(tInts.length>2){
|
||||
if(tInts[2]>0&&tInts[2]!=tFluidId)
|
||||
{
|
||||
tFluidId = tInts[2];
|
||||
tFluid = FluidRegistry.getFluid(tFluidId);
|
||||
}
|
||||
}
|
||||
GT_Proxy.chunkData.remove(tPos);
|
||||
}
|
||||
|
||||
if (needConsumeOil && tAmount >= 5000)
|
||||
tAmount = tAmount - 5;
|
||||
|
||||
tInts[0] = tAmount;
|
||||
tInts[2] = tFluidId;
|
||||
GT_Proxy.chunkData.put(tPos, tInts);
|
||||
|
||||
return new FluidStack(tFluid, tAmount);
|
||||
if (tFluid!=null)
|
||||
return new FluidStack(tFluid, tAmount);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getCoordinateScan(ArrayList<String> aList, EntityPlayer aPlayer, World aWorld, int aScanLevel, int aX, int aY, int aZ, int aSide, float aClickX, float aClickY, float aClickZ) {
|
||||
|
@ -2081,7 +2056,6 @@ public class GT_Utility {
|
|||
setBookTitle(aStack, "Raw Prospection Data");
|
||||
|
||||
NBTTagCompound tNBT = GT_Utility.ItemNBT.getNBT(aStack);
|
||||
|
||||
tNBT.setByte("prospection_tier", aTier);
|
||||
tNBT.setString("prospection_pos", "X: " + aX + " Y: " + aY + " Z: " + aZ + " Dim: " + aDim);
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import gregtech.api.items.GT_MetaGenerated_Item;
|
|||
import gregtech.api.items.GT_MetaGenerated_Tool;
|
||||
import gregtech.api.objects.GT_Fluid;
|
||||
import gregtech.api.objects.GT_FluidStack;
|
||||
import gregtech.api.objects.GT_UO_DimensionList;
|
||||
import gregtech.api.objects.ItemData;
|
||||
import gregtech.api.objects.MaterialStack;
|
||||
import gregtech.api.util.*;
|
||||
|
@ -165,11 +166,6 @@ 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; //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;
|
||||
|
@ -184,14 +180,8 @@ 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 = 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 final GT_UO_DimensionList mUndergroundOil = new GT_UO_DimensionList();
|
||||
public int mTicksUntilNextCraftSound = 0;
|
||||
public int[] mUndergroundOilBlackList;
|
||||
public int[] mUndergroundOilWhiteList;
|
||||
public double mMagneticraftBonusOutputPercent = 100.0d;
|
||||
private World mUniverse = null;
|
||||
private final String aTextThermalExpansion = "ThermalExpansion";
|
||||
|
@ -1710,52 +1700,44 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
|
|||
|
||||
@SubscribeEvent
|
||||
public void handleChunkSaveEvent(ChunkDataEvent.Save event)
|
||||
{
|
||||
{
|
||||
ChunkPosition tPos = new ChunkPosition(event.getChunk().xPosition,event.getChunk().worldObj.provider.dimensionId+1,event.getChunk().zPosition);
|
||||
if(chunkData.containsKey(tPos)){
|
||||
int[] tInts = chunkData.get(tPos);
|
||||
if(tInts.length>0){event.getData().setInteger("GTOIL", tInts[0]);}
|
||||
if(tInts.length>1){event.getData().setInteger("GTPOLLUTION", tInts[1]);}}
|
||||
if(tInts.length>1){event.getData().setInteger("GTPOLLUTION", tInts[1]);}
|
||||
if(tInts.length>2){event.getData().setInteger("GTOILFLUID", tInts[2]);}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void handleChunkLoadEvent(ChunkDataEvent.Load event)
|
||||
{
|
||||
int tOil = 0;
|
||||
int tOilFluid = 0;
|
||||
int tPollution = 0;
|
||||
|
||||
ChunkPosition tPos = new ChunkPosition(event.getChunk().xPosition,event.getChunk().worldObj.provider.dimensionId+1,event.getChunk().zPosition);
|
||||
int[] tData = new int[2];
|
||||
int[] tData = new int[0];
|
||||
if(chunkData.containsKey(tPos)){
|
||||
tData = chunkData.get(tPos);
|
||||
chunkData.remove(tPos);
|
||||
}
|
||||
|
||||
if(event.getData().hasKey("GTOIL")){
|
||||
if(tData.length>2){
|
||||
if(tData.length>0)
|
||||
tOil = tData[0];
|
||||
}else{
|
||||
tOil += event.getData().getInteger("GTOIL");
|
||||
}
|
||||
}else{
|
||||
if(tData[0]!=0){
|
||||
tOil = tData[0];
|
||||
}
|
||||
if(tData.length>1)
|
||||
tPollution = tData[1];
|
||||
if(tData.length>2)
|
||||
tOilFluid = tData[2];
|
||||
}
|
||||
|
||||
if(event.getData().hasKey("GTPOLLUTION")){
|
||||
if(tData.length>2){
|
||||
tPollution = tData[1];
|
||||
}else{
|
||||
tPollution += event.getData().getInteger("GTPOLLUTION");
|
||||
}
|
||||
}else{
|
||||
if(tData[1]!=0){
|
||||
tPollution = tData[1];
|
||||
}
|
||||
}
|
||||
if(tOil==0&&event.getData().hasKey("GTOIL"))
|
||||
tOil = event.getData().getInteger("GTOIL");
|
||||
if(tPollution==0&&event.getData().hasKey("GTPOLLUTION"))
|
||||
tPollution = event.getData().getInteger("GTPOLLUTION");
|
||||
if(tOilFluid==0&&event.getData().hasKey("GTOILFLUID"))
|
||||
tOilFluid = event.getData().getInteger("GTOILFLUID");
|
||||
|
||||
chunkData.put(tPos, new int[]{ tOil,tPollution,-1});
|
||||
chunkData.put(tPos, new int[]{tOil,tPollution,tOilFluid});
|
||||
}
|
||||
|
||||
public static class OreDictEventContainer {
|
||||
|
|
Loading…
Reference in a new issue