aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/common
diff options
context:
space:
mode:
authorAlkalus <Draknyte1@hotmail.com>2020-03-28 02:09:24 +0000
committerAlkalus <Draknyte1@hotmail.com>2020-03-28 02:09:24 +0000
commitf39e8134fcef5da8bd04503c5233b2b6de249b3a (patch)
tree5713706bbff562e41ee5ebb4c896f5beab6e396d /src/Java/gtPlusPlus/xmod/gregtech/common
parent0678527ea975b4a95eb7f3d6547b79865b0a2a0e (diff)
downloadGT5-Unofficial-f39e8134fcef5da8bd04503c5233b2b6de249b3a.tar.gz
GT5-Unofficial-f39e8134fcef5da8bd04503c5233b2b6de249b3a.tar.bz2
GT5-Unofficial-f39e8134fcef5da8bd04503c5233b2b6de249b3a.zip
+ Added more 'Special Behaviour' items for my multiblocks as Examples.
+ Added '/gtpp hand' command. + Added TungstenSteel & Neutronium tool variants to NEI while in dev. + Added Large Semifluid Generator and a crafting recipe for it. + Added Placeholder for Adv. Assembly Line. + Added Distillus Upgrade Chip and a crafting recipe for it. % Updated build.gradle. % Reworked a few recipes. $ Fixed ULV Overflow Covers using 0L Water in assembler. (https://github.com/GTNewHorizons/NewHorizons/issues/5700) $ Fixed Integral Encasement I using 0L Steel in assembler. (https://github.com/GTNewHorizons/NewHorizons/issues/5617) $ Fixed Thaumcraft based FakePlayer's triggering Fluorite drops. (https://github.com/GTNewHorizons/NewHorizons/issues/5744) $ Fixed bad handling of hatch textures on a few multiblocks. $ Semi-Fixed Distillus. $ Fixed Semifluid Generator recipes. $ Fixed Semifluid Generators crashing the game when mined. $ Fixed bad handling of calls to ItemList.java. $ Began work fixing all ASM to be more compatible with ProGuard. $ Fixed compiler complaining about varargs. ^ Bumped version to 1.7.05.x.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java9
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java623
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java530
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java317
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java1
8 files changed, 1279 insertions, 209 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java
index 5d4cf5ea94..232d4e2cd7 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java
@@ -363,6 +363,15 @@ public class MetaGeneratedGregtechItems extends Gregtech_MetaItem_X32 {
for (int aIndex=0;aIndex<10;aIndex++){
aTransParts[aIndex].set(this.addItem(aStartID++, "Transmission Component ("+GT_Values.VN[aIndex]+")", "", new Object[]{getTcAspectStack(TC_Aspects.ELECTRUM, aIndex), getTcAspectStack(TC_Aspects.MACHINA, aIndex), getTcAspectStack(TC_Aspects.MAGNETO, aIndex)}));
}
+
+ // Distillus Chip
+ GregtechItemList.Distillus_Upgrade_Chip.set(this.addItem(151, "Upgrade Chip", "Used to upgrade Distillus to Tier 2"));
+
+
+ GregtechItemList.Chip_MultiNerf_NoOutputBonus.set(this.addItem(160, "No-Bonus Chip", "You won't like using this"));
+ GregtechItemList.Chip_MultiNerf_NoSpeedBonus.set(this.addItem(161, "No-Bonus Chip", "You won't like using this"));
+ GregtechItemList.Chip_MultiNerf_NoEuBonus.set(this.addItem(162, "No-Bonus Chip", "You won't like using this"));
+
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java
index 9f50cf6d91..bd9708108b 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java
@@ -8,6 +8,7 @@ import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
@@ -15,10 +16,9 @@ import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map;
import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.GTPP_MTE_BasicLosslessGenerator;
import net.minecraft.item.ItemStack;
-public class GT_MetaTileEntity_SemiFluidGenerator extends GTPP_MTE_BasicLosslessGenerator{
+public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_BasicGenerator {
public static final int BASE_POLLUTION = 2;
public int mEfficiency;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java
index 0939a9e6be..738c8c7cf9 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialPlatePress.java
@@ -148,7 +148,7 @@ public class GregtechMetaTileEntity_IndustrialPlatePress extends GregtechMeta_Mu
Block aBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j);
int aMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j);
- if (!isValidBlockForStructure(tTileEntity, 4, true, aBlock, aMeta,
+ if (!isValidBlockForStructure(tTileEntity, TAE.getIndexFromPage(0, 4), true, aBlock, aMeta,
ModBlocks.blockCasingsMisc, 4)) {
Logger.INFO("Bad material press casing");
return false;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java
new file mode 100644
index 0000000000..eab997adb4
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java
@@ -0,0 +1,623 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced;
+
+import java.util.ArrayList;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.TAE;
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.util.minecraft.LangUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Naquadah;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_Adv_AssemblyLine
+ extends GregtechMeta_MultiBlockBase {
+
+ public ArrayList<GT_MetaTileEntity_Hatch_DataAccess> mDataAccessHatches = new ArrayList<GT_MetaTileEntity_Hatch_DataAccess>();
+
+ public static String[] mCasingName = new String[5];
+ private final int CASING_TEXTURE_ID = TAE.getIndexFromPage(0, 13);
+ private final int META_BaseCasing = 0; //4
+ private final int META_ContainmentCasing = 15; //3
+ private final int META_Shielding = 13; //1
+ private final int META_PipeCasing = 1; //4
+ private final int META_IntegralCasing = 6; //0
+ private final int META_ContainmentChamberCasing = 2; //4
+
+
+ public GregtechMetaTileEntity_Adv_AssemblyLine(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0);
+ mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1);
+ mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2);
+ mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15);
+ mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13);
+ }
+
+ public GregtechMetaTileEntity_Adv_AssemblyLine(String aName) {
+ super(aName);
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_Adv_AssemblyLine(this.mName);
+ }
+
+ public String[] getTooltip() {
+ if (mCasingName[0].toLowerCase().contains(".name")) {
+ mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0);
+ }
+ if (mCasingName[1].toLowerCase().contains(".name")) {
+ mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1);
+ }
+ if (mCasingName[2].toLowerCase().contains(".name")) {
+ mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2);
+ }
+ if (mCasingName[3].toLowerCase().contains(".name")) {
+ mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15);
+ }
+ if (mCasingName[4].toLowerCase().contains(".name")) {
+ mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13);
+ }
+ return new String[]{
+ "Advanced Integrated Assembly Line"
+ };
+ }
+
+ private Block getCasing(int casingID) {
+ if (casingID == 1) {
+ return ModBlocks.blockCasingsMisc;
+ }
+ else if (casingID == 2) {
+ return ModBlocks.blockCasings2Misc;
+ }
+ else if (casingID == 3) {
+ return ModBlocks.blockCasings3Misc;
+ }
+ else if (casingID == 4) {
+ return ModBlocks.blockCasings4Misc;
+ }
+ else {
+ return ModBlocks.blockCasingsTieredGTPP;
+ }
+ }
+
+ 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_ASSEMBLY_LINE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE)};
+ }
+ 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(), "AssemblyLine.png");
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return null;
+ }
+
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ public boolean isFacingValid(byte aFacing) {
+ return aFacing > 1;
+ }
+
+ public boolean checkRecipe(ItemStack aStack) {
+ if(GT_Values.D1)System.out.println("Start ALine recipe check");
+ ArrayList<ItemStack> tDataStickList = getDataItems(2);
+ if (tDataStickList.size() == 0) return false;
+ if(GT_Values.D1)System.out.println("Stick accepted, " + tDataStickList.size() + " Data Sticks found");
+
+ ItemStack tStack[] = new ItemStack[15];
+ FluidStack[] tFluids = new FluidStack[4];
+ boolean findRecipe = false;
+ nextDS:for (ItemStack tDataStick : tDataStickList){
+ NBTTagCompound tTag = tDataStick.getTagCompound();
+ if (tTag == null) continue;
+ for (int i = 0; i < 15; i++) {
+ int count = tTag.getInteger("a"+i);
+ if (!tTag.hasKey("" + i) && count <= 0) continue;
+ if (mInputBusses.get(i) == null) {
+ continue nextDS;
+ }
+
+ ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0);
+ boolean flag = true;
+ if (count > 0) {
+ for (int j = 0; j < count; j++) {
+ tStack[i] = GT_Utility.loadItem(tTag, "a" + i + ":" + j);
+ if (tStack[i] == null) continue;
+ if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName());
+ if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) {
+ flag = false;
+ break;
+ }
+ }
+ }
+ if (flag) {
+ tStack[i] = GT_Utility.loadItem(tTag, "" + i);
+ if (tStack[i] == null) {
+ flag = false;
+ continue;
+ }
+ if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName());
+ if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) {
+ flag = false;
+ }
+ }
+ if(GT_Values.D1) System.out.println(i + (flag ? " not accepted" : " accepted"));
+ if (flag) continue nextDS;
+ }
+
+ if(GT_Values.D1)System.out.println("All Items done, start fluid check");
+ for (int i = 0; i < 4; i++) {
+ if (!tTag.hasKey("f" + i)) continue;
+ tFluids[i] = GT_Utility.loadFluid(tTag, "f" + i);
+ if (tFluids[i] == null) continue;
+ if(GT_Values.D1)System.out.println("Fluid "+i+" "+tFluids[i].getUnlocalizedName());
+ if (mInputHatches.get(i) == null) {
+ continue nextDS;
+ }
+ FluidStack fluidInHatch = mInputHatches.get(i).mFluid;
+ if (fluidInHatch == null || !GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) {
+ if(GT_Values.D1)System.out.println(i+" not accepted");
+ continue nextDS;
+ }
+ if(GT_Values.D1)System.out.println(i+" accepted");
+ }
+
+ if(GT_Values.D1)System.out.println("Input accepted, check other values");
+ if (!tTag.hasKey("output")) continue;
+ mOutputItems = new ItemStack[]{GT_Utility.loadItem(tTag, "output")};
+ if (mOutputItems[0] == null || !GT_Utility.isStackValid(mOutputItems[0]))
+ continue;
+
+ if (!tTag.hasKey("time")) continue;
+ mMaxProgresstime = tTag.getInteger("time");
+ if (mMaxProgresstime <= 0) continue;
+
+ if (!tTag.hasKey("eu")) continue;
+ mEUt = tTag.getInteger("eu");
+
+ if(GT_Values.D1)System.out.println("Find avaiable recipe");
+ findRecipe = true;
+ break;
+ }
+ if (!findRecipe) return false;
+
+ if(GT_Values.D1)System.out.println("All checked start consuming inputs");
+ for (int i = 0; i < 15; i++) {
+ if (tStack[i] == null) continue;
+ ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0);
+ stackInSlot.stackSize -= tStack[i].stackSize;
+ }
+
+ for (int i = 0; i < 4; i++) {
+ if (tFluids[i] == null) continue;
+ mInputHatches.get(i).mFluid.amount -= tFluids[i].amount;
+ if (mInputHatches.get(i).mFluid.amount <= 0) {
+ mInputHatches.get(i).mFluid = null;
+ }
+ }
+ if(GT_Values.D1)System.out.println("Check overclock");
+
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage()));
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+ if (mEUt <= 16) {
+ this.mEUt = (mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ 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);
+ updateSlots();
+ if(GT_Values.D1)System.out.println("Recipe sucessfull");
+ return true;
+ }
+
+ public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
+ super.startSoundLoop(aIndex, aX, aY, aZ);
+ if (aIndex == 20) {
+ GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(212), 10, 1.0F, aX, aY, aZ);
+ }
+ }
+
+ public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 4;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 4;
+
+ // Counts for all Casing Types
+ int aBaseCasingCount = 0;
+ int aContainmentCasingCount = 0;
+ int aShieldingCount = 0;
+ int aPipeCount = 0;
+ int aIntegralCasingCount = 0;
+ int aContainmentChamberCount = 0;
+
+ // Bottom Layer
+ aBaseCasingCount += checkEntireLayer(aBaseMetaTileEntity, getCasing(4), META_BaseCasing, -7, xDir, zDir);
+ log("Bottom Layer is Valid. Moving to Layer 1.");
+
+ // Layer 1
+ aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -6, xDir, zDir);
+ aIntegralCasingCount += checkIntegralRing(aBaseMetaTileEntity, getCasing(0), this.META_IntegralCasing, -6, xDir, zDir);
+ aContainmentChamberCount += checkContainmentRing(aBaseMetaTileEntity, getCasing(4), this.META_ContainmentChamberCasing, -6, xDir, zDir);
+ log("Layer 1 is Valid. Moving to Layer 2.");
+
+ // Layer 2
+ aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -5, xDir, zDir);
+ aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -5, xDir, zDir);
+ log("Layer 2 is Valid. Moving to Layer 3.");
+
+ // Layer 3
+ aContainmentCasingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(3), this.META_ContainmentCasing, -4, xDir, zDir);
+ aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -4, xDir, zDir);
+ log("Layer 3 is Valid. Moving to Layer 4.");
+
+ // Layer 4
+ aContainmentCasingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(3), this.META_ContainmentCasing, -3, xDir, zDir);
+ aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -3, xDir, zDir);
+ log("Layer 4 is Valid. Moving to Layer 5.");
+
+ // Layer 5
+ aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -2, xDir, zDir);
+ aPipeCount += checkPipes(aBaseMetaTileEntity, getCasing(4), this.META_PipeCasing, -2, xDir, zDir);
+ log("Layer 5 is Valid. Moving to Layer 6.");
+
+ // Layer 6
+ aShieldingCount += checkOuterRing(aBaseMetaTileEntity, getCasing(1), this.META_Shielding, -1, xDir, zDir);
+ aIntegralCasingCount += checkIntegralRing(aBaseMetaTileEntity, getCasing(0), this.META_IntegralCasing, -1, xDir, zDir);
+ aContainmentChamberCount += checkContainmentRing(aBaseMetaTileEntity, getCasing(4), this.META_ContainmentChamberCasing, -1, xDir, zDir);
+ log("Layer 6 is Valid. Moving to Top Layer.");
+
+ // Top Layer
+ aBaseCasingCount += checkEntireLayer(aBaseMetaTileEntity, getCasing(4), META_BaseCasing, 0, xDir, zDir);
+
+ log("Found "+aBaseCasingCount+" "+mCasingName[0]+"s");
+ log("Found "+aShieldingCount+" "+mCasingName[4]+"s");
+ log("Found "+aPipeCount+" "+mCasingName[1]+"s");
+ log("Found "+aContainmentCasingCount+" "+mCasingName[3]+"s");
+ log("Found "+aIntegralCasingCount+" "+LangUtils.getLocalizedNameOfBlock(getCasing(0), 6)+"s");
+ log("Found "+aContainmentChamberCount+" "+mCasingName[2]+"s");
+
+ // Try mesage player
+ String aOwnerName = this.getBaseMetaTileEntity().getOwnerName();
+ EntityPlayer aOwner = null;
+ if (aOwnerName != null && aOwnerName.length() > 0) {
+ aOwner = PlayerUtils.getPlayer(aOwnerName);
+ }
+
+ if (aShieldingCount != 128) {
+ log("Not enough "+mCasingName[4]+"s, require 128.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[4]+"s, require 128.");
+ }
+ return false;
+ }
+ if (aPipeCount != 20) {
+ log("Not enough "+mCasingName[1]+"s, require 20.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[1]+"s, require 20.");
+ }
+ return false;
+ }
+ if (aContainmentCasingCount != 64) {
+ log("Not enough "+mCasingName[3]+"s, require 64.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[3]+"s, require 64.");
+ }
+ return false;
+ }
+ if (aContainmentChamberCount != 42) {
+ log("Not enough "+mCasingName[2]+"s, require 42.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[2]+"s, require 42.");
+ }
+ return false;
+ }
+ if (aBaseCasingCount < 140) {
+ log("Not enough "+mCasingName[0]+"s, require 140 at a minimum.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+mCasingName[0]+"s, require 140 at a minimum.");
+ }
+ return false;
+ }
+ if (aIntegralCasingCount != 48) {
+ log("Not enough "+LangUtils.getLocalizedNameOfBlock(getCasing(0), 6)+"s, require 48.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Not enough "+LangUtils.getLocalizedNameOfBlock(getCasing(0), 6)+"s, require 48.");
+ }
+ return false;
+ }
+ log("LNR Formed.");
+ if (aOwner != null) {
+ PlayerUtils.messagePlayer(aOwner, "Large Naquadah Reactor has formed successfully.");
+ }
+ return true;
+ }
+
+ public boolean addNaquadahHatchToMachineInput(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) {
+ return false;
+ }
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return false;
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity);
+ }
+ return false;
+ }
+
+ public int checkEntireLayer(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -4; x < 5; x++) {
+ for (int z = -4; z < 5; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 4 && z == 4) || (x == -4 && z == -4) || (x == 4 && z == -4) || (x == -4 && z == 4)) {
+ continue;
+ }
+ // Skip controller
+ if (aY == 0 && x == 0 && z == 0) {
+ continue;
+ }
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Layer has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ }
+ }
+ }
+ return aCasingCount;
+ }
+
+ public int checkOuterRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -4; x < 5; x++) {
+ for (int z = -4; z < 5; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 4 && z == 4) || (x == -4 && z == -4) || (x == 4 && z == -4) || (x == -4 && z == 4)) {
+ continue;
+ }
+
+ // If we are on the 5x5 ring, proceed
+ if ((x > -4 && x < 4 ) && (z > -4 && z < 4)) {
+ if ((x == 3 && z == 3) || (x == -3 && z == -3) || (x == 3 && z == -3) || (x == -3 && z == 3)) {
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ }
+ else {
+ continue;
+ }
+ }
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Layer has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ }
+ }
+ }
+ return aCasingCount;
+ }
+ public int checkIntegralRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -3; x < 4; x++) {
+ for (int z = -3; z < 4; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 3 && z == 3) || (x == -3 && z == -3) || (x == 3 && z == -3) || (x == -3 && z == 3)) {
+ continue;
+ }
+
+ // If we are on the 5x5 ring, proceed
+ if ((x > -3 && x < 3 ) && (z > -3 && z < 3)) {
+ if ((x == 2 && z == 2) || (x == -2 && z == -2) || (x == 2 && z == -2) || (x == -2 && z == 2)) {
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ }
+ else {
+ continue;
+ }
+ }
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Layer has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ }
+ }
+ }
+ return aCasingCount;
+ }
+
+ public int checkPipes(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -1; x < 2; x++) {
+ for (int z = -1; z < 2; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 1 && z == 1) || (x == -1 && z == -1) || (x == 1 && z == -1) || (x == -1 && z == 1) || (x == 0 && z == 0)) {
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Pipe has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ };
+ }
+ }
+ }
+ return aCasingCount;
+ }
+
+ public int checkContainmentRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) {
+ int aCasingCount = 0;
+ for (int x = -2; x < 3; x++) {
+ for (int z = -2; z < 3; z++) {
+ int aOffsetX = this.getBaseMetaTileEntity().getXCoord() + x;
+ int aOffsetY = this.getBaseMetaTileEntity().getYCoord() + aY;
+ int aOffsetZ = this.getBaseMetaTileEntity().getZCoord() + z;
+ //Skip the corners
+ if ((x == 2 && z == 2) || (x == -2 && z == -2) || (x == 2 && z == -2) || (x == -2 && z == 2)) {
+ continue;
+ }
+
+ Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z);
+ int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z);
+ if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) {
+ aCasingCount++;
+ }
+ final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + x, aY, zDir + z);
+ if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, aCurrentBlock, aCurrentMeta, aBlock, aMeta)) {
+ log("Layer has error. Height: "+aY);
+ //this.getBaseMetaTileEntity().getWorld().setBlock(aOffsetX, aOffsetY, aOffsetZ, aBlock, aMeta, 3);
+ return 0;
+ }
+ }
+ }
+ return aCasingCount;
+ }
+
+ /**
+ * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb
+ */
+ private boolean isCorrectDataItem(ItemStack aStack, int state){
+ if ((state & 1) != 0 && ItemList.Circuit_Integrated.isStackEqual(aStack, true, true)) return true;
+ if ((state & 2) != 0 && ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) return true;
+ if ((state & 4) != 0 && ItemList.Tool_DataOrb.isStackEqual(aStack, false, true)) return true;
+ return false;
+ }
+
+ /**
+ * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb
+ */
+ public ArrayList<ItemStack> getDataItems(int state) {
+ ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
+ if (GT_Utility.isStackValid(mInventory[1]) && isCorrectDataItem(mInventory[1], state)) {
+ rList.add(mInventory[1]);
+ }
+ for (GT_MetaTileEntity_Hatch_DataAccess tHatch : mDataAccessHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ for (int i = 0; i < tHatch.getBaseMetaTileEntity().getSizeInventory(); i++) {
+ if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null
+ && isCorrectDataItem(tHatch.getBaseMetaTileEntity().getStackInSlot(i), state))
+ rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i));
+ }
+ }
+ }
+ return rList;
+ }
+
+ public boolean addDataAccessToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ if (aTileEntity == null) return false;
+ IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) return false;
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) {
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex);
+ return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity);
+ }
+ return false;
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerTick(ItemStack aStack) {
+ return 0;
+ }
+
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Assembly Line";
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 0;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java
index e5387d8c6f..7471963eac 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java
@@ -1,5 +1,9 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced;
+import java.util.ArrayList;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
@@ -8,13 +12,16 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
-import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
@@ -23,94 +30,86 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
-import org.apache.commons.lang3.ArrayUtils;
-
-import java.util.ArrayList;
public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_MultiBlockBase {
-
- private static final int CASING_INDEX = 49;
-
- private short mControllerY = 0;
-
- private byte mMode = 0;
-
- public GregtechMetaTileEntity_Adv_DistillationTower(int aID, String aName, String aNameRegional) {
- super(aID, aName, aNameRegional);
- }
-
- public GregtechMetaTileEntity_Adv_DistillationTower(String aName) {
- super(aName);
- }
-
- public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GregtechMetaTileEntity_Adv_DistillationTower(this.mName);
- }
-
- public String[] getTooltip() {
+
+ private short mControllerY = 0;
+ private byte mMode = 0;
+ private boolean mUpgraded = false;
+
+ public GregtechMetaTileEntity_Adv_DistillationTower(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_Adv_DistillationTower(String aName) {
+ super(aName);
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_Adv_DistillationTower(this.mName);
+ }
+
+ public String[] getTooltip() {
String s = "Max parallel dictated by tower tier and mode";
String s1 = "DTower Mode: T1=4, T2=12";
String s2 = "Distilery Mode: Tower Tier * (4*InputTier)";
- return new String[]{
- "Controller Block for the Advanced Distillation Tower",
- "T1 constructed identical to standard DT",
- "T2 is currently disabled.",
- "T2 is not variable height",
- "Size(WxHxD): 3x26x3",
- "Controller (Front bottom)",
- "1x Input Hatch (Any bottom layer casing)",
- "24x Output Hatch (One per layer except bottom/top layer)",
- "1x Output Bus (Any bottom layer casing)",
- "1x Maintenance Hatch (Any casing)",
- "1x Energy Hatch (Any casing)",
- "Integral Framework I's for the rest",
- s,
- s1,
- s2};
- }
-
- 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[CASING_INDEX], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER)};
- }
- return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_INDEX]};
- }
-
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DistillationTower.png");
- }
-
- public GT_Recipe.GT_Recipe_Map getRecipeMap() {
- return mMode == 0 ? GT_Recipe.GT_Recipe_Map.sDistillationRecipes : GT_Recipe.GT_Recipe_Map.sDistilleryRecipes;
- }
-
- public boolean isCorrectMachinePart(ItemStack aStack) {
- return true;
- }
-
- public boolean isFacingValid(byte aFacing) {
- return aFacing > 1;
- }
-
- public int getMaxEfficiency(ItemStack aStack) {
- return 10000;
- }
-
- public int getPollutionPerTick(ItemStack aStack) {
+ return new String[]{
+ "Controller Block for the Advanced Distillation Tower",
+ "T1 constructed identical to standard DT",
+ "Place Distillus Upgrade Chip into Controller GUI to upgrade to T2",
+ "T2 is not variable height",
+ "Size(WxHxD): 3x26x3",
+ "Controller (Front bottom)",
+ "1x Input Hatch (Any bottom layer casing)",
+ "24x Output Hatch (One per layer except bottom/top layer)",
+ "1x Output Bus (Any bottom layer casing)",
+ "1x Maintenance Hatch (Any casing)",
+ "1x Energy Hatch (Any casing)",
+ "Integral Framework I's for the rest",
+ s,
+ s1,
+ s2};
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName()+(mUpgraded ? " T2" : ""), "MultiblockDisplay.png");
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeMap() {
+ return mMode == 0 ? GT_Recipe.GT_Recipe_Map.sDistillationRecipes : GT_Recipe.GT_Recipe_Map.sDistilleryRecipes;
+ }
+
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return true;
+ }
+
+ public boolean isFacingValid(byte aFacing) {
+ return aFacing > 1;
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return 10000;
+ }
+
+ public int getPollutionPerTick(ItemStack aStack) {
return this.mMode == 1 ? 12 : 24;
- }
-
+ }
+
@Override
public void saveNBTData(NBTTagCompound aNBT) {
aNBT.setByte("mMode", mMode);
+ aNBT.setInteger("mCasingTier", this.mCasingTier);
+ aNBT.setBoolean("mUpgraded", mUpgraded);
super.saveNBTData(aNBT);
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {
mMode = aNBT.getByte("mMode");
+ mCasingTier = aNBT.getInteger("mCasingTier");
+ mUpgraded = aNBT.getBoolean("mUpgraded");
super.loadNBTData(aNBT);
- }
+ }
@Override
public String getSound() {
@@ -134,44 +133,44 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M
}
}
- public int getDamageToComponent(ItemStack aStack) {
- return 0;
- }
-
- public boolean explodesOnComponentBreak(ItemStack aStack) {
- return false;
- }
-
- @Override
- public boolean addOutput(FluidStack aLiquid) {
- if (aLiquid == null) return false;
- FluidStack tLiquid = aLiquid.copy();
- for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) {
- if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) {
- if (tHatch.getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1) {
- int tAmount = tHatch.fill(tLiquid, false);
- if (tAmount >= tLiquid.amount) {
- return tHatch.fill(tLiquid, true) >= tLiquid.amount;
- } else if (tAmount > 0) {
- tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true);
- }
- }
- }
- }
- return false;
- }
-
- @Override
- protected void addFluidOutputs(FluidStack[] mOutputFluids2) {
- for (int i = 0; i < mOutputFluids2.length; i++) {
- if (mOutputHatches.size() > i && mOutputHatches.get(i) != null && mOutputFluids2[i] != null && isValidMetaTileEntity(mOutputHatches.get(i))) {
- if (mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1 + i) {
- mOutputHatches.get(i).fill(mOutputFluids2[i], true);
- }
- }
- }
-
- }
+ public int getDamageToComponent(ItemStack aStack) {
+ return 0;
+ }
+
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean addOutput(FluidStack aLiquid) {
+ if (aLiquid == null) return false;
+ FluidStack tLiquid = aLiquid.copy();
+ for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) {
+ if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) {
+ if (tHatch.getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1) {
+ int tAmount = tHatch.fill(tLiquid, false);
+ if (tAmount >= tLiquid.amount) {
+ return tHatch.fill(tLiquid, true) >= tLiquid.amount;
+ } else if (tAmount > 0) {
+ tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true);
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected void addFluidOutputs(FluidStack[] mOutputFluids2) {
+ for (int i = 0; i < mOutputFluids2.length; i++) {
+ if (mOutputHatches.size() > i && mOutputHatches.get(i) != null && mOutputFluids2[i] != null && isValidMetaTileEntity(mOutputHatches.get(i))) {
+ if (mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1 + i) {
+ mOutputHatches.get(i).fill(mOutputFluids2[i], true);
+ }
+ }
+ }
+
+ }
@Override
public boolean hasSlotInGUI() {
@@ -192,7 +191,7 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M
public String getMachineType() {
return "Distillery, Distillation Tower";
}
-
+
@Override
public boolean checkRecipe(final ItemStack aStack) {
for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) {
@@ -251,28 +250,28 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M
}
return false;
}
-
+
private int getTierOfTower() {
- return 1;
+ return mUpgraded ? 2 : 1;
}
-
+
private boolean checkTierOneTower(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- mControllerY = aBaseMetaTileEntity.getYCoord();
- int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
- int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
- int y = 0; //height
- int casingAmount = 0;
- boolean reachedTop = false;
-
- for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
+ mControllerY = aBaseMetaTileEntity.getYCoord();
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
+ int y = 0; //height
+ int casingAmount = 0;
+ boolean reachedTop = false;
+
+ for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth
if (x != 0 || z != 0) {
IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
- if (!addInputToMachineList(tileEntity, CASING_INDEX)
- && !addOutputToMachineList(tileEntity, CASING_INDEX)
- && !addMaintenanceToMachineList(tileEntity, CASING_INDEX)
- && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) {
+ if (!addInputToMachineList(tileEntity, getCasingTextureID())
+ && !addOutputToMachineList(tileEntity, getCasingTextureID())
+ && !addMaintenanceToMachineList(tileEntity, getCasingTextureID())
+ && !addEnergyInputToMachineList(tileEntity, getCasingTextureID())) {
if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
casingAmount++;
} else {
@@ -282,55 +281,55 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M
}
}
}
- y++;
-
- while (y < 12 && !reachedTop) {
- for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
- for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth
- IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
- Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
- if (aBaseMetaTileEntity.getAirOffset(x, y, z)) {
- if (x != xDir || z != zDir) {
- return false;
- }
- } else {
- if (x == xDir && z == zDir) {
- reachedTop = true;
- }
- if (!addOutputToMachineList(tileEntity, CASING_INDEX)
- && !addMaintenanceToMachineList(tileEntity, CASING_INDEX)
- && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) {
- if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
- casingAmount++;
- } else {
- return false;
- }
- }
- }
- }
- }
- y++;
- }
- return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop;
- }
-
+ y++;
+
+ while (y < 12 && !reachedTop) {
+ for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
+ for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth
+ IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
+ Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
+ if (aBaseMetaTileEntity.getAirOffset(x, y, z)) {
+ if (x != xDir || z != zDir) {
+ return false;
+ }
+ } else {
+ if (x == xDir && z == zDir) {
+ reachedTop = true;
+ }
+ if (!addOutputToMachineList(tileEntity, getCasingTextureID())
+ && !addMaintenanceToMachineList(tileEntity, getCasingTextureID())
+ && !addEnergyInputToMachineList(tileEntity, getCasingTextureID())) {
+ if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
+ casingAmount++;
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ y++;
+ }
+ return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop;
+ }
+
private boolean checkTierTwoTower(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
- mControllerY = aBaseMetaTileEntity.getYCoord();
- int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
- int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
- int y = 0; //height
- int casingAmount = 0;
- boolean reachedTop = false;
-
- for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
+ mControllerY = aBaseMetaTileEntity.getYCoord();
+ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;
+ int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
+ int y = 0; //height
+ int casingAmount = 0;
+ boolean reachedTop = false;
+
+ for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth
if (x != 0 || z != 0) {
IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
- if (!addInputToMachineList(tileEntity, CASING_INDEX)
- && !addOutputToMachineList(tileEntity, CASING_INDEX)
- && !addMaintenanceToMachineList(tileEntity, CASING_INDEX)
- && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) {
+ if (!addInputToMachineList(tileEntity, getCasingTextureID())
+ && !addOutputToMachineList(tileEntity, getCasingTextureID())
+ && !addMaintenanceToMachineList(tileEntity, getCasingTextureID())
+ && !addEnergyInputToMachineList(tileEntity, getCasingTextureID())) {
if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
casingAmount++;
} else {
@@ -340,36 +339,159 @@ public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_M
}
}
}
- y++;
-
- while (y < 12 && !reachedTop) {
- for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
- for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth
- IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
- Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
- if (aBaseMetaTileEntity.getAirOffset(x, y, z)) {
- if (x != xDir || z != zDir) {
- return false;
- }
- } else {
- if (x == xDir && z == zDir) {
- reachedTop = true;
- }
- if (!addOutputToMachineList(tileEntity, CASING_INDEX)
- && !addMaintenanceToMachineList(tileEntity, CASING_INDEX)
- && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) {
- if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
- casingAmount++;
- } else {
- return false;
- }
- }
- }
- }
- }
- y++;
- }
- return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop;
- }
-
+ y++;
+
+ while (y < 12 && !reachedTop) {
+ for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width
+ for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth
+ IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z);
+ Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z);
+ if (aBaseMetaTileEntity.getAirOffset(x, y, z)) {
+ if (x != xDir || z != zDir) {
+ return false;
+ }
+ } else {
+ if (x == xDir && z == zDir) {
+ reachedTop = true;
+ }
+ if (!addOutputToMachineList(tileEntity, getCasingTextureID())
+ && !addMaintenanceToMachineList(tileEntity, getCasingTextureID())
+ && !addEnergyInputToMachineList(tileEntity, getCasingTextureID())) {
+ if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) {
+ casingAmount++;
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ y++;
+ }
+ return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop;
+ }
+
+
+ private int mCasingTier = 0;
+
+ private int getMachineCasingTier() {
+ return mCasingTier;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+
+ ITexture aOriginalTexture;
+
+ // Check things exist client side (The worst code ever)
+ if (aBaseMetaTileEntity.getWorld() != null) {
+
+ }
+ // Check the Tier Client Side
+ int aTier = mCasingTier;
+
+ if (aTier == 0) {
+ aOriginalTexture = Textures.BlockIcons.CASING_BLOCKS[49];
+ }
+ else if (aTier == 1) {
+ aOriginalTexture = Textures.BlockIcons.CASING_BLOCKS[43];
+ }
+ else {
+ aOriginalTexture = Textures.BlockIcons.CASING_BLOCKS[49];
+ }
+
+ if (aSide == aFacing) {
+ return new ITexture[]{aOriginalTexture, new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER)};
+ }
+ return new ITexture[]{aOriginalTexture};
+ }
+
+ private int getCasingTextureID() {
+ // Check the Tier Client Side
+ int aTier = mCasingTier;
+
+ if (aTier == 1) {
+ return 49;
+ }
+ else if (aTier == 2) {
+ return 43;
+ }
+ else {
+ return 49;
+ }
+ }
+
+ public boolean addToMachineList(IGregTechTileEntity aTileEntity) {
+ int aMaxTier = getMachineCasingTier();
+ final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_TieredMachineBlock) {
+ GT_MetaTileEntity_TieredMachineBlock aMachineBlock = (GT_MetaTileEntity_TieredMachineBlock) aMetaTileEntity;
+ int aTileTier = aMachineBlock.mTier;
+ if (aTileTier > aMaxTier) {
+ Logger.INFO("Hatch tier too high.");
+ return false;
+ }
+ else {
+ return addToMachineList(aTileEntity, getCasingTextureID());
+ }
+ }
+ else {
+ Logger.INFO("Bad Tile Entity being added to hatch map."); // Shouldn't ever happen, but.. ya know..
+ return false;
+ }
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (aTick % 20 == 0 && !mUpgraded) {
+ ItemStack aGuiStack = this.getGUIItemStack();
+ if (aGuiStack != null) {
+ if (GT_Utility.areStacksEqual(aGuiStack, GregtechItemList.Distillus_Upgrade_Chip.get(1))) {
+ this.mUpgraded = true;
+ ItemUtils.depleteStack(aGuiStack);
+ }
+ }
+ }
+ // Silly Client Syncing
+ if (aBaseMetaTileEntity.isClientSide()) {
+ this.mCasingTier = getCasingTierOnClientSide();
+ }
+ }
+
+
+
+ @SideOnly(Side.CLIENT)
+ private final int getCasingTierOnClientSide() {
+ if (this == null || this.getBaseMetaTileEntity().getWorld() == null) {
+ return 0;
+ }
+ try {
+ Block aInitStructureCheck;
+ int aInitStructureCheckMeta;
+ IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity();
+ for (int i=1;1<10;i++) {
+ aInitStructureCheck = aBaseMetaTileEntity.getBlockOffset(0, i, 0);
+ aInitStructureCheckMeta = aBaseMetaTileEntity.getMetaIDOffset(0, i, 0);
+ if (aInitStructureCheck == GregTech_API.sBlockCasings4 && aInitStructureCheckMeta == 1) {
+ return 0;
+ }
+ else if (aInitStructureCheck == ModBlocks.blockCasingsTieredGTPP) {
+ return 1;
+ }
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ return 0;
+ }
+
+ }
+
+ @Override
+ public void setItemNBT(NBTTagCompound aNBT) {
+ aNBT.setBoolean("mUpgraded", mUpgraded);
+ super.setItemNBT(aNBT);
+ }
+
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java
index 6e7039f8ca..620bb9f4b3 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java
@@ -251,7 +251,7 @@ extends GregtechMeta_MultiBlockBase
Block aBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j);
int aMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j);
- if (!isValidBlockForStructure(tTileEntity, 1, true, aBlock, aMeta,
+ if (!isValidBlockForStructure(tTileEntity, TAE.getIndexFromPage(1, 11), true, aBlock, aMeta,
ModBlocks.blockCasings2Misc, 11)) {
log("Bad Thermal Boiler casing");
return false;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java
new file mode 100644
index 0000000000..2425e86c30
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeSemifluidGenerator.java
@@ -0,0 +1,317 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+
+public class GregtechMetaTileEntity_LargeSemifluidGenerator extends GregtechMeta_MultiBlockBase {
+
+ protected int fuelConsumption = 0;
+ protected int fuelValue = 0;
+ protected int fuelRemaining = 0;
+ protected boolean boostEu = false;
+
+ public GregtechMetaTileEntity_LargeSemifluidGenerator(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GregtechMetaTileEntity_LargeSemifluidGenerator(String aName) {
+ super(aName);
+ }
+
+ public String[] getTooltip() {
+ return new String[]{
+ "Controller Block for the Large Semifluid Generator",
+ "Engine Intake Casings must not be obstructed in front (only air blocks)",
+ "Supply Semifluid Fuels and 2000L of Lubricant per hour to run.",
+ "Supply 80L of Oxygen per second to boost output (optional).",
+ "Default: Produces 2048EU/t at 100% efficiency",
+ "Boosted: Produces 6144EU/t at 150% efficiency",
+ "Size(WxHxD): 3x3x4, Controller (front centered)",
+ "3x3x4 of Stable Titanium Machine Casing (hollow, Min 16!)",
+ "All hatches except dynamo can replace any Stable Titanium casing in middle two segments",
+ "2x Steel Gear Box Machine Casing inside the Hollow Casing",
+ "8x Engine Intake Machine Casing (around controller)",
+ "2x Input Hatch (Fuel/Lubricant)",
+ "1x Maintenance Hatch",
+ "1x Muffler Hatch",
+ "1x Dynamo Hatch (back centered)",
+ };
+ }
+
+ 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[50], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE)};
+ }
+ return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[50]};
+ }
+
+ @Override
+ public boolean isCorrectMachinePart(ItemStack aStack) {
+ return getMaxEfficiency(aStack) > 0;
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeDieselEngine.png");
+ }
+
+ @Override
+ public boolean checkRecipe(ItemStack aStack) {
+ ArrayList<FluidStack> tFluids = getStoredFluids();
+ Collection<GT_Recipe> tRecipeList = Gregtech_Recipe_Map.sSemiFluidLiquidFuels.mRecipeList;
+
+ if(tFluids.size() > 0 && tRecipeList != null) { //Does input hatch have a semifluid fuel?
+ for (FluidStack hatchFluid1 : tFluids) { //Loops through hatches
+ for(GT_Recipe aFuel : tRecipeList) { //Loops through semifluid fuel recipes
+ FluidStack tLiquid;
+ if ((tLiquid = GT_Utility.getFluidForFilledItem(aFuel.getRepresentativeInput(0), true)) != null) { //Create fluidstack from current recipe
+ if (hatchFluid1.isFluidEqual(tLiquid)) { //Has a semifluid fluid
+ fuelConsumption = tLiquid.amount = boostEu ? (4096 / aFuel.mSpecialValue) : (2048 / aFuel.mSpecialValue); //Calc fuel consumption
+ if(depleteInput(tLiquid)) { //Deplete that amount
+ boostEu = depleteInput(Materials.Oxygen.getGas(4L));
+ if(tFluids.contains(Materials.Lubricant.getFluid(2L))) { //Has lubricant?
+ //Deplete Lubricant. 2000L should = 1 hour of runtime (if baseEU = 2048)
+ if(mRuntime % 72 == 0 || mRuntime == 0) {
+ depleteInput(Materials.Lubricant.getFluid(boostEu ? 2 : 1));
+ }
+ }
+ else {
+ return false;
+ }
+
+ fuelValue = aFuel.mSpecialValue;
+ fuelRemaining = hatchFluid1.amount; //Record available fuel
+ this.mEUt = mEfficiency < 2000 ? 0 : 2048; //Output 0 if startup is less than 20%
+ this.mProgresstime = 1;
+ this.mMaxProgresstime = 1;
+ this.mEfficiencyIncrease = 15;
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ this.mEUt = 0;
+ this.mEfficiency = 0;
+ return false;
+ }
+
+ @Override
+ public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
+ byte tSide = aBaseMetaTileEntity.getBackFacing();
+ int aTileX = aBaseMetaTileEntity.getXCoord();
+ int aTileY = aBaseMetaTileEntity.getYCoord();
+ int aTileZ = aBaseMetaTileEntity.getZCoord();
+ boolean xFacing = (tSide == 4 || tSide == 5);
+ boolean zFacing = (tSide == 2 || tSide == 3);
+ int aCasingCount = 0;
+ // Check Intake Hatches
+ for (int aHorizontalOffset = -1; aHorizontalOffset < 2; aHorizontalOffset++) {
+ for (int aVerticalOffset = -1; aVerticalOffset < 2; aVerticalOffset++) {
+ if (aHorizontalOffset == 0 && aVerticalOffset == 0) {
+ continue;
+ }
+ int aX = !xFacing ? (aTileX + aHorizontalOffset) : aTileX;
+ int aY = aTileY + aVerticalOffset;
+ int aZ = !zFacing ? (aTileZ + aHorizontalOffset) : aTileZ;
+ Block aIntakeBlock = aBaseMetaTileEntity.getBlock(aX, aY, aZ);
+ int aIntakeMeta = aBaseMetaTileEntity.getMetaID(aX, aY, aZ);
+ if (!isValidBlockForStructure(null, 0, false, aIntakeBlock, aIntakeMeta, getIntakeBlock(), getIntakeMeta())) {
+ return false; // Not intake casing surrounding controller
+ }
+ }
+ }
+ // Check Casings
+ int aStartDepthOffset = (tSide == 2 || tSide == 4) ? -1 : 1;
+ int aFinishDepthOffset = (tSide == 2 || tSide == 4) ? -4 : 4;
+ for (int aDepthOffset = aStartDepthOffset; aDepthOffset != aFinishDepthOffset;) {
+ for (int aHorizontalOffset = -1; aHorizontalOffset < 2; aHorizontalOffset++) {
+ for (int aVerticalOffset = -1; aVerticalOffset < 2; aVerticalOffset++) {
+ if (aHorizontalOffset == 0 && aVerticalOffset == 0) {
+ continue;
+ }
+ int aX = !xFacing ? (aTileX + aHorizontalOffset) : (aTileX + aDepthOffset);
+ int aY = aTileY + aVerticalOffset;
+ int aZ = !zFacing ? (aTileZ + aHorizontalOffset) : (aTileZ + aDepthOffset);
+ Block aCasingBlock = aBaseMetaTileEntity.getBlock(aX, aY, aZ);
+ int aCasingMeta = aBaseMetaTileEntity.getMetaID(aX, aY, aZ);
+ IGregTechTileEntity aTileEntity = getBaseMetaTileEntity().getIGregTechTileEntity(aX, aY, aZ);
+ // Side areas
+ if (aDepthOffset < 3) {
+ if (!isValidBlockForStructure(aTileEntity, getCasingTextureIndex(), true, aCasingBlock, aCasingMeta, getCasingBlock(), getCasingMeta())) {
+ return false; // Not valid casing
+ }
+ else {
+ if (aTileEntity == null) {
+ aCasingCount++;
+ }
+ }
+ }
+ else {
+ if (!isValidBlockForStructure(null, 0, false, aCasingBlock, aCasingMeta, getCasingBlock(), getCasingMeta())) {
+ return false; // Not valid casing
+ }
+ else {
+ aCasingCount++;
+ }
+ }
+ }
+ }
+ // Count Backwards for 2 axis
+ if (aStartDepthOffset == -1) {
+ aDepthOffset--;
+ }
+ // Count Forwards for 2 axis
+ else {
+ aDepthOffset++;
+ }
+ }
+
+ // Check Gear Boxes
+ if(aBaseMetaTileEntity.getBlockAtSideAndDistance(tSide, 1) != getGearboxBlock() && aBaseMetaTileEntity.getBlockAtSideAndDistance(tSide, 2) != getGearboxBlock()) {
+ return false;
+ }
+ if(aBaseMetaTileEntity.getMetaIDAtSideAndDistance(tSide, 1) != getGearboxMeta() && aBaseMetaTileEntity.getMetaIDAtSideAndDistance(tSide, 2) != getGearboxMeta()) {
+ return false;
+ }
+
+ // Check Dynamo
+ this.mDynamoHatches.clear();
+ IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 3);
+ if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) {
+ if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Dynamo)) {
+ this.addDynamoToMachineList(tTileEntity, getCasingTextureIndex());
+ } else {
+ return false;
+ }
+ }
+ return aCasingCount >= 16;
+ }
+
+ public Block getCasingBlock() {
+ return GregTech_API.sBlockCasings4;
+ }
+
+ public byte getCasingMeta() {
+ return 2;
+ }
+
+ public Block getIntakeBlock() {
+ return GregTech_API.sBlockCasings4;
+ }
+
+ public byte getIntakeMeta() {
+ return 13;
+ }
+
+ public Block getGearboxBlock() {
+ return GregTech_API.sBlockCasings2;
+ }
+
+ public byte getGearboxMeta() {
+ return 3;
+ }
+
+ public byte getCasingTextureIndex() {
+ return 50;
+ }
+
+ private boolean addToMachineList(IGregTechTileEntity tTileEntity) {
+ return ((addMaintenanceToMachineList(tTileEntity, getCasingTextureIndex())) || (addInputToMachineList(tTileEntity, getCasingTextureIndex())) || (addOutputToMachineList(tTileEntity, getCasingTextureIndex())) || (addMufflerToMachineList(tTileEntity, getCasingTextureIndex())));
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaTileEntity_LargeSemifluidGenerator(this.mName);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ }
+
+ @Override
+ public int getDamageToComponent(ItemStack aStack) {
+ return 1;
+ }
+
+ public int getMaxEfficiency(ItemStack aStack) {
+ return boostEu ? 20000 : 10000;
+ }
+
+ @Override
+ public int getPollutionPerTick(ItemStack aStack) {
+ return 64;
+ }
+
+ @Override
+ public boolean explodesOnComponentBreak(ItemStack aStack) {
+ return true;
+ }
+
+ @Override
+ public String[] getExtraInfoData() {
+ return new String[]{
+ "Large Semifluid Generator",
+ "Current Output: " + mEUt * mEfficiency / 10000 + " EU/t",
+ "Fuel Consumption: " + fuelConsumption + "L/t",
+ "Fuel Value: " + fuelValue + " EU/L",
+ "Fuel Remaining: " + fuelRemaining + " Litres",
+ "Current Efficiency: " + (mEfficiency / 100) + "%",
+ getIdealStatus() == getRepairStatus() ? "No Maintainance issues" : "Needs Maintainance"};
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public boolean hasSlotInGUI() {
+ return false;
+ }
+
+ @Override
+ public String getCustomGUIResourceName() {
+ return null;
+ }
+
+ @Override
+ public String getMachineType() {
+ return "Semifluid Generator";
+ }
+
+ @Override
+ public int getMaxParallelRecipes() {
+ return 0;
+ }
+
+ @Override
+ public int getEuDiscountForParallelism() {
+ return 0;
+ }
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java
index 60c0ade62f..f0c5d9388f 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java
@@ -755,7 +755,6 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase {
if (aBaseMetaTileEntity.isClientSide()) {
this.mSolidCasingTier = getCasingTierOnClientSide();
}
-
}
@Override