diff options
16 files changed, 1271 insertions, 0 deletions
diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000000..635cfc9ef5 --- /dev/null +++ b/build.gradle @@ -0,0 +1,56 @@ +buildscript { + repositories { + mavenCentral() + maven { + name = "forge" + url = "http://files.minecraftforge.net/maven" + } + maven { + name = "sonatype" + url = "https://oss.sonatype.org/content/repositories/snapshots/" + } + } + dependencies { + classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' + } +} + +apply plugin: 'forge' + +version = "1.0.0" +group= "pers.gwyog.gtneioreplugin" +archivesBaseName = "gtneioreplugin" + +sourceCompatibility = 1.7 +targetCompatibility = 1.7 + +minecraft { + version = "1.7.10-10.13.4.1614-1.7.10" + runDir = "eclipse" +} + +dependencies { + compile "codechicken:NotEnoughItems:1.7.10-1.0.5.120:dev" + compile "codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev" + compile "codechicken:CodeChickenCore:1.7.10-1.0.7.47:dev" +} + +processResources +{ + // this will ensure that this task is redone when the versions change. + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version + + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' + + // replace version and mcversion + expand 'version':project.version, 'mcversion':project.minecraft.version + } + + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } +} diff --git a/gradlew b/gradlew new file mode 100644 index 0000000000..91a7e269e1 --- /dev/null +++ b/gradlew @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000000..8a0b282aa6 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java new file mode 100644 index 0000000000..fdf92404f8 --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -0,0 +1,29 @@ +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.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.event.ClientTickHandler; + +@Mod(modid = GTNEIOrePlugin.MODID, name = GTNEIOrePlugin.NAME, version = GTNEIOrePlugin.VERSION, dependencies = "required-after:gregtech") +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.0"; + + @Mod.Instance(MODID) + public static GTNEIOrePlugin instance; + + @EventHandler + public void init(FMLInitializationEvent event) { + if (event.getSide() == Side.CLIENT) + FMLCommonHandler.instance().bus().register(new ClientTickHandler()); + } + +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/event/ClientTickHandler.java b/src/main/java/pers/gwyog/gtneioreplugin/event/ClientTickHandler.java new file mode 100644 index 0000000000..cb83a4974d --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/event/ClientTickHandler.java @@ -0,0 +1,19 @@ +package pers.gwyog.gtneioreplugin.event; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent; +import pers.gwyog.gtneioreplugin.util.GTOreLayerHelper; +import pers.gwyog.gtneioreplugin.util.GTSmallOreHelper; + +public class ClientTickHandler { + public boolean hasInitialized = false; + + @SubscribeEvent + public void onTick(ClientTickEvent event) { + if (!hasInitialized) { + new GTOreLayerHelper(); + new GTSmallOreHelper(); + hasInitialized = true; + } + } +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java new file mode 100644 index 0000000000..a4813c746b --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java @@ -0,0 +1,32 @@ +package pers.gwyog.gtneioreplugin.plugin; + +import codechicken.nei.api.API; +import codechicken.nei.api.IConfigureNEI; +import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; + +public class NEIPluginConfig implements IConfigureNEI { + + @Override + public String getName() { + return "GregTech Ore Plugin"; + } + + @Override + public String getVersion() { + return GTNEIOrePlugin.VERSION; + } + + @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 new file mode 100644 index 0000000000..1dc55c441f --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java @@ -0,0 +1,134 @@ +package pers.gwyog.gtneioreplugin.plugin; + +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.List; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRect; +import gregtech.api.GregTech_API; +import gregtech.api.util.GT_LanguageManager; +import net.minecraft.client.resources.I18n; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import pers.gwyog.gtneioreplugin.plugin.PluginVeinStat.CachedVeinStatRecipe; +import pers.gwyog.gtneioreplugin.util.GTOreLayerHelper; +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("gui.nei.veinName") + ": " + I18n.format(oreLayer.veinName), 2, 18, 0x404040, false); + GuiDraw.drawString(I18n.format("gui.nei.asteroidPrimary") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.primaryMeta)), 2, 31, 0x404040, false); + GuiDraw.drawString(I18n.format("gui.nei.asteroidSecondary") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.secondaryMeta)), 2, 44, 0x404040, false); + GuiDraw.drawString(I18n.format("gui.nei.asteroidBetween") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.betweenMeta)), 2, 57, 0x404040, false); + GuiDraw.drawString(I18n.format("gui.nei.asteroidSporadic") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.sporadicMeta)), 2, 70, 0x404040, false); + GuiDraw.drawString(I18n.format("gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genEndAsteroid, oreLayer.genGCAsteroid), 2, 83, 0x404040, false); + GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("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("world.end.name"); + } + if (genGCAsteroid) { + if (!worldNameTranslatedAsteroid.isEmpty()) + worldNameTranslatedAsteroid += ", "; + worldNameTranslatedAsteroid += I18n.format("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("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 new file mode 100644 index 0000000000..e225ea0944 --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java @@ -0,0 +1,46 @@ +package pers.gwyog.gtneioreplugin.plugin; + +import java.awt.Rectangle; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.recipe.TemplateRecipeHandler; +import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRect; +import net.minecraft.client.resources.I18n; +import net.minecraft.util.EnumChatFormatting; + +public class PluginBase extends TemplateRecipeHandler { + + @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 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())); + } + + public String getOutputId() { + return null; + } + + public String getGTOreUnlocalizedName(short index) { + return "gt.blockores." + index + ".name"; + } + + 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 new file mode 100644 index 0000000000..ba8c39babb --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java @@ -0,0 +1,165 @@ +package pers.gwyog.gtneioreplugin.plugin; + +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.List; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_OreDictUnificator; +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; + +public class PluginSmallOreStat extends PluginBase { + + 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); + 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))); + 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("gui.nei.oreName") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName((short)(smallOre.oreMeta+16000))), 2, 18, 0x404040, false); + GuiDraw.drawString(I18n.format("gui.nei.genHeight") + ": " + smallOre.worldGenHeightRange, 2, 31, 0x404040, false); + GuiDraw.drawString(I18n.format("gui.nei.amount") + ": " + smallOre.amountPerChunk, 2, 44, 0x404040, false); + GuiDraw.drawString(I18n.format("gui.nei.worldNames") + ": " + getWorldNameTranslated(smallOre.genOverworld, smallOre.genNether, smallOre.genEnd, smallOre.genMoon, smallOre.genMars), 2, 57, 0x404040, false); + GuiDraw.drawString(I18n.format("gui.nei.restrictBiome") + ": " + getBiomeTranslated(smallOre.restrictBiome), 2, 70, 0x404040, false); + GuiDraw.drawString(I18n.format("gui.nei.chanceDrops") + ": ", 2, 83, 0x404040, false); + GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); + } + + public String getBiomeTranslated(String unlocalizedBiome) { + return unlocalizedBiome.equals("None")? I18n.format("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("world.overworld.name"); + } + if (genNether) { + if (!worldNameTranslated.isEmpty()) + worldNameTranslated += ", "; + worldNameTranslated += I18n.format("world.nether.name"); + } + if (genEnd) { + if (!worldNameTranslated.isEmpty()) + worldNameTranslated += ", "; + worldNameTranslated += I18n.format("world.end.name"); + } + if (genMoon) { + if (!worldNameTranslated.isEmpty()) + worldNameTranslated += ", "; + worldNameTranslated += I18n.format("world.moon.name"); + } + if (genMars) { + if (!worldNameTranslated.isEmpty()) + worldNameTranslated += ", "; + worldNameTranslated += I18n.format("world.mars.name"); + } + return worldNameTranslated; + } + + @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>(); + for (int i=0;i<7;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<7;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("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 new file mode 100644 index 0000000000..f281b3b29e --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java @@ -0,0 +1,175 @@ +package pers.gwyog.gtneioreplugin.plugin; + +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.List; + +import org.apache.http.impl.conn.tsccm.ConnPoolByRoute; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler; +import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRect; +import gregtech.api.GregTech_API; +import gregtech.api.util.GT_LanguageManager; +import gregtech.common.GT_Worldgen_GT_Ore_Layer; +import net.minecraft.client.gui.Gui; +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; + +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()) { + System.out.println(worldGen.primaryMeta + "," + worldGen.secondaryMeta + "," + worldGen.betweenMeta + "," + worldGen.sporadicMeta); + 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<7;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("gui.nei.veinName") + ": " + I18n.format(oreLayer.veinName), 2, 18, 0x404040, false); + GuiDraw.drawString(I18n.format("gui.nei.primaryOre") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.primaryMeta)), 2, 31, 0x404040, false); + GuiDraw.drawString(I18n.format("gui.nei.secondaryOre") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.secondaryMeta)), 2, 44, 0x404040, false); + GuiDraw.drawString(I18n.format("gui.nei.betweenOre") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.betweenMeta)), 2, 57, 0x404040, false); + GuiDraw.drawString(I18n.format("gui.nei.sporadicOre") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.sporadicMeta)), 2, 70, 0x404040, false); + GuiDraw.drawString(I18n.format("gui.nei.genHeight") + ": " + oreLayer.worldGenHeightRange, 2, 83, 0x404040, false); + GuiDraw.drawString(I18n.format("gui.nei.weightedChance") + ": " + oreLayer.weightedChance, 2, 96, 0x404040, false); + GuiDraw.drawString(I18n.format("gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genOverworld, oreLayer.genNether, oreLayer.genEnd, oreLayer.genMoon, oreLayer.genMars), 2, 109, 0x404040, false); + GuiDraw.drawString(I18n.format("gui.nei.restrictBiome") + ": " + getBiomeTranslated(oreLayer.restrictBiome), 2, 122, 0x404040, false); + GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); + } + + public String getBiomeTranslated(String unlocalizedBiome) { + return unlocalizedBiome.equals("None")? I18n.format("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("world.overworld.name"); + } + if (genNether) { + if (!worldNameTranslated.isEmpty()) + worldNameTranslated += ", "; + worldNameTranslated += I18n.format("world.nether.name"); + } + if (genEnd) { + if (!worldNameTranslated.isEmpty()) + worldNameTranslated += ", "; + worldNameTranslated += I18n.format("world.end.name"); + } + if (genMoon) { + if (!worldNameTranslated.isEmpty()) + worldNameTranslated += ", "; + worldNameTranslated += I18n.format("world.moon.name"); + } + if (genMars) { + if (!worldNameTranslated.isEmpty()) + worldNameTranslated += ", "; + worldNameTranslated += I18n.format("world.mars.name"); + } + return worldNameTranslated; + } + + @Override + public String getOutputId() { + return "GTOrePluginVein"; + } + + @Override + public String getRecipeName() { + return I18n.format("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 new file mode 100644 index 0000000000..e6f9541e9f --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GTOreLayerHelper.java @@ -0,0 +1,98 @@ +package pers.gwyog.gtneioreplugin.util; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import gregtech.common.GT_Worldgen_GT_Ore_Layer; +import net.minecraft.client.resources.I18n; +import net.minecraft.item.ItemStack; +import sun.awt.windows.WWindowPeer; + +public class GTOreLayerHelper { + 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 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.restrictBiome = worldGen.mRestrictBiome; + this.genOverworld = worldGen.mOverworld; + this.genNether = worldGen.mNether; + this.genEnd = worldGen.mEnd; + 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 new file mode 100644 index 0000000000..40889e8c11 --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GTSmallOreHelper.java @@ -0,0 +1,102 @@ +package pers.gwyog.gtneioreplugin.util; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_OreDictUnificator; +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; + +public class GTSmallOreHelper { + 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 clazzGTOreLayer = null; + try { + clazzGTOreLayer = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_SmallPieces"); + } catch (ClassNotFoundException e) {} + if (clazzGTOreLayer != null) { + try { + Field fieldGCMoon = clazzGTOreLayer.getField("mMoon"); + Field fieldGCMars = clazzGTOreLayer.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.restrictBiome = worldGen.mRestrictBiome; + this.genOverworld = worldGen.mOverworld; + this.genNether = worldGen.mNether; + this.genEnd = worldGen.mEnd; + if (GTOreLayerHelper.gcBasicSupport) { + this.genMoon = worldGen.mMoon; + this.genMars = worldGen.mMars; + } + } + } +} diff --git a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang new file mode 100644 index 0000000000..925a8d2fad --- /dev/null +++ b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang @@ -0,0 +1,73 @@ +# gui names +gui.veinStat.name=Vein Stats +gui.asteroidStat.name=Asteroid Stats +gui.smallOreStat.name=Small Ore Stats + +gui.nei.veinName=Vein name +gui.nei.primaryOre=Primary-Gen +gui.nei.secondaryOre=Secondary-Gen +gui.nei.betweenOre=Between-Gen +gui.nei.sporadicOre=Sporadic-Gen +gui.nei.genHeight=Height +gui.nei.weightedChance=Chance +gui.nei.worldNames=Generated world +gui.nei.restrictBiome=Restricted biome + +gui.nei.asteroidPrimary=Main-Gen1 +gui.nei.asteroidSecondary=Main-Gen2 +gui.nei.asteroidBetween=Minor-Gen1 +gui.nei.asteroidSporadic=Minor-Gen2 + +gui.nei.oreName=Ore name +gui.nei.amount=Amount per chunk +gui.nei.chanceDrops=Drops + +gui.nei.seeAll=See All + + +# world names +world.overworld.name=Overworld +world.nether.name=Nether +world.end.name=End +world.moon.name=Moon +world.mars.name=Mars +world.asteroid.name=GalactiCraft Asteroid + + +# biome names +biome.none.name=None + + +# vein names +ore.mix.naquadah=Naquadah Vein +ore.mix.lignite=Lignite Vein +ore.mix.coal=Coal Vein +ore.mix.magnetite=Magnetite Vein +ore.mix.gold=Gold Vein +ore.mix.iron=Iron Vein +ore.mix.cassiterite=Cassiterite Vein +ore.mix.tetrahedrite=Tetrahedrite Vein +ore.mix.netherquartz=Nether Quartz Vein +ore.mix.sulfur=Sulfur Vein +ore.mix.copper=Copper Vein +ore.mix.bauxite=Bauxite Vein +ore.mix.salts=Salts Vein +ore.mix.redstone=Redstone Vein +ore.mix.soapstone=Soapstone Vein +ore.mix.nickel=Nickel Vein +ore.mix.platinum=Platinum Vein +ore.mix.pitchblende=Pitchblends Vein +ore.mix.uranium=Uranium Vein +ore.mix.monazite=Monazite Vein +ore.mix.molybdenum=Molybdenum Vein +ore.mix.tungstate=Tungstate Vein +ore.mix.sapphire=Sapphire Vein +ore.mix.manganese=Manganese Vein +ore.mix.quartz=Quartz Vein +ore.mix.diamond=Diamond Vein +ore.mix.olivine=Olivine Vein +ore.mix.apatite=Apatite Vein +ore.mix.galena=Galena Vein +ore.mix.lapis=Lapis Vein +ore.mix.beryllium=Beryllium Vein +ore.mix.oilsand=Oilsand Vein
\ No newline at end of file diff --git a/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang b/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang new file mode 100644 index 0000000000..59de961f69 --- /dev/null +++ b/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang @@ -0,0 +1,72 @@ +# gui names +gui.veinStat.name=矿脉信息 +gui.asteroidStat.name=小行星信息 +gui.smallOreStat.name=贫瘠矿石信息 + +gui.nei.veinName=矿脉名称 +gui.nei.primaryOre=上层矿石 +gui.nei.secondaryOre=下层矿石 +gui.nei.betweenOre=中层矿石 +gui.nei.sporadicOre=散乱分布 +gui.nei.genHeight=生成高度 +gui.nei.weightedChance=发现几率 +gui.nei.worldNames=生成世界 +gui.nei.restrictBiome=生物群系限制 + +gui.nei.asteroidPrimary=主要生成1 +gui.nei.asteroidSecondary=主要生成2 +gui.nei.asteroidBetween=次要生成1 +gui.nei.asteroidSporadic=次要生成2 + +gui.nei.oreName=矿石名称 +gui.nei.amount=每区块生成个数 +gui.nei.chanceDrops=几率掉落 + +gui.nei.seeAll=查看全部 + +# world names +world.overworld.name=主世界 +world.nether.name=下界 +world.end.name=末地 +world.moon.name=月球 +world.mars.name=火星 +world.asteroid.name=星系mod小行星带 + + +# biome names +biome.none.name=无 + + +# vein names +ore.mix.naquadah=硅岩矿脉 +ore.mix.lignite=褐煤矿脉 +ore.mix.coal=煤矿脉 +ore.mix.magnetite=磁铁矿脉 +ore.mix.gold=金矿脉 +ore.mix.iron=铁矿脉 +ore.mix.cassiterite=锡石矿脉 +ore.mix.tetrahedrite=黝铜矿脉 +ore.mix.netherquartz=下届石英矿脉 +ore.mix.sulfur=硫矿脉 +ore.mix.copper=铜矿脉 +ore.mix.bauxite=铝土矿脉 +ore.mix.salts=岩盐矿脉 +ore.mix.redstone=红石矿脉 +ore.mix.soapstone=皂石矿脉 +ore.mix.nickel=镍矿脉 +ore.mix.platinum=铂矿脉 +ore.mix.pitchblende=沥青铀矿脉 +ore.mix.uranium=铀矿脉 +ore.mix.monazite=独居石矿脉 +ore.mix.molybdenum=钼矿脉 +ore.mix.tungstate=钨酸盐矿脉 +ore.mix.sapphire=蓝宝石矿脉 +ore.mix.manganese=锰矿脉 +ore.mix.quartz=石英岩矿脉 +ore.mix.diamond=钻石矿脉 +ore.mix.olivine=橄榄石矿脉 +ore.mix.apatite=磷灰石矿脉 +ore.mix.galena=方铅矿矿脉 +ore.mix.lapis=青金石矿脉 +ore.mix.beryllium=铍矿脉 +ore.mix.oilsand=油砂矿脉
\ No newline at end of file diff --git a/src/main/resources/assets/gtneioreplugin/textures/gui/nei/guiBase.png b/src/main/resources/assets/gtneioreplugin/textures/gui/nei/guiBase.png Binary files differnew file mode 100644 index 0000000000..87449ffd99 --- /dev/null +++ b/src/main/resources/assets/gtneioreplugin/textures/gui/nei/guiBase.png diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info new file mode 100644 index 0000000000..53bf12b1d3 --- /dev/null +++ b/src/main/resources/mcmod.info @@ -0,0 +1,16 @@ +[ +{ + "modid": "gtneioreplugin", + "name": "GT NEI Ore Plugin", + "description": "A forge mod which adds NEI plugins for GregTech5's ores.", + "version": "v1.0.0", + "mcversion": "1.7.10", + "url": "", + "updateUrl": "", + "authorList": ["GWYOG"], + "credits": "", + "logoFile": "", + "screenshots": [], + "dependencies": [] +} +] |