diff options
| author | Techlone <techlone.mc@gmail.com> | 2017-06-04 21:30:51 +0500 | 
|---|---|---|
| committer | Techlone <techlone.mc@gmail.com> | 2017-06-04 21:30:51 +0500 | 
| commit | dbd2f5800886a36dbe4528aabfb2b30f1e7b0908 (patch) | |
| tree | bb297a5498fe57f75aedf33e4f3f77f8bb89a202 /src/main/java/gregtech | |
| parent | 4f6bdedf963842c74bf1cf59f77ead8ad66b48bc (diff) | |
| parent | 30de32fb07bdc82ec7dc79fd698ba0a1ab6b06f6 (diff) | |
| download | GT5-Unofficial-dbd2f5800886a36dbe4528aabfb2b30f1e7b0908.tar.gz GT5-Unofficial-dbd2f5800886a36dbe4528aabfb2b30f1e7b0908.tar.bz2 GT5-Unofficial-dbd2f5800886a36dbe4528aabfb2b30f1e7b0908.zip | |
Merge branch 'unstable' of https://github.com/Blood-Asp/GT5-Unofficial into unstable
Diffstat (limited to 'src/main/java/gregtech')
48 files changed, 724 insertions, 323 deletions
| diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 7b6c5bafd5..4a4f096331 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -258,6 +258,7 @@ public class GT_Mod implements IGT_Mod {          Calendar now = Calendar.getInstance();
          gregtechproxy.mAprilFool = GregTech_API.sSpecialFile.get(ConfigCategories.general, "AprilFool", now.get(Calendar.MONTH) == Calendar.APRIL && now.get(Calendar.DAY_OF_MONTH) == 1);
          gregtechproxy.mCropNeedBlock = tMainConfig.get("general", "CropNeedBlockBelow", true).getBoolean(true);
 +        gregtechproxy.mAMHInteraction = tMainConfig.get("general", "AllowAutoMaintenanceHatchInteraction", false).getBoolean(false);
          GregTech_API.mOutputRF = GregTech_API.sOPStuff.get(ConfigCategories.general, "OutputRF", true);
          GregTech_API.mInputRF = GregTech_API.sOPStuff.get(ConfigCategories.general, "InputRF", false);
          GregTech_API.mEUtoRF = GregTech_API.sOPStuff.get(ConfigCategories.general, "100EUtoRF", 360);
 diff --git a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java index 64c5072c39..2454392cf7 100644 --- a/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java +++ b/src/main/java/gregtech/api/interfaces/metatileentity/IMetaTileEntity.java @@ -379,6 +379,8 @@ public interface IMetaTileEntity extends ISidedInventory, IFluidTank, IFluidHand      public void onColorChangeClient(byte aColor);      public int getLightOpacity(); +     +    public boolean allowGeneralRedstoneOutput();      public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider); diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java index b62ed4500b..63020684c0 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java @@ -1,8 +1,10 @@  package gregtech.api.interfaces.tileentity;  import cofh.api.energy.IEnergyReceiver; +import gregtech.GT_Mod;  import gregtech.api.GregTech_API;  import gregtech.api.util.GT_Utility; +import gregtech.common.GT_Pollution;  import ic2.api.energy.tile.IEnergySink;  import net.minecraft.init.Blocks;  import net.minecraft.tileentity.TileEntity; @@ -85,6 +87,8 @@ public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAnd                                  GT_Utility.sendSoundToPlayers(tWorld, GregTech_API.sSoundList.get(209), 1.0F, -1, tX, tY, tZ);                                  tWorld.setBlock(tX, tY, tZ, Blocks.air);                                  if (GregTech_API.sMachineExplosions) +                                	if(GT_Mod.gregtechproxy.mPollution) +                                		GT_Pollution.addPollution(tWorld.getChunkFromBlockCoords(tX,tZ), 100000);                                      tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true);                              }                          } diff --git a/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java b/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java index dacc42ccbb..baa5d23b4c 100644 --- a/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java +++ b/src/main/java/gregtech/api/items/GT_MetaGenerated_Tool.java @@ -339,7 +339,7 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements              if (name.equals("gt.metatool.01.170") || name.equals("gt.metatool.01.172") || name.equals("gt.metatool.01.174") || name.equals("gt.metatool.01.176")) {                  aList.add(tOffset + 0, EnumChatFormatting.WHITE + "Durability: " + EnumChatFormatting.GREEN + (tMaxDamage - getToolDamage(aStack)) + " / " + tMaxDamage + EnumChatFormatting.GRAY);                  aList.add(tOffset + 1, EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + EnumChatFormatting.YELLOW + " lvl " + getHarvestLevel(aStack, "") + EnumChatFormatting.GRAY); -                aList.add(tOffset + 2, EnumChatFormatting.WHITE + "Turbine Efficency: " + EnumChatFormatting.BLUE + (50.0F + (10.0F * getToolCombatDamage(aStack))) + EnumChatFormatting.GRAY); +                aList.add(tOffset + 2, EnumChatFormatting.WHITE + "Turbine Efficiency: " + EnumChatFormatting.BLUE + (50.0F + (10.0F * getToolCombatDamage(aStack))) + EnumChatFormatting.GRAY);                  aList.add(tOffset + 3, EnumChatFormatting.WHITE + "Optimal Steam flow: " + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 1000) + EnumChatFormatting.GRAY + "L/sec");                  aList.add(tOffset + 3, EnumChatFormatting.WHITE + "Optimal Gas flow(EU burnvalue per tick): " + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 50) + EnumChatFormatting.GRAY + "EU/t");                  aList.add(tOffset + 3, EnumChatFormatting.WHITE + "Optimal Plasma flow(Plasma energyvalue per tick): " + EnumChatFormatting.LIGHT_PURPLE + Math.max(Float.MIN_NORMAL, tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 2000) + EnumChatFormatting.GRAY + "EU/t"); diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 4aa49a954c..2d3e00ae6c 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -65,7 +65,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE      private long mTickTimer = 0, oOutput = 0, mAcceptedAmperes = Long.MAX_VALUE;      private String mOwnerName = "";      private NBTTagCompound mRecipeStuff = new NBTTagCompound(); - +          private static final Field ENTITY_ITEM_HEALTH_FIELD;      static      { @@ -1146,7 +1146,8 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE                      }                  }              } -            GT_Pollution.addPollution(getWorld(), new ChunkPosition(getXCoord(), getYCoord(), getZCoord()), 100000); + +            GT_Pollution.addPollution(this, 100000);              mMetaTileEntity.doExplosion(aAmount);          }      } @@ -1413,7 +1414,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE      @Override      public byte getOutputRedstoneSignal(byte aSide) { -        return getCoverBehaviorAtSide(aSide).manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this) ? mSidedRedstone[aSide] : 0; +        return getCoverBehaviorAtSide(aSide).manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this) ? mSidedRedstone[aSide] : mMetaTileEntity.allowGeneralRedstoneOutput() ? mSidedRedstone[aSide] : 0;      }      @Override diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java index b34483c31b..3adf2b618b 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java @@ -2,6 +2,7 @@ package gregtech.api.metatileentity;  import cpw.mods.fml.relauncher.Side;  import cpw.mods.fml.relauncher.SideOnly; +import gregtech.GT_Mod;  import gregtech.api.GregTech_API;  import gregtech.api.interfaces.metatileentity.IMetaTileEntity;  import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -9,6 +10,7 @@ import gregtech.api.objects.GT_ItemStack;  import gregtech.api.util.GT_Config;  import gregtech.api.util.GT_LanguageManager;  import gregtech.api.util.GT_Utility; +import gregtech.common.GT_Pollution;  import net.minecraft.block.Block;  import net.minecraft.client.renderer.RenderBlocks;  import net.minecraft.client.renderer.texture.IIconRegister; @@ -644,8 +646,9 @@ public abstract class MetaPipeEntity implements IMetaTileEntity {          int tX = getBaseMetaTileEntity().getXCoord(), tY = getBaseMetaTileEntity().getYCoord(), tZ = getBaseMetaTileEntity().getZCoord();          World tWorld = getBaseMetaTileEntity().getWorld();          tWorld.setBlock(tX, tY, tZ, Blocks.air); -        if (GregTech_API.sMachineExplosions) +        if (GregTech_API.sMachineExplosions) {              tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true); +        }      }      @Override diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index 662dc59d80..0561e87198 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -863,4 +863,9 @@ public abstract class MetaTileEntity implements IMetaTileEntity {      public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) {          //      } +     +    @Override +    public boolean allowGeneralRedstoneOutput(){ +    	return false; +    }  }
\ No newline at end of file diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java index 76b2e9aaf5..73d3c19a6b 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java @@ -203,8 +203,7 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity                  if (tFuelValue > 0 && tConsumed > 0 && mFluid.amount > tConsumed) {                      long tFluidAmountToUse = Math.min(mFluid.amount / tConsumed, (maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue);                      if (tFluidAmountToUse > 0 && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)) { -                        GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), -                                10 * getPollution()); +                        GT_Pollution.addPollution(getBaseMetaTileEntity(),10 * getPollution());                          mFluid.amount -= tFluidAmountToUse * tConsumed;                      }                  } @@ -216,8 +215,7 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity                      if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tEmptyContainer)) {                          aBaseMetaTileEntity.increaseStoredEnergyUnits(tFuelValue, true);                          aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1); -                        GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), -                                10 * getPollution()); +                        GT_Pollution.addPollution(getBaseMetaTileEntity(),10 * getPollution());                      }                  }              } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java index fc4ecfeea9..81948bb563 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java @@ -741,11 +741,33 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B       * @return see constants above       */      public int checkRecipe() { +        return checkRecipe(false); +    } + +    public static boolean isValidForLowGravity(GT_Recipe tRecipe, int dimId){ +        return //TODO check or get a better solution +                DimensionManager.getProvider(dimId).getClass().getName().contains("Orbit") || +                DimensionManager.getProvider(dimId).getClass().getName().endsWith("Space") || +                DimensionManager.getProvider(dimId).getClass().getName().endsWith("Asteroids") || +                DimensionManager.getProvider(dimId).getClass().getName().endsWith("SS") || +                DimensionManager.getProvider(dimId).getClass().getName().contains("SpaceStation"); +    } + + +    /** +     * +     * @param skipOC disables OverclockedNess calculation and check - if you do you must implement your own method... +     * @return +     */ +    public int checkRecipe(boolean skipOC){          GT_Recipe_Map tMap = getRecipeList();          if (tMap == null) return DID_NOT_FIND_RECIPE;          GT_Recipe tRecipe = tMap.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, V[mTier], new FluidStack[]{getFillableStack()}, getSpecialSlot(), getAllInputs());          if (tRecipe == null) return DID_NOT_FIND_RECIPE; -        if (GT_Mod.gregtechproxy.mLowGravProcessing && tRecipe.mSpecialValue == -100 && !(DimensionManager.getProvider(getBaseMetaTileEntity().getWorld().provider.dimensionId).getClass().getName().endsWith("Orbit")||DimensionManager.getProvider(getBaseMetaTileEntity().getWorld().provider.dimensionId).getClass().getName().endsWith("Space"))) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; + +        if (GT_Mod.gregtechproxy.mLowGravProcessing && tRecipe.mSpecialValue == -100 && +                !isValidForLowGravity(tRecipe,getBaseMetaTileEntity().getWorld().provider.dimensionId)) +            return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;          if (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe;          if (!canOutput(tRecipe)) {              mOutputBlocked++; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java index abbf5b7ee5..fba40a13a0 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java @@ -224,6 +224,7 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM          if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isUniversalEnergyStored(getMinimumStoredEU()) && (aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified() || aTimer % 200 == 0 || mSuccess > 0)) {              mSuccess--;              moveItems(aBaseMetaTileEntity, aTimer); +            System.out.println("inv "+bInvert+" full "+bRedstoneIfFull);              aBaseMetaTileEntity.setGenericRedstoneOutput(bInvert);              if (bRedstoneIfFull) {                  aBaseMetaTileEntity.setGenericRedstoneOutput(!bInvert); @@ -256,4 +257,9 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM      public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {          return aSide != aBaseMetaTileEntity.getBackFacing();      } +     +    @Override +    public boolean allowGeneralRedstoneOutput(){ +    	return true; +    }  }
\ No newline at end of file diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java index 3bcd29a6c9..608bec114e 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java @@ -23,8 +23,8 @@ import net.minecraft.entity.player.EntityPlayerMP;  import net.minecraft.entity.player.InventoryPlayer;  import net.minecraft.item.ItemStack;  import net.minecraft.nbt.NBTTagCompound; -import scala.actors.threadpool.Arrays; +import java.util.Arrays;  import java.util.List;  public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch { @@ -99,7 +99,7 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch      @Override      public boolean isValidSlot(int aIndex) { -        return false; +        return mAuto && GT_Mod.gregtechproxy.mAMHInteraction;      }      @Override @@ -128,6 +128,11 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch          return new GT_GUIContainer_MaintenanceHatch(aPlayerInventory, aBaseMetaTileEntity);      } +    public void updateSlots() { +        for (int i = 0; i < mInventory.length; i++) +            if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null; +    } +      public boolean autoMaintainance() {          boolean tSuccess = true;          ItemStack[] mInputs = new ItemStack[]{ItemList.Duct_Tape.get(4, new Object[]{}), GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Lubricant, 2), GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Steel, 4), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 2)}; @@ -174,6 +179,7 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch              this.mSoftHammer = true;              this.mSolderingTool = true;              this.mWrench = true; +            updateSlots();              return true;          }          return false; @@ -208,11 +214,11 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch      @Override      public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { -        return false; +        return mAuto && GT_Mod.gregtechproxy.mAMHInteraction;      }      @Override      public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { -        return false; +        return mAuto && GT_Mod.gregtechproxy.mAMHInteraction;      }  } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java index dde8d7cf4f..1209b9c582 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java @@ -1,14 +1,18 @@  package gregtech.api.metatileentity.implementations; +import gregtech.GT_Mod;  import gregtech.api.enums.Textures;  import gregtech.api.interfaces.ITexture;  import gregtech.api.interfaces.tileentity.IGregTechTileEntity;  import gregtech.api.metatileentity.MetaTileEntity;  import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.objects.XSTR;  import gregtech.common.GT_Pollution;  import net.minecraft.entity.player.EntityPlayer;  import net.minecraft.item.ItemStack;  import net.minecraft.world.ChunkPosition; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection;  public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch {      public GT_MetaTileEntity_Hatch_Muffler(int aID, String aName, String aNameRegional, int aTier) { @@ -69,7 +73,7 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch {      public boolean polluteEnvironment() {          if (getBaseMetaTileEntity().getAirAtSide(getBaseMetaTileEntity().getFrontFacing())) { -            GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), calculatePollutionReduction(10000)); +            GT_Pollution.addPollution(getBaseMetaTileEntity(), calculatePollutionReduction(10000));              return true;          }          return false; @@ -88,4 +92,57 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch {      public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {          return false;      } + +    @Override +    public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { +        super.onPostTick(aBaseMetaTileEntity, aTick); +        if(aBaseMetaTileEntity.isClientSide() && this.getBaseMetaTileEntity().isActive()) +            pollutionParticles(this.getBaseMetaTileEntity().getWorld(),"largesmoke"); +    } + +    private static XSTR floatGen=new XSTR(); + +    public void pollutionParticles(World aWorld,String name){ +        boolean chk1,chk2,chk3; +        float ran1=floatGen.nextFloat(),ran2=0,ran3=0; +        chk1=ran1*100<calculatePollutionReduction(100); +        if(GT_Pollution.getPollution(getBaseMetaTileEntity())>= GT_Mod.gregtechproxy.mPollutionSmogLimit){ +            ran2=floatGen.nextFloat(); +            ran3=floatGen.nextFloat(); +            chk2=ran2*100<calculatePollutionReduction(100); +            chk3=ran3*100<calculatePollutionReduction(100); +            if(!(chk1||chk2||chk3))return; +        }else{ +            if(!chk1)return; +            chk2=chk3=false; +        } + +        IGregTechTileEntity aMuffler=this.getBaseMetaTileEntity(); +        ForgeDirection aDir=ForgeDirection.getOrientation(aMuffler.getFrontFacing()); +        float xPos=aDir.offsetX*0.76F+aMuffler.getXCoord()+0.25F; +        float yPos=aDir.offsetY*0.76F+aMuffler.getYCoord()+0.25F; +        float zPos=aDir.offsetZ*0.76F+aMuffler.getZCoord()+0.25F; + +        float ySpd=aDir.offsetY*0.1F+0.2F+0.1F*floatGen.nextFloat(); +        float xSpd; +        float zSpd; + +        if(aDir.offsetY==-1){ +            float temp=floatGen.nextFloat()*2*(float)Math.PI; +            xSpd=(float)Math.sin(temp)*0.1F; +            zSpd=(float)Math.cos(temp)*0.1F; +        }else{ +            xSpd=aDir.offsetX*(0.1F+0.2F*floatGen.nextFloat()); +            zSpd=aDir.offsetZ*(0.1F+0.2F*floatGen.nextFloat()); +        } + +        if(chk1) +            aWorld.spawnParticle(name, xPos + ran1*0.5F, yPos + floatGen.nextFloat()*0.5F, zPos + floatGen.nextFloat()*0.5F, xSpd, ySpd, zSpd); + +        if(chk2) +            aWorld.spawnParticle(name, xPos + ran2*0.5F, yPos + floatGen.nextFloat()*0.5F, zPos + floatGen.nextFloat()*0.5F, xSpd, ySpd, zSpd); + +        if(chk3) +            aWorld.spawnParticle(name, xPos + ran3*0.5F, yPos + floatGen.nextFloat()*0.5F, zPos + floatGen.nextFloat()*0.5F, xSpd, ySpd, zSpd); +    }  } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index 3dd59126b8..963aa2926d 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -16,6 +16,7 @@ import gregtech.api.util.GT_ModHandler;  import gregtech.api.util.GT_OreDictUnificator;  import gregtech.api.util.GT_Recipe.GT_Recipe_Map;  import gregtech.api.util.GT_Utility; +import gregtech.common.GT_Pollution;  import gregtech.common.items.GT_MetaGenerated_Tool_01;  import net.minecraft.entity.player.EntityPlayer;  import net.minecraft.entity.player.InventoryPlayer; @@ -490,6 +491,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {      }      public void explodeMultiblock() { +        GT_Pollution.addPollution(getBaseMetaTileEntity(), 300000);          mInventory[1] = null;          for (MetaTileEntity tTileEntity : mInputBusses) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]);          for (MetaTileEntity tTileEntity : mOutputBusses) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]); @@ -641,11 +643,11 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {      public ArrayList<ItemStack> getStoredOutputs() {          ArrayList<ItemStack> rList = new ArrayList<ItemStack>(); -        for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { -            if (isValidMetaTileEntity(tHatch)) { -                rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(1)); -            } -        } +//        for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { +//            if (isValidMetaTileEntity(tHatch)) { +//                rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(1)); +//            } +//        }          for (GT_MetaTileEntity_Hatch_OutputBus tHatch : mOutputBusses) {              if (isValidMetaTileEntity(tHatch)) {                  for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { @@ -669,12 +671,12 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {      public ArrayList<ItemStack> getStoredInputs() {          ArrayList<ItemStack> rList = new ArrayList<ItemStack>(); -        for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { -            tHatch.mRecipeMap = getRecipeMap(); -            if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().getStackInSlot(0) != null) { -                rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(0)); -            } -        } +//        for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) { +//            tHatch.mRecipeMap = getRecipeMap(); +//            if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().getStackInSlot(0) != null) { +//                rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(0)); +//            } +//        }          for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) {              tHatch.mRecipeMap = getRecipeMap();              if (isValidMetaTileEntity(tHatch)) { diff --git a/src/main/java/gregtech/api/objects/GT_UO_Dimension.java b/src/main/java/gregtech/api/objects/GT_UO_Dimension.java index ffad72868c..657e9353c6 100644 --- a/src/main/java/gregtech/api/objects/GT_UO_Dimension.java +++ b/src/main/java/gregtech/api/objects/GT_UO_Dimension.java @@ -18,7 +18,7 @@ public class GT_UO_Dimension {  	private int maxChance;  	public String Dimension = "null"; -	public GT_UO_Dimension(ConfigCategory aConfigCategory) { +	public GT_UO_Dimension(ConfigCategory aConfigCategory) {//TODO CONFIGURE  		fFluids = HashBiMap.create();  		if (aConfigCategory.containsKey("Dimension"))  		{ @@ -35,18 +35,14 @@ public class GT_UO_Dimension {  	}  	public GT_UO_Fluid getRandomFluid (Random aRandom) { -		int random = aRandom.nextInt(3); -		random = aRandom.nextInt(1000); -		int step = 0; +		int random = aRandom.nextInt(1000);  		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; -  	}  } diff --git a/src/main/java/gregtech/api/objects/GT_UO_DimensionList.java b/src/main/java/gregtech/api/objects/GT_UO_DimensionList.java index 89340132be..ce3bdc51cb 100644 --- a/src/main/java/gregtech/api/objects/GT_UO_DimensionList.java +++ b/src/main/java/gregtech/api/objects/GT_UO_DimensionList.java @@ -2,9 +2,9 @@ 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 gregtech.api.util.GT_Log;  import net.minecraftforge.common.DimensionManager;  import net.minecraftforge.common.config.ConfigCategory;  import net.minecraftforge.common.config.Configuration; @@ -48,15 +48,16 @@ public class GT_UO_DimensionList {  		fConfig.get(Category, "MaxAmount", aMaxAmount).getInt(aMaxAmount);  		fConfig.get(Category, "Chance", aChance).getInt(aChance);  		fConfig.get(Category, "DecreasePerOperationAmount", aDecreasePerOperationAmount).getInt(aDecreasePerOperationAmount); +									//IT IS IN BUCKETS!!!  	}  	public void SetDafultValues() { -		SetConfigValues("Overworld", "0", "gas_natural_gas", "gas_natural_gas", 0, 625, 20, 5); -		SetConfigValues("Overworld", "0", "liquid_light_oil", "liquid_light_oil", 0, 625, 20, 5); +		SetConfigValues("Overworld", "0", "gas_natural_gas", "gas_natural_gas", 0, 625, 20, 7); +		SetConfigValues("Overworld", "0", "liquid_light_oil", "liquid_light_oil", 0, 625, 20, 6);  		SetConfigValues("Overworld", "0", "liquid_medium_oil", "liquid_medium_oil", 0, 625, 20, 5); -		SetConfigValues("Overworld", "0", "liquid_heavy_oil", "liquid_heavy_oil", 0, 625, 20, 5); +		SetConfigValues("Overworld", "0", "liquid_heavy_oil", "liquid_heavy_oil", 0, 625, 20, 4);  		SetConfigValues("Overworld", "0", "oil", "oil", 0, 625, 20, 5); -		SetConfigValues("Moon", "Moon", "helium-3", "helium-3", 0, 375, 100, 5); +		SetConfigValues("Moon", "Moon", "helium-3", "helium-3", 24, 128, 100, 1);  	}  	public void getConfig(Configuration aConfig, String aCategory) { @@ -65,7 +66,7 @@ public class GT_UO_DimensionList {  		if (!fConfig.hasCategory(fCategory))  			SetDafultValues(); -		fConfig.setCategoryComment(fCategory, "Config Undeground Fluids (Delete this Category for regenerate)"); +		fConfig.setCategoryComment(fCategory, "Config Underground Fluids (Delete this Category for regenerate)");  		fConfig.setCategoryComment(fCategory+".Default", "Set Default Generating (Use this Category for Default settings)");  		fConfig.setCategoryComment(fCategory+".Overworld", "Set Overworld Generating");  		fConfig.setCategoryComment(fCategory+".Moon", "Set Moon Generating"); diff --git a/src/main/java/gregtech/api/objects/GT_UO_Fluid.java b/src/main/java/gregtech/api/objects/GT_UO_Fluid.java index c2d9b70bd2..5eea9c323f 100644 --- a/src/main/java/gregtech/api/objects/GT_UO_Fluid.java +++ b/src/main/java/gregtech/api/objects/GT_UO_Fluid.java @@ -9,6 +9,10 @@ import net.minecraftforge.common.config.ConfigCategory;  import net.minecraftforge.fluids.Fluid;  import net.minecraftforge.fluids.FluidRegistry; +import java.util.Random; + +import static gregtech.common.GT_UndergroundOil.DIVIDER; +  public class GT_UO_Fluid {  	public String Registry = "null";  	public int MaxAmount = 0; @@ -19,27 +23,27 @@ public class GT_UO_Fluid {  	public GT_UO_Fluid(ConfigCategory aConfigCategory) {  		if (aConfigCategory.containsKey("Registry"))  		{ -			aConfigCategory.get("Registry").comment = "Fluid registry"; +			aConfigCategory.get("Registry").comment = "Fluid registry name";  			Registry = aConfigCategory.get("Registry").getString();  		}  		if (aConfigCategory.containsKey("MaxAmount"))  		{ -			aConfigCategory.get("MaxAmount").comment = "Max amount generation (per operation Amount)"; +			aConfigCategory.get("MaxAmount").comment = "Max amount generation (per operation, sets the VeinData) 80000 MAX";  			MaxAmount = aConfigCategory.get("MaxAmount").getInt(0);  		}  		if (aConfigCategory.containsKey("MinAmount"))  		{ -			aConfigCategory.get("MinAmount").comment = "Max amount generation (per operation Amount)"; +			aConfigCategory.get("MinAmount").comment = "Min amount generation (per operation, sets the VeinData) 0 MIN";  			MinAmount = aConfigCategory.get("MinAmount").getInt(0);  		}  		if (aConfigCategory.containsKey("Chance"))  		{ -			aConfigCategory.get("Chance").comment = "Chance generating"; +			aConfigCategory.get("Chance").comment = "Chance generating (weighted chance!, there will be a fluid in chunk always!)";  			Chance = aConfigCategory.get("Chance").getInt(0);  		}  		if (aConfigCategory.containsKey("DecreasePerOperationAmount"))  		{ -			aConfigCategory.get("DecreasePerOperationAmount").comment = "Decrease per operation Amount (X/5000L per operation)"; +			aConfigCategory.get("DecreasePerOperationAmount").comment = "Decrease per operation (actual fluid gained works like (Litre)VeinData/5000)";  			DecreasePerOperationAmount = aConfigCategory.get("DecreasePerOperationAmount").getInt(5);  		}  		//System.out.println("GT UO "+aConfigCategory.getName()+" Fluid:"+Registry+" Max:"+MaxAmount+" Min:"+MinAmount+" Chance:"+Chance); @@ -53,11 +57,10 @@ public class GT_UO_Fluid {  		}  	} -	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); +	public int getRandomAmount(Random aRandom){//generates some random ass number that correlates to extraction speeds +		int div = (int)Math.floor(Math.pow((MaxAmount-MinAmount)*100.d*DIVIDER, 0.2d)); +		int min = (int)Math.floor(Math.pow(MinAmount*100.d*DIVIDER, 0.2d)); +        double amount = min+aRandom.nextInt(div)+aRandom.nextDouble(); +        return (int) (Math.pow(amount, 5) / 100);//reverses the computation above  	} -  }
\ No newline at end of file diff --git a/src/main/java/gregtech/api/objects/MaterialStack.java b/src/main/java/gregtech/api/objects/MaterialStack.java index 6066d3cf23..62adefa35b 100644 --- a/src/main/java/gregtech/api/objects/MaterialStack.java +++ b/src/main/java/gregtech/api/objects/MaterialStack.java @@ -35,7 +35,7 @@ public class MaterialStack implements Cloneable {           String temp1 = "", temp2 = mMaterial.getToolTip(true), temp3 = "", temp4 = "";           if (mAmount > 1) {               temp4 = String.valueOf(mAmount); -             if (mMaterial.mMaterialList.size() > 1) { +             if (mMaterial.mMaterialList.size() > 1 || (mMaterial.mMaterialList.size() == 1 && mMaterial.mElement == null)) {                  temp1 = "(";                  temp3 = ")";               } diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java index 62c8714807..daa1b67069 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -682,8 +682,8 @@ public class GT_ModHandler {                  for (ItemStack tStack : ((IRecipeInput) tRecipe.getKey()).getInputs()) {                      if (GT_Utility.isStackValid(tStack)) {                          if (aAddGTRecipe && (aGTRecipeMap.findRecipe(null, false, Long.MAX_VALUE, null, tStack) == null)) { +                        	try{                              if (aExcludeGTIC2Items && ((tStack.getUnlocalizedName().contains("gt.metaitem.01") || tStack.getUnlocalizedName().contains("gt.blockores") || tStack.getUnlocalizedName().contains("ic2.itemCrushed") || tStack.getUnlocalizedName().contains("ic2.itemPurifiedCrushed")))) continue; -                            try{                              switch (aGTRecipeMap.mUnlocalizedName) {                                  case "gt.recipe.macerator":                                      aGTRecipeMap.addRecipe(true, new ItemStack[]{GT_Utility.copyAmount(((IRecipeInput) tRecipe.getKey()).getAmount(), tStack)}, (ItemStack[]) ((RecipeOutput) tRecipe.getValue()).items.toArray(), null, null, null, null, 300, 2, 0); diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 6c3289af30..9ccdc73a24 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -53,10 +53,13 @@ import net.minecraft.tileentity.TileEntity;  import net.minecraft.tileentity.TileEntityChest;  import net.minecraft.util.AxisAlignedBB;  import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting;  import net.minecraft.util.MathHelper; +import net.minecraft.world.ChunkCoordIntPair;  import net.minecraft.world.ChunkPosition;  import net.minecraft.world.World;  import net.minecraft.world.WorldServer; +import net.minecraft.world.chunk.Chunk;  import net.minecraftforge.common.DimensionManager;  import net.minecraftforge.common.MinecraftForge;  import net.minecraftforge.common.util.ForgeDirection; @@ -73,6 +76,9 @@ import java.util.*;  import java.util.Map.Entry;  import static gregtech.api.enums.GT_Values.*; +import static gregtech.common.GT_Proxy.GTPOLLUTION; +import static gregtech.common.GT_Proxy.dimensionWiseChunkData; +import static gregtech.common.GT_UndergroundOil.undergroundOil;  /**   * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -95,6 +101,14 @@ public class GT_Utility {          GregTech_API.sItemStackMappings.add(sFilledContainerToData);          GregTech_API.sItemStackMappings.add(sEmptyContainerToFluidToData);      } +     +    public static int safeInt(long number, int margin){ +        return number>Integer.MAX_VALUE-margin ? Integer.MAX_VALUE-margin :(int)number; +    } + +    public static int safeInt(long number){ +        return number>GT_Values.V[GT_Values.V.length-1] ? safeInt(GT_Values.V[GT_Values.V.length-1],1) : number<Integer.MIN_VALUE ? Integer.MIN_VALUE : (int)number; +}      public static Field getPublicField(Object aObject, String aField) {          Field rField = null; @@ -1527,70 +1541,70 @@ public class GT_Utility {      	return (int)Math.floor(aValue / aScale);      } -    public static FluidStack getUndergroundOil(World aWorld, int aX, int aZ) { -    	return getUndergroundOil(aWorld, aX, aZ, false); -    } - -    public static FluidStack getUndergroundOil(World aWorld, int aX, int aZ, boolean needConsumeOil) { - -    	if (GT_Mod.gregtechproxy.mUndergroundOil.CheckBlackList(aWorld.provider.dimensionId)) -    		return null; - -        Random tRandom = new Random((aWorld.getSeed() + aWorld.provider.dimensionId * 2 + (getScaleCoordinates(aX,96)) + (7 * (getScaleCoordinates(aZ,96))))); -        int tAmount = 0; -        int tFluidId = 0; -        int tDecreasePerOperationAmount = 5; -        Fluid tFluid = null; -//        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); -            	tDecreasePerOperationAmount = uoFluid.DecreasePerOperationAmount; -            	if (tFluid != null) -            		tFluidId = tFluid.getID(); -                //System.out.println("Fluid: ("+tFluidId+")"+tFluid.getName()+" Amount:"+tAmount); -            } -			 -		} catch (Exception e) { -	        tAmount = 0; -	        tFluidId = 0; -		} - -        try { -        ChunkPosition tPos = new ChunkPosition(getScaleCoordinates(aX,16), aWorld.provider.dimensionId, getScaleCoordinates(aZ,16)); -        int[] tInts = new int[3]; -    	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 - tDecreasePerOperationAmount; - -    	tInts[0] = tAmount; -    	tInts[2] = tFluidId; -    	GT_Proxy.chunkData.put(tPos, tInts); -		} catch (Exception e) { -			System.out.println("getUndergroundOil() - Error put data"); -		} -    	if (tFluid!=null) -    		return new FluidStack(tFluid, tAmount); -    	return null; -    } - +//    public static FluidStack getUndergroundOil(World aWorld, int aX, int aZ) { +//    	return getUndergroundOil(aWorld, aX, aZ, false); +//    } +// +//    public static FluidStack getUndergroundOil(World aWorld, int aX, int aZ, boolean needConsumeOil) { +// +//    	if (GT_Mod.gregtechproxy.mUndergroundOil.CheckBlackList(aWorld.provider.dimensionId)) +//    		return null; +// +//        Random tRandom = new Random((aWorld.getSeed() + aWorld.provider.dimensionId * 2 + (getScaleCoordinates(aX,96)) + (7 * (getScaleCoordinates(aZ,96))))); +//        int tAmount = 0; +//        int tFluidId = 0; +//        int tDecreasePerOperationAmount = 5; +//        Fluid tFluid = null; +////        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); +//            	tDecreasePerOperationAmount = uoFluid.DecreasePerOperationAmount; +//            	if (tFluid != null) +//            		tFluidId = tFluid.getID(); +//                //System.out.println("Fluid: ("+tFluidId+")"+tFluid.getName()+" Amount:"+tAmount); +//            } +//			 +//		} catch (Exception e) { +//	        tAmount = 0; +//	        tFluidId = 0; +//		} +// +//        try { +//        ChunkPosition tPos = new ChunkPosition(getScaleCoordinates(aX,16), aWorld.provider.dimensionId, getScaleCoordinates(aZ,16)); +//        int[] tInts = new int[3]; +//    	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 - tDecreasePerOperationAmount; +// +//    	tInts[0] = tAmount; +//    	tInts[2] = tFluidId; +//    	GT_Proxy.chunkData.put(tPos, tInts); +//		} catch (Exception e) { +//			System.out.println("getUndergroundOil() - Error put data"); +//		} +//    	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) {          if (aList == null) return 0; @@ -1779,22 +1793,25 @@ public class GT_Utility {                  if (D1) e.printStackTrace(GT_Log.err);              }          } -        if (aPlayer.capabilities.isCreativeMode&>_Values.D1) { -            FluidStack tFluid = getUndergroundOil(aWorld, aX, aZ); +         +        if (aPlayer.capabilities.isCreativeMode && GT_Values.D1) { +            FluidStack tFluid = undergroundOil(aWorld.getChunkFromBlockCoords(aX,aZ),-1);//-# to only read              if (tFluid!=null) -            	tList.add("Oil in Chunk: " + tFluid.amount + " " + tFluid.getLocalizedName()); -        } -//        if(aPlayer.capabilities.isCreativeMode){ -        	ChunkPosition tPos = new ChunkPosition(getScaleCoordinates(aX,16), aWorld.provider.dimensionId, getScaleCoordinates(aZ,16)); -        	if(GT_Proxy.chunkData.containsKey(tPos)){ -        		int[] tPollution = GT_Proxy.chunkData.get(tPos); -        		if(tPollution.length>1){ -        		tList.add("Pollution in Chunk: "+tPollution[1]); -        		}else{ -        			tList.add("No Pollution in Chunk"); -        		} -        	} -//        } +            	tList.add(EnumChatFormatting.GOLD+tFluid.getLocalizedName()+EnumChatFormatting.RESET+": " +EnumChatFormatting.YELLOW+ tFluid.amount +EnumChatFormatting.RESET+" L"); +            else +                tList.add(EnumChatFormatting.GOLD+"Nothing"+EnumChatFormatting.RESET+": " +EnumChatFormatting.YELLOW+ '0' +EnumChatFormatting.RESET+" L"); +        } +//      if(aPlayer.capabilities.isCreativeMode){ +        int[] chunkData = GT_Proxy.dimensionWiseChunkData.get(aWorld.provider.dimensionId).get(aWorld.getChunkFromBlockCoords(aX,aZ).getChunkCoordIntPair()); +        if(chunkData !=null){ +            if(chunkData[GTPOLLUTION]>0){ +                tList.add("Pollution in Chunk: "+EnumChatFormatting.RED+chunkData[GTPOLLUTION]+EnumChatFormatting.RESET+" gibbl"); +            }else{ +                tList.add(EnumChatFormatting.GREEN+"No Pollution in Chunk! HAYO!"+EnumChatFormatting.RESET); +            } +        }else{ +            tList.add(EnumChatFormatting.GREEN+"No Pollution in Chunk! HAYO!"+EnumChatFormatting.RESET); +}          try {              if (tBlock instanceof IDebugableBlock) { diff --git a/src/main/java/gregtech/common/GT_Pollution.java b/src/main/java/gregtech/common/GT_Pollution.java index a950e8a2f2..175ea6ac85 100644 --- a/src/main/java/gregtech/common/GT_Pollution.java +++ b/src/main/java/gregtech/common/GT_Pollution.java @@ -1,6 +1,8 @@  package gregtech.common; +import cpw.mods.fml.common.gameevent.TickEvent;  import gregtech.GT_Mod; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity;  import gregtech.api.objects.XSTR;  import gregtech.api.util.GT_Utility;  import net.minecraft.block.Block; @@ -10,12 +12,17 @@ import net.minecraft.init.Blocks;  import net.minecraft.potion.Potion;  import net.minecraft.potion.PotionEffect;  import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.ChunkCoordIntPair;  import net.minecraft.world.ChunkPosition;  import net.minecraft.world.World; -import net.minecraftforge.common.DimensionManager; +import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.event.world.WorldEvent; -import java.util.ArrayList; -import java.util.List; +import java.util.*; + +import static gregtech.common.GT_Proxy.*; + +//import net.minecraft.entity.EntityLiving;  public class GT_Pollution {  	/** @@ -49,95 +56,131 @@ public class GT_Pollution {  	 * Muffler Hatch Pollution reduction:  	 * LV (0%), MV (30%), HV (52%), EV (66%), IV (76%), LuV (84%), ZPM (89%), UV (92%), MAX (95%)  	 */ +	private static XSTR tRan = new XSTR(); +	private List<ChunkCoordIntPair> pollutionList = new ArrayList<>();//chunks left to process +	private HashMap<ChunkCoordIntPair,int[]> chunkData;//link to chunk data that is saved/loaded +	private int operationsPerTick=0;//how much chunks should be processed in each cycle +	private static final short cycleLen=1200; +	private final World aWorld; -	static List<ChunkPosition> tList = null; -	static int loops = 1; -	static XSTR tRan = new XSTR(); +	public GT_Pollution(World world){ +		aWorld=world; +		chunkData=dimensionWiseChunkData.get(aWorld.provider.dimensionId); +		if(chunkData==null){ +			chunkData=new HashMap<>(1024); +			dimensionWiseChunkData.put(world.provider.dimensionId,chunkData); +		} +		dimensionWisePollution.put(aWorld.provider.dimensionId,this); +	} -	public static void onWorldTick(World aWorld, int aTick){ -		if(!GT_Mod.gregtechproxy.mPollution)return; -		if(aTick == 0 || (tList==null && GT_Proxy.chunkData!=null)){ -			tList = new ArrayList<ChunkPosition>(GT_Proxy.chunkData.keySet()); -			loops = (tList.size()/1200) + 1; -//			System.out.println("new Pollution loop"+aTick); +	public static void onWorldTick(TickEvent.WorldTickEvent aEvent){//called from proxy +		//return if pollution disabled +		if(!GT_Mod.gregtechproxy.mPollution) return; +		final GT_Pollution pollutionInstance = dimensionWisePollution.get(aEvent.world.provider.dimensionId); +		if(pollutionInstance==null)return; +		pollutionInstance.tickPollutionInWorld((int)(aEvent.world.getTotalWorldTime()%cycleLen)); +	} + +	private void tickPollutionInWorld(int aTickID){//called from method above +		//gen data set +		if(aTickID==0){ +			pollutionList = new ArrayList<>(chunkData.keySet()); +			//set operations per tick +			if(pollutionList.size()>0) operationsPerTick =(pollutionList.size()/cycleLen); +			else operationsPerTick=0;//SANity  		} -		if(tList!=null && tList.size() > 0){ -			int i = 0; -			for(; i < loops ; i++){ -				if(tList.size()>0){ -				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.chunkPosY+" "+tPos.chunkPosX+" "+tPos.chunkPosZ+" "+tPollution); -				//Reduce pollution in chunk -				tPollution = (int)(0.99f*tPollution); -				tPollution -= 2000; -				if(tPollution<=0){tPollution = 0;} -				//Spread Pollution -				if(tPollution>50000){ -				List<ChunkPosition> tNeighbor = new ArrayList(); -				tNeighbor.add(new ChunkPosition(tPos.chunkPosX+1, tPos.chunkPosY, tPos.chunkPosZ)); -				tNeighbor.add(new ChunkPosition(tPos.chunkPosX-1, tPos.chunkPosY, tPos.chunkPosZ)); -				tNeighbor.add(new ChunkPosition(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ+1)); -				tNeighbor.add(new ChunkPosition(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ-1)); -				for(ChunkPosition tNPos : tNeighbor){ -					if(GT_Proxy.chunkData.containsKey(tNPos)){ -						int tNPol = GT_Proxy.chunkData.get(tNPos)[1]; -						if(tNPol<tPollution && tNPol*12 < tPollution*10){ -							int tDiff = tPollution - tNPol; -							tDiff = tDiff/10; -							tNPol += tDiff; -							tPollution -= tDiff; -							GT_Proxy.chunkData.get(tNPos)[1] = tNPol; -						} -					}else{ -						GT_Utility.getUndergroundOil(aWorld,tNPos.chunkPosX<<4,tNPos.chunkPosZ<<4); + +		for(int chunksProcessed=0;chunksProcessed<=operationsPerTick;chunksProcessed++){ +			if(pollutionList.size()==0)break;//no more stuff to do +			ChunkCoordIntPair actualPos=pollutionList.remove(pollutionList.size()-1);//faster +			//add default data if missing +			if(!chunkData.containsKey(actualPos)) chunkData.put(actualPos,getDefaultChunkDataOnCreation()); +			//get pollution +			int tPollution = chunkData.get(actualPos)[GTPOLLUTION]; +			//remove some +			tPollution = (int)(0.9945f*tPollution); +			//tPollution -= 2000;//This does not really matter... + +			if(tPollution<=0) tPollution = 0;//SANity check +			else if(tPollution>400000){//Spread Pollution + +				ChunkCoordIntPair[] tNeighbors = new ChunkCoordIntPair[4];//array is faster +				tNeighbors[0]=(new ChunkCoordIntPair(actualPos.chunkXPos+1,actualPos.chunkZPos)); +				tNeighbors[1]=(new ChunkCoordIntPair(actualPos.chunkXPos-1,actualPos.chunkZPos)); +				tNeighbors[2]=(new ChunkCoordIntPair(actualPos.chunkXPos,actualPos.chunkZPos+1)); +				tNeighbors[3]=(new ChunkCoordIntPair(actualPos.chunkXPos,actualPos.chunkZPos-1)); +				for(ChunkCoordIntPair neighborPosition : tNeighbors){ +					if(!chunkData.containsKey(neighborPosition)) chunkData.put(neighborPosition,getDefaultChunkDataOnCreation()); + +					int neighborPollution = chunkData.get(neighborPosition)[GTPOLLUTION]; +					if(neighborPollution*6 < tPollution*5){//METHEMATICS... +						int tDiff = tPollution - neighborPollution; +						tDiff = tDiff/20; +						neighborPollution = GT_Utility.safeInt((long)neighborPollution+tDiff);//tNPol += tDiff; +						tPollution -= tDiff; +						chunkData.get(neighborPosition)[GTPOLLUTION] = neighborPollution;  					} -				}} -				int[] tArray = GT_Proxy.chunkData.get(tPos); -				tArray[1] = tPollution; -				GT_Proxy.chunkData.remove(tPos); -				GT_Proxy.chunkData.put(tPos, tArray); +				} + +  				//Create Pollution effects -//				Smog filter TODO -				if(tPollution > GT_Mod.gregtechproxy.mPollutionSmogLimit){ -				AxisAlignedBB chunk = AxisAlignedBB.getBoundingBox(tPos.chunkPosX<<4, 0, tPos.chunkPosZ<<4, (tPos.chunkPosX<<4)+16, 256, (tPos.chunkPosZ<<4)+16); -				List<EntityLivingBase> tEntitys = aWorld.getEntitiesWithinAABB(EntityLivingBase.class, chunk); -					for(EntityLivingBase tEnt : tEntitys){ -						if(!GT_Utility.isWearingFullGasHazmat(tEnt) && tRan.nextInt(tPollution/2000) > 40){ -							int ran = tRan.nextInt(3); -							if(ran==0)tEnt.addPotionEffect(new PotionEffect(Potion.weakness.id,  Math.min(tPollution/2500,1000), tPollution/400000)); -							if(ran==1)tEnt.addPotionEffect(new PotionEffect(Potion.digSlowdown.id,  Math.min(tPollution/2500,1000), tPollution/400000)); -							if(ran==2)tEnt.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id,  Math.min(tPollution/2500,1000), tPollution/400000)); +				//Smog filter TODO +				if(tPollution > GT_Mod.gregtechproxy.mPollutionSmogLimit) { +					AxisAlignedBB chunk = AxisAlignedBB.getBoundingBox(actualPos.chunkXPos << 4, 0, actualPos.chunkZPos << 4, (actualPos.chunkXPos << 4) + 16, 256, (actualPos.chunkZPos << 4) + 16); +					List<EntityLivingBase> tEntitys = aWorld.getEntitiesWithinAABB(EntityLivingBase.class, chunk); +					for (EntityLivingBase tEnt : tEntitys) { +						if (!GT_Utility.isWearingFullGasHazmat(tEnt)) { +							switch (tRan.nextInt(3)) { +								default: +									tEnt.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, Math.min(tPollution / 1000, 1000), tPollution / 400000)); +								case 1: +									tEnt.addPotionEffect(new PotionEffect(Potion.weakness.id, Math.min(tPollution / 1000, 1000), tPollution / 400000)); +								case 2: +									tEnt.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, Math.min(tPollution / 1000, 1000), tPollution / 400000)); +							}  						} -} -//				Poison effects -				if(tPollution > GT_Mod.gregtechproxy.mPollutionPoisonLimit){ -				for(EntityLivingBase tEnt : tEntitys){ -				if(!GT_Utility.isWearingFullGasHazmat(tEnt) && tRan.nextInt(tPollution/2000) > 20){ -					int ran = tRan.nextInt(3); -					if(ran==0)tEnt.addPotionEffect(new PotionEffect(Potion.poison.id, Math.min(tPollution/2500,1000), tPollution/500000)); -					if(ran==1)tEnt.addPotionEffect(new PotionEffect(Potion.confusion.id, Math.min(tPollution/2500,1000), 1)); -					if(ran==2)tEnt.addPotionEffect(new PotionEffect(Potion.blindness.id, Math.min(tPollution/2500,1000), 1)); -} -				} -//				killing plants -				if(tPollution > GT_Mod.gregtechproxy.mPollutionVegetationLimit){ -				int f = 20; -				for(;f<(tPollution/25000);f++){ -					int x =tPos.chunkPosX<<4+(tRan.nextInt(16));; -					int y =60 +(-f+tRan.nextInt(f*2+1)); -					int z =tPos.chunkPosZ<<4+(tRan.nextInt(16)); -					damageBlock(x, y, z, tPollution > GT_Mod.gregtechproxy.mPollutionSourRainLimit); -				}}}} +					} + + +					//				Poison effects +					if (tPollution > GT_Mod.gregtechproxy.mPollutionPoisonLimit) { +						//AxisAlignedBB chunk = AxisAlignedBB.getBoundingBox(tPos.chunkPosX*16, 0, tPos.chunkPosZ*16, tPos.chunkPosX*16+16, 256, tPos.chunkPosZ*16+16); +						//List<EntityLiving> tEntitys = aWorld.getEntitiesWithinAABB(EntityLiving.class, chunk); +						for (EntityLivingBase tEnt : tEntitys) { +							if (!GT_Utility.isWearingFullGasHazmat(tEnt)) { +								switch (tRan.nextInt(4)) { +									default: +										tEnt.addPotionEffect(new PotionEffect(Potion.hunger.id, tPollution / 500000)); +									case 1: +										tEnt.addPotionEffect(new PotionEffect(Potion.confusion.id, Math.min(tPollution / 2000, 1000), 1)); +									case 2: +										tEnt.addPotionEffect(new PotionEffect(Potion.poison.id, Math.min(tPollution / 4000, 1000), tPollution / 500000)); +									case 3: +										tEnt.addPotionEffect(new PotionEffect(Potion.blindness.id, Math.min(tPollution / 2000, 1000), 1)); +								} +							} +						} + + +						//				killing plants +						if (tPollution > GT_Mod.gregtechproxy.mPollutionVegetationLimit) { +							int f = 20; +							for (; f < (tPollution / 25000); f++) { +								int x = (actualPos.chunkXPos << 4) + tRan.nextInt(16); +								int y = 60 + (-f + tRan.nextInt(f * 2 + 1)); +								int z = (actualPos.chunkZPos << 4) + tRan.nextInt(16); +								damageBlock(aWorld, x, y, z, tPollution > GT_Mod.gregtechproxy.mPollutionSourRainLimit); +							} +						} +					}  				}  			} -			}} +			//Write new pollution to Hashmap !!! +			chunkData.get(actualPos)[GTPOLLUTION] = tPollution; +		}  	} -	public static void damageBlock(int x, int y, int z, boolean sourRain){ -		World world = DimensionManager.getWorld(0); +	private static void damageBlock(World world, int x, int y, int z, boolean sourRain){  		if (world.isRemote)	return;  		Block tBlock = world.getBlock(x, y, z);  		int tMeta = world.getBlockMetadata(x, y, z); @@ -187,24 +230,42 @@ public class GT_Pollution {  			}  	} -	//Add aWorld to Save Pollution -	public static void addPollution(World aWorld, ChunkPosition aPos, int aPollution){ +	public static void addPollution(IGregTechTileEntity te, int aPollution){ +		addPollution(te.getWorld().getChunkFromBlockCoords(te.getXCoord(),te.getZCoord()), aPollution); +	} + +	public static void addPollution(Chunk ch, int aPollution){  		if(!GT_Mod.gregtechproxy.mPollution)return; -		try{ -		ChunkPosition tPos = new ChunkPosition(GT_Utility.getScaleCoordinates(aPos.chunkPosX,16), aWorld.provider.dimensionId, GT_Utility.getScaleCoordinates(aPos.chunkPosZ,16)); // OLD in coordinate -1 -1 chunk 0 0 -//		System.out.println("add pollution dim: "+aWorld.provider.dimensionId+" x: "+ tPos.chunkPosX +" z: " + tPos.chunkPosZ +" poll: "+aPollution); -		int[] tData = new int[3]; -		if(GT_Proxy.chunkData.containsKey(tPos)){ -			tData = GT_Proxy.chunkData.get(tPos); -			if(tData.length>1){ -				tData[1] += aPollution; -			} -		}else{ -			tData[1] += aPollution; -			GT_Proxy.chunkData.put(tPos, tData); +		HashMap<ChunkCoordIntPair,int[]> dataMap=dimensionWiseChunkData.get(ch.worldObj.provider.dimensionId); +		if(dataMap==null){ +			dataMap=new HashMap<>(1024); +			dimensionWiseChunkData.put(ch.worldObj.provider.dimensionId,dataMap);  		} -		}catch(Exception e){ -			 +		int[] dataArr=dataMap.get(ch.getChunkCoordIntPair()); +		if(dataArr==null){ +			dataArr=getDefaultChunkDataOnCreation(); +			dataMap.put(ch.getChunkCoordIntPair(),dataArr);  		} +		dataArr[GTPOLLUTION]+=aPollution; +		if(dataArr[GTPOLLUTION]<0)dataArr[GTPOLLUTION]=0; +	} + +	public static int getPollution(IGregTechTileEntity te){ +		return getPollution(te.getWorld().getChunkFromBlockCoords(te.getXCoord(),te.getZCoord())); +	} + +	public static int getPollution(Chunk ch){ +		if(!GT_Mod.gregtechproxy.mPollution)return 0; +		HashMap<ChunkCoordIntPair,int[]> dataMap=dimensionWiseChunkData.get(ch.worldObj.provider.dimensionId); +		if(dataMap==null || dataMap.get(ch.getChunkCoordIntPair())==null) return 0; +		return dataMap.get(ch.getChunkCoordIntPair())[GTPOLLUTION]; +	} +	 +	//Add compatibility with old code +	@Deprecated /*Don't use it... too weird way of passing position*/ +	public static void addPollution(World aWorld, ChunkPosition aPos, int aPollution){ +		//The abuse of ChunkPosition to store block position and dim...  +		//is just bad expacially when that is both used to store ChunkPos and BlockPos depeending on context +		addPollution(aWorld.getChunkFromBlockCoords(aPos.chunkPosX,aPos.chunkPosZ),aPollution);  	}  } diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index 91033a1f34..b79e6691d3 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -6,6 +6,8 @@ import cpw.mods.fml.common.Loader;  import cpw.mods.fml.common.ModContainer;  import cpw.mods.fml.common.ProgressManager;  import cpw.mods.fml.common.eventhandler.Event.Result; +import cpw.mods.fml.common.eventhandler.EventBus; +import cpw.mods.fml.common.eventhandler.EventPriority;  import cpw.mods.fml.common.eventhandler.SubscribeEvent;  import cpw.mods.fml.common.gameevent.TickEvent;  import cpw.mods.fml.common.network.FMLNetworkEvent; @@ -55,10 +57,12 @@ import net.minecraft.nbt.NBTTagCompound;  import net.minecraft.potion.Potion;  import net.minecraft.tileentity.TileEntity;  import net.minecraft.util.DamageSource; +import net.minecraft.world.ChunkCoordIntPair;  import net.minecraft.world.ChunkPosition;  import net.minecraft.world.World;  import net.minecraft.world.WorldSettings.GameType;  import net.minecraft.world.gen.feature.WorldGenMinable; +import net.minecraftforge.common.DimensionManager;  import net.minecraftforge.common.MinecraftForge;  import net.minecraftforge.event.ForgeEventFactory;  import net.minecraftforge.event.entity.EntityJoinWorldEvent; @@ -69,6 +73,7 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;  import net.minecraftforge.event.terraingen.OreGenEvent;  import net.minecraftforge.event.world.BlockEvent;  import net.minecraftforge.event.world.ChunkDataEvent; +import net.minecraftforge.event.world.WorldEvent;  import net.minecraftforge.fluids.Fluid;  import net.minecraftforge.fluids.FluidContainerRegistry;  import net.minecraftforge.fluids.FluidRegistry; @@ -196,6 +201,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {      public boolean mLowGravProcessing = false;      public boolean mAprilFool = false;      public boolean mCropNeedBlock = true; +    public boolean mAMHInteraction = true;      public GT_Proxy() {          GameRegistry.registerFuelHandler(this); @@ -580,6 +586,9 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {                  }              }          } catch (Throwable e) {e.printStackTrace(GT_Log.err);} + +        dimensionWiseChunkData.clear();//!!! IMPORTANT for map switching... +        dimensionWisePollution.clear();//!!! IMPORTANT for map switching...      }      public void onServerStarted() { @@ -1245,8 +1254,8 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {                      }                  }              } -            if(aEvent.world.provider.dimensionId==0) -                GT_Pollution.onWorldTick(aEvent.world, (int) (aEvent.world.getTotalWorldTime() % 1200)); + +            GT_Pollution.onWorldTick(aEvent);          }      } @@ -1699,48 +1708,91 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {          ProgressManager.pop(progressBar);      } -    public static final HashMap<ChunkPosition, int[]>  chunkData = new HashMap<ChunkPosition, int[]>(5000); +    public static final HashMap<Integer,HashMap<ChunkCoordIntPair,int []>> dimensionWiseChunkData = new HashMap<>(16);//stores chunk data that is loaded/saved +    public static final HashMap<Integer,GT_Pollution> dimensionWisePollution = new HashMap<>(16);//stores GT_Polluttors objects +	public static final byte GTOIL=3,GTOILFLUID=2,GTPOLLUTION=1,GTMETADATA=0,NOT_LOADED=0,LOADED=1;//consts +    //@Deprecated +	//public static final HashMap<ChunkPosition, int[]>  chunkData = new HashMap<>(0); + +    private static final byte oilVer=(byte)20;//non zero plz + +    //TO get default's fast +    public static int[] getDefaultChunkDataOnCreation(){ +        return new int[]{NOT_LOADED,0,-1,-1}; +    } +    public static int[] getDefaultChunkDataOnLoad(){ +        return new int[]{LOADED,0,-1,-1}; +    }      @SubscribeEvent -    public void handleChunkSaveEvent(ChunkDataEvent.Save event) -    {   -        ChunkPosition tPos = new ChunkPosition(event.getChunk().xPosition,event.getChunk().worldObj.provider.dimensionId,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>2){event.getData().setInteger("GTOILFLUID", tInts[2]);} -        } +    public void handleChunkSaveEvent(ChunkDataEvent.Save event) {//ALWAYS SAVE FROM THE HASH MAP DATA +        HashMap<ChunkCoordIntPair,int []> chunkData=dimensionWiseChunkData.get(event.world.provider.dimensionId); +        if(chunkData==null) return;//no dim info stored + +        int[] tInts = chunkData.get(event.getChunk().getChunkCoordIntPair()); +        if(tInts==null) return;//no chunk data stored +        //assuming len of this array 4 +        if(tInts[3]>=0)event.getData().setInteger("GTOIL", tInts[GTOIL]); +        else event.getData().removeTag("GTOIL"); +        if(tInts[2]>=0)event.getData().setInteger("GTOILFLUID", tInts[GTOILFLUID]); +        else event.getData().removeTag("GTOILFLUID"); +        if(tInts[1]>0)event.getData().setInteger("GTPOLLUTION", tInts[GTPOLLUTION]); +        else event.getData().removeTag("GTPOLLUTION"); +        event.getData().setByte("GTOILVER", oilVer);//version mark      }      @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,event.getChunk().zPosition); -        int[] tData = new int[0]; -        if(chunkData.containsKey(tPos)){ -            tData = chunkData.get(tPos); -            chunkData.remove(tPos); -            if(tData.length>0) -                tOil = tData[0]; -            if(tData.length>1) -            	tPollution = tData[1]; -            if(tData.length>2) -            	tOilFluid = tData[2]; +    public void handleChunkLoadEvent(ChunkDataEvent.Load event) { +        final int worldID=event.world.provider.dimensionId; +        HashMap<ChunkCoordIntPair, int[]> chunkData = dimensionWiseChunkData.get(worldID); +        if (chunkData == null){ +            chunkData=new HashMap<>(1024); +            dimensionWiseChunkData.put(worldID, chunkData);          } +        if (dimensionWisePollution.get(worldID) == null) +            dimensionWisePollution.put(worldID, new GT_Pollution(event.world)); + +        int[] tInts = chunkData.get(event.getChunk().getChunkCoordIntPair()); +        if (tInts == null) { +            //NOT LOADED and NOT PROCESSED by pollution algorithms +            //regular load +            tInts = getDefaultChunkDataOnLoad(); + +            if (event.getData().getByte("GTOILVER") == oilVer) { +                if (event.getData().hasKey("GTOIL")) +                    tInts[GTOIL] = event.getData().getInteger("GTOIL"); +                if (event.getData().hasKey("GTOILFLUID")) +                    tInts[GTOILFLUID] = event.getData().getInteger("GTOILFLUID"); +            } + +            tInts[GTPOLLUTION] = event.getData().getInteger("GTPOLLUTION");//Defaults to 0 + +            //store in HASH MAP if has useful data +            if (tInts[GTPOLLUTION] > 0 || tInts[GTOIL] >= 0 || tInts[GTOILFLUID] >= 0) +                chunkData.put(event.getChunk().getChunkCoordIntPair(), tInts); +        } else if (tInts[GTMETADATA] == NOT_LOADED) {//was NOT loaded from chunk save game data +            //NOT LOADED but generated +            //append load +            if (event.getData().getByte("GTOILVER") == oilVer) { +                if (tInts[GTOIL] < 0 && event.getData().hasKey("GTOIL"))//if was not yet initialized +                    tInts[GTOIL] = event.getData().getInteger("GTOIL"); + +                if (tInts[GTOILFLUID] < 0 && event.getData().hasKey("GTOILFLUID"))//if was not yet initialized +                    tInts[GTOILFLUID] = event.getData().getInteger("GTOILFLUID"); +            } else { +                tInts[GTOIL] = -1; +                tInts[GTOILFLUID] = -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"); +            tInts[GTPOLLUTION] += event.getData().getInteger("GTPOLLUTION");//Defaults to 0, add stored pollution to data +            tInts[GTMETADATA] = LOADED;//mark as = loaded +            //store in HASHMAP -        chunkData.put(tPos, new int[]{tOil,tPollution,tOilFluid}); +            chunkData.put(event.getChunk().getChunkCoordIntPair(), tInts); +        }//else if(tInts[0]==1){ +        ////Already loaded chunk data +        ////DO NOTHING - this chunk data was already loaded and stored in hash map +        //}      }      public static class OreDictEventContainer { diff --git a/src/main/java/gregtech/common/GT_UndergroundOil.java b/src/main/java/gregtech/common/GT_UndergroundOil.java new file mode 100644 index 0000000000..a3e0962100 --- /dev/null +++ b/src/main/java/gregtech/common/GT_UndergroundOil.java @@ -0,0 +1,100 @@ +package gregtech.common; + +import gregtech.GT_Mod; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_UO_Fluid; +import gregtech.api.objects.XSTR; +import gregtech.common.GT_Proxy; +import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.world.ChunkPosition; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + +import java.util.HashMap; + +import static gregtech.api.util.GT_Utility.getScaleCoordinates; +import static gregtech.common.GT_Proxy.*; + +/** + * Created by Tec on 29.04.2017. + */ +public class GT_UndergroundOil { +    public static final short DIVIDER=5000; + +    public static FluidStack undergroundOil(IGregTechTileEntity te, float drainSpeedCoefficient){ +        return undergroundOil(te.getWorld().getChunkFromBlockCoords(te.getXCoord(),te.getZCoord()),drainSpeedCoefficient); +    } + +    //Returns whole content for information purposes -> when drainSpeedCoeff < 0 +    //Else returns extracted fluidStack if amount > 0, or null otherwise +    public static FluidStack undergroundOil(Chunk chunk, float drainSpeedCoefficient) { +        if (GT_Mod.gregtechproxy.mUndergroundOil.CheckBlackList(chunk.worldObj.provider.dimensionId)) return null; +        World aWorld = chunk.worldObj; + +        //Read hash map +        HashMap<ChunkCoordIntPair, int[]> chunkData = dimensionWiseChunkData.get(aWorld.provider.dimensionId); +        if(chunkData==null){ +            chunkData=new HashMap<>(1024); +            dimensionWiseChunkData.put(aWorld.provider.dimensionId,chunkData); +        } + +        int[] tInts = chunkData.get(chunk.getChunkCoordIntPair()); + +        if(tInts==null) tInts=getDefaultChunkDataOnCreation();//init if null +        else if(tInts[GTOIL]==0){//FAST stop +            //can return 0 amount stack for info :D +            return drainSpeedCoefficient>=0 ? null : new FluidStack(FluidRegistry.getFluid(tInts[GTOILFLUID]),0); +        } + +        //GEN IT TO GET OBJECT... +        XSTR tRandom = new XSTR(aWorld.getSeed() + aWorld.provider.dimensionId * 2 + +                       (chunk.getChunkCoordIntPair().chunkXPos>>3) + +                8267 * (chunk.getChunkCoordIntPair().chunkZPos>>3)); +        GT_UO_Fluid uoFluid = GT_Mod.gregtechproxy.mUndergroundOil.GetDimension(aWorld.provider.dimensionId).getRandomFluid(tRandom); + +        //Fluid stack holder +        FluidStack fluidInChunk; + +        //Set fluidstack from uoFluid +        if (uoFluid == null || uoFluid.getFluid()==null){ +            tInts[GTOILFLUID]=Integer.MAX_VALUE;//null fluid pointer... kindof +            tInts[GTOIL]=0; +            chunkData.put(chunk.getChunkCoordIntPair(),tInts);//update hash map +            return null; +        } else { +            if(tInts[GTOILFLUID]== uoFluid.getFluid().getID()){//if stored fluid matches uoFluid +                fluidInChunk = new FluidStack(uoFluid.getFluid(),tInts[GTOIL]); +            }else{ +                fluidInChunk  = new FluidStack(uoFluid.getFluid(), uoFluid.getRandomAmount(tRandom)); +                tRandom=new XSTR(); +                fluidInChunk.amount=(int)((float)fluidInChunk.amount*(0.75f+(tRandom.nextFloat()/2f)));//Randomly change amounts by +/- 25% +            } +            tInts[GTOIL]=fluidInChunk.amount; +            tInts[GTOILFLUID]=fluidInChunk.getFluidID(); +        } + +        //do stuff on it if needed +        if(drainSpeedCoefficient>=0){ +            if(fluidInChunk.amount<DIVIDER){ +                fluidInChunk=null; +                tInts[GTOIL]=0;//so in next access it will stop way above +            }else{ +                fluidInChunk.amount = (int)(fluidInChunk.amount*(double)drainSpeedCoefficient/DIVIDER);//give appropriate amount +                tInts[GTOIL]-=uoFluid.DecreasePerOperationAmount;//diminish amount +            } +        }else{//just get info +            if(fluidInChunk.amount<DIVIDER){ +                fluidInChunk.amount=0;//return informative stack +                tInts[GTOIL]=0;//so in next access it will stop way above +            }else{ +                fluidInChunk.amount=fluidInChunk.amount/DIVIDER;//give moderate extraction speed +            } +        } + +        chunkData.put(chunk.getChunkCoordIntPair(),tInts);//update hash map +        return fluidInChunk; +    } +} diff --git a/src/main/java/gregtech/common/blocks/GT_Material_Casings.java b/src/main/java/gregtech/common/blocks/GT_Material_Casings.java index 211fbdd65f..94afcbd894 100644 --- a/src/main/java/gregtech/common/blocks/GT_Material_Casings.java +++ b/src/main/java/gregtech/common/blocks/GT_Material_Casings.java @@ -13,6 +13,6 @@ public class GT_Material_Casings      }
      public boolean isOpaque() {
 -        return false;
 +        return true;
      }
  }
 diff --git a/src/main/java/gregtech/common/blocks/GT_Material_Reinforced.java b/src/main/java/gregtech/common/blocks/GT_Material_Reinforced.java index a6cf425caa..4aa9ba6931 100644 --- a/src/main/java/gregtech/common/blocks/GT_Material_Reinforced.java +++ b/src/main/java/gregtech/common/blocks/GT_Material_Reinforced.java @@ -12,6 +12,6 @@ public class GT_Material_Reinforced      }      public boolean isOpaque() { -        return false; +        return true;      }  } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java b/src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java index 9c61f4feee..d76a05117b 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java @@ -57,8 +57,8 @@ public class GT_Cover_PlayerDetector extends GT_CoverBehavior {          if(aCoverVariable <0){aCoverVariable = 2;}          switch(aCoverVariable) {              case 0: GT_Utility.sendChatToPlayer(aPlayer, "Emit if any Player is close"); break; -            case 1: GT_Utility.sendChatToPlayer(aPlayer, "Emit if you are close"); break; -            case 2: GT_Utility.sendChatToPlayer(aPlayer, "Emit if other player is close"); break; +            case 1: GT_Utility.sendChatToPlayer(aPlayer, "Emit if other player is close"); break; +            case 2: GT_Utility.sendChatToPlayer(aPlayer, "Emit if you are close"); break;          }          return aCoverVariable;      } diff --git a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneReceiverInternal.java b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneReceiverInternal.java index 3af0a7de99..371928ec58 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneReceiverInternal.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneReceiverInternal.java @@ -2,10 +2,18 @@ package gregtech.common.covers;  import gregtech.api.GregTech_API;
  import gregtech.api.interfaces.tileentity.ICoverable;
 +import gregtech.api.interfaces.tileentity.IMachineProgress;
  public class GT_Cover_RedstoneReceiverInternal
          extends GT_Cover_RedstoneWirelessBase {
      public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
 +        if (aTileEntity instanceof IMachineProgress) {
 +            if (getRedstoneInput(aSide, aInputRedstone, aCoverID, aCoverVariable, aTileEntity) >0)
 +                ((IMachineProgress) aTileEntity).enableWorking();
 +            else
 +                ((IMachineProgress) aTileEntity).disableWorking();
 +            ((IMachineProgress) aTileEntity).setWorkDataValue(aInputRedstone);
 +        }
          return aCoverVariable;
      }
 diff --git a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_03.java b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_03.java index cf57b4edb6..97052a85ae 100644 --- a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_03.java +++ b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_03.java @@ -81,9 +81,9 @@ public class GT_MetaGenerated_Item_03           * 
           * quantum chips
           */
 -        ItemList.Circuit_Silicon_Ingot.set(addItem(tLastID = 30, "Monocrystalline Silicon Ingot", "Raw Circuit", o));
 -        ItemList.Circuit_Silicon_Ingot2.set(addItem(tLastID = 31, "Glowstone doped Monocrystalline Silicon Ingot", "Raw Circuit", o));
 -        ItemList.Circuit_Silicon_Ingot3.set(addItem(tLastID = 32, "Naquadah doped Monocrystalline Silicon Ingot", "Raw Circuit", o));
 +        ItemList.Circuit_Silicon_Ingot.set(addItem(tLastID = 30, "Monocrystalline Silicon Boule", "Raw Circuit", o));
 +        ItemList.Circuit_Silicon_Ingot2.set(addItem(tLastID = 31, "Glowstone doped Monocrystalline Silicon Boule", "Raw Circuit", o));
 +        ItemList.Circuit_Silicon_Ingot3.set(addItem(tLastID = 32, "Naquadah doped Monocrystalline Silicon Boule", "Raw Circuit", o));
          ItemList.Circuit_Silicon_Wafer.set(addItem(tLastID = 33, "Wafer", "Raw Circuit", o));
          ItemList.Circuit_Silicon_Wafer2.set(addItem(tLastID = 34, "Glowstone doped Wafer", "Raw Circuit", o));
 diff --git a/src/main/java/gregtech/common/items/ItemComb.java b/src/main/java/gregtech/common/items/ItemComb.java index ee314c8e31..6ee6d790db 100644 --- a/src/main/java/gregtech/common/items/ItemComb.java +++ b/src/main/java/gregtech/common/items/ItemComb.java @@ -187,15 +187,15 @@ public class ItemComb extends Item {  		if (ProcessingModSupport.aEnableGCMarsMats)  			addProcess(tComb, Materials.MeteoricIron, 100);  		tComb = getStackForType(CombType.STEEL); -		addProcess(tComb, Materials.Iron, Materials.Steel, 100); -		addProcess(tComb, Materials.Magnetite, Materials.Steel, 100); -		addProcess(tComb, Materials.BrownLimonite, Materials.Steel, 100); -		addProcess(tComb, Materials.YellowLimonite, Materials.Steel, 100); -		addProcess(tComb, Materials.VanadiumMagnetite, Materials.VanadiumSteel, 100); -		addProcess(tComb, Materials.BandedIron, Materials.Steel, 100); -		addProcess(tComb, Materials.Pyrite, Materials.Steel, 100); +		addProcess(tComb, Materials.Iron, Materials.Iron, 100); +		addProcess(tComb, Materials.Magnetite, Materials.Magnetite, 100); +		addProcess(tComb, Materials.BrownLimonite, Materials.BrownLimonite, 100); +		addProcess(tComb, Materials.YellowLimonite, Materials.YellowLimonite, 100); +		addProcess(tComb, Materials.VanadiumMagnetite, Materials.VanadiumMagnetite, 100); +		addProcess(tComb, Materials.BandedIron, Materials.BandedIron, 100); +		addProcess(tComb, Materials.Pyrite, Materials.Pyrite, 100);  		if (ProcessingModSupport.aEnableGCMarsMats) -			addProcess(tComb, Materials.MeteoricIron, Materials.MeteoricSteel, 100); +			addProcess(tComb, Materials.MeteoricIron, Materials.MeteoricIron, 100);  		addProcess(tComb, Materials.Molybdenite, 100);  		addProcess(tComb, Materials.Molybdenum, 100);  		tComb = getStackForType(CombType.NICKEL); diff --git a/src/main/java/gregtech/common/items/armor/ModularArmor_Item.java b/src/main/java/gregtech/common/items/armor/ModularArmor_Item.java index d2e51e67f1..761f263d79 100644 --- a/src/main/java/gregtech/common/items/armor/ModularArmor_Item.java +++ b/src/main/java/gregtech/common/items/armor/ModularArmor_Item.java @@ -89,6 +89,7 @@ public class ModularArmor_Item extends ItemArmor implements ISpecialArmor, IGogg  			data = fillArmorData((EntityPlayer) player, armor);  		}  		if (player != null && armor != null && source != null) { +			try{  			double tmp = 0.0d;  			if (source.isMagicDamage()) {  				tmp = data.mStat.get(StatType.MAGICDEFENCE); @@ -127,6 +128,9 @@ public class ModularArmor_Item extends ItemArmor implements ISpecialArmor, IGogg  				tmp = 1.0f - ((1.0f - tmp) / 2.0f);  			}  			return new ISpecialArmor.ArmorProperties(0, data.getBaseAbsorptionRatio() * tmp, 1000); +			}catch(Exception e){System.err.println(e); +			return new ISpecialArmor.ArmorProperties(0, 0, 0); +			}  		} else {  			return new ISpecialArmor.ArmorProperties(0, 0, 0); @@ -266,10 +270,10 @@ public class ModularArmor_Item extends ItemArmor implements ISpecialArmor, IGogg  				}  					aPlayer.openGui(GT_Values.GT, openGuiNr+(typeMod), aWorld, (int) aPlayer.posX, (int) aPlayer.posY, (int) aPlayer.posZ);  			} -			if(data.helmet!=null&&data.helmet.openGui){data.helmet.openGui=false;aPlayer.openGui(GT_Values.GT, openGuiNr+400, aWorld, (int) aPlayer.posX, (int) aPlayer.posY, (int) aPlayer.posZ);} -			if(data.chestplate!=null&&data.chestplate.openGui){data.chestplate.openGui=false;aPlayer.openGui(GT_Values.GT, openGuiNr+300, aWorld, (int) aPlayer.posX, (int) aPlayer.posY, (int) aPlayer.posZ);} -			if(data.leggings!=null&&data.leggings.openGui){data.leggings.openGui=false;aPlayer.openGui(GT_Values.GT, openGuiNr+200, aWorld, (int) aPlayer.posX, (int) aPlayer.posY, (int) aPlayer.posZ);} -			if(data.boots!=null&&data.boots.openGui){data.boots.openGui=false;aPlayer.openGui(GT_Values.GT, openGuiNr+100, aWorld, (int) aPlayer.posX, (int) aPlayer.posY, (int) aPlayer.posZ);} +//			if(data.helmet!=null&&data.helmet.openGui){data.helmet.openGui=false;aPlayer.openGui(GT_Values.GT, openGuiNr+400, aWorld, (int) aPlayer.posX, (int) aPlayer.posY, (int) aPlayer.posZ);} +//			if(data.chestplate!=null&&data.chestplate.openGui){data.chestplate.openGui=false;aPlayer.openGui(GT_Values.GT, openGuiNr+300, aWorld, (int) aPlayer.posX, (int) aPlayer.posY, (int) aPlayer.posZ);} +//			if(data.leggings!=null&&data.leggings.openGui){data.leggings.openGui=false;aPlayer.openGui(GT_Values.GT, openGuiNr+200, aWorld, (int) aPlayer.posX, (int) aPlayer.posY, (int) aPlayer.posZ);} +//			if(data.boots!=null&&data.boots.openGui){data.boots.openGui=false;aPlayer.openGui(GT_Values.GT, openGuiNr+100, aWorld, (int) aPlayer.posX, (int) aPlayer.posY, (int) aPlayer.posZ);}  			// Night Vision  			if (timer >= 200) {  				timer = 0; diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java index b16986fffd..c725634030 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java @@ -148,7 +148,7 @@ public class GT_MetaTileEntity_Boiler_Bronze                  this.mTemperature += 1;              }              if (this.mProcessingEnergy > 0 && (aTick % 20L == 0L)) { -                GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 20); +                GT_Pollution.addPollution(getBaseMetaTileEntity(), 20);              }              aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0);          } diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java index 3e5afedba2..8aef783b6b 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java @@ -127,7 +127,7 @@ public class GT_MetaTileEntity_Boiler_Lava              }
              if (this.mProcessingEnergy > 0 && (aTick % 20L == 0L)) {
 -                GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 20);
 +                GT_Pollution.addPollution(getBaseMetaTileEntity(), 20);
              }
              aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0);
          }
 diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java index 5d7ec97401..92a9b6d7dc 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java @@ -153,7 +153,7 @@ public class GT_MetaTileEntity_Boiler_Steel                  this.mTemperature += 1;
              }
              if (this.mProcessingEnergy > 0 && (aTick % 20L == 0L)) {
 -                GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 20);
 +                GT_Pollution.addPollution(getBaseMetaTileEntity(), 30);
              }
              aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0);
          }
 diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java index 7501924f69..2ae23a0d80 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java @@ -29,7 +29,7 @@ public class GT_MetaTileEntity_LightningRod extends GT_MetaTileEntity_TieredMach      @Override      public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { -        return new ITexture[]{aActive ? new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW) : new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS)}; +        return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1],aSide==1?(aActive ? new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW) : new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS)):Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]};      }      @Override @@ -46,7 +46,12 @@ public class GT_MetaTileEntity_LightningRod extends GT_MetaTileEntity_TieredMach          World aWorld = aBaseMetaTileEntity.getWorld();          XSTR aXSTR = new XSTR();          if (!aWorld.isRemote) { -        	if(aBaseMetaTileEntity.getStoredEU()>0)aBaseMetaTileEntity.decreaseStoredEnergyUnits(aBaseMetaTileEntity.getStoredEU()/100+1, false); +        	if(aBaseMetaTileEntity.getStoredEU()>0){ +                aBaseMetaTileEntity.setActive(true); +        	    aBaseMetaTileEntity.decreaseStoredEnergyUnits(aBaseMetaTileEntity.getStoredEU()/100+1, false); +            }else { +                aBaseMetaTileEntity.setActive(false); +            }              if (aTick % 256 == 0 && (aWorld.isThundering() || (aWorld.isRaining() && aXSTR.nextInt(10) == 0))) {                  int aRodValue = 0; @@ -68,10 +73,8 @@ public class GT_MetaTileEntity_LightningRod extends GT_MetaTileEntity_TieredMach                  }                  if (!aWorld.isThundering() && ((aY + aRodValue) < 128)) aRodValue = 0;                  if (aXSTR.nextInt(4 * aWorld.getHeight()) < (aRodValue * (aY + aRodValue))) { -                    aBaseMetaTileEntity.setActive(true);                      aBaseMetaTileEntity.increaseStoredEnergyUnits(maxEUStore() - aBaseMetaTileEntity.getStoredEU(), false);                      aWorld.addWeatherEffect(new EntityLightningBolt(aWorld, aX, aY + aRodValue, aZ)); -                    aBaseMetaTileEntity.setActive(false);                  }              }          } @@ -94,7 +97,7 @@ public class GT_MetaTileEntity_LightningRod extends GT_MetaTileEntity_TieredMach      @Override      public boolean isFacingValid(byte aFacing) { -        return true; +        return aFacing==1;      }      @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java index 270fef65e3..24eaf87292 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java @@ -22,6 +22,7 @@ import gregtech.api.objects.ItemData;  import gregtech.api.util.GT_ModHandler;  import gregtech.api.util.GT_OreDictUnificator;  import gregtech.api.util.GT_Utility; +import gregtech.common.GT_UndergroundOil;  import gregtech.common.blocks.GT_Block_Ores_Abstract;  import gregtech.common.blocks.GT_TileEntity_Ores;  import ic2.core.Ic2Items; @@ -31,6 +32,7 @@ import net.minecraft.init.Blocks;  import net.minecraft.item.Item;  import net.minecraft.item.ItemStack;  import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.ChunkCoordIntPair;  import net.minecraft.world.ChunkPosition;  import net.minecraftforge.fluids.FluidStack; @@ -141,25 +143,24 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba          int tLeftZBound = GT_Utility.getScaleCoordinates(this.getBaseMetaTileEntity().getZCoord() - radius, 16);          int tRightZBound = GT_Utility.getScaleCoordinates(this.getBaseMetaTileEntity().getZCoord() + radius, 16); -        HashMap<ChunkPosition, FluidStack> tFluids = new HashMap<ChunkPosition, FluidStack>(); +        HashMap<ChunkCoordIntPair, FluidStack> tFluids = new HashMap<>();          try {              for (int x = tLeftXBound; x <= tRightXBound; ++x)                  for (int z = tLeftZBound; z <= tRightZBound; ++z)                   {                  	ChunkPosition tPos = new ChunkPosition(GT_Utility.getScaleCoordinates(x*16,96), 0, GT_Utility.getScaleCoordinates(z*16,96)); -                	FluidStack tFluid = GT_Utility.getUndergroundOil(getBaseMetaTileEntity().getWorld(), x*16, z*16); +                	ChunkCoordIntPair cInts = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(tPos.chunkPosX,tPos.chunkPosZ).getChunkCoordIntPair(); +                	FluidStack tFluid = GT_UndergroundOil.undergroundOil(getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(tPos.chunkPosX,tPos.chunkPosZ),-1);              		if (tFluid != null) -	                	if (tFluids.containsKey(tPos)) -	                	{ -	                		if (tFluids.get(tPos).amount<tFluid.amount) -	                			tFluids.get(tPos).amount = tFluid.amount; -	                	} else if (tFluid.amount / 5000 > 0) -	                        tFluids.put(tPos, tFluid); +	                	if (tFluids.containsKey(cInts)) { +	                		if (tFluids.get(cInts).amount<tFluid.amount) +	                			tFluids.get(cInts).amount = tFluid.amount; +	                	} else tFluids.put(cInts, tFluid);                  } -    		for (HashMap.Entry<ChunkPosition, FluidStack> fl : tFluids.entrySet()) { -    			aOils.put(fl.getKey().chunkPosX + "," + fl.getKey().chunkPosZ + "," + (fl.getValue().amount / 5000) + "," + fl.getValue().getLocalizedName(), fl.getValue().amount / 5000); +    		for (Map.Entry<ChunkCoordIntPair, FluidStack> fl : tFluids.entrySet()) { +    			aOils.put(fl.getKey().chunkXPos + "," + fl.getKey().chunkZPos + "," + fl.getValue().amount + "," + fl.getValue().getLocalizedName(), fl.getValue().amount);      		}  		} catch (Exception e) {  			// TODO: handle exception diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java index a60ed1daed..859dd0a6e1 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java @@ -111,7 +111,8 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt          mPassiveEnergyUse = aConfig.get(ConfigCategories.machineconfig, "MicrowaveTransmitter.PassiveEnergy", true);      } -    public void onFirstTick() { +    @Override +    public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {          if (getBaseMetaTileEntity().isServerSide()) {              if ((this.mTargetX == 0) && (this.mTargetY == 0) && (this.mTargetZ == 0) && (this.mTargetD == 0)) {                  this.mTargetX = getBaseMetaTileEntity().getXCoord(); diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java index b088e10d69..85defad0cb 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java @@ -12,6 +12,7 @@ import gregtech.api.objects.GT_RenderedTexture;  import gregtech.api.objects.ItemData;  import gregtech.api.util.GT_OreDictUnificator;  import gregtech.api.util.GT_Utility; +import gregtech.common.GT_UndergroundOil;  import gregtech.common.blocks.GT_Block_Ores_Abstract;  import gregtech.common.blocks.GT_TileEntity_Ores;  import ic2.core.Ic2Items; @@ -102,7 +103,7 @@ public class GT_MetaTileEntity_SeismicProspector extends GT_MetaTileEntity_Basic                      }                  }                  if(tStringList.size()<1){tStringList.add("No Ores found.");} -                FluidStack tFluid = GT_Utility.getUndergroundOil(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord()); +                FluidStack tFluid = GT_UndergroundOil.undergroundOil(getBaseMetaTileEntity(),-1);                  String[] tStringArray = new String[tStringList.size()];                  {                      for (int i = 0; i < tStringArray.length; i++) { diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java index a834e48db7..aa4e5645a0 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java @@ -205,7 +205,8 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank {          sFPowerMultiplyer = sPowerMultiplyer / 100.0;              } -    public void onFirstTick() { +    @Override +    public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {          if (getBaseMetaTileEntity().isServerSide()) {              if ((this.mTargetX == 0) && (this.mTargetY == 0) && (this.mTargetZ == 0) && (this.mTargetD == 0)) {                  this.mTargetX = getBaseMetaTileEntity().getXCoord(); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java index ea8eb2f7ba..3b287d9ca4 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java @@ -23,6 +23,7 @@ import net.minecraft.init.Items;  import net.minecraft.item.ItemStack;
  import net.minecraft.nbt.NBTTagCompound;
  import net.minecraft.world.ChunkPosition;
 +import net.minecraft.world.World;
  import net.minecraftforge.common.util.ForgeDirection;
  public class GT_MetaTileEntity_BronzeBlastFurnace
 @@ -187,10 +188,6 @@ public class GT_MetaTileEntity_BronzeBlastFurnace      }
      public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
 -        if ((aBaseMetaTileEntity.isClientSide()) &&
 -                (aBaseMetaTileEntity.isActive())) {
 -            aBaseMetaTileEntity.getWorld().spawnParticle("largesmoke", aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), 0.0D, 0.3D, 0.0D);
 -        }
          if (aBaseMetaTileEntity.isServerSide()) {
              if (this.mUpdate-- == 0) {
                  this.mMachine = checkMachine();
 @@ -210,7 +207,7 @@ public class GT_MetaTileEntity_BronzeBlastFurnace                  }
              }
              if(this.mMaxProgresstime>0 && (aTimer % 20L == 0L)){
 -            	GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 50);
 +            	GT_Pollution.addPollution(getBaseMetaTileEntity(), 50);
              }
              aBaseMetaTileEntity.setActive((this.mMaxProgresstime > 0) && (this.mMachine));
 @@ -233,8 +230,20 @@ public class GT_MetaTileEntity_BronzeBlastFurnace                      this.mUpdate = 1;
                  }
              }
 +        }else if(aBaseMetaTileEntity.isActive()){
 +            World aWorld=aBaseMetaTileEntity.getWorld();
 +            double xPos=aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1);
 +            double yPos=aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1)+0.05F;
 +            double zPos=aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1);
 +            XSTR floatGen=new XSTR();
 +            aWorld.spawnParticle("largesmoke", xPos + floatGen.nextFloat(), yPos, zPos + floatGen.nextFloat(), 0.0D, 0.3D, 0.0D);
 +            //Pollution particles intensify
 +            if(GT_Pollution.getPollution(getBaseMetaTileEntity())>GT_Mod.gregtechproxy.mPollutionSmogLimit){
 +                aWorld.spawnParticle("largesmoke", xPos + floatGen.nextFloat(), yPos, zPos + floatGen.nextFloat(), 0.0D, 0.45D, 0.0D);
 +                aWorld.spawnParticle("largesmoke", xPos + floatGen.nextFloat(), yPos, zPos + floatGen.nextFloat(), 0.0D, 0.6D, 0.0D);
 +            }
          }
 -    }
 +}
      private void addOutputProducts() {
          if (this.mOutputItem1 != null) {
 diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java index 11c0fd109a..ff3af18e53 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java @@ -87,7 +87,7 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_MultiBlock              this.mEfficiency = 10000;              this.mEfficiencyIncrease = 10000;              this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); -            GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), mMaxProgresstime*5); +            GT_Pollution.addPollution(getBaseMetaTileEntity(), mMaxProgresstime*5);              return true;          } else {              this.mEfficiency = 0; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java index 015670cb02..6d3bf94534 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java @@ -148,9 +148,18 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas          if (doorState) {              mEfficiency = Math.max(0, mEfficiency - 200);          } - +        for(byte i = 0 ; i<6 ; i++){ +        	byte t = (byte) Math.max(1, (byte)(15/(10000f / mEfficiency))); +        aBaseMetaTileEntity.setInternalOutputRedstoneSignal(i, t); +        } +                  return true;      } +     +    @Override +    public boolean allowGeneralRedstoneOutput(){ +    	return true; +    }      public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {          if (aSide == 0 || aSide == 1) { diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java index 22dd01c755..78f247bb3b 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java @@ -90,7 +90,7 @@ public class GT_MetaTileEntity_DistillationTower          long tVoltage = getMaxInputVoltage();          byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); -        FluidStack[] tFluids = (FluidStack[]) Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tFluidList.size()]), 0, tFluidList.size()); +        FluidStack[] tFluids = tFluidList.toArray(new FluidStack[tFluidList.size()]);          if (tFluids.length > 0) {          	for(int i = 0;i<tFluids.length;i++){              GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sDistillationRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[]{tFluids[i]}, new ItemStack[]{}); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java index e0d0ee46d1..0f07a3e743 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java @@ -91,7 +91,7 @@ public class GT_MetaTileEntity_ElectricBlastFurnace                  }
              }
          }
 -        ItemStack[] tInputs = Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2);
 +        ItemStack[] tInputs = tInputList.toArray(new ItemStack[tInputList.size()]);
          ArrayList<FluidStack> tFluidList = getStoredFluids();
          int tFluidList_sS = tFluidList.size();
 diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java index 81e9485ecf..090b84320b 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java @@ -83,7 +83,7 @@ public class GT_MetaTileEntity_ImplosionCompressor                  }
              }
          }
 -        ItemStack[] tInputs = (ItemStack[]) Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2);
 +        ItemStack[] tInputs = tInputList.toArray(new ItemStack[tInputList.size()]);
          if (tInputList.size() > 0) {
              GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sImplosionRecipes.findRecipe(getBaseMetaTileEntity(), false, 9223372036854775807L, null, tInputs);
              if ((tRecipe != null) && (tRecipe.isRecipeInputEqual(true, null, tInputs))) {
 diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill.java index 60863e4c52..c86bdce89d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill.java @@ -18,6 +18,8 @@ import net.minecraftforge.fluids.FluidStack;  import java.util.ArrayList; +import static gregtech.common.GT_UndergroundOil.undergroundOil; +  public class GT_MetaTileEntity_OilDrill extends GT_MetaTileEntity_MultiBlockBase {      private boolean completedCycle = false; @@ -73,12 +75,13 @@ public class GT_MetaTileEntity_OilDrill extends GT_MetaTileEntity_MultiBlockBase                  }              }          } -        FluidStack tFluid = GT_Utility.getUndergroundOil(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord(), true); +        FluidStack tFluid = undergroundOil(getBaseMetaTileEntity(),.5F+(getInputTier()*.25F));          if (tFluid == null) {          	stopMachine();              return false;          }          if (getYOfPumpHead() > 0 && getBaseMetaTileEntity().getBlockOffset(ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX, getYOfPumpHead() - 1 - getBaseMetaTileEntity().getYCoord(), ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ) != Blocks.bedrock) { +              if (completedCycle) {                  moveOneDown();              } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java index db8462f76b..b45c0da6ca 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java @@ -1,5 +1,6 @@  package gregtech.common.tileentities.machines.multi; +import gregtech.GT_Mod;  import gregtech.api.GregTech_API;  import gregtech.api.enums.Textures;  import gregtech.api.gui.GT_GUIContainer_MultiMachine; @@ -22,6 +23,8 @@ import java.util.Arrays;  import java.util.Collections;  import java.util.List; +import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine.isValidForLowGravity; +  public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBlockBase {      GT_Recipe mLastRecipe; @@ -64,7 +67,7 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl      public GT_Recipe.GT_Recipe_Map getRecipeMap() {          if (mInventory[1] == null) return null; -        String tmp = mInventory[1].getUnlocalizedName().replaceAll("gt.blockmachines.basicmachine.", ""); +        String tmp = mInventory[1].getUnlocalizedName().replaceAll("gt\\.blockmachines\\.basicmachine\\.", "");          if (tmp.startsWith("centrifuge")) {              return GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes;          } else if (tmp.startsWith("electrolyzer")) { @@ -131,8 +134,25 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl              return GT_Recipe.GT_Recipe_Map.sPolarizerRecipes;          } else if(tmp.startsWith("press")){              return GT_Recipe.GT_Recipe_Map.sPressRecipes; +        } else if (tmp.startsWith("plasmaarcfurnace")) { +            return GT_Recipe.GT_Recipe_Map.sPlasmaArcFurnaceRecipes; +        } else if (tmp.startsWith("printer")) { +            return GT_Recipe.GT_Recipe_Map.sPrinterRecipes; +        } else if (tmp.startsWith("press")) { +            return GT_Recipe.GT_Recipe_Map.sPressRecipes; +        } else if (tmp.startsWith("fluidcanner")) { +            return GT_Recipe.GT_Recipe_Map.sFluidCannerRecipes; +        } else if (tmp.startsWith("fluidheater")) { +            return GT_Recipe.GT_Recipe_Map.sFluidHeaterRecipes; +        } else if (tmp.startsWith("distillery")) { +            return GT_Recipe.GT_Recipe_Map.sDistilleryRecipes; +        } else if (tmp.startsWith("slicer")) { +            return GT_Recipe.GT_Recipe_Map.sSlicerRecipes; +        } else if (tmp.startsWith("amplifier")) { +            return GT_Recipe.GT_Recipe_Map.sAmplifiers; +        } else if (tmp.startsWith("circuitassembler")) { +            return GT_Recipe.GT_Recipe_Map.sCircuitAssemblerRecipes;          } -          return null;      } @@ -153,9 +173,7 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl              return false;          }          GT_Recipe.GT_Recipe_Map map = getRecipeMap(); -        if (map == null) { -            return false; -        } +        if (map == null) return false;          ArrayList<ItemStack> tInputList = getStoredInputs();          int tTier = 0;          if (mInventory[1].getUnlocalizedName().endsWith("1")) { @@ -186,6 +204,10 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl          if (tInputList.size() > 0 || tFluids.length > 0) {              GT_Recipe tRecipe = map.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);              if (tRecipe != null) { +                if (GT_Mod.gregtechproxy.mLowGravProcessing && tRecipe.mSpecialValue == -100 && +                        !isValidForLowGravity(tRecipe,getBaseMetaTileEntity().getWorld().provider.dimensionId)) +                    return false; +                  mLastRecipe = tRecipe;                  this.mEUt = 0;                  this.mOutputItems = null; diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingPlate.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingPlate.java index 2e00133a69..64a8edaa5b 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingPlate.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingPlate.java @@ -85,7 +85,7 @@ public class ProcessingPlate implements gregtech.api.interfaces.IOreRecipeRegist                  if (aMaterial.mFuelPower > 0)                      GT_Values.RA.addFuel(GT_Utility.copyAmount(1L, new Object[]{aStack}), null, aMaterial.mFuelPower, aMaterial.mFuelType);                  GT_Utility.removeSimpleIC2MachineRecipe(GT_Utility.copyAmount(9L, new Object[]{aStack}), GT_ModHandler.getCompressorRecipeList(), GT_OreDictUnificator.get(OrePrefixes.plateDense, aMaterial, 1L)); -                GT_Values.RA.addImplosionRecipe(GT_Utility.copyAmount(2L, new Object[]{aStack}), 2, GT_OreDictUnificator.get(OrePrefixes.compressed, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L)); +                GT_Values.RA.addImplosionRecipe(GT_Utility.copyAmount(aMaterial == Materials.MeteoricIron ? 1 : 2, new Object[]{aStack}), 2, GT_OreDictUnificator.get(OrePrefixes.compressed, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.DarkAsh, 1L));                  GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, aMaterial, 2L), GT_Proxy.tBits, new Object[]{"hX", 'X', OrePrefixes.plate.get(aMaterial)});                  if (aMaterial == Materials.Paper) diff --git a/src/main/java/gregtech/loaders/postload/GT_CraftingRecipeLoader.java b/src/main/java/gregtech/loaders/postload/GT_CraftingRecipeLoader.java index 97b6f89c41..9ac3228e4c 100644 --- a/src/main/java/gregtech/loaders/postload/GT_CraftingRecipeLoader.java +++ b/src/main/java/gregtech/loaders/postload/GT_CraftingRecipeLoader.java @@ -436,6 +436,7 @@ public class GT_CraftingRecipeLoader implements Runnable {          }          if (GT_Mod.gregtechproxy.mNerfDustCrafting) {              GT_ModHandler.addShapelessCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dustSmall, Materials.Electrum, 6L), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{OrePrefixes.dust.get(Materials.Silver), OrePrefixes.dust.get(Materials.Gold)}); +            GT_ModHandler.removeRecipeByOutput(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Brass, 1L));              GT_ModHandler.addShapelessCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Brass, 3L), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{OrePrefixes.dust.get(Materials.AnyCopper), OrePrefixes.dust.get(Materials.AnyCopper), OrePrefixes.dust.get(Materials.AnyCopper), OrePrefixes.dust.get(Materials.Zinc)});              GT_ModHandler.addShapelessCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dustSmall, Materials.Brass, 9L), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{OrePrefixes.dust.get(Materials.Tetrahedrite), OrePrefixes.dust.get(Materials.Tetrahedrite), OrePrefixes.dust.get(Materials.Tetrahedrite), OrePrefixes.dust.get(Materials.Zinc)});              GT_ModHandler.addShapelessCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Bronze, 3L), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{OrePrefixes.dust.get(Materials.AnyCopper), OrePrefixes.dust.get(Materials.AnyCopper), OrePrefixes.dust.get(Materials.AnyCopper), OrePrefixes.dust.get(Materials.Tin)}); diff --git a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java index 1daeb77eba..e5376e4a22 100644 --- a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java +++ b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java @@ -651,7 +651,8 @@ if(Loader.isModLoaded("Railcraft")){          GT_Values.RA.addUniversalDistillationRecipe(Materials.OilHeavy.getFluid(100), new FluidStack[]{Materials.SulfuricGas.getGas(60), Materials.SulfuricNaphtha.getFluid(15), Materials.SulfuricLightFuel.getFluid(45), Materials.SulfuricHeavyFuel.getFluid(250)}, null, 20, 288);          GT_Values.RA.addUniversalDistillationRecipe(Materials.CrackedLightFuel.getFluid(192), new FluidStack[]{Materials.Gas.getGas(480), Materials.Naphtha.getFluid(60), Materials.HeavyFuel.getFluid(20), new FluidStack(ItemList.sToluene,20)}, null, 16, 120);          GT_Values.RA.addUniversalDistillationRecipe(Materials.CrackedHeavyFuel.getFluid(192), new FluidStack[]{Materials.Gas.getGas(160), Materials.Naphtha.getFluid(20), Materials.LightFuel.getFluid(80), new FluidStack(ItemList.sToluene,60), Materials.Lubricant.getFluid(10)}, GT_OreDictUnificator.get(OrePrefixes.dustTiny, Materials.HydratedCoal, 1L), 16, 120); - +        GT_Values.RA.addDistilleryRecipe(ItemList.Circuit_Integrated.getWithDamage(0L, 1L, new Object[0]), new FluidStack(ItemList.sOilExtraHeavy,10), Materials.OilHeavy.getFluid(15), 16, 24, false); +                  GT_Values.RA.addDistilleryRecipe(ItemList.Circuit_Integrated.getWithDamage(0L, 1L, new Object[0]), Materials.HeavyFuel.getFluid(10L), new FluidStack(ItemList.sToluene,4), 16, 24, false);          GT_Values.RA.addDistilleryRecipe(ItemList.Circuit_Integrated.getWithDamage(0L, 1L, new Object[0]), new FluidStack(ItemList.sToluene,30), Materials.LightFuel.getFluid(30L), 16, 24, false);          GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Ball.get(0L, new Object[0]), new FluidStack(ItemList.sToluene,100), ItemList.GelledToluene.get(1, new Object[0]), 100, 16); | 
