Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Material Tree JEI page #48

Closed
wants to merge 50 commits into from
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
8be19b9
Add material tree jei page
kumquat-ir Jul 23, 2021
592f34f
Add fluid and fluid container
kumquat-ir Jul 23, 2021
16f86c5
More material info, revert to DustMaterial, remove fluid containers, …
kumquat-ir Jul 23, 2021
e8c2593
first draft layout
kumquat-ir Jul 23, 2021
700a80f
New layout, only show slots that are filled
kumquat-ir Jul 24, 2021
b4749e9
Add arrows, clean things up
kumquat-ir Jul 25, 2021
f0271b1
Add Unbreaking to base enchant list (#49)
BraggestSage833 Jul 25, 2021
4443807
Add Multiblock cached value invalidation on structure deform (#51)
ALongStringOfNumbers Jul 27, 2021
b8f69de
Fixed Material Casting and Added RecipeMap Bracket Handler (#47)
idcppl Jul 28, 2021
812b005
suggested improvements
kumquat-ir Jul 28, 2021
0056465
remove `getTimer()` and add `isFirstTick()`
serenibyss Jul 28, 2021
b870b15
remove deprecated `IMetaItemStats`
serenibyss Jul 28, 2021
ab2f9c0
dump deprecated recipe property methods
serenibyss Jul 28, 2021
3a82954
make recipe properties easier to use
serenibyss Jul 28, 2021
4857d38
remove possible empty spaces between info text
kumquat-ir Jul 28, 2021
0e9d8c7
further small property cleanup
serenibyss Jul 28, 2021
7f6fab9
Implement Item Pipes
brachy84 Jul 28, 2021
7b8f5e4
fix lignite composition
serenibyss Jul 29, 2021
e09f13d
add Coal Gas and Coal Tar processing
serenibyss Jul 29, 2021
00fa71c
use non-deprecated JEI methods, change icon to aluminium ingot
kumquat-ir Jul 29, 2021
512ae6f
Cleanup the usage of some deprecated JEI method (#54)
ALongStringOfNumbers Jul 29, 2021
4da3dbc
add a ton of fluid pipes
TechLord22 Jul 29, 2021
8b840fe
Update some dependencies (#55)
ALongStringOfNumbers Jul 29, 2021
ba98780
new quantum chest texture
TechLord22 Jul 29, 2021
5b5ec62
Allow Multiblocks to share hatches (#12)
BraggestSage833 Jul 30, 2021
09bd434
add steam venting to multiblocks
TechLord22 Jul 31, 2021
33770b6
Add recipes for nearly all vanilla items (#56)
TechLord22 Aug 1, 2021
a0c0a03
Cleanup findRecipe calls (#57)
ALongStringOfNumbers Aug 2, 2021
cf82f95
set `makeObfSourceJar` false
serenibyss Aug 3, 2021
049897d
Material API Overhaul (#58)
serenibyss Aug 5, 2021
b7e2f15
MaterialIconSet Specific Fluid Textures (#61)
TechLord22 Aug 5, 2021
455cd7b
make less merge conflicts for brachy
serenibyss Aug 6, 2021
93a296d
change some colors and iconsets, add BRIGHT iconset
TechLord22 Aug 6, 2021
4aabcb0
add `colorAverage()` builder call
serenibyss Aug 6, 2021
54ba2e9
clean up warnings in RecipeBuilder
serenibyss Aug 6, 2021
1529aae
fix transformer textures not updating properly
TechLord22 Aug 6, 2021
eb091ed
fix incorrect gem_vertical fluid sprite registration
TechLord22 Aug 6, 2021
8022707
improve transformer rendering update logic
TechLord22 Aug 6, 2021
c7fb654
:monkey:
serenibyss Aug 7, 2021
bd584ab
de-Enum OrePrefix
serenibyss Aug 7, 2021
64ba7ff
Add material tree jei page
kumquat-ir Jul 23, 2021
7d71d97
Add fluid and fluid container
kumquat-ir Jul 23, 2021
c55e24e
More material info, revert to DustMaterial, remove fluid containers, …
kumquat-ir Jul 23, 2021
04b6e94
first draft layout
kumquat-ir Jul 23, 2021
39c57f0
New layout, only show slots that are filled
kumquat-ir Jul 24, 2021
5ee3ad5
Add arrows, clean things up
kumquat-ir Jul 25, 2021
00a4d95
suggested improvements
kumquat-ir Jul 28, 2021
856956c
remove possible empty spaces between info text
kumquat-ir Jul 28, 2021
4cabda1
use non-deprecated JEI methods, change icon to aluminium ingot
kumquat-ir Jul 29, 2021
c183803
Merge remote-tracking branch 'origin/materialtree' into materialtree
kumquat-ir Aug 7, 2021
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
14 changes: 13 additions & 1 deletion src/main/java/gregtech/integration/jei/GTJeiPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,15 @@ public void registerCategories(IRecipeCategoryRegistration registry) {
registry.addRecipeCategories(new CokeOvenRecipeCategory(registry.getJeiHelpers().getGuiHelper()));
registry.addRecipeCategories(new OreByProductCategory(registry.getJeiHelpers().getGuiHelper()));
registry.addRecipeCategories(new GTOreCategory(registry.getJeiHelpers().getGuiHelper()));
registry.addRecipeCategories(new MaterialTreeCategory(registry.getJeiHelpers().getGuiHelper()));
}

@Override
public void register(IModRegistry registry) {
IJeiHelpers jeiHelpers = registry.getJeiHelpers();

ingredientRegistry = registry.getIngredientRegistry();

registry.addRecipes(IntCircuitRecipeWrapper.create(), IntCircuitCategory.UID);
MultiblockInfoCategory.registerRecipes(registry);
registry.handleRecipes(CustomItemReturnShapedOreRecipeRecipe.class, recipe -> new CustomItemReturnRecipeWrapper(jeiHelpers, recipe), VanillaRecipeCategoryUid.CRAFTING);
Expand Down Expand Up @@ -197,6 +200,15 @@ public void register(IModRegistry registry) {
registry.addRecipeCatalyst(machine.getStackForm(), oreByProductId);
}

//Material Tree
List<MaterialTree> materialTreeList = new CopyOnWriteArrayList<>();
for (Material material : Material.MATERIAL_REGISTRY) {
if (material instanceof DustMaterial) {
materialTreeList.add(new MaterialTree((DustMaterial) material));
}
}
registry.addRecipes(materialTreeList, GTValues.MODID + ":" + "material_tree");

//Ore Veins
List<OreDepositDefinition> oreVeins = WorldGenRegistry.getOreDeposits();
List<GTOreInfo> oreInfoList = new CopyOnWriteArrayList<>();
Expand All @@ -210,7 +222,7 @@ public void register(IModRegistry registry) {
//Ore Veins End


ingredientRegistry = registry.getIngredientRegistry();

for (int i = 0; i <= IntCircuitIngredient.CIRCUIT_MAX; i++) {
registry.addIngredientInfo(IntCircuitIngredient.getIntegratedCircuit(i), VanillaTypes.ITEM,
"metaitem.circuit.integrated.jei_description");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
package gregtech.integration.jei.recipe.primitive;

import com.google.common.collect.ImmutableList;
import gregtech.api.unification.OreDictUnifier;
import gregtech.api.unification.material.type.DustMaterial;
import gregtech.api.unification.material.type.IngotMaterial;
import gregtech.api.unification.ore.OrePrefix;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;

import java.util.List;
import java.util.ArrayList;

public class MaterialTree implements IRecipeWrapper {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing that I think would be good for this class is a tooltip method for adding tooltips to the items in the material page to notify users of how the materials are made. For example an Aluminum Rod would have the tooltip:

Made from Aluminum ingot in: Extruder, Lathe
Made from Aluminum Long Rod in Cutting Saw

In addition, tooltips would give you the opportunity to mention any recipe properties. You have a line showing the EBF coils, however for the fluid, if it was made in a Fusion Reactor, you could have a tooltip on it:

Made in Fusion Reactor MK 2

private final static ImmutableList<OrePrefix> PREFIXES = ImmutableList.of(
OrePrefix.dust,
OrePrefix.dustSmall,
OrePrefix.dustTiny,
OrePrefix.ingotHot,
OrePrefix.ingot,
OrePrefix.gem,
OrePrefix.block,
OrePrefix.stick,
OrePrefix.stickLong,
OrePrefix.spring,
OrePrefix.gemFlawless,
OrePrefix.bolt,
OrePrefix.screw,
OrePrefix.gemExquisite,
OrePrefix.ring,
OrePrefix.gear,
OrePrefix.frameGt,
OrePrefix.nugget,
OrePrefix.pipeNormal,
OrePrefix.plate,
OrePrefix.plateDense,
OrePrefix.gemChipped,
OrePrefix.gearSmall,
OrePrefix.gemFlawed,
OrePrefix.foil,
OrePrefix.lens,
OrePrefix.wireFine,
OrePrefix.wireGtSingle,
OrePrefix.cableGtSingle
);

private final List<List<ItemStack>> itemInputs = new ArrayList<>();
private final List<List<FluidStack>> fluidInputs = new ArrayList<>();

private final String name;
private final String formula;
private final int blastTemp;
private final long avgM;
private final long avgP;
private final long avgN;

public MaterialTree(DustMaterial material) {
// adding an empty list to itemInputs/fluidInputs makes checking if a prefix exists much easier
List<ItemStack> inputDusts = new ArrayList<>();
for (OrePrefix prefix : PREFIXES) {
inputDusts.add(OreDictUnifier.get(prefix, material));
}
for (ItemStack stack : inputDusts) {
List<ItemStack> matItemsStack = new ArrayList<>();
matItemsStack.add(stack);
this.itemInputs.add(matItemsStack);
}

FluidStack matFluid = material.getFluid(1000);
List<FluidStack> matFluidsStack = new ArrayList<>();
if (matFluid != null) {
matFluidsStack.add(matFluid);
}
this.fluidInputs.add(matFluidsStack);

name = material.getLocalizedName();
formula = material.getChemicalFormula();
avgM = material.getAverageMass();
avgP = material.getAverageProtons();
avgN = material.getAverageNeutrons();
if (material instanceof IngotMaterial) {
blastTemp = ((IngotMaterial) material).blastFurnaceTemperature;
}
else {
blastTemp = 0;
}
}

@Override
public void getIngredients(IIngredients ingredients) {
ingredients.setInputLists(ItemStack.class, this.itemInputs);
ingredients.setInputLists(FluidStack.class, this.fluidInputs);
// these don't get displayed, but allow the material tree to show up on left *or* right click
ingredients.setOutputLists(ItemStack.class, this.itemInputs);
ingredients.setOutputLists(FluidStack.class, this.fluidInputs);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Init with the non-deprecated VanillaTypes.Item and VanillaTypes.Fluid, setInputLists and setOutputLists methods.

}

public String getMaterialName() {
return name;
}

public String getMaterialFormula() {
return formula;
}

public long getAvgM() {
return avgM;
}

public long getAvgP() {
return avgP;
}

public long getAvgN() {
return avgN;
}

public int getBlastTemp() {
return blastTemp;
}
}
Loading