diff options
Diffstat (limited to 'src/main/java/pers/gwyog')
19 files changed, 301 insertions, 990 deletions
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index 76132661c4..fd0e6710b5 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -5,19 +5,15 @@ import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLLoadCompleteEvent; import cpw.mods.fml.relauncher.Side; -import pers.gwyog.gtneioreplugin.util.GT6OreLayerHelper; -import pers.gwyog.gtneioreplugin.util.GT6OreSmallHelper; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; -import pers.gwyog.gtneioreplugin.util.GT6OreBedrockHelper; @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"; - public static final String VERSION = "1.0.4"; + public static final String NAME = "GT NEI Ore Plugin GT:NH Mod"; + public static final String VERSION = "1.0.4-GTNH"; - // default is GT5, however it will be "GT6" when GT6 is installed public static String GTVersion = "GT5"; @Mod.Instance(MODID) @@ -26,20 +22,9 @@ public class GTNEIOrePlugin { @EventHandler public void onLoadComplete(FMLLoadCompleteEvent event) { if (event.getSide() == Side.CLIENT) { - try { - Class clazzGT6API = Class.forName("gregapi.GT_API"); - GTVersion = "GT6"; - } catch (ClassNotFoundException e) {} - if (GTVersion.equals("GT5")) { new GT5OreLayerHelper(); new GT5OreSmallHelper(); } - else { - new GT6OreLayerHelper(); - new GT6OreSmallHelper(); - new GT6OreBedrockHelper(); - } } - } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java index 76cd9c4d18..d2cc0933d0 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java @@ -4,13 +4,9 @@ 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.PluginGT5IEVeinStat; +//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.plugin.gregtech6.PluginGT6BedrockOreStat; -import pers.gwyog.gtneioreplugin.plugin.gregtech6.PluginGT6SmallOreStat; -import pers.gwyog.gtneioreplugin.plugin.gregtech6.PluginGT6VeinStat; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; public class NEIPluginConfig implements IConfigureNEI { @@ -29,31 +25,14 @@ public class NEIPluginConfig implements IConfigureNEI { public void loadConfig() { if (GTNEIOrePlugin.GTVersion.equals("GT5")) { PluginGT5VeinStat pluginVeinStat = new PluginGT5VeinStat(); - PluginGT5AsteroidStat pluginAsteriodStat = new PluginGT5AsteroidStat(); + //PluginGT5AsteroidStat pluginAsteriodStat = new PluginGT5AsteroidStat(); PluginGT5SmallOreStat pluginSmallOreStat = new PluginGT5SmallOreStat(); API.registerRecipeHandler(pluginVeinStat); API.registerUsageHandler(pluginVeinStat); - API.registerRecipeHandler(pluginAsteriodStat); - API.registerUsageHandler(pluginAsteriodStat); + //API.registerRecipeHandler(pluginAsteriodStat); + //API.registerUsageHandler(pluginAsteriodStat); API.registerRecipeHandler(pluginSmallOreStat); API.registerUsageHandler(pluginSmallOreStat); - if (GT5OreLayerHelper.immersiveEngineeringSupport) { - PluginGT5IEVeinStat pluginIEVeinStat = new PluginGT5IEVeinStat(); - API.registerRecipeHandler(pluginIEVeinStat); - API.registerUsageHandler(pluginIEVeinStat); } } - else { - PluginGT6VeinStat pluginGT6VeinStat = new PluginGT6VeinStat(); - PluginGT6SmallOreStat pluginGT6SmallOreStat = new PluginGT6SmallOreStat(); - PluginGT6BedrockOreStat pluginGT6BedrockOreStat = new PluginGT6BedrockOreStat(); - API.registerRecipeHandler(pluginGT6VeinStat); - API.registerUsageHandler(pluginGT6VeinStat); - API.registerRecipeHandler(pluginGT6SmallOreStat); - API.registerUsageHandler(pluginGT6SmallOreStat); - API.registerRecipeHandler(pluginGT6BedrockOreStat); - API.registerUsageHandler(pluginGT6BedrockOreStat); - } } - -} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java index a554cf5f46..11b1b925f2 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java @@ -34,38 +34,14 @@ public class PluginBase extends TemplateRecipeHandler { public String getOutputId() { return null; } - - public String getBiomeTranslated(String unlocalizedBiome) { - return unlocalizedBiome.equals("None")? I18n.format("gtnop.biome.none.name"): unlocalizedBiome; - } - - public String getWorldNameTranslated(boolean genOverworld, boolean genNether, boolean genEnd, boolean genMoon, boolean genMars) { + + public String getWorldNameTranslated(boolean genOverworld) { String worldNameTranslated = ""; if (genOverworld) { if (!worldNameTranslated.isEmpty()) worldNameTranslated += ", "; worldNameTranslated += I18n.format("gtnop.world.overworld.name"); } - if (genNether) { - if (!worldNameTranslated.isEmpty()) - worldNameTranslated += ", "; - worldNameTranslated += I18n.format("gtnop.world.nether.name"); - } - if (genEnd) { - if (!worldNameTranslated.isEmpty()) - worldNameTranslated += ", "; - worldNameTranslated += I18n.format("gtnop.world.end.name"); - } - if (genMoon) { - if (!worldNameTranslated.isEmpty()) - worldNameTranslated += ", "; - worldNameTranslated += I18n.format("gtnop.world.moon.name"); - } - if (genMars) { - if (!worldNameTranslated.isEmpty()) - worldNameTranslated += ", "; - worldNameTranslated += I18n.format("gtnop.world.mars.name"); - } return worldNameTranslated; } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5AsteroidStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5AsteroidStat.java index 48e51a5367..b6c676dc70 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5AsteroidStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5AsteroidStat.java @@ -1,4 +1,4 @@ -package pers.gwyog.gtneioreplugin.plugin.gregtech5; +/*package pers.gwyog.gtneioreplugin.plugin.gregtech5; import java.awt.Rectangle; import java.util.ArrayList; @@ -57,10 +57,10 @@ public class PluginGT5AsteroidStat extends PluginGT5Base { CachedAsteroidStatRecipe crecipe = (CachedAsteroidStatRecipe) this.arecipes.get(recipe); OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedAsteroidName(oreLayer.veinName), 2, 18, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidPrimary") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.primaryMeta)), 2, 31, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSecondary") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.secondaryMeta)), 2, 44, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidBetween") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.betweenMeta)), 2, 57, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSporadic") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.sporadicMeta)), 2, 70, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidPrimary") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.Meta[0])), 2, 31, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSecondary") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.Meta[1])), 2, 44, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidBetween") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.Meta[2])), 2, 57, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSporadic") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.Meta[3])), 2, 70, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genEndAsteroid, oreLayer.genGCAsteroid), 2, 83, 0x404040, false); GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); } @@ -94,10 +94,10 @@ public class PluginGT5AsteroidStat extends PluginGT5Base { for (String veinName: GT5OreLayerHelper.mapOreLayerWrapper.keySet()) { oreLayerWrapper = GT5OreLayerHelper.mapOreLayerWrapper.get(veinName); if (oreLayerWrapper.genEndAsteroid || oreLayerWrapper.genGCAsteroid) { - ItemStack stackPrimary = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.primaryMeta+2000); - ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.secondaryMeta+2000); - ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.betweenMeta+2000); - ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.sporadicMeta+2000); + ItemStack stackPrimary = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[0]+2000); + ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[1]+2000); + ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[2]+2000); + ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[3]+2000); this.arecipes.add(new CachedAsteroidStatRecipe(veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); } } @@ -115,12 +115,12 @@ public class PluginGT5AsteroidStat extends PluginGT5Base { } short baseMeta = (short)(stack.getItemDamage() % 1000); for (OreLayerWrapper worldGen: GT5OreLayerHelper.mapOreLayerWrapper.values()) { - if (worldGen.primaryMeta == baseMeta || worldGen.secondaryMeta == baseMeta || worldGen.betweenMeta == baseMeta || worldGen.sporadicMeta == baseMeta) { + if (worldGen.Meta[0] == baseMeta || worldGen.Meta[1] == baseMeta || worldGen.Meta[2] == baseMeta || worldGen.Meta[3] == baseMeta) { if (worldGen.genEndAsteroid || worldGen.genGCAsteroid) { - ItemStack stackPrimary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.primaryMeta+2000); - ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.secondaryMeta+2000); - ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.betweenMeta+2000); - ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.sporadicMeta+2000); + ItemStack stackPrimary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[0]+2000); + ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[1]+2000); + ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[2]+2000); + ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[3]+2000); this.arecipes.add(new CachedAsteroidStatRecipe(worldGen.veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); } } @@ -140,3 +140,4 @@ public class PluginGT5AsteroidStat extends PluginGT5Base { return I18n.format("gtnop.gui.asteroidStat.name"); } } +*/
\ No newline at end of file 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 a61a8bb977..1a251ef514 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java @@ -5,6 +5,7 @@ import java.awt.Rectangle; import codechicken.lib.gui.GuiDraw; import codechicken.nei.recipe.TemplateRecipeHandler; import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRect; +import gregtech.api.enums.Materials; import gregtech.api.util.GT_LanguageManager; import net.minecraft.client.resources.I18n; import net.minecraft.util.EnumChatFormatting; @@ -23,7 +24,7 @@ public class PluginGT5Base extends PluginBase { } public String getGTOreLocalizedName(short index) { - return GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)); + return Materials.getLocalizedNameForItem(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)), index%1000); } public String getGTOreUnlocalizedName(short index) { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5IEVeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5IEVeinStat.java deleted file mode 100644 index 1d73ae5519..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5IEVeinStat.java +++ /dev/null @@ -1,133 +0,0 @@ -package pers.gwyog.gtneioreplugin.plugin.gregtech5; - -import java.util.ArrayList; -import java.util.List; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.TemplateRecipeHandler.CachedRecipe; -import gregtech.api.GregTech_API; -import gregtech.api.util.GT_LanguageManager; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; -import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; - -public class PluginGT5IEVeinStat extends PluginGT5Base { - - public class CachedIEVeinStatRecipe extends CachedRecipe { - public String veinName; - public PositionedStack positionedStackPrimary; - public PositionedStack positionedStackSecondary; - public PositionedStack positionedStackBetween; - public PositionedStack positionedStackSporadic; - - public CachedIEVeinStatRecipe(String veinName, ItemStack stackListPrimary, ItemStack stackListSecondary, - ItemStack stackListBetween, 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); - } - - @Override - public List<PositionedStack> getIngredients() { - List<PositionedStack> ingredientsList = new ArrayList<PositionedStack>(); - ingredientsList.add(positionedStackPrimary); - ingredientsList.add(positionedStackSecondary); - ingredientsList.add(positionedStackBetween); - ingredientsList.add(positionedStackSporadic); - return ingredientsList; - } - - @Override - public PositionedStack getResult() { - return null; - } - - } - - @Override - public void drawExtras(int recipe) { - CachedIEVeinStatRecipe crecipe = (CachedIEVeinStatRecipe) this.arecipes.get(recipe); - OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); - int stringLength1 = GuiDraw.getStringWidth(I18n.format("gtnop.gui.nei.weightedChance") + ": "); - int stringLength2 = GuiDraw.getStringWidth("40%"); - int beginXCoord = (stringLength1+stringLength2)/2; - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer.veinName), 2, 18, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.ieVeinComponent") + ": ", 2, 31, 0x404040, false); - GuiDraw.drawStringR("40.00%", beginXCoord+5, 44, 0x404040, false); - GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.primaryMeta)), 2+stringLength1, 44, 0x404040, false); - GuiDraw.drawStringR("40.00%", beginXCoord+5, 57, 0x404040, false); - GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.secondaryMeta)), 2+stringLength1, 57, 0x404040, false); - GuiDraw.drawStringR("15.00%", beginXCoord+5, 70, 0x404040, false); - GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.betweenMeta)), 2+stringLength1, 70, 0x404040, false); - GuiDraw.drawStringR("5.00%", beginXCoord+5, 83, 0x404040, false); - GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.sporadicMeta)), 2+stringLength1, 83, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + oreLayer.weightedIEChance, 2, 96, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.fromMod") + ": " + "Immersive Engineering", 2, 109, 0x404040, false); - GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); - } - - public String getLocalizedVeinName(String unlocalizedName) { - if (unlocalizedName.startsWith("ore.mix.custom.")) - return 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"); - } - - @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); - if (oreLayerWrapper.genIEVein) { - ItemStack stackPrimary = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.primaryMeta); - ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.secondaryMeta); - ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.betweenMeta); - ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.sporadicMeta); - this.arecipes.add(new CachedIEVeinStatRecipe(veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); - } - } - } - 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.primaryMeta == baseMeta || worldGen.secondaryMeta == baseMeta || worldGen.betweenMeta == baseMeta || worldGen.sporadicMeta == baseMeta) { - if (worldGen.genIEVein) { - ItemStack stackPrimary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.primaryMeta); - ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.secondaryMeta); - ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.betweenMeta); - ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.sporadicMeta); - this.arecipes.add(new CachedIEVeinStatRecipe(worldGen.veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); - } - } - } - } - else - super.loadCraftingRecipes(stack); - } - - @Override - public String getOutputId() { - return "GTOrePluginIEVeinCompat"; - } - - @Override - public String getRecipeName() { - return I18n.format("gtnop.gui.ieVeinStat.name"); - } -} 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 f1ddce6629..66ede68225 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java @@ -64,8 +64,8 @@ public class PluginGT5SmallOreStat extends PluginGT5Base { 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.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); } 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 fd9eb314ad..fd17e810b9 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -1,16 +1,19 @@ package pers.gwyog.gtneioreplugin.plugin.gregtech5; import java.awt.Rectangle; +import java.io.File; +import java.io.IOException; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; - -import org.apache.http.impl.conn.tsccm.ConnPoolByRoute; +import java.util.Set; import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRect; import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; import gregtech.api.util.GT_LanguageManager; import gregtech.common.GT_Worldgen_GT_Ore_Layer; import net.minecraft.client.gui.Gui; @@ -18,6 +21,8 @@ import net.minecraft.client.resources.I18n; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import pers.gwyog.gtneioreplugin.util.DimensionHelper; +import pers.gwyog.gtneioreplugin.util.GT5CFGHelper; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; @@ -71,10 +76,10 @@ public class PluginGT5VeinStat extends PluginGT5Base { 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.primaryMeta+i*1000)); - stackListSecondary.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.secondaryMeta+i*1000)); - stackListBetween.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.betweenMeta+i*1000)); - stackListSporadic.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.sporadicMeta+i*1000)); + 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)); } @@ -92,16 +97,16 @@ public class PluginGT5VeinStat extends PluginGT5Base { } short baseMeta = (short)(stack.getItemDamage() % 1000); for (OreLayerWrapper worldGen: GT5OreLayerHelper.mapOreLayerWrapper.values()) { - if (worldGen.primaryMeta == baseMeta || worldGen.secondaryMeta == baseMeta || worldGen.betweenMeta == baseMeta || worldGen.sporadicMeta == baseMeta) { + 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.primaryMeta+i*1000)); - stackListSecondary.add(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.secondaryMeta+i*1000)); - stackListBetween.add(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.betweenMeta+i*1000)); - stackListSporadic.add(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.sporadicMeta+i*1000)); + 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)); } @@ -110,58 +115,72 @@ public class PluginGT5VeinStat extends PluginGT5Base { else super.loadCraftingRecipes(stack); } - + @Override public void drawExtras(int recipe) { CachedVeinStatRecipe crecipe = (CachedVeinStatRecipe) this.arecipes.get(recipe); OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer.veinName), 2, 18, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.primaryOre") + ": " + getGTOreLocalizedName(oreLayer.primaryMeta), 2, 31, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.secondaryOre") + ": " + getGTOreLocalizedName(oreLayer.secondaryMeta), 2, 44, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + getGTOreLocalizedName(oreLayer.betweenMeta), 2, 57, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.sporadicOre") + ": " + getGTOreLocalizedName(oreLayer.sporadicMeta), 2, 70, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreLayer.worldGenHeightRange, 2, 83, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genOverworld, oreLayer.genNether, oreLayer.genEnd, oreLayer.genMoon, oreLayer.genMars), 2, 96, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + getWeightedChance(oreLayer.randomWeight, oreLayer.genOverworld, oreLayer.genNether, oreLayer.genEnd, oreLayer.genMoon, oreLayer.genMars), 2, 109, 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); + + 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); + } + else + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer).substring(20, getLocalizedVeinName(oreLayer).length()), 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.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.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 (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); } - public String getLocalizedVeinName(String unlocalizedName) { + public String getLocalizedVeinName(OreLayerWrapper oreLayer) { + + String unlocalizedName = oreLayer.veinName; if (unlocalizedName.startsWith("ore.mix.custom.")) - return I18n.format("gtnop.ore.custom.name") + I18n.format("gtnop.ore.vein.name") + unlocalizedName.substring(15); + return I18n.format(coustomVeinRenamer(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"); } - public String getWeightedChance(int randomWeight, boolean genOverworld, boolean genNether, boolean genEnd, boolean genMoon, boolean genMars) { + public 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(",","") + .trim() + .concat(" Vein"); + } + + /*public String getWeightedChance(OreLayerWrapper oreLayer) { String weightedChance = ""; - if (genOverworld && GT5OreLayerHelper.weightPerWorld[0] != 0) { + 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*randomWeight)/GT5OreLayerHelper.weightPerWorld[0]); + weightedChance += String.format("%.2f%%", (100.0f*oreLayer.Weight.get(i))/GT5OreLayerHelper.weightPerWorld[i]); } - if (genNether && GT5OreLayerHelper.weightPerWorld[1] != 0) { - if (!weightedChance.isEmpty()) - weightedChance += ", "; - weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT5OreLayerHelper.weightPerWorld[1]); - } - if (genEnd && GT5OreLayerHelper.weightPerWorld[2] != 0) { - if (!weightedChance.isEmpty()) - weightedChance += ", "; - weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT5OreLayerHelper.weightPerWorld[2]); - } - if (genMoon && GT5OreLayerHelper.weightPerWorld[3] != 0) { - if (!weightedChance.isEmpty()) - weightedChance += ", "; - weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT5OreLayerHelper.weightPerWorld[3]); - } - if (genMars && GT5OreLayerHelper.weightPerWorld[4] != 0) { - if (!weightedChance.isEmpty()) - weightedChance += ", "; - weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT5OreLayerHelper.weightPerWorld[4]); } return weightedChance; + }*/ + + public String getDims(OreLayerWrapper oreLayer) { + return GT5CFGHelper.GT5CFG(GregTech_API.sWorldgenFile.mConfig.getConfigFile(), oreLayer.veinName.replace("ore.mix.custom.", "").replace("ore.mix.", "")); } @Override diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6Base.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6Base.java deleted file mode 100644 index f047fbb1ab..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6Base.java +++ /dev/null @@ -1,35 +0,0 @@ -package pers.gwyog.gtneioreplugin.plugin.gregtech6; - -import gregapi.data.CS; -import gregapi.lang.LanguageHandler; -import net.minecraft.client.resources.I18n; -import pers.gwyog.gtneioreplugin.plugin.PluginBase; - -public class PluginGT6Base extends PluginBase { - - public static String getLocalizedOreName(short meta) { - // meta==-1 means OreDictMaterial is MT.NULL - if (meta==-1) - return I18n.format("gtnop.ore.null.name"); - else - return LanguageHandler.translate("oredict.ore" + CS.BlocksGT.ore.getMetaMaterial(meta).mNameInternal + ".name"); - } - - public static String getLocalizedSmallOreName(short meta) { - // meta==-1 means OreDictMaterial is MT.NULL - if (meta==-1) - return I18n.format("gtnop.ore.null.name"); - else - return LanguageHandler.translate("oredict.oreSmall" + CS.BlocksGT.oreSmall.getMetaMaterial(meta).mNameInternal + ".name"); - } - - public static String getLocalizedOreBedrockName(short meta) { - // meta==-1 means OreDictMaterial is MT.NULL - if (meta==-1) - return I18n.format("gtnop.ore.null.name"); - else - return LanguageHandler.translate("oredict.oreBedrock" + CS.BlocksGT.ore.getMetaMaterial(meta).mNameInternal + ".name"); - } - - -} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6BedrockOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6BedrockOreStat.java deleted file mode 100644 index daad693c56..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6BedrockOreStat.java +++ /dev/null @@ -1,113 +0,0 @@ -package pers.gwyog.gtneioreplugin.plugin.gregtech6; - -import java.util.ArrayList; -import java.util.List; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.TemplateRecipeHandler.CachedRecipe; -import gregapi.block.prefixblock.PrefixBlock; -import gregapi.data.CS; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import pers.gwyog.gtneioreplugin.util.GT6OreBedrockHelper; -import pers.gwyog.gtneioreplugin.util.GT6OreLayerHelper; -import pers.gwyog.gtneioreplugin.util.GT6OreSmallHelper; -import pers.gwyog.gtneioreplugin.util.GT6OreBedrockHelper.OreBedrockWrapper; - -public class PluginGT6BedrockOreStat extends PluginGT6Base { - - public class CachedBedrockOreStatRecipe extends CachedRecipe { - public String oreName; - public PositionedStack positionedStackOreBedrock; - public PositionedStack positionedStackOreSmallBedrock; - public PositionedStack positionedStackOre; - public PositionedStack positionedStackOreSmall; - - public CachedBedrockOreStatRecipe(String oreName, ItemStack stackOreBedrock, ItemStack stackOreSmallBedrock, - List<ItemStack> stackListOre, List<ItemStack> stackListOreSmall) { - this.oreName = oreName; - positionedStackOreBedrock = new PositionedStack(stackOreBedrock, 2, 0); - positionedStackOreSmallBedrock = new PositionedStack(stackOreSmallBedrock, 22, 0); - positionedStackOre = new PositionedStack(stackListOre, 42, 0); - positionedStackOreSmall = new PositionedStack(stackListOreSmall, 62, 0); - } - - @Override - public List<PositionedStack> getIngredients() { - List<PositionedStack> ingredientsList = new ArrayList<PositionedStack>(); - positionedStackOre.setPermutationToRender((cycleticks / 20) % positionedStackOre.items.length);; - positionedStackOreSmall.setPermutationToRender((cycleticks / 20) % positionedStackOreSmall.items.length);; - ingredientsList.add(positionedStackOreBedrock); - ingredientsList.add(positionedStackOreSmallBedrock); - ingredientsList.add(positionedStackOre); - ingredientsList.add(positionedStackOreSmall); - return ingredientsList; - } - - @Override - public PositionedStack getResult() { - return null; - } - - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals(getOutputId())) - for (OreBedrockWrapper worldGen: GT6OreBedrockHelper.mapOreBedrockWrapper.values()) - loadCraftingRecipes(new ItemStack(CS.BlocksGT.oreBedrock, 1, worldGen.meta)); - else - super.loadCraftingRecipes(outputId, results); - } - - @Override - public void loadCraftingRecipes(ItemStack stack) { - String unlocalizedName = stack.getUnlocalizedName(); - if (unlocalizedName.startsWith("oredict.oreBedrock") || unlocalizedName.startsWith("oredict.ore") || unlocalizedName.startsWith("oredict.oreSmall")) { - short meta = (short)stack.getItemDamage(); - for (OreBedrockWrapper worldGen: GT6OreBedrockHelper.mapOreBedrockWrapper.values()) { - if (meta==worldGen.meta) { - ItemStack stackOreBedrock = new ItemStack(CS.BlocksGT.oreBedrock, 1, meta); - ItemStack stackOreSmallBedrock = new ItemStack(CS.BlocksGT.oreSmallBedrock, 1, meta); - List<ItemStack> stackListOre = new ArrayList<ItemStack>(); - List<ItemStack> stackListOreSmall = new ArrayList<ItemStack>(); - for (PrefixBlock prefixBlock: GT6OreLayerHelper.setOreNormalBasicTypes) - stackListOre.add(new ItemStack(prefixBlock, 1, meta)); - for (PrefixBlock prefixBlock: GT6OreSmallHelper.setOreSmallBasicTypes) - stackListOreSmall.add(new ItemStack(prefixBlock, 1, meta)); - this.arecipes.add(new CachedBedrockOreStatRecipe(worldGen.veinName, stackOreBedrock, stackOreSmallBedrock, stackListOre, stackListOreSmall)); - } - } - } - else - super.loadCraftingRecipes(stack); - } - - @Override - public void drawExtras(int recipe) { - CachedBedrockOreStatRecipe crecipe = (CachedBedrockOreStatRecipe) this.arecipes.get(recipe); - OreBedrockWrapper oreLayer = GT6OreBedrockHelper.mapOreBedrockWrapper.get(crecipe.oreName); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreName") + ": " + getLocalizedOreBedrockName(oreLayer.meta), 2, 18, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreOthers") + ": " + getLocalizedSmallOreName(oreLayer.meta), 2, 31, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreOthers") + ": " + getLocalizedOreName(oreLayer.meta), 2, 44, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreOthers") + ": " + getLocalizedSmallOreName(oreLayer.meta), 2, 57, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + "0-6", 2, 70, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.nei.genPosition") + ": " + I18n.format("gtnop.nei.genPositionInfo"), 2,83, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + "1/" + oreLayer.probability, 2, 96, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genOverworld, oreLayer.genNether, oreLayer.genEnd, false, false), 2, 109, 0x404040, false); - GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); - } - - @Override - public String getOutputId() { - return "GTOrePluginOreBedrock"; - } - - @Override - public String getRecipeName() { - return I18n.format("gtnop.gui.bedrockOreStat.name"); - } - -} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6SmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6SmallOreStat.java deleted file mode 100644 index effcb5cc16..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6SmallOreStat.java +++ /dev/null @@ -1,138 +0,0 @@ -package pers.gwyog.gtneioreplugin.plugin.gregtech6; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.List; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.TemplateRecipeHandler.CachedRecipe; -import gregapi.block.IBlockPlacable; -import gregapi.block.behaviors.Drops_SmallOre; -import gregapi.block.prefixblock.PrefixBlock; -import gregapi.data.CS; -import gregapi.data.OP; -import gregapi.oredict.OreDictMaterial; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import pers.gwyog.gtneioreplugin.util.GT6OreSmallHelper; -import pers.gwyog.gtneioreplugin.util.GT6OreSmallHelper.OreSmallWrapper; - -public class PluginGT6SmallOreStat extends PluginGT6Base { - - 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, 67); - List<PositionedStack> positionedDropStackList = new ArrayList<PositionedStack>(); - int i = 1; - for (ItemStack stackDrop: dropStackList) - positionedDropStackList.add(new PositionedStack(stackDrop, 43+20*(i%5), 67+17*((i++)/5))); - 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; - } - - } - - @Override - public void drawExtras(int recipe) { - CachedOreSmallRecipe crecipe = (CachedOreSmallRecipe) this.arecipes.get(recipe); - OreSmallWrapper oreSmall = GT6OreSmallHelper.mapOreSmallWrapper.get(crecipe.oreGenName); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreName") + ": " + getLocalizedSmallOreName(oreSmall.oreMeta), 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, false, false), 2, 57, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.chanceDrops") + ": ", 2, 70, 0x404040, false); - GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals(getOutputId())) - for (ItemStack stack: GT6OreSmallHelper.oreSmallList) - loadCraftingRecipes(stack); - else - super.loadCraftingRecipes(outputId, results); - } - - @Override - public void loadCraftingRecipes(ItemStack stack) { - if (stack.getUnlocalizedName().startsWith("oredict.oreSmall") && !stack.isItemEqual(new ItemStack(CS.BlocksGT.oreSmallBedrock, 1, stack.getItemDamage()))) { - short meta = (short)stack.getItemDamage(); - for (OreSmallWrapper oreSmallWorldGen: GT6OreSmallHelper.mapOreSmallWrapper.values()) { - if (oreSmallWorldGen.oreMeta == meta) { - List<ItemStack> stackList = new ArrayList<ItemStack>(); - List<ItemStack> materialDustStackList = new ArrayList<ItemStack>(); - for (PrefixBlock prefixBlock: GT6OreSmallHelper.setOreSmallBasicTypes) { - stackList.add(new ItemStack(prefixBlock, 1, meta)); - Drops_SmallOre drops_SmallOre = ((Drops_SmallOre)prefixBlock.mDrops); - Class clazzDropsOreSmall = drops_SmallOre.getClass(); - try { - Field fieldSecondaryDrop = clazzDropsOreSmall.getDeclaredField("mSecondaryDrop"); - fieldSecondaryDrop.setAccessible(true); - OreDictMaterial oreDictMaterial = (OreDictMaterial)fieldSecondaryDrop.get(drops_SmallOre); - materialDustStackList.add(OP.dust.mat(oreDictMaterial.mTargetCrushing.mMaterial, 1L)); - } catch (Exception e) {} - } - this.arecipes.add(new CachedOreSmallRecipe(oreSmallWorldGen.oreGenName, stackList, materialDustStackList, GT6OreSmallHelper.mapOreMetaToOreDrops.get(meta))); - } - } - } - else if (GT6OreSmallHelper.mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) { - short meta = GT6OreSmallHelper.mapOreDropUnlocalizedNameToOreMeta.get(stack.getUnlocalizedName()); - for (String oreGenName: GT6OreSmallHelper.mapOreSmallWrapper.keySet()) { - OreSmallWrapper oreSmallWrapper = GT6OreSmallHelper.mapOreSmallWrapper.get(oreGenName); - if (oreSmallWrapper.oreMeta == meta) { - List<ItemStack> stackList = new ArrayList<ItemStack>(); - List<ItemStack> materialDustStackList = new ArrayList<ItemStack>(); - for (PrefixBlock prefixBlock: GT6OreSmallHelper.setOreSmallBasicTypes) { - stackList.add(new ItemStack(prefixBlock, 1, meta)); - Drops_SmallOre drops_OreSmall = ((Drops_SmallOre)prefixBlock.mDrops); - Class clazzDropsOreSmall = drops_OreSmall.getClass(); - try { - Field fieldSecondaryDrop = clazzDropsOreSmall.getDeclaredField("mSecondaryDrop"); - fieldSecondaryDrop.setAccessible(true); - OreDictMaterial oreDictMaterial = (OreDictMaterial)fieldSecondaryDrop.get(drops_OreSmall); - materialDustStackList.add(OP.dust.mat(oreDictMaterial.mTargetCrushing.mMaterial, 1L)); - } catch (Exception e) {} - } - this.arecipes.add(new CachedOreSmallRecipe(GT6OreSmallHelper.mapOreSmallWrapper.get(oreGenName).oreGenName, stackList, materialDustStackList, GT6OreSmallHelper.mapOreMetaToOreDrops.get(meta))); - } - } - } - else - super.loadCraftingRecipes(stack); - } - - @Override - public String getOutputId() { - return "GTOrePluginOreSmall"; - } - - @Override - public String getRecipeName() { - return I18n.format("gtnop.gui.smallOreStat.name"); - } - -} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java deleted file mode 100644 index 88bc814af4..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java +++ /dev/null @@ -1,157 +0,0 @@ -package pers.gwyog.gtneioreplugin.plugin.gregtech6; - -import java.util.ArrayList; -import java.util.List; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.TemplateRecipeHandler.CachedRecipe; -import gregapi.block.IBlockPlacable; -import gregapi.block.prefixblock.PrefixBlock; -import gregapi.data.CS; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import pers.gwyog.gtneioreplugin.util.GT6OreLayerHelper; -import pers.gwyog.gtneioreplugin.util.GT6OreLayerHelper.OreLayerWrapper; - -public class PluginGT6VeinStat extends PluginGT6Base { - - 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); - } - - @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; - } - - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals(getOutputId())) { - OreLayerWrapper oreLayerWrapper; - for (String veinName: GT6OreLayerHelper.mapOreLayerWrapper.keySet()) { - oreLayerWrapper = GT6OreLayerHelper.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 (PrefixBlock prefixBlock: GT6OreLayerHelper.setOreNormalBasicTypes) { - stackListPrimary.add(new ItemStack(prefixBlock, 1, oreLayerWrapper.primaryMeta)); - stackListSecondary.add(new ItemStack(prefixBlock, 1, oreLayerWrapper.secondaryMeta)); - stackListBetween.add(new ItemStack(prefixBlock, 1, oreLayerWrapper.betweenMeta)); - stackListSporadic.add(new ItemStack(prefixBlock, 1, oreLayerWrapper.sporadicMeta)); - } - this.arecipes.add(new CachedVeinStatRecipe(veinName, stackListPrimary, stackListSecondary, stackListBetween, stackListSporadic)); - } - } - else - super.loadCraftingRecipes(outputId, results); - } - - @Override - public void loadCraftingRecipes(ItemStack stack) { - String unlocalizedName = stack.getUnlocalizedName(); - if (unlocalizedName.startsWith("oredict.ore") && !unlocalizedName.startsWith("oredict.oreSmall") && !unlocalizedName.startsWith("oredict.oreBedrock")) { - short meta = (short)stack.getItemDamage(); - for (OreLayerWrapper worldGen: GT6OreLayerHelper.mapOreLayerWrapper.values()) { - if (meta==worldGen.primaryMeta || meta==worldGen.secondaryMeta || meta==worldGen.betweenMeta || meta==worldGen.sporadicMeta) { - 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 (PrefixBlock prefixBlock: GT6OreLayerHelper.setOreNormalBasicTypes) { - stackListPrimary.add(new ItemStack(prefixBlock, 1, worldGen.primaryMeta)); - stackListSecondary.add(new ItemStack(prefixBlock, 1, worldGen.secondaryMeta)); - stackListBetween.add(new ItemStack(prefixBlock, 1, worldGen.betweenMeta)); - stackListSporadic.add(new ItemStack(prefixBlock, 1, worldGen.sporadicMeta)); - } - this.arecipes.add(new CachedVeinStatRecipe(worldGen.veinName, stackListPrimary, stackListSecondary, stackListBetween, stackListSporadic)); - } - } - } - else - super.loadCraftingRecipes(stack); - } - - @Override - public void drawExtras(int recipe) { - CachedVeinStatRecipe crecipe = (CachedVeinStatRecipe) this.arecipes.get(recipe); - OreLayerWrapper oreLayer = GT6OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer.veinName), 2, 18, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.primaryOre") + ": " + getLocalizedOreName(oreLayer.primaryMeta), 2, 31, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.secondaryOre") + ": " + getLocalizedOreName(oreLayer.secondaryMeta), 2, 44, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + getLocalizedOreName(oreLayer.betweenMeta), 2, 57, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.sporadicOre") + ": " + getLocalizedOreName(oreLayer.sporadicMeta), 2, 70, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreLayer.worldGenHeightRange, 2, 83, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genOverworld, oreLayer.genNether, oreLayer.genEnd, false, false), 2, 96, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + getWeightedChance(oreLayer.randomWeight, oreLayer.genOverworld, oreLayer.genNether, oreLayer.genEnd), 2, 109, 0x404040, false); - GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); - } - - public String getLocalizedVeinName(String unlocalizedName) { - if (unlocalizedName.startsWith("ore.mix.custom.")) - return 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"); - } - - public String getWeightedChance(int randomWeight, boolean genOverworld, boolean genNether, boolean genEnd) { - String weightedChance = ""; - if (genOverworld && GT6OreLayerHelper.weightPerWorld[0] != 0) { - if (!weightedChance.isEmpty()) - weightedChance += ", "; - weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT6OreLayerHelper.weightPerWorld[0]); - } - if (genNether && GT6OreLayerHelper.weightPerWorld[1] != 0) { - if (!weightedChance.isEmpty()) - weightedChance += ", "; - weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT6OreLayerHelper.weightPerWorld[1]); - } - if (genEnd && GT6OreLayerHelper.weightPerWorld[2] != 0) { - if (!weightedChance.isEmpty()) - weightedChance += ", "; - weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT6OreLayerHelper.weightPerWorld[2]); - } - return weightedChance; - } - - @Override - public String getOutputId() { - return "GTOrePluginVein"; - } - - @Override - public String getRecipeName() { - return I18n.format("gtnop.gui.veinStat.name"); - } - -} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java new file mode 100644 index 0000000000..d68dd65d69 --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -0,0 +1,81 @@ +package pers.gwyog.gtneioreplugin.util; + +import net.minecraft.world.World; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.WorldServer; +import net.minecraftforge.common.DimensionManager; + +public class DimensionHelper { + + public static String[] DimName = + { + "EndAsteroid", + "GalacticraftCore_Moon", + "GalacticraftMars_Asteroids", + "GalacticraftMars_Mars", + "GalaxySpace_BarnardC", + "GalaxySpace_BarnardE", + "GalaxySpace_BarnardF", + "GalaxySpace_Callisto", + "GalaxySpace_CentauriA", + "GalaxySpace_Ceres", + "GalaxySpace_Deimos", + "GalaxySpace_Enceladus", + "GalaxySpace_Europa", + "GalaxySpace_Ganymede", + "GalaxySpace_Haumea", + "GalaxySpace_Io", + "GalaxySpace_Kuiperbelt", + "GalaxySpace_MakeMake", + "GalaxySpace_Mercury", + "GalaxySpace_Miranda", + "GalaxySpace_Oberon", + "GalaxySpace_Phobos", + "GalaxySpace_Pluto", + "GalaxySpace_Proteus", + "GalaxySpace_TcetiE", + "GalaxySpace_Titan", + "GalaxySpace_Triton", + "GalaxySpace_VegaB", + "GalaxySpace_Venus", + "Nether", + "Overworld", + "TheEnd", + "Vanilla_EndAsteroids"}; + + public static String[] DimNameDisplayed = + { + "End Asteroids", + "Moon", + "Asteroids", + "Mars", + "BarnardC", + "BarnardE", + "BarnardF", + "Callisto", + "CentauriA", + "Ceres", + "Deimos", + "Enceladus", + "Europa", + "Ganymede", + "Haumea", + "Io", + "Kuiperbelt", + "MakeMake", + "Mercury", + "Miranda", + "Oberon", + "Phobos", + "Pluto", + "Proteus", + "TcetiE", + "Titan", + "Triton", + "VegaB", + "Venus", + "The Nether", + "Overworld", + "The End", + "Far End Asteroids"}; +}
\ 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 new file mode 100644 index 0000000000..b5fd6ad6e5 --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java @@ -0,0 +1,109 @@ +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; +import java.util.HashSet; +import java.util.List; + +import cpw.mods.fml.common.FMLLog; + + +public class GT5CFGHelper { + + public static String GT5CFG(File F, String Veinname) { + //FMLLog.info(Veinname); + if (F == null) { + FMLLog.bigWarning("GT_CFG_NOT_FOUND"); + 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 aviable + //FMLLog.info("GT_CFG_FOUND"); + FileReader in = new FileReader(F); + //FMLLog.info("FileReader created"); + BufferedReader reader = new BufferedReader(in, buffer); + //FMLLog.info("BufferedReader" +Integer.toString(buffer)+"created"); + String st=""; + List<String> raw= new ArrayList<String>(); + List<String> rawbools = new ArrayList<String>(); + boolean found = false; + + do{ + //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 { + st = reader.readLine(); + //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; + } + }while((!found) || (reader.readLine() != null)); + } + }while((!found) || (reader.readLine() != null)); + + 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)); + 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)); + } + else FMLLog.info("raw is empty"); + + String ret=" "; + + //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(" ", ""); + 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); + //FMLLog.info("RawBools:"+st); + 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.trim(); + //FMLLog.info("ret:"+ret); + if(ret.equals("")||ret.equals(" ")) + ret ="Not aviable in any Galactic Dim, maybe Deep Dark or Bedrock Dim"; + return ret; + } catch (IOException e) { + e.printStackTrace(); + return "Error while Loading CFG"; + } + } +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index 80ea571719..9c94bf0029 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -15,119 +15,38 @@ import net.minecraft.item.ItemStack; import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; public class GT5OreLayerHelper { - public static boolean restrictBiomeSupport = false; - public static boolean endAsteroidSupport = false; - public static boolean gcBasicSupport = false; - public static boolean gcAsteroidSupport = false; - public static boolean immersiveEngineeringSupport = false; - public static int[] weightPerWorld = {0, 0, 0, 0, 0}; + + public static Integer weightPerWorld[] = new Integer[33]; + public static Integer DimIDs[] = new Integer[33]; public static HashMap<String, OreLayerWrapper> mapOreLayerWrapper = new HashMap<String, OreLayerWrapper>(); public GT5OreLayerHelper() { - checkExtraSupport(); + for (int i=0; i < DimIDs.length;i++) + weightPerWorld[i]=0; + for (int i=0; i < DimIDs.length;i++) + DimIDs[i]=0; for (GT_Worldgen_GT_Ore_Layer tWorldGen: GT_Worldgen_GT_Ore_Layer.sList) mapOreLayerWrapper.put(tWorldGen.mWorldGenName, new OreLayerWrapper(tWorldGen)); } - private static void checkExtraSupport() { - Class clazzGTOreLayer = null; - try { - clazzGTOreLayer = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_Layer"); - } catch (ClassNotFoundException e) {} - if (clazzGTOreLayer != null) { - try { - Field fieldRestrictBiome = clazzGTOreLayer.getField("mRestrictBiome"); - restrictBiomeSupport = true; - } catch (Exception e) {} - try { - Field fieldEndAsteroid = clazzGTOreLayer.getField("mEndAsteroid"); - endAsteroidSupport = true; - } catch (Exception e) {} - try { - Field fieldGCMoon = clazzGTOreLayer.getField("mMoon"); - Field fieldGCMars = clazzGTOreLayer.getField("mMars"); - gcBasicSupport = true; - } catch (Exception e) {} - try { - Field fieldGCAsteroid = clazzGTOreLayer.getField("mAsteroid"); - gcAsteroidSupport = true; - } catch (Exception e) {} - } - - // immersive engineering support for GT5.09.25+ - if (Loader.instance().isModLoaded("ImmersiveEngineering")) { - Class clazzGTMod = null; - Class clazzGTProxy = null; - Class clazzGTAPI = null; - try { - clazzGTMod = Class.forName("gregtech.GT_Mod"); - clazzGTProxy = Class.forName("gregtech.common.GT_Proxy"); - clazzGTAPI = Class.forName("gregtech.api.GregTech_API"); - } catch (ClassNotFoundException e) {} - if (clazzGTMod!=null && clazzGTProxy!=null && clazzGTAPI!=null) { - try { - Field fieldImmersiveEngineeringRecipes = clazzGTAPI.getField("mImmersiveEngineering"); - Field fieldGTProxy = clazzGTMod.getField("gregtechproxy"); - Field fieldImmersiveEngineering = clazzGTProxy.getField("mImmersiveEngineeringRecipes"); - immersiveEngineeringSupport = GregTech_API.mImmersiveEngineering && GT_Mod.gregtechproxy.mImmersiveEngineeringRecipes; - } catch (Exception e) {} - } - } - } - public class OreLayerWrapper { public String veinName; - public short primaryMeta; - public short secondaryMeta; - public short betweenMeta; - public short sporadicMeta; + public short[] Meta = new short[4]; public String worldGenHeightRange; public String weightedIEChance; - public String restrictBiome; public int randomWeight; - public boolean genOverworld = false; - public boolean genNether = false; - public boolean genEnd = false; - public boolean genMoon = false; - public boolean genMars = false; - public boolean genEndAsteroid = false; - public boolean genGCAsteroid = false; - public boolean genIEVein = false; + public List<Integer> Weight = new ArrayList<Integer>(); public OreLayerWrapper(GT_Worldgen_GT_Ore_Layer worldGen) { this.veinName = worldGen.mWorldGenName; - this.primaryMeta = worldGen.mPrimaryMeta; - this.secondaryMeta = worldGen.mSecondaryMeta; - this.betweenMeta = worldGen.mBetweenMeta; - this.sporadicMeta = worldGen.mSporadicMeta; + this.Meta[0] = worldGen.mPrimaryMeta; + this.Meta[1] = worldGen.mSecondaryMeta; + this.Meta[2] = worldGen.mBetweenMeta; + this.Meta[3] = worldGen.mSporadicMeta; this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; this.randomWeight = worldGen.mWeight; - this.genOverworld = worldGen.mOverworld; - this.genNether = worldGen.mNether; - this.genEnd = worldGen.mEnd; - weightPerWorld[0] += this.genOverworld ? this.randomWeight : 0; - weightPerWorld[1] += this.genNether ? this.randomWeight : 0; - weightPerWorld[2] += this.genEnd ? this.randomWeight : 0; - if (restrictBiomeSupport) - this.restrictBiome = worldGen.mRestrictBiome; - if (GT5OreLayerHelper.gcBasicSupport) { - this.genMoon = worldGen.mMoon; - this.genMars = worldGen.mMars; - weightPerWorld[3] += this.genMoon ? this.randomWeight : 0; - weightPerWorld[4] += this.genMars ? this.randomWeight : 0; - } - if (GT5OreLayerHelper.endAsteroidSupport) - this.genEndAsteroid = worldGen.mEndAsteroid; - if (GT5OreLayerHelper.gcAsteroidSupport) - this.genGCAsteroid = worldGen.mAsteroid; - - // immersive engineering support for GT5.09.25+ - if (immersiveEngineeringSupport) { - this.genIEVein = true; - this.weightedIEChance = String.format("%.3f%%", (100.0f*worldGen.mWeight)/GT_Worldgen_GT_Ore_Layer.sWeight/8); } } } - -} +
\ 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 69311a83ee..4326475606 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java @@ -100,12 +100,11 @@ public class GT5OreSmallHelper { 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; + //if (GT5OreSmallHelper.restrictBiomeSupport) + // this.restrictBiome = worldGen.mRestrictBiome; + // if (GT5OreSmallHelper.gcBasicSupport) { + // this.genMoon = worldGen.mMoon; + // this.genMars = worldGen.mMars; } } } -} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreBedrockHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreBedrockHelper.java deleted file mode 100644 index acae062f7c..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreBedrockHelper.java +++ /dev/null @@ -1,36 +0,0 @@ -package pers.gwyog.gtneioreplugin.util; - -import java.util.HashMap; - -import gregapi.worldgen.WorldgenObject; -import gregapi.worldgen.Worldgen_GT_Ore_Bedrock; -import gregapi.worldgen.Worldgenerator; - -public class GT6OreBedrockHelper { - public static HashMap<String, OreBedrockWrapper> mapOreBedrockWrapper = new HashMap<String, OreBedrockWrapper>(); - - public GT6OreBedrockHelper() { - for (WorldgenObject worldGenOreBedrock : Worldgenerator.sWorldgenList) - if (worldGenOreBedrock.mWorldGenName.startsWith("ore.bedrock.") && worldGenOreBedrock instanceof Worldgen_GT_Ore_Bedrock) - mapOreBedrockWrapper.put(worldGenOreBedrock.mWorldGenName, new OreBedrockWrapper((Worldgen_GT_Ore_Bedrock)worldGenOreBedrock)); - } - - public class OreBedrockWrapper { - public String veinName; - public short meta; - public int probability; - public boolean genOverworld = false; - public boolean genNether = false; - public boolean genEnd = false; - - public OreBedrockWrapper(Worldgen_GT_Ore_Bedrock worldGen) { - this.veinName = worldGen.mWorldGenName; - this.meta = worldGen.mMaterial.mID; - this.probability = worldGen.mProbability; - this.genOverworld = worldGen.mOverworld; - this.genNether = worldGen.mNether; - this.genEnd = worldGen.mEnd; - } - } - -} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java deleted file mode 100644 index bc0b40f5a1..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java +++ /dev/null @@ -1,59 +0,0 @@ -package pers.gwyog.gtneioreplugin.util; - -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Set; - -import gregapi.block.IBlockPlacable; -import gregapi.block.prefixblock.PrefixBlock; -import gregapi.data.CS; -import gregapi.worldgen.Worldgen_GT_Ore_Layer; -import gregtech.GT_Mod; -import net.minecraft.item.ItemStack; -import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; - -public class GT6OreLayerHelper { - public static int[] weightPerWorld = {0, 0, 0}; - public static HashMap<String, OreLayerWrapper> mapOreLayerWrapper = new HashMap<String, OreLayerWrapper>(); - public static Set<PrefixBlock> setOreNormalBasicTypes = new HashSet<PrefixBlock>(); - - public GT6OreLayerHelper() { - for (Worldgen_GT_Ore_Layer tWorldGen: Worldgen_GT_Ore_Layer.sList) - mapOreLayerWrapper.put(tWorldGen.mWorldGenName, new OreLayerWrapper(tWorldGen)); - Set<IBlockPlacable> setNormalOreBasicTypesTemp = new HashSet<IBlockPlacable>(CS.BlocksGT.stoneToNormalOres.values()); - for (IBlockPlacable block: setNormalOreBasicTypesTemp) - if (block instanceof PrefixBlock) - setOreNormalBasicTypes.add((PrefixBlock)block); - } - - public class OreLayerWrapper { - public String veinName; - public short primaryMeta; - public short secondaryMeta; - public short betweenMeta; - public short sporadicMeta; - public String worldGenHeightRange; - public int randomWeight; - public boolean genOverworld = false; - public boolean genNether = false; - public boolean genEnd = false; - - public OreLayerWrapper(Worldgen_GT_Ore_Layer worldGen) { - this.veinName = worldGen.mWorldGenName; - this.primaryMeta = worldGen.mPrimaryMeta; - this.secondaryMeta = worldGen.mSecondaryMeta; - this.betweenMeta = worldGen.mBetweenMeta; - this.sporadicMeta = worldGen.mSporadicMeta; - this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; - this.randomWeight = worldGen.mWeight; - this.genOverworld = worldGen.mOverworld; - this.genNether = worldGen.mNether; - this.genEnd = worldGen.mEnd; - weightPerWorld[0] += this.genOverworld ? this.randomWeight : 0; - weightPerWorld[1] += this.genNether ? this.randomWeight : 0; - weightPerWorld[2] += this.genEnd ? this.randomWeight : 0; - } - } - -} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreSmallHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreSmallHelper.java deleted file mode 100644 index 873f049856..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreSmallHelper.java +++ /dev/null @@ -1,87 +0,0 @@ -package pers.gwyog.gtneioreplugin.util; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import gregapi.block.IBlockPlacable; -import gregapi.block.prefixblock.PrefixBlock; -import gregapi.data.CS; -import gregapi.data.OP; -import gregapi.oredict.OreDictMaterial; -import gregapi.worldgen.WorldgenObject; -import gregapi.worldgen.Worldgen_GT_Ore_SmallPieces; -import gregapi.worldgen.Worldgenerator; -import net.minecraft.item.ItemStack; -import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; - -public class GT6OreSmallHelper { - 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 Set<PrefixBlock> setOreSmallBasicTypes = new HashSet<PrefixBlock>(); - - public GT6OreSmallHelper() { - ItemStack stack; - OreDictMaterial material; - PrefixBlock oreSmall = CS.BlocksGT.oreSmall; - short meta; - for (WorldgenObject worldGen : Worldgenerator.sWorldgenList) - if (worldGen.mWorldGenName.startsWith("ore.small.") && worldGen instanceof Worldgen_GT_Ore_SmallPieces) { - Worldgen_GT_Ore_SmallPieces worldGenSmallPieces = (Worldgen_GT_Ore_SmallPieces)worldGen; - meta = worldGenSmallPieces.mMeta; - material = oreSmall.getMetaMaterial(meta); - mapOreSmallWrapper.put(worldGen.mWorldGenName, new OreSmallWrapper(worldGenSmallPieces)); - if (!mapOreMetaToOreDrops.keySet().contains(meta)) { - List<ItemStack> stackList = new ArrayList<ItemStack>(); - stack = OP.gemExquisite.mat(material, OP.gem.mat(material, 1L), 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = OP.gemFlawless.mat(material, OP.gem.mat(material, 1L), 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = OP.gem.mat(material, 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = OP.gemFlawed.mat(material, OP.crushed.mat(material, 1L), 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = OP.crushed.mat(material, 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = OP.gemChipped.mat(material, OP.dustImpure.mat(material, 1L), 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = OP.dustImpure.mat(material, OP.dust.mat(material, 1L), 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = OP.gemLegendary.mat(material, 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - oreSmallList.add(new ItemStack(oreSmall, 1, meta)); - mapOreMetaToOreDrops.put(meta, stackList); - } - Set<IBlockPlacable> setSmallOreBasicTypesTemp = new HashSet<IBlockPlacable>(CS.BlocksGT.stoneToSmallOres.values()); - for (IBlockPlacable block: setSmallOreBasicTypesTemp) - if (block instanceof PrefixBlock) - setOreSmallBasicTypes.add((PrefixBlock)block); - } - } - - public class OreSmallWrapper { - public String oreGenName; - public short oreMeta; - public String worldGenHeightRange; - public String amountPerChunk; - public boolean genOverworld = false; - public boolean genNether = false; - public boolean genEnd = false; - - public OreSmallWrapper(Worldgen_GT_Ore_SmallPieces worldGen) { - this.oreGenName = worldGen.mWorldGenName; - this.oreMeta = worldGen.mMeta; - this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; - this.amountPerChunk = worldGen.mAmount/2 + "-" + (worldGen.mAmount/2 + (worldGen.mAmount+1)/2); - this.genOverworld = worldGen.mOverworld; - this.genNether = worldGen.mNether; - this.genEnd = worldGen.mEnd; - } - } - -} |