aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorYannickMG <yannickmg@gmail.com>2022-07-06 15:35:36 -0400
committerGitHub <noreply@github.com>2022-07-06 20:35:36 +0100
commit7836eea57a199661e1ac4b41d9ae678e62588ee2 (patch)
treeed9c71b33553fcdc58b52664b1efb3dbe4e3cb45 /src/main/java
parent1cb11f470f296eb4db63174f7e58b17c7af7000d (diff)
downloadGT5-Unofficial-7836eea57a199661e1ac4b41d9ae678e62588ee2.tar.gz
GT5-Unofficial-7836eea57a199661e1ac4b41d9ae678e62588ee2.tar.bz2
GT5-Unofficial-7836eea57a199661e1ac4b41d9ae678e62588ee2.zip
Enhanced NEI discoverability (#17)
* Removed unused code * Addressed IDE warnings * Refactored PluginGT5VeinStat::loadCraftingRecipes for readability * Refactored PluginGT5VeinStat::drawExtras for readability * Added OreVeinLayer class for the concept of ore layer * Updated buildscript * Ran spotlessApply * Addressed some trivial IDE warnings * Load both Small Ores and regular Ores when either is queried. * Refactored PluginGT5SmallOreStat::loadCraftingRecipes for readability * Refactored PluginGT5SmallOreStat::drawExtras for readability
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/Config.java7
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java34
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java7
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java76
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java143
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java257
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java38
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java206
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java109
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java47
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java83
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java31
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/OreVeinLayer.java21
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java49
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/StringPaddingHack.java38
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java4
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java12
17 files changed, 612 insertions, 550 deletions
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/Config.java b/src/main/java/pers/gwyog/gtneioreplugin/Config.java
index c31ebc63a6..eedd953316 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/Config.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/Config.java
@@ -1,9 +1,8 @@
package pers.gwyog.gtneioreplugin;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
-import net.minecraftforge.common.config.Configuration;
-
import java.io.File;
+import net.minecraftforge.common.config.Configuration;
public class Config {
public Configuration tConfig;
@@ -15,8 +14,6 @@ public class Config {
}
public void save() {
- if (tConfig.hasChanged())
- tConfig.save();
+ if (tConfig.hasChanged()) tConfig.save();
}
-
}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java
index a324621a3b..3c0eb00eb4 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java
@@ -11,7 +11,11 @@ import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper;
import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper;
import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper;
-@Mod(modid = GTNEIOrePlugin.MODID, name = GTNEIOrePlugin.NAME, version = GTNEIOrePlugin.VERSION, dependencies = "required-after:gregtech;required-after:NotEnoughItems")
+@Mod(
+ modid = GTNEIOrePlugin.MODID,
+ name = GTNEIOrePlugin.NAME,
+ version = GTNEIOrePlugin.VERSION,
+ dependencies = "required-after:gregtech;required-after:NotEnoughItems")
public class GTNEIOrePlugin {
public static final String MODID = "GRADLETOKEN_MODID";
public static final String NAME = "GRADLETOKEN_MODNAME";
@@ -22,17 +26,36 @@ public class GTNEIOrePlugin {
public static String CSVnameSmall;
public static boolean toolTips = true;
public static int maxTooltipLines = 11;
+
@Mod.Instance(MODID)
public static GTNEIOrePlugin instance;
@EventHandler
public void preinit(FMLPreInitializationEvent event) {
Config c = new Config(event, MODID + ".cfg");
- csv = c.tConfig.getBoolean("print csv", "ALL", false, "print csv, you need apache commons collections to be injected in the minecraft jar.");
- CSVname = c.tConfig.getString("CSV_name", "ALL", event.getModConfigurationDirectory() + "/GTNH-Oresheet.csv", "rename the oresheet here, it will appear in /config");
- CSVnameSmall= c.tConfig.getString("CSV_name_for_Small_Ore_Sheet", "ALL", event.getModConfigurationDirectory() + "/GTNH-Small-Ores-Sheet.csv", "rename the oresheet here, it will appear in /config");
+ csv = c.tConfig.getBoolean(
+ "print csv",
+ "ALL",
+ false,
+ "print csv, you need apache commons collections to be injected in the minecraft jar.");
+ CSVname = c.tConfig.getString(
+ "CSV_name",
+ "ALL",
+ event.getModConfigurationDirectory() + "/GTNH-Oresheet.csv",
+ "rename the oresheet here, it will appear in /config");
+ CSVnameSmall = c.tConfig.getString(
+ "CSV_name_for_Small_Ore_Sheet",
+ "ALL",
+ event.getModConfigurationDirectory() + "/GTNH-Small-Ores-Sheet.csv",
+ "rename the oresheet here, it will appear in /config");
toolTips = c.tConfig.getBoolean("DimTooltip", "ALL", true, "Activates Dimension Tooltips");
- maxTooltipLines = c.tConfig.getInt("MaxToolTipLines", "ALL", 11, 1, Integer.MAX_VALUE, "Maximum number of lines the dimension names tooltip can have before it wraps around.");
+ maxTooltipLines = c.tConfig.getInt(
+ "MaxToolTipLines",
+ "ALL",
+ 11,
+ 1,
+ Integer.MAX_VALUE,
+ "Maximum number of lines the dimension names tooltip can have before it wraps around.");
c.save();
}
@@ -48,5 +71,4 @@ public class GTNEIOrePlugin {
}
}
}
-
}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java
index da3947fee8..de36d22bc9 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java
@@ -2,11 +2,10 @@ package pers.gwyog.gtneioreplugin.plugin;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.recipe.TemplateRecipeHandler;
+import java.awt.*;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.EnumChatFormatting;
-import java.awt.*;
-
public abstract class PluginBase extends TemplateRecipeHandler {
@Override
@@ -27,7 +26,8 @@ public abstract class PluginBase extends TemplateRecipeHandler {
@Override
public void loadTransferRects() {
int stringLength = GuiDraw.getStringWidth(EnumChatFormatting.BOLD + I18n.format("gui.nei.seeAll"));
- transferRects.add(new RecipeTransferRect(new Rectangle(getGuiWidth() - stringLength - 3, 5, stringLength, 9), getOutputId()));
+ transferRects.add(new RecipeTransferRect(
+ new Rectangle(getGuiWidth() - stringLength - 3, 5, stringLength, 9), getOutputId()));
}
public abstract String getOutputId();
@@ -35,5 +35,4 @@ public abstract class PluginBase extends TemplateRecipeHandler {
public int getGuiWidth() {
return 166;
}
-
}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java
index f5bb8a618b..bdcccebe7a 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java
@@ -1,27 +1,27 @@
package pers.gwyog.gtneioreplugin.plugin.gregtech5;
+import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.toolTips;
+
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.guihook.GuiContainerManager;
import codechicken.nei.recipe.GuiRecipe;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.util.GT_LanguageManager;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.util.List;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.EnumChatFormatting;
import pers.gwyog.gtneioreplugin.plugin.PluginBase;
import pers.gwyog.gtneioreplugin.util.DimensionHelper;
import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.util.List;
-
-import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.toolTips;
-
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");
+ return String.format(aFormat.replace("%s", "%temp").replace("%material", "%s"), aMaterial.mLocalizedName)
+ .replace("%temp", "%s");
}
protected static String getLocalizedNameForItem(String aFormat, int aMaterialID) {
@@ -36,19 +36,24 @@ public abstract class PluginGT5Base extends PluginBase {
public static String getGTOreLocalizedName(short index) {
- if (!getLocalizedNameForItem(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)), index % 1000).contains("Awakened"))
- return getLocalizedNameForItem(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)), index % 1000);
- else
- return "Aw. Draconium Ore";
+ if (!getLocalizedNameForItem(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)), index % 1000)
+ .contains("Awakened"))
+ return getLocalizedNameForItem(
+ GT_LanguageManager.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);
+ }
+
/**
* Add lines to the current tooltip if appropriate
- *
+ *
* @param gui An instance of the currentscreen
* @param currenttip The current tooltip, will contain item name and info
* @param recipe The recipe index being handled
@@ -58,9 +63,8 @@ public abstract class PluginGT5Base extends PluginBase {
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe) {
if (toolTips && GuiContainerManager.shouldShowTooltip(gui) && currenttip.size() == 0) {
String dimNames = getDimensionNames(recipe);
- Rectangle dimRect = getDimensionNamesRect(gui, recipe , dimNames);
+ Rectangle dimRect = getDimensionNamesRect(gui, recipe, dimNames);
Point mousePos = GuiDraw.getMousePosition();
-
if (dimRect.contains(mousePos.x, mousePos.y)) {
List<String> dims = DimensionHelper.convertCondensedStringToToolTip(dimNames);
@@ -73,42 +77,42 @@ public abstract class PluginGT5Base extends PluginBase {
/**
* The dimension names for a given recipe index
- *
- * @param The recipe index being handled
+ *
+ * @param recipe The recipe index being handled
* @return A CSV string of dimension name abbreviations
*/
protected abstract String getDimensionNames(int recipe);
/**
* Produce a rectangle covering the area of displayed dimension names
- *
+ *
* @param gui An instance of the currentscreen
* @param recipe The recipe index being handled
* @param dimNames Dimension names to produce a rectangle for
* @return Rectangle area of dimension names
*/
protected Rectangle getDimensionNamesRect(GuiRecipe gui, int recipe, String dimNames) {
- int dimNamesHeight = dimNames.length() > 70 ? 30 : (dimNames.length() > 36 ? 20 : 10);
+ int dimNamesHeight = dimNames.length() > 70 ? 30 : (dimNames.length() > 36 ? 20 : 10);
Point offset = gui.getRecipePosition(recipe);
- return new Rectangle(GuiRecipeHelper.getGuiLeft(gui) + offset.x + 2,
- GuiRecipeHelper.getGuiTop(gui) + offset.y + 110,
- GuiRecipeHelper.getXSize(gui) - 9,
- dimNamesHeight );
+ return new Rectangle(
+ GuiRecipeHelper.getGuiLeft(gui) + offset.x + 2,
+ GuiRecipeHelper.getGuiTop(gui) + offset.y + 110,
+ GuiRecipeHelper.getXSize(gui) - 9,
+ dimNamesHeight);
}
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;
+ 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
- *
+ *
* @param dimNames A CSV string of dimension name abbreviations
*/
protected void drawDimNames(String dimNames) {
@@ -118,12 +122,13 @@ public abstract class PluginGT5Base extends PluginBase {
GuiDraw.drawString(I18n.format("") + dimNames.substring(0, 36), 2, 110, 0x404040, false);
if (dimNames.length() > 70) {
GuiDraw.drawString(I18n.format("") + dimNames.substring(36, 70), 2, 120, 0x404040, false);
- GuiDraw.drawString(I18n.format("") + dimNames.substring(70, dimNames.length() - 1), 2, 130, 0x404040, false);
- } else
- {
- GuiDraw.drawString(I18n.format("") + dimNames.substring(36, dimNames.length() - 1), 2, 120, 0x404040, false);
+ GuiDraw.drawString(
+ I18n.format("") + dimNames.substring(70, dimNames.length() - 1), 2, 130, 0x404040, false);
+ } else {
+ GuiDraw.drawString(
+ I18n.format("") + dimNames.substring(36, dimNames.length() - 1), 2, 120, 0x404040, false);
}
- } else{
+ } else {
GuiDraw.drawString(I18n.format("") + dimNames.substring(0, dimNames.length() - 1), 2, 110, 0x404040, false);
}
}
@@ -132,6 +137,7 @@ public abstract class PluginGT5Base extends PluginBase {
* Draw the "see all recipes" transfer label
*/
protected void drawSeeAllRecipesLabel() {
- GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth() - 3, 5, 0x404040, false);
+ GuiDraw.drawStringR(
+ EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth() - 3, 5, 0x404040, false);
}
}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java
index 70346889e9..38f668f05e 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java
@@ -1,37 +1,49 @@
package pers.gwyog.gtneioreplugin.plugin.gregtech5;
-import codechicken.lib.gui.GuiDraw;
import codechicken.nei.PositionedStack;
-import gregtech.api.GregTech_API;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.util.GT_OreDictUnificator;
+import java.util.ArrayList;
+import java.util.List;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper;
import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper.OreSmallWrapper;
-import java.util.ArrayList;
-import java.util.List;
-
public class PluginGT5SmallOreStat extends PluginGT5Base {
+ private static final int SMALL_ORE_BASE_META = 16000;
+
@Override
public void drawExtras(int recipe) {
- CachedOreSmallRecipe crecipe = (CachedOreSmallRecipe) this.arecipes.get(recipe);
- OreSmallWrapper oreSmall = GT5OreSmallHelper.mapOreSmallWrapper.get(crecipe.oreGenName);
- String sDimNames = GT5OreSmallHelper.bufferedDims.get(oreSmall);
- GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreName") + ": " + getGTOreLocalizedName((short) (oreSmall.oreMeta + 16000)), 2, 18, 0x404040, false);
+ OreSmallWrapper oreSmall = getSmallOre(recipe);
- GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreSmall.worldGenHeightRange, 2, 31, 0x404040, false);
- GuiDraw.drawString(I18n.format("gtnop.gui.nei.amount") + ": " + oreSmall.amountPerChunk, 2, 44, 0x404040, false);
- // if (GT5OreSmallHelper.restrictBiomeSupport) GuiDraw.drawString(I18n.format("gtnop.gui.nei.restrictBiome") + ": " + getBiomeTranslated(oreSmall.restrictBiome), 2, 70, 0x404040, false);
- GuiDraw.drawString(I18n.format("gtnop.gui.nei.chanceDrops") + ": ", 2, 83 + getRestrictBiomeOffset(), 0x404040, false);
- GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 100, 0x404040, false);
+ drawSmallOreName(oreSmall);
+ drawSmallOreInfo(oreSmall);
+ String sDimNames = GT5OreSmallHelper.bufferedDims.get(oreSmall);
drawDimNames(sDimNames);
+
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;
}
@@ -39,48 +51,51 @@ public class PluginGT5SmallOreStat extends PluginGT5Base {
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getOutputId()))
- for (ItemStack stack : GT5OreSmallHelper.oreSmallList)
- loadCraftingRecipes(stack);
- else
- super.loadCraftingRecipes(outputId, results);
+ for (ItemStack stack : GT5OreSmallHelper.oreSmallList) loadCraftingRecipes(stack);
+ else super.loadCraftingRecipes(outputId, results);
}
@Override
public void loadCraftingRecipes(ItemStack stack) {
if (stack.getUnlocalizedName().startsWith("gt.blockores")) {
- if (stack.getItemDamage() < 16000) {
- super.loadCraftingRecipes(stack);
- return;
- }
- short baseMeta = (short) (stack.getItemDamage() % 1000);
- for (OreSmallWrapper oreSmallWorldGen : GT5OreSmallHelper.mapOreSmallWrapper.values()) {
- if (oreSmallWorldGen.oreMeta == baseMeta) {
- List<ItemStack> stackList = new ArrayList<ItemStack>();
- int maximumIndex = getMaximumMaterialIndex(baseMeta, true);
- for (int i = 0; i < maximumIndex; i++)
- stackList.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreSmallWorldGen.oreMeta + 16000 + i * 1000));
- List<ItemStack> materialDustStackList = new ArrayList<ItemStack>();
- for (int i = 0; i < maximumIndex; i++)
- materialDustStackList.add(GT_OreDictUnificator.get(OrePrefixes.dust, GT5OreSmallHelper.getDroppedDusts()[i], 1L));
- this.arecipes.add(new CachedOreSmallRecipe(oreSmallWorldGen.oreGenName, stackList, materialDustStackList, GT5OreSmallHelper.mapOreMetaToOreDrops.get(baseMeta)));
- }
- }
- } else if (GT5OreSmallHelper.mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {
- short baseMeta = GT5OreSmallHelper.mapOreDropUnlocalizedNameToOreMeta.get(stack.getUnlocalizedName());
- for (String oreGenName : GT5OreSmallHelper.mapOreSmallWrapper.keySet()) {
- OreSmallWrapper oreSmallWrapper = GT5OreSmallHelper.mapOreSmallWrapper.get(oreGenName);
- if (oreSmallWrapper.oreMeta == baseMeta) {
- List<ItemStack> stackList = new ArrayList<ItemStack>();
- for (int i = 0; i < 7; i++)
- stackList.add(new ItemStack(GregTech_API.sBlockOres1, 1, baseMeta + 16000 + i * 1000));
- List<ItemStack> materialDustStackList = new ArrayList<ItemStack>();
- for (int i = 0; i < 7; i++)
- materialDustStackList.add(GT_OreDictUnificator.get(OrePrefixes.dust, GT5OreSmallHelper.getDroppedDusts()[i], 1L));
- this.arecipes.add(new CachedOreSmallRecipe(GT5OreSmallHelper.mapOreSmallWrapper.get(oreGenName).oreGenName, stackList, materialDustStackList, GT5OreSmallHelper.mapOreMetaToOreDrops.get(baseMeta)));
- }
+ 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);
+ }
+
+ 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;
}
- } else
- super.loadCraftingRecipes(stack);
+ }
+ 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(
+ GT_OreDictUnificator.get(OrePrefixes.dust, GT5OreSmallHelper.getDroppedDusts()[i], 1L));
+ return materialDustStackList;
}
@Override
@@ -95,48 +110,52 @@ public class PluginGT5SmallOreStat extends PluginGT5Base {
/**
* The dimension names for a given recipe identifier
- *
+ *
* @param recipe identifier
* @return A CSV string of dimension name abbreviations
*/
@Override
- protected String getDimensionNames(int recipe) {
- CachedOreSmallRecipe crecipe = (CachedOreSmallRecipe) this.arecipes.get(recipe);
- OreSmallWrapper oreSmall = GT5OreSmallHelper.mapOreSmallWrapper.get(crecipe.oreGenName);
+ protected String getDimensionNames(int recipe) {
+ OreSmallWrapper oreSmall = getSmallOre(recipe);
return GT5OreSmallHelper.bufferedDims.get(oreSmall);
}
-
+
public class CachedOreSmallRecipe extends CachedRecipe {
public String oreGenName;
public PositionedStack positionedStackOreSmall;
public PositionedStack positionedStackMaterialDust;
public List<PositionedStack> positionedDropStackList;
- public CachedOreSmallRecipe(String oreGenName, List<ItemStack> stackList, List<ItemStack> materialDustStackList, List<ItemStack> dropStackList) {
+ 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<PositionedStack>();
+ 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()));
+ positionedDropStackList.add(new PositionedStack(
+ stackDrop, 43 + 20 * (i % 4), 79 + 16 * ((i++) / 4) + getRestrictBiomeOffset()));
this.positionedDropStackList = positionedDropStackList;
}
@Override
public List<PositionedStack> getIngredients() {
positionedStackOreSmall.setPermutationToRender((cycleticks / 20) % positionedStackOreSmall.items.length);
- positionedStackMaterialDust.setPermutationToRender((cycleticks / 20) % positionedStackMaterialDust.items.length);
+ positionedStackMaterialDust.setPermutationToRender(
+ (cycleticks / 20) % positionedStackMaterialDust.items.length);
positionedDropStackList.add(positionedStackOreSmall);
positionedDropStackList.add(positionedStackMaterialDust);
return positionedDropStackList;
-
}
@Override
public PositionedStack getResult() {
return null;
}
-
}
}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java
index 8f8a01ef0a..dc559db34a 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java
@@ -1,202 +1,104 @@
package pers.gwyog.gtneioreplugin.plugin.gregtech5;
-import codechicken.lib.gui.GuiDraw;
+import static pers.gwyog.gtneioreplugin.util.OreVeinLayer.*;
+
import codechicken.nei.PositionedStack;
import cpw.mods.fml.common.Loader;
-import gregtech.api.GregTech_API;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper;
import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
public class PluginGT5VeinStat extends PluginGT5Base {
- // Unused
- public static String[] getLocalizedVeinName(OreLayerWrapper oreLayer) {
- String unlocalizedName = oreLayer.veinName;
- if (unlocalizedName.startsWith("ore.mix.custom."))
- return get_Cnames(oreLayer);//I18n.format("gtnop.ore.custom.name") + I18n.format("gtnop.ore.vein.name") + unlocalizedName.substring(15);
- else
- return new String[]{I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.vein.name")};
- }
-
- // Unused
- public static String coustomVeinRenamer(OreLayerWrapper oreLayer) {
- Set<String> s = new HashSet<String>();
- for (int i = 0; i < 4; i++)
- s.add(getGTOreLocalizedName(oreLayer.Meta[i]).replaceAll(" ", ""));
- return s.toString()
- .replace("[".charAt(0), ",".charAt(0))
- .replace("]".charAt(0), ",".charAt(0))
- .replaceAll(" Ore", ",")
- .replaceAll("Ore", ",")
- .replaceAll(" Sand", ",")
- .replaceAll("Sand", ",")
- .replaceAll("Stone", ",")
- .replaceAll(" Stone", ",")
- .replaceAll("Earth", ",")
- .replaceAll(" Earth", ",")
- .replaceAll("Infused", ",")
- .replaceAll(" Infused", ",")
- .replaceAll(",", "")
- .trim();
- }
-
- /*public String getWeightedChance(OreLayerWrapper oreLayer) {
- String weightedChance = "";
- for (int i=0; i < oreLayer.alloweddims.size(); i++) {
- if (oreLayer.alloweddims.get(i) && (oreLayer.Weight.get(i) != 0)) {
- if (!weightedChance.isEmpty())
- weightedChance += ", ";
- weightedChance += String.format("%.2f%%", (100.0f*oreLayer.Weight.get(i))/GT5OreLayerHelper.weightPerWorld[i]);
- }
- }
- return weightedChance;
- }*/
-
- // Unused
- public static String[] get_Cnames(OreLayerWrapper oreLayer) {
-
- String[] splt = coustomVeinRenamer(oreLayer).split("\\s");
- /*HashSet<String> h = new HashSet<String>();
- for (int i=0; i < splt.length;i++) {
- h.add(splt[i]);
- }
- h.toArray(splt);*/
-
- String[] ret = {oreLayer.veinName.replace("ore.mix.custom.", "") + " ", " ", " "};
- for (int i = 0; i < ret.length; i++) {
- ret[i] = ret[i].trim();
- }
- for (int i = 0; i < splt.length; i++) {
- //FMLLog.info("Split:"+splt[i]);
- //FMLLog.info("I:"+Integer.toString(i));
- if (ret[0].length() + splt[i].length() <= 20)
- ret[0] = ret[0] + splt[i] + " ";
- if ((ret[0].length() + splt[i].length() > 20) && ret[1].length() + splt[i].length() <= 70 && !ret[0].contains(splt[i]))
- ret[1] = ret[1] + splt[i] + " ";
- if ((ret[0].length() + splt[i].length() > 20) && (ret[1].length() + splt[i].length() > 70) && ret[2].length() + splt[i].length() <= 70 && !ret[1].contains(splt[i]))
- ret[2] = ret[2] + splt[i] + " ";
- }
- for (int i = 0; i < ret.length; i++) {
- ret[i] = ret[i].trim();
- }
-
- if (ret[2].isEmpty() && !ret[1].isEmpty())
- if (ret[1].length() <= 65)
- ret[1] = ret[1] + " Vein";
- else
- ret[2] = ret[2] + "Vein";
- else if (ret[1].isEmpty() && ret[2].isEmpty() && !ret[0].isEmpty())
- if (ret[0].length() <= 15)
- ret[0] = ret[0] + " Vein";
- else
- ret[1] = ret[1] + "Vein";
- else if (!(ret[1].isEmpty() && ret[2].isEmpty()))
- ret[2] = ret[2] + "Vein";
- String[] ret2 = new String[2];
- if (ret[2].isEmpty() && !ret[1].isEmpty()) {
- ret2[0] = ret[0];
- ret2[1] = ret[1];
- return ret2;
- }
- String[] ret1 = new String[1];
- if (ret[1].isEmpty() && ret[2].isEmpty() && !ret[0].isEmpty()) {
- ret1[0] = ret[0];
- return ret1;
- } else
- return ret;
- }
-
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getOutputId())) {
- OreLayerWrapper oreLayerWrapper;
- for (String veinName : GT5OreLayerHelper.mapOreLayerWrapper.keySet()) {
- oreLayerWrapper = GT5OreLayerHelper.mapOreLayerWrapper.get(veinName);
- List<ItemStack> stackListPrimary = new ArrayList<ItemStack>();
- List<ItemStack> stackListSecondary = new ArrayList<ItemStack>();
- List<ItemStack> stackListBetween = new ArrayList<ItemStack>();
- List<ItemStack> stackListSporadic = new ArrayList<ItemStack>();
- for (int i = 0; i < 7; i++) {
- stackListPrimary.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[0] + i * 1000));
- stackListSecondary.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[1] + i * 1000));
- stackListBetween.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[2] + i * 1000));
- stackListSporadic.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[3] + i * 1000));
- }
- this.arecipes.add(new CachedVeinStatRecipe(veinName, stackListPrimary, stackListSecondary, stackListBetween, stackListSporadic));
+ for (OreLayerWrapper oreVein : getAllVeins()) {
+ addVeinWithLayers(oreVein, 7);
}
- } else
- super.loadCraftingRecipes(outputId, results);
+ } else super.loadCraftingRecipes(outputId, results);
}
@Override
public void loadCraftingRecipes(ItemStack stack) {
if (stack.getUnlocalizedName().startsWith("gt.blockores")) {
- if (stack.getItemDamage() > 16000) {
- super.loadCraftingRecipes(stack);
- return;
- }
- short baseMeta = (short) (stack.getItemDamage() % 1000);
- for (OreLayerWrapper worldGen : GT5OreLayerHelper.mapOreLayerWrapper.values()) {
- if (worldGen.Meta[0] == baseMeta || worldGen.Meta[1] == baseMeta || worldGen.Meta[2] == baseMeta || worldGen.Meta[3] == baseMeta) {
- List<ItemStack> stackListPrimary = new ArrayList<ItemStack>();
- List<ItemStack> stackListSecondary = new ArrayList<ItemStack>();
- List<ItemStack> stackListBetween = new ArrayList<ItemStack>();
- List<ItemStack> stackListSporadic = new ArrayList<ItemStack>();
- for (int i = 0; i < getMaximumMaterialIndex(baseMeta, false); i++) {
- stackListPrimary.add(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[0] + i * 1000));
- stackListSecondary.add(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[1] + i * 1000));
- stackListBetween.add(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[2] + i * 1000));
- stackListSporadic.add(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[3] + i * 1000));
- }
- this.arecipes.add(new CachedVeinStatRecipe(worldGen.veinName, stackListPrimary, stackListSecondary, stackListBetween, stackListSporadic));
- }
+ 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));
}
- } else
- super.loadCraftingRecipes(stack);
+ }
+ }
+
+ private void addVeinWithLayers(OreLayerWrapper oreVein, int maximumMaterialIndex) {
+ this.arecipes.add(new CachedVeinStatRecipe(
+ oreVein.veinName,
+ oreVein.getVeinLayerOre(maximumMaterialIndex, VEIN_PRIMARY),
+ oreVein.getVeinLayerOre(maximumMaterialIndex, VEIN_SECONDARY),
+ oreVein.getVeinLayerOre(maximumMaterialIndex, VEIN_BETWEEN),
+ oreVein.getVeinLayerOre(maximumMaterialIndex, VEIN_SPORADIC)));
+ }
+
+ private Collection<OreLayerWrapper> getAllVeins() {
+ return GT5OreLayerHelper.mapOreLayerWrapper.values();
}
@Override
public void drawExtras(int recipe) {
- CachedVeinStatRecipe crecipe = (CachedVeinStatRecipe) this.arecipes.get(recipe);
- OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName);
+ OreLayerWrapper oreLayer = getOreLayer(recipe);
- String sDimNames = GT5OreLayerHelper.bufferedDims.get(oreLayer);
+ drawVeinName(oreLayer);
+ drawVeinLayerNames(oreLayer);
+ drawVeinInfo(oreLayer);
- if(Loader.isModLoaded("visualprospecting")) {
- GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + I18n.format(oreLayer.veinName) + " " + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false);
- }
- else {
- if (getGTOreLocalizedName(oreLayer.Meta[0]).contains("Ore"))
- GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]).split("Ore")[0] + "" + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false);
- else if (getGTOreLocalizedName(oreLayer.Meta[0]).contains("Sand"))
- GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]).split("Sand")[0] + "" + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false);
- else
- GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]) + " " + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false);
- }
-
- GuiDraw.drawString(I18n.format("gtnop.gui.nei.primaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]), 2, 50, 0x404040, false);
+ String sDimNames = GT5OreLayerHelper.bufferedDims.get(oreLayer);
+ drawDimNames(sDimNames);
- GuiDraw.drawString(I18n.format("gtnop.gui.nei.secondaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[1]), 2, 60, 0x404040, false);
+ drawSeeAllRecipesLabel();
+ }
- GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[2]), 2, 70, 0x404040, false);
+ private OreLayerWrapper getOreLayer(int recipe) {
+ CachedVeinStatRecipe crecipe = (CachedVeinStatRecipe) this.arecipes.get(recipe);
+ return GT5OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName);
+ }
- GuiDraw.drawString(I18n.format("gtnop.gui.nei.sporadicOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[3]), 2, 80, 0x404040, false);
+ private static void drawVeinName(OreLayerWrapper oreLayer) {
+ if (Loader.isModLoaded("visualprospecting")) {
+ drawVeinNameLine(I18n.format(oreLayer.veinName) + " ");
+ } else {
+ String veinName = getGTOreLocalizedName(oreLayer.Meta[VEIN_PRIMARY]);
+ if (veinName.contains("Ore")) drawVeinNameLine(veinName.split("Ore")[0]);
+ else if (veinName.contains("Sand")) drawVeinNameLine(veinName.split("Sand")[0]);
+ else drawVeinNameLine(veinName + " ");
+ }
+ }
- GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreLayer.worldGenHeightRange, 2, 90, 0x404040, false);
+ private static void drawVeinNameLine(String veinName) {
+ drawLine("gtnop.gui.nei.veinName", veinName + I18n.format("gtnop.gui" + ".nei.vein"), 2, 20);
+ }
- GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + Integer.toString(oreLayer.randomWeight), 100, 90, 0x404040, false);
+ private static void drawVeinLayerNames(OreLayerWrapper oreLayer) {
+ drawVeinLayerNameLine(oreLayer, VEIN_PRIMARY, 50);
+ drawVeinLayerNameLine(oreLayer, VEIN_SECONDARY, 60);
+ drawVeinLayerNameLine(oreLayer, VEIN_BETWEEN, 70);
+ drawVeinLayerNameLine(oreLayer, VEIN_SPORADIC, 80);
+ }
- drawDimNames(sDimNames);
+ private static void drawVeinLayerNameLine(OreLayerWrapper oreLayer, int veinLayer, int height) {
+ drawLine(getOreVeinLayerName(veinLayer), getGTOreLocalizedName(oreLayer.Meta[veinLayer]), 2, height);
+ }
- //if (GT5OreLayerHelper.restrictBiomeSupport) GuiDraw.drawString(I18n.format("gtnop.gui.nei.restrictBiome") + ": " + getBiomeTranslated(oreLayer.restrictBiome), 2, 122, 0x404040, false);
- drawSeeAllRecipesLabel();
+ 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
@@ -208,17 +110,16 @@ public class PluginGT5VeinStat extends PluginGT5Base {
public String getRecipeName() {
return I18n.format("gtnop.gui.veinStat.name");
}
-
+
/**
* The dimension names for a given recipe identifier
- *
+ *
* @param recipe identifier
* @return A CSV string of dimension name abbreviations
*/
@Override
- protected String getDimensionNames(int recipe) {
- CachedVeinStatRecipe crecipe = (CachedVeinStatRecipe) this.arecipes.get(recipe);
- OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName);
+ protected String getDimensionNames(int recipe) {
+ OreLayerWrapper oreLayer = getOreLayer(recipe);
return GT5OreLayerHelper.bufferedDims.get(oreLayer);
}
@@ -229,8 +130,12 @@ public class PluginGT5VeinStat extends PluginGT5Base {
public PositionedStack positionedStackBetween;
public PositionedStack positionedStackSporadic;
- public CachedVeinStatRecipe(String veinName, List<ItemStack> stackListPrimary, List<ItemStack> stackListSecondary,
- List<ItemStack> stackListBetween, List<ItemStack> stackListSporadic) {
+ 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);
@@ -240,15 +145,11 @@ public class PluginGT5VeinStat extends PluginGT5Base {
@Override
public List<PositionedStack> getIngredients() {
- List<PositionedStack> ingredientsList = new ArrayList<PositionedStack>();
+ List<PositionedStack> ingredientsList = 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);
- ;
ingredientsList.add(positionedStackPrimary);
ingredientsList.add(positionedStackSecondary);
ingredientsList.add(positionedStackBetween);
@@ -260,7 +161,5 @@ public class PluginGT5VeinStat extends PluginGT5Base {
public PositionedStack getResult() {
return null;
}
-
}
-
}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java b/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java
index f12405a7ae..24cc1dd023 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java
@@ -4,10 +4,6 @@ import com.opencsv.CSVWriter;
import com.opencsv.bean.ColumnPositionMappingStrategy;
import com.opencsv.bean.StatefulBeanToCsv;
import com.opencsv.bean.StatefulBeanToCsvBuilder;
-import pers.gwyog.gtneioreplugin.GTNEIOrePlugin;
-import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat;
-import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper;
-
import java.io.BufferedWriter;
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -15,12 +11,13 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import pers.gwyog.gtneioreplugin.GTNEIOrePlugin;
+import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat;
+import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper;
public class CSVMaker implements Runnable {
- public CSVMaker() {
-
- }
+ public CSVMaker() {}
public static List<Oremix> Combsort(List<Oremix> liste) {
try {
@@ -37,7 +34,13 @@ public class CSVMaker implements Runnable {
schritt = (int) (schritt / 1.3);
}
for (int i = 0; i < liste2.size() - schritt; i++) {
- if (liste2.get(i).getOreName().substring(0, 3).compareTo((liste2.get(i + schritt).getOreName().substring(0, 3))) > 0) {
+ if (liste2.get(i)
+ .getOreName()
+ .substring(0, 3)
+ .compareTo((liste2.get(i + schritt)
+ .getOreName()
+ .substring(0, 3)))
+ > 0) {
Oremix tmp = (Oremix) liste2.get(i);
liste2.set(i, liste2.get(i + schritt));
liste2.set(i + schritt, (Oremix) tmp);
@@ -107,14 +110,17 @@ public class CSVMaker implements Runnable {
BufferedWriter one = Files.newBufferedWriter(Paths.get(GTNEIOrePlugin.CSVnameSmall));
ColumnPositionMappingStrategy strat = new ColumnPositionMappingStrategy();
strat.setType(Oremix.class);
- String[] columns = "ORENAME,mix,DENSITY,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie".split("\\,");
+ String[] columns =
+ "ORENAME,mix,DENSITY,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie"
+ .split("\\,");
strat.setColumnMapping(columns);
StatefulBeanToCsv<Oremix> beanToCsv = new StatefulBeanToCsvBuilder(one)
.withQuotechar(CSVWriter.NO_QUOTE_CHARACTER)
.withMappingStrategy(strat)
.build();
List towrite = Combsort(OreVeins);
- one.write("Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E");
+ one.write(
+ "Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E");
one.newLine();
beanToCsv.write(towrite);
one.flush();
@@ -149,7 +155,8 @@ public class CSVMaker implements Runnable {
oremix.setHeight(oreLayer.worldGenHeightRange);
oremix.setDensity(oreLayer.density);
oremix.setWeight(oreLayer.randomWeight);
- oremix.setMix(Integer.toString(oreLayer.Meta[0]) + "|" + Integer.toString(oreLayer.Meta[1]) + "|" + Integer.toString(oreLayer.Meta[2]) + "|" + Integer.toString(oreLayer.Meta[3]));
+ oremix.setMix(Integer.toString(oreLayer.Meta[0]) + "|" + Integer.toString(oreLayer.Meta[1]) + "|"
+ + Integer.toString(oreLayer.Meta[2]) + "|" + Integer.toString(oreLayer.Meta[3]));
oremix.as = Dims.contains("As");
oremix.bc = Dims.contains("BC");
oremix.be = Dims.contains("BE");
@@ -186,21 +193,23 @@ public class CSVMaker implements Runnable {
oremix.setEnd(Dims.contains("EN"));
OreVeins.add(oremix);
-
System.out.println(pair.getKey() + " = " + pair.getValue());
it.remove(); // avoids a ConcurrentModificationException
}
BufferedWriter one = Files.newBufferedWriter(Paths.get(GTNEIOrePlugin.CSVname));
ColumnPositionMappingStrategy strat = new ColumnPositionMappingStrategy();
strat.setType(Oremix.class);
- String[] columns = "ORENAME,PRIMARY,SECONDARY,INBETWEEN,AROUND,mix,TIER,HEIGHT,DENSITY,SIZE,WEIGHT,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie".split("\\,");
+ String[] columns =
+ "ORENAME,PRIMARY,SECONDARY,INBETWEEN,AROUND,mix,TIER,HEIGHT,DENSITY,SIZE,WEIGHT,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie"
+ .split("\\,");
strat.setColumnMapping(columns);
StatefulBeanToCsv<Oremix> beanToCsv = new StatefulBeanToCsvBuilder(one)
.withQuotechar(CSVWriter.NO_QUOTE_CHARACTER)
.withMappingStrategy(strat)
.build();
List towrite = Combsort(OreVeins);
- one.write("Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E");
+ one.write(
+ "Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E");
one.newLine();
beanToCsv.write(towrite);
one.flush();
@@ -209,5 +218,4 @@ public class CSVMaker implements Runnable {
e.printStackTrace();
}
}
-
}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java
index fb422ed074..16be409b61 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java
@@ -1,111 +1,111 @@
package pers.gwyog.gtneioreplugin.util;
+import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.maxTooltipLines;
+
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import net.minecraft.client.resources.I18n;
-import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.maxTooltipLines;
-
public class DimensionHelper {
- public static String[] DimName =
- {
- // Non GC dimensions in progression order instead of alphabetical
- "Overworld",
- "Nether",
- "Twilight",
- "TheEnd",
- "Vanilla_EndAsteroids",
- "EndAsteroid",
- // T1
- "GalacticraftCore_Moon",
- // T2
- "GalaxySpace_Deimos",
- "GalacticraftMars_Mars",
- "GalaxySpace_Phobos",
- // T3
- "GalacticraftMars_Asteroids",
- "GalaxySpace_Callisto",
- "GalaxySpace_Ceres",
- "GalaxySpace_Europa",
- "GalaxySpace_Ganymede",
- // T4
- "GalaxySpace_Io",
- "GalaxySpace_Mercury",
- "GalaxySpace_Venus",
- // T5
- "GalaxySpace_Enceladus",
- "GalaxySpace_Miranda",
- "GalaxySpace_Oberon",
- "GalaxySpace_Titan",
- // T6
- "GalaxySpace_Proteus",
- "GalaxySpace_Triton",
- // T7
- "GalaxySpace_Haumea",
- "GalaxySpace_Kuiperbelt",
- "GalaxySpace_MakeMake",
- "GalaxySpace_Pluto",
- // T8
- "GalaxySpace_BarnardC",
- "GalaxySpace_BarnardE",
- "GalaxySpace_BarnardF",
- "GalaxySpace_CentauriA",
- "GalaxySpace_TcetiE",
- "Underdark",
- "GalaxySpace_VegaB",
- };
+ public static String[] DimName = {
+ // Non GC dimensions in progression order instead of alphabetical
+ "Overworld",
+ "Nether",
+ "Twilight",
+ "TheEnd",
+ "Vanilla_EndAsteroids",
+ "EndAsteroid",
+ // T1
+ "GalacticraftCore_Moon",
+ // T2
+ "GalaxySpace_Deimos",
+ "GalacticraftMars_Mars",
+ "GalaxySpace_Phobos",
+ // T3
+ "GalacticraftMars_Asteroids",
+ "GalaxySpace_Callisto",
+ "GalaxySpace_Ceres",
+ "GalaxySpace_Europa",
+ "GalaxySpace_Ganymede",
+ // T4
+ "GalaxySpace_Io",
+ "GalaxySpace_Mercury",
+ "GalaxySpace_Venus",
+ // T5
+ "GalaxySpace_Enceladus",
+ "GalaxySpace_Miranda",
+ "GalaxySpace_Oberon",
+ "GalaxySpace_Titan",
+ // T6
+ "GalaxySpace_Proteus",
+ "GalaxySpace_Triton",
+ // T7
+ "GalaxySpace_Haumea",
+ "GalaxySpace_Kuiperbelt",
+ "GalaxySpace_MakeMake",
+ "GalaxySpace_Pluto",
+ // T8
+ "GalaxySpace_BarnardC",
+ "GalaxySpace_BarnardE",
+ "GalaxySpace_BarnardF",
+ "GalaxySpace_CentauriA",
+ "GalaxySpace_TcetiE",
+ "Underdark",
+ "GalaxySpace_VegaB",
+ };
- public static String[] DimNameDisplayed =
- {// first 2 letters if one word else 1 letter of every word, except capital letter in name, then 1rst + capital Moon = Mo, BarnardC = BC, EndAsteroid = EA
- // Non GC dimensions in progression order instead of alphabetical
- "Ow", // Overworld
- "Ne", // Nether
- "TF", // Twilight
- "EN", // TheEnd because En = Encalus
- "VA", // Vanilla_EndAsteroids
- "EA", // EndAsteroid
- // T1
- "Mo", // GalacticraftCore_Moon
- // T2
- "De", // GalaxySpace_Deimos
- "Ma", // GalacticraftMars_Mars
- "Ph", // GalaxySpace_Phobos
- // T3
- "As", // GalacticraftMars_Asteroids
- "Ca", // GalaxySpace_Callisto
- "Ce", // GalaxySpace_Ceres
- "Eu", // GalaxySpace_Europa
- "Ga", // GalaxySpace_Ganymede
- // T4
- "Io", // GalaxySpace_Io
- "Me", // GalaxySpace_Mercury
- "Ve", // GalaxySpace_Venus
- // T5
- "En", // GalaxySpace_Enceladus
- "Mi", // GalaxySpace_Miranda
- "Ob", // GalaxySpace_Oberon
- "Ti", // GalaxySpace_Titan
- // T6
- "Pr", // GalaxySpace_Proteus
- "Tr", // GalaxySpace_Triton
- // T7
- "Ha", // GalaxySpace_Haumea
- "KB", // GalaxySpace_Kuiperbelt
- "MM", // GalaxySpace_MakeMake
- "Pl", // GalaxySpace_Pluto
- // T8
- "BC", // GalaxySpace_BarnardC
- "BE", // GalaxySpace_BarnardE
- "BF", // GalaxySpace_BarnardF
- "CB", // GalaxySpace_CentauriA is actually αCentauri Bb
- "TE", // GalaxySpace_TcetiE
- "DD", // Underdark
- "VB", // GalaxySpace_VegaB
- };
+ public static String[]
+ DimNameDisplayed = { // first 2 letters if one word else 1 letter of every word, except capital letter in
+ // name, then 1rst + capital Moon = Mo, BarnardC = BC, EndAsteroid = EA
+ // Non GC dimensions in progression order instead of alphabetical
+ "Ow", // Overworld
+ "Ne", // Nether
+ "TF", // Twilight
+ "EN", // TheEnd because En = Encalus
+ "VA", // Vanilla_EndAsteroids
+ "EA", // EndAsteroid
+ // T1
+ "Mo", // GalacticraftCore_Moon
+ // T2
+ "De", // GalaxySpace_Deimos
+ "Ma", // GalacticraftMars_Mars
+ "Ph", // GalaxySpace_Phobos
+ // T3
+ "As", // GalacticraftMars_Asteroids
+ "Ca", // GalaxySpace_Callisto
+ "Ce", // GalaxySpace_Ceres
+ "Eu", // GalaxySpace_Europa
+ "Ga", // GalaxySpace_Ganymede
+ // T4
+ "Io", // GalaxySpace_Io
+ "Me", // GalaxySpace_Mercury
+ "Ve", // GalaxySpace_Venus
+ // T5
+ "En", // GalaxySpace_Enceladus
+ "Mi", // GalaxySpace_Miranda
+ "Ob", // GalaxySpace_Oberon
+ "Ti", // GalaxySpace_Titan
+ // T6
+ "Pr", // GalaxySpace_Proteus
+ "Tr", // GalaxySpace_Triton
+ // T7
+ "Ha", // GalaxySpace_Haumea
+ "KB", // GalaxySpace_Kuiperbelt
+ "MM", // GalaxySpace_MakeMake
+ "Pl", // GalaxySpace_Pluto
+ // T8
+ "BC", // GalaxySpace_BarnardC
+ "BE", // GalaxySpace_BarnardE
+ "BF", // GalaxySpace_BarnardF
+ "CB", // GalaxySpace_CentauriA is actually αCentauri Bb
+ "TE", // GalaxySpace_TcetiE
+ "DD", // Underdark
+ "VB", // GalaxySpace_VegaB
+ };
- private static HashMap<String, List<String>> tooltipBuffer = new HashMap<>();
+ private static final HashMap<String, List<String>> tooltipBuffer = new HashMap<>();
private static List<String> computeString(String line) {
String[] dims = line.split(",");
@@ -115,7 +115,11 @@ public class DimensionHelper {
s = s.trim();
for (int i = 0; i < DimNameDisplayed.length; i++) {
if (s.equals(DimNameDisplayed[i])) {
- String k = DimName[i].replaceAll("GalacticraftCore_", "").replaceAll("GalacticraftMars_", "").replaceAll("GalaxySpace_", "").replaceAll("Vanilla_", "Vanilla ");
+ String k = DimName[i]
+ .replaceAll("GalacticraftCore_", "")
+ .replaceAll("GalacticraftMars_", "")
+ .replaceAll("GalaxySpace_", "")
+ .replaceAll("Vanilla_", "Vanilla ");
s = I18n.format("gtnop.world." + k);
switch (k) {
case "Moon":
@@ -170,9 +174,9 @@ public class DimensionHelper {
}
}
- if (dims.length > maxTooltipLines ) {
+ if (dims.length > maxTooltipLines) {
dims = StringPaddingHack.stringsToSpacedColumns(
- dims, dims.length / maxTooltipLines + (dims.length % maxTooltipLines == 0 ? 0 : 1) , 2);
+ dims, dims.length / maxTooltipLines + (dims.length % maxTooltipLines == 0 ? 0 : 1), 2);
}
return Arrays.asList(dims);
@@ -181,4 +185,4 @@ public class DimensionHelper {
public static List<String> convertCondensedStringToToolTip(String line) {
return tooltipBuffer.computeIfAbsent(line, (String tmp) -> computeString(line));
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java
index 94b826808f..1a62c31ec1 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java
@@ -2,11 +2,6 @@ package pers.gwyog.gtneioreplugin.util;
import cpw.mods.fml.common.FMLLog;
import gregtech.api.GregTech_API;
-import net.minecraftforge.common.config.ConfigCategory;
-import net.minecraftforge.common.config.Configuration;
-import net.minecraftforge.common.config.Property;
-import pers.gwyog.gtneioreplugin.GTNEIOrePlugin;
-
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
@@ -14,7 +9,10 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
-
+import net.minecraftforge.common.config.ConfigCategory;
+import net.minecraftforge.common.config.Configuration;
+import net.minecraftforge.common.config.Property;
+import pers.gwyog.gtneioreplugin.GTNEIOrePlugin;
public class GT5CFGHelper {
@@ -34,8 +32,7 @@ public class GT5CFGHelper {
if (!raw.isEmpty())
for (int i = 0; i < raw.size(); i++) {
for (int j = 0; j < DimensionHelper.DimName.length; j++)
- if (raw.get(i).contains(DimensionHelper.DimName[j]))
- rawbools.add(raw.get(i));
+ if (raw.get(i).contains(DimensionHelper.DimName[j])) rawbools.add(raw.get(i));
}
else GTNEIOrePlugin.LOG.info("Config entry not found for Vein: " + Veinname);
@@ -44,7 +41,12 @@ public class GT5CFGHelper {
HashSet<String> rawboolsset = new HashSet<String>();
if (!rawbools.isEmpty()) {
for (int i = 0; i < rawbools.size(); i++) {
- st = rawbools.get(i).replace("B:", "").replace("_true", "").replace("_false", "").replaceAll(" ", "").replaceAll("\"", "");
+ st = rawbools.get(i)
+ .replace("B:", "")
+ .replace("_true", "")
+ .replace("_false", "")
+ .replaceAll(" ", "")
+ .replaceAll("\"", "");
rawboolsset.add(st);
}
rawbools = new ArrayList<String>(rawboolsset);
@@ -52,33 +54,30 @@ public class GT5CFGHelper {
for (int i = 0; i < rawbools.size(); i++) {
st = rawbools.get(i);
if (st.contains(DimensionHelper.DimName[j]))
- if (st.contains("=true"))
- ret = (ret + DimensionHelper.DimNameDisplayed[j] + ",");
+ if (st.contains("=true")) ret = (ret + DimensionHelper.DimNameDisplayed[j] + ",");
}
}
}
ret = ret.trim();
- if (ret.equals("") || ret.equals(" "))
- ret = "Not available in any Galactic Dim!";
+ if (ret.equals("") || ret.equals(" ")) ret = "Not available in any Galactic Dim!";
return ret;
}
public static String GT5CFG(String Veinname) {
- //FMLLog.info(Veinname);
+ // FMLLog.info(Veinname);
if (F == null) {
FMLLog.bigWarning("GT_CFG_NOT_found[0]");
return "Error while Loading CFG";
} else
try {
int buffer = (int) (0.1 * Runtime.getRuntime().freeMemory());
- if (buffer > F.length())
- buffer = (int) F.length();
- //allocate 10% of free memory for read-in-buffer, if there is less than filesize memory available
- //FMLLog.info("GT_CFG_found[0]");
+ if (buffer > F.length()) buffer = (int) F.length();
+ // allocate 10% of free memory for read-in-buffer, if there is less than filesize memory available
+ // FMLLog.info("GT_CFG_found[0]");
FileReader in = new FileReader(F);
- //FMLLog.info("FileReader created");
+ // FMLLog.info("FileReader created");
BufferedReader reader = new BufferedReader(in, buffer);
- //FMLLog.info("BufferedReader" +Integer.toString(buffer)+"created");
+ // FMLLog.info("BufferedReader" +Integer.toString(buffer)+"created");
String st = null;
List<String> raw = new ArrayList<String>();
List<String> rawbools = new ArrayList<String>();
@@ -87,24 +86,23 @@ public class GT5CFGHelper {
found[1] = false;
do {
- //FMLLog.info("erste");
- //read until reached eof or mix {
+ // FMLLog.info("erste");
+ // read until reached eof or mix {
st = reader.readLine();
- //FMLLog.info("st: "+st);
+ // FMLLog.info("st: "+st);
if (st != null && st.trim().equals("mix {")) {
while (!((st == null) || ((st != null) && found[0]))) {
- //FMLLog.info("zweite");
+ // FMLLog.info("zweite");
st = reader.readLine();
- //read until reached eof or Veinname {
- //FMLLog.info("MIXst: "+st);
+ // read until reached eof or Veinname {
+ // FMLLog.info("MIXst: "+st);
if (st != null && st.trim().equals(Veinname + " {")) {
- //FMLLog.info("VEINNAMEst: "+st);
+ // FMLLog.info("VEINNAMEst: "+st);
while (!((st == null) || ((st != null) && found[0]))) {
st = reader.readLine();
- if ((!(st == null)) && st.trim().equals("}"))
- found[0] = true;
- //FMLLog.info("dritte");
- //add everything below Veinname { undtil } to raw
+ if ((!(st == null)) && st.trim().equals("}")) found[0] = true;
+ // FMLLog.info("dritte");
+ // add everything below Veinname { undtil } to raw
raw.add(st);
}
}
@@ -113,22 +111,21 @@ public class GT5CFGHelper {
if (st != null && st.trim().equals("dimensions {")) {
while (!((st == null) || ((st != null) && found[1]))) {
- //FMLLog.info("zweite");
+ // FMLLog.info("zweite");
st = reader.readLine();
if (st != null && (st.trim().equals("mix {"))) {
while (!((st == null) || ((st != null) && found[1]))) {
- //FMLLog.info("dritte");
+ // FMLLog.info("dritte");
st = reader.readLine();
- //read until reached eof or Veinname {
- //FMLLog.info("MIXst: "+st);
+ // read until reached eof or Veinname {
+ // FMLLog.info("MIXst: "+st);
if (st != null && st.trim().equals(Veinname + " {")) {
- //FMLLog.info("VEINNAMEst: "+st);
+ // FMLLog.info("VEINNAMEst: "+st);
while (!((st == null) || ((st != null) && found[1]))) {
st = reader.readLine();
- if ((!(st == null)) && st.trim().equals("}"))
- found[1] = true;
- //FMLLog.info("vierte");
- //add everything below Veinname { undtil } to raw
+ if ((!(st == null)) && st.trim().equals("}")) found[1] = true;
+ // FMLLog.info("vierte");
+ // add everything below Veinname { undtil } to raw
raw.add(st);
}
}
@@ -137,16 +134,15 @@ public class GT5CFGHelper {
}
}
} while (st != null);
- reader.close();//not needed anymore
+ reader.close(); // not needed anymore
if (!raw.isEmpty())
for (int i = 0; i < raw.size(); i++) {
- //filter needed booleans from raw
- ///FMLLog.info("raw contains"+raw.get(i));
+ // filter needed booleans from raw
+ /// FMLLog.info("raw contains"+raw.get(i));
for (int j = 0; j < DimensionHelper.DimName.length; j++)
- if (raw.get(i).contains(DimensionHelper.DimName[j]))
- rawbools.add(raw.get(i));
- //FMLLog.info("rawbools: "+rawbools.get(i));
+ if (raw.get(i).contains(DimensionHelper.DimName[j])) rawbools.add(raw.get(i));
+ // FMLLog.info("rawbools: "+rawbools.get(i));
}
else GTNEIOrePlugin.LOG.info("Config entry not found for Vein: " + Veinname);
@@ -154,27 +150,30 @@ public class GT5CFGHelper {
HashSet<String> rawboolsset = new HashSet<String>();
if (!rawbools.isEmpty()) {
- //remove dublicates
+ // remove dublicates
for (int i = 0; i < rawbools.size(); i++) {
- st = rawbools.get(i).replace("B:", "").replace("_true", "").replace("_false", "").replaceAll(" ", "").replaceAll("\"", "");
+ st = rawbools.get(i)
+ .replace("B:", "")
+ .replace("_true", "")
+ .replace("_false", "")
+ .replaceAll(" ", "")
+ .replaceAll("\"", "");
rawboolsset.add(st);
}
rawbools = new ArrayList<String>(rawboolsset);
- //filter for dims set to true
+ // filter for dims set to true
for (int j = 0; j < DimensionHelper.DimName.length; j++) {
- //FMLLog.info("RawBools:"+st);
+ // FMLLog.info("RawBools:"+st);
for (int i = 0; i < rawbools.size(); i++) {
st = rawbools.get(i);
if (st.contains(DimensionHelper.DimName[j]))
- if (st.contains("=true"))
- ret = (ret + DimensionHelper.DimNameDisplayed[j] + ",");
+ if (st.contains("=true")) ret = (ret + DimensionHelper.DimNameDisplayed[j] + ",");
}
}
}
ret = ret.trim();
- //FMLLog.info("ret:"+ret);
- if (ret.equals("") || ret.equals(" "))
- ret = "Not available in any Galactic Dim!";
+ // FMLLog.info("ret:"+ret);
+ if (ret.equals("") || ret.equals(" ")) ret = "Not available in any Galactic Dim!";
return ret;
} catch (IOException e) {
e.printStackTrace();
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java
index 9e8a608405..ac3873d9bc 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java
@@ -1,23 +1,26 @@
package pers.gwyog.gtneioreplugin.util;
-import gregtech.common.GT_Worldgen_GT_Ore_Layer;
+import static pers.gwyog.gtneioreplugin.util.OreVeinLayer.*;
+import gregtech.api.GregTech_API;
+import gregtech.common.GT_Worldgen_GT_Ore_Layer;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
+import net.minecraft.item.ItemStack;
public class GT5OreLayerHelper {
- public static Integer weightPerWorld[] = new Integer[33];
- public static Integer DimIDs[] = new Integer[33];
- public static HashMap<String, OreLayerWrapper> mapOreLayerWrapper = new HashMap<String, OreLayerWrapper>();
+ private static final int DIMENSION_COUNT = 33;
+ public static Integer[] weightPerWorld = new Integer[DIMENSION_COUNT];
+ public static Integer[] DimIDs = new Integer[DIMENSION_COUNT];
+ public static HashMap<String, OreLayerWrapper> mapOreLayerWrapper = new HashMap<>();
public static HashMap<OreLayerWrapper, String> bufferedDims = new HashMap<>();
public GT5OreLayerHelper() {
- for (int i = 0; i < DimIDs.length; i++)
- weightPerWorld[i] = 0;
- for (int i = 0; i < DimIDs.length; i++)
- DimIDs[i] = 0;
+ Arrays.fill(weightPerWorld, 0);
+ Arrays.fill(DimIDs, 0);
for (GT_Worldgen_GT_Ore_Layer tWorldGen : GT_Worldgen_GT_Ore_Layer.sList)
mapOreLayerWrapper.put(tWorldGen.mWorldGenName, new OreLayerWrapper(tWorldGen));
for (OreLayerWrapper layer : mapOreLayerWrapper.values()) {
@@ -26,15 +29,15 @@ public class GT5OreLayerHelper {
}
public static String getDims(OreLayerWrapper oreLayer) {
- return GT5CFGHelper.GT5CFG(oreLayer.veinName.replace("ore.mix.custom.", "").replace("ore.mix.", ""));
+ return GT5CFGHelper.GT5CFG(
+ oreLayer.veinName.replace("ore.mix.custom" + ".", "").replace("ore.mix.", ""));
}
-
- public class OreLayerWrapper {
+ public static class OreLayerWrapper {
public String veinName, worldGenHeightRange;
public short[] Meta = new short[4];
public short randomWeight, size, density;
- public List<Integer> Weight = new ArrayList<Integer>();
+ public List<Integer> Weight = new ArrayList<>();
public OreLayerWrapper(GT_Worldgen_GT_Ore_Layer worldGen) {
this.veinName = worldGen.mWorldGenName;
@@ -47,6 +50,24 @@ public class GT5OreLayerHelper {
this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY;
this.randomWeight = worldGen.mWeight;
}
+
+ public List<ItemStack> getVeinLayerOre(int maximumMaterialIndex, int veinLayer) {
+ List<ItemStack> stackList = new ArrayList<>();
+ for (int i = 0; i < maximumMaterialIndex; i++) {
+ stackList.add(getLayerOre(veinLayer, i));
+ }
+ return stackList;
+ }
+
+ public ItemStack getLayerOre(int veinLayer, int materialIndex) {
+ return new ItemStack(GregTech_API.sBlockOres1, 1, Meta[veinLayer] + materialIndex * 1000);
+ }
+
+ public boolean containsOre(short materialIndex) {
+ return Meta[VEIN_PRIMARY] == materialIndex
+ || Meta[VEIN_SECONDARY] == materialIndex
+ || Meta[VEIN_BETWEEN] == materialIndex
+ || Meta[VEIN_SPORADIC] == materialIndex;
+ }
}
}
- \ No newline at end of file
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java
index 6dc155e9fd..a730b3d148 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java
@@ -6,20 +6,20 @@ import gregtech.api.enums.OrePrefixes;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.world.GT_Worldgen;
import gregtech.common.GT_Worldgen_GT_Ore_SmallPieces;
-import net.minecraft.item.ItemStack;
-
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import net.minecraft.item.ItemStack;
public class GT5OreSmallHelper {
+ private static final int SMALL_ORE_BASE_META = 16000;
public static boolean restrictBiomeSupport = false;
public static boolean gcBasicSupport = false;
- public static List<ItemStack> oreSmallList = new ArrayList<ItemStack>();
- public static HashMap<String, OreSmallWrapper> mapOreSmallWrapper = new HashMap<String, OreSmallWrapper>();
- public static HashMap<String, Short> mapOreDropUnlocalizedNameToOreMeta = new HashMap<String, Short>();
- public static HashMap<Short, List<ItemStack>> mapOreMetaToOreDrops = new HashMap<Short, List<ItemStack>>();
+ public static List<ItemStack> oreSmallList = new ArrayList<>();
+ public static HashMap<String, OreSmallWrapper> mapOreSmallWrapper = new HashMap<>();
+ public static HashMap<String, Short> mapOreDropUnlocalizedNameToOreMeta = new HashMap<>();
+ public static HashMap<Short, List<ItemStack>> mapOreMetaToOreDrops = new HashMap<>();
public static HashMap<OreSmallWrapper, String> bufferedDims = new HashMap<>();
public GT5OreSmallHelper() {
@@ -31,48 +31,63 @@ public class GT5OreSmallHelper {
if (worldGen.mWorldGenName.startsWith("ore.small.") && worldGen instanceof GT_Worldgen_GT_Ore_SmallPieces) {
GT_Worldgen_GT_Ore_SmallPieces worldGenSmallPieces = (GT_Worldgen_GT_Ore_SmallPieces) worldGen;
meta = worldGenSmallPieces.mMeta;
- if (meta < 0)
- break;
+ if (meta < 0) break;
material = GregTech_API.sGeneratedMaterials[meta];
mapOreSmallWrapper.put(worldGen.mWorldGenName, new OreSmallWrapper(worldGenSmallPieces));
- if (!mapOreMetaToOreDrops.keySet().contains(meta)) {
- List<ItemStack> stackList = new ArrayList<ItemStack>();
- stack = GT_OreDictUnificator.get(OrePrefixes.gemExquisite, material, GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L), 1L);
- if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {
+ if (!mapOreMetaToOreDrops.containsKey(meta)) {
+ List<ItemStack> stackList = new ArrayList<>();
+ stack = GT_OreDictUnificator.get(
+ OrePrefixes.gemExquisite,
+ material,
+ GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L),
+ 1L);
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) {
mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);
stackList.add(stack);
}
- stack = GT_OreDictUnificator.get(OrePrefixes.gemFlawless, material, GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L), 1L);
- if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {
+ stack = GT_OreDictUnificator.get(
+ OrePrefixes.gemFlawless,
+ material,
+ GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L),
+ 1L);
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) {
mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);
stackList.add(stack);
}
stack = GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L);
- if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) {
mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);
stackList.add(stack);
}
- stack = GT_OreDictUnificator.get(OrePrefixes.gemFlawed, material, GT_OreDictUnificator.get(OrePrefixes.crushed, material, 1L), 1L);
- if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {
+ stack = GT_OreDictUnificator.get(
+ OrePrefixes.gemFlawed,
+ material,
+ GT_OreDictUnificator.get(OrePrefixes.crushed, material, 1L),
+ 1L);
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) {
mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);
stackList.add(stack);
}
stack = GT_OreDictUnificator.get(OrePrefixes.crushed, material, 1L);
- if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) {
mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);
stackList.add(stack);
}
- stack = GT_OreDictUnificator.get(OrePrefixes.gemChipped, material, GT_OreDictUnificator.get(OrePrefixes.dustImpure, material, 1L), 1L);
- if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {
+ stack = GT_OreDictUnificator.get(
+ OrePrefixes.gemChipped,
+ material,
+ GT_OreDictUnificator.get(OrePrefixes.dustImpure, material, 1L),
+ 1L);
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) {
mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);
stackList.add(stack);
}
stack = GT_OreDictUnificator.get(OrePrefixes.dustImpure, material, 1L);
- if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) {
mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);
stackList.add(stack);
}
- oreSmallList.add(new ItemStack(GregTech_API.sBlockOres1, 1, meta + 16000));
+ oreSmallList.add(new ItemStack(GregTech_API.sBlockOres1, 1, meta + SMALL_ORE_BASE_META));
mapOreMetaToOreDrops.put(meta, stackList);
}
}
@@ -82,9 +97,9 @@ public class GT5OreSmallHelper {
}
private static void checkExtraSupport() {
- Class clazzGTOreSmall = null;
+ Class<?> clazzGTOreSmall = null;
try {
- clazzGTOreSmall = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_SmallPieces");
+ clazzGTOreSmall = Class.forName("gregtech.common" + ".GT_Worldgen_GT_Ore_SmallPieces");
} catch (ClassNotFoundException e) {
}
if (clazzGTOreSmall != null) {
@@ -103,10 +118,19 @@ public class GT5OreSmallHelper {
}
public static Materials[] getDroppedDusts() {
- return new Materials[]{Materials.Stone, Materials.Netherrack, Materials.Endstone, Materials.GraniteBlack, Materials.GraniteRed, Materials.Marble, Materials.Basalt, Materials.Stone};
+ return new Materials[] {
+ Materials.Stone,
+ Materials.Netherrack,
+ Materials.Endstone,
+ Materials.GraniteBlack,
+ Materials.GraniteRed,
+ Materials.Marble,
+ Materials.Basalt,
+ Materials.Stone
+ };
}
- public class OreSmallWrapper {
+ public static class OreSmallWrapper {
public String oreGenName;
public short oreMeta;
public String worldGenHeightRange;
@@ -119,5 +143,12 @@ public class GT5OreSmallHelper {
this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY;
this.amountPerChunk = worldGen.mAmount;
}
+
+ public List<ItemStack> getMaterialDrops(int maximumIndex) {
+ List<ItemStack> stackList = new ArrayList<>();
+ for (int i = 0; i < maximumIndex; i++)
+ stackList.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreMeta + SMALL_ORE_BASE_META + i * 1000));
+ return stackList;
+ }
}
}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java
index 78d43f1bdd..8cf6a8faac 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java
@@ -1,25 +1,23 @@
package pers.gwyog.gtneioreplugin.util;
-import java.lang.reflect.Field;
-
-import org.apache.logging.log4j.Level;
-
import codechicken.nei.recipe.GuiRecipe;
import cpw.mods.fml.common.FMLLog;
+import java.lang.reflect.Field;
import net.minecraft.client.Minecraft;
+import org.apache.logging.log4j.Level;
public class GuiRecipeHelper {
- private static final String INIT_ERROR = "pers.gwyog.gtneioreplugin.util.GuiRecipeHelper failed setting up reflection : ";
+ private static final String INIT_ERROR =
+ "pers.gwyog.gtneioreplugin.util.GuiRecipeHelper failed setting up reflection : ";
private static final int DEFAULT_XSIZE = 176;
- private static Class<GuiRecipe> guiRecipeClass;
public static Field xSizeField;
public static Field guiLeftField;
public static Field guiTopField;
/**
* Access the xSize field of a GuiRecipe instance, or use a fallback hardcoded value if that fails
- *
+ *
* @param gui GuiRecipe object
* @return Integer value of the xSize field of that object
*/
@@ -31,15 +29,14 @@ public class GuiRecipeHelper {
// Fail silently, hoping that it it fails it will be during initialization
}
}
-
+
// Fallback should work unless codechicken.nei.recipe.GuiRecipe implementation changes
return DEFAULT_XSIZE;
}
-
/**
* Access the guiLeft field of a GuiRecipe instance, or use a fallback hardcoded value if that fails
- *
+ *
* @param gui GuiRecipe object
* @return Integer value of the guiLeft field of that object
*/
@@ -51,14 +48,14 @@ public class GuiRecipeHelper {
// Fail silently, hoping that it it fails it will be during initialization
}
}
-
+
// Fallback should work unless codechicken.nei.recipe.GuiRecipe implementation changes
return (Minecraft.getMinecraft().currentScreen.width - DEFAULT_XSIZE) / 2;
}
-
+
/**
* Access the guiTop field of a GuiRecipe instance, or use a fallback hardcoded value if that fails
- *
+ *
* @param gui GuiRecipe object
* @return Integer value of the guiTop field of that object
*/
@@ -70,7 +67,7 @@ public class GuiRecipeHelper {
// Fail silently, hoping that it it fails it will be during initialization
}
}
-
+
// Fallback should work unless codechicken.nei.recipe.GuiRecipe implementation changes
int height = Minecraft.getMinecraft().currentScreen.height;
int ySize = Math.min(Math.max(height - 68, 166), 370);
@@ -81,15 +78,15 @@ public class GuiRecipeHelper {
* Initialize the GuiRecipe Field accessors through reflection
*/
public GuiRecipeHelper() {
- guiRecipeClass = GuiRecipe.class;
+ Class<GuiRecipe> guiRecipeClass = GuiRecipe.class;
try {
- guiLeftField = guiRecipeClass.getField("guiLeft");
+ guiLeftField = guiRecipeClass.getField("guiLeft");
guiLeftField.setAccessible(true);
guiTopField = guiRecipeClass.getField("guiTop");
guiTopField.setAccessible(true);
xSizeField = guiRecipeClass.getField("xSize");
xSizeField.setAccessible(true);
- } catch(NoSuchFieldException|SecurityException e) {
+ } catch (NoSuchFieldException | SecurityException e) {
FMLLog.log(Level.ERROR, INIT_ERROR + e.getMessage());
}
}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/OreVeinLayer.java b/src/main/java/pers/gwyog/gtneioreplugin/util/OreVeinLayer.java
new file mode 100644
index 0000000000..3bd684987e
--- /dev/null
+++ b/src/main/java/pers/gwyog/gtneioreplugin/util/OreVeinLayer.java
@@ -0,0 +1,21 @@
+package pers.gwyog.gtneioreplugin.util;
+
+public class OreVeinLayer {
+ public static final int VEIN_PRIMARY = 0;
+ public static final int VEIN_SECONDARY = 1;
+ public static final int VEIN_BETWEEN = 2;
+ public static final int VEIN_SPORADIC = 3;
+
+ private static final String[] LAYER_NAMES = {
+ "gtnop.gui.nei.primaryOre",
+ "gtnop.gui.nei.secondaryOre",
+ "gtnop.gui.nei.betweenOre",
+ "gtnop.gui" + ".nei.sporadicOre"
+ };
+
+ public static String getOreVeinLayerName(int layerId) {
+ return LAYER_NAMES[layerId];
+ }
+
+ private OreVeinLayer() {}
+}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java b/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java
index 559a11cca8..69941b6ba2 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java
@@ -7,98 +7,142 @@ public class Oremix {
@CsvCustomBindByName(column = "Moon", required = false, converter = XtoBool.class)
public boolean mo;
+
@CsvCustomBindByName(column = "End Asteroids", required = false, converter = XtoBool.class)
public boolean ea;
+
@CsvCustomBindByName(column = "AstroidBelt", required = false, converter = XtoBool.class)
public boolean as;
+
@CsvCustomBindByName(column = "Barnard C", required = false, converter = XtoBool.class)
public boolean bc;
+
@CsvCustomBindByName(column = "Barnard E", required = false, converter = XtoBool.class)
public boolean be;
+
@CsvCustomBindByName(column = "Barnard F", required = false, converter = XtoBool.class)
public boolean bf;
+
@CsvCustomBindByName(column = "Mars", required = false, converter = XtoBool.class)
public boolean ma;
+
@CsvCustomBindByName(column = "Callisto", required = false, converter = XtoBool.class)
public boolean ca;
+
@CsvCustomBindByName(column = "Centauri Bb", required = false, converter = XtoBool.class)
public boolean cb;
+
@CsvCustomBindByName(column = "Ceres", required = false, converter = XtoBool.class)
public boolean ce;
+
@CsvCustomBindByName(column = "Twilight Forest", required = false, converter = XtoBool.class)
public boolean tf;
+
@CsvCustomBindByName(column = "Deep Dark", required = false, converter = XtoBool.class)
public boolean dd;
+
@CsvCustomBindByName(column = "Phobos", required = false, converter = XtoBool.class)
public boolean ph;
+
@CsvCustomBindByName(column = "Deimos", required = false, converter = XtoBool.class)
public boolean de;
+
@CsvCustomBindByName(column = "Europa", required = false, converter = XtoBool.class)
public boolean eu;
+
@CsvCustomBindByName(column = "Ganymede", required = false, converter = XtoBool.class)
public boolean ga;
+
@CsvCustomBindByName(column = "Io", required = false, converter = XtoBool.class)
public boolean io;
+
@CsvCustomBindByName(column = "Venus", required = false, converter = XtoBool.class)
public boolean ve;
+
@CsvCustomBindByName(column = "Mercury", required = false, converter = XtoBool.class)
public boolean me;
+
@CsvCustomBindByName(column = "Enceladus", required = false, converter = XtoBool.class)
public boolean en;
+
@CsvCustomBindByName(column = "Titan", required = false, converter = XtoBool.class)
public boolean ti;
+
@CsvCustomBindByName(column = "Miranda", required = false, converter = XtoBool.class)
public boolean mi;
+
@CsvCustomBindByName(column = "Oberon", required = false, converter = XtoBool.class)
public boolean ob;
+
@CsvCustomBindByName(column = "Triton", required = false, converter = XtoBool.class)
public boolean tr;
+
@CsvCustomBindByName(column = "Proteus", required = false, converter = XtoBool.class)
public boolean pr;
+
@CsvCustomBindByName(column = "Pluto", required = false, converter = XtoBool.class)
public boolean pl;
+
@CsvCustomBindByName(column = "Kuiper Belt", required = false, converter = XtoBool.class)
public boolean kb;
+
@CsvCustomBindByName(column = "Haumea", required = false, converter = XtoBool.class)
public boolean ha;
+
@CsvCustomBindByName(column = "Makemake", required = false, converter = XtoBool.class)
public boolean make;
+
@CsvCustomBindByName(column = "Vega B", required = false, converter = XtoBool.class)
public boolean vb;
+
@CsvCustomBindByName(column = "T Ceti E", required = false, converter = XtoBool.class)
public boolean tcetie;
+
@CsvCustomBindByName(column = "Ore Name", required = true, converter = Veinrenamer.class)
private String oreName;
+
@CsvBindByName(column = "Primary", required = false)
private String primary = "";
+
@CsvBindByName(column = "Secondary", required = false)
private String secondary = "";
+
@CsvBindByName(column = "Inbetween", required = false)
private String inbetween = "";
+
@CsvBindByName(column = "Around", required = false)
private String around = "";
+
@CsvBindByName(column = "ID ", required = false)
private String mix = "";
+
@CsvBindByName(column = "Tier", required = false)
private String tier = "";
+
@CsvBindByName(column = "Height", required = false)
private String height = "";
+
@CsvBindByName(column = "Density", required = false)
private int density;
+
@CsvBindByName(column = "Size", required = false)
private int size;
+
@CsvBindByName(column = "Weight", required = false)
private int weight;
+
@CsvCustomBindByName(column = "Overworld", required = false, converter = XtoBool.class)
private boolean overworld;
+
@CsvCustomBindByName(column = "Nether", required = false, converter = XtoBool.class)
private boolean nether;
+
@CsvCustomBindByName(column = "End", required = false, converter = XtoBool.class)
private boolean end;
+
private int miny, maxy;
- public Oremix() {
- }
+ public Oremix() {}
public boolean isMo() {
return mo;
@@ -486,5 +530,4 @@ public class Oremix {
public String getHeightcalced() {
return new String(this.miny + "-" + this.maxy);
}
-
}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/StringPaddingHack.java b/src/main/java/pers/gwyog/gtneioreplugin/util/StringPaddingHack.java
index d4c340a9be..20e524ec41 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/util/StringPaddingHack.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/util/StringPaddingHack.java
@@ -1,8 +1,7 @@
package pers.gwyog.gtneioreplugin.util;
-import java.util.Arrays;
import com.google.common.base.Strings;
-
+import java.util.Arrays;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
@@ -13,15 +12,16 @@ public class StringPaddingHack {
/**
* Given a list of strings, arrange them into the requested number of columns with the specified spacing.
* Up to 3 additional spaces might be added between columns because this function relies on quirky font behaviors.
- *
+ *
* @param strings List of strings to wrap into columns
* @param numColumns Number of columns, minimum of 1
* @param minColumnSpacing Minimum amount of extra spaces between columns.
- * @return
+ * @return strings wrapped into columns
*/
public static String[] stringsToSpacedColumns(String[] strings, int numColumns, int minColumnSpacing) {
if (numColumns < 1) {
- throw new IllegalArgumentException(String.format("Argument numColumns must be 1 or higher, got value %d", numColumns));
+ throw new IllegalArgumentException(
+ String.format("Argument numColumns must be 1 or higher, got value %d", numColumns));
}
if (numColumns > 1) {
int sliceSize = strings.length / numColumns;
@@ -36,37 +36,37 @@ public class StringPaddingHack {
remainder--;
extra = 1;
}
- columns[i] = Arrays.copyOfRange(strings, (sliceSize * i) + totalExtra, (sliceSize * (i + 1) + totalExtra + extra));
+ columns[i] = Arrays.copyOfRange(
+ strings, (sliceSize * i) + totalExtra, (sliceSize * (i + 1) + totalExtra + extra));
totalExtra += extra;
}
// Add extra padding to all but the last columns to align the text
- for(int i = 0; i < numColumns - 1; i++) {
+ for (int i = 0; i < numColumns - 1; i++) {
columns[i] = padStrings(columns[i], minColumnSpacing);
}
-
+
// Concatenate all columns into the final result
- strings = columns[0];
- for (int i = 0; i < sliceSize; i++ ) {
- for (int j = 1; j < numColumns; j++ ) {
+ strings = columns[0];
+ for (int i = 0; i < sliceSize; i++) {
+ for (int j = 1; j < numColumns; j++) {
strings[i] += columns[j][i];
}
}
}
-
+
return strings;
}
-
/**
* Pads strings with spaces so that they are of equal length and adds to
* that the number of spaces specified and up to 3 if minExtraSpaces is
* below 3. Added spaces might be bold.
- *
+ *
* Relies on the quirk of bold space characters being 1 pixel wider than
* regular space characters in the default font renderer.
- *
+ *
* @param strings List of strings
* @param minExtraSpaces The minimum number of extra spaces to add
* @return List of strings padded with spaces to an equal length
@@ -76,7 +76,7 @@ public class StringPaddingHack {
int maxUnPaddedStrLength = 0;
int numSpacesAddedToLongestString = 0;
int maxPaddedStrLength = 0;
-
+
// Making string width a multiple of 4 by adding bold spaces of width 5
for (int i = 0; i < strings.length; i++) {
int mod = widths[i] % SPACE_WIDTH;
@@ -88,7 +88,7 @@ public class StringPaddingHack {
maxUnPaddedStrLength = widths[i];
}
- strings[i] += "§l" + Strings.repeat(" ", numBoldSpacesToAdd ) + "§r";
+ strings[i] += "§l" + Strings.repeat(" ", numBoldSpacesToAdd) + "§r";
widths[i] += numBoldSpacesToAdd * BOLD_SPACE_WIDTH;
// Keep track of the current widest string we currently have
@@ -96,7 +96,7 @@ public class StringPaddingHack {
maxPaddedStrLength = widths[i];
}
}
-
+
// Make sure we pad at least up to the desired number of spaces from the longest string
if (numSpacesAddedToLongestString < minExtraSpaces) {
maxPaddedStrLength += (minExtraSpaces - numSpacesAddedToLongestString) * SPACE_WIDTH;
@@ -114,7 +114,7 @@ public class StringPaddingHack {
/**
* Returns an array of font widths for the given array of strings
- *
+ *
* @param strList Array of strings
* @return Array of font widths
*/
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java b/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java
index a721d88e82..e80d972b17 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java
@@ -17,11 +17,9 @@ public class Veinrenamer<T> extends AbstractBeanField<T> {
ret = ret.replaceAll(" ", "");
ret = ret.replaceAll("\\.", "");
ret = ret.toLowerCase();
- } else
- ret = value;
+ } else ret = value;
ret = ret.replaceAll(" ", "");
ret = ret.toLowerCase();
return ret;
}
-
}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java b/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java
index c27a480557..98be50d989 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java
@@ -3,12 +3,11 @@ package pers.gwyog.gtneioreplugin.util;
import com.opencsv.bean.AbstractBeanField;
import com.opencsv.exceptions.CsvConstraintViolationException;
import com.opencsv.exceptions.CsvDataTypeMismatchException;
+import java.util.ResourceBundle;
import org.apache.commons.beanutils.ConversionException;
import org.apache.commons.beanutils.Converter;
import org.apache.commons.beanutils.converters.BooleanConverter;
-import java.util.ResourceBundle;
-
public class XtoBool<T> extends AbstractBeanField<T> {
@Override
@@ -23,13 +22,12 @@ public class XtoBool<T> extends AbstractBeanField<T> {
return bc.convert(Boolean.class, value.trim());
} catch (ConversionException e) {
CsvDataTypeMismatchException csve = new CsvDataTypeMismatchException(
- value, field.getType(), ResourceBundle
- .getBundle("convertGermanToBoolean", errorLocale)
- .getString("input.not.boolean"));
+ value,
+ field.getType(),
+ ResourceBundle.getBundle("convertGermanToBoolean", errorLocale)
+ .getString("input.not.boolean"));
csve.initCause(e);
throw csve;
}
}
-
-
}