From 3f31c5fa1fcab44da42ba91820b9ff01d4f0798f Mon Sep 17 00:00:00 2001 From: Ghostipedia <46772882+Ghostipedia@users.noreply.github.com> Date: Sun, 12 May 2024 05:55:32 -0400 Subject: [PATCH] SoulRecipeCap Fixes (#13) * Fix SoulRecipeCapability having the same key as ItemRecipeCapability * Added Proper Lang for Input/Output and offset the Info above duration until I can figure out how to dynamically stretch the Recipeviewer window --- .../resources/assets/cosmiccore/lang/en_us.json | 3 ++- .../capability/recipe/SoulRecipeCapability.java | 17 ++++++++++++++++- .../cosmiccore/common/data/CosmicMachines.java | 1 + .../gtbridge/CosmicCoreRecipeTypes.java | 9 ++++----- .../cosmiccore/gtbridge/CosmicCoreRecipes.java | 10 +++++++++- 5 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/generated/resources/assets/cosmiccore/lang/en_us.json b/src/generated/resources/assets/cosmiccore/lang/en_us.json index 61c9b8d..cc5b61d 100644 --- a/src/generated/resources/assets/cosmiccore/lang/en_us.json +++ b/src/generated/resources/assets/cosmiccore/lang/en_us.json @@ -55,7 +55,8 @@ "item.cosmiccore.waxed_leather": "Waxed Leather", "material.cosmiccore.prisma": "Prisma", "material.cosmiccore.prismatic_tungstensteel": "Prismatic Tungstensteel", - "cosmiccore.recipe.soul": "Soul", + "cosmiccore.recipe.soulIn": "Soul Input: %s", + "cosmiccore.recipe.soulOut": "Soul Output: %s", "gui.cosmiccore.soul_hatch.label.import": "Soul Input Hatch", "gui.cosmiccore.soul_hatch.label.export": "Soul Output Hatch", "gui.cosmiccore.soul_hatch.owner": "Owner: %s", diff --git a/src/main/java/com/ghostipedia/cosmiccore/api/capability/recipe/SoulRecipeCapability.java b/src/main/java/com/ghostipedia/cosmiccore/api/capability/recipe/SoulRecipeCapability.java index 2cde049..09580bb 100644 --- a/src/main/java/com/ghostipedia/cosmiccore/api/capability/recipe/SoulRecipeCapability.java +++ b/src/main/java/com/ghostipedia/cosmiccore/api/capability/recipe/SoulRecipeCapability.java @@ -1,11 +1,17 @@ package com.ghostipedia.cosmiccore.api.capability.recipe; import com.ghostipedia.cosmiccore.api.recipe.lookup.MapSoulIngredient; +import com.gregtechceu.gtceu.api.capability.recipe.CWURecipeCapability; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; +import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import com.gregtechceu.gtceu.api.recipe.content.SerializerInteger; import com.gregtechceu.gtceu.api.recipe.lookup.AbstractMapIngredient; +import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; +import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; +import com.lowdragmc.lowdraglib.utils.LocalizationUtils; import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import org.apache.commons.lang3.mutable.MutableInt; import java.util.Collection; import java.util.List; @@ -14,7 +20,7 @@ public class SoulRecipeCapability extends RecipeCapability { public final static SoulRecipeCapability CAP = new SoulRecipeCapability(); protected SoulRecipeCapability() { - super("soul", 0x5E2129FF, true, 0, SerializerInteger.INSTANCE); + super("soul", 0x5E2129FF, true, 10, SerializerInteger.INSTANCE); } @Override @@ -44,4 +50,13 @@ public List compressIngredients(Collection ingredients) { public boolean isRecipeSearchFilter() { return true; } + @Override + public void addXEIInfo(WidgetGroup group, int xOffset, List contents, boolean perTick, boolean isInput, MutableInt yOffset) { + int soul = contents.stream().map(Content::getContent).mapToInt(SoulRecipeCapability.CAP::of).sum(); + if (isInput) { + group.addWidget(new LabelWidget(3 - xOffset, yOffset.addAndGet(-30), LocalizationUtils.format("cosmiccore.recipe.soulIn", soul))); + } else { + group.addWidget(new LabelWidget(3 - xOffset, yOffset.addAndGet(-30), LocalizationUtils.format("cosmiccore.recipe.soulOut", soul))); + } + } } diff --git a/src/main/java/com/ghostipedia/cosmiccore/common/data/CosmicMachines.java b/src/main/java/com/ghostipedia/cosmiccore/common/data/CosmicMachines.java index c2fb800..4a5fa5c 100644 --- a/src/main/java/com/ghostipedia/cosmiccore/common/data/CosmicMachines.java +++ b/src/main/java/com/ghostipedia/cosmiccore/common/data/CosmicMachines.java @@ -120,6 +120,7 @@ public static GTRecipe copyOutputs(GTRecipe recipe, ContentModifier modifier) { .or(abilities(PartAbility.EXPORT_ITEMS)) .or(abilities(PartAbility.INPUT_ENERGY)) .or(abilities(PartAbility.MAINTENANCE)) + .or(abilities(CosmicPartAbility.IMPORT_SOUL)) ).build()) .workableCasingRenderer(GTCEu.id("block/casings/solid/machine_casing_stable_titanium"), GTCEu.id("block/multiblock/coke_oven")) .register(); diff --git a/src/main/java/com/ghostipedia/cosmiccore/gtbridge/CosmicCoreRecipeTypes.java b/src/main/java/com/ghostipedia/cosmiccore/gtbridge/CosmicCoreRecipeTypes.java index 2e589bd..edd8af8 100644 --- a/src/main/java/com/ghostipedia/cosmiccore/gtbridge/CosmicCoreRecipeTypes.java +++ b/src/main/java/com/ghostipedia/cosmiccore/gtbridge/CosmicCoreRecipeTypes.java @@ -16,17 +16,16 @@ public class CosmicCoreRecipeTypes { public static final GTRecipeType SOUL_TESTER_RECIPES = GTRecipeTypes.register("soul_tester", GTRecipeTypes.MULTIBLOCK) - .addDataInfo(data -> LocalizationUtils.format("cosmic.recipe.soul", data.getInt("soul"))) .setMaxSize(IO.IN, SoulRecipeCapability.CAP, 1) .setMaxSize(IO.OUT, SoulRecipeCapability.CAP, 1) .setMaxIOSize(1,1,0,0) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, ProgressTexture.FillDirection.LEFT_TO_RIGHT) - .setMaxTooltips(1); + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, ProgressTexture.FillDirection.LEFT_TO_RIGHT); public static final GTRecipeType GROVE_RECIPES = GTRecipeTypes.register("drygmy_grove", GTRecipeTypes.MULTIBLOCK) + .setMaxSize(IO.IN, SoulRecipeCapability.CAP, 1) + .setMaxSize(IO.OUT, SoulRecipeCapability.CAP, 1) .setMaxIOSize(2,9,1,3) - .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, ProgressTexture.FillDirection.LEFT_TO_RIGHT) - .setMaxTooltips(1); + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, ProgressTexture.FillDirection.LEFT_TO_RIGHT); public static void init() { diff --git a/src/main/java/com/ghostipedia/cosmiccore/gtbridge/CosmicCoreRecipes.java b/src/main/java/com/ghostipedia/cosmiccore/gtbridge/CosmicCoreRecipes.java index 6717a86..7712c56 100644 --- a/src/main/java/com/ghostipedia/cosmiccore/gtbridge/CosmicCoreRecipes.java +++ b/src/main/java/com/ghostipedia/cosmiccore/gtbridge/CosmicCoreRecipes.java @@ -1,5 +1,6 @@ package com.ghostipedia.cosmiccore.gtbridge; +import com.ghostipedia.cosmiccore.api.capability.recipe.SoulRecipeCapability; import com.ghostipedia.cosmiccore.common.data.CosmicItems; import com.gregtechceu.gtceu.api.GTValues; import net.minecraft.data.recipes.FinishedRecipe; @@ -25,11 +26,18 @@ public static void init (Consumer provider) { // .duration(10) // .save(provider); GROVE_RECIPES.recipeBuilder("dirt_movement") + .input(SoulRecipeCapability.CAP, 100) .notConsumable(CosmicItems.DONK) .notConsumable(Items.ZOMBIE_HEAD) .outputItems(Items.ROTTEN_FLESH, 1) .duration(20) - .inputEU(GTValues.HV) + .EUt(GTValues.VA[GTValues.HV]) + .save(provider); + GROVE_RECIPES.recipeBuilder("killing_mobs") + .output(SoulRecipeCapability.CAP, 1000) + .notConsumable(Items.ZOMBIE_HEAD) + .duration(20) + .EUt(GTValues.VA[GTValues.HV]) .save(provider); }