aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtneioreplugin/plugin/gregtech5
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtneioreplugin/plugin/gregtech5')
-rw-r--r--src/main/java/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java65
-rw-r--r--src/main/java/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java208
-rw-r--r--src/main/java/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java168
-rw-r--r--src/main/java/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java212
4 files changed, 653 insertions, 0 deletions
diff --git a/src/main/java/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java b/src/main/java/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java
new file mode 100644
index 0000000000..86117f099a
--- /dev/null
+++ b/src/main/java/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java
@@ -0,0 +1,65 @@
+package gtneioreplugin.plugin.gregtech5;
+
+import net.minecraft.client.resources.I18n;
+
+import codechicken.lib.gui.GuiDraw;
+import gregtech.api.GregTechAPI;
+import gregtech.api.enums.Materials;
+import gregtech.api.util.GTLanguageManager;
+import gtneioreplugin.plugin.PluginBase;
+
+public abstract class PluginGT5Base extends PluginBase {
+
+ protected static String getLocalizedNameForItem(Materials aMaterial, String aFormat) {
+ return String.format(
+ aFormat.replace("%s", "%temp")
+ .replace("%material", "%s"),
+ aMaterial.mLocalizedName)
+ .replace("%temp", "%s");
+ }
+
+ protected static String getLocalizedNameForItem(String aFormat, int aMaterialID) {
+ if (aMaterialID >= 0 && aMaterialID < 1000) {
+ Materials aMaterial = GregTechAPI.sGeneratedMaterials[aMaterialID];
+ if (aMaterial != null) {
+ return getLocalizedNameForItem(aMaterial, aFormat);
+ }
+ }
+ return aFormat;
+ }
+
+ public static String getGTOreLocalizedName(short index) {
+
+ if (!getLocalizedNameForItem(GTLanguageManager.getTranslation(getGTOreUnlocalizedName(index)), index % 1000)
+ .contains("Awakened"))
+ return getLocalizedNameForItem(
+ GTLanguageManager.getTranslation(getGTOreUnlocalizedName(index)),
+ index % 1000);
+ else return "Aw. Draconium Ore";
+ }
+
+ protected static String getGTOreUnlocalizedName(short index) {
+ return "gt.blockores." + index + ".name";
+ }
+
+ static void drawLine(String lineKey, String value, int x, int y) {
+ GuiDraw.drawString(I18n.format(lineKey) + ": " + value, x, y, 0x404040, false);
+ }
+
+ protected int getMaximumMaterialIndex(short meta, boolean smallOre) {
+ int offset = smallOre ? 16000 : 0;
+ if (!getGTOreLocalizedName((short) (meta + offset + 5000))
+ .equals(getGTOreUnlocalizedName((short) (meta + offset + 5000)))) return 7;
+ else if (!getGTOreLocalizedName((short) (meta + offset + 5000))
+ .equals(getGTOreUnlocalizedName((short) (meta + offset + 5000)))) return 6;
+ else return 5;
+ }
+
+ /**
+ * Draw the dimension header and the dimension names over up to 3 lines
+ *
+ */
+ protected void drawDimNames() {
+ GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 100, 0x404040, false);
+ }
+}
diff --git a/src/main/java/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java b/src/main/java/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java
new file mode 100644
index 0000000000..fb5b298b7b
--- /dev/null
+++ b/src/main/java/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java
@@ -0,0 +1,208 @@
+package gtneioreplugin.plugin.gregtech5;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+
+import net.minecraft.client.resources.I18n;
+import net.minecraft.item.ItemStack;
+
+import codechicken.nei.PositionedStack;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.util.GTOreDictUnificator;
+import gtneioreplugin.plugin.item.ItemDimensionDisplay;
+import gtneioreplugin.util.DimensionHelper;
+import gtneioreplugin.util.GT5OreSmallHelper;
+import gtneioreplugin.util.GT5OreSmallHelper.OreSmallWrapper;
+
+public class PluginGT5SmallOreStat extends PluginGT5Base {
+
+ private static final int SMALL_ORE_BASE_META = 16000;
+
+ @Override
+ public void drawExtras(int recipe) {
+ OreSmallWrapper oreSmall = getSmallOre(recipe);
+
+ drawSmallOreName(oreSmall);
+ drawSmallOreInfo(oreSmall);
+
+ drawDimNames();
+
+ drawSeeAllRecipesLabel();
+ }
+
+ private void drawSmallOreName(OreSmallWrapper oreSmall) {
+ String oreName = getGTOreLocalizedName((short) (oreSmall.oreMeta + SMALL_ORE_BASE_META));
+ drawLine("gtnop.gui.nei.oreName", oreName, 2, 18);
+ }
+
+ private void drawSmallOreInfo(OreSmallWrapper oreSmall) {
+ drawLine("gtnop.gui.nei.genHeight", oreSmall.worldGenHeightRange, 2, 31);
+ drawLine("gtnop.gui.nei.amount", String.valueOf(oreSmall.amountPerChunk), 2, 44);
+ drawLine("gtnop.gui.nei.chanceDrops", "", 2, 83 + getRestrictBiomeOffset());
+ drawLine("gtnop.gui.nei.worldNames", "", 2, 100);
+ }
+
+ private OreSmallWrapper getSmallOre(int recipe) {
+ CachedOreSmallRecipe crecipe = (CachedOreSmallRecipe) this.arecipes.get(recipe);
+ return GT5OreSmallHelper.mapOreSmallWrapper.get(crecipe.oreGenName);
+ }
+
+ public int getRestrictBiomeOffset() {
+ return GT5OreSmallHelper.restrictBiomeSupport ? 0 : -13;
+ }
+
+ @Override
+ public void loadCraftingRecipes(String outputId, Object... results) {
+ if (outputId.equals(getOutputId()))
+ for (ItemStack stack : GT5OreSmallHelper.oreSmallList) loadCraftingRecipes(stack);
+ else super.loadCraftingRecipes(outputId, results);
+ }
+
+ @Override
+ public void loadCraftingRecipes(ItemStack stack) {
+ if (stack.getUnlocalizedName()
+ .startsWith("gt.blockores")) {
+ short oreMeta = (short) (stack.getItemDamage() % 1000);
+ loadSmallOre(oreMeta, getMaximumMaterialIndex(oreMeta, true));
+ } else if (GT5OreSmallHelper.mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) {
+ short oreMeta = GT5OreSmallHelper.mapOreDropUnlocalizedNameToOreMeta.get(stack.getUnlocalizedName());
+ loadSmallOre(oreMeta, 7);
+ } else super.loadCraftingRecipes(stack);
+ }
+
+ @Override
+ public void loadUsageRecipes(ItemStack stack) {
+ String dimension = ItemDimensionDisplay.getDimension(stack);
+ if (dimension == null) {
+ return;
+ }
+
+ for (OreSmallWrapper oreVein : GT5OreSmallHelper.mapOreSmallWrapper.values()) {
+ if (Arrays.asList(getDimNameArrayFromVeinName(oreVein.oreGenName))
+ .contains(dimension)) {
+ addSmallOre(oreVein, 7);
+ }
+ }
+ }
+
+ private void loadSmallOre(short oreMeta, int maximumIndex) {
+ OreSmallWrapper smallOre = getSmallOre(oreMeta);
+ if (smallOre != null) {
+ addSmallOre(smallOre, maximumIndex);
+ }
+ }
+
+ private OreSmallWrapper getSmallOre(short oreMeta) {
+ for (OreSmallWrapper oreSmallWorldGen : GT5OreSmallHelper.mapOreSmallWrapper.values()) {
+ if (oreSmallWorldGen.oreMeta == oreMeta) {
+ return oreSmallWorldGen;
+ }
+ }
+ return null;
+ }
+
+ private void addSmallOre(OreSmallWrapper smallOre, int maximumIndex) {
+ this.arecipes.add(
+ new CachedOreSmallRecipe(
+ smallOre.oreGenName,
+ smallOre.getMaterialDrops(maximumIndex),
+ getStoneDusts(maximumIndex),
+ GT5OreSmallHelper.mapOreMetaToOreDrops.get(smallOre.oreMeta)));
+ }
+
+ private List<ItemStack> getStoneDusts(int maximumIndex) {
+ List<ItemStack> materialDustStackList = new ArrayList<>();
+ for (int i = 0; i < maximumIndex; i++) materialDustStackList
+ .add(GTOreDictUnificator.get(OrePrefixes.dust, GT5OreSmallHelper.getDroppedDusts()[i], 1L));
+ return materialDustStackList;
+ }
+
+ @Override
+ public String getOutputId() {
+ return "GTOrePluginOreSmall";
+ }
+
+ @Override
+ public String getRecipeName() {
+ return I18n.format("gtnop.gui.smallOreStat.name");
+ }
+
+ private String[] getDimNameArrayFromVeinName(String veinName) {
+ OreSmallWrapper oreSmall = GT5OreSmallHelper.mapOreSmallWrapper.get(veinName);
+ String[] dims = GT5OreSmallHelper.bufferedDims.get(oreSmall)
+ .keySet()
+ .toArray(new String[0]);
+ Arrays.sort(
+ dims,
+ Comparator.comparingInt(
+ s -> Arrays.asList(DimensionHelper.DimNameDisplayed)
+ .indexOf(s)));
+ return dims;
+ }
+
+ public class CachedOreSmallRecipe extends CachedRecipe {
+
+ public final String oreGenName;
+ public final PositionedStack positionedStackOreSmall;
+ public final PositionedStack positionedStackMaterialDust;
+ public final List<PositionedStack> positionedDropStackList;
+ private final List<PositionedStack> dimensionDisplayItems = new ArrayList<>();
+
+ public CachedOreSmallRecipe(String oreGenName, List<ItemStack> stackList, List<ItemStack> materialDustStackList,
+ List<ItemStack> dropStackList) {
+ this.oreGenName = oreGenName;
+ this.positionedStackOreSmall = new PositionedStack(stackList, 2, 0);
+ this.positionedStackMaterialDust = new PositionedStack(
+ materialDustStackList,
+ 43,
+ 79 + getRestrictBiomeOffset());
+ List<PositionedStack> positionedDropStackList = new ArrayList<>();
+ int i = 1;
+ for (ItemStack stackDrop : dropStackList) positionedDropStackList.add(
+ new PositionedStack(stackDrop, 43 + 20 * (i % 4), 79 + 16 * ((i++) / 4) + getRestrictBiomeOffset()));
+ this.positionedDropStackList = positionedDropStackList;
+ setDimensionDisplayItems();
+ }
+
+ private void setDimensionDisplayItems() {
+ int x = 2;
+ int y = 110;
+ int count = 0;
+ int itemsPerLine = 9;
+ int itemSize = 18;
+ for (String dim : getDimNameArrayFromVeinName(this.oreGenName)) {
+ ItemStack item = ItemDimensionDisplay.getItem(dim);
+ if (item != null) {
+ int xPos = x + itemSize * (count % itemsPerLine);
+ int yPos = y + itemSize * (count / itemsPerLine);
+ dimensionDisplayItems.add(new PositionedStack(item, xPos, yPos, false));
+ count++;
+ }
+ }
+ }
+
+ @Override
+ public List<PositionedStack> getIngredients() {
+ return dimensionDisplayItems;
+ }
+
+ @Override
+ public PositionedStack getResult() {
+ return null;
+ }
+
+ @Override
+ public List<PositionedStack> getOtherStacks() {
+ List<PositionedStack> outputs = new ArrayList<>();
+ positionedStackOreSmall.setPermutationToRender((cycleticks / 20) % positionedStackOreSmall.items.length);
+ positionedStackMaterialDust
+ .setPermutationToRender((cycleticks / 20) % positionedStackMaterialDust.items.length);
+ outputs.add(positionedStackOreSmall);
+ outputs.add(positionedStackMaterialDust);
+ outputs.addAll(positionedDropStackList);
+ return outputs;
+ }
+ }
+}
diff --git a/src/main/java/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java b/src/main/java/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java
new file mode 100644
index 0000000000..bd1bbf0a00
--- /dev/null
+++ b/src/main/java/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java
@@ -0,0 +1,168 @@
+package gtneioreplugin.plugin.gregtech5;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import net.minecraft.client.resources.I18n;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+
+import codechicken.lib.gui.GuiDraw;
+import codechicken.nei.PositionedStack;
+import gregtech.api.util.GTUtility;
+import gtneioreplugin.plugin.PluginBase;
+import gtneioreplugin.plugin.item.ItemDimensionDisplay;
+import gtneioreplugin.util.GT5UndergroundFluidHelper;
+import gtneioreplugin.util.GT5UndergroundFluidHelper.UndergroundFluidWrapper;
+
+public class PluginGT5UndergroundFluid extends PluginBase {
+
+ private static final int lineSpace = 20;
+ private static final int xDimensionDisplay = 30;
+ private static final int halfItemLength = 16 / 2;
+ private static final DecimalFormat format = new DecimalFormat("0.#");
+
+ @Override
+ public void loadCraftingRecipes(String outputId, Object... results) {
+ if (outputId.equals(getOutputId())) {
+ for (Map.Entry<String, List<UndergroundFluidWrapper>> entry : GT5UndergroundFluidHelper.getAllEntries()
+ .entrySet()) {
+ Fluid fluid = FluidRegistry.getFluid(entry.getKey());
+ if (fluid != null) {
+ this.arecipes.add(new CachedUndergroundFluidRecipe(fluid, entry.getValue()));
+ }
+ }
+ } else {
+ super.loadCraftingRecipes(outputId, results);
+ }
+ }
+
+ @Override
+ public void loadCraftingRecipes(ItemStack result) {
+ Fluid fluid = null;
+ FluidStack containerFluid = GTUtility.getFluidForFilledItem(result, true);
+ if (containerFluid != null) {
+ fluid = containerFluid.getFluid();
+ }
+ if (fluid == null) {
+ FluidStack displayFluid = GTUtility.getFluidFromDisplayStack(result);
+ if (displayFluid != null) {
+ fluid = displayFluid.getFluid();
+ }
+ }
+ if (fluid == null) return;
+
+ List<UndergroundFluidWrapper> wrappers = GT5UndergroundFluidHelper.getEntry(fluid.getName());
+ if (wrappers != null) {
+ this.arecipes.add(new CachedUndergroundFluidRecipe(fluid, wrappers));
+ }
+ }
+
+ @Override
+ public void loadUsageRecipes(ItemStack ingredient) {
+ String dimension = ItemDimensionDisplay.getDimension(ingredient);
+ if (dimension != null) {
+ for (Map.Entry<String, List<UndergroundFluidWrapper>> entry : GT5UndergroundFluidHelper.getAllEntries()
+ .entrySet()) {
+ boolean found = false;
+ for (UndergroundFluidWrapper wrapper : entry.getValue()) {
+ if (wrapper.dimension.equals(dimension)) {
+ found = true;
+ break;
+ }
+ }
+ if (found) {
+ Fluid fluid = FluidRegistry.getFluid(entry.getKey());
+ if (fluid != null) {
+ this.arecipes.add(new CachedUndergroundFluidRecipe(fluid, entry.getValue()));
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void drawExtras(int recipeIndex) {
+ drawSeeAllRecipesLabel();
+
+ int xChance = 85;
+ int xAmount = 140;
+ int yHeader = 30;
+ int black = 0x404040;
+
+ GuiDraw.drawStringC(I18n.format("gtnop.gui.nei.dimension") + ":", xDimensionDisplay, yHeader, black, false);
+ GuiDraw.drawStringC(I18n.format("gtnop.gui.nei.chance") + ":", xChance, yHeader, black, false);
+ GuiDraw.drawStringC(I18n.format("gtnop.gui.nei.fluidAmount") + ":", xAmount, yHeader, black, false);
+
+ int y = 50;
+ CachedUndergroundFluidRecipe recipe = (CachedUndergroundFluidRecipe) this.arecipes.get(recipeIndex);
+ for (int i = 0; i < recipe.dimensionDisplayItems.size(); i++) {
+ GuiDraw.drawStringC(format.format((double) recipe.chances.get(i) / 100) + "%", xChance, y, black, false);
+ GuiDraw.drawStringC(
+ recipe.minAmounts.get(i)
+ .toString() + "-"
+ + recipe.maxAmounts.get(i)
+ .toString(),
+ xAmount,
+ y,
+ black,
+ false);
+ y += lineSpace;
+ }
+ }
+
+ @Override
+ public String getOutputId() {
+ return "GTOrePluginUndergroundFluid";
+ }
+
+ @Override
+ public String getRecipeName() {
+ return I18n.format("gtnop.gui.undergroundFluid.name");
+ }
+
+ private class CachedUndergroundFluidRecipe extends CachedRecipe {
+
+ private final PositionedStack targetFluidDisplay;
+ private final List<PositionedStack> dimensionDisplayItems = new ArrayList<>();
+ private final List<Integer> chances = new ArrayList<>();
+ private final List<Integer> maxAmounts = new ArrayList<>();
+ private final List<Integer> minAmounts = new ArrayList<>();
+
+ private CachedUndergroundFluidRecipe(Fluid fluid, List<UndergroundFluidWrapper> wrappers) {
+ targetFluidDisplay = new PositionedStack(
+ GTUtility.getFluidDisplayStack(fluid),
+ getGuiWidth() / 2 - halfItemLength,
+ 3);
+ int y = 50 - halfItemLength;
+ for (UndergroundFluidWrapper wrapper : wrappers) {
+ ItemStack dimensionDisplay = ItemDimensionDisplay.getItem(wrapper.dimension);
+ if (dimensionDisplay != null) {
+ dimensionDisplayItems.add(
+ new PositionedStack(
+ dimensionDisplay,
+ xDimensionDisplay - halfItemLength,
+ y + GuiDraw.fontRenderer.FONT_HEIGHT / 2));
+ y += lineSpace;
+ chances.add(wrapper.chance);
+ maxAmounts.add(wrapper.maxAmount);
+ minAmounts.add(wrapper.minAmount);
+ }
+ }
+ }
+
+ @Override
+ public PositionedStack getResult() {
+ return targetFluidDisplay;
+ }
+
+ @Override
+ public List<PositionedStack> getIngredients() {
+ return dimensionDisplayItems;
+ }
+ }
+}
diff --git a/src/main/java/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java b/src/main/java/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java
new file mode 100644
index 0000000000..954ac32242
--- /dev/null
+++ b/src/main/java/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java
@@ -0,0 +1,212 @@
+package gtneioreplugin.plugin.gregtech5;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.List;
+
+import net.minecraft.client.resources.I18n;
+import net.minecraft.item.ItemStack;
+
+import codechicken.nei.PositionedStack;
+import cpw.mods.fml.common.Loader;
+import gtneioreplugin.plugin.item.ItemDimensionDisplay;
+import gtneioreplugin.util.DimensionHelper;
+import gtneioreplugin.util.GT5OreLayerHelper;
+import gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper;
+import gtneioreplugin.util.OreVeinLayer;
+
+public class PluginGT5VeinStat extends PluginGT5Base {
+
+ @Override
+ public void loadCraftingRecipes(String outputId, Object... results) {
+ if (outputId.equals(getOutputId())) {
+ for (OreLayerWrapper oreVein : getAllVeins()) {
+ addVeinWithLayers(oreVein, 7);
+ }
+ } else super.loadCraftingRecipes(outputId, results);
+ }
+
+ @Override
+ public void loadCraftingRecipes(ItemStack stack) {
+ if (stack.getUnlocalizedName()
+ .startsWith("gt.blockores")) {
+ loadMatchingVeins((short) (stack.getItemDamage() % 1000));
+ } else super.loadCraftingRecipes(stack);
+ }
+
+ private void loadMatchingVeins(short oreId) {
+ for (OreLayerWrapper oreVein : getAllVeins()) {
+ if (oreVein.containsOre(oreId)) {
+ addVeinWithLayers(oreVein, getMaximumMaterialIndex(oreId, false));
+ }
+ }
+ }
+
+ @Override
+ public void loadUsageRecipes(ItemStack stack) {
+ String dimension = ItemDimensionDisplay.getDimension(stack);
+ if (dimension == null) {
+ return;
+ }
+
+ for (OreLayerWrapper oreVein : getAllVeins()) {
+ if (Arrays.asList(getDimNameArrayFromVeinName(oreVein.veinName))
+ .contains(dimension)) {
+ addVeinWithLayers(oreVein, getMaximumMaterialIndex((short) (stack.getItemDamage() % 1000), false));
+ }
+ }
+ }
+
+ private void addVeinWithLayers(OreLayerWrapper oreVein, int maximumMaterialIndex) {
+ this.arecipes.add(
+ new CachedVeinStatRecipe(
+ oreVein.veinName,
+ oreVein.getVeinLayerOre(maximumMaterialIndex, OreVeinLayer.VEIN_PRIMARY),
+ oreVein.getVeinLayerOre(maximumMaterialIndex, OreVeinLayer.VEIN_SECONDARY),
+ oreVein.getVeinLayerOre(maximumMaterialIndex, OreVeinLayer.VEIN_BETWEEN),
+ oreVein.getVeinLayerOre(maximumMaterialIndex, OreVeinLayer.VEIN_SPORADIC)));
+ }
+
+ private Collection<OreLayerWrapper> getAllVeins() {
+ return GT5OreLayerHelper.mapOreLayerWrapper.values();
+ }
+
+ @Override
+ public void drawExtras(int recipe) {
+ OreLayerWrapper oreLayer = getOreLayer(recipe);
+
+ drawVeinName(oreLayer);
+ drawVeinLayerNames(oreLayer);
+ drawVeinInfo(oreLayer);
+
+ drawDimNames();
+
+ drawSeeAllRecipesLabel();
+ }
+
+ private OreLayerWrapper getOreLayer(int recipe) {
+ CachedVeinStatRecipe crecipe = (CachedVeinStatRecipe) this.arecipes.get(recipe);
+ return GT5OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName);
+ }
+
+ private static void drawVeinName(OreLayerWrapper oreLayer) {
+ if (Loader.isModLoaded("visualprospecting")) {
+ drawVeinNameLine(I18n.format(oreLayer.veinName) + " ");
+ } else {
+ String veinName = getGTOreLocalizedName(oreLayer.Meta[OreVeinLayer.VEIN_PRIMARY]);
+ if (veinName.contains("Ore")) drawVeinNameLine(veinName.split("Ore")[0]);
+ else if (veinName.contains("Sand")) drawVeinNameLine(veinName.split("Sand")[0]);
+ else drawVeinNameLine(veinName + " ");
+ }
+ }
+
+ private static void drawVeinNameLine(String veinName) {
+ drawLine("gtnop.gui.nei.veinName", veinName + I18n.format("gtnop.gui" + ".nei.vein"), 2, 20);
+ }
+
+ private static void drawVeinLayerNames(OreLayerWrapper oreLayer) {
+ drawVeinLayerNameLine(oreLayer, OreVeinLayer.VEIN_PRIMARY, 50);
+ drawVeinLayerNameLine(oreLayer, OreVeinLayer.VEIN_SECONDARY, 60);
+ drawVeinLayerNameLine(oreLayer, OreVeinLayer.VEIN_BETWEEN, 70);
+ drawVeinLayerNameLine(oreLayer, OreVeinLayer.VEIN_SPORADIC, 80);
+ }
+
+ private static void drawVeinLayerNameLine(OreLayerWrapper oreLayer, int veinLayer, int height) {
+ drawLine(
+ OreVeinLayer.getOreVeinLayerName(veinLayer),
+ getGTOreLocalizedName(oreLayer.Meta[veinLayer]),
+ 2,
+ height);
+ }
+
+ private static void drawVeinInfo(OreLayerWrapper oreLayer) {
+ drawLine("gtnop.gui.nei.genHeight", oreLayer.worldGenHeightRange, 2, 90);
+ drawLine("gtnop.gui.nei.weightedChance", Integer.toString(oreLayer.randomWeight), 100, 90);
+ }
+
+ @Override
+ public String getOutputId() {
+ return "GTOrePluginVein";
+ }
+
+ @Override
+ public String getRecipeName() {
+ return I18n.format("gtnop.gui.veinStat.name");
+ }
+
+ private String[] getDimNameArrayFromVeinName(String veinName) {
+ OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(veinName);
+ String[] dims = (GT5OreLayerHelper.bufferedDims.get(oreLayer)
+ .keySet()
+ .toArray(new String[0]));
+ Arrays.sort(
+ dims,
+ Comparator.comparingInt(
+ s -> Arrays.asList(DimensionHelper.DimNameDisplayed)
+ .indexOf(s)));
+ return dims;
+ }
+
+ public class CachedVeinStatRecipe extends CachedRecipe {
+
+ public final String veinName;
+ public final PositionedStack positionedStackPrimary;
+ public final PositionedStack positionedStackSecondary;
+ public final PositionedStack positionedStackBetween;
+ public final PositionedStack positionedStackSporadic;
+ private final List<PositionedStack> dimensionDisplayItems = new ArrayList<>();
+
+ public CachedVeinStatRecipe(String veinName, List<ItemStack> stackListPrimary,
+ List<ItemStack> stackListSecondary, List<ItemStack> stackListBetween, List<ItemStack> stackListSporadic) {
+ this.veinName = veinName;
+ positionedStackPrimary = new PositionedStack(stackListPrimary, 2, 0);
+ positionedStackSecondary = new PositionedStack(stackListSecondary, 22, 0);
+ positionedStackBetween = new PositionedStack(stackListBetween, 42, 0);
+ positionedStackSporadic = new PositionedStack(stackListSporadic, 62, 0);
+ setDimensionDisplayItems();
+ }
+
+ private void setDimensionDisplayItems() {
+ int x = 2;
+ int y = 110;
+ int count = 0;
+ int itemsPerLine = 9;
+ int itemSize = 18;
+ for (String dim : getDimNameArrayFromVeinName(this.veinName)) {
+ ItemStack item = ItemDimensionDisplay.getItem(dim);
+ if (item != null) {
+ int xPos = x + itemSize * (count % itemsPerLine);
+ int yPos = y + itemSize * (count / itemsPerLine);
+ dimensionDisplayItems.add(new PositionedStack(item, xPos, yPos, false));
+ count++;
+ }
+ }
+ }
+
+ @Override
+ public List<PositionedStack> getIngredients() {
+ return dimensionDisplayItems;
+ }
+
+ @Override
+ public PositionedStack getResult() {
+ return null;
+ }
+
+ @Override
+ public List<PositionedStack> getOtherStacks() {
+ List<PositionedStack> outputs = new ArrayList<>();
+ positionedStackPrimary.setPermutationToRender((cycleticks / 20) % positionedStackPrimary.items.length);
+ positionedStackSecondary.setPermutationToRender((cycleticks / 20) % positionedStackPrimary.items.length);
+ positionedStackBetween.setPermutationToRender((cycleticks / 20) % positionedStackPrimary.items.length);
+ positionedStackSporadic.setPermutationToRender((cycleticks / 20) % positionedStackPrimary.items.length);
+ outputs.add(positionedStackPrimary);
+ outputs.add(positionedStackSecondary);
+ outputs.add(positionedStackBetween);
+ outputs.add(positionedStackSporadic);
+ return outputs;
+ }
+ }
+}