diff options
author | botn365 <42187820+botn365@users.noreply.github.com> | 2020-01-13 20:06:41 +0100 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2020-01-13 19:06:41 +0000 |
commit | 502fc2d8887189f0003361d09c71985c054010ea (patch) | |
tree | a82147155ecf327e64cac057c33c603df637fc59 /src/Java/gtPlusPlus | |
parent | bc630f3a7738e4a495cdc1672949d934f76838e3 (diff) | |
download | GT5-Unofficial-502fc2d8887189f0003361d09c71985c054010ea.tar.gz GT5-Unofficial-502fc2d8887189f0003361d09c71985c054010ea.tar.bz2 GT5-Unofficial-502fc2d8887189f0003361d09c71985c054010ea.zip |
$ Minor fixes to balance (#605)
+ Added TT Dynamo support to the LRE.
% Made Nitinol processing faster.
% Removed double efficiency bonus from single block Rocket Engines.
% Changed Efficiency drop-rate on LRE.
% Removed cap on LRE power production.
$ Changed pikyonium tier back to ZPM
$ Fixed Output buffering check on Multiblocks.
$ Fixed LRE disabled if too little fuel.
Diffstat (limited to 'src/Java/gtPlusPlus')
13 files changed, 205 insertions, 77 deletions
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index 8bfcfe2d70..114750d2d9 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -621,7 +621,7 @@ public final class ModItems { MaterialGenerator.generate(ALLOY.MARAGING350); MaterialGenerator.generate(ALLOY.AQUATIC_STEEL); - MaterialGenerator.generate(ALLOY.NITINOL_60); + MaterialGenerator.generate(ALLOY.NITINOL_60,true,false); //Composite Alloys MaterialGenerator.generate(ALLOY.STELLITE); diff --git a/src/Java/gtPlusPlus/core/material/ALLOY.java b/src/Java/gtPlusPlus/core/material/ALLOY.java index 95e3631aaf..4e28b4a428 100644 --- a/src/Java/gtPlusPlus/core/material/ALLOY.java +++ b/src/Java/gtPlusPlus/core/material/ALLOY.java @@ -775,7 +775,7 @@ public final class ALLOY { "Pikyonium 64B", //Material Name MaterialState.SOLID, //State new short[]{52, 103, 186, 0}, //Material Colour - 7850, //Melting Point in C + 6850, //Melting Point in C 11765, //Boiling Point in C -1, -1, diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index cd02a297a7..74c8ce4202 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -646,6 +646,18 @@ public class RECIPES_GREGTECH { new int[] {10000}, //Output Chance 20 * 120, 30720); + + //NITINOL_60 + CORE.RA.addBlastSmelterRecipe( + new ItemStack[] { + ELEMENT.getInstance().TITANIUM.getDust(3), + ELEMENT.getInstance().NICKEL.getDust(2) + }, + ALLOY.NITINOL_60.getFluid(20 * 144), + 0, + 20 * 75, + 7680); + 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 50c3c42600..e15a9d5c28 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 @@ -471,11 +471,11 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult public String getSound() { return ""; } - public boolean canBufferOutputs(final GT_Recipe aRecipe, int aParallelRecipes) { + public int canBufferOutputs(final GT_Recipe aRecipe, int aParallelRecipes) { return canBufferOutputs(aRecipe, aParallelRecipes, true); } - public boolean canBufferOutputs(final GT_Recipe aRecipe, int aParallelRecipes, boolean aAllow16SlotWithoutCheck) { + public int canBufferOutputs(final GT_Recipe aRecipe, int aParallelRecipes, boolean aAllow16SlotWithoutCheck) { Logger.INFO("Determining if we have space to buffer outputs. Parallel: "+aParallelRecipes); @@ -484,11 +484,11 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult // Do it anyway, provided the multi allows it. Default behaviour is aAllow16SlotWithoutCheck = true. if (aRecipe == null || aRecipe.mOutputs.length > 16) { if (aRecipe == null) { - return false; + return 0; } else if (aRecipe.mOutputs.length > 16) { if (aAllow16SlotWithoutCheck) { - return true; + return aParallelRecipes; } else { // Do nothing, we want to check this recipe properly. @@ -625,9 +625,14 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult // We have stacks that did not merge, do we have space for them? if (aInputMap.size() > 0) { if (aInputMap.size() > aInputBusSlotsFree) { + aParallelRecipes = (int) Math.floor((double) aInputBusSlotsFree/aInputMap.size() * aParallelRecipes); // We do not have enough free slots in total to accommodate the remaining managed stacks. - Logger.INFO("Failed to find enough space for all item outputs. Free: "+aInputBusSlotsFree+", Required: "+aInputMap.size()); - return false; + Logger.INFO(" Free: "+aInputBusSlotsFree+", Required: "+aInputMap.size()); + if(aParallelRecipes == 0) { + Logger.INFO("Failed to find enough space for all item outputs."); + return 0; + } + } } @@ -655,7 +660,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult int aEmptyFluidHatches = 0; int aFullFluidHatches = 0; // Create Map for Fluid Output - ConcurrentHashSet<Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>> aOutputHatches = new ConcurrentHashSet<Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>>(); + ArrayList<Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>> aOutputHatches = new ArrayList<Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>>(); for (final GT_MetaTileEntity_Hatch_Output tBus : this.mOutputHatches) { if (!isValidMetaTileEntity(tBus)) { continue; @@ -671,32 +676,36 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult } } // Create a map of all the fluids we would like to output, we can iterate over this and see how many we can merge into existing hatch stacks. - ConcurrentHashSet<FluidStack> aOutputFluids = new ConcurrentHashSet<FluidStack>(); + ArrayList<FluidStack> aOutputFluids = new ArrayList<FluidStack>(); // Ugly ass boxing aOutputFluids.addAll(new AutoMap<FluidStack>(aRecipe.mFluidOutputs)); // Iterate the Hatches, updating their 'stored' data. - aHatchIterator: for (Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aHatchData : aOutputHatches) { + //for (Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aHatchData : aOutputHatches) { + for (int i = 0;i<aOutputHatches.size();i++) { // The Hatch Itself - GT_MetaTileEntity_Hatch_Output aHatch = aHatchData.getValue_1(); + GT_MetaTileEntity_Hatch_Output aHatch = aOutputHatches.get(i).getValue_1(); // Fluid in the Hatch - FluidStack aHatchStack = aHatchData.getValue_2(); + FluidStack aHatchStack = aOutputHatches.get(i).getValue_2(); // Space left in Hatch - int aSpaceLeftInHatch = aHatch.getCapacity() - aHatch.getFluidAmount(); + int aSpaceLeftInHatch = aHatch.getCapacity() - aHatch.getFluidAmount(); // Hatch is full, if (aSpaceLeftInHatch <= 0) { aFullFluidHatches++; - aOutputHatches.remove(aHatchData); - continue aHatchIterator; - } + aOutputHatches.remove(aOutputHatches.get(i)); + i--; + continue; + } // Hatch has space - else { + else { // Check if any fluids match - aFluidMatch: for (FluidStack aOutputStack : aOutputFluids) { - if (GT_Utility.areFluidsEqual(aHatchStack, aOutputStack)) { - int aFluidToPutIntoHatch = aOutputStack.amount; + //aFluidMatch: for (FluidStack aOutputStack : aOutputFluids) { + for(int j = 0;j<aOutputFluids.size();j++) { + //log(" aHatchStack "+aHatchStack.getLocalizedName()+" aOutput stack "+aOutputStack.getLocalizedName()); + if (GT_Utility.areFluidsEqual(aHatchStack, aOutputFluids.get(j))) { + int aFluidToPutIntoHatch = aOutputFluids.get(j).amount * aParallelRecipes; // Not Enough space to insert all of the fluid. // We fill this hatch and add a smaller Fluidstack back to the iterator. - if (aSpaceLeftInHatch < aFluidToPutIntoHatch) { + if (aSpaceLeftInHatch < aFluidToPutIntoHatch) { // Copy existing Hatch Stack FluidStack aNewHatchStack = aHatchStack.copy(); aNewHatchStack.amount = 0; @@ -709,51 +718,57 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult aNewHatchStack.amount = aHatch.getCapacity(); aNewOutputStack.amount = aFluidLeftAfterInsert; // Remove fluid from output list, merge success - aOutputFluids.remove(aOutputStack); + aOutputFluids.remove(aOutputFluids.get(j)); + j--; // Remove hatch from hatch list, data is now invalid. - aOutputHatches.remove(aHatchData); + aOutputHatches.remove(aOutputHatches.get(i)); + i--; // Add remaining Fluid to Output list aOutputFluids.add(aNewOutputStack); // Re-add hatch to hatch list, with new data. - Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(aHatch, aNewHatchStack, aNewHatchStack.amount); - aOutputHatches.add(aNewHatchData); - continue aHatchIterator; + //Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(aHatch, aNewHatchStack, aNewHatchStack.amount); + //aOutputHatches.add(aNewHatchData); + break; } // We can fill this hatch perfectly (rare case), may as well add it directly to the full list. else if (aSpaceLeftInHatch == aFluidToPutIntoHatch) { // Copy Old Stack FluidStack aNewHatchStack = aHatchStack.copy(); // Add in amount from output stack - aNewHatchStack.amount += aOutputStack.amount; + aNewHatchStack.amount += aFluidToPutIntoHatch; // Remove fluid from output list, merge success - aOutputFluids.remove(aOutputStack); + aOutputFluids.remove(aOutputFluids.get(j)); + j--; // Remove hatch from hatch list, data is now invalid. - aOutputHatches.remove(aHatchData); + aOutputHatches.remove(aOutputHatches.get(i)); + i--; // Re-add hatch to hatch list, with new data. Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(aHatch, aNewHatchStack, aNewHatchStack.amount); aOutputHatches.add(aNewHatchData); - continue aHatchIterator; + break; } // We have more space than we need to merge, so we remove the stack from the output list and update the hatch list. - else { + else { // Copy Old Stack FluidStack aNewHatchStack = aHatchStack.copy(); // Add in amount from output stack - aNewHatchStack.amount += aOutputStack.amount; + aNewHatchStack.amount += aFluidToPutIntoHatch; // Remove fluid from output list, merge success - aOutputFluids.remove(aOutputStack); + aOutputFluids.remove(aOutputFluids.get(j)); + j--; // Remove hatch from hatch list, data is now invalid. - aOutputHatches.remove(aHatchData); + aOutputHatches.remove(aOutputHatches.get(i)); + i--; // Re-add hatch to hatch list, with new data. Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(aHatch, aNewHatchStack, aNewHatchStack.amount); aOutputHatches.add(aNewHatchData); // Check next fluid - continue aFluidMatch; + continue; } } else { - continue aFluidMatch; + continue; } } } @@ -767,11 +782,14 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult } // We have Fluid Stacks we did not merge. Do we have space? + Logger.INFO("fluids to output "+aOutputFluids.size()+" empty hatches "+aEmptyFluidHatches); if (aOutputFluids.size() > 0) { // Not enough space to add fluids. if (aOutputFluids.size() > aEmptyFluidHatches) { - Logger.INFO("Failed to find enough space for all fluid outputs."); - return false; + aParallelRecipes = (int) Math.floor((double) aEmptyFluidHatches/aOutputFluids.size() * aParallelRecipes); + Logger.INFO("Failed to find enough space for all fluid outputs. Free: "+aEmptyFluidHatches+", Required: "+aOutputFluids.size()); + return 0; + } } @@ -780,7 +798,7 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult */ } - return true; + return aParallelRecipes; } /** @@ -1070,8 +1088,9 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult } } } - - if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { + + aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes); + if (aMaxParallelRecipes == 0) { log("BAD RETURN - 2"); return false; } @@ -1378,7 +1397,8 @@ public abstract class GregtechMeta_MultiBlockBase extends GT_MetaTileEntity_Mult return false; } - 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/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java index e72838fcad..6e33529b66 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java @@ -63,12 +63,12 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_ String aPollution = "Causes between "+pollMin+" and "+pollMax+ " Pollution per second"; return new String[]{ this.mDescription, - "Fuel Efficiency: " + this.getEfficiency()*2 + "%", + "Fuel Efficiency: " + this.getEfficiency() + "%", aPollution}; } return new String[]{ this.mDescription, - "Fuel Efficiency: " + this.getEfficiency()*2 + "%"}; + "Fuel Efficiency: " + this.getEfficiency() + "%"}; } @@ -267,9 +267,8 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_ final int tFuelValue = this.getFuelValue(this.mFluid), tConsumed = this.consumedFluidPerOperation(this.mFluid); if ((tFuelValue > 0) && (tConsumed > 0) && (this.mFluid.amount >= tConsumed)) { final long tFluidAmountToUse = Math.min(this.mFluid.amount / tConsumed, (((this.maxEUOutput() * 20) + this.getMinimumStoredEU()) - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue); - if ((tFluidAmountToUse > 0) && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)){ + if ((tFluidAmountToUse > 0) && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)){ int aSafeFloor = (int) Math.max(((tFluidAmountToUse * tConsumed)/3), 1); - //Logger.INFO("True consumption: "+toConsumeTrue+" | Consuming this tick? "+useFuel); this.mFluid.amount -= (int) aSafeFloor; PollutionUtils.addPollution(getBaseMetaTileEntity(), 10 * getPollution()); } 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_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/advanced/GregtechMetaTileEntity_Adv_EBF.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java index ab7fb79c4b..cdfa078a1e 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 @@ -282,7 +282,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/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..10379d5817 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.mMultiDynamoHatches.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.mMultiDynamoHatches); + } - 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..4ec8804041 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 @@ -379,7 +379,8 @@ 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; } 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..1cb5b72161 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 @@ -832,7 +832,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; } |