diff options
author | GWYOG <jjn1jjn2@163.com> | 2017-03-31 15:15:38 +0800 |
---|---|---|
committer | GWYOG <jjn1jjn2@163.com> | 2017-03-31 15:15:38 +0800 |
commit | bb7c413280e2c152fdae6ff188a9c08c56dd2752 (patch) | |
tree | e9445de674829ccc8eaf3d174c99e22845d1d8e1 /src/main/java/pers/gwyog/gtneioreplugin/plugin | |
parent | 68e4693ddb7d17be4cabb45765b143eca4395a09 (diff) | |
download | GT5-Unofficial-bb7c413280e2c152fdae6ff188a9c08c56dd2752.tar.gz GT5-Unofficial-bb7c413280e2c152fdae6ff188a9c08c56dd2752.tar.bz2 GT5-Unofficial-bb7c413280e2c152fdae6ff188a9c08c56dd2752.zip |
Fix the weighted chance issue in Vein Stat Plungins
Each world (rather than all worlds) should have its own weight chance of
veins.
Diffstat (limited to 'src/main/java/pers/gwyog/gtneioreplugin/plugin')
-rw-r--r-- | src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java | 34 | ||||
-rw-r--r-- | src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java | 24 |
2 files changed, 54 insertions, 4 deletions
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 4967999870..fd9eb314ad 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -121,8 +121,8 @@ public class PluginGT5VeinStat extends PluginGT5Base { 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); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genOverworld, oreLayer.genNether, oreLayer.genEnd, oreLayer.genMoon, oreLayer.genMars), 2, 96, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + getWeightedChance(oreLayer.randomWeight, oreLayer.genOverworld, oreLayer.genNether, oreLayer.genEnd, oreLayer.genMoon, oreLayer.genMars), 2, 109, 0x404040, false); if (GT5OreLayerHelper.restrictBiomeSupport) GuiDraw.drawString(I18n.format("gtnop.gui.nei.restrictBiome") + ": " + getBiomeTranslated(oreLayer.restrictBiome), 2, 122, 0x404040, false); GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); } @@ -134,6 +134,36 @@ public class PluginGT5VeinStat extends PluginGT5Base { 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) { + String weightedChance = ""; + if (genOverworld && GT5OreLayerHelper.weightPerWorld[0] != 0) { + if (!weightedChance.isEmpty()) + weightedChance += ", "; + weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT5OreLayerHelper.weightPerWorld[0]); + } + 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; + } + @Override public String getOutputId() { return "GTOrePluginVein"; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java index 82714dd374..88bc814af4 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java @@ -112,8 +112,8 @@ public class PluginGT6VeinStat extends PluginGT6Base { 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.weightedChance") + ": " + oreLayer.weightedChance, 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.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); } @@ -124,6 +124,26 @@ public class PluginGT6VeinStat extends PluginGT6Base { return I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.vein.name"); } + public String getWeightedChance(int randomWeight, boolean genOverworld, boolean genNether, boolean genEnd) { + String weightedChance = ""; + if (genOverworld && GT6OreLayerHelper.weightPerWorld[0] != 0) { + if (!weightedChance.isEmpty()) + weightedChance += ", "; + weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT6OreLayerHelper.weightPerWorld[0]); + } + if (genNether && GT6OreLayerHelper.weightPerWorld[1] != 0) { + if (!weightedChance.isEmpty()) + weightedChance += ", "; + weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT6OreLayerHelper.weightPerWorld[1]); + } + if (genEnd && GT6OreLayerHelper.weightPerWorld[2] != 0) { + if (!weightedChance.isEmpty()) + weightedChance += ", "; + weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT6OreLayerHelper.weightPerWorld[2]); + } + return weightedChance; + } + @Override public String getOutputId() { return "GTOrePluginVein"; |