Skip to content

Commit b39d530

Browse files
authored
The AwakenedFusion category is hidden (#352)
1 parent 86f9397 commit b39d530

10 files changed

Lines changed: 300 additions & 204 deletions

File tree

File renamed without changes.
File renamed without changes.

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 2.6.4
2+
- Re: Improve the VOM UI [#351](https://github.com/GTModpackTeam/GTExpert-Core/pull/351)
3+
- The AwakenedFusion category is hidden [#352](https://github.com/GTModpackTeam/GTExpert-Core/pull/352)
4+
5+
* * *
6+
17
# 2.6.3
28
- Re: Fix Disable Helmet AutoEat Mixin [#349](https://github.com/GTModpackTeam/GTExpert-Core/pull/349)
39
- Improved VFP overclock efficiency with quadratic scaling [#350](https://github.com/GTModpackTeam/GTExpert-Core/pull/350)

src/main/java/com/github/gtexpert/core/api/capability/MultiblockRecipeLogicNoCache.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
import gregtech.api.capability.impl.MultiblockRecipeLogic;
44
import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController;
55

6-
import com.github.gtexpert.core.integration.deda.recipemaps.RecipeMapDraconicFusion;
7-
86
/**
97
* This recipe logic disables cache used for speeding up recipe check.
10-
* The reason is we do some special things inside {@link RecipeMapDraconicFusion},
11-
* and reusing recipe causes item with incorrect NBT to be outputted.
8+
* The reason is that Draconic Fusion recipes (TierUp and Upgrade) do special
9+
* output processing based on input NBT, and reusing recipe causes items with
10+
* incorrect NBT to be outputted.
1211
* Considering draconic fusion multi will not be spammed nor OCed to 1 tick, impact to TPS should be negligible.
1312
*/
1413
public class MultiblockRecipeLogicNoCache extends MultiblockRecipeLogic {

src/main/java/com/github/gtexpert/core/integration/deda/provider/DEDAJEIProvider.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,27 @@ public class DEDAJEIProvider implements IModPlugin {
1919
@Override
2020
public void register(@NotNull IModRegistry registry) {
2121
if (GTEValues.isModLoadedDEDA()) {
22-
String fusionCategory = GTValues.MODID + ":" +
22+
// Fusion categories
23+
String draconiumFusionCategory = GTValues.MODID + ":" +
2324
GTEDraconicRecipeMaps.DRACONIUM_FUSION_RECIPES.unlocalizedName;
25+
String awakenedFusionCategory = GTValues.MODID + ":" +
26+
GTEDraconicRecipeMaps.AWAKENED_DRACONIUM_FUSION_RECIPES.unlocalizedName;
27+
28+
// Shared categories
2429
String tierUpCategory = GTValues.MODID + ":" +
2530
GTEDraconicRecipeMaps.DRACONIC_FUSION_TIER_UP_RECIPES.unlocalizedName;
2631
String upgradeCategory = GTValues.MODID + ":" +
2732
GTEDraconicRecipeMaps.DRACONIC_FUSION_UPGRADE_RECIPES.unlocalizedName;
2833

29-
registry.addRecipeCatalyst(DEDAMetaTileEntities.AWAKENED_DRACONIUM_FUSION.getStackForm(), fusionCategory);
34+
// Register Fusion categories
35+
registry.addRecipeCatalyst(DEDAMetaTileEntities.AWAKENED_DRACONIUM_FUSION.getStackForm(),
36+
draconiumFusionCategory);
37+
38+
// Register TierUp category
3039
registry.addRecipeCatalyst(DEDAMetaTileEntities.DRACONIUM_FUSION.getStackForm(), tierUpCategory);
3140
registry.addRecipeCatalyst(DEDAMetaTileEntities.AWAKENED_DRACONIUM_FUSION.getStackForm(), tierUpCategory);
41+
42+
// Register Upgrade category
3243
registry.addRecipeCatalyst(DEDAMetaTileEntities.DRACONIUM_FUSION.getStackForm(), upgradeCategory);
3344
registry.addRecipeCatalyst(DEDAMetaTileEntities.AWAKENED_DRACONIUM_FUSION.getStackForm(), upgradeCategory);
3445
}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
package com.github.gtexpert.core.integration.deda.recipemaps;
2+
3+
import java.util.List;
4+
5+
import net.minecraft.item.ItemStack;
6+
import net.minecraft.nbt.NBTTagCompound;
7+
import net.minecraftforge.common.util.Constants;
8+
9+
import org.jetbrains.annotations.NotNull;
10+
import org.jetbrains.annotations.Nullable;
11+
12+
import com.brandon3055.brandonscore.utils.ItemNBTHelper;
13+
import com.brandon3055.draconicevolution.api.fusioncrafting.IFusionRecipe;
14+
import com.brandon3055.draconicevolution.api.fusioncrafting.SimpleFusionRecipe;
15+
import com.brandon3055.draconicevolution.api.itemupgrade.FusionUpgradeRecipe;
16+
import com.brandon3055.draconicevolution.api.itemupgrade.IUpgradableItem;
17+
import com.brandon3055.draconicevolution.api.itemupgrade.UpgradeHelper;
18+
import com.brandon3055.draconicevolution.items.ToolUpgrade;
19+
20+
import gregtech.api.capability.FeCompat;
21+
import gregtech.api.capability.GregtechCapabilities;
22+
import gregtech.api.capability.IElectricItem;
23+
import gregtech.api.recipes.Recipe;
24+
25+
import com.github.gtexpert.core.api.util.GTELog;
26+
27+
import cofh.redstoneflux.api.IEnergyContainerItem;
28+
29+
/**
30+
* Utility methods shared between TierUp and Upgrade recipe maps.
31+
*/
32+
public final class DraconicRecipeUtils {
33+
34+
private DraconicRecipeUtils() {}
35+
36+
/**
37+
* Applies default upgrade tags to upgradable items.
38+
* This ensures consistent NBT state for recipe matching.
39+
*/
40+
public static void applyDefaultUpgradeTag(List<ItemStack> inputs) {
41+
for (ItemStack input : inputs) {
42+
if (!(input.getItem() instanceof IUpgradableItem item)) continue;
43+
for (String upgradeName : ToolUpgrade.NAME_TO_ID.keySet()) {
44+
if (!item.getValidUpgrades(input).contains(upgradeName)) continue;
45+
NBTTagCompound upgradeTag = input.getOrCreateSubCompound(UpgradeHelper.UPGRADE_TAG);
46+
if (upgradeTag.hasKey(upgradeName, Constants.NBT.TAG_BYTE)) continue;
47+
upgradeTag.setByte(upgradeName, (byte) 0);
48+
}
49+
}
50+
}
51+
52+
/**
53+
* Sets up the output item for a TierUp or Upgrade recipe.
54+
* Handles NBT copying and energy conversion.
55+
*/
56+
@Nullable
57+
public static Recipe setupOutput(Recipe gtRecipe, List<ItemStack> inputs, IFusionRecipe fusionRecipe) {
58+
if (fusionRecipe == null) {
59+
GTELog.logger.warn("Recipe found, but property not found");
60+
GTELog.logger.warn("Recipe: " + gtRecipe);
61+
return null;
62+
}
63+
ItemStack catalyst = findCatalyst(inputs, fusionRecipe);
64+
if (catalyst.isEmpty()) {
65+
GTELog.logger.warn("Recipe found, but actual catalyst not found in the GT recipe");
66+
GTELog.logger.warn("Recipe: " + gtRecipe);
67+
GTELog.logger.warn("Expected catalyst: " + fusionRecipe.getRecipeCatalyst());
68+
return null;
69+
}
70+
71+
ItemStack outputStack = fusionRecipe.getRecipeOutput(catalyst);
72+
73+
// convert GTEU to FE
74+
IElectricItem inputElectricItem = catalyst.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null);
75+
if (inputElectricItem != null) {
76+
long euCharge = inputElectricItem.getCharge();
77+
int feCharge = (int) Math.min(euCharge * FeCompat.ratio(false), Integer.MAX_VALUE);
78+
if (outputStack.getItem() instanceof IEnergyContainerItem outputEnergyItem) {
79+
ItemNBTHelper.setInteger(outputStack, "Energy",
80+
Math.min(feCharge, outputEnergyItem.getMaxEnergyStored(outputStack)));
81+
}
82+
}
83+
84+
Recipe retRecipe = gtRecipe.copy();
85+
retRecipe.getOutputs().clear(); // This assumes there's only 1 output
86+
retRecipe.getOutputs().add(outputStack);
87+
return retRecipe;
88+
}
89+
90+
@NotNull
91+
public static ItemStack findCatalyst(List<ItemStack> inputs, IFusionRecipe fusionRecipe) {
92+
ItemStack expectedCatalyst = getCatalyst(fusionRecipe);
93+
if (expectedCatalyst == null || expectedCatalyst.isEmpty()) {
94+
return ItemStack.EMPTY;
95+
}
96+
for (ItemStack input : inputs) {
97+
if (expectedCatalyst.getItem() == input.getItem() &&
98+
expectedCatalyst.getItemDamage() == input.getItemDamage() && fusionRecipe.isRecipeCatalyst(input)) {
99+
return input;
100+
}
101+
}
102+
return ItemStack.EMPTY;
103+
}
104+
105+
@Nullable
106+
public static ItemStack getCatalyst(IFusionRecipe fusionRecipe) {
107+
if (fusionRecipe instanceof SimpleFusionRecipe) {
108+
return fusionRecipe.getRecipeCatalyst();
109+
} else if (fusionRecipe instanceof FusionUpgradeRecipe) {
110+
List<Object> ingredients = ((FusionUpgradeRecipe) fusionRecipe).getRecipeIngredients();
111+
if (ingredients.isEmpty() || !(ingredients.get(0) instanceof ItemStack)) {
112+
GTELog.logger.warn("Unknown ingredient: " + (ingredients.isEmpty() ? "empty" : ingredients.get(0)));
113+
GTELog.logger.warn("Recipe: " + fusionRecipe);
114+
return null;
115+
}
116+
return (ItemStack) ingredients.get(0);
117+
} else {
118+
throw new RuntimeException("Unknown type of IFusionRecipe: " + fusionRecipe.getClass().getName());
119+
}
120+
}
121+
}

src/main/java/com/github/gtexpert/core/integration/deda/recipemaps/GTEDraconicRecipeMaps.java

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import gregtech.api.gui.widgets.ProgressWidget;
55
import gregtech.api.recipes.RecipeMap;
66
import gregtech.api.recipes.builders.SimpleRecipeBuilder;
7-
import gregtech.api.recipes.ingredients.GTRecipeInput;
87
import gregtech.core.sound.GTSoundEvents;
98

109
import com.github.gtexpert.core.integration.deda.recipemaps.tierup.TierUpRecipeBuilder;
@@ -18,47 +17,34 @@
1817
@ZenRegister
1918
public class GTEDraconicRecipeMaps {
2019

21-
/**
22-
* Unified recipe map to show all tier-up recipes for draconic fusion on JEI.
23-
* Consolidates recipes from both Draconic and Awakened fusion machines.
24-
* Actual recipe execution is handled by {@link RecipeMapDraconicFusion}.
25-
*/
2620
@ZenProperty
27-
public static final RecipeMap<TierUpRecipeBuilder> DRACONIC_FUSION_TIER_UP_RECIPES = new RecipeMapDraconicUpgrade<>(
28-
"draconic_fusion_tier_up", 6, 3, 3, 1, new TierUpRecipeBuilder(), false)
29-
.setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, ProgressWidget.MoveType.HORIZONTAL);
21+
public static final RecipeMapDraconicTierUp DRACONIC_FUSION_TIER_UP_RECIPES = new RecipeMapDraconicTierUp(
22+
"draconic_fusion_tier_up", 6, 3, 3, 1, new TierUpRecipeBuilder(), false);
3023

31-
/**
32-
* Unified recipe map to show all upgrade recipes for draconic fusion on JEI.
33-
* Consolidates recipes from both Draconic and Awakened fusion machines.
34-
* Actual recipe execution is handled by {@link RecipeMapDraconicFusion}.
35-
*/
3624
@ZenProperty
37-
public static final RecipeMap<UpgradeRecipeBuilder> DRACONIC_FUSION_UPGRADE_RECIPES = new RecipeMapDraconicUpgrade<>(
38-
"draconic_fusion_upgrade", 6, 3, 3, 1, new UpgradeRecipeBuilder(), false)
39-
.setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, ProgressWidget.MoveType.HORIZONTAL);
25+
public static final RecipeMapDraconicUpgrade DRACONIC_FUSION_UPGRADE_RECIPES = new RecipeMapDraconicUpgrade(
26+
"draconic_fusion_upgrade", 6, 3, 3, 1, new UpgradeRecipeBuilder(), false);
4027

4128
@ZenProperty
4229
public static final RecipeMap<SimpleRecipeBuilder> DRACONIUM_FUSION_RECIPES = new RecipeMapDraconicFusion(
4330
"draconium_fusion", 6, 3, 3, 1, new SimpleRecipeBuilder(), false,
44-
DRACONIC_FUSION_TIER_UP_RECIPES, DRACONIC_FUSION_UPGRADE_RECIPES)
45-
.setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, ProgressWidget.MoveType.HORIZONTAL)
46-
.setSound(GTSoundEvents.ELECTROLYZER)
47-
.onRecipeBuild(
48-
recipeBuilder -> GTEDraconicRecipeMaps.AWAKENED_DRACONIUM_FUSION_RECIPES
49-
.recipeBuilder()
50-
.inputs(recipeBuilder.getInputs().toArray(new GTRecipeInput[0]))
51-
.fluidInputs(recipeBuilder.getFluidInputs())
52-
.outputs(recipeBuilder.getOutputs())
53-
.fluidOutputs(recipeBuilder.getFluidOutputs())
54-
.duration(recipeBuilder.getDuration())
55-
.EUt(recipeBuilder.getEUt())
56-
.buildAndRegister());
31+
DRACONIC_FUSION_TIER_UP_RECIPES, DRACONIC_FUSION_UPGRADE_RECIPES);
5732

5833
@ZenProperty
5934
public static final RecipeMap<SimpleRecipeBuilder> AWAKENED_DRACONIUM_FUSION_RECIPES = new RecipeMapDraconicFusion(
60-
"awakened_draconium_fusion", 6, 3, 3, 1, new SimpleRecipeBuilder(), true,
61-
DRACONIC_FUSION_TIER_UP_RECIPES, DRACONIC_FUSION_UPGRADE_RECIPES)
62-
.setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, ProgressWidget.MoveType.HORIZONTAL)
63-
.setSound(GTSoundEvents.ELECTROLYZER);
35+
"awakened_draconium_fusion", 6, 3, 3, 1, new SimpleRecipeBuilder(), false,
36+
DRACONIC_FUSION_TIER_UP_RECIPES, DRACONIC_FUSION_UPGRADE_RECIPES);
37+
38+
static {
39+
DRACONIC_FUSION_TIER_UP_RECIPES
40+
.setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, ProgressWidget.MoveType.HORIZONTAL);
41+
DRACONIC_FUSION_UPGRADE_RECIPES
42+
.setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, ProgressWidget.MoveType.HORIZONTAL);
43+
DRACONIUM_FUSION_RECIPES
44+
.setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, ProgressWidget.MoveType.HORIZONTAL)
45+
.setSound(GTSoundEvents.ELECTROLYZER);
46+
AWAKENED_DRACONIUM_FUSION_RECIPES
47+
.setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, ProgressWidget.MoveType.HORIZONTAL)
48+
.setSound(GTSoundEvents.ELECTROLYZER);
49+
}
6450
}

0 commit comments

Comments
 (0)