diff options
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common')
15 files changed, 252 insertions, 179 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java index 5ebdbf0ef8..cfbf7bd487 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java @@ -38,7 +38,8 @@ extends GT_MetaTileEntity_BasicGenerator @Override public String[] getDescription() { - return new String[]{this.mDescription, "Generates power at " + this.getEfficiency() + "% Efficiency per tick"}; + String aPollution = "Causes between "+this.getPollution()+ " Pollution per second"; + return new String[]{this.mDescription, "Generates power at " + this.getEfficiency() + "% Efficiency per tick", aPollution}; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java index 6a42232e40..7d20f1eb59 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java @@ -54,12 +54,12 @@ extends GregtechRocketFuelGeneratorBase { } public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "RocketEngine.efficiency.tier." + this.mTier, ((40+((this.mTier) * 16))/4)+(this.mTier)); + this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "RocketEngine.efficiency.tier." + this.mTier, 80 - (10 * (this.mTier - 4))); } @Override public int getEfficiency() { - int eff = ((40+((this.mTier) * 16))/4)+(this.mTier); + int eff = 80 - (10 * (this.mTier - 4)); return eff; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java index 78896dd650..b5cfff10e4 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java @@ -227,7 +227,8 @@ public class GregtechMetaTileEntity_IndustrialDehydrator extends GregtechMeta_Mu return false; } - if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { + aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes); + if (aMaxParallelRecipes == 0) { Logger.WARNING("BAD RETURN - 2"); return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java index e721761d82..6e4c071ecb 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java @@ -112,7 +112,30 @@ extends GregtechMeta_MultiBlockBase { @Override public boolean checkRecipe(final ItemStack aStack) { - return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 250); + for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) { + ArrayList<ItemStack> tBusItems = new ArrayList<ItemStack>(); + tBus.mRecipeMap = getRecipeMap(); + if (isValidMetaTileEntity(tBus)) { + for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { + if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null) + tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i)); + } + } + ItemStack[] inputs = new ItemStack[tBusItems.size()]; + int slot = 0; + for (ItemStack g : tBusItems) { + inputs[slot++] = g; + } + if (inputs.length > 0) { + log("Recipe. ["+inputs.length+"]["+getMaxParallelRecipes()+"]"); + if (checkRecipeGeneric(inputs, new FluidStack[]{}, getMaxParallelRecipes(), getEuDiscountForParallelism(), 250, 10000)) { + log("Recipe 2."); + return true; + } + } + + } + return false; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java index 8b07117596..b071c77d15 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMultiMachine.java @@ -351,7 +351,8 @@ extends GregtechMeta_MultiBlockBase { return false; } - if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { + aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes); + if (aMaxParallelRecipes == 0) { Logger.MACHINE_INFO("BAD RETURN - 2|"+tCircuitID); return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java index 8c62937bae..c99a6e286b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java @@ -53,8 +53,6 @@ extends GregtechMeta_MultiBlockBase { "Controller (Center Bottom)", "1x Input Bus (Any top or bottom edge casing)", "4x Output Bus (Any top or bottom edge casing)", - "1x Maintenance Hatch (Any top or bottom edge casing)", - "1x Muffler Hatch (Any top or bottom edge casing)", "1x Energy Hatch (Any top or bottom edge casing)", "18x Sieve Grate (Top and Middle 3x3)", "Sieve Casings for the rest (35 min)" diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java index ab7fb79c4b..133e10d6f6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java @@ -152,9 +152,14 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase Block tUsedBlock = aBaseMetaTileEntity.getBlockOffset(xDir + 1, 2, zDir); byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 2, zDir); this.mHeatingCapacity = StaticFields59.getHeatingCapacityForCoil(tUsedBlock, tUsedMeta); + + int aCasingCount = 0; for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { + + + if ((i != 0) || (j != 0)) { //Coils 1 if (!isValidBlockForStructure(null, CASING_TEXTURE_ID, false, aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j), StaticFields59.getBlockCasings5(), tUsedMeta)) { @@ -170,8 +175,15 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase } //Top Layer + + Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j); + int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j); + if (aCurrentBlock == ModBlocks.blockCasings3Misc && aCurrentMeta == 11) { + aCasingCount++; + } + final IGregTechTileEntity tTileEntity2 = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 3, zDir + j); - if (!isValidBlockForStructure(tTileEntity2, CASING_TEXTURE_ID, true, aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j), ModBlocks.blockCasings3Misc, 11)) { + if (!isValidBlockForStructure(tTileEntity2, CASING_TEXTURE_ID, true, aCurrentBlock, aCurrentMeta, ModBlocks.blockCasings3Misc, 11)) { Logger.INFO("Top Layer missing."); return false; } @@ -179,9 +191,16 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase } for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { + + + Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j); + int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j); + if (aCurrentBlock == ModBlocks.blockCasings3Misc && aCurrentMeta == 11) { + aCasingCount++; + } if ((xDir + i != 0) || (zDir + j != 0)) { IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0,zDir + j); - if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, aBaseMetaTileEntity.getBlockOffset(xDir + i, 0, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 0, zDir + j), ModBlocks.blockCasings3Misc, 11)) { + if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, aCurrentBlock, aCurrentMeta, ModBlocks.blockCasings3Misc, 11)) { Logger.INFO("Bottom Layer missing."); return false; } @@ -189,8 +208,7 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase } } - // TODO - Fix Casing Count - return true; + return aCasingCount >= 10; } public int getMaxEfficiency(ItemStack aStack) { @@ -282,7 +300,8 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase return false; } - if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { + aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes); + if (aMaxParallelRecipes == 0) { Logger.WARNING("BAD RETURN - 2"); return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java index c31a7c0758..f24825ba8a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_AutoCrafter.java @@ -223,7 +223,10 @@ public class GT4Entity_AutoCrafter extends GregtechMeta_MultiBlockBase { } } catch (IllegalArgumentException | IllegalAccessException e) { } - } + } + else if (this.mMachineMode == MODE.DISASSEMBLY) { + return null; + } return GT_Recipe.GT_Recipe_Map.sAssemblerRecipes; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java index 4e5c95ad73..3592475a5c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java @@ -2,6 +2,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import gregtech.api.GregTech_API; import gregtech.api.enums.TAE; @@ -16,6 +17,7 @@ import gregtech.api.util.Recipe_GT; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.item.Item; @@ -29,7 +31,7 @@ extends GregtechMeta_MultiBlockBase { private int mHeatingCapacity = 0; private int mMode = 0; private boolean isUsingControllerCircuit = false; - private static final Item circuit = CI.getNumberedCircuit(0).getItem(); + private static Item circuit; public GregtechMetaTileEntity_AlloyBlastSmelter(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); @@ -46,7 +48,7 @@ extends GregtechMeta_MultiBlockBase { @Override public String getMachineType() { - return "Alloy Smelter"; + return "Fluid Alloy Cooker"; } @Override @@ -104,6 +106,9 @@ extends GregtechMeta_MultiBlockBase { public boolean isCorrectMachinePart(final ItemStack aStack) { if (this.getBaseMetaTileEntity().isServerSide()) { //Get Controller Circuit + if (circuit == null) { + circuit = CI.getNumberedCircuit(0).getItem(); + } if (aStack != null && aStack.getItem() == circuit) { this.mMode = aStack.getItemDamage(); return this.isUsingControllerCircuit = true; @@ -197,6 +202,14 @@ extends GregtechMeta_MultiBlockBase { } this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); this.mOutputFluids = new FluidStack[]{tRecipe.getFluidOutput(0)}; + List<ItemStack> tOutPutItems = new ArrayList<ItemStack>(); + for (ItemStack tOut : tRecipe.mOutputs) { + if (ItemUtils.checkForInvalidItems(tOut)) { + tOutPutItems.add(tOut); + } + } + if (tOutPutItems.size() > 0) + this.mOutputItems = tOutPutItems.toArray(new ItemStack[tOutPutItems.size()]); this.updateSlots(); return true; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java index ed6c913e6b..6070e3604a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java @@ -2,7 +2,6 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; import java.util.ArrayList; -import gregtech.GT_Mod; import gregtech.api.enums.Dyes; import gregtech.api.enums.TAE; import gregtech.api.enums.Textures; @@ -10,7 +9,6 @@ import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; @@ -25,7 +23,6 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.chemistry.IonParticles; import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.block.Block; @@ -37,8 +34,6 @@ import net.minecraftforge.fluids.FluidStack; public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBase { - public long mEUStore; - public GregtechMetaTileEntity_Cyclotron(int aID, String aName, String aNameRegional, int tier) { super(aID, aName, aNameRegional); } @@ -95,13 +90,11 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas @Override public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setLong("mEUStore", mEUStore); super.saveNBTData(aNBT); } @Override public void loadNBTData(NBTTagCompound aNBT) { - mEUStore = aNBT.getLong("mEUStore"); super.loadNBTData(aNBT); } @@ -395,113 +388,6 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas } @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide()) { - if (mEfficiency < 0) - mEfficiency = 0; - - //Time Counter - this.mTotalRunTime++; - this.fixAllMaintenanceIssue(); - - onRunningTick(null); - - boolean aFormCheck = (aTick % 100 == 0 ? checkMultiblock(aBaseMetaTileEntity, mInventory[1]) : true); - - - - if (mRunningOnLoad && aFormCheck) { - this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU(); - checkRecipe(mInventory[1]); - } - if (--mUpdate == 0 || --mStartUpCheck == 0) { - mInputHatches.clear(); - mInputBusses.clear(); - mOutputHatches.clear(); - mOutputBusses.clear(); - mDynamoHatches.clear(); - mEnergyHatches.clear(); - mMufflerHatches.clear(); - mMaintenanceHatches.clear(); - mChargeHatches.clear(); - mDischargeHatches.clear(); - mControlCoreBus.clear(); - mAirIntakes.clear(); - mMultiDynamoHatches.clear(); - mMachine = aFormCheck; - } - if (mStartUpCheck < 0) { - if (mMachine) { - if (this.mEnergyHatches != null) { - for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) - if (isValidMetaTileEntity(tHatch)) { - if (aBaseMetaTileEntity.getStoredEU() + (2048*4) < maxEUStore() - && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits((2048*4), false)) { - aBaseMetaTileEntity.increaseStoredEnergyUnits((2048*4), true); - } - } - } - if (this.mEUStore <= 0 && mMaxProgresstime > 0) { - stopMachine(); - } - if (getRepairStatus() > 0) { - if (mMaxProgresstime > 0) { - this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(mEUt, true); - if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) { - if (mOutputItems != null) - for (ItemStack tStack : mOutputItems) if (tStack != null) addOutput(tStack); - if (mOutputFluids != null) - for (FluidStack tStack : mOutputFluids) if (tStack != null) addOutput(tStack); - mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); - mOutputItems = null; - mProgresstime = 0; - mMaxProgresstime = 0; - mEfficiencyIncrease = 0; - if (mOutputFluids != null && mOutputFluids.length > 0) { - try { - GT_Mod.instance.achievements.issueAchivementHatchFluid(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), mOutputFluids[0]); - } catch (Exception e) { - } - } - this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU(); - if (aBaseMetaTileEntity.isAllowedToWork()) - checkRecipe(mInventory[1]); - } - } else { - if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { - turnCasingActive(mMaxProgresstime > 0); - if (aBaseMetaTileEntity.isAllowedToWork()) { - this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU(); - if (checkRecipe(mInventory[1])) { - if (this.mEUStore < this.mLastRecipe.mSpecialValue) { - mMaxProgresstime = 0; - turnCasingActive(false); - } - aBaseMetaTileEntity.decreaseStoredEnergyUnits(this.mLastRecipe.mSpecialValue, true); - } - } - if (mMaxProgresstime <= 0) - mEfficiency = Math.max(0, mEfficiency - 1000); - } - } - } else { - this.mLastRecipe = null; - stopMachine(); - } - } else { - turnCasingActive(false); - this.mLastRecipe = null; - stopMachine(); - } - } - //doRandomMaintenanceDamage(); - aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) - | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64)); - aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); - } - } - - @Override public boolean onRunningTick(ItemStack aStack) { if (this.mOutputBusses.size() > 0) { for (GT_MetaTileEntity_Hatch_OutputBus g : this.mOutputBusses) { @@ -529,10 +415,9 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas } } } - } - PollutionUtils.addPollution(getBaseMetaTileEntity(), this.getPollutionPerTick(aStack)); - - return true; + } + this.fixAllMaintenanceIssue(); + return super.onRunningTick(aStack); } @@ -570,7 +455,7 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas return new String[]{ "COMET - Compact Cyclotron MK "+tier, "EU Required: "+powerRequired+"EU/t", - "Stored EU: "+mEUStore+" / "+maxEUStore()}; + "Stored EU: "+this.getEUVar()+" / "+maxEUStore()}; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java index 031bf16b17..cb9c68b53c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialFishingPond.java @@ -549,7 +549,8 @@ public class GregtechMetaTileEntity_IndustrialFishingPond extends GregtechMeta_M ItemStack[] mFishOutput = generateLoot(this.mMode); mFishOutput = removeNulls(mFishOutput); GT_Recipe g = new Recipe_GT(true, new ItemStack[] {}, mFishOutput, null, new int[] {}, aFluidInputs, mOutputFluids, 200, 16, 0); - if (!this.canBufferOutputs(g, aMaxParallelRecipes)) { + aMaxParallelRecipes = this.canBufferOutputs(g, aMaxParallelRecipes); + if (aMaxParallelRecipes == 0) { log("No Space"); return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java index 8e3e40b3ab..af4132f5ff 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java @@ -12,6 +12,7 @@ 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_Dynamo; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; @@ -22,6 +23,7 @@ import gregtech.api.util.Recipe_GT; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.chemistry.RocketFuels; +import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.MISC_MATERIALS; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; @@ -52,6 +54,8 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi private final static int CASING_ID = TAE.getIndexFromPage(3, 11); + + public ArrayList<GT_MetaTileEntity_Hatch> mAllDynamoHatches = new ArrayList<GT_MetaTileEntity_Hatch>(); public GregtechMetaTileEntity_LargeRocketEngine(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); @@ -91,13 +95,13 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi "Supply Rocket Fuels and 1000L(3000L boosted) of "+mLubricantName+" per hour to run", "Supply 4L of "+mCoolantName+" per second per 2100 eu/t to boost output (optional)", "Consumes upto 37500L of Air per second", - "Produces between 4K and 32K eu/t depending on how much fuel is fed", - "When producing more then 16K eu/t fuel wil be consume less efficiently (3x - 1.5x eff)", + "Produces as much energy as you put fuel in becomes less ", + "When producing more then 30K eu/t fuel wil be consume less efficiently (3x - 1.5x eff@55Keu/t)", "Boosting will produce 3x the amount of power but will consume 3x fuel", "Size(WxHxD): 3x3x10, Controller (front centered)", "3x3x10 of Stable "+mCasingName+" (hollow, Min 64!)", "8x "+mGearboxName+" inside the Hollow Casing", - "1x Dynamo Hatch (Top Middle, Max 8)", + "1x Dynamo Hatch (Top Middle, Max 8) suports tectech dynamos", "8x Air Intake Hatch (one of the Casings next to a Gear Box, top row allowed)", "2x Input Hatch (Rocket Fuel/Booster) (one of the Casings next to a Gear Box, top row not allowed)", "1x Maintenance Hatch (one of the Casings next to a Gear Box)", @@ -149,21 +153,20 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi @Override public boolean checkRecipe(final ItemStack aStack) { - if (this.mEfficiency < 0) log(" geting air"); final ArrayList<FluidStack> tFluids = this.getStoredFluids(); FluidStack air = FluidUtils.getFluidStack("air", 1); log(" geting air 2"); int aircount = getAir() ; - if (aircount < euProduction/32) { + if (aircount < euProduction/100) { log(" not enough air"); //log("Not Enough Air to Run "+aircount); return false; } else { log(" no boost"); - boolean hasIntakeAir = this.depleteInput(FluidUtils.getFluidStack(air, euProduction/32)); + boolean hasIntakeAir = this.depleteInput(FluidUtils.getFluidStack(air, euProduction/100)); if (!hasIntakeAir) { //log("Could not consume Air to run "+aircount); freeFuelTicks = 0; @@ -221,7 +224,7 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi this.mEUt = (int) ((this.mEfficiency < 2000) ? 0 : GT_Values.V[5]<<1); this.mProgresstime = 1; this.mMaxProgresstime = 1; - this.mEfficiencyIncrease = euProduction/4000; + this.mEfficiencyIncrease = euProduction/2000; return true; //log(""); } @@ -229,7 +232,7 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi } else { - this.mEfficiencyIncrease = euProduction/4000; + this.mEfficiencyIncrease = euProduction/2000; freeFuelTicks--; this.mEUt = (int) ((this.mEfficiency < 1000) ? 0 : GT_Values.V[5]<<1); this.mProgresstime = 1; @@ -259,17 +262,9 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi log("amount: "+amount); log("Value: "+value); int energy = value * amount; - //engine needs at leas 2A EV of fuel to waork - if (energy < 40000){ - log("not enough fuel to work"); - return false; - } - //limits engine to LuV fuel consumption - if (energy > 427500){ - amount = (int) ((double) 427500/value); - energy = 427500; - } log("amount2: "+amount); + if (amount < 5) + return false; FluidStack tLiquid = FluidUtils.getFluidStack(aFuel.mFluidInputs[0], (this.boostEu ? amount * 3 : amount)); if (!this.depleteInput(tLiquid)) { log("could not deplete fluid"); @@ -286,8 +281,16 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi public void setEUProduction(int energy){ energy /= 20; - // 3x eff unles it gose above 16K eu/t - double energyEfficiency = energy > 5500 ? ((double) Math.sqrt(5500)/Math.sqrt(energy) * energy) : energy; + double energyEfficiency; + if (energy > 10000) { + energyEfficiency = ((double) Math.cbrt(10000)/Math.cbrt(energy)); + if (energy >= 40000) + energyEfficiency *= ((double) Math.cbrt(40000)/Math.cbrt(energy)); + energyEfficiency *= energy; + } + else { + energyEfficiency = energy; + } euProduction = (int) ((double) energyEfficiency * 1.84); if (this.boostEu) euProduction *= 3; @@ -313,6 +316,10 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi int tX = getBaseMetaTileEntity().getXCoord(); int tY = getBaseMetaTileEntity().getYCoord(); int tZ = getBaseMetaTileEntity().getZCoord(); + + this.mTecTechDynamoHatches.clear(); + this.mAllDynamoHatches.clear(); + final int MAX_LENGTH = 8; for (int length=0;length<MAX_LENGTH;length++) { if(getBaseMetaTileEntity().getBlockAtSideAndDistance(tSide, length+1) != getGearboxBlock()) { @@ -425,8 +432,14 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi this.updateTexture(tTileEntity, getCasingTextureIndex()); } } + + mAllDynamoHatches.addAll(this.mDynamoHatches); + + if (LoadedMods.TecTech) { + mAllDynamoHatches.addAll(this.mTecTechDynamoHatches); + } - if (this.mDynamoHatches.size() <= 0 || this.mDynamoHatches.isEmpty()) { + if (this.mAllDynamoHatches.size() <= 0 || this.mAllDynamoHatches.isEmpty()) { log("Wrong count for Dynamos"); return false; } @@ -446,7 +459,85 @@ public class GregtechMetaTileEntity_LargeRocketEngine extends GregtechMeta_Multi log("Formed Rocket Engine."); return true; - } + } + + @Override + public boolean addEnergyOutput(long aEU) { + if (aEU <= 0) { + return true; + } + if (mAllDynamoHatches.size() > 0) { + return addEnergyOutputMultipleDynamos(aEU, true); + } + return false; + } + + + public boolean addEnergyOutputMultipleDynamos(long aEU, boolean aAllowMixedVoltageDynamos) { + int injected = 0; + long totalOutput = 0; + long aFirstVoltageFound = -1; + boolean aFoundMixedDynamos = false; + for (GT_MetaTileEntity_Hatch aDynamo : mAllDynamoHatches) { + if( aDynamo == null ) { + return false; + } + if (isValidMetaTileEntity(aDynamo)) { + long aVoltage = aDynamo.maxEUOutput(); + long aTotal = aDynamo.maxAmperesOut() * aVoltage; + // Check against voltage to check when hatch mixing + if (aFirstVoltageFound == -1) { + aFirstVoltageFound = aVoltage; + } + else { + /** + * Calcualtes overclocked ness using long integers + * @param aEUt - recipe EUt + * @param aDuration - recipe Duration + * @param mAmperage - should be 1 ? + */ + //Long time calculation + if (aFirstVoltageFound != aVoltage) { + aFoundMixedDynamos = true; + } + } + totalOutput += aTotal; + } + } + + if (totalOutput < aEU || (aFoundMixedDynamos && !aAllowMixedVoltageDynamos)) { + explodeMultiblock(); + return false; + } + + long leftToInject; + //Long EUt calculation + long aVoltage; + //Isnt too low EUt check? + int aAmpsToInject; + int aRemainder; + + //xEUt *= 4;//this is effect of everclocking + for (GT_MetaTileEntity_Hatch aDynamo : mAllDynamoHatches) { + if (isValidMetaTileEntity(aDynamo)) { + leftToInject = aEU - injected; + aVoltage = aDynamo.maxEUOutput(); + aAmpsToInject = (int) (leftToInject / aVoltage); + aRemainder = (int) (leftToInject - (aAmpsToInject * aVoltage)); + long powerGain; + for (int i = 0; i < Math.min(aDynamo.maxAmperesOut(), aAmpsToInject + 1); i++) { + if (i == Math.min(aDynamo.maxAmperesOut(), aAmpsToInject)){ + powerGain = aRemainder; + }else{ + powerGain = aVoltage; + } + aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(powerGain, false); + injected += powerGain; + } + } + } + return injected > 0; + } public Block getCasingBlock() { return ModBlocks.blockCasings4Misc; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java index a05ecca551..a7afaa6b56 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java @@ -232,7 +232,7 @@ public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase { } public boolean checkForWater() { - + // Get Facing direction IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); int mDirectionX = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; @@ -340,7 +340,7 @@ public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase { if (aBaseMetaTileEntity.isClientSide()) { this.mLevel = getCasingTierOnClientSide(); } - + } @Override @@ -379,9 +379,15 @@ public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase { return false; } - if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes, false)) { + aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes); + if (aMaxParallelRecipes == 0) { return false; } + if (tRecipe.mInputs.length > 0) { + for (ItemStack aInputToConsume : tRecipe.mInputs) { + this.depleteInput(aInputToConsume); + } + } // -- Try not to fail after this point - inputs have already been consumed! -- @@ -475,7 +481,7 @@ public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase { } return false; } - + @SideOnly(Side.CLIENT) private final int getCasingTierOnClientSide() { if (this == null || this.getBaseMetaTileEntity().getWorld() == null) { @@ -497,7 +503,7 @@ public class GregtechMTE_AlgaePondBase extends GregtechMeta_MultiBlockBase { 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 87f8d81bb2..ebae66fe72 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 @@ -57,7 +57,10 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { private int mPipeCasingTier = 0; private int mCoilTier = 0; - + public static GT_Recipe_Map getGeneratedRecipeMap() { + return mFluidChemicalReactorRecipes; + } + /** * Internal Recipe Map which holds the actual recipes, backed by the real map, shown by NEI. */ @@ -832,7 +835,8 @@ public class GregtechMTE_ChemicalPlant extends GregtechMeta_MultiBlockBase { } - if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { + aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes); + if (aMaxParallelRecipes == 0) { log("BAD RETURN - 2"); return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java index 7300b3507b..9b898e34af 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/storage/GregtechMetaTileEntity_PowerSubStationController.java @@ -10,7 +10,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; @@ -47,6 +46,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe private final int ENERGY_TAX = 2; //TecTech Support + public ArrayList<GT_MetaTileEntity_Hatch> mAllEnergyHatches = new ArrayList<GT_MetaTileEntity_Hatch>(); public ArrayList<GT_MetaTileEntity_Hatch> mAllDynamoHatches = new ArrayList<GT_MetaTileEntity_Hatch>(); public GregtechMetaTileEntity_PowerSubStationController(final int aID, final String aName, final String aNameRegional) { @@ -138,12 +138,26 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe } else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 7) { return 8; } else if (aBlock == ModBlocks.blockCasings3Misc && aMeta == 8) { - return CORE.GTNH ? GT_Values.V.length : 9; + return 9; } else { return -1; } } + public static int getMaxHatchTier(int aCellTier) { + switch(aCellTier) { + case 9: + return CORE.GTNH ? 15 : 9; + default: + if (aCellTier < 4) { + return 0; + } + else { + return aCellTier; + } + } + } + public static final int CELL_HEIGHT_MAX = 16; public static final int CELL_HEIGHT_MIN = 2; @@ -153,8 +167,11 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 2; final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 2; - this.mMultiDynamoHatches.clear(); - this.mAllDynamoHatches.clear(); + this.mTecTechDynamoHatches.clear(); + this.mAllDynamoHatches.clear(); + + this.mTecTechEnergyHatches.clear(); + this.mAllEnergyHatches.clear(); boolean tFoundCeiling = false; int tCasingCount = 0; @@ -246,10 +263,12 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe /** * TecTech Support, this allows adding Multi-Amp dynamos. */ + mAllEnergyHatches.addAll(this.mEnergyHatches); mAllDynamoHatches.addAll(this.mDynamoHatches); if (LoadedMods.TecTech) { - mAllDynamoHatches.addAll(this.mMultiDynamoHatches); + mAllDynamoHatches.addAll(this.mTecTechEnergyHatches); + mAllDynamoHatches.addAll(this.mTecTechDynamoHatches); } @@ -257,7 +276,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe checkMachineProblem("Needed 1 maintenance hatch, found " + this.mMaintenanceHatches.size()); return false; } - if (this.mEnergyHatches.size() < 1) { + if (this.mAllEnergyHatches.size() < 1) { checkMachineProblem("Needed at least 1 energy hatch, found 0"); return false; } @@ -269,15 +288,17 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe // Find average EU throughput int totalEuThroughput = 0; int hatchCount = 0; + + int aMaxHatchTier = getMaxHatchTier(tOverallCellTier); - for (GT_MetaTileEntity_Hatch_Energy re : this.mEnergyHatches) { + for (GT_MetaTileEntity_Hatch re : this.mAllEnergyHatches) { long tier = re.getOutputTier(); - if(tier > tOverallCellTier) { - checkMachineProblem("Energy hatch (tier " + tier + ") is too strong for cells (tier " + tOverallCellTier + ")"); + if(tier > aMaxHatchTier) { + checkMachineProblem("Energy hatch (tier " + tier + ") is too strong for cells (tier " + aMaxHatchTier + ")"); return false; } if(tier < 3) { - checkMachineProblem("Energy hatch (tier " + tier + ") is too weak for cells (tier " + tOverallCellTier + ")"); + checkMachineProblem("Energy hatch (tier " + tier + ") is too weak for cells (tier " + aMaxHatchTier + ")"); return false; } totalEuThroughput += re.maxEUInput(); @@ -286,12 +307,12 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe for (GT_MetaTileEntity_Hatch re : this.mAllDynamoHatches) { long tier = re.getInputTier(); - if(tier > tOverallCellTier) { - checkMachineProblem("Dynamo hatch (tier " + tier + ") is too strong for cells (tier " + tOverallCellTier + ")"); + if(tier > aMaxHatchTier) { + checkMachineProblem("Dynamo hatch (tier " + tier + ") is too strong for cells (tier " + aMaxHatchTier + ")"); return false; } if(tier < 3) { - checkMachineProblem("Energy hatch (tier " + tier + ") is too weak for cells (tier " + tOverallCellTier + ")"); + checkMachineProblem("Energy hatch (tier " + tier + ") is too weak for cells (tier " + aMaxHatchTier + ")"); return false; } totalEuThroughput += re.maxEUOutput(); @@ -431,6 +452,12 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe return MathUtils.roundToClosestInt(mTax); } + + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + this.fixAllMaintenanceIssue(); + } + @Override public boolean onRunningTick(ItemStack aStack) { // First, decay overcharge (0.1% of stored energy plus 1000 EU per tick) @@ -448,7 +475,7 @@ public class GregtechMetaTileEntity_PowerSubStationController extends GregtechMe for (GT_MetaTileEntity_Hatch_OutputBattery tHatch : this.mDischargeHatches) { drawEnergyFromHatch(tHatch); } - for (GT_MetaTileEntity_Hatch_Energy tHatch : this.mEnergyHatches) { + for (GT_MetaTileEntity_Hatch tHatch : this.mAllEnergyHatches) { drawEnergyFromHatch(tHatch); } |