Skip to content

Commit

Permalink
SoulRecipeCap Fixes (#13)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Ghostipedia authored May 12, 2024
1 parent 252414e commit 3f31c5f
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/generated/resources/assets/cosmiccore/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -14,7 +20,7 @@ public class SoulRecipeCapability extends RecipeCapability<Integer> {
public final static SoulRecipeCapability CAP = new SoulRecipeCapability();

protected SoulRecipeCapability() {
super("soul", 0x5E2129FF, true, 0, SerializerInteger.INSTANCE);
super("soul", 0x5E2129FF, true, 10, SerializerInteger.INSTANCE);
}

@Override
Expand Down Expand Up @@ -44,4 +50,13 @@ public List<Object> compressIngredients(Collection<Object> ingredients) {
public boolean isRecipeSearchFilter() {
return true;
}
@Override
public void addXEIInfo(WidgetGroup group, int xOffset, List<Content> 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)));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -25,11 +26,18 @@ public static void init (Consumer<FinishedRecipe> 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);
}

Expand Down

0 comments on commit 3f31c5f

Please sign in to comment.