diff options
author | Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> | 2023-02-09 07:16:38 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-09 08:16:38 +0100 |
commit | 53d893935094140835494e3b983cbef6d0adc731 (patch) | |
tree | 13b2c4c604b6aeeb0076cbff8c8368f76a7cd7b9 /src/main/java | |
parent | 41a21223aecf805673b9e1c16e9ab8d7e4ed418c (diff) | |
download | GT5-Unofficial-53d893935094140835494e3b983cbef6d0adc731.tar.gz GT5-Unofficial-53d893935094140835494e3b983cbef6d0adc731.tar.bz2 GT5-Unofficial-53d893935094140835494e3b983cbef6d0adc731.zip |
Forge Hammer Fluid Fix (#534)
* Bump dep
* Fix Alk code
* Remove weird comment
---------
Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com>
Diffstat (limited to 'src/main/java')
2 files changed, 10 insertions, 82 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 775a2a50a7..1a7a9738fd 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -494,62 +494,6 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_Ex null); } - /* - * public boolean checkRecipeGeneric( ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, - * int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) { // Based on the Processing - * Array. A bit overkill, but very flexible. if (this.doesMachineBoostOutput()) { log("Boosting."); return - * checkRecipeBoostedOutputs(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, - * aOutputChanceRoll, aRecipe); } //Control Core to control the Multiblocks behaviour. int aControlCoreTier = - * getControlCoreTier(); //If no core, return false; if (aControlCoreTier > 0) { log("Control core found."); } // - * Reset outputs and progress stats this.lEUt = 0; this.mMaxProgresstime = 0; this.mOutputItems = new ItemStack[]{}; - * this.mOutputFluids = new FluidStack[]{}; long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, - * GT_Utility.getTier(tVoltage)); log("Running checkRecipeGeneric(0)"); //Check to see if Voltage Tier > Control - * Core Tier if (tTier > aControlCoreTier) { log("Control core found is lower tier than power tier. OK"); tTier = - * (byte) aControlCoreTier; } tTier = (byte) MathUtils.getValueWithinRange(tTier, 0, 9); GT_Recipe tRecipe = aRecipe - * != null ? aRecipe : findRecipe( getBaseMetaTileEntity(), mLastRecipe, false, - * gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); log("Running checkRecipeGeneric(1)"); // - * Remember last recipe - an optimization for findRecipe() this.mLastRecipe = tRecipe; if (tRecipe == null) { - * log("BAD RETURN - 1"); return false; } if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { - * log("BAD RETURN - 2"); return false; } // EU discount float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f; - * float tTotalEUt = 0.0f; int parallelRecipes = 0; log("parallelRecipes: "+parallelRecipes); - * log("aMaxParallelRecipes: "+aMaxParallelRecipes); log("tTotalEUt: "+tTotalEUt); log("tVoltage: "+tVoltage); - * log("tRecipeEUt: "+tRecipeEUt); log("EU1: "+tRecipeEUt); // Count recipes to do in parallel, consuming input - * items and fluids and considering input voltage limits for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < - * (tVoltage - tRecipeEUt); parallelRecipes++) { if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) { - * log("Broke at "+parallelRecipes+"."); break; } - * log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+"."); tTotalEUt += tRecipeEUt; - * log("EU2: "+tTotalEUt); } if (parallelRecipes == 0) { log("BAD RETURN - 3"); return false; } - * log("EU3: "+tTotalEUt); // -- Try not to fail after this point - inputs have already been consumed! -- // Convert - * speed bonus to duration multiplier // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. - * aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent); float tTimeFactor = 100.0f / (100.0f + - * aSpeedBonusPercent); this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor * 10000); int aTempEu = (int) - * Math.floor(tTotalEUt); log("EU4: "+aTempEu); this.lEUt = (long) aTempEu; this.mEfficiency = (10000 - - * (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; // Overclock if (this.lEUt <= - * 16) { this.lEUt = (this.lEUt * (1 << tTier - 1) * (1 << tTier - 1)); this.mMaxProgresstime = - * (this.mMaxProgresstime / (1 << tTier - 1)); } else { while (this.lEUt <= gregtech.api.enums.GT_Values.V[(tTier - - * 1)]) { this.lEUt *= 4; this.mMaxProgresstime /= 2; } } if (this.lEUt > 0) { this.lEUt = (-this.lEUt); } - * this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); // Collect fluid outputs FluidStack[] tOutputFluids = - * new FluidStack[tRecipe.mFluidOutputs.length]; for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) { if - * (tRecipe.getFluidOutput(h) != null) { tOutputFluids[h] = tRecipe.getFluidOutput(h).copy(); - * tOutputFluids[h].amount *= parallelRecipes; } } // Collect output item types ItemStack[] tOutputItems = new - * ItemStack[tRecipe.mOutputs.length]; for (int h = 0; h < tRecipe.mOutputs.length; h++) { if (tRecipe.getOutput(h) - * != null) { tOutputItems[h] = tRecipe.getOutput(h).copy(); tOutputItems[h].stackSize = 0; } } // Set output item - * stack sizes (taking output chance into account) for (int f = 0; f < tOutputItems.length; f++) { if - * (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) { for (int g = 0; g < parallelRecipes; g++) { if - * (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f)) - * tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize; } } } tOutputItems = removeNulls(tOutputItems); // - * Sanitize item stack size, splitting any stacks greater than max stack size List<ItemStack> splitStacks = new - * ArrayList<ItemStack>(); for (ItemStack tItem : tOutputItems) { while (tItem.getMaxStackSize() < tItem.stackSize) - * { ItemStack tmp = tItem.copy(); tmp.stackSize = tmp.getMaxStackSize(); tItem.stackSize = tItem.stackSize - - * tItem.getMaxStackSize(); splitStacks.add(tmp); } } if (splitStacks.size() > 0) { ItemStack[] tmp = new - * ItemStack[splitStacks.size()]; tmp = splitStacks.toArray(tmp); tOutputItems = ArrayUtils.addAll(tOutputItems, - * tmp); } // Strip empty stacks List<ItemStack> tSList = new ArrayList<ItemStack>(); for (ItemStack tS : - * tOutputItems) { if (tS.stackSize > 0) tSList.add(tS); } tOutputItems = tSList.toArray(new - * ItemStack[tSList.size()]); // Commit outputs this.mOutputItems = tOutputItems; this.mOutputFluids = - * tOutputFluids; updateSlots(); // Play sounds (GT++ addition - GT multiblocks play no sounds) startProcess(); - * log("GOOD RETURN - 1"); return true; } - */ - public long getMaxInputEnergy() { long rEnergy = 0; if (mEnergyHatches.size() == 1) // so it only takes 1 amp is only 1 hatch is present so it works like most gt diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java index 1859e3ac9e..f2e9f43fe0 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialForgeHammer.java @@ -7,14 +7,12 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose import static gregtech.api.enums.GT_HatchElement.*; import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; -import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; @@ -27,7 +25,6 @@ import gregtech.api.enums.TAE; import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; @@ -37,6 +34,7 @@ import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +@SuppressWarnings("SpellCheckingInspection") public class GregtechMetaTileEntity_IndustrialForgeHammer extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_IndustrialForgeHammer> implements ISurvivalConstructable { @@ -90,7 +88,7 @@ public class GregtechMetaTileEntity_IndustrialForgeHammer extends @Override public IStructureDefinition<GregtechMetaTileEntity_IndustrialForgeHammer> getStructureDefinition() { if (STRUCTURE_DEFINITION == null) { - Map<Block, Integer> aBlockMap = new HashMap<Block, Integer>(); + Map<Block, Integer> aBlockMap = new HashMap<>(); aBlockMap.put(sAnvil, 0); if (LoadedMods.Railcraft) { aBlockMap.put(sSteelAnvil, 0); @@ -169,25 +167,13 @@ public class GregtechMetaTileEntity_IndustrialForgeHammer extends if (aAnvil != null) { int aAnvilTier = getAnvilTier(aAnvil); if (aAnvilTier > 0) { - 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)); - } - } - if (checkRecipeGeneric( - tBusItems.toArray(new ItemStack[] {}), - new FluidStack[] {}, - getMaxParallelRecipes() * aAnvilTier, - 100, - 100, - 10000)) { - return true; - } - } + return checkRecipeGeneric( + getCompactedInputs(), + getCompactedFluids(), + getMaxParallelRecipes() * aAnvilTier, + 100, + 100, + 10000); } } return false; @@ -266,9 +252,7 @@ public class GregtechMetaTileEntity_IndustrialForgeHammer extends } } if (LoadedMods.ThaumicBases) { - if (sThaumiumAnvil == aBlock || sVoidAnvil == aBlock) { - return true; - } + return sThaumiumAnvil == aBlock || sVoidAnvil == aBlock; } return false; } |