aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGWYOG <jjn1jjn2@163.com>2017-03-31 15:15:38 +0800
committerGWYOG <jjn1jjn2@163.com>2017-03-31 15:15:38 +0800
commitbb7c413280e2c152fdae6ff188a9c08c56dd2752 (patch)
treee9445de674829ccc8eaf3d174c99e22845d1d8e1 /src
parent68e4693ddb7d17be4cabb45765b143eca4395a09 (diff)
downloadGT5-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')
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java34
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java24
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java10
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java8
4 files changed, 68 insertions, 8 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";
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java
index 9026aec71d..9991387703 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java
@@ -21,6 +21,7 @@ public class GT5OreLayerHelper {
public static boolean gcBasicSupport = false;
public static boolean gcAsteroidSupport = false;
public static boolean immersiveEngineeringSupport = false;
+ public static int[] weightPerWorld = {0, 0, 0, 0, 0};
public static HashMap<String, OreLayerWrapper> mapOreLayerWrapper = new HashMap<String, OreLayerWrapper>();
public GT5OreLayerHelper() {
@@ -82,9 +83,9 @@ public class GT5OreLayerHelper {
public short betweenMeta;
public short sporadicMeta;
public String worldGenHeightRange;
- public String weightedChance;
public String weightedIEChance;
public String restrictBiome;
+ public int randomWeight;
public boolean genOverworld = false;
public boolean genNether = false;
public boolean genEnd = false;
@@ -101,15 +102,20 @@ public class GT5OreLayerHelper {
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.randomWeight = worldGen.mWeight;
this.genOverworld = worldGen.mOverworld;
this.genNether = worldGen.mNether;
this.genEnd = worldGen.mEnd;
+ weightPerWorld[0] += this.genOverworld ? this.randomWeight : 0;
+ weightPerWorld[1] += this.genNether ? this.randomWeight : 0;
+ weightPerWorld[2] += this.genEnd ? this.randomWeight : 0;
if (restrictBiomeSupport)
this.restrictBiome = worldGen.mRestrictBiome;
if (GT5OreLayerHelper.gcBasicSupport) {
this.genMoon = worldGen.mMoon;
this.genMars = worldGen.mMars;
+ weightPerWorld[3] += this.genMoon ? this.randomWeight : 0;
+ weightPerWorld[4] += this.genMars ? this.randomWeight : 0;
}
if (GT5OreLayerHelper.endAsteroidSupport)
this.genEndAsteroid = worldGen.mEndAsteroid;
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java
index 70bddee30d..bc0b40f5a1 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java
@@ -14,6 +14,7 @@ import net.minecraft.item.ItemStack;
import pers.gwyog.gtneioreplugin.GTNEIOrePlugin;
public class GT6OreLayerHelper {
+ public static int[] weightPerWorld = {0, 0, 0};
public static HashMap<String, OreLayerWrapper> mapOreLayerWrapper = new HashMap<String, OreLayerWrapper>();
public static Set<PrefixBlock> setOreNormalBasicTypes = new HashSet<PrefixBlock>();
@@ -33,7 +34,7 @@ public class GT6OreLayerHelper {
public short betweenMeta;
public short sporadicMeta;
public String worldGenHeightRange;
- public String weightedChance;
+ public int randomWeight;
public boolean genOverworld = false;
public boolean genNether = false;
public boolean genEnd = false;
@@ -45,10 +46,13 @@ public class GT6OreLayerHelper {
this.betweenMeta = worldGen.mBetweenMeta;
this.sporadicMeta = worldGen.mSporadicMeta;
this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY;
- this.weightedChance = String.format("%.2f%%", (100.0f*worldGen.mWeight)/Worldgen_GT_Ore_Layer.sWeight);
+ this.randomWeight = worldGen.mWeight;
this.genOverworld = worldGen.mOverworld;
this.genNether = worldGen.mNether;
this.genEnd = worldGen.mEnd;
+ weightPerWorld[0] += this.genOverworld ? this.randomWeight : 0;
+ weightPerWorld[1] += this.genNether ? this.randomWeight : 0;
+ weightPerWorld[2] += this.genEnd ? this.randomWeight : 0;
}
}