diff options
author | Mary <33456283+FourIsTheNumber@users.noreply.github.com> | 2024-09-17 11:54:42 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-17 15:54:42 +0000 |
commit | 89b686513756e38b20105749dd2aff1de7bd1372 (patch) | |
tree | f0c3299b09951b49b022c0e70ca1c90993fcdb97 | |
parent | c7e451f83e3ae5ebadc5d223eb1180bf4b218e7f (diff) | |
download | GT5-Unofficial-89b686513756e38b20105749dd2aff1de7bd1372.tar.gz GT5-Unofficial-89b686513756e38b20105749dd2aff1de7bd1372.tar.bz2 GT5-Unofficial-89b686513756e38b20105749dd2aff1de7bd1372.zip |
Fix stocking bus on black hole (#3217)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
-rw-r--r-- | src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java | 63 |
1 files changed, 39 insertions, 24 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 39538bfc7f..ba1c38db40 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 @@ -434,6 +434,44 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl return 0; } + private void searchAndDecrementCatalysts() { + // Loop through all items and look for the Activation and Deactivation Catalysts + // Deactivation resets stability to 100 and catalyzing cost to 1 + + // Has to do this "start/endRecipeProcessing" nonsense, or it doesn't work with stocking bus. + for (MTEHatchInputBus bus : mInputBusses) { + ItemStack[] inv = bus.getRealInventory(); + if (inv != null) { + for (int i = 0; i < inv.length; i++) { + ItemStack inputItem = inv[i]; + if (inputItem != null) { + if (inputItem.getItem() instanceof MetaGeneratedItem01) { + if (inputItem.getItemDamage() == 32418 && (blackHoleStatus == 1)) { + startRecipeProcessing(); + bus.decrStackSize(i, 1); + endRecipeProcessing(); + blackHoleStatus = 2; + createRenderBlock(); + return; + } else if (inputItem.getItemDamage() == 32419 && !(blackHoleStatus == 1)) { + startRecipeProcessing(); + bus.decrStackSize(i, 1); + endRecipeProcessing(); + inputItem.stackSize -= 1; + blackHoleStatus = 1; + blackHoleStability = 100; + catalyzingCostModifier = 1; + rendererTileEntity = null; + destroyRenderBlock(); + return; + } + } + } + } + } + } + } + @Override protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic() { @@ -441,30 +479,7 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl @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 (MTEHatchInputBus bus : mInputBusses) { - for (ItemStack inputItem : bus.mInventory) { - if (inputItem != null) { - 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; - } - } - } - } - } + searchAndDecrementCatalysts(); RecipeMap<?> realMap = (getModeFromCircuit(inputItems) == MACHINEMODE_COMPRESSOR) ? RecipeMaps.compressorRecipes |