diff options
author | GWYOG <jjn1jjn2@163.com> | 2016-11-06 14:34:17 +0800 |
---|---|---|
committer | GWYOG <jjn1jjn2@163.com> | 2016-11-06 14:34:17 +0800 |
commit | 10f86d028093566285f9500da84961c86c8552a1 (patch) | |
tree | bad9802537ed61f77185429b37b9ddfde71f395f /src/main/java/pers | |
parent | 980f64738347a74416187001c53b5544960949a3 (diff) | |
download | GT5-Unofficial-10f86d028093566285f9500da84961c86c8552a1.tar.gz GT5-Unofficial-10f86d028093566285f9500da84961c86c8552a1.tar.bz2 GT5-Unofficial-10f86d028093566285f9500da84961c86c8552a1.zip |
Change code formatter - change tab to 4 spaces
Diffstat (limited to 'src/main/java/pers')
8 files changed, 600 insertions, 600 deletions
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index 09e2a99e7c..37ba99addf 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -15,19 +15,19 @@ import pers.gwyog.gtneioreplugin.util.GTSmallOreHelper; @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.1"; - + public static final String MODID = "gtneioreplugin"; + public static final String NAME = "GT NEI Ore Plugin"; + public static final String VERSION = "1.0.1"; + @Mod.Instance(MODID) public static GTNEIOrePlugin instance; @EventHandler - public void onLoadComplete(FMLLoadCompleteEvent event) { - if (event.getSide() == Side.CLIENT) { - new GTOreLayerHelper(); - new GTSmallOreHelper(); - } - } + public void onLoadComplete(FMLLoadCompleteEvent event) { + if (event.getSide() == Side.CLIENT) { + new GTOreLayerHelper(); + new GTSmallOreHelper(); + } + } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java index a4813c746b..0f1b0210b5 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java @@ -6,27 +6,27 @@ import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; public class NEIPluginConfig implements IConfigureNEI { - @Override - public String getName() { - return "GregTech Ore Plugin"; - } + @Override + public String getName() { + return "GregTech Ore Plugin"; + } - @Override - public String getVersion() { - return GTNEIOrePlugin.VERSION; - } + @Override + public String getVersion() { + return GTNEIOrePlugin.VERSION; + } - @Override - public void loadConfig() { - PluginVeinStat pluginVeinStat = new PluginVeinStat(); - PluginAsteroidStat pluginAsteriodStat = new PluginAsteroidStat(); - PluginSmallOreStat pluginSmallOreStat = new PluginSmallOreStat(); + @Override + public void loadConfig() { + PluginVeinStat pluginVeinStat = new PluginVeinStat(); + PluginAsteroidStat pluginAsteriodStat = new PluginAsteroidStat(); + PluginSmallOreStat pluginSmallOreStat = new PluginSmallOreStat(); API.registerRecipeHandler(pluginVeinStat); API.registerUsageHandler(pluginVeinStat); API.registerRecipeHandler(pluginAsteriodStat); API.registerUsageHandler(pluginAsteriodStat); API.registerRecipeHandler(pluginSmallOreStat); API.registerUsageHandler(pluginSmallOreStat); - } + } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java index 027d4fa035..acc00c01ef 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java @@ -19,117 +19,117 @@ import pers.gwyog.gtneioreplugin.util.GTOreLayerHelper.OreLayerWrapper; public class PluginAsteroidStat extends PluginBase { - public class CachedAsteroidStatRecipe extends CachedRecipe { - public String veinName; - public PositionedStack positionedStackPrimary; - public PositionedStack positionedStackSecondary; - public PositionedStack positionedStackBetween; - public PositionedStack positionedStackSporadic; - - public CachedAsteroidStatRecipe(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) { - CachedAsteroidStatRecipe crecipe = (CachedAsteroidStatRecipe) this.arecipes.get(recipe); - OreLayerWrapper oreLayer = GTOreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + I18n.format("gtnop." + oreLayer.veinName) + I18n.format("gtnop.ore.asteroid.name"), 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.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); - } - - public String getWorldNameTranslated(boolean genEndAsteroid, boolean genGCAsteroid) { - String worldNameTranslatedAsteroid = ""; - if (genEndAsteroid) { - if (!worldNameTranslatedAsteroid.isEmpty()) - worldNameTranslatedAsteroid += ", "; - worldNameTranslatedAsteroid += I18n.format("gtnop.world.end.name"); - } - if (genGCAsteroid) { - if (!worldNameTranslatedAsteroid.isEmpty()) - worldNameTranslatedAsteroid += ", "; - worldNameTranslatedAsteroid += I18n.format("gtnop.world.asteroid.name"); - } - return worldNameTranslatedAsteroid; - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals(getOutputId())) { - OreLayerWrapper oreLayerWrapper; - for (String veinName: GTOreLayerHelper.mapOreLayerWrapper.keySet()) { - oreLayerWrapper = GTOreLayerHelper.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); - this.arecipes.add(new CachedAsteroidStatRecipe(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: GTOreLayerHelper.mapOreLayerWrapper.values()) { - if (worldGen.primaryMeta == baseMeta || worldGen.secondaryMeta == baseMeta || worldGen.betweenMeta == baseMeta || worldGen.sporadicMeta == 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); - this.arecipes.add(new CachedAsteroidStatRecipe(worldGen.veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); - } - } - } - } - else - super.loadCraftingRecipes(stack); - } - - @Override - public String getOutputId() { - return "GTOrePluginAsteroid"; - } - - @Override - public String getRecipeName() { - return I18n.format("gtnop.gui.asteroidStat.name"); - } + public class CachedAsteroidStatRecipe extends CachedRecipe { + public String veinName; + public PositionedStack positionedStackPrimary; + public PositionedStack positionedStackSecondary; + public PositionedStack positionedStackBetween; + public PositionedStack positionedStackSporadic; + + public CachedAsteroidStatRecipe(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) { + CachedAsteroidStatRecipe crecipe = (CachedAsteroidStatRecipe) this.arecipes.get(recipe); + OreLayerWrapper oreLayer = GTOreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + I18n.format("gtnop." + oreLayer.veinName) + I18n.format("gtnop.ore.asteroid.name"), 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.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); + } + + public String getWorldNameTranslated(boolean genEndAsteroid, boolean genGCAsteroid) { + String worldNameTranslatedAsteroid = ""; + if (genEndAsteroid) { + if (!worldNameTranslatedAsteroid.isEmpty()) + worldNameTranslatedAsteroid += ", "; + worldNameTranslatedAsteroid += I18n.format("gtnop.world.end.name"); + } + if (genGCAsteroid) { + if (!worldNameTranslatedAsteroid.isEmpty()) + worldNameTranslatedAsteroid += ", "; + worldNameTranslatedAsteroid += I18n.format("gtnop.world.asteroid.name"); + } + return worldNameTranslatedAsteroid; + } + + @Override + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals(getOutputId())) { + OreLayerWrapper oreLayerWrapper; + for (String veinName: GTOreLayerHelper.mapOreLayerWrapper.keySet()) { + oreLayerWrapper = GTOreLayerHelper.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); + this.arecipes.add(new CachedAsteroidStatRecipe(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: GTOreLayerHelper.mapOreLayerWrapper.values()) { + if (worldGen.primaryMeta == baseMeta || worldGen.secondaryMeta == baseMeta || worldGen.betweenMeta == baseMeta || worldGen.sporadicMeta == 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); + this.arecipes.add(new CachedAsteroidStatRecipe(worldGen.veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); + } + } + } + } + else + super.loadCraftingRecipes(stack); + } + + @Override + public String getOutputId() { + return "GTOrePluginAsteroid"; + } + + @Override + public String getRecipeName() { + return I18n.format("gtnop.gui.asteroidStat.name"); + } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java index 0fbe12a597..33102a8248 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java @@ -11,85 +11,85 @@ import net.minecraft.util.EnumChatFormatting; public class PluginBase extends TemplateRecipeHandler { - @Override - public int recipiesPerPage() { - return 1; - } - - @Override - public String getRecipeName() { - return null; - } + @Override + public int recipiesPerPage() { + return 1; + } + + @Override + public String getRecipeName() { + return null; + } - @Override - public String getGuiTexture() { - return "gtneioreplugin:textures/gui/nei/guiBase.png"; - } - + @Override + public String getGuiTexture() { + return "gtneioreplugin:textures/gui/nei/guiBase.png"; + } + @Override public void loadTransferRects() { - int stringLength = GuiDraw.getStringWidth(EnumChatFormatting.BOLD + I18n.format("gui.nei.seeAll")); - transferRects.add(new RecipeTransferRect(new Rectangle(getGuiWidth()-stringLength-3, 5, stringLength, 9), getOutputId())); + int stringLength = GuiDraw.getStringWidth(EnumChatFormatting.BOLD + I18n.format("gui.nei.seeAll")); + transferRects.add(new RecipeTransferRect(new Rectangle(getGuiWidth()-stringLength-3, 5, stringLength, 9), getOutputId())); } - + public String getOutputId() { - return null; + return null; } public int getMaximumMaterialIndex(short meta, boolean smallOre) { - int offset = smallOre? 16000: 0; - if (!getGTOreLocalizedName((short)(meta+offset+5000)).equals(getGTOreUnlocalizedName((short)(meta+offset+5000)))) - return 7; - else if (!getGTOreLocalizedName((short)(meta+offset+5000)).equals(getGTOreUnlocalizedName((short)(meta+offset+5000)))) - return 6; - else - return 5; + int offset = smallOre? 16000: 0; + if (!getGTOreLocalizedName((short)(meta+offset+5000)).equals(getGTOreUnlocalizedName((short)(meta+offset+5000)))) + return 7; + else if (!getGTOreLocalizedName((short)(meta+offset+5000)).equals(getGTOreUnlocalizedName((short)(meta+offset+5000)))) + return 6; + else + return 5; } public String getGTOreLocalizedName(short index) { - return GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)); + return GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)); + } + + public String getGTOreUnlocalizedName(short index) { + return "gt.blockores." + index + ".name"; + } + + 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) { + 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; } - public String getGTOreUnlocalizedName(short index) { - return "gt.blockores." + index + ".name"; - } - - 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) { - 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; - } - - public int getGuiWidth() { - return 166; - } + public int getGuiWidth() { + return 166; + } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java index e68c9ac8ee..1aba8c8992 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java @@ -23,114 +23,114 @@ import pers.gwyog.gtneioreplugin.util.GTOreLayerHelper.OreLayerWrapper; import pers.gwyog.gtneioreplugin.util.GTSmallOreHelper.SmallOreWrapper; public class PluginSmallOreStat extends PluginBase { - - public class CachedSmallOreRecipe extends CachedRecipe { - public String oreGenName; - public PositionedStack positionedStackSmallOre; - public PositionedStack positionedStackMaterialDust; - public List<PositionedStack> positionedDropStackList; + + public class CachedSmallOreRecipe extends CachedRecipe { + public String oreGenName; + public PositionedStack positionedStackSmallOre; + public PositionedStack positionedStackMaterialDust; + public List<PositionedStack> positionedDropStackList; - public CachedSmallOreRecipe(String oreGenName, List<ItemStack> stackList, List<ItemStack> materialDustStackList, List<ItemStack> dropStackList) { - this.oreGenName = oreGenName; - this.positionedStackSmallOre = new PositionedStack(stackList, 2, 0); - this.positionedStackMaterialDust = new PositionedStack(materialDustStackList, 43, 79+getRestrictBiomeOffset()); - List<PositionedStack> positionedDropStackList = new ArrayList<PositionedStack>(); - int i = 1; - for (ItemStack stackDrop: dropStackList) - positionedDropStackList.add(new PositionedStack(stackDrop, 43+20*(i%4), 79+16*((i++)/4)+getRestrictBiomeOffset())); - this.positionedDropStackList = positionedDropStackList; - } + public CachedSmallOreRecipe(String oreGenName, List<ItemStack> stackList, List<ItemStack> materialDustStackList, List<ItemStack> dropStackList) { + this.oreGenName = oreGenName; + this.positionedStackSmallOre = new PositionedStack(stackList, 2, 0); + this.positionedStackMaterialDust = new PositionedStack(materialDustStackList, 43, 79+getRestrictBiomeOffset()); + List<PositionedStack> positionedDropStackList = new ArrayList<PositionedStack>(); + int i = 1; + for (ItemStack stackDrop: dropStackList) + positionedDropStackList.add(new PositionedStack(stackDrop, 43+20*(i%4), 79+16*((i++)/4)+getRestrictBiomeOffset())); + this.positionedDropStackList = positionedDropStackList; + } - @Override - public List<PositionedStack> getIngredients() { - positionedStackSmallOre.setPermutationToRender((cycleticks / 20) % positionedStackSmallOre.items.length); - positionedStackMaterialDust.setPermutationToRender((cycleticks / 20) % positionedStackMaterialDust.items.length); - positionedDropStackList.add(positionedStackSmallOre); - positionedDropStackList.add(positionedStackMaterialDust); - return positionedDropStackList; - - } - - @Override - public PositionedStack getResult() { - return null; - } - - } - - @Override - public void drawExtras(int recipe) { - CachedSmallOreRecipe crecipe = (CachedSmallOreRecipe) this.arecipes.get(recipe); - SmallOreWrapper smallOre = GTSmallOreHelper.mapSmallOreWrapper.get(crecipe.oreGenName); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreName") + ": " + getGTOreLocalizedName((short)(smallOre.oreMeta+16000)), 2, 18, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + smallOre.worldGenHeightRange, 2, 31, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.amount") + ": " + smallOre.amountPerChunk, 2, 44, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(smallOre.genOverworld, smallOre.genNether, smallOre.genEnd, smallOre.genMoon, smallOre.genMars), 2, 57, 0x404040, false); - if (GTSmallOreHelper.restrictBiomeSupport) GuiDraw.drawString(I18n.format("gtnop.gui.nei.restrictBiome") + ": " + getBiomeTranslated(smallOre.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); - } - - public int getRestrictBiomeOffset() { - return GTSmallOreHelper.restrictBiomeSupport? 0: -13; - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals(getOutputId())) - for (ItemStack stack: GTSmallOreHelper.smallOreList) - loadCraftingRecipes(stack); - else - super.loadCraftingRecipes(outputId, results); - } - - @Override - public void loadCraftingRecipes(ItemStack stack) { - if (stack.getUnlocalizedName().startsWith("gt.blockores")) { - if (stack.getItemDamage()<16000) { - super.loadCraftingRecipes(stack); - return; - } - short baseMeta = (short)(stack.getItemDamage() % 1000); - for (SmallOreWrapper smallOreWorldGen: GTSmallOreHelper.mapSmallOreWrapper.values()) { - if (smallOreWorldGen.oreMeta == baseMeta) { - List<ItemStack> stackList = new ArrayList<ItemStack>(); - int maximumIndex = getMaximumMaterialIndex(baseMeta, true); - for (int i=0;i<maximumIndex;i++) - stackList.add(new ItemStack(GregTech_API.sBlockOres1, 1, smallOreWorldGen.oreMeta+16000+i*1000)); - List<ItemStack> materialDustStackList = new ArrayList<ItemStack>(); - for (int i=0;i<maximumIndex;i++) - materialDustStackList.add(GT_OreDictUnificator.get(OrePrefixes.dust, GTSmallOreHelper.getDroppedDusts()[i], 1L)); - this.arecipes.add(new CachedSmallOreRecipe(smallOreWorldGen.oreGenName, stackList, materialDustStackList, GTSmallOreHelper.mapOreMetaToOreDrops.get(baseMeta))); - } - } - } - else if (GTSmallOreHelper.mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) { - short baseMeta = GTSmallOreHelper.mapOreDropUnlocalizedNameToOreMeta.get(stack.getUnlocalizedName()); - for (String oreGenName: GTSmallOreHelper.mapSmallOreWrapper.keySet()) { - SmallOreWrapper smallOreWrapper = GTSmallOreHelper.mapSmallOreWrapper.get(oreGenName); - if (smallOreWrapper.oreMeta == baseMeta) { - List<ItemStack> stackList = new ArrayList<ItemStack>(); - for (int i=0;i<7;i++) - stackList.add(new ItemStack(GregTech_API.sBlockOres1, 1, baseMeta+16000+i*1000)); - List<ItemStack> materialDustStackList = new ArrayList<ItemStack>(); - for (int i=0;i<7;i++) - materialDustStackList.add(GT_OreDictUnificator.get(OrePrefixes.dust, GTSmallOreHelper.getDroppedDusts()[i], 1L)); - this.arecipes.add(new CachedSmallOreRecipe(GTSmallOreHelper.mapSmallOreWrapper.get(oreGenName).oreGenName, stackList, materialDustStackList, GTSmallOreHelper.mapOreMetaToOreDrops.get(baseMeta))); - } - } - } - else - super.loadCraftingRecipes(stack); - } - - @Override - public String getOutputId() { - return "GTOrePluginSmallOre"; - } + @Override + public List<PositionedStack> getIngredients() { + positionedStackSmallOre.setPermutationToRender((cycleticks / 20) % positionedStackSmallOre.items.length); + positionedStackMaterialDust.setPermutationToRender((cycleticks / 20) % positionedStackMaterialDust.items.length); + positionedDropStackList.add(positionedStackSmallOre); + positionedDropStackList.add(positionedStackMaterialDust); + return positionedDropStackList; + + } - @Override - public String getRecipeName() { - return I18n.format("gtnop.gui.smallOreStat.name"); - } + @Override + public PositionedStack getResult() { + return null; + } + + } + + @Override + public void drawExtras(int recipe) { + CachedSmallOreRecipe crecipe = (CachedSmallOreRecipe) this.arecipes.get(recipe); + SmallOreWrapper smallOre = GTSmallOreHelper.mapSmallOreWrapper.get(crecipe.oreGenName); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreName") + ": " + getGTOreLocalizedName((short)(smallOre.oreMeta+16000)), 2, 18, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + smallOre.worldGenHeightRange, 2, 31, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.amount") + ": " + smallOre.amountPerChunk, 2, 44, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(smallOre.genOverworld, smallOre.genNether, smallOre.genEnd, smallOre.genMoon, smallOre.genMars), 2, 57, 0x404040, false); + if (GTSmallOreHelper.restrictBiomeSupport) GuiDraw.drawString(I18n.format("gtnop.gui.nei.restrictBiome") + ": " + getBiomeTranslated(smallOre.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); + } + + public int getRestrictBiomeOffset() { + return GTSmallOreHelper.restrictBiomeSupport? 0: -13; + } + + @Override + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals(getOutputId())) + for (ItemStack stack: GTSmallOreHelper.smallOreList) + loadCraftingRecipes(stack); + else + super.loadCraftingRecipes(outputId, results); + } + + @Override + public void loadCraftingRecipes(ItemStack stack) { + if (stack.getUnlocalizedName().startsWith("gt.blockores")) { + if (stack.getItemDamage()<16000) { + super.loadCraftingRecipes(stack); + return; + } + short baseMeta = (short)(stack.getItemDamage() % 1000); + for (SmallOreWrapper smallOreWorldGen: GTSmallOreHelper.mapSmallOreWrapper.values()) { + if (smallOreWorldGen.oreMeta == baseMeta) { + List<ItemStack> stackList = new ArrayList<ItemStack>(); + int maximumIndex = getMaximumMaterialIndex(baseMeta, true); + for (int i=0;i<maximumIndex;i++) + stackList.add(new ItemStack(GregTech_API.sBlockOres1, 1, smallOreWorldGen.oreMeta+16000+i*1000)); + List<ItemStack> materialDustStackList = new ArrayList<ItemStack>(); + for (int i=0;i<maximumIndex;i++) + materialDustStackList.add(GT_OreDictUnificator.get(OrePrefixes.dust, GTSmallOreHelper.getDroppedDusts()[i], 1L)); + this.arecipes.add(new CachedSmallOreRecipe(smallOreWorldGen.oreGenName, stackList, materialDustStackList, GTSmallOreHelper.mapOreMetaToOreDrops.get(baseMeta))); + } + } + } + else if (GTSmallOreHelper.mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) { + short baseMeta = GTSmallOreHelper.mapOreDropUnlocalizedNameToOreMeta.get(stack.getUnlocalizedName()); + for (String oreGenName: GTSmallOreHelper.mapSmallOreWrapper.keySet()) { + SmallOreWrapper smallOreWrapper = GTSmallOreHelper.mapSmallOreWrapper.get(oreGenName); + if (smallOreWrapper.oreMeta == baseMeta) { + List<ItemStack> stackList = new ArrayList<ItemStack>(); + for (int i=0;i<7;i++) + stackList.add(new ItemStack(GregTech_API.sBlockOres1, 1, baseMeta+16000+i*1000)); + List<ItemStack> materialDustStackList = new ArrayList<ItemStack>(); + for (int i=0;i<7;i++) + materialDustStackList.add(GT_OreDictUnificator.get(OrePrefixes.dust, GTSmallOreHelper.getDroppedDusts()[i], 1L)); + this.arecipes.add(new CachedSmallOreRecipe(GTSmallOreHelper.mapSmallOreWrapper.get(oreGenName).oreGenName, stackList, materialDustStackList, GTSmallOreHelper.mapOreMetaToOreDrops.get(baseMeta))); + } + } + } + else + super.loadCraftingRecipes(stack); + } + + @Override + public String getOutputId() { + return "GTOrePluginSmallOre"; + } + + @Override + public String getRecipeName() { + return I18n.format("gtnop.gui.smallOreStat.name"); + } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java index 84ad4d4cb2..8182233c9b 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java @@ -23,118 +23,118 @@ import pers.gwyog.gtneioreplugin.util.GTOreLayerHelper.OreLayerWrapper; public class PluginVeinStat extends PluginBase { - 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((3 + cycleticks / 20) % positionedStackPrimary.items.length);; - positionedStackBetween.setPermutationToRender((2 + cycleticks / 20) % positionedStackPrimary.items.length);; - positionedStackSporadic.setPermutationToRender((1 + 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: GTOreLayerHelper.mapOreLayerWrapper.keySet()) { - oreLayerWrapper = GTOreLayerHelper.mapOreLayerWrapper.get(veinName); - List<ItemStack> stackListPrimary = new ArrayList<ItemStack>(); - List<ItemStack> stackListSecondary = new ArrayList<ItemStack>(); - List<ItemStack> stackListBetween = new ArrayList<ItemStack>(); - List<ItemStack> stackListSporadic = new ArrayList<ItemStack>(); - for (int i=0;i<7;i++) { - stackListPrimary.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.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)); - } - this.arecipes.add(new CachedVeinStatRecipe(veinName, stackListPrimary, stackListSecondary, stackListBetween, stackListSporadic)); - } - } - 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: GTOreLayerHelper.mapOreLayerWrapper.values()) { - if (worldGen.primaryMeta == baseMeta || worldGen.secondaryMeta == baseMeta || worldGen.betweenMeta == baseMeta || worldGen.sporadicMeta == 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)); - } - 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 = GTOreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + I18n.format("gtnop." + oreLayer.veinName) + I18n.format("gtnop.ore.vein.name"), 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.weightedChance") + ": " + oreLayer.weightedChance, 2, 96, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genOverworld, oreLayer.genNether, oreLayer.genEnd, oreLayer.genMoon, oreLayer.genMars), 2, 109, 0x404040, false); - if (GTOreLayerHelper.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); - } - - @Override - public String getOutputId() { - return "GTOrePluginVein"; - } - - @Override - public String getRecipeName() { - return I18n.format("gtnop.gui.veinStat.name"); - } - + 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((3 + cycleticks / 20) % positionedStackPrimary.items.length);; + positionedStackBetween.setPermutationToRender((2 + cycleticks / 20) % positionedStackPrimary.items.length);; + positionedStackSporadic.setPermutationToRender((1 + 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: GTOreLayerHelper.mapOreLayerWrapper.keySet()) { + oreLayerWrapper = GTOreLayerHelper.mapOreLayerWrapper.get(veinName); + List<ItemStack> stackListPrimary = new ArrayList<ItemStack>(); + List<ItemStack> stackListSecondary = new ArrayList<ItemStack>(); + List<ItemStack> stackListBetween = new ArrayList<ItemStack>(); + List<ItemStack> stackListSporadic = new ArrayList<ItemStack>(); + for (int i=0;i<7;i++) { + stackListPrimary.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.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)); + } + this.arecipes.add(new CachedVeinStatRecipe(veinName, stackListPrimary, stackListSecondary, stackListBetween, stackListSporadic)); + } + } + 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: GTOreLayerHelper.mapOreLayerWrapper.values()) { + if (worldGen.primaryMeta == baseMeta || worldGen.secondaryMeta == baseMeta || worldGen.betweenMeta == baseMeta || worldGen.sporadicMeta == 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)); + } + 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 = GTOreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + I18n.format("gtnop." + oreLayer.veinName) + I18n.format("gtnop.ore.vein.name"), 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.weightedChance") + ": " + oreLayer.weightedChance, 2, 96, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genOverworld, oreLayer.genNether, oreLayer.genEnd, oreLayer.genMoon, oreLayer.genMars), 2, 109, 0x404040, false); + if (GTOreLayerHelper.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); + } + + @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/GTOreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GTOreLayerHelper.java index 40e5c21ea5..8bc84157e1 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GTOreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GTOreLayerHelper.java @@ -12,93 +12,93 @@ import net.minecraft.item.ItemStack; import sun.awt.windows.WWindowPeer; public class GTOreLayerHelper { - public static boolean restrictBiomeSupport = false; - public static boolean endAsteroidSupport = false; - public static boolean gcBasicSupport = false; - public static boolean gcAsteroidSupport = false; - public static HashMap<String, OreLayerWrapper> mapOreLayerWrapper = new HashMap<String, OreLayerWrapper>(); - public static List<List<Short>> listVein = new ArrayList<List<Short>>(); - public static List<List<Short>> listAsteroid = new ArrayList<List<Short>>(); + public static boolean restrictBiomeSupport = false; + public static boolean endAsteroidSupport = false; + public static boolean gcBasicSupport = false; + public static boolean gcAsteroidSupport = false; + public static HashMap<String, OreLayerWrapper> mapOreLayerWrapper = new HashMap<String, OreLayerWrapper>(); + public static List<List<Short>> listVein = new ArrayList<List<Short>>(); + public static List<List<Short>> listAsteroid = new ArrayList<List<Short>>(); - public GTOreLayerHelper() { - checkExtraSupport(); - 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) {} - } - } - - public class OreLayerWrapper { - public String veinName; - public short primaryMeta; - public short secondaryMeta; - public short betweenMeta; - public short sporadicMeta; - public String worldGenHeightRange; - public String weightedChance; - public String restrictBiome; - 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 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.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; - this.weightedChance = String.format("%.2f%%", (100.0f*worldGen.mWeight)/GT_Worldgen_GT_Ore_Layer.sWeight); - this.genOverworld = worldGen.mOverworld; - this.genNether = worldGen.mNether; - this.genEnd = worldGen.mEnd; - if (restrictBiomeSupport) - this.restrictBiome = worldGen.mRestrictBiome; - if (GTOreLayerHelper.gcBasicSupport) { - this.genMoon = worldGen.mMoon; - this.genMars = worldGen.mMars; - } - if (GTOreLayerHelper.endAsteroidSupport) - this.genEndAsteroid = worldGen.mEndAsteroid; - if (GTOreLayerHelper.gcAsteroidSupport) - this.genGCAsteroid = worldGen.mAsteroid; - List<Short> list = new ArrayList<Short>(); - list.add(primaryMeta); - list.add(secondaryMeta); - list.add(betweenMeta); - list.add(sporadicMeta); - listVein.add(list); - if (genEndAsteroid || genGCAsteroid) - listAsteroid.add(list); - } - } - + public GTOreLayerHelper() { + checkExtraSupport(); + 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) {} + } + } + + public class OreLayerWrapper { + public String veinName; + public short primaryMeta; + public short secondaryMeta; + public short betweenMeta; + public short sporadicMeta; + public String worldGenHeightRange; + public String weightedChance; + public String restrictBiome; + 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 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.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; + this.weightedChance = String.format("%.2f%%", (100.0f*worldGen.mWeight)/GT_Worldgen_GT_Ore_Layer.sWeight); + this.genOverworld = worldGen.mOverworld; + this.genNether = worldGen.mNether; + this.genEnd = worldGen.mEnd; + if (restrictBiomeSupport) + this.restrictBiome = worldGen.mRestrictBiome; + if (GTOreLayerHelper.gcBasicSupport) { + this.genMoon = worldGen.mMoon; + this.genMars = worldGen.mMars; + } + if (GTOreLayerHelper.endAsteroidSupport) + this.genEndAsteroid = worldGen.mEndAsteroid; + if (GTOreLayerHelper.gcAsteroidSupport) + this.genGCAsteroid = worldGen.mAsteroid; + List<Short> list = new ArrayList<Short>(); + list.add(primaryMeta); + list.add(secondaryMeta); + list.add(betweenMeta); + list.add(sporadicMeta); + listVein.add(list); + if (genEndAsteroid || genGCAsteroid) + listAsteroid.add(list); + } + } + } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GTSmallOreHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GTSmallOreHelper.java index 0a4ac52f07..5c8168e503 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GTSmallOreHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GTSmallOreHelper.java @@ -15,94 +15,94 @@ import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; public class GTSmallOreHelper { - public static boolean restrictBiomeSupport = false; - public static boolean gcBasicSupport = false; - public static List<ItemStack> smallOreList = new ArrayList<ItemStack>(); - public static HashMap<String, SmallOreWrapper> mapSmallOreWrapper = new HashMap<String, SmallOreWrapper>(); - public static HashMap<String, Short> mapOreDropUnlocalizedNameToOreMeta = new HashMap<String, Short>(); - public static HashMap<Short, List<ItemStack>> mapOreMetaToOreDrops = new HashMap<Short, List<ItemStack>>(); - - public GTSmallOreHelper() { - checkExtraSupport(); - ItemStack stack; - Materials material; - short meta; - for (GT_Worldgen worldGen : GregTech_API.sWorldgenList) - if (worldGen.mWorldGenName.startsWith("ore.small.") && worldGen instanceof GT_Worldgen_GT_Ore_SmallPieces) { - GT_Worldgen_GT_Ore_SmallPieces worldGenSmallPieces = (GT_Worldgen_GT_Ore_SmallPieces)worldGen; - meta = worldGenSmallPieces.mMeta; - material = GregTech_API.sGeneratedMaterials[meta]; - mapSmallOreWrapper.put(worldGen.mWorldGenName, new SmallOreWrapper(worldGenSmallPieces)); - if (!mapOreMetaToOreDrops.keySet().contains(meta)) { - List<ItemStack> stackList = new ArrayList<ItemStack>(); - stack = GT_OreDictUnificator.get(OrePrefixes.gemExquisite, material, GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L), 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = GT_OreDictUnificator.get(OrePrefixes.gemFlawless, material, GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L), 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = GT_OreDictUnificator.get(OrePrefixes.gemFlawed, material, GT_OreDictUnificator.get(OrePrefixes.crushed, material, 1L), 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = GT_OreDictUnificator.get(OrePrefixes.crushed, material, 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = GT_OreDictUnificator.get(OrePrefixes.gemChipped, material, GT_OreDictUnificator.get(OrePrefixes.dustImpure, material, 1L), 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = GT_OreDictUnificator.get(OrePrefixes.dustImpure, material, 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - smallOreList.add(new ItemStack(GregTech_API.sBlockOres1, 1, meta+16000)); - mapOreMetaToOreDrops.put(meta, stackList); - } - } - } - - private static void checkExtraSupport() { - Class clazzGTSmallOre = null; - try { - clazzGTSmallOre = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_SmallPieces"); - } catch (ClassNotFoundException e) {} - if (clazzGTSmallOre != null) { - try { - Field fieldRestrictBiome = clazzGTSmallOre.getField("mRestrictBiome");; - restrictBiomeSupport = true; - } catch (Exception e) {} - try { - Field fieldGCMoon = clazzGTSmallOre.getField("mMoon"); - Field fieldGCMars = clazzGTSmallOre.getField("mMars"); - gcBasicSupport = true; - } catch (Exception e) {} - } - } - + public static boolean restrictBiomeSupport = false; + public static boolean gcBasicSupport = false; + public static List<ItemStack> smallOreList = new ArrayList<ItemStack>(); + public static HashMap<String, SmallOreWrapper> mapSmallOreWrapper = new HashMap<String, SmallOreWrapper>(); + public static HashMap<String, Short> mapOreDropUnlocalizedNameToOreMeta = new HashMap<String, Short>(); + public static HashMap<Short, List<ItemStack>> mapOreMetaToOreDrops = new HashMap<Short, List<ItemStack>>(); + + public GTSmallOreHelper() { + checkExtraSupport(); + ItemStack stack; + Materials material; + short meta; + for (GT_Worldgen worldGen : GregTech_API.sWorldgenList) + if (worldGen.mWorldGenName.startsWith("ore.small.") && worldGen instanceof GT_Worldgen_GT_Ore_SmallPieces) { + GT_Worldgen_GT_Ore_SmallPieces worldGenSmallPieces = (GT_Worldgen_GT_Ore_SmallPieces)worldGen; + meta = worldGenSmallPieces.mMeta; + material = GregTech_API.sGeneratedMaterials[meta]; + mapSmallOreWrapper.put(worldGen.mWorldGenName, new SmallOreWrapper(worldGenSmallPieces)); + if (!mapOreMetaToOreDrops.keySet().contains(meta)) { + List<ItemStack> stackList = new ArrayList<ItemStack>(); + stack = GT_OreDictUnificator.get(OrePrefixes.gemExquisite, material, GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L), 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} + stack = GT_OreDictUnificator.get(OrePrefixes.gemFlawless, material, GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L), 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} + stack = GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} + stack = GT_OreDictUnificator.get(OrePrefixes.gemFlawed, material, GT_OreDictUnificator.get(OrePrefixes.crushed, material, 1L), 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} + stack = GT_OreDictUnificator.get(OrePrefixes.crushed, material, 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} + stack = GT_OreDictUnificator.get(OrePrefixes.gemChipped, material, GT_OreDictUnificator.get(OrePrefixes.dustImpure, material, 1L), 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} + stack = GT_OreDictUnificator.get(OrePrefixes.dustImpure, material, 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} + smallOreList.add(new ItemStack(GregTech_API.sBlockOres1, 1, meta+16000)); + mapOreMetaToOreDrops.put(meta, stackList); + } + } + } + + private static void checkExtraSupport() { + Class clazzGTSmallOre = null; + try { + clazzGTSmallOre = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_SmallPieces"); + } catch (ClassNotFoundException e) {} + if (clazzGTSmallOre != null) { + try { + Field fieldRestrictBiome = clazzGTSmallOre.getField("mRestrictBiome");; + restrictBiomeSupport = true; + } catch (Exception e) {} + try { + Field fieldGCMoon = clazzGTSmallOre.getField("mMoon"); + Field fieldGCMars = clazzGTSmallOre.getField("mMars"); + gcBasicSupport = true; + } catch (Exception e) {} + } + } + public static Materials[] getDroppedDusts() { return new Materials[]{Materials.Stone, Materials.Netherrack, Materials.Endstone, Materials.GraniteBlack, Materials.GraniteRed, Materials.Marble, Materials.Basalt, Materials.Stone}; } - - public class SmallOreWrapper { - public String oreGenName; - public short oreMeta; - public String worldGenHeightRange; - public short amountPerChunk; - public String restrictBiome; - public boolean genOverworld = false; - public boolean genNether = false; - public boolean genEnd = false; - public boolean genMoon = false; - public boolean genMars = false; - - public SmallOreWrapper(GT_Worldgen_GT_Ore_SmallPieces worldGen) { - this.oreGenName = worldGen.mWorldGenName; - this.oreMeta = worldGen.mMeta; - this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; - this.amountPerChunk = worldGen.mAmount; - this.genOverworld = worldGen.mOverworld; - this.genNether = worldGen.mNether; - this.genEnd = worldGen.mEnd; - if (GTSmallOreHelper.restrictBiomeSupport) - this.restrictBiome = worldGen.mRestrictBiome; - if (GTSmallOreHelper.gcBasicSupport) { - this.genMoon = worldGen.mMoon; - this.genMars = worldGen.mMars; - } - } - } + + public class SmallOreWrapper { + public String oreGenName; + public short oreMeta; + public String worldGenHeightRange; + public short amountPerChunk; + public String restrictBiome; + public boolean genOverworld = false; + public boolean genNether = false; + public boolean genEnd = false; + public boolean genMoon = false; + public boolean genMars = false; + + public SmallOreWrapper(GT_Worldgen_GT_Ore_SmallPieces worldGen) { + this.oreGenName = worldGen.mWorldGenName; + this.oreMeta = worldGen.mMeta; + this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; + this.amountPerChunk = worldGen.mAmount; + this.genOverworld = worldGen.mOverworld; + this.genNether = worldGen.mNether; + this.genEnd = worldGen.mEnd; + if (GTSmallOreHelper.restrictBiomeSupport) + this.restrictBiome = worldGen.mRestrictBiome; + if (GTSmallOreHelper.gcBasicSupport) { + this.genMoon = worldGen.mMoon; + this.genMars = worldGen.mMars; + } + } + } } |