Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 2.6.4
- Re: Improve the VOM UI [#351](https://github.com/GTModpackTeam/GTExpert-Core/pull/351)
- The AwakenedFusion category is hidden [#352](https://github.com/GTModpackTeam/GTExpert-Core/pull/352)

* * *

# 2.6.3
- Re: Fix Disable Helmet AutoEat Mixin [#349](https://github.com/GTModpackTeam/GTExpert-Core/pull/349)
- Improved VFP overclock efficiency with quadratic scaling [#350](https://github.com/GTModpackTeam/GTExpert-Core/pull/350)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
import gregtech.api.capability.impl.MultiblockRecipeLogic;
import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController;

import com.github.gtexpert.core.integration.deda.recipemaps.RecipeMapDraconicFusion;

/**
* This recipe logic disables cache used for speeding up recipe check.
* The reason is we do some special things inside {@link RecipeMapDraconicFusion},
* and reusing recipe causes item with incorrect NBT to be outputted.
* The reason is that Draconic Fusion recipes (TierUp and Upgrade) do special
* output processing based on input NBT, and reusing recipe causes items with
* incorrect NBT to be outputted.
* Considering draconic fusion multi will not be spammed nor OCed to 1 tick, impact to TPS should be negligible.
*/
public class MultiblockRecipeLogicNoCache extends MultiblockRecipeLogic {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,27 @@ public class DEDAJEIProvider implements IModPlugin {
@Override
public void register(@NotNull IModRegistry registry) {
if (GTEValues.isModLoadedDEDA()) {
String fusionCategory = GTValues.MODID + ":" +
// Fusion categories
String draconiumFusionCategory = GTValues.MODID + ":" +
GTEDraconicRecipeMaps.DRACONIUM_FUSION_RECIPES.unlocalizedName;
String awakenedFusionCategory = GTValues.MODID + ":" +
GTEDraconicRecipeMaps.AWAKENED_DRACONIUM_FUSION_RECIPES.unlocalizedName;

// Shared categories
String tierUpCategory = GTValues.MODID + ":" +
GTEDraconicRecipeMaps.DRACONIC_FUSION_TIER_UP_RECIPES.unlocalizedName;
String upgradeCategory = GTValues.MODID + ":" +
GTEDraconicRecipeMaps.DRACONIC_FUSION_UPGRADE_RECIPES.unlocalizedName;

registry.addRecipeCatalyst(DEDAMetaTileEntities.AWAKENED_DRACONIUM_FUSION.getStackForm(), fusionCategory);
// Register Fusion categories
registry.addRecipeCatalyst(DEDAMetaTileEntities.AWAKENED_DRACONIUM_FUSION.getStackForm(),
draconiumFusionCategory);

// Register TierUp category
registry.addRecipeCatalyst(DEDAMetaTileEntities.DRACONIUM_FUSION.getStackForm(), tierUpCategory);
registry.addRecipeCatalyst(DEDAMetaTileEntities.AWAKENED_DRACONIUM_FUSION.getStackForm(), tierUpCategory);

// Register Upgrade category
registry.addRecipeCatalyst(DEDAMetaTileEntities.DRACONIUM_FUSION.getStackForm(), upgradeCategory);
registry.addRecipeCatalyst(DEDAMetaTileEntities.AWAKENED_DRACONIUM_FUSION.getStackForm(), upgradeCategory);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
package com.github.gtexpert.core.integration.deda.recipemaps;

import java.util.List;

import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.Constants;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import com.brandon3055.brandonscore.utils.ItemNBTHelper;
import com.brandon3055.draconicevolution.api.fusioncrafting.IFusionRecipe;
import com.brandon3055.draconicevolution.api.fusioncrafting.SimpleFusionRecipe;
import com.brandon3055.draconicevolution.api.itemupgrade.FusionUpgradeRecipe;
import com.brandon3055.draconicevolution.api.itemupgrade.IUpgradableItem;
import com.brandon3055.draconicevolution.api.itemupgrade.UpgradeHelper;
import com.brandon3055.draconicevolution.items.ToolUpgrade;

import gregtech.api.capability.FeCompat;
import gregtech.api.capability.GregtechCapabilities;
import gregtech.api.capability.IElectricItem;
import gregtech.api.recipes.Recipe;

import com.github.gtexpert.core.api.util.GTELog;

import cofh.redstoneflux.api.IEnergyContainerItem;

/**
* Utility methods shared between TierUp and Upgrade recipe maps.
*/
public final class DraconicRecipeUtils {

private DraconicRecipeUtils() {}

/**
* Applies default upgrade tags to upgradable items.
* This ensures consistent NBT state for recipe matching.
*/
public static void applyDefaultUpgradeTag(List<ItemStack> inputs) {
for (ItemStack input : inputs) {
if (!(input.getItem() instanceof IUpgradableItem item)) continue;
for (String upgradeName : ToolUpgrade.NAME_TO_ID.keySet()) {
if (!item.getValidUpgrades(input).contains(upgradeName)) continue;
NBTTagCompound upgradeTag = input.getOrCreateSubCompound(UpgradeHelper.UPGRADE_TAG);
if (upgradeTag.hasKey(upgradeName, Constants.NBT.TAG_BYTE)) continue;
upgradeTag.setByte(upgradeName, (byte) 0);
}
}
}

/**
* Sets up the output item for a TierUp or Upgrade recipe.
* Handles NBT copying and energy conversion.
*/
@Nullable
public static Recipe setupOutput(Recipe gtRecipe, List<ItemStack> inputs, IFusionRecipe fusionRecipe) {
if (fusionRecipe == null) {
GTELog.logger.warn("Recipe found, but property not found");
GTELog.logger.warn("Recipe: " + gtRecipe);
return null;
}
ItemStack catalyst = findCatalyst(inputs, fusionRecipe);
if (catalyst.isEmpty()) {
GTELog.logger.warn("Recipe found, but actual catalyst not found in the GT recipe");
GTELog.logger.warn("Recipe: " + gtRecipe);
GTELog.logger.warn("Expected catalyst: " + fusionRecipe.getRecipeCatalyst());
return null;
}

ItemStack outputStack = fusionRecipe.getRecipeOutput(catalyst);

// convert GTEU to FE
IElectricItem inputElectricItem = catalyst.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null);
if (inputElectricItem != null) {
long euCharge = inputElectricItem.getCharge();
int feCharge = (int) Math.min(euCharge * FeCompat.ratio(false), Integer.MAX_VALUE);
if (outputStack.getItem() instanceof IEnergyContainerItem outputEnergyItem) {
ItemNBTHelper.setInteger(outputStack, "Energy",
Math.min(feCharge, outputEnergyItem.getMaxEnergyStored(outputStack)));
}
}

Recipe retRecipe = gtRecipe.copy();
retRecipe.getOutputs().clear(); // This assumes there's only 1 output
retRecipe.getOutputs().add(outputStack);
return retRecipe;
}

@NotNull
public static ItemStack findCatalyst(List<ItemStack> inputs, IFusionRecipe fusionRecipe) {
ItemStack expectedCatalyst = getCatalyst(fusionRecipe);
if (expectedCatalyst == null || expectedCatalyst.isEmpty()) {
return ItemStack.EMPTY;
}
for (ItemStack input : inputs) {
if (expectedCatalyst.getItem() == input.getItem() &&
expectedCatalyst.getItemDamage() == input.getItemDamage() && fusionRecipe.isRecipeCatalyst(input)) {
return input;
}
}
return ItemStack.EMPTY;
}

@Nullable
public static ItemStack getCatalyst(IFusionRecipe fusionRecipe) {
if (fusionRecipe instanceof SimpleFusionRecipe) {
return fusionRecipe.getRecipeCatalyst();
} else if (fusionRecipe instanceof FusionUpgradeRecipe) {
List<Object> ingredients = ((FusionUpgradeRecipe) fusionRecipe).getRecipeIngredients();
if (ingredients.isEmpty() || !(ingredients.get(0) instanceof ItemStack)) {
GTELog.logger.warn("Unknown ingredient: " + (ingredients.isEmpty() ? "empty" : ingredients.get(0)));
GTELog.logger.warn("Recipe: " + fusionRecipe);
return null;
}
return (ItemStack) ingredients.get(0);
} else {
throw new RuntimeException("Unknown type of IFusionRecipe: " + fusionRecipe.getClass().getName());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import gregtech.api.gui.widgets.ProgressWidget;
import gregtech.api.recipes.RecipeMap;
import gregtech.api.recipes.builders.SimpleRecipeBuilder;
import gregtech.api.recipes.ingredients.GTRecipeInput;
import gregtech.core.sound.GTSoundEvents;

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

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

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

@ZenProperty
public static final RecipeMap<SimpleRecipeBuilder> DRACONIUM_FUSION_RECIPES = new RecipeMapDraconicFusion(
"draconium_fusion", 6, 3, 3, 1, new SimpleRecipeBuilder(), false,
DRACONIC_FUSION_TIER_UP_RECIPES, DRACONIC_FUSION_UPGRADE_RECIPES)
.setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, ProgressWidget.MoveType.HORIZONTAL)
.setSound(GTSoundEvents.ELECTROLYZER)
.onRecipeBuild(
recipeBuilder -> GTEDraconicRecipeMaps.AWAKENED_DRACONIUM_FUSION_RECIPES
.recipeBuilder()
.inputs(recipeBuilder.getInputs().toArray(new GTRecipeInput[0]))
.fluidInputs(recipeBuilder.getFluidInputs())
.outputs(recipeBuilder.getOutputs())
.fluidOutputs(recipeBuilder.getFluidOutputs())
.duration(recipeBuilder.getDuration())
.EUt(recipeBuilder.getEUt())
.buildAndRegister());
DRACONIC_FUSION_TIER_UP_RECIPES, DRACONIC_FUSION_UPGRADE_RECIPES);

@ZenProperty
public static final RecipeMap<SimpleRecipeBuilder> AWAKENED_DRACONIUM_FUSION_RECIPES = new RecipeMapDraconicFusion(
"awakened_draconium_fusion", 6, 3, 3, 1, new SimpleRecipeBuilder(), true,
DRACONIC_FUSION_TIER_UP_RECIPES, DRACONIC_FUSION_UPGRADE_RECIPES)
.setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, ProgressWidget.MoveType.HORIZONTAL)
.setSound(GTSoundEvents.ELECTROLYZER);
"awakened_draconium_fusion", 6, 3, 3, 1, new SimpleRecipeBuilder(), false,
DRACONIC_FUSION_TIER_UP_RECIPES, DRACONIC_FUSION_UPGRADE_RECIPES);

static {
DRACONIC_FUSION_TIER_UP_RECIPES
.setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, ProgressWidget.MoveType.HORIZONTAL);
DRACONIC_FUSION_UPGRADE_RECIPES
.setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, ProgressWidget.MoveType.HORIZONTAL);
DRACONIUM_FUSION_RECIPES
.setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, ProgressWidget.MoveType.HORIZONTAL)
.setSound(GTSoundEvents.ELECTROLYZER);
AWAKENED_DRACONIUM_FUSION_RECIPES
.setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, ProgressWidget.MoveType.HORIZONTAL)
.setSound(GTSoundEvents.ELECTROLYZER);
}
}
Loading