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.java143
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill.java236
2 files changed, 358 insertions, 21 deletions
diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java
index b4a9c24806..1990373647 100644
--- a/src/main/java/gregtech/common/GT_Proxy.java
+++ b/src/main/java/gregtech/common/GT_Proxy.java
@@ -13,6 +13,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.api.GregTech_API;
import gregtech.api.enums.*;
+import gregtech.api.enums.TC_Aspects.TC_AspectStack;
import gregtech.api.interfaces.IProjectileItem;
import gregtech.api.interfaces.internal.IGT_Mod;
import gregtech.api.interfaces.internal.IThaumcraftCompat;
@@ -27,6 +28,12 @@ import gregtech.api.objects.MaterialStack;
import gregtech.api.util.*;
import gregtech.common.entities.GT_Entity_Arrow;
import gregtech.common.items.GT_MetaGenerated_Tool_01;
+
+
+
+
+
+
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
@@ -46,6 +53,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
+import net.minecraft.world.ChunkPosition;
import net.minecraft.world.World;
import net.minecraft.world.WorldSettings.GameType;
import net.minecraft.world.gen.feature.WorldGenMinable;
@@ -58,6 +66,7 @@ import net.minecraftforge.event.entity.player.ArrowNockEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.terraingen.OreGenEvent;
import net.minecraftforge.event.world.BlockEvent;
+import net.minecraftforge.event.world.ChunkDataEvent;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
@@ -148,6 +157,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
public int mFlintChance = 30;
public int mItemDespawnTime = 6000;
public int mUpgradeCount = 4;
+
private World mUniverse = null;
private boolean isFirstServerWorldTick = true;
private boolean mOreDictActivated = false;
@@ -158,6 +168,10 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
public boolean mChangeHarvestLevels=false;
+
+
+
+
public GT_Proxy() {
GameRegistry.registerFuelHandler(this);
MinecraftForge.EVENT_BUS.register(this);
@@ -561,6 +575,12 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.rotor, aMaterial, 1L), tBits, new Object[]{"PhP", "SRf", "PdP",
Character.valueOf('P'), aMaterial == Materials.Wood ? OrePrefixes.plank.get(aMaterial) : OrePrefixes.plate.get(aMaterial),
Character.valueOf('R'), OrePrefixes.ring.get(aMaterial), Character.valueOf('S'), OrePrefixes.screw.get(aMaterial)});
+ GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 4L), GT_OreDictUnificator.get(OrePrefixes.ring, aMaterial, 1L), Materials.Tin.getMolten(32), GT_OreDictUnificator.get(OrePrefixes.rotor, aMaterial, 1L), 240, 24);
+ GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 4L), GT_OreDictUnificator.get(OrePrefixes.ring, aMaterial, 1L), Materials.Lead.getMolten(48), GT_OreDictUnificator.get(OrePrefixes.rotor, aMaterial, 1L), 240, 24);
+ GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 4L), GT_OreDictUnificator.get(OrePrefixes.ring, aMaterial, 1L), Materials.SolderingAlloy.getMolten(16), GT_OreDictUnificator.get(OrePrefixes.rotor, aMaterial, 1L), 240, 24);
+
+
+
GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.stickLong, aMaterial, 1L), tBits,
new Object[]{"sf", "G ", Character.valueOf('G'), OrePrefixes.gemFlawless.get(aMaterial)});
GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.stickLong, aMaterial, 2L), tBits,
@@ -1114,20 +1134,21 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
tReRegisteredMaterial = (Materials) i$.next();
}
aMaterial.add(GT_Utility.copyAmount(1L, new Object[]{aEvent.Ore}));
- if ((GregTech_API.sThaumcraftCompat != null) && (aPrefix.doGenerateItem(aMaterial)) && (!aPrefix.isIgnored(aMaterial))) {
- long tAmount = aPrefix.mMaterialAmount < 0L ? 3628800L : aPrefix.mMaterialAmount;
- List<TC_Aspects.TC_AspectStack> tAspects = new ArrayList();
- TC_Aspects.TC_AspectStack tAspect;
- for (Iterator i$ = aPrefix.mAspects.iterator(); i$.hasNext(); tAspect.addToAspectList(tAspects)) {
- tAspect = (TC_Aspects.TC_AspectStack) i$.next();
- }
- tAspect = null;
- for (Iterator i$ = aMaterial.mAspects.iterator(); i$.hasNext(); tAspect.copy(tAspect.mAmount * tAmount / 3628800L)
- .addToAspectList(tAspects)) {
- tAspect = (TC_Aspects.TC_AspectStack) i$.next();
- }
- GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(GT_Utility.copyAmount(1L, new Object[]{aEvent.Ore}),
- tAspects, aEvent.Name);
+
+ if (GregTech_API.sThaumcraftCompat != null && aPrefix.doGenerateItem(aMaterial) && !aPrefix.isIgnored(aMaterial)) {
+
+ List<TC_AspectStack> tAspects = new ArrayList<TC_AspectStack>();
+
+ for (TC_AspectStack tAspect : aPrefix.mAspects) tAspect.addToAspectList(tAspects);
+ if (aPrefix.mMaterialAmount >= 3628800 || aPrefix.mMaterialAmount < 0) for (TC_AspectStack tAspect : aMaterial.mAspects) tAspect.addToAspectList(tAspects);
+
+
+
+
+
+
+
+ GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(GT_Utility.copyAmount(1, aEvent.Ore), tAspects, aEvent.Name);
}
switch (aPrefix) {
case crystal:
@@ -1511,6 +1532,19 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
}
public Object getServerGuiElement(int aID, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) {
+ // if(aID>=1000){
+ // int ID = aID-1000;
+ // switch(ID){
+ // case 0:
+ // return new ContainerBasicArmor(aPlayer, new InventoryArmor(ModularArmor_Item.class, aPlayer.getCurrentEquippedItem()));
+ // case 1:
+ // return new ContainerElectricArmor1(aPlayer, new InventoryArmor(ModularArmor_Item.class, aPlayer.getCurrentEquippedItem()));
+ // case 2:
+ // return new ContainerElectricArmor1(aPlayer, new InventoryArmor(ModularArmor_Item.class, aPlayer.getCurrentEquippedItem()));
+ // default:
+ // return getRightItem(aPlayer, ID);
+ // }
+ // }
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if ((tTileEntity instanceof IGregTechTileEntity)) {
IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity();
@@ -1520,8 +1554,36 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
}
return null;
}
+ public Object getRightItem(EntityPlayer player, int ID){
+ // ItemStack mStack = player.getEquipmentInSlot(ID/100);
+ // if(mStack==null||!(mStack.getItem() instanceof ModularArmor_Item))return null;
+
+ // switch(ID % 100){
+ // case 0:
+ // return new ContainerBasicArmor(player, new InventoryArmor(ModularArmor_Item.class, mStack));
+ // case 1:
+ // return new ContainerElectricArmor1(player, new InventoryArmor(ModularArmor_Item.class, mStack));
+ // case 2:
+ // return new ContainerElectricArmor1(player, new InventoryArmor(ModularArmor_Item.class, mStack));
+ // }
+ return null;
+
+ }
public Object getClientGuiElement(int aID, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) {
+ // if(aID>=1000){
+ // int ID = aID-1000;
+ // switch(ID){
+ // case 0:
+ // return new GuiModularArmor(new ContainerBasicArmor(aPlayer, new InventoryArmor(ModularArmor_Item.class, aPlayer.getCurrentEquippedItem())), aPlayer);
+ // case 1:
+ // return new GuiElectricArmor1(new ContainerElectricArmor1(aPlayer, new InventoryArmor(ModularArmor_Item.class, aPlayer.getCurrentEquippedItem())), aPlayer);
+ // case 2:
+ // return new GuiElectricArmor1(new ContainerElectricArmor1(aPlayer, new InventoryArmor(ModularArmor_Item.class, aPlayer.getCurrentEquippedItem())), aPlayer);
+ // default:
+ // return getRightItemGui(aPlayer, ID);
+ // }
+ // }
TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
if ((tTileEntity instanceof IGregTechTileEntity)) {
IMetaTileEntity tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity();
@@ -1531,6 +1593,21 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
}
return null;
}
+ public Object getRightItemGui(EntityPlayer player, int ID){
+ // ItemStack mStack = player.getEquipmentInSlot(ID/100);
+ // if(mStack==null||!(mStack.getItem() instanceof ModularArmor_Item))return null;
+
+ // switch(ID % 100){
+ // case 0:
+ // return new GuiModularArmor(new ContainerBasicArmor(player, new InventoryArmor(ModularArmor_Item.class, mStack)),player);
+ // case 1:
+ // return new GuiElectricArmor1(new ContainerElectricArmor1(player, new InventoryArmor(ModularArmor_Item.class, mStack)), player);
+ // case 2:
+ // return new GuiElectricArmor1(new ContainerElectricArmor1(player, new InventoryArmor(ModularArmor_Item.class, mStack)), player);
+ // }
+ return null;
+
+ }
public int getBurnTime(ItemStack aFuel) {
if ((aFuel == null) || (aFuel.getItem() == null)) {
@@ -1594,7 +1671,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
rFuelValue = (short) Math.max(rFuelValue, 6000);
}
if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "dustCaesium")) {
- rFuelValue = (short) Math.max(rFuelValue, 6000);
+ rFuelValue = (short) Math.max(rFuelValue, 6000);
}
if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "dustSmallCaesium")) {
rFuelValue = (short) Math.max(rFuelValue, 2000);
@@ -1603,22 +1680,22 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
rFuelValue = (short) Math.max(rFuelValue, 888);
}
if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "gemLignite")) {
- rFuelValue = (short) Math.max(rFuelValue, 300);
+ rFuelValue = (short) Math.max(rFuelValue, 1200);
}
if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "crushedLignite")) {
- rFuelValue = (short) Math.max(rFuelValue, 300);
+ rFuelValue = (short) Math.max(rFuelValue, 1200);
}
if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "dustImpureLignite")) {
- rFuelValue = (short) Math.max(rFuelValue, 300);
+ rFuelValue = (short) Math.max(rFuelValue, 1200);
}
if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "dustLignite")) {
- rFuelValue = (short) Math.max(rFuelValue, 300);
+ rFuelValue = (short) Math.max(rFuelValue, 1200);
}
if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "dustSmallLignite")) {
- rFuelValue = (short) Math.max(rFuelValue, 75);
+ rFuelValue = (short) Math.max(rFuelValue, 375);
}
if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "dustTinyLignite")) {
- rFuelValue = (short) Math.max(rFuelValue, 33);
+ rFuelValue = (short) Math.max(rFuelValue, 375);
}
if (GT_OreDictUnificator.isItemStackInstanceOf(aFuel, "gemCoal")) {
rFuelValue = (short) Math.max(rFuelValue, 1600);
@@ -1807,6 +1884,9 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
} else if (tOre.mModID != null && tOre.mModID.toLowerCase().equals("appliedenergistics2") && tOre.mPrefix == OrePrefixes.dust && tOre.mMaterial == Materials.CertusQuartz) {
GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false);
GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (tOre.mModID != null) && (GregTech_API.sUnification.get(ConfigCategories.specialunificationtargets + "." + tOre.mModID, tOre.mEvent.Name, true)), true);
+ } else if (tOre.mModID != null && tOre.mModID.toLowerCase().equals(GT_Values.MOD_ID_TC) && tOre.mPrefix == OrePrefixes.block && tOre.mMaterial == Materials.Thaumium) {
+ GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, false);
+ GT_OreDictUnificator.set(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, (tOre.mModID != null) && (GregTech_API.sUnification.get(ConfigCategories.specialunificationtargets + "." + tOre.mModID, tOre.mEvent.Name, true)), true);
} else if (GT_OreDictUnificator.isBlacklisted(tOre.mEvent.Ore)) {
GT_OreDictUnificator.addAssociation(tOre.mPrefix, tOre.mMaterial, tOre.mEvent.Ore, true);
} else {
@@ -1839,7 +1919,28 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
tEvent = (OreDictEventContainer) i$.next();
}
}
+ public static final HashMap<ChunkPosition, int[]> chunkData = new HashMap<ChunkPosition, int[]>(5000);
+ @SubscribeEvent
+ public void handleChunkSaveEvent(ChunkDataEvent.Save event)
+ {
+ ChunkPosition tPos = new ChunkPosition(event.getChunk().xPosition,1,event.getChunk().zPosition);
+ if(chunkData.containsKey(tPos)){
+ int[] tInts = chunkData.get(tPos);
+ if(tInts.length>0){event.getData().setInteger("GTOIL", tInts[0]);}}
+ }
+
+ @SubscribeEvent
+ public void handleChunkLoadEvent(ChunkDataEvent.Load event)
+ {
+ int tOil = -1;
+ if(event.getData().hasKey("GTOIL")){
+ tOil = event.getData().getInteger("GTOIL");}
+ ChunkPosition tPos = new ChunkPosition(event.getChunk().xPosition,1,event.getChunk().zPosition);
+ if(chunkData.containsKey(tPos)){
+ chunkData.remove(tPos);}
+ chunkData.put(tPos, new int[]{ tOil});
+ }
public static class OreDictEventContainer {
public final OreDictionary.OreRegisterEvent mEvent;
public final OrePrefixes mPrefix;
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
new file mode 100644
index 0000000000..33993cc9c8
--- /dev/null
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrill.java
@@ -0,0 +1,236 @@
+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_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.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+
+import java.util.ArrayList;
+
+public class GT_MetaTileEntity_OilDrill extends GT_MetaTileEntity_MultiBlockBase {
+
+ private boolean completedCycle = false;
+
+ 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: 3x3x7", "Controller (front middle at bottom)",
+ "3x3 Base of Solid Steel Casings",
+ "Also part of Base: Energy Input Hatch",
+ "Fluid Output Hatch and Maintainance Hatch",
+ "3x Solid Steel Casings on top the Center of the base",
+ "Steel Frame Boxes on each side and 3 more on top"};
+ }
+
+ 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_LARGE_BOILER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER)};
+ }
+ 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++;
+ }
+ }
+ }
+ FluidStack tFluid = GT_Utility.getUndergroundOil(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord());
+ if (tFluid == null) {
+ return false;
+ }
+ if (getBaseMetaTileEntity().getBlockOffset(ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetX, getYOfPumpHead() - 1 - getBaseMetaTileEntity().getYCoord(), ForgeDirection.getOrientation(getBaseMetaTileEntity().getBackFacing()).offsetZ) != Blocks.bedrock) {
+ if (completedCycle) {
+ moveOneDown();
+ }
+ tFluid = null;
+ if (mEnergyHatches.size() > 0 && mEnergyHatches.get(0).getEUVar() > (512 + getMaxInputVoltage() * 4))
+ completedCycle = true;
+ } else if (tFluid.amount < 5000) {
+ return false;
+ } else {
+ tFluid.amount = tFluid.amount / 5000;
+ }
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+ int tEU = 24;
+ int tDuration = 160;
+ if (tEU <= 16) {
+ this.mEUt = (tEU * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (tDuration / (1 << tTier - 1));
+ } else {
+ this.mEUt = tEU;
+ this.mMaxProgresstime = tDuration;
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 2;
+ }
+ }
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+ 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 <= 0) {
+ 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 int getAmountOfOutputs() {
+ return 0;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_OilDrill(this.mName);
+ }
+
+} \ No newline at end of file