More Pollution & bugfixes

This commit is contained in:
Blood-Asp 2016-09-27 02:00:19 +02:00
parent 97d7efcc22
commit 16fb901529
7 changed files with 87 additions and 18 deletions

View file

@ -411,7 +411,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
|| (getCoverIDAtSide((byte) 5) == 0 && worldObj.getPrecipitationHeight(xCoord + 1, zCoord) - 1 < yCoord)) { || (getCoverIDAtSide((byte) 5) == 0 && worldObj.getPrecipitationHeight(xCoord + 1, zCoord) - 1 < yCoord)) {
if (GregTech_API.sMachineRainExplosions && worldObj.isRaining() && getBiome().rainfall > 0) { if (GregTech_API.sMachineRainExplosions && worldObj.isRaining() && getBiome().rainfall > 0) {
if (getRandomNumber(10) == 0) { if (getRandomNumber(10) == 0) {
GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather"); try{GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather");}catch(Exception e){}
doEnergyExplosion(); doEnergyExplosion();
} else setOnFire(); } else setOnFire();
} }
@ -420,7 +420,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
return; return;
} }
if (GregTech_API.sMachineThunderExplosions && worldObj.isThundering() && getBiome().rainfall > 0 && getRandomNumber(3) == 0) { if (GregTech_API.sMachineThunderExplosions && worldObj.isThundering() && getBiome().rainfall > 0 && getRandomNumber(3) == 0) {
GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather"); try{GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather");}catch(Exception e){}
doEnergyExplosion(); doEnergyExplosion();
} }
} }

View file

@ -112,7 +112,7 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
} }
if (mSolderingTool && aPlayer instanceof EntityPlayerMP) { if (mSolderingTool && aPlayer instanceof EntityPlayerMP) {
EntityPlayerMP tPlayer = (EntityPlayerMP) aPlayer; EntityPlayerMP tPlayer = (EntityPlayerMP) aPlayer;
GT_Mod.instance.achievements.issueAchievement(tPlayer, "maintainance"); try{GT_Mod.instance.achievements.issueAchievement(tPlayer, "maintainance");}catch(Exception e){}
} }
} }

View file

@ -238,7 +238,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) { if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) {
if (mOutputItems != null) for (ItemStack tStack : mOutputItems) if (mOutputItems != null) for (ItemStack tStack : mOutputItems)
if (tStack != null) { if (tStack != null) {
GT_Mod.instance.achievements.issueAchivementHatch(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), tStack); try{GT_Mod.instance.achievements.issueAchivementHatch(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), tStack);}catch(Exception e){}
addOutput(tStack); addOutput(tStack);
} }
if (mOutputFluids != null && mOutputFluids.length == 1) { if (mOutputFluids != null && mOutputFluids.length == 1) {

View file

@ -860,10 +860,12 @@ public class GT_Utility {
return false; return false;
} }
} }
ItemStack[] tStack = GT_OreDictUnificator.getStackArray(true, aOutput);
if(tStack==null||(tStack.length>0&&GT_Utility.areStacksEqual(aInput, tStack[0])))return false;
if (tOreName != null) { if (tOreName != null) {
aRecipeList.put(new RecipeInputOreDict(tOreName.toString(), aInput.stackSize), new RecipeOutput(aNBT, GT_OreDictUnificator.getStackArray(true, aOutput))); aRecipeList.put(new RecipeInputOreDict(tOreName.toString(), aInput.stackSize), new RecipeOutput(aNBT, tStack));
} else { } else {
aRecipeList.put(new RecipeInputItemStack(copy(aInput), aInput.stackSize), new RecipeOutput(aNBT, GT_OreDictUnificator.getStackArray(true, aOutput))); aRecipeList.put(new RecipeInputItemStack(copy(aInput), aInput.stackSize), new RecipeOutput(aNBT, tStack));
} }
return true; return true;
} }
@ -1741,7 +1743,7 @@ public class GT_Utility {
tList.add("Oil in Chunk: " + tFluid.amount + " " + tFluid.getLocalizedName()); tList.add("Oil in Chunk: " + tFluid.amount + " " + tFluid.getLocalizedName());
} }
if(aPlayer.capabilities.isCreativeMode){ if(aPlayer.capabilities.isCreativeMode){
ChunkPosition tPos = new ChunkPosition(aX, aY, aZ); ChunkPosition tPos = new ChunkPosition(aX/16, 1, aZ/16);
if(GT_Proxy.chunkData.containsKey(tPos)){ if(GT_Proxy.chunkData.containsKey(tPos)){
int[] tPollution = GT_Proxy.chunkData.get(tPos); int[] tPollution = GT_Proxy.chunkData.get(tPos);
if(tPollution.length>1){ if(tPollution.length>1){

View file

@ -1,28 +1,85 @@
package gregtech.common; package gregtech.common;
import java.util.ArrayList;
import java.util.List;
import gregtech.api.util.GT_Utility;
import net.minecraft.client.Minecraft;
import net.minecraft.world.ChunkPosition; import net.minecraft.world.ChunkPosition;
import net.minecraft.world.WorldManager;
public class GT_Pollution { public class GT_Pollution {
// List<ChunkPosition> list = new ArrayList<ChunkPosition>(chunkData.keySet()); static List<ChunkPosition> tList = null;
static int loops = 1;
public static void onWorldTick(int aTick){ public static void onWorldTick(int aTick){
if(aTick == 0 || (tList==null && GT_Proxy.chunkData!=null)){
tList = new ArrayList<ChunkPosition>(GT_Proxy.chunkData.keySet());
loops = (tList.size()/1200) + 1;
}
if(tList!=null && tList.size() > 0){
int i = 0;
for(; i < loops ; i++){
ChunkPosition tPos = tList.get(0);
tList.remove(0);
if(tPos!=null && GT_Proxy.chunkData.containsKey(tPos)){
int tPollution = GT_Proxy.chunkData.get(tPos)[1];
// System.out.println("process: "+tPos.chunkPosX+" "+tPos.chunkPosZ+" "+tPollution);
//Reduce pollution in chunk
tPollution = (int)(0.99f*tPollution);
tPollution -= 2000;
if(tPollution<=0){tPollution = 0;}else{
//Spread Pollution
if(tPollution>50000){
List<ChunkPosition> tNeighbor = new ArrayList();
tNeighbor.add(new ChunkPosition(tPos.chunkPosX+1, 1, tPos.chunkPosZ+1));
tNeighbor.add(new ChunkPosition(tPos.chunkPosX+1, 1, tPos.chunkPosZ-1));
tNeighbor.add(new ChunkPosition(tPos.chunkPosX-1, 1, tPos.chunkPosZ+1));
tNeighbor.add(new ChunkPosition(tPos.chunkPosX-1, 1, tPos.chunkPosZ-1));
for(ChunkPosition tNPos : tNeighbor){
if(GT_Proxy.chunkData.containsKey(tNPos)){
int tNPol = GT_Proxy.chunkData.get(tNPos)[1];
if(tNPol<tPollution){
int tDiff = tPollution - tNPol;
tDiff = tDiff/10;
tNPol += tDiff;
tPollution -= tDiff;
GT_Proxy.chunkData.get(tNPos)[1] = tNPol;
}
}else{
GT_Utility.getUndergroundOil(Minecraft.getMinecraft().theWorld,tPos.chunkPosX*16,tPos.chunkPosZ*16);
}
}}
int[] tArray = GT_Proxy.chunkData.get(tPos);
tArray[1] = tPollution;
GT_Proxy.chunkData.remove(tPos);
GT_Proxy.chunkData.put(tPos, tArray);
//Create Pollution effects
}
}
}
}
} }
public static void addPollution(ChunkPosition aPos, int aPollution){ public static void addPollution(ChunkPosition aPos, int aPollution){
try{
ChunkPosition tPos = new ChunkPosition(aPos.chunkPosX/16, 1, aPos.chunkPosZ/16);
// System.out.println("add pollution x: "+ tPos.chunkPosX +" z: " + tPos.chunkPosZ +" poll: "+aPollution);
int[] tData = new int[2]; int[] tData = new int[2];
if(GT_Proxy.chunkData.containsKey(aPos)){ if(GT_Proxy.chunkData.containsKey(tPos)){
tData = GT_Proxy.chunkData.get(aPos); tData = GT_Proxy.chunkData.get(tPos);
if(tData.length>1){ if(tData.length>1){
tData[1] += aPollution; tData[1] += aPollution;
} }
GT_Proxy.chunkData.replace(aPos, tData);
}else{ }else{
tData[1] += aPollution; tData[1] += aPollution;
GT_Proxy.chunkData.put(aPos, tData); GT_Proxy.chunkData.put(tPos, tData);
} }
}catch(Exception e){
}
} }
} }

View file

@ -46,7 +46,7 @@ public class GT_MetaTileEntity_DistillationTower
"1x Output Bus (Any bottom layer casing)", "1x Output Bus (Any bottom layer casing)",
"1x Maintenance Hatch (Any casing)", "1x Maintenance Hatch (Any casing)",
"1x Energy Hatch (Any casing)", "1x Energy Hatch (Any casing)",
"Clean Stainless Steel Casings for the rest (26 at least!)"}; "Clean Stainless Steel Casings for the rest (36 at least!)"};
} }
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
@ -174,7 +174,8 @@ public class GT_MetaTileEntity_DistillationTower
for (int i = 0; i < tmpHatches.length; i++) { for (int i = 0; i < tmpHatches.length; i++) {
this.mOutputHatches.add(tmpHatches[i]); this.mOutputHatches.add(tmpHatches[i]);
} }
return tAmount >= 26; if(this.mMaintenanceHatches.size()!=1)return false;
return tAmount >= 36;
} }
public boolean ignoreController(Block tTileEntity) { public boolean ignoreController(Block tTileEntity) {

View file

@ -1740,7 +1740,7 @@ if(Loader.isModLoaded("Railcraft")){
addProcess(tCrop, Materials.Galena, 100); addProcess(tCrop, Materials.Galena, 100);
tCrop = ItemList.Crop_Drop_Aurelia.get(1, new Object[0]); tCrop = ItemList.Crop_Drop_Aurelia.get(1, new Object[0]);
addProcess(tCrop, Materials.Gold, 100); addProcess(tCrop, Materials.Gold, 100);
addProcess(tCrop, Materials.Magnetite, 100); addProcess(tCrop, Materials.Magnetite, Materials.Gold, 100);
// Rare Metals Line // Rare Metals Line
tCrop = ItemList.Crop_Drop_Bauxite.get(1, new Object[0]); tCrop = ItemList.Crop_Drop_Bauxite.get(1, new Object[0]);
@ -1802,6 +1802,15 @@ if(Loader.isModLoaded("Railcraft")){
} }
} }
public void addProcess(ItemStack tCrop, Materials aMaterial, Materials aMaterialOut, int chance){
if(GT_Mod.gregtechproxy.mNerfedCombs){
GT_Values.RA.addChemicalRecipe(GT_Utility.copyAmount(9, tCrop), GT_OreDictUnificator.get(OrePrefixes.crushed, aMaterial, 1), Materials.Water.getFluid(1000), aMaterialOut.mOreByProducts.isEmpty() ? null : aMaterialOut.mOreByProducts.get(0).getMolten(144), GT_OreDictUnificator.get(OrePrefixes.crushedPurified, aMaterialOut, 4), 96, 24);
GT_Values.RA.addAutoclaveRecipe(GT_Utility.copyAmount(16, tCrop), Materials.UUMatter.getFluid(Math.max(1, ((aMaterial.getMass()+9)/10))), GT_OreDictUnificator.get(OrePrefixes.crushedPurified, aMaterial, 1), 10000, (int) (aMaterial.getMass() * 128), 384);
}else{
GT_ModHandler.addExtractionRecipe(tCrop, GT_OreDictUnificator.get(OrePrefixes.dustTiny, aMaterial, 1));
}
}
private void run2(){ private void run2(){
GT_Values.RA.addAssemblylineRecipe(ItemList.Electric_Motor_IV.get(1, new Object(){}),144000,new ItemStack[]{ GT_Values.RA.addAssemblylineRecipe(ItemList.Electric_Motor_IV.get(1, new Object(){}),144000,new ItemStack[]{
GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.NeodymiumMagnetic, 1L), GT_OreDictUnificator.get(OrePrefixes.stickLong, Materials.NeodymiumMagnetic, 1L),