aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java9
-rw-r--r--src/main/java/gregtech/api/util/GT_Utility.java56
-rw-r--r--src/main/java/gregtech/common/GT_Proxy.java8
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Casings1.java19
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Casings2.java12
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Casings5.java4
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Casings8.java4
-rw-r--r--src/main/java/gregtech/common/items/armor/components/ArmorComponent.java53
-rw-r--r--src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java2
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java23
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java37
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfillerBase.java29
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java111
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java8
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java63
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java294
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java16
-rw-r--r--src/main/java/gregtech/loaders/oreprocessing/ProcessingCircuit.java2
-rw-r--r--src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java2
-rw-r--r--src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java5
20 files changed, 350 insertions, 407 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java
index fe21e8a3c2..d57aff8fc9 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java
@@ -1,6 +1,5 @@
package gregtech.api.metatileentity.implementations;
-import gregtech.GT_Mod;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
@@ -77,6 +76,14 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan
mMachineBlock=actualTexture;
}
+ /**
+ *
+ * @param textureIndex
+ * Index between 0-127.
+ * Add 128 per page, if texture index is not on first page.
+ *
+ */
+
public final void updateTexture(int textureIndex){
onValueUpdate((byte) textureIndex);
onTexturePageUpdate((byte) (textureIndex>>7));
diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java
index fb89cbba8b..69f5b9783c 100644
--- a/src/main/java/gregtech/api/util/GT_Utility.java
+++ b/src/main/java/gregtech/api/util/GT_Utility.java
@@ -8,9 +8,11 @@ import gregtech.api.enchants.Enchantment_Radioactivity;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.SubTag;
+import gregtech.api.enums.Textures;
import gregtech.api.events.BlockScanningEvent;
import gregtech.api.interfaces.IDebugableBlock;
import gregtech.api.interfaces.IProjectileItem;
+import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.*;
import gregtech.api.items.GT_EnergyArmor_Item;
import gregtech.api.items.GT_Generic_Item;
@@ -54,7 +56,12 @@ import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.common.util.BlockSnapshot;
+import net.minecraftforge.common.util.FakePlayer;
+import net.minecraftforge.common.util.FakePlayerFactory;
import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.event.ForgeEventFactory;
+import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.fluids.*;
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
@@ -67,6 +74,8 @@ import java.text.NumberFormat;
import java.util.*;
import java.util.Map.Entry;
+import com.mojang.authlib.GameProfile;
+
import static gregtech.api.enums.GT_Values.*;
import static gregtech.common.GT_Proxy.GTPOLLUTION;
import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation;
@@ -1115,6 +1124,17 @@ public class GT_Utility {
aInventory.setInventorySlotContents(i, null);
}
}
+
+ /**
+ * Initializes a new texture page.
+ */
+ public static boolean addTexturePage(byte page){
+ if(Textures.BlockIcons.casingTexturePages[page]==null){
+ Textures.BlockIcons.casingTexturePages[page]=new ITexture[128];
+ return true;
+ }
+ return false;
+ }
/**
* Converts a Number to a String
@@ -1981,7 +2001,41 @@ public class GT_Utility {
public static ItemStack getIntegratedCircuit(int config){
return ItemList.Circuit_Integrated.getWithDamage(0, config, new Object[0]);
}
-
+
+ public static float getBlockHardnessAt(World aWorld, int aX, int aY, int aZ) {
+ return aWorld.getBlock(aX, aY, aZ).getBlockHardness(aWorld, aX, aY, aZ);
+ }
+
+ public static FakePlayer getFakePlayer(IGregTechTileEntity aBaseMetaTileEntity) {
+ if (aBaseMetaTileEntity.getWorld() instanceof WorldServer) {
+ return FakePlayerFactory.get((WorldServer) aBaseMetaTileEntity.getWorld(), new GameProfile(null, aBaseMetaTileEntity.getOwnerName()));
+ }
+ return null;
+ }
+
+ public static boolean eraseBlockByFakePlayer(FakePlayer aPlayer, int aX, int aY, int aZ, boolean isSimulate) {
+ if (aPlayer == null) return false;
+ World aWorld = aPlayer.worldObj;
+ BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(aX, aY, aZ, aWorld, aWorld.getBlock(aX, aY, aZ), aWorld.getBlockMetadata(aX, aY, aZ), aPlayer);
+ MinecraftForge.EVENT_BUS.post(event);
+ if (!event.isCanceled()) {
+ if (!isSimulate) return aWorld.setBlockToAir(aX, aY, aZ);
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean setBlockByFakePlayer(FakePlayer aPlayer, int aX, int aY, int aZ, Block aBlock, int aMeta, boolean isSimulate) {
+ if (aPlayer == null) return false;
+ World aWorld = aPlayer.worldObj;
+ BlockEvent.PlaceEvent event = ForgeEventFactory.onPlayerBlockPlace(aPlayer, new BlockSnapshot(aWorld, aX, aY, aZ, aBlock, aMeta), ForgeDirection.UNKNOWN);
+ if (!event.isCanceled()) {
+ if (!isSimulate) return aWorld.setBlock(aX, aY, aZ, aBlock, aMeta, 3);
+ return true;
+ }
+ return false;
+ }
+
public static class ItemNBT {
public static void setNBT(ItemStack aStack, NBTTagCompound aNBT) {
if (aNBT == null) {
diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java
index c0e1134c6a..09fb87fd25 100644
--- a/src/main/java/gregtech/common/GT_Proxy.java
+++ b/src/main/java/gregtech/common/GT_Proxy.java
@@ -1888,5 +1888,11 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
}
}
+ @SubscribeEvent
+ public void onBlockEvent(BlockEvent event) {
+ if (event.block.getUnlocalizedName().equals("blockAlloyGlass"))
+ GregTech_API.causeMachineUpdate(event.world, event.x, event.y, event.z);
+ }
+
-} \ No newline at end of file
+}
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings1.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings1.java
index 08f7118f66..965c4bffab 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Casings1.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings1.java
@@ -11,12 +11,27 @@ import net.minecraft.world.IBlockAccess;
public class GT_Block_Casings1
extends GT_Block_Casings_Abstract {
+
+ /**
+ * Texture Index Information
+ * Textures.BlockIcons.casingTexturePages[0][0-63] - Gregtech
+ * Textures.BlockIcons.casingTexturePages[0][64-127] - GT++
+ * Textures.BlockIcons.casingTexturePages[1][0-127] - Gregtech
+ * Textures.BlockIcons.casingTexturePages[2][0-127] - Free
+ * Textures.BlockIcons.casingTexturePages[3][0-127] - Free
+ * Textures.BlockIcons.casingTexturePages[4][0-127] - Free
+ * Textures.BlockIcons.casingTexturePages[5][0-127] - Free
+ * Textures.BlockIcons.casingTexturePages[6][0-127] - Free
+ * Textures.BlockIcons.casingTexturePages[7][0-127] - Free
+ * Textures.BlockIcons.casingTexturePages[8][0-127] - TecTech
+ */
+
+
public GT_Block_Casings1() {
super(GT_Item_Casings1.class, "gt.blockcasings", GT_Material_Casings.INSTANCE);
- for (byte i = 0; i < 16; i = (byte) (i + 1)) {
+ for (byte i = 0; i < 16; i = (byte) (i + 1)) {
Textures.BlockIcons.CASING_BLOCKS[i] = new GT_CopiedBlockTexture(this, 6, i);
}
- Textures.BlockIcons.CASING_BLOCKS[111] = new GT_CopiedBlockTexture(this, 6, 0,Dyes.MACHINE_METAL.mRGBa);
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "ULV Machine Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "LV Machine Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "MV Machine Casing");
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java
index 83ffddd47a..f8f54f9604 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java
@@ -1,9 +1,11 @@
package gregtech.common.blocks;
+import gregtech.api.enums.Dyes;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.util.GT_LanguageManager;
+import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
@@ -15,8 +17,11 @@ public class GT_Block_Casings2
public GT_Block_Casings2() {
super(GT_Item_Casings2.class, "gt.blockcasings2", GT_Material_Casings.INSTANCE);
for (byte i = 0; i < 16; i = (byte) (i + 1)) {
- Textures.BlockIcons.CASING_BLOCKS[(i + 16)] = new GT_CopiedBlockTexture(this, 6, i);
- }
+ if (i != 6){
+ Textures.BlockIcons.CASING_BLOCKS[(i + 16)] = new GT_CopiedBlockTexture(this, 6, i);
+ }
+ }
+
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Solid Steel Machine Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Frost Proof Machine Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Bronze Gear Box Casing");
@@ -49,6 +54,9 @@ public class GT_Block_Casings2
ItemList.Casing_Pipe_Steel.set(new ItemStack(this, 1, 13));
ItemList.Casing_Pipe_Titanium.set(new ItemStack(this, 1, 14));
ItemList.Casing_Pipe_TungstenSteel.set(new ItemStack(this, 1, 15));
+
+ //Special handler for Pyrolyse Oven Casing
+ Textures.BlockIcons.CASING_BLOCKS[22] = new GT_CopiedBlockTexture(Block.getBlockFromItem(ItemList.Casing_ULV.get(1).getItem()), 6, 0,Dyes.MACHINE_METAL.mRGBa);
}
public IIcon getIcon(int aSide, int aMeta) {
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java
index d6c5bfebc9..e97228f5fe 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java
@@ -6,6 +6,7 @@ import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_Utility;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
@@ -13,8 +14,9 @@ public class GT_Block_Casings5
extends GT_Block_Casings_Abstract {
public GT_Block_Casings5() {
super(GT_Item_Casings5.class, "gt.blockcasings5", GT_Material_Casings.INSTANCE);
+ GT_Utility.addTexturePage((byte) 1);
for (byte i = 0; i < 16; i = (byte) (i + 1)) {
- Textures.BlockIcons.CASING_BLOCKS[(i + 64)] = new GT_CopiedBlockTexture(this, 6, i);
+ Textures.BlockIcons.casingTexturePages[1][i] = new GT_CopiedBlockTexture(this, 6, i);
}
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Cupronickel Coil Block");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Kanthal Coil Block");
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java
index b085bbe6a3..84dbb80c02 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java
@@ -13,8 +13,8 @@ public class GT_Block_Casings8
extends GT_Block_Casings_Abstract {
public GT_Block_Casings8() {
super(GT_Item_Casings8.class, "gt.blockcasings8", GT_Material_Casings.INSTANCE);
- for (int i = 0; i < 16; i = (i + 1)) {
- Textures.BlockIcons.CASING_BLOCKS[(i + 112)] = new GT_CopiedBlockTexture(this, 6, i);
+ for (int i = 0; i < 1; i = (i + 1)) {
+ Textures.BlockIcons.casingTexturePages[1][i+48] = new GT_CopiedBlockTexture(this, 6, i);
}
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Chemically Inert Machine Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "PTFE Pipe Casing");
diff --git a/src/main/java/gregtech/common/items/armor/components/ArmorComponent.java b/src/main/java/gregtech/common/items/armor/components/ArmorComponent.java
index ea2f0184dd..3dfcdd17fb 100644
--- a/src/main/java/gregtech/common/items/armor/components/ArmorComponent.java
+++ b/src/main/java/gregtech/common/items/armor/components/ArmorComponent.java
@@ -2,6 +2,7 @@ package gregtech.common.items.armor.components;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.api.GregTech_API;
+import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Utility;
import gregtech.common.items.armor.ArmorData;
import net.minecraft.item.ItemStack;
@@ -18,27 +19,37 @@ public abstract class ArmorComponent implements IArmorComponent {
public static Map<String, ArmorComponent> mStacks = new HashMap<String, ArmorComponent>();
public Map<StatType,Float> mStat = new HashMap<StatType,Float>();
public Map<StatType,Boolean> mBStat = new HashMap<StatType,Boolean>();
-
+
public ArmorComponent(String aName, String aOreDict, boolean aElectric, float aWeight){
- mConfigName = aName;
- if(!GregTech_API.sModularArmor.get( mConfigName, "Enabled", true))return;
- mOreDict = GregTech_API.sModularArmor.get( mConfigName, "OreDict", aOreDict);
- mBStat.put(StatType.ELECTRIC, aElectric);
- mOreDicts.put(aOreDict, this);
- for(ItemStack tStack : OreDictionary.getOres(aOreDict))if(tStack!=null)mStacks.put(tStack.getUnlocalizedName(), this);
- mStat.put(StatType.WEIGHT, (float) GregTech_API.sModularArmor.get( mConfigName, "Weight", aWeight));
+ try {
+ mConfigName = aName;
+ if(!GregTech_API.sModularArmor.get( mConfigName, "Enabled", true))return;
+ mOreDict = GregTech_API.sModularArmor.get( mConfigName, "OreDict", aOreDict);
+ mBStat.put(StatType.ELECTRIC, aElectric);
+ mOreDicts.put(aOreDict, this);
+ for(ItemStack tStack : OreDictionary.getOres(aOreDict))if(tStack!=null)mStacks.put(tStack.getUnlocalizedName(), this);
+ mStat.put(StatType.WEIGHT, (float) GregTech_API.sModularArmor.get( mConfigName, "Weight", aWeight));
+ }
+ catch (Throwable t){
+ GT_Log.out.println("Tried adding "+aName+" as a modular armour component, however it failed.");
+ }
}
-
+
public ArmorComponent(String aName, ItemStack aStack, boolean aElectric, float aWeight){
- mConfigName = aName;
- String tStackName = GregTech_API.sModularArmor.get( mConfigName, "Stack", GameRegistry.findUniqueIdentifierFor(aStack.getItem()).toString()+(aStack.getItemDamage()==0 ? "" : ":"+aStack.getItemDamage()));
- mStack = GameRegistry.findItemStack(tStackName.split(":")[0], tStackName.split(":")[1], 1);
- if(tStackName.split(":").length>2)mStack.setItemDamage(Integer.parseInt(tStackName.split(":")[2]));
- if(!GregTech_API.sModularArmor.get( mConfigName, "Enabled", true))return;
- mStack = aStack;
- mBStat.put(StatType.ELECTRIC, aElectric);
- mStacks.put(aStack.getUnlocalizedName(), this);
- mStat.put(StatType.WEIGHT, (float) GregTech_API.sModularArmor.get( mConfigName, "Weight", aWeight));
+ try {
+ mConfigName = aName;
+ String tStackName = GregTech_API.sModularArmor.get( mConfigName, "Stack", GameRegistry.findUniqueIdentifierFor(aStack.getItem()).toString()+(aStack.getItemDamage()==0 ? "" : ":"+aStack.getItemDamage()));
+ mStack = GameRegistry.findItemStack(tStackName.split(":")[0], tStackName.split(":")[1], 1);
+ if(tStackName.split(":").length>2)mStack.setItemDamage(Integer.parseInt(tStackName.split(":")[2]));
+ if(!GregTech_API.sModularArmor.get( mConfigName, "Enabled", true))return;
+ mStack = aStack;
+ mBStat.put(StatType.ELECTRIC, aElectric);
+ mStacks.put(aStack.getUnlocalizedName(), this);
+ mStat.put(StatType.WEIGHT, (float) GregTech_API.sModularArmor.get( mConfigName, "Weight", aWeight));
+ }
+ catch (Throwable t){
+ GT_Log.out.println("Tried adding "+aName+" as a modular armour component, however it failed.");
+ }
}
@Override
@@ -49,12 +60,12 @@ public abstract class ArmorComponent implements IArmorComponent {
if(GT_Utility.areStacksEqual(tStack, aStack, true))return true;}
return false;
}
-
+
public void addVal(StatType aType, ArmorData aArmorData){
float tArmorDef = 0.0f;
if(aArmorData.mStat.containsKey(aType)){
- tArmorDef = aArmorData.mStat.get(aType);
- aArmorData.mStat.remove(aType);}
+ tArmorDef = aArmorData.mStat.get(aType);
+ aArmorData.mStat.remove(aType);}
aArmorData.mStat.put(aType, tArmorDef + mStat.get(aType));
}
diff --git a/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java
index 90d882f048..f6a74020ae 100644
--- a/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java
+++ b/src/main/java/gregtech/common/items/behaviors/Behaviour_Plunger_Item.java
@@ -34,7 +34,7 @@ public class Behaviour_Plunger_Item
if ((aTileEntity instanceof IGregTechTileEntity)) {
IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) aTileEntity).getMetaTileEntity();
if ((tMetaTileEntity instanceof IMetaTileEntityItemPipe)) {
- for (Object tTileEntity : GT_Utility.sortMapByValuesAcending(IMetaTileEntityItemPipe.Util.scanPipes((IMetaTileEntityItemPipe) tMetaTileEntity, new ConcurrentHashMap(), 0L, false, true)).keySet())
+ for (Object tTileEntity : GT_Utility.sortMapByValuesAcending(IMetaTileEntityItemPipe.Util.scanPipes((IMetaTileEntityItemPipe) tMetaTileEntity, new ConcurrentHashMap<IMetaTileEntityItemPipe,Long>(), 0L, false, true)).keySet())
{
int i = 0;
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java
index 13f16a2b99..9ff143c92c 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java
@@ -17,9 +17,12 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.FakePlayer;
import java.util.ArrayList;
+import static gregtech.api.enums.GT_Values.V;
+
public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
private static final ItemStack MINING_PIPE = GT_ModHandler.getIC2Item("miningPipe", 0);
private static final Block MINING_PIPE_BLOCK = GT_Utility.getBlockFromStack(MINING_PIPE);
@@ -132,8 +135,15 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
}
}
+ @Override
+ public long maxEUStore() {
+ return mTier == 1 ? 4096 : V[mTier] * 64;
+ }
+
public boolean moveOneDown(IGregTechTileEntity aBaseMetaTileEntity) {
- if (aBaseMetaTileEntity.getYCoord() + drillY - 1 < 0 || aBaseMetaTileEntity.getBlockOffset(0, drillY - 1, 0) == Blocks.bedrock) {
+ if (aBaseMetaTileEntity.getYCoord() + drillY - 1 < 0
+ || GT_Utility.getBlockHardnessAt(aBaseMetaTileEntity.getWorld(), aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord() + drillY - 1, aBaseMetaTileEntity.getZCoord()) < 0
+ || !GT_Utility.setBlockByFakePlayer(getFakePlayer(aBaseMetaTileEntity), aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord() + drillY - 1, aBaseMetaTileEntity.getZCoord(), MINING_PIPE_TIP_BLOCK, 0, true)) {
isPickingPipes = true;
return false;
}
@@ -166,6 +176,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
}
public void mineBlock(IGregTechTileEntity aBaseMetaTileEntity, int x, int y, int z) {
+ if (!GT_Utility.eraseBlockByFakePlayer(getFakePlayer(aBaseMetaTileEntity), aBaseMetaTileEntity.getXCoord() + x, aBaseMetaTileEntity.getYCoord() + y, aBaseMetaTileEntity.getZCoord() + z, true));
ArrayList<ItemStack> drops = getBlockDrops(aBaseMetaTileEntity.getBlockOffset(x, y, z), aBaseMetaTileEntity.getXCoord() + x, aBaseMetaTileEntity.getYCoord() + y, aBaseMetaTileEntity.getZCoord() + z);
if (drops.size() > 0)
mOutputItems[0] = drops.get(0);
@@ -196,4 +207,14 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
drillY = aNBT.getInteger("drillY");
drillZ = aNBT.getInteger("drillZ");
}
+
+ private FakePlayer mFakePlayer = null;
+
+ protected FakePlayer getFakePlayer(IGregTechTileEntity aBaseTile) {
+ if (mFakePlayer == null) mFakePlayer = GT_Utility.getFakePlayer(aBaseTile);
+ mFakePlayer.setWorld(aBaseTile.getWorld());
+ mFakePlayer.setPosition(aBaseTile.getXCoord(), aBaseTile.getYCoord(), aBaseTile.getZCoord());
+ return mFakePlayer;
+ }
+
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
index c4fa8d7397..1c02526ab9 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
@@ -15,8 +15,10 @@ import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.ChunkPosition;
+import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidBlock;
@@ -26,6 +28,9 @@ import java.util.Iterator;
import static gregtech.api.enums.GT_Values.V;
public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
+ private static final ItemStack MINING_PIPE = GT_ModHandler.getIC2Item("miningPipe", 0);
+ private static final Block MINING_PIPE_BLOCK = GT_Utility.getBlockFromStack(MINING_PIPE);
+ private static final Block MINING_PIPE_TIP_BLOCK = GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 0));
public ArrayList<ChunkPosition> mPumpList = new ArrayList<ChunkPosition>();
public int mPumpTimer = 0;
@@ -171,22 +176,21 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
private boolean moveOneDown() {
if ((this.mInventory[0] == null) || (this.mInventory[0].stackSize < 1)
- || (!GT_Utility.areStacksEqual(this.mInventory[0], GT_ModHandler.getIC2Item("miningPipe", 1L)))) {
+ || (!GT_Utility.areStacksEqual(this.mInventory[0], MINING_PIPE))) {
return false;
}
int yHead = getYOfPumpHead();
if (yHead <= 0) {
return false;
}
- if ((!consumeFluid(getBaseMetaTileEntity().getXCoord(), yHead - 1, getBaseMetaTileEntity().getZCoord())) && (!getBaseMetaTileEntity().getAir(getBaseMetaTileEntity().getXCoord(), yHead - 1, getBaseMetaTileEntity().getZCoord()))) {
-
+ if ((!consumeFluid(getBaseMetaTileEntity().getXCoord(), yHead - 1, getBaseMetaTileEntity().getZCoord())) && (!getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord(), yHead - 1, getBaseMetaTileEntity().getZCoord()).isAir(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getXCoord(), yHead - 1, getBaseMetaTileEntity().getZCoord()))) {
return false;
}
- if (!(getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord(), yHead - 1, getBaseMetaTileEntity().getZCoord(), GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))))) {
+ if (!GT_Utility.setBlockByFakePlayer(getFakePlayer(getBaseMetaTileEntity()), getBaseMetaTileEntity().getXCoord(), yHead - 1, getBaseMetaTileEntity().getZCoord(), MINING_PIPE_TIP_BLOCK, 0, false)) {
return false;
}
if (yHead != getBaseMetaTileEntity().getYCoord()) {
- getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord(), yHead, getBaseMetaTileEntity().getZCoord(), GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L)));
+ getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord(), yHead, getBaseMetaTileEntity().getZCoord(), MINING_PIPE_BLOCK);
}
getBaseMetaTileEntity().decrStackSize(0, 1);
return true;
@@ -194,19 +198,16 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
private int getYOfPumpHead() {
int y = getBaseMetaTileEntity().getYCoord() - 1;
- while (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord()) == GT_Utility
- .getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L))) {
+ while (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord()) == MINING_PIPE_BLOCK) {
y--;
}
if (y == getBaseMetaTileEntity().getYCoord() - 1) {
- if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord()) != GT_Utility
- .getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))) {
+ if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord()) != MINING_PIPE_TIP_BLOCK) {
return y + 1;
}
- } else if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord()) != GT_Utility
- .getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L)) && this.mInventory[0] != null && this.mInventory[0].stackSize > 0 && GT_Utility.areStacksEqual(this.mInventory[0], GT_ModHandler.getIC2Item("miningPipe", 1L))) {
- getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord(),
- GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L)));
+ } else if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord()) != MINING_PIPE_TIP_BLOCK
+ && this.mInventory[0] != null && this.mInventory[0].stackSize > 0 && GT_Utility.areStacksEqual(this.mInventory[0], MINING_PIPE)) {
+ getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord(), MINING_PIPE_BLOCK);
getBaseMetaTileEntity().decrStackSize(0, 1);
}
return y;
@@ -281,6 +282,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
}
private boolean consumeFluid(int aX, int aY, int aZ) {
+ if (!GT_Utility.eraseBlockByFakePlayer(getFakePlayer(getBaseMetaTileEntity()), aX, aY, aZ, true)) return false;
Block aBlock = getBaseMetaTileEntity().getBlock(aX, aY, aZ);
int aMeta = getBaseMetaTileEntity().getMetaID(aX, aY, aZ);
if ((GT_Utility.isBlockValid(aBlock)) && ((this.mPumpedBlock1 == aBlock) || (this.mPumpedBlock2 == aBlock))) {
@@ -447,4 +449,13 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP),
new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP),};
}
+
+ private FakePlayer mFakePlayer = null;
+
+ protected FakePlayer getFakePlayer(IGregTechTileEntity aBaseTile) {
+ if (mFakePlayer == null) mFakePlayer = GT_Utility.getFakePlayer(aBaseTile);
+ mFakePlayer.setWorld(aBaseTile.getWorld());
+ mFakePlayer.setPosition(aBaseTile.getXCoord(), aBaseTile.getYCoord(), aBaseTile.getZCoord());
+ return mFakePlayer;
+ }
}
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
index 29b37f6d00..7379564745 100644
--- 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
@@ -1,6 +1,5 @@
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;
@@ -53,18 +52,9 @@ public abstract class GT_MetaTileEntity_ConcreteBackfillerBase extends GT_MetaTi
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;
+ int tier = Math.max(1, GT_Utility.getTier(getMaxInputVoltage()));
+ this.mEUt = -6 * (1 << (tier << 1));
+ this.mMaxProgresstime = (workState == STATE_UPWARD ? 240 : 80) / (1 << tier);
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
}
@@ -94,22 +84,21 @@ public abstract class GT_MetaTileEntity_ConcreteBackfillerBase extends GT_MetaTi
mLastZOff = 0;
return true;
} else {
- isPickingPipes = false;
+ workState = STATE_DOWNWARD;
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;
+ IGregTechTileEntity aBaseTile = getBaseMetaTileEntity();
+ if (!aBaseTile.getBlock(aX, aY, aZ).isAir(aBaseTile.getWorld(), aX, aY, aZ) || aBaseTile.getBlock(aX, aY, aZ).getMaterial().isSolid()) return false;
+ if (!GT_Utility.setBlockByFakePlayer(getFakePlayer(aBaseTile), aX, aY, aZ, GregTech_API.sBlockConcretes, 8, true)) return false;
+ return true;
}
private boolean tryRefillBlock(int aX, int aY, int aZ) {
- if (!tryConsumeFluid())
- return false;
+ if (!tryConsumeFluid()) return false;
getBaseMetaTileEntity().getWorld().setBlock(aX, aY, aZ, GregTech_API.sBlockConcretes, 8, 3);
return true;
}
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
index 7f1cfafb11..b98d99360c 100644
--- 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
@@ -23,6 +23,7 @@ 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.FakePlayer;
import net.minecraftforge.common.util.ForgeDirection;
public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_MultiBlockBase {
@@ -39,7 +40,8 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
private ForgeDirection back;
private int xDrill, yDrill, zDrill, xPipe, zPipe, yHead;
- protected boolean isPickingPipes;
+ protected int workState;
+ protected static final int STATE_DOWNWARD = 0, STATE_AT_BOTTOM = 1, STATE_UPWARD = 2;
public GT_MetaTileEntity_DrillerBase(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -57,7 +59,7 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
int frameId = 4096 + getFrameMaterial().mMetaItemSubID;
frameMeta = GregTech_API.METATILEENTITIES[frameId] != null ? GregTech_API.METATILEENTITIES[frameId].getTileEntityBaseType() : W;
casingTextureIndex = getCasingTextureIndex();
- isPickingPipes = false;
+ workState = STATE_DOWNWARD;
}
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
@@ -69,13 +71,14 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
@Override
public void saveNBTData(NBTTagCompound aNBT) {
super.saveNBTData(aNBT);
- aNBT.setBoolean("isPickingPipe", isPickingPipes);
+ aNBT.setInteger("workState", workState);
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
- isPickingPipes = aNBT.getBoolean("isPickingPipes");
+ workState = aNBT.getInteger("workState");
+ if (aNBT.hasKey("isPickingPipes")) workState = aNBT.getBoolean("isPickingPipes") ? STATE_UPWARD : STATE_DOWNWARD;
}
protected boolean tryPickPipe() {
@@ -89,17 +92,30 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
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);
+ /**
+ * @return 0 for succeeded, 1 for invalid block, 2 for not having mining pipes, 3 for event canceled.
+ */
+ protected int tryLowerPipe() {
+ return tryLowerPipe(false);
+ }
- getBaseMetaTileEntity().decrStackSize(1, 1);
- return true;
+ /**
+ * @return 0 for succeeded, 1 for invalid block, 2 for not having mining pipes, 3 for event canceled.
+ */
+ protected int tryLowerPipe(boolean isSimulating) {
+ if (!isHasMiningPipes()) return 2;
+ switch (canLowerPipe()) {
+ case 1: return 1;
+ case 2: return 3;
+ }
+
+ if (!GT_Utility.setBlockByFakePlayer(getFakePlayer(getBaseMetaTileEntity()), xPipe, yHead - 1, zPipe, miningPipeTipBlock, 0, isSimulating)) return 3;
+ if (!isSimulating) {
+ if (yHead != yDrill) getBaseMetaTileEntity().getWorld().setBlock(xPipe, yHead, zPipe, miningPipeBlock);
+ getBaseMetaTileEntity().decrStackSize(1, 1);
+ }
+
+ return 0;
}
private void putMiningPipesFromInputsInController() {
@@ -132,8 +148,19 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
return true;
}
- protected boolean canLowerPipe(){
- return yHead > 0 && !checkBlockAndMeta(xPipe, yHead - 1, zPipe, Blocks.bedrock, W);
+ /**
+ * @return 0 for available, 1 for invalid block, 2 for event canceled.
+ */
+ protected int canLowerPipe(){
+ IGregTechTileEntity aBaseTile = getBaseMetaTileEntity();
+ if (yHead > 0 && GT_Utility.getBlockHardnessAt(aBaseTile.getWorld(), xPipe, yHead - 1, zPipe) >= 0) {
+ return GT_Utility.eraseBlockByFakePlayer(getFakePlayer(aBaseTile), xPipe, yHead - 1, zPipe, true) ? 0 : 2;
+ }
+ return 1;
+ }
+
+ protected boolean reachingVoidOrBedrock() {
+ return yHead <= 0 || checkBlockAndMeta(xPipe, yHead - 1, zPipe, Blocks.bedrock, W);
}
private boolean isHasMiningPipes() {
@@ -154,18 +181,27 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
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 workingDownward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) {
+ switch (tryLowerPipe()) {
+ case 2: mMaxProgresstime = 0; return false;
+ case 3: workState = STATE_UPWARD; return true;
+ case 1: workState = STATE_AT_BOTTOM; return true;
+ default: return true;
+ }
}
-
+
+ protected boolean workingAtBottom(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) {
+ switch (tryLowerPipe(true)) {
+ case 0: workState = STATE_DOWNWARD; return true;
+ default: workState = STATE_UPWARD; 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;
+ workState = STATE_DOWNWARD;
stopMachine();
return false;
}
@@ -181,10 +217,16 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
return false;
}
putMiningPipesFromInputsInController();
- if (!isPickingPipes)
+ switch (workState) {
+ case STATE_DOWNWARD:
return workingDownward(aStack, xDrill, yDrill, zDrill, xPipe, zPipe, yHead, oldYHead);
- else
+ case STATE_AT_BOTTOM:
+ return workingAtBottom(aStack, xDrill, yDrill, zDrill, xPipe, zPipe, yHead, oldYHead);
+ case STATE_UPWARD:
return workingUpward(aStack, xDrill, yDrill, zDrill, xPipe, zPipe, yHead, oldYHead);
+ default:
+ return false;
+ }
}
@Override
@@ -255,13 +297,14 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
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;
+
+ private FakePlayer mFakePlayer = null;
+
+ protected FakePlayer getFakePlayer(IGregTechTileEntity aBaseTile) {
+ if (mFakePlayer == null) mFakePlayer = GT_Utility.getFakePlayer(aBaseTile);
+ mFakePlayer.setWorld(aBaseTile.getWorld());
+ mFakePlayer.setPosition(aBaseTile.getXCoord(), aBaseTile.getYCoord(), aBaseTile.getZCoord());
+ return mFakePlayer;
}
@Override
@@ -288,8 +331,6 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
public boolean explodesOnComponentBreak(ItemStack aStack) {
return false;
}
-
- public abstract Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity);
protected abstract ItemList getCasingBlockItem();
@@ -348,7 +389,7 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
if (aMetaTileEntity == null) return false;
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) {
- ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex;
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture((byte) aBaseCasingIndex);
return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity);
}
return false;
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java
index 52120d2e90..393aeeff70 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java
@@ -20,8 +20,8 @@ import java.util.ArrayList;
public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_MultiBlockBase {
- private static final int CASING_INDEX = 112;
-
+ private final int CASING_INDEX = 176;
+
public GT_MetaTileEntity_LargeChemicalReactor(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}
@@ -58,11 +58,11 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu
boolean aRedstone) {
if (aSide == aFacing) {
return new ITexture[] {
- Textures.BlockIcons.CASING_BLOCKS[CASING_INDEX],
+ Textures.BlockIcons.casingTexturePages[1][48],
new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE
: Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR) };
}
- return new ITexture[] { Textures.BlockIcons.CASING_BLOCKS[CASING_INDEX] };
+ return new ITexture[] { Textures.BlockIcons.casingTexturePages[1][48] };
}
@Override
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
index a4311ee172..5d760e62b3 100644
--- 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
@@ -1,5 +1,11 @@
package gregtech.common.tileentities.machines.multi;
+import static gregtech.api.enums.GT_Values.VN;
+import static gregtech.common.GT_UndergroundOil.undergroundOil;
+import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation;
+
+import java.util.ArrayList;
+
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.GT_Utility;
@@ -10,13 +16,6 @@ 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;
@@ -78,38 +77,29 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
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;
+ int tier = Math.max(1, GT_Utility.getTier(getMaxInputVoltage()));
+ this.mEUt = -3 * (1 << (tier << 1));
+ this.mMaxProgresstime = (workState == STATE_AT_BOTTOM ? (1280 * getRangeInChunks() * getRangeInChunks() / (1 << getMinTier())) : 80) / (1 << tier);
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;
- }
+ protected boolean workingAtBottom(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) {
+ switch (tryLowerPipe(true)) {
+ case 0: workState = STATE_DOWNWARD; setElectricityStats(); return true;
+ case 3: workState = STATE_UPWARD; return true;
+ }
+
+ if (reachingVoidOrBedrock() && 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;
+ }
+ workState = STATE_UPWARD;
+ return true;
}
private boolean tryFillChunkList(){
@@ -124,11 +114,10 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
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;
+ int xChunk = (tChunk.xPosition / range) * range - (tChunk.xPosition < 0 ? range : 0), zChunk = (tChunk.zPosition / range) * range - (tChunk.zPosition < 0 ? range : 0);
for (int i = 0; i < range; i++) {
for (int j = 0; j < range; j++) {
- tChunk = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(xChunk + i * xDir, zChunk + j * zDir);
+ tChunk = getBaseMetaTileEntity().getWorld().getChunkFromChunkCoords(xChunk + i, zChunk + j);
tFluid = undergroundOilReadInformation(tChunk);
if (tOil.isFluidEqual(tFluid))
mOilFieldChunks.add(tChunk);
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 a227ab74c2..4e963d53ca 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
@@ -1,18 +1,15 @@
package gregtech.common.tileentities.machines.multi;
-import gregtech.api.GregTech_API;
+import static gregtech.api.enums.GT_Values.VN;
+
+import java.util.ArrayList;
+
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
-import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
-import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-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.objects.ItemData;
-import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
@@ -22,106 +19,40 @@ 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.minecraft.tileentity.TileEntity;
import net.minecraft.world.ChunkPosition;
-import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
-import java.util.ArrayList;
-
-import static gregtech.api.enums.GT_Values.*;
-
-public abstract class GT_MetaTileEntity_OreDrillingPlantBase 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);
-
+public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTileEntity_DrillerBase {
+
private final ArrayList<ChunkPosition> oreBlockPositions = new ArrayList<>();
- private Block casingBlock;
- private int casingMeta;
- private int frameMeta;
- private int casingTextureIndex;
-
- private ForgeDirection back;
- private int xDrill, yDrill, zDrill, xCenter, zCenter, yHead;
-
- private boolean isPickingPipes;
-
public GT_MetaTileEntity_OreDrillingPlantBase(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
- initFields();
}
public GT_MetaTileEntity_OreDrillingPlantBase(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 Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "OreDrillingPlant.png");
}
@Override
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
- aNBT.setBoolean("isPickingPipes", isPickingPipes);
- }
-
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- super.loadNBTData(aNBT);
- isPickingPipes = aNBT.getBoolean("isPickingPipes");
- }
-
- @Override
- public boolean checkRecipe(ItemStack aStack) {
- setElectricityStats();
- int oldYHead = yHead;
- if (!checkPipesAndSetYHead() || !isEnergyEnough()) {
- stopMachine();
- return false;
- }
- if (yHead != oldYHead) oreBlockPositions.clear();
- if (isPickingPipes) {
- if (tryPickPipe()) {
- mOutputItems = new ItemStack[] {GT_Utility.copyAmount(1, miningPipe)};
- return true;
- } else {
- isPickingPipes = false;
- stopMachine();
- return false;
- }
- }
+ protected boolean workingDownward(ItemStack aStack, int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead, int oldYHead) {
+ if (yHead != oldYHead) oreBlockPositions.clear();
- putMiningPipesFromInputsInController();
- if (!tryConsumeDrillingFluid()) return false;
-
- fillMineListIfEmpty();
+ fillMineListIfEmpty(xDrill, yDrill, zDrill, xPipe, zPipe, yHead);
if (oreBlockPositions.isEmpty()) {
- if (!tryLowerPipe()) {
- isPickingPipes = true;
- return true;
- }
+ switch (tryLowerPipe()) {
+ case 2: mMaxProgresstime = 0; return false;
+ case 3: workState = STATE_UPWARD; return true;
+ case 1: workState = STATE_AT_BOTTOM; return true;
+ }
//new layer - fill again
- fillMineListIfEmpty();
+ fillMineListIfEmpty(xDrill, yDrill, zDrill, xPipe, zPipe, yHead);
}
ChunkPosition oreBlockPos = null;
@@ -129,9 +60,14 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
while ((oreBlock == null || oreBlock == Blocks.air) && !oreBlockPositions.isEmpty()) {
oreBlockPos = oreBlockPositions.remove(0);
- oreBlock = getBaseMetaTileEntity().getBlock(oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ);
+ if (GT_Utility.eraseBlockByFakePlayer(getFakePlayer(getBaseMetaTileEntity()), oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ, true))
+ oreBlock = getBaseMetaTileEntity().getBlock(oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ);
}
+ if (!tryConsumeDrillingFluid()) {
+ oreBlockPositions.add(0, oreBlockPos);
+ return false;
+ }
if (oreBlock != null && oreBlock != Blocks.air) {
ArrayList<ItemStack> oreBlockDrops = getBlockDrops(oreBlock, oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ);
getBaseMetaTileEntity().getWorld().setBlockToAir(oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ);
@@ -141,29 +77,19 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
return true;
}
- 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;
- }
-
- private boolean tryPickPipe() {
- if (yHead == yDrill) return false;
- if (checkBlockAndMeta(xCenter, yHead + 1, zCenter, miningPipeBlock, W))
- getBaseMetaTileEntity().getWorld().setBlock(xCenter, yHead + 1, zCenter, miningPipeTipBlock);
- getBaseMetaTileEntity().getWorld().setBlockToAir(xCenter, yHead, zCenter);
- return true;
+ @Override
+ protected boolean checkHatches(){
+ return !mMaintenanceHatches.isEmpty() && !mInputHatches.isEmpty() && !mOutputBusses.isEmpty() && !mEnergyHatches.isEmpty();
}
-
- private void setElectricityStats() {
+
+ @Override
+ protected void setElectricityStats() {
this.mEfficiency = getCurrentEfficiency(null);
this.mEfficiencyIncrease = 10000;
- int overclock = 1 << GT_Utility.getTier(getMaxInputVoltage()) - 1;
- this.mEUt = -12 * overclock * overclock;
- this.mMaxProgresstime = (isPickingPipes ? 80 : getBaseProgressTime()) / overclock;
+ int tier = Math.max(1, GT_Utility.getTier(getMaxInputVoltage()));
+ this.mEUt = -3 * (1 << (tier << 1));
+ this.mMaxProgresstime = (workState == STATE_DOWNWARD ? getBaseProgressTime() : 80) / (1 <<tier);
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
}
private ItemStack[] getOutputByDrops(ArrayList<ItemStack> oreBlockDrops) {
@@ -216,37 +142,17 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
}
private boolean tryConsumeDrillingFluid() {
- return depleteInput(new FluidStack(ItemList.sDrillingFluid, 2000));
- }
-
- 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;
+ if (!depleteInput(new FluidStack(ItemList.sDrillingFluid, 2000))) {
+ mMaxProgresstime = 0;
+ return false;
}
- updateSlots();
+ return true;
}
- private void fillMineListIfEmpty() {
+ private void fillMineListIfEmpty(int xDrill, int yDrill, int zDrill, int xPipe, int zPipe, int yHead) {
if (!oreBlockPositions.isEmpty()) return;
- tryAddOreBlockToMineList(xCenter, yHead - 1, zCenter);
+ tryAddOreBlockToMineList(xPipe, yHead - 1, zPipe);
if (yHead == yDrill) return; //skip controller block layer
int radius = getRadiusInChunks() << 4;
@@ -271,132 +177,8 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
}
}
- private boolean tryLowerPipe() {
- if (!isHasMiningPipes()) return false;
-
- if (yHead <= 0) return false;
- if (checkBlockAndMeta(xCenter, yHead - 1, zCenter, Blocks.bedrock, W)) return false;
-
- getBaseMetaTileEntity().getWorld().setBlock(xCenter, yHead - 1, zCenter, miningPipeTipBlock);
- if (yHead != yDrill) getBaseMetaTileEntity().getWorld().setBlock(xCenter, yHead, zCenter, miningPipeBlock);
-
- getBaseMetaTileEntity().decrStackSize(1, 1);
- return true;
- }
-
- 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);
- }
-
- @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))
- return false;
- }
- }
- if (mMaintenanceHatches.isEmpty() || mInputHatches.isEmpty() || mOutputBusses.isEmpty() || mEnergyHatches.isEmpty()) 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());
- xCenter = xDrill + back.offsetX;
- zCenter = zDrill + back.offsetZ;
- }
-
- private boolean checkPipesAndSetYHead() {
- yHead = yDrill - 1;
- while (checkBlockAndMeta(xCenter, yHead, zCenter, miningPipeBlock, W)) yHead--; //skip pipes
- //is pipe tip OR is controller layer
- if (checkBlockAndMeta(xCenter, yHead, zCenter, miningPipeTipBlock, W) || ++yHead == yDrill) return true;
- //pipe column is broken - try fix
- getBaseMetaTileEntity().getWorld().setBlock(xCenter, yHead, zCenter, miningPipeTipBlock);
- return true;
- }
-
- private 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)
- private boolean checkFrameBlock(int xOff, int yOff, int zOff) {
- return checkBlockAndMetaOffset(xOff, yOff, zOff, GregTech_API.sBlockMachines, frameMeta);
- }
-
- private 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;
- }
-
- @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;
- }
-
- protected abstract ItemList getCasingBlockItem();
-
- protected abstract Materials getFrameMaterial();
-
- protected abstract int getCasingTextureIndex();
-
protected abstract int getRadiusInChunks();
- protected abstract int getMinTier();
-
- //returns theoretical progress time for LV energy hatch
protected abstract int getBaseProgressTime();
protected String[] getDescriptionInternal(String tierSuffix) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java
index 25fa0b9042..6f3d3e9a47 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java
@@ -1,15 +1,19 @@
package gregtech.common.tileentities.machines.multi;
import gregtech.api.GregTech_API;
+import gregtech.api.enums.Dyes;
+import gregtech.api.enums.ItemList;
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_MultiBlockBase;
+import gregtech.api.objects.GT_CopiedBlockTexture;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
+import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
@@ -20,6 +24,9 @@ import java.util.ArrayList;
public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlockBase {
private int coilMetaID;
+ public static GT_CopiedBlockTexture mTextureULV = new GT_CopiedBlockTexture(Block.getBlockFromItem(ItemList.Casing_ULV.get(1).getItem()), 6, 0,Dyes.MACHINE_METAL.mRGBa);
+
+ //private final int CASING_INDEX = 22;
public GT_MetaTileEntity_PyrolyseOven(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -49,10 +56,9 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
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[111],
- new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN)};
+ return new ITexture[]{mTextureULV, new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN)};
}
- return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[111]};
+ return new ITexture[]{mTextureULV};
}
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
@@ -127,7 +133,7 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
}
}
} else if (h == 3) {// innen decke (ulv casings + input + muffler)
- if ((!addInputToMachineList(tTileEntity, 111)) && (!addMufflerToMachineList(tTileEntity, 111))) {
+ if ((!addInputToMachineList(tTileEntity, 22)) && (!addMufflerToMachineList(tTileEntity, 22))) {
if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GregTech_API.sBlockCasings1) {
return false;
}
@@ -142,7 +148,7 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
}
} else {// Aeusserer 5x5 ohne hoehe
if (h == 0) {// aussen boden (controller, output, energy, maintainance, rest ulv casings)
- if ((!addMaintenanceToMachineList(tTileEntity, 111)) && (!addOutputToMachineList(tTileEntity, 111)) && (!addEnergyInputToMachineList(tTileEntity, 111))) {
+ if ((!addMaintenanceToMachineList(tTileEntity, 22)) && (!addOutputToMachineList(tTileEntity, 22)) && (!addEnergyInputToMachineList(tTileEntity, 22))) {
if ((xDir + i != 0) || (zDir + j != 0)) {//no controller
if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GregTech_API.sBlockCasings1) {
return false;
diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingCircuit.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingCircuit.java
index 1108ab61fd..2a17cfbec8 100644
--- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingCircuit.java
+++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingCircuit.java
@@ -29,7 +29,7 @@ public class ProcessingCircuit implements gregtech.api.interfaces.IOreRecipeRegi
case "Basic":
GT_ModHandler.removeRecipeByOutput(aStack);
GT_ModHandler.addCraftingRecipe(aStack, new Object[]{"RIR","VBV","CCC",'R',ItemList.Circuit_Parts_Resistor.get(1,new Object[0]),'C',GT_OreDictUnificator.get(OrePrefixes.cableGt01, Materials.RedAlloy, 1),'V', ItemList.Circuit_Parts_Vacuum_Tube.get(1,new Object[0]),'B',ItemList.Circuit_Board_Coated.get(1,new Object[0]),'I',ItemList.IC2_Item_Casing_Steel.get(1,new Object[0])});
- GT_ModHandler.addShapelessCraftingRecipe(ItemList.Circuit_Basic.get(1L, new Object[0]), new Object[]{ItemList.Circuit_Integrated.getWildcard(1L, new Object[0])});
+ GT_ModHandler.addShapelessCraftingRecipe(aStack, new Object[]{ItemList.Circuit_Integrated.getWildcard(1L, new Object[0])});
break;
case "Advanced":
GT_ModHandler.removeRecipeByOutput(aStack);
diff --git a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java
index a715dc4404..0a67aa4414 100644
--- a/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java
+++ b/src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java
@@ -503,7 +503,7 @@ if(Loader.isModLoaded("Railcraft")){
GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Plastic, 1), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 2), ItemList.Circuit_Parts_Capacitor.get(2, o), 80, 96);
GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Silicone, 8), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 2),Materials.Plastic.getMolten(72), ItemList.Circuit_Parts_CapacitorSMD.get(32, o), 120, 120);
GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.foil, Materials.PolyvinylChloride, 8), GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Aluminium, 2),Materials.Plastic.getMolten(72), ItemList.Circuit_Parts_CapacitorSMD.get(32, o), 100, 120);
- GT_Values.RA.addExtruderRecipe(Materials.BorosilicateGlass.getIngots(1), ItemList.Shape_Extruder_Wire.get(1, new Object[0]), ItemList.Circuit_Parts_GlassFiber.get(8, new Object[0]), 160, 96);
+ GT_Values.RA.addExtruderRecipe(Materials.BorosilicateGlass.getIngots(1), ItemList.Shape_Extruder_Wire.get(0, new Object[0]), ItemList.Circuit_Parts_GlassFiber.get(8, new Object[0]), 160, 96);
GT_Values.RA.addLaserEngraverRecipe(ItemList.Circuit_Silicon_Wafer2.get(1, new Object[0]), GT_Utility.copyAmount(0,GT_OreDictUnificator.get(OrePrefixes.lens, Materials.EnderPearl, 1)), ItemList.Circuit_Wafer_NAND.get(1, new Object[0]), 500, 480, true);
GT_Values.RA.addLaserEngraverRecipe(ItemList.Circuit_Silicon_Wafer3.get(1, new Object[0]), GT_Utility.copyAmount(0,GT_OreDictUnificator.get(OrePrefixes.lens, Materials.EnderPearl, 1)), ItemList.Circuit_Wafer_NAND.get(4, new Object[0]), 200, 1920, true);
diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java b/src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java
index cf216a17c3..719907d285 100644
--- a/src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java
+++ b/src/main/java/gregtech/loaders/preload/GT_Loader_Item_Block_And_Fluid.java
@@ -653,10 +653,10 @@ public class GT_Loader_Item_Block_And_Fluid
}
}
}
- GT_ModHandler.addPulverisationRecipe(new ItemStack(Blocks.cobblestone, 1, 32767), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Stone, 1L), null, 0, false);
+ GT_ModHandler.addPulverisationRecipe(new ItemStack(Blocks.cobblestone, 1, 32767), new ItemStack(Blocks.sand, 1), null, 0, false);
//GT_ModHandler.addPulverisationRecipe(new ItemStack(Blocks.stone, 1, 32767), new ItemStack(Blocks.cobblestone, 1), null, 0, false);
GT_ModHandler.addPulverisationRecipe(new ItemStack(Blocks.gravel, 1, 32767), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Stone, 1L), null, 0, false);
- GT_ModHandler.addPulverisationRecipe(new ItemStack(Blocks.furnace, 1, 32767), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Stone, 8L), null, 0, false);
+ GT_ModHandler.addPulverisationRecipe(new ItemStack(Blocks.furnace, 1, 32767), new ItemStack(Blocks.sand, 6), null, 0, false);
GT_ModHandler.addPulverisationRecipe(new ItemStack(Blocks.lit_furnace, 1, 32767), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Stone, 8L), null, 0, false);
GT_OreDictUnificator.set(OrePrefixes.ingot, Materials.FierySteel, GT_ModHandler.getModItem("TwilightForest", "item.fieryIngot", 1L, 0));
@@ -722,5 +722,6 @@ public class GT_Loader_Item_Block_And_Fluid
FluidContainerRegistry.registerFluidContainer(new FluidContainerRegistry.FluidContainerData(Materials.NaquadahEnriched.getMolten(1000L), GT_OreDictUnificator.get(OrePrefixes.cell, Materials.NaquadahEnriched, 1L), GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Empty, 1L)));
FluidContainerRegistry.registerFluidContainer(new FluidContainerRegistry.FluidContainerData(Materials.Naquadria.getMolten(1000L), GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Naquadria, 1L), GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Empty, 1L)));
+ GregTech_API.registerMachineBlock(GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("reinforcedGlass", 0)), 0);
}
}