aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/common')
-rw-r--r--src/main/java/gregtech/common/GT_Proxy.java4
-rw-r--r--src/main/java/gregtech/common/GT_UndergroundOil.java41
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Ores.java28
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java14
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Ores_UB1.java7
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Ores_UB2.java7
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Ores_UB3.java7
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Item_Machines.java21
-rw-r--r--src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java2
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java2
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java3
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java2
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java2
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java2
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller1.java51
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller2.java66
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfillerBase.java125
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java357
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill.java270
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill1.java51
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill2.java51
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill3.java51
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java153
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java8
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java7
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java7
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java8
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java22
-rw-r--r--src/main/java/gregtech/common/tools/GT_Tool_Scoop.java12
29 files changed, 1035 insertions, 346 deletions
diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java
index f6d4ca65a7..d9bc047b45 100644
--- a/src/main/java/gregtech/common/GT_Proxy.java
+++ b/src/main/java/gregtech/common/GT_Proxy.java
@@ -194,6 +194,10 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
public boolean mBrickedBlastFurnace = true;
public boolean mEasierIVPlusCables = false;
public boolean mMixedOreOnlyYieldsTwoThirdsOfPureOre = false;
+ public boolean enableBlackGraniteOres = true;
+ public boolean enableRedGraniteOres = true;
+ public boolean enableMarbleOres = true;
+ public boolean enableBasaltOres = true;
public GT_Proxy() {
GameRegistry.registerFuelHandler(this);
diff --git a/src/main/java/gregtech/common/GT_UndergroundOil.java b/src/main/java/gregtech/common/GT_UndergroundOil.java
index 83262716ae..f090498a4e 100644
--- a/src/main/java/gregtech/common/GT_UndergroundOil.java
+++ b/src/main/java/gregtech/common/GT_UndergroundOil.java
@@ -19,14 +19,23 @@ import static gregtech.common.GT_Proxy.*;
*/
public class GT_UndergroundOil {
public static final short DIVIDER=5000;
+ private static final XSTR random=new XSTR();
- public static FluidStack undergroundOil(IGregTechTileEntity te, float drainSpeedCoefficient){
- return undergroundOil(te.getWorld().getChunkFromBlockCoords(te.getXCoord(),te.getZCoord()),drainSpeedCoefficient);
+ public static FluidStack undergroundOilReadInformation(IGregTechTileEntity te){
+ return undergroundOil(te.getWorld().getChunkFromBlockCoords(te.getXCoord(),te.getZCoord()),-1);
+ }
+
+ public static FluidStack undergroundOilReadInformation(Chunk chunk) {
+ return undergroundOil(chunk,-1);
+ }
+
+ public static FluidStack undergroundOil(IGregTechTileEntity te, float readOrDrainCoefficient){
+ return undergroundOil(te.getWorld().getChunkFromBlockCoords(te.getXCoord(),te.getZCoord()),readOrDrainCoefficient);
}
//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) {
+ public static FluidStack undergroundOil(Chunk chunk, float readOrDrainCoefficient) {
if (GT_Mod.gregtechproxy.mUndergroundOil.CheckBlackList(chunk.worldObj.provider.dimensionId)) return null;
World aWorld = chunk.worldObj;
@@ -42,11 +51,11 @@ public class GT_UndergroundOil {
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);
+ return readOrDrainCoefficient>=0 ? null : new FluidStack(FluidRegistry.getFluid(tInts[GTOILFLUID]),0);
}
//GEN IT TO GET OBJECT...
- XSTR tRandom = new XSTR(aWorld.getSeed() + aWorld.provider.dimensionId * 2 +
+ final 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);
@@ -65,24 +74,32 @@ public class GT_UndergroundOil {
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%
+ fluidInChunk.amount=(int)((float)fluidInChunk.amount*(0.75f+(random.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){
+ if(readOrDrainCoefficient>=0){
+ int fluidExtracted=(int)Math.floor(fluidInChunk.amount * (double) readOrDrainCoefficient / DIVIDER);
+ double averageDecrease=uoFluid.DecreasePerOperationAmount * (double)readOrDrainCoefficient;
+ int decrease=(int)Math.ceil(averageDecrease);
+ if(fluidExtracted<=0 || fluidInChunk.amount<=decrease){//decrease - here it is max value of extraction for easy check
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
+ fluidInChunk.amount = fluidExtracted;//give appropriate amount
+ if(random.nextFloat()<(decrease-averageDecrease)) decrease--;//use random to "subtract double from int"
+ //ex.
+ // averageDecrease=3.9
+ // decrease= ceil from 3.9 = 4
+ // decrease-averageDecrease=0.1 -> chance to subtract 1
+ // if random is < chance then subtract 1
+ tInts[GTOIL]-=decrease;//diminish amount, "randomly" adjusted to double value (averageDecrease)
}
}else{//just get info
- if(fluidInChunk.amount<DIVIDER){
+ if(fluidInChunk.amount<=DIVIDER){
fluidInChunk.amount=0;//return informative stack
tInts[GTOIL]=0;//so in next access it will stop way above
}else{
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Ores.java b/src/main/java/gregtech/common/blocks/GT_Block_Ores.java
index 70200e5199..bab31d85ed 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Ores.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Ores.java
@@ -1,5 +1,6 @@
package gregtech.common.blocks;
+import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
@@ -47,27 +48,16 @@ public class GT_Block_Ores extends GT_Block_Ores_Abstract {
@Override
public Materials[] getDroppedDusts() { //Must have 8 entries; can be null.
- return new Materials[]{Materials.Stone, Materials.Netherrack, Materials.Endstone, Materials.GraniteBlack, Materials.GraniteRed, Materials.Marble, Materials.Basalt, null};
+ return new Materials[]{Materials.Stone, Materials.Netherrack, Materials.Endstone, Materials.GraniteBlack, Materials.GraniteRed, Materials.Marble, Materials.Basalt, Materials.Stone};
+ }
+
+ @Override
+ public boolean[] getEnabledMetas() {
+ return new boolean[]{true, true, true, GT_Mod.gregtechproxy.enableBlackGraniteOres, GT_Mod.gregtechproxy.enableRedGraniteOres, GT_Mod.gregtechproxy.enableMarbleOres, GT_Mod.gregtechproxy.enableBasaltOres, true};
}
@Override
public ITexture[] getTextureSet() { //Must have 16 entries.
- return new ITexture[]{
- new GT_CopiedBlockTexture(Blocks.stone, 0, 0),
- new GT_CopiedBlockTexture(Blocks.netherrack, 0, 0),
- new GT_CopiedBlockTexture(Blocks.end_stone, 0, 0),
- new GT_RenderedTexture(Textures.BlockIcons.GRANITE_BLACK_STONE),
- new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE),
- new GT_RenderedTexture(Textures.BlockIcons.MARBLE_STONE),
- new GT_RenderedTexture(Textures.BlockIcons.BASALT_STONE),
- new GT_CopiedBlockTexture(Blocks.stone, 0, 0),
- new GT_CopiedBlockTexture(Blocks.stone, 0, 0),
- new GT_CopiedBlockTexture(Blocks.netherrack, 0, 0),
- new GT_CopiedBlockTexture(Blocks.end_stone, 0, 0),
- new GT_RenderedTexture(Textures.BlockIcons.GRANITE_BLACK_STONE),
- new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE),
- new GT_RenderedTexture(Textures.BlockIcons.MARBLE_STONE),
- new GT_RenderedTexture(Textures.BlockIcons.BASALT_STONE),
- new GT_CopiedBlockTexture(Blocks.stone, 0, 0)};
+ return new ITexture[]{new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.netherrack, 0, 0), new GT_CopiedBlockTexture(Blocks.end_stone, 0, 0), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_BLACK_STONE), new GT_RenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_RenderedTexture(Textures.BlockIcons.MARBLE_STONE), new GT_RenderedTexture(Textures.BlockIcons.BASALT_STONE), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0)};
}
-}
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java b/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java
index 1d63d8bfb8..5595fa8673 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Ores_Abstract.java
@@ -30,14 +30,17 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements ITileEntityProvider {
- public static ThreadLocal<GT_TileEntity_Ores> mTemporaryTileEntity = new ThreadLocal<>();
+ public static ThreadLocal<GT_TileEntity_Ores> mTemporaryTileEntity = new ThreadLocal();
public static boolean FUCKING_LOCK = false;
public static boolean tHideOres;
private final String aTextName = ".name";
private final String aTextSmall = "Small ";
+ public static Set aBlockedOres = new HashSet<Materials>();
protected GT_Block_Ores_Abstract(String aUnlocalizedName, int aOreMetaCount, boolean aHideFirstMeta, Material aMaterial) {
super(GT_Item_Ores.class, aUnlocalizedName, aMaterial);
@@ -45,7 +48,7 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements
setStepSound(soundTypeStone);
setCreativeTab(GregTech_API.TAB_GREGTECH_ORES);
tHideOres = Loader.isModLoaded("NotEnoughItems") && GT_Mod.gregtechproxy.mHideUnusedOres;
- if (aOreMetaCount > 8 || aOreMetaCount < 0) aOreMetaCount = 8;
+ if(aOreMetaCount > 8 || aOreMetaCount < 0) aOreMetaCount = 8;
for (int i = 0; i < 16; i++) {
GT_ModHandler.addValuableOre(this, i, 1);
@@ -53,9 +56,10 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements
for (int i = 1; i < GregTech_API.sGeneratedMaterials.length; i++) {
if (GregTech_API.sGeneratedMaterials[i] != null) {
for (int j = 0; j < aOreMetaCount; j++) {
+ if (!this.getEnabledMetas()[j]) continue;
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + (i + (j * 1000)) + aTextName, getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + "." + ((i + 16000) + (j * 1000)) + aTextName, aTextSmall + getLocalizedName(GregTech_API.sGeneratedMaterials[i]));
- if ((GregTech_API.sGeneratedMaterials[i].mTypes & 0x8) != 0) {
+ if ((GregTech_API.sGeneratedMaterials[i].mTypes & 0x8) != 0 && !aBlockedOres.contains(GregTech_API.sGeneratedMaterials[i])) {
GT_OreDictUnificator.registerOre(this.getProcessingPrefix()[j] != null ? this.getProcessingPrefix()[j].get(GregTech_API.sGeneratedMaterials[i]) : "", new ItemStack(this, 1, i + (j * 1000)));
if (tHideOres) {
if (!(j == 0 && !aHideFirstMeta)) {
@@ -222,6 +226,8 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements
public abstract OrePrefixes[] getProcessingPrefix(); //Must have 8 entries; an entry can be null to disable automatic recipes.
+ public abstract boolean[] getEnabledMetas(); //Must have 8 entries.
+
public abstract Block getDroppedBlock();
public abstract Materials[] getDroppedDusts(); //Must have 8 entries; can be null.
@@ -244,7 +250,7 @@ public abstract class GT_Block_Ores_Abstract extends GT_Generic_Block implements
public void getSubBlocks(Item aItem, CreativeTabs aTab, List aList) {
for (int i = 0; i < GregTech_API.sGeneratedMaterials.length; i++) {
Materials tMaterial = GregTech_API.sGeneratedMaterials[i];
- if ((tMaterial != null) && ((tMaterial.mTypes & 0x8) != 0)) {
+ if ((tMaterial != null) && ((tMaterial.mTypes & 0x8) != 0)&& !aBlockedOres.contains(tMaterial)) {
if (!(new ItemStack(aItem, 1, i).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i));
if (!(new ItemStack(aItem, 1, i + 1000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 1000));
if (!(new ItemStack(aItem, 1, i + 2000).getDisplayName().contains(aTextName))) aList.add(new ItemStack(aItem, 1, i + 2000));
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB1.java b/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB1.java
index 52c5710ae9..bea2320f01 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB1.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB1.java
@@ -44,7 +44,12 @@ public class GT_Block_Ores_UB1 extends GT_Block_Ores_Abstract {
}
@Override
+ public boolean[] getEnabledMetas() {
+ return new boolean[]{true, true, true, true, true, true, true, true};
+ }
+
+ @Override
public ITexture[] getTextureSet() { //Must have 16 entries.
return new ITexture[]{new GT_CopiedBlockTexture(aUBBlock, 0, 0), new GT_CopiedBlockTexture(aUBBlock, 0, 1), new GT_CopiedBlockTexture(aUBBlock, 0, 2), new GT_CopiedBlockTexture(aUBBlock, 0, 3), new GT_CopiedBlockTexture(aUBBlock, 0, 4), new GT_CopiedBlockTexture(aUBBlock, 0, 5), new GT_CopiedBlockTexture(aUBBlock, 0, 6), new GT_CopiedBlockTexture(aUBBlock, 0, 7), new GT_CopiedBlockTexture(aUBBlock, 0, 0), new GT_CopiedBlockTexture(aUBBlock, 0, 1), new GT_CopiedBlockTexture(aUBBlock, 0, 2), new GT_CopiedBlockTexture(aUBBlock, 0, 3), new GT_CopiedBlockTexture(aUBBlock, 0, 4), new GT_CopiedBlockTexture(aUBBlock, 0, 5), new GT_CopiedBlockTexture(aUBBlock, 0, 6), new GT_CopiedBlockTexture(aUBBlock, 0, 7)};
}
-}
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB2.java b/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB2.java
index 78526c84c5..d3278f0cb4 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB2.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB2.java
@@ -44,7 +44,12 @@ public class GT_Block_Ores_UB2 extends GT_Block_Ores_Abstract {
}
@Override
+ public boolean[] getEnabledMetas() {
+ return new boolean[]{true, true, true, true, true, true, true, true};
+ }
+
+ @Override
public ITexture[] getTextureSet() { //Must have 16 entries.
return new ITexture[]{new GT_CopiedBlockTexture(aUBBlock, 0, 0), new GT_CopiedBlockTexture(aUBBlock, 0, 1), new GT_CopiedBlockTexture(aUBBlock, 0, 2), new GT_CopiedBlockTexture(aUBBlock, 0, 3), new GT_CopiedBlockTexture(aUBBlock, 0, 4), new GT_CopiedBlockTexture(aUBBlock, 0, 5), new GT_CopiedBlockTexture(aUBBlock, 0, 6), new GT_CopiedBlockTexture(aUBBlock, 0, 7), new GT_CopiedBlockTexture(aUBBlock, 0, 0), new GT_CopiedBlockTexture(aUBBlock, 0, 1), new GT_CopiedBlockTexture(aUBBlock, 0, 2), new GT_CopiedBlockTexture(aUBBlock, 0, 3), new GT_CopiedBlockTexture(aUBBlock, 0, 4), new GT_CopiedBlockTexture(aUBBlock, 0, 5), new GT_CopiedBlockTexture(aUBBlock, 0, 6), new GT_CopiedBlockTexture(aUBBlock, 0, 7)};
}
-}
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB3.java b/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB3.java
index dc5e07a115..7942d80b22 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB3.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB3.java
@@ -44,7 +44,12 @@ public class GT_Block_Ores_UB3 extends GT_Block_Ores_Abstract {
}
@Override
+ public boolean[] getEnabledMetas() {
+ return new boolean[]{true, true, true, true, true, true, true, true};
+ }
+
+ @Override
public ITexture[] getTextureSet() { //Must have 16 entries.
return new ITexture[]{new GT_CopiedBlockTexture(aUBBlock, 0, 0), new GT_CopiedBlockTexture(aUBBlock, 0, 1), new GT_CopiedBlockTexture(aUBBlock, 0, 2), new GT_CopiedBlockTexture(aUBBlock, 0, 3), new GT_CopiedBlockTexture(aUBBlock, 0, 4), new GT_CopiedBlockTexture(aUBBlock, 0, 5), new GT_CopiedBlockTexture(aUBBlock, 0, 6), new GT_CopiedBlockTexture(aUBBlock, 0, 7), new GT_CopiedBlockTexture(aUBBlock, 0, 0), new GT_CopiedBlockTexture(aUBBlock, 0, 1), new GT_CopiedBlockTexture(aUBBlock, 0, 2), new GT_CopiedBlockTexture(aUBBlock, 0, 3), new GT_CopiedBlockTexture(aUBBlock, 0, 4), new GT_CopiedBlockTexture(aUBBlock, 0, 5), new GT_CopiedBlockTexture(aUBBlock, 0, 6), new GT_CopiedBlockTexture(aUBBlock, 0, 7)};
}
-}
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
index a48ea8d3c5..aa54506468 100644
--- a/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
+++ b/src/main/java/gregtech/common/blocks/GT_Item_Machines.java
@@ -39,13 +39,18 @@ public class GT_Item_Machines
int i = 0;
for (String tDescription : tTileEntity.getDescription()) {
if (GT_Utility.isStringValid(tDescription)) {
- if(tDescription.contains("%%%")){
- String[] tString = tDescription.split("%%%");
- if(tString.length>=2){
- aList.add(GT_LanguageManager.addStringLocalization("TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, tString[0], !GregTech_API.sPostloadFinished )+" "+tString[1]);
- }
- }else{String tTranslated = GT_LanguageManager.addStringLocalization("TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, tDescription, !GregTech_API.sPostloadFinished );
- aList.add(tTranslated.equals("") ? tDescription : tTranslated);}
+ if(tDescription.contains("%%%")){
+ String[] tString = tDescription.split("%%%");
+ if(tString.length>=2){
+ StringBuffer tBuffer = new StringBuffer();
+ Object tRep[] = new String[tString.length / 2];
+ for (int j = 0; j < tString.length; j++)
+ if (j % 2 == 0) tBuffer.append(tString[j]);
+ else {tBuffer.append(" %s"); tRep[j / 2] = tString[j];}
+ aList.add(String.format(GT_LanguageManager.addStringLocalization("TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, tBuffer.toString(), !GregTech_API.sPostloadFinished), tRep));
+ }
+ }else{String tTranslated = GT_LanguageManager.addStringLocalization("TileEntity_DESCRIPTION_" + tDamage + "_Index_" + i++, tDescription, !GregTech_API.sPostloadFinished );
+ aList.add(tTranslated.equals("") ? tDescription : tTranslated);}
}else i++;
}
}
@@ -136,4 +141,4 @@ public class GT_Item_Machines
}
return true;
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java
index 8239dc16e1..5fa3bc8c82 100644
--- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java
+++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java
@@ -153,7 +153,7 @@ public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer
//Adjust items per side by 1 or -1, constrained to the cyclic interval [0, 127]
itemsPerSide[aSide] += aPlayer.isSneaking() ? -1 : 1;
itemsPerSide[aSide] = (byte) ((itemsPerSide[aSide] + 128) % 128);
- GT_Utility.sendChatToPlayer(aPlayer, trans("110", "Items per side: " + itemsPerSide[aSide]));
+ GT_Utility.sendChatToPlayer(aPlayer, trans("211", "Items per side: ") + itemsPerSide[aSide]);
}
@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 b0f36ae7e5..3099959501 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
@@ -145,7 +145,7 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba
{
ChunkPosition tPos = new ChunkPosition(GT_Utility.getScaleCoordinates(x*16,96), 0, GT_Utility.getScaleCoordinates(z*16,96));
ChunkCoordIntPair cInts = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(tPos.chunkPosX,tPos.chunkPosZ).getChunkCoordIntPair();
- FluidStack tFluid = GT_UndergroundOil.undergroundOil(getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(tPos.chunkPosX,tPos.chunkPosZ),-1);
+ FluidStack tFluid = GT_UndergroundOil.undergroundOilReadInformation(getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(tPos.chunkPosX,tPos.chunkPosZ));
if (tFluid != null)
if (tFluids.containsKey(cInts)) {
if (tFluids.get(cInts).amount<tFluid.amount)
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 934be4c389..abdc569da9 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
@@ -153,7 +153,8 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt
sInterDimensionalTeleportAllowed &&
(
this.hasBlock ||
- mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)) && mFluid.amount >= 1000
+ mFluid != null && mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)) && mFluid.amount >= 1000
+
)
)
;
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 de9b656941..f6c5013a7b 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
@@ -103,7 +103,7 @@ public class GT_MetaTileEntity_SeismicProspector extends GT_MetaTileEntity_Basic
}
}
if(tStringList.size()<1){tStringList.add("No Ores found.");}
- FluidStack tFluid = GT_UndergroundOil.undergroundOil(getBaseMetaTileEntity(),-1);
+ FluidStack tFluid = GT_UndergroundOil.undergroundOilReadInformation(getBaseMetaTileEntity());
String[] tStringArray = new String[tStringList.size()];
{
for (int i = 0; i < tStringArray.length; i++) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java
index 85fa7370f7..2934fc527c 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java
@@ -322,7 +322,7 @@ public class GT_MetaTileEntity_AssemblyLine
* @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb
*/
private boolean isCorrectDataItem(ItemStack aStack, int state){
- if ((state & 1) != 0 && ItemList.Circuit_Integrated.isStackEqual(aStack, false, true)) return true;
+ if ((state & 1) != 0 && ItemList.Circuit_Integrated.isStackEqual(aStack, true, true)) return true;
if ((state & 2) != 0 && ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) return true;
if ((state & 4) != 0 && ItemList.Tool_DataOrb.isStackEqual(aStack, false, true)) return true;
return false;
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 214628f39a..64b5914bb4 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
@@ -39,7 +39,7 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas
"Controller (Top center)",
"Top besides contoller and edges: Filter Casings",
"1 Reinforced Door (keep closed for 100% efficency)",
- "1x Energy Hatch, 1x Maintainance Hatch",
+ "1x ULV+ Energy Hatch, 1x Maintainance Hatch",
"Up to 10 Machine Hull Item & Energy transfer through walls",
"Remaining Blocks: Plascrete, 20 min"};
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller1.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller1.java
new file mode 100644
index 0000000000..84bba3b3dd
--- /dev/null
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller1.java
@@ -0,0 +1,51 @@
+package gregtech.common.tileentities.machines.multi;
+
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+
+public class GT_MetaTileEntity_ConcreteBackfiller1 extends GT_MetaTileEntity_ConcreteBackfillerBase {
+ public GT_MetaTileEntity_ConcreteBackfiller1(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GT_MetaTileEntity_ConcreteBackfiller1(String aName) {
+ super(aName);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return getDescriptionInternal("");
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_ConcreteBackfiller1(mName);
+ }
+
+ @Override
+ protected ItemList getCasingBlockItem() {
+ return ItemList.Casing_SolidSteel;
+ }
+
+ @Override
+ protected Materials getFrameMaterial() {
+ return Materials.Steel;
+ }
+
+ @Override
+ protected int getCasingTextureIndex() {
+ return 16;
+ }
+
+ @Override
+ protected int getRadius() {
+ return 16;
+ }
+
+ @Override
+ protected int getMinTier() {
+ return 2;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller2.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller2.java
new file mode 100644
index 0000000000..6357783b01
--- /dev/null
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller2.java
@@ -0,0 +1,66 @@
+package gregtech.common.tileentities.machines.multi;
+
+import static gregtech.api.enums.GT_Values.VN;
+
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+
+public class GT_MetaTileEntity_ConcreteBackfiller2 extends GT_MetaTileEntity_ConcreteBackfillerBase {
+ public GT_MetaTileEntity_ConcreteBackfiller2(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GT_MetaTileEntity_ConcreteBackfiller2(String aName) {
+ super(aName);
+ }
+
+ @Override
+ public String[] getDescription() {
+ String casings = getCasingBlockItem().get(0).getDisplayName();
+ return new String[]{
+ "Controller Block for the Advanced Concrete Backfiller",
+ "Size(WxHxD): 3x7x3", "Controller (Front middle at bottom)",
+ "3x1x3 Base of " + casings,
+ "1x3x1 " + casings + " pillar (Center of base)",
+ "1x3x1 " + getFrameMaterial().mName + " Frame Boxes (Each pillar side and on top)",
+ "1x Input Hatch (One of base casings)",
+ "1x Maintenance Hatch (One of base casings)",
+ "1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)",
+ "Put Programmed Circuits into Data Access to config radius",
+ "Radius = (total config value)x2 blocks",
+ "Default 64, Maximum 128",};
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_ConcreteBackfiller2(mName);
+ }
+
+ @Override
+ protected ItemList getCasingBlockItem() {
+ return ItemList.Casing_StableTitanium;
+ }
+
+ @Override
+ protected Materials getFrameMaterial() {
+ return Materials.Titanium;
+ }
+
+ @Override
+ protected int getCasingTextureIndex() {
+ return 50;
+ }
+
+ @Override
+ protected int getRadius() {
+ int tConfig = getTotalConfigValue() * 2;
+ return tConfig >= 128 ? 128 : tConfig <= 0 ? 64 : tConfig;
+ }
+
+ @Override
+ protected int getMinTier() {
+ return 4;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfillerBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfillerBase.java
new file mode 100644
index 0000000000..169bb262cc
--- /dev/null
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfillerBase.java
@@ -0,0 +1,125 @@
+package gregtech.common.tileentities.machines.multi;
+
+import static gregtech.api.enums.GT_Values.V;
+import static gregtech.api.enums.GT_Values.VN;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+
+public abstract class GT_MetaTileEntity_ConcreteBackfillerBase extends GT_MetaTileEntity_DrillerBase {
+
+ private int mLastXOff = 0, mLastZOff = 0;
+
+ public GT_MetaTileEntity_ConcreteBackfillerBase(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GT_MetaTileEntity_ConcreteBackfillerBase(String aName) {
+ super(aName);
+ }
+
+ protected String[] getDescriptionInternal(String tierSuffix) {
+ String casings = getCasingBlockItem().get(0).getDisplayName();
+ return new String[]{
+ "Controller Block for the Concrete Backfiller " + (tierSuffix != null ? tierSuffix : ""),
+ "Size(WxHxD): 3x7x3", "Controller (Front middle at bottom)",
+ "3x1x3 Base of " + casings,
+ "1x3x1 " + casings + " pillar (Center of base)",
+ "1x3x1 " + getFrameMaterial().mName + " Frame Boxes (Each pillar side and on top)",
+ "1x Input Hatch (One of base casings)",
+ "1x Maintenance Hatch (One of base casings)",
+ "1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)",
+ "Radius is " + getRadius() + " blocks"};
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DrillingRig.png");
+ }
+
+ protected abstract int getRadius();
+
+ @Override
+ protected boolean checkHatches() {
+ return !mMaintenanceHatches.isEmpty() && !mInputHatches.isEmpty() && !mEnergyHatches.isEmpty();
+ }
+
+ @Override
+ protected void setElectricityStats() {
+ this.mEfficiency = getCurrentEfficiency(null);
+ this.mEfficiencyIncrease = 10000;
+ //T1 = 48; T2 = 192; T3 = 768; T4 = 3072
+ this.mEUt = 12 * (1 << (getMinTier() << 1));
+ this.mMaxProgresstime = (isPickingPipes ? 240: 80) / (1 << getMinTier());
+
+ long voltage = getMaxInputVoltage();
+ long overclockEu = V[Math.max(1, GT_Utility.getTier(voltage)) - 1];
+ while (this.mEUt <= overclockEu) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 2;
+ }
+
+ this.mEUt = -this.mEUt;
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+ }
+
+ @Override
+ protected boolean workingUpward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) {
+ if (isRefillableBlock(xPipe, yHead - 1, zPipe))
+ return tryRefillBlock(xPipe, yHead - 1, zPipe);
+ int radius = getRadius();
+ if (mLastXOff == 0 && mLastZOff == 0) {
+ mLastXOff = - radius;
+ mLastZOff = - radius;
+ }
+ if (yHead != yDrill) {
+ for (int i = mLastXOff; i <= radius; i++) {
+ for (int j = (i == mLastXOff ? mLastZOff : - radius); j <= radius; j++) {
+ if (isRefillableBlock(xPipe + i, yHead, zPipe + j)){
+ mLastXOff = i;
+ mLastZOff = j;
+ return tryRefillBlock(xPipe + i, yHead, zPipe + j);
+ }
+ }
+ }
+ }
+
+ if (tryPickPipe()) {
+ mLastXOff = 0;
+ mLastZOff = 0;
+ return true;
+ } else {
+ isPickingPipes = false;
+ stopMachine();
+ return false;
+ }
+ }
+
+ private boolean isRefillableBlock(int aX, int aY, int aZ){
+ if (getBaseMetaTileEntity().getTileEntity(aX, aY, aZ) != null) return false;
+ if (getBaseMetaTileEntity().getAir(aX, aY, aZ) || !getBaseMetaTileEntity().getBlock(aX, aY, aZ).getMaterial().isSolid())
+ return true;
+ return false;
+ }
+
+ private boolean tryRefillBlock(int aX, int aY, int aZ) {
+ if (!tryConsumeFluid())
+ return false;
+ getBaseMetaTileEntity().getWorld().setBlock(aX, aY, aZ, GregTech_API.sBlockConcretes, 8, 3);
+ return true;
+ }
+
+ private boolean tryConsumeFluid() {
+ if (!depleteInput(Materials.Concrete.getMolten(144L))){
+ mMaxProgresstime = 0;
+ return false;
+ }
+ return true;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java
new file mode 100644
index 0000000000..2e7616b029
--- /dev/null
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java
@@ -0,0 +1,357 @@
+package gregtech.common.tileentities.machines.multi;
+
+import static gregtech.api.enums.GT_Values.W;
+
+import java.util.ArrayList;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_MultiBlockBase {
+ private static final ItemStack miningPipe = GT_ModHandler.getIC2Item("miningPipe", 0);
+ private static final ItemStack miningPipeTip = GT_ModHandler.getIC2Item("miningPipeTip", 0);
+ private static final Block miningPipeBlock = GT_Utility.getBlockFromStack(miningPipe);
+ private static final Block miningPipeTipBlock = GT_Utility.getBlockFromStack(miningPipeTip);
+
+ private Block casingBlock;
+ private int casingMeta;
+ private int frameMeta;
+ private int casingTextureIndex;
+
+ private ForgeDirection back;
+
+ private int xDrill, yDrill, zDrill, xPipe, zPipe, yHead;
+ protected boolean isPickingPipes;
+
+ public GT_MetaTileEntity_DrillerBase(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ initFields();
+ }
+
+ public GT_MetaTileEntity_DrillerBase(String aName) {
+ super(aName);
+ initFields();
+ }
+
+ private void initFields() {
+ casingBlock = getCasingBlockItem().getBlock();
+ casingMeta = getCasingBlockItem().get(0).getItemDamage();
+ int frameId = 4096 + getFrameMaterial().mMetaItemSubID;
+ frameMeta = GregTech_API.METATILEENTITIES[frameId] != null ? GregTech_API.METATILEENTITIES[frameId].getTileEntityBaseType() : W;
+ casingTextureIndex = getCasingTextureIndex();
+ isPickingPipes = false;
+ }
+
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing)
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[casingTextureIndex],new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL)};
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[casingTextureIndex]};
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setBoolean("isPickingPipe", isPickingPipes);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ isPickingPipes = aNBT.getBoolean("isPickingPipes");
+ }
+
+ protected boolean tryPickPipe() {
+ if (yHead == yDrill) return false;
+ if (tryOutputPipe()){
+ if (checkBlockAndMeta(xPipe, yHead + 1, zPipe, miningPipeBlock, W))
+ getBaseMetaTileEntity().getWorld().setBlock(xPipe, yHead + 1, zPipe, miningPipeTipBlock);
+ getBaseMetaTileEntity().getWorld().setBlockToAir(xPipe, yHead, zPipe);
+ return true;
+ }
+ return false;
+ }
+
+ protected boolean tryLowerPipe() {
+ if (!isHasMiningPipes()) return false;
+
+ if (yHead <= 0) return false;
+ if (!canLowerPipe()) return false;
+
+ getBaseMetaTileEntity().getWorld().setBlock(xPipe, yHead - 1, zPipe, miningPipeTipBlock);
+ if (yHead != yDrill) getBaseMetaTileEntity().getWorld().setBlock(xPipe, yHead, zPipe, miningPipeBlock);
+
+ getBaseMetaTileEntity().decrStackSize(1, 1);
+ return true;
+ }
+
+ private void putMiningPipesFromInputsInController() {
+ int maxPipes = miningPipe.getMaxStackSize();
+ if (isHasMiningPipes(maxPipes)) return;
+
+ ItemStack pipes = getStackInSlot(1);
+ for (ItemStack storedItem : getStoredInputs()) {
+ if (!storedItem.isItemEqual(miningPipe)) continue;
+
+ if (pipes == null) {
+ setInventorySlotContents(1, GT_Utility.copy(miningPipe));
+ pipes = getStackInSlot(1);
+ }
+
+ if (pipes.stackSize == maxPipes) break;
+
+ int needPipes = maxPipes - pipes.stackSize;
+ int transferPipes = storedItem.stackSize < needPipes ? storedItem.stackSize : needPipes;
+
+ pipes.stackSize += transferPipes;
+ storedItem.stackSize -= transferPipes;
+ }
+ updateSlots();
+ }
+
+ private boolean tryOutputPipe(){
+ if (!getBaseMetaTileEntity().addStackToSlot(1, GT_Utility.copyAmount(1, miningPipe)))
+ mOutputItems = new ItemStack[] {GT_Utility.copyAmount(1, miningPipe)};
+ return true;
+ }
+
+ protected boolean canLowerPipe(){
+ return yHead > 0 && !checkBlockAndMeta(xPipe, yHead - 1, zPipe, Blocks.bedrock, W);
+ }
+
+ private boolean isHasMiningPipes() {
+ return isHasMiningPipes(1);
+ }
+
+ private boolean isHasMiningPipes(int minCount) {
+ ItemStack pipe = getStackInSlot(1);
+ return pipe != null && pipe.stackSize > minCount - 1 && pipe.isItemEqual(miningPipe);
+ }
+
+ private boolean isEnergyEnough() {
+ long requiredEnergy = 512 + getMaxInputVoltage() * 4;
+ for (GT_MetaTileEntity_Hatch_Energy energyHatch : mEnergyHatches) {
+ requiredEnergy -= energyHatch.getEUVar();
+ if (requiredEnergy <= 0) return true;
+ }
+ return false;
+ }
+
+ protected boolean workingDownward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead){
+ if(!tryLowerPipe())
+ if(waitForPipes()) return false;
+ isPickingPipes = true;
+ return true;
+ }
+
+ protected boolean workingUpward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) {
+ if (tryPickPipe()) {
+ return true;
+ } else {
+ isPickingPipes = false;
+ stopMachine();
+ return false;
+ }
+ }
+
+ @Override
+ public boolean checkRecipe(ItemStack aStack) {
+ //Public pipe actions
+ setElectricityStats();
+ int oldYHead = yHead;
+ if (!checkPipesAndSetYHead() || !isEnergyEnough()) {
+ stopMachine();
+ return false;
+ }
+ putMiningPipesFromInputsInController();
+ if (!isPickingPipes)
+ return workingDownward(aStack, xDrill, yDrill, zDrill, xPipe, zPipe, yHead, oldYHead);
+ else
+ return workingUpward(aStack, xDrill, yDrill, zDrill, xPipe, zPipe, yHead, oldYHead);
+ }
+
+ @Override
+ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ updateCoordinates();
+ //check base layer
+ for (int xOff = -1 + back.offsetX; xOff <= 1 + back.offsetX; xOff++) {
+ for (int zOff = -1 + back.offsetZ; zOff <= 1 + back.offsetZ; zOff++) {
+ if (xOff == 0 && zOff == 0) continue;
+
+ IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xOff, 0, zOff);
+ if (!checkCasingBlock(xOff, 0, zOff)
+ && !addMaintenanceToMachineList(tTileEntity, casingTextureIndex)
+ && !addInputToMachineList(tTileEntity, casingTextureIndex)
+ && !addOutputToMachineList(tTileEntity, casingTextureIndex)
+ && !addEnergyInputToMachineList(tTileEntity, casingTextureIndex)
+ && !addDataAccessToMachineList(tTileEntity, casingTextureIndex))
+ return false;
+ }
+ }
+ if(!checkHatches()) return false;
+ if (GT_Utility.getTier(getMaxInputVoltage()) < getMinTier()) return false;
+ //check tower
+ for (int yOff = 1; yOff < 4; yOff++) {
+ if (!checkCasingBlock(back.offsetX, yOff, back.offsetZ)
+ || !checkFrameBlock(back.offsetX + 1, yOff, back.offsetZ)
+ || !checkFrameBlock(back.offsetX - 1, yOff, back.offsetZ)
+ || !checkFrameBlock(back.offsetX, yOff, back.offsetZ + 1)
+ || !checkFrameBlock(back.offsetX, yOff, back.offsetZ - 1)
+ || !checkFrameBlock(back.offsetX, yOff + 3, back.offsetZ))
+ return false;
+ }
+ return true;
+ }
+
+ private void updateCoordinates() {
+ xDrill = getBaseMetaTileEntity().getXCoord();
+ yDrill = getBaseMetaTileEntity().getYCoord();
+ zDrill = getBaseMetaTileEntity().getZCoord();
+ back = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing());
+ xPipe = xDrill + back.offsetX;
+ zPipe = zDrill + back.offsetZ;
+ }
+
+ private boolean checkPipesAndSetYHead() {
+ yHead = yDrill - 1;
+ while (checkBlockAndMeta(xPipe, yHead, zPipe, miningPipeBlock, W)) yHead--; //skip pipes
+ //is pipe tip OR is controller layer
+ if (checkBlockAndMeta(xPipe, yHead, zPipe, miningPipeTipBlock, W) || ++yHead == yDrill) return true;
+ //pipe column is broken - try fix
+ getBaseMetaTileEntity().getWorld().setBlock(xPipe, yHead, zPipe, miningPipeTipBlock);
+ return true;
+ }
+
+ protected boolean checkCasingBlock(int xOff, int yOff, int zOff) {
+ return checkBlockAndMetaOffset(xOff, yOff, zOff, casingBlock, casingMeta);
+ }
+ //meta of frame is getTileEntityBaseType; frame should be checked using its drops (possible a high weight operation)
+ protected boolean checkFrameBlock(int xOff, int yOff, int zOff) {
+ return checkBlockAndMetaOffset(xOff, yOff, zOff, GregTech_API.sBlockMachines, frameMeta);
+ }
+
+ protected boolean checkBlockAndMetaOffset(int xOff, int yOff, int zOff, Block block, int meta) {
+ return checkBlockAndMeta(xDrill + xOff, yDrill + yOff, zDrill + zOff, block, meta);
+ }
+
+ private boolean checkBlockAndMeta(int x, int y, int z, Block block, int meta) {
+ return (meta == W || getBaseMetaTileEntity().getMetaID(x, y, z) == meta)
+ && getBaseMetaTileEntity().getBlock(x, y, z) == block;
+ }
+
+ protected boolean waitForPipes(){
+ if (canLowerPipe()) {
+ mMaxProgresstime = 0;
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ @Override
+ public int getPollutionPerTick(ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ public abstract Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity);
+
+ protected abstract ItemList getCasingBlockItem();
+
+ protected abstract Materials getFrameMaterial();
+
+ protected abstract int getCasingTextureIndex();
+
+ protected abstract int getMinTier();
+
+ protected abstract boolean checkHatches();
+
+ protected abstract void setElectricityStats();
+
+ public int getTotalConfigValue(){
+ int config = 0;
+ ArrayList<ItemStack> tCircuitList = getDataItems(1);
+ for (ItemStack tCircuit : tCircuitList)
+ config += tCircuit.getItemDamage();
+ return config;
+ }
+
+ public ArrayList<GT_MetaTileEntity_Hatch_DataAccess> mDataAccessHatches = new ArrayList<GT_MetaTileEntity_Hatch_DataAccess>();
+
+ /**
+ * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb
+ */
+ private boolean isCorrectDataItem(ItemStack aStack, int state){
+ if ((state & 1) != 0 && ItemList.Circuit_Integrated.isStackEqual(aStack, true, true)) return true;
+ if ((state & 2) != 0 && ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) return true;
+ if ((state & 4) != 0 && ItemList.Tool_DataOrb.isStackEqual(aStack, false, true)) return true;
+ return false;
+ }
+
+ /**
+ * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb
+ */
+ public ArrayList<ItemStack> getDataItems(int state) {
+ ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
+ if (GT_Utility.isStackValid(mInventory[1]) && isCorrectDataItem(mInventory[1], state)) {
+ rList.add(mInventory[1]);
+ }
+ for (GT_MetaTileEntity_Hatch_DataAccess tHatch : mDataAccessHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ for (int i = 0; i < tHatch.getBaseMetaTileEntity().getSizeInventory(); i++) {
+ if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null
+ && isCorrectDataItem(tHatch.getBaseMetaTileEntity().getStackInSlot(i), state))
+ rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+ }
+ return rList;
+ }
+
+ public boolean addDataAccessToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) return false;
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) return false;
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex;
+ return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity);
+ }
+ return false;
+ }
+
+} \ No newline at end of file
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
deleted file mode 100644
index e3e0c8524d..0000000000
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill.java
+++ /dev/null
@@ -1,270 +0,0 @@
-package gregtech.common.tileentities.machines.multi;
-
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.Textures;
-import gregtech.api.gui.GT_GUIContainer_MultiMachine;
-import gregtech.api.interfaces.ITexture;
-import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
-import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_ModHandler;
-import gregtech.api.util.GT_Utility;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraftforge.common.util.ForgeDirection;
-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;
- private int extractionSpeed=0;
-
- public GT_MetaTileEntity_OilDrill(int aID, String aName, String aNameRegional) {
- super(aID, aName, aNameRegional);
- }
-
- public GT_MetaTileEntity_OilDrill(String aName) {
- super(aName);
- }
-
- public String[] getDescription() {
- return new String[]{
- "Controller Block for the Oil Drilling Rig",
- "Size(WxHxD): 3x7x3", "Controller (Front middle at bottom)",
- "3x1x3 Base of Solid Steel Machine Casings",
- "1x3x1 Solid Steel Machine Casing pillar (Center of base)",
- "1x3x1 Steel Frame Boxes (Each Steel pillar side and on top)",
- "1x Output Hatch (One of base casings)",
- "1x Maintenance Hatch (One of base casings)",
- "1x Energy Hatch (One of base casings)",
- "Also check the seismic prospector..."};
- }
-
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- if (aSide == aFacing) {
- return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[16], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_OIL_DRILL_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_OIL_DRILL)};
- }
- return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[16]};
- }
-
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DrillingRig.png");
- }
-
- @Override
- public boolean checkRecipe(ItemStack aStack) {
- if (mInventory[1] == null || (mInventory[1].isItemEqual(GT_ModHandler.getIC2Item("miningPipe", 1L)) && mInventory[1].stackSize < mInventory[1].getMaxStackSize())) {
- ArrayList<ItemStack> tItems = getStoredInputs();
- for (ItemStack tStack : tItems) {
- if (tStack.isItemEqual(GT_ModHandler.getIC2Item("miningPipe", 1L))) {
- if (tStack.stackSize < 2) {
- tStack = null;
- } else {
- tStack.stackSize--;
- }
-
- }
- if (mInventory[1] == null) {
- mInventory[1] = GT_ModHandler.getIC2Item("miningPipe", 1L);
- } else {
- mInventory[1].stackSize++;
- }
- }
- }
- //Output fluid
- FluidStack tFluid = undergroundOil(getBaseMetaTileEntity(),.5F+(getInputTier()*.25F));//consumes here...
- if (tFluid == null){
- extractionSpeed=0;
- stopMachine();
- return false;//impossible
- }
- if (getBaseMetaTileEntity().getBlockOffset(ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX, getYOfPumpHead() - 1 - getBaseMetaTileEntity().getYCoord(), ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ) != Blocks.bedrock) {
- //Not at bedrock layer - i prefer to keep it like it is...
- if (completedCycle) {
- moveOneDown();
- }
- tFluid = null;
- if (mEnergyHatches.size() > 0 && mEnergyHatches.get(0).getEUVar() > (512 + getMaxInputVoltage() * 4))
- completedCycle = true;
- } else if (tFluid.amount == 0) {//no fluid remaining, for SANity
- extractionSpeed=0;
- stopMachine();
- return false;//stops processing??
- } else {
- extractionSpeed=tFluid.amount;
- }
- this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
- this.mEfficiencyIncrease = 10000;
- calculateOverclockedNessMulti(24, 160, 1, getMaxInputVoltage());
- //In case recipe is too OP for that machine
- if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
- return false;
- if (this.mEUt > 0) {
- this.mEUt = (-this.mEUt);
- }
- this.mOutputFluids = new FluidStack[]{tFluid};
- return true;
- }
-
- private boolean moveOneDown() {
- if ((this.mInventory[1] == null) || (this.mInventory[1].stackSize < 1)
- || (!GT_Utility.areStacksEqual(this.mInventory[1], GT_ModHandler.getIC2Item("miningPipe", 1L)))) {
- return false;
- }
- int xDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX;
- int zDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ;
- int yHead = getYOfPumpHead();
- if (yHead < 1) {
- return false;
- }
- if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord() + xDir, yHead - 1, getBaseMetaTileEntity().getZCoord() + zDir) == Blocks.bedrock) {
- return false;
- }
- if (!(getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord() + xDir, yHead - 1, getBaseMetaTileEntity().getZCoord() + zDir, GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))))) {
- return false;
- }
- if (yHead != getBaseMetaTileEntity().getYCoord()) {
- getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord() + xDir, yHead, getBaseMetaTileEntity().getZCoord() + zDir, GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L)));
- }
- getBaseMetaTileEntity().decrStackSize(1, 1);
- return true;
- }
-
- private int getYOfPumpHead() {
- int xDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX;
- int zDir = ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ;
- int y = getBaseMetaTileEntity().getYCoord() - 1;
- while (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord() + xDir, y, getBaseMetaTileEntity().getZCoord() + zDir) == GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L))) {
- y--;
- }
- if (y == getBaseMetaTileEntity().getYCoord() - 1) {
- if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord() + xDir, y, getBaseMetaTileEntity().getZCoord() + zDir) != GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))) {
- return y + 1;
- }
- } else if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord() + xDir, y, getBaseMetaTileEntity().getZCoord() + zDir) != GT_Utility
- .getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L)) && this.mInventory[1] != null && this.mInventory[1].stackSize > 0 && GT_Utility.areStacksEqual(this.mInventory[1], GT_ModHandler.getIC2Item("miningPipe", 1L))) {
- getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord() + xDir, y, getBaseMetaTileEntity().getZCoord() + zDir,
- GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L)));
- getBaseMetaTileEntity().decrStackSize(0, 1);
- }
- return y;
- }
-
- @Override
- public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
- int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
- for (int i = -1; i < 2; i++) {
- for (int j = -1; j < 2; j++) {
- if ((xDir + i != 0) || (zDir + j != 0)) {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j);
- if ((!addMaintenanceToMachineList(tTileEntity, 16)) && (!addInputToMachineList(tTileEntity, 16)) && (!addOutputToMachineList(tTileEntity, 16)) && (!addEnergyInputToMachineList(tTileEntity, 16))) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j) != GregTech_API.sBlockCasings2) {
- return false;
- }
- if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j) != 0) {
- return false;
- }
- }
- }
- }
- }
- for (int y = 1; y < 4; y++) {
- if (aBaseMetaTileEntity.getBlockOffset(xDir, y, zDir) != GregTech_API.sBlockCasings2) {
- return false;
- }
- if (aBaseMetaTileEntity.getBlockOffset(xDir + 1, y, zDir) != GregTech_API.sBlockMachines) {
- return false;
- }
- if (aBaseMetaTileEntity.getBlockOffset(xDir - 1, y, zDir) != GregTech_API.sBlockMachines) {
- return false;
- }
- if (aBaseMetaTileEntity.getBlockOffset(xDir, y, zDir + 1) != GregTech_API.sBlockMachines) {
- return false;
- }
- if (aBaseMetaTileEntity.getBlockOffset(xDir, y, zDir - 1) != GregTech_API.sBlockMachines) {
- return false;
- }
- if (aBaseMetaTileEntity.getBlockOffset(xDir, y + 3, zDir) != GregTech_API.sBlockMachines) {
- return false;
- }
- }
- return true;
- }
-
- @Override
- public boolean isCorrectMachinePart(ItemStack aStack) {
- return true;
- }
-
- @Override
- public int getMaxEfficiency(ItemStack aStack) {
- return 10000;
- }
-
- @Override
- public int getPollutionPerTick(ItemStack aStack) {
- return 0;
- }
-
- @Override
- public int getDamageToComponent(ItemStack aStack) {
- return 0;
- }
-
- @Override
- public boolean explodesOnComponentBreak(ItemStack aStack) {
- return false;
- }
-
- public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GT_MetaTileEntity_OilDrill(this.mName);
- }
-
- @Override
- public String[] getInfoData() {
- int mPollutionReduction=0;
- for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) {
- if (isValidMetaTileEntity(tHatch)) {
- mPollutionReduction=Math.max(tHatch.calculatePollutionReduction(100),mPollutionReduction);
- }
- }
-
- long storedEnergy=0;
- long maxEnergy=0;
- for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) {
- if (isValidMetaTileEntity(tHatch)) {
- storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU();
- maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity();
- }
- }
-
- return new String[]{
- "Progress:",
- EnumChatFormatting.GREEN + Integer.toString(mProgresstime/20) + EnumChatFormatting.RESET +" s / "+
- EnumChatFormatting.YELLOW + Integer.toString(mMaxProgresstime/20) + EnumChatFormatting.RESET +" s",
- "Stored Energy:",
- EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+
- EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU",
- "Probably uses: "+
- EnumChatFormatting.RED + Integer.toString(-mEUt) + EnumChatFormatting.RESET + " EU/t",
- "Maximum total power (to all Energy Hatches, not single ones): ",
- EnumChatFormatting.YELLOW+Long.toString(getMaxInputVoltage())+EnumChatFormatting.RESET+ " EU/t * 2A",
- "Problems: "+
- EnumChatFormatting.RED+ (getIdealStatus() - getRepairStatus())+EnumChatFormatting.RESET+
- " Efficiency: "+
- EnumChatFormatting.YELLOW+Float.toString(mEfficiency / 100.0F)+EnumChatFormatting.RESET + " %",
- "Pollution reduced to: "+ EnumChatFormatting.GREEN + mPollutionReduction+ EnumChatFormatting.RESET+" %",
- "Extraction this cycle: "+ EnumChatFormatting.GOLD + extractionSpeed + EnumChatFormatting.RESET+" L"
- };
- }
-}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill1.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill1.java
new file mode 100644
index 0000000000..750978a3c3
--- /dev/null
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill1.java
@@ -0,0 +1,51 @@
+package gregtech.common.tileentities.machines.multi;
+
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+
+public class GT_MetaTileEntity_OilDrill1 extends GT_MetaTileEntity_OilDrillBase {
+ public GT_MetaTileEntity_OilDrill1(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GT_MetaTileEntity_OilDrill1(String aName) {
+ super(aName);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return getDescriptionInternal("I");
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_OilDrill1(mName);
+ }
+
+ @Override
+ protected ItemList getCasingBlockItem() {
+ return ItemList.Casing_SolidSteel;
+ }
+
+ @Override
+ protected Materials getFrameMaterial() {
+ return Materials.Steel;
+ }
+
+ @Override
+ protected int getCasingTextureIndex() {
+ return 16;
+ }
+
+ @Override
+ protected int getRangeInChunks() {
+ return 1;
+ }
+
+ @Override
+ protected int getMinTier() {
+ return 2;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill2.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill2.java
new file mode 100644
index 0000000000..00b6f19605
--- /dev/null
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill2.java
@@ -0,0 +1,51 @@
+package gregtech.common.tileentities.machines.multi;
+
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+
+public class GT_MetaTileEntity_OilDrill2 extends GT_MetaTileEntity_OilDrillBase {
+ public GT_MetaTileEntity_OilDrill2(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GT_MetaTileEntity_OilDrill2(String aName) {
+ super(aName);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return getDescriptionInternal("II");
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_OilDrill2(mName);
+ }
+
+ @Override
+ protected ItemList getCasingBlockItem() {
+ return ItemList.Casing_StableTitanium;
+ }
+
+ @Override
+ protected Materials getFrameMaterial() {
+ return Materials.Titanium;
+ }
+
+ @Override
+ protected int getCasingTextureIndex() {
+ return 50;
+ }
+
+ @Override
+ protected int getRangeInChunks() {
+ return 3;
+ }
+
+ @Override
+ protected int getMinTier() {
+ return 3;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill3.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill3.java
new file mode 100644
index 0000000000..164ece9deb
--- /dev/null
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill3.java
@@ -0,0 +1,51 @@
+package gregtech.common.tileentities.machines.multi;
+
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.Materials;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+
+public class GT_MetaTileEntity_OilDrill3 extends GT_MetaTileEntity_OilDrillBase {
+ public GT_MetaTileEntity_OilDrill3(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GT_MetaTileEntity_OilDrill3(String aName) {
+ super(aName);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return getDescriptionInternal("III");
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_OilDrill3(mName);
+ }
+
+ @Override
+ protected ItemList getCasingBlockItem() {
+ return ItemList.Casing_RobustTungstenSteel;
+ }
+
+ @Override
+ protected Materials getFrameMaterial() {
+ return Materials.TungstenSteel;
+ }
+
+ @Override
+ protected int getCasingTextureIndex() {
+ return 48;
+ }
+
+ @Override
+ protected int getRangeInChunks() {
+ return 6;
+ }
+
+ @Override
+ protected int getMinTier() {
+ return 4;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java
new file mode 100644
index 0000000000..9b885717e2
--- /dev/null
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java
@@ -0,0 +1,153 @@
+package gregtech.common.tileentities.machines.multi;
+
+import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.chunk.Chunk;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+
+import java.util.ArrayList;
+
+import static gregtech.api.enums.GT_Values.V;
+import static gregtech.api.enums.GT_Values.VN;
+import static gregtech.common.GT_UndergroundOil.undergroundOil;
+import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation;
+
+public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_DrillerBase {
+
+ private boolean completedCycle = false;
+
+ private ArrayList<Chunk> mOilFieldChunks = new ArrayList<Chunk>();
+ private int mOilId = 0;
+
+ public GT_MetaTileEntity_OilDrillBase(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GT_MetaTileEntity_OilDrillBase(String aName) {
+ super(aName);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setInteger("mOilId", mOilId);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ mOilId = aNBT.getInteger("mOilId");
+ }
+
+ protected String[] getDescriptionInternal(String tierSuffix) {
+ String casings = getCasingBlockItem().get(0).getDisplayName();
+ return new String[]{
+ "Controller Block for the Oil Drilling Rig " + (tierSuffix != null ? tierSuffix : ""),
+ "Size(WxHxD): 3x7x3", "Controller (Front middle at bottom)",
+ "3x1x3 Base of " + casings,
+ "1x3x1 " + casings + " pillar (Center of base)",
+ "1x3x1 " + getFrameMaterial().mName + " Frame Boxes (Each pillar side and on top)",
+ "1x Output Hatch (One of base casings)",
+ "1x Maintenance Hatch (One of base casings)",
+ "1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)",
+ "Working on " + getRangeInChunks() + " * " + getRangeInChunks() + " chunks",
+ "Use Programmed Circuits to ignore near exhausted oil field"};
+ }
+
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DrillingRig.png");
+ }
+
+ protected int getRangeInChunks(){
+ return 0;
+ }
+
+ @Override
+ protected boolean checkHatches() {
+ return !mMaintenanceHatches.isEmpty() && !mOutputHatches.isEmpty() && !mEnergyHatches.isEmpty();
+ }
+
+ @Override
+ protected void setElectricityStats() {
+ this.mEfficiency = getCurrentEfficiency(null);
+ this.mEfficiencyIncrease = 10000;
+ //T1 = 24; T2 = 96; T3 = 384
+ this.mEUt = 6 * (1 << (getMinTier() << 1));
+ //160 per chunk in MV
+ this.mMaxProgresstime = (isPickingPipes ? 80 : 640 * getRangeInChunks() * getRangeInChunks()) / (1 << getMinTier());
+
+ long voltage = getMaxInputVoltage();
+ long overclockEu = V[Math.max(1, GT_Utility.getTier(voltage)) - 1];
+ while (this.mEUt <= overclockEu) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 2;
+ }
+
+ this.mEUt = -this.mEUt;
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+ }
+
+ @Override
+ protected boolean workingDownward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead){
+ if (!tryLowerPipe()){
+ if (waitForPipes()) return false;
+ if (tryFillChunkList()) {
+ float speed = .5F+(GT_Utility.getTier(getMaxInputVoltage()) - getMinTier()) *.25F;
+ FluidStack tFluid = pumpOil(speed);
+ if (tFluid != null && tFluid.amount > getTotalConfigValue()){
+ this.mOutputFluids = new FluidStack[]{tFluid};
+ return true;
+ }
+ }
+ isPickingPipes = true;
+ return true;
+ }
+ return true;
+ }
+
+ private boolean tryFillChunkList(){
+ FluidStack tFluid, tOil;
+ if (mOilId <= 0) {
+ tFluid = undergroundOilReadInformation(getBaseMetaTileEntity());
+ if (tFluid == null) return false;
+ mOilId = tFluid.getFluidID();
+ }
+ tOil = new FluidStack(FluidRegistry.getFluid(mOilId), 0);
+
+ if (mOilFieldChunks.isEmpty()) {
+ Chunk tChunk = getBaseMetaTileEntity().getWorld().getChunkFromBlockCoords(getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord());
+ int range = getRangeInChunks();
+ int xChunk = (tChunk.xPosition / range) * range, zChunk = (tChunk.zPosition / range) * range;
+ int xDir = tChunk.xPosition < 0 ? -1 : 1, zDir = tChunk.zPosition < 0 ? -1 : 1;
+ for (int i = 0; i < range; i++) {
+ for (int j = 0; j < range; j++) {
+ tChunk = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(xChunk + i * xDir, zChunk + j * zDir);
+ tFluid = undergroundOilReadInformation(tChunk);
+ if (tOil.isFluidEqual(tFluid))
+ mOilFieldChunks.add(tChunk);
+ }
+ }
+ }
+ if (mOilFieldChunks.isEmpty()) return false;
+ return true;
+ }
+
+ private FluidStack pumpOil(float speed){
+ if (mOilId <= 0) return null;
+ FluidStack tFluid, tOil;
+ tOil = new FluidStack(FluidRegistry.getFluid(mOilId), 0);
+ for (Chunk tChunk : mOilFieldChunks) {
+ tFluid = undergroundOil(getBaseMetaTileEntity(),speed);
+ if (tFluid == null) mOilFieldChunks.remove(tChunk);
+ if (tOil.isFluidEqual(tFluid)) tOil.amount += tFluid.amount;
+ }
+ return tOil.amount == 0 ? null : tOil;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java
index 8d1f68346d..bd1c07927c 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant1.java
@@ -1,4 +1,3 @@
-
package gregtech.common.tileentities.machines.multi;
import gregtech.api.enums.ItemList;
@@ -49,4 +48,9 @@ public class GT_MetaTileEntity_OreDrillingPlant1 extends GT_MetaTileEntity_OreDr
protected int getMinTier() {
return 2;
}
-}
+
+ @Override
+ protected int getBaseProgressTime() {
+ return 960;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java
index 2b161fe471..272ea64360 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant2.java
@@ -48,4 +48,9 @@ public class GT_MetaTileEntity_OreDrillingPlant2 extends GT_MetaTileEntity_OreDr
protected int getMinTier() {
return 3;
}
-}
+
+ @Override
+ protected int getBaseProgressTime() {
+ return 800;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java
index 1be6391f7a..f89c578b91 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant3.java
@@ -48,4 +48,9 @@ public class GT_MetaTileEntity_OreDrillingPlant3 extends GT_MetaTileEntity_OreDr
protected int getMinTier() {
return 4;
}
-}
+
+ @Override
+ protected int getBaseProgressTime() {
+ return 640;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java
index 2488bc1040..405973547e 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlant4.java
@@ -1,4 +1,3 @@
-
package gregtech.common.tileentities.machines.multi;
import gregtech.api.enums.ItemList;
@@ -49,4 +48,9 @@ public class GT_MetaTileEntity_OreDrillingPlant4 extends GT_MetaTileEntity_OreDr
protected int getMinTier() {
return 5;
}
-}
+
+ @Override
+ protected int getBaseProgressTime() {
+ return 480;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java
index 3d8dbb02bd..a227ab74c2 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java
@@ -161,20 +161,9 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
private void setElectricityStats() {
this.mEfficiency = getCurrentEfficiency(null);
this.mEfficiencyIncrease = 10000;
- //T1 = 12; T2 = 48; T3 = 192; T4 = 768
- this.mEUt = 3 * (1 << (getMinTier() << 1));
- //T1 = 960; T2 = 480; T3 = 240; T4 = 120
- this.mMaxProgresstime = (isPickingPipes ? 80 : 1920) / (1 << getMinTier());
-
- long voltage = getMaxInputVoltage();
- long overclockEu = V[Math.max(1, GT_Utility.getTier(voltage)) - 1];
- while (this.mEUt <= overclockEu) {
- this.mEUt *= 4;
- this.mMaxProgresstime /= 2;
- }
-
- this.mEUt = -this.mEUt;
- this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+ int overclock = 1 << GT_Utility.getTier(getMaxInputVoltage()) - 1;
+ this.mEUt = -12 * overclock * overclock;
+ this.mMaxProgresstime = (isPickingPipes ? 80 : getBaseProgressTime()) / overclock;
}
private ItemStack[] getOutputByDrops(ArrayList<ItemStack> oreBlockDrops) {
@@ -407,6 +396,9 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
protected abstract int getMinTier();
+ //returns theoretical progress time for LV energy hatch
+ protected abstract int getBaseProgressTime();
+
protected String[] getDescriptionInternal(String tierSuffix) {
String casings = getCasingBlockItem().get(0).getDisplayName();
return new String[]{
@@ -422,4 +414,4 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
"1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)",
"Radius is " + (getRadiusInChunks() << 4) + " blocks"};
}
-}
+} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/tools/GT_Tool_Scoop.java b/src/main/java/gregtech/common/tools/GT_Tool_Scoop.java
index 92f9d497c6..09f3298ee8 100644
--- a/src/main/java/gregtech/common/tools/GT_Tool_Scoop.java
+++ b/src/main/java/gregtech/common/tools/GT_Tool_Scoop.java
@@ -1,11 +1,12 @@
package gregtech.common.tools;
+import cpw.mods.fml.common.Loader;
import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.IIconContainer;
-import gregtech.api.interfaces.IItemBehaviour;
import gregtech.api.items.GT_MetaGenerated_Tool;
-import gregtech.api.util.GT_Utility;
+import gregtech.common.items.behaviors.Behaviour_None;
import gregtech.common.items.behaviors.Behaviour_Scoop;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@@ -93,7 +94,12 @@ public class GT_Tool_Scoop
}
public void onStatsAddedToTool(GT_MetaGenerated_Tool aItem, int aID) {
- aItem.addItemBehavior(aID, new Behaviour_Scoop(200));
+ if(Loader.isModLoaded(GT_Values.MOD_ID_FR)){
+ aItem.addItemBehavior(aID, new Behaviour_Scoop(200));
+ }else{
+ aItem.addItemBehavior(aID, new Behaviour_None());
+ }
+
}
public IChatComponent getDeathMessage(EntityLivingBase aPlayer, EntityLivingBase aEntity) {