From 9066c13deea8a77c3e4828b4fcddf7cf0a096a74 Mon Sep 17 00:00:00 2001 From: LOKKO12 <33183715+LOKKO12@users.noreply.github.com> Date: Mon, 22 Jan 2018 18:56:12 +0100 Subject: - removed GT6 support - removed IE support - removed biome specific vein support - removed ShowAll button due to Memory Issures - fixed %material - try to read out config without modifying it - added Coustom Vein renamer --- .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 19 +-- .../gtneioreplugin/plugin/NEIPluginConfig.java | 29 +--- .../gwyog/gtneioreplugin/plugin/PluginBase.java | 28 +--- .../plugin/gregtech5/PluginGT5AsteroidStat.java | 29 ++-- .../plugin/gregtech5/PluginGT5Base.java | 3 +- .../plugin/gregtech5/PluginGT5IEVeinStat.java | 133 ----------------- .../plugin/gregtech5/PluginGT5SmallOreStat.java | 4 +- .../plugin/gregtech5/PluginGT5VeinStat.java | 111 +++++++++------ .../plugin/gregtech6/PluginGT6Base.java | 35 ----- .../plugin/gregtech6/PluginGT6BedrockOreStat.java | 113 --------------- .../plugin/gregtech6/PluginGT6SmallOreStat.java | 138 ------------------ .../plugin/gregtech6/PluginGT6VeinStat.java | 157 --------------------- .../gwyog/gtneioreplugin/util/DimensionHelper.java | 81 +++++++++++ .../gwyog/gtneioreplugin/util/GT5CFGHelper.java | 109 ++++++++++++++ .../gtneioreplugin/util/GT5OreLayerHelper.java | 109 ++------------ .../gtneioreplugin/util/GT5OreSmallHelper.java | 11 +- .../gtneioreplugin/util/GT6OreBedrockHelper.java | 36 ----- .../gtneioreplugin/util/GT6OreLayerHelper.java | 59 -------- .../gtneioreplugin/util/GT6OreSmallHelper.java | 87 ------------ 19 files changed, 301 insertions(+), 990 deletions(-) delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5IEVeinStat.java delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6Base.java delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6BedrockOreStat.java delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6SmallOreStat.java delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreBedrockHelper.java delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreSmallHelper.java (limited to 'src/main/java/pers') 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 getIngredients() { - List ingredientsList = new ArrayList(); - 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 stackListBetween = new ArrayList(); List stackListSporadic = new ArrayList(); 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 stackListPrimary = new ArrayList(); List stackListSecondary = new ArrayList(); List stackListBetween = new ArrayList(); List stackListSporadic = new ArrayList(); for (int i=0;i20) { + 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 s = new HashSet(); + 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 stackListOre, List 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 getIngredients() { - List ingredientsList = new ArrayList(); - 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 stackListOre = new ArrayList(); - List stackListOreSmall = new ArrayList(); - 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 positionedDropStackList; - - public CachedOreSmallRecipe(String oreGenName, List stackList, List materialDustStackList, List dropStackList) { - this.oreGenName = oreGenName; - this.positionedStackOreSmall = new PositionedStack(stackList, 2, 0); - this.positionedStackMaterialDust = new PositionedStack(materialDustStackList, 43, 67); - List positionedDropStackList = new ArrayList(); - 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 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 stackList = new ArrayList(); - List materialDustStackList = new ArrayList(); - 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 stackList = new ArrayList(); - List materialDustStackList = new ArrayList(); - 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 stackListPrimary, List stackListSecondary, - List stackListBetween, List 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 getIngredients() { - List ingredientsList = new ArrayList(); - positionedStackPrimary.setPermutationToRender((cycleticks / 20) % positionedStackPrimary.items.length);; - positionedStackSecondary.setPermutationToRender((cycleticks / 20) % positionedStackPrimary.items.length);; - positionedStackBetween.setPermutationToRender((cycleticks / 20) % positionedStackPrimary.items.length);; - positionedStackSporadic.setPermutationToRender((cycleticks / 20) % positionedStackPrimary.items.length);; - ingredientsList.add(positionedStackPrimary); - ingredientsList.add(positionedStackSecondary); - ingredientsList.add(positionedStackBetween); - 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 stackListPrimary = new ArrayList(); - List stackListSecondary = new ArrayList(); - List stackListBetween = new ArrayList(); - List stackListSporadic = new ArrayList(); - 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 stackListPrimary = new ArrayList(); - List stackListSecondary = new ArrayList(); - List stackListBetween = new ArrayList(); - List stackListSporadic = new ArrayList(); - 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]); - } -