Skip to content

Commit

Permalink
Godforge hangover (#3396)
Browse files Browse the repository at this point in the history
Co-authored-by: GDCloud <[email protected]>
Co-authored-by: GDCloud <[email protected]>
Co-authored-by: Martin Robertz <[email protected]>
  • Loading branch information
4 people authored Nov 28, 2024
1 parent 3fcd89a commit e41a088
Show file tree
Hide file tree
Showing 30 changed files with 2,564 additions and 1,760 deletions.
1 change: 1 addition & 0 deletions src/main/java/gregtech/api/gui/modularui/GTUITextures.java
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ public static FallbackableUITexture fallbackableProgressbar(String name, UITextu
public static final UITexture PICTURE_SLOTS_HOLO_3BY3 = UITexture
.fullImage(GregTech.ID, "gui/picture/slots_holo_3by3");
public static final UITexture PICTURE_ARROW_DOUBLE = UITexture.fullImage(GregTech.ID, "gui/picture/arrow_double");
public static final UITexture PICTURE_ARROW_GRAY = UITexture.fullImage(GregTech.ID, "gui/picture/arrow_gray");
public static final UITexture PICTURE_SUPER_BUFFER = UITexture.fullImage(GregTech.ID, "gui/picture/super_buffer");
public static final UITexture PICTURE_SQUARE_LIGHT_GRAY = UITexture
.fullImage(GregTech.ID, "gui/picture/square_light_gray");
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/gregtech/api/util/GTRecipeConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ public class GTRecipeConstants {
public static final RecipeMetadataKey<Boolean> FOG_PLASMA_MULTISTEP = SimpleRecipeMetadataKey
.create(Boolean.class, "fog_plasma_multistep");

/**
* FOG Shortened upgrade name.
*/
public static final RecipeMetadataKey<String> FOG_UPGRADE_NAME_SHORT = SimpleRecipeMetadataKey
.create(String.class, "fog_plasma_upgrade_name_short");

/**
* DEFC Casing tier.
*/
Expand Down
1 change: 1 addition & 0 deletions src/main/java/tectech/loader/recipe/BaseRecipeLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ public void run() {
} else {
Godforge.runDevEnvironmentRecipes();
}
Godforge.addFakeUpgradeCostRecipes();
}
}
220 changes: 147 additions & 73 deletions src/main/java/tectech/loader/recipe/Godforge.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
import static gregtech.api.util.GTRecipeConstants.FOG_EXOTIC_TIER;
import static gregtech.api.util.GTRecipeConstants.FOG_PLASMA_MULTISTEP;
import static gregtech.api.util.GTRecipeConstants.FOG_PLASMA_TIER;
import static gregtech.api.util.GTRecipeConstants.FOG_UPGRADE_NAME_SHORT;
import static tectech.recipe.TecTechRecipeMaps.godforgeExoticMatterRecipes;
import static tectech.recipe.TecTechRecipeMaps.godforgePlasmaRecipes;
import static tectech.util.GodforgeMath.getRandomIntInRange;
import static tectech.thing.metaTileEntity.multi.godforge.util.GodforgeMath.getRandomIntInRange;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -26,6 +27,8 @@
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary;

import org.apache.commons.lang3.ArrayUtils;

import goodgenerator.items.GGMaterial;
import goodgenerator.util.ItemRefer;
import gregtech.api.enums.GTValues;
Expand All @@ -47,6 +50,7 @@
import it.unimi.dsi.fastutil.ints.IntList;
import tectech.recipe.TecTechRecipeMaps;
import tectech.thing.CustomItemList;
import tectech.thing.metaTileEntity.multi.godforge.upgrade.ForgeOfGodsUpgrade;

public class Godforge implements Runnable {

Expand All @@ -55,7 +59,6 @@ public class Godforge implements Runnable {
public static final HashMap<ItemStack, Integer> exoticModulePlasmaItemMap = new HashMap<>();
public static final HashMap<FluidStack, Integer> exoticModulePlasmaFluidMap = new HashMap<>();
public static final HashMap<ItemStack, Integer> exoticModuleMagmatterItemMap = new HashMap<>();
public static final HashMap<Integer, ItemStack[]> godforgeUpgradeMats = new HashMap<>();
public static final List<ItemStack> quarkGluonFluidItemsForNEI = new ArrayList<>();
public static final List<ItemStack> quarkGluonItemsForNEI = new ArrayList<>();
public static final List<ItemStack> magmatterTimeFluidItemsForNEI = new ArrayList<>();
Expand Down Expand Up @@ -688,83 +691,154 @@ public void run() {

// Godforge upgrade materials
if (EternalSingularity.isModLoaded() && GalaxySpace.isModLoaded()) {
godforgeUpgradeMats.put(
0,
new ItemStack[] { GTOreDictUnificator.get(OrePrefixes.frameGt, Materials.SuperconductorUIVBase, 64),
ItemList.SuperconductorComposite.get(32),
GGMaterial.metastableOganesson.get(OrePrefixes.gearGt, 16),
getModItem(EternalSingularity.ID, "eternal_singularity", 8L), ItemList.Robot_Arm_UIV.get(64L),
ItemList.Field_Generator_UEV.get(64L) });

godforgeUpgradeMats.put(
5,
new ItemStack[] { GregtechItemList.Mega_AlloyBlastSmelter.get(16L),
ItemList.Casing_Coil_Hypogen.get(64L),
CustomItemList.Godforge_HarmonicPhononTransmissionConduit.get(32L),
getModItem(EternalSingularity.ID, "eternal_singularity", 16L),
ItemRefer.Field_Restriction_Coil_T3.get(48), ItemList.Robot_Arm_UIV.get(64L),
ItemList.Field_Generator_UEV.get(64L) });

godforgeUpgradeMats.put(
7,
new ItemStack[] { CustomItemList.Godforge_StellarEnergySiphonCasing.get(8),
GregtechItemList.FusionComputer_UV3.get(8), GregtechItemList.Casing_Fusion_Internal2.get(64),
getModItem(GalaxySpace.ID, "item.DysonSwarmParts", 64, 3), MaterialsAlloy.QUANTUM.getPlateDense(48),
MaterialsElements.STANDALONE.RHUGNOR.getGear(32),
getModItem(EternalSingularity.ID, "eternal_singularity", 16L), ItemList.Robot_Arm_UIV.get(64L),
ItemList.Field_Generator_UEV.get(64L) });

godforgeUpgradeMats.put(
11,
new ItemStack[] { CustomItemList.Godforge_StellarEnergySiphonCasing.get(16),
ItemRefer.Compact_Fusion_MK5.get(2), ItemRefer.Compact_Fusion_Coil_T4.get(64),
CustomItemList.Godforge_HarmonicPhononTransmissionConduit.get(16),
ItemList.Machine_Multi_TranscendentPlasmaMixer.get(4),
MaterialsElements.STANDALONE.RHUGNOR.getGear(64),
GTOreDictUnificator.get(OrePrefixes.gearGt, Materials.Ichorium, 64),
getModItem(EternalSingularity.ID, "eternal_singularity", 32L), ItemList.Robot_Arm_UIV.get(64L),
ItemList.Field_Generator_UEV.get(64L) });

godforgeUpgradeMats.put(
26,
new ItemStack[] { GTOreDictUnificator.get(OrePrefixes.frameGt, MaterialsUEVplus.SpaceTime, 64),
GTOreDictUnificator.get(OrePrefixes.frameGt, Materials.SuperconductorUMVBase, 64),
MaterialsElements.STANDALONE.HYPOGEN.getFrameBox(64),
MaterialsElements.STANDALONE.DRAGON_METAL.getFrameBox(64),
CustomItemList.EOH_Reinforced_Spatial_Casing.get(64),
CustomItemList.EOH_Infinite_Energy_Casing.get(8), ItemList.ZPM6.get(2),
ItemList.Field_Generator_UMV.get(32) });

godforgeUpgradeMats.put(
29,
new ItemStack[] { GTOreDictUnificator.get(OrePrefixes.frameGt, MaterialsUEVplus.WhiteDwarfMatter, 64),
GTOreDictUnificator.get(OrePrefixes.frameGt, MaterialsUEVplus.BlackDwarfMatter, 64),
GTOreDictUnificator.get(OrePrefixes.frameGt, MaterialsUEVplus.Eternity, 16),
GTOreDictUnificator.get(OrePrefixes.frameGt, MaterialsUEVplus.Universium, 2),
CustomItemList.EOH_Infinite_Energy_Casing.get(64),
CustomItemList.StabilisationFieldGeneratorTier5.get(16), ItemList.ZPM6.get(6),
ItemList.Field_Generator_UMV.get(64) });

godforgeUpgradeMats.put(
30,
new ItemStack[] { CustomItemList.Machine_Multi_QuarkGluonPlasmaModule.get(32),
CustomItemList.Godforge_StellarEnergySiphonCasing.get(64),
CustomItemList.StabilisationFieldGeneratorTier6.get(48),
ItemList.Transdimensional_Alignment_Matrix.get(8), ItemList.ZPM6.get(16),
ItemList.Robot_Arm_UMV.get(64), ItemList.Conveyor_Module_UMV.get(64) });
ForgeOfGodsUpgrade.START.addExtraCost(
GTOreDictUnificator.get(OrePrefixes.frameGt, Materials.SuperconductorUIVBase, 64),
ItemList.SuperconductorComposite.get(32),
GGMaterial.metastableOganesson.get(OrePrefixes.gearGt, 16),
getModItem(EternalSingularity.ID, "eternal_singularity", 8L),
ItemList.Robot_Arm_UIV.get(64L),
ItemList.Field_Generator_UEV.get(64L));

ForgeOfGodsUpgrade.FDIM.addExtraCost(
GregtechItemList.Mega_AlloyBlastSmelter.get(16L),
ItemList.Casing_Coil_Hypogen.get(64L),
CustomItemList.Godforge_HarmonicPhononTransmissionConduit.get(32L),
getModItem(EternalSingularity.ID, "eternal_singularity", 16L),
ItemRefer.Field_Restriction_Coil_T3.get(48),
ItemList.Robot_Arm_UIV.get(64L),
ItemList.Field_Generator_UEV.get(64L));

ForgeOfGodsUpgrade.GPCI.addExtraCost(
CustomItemList.Godforge_StellarEnergySiphonCasing.get(8),
GregtechItemList.FusionComputer_UV3.get(8),
GregtechItemList.Casing_Fusion_Internal2.get(64),
getModItem(GalaxySpace.ID, "item.DysonSwarmParts", 64, 3),
MaterialsAlloy.QUANTUM.getPlateDense(48),
MaterialsElements.STANDALONE.RHUGNOR.getGear(32),
getModItem(EternalSingularity.ID, "eternal_singularity", 16L),
ItemList.Robot_Arm_UIV.get(64L),
ItemList.Field_Generator_UEV.get(64L));

ForgeOfGodsUpgrade.QGPIU.addExtraCost(
CustomItemList.Godforge_StellarEnergySiphonCasing.get(16),
ItemRefer.Compact_Fusion_MK5.get(2),
ItemRefer.Compact_Fusion_Coil_T4.get(64),
CustomItemList.Godforge_HarmonicPhononTransmissionConduit.get(16),
ItemList.Machine_Multi_TranscendentPlasmaMixer.get(4),
MaterialsElements.STANDALONE.RHUGNOR.getGear(64),
GTOreDictUnificator.get(OrePrefixes.gearGt, Materials.Ichorium, 64),
getModItem(EternalSingularity.ID, "eternal_singularity", 32L),
ItemList.Robot_Arm_UIV.get(64L),
ItemList.Field_Generator_UEV.get(64L));

ForgeOfGodsUpgrade.CD.addExtraCost(
GTOreDictUnificator.get(OrePrefixes.frameGt, MaterialsUEVplus.SpaceTime, 64),
GTOreDictUnificator.get(OrePrefixes.frameGt, Materials.SuperconductorUMVBase, 64),
MaterialsElements.STANDALONE.HYPOGEN.getFrameBox(64),
MaterialsElements.STANDALONE.DRAGON_METAL.getFrameBox(64),
CustomItemList.EOH_Reinforced_Spatial_Casing.get(64),
CustomItemList.EOH_Infinite_Energy_Casing.get(8),
ItemList.ZPM6.get(2),
ItemList.Field_Generator_UMV.get(32));

ForgeOfGodsUpgrade.EE.addExtraCost(
GTOreDictUnificator.get(OrePrefixes.frameGt, MaterialsUEVplus.WhiteDwarfMatter, 64),
GTOreDictUnificator.get(OrePrefixes.frameGt, MaterialsUEVplus.BlackDwarfMatter, 64),
GTOreDictUnificator.get(OrePrefixes.frameGt, MaterialsUEVplus.Eternity, 16),
GTOreDictUnificator.get(OrePrefixes.frameGt, MaterialsUEVplus.Universium, 2),
CustomItemList.EOH_Infinite_Energy_Casing.get(64),
CustomItemList.StabilisationFieldGeneratorTier5.get(16),
ItemList.ZPM6.get(6),
ItemList.Field_Generator_UMV.get(64));

ForgeOfGodsUpgrade.END.addExtraCost(
CustomItemList.Machine_Multi_QuarkGluonPlasmaModule.get(32),
CustomItemList.Godforge_StellarEnergySiphonCasing.get(64),
CustomItemList.StabilisationFieldGeneratorTier6.get(48),
ItemList.Transdimensional_Alignment_Matrix.get(8),
ItemList.ZPM6.get(16),
ItemList.Robot_Arm_UMV.get(64),
ItemList.Conveyor_Module_UMV.get(64));
}

}

public static void runDevEnvironmentRecipes() {
// put something in here to not crash the game in dev environment when opening the manual insertion window
godforgeUpgradeMats.put(0, new ItemStack[] { new ItemStack(Blocks.cobblestone, 4) });
godforgeUpgradeMats.put(5, new ItemStack[] { new ItemStack(Blocks.cobblestone, 8) });
godforgeUpgradeMats.put(7, new ItemStack[] { new ItemStack(Blocks.cobblestone, 12) });
godforgeUpgradeMats.put(11, new ItemStack[] { new ItemStack(Blocks.cobblestone, 16) });
godforgeUpgradeMats.put(26, new ItemStack[] { new ItemStack(Blocks.cobblestone, 32) });
godforgeUpgradeMats.put(29, new ItemStack[] { new ItemStack(Blocks.cobblestone, 48) });
godforgeUpgradeMats.put(30, new ItemStack[] { new ItemStack(Blocks.cobblestone, 64) });
ForgeOfGodsUpgrade.START.addExtraCost(
new ItemStack(Blocks.cobblestone, 4),
new ItemStack(Blocks.dirt, 12),
new ItemStack(Blocks.diamond_block, 8),
new ItemStack(Blocks.gold_block, 32));
ForgeOfGodsUpgrade.FDIM.addExtraCost(new ItemStack(Blocks.cobblestone, 8));
ForgeOfGodsUpgrade.GPCI.addExtraCost(new ItemStack(Blocks.cobblestone, 12));
ForgeOfGodsUpgrade.QGPIU.addExtraCost(new ItemStack(Blocks.cobblestone, 16));
ForgeOfGodsUpgrade.CD.addExtraCost(new ItemStack(Blocks.cobblestone, 32));
ForgeOfGodsUpgrade.EE.addExtraCost(new ItemStack(Blocks.cobblestone, 48));
ForgeOfGodsUpgrade.END.addExtraCost(new ItemStack(Blocks.cobblestone, 64));
}

public static void addFakeUpgradeCostRecipes() {
GTValues.RA.stdBuilder()
.itemInputs(ArrayUtils.addAll(ForgeOfGodsUpgrade.START.getExtraCost()))
.itemOutputs(
CustomItemList.Godforge_GravitonFlowModulatorTier1.get(1),
CustomItemList.Machine_Multi_SmeltingModule.get(1))
.duration(1)
.eut(1)
.metadata(FOG_UPGRADE_NAME_SHORT, ForgeOfGodsUpgrade.START.getShortNameText())
.fake()
.addTo(TecTechRecipeMaps.godforgeFakeUpgradeCostRecipes);
GTValues.RA.stdBuilder()
.itemInputs(ArrayUtils.addAll(ForgeOfGodsUpgrade.FDIM.getExtraCost()))
.itemOutputs(CustomItemList.Machine_Multi_MoltenModule.get(1))
.duration(1)
.eut(1)
.metadata(FOG_UPGRADE_NAME_SHORT, ForgeOfGodsUpgrade.FDIM.getShortNameText())
.fake()
.addTo(TecTechRecipeMaps.godforgeFakeUpgradeCostRecipes);
GTValues.RA.stdBuilder()
.itemInputs(ArrayUtils.addAll(ForgeOfGodsUpgrade.GPCI.getExtraCost()))
.itemOutputs(CustomItemList.Machine_Multi_PlasmaModule.get(1))
.duration(1)
.eut(1)
.metadata(FOG_UPGRADE_NAME_SHORT, ForgeOfGodsUpgrade.GPCI.getShortNameText())
.fake()
.addTo(TecTechRecipeMaps.godforgeFakeUpgradeCostRecipes);
GTValues.RA.stdBuilder()
.itemInputs(ArrayUtils.addAll(ForgeOfGodsUpgrade.QGPIU.getExtraCost()))
.itemOutputs(CustomItemList.Machine_Multi_QuarkGluonPlasmaModule.get(1))
.fluidOutputs(MaterialsUEVplus.QuarkGluonPlasma.getFluid(1000))
.duration(1)
.eut(1)
.metadata(FOG_UPGRADE_NAME_SHORT, ForgeOfGodsUpgrade.QGPIU.getShortNameText())
.fake()
.addTo(TecTechRecipeMaps.godforgeFakeUpgradeCostRecipes);
GTValues.RA.stdBuilder()
.itemInputs(ArrayUtils.addAll(ForgeOfGodsUpgrade.CD.getExtraCost()))
.itemOutputs(CustomItemList.Godforge_GravitonFlowModulatorTier2.get(1))
.duration(1)
.eut(1)
.metadata(FOG_UPGRADE_NAME_SHORT, ForgeOfGodsUpgrade.CD.getShortNameText())
.fake()
.addTo(TecTechRecipeMaps.godforgeFakeUpgradeCostRecipes);
GTValues.RA.stdBuilder()
.itemInputs(ArrayUtils.addAll(ForgeOfGodsUpgrade.EE.getExtraCost()))
.itemOutputs(CustomItemList.Godforge_GravitonFlowModulatorTier3.get(1))
.duration(1)
.eut(1)
.metadata(FOG_UPGRADE_NAME_SHORT, ForgeOfGodsUpgrade.EE.getShortNameText())
.fake()
.addTo(TecTechRecipeMaps.godforgeFakeUpgradeCostRecipes);
GTValues.RA.stdBuilder()
.itemInputs(ArrayUtils.addAll(ForgeOfGodsUpgrade.END.getExtraCost()))
.itemOutputs(MaterialsUEVplus.GravitonShard.getGems(1))
.fluidOutputs(MaterialsUEVplus.MagMatter.getMolten(576), Materials.Neutronium.getPlasma(1000))
.duration(1)
.eut(1)
.metadata(FOG_UPGRADE_NAME_SHORT, ForgeOfGodsUpgrade.END.getShortNameText())
.fake()
.addTo(TecTechRecipeMaps.godforgeFakeUpgradeCostRecipes);
}

public static void initMoltenModuleRecipes() {
Expand Down
74 changes: 74 additions & 0 deletions src/main/java/tectech/recipe/GodforgeUpgradeCostFrontend.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package tectech.recipe;

import static gregtech.api.util.GTRecipeConstants.FOG_UPGRADE_NAME_SHORT;

import java.util.List;

import javax.annotation.ParametersAreNonnullByDefault;

import net.minecraft.client.Minecraft;
import net.minecraft.util.EnumChatFormatting;

import com.gtnewhorizons.modularui.api.math.Pos2d;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.common.widget.DrawableWidget;

import gregtech.api.recipe.BasicUIPropertiesBuilder;
import gregtech.api.recipe.NEIRecipePropertiesBuilder;
import gregtech.api.recipe.RecipeMapFrontend;
import gregtech.api.util.MethodsReturnNonnullByDefault;
import gregtech.common.gui.modularui.UIHelper;
import gregtech.nei.RecipeDisplayInfo;
import tectech.thing.gui.TecTechUITextures;

@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class GodforgeUpgradeCostFrontend extends RecipeMapFrontend {

public GodforgeUpgradeCostFrontend(BasicUIPropertiesBuilder uiPropertiesBuilder,
NEIRecipePropertiesBuilder neiPropertiesBuilder) {
super(uiPropertiesBuilder, neiPropertiesBuilder);
}

@Override
public void addGregTechLogo(ModularWindow.Builder builder, Pos2d windowOffset) {
builder.widget(
new DrawableWidget().setDrawable(TecTechUITextures.PICTURE_GODFORGE_LOGO)
.setSize(18, 18)
.setPos(new Pos2d(151, 63).add(windowOffset)));
}

@Override
public List<Pos2d> getItemInputPositions(int itemInputCount) {
return UIHelper.getGridPositions(itemInputCount, 8, 17, 4);
}

@Override
public List<Pos2d> getItemOutputPositions(int itemOutputCount) {
return UIHelper.getGridPositions(itemOutputCount, 116, 26, 1);
}

@Override
public List<Pos2d> getFluidOutputPositions(int fluidOutputCount) {
return UIHelper.getGridPositions(fluidOutputCount, 134, 26, 1);
}

@Override
protected void drawDurationInfo(RecipeDisplayInfo recipeInfo) {}

@Override
protected void drawEnergyInfo(RecipeDisplayInfo recipeInfo) {}

@Override
protected void drawSpecialInfo(RecipeDisplayInfo recipeInfo) {
String upgradeName = recipeInfo.recipe.getMetadataOrDefault(FOG_UPGRADE_NAME_SHORT, "");
int width = Minecraft.getMinecraft().fontRenderer.getStringWidth(upgradeName);
if (width % 2 == 1) width -= 1;
int xOffset = 18 - width / 2 - 1;
recipeInfo.drawText(" ", 83, -76);
recipeInfo.drawText(
EnumChatFormatting.BLUE.toString() + EnumChatFormatting.UNDERLINE + EnumChatFormatting.BOLD + upgradeName,
110 + xOffset,
0);
}
}
12 changes: 12 additions & 0 deletions src/main/java/tectech/recipe/TecTechRecipeMaps.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,16 @@ public static void init() {}
.logoPos(151, 63)
.build();

public static final RecipeMap<RecipeMapBackend> godforgeFakeUpgradeCostRecipes = RecipeMapBuilder
.of("gt.recipe.upgrade_costs")
.maxIO(12, 2, 0, 2)
.addSpecialTexture(83, 38, 30, 13, GTUITextures.PICTURE_ARROW_GRAY)
.dontUseProgressBar()
.neiTransferRect(83, 38, 30, 13)
.frontend(GodforgeUpgradeCostFrontend::new)
.neiHandlerInfo(
builder -> builder.setDisplayStack(CustomItemList.Machine_Multi_ForgeOfGods.get(1))
.setHeight(100))
.build();

}
Loading

0 comments on commit e41a088

Please sign in to comment.