From 98e3befed157f56ac3859ee19d4a8b0954fed113 Mon Sep 17 00:00:00 2001 From: froot <66188216+kumquat-ir@users.noreply.github.com> Date: Fri, 20 Aug 2021 22:38:12 -0700 Subject: [PATCH] Material Tree JEI page returns (#66) --- .../gregtech/integration/jei/GTJeiPlugin.java | 10 + .../jei/recipe/primitive/MaterialTree.java | 123 ++++++++ .../primitive/MaterialTreeCategory.java | 290 ++++++++++++++++++ .../jei/utils/render/DrawableRegistry.java | 24 ++ .../resources/assets/gregtech/lang/en_us.lang | 5 + .../gregtech/textures/gui/arrows/2d12.png | Bin 0 -> 115 bytes .../gregtech/textures/gui/arrows/2d16.png | Bin 0 -> 115 bytes .../gregtech/textures/gui/arrows/2r16d37.png | Bin 0 -> 148 bytes .../gregtech/textures/gui/arrows/d14.png | Bin 0 -> 106 bytes .../gregtech/textures/gui/arrows/d7r25u6.png | Bin 0 -> 119 bytes .../gregtech/textures/gui/arrows/d7r50d7.png | Bin 0 -> 133 bytes .../gregtech/textures/gui/arrows/d7r50u6.png | Bin 0 -> 131 bytes .../gregtech/textures/gui/arrows/d7r75d7.png | Bin 0 -> 149 bytes .../gregtech/textures/gui/arrows/d7r75u6.png | Bin 0 -> 140 bytes .../textures/gui/arrows/d7r87u22r4.png | Bin 0 -> 189 bytes .../textures/gui/arrows/d7r87u46r4.png | Bin 0 -> 241 bytes .../gregtech/textures/gui/arrows/l7.png | Bin 0 -> 108 bytes .../gregtech/textures/gui/arrows/r3d16r4.png | Bin 0 -> 116 bytes .../gregtech/textures/gui/arrows/r3d26r4.png | Bin 0 -> 118 bytes .../gregtech/textures/gui/arrows/r3u15r4.png | Bin 0 -> 121 bytes .../gregtech/textures/gui/arrows/r3u32r4.png | Bin 0 -> 125 bytes .../gregtech/textures/gui/arrows/r3u57r4.png | Bin 0 -> 129 bytes .../gregtech/textures/gui/arrows/r7.png | Bin 0 -> 108 bytes .../gregtech/textures/gui/arrows/u12.png | Bin 0 -> 108 bytes .../gregtech/textures/gui/arrows/u7r25d6.png | Bin 0 -> 115 bytes .../gregtech/textures/gui/arrows/u7r50d6.png | Bin 0 -> 124 bytes .../gregtech/textures/gui/arrows/u7r50u5.png | Bin 0 -> 143 bytes .../gregtech/textures/gui/arrows/u7r75d6.png | Bin 0 -> 132 bytes .../gregtech/textures/gui/arrows/u7r75u5.png | Bin 0 -> 152 bytes .../textures/gui/arrows/u7r87d15r4.png | Bin 0 -> 164 bytes .../textures/gui/arrows/u7r87u8r4.png | Bin 0 -> 171 bytes 31 files changed, 452 insertions(+) create mode 100644 src/main/java/gregtech/integration/jei/recipe/primitive/MaterialTree.java create mode 100644 src/main/java/gregtech/integration/jei/recipe/primitive/MaterialTreeCategory.java create mode 100644 src/main/java/gregtech/integration/jei/utils/render/DrawableRegistry.java create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/2d12.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/2d16.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/2r16d37.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/d14.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/d7r25u6.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/d7r50d7.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/d7r50u6.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/d7r75d7.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/d7r75u6.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/d7r87u22r4.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/d7r87u46r4.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/l7.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/r3d16r4.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/r3d26r4.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/r3u15r4.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/r3u32r4.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/r3u57r4.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/r7.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/u12.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/u7r25d6.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/u7r50d6.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/u7r50u5.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/u7r75d6.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/u7r75u5.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/u7r87d15r4.png create mode 100644 src/main/resources/assets/gregtech/textures/gui/arrows/u7r87u8r4.png diff --git a/src/main/java/gregtech/integration/jei/GTJeiPlugin.java b/src/main/java/gregtech/integration/jei/GTJeiPlugin.java index 423747517b8..72b34be1d94 100755 --- a/src/main/java/gregtech/integration/jei/GTJeiPlugin.java +++ b/src/main/java/gregtech/integration/jei/GTJeiPlugin.java @@ -84,6 +84,7 @@ public void registerCategories(IRecipeCategoryRegistration registry) { } registry.addRecipeCategories(new OreByProductCategory(registry.getJeiHelpers().getGuiHelper())); registry.addRecipeCategories(new GTOreCategory(registry.getJeiHelpers().getGuiHelper())); + registry.addRecipeCategories(new MaterialTreeCategory(registry.getJeiHelpers().getGuiHelper())); } @Override @@ -187,6 +188,15 @@ public void register(IModRegistry registry) { registry.addRecipeCatalyst(machine.getStackForm(), oreByProductId); } + //Material Tree + List materialTreeList = new CopyOnWriteArrayList<>(); + for (Material material : MaterialRegistry.MATERIAL_REGISTRY) { + if (material.hasProperty(PropertyKey.DUST)) { + materialTreeList.add(new MaterialTree(material)); + } + } + registry.addRecipes(materialTreeList, GTValues.MODID + ":" + "material_tree"); + //Ore Veins List oreVeins = WorldGenRegistry.getOreDeposits(); List oreInfoList = new CopyOnWriteArrayList<>(); diff --git a/src/main/java/gregtech/integration/jei/recipe/primitive/MaterialTree.java b/src/main/java/gregtech/integration/jei/recipe/primitive/MaterialTree.java new file mode 100644 index 00000000000..46e7e653e29 --- /dev/null +++ b/src/main/java/gregtech/integration/jei/recipe/primitive/MaterialTree.java @@ -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.Material; +import gregtech.api.unification.material.properties.PropertyKey; +import gregtech.api.unification.ore.OrePrefix; +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; +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 { + private final static ImmutableList PREFIXES = ImmutableList.of( + OrePrefix.dustTiny, + OrePrefix.dust, + OrePrefix.dustSmall, + OrePrefix.cableGtSingle, + OrePrefix.ingotHot, + OrePrefix.ingot, + OrePrefix.gem, + OrePrefix.block, + OrePrefix.wireGtSingle, + OrePrefix.stick, + OrePrefix.nugget, + OrePrefix.plate, + OrePrefix.wireFine, + OrePrefix.frameGt, + OrePrefix.round, + OrePrefix.pipeNormalFluid, + OrePrefix.pipeNormalItem, + OrePrefix.screw, + OrePrefix.bolt, + OrePrefix.gear, + OrePrefix.plateDouble, + OrePrefix.spring, + OrePrefix.stickLong, + OrePrefix.gearSmall, + OrePrefix.plateDense, + OrePrefix.springSmall, + OrePrefix.ring, + // fluid, + OrePrefix.lens, + OrePrefix.foil + ); + + private final List> itemInputs = new ArrayList<>(); + private final List> 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(Material material) { + // adding an empty list to itemInputs/fluidInputs makes checking if a prefix exists later much easier + List inputDusts = new ArrayList<>(); + for (OrePrefix prefix : PREFIXES) { + inputDusts.add(OreDictUnifier.get(prefix, material)); + } + for (ItemStack stack : inputDusts) { + List matItemsStack = new ArrayList<>(); + matItemsStack.add(stack); + this.itemInputs.add(matItemsStack); + } + + List matFluidsStack = new ArrayList<>(); + if (material.hasProperty(PropertyKey.FLUID)) { + matFluidsStack.add(material.getFluid(1000)); + } + this.fluidInputs.add(matFluidsStack); + + name = material.getLocalizedName(); + formula = material.getChemicalFormula(); + avgM = material.getAverageMass(); + avgP = material.getAverageProtons(); + avgN = material.getAverageNeutrons(); + if (material.hasProperty(PropertyKey.BLAST)) { + blastTemp = material.getBlastTemperature(); + } else { + blastTemp = 0; + } + } + + @Override + public void getIngredients(IIngredients ingredients) { + ingredients.setInputLists(VanillaTypes.ITEM, this.itemInputs); + ingredients.setInputLists(VanillaTypes.FLUID, this.fluidInputs); + // these don't get displayed, but allow the material tree to show up on left *or* right click + ingredients.setOutputLists(VanillaTypes.ITEM, this.itemInputs); + ingredients.setOutputLists(VanillaTypes.FLUID, this.fluidInputs); + } + + 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; + } +} diff --git a/src/main/java/gregtech/integration/jei/recipe/primitive/MaterialTreeCategory.java b/src/main/java/gregtech/integration/jei/recipe/primitive/MaterialTreeCategory.java new file mode 100644 index 00000000000..0469becd8d1 --- /dev/null +++ b/src/main/java/gregtech/integration/jei/recipe/primitive/MaterialTreeCategory.java @@ -0,0 +1,290 @@ +package gregtech.integration.jei.recipe.primitive; + +import com.google.common.collect.ImmutableList; +import gregtech.api.GTValues; +import gregtech.api.gui.GuiTextures; +import gregtech.api.recipes.recipeproperties.BlastTemperatureProperty; +import gregtech.api.unification.OreDictUnifier; +import gregtech.api.unification.material.Materials; +import gregtech.api.unification.ore.OrePrefix; +import gregtech.integration.jei.utils.render.DrawableRegistry; +import mezz.jei.api.IGuiHelper; +import mezz.jei.api.gui.IDrawable; +import mezz.jei.api.gui.IGuiFluidStackGroup; +import mezz.jei.api.gui.IGuiItemStackGroup; +import mezz.jei.api.gui.IRecipeLayout; +import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.ingredients.VanillaTypes; +import mezz.jei.api.recipe.IRecipeWrapper; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +import javax.annotation.Nullable; +import java.util.List; +import java.util.ArrayList; + +public class MaterialTreeCategory extends PrimitiveRecipeCategory { + + protected String materialName; + protected String materialFormula; + protected int materialBFTemp; + protected String materialAvgM; + protected String materialAvgP; + protected String materialAvgN; + + protected final IDrawable slot; + protected final IDrawable icon; + protected final int FONT_HEIGHT = Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT; + + protected List itemExists = new ArrayList<>(); + protected List fluidExists = new ArrayList<>(); + // XY positions of ingredients + protected final static ImmutableList ITEM_LOCATIONS = ImmutableList.of( + // corresponds pair-to-one with PREFIXES in MaterialTree.java + 4, 67, // dustTiny 0 + 4, 101, // dust + 4, 135, // dustSmall + 29, 55, // cableGtSingle + 29, 85, // ingotHot + 29, 117, // ingot 5 + 29, 117, // gem + 29, 147, // block + 54, 55, // wireGtSingle + 54, 85, // stick + 54, 117, // nugget 10 + 54, 147, // plate + 79, 55, // wireFine + 79, 85, // frameGt + 79, 117, // round + 79, 147, // pipeNormalFluid 15 + 79, 147, // pipeNormalItem + 104, 55, // screw + 104, 85, // bolt + 104, 117, // gear + 104, 147, // plateDouble 20 + 129, 55, // spring + 129, 85, // stickLong + 129, 117, // gearSmall + 129, 147, // plateDense + 154, 55, // springSmall 25 + 154, 78, // ring + 154, 124, // lens + 154, 147 // foil + ); + protected ImmutableList FLUID_LOCATIONS = ImmutableList.of( + 154, 101 // fluid + ); + + public MaterialTreeCategory(IGuiHelper guiHelper) { + super("material_tree", + "recipemap.materialtree.name", + guiHelper.createBlankDrawable(176, 166), + guiHelper); + + this.slot = guiHelper.drawableBuilder(GuiTextures.SLOT.imageLocation, 0, 0, 18, 18).setTextureSize(18, 18).build(); + this.icon = guiHelper.createDrawableIngredient(OreDictUnifier.get(OrePrefix.ingot, Materials.Aluminium)); + + /* couldn't think of a better way to register all these + generated with bash, requires imagemagick and sed + for file in ./*.png; do + dimstring=$(identify -ping -format '%w, %h' "$file") + basename "$file" .png | sed "s/\(.*\)/registerArrow(guiHelper, \"\1\", $dimstring);/" + done + */ + registerArrow(guiHelper, "2d12", 5, 12); + registerArrow(guiHelper, "2d16", 5, 16); + registerArrow(guiHelper, "2r16d37", 18, 40); + registerArrow(guiHelper, "d14", 5, 14); + registerArrow(guiHelper, "d7r25u6", 28, 7); + registerArrow(guiHelper, "d7r50d7", 53, 14); + registerArrow(guiHelper, "d7r50u6", 53, 7); + registerArrow(guiHelper, "d7r75d7", 78, 14); + registerArrow(guiHelper, "d7r75u6", 78, 7); + registerArrow(guiHelper, "d7r87u22r4", 92, 25); + registerArrow(guiHelper, "d7r87u46r4", 92, 49); + registerArrow(guiHelper, "l7", 7, 5); + registerArrow(guiHelper, "r3d16r4", 7, 19); + registerArrow(guiHelper, "r3d26r4", 7, 29); + registerArrow(guiHelper, "r3u15r4", 7, 18); + registerArrow(guiHelper, "r3u32r4", 7, 35); + registerArrow(guiHelper, "r3u57r4", 7, 60); + registerArrow(guiHelper, "r7", 7, 5); + registerArrow(guiHelper, "u12", 5, 12); + registerArrow(guiHelper, "u7r25d6", 28, 7); + registerArrow(guiHelper, "u7r50d6", 53, 7); + registerArrow(guiHelper, "u7r50u5", 53, 12); + registerArrow(guiHelper, "u7r75d6", 78, 7); + registerArrow(guiHelper, "u7r75u5", 78, 12); + registerArrow(guiHelper, "u7r87d15r4", 92, 18); + registerArrow(guiHelper, "u7r87u8r4", 92, 17); + } + + @Override + public void setRecipe(IRecipeLayout recipeLayout, MaterialTree recipeWrapper, IIngredients ingredients) { + // place and check existence of items + IGuiItemStackGroup itemStackGroup = recipeLayout.getItemStacks(); + List> itemInputs = ingredients.getInputs(VanillaTypes.ITEM); + itemExists.clear(); + for (int i = 0; i < ITEM_LOCATIONS.size(); i += 2) { + itemStackGroup.init(i, true, ITEM_LOCATIONS.get(i), ITEM_LOCATIONS.get(i + 1)); + itemExists.add(itemInputs.get(i / 2).size() > 0); + } + itemStackGroup.set(ingredients); + + // place and check existence of fluid(s) + IGuiFluidStackGroup fluidStackGroup = recipeLayout.getFluidStacks(); + List> fluidInputs = ingredients.getInputs(VanillaTypes.FLUID); + fluidExists.clear(); + for (int i = 0; i < FLUID_LOCATIONS.size(); i += 2) { + // fluids annoyingly need to be offset by 1 to fit in the slot graphic + fluidStackGroup.init(0, true, FLUID_LOCATIONS.get(i) + 1, FLUID_LOCATIONS.get(i + 1) + 1); + fluidExists.add(fluidInputs.get(i / 2).size() > 0); + } + fluidStackGroup.set(ingredients); + + // set info of current material + materialName = recipeWrapper.getMaterialName(); + materialFormula = recipeWrapper.getMaterialFormula(); + materialBFTemp = recipeWrapper.getBlastTemp(); + materialAvgM = I18n.format("gregtech.jei.materials.average_mass", recipeWrapper.getAvgM()); + materialAvgP = I18n.format("gregtech.jei.materials.average_protons", recipeWrapper.getAvgP()); + materialAvgN = I18n.format("gregtech.jei.materials.average_neutrons", recipeWrapper.getAvgN()); + } + + @Override + public IRecipeWrapper getRecipeWrapper(MaterialTree recipe) { + return recipe; + } + + @Nullable + @Override + public IDrawable getIcon() { + return icon; + } + + @Override + public void drawExtras(Minecraft minecraft) { + // item slot rendering + for (int i = 0; i < ITEM_LOCATIONS.size(); i += 2) { + if (itemExists.get(i / 2)) + this.slot.draw(minecraft, ITEM_LOCATIONS.get(i), ITEM_LOCATIONS.get(i + 1)); + } + + // fluid slot rendering + for (int i = 0; i < FLUID_LOCATIONS.size(); i += 2) { + if (fluidExists.get(i / 2)) + this.slot.draw(minecraft, FLUID_LOCATIONS.get(i), FLUID_LOCATIONS.get(i + 1)); + } + + // arrow rendering, aka hardcoded jank + // indeces are from ITEM_LOCATIONS / MaterialTree.PREFIXES + // dustTiny <-> dust + drawArrow(minecraft, "2d16", 10, 85, itemExists.get(0) && itemExists.get(1)); + // dust <-> dustSmall + drawArrow(minecraft, "2d16", 10, 119, itemExists.get(1) && itemExists.get(2)); + // dust <-> block (if no ingot or gem) + drawArrow(minecraft, "2r16d37", 22, 107, !itemExists.get(5) && + !itemExists.get(6) && itemExists.get(1) && itemExists.get(7)); + // dust -> ingotHot + drawArrow(minecraft, "r3u15r4", 22, 92, itemExists.get(1) && itemExists.get(4)); + // dust -> ingot/gem (if no ingotHot) + drawArrow(minecraft, "r3d16r4", 22, 109, !itemExists.get(4) && + itemExists.get(1) && (itemExists.get(5) || itemExists.get(6))); + // ingotHot -> ingot + drawArrow(minecraft, "d14", 35, 103, itemExists.get(4) && itemExists.get(5)); + // ingot/gem <-> block + drawArrow(minecraft, "2d12", 35, 135, itemExists.get(7) && + (itemExists.get(5) || itemExists.get(6))); + // ingot -> wireGtSingle + drawArrow(minecraft, "r3u57r4", 47, 66, itemExists.get(5) && itemExists.get(8)); + // ingot/gem -> stick + drawArrow(minecraft, "r3u32r4", 47, 91, itemExists.get(9) && + (itemExists.get(5) || itemExists.get(6))); + // ingot -> nugget + drawArrow(minecraft, "r7", 47, 123, itemExists.get(5) && itemExists.get(10)); + // ingot -> plate + drawArrow(minecraft, "r3d26r4", 47, 125, itemExists.get(5) && itemExists.get(11)); + // block -> plate + drawArrow(minecraft, "r7", 47, 158, itemExists.get(7) && itemExists.get(11)); + // wireGtSingle -> cableGtSingle + drawArrow(minecraft, "l7", 47, 57, itemExists.get(8) && itemExists.get(3)); + // wireGtSingle -> wireFine + drawArrow(minecraft, "r7", 72, 61, itemExists.get(8) && itemExists.get(12)); + // stick -> frameGt + drawArrow(minecraft, "d7r25u6", 62, 103, itemExists.get(9) && itemExists.get(13)); + // stick -> bolt + drawArrow(minecraft, "d7r50u6", 62, 103, itemExists.get(9) && itemExists.get(18)); + // stick -> gear + drawArrow(minecraft, "d7r50d7", 62, 103, itemExists.get(9) && itemExists.get(19)); + // stick -> stickLong + drawArrow(minecraft, "d7r75u6", 62, 103, itemExists.get(9) && itemExists.get(22)); + // stick -> gearSmall + drawArrow(minecraft, "d7r75d7", 62, 103, itemExists.get(9) && itemExists.get(23)); + // stick -> springSmall + drawArrow(minecraft, "d7r87u46r4", 62, 61, itemExists.get(9) && itemExists.get(25)); + // stick -> ring + drawArrow(minecraft, "d7r87u22r4", 62, 85, itemExists.get(9) && itemExists.get(26)); + // nugget -> round + drawArrow(minecraft, "r7", 72, 123, itemExists.get(10) && itemExists.get(14)); + // plate -> pipeNormalFluid/pipeNormalItem + drawArrow(minecraft, "u7r25d6", 62, 140, itemExists.get(11) && + (itemExists.get(15) || itemExists.get(16))); + // plate -> gear + drawArrow(minecraft, "u7r50u5", 62, 135, itemExists.get(11) && itemExists.get(19)); + // plate -> plateDouble + drawArrow(minecraft, "u7r50d6", 62, 140, itemExists.get(11) && itemExists.get(20)); + // plate -> gearSmall + drawArrow(minecraft, "u7r75u5", 62, 135, itemExists.get(11) && itemExists.get(23)); + // plate -> plateDense + drawArrow(minecraft, "u7r75d6", 62, 140, itemExists.get(11) && itemExists.get(24)); + // plate -> lens + drawArrow(minecraft, "u7r87u8r4", 62, 130, itemExists.get(11) && itemExists.get(27)); + // plate -> foil + drawArrow(minecraft, "u7r87d15r4", 62, 140, itemExists.get(11) && itemExists.get(28)); + // bolt -> screw + drawArrow(minecraft, "u12", 110, 73, itemExists.get(18) && itemExists.get(17)); + // stickLong -> spring + drawArrow(minecraft, "u12", 135, 73, itemExists.get(22) && itemExists.get(21)); + + // material info rendering + int linesDrawn = 0; + if (minecraft.fontRenderer.getStringWidth(materialName) > 176) { + minecraft.fontRenderer.drawString(minecraft.fontRenderer.trimStringToWidth(materialName, 171) + "...", + 0, 0, 0x111111); + linesDrawn++; + } else if (materialName.length() != 0) { + minecraft.fontRenderer.drawString(materialName, 0, 0, 0x111111); + linesDrawn++; + } + if (minecraft.fontRenderer.getStringWidth(materialFormula) > 176) { + minecraft.fontRenderer.drawString(minecraft.fontRenderer.trimStringToWidth(materialFormula, 171) + "...", + 0, FONT_HEIGHT * linesDrawn, 0x111111); + linesDrawn++; + } else if (materialFormula.length() != 0) { + minecraft.fontRenderer.drawString(materialFormula, 0, FONT_HEIGHT * linesDrawn, 0x111111); + linesDrawn++; + } + // don't think theres a good way to get the coil tier other than this + if (materialBFTemp != 0) { + BlastTemperatureProperty.getInstance().drawInfo(minecraft, 0, FONT_HEIGHT * linesDrawn, 0x111111, materialBFTemp); + linesDrawn++; + } + minecraft.fontRenderer.drawString(materialAvgM, 0, FONT_HEIGHT * linesDrawn, 0x111111); + linesDrawn++; + minecraft.fontRenderer.drawString(materialAvgN, 0, FONT_HEIGHT * linesDrawn, 0x111111); + linesDrawn++; + minecraft.fontRenderer.drawString(materialAvgP, 0, FONT_HEIGHT * linesDrawn, 0x111111); + } + + // a couple wrappers to make the code look less terrible + private void registerArrow(IGuiHelper guiHelper, String name, int width, int height) { + DrawableRegistry.initDrawable(guiHelper, GTValues.MODID + ":textures/gui/arrows/" + name + ".png", width, height, name); + } + + private void drawArrow(Minecraft minecraft, String name, int x, int y, boolean shown) { + if (shown) + DrawableRegistry.drawDrawable(minecraft, name, x, y); + } +} diff --git a/src/main/java/gregtech/integration/jei/utils/render/DrawableRegistry.java b/src/main/java/gregtech/integration/jei/utils/render/DrawableRegistry.java new file mode 100644 index 00000000000..8d5cf5d12c2 --- /dev/null +++ b/src/main/java/gregtech/integration/jei/utils/render/DrawableRegistry.java @@ -0,0 +1,24 @@ +package gregtech.integration.jei.utils.render; + +import mezz.jei.api.IGuiHelper; +import mezz.jei.api.gui.IDrawable; +import net.minecraft.client.Minecraft; +import net.minecraft.util.ResourceLocation; + +import java.util.Map; +import java.util.HashMap; + +/** + * HashMap of IDrawables for JEI rendering + */ +public class DrawableRegistry { + private static final Map drawableMap = new HashMap<>(); + + public static void initDrawable(IGuiHelper guiHelper, String textureLocation, int width, int height, String key) { + drawableMap.put(key, guiHelper.drawableBuilder(new ResourceLocation(textureLocation), 0, 0, width, height).setTextureSize(width, height).build()); + } + + public static void drawDrawable(Minecraft minecraft, String key, int x, int y) { + drawableMap.get(key).draw(minecraft, x, y); + } +} diff --git a/src/main/resources/assets/gregtech/lang/en_us.lang b/src/main/resources/assets/gregtech/lang/en_us.lang index 435de4c0cd6..2b17ba266c1 100644 --- a/src/main/resources/assets/gregtech/lang/en_us.lang +++ b/src/main/resources/assets/gregtech/lang/en_us.lang @@ -1957,6 +1957,7 @@ recipemap.semi_fluid_generator.name=Semi Fluid Fuels recipemap.plasma_generator.name=Plasma Generator recipemap.circuit_assembler.name=Circuit Assembler recipemap.mass_fabricator.name=Mass Fabricator +recipemap.materialtree.name=Material Tree recipemap.gas_collector.name=Gas Collector recipemap.primitive_blast_furnace.name=Primitive Blast Furnace recipemap.coke_oven.name=Coke Oven @@ -3641,6 +3642,10 @@ gregtech.jei.ore.surface_rock_2=They can be broken for 3 Tiny Piles of the dust, gregtech.jei.ore.biome_weighting=%s Weight: %d gregtech.jei.ore.biome_weighting_no_spawn=%s Weight: Cannot Spawn +gregtech.jei.materials.average_mass=Average mass: %,d +gregtech.jei.materials.average_protons=Average protons: %,d +gregtech.jei.materials.average_neutrons=Average neutrons: %,d + gregtech.item_filter.empty_item=Empty (No Item) gregtech.item_filter.footer=§eClick with item to override diff --git a/src/main/resources/assets/gregtech/textures/gui/arrows/2d12.png b/src/main/resources/assets/gregtech/textures/gui/arrows/2d12.png new file mode 100644 index 0000000000000000000000000000000000000000..01de41f761d672cd197306379f1843606f2b22ef GIT binary patch literal 115 zcmeAS@N?(olHy`uVBq!ia0vp^tU%1e!3HE(C6wy|Db50q$YLN30*nkTmEs_ds;7%% zNX4Awga#%@$AkZQPB5r29F}0x5Q^A(*;Qcq#v#vq&N#aB8!1E2rx3VREmQ*Zk{fV zAr*7pUNhukFyL^$7<2Hq{I;bR9t2sfc+AhCXJ@2!*X2l%IeVtF+bZKrFDi}MLYY{g jV9J5-tZS0ih8^3JKU2tebF`&^KFDlOS3j3^P6MO`FPgg&ebxsLQ0LMKfrvLx| literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/gui/arrows/d7r50u6.png b/src/main/resources/assets/gregtech/textures/gui/arrows/d7r50u6.png new file mode 100644 index 0000000000000000000000000000000000000000..3bb3fb7d71174b8872e83a5d17ad59870a3bfb51 GIT binary patch literal 131 zcmeAS@N?(olHy`uVBq!ia0vp^ra;Wj!3HE(gs@%%Qk(@Ik;On71Q;1wD#bw@Q%@Ji zkcv6U0wN-R&KvMBblJBxFL$VGNZfINVRxre!yCmN$J=%-Pe{0-YA+xmIZsMY;+Z;w X#Py)+lkDqnfQ<5V^>bP0l+XkKhcqNt literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/gui/arrows/d7r75d7.png b/src/main/resources/assets/gregtech/textures/gui/arrows/d7r75d7.png new file mode 100644 index 0000000000000000000000000000000000000000..aecdd695f52275e2fd2671c70c1cf209b5d5581c GIT binary patch literal 149 zcmeAS@N?(olHy`uVBq!ia0vp^en8B}!3HE7KWP;LDb50q$YLN30*nkTmEs_dyQhm| zNX4ADS2uDp7;vx#h8O%#RDKzBY%@n=^#^eaZe`=}73T{kJXARB*w)O${SG{Pkiyi{ gAbs>ma>Ncs20fvISb^fpUqEJhy85}Sb4q9e0Pm$H*#H0l literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/gui/arrows/d7r87u22r4.png b/src/main/resources/assets/gregtech/textures/gui/arrows/d7r87u22r4.png new file mode 100644 index 0000000000000000000000000000000000000000..55cae69f6f1c1694f05d952157306d1da48d5db0 GIT binary patch literal 189 zcmeAS@N?(olHy`uVBq!ia0vp^F+eQI!3HGvRC%@oDb50q$YLN30*nkTmEs^yzNd?0 zNX4AD7dLVqFyLVgT)*INd#OjFfSP70({H{y{dvbWd{Rm(yI&BhzvG1ix7GUJ%N9o; zNODg7@Gg3tM~210hb-;FGJXZc6BRpOGT-G@yGywp@K|-ql literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/gui/arrows/d7r87u46r4.png b/src/main/resources/assets/gregtech/textures/gui/arrows/d7r87u46r4.png new file mode 100644 index 0000000000000000000000000000000000000000..458f0b05b42949935bb351b3c83d4068d194e047 GIT binary patch literal 241 zcmeAS@N?(olHy`uVBq!ia0vp^F+gm{!3HG5ThHAAQk(@Ik;On71Q;1wD#byZ#hxyX zAr*7pUUcL-Y#_kmSnv41evLC9TjHd}Q3>IP?@Yh-_`;`S63^dB$6Xbdsk*>woB!Rn z{~c4CtZDQ6eNROj`TIAcHA0(bli;v>Wn2L0yFdtLVZAA_LE VX5XEncP@b(?&<31vd$@?2>?u_S#_E)Q!3HEdXMMW?q&N#aB8!1E2rx3VREmQ*a-J@Z zAr*6y6B?Kt9S{EJxxwJUv|7c7N&47&;rVkJsvG&c`6gwgf%JH~`njxgN@xNAnIReZ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/gui/arrows/r3d16r4.png b/src/main/resources/assets/gregtech/textures/gui/arrows/r3d16r4.png new file mode 100644 index 0000000000000000000000000000000000000000..9ae92750312c030b05acd470b1b419336520ce47 GIT binary patch literal 116 zcmeAS@N?(olHy`uVBq!ia0vp^>_9Bc!3HE_M8)HP6lZ})WHFEi0Y-+FN^uZJ&C|s( zq+(98fQZN+{=+;w4y<^>;GGoOqSLvM!7{G!nEt&E_h}3ale(2wmoH-D0O|E~^>bP0 Hl+XkK0Tmnd literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/gui/arrows/r3d26r4.png b/src/main/resources/assets/gregtech/textures/gui/arrows/r3d26r4.png new file mode 100644 index 0000000000000000000000000000000000000000..b5eb9ae95eed21502a80b7003f67831f0c2ed3fd GIT binary patch literal 118 zcmeAS@N?(olHy`uVBq!ia0vp^>_9Bb!3HGL_9BU!3HF!dmi}>q&N#aB8!1E2rx3VREmQ*+MX_s zAr*6y6C9YEnwtJ!JQ|>4C~|;hqG4O1Md_n0lNUI_Du{!3HEF@&!HvDb50q$YLN30*nkTmEs_dzNd?0 zNX4Aw1PA7(rl$WFj|Qk1iX32>XxLV0QTk}h_BY8!3HE(y2>S5MX3zsT2osj6Gc( zLn`JZCpa)SH8uUecr-x8P~-s1M8md1i_%A1CNFSyQ+0>I2`bmT*ti%HZUnE@oU()w OWRRz;pUXO@geCxhwIYQ8 literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/gui/arrows/r7.png b/src/main/resources/assets/gregtech/textures/gui/arrows/r7.png new file mode 100644 index 0000000000000000000000000000000000000000..601cca74151ee746a34ac1145d1aa5952b58cf2f GIT binary patch literal 108 zcmeAS@N?(olHy`uVBq!ia0vp^>_E)Q!3HEdXMMW?q&N#aB8!1E2rx3VREmQ*a-J@Z yAr*6y6C9YEnwtJ!JQ|?#kSjqZM`FKUO&Jq|J|lm(K!4M3kRDH0KbLh*2~7aC{u-+Q literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/gui/arrows/u12.png b/src/main/resources/assets/gregtech/textures/gui/arrows/u12.png new file mode 100644 index 0000000000000000000000000000000000000000..fbdc56b120d35a38621e0aadd58bf8938fbd1ae6 GIT binary patch literal 108 zcmeAS@N?(olHy`uVBq!ia0vp^tU%1e!3HE(C6wy|Db50q$YLN30*nkTmEs_doTrOp yNX4Awga#%@$AkZQPB5r29F}0x5Q^B!&*;c-;E8B!Re<;*kRDH0KbLh*2~7YVU>Dl} literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/gui/arrows/u7r25d6.png b/src/main/resources/assets/gregtech/textures/gui/arrows/u7r25d6.png new file mode 100644 index 0000000000000000000000000000000000000000..ca73d554fb5a30171fb093fd006495a91119608b GIT binary patch literal 115 zcmeAS@N?(olHy`uVBq!ia0vp^GC<7E!3HFyWpvK~Db50q$YLN30*nkTmEs_ds;7%% zNX49F0TGcu{`_Ycm^Eai8UwjkW(m5*T)NdR!P$P#k&D5$)nw+EtNt1wt)8xaF6*2U FngFIj8aV&} literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/gui/arrows/u7r50d6.png b/src/main/resources/assets/gregtech/textures/gui/arrows/u7r50d6.png new file mode 100644 index 0000000000000000000000000000000000000000..fbb46d963e6262936ccc38598b444171e9507f0c GIT binary patch literal 124 zcmeAS@N?(olHy`uVBq!ia0vp^ra;Wj!3HE(gs@%%Qk(@Ik;On71Q;1wD#bw@Jx>?M zkcv6U0wN-R>|+d=c@`A38AyD+62N%)RB*)SYXRRyI1)s}4j&9wXn4cVu*5#7+MrVL PH^>Z6S3j3^P6aiP#X#Y^U?TfF{q8i4;_p{$4_m0;iv6yeyys$vy21>N smecnp{GA@|BKy##MOe_!#X|6*iS%>vd~HLot^|zopr0E87TCjbBd literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/gregtech/textures/gui/arrows/u7r87d15r4.png b/src/main/resources/assets/gregtech/textures/gui/arrows/u7r87d15r4.png new file mode 100644 index 0000000000000000000000000000000000000000..18ff831765e09475034542c660f783e675c3fd4b GIT binary patch literal 164 zcmeAS@N?(olHy`uVBq!ia0vp^F+eQD!3HF+?cM1Dq&N#aB8!1E2rx3VREmQ*VV*9I zAr*7p-dM=***;3bNAE)z4*} HQ$iB}PtZ9| literal 0 HcmV?d00001