From 03f8ac57b99f8fa26975151ad39cb1a78667db73 Mon Sep 17 00:00:00 2001 From: Mary <33456283+FourIsTheNumber@users.noreply.github.com> Date: Thu, 29 Aug 2024 11:15:21 -0400 Subject: Compressor Multiblock (#2861) * Compressor boilerplate * Getting test structure working * Structure fixes * Implemented basic HIP and Black Hole structure elements complete with heat and black hole stabilization mechanics * Cooling glow, also HIP cools much slower than it heats * Got blue cooling texture working * spotless :3 * Force structure checks every 10 seconds like nano forge * Neutronium compressor recipemap created * Various strange changes attempting to get a neutronium compressor map working. Shelved for now * Absolutely going hog wild with neutronium testing * BIG RECIPE * Added Ollie author tag * Added a bunch of neutronium compressor recipes * Deeply cursed recipemap combining * Neutronium compressor structure * Black hole requirement for recipes established * Black hole implementation changed * Added black hole catalyzation * spotless * Removed neutronium compressor recipes from gt5u * Made eternal singularity work somehow * Boilerplate for new hatches * Tinkering * Split the multi in 4 * Fix refactor * Implemented the new black hole mechanic with catalysts. * Give speed bonuses/nerfs to recipes based on black hole. Shuffled some logic around * Imported real structures * Proper HIP implementation with heat sensor * Cut HIP mechanics from Neutronium * Restore Gangue for use in a black hole recipe * Made Gangue blocks load * sa+update deps * Added t1/t2 casings * Temporary casings for neutronium * SA from merge * Temporary HIP Textures * Temporary Black Hole textures * Support machinemode for black hole, support special value for compression * Don't let neutronium compressor do black hole recipes * Get all of the numbers in * Tooltip adjustments for readability * Casing fix and more tooltips * Correct structure tooltips * Improve legibility of HIP tooltip * 1 parallel per tier when overheated * Lost my privates * Fixed modern cast and imported the new textures * Removed very unnecessary logic * Nerf HIP parallels to 4 to make black hole better * Change all special value stuff to proper metadata --------- Co-authored-by: Martin Robertz --- src/main/java/gregtech/api/recipe/RecipeMaps.java | 21 ++++++++++++++ .../recipe/check/CheckRecipeResultRegistry.java | 10 +++++++ .../api/recipe/metadata/CompressionTierKey.java | 33 ++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 src/main/java/gregtech/api/recipe/metadata/CompressionTierKey.java (limited to 'src/main/java/gregtech/api/recipe') diff --git a/src/main/java/gregtech/api/recipe/RecipeMaps.java b/src/main/java/gregtech/api/recipe/RecipeMaps.java index 82dd60441a..293b4f36b5 100644 --- a/src/main/java/gregtech/api/recipe/RecipeMaps.java +++ b/src/main/java/gregtech/api/recipe/RecipeMaps.java @@ -1,8 +1,10 @@ package gregtech.api.recipe; +import static gregtech.api.enums.Mods.Avaritia; import static gregtech.api.enums.Mods.GTNHIntergalactic; import static gregtech.api.enums.Mods.NEICustomDiagrams; import static gregtech.api.enums.Mods.Railcraft; +import static gregtech.api.util.GT_ModHandler.getModItem; import static gregtech.api.util.GT_RecipeConstants.ADDITIVE_AMOUNT; import static gregtech.api.util.GT_RecipeConstants.FUEL_VALUE; import static gregtech.api.util.GT_RecipeMapUtil.GT_RecipeTemplate; @@ -63,6 +65,7 @@ import gregtech.api.recipe.maps.ReplicatorBackend; import gregtech.api.recipe.maps.SpaceProjectFrontend; import gregtech.api.recipe.maps.TranscendentPlasmaMixerFrontend; import gregtech.api.recipe.maps.UnpackagerBackend; +import gregtech.api.recipe.metadata.CompressionTierKey; import gregtech.api.recipe.metadata.PCBFactoryTierKey; import gregtech.api.recipe.metadata.PurificationPlantBaseChanceKey; import gregtech.api.util.GT_ModHandler; @@ -125,9 +128,27 @@ public final class RecipeMaps { (index, isFluid, isOutput, isSpecial) -> !isFluid && !isOutput ? GT_UITextures.OVERLAY_SLOT_COMPRESSOR_STEAM : null) .progressBarSteam(GT_UITextures.PROGRESSBAR_COMPRESS_STEAM) + .neiRecipeComparator( + Comparator + .comparing(recipe -> recipe.getMetadataOrDefault(CompressionTierKey.INSTANCE, 0)) + .thenComparing(GT_Recipe::compareTo)) // Avoid steam machine being used as handler icon .neiHandlerInfo(builder -> builder.setDisplayStack(ItemList.Machine_LV_Compressor.get(1))) .build(); + public static final RecipeMap neutroniumCompressorRecipes = RecipeMapBuilder + .of("gt.recipe.neutroniumcompressor") + .maxIO(1, 1, 1, 0) + .slotOverlays( + (index, isFluid, isOutput, isSpecial) -> !isFluid && !isOutput ? GT_UITextures.OVERLAY_SLOT_COMPRESSOR + : null) + .progressBar(GT_UITextures.PROGRESSBAR_COMPRESS) + .neiHandlerInfo(builder -> builder.setDisplayStack(getModItem(Avaritia.ID, "Singularity", 1L, 0))) + .disableOptimize() + .neiRecipeComparator( + Comparator + .comparing(recipe -> recipe.getMetadataOrDefault(CompressionTierKey.INSTANCE, 0)) + .thenComparing(GT_Recipe::compareTo)) + .build(); public static final RecipeMap extractorRecipes = RecipeMapBuilder.of("gt.recipe.extractor") .maxIO(1, 1, 0, 0) .minInputs(1, 0) diff --git a/src/main/java/gregtech/api/recipe/check/CheckRecipeResultRegistry.java b/src/main/java/gregtech/api/recipe/check/CheckRecipeResultRegistry.java index 5844a49180..dc7fc0d6a6 100644 --- a/src/main/java/gregtech/api/recipe/check/CheckRecipeResultRegistry.java +++ b/src/main/java/gregtech/api/recipe/check/CheckRecipeResultRegistry.java @@ -109,6 +109,16 @@ public final class CheckRecipeResultRegistry { public static final CheckRecipeResult BACKFILLER_NO_CONCRETE = SimpleCheckRecipeResult .ofFailure("backfiller_no_concrete"); + /** + * Black Hole Compressor does not have an active black hole + */ + public static final CheckRecipeResult NO_BLACK_HOLE = SimpleCheckRecipeResult.ofFailure("no_black_hole"); + /** + * Black Hole Compressor became unstable + */ + public static final CheckRecipeResult UNSTABLE_BLACK_HOLE = SimpleCheckRecipeResult + .ofFailure("unstable_black_hole"); + public static final CheckRecipeResult NO_SEE_SKY = SimpleCheckRecipeResult.ofFailure("no_see_sky"); /** diff --git a/src/main/java/gregtech/api/recipe/metadata/CompressionTierKey.java b/src/main/java/gregtech/api/recipe/metadata/CompressionTierKey.java new file mode 100644 index 0000000000..384b5ce2d9 --- /dev/null +++ b/src/main/java/gregtech/api/recipe/metadata/CompressionTierKey.java @@ -0,0 +1,33 @@ +package gregtech.api.recipe.metadata; + +import static gregtech.api.util.GT_Utility.trans; + +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; + +import gregtech.api.recipe.RecipeMetadataKey; +import gregtech.api.util.MethodsReturnNonnullByDefault; +import gregtech.nei.RecipeDisplayInfo; + +/** + * Tier of advanced compression required + */ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +public class CompressionTierKey extends RecipeMetadataKey { + + public static final CompressionTierKey INSTANCE = new CompressionTierKey(); + + private CompressionTierKey() { + super(Integer.class, "compression_tier"); + } + + @Override + public void drawInfo(RecipeDisplayInfo recipeInfo, @Nullable Object value) { + int tier = cast(value, 1); + switch (tier) { + case 1 -> recipeInfo.drawText(trans("509", "Requires HIP Unit")); + case 2 -> recipeInfo.drawText(trans("508", "Requires Stabilized Black Hole")); + } + } +} -- cgit