From 502fc2d8887189f0003361d09c71985c054010ea Mon Sep 17 00:00:00 2001 From: botn365 <42187820+botn365@users.noreply.github.com> Date: Mon, 13 Jan 2020 20:06:41 +0100 Subject: $ 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. --- .../base/GregtechMeta_MultiBlockBase.java | 102 ++++++++++++--------- .../GregtechRocketFuelGeneratorBase.java | 7 +- 2 files changed, 64 insertions(+), 45 deletions(-) (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations') 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> aOutputHatches = new ConcurrentHashSet>(); + ArrayList> aOutputHatches = new ArrayList>(); 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 aOutputFluids = new ConcurrentHashSet(); + ArrayList aOutputFluids = new ArrayList(); // Ugly ass boxing aOutputFluids.addAll(new AutoMap(aRecipe.mFluidOutputs)); // Iterate the Hatches, updating their 'stored' data. - aHatchIterator: for (Triplet aHatchData : aOutputHatches) { + //for (Triplet aHatchData : aOutputHatches) { + for (int i = 0;i aNewHatchData = new Triplet(aHatch, aNewHatchStack, aNewHatchStack.amount); - aOutputHatches.add(aNewHatchData); - continue aHatchIterator; + //Triplet aNewHatchData = new Triplet(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 aNewHatchData = new Triplet(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 aNewHatchData = new Triplet(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()); } -- cgit