aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorMartin Robertz <dream-master@gmx.net>2019-03-27 10:38:18 +0100
committerGitHub <noreply@github.com>2019-03-27 10:38:18 +0100
commit2f41352d694d94f48785546e6b30971718ae18de (patch)
tree394c7f7956aa0cfedd06e710ab13e2941d54155c /src/main/java
parentb68623b6d0af6476bb388eb64e55d205907c931c (diff)
parent3d7fafbff5a8e38e4207d3ca98288d07e2743c7f (diff)
downloadGT5-Unofficial-2f41352d694d94f48785546e6b30971718ae18de.tar.gz
GT5-Unofficial-2f41352d694d94f48785546e6b30971718ae18de.tar.bz2
GT5-Unofficial-2f41352d694d94f48785546e6b30971718ae18de.zip
Merge pull request #5 from bartimaeusnek/GTNH-Mod-SmallOres
1.0.7
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/Config.java25
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java42
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java25
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java19
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java91
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java149
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java394
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java272
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java189
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java291
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java60
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java104
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java914
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java33
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java23
15 files changed, 1436 insertions, 1195 deletions
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/Config.java b/src/main/java/pers/gwyog/gtneioreplugin/Config.java
index 62a94de43b..c31ebc63a6 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/Config.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/Config.java
@@ -1,19 +1,22 @@
package pers.gwyog.gtneioreplugin;
-import java.io.File;
-
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.common.config.Configuration;
+import java.io.File;
+
public class Config {
public Configuration tConfig;
- public Config(FMLPreInitializationEvent preinit,String cfgname) {
- File tFile = new File(preinit.getModConfigurationDirectory(), cfgname);
- tConfig = new Configuration(tFile);
- tConfig.load();
- }
- public void save () {
- tConfig.save();
- }
-
+
+ public Config(FMLPreInitializationEvent preinit, String cfgname) {
+ File tFile = new File(preinit.getModConfigurationDirectory(), cfgname);
+ tConfig = new Configuration(tFile);
+ tConfig.load();
+ }
+
+ public void 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 c781991fe6..c62a196bb4 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java
@@ -1,45 +1,53 @@
package pers.gwyog.gtneioreplugin;
-import java.util.HashSet;
-
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.relauncher.Side;
-import net.minecraft.init.Items;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper;
import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper;
+import java.util.HashSet;
+
@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 = "gtneioreplugin";
public static final String NAME = "GT NEI Ore Plugin GT:NH Mod";
public static final String VERSION = "@version@";
+ public static final Logger LOG = LogManager.getLogger(NAME);
public static boolean csv = false;
- public static String CSVname;
- public static HashSet OreV=new HashSet();
-
+ public static String CSVname;
+ public static String CSVnameSmall;
+ public static HashSet OreV = new HashSet();
+ public static boolean hideBackground = true;
+ public static boolean toolTips = true;
@Mod.Instance(MODID)
public static GTNEIOrePlugin instance;
-
+
@EventHandler
public void preinit(FMLPreInitializationEvent event) {
- Config c = new Config(event, this.MODID+".cfg");
- csv = c.tConfig.getBoolean("print csv","ALL", false, "princsv, 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");
- c.save();
+ Config c = new Config(event, this.MODID + ".cfg");
+ csv = c.tConfig.getBoolean("print csv", "ALL", false, "princsv, 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");
+ hideBackground = c.tConfig.getBoolean("Hide Background", "ALL", true, "Hides the Background when the tooltip for the Dimensions is rendered");
+ toolTips = c.tConfig.getBoolean("DimTooltip", "ALL", true, "Activates Dimensison Tooltips");
+
+ c.save();
}
-
+
@EventHandler
public void onLoadComplete(FMLLoadCompleteEvent event) {
if (event.getSide() == Side.CLIENT) {
- new GT5OreLayerHelper();
+ new GT5OreLayerHelper();
new GT5OreSmallHelper();
- if (csv) {
- new pers.gwyog.gtneioreplugin.util.CSVMaker().run();
- }
- }
+ if (csv) {
+ new pers.gwyog.gtneioreplugin.util.CSVMaker().run();
}
+ }
+ }
}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java
index 06133bebcc..8283b3b263 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java
@@ -2,12 +2,11 @@ package pers.gwyog.gtneioreplugin.plugin;
import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
-import cpw.mods.fml.common.Loader;
import pers.gwyog.gtneioreplugin.GTNEIOrePlugin;
-//import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5AsteroidStat;
import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5SmallOreStat;
import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat;
-import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper;
+
+//import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5AsteroidStat;
public class NEIPluginConfig implements IConfigureNEI {
@@ -23,14 +22,14 @@ public class NEIPluginConfig implements IConfigureNEI {
@Override
public void loadConfig() {
- PluginGT5VeinStat pluginVeinStat = new PluginGT5VeinStat();
- //PluginGT5AsteroidStat pluginAsteriodStat = new PluginGT5AsteroidStat();
- PluginGT5SmallOreStat pluginSmallOreStat = new PluginGT5SmallOreStat();
- API.registerRecipeHandler(pluginVeinStat);
- API.registerUsageHandler(pluginVeinStat);
- //API.registerRecipeHandler(pluginAsteriodStat);
- //API.registerUsageHandler(pluginAsteriodStat);
- API.registerRecipeHandler(pluginSmallOreStat);
- API.registerUsageHandler(pluginSmallOreStat);
- }
+ PluginGT5VeinStat pluginVeinStat = new PluginGT5VeinStat();
+ //PluginGT5AsteroidStat pluginAsteriodStat = new PluginGT5AsteroidStat();
+ PluginGT5SmallOreStat pluginSmallOreStat = new PluginGT5SmallOreStat();
+ API.registerRecipeHandler(pluginVeinStat);
+ API.registerUsageHandler(pluginVeinStat);
+ //API.registerRecipeHandler(pluginAsteriodStat);
+ //API.registerUsageHandler(pluginAsteriodStat);
+ API.registerRecipeHandler(pluginSmallOreStat);
+ API.registerUsageHandler(pluginSmallOreStat);
}
+}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java
index cbca2a66c6..9186eddcbd 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java
@@ -1,20 +1,19 @@
package pers.gwyog.gtneioreplugin.plugin;
-import java.awt.Rectangle;
-
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.recipe.TemplateRecipeHandler;
-import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRect;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.EnumChatFormatting;
+import java.awt.*;
+
public class PluginBase extends TemplateRecipeHandler {
@Override
public int recipiesPerPage() {
return 1;
}
-
+
@Override
public String getRecipeName() {
return null;
@@ -24,17 +23,17 @@ public class PluginBase extends TemplateRecipeHandler {
public String getGuiTexture() {
return "gtneioreplugin:textures/gui/nei/guiBase.png";
}
-
+
@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 String getOutputId() {
return null;
}
-
+
public String getWorldNameTranslated(boolean genOverworld) {
String worldNameTranslated = "";
if (genOverworld) {
@@ -44,9 +43,9 @@ public class PluginBase extends TemplateRecipeHandler {
}
return worldNameTranslated;
}
-
+
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 1d612d8c9c..88775c3e14 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java
@@ -1,31 +1,88 @@
package pers.gwyog.gtneioreplugin.plugin.gregtech5;
+import codechicken.lib.gui.GuiDraw;
+import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.util.GT_LanguageManager;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
import pers.gwyog.gtneioreplugin.plugin.PluginBase;
+import pers.gwyog.gtneioreplugin.util.DimensionHelper;
+
+import java.util.List;
+
+import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.hideBackground;
+import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.toolTips;
public class PluginGT5Base extends PluginBase {
-
- public 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;
+
+ protected boolean ttDisplayed = false;
+
+ protected static String getLocalizedNameForItem(Materials aMaterial, String aFormat) {
+ return String.format(aFormat.replace("%s", "%temp").replace("%material", "%s"), aMaterial.mDefaultLocalName).replace("%temp", "%s");
+ }
+
+ protected static int calculateMaxW(List L) {
+ int w = 0;
+ FontRenderer font = GuiDraw.fontRenderer;
+ for (int i = 0; i < L.size(); ++i) {
+ String s = (String) L.get(i);
+ w = Math.max(font.getStringWidth(s), w);
+ }
+ return w;
+ }
+
+ protected static String getLocalizedNameForItem(String aFormat, int aMaterialID) {
+ if (aMaterialID >= 0 && aMaterialID < 1000) {
+ Materials aMaterial = GregTech_API.sGeneratedMaterials[aMaterialID];
+ if (aMaterial != null) {
+ return getLocalizedNameForItem(aMaterial, aFormat);
+ }
+ }
+ return aFormat;
}
-
+
public static String getGTOreLocalizedName(short index) {
-
- if (!Materials.getLocalizedNameForItem(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)), index%1000).contains("Awakened"))
- return Materials.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";
}
-
- public static String getGTOreUnlocalizedName(short index) {
+
+ protected static String getGTOreUnlocalizedName(short index) {
return "gt.blockores." + index + ".name";
}
+ protected void drawToolTip(String sDimNames) {
+ if (toolTips) {
+ ttDisplayed = false;
+ if (GuiDraw.getMousePosition().y > (int) (Minecraft.getMinecraft().currentScreen.height * 0.6f) && GuiDraw.getMousePosition().y < (int) (Minecraft.getMinecraft().currentScreen.height * 0.8f)) {
+ List<String> dims = DimensionHelper.convertCondensedStringToToolTip(sDimNames);
+ int w = calculateMaxW(dims);
+ int x = GuiDraw.getMousePosition().x > Minecraft.getMinecraft().currentScreen.width / 2 ? this.getGuiWidth() - w - 8 : 0;
+ if (dims.size() > 10) {
+ List<String> dims2 = dims.subList(11, dims.size());
+ int w2 = calculateMaxW(dims2);
+ dims = dims.subList(0, 11);
+ w = calculateMaxW(dims);
+ GuiDraw.drawMultilineTip(x == 0 ? 16 + w : x - (w2 + 8), 108 - (dims.size() * 8), dims2);
+ }
+ GuiDraw.drawMultilineTip(x, 108 - (dims.size() * 8), dims);
+
+ ttDisplayed = hideBackground;
+ }
+ }
+ }
+
+ 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;
+ }
+
}
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 66ede68225..4a8e2174e3 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java
@@ -1,135 +1,140 @@
package pers.gwyog.gtneioreplugin.plugin.gregtech5;
-import java.awt.Rectangle;
-import java.util.ArrayList;
-import java.util.List;
-
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.PositionedStack;
import gregtech.api.GregTech_API;
-import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
-import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_OreDictUnificator;
-import gregtech.common.blocks.GT_Block_Ores_Abstract;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
-import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat.CachedVeinStatRecipe;
-import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper;
import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper;
-import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper;
import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper.OreSmallWrapper;
-public class PluginGT5SmallOreStat extends PluginGT5Base {
-
- public class CachedOreSmallRecipe extends CachedRecipe {
- public String oreGenName;
- public PositionedStack positionedStackOreSmall;
- public PositionedStack positionedStackMaterialDust;
- public List<PositionedStack> positionedDropStackList;
+import java.util.ArrayList;
+import java.util.List;
- 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>();
- int i = 1;
- for (ItemStack stackDrop: dropStackList)
- positionedDropStackList.add(new PositionedStack(stackDrop, 43+20*(i%4), 79+16*((i++)/4)+getRestrictBiomeOffset()));
- this.positionedDropStackList = positionedDropStackList;
- }
+public class PluginGT5SmallOreStat extends PluginGT5Base {
- @Override
- public List<PositionedStack> getIngredients() {
- positionedStackOreSmall.setPermutationToRender((cycleticks / 20) % positionedStackOreSmall.items.length);
- positionedStackMaterialDust.setPermutationToRender((cycleticks / 20) % positionedStackMaterialDust.items.length);
- positionedDropStackList.add(positionedStackOreSmall);
- positionedDropStackList.add(positionedStackMaterialDust);
- return positionedDropStackList;
-
- }
-
- @Override
- public PositionedStack getResult() {
- return null;
- }
-
- }
-
@Override
public void drawExtras(int recipe) {
CachedOreSmallRecipe crecipe = (CachedOreSmallRecipe) this.arecipes.get(recipe);
OreSmallWrapper oreSmall = GT5OreSmallHelper.mapOreSmallWrapper.get(crecipe.oreGenName);
- GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreName") + ": " + getGTOreLocalizedName((short)(oreSmall.oreMeta+16000)), 2, 18, 0x404040, false);
- 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);
- // GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreSmall.genOverworld, oreSmall.genNether, oreSmall.genEnd, oreSmall.genMoon, oreSmall.genMars), 2, 57, 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.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false);
+ String sDimNames = GT5OreSmallHelper.bufferedDims.get(oreSmall);
+ GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreName") + ": " + getGTOreLocalizedName((short) (oreSmall.oreMeta + 16000)), 2, 18, 0x404040, false);
+ drawToolTip(sDimNames);
+ if (!ttDisplayed) {
+ 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);
+ // GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreSmall.genOverworld, oreSmall.genNether, oreSmall.genEnd, oreSmall.genMoon, oreSmall.genMars), 2, 57, 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, 110, 0x404040, false);
+ if (sDimNames.length() > 36) {
+ GuiDraw.drawString(I18n.format("") + sDimNames.substring(0, 36), 2, 120, 0x404040, false);
+ if (sDimNames.length() > 70) {
+ GuiDraw.drawString(I18n.format("") + sDimNames.substring(36, 70), 2, 130, 0x404040, false);
+ GuiDraw.drawString(I18n.format("") + sDimNames.substring(70, sDimNames.length() - 1), 2, 140, 0x404040, false);
+ } else
+ GuiDraw.drawString(I18n.format("") + sDimNames.substring(36, sDimNames.length() - 1), 2, 130, 0x404040, false);
+ } else
+ GuiDraw.drawString(I18n.format("") + sDimNames.substring(0, sDimNames.length() - 1), 2, 120, 0x404040, false);
+ }
+ GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth() - 3, 5, 0x404040, false);
}
-
+
public int getRestrictBiomeOffset() {
- return GT5OreSmallHelper.restrictBiomeSupport? 0: -13;
+ return GT5OreSmallHelper.restrictBiomeSupport ? 0 : -13;
}
-
+
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getOutputId()))
- for (ItemStack stack: GT5OreSmallHelper.oreSmallList)
+ 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) {
+ if (stack.getItemDamage() < 16000) {
super.loadCraftingRecipes(stack);
return;
}
- short baseMeta = (short)(stack.getItemDamage() % 1000);
- for (OreSmallWrapper oreSmallWorldGen: GT5OreSmallHelper.mapOreSmallWrapper.values()) {
+ 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));
+ 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++)
+ 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())) {
+ } else if (GT5OreSmallHelper.mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {
short baseMeta = GT5OreSmallHelper.mapOreDropUnlocalizedNameToOreMeta.get(stack.getUnlocalizedName());
- for (String oreGenName: GT5OreSmallHelper.mapOreSmallWrapper.keySet()) {
+ 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));
+ 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++)
+ 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)));
}
}
- }
- else
+ } else
super.loadCraftingRecipes(stack);
}
-
+
@Override
public String getOutputId() {
return "GTOrePluginOreSmall";
}
-
+
@Override
public String getRecipeName() {
return I18n.format("gtnop.gui.smallOreStat.name");
}
+
+ 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) {
+ this.oreGenName = oreGenName;
+ this.positionedStackOreSmall = new PositionedStack(stackList, 2, 0);
+ this.positionedStackMaterialDust = new PositionedStack(materialDustStackList, 43, 79 + getRestrictBiomeOffset());
+ List<PositionedStack> positionedDropStackList = new ArrayList<PositionedStack>();
+ int i = 1;
+ for (ItemStack stackDrop : dropStackList)
+ 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);
+ 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 4cc76f2bf4..2c9f9d3298 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java
@@ -1,129 +1,171 @@
package pers.gwyog.gtneioreplugin.plugin.gregtech5;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import com.opencsv.bean.ColumnPositionMappingStrategy;
-import com.opencsv.bean.StatefulBeanToCsv;
-import com.opencsv.bean.StatefulBeanToCsvBuilder;
-import com.opencsv.exceptions.CsvDataTypeMismatchException;
-import com.opencsv.exceptions.CsvRequiredFieldEmptyException;
-
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.PositionedStack;
import gregtech.api.GregTech_API;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
-import pers.gwyog.gtneioreplugin.GTNEIOrePlugin;
-import pers.gwyog.gtneioreplugin.util.GT5CFGHelper;
import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper;
import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper;
-import pers.gwyog.gtneioreplugin.util.Oremix;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
public class PluginGT5VeinStat extends PluginGT5Base {
- public class CachedVeinStatRecipe extends CachedRecipe {
- public String veinName;
- public PositionedStack positionedStackPrimary;
- public PositionedStack positionedStackSecondary;
- public PositionedStack positionedStackBetween;
- public PositionedStack positionedStackSporadic;
-
- 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);
+ 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")};
+ }
+
+ 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]);
}
-
- @Override
- public List<PositionedStack> getIngredients() {
- List<PositionedStack> ingredientsList = new ArrayList<PositionedStack>();
- 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);
- ingredientsList.add(positionedStackSporadic);
- return ingredientsList;
}
-
- @Override
- public PositionedStack getResult() {
- return null;
+ return weightedChance;
+ }*/
+
+ 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] + " ";