aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pers/gwyog
diff options
context:
space:
mode:
authorGWYOG <jjn1jjn2@163.com>2016-11-10 12:51:44 +0800
committerGWYOG <jjn1jjn2@163.com>2016-11-10 12:51:44 +0800
commit96a346cbe022086815d014e3616182df05b9bfd8 (patch)
tree2b413aa832d1f178321186a5baf22e7212018e0e /src/main/java/pers/gwyog
parent4d9e74936b20d24020b0fdebed723caad9cbf9b4 (diff)
downloadGT5-Unofficial-96a346cbe022086815d014e3616182df05b9bfd8.tar.gz
GT5-Unofficial-96a346cbe022086815d014e3616182df05b9bfd8.tar.bz2
GT5-Unofficial-96a346cbe022086815d014e3616182df05b9bfd8.zip
Add 3 plugins supporting GT6 and refactor some code
Diffstat (limited to 'src/main/java/pers/gwyog')
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java29
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java48
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java22
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5AsteroidStat.java (renamed from src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java)20
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java33
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5IEVeinStat.java (renamed from src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginIEVeinStat.java)17
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java (renamed from src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java)71
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java (renamed from src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java)18
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6BedrockOreStat.java114
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6SmallOreStat.java139
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java138
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java (renamed from src/main/java/pers/gwyog/gtneioreplugin/util/GTOreLayerHelper.java)16
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java (renamed from src/main/java/pers/gwyog/gtneioreplugin/util/GTSmallOreHelper.java)51
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreBedrockHelper.java56
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java76
-rw-r--r--src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreSmallHelper.java100
16 files changed, 810 insertions, 138 deletions
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java
index d50011b4ec..a023a21d5b 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java
@@ -1,17 +1,16 @@
package pers.gwyog.gtneioreplugin;
-import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
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.common.event.FMLServerStartingEvent;
import cpw.mods.fml.relauncher.Side;
-import gregtech.api.enums.OrePrefixes;
-import gregtech.api.util.GT_OreDictUnificator;
-import net.minecraft.item.ItemStack;
-import pers.gwyog.gtneioreplugin.util.GTOreLayerHelper;
-import pers.gwyog.gtneioreplugin.util.GTSmallOreHelper;
+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 {
@@ -19,14 +18,28 @@ public class GTNEIOrePlugin {
public static final String NAME = "GT NEI Ore Plugin";
public static final String VERSION = "1.0.2";
+ // default is GT5, however it will be "GT6" when GT6 is installed
+ public static String GTVersion = "GT5";
+
@Mod.Instance(MODID)
public static GTNEIOrePlugin instance;
@EventHandler
public void onLoadComplete(FMLLoadCompleteEvent event) {
if (event.getSide() == Side.CLIENT) {
- new GTOreLayerHelper();
- new GTSmallOreHelper();
+ 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 738834c8f0..76cd9c4d18 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java
@@ -4,7 +4,14 @@ 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.util.GTOreLayerHelper;
+import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5AsteroidStat;
+import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5IEVeinStat;
+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 {
@@ -20,20 +27,33 @@ public class NEIPluginConfig implements IConfigureNEI {
@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);
- if (GTOreLayerHelper.immersiveEngineeringSupport) {
- PluginIEVeinStat pluginIEVeinStat = new PluginIEVeinStat();
- API.registerRecipeHandler(pluginIEVeinStat);
- API.registerUsageHandler(pluginIEVeinStat);
+ if (GTNEIOrePlugin.GTVersion.equals("GT5")) {
+ PluginGT5VeinStat pluginVeinStat = new PluginGT5VeinStat();
+ PluginGT5AsteroidStat pluginAsteriodStat = new PluginGT5AsteroidStat();
+ PluginGT5SmallOreStat pluginSmallOreStat = new PluginGT5SmallOreStat();
+ API.registerRecipeHandler(pluginVeinStat);
+ API.registerUsageHandler(pluginVeinStat);
+ 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 33102a8248..a554cf5f46 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java
@@ -5,7 +5,6 @@ import java.awt.Rectangle;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.recipe.TemplateRecipeHandler;
import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRect;
-import gregtech.api.util.GT_LanguageManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.EnumChatFormatting;
@@ -35,25 +34,7 @@ public class PluginBase extends TemplateRecipeHandler {
public String getOutputId() {
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;
- }
-
- public String getGTOreLocalizedName(short 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;
}
@@ -91,5 +72,4 @@ public class PluginBase extends TemplateRecipeHandler {
public int getGuiWidth() {
return 166;
}
-
}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5AsteroidStat.java
index 9cdc5e7108..48e51a5367 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5AsteroidStat.java
@@ -1,4 +1,4 @@
-package pers.gwyog.gtneioreplugin.plugin;
+package pers.gwyog.gtneioreplugin.plugin.gregtech5;
import java.awt.Rectangle;
import java.util.ArrayList;
@@ -12,12 +12,12 @@ 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.plugin.PluginVeinStat.CachedVeinStatRecipe;
-import pers.gwyog.gtneioreplugin.util.GTOreLayerHelper;
-import pers.gwyog.gtneioreplugin.util.GTSmallOreHelper;
-import pers.gwyog.gtneioreplugin.util.GTOreLayerHelper.OreLayerWrapper;
+import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat.CachedVeinStatRecipe;
+import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper;
+import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper;
+import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper;
-public class PluginAsteroidStat extends PluginBase {
+public class PluginGT5AsteroidStat extends PluginGT5Base {
public class CachedAsteroidStatRecipe extends CachedRecipe {
public String veinName;
@@ -55,7 +55,7 @@ public class PluginAsteroidStat extends PluginBase {
@Override
public void drawExtras(int recipe) {
CachedAsteroidStatRecipe crecipe = (CachedAsteroidStatRecipe) this.arecipes.get(recipe);
- OreLayerWrapper oreLayer = GTOreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName);
+ 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);
@@ -91,8 +91,8 @@ public class PluginAsteroidStat extends PluginBase {
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getOutputId())) {
OreLayerWrapper oreLayerWrapper;
- for (String veinName: GTOreLayerHelper.mapOreLayerWrapper.keySet()) {
- oreLayerWrapper = GTOreLayerHelper.mapOreLayerWrapper.get(veinName);
+ 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);
@@ -114,7 +114,7 @@ public class PluginAsteroidStat extends PluginBase {
return;
}
short baseMeta = (short)(stack.getItemDamage() % 1000);
- for (OreLayerWrapper worldGen: GTOreLayerHelper.mapOreLayerWrapper.values()) {
+ for (OreLayerWrapper worldGen: GT5OreLayerHelper.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);
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java
new file mode 100644
index 0000000000..a61a8bb977
--- /dev/null
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java
@@ -0,0 +1,33 @@
+package pers.gwyog.gtneioreplugin.plugin.gregtech5;
+
+import java.awt.Rectangle;
+
+import codechicken.lib.gui.GuiDraw;
+import codechicken.nei.recipe.TemplateRecipeHandler;
+import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRect;
+import gregtech.api.util.GT_LanguageManager;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.util.EnumChatFormatting;
+import pers.gwyog.gtneioreplugin.plugin.PluginBase;
+
+public class PluginGT5Base extends PluginBase {
+
+ 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;
+ }
+
+ public String getGTOreLocalizedName(short index) {
+ return GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index));
+ }
+
+ public String getGTOreUnlocalizedName(short index) {
+ return "gt.blockores." + index + ".name";
+ }
+
+}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginIEVeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5IEVeinStat.java
index 430490d18a..547c966081 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginIEVeinStat.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5IEVeinStat.java
@@ -1,4 +1,4 @@
-package pers.gwyog.gtneioreplugin.plugin;
+package pers.gwyog.gtneioreplugin.plugin.gregtech5;
import java.util.ArrayList;
import java.util.List;
@@ -11,11 +11,10 @@ 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.plugin.PluginAsteroidStat.CachedAsteroidStatRecipe;
-import pers.gwyog.gtneioreplugin.util.GTOreLayerHelper;
-import pers.gwyog.gtneioreplugin.util.GTOreLayerHelper.OreLayerWrapper;
+import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper;
+import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper;
-public class PluginIEVeinStat extends PluginBase {
+public class PluginGT5IEVeinStat extends PluginGT5Base {
public class CachedIEVeinStatRecipe extends CachedRecipe {
public String veinName;
@@ -53,7 +52,7 @@ public class PluginIEVeinStat extends PluginBase {
@Override
public void drawExtras(int recipe) {
CachedIEVeinStatRecipe crecipe = (CachedIEVeinStatRecipe) this.arecipes.get(recipe);
- OreLayerWrapper oreLayer = GTOreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName);
+ 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;
@@ -83,8 +82,8 @@ public class PluginIEVeinStat extends PluginBase {
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getOutputId())) {
OreLayerWrapper oreLayerWrapper;
- for (String veinName: GTOreLayerHelper.mapOreLayerWrapper.keySet()) {
- oreLayerWrapper = GTOreLayerHelper.mapOreLayerWrapper.get(veinName);
+ 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);
@@ -106,7 +105,7 @@ public class PluginIEVeinStat extends PluginBase {
return;
}
short baseMeta = (short)(stack.getItemDamage() % 1000);
- for (OreLayerWrapper worldGen: GTOreLayerHelper.mapOreLayerWrapper.values()) {
+ 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);
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java
index 1aba8c8992..f1ddce6629 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java
@@ -1,4 +1,4 @@
-package pers.gwyog.gtneioreplugin.plugin;
+package pers.gwyog.gtneioreplugin.plugin.gregtech5;
import java.awt.Rectangle;
import java.util.ArrayList;
@@ -15,24 +15,23 @@ import gregtech.common.blocks.GT_Block_Ores_Abstract;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
-import pers.gwyog.gtneioreplugin.plugin.PluginAsteroidStat.CachedAsteroidStatRecipe;
-import pers.gwyog.gtneioreplugin.plugin.PluginVeinStat.CachedVeinStatRecipe;
-import pers.gwyog.gtneioreplugin.util.GTOreLayerHelper;
-import pers.gwyog.gtneioreplugin.util.GTSmallOreHelper;
-import pers.gwyog.gtneioreplugin.util.GTOreLayerHelper.OreLayerWrapper;
-import pers.gwyog.gtneioreplugin.util.GTSmallOreHelper.SmallOreWrapper;
+import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat.CachedVeinStatRecipe;
+import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper;
+import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper;
+import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper;
+import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper.OreSmallWrapper;
-public class PluginSmallOreStat extends PluginBase {
+public class PluginGT5SmallOreStat extends PluginGT5Base {
- public class CachedSmallOreRecipe extends CachedRecipe {
+ public class CachedOreSmallRecipe extends CachedRecipe {
public String oreGenName;
- public PositionedStack positionedStackSmallOre;
+ public PositionedStack positionedStackOreSmall;
public PositionedStack positionedStackMaterialDust;
public List<PositionedStack> positionedDropStackList;
- public CachedSmallOreRecipe(String oreGenName, List<ItemStack> stackList, List<ItemStack> materialDustStackList, List<ItemStack> dropStackList) {
+ public CachedOreSmallRecipe(String oreGenName, List<ItemStack> stackList, List<ItemStack> materialDustStackList, List<ItemStack> dropStackList) {
this.oreGenName = oreGenName;
- this.positionedStackSmallOre = new PositionedStack(stackList, 2, 0);
+ this.positionedStackOreSmall = new PositionedStack(stackList, 2, 0);
this.positionedStackMaterialDust = new PositionedStack(materialDustStackList, 43, 79+getRestrictBiomeOffset());
List<PositionedStack> positionedDropStackList = new ArrayList<PositionedStack>();
int i = 1;
@@ -43,9 +42,9 @@ public class PluginSmallOreStat extends PluginBase {
@Override
public List<PositionedStack> getIngredients() {
- positionedStackSmallOre.setPermutationToRender((cycleticks / 20) % positionedStackSmallOre.items.length);
+ positionedStackOreSmall.setPermutationToRender((cycleticks / 20) % positionedStackOreSmall.items.length);
positionedStackMaterialDust.setPermutationToRender((cycleticks / 20) % positionedStackMaterialDust.items.length);
- positionedDropStackList.add(positionedStackSmallOre);
+ positionedDropStackList.add(positionedStackOreSmall);
positionedDropStackList.add(positionedStackMaterialDust);
return positionedDropStackList;
@@ -60,25 +59,25 @@ public class PluginSmallOreStat extends PluginBase {
@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);
+ CachedOreSmallRecipe crecipe = (CachedOreSmallRecipe) this.arecipes.get(recipe);
+ OreSmallWrapper oreSmall = GT5OreSmallHelper.mapOreSmallWrapper.get(crecipe.oreGenName);
+ 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.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;
+ return GT5OreSmallHelper.restrictBiomeSupport? 0: -13;
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getOutputId()))
- for (ItemStack stack: GTSmallOreHelper.smallOreList)
+ for (ItemStack stack: GT5OreSmallHelper.oreSmallList)
loadCraftingRecipes(stack);
else
super.loadCraftingRecipes(outputId, results);
@@ -92,31 +91,31 @@ public class PluginSmallOreStat extends PluginBase {
return;
}
short baseMeta = (short)(stack.getItemDamage() % 1000);
- for (SmallOreWrapper smallOreWorldGen: GTSmallOreHelper.mapSmallOreWrapper.values()) {
- if (smallOreWorldGen.oreMeta == baseMeta) {
+ for (OreSmallWrapper oreSmallWorldGen: GT5OreSmallHelper.mapOreSmallWrapper.values()) {
+ if (oreSmallWorldGen.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));
+ stackList.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreSmallWorldGen.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)));
+ materialDustStackList.add(GT_OreDictUnificator.get(OrePrefixes.dust, GT5OreSmallHelper.getDroppedDusts()[i], 1L));
+ this.arecipes.add(new CachedOreSmallRecipe(oreSmallWorldGen.oreGenName, stackList, materialDustStackList, GT5OreSmallHelper.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) {
+ else if (GT5OreSmallHelper.mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {
+ short baseMeta = GT5OreSmallHelper.mapOreDropUnlocalizedNameToOreMeta.get(stack.getUnlocalizedName());
+ for (String oreGenName: GT5OreSmallHelper.mapOreSmallWrapper.keySet()) {
+ OreSmallWrapper oreSmallWrapper = GT5OreSmallHelper.mapOreSmallWrapper.get(oreGenName);
+ if (oreSmallWrapper.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)));
+ materialDustStackList.add(GT_OreDictUnificator.get(OrePrefixes.dust, GT5OreSmallHelper.getDroppedDusts()[i], 1L));
+ this.arecipes.add(new CachedOreSmallRecipe(GT5OreSmallHelper.mapOreSmallWrapper.get(oreGenName).oreGenName, stackList, materialDustStackList, GT5OreSmallHelper.mapOreMetaToOreDrops.get(baseMeta)));
}
}
}
@@ -126,7 +125,7 @@ public class PluginSmallOreStat extends PluginBase {
@Override
public String getOutputId() {
- return "GTOrePluginSmallOre";
+ return "GTOrePluginOreSmall";
}
@Override
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java
index e2b43cf482..d9085ab82a 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java
@@ -1,4 +1,4 @@
-package pers.gwyog.gtneioreplugin.plugin;
+package pers.gwyog.gtneioreplugin.plugin.gregtech5;
import java.awt.Rectangle;
import java.util.ArrayList;
@@ -18,10 +18,10 @@ 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.GTOreLayerHelper;
-import pers.gwyog.gtneioreplugin.util.GTOreLayerHelper.OreLayerWrapper;
+import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper;
+import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper;
-public class PluginVeinStat extends PluginBase {
+public class PluginGT5VeinStat extends PluginGT5Base {
public class CachedVeinStatRecipe extends CachedRecipe {
public String veinName;
@@ -64,8 +64,8 @@ public class PluginVeinStat extends PluginBase {
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getOutputId())) {
OreLayerWrapper oreLayerWrapper;
- for (String veinName: GTOreLayerHelper.mapOreLayerWrapper.keySet()) {
- oreLayerWrapper = GTOreLayerHelper.mapOreLayerWrapper.get(veinName);
+ for (String veinName: GT5OreLayerHelper.mapOreLayerWrapper.keySet()) {
+ oreLayerWrapper = GT5OreLayerHelper.mapOreLayerWrapper.get(veinName);
List<ItemStack> stackListPrimary = new ArrayList<ItemStack>();
List<ItemStack> stackListSecondary = new ArrayList<ItemStack>();
List<ItemStack> stackListBetween = new ArrayList<ItemStack>();
@@ -91,7 +91,7 @@ public class PluginVeinStat extends PluginBase {
return;
}
short baseMeta = (short)(stack.getItemDamage() % 1000);
- for (OreLayerWrapper worldGen: GTOreLayerHelper.mapOreLayerWrapper.values()) {
+ for (OreLayerWrapper worldGen: GT5OreLayerHelper.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>();
@@ -114,7 +114,7 @@ public class PluginVeinStat extends PluginBase {
@Override
public void drawExtras(int recipe) {
CachedVeinStatRecipe crecipe = (CachedVeinStatRecipe) this.arecipes.get(recipe);
- OreLayerWrapper oreLayer = GTOreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName);
+ OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName);
GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer.veinName), 2, 18, 0x404040, false);
GuiDraw.drawString(I18n.format("gtnop.gui.nei.primaryOre") + ": " + getGTOreLocalizedName(oreLayer.primaryMeta), 2, 31, 0x404040, false);
GuiDraw.drawString(I18n.format("gtnop.gui.nei.secondaryOre") + ": " + getGTOreLocalizedName(oreLayer.secondaryMeta), 2, 44, 0x404040, false);
@@ -123,7 +123,7 @@ public class PluginVeinStat extends PluginBase {
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);
+ 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);
}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6BedrockOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6BedrockOreStat.java
new file mode 100644
index 0000000000..ce46736597
--- /dev/null
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6BedrockOreStat.java
@@ -0,0 +1,114 @@
+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.plugin.PluginBase;
+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 PluginBase {
+
+ public class CachedBedrockOreStatRecipe extends CachedRecipe {
+ public String oreName;
+ public PositionedStack positionedStackOreBedrock;
+ public PositionedStack positionedStackOreSmallBedrock;
+ public PositionedStack positionedStackOre;
+ public PositionedStack positionedStackOreSmall;
+
+ public CachedBedrockOreStatRecipe(String oreName, ItemStack stackOreBedrock, ItemStack stackOreSmallBedrock,
+ List<ItemStack> stackListOre, List<ItemStack> stackListOreSmall) {
+ this.oreName = oreName;
+ positionedStackOreBedrock = new PositionedStack(stackOreBedrock, 2, 0);
+ positionedStackOreSmallBedrock = new PositionedStack(stackOreSmallBedrock, 22, 0);
+ positionedStackOre = new PositionedStack(stackListOre, 42, 0);
+ positionedStackOreSmall = new PositionedStack(stackListOreSmall, 62, 0);
+ }
+
+ @Override
+ public List<PositionedStack> getIngredients() {
+ List<PositionedStack> ingredientsList = new ArrayList<PositionedStack>();
+ positionedStackOre.setPermutationToRender((cycleticks / 20) % positionedStackOre.items.length);;
+ positionedStackOreSmall.setPermutationToRender((cycleticks / 20) % positionedStackOreSmall.items.length);;
+ ingredientsList.add(positionedStackOreBedrock);
+ ingredientsList.add(positionedStackOreSmallBedrock);
+ ingredientsList.add(positionedStackOre);
+ ingredientsList.add(positionedStackOreSmall);
+ return ingredientsList;
+ }
+
+ @Override
+ public PositionedStack getResult() {
+ return null;
+ }
+
+ }
+
+ @Override
+ public void loadCraftingRecipes(String outputId, Object... results) {
+ if (outputId.equals(getOutputId()))
+ for (OreBedrockWrapper worldGen: GT6OreBedrockHelper.mapOreBedrockWrapper.values())
+ loadCraftingRecipes(new ItemStack(CS.BlocksGT.oreBedrock, 1, worldGen.meta));
+ else
+ super.loadCraftingRecipes(outputId, results);
+ }
+
+ @Override
+ public void loadCraftingRecipes(ItemStack stack) {
+ String unlocalizedName = stack.getUnlocalizedName();
+ if (unlocalizedName.startsWith("oredict.oreBedrock") || unlocalizedName.startsWith("oredict.ore") || unlocalizedName.startsWith("oredict.oreSmall")) {
+ short meta = (short)stack.getItemDamage();
+ for (OreBedrockWrapper worldGen: GT6OreBedrockHelper.mapOreBedrockWrapper.values()) {
+ if (meta==worldGen.meta) {
+ ItemStack stackOreBedrock = new ItemStack(CS.BlocksGT.oreBedrock, 1, meta);
+ ItemStack stackOreSmallBedrock = new ItemStack(CS.BlocksGT.oreSmallBedrock, 1, meta);
+ List<ItemStack> stackListOre = new ArrayList<ItemStack>();
+ List<ItemStack> stackListOreSmall = new ArrayList<ItemStack>();
+ for (PrefixBlock prefixBlock: GT6OreLayerHelper.setOreNormalBasicTypes)
+ stackListOre.add(new ItemStack(prefixBlock, 1, meta));
+ for (PrefixBlock prefixBlock: GT6OreSmallHelper.setOreSmallBasicTypes)
+ stackListOreSmall.add(new ItemStack(prefixBlock, 1, meta));
+ this.arecipes.add(new CachedBedrockOreStatRecipe(worldGen.veinName, stackOreBedrock, stackOreSmallBedrock, stackListOre, stackListOreSmall));
+ }
+ }
+ }
+ else
+ super.loadCraftingRecipes(stack);
+ }
+
+ @Override
+ public void drawExtras(int recipe) {
+ CachedBedrockOreStatRecipe crecipe = (CachedBedrockOreStatRecipe) this.arecipes.get(recipe);
+ OreBedrockWrapper oreLayer = GT6OreBedrockHelper.mapOreBedrockWrapper.get(crecipe.oreName);
+ GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreName") + ": " + GT6OreBedrockHelper.mapMetaToLocalizedName.get(oreLayer.meta), 2, 18, 0x404040, false);
+ GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreOthers") + ": " + GT6OreSmallHelper.mapMetaToLocalizedName.get(oreLayer.meta), 2, 31, 0x404040, false);
+ GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreOthers") + ": " + GT6OreLayerHelper.mapMetaToLocalizedName.get(oreLayer.meta), 2, 44, 0x404040, false);
+ GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreOthers") + ": " + GT6OreSmallHelper.mapMetaToLocalizedName.get(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
new file mode 100644
index 0000000000..02f43a02f9
--- /dev/null
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6SmallOreStat.java
@@ -0,0 +1,139 @@
+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.plugin.PluginBase;
+import pers.gwyog.gtneioreplugin.util.GT6OreSmallHelper;
+import pers.gwyog.gtneioreplugin.util.GT6OreSmallHelper.OreSmallWrapper;
+
+public class PluginGT6SmallOreStat extends PluginBase {
+
+ public class CachedOreSmallRecipe extends CachedRecipe {
+ public String oreGenName;
+ public PositionedStack positionedStackOreSmall;
+ public PositionedStack positionedStackMaterialDust;
+ public List<PositionedStack> positionedDropStackList;
+
+ public CachedOreSmallRecipe(String oreGenName, List<ItemStack> stackList, List<ItemStack> materialDustStackList, List<ItemStack> dropStackList) {
+ this.oreGenName = oreGenName;
+ this.positionedStackOreSmall = new PositionedStack(stackList, 2, 0);
+ this.positionedStackMaterialDust = new PositionedStack(materialDustStackList, 43, 67);
+ List<PositionedStack> positionedDropStackList = new ArrayList<PositionedStack>();
+ int i = 1;
+ for (ItemStack stackDrop: dropStackList)
+ positionedDropStackList.add(new PositionedStack(stackDrop, 43+20*(i%5), 67+17*((i++)/5)));
+ this.positionedDropStackList = positionedDropStackList;
+ }
+
+ @Override
+ public List<PositionedStack> getIngredients() {
+ positionedStackOreSmall.setPermutationToRender((cycleticks / 20) % positionedStackOreSmall.items.length);
+ positionedStackMaterialDust.setPermutationToRender((cycleticks / 20) % positionedStackMaterialDust.items.length);
+ positionedDropStackList.add(positionedStackOreSmall);
+ positionedDropStackList.add(positionedStackMaterialDust);
+ return positionedDropStackList;
+
+ }
+
+ @Override
+ public PositionedStack getResult() {
+ return null;
+ }
+
+ }
+
+ @Override
+ public void drawExtras(int recipe) {
+ CachedOreSmallRecipe crecipe = (CachedOreSmallRecipe) this.arecipes.get(recipe);
+ OreSmallWrapper oreSmall = GT6OreSmallHelper.mapOreSmallWrapper.get(crecipe.oreGenName);
+ GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreName") + ": " + GT6OreSmallHelper.mapMetaToLocalizedName.get(oreSmall.oreMeta), 2, 18, 0x404040, false);
+ GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreSmall.worldGenHeightRange, 2, 31, 0x404040, false);
+ GuiDraw.drawString(I18n.format("gtnop.gui.nei.amount") + ": " + oreSmall.amountPerChunk, 2, 44, 0x404040, false);
+ GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreSmall.genOverworld, oreSmall.genNether, oreSmall.genEnd, false, false), 2, 57, 0x404040, false);
+ GuiDraw.drawString(I18n.format("gtnop.gui.nei.chanceDrops") + ": ", 2, 70, 0x404040, false);
+ GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false);
+ }
+
+ @Override
+ public void loadCraftingRecipes(String outputId, Object... results) {
+ if (outputId.equals(getOutputId()))
+ for (ItemStack stack: GT6OreSmallHelper.oreSmallList)
+ loadCraftingRecipes(stack);
+ else
+ super.loadCraftingRecipes(outputId, results);
+ }
+
+ @Override
+ public void loadCraftingRecipes(ItemStack stack) {
+ if (stack.getUnlocalizedName().startsWith("oredict.oreSmall") && !stack.isItemEqual(new ItemStack(CS.BlocksGT.oreSmallBedrock, 1, stack.getItemDamage()))) {
+ short meta = (short)stack.getItemDamage();
+ for (OreSmallWrapper oreSmallWorldGen: GT6OreSmallHelper.mapOreSmallWrapper.values()) {
+ if (oreSmallWorldGen.oreMeta == meta) {
+ List<ItemStack> stackList = new ArrayList<ItemStack>();
+ List<ItemStack> materialDustStackList = new ArrayList<ItemStack>();
+ for (PrefixBlock prefixBlock: GT6OreSmallHelper.setOreSmallBasicTypes) {
+ stackList.add(new ItemStack(prefixBlock, 1, meta));
+ Drops_SmallOre drops_SmallOre = ((Drops_SmallOre)prefixBlock.mDrops);
+ Class clazzDropsOreSmall = drops_SmallOre.getClass();
+ try {
+ Field fieldSecondaryDrop = clazzDropsOreSmall.getDeclaredField("mSecondaryDrop");
+ fieldSecondaryDrop.setAccessible(true);
+ OreDictMaterial oreDictMaterial = (OreDictMaterial)fieldSecondaryDrop.get(drops_SmallOre);
+ materialDustStackList.add(OP.dust.mat(oreDictMaterial.mTargetCrushing.mMaterial, 1L));
+ } catch (Exception e) {}
+ }
+ this.arecipes.add(new CachedOreSmallRecipe(oreSmallWorldGen.oreGenName, stackList, materialDustStackList, GT6OreSmallHelper.mapOreMetaToOreDrops.get(meta)));
+ }
+ }
+ }
+ else if (GT6OreSmallHelper.mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {
+ short meta = GT6OreSmallHelper.mapOreDropUnlocalizedNameToOreMeta.get(stack.getUnlocalizedName());
+ for (String oreGenName: GT6OreSmallHelper.mapOreSmallWrapper.keySet()) {
+ OreSmallWrapper oreSmallWrapper = GT6OreSmallHelper.mapOreSmallWrapper.get(oreGenName);
+ if (oreSmallWrapper.oreMeta == meta) {
+ List<ItemStack> stackList = new ArrayList<ItemStack>();
+ List<ItemStack> materialDustStackList = new ArrayList<ItemStack>();
+ for (PrefixBlock prefixBlock: GT6OreSmallHelper.setOreSmallBasicTypes) {
+ stackList.add(new ItemStack(prefixBlock, 1, meta));
+ Drops_SmallOre drops_OreSmall = ((Drops_SmallOre)prefixBlock.mDrops);
+ Class clazzDropsOreSmall = drops_OreSmall.getClass();
+ try {
+ Field fieldSecondaryDrop = clazzDropsOreSmall.getDeclaredField("mSecondaryDrop");
+ fieldSecondaryDrop.setAccessible(true);
+ OreDictMaterial oreDictMaterial = (OreDictMaterial)fieldSecondaryDrop.get(drops_OreSmall);
+ materialDustStackList.add(OP.dust.mat(oreDictMaterial.mTargetCrushing.mMaterial, 1L));
+ } catch (Exception e) {}
+ }
+ this.arecipes.add(new CachedOreSmallRecipe(GT6OreSmallHelper.mapOreSmallWrapper.get(oreGenName).oreGenName, stackList, materialDustStackList, GT6OreSmallHelper.mapOreMetaToOreDrops.get(meta)));
+ }
+ }
+ }
+ else
+ super.loadCraftingRecipes(stack);
+ }
+
+ @Override
+ public String getOutputId() {
+ return "GTOrePluginOreSmall";
+ }
+
+ @Override
+ public String getRecipeName() {
+ return I18n.format("gtnop.gui.smallOreStat.name");
+ }
+
+}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java
new file mode 100644
index 0000000000..83ebb1211e
--- /dev/null
+++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java
@@ -0,0 +1,138 @@
+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.plugin.PluginBase;
+import pers.gwyog.gtneioreplugin.util.GT6OreLayerHelper;
+import pers.gwyog.gtneioreplugin.util.GT6OreLayerHelper.OreLayerWrapper;
+
+public class PluginGT6VeinStat 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((cycleticks / 20) % positionedStackPrimary.items.length);;
+ positionedStackBetween.setPermutationToRender((cycleticks / 20) % positionedStackPrimary.items.length);;
+ positionedStackSporadic.setPermutationToRender((cycleticks / 20) % positionedStackPrimary.items.length);;
+ ingredientsList.add(positionedStackPrimary);
+ ingredientsList.add(positionedStackSecondary);
+ ingredientsList.add(positionedStackBetween);
+ ingredientsList.add(positionedStackSporadic);
+ return ingredientsList;
+ }
+
+ @Override
+ public PositionedStack getResult() {
+ return null;
+ }
+
+ }
+
+ @Override
+ public void loadCraftingRecipes(String outputId, Object... results) {
+ if (outputId.equals(getOutputId())) {
+ OreLayerWrapper oreLayerWrapper;
+ for (String veinName: GT6OreLayerHelper.mapOreLayerWrapper.keySet()) {
+ oreLayerWrapper = GT6OreLayerHelper.mapOreLayerWrapper.get(veinName);
+ List<ItemStack> stackListPrimary = new ArrayList<ItemStack>();
+ List<ItemStack> stackListSecondary = new ArrayList<ItemStack>();
+ List<ItemStack> stackListBetween = new ArrayList<ItemStack>();
+ List<ItemStack> stackListSporadic = new ArrayList<ItemStack>();
+ for (PrefixBlock prefixBlock: GT6OreLayerHelper.setOreNormalBasicTypes) {
+ stackListPrimary.add(new ItemStack(prefixBlock, 1, oreLayerWrapper.primaryMeta));
+ stackListSecondary.add(new ItemStack(prefixBlock, 1, oreLayerWrapper.secondaryMeta));
+ stackListBetween.add(new ItemStack(prefixBlock, 1, oreLayerWrapper.betweenMeta));
+ stackListSporadic.add(new ItemStack(prefixBlock, 1, oreLayerWrapper.sporadicMeta));
+ }
+ this.arecipes.add(new CachedVeinStatRecipe(veinName, stackListPrimary, stackListSecondary, stackListBetween, stackListSporadic));
+ }
+ }
+ else
+ super.loadCraftingRecipes(outputId, results);
+ }
+
+ @Override
+ public void loadCraftingRecipes(ItemStack stack) {
+ String unlocalizedName = stack.getUnlocalizedName();
+ if (unlocalizedName.startsWith("oredict.ore") && !unlocalizedName.startsWith("oredict.oreSmall") && !unlocalizedName.startsWith("oredict.oreBedrock")) {
+ short meta = (short)stack.getItemDamage();
+ for (OreLayerWrapper worldGen: GT6OreLayerHelper.mapOreLayerWrapper.values()) {
+ if (meta==worldGen.primaryMeta || meta==worldGen.secondaryMeta || meta==worldGen.betweenMeta || meta==worldGen.sporadicMeta) {
+ List<ItemStack> stackListPrimary = new ArrayList<ItemStack>();
+ List<ItemStack> stackListSecondary = new ArrayList<ItemStack>();
+ List<ItemStack> stackListBetween = new ArrayList<ItemStack>();
+ List<ItemStack> stackListSporadic = new ArrayList<ItemStack>();
+ for (PrefixBlock prefixBlock: GT6OreLayerHelper.setOreNormalBasicTypes) {
+ stackListPrimary.add(new ItemStack(prefixBlock, 1, worldGen.primaryMeta));
+ stackListSecondary.add(new ItemStack(prefixBlock, 1, worldGen.secondaryMeta));
+ stackListBetween.add(new ItemStack(prefixBlock, 1, worldGen.betweenMeta));
+ stackListSporadic.add(new ItemStack(prefixBlock, 1, worldGen.sporadicMeta));
+ }
+ this.arecipes.add(new CachedVeinStatRecipe(worldGen.veinName, stackListPrimary, stackListSecondary, stackListBetween, stackListSporadic));
+ }
+ }
+ }
+ else
+ super.loadCraftingRecipes(stack);
+ }
+
+ @Override
+ public void drawExtras(int recipe) {
+ CachedVeinStatRecipe crecipe = (CachedVeinStatRecipe) this.arecipes.get(recipe);
+ OreLayerWrapper oreLayer = GT6OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName);
+ GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer.veinName), 2, 18, 0x404040, false);
+ GuiDraw.drawString(I18n.format("gtnop.gui.nei.primaryOre") + ": " + GT6OreLayerHelper.mapMetaToLocalizedName.get(oreLayer.primaryMeta), 2, 31, 0x404040, false);
+ GuiDraw.drawString(I18n.format("gtnop.gui.nei.secondaryOre") + ": " + GT6OreLayerHelper.mapMetaToLocalizedName.get(oreLayer.secondaryMeta), 2, 44, 0x404040, false);
+ GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + GT6OreLayerHelper.mapMetaToLocalizedName.get(oreLayer.betweenMeta), 2, 57, 0x404040, false);
+ GuiDraw.drawString(I18n.format("gtnop.gui.nei.sporadicOre") + ": " + GT6OreLayerHelper.mapMetaToLocalizedName.get(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.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 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/GT5OreLayerHelper.java
index fd674464cb..9026aec71d 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/util/GTOreLayerHelper.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java
@@ -12,9 +12,10 @@ import gregtech.api.GregTech_API;
import gregtech.common.GT_Worldgen_GT_Ore_Layer;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
+import pers.gwyog.gtneioreplugin.GTNEIOrePlugin;
import sun.awt.windows.WWindowPeer;
-public class GTOreLayerHelper {
+public class GT5OreLayerHelper {
public static boolean restrictBiomeSupport = false;
public static boolean endAsteroidSupport = false;
public static boolean gcBasicSupport = false;
@@ -22,11 +23,11 @@ public class GTOreLayerHelper {
public static boolean immersiveEngineeringSupport = false;
public static HashMap<String, OreLayerWrapper> mapOreLayerWrapper = new HashMap<String, OreLayerWrapper>();
- public GTOreLayerHelper() {
+ public GT5OreLayerHelper() {
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;
@@ -54,7 +55,7 @@ public class GTOreLayerHelper {
}
// immersive engineering support for GT5.09.25+
- if (Loader.isModLoaded("ImmersiveEngineering")) {
+ if (Loader.instance().isModLoaded("ImmersiveEngineering")) {
Class clazzGTMod = null;
Class clazzGTProxy = null;
Class clazzGTAPI = null;
@@ -106,13 +107,13 @@ public class GTOreLayerHelper {
this.genEnd = worldGen.mEnd;
if (restrictBiomeSupport)
this.restrictBiome = worldGen.mRestrictBiome;
- if (GTOreLayerHelper.gcBasicSupport) {
+ if (GT5OreLayerHelper.gcBasicSupport) {
this.genMoon = worldGen.mMoon;
this.genMars = worldGen.mMars;
}
- if (GTOreLayerHelper.endAsteroidSupport)
+ if (GT5OreLayerHelper.endAsteroidSupport)
this.genEndAsteroid = worldGen.mEndAsteroid;
- if (GTOreLayerHelper.gcAsteroidSupport)
+ if (GT5OreLayerHelper.gcAsteroidSupport)
this.genGCAsteroid = worldGen.mAsteroid;
// immersive engineering support for GT5.09.25+
@@ -121,6 +122,7 @@ public class GTOreLayerHelper {
this.weightedIEChance = String.format("%.3f%%", (100.0f*worldGen.mWeight)/GT_Worldgen_GT_Ore_Layer.sWeight/8);
}
}
+
}
}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GTSmallOreHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java
index 5c8168e503..69311a83ee 100644
--- a/src/main/java/pers/gwyog/gtneioreplugin/util/GTSmallOreHelper.java
+++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java
@@ -13,16 +13,17 @@ import gregtech.api.world.GT_Worldgen;
import gregtech.common.GT_Worldgen_GT_Ore_SmallPieces;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
+import pers.gwyog.gtneioreplugin.GTNEIOrePlugin;
-public class GTSmallOreHelper {
+public class GT5OreSmallHelper {
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 List<ItemStack> oreSmallList = new ArrayList<ItemStack>();
+ public static HashMap<String, OreSmallWrapper> mapOreSmallWrapper = new HashMap<String, OreSmallWrapper>();
public static HashMap<String, Short> mapOreDropUnlocalizedNameToOreMeta = new HashMap<String, Short>();
public static HashMap<Short, List<ItemStack>> mapOreMetaToOreDrops = new HashMap<Short, List<ItemStack>>();
- public GTSmallOreHelper() {
+ public GT5OreSmallHelper() {
checkExtraSupport();
ItemStack stack;
Materials material;
@@ -32,7 +33,7 @@ public class GTSmallOreHelper {
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));
+ mapOreSmallWrapper.put(worldGen.mWorldGenName, new OreSmallWrapper(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);
@@ -49,35 +50,37 @@ public class GTSmallOreHelper {
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));
+ oreSmallList.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) {
+ if (GTNEIOrePlugin.GTVersion.equals("GT5")) {
+ Class clazzGTOreSmall = 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) {}
- }
+ clazzGTOreSmall = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_SmallPieces");
+ } catch (ClassNotFoundException e) {}
+ if (clazzGTOreSmall != null) {
+ try {
+ Field fieldRestrictBiome = clazzGTOreSmall.getField("mRestrictBiome");;
+ restrictBiomeSupport = true;
+ } catch (Exception e) {}
+ try {
+ Field fieldGCMoon = clazzGTOreSmall.getField("mMoon");
+ Field fieldGCMars = clazzGTOreSmall.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 class OreSmallWrapper {
public String oreGenName;
public short oreMeta;
public String worldGenHeightRange;
@@ -89,7 +92,7 @@ public class GTSmallOreHelper {
public boolean genMoon = false;
public boolean genMars = false;
- public SmallOreWrapper(GT_Worldgen_GT_Ore_SmallPieces worldGen) {
+ public OreSmallWrapper(GT_Worldgen_GT_Ore_SmallPieces worldGen) {
this.oreGenName = worldGen.mWorldGenName;
this.oreMeta = worldGen.mMeta;
this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY;
@@ -97,9 +100,9 @@ public class GTSmallOreHelper {
this.genOverworld = worldGen.mOverworld;
this.genNether = worldGen.mNether;
this.genEnd = worldGen.mEnd;
- if (GTSmallOreHelper.restrictBiomeSupport)
+ if (GT5OreSmallHelper.restrictBiomeSupport)
this.restrictBiome = worldGen.mRestrictBiome;
- if (GTSmallOreHelper.gcBasicSupport) {
+ if (GT5OreSmallHelper.gcBasicSupport) {
this.genMoon = worldGen.mMoon;
this.genMars = worldGen.mMars;
}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreBedrockHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreBedrockHelper.java
new file mode 100644
index 0000000000..be95bcc7b3
--- /dev/null
+++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreBedrockHelper.java
@@ -0,0 +1,56 @@
+package pers.gwyog.gtneioreplugin.util;
+
+import java.util.HashMap;
+
+import gregapi.data.CS;
+import gregapi.data.OP;
+import gregapi.lang.LanguageHandler;
+import gregapi.oredict.OreDictMaterial;
+import gregapi.worldgen.WorldgenObject;
+import gregapi.worldgen.Worldgen_GT_Ore_Bedrock;
+import gregapi.worldgen.Worldgenerator;
+import net.minecraft.client.resources.I18n;
+
+public class GT6OreBedrockHelper {
+ public static HashMap<String, OreBedrockWrapper> mapOreBedrockWrapper = new HashMap<String, OreBedrockWrapper>();
+ public static HashMap<Short, String> mapMetaToLocalizedName = new HashMap<Short, String>();
+
+ public GT6OreBedrockHelper() {
+ for (WorldgenObject worldGenOreBedrock : Worldgenerator.sWorldgenList)
+ if (worldGenOreBedrock.mWorldGenName.startsWith("ore.bedrock.") && worldGenOreBedrock instanceof Worldgen_GT_Ore_Bedrock)
+ mapOreBedrockWrapper.put(worldGenOreBedrock.mWorldGenName, new OreBedrockWrapper((Worldgen_GT_Ore_Bedrock)worldGenOreBedrock));
+ }
+
+ public 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.getLocalName(OP.oreBedrock, CS.BlocksGT.oreBedrock.getMetaMaterial(meta));
+ }
+
+ public class OreBedrockWrapper {
+ public String veinName;
+ public short meta;
+ public int probability;
+ public boolean genOverworld = false;
+ public boolean genNether = false;
+ public boolean genEnd = false;
+
+ public OreBedrockWrapper(Worldgen_GT_Ore_Bedrock worldGen) {
+ this.veinName = worldGen.mWorldGenName;
+ this.meta = worldGen.mMaterial.mID;
+ this.probability = worldGen.mProbability;
+ this.genOverworld = worldGen.mOverworld;
+ this.genNether = worldGen.mNether;
+ this.genEnd = worldGen.mEnd;
+ if (!GT6OreLayerHelper.mapMetaToLocalizedName.keySet().contains(meta))
+ GT6OreLayerHelper.mapMetaToLocalizedName.put(meta, GT6OreLayerHelper.getLocalizedOreName(meta));
+ if (!GT6OreSmallHelper.mapMetaToLocalizedName.keySet().contains(meta))
+ GT6OreSmallHelper.mapMetaToLocalizedName.put(meta, GT6OreSmallHelper.getLocalizedSmallOreName(meta));
+ if (!mapMetaToLocalizedName.keySet().contains(meta))
+ mapMetaToLocalizedName.put(meta, getLocalizedOreBedrockName(meta));
+ }
+ }
+
+}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java
new file mode 100644
index 0000000000..ce5da9feb8
--- /dev/null
+++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java
@@ -0,0 +1,76 @@
+package pers.gwyog.gtneioreplugin.util;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
+
+import cpw.mods.fml.common.Loader;
+import gregapi.block.IBlockPlacable;
+import gregapi.block.prefixblock.PrefixBlock;
+import gregapi.data.CS;
+import gregapi.data.OP;
+import gregapi.lang.LanguageHandler;
+import gregapi.worldgen.Worldgen_GT_Ore_Layer;
+import gregtech.GT_Mod;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.item.ItemStack;
+import pers.gwyog.gtneioreplugin.GTNEIOrePlugin;
+
+public class GT6OreLayerHelper {
+ public static HashMap<String, OreLayerWrapper> mapOreLayerWrapper = new HashMap<String, OreLayerWrapper>();
+ public static HashMap<Short, String> mapMetaToLocalizedName = new HashMap<Short, String>();
+ public static Set<PrefixBlock> setOreNormalBasicTypes = new HashSet<PrefixBlock>();
+
+ public GT6OreLayerHelper() {
+ for (Worldgen_GT_Ore_Layer tWorldGen: Worldgen_GT_Ore_Layer.sList)
+ mapOreLayerWrapper.put(tWorldGen.mWorldGenName, new OreLayerWrapper(tWorldGen));
+ Set<IBlockPlacable> setNormalOreBasicTypesTemp = new HashSet<IBlockPlacable>(CS.BlocksGT.stoneToNormalOres.values());
+ for (IBlockPlacable block: setNormalOreBasicTypesTemp)
+ if (block instanceof PrefixBlock)
+ setOreNormalBasicTypes.add((PrefixBlock)block);
+ }
+
+ public 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.getLocalName(OP.ore, CS.BlocksGT.ore.getMetaMaterial(meta));
+ }
+
+ 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 boolean genOverworld = false;
+ public boolean genNether = false;
+ public boolean genEnd = false;
+
+ public OreLayerWrapper(Worldgen_GT_Ore_Layer worldGen) {
+ this.veinName = worldGen.mWorldGenName;
+ this.primaryMeta = worldGen.mPrimaryMeta;
+ this.secondaryMeta = worldGen.mSecondaryMeta;
+ this.betweenMeta = worldGen.mBetweenMeta;
+ this.sporadicMeta = worldGen.mSporadicMeta;
+ this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY;
+ this.weightedChance = String.format("%.2f%%", (100.0f*worldGen.mWeight)/Worldgen_GT_Ore_Layer.sWeight);
+ this.genOverworld = worldGen.mOverworld;
+ this.genNether = worldGen.mNether;
+ this.genEnd = worldGen.mEnd;
+ if (!mapMetaToLocalizedName.keySet().contains(primaryMeta))
+ mapMetaToLocalizedName.put(primaryMeta, getLocalizedOreName(primaryMeta));
+ if (!mapMetaToLocalizedName.keySet().contains(secondaryMeta))
+ mapMetaToLocalizedName.put(secondaryMeta, getLocalizedOreName(secondaryMeta));
+ if (!mapMetaToLocalizedName.keySet().contains(betweenMeta))
+ mapMetaToLocalizedName.put(betweenMeta, getLocalizedOreName(betweenMeta));
+ if (!mapMetaToLocalizedName.keySet().contains(sporadicMeta))
+ mapMetaToLocalizedName.put(sporadicMeta, getLocalizedOreName(sporadicMeta));
+ }
+ }
+
+}
diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreSmallHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreSmallHelper.java
new file mode 100644
index 0000000000..33598b0d98
--- /dev/null
+++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreSmallHelper.java
@@ -0,0 +1,100 @@
+package pers.gwyog.gtneioreplugin.util;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import gregapi.block.IBlockPlacable;
+import gregapi.block.prefixblock.PrefixBlock;
+import gregapi.data.CS;
+import gregapi.data.MT;
+import gregapi.data.OP;
+import gregapi.lang.LanguageHandler;
+import gregapi.oredict.OreDictMaterial;
+import gregapi.worldgen.WorldgenObject;
+import gregapi.worldgen.Worldgen_GT_Ore_SmallPieces;
+import gregapi.worldgen.Worldgenerator;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.item.ItemStack;
+import pers.gwyog.gtneioreplugin.GTNEIOrePlugin;
+
+public class GT6OreSmallHelper {
+ public static List<ItemStack> oreSmallList = new ArrayList<ItemStack>();
+ public static HashMap<String, OreSmallWrapper> mapOreSmallWrapper = new HashMap<String, OreSmallWrapper>();
+ public static HashMap<String, Short> mapOreDropUnlocalizedNameToOreMeta = new HashMap<String, Short>();
+ public static HashMap<Short, List<ItemStack>> mapOreMetaToOreDrops = new HashMap<Short, List<ItemStack>>();
+ public static HashMap<Short, String> mapMetaToLocalizedName = new HashMap<Short, String>();
+ public static Set<PrefixBlock> setOreSmallBasicTypes = new HashSet<PrefixBlock>();
+
+ public GT6OreSmallHelper() {
+ ItemStack stack;
+ OreDictMaterial material;
+ PrefixBlock oreSmall = CS.BlocksGT.oreSmall;
+ short meta;
+ for (WorldgenObject worldGen : Worldgenerator.sWorldgenList)
+ if (worldGen.mWorldGenName.startsWith("ore.small.") && worldGen instanceof Worldgen_GT_Ore_SmallPieces) {
+ Worldgen_GT_Ore_SmallPieces worldGenSmallPieces = (Worldgen_GT_Ore_SmallPieces)worldGen;
+ meta = worldGenSmallPieces.mMeta;
+ material = oreSmall.getMetaMaterial(meta);
+ mapOreSmallWrapper.put(worldGen.mWorldGenName, new OreSmallWrapper(worldGenSmallPieces));
+ if (!mapOreMetaToOreDrops.keySet().contains(meta)) {
+ List<ItemStack> stackList = new ArrayList<ItemStack>();
+ stack = OP.gemExquisite.mat(material, OP.gem.mat(material, 1L), 1L);
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);}
+ stack = OP.gemFlawless.mat(material, OP.gem.mat(material, 1L), 1L);
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);}
+ stack = OP.gem.mat(material, 1L);
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);}
+ stack = OP.gemFlawed.mat(material, OP.crushed.mat(material, 1L), 1L);
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);}
+ stack = OP.crushed.mat(material, 1L);
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);}
+ stack = OP.gemChipped.mat(material, OP.dustImpure.mat(material, 1L), 1L);
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);}
+ stack = OP.dustImpure.mat(material, OP.dust.mat(material, 1L), 1L);
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);}
+ stack = OP.gemLegendary.mat(material, 1L);
+ if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);}
+ oreSmallList.add(new ItemStack(oreSmall, 1, meta));
+ mapOreMetaToOreDrops.put(meta, stackList);
+ }
+ mapMetaToLocalizedName.put(meta, getLocalizedSmallOreName(meta));
+ Set<IBlockPlacable> setSmallOreBasicTypesTemp = new HashSet<IBlockPlacable>(CS.BlocksGT.stoneToSmallOres.values());
+ for (IBlockPlacable block: setSmallOreBasicTypesTemp)
+ if (block instanceof PrefixBlock)
+ setOreSmallBasicTypes.add((PrefixBlock)block);
+ }
+ }
+
+ 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.getLocalName(OP.oreSmall, CS.BlocksGT.oreSmall.getMetaMaterial(meta));
+ }
+
+ public class OreSmallWrapper {
+ public String oreGenName;
+ public short oreMeta;
+ public String worldGenHeightRange;
+ public String amountPerChunk;
+ public boolean genOverworld = false;
+ public boolean genNether = false;
+ public boolean genEnd = false;
+
+ public OreSmallWrapper(Worldgen_GT_Ore_SmallPieces worldGen) {
+ this.oreGenName = worldGen.mWorldGenName;
+ this.oreMeta = worldGen.mMeta;
+ this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY;
+ this.amountPerChunk = worldGen.mAmount/2 + "-" + (worldGen.mAmount/2 + (worldGen.mAmount+1)/2);
+ this.genOverworld = worldGen.mOverworld;
+ this.genNether = worldGen.mNether;
+ this.genEnd = worldGen.mEnd;
+ }
+ }
+
+}