diff options
Diffstat (limited to 'src/Java/gtPlusPlus/xmod')
18 files changed, 1354 insertions, 261 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java index 663804bc81..e7ac605450 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java @@ -7,6 +7,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import codechicken.nei.api.API; import cpw.mods.fml.common.event.FMLLoadCompleteEvent; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; @@ -23,7 +24,9 @@ import gtPlusPlus.api.helpers.GregtechPlusPlus_API.Multiblock_API; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.data.Pair; +import gtPlusPlus.api.objects.minecraft.multi.NoEUBonusMultiBehaviour; import gtPlusPlus.api.objects.minecraft.multi.NoOutputBonusMultiBehaviour; +import gtPlusPlus.api.objects.minecraft.multi.NoSpeedBonusMultiBehaviour; import gtPlusPlus.australia.gen.gt.WorldGen_GT_Australia; import gtPlusPlus.core.handler.COMPAT_HANDLER; import gtPlusPlus.core.handler.OldCircuitHandler; @@ -131,6 +134,8 @@ public class HANDLER_GT { // Register the No-Bonus Special Behaviour. Multiblock_API.registerSpecialMultiBehaviour(new NoOutputBonusMultiBehaviour()); + Multiblock_API.registerSpecialMultiBehaviour(new NoSpeedBonusMultiBehaviour()); + Multiblock_API.registerSpecialMultiBehaviour(new NoEUBonusMultiBehaviour()); //Register some custom recipe maps for any enabled multiblocks. //MultiblockRecipeMapHandler.run(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index cd4b0947e4..c7fe473c44 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -2,13 +2,14 @@ package gtPlusPlus.xmod.gregtech.api.enums; import static gregtech.api.enums.GT_Values.W; -import gregtech.api.util.*; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; import gtPlusPlus.xmod.gregtech.api.interfaces.GregtechItemContainer; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; /** * Class containing all non-OreDict Items of GregTech. @@ -130,6 +131,14 @@ public enum GregtechItemList implements GregtechItemContainer { Farm_Processor_ZPM, Farm_Processor_UV, + // Upgrade chip for Distillus + Distillus_Upgrade_Chip, + + + // Chips used to nerf my multis via custom behavioural attachments + Chip_MultiNerf_NoOutputBonus, + Chip_MultiNerf_NoSpeedBonus, + Chip_MultiNerf_NoEuBonus, //---------------------------------------------------------------------------- @@ -308,7 +317,9 @@ public enum GregtechItemList implements GregtechItemContainer { Machine_Adv_ImplosionCompressor, Machine_Adv_DistillationTower, - + //Advanced Assembly Line + Machine_Adv_AssemblyLine, + //Advanced Vacuum Freezer Industrial_Cryogenic_Freezer, Casing_AdvancedVacuum, @@ -579,6 +590,7 @@ public enum GregtechItemList implements GregtechItemContainer { Generator_SemiFluid_LV, Generator_SemiFluid_MV, Generator_SemiFluid_HV, + Controller_LargeSemifluidGenerator, //Advanced Mixer 4x4 diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index ef5429af62..b6b75808fc 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -16,7 +16,6 @@ import org.apache.commons.lang3.ArrayUtils; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; -import gregtech.api.enums.TAE; import gregtech.api.gui.GT_Container_MultiMachine; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -2213,7 +2212,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult } } - return super.addDynamoToMachineList(aTileEntity, aBaseCasingIndex); + return addToMachineList(aTileEntity, aBaseCasingIndex); } @@ -2536,9 +2535,10 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult boolean isHatch = false; if (aBaseMetaTileEntity != null) { - if (aCasingID < 64) { + // Unsure why this check exists? + /*if (aCasingID < 64) { aCasingID = TAE.GTPP_INDEX(aCasingID); - } + }*/ isHatch = this.addToMachineList(aBaseMetaTileEntity, aCasingID); if (isHatch) { 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 diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java index 2b4e52abb9..3c74c4166d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java @@ -210,11 +210,11 @@ public class RecipeGen_Fluids extends RecipeGen_Base { // Shape_Mold_Ring, - ItemList mold_Rod = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Rod", null); - ItemList mold_Rod_Long = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Rod_Long", null); - ItemList mold_Bolt = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Bolt", null); - ItemList mold_Screw = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Screw", null); - ItemList mold_Ring = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Ring", null); + ItemList mold_Rod = ItemUtils.getValueOfItemList("Shape_Mold_Rod", null); + ItemList mold_Rod_Long = ItemUtils.getValueOfItemList("Shape_Mold_Rod_Long", null); + ItemList mold_Bolt = ItemUtils.getValueOfItemList("Shape_Mold_Bolt", null); + ItemList mold_Screw = ItemUtils.getValueOfItemList("Shape_Mold_Screw", null); + ItemList mold_Ring = ItemUtils.getValueOfItemList("Shape_Mold_Ring", null); // Rod if (ItemUtils.checkForInvalidItems(material.getRod(1))) diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java index 3490e8d8be..5d2f5b414d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechComponentAssembler.java @@ -197,7 +197,7 @@ public class GregtechComponentAssembler { ItemStack Input[] = { wireStack, cableStack, rodStack, magrodStack }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Electric_Motor_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getElectricMotor(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } catch (Throwable t) { @@ -213,12 +213,12 @@ public class GregtechComponentAssembler { ItemStack rodStack = ItemUtils.getGregtechOreStack(OrePrefixes.stick, mat, 2); ItemStack plateStack = ItemUtils.getGregtechOreStack(OrePrefixes.plate, mat, 3); ItemStack gearStack = ItemUtils.getGregtechOreStack(OrePrefixes.gearGtSmall, mat, 1); - ItemStack motorStack = ItemList.valueOf("Electric_Motor_" + GT_Values.VN[tier]).get(1); + ItemStack motorStack = CI.getElectricMotor(tier, 1); ItemStack Input[] = { plateStack, cableStack, rodStack, gearStack, motorStack }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Electric_Piston_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getElectricPiston(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } catch (Throwable t) { @@ -230,7 +230,7 @@ public class GregtechComponentAssembler { try { OrePrefixes prefixCable = OrePrefixes.cableGt01; ItemStack cableStack = ItemUtils.getGregtechOreStack(prefixCable, cable, 1); - ItemStack motorStack = ItemList.valueOf("Electric_Motor_" + GT_Values.VN[tier]).get(2); + ItemStack motorStack = CI.getElectricMotor(tier, 2); boolean mAdd[]; final ArrayList<ItemStack> oreDictList = OreDictionary.getOres("plateAnyRubber"); if (!oreDictList.isEmpty()) { @@ -241,7 +241,7 @@ public class GregtechComponentAssembler { returnValue.stackSize = 6; ItemStack Input[] = { cableStack, motorStack, returnValue }; mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Conveyor_Module_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getConveyor(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } int added = 0; @@ -261,7 +261,7 @@ public class GregtechComponentAssembler { ItemStack Input[] = { cableStack, motorStack, ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateRubber", 6) }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Conveyor_Module_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getConveyor(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } @@ -277,7 +277,7 @@ public class GregtechComponentAssembler { ItemStack screwStack = ItemUtils.getGregtechOreStack(OrePrefixes.screw, main, 1); ItemStack rotorStack = ItemUtils.getGregtechOreStack(OrePrefixes.rotor, main, 1); ItemStack pipeStack = ItemUtils.getGregtechOreStack(OrePrefixes.pipeMedium, pipe, 1); - ItemStack motorStack = ItemList.valueOf("Electric_Motor_" + GT_Values.VN[tier]).get(1); + ItemStack motorStack = CI.getElectricMotor(tier, 1); boolean mAdd[]; final ArrayList<ItemStack> oreDictList = OreDictionary.getOres("ringAnyRubber"); if (!oreDictList.isEmpty()) { @@ -288,7 +288,7 @@ public class GregtechComponentAssembler { returnValue.stackSize = 2; ItemStack Input[] = { cableStack, screwStack, rotorStack, pipeStack, motorStack, returnValue }; mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Electric_Pump_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getElectricPump(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } int added = 0; @@ -308,7 +308,7 @@ public class GregtechComponentAssembler { ItemStack Input[] = { cableStack, screwStack, rotorStack, pipeStack, motorStack, ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ringRubber", 2) }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Electric_Pump_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getElectricPump(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } @@ -322,8 +322,8 @@ public class GregtechComponentAssembler { try { ItemStack cableStack = ItemUtils.getGregtechOreStack(OrePrefixes.cableGt01, cable, 3); ItemStack rodStack = ItemUtils.getGregtechOreStack(OrePrefixes.stick, stick, 2); - ItemStack motorStack = ItemList.valueOf("Electric_Motor_" + GT_Values.VN[tier]).get(2); - ItemStack pistonStack = ItemList.valueOf("Electric_Piston_" + GT_Values.VN[tier]).get(1); + ItemStack motorStack = CI.getElectricMotor(tier, 2); + ItemStack pistonStack = CI.getElectricPiston(tier, 1); boolean mAdd[]; final ItemStack oreDictList[] = CI.getAllCircuitsOfTier(tier); @@ -335,7 +335,7 @@ public class GregtechComponentAssembler { returnValue.stackSize = 1; ItemStack Input[] = { returnValue, cableStack, rodStack, pistonStack, motorStack }; mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Robot_Arm_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getRobotArm(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } for (boolean y : mAdd) { @@ -353,7 +353,7 @@ public class GregtechComponentAssembler { else { ItemStack Input[] = { ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(tier), 1), cableStack, rodStack, pistonStack, motorStack }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Robot_Arm_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getRobotArm(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } @@ -381,8 +381,8 @@ public class GregtechComponentAssembler { else mWT = "01"; - ItemStack eyeQuantum = ItemList.valueOf("QuantumEye").get(1); - ItemStack starQuantum = ItemList.valueOf("QuantumStar").get(1); + ItemStack eyeQuantum = ItemUtils.getValueOfItemList("QuantumEye", 1, ItemUtils.getSimpleStack(Items.ender_eye, 4)); + ItemStack starQuantum = ItemUtils.getValueOfItemList("QuantumStar", 1, ItemUtils.getSimpleStack(Items.nether_star, 4)); if (tier == 1) gem = ItemUtils.getSimpleStack(Items.ender_pearl); @@ -410,7 +410,7 @@ public class GregtechComponentAssembler { returnValue.stackSize = 4; ItemStack Input[] = { returnValue, wireStack, gem }; mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Field_Generator_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getFieldGenerator(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } for (boolean y : mAdd) { @@ -428,7 +428,7 @@ public class GregtechComponentAssembler { else { ItemStack Input[] = { ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(tier), 4), wireStack, gem }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Field_Generator_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getFieldGenerator(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } @@ -454,7 +454,7 @@ public class GregtechComponentAssembler { returnValue.stackSize = 2; ItemStack Input[] = { returnValue, cableStack, gemstack, magrodStack }; mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Emitter_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getEmitter(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } for (boolean y : mAdd) { @@ -472,7 +472,7 @@ public class GregtechComponentAssembler { else { ItemStack Input[] = { ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(tier), 2), cableStack, gemstack, magrodStack }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Emitter_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getEmitter(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } @@ -500,7 +500,7 @@ public class GregtechComponentAssembler { returnValue.stackSize = 1; ItemStack Input[] = { gemStack, cableStack, returnValue, magrodStack }; mAdd[mcount++] = CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Sensor_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getSensor(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } for (boolean y : mAdd) { @@ -518,7 +518,7 @@ public class GregtechComponentAssembler { else { ItemStack Input[] = { gemStack, cableStack, magrodStack, ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(tier), 1) }; return CORE.RA.addComponentMakerRecipe(Input, GT_Values.NF, - ItemList.valueOf("Sensor_" + GT_Values.VN[tier]).get(1), (tier * 40), + CI.getSensor(tier, 1), (tier * 40), ((int) GT_Values.V[tier] / 16) * 15); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java index 54e4fbf024..2c622b9d8e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java @@ -5,8 +5,8 @@ import java.lang.reflect.InvocationTargetException; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_AirIntake; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ControlCore; @@ -23,12 +23,9 @@ public class GregtechCustomHatches { if (gtPlusPlus.core.lib.LoadedMods.Gregtech) { Logger.INFO("Gregtech5u Content | Registering Custom Fluid Hatches."); run1(); - - //No pollution in 5.08 - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + if (PollutionUtils.isPollutionEnabled()) { run2(); - } - + } run3(); } } @@ -201,32 +198,31 @@ public class GregtechCustomHatches { Class<?> aBusEntity = aClass; Constructor<?> constructor; try { - constructor = aBusEntity.getConstructor(int.class, String.class, String.class, int.class, int.class); + constructor = aBusEntity.getConstructor(int.class, String.class, String.class, int.class, int.class); if (constructor != null) { - Object aPipe; + Object aBus; try { - aPipe = constructor.newInstance( + aBus = constructor.newInstance( aID, aUnlocalName, aLocalName, aTier, (1+ aTier) * 32); - if (aPipe == null) { - //Logger.INFO("Failed to Generate "+aMaterial+" Hexadecuple pipes."); + if (aBus == null) { + Logger.INFO("Failed to Generate "+aLocalName+"."); } else { Logger.INFO("Generated "+aLocalName+"."); - return aPipe; - //GT_OreDictUnificator.registerOre("pipeHexadecuple" + aMaterial, aPipe.getStackForm(1L)); + return aBus; } } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - //Logger.INFO("Failed to Generate "+aMaterial+" Hexadecuple pipes. [Ecx]"); e.printStackTrace(); + Logger.INFO("Failed to Generate "+aLocalName+"."); } } } catch (NoSuchMethodException | SecurityException e1) { - // TODO Auto-generated catch block e1.printStackTrace(); + Logger.INFO("Failed to Generate "+aLocalName+"."); } return null; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java index 86cbdb75fa..67c54a7699 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java @@ -1,8 +1,10 @@ package gtPlusPlus.xmod.gregtech.registration.gregtech; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialVacuumFreezer; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_AssemblyLine; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_DistillationTower; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_EBF; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_Fusion_MK4; @@ -24,6 +26,9 @@ public class GregtechFactoryGradeReplacementMultis { //31021 GregtechItemList.Machine_Adv_DistillationTower.set(new GregtechMetaTileEntity_Adv_DistillationTower(31021, "multimachine.adv.distillationtower", "Dangote Distillus").getStackForm(1L)); + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + GregtechItemList.Machine_Adv_AssemblyLine.set(new GregtechMetaTileEntity_Adv_AssemblyLine(31024, "multimachine.adv.assemblyline", "Compound Fabricator").getStackForm(1L)); + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java index 2d548a57b7..5a7d3a50d7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechRocketFuelGenerator.java @@ -12,7 +12,7 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GregtechMetaTileEntityRocketFuelGenerator; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_LargeRocketEngine; @@ -28,13 +28,13 @@ public class GregtechRocketFuelGenerator { } } - + private static void run1() { GregtechItemList.Controller_RocketEngine.set( new GregtechMetaTileEntity_LargeRocketEngine(996, "gtpp.multimachine.rocketengine", "Rocketdyne F-1A Engine").getStackForm(1L)); - ItemList aDieselEngine = Utils.getValueOfItemList("Machine_Multi_DieselEngine", ItemList.Machine_Multi_LargeBoiler_TungstenSteel); + ItemList aDieselEngine = ItemUtils.getValueOfItemList("Machine_Multi_DieselEngine", ItemList.Machine_Multi_LargeBoiler_TungstenSteel); GT_ModHandler.addCraftingRecipe( GregtechItemList.Controller_RocketEngine.get(1L), diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSemiFluidgenerators.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSemiFluidgenerators.java index c4141a6a77..6b38415db1 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSemiFluidgenerators.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSemiFluidgenerators.java @@ -2,6 +2,7 @@ package gtPlusPlus.xmod.gregtech.registration.gregtech; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GT_MetaTileEntity_SemiFluidGenerator; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_LargeSemifluidGenerator; public class GregtechSemiFluidgenerators { @@ -12,6 +13,8 @@ public class GregtechSemiFluidgenerators { "Advanced Semi-Fluid Generator", 2).getStackForm(1L)); GregtechItemList.Generator_SemiFluid_HV.set(new GT_MetaTileEntity_SemiFluidGenerator(839, "basicgenerator.semifluid.tier.03", "Turbo Semi-Fluid Generator", 3).getStackForm(1L)); + GregtechItemList.Controller_LargeSemifluidGenerator.set(new GregtechMetaTileEntity_LargeSemifluidGenerator(31026, "gtpp.multimachine.semifluidgenerator", "Large Semifluid Burner").getStackForm(1L)); + } } diff --git a/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java b/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java index f23a5db6fe..4f1006693e 100644 --- a/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java +++ b/src/Java/gtPlusPlus/xmod/thaumcraft/util/ThaumcraftUtils.java @@ -159,7 +159,9 @@ public class ThaumcraftUtils { rResearch.setItemTriggers(aResearchTriggers); rResearch.setHidden(); } - rResearch.setPages((TC_ResearchPage_Wrapper[]) tPages.toArray(new TC_ResearchPage_Wrapper[tPages.size()])); + + Object[] aVarArgs = (TC_ResearchPage_Wrapper[]) tPages.toArray(new TC_ResearchPage_Wrapper[tPages.size()]); + rResearch.setPages(aVarArgs); return rResearch.registerResearchItem(); } |