diff options
author | Mary <33456283+FourIsTheNumber@users.noreply.github.com> | 2024-09-10 18:18:48 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-11 00:18:48 +0200 |
commit | 272b61aeabe2efdc3d7f6495500c9dc6993a8b78 (patch) | |
tree | 7eb5b95383f42e805d4d3d741f8ec7bcfb530876 /src/main/java/gregtech/common/tileentities/machines/multi | |
parent | b567189e69f86c9836a022b6505ae282fd59ae09 (diff) | |
download | GT5-Unofficial-272b61aeabe2efdc3d7f6495500c9dc6993a8b78.tar.gz GT5-Unofficial-272b61aeabe2efdc3d7f6495500c9dc6993a8b78.tar.bz2 GT5-Unofficial-272b61aeabe2efdc3d7f6495500c9dc6993a8b78.zip |
A few bugfixes and changes for black hole (#3150)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Diffstat (limited to 'src/main/java/gregtech/common/tileentities/machines/multi')
-rw-r--r-- | src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java | 97 |
1 files changed, 47 insertions, 50 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java index 6db9969cae..d3df572107 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java @@ -18,7 +18,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; -import java.util.stream.Stream; import javax.annotation.Nonnull; @@ -35,7 +34,6 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; @@ -53,8 +51,8 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.logic.ProcessingLogic; import gregtech.api.metatileentity.implementations.MTEExtendedPowerMultiBlockBase; -import gregtech.api.metatileentity.implementations.MTEHatchEnergy; import gregtech.api.metatileentity.implementations.MTEHatchInput; +import gregtech.api.metatileentity.implementations.MTEHatchInputBus; import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.RecipeMaps; import gregtech.api.recipe.check.CheckRecipeResult; @@ -123,7 +121,7 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl buildHatchAdder(MTEBlackHoleCompressor.class) .atLeast(Energy.or(ExoticEnergy), InputBus, OutputBus, InputHatch) .casingIndex(((BlockCasings10) GregTechAPI.sBlockCasings10).getTextureIndex(12)) - .dot(2) + .dot(1) .buildAndChain( onElementPass(MTEBlackHoleCompressor::onCasingAdded, ofBlock(GregTechAPI.sBlockCasings10, 12)))) .addElement('C', ofBlock(GregTechAPI.sBlockCasings10, 11)) @@ -133,7 +131,7 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl buildHatchAdder(MTEBlackHoleCompressor.class).atLeast(InputHatch) .adder(MTEBlackHoleCompressor::addSpacetimeInput) .casingIndex(((BlockCasings10) GregTechAPI.sBlockCasings10).getTextureIndex(11)) - .dot(1) + .dot(2) .buildAndChain(ofBlock(GregTechAPI.sBlockCasings10, 11))) .build(); @@ -284,10 +282,12 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl protected MultiblockTooltipBuilder createTooltip() { MultiblockTooltipBuilder tt = new MultiblockTooltipBuilder(); tt.addMachineType("Compressor/Advanced Neutronium Compressor") - .addInfo("Controller Block for the Semi-Stable Black Hole Containment Field") + .addInfo("Controller Block for the Pseudostable Black Hole Containment Field") .addInfo(EnumChatFormatting.LIGHT_PURPLE + "Uses the immense power of the event horizon to compress things") - .addInfo("No longer requires heat management to perform superdense compression") - .addInfo("Can create advanced singularities!") + .addInfo( + EnumChatFormatting.LIGHT_PURPLE + + "No longer requires heat management to perform superdense compression") + .addInfo(EnumChatFormatting.LIGHT_PURPLE + "Can create advanced singularities!") .addSeparator() .addInfo( "Insert a " + EnumChatFormatting.WHITE @@ -313,7 +313,7 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl + "halted" + EnumChatFormatting.RESET + EnumChatFormatting.GRAY - + " by inserting 1 L/s of spacetime") + + " by inserting 1 L/s of spacetime into specific hatches") .addInfo( "Every " + EnumChatFormatting.RED + "30" @@ -336,7 +336,7 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl + EnumChatFormatting.GRAY + " if it becomes unstable") .addInfo("400% faster than singleblock machines of the same voltage") - .addInfo("Only uses 70% of the EU/t normally required - does not overclock above energy hatch tier") + .addInfo("Only uses 70% of the EU/t normally required") .addInfo("Gains 8 parallels per voltage tier") .addInfo( EnumChatFormatting.RED + "2x/4x" @@ -344,7 +344,10 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl + " parallels when stability is BELOW " + EnumChatFormatting.RED + "50/20") - .addInfo("Accepts one " + TT + " energy hatch") + .addInfo("Accepts " + TT + " energy hatches") + .addInfo( + EnumChatFormatting.RED + + "Recipe tier is limited to hatch tier + 1. Will not perform overclocks above the hatch tier.") .addInfo(AuthorFourIsTheNumber + EnumChatFormatting.RESET + " & " + Ollie) .addInfo("Rendering by: " + EnumChatFormatting.WHITE + "BucketBrigade") .addSeparator() @@ -389,15 +392,6 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl if (!checkPiece(STRUCTURE_PIECE_MAIN, 17, 27, 10)) return false; if (mCasingAmount < 950) return false; - if (!mExoticEnergyHatches.isEmpty()) { - if (mExoticEnergyHatches.size() > 1) return false; - energyHatchTier = mExoticEnergyHatches.get(0).mTier; - } else if (!mEnergyHatches.isEmpty()) { - byte tier = mEnergyHatches.get(0).mTier; - for (MTEHatchEnergy hatch : mEnergyHatches) if (hatch.mTier < tier) tier = hatch.mTier; - energyHatchTier = tier; - } - return true; } @@ -427,6 +421,7 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl super.getWailaNBTData(player, tile, tag, world, x, y, z); tag.setByte("blackHoleStatus", blackHoleStatus); tag.setFloat("blackHoleStability", blackHoleStability); + tag.setInteger("parallels", getMaxParallelRecipes()); } @Override @@ -434,6 +429,10 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl IWailaConfigHandler config) { super.getWailaBody(itemStack, currentTip, accessor, config); final NBTTagCompound tag = accessor.getNBTData(); + currentTip.add( + StatCollector.translateToLocal("GT5U.multiblock.parallelism") + ": " + + EnumChatFormatting.WHITE + + tag.getInteger("parallels")); if (tag.getByte("blackHoleStatus") != 1) { if (tag.getFloat("blackHoleStability") > 0) { currentTip.add(EnumChatFormatting.DARK_PURPLE + "Black Hole Active"); @@ -448,43 +447,14 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl } else currentTip.add(EnumChatFormatting.DARK_PURPLE + "Black Hole Offline"); } - byte energyHatchTier = 0; - @Override protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic() { @NotNull @Override - protected Stream<GTRecipe> findRecipeMatches(@Nullable RecipeMap<?> map) { - - // Loop through all items and look for the Activation and Deactivation Catalysts - // Deactivation resets stability to 100 and catalyzing cost to 1 - for (ItemStack inputItem : inputItems) { - if (inputItem.getItem() instanceof MetaGeneratedItem01) { - if (inputItem.getItemDamage() == 32418 && (blackHoleStatus == 1)) { - inputItem.stackSize -= 1; - blackHoleStatus = 2; - createRenderBlock(); - break; - } else if (inputItem.getItemDamage() == 32419 && !(blackHoleStatus == 1)) { - inputItem.stackSize -= 1; - blackHoleStatus = 1; - blackHoleStability = 100; - catalyzingCostModifier = 1; - rendererTileEntity = null; - destroyRenderBlock(); - break; - } - } - } - return super.findRecipeMatches(map); - } - - @NotNull - @Override protected OverclockCalculator createOverclockCalculator(@NotNull GTRecipe recipe) { - int ocs = energyHatchTier - GTUtility.getTier(recipe.mEUt); + int ocs = GTUtility.getTier(getAverageInputVoltage()) - GTUtility.getTier(recipe.mEUt); if (ocs < 0) ocs = 0; return new OverclockCalculator().setRecipeEUt(recipe.mEUt) .setAmperage(availableAmperage) @@ -495,12 +465,35 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl .setAmperageOC(amperageOC) .setDurationDecreasePerOC(overClockTimeReduction) .setEUtIncreasePerOC(overClockPowerIncrease) + .setParallel(getMaxParallelRecipes()) .limitOverclockCount(ocs); } @NotNull @Override protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { + // Loop through all items and look for the Activation and Deactivation Catalysts + // Deactivation resets stability to 100 and catalyzing cost to 1 + for (MTEHatchInputBus bus : mInputBusses) { + for (ItemStack inputItem : bus.mInventory) { + if (inputItem.getItem() instanceof MetaGeneratedItem01) { + if (inputItem.getItemDamage() == 32418 && (blackHoleStatus == 1)) { + inputItem.stackSize -= 1; + blackHoleStatus = 2; + createRenderBlock(); + break; + } else if (inputItem.getItemDamage() == 32419 && !(blackHoleStatus == 1)) { + inputItem.stackSize -= 1; + blackHoleStatus = 1; + blackHoleStability = 100; + catalyzingCostModifier = 1; + rendererTileEntity = null; + destroyRenderBlock(); + break; + } + } + } + } // Default speed bonus setSpeedBonus(0.2F); @@ -510,6 +503,10 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl if (recipe.getMetadataOrDefault(CompressionTierKey.INSTANCE, 0) == 0 && (blackHoleStatus == 3)) { setSpeedBonus(5F); } + + // Cap recipes to energy hatch + 1 + if (GTUtility.getTier(getAverageInputVoltage()) < GTUtility.getTier(recipe.mEUt) - 1) + return CheckRecipeResultRegistry.insufficientPower(recipe.mEUt); return super.validateRecipe(recipe); } |