diff options
Diffstat (limited to 'src/main/java/pers/gwyog')
6 files changed, 180 insertions, 90 deletions
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index fd0e6710b5..995e1a02da 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -12,7 +12,7 @@ import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; 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 = "1.0.4-GTNH"; + public static final String VERSION = "1.0.5-GTNH"; public static String GTVersion = "GT5"; 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 1a251ef514..242b27f23e 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java @@ -24,7 +24,11 @@ public class PluginGT5Base extends PluginBase { } public 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"; } public String getGTOreUnlocalizedName(short index) { 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 fd17e810b9..3aca184a8b 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -12,6 +12,7 @@ import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRect; +import cpw.mods.fml.common.FMLLog; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.util.GT_LanguageManager; @@ -121,36 +122,46 @@ public class PluginGT5VeinStat extends PluginGT5Base { CachedVeinStatRecipe crecipe = (CachedVeinStatRecipe) this.arecipes.get(recipe); OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); - if (getLocalizedVeinName(oreLayer).length()>20) { - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer).substring(0, 20), 2, 20, 0x404040, false); - if (getLocalizedVeinName(oreLayer).length()>40) { - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer).substring(20, 40), 2, 30, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer).substring(40, getLocalizedVeinName(oreLayer).length()), 2, 40, 0x404040, false); + if (getLocalizedVeinName(oreLayer).length>1) { + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[0], 2, 20, 0x404040, false); + if (getLocalizedVeinName(oreLayer).length>2) { + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[1], 2, 30, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[2], 2, 40, 0x404040, false); } else - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer).substring(20, getLocalizedVeinName(oreLayer).length()), 2, 30, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[1], 2, 30, 0x404040, false); } else - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer), 2, 20, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[0], 2, 20, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.primaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]), 2, 50, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.secondaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[1]), 2, 60, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[2]), 2, 70, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.sporadicOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[3]), 2, 80, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreLayer.worldGenHeightRange, 2, 90, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + Integer.toString(oreLayer.randomWeight), 100, 90, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 100, 0x404040, false); - GuiDraw.drawString(I18n.format("") + getDims(oreLayer), 2, 110, 0x404040, false); - // GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + getWeightedChance(oreLayer), 2, 122, 0x404040, false); + if (getDims(oreLayer).length()>36) { + GuiDraw.drawString(I18n.format("") + getDims(oreLayer).substring(0, 36), 2, 110, 0x404040, false); + if (getDims(oreLayer).length()>70) { + GuiDraw.drawString(I18n.format("") + getDims(oreLayer).substring(36, 70), 2, 120, 0x404040, false); + GuiDraw.drawString(I18n.format("") + getDims(oreLayer).substring(70, getDims(oreLayer).length()-1), 2, 130, 0x404040, false); + } + else + GuiDraw.drawString(I18n.format("") + getDims(oreLayer).substring(36, getDims(oreLayer).length()-1), 2, 120, 0x404040, false); + } + else + GuiDraw.drawString(I18n.format("") + getDims(oreLayer).substring(0, getDims(oreLayer).length()-1), 2, 110, 0x404040, false); //if (GT5OreLayerHelper.restrictBiomeSupport) GuiDraw.drawString(I18n.format("gtnop.gui.nei.restrictBiome") + ": " + getBiomeTranslated(oreLayer.restrictBiome), 2, 122, 0x404040, false); - //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); } - public String getLocalizedVeinName(OreLayerWrapper oreLayer) { + public String[] getLocalizedVeinName(OreLayerWrapper oreLayer) { String unlocalizedName = oreLayer.veinName; if (unlocalizedName.startsWith("ore.mix.custom.")) - return I18n.format(coustomVeinRenamer(oreLayer));//I18n.format("gtnop.ore.custom.name") + I18n.format("gtnop.ore.vein.name") + unlocalizedName.substring(15); + return get_Cnames(oreLayer);//I18n.format("gtnop.ore.custom.name") + I18n.format("gtnop.ore.vein.name") + unlocalizedName.substring(15); else - return I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.vein.name"); + return new String[] {I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.vein.name")}; } public String coustomVeinRenamer(OreLayerWrapper oreLayer) { @@ -162,9 +173,16 @@ public class PluginGT5VeinStat extends PluginGT5Base { .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() - .concat(" Vein"); + .trim(); } /*public String getWeightedChance(OreLayerWrapper oreLayer) { @@ -183,6 +201,57 @@ public class PluginGT5VeinStat extends PluginGT5Base { return GT5CFGHelper.GT5CFG(GregTech_API.sWorldgenFile.mConfig.getConfigFile(), oreLayer.veinName.replace("ore.mix.custom.", "").replace("ore.mix.", "")); } + public 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 < 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()<=20&&!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()>20)&&ret[2].length()+splt[i].length()<=20&&!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()<=15) + 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[1].isEmpty()&&!ret[0].isEmpty()) { + ret1[0] = ret[0]; + return ret1; + } + else + return ret; + } + @Override public String getOutputId() { return "GTOrePluginVein"; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java index d68dd65d69..f81e355f83 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -41,41 +41,45 @@ public class DimensionHelper { "Nether", "Overworld", "TheEnd", - "Vanilla_EndAsteroids"}; + "Vanilla_EndAsteroids", + "Twilight", + "Underdark"}; public static String[] DimNameDisplayed = { - "End Asteroids", - "Moon", - "Asteroids", - "Mars", - "BarnardC", - "BarnardE", - "BarnardF", - "Callisto", - "CentauriA", - "Ceres", - "Deimos", - "Enceladus", - "Europa", - "Ganymede", - "Haumea", + "EA", + "MO", + "AS", + "MA", + "BC", + "BE", + "BF", + "Ca", + "CeA", + "Ce", + "De", + "En", + "Eu", + "Ga", + "Ha", "Io", - "Kuiperbelt", - "MakeMake", - "Mercury", - "Miranda", - "Oberon", - "Phobos", - "Pluto", - "Proteus", - "TcetiE", - "Titan", - "Triton", - "VegaB", - "Venus", - "The Nether", - "Overworld", - "The End", - "Far End Asteroids"}; + "KB", + "MM", + "Me", + "Mi", + "Ob", + "Ph", + "Pu", + "Pr", + "TE", + "Ti", + "Tr", + "VB", + "Ve", + "Ne", + "OW", + "EN", + "VA", + "TF", + "DD"}; }
\ 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 b5fd6ad6e5..33f5604fa7 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java @@ -2,7 +2,6 @@ package pers.gwyog.gtneioreplugin.util; import java.io.BufferedReader; import java.io.File; -import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; @@ -17,7 +16,7 @@ public class GT5CFGHelper { public static String GT5CFG(File F, String Veinname) { //FMLLog.info(Veinname); if (F == null) { - FMLLog.bigWarning("GT_CFG_NOT_FOUND"); + FMLLog.bigWarning("GT_CFG_NOT_found[0]"); return "Error while Loading CFG"; } else @@ -26,41 +25,70 @@ public class GT5CFGHelper { if (buffer > F.length()) buffer = (int) F.length(); //allocate 10% of free memory for read-in-buffer, if there is less than filesize memory aviable - //FMLLog.info("GT_CFG_FOUND"); + //FMLLog.info("GT_CFG_found[0]"); FileReader in = new FileReader(F); //FMLLog.info("FileReader created"); BufferedReader reader = new BufferedReader(in, buffer); //FMLLog.info("BufferedReader" +Integer.toString(buffer)+"created"); - String st=""; + String st=null; List<String> raw= new ArrayList<String>(); List<String> rawbools = new ArrayList<String>(); - boolean found = false; + Boolean[] found = new Boolean[2]; + found[0] = false; + found[1] = false; do{ + //FMLLog.info("erste"); //read until reached eof or mix { st = reader.readLine(); //FMLLog.info("st: "+st); - if ((reader.readLine() != null)) - if (st.contains("mix {")) { - do{ - //read until reached eof or Veinname { + if (st != null && st.trim().equals("mix {")) { + while(!((st == null)||((st != null)&&found[0]))){ + //FMLLog.info("zweite"); st = reader.readLine(); + //read until reached eof or Veinname { //FMLLog.info("MIXst: "+st); - if ((reader.readLine() != null)) - if (st.contains(Veinname)) { - //FMLLog.info("VEINNAMEst: "+st); - //for (int i=0; i < 44;i++) - do{ - //add everything below Veinname { undtil } to raw - raw.add(reader.readLine()); - }while (!reader.readLine().contains("}")&&(reader.readLine() != null)); - found = true; + if (st != null && st.trim().equals(Veinname+" {")) { + //FMLLog.info("VEINNAMEst: "+st); + while (!((st == null)||((st != null)&&found[0]))){ + st = reader.readLine(); + if (st.trim().equals("}")) + found[0] = true; + //FMLLog.info("dritte"); + //add everything below Veinname { undtil } to raw + raw.add(st); + } + } } - }while((!found) || (reader.readLine() != null)); } - }while((!found) || (reader.readLine() != null)); - - reader.close();//not needed anymore + + if (st != null && st.trim().equals("dimensions {")) { + while(!((st == null)||((st != null)&&found[1]))){ + //FMLLog.info("zweite"); + st = reader.readLine(); + if (st != null && (st.trim().equals("mix {"))) { + while(!((st == null)||((st != null)&&found[1]))){ + //FMLLog.info("dritte"); + st = reader.readLine(); + //read until reached eof or Veinname { + //FMLLog.info("MIXst: "+st); + if (st != null && st.trim().equals(Veinname+" {")) { + //FMLLog.info("VEINNAMEst: "+st); + while (!((st == null)||((st != null)&&found[1]))){ + st = reader.readLine(); + if (st.trim().equals("}")) + found[1] = true; + //FMLLog.info("vierte"); + //add everything below Veinname { undtil } to raw + raw.add(st); + } + } + } + } + } + } + }while(st != null); + reader.close();//not needed anymore if (!raw.isEmpty()) for (int i=0; i < raw.size();i++) { @@ -75,16 +103,14 @@ public class GT5CFGHelper { String ret=" "; - //HashSet<String> rawboolsset = new HashSet<String>(); + HashSet<String> rawboolsset = new HashSet<String>(); if (!rawbools.isEmpty()) { //remove dublicats - /* for (int i=0; i < rawbools.size();i++){ - st = rawbools.get(i).replace("B:", "").replace("_true", "").replace("_false", "").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 for (int i=0; i < rawbools.size();i++) { st = rawbools.get(i); @@ -92,14 +118,14 @@ public class GT5CFGHelper { for (int j=0; j < DimensionHelper.DimName.length;j++) { if(st.contains(DimensionHelper.DimName[j])) if(st.contains("=true")) - ret=(ret+DimensionHelper.DimNameDisplayed[j]+" "); + ret=(ret+DimensionHelper.DimNameDisplayed[j]+","); } } } ret = ret.trim(); //FMLLog.info("ret:"+ret); if(ret.equals("")||ret.equals(" ")) - ret ="Not aviable in any Galactic Dim, maybe Deep Dark or Bedrock Dim"; + ret ="Not aviable in any Galactic Dim!"; return ret; } catch (IOException e) { e.printStackTrace(); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java index 4326475606..39173c756f 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java @@ -86,25 +86,12 @@ public class GT5OreSmallHelper { public String worldGenHeightRange; public short amountPerChunk; public String restrictBiome; - public boolean genOverworld = false; - public boolean genNether = false; - public boolean genEnd = false; - public boolean genMoon = false; - public boolean genMars = false; public OreSmallWrapper(GT_Worldgen_GT_Ore_SmallPieces worldGen) { this.oreGenName = worldGen.mWorldGenName; this.oreMeta = worldGen.mMeta; this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; this.amountPerChunk = worldGen.mAmount; - this.genOverworld = worldGen.mOverworld; - this.genNether = worldGen.mNether; - this.genEnd = worldGen.mEnd; - //if (GT5OreSmallHelper.restrictBiomeSupport) - // this.restrictBiome = worldGen.mRestrictBiome; - // if (GT5OreSmallHelper.gcBasicSupport) { - // this.genMoon = worldGen.mMoon; - // this.genMars = worldGen.mMars; } } } |