From 25ca5d5b8cf8dc2adece8db5baccf6ec0640264e Mon Sep 17 00:00:00 2001 From: JJN Date: Fri, 4 Nov 2016 02:38:10 +0800 Subject: Initial commit --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..39bf9ee6dd --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 JJN + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. -- cgit From f01a9dda14179eda02171c5e48d9ff4f7fd0fd5f Mon Sep 17 00:00:00 2001 From: GWYOG Date: Fri, 4 Nov 2016 02:41:12 +0800 Subject: Pre-release 1.0.0 --- build.gradle | 56 +++++++ gradlew | 164 +++++++++++++++++++ gradlew.bat | 90 +++++++++++ .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 29 ++++ .../gtneioreplugin/event/ClientTickHandler.java | 19 +++ .../gtneioreplugin/plugin/NEIPluginConfig.java | 32 ++++ .../gtneioreplugin/plugin/PluginAsteroidStat.java | 134 ++++++++++++++++ .../gwyog/gtneioreplugin/plugin/PluginBase.java | 46 ++++++ .../gtneioreplugin/plugin/PluginSmallOreStat.java | 165 +++++++++++++++++++ .../gtneioreplugin/plugin/PluginVeinStat.java | 175 +++++++++++++++++++++ .../gtneioreplugin/util/GTOreLayerHelper.java | 98 ++++++++++++ .../gtneioreplugin/util/GTSmallOreHelper.java | 102 ++++++++++++ .../assets/gtneioreplugin/lang/en_US.lang | 73 +++++++++ .../assets/gtneioreplugin/lang/zh_CN.lang | 72 +++++++++ .../gtneioreplugin/textures/gui/nei/guiBase.png | Bin 0 -> 1846 bytes src/main/resources/mcmod.info | 16 ++ 16 files changed, 1271 insertions(+) create mode 100644 build.gradle create mode 100644 gradlew create mode 100644 gradlew.bat create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/event/ClientTickHandler.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/GTOreLayerHelper.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/GTSmallOreHelper.java create mode 100644 src/main/resources/assets/gtneioreplugin/lang/en_US.lang create mode 100644 src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang create mode 100644 src/main/resources/assets/gtneioreplugin/textures/gui/nei/guiBase.png create mode 100644 src/main/resources/mcmod.info 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 getIngredients() { + List ingredientsList = new ArrayList(); + 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 positionedDropStackList; + + public CachedSmallOreRecipe(String oreGenName, List stackList, List materialDustStackList, List dropStackList) { + this.oreGenName = oreGenName; + this.positionedStackSmallOre = new PositionedStack(stackList, 2, 0); + this.positionedStackMaterialDust = new PositionedStack(materialDustStackList, 43, 79); + List positionedDropStackList = new ArrayList(); + 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 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 stackList = new ArrayList(); + for (int i=0;i<7;i++) + stackList.add(new ItemStack(GregTech_API.sBlockOres1, 1, smallOreWorldGen.oreMeta+16000+i*1000)); + List materialDustStackList = new ArrayList(); + 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 stackList = new ArrayList(); + for (int i=0;i<7;i++) + stackList.add(new ItemStack(GregTech_API.sBlockOres1, 1, baseMeta+16000+i*1000)); + List materialDustStackList = new ArrayList(); + 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 stackListPrimary, List stackListSecondary, + List stackListBetween, List 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 getIngredients() { + List ingredientsList = new ArrayList(); + 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 stackListPrimary = new ArrayList(); + List stackListSecondary = new ArrayList(); + List stackListBetween = new ArrayList(); + List stackListSporadic = new ArrayList(); + 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 stackListPrimary = new ArrayList(); + List stackListSecondary = new ArrayList(); + List stackListBetween = new ArrayList(); + List stackListSporadic = new ArrayList(); + 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 mapOreLayerWrapper = new HashMap(); + public static List> listVein = new ArrayList>(); + public static List> listAsteroid = new ArrayList>(); + + 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 list = new ArrayList(); + 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 smallOreList = new ArrayList(); + public static HashMap mapSmallOreWrapper = new HashMap(); + public static HashMap mapOreDropUnlocalizedNameToOreMeta = new HashMap(); + public static HashMap> mapOreMetaToOreDrops = new HashMap>(); + + 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 stackList = new ArrayList(); + 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 new file mode 100644 index 0000000000..87449ffd99 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/gui/nei/guiBase.png differ 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": [] +} +] -- cgit From c4f1cf95562653835e0923eca7988da7fae85112 Mon Sep 17 00:00:00 2001 From: GWYOG Date: Fri, 4 Nov 2016 10:47:19 +0800 Subject: Add NEI in mod's @Mod dependencies --- src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index fdf92404f8..f527f5600c 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -11,7 +11,7 @@ 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") +@Mod(modid = GTNEIOrePlugin.MODID, name = GTNEIOrePlugin.NAME, version = GTNEIOrePlugin.VERSION, dependencies = "required-after:gregtech;required-after:NotEnoughItems") public class GTNEIOrePlugin { public static final String MODID = "gtneioreplugin"; public static final String NAME = "GT NEI Ore Plugin"; -- cgit From 6941633f426323c8c9f41b6846e9c8120c19cc86 Mon Sep 17 00:00:00 2001 From: GWYOG Date: Fri, 4 Nov 2016 10:52:10 +0800 Subject: Remove the dependencies in build.gradle and add comments --- build.gradle | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 635cfc9ef5..332d67e102 100644 --- a/build.gradle +++ b/build.gradle @@ -30,9 +30,11 @@ minecraft { } 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" + // You should put the dev builds of NEI (with its dependencies) and GregTech5 in the /libs folder manually + // to make the gradlew build working properly. + // 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 -- cgit From b4c82188a714fdef80d9c6627a749a9d0f456695 Mon Sep 17 00:00:00 2001 From: GWYOG Date: Fri, 4 Nov 2016 11:11:06 +0800 Subject: Fix NoSuchFieldError for mRestrictBiome when using old version of GT5 --- .../gtneioreplugin/plugin/PluginAsteroidStat.java | 1 + .../gtneioreplugin/plugin/PluginSmallOreStat.java | 12 ++++++++---- .../gwyog/gtneioreplugin/plugin/PluginVeinStat.java | 2 +- .../gwyog/gtneioreplugin/util/GTOreLayerHelper.java | 8 +++++++- .../gwyog/gtneioreplugin/util/GTSmallOreHelper.java | 20 +++++++++++++------- 5 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java index 1dc55c441f..f06e3ae1d9 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java @@ -14,6 +14,7 @@ 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; public class PluginAsteroidStat extends PluginBase { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java index ba8c39babb..b8432c7c93 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java @@ -33,11 +33,11 @@ public class PluginSmallOreStat extends PluginBase { public CachedSmallOreRecipe(String oreGenName, List stackList, List materialDustStackList, List dropStackList) { this.oreGenName = oreGenName; this.positionedStackSmallOre = new PositionedStack(stackList, 2, 0); - this.positionedStackMaterialDust = new PositionedStack(materialDustStackList, 43, 79); + this.positionedStackMaterialDust = new PositionedStack(materialDustStackList, 43, 79+getRestrictBiomeOffset()); List positionedDropStackList = new ArrayList(); int i = 1; for (ItemStack stackDrop: dropStackList) - positionedDropStackList.add(new PositionedStack(stackDrop, 43+20*(i%4), 79+16*((i++)/4))); + positionedDropStackList.add(new PositionedStack(stackDrop, 43+20*(i%4), 79+16*((i++)/4)+getRestrictBiomeOffset())); this.positionedDropStackList = positionedDropStackList; } @@ -66,8 +66,8 @@ public class PluginSmallOreStat extends PluginBase { 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); + if (GTSmallOreHelper.restrictBiomeSupport) GuiDraw.drawString(I18n.format("gui.nei.restrictBiome") + ": " + getBiomeTranslated(smallOre.restrictBiome), 2, 70, 0x404040, false); + GuiDraw.drawString(I18n.format("gui.nei.chanceDrops") + ": ", 2, 83+getRestrictBiomeOffset(), 0x404040, false); GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); } @@ -75,6 +75,10 @@ public class PluginSmallOreStat extends PluginBase { return unlocalizedBiome.equals("None")? I18n.format("biome.none.name"): unlocalizedBiome; } + public int getRestrictBiomeOffset() { + return GTSmallOreHelper.restrictBiomeSupport? 0: -13; + } + public String getWorldNameTranslated(boolean genOverworld, boolean genNether, boolean genEnd, boolean genMoon, boolean genMars) { String worldNameTranslated = ""; if (genOverworld) { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java index f281b3b29e..a2a78b0d35 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java @@ -124,7 +124,7 @@ public class PluginVeinStat extends PluginBase { 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); + if (GTOreLayerHelper.restrictBiomeSupport) 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); } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GTOreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GTOreLayerHelper.java index e6f9541e9f..40e5c21ea5 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GTOreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GTOreLayerHelper.java @@ -12,6 +12,7 @@ import net.minecraft.item.ItemStack; import sun.awt.windows.WWindowPeer; public class GTOreLayerHelper { + public static boolean restrictBiomeSupport = false; public static boolean endAsteroidSupport = false; public static boolean gcBasicSupport = false; public static boolean gcAsteroidSupport = false; @@ -31,6 +32,10 @@ public class GTOreLayerHelper { clazzGTOreLayer = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_Layer"); } catch (ClassNotFoundException e) {} if (clazzGTOreLayer != null) { + try { + Field fieldRestrictBiome = clazzGTOreLayer.getField("mRestrictBiome"); + restrictBiomeSupport = true; + } catch (Exception e) {} try { Field fieldEndAsteroid = clazzGTOreLayer.getField("mEndAsteroid"); endAsteroidSupport = true; @@ -72,10 +77,11 @@ public class GTOreLayerHelper { 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 (restrictBiomeSupport) + this.restrictBiome = worldGen.mRestrictBiome; if (GTOreLayerHelper.gcBasicSupport) { this.genMoon = worldGen.mMoon; this.genMars = worldGen.mMars; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GTSmallOreHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GTSmallOreHelper.java index 40889e8c11..0a4ac52f07 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GTSmallOreHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GTSmallOreHelper.java @@ -15,6 +15,7 @@ import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; public class GTSmallOreHelper { + public static boolean restrictBiomeSupport = false; public static boolean gcBasicSupport = false; public static List smallOreList = new ArrayList(); public static HashMap mapSmallOreWrapper = new HashMap(); @@ -55,14 +56,18 @@ public class GTSmallOreHelper { } private static void checkExtraSupport() { - Class clazzGTOreLayer = null; + Class clazzGTSmallOre = null; try { - clazzGTOreLayer = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_SmallPieces"); + clazzGTSmallOre = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_SmallPieces"); } catch (ClassNotFoundException e) {} - if (clazzGTOreLayer != null) { + if (clazzGTSmallOre != null) { try { - Field fieldGCMoon = clazzGTOreLayer.getField("mMoon"); - Field fieldGCMars = clazzGTOreLayer.getField("mMars"); + 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) {} } @@ -89,11 +94,12 @@ public class GTSmallOreHelper { 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) { + if (GTSmallOreHelper.restrictBiomeSupport) + this.restrictBiome = worldGen.mRestrictBiome; + if (GTSmallOreHelper.gcBasicSupport) { this.genMoon = worldGen.mMoon; this.genMars = worldGen.mMars; } -- cgit From 8aa362bc03265552f3455f5d3ed7b2c53ce7da54 Mon Sep 17 00:00:00 2001 From: GWYOG Date: Fri, 4 Nov 2016 11:42:11 +0800 Subject: Reset I18n keys to make I18n works properly --- .../gtneioreplugin/plugin/PluginAsteroidStat.java | 20 ++-- .../gwyog/gtneioreplugin/plugin/PluginBase.java | 34 ++++++ .../gtneioreplugin/plugin/PluginSmallOreStat.java | 50 ++------- .../gtneioreplugin/plugin/PluginVeinStat.java | 57 ++-------- .../assets/gtneioreplugin/lang/en_US.lang | 123 ++++++++++---------- .../assets/gtneioreplugin/lang/zh_CN.lang | 125 +++++++++++---------- 6 files changed, 193 insertions(+), 216 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java index f06e3ae1d9..027d4fa035 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java @@ -56,13 +56,13 @@ public class PluginAsteroidStat extends PluginBase { 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); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + I18n.format("gtnop." + oreLayer.veinName) + I18n.format("gtnop.ore.asteroid.name"), 2, 18, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidPrimary") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.primaryMeta)), 2, 31, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSecondary") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.secondaryMeta)), 2, 44, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidBetween") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.betweenMeta)), 2, 57, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSporadic") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.sporadicMeta)), 2, 70, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genEndAsteroid, oreLayer.genGCAsteroid), 2, 83, 0x404040, false); + GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); } public String getWorldNameTranslated(boolean genEndAsteroid, boolean genGCAsteroid) { @@ -70,12 +70,12 @@ public class PluginAsteroidStat extends PluginBase { if (genEndAsteroid) { if (!worldNameTranslatedAsteroid.isEmpty()) worldNameTranslatedAsteroid += ", "; - worldNameTranslatedAsteroid += I18n.format("world.end.name"); + worldNameTranslatedAsteroid += I18n.format("gtnop.world.end.name"); } if (genGCAsteroid) { if (!worldNameTranslatedAsteroid.isEmpty()) worldNameTranslatedAsteroid += ", "; - worldNameTranslatedAsteroid += I18n.format("world.asteroid.name"); + worldNameTranslatedAsteroid += I18n.format("gtnop.world.asteroid.name"); } return worldNameTranslatedAsteroid; } @@ -130,6 +130,6 @@ public class PluginAsteroidStat extends PluginBase { @Override public String getRecipeName() { - return I18n.format("gui.asteroidStat.name"); + return I18n.format("gtnop.gui.asteroidStat.name"); } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java index e225ea0944..789e4babf1 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java @@ -39,6 +39,40 @@ public class PluginBase extends TemplateRecipeHandler { return "gt.blockores." + index + ".name"; } + public String getBiomeTranslated(String unlocalizedBiome) { + return unlocalizedBiome.equals("None")? I18n.format("gtnop.biome.none.name"): unlocalizedBiome; + } + + public String getWorldNameTranslated(boolean genOverworld, boolean genNether, boolean genEnd, boolean genMoon, boolean genMars) { + String worldNameTranslated = ""; + if (genOverworld) { + if (!worldNameTranslated.isEmpty()) + worldNameTranslated += ", "; + worldNameTranslated += I18n.format("gtnop.world.overworld.name"); + } + if (genNether) { + if (!worldNameTranslated.isEmpty()) + worldNameTranslated += ", "; + worldNameTranslated += I18n.format("gtnop.world.nether.name"); + } + if (genEnd) { + if (!worldNameTranslated.isEmpty()) + worldNameTranslated += ", "; + worldNameTranslated += I18n.format("gtnop.world.end.name"); + } + if (genMoon) { + if (!worldNameTranslated.isEmpty()) + worldNameTranslated += ", "; + worldNameTranslated += I18n.format("gtnop.world.moon.name"); + } + if (genMars) { + if (!worldNameTranslated.isEmpty()) + worldNameTranslated += ", "; + worldNameTranslated += I18n.format("gtnop.world.mars.name"); + } + return worldNameTranslated; + } + public int getGuiWidth() { return 166; } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java index b8432c7c93..c0e784d3d3 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java @@ -62,53 +62,19 @@ public class PluginSmallOreStat extends PluginBase { 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); - if (GTSmallOreHelper.restrictBiomeSupport) GuiDraw.drawString(I18n.format("gui.nei.restrictBiome") + ": " + getBiomeTranslated(smallOre.restrictBiome), 2, 70, 0x404040, false); - GuiDraw.drawString(I18n.format("gui.nei.chanceDrops") + ": ", 2, 83+getRestrictBiomeOffset(), 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; + GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreName") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName((short)(smallOre.oreMeta+16000))), 2, 18, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + smallOre.worldGenHeightRange, 2, 31, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.amount") + ": " + smallOre.amountPerChunk, 2, 44, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(smallOre.genOverworld, smallOre.genNether, smallOre.genEnd, smallOre.genMoon, smallOre.genMars), 2, 57, 0x404040, false); + if (GTSmallOreHelper.restrictBiomeSupport) GuiDraw.drawString(I18n.format("gtnop.gui.nei.restrictBiome") + ": " + getBiomeTranslated(smallOre.restrictBiome), 2, 70, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.chanceDrops") + ": ", 2, 83+getRestrictBiomeOffset(), 0x404040, false); + GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); } public int getRestrictBiomeOffset() { return GTSmallOreHelper.restrictBiomeSupport? 0: -13; } - 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())) @@ -164,6 +130,6 @@ public class PluginSmallOreStat extends PluginBase { @Override public String getRecipeName() { - return I18n.format("gui.smallOreStat.name"); + return I18n.format("gtnop.gui.smallOreStat.name"); } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java index a2a78b0d35..285382303c 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java @@ -92,7 +92,6 @@ public class PluginVeinStat extends PluginBase { } 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 stackListPrimary = new ArrayList(); List stackListSecondary = new ArrayList(); @@ -116,50 +115,16 @@ public class PluginVeinStat extends PluginBase { 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); - if (GTOreLayerHelper.restrictBiomeSupport) 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; + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + I18n.format("gtnop." + oreLayer.veinName) + I18n.format("gtnop.ore.vein.name"), 2, 18, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.primaryOre") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.primaryMeta)), 2, 31, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.secondaryOre") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.secondaryMeta)), 2, 44, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.betweenMeta)), 2, 57, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.sporadicOre") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.sporadicMeta)), 2, 70, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreLayer.worldGenHeightRange, 2, 83, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + oreLayer.weightedChance, 2, 96, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genOverworld, oreLayer.genNether, oreLayer.genEnd, oreLayer.genMoon, oreLayer.genMars), 2, 109, 0x404040, false); + if (GTOreLayerHelper.restrictBiomeSupport) GuiDraw.drawString(I18n.format("gtnop.gui.nei.restrictBiome") + ": " + getBiomeTranslated(oreLayer.restrictBiome), 2, 122, 0x404040, false); + GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); } @Override @@ -169,7 +134,7 @@ public class PluginVeinStat extends PluginBase { @Override public String getRecipeName() { - return I18n.format("gui.veinStat.name"); + return I18n.format("gtnop.gui.veinStat.name"); } } diff --git a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang index 925a8d2fad..177bc65345 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang @@ -1,73 +1,78 @@ # gui names -gui.veinStat.name=Vein Stats -gui.asteroidStat.name=Asteroid Stats -gui.smallOreStat.name=Small Ore Stats +gtnop.gui.veinStat.name=Vein Stats +gtnop.gui.asteroidStat.name=Asteroid Stats +gtnop.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 +gtnop.gui.nei.veinName=Vein name +gtnop.gui.nei.primaryOre=Primary-Gen +gtnop.gui.nei.secondaryOre=Secondary-Gen +gtnop.gui.nei.betweenOre=Between-Gen +gtnop.gui.nei.sporadicOre=Sporadic-Gen +gtnop.gui.nei.genHeight=Height +gtnop.gui.nei.weightedChance=Chance +gtnop.gui.nei.worldNames=Generated world +gtnop.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 +gtnop.gui.nei.asteroidPrimary=Main-Gen1 +gtnop.gui.nei.asteroidSecondary=Main-Gen2 +gtnop.gui.nei.asteroidBetween=Minor-Gen1 +gtnop.gui.nei.asteroidSporadic=Minor-Gen2 -gui.nei.oreName=Ore name -gui.nei.amount=Amount per chunk -gui.nei.chanceDrops=Drops +gtnop.gui.nei.oreName=Ore name +gtnop.gui.nei.amount=Amount per chunk +gtnop.gui.nei.chanceDrops=Drops -gui.nei.seeAll=See All +gtnop.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 +gtnop.world.overworld.name=Overworld +gtnop.world.nether.name=Nether +gtnop.world.end.name=End +gtnop.world.moon.name=Moon +gtnop.world.mars.name=Mars +gtnop.world.asteroid.name=GalactiCraft Asteroid # biome names -biome.none.name=None +gtnop.biome.none.name=None +# vein types +gtnop.ore.vein.name= Vein +gtnop.ore.asteroid.name= Asteriod # 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 +gtnop.ore.mix.naquadah=Naquadah +gtnop.ore.mix.lignite=Lignite +gtnop.ore.mix.coal=Coal +gtnop.ore.mix.magnetite=Magnetite +gtnop.ore.mix.gold=Gold +gtnop.ore.mix.iron=Iron +gtnop.ore.mix.cassiterite=Cassiterite +gtnop.ore.mix.tetrahedrite=Tetrahedrite +gtnop.ore.mix.netherquartz=Nether Quartz +gtnop.ore.mix.sulfur=Sulfur +gtnop.ore.mix.copper=Copper +gtnop.ore.mix.bauxite=Bauxite +gtnop.ore.mix.salts=Salts +gtnop.ore.mix.redstone=Redstone +gtnop.ore.mix.soapstone=Soapstone +gtnop.ore.mix.nickel=Nickel +gtnop.ore.mix.platinum=Platinum +gtnop.ore.mix.pitchblende=Pitchblends +gtnop.ore.mix.uranium=Uranium +gtnop.ore.mix.monazite=Monazite +gtnop.ore.mix.molybdenum=Molybdenum +gtnop.ore.mix.tungstate=Tungstate +gtnop.ore.mix.sapphire=Sapphire +gtnop.ore.mix.manganese=Manganese +gtnop.ore.mix.quartz=Quartz +gtnop.ore.mix.diamond=Diamond +gtnop.ore.mix.olivine=Olivine +gtnop.ore.mix.apatite=Apatite +gtnop.ore.mix.galena=Galena +gtnop.ore.mix.lapis=Lapis +gtnop.ore.mix.beryllium=Beryllium +gtnop.ore.mix.oilsand=Oilsand + +gtnop.ore.mix.plutonium=Plutonium \ 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 index 59de961f69..203a30f259 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang @@ -1,72 +1,79 @@ # gui names -gui.veinStat.name=矿脉信息 -gui.asteroidStat.name=小行星信息 -gui.smallOreStat.name=贫瘠矿石信息 +gtnop.gui.veinStat.name=矿脉信息 +gtnop.gui.asteroidStat.name=小行星信息 +gtnop.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=生物群系限制 +gtnop.gui.nei.veinName=矿脉名称 +gtnop.gui.nei.primaryOre=上层矿石 +gtnop.gui.nei.secondaryOre=下层矿石 +gtnop.gui.nei.betweenOre=中层矿石 +gtnop.gui.nei.sporadicOre=散乱分布 +gtnop.gui.nei.genHeight=生成高度 +gtnop.gui.nei.weightedChance=发现几率 +gtnop.gui.nei.worldNames=生成世界 +gtnop.gui.nei.restrictBiome=生物群系限制 -gui.nei.asteroidPrimary=主要生成1 -gui.nei.asteroidSecondary=主要生成2 -gui.nei.asteroidBetween=次要生成1 -gui.nei.asteroidSporadic=次要生成2 +gtnop.gui.nei.asteroidPrimary=主要生成一 +gtnop.gui.nei.asteroidSecondary=主要生成二 +gtnop.gui.nei.asteroidBetween=次要生成一 +gtnop.gui.nei.asteroidSporadic=次要生成二 -gui.nei.oreName=矿石名称 -gui.nei.amount=每区块生成个数 -gui.nei.chanceDrops=几率掉落 +gtnop.gui.nei.oreName=矿石名称 +gtnop.gui.nei.amount=每区块生成个数 +gtnop.gui.nei.chanceDrops=几率掉落 -gui.nei.seeAll=查看全部 +gtnop.gui.nei.seeAll=查看全部 # world names -world.overworld.name=主世界 -world.nether.name=下界 -world.end.name=末地 -world.moon.name=月球 -world.mars.name=火星 -world.asteroid.name=星系mod小行星带 +gtnop.world.overworld.name=主世界 +gtnop.world.nether.name=下界 +gtnop.world.end.name=末地 +gtnop.world.moon.name=月球 +gtnop.world.mars.name=火星 +gtnop.world.asteroid.name=星系mod小行星带 # biome names -biome.none.name=无 +gtnop.biome.none.name=无 + + +# vein types +gtnop.ore.vein.name=矿脉 +gtnop.ore.asteroid.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 +gtnop.ore.mix.naquadah=硅岩 +gtnop.ore.mix.lignite=褐煤 +gtnop.ore.mix.coal=煤 +gtnop.ore.mix.magnetite=磁铁 +gtnop.ore.mix.gold=金 +gtnop.ore.mix.iron=铁 +gtnop.ore.mix.cassiterite=锡石 +gtnop.ore.mix.tetrahedrite=黝铜 +gtnop.ore.mix.netherquartz=下届石英 +gtnop.ore.mix.sulfur=硫 +gtnop.ore.mix.copper=铜 +gtnop.ore.mix.bauxite=铝土 +gtnop.ore.mix.salts=岩盐 +gtnop.ore.mix.redstone=红石 +gtnop.ore.mix.soapstone=皂石 +gtnop.ore.mix.nickel=镍 +gtnop.ore.mix.platinum=铂 +gtnop.ore.mix.pitchblende=沥青铀 +gtnop.ore.mix.uranium=铀 +gtnop.ore.mix.monazite=独居石 +gtnop.ore.mix.molybdenum=钼 +gtnop.ore.mix.tungstate=钨酸盐 +gtnop.ore.mix.sapphire=蓝宝石 +gtnop.ore.mix.manganese=锰 +gtnop.ore.mix.quartz=石英岩 +gtnop.ore.mix.diamond=钻石 +gtnop.ore.mix.olivine=橄榄石 +gtnop.ore.mix.apatite=磷灰石 +gtnop.ore.mix.galena=方铅矿 +gtnop.ore.mix.lapis=青金石 +gtnop.ore.mix.beryllium=铍 +gtnop.ore.mix.oilsand=油砂 + +gtnop.ore.mix.plutonium=钚 \ No newline at end of file -- cgit From afdf6a14f26cc451f36e5eea205188bdde72549c Mon Sep 17 00:00:00 2001 From: GWYOG Date: Fri, 4 Nov 2016 12:22:24 +0800 Subject: Remove the itemstack icons from unaccessible items on the gui --- .../java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java | 15 +++++++++++++++ .../gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java | 7 ++++--- .../pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java | 10 +++++----- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java index 789e4babf1..0fbe12a597 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java @@ -5,6 +5,7 @@ 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,6 +36,20 @@ public class PluginBase extends TemplateRecipeHandler { 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"; } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java index c0e784d3d3..e68c9ac8ee 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java @@ -62,7 +62,7 @@ public class PluginSmallOreStat extends PluginBase { 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") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName((short)(smallOre.oreMeta+16000))), 2, 18, 0x404040, false); + 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); @@ -95,10 +95,11 @@ public class PluginSmallOreStat extends PluginBase { for (SmallOreWrapper smallOreWorldGen: GTSmallOreHelper.mapSmallOreWrapper.values()) { if (smallOreWorldGen.oreMeta == baseMeta) { List stackList = new ArrayList(); - for (int i=0;i<7;i++) + int maximumIndex = getMaximumMaterialIndex(baseMeta, true); + for (int i=0;i materialDustStackList = new ArrayList(); - for (int i=0;i<7;i++) + for (int i=0;i stackListSecondary = new ArrayList(); List stackListBetween = new ArrayList(); List stackListSporadic = new ArrayList(); - for (int i=0;i<7;i++) { + for (int i=0;i Date: Fri, 4 Nov 2016 17:10:08 +0800 Subject: Update mod version to 1.0.1 --- build.gradle | 2 +- src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 2 +- src/main/resources/mcmod.info | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 332d67e102..6e1dc96c39 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.0.0" +version = "1.7.10-1.0.1" group= "pers.gwyog.gtneioreplugin" archivesBaseName = "gtneioreplugin" diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index f527f5600c..63bfa018e4 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -15,7 +15,7 @@ import pers.gwyog.gtneioreplugin.event.ClientTickHandler; 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"; + public static final String VERSION = "1.0.1"; @Mod.Instance(MODID) public static GTNEIOrePlugin instance; diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 53bf12b1d3..1ade29cae4 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "gtneioreplugin", "name": "GT NEI Ore Plugin", "description": "A forge mod which adds NEI plugins for GregTech5's ores.", - "version": "v1.0.0", + "version": "v1.0.1", "mcversion": "1.7.10", "url": "", "updateUrl": "", -- cgit From 980f64738347a74416187001c53b5544960949a3 Mon Sep 17 00:00:00 2001 From: GWYOG Date: Sun, 6 Nov 2016 12:26:23 +0800 Subject: Use FMLLoadCompleteEvent instead of ClientTickEvent Thanks for @3TUSK --- .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 14 +++++++++----- .../gwyog/gtneioreplugin/event/ClientTickHandler.java | 19 ------------------- 2 files changed, 9 insertions(+), 24 deletions(-) delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/event/ClientTickHandler.java diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index 63bfa018e4..09e2a99e7c 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -4,12 +4,14 @@ 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.event.ClientTickHandler; +import pers.gwyog.gtneioreplugin.util.GTOreLayerHelper; +import pers.gwyog.gtneioreplugin.util.GTSmallOreHelper; @Mod(modid = GTNEIOrePlugin.MODID, name = GTNEIOrePlugin.NAME, version = GTNEIOrePlugin.VERSION, dependencies = "required-after:gregtech;required-after:NotEnoughItems") public class GTNEIOrePlugin { @@ -21,9 +23,11 @@ public class GTNEIOrePlugin { public static GTNEIOrePlugin instance; @EventHandler - public void init(FMLInitializationEvent event) { - if (event.getSide() == Side.CLIENT) - FMLCommonHandler.instance().bus().register(new ClientTickHandler()); - } + public void onLoadComplete(FMLLoadCompleteEvent event) { + if (event.getSide() == Side.CLIENT) { + new GTOreLayerHelper(); + new GTSmallOreHelper(); + } + } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/event/ClientTickHandler.java b/src/main/java/pers/gwyog/gtneioreplugin/event/ClientTickHandler.java deleted file mode 100644 index cb83a4974d..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/event/ClientTickHandler.java +++ /dev/null @@ -1,19 +0,0 @@ -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; - } - } -} -- cgit From 10f86d028093566285f9500da84961c86c8552a1 Mon Sep 17 00:00:00 2001 From: GWYOG Date: Sun, 6 Nov 2016 14:34:17 +0800 Subject: Change code formatter - change tab to 4 spaces --- .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 20 +- .../gtneioreplugin/plugin/NEIPluginConfig.java | 28 +-- .../gtneioreplugin/plugin/PluginAsteroidStat.java | 226 ++++++++++---------- .../gwyog/gtneioreplugin/plugin/PluginBase.java | 134 ++++++------ .../gtneioreplugin/plugin/PluginSmallOreStat.java | 214 +++++++++---------- .../gtneioreplugin/plugin/PluginVeinStat.java | 228 ++++++++++----------- .../gtneioreplugin/util/GTOreLayerHelper.java | 176 ++++++++-------- .../gtneioreplugin/util/GTSmallOreHelper.java | 174 ++++++++-------- 8 files changed, 600 insertions(+), 600 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index 09e2a99e7c..37ba99addf 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -15,19 +15,19 @@ import pers.gwyog.gtneioreplugin.util.GTSmallOreHelper; @Mod(modid = GTNEIOrePlugin.MODID, name = GTNEIOrePlugin.NAME, version = GTNEIOrePlugin.VERSION, dependencies = "required-after:gregtech;required-after:NotEnoughItems") public class GTNEIOrePlugin { - public static final String MODID = "gtneioreplugin"; - public static final String NAME = "GT NEI Ore Plugin"; - public static final String VERSION = "1.0.1"; - + public static final String MODID = "gtneioreplugin"; + public static final String NAME = "GT NEI Ore Plugin"; + public static final String VERSION = "1.0.1"; + @Mod.Instance(MODID) public static GTNEIOrePlugin instance; @EventHandler - public void onLoadComplete(FMLLoadCompleteEvent event) { - if (event.getSide() == Side.CLIENT) { - new GTOreLayerHelper(); - new GTSmallOreHelper(); - } - } + public void onLoadComplete(FMLLoadCompleteEvent event) { + if (event.getSide() == Side.CLIENT) { + new GTOreLayerHelper(); + new GTSmallOreHelper(); + } + } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java index a4813c746b..0f1b0210b5 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java @@ -6,27 +6,27 @@ import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; public class NEIPluginConfig implements IConfigureNEI { - @Override - public String getName() { - return "GregTech Ore Plugin"; - } + @Override + public String getName() { + return "GregTech Ore Plugin"; + } - @Override - public String getVersion() { - return GTNEIOrePlugin.VERSION; - } + @Override + public String getVersion() { + return GTNEIOrePlugin.VERSION; + } - @Override - public void loadConfig() { - PluginVeinStat pluginVeinStat = new PluginVeinStat(); - PluginAsteroidStat pluginAsteriodStat = new PluginAsteroidStat(); - PluginSmallOreStat pluginSmallOreStat = new PluginSmallOreStat(); + @Override + public void loadConfig() { + PluginVeinStat pluginVeinStat = new PluginVeinStat(); + PluginAsteroidStat pluginAsteriodStat = new PluginAsteroidStat(); + PluginSmallOreStat pluginSmallOreStat = new PluginSmallOreStat(); API.registerRecipeHandler(pluginVeinStat); API.registerUsageHandler(pluginVeinStat); API.registerRecipeHandler(pluginAsteriodStat); API.registerUsageHandler(pluginAsteriodStat); API.registerRecipeHandler(pluginSmallOreStat); API.registerUsageHandler(pluginSmallOreStat); - } + } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java index 027d4fa035..acc00c01ef 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java @@ -19,117 +19,117 @@ import pers.gwyog.gtneioreplugin.util.GTOreLayerHelper.OreLayerWrapper; public class PluginAsteroidStat extends PluginBase { - public class CachedAsteroidStatRecipe extends CachedRecipe { - public String veinName; - public PositionedStack positionedStackPrimary; - public PositionedStack positionedStackSecondary; - public PositionedStack positionedStackBetween; - public PositionedStack positionedStackSporadic; - - public CachedAsteroidStatRecipe(String veinName, ItemStack stackListPrimary, ItemStack stackListSecondary, - ItemStack stackListBetween, ItemStack stackListSporadic) { - this.veinName = veinName; - positionedStackPrimary = new PositionedStack(stackListPrimary, 2, 0); - positionedStackSecondary = new PositionedStack(stackListSecondary, 22, 0); - positionedStackBetween = new PositionedStack(stackListBetween, 42, 0); - positionedStackSporadic = new PositionedStack(stackListSporadic, 62, 0); - } - - @Override - public List getIngredients() { - List ingredientsList = new ArrayList(); - ingredientsList.add(positionedStackPrimary); - ingredientsList.add(positionedStackSecondary); - ingredientsList.add(positionedStackBetween); - ingredientsList.add(positionedStackSporadic); - return ingredientsList; - } - - @Override - public PositionedStack getResult() { - return null; - } - - } - - @Override - public void drawExtras(int recipe) { - CachedAsteroidStatRecipe crecipe = (CachedAsteroidStatRecipe) this.arecipes.get(recipe); - OreLayerWrapper oreLayer = GTOreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + I18n.format("gtnop." + oreLayer.veinName) + I18n.format("gtnop.ore.asteroid.name"), 2, 18, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidPrimary") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.primaryMeta)), 2, 31, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSecondary") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.secondaryMeta)), 2, 44, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidBetween") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.betweenMeta)), 2, 57, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSporadic") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.sporadicMeta)), 2, 70, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genEndAsteroid, oreLayer.genGCAsteroid), 2, 83, 0x404040, false); - GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); - } - - public String getWorldNameTranslated(boolean genEndAsteroid, boolean genGCAsteroid) { - String worldNameTranslatedAsteroid = ""; - if (genEndAsteroid) { - if (!worldNameTranslatedAsteroid.isEmpty()) - worldNameTranslatedAsteroid += ", "; - worldNameTranslatedAsteroid += I18n.format("gtnop.world.end.name"); - } - if (genGCAsteroid) { - if (!worldNameTranslatedAsteroid.isEmpty()) - worldNameTranslatedAsteroid += ", "; - worldNameTranslatedAsteroid += I18n.format("gtnop.world.asteroid.name"); - } - return worldNameTranslatedAsteroid; - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals(getOutputId())) { - OreLayerWrapper oreLayerWrapper; - for (String veinName: GTOreLayerHelper.mapOreLayerWrapper.keySet()) { - oreLayerWrapper = GTOreLayerHelper.mapOreLayerWrapper.get(veinName); - if (oreLayerWrapper.genEndAsteroid || oreLayerWrapper.genGCAsteroid) { - ItemStack stackPrimary = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.primaryMeta+2000); - ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.secondaryMeta+2000); - ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.betweenMeta+2000); - ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.sporadicMeta+2000); - this.arecipes.add(new CachedAsteroidStatRecipe(veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); - } - } - } - else - super.loadCraftingRecipes(outputId, results); - } - - @Override - public void loadCraftingRecipes(ItemStack stack) { - if (stack.getUnlocalizedName().startsWith("gt.blockores")) { - if (stack.getItemDamage()>16000) { - super.loadCraftingRecipes(stack); - return; - } - short baseMeta = (short)(stack.getItemDamage() % 1000); - for (OreLayerWrapper worldGen: GTOreLayerHelper.mapOreLayerWrapper.values()) { - if (worldGen.primaryMeta == baseMeta || worldGen.secondaryMeta == baseMeta || worldGen.betweenMeta == baseMeta || worldGen.sporadicMeta == baseMeta) { - if (worldGen.genEndAsteroid || worldGen.genGCAsteroid) { - ItemStack stackPrimary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.primaryMeta+2000); - ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.secondaryMeta+2000); - ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.betweenMeta+2000); - ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.sporadicMeta+2000); - this.arecipes.add(new CachedAsteroidStatRecipe(worldGen.veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); - } - } - } - } - else - super.loadCraftingRecipes(stack); - } - - @Override - public String getOutputId() { - return "GTOrePluginAsteroid"; - } - - @Override - public String getRecipeName() { - return I18n.format("gtnop.gui.asteroidStat.name"); - } + public class CachedAsteroidStatRecipe extends CachedRecipe { + public String veinName; + public PositionedStack positionedStackPrimary; + public PositionedStack positionedStackSecondary; + public PositionedStack positionedStackBetween; + public PositionedStack positionedStackSporadic; + + public CachedAsteroidStatRecipe(String veinName, ItemStack stackListPrimary, ItemStack stackListSecondary, + ItemStack stackListBetween, ItemStack stackListSporadic) { + this.veinName = veinName; + positionedStackPrimary = new PositionedStack(stackListPrimary, 2, 0); + positionedStackSecondary = new PositionedStack(stackListSecondary, 22, 0); + positionedStackBetween = new PositionedStack(stackListBetween, 42, 0); + positionedStackSporadic = new PositionedStack(stackListSporadic, 62, 0); + } + + @Override + public List getIngredients() { + List ingredientsList = new ArrayList(); + ingredientsList.add(positionedStackPrimary); + ingredientsList.add(positionedStackSecondary); + ingredientsList.add(positionedStackBetween); + ingredientsList.add(positionedStackSporadic); + return ingredientsList; + } + + @Override + public PositionedStack getResult() { + return null; + } + + } + + @Override + public void drawExtras(int recipe) { + CachedAsteroidStatRecipe crecipe = (CachedAsteroidStatRecipe) this.arecipes.get(recipe); + OreLayerWrapper oreLayer = GTOreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + I18n.format("gtnop." + oreLayer.veinName) + I18n.format("gtnop.ore.asteroid.name"), 2, 18, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidPrimary") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.primaryMeta)), 2, 31, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSecondary") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.secondaryMeta)), 2, 44, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidBetween") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.betweenMeta)), 2, 57, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSporadic") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.sporadicMeta)), 2, 70, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genEndAsteroid, oreLayer.genGCAsteroid), 2, 83, 0x404040, false); + GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); + } + + public String getWorldNameTranslated(boolean genEndAsteroid, boolean genGCAsteroid) { + String worldNameTranslatedAsteroid = ""; + if (genEndAsteroid) { + if (!worldNameTranslatedAsteroid.isEmpty()) + worldNameTranslatedAsteroid += ", "; + worldNameTranslatedAsteroid += I18n.format("gtnop.world.end.name"); + } + if (genGCAsteroid) { + if (!worldNameTranslatedAsteroid.isEmpty()) + worldNameTranslatedAsteroid += ", "; + worldNameTranslatedAsteroid += I18n.format("gtnop.world.asteroid.name"); + } + return worldNameTranslatedAsteroid; + } + + @Override + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals(getOutputId())) { + OreLayerWrapper oreLayerWrapper; + for (String veinName: GTOreLayerHelper.mapOreLayerWrapper.keySet()) { + oreLayerWrapper = GTOreLayerHelper.mapOreLayerWrapper.get(veinName); + if (oreLayerWrapper.genEndAsteroid || oreLayerWrapper.genGCAsteroid) { + ItemStack stackPrimary = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.primaryMeta+2000); + ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.secondaryMeta+2000); + ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.betweenMeta+2000); + ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.sporadicMeta+2000); + this.arecipes.add(new CachedAsteroidStatRecipe(veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); + } + } + } + else + super.loadCraftingRecipes(outputId, results); + } + + @Override + public void loadCraftingRecipes(ItemStack stack) { + if (stack.getUnlocalizedName().startsWith("gt.blockores")) { + if (stack.getItemDamage()>16000) { + super.loadCraftingRecipes(stack); + return; + } + short baseMeta = (short)(stack.getItemDamage() % 1000); + for (OreLayerWrapper worldGen: GTOreLayerHelper.mapOreLayerWrapper.values()) { + if (worldGen.primaryMeta == baseMeta || worldGen.secondaryMeta == baseMeta || worldGen.betweenMeta == baseMeta || worldGen.sporadicMeta == baseMeta) { + if (worldGen.genEndAsteroid || worldGen.genGCAsteroid) { + ItemStack stackPrimary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.primaryMeta+2000); + ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.secondaryMeta+2000); + ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.betweenMeta+2000); + ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.sporadicMeta+2000); + this.arecipes.add(new CachedAsteroidStatRecipe(worldGen.veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); + } + } + } + } + else + super.loadCraftingRecipes(stack); + } + + @Override + public String getOutputId() { + return "GTOrePluginAsteroid"; + } + + @Override + public String getRecipeName() { + return I18n.format("gtnop.gui.asteroidStat.name"); + } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java index 0fbe12a597..33102a8248 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java @@ -11,85 +11,85 @@ import net.minecraft.util.EnumChatFormatting; public class PluginBase extends TemplateRecipeHandler { - @Override - public int recipiesPerPage() { - return 1; - } - - @Override - public String getRecipeName() { - return null; - } + @Override + public int recipiesPerPage() { + return 1; + } + + @Override + public String getRecipeName() { + return null; + } - @Override - public String getGuiTexture() { - return "gtneioreplugin:textures/gui/nei/guiBase.png"; - } - + @Override + public String getGuiTexture() { + return "gtneioreplugin:textures/gui/nei/guiBase.png"; + } + @Override public void loadTransferRects() { - int stringLength = GuiDraw.getStringWidth(EnumChatFormatting.BOLD + I18n.format("gui.nei.seeAll")); - transferRects.add(new RecipeTransferRect(new Rectangle(getGuiWidth()-stringLength-3, 5, stringLength, 9), getOutputId())); + int stringLength = GuiDraw.getStringWidth(EnumChatFormatting.BOLD + I18n.format("gui.nei.seeAll")); + transferRects.add(new RecipeTransferRect(new Rectangle(getGuiWidth()-stringLength-3, 5, stringLength, 9), getOutputId())); } - + public String getOutputId() { - return null; + return null; } public int getMaximumMaterialIndex(short meta, boolean smallOre) { - int offset = smallOre? 16000: 0; - if (!getGTOreLocalizedName((short)(meta+offset+5000)).equals(getGTOreUnlocalizedName((short)(meta+offset+5000)))) - return 7; - else if (!getGTOreLocalizedName((short)(meta+offset+5000)).equals(getGTOreUnlocalizedName((short)(meta+offset+5000)))) - return 6; - else - return 5; + int offset = smallOre? 16000: 0; + if (!getGTOreLocalizedName((short)(meta+offset+5000)).equals(getGTOreUnlocalizedName((short)(meta+offset+5000)))) + return 7; + else if (!getGTOreLocalizedName((short)(meta+offset+5000)).equals(getGTOreUnlocalizedName((short)(meta+offset+5000)))) + return 6; + else + return 5; } public String getGTOreLocalizedName(short index) { - return GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)); + return GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)); + } + + public String getGTOreUnlocalizedName(short index) { + return "gt.blockores." + index + ".name"; + } + + public String getBiomeTranslated(String unlocalizedBiome) { + return unlocalizedBiome.equals("None")? I18n.format("gtnop.biome.none.name"): unlocalizedBiome; + } + + public String getWorldNameTranslated(boolean genOverworld, boolean genNether, boolean genEnd, boolean genMoon, boolean genMars) { + String worldNameTranslated = ""; + if (genOverworld) { + if (!worldNameTranslated.isEmpty()) + worldNameTranslated += ", "; + worldNameTranslated += I18n.format("gtnop.world.overworld.name"); + } + if (genNether) { + if (!worldNameTranslated.isEmpty()) + worldNameTranslated += ", "; + worldNameTranslated += I18n.format("gtnop.world.nether.name"); + } + if (genEnd) { + if (!worldNameTranslated.isEmpty()) + worldNameTranslated += ", "; + worldNameTranslated += I18n.format("gtnop.world.end.name"); + } + if (genMoon) { + if (!worldNameTranslated.isEmpty()) + worldNameTranslated += ", "; + worldNameTranslated += I18n.format("gtnop.world.moon.name"); + } + if (genMars) { + if (!worldNameTranslated.isEmpty()) + worldNameTranslated += ", "; + worldNameTranslated += I18n.format("gtnop.world.mars.name"); + } + return worldNameTranslated; } - public String getGTOreUnlocalizedName(short index) { - return "gt.blockores." + index + ".name"; - } - - public String getBiomeTranslated(String unlocalizedBiome) { - return unlocalizedBiome.equals("None")? I18n.format("gtnop.biome.none.name"): unlocalizedBiome; - } - - public String getWorldNameTranslated(boolean genOverworld, boolean genNether, boolean genEnd, boolean genMoon, boolean genMars) { - String worldNameTranslated = ""; - if (genOverworld) { - if (!worldNameTranslated.isEmpty()) - worldNameTranslated += ", "; - worldNameTranslated += I18n.format("gtnop.world.overworld.name"); - } - if (genNether) { - if (!worldNameTranslated.isEmpty()) - worldNameTranslated += ", "; - worldNameTranslated += I18n.format("gtnop.world.nether.name"); - } - if (genEnd) { - if (!worldNameTranslated.isEmpty()) - worldNameTranslated += ", "; - worldNameTranslated += I18n.format("gtnop.world.end.name"); - } - if (genMoon) { - if (!worldNameTranslated.isEmpty()) - worldNameTranslated += ", "; - worldNameTranslated += I18n.format("gtnop.world.moon.name"); - } - if (genMars) { - if (!worldNameTranslated.isEmpty()) - worldNameTranslated += ", "; - worldNameTranslated += I18n.format("gtnop.world.mars.name"); - } - return worldNameTranslated; - } - - public int getGuiWidth() { - return 166; - } + public int getGuiWidth() { + return 166; + } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java index e68c9ac8ee..1aba8c8992 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java @@ -23,114 +23,114 @@ import pers.gwyog.gtneioreplugin.util.GTOreLayerHelper.OreLayerWrapper; import pers.gwyog.gtneioreplugin.util.GTSmallOreHelper.SmallOreWrapper; public class PluginSmallOreStat extends PluginBase { - - public class CachedSmallOreRecipe extends CachedRecipe { - public String oreGenName; - public PositionedStack positionedStackSmallOre; - public PositionedStack positionedStackMaterialDust; - public List positionedDropStackList; + + public class CachedSmallOreRecipe extends CachedRecipe { + public String oreGenName; + public PositionedStack positionedStackSmallOre; + public PositionedStack positionedStackMaterialDust; + public List positionedDropStackList; - public CachedSmallOreRecipe(String oreGenName, List stackList, List materialDustStackList, List dropStackList) { - this.oreGenName = oreGenName; - this.positionedStackSmallOre = new PositionedStack(stackList, 2, 0); - this.positionedStackMaterialDust = new PositionedStack(materialDustStackList, 43, 79+getRestrictBiomeOffset()); - List positionedDropStackList = new ArrayList(); - int i = 1; - for (ItemStack stackDrop: dropStackList) - positionedDropStackList.add(new PositionedStack(stackDrop, 43+20*(i%4), 79+16*((i++)/4)+getRestrictBiomeOffset())); - this.positionedDropStackList = positionedDropStackList; - } + public CachedSmallOreRecipe(String oreGenName, List stackList, List materialDustStackList, List dropStackList) { + this.oreGenName = oreGenName; + this.positionedStackSmallOre = new PositionedStack(stackList, 2, 0); + this.positionedStackMaterialDust = new PositionedStack(materialDustStackList, 43, 79+getRestrictBiomeOffset()); + List positionedDropStackList = new ArrayList(); + int i = 1; + for (ItemStack stackDrop: dropStackList) + positionedDropStackList.add(new PositionedStack(stackDrop, 43+20*(i%4), 79+16*((i++)/4)+getRestrictBiomeOffset())); + this.positionedDropStackList = positionedDropStackList; + } - @Override - public List getIngredients() { - positionedStackSmallOre.setPermutationToRender((cycleticks / 20) % positionedStackSmallOre.items.length); - positionedStackMaterialDust.setPermutationToRender((cycleticks / 20) % positionedStackMaterialDust.items.length); - positionedDropStackList.add(positionedStackSmallOre); - positionedDropStackList.add(positionedStackMaterialDust); - return positionedDropStackList; - - } - - @Override - public PositionedStack getResult() { - return null; - } - - } - - @Override - public void drawExtras(int recipe) { - CachedSmallOreRecipe crecipe = (CachedSmallOreRecipe) this.arecipes.get(recipe); - SmallOreWrapper smallOre = GTSmallOreHelper.mapSmallOreWrapper.get(crecipe.oreGenName); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreName") + ": " + getGTOreLocalizedName((short)(smallOre.oreMeta+16000)), 2, 18, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + smallOre.worldGenHeightRange, 2, 31, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.amount") + ": " + smallOre.amountPerChunk, 2, 44, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(smallOre.genOverworld, smallOre.genNether, smallOre.genEnd, smallOre.genMoon, smallOre.genMars), 2, 57, 0x404040, false); - if (GTSmallOreHelper.restrictBiomeSupport) GuiDraw.drawString(I18n.format("gtnop.gui.nei.restrictBiome") + ": " + getBiomeTranslated(smallOre.restrictBiome), 2, 70, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.chanceDrops") + ": ", 2, 83+getRestrictBiomeOffset(), 0x404040, false); - GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); - } - - public int getRestrictBiomeOffset() { - return GTSmallOreHelper.restrictBiomeSupport? 0: -13; - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals(getOutputId())) - for (ItemStack stack: GTSmallOreHelper.smallOreList) - loadCraftingRecipes(stack); - else - super.loadCraftingRecipes(outputId, results); - } - - @Override - public void loadCraftingRecipes(ItemStack stack) { - if (stack.getUnlocalizedName().startsWith("gt.blockores")) { - if (stack.getItemDamage()<16000) { - super.loadCraftingRecipes(stack); - return; - } - short baseMeta = (short)(stack.getItemDamage() % 1000); - for (SmallOreWrapper smallOreWorldGen: GTSmallOreHelper.mapSmallOreWrapper.values()) { - if (smallOreWorldGen.oreMeta == baseMeta) { - List stackList = new ArrayList(); - int maximumIndex = getMaximumMaterialIndex(baseMeta, true); - for (int i=0;i materialDustStackList = new ArrayList(); - for (int i=0;i stackList = new ArrayList(); - for (int i=0;i<7;i++) - stackList.add(new ItemStack(GregTech_API.sBlockOres1, 1, baseMeta+16000+i*1000)); - List materialDustStackList = new ArrayList(); - for (int i=0;i<7;i++) - materialDustStackList.add(GT_OreDictUnificator.get(OrePrefixes.dust, GTSmallOreHelper.getDroppedDusts()[i], 1L)); - this.arecipes.add(new CachedSmallOreRecipe(GTSmallOreHelper.mapSmallOreWrapper.get(oreGenName).oreGenName, stackList, materialDustStackList, GTSmallOreHelper.mapOreMetaToOreDrops.get(baseMeta))); - } - } - } - else - super.loadCraftingRecipes(stack); - } - - @Override - public String getOutputId() { - return "GTOrePluginSmallOre"; - } + @Override + public List getIngredients() { + positionedStackSmallOre.setPermutationToRender((cycleticks / 20) % positionedStackSmallOre.items.length); + positionedStackMaterialDust.setPermutationToRender((cycleticks / 20) % positionedStackMaterialDust.items.length); + positionedDropStackList.add(positionedStackSmallOre); + positionedDropStackList.add(positionedStackMaterialDust); + return positionedDropStackList; + + } - @Override - public String getRecipeName() { - return I18n.format("gtnop.gui.smallOreStat.name"); - } + @Override + public PositionedStack getResult() { + return null; + } + + } + + @Override + public void drawExtras(int recipe) { + CachedSmallOreRecipe crecipe = (CachedSmallOreRecipe) this.arecipes.get(recipe); + SmallOreWrapper smallOre = GTSmallOreHelper.mapSmallOreWrapper.get(crecipe.oreGenName); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreName") + ": " + getGTOreLocalizedName((short)(smallOre.oreMeta+16000)), 2, 18, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + smallOre.worldGenHeightRange, 2, 31, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.amount") + ": " + smallOre.amountPerChunk, 2, 44, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(smallOre.genOverworld, smallOre.genNether, smallOre.genEnd, smallOre.genMoon, smallOre.genMars), 2, 57, 0x404040, false); + if (GTSmallOreHelper.restrictBiomeSupport) GuiDraw.drawString(I18n.format("gtnop.gui.nei.restrictBiome") + ": " + getBiomeTranslated(smallOre.restrictBiome), 2, 70, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.chanceDrops") + ": ", 2, 83+getRestrictBiomeOffset(), 0x404040, false); + GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); + } + + public int getRestrictBiomeOffset() { + return GTSmallOreHelper.restrictBiomeSupport? 0: -13; + } + + @Override + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals(getOutputId())) + for (ItemStack stack: GTSmallOreHelper.smallOreList) + loadCraftingRecipes(stack); + else + super.loadCraftingRecipes(outputId, results); + } + + @Override + public void loadCraftingRecipes(ItemStack stack) { + if (stack.getUnlocalizedName().startsWith("gt.blockores")) { + if (stack.getItemDamage()<16000) { + super.loadCraftingRecipes(stack); + return; + } + short baseMeta = (short)(stack.getItemDamage() % 1000); + for (SmallOreWrapper smallOreWorldGen: GTSmallOreHelper.mapSmallOreWrapper.values()) { + if (smallOreWorldGen.oreMeta == baseMeta) { + List stackList = new ArrayList(); + int maximumIndex = getMaximumMaterialIndex(baseMeta, true); + for (int i=0;i materialDustStackList = new ArrayList(); + for (int i=0;i stackList = new ArrayList(); + for (int i=0;i<7;i++) + stackList.add(new ItemStack(GregTech_API.sBlockOres1, 1, baseMeta+16000+i*1000)); + List materialDustStackList = new ArrayList(); + for (int i=0;i<7;i++) + materialDustStackList.add(GT_OreDictUnificator.get(OrePrefixes.dust, GTSmallOreHelper.getDroppedDusts()[i], 1L)); + this.arecipes.add(new CachedSmallOreRecipe(GTSmallOreHelper.mapSmallOreWrapper.get(oreGenName).oreGenName, stackList, materialDustStackList, GTSmallOreHelper.mapOreMetaToOreDrops.get(baseMeta))); + } + } + } + else + super.loadCraftingRecipes(stack); + } + + @Override + public String getOutputId() { + return "GTOrePluginSmallOre"; + } + + @Override + public String getRecipeName() { + return I18n.format("gtnop.gui.smallOreStat.name"); + } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java index 84ad4d4cb2..8182233c9b 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java @@ -23,118 +23,118 @@ import pers.gwyog.gtneioreplugin.util.GTOreLayerHelper.OreLayerWrapper; public class PluginVeinStat extends PluginBase { - public class CachedVeinStatRecipe extends CachedRecipe { - public String veinName; - public PositionedStack positionedStackPrimary; - public PositionedStack positionedStackSecondary; - public PositionedStack positionedStackBetween; - public PositionedStack positionedStackSporadic; - - public CachedVeinStatRecipe(String veinName, List stackListPrimary, List stackListSecondary, - List stackListBetween, List 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 getIngredients() { - List ingredientsList = new ArrayList(); - 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 stackListPrimary = new ArrayList(); - List stackListSecondary = new ArrayList(); - List stackListBetween = new ArrayList(); - List stackListSporadic = new ArrayList(); - for (int i=0;i<7;i++) { - stackListPrimary.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.primaryMeta+i*1000)); - stackListSecondary.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.secondaryMeta+i*1000)); - stackListBetween.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.betweenMeta+i*1000)); - stackListSporadic.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.sporadicMeta+i*1000)); - } - this.arecipes.add(new CachedVeinStatRecipe(veinName, stackListPrimary, stackListSecondary, stackListBetween, stackListSporadic)); - } - } - else - super.loadCraftingRecipes(outputId, results); - } - - @Override - public void loadCraftingRecipes(ItemStack stack) { - if (stack.getUnlocalizedName().startsWith("gt.blockores")) { - if (stack.getItemDamage()>16000) { - super.loadCraftingRecipes(stack); - return; - } - short baseMeta = (short)(stack.getItemDamage() % 1000); - for (OreLayerWrapper worldGen: GTOreLayerHelper.mapOreLayerWrapper.values()) { - if (worldGen.primaryMeta == baseMeta || worldGen.secondaryMeta == baseMeta || worldGen.betweenMeta == baseMeta || worldGen.sporadicMeta == baseMeta) { - List stackListPrimary = new ArrayList(); - List stackListSecondary = new ArrayList(); - List stackListBetween = new ArrayList(); - List stackListSporadic = new ArrayList(); - for (int i=0;i stackListPrimary, List stackListSecondary, + List stackListBetween, List 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 getIngredients() { + List ingredientsList = new ArrayList(); + 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 stackListPrimary = new ArrayList(); + List stackListSecondary = new ArrayList(); + List stackListBetween = new ArrayList(); + List stackListSporadic = new ArrayList(); + for (int i=0;i<7;i++) { + stackListPrimary.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.primaryMeta+i*1000)); + stackListSecondary.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.secondaryMeta+i*1000)); + stackListBetween.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.betweenMeta+i*1000)); + stackListSporadic.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.sporadicMeta+i*1000)); + } + this.arecipes.add(new CachedVeinStatRecipe(veinName, stackListPrimary, stackListSecondary, stackListBetween, stackListSporadic)); + } + } + else + super.loadCraftingRecipes(outputId, results); + } + + @Override + public void loadCraftingRecipes(ItemStack stack) { + if (stack.getUnlocalizedName().startsWith("gt.blockores")) { + if (stack.getItemDamage()>16000) { + super.loadCraftingRecipes(stack); + return; + } + short baseMeta = (short)(stack.getItemDamage() % 1000); + for (OreLayerWrapper worldGen: GTOreLayerHelper.mapOreLayerWrapper.values()) { + if (worldGen.primaryMeta == baseMeta || worldGen.secondaryMeta == baseMeta || worldGen.betweenMeta == baseMeta || worldGen.sporadicMeta == baseMeta) { + List stackListPrimary = new ArrayList(); + List stackListSecondary = new ArrayList(); + List stackListBetween = new ArrayList(); + List stackListSporadic = new ArrayList(); + for (int i=0;i mapOreLayerWrapper = new HashMap(); - public static List> listVein = new ArrayList>(); - public static List> listAsteroid = new ArrayList>(); + public static boolean restrictBiomeSupport = false; + public static boolean endAsteroidSupport = false; + public static boolean gcBasicSupport = false; + public static boolean gcAsteroidSupport = false; + public static HashMap mapOreLayerWrapper = new HashMap(); + public static List> listVein = new ArrayList>(); + public static List> listAsteroid = new ArrayList>(); - public GTOreLayerHelper() { - checkExtraSupport(); - for (GT_Worldgen_GT_Ore_Layer tWorldGen: GT_Worldgen_GT_Ore_Layer.sList) - mapOreLayerWrapper.put(tWorldGen.mWorldGenName, new OreLayerWrapper(tWorldGen)); - } - - private static void checkExtraSupport() { - Class clazzGTOreLayer = null; - try { - clazzGTOreLayer = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_Layer"); - } catch (ClassNotFoundException e) {} - if (clazzGTOreLayer != null) { - try { - Field fieldRestrictBiome = clazzGTOreLayer.getField("mRestrictBiome"); - restrictBiomeSupport = true; - } catch (Exception e) {} - try { - Field fieldEndAsteroid = clazzGTOreLayer.getField("mEndAsteroid"); - endAsteroidSupport = true; - } catch (Exception e) {} - try { - Field fieldGCMoon = clazzGTOreLayer.getField("mMoon"); - Field fieldGCMars = clazzGTOreLayer.getField("mMars"); - gcBasicSupport = true; - } catch (Exception e) {} - try { - Field fieldGCAsteroid = clazzGTOreLayer.getField("mAsteroid"); - gcAsteroidSupport = true; - } catch (Exception e) {} - } - } - - public class OreLayerWrapper { - public String veinName; - public short primaryMeta; - public short secondaryMeta; - public short betweenMeta; - public short sporadicMeta; - public String worldGenHeightRange; - public String weightedChance; - public String restrictBiome; - public boolean genOverworld = false; - public boolean genNether = false; - public boolean genEnd = false; - public boolean genMoon = false; - public boolean genMars = false; - public boolean genEndAsteroid = false; - public boolean genGCAsteroid = false; - - public OreLayerWrapper(GT_Worldgen_GT_Ore_Layer worldGen) { - this.veinName = worldGen.mWorldGenName; - this.primaryMeta = worldGen.mPrimaryMeta; - this.secondaryMeta = worldGen.mSecondaryMeta; - this.betweenMeta = worldGen.mBetweenMeta; - this.sporadicMeta = worldGen.mSporadicMeta; - this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; - this.weightedChance = String.format("%.2f%%", (100.0f*worldGen.mWeight)/GT_Worldgen_GT_Ore_Layer.sWeight); - this.genOverworld = worldGen.mOverworld; - this.genNether = worldGen.mNether; - this.genEnd = worldGen.mEnd; - if (restrictBiomeSupport) - this.restrictBiome = worldGen.mRestrictBiome; - if (GTOreLayerHelper.gcBasicSupport) { - this.genMoon = worldGen.mMoon; - this.genMars = worldGen.mMars; - } - if (GTOreLayerHelper.endAsteroidSupport) - this.genEndAsteroid = worldGen.mEndAsteroid; - if (GTOreLayerHelper.gcAsteroidSupport) - this.genGCAsteroid = worldGen.mAsteroid; - List list = new ArrayList(); - list.add(primaryMeta); - list.add(secondaryMeta); - list.add(betweenMeta); - list.add(sporadicMeta); - listVein.add(list); - if (genEndAsteroid || genGCAsteroid) - listAsteroid.add(list); - } - } - + public GTOreLayerHelper() { + checkExtraSupport(); + for (GT_Worldgen_GT_Ore_Layer tWorldGen: GT_Worldgen_GT_Ore_Layer.sList) + mapOreLayerWrapper.put(tWorldGen.mWorldGenName, new OreLayerWrapper(tWorldGen)); + } + + private static void checkExtraSupport() { + Class clazzGTOreLayer = null; + try { + clazzGTOreLayer = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_Layer"); + } catch (ClassNotFoundException e) {} + if (clazzGTOreLayer != null) { + try { + Field fieldRestrictBiome = clazzGTOreLayer.getField("mRestrictBiome"); + restrictBiomeSupport = true; + } catch (Exception e) {} + try { + Field fieldEndAsteroid = clazzGTOreLayer.getField("mEndAsteroid"); + endAsteroidSupport = true; + } catch (Exception e) {} + try { + Field fieldGCMoon = clazzGTOreLayer.getField("mMoon"); + Field fieldGCMars = clazzGTOreLayer.getField("mMars"); + gcBasicSupport = true; + } catch (Exception e) {} + try { + Field fieldGCAsteroid = clazzGTOreLayer.getField("mAsteroid"); + gcAsteroidSupport = true; + } catch (Exception e) {} + } + } + + public class OreLayerWrapper { + public String veinName; + public short primaryMeta; + public short secondaryMeta; + public short betweenMeta; + public short sporadicMeta; + public String worldGenHeightRange; + public String weightedChance; + public String restrictBiome; + public boolean genOverworld = false; + public boolean genNether = false; + public boolean genEnd = false; + public boolean genMoon = false; + public boolean genMars = false; + public boolean genEndAsteroid = false; + public boolean genGCAsteroid = false; + + public OreLayerWrapper(GT_Worldgen_GT_Ore_Layer worldGen) { + this.veinName = worldGen.mWorldGenName; + this.primaryMeta = worldGen.mPrimaryMeta; + this.secondaryMeta = worldGen.mSecondaryMeta; + this.betweenMeta = worldGen.mBetweenMeta; + this.sporadicMeta = worldGen.mSporadicMeta; + this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; + this.weightedChance = String.format("%.2f%%", (100.0f*worldGen.mWeight)/GT_Worldgen_GT_Ore_Layer.sWeight); + this.genOverworld = worldGen.mOverworld; + this.genNether = worldGen.mNether; + this.genEnd = worldGen.mEnd; + if (restrictBiomeSupport) + this.restrictBiome = worldGen.mRestrictBiome; + if (GTOreLayerHelper.gcBasicSupport) { + this.genMoon = worldGen.mMoon; + this.genMars = worldGen.mMars; + } + if (GTOreLayerHelper.endAsteroidSupport) + this.genEndAsteroid = worldGen.mEndAsteroid; + if (GTOreLayerHelper.gcAsteroidSupport) + this.genGCAsteroid = worldGen.mAsteroid; + List list = new ArrayList(); + list.add(primaryMeta); + list.add(secondaryMeta); + list.add(betweenMeta); + list.add(sporadicMeta); + listVein.add(list); + if (genEndAsteroid || genGCAsteroid) + listAsteroid.add(list); + } + } + } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GTSmallOreHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GTSmallOreHelper.java index 0a4ac52f07..5c8168e503 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GTSmallOreHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GTSmallOreHelper.java @@ -15,94 +15,94 @@ import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; public class GTSmallOreHelper { - public static boolean restrictBiomeSupport = false; - public static boolean gcBasicSupport = false; - public static List smallOreList = new ArrayList(); - public static HashMap mapSmallOreWrapper = new HashMap(); - public static HashMap mapOreDropUnlocalizedNameToOreMeta = new HashMap(); - public static HashMap> mapOreMetaToOreDrops = new HashMap>(); - - 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 stackList = new ArrayList(); - stack = GT_OreDictUnificator.get(OrePrefixes.gemExquisite, material, GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L), 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = GT_OreDictUnificator.get(OrePrefixes.gemFlawless, material, GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L), 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = GT_OreDictUnificator.get(OrePrefixes.gemFlawed, material, GT_OreDictUnificator.get(OrePrefixes.crushed, material, 1L), 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = GT_OreDictUnificator.get(OrePrefixes.crushed, material, 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = GT_OreDictUnificator.get(OrePrefixes.gemChipped, material, GT_OreDictUnificator.get(OrePrefixes.dustImpure, material, 1L), 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = GT_OreDictUnificator.get(OrePrefixes.dustImpure, material, 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - smallOreList.add(new ItemStack(GregTech_API.sBlockOres1, 1, meta+16000)); - mapOreMetaToOreDrops.put(meta, stackList); - } - } - } - - private static void checkExtraSupport() { - Class clazzGTSmallOre = null; - try { - clazzGTSmallOre = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_SmallPieces"); - } catch (ClassNotFoundException e) {} - if (clazzGTSmallOre != null) { - try { - Field fieldRestrictBiome = clazzGTSmallOre.getField("mRestrictBiome");; - restrictBiomeSupport = true; - } catch (Exception e) {} - try { - Field fieldGCMoon = clazzGTSmallOre.getField("mMoon"); - Field fieldGCMars = clazzGTSmallOre.getField("mMars"); - gcBasicSupport = true; - } catch (Exception e) {} - } - } - + public static boolean restrictBiomeSupport = false; + public static boolean gcBasicSupport = false; + public static List smallOreList = new ArrayList(); + public static HashMap mapSmallOreWrapper = new HashMap(); + public static HashMap mapOreDropUnlocalizedNameToOreMeta = new HashMap(); + public static HashMap> mapOreMetaToOreDrops = new HashMap>(); + + 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 stackList = new ArrayList(); + stack = GT_OreDictUnificator.get(OrePrefixes.gemExquisite, material, GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L), 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} + stack = GT_OreDictUnificator.get(OrePrefixes.gemFlawless, material, GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L), 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} + stack = GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} + stack = GT_OreDictUnificator.get(OrePrefixes.gemFlawed, material, GT_OreDictUnificator.get(OrePrefixes.crushed, material, 1L), 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} + stack = GT_OreDictUnificator.get(OrePrefixes.crushed, material, 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} + stack = GT_OreDictUnificator.get(OrePrefixes.gemChipped, material, GT_OreDictUnificator.get(OrePrefixes.dustImpure, material, 1L), 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} + stack = GT_OreDictUnificator.get(OrePrefixes.dustImpure, material, 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} + smallOreList.add(new ItemStack(GregTech_API.sBlockOres1, 1, meta+16000)); + mapOreMetaToOreDrops.put(meta, stackList); + } + } + } + + private static void checkExtraSupport() { + Class clazzGTSmallOre = null; + try { + clazzGTSmallOre = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_SmallPieces"); + } catch (ClassNotFoundException e) {} + if (clazzGTSmallOre != null) { + try { + Field fieldRestrictBiome = clazzGTSmallOre.getField("mRestrictBiome");; + restrictBiomeSupport = true; + } catch (Exception e) {} + try { + Field fieldGCMoon = clazzGTSmallOre.getField("mMoon"); + Field fieldGCMars = clazzGTSmallOre.getField("mMars"); + gcBasicSupport = true; + } catch (Exception e) {} + } + } + public static Materials[] getDroppedDusts() { return new Materials[]{Materials.Stone, Materials.Netherrack, Materials.Endstone, Materials.GraniteBlack, Materials.GraniteRed, Materials.Marble, Materials.Basalt, Materials.Stone}; } - - public class SmallOreWrapper { - public String oreGenName; - public short oreMeta; - public String worldGenHeightRange; - public short amountPerChunk; - public String restrictBiome; - public boolean genOverworld = false; - public boolean genNether = false; - public boolean genEnd = false; - public boolean genMoon = false; - public boolean genMars = false; - - public SmallOreWrapper(GT_Worldgen_GT_Ore_SmallPieces worldGen) { - this.oreGenName = worldGen.mWorldGenName; - this.oreMeta = worldGen.mMeta; - this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; - this.amountPerChunk = worldGen.mAmount; - this.genOverworld = worldGen.mOverworld; - this.genNether = worldGen.mNether; - this.genEnd = worldGen.mEnd; - if (GTSmallOreHelper.restrictBiomeSupport) - this.restrictBiome = worldGen.mRestrictBiome; - if (GTSmallOreHelper.gcBasicSupport) { - this.genMoon = worldGen.mMoon; - this.genMars = worldGen.mMars; - } - } - } + + public class SmallOreWrapper { + public String oreGenName; + public short oreMeta; + public String worldGenHeightRange; + public short amountPerChunk; + public String restrictBiome; + public boolean genOverworld = false; + public boolean genNether = false; + public boolean genEnd = false; + public boolean genMoon = false; + public boolean genMars = false; + + public SmallOreWrapper(GT_Worldgen_GT_Ore_SmallPieces worldGen) { + this.oreGenName = worldGen.mWorldGenName; + this.oreMeta = worldGen.mMeta; + this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; + this.amountPerChunk = worldGen.mAmount; + this.genOverworld = worldGen.mOverworld; + this.genNether = worldGen.mNether; + this.genEnd = worldGen.mEnd; + if (GTSmallOreHelper.restrictBiomeSupport) + this.restrictBiome = worldGen.mRestrictBiome; + if (GTSmallOreHelper.gcBasicSupport) { + this.genMoon = worldGen.mMoon; + this.genMars = worldGen.mMars; + } + } + } } -- cgit From efb446e212ccb7ff67e392eb46605117564aa235 Mon Sep 17 00:00:00 2001 From: GWYOG Date: Mon, 7 Nov 2016 20:25:26 +0800 Subject: Add I18n support for GT5's custom vein/asteroid --- .../pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java | 9 ++++++++- .../java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java | 9 ++++++++- src/main/resources/assets/gtneioreplugin/lang/en_US.lang | 7 +++++-- src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang | 1 + 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java index acc00c01ef..9cdc5e7108 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java @@ -56,7 +56,7 @@ public class PluginAsteroidStat extends PluginBase { public void drawExtras(int recipe) { CachedAsteroidStatRecipe crecipe = (CachedAsteroidStatRecipe) this.arecipes.get(recipe); OreLayerWrapper oreLayer = GTOreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + I18n.format("gtnop." + oreLayer.veinName) + I18n.format("gtnop.ore.asteroid.name"), 2, 18, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.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); GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidBetween") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.betweenMeta)), 2, 57, 0x404040, false); @@ -80,6 +80,13 @@ public class PluginAsteroidStat extends PluginBase { return worldNameTranslatedAsteroid; } + public String getLocalizedAsteroidName(String unlocalizedName) { + if (unlocalizedName.startsWith("ore.mix.custom.")) + return I18n.format("gtnop.ore.custom.name") + I18n.format("gtnop.ore.asteroid.name") + unlocalizedName.substring(15); + else + return I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.asteroid.name"); + } + @Override public void loadCraftingRecipes(String outputId, Object... results) { if (outputId.equals(getOutputId())) { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java index 8182233c9b..e2b43cf482 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java @@ -115,7 +115,7 @@ public class PluginVeinStat extends PluginBase { public void drawExtras(int recipe) { CachedVeinStatRecipe crecipe = (CachedVeinStatRecipe) this.arecipes.get(recipe); OreLayerWrapper oreLayer = GTOreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + I18n.format("gtnop." + oreLayer.veinName) + I18n.format("gtnop.ore.vein.name"), 2, 18, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.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); GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + getGTOreLocalizedName(oreLayer.betweenMeta), 2, 57, 0x404040, false); @@ -127,6 +127,13 @@ public class PluginVeinStat extends PluginBase { 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"; diff --git a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang index 177bc65345..cbeb074fbd 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang @@ -37,9 +37,12 @@ gtnop.world.asteroid.name=GalactiCraft Asteroid # biome names gtnop.biome.none.name=None + # vein types -gtnop.ore.vein.name= Vein -gtnop.ore.asteroid.name= Asteriod +gtnop.ore.vein.name=Vein +gtnop.ore.asteroid.name=Asteriod +gtnop.ore.custom.name=Custom + # vein names gtnop.ore.mix.naquadah=Naquadah diff --git a/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang b/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang index 203a30f259..d02326efa8 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang @@ -40,6 +40,7 @@ gtnop.biome.none.name=无 # vein types gtnop.ore.vein.name=矿脉 gtnop.ore.asteroid.name=小行星 +gtnop.ore.custom.name=自定义 # vein names -- cgit From 858f8a8e9d480e271e0dd7219dd24928cc101de7 Mon Sep 17 00:00:00 2001 From: GWYOG Date: Mon, 7 Nov 2016 22:50:01 +0800 Subject: Add new plugin for GT5.09.26's support for IE Vein --- .../gtneioreplugin/plugin/NEIPluginConfig.java | 7 ++ .../gtneioreplugin/plugin/PluginIEVeinStat.java | 134 +++++++++++++++++++++ .../gtneioreplugin/util/GTOreLayerHelper.java | 42 +++++-- .../assets/gtneioreplugin/lang/en_US.lang | 4 + .../assets/gtneioreplugin/lang/zh_CN.lang | 4 + 5 files changed, 181 insertions(+), 10 deletions(-) create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginIEVeinStat.java diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java index 0f1b0210b5..738834c8f0 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java @@ -2,7 +2,9 @@ package pers.gwyog.gtneioreplugin.plugin; 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; public class NEIPluginConfig implements IConfigureNEI { @@ -27,6 +29,11 @@ public class NEIPluginConfig implements IConfigureNEI { API.registerUsageHandler(pluginAsteriodStat); API.registerRecipeHandler(pluginSmallOreStat); API.registerUsageHandler(pluginSmallOreStat); + if (GTOreLayerHelper.immersiveEngineeringSupport) { + PluginIEVeinStat pluginIEVeinStat = new PluginIEVeinStat(); + API.registerRecipeHandler(pluginIEVeinStat); + API.registerUsageHandler(pluginIEVeinStat); + } } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginIEVeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginIEVeinStat.java new file mode 100644 index 0000000000..430490d18a --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginIEVeinStat.java @@ -0,0 +1,134 @@ +package pers.gwyog.gtneioreplugin.plugin; + +import java.util.ArrayList; +import java.util.List; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler.CachedRecipe; +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.PluginAsteroidStat.CachedAsteroidStatRecipe; +import pers.gwyog.gtneioreplugin.util.GTOreLayerHelper; +import pers.gwyog.gtneioreplugin.util.GTOreLayerHelper.OreLayerWrapper; + +public class PluginIEVeinStat extends PluginBase { + + public class CachedIEVeinStatRecipe extends CachedRecipe { + public String veinName; + public PositionedStack positionedStackPrimary; + public PositionedStack positionedStackSecondary; + public PositionedStack positionedStackBetween; + public PositionedStack positionedStackSporadic; + + public CachedIEVeinStatRecipe(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 getIngredients() { + List ingredientsList = new ArrayList(); + 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) { + CachedIEVeinStatRecipe crecipe = (CachedIEVeinStatRecipe) this.arecipes.get(recipe); + OreLayerWrapper oreLayer = GTOreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); + int stringLength1 = GuiDraw.getStringWidth(I18n.format("gtnop.gui.nei.weightedChance") + ": "); + int stringLength2 = GuiDraw.getStringWidth("40%"); + int beginXCoord = (stringLength1-stringLength2)/2; + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer.veinName), 2, 18, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.ieVeinComponent") + ": ", 2, 31, 0x404040, false); + GuiDraw.drawString("40%", beginXCoord, 44, 0x404040, false); + GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.primaryMeta)), 2+stringLength1, 44, 0x404040, false); + GuiDraw.drawString("40%", beginXCoord, 57, 0x404040, false); + GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.secondaryMeta)), 2+stringLength1, 57, 0x404040, false); + GuiDraw.drawString("15%", beginXCoord, 70, 0x404040, false); + GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.betweenMeta)), 2+stringLength1, 70, 0x404040, false); + GuiDraw.drawString("5% ", beginXCoord, 83, 0x404040, false); + GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.sporadicMeta)), 2+stringLength1, 83, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + oreLayer.weightedIEChance, 2, 96, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.fromMod") + ": " + "Immersive Engineering", 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 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.genIEVein) { + ItemStack stackPrimary = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.primaryMeta); + ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.secondaryMeta); + ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.betweenMeta); + ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.sporadicMeta); + this.arecipes.add(new CachedIEVeinStatRecipe(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.genIEVein) { + ItemStack stackPrimary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.primaryMeta); + ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.secondaryMeta); + ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.betweenMeta); + ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.sporadicMeta); + this.arecipes.add(new CachedIEVeinStatRecipe(worldGen.veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); + } + } + } + } + else + super.loadCraftingRecipes(stack); + } + + @Override + public String getOutputId() { + return "GTOrePluginIEVeinCompat"; + } + + @Override + public String getRecipeName() { + return I18n.format("gtnop.gui.ieVeinStat.name"); + } +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GTOreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GTOreLayerHelper.java index 8bc84157e1..fd674464cb 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GTOreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GTOreLayerHelper.java @@ -6,6 +6,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import cpw.mods.fml.common.Loader; +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; import gregtech.common.GT_Worldgen_GT_Ore_Layer; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -16,9 +19,8 @@ public class GTOreLayerHelper { public static boolean endAsteroidSupport = false; public static boolean gcBasicSupport = false; public static boolean gcAsteroidSupport = false; + public static boolean immersiveEngineeringSupport = false; public static HashMap mapOreLayerWrapper = new HashMap(); - public static List> listVein = new ArrayList>(); - public static List> listAsteroid = new ArrayList>(); public GTOreLayerHelper() { checkExtraSupport(); @@ -50,6 +52,26 @@ public class GTOreLayerHelper { gcAsteroidSupport = true; } catch (Exception e) {} } + + // immersive engineering support for GT5.09.25+ + if (Loader.isModLoaded("ImmersiveEngineering")) { + Class clazzGTMod = null; + Class clazzGTProxy = null; + Class clazzGTAPI = null; + try { + clazzGTMod = Class.forName("gregtech.GT_Mod"); + clazzGTProxy = Class.forName("gregtech.common.GT_Proxy"); + clazzGTAPI = Class.forName("gregtech.api.GregTech_API"); + } catch (ClassNotFoundException e) {} + if (clazzGTMod!=null && clazzGTProxy!=null && clazzGTAPI!=null) { + try { + Field fieldImmersiveEngineeringRecipes = clazzGTAPI.getField("mImmersiveEngineering"); + Field fieldGTProxy = clazzGTMod.getField("gregtechproxy"); + Field fieldImmersiveEngineering = clazzGTProxy.getField("mImmersiveEngineeringRecipes"); + immersiveEngineeringSupport = GregTech_API.mImmersiveEngineering && GT_Mod.gregtechproxy.mImmersiveEngineeringRecipes; + } catch (Exception e) {} + } + } } public class OreLayerWrapper { @@ -60,6 +82,7 @@ public class GTOreLayerHelper { public short sporadicMeta; public String worldGenHeightRange; public String weightedChance; + public String weightedIEChance; public String restrictBiome; public boolean genOverworld = false; public boolean genNether = false; @@ -68,6 +91,7 @@ public class GTOreLayerHelper { public boolean genMars = false; public boolean genEndAsteroid = false; public boolean genGCAsteroid = false; + public boolean genIEVein = false; public OreLayerWrapper(GT_Worldgen_GT_Ore_Layer worldGen) { this.veinName = worldGen.mWorldGenName; @@ -90,14 +114,12 @@ public class GTOreLayerHelper { this.genEndAsteroid = worldGen.mEndAsteroid; if (GTOreLayerHelper.gcAsteroidSupport) this.genGCAsteroid = worldGen.mAsteroid; - List list = new ArrayList(); - list.add(primaryMeta); - list.add(secondaryMeta); - list.add(betweenMeta); - list.add(sporadicMeta); - listVein.add(list); - if (genEndAsteroid || genGCAsteroid) - listAsteroid.add(list); + + // immersive engineering support for GT5.09.25+ + if (immersiveEngineeringSupport) { + this.genIEVein = true; + this.weightedIEChance = String.format("%.3f%%", (100.0f*worldGen.mWeight)/GT_Worldgen_GT_Ore_Layer.sWeight/8); + } } } diff --git a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang index cbeb074fbd..2b347b0398 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang @@ -2,6 +2,7 @@ gtnop.gui.veinStat.name=Vein Stats gtnop.gui.asteroidStat.name=Asteroid Stats gtnop.gui.smallOreStat.name=Small Ore Stats +gtnop.gui.ieVeinStat.name=IE Vein Stats gtnop.gui.nei.veinName=Vein name gtnop.gui.nei.primaryOre=Primary-Gen @@ -22,6 +23,9 @@ gtnop.gui.nei.oreName=Ore name gtnop.gui.nei.amount=Amount per chunk gtnop.gui.nei.chanceDrops=Drops +gtnop.gui.nei.ieVeinComponent=Vein components +gtnop.gui.nei.fromMod=From mod + gtnop.gui.nei.seeAll=See All diff --git a/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang b/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang index d02326efa8..042f6065d9 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang @@ -2,6 +2,7 @@ gtnop.gui.veinStat.name=矿脉信息 gtnop.gui.asteroidStat.name=小行星信息 gtnop.gui.smallOreStat.name=贫瘠矿石信息 +gtnop.gui.ieVeinStat.name=IE虚拟矿脉信息 gtnop.gui.nei.veinName=矿脉名称 gtnop.gui.nei.primaryOre=上层矿石 @@ -22,6 +23,9 @@ gtnop.gui.nei.oreName=矿石名称 gtnop.gui.nei.amount=每区块生成个数 gtnop.gui.nei.chanceDrops=几率掉落 +gtnop.gui.nei.ieVeinComponent=矿脉构成 +gtnop.gui.nei.fromMod=来自模组 + gtnop.gui.nei.seeAll=查看全部 # world names -- cgit From 4d9e74936b20d24020b0fdebed723caad9cbf9b4 Mon Sep 17 00:00:00 2001 From: GWYOG Date: Mon, 7 Nov 2016 23:06:46 +0800 Subject: Update mod version to 1.0.2 --- build.gradle | 2 +- src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 2 +- src/main/resources/mcmod.info | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 6e1dc96c39..326c94196c 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.7.10-1.0.1" +version = "1.7.10-1.0.2" group= "pers.gwyog.gtneioreplugin" archivesBaseName = "gtneioreplugin" diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index 37ba99addf..d50011b4ec 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -17,7 +17,7 @@ import pers.gwyog.gtneioreplugin.util.GTSmallOreHelper; public class GTNEIOrePlugin { public static final String MODID = "gtneioreplugin"; public static final String NAME = "GT NEI Ore Plugin"; - public static final String VERSION = "1.0.1"; + public static final String VERSION = "1.0.2"; @Mod.Instance(MODID) public static GTNEIOrePlugin instance; diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 1ade29cae4..9c54701020 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "gtneioreplugin", "name": "GT NEI Ore Plugin", "description": "A forge mod which adds NEI plugins for GregTech5's ores.", - "version": "v1.0.1", + "version": "v1.0.2", "mcversion": "1.7.10", "url": "", "updateUrl": "", -- cgit From 96a346cbe022086815d014e3616182df05b9bfd8 Mon Sep 17 00:00:00 2001 From: GWYOG Date: Thu, 10 Nov 2016 12:51:44 +0800 Subject: Add 3 plugins supporting GT6 and refactor some code --- .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 29 ++-- .../gtneioreplugin/plugin/NEIPluginConfig.java | 48 +++++-- .../gtneioreplugin/plugin/PluginAsteroidStat.java | 142 -------------------- .../gwyog/gtneioreplugin/plugin/PluginBase.java | 22 +-- .../gtneioreplugin/plugin/PluginIEVeinStat.java | 134 ------------------- .../gtneioreplugin/plugin/PluginSmallOreStat.java | 136 ------------------- .../gtneioreplugin/plugin/PluginVeinStat.java | 147 --------------------- .../plugin/gregtech5/PluginGT5AsteroidStat.java | 142 ++++++++++++++++++++ .../plugin/gregtech5/PluginGT5Base.java | 33 +++++ .../plugin/gregtech5/PluginGT5IEVeinStat.java | 133 +++++++++++++++++++ .../plugin/gregtech5/PluginGT5SmallOreStat.java | 135 +++++++++++++++++++ .../plugin/gregtech5/PluginGT5VeinStat.java | 147 +++++++++++++++++++++ .../plugin/gregtech6/PluginGT6BedrockOreStat.java | 114 ++++++++++++++++ .../plugin/gregtech6/PluginGT6SmallOreStat.java | 139 +++++++++++++++++++ .../plugin/gregtech6/PluginGT6VeinStat.java | 138 +++++++++++++++++++ .../gtneioreplugin/util/GT5OreLayerHelper.java | 128 ++++++++++++++++++ .../gtneioreplugin/util/GT5OreSmallHelper.java | 111 ++++++++++++++++ .../gtneioreplugin/util/GT6OreBedrockHelper.java | 56 ++++++++ .../gtneioreplugin/util/GT6OreLayerHelper.java | 76 +++++++++++ .../gtneioreplugin/util/GT6OreSmallHelper.java | 100 ++++++++++++++ .../gtneioreplugin/util/GTOreLayerHelper.java | 126 ------------------ .../gtneioreplugin/util/GTSmallOreHelper.java | 108 --------------- .../assets/gtneioreplugin/lang/en_US.lang | 21 ++- .../assets/gtneioreplugin/lang/zh_CN.lang | 24 +++- 24 files changed, 1550 insertions(+), 839 deletions(-) delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginIEVeinStat.java delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5AsteroidStat.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5IEVeinStat.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6BedrockOreStat.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6SmallOreStat.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreBedrockHelper.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreSmallHelper.java delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/GTOreLayerHelper.java delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/GTSmallOreHelper.java 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/PluginAsteroidStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java deleted file mode 100644 index 9cdc5e7108..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginAsteroidStat.java +++ /dev/null @@ -1,142 +0,0 @@ -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.GTSmallOreHelper; -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 getIngredients() { - List ingredientsList = new ArrayList(); - ingredientsList.add(positionedStackPrimary); - ingredientsList.add(positionedStackSecondary); - ingredientsList.add(positionedStackBetween); - ingredientsList.add(positionedStackSporadic); - return ingredientsList; - } - - @Override - public PositionedStack getResult() { - return null; - } - - } - - @Override - public void drawExtras(int recipe) { - CachedAsteroidStatRecipe crecipe = (CachedAsteroidStatRecipe) this.arecipes.get(recipe); - OreLayerWrapper oreLayer = GTOreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + 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); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidBetween") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.betweenMeta)), 2, 57, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSporadic") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.sporadicMeta)), 2, 70, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genEndAsteroid, oreLayer.genGCAsteroid), 2, 83, 0x404040, false); - GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); - } - - public String getWorldNameTranslated(boolean genEndAsteroid, boolean genGCAsteroid) { - String worldNameTranslatedAsteroid = ""; - if (genEndAsteroid) { - if (!worldNameTranslatedAsteroid.isEmpty()) - worldNameTranslatedAsteroid += ", "; - worldNameTranslatedAsteroid += I18n.format("gtnop.world.end.name"); - } - if (genGCAsteroid) { - if (!worldNameTranslatedAsteroid.isEmpty()) - worldNameTranslatedAsteroid += ", "; - worldNameTranslatedAsteroid += I18n.format("gtnop.world.asteroid.name"); - } - return worldNameTranslatedAsteroid; - } - - public String getLocalizedAsteroidName(String unlocalizedName) { - if (unlocalizedName.startsWith("ore.mix.custom.")) - return I18n.format("gtnop.ore.custom.name") + I18n.format("gtnop.ore.asteroid.name") + unlocalizedName.substring(15); - else - return I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.asteroid.name"); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals(getOutputId())) { - OreLayerWrapper oreLayerWrapper; - for (String veinName: GTOreLayerHelper.mapOreLayerWrapper.keySet()) { - oreLayerWrapper = GTOreLayerHelper.mapOreLayerWrapper.get(veinName); - if (oreLayerWrapper.genEndAsteroid || oreLayerWrapper.genGCAsteroid) { - ItemStack stackPrimary = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.primaryMeta+2000); - ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.secondaryMeta+2000); - ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.betweenMeta+2000); - ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.sporadicMeta+2000); - this.arecipes.add(new CachedAsteroidStatRecipe(veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); - } - } - } - else - super.loadCraftingRecipes(outputId, results); - } - - @Override - public void loadCraftingRecipes(ItemStack stack) { - if (stack.getUnlocalizedName().startsWith("gt.blockores")) { - if (stack.getItemDamage()>16000) { - super.loadCraftingRecipes(stack); - return; - } - short baseMeta = (short)(stack.getItemDamage() % 1000); - for (OreLayerWrapper worldGen: GTOreLayerHelper.mapOreLayerWrapper.values()) { - if (worldGen.primaryMeta == baseMeta || worldGen.secondaryMeta == baseMeta || worldGen.betweenMeta == baseMeta || worldGen.sporadicMeta == baseMeta) { - if (worldGen.genEndAsteroid || worldGen.genGCAsteroid) { - ItemStack stackPrimary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.primaryMeta+2000); - ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.secondaryMeta+2000); - ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.betweenMeta+2000); - ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.sporadicMeta+2000); - this.arecipes.add(new CachedAsteroidStatRecipe(worldGen.veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); - } - } - } - } - else - super.loadCraftingRecipes(stack); - } - - @Override - public String getOutputId() { - return "GTOrePluginAsteroid"; - } - - @Override - public String getRecipeName() { - return I18n.format("gtnop.gui.asteroidStat.name"); - } -} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java index 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/PluginIEVeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginIEVeinStat.java deleted file mode 100644 index 430490d18a..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginIEVeinStat.java +++ /dev/null @@ -1,134 +0,0 @@ -package pers.gwyog.gtneioreplugin.plugin; - -import java.util.ArrayList; -import java.util.List; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.TemplateRecipeHandler.CachedRecipe; -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.PluginAsteroidStat.CachedAsteroidStatRecipe; -import pers.gwyog.gtneioreplugin.util.GTOreLayerHelper; -import pers.gwyog.gtneioreplugin.util.GTOreLayerHelper.OreLayerWrapper; - -public class PluginIEVeinStat extends PluginBase { - - public class CachedIEVeinStatRecipe extends CachedRecipe { - public String veinName; - public PositionedStack positionedStackPrimary; - public PositionedStack positionedStackSecondary; - public PositionedStack positionedStackBetween; - public PositionedStack positionedStackSporadic; - - public CachedIEVeinStatRecipe(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 getIngredients() { - List ingredientsList = new ArrayList(); - 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) { - CachedIEVeinStatRecipe crecipe = (CachedIEVeinStatRecipe) this.arecipes.get(recipe); - OreLayerWrapper oreLayer = GTOreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); - int stringLength1 = GuiDraw.getStringWidth(I18n.format("gtnop.gui.nei.weightedChance") + ": "); - int stringLength2 = GuiDraw.getStringWidth("40%"); - int beginXCoord = (stringLength1-stringLength2)/2; - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer.veinName), 2, 18, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.ieVeinComponent") + ": ", 2, 31, 0x404040, false); - GuiDraw.drawString("40%", beginXCoord, 44, 0x404040, false); - GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.primaryMeta)), 2+stringLength1, 44, 0x404040, false); - GuiDraw.drawString("40%", beginXCoord, 57, 0x404040, false); - GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.secondaryMeta)), 2+stringLength1, 57, 0x404040, false); - GuiDraw.drawString("15%", beginXCoord, 70, 0x404040, false); - GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.betweenMeta)), 2+stringLength1, 70, 0x404040, false); - GuiDraw.drawString("5% ", beginXCoord, 83, 0x404040, false); - GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.sporadicMeta)), 2+stringLength1, 83, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + oreLayer.weightedIEChance, 2, 96, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.fromMod") + ": " + "Immersive Engineering", 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 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.genIEVein) { - ItemStack stackPrimary = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.primaryMeta); - ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.secondaryMeta); - ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.betweenMeta); - ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.sporadicMeta); - this.arecipes.add(new CachedIEVeinStatRecipe(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.genIEVein) { - ItemStack stackPrimary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.primaryMeta); - ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.secondaryMeta); - ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.betweenMeta); - ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.sporadicMeta); - this.arecipes.add(new CachedIEVeinStatRecipe(worldGen.veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); - } - } - } - } - else - super.loadCraftingRecipes(stack); - } - - @Override - public String getOutputId() { - return "GTOrePluginIEVeinCompat"; - } - - @Override - public String getRecipeName() { - return I18n.format("gtnop.gui.ieVeinStat.name"); - } -} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java deleted file mode 100644 index 1aba8c8992..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginSmallOreStat.java +++ /dev/null @@ -1,136 +0,0 @@ -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 positionedDropStackList; - - public CachedSmallOreRecipe(String oreGenName, List stackList, List materialDustStackList, List dropStackList) { - this.oreGenName = oreGenName; - this.positionedStackSmallOre = new PositionedStack(stackList, 2, 0); - this.positionedStackMaterialDust = new PositionedStack(materialDustStackList, 43, 79+getRestrictBiomeOffset()); - List positionedDropStackList = new ArrayList(); - int i = 1; - for (ItemStack stackDrop: dropStackList) - positionedDropStackList.add(new PositionedStack(stackDrop, 43+20*(i%4), 79+16*((i++)/4)+getRestrictBiomeOffset())); - this.positionedDropStackList = positionedDropStackList; - } - - @Override - public List getIngredients() { - positionedStackSmallOre.setPermutationToRender((cycleticks / 20) % positionedStackSmallOre.items.length); - positionedStackMaterialDust.setPermutationToRender((cycleticks / 20) % positionedStackMaterialDust.items.length); - positionedDropStackList.add(positionedStackSmallOre); - positionedDropStackList.add(positionedStackMaterialDust); - return positionedDropStackList; - - } - - @Override - public PositionedStack getResult() { - return null; - } - - } - - @Override - public void drawExtras(int recipe) { - CachedSmallOreRecipe crecipe = (CachedSmallOreRecipe) this.arecipes.get(recipe); - SmallOreWrapper smallOre = GTSmallOreHelper.mapSmallOreWrapper.get(crecipe.oreGenName); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreName") + ": " + getGTOreLocalizedName((short)(smallOre.oreMeta+16000)), 2, 18, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + smallOre.worldGenHeightRange, 2, 31, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.amount") + ": " + smallOre.amountPerChunk, 2, 44, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(smallOre.genOverworld, smallOre.genNether, smallOre.genEnd, smallOre.genMoon, smallOre.genMars), 2, 57, 0x404040, false); - if (GTSmallOreHelper.restrictBiomeSupport) GuiDraw.drawString(I18n.format("gtnop.gui.nei.restrictBiome") + ": " + getBiomeTranslated(smallOre.restrictBiome), 2, 70, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.chanceDrops") + ": ", 2, 83+getRestrictBiomeOffset(), 0x404040, false); - GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); - } - - public int getRestrictBiomeOffset() { - return GTSmallOreHelper.restrictBiomeSupport? 0: -13; - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals(getOutputId())) - for (ItemStack stack: GTSmallOreHelper.smallOreList) - loadCraftingRecipes(stack); - else - super.loadCraftingRecipes(outputId, results); - } - - @Override - public void loadCraftingRecipes(ItemStack stack) { - if (stack.getUnlocalizedName().startsWith("gt.blockores")) { - if (stack.getItemDamage()<16000) { - super.loadCraftingRecipes(stack); - return; - } - short baseMeta = (short)(stack.getItemDamage() % 1000); - for (SmallOreWrapper smallOreWorldGen: GTSmallOreHelper.mapSmallOreWrapper.values()) { - if (smallOreWorldGen.oreMeta == baseMeta) { - List stackList = new ArrayList(); - int maximumIndex = getMaximumMaterialIndex(baseMeta, true); - for (int i=0;i materialDustStackList = new ArrayList(); - for (int i=0;i stackList = new ArrayList(); - for (int i=0;i<7;i++) - stackList.add(new ItemStack(GregTech_API.sBlockOres1, 1, baseMeta+16000+i*1000)); - List materialDustStackList = new ArrayList(); - for (int i=0;i<7;i++) - materialDustStackList.add(GT_OreDictUnificator.get(OrePrefixes.dust, GTSmallOreHelper.getDroppedDusts()[i], 1L)); - this.arecipes.add(new CachedSmallOreRecipe(GTSmallOreHelper.mapSmallOreWrapper.get(oreGenName).oreGenName, stackList, materialDustStackList, GTSmallOreHelper.mapOreMetaToOreDrops.get(baseMeta))); - } - } - } - else - super.loadCraftingRecipes(stack); - } - - @Override - public String getOutputId() { - return "GTOrePluginSmallOre"; - } - - @Override - public String getRecipeName() { - return I18n.format("gtnop.gui.smallOreStat.name"); - } -} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java deleted file mode 100644 index e2b43cf482..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginVeinStat.java +++ /dev/null @@ -1,147 +0,0 @@ -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 stackListPrimary, List stackListSecondary, - List stackListBetween, List 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 getIngredients() { - List ingredientsList = new ArrayList(); - 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 stackListPrimary = new ArrayList(); - List stackListSecondary = new ArrayList(); - List stackListBetween = new ArrayList(); - List stackListSporadic = new ArrayList(); - for (int i=0;i<7;i++) { - stackListPrimary.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.primaryMeta+i*1000)); - stackListSecondary.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.secondaryMeta+i*1000)); - stackListBetween.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.betweenMeta+i*1000)); - stackListSporadic.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.sporadicMeta+i*1000)); - } - this.arecipes.add(new CachedVeinStatRecipe(veinName, stackListPrimary, stackListSecondary, stackListBetween, stackListSporadic)); - } - } - else - super.loadCraftingRecipes(outputId, results); - } - - @Override - public void loadCraftingRecipes(ItemStack stack) { - if (stack.getUnlocalizedName().startsWith("gt.blockores")) { - if (stack.getItemDamage()>16000) { - super.loadCraftingRecipes(stack); - return; - } - short baseMeta = (short)(stack.getItemDamage() % 1000); - for (OreLayerWrapper worldGen: GTOreLayerHelper.mapOreLayerWrapper.values()) { - if (worldGen.primaryMeta == baseMeta || worldGen.secondaryMeta == baseMeta || worldGen.betweenMeta == baseMeta || worldGen.sporadicMeta == baseMeta) { - List stackListPrimary = new ArrayList(); - List stackListSecondary = new ArrayList(); - List stackListBetween = new ArrayList(); - List stackListSporadic = new ArrayList(); - for (int i=0;i getIngredients() { + List ingredientsList = new ArrayList(); + 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 = 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); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidBetween") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.betweenMeta)), 2, 57, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSporadic") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.sporadicMeta)), 2, 70, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genEndAsteroid, oreLayer.genGCAsteroid), 2, 83, 0x404040, false); + GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); + } + + public String getWorldNameTranslated(boolean genEndAsteroid, boolean genGCAsteroid) { + String worldNameTranslatedAsteroid = ""; + if (genEndAsteroid) { + if (!worldNameTranslatedAsteroid.isEmpty()) + worldNameTranslatedAsteroid += ", "; + worldNameTranslatedAsteroid += I18n.format("gtnop.world.end.name"); + } + if (genGCAsteroid) { + if (!worldNameTranslatedAsteroid.isEmpty()) + worldNameTranslatedAsteroid += ", "; + worldNameTranslatedAsteroid += I18n.format("gtnop.world.asteroid.name"); + } + return worldNameTranslatedAsteroid; + } + + public String getLocalizedAsteroidName(String unlocalizedName) { + if (unlocalizedName.startsWith("ore.mix.custom.")) + return I18n.format("gtnop.ore.custom.name") + I18n.format("gtnop.ore.asteroid.name") + unlocalizedName.substring(15); + else + return I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.asteroid.name"); + } + + @Override + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals(getOutputId())) { + OreLayerWrapper oreLayerWrapper; + 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); + 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: 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); + ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.secondaryMeta+2000); + ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.betweenMeta+2000); + ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.sporadicMeta+2000); + this.arecipes.add(new CachedAsteroidStatRecipe(worldGen.veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); + } + } + } + } + else + super.loadCraftingRecipes(stack); + } + + @Override + public String getOutputId() { + return "GTOrePluginAsteroid"; + } + + @Override + public String getRecipeName() { + return I18n.format("gtnop.gui.asteroidStat.name"); + } +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/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/gregtech5/PluginGT5IEVeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5IEVeinStat.java new file mode 100644 index 0000000000..547c966081 --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5IEVeinStat.java @@ -0,0 +1,133 @@ +package pers.gwyog.gtneioreplugin.plugin.gregtech5; + +import java.util.ArrayList; +import java.util.List; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler.CachedRecipe; +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.util.GT5OreLayerHelper; +import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; + +public class PluginGT5IEVeinStat extends PluginGT5Base { + + public class CachedIEVeinStatRecipe extends CachedRecipe { + public String veinName; + public PositionedStack positionedStackPrimary; + public PositionedStack positionedStackSecondary; + public PositionedStack positionedStackBetween; + public PositionedStack positionedStackSporadic; + + public CachedIEVeinStatRecipe(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 getIngredients() { + List ingredientsList = new ArrayList(); + 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) { + CachedIEVeinStatRecipe crecipe = (CachedIEVeinStatRecipe) this.arecipes.get(recipe); + 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; + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer.veinName), 2, 18, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.ieVeinComponent") + ": ", 2, 31, 0x404040, false); + GuiDraw.drawString("40%", beginXCoord, 44, 0x404040, false); + GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.primaryMeta)), 2+stringLength1, 44, 0x404040, false); + GuiDraw.drawString("40%", beginXCoord, 57, 0x404040, false); + GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.secondaryMeta)), 2+stringLength1, 57, 0x404040, false); + GuiDraw.drawString("15%", beginXCoord, 70, 0x404040, false); + GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.betweenMeta)), 2+stringLength1, 70, 0x404040, false); + GuiDraw.drawString("5% ", beginXCoord, 83, 0x404040, false); + GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.sporadicMeta)), 2+stringLength1, 83, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + oreLayer.weightedIEChance, 2, 96, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.fromMod") + ": " + "Immersive Engineering", 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 void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals(getOutputId())) { + OreLayerWrapper oreLayerWrapper; + 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); + ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.betweenMeta); + ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.sporadicMeta); + this.arecipes.add(new CachedIEVeinStatRecipe(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: 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); + ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.secondaryMeta); + ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.betweenMeta); + ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.sporadicMeta); + this.arecipes.add(new CachedIEVeinStatRecipe(worldGen.veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); + } + } + } + } + else + super.loadCraftingRecipes(stack); + } + + @Override + public String getOutputId() { + return "GTOrePluginIEVeinCompat"; + } + + @Override + public String getRecipeName() { + return I18n.format("gtnop.gui.ieVeinStat.name"); + } +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java new file mode 100644 index 0000000000..f1ddce6629 --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java @@ -0,0 +1,135 @@ +package pers.gwyog.gtneioreplugin.plugin.gregtech5; + +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.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 PluginGT5SmallOreStat extends PluginGT5Base { + + public class CachedOreSmallRecipe extends CachedRecipe { + public String oreGenName; + public PositionedStack positionedStackOreSmall; + public PositionedStack positionedStackMaterialDust; + public List positionedDropStackList; + + public CachedOreSmallRecipe(String oreGenName, List stackList, List materialDustStackList, List dropStackList) { + this.oreGenName = oreGenName; + this.positionedStackOreSmall = new PositionedStack(stackList, 2, 0); + this.positionedStackMaterialDust = new PositionedStack(materialDustStackList, 43, 79+getRestrictBiomeOffset()); + List positionedDropStackList = new ArrayList(); + int i = 1; + for (ItemStack stackDrop: dropStackList) + positionedDropStackList.add(new PositionedStack(stackDrop, 43+20*(i%4), 79+16*((i++)/4)+getRestrictBiomeOffset())); + this.positionedDropStackList = positionedDropStackList; + } + + @Override + public List 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 = 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 GT5OreSmallHelper.restrictBiomeSupport? 0: -13; + } + + @Override + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals(getOutputId())) + for (ItemStack stack: GT5OreSmallHelper.oreSmallList) + 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 (OreSmallWrapper oreSmallWorldGen: GT5OreSmallHelper.mapOreSmallWrapper.values()) { + if (oreSmallWorldGen.oreMeta == baseMeta) { + List stackList = new ArrayList(); + int maximumIndex = getMaximumMaterialIndex(baseMeta, true); + for (int i=0;i materialDustStackList = new ArrayList(); + for (int i=0;i stackList = new ArrayList(); + for (int i=0;i<7;i++) + stackList.add(new ItemStack(GregTech_API.sBlockOres1, 1, baseMeta+16000+i*1000)); + List materialDustStackList = new ArrayList(); + for (int i=0;i<7;i++) + 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))); + } + } + } + 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/gregtech5/PluginGT5VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java new file mode 100644 index 0000000000..d9085ab82a --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -0,0 +1,147 @@ +package pers.gwyog.gtneioreplugin.plugin.gregtech5; + +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.GT5OreLayerHelper; +import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; + +public class PluginGT5VeinStat extends PluginGT5Base { + + 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 stackListPrimary, List stackListSecondary, + List stackListBetween, List 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 getIngredients() { + List ingredientsList = new ArrayList(); + 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: GT5OreLayerHelper.mapOreLayerWrapper.keySet()) { + oreLayerWrapper = GT5OreLayerHelper.mapOreLayerWrapper.get(veinName); + List stackListPrimary = new ArrayList(); + List stackListSecondary = new ArrayList(); + List stackListBetween = new ArrayList(); + List stackListSporadic = new ArrayList(); + 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: GT5OreLayerHelper.mapOreLayerWrapper.values()) { + if (worldGen.primaryMeta == baseMeta || worldGen.secondaryMeta == baseMeta || worldGen.betweenMeta == baseMeta || worldGen.sporadicMeta == baseMeta) { + List stackListPrimary = new ArrayList(); + List stackListSecondary = new ArrayList(); + List stackListBetween = new ArrayList(); + List stackListSporadic = new ArrayList(); + for (int i=0;i stackListOre, List 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 getIngredients() { + List ingredientsList = new ArrayList(); + 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 stackListOre = new ArrayList(); + List stackListOreSmall = new ArrayList(); + 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 positionedDropStackList; + + public CachedOreSmallRecipe(String oreGenName, List stackList, List materialDustStackList, List dropStackList) { + this.oreGenName = oreGenName; + this.positionedStackOreSmall = new PositionedStack(stackList, 2, 0); + this.positionedStackMaterialDust = new PositionedStack(materialDustStackList, 43, 67); + List positionedDropStackList = new ArrayList(); + 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 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 stackList = new ArrayList(); + List materialDustStackList = new ArrayList(); + 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 stackList = new ArrayList(); + List materialDustStackList = new ArrayList(); + 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 stackListPrimary, List stackListSecondary, + List stackListBetween, List 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 getIngredients() { + List ingredientsList = new ArrayList(); + 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 stackListPrimary = new ArrayList(); + List stackListSecondary = new ArrayList(); + List stackListBetween = new ArrayList(); + List stackListSporadic = new ArrayList(); + 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 stackListPrimary = new ArrayList(); + List stackListSecondary = new ArrayList(); + List stackListBetween = new ArrayList(); + List stackListSporadic = new ArrayList(); + 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/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java new file mode 100644 index 0000000000..9026aec71d --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -0,0 +1,128 @@ +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 cpw.mods.fml.common.Loader; +import gregtech.GT_Mod; +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 GT5OreLayerHelper { + public static boolean restrictBiomeSupport = false; + public static boolean endAsteroidSupport = false; + public static boolean gcBasicSupport = false; + public static boolean gcAsteroidSupport = false; + public static boolean immersiveEngineeringSupport = false; + public static HashMap mapOreLayerWrapper = new HashMap(); + + 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; + try { + clazzGTOreLayer = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_Layer"); + } catch (ClassNotFoundException e) {} + if (clazzGTOreLayer != null) { + try { + Field fieldRestrictBiome = clazzGTOreLayer.getField("mRestrictBiome"); + restrictBiomeSupport = true; + } catch (Exception e) {} + try { + Field fieldEndAsteroid = clazzGTOreLayer.getField("mEndAsteroid"); + endAsteroidSupport = true; + } catch (Exception e) {} + try { + Field fieldGCMoon = clazzGTOreLayer.getField("mMoon"); + Field fieldGCMars = clazzGTOreLayer.getField("mMars"); + gcBasicSupport = true; + } catch (Exception e) {} + try { + Field fieldGCAsteroid = clazzGTOreLayer.getField("mAsteroid"); + gcAsteroidSupport = true; + } catch (Exception e) {} + } + + // immersive engineering support for GT5.09.25+ + if (Loader.instance().isModLoaded("ImmersiveEngineering")) { + Class clazzGTMod = null; + Class clazzGTProxy = null; + Class clazzGTAPI = null; + try { + clazzGTMod = Class.forName("gregtech.GT_Mod"); + clazzGTProxy = Class.forName("gregtech.common.GT_Proxy"); + clazzGTAPI = Class.forName("gregtech.api.GregTech_API"); + } catch (ClassNotFoundException e) {} + if (clazzGTMod!=null && clazzGTProxy!=null && clazzGTAPI!=null) { + try { + Field fieldImmersiveEngineeringRecipes = clazzGTAPI.getField("mImmersiveEngineering"); + Field fieldGTProxy = clazzGTMod.getField("gregtechproxy"); + Field fieldImmersiveEngineering = clazzGTProxy.getField("mImmersiveEngineeringRecipes"); + immersiveEngineeringSupport = GregTech_API.mImmersiveEngineering && GT_Mod.gregtechproxy.mImmersiveEngineeringRecipes; + } 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 weightedIEChance; + 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 boolean genIEVein = false; + + public OreLayerWrapper(GT_Worldgen_GT_Ore_Layer worldGen) { + this.veinName = worldGen.mWorldGenName; + this.primaryMeta = worldGen.mPrimaryMeta; + this.secondaryMeta = worldGen.mSecondaryMeta; + this.betweenMeta = worldGen.mBetweenMeta; + this.sporadicMeta = worldGen.mSporadicMeta; + this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; + this.weightedChance = String.format("%.2f%%", (100.0f*worldGen.mWeight)/GT_Worldgen_GT_Ore_Layer.sWeight); + this.genOverworld = worldGen.mOverworld; + this.genNether = worldGen.mNether; + this.genEnd = worldGen.mEnd; + if (restrictBiomeSupport) + this.restrictBiome = worldGen.mRestrictBiome; + if (GT5OreLayerHelper.gcBasicSupport) { + this.genMoon = worldGen.mMoon; + this.genMars = worldGen.mMars; + } + if (GT5OreLayerHelper.endAsteroidSupport) + this.genEndAsteroid = worldGen.mEndAsteroid; + if (GT5OreLayerHelper.gcAsteroidSupport) + this.genGCAsteroid = worldGen.mAsteroid; + + // immersive engineering support for GT5.09.25+ + if (immersiveEngineeringSupport) { + this.genIEVein = true; + 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/GT5OreSmallHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java new file mode 100644 index 0000000000..69311a83ee --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java @@ -0,0 +1,111 @@ +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; +import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; + +public class GT5OreSmallHelper { + public static boolean restrictBiomeSupport = false; + public static boolean gcBasicSupport = false; + public static List oreSmallList = new ArrayList(); + public static HashMap mapOreSmallWrapper = new HashMap(); + public static HashMap mapOreDropUnlocalizedNameToOreMeta = new HashMap(); + public static HashMap> mapOreMetaToOreDrops = new HashMap>(); + + public GT5OreSmallHelper() { + 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]; + mapOreSmallWrapper.put(worldGen.mWorldGenName, new OreSmallWrapper(worldGenSmallPieces)); + if (!mapOreMetaToOreDrops.keySet().contains(meta)) { + List stackList = new ArrayList(); + 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);} + oreSmallList.add(new ItemStack(GregTech_API.sBlockOres1, 1, meta+16000)); + mapOreMetaToOreDrops.put(meta, stackList); + } + } + } + + private static void checkExtraSupport() { + if (GTNEIOrePlugin.GTVersion.equals("GT5")) { + Class clazzGTOreSmall = null; + try { + 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 OreSmallWrapper { + 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 OreSmallWrapper(GT_Worldgen_GT_Ore_SmallPieces worldGen) { + this.oreGenName = worldGen.mWorldGenName; + this.oreMeta = worldGen.mMeta; + this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; + this.amountPerChunk = worldGen.mAmount; + this.genOverworld = worldGen.mOverworld; + this.genNether = worldGen.mNether; + this.genEnd = worldGen.mEnd; + if (GT5OreSmallHelper.restrictBiomeSupport) + this.restrictBiome = worldGen.mRestrictBiome; + 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 mapOreBedrockWrapper = new HashMap(); + public static HashMap mapMetaToLocalizedName = new HashMap(); + + 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 mapOreLayerWrapper = new HashMap(); + public static HashMap mapMetaToLocalizedName = new HashMap(); + public static Set setOreNormalBasicTypes = new HashSet(); + + public GT6OreLayerHelper() { + for (Worldgen_GT_Ore_Layer tWorldGen: Worldgen_GT_Ore_Layer.sList) + mapOreLayerWrapper.put(tWorldGen.mWorldGenName, new OreLayerWrapper(tWorldGen)); + Set setNormalOreBasicTypesTemp = new HashSet(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 oreSmallList = new ArrayList(); + public static HashMap mapOreSmallWrapper = new HashMap(); + public static HashMap mapOreDropUnlocalizedNameToOreMeta = new HashMap(); + public static HashMap> mapOreMetaToOreDrops = new HashMap>(); + public static HashMap mapMetaToLocalizedName = new HashMap(); + public static Set setOreSmallBasicTypes = new HashSet(); + + 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 stackList = new ArrayList(); + 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 setSmallOreBasicTypesTemp = new HashSet(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; + } + } + +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GTOreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GTOreLayerHelper.java deleted file mode 100644 index fd674464cb..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GTOreLayerHelper.java +++ /dev/null @@ -1,126 +0,0 @@ -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 cpw.mods.fml.common.Loader; -import gregtech.GT_Mod; -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 sun.awt.windows.WWindowPeer; - -public class GTOreLayerHelper { - public static boolean restrictBiomeSupport = false; - public static boolean endAsteroidSupport = false; - public static boolean gcBasicSupport = false; - public static boolean gcAsteroidSupport = false; - public static boolean immersiveEngineeringSupport = false; - public static HashMap mapOreLayerWrapper = new HashMap(); - - public GTOreLayerHelper() { - checkExtraSupport(); - for (GT_Worldgen_GT_Ore_Layer tWorldGen: GT_Worldgen_GT_Ore_Layer.sList) - mapOreLayerWrapper.put(tWorldGen.mWorldGenName, new OreLayerWrapper(tWorldGen)); - } - - private static void checkExtraSupport() { - Class clazzGTOreLayer = null; - try { - clazzGTOreLayer = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_Layer"); - } catch (ClassNotFoundException e) {} - if (clazzGTOreLayer != null) { - try { - Field fieldRestrictBiome = clazzGTOreLayer.getField("mRestrictBiome"); - restrictBiomeSupport = true; - } catch (Exception e) {} - try { - Field fieldEndAsteroid = clazzGTOreLayer.getField("mEndAsteroid"); - endAsteroidSupport = true; - } catch (Exception e) {} - try { - Field fieldGCMoon = clazzGTOreLayer.getField("mMoon"); - Field fieldGCMars = clazzGTOreLayer.getField("mMars"); - gcBasicSupport = true; - } catch (Exception e) {} - try { - Field fieldGCAsteroid = clazzGTOreLayer.getField("mAsteroid"); - gcAsteroidSupport = true; - } catch (Exception e) {} - } - - // immersive engineering support for GT5.09.25+ - if (Loader.isModLoaded("ImmersiveEngineering")) { - Class clazzGTMod = null; - Class clazzGTProxy = null; - Class clazzGTAPI = null; - try { - clazzGTMod = Class.forName("gregtech.GT_Mod"); - clazzGTProxy = Class.forName("gregtech.common.GT_Proxy"); - clazzGTAPI = Class.forName("gregtech.api.GregTech_API"); - } catch (ClassNotFoundException e) {} - if (clazzGTMod!=null && clazzGTProxy!=null && clazzGTAPI!=null) { - try { - Field fieldImmersiveEngineeringRecipes = clazzGTAPI.getField("mImmersiveEngineering"); - Field fieldGTProxy = clazzGTMod.getField("gregtechproxy"); - Field fieldImmersiveEngineering = clazzGTProxy.getField("mImmersiveEngineeringRecipes"); - immersiveEngineeringSupport = GregTech_API.mImmersiveEngineering && GT_Mod.gregtechproxy.mImmersiveEngineeringRecipes; - } 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 weightedIEChance; - 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 boolean genIEVein = false; - - public OreLayerWrapper(GT_Worldgen_GT_Ore_Layer worldGen) { - this.veinName = worldGen.mWorldGenName; - this.primaryMeta = worldGen.mPrimaryMeta; - this.secondaryMeta = worldGen.mSecondaryMeta; - this.betweenMeta = worldGen.mBetweenMeta; - this.sporadicMeta = worldGen.mSporadicMeta; - this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; - this.weightedChance = String.format("%.2f%%", (100.0f*worldGen.mWeight)/GT_Worldgen_GT_Ore_Layer.sWeight); - this.genOverworld = worldGen.mOverworld; - this.genNether = worldGen.mNether; - this.genEnd = worldGen.mEnd; - if (restrictBiomeSupport) - this.restrictBiome = worldGen.mRestrictBiome; - if (GTOreLayerHelper.gcBasicSupport) { - this.genMoon = worldGen.mMoon; - this.genMars = worldGen.mMars; - } - if (GTOreLayerHelper.endAsteroidSupport) - this.genEndAsteroid = worldGen.mEndAsteroid; - if (GTOreLayerHelper.gcAsteroidSupport) - this.genGCAsteroid = worldGen.mAsteroid; - - // immersive engineering support for GT5.09.25+ - if (immersiveEngineeringSupport) { - this.genIEVein = true; - 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/GTSmallOreHelper.java deleted file mode 100644 index 5c8168e503..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GTSmallOreHelper.java +++ /dev/null @@ -1,108 +0,0 @@ -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 restrictBiomeSupport = false; - public static boolean gcBasicSupport = false; - public static List smallOreList = new ArrayList(); - public static HashMap mapSmallOreWrapper = new HashMap(); - public static HashMap mapOreDropUnlocalizedNameToOreMeta = new HashMap(); - public static HashMap> mapOreMetaToOreDrops = new HashMap>(); - - 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 stackList = new ArrayList(); - stack = GT_OreDictUnificator.get(OrePrefixes.gemExquisite, material, GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L), 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = GT_OreDictUnificator.get(OrePrefixes.gemFlawless, material, GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L), 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = GT_OreDictUnificator.get(OrePrefixes.gemFlawed, material, GT_OreDictUnificator.get(OrePrefixes.crushed, material, 1L), 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = GT_OreDictUnificator.get(OrePrefixes.crushed, material, 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = GT_OreDictUnificator.get(OrePrefixes.gemChipped, material, GT_OreDictUnificator.get(OrePrefixes.dustImpure, material, 1L), 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - stack = GT_OreDictUnificator.get(OrePrefixes.dustImpure, material, 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) {mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta);stackList.add(stack);} - smallOreList.add(new ItemStack(GregTech_API.sBlockOres1, 1, meta+16000)); - mapOreMetaToOreDrops.put(meta, stackList); - } - } - } - - private static void checkExtraSupport() { - Class clazzGTSmallOre = null; - try { - clazzGTSmallOre = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_SmallPieces"); - } catch (ClassNotFoundException e) {} - if (clazzGTSmallOre != null) { - try { - Field fieldRestrictBiome = clazzGTSmallOre.getField("mRestrictBiome");; - restrictBiomeSupport = true; - } catch (Exception e) {} - try { - Field fieldGCMoon = clazzGTSmallOre.getField("mMoon"); - Field fieldGCMars = clazzGTSmallOre.getField("mMars"); - gcBasicSupport = true; - } catch (Exception e) {} - } - } - - public static Materials[] getDroppedDusts() { - return new Materials[]{Materials.Stone, Materials.Netherrack, Materials.Endstone, Materials.GraniteBlack, Materials.GraniteRed, Materials.Marble, Materials.Basalt, Materials.Stone}; - } - - public class SmallOreWrapper { - public String oreGenName; - public short oreMeta; - public String worldGenHeightRange; - public short amountPerChunk; - public String restrictBiome; - public boolean genOverworld = false; - public boolean genNether = false; - public boolean genEnd = false; - public boolean genMoon = false; - public boolean genMars = false; - - public SmallOreWrapper(GT_Worldgen_GT_Ore_SmallPieces worldGen) { - this.oreGenName = worldGen.mWorldGenName; - this.oreMeta = worldGen.mMeta; - this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; - this.amountPerChunk = worldGen.mAmount; - this.genOverworld = worldGen.mOverworld; - this.genNether = worldGen.mNether; - this.genEnd = worldGen.mEnd; - if (GTSmallOreHelper.restrictBiomeSupport) - this.restrictBiome = worldGen.mRestrictBiome; - if (GTSmallOreHelper.gcBasicSupport) { - this.genMoon = worldGen.mMoon; - this.genMars = worldGen.mMars; - } - } - } -} diff --git a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang index 2b347b0398..25cfea1ead 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang @@ -3,6 +3,7 @@ gtnop.gui.veinStat.name=Vein Stats gtnop.gui.asteroidStat.name=Asteroid Stats gtnop.gui.smallOreStat.name=Small Ore Stats gtnop.gui.ieVeinStat.name=IE Vein Stats +gtnop.gui.bedrockOreStat.name=Bedrock Ore Stats gtnop.gui.nei.veinName=Vein name gtnop.gui.nei.primaryOre=Primary-Gen @@ -28,6 +29,10 @@ gtnop.gui.nei.fromMod=From mod gtnop.gui.nei.seeAll=See All +gtnop.gui.nei.oreOthers=Other ore +gtnop.nei.genPosition=Position +gtnop.nei.genPositionInfo=In the center of each chunk + # world names gtnop.world.overworld.name=Overworld @@ -42,6 +47,10 @@ gtnop.world.asteroid.name=GalactiCraft Asteroid gtnop.biome.none.name=None +# ore names extra +gtnop.ore.null.name=None + + # vein types gtnop.ore.vein.name=Vein gtnop.ore.asteroid.name=Asteriod @@ -49,6 +58,7 @@ gtnop.ore.custom.name=Custom # vein names +# gregtech5.09 gtnop.ore.mix.naquadah=Naquadah gtnop.ore.mix.lignite=Lignite gtnop.ore.mix.coal=Coal @@ -82,4 +92,13 @@ gtnop.ore.mix.lapis=Lapis gtnop.ore.mix.beryllium=Beryllium gtnop.ore.mix.oilsand=Oilsand -gtnop.ore.mix.plutonium=Plutonium \ No newline at end of file +# gregtech5.08 +gtnop.ore.mix.plutonium=Plutonium + +# gregtech6 +gtnop.ore.mix.iodinesalt=Iodinesalt +gtnop.ore.mix.rocksalt=Rocksalt +gtnop.ore.mix.asbestos=Asbestos +gtnop.ore.mix.titanium=Titanium +gtnop.ore.mix.garnet=Garnet +gtnop.ore.mix.dolamide=Dolamide \ 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 index 042f6065d9..28b037420e 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang @@ -3,6 +3,7 @@ gtnop.gui.veinStat.name=矿脉信息 gtnop.gui.asteroidStat.name=小行星信息 gtnop.gui.smallOreStat.name=贫瘠矿石信息 gtnop.gui.ieVeinStat.name=IE虚拟矿脉信息 +gtnop.gui.bedrockOreStat.name=基岩矿脉信息 gtnop.gui.nei.veinName=矿脉名称 gtnop.gui.nei.primaryOre=上层矿石 @@ -10,7 +11,7 @@ gtnop.gui.nei.secondaryOre=下层矿石 gtnop.gui.nei.betweenOre=中层矿石 gtnop.gui.nei.sporadicOre=散乱分布 gtnop.gui.nei.genHeight=生成高度 -gtnop.gui.nei.weightedChance=发现几率 +gtnop.gui.nei.weightedChance=生成几率 gtnop.gui.nei.worldNames=生成世界 gtnop.gui.nei.restrictBiome=生物群系限制 @@ -28,6 +29,11 @@ gtnop.gui.nei.fromMod=来自模组 gtnop.gui.nei.seeAll=查看全部 +gtnop.gui.nei.oreOthers=伴随生成 +gtnop.nei.genPosition=生成位置 +gtnop.nei.genPositionInfo=各个区块的正中心 + + # world names gtnop.world.overworld.name=主世界 gtnop.world.nether.name=下界 @@ -41,6 +47,10 @@ gtnop.world.asteroid.name=星系mod小行星带 gtnop.biome.none.name=无 +# ore names extra +gtnop.ore.null.name=无 + + # vein types gtnop.ore.vein.name=矿脉 gtnop.ore.asteroid.name=小行星 @@ -48,6 +58,7 @@ gtnop.ore.custom.name=自定义 # vein names +# gregtech5.09 gtnop.ore.mix.naquadah=硅岩 gtnop.ore.mix.lignite=褐煤 gtnop.ore.mix.coal=煤 @@ -81,4 +92,13 @@ gtnop.ore.mix.lapis=青金石 gtnop.ore.mix.beryllium=铍 gtnop.ore.mix.oilsand=油砂 -gtnop.ore.mix.plutonium=钚 \ No newline at end of file +# gregtech5.08 +gtnop.ore.mix.plutonium=钚 + +# gregtech6 +gtnop.ore.mix.iodinesalt=Iodinesalt +gtnop.ore.mix.rocksalt=岩盐 +gtnop.ore.mix.asbestos=石棉 +gtnop.ore.mix.titanium=钛 +gtnop.ore.mix.garnet=石榴石 +gtnop.ore.mix.dolamide=Dolamide \ No newline at end of file -- cgit From 93ec38a82e317adf8bf398b14d8ed8741defc655 Mon Sep 17 00:00:00 2001 From: GWYOG Date: Thu, 10 Nov 2016 12:53:36 +0800 Subject: Update the comment info in build.gradle --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 326c94196c..58d091f43a 100644 --- a/build.gradle +++ b/build.gradle @@ -30,7 +30,7 @@ minecraft { } dependencies { - // You should put the dev builds of NEI (with its dependencies) and GregTech5 in the /libs folder manually + // You should put the dev builds of NEI (with its dependencies), GregTech5 and GregTech6 in the /libs folder manually // to make the gradlew build working properly. // compile "codechicken:NotEnoughItems:1.7.10-1.0.5.120:dev" // compile "codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev" -- cgit From 1c52a952844381efb16eab551118a35e45745247 Mon Sep 17 00:00:00 2001 From: GWYOG Date: Thu, 10 Nov 2016 13:36:07 +0800 Subject: Make the cycles of the positionedStacks on the gui of GT5's vein plugin sync with each other --- .../gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java index d9085ab82a..4967999870 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -43,9 +43,9 @@ public class PluginGT5VeinStat extends PluginGT5Base { public List getIngredients() { List ingredientsList = new ArrayList(); 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);; + 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); -- cgit From 04473afbe1cbb3ceca2a91dd0f58e4bff783a2bf Mon Sep 17 00:00:00 2001 From: GWYOG Date: Thu, 10 Nov 2016 13:49:52 +0800 Subject: Tweak the String drawn on the gui of GT5's IE Vein plugin --- .../gtneioreplugin/plugin/gregtech5/PluginGT5IEVeinStat.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5IEVeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5IEVeinStat.java index 547c966081..1d73ae5519 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5IEVeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5IEVeinStat.java @@ -55,16 +55,16 @@ public class PluginGT5IEVeinStat extends PluginGT5Base { 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; + int beginXCoord = (stringLength1+stringLength2)/2; GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer.veinName), 2, 18, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.ieVeinComponent") + ": ", 2, 31, 0x404040, false); - GuiDraw.drawString("40%", beginXCoord, 44, 0x404040, false); + GuiDraw.drawStringR("40.00%", beginXCoord+5, 44, 0x404040, false); GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.primaryMeta)), 2+stringLength1, 44, 0x404040, false); - GuiDraw.drawString("40%", beginXCoord, 57, 0x404040, false); + GuiDraw.drawStringR("40.00%", beginXCoord+5, 57, 0x404040, false); GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.secondaryMeta)), 2+stringLength1, 57, 0x404040, false); - GuiDraw.drawString("15%", beginXCoord, 70, 0x404040, false); + GuiDraw.drawStringR("15.00%", beginXCoord+5, 70, 0x404040, false); GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.betweenMeta)), 2+stringLength1, 70, 0x404040, false); - GuiDraw.drawString("5% ", beginXCoord, 83, 0x404040, false); + GuiDraw.drawStringR("5.00%", beginXCoord+5, 83, 0x404040, false); GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.sporadicMeta)), 2+stringLength1, 83, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + oreLayer.weightedIEChance, 2, 96, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.fromMod") + ": " + "Immersive Engineering", 2, 109, 0x404040, false); -- cgit From 5126c8575224171dc8dd156b0be0e551c4cb4c99 Mon Sep 17 00:00:00 2001 From: GWYOG Date: Thu, 10 Nov 2016 14:20:20 +0800 Subject: Create README.MD --- README.MD | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 README.MD diff --git a/README.MD b/README.MD new file mode 100644 index 0000000000..4f39ad8f45 --- /dev/null +++ b/README.MD @@ -0,0 +1,24 @@ +# GT NEI Ore Plugin +This minecraft forge mod is an addon for GregTech5/6 and NEI and is a client-side mod. + +It adds several NEI plugins for GT5/6 which shows the detailed information of GregTech's ore generation. +These plugins are: +* Plugin for vein generation (GT5/6) +* Plugin for asteriod generation (GT5.09+ only) +* Plugin for small ore generation (GT5/6) +* Plugin for Immersive Engineering vein generation (GT5.09.26+ only) +* Plugin for bedrock ore generation (GT6 only). + + +### Download +Currently, this mod is only released on two **Chinese** minecraft forum: [Baidu Post Bar](http://tieba.baidu.com/p/4848951445) and [MCBBS](http://www.mcbbs.net/forum.php?mod=viewthread&tid=646455). +You can find the download link there, or simply download it [here](http://pan.baidu.com/s/1b2mOFW). +This download link is from a Chinese NetDisk FYI. + +### Build +If you want a bleeding-edge version of this mod, you can simply download or clone this repository, establish a folder named "libs" and put the dev build of NEI, GT5, and GT6 in the folder. +Then you can build this mod in the same way as building other mods. i.e. run "gradlew build" command in the CMD window. Then the build can be found in "./build/libs/" folder. + +### License +The whole repository is under [MIT](https://github.com/GWYOG/GTNEIOrePlugin/blob/master/LICENSE) License. +You can feel free to use the mod in your modpacks. If you add my name in your credit list, I'll be super happy with that. -- cgit From ae9af976f01dda2d093400d3b9a56780f90a3fc3 Mon Sep 17 00:00:00 2001 From: GWYOG Date: Thu, 10 Nov 2016 14:21:18 +0800 Subject: Update mod version to 1.0.3 --- build.gradle | 2 +- src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 2 +- src/main/resources/mcmod.info | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 58d091f43a..5f1015786f 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.7.10-1.0.2" +version = "1.7.10-1.0.3" group= "pers.gwyog.gtneioreplugin" archivesBaseName = "gtneioreplugin" diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index a023a21d5b..b309425e64 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -16,7 +16,7 @@ import pers.gwyog.gtneioreplugin.util.GT6OreBedrockHelper; 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.2"; + public static final String VERSION = "1.0.3"; // default is GT5, however it will be "GT6" when GT6 is installed public static String GTVersion = "GT5"; diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 9c54701020..28698f0bbb 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "gtneioreplugin", "name": "GT NEI Ore Plugin", "description": "A forge mod which adds NEI plugins for GregTech5's ores.", - "version": "v1.0.2", + "version": "v1.0.3", "mcversion": "1.7.10", "url": "", "updateUrl": "", -- cgit From 68e4693ddb7d17be4cabb45765b143eca4395a09 Mon Sep 17 00:00:00 2001 From: GWYOG Date: Thu, 10 Nov 2016 16:24:18 +0800 Subject: Fix the localization bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I misunderstood GT6‘s API, it's my own fault. --- .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 1 - .../plugin/gregtech6/PluginGT6Base.java | 35 ++++++++++++++++++++++ .../plugin/gregtech6/PluginGT6BedrockOreStat.java | 11 ++++--- .../plugin/gregtech6/PluginGT6SmallOreStat.java | 5 ++-- .../plugin/gregtech6/PluginGT6VeinStat.java | 11 ++++--- .../gtneioreplugin/util/GT6OreBedrockHelper.java | 20 ------------- .../gtneioreplugin/util/GT6OreLayerHelper.java | 23 +------------- .../gtneioreplugin/util/GT6OreSmallHelper.java | 13 -------- 8 files changed, 48 insertions(+), 71 deletions(-) create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6Base.java diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index b309425e64..b55e57f0a1 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -4,7 +4,6 @@ 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 pers.gwyog.gtneioreplugin.util.GT6OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT6OreSmallHelper; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6Base.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6Base.java new file mode 100644 index 0000000000..f047fbb1ab --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6Base.java @@ -0,0 +1,35 @@ +package pers.gwyog.gtneioreplugin.plugin.gregtech6; + +import gregapi.data.CS; +import gregapi.lang.LanguageHandler; +import net.minecraft.client.resources.I18n; +import pers.gwyog.gtneioreplugin.plugin.PluginBase; + +public class PluginGT6Base extends PluginBase { + + 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.translate("oredict.ore" + CS.BlocksGT.ore.getMetaMaterial(meta).mNameInternal + ".name"); + } + + 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.translate("oredict.oreSmall" + CS.BlocksGT.oreSmall.getMetaMaterial(meta).mNameInternal + ".name"); + } + + 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.translate("oredict.oreBedrock" + CS.BlocksGT.ore.getMetaMaterial(meta).mNameInternal + ".name"); + } + + +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6BedrockOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6BedrockOreStat.java index ce46736597..daad693c56 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6BedrockOreStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6BedrockOreStat.java @@ -11,13 +11,12 @@ 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 PluginGT6BedrockOreStat extends PluginGT6Base { public class CachedBedrockOreStatRecipe extends CachedRecipe { public String oreName; @@ -90,10 +89,10 @@ public class PluginGT6BedrockOreStat extends PluginBase { 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.oreName") + ": " + getLocalizedOreBedrockName(oreLayer.meta), 2, 18, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreOthers") + ": " + getLocalizedSmallOreName(oreLayer.meta), 2, 31, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreOthers") + ": " + getLocalizedOreName(oreLayer.meta), 2, 44, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreOthers") + ": " + getLocalizedSmallOreName(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); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6SmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6SmallOreStat.java index 02f43a02f9..effcb5cc16 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6SmallOreStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6SmallOreStat.java @@ -16,11 +16,10 @@ 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 PluginGT6SmallOreStat extends PluginGT6Base { public class CachedOreSmallRecipe extends CachedRecipe { public String oreGenName; @@ -60,7 +59,7 @@ public class PluginGT6SmallOreStat extends PluginBase { 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.oreName") + ": " + getLocalizedSmallOreName(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); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java index 83ebb1211e..82714dd374 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java @@ -12,11 +12,10 @@ 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 PluginGT6VeinStat extends PluginGT6Base { public class CachedVeinStatRecipe extends CachedRecipe { public String veinName; @@ -108,10 +107,10 @@ public class PluginGT6VeinStat extends PluginBase { 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.primaryOre") + ": " + getLocalizedOreName(oreLayer.primaryMeta), 2, 31, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.secondaryOre") + ": " + getLocalizedOreName(oreLayer.secondaryMeta), 2, 44, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + getLocalizedOreName(oreLayer.betweenMeta), 2, 57, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.sporadicOre") + ": " + getLocalizedOreName(oreLayer.sporadicMeta), 2, 70, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreLayer.worldGenHeightRange, 2, 83, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + oreLayer.weightedChance, 2, 96, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genOverworld, oreLayer.genNether, oreLayer.genEnd, false, false), 2, 109, 0x404040, false); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreBedrockHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreBedrockHelper.java index be95bcc7b3..acae062f7c 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreBedrockHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreBedrockHelper.java @@ -2,18 +2,12 @@ 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 mapOreBedrockWrapper = new HashMap(); - public static HashMap mapMetaToLocalizedName = new HashMap(); public GT6OreBedrockHelper() { for (WorldgenObject worldGenOreBedrock : Worldgenerator.sWorldgenList) @@ -21,14 +15,6 @@ public class GT6OreBedrockHelper { 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; @@ -44,12 +30,6 @@ public class GT6OreBedrockHelper { 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 index ce5da9feb8..70bddee30d 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java @@ -5,21 +5,16 @@ 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 mapOreLayerWrapper = new HashMap(); - public static HashMap mapMetaToLocalizedName = new HashMap(); public static Set setOreNormalBasicTypes = new HashSet(); public GT6OreLayerHelper() { @@ -29,15 +24,7 @@ public class GT6OreLayerHelper { 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; @@ -62,14 +49,6 @@ public class GT6OreLayerHelper { 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 index 33598b0d98..873f049856 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreSmallHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreSmallHelper.java @@ -10,14 +10,11 @@ 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; @@ -26,7 +23,6 @@ public class GT6OreSmallHelper { public static HashMap mapOreSmallWrapper = new HashMap(); public static HashMap mapOreDropUnlocalizedNameToOreMeta = new HashMap(); public static HashMap> mapOreMetaToOreDrops = new HashMap>(); - public static HashMap mapMetaToLocalizedName = new HashMap(); public static Set setOreSmallBasicTypes = new HashSet(); public GT6OreSmallHelper() { @@ -61,7 +57,6 @@ public class GT6OreSmallHelper { oreSmallList.add(new ItemStack(oreSmall, 1, meta)); mapOreMetaToOreDrops.put(meta, stackList); } - mapMetaToLocalizedName.put(meta, getLocalizedSmallOreName(meta)); Set setSmallOreBasicTypesTemp = new HashSet(CS.BlocksGT.stoneToSmallOres.values()); for (IBlockPlacable block: setSmallOreBasicTypesTemp) if (block instanceof PrefixBlock) @@ -69,14 +64,6 @@ public class GT6OreSmallHelper { } } - 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; -- cgit From bb7c413280e2c152fdae6ff188a9c08c56dd2752 Mon Sep 17 00:00:00 2001 From: GWYOG Date: Fri, 31 Mar 2017 15:15:38 +0800 Subject: Fix the weighted chance issue in Vein Stat Plungins Each world (rather than all worlds) should have its own weight chance of veins. --- .../plugin/gregtech5/PluginGT5VeinStat.java | 34 ++++++++++++++++++++-- .../plugin/gregtech6/PluginGT6VeinStat.java | 24 +++++++++++++-- .../gtneioreplugin/util/GT5OreLayerHelper.java | 10 +++++-- .../gtneioreplugin/util/GT6OreLayerHelper.java | 8 +++-- 4 files changed, 68 insertions(+), 8 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java index 4967999870..fd9eb314ad 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -121,8 +121,8 @@ public class PluginGT5VeinStat extends PluginGT5Base { GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + getGTOreLocalizedName(oreLayer.betweenMeta), 2, 57, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.sporadicOre") + ": " + getGTOreLocalizedName(oreLayer.sporadicMeta), 2, 70, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreLayer.worldGenHeightRange, 2, 83, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + oreLayer.weightedChance, 2, 96, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genOverworld, oreLayer.genNether, oreLayer.genEnd, oreLayer.genMoon, oreLayer.genMars), 2, 109, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genOverworld, oreLayer.genNether, oreLayer.genEnd, oreLayer.genMoon, oreLayer.genMars), 2, 96, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + getWeightedChance(oreLayer.randomWeight, oreLayer.genOverworld, oreLayer.genNether, oreLayer.genEnd, oreLayer.genMoon, oreLayer.genMars), 2, 109, 0x404040, false); if (GT5OreLayerHelper.restrictBiomeSupport) GuiDraw.drawString(I18n.format("gtnop.gui.nei.restrictBiome") + ": " + getBiomeTranslated(oreLayer.restrictBiome), 2, 122, 0x404040, false); GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); } @@ -134,6 +134,36 @@ public class PluginGT5VeinStat extends PluginGT5Base { return I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.vein.name"); } + public String getWeightedChance(int randomWeight, boolean genOverworld, boolean genNether, boolean genEnd, boolean genMoon, boolean genMars) { + String weightedChance = ""; + if (genOverworld && GT5OreLayerHelper.weightPerWorld[0] != 0) { + if (!weightedChance.isEmpty()) + weightedChance += ", "; + weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT5OreLayerHelper.weightPerWorld[0]); + } + if (genNether && GT5OreLayerHelper.weightPerWorld[1] != 0) { + if (!weightedChance.isEmpty()) + weightedChance += ", "; + weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT5OreLayerHelper.weightPerWorld[1]); + } + if (genEnd && GT5OreLayerHelper.weightPerWorld[2] != 0) { + if (!weightedChance.isEmpty()) + weightedChance += ", "; + weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT5OreLayerHelper.weightPerWorld[2]); + } + if (genMoon && GT5OreLayerHelper.weightPerWorld[3] != 0) { + if (!weightedChance.isEmpty()) + weightedChance += ", "; + weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT5OreLayerHelper.weightPerWorld[3]); + } + if (genMars && GT5OreLayerHelper.weightPerWorld[4] != 0) { + if (!weightedChance.isEmpty()) + weightedChance += ", "; + weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT5OreLayerHelper.weightPerWorld[4]); + } + return weightedChance; + } + @Override public String getOutputId() { return "GTOrePluginVein"; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java index 82714dd374..88bc814af4 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java @@ -112,8 +112,8 @@ public class PluginGT6VeinStat extends PluginGT6Base { GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + getLocalizedOreName(oreLayer.betweenMeta), 2, 57, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.sporadicOre") + ": " + getLocalizedOreName(oreLayer.sporadicMeta), 2, 70, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreLayer.worldGenHeightRange, 2, 83, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + oreLayer.weightedChance, 2, 96, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genOverworld, oreLayer.genNether, oreLayer.genEnd, false, false), 2, 109, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genOverworld, oreLayer.genNether, oreLayer.genEnd, false, false), 2, 96, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + getWeightedChance(oreLayer.randomWeight, oreLayer.genOverworld, oreLayer.genNether, oreLayer.genEnd), 2, 109, 0x404040, false); GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); } @@ -124,6 +124,26 @@ public class PluginGT6VeinStat extends PluginGT6Base { return I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.vein.name"); } + public String getWeightedChance(int randomWeight, boolean genOverworld, boolean genNether, boolean genEnd) { + String weightedChance = ""; + if (genOverworld && GT6OreLayerHelper.weightPerWorld[0] != 0) { + if (!weightedChance.isEmpty()) + weightedChance += ", "; + weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT6OreLayerHelper.weightPerWorld[0]); + } + if (genNether && GT6OreLayerHelper.weightPerWorld[1] != 0) { + if (!weightedChance.isEmpty()) + weightedChance += ", "; + weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT6OreLayerHelper.weightPerWorld[1]); + } + if (genEnd && GT6OreLayerHelper.weightPerWorld[2] != 0) { + if (!weightedChance.isEmpty()) + weightedChance += ", "; + weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT6OreLayerHelper.weightPerWorld[2]); + } + return weightedChance; + } + @Override public String getOutputId() { return "GTOrePluginVein"; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index 9026aec71d..9991387703 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -21,6 +21,7 @@ public class GT5OreLayerHelper { public static boolean gcBasicSupport = false; public static boolean gcAsteroidSupport = false; public static boolean immersiveEngineeringSupport = false; + public static int[] weightPerWorld = {0, 0, 0, 0, 0}; public static HashMap mapOreLayerWrapper = new HashMap(); public GT5OreLayerHelper() { @@ -82,9 +83,9 @@ public class GT5OreLayerHelper { public short betweenMeta; public short sporadicMeta; public String worldGenHeightRange; - public String weightedChance; public String weightedIEChance; public String restrictBiome; + public int randomWeight; public boolean genOverworld = false; public boolean genNether = false; public boolean genEnd = false; @@ -101,15 +102,20 @@ public class GT5OreLayerHelper { this.betweenMeta = worldGen.mBetweenMeta; this.sporadicMeta = worldGen.mSporadicMeta; this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; - this.weightedChance = String.format("%.2f%%", (100.0f*worldGen.mWeight)/GT_Worldgen_GT_Ore_Layer.sWeight); + this.randomWeight = worldGen.mWeight; this.genOverworld = worldGen.mOverworld; this.genNether = worldGen.mNether; this.genEnd = worldGen.mEnd; + weightPerWorld[0] += this.genOverworld ? this.randomWeight : 0; + weightPerWorld[1] += this.genNether ? this.randomWeight : 0; + weightPerWorld[2] += this.genEnd ? this.randomWeight : 0; if (restrictBiomeSupport) this.restrictBiome = worldGen.mRestrictBiome; if (GT5OreLayerHelper.gcBasicSupport) { this.genMoon = worldGen.mMoon; this.genMars = worldGen.mMars; + weightPerWorld[3] += this.genMoon ? this.randomWeight : 0; + weightPerWorld[4] += this.genMars ? this.randomWeight : 0; } if (GT5OreLayerHelper.endAsteroidSupport) this.genEndAsteroid = worldGen.mEndAsteroid; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java index 70bddee30d..bc0b40f5a1 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java @@ -14,6 +14,7 @@ import net.minecraft.item.ItemStack; import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; public class GT6OreLayerHelper { + public static int[] weightPerWorld = {0, 0, 0}; public static HashMap mapOreLayerWrapper = new HashMap(); public static Set setOreNormalBasicTypes = new HashSet(); @@ -33,7 +34,7 @@ public class GT6OreLayerHelper { public short betweenMeta; public short sporadicMeta; public String worldGenHeightRange; - public String weightedChance; + public int randomWeight; public boolean genOverworld = false; public boolean genNether = false; public boolean genEnd = false; @@ -45,10 +46,13 @@ public class GT6OreLayerHelper { this.betweenMeta = worldGen.mBetweenMeta; this.sporadicMeta = worldGen.mSporadicMeta; this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; - this.weightedChance = String.format("%.2f%%", (100.0f*worldGen.mWeight)/Worldgen_GT_Ore_Layer.sWeight); + this.randomWeight = worldGen.mWeight; this.genOverworld = worldGen.mOverworld; this.genNether = worldGen.mNether; this.genEnd = worldGen.mEnd; + weightPerWorld[0] += this.genOverworld ? this.randomWeight : 0; + weightPerWorld[1] += this.genNether ? this.randomWeight : 0; + weightPerWorld[2] += this.genEnd ? this.randomWeight : 0; } } -- cgit From 04c6336faec2f47d278eeeaa2268cd309b5ccc80 Mon Sep 17 00:00:00 2001 From: GWYOG Date: Fri, 31 Mar 2017 15:16:35 +0800 Subject: Update mod version to 1.0.4 --- build.gradle | 2 +- src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 2 +- src/main/resources/mcmod.info | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 5f1015786f..7e1046fa83 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.7.10-1.0.3" +version = "1.7.10-1.0.4" group= "pers.gwyog.gtneioreplugin" archivesBaseName = "gtneioreplugin" diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index b55e57f0a1..76132661c4 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -15,7 +15,7 @@ import pers.gwyog.gtneioreplugin.util.GT6OreBedrockHelper; 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.3"; + public static final String VERSION = "1.0.4"; // default is GT5, however it will be "GT6" when GT6 is installed public static String GTVersion = "GT5"; diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 28698f0bbb..eaf0e4dd16 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "gtneioreplugin", "name": "GT NEI Ore Plugin", "description": "A forge mod which adds NEI plugins for GregTech5's ores.", - "version": "v1.0.3", + "version": "v1.0.4", "mcversion": "1.7.10", "url": "", "updateUrl": "", -- cgit From 8f927e53cc273603d974d8283d1e08bf0f986523 Mon Sep 17 00:00:00 2001 From: GWYOG Date: Fri, 14 Jul 2017 18:31:59 +0800 Subject: Remove an unused import, close #2 --- src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index 9991387703..80ea571719 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -13,7 +13,6 @@ 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 GT5OreLayerHelper { public static boolean restrictBiomeSupport = false; -- cgit From 2bfa55842458c092acb599fd4876a74386680b0f Mon Sep 17 00:00:00 2001 From: GWYOG Date: Fri, 14 Jul 2017 18:40:45 +0800 Subject: Add the versions of dependency mods in README.md, close #3 --- README.MD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.MD b/README.MD index 4f39ad8f45..fa712c8466 100644 --- a/README.MD +++ b/README.MD @@ -16,7 +16,7 @@ You can find the download link there, or simply download it [here](http://pan.ba This download link is from a Chinese NetDisk FYI. ### Build -If you want a bleeding-edge version of this mod, you can simply download or clone this repository, establish a folder named "libs" and put the dev build of NEI, GT5, and GT6 in the folder. +If you want a bleeding-edge version of this mod, you can simply download or clone this repository, establish a folder named "libs" and put the dev builds of suitable version of NEI(e.g. 1.0.5.120-dev), GT5(e.g. 5.09.28-dev), and GT6(e.g. 6.05.00-dev) in the folder. Then you can build this mod in the same way as building other mods. i.e. run "gradlew build" command in the CMD window. Then the build can be found in "./build/libs/" folder. ### License -- cgit From 9066c13deea8a77c3e4828b4fcddf7cf0a096a74 Mon Sep 17 00:00:00 2001 From: LOKKO12 <33183715+LOKKO12@users.noreply.github.com> Date: Mon, 22 Jan 2018 18:56:12 +0100 Subject: - removed GT6 support - removed IE support - removed biome specific vein support - removed ShowAll button due to Memory Issures - fixed %material - try to read out config without modifying it - added Coustom Vein renamer --- .gitignore | 31 ++++ build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 6 + .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 19 +-- .../gtneioreplugin/plugin/NEIPluginConfig.java | 29 +--- .../gwyog/gtneioreplugin/plugin/PluginBase.java | 28 +--- .../plugin/gregtech5/PluginGT5AsteroidStat.java | 29 ++-- .../plugin/gregtech5/PluginGT5Base.java | 3 +- .../plugin/gregtech5/PluginGT5IEVeinStat.java | 133 ----------------- .../plugin/gregtech5/PluginGT5SmallOreStat.java | 4 +- .../plugin/gregtech5/PluginGT5VeinStat.java | 111 +++++++++------ .../plugin/gregtech6/PluginGT6Base.java | 35 ----- .../plugin/gregtech6/PluginGT6BedrockOreStat.java | 113 --------------- .../plugin/gregtech6/PluginGT6SmallOreStat.java | 138 ------------------ .../plugin/gregtech6/PluginGT6VeinStat.java | 157 --------------------- .../gwyog/gtneioreplugin/util/DimensionHelper.java | 81 +++++++++++ .../gwyog/gtneioreplugin/util/GT5CFGHelper.java | 109 ++++++++++++++ .../gtneioreplugin/util/GT5OreLayerHelper.java | 109 ++------------ .../gtneioreplugin/util/GT5OreSmallHelper.java | 11 +- .../gtneioreplugin/util/GT6OreBedrockHelper.java | 36 ----- .../gtneioreplugin/util/GT6OreLayerHelper.java | 59 -------- .../gtneioreplugin/util/GT6OreSmallHelper.java | 87 ------------ .../assets/gtneioreplugin/lang/en_US.lang | 5 - src/main/resources/mcmod.info | 8 +- 24 files changed, 343 insertions(+), 1000 deletions(-) create mode 100644 .gitignore create mode 100644 gradle/wrapper/gradle-wrapper.properties delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5IEVeinStat.java delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6Base.java delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6BedrockOreStat.java delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6SmallOreStat.java delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreBedrockHelper.java delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreSmallHelper.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..dca47ebd18 --- /dev/null +++ b/.gitignore @@ -0,0 +1,31 @@ +.git/ +.gradle/ +.settings/ +build/ +bin/ +eclipse/ +.classpath +.project + +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* diff --git a/build.gradle b/build.gradle index 7e1046fa83..f98f821268 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.7.10-1.0.4" +version = "1.7.10-1.0.4-GT-NH" group= "pers.gwyog.gtneioreplugin" archivesBaseName = "gtneioreplugin" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..678d9d8de3 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Jul 02 15:54:47 CDT 2014 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index 76132661c4..fd0e6710b5 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -5,19 +5,15 @@ 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.relauncher.Side; -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 { public static final String MODID = "gtneioreplugin"; - public static final String NAME = "GT NEI Ore Plugin"; - public static final String VERSION = "1.0.4"; + public static final String NAME = "GT NEI Ore Plugin GT:NH Mod"; + public static final String VERSION = "1.0.4-GTNH"; - // default is GT5, however it will be "GT6" when GT6 is installed public static String GTVersion = "GT5"; @Mod.Instance(MODID) @@ -26,20 +22,9 @@ public class GTNEIOrePlugin { @EventHandler public void onLoadComplete(FMLLoadCompleteEvent event) { if (event.getSide() == Side.CLIENT) { - 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 76cd9c4d18..d2cc0933d0 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java @@ -4,13 +4,9 @@ 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.plugin.gregtech5.PluginGT5AsteroidStat; -import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5IEVeinStat; +//import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5AsteroidStat; 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 { @@ -29,31 +25,14 @@ public class NEIPluginConfig implements IConfigureNEI { public void loadConfig() { if (GTNEIOrePlugin.GTVersion.equals("GT5")) { PluginGT5VeinStat pluginVeinStat = new PluginGT5VeinStat(); - PluginGT5AsteroidStat pluginAsteriodStat = new PluginGT5AsteroidStat(); + //PluginGT5AsteroidStat pluginAsteriodStat = new PluginGT5AsteroidStat(); PluginGT5SmallOreStat pluginSmallOreStat = new PluginGT5SmallOreStat(); API.registerRecipeHandler(pluginVeinStat); API.registerUsageHandler(pluginVeinStat); - API.registerRecipeHandler(pluginAsteriodStat); - API.registerUsageHandler(pluginAsteriodStat); + //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 a554cf5f46..11b1b925f2 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java @@ -34,38 +34,14 @@ public class PluginBase extends TemplateRecipeHandler { public String getOutputId() { return null; } - - public String getBiomeTranslated(String unlocalizedBiome) { - return unlocalizedBiome.equals("None")? I18n.format("gtnop.biome.none.name"): unlocalizedBiome; - } - - public String getWorldNameTranslated(boolean genOverworld, boolean genNether, boolean genEnd, boolean genMoon, boolean genMars) { + + public String getWorldNameTranslated(boolean genOverworld) { String worldNameTranslated = ""; if (genOverworld) { if (!worldNameTranslated.isEmpty()) worldNameTranslated += ", "; worldNameTranslated += I18n.format("gtnop.world.overworld.name"); } - if (genNether) { - if (!worldNameTranslated.isEmpty()) - worldNameTranslated += ", "; - worldNameTranslated += I18n.format("gtnop.world.nether.name"); - } - if (genEnd) { - if (!worldNameTranslated.isEmpty()) - worldNameTranslated += ", "; - worldNameTranslated += I18n.format("gtnop.world.end.name"); - } - if (genMoon) { - if (!worldNameTranslated.isEmpty()) - worldNameTranslated += ", "; - worldNameTranslated += I18n.format("gtnop.world.moon.name"); - } - if (genMars) { - if (!worldNameTranslated.isEmpty()) - worldNameTranslated += ", "; - worldNameTranslated += I18n.format("gtnop.world.mars.name"); - } return worldNameTranslated; } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5AsteroidStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5AsteroidStat.java index 48e51a5367..b6c676dc70 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5AsteroidStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5AsteroidStat.java @@ -1,4 +1,4 @@ -package pers.gwyog.gtneioreplugin.plugin.gregtech5; +/*package pers.gwyog.gtneioreplugin.plugin.gregtech5; import java.awt.Rectangle; import java.util.ArrayList; @@ -57,10 +57,10 @@ public class PluginGT5AsteroidStat extends PluginGT5Base { CachedAsteroidStatRecipe crecipe = (CachedAsteroidStatRecipe) this.arecipes.get(recipe); 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); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidBetween") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.betweenMeta)), 2, 57, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSporadic") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.sporadicMeta)), 2, 70, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidPrimary") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.Meta[0])), 2, 31, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSecondary") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.Meta[1])), 2, 44, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidBetween") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.Meta[2])), 2, 57, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSporadic") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.Meta[3])), 2, 70, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genEndAsteroid, oreLayer.genGCAsteroid), 2, 83, 0x404040, false); GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); } @@ -94,10 +94,10 @@ public class PluginGT5AsteroidStat extends PluginGT5Base { 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); - ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.betweenMeta+2000); - ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.sporadicMeta+2000); + ItemStack stackPrimary = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[0]+2000); + ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[1]+2000); + ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[2]+2000); + ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[3]+2000); this.arecipes.add(new CachedAsteroidStatRecipe(veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); } } @@ -115,12 +115,12 @@ public class PluginGT5AsteroidStat extends PluginGT5Base { } short baseMeta = (short)(stack.getItemDamage() % 1000); for (OreLayerWrapper worldGen: GT5OreLayerHelper.mapOreLayerWrapper.values()) { - if (worldGen.primaryMeta == baseMeta || worldGen.secondaryMeta == baseMeta || worldGen.betweenMeta == baseMeta || worldGen.sporadicMeta == baseMeta) { + if (worldGen.Meta[0] == baseMeta || worldGen.Meta[1] == baseMeta || worldGen.Meta[2] == baseMeta || worldGen.Meta[3] == 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); + ItemStack stackPrimary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[0]+2000); + ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[1]+2000); + ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[2]+2000); + ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[3]+2000); this.arecipes.add(new CachedAsteroidStatRecipe(worldGen.veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); } } @@ -140,3 +140,4 @@ public class PluginGT5AsteroidStat extends PluginGT5Base { return I18n.format("gtnop.gui.asteroidStat.name"); } } +*/ \ No newline at end of file diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java index a61a8bb977..1a251ef514 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java @@ -5,6 +5,7 @@ import java.awt.Rectangle; import codechicken.lib.gui.GuiDraw; import codechicken.nei.recipe.TemplateRecipeHandler; import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRect; +import gregtech.api.enums.Materials; import gregtech.api.util.GT_LanguageManager; import net.minecraft.client.resources.I18n; import net.minecraft.util.EnumChatFormatting; @@ -23,7 +24,7 @@ public class PluginGT5Base extends PluginBase { } public String getGTOreLocalizedName(short index) { - return GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)); + return Materials.getLocalizedNameForItem(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)), index%1000); } public String getGTOreUnlocalizedName(short index) { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5IEVeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5IEVeinStat.java deleted file mode 100644 index 1d73ae5519..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5IEVeinStat.java +++ /dev/null @@ -1,133 +0,0 @@ -package pers.gwyog.gtneioreplugin.plugin.gregtech5; - -import java.util.ArrayList; -import java.util.List; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.TemplateRecipeHandler.CachedRecipe; -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.util.GT5OreLayerHelper; -import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; - -public class PluginGT5IEVeinStat extends PluginGT5Base { - - public class CachedIEVeinStatRecipe extends CachedRecipe { - public String veinName; - public PositionedStack positionedStackPrimary; - public PositionedStack positionedStackSecondary; - public PositionedStack positionedStackBetween; - public PositionedStack positionedStackSporadic; - - public CachedIEVeinStatRecipe(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 getIngredients() { - List ingredientsList = new ArrayList(); - 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) { - CachedIEVeinStatRecipe crecipe = (CachedIEVeinStatRecipe) this.arecipes.get(recipe); - 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; - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer.veinName), 2, 18, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.ieVeinComponent") + ": ", 2, 31, 0x404040, false); - GuiDraw.drawStringR("40.00%", beginXCoord+5, 44, 0x404040, false); - GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.primaryMeta)), 2+stringLength1, 44, 0x404040, false); - GuiDraw.drawStringR("40.00%", beginXCoord+5, 57, 0x404040, false); - GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.secondaryMeta)), 2+stringLength1, 57, 0x404040, false); - GuiDraw.drawStringR("15.00%", beginXCoord+5, 70, 0x404040, false); - GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.betweenMeta)), 2+stringLength1, 70, 0x404040, false); - GuiDraw.drawStringR("5.00%", beginXCoord+5, 83, 0x404040, false); - GuiDraw.drawString(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.sporadicMeta)), 2+stringLength1, 83, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + oreLayer.weightedIEChance, 2, 96, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.fromMod") + ": " + "Immersive Engineering", 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 void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals(getOutputId())) { - OreLayerWrapper oreLayerWrapper; - 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); - ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.betweenMeta); - ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.sporadicMeta); - this.arecipes.add(new CachedIEVeinStatRecipe(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: 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); - ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.secondaryMeta); - ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.betweenMeta); - ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.sporadicMeta); - this.arecipes.add(new CachedIEVeinStatRecipe(worldGen.veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); - } - } - } - } - else - super.loadCraftingRecipes(stack); - } - - @Override - public String getOutputId() { - return "GTOrePluginIEVeinCompat"; - } - - @Override - public String getRecipeName() { - return I18n.format("gtnop.gui.ieVeinStat.name"); - } -} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java index f1ddce6629..66ede68225 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java @@ -64,8 +64,8 @@ public class PluginGT5SmallOreStat extends PluginGT5Base { 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.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); } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java index fd9eb314ad..fd17e810b9 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -1,16 +1,19 @@ package pers.gwyog.gtneioreplugin.plugin.gregtech5; import java.awt.Rectangle; +import java.io.File; +import java.io.IOException; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; - -import org.apache.http.impl.conn.tsccm.ConnPoolByRoute; +import java.util.Set; 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.enums.Materials; import gregtech.api.util.GT_LanguageManager; import gregtech.common.GT_Worldgen_GT_Ore_Layer; import net.minecraft.client.gui.Gui; @@ -18,6 +21,8 @@ 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.DimensionHelper; +import pers.gwyog.gtneioreplugin.util.GT5CFGHelper; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; @@ -71,10 +76,10 @@ public class PluginGT5VeinStat extends PluginGT5Base { List stackListBetween = new ArrayList(); List stackListSporadic = new ArrayList(); 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)); + stackListPrimary.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[0]+i*1000)); + stackListSecondary.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[1]+i*1000)); + stackListBetween.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[2]+i*1000)); + stackListSporadic.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[3]+i*1000)); } this.arecipes.add(new CachedVeinStatRecipe(veinName, stackListPrimary, stackListSecondary, stackListBetween, stackListSporadic)); } @@ -92,16 +97,16 @@ public class PluginGT5VeinStat extends PluginGT5Base { } short baseMeta = (short)(stack.getItemDamage() % 1000); for (OreLayerWrapper worldGen: GT5OreLayerHelper.mapOreLayerWrapper.values()) { - if (worldGen.primaryMeta == baseMeta || worldGen.secondaryMeta == baseMeta || worldGen.betweenMeta == baseMeta || worldGen.sporadicMeta == baseMeta) { + if (worldGen.Meta[0] == baseMeta || worldGen.Meta[1] == baseMeta || worldGen.Meta[2] == baseMeta || worldGen.Meta[3] == baseMeta) { List stackListPrimary = new ArrayList(); List stackListSecondary = new ArrayList(); List stackListBetween = new ArrayList(); List stackListSporadic = new ArrayList(); for (int i=0;i20) { + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer).substring(0, 20), 2, 20, 0x404040, false); + if (getLocalizedVeinName(oreLayer).length()>40) { + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer).substring(20, 40), 2, 30, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer).substring(40, getLocalizedVeinName(oreLayer).length()), 2, 40, 0x404040, false); + } + else + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer).substring(20, getLocalizedVeinName(oreLayer).length()), 2, 30, 0x404040, false); + } + else + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer), 2, 20, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.primaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]), 2, 50, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.secondaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[1]), 2, 60, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[2]), 2, 70, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.sporadicOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[3]), 2, 80, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreLayer.worldGenHeightRange, 2, 90, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 100, 0x404040, false); + GuiDraw.drawString(I18n.format("") + getDims(oreLayer), 2, 110, 0x404040, false); + // GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + getWeightedChance(oreLayer), 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); } - public String getLocalizedVeinName(String unlocalizedName) { + public String getLocalizedVeinName(OreLayerWrapper oreLayer) { + + String unlocalizedName = oreLayer.veinName; if (unlocalizedName.startsWith("ore.mix.custom.")) - return I18n.format("gtnop.ore.custom.name") + I18n.format("gtnop.ore.vein.name") + unlocalizedName.substring(15); + return I18n.format(coustomVeinRenamer(oreLayer));//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"); } - public String getWeightedChance(int randomWeight, boolean genOverworld, boolean genNether, boolean genEnd, boolean genMoon, boolean genMars) { + public String coustomVeinRenamer(OreLayerWrapper oreLayer) { + Set s = new HashSet(); + for (int i=0; i < 4; i++) + s.add(getGTOreLocalizedName(oreLayer.Meta[i]).replaceAll(" ", "")); + return s.toString() + .replace("[".charAt(0), ",".charAt(0)) + .replace("]".charAt(0), ",".charAt(0)) + .replaceAll(" Ore", ",") + .replaceAll("Ore", ",") + .replaceAll(",","") + .trim() + .concat(" Vein"); + } + + /*public String getWeightedChance(OreLayerWrapper oreLayer) { String weightedChance = ""; - if (genOverworld && GT5OreLayerHelper.weightPerWorld[0] != 0) { + for (int i=0; i < oreLayer.alloweddims.size(); i++) { + if (oreLayer.alloweddims.get(i) && (oreLayer.Weight.get(i) != 0)) { if (!weightedChance.isEmpty()) weightedChance += ", "; - weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT5OreLayerHelper.weightPerWorld[0]); + weightedChance += String.format("%.2f%%", (100.0f*oreLayer.Weight.get(i))/GT5OreLayerHelper.weightPerWorld[i]); } - if (genNether && GT5OreLayerHelper.weightPerWorld[1] != 0) { - if (!weightedChance.isEmpty()) - weightedChance += ", "; - weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT5OreLayerHelper.weightPerWorld[1]); - } - if (genEnd && GT5OreLayerHelper.weightPerWorld[2] != 0) { - if (!weightedChance.isEmpty()) - weightedChance += ", "; - weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT5OreLayerHelper.weightPerWorld[2]); - } - if (genMoon && GT5OreLayerHelper.weightPerWorld[3] != 0) { - if (!weightedChance.isEmpty()) - weightedChance += ", "; - weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT5OreLayerHelper.weightPerWorld[3]); - } - if (genMars && GT5OreLayerHelper.weightPerWorld[4] != 0) { - if (!weightedChance.isEmpty()) - weightedChance += ", "; - weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT5OreLayerHelper.weightPerWorld[4]); } return weightedChance; + }*/ + + public String getDims(OreLayerWrapper oreLayer) { + return GT5CFGHelper.GT5CFG(GregTech_API.sWorldgenFile.mConfig.getConfigFile(), oreLayer.veinName.replace("ore.mix.custom.", "").replace("ore.mix.", "")); } @Override diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6Base.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6Base.java deleted file mode 100644 index f047fbb1ab..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6Base.java +++ /dev/null @@ -1,35 +0,0 @@ -package pers.gwyog.gtneioreplugin.plugin.gregtech6; - -import gregapi.data.CS; -import gregapi.lang.LanguageHandler; -import net.minecraft.client.resources.I18n; -import pers.gwyog.gtneioreplugin.plugin.PluginBase; - -public class PluginGT6Base extends PluginBase { - - 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.translate("oredict.ore" + CS.BlocksGT.ore.getMetaMaterial(meta).mNameInternal + ".name"); - } - - 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.translate("oredict.oreSmall" + CS.BlocksGT.oreSmall.getMetaMaterial(meta).mNameInternal + ".name"); - } - - 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.translate("oredict.oreBedrock" + CS.BlocksGT.ore.getMetaMaterial(meta).mNameInternal + ".name"); - } - - -} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6BedrockOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6BedrockOreStat.java deleted file mode 100644 index daad693c56..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6BedrockOreStat.java +++ /dev/null @@ -1,113 +0,0 @@ -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.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 PluginGT6Base { - - 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 stackListOre, List 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 getIngredients() { - List ingredientsList = new ArrayList(); - 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 stackListOre = new ArrayList(); - List stackListOreSmall = new ArrayList(); - 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") + ": " + getLocalizedOreBedrockName(oreLayer.meta), 2, 18, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreOthers") + ": " + getLocalizedSmallOreName(oreLayer.meta), 2, 31, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreOthers") + ": " + getLocalizedOreName(oreLayer.meta), 2, 44, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreOthers") + ": " + getLocalizedSmallOreName(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 deleted file mode 100644 index effcb5cc16..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6SmallOreStat.java +++ /dev/null @@ -1,138 +0,0 @@ -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.util.GT6OreSmallHelper; -import pers.gwyog.gtneioreplugin.util.GT6OreSmallHelper.OreSmallWrapper; - -public class PluginGT6SmallOreStat extends PluginGT6Base { - - public class CachedOreSmallRecipe extends CachedRecipe { - public String oreGenName; - public PositionedStack positionedStackOreSmall; - public PositionedStack positionedStackMaterialDust; - public List positionedDropStackList; - - public CachedOreSmallRecipe(String oreGenName, List stackList, List materialDustStackList, List dropStackList) { - this.oreGenName = oreGenName; - this.positionedStackOreSmall = new PositionedStack(stackList, 2, 0); - this.positionedStackMaterialDust = new PositionedStack(materialDustStackList, 43, 67); - List positionedDropStackList = new ArrayList(); - 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 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") + ": " + getLocalizedSmallOreName(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 stackList = new ArrayList(); - List materialDustStackList = new ArrayList(); - 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 stackList = new ArrayList(); - List materialDustStackList = new ArrayList(); - 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 deleted file mode 100644 index 88bc814af4..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech6/PluginGT6VeinStat.java +++ /dev/null @@ -1,157 +0,0 @@ -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.util.GT6OreLayerHelper; -import pers.gwyog.gtneioreplugin.util.GT6OreLayerHelper.OreLayerWrapper; - -public class PluginGT6VeinStat extends PluginGT6Base { - - 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 stackListPrimary, List stackListSecondary, - List stackListBetween, List 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 getIngredients() { - List ingredientsList = new ArrayList(); - 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 stackListPrimary = new ArrayList(); - List stackListSecondary = new ArrayList(); - List stackListBetween = new ArrayList(); - List stackListSporadic = new ArrayList(); - 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 stackListPrimary = new ArrayList(); - List stackListSecondary = new ArrayList(); - List stackListBetween = new ArrayList(); - List stackListSporadic = new ArrayList(); - 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") + ": " + getLocalizedOreName(oreLayer.primaryMeta), 2, 31, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.secondaryOre") + ": " + getLocalizedOreName(oreLayer.secondaryMeta), 2, 44, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + getLocalizedOreName(oreLayer.betweenMeta), 2, 57, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.sporadicOre") + ": " + getLocalizedOreName(oreLayer.sporadicMeta), 2, 70, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreLayer.worldGenHeightRange, 2, 83, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genOverworld, oreLayer.genNether, oreLayer.genEnd, false, false), 2, 96, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + getWeightedChance(oreLayer.randomWeight, oreLayer.genOverworld, oreLayer.genNether, oreLayer.genEnd), 2, 109, 0x404040, false); - GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); - } - - 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"); - } - - public String getWeightedChance(int randomWeight, boolean genOverworld, boolean genNether, boolean genEnd) { - String weightedChance = ""; - if (genOverworld && GT6OreLayerHelper.weightPerWorld[0] != 0) { - if (!weightedChance.isEmpty()) - weightedChance += ", "; - weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT6OreLayerHelper.weightPerWorld[0]); - } - if (genNether && GT6OreLayerHelper.weightPerWorld[1] != 0) { - if (!weightedChance.isEmpty()) - weightedChance += ", "; - weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT6OreLayerHelper.weightPerWorld[1]); - } - if (genEnd && GT6OreLayerHelper.weightPerWorld[2] != 0) { - if (!weightedChance.isEmpty()) - weightedChance += ", "; - weightedChance += String.format("%.2f%%", (100.0f*randomWeight)/GT6OreLayerHelper.weightPerWorld[2]); - } - return weightedChance; - } - - @Override - public String getOutputId() { - return "GTOrePluginVein"; - } - - @Override - public String getRecipeName() { - return I18n.format("gtnop.gui.veinStat.name"); - } - -} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java new file mode 100644 index 0000000000..d68dd65d69 --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -0,0 +1,81 @@ +package pers.gwyog.gtneioreplugin.util; + +import net.minecraft.world.World; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.WorldServer; +import net.minecraftforge.common.DimensionManager; + +public class DimensionHelper { + + public static String[] DimName = + { + "EndAsteroid", + "GalacticraftCore_Moon", + "GalacticraftMars_Asteroids", + "GalacticraftMars_Mars", + "GalaxySpace_BarnardC", + "GalaxySpace_BarnardE", + "GalaxySpace_BarnardF", + "GalaxySpace_Callisto", + "GalaxySpace_CentauriA", + "GalaxySpace_Ceres", + "GalaxySpace_Deimos", + "GalaxySpace_Enceladus", + "GalaxySpace_Europa", + "GalaxySpace_Ganymede", + "GalaxySpace_Haumea", + "GalaxySpace_Io", + "GalaxySpace_Kuiperbelt", + "GalaxySpace_MakeMake", + "GalaxySpace_Mercury", + "GalaxySpace_Miranda", + "GalaxySpace_Oberon", + "GalaxySpace_Phobos", + "GalaxySpace_Pluto", + "GalaxySpace_Proteus", + "GalaxySpace_TcetiE", + "GalaxySpace_Titan", + "GalaxySpace_Triton", + "GalaxySpace_VegaB", + "GalaxySpace_Venus", + "Nether", + "Overworld", + "TheEnd", + "Vanilla_EndAsteroids"}; + + public static String[] DimNameDisplayed = + { + "End Asteroids", + "Moon", + "Asteroids", + "Mars", + "BarnardC", + "BarnardE", + "BarnardF", + "Callisto", + "CentauriA", + "Ceres", + "Deimos", + "Enceladus", + "Europa", + "Ganymede", + "Haumea", + "Io", + "Kuiperbelt", + "MakeMake", + "Mercury", + "Miranda", + "Oberon", + "Phobos", + "Pluto", + "Proteus", + "TcetiE", + "Titan", + "Triton", + "VegaB", + "Venus", + "The Nether", + "Overworld", + "The End", + "Far End Asteroids"}; +} \ No newline at end of file diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java new file mode 100644 index 0000000000..b5fd6ad6e5 --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java @@ -0,0 +1,109 @@ +package pers.gwyog.gtneioreplugin.util; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; + +import cpw.mods.fml.common.FMLLog; + + +public class GT5CFGHelper { + + public static String GT5CFG(File F, String Veinname) { + //FMLLog.info(Veinname); + if (F == null) { + FMLLog.bigWarning("GT_CFG_NOT_FOUND"); + return "Error while Loading CFG"; + } + else + try { + int buffer = (int) (0.1*Runtime.getRuntime().freeMemory()); + if (buffer > F.length()) + buffer = (int) F.length(); + //allocate 10% of free memory for read-in-buffer, if there is less than filesize memory aviable + //FMLLog.info("GT_CFG_FOUND"); + FileReader in = new FileReader(F); + //FMLLog.info("FileReader created"); + BufferedReader reader = new BufferedReader(in, buffer); + //FMLLog.info("BufferedReader" +Integer.toString(buffer)+"created"); + String st=""; + List raw= new ArrayList(); + List rawbools = new ArrayList(); + boolean found = false; + + do{ + //read until reached eof or mix { + st = reader.readLine(); + //FMLLog.info("st: "+st); + if ((reader.readLine() != null)) + if (st.contains("mix {")) { + do{ + //read until reached eof or Veinname { + st = reader.readLine(); + //FMLLog.info("MIXst: "+st); + if ((reader.readLine() != null)) + if (st.contains(Veinname)) { + //FMLLog.info("VEINNAMEst: "+st); + //for (int i=0; i < 44;i++) + do{ + //add everything below Veinname { undtil } to raw + raw.add(reader.readLine()); + }while (!reader.readLine().contains("}")&&(reader.readLine() != null)); + found = true; + } + }while((!found) || (reader.readLine() != null)); + } + }while((!found) || (reader.readLine() != null)); + + reader.close();//not needed anymore + + if (!raw.isEmpty()) + for (int i=0; i < raw.size();i++) { + //filter needed booleans from raw + ///FMLLog.info("raw contains"+raw.get(i)); + for (int j=0; j < DimensionHelper.DimName.length;j++) + if(raw.get(i).contains(DimensionHelper.DimName[j])) + rawbools.add(raw.get(i)); + //FMLLog.info("rawbools: "+rawbools.get(i)); + } + else FMLLog.info("raw is empty"); + + String ret=" "; + + //HashSet rawboolsset = new HashSet(); + if (!rawbools.isEmpty()) { + //remove dublicats + /* + for (int i=0; i < rawbools.size();i++){ + st = rawbools.get(i).replace("B:", "").replace("_true", "").replace("_false", "").replaceAll(" ", ""); + rawboolsset.add(st); + } + rawbools = new ArrayList(rawboolsset); + */ + //filter for dims set to true + for (int i=0; i < rawbools.size();i++) { + st = rawbools.get(i); + //FMLLog.info("RawBools:"+st); + for (int j=0; j < DimensionHelper.DimName.length;j++) { + if(st.contains(DimensionHelper.DimName[j])) + if(st.contains("=true")) + ret=(ret+DimensionHelper.DimNameDisplayed[j]+" "); + } + } + } + ret = ret.trim(); + //FMLLog.info("ret:"+ret); + if(ret.equals("")||ret.equals(" ")) + ret ="Not aviable in any Galactic Dim, maybe Deep Dark or Bedrock Dim"; + return ret; + } catch (IOException e) { + e.printStackTrace(); + return "Error while Loading CFG"; + } + } +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index 80ea571719..9c94bf0029 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -15,119 +15,38 @@ import net.minecraft.item.ItemStack; import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; public class GT5OreLayerHelper { - public static boolean restrictBiomeSupport = false; - public static boolean endAsteroidSupport = false; - public static boolean gcBasicSupport = false; - public static boolean gcAsteroidSupport = false; - public static boolean immersiveEngineeringSupport = false; - public static int[] weightPerWorld = {0, 0, 0, 0, 0}; + + public static Integer weightPerWorld[] = new Integer[33]; + public static Integer DimIDs[] = new Integer[33]; public static HashMap mapOreLayerWrapper = new HashMap(); public GT5OreLayerHelper() { - checkExtraSupport(); + for (int i=0; i < DimIDs.length;i++) + weightPerWorld[i]=0; + for (int i=0; i < DimIDs.length;i++) + DimIDs[i]=0; for (GT_Worldgen_GT_Ore_Layer tWorldGen: GT_Worldgen_GT_Ore_Layer.sList) mapOreLayerWrapper.put(tWorldGen.mWorldGenName, new OreLayerWrapper(tWorldGen)); } - private static void checkExtraSupport() { - Class clazzGTOreLayer = null; - try { - clazzGTOreLayer = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_Layer"); - } catch (ClassNotFoundException e) {} - if (clazzGTOreLayer != null) { - try { - Field fieldRestrictBiome = clazzGTOreLayer.getField("mRestrictBiome"); - restrictBiomeSupport = true; - } catch (Exception e) {} - try { - Field fieldEndAsteroid = clazzGTOreLayer.getField("mEndAsteroid"); - endAsteroidSupport = true; - } catch (Exception e) {} - try { - Field fieldGCMoon = clazzGTOreLayer.getField("mMoon"); - Field fieldGCMars = clazzGTOreLayer.getField("mMars"); - gcBasicSupport = true; - } catch (Exception e) {} - try { - Field fieldGCAsteroid = clazzGTOreLayer.getField("mAsteroid"); - gcAsteroidSupport = true; - } catch (Exception e) {} - } - - // immersive engineering support for GT5.09.25+ - if (Loader.instance().isModLoaded("ImmersiveEngineering")) { - Class clazzGTMod = null; - Class clazzGTProxy = null; - Class clazzGTAPI = null; - try { - clazzGTMod = Class.forName("gregtech.GT_Mod"); - clazzGTProxy = Class.forName("gregtech.common.GT_Proxy"); - clazzGTAPI = Class.forName("gregtech.api.GregTech_API"); - } catch (ClassNotFoundException e) {} - if (clazzGTMod!=null && clazzGTProxy!=null && clazzGTAPI!=null) { - try { - Field fieldImmersiveEngineeringRecipes = clazzGTAPI.getField("mImmersiveEngineering"); - Field fieldGTProxy = clazzGTMod.getField("gregtechproxy"); - Field fieldImmersiveEngineering = clazzGTProxy.getField("mImmersiveEngineeringRecipes"); - immersiveEngineeringSupport = GregTech_API.mImmersiveEngineering && GT_Mod.gregtechproxy.mImmersiveEngineeringRecipes; - } catch (Exception e) {} - } - } - } - public class OreLayerWrapper { public String veinName; - public short primaryMeta; - public short secondaryMeta; - public short betweenMeta; - public short sporadicMeta; + public short[] Meta = new short[4]; public String worldGenHeightRange; public String weightedIEChance; - public String restrictBiome; public int randomWeight; - 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 boolean genIEVein = false; + public List Weight = new ArrayList(); 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.Meta[0] = worldGen.mPrimaryMeta; + this.Meta[1] = worldGen.mSecondaryMeta; + this.Meta[2] = worldGen.mBetweenMeta; + this.Meta[3] = worldGen.mSporadicMeta; this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; this.randomWeight = worldGen.mWeight; - this.genOverworld = worldGen.mOverworld; - this.genNether = worldGen.mNether; - this.genEnd = worldGen.mEnd; - weightPerWorld[0] += this.genOverworld ? this.randomWeight : 0; - weightPerWorld[1] += this.genNether ? this.randomWeight : 0; - weightPerWorld[2] += this.genEnd ? this.randomWeight : 0; - if (restrictBiomeSupport) - this.restrictBiome = worldGen.mRestrictBiome; - if (GT5OreLayerHelper.gcBasicSupport) { - this.genMoon = worldGen.mMoon; - this.genMars = worldGen.mMars; - weightPerWorld[3] += this.genMoon ? this.randomWeight : 0; - weightPerWorld[4] += this.genMars ? this.randomWeight : 0; - } - if (GT5OreLayerHelper.endAsteroidSupport) - this.genEndAsteroid = worldGen.mEndAsteroid; - if (GT5OreLayerHelper.gcAsteroidSupport) - this.genGCAsteroid = worldGen.mAsteroid; - - // immersive engineering support for GT5.09.25+ - if (immersiveEngineeringSupport) { - this.genIEVein = true; - this.weightedIEChance = String.format("%.3f%%", (100.0f*worldGen.mWeight)/GT_Worldgen_GT_Ore_Layer.sWeight/8); } } } - -} + \ No newline at end of file diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java index 69311a83ee..4326475606 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java @@ -100,12 +100,11 @@ public class GT5OreSmallHelper { this.genOverworld = worldGen.mOverworld; this.genNether = worldGen.mNether; this.genEnd = worldGen.mEnd; - if (GT5OreSmallHelper.restrictBiomeSupport) - this.restrictBiome = worldGen.mRestrictBiome; - if (GT5OreSmallHelper.gcBasicSupport) { - this.genMoon = worldGen.mMoon; - this.genMars = worldGen.mMars; + //if (GT5OreSmallHelper.restrictBiomeSupport) + // this.restrictBiome = worldGen.mRestrictBiome; + // 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 deleted file mode 100644 index acae062f7c..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreBedrockHelper.java +++ /dev/null @@ -1,36 +0,0 @@ -package pers.gwyog.gtneioreplugin.util; - -import java.util.HashMap; - -import gregapi.worldgen.WorldgenObject; -import gregapi.worldgen.Worldgen_GT_Ore_Bedrock; -import gregapi.worldgen.Worldgenerator; - -public class GT6OreBedrockHelper { - public static HashMap mapOreBedrockWrapper = new HashMap(); - - 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 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; - } - } - -} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java deleted file mode 100644 index bc0b40f5a1..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreLayerHelper.java +++ /dev/null @@ -1,59 +0,0 @@ -package pers.gwyog.gtneioreplugin.util; - -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Set; - -import gregapi.block.IBlockPlacable; -import gregapi.block.prefixblock.PrefixBlock; -import gregapi.data.CS; -import gregapi.worldgen.Worldgen_GT_Ore_Layer; -import gregtech.GT_Mod; -import net.minecraft.item.ItemStack; -import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; - -public class GT6OreLayerHelper { - public static int[] weightPerWorld = {0, 0, 0}; - public static HashMap mapOreLayerWrapper = new HashMap(); - public static Set setOreNormalBasicTypes = new HashSet(); - - public GT6OreLayerHelper() { - for (Worldgen_GT_Ore_Layer tWorldGen: Worldgen_GT_Ore_Layer.sList) - mapOreLayerWrapper.put(tWorldGen.mWorldGenName, new OreLayerWrapper(tWorldGen)); - Set setNormalOreBasicTypesTemp = new HashSet(CS.BlocksGT.stoneToNormalOres.values()); - for (IBlockPlacable block: setNormalOreBasicTypesTemp) - if (block instanceof PrefixBlock) - setOreNormalBasicTypes.add((PrefixBlock)block); - } - - public class OreLayerWrapper { - public String veinName; - public short primaryMeta; - public short secondaryMeta; - public short betweenMeta; - public short sporadicMeta; - public String worldGenHeightRange; - public int randomWeight; - 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.randomWeight = worldGen.mWeight; - this.genOverworld = worldGen.mOverworld; - this.genNether = worldGen.mNether; - this.genEnd = worldGen.mEnd; - weightPerWorld[0] += this.genOverworld ? this.randomWeight : 0; - weightPerWorld[1] += this.genNether ? this.randomWeight : 0; - weightPerWorld[2] += this.genEnd ? this.randomWeight : 0; - } - } - -} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreSmallHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreSmallHelper.java deleted file mode 100644 index 873f049856..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT6OreSmallHelper.java +++ /dev/null @@ -1,87 +0,0 @@ -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.OP; -import gregapi.oredict.OreDictMaterial; -import gregapi.worldgen.WorldgenObject; -import gregapi.worldgen.Worldgen_GT_Ore_SmallPieces; -import gregapi.worldgen.Worldgenerator; -import net.minecraft.item.ItemStack; -import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; - -public class GT6OreSmallHelper { - public static List oreSmallList = new ArrayList(); - public static HashMap mapOreSmallWrapper = new HashMap(); - public static HashMap mapOreDropUnlocalizedNameToOreMeta = new HashMap(); - public static HashMap> mapOreMetaToOreDrops = new HashMap>(); - public static Set setOreSmallBasicTypes = new HashSet(); - - 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 stackList = new ArrayList(); - 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); - } - Set setSmallOreBasicTypesTemp = new HashSet(CS.BlocksGT.stoneToSmallOres.values()); - for (IBlockPlacable block: setSmallOreBasicTypesTemp) - if (block instanceof PrefixBlock) - setOreSmallBasicTypes.add((PrefixBlock)block); - } - } - - 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; - } - } - -} diff --git a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang index 25cfea1ead..710faef061 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang @@ -58,7 +58,6 @@ gtnop.ore.custom.name=Custom # vein names -# gregtech5.09 gtnop.ore.mix.naquadah=Naquadah gtnop.ore.mix.lignite=Lignite gtnop.ore.mix.coal=Coal @@ -91,11 +90,7 @@ gtnop.ore.mix.galena=Galena gtnop.ore.mix.lapis=Lapis gtnop.ore.mix.beryllium=Beryllium gtnop.ore.mix.oilsand=Oilsand - -# gregtech5.08 gtnop.ore.mix.plutonium=Plutonium - -# gregtech6 gtnop.ore.mix.iodinesalt=Iodinesalt gtnop.ore.mix.rocksalt=Rocksalt gtnop.ore.mix.asbestos=Asbestos diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index eaf0e4dd16..d553921d26 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,13 +1,13 @@ [ { "modid": "gtneioreplugin", - "name": "GT NEI Ore Plugin", - "description": "A forge mod which adds NEI plugins for GregTech5's ores.", - "version": "v1.0.4", + "name": "GT NEI Ore Plugin GT:NH Mod", + "description": "A forge mod which adds NEI plugins for GregTech5's ores. Modded for GT:NH", + "version": "v1.0.4-GTNH", "mcversion": "1.7.10", "url": "", "updateUrl": "", - "authorList": ["GWYOG"], + "authorList": ["GWYOG","bartimaeusnek"], "credits": "", "logoFile": "", "screenshots": [], -- cgit From 139001bc39cbf1eee935770dfbb5a0ffa45da5d8 Mon Sep 17 00:00:00 2001 From: LOKKO12 <33183715+LOKKO12@users.noreply.github.com> Date: Fri, 26 Jan 2018 17:10:21 +0100 Subject: Fixed it. upgrade to V1.0.5 --- build.gradle | 2 +- .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 2 +- .../plugin/gregtech5/PluginGT5Base.java | 4 + .../plugin/gregtech5/PluginGT5VeinStat.java | 99 ++++++++++++++++++---- .../gwyog/gtneioreplugin/util/DimensionHelper.java | 70 +++++++-------- .../gwyog/gtneioreplugin/util/GT5CFGHelper.java | 82 ++++++++++++------ .../gtneioreplugin/util/GT5OreSmallHelper.java | 13 --- .../assets/gtneioreplugin/lang/en_US.lang | 10 +-- 8 files changed, 186 insertions(+), 96 deletions(-) diff --git a/build.gradle b/build.gradle index f98f821268..f5a6e5abc9 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.7.10-1.0.4-GT-NH" +version = "1.7.10-1.0.5-GT-NH" group= "pers.gwyog.gtneioreplugin" archivesBaseName = "gtneioreplugin" diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index fd0e6710b5..995e1a02da 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -12,7 +12,7 @@ import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; public class GTNEIOrePlugin { public static final String MODID = "gtneioreplugin"; public static final String NAME = "GT NEI Ore Plugin GT:NH Mod"; - public static final String VERSION = "1.0.4-GTNH"; + public static final String VERSION = "1.0.5-GTNH"; public static String GTVersion = "GT5"; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java index 1a251ef514..242b27f23e 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java @@ -24,7 +24,11 @@ public class PluginGT5Base extends PluginBase { } public String getGTOreLocalizedName(short index) { + + if (!Materials.getLocalizedNameForItem(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)), index%1000).contains("Awakened")) return Materials.getLocalizedNameForItem(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)), index%1000); + else + return "Aw. Draconium Ore"; } public String getGTOreUnlocalizedName(short index) { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java index fd17e810b9..3aca184a8b 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -12,6 +12,7 @@ import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRect; +import cpw.mods.fml.common.FMLLog; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.util.GT_LanguageManager; @@ -121,36 +122,46 @@ public class PluginGT5VeinStat extends PluginGT5Base { CachedVeinStatRecipe crecipe = (CachedVeinStatRecipe) this.arecipes.get(recipe); OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); - if (getLocalizedVeinName(oreLayer).length()>20) { - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer).substring(0, 20), 2, 20, 0x404040, false); - if (getLocalizedVeinName(oreLayer).length()>40) { - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer).substring(20, 40), 2, 30, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer).substring(40, getLocalizedVeinName(oreLayer).length()), 2, 40, 0x404040, false); + if (getLocalizedVeinName(oreLayer).length>1) { + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[0], 2, 20, 0x404040, false); + if (getLocalizedVeinName(oreLayer).length>2) { + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[1], 2, 30, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[2], 2, 40, 0x404040, false); } else - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer).substring(20, getLocalizedVeinName(oreLayer).length()), 2, 30, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[1], 2, 30, 0x404040, false); } else - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer), 2, 20, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[0], 2, 20, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.primaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]), 2, 50, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.secondaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[1]), 2, 60, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[2]), 2, 70, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.sporadicOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[3]), 2, 80, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreLayer.worldGenHeightRange, 2, 90, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + Integer.toString(oreLayer.randomWeight), 100, 90, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 100, 0x404040, false); - GuiDraw.drawString(I18n.format("") + getDims(oreLayer), 2, 110, 0x404040, false); - // GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + getWeightedChance(oreLayer), 2, 122, 0x404040, false); + if (getDims(oreLayer).length()>36) { + GuiDraw.drawString(I18n.format("") + getDims(oreLayer).substring(0, 36), 2, 110, 0x404040, false); + if (getDims(oreLayer).length()>70) { + GuiDraw.drawString(I18n.format("") + getDims(oreLayer).substring(36, 70), 2, 120, 0x404040, false); + GuiDraw.drawString(I18n.format("") + getDims(oreLayer).substring(70, getDims(oreLayer).length()-1), 2, 130, 0x404040, false); + } + else + GuiDraw.drawString(I18n.format("") + getDims(oreLayer).substring(36, getDims(oreLayer).length()-1), 2, 120, 0x404040, false); + } + else + GuiDraw.drawString(I18n.format("") + getDims(oreLayer).substring(0, getDims(oreLayer).length()-1), 2, 110, 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); + GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); } - public String getLocalizedVeinName(OreLayerWrapper oreLayer) { + public String[] getLocalizedVeinName(OreLayerWrapper oreLayer) { String unlocalizedName = oreLayer.veinName; if (unlocalizedName.startsWith("ore.mix.custom.")) - return I18n.format(coustomVeinRenamer(oreLayer));//I18n.format("gtnop.ore.custom.name") + I18n.format("gtnop.ore.vein.name") + unlocalizedName.substring(15); + return get_Cnames(oreLayer);//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"); + return new String[] {I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.vein.name")}; } public String coustomVeinRenamer(OreLayerWrapper oreLayer) { @@ -162,9 +173,16 @@ public class PluginGT5VeinStat extends PluginGT5Base { .replace("]".charAt(0), ",".charAt(0)) .replaceAll(" Ore", ",") .replaceAll("Ore", ",") + .replaceAll(" Sand", ",") + .replaceAll("Sand", ",") + .replaceAll("Stone", ",") + .replaceAll(" Stone", ",") + .replaceAll("Earth", ",") + .replaceAll(" Earth", ",") + .replaceAll("Infused", ",") + .replaceAll(" Infused", ",") .replaceAll(",","") - .trim() - .concat(" Vein"); + .trim(); } /*public String getWeightedChance(OreLayerWrapper oreLayer) { @@ -183,6 +201,57 @@ public class PluginGT5VeinStat extends PluginGT5Base { return GT5CFGHelper.GT5CFG(GregTech_API.sWorldgenFile.mConfig.getConfigFile(), oreLayer.veinName.replace("ore.mix.custom.", "").replace("ore.mix.", "")); } + public String[] get_Cnames(OreLayerWrapper oreLayer) { + + String[] splt = coustomVeinRenamer(oreLayer).split("\\s"); + /*HashSet h = new HashSet(); + for (int i=0; i < splt.length;i++) { + h.add(splt[i]); + } + h.toArray(splt);*/ + + String[] ret = {oreLayer.veinName.replace("ore.mix.custom.", "")," "," "}; + for (int i=0; i < splt.length;i++) { + //FMLLog.info("Split:"+splt[i]); + //FMLLog.info("I:"+Integer.toString(i)); + if(ret[0].length()+splt[i].length()<=20) + ret[0]=ret[0]+splt[i]+" "; + if((ret[0].length()+splt[i].length()>20)&&ret[1].length()+splt[i].length()<=20&&!ret[0].contains(splt[i])) + ret[1]=ret[1]+splt[i]+" "; + if((ret[0].length()+splt[i].length()>20)&&(ret[1].length()+splt[i].length()>20)&&ret[2].length()+splt[i].length()<=20&&!ret[1].contains(splt[i])) + ret[2]=ret[2]+splt[i]+" "; + } + for (int i=0; i < ret.length;i++) { + ret[i]=ret[i].trim(); + } + + if(ret[2].isEmpty()&&!ret[1].isEmpty()) + if(ret[1].length()<=15) + ret[1]=ret[1]+" Vein"; + else + ret[2]=ret[2]+"Vein"; + else if(ret[1].isEmpty()&&ret[2].isEmpty()&&!ret[0].isEmpty()) + if(ret[0].length()<=15) + ret[0]=ret[0]+" Vein"; + else + ret[1]=ret[1]+"Vein"; + else if (!(ret[1].isEmpty()&&ret[2].isEmpty())) + ret[2]=ret[2]+"Vein"; + String[] ret2 = new String[2]; + if (ret[2].isEmpty()&&!ret[1].isEmpty()) { + ret2[0] = ret[0]; + ret2[1] = ret[1]; + return ret2; + } + String[] ret1 = new String[1]; + if (ret[1].isEmpty()&&ret[1].isEmpty()&&!ret[0].isEmpty()) { + ret1[0] = ret[0]; + return ret1; + } + else + return ret; + } + @Override public String getOutputId() { return "GTOrePluginVein"; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java index d68dd65d69..f81e355f83 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -41,41 +41,45 @@ public class DimensionHelper { "Nether", "Overworld", "TheEnd", - "Vanilla_EndAsteroids"}; + "Vanilla_EndAsteroids", + "Twilight", + "Underdark"}; public static String[] DimNameDisplayed = { - "End Asteroids", - "Moon", - "Asteroids", - "Mars", - "BarnardC", - "BarnardE", - "BarnardF", - "Callisto", - "CentauriA", - "Ceres", - "Deimos", - "Enceladus", - "Europa", - "Ganymede", - "Haumea", + "EA", + "MO", + "AS", + "MA", + "BC", + "BE", + "BF", + "Ca", + "CeA", + "Ce", + "De", + "En", + "Eu", + "Ga", + "Ha", "Io", - "Kuiperbelt", - "MakeMake", - "Mercury", - "Miranda", - "Oberon", - "Phobos", - "Pluto", - "Proteus", - "TcetiE", - "Titan", - "Triton", - "VegaB", - "Venus", - "The Nether", - "Overworld", - "The End", - "Far End Asteroids"}; + "KB", + "MM", + "Me", + "Mi", + "Ob", + "Ph", + "Pu", + "Pr", + "TE", + "Ti", + "Tr", + "VB", + "Ve", + "Ne", + "OW", + "EN", + "VA", + "TF", + "DD"}; } \ No newline at end of file diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java index b5fd6ad6e5..33f5604fa7 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java @@ -2,7 +2,6 @@ package pers.gwyog.gtneioreplugin.util; import java.io.BufferedReader; import java.io.File; -import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; @@ -17,7 +16,7 @@ public class GT5CFGHelper { public static String GT5CFG(File F, String Veinname) { //FMLLog.info(Veinname); if (F == null) { - FMLLog.bigWarning("GT_CFG_NOT_FOUND"); + FMLLog.bigWarning("GT_CFG_NOT_found[0]"); return "Error while Loading CFG"; } else @@ -26,41 +25,70 @@ public class GT5CFGHelper { if (buffer > F.length()) buffer = (int) F.length(); //allocate 10% of free memory for read-in-buffer, if there is less than filesize memory aviable - //FMLLog.info("GT_CFG_FOUND"); + //FMLLog.info("GT_CFG_found[0]"); FileReader in = new FileReader(F); //FMLLog.info("FileReader created"); BufferedReader reader = new BufferedReader(in, buffer); //FMLLog.info("BufferedReader" +Integer.toString(buffer)+"created"); - String st=""; + String st=null; List raw= new ArrayList(); List rawbools = new ArrayList(); - boolean found = false; + Boolean[] found = new Boolean[2]; + found[0] = false; + found[1] = false; do{ + //FMLLog.info("erste"); //read until reached eof or mix { st = reader.readLine(); //FMLLog.info("st: "+st); - if ((reader.readLine() != null)) - if (st.contains("mix {")) { - do{ - //read until reached eof or Veinname { + if (st != null && st.trim().equals("mix {")) { + while(!((st == null)||((st != null)&&found[0]))){ + //FMLLog.info("zweite"); st = reader.readLine(); + //read until reached eof or Veinname { //FMLLog.info("MIXst: "+st); - if ((reader.readLine() != null)) - if (st.contains(Veinname)) { - //FMLLog.info("VEINNAMEst: "+st); - //for (int i=0; i < 44;i++) - do{ - //add everything below Veinname { undtil } to raw - raw.add(reader.readLine()); - }while (!reader.readLine().contains("}")&&(reader.readLine() != null)); - found = true; + if (st != null && st.trim().equals(Veinname+" {")) { + //FMLLog.info("VEINNAMEst: "+st); + while (!((st == null)||((st != null)&&found[0]))){ + st = reader.readLine(); + if (st.trim().equals("}")) + found[0] = true; + //FMLLog.info("dritte"); + //add everything below Veinname { undtil } to raw + raw.add(st); + } + } } - }while((!found) || (reader.readLine() != null)); } - }while((!found) || (reader.readLine() != null)); - - reader.close();//not needed anymore + + if (st != null && st.trim().equals("dimensions {")) { + while(!((st == null)||((st != null)&&found[1]))){ + //FMLLog.info("zweite"); + st = reader.readLine(); + if (st != null && (st.trim().equals("mix {"))) { + while(!((st == null)||((st != null)&&found[1]))){ + //FMLLog.info("dritte"); + st = reader.readLine(); + //read until reached eof or Veinname { + //FMLLog.info("MIXst: "+st); + if (st != null && st.trim().equals(Veinname+" {")) { + //FMLLog.info("VEINNAMEst: "+st); + while (!((st == null)||((st != null)&&found[1]))){ + st = reader.readLine(); + if (st.trim().equals("}")) + found[1] = true; + //FMLLog.info("vierte"); + //add everything below Veinname { undtil } to raw + raw.add(st); + } + } + } + } + } + } + }while(st != null); + reader.close();//not needed anymore if (!raw.isEmpty()) for (int i=0; i < raw.size();i++) { @@ -75,16 +103,14 @@ public class GT5CFGHelper { String ret=" "; - //HashSet rawboolsset = new HashSet(); + HashSet rawboolsset = new HashSet(); if (!rawbools.isEmpty()) { //remove dublicats - /* for (int i=0; i < rawbools.size();i++){ - st = rawbools.get(i).replace("B:", "").replace("_true", "").replace("_false", "").replaceAll(" ", ""); + st = rawbools.get(i).replace("B:", "").replace("_true", "").replace("_false", "").replaceAll(" ", "").replaceAll("\"", ""); rawboolsset.add(st); } rawbools = new ArrayList(rawboolsset); - */ //filter for dims set to true for (int i=0; i < rawbools.size();i++) { st = rawbools.get(i); @@ -92,14 +118,14 @@ public class GT5CFGHelper { for (int j=0; j < DimensionHelper.DimName.length;j++) { if(st.contains(DimensionHelper.DimName[j])) if(st.contains("=true")) - ret=(ret+DimensionHelper.DimNameDisplayed[j]+" "); + ret=(ret+DimensionHelper.DimNameDisplayed[j]+","); } } } ret = ret.trim(); //FMLLog.info("ret:"+ret); if(ret.equals("")||ret.equals(" ")) - ret ="Not aviable in any Galactic Dim, maybe Deep Dark or Bedrock Dim"; + ret ="Not aviable in any Galactic Dim!"; return ret; } catch (IOException e) { e.printStackTrace(); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java index 4326475606..39173c756f 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java @@ -86,25 +86,12 @@ public class GT5OreSmallHelper { 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 OreSmallWrapper(GT_Worldgen_GT_Ore_SmallPieces worldGen) { this.oreGenName = worldGen.mWorldGenName; this.oreMeta = worldGen.mMeta; this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; this.amountPerChunk = worldGen.mAmount; - this.genOverworld = worldGen.mOverworld; - this.genNether = worldGen.mNether; - this.genEnd = worldGen.mEnd; - //if (GT5OreSmallHelper.restrictBiomeSupport) - // this.restrictBiome = worldGen.mRestrictBiome; - // if (GT5OreSmallHelper.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 index 710faef061..bf6ce27511 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang @@ -6,12 +6,12 @@ gtnop.gui.ieVeinStat.name=IE Vein Stats gtnop.gui.bedrockOreStat.name=Bedrock Ore Stats gtnop.gui.nei.veinName=Vein name -gtnop.gui.nei.primaryOre=Primary-Gen -gtnop.gui.nei.secondaryOre=Secondary-Gen -gtnop.gui.nei.betweenOre=Between-Gen -gtnop.gui.nei.sporadicOre=Sporadic-Gen +gtnop.gui.nei.primaryOre=Primary +gtnop.gui.nei.secondaryOre=Secondary +gtnop.gui.nei.betweenOre=Between +gtnop.gui.nei.sporadicOre=Sporadic gtnop.gui.nei.genHeight=Height -gtnop.gui.nei.weightedChance=Chance +gtnop.gui.nei.weightedChance=Weight gtnop.gui.nei.worldNames=Generated world gtnop.gui.nei.restrictBiome=Restricted biome -- cgit From 739a4eb9977c363d9393f3cb95996eda72e7c29c Mon Sep 17 00:00:00 2001 From: LOKKO12 <33183715+LOKKO12@users.noreply.github.com> Date: Tue, 30 Jan 2018 14:16:44 +0100 Subject: Small Gui Fix --- .../plugin/gregtech5/PluginGT5VeinStat.java | 14 +++++++------- .../pers/gwyog/gtneioreplugin/util/DimensionHelper.java | 16 ++++++++-------- .../pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java index 3aca184a8b..b6081fc9b0 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -125,11 +125,11 @@ public class PluginGT5VeinStat extends PluginGT5Base { if (getLocalizedVeinName(oreLayer).length>1) { GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[0], 2, 20, 0x404040, false); if (getLocalizedVeinName(oreLayer).length>2) { - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[1], 2, 30, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[2], 2, 40, 0x404040, false); + GuiDraw.drawString(I18n.format(getLocalizedVeinName(oreLayer)[1]), 2, 30, 0x404040, false); + GuiDraw.drawString(I18n.format(getLocalizedVeinName(oreLayer)[2]), 2, 40, 0x404040, false); } else - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[1], 2, 30, 0x404040, false); + GuiDraw.drawString(I18n.format(getLocalizedVeinName(oreLayer)[1]), 2, 30, 0x404040, false); } else GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[0], 2, 20, 0x404040, false); @@ -210,15 +210,15 @@ public class PluginGT5VeinStat extends PluginGT5Base { } h.toArray(splt);*/ - String[] ret = {oreLayer.veinName.replace("ore.mix.custom.", "")," "," "}; + String[] ret = {oreLayer.veinName.replace("ore.mix.custom.", "")+" "," "," "}; for (int i=0; i < splt.length;i++) { //FMLLog.info("Split:"+splt[i]); //FMLLog.info("I:"+Integer.toString(i)); if(ret[0].length()+splt[i].length()<=20) ret[0]=ret[0]+splt[i]+" "; - if((ret[0].length()+splt[i].length()>20)&&ret[1].length()+splt[i].length()<=20&&!ret[0].contains(splt[i])) + if((ret[0].length()+splt[i].length()>20)&&ret[1].length()+splt[i].length()<=70&&!ret[0].contains(splt[i])) ret[1]=ret[1]+splt[i]+" "; - if((ret[0].length()+splt[i].length()>20)&&(ret[1].length()+splt[i].length()>20)&&ret[2].length()+splt[i].length()<=20&&!ret[1].contains(splt[i])) + if((ret[0].length()+splt[i].length()>20)&&(ret[1].length()+splt[i].length()>70)&&ret[2].length()+splt[i].length()<=70&&!ret[1].contains(splt[i])) ret[2]=ret[2]+splt[i]+" "; } for (int i=0; i < ret.length;i++) { @@ -226,7 +226,7 @@ public class PluginGT5VeinStat extends PluginGT5Base { } if(ret[2].isEmpty()&&!ret[1].isEmpty()) - if(ret[1].length()<=15) + if(ret[1].length()<=65) ret[1]=ret[1]+" Vein"; else ret[2]=ret[2]+"Vein"; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java index f81e355f83..c0842bfbfa 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -46,16 +46,16 @@ public class DimensionHelper { "Underdark"}; public static String[] DimNameDisplayed = - { + {// first 2 letters if one word else 1 letter of every word, execpt capital letter in name, then 1rst + capital Moon = Mo, BarnardC = BC, EndAsteroid = EA "EA", - "MO", - "AS", - "MA", + "Mo", + "As", + "Ma", "BC", "BE", "BF", "Ca", - "CeA", + "CA", "Ce", "De", "En", @@ -69,7 +69,7 @@ public class DimensionHelper { "Mi", "Ob", "Ph", - "Pu", + "Pl", "Pr", "TE", "Ti", @@ -77,8 +77,8 @@ public class DimensionHelper { "VB", "Ve", "Ne", - "OW", - "EN", + "Ow", + "EN",//End = EN bc En = Encalus "VA", "TF", "DD"}; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java index 33f5604fa7..c616534d8d 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java @@ -50,9 +50,9 @@ public class GT5CFGHelper { //FMLLog.info("MIXst: "+st); if (st != null && st.trim().equals(Veinname+" {")) { //FMLLog.info("VEINNAMEst: "+st); - while (!((st == null)||((st != null)&&found[0]))){ + while (!((st == null)||((st != null) && found[0]))){ st = reader.readLine(); - if (st.trim().equals("}")) + if ((!(st == null)) && st.trim().equals("}")) found[0] = true; //FMLLog.info("dritte"); //add everything below Veinname { undtil } to raw @@ -76,7 +76,7 @@ public class GT5CFGHelper { //FMLLog.info("VEINNAMEst: "+st); while (!((st == null)||((st != null)&&found[1]))){ st = reader.readLine(); - if (st.trim().equals("}")) + if ((!(st == null)) && st.trim().equals("}")) found[1] = true; //FMLLog.info("vierte"); //add everything below Veinname { undtil } to raw -- cgit From b13e29fd889680a89a4019b8fc7b68d2d46418bc Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Tue, 30 Jan 2018 14:25:42 +0100 Subject: Update README.MD --- README.MD | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.MD b/README.MD index fa712c8466..bc5bbdbdd9 100644 --- a/README.MD +++ b/README.MD @@ -1,24 +1,24 @@ # GT NEI Ore Plugin -This minecraft forge mod is an addon for GregTech5/6 and NEI and is a client-side mod. +This minecraft forge mod is an addon for GregTech5 and NEI and is a client-side mod. -It adds several NEI plugins for GT5/6 which shows the detailed information of GregTech's ore generation. +It adds several NEI plugins for GT5 which shows the detailed information of GregTech's ore generation. These plugins are: -* Plugin for vein generation (GT5/6) -* Plugin for asteriod generation (GT5.09+ only) -* Plugin for small ore generation (GT5/6) -* Plugin for Immersive Engineering vein generation (GT5.09.26+ only) -* Plugin for bedrock ore generation (GT6 only). +* Plugin for vein generation (GT5) +* Plugin for small ore generation (GT5) (Not yet.) ### Download -Currently, this mod is only released on two **Chinese** minecraft forum: [Baidu Post Bar](http://tieba.baidu.com/p/4848951445) and [MCBBS](http://www.mcbbs.net/forum.php?mod=viewthread&tid=646455). -You can find the download link there, or simply download it [here](http://pan.baidu.com/s/1b2mOFW). -This download link is from a Chinese NetDisk FYI. +You can find the download link [here](https://github.com/bartimaeusnek/GTNEIOrePlugin/releases). ### Build -If you want a bleeding-edge version of this mod, you can simply download or clone this repository, establish a folder named "libs" and put the dev builds of suitable version of NEI(e.g. 1.0.5.120-dev), GT5(e.g. 5.09.28-dev), and GT6(e.g. 6.05.00-dev) in the folder. +If you want a bleeding-edge version of this mod, you can simply download or clone this repository, establish a folder named "libs" and put the dev builds: +CodeChickenCore-1.7.10-1.0.7.47-dev.jar +CodeChickenLib-1.7.10-1.1.3.140-dev.jar +gregtech-5.09.32.19-dev.jar (or higher, GT5U) +NotEnoughItems-1.7.10-1.0.5.120-dev.jar +in the folder. Then you can build this mod in the same way as building other mods. i.e. run "gradlew build" command in the CMD window. Then the build can be found in "./build/libs/" folder. ### License -The whole repository is under [MIT](https://github.com/GWYOG/GTNEIOrePlugin/blob/master/LICENSE) License. +The whole repository is under [MIT](https://github.com/bartimaeusnek/GTNEIOrePlugin/blob/GT-NH-Mod/LICENSE) License. You can feel free to use the mod in your modpacks. If you add my name in your credit list, I'll be super happy with that. -- cgit From d4e9d703e5bae6c9c118500bc8e7876346837f90 Mon Sep 17 00:00:00 2001 From: LOKKO12 <33183715+LOKKO12@users.noreply.github.com> Date: Mon, 12 Feb 2018 18:33:16 +0100 Subject: +added gradlew automation --- build.gradle | 42 +++++++++++++++++++--- build.properties | 7 ++++ .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 4 +-- .../gtneioreplugin/plugin/NEIPluginConfig.java | 2 -- .../gtneioreplugin/util/GT5OreSmallHelper.java | 4 +-- 5 files changed, 46 insertions(+), 13 deletions(-) create mode 100644 build.properties diff --git a/build.gradle b/build.gradle index f5a6e5abc9..72194b5354 100644 --- a/build.gradle +++ b/build.gradle @@ -12,10 +12,12 @@ buildscript { } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' + classpath "de.undercouch:gradle-download-task:3.1.2" } } apply plugin: 'forge' +import de.undercouch.gradle.tasks.download.Download version = "1.7.10-1.0.5-GT-NH" group= "pers.gwyog.gtneioreplugin" @@ -26,17 +28,47 @@ targetCompatibility = 1.7 minecraft { version = "1.7.10-10.13.4.1614-1.7.10" + replaceIn "GTNEIOrePlugin.java" + replace "@version@", project.version runDir = "eclipse" } +file "build.properties" withReader { + def prop = new Properties() + prop.load(it) + ext.config = new ConfigSlurper().parse prop +} + +repositories { + mavenLocal() + maven { + name "ChickenBones" + url "http://chickenbones.net/maven/" + } +} + dependencies { - // You should put the dev builds of NEI (with its dependencies), GregTech5 and GregTech6 in the /libs folder manually - // to make the gradlew build working properly. - // 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" + //compile "codechicken:ForgeMultipart:${config.minecraft.version}-${config.fmp.version}:dev" + compile "codechicken:CodeChickenLib:${config.minecraft.version}-${config.ccl.version}:dev" + compile "codechicken:CodeChickenCore:${config.minecraft.version}-${config.ccc.version}:dev" + compile "codechicken:NotEnoughItems:${config.minecraft.version}-${config.nei.version}:dev" } +task getGregTech(type: Download) { + onlyIf { + !file("libs/gregtech-${config.gregtech.version}-dev.jar").exists() + } + src "http://jenkins.usrv.de:8081/job/Gregtech-5-Unofficial/${config.gregtech.jenkinsbuild}/artifact/build/libs/gregtech-${config.gregtech.version}-dev.jar" + dest file("libs/gregtech-${config.gregtech.version}-dev.jar") + mustRunAfter "deobfBinJar" + mustRunAfter "repackMinecraft" +} + +tasks.setupCIWorkspace.dependsOn getGregTech +tasks.setupDevWorkspace.dependsOn getGregTech +tasks.setupDecompWorkspace.dependsOn getGregTech +tasks.compileJava.dependsOn getGregTech + processResources { // this will ensure that this task is redone when the versions change. diff --git a/build.properties b/build.properties new file mode 100644 index 0000000000..e5849c14be --- /dev/null +++ b/build.properties @@ -0,0 +1,7 @@ +gregtech.version=5.09.32.19 +gregtech.jenkinsbuild=1037 +croploadcore.version=0.0.8 +minecraft.version=1.7.10 +ccl.version=1.1.3.140 +ccc.version=1.0.7.47 +nei.version=1.0.5.120 \ No newline at end of file diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index 995e1a02da..e0c28843bb 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -12,9 +12,7 @@ import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; public class GTNEIOrePlugin { public static final String MODID = "gtneioreplugin"; public static final String NAME = "GT NEI Ore Plugin GT:NH Mod"; - public static final String VERSION = "1.0.5-GTNH"; - - public static String GTVersion = "GT5"; + public static final String VERSION = "@version@"; @Mod.Instance(MODID) public static GTNEIOrePlugin instance; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java index d2cc0933d0..06133bebcc 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java @@ -23,7 +23,6 @@ public class NEIPluginConfig implements IConfigureNEI { @Override public void loadConfig() { - if (GTNEIOrePlugin.GTVersion.equals("GT5")) { PluginGT5VeinStat pluginVeinStat = new PluginGT5VeinStat(); //PluginGT5AsteroidStat pluginAsteriodStat = new PluginGT5AsteroidStat(); PluginGT5SmallOreStat pluginSmallOreStat = new PluginGT5SmallOreStat(); @@ -33,6 +32,5 @@ public class NEIPluginConfig implements IConfigureNEI { //API.registerUsageHandler(pluginAsteriodStat); API.registerRecipeHandler(pluginSmallOreStat); API.registerUsageHandler(pluginSmallOreStat); - } } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java index 39173c756f..fa09482efb 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java @@ -57,7 +57,6 @@ public class GT5OreSmallHelper { } private static void checkExtraSupport() { - if (GTNEIOrePlugin.GTVersion.equals("GT5")) { Class clazzGTOreSmall = null; try { clazzGTOreSmall = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_SmallPieces"); @@ -72,8 +71,7 @@ public class GT5OreSmallHelper { Field fieldGCMars = clazzGTOreSmall.getField("mMars"); gcBasicSupport = true; } catch (Exception e) {} - } - } + } } public static Materials[] getDroppedDusts() { -- cgit From ab8d9f940dc73bf92639278d7616d1eaec6a7df2 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Mon, 12 Feb 2018 18:47:24 +0100 Subject: Added gradle wrapper jar --- gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 51017 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 gradle/wrapper/gradle-wrapper.jar diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..b761216703 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ -- cgit From 30d2405b128ed0e451112783bbbc3ecd94739727 Mon Sep 17 00:00:00 2001 From: LOKKO12 <33183715+LOKKO12@users.noreply.github.com> Date: Mon, 12 Feb 2018 18:49:18 +0100 Subject: added gradlew wrapper jar --- .gitignore | 3 ++- gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 51017 bytes 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 gradle/wrapper/gradle-wrapper.jar diff --git a/.gitignore b/.gitignore index dca47ebd18..f53f3d8eef 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ bin/ eclipse/ .classpath .project +libs/ +libs2/ # Compiled class file *.class @@ -20,7 +22,6 @@ eclipse/ .mtj.tmp/ # Package Files # -*.jar *.war *.ear *.zip diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000..b761216703 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ -- cgit From 64b269ee73cd7bf6f839caa2684a25e46666e684 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Wed, 28 Feb 2018 04:24:14 +0100 Subject: Create README_CH_DIMS.MD --- README_CH_DIMS.MD | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 README_CH_DIMS.MD diff --git a/README_CH_DIMS.MD b/README_CH_DIMS.MD new file mode 100644 index 0000000000..90d8855350 --- /dev/null +++ b/README_CH_DIMS.MD @@ -0,0 +1,6 @@ +感谢您的支持。 缩写如下: +缩写=维度的前两个字母, +如果维度具有大写字母,例如: B.“BarnadaF”是BF的缩写。 +此致 +bartimaeusnek。 +(请原谅我的中文,我是德语,并使用谷歌翻译。) -- cgit From 849edc278f7cfb71f4b7b6132cfdea3c1ed056e8 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Wed, 28 Feb 2018 04:25:45 +0100 Subject: Rename README_CH_DIMS.MD to README_ZH-CN_DIMS.MD --- README_CH_DIMS.MD | 6 ------ README_ZH-CN_DIMS.MD | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) delete mode 100644 README_CH_DIMS.MD create mode 100644 README_ZH-CN_DIMS.MD diff --git a/README_CH_DIMS.MD b/README_CH_DIMS.MD deleted file mode 100644 index 90d8855350..0000000000 --- a/README_CH_DIMS.MD +++ /dev/null @@ -1,6 +0,0 @@ -感谢您的支持。 缩写如下: -缩写=维度的前两个字母, -如果维度具有大写字母,例如: B.“BarnadaF”是BF的缩写。 -此致 -bartimaeusnek。 -(请原谅我的中文,我是德语,并使用谷歌翻译。) diff --git a/README_ZH-CN_DIMS.MD b/README_ZH-CN_DIMS.MD new file mode 100644 index 0000000000..90d8855350 --- /dev/null +++ b/README_ZH-CN_DIMS.MD @@ -0,0 +1,6 @@ +感谢您的支持。 缩写如下: +缩写=维度的前两个字母, +如果维度具有大写字母,例如: B.“BarnadaF”是BF的缩写。 +此致 +bartimaeusnek。 +(请原谅我的中文,我是德语,并使用谷歌翻译。) -- cgit From b0e5b659c0e9ded575f6a05bd6b61ae2a5b4b27f Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Tue, 24 Apr 2018 18:47:47 +0200 Subject: added Sheetexport feature + added some config options --- build.gradle | 3 +- .../java/pers/gwyog/gtneioreplugin/Config.java | 19 + .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 21 +- .../gwyog/gtneioreplugin/plugin/PluginBase.java | 1 + .../plugin/gregtech5/PluginGT5Base.java | 11 +- .../plugin/gregtech5/PluginGT5VeinStat.java | 57 ++- .../gtneioreplugin/util/GT5OreLayerHelper.java | 147 ++++++- .../pers/gwyog/gtneioreplugin/util/Oremix.java | 466 +++++++++++++++++++++ .../gwyog/gtneioreplugin/util/Veinrenamer.java | 28 ++ .../pers/gwyog/gtneioreplugin/util/XtoBool.java | 36 ++ 10 files changed, 750 insertions(+), 39 deletions(-) create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/Config.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java diff --git a/build.gradle b/build.gradle index 72194b5354..e9fd886ad3 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ import de.undercouch.gradle.tasks.download.Download version = "1.7.10-1.0.5-GT-NH" group= "pers.gwyog.gtneioreplugin" -archivesBaseName = "gtneioreplugin" +archivesBaseName = "gtneioreplugin-csv" sourceCompatibility = 1.7 targetCompatibility = 1.7 @@ -52,6 +52,7 @@ dependencies { compile "codechicken:CodeChickenLib:${config.minecraft.version}-${config.ccl.version}:dev" compile "codechicken:CodeChickenCore:${config.minecraft.version}-${config.ccc.version}:dev" compile "codechicken:NotEnoughItems:${config.minecraft.version}-${config.nei.version}:dev" + compile "com.opencsv:opencsv:4.0" } task getGregTech(type: Download) { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/Config.java b/src/main/java/pers/gwyog/gtneioreplugin/Config.java new file mode 100644 index 0000000000..62a94de43b --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/Config.java @@ -0,0 +1,19 @@ +package pers.gwyog.gtneioreplugin; + +import java.io.File; + +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.common.config.Configuration; + +public class Config { + public Configuration tConfig; + public Config(FMLPreInitializationEvent preinit,String cfgname) { + File tFile = new File(preinit.getModConfigurationDirectory(), cfgname); + tConfig = new Configuration(tFile); + tConfig.load(); + } + public void save () { + tConfig.save(); + } + +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index e0c28843bb..0ce4ed0b81 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -1,28 +1,45 @@ package pers.gwyog.gtneioreplugin; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; + 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.FMLPreInitializationEvent; import cpw.mods.fml.relauncher.Side; +import net.minecraft.init.Items; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; +import pers.gwyog.gtneioreplugin.util.Oremix; @Mod(modid = GTNEIOrePlugin.MODID, name = GTNEIOrePlugin.NAME, version = GTNEIOrePlugin.VERSION, dependencies = "required-after:gregtech;required-after:NotEnoughItems") public class GTNEIOrePlugin { public static final String MODID = "gtneioreplugin"; public static final String NAME = "GT NEI Ore Plugin GT:NH Mod"; public static final String VERSION = "@version@"; + public static boolean csv; + public static String CSVname; + public static List OreVeins=new ArrayList(); + public static HashSet OreV=new HashSet(); @Mod.Instance(MODID) public static GTNEIOrePlugin instance; + @EventHandler + public void preinit(FMLPreInitializationEvent event) { + Config c = new Config(event, this.MODID+".cfg"); + csv = c.tConfig.getBoolean("print csv","ALL", false, "princsv, you need apache commons collections to be injected in the minecraft jar."); + CSVname = c.tConfig.getString("CSV_name", "ALL", event.getModConfigurationDirectory()+"/GTNH-Oresheet.csv", "rename the oresheet here, it will appear in /config"); + } + @EventHandler public void onLoadComplete(FMLLoadCompleteEvent event) { if (event.getSide() == Side.CLIENT) { new GT5OreLayerHelper(); new GT5OreSmallHelper(); + } } - } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java index 11b1b925f2..cbca2a66c6 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java @@ -48,4 +48,5 @@ public class PluginBase extends TemplateRecipeHandler { public int getGuiWidth() { return 166; } + } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java index 242b27f23e..1d612d8c9c 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java @@ -1,14 +1,7 @@ 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.enums.Materials; 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 { @@ -23,7 +16,7 @@ public class PluginGT5Base extends PluginBase { return 5; } - public String getGTOreLocalizedName(short index) { + public static String getGTOreLocalizedName(short index) { if (!Materials.getLocalizedNameForItem(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)), index%1000).contains("Awakened")) return Materials.getLocalizedNameForItem(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)), index%1000); @@ -31,7 +24,7 @@ public class PluginGT5Base extends PluginBase { return "Aw. Draconium Ore"; } - public String getGTOreUnlocalizedName(short index) { + public static String getGTOreUnlocalizedName(short index) { return "gt.blockores." + index + ".name"; } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java index b6081fc9b0..ddb130eec3 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -1,31 +1,31 @@ package pers.gwyog.gtneioreplugin.plugin.gregtech5; -import java.awt.Rectangle; -import java.io.File; +import java.io.FileWriter; import java.io.IOException; +import java.io.StringWriter; +import java.io.Writer; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; +import com.opencsv.bean.ColumnPositionMappingStrategy; +import com.opencsv.bean.StatefulBeanToCsv; +import com.opencsv.bean.StatefulBeanToCsvBuilder; +import com.opencsv.exceptions.CsvDataTypeMismatchException; +import com.opencsv.exceptions.CsvRequiredFieldEmptyException; + import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; -import codechicken.nei.recipe.TemplateRecipeHandler; -import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRect; -import cpw.mods.fml.common.FMLLog; import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; -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.DimensionHelper; +import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; import pers.gwyog.gtneioreplugin.util.GT5CFGHelper; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; +import pers.gwyog.gtneioreplugin.util.Oremix; public class PluginGT5VeinStat extends PluginGT5Base { @@ -122,6 +122,8 @@ public class PluginGT5VeinStat extends PluginGT5Base { CachedVeinStatRecipe crecipe = (CachedVeinStatRecipe) this.arecipes.get(recipe); OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); + String Dims = getDims(oreLayer); + if (getLocalizedVeinName(oreLayer).length>1) { GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[0], 2, 20, 0x404040, false); if (getLocalizedVeinName(oreLayer).length>2) { @@ -133,29 +135,40 @@ public class PluginGT5VeinStat extends PluginGT5Base { } else GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[0], 2, 20, 0x404040, false); + + GuiDraw.drawString(I18n.format("gtnop.gui.nei.primaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]), 2, 50, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.secondaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[1]), 2, 60, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[2]), 2, 70, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.sporadicOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[3]), 2, 80, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreLayer.worldGenHeightRange, 2, 90, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + Integer.toString(oreLayer.randomWeight), 100, 90, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 100, 0x404040, false); - if (getDims(oreLayer).length()>36) { - GuiDraw.drawString(I18n.format("") + getDims(oreLayer).substring(0, 36), 2, 110, 0x404040, false); - if (getDims(oreLayer).length()>70) { - GuiDraw.drawString(I18n.format("") + getDims(oreLayer).substring(36, 70), 2, 120, 0x404040, false); - GuiDraw.drawString(I18n.format("") + getDims(oreLayer).substring(70, getDims(oreLayer).length()-1), 2, 130, 0x404040, false); + if (Dims.length()>36) { + GuiDraw.drawString(I18n.format("") + Dims.substring(0, 36), 2, 110, 0x404040, false); + if (Dims.length()>70) { + GuiDraw.drawString(I18n.format("") + Dims.substring(36, 70), 2, 120, 0x404040, false); + GuiDraw.drawString(I18n.format("") + Dims.substring(70, Dims.length()-1), 2, 130, 0x404040, false); } else - GuiDraw.drawString(I18n.format("") + getDims(oreLayer).substring(36, getDims(oreLayer).length()-1), 2, 120, 0x404040, false); + GuiDraw.drawString(I18n.format("") + Dims.substring(36, Dims.length()-1), 2, 120, 0x404040, false); } else - GuiDraw.drawString(I18n.format("") + getDims(oreLayer).substring(0, getDims(oreLayer).length()-1), 2, 110, 0x404040, false); + GuiDraw.drawString(I18n.format("") + Dims.substring(0, Dims.length()-1), 2, 110, 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); + } - public String[] getLocalizedVeinName(OreLayerWrapper oreLayer) { + public static String[] getLocalizedVeinName(OreLayerWrapper oreLayer) { String unlocalizedName = oreLayer.veinName; if (unlocalizedName.startsWith("ore.mix.custom.")) @@ -164,7 +177,7 @@ public class PluginGT5VeinStat extends PluginGT5Base { return new String[] {I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.vein.name")}; } - public String coustomVeinRenamer(OreLayerWrapper oreLayer) { + public static String coustomVeinRenamer(OreLayerWrapper oreLayer) { Set s = new HashSet(); for (int i=0; i < 4; i++) s.add(getGTOreLocalizedName(oreLayer.Meta[i]).replaceAll(" ", "")); @@ -197,11 +210,11 @@ public class PluginGT5VeinStat extends PluginGT5Base { return weightedChance; }*/ - public String getDims(OreLayerWrapper oreLayer) { + public static String getDims(OreLayerWrapper oreLayer) { return GT5CFGHelper.GT5CFG(GregTech_API.sWorldgenFile.mConfig.getConfigFile(), oreLayer.veinName.replace("ore.mix.custom.", "").replace("ore.mix.", "")); } - public String[] get_Cnames(OreLayerWrapper oreLayer) { + public static String[] get_Cnames(OreLayerWrapper oreLayer) { String[] splt = coustomVeinRenamer(oreLayer).split("\\s"); /*HashSet h = new HashSet(); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index 9c94bf0029..073147696c 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -1,18 +1,35 @@ package pers.gwyog.gtneioreplugin.util; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.io.IOException; import java.lang.reflect.Field; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.function.BiConsumer; + +import com.opencsv.CSVReader; +import com.opencsv.CSVWriter; +import com.opencsv.bean.ColumnPositionMappingStrategy; +import com.opencsv.bean.CsvToBean; +import com.opencsv.bean.StatefulBeanToCsv; +import com.opencsv.bean.StatefulBeanToCsvBuilder; import cpw.mods.fml.common.Loader; import gregtech.GT_Mod; import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; 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 pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat; public class GT5OreLayerHelper { @@ -27,14 +44,108 @@ public class GT5OreLayerHelper { DimIDs[i]=0; for (GT_Worldgen_GT_Ore_Layer tWorldGen: GT_Worldgen_GT_Ore_Layer.sList) mapOreLayerWrapper.put(tWorldGen.mWorldGenName, new OreLayerWrapper(tWorldGen)); + + if (GTNEIOrePlugin.csv) { + Iterator it = mapOreLayerWrapper.entrySet().iterator(); + while (it.hasNext()) { + Oremix oremix = new Oremix(); + + Map.Entry pair = (Map.Entry)it.next(); + String Dims = PluginGT5VeinStat.getDims((OreLayerWrapper)pair.getValue()); + OreLayerWrapper oreLayer = (OreLayerWrapper) pair.getValue(); + if (PluginGT5VeinStat.getLocalizedVeinName(oreLayer).length>2) + oremix.setOreName(PluginGT5VeinStat.getLocalizedVeinName(oreLayer)[0]+PluginGT5VeinStat.getLocalizedVeinName(oreLayer)[1]+PluginGT5VeinStat.getLocalizedVeinName(oreLayer)[2]); + else if (PluginGT5VeinStat.getLocalizedVeinName(oreLayer).length>1) + oremix.setOreName(PluginGT5VeinStat.getLocalizedVeinName(oreLayer)[0]+PluginGT5VeinStat.getLocalizedVeinName(oreLayer)[1]); + else + oremix.setOreName(PluginGT5VeinStat.getLocalizedVeinName(oreLayer)[0]); + + oremix.setPrimary(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[0])); + oremix.setSecondary(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[1])); + oremix.setInbetween(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[2])); + oremix.setAround(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[3])); + oremix.setSize(oreLayer.size); + oremix.setHeight(oreLayer.worldGenHeightRange); + oremix.setDensity(oreLayer.density); + oremix.setWeight(oreLayer.randomWeight); + oremix.setMix("\'"+Integer.toString(oreLayer.Meta[0])+"|"+Integer.toString(oreLayer.Meta[1])+"|"+Integer.toString(oreLayer.Meta[2])+"|"+Integer.toString(oreLayer.Meta[3])+"\'"); + oremix.as=Dims.contains("As"); + oremix.bc=Dims.contains("BC"); + oremix.be=Dims.contains("BE"); + oremix.bf=Dims.contains("BF"); + oremix.ca=Dims.contains("Ca"); + oremix.cb=Dims.contains("CA"); + oremix.ce=Dims.contains("Ce"); + oremix.dd=Dims.contains("DD"); + oremix.de=Dims.contains("De"); + oremix.ea=Dims.contains("EA"); + oremix.en=Dims.contains("En"); + oremix.eu=Dims.contains("Eu"); + oremix.ga=Dims.contains("Ga"); + oremix.ha=Dims.contains("Ha"); + oremix.io=Dims.contains("Io"); + oremix.kb=Dims.contains("KB"); + oremix.make=Dims.contains("MM"); + oremix.ma=Dims.contains("Ma"); + oremix.me=Dims.contains("Me"); + oremix.mi=Dims.contains("Mi"); + oremix.mo=Dims.contains("Mo"); + oremix.ob=Dims.contains("Ob"); + oremix.ph=Dims.contains("Ph"); + oremix.pl=Dims.contains("Pl"); + oremix.pr=Dims.contains("Pr"); + oremix.tcetie=Dims.contains("TE"); + oremix.tf=Dims.contains("TF"); + oremix.ti=Dims.contains("Ti"); + oremix.tr=Dims.contains("Tr"); + oremix.vb=Dims.contains("VB"); + oremix.ve=Dims.contains("Ve"); + oremix.setOverworld(Dims.contains("Ow")); + oremix.setNether(Dims.contains("Ne")); + oremix.setEnd(Dims.contains("EN")); + GTNEIOrePlugin.OreVeins.add(oremix); + + + System.out.println(pair.getKey() + " = " + pair.getValue()); + it.remove(); // avoids a ConcurrentModificationException + } + BufferedWriter one = null; + try { + one = Files.newBufferedWriter(Paths.get(GTNEIOrePlugin.CSVname)); + } catch (IOException e1) { + e1.printStackTrace(); + } + + ColumnPositionMappingStrategy strat = new ColumnPositionMappingStrategy(); + strat.setType(Oremix.class); + String[] columns = "ORENAME,PRIMARY,SECONDARY,INBETWEEN,AROUND,mix,TIER,HEIGHT,DENSITY,SIZE,WEIGHT,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie".split("\\,"); + strat.setColumnMapping(columns); + StatefulBeanToCsv beanToCsv = new StatefulBeanToCsvBuilder(one) + .withQuotechar(CSVWriter.NO_QUOTE_CHARACTER) + .withMappingStrategy(strat) + .build(); + List towrite = Combsort(GTNEIOrePlugin.OreVeins); + try { + one.write("Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E"); + one.newLine(); + beanToCsv.write(towrite); + } catch (Exception e) { + e.printStackTrace(); + } + try { + one.flush(); + one.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } } public class OreLayerWrapper { - public String veinName; + public String veinName,worldGenHeightRange, weightedIEChance; public short[] Meta = new short[4]; - public String worldGenHeightRange; - public String weightedIEChance; - public int randomWeight; + public short randomWeight, size, density; public List Weight = new ArrayList(); public OreLayerWrapper(GT_Worldgen_GT_Ore_Layer worldGen) { @@ -43,10 +154,36 @@ public class GT5OreLayerHelper { this.Meta[1] = worldGen.mSecondaryMeta; this.Meta[2] = worldGen.mBetweenMeta; this.Meta[3] = worldGen.mSporadicMeta; + this.size = worldGen.mSize; + this.density = worldGen.mDensity; this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; this.randomWeight = worldGen.mWeight; } } - + + public static List Combsort(List liste) { + List liste2 = new ArrayList(liste.size()); + for (Oremix element : liste) { + liste2.add(element); + } + + int schritt = liste2.size(); + boolean vertauscht = false; + do { + vertauscht = false; + if (schritt > 1) { + schritt = (int) (schritt / 1.3); + } + for (int i = 0; i < liste2.size() - schritt; i++) { + if (liste2.get(i).getOreName().substring(0, 3).compareTo((liste2.get(i + schritt).getOreName().substring(0, 3))) > 0) { + T tmp = (T) liste2.get(i); + liste2.set(i, liste2.get(i + schritt)); + liste2.set(i + schritt, (Oremix) tmp); + vertauscht = true; + } + } + } while (vertauscht || schritt > 1); + return liste2; + } } \ No newline at end of file diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java b/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java new file mode 100644 index 0000000000..0835293f8d --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java @@ -0,0 +1,466 @@ +package pers.gwyog.gtneioreplugin.util; + +import com.opencsv.bean.CsvBindByName; +import com.opencsv.bean.CsvCustomBindByName; + +public class Oremix { + + @CsvCustomBindByName(column = "Ore Name", required = true, converter = Veinrenamer.class) + private String oreName; + @CsvBindByName(column = "Primary", required = false) + private String primary = ""; + @CsvBindByName(column = "Secondary", required = false) + private String secondary = ""; + @CsvBindByName(column = "Inbetween", required = false) + private String inbetween = ""; + @CsvBindByName(column = "Around", required = false) + private String around = ""; + @CsvBindByName(column = "ID ", required = false) + private String mix = ""; + @CsvBindByName(column = "Tier", required = false) + private String tier = ""; + @CsvBindByName(column = "Height", required = false) + private String height = ""; + @CsvBindByName(column = "Density", required = false) + private int density; + @CsvBindByName(column = "Size", required = false) + private int size; + @CsvBindByName(column = "Weight", required = false) + private int weight; + @CsvCustomBindByName(column = "Overworld", required = false, converter = XtoBool.class) + private boolean overworld; + @CsvCustomBindByName(column = "Nether", required = false, converter = XtoBool.class) + private boolean nether; + @CsvCustomBindByName(column = "End", required = false, converter = XtoBool.class) + private boolean end; + @CsvCustomBindByName(column = "Moon", required = false, converter = XtoBool.class) + public boolean mo; + public boolean isMo() { + return mo; + } + + public void setMo(boolean mo) { + this.mo = mo; + } + + public boolean isEa() { + return ea; + } + + public void setEa(boolean ea) { + this.ea = ea; + } + + public boolean isAs() { + return as; + } + + public void setAs(boolean as) { + this.as = as; + } + + public boolean isBc() { + return bc; + } + + public void setBc(boolean bc) { + this.bc = bc; + } + + public boolean isBe() { + return be; + } + + public void setBe(boolean be) { + this.be = be; + } + + public boolean isBf() { + return bf; + } + + public void setBf(boolean bf) { + this.bf = bf; + } + + public boolean isMa() { + return ma; + } + + public void setMa(boolean ma) { + this.ma = ma; + } + + public boolean isCa() { + return ca; + } + + public void setCa(boolean ca) { + this.ca = ca; + } + + public boolean isCb() { + return cb; + } + + public void setCb(boolean cb) { + this.cb = cb; + } + + public boolean isCe() { + return ce; + } + + public void setCe(boolean ce) { + this.ce = ce; + } + + public boolean isTf() { + return tf; + } + + public void setTf(boolean tf) { + this.tf = tf; + } + + public boolean isDd() { + return dd; + } + + public void setDd(boolean dd) { + this.dd = dd; + } + + public boolean isPh() { + return ph; + } + + public void setPh(boolean ph) { + this.ph = ph; + } + + public boolean isDe() { + return de; + } + + public void setDe(boolean de) { + this.de = de; + } + + public boolean isEu() { + return eu; + } + + public void setEu(boolean eu) { + this.eu = eu; + } + + public boolean isGa() { + return ga; + } + + public void setGa(boolean ga) { + this.ga = ga; + } + + public boolean isIo() { + return io; + } + + public void setIo(boolean io) { + this.io = io; + } + + public boolean isVe() { + return ve; + } + + public void setVe(boolean ve) { + this.ve = ve; + } + + public boolean isMe() { + return me; + } + + public void setMe(boolean me) { + this.me = me; + } + + public boolean isEn() { + return en; + } + + public void setEn(boolean en) { + this.en = en; + } + + public boolean isTi() { + return ti; + } + + public void setTi(boolean ti) { + this.ti = ti; + } + + public boolean isMi() { + return mi; + } + + public void setMi(boolean mi) { + this.mi = mi; + } + + public boolean isOb() { + return ob; + } + + public void setOb(boolean ob) { + this.ob = ob; + } + + public boolean isTr() { + return tr; + } + + public void setTr(boolean tr) { + this.tr = tr; + } + + public boolean isPr() { + return pr; + } + + public void setPr(boolean pr) { + this.pr = pr; + } + + public boolean isPl() { + return pl; + } + + public void setPl(boolean pl) { + this.pl = pl; + } + + public boolean isKb() { + return kb; + } + + public void setKb(boolean kb) { + this.kb = kb; + } + + public boolean isHa() { + return ha; + } + + public void setHa(boolean ha) { + this.ha = ha; + } + + public boolean isMake() { + return make; + } + + public void setMake(boolean make) { + this.make = make; + } + + public boolean isVb() { + return vb; + } + + public void setVb(boolean vb) { + this.vb = vb; + } + + public boolean isTcetie() { + return tcetie; + } + + public void setTcetie(boolean tcetie) { + this.tcetie = tcetie; + } + + @CsvCustomBindByName(column = "End Asteroids", required = false, converter = XtoBool.class) + public boolean ea; + @CsvCustomBindByName(column = "Astroids", required = false, converter = XtoBool.class) + public boolean as; + @CsvCustomBindByName(column = "Barnard C", required = false, converter = XtoBool.class) + public boolean bc; + @CsvCustomBindByName(column = "Barnard E", required = false, converter = XtoBool.class) + public boolean be; + @CsvCustomBindByName(column = "Barnard F", required = false, converter = XtoBool.class) + public boolean bf; + @CsvCustomBindByName(column = "Mars", required = false, converter = XtoBool.class) + public boolean ma; + @CsvCustomBindByName(column = "Callisto", required = false, converter = XtoBool.class) + public boolean ca; + @CsvCustomBindByName(column = "Centauri Bb", required = false, converter = XtoBool.class) + public boolean cb; + @CsvCustomBindByName(column = "Ceres", required = false, converter = XtoBool.class) + public boolean ce; + @CsvCustomBindByName(column = "Twilight Forest", required = false, converter = XtoBool.class) + public boolean tf; + @CsvCustomBindByName(column = "Deep Dark", required = false, converter = XtoBool.class) + public boolean dd; + @CsvCustomBindByName(column = "Phobos", required = false, converter = XtoBool.class) + public boolean ph; + @CsvCustomBindByName(column = "Deimos", required = false, converter = XtoBool.class) + public boolean de; + @CsvCustomBindByName(column = "Europa", required = false, converter = XtoBool.class) + public boolean eu; + @CsvCustomBindByName(column = "Ganymede", required = false, converter = XtoBool.class) + public boolean ga; + @CsvCustomBindByName(column = "Io", required = false, converter = XtoBool.class) + public boolean io; + @CsvCustomBindByName(column = "Venus", required = false, converter = XtoBool.class) + public boolean ve; + @CsvCustomBindByName(column = "Mercury", required = false, converter = XtoBool.class) + public boolean me; + @CsvCustomBindByName(column = "Enceladus", required = false, converter = XtoBool.class) + public boolean en; + @CsvCustomBindByName(column = "Titan", required = false, converter = XtoBool.class) + public boolean ti; + @CsvCustomBindByName(column = "Miranda", required = false, converter = XtoBool.class) + public boolean mi; + @CsvCustomBindByName(column = "Oberon", required = false, converter = XtoBool.class) + public boolean ob; + @CsvCustomBindByName(column = "Triton", required = false, converter = XtoBool.class) + public boolean tr; + @CsvCustomBindByName(column = "Proteus", required = false, converter = XtoBool.class) + public boolean pr; + @CsvCustomBindByName(column = "Pluto", required = false, converter = XtoBool.class) + public boolean pl; + @CsvCustomBindByName(column = "Kuiper Belt", required = false, converter = XtoBool.class) + public boolean kb; + @CsvCustomBindByName(column = "Haumea", required = false, converter = XtoBool.class) + public boolean ha; + @CsvCustomBindByName(column = "Makemake", required = false, converter = XtoBool.class) + public boolean make; + @CsvCustomBindByName(column = "Vega B", required = false, converter = XtoBool.class) + public boolean vb; + @CsvCustomBindByName(column = "T Ceti E", required = false, converter = XtoBool.class) + public boolean tcetie; + + + + + public Oremix() { + } + + public void setOreName(String s) { + this.oreName = s; + } + public void setPrimary(String s) { + this.primary = s; + } + public void setSecondary(String s) { + this.secondary = s; + } + public void setInbetween(String s) { + this.inbetween = s; + } + public void setAround(String s) { + this.around = s; + } + public void setMix(String s) { + this.mix = s; + } + public void setTier(String s) { + this.tier = s; + } + public void setHeight(String s) { + this.height = s; + } + public void setDensity(int i) { + this.density = i; + } + public void setSize(int i) { + this.size = i; + } + public void setWeight(int i) { + this.weight = i; + } + public void setOverworld(boolean s) { + this.overworld = s; + } + public void setNether(boolean s) { + this.nether = s; + } + public void setEnd(boolean s) { + this.end = s; + } + + public String getOreName() { + return this.oreName; + } + + public String getPrimary() { + return this.primary; + } + public String getSecondary() { + return this.secondary; + } + public String getInbetween() { + return this.inbetween; + } + public String getAround() { + return this.around; + } + public String getMix() { + return this.mix; + } + public String getTier() { + return this.tier; + } + public String getHeight() { + return this.height; + } + public int getDensity() { + return this.density; + } + public int getSize() { + return this.size; + } + public int getWeight() { + return this.weight; + } + public int getMinY() { + calculateminmax(); + return this.miny; + } + public int getMaxY() { + calculateminmax(); + return this.maxy; + } + public boolean getOverworld() { + return this.overworld; + } + public boolean getNether() { + return this.nether; + } + public boolean getEnd() { + return this.end; + } + + private int miny,maxy; + + private void calculateminmax() { + this.miny=Integer.parseInt(this.height.split("-")[0]); + this.maxy=Integer.parseInt(this.height.split("-")[1]); + } + + public void setMinY(int i) { + this.miny=i; + } + public void setMaxY(int i) { + this.maxy=i; + } + + public String getHeightcalced() { + return new String (this.miny+"-"+this.maxy); + } + +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java b/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java new file mode 100644 index 0000000000..8c0ca7df58 --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java @@ -0,0 +1,28 @@ +package pers.gwyog.gtneioreplugin.util; + +import com.opencsv.bean.AbstractBeanField; +import com.opencsv.exceptions.CsvConstraintViolationException; +import com.opencsv.exceptions.CsvDataTypeMismatchException; + +public class Veinrenamer extends AbstractBeanField { + + @Override + protected Object convert(String value) throws CsvDataTypeMismatchException, CsvConstraintViolationException { + String ret = null; + CharSequence s = "/"; + + if (value.contains(s)) { + ret = value.split("/")[1]; + ret =ret.replaceAll("&", ""); + ret =ret.replaceAll(" ", ""); + ret =ret.replaceAll("\\.", ""); + ret = ret.toLowerCase(); + } + else + ret=value; + ret =ret.replaceAll(" ", ""); + ret = ret.toLowerCase(); + return ret; + } + +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java b/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java new file mode 100644 index 0000000000..7839221630 --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java @@ -0,0 +1,36 @@ +package pers.gwyog.gtneioreplugin.util; + +import java.util.ResourceBundle; + +import org.apache.commons.beanutils.ConversionException; +import org.apache.commons.beanutils.Converter; +import org.apache.commons.beanutils.converters.BooleanConverter; + +import com.opencsv.bean.AbstractBeanField; +import com.opencsv.exceptions.CsvConstraintViolationException; +import com.opencsv.exceptions.CsvDataTypeMismatchException; + +public class XtoBool extends AbstractBeanField { + + @Override + protected Object convert(String value) throws CsvDataTypeMismatchException, CsvConstraintViolationException { + if (value.isEmpty()) { + return null; + } + String[] trueStrings = {"x","X"}; + String[] falseStrings = {""}; + Converter bc = new BooleanConverter(trueStrings, falseStrings); + try { + return bc.convert(Boolean.class, value.trim()); + } catch (ConversionException e) { + CsvDataTypeMismatchException csve = new CsvDataTypeMismatchException( + value, field.getType(), ResourceBundle + .getBundle("convertGermanToBoolean", errorLocale) + .getString("input.not.boolean")); + csve.initCause(e); + throw csve; + } + } + + +} -- cgit From 060ec74acb87fa609de3e31ee084bbbd77f215c6 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Wed, 25 Apr 2018 00:10:13 +0200 Subject: Various Fixes +Fixed Astroid Dim Problem +fixed config not getting saved +fixed Vein Name beeing too long +fixed a random crash --- .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 1 + .../plugin/gregtech5/PluginGT5VeinStat.java | 11 ++++-- .../gtneioreplugin/util/GT5OreSmallHelper.java | 2 + .../pers/gwyog/gtneioreplugin/util/Oremix.java | 2 +- .../assets/gtneioreplugin/lang/en_US.lang | 46 +--------------------- 5 files changed, 13 insertions(+), 49 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index 0ce4ed0b81..032da37281 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -32,6 +32,7 @@ public class GTNEIOrePlugin { Config c = new Config(event, this.MODID+".cfg"); csv = c.tConfig.getBoolean("print csv","ALL", false, "princsv, you need apache commons collections to be injected in the minecraft jar."); CSVname = c.tConfig.getString("CSV_name", "ALL", event.getModConfigurationDirectory()+"/GTNH-Oresheet.csv", "rename the oresheet here, it will appear in /config"); + c.save(); } @EventHandler diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java index ddb130eec3..4cc76f2bf4 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -124,7 +124,7 @@ public class PluginGT5VeinStat extends PluginGT5Base { String Dims = getDims(oreLayer); - if (getLocalizedVeinName(oreLayer).length>1) { + /*if (getLocalizedVeinName(oreLayer).length>1) { GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[0], 2, 20, 0x404040, false); if (getLocalizedVeinName(oreLayer).length>2) { GuiDraw.drawString(I18n.format(getLocalizedVeinName(oreLayer)[1]), 2, 30, 0x404040, false); @@ -133,10 +133,13 @@ public class PluginGT5VeinStat extends PluginGT5Base { else GuiDraw.drawString(I18n.format(getLocalizedVeinName(oreLayer)[1]), 2, 30, 0x404040, false); } + else*/ + if (getGTOreLocalizedName(oreLayer.Meta[0]).contains("Ore")) + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]).split("Ore")[0] + " " +I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); + else if (getGTOreLocalizedName(oreLayer.Meta[0]).contains("Sand")) + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]).split("Sand")[0] + " " +I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); else - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[0], 2, 20, 0x404040, false); - - + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]) + " " +I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.primaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]), 2, 50, 0x404040, false); GuiDraw.drawString(I18n.format("gtnop.gui.nei.secondaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[1]), 2, 60, 0x404040, false); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java index fa09482efb..18aca0e5d8 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java @@ -32,6 +32,8 @@ public class GT5OreSmallHelper { 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; + if (meta<0) + break; material = GregTech_API.sGeneratedMaterials[meta]; mapOreSmallWrapper.put(worldGen.mWorldGenName, new OreSmallWrapper(worldGenSmallPieces)); if (!mapOreMetaToOreDrops.keySet().contains(meta)) { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java b/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java index 0835293f8d..1b1f44df67 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java @@ -285,7 +285,7 @@ public class Oremix { @CsvCustomBindByName(column = "End Asteroids", required = false, converter = XtoBool.class) public boolean ea; - @CsvCustomBindByName(column = "Astroids", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "AstroidBelt", required = false, converter = XtoBool.class) public boolean as; @CsvCustomBindByName(column = "Barnard C", required = false, converter = XtoBool.class) public boolean bc; diff --git a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang index bf6ce27511..a02ecb0b58 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang @@ -28,7 +28,7 @@ gtnop.gui.nei.ieVeinComponent=Vein components gtnop.gui.nei.fromMod=From mod gtnop.gui.nei.seeAll=See All - +gtnop.gui.nei.vein=Vein gtnop.gui.nei.oreOthers=Other ore gtnop.nei.genPosition=Position gtnop.nei.genPositionInfo=In the center of each chunk @@ -54,46 +54,4 @@ gtnop.ore.null.name=None # vein types gtnop.ore.vein.name=Vein gtnop.ore.asteroid.name=Asteriod -gtnop.ore.custom.name=Custom - - -# vein names -gtnop.ore.mix.naquadah=Naquadah -gtnop.ore.mix.lignite=Lignite -gtnop.ore.mix.coal=Coal -gtnop.ore.mix.magnetite=Magnetite -gtnop.ore.mix.gold=Gold -gtnop.ore.mix.iron=Iron -gtnop.ore.mix.cassiterite=Cassiterite -gtnop.ore.mix.tetrahedrite=Tetrahedrite -gtnop.ore.mix.netherquartz=Nether Quartz -gtnop.ore.mix.sulfur=Sulfur -gtnop.ore.mix.copper=Copper -gtnop.ore.mix.bauxite=Bauxite -gtnop.ore.mix.salts=Salts -gtnop.ore.mix.redstone=Redstone -gtnop.ore.mix.soapstone=Soapstone -gtnop.ore.mix.nickel=Nickel -gtnop.ore.mix.platinum=Platinum -gtnop.ore.mix.pitchblende=Pitchblends -gtnop.ore.mix.uranium=Uranium -gtnop.ore.mix.monazite=Monazite -gtnop.ore.mix.molybdenum=Molybdenum -gtnop.ore.mix.tungstate=Tungstate -gtnop.ore.mix.sapphire=Sapphire -gtnop.ore.mix.manganese=Manganese -gtnop.ore.mix.quartz=Quartz -gtnop.ore.mix.diamond=Diamond -gtnop.ore.mix.olivine=Olivine -gtnop.ore.mix.apatite=Apatite -gtnop.ore.mix.galena=Galena -gtnop.ore.mix.lapis=Lapis -gtnop.ore.mix.beryllium=Beryllium -gtnop.ore.mix.oilsand=Oilsand -gtnop.ore.mix.plutonium=Plutonium -gtnop.ore.mix.iodinesalt=Iodinesalt -gtnop.ore.mix.rocksalt=Rocksalt -gtnop.ore.mix.asbestos=Asbestos -gtnop.ore.mix.titanium=Titanium -gtnop.ore.mix.garnet=Garnet -gtnop.ore.mix.dolamide=Dolamide \ No newline at end of file +gtnop.ore.custom.name=Custom \ No newline at end of file -- cgit From 0864ce31bcc1c0535b5caece2cf893dfca7efacd Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Wed, 25 Apr 2018 00:11:42 +0200 Subject: version bump --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index e9fd886ad3..aaea21bf0a 100644 --- a/build.gradle +++ b/build.gradle @@ -19,9 +19,9 @@ buildscript { apply plugin: 'forge' import de.undercouch.gradle.tasks.download.Download -version = "1.7.10-1.0.5-GT-NH" +version = "1.7.10-1.0.6-GT-NH" group= "pers.gwyog.gtneioreplugin" -archivesBaseName = "gtneioreplugin-csv" +archivesBaseName = "gtneioreplugin" sourceCompatibility = 1.7 targetCompatibility = 1.7 -- cgit From 0be290d7cf3003ae41276524b49932c17d90e4f5 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Wed, 25 Apr 2018 13:15:11 +0200 Subject: name fix for csv export --- .../java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index 073147696c..0fb7540244 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -53,13 +53,7 @@ public class GT5OreLayerHelper { Map.Entry pair = (Map.Entry)it.next(); String Dims = PluginGT5VeinStat.getDims((OreLayerWrapper)pair.getValue()); OreLayerWrapper oreLayer = (OreLayerWrapper) pair.getValue(); - if (PluginGT5VeinStat.getLocalizedVeinName(oreLayer).length>2) - oremix.setOreName(PluginGT5VeinStat.getLocalizedVeinName(oreLayer)[0]+PluginGT5VeinStat.getLocalizedVeinName(oreLayer)[1]+PluginGT5VeinStat.getLocalizedVeinName(oreLayer)[2]); - else if (PluginGT5VeinStat.getLocalizedVeinName(oreLayer).length>1) - oremix.setOreName(PluginGT5VeinStat.getLocalizedVeinName(oreLayer)[0]+PluginGT5VeinStat.getLocalizedVeinName(oreLayer)[1]); - else - oremix.setOreName(PluginGT5VeinStat.getLocalizedVeinName(oreLayer)[0]); - + oremix.setOreName(oreLayer.veinName.split("\\.")[2]); oremix.setPrimary(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[0])); oremix.setSecondary(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[1])); oremix.setInbetween(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[2])); @@ -68,7 +62,7 @@ public class GT5OreLayerHelper { oremix.setHeight(oreLayer.worldGenHeightRange); oremix.setDensity(oreLayer.density); oremix.setWeight(oreLayer.randomWeight); - oremix.setMix("\'"+Integer.toString(oreLayer.Meta[0])+"|"+Integer.toString(oreLayer.Meta[1])+"|"+Integer.toString(oreLayer.Meta[2])+"|"+Integer.toString(oreLayer.Meta[3])+"\'"); + oremix.setMix(Integer.toString(oreLayer.Meta[0])+"|"+Integer.toString(oreLayer.Meta[1])+"|"+Integer.toString(oreLayer.Meta[2])+"|"+Integer.toString(oreLayer.Meta[3])); oremix.as=Dims.contains("As"); oremix.bc=Dims.contains("BC"); oremix.be=Dims.contains("BE"); -- cgit From 83f6f8f542265968e47709353495bfef91c04d94 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Mon, 30 Apr 2018 18:40:07 +0200 Subject: hotfix for NoClassDefFoundError --- .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 6 +- .../gtneioreplugin/util/GT5OreLayerHelper.java | 92 +++++++++++----------- 2 files changed, 50 insertions(+), 48 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index 032da37281..e04444ad7c 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -19,7 +19,7 @@ public class GTNEIOrePlugin { public static final String MODID = "gtneioreplugin"; public static final String NAME = "GT NEI Ore Plugin GT:NH Mod"; public static final String VERSION = "@version@"; - public static boolean csv; + public static boolean csv = false; public static String CSVname; public static List OreVeins=new ArrayList(); public static HashSet OreV=new HashSet(); @@ -38,8 +38,10 @@ public class GTNEIOrePlugin { @EventHandler public void onLoadComplete(FMLLoadCompleteEvent event) { if (event.getSide() == Side.CLIENT) { - new GT5OreLayerHelper(); + GT5OreLayerHelper h = new GT5OreLayerHelper(); new GT5OreSmallHelper(); + if (csv) + h.make_csv(); } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index 0fb7540244..b3041f13c0 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -44,8 +44,53 @@ public class GT5OreLayerHelper { DimIDs[i]=0; for (GT_Worldgen_GT_Ore_Layer tWorldGen: GT_Worldgen_GT_Ore_Layer.sList) mapOreLayerWrapper.put(tWorldGen.mWorldGenName, new OreLayerWrapper(tWorldGen)); + } + + public class OreLayerWrapper { + public String veinName,worldGenHeightRange, weightedIEChance; + public short[] Meta = new short[4]; + public short randomWeight, size, density; + public List Weight = new ArrayList(); - if (GTNEIOrePlugin.csv) { + public OreLayerWrapper(GT_Worldgen_GT_Ore_Layer worldGen) { + this.veinName = worldGen.mWorldGenName; + this.Meta[0] = worldGen.mPrimaryMeta; + this.Meta[1] = worldGen.mSecondaryMeta; + this.Meta[2] = worldGen.mBetweenMeta; + this.Meta[3] = worldGen.mSporadicMeta; + this.size = worldGen.mSize; + this.density = worldGen.mDensity; + this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; + this.randomWeight = worldGen.mWeight; + } + } + + public static List Combsort(List liste) { + List liste2 = new ArrayList(liste.size()); + for (Oremix element : liste) { + liste2.add(element); + } + + int schritt = liste2.size(); + boolean vertauscht = false; + do { + vertauscht = false; + if (schritt > 1) { + schritt = (int) (schritt / 1.3); + } + for (int i = 0; i < liste2.size() - schritt; i++) { + if (liste2.get(i).getOreName().substring(0, 3).compareTo((liste2.get(i + schritt).getOreName().substring(0, 3))) > 0) { + T tmp = (T) liste2.get(i); + liste2.set(i, liste2.get(i + schritt)); + liste2.set(i + schritt, (Oremix) tmp); + vertauscht = true; + } + } + } while (vertauscht || schritt > 1); + return liste2; + } + + public static void make_csv() { Iterator it = mapOreLayerWrapper.entrySet().iterator(); while (it.hasNext()) { Oremix oremix = new Oremix(); @@ -133,51 +178,6 @@ public class GT5OreLayerHelper { // TODO Auto-generated catch block e.printStackTrace(); } - } - } - - public class OreLayerWrapper { - public String veinName,worldGenHeightRange, weightedIEChance; - public short[] Meta = new short[4]; - public short randomWeight, size, density; - public List Weight = new ArrayList(); - - public OreLayerWrapper(GT_Worldgen_GT_Ore_Layer worldGen) { - this.veinName = worldGen.mWorldGenName; - this.Meta[0] = worldGen.mPrimaryMeta; - this.Meta[1] = worldGen.mSecondaryMeta; - this.Meta[2] = worldGen.mBetweenMeta; - this.Meta[3] = worldGen.mSporadicMeta; - this.size = worldGen.mSize; - this.density = worldGen.mDensity; - this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; - this.randomWeight = worldGen.mWeight; - } - } - - public static List Combsort(List liste) { - List liste2 = new ArrayList(liste.size()); - for (Oremix element : liste) { - liste2.add(element); } - - int schritt = liste2.size(); - boolean vertauscht = false; - do { - vertauscht = false; - if (schritt > 1) { - schritt = (int) (schritt / 1.3); - } - for (int i = 0; i < liste2.size() - schritt; i++) { - if (liste2.get(i).getOreName().substring(0, 3).compareTo((liste2.get(i + schritt).getOreName().substring(0, 3))) > 0) { - T tmp = (T) liste2.get(i); - liste2.set(i, liste2.get(i + schritt)); - liste2.set(i + schritt, (Oremix) tmp); - vertauscht = true; - } - } - } while (vertauscht || schritt > 1); - return liste2; - } } \ No newline at end of file -- cgit From e2c8a04abd39d3d3be2256156adb16938a26dea8 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Thu, 3 May 2018 20:25:04 +0200 Subject: Crashfix 2.0 +moved all CSV-related stuff into own Class. Wiki Article on how to make a spreadsheet: https://gtnh.miraheze.org/wiki/GT-NEI-Ore-Plugin_Spreadsheet_Export_Tutorial --- .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 13 +- .../pers/gwyog/gtneioreplugin/util/CSVMaker.java | 137 +++++++++++++++++++++ .../gtneioreplugin/util/GT5OreLayerHelper.java | 117 +----------------- src/main/resources/mcmod.info | 2 +- 4 files changed, 144 insertions(+), 125 deletions(-) create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index e04444ad7c..c781991fe6 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -1,8 +1,6 @@ package pers.gwyog.gtneioreplugin; -import java.util.ArrayList; import java.util.HashSet; -import java.util.List; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; @@ -12,7 +10,6 @@ import cpw.mods.fml.relauncher.Side; import net.minecraft.init.Items; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; -import pers.gwyog.gtneioreplugin.util.Oremix; @Mod(modid = GTNEIOrePlugin.MODID, name = GTNEIOrePlugin.NAME, version = GTNEIOrePlugin.VERSION, dependencies = "required-after:gregtech;required-after:NotEnoughItems") public class GTNEIOrePlugin { @@ -21,7 +18,6 @@ public class GTNEIOrePlugin { public static final String VERSION = "@version@"; public static boolean csv = false; public static String CSVname; - public static List OreVeins=new ArrayList(); public static HashSet OreV=new HashSet(); @Mod.Instance(MODID) @@ -38,10 +34,11 @@ public class GTNEIOrePlugin { @EventHandler public void onLoadComplete(FMLLoadCompleteEvent event) { if (event.getSide() == Side.CLIENT) { - GT5OreLayerHelper h = new GT5OreLayerHelper(); - new GT5OreSmallHelper(); - if (csv) - h.make_csv(); + new GT5OreLayerHelper(); + new GT5OreSmallHelper(); + if (csv) { + new pers.gwyog.gtneioreplugin.util.CSVMaker().run(); + } } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java b/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java new file mode 100644 index 0000000000..82a2f4f341 --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java @@ -0,0 +1,137 @@ +package pers.gwyog.gtneioreplugin.util; + +import java.io.BufferedWriter; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import com.opencsv.CSVWriter; +import com.opencsv.bean.ColumnPositionMappingStrategy; +import com.opencsv.bean.StatefulBeanToCsv; +import com.opencsv.bean.StatefulBeanToCsvBuilder; + +import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; +import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat; +import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; + +public class CSVMaker implements Runnable { + + public CSVMaker() { + + } + + public static List Combsort(List liste) { + try { + List liste2 = new ArrayList(liste.size()); + for (Oremix element : liste) { + liste2.add(element); + } + + int schritt = liste2.size(); + boolean vertauscht = false; + do { + vertauscht = false; + if (schritt > 1) { + schritt = (int) (schritt / 1.3); + } + for (int i = 0; i < liste2.size() - schritt; i++) { + if (liste2.get(i).getOreName().substring(0, 3).compareTo((liste2.get(i + schritt).getOreName().substring(0, 3))) > 0) { + T tmp = (T) liste2.get(i); + liste2.set(i, liste2.get(i + schritt)); + liste2.set(i + schritt, (Oremix) tmp); + vertauscht = true; + } + } + } while (vertauscht || schritt > 1); + return liste2; + }catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + public void run() { + try { + Iterator it = GT5OreLayerHelper.mapOreLayerWrapper.entrySet().iterator(); + List OreVeins=new ArrayList(); + while (it.hasNext()) { + Oremix oremix = new Oremix(); + + Map.Entry pair = (Map.Entry)it.next(); + String Dims = PluginGT5VeinStat.getDims((OreLayerWrapper)pair.getValue()); + OreLayerWrapper oreLayer = (OreLayerWrapper) pair.getValue(); + oremix.setOreName(oreLayer.veinName.split("\\.")[2]); + oremix.setPrimary(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[0])); + oremix.setSecondary(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[1])); + oremix.setInbetween(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[2])); + oremix.setAround(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[3])); + oremix.setSize(oreLayer.size); + oremix.setHeight(oreLayer.worldGenHeightRange); + oremix.setDensity(oreLayer.density); + oremix.setWeight(oreLayer.randomWeight); + oremix.setMix(Integer.toString(oreLayer.Meta[0])+"|"+Integer.toString(oreLayer.Meta[1])+"|"+Integer.toString(oreLayer.Meta[2])+"|"+Integer.toString(oreLayer.Meta[3])); + oremix.as=Dims.contains("As"); + oremix.bc=Dims.contains("BC"); + oremix.be=Dims.contains("BE"); + oremix.bf=Dims.contains("BF"); + oremix.ca=Dims.contains("Ca"); + oremix.cb=Dims.contains("CA"); + oremix.ce=Dims.contains("Ce"); + oremix.dd=Dims.contains("DD"); + oremix.de=Dims.contains("De"); + oremix.ea=Dims.contains("EA"); + oremix.en=Dims.contains("En"); + oremix.eu=Dims.contains("Eu"); + oremix.ga=Dims.contains("Ga"); + oremix.ha=Dims.contains("Ha"); + oremix.io=Dims.contains("Io"); + oremix.kb=Dims.contains("KB"); + oremix.make=Dims.contains("MM"); + oremix.ma=Dims.contains("Ma"); + oremix.me=Dims.contains("Me"); + oremix.mi=Dims.contains("Mi"); + oremix.mo=Dims.contains("Mo"); + oremix.ob=Dims.contains("Ob"); + oremix.ph=Dims.contains("Ph"); + oremix.pl=Dims.contains("Pl"); + oremix.pr=Dims.contains("Pr"); + oremix.tcetie=Dims.contains("TE"); + oremix.tf=Dims.contains("TF"); + oremix.ti=Dims.contains("Ti"); + oremix.tr=Dims.contains("Tr"); + oremix.vb=Dims.contains("VB"); + oremix.ve=Dims.contains("Ve"); + oremix.setOverworld(Dims.contains("Ow")); + oremix.setNether(Dims.contains("Ne")); + oremix.setEnd(Dims.contains("EN")); + OreVeins.add(oremix); + + + System.out.println(pair.getKey() + " = " + pair.getValue()); + it.remove(); // avoids a ConcurrentModificationException + } + BufferedWriter one = Files.newBufferedWriter(Paths.get(GTNEIOrePlugin.CSVname)); + ColumnPositionMappingStrategy strat = new ColumnPositionMappingStrategy(); + strat.setType(Oremix.class); + String[] columns = "ORENAME,PRIMARY,SECONDARY,INBETWEEN,AROUND,mix,TIER,HEIGHT,DENSITY,SIZE,WEIGHT,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie".split("\\,"); + strat.setColumnMapping(columns); + StatefulBeanToCsv beanToCsv = new StatefulBeanToCsvBuilder(one) + .withQuotechar(CSVWriter.NO_QUOTE_CHARACTER) + .withMappingStrategy(strat) + .build(); + List towrite = Combsort(OreVeins); + one.write("Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E"); + one.newLine(); + beanToCsv.write(towrite); + one.flush(); + one.close(); + + }catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index b3041f13c0..2b6e286174 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -47,7 +47,7 @@ public class GT5OreLayerHelper { } public class OreLayerWrapper { - public String veinName,worldGenHeightRange, weightedIEChance; + public String veinName, worldGenHeightRange, weightedIEChance; public short[] Meta = new short[4]; public short randomWeight, size, density; public List Weight = new ArrayList(); @@ -64,120 +64,5 @@ public class GT5OreLayerHelper { this.randomWeight = worldGen.mWeight; } } - - public static List Combsort(List liste) { - List liste2 = new ArrayList(liste.size()); - for (Oremix element : liste) { - liste2.add(element); - } - - int schritt = liste2.size(); - boolean vertauscht = false; - do { - vertauscht = false; - if (schritt > 1) { - schritt = (int) (schritt / 1.3); - } - for (int i = 0; i < liste2.size() - schritt; i++) { - if (liste2.get(i).getOreName().substring(0, 3).compareTo((liste2.get(i + schritt).getOreName().substring(0, 3))) > 0) { - T tmp = (T) liste2.get(i); - liste2.set(i, liste2.get(i + schritt)); - liste2.set(i + schritt, (Oremix) tmp); - vertauscht = true; - } - } - } while (vertauscht || schritt > 1); - return liste2; - } - - public static void make_csv() { - Iterator it = mapOreLayerWrapper.entrySet().iterator(); - while (it.hasNext()) { - Oremix oremix = new Oremix(); - - Map.Entry pair = (Map.Entry)it.next(); - String Dims = PluginGT5VeinStat.getDims((OreLayerWrapper)pair.getValue()); - OreLayerWrapper oreLayer = (OreLayerWrapper) pair.getValue(); - oremix.setOreName(oreLayer.veinName.split("\\.")[2]); - oremix.setPrimary(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[0])); - oremix.setSecondary(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[1])); - oremix.setInbetween(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[2])); - oremix.setAround(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[3])); - oremix.setSize(oreLayer.size); - oremix.setHeight(oreLayer.worldGenHeightRange); - oremix.setDensity(oreLayer.density); - oremix.setWeight(oreLayer.randomWeight); - oremix.setMix(Integer.toString(oreLayer.Meta[0])+"|"+Integer.toString(oreLayer.Meta[1])+"|"+Integer.toString(oreLayer.Meta[2])+"|"+Integer.toString(oreLayer.Meta[3])); - oremix.as=Dims.contains("As"); - oremix.bc=Dims.contains("BC"); - oremix.be=Dims.contains("BE"); - oremix.bf=Dims.contains("BF"); - oremix.ca=Dims.contains("Ca"); - oremix.cb=Dims.contains("CA"); - oremix.ce=Dims.contains("Ce"); - oremix.dd=Dims.contains("DD"); - oremix.de=Dims.contains("De"); - oremix.ea=Dims.contains("EA"); - oremix.en=Dims.contains("En"); - oremix.eu=Dims.contains("Eu"); - oremix.ga=Dims.contains("Ga"); - oremix.ha=Dims.contains("Ha"); - oremix.io=Dims.contains("Io"); - oremix.kb=Dims.contains("KB"); - oremix.make=Dims.contains("MM"); - oremix.ma=Dims.contains("Ma"); - oremix.me=Dims.contains("Me"); - oremix.mi=Dims.contains("Mi"); - oremix.mo=Dims.contains("Mo"); - oremix.ob=Dims.contains("Ob"); - oremix.ph=Dims.contains("Ph"); - oremix.pl=Dims.contains("Pl"); - oremix.pr=Dims.contains("Pr"); - oremix.tcetie=Dims.contains("TE"); - oremix.tf=Dims.contains("TF"); - oremix.ti=Dims.contains("Ti"); - oremix.tr=Dims.contains("Tr"); - oremix.vb=Dims.contains("VB"); - oremix.ve=Dims.contains("Ve"); - oremix.setOverworld(Dims.contains("Ow")); - oremix.setNether(Dims.contains("Ne")); - oremix.setEnd(Dims.contains("EN")); - GTNEIOrePlugin.OreVeins.add(oremix); - - - System.out.println(pair.getKey() + " = " + pair.getValue()); - it.remove(); // avoids a ConcurrentModificationException - } - BufferedWriter one = null; - try { - one = Files.newBufferedWriter(Paths.get(GTNEIOrePlugin.CSVname)); - } catch (IOException e1) { - e1.printStackTrace(); - } - - ColumnPositionMappingStrategy strat = new ColumnPositionMappingStrategy(); - strat.setType(Oremix.class); - String[] columns = "ORENAME,PRIMARY,SECONDARY,INBETWEEN,AROUND,mix,TIER,HEIGHT,DENSITY,SIZE,WEIGHT,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie".split("\\,"); - strat.setColumnMapping(columns); - StatefulBeanToCsv beanToCsv = new StatefulBeanToCsvBuilder(one) - .withQuotechar(CSVWriter.NO_QUOTE_CHARACTER) - .withMappingStrategy(strat) - .build(); - List towrite = Combsort(GTNEIOrePlugin.OreVeins); - try { - one.write("Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E"); - one.newLine(); - beanToCsv.write(towrite); - } catch (Exception e) { - e.printStackTrace(); - } - try { - one.flush(); - one.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } } \ No newline at end of file diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index d553921d26..67282f3b03 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "gtneioreplugin", "name": "GT NEI Ore Plugin GT:NH Mod", "description": "A forge mod which adds NEI plugins for GregTech5's ores. Modded for GT:NH", - "version": "v1.0.4-GTNH", + "version": "v1.0.6c-GTNH", "mcversion": "1.7.10", "url": "", "updateUrl": "", -- cgit From b68623b6d0af6476bb388eb64e55d205907c931c Mon Sep 17 00:00:00 2001 From: Namikon Date: Thu, 3 May 2018 23:55:33 +0200 Subject: New jenkins source JarSign --- build.gradle | 18 +++++++++++++++++- build.properties | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index aaea21bf0a..a27385b152 100644 --- a/build.gradle +++ b/build.gradle @@ -17,6 +17,7 @@ buildscript { } apply plugin: 'forge' +apply plugin: 'signing' import de.undercouch.gradle.tasks.download.Download version = "1.7.10-1.0.6-GT-NH" @@ -59,7 +60,7 @@ task getGregTech(type: Download) { onlyIf { !file("libs/gregtech-${config.gregtech.version}-dev.jar").exists() } - src "http://jenkins.usrv.de:8081/job/Gregtech-5-Unofficial/${config.gregtech.jenkinsbuild}/artifact/build/libs/gregtech-${config.gregtech.version}-dev.jar" + src "http://jenkins.usrv.eu:8080/job/Gregtech-5-Unofficial/${config.gregtech.jenkinsbuild}/artifact/build/libs/gregtech-${config.gregtech.version}-dev.jar" dest file("libs/gregtech-${config.gregtech.version}-dev.jar") mustRunAfter "deobfBinJar" mustRunAfter "repackMinecraft" @@ -89,3 +90,18 @@ processResources exclude 'mcmod.info' } } + +task signJar(dependsOn: 'reobf'){ + doLast { + ant.signjar( + destDir: jar.destinationDir, + jar: jar.getArchivePath(), + alias: findProperty('keyStoreAlias') ?: '', + keystore: findProperty('keyStore') ?: '', + storepass: findProperty('keyStorePass') ?: '', + digestalg: findProperty('signDigestAlg') ?: '', + tsaurl: findProperty('signTSAurl') ?: '', + verbose: true + ) + } +} diff --git a/build.properties b/build.properties index e5849c14be..7d51ba995d 100644 --- a/build.properties +++ b/build.properties @@ -1,5 +1,5 @@ -gregtech.version=5.09.32.19 -gregtech.jenkinsbuild=1037 +gregtech.version=5.09.32.22 +gregtech.jenkinsbuild=2 croploadcore.version=0.0.8 minecraft.version=1.7.10 ccl.version=1.1.3.140 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 678d9d8de3..aae599bbfa 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip -- cgit From a0bfd778cc565865f31653e4c82b9c219a3fe69c Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Wed, 27 Mar 2019 08:23:29 +0100 Subject: 1.0.7 + updated Java 7 -> 8 + Buffered Input from cfg + refractor, code improvements + small ores completely working + added tooltip + added logger + added ic2 to gradle + updated gradle deps + restored base gt compability + small ore csv (untested) Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> --- .gitignore | 5 + build.gradle | 13 +- build.properties | 7 +- .../java/pers/gwyog/gtneioreplugin/Config.java | 25 +- .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 42 +- .../gtneioreplugin/plugin/NEIPluginConfig.java | 25 +- .../gwyog/gtneioreplugin/plugin/PluginBase.java | 19 +- .../plugin/gregtech5/PluginGT5Base.java | 91 +- .../plugin/gregtech5/PluginGT5SmallOreStat.java | 149 ++-- .../plugin/gregtech5/PluginGT5VeinStat.java | 394 +++++---- .../pers/gwyog/gtneioreplugin/util/CSVMaker.java | 272 +++--- .../gwyog/gtneioreplugin/util/DimensionHelper.java | 189 +++-- .../gwyog/gtneioreplugin/util/GT5CFGHelper.java | 291 ++++--- .../gtneioreplugin/util/GT5OreLayerHelper.java | 60 +- .../gtneioreplugin/util/GT5OreSmallHelper.java | 104 ++- .../pers/gwyog/gtneioreplugin/util/Oremix.java | 914 +++++++++++---------- .../gwyog/gtneioreplugin/util/Veinrenamer.java | 33 +- .../pers/gwyog/gtneioreplugin/util/XtoBool.java | 23 +- 18 files changed, 1454 insertions(+), 1202 deletions(-) diff --git a/.gitignore b/.gitignore index f53f3d8eef..0b6a00d78f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ eclipse/ .project libs/ libs2/ +out/ # Compiled class file *.class @@ -21,6 +22,10 @@ libs2/ # Mobile Tools for Java (J2ME) .mtj.tmp/ +*.ipr +*.iws +*.iml + # Package Files # *.war *.ear diff --git a/build.gradle b/build.gradle index aaea21bf0a..ab8a17e9e3 100644 --- a/build.gradle +++ b/build.gradle @@ -19,12 +19,12 @@ buildscript { apply plugin: 'forge' import de.undercouch.gradle.tasks.download.Download -version = "1.7.10-1.0.6-GT-NH" +version = "1.7.10-1.0.7" group= "pers.gwyog.gtneioreplugin" archivesBaseName = "gtneioreplugin" -sourceCompatibility = 1.7 -targetCompatibility = 1.7 +sourceCompatibility = 1.8 +targetCompatibility = 1.8 minecraft { version = "1.7.10-10.13.4.1614-1.7.10" @@ -44,6 +44,10 @@ repositories { maven { name "ChickenBones" url "http://chickenbones.net/maven/" + } + maven { + name = "ic2" + url = "http://maven.ic2.player.to/" } } @@ -53,13 +57,14 @@ dependencies { compile "codechicken:CodeChickenCore:${config.minecraft.version}-${config.ccc.version}:dev" compile "codechicken:NotEnoughItems:${config.minecraft.version}-${config.nei.version}:dev" compile "com.opencsv:opencsv:4.0" + compile "net.industrial-craft:industrialcraft-2:${config.ic2.version}:dev" } task getGregTech(type: Download) { onlyIf { !file("libs/gregtech-${config.gregtech.version}-dev.jar").exists() } - src "http://jenkins.usrv.de:8081/job/Gregtech-5-Unofficial/${config.gregtech.jenkinsbuild}/artifact/build/libs/gregtech-${config.gregtech.version}-dev.jar" + src "http://jenkins.usrv.eu:8080/job/Gregtech-5-Unofficial/${config.gregtech.jenkinsbuild}/artifact/build/libs/gregtech-${config.gregtech.version}-dev.jar" dest file("libs/gregtech-${config.gregtech.version}-dev.jar") mustRunAfter "deobfBinJar" mustRunAfter "repackMinecraft" diff --git a/build.properties b/build.properties index e5849c14be..1af417224e 100644 --- a/build.properties +++ b/build.properties @@ -1,7 +1,8 @@ -gregtech.version=5.09.32.19 -gregtech.jenkinsbuild=1037 +gregtech.version=5.09.33.12 +gregtech.jenkinsbuild=265 croploadcore.version=0.0.8 minecraft.version=1.7.10 ccl.version=1.1.3.140 ccc.version=1.0.7.47 -nei.version=1.0.5.120 \ No newline at end of file +nei.version=1.0.5.120 +ic2.version=2.2.828-experimental \ No newline at end of file diff --git a/src/main/java/pers/gwyog/gtneioreplugin/Config.java b/src/main/java/pers/gwyog/gtneioreplugin/Config.java index 62a94de43b..c31ebc63a6 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/Config.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/Config.java @@ -1,19 +1,22 @@ package pers.gwyog.gtneioreplugin; -import java.io.File; - import cpw.mods.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.common.config.Configuration; +import java.io.File; + public class Config { public Configuration tConfig; - public Config(FMLPreInitializationEvent preinit,String cfgname) { - File tFile = new File(preinit.getModConfigurationDirectory(), cfgname); - tConfig = new Configuration(tFile); - tConfig.load(); - } - public void save () { - tConfig.save(); - } - + + public Config(FMLPreInitializationEvent preinit, String cfgname) { + File tFile = new File(preinit.getModConfigurationDirectory(), cfgname); + tConfig = new Configuration(tFile); + tConfig.load(); + } + + public void save() { + if (tConfig.hasChanged()) + tConfig.save(); + } + } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index c781991fe6..c62a196bb4 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -1,45 +1,53 @@ package pers.gwyog.gtneioreplugin; -import java.util.HashSet; - import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLLoadCompleteEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.relauncher.Side; -import net.minecraft.init.Items; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; +import java.util.HashSet; + @Mod(modid = GTNEIOrePlugin.MODID, name = GTNEIOrePlugin.NAME, version = GTNEIOrePlugin.VERSION, dependencies = "required-after:gregtech;required-after:NotEnoughItems") public class GTNEIOrePlugin { public static final String MODID = "gtneioreplugin"; public static final String NAME = "GT NEI Ore Plugin GT:NH Mod"; public static final String VERSION = "@version@"; + public static final Logger LOG = LogManager.getLogger(NAME); public static boolean csv = false; - public static String CSVname; - public static HashSet OreV=new HashSet(); - + public static String CSVname; + public static String CSVnameSmall; + public static HashSet OreV = new HashSet(); + public static boolean hideBackground = true; + public static boolean toolTips = true; @Mod.Instance(MODID) public static GTNEIOrePlugin instance; - + @EventHandler public void preinit(FMLPreInitializationEvent event) { - Config c = new Config(event, this.MODID+".cfg"); - csv = c.tConfig.getBoolean("print csv","ALL", false, "princsv, you need apache commons collections to be injected in the minecraft jar."); - CSVname = c.tConfig.getString("CSV_name", "ALL", event.getModConfigurationDirectory()+"/GTNH-Oresheet.csv", "rename the oresheet here, it will appear in /config"); - c.save(); + Config c = new Config(event, this.MODID + ".cfg"); + csv = c.tConfig.getBoolean("print csv", "ALL", false, "princsv, you need apache commons collections to be injected in the minecraft jar."); + CSVname = c.tConfig.getString("CSV_name", "ALL", event.getModConfigurationDirectory() + "/GTNH-Oresheet.csv", "rename the oresheet here, it will appear in /config"); + CSVnameSmall= c.tConfig.getString("CSV_name_for_Small_Ore_Sheet", "ALL", event.getModConfigurationDirectory() + "/GTNH-Small-Ores-Sheet.csv", "rename the oresheet here, it will appear in /config"); + hideBackground = c.tConfig.getBoolean("Hide Background", "ALL", true, "Hides the Background when the tooltip for the Dimensions is rendered"); + toolTips = c.tConfig.getBoolean("DimTooltip", "ALL", true, "Activates Dimensison Tooltips"); + + c.save(); } - + @EventHandler public void onLoadComplete(FMLLoadCompleteEvent event) { if (event.getSide() == Side.CLIENT) { - new GT5OreLayerHelper(); + new GT5OreLayerHelper(); new GT5OreSmallHelper(); - if (csv) { - new pers.gwyog.gtneioreplugin.util.CSVMaker().run(); - } - } + if (csv) { + new pers.gwyog.gtneioreplugin.util.CSVMaker().run(); } + } + } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java index 06133bebcc..8283b3b263 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java @@ -2,12 +2,11 @@ package pers.gwyog.gtneioreplugin.plugin; 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.plugin.gregtech5.PluginGT5AsteroidStat; import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5SmallOreStat; import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat; -import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; + +//import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5AsteroidStat; public class NEIPluginConfig implements IConfigureNEI { @@ -23,14 +22,14 @@ public class NEIPluginConfig implements IConfigureNEI { @Override public void loadConfig() { - 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); - } + 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); } +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java index cbca2a66c6..9186eddcbd 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java @@ -1,20 +1,19 @@ 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; +import java.awt.*; + public class PluginBase extends TemplateRecipeHandler { @Override public int recipiesPerPage() { return 1; } - + @Override public String getRecipeName() { return null; @@ -24,17 +23,17 @@ public class PluginBase extends TemplateRecipeHandler { 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())); + transferRects.add(new RecipeTransferRect(new Rectangle(getGuiWidth() - stringLength - 3, 5, stringLength, 9), getOutputId())); } - + public String getOutputId() { return null; } - + public String getWorldNameTranslated(boolean genOverworld) { String worldNameTranslated = ""; if (genOverworld) { @@ -44,9 +43,9 @@ public class PluginBase extends TemplateRecipeHandler { } return worldNameTranslated; } - + public int getGuiWidth() { return 166; } - + } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java index 1d612d8c9c..88775c3e14 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java @@ -1,31 +1,88 @@ package pers.gwyog.gtneioreplugin.plugin.gregtech5; +import codechicken.lib.gui.GuiDraw; +import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.util.GT_LanguageManager; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; import pers.gwyog.gtneioreplugin.plugin.PluginBase; +import pers.gwyog.gtneioreplugin.util.DimensionHelper; + +import java.util.List; + +import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.hideBackground; +import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.toolTips; 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; + + protected boolean ttDisplayed = false; + + protected static String getLocalizedNameForItem(Materials aMaterial, String aFormat) { + return String.format(aFormat.replace("%s", "%temp").replace("%material", "%s"), aMaterial.mDefaultLocalName).replace("%temp", "%s"); + } + + protected static int calculateMaxW(List L) { + int w = 0; + FontRenderer font = GuiDraw.fontRenderer; + for (int i = 0; i < L.size(); ++i) { + String s = (String) L.get(i); + w = Math.max(font.getStringWidth(s), w); + } + return w; + } + + protected static String getLocalizedNameForItem(String aFormat, int aMaterialID) { + if (aMaterialID >= 0 && aMaterialID < 1000) { + Materials aMaterial = GregTech_API.sGeneratedMaterials[aMaterialID]; + if (aMaterial != null) { + return getLocalizedNameForItem(aMaterial, aFormat); + } + } + return aFormat; } - + public static String getGTOreLocalizedName(short index) { - - if (!Materials.getLocalizedNameForItem(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)), index%1000).contains("Awakened")) - return Materials.getLocalizedNameForItem(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)), index%1000); - else - return "Aw. Draconium Ore"; + + if (!getLocalizedNameForItem(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)), index % 1000).contains("Awakened")) + return getLocalizedNameForItem(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)), index % 1000); + else + return "Aw. Draconium Ore"; } - - public static String getGTOreUnlocalizedName(short index) { + + protected static String getGTOreUnlocalizedName(short index) { return "gt.blockores." + index + ".name"; } + protected void drawToolTip(String sDimNames) { + if (toolTips) { + ttDisplayed = false; + if (GuiDraw.getMousePosition().y > (int) (Minecraft.getMinecraft().currentScreen.height * 0.6f) && GuiDraw.getMousePosition().y < (int) (Minecraft.getMinecraft().currentScreen.height * 0.8f)) { + List dims = DimensionHelper.convertCondensedStringToToolTip(sDimNames); + int w = calculateMaxW(dims); + int x = GuiDraw.getMousePosition().x > Minecraft.getMinecraft().currentScreen.width / 2 ? this.getGuiWidth() - w - 8 : 0; + if (dims.size() > 10) { + List dims2 = dims.subList(11, dims.size()); + int w2 = calculateMaxW(dims2); + dims = dims.subList(0, 11); + w = calculateMaxW(dims); + GuiDraw.drawMultilineTip(x == 0 ? 16 + w : x - (w2 + 8), 108 - (dims.size() * 8), dims2); + } + GuiDraw.drawMultilineTip(x, 108 - (dims.size() * 8), dims); + + ttDisplayed = hideBackground; + } + } + } + + protected 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; + } + } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java index 66ede68225..4a8e2174e3 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java @@ -1,135 +1,140 @@ package pers.gwyog.gtneioreplugin.plugin.gregtech5; -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.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 PluginGT5SmallOreStat extends PluginGT5Base { - - public class CachedOreSmallRecipe extends CachedRecipe { - public String oreGenName; - public PositionedStack positionedStackOreSmall; - public PositionedStack positionedStackMaterialDust; - public List positionedDropStackList; +import java.util.ArrayList; +import java.util.List; - public CachedOreSmallRecipe(String oreGenName, List stackList, List materialDustStackList, List dropStackList) { - this.oreGenName = oreGenName; - this.positionedStackOreSmall = new PositionedStack(stackList, 2, 0); - this.positionedStackMaterialDust = new PositionedStack(materialDustStackList, 43, 79+getRestrictBiomeOffset()); - List positionedDropStackList = new ArrayList(); - int i = 1; - for (ItemStack stackDrop: dropStackList) - positionedDropStackList.add(new PositionedStack(stackDrop, 43+20*(i%4), 79+16*((i++)/4)+getRestrictBiomeOffset())); - this.positionedDropStackList = positionedDropStackList; - } +public class PluginGT5SmallOreStat extends PluginGT5Base { - @Override - public List 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 = 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); + String sDimNames = GT5OreSmallHelper.bufferedDims.get(oreSmall); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreName") + ": " + getGTOreLocalizedName((short) (oreSmall.oreMeta + 16000)), 2, 18, 0x404040, false); + drawToolTip(sDimNames); + if (!ttDisplayed) { + 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.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 110, 0x404040, false); + if (sDimNames.length() > 36) { + GuiDraw.drawString(I18n.format("") + sDimNames.substring(0, 36), 2, 120, 0x404040, false); + if (sDimNames.length() > 70) { + GuiDraw.drawString(I18n.format("") + sDimNames.substring(36, 70), 2, 130, 0x404040, false); + GuiDraw.drawString(I18n.format("") + sDimNames.substring(70, sDimNames.length() - 1), 2, 140, 0x404040, false); + } else + GuiDraw.drawString(I18n.format("") + sDimNames.substring(36, sDimNames.length() - 1), 2, 130, 0x404040, false); + } else + GuiDraw.drawString(I18n.format("") + sDimNames.substring(0, sDimNames.length() - 1), 2, 120, 0x404040, false); + } + GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth() - 3, 5, 0x404040, false); } - + public int getRestrictBiomeOffset() { - return GT5OreSmallHelper.restrictBiomeSupport? 0: -13; + return GT5OreSmallHelper.restrictBiomeSupport ? 0 : -13; } - + @Override public void loadCraftingRecipes(String outputId, Object... results) { if (outputId.equals(getOutputId())) - for (ItemStack stack: GT5OreSmallHelper.oreSmallList) + for (ItemStack stack : GT5OreSmallHelper.oreSmallList) loadCraftingRecipes(stack); else super.loadCraftingRecipes(outputId, results); } - + @Override public void loadCraftingRecipes(ItemStack stack) { if (stack.getUnlocalizedName().startsWith("gt.blockores")) { - if (stack.getItemDamage()<16000) { + if (stack.getItemDamage() < 16000) { super.loadCraftingRecipes(stack); return; } - short baseMeta = (short)(stack.getItemDamage() % 1000); - for (OreSmallWrapper oreSmallWorldGen: GT5OreSmallHelper.mapOreSmallWrapper.values()) { + short baseMeta = (short) (stack.getItemDamage() % 1000); + for (OreSmallWrapper oreSmallWorldGen : GT5OreSmallHelper.mapOreSmallWrapper.values()) { if (oreSmallWorldGen.oreMeta == baseMeta) { List stackList = new ArrayList(); int maximumIndex = getMaximumMaterialIndex(baseMeta, true); - for (int i=0;i materialDustStackList = new ArrayList(); - for (int i=0;i stackList = new ArrayList(); - for (int i=0;i<7;i++) - stackList.add(new ItemStack(GregTech_API.sBlockOres1, 1, baseMeta+16000+i*1000)); + for (int i = 0; i < 7; i++) + stackList.add(new ItemStack(GregTech_API.sBlockOres1, 1, baseMeta + 16000 + i * 1000)); List materialDustStackList = new ArrayList(); - for (int i=0;i<7;i++) + for (int i = 0; i < 7; i++) 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))); } } - } - else + } else super.loadCraftingRecipes(stack); } - + @Override public String getOutputId() { return "GTOrePluginOreSmall"; } - + @Override public String getRecipeName() { return I18n.format("gtnop.gui.smallOreStat.name"); } + + public class CachedOreSmallRecipe extends CachedRecipe { + public String oreGenName; + public PositionedStack positionedStackOreSmall; + public PositionedStack positionedStackMaterialDust; + public List positionedDropStackList; + + public CachedOreSmallRecipe(String oreGenName, List stackList, List materialDustStackList, List dropStackList) { + this.oreGenName = oreGenName; + this.positionedStackOreSmall = new PositionedStack(stackList, 2, 0); + this.positionedStackMaterialDust = new PositionedStack(materialDustStackList, 43, 79 + getRestrictBiomeOffset()); + List positionedDropStackList = new ArrayList(); + int i = 1; + for (ItemStack stackDrop : dropStackList) + positionedDropStackList.add(new PositionedStack(stackDrop, 43 + 20 * (i % 4), 79 + 16 * ((i++) / 4) + getRestrictBiomeOffset())); + this.positionedDropStackList = positionedDropStackList; + } + + @Override + public List 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; + } + + } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java index 4cc76f2bf4..2c9f9d3298 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -1,129 +1,171 @@ package pers.gwyog.gtneioreplugin.plugin.gregtech5; -import java.io.FileWriter; -import java.io.IOException; -import java.io.StringWriter; -import java.io.Writer; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import com.opencsv.bean.ColumnPositionMappingStrategy; -import com.opencsv.bean.StatefulBeanToCsv; -import com.opencsv.bean.StatefulBeanToCsvBuilder; -import com.opencsv.exceptions.CsvDataTypeMismatchException; -import com.opencsv.exceptions.CsvRequiredFieldEmptyException; - import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; import gregtech.api.GregTech_API; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; -import pers.gwyog.gtneioreplugin.util.GT5CFGHelper; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; -import pers.gwyog.gtneioreplugin.util.Oremix; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; public class PluginGT5VeinStat extends PluginGT5Base { - 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 stackListPrimary, List stackListSecondary, - List stackListBetween, List 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); + public static String[] getLocalizedVeinName(OreLayerWrapper oreLayer) { + String unlocalizedName = oreLayer.veinName; + if (unlocalizedName.startsWith("ore.mix.custom.")) + return get_Cnames(oreLayer);//I18n.format("gtnop.ore.custom.name") + I18n.format("gtnop.ore.vein.name") + unlocalizedName.substring(15); + else + return new String[]{I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.vein.name")}; + } + + public static String coustomVeinRenamer(OreLayerWrapper oreLayer) { + Set s = new HashSet(); + for (int i = 0; i < 4; i++) + s.add(getGTOreLocalizedName(oreLayer.Meta[i]).replaceAll(" ", "")); + return s.toString() + .replace("[".charAt(0), ",".charAt(0)) + .replace("]".charAt(0), ",".charAt(0)) + .replaceAll(" Ore", ",") + .replaceAll("Ore", ",") + .replaceAll(" Sand", ",") + .replaceAll("Sand", ",") + .replaceAll("Stone", ",") + .replaceAll(" Stone", ",") + .replaceAll("Earth", ",") + .replaceAll(" Earth", ",") + .replaceAll("Infused", ",") + .replaceAll(" Infused", ",") + .replaceAll(",", "") + .trim(); + } + + /*public String getWeightedChance(OreLayerWrapper oreLayer) { + String weightedChance = ""; + for (int i=0; i < oreLayer.alloweddims.size(); i++) { + if (oreLayer.alloweddims.get(i) && (oreLayer.Weight.get(i) != 0)) { + if (!weightedChance.isEmpty()) + weightedChance += ", "; + weightedChance += String.format("%.2f%%", (100.0f*oreLayer.Weight.get(i))/GT5OreLayerHelper.weightPerWorld[i]); } - - @Override - public List getIngredients() { - List ingredientsList = new ArrayList(); - 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; + return weightedChance; + }*/ + + public static String[] get_Cnames(OreLayerWrapper oreLayer) { + + String[] splt = coustomVeinRenamer(oreLayer).split("\\s"); + /*HashSet h = new HashSet(); + for (int i=0; i < splt.length;i++) { + h.add(splt[i]); + } + h.toArray(splt);*/ + + String[] ret = {oreLayer.veinName.replace("ore.mix.custom.", "") + " ", " ", " "}; + for (int i = 0; i < ret.length; i++) { + ret[i] = ret[i].trim(); + } + for (int i = 0; i < splt.length; i++) { + //FMLLog.info("Split:"+splt[i]); + //FMLLog.info("I:"+Integer.toString(i)); + if (ret[0].length() + splt[i].length() <= 20) + ret[0] = ret[0] + splt[i] + " "; + if ((ret[0].length() + splt[i].length() > 20) && ret[1].length() + splt[i].length() <= 70 && !ret[0].contains(splt[i])) + ret[1] = ret[1] + splt[i] + " "; + if ((ret[0].length() + splt[i].length() > 20) && (ret[1].length() + splt[i].length() > 70) && ret[2].length() + splt[i].length() <= 70 && !ret[1].contains(splt[i])) + ret[2] = ret[2] + splt[i] + " "; + } + for (int i = 0; i < ret.length; i++) { + ret[i] = ret[i].trim(); + } + + if (ret[2].isEmpty() && !ret[1].isEmpty()) + if (ret[1].length() <= 65) + ret[1] = ret[1] + " Vein"; + else + ret[2] = ret[2] + "Vein"; + else if (ret[1].isEmpty() && ret[2].isEmpty() && !ret[0].isEmpty()) + if (ret[0].length() <= 15) + ret[0] = ret[0] + " Vein"; + else + ret[1] = ret[1] + "Vein"; + else if (!(ret[1].isEmpty() && ret[2].isEmpty())) + ret[2] = ret[2] + "Vein"; + String[] ret2 = new String[2]; + if (ret[2].isEmpty() && !ret[1].isEmpty()) { + ret2[0] = ret[0]; + ret2[1] = ret[1]; + return ret2; } - + String[] ret1 = new String[1]; + if (ret[1].isEmpty() && ret[2].isEmpty() && !ret[0].isEmpty()) { + ret1[0] = ret[0]; + return ret1; + } else + return ret; } - + @Override public void loadCraftingRecipes(String outputId, Object... results) { if (outputId.equals(getOutputId())) { OreLayerWrapper oreLayerWrapper; - for (String veinName: GT5OreLayerHelper.mapOreLayerWrapper.keySet()) { + for (String veinName : GT5OreLayerHelper.mapOreLayerWrapper.keySet()) { oreLayerWrapper = GT5OreLayerHelper.mapOreLayerWrapper.get(veinName); List stackListPrimary = new ArrayList(); List stackListSecondary = new ArrayList(); List stackListBetween = new ArrayList(); List stackListSporadic = new ArrayList(); - for (int i=0;i<7;i++) { - stackListPrimary.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[0]+i*1000)); - stackListSecondary.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[1]+i*1000)); - stackListBetween.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[2]+i*1000)); - stackListSporadic.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[3]+i*1000)); - } + for (int i = 0; i < 7; i++) { + stackListPrimary.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[0] + i * 1000)); + stackListSecondary.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[1] + i * 1000)); + stackListBetween.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[2] + i * 1000)); + stackListSporadic.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[3] + i * 1000)); + } this.arecipes.add(new CachedVeinStatRecipe(veinName, stackListPrimary, stackListSecondary, stackListBetween, stackListSporadic)); } - } - else + } else super.loadCraftingRecipes(outputId, results); } - + @Override public void loadCraftingRecipes(ItemStack stack) { if (stack.getUnlocalizedName().startsWith("gt.blockores")) { - if (stack.getItemDamage()>16000) { + if (stack.getItemDamage() > 16000) { super.loadCraftingRecipes(stack); return; } - short baseMeta = (short)(stack.getItemDamage() % 1000); - for (OreLayerWrapper worldGen: GT5OreLayerHelper.mapOreLayerWrapper.values()) { + short baseMeta = (short) (stack.getItemDamage() % 1000); + for (OreLayerWrapper worldGen : GT5OreLayerHelper.mapOreLayerWrapper.values()) { if (worldGen.Meta[0] == baseMeta || worldGen.Meta[1] == baseMeta || worldGen.Meta[2] == baseMeta || worldGen.Meta[3] == baseMeta) { List stackListPrimary = new ArrayList(); List stackListSecondary = new ArrayList(); List stackListBetween = new ArrayList(); List stackListSporadic = new ArrayList(); - for (int i=0;i1) { GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[0], 2, 20, 0x404040, false); if (getLocalizedVeinName(oreLayer).length>2) { @@ -135,147 +177,89 @@ public class PluginGT5VeinStat extends PluginGT5Base { } else*/ if (getGTOreLocalizedName(oreLayer.Meta[0]).contains("Ore")) - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]).split("Ore")[0] + " " +I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]).split("Ore")[0] + "" + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); else if (getGTOreLocalizedName(oreLayer.Meta[0]).contains("Sand")) - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]).split("Sand")[0] + " " +I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]).split("Sand")[0] + "" + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); else - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]) + " " +I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.primaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]), 2, 50, 0x404040, false); - - GuiDraw.drawString(I18n.format("gtnop.gui.nei.secondaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[1]), 2, 60, 0x404040, false); - - GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[2]), 2, 70, 0x404040, false); - - GuiDraw.drawString(I18n.format("gtnop.gui.nei.sporadicOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[3]), 2, 80, 0x404040, false); - - GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreLayer.worldGenHeightRange, 2, 90, 0x404040, false); - - GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + Integer.toString(oreLayer.randomWeight), 100, 90, 0x404040, false); - - GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 100, 0x404040, false); - if (Dims.length()>36) { - GuiDraw.drawString(I18n.format("") + Dims.substring(0, 36), 2, 110, 0x404040, false); - if (Dims.length()>70) { - GuiDraw.drawString(I18n.format("") + Dims.substring(36, 70), 2, 120, 0x404040, false); - GuiDraw.drawString(I18n.format("") + Dims.substring(70, Dims.length()-1), 2, 130, 0x404040, false); - } - else - GuiDraw.drawString(I18n.format("") + Dims.substring(36, Dims.length()-1), 2, 120, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]) + " " + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); + drawToolTip(sDimNames); + if (!ttDisplayed) { + GuiDraw.drawString(I18n.format("gtnop.gui.nei.primaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]), 2, 50, 0x404040, false); + + GuiDraw.drawString(I18n.format("gtnop.gui.nei.secondaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[1]), 2, 60, 0x404040, false); + + GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[2]), 2, 70, 0x404040, false); + + GuiDraw.drawString(I18n.format("gtnop.gui.nei.sporadicOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[3]), 2, 80, 0x404040, false); + + GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreLayer.worldGenHeightRange, 2, 90, 0x404040, false); + + GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + Integer.toString(oreLayer.randomWeight), 100, 90, 0x404040, false); + + GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 100, 0x404040, false); + if (sDimNames.length() > 36) { + GuiDraw.drawString(I18n.format("") + sDimNames.substring(0, 36), 2, 110, 0x404040, false); + if (sDimNames.length() > 70) { + GuiDraw.drawString(I18n.format("") + sDimNames.substring(36, 70), 2, 120, 0x404040, false); + GuiDraw.drawString(I18n.format("") + sDimNames.substring(70, sDimNames.length() - 1), 2, 130, 0x404040, false); + } else + GuiDraw.drawString(I18n.format("") + sDimNames.substring(36, sDimNames.length() - 1), 2, 120, 0x404040, false); + } else + GuiDraw.drawString(I18n.format("") + sDimNames.substring(0, sDimNames.length() - 1), 2, 110, 0x404040, false); } - else - GuiDraw.drawString(I18n.format("") + Dims.substring(0, Dims.length()-1), 2, 110, 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); - - } - - public static String[] getLocalizedVeinName(OreLayerWrapper oreLayer) { - - String unlocalizedName = oreLayer.veinName; - if (unlocalizedName.startsWith("ore.mix.custom.")) - return get_Cnames(oreLayer);//I18n.format("gtnop.ore.custom.name") + I18n.format("gtnop.ore.vein.name") + unlocalizedName.substring(15); - else - return new String[] {I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.vein.name")}; - } - - public static String coustomVeinRenamer(OreLayerWrapper oreLayer) { - Set s = new HashSet(); - for (int i=0; i < 4; i++) - s.add(getGTOreLocalizedName(oreLayer.Meta[i]).replaceAll(" ", "")); - return s.toString() - .replace("[".charAt(0), ",".charAt(0)) - .replace("]".charAt(0), ",".charAt(0)) - .replaceAll(" Ore", ",") - .replaceAll("Ore", ",") - .replaceAll(" Sand", ",") - .replaceAll("Sand", ",") - .replaceAll("Stone", ",") - .replaceAll(" Stone", ",") - .replaceAll("Earth", ",") - .replaceAll(" Earth", ",") - .replaceAll("Infused", ",") - .replaceAll(" Infused", ",") - .replaceAll(",","") - .trim(); - } - - /*public String getWeightedChance(OreLayerWrapper oreLayer) { - String weightedChance = ""; - for (int i=0; i < oreLayer.alloweddims.size(); i++) { - if (oreLayer.alloweddims.get(i) && (oreLayer.Weight.get(i) != 0)) { - if (!weightedChance.isEmpty()) - weightedChance += ", "; - weightedChance += String.format("%.2f%%", (100.0f*oreLayer.Weight.get(i))/GT5OreLayerHelper.weightPerWorld[i]); - } - } - return weightedChance; - }*/ - - public static String getDims(OreLayerWrapper oreLayer) { - return GT5CFGHelper.GT5CFG(GregTech_API.sWorldgenFile.mConfig.getConfigFile(), oreLayer.veinName.replace("ore.mix.custom.", "").replace("ore.mix.", "")); + GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth() - 3, 5, 0x404040, false); } - - public static String[] get_Cnames(OreLayerWrapper oreLayer) { - - String[] splt = coustomVeinRenamer(oreLayer).split("\\s"); - /*HashSet h = new HashSet(); - for (int i=0; i < splt.length;i++) { - h.add(splt[i]); - } - h.toArray(splt);*/ - - String[] ret = {oreLayer.veinName.replace("ore.mix.custom.", "")+" "," "," "}; - for (int i=0; i < splt.length;i++) { - //FMLLog.info("Split:"+splt[i]); - //FMLLog.info("I:"+Integer.toString(i)); - if(ret[0].length()+splt[i].length()<=20) - ret[0]=ret[0]+splt[i]+" "; - if((ret[0].length()+splt[i].length()>20)&&ret[1].length()+splt[i].length()<=70&&!ret[0].contains(splt[i])) - ret[1]=ret[1]+splt[i]+" "; - if((ret[0].length()+splt[i].length()>20)&&(ret[1].length()+splt[i].length()>70)&&ret[2].length()+splt[i].length()<=70&&!ret[1].contains(splt[i])) - ret[2]=ret[2]+splt[i]+" "; - } - for (int i=0; i < ret.length;i++) { - ret[i]=ret[i].trim(); - } - - if(ret[2].isEmpty()&&!ret[1].isEmpty()) - if(ret[1].length()<=65) - ret[1]=ret[1]+" Vein"; - else - ret[2]=ret[2]+"Vein"; - else if(ret[1].isEmpty()&&ret[2].isEmpty()&&!ret[0].isEmpty()) - if(ret[0].length()<=15) - ret[0]=ret[0]+" Vein"; - else - ret[1]=ret[1]+"Vein"; - else if (!(ret[1].isEmpty()&&ret[2].isEmpty())) - ret[2]=ret[2]+"Vein"; - String[] ret2 = new String[2]; - if (ret[2].isEmpty()&&!ret[1].isEmpty()) { - ret2[0] = ret[0]; - ret2[1] = ret[1]; - return ret2; - } - String[] ret1 = new String[1]; - if (ret[1].isEmpty()&&ret[1].isEmpty()&&!ret[0].isEmpty()) { - ret1[0] = ret[0]; - return ret1; - } - else - return ret; - } - + @Override public String getOutputId() { return "GTOrePluginVein"; } - + @Override public String getRecipeName() { return I18n.format("gtnop.gui.veinStat.name"); } - + + public class CachedVeinStatRecipe extends CachedRecipe { + public String veinName; + public PositionedStack positionedStackPrimary; + public PositionedStack positionedStackSecondary; + public PositionedStack positionedStackBetween; + public PositionedStack positionedStackSporadic; + + public CachedVeinStatRecipe(String veinName, List stackListPrimary, List stackListSecondary, + List stackListBetween, List 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 getIngredients() { + List ingredientsList = new ArrayList(); + 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; + } + + } + } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java b/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java index 82a2f4f341..f12405a7ae 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java @@ -1,5 +1,13 @@ package pers.gwyog.gtneioreplugin.util; +import com.opencsv.CSVWriter; +import com.opencsv.bean.ColumnPositionMappingStrategy; +import com.opencsv.bean.StatefulBeanToCsv; +import com.opencsv.bean.StatefulBeanToCsvBuilder; +import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; +import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat; +import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; + import java.io.BufferedWriter; import java.nio.file.Files; import java.nio.file.Paths; @@ -8,60 +16,129 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import com.opencsv.CSVWriter; -import com.opencsv.bean.ColumnPositionMappingStrategy; -import com.opencsv.bean.StatefulBeanToCsv; -import com.opencsv.bean.StatefulBeanToCsvBuilder; +public class CSVMaker implements Runnable { -import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; -import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat; -import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; + public CSVMaker() { -public class CSVMaker implements Runnable { + } + + public static List Combsort(List liste) { + try { + List liste2 = new ArrayList(liste.size()); + for (Oremix element : liste) { + liste2.add(element); + } - public CSVMaker() { - - } - - public static List Combsort(List liste) { - try { - List liste2 = new ArrayList(liste.size()); - for (Oremix element : liste) { - liste2.add(element); - } - - int schritt = liste2.size(); - boolean vertauscht = false; - do { - vertauscht = false; - if (schritt > 1) { - schritt = (int) (schritt / 1.3); - } - for (int i = 0; i < liste2.size() - schritt; i++) { - if (liste2.get(i).getOreName().substring(0, 3).compareTo((liste2.get(i + schritt).getOreName().substring(0, 3))) > 0) { - T tmp = (T) liste2.get(i); - liste2.set(i, liste2.get(i + schritt)); - liste2.set(i + schritt, (Oremix) tmp); - vertauscht = true; - } - } - } while (vertauscht || schritt > 1); - return liste2; - }catch (Exception e) { - e.printStackTrace(); - return null; - } + int schritt = liste2.size(); + boolean vertauscht = false; + do { + vertauscht = false; + if (schritt > 1) { + schritt = (int) (schritt / 1.3); + } + for (int i = 0; i < liste2.size() - schritt; i++) { + if (liste2.get(i).getOreName().substring(0, 3).compareTo((liste2.get(i + schritt).getOreName().substring(0, 3))) > 0) { + Oremix tmp = (Oremix) liste2.get(i); + liste2.set(i, liste2.get(i + schritt)); + liste2.set(i + schritt, (Oremix) tmp); + vertauscht = true; + } + } + } while (vertauscht || schritt > 1); + return liste2; + } catch (Exception e) { + e.printStackTrace(); + return null; + } } - - public void run() { - try { - Iterator it = GT5OreLayerHelper.mapOreLayerWrapper.entrySet().iterator(); - List OreVeins=new ArrayList(); - while (it.hasNext()) { - Oremix oremix = new Oremix(); - - Map.Entry pair = (Map.Entry)it.next(); - String Dims = PluginGT5VeinStat.getDims((OreLayerWrapper)pair.getValue()); + + public void runSmallOres() { + try { + Iterator it = GT5OreSmallHelper.mapOreSmallWrapper.entrySet().iterator(); + List OreVeins = new ArrayList(); + while (it.hasNext()) { + Oremix oremix = new Oremix(); + + Map.Entry pair = (Map.Entry) it.next(); + String Dims = GT5OreSmallHelper.bufferedDims.get(pair.getValue()); + GT5OreSmallHelper.OreSmallWrapper oreLayer = (GT5OreSmallHelper.OreSmallWrapper) pair.getValue(); + oremix.setOreName(oreLayer.oreGenName.split("\\.")[2]); + oremix.setHeight(oreLayer.worldGenHeightRange); + oremix.setDensity(oreLayer.amountPerChunk); + oremix.as = Dims.contains("As"); + oremix.bc = Dims.contains("BC"); + oremix.be = Dims.contains("BE"); + oremix.bf = Dims.contains("BF"); + oremix.ca = Dims.contains("Ca"); + oremix.cb = Dims.contains("CA"); + oremix.ce = Dims.contains("Ce"); + oremix.dd = Dims.contains("DD"); + oremix.de = Dims.contains("De"); + oremix.ea = Dims.contains("EA"); + oremix.en = Dims.contains("En"); + oremix.eu = Dims.contains("Eu"); + oremix.ga = Dims.contains("Ga"); + oremix.ha = Dims.contains("Ha"); + oremix.io = Dims.contains("Io"); + oremix.kb = Dims.contains("KB"); + oremix.make = Dims.contains("MM"); + oremix.ma = Dims.contains("Ma"); + oremix.me = Dims.contains("Me"); + oremix.mi = Dims.contains("Mi"); + oremix.mo = Dims.contains("Mo"); + oremix.ob = Dims.contains("Ob"); + oremix.ph = Dims.contains("Ph"); + oremix.pl = Dims.contains("Pl"); + oremix.pr = Dims.contains("Pr"); + oremix.tcetie = Dims.contains("TE"); + oremix.tf = Dims.contains("TF"); + oremix.ti = Dims.contains("Ti"); + oremix.tr = Dims.contains("Tr"); + oremix.vb = Dims.contains("VB"); + oremix.ve = Dims.contains("Ve"); + oremix.setOverworld(Dims.contains("Ow")); + oremix.setNether(Dims.contains("Ne")); + oremix.setEnd(Dims.contains("EN")); + OreVeins.add(oremix); + + System.out.println(pair.getKey() + " = " + pair.getValue()); + it.remove(); // avoids a ConcurrentModificationException + } + BufferedWriter one = Files.newBufferedWriter(Paths.get(GTNEIOrePlugin.CSVnameSmall)); + ColumnPositionMappingStrategy strat = new ColumnPositionMappingStrategy(); + strat.setType(Oremix.class); + String[] columns = "ORENAME,mix,DENSITY,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie".split("\\,"); + strat.setColumnMapping(columns); + StatefulBeanToCsv beanToCsv = new StatefulBeanToCsvBuilder(one) + .withQuotechar(CSVWriter.NO_QUOTE_CHARACTER) + .withMappingStrategy(strat) + .build(); + List towrite = Combsort(OreVeins); + one.write("Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E"); + one.newLine(); + beanToCsv.write(towrite); + one.flush(); + one.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void run() { + runVeins(); + runSmallOres(); + } + + public void runVeins() { + try { + Iterator it = GT5OreLayerHelper.mapOreLayerWrapper.entrySet().iterator(); + List OreVeins = new ArrayList(); + while (it.hasNext()) { + Oremix oremix = new Oremix(); + + Map.Entry pair = (Map.Entry) it.next(); + String Dims = GT5OreLayerHelper.bufferedDims.get(pair.getValue()); OreLayerWrapper oreLayer = (OreLayerWrapper) pair.getValue(); oremix.setOreName(oreLayer.veinName.split("\\.")[2]); oremix.setPrimary(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[0])); @@ -72,66 +149,65 @@ public class CSVMaker implements Runnable { oremix.setHeight(oreLayer.worldGenHeightRange); oremix.setDensity(oreLayer.density); oremix.setWeight(oreLayer.randomWeight); - oremix.setMix(Integer.toString(oreLayer.Meta[0])+"|"+Integer.toString(oreLayer.Meta[1])+"|"+Integer.toString(oreLayer.Meta[2])+"|"+Integer.toString(oreLayer.Meta[3])); - oremix.as=Dims.contains("As"); - oremix.bc=Dims.contains("BC"); - oremix.be=Dims.contains("BE"); - oremix.bf=Dims.contains("BF"); - oremix.ca=Dims.contains("Ca"); - oremix.cb=Dims.contains("CA"); - oremix.ce=Dims.contains("Ce"); - oremix.dd=Dims.contains("DD"); - oremix.de=Dims.contains("De"); - oremix.ea=Dims.contains("EA"); - oremix.en=Dims.contains("En"); - oremix.eu=Dims.contains("Eu"); - oremix.ga=Dims.contains("Ga"); - oremix.ha=Dims.contains("Ha"); - oremix.io=Dims.contains("Io"); - oremix.kb=Dims.contains("KB"); - oremix.make=Dims.contains("MM"); - oremix.ma=Dims.contains("Ma"); - oremix.me=Dims.contains("Me"); - oremix.mi=Dims.contains("Mi"); - oremix.mo=Dims.contains("Mo"); - oremix.ob=Dims.contains("Ob"); - oremix.ph=Dims.contains("Ph"); - oremix.pl=Dims.contains("Pl"); - oremix.pr=Dims.contains("Pr"); - oremix.tcetie=Dims.contains("TE"); - oremix.tf=Dims.contains("TF"); - oremix.ti=Dims.contains("Ti"); - oremix.tr=Dims.contains("Tr"); - oremix.vb=Dims.contains("VB"); - oremix.ve=Dims.contains("Ve"); + oremix.setMix(Integer.toString(oreLayer.Meta[0]) + "|" + Integer.toString(oreLayer.Meta[1]) + "|" + Integer.toString(oreLayer.Meta[2]) + "|" + Integer.toString(oreLayer.Meta[3])); + oremix.as = Dims.contains("As"); + oremix.bc = Dims.contains("BC"); + oremix.be = Dims.contains("BE"); + oremix.bf = Dims.contains("BF"); + oremix.ca = Dims.contains("Ca"); + oremix.cb = Dims.contains("CA"); + oremix.ce = Dims.contains("Ce"); + oremix.dd = Dims.contains("DD"); + oremix.de = Dims.contains("De"); + oremix.ea = Dims.contains("EA"); + oremix.en = Dims.contains("En"); + oremix.eu = Dims.contains("Eu"); + oremix.ga = Dims.contains("Ga"); + oremix.ha = Dims.contains("Ha"); + oremix.io = Dims.contains("Io"); + oremix.kb = Dims.contains("KB"); + oremix.make = Dims.contains("MM"); + oremix.ma = Dims.contains("Ma"); + oremix.me = Dims.contains("Me"); + oremix.mi = Dims.contains("Mi"); + oremix.mo = Dims.contains("Mo"); + oremix.ob = Dims.contains("Ob"); + oremix.ph = Dims.contains("Ph"); + oremix.pl = Dims.contains("Pl"); + oremix.pr = Dims.contains("Pr"); + oremix.tcetie = Dims.contains("TE"); + oremix.tf = Dims.contains("TF"); + oremix.ti = Dims.contains("Ti"); + oremix.tr = Dims.contains("Tr"); + oremix.vb = Dims.contains("VB"); + oremix.ve = Dims.contains("Ve"); oremix.setOverworld(Dims.contains("Ow")); oremix.setNether(Dims.contains("Ne")); oremix.setEnd(Dims.contains("EN")); OreVeins.add(oremix); - - + + System.out.println(pair.getKey() + " = " + pair.getValue()); it.remove(); // avoids a ConcurrentModificationException - } - BufferedWriter one = Files.newBufferedWriter(Paths.get(GTNEIOrePlugin.CSVname)); + } + BufferedWriter one = Files.newBufferedWriter(Paths.get(GTNEIOrePlugin.CSVname)); ColumnPositionMappingStrategy strat = new ColumnPositionMappingStrategy(); strat.setType(Oremix.class); String[] columns = "ORENAME,PRIMARY,SECONDARY,INBETWEEN,AROUND,mix,TIER,HEIGHT,DENSITY,SIZE,WEIGHT,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie".split("\\,"); strat.setColumnMapping(columns); - StatefulBeanToCsv beanToCsv = new StatefulBeanToCsvBuilder(one) + StatefulBeanToCsv beanToCsv = new StatefulBeanToCsvBuilder(one) .withQuotechar(CSVWriter.NO_QUOTE_CHARACTER) .withMappingStrategy(strat) .build(); - List towrite = Combsort(OreVeins); - one.write("Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E"); - one.newLine(); - beanToCsv.write(towrite); - one.flush(); - one.close(); - - }catch (Exception e) { - e.printStackTrace(); - } - } + List towrite = Combsort(OreVeins); + one.write("Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E"); + one.newLine(); + beanToCsv.write(towrite); + one.flush(); + one.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java index c0842bfbfa..1d4b0e0025 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -1,85 +1,114 @@ package pers.gwyog.gtneioreplugin.util; -import net.minecraft.world.World; -import net.minecraft.world.WorldProvider; -import net.minecraft.world.WorldServer; -import net.minecraftforge.common.DimensionManager; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; public class DimensionHelper { - - public static String[] DimName = - { - "EndAsteroid", - "GalacticraftCore_Moon", - "GalacticraftMars_Asteroids", - "GalacticraftMars_Mars", - "GalaxySpace_BarnardC", - "GalaxySpace_BarnardE", - "GalaxySpace_BarnardF", - "GalaxySpace_Callisto", - "GalaxySpace_CentauriA", - "GalaxySpace_Ceres", - "GalaxySpace_Deimos", - "GalaxySpace_Enceladus", - "GalaxySpace_Europa", - "GalaxySpace_Ganymede", - "GalaxySpace_Haumea", - "GalaxySpace_Io", - "GalaxySpace_Kuiperbelt", - "GalaxySpace_MakeMake", - "GalaxySpace_Mercury", - "GalaxySpace_Miranda", - "GalaxySpace_Oberon", - "GalaxySpace_Phobos", - "GalaxySpace_Pluto", - "GalaxySpace_Proteus", - "GalaxySpace_TcetiE", - "GalaxySpace_Titan", - "GalaxySpace_Triton", - "GalaxySpace_VegaB", - "GalaxySpace_Venus", - "Nether", - "Overworld", - "TheEnd", - "Vanilla_EndAsteroids", - "Twilight", - "Underdark"}; - - public static String[] DimNameDisplayed = - {// first 2 letters if one word else 1 letter of every word, execpt capital letter in name, then 1rst + capital Moon = Mo, BarnardC = BC, EndAsteroid = EA - "EA", - "Mo", - "As", - "Ma", - "BC", - "BE", - "BF", - "Ca", - "CA", - "Ce", - "De", - "En", - "Eu", - "Ga", - "Ha", - "Io", - "KB", - "MM", - "Me", - "Mi", - "Ob", - "Ph", - "Pl", - "Pr", - "TE", - "Ti", - "Tr", - "VB", - "Ve", - "Ne", - "Ow", - "EN",//End = EN bc En = Encalus - "VA", - "TF", - "DD"}; + + public static String[] DimName = + { + "EndAsteroid", + "GalacticraftCore_Moon", + "GalacticraftMars_Asteroids", + "GalacticraftMars_Mars", + "GalaxySpace_BarnardC", + "GalaxySpace_BarnardE", + "GalaxySpace_BarnardF", + "GalaxySpace_Callisto", + "GalaxySpace_CentauriA", + "GalaxySpace_Ceres", + "GalaxySpace_Deimos", + "GalaxySpace_Enceladus", + "GalaxySpace_Europa", + "GalaxySpace_Ganymede", + "GalaxySpace_Haumea", + "GalaxySpace_Io", + "GalaxySpace_Kuiperbelt", + "GalaxySpace_MakeMake", + "GalaxySpace_Mercury", + "GalaxySpace_Miranda", + "GalaxySpace_Oberon", + "GalaxySpace_Phobos", + "GalaxySpace_Pluto", + "GalaxySpace_Proteus", + "GalaxySpace_TcetiE", + "GalaxySpace_Titan", + "GalaxySpace_Triton", + "GalaxySpace_VegaB", + "GalaxySpace_Venus", + "Nether", + "Overworld", + "TheEnd", + "Vanilla_EndAsteroids", + "Twilight", + "Underdark" + }; + + public static String[] DimNameDisplayed = + {// first 2 letters if one word else 1 letter of every word, execpt capital letter in name, then 1rst + capital Moon = Mo, BarnardC = BC, EndAsteroid = EA + "EA", + "Mo", + "As", + "Ma", + "BC", + "BE", + "BF", + "Ca", + "CA", + "Ce", + "De", + "En", + "Eu", + "Ga", + "Ha", + "Io", + "KB", + "MM", + "Me", + "Mi", + "Ob", + "Ph", + "Pl", + "Pr", + "TE", + "Ti", + "Tr", + "VB", + "Ve", + "Ne", + "Ow", + "EN",//End = EN bc En = Encalus + "VA", + "TF", + "DD" + }; + + private static HashMap> tooltipBuffer = new HashMap<>(); + + private static List computeString(String line) { + String[] dims = line.split(","); + for (int j = 0; j < dims.length; j++) { + String s = dims[j]; + s = s.replaceAll(",", ""); + s = s.trim(); + for (int i = 0; i < DimNameDisplayed.length; i++) { + if (s.equals(DimNameDisplayed[i])) { + s = DimName[i].replaceAll("GalacticraftCore_", "").replaceAll("GalacticraftMars_", "").replaceAll("GalaxySpace_", "").replaceAll("Vanilla_", "Vanilla "); + if (s.equals("Twilight")) + s = "Twilight Forrest"; + else if (s.equals("Underdark")) + s = "Deep Dark"; + else if (s.equals("EndAsteroid")) + s = "Far End Asteroids"; + dims[j] = s; + } + } + } + return Arrays.asList(dims); + } + + public static List convertCondensedStringToToolTip(String line) { + return tooltipBuffer.computeIfAbsent(line, (String tmp) -> computeString(line)); + } } \ No newline at end of file diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java index c616534d8d..00260020da 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java @@ -1,5 +1,12 @@ package pers.gwyog.gtneioreplugin.util; +import cpw.mods.fml.common.FMLLog; +import gregtech.api.GregTech_API; +import net.minecraftforge.common.config.ConfigCategory; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.config.Property; +import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; + import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -8,128 +15,170 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; -import cpw.mods.fml.common.FMLLog; - public class GT5CFGHelper { - - public static String GT5CFG(File F, String Veinname) { - //FMLLog.info(Veinname); - if (F == null) { - FMLLog.bigWarning("GT_CFG_NOT_found[0]"); - return "Error while Loading CFG"; - } - else - try { - int buffer = (int) (0.1*Runtime.getRuntime().freeMemory()); - if (buffer > F.length()) - buffer = (int) F.length(); - //allocate 10% of free memory for read-in-buffer, if there is less than filesize memory aviable - //FMLLog.info("GT_CFG_found[0]"); - FileReader in = new FileReader(F); - //FMLLog.info("FileReader created"); - BufferedReader reader = new BufferedReader(in, buffer); - //FMLLog.info("BufferedReader" +Integer.toString(buffer)+"created"); - String st=null; - List raw= new ArrayList(); - List rawbools = new ArrayList(); - Boolean[] found = new Boolean[2]; - found[0] = false; - found[1] = false; - - do{ - //FMLLog.info("erste"); - //read until reached eof or mix { - st = reader.readLine(); - //FMLLog.info("st: "+st); - if (st != null && st.trim().equals("mix {")) { - while(!((st == null)||((st != null)&&found[0]))){ - //FMLLog.info("zweite"); - st = reader.readLine(); - //read until reached eof or Veinname { - //FMLLog.info("MIXst: "+st); - if (st != null && st.trim().equals(Veinname+" {")) { - //FMLLog.info("VEINNAMEst: "+st); - while (!((st == null)||((st != null) && found[0]))){ - st = reader.readLine(); - if ((!(st == null)) && st.trim().equals("}")) - found[0] = true; - //FMLLog.info("dritte"); - //add everything below Veinname { undtil } to raw - raw.add(st); - } - } - } - } - - if (st != null && st.trim().equals("dimensions {")) { - while(!((st == null)||((st != null)&&found[1]))){ - //FMLLog.info("zweite"); - st = reader.readLine(); - if (st != null && (st.trim().equals("mix {"))) { - while(!((st == null)||((st != null)&&found[1]))){ - //FMLLog.info("dritte"); - st = reader.readLine(); - //read until reached eof or Veinname { - //FMLLog.info("MIXst: "+st); - if (st != null && st.trim().equals(Veinname+" {")) { - //FMLLog.info("VEINNAMEst: "+st); - while (!((st == null)||((st != null)&&found[1]))){ - st = reader.readLine(); - if ((!(st == null)) && st.trim().equals("}")) - found[1] = true; - //FMLLog.info("vierte"); - //add everything below Veinname { undtil } to raw - raw.add(st); - } - } - } - } - } - } - }while(st != null); - reader.close();//not needed anymore - - if (!raw.isEmpty()) - for (int i=0; i < raw.size();i++) { - //filter needed booleans from raw - ///FMLLog.info("raw contains"+raw.get(i)); - for (int j=0; j < DimensionHelper.DimName.length;j++) - if(raw.get(i).contains(DimensionHelper.DimName[j])) - rawbools.add(raw.get(i)); - //FMLLog.info("rawbools: "+rawbools.get(i)); - } - else FMLLog.info("raw is empty"); - - String ret=" "; - - HashSet rawboolsset = new HashSet(); - if (!rawbools.isEmpty()) { - //remove dublicats - for (int i=0; i < rawbools.size();i++){ - st = rawbools.get(i).replace("B:", "").replace("_true", "").replace("_false", "").replaceAll(" ", "").replaceAll("\"", ""); - rawboolsset.add(st); - } - rawbools = new ArrayList(rawboolsset); - //filter for dims set to true - for (int i=0; i < rawbools.size();i++) { - st = rawbools.get(i); - //FMLLog.info("RawBools:"+st); - for (int j=0; j < DimensionHelper.DimName.length;j++) { - if(st.contains(DimensionHelper.DimName[j])) - if(st.contains("=true")) - ret=(ret+DimensionHelper.DimNameDisplayed[j]+","); - } - } - } - ret = ret.trim(); - //FMLLog.info("ret:"+ret); - if(ret.equals("")||ret.equals(" ")) - ret ="Not aviable in any Galactic Dim!"; + + private static File F = GregTech_API.sWorldgenFile.mConfig.getConfigFile(); + + public static String GT5CFGSmallOres(String Veinname) { + List raw = new ArrayList(); + List rawbools = new ArrayList(); + String st = null; + Configuration c = new Configuration(F); + ConfigCategory configCategory = c.getCategory("worldgen." + Veinname); + for (Property p : configCategory.getOrderedValues()) { + if (p.isBooleanValue() && p.getBoolean()) { + raw.add(p.getName() + "=" + p.getBoolean()); + } + } + if (!raw.isEmpty()) + for (int i = 0; i < raw.size(); i++) { + for (int j = 0; j < DimensionHelper.DimName.length; j++) + if (raw.get(i).contains(DimensionHelper.DimName[j])) + rawbools.add(raw.get(i)); + } + else GTNEIOrePlugin.LOG.info("Config entry not found for Vein: " + Veinname); + + String ret = " "; + + HashSet rawboolsset = new HashSet(); + if (!rawbools.isEmpty()) { + for (int i = 0; i < rawbools.size(); i++) { + st = rawbools.get(i).replace("B:", "").replace("_true", "").replace("_false", "").replaceAll(" ", "").replaceAll("\"", ""); + rawboolsset.add(st); + } + rawbools = new ArrayList(rawboolsset); + for (int i = 0; i < rawbools.size(); i++) { + st = rawbools.get(i); + for (int j = 0; j < DimensionHelper.DimName.length; j++) { + if (st.contains(DimensionHelper.DimName[j])) + if (st.contains("=true")) + ret = (ret + DimensionHelper.DimNameDisplayed[j] + ","); + } + } + } + ret = ret.trim(); + if (ret.equals("") || ret.equals(" ")) + ret = "Not aviable in any Galactic Dim!"; return ret; - } catch (IOException e) { - e.printStackTrace(); - return "Error while Loading CFG"; - } - } + } + + public static String GT5CFG(String Veinname) { + //FMLLog.info(Veinname); + if (F == null) { + FMLLog.bigWarning("GT_CFG_NOT_found[0]"); + return "Error while Loading CFG"; + } else + try { + int buffer = (int) (0.1 * Runtime.getRuntime().freeMemory()); + if (buffer > F.length()) + buffer = (int) F.length(); + //allocate 10% of free memory for read-in-buffer, if there is less than filesize memory aviable + //FMLLog.info("GT_CFG_found[0]"); + FileReader in = new FileReader(F); + //FMLLog.info("FileReader created"); + BufferedReader reader = new BufferedReader(in, buffer); + //FMLLog.info("BufferedReader" +Integer.toString(buffer)+"created"); + String st = null; + List raw = new ArrayList(); + List rawbools = new ArrayList(); + Boolean[] found = new Boolean[2]; + found[0] = false; + found[1] = false; + + do { + //FMLLog.info("erste"); + //read until reached eof or mix { + st = reader.readLine(); + //FMLLog.info("st: "+st); + if (st != null && st.trim().equals("mix {")) { + while (!((st == null) || ((st != null) && found[0]))) { + //FMLLog.info("zweite"); + st = reader.readLine(); + //read until reached eof or Veinname { + //FMLLog.info("MIXst: "+st); + if (st != null && st.trim().equals(Veinname + " {")) { + //FMLLog.info("VEINNAMEst: "+st); + while (!((st == null) || ((st != null) && found[0]))) { + st = reader.readLine(); + if ((!(st == null)) && st.trim().equals("}")) + found[0] = true; + //FMLLog.info("dritte"); + //add everything below Veinname { undtil } to raw + raw.add(st); + } + } + } + } + + if (st != null && st.trim().equals("dimensions {")) { + while (!((st == null) || ((st != null) && found[1]))) { + //FMLLog.info("zweite"); + st = reader.readLine(); + if (st != null && (st.trim().equals("mix {"))) { + while (!((st == null) || ((st != null) && found[1]))) { + //FMLLog.info("dritte"); + st = reader.readLine(); + //read until reached eof or Veinname { + //FMLLog.info("MIXst: "+st); + if (st != null && st.trim().equals(Veinname + " {")) { + //FMLLog.info("VEINNAMEst: "+st); + while (!((st == null) || ((st != null) && found[1]))) { + st = reader.readLine(); + if ((!(st == null)) && st.trim().equals("}")) + found[1] = true; + //FMLLog.info("vierte"); + //add everything below Veinname { undtil } to raw + raw.add(st); + } + } + } + } + } + } + } while (st != null); + reader.close();//not needed anymore + + if (!raw.isEmpty()) + for (int i = 0; i < raw.size(); i++) { + //filter needed booleans from raw + ///FMLLog.info("raw contains"+raw.get(i)); + for (int j = 0; j < DimensionHelper.DimName.length; j++) + if (raw.get(i).contains(DimensionHelper.DimName[j])) + rawbools.add(raw.get(i)); + //FMLLog.info("rawbools: "+rawbools.get(i)); + } + else GTNEIOrePlugin.LOG.info("Config entry not found for Vein: " + Veinname); + + String ret = " "; + + HashSet rawboolsset = new HashSet(); + if (!rawbools.isEmpty()) { + //remove dublicats + for (int i = 0; i < rawbools.size(); i++) { + st = rawbools.get(i).replace("B:", "").replace("_true", "").replace("_false", "").replaceAll(" ", "").replaceAll("\"", ""); + rawboolsset.add(st); + } + rawbools = new ArrayList(rawboolsset); + //filter for dims set to true + for (int i = 0; i < rawbools.size(); i++) { + st = rawbools.get(i); + //FMLLog.info("RawBools:"+st); + for (int j = 0; j < DimensionHelper.DimName.length; j++) { + if (st.contains(DimensionHelper.DimName[j])) + if (st.contains("=true")) + ret = (ret + DimensionHelper.DimNameDisplayed[j] + ","); + } + } + } + ret = ret.trim(); + //FMLLog.info("ret:"+ret); + if (ret.equals("") || ret.equals(" ")) + ret = "Not aviable in any Galactic Dim!"; + return ret; + } catch (IOException e) { + e.printStackTrace(); + return "Error while Loading CFG"; + } + } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index 2b6e286174..9e8a608405 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -1,57 +1,41 @@ package pers.gwyog.gtneioreplugin.util; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.FileWriter; -import java.io.IOException; -import java.lang.reflect.Field; -import java.nio.file.Files; -import java.nio.file.Paths; +import gregtech.common.GT_Worldgen_GT_Ore_Layer; + import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; import java.util.List; -import java.util.Map; -import java.util.function.BiConsumer; - -import com.opencsv.CSVReader; -import com.opencsv.CSVWriter; -import com.opencsv.bean.ColumnPositionMappingStrategy; -import com.opencsv.bean.CsvToBean; -import com.opencsv.bean.StatefulBeanToCsv; -import com.opencsv.bean.StatefulBeanToCsvBuilder; - -import cpw.mods.fml.common.Loader; -import gregtech.GT_Mod; -import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; -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 pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat; public class GT5OreLayerHelper { - + public static Integer weightPerWorld[] = new Integer[33]; public static Integer DimIDs[] = new Integer[33]; public static HashMap mapOreLayerWrapper = new HashMap(); + public static HashMap bufferedDims = new HashMap<>(); public GT5OreLayerHelper() { - for (int i=0; i < DimIDs.length;i++) - weightPerWorld[i]=0; - for (int i=0; i < DimIDs.length;i++) - DimIDs[i]=0; - for (GT_Worldgen_GT_Ore_Layer tWorldGen: GT_Worldgen_GT_Ore_Layer.sList) + for (int i = 0; i < DimIDs.length; i++) + weightPerWorld[i] = 0; + for (int i = 0; i < DimIDs.length; i++) + DimIDs[i] = 0; + for (GT_Worldgen_GT_Ore_Layer tWorldGen : GT_Worldgen_GT_Ore_Layer.sList) mapOreLayerWrapper.put(tWorldGen.mWorldGenName, new OreLayerWrapper(tWorldGen)); - } - + for (OreLayerWrapper layer : mapOreLayerWrapper.values()) { + bufferedDims.put(layer, getDims(layer)); + } + } + + public static String getDims(OreLayerWrapper oreLayer) { + return GT5CFGHelper.GT5CFG(oreLayer.veinName.replace("ore.mix.custom.", "").replace("ore.mix.", "")); + } + + public class OreLayerWrapper { - public String veinName, worldGenHeightRange, weightedIEChance; + public String veinName, worldGenHeightRange; public short[] Meta = new short[4]; public short randomWeight, size, density; public List Weight = new ArrayList(); - + public OreLayerWrapper(GT_Worldgen_GT_Ore_Layer worldGen) { this.veinName = worldGen.mWorldGenName; this.Meta[0] = worldGen.mPrimaryMeta; @@ -62,7 +46,7 @@ public class GT5OreLayerHelper { this.density = worldGen.mDensity; this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; this.randomWeight = worldGen.mWeight; - } } } +} \ No newline at end of file diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java index 18aca0e5d8..6dc155e9fd 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java @@ -1,19 +1,17 @@ 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; -import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; public class GT5OreSmallHelper { public static boolean restrictBiomeSupport = false; @@ -21,8 +19,9 @@ public class GT5OreSmallHelper { public static List oreSmallList = new ArrayList(); public static HashMap mapOreSmallWrapper = new HashMap(); public static HashMap mapOreDropUnlocalizedNameToOreMeta = new HashMap(); - public static HashMap> mapOreMetaToOreDrops = new HashMap>(); - + public static HashMap> mapOreMetaToOreDrops = new HashMap>(); + public static HashMap bufferedDims = new HashMap<>(); + public GT5OreSmallHelper() { checkExtraSupport(); ItemStack stack; @@ -30,68 +29,95 @@ public class GT5OreSmallHelper { 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; + GT_Worldgen_GT_Ore_SmallPieces worldGenSmallPieces = (GT_Worldgen_GT_Ore_SmallPieces) worldGen; meta = worldGenSmallPieces.mMeta; - if (meta<0) - break; + if (meta < 0) + break; material = GregTech_API.sGeneratedMaterials[meta]; mapOreSmallWrapper.put(worldGen.mWorldGenName, new OreSmallWrapper(worldGenSmallPieces)); if (!mapOreMetaToOreDrops.keySet().contains(meta)) { List stackList = new ArrayList(); 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);} + 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);} + 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);} + 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);} + 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);} + 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);} + 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);} - oreSmallList.add(new ItemStack(GregTech_API.sBlockOres1, 1, meta+16000)); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) { + mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta); + stackList.add(stack); + } + oreSmallList.add(new ItemStack(GregTech_API.sBlockOres1, 1, meta + 16000)); mapOreMetaToOreDrops.put(meta, stackList); } } + for (OreSmallWrapper oreSmallWrapper : mapOreSmallWrapper.values()) { + bufferedDims.put(oreSmallWrapper, GT5CFGHelper.GT5CFGSmallOres(oreSmallWrapper.oreGenName)); + } } - + private static void checkExtraSupport() { - Class clazzGTOreSmall = null; + Class clazzGTOreSmall = null; + try { + clazzGTOreSmall = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_SmallPieces"); + } catch (ClassNotFoundException e) { + } + if (clazzGTOreSmall != null) { try { - 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) {} - } + 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 OreSmallWrapper { public String oreGenName; public short oreMeta; public String worldGenHeightRange; public short amountPerChunk; public String restrictBiome; - + public OreSmallWrapper(GT_Worldgen_GT_Ore_SmallPieces worldGen) { this.oreGenName = worldGen.mWorldGenName; this.oreMeta = worldGen.mMeta; this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; this.amountPerChunk = worldGen.mAmount; - } } } +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java b/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java index 1b1f44df67..559a11cca8 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java @@ -4,463 +4,487 @@ import com.opencsv.bean.CsvBindByName; import com.opencsv.bean.CsvCustomBindByName; public class Oremix { - - @CsvCustomBindByName(column = "Ore Name", required = true, converter = Veinrenamer.class) - private String oreName; - @CsvBindByName(column = "Primary", required = false) - private String primary = ""; - @CsvBindByName(column = "Secondary", required = false) - private String secondary = ""; - @CsvBindByName(column = "Inbetween", required = false) - private String inbetween = ""; - @CsvBindByName(column = "Around", required = false) - private String around = ""; - @CsvBindByName(column = "ID ", required = false) - private String mix = ""; - @CsvBindByName(column = "Tier", required = false) - private String tier = ""; - @CsvBindByName(column = "Height", required = false) - private String height = ""; - @CsvBindByName(column = "Density", required = false) - private int density; - @CsvBindByName(column = "Size", required = false) - private int size; - @CsvBindByName(column = "Weight", required = false) - private int weight; - @CsvCustomBindByName(column = "Overworld", required = false, converter = XtoBool.class) - private boolean overworld; - @CsvCustomBindByName(column = "Nether", required = false, converter = XtoBool.class) - private boolean nether; - @CsvCustomBindByName(column = "End", required = false, converter = XtoBool.class) - private boolean end; - @CsvCustomBindByName(column = "Moon", required = false, converter = XtoBool.class) - public boolean mo; - public boolean isMo() { - return mo; - } - - public void setMo(boolean mo) { - this.mo = mo; - } - - public boolean isEa() { - return ea; - } - - public void setEa(boolean ea) { - this.ea = ea; - } - - public boolean isAs() { - return as; - } - - public void setAs(boolean as) { - this.as = as; - } - - public boolean isBc() { - return bc; - } - - public void setBc(boolean bc) { - this.bc = bc; - } - - public boolean isBe() { - return be; - } - - public void setBe(boolean be) { - this.be = be; - } - - public boolean isBf() { - return bf; - } - - public void setBf(boolean bf) { - this.bf = bf; - } - - public boolean isMa() { - return ma; - } - - public void setMa(boolean ma) { - this.ma = ma; - } - - public boolean isCa() { - return ca; - } - - public void setCa(boolean ca) { - this.ca = ca; - } - - public boolean isCb() { - return cb; - } - - public void setCb(boolean cb) { - this.cb = cb; - } - - public boolean isCe() { - return ce; - } - - public void setCe(boolean ce) { - this.ce = ce; - } - - public boolean isTf() { - return tf; - } - - public void setTf(boolean tf) { - this.tf = tf; - } - - public boolean isDd() { - return dd; - } - - public void setDd(boolean dd) { - this.dd = dd; - } - - public boolean isPh() { - return ph; - } - public void setPh(boolean ph) { - this.ph = ph; - } + @CsvCustomBindByName(column = "Moon", required = false, converter = XtoBool.class) + public boolean mo; + @CsvCustomBindByName(column = "End Asteroids", required = false, converter = XtoBool.class) + public boolean ea; + @CsvCustomBindByName(column = "AstroidBelt", required = false, converter = XtoBool.class) + public boolean as; + @CsvCustomBindByName(column = "Barnard C", required = false, converter = XtoBool.class) + public boolean bc; + @CsvCustomBindByName(column = "Barnard E", required = false, converter = XtoBool.class) + public boolean be; + @CsvCustomBindByName(column = "Barnard F", required = false, converter = XtoBool.class) + public boolean bf; + @CsvCustomBindByName(column = "Mars", required = false, converter = XtoBool.class) + public boolean ma; + @CsvCustomBindByName(column = "Callisto", required = false, converter = XtoBool.class) + public boolean ca; + @CsvCustomBindByName(column = "Centauri Bb", required = false, converter = XtoBool.class) + public boolean cb; + @CsvCustomBindByName(column = "Ceres", required = false, converter = XtoBool.class) + public boolean ce; + @CsvCustomBindByName(column = "Twilight Forest", required = false, converter = XtoBool.class) + public boolean tf; + @CsvCustomBindByName(column = "Deep Dark", required = false, converter = XtoBool.class) + public boolean dd; + @CsvCustomBindByName(column = "Phobos", required = false, converter = XtoBool.class) + public boolean ph; + @CsvCustomBindByName(column = "Deimos", required = false, converter = XtoBool.class) + public boolean de; + @CsvCustomBindByName(column = "Europa", required = false, converter = XtoBool.class) + public boolean eu; + @CsvCustomBindByName(column = "Ganymede", required = false, converter = XtoBool.class) + public boolean ga; + @CsvCustomBindByName(column = "Io", required = false, converter = XtoBool.class) + public boolean io; + @CsvCustomBindByName(column = "Venus", required = false, converter = XtoBool.class) + public boolean ve; + @CsvCustomBindByName(column = "Mercury", required = false, converter = XtoBool.class) + public boolean me; + @CsvCustomBindByName(column = "Enceladus", required = false, converter = XtoBool.class) + public boolean en; + @CsvCustomBindByName(column = "Titan", required = false, converter = XtoBool.class) + public boolean ti; + @CsvCustomBindByName(column = "Miranda", required = false, converter = XtoBool.class) + public boolean mi; + @CsvCustomBindByName(column = "Oberon", required = false, converter = XtoBool.class) + public boolean ob; + @CsvCustomBindByName(column = "Triton", required = false, converter = XtoBool.class) + public boolean tr; + @CsvCustomBindByName(column = "Proteus", required = false, converter = XtoBool.class) + public boolean pr; + @CsvCustomBindByName(column = "Pluto", required = false, converter = XtoBool.class) + public boolean pl; + @CsvCustomBindByName(column = "Kuiper Belt", required = false, converter = XtoBool.class) + public boolean kb; + @CsvCustomBindByName(column = "Haumea", required = false, converter = XtoBool.class) + public boolean ha; + @CsvCustomBindByName(column = "Makemake", required = false, converter = XtoBool.class) + public boolean make; + @CsvCustomBindByName(column = "Vega B", required = false, converter = XtoBool.class) + public boolean vb; + @CsvCustomBindByName(column = "T Ceti E", required = false, converter = XtoBool.class) + public boolean tcetie; + @CsvCustomBindByName(column = "Ore Name", required = true, converter = Veinrenamer.class) + private String oreName; + @CsvBindByName(column = "Primary", required = false) + private String primary = ""; + @CsvBindByName(column = "Secondary", required = false) + private String secondary = ""; + @CsvBindByName(column = "Inbetween", required = false) + private String inbetween = ""; + @CsvBindByName(column = "Around", required = false) + private String around = ""; + @CsvBindByName(column = "ID ", required = false) + private String mix = ""; + @CsvBindByName(column = "Tier", required = false) + private String tier = ""; + @CsvBindByName(column = "Height", required = false) + private String height = ""; + @CsvBindByName(column = "Density", required = false) + private int density; + @CsvBindByName(column = "Size", required = false) + private int size; + @CsvBindByName(column = "Weight", required = false) + private int weight; + @CsvCustomBindByName(column = "Overworld", required = false, converter = XtoBool.class) + private boolean overworld; + @CsvCustomBindByName(column = "Nether", required = false, converter = XtoBool.class) + private boolean nether; + @CsvCustomBindByName(column = "End", required = false, converter = XtoBool.class) + private boolean end; + private int miny, maxy; + + public Oremix() { + } + + public boolean isMo() { + return mo; + } + + public void setMo(boolean mo) { + this.mo = mo; + } + + public boolean isEa() { + return ea; + } + + public void setEa(boolean ea) { + this.ea = ea; + } + + public boolean isAs() { + return as; + } + + public void setAs(boolean as) { + this.as = as; + } + + public boolean isBc() { + return bc; + } + + public void setBc(boolean bc) { + this.bc = bc; + } + + public boolean isBe() { + return be; + } + + public void setBe(boolean be) { + this.be = be; + } + + public boolean isBf() { + return bf; + } + + public void setBf(boolean bf) { + this.bf = bf; + } + + public boolean isMa() { + return ma; + } + + public void setMa(boolean ma) { + this.ma = ma; + } + + public boolean isCa() { + return ca; + } + + public void setCa(boolean ca) { + this.ca = ca; + } + + public boolean isCb() { + return cb; + } + + public void setCb(boolean cb) { + this.cb = cb; + } + + public boolean isCe() { + return ce; + } + + public void setCe(boolean ce) { + this.ce = ce; + } + + public boolean isTf() { + return tf; + } + + public void setTf(boolean tf) { + this.tf = tf; + } + + public boolean isDd() { + return dd; + } - public boolean isDe() { - return de; - } + public void setDd(boolean dd) { + this.dd = dd; + } - public void setDe(boolean de) { - this.de = de; - } + public boolean isPh() { + return ph; + } - public boolean isEu() { - return eu; - } + public void setPh(boolean ph) { + this.ph = ph; + } - public void setEu(boolean eu) { - this.eu = eu; - } + public boolean isDe() { + return de; + } - public boolean isGa() { - return ga; - } + public void setDe(boolean de) { + this.de = de; + } - public void setGa(boolean ga) { - this.ga = ga; - } + public boolean isEu() { + return eu; + } - public boolean isIo() { - return io; - } + public void setEu(boolean eu) { + this.eu = eu; + } - public void setIo(boolean io) { - this.io = io; - } + public boolean isGa() { + return ga; + } - public boolean isVe() { - return ve; - } + public void setGa(boolean ga) { + this.ga = ga; + } - public void setVe(boolean ve) { - this.ve = ve; - } + public boolean isIo() { + return io; + } - public boolean isMe() { - return me; - } + public void setIo(boolean io) { + this.io = io; + } - public void setMe(boolean me) { - this.me = me; - } + public boolean isVe() { + return ve; + } + + public void setVe(boolean ve) { + this.ve = ve; + } + + public boolean isMe() { + return me; + } + + public void setMe(boolean me) { + this.me = me; + } + + public boolean isEn() { + return en; + } + + public void setEn(boolean en) { + this.en = en; + } + + public boolean isTi() { + return ti; + } + + public void setTi(boolean ti) { + this.ti = ti; + } + + public boolean isMi() { + return mi; + } + + public void setMi(boolean mi) { + this.mi = mi; + } + + public boolean isOb() { + return ob; + } + + public void setOb(boolean ob) { + this.ob = ob; + } + + public boolean isTr() { + return tr; + } + + public void setTr(boolean tr) { + this.tr = tr; + } + + public boolean isPr() { + return pr; + } + + public void setPr(boolean pr) { + this.pr = pr; + } + + public boolean isPl() { + return pl; + } + + public void setPl(boolean pl) { + this.pl = pl; + } + + public boolean isKb() { + return kb; + } + + public void setKb(boolean kb) { + this.kb = kb; + } + + public boolean isHa() { + return ha; + } + + public void setHa(boolean ha) { + this.ha = ha; + } + + public boolean isMake() { + return make; + } + + public void setMake(boolean make) { + this.make = make; + } + + public boolean isVb() { + return vb; + } + + public void setVb(boolean vb) { + this.vb = vb; + } + + public boolean isTcetie() { + return tcetie; + } + + public void setTcetie(boolean tcetie) { + this.tcetie = tcetie; + } + + public String getOreName() { + return this.oreName; + } + + public void setOreName(String s) { + this.oreName = s; + } + + public String getPrimary() { + return this.primary; + } + + public void setPrimary(String s) { + this.primary = s; + } + + public String getSecondary() { + return this.secondary; + } + + public void setSecondary(String s) { + this.secondary = s; + } + + public String getInbetween() { + return this.inbetween; + } + + public void setInbetween(String s) { + this.inbetween = s; + } + + public String getAround() { + return this.around; + } + + public void setAround(String s) { + this.around = s; + } + + public String getMix() { + return this.mix; + } + + public void setMix(String s) { + this.mix = s; + } + + public String getTier() { + return this.tier; + } + + public void setTier(String s) { + this.tier = s; + } + + public String getHeight() { + return this.height; + } + + public void setHeight(String s) { + this.height = s; + } + + public int getDensity() { + return this.density; + } + + public void setDensity(int i) { + this.density = i; + } + + public int getSize() { + return this.size; + } + + public void setSize(int i) { + this.size = i; + } + + public int getWeight() { + return this.weight; + } + + public void setWeight(int i) { + this.weight = i; + } + + public int getMinY() { + calculateminmax(); + return this.miny; + } + + public void setMinY(int i) { + this.miny = i; + } + + public int getMaxY() { + calculateminmax(); + return this.maxy; + } + + public void setMaxY(int i) { + this.maxy = i; + } + + public boolean getOverworld() { + return this.overworld; + } + + public void setOverworld(boolean s) { + this.overworld = s; + } + + public boolean getNether() { + return this.nether; + } + + public void setNether(boolean s) { + this.nether = s; + } + + public boolean getEnd() { + return this.end; + } + + public void setEnd(boolean s) { + this.end = s; + } + + private void calculateminmax() { + this.miny = Integer.parseInt(this.height.split("-")[0]); + this.maxy = Integer.parseInt(this.height.split("-")[1]); + } + + public String getHeightcalced() { + return new String(this.miny + "-" + this.maxy); + } - public boolean isEn() { - return en; - } - - public void setEn(boolean en) { - this.en = en; - } - - public boolean isTi() { - return ti; - } - - public void setTi(boolean ti) { - this.ti = ti; - } - - public boolean isMi() { - return mi; - } - - public void setMi(boolean mi) { - this.mi = mi; - } - - public boolean isOb() { - return ob; - } - - public void setOb(boolean ob) { - this.ob = ob; - } - - public boolean isTr() { - return tr; - } - - public void setTr(boolean tr) { - this.tr = tr; - } - - public boolean isPr() { - return pr; - } - - public void setPr(boolean pr) { - this.pr = pr; - } - - public boolean isPl() { - return pl; - } - - public void setPl(boolean pl) { - this.pl = pl; - } - - public boolean isKb() { - return kb; - } - - public void setKb(boolean kb) { - this.kb = kb; - } - - public boolean isHa() { - return ha; - } - - public void setHa(boolean ha) { - this.ha = ha; - } - - public boolean isMake() { - return make; - } - - public void setMake(boolean make) { - this.make = make; - } - - public boolean isVb() { - return vb; - } - - public void setVb(boolean vb) { - this.vb = vb; - } - - public boolean isTcetie() { - return tcetie; - } - - public void setTcetie(boolean tcetie) { - this.tcetie = tcetie; - } - - @CsvCustomBindByName(column = "End Asteroids", required = false, converter = XtoBool.class) - public boolean ea; - @CsvCustomBindByName(column = "AstroidBelt", required = false, converter = XtoBool.class) - public boolean as; - @CsvCustomBindByName(column = "Barnard C", required = false, converter = XtoBool.class) - public boolean bc; - @CsvCustomBindByName(column = "Barnard E", required = false, converter = XtoBool.class) - public boolean be; - @CsvCustomBindByName(column = "Barnard F", required = false, converter = XtoBool.class) - public boolean bf; - @CsvCustomBindByName(column = "Mars", required = false, converter = XtoBool.class) - public boolean ma; - @CsvCustomBindByName(column = "Callisto", required = false, converter = XtoBool.class) - public boolean ca; - @CsvCustomBindByName(column = "Centauri Bb", required = false, converter = XtoBool.class) - public boolean cb; - @CsvCustomBindByName(column = "Ceres", required = false, converter = XtoBool.class) - public boolean ce; - @CsvCustomBindByName(column = "Twilight Forest", required = false, converter = XtoBool.class) - public boolean tf; - @CsvCustomBindByName(column = "Deep Dark", required = false, converter = XtoBool.class) - public boolean dd; - @CsvCustomBindByName(column = "Phobos", required = false, converter = XtoBool.class) - public boolean ph; - @CsvCustomBindByName(column = "Deimos", required = false, converter = XtoBool.class) - public boolean de; - @CsvCustomBindByName(column = "Europa", required = false, converter = XtoBool.class) - public boolean eu; - @CsvCustomBindByName(column = "Ganymede", required = false, converter = XtoBool.class) - public boolean ga; - @CsvCustomBindByName(column = "Io", required = false, converter = XtoBool.class) - public boolean io; - @CsvCustomBindByName(column = "Venus", required = false, converter = XtoBool.class) - public boolean ve; - @CsvCustomBindByName(column = "Mercury", required = false, converter = XtoBool.class) - public boolean me; - @CsvCustomBindByName(column = "Enceladus", required = false, converter = XtoBool.class) - public boolean en; - @CsvCustomBindByName(column = "Titan", required = false, converter = XtoBool.class) - public boolean ti; - @CsvCustomBindByName(column = "Miranda", required = false, converter = XtoBool.class) - public boolean mi; - @CsvCustomBindByName(column = "Oberon", required = false, converter = XtoBool.class) - public boolean ob; - @CsvCustomBindByName(column = "Triton", required = false, converter = XtoBool.class) - public boolean tr; - @CsvCustomBindByName(column = "Proteus", required = false, converter = XtoBool.class) - public boolean pr; - @CsvCustomBindByName(column = "Pluto", required = false, converter = XtoBool.class) - public boolean pl; - @CsvCustomBindByName(column = "Kuiper Belt", required = false, converter = XtoBool.class) - public boolean kb; - @CsvCustomBindByName(column = "Haumea", required = false, converter = XtoBool.class) - public boolean ha; - @CsvCustomBindByName(column = "Makemake", required = false, converter = XtoBool.class) - public boolean make; - @CsvCustomBindByName(column = "Vega B", required = false, converter = XtoBool.class) - public boolean vb; - @CsvCustomBindByName(column = "T Ceti E", required = false, converter = XtoBool.class) - public boolean tcetie; - - - - - public Oremix() { - } - - public void setOreName(String s) { - this.oreName = s; - } - public void setPrimary(String s) { - this.primary = s; - } - public void setSecondary(String s) { - this.secondary = s; - } - public void setInbetween(String s) { - this.inbetween = s; - } - public void setAround(String s) { - this.around = s; - } - public void setMix(String s) { - this.mix = s; - } - public void setTier(String s) { - this.tier = s; - } - public void setHeight(String s) { - this.height = s; - } - public void setDensity(int i) { - this.density = i; - } - public void setSize(int i) { - this.size = i; - } - public void setWeight(int i) { - this.weight = i; - } - public void setOverworld(boolean s) { - this.overworld = s; - } - public void setNether(boolean s) { - this.nether = s; - } - public void setEnd(boolean s) { - this.end = s; - } - - public String getOreName() { - return this.oreName; - } - - public String getPrimary() { - return this.primary; - } - public String getSecondary() { - return this.secondary; - } - public String getInbetween() { - return this.inbetween; - } - public String getAround() { - return this.around; - } - public String getMix() { - return this.mix; - } - public String getTier() { - return this.tier; - } - public String getHeight() { - return this.height; - } - public int getDensity() { - return this.density; - } - public int getSize() { - return this.size; - } - public int getWeight() { - return this.weight; - } - public int getMinY() { - calculateminmax(); - return this.miny; - } - public int getMaxY() { - calculateminmax(); - return this.maxy; - } - public boolean getOverworld() { - return this.overworld; - } - public boolean getNether() { - return this.nether; - } - public boolean getEnd() { - return this.end; - } - - private int miny,maxy; - - private void calculateminmax() { - this.miny=Integer.parseInt(this.height.split("-")[0]); - this.maxy=Integer.parseInt(this.height.split("-")[1]); - } - - public void setMinY(int i) { - this.miny=i; - } - public void setMaxY(int i) { - this.maxy=i; - } - - public String getHeightcalced() { - return new String (this.miny+"-"+this.maxy); - } - } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java b/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java index 8c0ca7df58..a721d88e82 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java @@ -6,23 +6,22 @@ import com.opencsv.exceptions.CsvDataTypeMismatchException; public class Veinrenamer extends AbstractBeanField { - @Override - protected Object convert(String value) throws CsvDataTypeMismatchException, CsvConstraintViolationException { - String ret = null; - CharSequence s = "/"; + @Override + protected Object convert(String value) throws CsvDataTypeMismatchException, CsvConstraintViolationException { + String ret = null; + CharSequence s = "/"; - if (value.contains(s)) { - ret = value.split("/")[1]; - ret =ret.replaceAll("&", ""); - ret =ret.replaceAll(" ", ""); - ret =ret.replaceAll("\\.", ""); - ret = ret.toLowerCase(); - } - else - ret=value; - ret =ret.replaceAll(" ", ""); - ret = ret.toLowerCase(); - return ret; - } + if (value.contains(s)) { + ret = value.split("/")[1]; + ret = ret.replaceAll("&", ""); + ret = ret.replaceAll(" ", ""); + ret = ret.replaceAll("\\.", ""); + ret = ret.toLowerCase(); + } else + ret = value; + ret = ret.replaceAll(" ", ""); + ret = ret.toLowerCase(); + return ret; + } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java b/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java index 7839221630..c27a480557 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java @@ -1,23 +1,22 @@ package pers.gwyog.gtneioreplugin.util; -import java.util.ResourceBundle; - +import com.opencsv.bean.AbstractBeanField; +import com.opencsv.exceptions.CsvConstraintViolationException; +import com.opencsv.exceptions.CsvDataTypeMismatchException; import org.apache.commons.beanutils.ConversionException; import org.apache.commons.beanutils.Converter; import org.apache.commons.beanutils.converters.BooleanConverter; -import com.opencsv.bean.AbstractBeanField; -import com.opencsv.exceptions.CsvConstraintViolationException; -import com.opencsv.exceptions.CsvDataTypeMismatchException; +import java.util.ResourceBundle; public class XtoBool extends AbstractBeanField { - @Override - protected Object convert(String value) throws CsvDataTypeMismatchException, CsvConstraintViolationException { - if (value.isEmpty()) { + @Override + protected Object convert(String value) throws CsvDataTypeMismatchException, CsvConstraintViolationException { + if (value.isEmpty()) { return null; } - String[] trueStrings = {"x","X"}; + String[] trueStrings = {"x", "X"}; String[] falseStrings = {""}; Converter bc = new BooleanConverter(trueStrings, falseStrings); try { @@ -25,12 +24,12 @@ public class XtoBool extends AbstractBeanField { } catch (ConversionException e) { CsvDataTypeMismatchException csve = new CsvDataTypeMismatchException( value, field.getType(), ResourceBundle - .getBundle("convertGermanToBoolean", errorLocale) - .getString("input.not.boolean")); + .getBundle("convertGermanToBoolean", errorLocale) + .getString("input.not.boolean")); csve.initCause(e); throw csve; } } - + } -- cgit From 63e659f8ec07d81f972fd898407f92019edd06a6 Mon Sep 17 00:00:00 2001 From: Lex <50260829+4gname@users.noreply.github.com> Date: Mon, 23 Nov 2020 05:42:23 +0700 Subject: add Tier Planets --- .../gwyog/gtneioreplugin/util/DimensionHelper.java | 52 +++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java index 1d4b0e0025..13f9b02545 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -101,6 +101,56 @@ public class DimensionHelper { s = "Deep Dark"; else if (s.equals("EndAsteroid")) s = "Far End Asteroids"; + + switch (s) { + case "Moon": + s = s + " (T1)"; + break; + case "Mars": + case "Phobos": + case "Deimos": + s = s + " (T2)"; + break; + case "Asteroids": + case "Ceres": + case "Europa": + case "Ganymede": + case "Callisto": + s = s + " (T3)"; + break; + case "Io": + case "Venus": + case "Mercury": + s = s + " (T4)"; + break; + case "Enceladus": + case "Titan": + case "Miranda": + case "Oberon": + s = s + " (T5)"; + break; + case "Proteus": + case "Triton": + s = s + " (T6)"; + break; + case "Pluto": + case "Kuiperbelt": + case "Haumea": + case "MakeMake": + s = s + " (T7)"; + break; + case "Deep Dark": + case "CentauriBb": + case "CentauriA": + case "VegaB": + case "BarnardC": + case "BarnardE": + case "BarnardF": + case "TcetiE": + s = s + " (T8)"; + break; + } + dims[j] = s; } } @@ -111,4 +161,4 @@ public class DimensionHelper { public static List convertCondensedStringToToolTip(String line) { return tooltipBuffer.computeIfAbsent(line, (String tmp) -> computeString(line)); } -} \ No newline at end of file +} -- cgit From 7265ed895127dc2fcb38d21e91c77356749f9951 Mon Sep 17 00:00:00 2001 From: Martin Robertz Date: Mon, 23 Nov 2020 11:19:04 +0100 Subject: fix(NEiPlugin)update Gt build version Now Jenkins will build it. --- build.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.properties b/build.properties index 1af417224e..8fd510d9bd 100644 --- a/build.properties +++ b/build.properties @@ -1,8 +1,8 @@ -gregtech.version=5.09.33.12 -gregtech.jenkinsbuild=265 +gregtech.version=5.09.33.57 +gregtech.jenkinsbuild=754 croploadcore.version=0.0.8 minecraft.version=1.7.10 ccl.version=1.1.3.140 ccc.version=1.0.7.47 nei.version=1.0.5.120 -ic2.version=2.2.828-experimental \ No newline at end of file +ic2.version=2.2.828-experimental -- cgit From 6cf2ebb40a28384a9dd372541cb9c697ba88a264 Mon Sep 17 00:00:00 2001 From: DreamMasterXXL Date: Sun, 20 Dec 2020 13:03:11 +0100 Subject: bump version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 31a812d609..b1bf0e8750 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ apply plugin: 'forge' apply plugin: 'signing' import de.undercouch.gradle.tasks.download.Download -version = "1.7.10-1.0.7" +version = "1.7.10-1.0.8" group= "pers.gwyog.gtneioreplugin" archivesBaseName = "gtneioreplugin" -- cgit From 66d8c20fa08b89ca74dc188d4e1991713f59f2cb Mon Sep 17 00:00:00 2001 From: DreamMasterXXL Date: Sun, 20 Dec 2020 13:04:58 +0100 Subject: bump gt build dependencies --- build.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.properties b/build.properties index 8fd510d9bd..ebe3c5dff0 100644 --- a/build.properties +++ b/build.properties @@ -1,5 +1,5 @@ -gregtech.version=5.09.33.57 -gregtech.jenkinsbuild=754 +gregtech.version=5.09.34.00 +gregtech.jenkinsbuild=808 croploadcore.version=0.0.8 minecraft.version=1.7.10 ccl.version=1.1.3.140 -- cgit From 27a4e86732029ef4788f93c264444b85fc4aa0f6 Mon Sep 17 00:00:00 2001 From: iouter <3155186831@qq.com> Date: Mon, 19 Jul 2021 15:03:01 +0800 Subject: add lang key about dimension and fix a localization issue --- .../plugin/gregtech5/PluginGT5Base.java | 2 +- .../gwyog/gtneioreplugin/util/DimensionHelper.java | 18 ++++------ .../assets/gtneioreplugin/lang/en_US.lang | 40 ++++++++++++++++++---- .../assets/gtneioreplugin/lang/zh_CN.lang | 40 ++++++++++++++++++---- 4 files changed, 75 insertions(+), 25 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java index 88775c3e14..00107e12c1 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java @@ -19,7 +19,7 @@ public class PluginGT5Base extends PluginBase { protected boolean ttDisplayed = false; protected static String getLocalizedNameForItem(Materials aMaterial, String aFormat) { - return String.format(aFormat.replace("%s", "%temp").replace("%material", "%s"), aMaterial.mDefaultLocalName).replace("%temp", "%s"); + return String.format(aFormat.replace("%s", "%temp").replace("%material", "%s"), aMaterial.mLocalizedName).replace("%temp", "%s"); } protected static int calculateMaxW(List L) { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java index 13f9b02545..e3d59e4d08 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -3,6 +3,7 @@ package pers.gwyog.gtneioreplugin.util; import java.util.Arrays; import java.util.HashMap; import java.util.List; +import net.minecraft.client.resources.I18n; public class DimensionHelper { @@ -94,15 +95,9 @@ public class DimensionHelper { s = s.trim(); for (int i = 0; i < DimNameDisplayed.length; i++) { if (s.equals(DimNameDisplayed[i])) { - s = DimName[i].replaceAll("GalacticraftCore_", "").replaceAll("GalacticraftMars_", "").replaceAll("GalaxySpace_", "").replaceAll("Vanilla_", "Vanilla "); - if (s.equals("Twilight")) - s = "Twilight Forrest"; - else if (s.equals("Underdark")) - s = "Deep Dark"; - else if (s.equals("EndAsteroid")) - s = "Far End Asteroids"; - - switch (s) { + s = I18n.format("gtnop.world." + DimName[i].replaceAll("GalacticraftCore_", "").replaceAll("GalacticraftMars_", "").replaceAll("GalaxySpace_", "").replaceAll("Vanilla_", "Vanilla ")); + String k = DimName[i].replaceAll("GalacticraftCore_", "").replaceAll("GalacticraftMars_", "").replaceAll("GalaxySpace_", "").replaceAll("Vanilla_", "Vanilla "); + switch (k) { case "Moon": s = s + " (T1)"; break; @@ -140,7 +135,6 @@ public class DimensionHelper { s = s + " (T7)"; break; case "Deep Dark": - case "CentauriBb": case "CentauriA": case "VegaB": case "BarnardC": @@ -150,7 +144,7 @@ public class DimensionHelper { s = s + " (T8)"; break; } - + dims[j] = s; } } @@ -161,4 +155,4 @@ public class DimensionHelper { public static List convertCondensedStringToToolTip(String line) { return tooltipBuffer.computeIfAbsent(line, (String tmp) -> computeString(line)); } -} +} \ No newline at end of file diff --git a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang index a02ecb0b58..e17206d995 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang @@ -35,12 +35,40 @@ gtnop.nei.genPositionInfo=In the center of each chunk # world names -gtnop.world.overworld.name=Overworld -gtnop.world.nether.name=Nether -gtnop.world.end.name=End -gtnop.world.moon.name=Moon -gtnop.world.mars.name=Mars -gtnop.world.asteroid.name=GalactiCraft Asteroid +gtnop.world.Overworld=Overworld +gtnop.world.Nether=Nether +gtnop.world.TheEnd=TheEnd +gtnop.world.Twilight=Twilight Forrest +gtnop.world.EndAsteroid=Far End Asteroids +gtnop.world.Moon=Moon +gtnop.world.Mars=Mars +gtnop.world.Phobos=Phobos +gtnop.world.Deimos=Deimos +gtnop.world.Asteroids=Asteroids +gtnop.world.Ceres=Ceres +gtnop.world.Europa=Europa +gtnop.world.Ganymede=Ganymede +gtnop.world.Callisto=Callisto +gtnop.world.Io=Io +gtnop.world.Venus=Venus +gtnop.world.Mercury=Mercury +gtnop.world.Enceladus=Enceladus +gtnop.world.Titan=Titan +gtnop.world.Miranda=Miranda +gtnop.world.Oberon=Oberon +gtnop.world.Proteus=Proteus +gtnop.world.Triton=Triton +gtnop.world.Pluto=Pluto +gtnop.world.Kuiperbelt=Kuiperbelt +gtnop.world.Haumea=Haumea +gtnop.world.MakeMake=MakeMake +gtnop.world.CentauriA=CentauriA +gtnop.world.VegaB=VegaB +gtnop.world.BarnardC=BarnardC +gtnop.world.BarnardE=BarnardE +gtnop.world.BarnardF=BarnardF +gtnop.world.TcetiE=TcetiE +gtnop.world.Underdark=Deep Dark # biome names diff --git a/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang b/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang index 28b037420e..d3e5a2e32d 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang @@ -35,12 +35,40 @@ gtnop.nei.genPositionInfo=各个区块的正中心 # world names -gtnop.world.overworld.name=主世界 -gtnop.world.nether.name=下界 -gtnop.world.end.name=末地 -gtnop.world.moon.name=月球 -gtnop.world.mars.name=火星 -gtnop.world.asteroid.name=星系mod小行星带 +gtnop.world.Overworld=主世界 +gtnop.world.Nether=下界 +gtnop.world.TheEnd=末地 +gtnop.world.Twilight=暮色森林 +gtnop.world.EndAsteroid=末地小行星 +gtnop.world.Moon=月球 +gtnop.world.Mars=火星 +gtnop.world.Phobos=火卫一 +gtnop.world.Deimos=火卫二 +gtnop.world.Asteroids=小行星带 +gtnop.world.Ceres=谷神星 +gtnop.world.Europa=木卫二 +gtnop.world.Ganymede=木卫三 +gtnop.world.Callisto=木卫四 +gtnop.world.Io=木卫一 +gtnop.world.Venus=金星 +gtnop.world.Mercury=水星 +gtnop.world.Enceladus=土卫二 +gtnop.world.Titan=土卫六 +gtnop.world.Miranda=天卫五 +gtnop.world.Oberon=天卫四 +gtnop.world.Proteus=海卫八 +gtnop.world.Triton=海卫一 +gtnop.world.Pluto=冥王星 +gtnop.world.Kuiperbelt=柯伊伯带 +gtnop.world.Haumea=妊神星 +gtnop.world.MakeMake=鸟神星 +gtnop.world.CentauriA=半人马Bb +gtnop.world.VegaB=织女B +gtnop.world.BarnardC=巴纳德C +gtnop.world.BarnardE=巴纳德E +gtnop.world.BarnardF=巴纳德F +gtnop.world.TcetiE=鲸鱼座T星E +gtnop.world.Underdark=漆黑世界 # biome names -- cgit From c8206f57b2e775c3fa01911ef312a37583fbe065 Mon Sep 17 00:00:00 2001 From: iouter <3155186831@qq.com> Date: Mon, 19 Jul 2021 20:24:07 +0800 Subject: fix Deep Dark --- src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java index e3d59e4d08..75b227d8a4 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -134,7 +134,7 @@ public class DimensionHelper { case "MakeMake": s = s + " (T7)"; break; - case "Deep Dark": + case "Underdark": case "CentauriA": case "VegaB": case "BarnardC": -- cgit From 0fbf2ad3adfe223c38a46b27c3a5dfc3ab4b879e Mon Sep 17 00:00:00 2001 From: iouter <3155186831@qq.com> Date: Tue, 20 Jul 2021 16:53:02 +0800 Subject: add "Vanilla EndAsteroids" and delete vein names in zh_CN --- .../assets/gtneioreplugin/lang/en_US.lang | 1 + .../assets/gtneioreplugin/lang/zh_CN.lang | 50 +--------------------- 2 files changed, 3 insertions(+), 48 deletions(-) diff --git a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang index e17206d995..39a8d53e6d 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang @@ -40,6 +40,7 @@ gtnop.world.Nether=Nether gtnop.world.TheEnd=TheEnd gtnop.world.Twilight=Twilight Forrest gtnop.world.EndAsteroid=Far End Asteroids +gtnop.world.Vanilla EndAsteroids=Vanilla EndAsteroids gtnop.world.Moon=Moon gtnop.world.Mars=Mars gtnop.world.Phobos=Phobos diff --git a/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang b/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang index d3e5a2e32d..ce0fe22f00 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang @@ -40,6 +40,7 @@ gtnop.world.Nether=下界 gtnop.world.TheEnd=末地 gtnop.world.Twilight=暮色森林 gtnop.world.EndAsteroid=末地小行星 +gtnop.world.Vanilla EndAsteroids=原版末地小行星 gtnop.world.Moon=月球 gtnop.world.Mars=火星 gtnop.world.Phobos=火卫一 @@ -82,51 +83,4 @@ gtnop.ore.null.name=无 # vein types gtnop.ore.vein.name=矿脉 gtnop.ore.asteroid.name=小行星 -gtnop.ore.custom.name=自定义 - - -# vein names -# gregtech5.09 -gtnop.ore.mix.naquadah=硅岩 -gtnop.ore.mix.lignite=褐煤 -gtnop.ore.mix.coal=煤 -gtnop.ore.mix.magnetite=磁铁 -gtnop.ore.mix.gold=金 -gtnop.ore.mix.iron=铁 -gtnop.ore.mix.cassiterite=锡石 -gtnop.ore.mix.tetrahedrite=黝铜 -gtnop.ore.mix.netherquartz=下届石英 -gtnop.ore.mix.sulfur=硫 -gtnop.ore.mix.copper=铜 -gtnop.ore.mix.bauxite=铝土 -gtnop.ore.mix.salts=岩盐 -gtnop.ore.mix.redstone=红石 -gtnop.ore.mix.soapstone=皂石 -gtnop.ore.mix.nickel=镍 -gtnop.ore.mix.platinum=铂 -gtnop.ore.mix.pitchblende=沥青铀 -gtnop.ore.mix.uranium=铀 -gtnop.ore.mix.monazite=独居石 -gtnop.ore.mix.molybdenum=钼 -gtnop.ore.mix.tungstate=钨酸盐 -gtnop.ore.mix.sapphire=蓝宝石 -gtnop.ore.mix.manganese=锰 -gtnop.ore.mix.quartz=石英岩 -gtnop.ore.mix.diamond=钻石 -gtnop.ore.mix.olivine=橄榄石 -gtnop.ore.mix.apatite=磷灰石 -gtnop.ore.mix.galena=方铅矿 -gtnop.ore.mix.lapis=青金石 -gtnop.ore.mix.beryllium=铍 -gtnop.ore.mix.oilsand=油砂 - -# gregtech5.08 -gtnop.ore.mix.plutonium=钚 - -# gregtech6 -gtnop.ore.mix.iodinesalt=Iodinesalt -gtnop.ore.mix.rocksalt=岩盐 -gtnop.ore.mix.asbestos=石棉 -gtnop.ore.mix.titanium=钛 -gtnop.ore.mix.garnet=石榴石 -gtnop.ore.mix.dolamide=Dolamide \ No newline at end of file +gtnop.ore.custom.name=自定义 \ No newline at end of file -- cgit From a68e8610086d810ddfe646d44c7489e4b9b7d843 Mon Sep 17 00:00:00 2001 From: iouter <3155186831@qq.com> Date: Tue, 20 Jul 2021 17:15:04 +0800 Subject: αCentauriBb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/assets/gtneioreplugin/lang/en_US.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang index 39a8d53e6d..b770cea7cb 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang @@ -63,7 +63,7 @@ gtnop.world.Pluto=Pluto gtnop.world.Kuiperbelt=Kuiperbelt gtnop.world.Haumea=Haumea gtnop.world.MakeMake=MakeMake -gtnop.world.CentauriA=CentauriA +gtnop.world.CentauriA=αCentauriBb gtnop.world.VegaB=VegaB gtnop.world.BarnardC=BarnardC gtnop.world.BarnardE=BarnardE -- cgit From 72462399dc212be435188a41e44c8d81ada33d4c Mon Sep 17 00:00:00 2001 From: DreamMasterXXL Date: Fri, 30 Jul 2021 22:21:25 +0200 Subject: update(GT-NEI)Gradle update buildscript and gitignore (cherry picked from commit 0f5996b1a38b20f8bff113e6762439974912bdba) --- .gitignore | 1 + build.gradle | 15 +++++++++------ build.properties | 4 ++-- gradle/wrapper/gradle-wrapper.jar | Bin 51017 -> 53324 bytes gradle/wrapper/gradle-wrapper.properties | 4 ++-- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 0b6a00d78f..18ebc78006 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ out/ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* +*.bat diff --git a/build.gradle b/build.gradle index b1bf0e8750..9dfde5bbc7 100644 --- a/build.gradle +++ b/build.gradle @@ -2,25 +2,28 @@ buildscript { repositories { mavenCentral() maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" + name = "gt" + url = "https://gregtech.overminddl1.com/" } maven { name = "sonatype" url = "https://oss.sonatype.org/content/repositories/snapshots/" } + maven { + name = "jitpack.io" + url = "https://jitpack.io" + } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' - classpath "de.undercouch:gradle-download-task:3.1.2" + classpath 'com.github.GTNH2:ForgeGradle:FG_1.2-SNAPSHOT' + classpath "de.undercouch:gradle-download-task:3.1.2" } } - apply plugin: 'forge' apply plugin: 'signing' import de.undercouch.gradle.tasks.download.Download -version = "1.7.10-1.0.8" +version = "1.7.10-1.0.8-test" group= "pers.gwyog.gtneioreplugin" archivesBaseName = "gtneioreplugin" diff --git a/build.properties b/build.properties index ebe3c5dff0..e45afb7c16 100644 --- a/build.properties +++ b/build.properties @@ -1,5 +1,5 @@ -gregtech.version=5.09.34.00 -gregtech.jenkinsbuild=808 +gregtech.version=5.09.37.01 +gregtech.jenkinsbuild=1402 croploadcore.version=0.0.8 minecraft.version=1.7.10 ccl.version=1.1.3.140 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index b761216703..3baa851b28 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index aae599bbfa..82b0d2f5d7 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Jul 02 15:54:47 CDT 2014 +#Sat Jan 04 01:52:14 CET 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip -- cgit From b9243f048bd18301b8bc65b9ae376ccc56d0250b Mon Sep 17 00:00:00 2001 From: iouter <3155186831@qq.com> Date: Sat, 31 Jul 2021 13:02:00 +0800 Subject: reduce code duplication --- src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java index 75b227d8a4..427d8a8be8 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -95,8 +95,8 @@ public class DimensionHelper { s = s.trim(); for (int i = 0; i < DimNameDisplayed.length; i++) { if (s.equals(DimNameDisplayed[i])) { - s = I18n.format("gtnop.world." + DimName[i].replaceAll("GalacticraftCore_", "").replaceAll("GalacticraftMars_", "").replaceAll("GalaxySpace_", "").replaceAll("Vanilla_", "Vanilla ")); String k = DimName[i].replaceAll("GalacticraftCore_", "").replaceAll("GalacticraftMars_", "").replaceAll("GalaxySpace_", "").replaceAll("Vanilla_", "Vanilla "); + s = I18n.format("gtnop.world." + k); switch (k) { case "Moon": s = s + " (T1)"; -- cgit From 61bc530418284c8b77da15fe1670ac3c8d34f0a4 Mon Sep 17 00:00:00 2001 From: DreamMasterXXL Date: Sat, 31 Jul 2021 12:04:20 +0200 Subject: update(GT-NEI)version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 9dfde5bbc7..b3577aba37 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ apply plugin: 'forge' apply plugin: 'signing' import de.undercouch.gradle.tasks.download.Download -version = "1.7.10-1.0.8-test" +version = "1.7.10-1.0.9" group= "pers.gwyog.gtneioreplugin" archivesBaseName = "gtneioreplugin" -- cgit From 240a5e4b2b1aafc0c3fe3948455ab5d9a9fdfdd6 Mon Sep 17 00:00:00 2001 From: Johann Bernhardt Date: Fri, 29 Oct 2021 02:29:11 +0200 Subject: Synchronize ore vein names to visual prospecting if installed --- .../plugin/gregtech5/PluginGT5VeinStat.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java index 2c9f9d3298..c288aa72ca 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -2,6 +2,7 @@ package pers.gwyog.gtneioreplugin.plugin.gregtech5; import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; +import cpw.mods.fml.common.Loader; import gregtech.api.GregTech_API; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; @@ -176,12 +177,18 @@ public class PluginGT5VeinStat extends PluginGT5Base { GuiDraw.drawString(I18n.format(getLocalizedVeinName(oreLayer)[1]), 2, 30, 0x404040, false); } else*/ - if (getGTOreLocalizedName(oreLayer.Meta[0]).contains("Ore")) - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]).split("Ore")[0] + "" + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); - else if (getGTOreLocalizedName(oreLayer.Meta[0]).contains("Sand")) - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]).split("Sand")[0] + "" + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); - else - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]) + " " + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); + if(Loader.isModLoaded("visualprospecting")) { + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + I18n.format(oreLayer.veinName) + "" + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); + } + else { + if (getGTOreLocalizedName(oreLayer.Meta[0]).contains("Ore")) + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]).split("Ore")[0] + "" + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); + else if (getGTOreLocalizedName(oreLayer.Meta[0]).contains("Sand")) + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]).split("Sand")[0] + "" + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); + else + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]) + " " + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); + } + drawToolTip(sDimNames); if (!ttDisplayed) { GuiDraw.drawString(I18n.format("gtnop.gui.nei.primaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]), 2, 50, 0x404040, false); -- cgit From f4269518edfdd7331b5d64018427ac0a99b1a556 Mon Sep 17 00:00:00 2001 From: DreamMasterXXL Date: Sat, 30 Oct 2021 13:24:45 +0200 Subject: bump gt dependencie --- build.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.properties b/build.properties index e45afb7c16..e2d5ba2f21 100644 --- a/build.properties +++ b/build.properties @@ -1,5 +1,5 @@ -gregtech.version=5.09.37.01 -gregtech.jenkinsbuild=1402 +gregtech.version=5.09.38.04 +gregtech.jenkinsbuild=1666 croploadcore.version=0.0.8 minecraft.version=1.7.10 ccl.version=1.1.3.140 -- cgit From 9b2272b6ec23bb4a1f92ef9d8af5eb1258fa776a Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Sun, 5 Dec 2021 12:15:19 -0800 Subject: Update license (#11) * Add license * Update Readme --- COPYING | 674 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ COPYING.LESSER | 165 ++++++++++++++ LICENSE | 7 + README.MD | 3 +- 4 files changed, 847 insertions(+), 2 deletions(-) create mode 100644 COPYING create mode 100644 COPYING.LESSER diff --git a/COPYING b/COPYING new file mode 100644 index 0000000000..19d1fa01fb --- /dev/null +++ b/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +.1996 diff --git a/COPYING.LESSER b/COPYING.LESSER new file mode 100644 index 0000000000..0a041280bd --- /dev/null +++ b/COPYING.LESSER @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/LICENSE b/LICENSE index 39bf9ee6dd..3c7feb57c2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,10 @@ +GTNH Modifications: + +LGPL v3.0 or later. See COPYING & COPYING.LESSER. Feel free to use our changes, just give back any changes you make to the community as well! + + +Original License: + MIT License Copyright (c) 2016 JJN diff --git a/README.MD b/README.MD index bc5bbdbdd9..34b77ce188 100644 --- a/README.MD +++ b/README.MD @@ -8,7 +8,7 @@ These plugins are: ### Download -You can find the download link [here](https://github.com/bartimaeusnek/GTNEIOrePlugin/releases). +You can find the download link [here](https://github.com/GTNewHorizons/GTNEIOrePlugin/releases). ### Build If you want a bleeding-edge version of this mod, you can simply download or clone this repository, establish a folder named "libs" and put the dev builds: @@ -20,5 +20,4 @@ in the folder. Then you can build this mod in the same way as building other mods. i.e. run "gradlew build" command in the CMD window. Then the build can be found in "./build/libs/" folder. ### License -The whole repository is under [MIT](https://github.com/bartimaeusnek/GTNEIOrePlugin/blob/GT-NH-Mod/LICENSE) License. You can feel free to use the mod in your modpacks. If you add my name in your credit list, I'll be super happy with that. -- cgit From b4f5e02a69cd72d7d4ef75d101b6d14746297972 Mon Sep 17 00:00:00 2001 From: bombcar Date: Sun, 5 Dec 2021 19:57:24 -0600 Subject: update dependencies (#12) * update build scripts and dependencies to use gtnh * note not 5.5.2 --- build.gradle | 48 +++++++++++++++++------------------------------- gradlew | 0 2 files changed, 17 insertions(+), 31 deletions(-) mode change 100644 => 100755 gradlew diff --git a/build.gradle b/build.gradle index b3577aba37..103b504542 100644 --- a/build.gradle +++ b/build.gradle @@ -15,13 +15,11 @@ buildscript { } } dependencies { - classpath 'com.github.GTNH2:ForgeGradle:FG_1.2-SNAPSHOT' - classpath "de.undercouch:gradle-download-task:3.1.2" + classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.4' } } apply plugin: 'forge' apply plugin: 'signing' -import de.undercouch.gradle.tasks.download.Download version = "1.7.10-1.0.9" group= "pers.gwyog.gtneioreplugin" @@ -44,41 +42,29 @@ file "build.properties" withReader { } repositories { - mavenLocal() - maven { - name "ChickenBones" - url "http://chickenbones.net/maven/" - } + mavenCentral() maven { name = "ic2" - url = "http://maven.ic2.player.to/" + url = "https://maven.ic2.player.to/" + } + maven { + name = "jitpack.io" + url = "https://jitpack.io" } } dependencies { - //compile "codechicken:ForgeMultipart:${config.minecraft.version}-${config.fmp.version}:dev" - compile "codechicken:CodeChickenLib:${config.minecraft.version}-${config.ccl.version}:dev" - compile "codechicken:CodeChickenCore:${config.minecraft.version}-${config.ccc.version}:dev" - compile "codechicken:NotEnoughItems:${config.minecraft.version}-${config.nei.version}:dev" - compile "com.opencsv:opencsv:4.0" - compile "net.industrial-craft:industrialcraft-2:${config.ic2.version}:dev" -} - -task getGregTech(type: Download) { - onlyIf { - !file("libs/gregtech-${config.gregtech.version}-dev.jar").exists() + implementation "com.github.GTNewHorizons:CodeChickenLib:master-SNAPSHOT:dev" + implementation "com.github.GTNewHorizons:CodeChickenCore:master-SNAPSHOT:dev" + implementation "com.github.GTNewHorizons:NotEnoughItems:master-SNAPSHOT:dev" + implementation("com.github.GTNewHorizons:GT5-Unofficial:master-SNAPSHOT:dev") { + setChanging(true) + transitive = false } - src "http://jenkins.usrv.eu:8080/job/Gregtech-5-Unofficial/${config.gregtech.jenkinsbuild}/artifact/build/libs/gregtech-${config.gregtech.version}-dev.jar" - dest file("libs/gregtech-${config.gregtech.version}-dev.jar") - mustRunAfter "deobfBinJar" - mustRunAfter "repackMinecraft" + implementation "net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev" + implementation 'com.opencsv:opencsv:4.0' //5.5.2 is a breaking update } -tasks.setupCIWorkspace.dependsOn getGregTech -tasks.setupDevWorkspace.dependsOn getGregTech -tasks.setupDecompWorkspace.dependsOn getGregTech -tasks.compileJava.dependsOn getGregTech - processResources { // this will ensure that this task is redone when the versions change. @@ -93,7 +79,7 @@ processResources expand 'version':project.version, 'mcversion':project.minecraft.version } - // copy everything else, thats not the mcmod.info + // copy everything else, that's not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } @@ -112,4 +98,4 @@ task signJar(dependsOn: 'reobf'){ verbose: true ) } -} +} \ No newline at end of file diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 -- cgit From c88ea3b647fa3b816876fd93d328c9c4d7790dce Mon Sep 17 00:00:00 2001 From: Johann Bernhardt Date: Sun, 19 Dec 2021 15:05:00 +0100 Subject: Draft for unified build script (#10) * Draft for unified build script * Update gradle, build script and streamline dependencies --- .github/scripts/test-no-crash-reports.sh | 9 + .github/workflows/build-and-test.yml | 45 ++ .github/workflows/release-tags.yml | 45 ++ .gitignore | 58 +-- build.gradle | 548 ++++++++++++++++++--- build.properties | 8 - dependencies.gradle | 7 + gradle.properties | 64 +++ gradle/wrapper/gradle-wrapper.jar | Bin 53324 -> 55616 bytes gradle/wrapper/gradle-wrapper.properties | 3 +- gradlew | 98 ++-- gradlew.bat | 30 +- jitpack.yml | 2 + repositories.gradle | 19 + .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 6 +- src/main/resources/mcmod.info | 8 +- 16 files changed, 792 insertions(+), 158 deletions(-) create mode 100644 .github/scripts/test-no-crash-reports.sh create mode 100644 .github/workflows/build-and-test.yml create mode 100644 .github/workflows/release-tags.yml delete mode 100644 build.properties create mode 100644 dependencies.gradle create mode 100644 gradle.properties create mode 100644 jitpack.yml create mode 100644 repositories.gradle diff --git a/.github/scripts/test-no-crash-reports.sh b/.github/scripts/test-no-crash-reports.sh new file mode 100644 index 0000000000..c67e342c06 --- /dev/null +++ b/.github/scripts/test-no-crash-reports.sh @@ -0,0 +1,9 @@ +directory="run/crash-reports" +if [ -d $directory ]; then + echo "Crash reports detected:" + cat $directory/* + exit 1 +else + echo "No crash reports detected" + exit 0 +fi diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000000..a60a2b6468 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,45 @@ +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Build and test + +on: + pull_request: + branches: [ master, main ] + push: + branches: [ master, main ] + +jobs: + build-and-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Setup the workspace + run: ./gradlew setupCIWorkspace + + - name: Build the mod + run: ./gradlew build + + - name: Run server for 1 minute + run: | + mkdir run + echo "eula=true" > run/eula.txt + timeout 60 ./gradlew runServer || true + + - name: Test no crashes happend + run: | + chmod +x .github/scripts/test-no-crash-reports.sh + .github/scripts/test-no-crash-reports.sh diff --git a/.github/workflows/release-tags.yml b/.github/workflows/release-tags.yml new file mode 100644 index 0000000000..25c354b227 --- /dev/null +++ b/.github/workflows/release-tags.yml @@ -0,0 +1,45 @@ +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Release tagged build + +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set release version + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Setup the workspace + run: ./gradlew setupCIWorkspace + + - name: Build the mod + run: ./gradlew build + + - name: Release under current tag + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "${{ env.RELEASE_VERSION }}" + prerelease: false + title: "${{ env.RELEASE_VERSION }}" + files: build/libs/*.jar diff --git a/.gitignore b/.gitignore index 18ebc78006..558ad12d27 100644 --- a/.gitignore +++ b/.gitignore @@ -1,38 +1,28 @@ -.git/ -.gradle/ -.settings/ -build/ -bin/ -eclipse/ +.gradle +.settings +/.idea/ +/run/ +/build/ +/eclipse/ .classpath .project -libs/ -libs2/ -out/ - -# Compiled class file -*.class - -# Log file -*.log - -# BlueJ files -*.ctxt - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - +/bin/ +/config/ +/crash-reports/ +/logs/ +options.txt +/saves/ +usernamecache.json +banned-ips.json +banned-players.json +eula.txt +ops.json +server.properties +servers.dat +usercache.json +whitelist.json +/out/ +*.iml *.ipr *.iws -*.iml - -# Package Files # -*.war -*.ear -*.zip -*.tar.gz -*.rar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* -*.bat +src/main/resources/mixins.*.json diff --git a/build.gradle b/build.gradle index 103b504542..18fedd355e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,16 +1,33 @@ +//version: 928ecf7feb33a1149538b0e2cd17e3bc5f281428 +/* +DO NOT CHANGE THIS FILE! + +Also, you may replace this file at any time if there is an update available. +Please check https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/build.gradle for updates. + */ + + +import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar + +import java.util.concurrent.TimeUnit + buildscript { repositories { - mavenCentral() maven { - name = "gt" - url = "https://gregtech.overminddl1.com/" + name = "forge" + url = "https://maven.minecraftforge.net" } maven { name = "sonatype" url = "https://oss.sonatype.org/content/repositories/snapshots/" } maven { - name = "jitpack.io" + name = "Scala CI dependencies" + url = "https://repo1.maven.org/maven2/" + } + maven { + name = "jitpack" url = "https://jitpack.io" } } @@ -18,84 +35,495 @@ buildscript { classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.4' } } + +plugins { + id 'idea' + id 'scala' + id("org.ajoberstar.grgit") version("3.1.1") + id("com.github.johnrengelman.shadow") version("4.0.4") + id("com.palantir.git-version") version("0.12.3") +} + apply plugin: 'forge' -apply plugin: 'signing' -version = "1.7.10-1.0.9" -group= "pers.gwyog.gtneioreplugin" -archivesBaseName = "gtneioreplugin" +def projectJavaVersion = JavaLanguageVersion.of(8) + +java { + toolchain { + languageVersion.set(projectJavaVersion) + } +} + +idea { + module { + inheritOutputDirs = true + downloadJavadoc = true + downloadSources = true + } +} + +if(JavaVersion.current() != JavaVersion.VERSION_1_8) { + throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current()) +} + +checkPropertyExists("modName") +checkPropertyExists("modId") +checkPropertyExists("modGroup") +checkPropertyExists("autoUpdateBuildScript") +checkPropertyExists("minecraftVersion") +checkPropertyExists("forgeVersion") +checkPropertyExists("replaceGradleTokenInFile") +checkPropertyExists("gradleTokenModId") +checkPropertyExists("gradleTokenModName") +checkPropertyExists("gradleTokenVersion") +checkPropertyExists("gradleTokenGroupName") +checkPropertyExists("apiPackage") +checkPropertyExists("accessTransformersFile") +checkPropertyExists("usesMixins") +checkPropertyExists("mixinPlugin") +checkPropertyExists("mixinsPackage") +checkPropertyExists("coreModClass") +checkPropertyExists("containsMixinsAndOrCoreModOnly") +checkPropertyExists("usesShadowedDependencies") +checkPropertyExists("developmentEnvironmentUserName") + + +String javaSourceDir = "src/main/java/" +String scalaSourceDir = "src/main/scala/" + +String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") +String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") +if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { + throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala) +} + +if(apiPackage) { + targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { + throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala) + } +} + +if(accessTransformersFile) { + String targetFile = "src/main/resources/META-INF/" + accessTransformersFile + if(getFile(targetFile).exists() == false) { + throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) + } +} + +if(usesMixins.toBoolean()) { + if(mixinsPackage.isEmpty() || mixinPlugin.isEmpty()) { + throw new GradleException("\"mixinPlugin\" requires \"mixinsPackage\" and \"mixinPlugin\" to be set!") + } + + targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") + targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") + if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { + throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala) + } + + String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" + String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala" + String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" + if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) { + throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava) + } +} + +if(coreModClass) { + String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" + String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala" + String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" + if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) { + throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava) + } +} + +configurations.all { + resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS) + + // Make sure GregTech build won't time out + System.setProperty("org.gradle.internal.http.connectionTimeout", 120000 as String) + System.setProperty("org.gradle.internal.http.socketTimeout", 120000 as String) +} + +// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version +'git config core.fileMode false'.execute() +// Pulls version from git tag +try { + version = minecraftVersion + "-" + gitVersion() +} +catch (Exception e) { + throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag!"); +} -sourceCompatibility = 1.8 -targetCompatibility = 1.8 +group = modGroup +if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) { + archivesBaseName = customArchiveBaseName +} +else { + archivesBaseName = modId +} minecraft { - version = "1.7.10-10.13.4.1614-1.7.10" - replaceIn "GTNEIOrePlugin.java" - replace "@version@", project.version - runDir = "eclipse" + version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion + runDir = "run" + + if (replaceGradleTokenInFile) { + replaceIn replaceGradleTokenInFile + if(gradleTokenModId) { + replace gradleTokenModId, modId + } + if(gradleTokenModName) { + replace gradleTokenModName, modName + } + if(gradleTokenVersion) { + replace gradleTokenVersion, versionDetails().lastTag + } + if(gradleTokenGroupName) { + replace gradleTokenGroupName, modGroup + } + } } -file "build.properties" withReader { - def prop = new Properties() - prop.load(it) - ext.config = new ConfigSlurper().parse prop +if(file("addon.gradle").exists()) { + apply from: "addon.gradle" +} + +apply from: 'repositories.gradle' + +configurations { + implementation.extendsFrom(shadowImplementation) } repositories { - mavenCentral() - maven { - name = "ic2" - url = "https://maven.ic2.player.to/" - } maven { - name = "jitpack.io" - url = "https://jitpack.io" + name = "Overmind forge repo mirror" + url = "https://gregtech.overminddl1.com/" + } + if(usesMixins.toBoolean()) { + maven { + name = "sponge" + url = "https://repo.spongepowered.org/repository/maven-public" + } + maven { + url = "https://jitpack.io" + } } } dependencies { - implementation "com.github.GTNewHorizons:CodeChickenLib:master-SNAPSHOT:dev" - implementation "com.github.GTNewHorizons:CodeChickenCore:master-SNAPSHOT:dev" - implementation "com.github.GTNewHorizons:NotEnoughItems:master-SNAPSHOT:dev" - implementation("com.github.GTNewHorizons:GT5-Unofficial:master-SNAPSHOT:dev") { - setChanging(true) - transitive = false + if(usesMixins.toBoolean()) { + annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3") + annotationProcessor("com.google.guava:guava:24.1.1-jre") + annotationProcessor("com.google.code.gson:gson:2.8.6") + annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT") + // using 0.8 to workaround a issue in 0.7 which fails mixin application + compile("org.spongepowered:mixin:0.7.11-SNAPSHOT") { + // Mixin includes a lot of dependencies that are too up-to-date + exclude module: "launchwrapper" + exclude module: "guava" + exclude module: "gson" + exclude module: "commons-io" + exclude module: "log4j-core" + } + compile("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev") } - implementation "net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev" - implementation 'com.opencsv:opencsv:4.0' //5.5.2 is a breaking update +} + +apply from: 'dependencies.gradle' + +def mixingConfigRefMap = "mixins." + modId + ".refmap.json" +def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap +def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg" + +task generateAssets { + if(usesMixins.toBoolean()) { + getFile("/src/main/resources/mixins." + modId + ".json").text = """{ + "required": true, + "minVersion": "0.7.11", + "package": "${modGroup}.${mixinsPackage}", + "plugin": "${modGroup}.${mixinPlugin}", + "refmap": "${mixingConfigRefMap}", + "target": "@env(DEFAULT)", + "compatibilityLevel": "JAVA_8" +} + +""" + } +} + +task relocateShadowJar(type: ConfigureShadowRelocation) { + target = tasks.shadowJar + prefix = modGroup + ".shadow" +} + +shadowJar { + manifest { + attributes(getManifestAttributes()) + } + + minimize() // This will only allow shading for actually used classes + configurations = [project.configurations.shadowImplementation] + dependsOn(relocateShadowJar) +} + +jar { + manifest { + attributes(getManifestAttributes()) + } + + if(usesShadowedDependencies.toBoolean()) { + dependsOn(shadowJar) + enabled = false + } +} + +reobf { + if(usesMixins.toBoolean()) { + addExtraSrgFile mixinSrg + } +} + +afterEvaluate { + if(usesMixins.toBoolean()) { + tasks.compileJava { + options.compilerArgs += [ + "-AreobfSrgFile=${tasks.reobf.srg}", + "-AoutSrgFile=${mixinSrg}", + "-AoutRefMapFile=${refMap}", + // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code + "-XDenableSunApiLintControl", + "-XDignore.symbol.file" + ] + } + } +} + +runClient { + def arguments = [] + + if(usesMixins.toBoolean()) { + arguments += [ + "--mods=../build/libs/$modId-${version}.jar", + "--tweakClass org.spongepowered.asm.launch.MixinTweaker" + ] + } + + if(developmentEnvironmentUserName) { + arguments += [ + "--username", + developmentEnvironmentUserName + ] + } + + args(arguments) +} + +runServer { + def arguments = [] + + if (usesMixins.toBoolean()) { + arguments += [ + "--mods=../build/libs/$modId-${version}.jar", + "--tweakClass org.spongepowered.asm.launch.MixinTweaker" + ] + } + + args(arguments) +} + +tasks.withType(JavaExec).configureEach { + javaLauncher.set( + javaToolchains.launcherFor { + languageVersion = projectJavaVersion + } + ) } processResources -{ - // this will ensure that this task is redone when the versions change. - inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.version + { + // 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 "minecraftVersion": project.minecraft.version, + "modVersion": versionDetails().lastTag, + "modId": modId, + "modName": modName + } - // 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 + if(usesMixins.toBoolean()) { + from refMap + } + + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } + } + +def getManifestAttributes() { + def manifestAttributes = [:] + if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) { + manifestAttributes += ["FMLCorePluginContainsFMLMod": true] } - - // copy everything else, that's not the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' + + if(accessTransformersFile) { + manifestAttributes += ["FMLAT" : accessTransformersFile.toString()] + } + + if(coreModClass) { + manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass] } + + if(usesMixins.toBoolean()) { + manifestAttributes += [ + "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", + "MixinConfigs" : "mixins." + modId + ".json", + "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false + ] + } + return manifestAttributes } -task signJar(dependsOn: 'reobf'){ +task sourcesJar(type: Jar) { + from (sourceSets.main.allJava) + from (file("$projectDir/LICENSE")) + getArchiveClassifier().set('sources') +} + +task shadowDevJar(type: ShadowJar) { + from sourceSets.main.output + getArchiveClassifier().set("dev") + + manifest { + attributes(getManifestAttributes()) + } + + minimize() // This will only allow shading for actually used classes + configurations = [project.configurations.shadowImplementation] +} + +task relocateShadowDevJar(type: ConfigureShadowRelocation) { + target = tasks.shadowDevJar + prefix = modGroup + ".shadow" +} + +task circularResolverJar(type: Jar) { + dependsOn(relocateShadowDevJar) + dependsOn(shadowDevJar) + enabled = false +} + +task devJar(type: Jar) { + from sourceSets.main.output + getArchiveClassifier().set("dev") + + manifest { + attributes(getManifestAttributes()) + } + + if(usesShadowedDependencies.toBoolean()) { + dependsOn(circularResolverJar) + enabled = false + } +} + +task apiJar(type: Jar) { + from (sourceSets.main.allJava) { + include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' + } + + from (sourceSets.main.output) { + include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' + } + + from (sourceSets.main.resources.srcDirs) { + include("LICENSE") + } + + getArchiveClassifier().set('api') +} + +artifacts { + archives sourcesJar + archives devJar + if(apiPackage) { + archives apiJar + } +} + +// Updating +task updateBuildScript { doLast { - ant.signjar( - destDir: jar.destinationDir, - jar: jar.getArchivePath(), - alias: findProperty('keyStoreAlias') ?: '', - keystore: findProperty('keyStore') ?: '', - storepass: findProperty('keyStorePass') ?: '', - digestalg: findProperty('signDigestAlg') ?: '', - tsaurl: findProperty('signTSAurl') ?: '', - verbose: true - ) - } -} \ No newline at end of file + if (performBuildScriptUpdate(projectDir.toString())) return + + print("Build script already up-to-date!") + } +} + +if (isNewBuildScriptVersionAvailable(projectDir.toString())) { + if (autoUpdateBuildScript.toBoolean()) { + performBuildScriptUpdate(projectDir.toString()) + } else { + println("Build script update available! Run 'gradle updateBuildScript'") + } +} + +static URL availableBuildScriptUrl() { + new URL("https://raw.githubusercontent.com/SinTh0r4s/ExampleMod1.7.10/main/build.gradle") +} + +boolean performBuildScriptUpdate(String projectDir) { + if (isNewBuildScriptVersionAvailable(projectDir)) { + def buildscriptFile = getFile("build.gradle") + availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } } + print("Build script updated. Please REIMPORT the project or RESTART your IDE!") + return true + } + return false +} + +boolean isNewBuildScriptVersionAvailable(String projectDir) { + Map parameters = ["connectTimeout": 2000, "readTimeout": 2000] + + String currentBuildScript = getFile("build.gradle").getText() + String currentBuildScriptHash = getVersionHash(currentBuildScript) + String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText() + String availableBuildScriptHash = getVersionHash(availableBuildScript) + + boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash + return !isUpToDate +} + +static String getVersionHash(String buildScriptContent) { + String versionLine = buildScriptContent.find("^//version: [a-z0-9]*") + if(versionLine != null) { + return versionLine.split(": ").last() + } + return "" +} + +configure(updateBuildScript) { + group = 'forgegradle' + description = 'Updates the build script to the latest version' +} + +// Helper methods + +def checkPropertyExists(String propertyName) { + if (project.hasProperty(propertyName) == false) { + throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/gradle.properties") + } +} + +def getFile(String relativePath) { + return new File(projectDir, relativePath) +} diff --git a/build.properties b/build.properties deleted file mode 100644 index e2d5ba2f21..0000000000 --- a/build.properties +++ /dev/null @@ -1,8 +0,0 @@ -gregtech.version=5.09.38.04 -gregtech.jenkinsbuild=1666 -croploadcore.version=0.0.8 -minecraft.version=1.7.10 -ccl.version=1.1.3.140 -ccc.version=1.0.7.47 -nei.version=1.0.5.120 -ic2.version=2.2.828-experimental diff --git a/dependencies.gradle b/dependencies.gradle new file mode 100644 index 0000000000..4b23dbe5b0 --- /dev/null +++ b/dependencies.gradle @@ -0,0 +1,7 @@ +// Add your dependencies here + +dependencies { + compile("com.github.GTNewHorizons:GT5-Unofficial:master-SNAPSHOT:dev") + + compile("com.opencsv:opencsv:4.0") +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000000..dd5be647af --- /dev/null +++ b/gradle.properties @@ -0,0 +1,64 @@ +modName = GT NEI Ore Plugin GT:NH Mod + +# This is a case-sensitive string to identify your mod. Convention is to use lower case. +modId = gtneioreplugin + +modGroup = pers.gwyog.gtneioreplugin + +# WHY is there no version field? +# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the +# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/ + +# Will update your build.gradle automatically whenever an update is available +autoUpdateBuildScript = false + +minecraftVersion = 1.7.10 +forgeVersion = 10.13.4.1614 + +# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you +# restart Minecraft in development. Choose this dependent on your mod: +# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name +# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty +developmentEnvironmentUserName = "Developer" + +# Define a source file of your project with: +# public static final String VERSION = "GRADLETOKEN_VERSION"; +# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's +# version in @Mod([...], version = VERSION, [...]) +# Leave these properties empty to skip individual token replacements +replaceGradleTokenInFile = GTNEIOrePlugin.java +gradleTokenModId = GRADLETOKEN_MODID +gradleTokenModName = GRADLETOKEN_MODNAME +gradleTokenVersion = GRADLETOKEN_VERSION +gradleTokenGroupName = + +# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can +# leave this property empty. +# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api +apiPackage = + +# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/ +# Example value: mymodid_at.cfg +accessTransformersFile = + +# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! +usesMixins = false +# Specify the location of your implementation of IMixinPlugin. Leave it empty otherwise. +mixinPlugin = +# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail! +mixinsPackage = +# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin! +# This parameter is for legacy compatability only +# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin +coreModClass = +# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class +# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false! +containsMixinsAndOrCoreModOnly = false + +# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your +# responsibility check the licence and request permission for distribution, if required. +usesShadowedDependencies = false + +# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older +# projects. New projects should not use this parameter. +#customArchiveBaseName = diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 3baa851b28..5c2d1cf016 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 82b0d2f5d7..3ab0b725ef 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Sat Jan 04 01:52:14 CET 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip diff --git a/gradlew b/gradlew index 91a7e269e1..83f2acfdc3 100755 --- a/gradlew +++ b/gradlew @@ -1,4 +1,20 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################## ## @@ -6,20 +22,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# 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\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +64,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,31 +75,11 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=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. @@ -90,7 +105,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -110,10 +125,11 @@ 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 +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` @@ -154,11 +170,19 @@ if $cygwin ; then 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=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 8a0b282aa6..9618d8d960 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -8,14 +24,14 @@ @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 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="-Xmx64m" "-Xms64m" + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome @@ -46,10 +62,9 @@ echo location of your Java installation. goto fail :init -@rem Get command-line arguments, handling Windowz variants +@rem Get command-line arguments, handling Windows 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. @@ -60,11 +75,6 @@ set _SKIP=2 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 diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 0000000000..09bbb514fc --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,2 @@ +before_install: + - ./gradlew setupCIWorkspace \ No newline at end of file diff --git a/repositories.gradle b/repositories.gradle new file mode 100644 index 0000000000..ec1cbff0ac --- /dev/null +++ b/repositories.gradle @@ -0,0 +1,19 @@ +// Add any additional repositiroes for your dependencies here + +repositories { + maven { + name = "ic2" + url = "http://maven.ic2.player.to/" + metadataSources { + mavenPom() + artifact() + } + } + maven { + url = "https://jitpack.io" + } + maven { + name = "ic2" + url = "https://maven.ic2.player.to/" + } +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index c62a196bb4..28ecd5063c 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -14,9 +14,9 @@ import java.util.HashSet; @Mod(modid = GTNEIOrePlugin.MODID, name = GTNEIOrePlugin.NAME, version = GTNEIOrePlugin.VERSION, dependencies = "required-after:gregtech;required-after:NotEnoughItems") public class GTNEIOrePlugin { - public static final String MODID = "gtneioreplugin"; - public static final String NAME = "GT NEI Ore Plugin GT:NH Mod"; - public static final String VERSION = "@version@"; + public static final String MODID = "GRADLETOKEN_MODID"; + public static final String NAME = "GRADLETOKEN_MODNAME"; + public static final String VERSION = "GRADLETOKEN_VERSION"; public static final Logger LOG = LogManager.getLogger(NAME); public static boolean csv = false; public static String CSVname; diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 67282f3b03..350b3bd56d 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,10 +1,10 @@ [ { - "modid": "gtneioreplugin", - "name": "GT NEI Ore Plugin GT:NH Mod", + "modid": "${modId}", + "name": "${modName}", "description": "A forge mod which adds NEI plugins for GregTech5's ores. Modded for GT:NH", - "version": "v1.0.6c-GTNH", - "mcversion": "1.7.10", + "version": "${modVersion}", + "mcversion": "${minecraftVersion}", "url": "", "updateUrl": "", "authorList": ["GWYOG","bartimaeusnek"], -- cgit From 9f4ea5d9d65607cc1563ea493b5a989862c4aefe Mon Sep 17 00:00:00 2001 From: YannickMG Date: Thu, 23 Dec 2021 17:40:28 -0500 Subject: Tooltip rework (#13) * Draft for unified build script * Update gradle, build script and streamline dependencies * Fixed string typos Fixed VisualProspecting vein name missing whitespace * Several dimension name fixes: - Handle tooltip display for individual recipes when multiple are visible - Don't hide the background when tooltip is shown - Tooltip trigger area more precise - Dimension names appear in progression order both in abbreviated and tooltip forms - Customizable dimension name tooltip max line count * Removed some dead code Especially asteroid handling separate from vein handling There's more still to remove * Javadoc for StringPaddingHack class Also comment cleanup * Fixed more misnamed dimensions Co-authored-by: Johann Bernhardt --- gradle.properties | 2 +- .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 9 +- .../gtneioreplugin/plugin/NEIPluginConfig.java | 5 - .../gwyog/gtneioreplugin/plugin/PluginBase.java | 16 +- .../plugin/gregtech5/PluginGT5AsteroidStat.java | 143 ----------------- .../plugin/gregtech5/PluginGT5Base.java | 111 +++++++++---- .../plugin/gregtech5/PluginGT5SmallOreStat.java | 42 ++--- .../plugin/gregtech5/PluginGT5VeinStat.java | 60 ++++--- .../gwyog/gtneioreplugin/util/DimensionHelper.java | 174 ++++++++++++--------- .../gwyog/gtneioreplugin/util/GT5CFGHelper.java | 20 +-- .../gtneioreplugin/util/StringPaddingHack.java | 129 +++++++++++++++ src/main/resources/META-INF/gtneioreplugin_at.cfg | 5 + .../assets/gtneioreplugin/lang/en_US.lang | 22 +-- 13 files changed, 388 insertions(+), 350 deletions(-) delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5AsteroidStat.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/StringPaddingHack.java create mode 100644 src/main/resources/META-INF/gtneioreplugin_at.cfg diff --git a/gradle.properties b/gradle.properties index dd5be647af..1ddcad1bf9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -39,7 +39,7 @@ apiPackage = # Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/ # Example value: mymodid_at.cfg -accessTransformersFile = +accessTransformersFile = gtneioreplugin_at.cfg # Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! usesMixins = false diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index 28ecd5063c..7b52bd44c6 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -10,8 +10,6 @@ import org.apache.logging.log4j.Logger; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; -import java.util.HashSet; - @Mod(modid = GTNEIOrePlugin.MODID, name = GTNEIOrePlugin.NAME, version = GTNEIOrePlugin.VERSION, dependencies = "required-after:gregtech;required-after:NotEnoughItems") public class GTNEIOrePlugin { public static final String MODID = "GRADLETOKEN_MODID"; @@ -21,9 +19,8 @@ public class GTNEIOrePlugin { public static boolean csv = false; public static String CSVname; public static String CSVnameSmall; - public static HashSet OreV = new HashSet(); - public static boolean hideBackground = true; public static boolean toolTips = true; + public static int maxTooltipLines = 11; @Mod.Instance(MODID) public static GTNEIOrePlugin instance; @@ -33,8 +30,8 @@ public class GTNEIOrePlugin { csv = c.tConfig.getBoolean("print csv", "ALL", false, "princsv, you need apache commons collections to be injected in the minecraft jar."); CSVname = c.tConfig.getString("CSV_name", "ALL", event.getModConfigurationDirectory() + "/GTNH-Oresheet.csv", "rename the oresheet here, it will appear in /config"); CSVnameSmall= c.tConfig.getString("CSV_name_for_Small_Ore_Sheet", "ALL", event.getModConfigurationDirectory() + "/GTNH-Small-Ores-Sheet.csv", "rename the oresheet here, it will appear in /config"); - hideBackground = c.tConfig.getBoolean("Hide Background", "ALL", true, "Hides the Background when the tooltip for the Dimensions is rendered"); - toolTips = c.tConfig.getBoolean("DimTooltip", "ALL", true, "Activates Dimensison Tooltips"); + toolTips = c.tConfig.getBoolean("DimTooltip", "ALL", true, "Activates Dimension Tooltips"); + maxTooltipLines = c.tConfig.getInt("MaxToolTipLines", "ALL", 11, 1, Integer.MAX_VALUE, "Maximum number of lines the dimension names tooltip can have before it wraps around."); c.save(); } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java index 8283b3b263..ee76cff2d2 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java @@ -6,8 +6,6 @@ import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5SmallOreStat; import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat; -//import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5AsteroidStat; - public class NEIPluginConfig implements IConfigureNEI { @Override @@ -23,12 +21,9 @@ public class NEIPluginConfig implements IConfigureNEI { @Override public void loadConfig() { 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); } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java index 9186eddcbd..da3947fee8 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java @@ -7,7 +7,7 @@ import net.minecraft.util.EnumChatFormatting; import java.awt.*; -public class PluginBase extends TemplateRecipeHandler { +public abstract class PluginBase extends TemplateRecipeHandler { @Override public int recipiesPerPage() { @@ -30,19 +30,7 @@ public class PluginBase extends TemplateRecipeHandler { transferRects.add(new RecipeTransferRect(new Rectangle(getGuiWidth() - stringLength - 3, 5, stringLength, 9), getOutputId())); } - public String getOutputId() { - return null; - } - - public String getWorldNameTranslated(boolean genOverworld) { - String worldNameTranslated = ""; - if (genOverworld) { - if (!worldNameTranslated.isEmpty()) - worldNameTranslated += ", "; - worldNameTranslated += I18n.format("gtnop.world.overworld.name"); - } - return worldNameTranslated; - } + public abstract String getOutputId(); public int getGuiWidth() { return 166; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5AsteroidStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5AsteroidStat.java deleted file mode 100644 index b6c676dc70..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5AsteroidStat.java +++ /dev/null @@ -1,143 +0,0 @@ -/*package pers.gwyog.gtneioreplugin.plugin.gregtech5; - -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.gregtech5.PluginGT5VeinStat.CachedVeinStatRecipe; -import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; -import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; -import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; - -public class PluginGT5AsteroidStat extends PluginGT5Base { - - 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 getIngredients() { - List ingredientsList = new ArrayList(); - 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 = 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.Meta[0])), 2, 31, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSecondary") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.Meta[1])), 2, 44, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidBetween") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.Meta[2])), 2, 57, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.asteroidSporadic") + ": " + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(oreLayer.Meta[3])), 2, 70, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": " + getWorldNameTranslated(oreLayer.genEndAsteroid, oreLayer.genGCAsteroid), 2, 83, 0x404040, false); - GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth()-3, 5, 0x404040, false); - } - - public String getWorldNameTranslated(boolean genEndAsteroid, boolean genGCAsteroid) { - String worldNameTranslatedAsteroid = ""; - if (genEndAsteroid) { - if (!worldNameTranslatedAsteroid.isEmpty()) - worldNameTranslatedAsteroid += ", "; - worldNameTranslatedAsteroid += I18n.format("gtnop.world.end.name"); - } - if (genGCAsteroid) { - if (!worldNameTranslatedAsteroid.isEmpty()) - worldNameTranslatedAsteroid += ", "; - worldNameTranslatedAsteroid += I18n.format("gtnop.world.asteroid.name"); - } - return worldNameTranslatedAsteroid; - } - - public String getLocalizedAsteroidName(String unlocalizedName) { - if (unlocalizedName.startsWith("ore.mix.custom.")) - return I18n.format("gtnop.ore.custom.name") + I18n.format("gtnop.ore.asteroid.name") + unlocalizedName.substring(15); - else - return I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.asteroid.name"); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - if (outputId.equals(getOutputId())) { - OreLayerWrapper oreLayerWrapper; - 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.Meta[0]+2000); - ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[1]+2000); - ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[2]+2000); - ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[3]+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: GT5OreLayerHelper.mapOreLayerWrapper.values()) { - if (worldGen.Meta[0] == baseMeta || worldGen.Meta[1] == baseMeta || worldGen.Meta[2] == baseMeta || worldGen.Meta[3] == baseMeta) { - if (worldGen.genEndAsteroid || worldGen.genGCAsteroid) { - ItemStack stackPrimary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[0]+2000); - ItemStack stackSecondary = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[1]+2000); - ItemStack stackBetween = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[2]+2000); - ItemStack stackSporadic = new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[3]+2000); - this.arecipes.add(new CachedAsteroidStatRecipe(worldGen.veinName, stackPrimary, stackSecondary, stackBetween, stackSporadic)); - } - } - } - } - else - super.loadCraftingRecipes(stack); - } - - @Override - public String getOutputId() { - return "GTOrePluginAsteroid"; - } - - @Override - public String getRecipeName() { - return I18n.format("gtnop.gui.asteroidStat.name"); - } -} -*/ \ No newline at end of file diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java index 00107e12c1..6bc9db3e2c 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java @@ -1,37 +1,28 @@ package pers.gwyog.gtneioreplugin.plugin.gregtech5; import codechicken.lib.gui.GuiDraw; +import codechicken.nei.guihook.GuiContainerManager; +import codechicken.nei.recipe.GuiRecipe; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.util.GT_LanguageManager; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.resources.I18n; +import net.minecraft.util.EnumChatFormatting; import pers.gwyog.gtneioreplugin.plugin.PluginBase; import pers.gwyog.gtneioreplugin.util.DimensionHelper; +import java.awt.Point; +import java.awt.Rectangle; import java.util.List; -import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.hideBackground; import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.toolTips; -public class PluginGT5Base extends PluginBase { - - protected boolean ttDisplayed = false; +public abstract class PluginGT5Base extends PluginBase { protected static String getLocalizedNameForItem(Materials aMaterial, String aFormat) { return String.format(aFormat.replace("%s", "%temp").replace("%material", "%s"), aMaterial.mLocalizedName).replace("%temp", "%s"); } - protected static int calculateMaxW(List L) { - int w = 0; - FontRenderer font = GuiDraw.fontRenderer; - for (int i = 0; i < L.size(); ++i) { - String s = (String) L.get(i); - w = Math.max(font.getStringWidth(s), w); - } - return w; - } - protected static String getLocalizedNameForItem(String aFormat, int aMaterialID) { if (aMaterialID >= 0 && aMaterialID < 1000) { Materials aMaterial = GregTech_API.sGeneratedMaterials[aMaterialID]; @@ -54,25 +45,51 @@ public class PluginGT5Base extends PluginBase { return "gt.blockores." + index + ".name"; } - protected void drawToolTip(String sDimNames) { - if (toolTips) { - ttDisplayed = false; - if (GuiDraw.getMousePosition().y > (int) (Minecraft.getMinecraft().currentScreen.height * 0.6f) && GuiDraw.getMousePosition().y < (int) (Minecraft.getMinecraft().currentScreen.height * 0.8f)) { - List dims = DimensionHelper.convertCondensedStringToToolTip(sDimNames); - int w = calculateMaxW(dims); - int x = GuiDraw.getMousePosition().x > Minecraft.getMinecraft().currentScreen.width / 2 ? this.getGuiWidth() - w - 8 : 0; - if (dims.size() > 10) { - List dims2 = dims.subList(11, dims.size()); - int w2 = calculateMaxW(dims2); - dims = dims.subList(0, 11); - w = calculateMaxW(dims); - GuiDraw.drawMultilineTip(x == 0 ? 16 + w : x - (w2 + 8), 108 - (dims.size() * 8), dims2); - } - GuiDraw.drawMultilineTip(x, 108 - (dims.size() * 8), dims); - - ttDisplayed = hideBackground; + /** + * Add lines to the current tooltip if appropriate + * + * @param gui An instance of the currentscreen + * @param currenttip The current tooltip, will contain item name and info + * @param recipe The recipe index being handled + * @return The modified tooltip. DO NOT return null + */ + @Override + public List handleTooltip(GuiRecipe gui, List currenttip, int recipe) { + if (toolTips && GuiContainerManager.shouldShowTooltip(gui) && currenttip.size() == 0) { + String dimNames = getDimensionNames(recipe); + Rectangle dimRect = getDimensionNamesRect(gui, recipe , dimNames); + Point mousePos = GuiDraw.getMousePosition(); + + + if (dimRect.contains(mousePos.x, mousePos.y)) { + List dims = DimensionHelper.convertCondensedStringToToolTip(dimNames); + currenttip.addAll(dims); } } + + return super.handleTooltip(gui, currenttip, recipe); + } + + /** + * The dimension names for a given recipe index + * + * @param The recipe index being handled + * @return A CSV string of dimension name abbreviations + */ + protected abstract String getDimensionNames(int recipe); + + /** + * Produce a rectangle covering the area of displayed dimension names + * + * @param gui An instance of the currentscreen + * @param recipe The recipe index being handled + * @param dimNames Dimension names to produce a rectangle for + * @return Rectangle area of dimension names + */ + protected Rectangle getDimensionNamesRect(GuiRecipe gui, int recipe, String dimNames) { + int height = dimNames.length() > 70 ? 30 : (dimNames.length() > 36 ? 20 : 10); + Point offset = gui.getRecipePosition(recipe); + return new Rectangle(gui.guiLeft + offset.x + 2, gui.guiTop + offset.y + 110, gui.xSize - 9, height ); } protected int getMaximumMaterialIndex(short meta, boolean smallOre) { @@ -85,4 +102,32 @@ public class PluginGT5Base extends PluginBase { return 5; } + /** + * Draw the dimension header and the dimension names over up to 3 lines + * + * @param dimNames A CSV string of dimension name abbreviations + */ + protected void drawDimNames(String dimNames) { + GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 100, 0x404040, false); + + if (dimNames.length() > 36) { + GuiDraw.drawString(I18n.format("") + dimNames.substring(0, 36), 2, 110, 0x404040, false); + if (dimNames.length() > 70) { + GuiDraw.drawString(I18n.format("") + dimNames.substring(36, 70), 2, 120, 0x404040, false); + GuiDraw.drawString(I18n.format("") + dimNames.substring(70, dimNames.length() - 1), 2, 130, 0x404040, false); + } else + { + GuiDraw.drawString(I18n.format("") + dimNames.substring(36, dimNames.length() - 1), 2, 120, 0x404040, false); + } + } else{ + GuiDraw.drawString(I18n.format("") + dimNames.substring(0, dimNames.length() - 1), 2, 110, 0x404040, false); + } + } + + /** + * Draw the "see all recipes" transfer label + */ + protected void drawSeeAllRecipesLabel() { + 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/gregtech5/PluginGT5SmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java index 4a8e2174e3..70346889e9 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java @@ -7,7 +7,6 @@ import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_OreDictUnificator; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper.OreSmallWrapper; @@ -22,25 +21,15 @@ public class PluginGT5SmallOreStat extends PluginGT5Base { OreSmallWrapper oreSmall = GT5OreSmallHelper.mapOreSmallWrapper.get(crecipe.oreGenName); String sDimNames = GT5OreSmallHelper.bufferedDims.get(oreSmall); GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreName") + ": " + getGTOreLocalizedName((short) (oreSmall.oreMeta + 16000)), 2, 18, 0x404040, false); - drawToolTip(sDimNames); - if (!ttDisplayed) { - 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.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 110, 0x404040, false); - if (sDimNames.length() > 36) { - GuiDraw.drawString(I18n.format("") + sDimNames.substring(0, 36), 2, 120, 0x404040, false); - if (sDimNames.length() > 70) { - GuiDraw.drawString(I18n.format("") + sDimNames.substring(36, 70), 2, 130, 0x404040, false); - GuiDraw.drawString(I18n.format("") + sDimNames.substring(70, sDimNames.length() - 1), 2, 140, 0x404040, false); - } else - GuiDraw.drawString(I18n.format("") + sDimNames.substring(36, sDimNames.length() - 1), 2, 130, 0x404040, false); - } else - GuiDraw.drawString(I18n.format("") + sDimNames.substring(0, sDimNames.length() - 1), 2, 120, 0x404040, false); - } - GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth() - 3, 5, 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); + // 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.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 100, 0x404040, false); + + drawDimNames(sDimNames); + drawSeeAllRecipesLabel(); } public int getRestrictBiomeOffset() { @@ -104,6 +93,19 @@ public class PluginGT5SmallOreStat extends PluginGT5Base { return I18n.format("gtnop.gui.smallOreStat.name"); } + /** + * The dimension names for a given recipe identifier + * + * @param recipe identifier + * @return A CSV string of dimension name abbreviations + */ + @Override + protected String getDimensionNames(int recipe) { + CachedOreSmallRecipe crecipe = (CachedOreSmallRecipe) this.arecipes.get(recipe); + OreSmallWrapper oreSmall = GT5OreSmallHelper.mapOreSmallWrapper.get(crecipe.oreGenName); + return GT5OreSmallHelper.bufferedDims.get(oreSmall); + } + public class CachedOreSmallRecipe extends CachedRecipe { public String oreGenName; public PositionedStack positionedStackOreSmall; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java index c288aa72ca..8f8a01ef0a 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -6,7 +6,6 @@ import cpw.mods.fml.common.Loader; import gregtech.api.GregTech_API; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; @@ -17,6 +16,7 @@ import java.util.Set; public class PluginGT5VeinStat extends PluginGT5Base { + // Unused public static String[] getLocalizedVeinName(OreLayerWrapper oreLayer) { String unlocalizedName = oreLayer.veinName; if (unlocalizedName.startsWith("ore.mix.custom.")) @@ -25,6 +25,7 @@ public class PluginGT5VeinStat extends PluginGT5Base { return new String[]{I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.vein.name")}; } + // Unused public static String coustomVeinRenamer(OreLayerWrapper oreLayer) { Set s = new HashSet(); for (int i = 0; i < 4; i++) @@ -58,6 +59,7 @@ public class PluginGT5VeinStat extends PluginGT5Base { return weightedChance; }*/ + // Unused public static String[] get_Cnames(OreLayerWrapper oreLayer) { String[] splt = coustomVeinRenamer(oreLayer).split("\\s"); @@ -167,18 +169,8 @@ public class PluginGT5VeinStat extends PluginGT5Base { String sDimNames = GT5OreLayerHelper.bufferedDims.get(oreLayer); - /*if (getLocalizedVeinName(oreLayer).length>1) { - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getLocalizedVeinName(oreLayer)[0], 2, 20, 0x404040, false); - if (getLocalizedVeinName(oreLayer).length>2) { - GuiDraw.drawString(I18n.format(getLocalizedVeinName(oreLayer)[1]), 2, 30, 0x404040, false); - GuiDraw.drawString(I18n.format(getLocalizedVeinName(oreLayer)[2]), 2, 40, 0x404040, false); - } - else - GuiDraw.drawString(I18n.format(getLocalizedVeinName(oreLayer)[1]), 2, 30, 0x404040, false); - } - else*/ if(Loader.isModLoaded("visualprospecting")) { - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + I18n.format(oreLayer.veinName) + "" + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + I18n.format(oreLayer.veinName) + " " + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); } else { if (getGTOreLocalizedName(oreLayer.Meta[0]).contains("Ore")) @@ -188,34 +180,23 @@ public class PluginGT5VeinStat extends PluginGT5Base { else GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]) + " " + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); } - - drawToolTip(sDimNames); - if (!ttDisplayed) { - GuiDraw.drawString(I18n.format("gtnop.gui.nei.primaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]), 2, 50, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.secondaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[1]), 2, 60, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.primaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]), 2, 50, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[2]), 2, 70, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.secondaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[1]), 2, 60, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.sporadicOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[3]), 2, 80, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[2]), 2, 70, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreLayer.worldGenHeightRange, 2, 90, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.sporadicOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[3]), 2, 80, 0x404040, false); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + Integer.toString(oreLayer.randomWeight), 100, 90, 0x404040, false); + GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreLayer.worldGenHeightRange, 2, 90, 0x404040, false); + + GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + Integer.toString(oreLayer.randomWeight), 100, 90, 0x404040, false); + + drawDimNames(sDimNames); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 100, 0x404040, false); - if (sDimNames.length() > 36) { - GuiDraw.drawString(I18n.format("") + sDimNames.substring(0, 36), 2, 110, 0x404040, false); - if (sDimNames.length() > 70) { - GuiDraw.drawString(I18n.format("") + sDimNames.substring(36, 70), 2, 120, 0x404040, false); - GuiDraw.drawString(I18n.format("") + sDimNames.substring(70, sDimNames.length() - 1), 2, 130, 0x404040, false); - } else - GuiDraw.drawString(I18n.format("") + sDimNames.substring(36, sDimNames.length() - 1), 2, 120, 0x404040, false); - } else - GuiDraw.drawString(I18n.format("") + sDimNames.substring(0, sDimNames.length() - 1), 2, 110, 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); + drawSeeAllRecipesLabel(); } @Override @@ -227,6 +208,19 @@ public class PluginGT5VeinStat extends PluginGT5Base { public String getRecipeName() { return I18n.format("gtnop.gui.veinStat.name"); } + + /** + * The dimension names for a given recipe identifier + * + * @param recipe identifier + * @return A CSV string of dimension name abbreviations + */ + @Override + protected String getDimensionNames(int recipe) { + CachedVeinStatRecipe crecipe = (CachedVeinStatRecipe) this.arecipes.get(recipe); + OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); + return GT5OreLayerHelper.bufferedDims.get(oreLayer); + } public class CachedVeinStatRecipe extends CachedRecipe { public String veinName; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java index 427d8a8be8..fb422ed074 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -5,84 +5,104 @@ import java.util.HashMap; import java.util.List; import net.minecraft.client.resources.I18n; +import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.maxTooltipLines; + public class DimensionHelper { public static String[] DimName = { + // Non GC dimensions in progression order instead of alphabetical + "Overworld", + "Nether", + "Twilight", + "TheEnd", + "Vanilla_EndAsteroids", "EndAsteroid", + // T1 "GalacticraftCore_Moon", - "GalacticraftMars_Asteroids", + // T2 + "GalaxySpace_Deimos", "GalacticraftMars_Mars", - "GalaxySpace_BarnardC", - "GalaxySpace_BarnardE", - "GalaxySpace_BarnardF", + "GalaxySpace_Phobos", + // T3 + "GalacticraftMars_Asteroids", "GalaxySpace_Callisto", - "GalaxySpace_CentauriA", "GalaxySpace_Ceres", - "GalaxySpace_Deimos", - "GalaxySpace_Enceladus", "GalaxySpace_Europa", "GalaxySpace_Ganymede", - "GalaxySpace_Haumea", + // T4 "GalaxySpace_Io", - "GalaxySpace_Kuiperbelt", - "GalaxySpace_MakeMake", "GalaxySpace_Mercury", + "GalaxySpace_Venus", + // T5 + "GalaxySpace_Enceladus", "GalaxySpace_Miranda", "GalaxySpace_Oberon", - "GalaxySpace_Phobos", - "GalaxySpace_Pluto", - "GalaxySpace_Proteus", - "GalaxySpace_TcetiE", "GalaxySpace_Titan", + // T6 + "GalaxySpace_Proteus", "GalaxySpace_Triton", + // T7 + "GalaxySpace_Haumea", + "GalaxySpace_Kuiperbelt", + "GalaxySpace_MakeMake", + "GalaxySpace_Pluto", + // T8 + "GalaxySpace_BarnardC", + "GalaxySpace_BarnardE", + "GalaxySpace_BarnardF", + "GalaxySpace_CentauriA", + "GalaxySpace_TcetiE", + "Underdark", "GalaxySpace_VegaB", - "GalaxySpace_Venus", - "Nether", - "Overworld", - "TheEnd", - "Vanilla_EndAsteroids", - "Twilight", - "Underdark" }; public static String[] DimNameDisplayed = - {// first 2 letters if one word else 1 letter of every word, execpt capital letter in name, then 1rst + capital Moon = Mo, BarnardC = BC, EndAsteroid = EA - "EA", - "Mo", - "As", - "Ma", - "BC", - "BE", - "BF", - "Ca", - "CA", - "Ce", - "De", - "En", - "Eu", - "Ga", - "Ha", - "Io", - "KB", - "MM", - "Me", - "Mi", - "Ob", - "Ph", - "Pl", - "Pr", - "TE", - "Ti", - "Tr", - "VB", - "Ve", - "Ne", - "Ow", - "EN",//End = EN bc En = Encalus - "VA", - "TF", - "DD" + {// first 2 letters if one word else 1 letter of every word, except capital letter in name, then 1rst + capital Moon = Mo, BarnardC = BC, EndAsteroid = EA + // Non GC dimensions in progression order instead of alphabetical + "Ow", // Overworld + "Ne", // Nether + "TF", // Twilight + "EN", // TheEnd because En = Encalus + "VA", // Vanilla_EndAsteroids + "EA", // EndAsteroid + // T1 + "Mo", // GalacticraftCore_Moon + // T2 + "De", // GalaxySpace_Deimos + "Ma", // GalacticraftMars_Mars + "Ph", // GalaxySpace_Phobos + // T3 + "As", // GalacticraftMars_Asteroids + "Ca", // GalaxySpace_Callisto + "Ce", // GalaxySpace_Ceres + "Eu", // GalaxySpace_Europa + "Ga", // GalaxySpace_Ganymede + // T4 + "Io", // GalaxySpace_Io + "Me", // GalaxySpace_Mercury + "Ve", // GalaxySpace_Venus + // T5 + "En", // GalaxySpace_Enceladus + "Mi", // GalaxySpace_Miranda + "Ob", // GalaxySpace_Oberon + "Ti", // GalaxySpace_Titan + // T6 + "Pr", // GalaxySpace_Proteus + "Tr", // GalaxySpace_Triton + // T7 + "Ha", // GalaxySpace_Haumea + "KB", // GalaxySpace_Kuiperbelt + "MM", // GalaxySpace_MakeMake + "Pl", // GalaxySpace_Pluto + // T8 + "BC", // GalaxySpace_BarnardC + "BE", // GalaxySpace_BarnardE + "BF", // GalaxySpace_BarnardF + "CB", // GalaxySpace_CentauriA is actually αCentauri Bb + "TE", // GalaxySpace_TcetiE + "DD", // Underdark + "VB", // GalaxySpace_VegaB }; private static HashMap> tooltipBuffer = new HashMap<>(); @@ -99,49 +119,49 @@ public class DimensionHelper { s = I18n.format("gtnop.world." + k); switch (k) { case "Moon": - s = s + " (T1)"; + s = "T1: " + s; break; + case "Deimos": case "Mars": case "Phobos": - case "Deimos": - s = s + " (T2)"; + s = "T2: " + s; break; case "Asteroids": + case "Callisto": case "Ceres": case "Europa": case "Ganymede": - case "Callisto": - s = s + " (T3)"; + s = "T3: " + s; break; case "Io": - case "Venus": case "Mercury": - s = s + " (T4)"; + case "Venus": + s = "T4: " + s; break; case "Enceladus": - case "Titan": case "Miranda": case "Oberon": - s = s + " (T5)"; + case "Titan": + s = "T5: " + s; break; case "Proteus": case "Triton": - s = s + " (T6)"; + s = "T6: " + s; break; - case "Pluto": - case "Kuiperbelt": case "Haumea": + case "Kuiperbelt": case "MakeMake": - s = s + " (T7)"; + case "Pluto": + s = "T7: " + s; break; - case "Underdark": - case "CentauriA": - case "VegaB": case "BarnardC": case "BarnardE": case "BarnardF": + case "CentauriA": case "TcetiE": - s = s + " (T8)"; + case "Underdark": + case "VegaB": + s = "T8: " + s; break; } @@ -149,6 +169,12 @@ public class DimensionHelper { } } } + + if (dims.length > maxTooltipLines ) { + dims = StringPaddingHack.stringsToSpacedColumns( + dims, dims.length / maxTooltipLines + (dims.length % maxTooltipLines == 0 ? 0 : 1) , 2); + } + return Arrays.asList(dims); } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java index 00260020da..94b826808f 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java @@ -48,9 +48,9 @@ public class GT5CFGHelper { rawboolsset.add(st); } rawbools = new ArrayList(rawboolsset); - for (int i = 0; i < rawbools.size(); i++) { - st = rawbools.get(i); - for (int j = 0; j < DimensionHelper.DimName.length; j++) { + for (int j = 0; j < DimensionHelper.DimName.length; j++) { + for (int i = 0; i < rawbools.size(); i++) { + st = rawbools.get(i); if (st.contains(DimensionHelper.DimName[j])) if (st.contains("=true")) ret = (ret + DimensionHelper.DimNameDisplayed[j] + ","); @@ -59,7 +59,7 @@ public class GT5CFGHelper { } ret = ret.trim(); if (ret.equals("") || ret.equals(" ")) - ret = "Not aviable in any Galactic Dim!"; + ret = "Not available in any Galactic Dim!"; return ret; } @@ -73,7 +73,7 @@ public class GT5CFGHelper { int buffer = (int) (0.1 * Runtime.getRuntime().freeMemory()); if (buffer > F.length()) buffer = (int) F.length(); - //allocate 10% of free memory for read-in-buffer, if there is less than filesize memory aviable + //allocate 10% of free memory for read-in-buffer, if there is less than filesize memory available //FMLLog.info("GT_CFG_found[0]"); FileReader in = new FileReader(F); //FMLLog.info("FileReader created"); @@ -154,17 +154,17 @@ public class GT5CFGHelper { HashSet rawboolsset = new HashSet(); if (!rawbools.isEmpty()) { - //remove dublicats + //remove dublicates for (int i = 0; i < rawbools.size(); i++) { st = rawbools.get(i).replace("B:", "").replace("_true", "").replace("_false", "").replaceAll(" ", "").replaceAll("\"", ""); rawboolsset.add(st); } rawbools = new ArrayList(rawboolsset); //filter for dims set to true - for (int i = 0; i < rawbools.size(); i++) { - st = rawbools.get(i); + for (int j = 0; j < DimensionHelper.DimName.length; j++) { //FMLLog.info("RawBools:"+st); - for (int j = 0; j < DimensionHelper.DimName.length; j++) { + for (int i = 0; i < rawbools.size(); i++) { + st = rawbools.get(i); if (st.contains(DimensionHelper.DimName[j])) if (st.contains("=true")) ret = (ret + DimensionHelper.DimNameDisplayed[j] + ","); @@ -174,7 +174,7 @@ public class GT5CFGHelper { ret = ret.trim(); //FMLLog.info("ret:"+ret); if (ret.equals("") || ret.equals(" ")) - ret = "Not aviable in any Galactic Dim!"; + ret = "Not available in any Galactic Dim!"; return ret; } catch (IOException e) { e.printStackTrace(); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/StringPaddingHack.java b/src/main/java/pers/gwyog/gtneioreplugin/util/StringPaddingHack.java new file mode 100644 index 0000000000..d4c340a9be --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/StringPaddingHack.java @@ -0,0 +1,129 @@ +package pers.gwyog.gtneioreplugin.util; +import java.util.Arrays; + +import com.google.common.base.Strings; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; + +public class StringPaddingHack { + private static final int SPACE_WIDTH = 4; + private static final int BOLD_SPACE_WIDTH = 5; + + /** + * Given a list of strings, arrange them into the requested number of columns with the specified spacing. + * Up to 3 additional spaces might be added between columns because this function relies on quirky font behaviors. + * + * @param strings List of strings to wrap into columns + * @param numColumns Number of columns, minimum of 1 + * @param minColumnSpacing Minimum amount of extra spaces between columns. + * @return + */ + public static String[] stringsToSpacedColumns(String[] strings, int numColumns, int minColumnSpacing) { + if (numColumns < 1) { + throw new IllegalArgumentException(String.format("Argument numColumns must be 1 or higher, got value %d", numColumns)); + } + if (numColumns > 1) { + int sliceSize = strings.length / numColumns; + int remainder = strings.length % numColumns; + String[][] columns = new String[numColumns][]; + int totalExtra = 0; + + // Arrange all strings into their proper columns so that the list of strings wraps through all columns + for (int i = 0; i < numColumns; i++) { + int extra = 0; + if (remainder > 0) { + remainder--; + extra = 1; + } + columns[i] = Arrays.copyOfRange(strings, (sliceSize * i) + totalExtra, (sliceSize * (i + 1) + totalExtra + extra)); + + totalExtra += extra; + } + + // Add extra padding to all but the last columns to align the text + for(int i = 0; i < numColumns - 1; i++) { + columns[i] = padStrings(columns[i], minColumnSpacing); + } + + // Concatenate all columns into the final result + strings = columns[0]; + for (int i = 0; i < sliceSize; i++ ) { + for (int j = 1; j < numColumns; j++ ) { + strings[i] += columns[j][i]; + } + } + } + + return strings; + } + + + /** + * Pads strings with spaces so that they are of equal length and adds to + * that the number of spaces specified and up to 3 if minExtraSpaces is + * below 3. Added spaces might be bold. + * + * Relies on the quirk of bold space characters being 1 pixel wider than + * regular space characters in the default font renderer. + * + * @param strings List of strings + * @param minExtraSpaces The minimum number of extra spaces to add + * @return List of strings padded with spaces to an equal length + */ + public static String[] padStrings(String[] strings, int minExtraSpaces) { + int[] widths = getStringWidths(strings); + int maxUnPaddedStrLength = 0; + int numSpacesAddedToLongestString = 0; + int maxPaddedStrLength = 0; + + // Making string width a multiple of 4 by adding bold spaces of width 5 + for (int i = 0; i < strings.length; i++) { + int mod = widths[i] % SPACE_WIDTH; + int numBoldSpacesToAdd = (SPACE_WIDTH - mod) % SPACE_WIDTH; + + // Keep track of the number of spaces added to the longest string + if (widths[i] > maxUnPaddedStrLength) { + numSpacesAddedToLongestString = numBoldSpacesToAdd; + maxUnPaddedStrLength = widths[i]; + } + + strings[i] += "§l" + Strings.repeat(" ", numBoldSpacesToAdd ) + "§r"; + widths[i] += numBoldSpacesToAdd * BOLD_SPACE_WIDTH; + + // Keep track of the current widest string we currently have + if (widths[i] > maxPaddedStrLength) { + maxPaddedStrLength = widths[i]; + } + } + + // Make sure we pad at least up to the desired number of spaces from the longest string + if (numSpacesAddedToLongestString < minExtraSpaces) { + maxPaddedStrLength += (minExtraSpaces - numSpacesAddedToLongestString) * SPACE_WIDTH; + } + + // Add required spaces to equalize length of all strings to at least the target width + for (int i = 0; i < strings.length; i++) { + int numSpacesToAdd = (maxPaddedStrLength - widths[i]) / SPACE_WIDTH; + strings[i] += Strings.repeat(" ", numSpacesToAdd); + widths[i] += numSpacesToAdd * SPACE_WIDTH; + } + + return strings; + } + + /** + * Returns an array of font widths for the given array of strings + * + * @param strList Array of strings + * @return Array of font widths + */ + protected static int[] getStringWidths(String[] strList) { + FontRenderer font = Minecraft.getMinecraft().fontRenderer; + int[] widths = new int[strList.length]; + for (int i = 0; i < strList.length; ++i) { + widths[i] = font.getStringWidth(strList[i]); + } + return widths; + } +} diff --git a/src/main/resources/META-INF/gtneioreplugin_at.cfg b/src/main/resources/META-INF/gtneioreplugin_at.cfg new file mode 100644 index 0000000000..efa5067287 --- /dev/null +++ b/src/main/resources/META-INF/gtneioreplugin_at.cfg @@ -0,0 +1,5 @@ +# GT NEI Ore Plugin Access Transformer configuration file +public net.minecraft.client.gui.inventory.GuiContainer field_146999_f #xSize +public net.minecraft.client.gui.inventory.GuiContainer field_147000_g #ySize +public net.minecraft.client.gui.inventory.GuiContainer field_147003_i #guiLeft +public net.minecraft.client.gui.inventory.GuiContainer field_147009_r #guiTop \ No newline at end of file diff --git a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang index b770cea7cb..ec8c8a9681 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang @@ -37,10 +37,10 @@ gtnop.nei.genPositionInfo=In the center of each chunk # world names gtnop.world.Overworld=Overworld gtnop.world.Nether=Nether -gtnop.world.TheEnd=TheEnd -gtnop.world.Twilight=Twilight Forrest +gtnop.world.TheEnd=The End +gtnop.world.Twilight=Twilight Forest gtnop.world.EndAsteroid=Far End Asteroids -gtnop.world.Vanilla EndAsteroids=Vanilla EndAsteroids +gtnop.world.Vanilla EndAsteroids=Vanilla End Asteroids gtnop.world.Moon=Moon gtnop.world.Mars=Mars gtnop.world.Phobos=Phobos @@ -60,15 +60,15 @@ gtnop.world.Oberon=Oberon gtnop.world.Proteus=Proteus gtnop.world.Triton=Triton gtnop.world.Pluto=Pluto -gtnop.world.Kuiperbelt=Kuiperbelt +gtnop.world.Kuiperbelt=Kuiper Belt gtnop.world.Haumea=Haumea -gtnop.world.MakeMake=MakeMake -gtnop.world.CentauriA=αCentauriBb -gtnop.world.VegaB=VegaB -gtnop.world.BarnardC=BarnardC -gtnop.world.BarnardE=BarnardE -gtnop.world.BarnardF=BarnardF -gtnop.world.TcetiE=TcetiE +gtnop.world.MakeMake=Makemake +gtnop.world.CentauriA=α Centauri Bb +gtnop.world.VegaB=Vega B +gtnop.world.BarnardC=Barnard C +gtnop.world.BarnardE=Barnard E +gtnop.world.BarnardF=Barnard F +gtnop.world.TcetiE=T Ceti E gtnop.world.Underdark=Deep Dark -- cgit From d53a56a239c88c51c7438125fcba5a6d850a95e6 Mon Sep 17 00:00:00 2001 From: YannickMG Date: Sat, 22 Jan 2022 00:03:51 -0500 Subject: Updated build script and pinned dependencies --- build.gradle | 115 +++++++++++++++++++++++++++++++++++++++------------- dependencies.gradle | 2 +- 2 files changed, 88 insertions(+), 29 deletions(-) diff --git a/build.gradle b/build.gradle index 18fedd355e..e466de0fd5 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 928ecf7feb33a1149538b0e2cd17e3bc5f281428 +//version: 1641429628 /* DO NOT CHANGE THIS FILE! @@ -32,7 +32,7 @@ buildscript { } } dependencies { - classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.4' + classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.5' } } @@ -42,6 +42,7 @@ plugins { id("org.ajoberstar.grgit") version("3.1.1") id("com.github.johnrengelman.shadow") version("4.0.4") id("com.palantir.git-version") version("0.12.3") + id("maven-publish") } apply plugin: 'forge' @@ -194,7 +195,9 @@ if(file("addon.gradle").exists()) { apply from: 'repositories.gradle' configurations { - implementation.extendsFrom(shadowImplementation) + implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored + implementation.extendsFrom(shadowCompile) + implementation.extendsFrom(shadeCompile) } repositories { @@ -260,16 +263,28 @@ task relocateShadowJar(type: ConfigureShadowRelocation) { } shadowJar { + project.configurations.shadeCompile.each { dep -> + from(project.zipTree(dep)) { + exclude 'META-INF', 'META-INF/**' + } + } + manifest { attributes(getManifestAttributes()) } minimize() // This will only allow shading for actually used classes - configurations = [project.configurations.shadowImplementation] + configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile] dependsOn(relocateShadowJar) } jar { + project.configurations.shadeCompile.each { dep -> + from(project.zipTree(dep)) { + exclude 'META-INF', 'META-INF/**' + } + } + manifest { attributes(getManifestAttributes()) } @@ -343,31 +358,31 @@ tasks.withType(JavaExec).configureEach { } 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 "minecraftVersion": project.minecraft.version, - "modVersion": versionDetails().lastTag, - "modId": modId, - "modName": modName - } +{ + // this will ensure that this task is redone when the versions change. + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version - if(usesMixins.toBoolean()) { - from refMap - } + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' - // copy everything else, thats not the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } - } + // replace version and mcversion + expand "minecraftVersion": project.minecraft.version, + "modVersion": versionDetails().lastTag, + "modId": modId, + "modName": modName + } + + if(usesMixins.toBoolean()) { + from refMap + } + + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } +} def getManifestAttributes() { def manifestAttributes = [:] @@ -400,6 +415,12 @@ task sourcesJar(type: Jar) { } task shadowDevJar(type: ShadowJar) { + project.configurations.shadeCompile.each { dep -> + from(project.zipTree(dep)) { + exclude 'META-INF', 'META-INF/**' + } + } + from sourceSets.main.output getArchiveClassifier().set("dev") @@ -408,7 +429,7 @@ task shadowDevJar(type: ShadowJar) { } minimize() // This will only allow shading for actually used classes - configurations = [project.configurations.shadowImplementation] + configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile] } task relocateShadowDevJar(type: ConfigureShadowRelocation) { @@ -423,6 +444,12 @@ task circularResolverJar(type: Jar) { } task devJar(type: Jar) { + project.configurations.shadeCompile.each { dep -> + from(project.zipTree(dep)) { + exclude 'META-INF', 'META-INF/**' + } + } + from sourceSets.main.output getArchiveClassifier().set("dev") @@ -460,6 +487,38 @@ artifacts { } } +// publishing +publishing { + publications { + maven(MavenPublication) { + artifact source: jar + artifact source: sourcesJar, classifier: "src" + artifact source: devJar, classifier: "dev" + if (apiPackage) { + artifact source: apiJar, classifier: "api" + } + + groupId = System.getenv("ARTIFACT_GROUP_ID") ?: group + artifactId = System.getenv("ARTIFACT_ID") ?: project.name + version = System.getenv("ARTIFACT_VERSION") ?: project.version + } + } + + repositories { + maven { + String owner = System.getenv("REPOSITORY_OWNER") ?: "Unknown" + String repositoryName = System.getenv("REPOSITORY_NAME") ?: "Unknown" + String githubRepositoryUrl = "https://maven.pkg.github.com/$owner/$repositoryName" + name = "GitHubPackages" + url = githubRepositoryUrl + credentials { + username = System.getenv("GITHUB_ACTOR") ?: "NONE" + password = System.getenv("GITHUB_TOKEN") ?: "NONE" + } + } + } +} + // Updating task updateBuildScript { doLast { diff --git a/dependencies.gradle b/dependencies.gradle index 4b23dbe5b0..43a0798ac8 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,7 +1,7 @@ // Add your dependencies here dependencies { - compile("com.github.GTNewHorizons:GT5-Unofficial:master-SNAPSHOT:dev") + compile("com.github.GTNewHorizons:GT5-Unofficial:5.09.40.20:dev") compile("com.opencsv:opencsv:4.0") } -- cgit From b0655be5f677f03bb6dfa22101a82609f233e2d1 Mon Sep 17 00:00:00 2001 From: YannickMG Date: Sat, 22 Jan 2022 00:04:58 -0500 Subject: Replacing access transformers by reflection --- gradle.properties | 2 +- .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 2 + .../plugin/gregtech5/PluginGT5Base.java | 8 +- .../gwyog/gtneioreplugin/util/GuiRecipeHelper.java | 96 ++++++++++++++++++++++ src/main/resources/META-INF/gtneioreplugin_at.cfg | 5 -- 5 files changed, 105 insertions(+), 8 deletions(-) create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java delete mode 100644 src/main/resources/META-INF/gtneioreplugin_at.cfg diff --git a/gradle.properties b/gradle.properties index 1ddcad1bf9..dd5be647af 100644 --- a/gradle.properties +++ b/gradle.properties @@ -39,7 +39,7 @@ apiPackage = # Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/ # Example value: mymodid_at.cfg -accessTransformersFile = gtneioreplugin_at.cfg +accessTransformersFile = # Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! usesMixins = false diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index 7b52bd44c6..8adcc41c10 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -9,6 +9,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; +import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper; @Mod(modid = GTNEIOrePlugin.MODID, name = GTNEIOrePlugin.NAME, version = GTNEIOrePlugin.VERSION, dependencies = "required-after:gregtech;required-after:NotEnoughItems") public class GTNEIOrePlugin { @@ -41,6 +42,7 @@ public class GTNEIOrePlugin { if (event.getSide() == Side.CLIENT) { new GT5OreLayerHelper(); new GT5OreSmallHelper(); + new GuiRecipeHelper(); if (csv) { new pers.gwyog.gtneioreplugin.util.CSVMaker().run(); } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java index 6bc9db3e2c..f5bb8a618b 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java @@ -10,6 +10,7 @@ import net.minecraft.client.resources.I18n; import net.minecraft.util.EnumChatFormatting; import pers.gwyog.gtneioreplugin.plugin.PluginBase; import pers.gwyog.gtneioreplugin.util.DimensionHelper; +import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper; import java.awt.Point; import java.awt.Rectangle; @@ -87,9 +88,12 @@ public abstract class PluginGT5Base extends PluginBase { * @return Rectangle area of dimension names */ protected Rectangle getDimensionNamesRect(GuiRecipe gui, int recipe, String dimNames) { - int height = dimNames.length() > 70 ? 30 : (dimNames.length() > 36 ? 20 : 10); + int dimNamesHeight = dimNames.length() > 70 ? 30 : (dimNames.length() > 36 ? 20 : 10); Point offset = gui.getRecipePosition(recipe); - return new Rectangle(gui.guiLeft + offset.x + 2, gui.guiTop + offset.y + 110, gui.xSize - 9, height ); + return new Rectangle(GuiRecipeHelper.getGuiLeft(gui) + offset.x + 2, + GuiRecipeHelper.getGuiTop(gui) + offset.y + 110, + GuiRecipeHelper.getXSize(gui) - 9, + dimNamesHeight ); } protected int getMaximumMaterialIndex(short meta, boolean smallOre) { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java new file mode 100644 index 0000000000..78d43f1bdd --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java @@ -0,0 +1,96 @@ +package pers.gwyog.gtneioreplugin.util; + +import java.lang.reflect.Field; + +import org.apache.logging.log4j.Level; + +import codechicken.nei.recipe.GuiRecipe; +import cpw.mods.fml.common.FMLLog; +import net.minecraft.client.Minecraft; + +public class GuiRecipeHelper { + private static final String INIT_ERROR = "pers.gwyog.gtneioreplugin.util.GuiRecipeHelper failed setting up reflection : "; + private static final int DEFAULT_XSIZE = 176; + + private static Class guiRecipeClass; + public static Field xSizeField; + public static Field guiLeftField; + public static Field guiTopField; + + /** + * Access the xSize field of a GuiRecipe instance, or use a fallback hardcoded value if that fails + * + * @param gui GuiRecipe object + * @return Integer value of the xSize field of that object + */ + public static int getXSize(GuiRecipe gui) { + if (xSizeField != null) { + try { + return (int) xSizeField.get(gui); + } catch (IllegalAccessException e) { + // Fail silently, hoping that it it fails it will be during initialization + } + } + + // Fallback should work unless codechicken.nei.recipe.GuiRecipe implementation changes + return DEFAULT_XSIZE; + } + + + /** + * Access the guiLeft field of a GuiRecipe instance, or use a fallback hardcoded value if that fails + * + * @param gui GuiRecipe object + * @return Integer value of the guiLeft field of that object + */ + public static int getGuiLeft(GuiRecipe gui) { + if (guiLeftField != null) { + try { + return (int) guiLeftField.get(gui); + } catch (IllegalAccessException e) { + // Fail silently, hoping that it it fails it will be during initialization + } + } + + // Fallback should work unless codechicken.nei.recipe.GuiRecipe implementation changes + return (Minecraft.getMinecraft().currentScreen.width - DEFAULT_XSIZE) / 2; + } + + /** + * Access the guiTop field of a GuiRecipe instance, or use a fallback hardcoded value if that fails + * + * @param gui GuiRecipe object + * @return Integer value of the guiTop field of that object + */ + public static int getGuiTop(GuiRecipe gui) { + if (guiTopField != null) { + try { + return (int) guiTopField.get(gui); + } catch (IllegalAccessException e) { + // Fail silently, hoping that it it fails it will be during initialization + } + } + + // Fallback should work unless codechicken.nei.recipe.GuiRecipe implementation changes + int height = Minecraft.getMinecraft().currentScreen.height; + int ySize = Math.min(Math.max(height - 68, 166), 370); + return (height - ySize) / 2 + 10; + } + + /** + * Initialize the GuiRecipe Field accessors through reflection + */ + public GuiRecipeHelper() { + guiRecipeClass = GuiRecipe.class; + try { + guiLeftField = guiRecipeClass.getField("guiLeft"); + guiLeftField.setAccessible(true); + guiTopField = guiRecipeClass.getField("guiTop"); + guiTopField.setAccessible(true); + xSizeField = guiRecipeClass.getField("xSize"); + xSizeField.setAccessible(true); + } catch(NoSuchFieldException|SecurityException e) { + FMLLog.log(Level.ERROR, INIT_ERROR + e.getMessage()); + } + } +} diff --git a/src/main/resources/META-INF/gtneioreplugin_at.cfg b/src/main/resources/META-INF/gtneioreplugin_at.cfg deleted file mode 100644 index efa5067287..0000000000 --- a/src/main/resources/META-INF/gtneioreplugin_at.cfg +++ /dev/null @@ -1,5 +0,0 @@ -# GT NEI Ore Plugin Access Transformer configuration file -public net.minecraft.client.gui.inventory.GuiContainer field_146999_f #xSize -public net.minecraft.client.gui.inventory.GuiContainer field_147000_g #ySize -public net.minecraft.client.gui.inventory.GuiContainer field_147003_i #guiLeft -public net.minecraft.client.gui.inventory.GuiContainer field_147009_r #guiTop \ No newline at end of file -- cgit From a371b649ea121d10bd4a8f8a54749422bb9dda1d Mon Sep 17 00:00:00 2001 From: YannickMG Date: Sat, 22 Jan 2022 00:34:58 -0500 Subject: Enaable publishing to Maven repository --- .github/workflows/release-tags.yml | 6 ++++++ CODEOWNERS | 3 +++ 2 files changed, 9 insertions(+) create mode 100644 CODEOWNERS diff --git a/.github/workflows/release-tags.yml b/.github/workflows/release-tags.yml index 25c354b227..c86d8889b7 100644 --- a/.github/workflows/release-tags.yml +++ b/.github/workflows/release-tags.yml @@ -43,3 +43,9 @@ jobs: prerelease: false title: "${{ env.RELEASE_VERSION }}" files: build/libs/*.jar + + - name: Publish to Maven + run: ./gradlew publish + env: + MAVEN_USER: ${{ secrets.MAVEN_USER }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000000..a6b5f68cd0 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,3 @@ +# Any Github changes require admin approval +/.github/** @GTNewHorizons/admin + -- cgit From 606d9445dd7b76b19e02737844f826b84e2e4b60 Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Fri, 21 Jan 2022 21:48:09 -0800 Subject: update to explicit dependencies and gtnh buildscript --- build.gradle | 56 +++++++++++++++++++++++++++++++---------------------- dependencies.gradle | 2 +- repositories.gradle | 4 ++++ 3 files changed, 38 insertions(+), 24 deletions(-) diff --git a/build.gradle b/build.gradle index e466de0fd5..a2ab5d77b9 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,9 @@ -//version: 1641429628 +//version: 1642784244 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. -Please check https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/build.gradle for updates. +Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates. */ @@ -38,6 +38,7 @@ buildscript { plugins { id 'idea' + id 'eclipse' id 'scala' id("org.ajoberstar.grgit") version("3.1.1") id("com.github.johnrengelman.shadow") version("4.0.4") @@ -88,6 +89,7 @@ checkPropertyExists("containsMixinsAndOrCoreModOnly") checkPropertyExists("usesShadowedDependencies") checkPropertyExists("developmentEnvironmentUserName") +boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false String javaSourceDir = "src/main/java/" String scalaSourceDir = "src/main/scala/" @@ -151,12 +153,16 @@ configurations.all { // Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version 'git config core.fileMode false'.execute() -// Pulls version from git tag + +// Pulls version first from the VERSION env and then git tag +String identifiedVersion try { - version = minecraftVersion + "-" + gitVersion() + String versionOverride = System.getenv("VERSION") ?: null + identifiedVersion = versionOverride == null ? gitVersion() : versionOverride + version = minecraftVersion + "-" + identifiedVersion } catch (Exception e) { - throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag!"); + throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag, or the VERSION override must be set!"); } group = modGroup @@ -223,7 +229,7 @@ dependencies { annotationProcessor("com.google.code.gson:gson:2.8.6") annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT") // using 0.8 to workaround a issue in 0.7 which fails mixin application - compile("org.spongepowered:mixin:0.7.11-SNAPSHOT") { + compile("com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH") { // Mixin includes a lot of dependencies that are too up-to-date exclude module: "launchwrapper" exclude module: "guava" @@ -231,7 +237,7 @@ dependencies { exclude module: "commons-io" exclude module: "log4j-core" } - compile("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev") + compile("com.github.GTNewHorizons:SpongeMixins:1.5.0") } } @@ -480,7 +486,9 @@ task apiJar(type: Jar) { } artifacts { - archives sourcesJar + if(!noPublishedSources) { + archives sourcesJar + } archives devJar if(apiPackage) { archives apiJar @@ -491,29 +499,31 @@ artifacts { publishing { publications { maven(MavenPublication) { - artifact source: jar - artifact source: sourcesJar, classifier: "src" - artifact source: devJar, classifier: "dev" + from components.java + if(usesShadowedDependencies.toBoolean()) { + artifact source: shadowJar, classifier: "" + } + if(!noPublishedSources) { + artifact source: sourcesJar, classifier: "src" + } + artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev" if (apiPackage) { artifact source: apiJar, classifier: "api" } - groupId = System.getenv("ARTIFACT_GROUP_ID") ?: group + groupId = System.getenv("ARTIFACT_GROUP_ID") ?: "com.github.GTNewHorizons" artifactId = System.getenv("ARTIFACT_ID") ?: project.name - version = System.getenv("ARTIFACT_VERSION") ?: project.version + // Using the identified version, not project.version as it has the prepended 1.7.10 + version = System.getenv("RELEASE_VERSION") ?: identifiedVersion } } - + repositories { maven { - String owner = System.getenv("REPOSITORY_OWNER") ?: "Unknown" - String repositoryName = System.getenv("REPOSITORY_NAME") ?: "Unknown" - String githubRepositoryUrl = "https://maven.pkg.github.com/$owner/$repositoryName" - name = "GitHubPackages" - url = githubRepositoryUrl + url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases" credentials { - username = System.getenv("GITHUB_ACTOR") ?: "NONE" - password = System.getenv("GITHUB_TOKEN") ?: "NONE" + username = System.getenv("MAVEN_USER") ?: "NONE" + password = System.getenv("MAVEN_PASSWORD") ?: "NONE" } } } @@ -537,7 +547,7 @@ if (isNewBuildScriptVersionAvailable(projectDir.toString())) { } static URL availableBuildScriptUrl() { - new URL("https://raw.githubusercontent.com/SinTh0r4s/ExampleMod1.7.10/main/build.gradle") + new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/build.gradle") } boolean performBuildScriptUpdate(String projectDir) { @@ -579,7 +589,7 @@ configure(updateBuildScript) { def checkPropertyExists(String propertyName) { if (project.hasProperty(propertyName) == false) { - throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/gradle.properties") + throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties") } } diff --git a/dependencies.gradle b/dependencies.gradle index 43a0798ac8..f283051184 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,7 +1,7 @@ // Add your dependencies here dependencies { - compile("com.github.GTNewHorizons:GT5-Unofficial:5.09.40.20:dev") + compile("com.github.GTNewHorizons:GT5-Unofficial:5.09.40.18:dev") compile("com.opencsv:opencsv:4.0") } diff --git a/repositories.gradle b/repositories.gradle index ec1cbff0ac..8c16d540af 100644 --- a/repositories.gradle +++ b/repositories.gradle @@ -1,6 +1,10 @@ // Add any additional repositiroes for your dependencies here repositories { + maven { + name = "GTNH Maven" + url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" + } maven { name = "ic2" url = "http://maven.ic2.player.to/" -- cgit From 07f048a26fd27ff17142d2e4b35b4ffb19c6922d Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Fri, 21 Jan 2022 21:56:48 -0800 Subject: rollback buildscript 1 version, add deps --- build.gradle | 7 ++----- dependencies.gradle | 4 ++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index a2ab5d77b9..58264f1790 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1642784244 +//version: 1642484596 /* DO NOT CHANGE THIS FILE! @@ -499,10 +499,7 @@ artifacts { publishing { publications { maven(MavenPublication) { - from components.java - if(usesShadowedDependencies.toBoolean()) { - artifact source: shadowJar, classifier: "" - } + artifact source: usesShadowedDependencies.toBoolean() ? shadowJar : jar, classifier: "" if(!noPublishedSources) { artifact source: sourcesJar, classifier: "src" } diff --git a/dependencies.gradle b/dependencies.gradle index f283051184..9fd792033d 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -2,6 +2,10 @@ dependencies { compile("com.github.GTNewHorizons:GT5-Unofficial:5.09.40.18:dev") + compile("com.github.GTNewHorizons:NotEnoughItems:2.1.22-GTNH:dev") + compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.1:dev") + compile("com.github.GTNewHorizons:CodeChickenCore:1.1.3:dev") + compile("com.opencsv:opencsv:4.0") } -- cgit From 793693e6f2f1280a4539658e2ffab8560c59f00c Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Fri, 21 Jan 2022 22:04:11 -0800 Subject: more deps --- dependencies.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dependencies.gradle b/dependencies.gradle index 9fd792033d..24dc7802a7 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -5,7 +5,8 @@ dependencies { compile("com.github.GTNewHorizons:NotEnoughItems:2.1.22-GTNH:dev") compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.1:dev") compile("com.github.GTNewHorizons:CodeChickenCore:1.1.3:dev") - + compile("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") + compile("com.github.GTNewHorizons:StructureLib:1.0.14:dev") compile("com.opencsv:opencsv:4.0") } -- cgit From 7156325eb77a3df32be06caefe40b1c5eb3b932d Mon Sep 17 00:00:00 2001 From: bombcar Date: Fri, 4 Mar 2022 16:10:02 -0600 Subject: update for maven (#16) --- .editorconfig | 19 ++ .github/scripts/test-no-crash-reports.sh | 9 - .github/scripts/test_no_error_reports | 51 ++++ .github/workflows/build-and-test.yml | 20 +- build.gradle | 334 +++++++++++++++------ dependencies.gradle | 12 +- repositories.gradle | 17 +- .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 4 +- src/main/resources/mcmod.info | 32 +- 9 files changed, 356 insertions(+), 142 deletions(-) create mode 100644 .editorconfig delete mode 100644 .github/scripts/test-no-crash-reports.sh create mode 100755 .github/scripts/test_no_error_reports diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..6effbc91a8 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,19 @@ +# This is the universal Text Editor Configuration +# for all GTNewHorizons projects +# See: https://editorconfig.org/ + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{bat,ini}] +end_of_line = crlf + +[*.{dtd,json,info,mcmeta,md,sh,svg,xml,xsd,xsl,yaml,yml}] +indent_size = 2 diff --git a/.github/scripts/test-no-crash-reports.sh b/.github/scripts/test-no-crash-reports.sh deleted file mode 100644 index c67e342c06..0000000000 --- a/.github/scripts/test-no-crash-reports.sh +++ /dev/null @@ -1,9 +0,0 @@ -directory="run/crash-reports" -if [ -d $directory ]; then - echo "Crash reports detected:" - cat $directory/* - exit 1 -else - echo "No crash reports detected" - exit 0 -fi diff --git a/.github/scripts/test_no_error_reports b/.github/scripts/test_no_error_reports new file mode 100755 index 0000000000..1fcc7396c6 --- /dev/null +++ b/.github/scripts/test_no_error_reports @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +# bashsupport disable=BP5006 # Global environment variables +RUNDIR="run" \ + CRASH="crash-reports" \ + SERVERLOG="server.log" + +# enable nullglob to get 0 results when no match rather than the pattern +shopt -s nullglob + +# store matches in array +crash_reports=("$RUNDIR/$CRASH/crash"*.txt) + +# if array not empty there are crash_reports +if [ "${#crash_reports[@]}" -gt 0 ]; then + # get the latest crash_report from array + latest_crash_report="${crash_reports[-1]}" + { + printf 'Latest crash report detected %s:\n' "${latest_crash_report##*/}" + cat "$latest_crash_report" + } >&2 + exit 1 +fi + +if grep --quiet --fixed-strings 'Fatal errors were detected' "$SERVERLOG"; then + { + printf 'Fatal errors detected:\n' + cat server.log + } >&2 + exit 1 +fi + +if grep --quiet --fixed-strings 'The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED' \ + "$SERVERLOG"; then + { + printf 'Server force stopped:' + cat server.log + } >&2 + exit 1 +fi + +if ! grep --quiet --perl-regexp --only-matching '.+Done \(.+\)\! For help, type "help" or "\?"' "$SERVERLOG"; then + { + printf 'Server did not finish startup:' + cat server.log + } >&2 + exit 1 +fi + +printf 'No crash reports detected' +exit 0 diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index a60a2b6468..56a1ad52cc 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -14,32 +14,32 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - with: + with: fetch-depth: 0 - + - name: Set up JDK 8 uses: actions/setup-java@v2 with: java-version: '8' distribution: 'adopt' cache: gradle - + - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Setup the workspace run: ./gradlew setupCIWorkspace - + - name: Build the mod run: ./gradlew build - - name: Run server for 1 minute + - name: Run server for 1.5 minutes run: | mkdir run - echo "eula=true" > run/eula.txt - timeout 60 ./gradlew runServer || true + echo "eula=true" > run/eula.txt + timeout 90 ./gradlew runServer 2>&1 | tee -a server.log || true - - name: Test no crashes happend + - name: Test no errors reported during server run run: | - chmod +x .github/scripts/test-no-crash-reports.sh - .github/scripts/test-no-crash-reports.sh + chmod +x .github/scripts/test_no_error_reports + .github/scripts/test_no_error_reports diff --git a/build.gradle b/build.gradle index 58264f1790..d90db129d1 100644 --- a/build.gradle +++ b/build.gradle @@ -1,51 +1,64 @@ -//version: 1642484596 +//version: 1646409286 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates. - */ +*/ import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import org.gradle.internal.logging.text.StyledTextOutput.Style +import org.gradle.internal.logging.text.StyledTextOutputFactory import java.util.concurrent.TimeUnit buildscript { repositories { maven { - name = "forge" - url = "https://maven.minecraftforge.net" + name 'forge' + url 'https://maven.minecraftforge.net' } maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" + name 'sonatype' + url 'https://oss.sonatype.org/content/repositories/snapshots/' } maven { - name = "Scala CI dependencies" - url = "https://repo1.maven.org/maven2/" + name 'Scala CI dependencies' + url 'https://repo1.maven.org/maven2/' } maven { - name = "jitpack" - url = "https://jitpack.io" + name 'jitpack' + url 'https://jitpack.io' } } dependencies { - classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.5' + classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.7' } } plugins { + id 'java-library' id 'idea' id 'eclipse' id 'scala' - id("org.ajoberstar.grgit") version("3.1.1") - id("com.github.johnrengelman.shadow") version("4.0.4") - id("com.palantir.git-version") version("0.12.3") - id("maven-publish") + id 'maven-publish' + id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false + id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false + id 'org.ajoberstar.grgit' version '4.1.1' + id 'com.github.johnrengelman.shadow' version '4.0.4' + id 'com.palantir.git-version' version '0.13.0' apply false + id 'de.undercouch.download' version '5.0.1' + id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false } +if (project.file('.git/HEAD').isFile()) { + apply plugin: 'com.palantir.git-version' +} + +def out = services.get(StyledTextOutputFactory).create('an-output') + apply plugin: 'forge' def projectJavaVersion = JavaLanguageVersion.of(8) @@ -90,27 +103,31 @@ checkPropertyExists("usesShadowedDependencies") checkPropertyExists("developmentEnvironmentUserName") boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false +boolean usesMixinDebug = project.findProperty('usesMixinDebug') ?: project.usesMixins.toBoolean() String javaSourceDir = "src/main/java/" String scalaSourceDir = "src/main/scala/" +String kotlinSourceDir = "src/main/kotlin/" String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") -if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { - throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala) +String targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") +if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { + throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) } if(apiPackage) { targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") - if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { - throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala) + targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { + throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) } } if(accessTransformersFile) { String targetFile = "src/main/resources/META-INF/" + accessTransformersFile - if(getFile(targetFile).exists() == false) { + if(!getFile(targetFile).exists()) { throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) } } @@ -122,15 +139,17 @@ if(usesMixins.toBoolean()) { targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") - if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { - throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala) + targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") + if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { + throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) } String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala" String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" - if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) { - throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava) + String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".kt" + if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { + throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) } } @@ -138,8 +157,9 @@ if(coreModClass) { String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala" String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" - if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) { - throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava) + String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".kt" + if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { + throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) } } @@ -152,17 +172,35 @@ configurations.all { } // Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version -'git config core.fileMode false'.execute() +try { + 'git config core.fileMode false'.execute() +} +catch (Exception ignored) { + out.style(Style.Failure).println("git isn't installed at all") +} // Pulls version first from the VERSION env and then git tag String identifiedVersion +String versionOverride = System.getenv("VERSION") ?: null try { - String versionOverride = System.getenv("VERSION") ?: null identifiedVersion = versionOverride == null ? gitVersion() : versionOverride - version = minecraftVersion + "-" + identifiedVersion } -catch (Exception e) { - throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag, or the VERSION override must be set!"); +catch (Exception ignored) { + out.style(Style.Failure).text( + 'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' + + 'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' + + 'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)' + ) + versionOverride = 'NO-GIT-TAG-SET' + identifiedVersion = versionOverride +} +version = minecraftVersion + '-' + identifiedVersion +ext { + modVersion = identifiedVersion +} + +if(identifiedVersion == versionOverride) { + out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7') } group = modGroup @@ -173,9 +211,25 @@ else { archivesBaseName = modId } +def arguments = [] +def jvmArguments = [] + +if (usesMixins.toBoolean()) { + arguments += [ + "--tweakClass org.spongepowered.asm.launch.MixinTweaker" + ] + if (usesMixinDebug.toBoolean()) { + jvmArguments += [ + "-Dmixin.debug.countInjections=true", + "-Dmixin.debug.verbose=true", + "-Dmixin.debug.export=true" + ] + } +} + minecraft { - version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion - runDir = "run" + version = minecraftVersion + '-' + forgeVersion + '-' + minecraftVersion + runDir = 'run' if (replaceGradleTokenInFile) { replaceIn replaceGradleTokenInFile @@ -186,16 +240,30 @@ minecraft { replace gradleTokenModName, modName } if(gradleTokenVersion) { - replace gradleTokenVersion, versionDetails().lastTag + replace gradleTokenVersion, modVersion } if(gradleTokenGroupName) { replace gradleTokenGroupName, modGroup } } + + clientIntellijRun { + args(arguments) + jvmArgs(jvmArguments) + + if(developmentEnvironmentUserName) { + args("--username", developmentEnvironmentUserName) + } + } + + serverIntellijRun { + args(arguments) + jvmArgs(jvmArguments) + } } -if(file("addon.gradle").exists()) { - apply from: "addon.gradle" +if(file('addon.gradle').exists()) { + apply from: 'addon.gradle' } apply from: 'repositories.gradle' @@ -208,58 +276,63 @@ configurations { repositories { maven { - name = "Overmind forge repo mirror" - url = "https://gregtech.overminddl1.com/" + name 'Overmind forge repo mirror' + url 'https://gregtech.overminddl1.com/' } if(usesMixins.toBoolean()) { maven { - name = "sponge" - url = "https://repo.spongepowered.org/repository/maven-public" + name 'sponge' + url 'https://repo.spongepowered.org/repository/maven-public' } maven { - url = "https://jitpack.io" + url 'https://jitpack.io' } } } dependencies { if(usesMixins.toBoolean()) { - annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3") - annotationProcessor("com.google.guava:guava:24.1.1-jre") - annotationProcessor("com.google.code.gson:gson:2.8.6") - annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT") + annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3') + annotationProcessor('com.google.guava:guava:24.1.1-jre') + annotationProcessor('com.google.code.gson:gson:2.8.6') + annotationProcessor('org.spongepowered:mixin:0.8-SNAPSHOT') // using 0.8 to workaround a issue in 0.7 which fails mixin application - compile("com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH") { + compile('com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH') { // Mixin includes a lot of dependencies that are too up-to-date - exclude module: "launchwrapper" - exclude module: "guava" - exclude module: "gson" - exclude module: "commons-io" - exclude module: "log4j-core" + exclude module: 'launchwrapper' + exclude module: 'guava' + exclude module: 'gson' + exclude module: 'commons-io' + exclude module: 'log4j-core' } - compile("com.github.GTNewHorizons:SpongeMixins:1.5.0") + compile('com.github.GTNewHorizons:SpongeMixins:1.5.0') } } apply from: 'dependencies.gradle' -def mixingConfigRefMap = "mixins." + modId + ".refmap.json" +def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg" task generateAssets { - if(usesMixins.toBoolean()) { - getFile("/src/main/resources/mixins." + modId + ".json").text = """{ + if (usesMixins.toBoolean()) { + def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json"); + if (!mixinConfigFile.exists()) { + mixinConfigFile.text = """{ "required": true, "minVersion": "0.7.11", "package": "${modGroup}.${mixinsPackage}", "plugin": "${modGroup}.${mixinPlugin}", "refmap": "${mixingConfigRefMap}", "target": "@env(DEFAULT)", - "compatibilityLevel": "JAVA_8" + "compatibilityLevel": "JAVA_8", + "mixins": [], + "client": [], + "server": [] } - """ + } } } @@ -323,15 +396,6 @@ afterEvaluate { } runClient { - def arguments = [] - - if(usesMixins.toBoolean()) { - arguments += [ - "--mods=../build/libs/$modId-${version}.jar", - "--tweakClass org.spongepowered.asm.launch.MixinTweaker" - ] - } - if(developmentEnvironmentUserName) { arguments += [ "--username", @@ -340,19 +404,12 @@ runClient { } args(arguments) + jvmArgs(jvmArguments) } runServer { - def arguments = [] - - if (usesMixins.toBoolean()) { - arguments += [ - "--mods=../build/libs/$modId-${version}.jar", - "--tweakClass org.spongepowered.asm.launch.MixinTweaker" - ] - } - args(arguments) + jvmArgs(jvmArguments) } tasks.withType(JavaExec).configureEach { @@ -363,8 +420,7 @@ tasks.withType(JavaExec).configureEach { ) } -processResources -{ +processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version @@ -373,18 +429,18 @@ processResources from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' - // replace version and mcversion + // replace modVersion and minecraftVersion expand "minecraftVersion": project.minecraft.version, - "modVersion": versionDetails().lastTag, - "modId": modId, - "modName": modName + "modVersion": modVersion, + "modId": modId, + "modName": modName } if(usesMixins.toBoolean()) { from refMap } - // copy everything else, thats not the mcmod.info + // copy everything else that's not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } @@ -392,7 +448,7 @@ processResources def getManifestAttributes() { def manifestAttributes = [:] - if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) { + if(!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) { manifestAttributes += ["FMLCorePluginContainsFMLMod": true] } @@ -408,14 +464,14 @@ def getManifestAttributes() { manifestAttributes += [ "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", "MixinConfigs" : "mixins." + modId + ".json", - "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false + "ForceLoadAsMod" : !containsMixinsAndOrCoreModOnly.toBoolean() ] } return manifestAttributes } task sourcesJar(type: Jar) { - from (sourceSets.main.allJava) + from (sourceSets.main.allSource) from (file("$projectDir/LICENSE")) getArchiveClassifier().set('sources') } @@ -470,7 +526,7 @@ task devJar(type: Jar) { } task apiJar(type: Jar) { - from (sourceSets.main.allJava) { + from (sourceSets.main.allSource) { include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' } @@ -495,11 +551,22 @@ artifacts { } } -// publishing +// The gradle metadata includes all of the additional deps that we disabled from POM generation (including forgeBin with no groupID), +// and isn't strictly needed with the POM so just disable it. +tasks.withType(GenerateModuleMetadata) { + enabled = false +} + +// workaround variable hiding in pom processing +def projectConfigs = project.configurations + publishing { publications { maven(MavenPublication) { - artifact source: usesShadowedDependencies.toBoolean() ? shadowJar : jar, classifier: "" + from components.java + if(usesShadowedDependencies.toBoolean()) { + artifact source: shadowJar, classifier: "" + } if(!noPublishedSources) { artifact source: sourcesJar, classifier: "src" } @@ -512,6 +579,25 @@ publishing { artifactId = System.getenv("ARTIFACT_ID") ?: project.name // Using the identified version, not project.version as it has the prepended 1.7.10 version = System.getenv("RELEASE_VERSION") ?: identifiedVersion + + // remove extra garbage from minecraft and minecraftDeps configuration + pom.withXml { + def badArtifacts = [:].withDefault {[] as Set} + for (configuration in [projectConfigs.minecraft, projectConfigs.minecraftDeps]) { + for (dependency in configuration.allDependencies) { + badArtifacts[dependency.group == null ? "" : dependency.group] += dependency.name + } + } + // example for specifying extra stuff to ignore + // badArtifacts["org.example.group"] += "artifactName" + + Node pomNode = asNode() + pomNode.dependencies.'*'.findAll() { + badArtifacts[it.groupId.text()].contains(it.artifactId.text()) + }.each() { + it.parent().remove(it) + } + } } } @@ -539,7 +625,7 @@ if (isNewBuildScriptVersionAvailable(projectDir.toString())) { if (autoUpdateBuildScript.toBoolean()) { performBuildScriptUpdate(projectDir.toString()) } else { - println("Build script update available! Run 'gradle updateBuildScript'") + out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'") } } @@ -551,7 +637,7 @@ boolean performBuildScriptUpdate(String projectDir) { if (isNewBuildScriptVersionAvailable(projectDir)) { def buildscriptFile = getFile("build.gradle") availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } } - print("Build script updated. Please REIMPORT the project or RESTART your IDE!") + out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!") return true } return false @@ -582,10 +668,76 @@ configure(updateBuildScript) { description = 'Updates the build script to the latest version' } +// Deobfuscation + +def deobf(String sourceURL) { + try { + URL url = new URL(sourceURL) + String fileName = url.getFile() + + //get rid of directories: + int lastSlash = fileName.lastIndexOf("/") + if(lastSlash > 0) { + fileName = fileName.substring(lastSlash + 1) + } + //get rid of extension: + if(fileName.endsWith(".jar")) { + fileName = fileName.substring(0, fileName.lastIndexOf(".")) + } + + String hostName = url.getHost() + if(hostName.startsWith("www.")) { + hostName = hostName.substring(4) + } + List parts = Arrays.asList(hostName.split("\\.")) + Collections.reverse(parts) + hostName = String.join(".", parts) + + return deobf(sourceURL, hostName + "/" + fileName) + } catch(Exception e) { + return deobf(sourceURL, "deobf/" + String.valueOf(sourceURL.hashCode())) + } +} + +// The method above is to be preferred. Use this method if the filename is not at the end of the URL. +def deobf(String sourceURL, String fileName) { + String cacheDir = System.getProperty("user.home") + "/.gradle/caches/" + String bon2Dir = cacheDir + "forge_gradle/deobf" + String bon2File = bon2Dir + "/BON2-2.5.0.jar" + String obfFile = cacheDir + "modules-2/files-2.1/" + fileName + ".jar" + String deobfFile = cacheDir + "modules-2/files-2.1/" + fileName + "-deobf.jar" + + if(file(deobfFile).exists()) { + return files(deobfFile) + } + + download.run { + src 'https://github.com/GTNewHorizons/BON2/releases/download/2.5.0/BON2-2.5.0.CUSTOM-all.jar' + dest bon2File + quiet true + overwrite false + } + + download.run { + src sourceURL + dest obfFile + quiet true + overwrite false + } + + exec { + commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', '1.7.10', '--mappingsVer', 'stable_12', '--notch' + workingDir bon2Dir + standardOutput = new ByteArrayOutputStream() + } + + return files(deobfFile) +} + // Helper methods def checkPropertyExists(String propertyName) { - if (project.hasProperty(propertyName) == false) { + if (!project.hasProperty(propertyName)) { throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties") } } diff --git a/dependencies.gradle b/dependencies.gradle index 24dc7802a7..d8316c045f 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,12 +1,10 @@ // Add your dependencies here dependencies { - compile("com.github.GTNewHorizons:GT5-Unofficial:5.09.40.18:dev") - compile("com.github.GTNewHorizons:NotEnoughItems:2.1.22-GTNH:dev") - compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.1:dev") - compile("com.github.GTNewHorizons:CodeChickenCore:1.1.3:dev") - compile("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") - compile("com.github.GTNewHorizons:StructureLib:1.0.14:dev") + compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.39:dev') + compile('com.github.GTNewHorizons:NotEnoughItems:2.2.9-GTNH:dev') - compile("com.opencsv:opencsv:4.0") + compile('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev') + + compileOnly('com.opencsv:opencsv:4.0') } diff --git a/repositories.gradle b/repositories.gradle index 8c16d540af..e850975183 100644 --- a/repositories.gradle +++ b/repositories.gradle @@ -2,22 +2,21 @@ repositories { maven { - name = "GTNH Maven" - url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" + name 'GTNH Maven' + url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/' } maven { - name = "ic2" - url = "http://maven.ic2.player.to/" + name 'ic2' + url 'http://maven.ic2.player.to/' metadataSources { mavenPom() artifact() } } maven { - url = "https://jitpack.io" - } - maven { - name = "ic2" - url = "https://maven.ic2.player.to/" + url 'https://cursemaven.com' + content { + includeGroup 'curse.maven' + } } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index 8adcc41c10..a324621a3b 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -27,8 +27,8 @@ public class GTNEIOrePlugin { @EventHandler public void preinit(FMLPreInitializationEvent event) { - Config c = new Config(event, this.MODID + ".cfg"); - csv = c.tConfig.getBoolean("print csv", "ALL", false, "princsv, you need apache commons collections to be injected in the minecraft jar."); + Config c = new Config(event, MODID + ".cfg"); + csv = c.tConfig.getBoolean("print csv", "ALL", false, "print csv, you need apache commons collections to be injected in the minecraft jar."); CSVname = c.tConfig.getString("CSV_name", "ALL", event.getModConfigurationDirectory() + "/GTNH-Oresheet.csv", "rename the oresheet here, it will appear in /config"); CSVnameSmall= c.tConfig.getString("CSV_name_for_Small_Ore_Sheet", "ALL", event.getModConfigurationDirectory() + "/GTNH-Small-Ores-Sheet.csv", "rename the oresheet here, it will appear in /config"); toolTips = c.tConfig.getBoolean("DimTooltip", "ALL", true, "Activates Dimension Tooltips"); diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 350b3bd56d..f46fb75db6 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,16 +1,20 @@ -[ { - "modid": "${modId}", - "name": "${modName}", - "description": "A forge mod which adds NEI plugins for GregTech5's ores. Modded for GT:NH", - "version": "${modVersion}", - "mcversion": "${minecraftVersion}", - "url": "", - "updateUrl": "", - "authorList": ["GWYOG","bartimaeusnek"], - "credits": "", - "logoFile": "", - "screenshots": [], - "dependencies": [] + "modListVersion": 2, + "modList": [{ + "modid": "${modId}", + "name": "${modName}", + "description": "A forge mod which adds NEI plugins for GregTech5's ores. Modded for GTNH", + "version": "${modVersion}", + "mcversion": "${minecraftVersion}", + "url": "", + "updateUrl": "", + "authorList": ["GWYOG", "bartimaeusnek"], + "credits": "", + "logoFile": "", + "screenshots": [], + "requiredMods": ["Forge", "gregtech", "NotEnoughItems"], + "dependencies": ["gregtech", "NotEnoughItems"], + "dependants": [], + "useDependencyInformation": true + }] } -] -- cgit From 1cb11f470f296eb4db63174f7e58b17c7af7000d Mon Sep 17 00:00:00 2001 From: Martin Robertz Date: Fri, 4 Mar 2022 23:11:16 +0100 Subject: ignore bat files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 558ad12d27..40fb5e4a7d 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ whitelist.json *.ipr *.iws src/main/resources/mixins.*.json +*.bat -- cgit From 7836eea57a199661e1ac4b41d9ae678e62588ee2 Mon Sep 17 00:00:00 2001 From: YannickMG Date: Wed, 6 Jul 2022 15:35:36 -0400 Subject: Enhanced NEI discoverability (#17) * Removed unused code * Addressed IDE warnings * Refactored PluginGT5VeinStat::loadCraftingRecipes for readability * Refactored PluginGT5VeinStat::drawExtras for readability * Added OreVeinLayer class for the concept of ore layer * Updated buildscript * Ran spotlessApply * Addressed some trivial IDE warnings * Load both Small Ores and regular Ores when either is queried. * Refactored PluginGT5SmallOreStat::loadCraftingRecipes for readability * Refactored PluginGT5SmallOreStat::drawExtras for readability --- build.gradle | 223 ++++++++++++++++-- dependencies.gradle | 8 +- repositories.gradle | 36 +-- .../java/pers/gwyog/gtneioreplugin/Config.java | 7 +- .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 34 ++- .../gwyog/gtneioreplugin/plugin/PluginBase.java | 7 +- .../plugin/gregtech5/PluginGT5Base.java | 76 +++--- .../plugin/gregtech5/PluginGT5SmallOreStat.java | 143 +++++++----- .../plugin/gregtech5/PluginGT5VeinStat.java | 257 +++++++-------------- .../pers/gwyog/gtneioreplugin/util/CSVMaker.java | 38 +-- .../gwyog/gtneioreplugin/util/DimensionHelper.java | 206 +++++++++-------- .../gwyog/gtneioreplugin/util/GT5CFGHelper.java | 109 +++++---- .../gtneioreplugin/util/GT5OreLayerHelper.java | 47 ++-- .../gtneioreplugin/util/GT5OreSmallHelper.java | 83 ++++--- .../gwyog/gtneioreplugin/util/GuiRecipeHelper.java | 31 ++- .../gwyog/gtneioreplugin/util/OreVeinLayer.java | 21 ++ .../pers/gwyog/gtneioreplugin/util/Oremix.java | 49 +++- .../gtneioreplugin/util/StringPaddingHack.java | 38 +-- .../gwyog/gtneioreplugin/util/Veinrenamer.java | 4 +- .../pers/gwyog/gtneioreplugin/util/XtoBool.java | 12 +- 20 files changed, 838 insertions(+), 591 deletions(-) create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/OreVeinLayer.java diff --git a/build.gradle b/build.gradle index d90db129d1..e182c451c6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1646409286 +//version: 1656760175 /* DO NOT CHANGE THIS FILE! @@ -12,7 +12,12 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import org.gradle.internal.logging.text.StyledTextOutput.Style import org.gradle.internal.logging.text.StyledTextOutputFactory +import java.nio.file.Files +import java.nio.file.Paths import java.util.concurrent.TimeUnit +import java.util.zip.ZipEntry +import java.util.zip.ZipInputStream +import java.util.zip.ZipOutputStream buildscript { repositories { @@ -44,13 +49,15 @@ plugins { id 'eclipse' id 'scala' id 'maven-publish' - id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false - id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false + id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false + id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false + id 'com.google.devtools.ksp' version '1.5.30-1.0.0' apply false id 'org.ajoberstar.grgit' version '4.1.1' id 'com.github.johnrengelman.shadow' version '4.0.4' - id 'com.palantir.git-version' version '0.13.0' apply false + id 'com.palantir.git-version' version '0.13.0' apply false id 'de.undercouch.download' version '5.0.1' - id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false + id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false + id "com.diffplug.spotless" version "6.7.2" } if (project.file('.git/HEAD').isFile()) { @@ -77,6 +84,37 @@ idea { } } +// Spotless autoformatter +// See https://github.com/diffplug/spotless/tree/main/plugin-gradle +// Can be locally toggled via spotless:off/spotless:on comments +spotless { + encoding 'UTF-8' + + format 'misc', { + target '.gitignore' + + trimTrailingWhitespace() + indentWithSpaces(4) + endWithNewline() + } + java { + toggleOffOn() + importOrder() + removeUnusedImports() + palantirJavaFormat('1.1.0') // last version supporting jvm 8 + } + kotlin { + toggleOffOn() + ktfmt('0.39') + } + groovyGradle { + toggleOffOn() + importOrder() + target '*.gradle' + greclipse('4.19.0') // last version supporting jvm 8 + } +} + if(JavaVersion.current() != JavaVersion.VERSION_1_8) { throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current()) } @@ -104,6 +142,9 @@ checkPropertyExists("developmentEnvironmentUserName") boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false boolean usesMixinDebug = project.findProperty('usesMixinDebug') ?: project.usesMixins.toBoolean() +String channel = project.findProperty('channel') ? project.channel : 'stable' +String mappingsVersion = project.findProperty('mappingsVersion') ? project.mappingsVersion : '12' +String remoteMappings = project.findProperty('remoteMappings') ? project.remoteMappings : 'https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/' String javaSourceDir = "src/main/java/" String scalaSourceDir = "src/main/scala/" @@ -568,7 +609,7 @@ publishing { artifact source: shadowJar, classifier: "" } if(!noPublishedSources) { - artifact source: sourcesJar, classifier: "src" + artifact source: sourcesJar, classifier: "sources" } artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev" if (apiPackage) { @@ -668,7 +709,103 @@ configure(updateBuildScript) { description = 'Updates the build script to the latest version' } -// Deobfuscation +// Parameter Deobfuscation + +task deobfParams { + doLast { + + String mcpDir = "$project.gradle.gradleUserHomeDir/caches/minecraft/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion" + String mcpZIP = "$mcpDir/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip" + String paramsCSV = "$mcpDir/params.csv" + + download.run { + src "https://maven.minecraftforge.net/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion-$minecraftVersion/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip" + dest mcpZIP + overwrite false + } + + if(!file(paramsCSV).exists()) { + println("Extracting MCP archive ...") + unzip(mcpZIP, mcpDir) + } + + println("Parsing params.csv ...") + Map params = new HashMap<>() + Files.lines(Paths.get(paramsCSV)).forEach{line -> + String[] cells = line.split(",") + if(cells.length > 2 && cells[0].matches("p_i?\\d+_\\d+_")) { + params.put(cells[0], cells[1]) + } + } + + out.style(Style.Success).println("Modified ${replaceParams(file("$projectDir/src/main/java"), params)} files!") + out.style(Style.Failure).println("Don't forget to verify that the code still works as before!\n It could be broken due to duplicate variables existing now\n or parameters taking priority over other variables.") + } +} + +static int replaceParams(File file, Map params) { + int fileCount = 0 + + if(file.isDirectory()) { + for(File f : file.listFiles()) { + fileCount += replaceParams(f, params) + } + return fileCount + } + println("Visiting ${file.getName()} ...") + try { + String content = new String(Files.readAllBytes(file.toPath())) + int hash = content.hashCode() + params.forEach{key, value -> + content = content.replaceAll(key, value) + } + if(hash != content.hashCode()) { + Files.write(file.toPath(), content.getBytes("UTF-8")) + return 1 + } + } catch(Exception e) { + e.printStackTrace() + } + return 0 +} + +// Credit: bitsnaps (https://gist.github.com/bitsnaps/00947f2dce66f4bbdabc67d7e7b33681) +static unzip(String zipFileName, String outputDir) { + byte[] buffer = new byte[16384] + ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFileName)) + ZipEntry zipEntry = zis.getNextEntry() + while (zipEntry != null) { + File newFile = new File(outputDir + File.separator, zipEntry.name) + if (zipEntry.isDirectory()) { + if (!newFile.isDirectory() && !newFile.mkdirs()) { + throw new IOException("Failed to create directory $newFile") + } + } else { + // fix for Windows-created archives + File parent = newFile.parentFile + if (!parent.isDirectory() && !parent.mkdirs()) { + throw new IOException("Failed to create directory $parent") + } + // write file content + FileOutputStream fos = new FileOutputStream(newFile) + int len = 0 + while ((len = zis.read(buffer)) > 0) { + fos.write(buffer, 0, len) + } + fos.close() + } + zipEntry = zis.getNextEntry() + } + zis.closeEntry() + zis.close() +} + +configure(deobfParams) { + group = 'forgegradle' + description = 'Rename all obfuscated parameter names inherited from Minecraft classes' +} + +// Dependency Deobfuscation def deobf(String sourceURL) { try { @@ -681,7 +818,7 @@ def deobf(String sourceURL) { fileName = fileName.substring(lastSlash + 1) } //get rid of extension: - if(fileName.endsWith(".jar")) { + if(fileName.endsWith(".jar") || fileName.endsWith(".litemod")) { fileName = fileName.substring(0, fileName.lastIndexOf(".")) } @@ -693,26 +830,40 @@ def deobf(String sourceURL) { Collections.reverse(parts) hostName = String.join(".", parts) - return deobf(sourceURL, hostName + "/" + fileName) + return deobf(sourceURL, "$hostName/$fileName") } catch(Exception e) { - return deobf(sourceURL, "deobf/" + String.valueOf(sourceURL.hashCode())) + return deobf(sourceURL, "deobf/${sourceURL.hashCode()}") } } // The method above is to be preferred. Use this method if the filename is not at the end of the URL. -def deobf(String sourceURL, String fileName) { - String cacheDir = System.getProperty("user.home") + "/.gradle/caches/" - String bon2Dir = cacheDir + "forge_gradle/deobf" - String bon2File = bon2Dir + "/BON2-2.5.0.jar" - String obfFile = cacheDir + "modules-2/files-2.1/" + fileName + ".jar" - String deobfFile = cacheDir + "modules-2/files-2.1/" + fileName + "-deobf.jar" +def deobf(String sourceURL, String rawFileName) { + String bon2Version = "2.5.1" + String fileName = URLDecoder.decode(rawFileName, "UTF-8") + String cacheDir = "$project.gradle.gradleUserHomeDir/caches" + String bon2Dir = "$cacheDir/forge_gradle/deobf" + String bon2File = "$bon2Dir/BON2-${bon2Version}.jar" + String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar" + String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar" if(file(deobfFile).exists()) { return files(deobfFile) } + String mappingsVer + if(remoteMappings) { + String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion" + String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip" + + zipMappings(mappingsZIP, remoteMappings, bon2Dir) + + mappingsVer = "snapshot_$id" + } else { + mappingsVer = "${channel}_$mappingsVersion" + } + download.run { - src 'https://github.com/GTNewHorizons/BON2/releases/download/2.5.0/BON2-2.5.0.CUSTOM-all.jar' + src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar" dest bon2File quiet true overwrite false @@ -726,14 +877,48 @@ def deobf(String sourceURL, String fileName) { } exec { - commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', '1.7.10', '--mappingsVer', 'stable_12', '--notch' + commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch' workingDir bon2Dir - standardOutput = new ByteArrayOutputStream() + standardOutput = new FileOutputStream("${deobfFile}.log") } return files(deobfFile) } +def zipMappings(String zipPath, String url, String bon2Dir) { + File zipFile = new File(zipPath) + if(zipFile.exists()) { + return + } + + String fieldsCache = "$bon2Dir/data/fields.csv" + String methodsCache = "$bon2Dir/data/methods.csv" + + download.run { + src "${url}fields.csv" + dest fieldsCache + quiet true + } + download.run { + src "${url}methods.csv" + dest methodsCache + quiet true + } + + zipFile.getParentFile().mkdirs() + ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile)) + + zos.putNextEntry(new ZipEntry("fields.csv")) + Files.copy(Paths.get(fieldsCache), zos) + zos.closeEntry() + + zos.putNextEntry(new ZipEntry("methods.csv")) + Files.copy(Paths.get(methodsCache), zos) + zos.closeEntry() + + zos.close() +} + // Helper methods def checkPropertyExists(String propertyName) { diff --git a/dependencies.gradle b/dependencies.gradle index d8316c045f..9e3d33e5e2 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,10 +1,10 @@ // Add your dependencies here dependencies { - compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.39:dev') - compile('com.github.GTNewHorizons:NotEnoughItems:2.2.9-GTNH:dev') + compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.39:dev') + compile('com.github.GTNewHorizons:NotEnoughItems:2.2.9-GTNH:dev') - compile('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev') + compile('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev') - compileOnly('com.opencsv:opencsv:4.0') + compileOnly('com.opencsv:opencsv:4.0') } diff --git a/repositories.gradle b/repositories.gradle index e850975183..f67e7c627d 100644 --- a/repositories.gradle +++ b/repositories.gradle @@ -1,22 +1,22 @@ // Add any additional repositiroes for your dependencies here repositories { - maven { - name 'GTNH Maven' - url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/' - } - maven { - name 'ic2' - url 'http://maven.ic2.player.to/' - metadataSources { - mavenPom() - artifact() - } - } - maven { - url 'https://cursemaven.com' - content { - includeGroup 'curse.maven' - } - } + maven { + name 'GTNH Maven' + url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/' + } + maven { + name 'ic2' + url 'http://maven.ic2.player.to/' + metadataSources { + mavenPom() + artifact() + } + } + maven { + url 'https://cursemaven.com' + content { + includeGroup 'curse.maven' + } + } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/Config.java b/src/main/java/pers/gwyog/gtneioreplugin/Config.java index c31ebc63a6..eedd953316 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/Config.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/Config.java @@ -1,9 +1,8 @@ package pers.gwyog.gtneioreplugin; import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.common.config.Configuration; - import java.io.File; +import net.minecraftforge.common.config.Configuration; public class Config { public Configuration tConfig; @@ -15,8 +14,6 @@ public class Config { } public void save() { - if (tConfig.hasChanged()) - tConfig.save(); + if (tConfig.hasChanged()) tConfig.save(); } - } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index a324621a3b..3c0eb00eb4 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -11,7 +11,11 @@ import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper; -@Mod(modid = GTNEIOrePlugin.MODID, name = GTNEIOrePlugin.NAME, version = GTNEIOrePlugin.VERSION, dependencies = "required-after:gregtech;required-after:NotEnoughItems") +@Mod( + modid = GTNEIOrePlugin.MODID, + name = GTNEIOrePlugin.NAME, + version = GTNEIOrePlugin.VERSION, + dependencies = "required-after:gregtech;required-after:NotEnoughItems") public class GTNEIOrePlugin { public static final String MODID = "GRADLETOKEN_MODID"; public static final String NAME = "GRADLETOKEN_MODNAME"; @@ -22,17 +26,36 @@ public class GTNEIOrePlugin { public static String CSVnameSmall; public static boolean toolTips = true; public static int maxTooltipLines = 11; + @Mod.Instance(MODID) public static GTNEIOrePlugin instance; @EventHandler public void preinit(FMLPreInitializationEvent event) { Config c = new Config(event, MODID + ".cfg"); - csv = c.tConfig.getBoolean("print csv", "ALL", false, "print csv, you need apache commons collections to be injected in the minecraft jar."); - CSVname = c.tConfig.getString("CSV_name", "ALL", event.getModConfigurationDirectory() + "/GTNH-Oresheet.csv", "rename the oresheet here, it will appear in /config"); - CSVnameSmall= c.tConfig.getString("CSV_name_for_Small_Ore_Sheet", "ALL", event.getModConfigurationDirectory() + "/GTNH-Small-Ores-Sheet.csv", "rename the oresheet here, it will appear in /config"); + csv = c.tConfig.getBoolean( + "print csv", + "ALL", + false, + "print csv, you need apache commons collections to be injected in the minecraft jar."); + CSVname = c.tConfig.getString( + "CSV_name", + "ALL", + event.getModConfigurationDirectory() + "/GTNH-Oresheet.csv", + "rename the oresheet here, it will appear in /config"); + CSVnameSmall = c.tConfig.getString( + "CSV_name_for_Small_Ore_Sheet", + "ALL", + event.getModConfigurationDirectory() + "/GTNH-Small-Ores-Sheet.csv", + "rename the oresheet here, it will appear in /config"); toolTips = c.tConfig.getBoolean("DimTooltip", "ALL", true, "Activates Dimension Tooltips"); - maxTooltipLines = c.tConfig.getInt("MaxToolTipLines", "ALL", 11, 1, Integer.MAX_VALUE, "Maximum number of lines the dimension names tooltip can have before it wraps around."); + maxTooltipLines = c.tConfig.getInt( + "MaxToolTipLines", + "ALL", + 11, + 1, + Integer.MAX_VALUE, + "Maximum number of lines the dimension names tooltip can have before it wraps around."); c.save(); } @@ -48,5 +71,4 @@ public class GTNEIOrePlugin { } } } - } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java index da3947fee8..de36d22bc9 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java @@ -2,11 +2,10 @@ package pers.gwyog.gtneioreplugin.plugin; import codechicken.lib.gui.GuiDraw; import codechicken.nei.recipe.TemplateRecipeHandler; +import java.awt.*; import net.minecraft.client.resources.I18n; import net.minecraft.util.EnumChatFormatting; -import java.awt.*; - public abstract class PluginBase extends TemplateRecipeHandler { @Override @@ -27,7 +26,8 @@ public abstract class PluginBase extends TemplateRecipeHandler { @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())); + transferRects.add(new RecipeTransferRect( + new Rectangle(getGuiWidth() - stringLength - 3, 5, stringLength, 9), getOutputId())); } public abstract String getOutputId(); @@ -35,5 +35,4 @@ public abstract class PluginBase extends TemplateRecipeHandler { public int getGuiWidth() { return 166; } - } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java index f5bb8a618b..bdcccebe7a 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java @@ -1,27 +1,27 @@ package pers.gwyog.gtneioreplugin.plugin.gregtech5; +import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.toolTips; + import codechicken.lib.gui.GuiDraw; import codechicken.nei.guihook.GuiContainerManager; import codechicken.nei.recipe.GuiRecipe; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.util.GT_LanguageManager; +import java.awt.Point; +import java.awt.Rectangle; +import java.util.List; import net.minecraft.client.resources.I18n; import net.minecraft.util.EnumChatFormatting; import pers.gwyog.gtneioreplugin.plugin.PluginBase; import pers.gwyog.gtneioreplugin.util.DimensionHelper; import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper; -import java.awt.Point; -import java.awt.Rectangle; -import java.util.List; - -import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.toolTips; - public abstract class PluginGT5Base extends PluginBase { protected static String getLocalizedNameForItem(Materials aMaterial, String aFormat) { - return String.format(aFormat.replace("%s", "%temp").replace("%material", "%s"), aMaterial.mLocalizedName).replace("%temp", "%s"); + return String.format(aFormat.replace("%s", "%temp").replace("%material", "%s"), aMaterial.mLocalizedName) + .replace("%temp", "%s"); } protected static String getLocalizedNameForItem(String aFormat, int aMaterialID) { @@ -36,19 +36,24 @@ public abstract class PluginGT5Base extends PluginBase { public static String getGTOreLocalizedName(short index) { - if (!getLocalizedNameForItem(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)), index % 1000).contains("Awakened")) - return getLocalizedNameForItem(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)), index % 1000); - else - return "Aw. Draconium Ore"; + if (!getLocalizedNameForItem(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)), index % 1000) + .contains("Awakened")) + return getLocalizedNameForItem( + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)), index % 1000); + else return "Aw. Draconium Ore"; } protected static String getGTOreUnlocalizedName(short index) { return "gt.blockores." + index + ".name"; } + static void drawLine(String lineKey, String value, int x, int y) { + GuiDraw.drawString(I18n.format(lineKey) + ": " + value, x, y, 0x404040, false); + } + /** * Add lines to the current tooltip if appropriate - * + * * @param gui An instance of the currentscreen * @param currenttip The current tooltip, will contain item name and info * @param recipe The recipe index being handled @@ -58,9 +63,8 @@ public abstract class PluginGT5Base extends PluginBase { public List handleTooltip(GuiRecipe gui, List currenttip, int recipe) { if (toolTips && GuiContainerManager.shouldShowTooltip(gui) && currenttip.size() == 0) { String dimNames = getDimensionNames(recipe); - Rectangle dimRect = getDimensionNamesRect(gui, recipe , dimNames); + Rectangle dimRect = getDimensionNamesRect(gui, recipe, dimNames); Point mousePos = GuiDraw.getMousePosition(); - if (dimRect.contains(mousePos.x, mousePos.y)) { List dims = DimensionHelper.convertCondensedStringToToolTip(dimNames); @@ -73,42 +77,42 @@ public abstract class PluginGT5Base extends PluginBase { /** * The dimension names for a given recipe index - * - * @param The recipe index being handled + * + * @param recipe The recipe index being handled * @return A CSV string of dimension name abbreviations */ protected abstract String getDimensionNames(int recipe); /** * Produce a rectangle covering the area of displayed dimension names - * + * * @param gui An instance of the currentscreen * @param recipe The recipe index being handled * @param dimNames Dimension names to produce a rectangle for * @return Rectangle area of dimension names */ protected Rectangle getDimensionNamesRect(GuiRecipe gui, int recipe, String dimNames) { - int dimNamesHeight = dimNames.length() > 70 ? 30 : (dimNames.length() > 36 ? 20 : 10); + int dimNamesHeight = dimNames.length() > 70 ? 30 : (dimNames.length() > 36 ? 20 : 10); Point offset = gui.getRecipePosition(recipe); - return new Rectangle(GuiRecipeHelper.getGuiLeft(gui) + offset.x + 2, - GuiRecipeHelper.getGuiTop(gui) + offset.y + 110, - GuiRecipeHelper.getXSize(gui) - 9, - dimNamesHeight ); + return new Rectangle( + GuiRecipeHelper.getGuiLeft(gui) + offset.x + 2, + GuiRecipeHelper.getGuiTop(gui) + offset.y + 110, + GuiRecipeHelper.getXSize(gui) - 9, + dimNamesHeight); } protected 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; + 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; } /** * Draw the dimension header and the dimension names over up to 3 lines - * + * * @param dimNames A CSV string of dimension name abbreviations */ protected void drawDimNames(String dimNames) { @@ -118,12 +122,13 @@ public abstract class PluginGT5Base extends PluginBase { GuiDraw.drawString(I18n.format("") + dimNames.substring(0, 36), 2, 110, 0x404040, false); if (dimNames.length() > 70) { GuiDraw.drawString(I18n.format("") + dimNames.substring(36, 70), 2, 120, 0x404040, false); - GuiDraw.drawString(I18n.format("") + dimNames.substring(70, dimNames.length() - 1), 2, 130, 0x404040, false); - } else - { - GuiDraw.drawString(I18n.format("") + dimNames.substring(36, dimNames.length() - 1), 2, 120, 0x404040, false); + GuiDraw.drawString( + I18n.format("") + dimNames.substring(70, dimNames.length() - 1), 2, 130, 0x404040, false); + } else { + GuiDraw.drawString( + I18n.format("") + dimNames.substring(36, dimNames.length() - 1), 2, 120, 0x404040, false); } - } else{ + } else { GuiDraw.drawString(I18n.format("") + dimNames.substring(0, dimNames.length() - 1), 2, 110, 0x404040, false); } } @@ -132,6 +137,7 @@ public abstract class PluginGT5Base extends PluginBase { * Draw the "see all recipes" transfer label */ protected void drawSeeAllRecipesLabel() { - GuiDraw.drawStringR(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth() - 3, 5, 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/gregtech5/PluginGT5SmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java index 70346889e9..38f668f05e 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java @@ -1,37 +1,49 @@ package pers.gwyog.gtneioreplugin.plugin.gregtech5; -import codechicken.lib.gui.GuiDraw; import codechicken.nei.PositionedStack; -import gregtech.api.GregTech_API; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_OreDictUnificator; +import java.util.ArrayList; +import java.util.List; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper.OreSmallWrapper; -import java.util.ArrayList; -import java.util.List; - public class PluginGT5SmallOreStat extends PluginGT5Base { + private static final int SMALL_ORE_BASE_META = 16000; + @Override public void drawExtras(int recipe) { - CachedOreSmallRecipe crecipe = (CachedOreSmallRecipe) this.arecipes.get(recipe); - OreSmallWrapper oreSmall = GT5OreSmallHelper.mapOreSmallWrapper.get(crecipe.oreGenName); - String sDimNames = GT5OreSmallHelper.bufferedDims.get(oreSmall); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.oreName") + ": " + getGTOreLocalizedName((short) (oreSmall.oreMeta + 16000)), 2, 18, 0x404040, false); + OreSmallWrapper oreSmall = getSmallOre(recipe); - 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); - // 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.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 100, 0x404040, false); + drawSmallOreName(oreSmall); + drawSmallOreInfo(oreSmall); + String sDimNames = GT5OreSmallHelper.bufferedDims.get(oreSmall); drawDimNames(sDimNames); + drawSeeAllRecipesLabel(); } + private void drawSmallOreName(OreSmallWrapper oreSmall) { + String oreName = getGTOreLocalizedName((short) (oreSmall.oreMeta + SMALL_ORE_BASE_META)); + drawLine("gtnop.gui.nei.oreName", oreName, 2, 18); + } + + private void drawSmallOreInfo(OreSmallWrapper oreSmall) { + drawLine("gtnop.gui.nei.genHeight", oreSmall.worldGenHeightRange, 2, 31); + drawLine("gtnop.gui.nei.amount", String.valueOf(oreSmall.amountPerChunk), 2, 44); + drawLine("gtnop.gui.nei.chanceDrops", "", 2, 83 + getRestrictBiomeOffset()); + drawLine("gtnop.gui.nei.worldNames", "", 2, 100); + } + + private OreSmallWrapper getSmallOre(int recipe) { + CachedOreSmallRecipe crecipe = (CachedOreSmallRecipe) this.arecipes.get(recipe); + return GT5OreSmallHelper.mapOreSmallWrapper.get(crecipe.oreGenName); + } + public int getRestrictBiomeOffset() { return GT5OreSmallHelper.restrictBiomeSupport ? 0 : -13; } @@ -39,48 +51,51 @@ public class PluginGT5SmallOreStat extends PluginGT5Base { @Override public void loadCraftingRecipes(String outputId, Object... results) { if (outputId.equals(getOutputId())) - for (ItemStack stack : GT5OreSmallHelper.oreSmallList) - loadCraftingRecipes(stack); - else - super.loadCraftingRecipes(outputId, results); + for (ItemStack stack : GT5OreSmallHelper.oreSmallList) 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 (OreSmallWrapper oreSmallWorldGen : GT5OreSmallHelper.mapOreSmallWrapper.values()) { - if (oreSmallWorldGen.oreMeta == baseMeta) { - List stackList = new ArrayList(); - int maximumIndex = getMaximumMaterialIndex(baseMeta, true); - for (int i = 0; i < maximumIndex; i++) - stackList.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreSmallWorldGen.oreMeta + 16000 + i * 1000)); - List materialDustStackList = new ArrayList(); - for (int i = 0; i < maximumIndex; i++) - 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 (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 stackList = new ArrayList(); - for (int i = 0; i < 7; i++) - stackList.add(new ItemStack(GregTech_API.sBlockOres1, 1, baseMeta + 16000 + i * 1000)); - List materialDustStackList = new ArrayList(); - for (int i = 0; i < 7; i++) - 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))); - } + short oreMeta = (short) (stack.getItemDamage() % 1000); + loadSmallOre(oreMeta, getMaximumMaterialIndex(oreMeta, true)); + } else if (GT5OreSmallHelper.mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) { + short oreMeta = GT5OreSmallHelper.mapOreDropUnlocalizedNameToOreMeta.get(stack.getUnlocalizedName()); + loadSmallOre(oreMeta, 7); + } else super.loadCraftingRecipes(stack); + } + + private void loadSmallOre(short oreMeta, int maximumIndex) { + OreSmallWrapper smallOre = getSmallOre(oreMeta); + if (smallOre != null) { + addSmallOre(smallOre, maximumIndex); + } + } + + private OreSmallWrapper getSmallOre(short oreMeta) { + for (OreSmallWrapper oreSmallWorldGen : GT5OreSmallHelper.mapOreSmallWrapper.values()) { + if (oreSmallWorldGen.oreMeta == oreMeta) { + return oreSmallWorldGen; } - } else - super.loadCraftingRecipes(stack); + } + return null; + } + + private void addSmallOre(OreSmallWrapper smallOre, int maximumIndex) { + this.arecipes.add(new CachedOreSmallRecipe( + smallOre.oreGenName, + smallOre.getMaterialDrops(maximumIndex), + getStoneDusts(maximumIndex), + GT5OreSmallHelper.mapOreMetaToOreDrops.get(smallOre.oreMeta))); + } + + private List getStoneDusts(int maximumIndex) { + List materialDustStackList = new ArrayList<>(); + for (int i = 0; i < maximumIndex; i++) + materialDustStackList.add( + GT_OreDictUnificator.get(OrePrefixes.dust, GT5OreSmallHelper.getDroppedDusts()[i], 1L)); + return materialDustStackList; } @Override @@ -95,48 +110,52 @@ public class PluginGT5SmallOreStat extends PluginGT5Base { /** * The dimension names for a given recipe identifier - * + * * @param recipe identifier * @return A CSV string of dimension name abbreviations */ @Override - protected String getDimensionNames(int recipe) { - CachedOreSmallRecipe crecipe = (CachedOreSmallRecipe) this.arecipes.get(recipe); - OreSmallWrapper oreSmall = GT5OreSmallHelper.mapOreSmallWrapper.get(crecipe.oreGenName); + protected String getDimensionNames(int recipe) { + OreSmallWrapper oreSmall = getSmallOre(recipe); return GT5OreSmallHelper.bufferedDims.get(oreSmall); } - + public class CachedOreSmallRecipe extends CachedRecipe { public String oreGenName; public PositionedStack positionedStackOreSmall; public PositionedStack positionedStackMaterialDust; public List positionedDropStackList; - public CachedOreSmallRecipe(String oreGenName, List stackList, List materialDustStackList, List dropStackList) { + public CachedOreSmallRecipe( + String oreGenName, + List stackList, + List materialDustStackList, + List dropStackList) { this.oreGenName = oreGenName; this.positionedStackOreSmall = new PositionedStack(stackList, 2, 0); - this.positionedStackMaterialDust = new PositionedStack(materialDustStackList, 43, 79 + getRestrictBiomeOffset()); - List positionedDropStackList = new ArrayList(); + this.positionedStackMaterialDust = + new PositionedStack(materialDustStackList, 43, 79 + getRestrictBiomeOffset()); + List positionedDropStackList = new ArrayList<>(); int i = 1; for (ItemStack stackDrop : dropStackList) - positionedDropStackList.add(new PositionedStack(stackDrop, 43 + 20 * (i % 4), 79 + 16 * ((i++) / 4) + getRestrictBiomeOffset())); + positionedDropStackList.add(new PositionedStack( + stackDrop, 43 + 20 * (i % 4), 79 + 16 * ((i++) / 4) + getRestrictBiomeOffset())); this.positionedDropStackList = positionedDropStackList; } @Override public List getIngredients() { positionedStackOreSmall.setPermutationToRender((cycleticks / 20) % positionedStackOreSmall.items.length); - positionedStackMaterialDust.setPermutationToRender((cycleticks / 20) % positionedStackMaterialDust.items.length); + positionedStackMaterialDust.setPermutationToRender( + (cycleticks / 20) % positionedStackMaterialDust.items.length); positionedDropStackList.add(positionedStackOreSmall); positionedDropStackList.add(positionedStackMaterialDust); return positionedDropStackList; - } @Override public PositionedStack getResult() { return null; } - } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java index 8f8a01ef0a..dc559db34a 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -1,202 +1,104 @@ package pers.gwyog.gtneioreplugin.plugin.gregtech5; -import codechicken.lib.gui.GuiDraw; +import static pers.gwyog.gtneioreplugin.util.OreVeinLayer.*; + import codechicken.nei.PositionedStack; import cpw.mods.fml.common.Loader; -import gregtech.api.GregTech_API; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - public class PluginGT5VeinStat extends PluginGT5Base { - // Unused - public static String[] getLocalizedVeinName(OreLayerWrapper oreLayer) { - String unlocalizedName = oreLayer.veinName; - if (unlocalizedName.startsWith("ore.mix.custom.")) - return get_Cnames(oreLayer);//I18n.format("gtnop.ore.custom.name") + I18n.format("gtnop.ore.vein.name") + unlocalizedName.substring(15); - else - return new String[]{I18n.format("gtnop." + unlocalizedName) + I18n.format("gtnop.ore.vein.name")}; - } - - // Unused - public static String coustomVeinRenamer(OreLayerWrapper oreLayer) { - Set s = new HashSet(); - for (int i = 0; i < 4; i++) - s.add(getGTOreLocalizedName(oreLayer.Meta[i]).replaceAll(" ", "")); - return s.toString() - .replace("[".charAt(0), ",".charAt(0)) - .replace("]".charAt(0), ",".charAt(0)) - .replaceAll(" Ore", ",") - .replaceAll("Ore", ",") - .replaceAll(" Sand", ",") - .replaceAll("Sand", ",") - .replaceAll("Stone", ",") - .replaceAll(" Stone", ",") - .replaceAll("Earth", ",") - .replaceAll(" Earth", ",") - .replaceAll("Infused", ",") - .replaceAll(" Infused", ",") - .replaceAll(",", "") - .trim(); - } - - /*public String getWeightedChance(OreLayerWrapper oreLayer) { - String weightedChance = ""; - for (int i=0; i < oreLayer.alloweddims.size(); i++) { - if (oreLayer.alloweddims.get(i) && (oreLayer.Weight.get(i) != 0)) { - if (!weightedChance.isEmpty()) - weightedChance += ", "; - weightedChance += String.format("%.2f%%", (100.0f*oreLayer.Weight.get(i))/GT5OreLayerHelper.weightPerWorld[i]); - } - } - return weightedChance; - }*/ - - // Unused - public static String[] get_Cnames(OreLayerWrapper oreLayer) { - - String[] splt = coustomVeinRenamer(oreLayer).split("\\s"); - /*HashSet h = new HashSet(); - for (int i=0; i < splt.length;i++) { - h.add(splt[i]); - } - h.toArray(splt);*/ - - String[] ret = {oreLayer.veinName.replace("ore.mix.custom.", "") + " ", " ", " "}; - for (int i = 0; i < ret.length; i++) { - ret[i] = ret[i].trim(); - } - for (int i = 0; i < splt.length; i++) { - //FMLLog.info("Split:"+splt[i]); - //FMLLog.info("I:"+Integer.toString(i)); - if (ret[0].length() + splt[i].length() <= 20) - ret[0] = ret[0] + splt[i] + " "; - if ((ret[0].length() + splt[i].length() > 20) && ret[1].length() + splt[i].length() <= 70 && !ret[0].contains(splt[i])) - ret[1] = ret[1] + splt[i] + " "; - if ((ret[0].length() + splt[i].length() > 20) && (ret[1].length() + splt[i].length() > 70) && ret[2].length() + splt[i].length() <= 70 && !ret[1].contains(splt[i])) - ret[2] = ret[2] + splt[i] + " "; - } - for (int i = 0; i < ret.length; i++) { - ret[i] = ret[i].trim(); - } - - if (ret[2].isEmpty() && !ret[1].isEmpty()) - if (ret[1].length() <= 65) - ret[1] = ret[1] + " Vein"; - else - ret[2] = ret[2] + "Vein"; - else if (ret[1].isEmpty() && ret[2].isEmpty() && !ret[0].isEmpty()) - if (ret[0].length() <= 15) - ret[0] = ret[0] + " Vein"; - else - ret[1] = ret[1] + "Vein"; - else if (!(ret[1].isEmpty() && ret[2].isEmpty())) - ret[2] = ret[2] + "Vein"; - String[] ret2 = new String[2]; - if (ret[2].isEmpty() && !ret[1].isEmpty()) { - ret2[0] = ret[0]; - ret2[1] = ret[1]; - return ret2; - } - String[] ret1 = new String[1]; - if (ret[1].isEmpty() && ret[2].isEmpty() && !ret[0].isEmpty()) { - ret1[0] = ret[0]; - return ret1; - } else - return ret; - } - @Override public void loadCraftingRecipes(String outputId, Object... results) { if (outputId.equals(getOutputId())) { - OreLayerWrapper oreLayerWrapper; - for (String veinName : GT5OreLayerHelper.mapOreLayerWrapper.keySet()) { - oreLayerWrapper = GT5OreLayerHelper.mapOreLayerWrapper.get(veinName); - List stackListPrimary = new ArrayList(); - List stackListSecondary = new ArrayList(); - List stackListBetween = new ArrayList(); - List stackListSporadic = new ArrayList(); - for (int i = 0; i < 7; i++) { - stackListPrimary.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[0] + i * 1000)); - stackListSecondary.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[1] + i * 1000)); - stackListBetween.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[2] + i * 1000)); - stackListSporadic.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreLayerWrapper.Meta[3] + i * 1000)); - } - this.arecipes.add(new CachedVeinStatRecipe(veinName, stackListPrimary, stackListSecondary, stackListBetween, stackListSporadic)); + for (OreLayerWrapper oreVein : getAllVeins()) { + addVeinWithLayers(oreVein, 7); } - } else - super.loadCraftingRecipes(outputId, results); + } 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 : GT5OreLayerHelper.mapOreLayerWrapper.values()) { - if (worldGen.Meta[0] == baseMeta || worldGen.Meta[1] == baseMeta || worldGen.Meta[2] == baseMeta || worldGen.Meta[3] == baseMeta) { - List stackListPrimary = new ArrayList(); - List stackListSecondary = new ArrayList(); - List stackListBetween = new ArrayList(); - List stackListSporadic = new ArrayList(); - for (int i = 0; i < getMaximumMaterialIndex(baseMeta, false); i++) { - stackListPrimary.add(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[0] + i * 1000)); - stackListSecondary.add(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[1] + i * 1000)); - stackListBetween.add(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[2] + i * 1000)); - stackListSporadic.add(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.Meta[3] + i * 1000)); - } - this.arecipes.add(new CachedVeinStatRecipe(worldGen.veinName, stackListPrimary, stackListSecondary, stackListBetween, stackListSporadic)); - } + loadMatchingVeins((short) (stack.getItemDamage() % 1000)); + } else super.loadCraftingRecipes(stack); + } + + private void loadMatchingVeins(short oreId) { + for (OreLayerWrapper oreVein : getAllVeins()) { + if (oreVein.containsOre(oreId)) { + addVeinWithLayers(oreVein, getMaximumMaterialIndex(oreId, false)); } - } else - super.loadCraftingRecipes(stack); + } + } + + private void addVeinWithLayers(OreLayerWrapper oreVein, int maximumMaterialIndex) { + this.arecipes.add(new CachedVeinStatRecipe( + oreVein.veinName, + oreVein.getVeinLayerOre(maximumMaterialIndex, VEIN_PRIMARY), + oreVein.getVeinLayerOre(maximumMaterialIndex, VEIN_SECONDARY), + oreVein.getVeinLayerOre(maximumMaterialIndex, VEIN_BETWEEN), + oreVein.getVeinLayerOre(maximumMaterialIndex, VEIN_SPORADIC))); + } + + private Collection getAllVeins() { + return GT5OreLayerHelper.mapOreLayerWrapper.values(); } @Override public void drawExtras(int recipe) { - CachedVeinStatRecipe crecipe = (CachedVeinStatRecipe) this.arecipes.get(recipe); - OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); + OreLayerWrapper oreLayer = getOreLayer(recipe); - String sDimNames = GT5OreLayerHelper.bufferedDims.get(oreLayer); + drawVeinName(oreLayer); + drawVeinLayerNames(oreLayer); + drawVeinInfo(oreLayer); - if(Loader.isModLoaded("visualprospecting")) { - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + I18n.format(oreLayer.veinName) + " " + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); - } - else { - if (getGTOreLocalizedName(oreLayer.Meta[0]).contains("Ore")) - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]).split("Ore")[0] + "" + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); - else if (getGTOreLocalizedName(oreLayer.Meta[0]).contains("Sand")) - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]).split("Sand")[0] + "" + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); - else - GuiDraw.drawString(I18n.format("gtnop.gui.nei.veinName") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]) + " " + I18n.format("gtnop.gui.nei.vein"), 2, 20, 0x404040, false); - } - - GuiDraw.drawString(I18n.format("gtnop.gui.nei.primaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[0]), 2, 50, 0x404040, false); + String sDimNames = GT5OreLayerHelper.bufferedDims.get(oreLayer); + drawDimNames(sDimNames); - GuiDraw.drawString(I18n.format("gtnop.gui.nei.secondaryOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[1]), 2, 60, 0x404040, false); + drawSeeAllRecipesLabel(); + } - GuiDraw.drawString(I18n.format("gtnop.gui.nei.betweenOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[2]), 2, 70, 0x404040, false); + private OreLayerWrapper getOreLayer(int recipe) { + CachedVeinStatRecipe crecipe = (CachedVeinStatRecipe) this.arecipes.get(recipe); + return GT5OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); + } - GuiDraw.drawString(I18n.format("gtnop.gui.nei.sporadicOre") + ": " + getGTOreLocalizedName(oreLayer.Meta[3]), 2, 80, 0x404040, false); + private static void drawVeinName(OreLayerWrapper oreLayer) { + if (Loader.isModLoaded("visualprospecting")) { + drawVeinNameLine(I18n.format(oreLayer.veinName) + " "); + } else { + String veinName = getGTOreLocalizedName(oreLayer.Meta[VEIN_PRIMARY]); + if (veinName.contains("Ore")) drawVeinNameLine(veinName.split("Ore")[0]); + else if (veinName.contains("Sand")) drawVeinNameLine(veinName.split("Sand")[0]); + else drawVeinNameLine(veinName + " "); + } + } - GuiDraw.drawString(I18n.format("gtnop.gui.nei.genHeight") + ": " + oreLayer.worldGenHeightRange, 2, 90, 0x404040, false); + private static void drawVeinNameLine(String veinName) { + drawLine("gtnop.gui.nei.veinName", veinName + I18n.format("gtnop.gui" + ".nei.vein"), 2, 20); + } - GuiDraw.drawString(I18n.format("gtnop.gui.nei.weightedChance") + ": " + Integer.toString(oreLayer.randomWeight), 100, 90, 0x404040, false); + private static void drawVeinLayerNames(OreLayerWrapper oreLayer) { + drawVeinLayerNameLine(oreLayer, VEIN_PRIMARY, 50); + drawVeinLayerNameLine(oreLayer, VEIN_SECONDARY, 60); + drawVeinLayerNameLine(oreLayer, VEIN_BETWEEN, 70); + drawVeinLayerNameLine(oreLayer, VEIN_SPORADIC, 80); + } - drawDimNames(sDimNames); + private static void drawVeinLayerNameLine(OreLayerWrapper oreLayer, int veinLayer, int height) { + drawLine(getOreVeinLayerName(veinLayer), getGTOreLocalizedName(oreLayer.Meta[veinLayer]), 2, height); + } - //if (GT5OreLayerHelper.restrictBiomeSupport) GuiDraw.drawString(I18n.format("gtnop.gui.nei.restrictBiome") + ": " + getBiomeTranslated(oreLayer.restrictBiome), 2, 122, 0x404040, false); - drawSeeAllRecipesLabel(); + private static void drawVeinInfo(OreLayerWrapper oreLayer) { + drawLine("gtnop.gui.nei.genHeight", oreLayer.worldGenHeightRange, 2, 90); + drawLine("gtnop.gui.nei.weightedChance", Integer.toString(oreLayer.randomWeight), 100, 90); } @Override @@ -208,17 +110,16 @@ public class PluginGT5VeinStat extends PluginGT5Base { public String getRecipeName() { return I18n.format("gtnop.gui.veinStat.name"); } - + /** * The dimension names for a given recipe identifier - * + * * @param recipe identifier * @return A CSV string of dimension name abbreviations */ @Override - protected String getDimensionNames(int recipe) { - CachedVeinStatRecipe crecipe = (CachedVeinStatRecipe) this.arecipes.get(recipe); - OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(crecipe.veinName); + protected String getDimensionNames(int recipe) { + OreLayerWrapper oreLayer = getOreLayer(recipe); return GT5OreLayerHelper.bufferedDims.get(oreLayer); } @@ -229,8 +130,12 @@ public class PluginGT5VeinStat extends PluginGT5Base { public PositionedStack positionedStackBetween; public PositionedStack positionedStackSporadic; - public CachedVeinStatRecipe(String veinName, List stackListPrimary, List stackListSecondary, - List stackListBetween, List stackListSporadic) { + public CachedVeinStatRecipe( + String veinName, + List stackListPrimary, + List stackListSecondary, + List stackListBetween, + List stackListSporadic) { this.veinName = veinName; positionedStackPrimary = new PositionedStack(stackListPrimary, 2, 0); positionedStackSecondary = new PositionedStack(stackListSecondary, 22, 0); @@ -240,15 +145,11 @@ public class PluginGT5VeinStat extends PluginGT5Base { @Override public List getIngredients() { - List ingredientsList = new ArrayList(); + List ingredientsList = new ArrayList<>(); 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); @@ -260,7 +161,5 @@ public class PluginGT5VeinStat extends PluginGT5Base { public PositionedStack getResult() { return null; } - } - } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java b/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java index f12405a7ae..24cc1dd023 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java @@ -4,10 +4,6 @@ import com.opencsv.CSVWriter; import com.opencsv.bean.ColumnPositionMappingStrategy; import com.opencsv.bean.StatefulBeanToCsv; import com.opencsv.bean.StatefulBeanToCsvBuilder; -import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; -import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat; -import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; - import java.io.BufferedWriter; import java.nio.file.Files; import java.nio.file.Paths; @@ -15,12 +11,13 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; +import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; +import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat; +import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; public class CSVMaker implements Runnable { - public CSVMaker() { - - } + public CSVMaker() {} public static List Combsort(List liste) { try { @@ -37,7 +34,13 @@ public class CSVMaker implements Runnable { schritt = (int) (schritt / 1.3); } for (int i = 0; i < liste2.size() - schritt; i++) { - if (liste2.get(i).getOreName().substring(0, 3).compareTo((liste2.get(i + schritt).getOreName().substring(0, 3))) > 0) { + if (liste2.get(i) + .getOreName() + .substring(0, 3) + .compareTo((liste2.get(i + schritt) + .getOreName() + .substring(0, 3))) + > 0) { Oremix tmp = (Oremix) liste2.get(i); liste2.set(i, liste2.get(i + schritt)); liste2.set(i + schritt, (Oremix) tmp); @@ -107,14 +110,17 @@ public class CSVMaker implements Runnable { BufferedWriter one = Files.newBufferedWriter(Paths.get(GTNEIOrePlugin.CSVnameSmall)); ColumnPositionMappingStrategy strat = new ColumnPositionMappingStrategy(); strat.setType(Oremix.class); - String[] columns = "ORENAME,mix,DENSITY,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie".split("\\,"); + String[] columns = + "ORENAME,mix,DENSITY,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie" + .split("\\,"); strat.setColumnMapping(columns); StatefulBeanToCsv beanToCsv = new StatefulBeanToCsvBuilder(one) .withQuotechar(CSVWriter.NO_QUOTE_CHARACTER) .withMappingStrategy(strat) .build(); List towrite = Combsort(OreVeins); - one.write("Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E"); + one.write( + "Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E"); one.newLine(); beanToCsv.write(towrite); one.flush(); @@ -149,7 +155,8 @@ public class CSVMaker implements Runnable { oremix.setHeight(oreLayer.worldGenHeightRange); oremix.setDensity(oreLayer.density); oremix.setWeight(oreLayer.randomWeight); - oremix.setMix(Integer.toString(oreLayer.Meta[0]) + "|" + Integer.toString(oreLayer.Meta[1]) + "|" + Integer.toString(oreLayer.Meta[2]) + "|" + Integer.toString(oreLayer.Meta[3])); + oremix.setMix(Integer.toString(oreLayer.Meta[0]) + "|" + Integer.toString(oreLayer.Meta[1]) + "|" + + Integer.toString(oreLayer.Meta[2]) + "|" + Integer.toString(oreLayer.Meta[3])); oremix.as = Dims.contains("As"); oremix.bc = Dims.contains("BC"); oremix.be = Dims.contains("BE"); @@ -186,21 +193,23 @@ public class CSVMaker implements Runnable { oremix.setEnd(Dims.contains("EN")); OreVeins.add(oremix); - System.out.println(pair.getKey() + " = " + pair.getValue()); it.remove(); // avoids a ConcurrentModificationException } BufferedWriter one = Files.newBufferedWriter(Paths.get(GTNEIOrePlugin.CSVname)); ColumnPositionMappingStrategy strat = new ColumnPositionMappingStrategy(); strat.setType(Oremix.class); - String[] columns = "ORENAME,PRIMARY,SECONDARY,INBETWEEN,AROUND,mix,TIER,HEIGHT,DENSITY,SIZE,WEIGHT,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie".split("\\,"); + String[] columns = + "ORENAME,PRIMARY,SECONDARY,INBETWEEN,AROUND,mix,TIER,HEIGHT,DENSITY,SIZE,WEIGHT,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie" + .split("\\,"); strat.setColumnMapping(columns); StatefulBeanToCsv beanToCsv = new StatefulBeanToCsvBuilder(one) .withQuotechar(CSVWriter.NO_QUOTE_CHARACTER) .withMappingStrategy(strat) .build(); List towrite = Combsort(OreVeins); - one.write("Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E"); + one.write( + "Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E"); one.newLine(); beanToCsv.write(towrite); one.flush(); @@ -209,5 +218,4 @@ public class CSVMaker implements Runnable { e.printStackTrace(); } } - } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java index fb422ed074..16be409b61 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -1,111 +1,111 @@ package pers.gwyog.gtneioreplugin.util; +import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.maxTooltipLines; + import java.util.Arrays; import java.util.HashMap; import java.util.List; import net.minecraft.client.resources.I18n; -import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.maxTooltipLines; - public class DimensionHelper { - public static String[] DimName = - { - // Non GC dimensions in progression order instead of alphabetical - "Overworld", - "Nether", - "Twilight", - "TheEnd", - "Vanilla_EndAsteroids", - "EndAsteroid", - // T1 - "GalacticraftCore_Moon", - // T2 - "GalaxySpace_Deimos", - "GalacticraftMars_Mars", - "GalaxySpace_Phobos", - // T3 - "GalacticraftMars_Asteroids", - "GalaxySpace_Callisto", - "GalaxySpace_Ceres", - "GalaxySpace_Europa", - "GalaxySpace_Ganymede", - // T4 - "GalaxySpace_Io", - "GalaxySpace_Mercury", - "GalaxySpace_Venus", - // T5 - "GalaxySpace_Enceladus", - "GalaxySpace_Miranda", - "GalaxySpace_Oberon", - "GalaxySpace_Titan", - // T6 - "GalaxySpace_Proteus", - "GalaxySpace_Triton", - // T7 - "GalaxySpace_Haumea", - "GalaxySpace_Kuiperbelt", - "GalaxySpace_MakeMake", - "GalaxySpace_Pluto", - // T8 - "GalaxySpace_BarnardC", - "GalaxySpace_BarnardE", - "GalaxySpace_BarnardF", - "GalaxySpace_CentauriA", - "GalaxySpace_TcetiE", - "Underdark", - "GalaxySpace_VegaB", - }; + public static String[] DimName = { + // Non GC dimensions in progression order instead of alphabetical + "Overworld", + "Nether", + "Twilight", + "TheEnd", + "Vanilla_EndAsteroids", + "EndAsteroid", + // T1 + "GalacticraftCore_Moon", + // T2 + "GalaxySpace_Deimos", + "GalacticraftMars_Mars", + "GalaxySpace_Phobos", + // T3 + "GalacticraftMars_Asteroids", + "GalaxySpace_Callisto", + "GalaxySpace_Ceres", + "GalaxySpace_Europa", + "GalaxySpace_Ganymede", + // T4 + "GalaxySpace_Io", + "GalaxySpace_Mercury", + "GalaxySpace_Venus", + // T5 + "GalaxySpace_Enceladus", + "GalaxySpace_Miranda", + "GalaxySpace_Oberon", + "GalaxySpace_Titan", + // T6 + "GalaxySpace_Proteus", + "GalaxySpace_Triton", + // T7 + "GalaxySpace_Haumea", + "GalaxySpace_Kuiperbelt", + "GalaxySpace_MakeMake", + "GalaxySpace_Pluto", + // T8 + "GalaxySpace_BarnardC", + "GalaxySpace_BarnardE", + "GalaxySpace_BarnardF", + "GalaxySpace_CentauriA", + "GalaxySpace_TcetiE", + "Underdark", + "GalaxySpace_VegaB", + }; - public static String[] DimNameDisplayed = - {// first 2 letters if one word else 1 letter of every word, except capital letter in name, then 1rst + capital Moon = Mo, BarnardC = BC, EndAsteroid = EA - // Non GC dimensions in progression order instead of alphabetical - "Ow", // Overworld - "Ne", // Nether - "TF", // Twilight - "EN", // TheEnd because En = Encalus - "VA", // Vanilla_EndAsteroids - "EA", // EndAsteroid - // T1 - "Mo", // GalacticraftCore_Moon - // T2 - "De", // GalaxySpace_Deimos - "Ma", // GalacticraftMars_Mars - "Ph", // GalaxySpace_Phobos - // T3 - "As", // GalacticraftMars_Asteroids - "Ca", // GalaxySpace_Callisto - "Ce", // GalaxySpace_Ceres - "Eu", // GalaxySpace_Europa - "Ga", // GalaxySpace_Ganymede - // T4 - "Io", // GalaxySpace_Io - "Me", // GalaxySpace_Mercury - "Ve", // GalaxySpace_Venus - // T5 - "En", // GalaxySpace_Enceladus - "Mi", // GalaxySpace_Miranda - "Ob", // GalaxySpace_Oberon - "Ti", // GalaxySpace_Titan - // T6 - "Pr", // GalaxySpace_Proteus - "Tr", // GalaxySpace_Triton - // T7 - "Ha", // GalaxySpace_Haumea - "KB", // GalaxySpace_Kuiperbelt - "MM", // GalaxySpace_MakeMake - "Pl", // GalaxySpace_Pluto - // T8 - "BC", // GalaxySpace_BarnardC - "BE", // GalaxySpace_BarnardE - "BF", // GalaxySpace_BarnardF - "CB", // GalaxySpace_CentauriA is actually αCentauri Bb - "TE", // GalaxySpace_TcetiE - "DD", // Underdark - "VB", // GalaxySpace_VegaB - }; + public static String[] + DimNameDisplayed = { // first 2 letters if one word else 1 letter of every word, except capital letter in + // name, then 1rst + capital Moon = Mo, BarnardC = BC, EndAsteroid = EA + // Non GC dimensions in progression order instead of alphabetical + "Ow", // Overworld + "Ne", // Nether + "TF", // Twilight + "EN", // TheEnd because En = Encalus + "VA", // Vanilla_EndAsteroids + "EA", // EndAsteroid + // T1 + "Mo", // GalacticraftCore_Moon + // T2 + "De", // GalaxySpace_Deimos + "Ma", // GalacticraftMars_Mars + "Ph", // GalaxySpace_Phobos + // T3 + "As", // GalacticraftMars_Asteroids + "Ca", // GalaxySpace_Callisto + "Ce", // GalaxySpace_Ceres + "Eu", // GalaxySpace_Europa + "Ga", // GalaxySpace_Ganymede + // T4 + "Io", // GalaxySpace_Io + "Me", // GalaxySpace_Mercury + "Ve", // GalaxySpace_Venus + // T5 + "En", // GalaxySpace_Enceladus + "Mi", // GalaxySpace_Miranda + "Ob", // GalaxySpace_Oberon + "Ti", // GalaxySpace_Titan + // T6 + "Pr", // GalaxySpace_Proteus + "Tr", // GalaxySpace_Triton + // T7 + "Ha", // GalaxySpace_Haumea + "KB", // GalaxySpace_Kuiperbelt + "MM", // GalaxySpace_MakeMake + "Pl", // GalaxySpace_Pluto + // T8 + "BC", // GalaxySpace_BarnardC + "BE", // GalaxySpace_BarnardE + "BF", // GalaxySpace_BarnardF + "CB", // GalaxySpace_CentauriA is actually αCentauri Bb + "TE", // GalaxySpace_TcetiE + "DD", // Underdark + "VB", // GalaxySpace_VegaB + }; - private static HashMap> tooltipBuffer = new HashMap<>(); + private static final HashMap> tooltipBuffer = new HashMap<>(); private static List computeString(String line) { String[] dims = line.split(","); @@ -115,7 +115,11 @@ public class DimensionHelper { s = s.trim(); for (int i = 0; i < DimNameDisplayed.length; i++) { if (s.equals(DimNameDisplayed[i])) { - String k = DimName[i].replaceAll("GalacticraftCore_", "").replaceAll("GalacticraftMars_", "").replaceAll("GalaxySpace_", "").replaceAll("Vanilla_", "Vanilla "); + String k = DimName[i] + .replaceAll("GalacticraftCore_", "") + .replaceAll("GalacticraftMars_", "") + .replaceAll("GalaxySpace_", "") + .replaceAll("Vanilla_", "Vanilla "); s = I18n.format("gtnop.world." + k); switch (k) { case "Moon": @@ -170,9 +174,9 @@ public class DimensionHelper { } } - if (dims.length > maxTooltipLines ) { + if (dims.length > maxTooltipLines) { dims = StringPaddingHack.stringsToSpacedColumns( - dims, dims.length / maxTooltipLines + (dims.length % maxTooltipLines == 0 ? 0 : 1) , 2); + dims, dims.length / maxTooltipLines + (dims.length % maxTooltipLines == 0 ? 0 : 1), 2); } return Arrays.asList(dims); @@ -181,4 +185,4 @@ public class DimensionHelper { public static List convertCondensedStringToToolTip(String line) { return tooltipBuffer.computeIfAbsent(line, (String tmp) -> computeString(line)); } -} \ No newline at end of file +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java index 94b826808f..1a62c31ec1 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java @@ -2,11 +2,6 @@ package pers.gwyog.gtneioreplugin.util; import cpw.mods.fml.common.FMLLog; import gregtech.api.GregTech_API; -import net.minecraftforge.common.config.ConfigCategory; -import net.minecraftforge.common.config.Configuration; -import net.minecraftforge.common.config.Property; -import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; - import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -14,7 +9,10 @@ import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; import java.util.List; - +import net.minecraftforge.common.config.ConfigCategory; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.config.Property; +import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; public class GT5CFGHelper { @@ -34,8 +32,7 @@ public class GT5CFGHelper { if (!raw.isEmpty()) for (int i = 0; i < raw.size(); i++) { for (int j = 0; j < DimensionHelper.DimName.length; j++) - if (raw.get(i).contains(DimensionHelper.DimName[j])) - rawbools.add(raw.get(i)); + if (raw.get(i).contains(DimensionHelper.DimName[j])) rawbools.add(raw.get(i)); } else GTNEIOrePlugin.LOG.info("Config entry not found for Vein: " + Veinname); @@ -44,7 +41,12 @@ public class GT5CFGHelper { HashSet rawboolsset = new HashSet(); if (!rawbools.isEmpty()) { for (int i = 0; i < rawbools.size(); i++) { - st = rawbools.get(i).replace("B:", "").replace("_true", "").replace("_false", "").replaceAll(" ", "").replaceAll("\"", ""); + st = rawbools.get(i) + .replace("B:", "") + .replace("_true", "") + .replace("_false", "") + .replaceAll(" ", "") + .replaceAll("\"", ""); rawboolsset.add(st); } rawbools = new ArrayList(rawboolsset); @@ -52,33 +54,30 @@ public class GT5CFGHelper { for (int i = 0; i < rawbools.size(); i++) { st = rawbools.get(i); if (st.contains(DimensionHelper.DimName[j])) - if (st.contains("=true")) - ret = (ret + DimensionHelper.DimNameDisplayed[j] + ","); + if (st.contains("=true")) ret = (ret + DimensionHelper.DimNameDisplayed[j] + ","); } } } ret = ret.trim(); - if (ret.equals("") || ret.equals(" ")) - ret = "Not available in any Galactic Dim!"; + if (ret.equals("") || ret.equals(" ")) ret = "Not available in any Galactic Dim!"; return ret; } public static String GT5CFG(String Veinname) { - //FMLLog.info(Veinname); + // FMLLog.info(Veinname); if (F == null) { FMLLog.bigWarning("GT_CFG_NOT_found[0]"); return "Error while Loading CFG"; } else try { int buffer = (int) (0.1 * Runtime.getRuntime().freeMemory()); - if (buffer > F.length()) - buffer = (int) F.length(); - //allocate 10% of free memory for read-in-buffer, if there is less than filesize memory available - //FMLLog.info("GT_CFG_found[0]"); + if (buffer > F.length()) buffer = (int) F.length(); + // allocate 10% of free memory for read-in-buffer, if there is less than filesize memory available + // FMLLog.info("GT_CFG_found[0]"); FileReader in = new FileReader(F); - //FMLLog.info("FileReader created"); + // FMLLog.info("FileReader created"); BufferedReader reader = new BufferedReader(in, buffer); - //FMLLog.info("BufferedReader" +Integer.toString(buffer)+"created"); + // FMLLog.info("BufferedReader" +Integer.toString(buffer)+"created"); String st = null; List raw = new ArrayList(); List rawbools = new ArrayList(); @@ -87,24 +86,23 @@ public class GT5CFGHelper { found[1] = false; do { - //FMLLog.info("erste"); - //read until reached eof or mix { + // FMLLog.info("erste"); + // read until reached eof or mix { st = reader.readLine(); - //FMLLog.info("st: "+st); + // FMLLog.info("st: "+st); if (st != null && st.trim().equals("mix {")) { while (!((st == null) || ((st != null) && found[0]))) { - //FMLLog.info("zweite"); + // FMLLog.info("zweite"); st = reader.readLine(); - //read until reached eof or Veinname { - //FMLLog.info("MIXst: "+st); + // read until reached eof or Veinname { + // FMLLog.info("MIXst: "+st); if (st != null && st.trim().equals(Veinname + " {")) { - //FMLLog.info("VEINNAMEst: "+st); + // FMLLog.info("VEINNAMEst: "+st); while (!((st == null) || ((st != null) && found[0]))) { st = reader.readLine(); - if ((!(st == null)) && st.trim().equals("}")) - found[0] = true; - //FMLLog.info("dritte"); - //add everything below Veinname { undtil } to raw + if ((!(st == null)) && st.trim().equals("}")) found[0] = true; + // FMLLog.info("dritte"); + // add everything below Veinname { undtil } to raw raw.add(st); } } @@ -113,22 +111,21 @@ public class GT5CFGHelper { if (st != null && st.trim().equals("dimensions {")) { while (!((st == null) || ((st != null) && found[1]))) { - //FMLLog.info("zweite"); + // FMLLog.info("zweite"); st = reader.readLine(); if (st != null && (st.trim().equals("mix {"))) { while (!((st == null) || ((st != null) && found[1]))) { - //FMLLog.info("dritte"); + // FMLLog.info("dritte"); st = reader.readLine(); - //read until reached eof or Veinname { - //FMLLog.info("MIXst: "+st); + // read until reached eof or Veinname { + // FMLLog.info("MIXst: "+st); if (st != null && st.trim().equals(Veinname + " {")) { - //FMLLog.info("VEINNAMEst: "+st); + // FMLLog.info("VEINNAMEst: "+st); while (!((st == null) || ((st != null) && found[1]))) { st = reader.readLine(); - if ((!(st == null)) && st.trim().equals("}")) - found[1] = true; - //FMLLog.info("vierte"); - //add everything below Veinname { undtil } to raw + if ((!(st == null)) && st.trim().equals("}")) found[1] = true; + // FMLLog.info("vierte"); + // add everything below Veinname { undtil } to raw raw.add(st); } } @@ -137,16 +134,15 @@ public class GT5CFGHelper { } } } while (st != null); - reader.close();//not needed anymore + reader.close(); // not needed anymore if (!raw.isEmpty()) for (int i = 0; i < raw.size(); i++) { - //filter needed booleans from raw - ///FMLLog.info("raw contains"+raw.get(i)); + // filter needed booleans from raw + /// FMLLog.info("raw contains"+raw.get(i)); for (int j = 0; j < DimensionHelper.DimName.length; j++) - if (raw.get(i).contains(DimensionHelper.DimName[j])) - rawbools.add(raw.get(i)); - //FMLLog.info("rawbools: "+rawbools.get(i)); + if (raw.get(i).contains(DimensionHelper.DimName[j])) rawbools.add(raw.get(i)); + // FMLLog.info("rawbools: "+rawbools.get(i)); } else GTNEIOrePlugin.LOG.info("Config entry not found for Vein: " + Veinname); @@ -154,27 +150,30 @@ public class GT5CFGHelper { HashSet rawboolsset = new HashSet(); if (!rawbools.isEmpty()) { - //remove dublicates + // remove dublicates for (int i = 0; i < rawbools.size(); i++) { - st = rawbools.get(i).replace("B:", "").replace("_true", "").replace("_false", "").replaceAll(" ", "").replaceAll("\"", ""); + st = rawbools.get(i) + .replace("B:", "") + .replace("_true", "") + .replace("_false", "") + .replaceAll(" ", "") + .replaceAll("\"", ""); rawboolsset.add(st); } rawbools = new ArrayList(rawboolsset); - //filter for dims set to true + // filter for dims set to true for (int j = 0; j < DimensionHelper.DimName.length; j++) { - //FMLLog.info("RawBools:"+st); + // FMLLog.info("RawBools:"+st); for (int i = 0; i < rawbools.size(); i++) { st = rawbools.get(i); if (st.contains(DimensionHelper.DimName[j])) - if (st.contains("=true")) - ret = (ret + DimensionHelper.DimNameDisplayed[j] + ","); + if (st.contains("=true")) ret = (ret + DimensionHelper.DimNameDisplayed[j] + ","); } } } ret = ret.trim(); - //FMLLog.info("ret:"+ret); - if (ret.equals("") || ret.equals(" ")) - ret = "Not available in any Galactic Dim!"; + // FMLLog.info("ret:"+ret); + if (ret.equals("") || ret.equals(" ")) ret = "Not available in any Galactic Dim!"; return ret; } catch (IOException e) { e.printStackTrace(); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index 9e8a608405..ac3873d9bc 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -1,23 +1,26 @@ package pers.gwyog.gtneioreplugin.util; -import gregtech.common.GT_Worldgen_GT_Ore_Layer; +import static pers.gwyog.gtneioreplugin.util.OreVeinLayer.*; +import gregtech.api.GregTech_API; +import gregtech.common.GT_Worldgen_GT_Ore_Layer; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; +import net.minecraft.item.ItemStack; public class GT5OreLayerHelper { - public static Integer weightPerWorld[] = new Integer[33]; - public static Integer DimIDs[] = new Integer[33]; - public static HashMap mapOreLayerWrapper = new HashMap(); + private static final int DIMENSION_COUNT = 33; + public static Integer[] weightPerWorld = new Integer[DIMENSION_COUNT]; + public static Integer[] DimIDs = new Integer[DIMENSION_COUNT]; + public static HashMap mapOreLayerWrapper = new HashMap<>(); public static HashMap bufferedDims = new HashMap<>(); public GT5OreLayerHelper() { - for (int i = 0; i < DimIDs.length; i++) - weightPerWorld[i] = 0; - for (int i = 0; i < DimIDs.length; i++) - DimIDs[i] = 0; + Arrays.fill(weightPerWorld, 0); + Arrays.fill(DimIDs, 0); for (GT_Worldgen_GT_Ore_Layer tWorldGen : GT_Worldgen_GT_Ore_Layer.sList) mapOreLayerWrapper.put(tWorldGen.mWorldGenName, new OreLayerWrapper(tWorldGen)); for (OreLayerWrapper layer : mapOreLayerWrapper.values()) { @@ -26,15 +29,15 @@ public class GT5OreLayerHelper { } public static String getDims(OreLayerWrapper oreLayer) { - return GT5CFGHelper.GT5CFG(oreLayer.veinName.replace("ore.mix.custom.", "").replace("ore.mix.", "")); + return GT5CFGHelper.GT5CFG( + oreLayer.veinName.replace("ore.mix.custom" + ".", "").replace("ore.mix.", "")); } - - public class OreLayerWrapper { + public static class OreLayerWrapper { public String veinName, worldGenHeightRange; public short[] Meta = new short[4]; public short randomWeight, size, density; - public List Weight = new ArrayList(); + public List Weight = new ArrayList<>(); public OreLayerWrapper(GT_Worldgen_GT_Ore_Layer worldGen) { this.veinName = worldGen.mWorldGenName; @@ -47,6 +50,24 @@ public class GT5OreLayerHelper { this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; this.randomWeight = worldGen.mWeight; } + + public List getVeinLayerOre(int maximumMaterialIndex, int veinLayer) { + List stackList = new ArrayList<>(); + for (int i = 0; i < maximumMaterialIndex; i++) { + stackList.add(getLayerOre(veinLayer, i)); + } + return stackList; + } + + public ItemStack getLayerOre(int veinLayer, int materialIndex) { + return new ItemStack(GregTech_API.sBlockOres1, 1, Meta[veinLayer] + materialIndex * 1000); + } + + public boolean containsOre(short materialIndex) { + return Meta[VEIN_PRIMARY] == materialIndex + || Meta[VEIN_SECONDARY] == materialIndex + || Meta[VEIN_BETWEEN] == materialIndex + || Meta[VEIN_SPORADIC] == materialIndex; + } } } - \ No newline at end of file diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java index 6dc155e9fd..a730b3d148 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java @@ -6,20 +6,20 @@ 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.item.ItemStack; - import java.lang.reflect.Field; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import net.minecraft.item.ItemStack; public class GT5OreSmallHelper { + private static final int SMALL_ORE_BASE_META = 16000; public static boolean restrictBiomeSupport = false; public static boolean gcBasicSupport = false; - public static List oreSmallList = new ArrayList(); - public static HashMap mapOreSmallWrapper = new HashMap(); - public static HashMap mapOreDropUnlocalizedNameToOreMeta = new HashMap(); - public static HashMap> mapOreMetaToOreDrops = new HashMap>(); + public static List oreSmallList = new ArrayList<>(); + public static HashMap mapOreSmallWrapper = new HashMap<>(); + public static HashMap mapOreDropUnlocalizedNameToOreMeta = new HashMap<>(); + public static HashMap> mapOreMetaToOreDrops = new HashMap<>(); public static HashMap bufferedDims = new HashMap<>(); public GT5OreSmallHelper() { @@ -31,48 +31,63 @@ public class GT5OreSmallHelper { 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; - if (meta < 0) - break; + if (meta < 0) break; material = GregTech_API.sGeneratedMaterials[meta]; mapOreSmallWrapper.put(worldGen.mWorldGenName, new OreSmallWrapper(worldGenSmallPieces)); - if (!mapOreMetaToOreDrops.keySet().contains(meta)) { - List stackList = new ArrayList(); - stack = GT_OreDictUnificator.get(OrePrefixes.gemExquisite, material, GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L), 1L); - if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.keySet().contains(stack.getUnlocalizedName())) { + if (!mapOreMetaToOreDrops.containsKey(meta)) { + List stackList = new ArrayList<>(); + stack = GT_OreDictUnificator.get( + OrePrefixes.gemExquisite, + material, + GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L), + 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(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())) { + stack = GT_OreDictUnificator.get( + OrePrefixes.gemFlawless, + material, + GT_OreDictUnificator.get(OrePrefixes.gem, material, 1L), + 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(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())) { + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(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())) { + stack = GT_OreDictUnificator.get( + OrePrefixes.gemFlawed, + material, + GT_OreDictUnificator.get(OrePrefixes.crushed, material, 1L), + 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(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())) { + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(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())) { + stack = GT_OreDictUnificator.get( + OrePrefixes.gemChipped, + material, + GT_OreDictUnificator.get(OrePrefixes.dustImpure, material, 1L), + 1L); + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(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())) { + if (stack != null && !mapOreDropUnlocalizedNameToOreMeta.containsKey(stack.getUnlocalizedName())) { mapOreDropUnlocalizedNameToOreMeta.put(stack.getUnlocalizedName(), meta); stackList.add(stack); } - oreSmallList.add(new ItemStack(GregTech_API.sBlockOres1, 1, meta + 16000)); + oreSmallList.add(new ItemStack(GregTech_API.sBlockOres1, 1, meta + SMALL_ORE_BASE_META)); mapOreMetaToOreDrops.put(meta, stackList); } } @@ -82,9 +97,9 @@ public class GT5OreSmallHelper { } private static void checkExtraSupport() { - Class clazzGTOreSmall = null; + Class clazzGTOreSmall = null; try { - clazzGTOreSmall = Class.forName("gregtech.common.GT_Worldgen_GT_Ore_SmallPieces"); + clazzGTOreSmall = Class.forName("gregtech.common" + ".GT_Worldgen_GT_Ore_SmallPieces"); } catch (ClassNotFoundException e) { } if (clazzGTOreSmall != null) { @@ -103,10 +118,19 @@ public class GT5OreSmallHelper { } public static Materials[] getDroppedDusts() { - return new Materials[]{Materials.Stone, Materials.Netherrack, Materials.Endstone, Materials.GraniteBlack, Materials.GraniteRed, Materials.Marble, Materials.Basalt, Materials.Stone}; + return new Materials[] { + Materials.Stone, + Materials.Netherrack, + Materials.Endstone, + Materials.GraniteBlack, + Materials.GraniteRed, + Materials.Marble, + Materials.Basalt, + Materials.Stone + }; } - public class OreSmallWrapper { + public static class OreSmallWrapper { public String oreGenName; public short oreMeta; public String worldGenHeightRange; @@ -119,5 +143,12 @@ public class GT5OreSmallHelper { this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; this.amountPerChunk = worldGen.mAmount; } + + public List getMaterialDrops(int maximumIndex) { + List stackList = new ArrayList<>(); + for (int i = 0; i < maximumIndex; i++) + stackList.add(new ItemStack(GregTech_API.sBlockOres1, 1, oreMeta + SMALL_ORE_BASE_META + i * 1000)); + return stackList; + } } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java index 78d43f1bdd..8cf6a8faac 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java @@ -1,25 +1,23 @@ package pers.gwyog.gtneioreplugin.util; -import java.lang.reflect.Field; - -import org.apache.logging.log4j.Level; - import codechicken.nei.recipe.GuiRecipe; import cpw.mods.fml.common.FMLLog; +import java.lang.reflect.Field; import net.minecraft.client.Minecraft; +import org.apache.logging.log4j.Level; public class GuiRecipeHelper { - private static final String INIT_ERROR = "pers.gwyog.gtneioreplugin.util.GuiRecipeHelper failed setting up reflection : "; + private static final String INIT_ERROR = + "pers.gwyog.gtneioreplugin.util.GuiRecipeHelper failed setting up reflection : "; private static final int DEFAULT_XSIZE = 176; - private static Class guiRecipeClass; public static Field xSizeField; public static Field guiLeftField; public static Field guiTopField; /** * Access the xSize field of a GuiRecipe instance, or use a fallback hardcoded value if that fails - * + * * @param gui GuiRecipe object * @return Integer value of the xSize field of that object */ @@ -31,15 +29,14 @@ public class GuiRecipeHelper { // Fail silently, hoping that it it fails it will be during initialization } } - + // Fallback should work unless codechicken.nei.recipe.GuiRecipe implementation changes return DEFAULT_XSIZE; } - /** * Access the guiLeft field of a GuiRecipe instance, or use a fallback hardcoded value if that fails - * + * * @param gui GuiRecipe object * @return Integer value of the guiLeft field of that object */ @@ -51,14 +48,14 @@ public class GuiRecipeHelper { // Fail silently, hoping that it it fails it will be during initialization } } - + // Fallback should work unless codechicken.nei.recipe.GuiRecipe implementation changes return (Minecraft.getMinecraft().currentScreen.width - DEFAULT_XSIZE) / 2; } - + /** * Access the guiTop field of a GuiRecipe instance, or use a fallback hardcoded value if that fails - * + * * @param gui GuiRecipe object * @return Integer value of the guiTop field of that object */ @@ -70,7 +67,7 @@ public class GuiRecipeHelper { // Fail silently, hoping that it it fails it will be during initialization } } - + // Fallback should work unless codechicken.nei.recipe.GuiRecipe implementation changes int height = Minecraft.getMinecraft().currentScreen.height; int ySize = Math.min(Math.max(height - 68, 166), 370); @@ -81,15 +78,15 @@ public class GuiRecipeHelper { * Initialize the GuiRecipe Field accessors through reflection */ public GuiRecipeHelper() { - guiRecipeClass = GuiRecipe.class; + Class guiRecipeClass = GuiRecipe.class; try { - guiLeftField = guiRecipeClass.getField("guiLeft"); + guiLeftField = guiRecipeClass.getField("guiLeft"); guiLeftField.setAccessible(true); guiTopField = guiRecipeClass.getField("guiTop"); guiTopField.setAccessible(true); xSizeField = guiRecipeClass.getField("xSize"); xSizeField.setAccessible(true); - } catch(NoSuchFieldException|SecurityException e) { + } catch (NoSuchFieldException | SecurityException e) { FMLLog.log(Level.ERROR, INIT_ERROR + e.getMessage()); } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/OreVeinLayer.java b/src/main/java/pers/gwyog/gtneioreplugin/util/OreVeinLayer.java new file mode 100644 index 0000000000..3bd684987e --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/OreVeinLayer.java @@ -0,0 +1,21 @@ +package pers.gwyog.gtneioreplugin.util; + +public class OreVeinLayer { + public static final int VEIN_PRIMARY = 0; + public static final int VEIN_SECONDARY = 1; + public static final int VEIN_BETWEEN = 2; + public static final int VEIN_SPORADIC = 3; + + private static final String[] LAYER_NAMES = { + "gtnop.gui.nei.primaryOre", + "gtnop.gui.nei.secondaryOre", + "gtnop.gui.nei.betweenOre", + "gtnop.gui" + ".nei.sporadicOre" + }; + + public static String getOreVeinLayerName(int layerId) { + return LAYER_NAMES[layerId]; + } + + private OreVeinLayer() {} +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java b/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java index 559a11cca8..69941b6ba2 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java @@ -7,98 +7,142 @@ public class Oremix { @CsvCustomBindByName(column = "Moon", required = false, converter = XtoBool.class) public boolean mo; + @CsvCustomBindByName(column = "End Asteroids", required = false, converter = XtoBool.class) public boolean ea; + @CsvCustomBindByName(column = "AstroidBelt", required = false, converter = XtoBool.class) public boolean as; + @CsvCustomBindByName(column = "Barnard C", required = false, converter = XtoBool.class) public boolean bc; + @CsvCustomBindByName(column = "Barnard E", required = false, converter = XtoBool.class) public boolean be; + @CsvCustomBindByName(column = "Barnard F", required = false, converter = XtoBool.class) public boolean bf; + @CsvCustomBindByName(column = "Mars", required = false, converter = XtoBool.class) public boolean ma; + @CsvCustomBindByName(column = "Callisto", required = false, converter = XtoBool.class) public boolean ca; + @CsvCustomBindByName(column = "Centauri Bb", required = false, converter = XtoBool.class) public boolean cb; + @CsvCustomBindByName(column = "Ceres", required = false, converter = XtoBool.class) public boolean ce; + @CsvCustomBindByName(column = "Twilight Forest", required = false, converter = XtoBool.class) public boolean tf; + @CsvCustomBindByName(column = "Deep Dark", required = false, converter = XtoBool.class) public boolean dd; + @CsvCustomBindByName(column = "Phobos", required = false, converter = XtoBool.class) public boolean ph; + @CsvCustomBindByName(column = "Deimos", required = false, converter = XtoBool.class) public boolean de; + @CsvCustomBindByName(column = "Europa", required = false, converter = XtoBool.class) public boolean eu; + @CsvCustomBindByName(column = "Ganymede", required = false, converter = XtoBool.class) public boolean ga; + @CsvCustomBindByName(column = "Io", required = false, converter = XtoBool.class) public boolean io; + @CsvCustomBindByName(column = "Venus", required = false, converter = XtoBool.class) public boolean ve; + @CsvCustomBindByName(column = "Mercury", required = false, converter = XtoBool.class) public boolean me; + @CsvCustomBindByName(column = "Enceladus", required = false, converter = XtoBool.class) public boolean en; + @CsvCustomBindByName(column = "Titan", required = false, converter = XtoBool.class) public boolean ti; + @CsvCustomBindByName(column = "Miranda", required = false, converter = XtoBool.class) public boolean mi; + @CsvCustomBindByName(column = "Oberon", required = false, converter = XtoBool.class) public boolean ob; + @CsvCustomBindByName(column = "Triton", required = false, converter = XtoBool.class) public boolean tr; + @CsvCustomBindByName(column = "Proteus", required = false, converter = XtoBool.class) public boolean pr; + @CsvCustomBindByName(column = "Pluto", required = false, converter = XtoBool.class) public boolean pl; + @CsvCustomBindByName(column = "Kuiper Belt", required = false, converter = XtoBool.class) public boolean kb; + @CsvCustomBindByName(column = "Haumea", required = false, converter = XtoBool.class) public boolean ha; + @CsvCustomBindByName(column = "Makemake", required = false, converter = XtoBool.class) public boolean make; + @CsvCustomBindByName(column = "Vega B", required = false, converter = XtoBool.class) public boolean vb; + @CsvCustomBindByName(column = "T Ceti E", required = false, converter = XtoBool.class) public boolean tcetie; + @CsvCustomBindByName(column = "Ore Name", required = true, converter = Veinrenamer.class) private String oreName; + @CsvBindByName(column = "Primary", required = false) private String primary = ""; + @CsvBindByName(column = "Secondary", required = false) private String secondary = ""; + @CsvBindByName(column = "Inbetween", required = false) private String inbetween = ""; + @CsvBindByName(column = "Around", required = false) private String around = ""; + @CsvBindByName(column = "ID ", required = false) private String mix = ""; + @CsvBindByName(column = "Tier", required = false) private String tier = ""; + @CsvBindByName(column = "Height", required = false) private String height = ""; + @CsvBindByName(column = "Density", required = false) private int density; + @CsvBindByName(column = "Size", required = false) private int size; + @CsvBindByName(column = "Weight", required = false) private int weight; + @CsvCustomBindByName(column = "Overworld", required = false, converter = XtoBool.class) private boolean overworld; + @CsvCustomBindByName(column = "Nether", required = false, converter = XtoBool.class) private boolean nether; + @CsvCustomBindByName(column = "End", required = false, converter = XtoBool.class) private boolean end; + private int miny, maxy; - public Oremix() { - } + public Oremix() {} public boolean isMo() { return mo; @@ -486,5 +530,4 @@ public class Oremix { public String getHeightcalced() { return new String(this.miny + "-" + this.maxy); } - } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/StringPaddingHack.java b/src/main/java/pers/gwyog/gtneioreplugin/util/StringPaddingHack.java index d4c340a9be..20e524ec41 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/StringPaddingHack.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/StringPaddingHack.java @@ -1,8 +1,7 @@ package pers.gwyog.gtneioreplugin.util; -import java.util.Arrays; import com.google.common.base.Strings; - +import java.util.Arrays; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -13,15 +12,16 @@ public class StringPaddingHack { /** * Given a list of strings, arrange them into the requested number of columns with the specified spacing. * Up to 3 additional spaces might be added between columns because this function relies on quirky font behaviors. - * + * * @param strings List of strings to wrap into columns * @param numColumns Number of columns, minimum of 1 * @param minColumnSpacing Minimum amount of extra spaces between columns. - * @return + * @return strings wrapped into columns */ public static String[] stringsToSpacedColumns(String[] strings, int numColumns, int minColumnSpacing) { if (numColumns < 1) { - throw new IllegalArgumentException(String.format("Argument numColumns must be 1 or higher, got value %d", numColumns)); + throw new IllegalArgumentException( + String.format("Argument numColumns must be 1 or higher, got value %d", numColumns)); } if (numColumns > 1) { int sliceSize = strings.length / numColumns; @@ -36,37 +36,37 @@ public class StringPaddingHack { remainder--; extra = 1; } - columns[i] = Arrays.copyOfRange(strings, (sliceSize * i) + totalExtra, (sliceSize * (i + 1) + totalExtra + extra)); + columns[i] = Arrays.copyOfRange( + strings, (sliceSize * i) + totalExtra, (sliceSize * (i + 1) + totalExtra + extra)); totalExtra += extra; } // Add extra padding to all but the last columns to align the text - for(int i = 0; i < numColumns - 1; i++) { + for (int i = 0; i < numColumns - 1; i++) { columns[i] = padStrings(columns[i], minColumnSpacing); } - + // Concatenate all columns into the final result - strings = columns[0]; - for (int i = 0; i < sliceSize; i++ ) { - for (int j = 1; j < numColumns; j++ ) { + strings = columns[0]; + for (int i = 0; i < sliceSize; i++) { + for (int j = 1; j < numColumns; j++) { strings[i] += columns[j][i]; } } } - + return strings; } - /** * Pads strings with spaces so that they are of equal length and adds to * that the number of spaces specified and up to 3 if minExtraSpaces is * below 3. Added spaces might be bold. - * + * * Relies on the quirk of bold space characters being 1 pixel wider than * regular space characters in the default font renderer. - * + * * @param strings List of strings * @param minExtraSpaces The minimum number of extra spaces to add * @return List of strings padded with spaces to an equal length @@ -76,7 +76,7 @@ public class StringPaddingHack { int maxUnPaddedStrLength = 0; int numSpacesAddedToLongestString = 0; int maxPaddedStrLength = 0; - + // Making string width a multiple of 4 by adding bold spaces of width 5 for (int i = 0; i < strings.length; i++) { int mod = widths[i] % SPACE_WIDTH; @@ -88,7 +88,7 @@ public class StringPaddingHack { maxUnPaddedStrLength = widths[i]; } - strings[i] += "§l" + Strings.repeat(" ", numBoldSpacesToAdd ) + "§r"; + strings[i] += "§l" + Strings.repeat(" ", numBoldSpacesToAdd) + "§r"; widths[i] += numBoldSpacesToAdd * BOLD_SPACE_WIDTH; // Keep track of the current widest string we currently have @@ -96,7 +96,7 @@ public class StringPaddingHack { maxPaddedStrLength = widths[i]; } } - + // Make sure we pad at least up to the desired number of spaces from the longest string if (numSpacesAddedToLongestString < minExtraSpaces) { maxPaddedStrLength += (minExtraSpaces - numSpacesAddedToLongestString) * SPACE_WIDTH; @@ -114,7 +114,7 @@ public class StringPaddingHack { /** * Returns an array of font widths for the given array of strings - * + * * @param strList Array of strings * @return Array of font widths */ diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java b/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java index a721d88e82..e80d972b17 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java @@ -17,11 +17,9 @@ public class Veinrenamer extends AbstractBeanField { ret = ret.replaceAll(" ", ""); ret = ret.replaceAll("\\.", ""); ret = ret.toLowerCase(); - } else - ret = value; + } else ret = value; ret = ret.replaceAll(" ", ""); ret = ret.toLowerCase(); return ret; } - } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java b/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java index c27a480557..98be50d989 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java @@ -3,12 +3,11 @@ package pers.gwyog.gtneioreplugin.util; import com.opencsv.bean.AbstractBeanField; import com.opencsv.exceptions.CsvConstraintViolationException; import com.opencsv.exceptions.CsvDataTypeMismatchException; +import java.util.ResourceBundle; import org.apache.commons.beanutils.ConversionException; import org.apache.commons.beanutils.Converter; import org.apache.commons.beanutils.converters.BooleanConverter; -import java.util.ResourceBundle; - public class XtoBool extends AbstractBeanField { @Override @@ -23,13 +22,12 @@ public class XtoBool extends AbstractBeanField { return bc.convert(Boolean.class, value.trim()); } catch (ConversionException e) { CsvDataTypeMismatchException csve = new CsvDataTypeMismatchException( - value, field.getType(), ResourceBundle - .getBundle("convertGermanToBoolean", errorLocale) - .getString("input.not.boolean")); + value, + field.getType(), + ResourceBundle.getBundle("convertGermanToBoolean", errorLocale) + .getString("input.not.boolean")); csve.initCause(e); throw csve; } } - - } -- cgit From 5c06d007a8fee37f493737d4f6e5af1a7df5727c Mon Sep 17 00:00:00 2001 From: miozune Date: Sat, 9 Jul 2022 19:47:06 +0900 Subject: Add Dimension Display Item (#18) * Add Dimension Display Item * side * Sort dims --- .editorconfig | 3 + dependencies.gradle | 2 +- .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 21 +++ .../plugin/gregtech5/PluginGT5Base.java | 43 ----- .../plugin/gregtech5/PluginGT5SmallOreStat.java | 64 +++++++- .../plugin/gregtech5/PluginGT5VeinStat.java | 70 ++++++-- .../plugin/items/ItemDimensionDisplay.java | 111 +++++++++++++ .../gtneioreplugin/plugin/items/ModItems.java | 15 ++ .../renderer/ItemDimensionDisplayRenderer.java | 181 +++++++++++++++++++++ .../gwyog/gtneioreplugin/util/DimensionHelper.java | 15 +- .../assets/gtneioreplugin/lang/en_US.lang | 5 +- .../textures/items/dimensionDisplay/EA.png | Bin 0 -> 168 bytes .../textures/items/dimensionDisplay/EN.png | Bin 0 -> 164 bytes .../textures/items/dimensionDisplay/Ne.png | Bin 0 -> 257 bytes .../textures/items/dimensionDisplay/Ow.png | Bin 0 -> 236 bytes .../textures/items/dimensionDisplay/TF.png | Bin 0 -> 239 bytes .../textures/items/dimensionDisplay/VA.png | Bin 0 -> 169 bytes .../textures/items/dimensionDisplay/_unknown.png | Bin 0 -> 1155 bytes 18 files changed, 466 insertions(+), 64 deletions(-) create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/items/ItemDimensionDisplay.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/items/ModItems.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java create mode 100644 src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/EA.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/EN.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/Ne.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/Ow.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/TF.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/VA.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/_unknown.png diff --git a/.editorconfig b/.editorconfig index 6effbc91a8..4ffbd90826 100644 --- a/.editorconfig +++ b/.editorconfig @@ -17,3 +17,6 @@ end_of_line = crlf [*.{dtd,json,info,mcmeta,md,sh,svg,xml,xsd,xsl,yaml,yml}] indent_size = 2 + +[*.lang] +trim_trailing_whitespace = false diff --git a/dependencies.gradle b/dependencies.gradle index 9e3d33e5e2..a94333541e 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -2,7 +2,7 @@ dependencies { compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.39:dev') - compile('com.github.GTNewHorizons:NotEnoughItems:2.2.9-GTNH:dev') + compile('com.github.GTNewHorizons:NotEnoughItems:2.2.19-GTNH:dev') compile('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev') diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index 3c0eb00eb4..928fe07bd5 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -2,11 +2,17 @@ package pers.gwyog.gtneioreplugin; 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.FMLPreInitializationEvent; +import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import pers.gwyog.gtneioreplugin.plugin.items.ModItems; +import pers.gwyog.gtneioreplugin.plugin.renderer.ItemDimensionDisplayRenderer; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper; @@ -26,6 +32,13 @@ public class GTNEIOrePlugin { public static String CSVnameSmall; public static boolean toolTips = true; public static int maxTooltipLines = 11; + public static final CreativeTabs creativeTab = new CreativeTabs(MODID) { + @Override + public Item getTabIconItem() { + return GameRegistry.makeItemStack("gregtech:gt.blockores", 386, 1, null) + .getItem(); + } + }; @Mod.Instance(MODID) public static GTNEIOrePlugin instance; @@ -60,6 +73,14 @@ public class GTNEIOrePlugin { c.save(); } + @EventHandler + public void init(FMLInitializationEvent event) { + ModItems.init(); + if (event.getSide() == Side.CLIENT) { + new ItemDimensionDisplayRenderer(); + } + } + @EventHandler public void onLoadComplete(FMLLoadCompleteEvent event) { if (event.getSide() == Side.CLIENT) { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java index bdcccebe7a..6abc3ea96c 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java @@ -1,20 +1,15 @@ package pers.gwyog.gtneioreplugin.plugin.gregtech5; -import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.toolTips; - import codechicken.lib.gui.GuiDraw; -import codechicken.nei.guihook.GuiContainerManager; import codechicken.nei.recipe.GuiRecipe; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.util.GT_LanguageManager; import java.awt.Point; import java.awt.Rectangle; -import java.util.List; import net.minecraft.client.resources.I18n; import net.minecraft.util.EnumChatFormatting; import pers.gwyog.gtneioreplugin.plugin.PluginBase; -import pers.gwyog.gtneioreplugin.util.DimensionHelper; import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper; public abstract class PluginGT5Base extends PluginBase { @@ -51,30 +46,6 @@ public abstract class PluginGT5Base extends PluginBase { GuiDraw.drawString(I18n.format(lineKey) + ": " + value, x, y, 0x404040, false); } - /** - * Add lines to the current tooltip if appropriate - * - * @param gui An instance of the currentscreen - * @param currenttip The current tooltip, will contain item name and info - * @param recipe The recipe index being handled - * @return The modified tooltip. DO NOT return null - */ - @Override - public List handleTooltip(GuiRecipe gui, List currenttip, int recipe) { - if (toolTips && GuiContainerManager.shouldShowTooltip(gui) && currenttip.size() == 0) { - String dimNames = getDimensionNames(recipe); - Rectangle dimRect = getDimensionNamesRect(gui, recipe, dimNames); - Point mousePos = GuiDraw.getMousePosition(); - - if (dimRect.contains(mousePos.x, mousePos.y)) { - List dims = DimensionHelper.convertCondensedStringToToolTip(dimNames); - currenttip.addAll(dims); - } - } - - return super.handleTooltip(gui, currenttip, recipe); - } - /** * The dimension names for a given recipe index * @@ -117,20 +88,6 @@ public abstract class PluginGT5Base extends PluginBase { */ protected void drawDimNames(String dimNames) { GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 100, 0x404040, false); - - if (dimNames.length() > 36) { - GuiDraw.drawString(I18n.format("") + dimNames.substring(0, 36), 2, 110, 0x404040, false); - if (dimNames.length() > 70) { - GuiDraw.drawString(I18n.format("") + dimNames.substring(36, 70), 2, 120, 0x404040, false); - GuiDraw.drawString( - I18n.format("") + dimNames.substring(70, dimNames.length() - 1), 2, 130, 0x404040, false); - } else { - GuiDraw.drawString( - I18n.format("") + dimNames.substring(36, dimNames.length() - 1), 2, 120, 0x404040, false); - } - } else { - GuiDraw.drawString(I18n.format("") + dimNames.substring(0, dimNames.length() - 1), 2, 110, 0x404040, false); - } } /** diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java index 38f668f05e..0955409d58 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java @@ -4,9 +4,13 @@ import codechicken.nei.PositionedStack; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_OreDictUnificator; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; import java.util.List; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; +import pers.gwyog.gtneioreplugin.plugin.items.ItemDimensionDisplay; +import pers.gwyog.gtneioreplugin.util.DimensionHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper.OreSmallWrapper; @@ -66,6 +70,20 @@ public class PluginGT5SmallOreStat extends PluginGT5Base { } else super.loadCraftingRecipes(stack); } + @Override + public void loadUsageRecipes(ItemStack stack) { + String dimension = ItemDimensionDisplay.getDimension(stack); + if (dimension == null) { + return; + } + + for (OreSmallWrapper oreVein : GT5OreSmallHelper.mapOreSmallWrapper.values()) { + if (Arrays.asList(getDimNameArrayFromVeinName(oreVein.oreGenName)).contains(dimension)) { + addSmallOre(oreVein, 7); + } + } + } + private void loadSmallOre(short oreMeta, int maximumIndex) { OreSmallWrapper smallOre = getSmallOre(oreMeta); if (smallOre != null) { @@ -120,11 +138,20 @@ public class PluginGT5SmallOreStat extends PluginGT5Base { return GT5OreSmallHelper.bufferedDims.get(oreSmall); } + private String[] getDimNameArrayFromVeinName(String veinName) { + OreSmallWrapper oreSmall = GT5OreSmallHelper.mapOreSmallWrapper.get(veinName); + String[] dims = DimensionHelper.parseDimNames(GT5OreSmallHelper.bufferedDims.get(oreSmall)); + Arrays.sort(dims, Comparator.comparingInt(s -> Arrays.asList(DimensionHelper.DimNameDisplayed) + .indexOf(s))); + return dims; + } + public class CachedOreSmallRecipe extends CachedRecipe { public String oreGenName; public PositionedStack positionedStackOreSmall; public PositionedStack positionedStackMaterialDust; public List positionedDropStackList; + private final List dimensionDisplayItems = new ArrayList<>(); public CachedOreSmallRecipe( String oreGenName, @@ -141,21 +168,46 @@ public class PluginGT5SmallOreStat extends PluginGT5Base { positionedDropStackList.add(new PositionedStack( stackDrop, 43 + 20 * (i % 4), 79 + 16 * ((i++) / 4) + getRestrictBiomeOffset())); this.positionedDropStackList = positionedDropStackList; + setDimensionDisplayItems(); + } + + private void setDimensionDisplayItems() { + int x = 2; + int y = 110; + int count = 0; + int itemsPerLine = 9; + int itemSize = 18; + for (String dim : getDimNameArrayFromVeinName(this.oreGenName)) { + ItemStack item = ItemDimensionDisplay.getItem(dim); + if (item != null) { + int xPos = x + itemSize * (count % itemsPerLine); + int yPos = y + itemSize * (count / itemsPerLine); + dimensionDisplayItems.add(new PositionedStack(item, xPos, yPos, false)); + count++; + } + } } @Override public List getIngredients() { - positionedStackOreSmall.setPermutationToRender((cycleticks / 20) % positionedStackOreSmall.items.length); - positionedStackMaterialDust.setPermutationToRender( - (cycleticks / 20) % positionedStackMaterialDust.items.length); - positionedDropStackList.add(positionedStackOreSmall); - positionedDropStackList.add(positionedStackMaterialDust); - return positionedDropStackList; + return dimensionDisplayItems; } @Override public PositionedStack getResult() { return null; } + + @Override + public List getOtherStacks() { + List outputs = new ArrayList<>(); + positionedStackOreSmall.setPermutationToRender((cycleticks / 20) % positionedStackOreSmall.items.length); + positionedStackMaterialDust.setPermutationToRender( + (cycleticks / 20) % positionedStackMaterialDust.items.length); + outputs.add(positionedStackOreSmall); + outputs.add(positionedStackMaterialDust); + outputs.addAll(positionedDropStackList); + return outputs; + } } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java index dc559db34a..67da9bab02 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -5,10 +5,14 @@ import static pers.gwyog.gtneioreplugin.util.OreVeinLayer.*; import codechicken.nei.PositionedStack; import cpw.mods.fml.common.Loader; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; +import java.util.Comparator; import java.util.List; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; +import pers.gwyog.gtneioreplugin.plugin.items.ItemDimensionDisplay; +import pers.gwyog.gtneioreplugin.util.DimensionHelper; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; @@ -38,6 +42,20 @@ public class PluginGT5VeinStat extends PluginGT5Base { } } + @Override + public void loadUsageRecipes(ItemStack stack) { + String dimension = ItemDimensionDisplay.getDimension(stack); + if (dimension == null) { + return; + } + + for (OreLayerWrapper oreVein : getAllVeins()) { + if (Arrays.asList(getDimNameArrayFromVeinName(oreVein.veinName)).contains(dimension)) { + addVeinWithLayers(oreVein, getMaximumMaterialIndex((short) (stack.getItemDamage() % 1000), false)); + } + } + } + private void addVeinWithLayers(OreLayerWrapper oreVein, int maximumMaterialIndex) { this.arecipes.add(new CachedVeinStatRecipe( oreVein.veinName, @@ -123,12 +141,21 @@ public class PluginGT5VeinStat extends PluginGT5Base { return GT5OreLayerHelper.bufferedDims.get(oreLayer); } + private String[] getDimNameArrayFromVeinName(String veinName) { + OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(veinName); + String[] dims = DimensionHelper.parseDimNames(GT5OreLayerHelper.bufferedDims.get(oreLayer)); + Arrays.sort(dims, Comparator.comparingInt(s -> Arrays.asList(DimensionHelper.DimNameDisplayed) + .indexOf(s))); + return dims; + } + public class CachedVeinStatRecipe extends CachedRecipe { public String veinName; public PositionedStack positionedStackPrimary; public PositionedStack positionedStackSecondary; public PositionedStack positionedStackBetween; public PositionedStack positionedStackSporadic; + private final List dimensionDisplayItems = new ArrayList<>(); public CachedVeinStatRecipe( String veinName, @@ -141,25 +168,48 @@ public class PluginGT5VeinStat extends PluginGT5Base { positionedStackSecondary = new PositionedStack(stackListSecondary, 22, 0); positionedStackBetween = new PositionedStack(stackListBetween, 42, 0); positionedStackSporadic = new PositionedStack(stackListSporadic, 62, 0); + setDimensionDisplayItems(); + } + + private void setDimensionDisplayItems() { + int x = 2; + int y = 110; + int count = 0; + int itemsPerLine = 9; + int itemSize = 18; + for (String dim : getDimNameArrayFromVeinName(this.veinName)) { + ItemStack item = ItemDimensionDisplay.getItem(dim); + if (item != null) { + int xPos = x + itemSize * (count % itemsPerLine); + int yPos = y + itemSize * (count / itemsPerLine); + dimensionDisplayItems.add(new PositionedStack(item, xPos, yPos, false)); + count++; + } + } } @Override public List getIngredients() { - List ingredientsList = new ArrayList<>(); - 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; + return dimensionDisplayItems; } @Override public PositionedStack getResult() { return null; } + + @Override + public List getOtherStacks() { + List outputs = new ArrayList<>(); + 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); + outputs.add(positionedStackPrimary); + outputs.add(positionedStackSecondary); + outputs.add(positionedStackBetween); + outputs.add(positionedStackSporadic); + return outputs; + } } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/items/ItemDimensionDisplay.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/items/ItemDimensionDisplay.java new file mode 100644 index 0000000000..76be6536e8 --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/items/ItemDimensionDisplay.java @@ -0,0 +1,111 @@ +package pers.gwyog.gtneioreplugin.plugin.items; + +import cpw.mods.fml.common.Loader; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.Constants; +import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; +import pers.gwyog.gtneioreplugin.util.DimensionHelper; + +public class ItemDimensionDisplay extends Item { + + private static final String TAG_DIMENSION = "dimension"; + private static final Map items = new HashMap<>(); + + public ItemDimensionDisplay() { + setUnlocalizedName(GTNEIOrePlugin.MODID + ".itemDimensionDisplay"); + setCreativeTab(GTNEIOrePlugin.creativeTab); + } + + public static ItemStack getItem(String dimension) { + if (items.get(dimension) != null) { + return items.get(dimension).copy(); + } + return null; + } + + public static void setDimension(ItemStack stack, String dimension) { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setString(TAG_DIMENSION, dimension); + stack.setTagCompound(nbt); + } + + public static String getDimension(ItemStack stack) { + if (stack.hasTagCompound() && stack.getTagCompound().hasKey(TAG_DIMENSION, Constants.NBT.TAG_STRING)) { + return stack.getTagCompound().getString(TAG_DIMENSION); + } + return null; + } + + public static boolean isDimensionEqual(ItemStack stack1, ItemStack stack2) { + if (!(stack1.getItem() instanceof ItemDimensionDisplay) + || !(stack2.getItem() instanceof ItemDimensionDisplay)) { + return false; + } + return Objects.equals(getDimension(stack1), getDimension(stack2)); + } + + @Override + public String getItemStackDisplayName(ItemStack stack) { + String dimension = getDimension(stack); + if (dimension != null) { + return DimensionHelper.convertCondensedStringToToolTip(dimension).get(0); + } + return super.getItemStackDisplayName(stack); + } + + @Override + public Item setTextureName(String p_111206_1_) { + return super.setTextureName(p_111206_1_); + } + + @SuppressWarnings("unchecked") + @Override + public void getSubItems(Item item, CreativeTabs creativeTabs, List itemList) { + for (ItemStack stack : items.values()) { + itemList.add(stack.copy()); + } + } + + public static void loadItems() { + String[] vanilla_gt = new String[] {"Ow", "Ne", "TF", "EN", "VA", "EA"}; + for (String dimension : vanilla_gt) { + ItemStack stack = new ItemStack(ModItems.itemDimensionDisplay); + setDimension(stack, dimension); + items.put(dimension, stack); + } + String[] gc = new String[] {"Mo", "Ma", "As"}; + if (Loader.isModLoaded("GalacticraftCore")) { + for (String dimension : gc) { + ItemStack stack = new ItemStack(ModItems.itemDimensionDisplay); + setDimension(stack, dimension); + items.put(dimension, stack); + } + } + String[] gs = new String[] { + "De", "Ph", "Ca", "Ce", "Eu", "Ga", "Io", "Me", "Ve", "En", "Mi", "Ob", "Ti", "Pr", "Tr", "Ha", "KB", "MM", + "Pl", "BC", "BE", "BF", "CB", "TE", "VB" + }; + if (Loader.isModLoaded("GalaxySpace")) { + for (String dimension : gs) { + ItemStack stack = new ItemStack(ModItems.itemDimensionDisplay); + setDimension(stack, dimension); + items.put(dimension, stack); + } + } + String[] xu = new String[] {"DD"}; + if (Loader.isModLoaded("ExtraUtilities")) { + for (String dimension : xu) { + ItemStack stack = new ItemStack(ModItems.itemDimensionDisplay); + setDimension(stack, dimension); + items.put(dimension, stack); + } + } + } +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/items/ModItems.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/items/ModItems.java new file mode 100644 index 0000000000..1a519c4548 --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/items/ModItems.java @@ -0,0 +1,15 @@ +package pers.gwyog.gtneioreplugin.plugin.items; + +import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.item.Item; +import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; + +public class ModItems { + + public static Item itemDimensionDisplay = new ItemDimensionDisplay(); + + public static void init() { + GameRegistry.registerItem(itemDimensionDisplay, "itemDimensionDisplay", GTNEIOrePlugin.MODID); + ItemDimensionDisplay.loadItems(); + } +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java new file mode 100644 index 0000000000..d85a3764d3 --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java @@ -0,0 +1,181 @@ +package pers.gwyog.gtneioreplugin.plugin.renderer; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.IItemRenderer; +import net.minecraftforge.client.MinecraftForgeClient; +import org.lwjgl.opengl.GL11; +import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; +import pers.gwyog.gtneioreplugin.plugin.items.ItemDimensionDisplay; +import pers.gwyog.gtneioreplugin.plugin.items.ModItems; + +public class ItemDimensionDisplayRenderer implements IItemRenderer { + + public ItemDimensionDisplayRenderer() { + MinecraftForgeClient.registerItemRenderer(ModItems.itemDimensionDisplay, this); + } + + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return true; + } + + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return false; + } + + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + String dimension = ItemDimensionDisplay.getDimension(item); + if (dimension == null) { + return; + } + + GL11.glEnable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_ALPHA_TEST); + + Minecraft.getMinecraft().renderEngine.bindTexture(getResourceLocation(dimension)); + + Tessellator tess = Tessellator.instance; + tess.startDrawingQuads(); + tess.addVertexWithUV(0, 16, 0, 0, 1); + tess.addVertexWithUV(16, 16, 0, 1, 1); + tess.addVertexWithUV(16, 0, 0, 1, 0); + tess.addVertexWithUV(0, 0, 0, 0, 0); + tess.draw(); + + GL11.glDisable(GL11.GL_BLEND); + + String prefix = getPrefix(dimension); + if (!prefix.isEmpty()) { + FontRenderer fontRender = Minecraft.getMinecraft().fontRenderer; + float smallTextScale = fontRender.getUnicodeFlag() ? 3F / 4F : 1F / 2F; + GL11.glScalef(smallTextScale, smallTextScale, 1.0f); + + fontRender.drawString(prefix, 0, (int) (16 / smallTextScale) - fontRender.FONT_HEIGHT + 1, 0xFFFFFF, true); + } + + GL11.glDisable(GL11.GL_ALPHA_TEST); + } + + private ResourceLocation getResourceLocation(String dimension) { + switch (dimension) { + case "Ow": + case "Ne": + case "TF": + case "EN": + case "VA": + case "EA": + return new ResourceLocation( + GTNEIOrePlugin.MODID, String.format("textures/items/dimensionDisplay/%s.png", dimension)); + case "Mo": + return new ResourceLocation("galacticraftcore:textures/gui/celestialbodies/moon.png"); + case "De": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/deimos.png"); + case "Ma": + return new ResourceLocation("galacticraftcore:textures/gui/celestialbodies/mars.png"); + case "Ph": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/phobos.png"); + case "As": + return new ResourceLocation("galacticraftcore:textures/gui/celestialbodies/asteroid.png"); + case "Ca": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/callisto.png"); + case "Ce": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/ceres.png"); + case "Eu": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/europa.png"); + case "Ga": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/ganymede.png"); + case "Io": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/io.png"); + case "Me": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/mercury.png"); + case "Ve": + return new ResourceLocation("galacticraftcore:textures/gui/celestialbodies/venus.png"); + case "En": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/enceladus.png"); + case "Mi": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/miranda.png"); + case "Ob": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/oberon.png"); + case "Ti": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/titan.png"); + case "Pr": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/proteus.png"); + case "Tr": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/triton.png"); + case "Ha": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/haumea.png"); + case "KB": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/kuiperbelt.png"); + case "MM": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/makemake.png"); + case "Pl": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/pluto.png"); + case "BC": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/barnards/Barnarda2.png"); + case "BE": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/barnards/Barnarda4.png"); + case "BF": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/barnards/Barnarda5.png"); + case "CB": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/aCentauri/CentauriBb.png"); + case "TE": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/tceti/TCetiE.png"); + case "DD": + return new ResourceLocation("extrautils:textures/blocks/dark_portal.png"); + case "VB": + return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/vega/Vega1.png"); + default: + return new ResourceLocation(GTNEIOrePlugin.MODID, "textures/items/dimensionDisplay/_unknown.png"); + } + } + + private static String getPrefix(String dimName) { + switch (dimName) { + case "Mo": + return "T1"; + case "De": + case "Ma": + case "Ph": + return "T2"; + case "As": + case "Ca": + case "Ce": + case "Eu": + case "Ga": + return "T3"; + case "Io": + case "Me": + case "Ve": + return "T4"; + case "En": + case "Mi": + case "Ob": + case "Ti": + return "T5"; + case "Pr": + case "Tr": + return "T6"; + case "Ha": + case "KB": + case "MM": + case "Pl": + return "T7"; + case "BC": + case "BE": + case "BF": + case "CB": + case "TE": + case "DD": + case "VB": + return "T8"; + default: + return ""; + } + } +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java index 16be409b61..ac4ceb6f95 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -108,11 +108,9 @@ public class DimensionHelper { private static final HashMap> tooltipBuffer = new HashMap<>(); private static List computeString(String line) { - String[] dims = line.split(","); + String[] dims = parseDimNames(line); for (int j = 0; j < dims.length; j++) { String s = dims[j]; - s = s.replaceAll(",", ""); - s = s.trim(); for (int i = 0; i < DimNameDisplayed.length; i++) { if (s.equals(DimNameDisplayed[i])) { String k = DimName[i] @@ -182,6 +180,17 @@ public class DimensionHelper { return Arrays.asList(dims); } + public static String[] parseDimNames(String line) { + String[] dims = line.split(","); + for (int j = 0; j < dims.length; j++) { + String s = dims[j]; + s = s.replaceAll(",", ""); + s = s.trim(); + dims[j] = s; + } + return dims; + } + public static List convertCondensedStringToToolTip(String line) { return tooltipBuffer.computeIfAbsent(line, (String tmp) -> computeString(line)); } diff --git a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang index ec8c8a9681..dd65efe1ff 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang @@ -83,4 +83,7 @@ gtnop.ore.null.name=None # vein types gtnop.ore.vein.name=Vein gtnop.ore.asteroid.name=Asteriod -gtnop.ore.custom.name=Custom \ No newline at end of file +gtnop.ore.custom.name=Custom + +# items +itemGroup.gtneioreplugin=GT NEI Ore Plugin diff --git a/src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/EA.png b/src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/EA.png new file mode 100644 index 0000000000..e286109098 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/EA.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/EN.png b/src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/EN.png new file mode 100644 index 0000000000..eb8ad3262f Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/EN.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/Ne.png b/src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/Ne.png new file mode 100644 index 0000000000..664709d6da Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/Ne.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/Ow.png b/src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/Ow.png new file mode 100644 index 0000000000..95f73b28fe Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/Ow.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/TF.png b/src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/TF.png new file mode 100644 index 0000000000..bf804874d3 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/TF.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/VA.png b/src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/VA.png new file mode 100644 index 0000000000..83774cb6f1 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/VA.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/_unknown.png b/src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/_unknown.png new file mode 100644 index 0000000000..89bb66bc8e Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/items/dimensionDisplay/_unknown.png differ -- cgit From 1e423d38361b740473bc5c0674821b2b5f77ffc0 Mon Sep 17 00:00:00 2001 From: miozune Date: Wed, 13 Jul 2022 05:27:30 +0900 Subject: Rework for Dimension Display (#19) * Rework for Dimension Display * side (again) * :weary: --- .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 8 +- .../plugin/block/BlockDimensionDisplay.java | 48 +++++++++ .../gtneioreplugin/plugin/block/ModBlocks.java | 25 +++++ .../plugin/gregtech5/PluginGT5SmallOreStat.java | 2 +- .../plugin/gregtech5/PluginGT5VeinStat.java | 2 +- .../plugin/item/ItemDimensionDisplay.java | 58 +++++++++++ .../plugin/items/ItemDimensionDisplay.java | 111 -------------------- .../gtneioreplugin/plugin/items/ModItems.java | 15 --- .../renderer/ItemDimensionDisplayRenderer.java | 114 +++------------------ .../gwyog/gtneioreplugin/util/DimensionHelper.java | 2 +- .../gtneioreplugin/textures/blocks/As_left.png | Bin 0 -> 310 bytes .../gtneioreplugin/textures/blocks/As_right.png | Bin 0 -> 375 bytes .../gtneioreplugin/textures/blocks/As_top.png | Bin 0 -> 345 bytes .../gtneioreplugin/textures/blocks/BC_left.png | Bin 0 -> 408 bytes .../gtneioreplugin/textures/blocks/BC_right.png | Bin 0 -> 442 bytes .../gtneioreplugin/textures/blocks/BC_top.png | Bin 0 -> 536 bytes .../gtneioreplugin/textures/blocks/BE_left.png | Bin 0 -> 301 bytes .../gtneioreplugin/textures/blocks/BE_right.png | Bin 0 -> 315 bytes .../gtneioreplugin/textures/blocks/BE_top.png | Bin 0 -> 330 bytes .../gtneioreplugin/textures/blocks/BF_left.png | Bin 0 -> 420 bytes .../gtneioreplugin/textures/blocks/BF_right.png | Bin 0 -> 462 bytes .../gtneioreplugin/textures/blocks/BF_top.png | Bin 0 -> 375 bytes .../gtneioreplugin/textures/blocks/CB_left.png | Bin 0 -> 406 bytes .../gtneioreplugin/textures/blocks/CB_right.png | Bin 0 -> 390 bytes .../gtneioreplugin/textures/blocks/CB_top.png | Bin 0 -> 385 bytes .../gtneioreplugin/textures/blocks/Ca_left.png | Bin 0 -> 466 bytes .../gtneioreplugin/textures/blocks/Ca_right.png | Bin 0 -> 563 bytes .../gtneioreplugin/textures/blocks/Ca_top.png | Bin 0 -> 504 bytes .../gtneioreplugin/textures/blocks/Ce_left.png | Bin 0 -> 413 bytes .../gtneioreplugin/textures/blocks/Ce_right.png | Bin 0 -> 410 bytes .../gtneioreplugin/textures/blocks/Ce_top.png | Bin 0 -> 406 bytes .../gtneioreplugin/textures/blocks/DD_left.png | Bin 0 -> 719 bytes .../gtneioreplugin/textures/blocks/DD_right.png | Bin 0 -> 617 bytes .../gtneioreplugin/textures/blocks/DD_top.png | Bin 0 -> 745 bytes .../gtneioreplugin/textures/blocks/De_left.png | Bin 0 -> 479 bytes .../gtneioreplugin/textures/blocks/De_right.png | Bin 0 -> 539 bytes .../gtneioreplugin/textures/blocks/De_top.png | Bin 0 -> 436 bytes .../gtneioreplugin/textures/blocks/EA_left.png | Bin 0 -> 408 bytes .../gtneioreplugin/textures/blocks/EA_right.png | Bin 0 -> 423 bytes .../gtneioreplugin/textures/blocks/EA_top.png | Bin 0 -> 331 bytes .../gtneioreplugin/textures/blocks/ED_left.png | Bin 0 -> 467 bytes .../gtneioreplugin/textures/blocks/ED_right.png | Bin 0 -> 521 bytes .../gtneioreplugin/textures/blocks/ED_top.png | Bin 0 -> 557 bytes .../gtneioreplugin/textures/blocks/En_left.png | Bin 0 -> 620 bytes .../gtneioreplugin/textures/blocks/En_right.png | Bin 0 -> 661 bytes .../gtneioreplugin/textures/blocks/En_top.png | Bin 0 -> 533 bytes .../gtneioreplugin/textures/blocks/Eu_left.png | Bin 0 -> 442 bytes .../gtneioreplugin/textures/blocks/Eu_right.png | Bin 0 -> 430 bytes .../gtneioreplugin/textures/blocks/Eu_top.png | Bin 0 -> 465 bytes .../gtneioreplugin/textures/blocks/Ga_left.png | Bin 0 -> 402 bytes .../gtneioreplugin/textures/blocks/Ga_right.png | Bin 0 -> 388 bytes .../gtneioreplugin/textures/blocks/Ga_top.png | Bin 0 -> 464 bytes .../gtneioreplugin/textures/blocks/Ha_left.png | Bin 0 -> 454 bytes .../gtneioreplugin/textures/blocks/Ha_right.png | Bin 0 -> 451 bytes .../gtneioreplugin/textures/blocks/Ha_top.png | Bin 0 -> 436 bytes .../gtneioreplugin/textures/blocks/Io_left.png | Bin 0 -> 408 bytes .../gtneioreplugin/textures/blocks/Io_right.png | Bin 0 -> 469 bytes .../gtneioreplugin/textures/blocks/Io_top.png | Bin 0 -> 468 bytes .../gtneioreplugin/textures/blocks/KB_left.png | Bin 0 -> 476 bytes .../gtneioreplugin/textures/blocks/KB_right.png | Bin 0 -> 432 bytes .../gtneioreplugin/textures/blocks/KB_top.png | Bin 0 -> 409 bytes .../gtneioreplugin/textures/blocks/MM_left.png | Bin 0 -> 477 bytes .../gtneioreplugin/textures/blocks/MM_right.png | Bin 0 -> 479 bytes .../gtneioreplugin/textures/blocks/MM_top.png | Bin 0 -> 398 bytes .../gtneioreplugin/textures/blocks/Ma_left.png | Bin 0 -> 348 bytes .../gtneioreplugin/textures/blocks/Ma_right.png | Bin 0 -> 399 bytes .../gtneioreplugin/textures/blocks/Ma_top.png | Bin 0 -> 350 bytes .../gtneioreplugin/textures/blocks/Me_left.png | Bin 0 -> 568 bytes .../gtneioreplugin/textures/blocks/Me_right.png | Bin 0 -> 470 bytes .../gtneioreplugin/textures/blocks/Me_top.png | Bin 0 -> 543 bytes .../gtneioreplugin/textures/blocks/Mi_left.png | Bin 0 -> 561 bytes .../gtneioreplugin/textures/blocks/Mi_right.png | Bin 0 -> 489 bytes .../gtneioreplugin/textures/blocks/Mi_top.png | Bin 0 -> 502 bytes .../gtneioreplugin/textures/blocks/Mo_left.png | Bin 0 -> 465 bytes .../gtneioreplugin/textures/blocks/Mo_right.png | Bin 0 -> 413 bytes .../gtneioreplugin/textures/blocks/Mo_top.png | Bin 0 -> 495 bytes .../gtneioreplugin/textures/blocks/Ne_left.png | Bin 0 -> 438 bytes .../gtneioreplugin/textures/blocks/Ne_right.png | Bin 0 -> 492 bytes .../gtneioreplugin/textures/blocks/Ne_top.png | Bin 0 -> 506 bytes .../gtneioreplugin/textures/blocks/Ob_left.png | Bin 0 -> 477 bytes .../gtneioreplugin/textures/blocks/Ob_right.png | Bin 0 -> 437 bytes .../gtneioreplugin/textures/blocks/Ob_top.png | Bin 0 -> 395 bytes .../gtneioreplugin/textures/blocks/Ow_left.png | Bin 0 -> 733 bytes .../gtneioreplugin/textures/blocks/Ow_right.png | Bin 0 -> 700 bytes .../gtneioreplugin/textures/blocks/Ow_top.png | Bin 0 -> 816 bytes .../gtneioreplugin/textures/blocks/Ph_left.png | Bin 0 -> 374 bytes .../gtneioreplugin/textures/blocks/Ph_right.png | Bin 0 -> 380 bytes .../gtneioreplugin/textures/blocks/Ph_top.png | Bin 0 -> 414 bytes .../gtneioreplugin/textures/blocks/Pl_left.png | Bin 0 -> 389 bytes .../gtneioreplugin/textures/blocks/Pl_right.png | Bin 0 -> 379 bytes .../gtneioreplugin/textures/blocks/Pl_top.png | Bin 0 -> 457 bytes .../gtneioreplugin/textures/blocks/Pr_left.png | Bin 0 -> 402 bytes .../gtneioreplugin/textures/blocks/Pr_right.png | Bin 0 -> 350 bytes .../gtneioreplugin/textures/blocks/Pr_top.png | Bin 0 -> 373 bytes .../gtneioreplugin/textures/blocks/TE_left.png | Bin 0 -> 343 bytes .../gtneioreplugin/textures/blocks/TE_right.png | Bin 0 -> 353 bytes .../gtneioreplugin/textures/blocks/TE_top.png | Bin 0 -> 422 bytes .../gtneioreplugin/textures/blocks/TF_left.png | Bin 0 -> 463 bytes .../gtneioreplugin/textures/blocks/TF_right.png | Bin 0 -> 503 bytes .../gtneioreplugin/textures/blocks/TF_top.png | Bin 0 -> 457 bytes .../gtneioreplugin/textures/blocks/Ti_left.png | Bin 0 -> 335 bytes .../gtneioreplugin/textures/blocks/Ti_right.png | Bin 0 -> 352 bytes .../gtneioreplugin/textures/blocks/Ti_top.png | Bin 0 -> 452 bytes .../gtneioreplugin/textures/blocks/Tr_left.png | Bin 0 -> 286 bytes .../gtneioreplugin/textures/blocks/Tr_right.png | Bin 0 -> 303 bytes .../gtneioreplugin/textures/blocks/Tr_top.png | Bin 0 -> 295 bytes .../gtneioreplugin/textures/blocks/VA_left.png | Bin 0 -> 374 bytes .../gtneioreplugin/textures/blocks/VA_right.png | Bin 0 -> 446 bytes .../gtneioreplugin/textures/blocks/VA_top.png | Bin 0 -> 354 bytes .../gtneioreplugin/textures/blocks/VB_left.png | Bin 0 -> 357 bytes .../gtneioreplugin/textures/blocks/VB_right.png | Bin 0 -> 331 bytes .../gtneioreplugin/textures/blocks/VB_top.png | Bin 0 -> 383 bytes .../gtneioreplugin/textures/blocks/Ve_left.png | Bin 0 -> 399 bytes .../gtneioreplugin/textures/blocks/Ve_right.png | Bin 0 -> 440 bytes .../gtneioreplugin/textures/blocks/Ve_top.png | Bin 0 -> 364 bytes 115 files changed, 150 insertions(+), 235 deletions(-) create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/block/BlockDimensionDisplay.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/block/ModBlocks.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/items/ItemDimensionDisplay.java delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/items/ModItems.java create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/As_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/As_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/As_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/BC_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/BC_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/BC_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/BE_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/BE_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/BE_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/BF_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/BF_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/BF_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/CB_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/CB_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/CB_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/DD_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/DD_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/DD_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/De_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/De_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/De_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/EA_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/EA_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/EA_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/ED_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/ED_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/ED_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/En_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/En_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/En_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Io_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Io_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Io_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/KB_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/KB_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/KB_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/MM_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/MM_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/MM_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Me_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Me_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Me_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/TE_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/TE_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/TE_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/TF_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/TF_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/TF_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/VA_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/VA_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/VA_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/VB_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/VB_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/VB_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_top.png diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index 928fe07bd5..55a8680555 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -11,8 +11,7 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import pers.gwyog.gtneioreplugin.plugin.items.ModItems; -import pers.gwyog.gtneioreplugin.plugin.renderer.ItemDimensionDisplayRenderer; +import pers.gwyog.gtneioreplugin.plugin.block.ModBlocks; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper; @@ -75,10 +74,7 @@ public class GTNEIOrePlugin { @EventHandler public void init(FMLInitializationEvent event) { - ModItems.init(); - if (event.getSide() == Side.CLIENT) { - new ItemDimensionDisplayRenderer(); - } + ModBlocks.init(); } @EventHandler diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/BlockDimensionDisplay.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/BlockDimensionDisplay.java new file mode 100644 index 0000000000..5ef2cb04a9 --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/BlockDimensionDisplay.java @@ -0,0 +1,48 @@ +package pers.gwyog.gtneioreplugin.plugin.block; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IIcon; + +public class BlockDimensionDisplay extends Block { + + private final String dimension; + private IIcon iconTop; + private IIcon iconRight; + private IIcon iconLeft; + + public BlockDimensionDisplay(String dimension) { + super(Material.rock); + this.dimension = dimension; + } + + @Override + public IIcon getIcon(int side, int meta) { + EnumFacing direction = EnumFacing.getFront(side); + switch (direction) { + case NORTH: + case SOUTH: + return iconRight; + case WEST: + case EAST: + return iconLeft; + case UP: + case DOWN: + default: + return iconTop; + } + } + + @Override + public void registerBlockIcons(IIconRegister iconRegister) { + this.iconTop = iconRegister.registerIcon("gtneioreplugin:" + dimension + "_top"); + this.iconRight = iconRegister.registerIcon("gtneioreplugin:" + dimension + "_right"); + this.iconLeft = iconRegister.registerIcon("gtneioreplugin:" + dimension + "_left"); + } + + public String getDimension() { + return dimension; + } +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/ModBlocks.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/ModBlocks.java new file mode 100644 index 0000000000..fce0a0883e --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/ModBlocks.java @@ -0,0 +1,25 @@ +package pers.gwyog.gtneioreplugin.plugin.block; + +import cpw.mods.fml.common.registry.GameRegistry; +import java.util.HashMap; +import java.util.Map; +import net.minecraft.block.Block; +import pers.gwyog.gtneioreplugin.plugin.item.ItemDimensionDisplay; +import pers.gwyog.gtneioreplugin.util.DimensionHelper; + +public class ModBlocks { + + public static final Map blocks = new HashMap<>(); + + public static void init() { + for (String dimension : DimensionHelper.DimNameDisplayed) { + Block block = new BlockDimensionDisplay(dimension); + GameRegistry.registerBlock(block, ItemDimensionDisplay.class, "blockDimensionDisplay_" + dimension); + blocks.put(dimension, block); + } + } + + public static Block getBlock(String dimension) { + return blocks.get(dimension); + } +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java index 0955409d58..bf24ee186e 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java @@ -9,7 +9,7 @@ import java.util.Comparator; import java.util.List; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; -import pers.gwyog.gtneioreplugin.plugin.items.ItemDimensionDisplay; +import pers.gwyog.gtneioreplugin.plugin.item.ItemDimensionDisplay; import pers.gwyog.gtneioreplugin.util.DimensionHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper.OreSmallWrapper; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java index 67da9bab02..cafb69a8f6 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -11,7 +11,7 @@ import java.util.Comparator; import java.util.List; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; -import pers.gwyog.gtneioreplugin.plugin.items.ItemDimensionDisplay; +import pers.gwyog.gtneioreplugin.plugin.item.ItemDimensionDisplay; import pers.gwyog.gtneioreplugin.util.DimensionHelper; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java new file mode 100644 index 0000000000..7584cf405c --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java @@ -0,0 +1,58 @@ +package pers.gwyog.gtneioreplugin.plugin.item; + +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.relauncher.Side; +import java.util.Objects; +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraftforge.client.MinecraftForgeClient; +import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; +import pers.gwyog.gtneioreplugin.plugin.block.BlockDimensionDisplay; +import pers.gwyog.gtneioreplugin.plugin.block.ModBlocks; +import pers.gwyog.gtneioreplugin.plugin.renderer.ItemDimensionDisplayRenderer; +import pers.gwyog.gtneioreplugin.util.DimensionHelper; + +public class ItemDimensionDisplay extends ItemBlock { + + public ItemDimensionDisplay(Block block) { + super(block); + setCreativeTab(GTNEIOrePlugin.creativeTab); + + if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) { + MinecraftForgeClient.registerItemRenderer(this, new ItemDimensionDisplayRenderer()); + } + } + + public static ItemStack getItem(String dimension) { + Block block = ModBlocks.getBlock(dimension); + if (block != null) { + return new ItemStack(block); + } + return null; + } + + public static String getDimension(ItemStack stack) { + if (stack.getItem() instanceof ItemDimensionDisplay) { + return ((BlockDimensionDisplay) Block.getBlockFromItem(stack.getItem())).getDimension(); + } + return null; + } + + public static boolean isDimensionEqual(ItemStack stack1, ItemStack stack2) { + if (!(stack1.getItem() instanceof ItemDimensionDisplay) + || !(stack2.getItem() instanceof ItemDimensionDisplay)) { + return false; + } + return Objects.equals(getDimension(stack1), getDimension(stack2)); + } + + @Override + public String getItemStackDisplayName(ItemStack stack) { + String dimension = getDimension(stack); + if (dimension != null) { + return DimensionHelper.convertCondensedStringToToolTip(dimension).get(0); + } + return super.getItemStackDisplayName(stack); + } +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/items/ItemDimensionDisplay.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/items/ItemDimensionDisplay.java deleted file mode 100644 index 76be6536e8..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/items/ItemDimensionDisplay.java +++ /dev/null @@ -1,111 +0,0 @@ -package pers.gwyog.gtneioreplugin.plugin.items; - -import cpw.mods.fml.common.Loader; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.common.util.Constants; -import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; -import pers.gwyog.gtneioreplugin.util.DimensionHelper; - -public class ItemDimensionDisplay extends Item { - - private static final String TAG_DIMENSION = "dimension"; - private static final Map items = new HashMap<>(); - - public ItemDimensionDisplay() { - setUnlocalizedName(GTNEIOrePlugin.MODID + ".itemDimensionDisplay"); - setCreativeTab(GTNEIOrePlugin.creativeTab); - } - - public static ItemStack getItem(String dimension) { - if (items.get(dimension) != null) { - return items.get(dimension).copy(); - } - return null; - } - - public static void setDimension(ItemStack stack, String dimension) { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setString(TAG_DIMENSION, dimension); - stack.setTagCompound(nbt); - } - - public static String getDimension(ItemStack stack) { - if (stack.hasTagCompound() && stack.getTagCompound().hasKey(TAG_DIMENSION, Constants.NBT.TAG_STRING)) { - return stack.getTagCompound().getString(TAG_DIMENSION); - } - return null; - } - - public static boolean isDimensionEqual(ItemStack stack1, ItemStack stack2) { - if (!(stack1.getItem() instanceof ItemDimensionDisplay) - || !(stack2.getItem() instanceof ItemDimensionDisplay)) { - return false; - } - return Objects.equals(getDimension(stack1), getDimension(stack2)); - } - - @Override - public String getItemStackDisplayName(ItemStack stack) { - String dimension = getDimension(stack); - if (dimension != null) { - return DimensionHelper.convertCondensedStringToToolTip(dimension).get(0); - } - return super.getItemStackDisplayName(stack); - } - - @Override - public Item setTextureName(String p_111206_1_) { - return super.setTextureName(p_111206_1_); - } - - @SuppressWarnings("unchecked") - @Override - public void getSubItems(Item item, CreativeTabs creativeTabs, List itemList) { - for (ItemStack stack : items.values()) { - itemList.add(stack.copy()); - } - } - - public static void loadItems() { - String[] vanilla_gt = new String[] {"Ow", "Ne", "TF", "EN", "VA", "EA"}; - for (String dimension : vanilla_gt) { - ItemStack stack = new ItemStack(ModItems.itemDimensionDisplay); - setDimension(stack, dimension); - items.put(dimension, stack); - } - String[] gc = new String[] {"Mo", "Ma", "As"}; - if (Loader.isModLoaded("GalacticraftCore")) { - for (String dimension : gc) { - ItemStack stack = new ItemStack(ModItems.itemDimensionDisplay); - setDimension(stack, dimension); - items.put(dimension, stack); - } - } - String[] gs = new String[] { - "De", "Ph", "Ca", "Ce", "Eu", "Ga", "Io", "Me", "Ve", "En", "Mi", "Ob", "Ti", "Pr", "Tr", "Ha", "KB", "MM", - "Pl", "BC", "BE", "BF", "CB", "TE", "VB" - }; - if (Loader.isModLoaded("GalaxySpace")) { - for (String dimension : gs) { - ItemStack stack = new ItemStack(ModItems.itemDimensionDisplay); - setDimension(stack, dimension); - items.put(dimension, stack); - } - } - String[] xu = new String[] {"DD"}; - if (Loader.isModLoaded("ExtraUtilities")) { - for (String dimension : xu) { - ItemStack stack = new ItemStack(ModItems.itemDimensionDisplay); - setDimension(stack, dimension); - items.put(dimension, stack); - } - } - } -} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/items/ModItems.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/items/ModItems.java deleted file mode 100644 index 1a519c4548..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/items/ModItems.java +++ /dev/null @@ -1,15 +0,0 @@ -package pers.gwyog.gtneioreplugin.plugin.items; - -import cpw.mods.fml.common.registry.GameRegistry; -import net.minecraft.item.Item; -import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; - -public class ModItems { - - public static Item itemDimensionDisplay = new ItemDimensionDisplay(); - - public static void init() { - GameRegistry.registerItem(itemDimensionDisplay, "itemDimensionDisplay", GTNEIOrePlugin.MODID); - ItemDimensionDisplay.loadItems(); - } -} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java index d85a3764d3..3b281713f7 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java @@ -2,25 +2,19 @@ package pers.gwyog.gtneioreplugin.plugin.renderer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; -import net.minecraftforge.client.MinecraftForgeClient; import org.lwjgl.opengl.GL11; -import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; -import pers.gwyog.gtneioreplugin.plugin.items.ItemDimensionDisplay; -import pers.gwyog.gtneioreplugin.plugin.items.ModItems; +import pers.gwyog.gtneioreplugin.plugin.item.ItemDimensionDisplay; public class ItemDimensionDisplayRenderer implements IItemRenderer { - public ItemDimensionDisplayRenderer() { - MinecraftForgeClient.registerItemRenderer(ModItems.itemDimensionDisplay, this); - } + private final RenderItem renderItem = new RenderItem(); @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return true; + return type == ItemRenderType.INVENTORY; } @Override @@ -29,112 +23,32 @@ public class ItemDimensionDisplayRenderer implements IItemRenderer { } @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - String dimension = ItemDimensionDisplay.getDimension(item); + public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { + String dimension = ItemDimensionDisplay.getDimension(stack); if (dimension == null) { return; } - GL11.glEnable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_ALPHA_TEST); - - Minecraft.getMinecraft().renderEngine.bindTexture(getResourceLocation(dimension)); - - Tessellator tess = Tessellator.instance; - tess.startDrawingQuads(); - tess.addVertexWithUV(0, 16, 0, 0, 1); - tess.addVertexWithUV(16, 16, 0, 1, 1); - tess.addVertexWithUV(16, 0, 0, 1, 0); - tess.addVertexWithUV(0, 0, 0, 0, 0); - tess.draw(); - - GL11.glDisable(GL11.GL_BLEND); + renderItem.renderItemIntoGUI( + Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().renderEngine, stack, 0, 0, false); String prefix = getPrefix(dimension); if (!prefix.isEmpty()) { FontRenderer fontRender = Minecraft.getMinecraft().fontRenderer; - float smallTextScale = fontRender.getUnicodeFlag() ? 3F / 4F : 1F / 2F; + float smallTextScale = 3F / 4F; + + GL11.glPushMatrix(); + GL11.glTranslatef(0, 0, 300); GL11.glScalef(smallTextScale, smallTextScale, 1.0f); fontRender.drawString(prefix, 0, (int) (16 / smallTextScale) - fontRender.FONT_HEIGHT + 1, 0xFFFFFF, true); + + GL11.glPopMatrix(); } GL11.glDisable(GL11.GL_ALPHA_TEST); } - private ResourceLocation getResourceLocation(String dimension) { - switch (dimension) { - case "Ow": - case "Ne": - case "TF": - case "EN": - case "VA": - case "EA": - return new ResourceLocation( - GTNEIOrePlugin.MODID, String.format("textures/items/dimensionDisplay/%s.png", dimension)); - case "Mo": - return new ResourceLocation("galacticraftcore:textures/gui/celestialbodies/moon.png"); - case "De": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/deimos.png"); - case "Ma": - return new ResourceLocation("galacticraftcore:textures/gui/celestialbodies/mars.png"); - case "Ph": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/phobos.png"); - case "As": - return new ResourceLocation("galacticraftcore:textures/gui/celestialbodies/asteroid.png"); - case "Ca": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/callisto.png"); - case "Ce": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/ceres.png"); - case "Eu": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/europa.png"); - case "Ga": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/ganymede.png"); - case "Io": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/io.png"); - case "Me": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/mercury.png"); - case "Ve": - return new ResourceLocation("galacticraftcore:textures/gui/celestialbodies/venus.png"); - case "En": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/enceladus.png"); - case "Mi": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/miranda.png"); - case "Ob": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/oberon.png"); - case "Ti": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/titan.png"); - case "Pr": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/proteus.png"); - case "Tr": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/triton.png"); - case "Ha": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/haumea.png"); - case "KB": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/kuiperbelt.png"); - case "MM": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/makemake.png"); - case "Pl": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/pluto.png"); - case "BC": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/barnards/Barnarda2.png"); - case "BE": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/barnards/Barnarda4.png"); - case "BF": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/barnards/Barnarda5.png"); - case "CB": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/aCentauri/CentauriBb.png"); - case "TE": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/tceti/TCetiE.png"); - case "DD": - return new ResourceLocation("extrautils:textures/blocks/dark_portal.png"); - case "VB": - return new ResourceLocation("galaxyspace:textures/gui/celestialbodies/vega/Vega1.png"); - default: - return new ResourceLocation(GTNEIOrePlugin.MODID, "textures/items/dimensionDisplay/_unknown.png"); - } - } - private static String getPrefix(String dimName) { switch (dimName) { case "Mo": diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java index ac4ceb6f95..90d49d7e35 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -63,7 +63,7 @@ public class DimensionHelper { "Ow", // Overworld "Ne", // Nether "TF", // Twilight - "EN", // TheEnd because En = Encalus + "ED", // TheEnd because En = Encalus "VA", // Vanilla_EndAsteroids "EA", // EndAsteroid // T1 diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/As_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_left.png new file mode 100644 index 0000000000..e8ebe8ff3c Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/As_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_right.png new file mode 100644 index 0000000000..bf429a9420 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/As_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_top.png new file mode 100644 index 0000000000..fb3fa76d68 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_left.png new file mode 100644 index 0000000000..08e3476679 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_right.png new file mode 100644 index 0000000000..98bedd24a9 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_top.png new file mode 100644 index 0000000000..d80c0cfbe1 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_left.png new file mode 100644 index 0000000000..2bd9239b54 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_right.png new file mode 100644 index 0000000000..3236dc3092 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_top.png new file mode 100644 index 0000000000..438183edf9 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_left.png new file mode 100644 index 0000000000..390fc007b2 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_right.png new file mode 100644 index 0000000000..2938c597e5 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_top.png new file mode 100644 index 0000000000..a4e895b930 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_left.png new file mode 100644 index 0000000000..3e7acb325b Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_right.png new file mode 100644 index 0000000000..dd0cc29823 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_top.png new file mode 100644 index 0000000000..a6f6fdbdbb Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_left.png new file mode 100644 index 0000000000..285a3519d4 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_right.png new file mode 100644 index 0000000000..50e1d57261 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_top.png new file mode 100644 index 0000000000..3ff0b305f6 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_left.png new file mode 100644 index 0000000000..f4daab3c5e Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_right.png new file mode 100644 index 0000000000..19e924851d Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_top.png new file mode 100644 index 0000000000..290dc98d23 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_left.png new file mode 100644 index 0000000000..3186eb20be Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_right.png new file mode 100644 index 0000000000..0b48b98f57 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_top.png new file mode 100644 index 0000000000..922d37b763 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/De_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_left.png new file mode 100644 index 0000000000..052a0fd801 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/De_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_right.png new file mode 100644 index 0000000000..ca83e70c83 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/De_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_top.png new file mode 100644 index 0000000000..eedde3785d Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_left.png new file mode 100644 index 0000000000..eff9de3bf6 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_right.png new file mode 100644 index 0000000000..2c3039c69c Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_top.png new file mode 100644 index 0000000000..7c8a535ce6 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_left.png new file mode 100644 index 0000000000..330b5d7411 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_right.png new file mode 100644 index 0000000000..5e8cb34706 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_top.png new file mode 100644 index 0000000000..2a7a8d6a40 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/En_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_left.png new file mode 100644 index 0000000000..f3ee55057c Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/En_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_right.png new file mode 100644 index 0000000000..5bd0879be1 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/En_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_top.png new file mode 100644 index 0000000000..49e0ed3b9c Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_left.png new file mode 100644 index 0000000000..b92e12f527 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_right.png new file mode 100644 index 0000000000..1146d74451 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_top.png new file mode 100644 index 0000000000..c8da5f6000 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_left.png new file mode 100644 index 0000000000..ac8d6b2495 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_right.png new file mode 100644 index 0000000000..c35cab6541 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_top.png new file mode 100644 index 0000000000..dad022650a Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_left.png new file mode 100644 index 0000000000..5d9eba9359 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_right.png new file mode 100644 index 0000000000..168b16839a Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_top.png new file mode 100644 index 0000000000..d22edd8a5d Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_left.png new file mode 100644 index 0000000000..461e7efbbc Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_right.png new file mode 100644 index 0000000000..a6018d4171 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_top.png new file mode 100644 index 0000000000..848dd243b2 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_left.png new file mode 100644 index 0000000000..249ce029d9 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_right.png new file mode 100644 index 0000000000..86b795ba93 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_top.png new file mode 100644 index 0000000000..d3f21d7f44 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_left.png new file mode 100644 index 0000000000..9efcc23d2d Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_right.png new file mode 100644 index 0000000000..825f55bf85 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_top.png new file mode 100644 index 0000000000..8e4b5a293e Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_left.png new file mode 100644 index 0000000000..0855bc7b0b Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_right.png new file mode 100644 index 0000000000..5d4344d3c3 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_top.png new file mode 100644 index 0000000000..fb75b85b47 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_left.png new file mode 100644 index 0000000000..03c968b03d Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_right.png new file mode 100644 index 0000000000..ad829dcea5 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_top.png new file mode 100644 index 0000000000..5f43d1426b Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_left.png new file mode 100644 index 0000000000..9639444c22 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_right.png new file mode 100644 index 0000000000..a334c5b85f Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_top.png new file mode 100644 index 0000000000..58ea1e12bb Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_left.png new file mode 100644 index 0000000000..ddb95f761c Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_right.png new file mode 100644 index 0000000000..727fa3a3a1 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_top.png new file mode 100644 index 0000000000..5bf05a9b60 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_left.png new file mode 100644 index 0000000000..b91dcd0f31 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_right.png new file mode 100644 index 0000000000..b27223a93e Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_top.png new file mode 100644 index 0000000000..97166de028 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_left.png new file mode 100644 index 0000000000..fe3fc6cd8d Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_right.png new file mode 100644 index 0000000000..7a5aececef Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_top.png new file mode 100644 index 0000000000..97c46c3771 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_left.png new file mode 100644 index 0000000000..e8c1f84a67 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_right.png new file mode 100644 index 0000000000..eef1391057 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_top.png new file mode 100644 index 0000000000..055ab23b47 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_left.png new file mode 100644 index 0000000000..71e05289bc Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_right.png new file mode 100644 index 0000000000..7ffa6569be Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_top.png new file mode 100644 index 0000000000..8be6fa5f56 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_left.png new file mode 100644 index 0000000000..148400234c Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_right.png new file mode 100644 index 0000000000..b8668cfd4d Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_top.png new file mode 100644 index 0000000000..2e10f711b3 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_left.png new file mode 100644 index 0000000000..fad9ac0b19 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_right.png new file mode 100644 index 0000000000..d4a1da8594 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_top.png new file mode 100644 index 0000000000..8bc3209ee7 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_left.png new file mode 100644 index 0000000000..00be257e51 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_right.png new file mode 100644 index 0000000000..9fa5badcd6 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_top.png new file mode 100644 index 0000000000..f20c02d574 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_left.png new file mode 100644 index 0000000000..a231fe5915 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_right.png new file mode 100644 index 0000000000..94c7c27470 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_top.png new file mode 100644 index 0000000000..795540b3d4 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_left.png new file mode 100644 index 0000000000..cca5d11ea3 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_right.png new file mode 100644 index 0000000000..6e7b9cc2ff Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_top.png new file mode 100644 index 0000000000..22ca8ea36e Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_left.png new file mode 100644 index 0000000000..d2abe17365 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_right.png new file mode 100644 index 0000000000..7fc58a438f Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_top.png new file mode 100644 index 0000000000..5e92db08e6 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_left.png new file mode 100644 index 0000000000..520529a043 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_right.png new file mode 100644 index 0000000000..1f10338d26 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_top.png new file mode 100644 index 0000000000..733204cb34 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_left.png new file mode 100644 index 0000000000..81e17f66aa Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_right.png new file mode 100644 index 0000000000..ad742e1c2f Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_top.png new file mode 100644 index 0000000000..a58b98974d Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_left.png new file mode 100644 index 0000000000..c63503ca8d Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_right.png new file mode 100644 index 0000000000..87a0c84992 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_top.png new file mode 100644 index 0000000000..76a348b458 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_top.png differ -- cgit From 8d107e3f476534032f321a941891f2c567119ac1 Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Sat, 16 Jul 2022 10:48:35 -0700 Subject: [ci skip] Migrate github actions to GTNH-Actions-Workflows --- .github/workflows/build-and-test.yml | 36 ++----------------------- .github/workflows/release-tags.yml | 51 +++++------------------------------- 2 files changed, 9 insertions(+), 78 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 56a1ad52cc..3ee2f686fd 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -1,5 +1,3 @@ -# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle name: Build and test @@ -11,35 +9,5 @@ on: jobs: build-and-test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Set up JDK 8 - uses: actions/setup-java@v2 - with: - java-version: '8' - distribution: 'adopt' - cache: gradle - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - - name: Setup the workspace - run: ./gradlew setupCIWorkspace - - - name: Build the mod - run: ./gradlew build - - - name: Run server for 1.5 minutes - run: | - mkdir run - echo "eula=true" > run/eula.txt - timeout 90 ./gradlew runServer 2>&1 | tee -a server.log || true - - - name: Test no errors reported during server run - run: | - chmod +x .github/scripts/test_no_error_reports - .github/scripts/test_no_error_reports + uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master + secrets: inherit diff --git a/.github/workflows/release-tags.yml b/.github/workflows/release-tags.yml index c86d8889b7..e4c0be6b0d 100644 --- a/.github/workflows/release-tags.yml +++ b/.github/workflows/release-tags.yml @@ -1,51 +1,14 @@ -# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle name: Release tagged build on: push: - tags: - - '*' + tags: [ '*' ] -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Set release version - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - - - name: Set up JDK 8 - uses: actions/setup-java@v2 - with: - java-version: '8' - distribution: 'adopt' - cache: gradle - - - name: Grant execute permission for gradlew - run: chmod +x gradlew +permissions: + contents: write - - name: Setup the workspace - run: ./gradlew setupCIWorkspace - - - name: Build the mod - run: ./gradlew build - - - name: Release under current tag - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "${{ env.RELEASE_VERSION }}" - prerelease: false - title: "${{ env.RELEASE_VERSION }}" - files: build/libs/*.jar - - - name: Publish to Maven - run: ./gradlew publish - env: - MAVEN_USER: ${{ secrets.MAVEN_USER }} - MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} +jobs: + release-tags: + uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master + secrets: inherit -- cgit From 4eeee867cb1a0d09fdbb77f05a94be65be7751c3 Mon Sep 17 00:00:00 2001 From: miozune Date: Tue, 2 Aug 2022 18:23:15 +0900 Subject: Underground fluid NEI (#20) * Underground fluid NEI * updateBuildScript --- build.gradle | 426 +++++++++++---------- dependencies.gradle | 8 +- repositories.gradle | 36 +- settings.gradle | 10 + .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 4 + .../gwyog/gtneioreplugin/plugin/IMCForNEI.java | 57 +++ .../gtneioreplugin/plugin/NEIPluginConfig.java | 4 + .../gwyog/gtneioreplugin/plugin/PluginBase.java | 10 +- .../plugin/gregtech5/PluginGT5Base.java | 9 - .../gregtech5/PluginGT5UndergroundFluid.java | 165 ++++++++ .../plugin/item/ItemDimensionDisplay.java | 5 + .../renderer/ItemDimensionDisplayRenderer.java | 2 + .../gwyog/gtneioreplugin/util/DimensionHelper.java | 21 +- .../util/GT5UndergroundFluidHelper.java | 170 ++++++++ .../assets/gtneioreplugin/lang/en_US.lang | 6 + .../gtneioreplugin/textures/blocks/Ra_left.png | Bin 0 -> 446 bytes .../gtneioreplugin/textures/blocks/Ra_right.png | Bin 0 -> 426 bytes .../gtneioreplugin/textures/blocks/Ra_top.png | Bin 0 -> 521 bytes .../gtneioreplugin/textures/blocks/Rb_left.png | Bin 0 -> 492 bytes .../gtneioreplugin/textures/blocks/Rb_right.png | Bin 0 -> 511 bytes .../gtneioreplugin/textures/blocks/Rb_top.png | Bin 0 -> 496 bytes 21 files changed, 685 insertions(+), 248 deletions(-) create mode 100644 settings.gradle create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java create mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_top.png diff --git a/build.gradle b/build.gradle index e182c451c6..ec6cfc966c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,9 @@ -//version: 1656760175 +//version: 1659365110 /* -DO NOT CHANGE THIS FILE! - -Also, you may replace this file at any time if there is an update available. -Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates. -*/ + DO NOT CHANGE THIS FILE! + Also, you may replace this file at any time if there is an update available. + Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates. + */ import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation @@ -21,6 +20,8 @@ import java.util.zip.ZipOutputStream buildscript { repositories { + mavenCentral() + maven { name 'forge' url 'https://maven.minecraftforge.net' @@ -42,7 +43,6 @@ buildscript { classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.7' } } - plugins { id 'java-library' id 'idea' @@ -59,6 +59,13 @@ plugins { id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false id "com.diffplug.spotless" version "6.7.2" } +verifySettingsGradle() + +dependencies { + implementation 'com.diffplug:blowdryer:1.6.0' +} + +apply plugin: 'com.diffplug.blowdryer' if (project.file('.git/HEAD').isFile()) { apply plugin: 'com.palantir.git-version' @@ -83,37 +90,7 @@ idea { downloadSources = true } } - -// Spotless autoformatter -// See https://github.com/diffplug/spotless/tree/main/plugin-gradle -// Can be locally toggled via spotless:off/spotless:on comments -spotless { - encoding 'UTF-8' - - format 'misc', { - target '.gitignore' - - trimTrailingWhitespace() - indentWithSpaces(4) - endWithNewline() - } - java { - toggleOffOn() - importOrder() - removeUnusedImports() - palantirJavaFormat('1.1.0') // last version supporting jvm 8 - } - kotlin { - toggleOffOn() - ktfmt('0.39') - } - groovyGradle { - toggleOffOn() - importOrder() - target '*.gradle' - greclipse('4.19.0') // last version supporting jvm 8 - } -} +apply from: Blowdryer.file('spotless.gradle') if(JavaVersion.current() != JavaVersion.VERSION_1_8) { throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current()) @@ -140,12 +117,11 @@ checkPropertyExists("containsMixinsAndOrCoreModOnly") checkPropertyExists("usesShadowedDependencies") checkPropertyExists("developmentEnvironmentUserName") -boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false -boolean usesMixinDebug = project.findProperty('usesMixinDebug') ?: project.usesMixins.toBoolean() -String channel = project.findProperty('channel') ? project.channel : 'stable' -String mappingsVersion = project.findProperty('mappingsVersion') ? project.mappingsVersion : '12' -String remoteMappings = project.findProperty('remoteMappings') ? project.remoteMappings : 'https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/' - +boolean noPublishedSources = project.hasProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false +boolean usesMixinDebug = project.hasProperty('usesMixinDebug') ?: project.usesMixins.toBoolean() +boolean forceEnableMixins = project.hasProperty('forceEnableMixins') ? project.forceEnableMixins.toBoolean() : false +String channel = project.hasProperty('channel') ? project.channel : 'stable' +String mappingsVersion = project.hasProperty('mappingsVersion') ? project.mappingsVersion : '12' String javaSourceDir = "src/main/java/" String scalaSourceDir = "src/main/scala/" String kotlinSourceDir = "src/main/kotlin/" @@ -228,10 +204,10 @@ try { } catch (Exception ignored) { out.style(Style.Failure).text( - 'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' + - 'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' + - 'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)' - ) + 'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' + + 'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' + + 'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)' + ) versionOverride = 'NO-GIT-TAG-SET' identifiedVersion = versionOverride } @@ -255,7 +231,7 @@ else { def arguments = [] def jvmArguments = [] -if (usesMixins.toBoolean()) { +if (usesMixins.toBoolean() || forceEnableMixins) { arguments += [ "--tweakClass org.spongepowered.asm.launch.MixinTweaker" ] @@ -320,7 +296,7 @@ repositories { name 'Overmind forge repo mirror' url 'https://gregtech.overminddl1.com/' } - if(usesMixins.toBoolean()) { + if(usesMixins.toBoolean() || forceEnableMixins) { maven { name 'sponge' url 'https://repo.spongepowered.org/repository/maven-public' @@ -337,6 +313,8 @@ dependencies { annotationProcessor('com.google.guava:guava:24.1.1-jre') annotationProcessor('com.google.code.gson:gson:2.8.6') annotationProcessor('org.spongepowered:mixin:0.8-SNAPSHOT') + } + if(usesMixins.toBoolean() || forceEnableMixins) { // using 0.8 to workaround a issue in 0.7 which fails mixin application compile('com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH') { // Mixin includes a lot of dependencies that are too up-to-date @@ -394,7 +372,10 @@ shadowJar { } minimize() // This will only allow shading for actually used classes - configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile] + configurations = [ + project.configurations.shadowImplementation, + project.configurations.shadowCompile + ] dependsOn(relocateShadowJar) } @@ -425,12 +406,12 @@ afterEvaluate { if(usesMixins.toBoolean()) { tasks.compileJava { options.compilerArgs += [ - "-AreobfSrgFile=${tasks.reobf.srg}", - "-AoutSrgFile=${mixinSrg}", - "-AoutRefMapFile=${refMap}", - // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code - "-XDenableSunApiLintControl", - "-XDignore.symbol.file" + "-AreobfSrgFile=${tasks.reobf.srg}", + "-AoutSrgFile=${mixinSrg}", + "-AoutRefMapFile=${refMap}", + // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code + "-XDenableSunApiLintControl", + "-XDignore.symbol.file" ] } } @@ -439,8 +420,8 @@ afterEvaluate { runClient { if(developmentEnvironmentUserName) { arguments += [ - "--username", - developmentEnvironmentUserName + "--username", + developmentEnvironmentUserName ] } @@ -458,13 +439,14 @@ tasks.withType(JavaExec).configureEach { javaToolchains.launcherFor { languageVersion = projectJavaVersion } - ) + ) } processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version + exclude("spotless.gradle") // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { @@ -472,9 +454,9 @@ processResources { // replace modVersion and minecraftVersion expand "minecraftVersion": project.minecraft.version, - "modVersion": modVersion, - "modId": modId, - "modName": modName + "modVersion": modVersion, + "modId": modId, + "modName": modName } if(usesMixins.toBoolean()) { @@ -484,6 +466,7 @@ processResources { // copy everything else that's not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' + exclude 'spotless.gradle' } } @@ -503,9 +486,9 @@ def getManifestAttributes() { if(usesMixins.toBoolean()) { manifestAttributes += [ - "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", - "MixinConfigs" : "mixins." + modId + ".json", - "ForceLoadAsMod" : !containsMixinsAndOrCoreModOnly.toBoolean() + "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", + "MixinConfigs" : "mixins." + modId + ".json", + "ForceLoadAsMod" : !containsMixinsAndOrCoreModOnly.toBoolean() ] } return manifestAttributes @@ -532,7 +515,10 @@ task shadowDevJar(type: ShadowJar) { } minimize() // This will only allow shading for actually used classes - configurations = [project.configurations.shadowImplementation, project.configurations.shadowCompile] + configurations = [ + project.configurations.shadowImplementation, + project.configurations.shadowCompile + ] } task relocateShadowDevJar(type: ConfigureShadowRelocation) { @@ -624,7 +610,10 @@ publishing { // remove extra garbage from minecraft and minecraftDeps configuration pom.withXml { def badArtifacts = [:].withDefault {[] as Set} - for (configuration in [projectConfigs.minecraft, projectConfigs.minecraftDeps]) { + for (configuration in [ + projectConfigs.minecraft, + projectConfigs.minecraftDeps + ]) { for (dependency in configuration.allDependencies) { badArtifacts[dependency.group == null ? "" : dependency.group] += dependency.name } @@ -658,7 +647,7 @@ task updateBuildScript { doLast { if (performBuildScriptUpdate(projectDir.toString())) return - print("Build script already up-to-date!") + print("Build script already up-to-date!") } } @@ -673,12 +662,26 @@ if (isNewBuildScriptVersionAvailable(projectDir.toString())) { static URL availableBuildScriptUrl() { new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/build.gradle") } +static URL exampleSettingsGradleUrl() { + new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/settings.gradle.example") +} + + +def verifySettingsGradle() { + def settingsFile = getFile("settings.gradle") + if (!settingsFile.exists()) { + println("Downloading default settings.gradle") + exampleSettingsGradleUrl().withInputStream { i -> settingsFile.withOutputStream { it << i } } + throw new GradleException("Settings.gradle has been updated, please re-run task.") + } +} boolean performBuildScriptUpdate(String projectDir) { if (isNewBuildScriptVersionAvailable(projectDir)) { def buildscriptFile = getFile("build.gradle") availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } } out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!") + verifySettingsGradle() return true } return false @@ -739,194 +742,195 @@ task deobfParams { } out.style(Style.Success).println("Modified ${replaceParams(file("$projectDir/src/main/java"), params)} files!") - out.style(Style.Failure).println("Don't forget to verify that the code still works as before!\n It could be broken due to duplicate variables existing now\n or parameters taking priority over other variables.") - } + out.style(Style.Failure).println("Don't forget to verify that the code still works as before!\n It could be broken due to duplicate variables existing now\n or parameters taking priority over other variables.") +} } static int replaceParams(File file, Map params) { - int fileCount = 0 +int fileCount = 0 - if(file.isDirectory()) { - for(File f : file.listFiles()) { - fileCount += replaceParams(f, params) - } - return fileCount - } - println("Visiting ${file.getName()} ...") - try { - String content = new String(Files.readAllBytes(file.toPath())) - int hash = content.hashCode() - params.forEach{key, value -> - content = content.replaceAll(key, value) - } - if(hash != content.hashCode()) { - Files.write(file.toPath(), content.getBytes("UTF-8")) - return 1 - } - } catch(Exception e) { - e.printStackTrace() +if(file.isDirectory()) { + for(File f : file.listFiles()) { + fileCount += replaceParams(f, params) } - return 0 + return fileCount +} +println("Visiting ${file.getName()} ...") +try { + String content = new String(Files.readAllBytes(file.toPath())) + int hash = content.hashCode() + params.forEach{key, value -> + content = content.replaceAll(key, value) + } + if(hash != content.hashCode()) { + Files.write(file.toPath(), content.getBytes("UTF-8")) + return 1 + } +} catch(Exception e) { + e.printStackTrace() +} +return 0 } // Credit: bitsnaps (https://gist.github.com/bitsnaps/00947f2dce66f4bbdabc67d7e7b33681) static unzip(String zipFileName, String outputDir) { - byte[] buffer = new byte[16384] - ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFileName)) - ZipEntry zipEntry = zis.getNextEntry() - while (zipEntry != null) { - File newFile = new File(outputDir + File.separator, zipEntry.name) - if (zipEntry.isDirectory()) { - if (!newFile.isDirectory() && !newFile.mkdirs()) { - throw new IOException("Failed to create directory $newFile") - } - } else { - // fix for Windows-created archives - File parent = newFile.parentFile - if (!parent.isDirectory() && !parent.mkdirs()) { - throw new IOException("Failed to create directory $parent") - } - // write file content - FileOutputStream fos = new FileOutputStream(newFile) - int len = 0 - while ((len = zis.read(buffer)) > 0) { - fos.write(buffer, 0, len) - } - fos.close() - } - zipEntry = zis.getNextEntry() - } - zis.closeEntry() - zis.close() +byte[] buffer = new byte[16384] +ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFileName)) +ZipEntry zipEntry = zis.getNextEntry() +while (zipEntry != null) { + File newFile = new File(outputDir + File.separator, zipEntry.name) + if (zipEntry.isDirectory()) { + if (!newFile.isDirectory() && !newFile.mkdirs()) { + throw new IOException("Failed to create directory $newFile") + } + } else { + // fix for Windows-created archives + File parent = newFile.parentFile + if (!parent.isDirectory() && !parent.mkdirs()) { + throw new IOException("Failed to create directory $parent") + } + // write file content + FileOutputStream fos = new FileOutputStream(newFile) + int len = 0 + while ((len = zis.read(buffer)) > 0) { + fos.write(buffer, 0, len) + } + fos.close() + } + zipEntry = zis.getNextEntry() +} +zis.closeEntry() +zis.close() } configure(deobfParams) { - group = 'forgegradle' - description = 'Rename all obfuscated parameter names inherited from Minecraft classes' +group = 'forgegradle' +description = 'Rename all obfuscated parameter names inherited from Minecraft classes' } // Dependency Deobfuscation def deobf(String sourceURL) { - try { - URL url = new URL(sourceURL) - String fileName = url.getFile() - - //get rid of directories: - int lastSlash = fileName.lastIndexOf("/") - if(lastSlash > 0) { - fileName = fileName.substring(lastSlash + 1) - } - //get rid of extension: - if(fileName.endsWith(".jar") || fileName.endsWith(".litemod")) { - fileName = fileName.substring(0, fileName.lastIndexOf(".")) - } +try { + URL url = new URL(sourceURL) + String fileName = url.getFile() - String hostName = url.getHost() - if(hostName.startsWith("www.")) { - hostName = hostName.substring(4) - } - List parts = Arrays.asList(hostName.split("\\.")) - Collections.reverse(parts) - hostName = String.join(".", parts) + //get rid of directories: + int lastSlash = fileName.lastIndexOf("/") + if(lastSlash > 0) { + fileName = fileName.substring(lastSlash + 1) + } + //get rid of extension: + if(fileName.endsWith(".jar") || fileName.endsWith(".litemod")) { + fileName = fileName.substring(0, fileName.lastIndexOf(".")) + } - return deobf(sourceURL, "$hostName/$fileName") - } catch(Exception e) { - return deobf(sourceURL, "deobf/${sourceURL.hashCode()}") + String hostName = url.getHost() + if(hostName.startsWith("www.")) { + hostName = hostName.substring(4) } + List parts = Arrays.asList(hostName.split("\\.")) + Collections.reverse(parts) + hostName = String.join(".", parts) + + return deobf(sourceURL, "$hostName/$fileName") +} catch(Exception e) { + return deobf(sourceURL, "deobf/${sourceURL.hashCode()}") +} } // The method above is to be preferred. Use this method if the filename is not at the end of the URL. def deobf(String sourceURL, String rawFileName) { - String bon2Version = "2.5.1" - String fileName = URLDecoder.decode(rawFileName, "UTF-8") - String cacheDir = "$project.gradle.gradleUserHomeDir/caches" - String bon2Dir = "$cacheDir/forge_gradle/deobf" - String bon2File = "$bon2Dir/BON2-${bon2Version}.jar" - String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar" - String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar" - - if(file(deobfFile).exists()) { - return files(deobfFile) - } +String bon2Version = "2.5.1" +String fileName = URLDecoder.decode(rawFileName, "UTF-8") +String cacheDir = "$project.gradle.gradleUserHomeDir/caches" +String bon2Dir = "$cacheDir/forge_gradle/deobf" +String bon2File = "$bon2Dir/BON2-${bon2Version}.jar" +String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar" +String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar" + +if(file(deobfFile).exists()) { + return files(deobfFile) +} - String mappingsVer - if(remoteMappings) { - String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion" - String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip" +String mappingsVer +String remoteMappings = project.hasProperty('remoteMappings') ? project.remoteMappings : 'https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/' +if(remoteMappings) { + String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion" + String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip" - zipMappings(mappingsZIP, remoteMappings, bon2Dir) + zipMappings(mappingsZIP, remoteMappings, bon2Dir) - mappingsVer = "snapshot_$id" - } else { - mappingsVer = "${channel}_$mappingsVersion" - } + mappingsVer = "snapshot_$id" +} else { + mappingsVer = "${channel}_$mappingsVersion" +} - download.run { - src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar" - dest bon2File - quiet true - overwrite false - } +download.run { + src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar" + dest bon2File + quiet true + overwrite false +} - download.run { - src sourceURL - dest obfFile - quiet true - overwrite false - } +download.run { + src sourceURL + dest obfFile + quiet true + overwrite false +} - exec { - commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch' - workingDir bon2Dir - standardOutput = new FileOutputStream("${deobfFile}.log") - } +exec { + commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch' + workingDir bon2Dir + standardOutput = new FileOutputStream("${deobfFile}.log") +} - return files(deobfFile) +return files(deobfFile) } def zipMappings(String zipPath, String url, String bon2Dir) { - File zipFile = new File(zipPath) - if(zipFile.exists()) { - return - } +File zipFile = new File(zipPath) +if(zipFile.exists()) { + return +} - String fieldsCache = "$bon2Dir/data/fields.csv" - String methodsCache = "$bon2Dir/data/methods.csv" +String fieldsCache = "$bon2Dir/data/fields.csv" +String methodsCache = "$bon2Dir/data/methods.csv" - download.run { - src "${url}fields.csv" - dest fieldsCache - quiet true - } - download.run { - src "${url}methods.csv" - dest methodsCache - quiet true - } +download.run { + src "${url}fields.csv" + dest fieldsCache + quiet true +} +download.run { + src "${url}methods.csv" + dest methodsCache + quiet true +} - zipFile.getParentFile().mkdirs() - ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile)) +zipFile.getParentFile().mkdirs() +ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile)) - zos.putNextEntry(new ZipEntry("fields.csv")) - Files.copy(Paths.get(fieldsCache), zos) - zos.closeEntry() +zos.putNextEntry(new ZipEntry("fields.csv")) +Files.copy(Paths.get(fieldsCache), zos) +zos.closeEntry() - zos.putNextEntry(new ZipEntry("methods.csv")) - Files.copy(Paths.get(methodsCache), zos) - zos.closeEntry() +zos.putNextEntry(new ZipEntry("methods.csv")) +Files.copy(Paths.get(methodsCache), zos) +zos.closeEntry() - zos.close() +zos.close() } // Helper methods def checkPropertyExists(String propertyName) { - if (!project.hasProperty(propertyName)) { - throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties") - } +if (!project.hasProperty(propertyName)) { + throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties") +} } def getFile(String relativePath) { - return new File(projectDir, relativePath) +return new File(projectDir, relativePath) } diff --git a/dependencies.gradle b/dependencies.gradle index a94333541e..18093d7d3d 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,10 +1,10 @@ // Add your dependencies here dependencies { - compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.39:dev') - compile('com.github.GTNewHorizons:NotEnoughItems:2.2.19-GTNH:dev') + compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.39:dev') + compile('com.github.GTNewHorizons:NotEnoughItems:2.2.19-GTNH:dev') - compile('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev') + compile('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev') - compileOnly('com.opencsv:opencsv:4.0') + compileOnly('com.opencsv:opencsv:4.0') } diff --git a/repositories.gradle b/repositories.gradle index f67e7c627d..e850975183 100644 --- a/repositories.gradle +++ b/repositories.gradle @@ -1,22 +1,22 @@ // Add any additional repositiroes for your dependencies here repositories { - maven { - name 'GTNH Maven' - url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/' - } - maven { - name 'ic2' - url 'http://maven.ic2.player.to/' - metadataSources { - mavenPom() - artifact() - } - } - maven { - url 'https://cursemaven.com' - content { - includeGroup 'curse.maven' - } - } + maven { + name 'GTNH Maven' + url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/' + } + maven { + name 'ic2' + url 'http://maven.ic2.player.to/' + metadataSources { + mavenPom() + artifact() + } + } + maven { + url 'https://cursemaven.com' + content { + includeGroup 'curse.maven' + } + } } diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000000..97d8f71c52 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,10 @@ +plugins { + id 'com.diffplug.blowdryerSetup' version '1.6.0' +} + +apply plugin: 'com.diffplug.blowdryerSetup' + +blowdryerSetup { + github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.1.4') + //devLocal '.' // Use this when testing config updates locally +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index 55a8680555..9876e07276 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -11,9 +11,11 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import pers.gwyog.gtneioreplugin.plugin.IMCForNEI; import pers.gwyog.gtneioreplugin.plugin.block.ModBlocks; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; +import pers.gwyog.gtneioreplugin.util.GT5UndergroundFluidHelper; import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper; @Mod( @@ -75,6 +77,7 @@ public class GTNEIOrePlugin { @EventHandler public void init(FMLInitializationEvent event) { ModBlocks.init(); + IMCForNEI.IMCSender(); } @EventHandler @@ -82,6 +85,7 @@ public class GTNEIOrePlugin { if (event.getSide() == Side.CLIENT) { new GT5OreLayerHelper(); new GT5OreSmallHelper(); + new GT5UndergroundFluidHelper(); new GuiRecipeHelper(); if (csv) { new pers.gwyog.gtneioreplugin.util.CSVMaker().run(); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java new file mode 100644 index 0000000000..bcba2eed1a --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java @@ -0,0 +1,57 @@ +package pers.gwyog.gtneioreplugin.plugin; + +import cpw.mods.fml.common.event.FMLInterModComms; +import net.minecraft.nbt.NBTTagCompound; +import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; + +public class IMCForNEI { + public static void IMCSender() { + // Though these 2 are already registered in NEI jar, we need to re-register + // because new DimensionDisplayItems made tabs a bit taller. + sendHandler("pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat", "gregtech:gt.blockores:386"); + + sendHandler("pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5SmallOreStat", "gregtech:gt.blockores:85"); + + sendHandler( + "pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5UndergroundFluid", + "gregtech:gt.metaitem.01:32619"); + sendCatalyst( + "pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5UndergroundFluid", + "gregtech:gt.blockmachines:1157"); + sendCatalyst( + "pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5UndergroundFluid", + "gregtech:gt.blockmachines:141"); + sendCatalyst( + "pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5UndergroundFluid", + "gregtech:gt.blockmachines:142"); + sendCatalyst( + "pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5UndergroundFluid", + "gregtech:gt.blockmachines:148"); + } + + private static void sendHandler(String name, String itemStack) { + NBTTagCompound aNBT = new NBTTagCompound(); + aNBT.setString("handler", name); + aNBT.setString("modName", GTNEIOrePlugin.NAME); + aNBT.setString("modId", GTNEIOrePlugin.MODID); + aNBT.setBoolean("modRequired", true); + aNBT.setString("itemName", itemStack); + aNBT.setInteger("handlerHeight", 160); + aNBT.setInteger("handlerWidth", 166); + aNBT.setInteger("maxRecipesPerPage", 2); + aNBT.setInteger("yShift", 0); + FMLInterModComms.sendMessage("NotEnoughItems", "registerHandlerInfo", aNBT); + } + + private static void sendCatalyst(String name, String itemStack, int priority) { + NBTTagCompound aNBT = new NBTTagCompound(); + aNBT.setString("handlerID", name); + aNBT.setString("itemName", itemStack); + aNBT.setInteger("priority", priority); + FMLInterModComms.sendMessage("NotEnoughItems", "registerCatalystInfo", aNBT); + } + + private static void sendCatalyst(String name, String itemStack) { + sendCatalyst(name, itemStack, 0); + } +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java index ee76cff2d2..17193b07fe 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java @@ -4,6 +4,7 @@ import codechicken.nei.api.API; import codechicken.nei.api.IConfigureNEI; import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5SmallOreStat; +import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5UndergroundFluid; import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat; public class NEIPluginConfig implements IConfigureNEI { @@ -22,9 +23,12 @@ public class NEIPluginConfig implements IConfigureNEI { public void loadConfig() { PluginGT5VeinStat pluginVeinStat = new PluginGT5VeinStat(); PluginGT5SmallOreStat pluginSmallOreStat = new PluginGT5SmallOreStat(); + PluginGT5UndergroundFluid pluginGT5UndergroundFluid = new PluginGT5UndergroundFluid(); API.registerRecipeHandler(pluginVeinStat); API.registerUsageHandler(pluginVeinStat); API.registerRecipeHandler(pluginSmallOreStat); API.registerUsageHandler(pluginSmallOreStat); + API.registerRecipeHandler(pluginGT5UndergroundFluid); + API.registerUsageHandler(pluginGT5UndergroundFluid); } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java index de36d22bc9..71c770a86b 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java @@ -25,7 +25,7 @@ public abstract class PluginBase extends TemplateRecipeHandler { @Override public void loadTransferRects() { - int stringLength = GuiDraw.getStringWidth(EnumChatFormatting.BOLD + I18n.format("gui.nei.seeAll")); + int stringLength = GuiDraw.getStringWidth(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll")); transferRects.add(new RecipeTransferRect( new Rectangle(getGuiWidth() - stringLength - 3, 5, stringLength, 9), getOutputId())); } @@ -35,4 +35,12 @@ public abstract class PluginBase extends TemplateRecipeHandler { public int getGuiWidth() { return 166; } + + /** + * Draw the "see all recipes" transfer label + */ + protected void drawSeeAllRecipesLabel() { + 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/gregtech5/PluginGT5Base.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java index 6abc3ea96c..1c7e14db79 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java @@ -8,7 +8,6 @@ import gregtech.api.util.GT_LanguageManager; import java.awt.Point; import java.awt.Rectangle; import net.minecraft.client.resources.I18n; -import net.minecraft.util.EnumChatFormatting; import pers.gwyog.gtneioreplugin.plugin.PluginBase; import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper; @@ -89,12 +88,4 @@ public abstract class PluginGT5Base extends PluginBase { protected void drawDimNames(String dimNames) { GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 100, 0x404040, false); } - - /** - * Draw the "see all recipes" transfer label - */ - protected void drawSeeAllRecipesLabel() { - 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/gregtech5/PluginGT5UndergroundFluid.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java new file mode 100644 index 0000000000..0cdf2b53b7 --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java @@ -0,0 +1,165 @@ +package pers.gwyog.gtneioreplugin.plugin.gregtech5; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import gregtech.api.util.GT_Utility; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import net.minecraft.client.resources.I18n; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import pers.gwyog.gtneioreplugin.plugin.PluginBase; +import pers.gwyog.gtneioreplugin.plugin.item.ItemDimensionDisplay; +import pers.gwyog.gtneioreplugin.util.GT5UndergroundFluidHelper; +import pers.gwyog.gtneioreplugin.util.GT5UndergroundFluidHelper.UndergroundFluidWrapper; + +public class PluginGT5UndergroundFluid extends PluginBase { + + private static final int lineSpace = 20; + private static final int xDimensionDisplay = 30; + private static final int halfItemLength = 16 / 2; + + @Override + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals(getOutputId())) { + for (Map.Entry> entry : + GT5UndergroundFluidHelper.getAllEntries().entrySet()) { + Fluid fluid = FluidRegistry.getFluid(entry.getKey()); + if (fluid != null) { + this.arecipes.add(new CachedUndergroundFluidRecipe(fluid, entry.getValue())); + } + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadCraftingRecipes(ItemStack result) { + Fluid fluid = null; + FluidStack containerFluid = GT_Utility.getFluidForFilledItem(result, true); + if (containerFluid != null) { + fluid = containerFluid.getFluid(); + } + if (fluid == null) { + FluidStack displayFluid = GT_Utility.getFluidFromDisplayStack(result); + if (displayFluid != null) { + fluid = displayFluid.getFluid(); + } + } + if (fluid == null) return; + + List wrappers = GT5UndergroundFluidHelper.getEntry(fluid.getName()); + if (wrappers != null) { + this.arecipes.add(new CachedUndergroundFluidRecipe(fluid, wrappers)); + } + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) { + String dimension = ItemDimensionDisplay.getDimension(ingredient); + if (dimension != null) { + for (Map.Entry> entry : + GT5UndergroundFluidHelper.getAllEntries().entrySet()) { + boolean found = false; + for (UndergroundFluidWrapper wrapper : entry.getValue()) { + if (wrapper.dimension.equals(dimension)) { + found = true; + break; + } + } + if (found) { + Fluid fluid = FluidRegistry.getFluid(entry.getKey()); + if (fluid != null) { + this.arecipes.add(new CachedUndergroundFluidRecipe(fluid, entry.getValue())); + } + } + } + } + } + + @Override + public void drawExtras(int recipeIndex) { + drawSeeAllRecipesLabel(); + + int xChance = 85; + int xAmount = 140; + int yHeader = 30; + int black = 0x404040; + + GuiDraw.drawStringC(I18n.format("gtnop.gui.nei.dimension") + ":", xDimensionDisplay, yHeader, black, false); + GuiDraw.drawStringC(I18n.format("gtnop.gui.nei.chance") + ":", xChance, yHeader, black, false); + GuiDraw.drawStringC(I18n.format("gtnop.gui.nei.fluidAmount") + ":", xAmount, yHeader, black, false); + + int y = 50; + CachedUndergroundFluidRecipe recipe = (CachedUndergroundFluidRecipe) this.arecipes.get(recipeIndex); + for (int i = 0; i < recipe.dimensionDisplayItems.size(); i++) { + GuiDraw.drawStringC( + new DecimalFormat("0.#").format((double) recipe.chances.get(i) / 100) + "%", + xChance, + y, + black, + false); + GuiDraw.drawStringC( + recipe.minAmounts.get(i).toString() + "-" + + recipe.maxAmounts.get(i).toString(), + xAmount, + y, + black, + false); + y += lineSpace; + } + } + + @Override + public String getOutputId() { + return "GTOrePluginUndergroundFluid"; + } + + @Override + public String getRecipeName() { + return I18n.format("gtnop.gui.undergroundFluid.name"); + } + + private class CachedUndergroundFluidRecipe extends CachedRecipe { + + private final PositionedStack targetFluidDisplay; + private final List dimensionDisplayItems = new ArrayList<>(); + private final List chances = new ArrayList<>(); + private final List maxAmounts = new ArrayList<>(); + private final List minAmounts = new ArrayList<>(); + + private CachedUndergroundFluidRecipe(Fluid fluid, List wrappers) { + targetFluidDisplay = + new PositionedStack(GT_Utility.getFluidDisplayStack(fluid), getGuiWidth() / 2 - halfItemLength, 3); + int y = 50 - halfItemLength; + for (UndergroundFluidWrapper wrapper : wrappers) { + ItemStack dimensionDisplay = ItemDimensionDisplay.getItem(wrapper.dimension); + if (dimensionDisplay != null) { + dimensionDisplayItems.add(new PositionedStack( + dimensionDisplay, + xDimensionDisplay - halfItemLength, + y + GuiDraw.fontRenderer.FONT_HEIGHT / 2)); + y += lineSpace; + chances.add(wrapper.chance); + maxAmounts.add(wrapper.maxAmount); + minAmounts.add(wrapper.minAmount); + } + } + } + + @Override + public PositionedStack getResult() { + return targetFluidDisplay; + } + + @Override + public List getIngredients() { + return dimensionDisplayItems; + } + } +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java index 7584cf405c..0e5bf0c24b 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java @@ -1,5 +1,7 @@ package pers.gwyog.gtneioreplugin.plugin.item; +import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.LOG; + import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.relauncher.Side; import java.util.Objects; @@ -29,6 +31,9 @@ public class ItemDimensionDisplay extends ItemBlock { if (block != null) { return new ItemStack(block); } + if (dimension != null) { + LOG.warn("Unknown dimension queried for ItemDimensionDisplay: " + dimension); + } return null; } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java index 3b281713f7..b175b456b1 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java @@ -62,6 +62,7 @@ public class ItemDimensionDisplayRenderer implements IItemRenderer { case "Ce": case "Eu": case "Ga": + case "Rb": return "T3"; case "Io": case "Me": @@ -71,6 +72,7 @@ public class ItemDimensionDisplayRenderer implements IItemRenderer { case "Mi": case "Ob": case "Ti": + case "Ra": return "T5"; case "Pr": case "Tr": diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java index 90d49d7e35..74f726dac1 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -5,6 +5,7 @@ import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.maxTooltipLines; import java.util.Arrays; import java.util.HashMap; import java.util.List; +import java.util.stream.Collectors; import net.minecraft.client.resources.I18n; public class DimensionHelper { @@ -29,6 +30,7 @@ public class DimensionHelper { "GalaxySpace_Ceres", "GalaxySpace_Europa", "GalaxySpace_Ganymede", + "Ross128b", // T4 "GalaxySpace_Io", "GalaxySpace_Mercury", @@ -38,6 +40,7 @@ public class DimensionHelper { "GalaxySpace_Miranda", "GalaxySpace_Oberon", "GalaxySpace_Titan", + "Ross128ba", // T6 "GalaxySpace_Proteus", "GalaxySpace_Triton", @@ -56,6 +59,14 @@ public class DimensionHelper { "GalaxySpace_VegaB", }; + public static String[] DimNameTrimmed = Arrays.stream(DimName) + .map(n -> n.replaceAll("GalacticraftCore_", "") + .replaceAll("GalacticraftMars_", "") + .replaceAll("GalaxySpace_", "") + .replaceAll("Vanilla_", "Vanilla ")) + .collect(Collectors.toList()) + .toArray(new String[0]); + public static String[] DimNameDisplayed = { // first 2 letters if one word else 1 letter of every word, except capital letter in // name, then 1rst + capital Moon = Mo, BarnardC = BC, EndAsteroid = EA @@ -78,6 +89,7 @@ public class DimensionHelper { "Ce", // GalaxySpace_Ceres "Eu", // GalaxySpace_Europa "Ga", // GalaxySpace_Ganymede + "Rb", // Ross128b // T4 "Io", // GalaxySpace_Io "Me", // GalaxySpace_Mercury @@ -87,6 +99,7 @@ public class DimensionHelper { "Mi", // GalaxySpace_Miranda "Ob", // GalaxySpace_Oberon "Ti", // GalaxySpace_Titan + "Ra", // Ross128ba // T6 "Pr", // GalaxySpace_Proteus "Tr", // GalaxySpace_Triton @@ -113,11 +126,7 @@ public class DimensionHelper { String s = dims[j]; for (int i = 0; i < DimNameDisplayed.length; i++) { if (s.equals(DimNameDisplayed[i])) { - String k = DimName[i] - .replaceAll("GalacticraftCore_", "") - .replaceAll("GalacticraftMars_", "") - .replaceAll("GalaxySpace_", "") - .replaceAll("Vanilla_", "Vanilla "); + String k = DimNameTrimmed[i]; s = I18n.format("gtnop.world." + k); switch (k) { case "Moon": @@ -133,6 +142,7 @@ public class DimensionHelper { case "Ceres": case "Europa": case "Ganymede": + case "Ross128b": s = "T3: " + s; break; case "Io": @@ -144,6 +154,7 @@ public class DimensionHelper { case "Miranda": case "Oberon": case "Titan": + case "Ross128ba": s = "T5: " + s; break; case "Proteus": diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java new file mode 100644 index 0000000000..731867953d --- /dev/null +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java @@ -0,0 +1,170 @@ +package pers.gwyog.gtneioreplugin.util; + +import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.LOG; + +import com.google.common.collect.BiMap; +import gregtech.GT_Mod; +import gregtech.api.objects.GT_UO_Dimension; +import gregtech.api.objects.GT_UO_DimensionList; +import gregtech.api.objects.GT_UO_Fluid; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import net.minecraft.world.WorldProvider; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; + +public class GT5UndergroundFluidHelper { + + /** + * Need to store fluid name instead of fluid + * because fluid instance might be different between gas and liquid + */ + private static final Map> fluidMap = new HashMap<>(); + + @SuppressWarnings("unchecked") + public GT5UndergroundFluidHelper() { + try { + Field fieldDimensionList = GT_UO_DimensionList.class.getDeclaredField("fDimensionList"); + fieldDimensionList.setAccessible(true); + BiMap dimensionList = + (BiMap) fieldDimensionList.get(GT_Mod.gregtechproxy.mUndergroundOil); + for (Map.Entry dimensionEntry : dimensionList.entrySet()) { + String rawDimension = dimensionEntry.getKey(); + String dimension = null; + try { + dimension = getDimensionFromID(Integer.parseInt(rawDimension)); + } catch (NumberFormatException ignored) { + Field fieldProviders = DimensionManager.class.getDeclaredField("providers"); + fieldProviders.setAccessible(true); + Hashtable> providers = + (Hashtable>) fieldProviders.get(null); + + // some short dimension names like Io might be caught by multiple dimension classes, + // so we'll check them all. + // List dimensionCandidates = providers.values() + List> dimensionCandidates = providers.values().stream() + .filter(p -> p.getName().contains(rawDimension)) + .collect(Collectors.toList()); + loop: + for (Class candidate : dimensionCandidates) { + for (int i = 0; i < DimensionHelper.DimNameTrimmed.length; i++) { + if (DimensionHelper.DimNameTrimmed[i].equalsIgnoreCase( + candidate.newInstance().getDimensionName())) { + dimension = DimensionHelper.DimNameDisplayed[i]; + break loop; + } + } + } + } + + if (dimension == null) { + dimension = getDimensionForEdgeCase(rawDimension); + if (dimension == null) { + LOG.warn("Unknown dimension found in GT5 config: " + rawDimension); + continue; + } + } + + Field fieldFluids = GT_UO_Dimension.class.getDeclaredField("fFluids"); + fieldFluids.setAccessible(true); + BiMap fluids = + (BiMap) fieldFluids.get(dimensionEntry.getValue()); + + int maxChance = 0; + for (Map.Entry fluidEntry : fluids.entrySet()) { + maxChance += fluidEntry.getValue().Chance; + } + + for (Map.Entry fluidEntry : fluids.entrySet()) { + Fluid fluid = FluidRegistry.getFluid(fluidEntry.getKey()); + if (fluid != null) { + UndergroundFluidWrapper wrapper = new UndergroundFluidWrapper( + dimension, + fluidEntry.getValue().Chance * 10000 / maxChance, + fluidEntry.getValue().MaxAmount, + fluidEntry.getValue().MinAmount); + if (fluidMap.containsKey(fluid.getName())) { + fluidMap.get(fluid.getName()).add(wrapper); + } else { + fluidMap.put(fluid.getName(), new ArrayList<>(Collections.singletonList(wrapper))); + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + + for (List wrappers : fluidMap.values()) { + wrappers.sort(Comparator.comparingInt( + w -> Arrays.asList(DimensionHelper.DimNameDisplayed).indexOf(w.dimension))); + } + } + + public static List getEntry(String fluidName) { + return fluidMap.get(fluidName); + } + + public static Map> getAllEntries() { + return fluidMap; + } + + @SuppressWarnings("SwitchStatementWithTooFewBranches") + private String getDimensionFromID(int id) { + switch (id) { + case 0: + return "Ow"; + default: + return null; + } + } + + private String getDimensionForEdgeCase(String rawDimension) { + switch (rawDimension) { + case "aCentauriBb": + return "CB"; + case "BarnardaC": + return "BC"; + case "BarnardaE": + return "BE"; + case "BarnardaF": + return "BF"; + case "TCetiE": + return "TE"; + default: + LOG.warn("Unknown dimension name while parsing: " + rawDimension); + return null; + } + } + + public static class UndergroundFluidWrapper { + + /** + * Using {@link DimensionHelper#DimNameDisplayed} + */ + public final String dimension; + /** + * Chance of this fluid field being generated. 10000 means 100% of the dimension + */ + public final int chance; + + public final int maxAmount; + public final int minAmount; + + public UndergroundFluidWrapper(String dimension, int chance, int maxAmount, int minAmount) { + this.dimension = dimension; + this.chance = chance; + this.maxAmount = maxAmount; + this.minAmount = minAmount; + } + } +} diff --git a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang index dd65efe1ff..e55dedc668 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang @@ -2,6 +2,7 @@ gtnop.gui.veinStat.name=Vein Stats gtnop.gui.asteroidStat.name=Asteroid Stats gtnop.gui.smallOreStat.name=Small Ore Stats +gtnop.gui.undergroundFluid.name=Underground Fluid Stats gtnop.gui.ieVeinStat.name=IE Vein Stats gtnop.gui.bedrockOreStat.name=Bedrock Ore Stats @@ -14,6 +15,9 @@ gtnop.gui.nei.genHeight=Height gtnop.gui.nei.weightedChance=Weight gtnop.gui.nei.worldNames=Generated world gtnop.gui.nei.restrictBiome=Restricted biome +gtnop.gui.nei.dimension=Dimension +gtnop.gui.nei.chance=Chance +gtnop.gui.nei.fluidAmount=Amount gtnop.gui.nei.asteroidPrimary=Main-Gen1 gtnop.gui.nei.asteroidSecondary=Main-Gen2 @@ -50,11 +54,13 @@ gtnop.world.Ceres=Ceres gtnop.world.Europa=Europa gtnop.world.Ganymede=Ganymede gtnop.world.Callisto=Callisto +gtnop.world.Ross128b=Ross128b gtnop.world.Io=Io gtnop.world.Venus=Venus gtnop.world.Mercury=Mercury gtnop.world.Enceladus=Enceladus gtnop.world.Titan=Titan +gtnop.world.Ross128ba=Ross128ba gtnop.world.Miranda=Miranda gtnop.world.Oberon=Oberon gtnop.world.Proteus=Proteus diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_left.png new file mode 100644 index 0000000000..bd7a426d98 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_right.png new file mode 100644 index 0000000000..5f5322c16f Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_top.png new file mode 100644 index 0000000000..2f40ded50c Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_left.png new file mode 100644 index 0000000000..de3fd5d20c Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_right.png new file mode 100644 index 0000000000..824764eca6 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_top.png new file mode 100644 index 0000000000..8c46a5ec54 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_top.png differ -- cgit From d2363df06930afb452eda246f1e36fe1768ea75d Mon Sep 17 00:00:00 2001 From: miozune Date: Wed, 24 Aug 2022 17:20:39 +0900 Subject: Add Drilling Rig IV to RecipeCatalyst (#21) --- src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java index bcba2eed1a..72aaf6fb85 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java @@ -24,6 +24,9 @@ public class IMCForNEI { sendCatalyst( "pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5UndergroundFluid", "gregtech:gt.blockmachines:142"); + sendCatalyst( + "pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5UndergroundFluid", + "gregtech:gt.blockmachines:149"); sendCatalyst( "pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5UndergroundFluid", "gregtech:gt.blockmachines:148"); -- cgit From 5eaf79f70be6dcb9cab46824b24c1785acdcb888 Mon Sep 17 00:00:00 2001 From: Kiwi <42833050+Kiwi233@users.noreply.github.com> Date: Sat, 24 Sep 2022 18:37:38 +0800 Subject: Update zh_CN.lang (#22) --- src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang b/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang index ce0fe22f00..4fe6e5fe32 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/zh_CN.lang @@ -1,7 +1,8 @@ -# gui names +# gui names gtnop.gui.veinStat.name=矿脉信息 gtnop.gui.asteroidStat.name=小行星信息 gtnop.gui.smallOreStat.name=贫瘠矿石信息 +gtnop.gui.undergroundFluid.name=地下流体信息 gtnop.gui.ieVeinStat.name=IE虚拟矿脉信息 gtnop.gui.bedrockOreStat.name=基岩矿脉信息 @@ -14,6 +15,9 @@ gtnop.gui.nei.genHeight=生成高度 gtnop.gui.nei.weightedChance=生成几率 gtnop.gui.nei.worldNames=生成世界 gtnop.gui.nei.restrictBiome=生物群系限制 +gtnop.gui.nei.dimension=维度 +gtnop.gui.nei.chance=几率 +gtnop.gui.nei.fluidAmount=储量 gtnop.gui.nei.asteroidPrimary=主要生成一 gtnop.gui.nei.asteroidSecondary=主要生成二 @@ -28,7 +32,7 @@ gtnop.gui.nei.ieVeinComponent=矿脉构成 gtnop.gui.nei.fromMod=来自模组 gtnop.gui.nei.seeAll=查看全部 - +gtnop.gui.nei.vein=矿脉 gtnop.gui.nei.oreOthers=伴随生成 gtnop.nei.genPosition=生成位置 gtnop.nei.genPositionInfo=各个区块的正中心 @@ -50,11 +54,13 @@ gtnop.world.Ceres=谷神星 gtnop.world.Europa=木卫二 gtnop.world.Ganymede=木卫三 gtnop.world.Callisto=木卫四 +gtnop.world.Ross128b=罗斯128b gtnop.world.Io=木卫一 gtnop.world.Venus=金星 gtnop.world.Mercury=水星 gtnop.world.Enceladus=土卫二 gtnop.world.Titan=土卫六 +gtnop.world.Ross128ba=罗斯128ba gtnop.world.Miranda=天卫五 gtnop.world.Oberon=天卫四 gtnop.world.Proteus=海卫八 @@ -83,4 +89,7 @@ gtnop.ore.null.name=无 # vein types gtnop.ore.vein.name=矿脉 gtnop.ore.asteroid.name=小行星 -gtnop.ore.custom.name=自定义 \ No newline at end of file +gtnop.ore.custom.name=自定义 + +# items +itemGroup.gtneioreplugin=GT NEI 矿物插件 \ No newline at end of file -- cgit From 7523a237982b5ddf06c956a34742d8056727cf0c Mon Sep 17 00:00:00 2001 From: Martin Robertz Date: Sat, 5 Nov 2022 18:47:48 +0100 Subject: Update build.gradle --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index ec6cfc966c..3c075f03bb 100644 --- a/build.gradle +++ b/build.gradle @@ -40,7 +40,7 @@ buildscript { } } dependencies { - classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.7' + classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.11' } } plugins { -- cgit From 9c2b103c1247a71d706654ac375164ee71a6f039 Mon Sep 17 00:00:00 2001 From: miozune Date: Sun, 6 Nov 2022 02:48:37 +0900 Subject: Update textures by Jimbno (#23) --- .../assets/gtneioreplugin/textures/blocks/As_left.png | Bin 310 -> 301 bytes .../assets/gtneioreplugin/textures/blocks/As_right.png | Bin 375 -> 310 bytes .../assets/gtneioreplugin/textures/blocks/As_top.png | Bin 345 -> 319 bytes .../assets/gtneioreplugin/textures/blocks/BC_left.png | Bin 408 -> 395 bytes .../assets/gtneioreplugin/textures/blocks/BC_right.png | Bin 442 -> 413 bytes .../assets/gtneioreplugin/textures/blocks/BC_top.png | Bin 536 -> 389 bytes .../assets/gtneioreplugin/textures/blocks/BE_left.png | Bin 301 -> 329 bytes .../assets/gtneioreplugin/textures/blocks/BE_right.png | Bin 315 -> 319 bytes .../assets/gtneioreplugin/textures/blocks/BE_top.png | Bin 330 -> 312 bytes .../assets/gtneioreplugin/textures/blocks/CB_left.png | Bin 406 -> 383 bytes .../assets/gtneioreplugin/textures/blocks/CB_right.png | Bin 390 -> 383 bytes .../assets/gtneioreplugin/textures/blocks/CB_top.png | Bin 385 -> 387 bytes .../assets/gtneioreplugin/textures/blocks/Ca_left.png | Bin 466 -> 489 bytes .../assets/gtneioreplugin/textures/blocks/Ca_right.png | Bin 563 -> 268 bytes .../assets/gtneioreplugin/textures/blocks/Ca_top.png | Bin 504 -> 540 bytes .../assets/gtneioreplugin/textures/blocks/Ce_left.png | Bin 413 -> 232 bytes .../assets/gtneioreplugin/textures/blocks/Ce_right.png | Bin 410 -> 235 bytes .../assets/gtneioreplugin/textures/blocks/Ce_top.png | Bin 406 -> 229 bytes .../assets/gtneioreplugin/textures/blocks/DD_left.png | Bin 719 -> 520 bytes .../assets/gtneioreplugin/textures/blocks/DD_right.png | Bin 617 -> 471 bytes .../assets/gtneioreplugin/textures/blocks/DD_top.png | Bin 745 -> 541 bytes .../assets/gtneioreplugin/textures/blocks/De_left.png | Bin 479 -> 451 bytes .../assets/gtneioreplugin/textures/blocks/De_right.png | Bin 539 -> 482 bytes .../assets/gtneioreplugin/textures/blocks/De_top.png | Bin 436 -> 415 bytes .../assets/gtneioreplugin/textures/blocks/EA_left.png | Bin 408 -> 299 bytes .../assets/gtneioreplugin/textures/blocks/EA_right.png | Bin 423 -> 449 bytes .../assets/gtneioreplugin/textures/blocks/EA_top.png | Bin 331 -> 336 bytes .../assets/gtneioreplugin/textures/blocks/ED_left.png | Bin 467 -> 430 bytes .../assets/gtneioreplugin/textures/blocks/ED_right.png | Bin 521 -> 445 bytes .../assets/gtneioreplugin/textures/blocks/ED_top.png | Bin 557 -> 508 bytes .../assets/gtneioreplugin/textures/blocks/En_left.png | Bin 620 -> 270 bytes .../assets/gtneioreplugin/textures/blocks/En_right.png | Bin 661 -> 274 bytes .../assets/gtneioreplugin/textures/blocks/En_top.png | Bin 533 -> 276 bytes .../assets/gtneioreplugin/textures/blocks/Eu_left.png | Bin 442 -> 253 bytes .../assets/gtneioreplugin/textures/blocks/Eu_right.png | Bin 430 -> 247 bytes .../assets/gtneioreplugin/textures/blocks/Eu_top.png | Bin 465 -> 261 bytes .../assets/gtneioreplugin/textures/blocks/Ga_left.png | Bin 402 -> 415 bytes .../assets/gtneioreplugin/textures/blocks/Ga_right.png | Bin 388 -> 394 bytes .../assets/gtneioreplugin/textures/blocks/Ga_top.png | Bin 464 -> 425 bytes .../assets/gtneioreplugin/textures/blocks/Ha_left.png | Bin 454 -> 286 bytes .../assets/gtneioreplugin/textures/blocks/Ha_right.png | Bin 451 -> 289 bytes .../assets/gtneioreplugin/textures/blocks/Ha_top.png | Bin 436 -> 282 bytes .../assets/gtneioreplugin/textures/blocks/Io_left.png | Bin 408 -> 458 bytes .../assets/gtneioreplugin/textures/blocks/Io_right.png | Bin 469 -> 454 bytes .../assets/gtneioreplugin/textures/blocks/Io_top.png | Bin 468 -> 457 bytes .../assets/gtneioreplugin/textures/blocks/KB_left.png | Bin 476 -> 408 bytes .../assets/gtneioreplugin/textures/blocks/KB_right.png | Bin 432 -> 424 bytes .../assets/gtneioreplugin/textures/blocks/KB_top.png | Bin 409 -> 380 bytes .../assets/gtneioreplugin/textures/blocks/MM_left.png | Bin 477 -> 376 bytes .../assets/gtneioreplugin/textures/blocks/MM_right.png | Bin 479 -> 440 bytes .../assets/gtneioreplugin/textures/blocks/MM_top.png | Bin 398 -> 384 bytes .../assets/gtneioreplugin/textures/blocks/Ma_left.png | Bin 348 -> 320 bytes .../assets/gtneioreplugin/textures/blocks/Ma_right.png | Bin 399 -> 304 bytes .../assets/gtneioreplugin/textures/blocks/Ma_top.png | Bin 350 -> 323 bytes .../assets/gtneioreplugin/textures/blocks/Me_left.png | Bin 568 -> 491 bytes .../assets/gtneioreplugin/textures/blocks/Me_right.png | Bin 470 -> 456 bytes .../assets/gtneioreplugin/textures/blocks/Me_top.png | Bin 543 -> 559 bytes .../assets/gtneioreplugin/textures/blocks/Mi_left.png | Bin 561 -> 262 bytes .../assets/gtneioreplugin/textures/blocks/Mi_right.png | Bin 489 -> 265 bytes .../assets/gtneioreplugin/textures/blocks/Mi_top.png | Bin 502 -> 266 bytes .../assets/gtneioreplugin/textures/blocks/Mo_left.png | Bin 465 -> 402 bytes .../assets/gtneioreplugin/textures/blocks/Mo_right.png | Bin 413 -> 343 bytes .../assets/gtneioreplugin/textures/blocks/Mo_top.png | Bin 495 -> 389 bytes .../assets/gtneioreplugin/textures/blocks/Ne_left.png | Bin 438 -> 227 bytes .../assets/gtneioreplugin/textures/blocks/Ne_right.png | Bin 492 -> 218 bytes .../assets/gtneioreplugin/textures/blocks/Ne_top.png | Bin 506 -> 226 bytes .../assets/gtneioreplugin/textures/blocks/Ob_left.png | Bin 477 -> 411 bytes .../assets/gtneioreplugin/textures/blocks/Ob_right.png | Bin 437 -> 349 bytes .../assets/gtneioreplugin/textures/blocks/Ob_top.png | Bin 395 -> 345 bytes .../assets/gtneioreplugin/textures/blocks/Ow_left.png | Bin 733 -> 229 bytes .../assets/gtneioreplugin/textures/blocks/Ow_right.png | Bin 700 -> 222 bytes .../assets/gtneioreplugin/textures/blocks/Ow_top.png | Bin 816 -> 241 bytes .../assets/gtneioreplugin/textures/blocks/Ph_left.png | Bin 374 -> 208 bytes .../assets/gtneioreplugin/textures/blocks/Ph_right.png | Bin 380 -> 368 bytes .../assets/gtneioreplugin/textures/blocks/Ph_top.png | Bin 414 -> 381 bytes .../assets/gtneioreplugin/textures/blocks/Pl_left.png | Bin 389 -> 285 bytes .../assets/gtneioreplugin/textures/blocks/Pl_right.png | Bin 379 -> 314 bytes .../assets/gtneioreplugin/textures/blocks/Pl_top.png | Bin 457 -> 423 bytes .../assets/gtneioreplugin/textures/blocks/Pr_left.png | Bin 402 -> 304 bytes .../assets/gtneioreplugin/textures/blocks/Pr_right.png | Bin 350 -> 306 bytes .../assets/gtneioreplugin/textures/blocks/Pr_top.png | Bin 373 -> 251 bytes .../assets/gtneioreplugin/textures/blocks/Ra_left.png | Bin 446 -> 224 bytes .../assets/gtneioreplugin/textures/blocks/Ra_right.png | Bin 426 -> 229 bytes .../assets/gtneioreplugin/textures/blocks/Ra_top.png | Bin 521 -> 210 bytes .../assets/gtneioreplugin/textures/blocks/Rb_left.png | Bin 492 -> 221 bytes .../assets/gtneioreplugin/textures/blocks/Rb_right.png | Bin 511 -> 214 bytes .../assets/gtneioreplugin/textures/blocks/Rb_top.png | Bin 496 -> 221 bytes .../assets/gtneioreplugin/textures/blocks/TF_left.png | Bin 463 -> 219 bytes .../assets/gtneioreplugin/textures/blocks/TF_right.png | Bin 503 -> 222 bytes .../assets/gtneioreplugin/textures/blocks/TF_top.png | Bin 457 -> 219 bytes .../assets/gtneioreplugin/textures/blocks/Ti_left.png | Bin 335 -> 206 bytes .../assets/gtneioreplugin/textures/blocks/Ti_right.png | Bin 352 -> 215 bytes .../assets/gtneioreplugin/textures/blocks/Ti_top.png | Bin 452 -> 223 bytes .../assets/gtneioreplugin/textures/blocks/Tr_left.png | Bin 286 -> 262 bytes .../assets/gtneioreplugin/textures/blocks/Tr_right.png | Bin 303 -> 291 bytes .../assets/gtneioreplugin/textures/blocks/Tr_top.png | Bin 295 -> 312 bytes .../assets/gtneioreplugin/textures/blocks/VA_left.png | Bin 374 -> 351 bytes .../assets/gtneioreplugin/textures/blocks/VA_right.png | Bin 446 -> 440 bytes .../assets/gtneioreplugin/textures/blocks/VA_top.png | Bin 354 -> 284 bytes .../assets/gtneioreplugin/textures/blocks/VB_left.png | Bin 357 -> 217 bytes .../assets/gtneioreplugin/textures/blocks/VB_right.png | Bin 331 -> 224 bytes .../assets/gtneioreplugin/textures/blocks/VB_top.png | Bin 383 -> 230 bytes .../assets/gtneioreplugin/textures/blocks/Ve_left.png | Bin 399 -> 407 bytes .../assets/gtneioreplugin/textures/blocks/Ve_right.png | Bin 440 -> 399 bytes .../assets/gtneioreplugin/textures/blocks/Ve_top.png | Bin 364 -> 382 bytes 105 files changed, 0 insertions(+), 0 deletions(-) diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/As_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_left.png index e8ebe8ff3c..c8a5799ea7 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/As_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/As_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_right.png index bf429a9420..a455f19fb2 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/As_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/As_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_top.png index fb3fa76d68..cb20e4040b 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/As_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_left.png index 08e3476679..5cbf4ca363 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_right.png index 98bedd24a9..f7c224e81a 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_top.png index d80c0cfbe1..4db601b87c 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_left.png index 2bd9239b54..4dd37bc4ef 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_right.png index 3236dc3092..df1a5e6373 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_top.png index 438183edf9..5310cb6431 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_left.png index 3e7acb325b..2f71e36023 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_right.png index dd0cc29823..6c9ca752d4 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_top.png index a6f6fdbdbb..ccf32f0d93 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_left.png index 285a3519d4..b7450c7953 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_right.png index 50e1d57261..14d4203311 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_top.png index 3ff0b305f6..4cc79ad20a 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_left.png index f4daab3c5e..103ab02488 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_right.png index 19e924851d..9ef6cc566a 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_top.png index 290dc98d23..f0dc57b878 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_left.png index 3186eb20be..0c9f97e32e 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_right.png index 0b48b98f57..89cab33de8 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_top.png index 922d37b763..01591ff484 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/De_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_left.png index 052a0fd801..f04a2e3db8 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/De_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/De_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_right.png index ca83e70c83..f847bc0b54 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/De_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/De_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_top.png index eedde3785d..ff18590e1b 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/De_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_left.png index eff9de3bf6..83136e0dbf 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_right.png index 2c3039c69c..62c0a7847a 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_top.png index 7c8a535ce6..06c210fa06 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_left.png index 330b5d7411..a35beb10da 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_right.png index 5e8cb34706..c3acf3e395 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_top.png index 2a7a8d6a40..486f602f00 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/En_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_left.png index f3ee55057c..06dd795fad 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/En_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/En_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_right.png index 5bd0879be1..51ada05bec 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/En_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/En_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_top.png index 49e0ed3b9c..f589cc7af7 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/En_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_left.png index b92e12f527..71fca7f0f6 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_right.png index 1146d74451..00d5be9dd7 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_top.png index c8da5f6000..06d28f7181 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_left.png index ac8d6b2495..e57eba6c06 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_right.png index c35cab6541..bdcfec1cce 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_top.png index dad022650a..244f654369 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_left.png index 5d9eba9359..e3c3815718 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_right.png index 168b16839a..adb1ea513a 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_top.png index d22edd8a5d..484471ea0e 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_left.png index 461e7efbbc..42b42e964c 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_right.png index a6018d4171..968f79d47b 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_top.png index 848dd243b2..9b2f739732 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_left.png index 249ce029d9..25166a16a8 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_right.png index 86b795ba93..b894e9520c 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_top.png index d3f21d7f44..087bfe7ef0 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_left.png index 9efcc23d2d..c25c8cc4fd 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_right.png index 825f55bf85..75e9dfe812 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_top.png index 8e4b5a293e..eaea4da1f2 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_left.png index 0855bc7b0b..009608cd1b 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_right.png index 5d4344d3c3..069ce0dd52 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_top.png index fb75b85b47..ca0681b93b 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_left.png index 03c968b03d..6b0166b94e 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_right.png index ad829dcea5..f371e702ee 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_top.png index 5f43d1426b..0868757746 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_left.png index 9639444c22..0669efd353 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_right.png index a334c5b85f..9ae13115e7 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_top.png index 58ea1e12bb..d20dc2a249 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_left.png index ddb95f761c..5980cfdad1 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_right.png index 727fa3a3a1..3b2eada1f5 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_top.png index 5bf05a9b60..c06c86b6be 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_left.png index b91dcd0f31..98e8dee9f3 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_right.png index b27223a93e..a86ce29448 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_top.png index 97166de028..9bcc7b12c9 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_left.png index fe3fc6cd8d..1ab939f012 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_right.png index 7a5aececef..b8100cceb6 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_top.png index 97c46c3771..dd3c5f48b3 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_left.png index e8c1f84a67..be7943782c 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_right.png index eef1391057..b1ec2c836b 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_top.png index 055ab23b47..c78e825e8d 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_left.png index 71e05289bc..76619e4fb9 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_right.png index 7ffa6569be..a7d13c71c1 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_top.png index 8be6fa5f56..66614ac77a 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_left.png index 148400234c..392fc6b0ce 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_right.png index b8668cfd4d..92864c3edd 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_top.png index 2e10f711b3..890e3147f8 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_left.png index fad9ac0b19..29318a5c3a 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_right.png index d4a1da8594..2356c6af90 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_top.png index 8bc3209ee7..a9d3ca1cb9 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_left.png index bd7a426d98..faca5456e9 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_right.png index 5f5322c16f..1bca8530c3 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_top.png index 2f40ded50c..d40072f28e 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_left.png index de3fd5d20c..6d71ed8b71 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_right.png index 824764eca6..51d4eec75b 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_top.png index 8c46a5ec54..560ee6060d 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_left.png index a231fe5915..fc8bb231f4 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_right.png index 94c7c27470..6f7fb5a50b 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_top.png index 795540b3d4..c571c220b2 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_left.png index cca5d11ea3..f0f2279512 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_right.png index 6e7b9cc2ff..c3df18ba09 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_top.png index 22ca8ea36e..a71f77617f 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_left.png index d2abe17365..8826ed2343 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_right.png index 7fc58a438f..58075fe3a9 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_top.png index 5e92db08e6..0113778ed6 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_left.png index 520529a043..7a05a6621e 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_right.png index 1f10338d26..ed402f7b4a 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_top.png index 733204cb34..4fa64bd1f0 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_left.png index 81e17f66aa..3a5e1008d9 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_right.png index ad742e1c2f..be5288e3ad 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_top.png index a58b98974d..7331ff69fc 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_left.png index c63503ca8d..ac2e73207b 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_right.png index 87a0c84992..dd3d79935c 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_top.png index 76a348b458..374d58e287 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_top.png differ -- cgit From 1d38214cf68b9cdb1974c5006012d03c05d140da Mon Sep 17 00:00:00 2001 From: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Date: Sat, 17 Dec 2022 20:58:06 +0000 Subject: Helper hashmaps for black hole gen --- .../gtneioreplugin/util/GT5OreLayerHelper.java | 69 ++++++++++++++++++++++ .../gtneioreplugin/util/GT5OreSmallHelper.java | 4 +- 2 files changed, 71 insertions(+), 2 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index ac3873d9bc..fff381def1 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -3,6 +3,8 @@ package pers.gwyog.gtneioreplugin.util; import static pers.gwyog.gtneioreplugin.util.OreVeinLayer.*; import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.util.GT_OreDictUnificator; import gregtech.common.GT_Worldgen_GT_Ore_Layer; import java.util.ArrayList; import java.util.Arrays; @@ -12,11 +14,28 @@ import net.minecraft.item.ItemStack; public class GT5OreLayerHelper { + class oreDimensionWrapper { + ArrayList internalDimOreList = new ArrayList<>(); + HashMap oreVeinToProbabilityInDimension = new HashMap(); + + // Calculate all weights of ore veins once dimension is initialised. + void calculateWeights() { + int totalWeight = 0; + for (OreLayerWrapper oreVein : internalDimOreList) { + totalWeight += oreVein.randomWeight; + } + for (OreLayerWrapper oreVein : internalDimOreList) { + oreVeinToProbabilityInDimension.put(oreVein, ((double) oreVein.randomWeight) / ((double) totalWeight)); + } + } + } + private static final int DIMENSION_COUNT = 33; public static Integer[] weightPerWorld = new Integer[DIMENSION_COUNT]; public static Integer[] DimIDs = new Integer[DIMENSION_COUNT]; public static HashMap mapOreLayerWrapper = new HashMap<>(); public static HashMap bufferedDims = new HashMap<>(); + public static HashMap dimToOreWrapper = new HashMap<>(); public GT5OreLayerHelper() { Arrays.fill(weightPerWorld, 0); @@ -26,6 +45,40 @@ public class GT5OreLayerHelper { for (OreLayerWrapper layer : mapOreLayerWrapper.values()) { bufferedDims.put(layer, getDims(layer)); } + + // ------------------------------ + // Get dims as "Ow,Ne,Ma" etc. + for (OreLayerWrapper oreLayer : bufferedDims.keySet()) { + + String dims = bufferedDims.get(oreLayer); + + if (dims.equals("Not available in any Galactic Dim!")) { + continue; + } + + for (String dim : dims.split(",")) { + if (dim.length() != 0) { + oreDimensionWrapper dimensionOres = dimToOreWrapper.getOrDefault(dim, new oreDimensionWrapper()); + dimensionOres.internalDimOreList.add(oreLayer); + dimToOreWrapper.put(dim, dimensionOres); + } + } + + // Calculate probabilities for each dim. + for (String dim : dimToOreWrapper.keySet()) { + dimToOreWrapper.get(dim).calculateWeights(); + } + + for (String dim : dimToOreWrapper.keySet()) { + double a = dimToOreWrapper.get(dim).oreVeinToProbabilityInDimension.values() + .stream() + .mapToDouble(Double::valueOf) + .sum(); + + System.out.println("TEST312IMJD + " + a); + } + } + // ------------------------------ } public static String getDims(OreLayerWrapper oreLayer) { @@ -39,12 +92,28 @@ public class GT5OreLayerHelper { public short randomWeight, size, density; public List Weight = new ArrayList<>(); + public Materials mPrimaryVeinMaterial; + public Materials mSecondaryMaterial; + public Materials mBetweenMaterial; + public Materials mSporadicMaterial; + public OreLayerWrapper(GT_Worldgen_GT_Ore_Layer worldGen) { this.veinName = worldGen.mWorldGenName; this.Meta[0] = worldGen.mPrimaryMeta; this.Meta[1] = worldGen.mSecondaryMeta; this.Meta[2] = worldGen.mBetweenMeta; this.Meta[3] = worldGen.mSporadicMeta; + + // Black magic, don't ask me how it works, I have no idea. + try { + this.mPrimaryVeinMaterial = GT_OreDictUnificator.getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mPrimaryMeta)).mMaterial.mMaterial; + this.mSecondaryMaterial = GT_OreDictUnificator.getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSecondaryMeta)).mMaterial.mMaterial; + this.mBetweenMaterial = GT_OreDictUnificator.getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mBetweenMeta)).mMaterial.mMaterial; + this.mSporadicMaterial = GT_OreDictUnificator.getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSporadicMeta)).mMaterial.mMaterial; + } catch(Exception ignored) { + + } + this.size = worldGen.mSize; this.density = worldGen.mDensity; this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java index a730b3d148..4e2dce5104 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java @@ -106,13 +106,13 @@ public class GT5OreSmallHelper { try { Field fieldRestrictBiome = clazzGTOreSmall.getField("mRestrictBiome"); restrictBiomeSupport = true; - } catch (Exception e) { + } catch (Exception ignored) { } try { Field fieldGCMoon = clazzGTOreSmall.getField("mMoon"); Field fieldGCMars = clazzGTOreSmall.getField("mMars"); gcBasicSupport = true; - } catch (Exception e) { + } catch (Exception ignored) { } } } -- cgit From c1c476b2b4a2daa5ecbf1afbd7ebadd2a0db5007 Mon Sep 17 00:00:00 2001 From: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Date: Sat, 17 Dec 2022 21:04:25 +0000 Subject: Remove debug statement --- .../gtneioreplugin/util/GT5OreLayerHelper.java | 31 ++++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index fff381def1..3a9f40e57e 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -69,16 +69,7 @@ public class GT5OreLayerHelper { dimToOreWrapper.get(dim).calculateWeights(); } - for (String dim : dimToOreWrapper.keySet()) { - double a = dimToOreWrapper.get(dim).oreVeinToProbabilityInDimension.values() - .stream() - .mapToDouble(Double::valueOf) - .sum(); - - System.out.println("TEST312IMJD + " + a); - } } - // ------------------------------ } public static String getDims(OreLayerWrapper oreLayer) { @@ -106,11 +97,23 @@ public class GT5OreLayerHelper { // Black magic, don't ask me how it works, I have no idea. try { - this.mPrimaryVeinMaterial = GT_OreDictUnificator.getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mPrimaryMeta)).mMaterial.mMaterial; - this.mSecondaryMaterial = GT_OreDictUnificator.getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSecondaryMeta)).mMaterial.mMaterial; - this.mBetweenMaterial = GT_OreDictUnificator.getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mBetweenMeta)).mMaterial.mMaterial; - this.mSporadicMaterial = GT_OreDictUnificator.getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSporadicMeta)).mMaterial.mMaterial; - } catch(Exception ignored) { + this.mPrimaryVeinMaterial = GT_OreDictUnificator.getAssociation( + new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mPrimaryMeta)) + .mMaterial + .mMaterial; + this.mSecondaryMaterial = GT_OreDictUnificator.getAssociation( + new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSecondaryMeta)) + .mMaterial + .mMaterial; + this.mBetweenMaterial = GT_OreDictUnificator.getAssociation( + new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mBetweenMeta)) + .mMaterial + .mMaterial; + this.mSporadicMaterial = GT_OreDictUnificator.getAssociation( + new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSporadicMeta)) + .mMaterial + .mMaterial; + } catch (Exception ignored) { } -- cgit From 9396914a59f2dfc47bf50dd3609a93fe0e72615e Mon Sep 17 00:00:00 2001 From: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Date: Sat, 17 Dec 2022 21:25:26 +0000 Subject: Fix issues --- .../pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index 3a9f40e57e..8ed345eade 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -14,12 +14,12 @@ import net.minecraft.item.ItemStack; public class GT5OreLayerHelper { - class oreDimensionWrapper { - ArrayList internalDimOreList = new ArrayList<>(); - HashMap oreVeinToProbabilityInDimension = new HashMap(); + private static class OreDimensionWrapper { + public final ArrayList internalDimOreList = new ArrayList<>(); + public final HashMap oreVeinToProbabilityInDimension = new HashMap<>(); // Calculate all weights of ore veins once dimension is initialised. - void calculateWeights() { + private void calculateWeights() { int totalWeight = 0; for (OreLayerWrapper oreVein : internalDimOreList) { totalWeight += oreVein.randomWeight; @@ -35,7 +35,7 @@ public class GT5OreLayerHelper { public static Integer[] DimIDs = new Integer[DIMENSION_COUNT]; public static HashMap mapOreLayerWrapper = new HashMap<>(); public static HashMap bufferedDims = new HashMap<>(); - public static HashMap dimToOreWrapper = new HashMap<>(); + public static HashMap dimToOreWrapper = new HashMap<>(); public GT5OreLayerHelper() { Arrays.fill(weightPerWorld, 0); @@ -58,7 +58,7 @@ public class GT5OreLayerHelper { for (String dim : dims.split(",")) { if (dim.length() != 0) { - oreDimensionWrapper dimensionOres = dimToOreWrapper.getOrDefault(dim, new oreDimensionWrapper()); + OreDimensionWrapper dimensionOres = dimToOreWrapper.getOrDefault(dim, new OreDimensionWrapper()); dimensionOres.internalDimOreList.add(oreLayer); dimToOreWrapper.put(dim, dimensionOres); } @@ -68,7 +68,6 @@ public class GT5OreLayerHelper { for (String dim : dimToOreWrapper.keySet()) { dimToOreWrapper.get(dim).calculateWeights(); } - } } -- cgit From cc48e25e31535cdb00e10970d02ee08f1922bbff Mon Sep 17 00:00:00 2001 From: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Date: Sat, 17 Dec 2022 21:30:53 +0000 Subject: Fix issues --- .../pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index 8ed345eade..052f76a0cd 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -48,16 +48,13 @@ public class GT5OreLayerHelper { // ------------------------------ // Get dims as "Ow,Ne,Ma" etc. - for (OreLayerWrapper oreLayer : bufferedDims.keySet()) { - - String dims = bufferedDims.get(oreLayer); - + bufferedDims.forEach((oreLayer, dims) -> { if (dims.equals("Not available in any Galactic Dim!")) { - continue; + return; } for (String dim : dims.split(",")) { - if (dim.length() != 0) { + if (dim.isEmpty()) { OreDimensionWrapper dimensionOres = dimToOreWrapper.getOrDefault(dim, new OreDimensionWrapper()); dimensionOres.internalDimOreList.add(oreLayer); dimToOreWrapper.put(dim, dimensionOres); @@ -68,7 +65,7 @@ public class GT5OreLayerHelper { for (String dim : dimToOreWrapper.keySet()) { dimToOreWrapper.get(dim).calculateWeights(); } - } + }); } public static String getDims(OreLayerWrapper oreLayer) { -- cgit From f3fe84c1d621e59162e7b01b6d8a50c2b6dfdffb Mon Sep 17 00:00:00 2001 From: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Date: Sat, 17 Dec 2022 21:44:34 +0000 Subject: Revert "Fix issues" This reverts commit cc48e25e31535cdb00e10970d02ee08f1922bbff. --- .../pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index 052f76a0cd..8ed345eade 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -48,13 +48,16 @@ public class GT5OreLayerHelper { // ------------------------------ // Get dims as "Ow,Ne,Ma" etc. - bufferedDims.forEach((oreLayer, dims) -> { + for (OreLayerWrapper oreLayer : bufferedDims.keySet()) { + + String dims = bufferedDims.get(oreLayer); + if (dims.equals("Not available in any Galactic Dim!")) { - return; + continue; } for (String dim : dims.split(",")) { - if (dim.isEmpty()) { + if (dim.length() != 0) { OreDimensionWrapper dimensionOres = dimToOreWrapper.getOrDefault(dim, new OreDimensionWrapper()); dimensionOres.internalDimOreList.add(oreLayer); dimToOreWrapper.put(dim, dimensionOres); @@ -65,7 +68,7 @@ public class GT5OreLayerHelper { for (String dim : dimToOreWrapper.keySet()) { dimToOreWrapper.get(dim).calculateWeights(); } - }); + } } public static String getDims(OreLayerWrapper oreLayer) { -- cgit From 1ba92eee422c85cf435401509c64958427c2ae43 Mon Sep 17 00:00:00 2001 From: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Date: Sat, 17 Dec 2022 21:44:34 +0000 Subject: Revert "Fix issues" This reverts commit 9396914a59f2dfc47bf50dd3609a93fe0e72615e. --- .../pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index 8ed345eade..3a9f40e57e 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -14,12 +14,12 @@ import net.minecraft.item.ItemStack; public class GT5OreLayerHelper { - private static class OreDimensionWrapper { - public final ArrayList internalDimOreList = new ArrayList<>(); - public final HashMap oreVeinToProbabilityInDimension = new HashMap<>(); + class oreDimensionWrapper { + ArrayList internalDimOreList = new ArrayList<>(); + HashMap oreVeinToProbabilityInDimension = new HashMap(); // Calculate all weights of ore veins once dimension is initialised. - private void calculateWeights() { + void calculateWeights() { int totalWeight = 0; for (OreLayerWrapper oreVein : internalDimOreList) { totalWeight += oreVein.randomWeight; @@ -35,7 +35,7 @@ public class GT5OreLayerHelper { public static Integer[] DimIDs = new Integer[DIMENSION_COUNT]; public static HashMap mapOreLayerWrapper = new HashMap<>(); public static HashMap bufferedDims = new HashMap<>(); - public static HashMap dimToOreWrapper = new HashMap<>(); + public static HashMap dimToOreWrapper = new HashMap<>(); public GT5OreLayerHelper() { Arrays.fill(weightPerWorld, 0); @@ -58,7 +58,7 @@ public class GT5OreLayerHelper { for (String dim : dims.split(",")) { if (dim.length() != 0) { - OreDimensionWrapper dimensionOres = dimToOreWrapper.getOrDefault(dim, new OreDimensionWrapper()); + oreDimensionWrapper dimensionOres = dimToOreWrapper.getOrDefault(dim, new oreDimensionWrapper()); dimensionOres.internalDimOreList.add(oreLayer); dimToOreWrapper.put(dim, dimensionOres); } @@ -68,6 +68,7 @@ public class GT5OreLayerHelper { for (String dim : dimToOreWrapper.keySet()) { dimToOreWrapper.get(dim).calculateWeights(); } + } } -- cgit From 1bc7a4bae7aa291ff9b8bb91b269ddf567db99a9 Mon Sep 17 00:00:00 2001 From: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Date: Sat, 17 Dec 2022 21:46:40 +0000 Subject: Revert "Remove debug statement" This reverts commit c1c476b2b4a2daa5ecbf1afbd7ebadd2a0db5007. --- .../gtneioreplugin/util/GT5OreLayerHelper.java | 31 ++++++++++------------ 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index 3a9f40e57e..fff381def1 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -69,7 +69,16 @@ public class GT5OreLayerHelper { dimToOreWrapper.get(dim).calculateWeights(); } + for (String dim : dimToOreWrapper.keySet()) { + double a = dimToOreWrapper.get(dim).oreVeinToProbabilityInDimension.values() + .stream() + .mapToDouble(Double::valueOf) + .sum(); + + System.out.println("TEST312IMJD + " + a); + } } + // ------------------------------ } public static String getDims(OreLayerWrapper oreLayer) { @@ -97,23 +106,11 @@ public class GT5OreLayerHelper { // Black magic, don't ask me how it works, I have no idea. try { - this.mPrimaryVeinMaterial = GT_OreDictUnificator.getAssociation( - new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mPrimaryMeta)) - .mMaterial - .mMaterial; - this.mSecondaryMaterial = GT_OreDictUnificator.getAssociation( - new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSecondaryMeta)) - .mMaterial - .mMaterial; - this.mBetweenMaterial = GT_OreDictUnificator.getAssociation( - new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mBetweenMeta)) - .mMaterial - .mMaterial; - this.mSporadicMaterial = GT_OreDictUnificator.getAssociation( - new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSporadicMeta)) - .mMaterial - .mMaterial; - } catch (Exception ignored) { + this.mPrimaryVeinMaterial = GT_OreDictUnificator.getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mPrimaryMeta)).mMaterial.mMaterial; + this.mSecondaryMaterial = GT_OreDictUnificator.getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSecondaryMeta)).mMaterial.mMaterial; + this.mBetweenMaterial = GT_OreDictUnificator.getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mBetweenMeta)).mMaterial.mMaterial; + this.mSporadicMaterial = GT_OreDictUnificator.getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSporadicMeta)).mMaterial.mMaterial; + } catch(Exception ignored) { } -- cgit From 457c977b76c4cdcaa223837a69409d5c8ad2e9a2 Mon Sep 17 00:00:00 2001 From: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Date: Sat, 17 Dec 2022 21:46:40 +0000 Subject: Revert "Helper hashmaps for black hole gen" This reverts commit 1d38214cf68b9cdb1974c5006012d03c05d140da. --- .../gtneioreplugin/util/GT5OreLayerHelper.java | 69 ---------------------- .../gtneioreplugin/util/GT5OreSmallHelper.java | 4 +- 2 files changed, 2 insertions(+), 71 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index fff381def1..ac3873d9bc 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -3,8 +3,6 @@ package pers.gwyog.gtneioreplugin.util; import static pers.gwyog.gtneioreplugin.util.OreVeinLayer.*; import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; -import gregtech.api.util.GT_OreDictUnificator; import gregtech.common.GT_Worldgen_GT_Ore_Layer; import java.util.ArrayList; import java.util.Arrays; @@ -14,28 +12,11 @@ import net.minecraft.item.ItemStack; public class GT5OreLayerHelper { - class oreDimensionWrapper { - ArrayList internalDimOreList = new ArrayList<>(); - HashMap oreVeinToProbabilityInDimension = new HashMap(); - - // Calculate all weights of ore veins once dimension is initialised. - void calculateWeights() { - int totalWeight = 0; - for (OreLayerWrapper oreVein : internalDimOreList) { - totalWeight += oreVein.randomWeight; - } - for (OreLayerWrapper oreVein : internalDimOreList) { - oreVeinToProbabilityInDimension.put(oreVein, ((double) oreVein.randomWeight) / ((double) totalWeight)); - } - } - } - private static final int DIMENSION_COUNT = 33; public static Integer[] weightPerWorld = new Integer[DIMENSION_COUNT]; public static Integer[] DimIDs = new Integer[DIMENSION_COUNT]; public static HashMap mapOreLayerWrapper = new HashMap<>(); public static HashMap bufferedDims = new HashMap<>(); - public static HashMap dimToOreWrapper = new HashMap<>(); public GT5OreLayerHelper() { Arrays.fill(weightPerWorld, 0); @@ -45,40 +26,6 @@ public class GT5OreLayerHelper { for (OreLayerWrapper layer : mapOreLayerWrapper.values()) { bufferedDims.put(layer, getDims(layer)); } - - // ------------------------------ - // Get dims as "Ow,Ne,Ma" etc. - for (OreLayerWrapper oreLayer : bufferedDims.keySet()) { - - String dims = bufferedDims.get(oreLayer); - - if (dims.equals("Not available in any Galactic Dim!")) { - continue; - } - - for (String dim : dims.split(",")) { - if (dim.length() != 0) { - oreDimensionWrapper dimensionOres = dimToOreWrapper.getOrDefault(dim, new oreDimensionWrapper()); - dimensionOres.internalDimOreList.add(oreLayer); - dimToOreWrapper.put(dim, dimensionOres); - } - } - - // Calculate probabilities for each dim. - for (String dim : dimToOreWrapper.keySet()) { - dimToOreWrapper.get(dim).calculateWeights(); - } - - for (String dim : dimToOreWrapper.keySet()) { - double a = dimToOreWrapper.get(dim).oreVeinToProbabilityInDimension.values() - .stream() - .mapToDouble(Double::valueOf) - .sum(); - - System.out.println("TEST312IMJD + " + a); - } - } - // ------------------------------ } public static String getDims(OreLayerWrapper oreLayer) { @@ -92,28 +39,12 @@ public class GT5OreLayerHelper { public short randomWeight, size, density; public List Weight = new ArrayList<>(); - public Materials mPrimaryVeinMaterial; - public Materials mSecondaryMaterial; - public Materials mBetweenMaterial; - public Materials mSporadicMaterial; - public OreLayerWrapper(GT_Worldgen_GT_Ore_Layer worldGen) { this.veinName = worldGen.mWorldGenName; this.Meta[0] = worldGen.mPrimaryMeta; this.Meta[1] = worldGen.mSecondaryMeta; this.Meta[2] = worldGen.mBetweenMeta; this.Meta[3] = worldGen.mSporadicMeta; - - // Black magic, don't ask me how it works, I have no idea. - try { - this.mPrimaryVeinMaterial = GT_OreDictUnificator.getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mPrimaryMeta)).mMaterial.mMaterial; - this.mSecondaryMaterial = GT_OreDictUnificator.getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSecondaryMeta)).mMaterial.mMaterial; - this.mBetweenMaterial = GT_OreDictUnificator.getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mBetweenMeta)).mMaterial.mMaterial; - this.mSporadicMaterial = GT_OreDictUnificator.getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSporadicMeta)).mMaterial.mMaterial; - } catch(Exception ignored) { - - } - this.size = worldGen.mSize; this.density = worldGen.mDensity; this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java index 4e2dce5104..a730b3d148 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java @@ -106,13 +106,13 @@ public class GT5OreSmallHelper { try { Field fieldRestrictBiome = clazzGTOreSmall.getField("mRestrictBiome"); restrictBiomeSupport = true; - } catch (Exception ignored) { + } catch (Exception e) { } try { Field fieldGCMoon = clazzGTOreSmall.getField("mMoon"); Field fieldGCMars = clazzGTOreSmall.getField("mMars"); gcBasicSupport = true; - } catch (Exception ignored) { + } catch (Exception e) { } } } -- cgit From 7cdbdb7e6ed5e5864bf2cebc9aff8b6941a8ed95 Mon Sep 17 00:00:00 2001 From: Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> Date: Sat, 17 Dec 2022 22:01:01 +0000 Subject: Helper hashmaps for black hole gen (#24) * spotlessApply (#26) Co-authored-by: Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> Co-authored-by: GitHub GTNH Actions <> * Fix issues (cherry picked from commit 9396914a59f2dfc47bf50dd3609a93fe0e72615e) * Fix issues (cherry picked from commit cc48e25e31535cdb00e10970d02ee08f1922bbff) * Fix more issues * Fix conflicts Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> --- .../gwyog/gtneioreplugin/util/GT5CFGHelper.java | 6 +- .../gtneioreplugin/util/GT5OreLayerHelper.java | 69 ++++++++++++++++++++++ 2 files changed, 73 insertions(+), 2 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java index 1a62c31ec1..f6448660f0 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java @@ -16,6 +16,8 @@ import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; public class GT5CFGHelper { + public static String oreVeinNotInAnyDim = "Not available in any Galactic Dim!"; + private static File F = GregTech_API.sWorldgenFile.mConfig.getConfigFile(); public static String GT5CFGSmallOres(String Veinname) { @@ -59,7 +61,7 @@ public class GT5CFGHelper { } } ret = ret.trim(); - if (ret.equals("") || ret.equals(" ")) ret = "Not available in any Galactic Dim!"; + if (ret.equals("") || ret.equals(" ")) ret = oreVeinNotInAnyDim; return ret; } @@ -173,7 +175,7 @@ public class GT5CFGHelper { } ret = ret.trim(); // FMLLog.info("ret:"+ret); - if (ret.equals("") || ret.equals(" ")) ret = "Not available in any Galactic Dim!"; + if (ret.equals("") || ret.equals(" ")) ret = oreVeinNotInAnyDim; return ret; } catch (IOException e) { e.printStackTrace(); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index ac3873d9bc..db9020f027 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -1,8 +1,11 @@ package pers.gwyog.gtneioreplugin.util; +import static pers.gwyog.gtneioreplugin.util.GT5CFGHelper.oreVeinNotInAnyDim; import static pers.gwyog.gtneioreplugin.util.OreVeinLayer.*; import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.util.GT_OreDictUnificator; import gregtech.common.GT_Worldgen_GT_Ore_Layer; import java.util.ArrayList; import java.util.Arrays; @@ -12,11 +15,28 @@ import net.minecraft.item.ItemStack; public class GT5OreLayerHelper { + private static class OreDimensionWrapper { + public final ArrayList internalDimOreList = new ArrayList<>(); + public final HashMap oreVeinToProbabilityInDimension = new HashMap<>(); + + // Calculate all weights of ore veins once dimension is initialised. + private void calculateWeights() { + int totalWeight = 0; + for (OreLayerWrapper oreVein : internalDimOreList) { + totalWeight += oreVein.randomWeight; + } + for (OreLayerWrapper oreVein : internalDimOreList) { + oreVeinToProbabilityInDimension.put(oreVein, ((double) oreVein.randomWeight) / ((double) totalWeight)); + } + } + } + private static final int DIMENSION_COUNT = 33; public static Integer[] weightPerWorld = new Integer[DIMENSION_COUNT]; public static Integer[] DimIDs = new Integer[DIMENSION_COUNT]; public static HashMap mapOreLayerWrapper = new HashMap<>(); public static HashMap bufferedDims = new HashMap<>(); + public static HashMap dimToOreWrapper = new HashMap<>(); public GT5OreLayerHelper() { Arrays.fill(weightPerWorld, 0); @@ -26,6 +46,27 @@ public class GT5OreLayerHelper { for (OreLayerWrapper layer : mapOreLayerWrapper.values()) { bufferedDims.put(layer, getDims(layer)); } + + // ------------------------------ + // Get dims as "Ow,Ne,Ma" etc. + bufferedDims.forEach((oreLayer, dims) -> { + if (dims.equals(oreVeinNotInAnyDim)) { + return; + } + + for (String dim : dims.split(",")) { + if (dim.isEmpty()) { + OreDimensionWrapper dimensionOres = dimToOreWrapper.getOrDefault(dim, new OreDimensionWrapper()); + dimensionOres.internalDimOreList.add(oreLayer); + dimToOreWrapper.put(dim, dimensionOres); + } + } + + // Calculate probabilities for each dim. + for (String dim : dimToOreWrapper.keySet()) { + dimToOreWrapper.get(dim).calculateWeights(); + } + }); } public static String getDims(OreLayerWrapper oreLayer) { @@ -39,12 +80,40 @@ public class GT5OreLayerHelper { public short randomWeight, size, density; public List Weight = new ArrayList<>(); + public Materials mPrimaryVeinMaterial; + public Materials mSecondaryMaterial; + public Materials mBetweenMaterial; + public Materials mSporadicMaterial; + public OreLayerWrapper(GT_Worldgen_GT_Ore_Layer worldGen) { this.veinName = worldGen.mWorldGenName; this.Meta[0] = worldGen.mPrimaryMeta; this.Meta[1] = worldGen.mSecondaryMeta; this.Meta[2] = worldGen.mBetweenMeta; this.Meta[3] = worldGen.mSporadicMeta; + + // Black magic, don't ask me how it works, I have no idea. + try { + this.mPrimaryVeinMaterial = GT_OreDictUnificator.getAssociation( + new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mPrimaryMeta)) + .mMaterial + .mMaterial; + this.mSecondaryMaterial = GT_OreDictUnificator.getAssociation( + new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSecondaryMeta)) + .mMaterial + .mMaterial; + this.mBetweenMaterial = GT_OreDictUnificator.getAssociation( + new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mBetweenMeta)) + .mMaterial + .mMaterial; + this.mSporadicMaterial = GT_OreDictUnificator.getAssociation( + new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSporadicMeta)) + .mMaterial + .mMaterial; + } catch (Exception ignored) { + + } + this.size = worldGen.mSize; this.density = worldGen.mDensity; this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; -- cgit From a9edfd8efa87347168ddf040bb4759944a3c6e14 Mon Sep 17 00:00:00 2001 From: Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> Date: Sat, 17 Dec 2022 22:17:48 +0000 Subject: Change access modifier. (#27) Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> --- src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index db9020f027..ffef74d11a 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack; public class GT5OreLayerHelper { - private static class OreDimensionWrapper { + public static class OreDimensionWrapper { public final ArrayList internalDimOreList = new ArrayList<>(); public final HashMap oreVeinToProbabilityInDimension = new HashMap<>(); -- cgit From b1d0a92687b36b5e0878e08befd09dffc0ba85ce Mon Sep 17 00:00:00 2001 From: Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> Date: Sat, 17 Dec 2022 23:07:25 +0000 Subject: Fix if statement not triggering code correctly and slight clarification. (#28) Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> --- .../java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index ffef74d11a..c240a175c7 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -47,17 +47,18 @@ public class GT5OreLayerHelper { bufferedDims.put(layer, getDims(layer)); } - // ------------------------------ + // --- Handling of dimToOreWrapper --- + // Get dims as "Ow,Ne,Ma" etc. - bufferedDims.forEach((oreLayer, dims) -> { + bufferedDims.forEach((veinInfo, dims) -> { if (dims.equals(oreVeinNotInAnyDim)) { return; } for (String dim : dims.split(",")) { - if (dim.isEmpty()) { + if (!dim.isEmpty()) { OreDimensionWrapper dimensionOres = dimToOreWrapper.getOrDefault(dim, new OreDimensionWrapper()); - dimensionOres.internalDimOreList.add(oreLayer); + dimensionOres.internalDimOreList.add(veinInfo); dimToOreWrapper.put(dim, dimensionOres); } } @@ -67,6 +68,7 @@ public class GT5OreLayerHelper { dimToOreWrapper.get(dim).calculateWeights(); } }); + // --- End of handling for dimToOreWrapper --- } public static String getDims(OreLayerWrapper oreLayer) { -- cgit From 3f1f37d003b28d02bd896aebf6287420e8dcceeb Mon Sep 17 00:00:00 2001 From: Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> Date: Wed, 21 Dec 2022 17:26:57 +0000 Subject: More helpers for other mods (#29) * Add small ore helper hash maps, clean up a little and add getDimensionRocketTier to BlockDimensionDisplay * Try catch exception to prevent state engine erroring. * Spotless * Adjust tier display slightly for errors. Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> --- .../plugin/block/BlockDimensionDisplay.java | 9 ++++ .../renderer/ItemDimensionDisplayRenderer.java | 50 +++++++++++-------- .../gwyog/gtneioreplugin/util/GT5CFGHelper.java | 1 + .../gtneioreplugin/util/GT5OreLayerHelper.java | 8 +-- .../gtneioreplugin/util/GT5OreSmallHelper.java | 58 ++++++++++++++++++++++ 5 files changed, 102 insertions(+), 24 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/BlockDimensionDisplay.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/BlockDimensionDisplay.java index 5ef2cb04a9..048ce84aff 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/BlockDimensionDisplay.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/BlockDimensionDisplay.java @@ -1,5 +1,7 @@ package pers.gwyog.gtneioreplugin.plugin.block; +import static pers.gwyog.gtneioreplugin.plugin.renderer.ItemDimensionDisplayRenderer.getPrefix; + import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -9,6 +11,12 @@ import net.minecraft.util.IIcon; public class BlockDimensionDisplay extends Block { private final String dimension; + + public long getDimensionRocketTier() { + return dimensionRocketTier; + } + + private final long dimensionRocketTier; private IIcon iconTop; private IIcon iconRight; private IIcon iconLeft; @@ -16,6 +24,7 @@ public class BlockDimensionDisplay extends Block { public BlockDimensionDisplay(String dimension) { super(Material.rock); this.dimension = dimension; + this.dimensionRocketTier = getPrefix(dimension); } @Override diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java index b175b456b1..f3feda0544 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java @@ -22,6 +22,7 @@ public class ItemDimensionDisplayRenderer implements IItemRenderer { return false; } + // Renders the actual text on top of planet items. @Override public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { String dimension = ItemDimensionDisplay.getDimension(stack); @@ -32,56 +33,65 @@ public class ItemDimensionDisplayRenderer implements IItemRenderer { renderItem.renderItemIntoGUI( Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().renderEngine, stack, 0, 0, false); - String prefix = getPrefix(dimension); - if (!prefix.isEmpty()) { - FontRenderer fontRender = Minecraft.getMinecraft().fontRenderer; - float smallTextScale = 3F / 4F; + FontRenderer fontRender = Minecraft.getMinecraft().fontRenderer; + float smallTextScale = 3F / 4F; - GL11.glPushMatrix(); - GL11.glTranslatef(0, 0, 300); - GL11.glScalef(smallTextScale, smallTextScale, 1.0f); + GL11.glPushMatrix(); + GL11.glTranslatef(0, 0, 300); + GL11.glScalef(smallTextScale, smallTextScale, 1.0f); - fontRender.drawString(prefix, 0, (int) (16 / smallTextScale) - fontRender.FONT_HEIGHT + 1, 0xFFFFFF, true); + long prefix = getPrefix(dimension); + String tooltipPrefix = prefix != -1 ? "T" + prefix : "INVALID. Please, report this to the GTNH team"; - GL11.glPopMatrix(); - } + fontRender.drawString( + tooltipPrefix, 0, (int) (16 / smallTextScale) - fontRender.FONT_HEIGHT + 1, 0xFFFFFF, true); + + GL11.glPopMatrix(); GL11.glDisable(GL11.GL_ALPHA_TEST); } - private static String getPrefix(String dimName) { + // See DimensionHelper.DimNameDisplayed for real names of these. + public static long getPrefix(String dimName) { switch (dimName) { + case "Ow": + case "Ne": + case "TF": + case "ED": + case "VA": + case "EA": + return 0L; case "Mo": - return "T1"; + return 1L; case "De": case "Ma": case "Ph": - return "T2"; + return 2L; case "As": case "Ca": case "Ce": case "Eu": case "Ga": case "Rb": - return "T3"; + return 3L; case "Io": case "Me": case "Ve": - return "T4"; + return 4L; case "En": case "Mi": case "Ob": case "Ti": case "Ra": - return "T5"; + return 5L; case "Pr": case "Tr": - return "T6"; + return 6L; case "Ha": case "KB": case "MM": case "Pl": - return "T7"; + return 7L; case "BC": case "BE": case "BF": @@ -89,9 +99,9 @@ public class ItemDimensionDisplayRenderer implements IItemRenderer { case "TE": case "DD": case "VB": - return "T8"; + return 8L; default: - return ""; + return -1L; } } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java index f6448660f0..9b12e3d007 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java @@ -16,6 +16,7 @@ import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; public class GT5CFGHelper { + // Do NOT ever put a comma in this or it will break split calls later in the code. Bad, but it is what it is. public static String oreVeinNotInAnyDim = "Not available in any Galactic Dim!"; private static File F = GregTech_API.sWorldgenFile.mConfig.getConfigFile(); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index c240a175c7..3df3d98242 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack; public class GT5OreLayerHelper { - public static class OreDimensionWrapper { + public static class NormalOreDimensionWrapper { public final ArrayList internalDimOreList = new ArrayList<>(); public final HashMap oreVeinToProbabilityInDimension = new HashMap<>(); @@ -36,7 +36,7 @@ public class GT5OreLayerHelper { public static Integer[] DimIDs = new Integer[DIMENSION_COUNT]; public static HashMap mapOreLayerWrapper = new HashMap<>(); public static HashMap bufferedDims = new HashMap<>(); - public static HashMap dimToOreWrapper = new HashMap<>(); + public static HashMap dimToOreWrapper = new HashMap<>(); public GT5OreLayerHelper() { Arrays.fill(weightPerWorld, 0); @@ -57,7 +57,8 @@ public class GT5OreLayerHelper { for (String dim : dims.split(",")) { if (!dim.isEmpty()) { - OreDimensionWrapper dimensionOres = dimToOreWrapper.getOrDefault(dim, new OreDimensionWrapper()); + NormalOreDimensionWrapper dimensionOres = + dimToOreWrapper.getOrDefault(dim, new NormalOreDimensionWrapper()); dimensionOres.internalDimOreList.add(veinInfo); dimToOreWrapper.put(dim, dimensionOres); } @@ -113,7 +114,6 @@ public class GT5OreLayerHelper { .mMaterial .mMaterial; } catch (Exception ignored) { - } this.size = worldGen.mSize; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java index a730b3d148..9ea39398ea 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java @@ -1,5 +1,7 @@ package pers.gwyog.gtneioreplugin.util; +import static pers.gwyog.gtneioreplugin.util.GT5CFGHelper.oreVeinNotInAnyDim; + import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; @@ -21,6 +23,24 @@ public class GT5OreSmallHelper { public static HashMap mapOreDropUnlocalizedNameToOreMeta = new HashMap<>(); public static HashMap> mapOreMetaToOreDrops = new HashMap<>(); public static HashMap bufferedDims = new HashMap<>(); + public static HashMap dimToSmallOreWrapper = new HashMap<>(); + + public static class SmallOreDimensionWrapper { + public final ArrayList internalDimOreList = new ArrayList<>(); + public final HashMap oreVeinToProbabilityInDimension = new HashMap<>(); + + // Calculate all weights of ore veins once dimension is initialised. + private void calculateWeights() { + int totalWeight = 0; + for (OreSmallWrapper oreVein : internalDimOreList) { + totalWeight += oreVein.amountPerChunk; + } + for (OreSmallWrapper oreVein : internalDimOreList) { + oreVeinToProbabilityInDimension.put( + oreVein, ((double) oreVein.amountPerChunk) / ((double) totalWeight)); + } + } + } public GT5OreSmallHelper() { checkExtraSupport(); @@ -94,6 +114,30 @@ public class GT5OreSmallHelper { for (OreSmallWrapper oreSmallWrapper : mapOreSmallWrapper.values()) { bufferedDims.put(oreSmallWrapper, GT5CFGHelper.GT5CFGSmallOres(oreSmallWrapper.oreGenName)); } + + // --- Handling of dimToOreWrapper --- + + // Get dims as "Ow,Ne,Ma" etc. + bufferedDims.forEach((veinInfo, dims) -> { + if (dims.equals(oreVeinNotInAnyDim)) { + return; + } + + for (String dim : dims.split(",")) { + if (!dim.isEmpty()) { + SmallOreDimensionWrapper dimensionSmallOres = + dimToSmallOreWrapper.getOrDefault(dim, new SmallOreDimensionWrapper()); + dimensionSmallOres.internalDimOreList.add(veinInfo); + dimToSmallOreWrapper.put(dim, dimensionSmallOres); + } + } + + // Calculate probabilities for each dim. + for (String dim : dimToSmallOreWrapper.keySet()) { + dimToSmallOreWrapper.get(dim).calculateWeights(); + } + }); + // --- End of handling for dimToOreWrapper --- } private static void checkExtraSupport() { @@ -137,11 +181,25 @@ public class GT5OreSmallHelper { public short amountPerChunk; public String restrictBiome; + public Materials getOreMaterial() { + return oreMaterial; + } + + private Materials oreMaterial = null; + public OreSmallWrapper(GT_Worldgen_GT_Ore_SmallPieces worldGen) { this.oreGenName = worldGen.mWorldGenName; this.oreMeta = worldGen.mMeta; this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; this.amountPerChunk = worldGen.mAmount; + try { + this.oreMaterial = GT_OreDictUnificator.getAssociation( + new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mMeta)) + .mMaterial + .mMaterial; + } catch (Exception e) { + e.printStackTrace(); + } } public List getMaterialDrops(int maximumIndex) { -- cgit From 90d2ab48a37fa5418c316090e22411125ce20261 Mon Sep 17 00:00:00 2001 From: Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> Date: Fri, 30 Dec 2022 12:05:44 +0000 Subject: Make DD offiically tier 9 (#30) Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> --- .../gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java | 3 ++- src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java index f3feda0544..c4cca1387c 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java @@ -97,9 +97,10 @@ public class ItemDimensionDisplayRenderer implements IItemRenderer { case "BF": case "CB": case "TE": - case "DD": case "VB": return 8L; + case "DD": + return 9L; default: return -1L; } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java index 74f726dac1..1b361cb86e 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -172,10 +172,12 @@ public class DimensionHelper { case "BarnardF": case "CentauriA": case "TcetiE": - case "Underdark": case "VegaB": s = "T8: " + s; break; + case "Underdark": + s = "T9: " + s; + break; } dims[j] = s; -- cgit From ec1ed112790794d344ff6679ed0bbc13a9b5d1ee Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Sun, 29 Jan 2023 10:49:21 -0800 Subject: [ci skip] Update buildscript to RetroFuturaGradle --- .gitattributes | 44 + build.gradle | 1334 ++++++++++++++++++------------ gradle/wrapper/gradle-wrapper.jar | Bin 55616 -> 61608 bytes gradle/wrapper/gradle-wrapper.properties | 3 +- gradlew | 272 +++--- gradlew.bat | 38 +- settings.gradle | 24 +- 7 files changed, 1051 insertions(+), 664 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..fd2792b6cb --- /dev/null +++ b/.gitattributes @@ -0,0 +1,44 @@ +* text eol=lf + +*.[jJ][aA][rR] binary + +*.[pP][nN][gG] binary +*.[jJ][pP][gG] binary +*.[jJ][pP][eE][gG] binary +*.[gG][iI][fF] binary +*.[tT][iI][fF] binary +*.[tT][iI][fF][fF] binary +*.[iI][cC][oO] binary +*.[sS][vV][gG] text +*.[eE][pP][sS] binary +*.[xX][cC][fF] binary + +*.[kK][aA][rR] binary +*.[mM]4[aA] binary +*.[mM][iI][dD] binary +*.[mM][iI][dD][iI] binary +*.[mM][pP]3 binary +*.[oO][gG][gG] binary +*.[rR][aA] binary + +*.7[zZ] binary +*.[gG][zZ] binary +*.[tT][aA][rR] binary +*.[tT][gG][zZ] binary +*.[zZ][iI][pP] binary + +*.[tT][cC][nN] binary +*.[sS][oO] binary +*.[dD][lL][lL] binary +*.[dD][yY][lL][iI][bB] binary +*.[pP][sS][dD] binary +*.[tT][tT][fF] binary +*.[oO][tT][fF] binary + +*.[pP][aA][tT][cC][hH] -text + +*.[bB][aA][tT] text eol=crlf +*.[cC][mM][dD] text eol=crlf +*.[pP][sS]1 text eol=crlf + +*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary diff --git a/build.gradle b/build.gradle index 3c075f03bb..18afe431e9 100644 --- a/build.gradle +++ b/build.gradle @@ -1,31 +1,44 @@ -//version: 1659365110 +//version: 1675013090 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. - Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates. + Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/master/build.gradle for updates. */ +import com.diffplug.blowdryer.Blowdryer import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import com.gtnewhorizons.retrofuturagradle.mcp.ReobfuscatedJar +import com.matthewprenger.cursegradle.CurseArtifact +import com.matthewprenger.cursegradle.CurseRelation +import com.modrinth.minotaur.dependencies.ModDependency +import com.modrinth.minotaur.dependencies.VersionDependency import org.gradle.internal.logging.text.StyledTextOutput.Style import org.gradle.internal.logging.text.StyledTextOutputFactory +import org.jetbrains.gradle.ext.* import java.nio.file.Files import java.nio.file.Paths import java.util.concurrent.TimeUnit import java.util.zip.ZipEntry -import java.util.zip.ZipInputStream import java.util.zip.ZipOutputStream buildscript { repositories { + mavenLocal() mavenCentral() maven { name 'forge' url 'https://maven.minecraftforge.net' } + maven { + // GTNH RetroFuturaGradle and ASM Fork + name "GTNH Maven" + url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" + allowInsecureProtocol = true + } maven { name 'sonatype' url 'https://oss.sonatype.org/content/repositories/snapshots/' @@ -34,38 +47,31 @@ buildscript { name 'Scala CI dependencies' url 'https://repo1.maven.org/maven2/' } - maven { - name 'jitpack' - url 'https://jitpack.io' - } - } - dependencies { - classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.11' } } plugins { id 'java-library' - id 'idea' + id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7" id 'eclipse' id 'scala' id 'maven-publish' - id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false - id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false - id 'com.google.devtools.ksp' version '1.5.30-1.0.0' apply false - id 'org.ajoberstar.grgit' version '4.1.1' - id 'com.github.johnrengelman.shadow' version '4.0.4' - id 'com.palantir.git-version' version '0.13.0' apply false - id 'de.undercouch.download' version '5.0.1' - id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false - id "com.diffplug.spotless" version "6.7.2" -} -verifySettingsGradle() - -dependencies { - implementation 'com.diffplug:blowdryer:1.6.0' -} - -apply plugin: 'com.diffplug.blowdryer' + id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false + id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false + id 'com.google.devtools.ksp' version '1.5.30-1.0.0' apply false + id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version ,unused, available for addon.gradle + id 'com.github.johnrengelman.shadow' version '7.1.2' apply false + id 'com.palantir.git-version' version '0.13.0' apply false // 0.13.0 is the last jvm8 supporting version + id 'de.undercouch.download' version '5.3.0' + id 'com.github.gmazzo.buildconfig' version '3.1.0' apply false // Unused, available for addon.gradle + id 'com.diffplug.spotless' version '6.7.2' apply false + id 'com.modrinth.minotaur' version '2.+' apply false + id 'com.matthewprenger.cursegradle' version '1.4.0' apply false + id 'com.gtnewhorizons.retrofuturagradle' version '1.0.18' +} +boolean settingsupdated = verifySettingsGradle() +settingsupdated = verifyGitAttributes() || settingsupdated +if (settingsupdated) + throw new GradleException("Settings has been updated, please re-run task.") if (project.file('.git/HEAD').isFile()) { apply plugin: 'com.palantir.git-version' @@ -73,28 +79,9 @@ if (project.file('.git/HEAD').isFile()) { def out = services.get(StyledTextOutputFactory).create('an-output') -apply plugin: 'forge' - def projectJavaVersion = JavaLanguageVersion.of(8) -java { - toolchain { - languageVersion.set(projectJavaVersion) - } -} - -idea { - module { - inheritOutputDirs = true - downloadJavadoc = true - downloadSources = true - } -} -apply from: Blowdryer.file('spotless.gradle') - -if(JavaVersion.current() != JavaVersion.VERSION_1_8) { - throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current()) -} +boolean disableSpotless = project.hasProperty("disableSpotless") ? project.disableSpotless.toBoolean() : false checkPropertyExists("modName") checkPropertyExists("modId") @@ -103,10 +90,7 @@ checkPropertyExists("autoUpdateBuildScript") checkPropertyExists("minecraftVersion") checkPropertyExists("forgeVersion") checkPropertyExists("replaceGradleTokenInFile") -checkPropertyExists("gradleTokenModId") -checkPropertyExists("gradleTokenModName") checkPropertyExists("gradleTokenVersion") -checkPropertyExists("gradleTokenGroupName") checkPropertyExists("apiPackage") checkPropertyExists("accessTransformersFile") checkPropertyExists("usesMixins") @@ -117,70 +101,175 @@ checkPropertyExists("containsMixinsAndOrCoreModOnly") checkPropertyExists("usesShadowedDependencies") checkPropertyExists("developmentEnvironmentUserName") -boolean noPublishedSources = project.hasProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false -boolean usesMixinDebug = project.hasProperty('usesMixinDebug') ?: project.usesMixins.toBoolean() -boolean forceEnableMixins = project.hasProperty('forceEnableMixins') ? project.forceEnableMixins.toBoolean() : false -String channel = project.hasProperty('channel') ? project.channel : 'stable' -String mappingsVersion = project.hasProperty('mappingsVersion') ? project.mappingsVersion : '12' +propertyDefaultIfUnset("generateGradleTokenClass", "") +propertyDefaultIfUnset("includeWellKnownRepositories", true) +propertyDefaultIfUnset("noPublishedSources", false) +propertyDefaultIfUnset("usesMixinDebug", project.usesMixins) +propertyDefaultIfUnset("forceEnableMixins", false) +propertyDefaultIfUnset("channel", "stable") +propertyDefaultIfUnset("mappingsVersion", "12") +propertyDefaultIfUnset("modrinthProjectId", "") +propertyDefaultIfUnset("modrinthRelations", "") +propertyDefaultIfUnset("curseForgeProjectId", "") +propertyDefaultIfUnset("curseForgeRelations", "") +propertyDefaultIfUnset("minimizeShadowedDependencies", true) +// Deprecated properties (kept for backwards compat) +propertyDefaultIfUnset("gradleTokenModId", "") +propertyDefaultIfUnset("gradleTokenModName", "") +propertyDefaultIfUnset("gradleTokenGroupName", "") + +propertyDefaultIfUnset("enableModernJavaSyntax", false) // On by default for new projects only +propertyDefaultIfUnset("enableGenericInjection", false) // On by default for new projects only + +project.extensions.add(Blowdryer, "Blowdryer", Blowdryer) // Make blowdryer available in "apply from:" scripts +if (!disableSpotless) { + apply plugin: 'com.diffplug.spotless' + apply from: Blowdryer.file('spotless.gradle') +} + String javaSourceDir = "src/main/java/" String scalaSourceDir = "src/main/scala/" String kotlinSourceDir = "src/main/kotlin/" -String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") -String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") -String targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") -if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { +if (usesShadowedDependencies.toBoolean()) { + apply plugin: "com.github.johnrengelman.shadow" +} + +java { + toolchain { + if (enableModernJavaSyntax.toBoolean()) { + languageVersion.set(JavaLanguageVersion.of(17)) + } else { + languageVersion.set(projectJavaVersion) + } + vendor.set(JvmVendorSpec.ADOPTIUM) + } + if (!noPublishedSources) { + withSourcesJar() + } +} + +configurations { + create("runtimeOnlyNonPublishable") { + description = "Runtime only dependencies that are not published alongside the jar" + canBeConsumed = false + canBeResolved = false + } +} + +if (enableModernJavaSyntax.toBoolean()) { + dependencies { + annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0' + compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') { + transitive = false // We only care about the 1 annotation class + } + } + + tasks.withType(JavaCompile).configureEach { + if (it.name in ["compileMcLauncherJava", "compilePatchedMcJava"]) { + return + } + sourceCompatibility = 17 // for the IDE support + options.release.set(8) + + javaCompiler.set(javaToolchains.compilerFor { + languageVersion.set(JavaLanguageVersion.of(17)) + vendor.set(JvmVendorSpec.ADOPTIUM) + }) + } +} + +eclipse { + classpath { + downloadSources = true + downloadJavadoc = true + } +} + +final String modGroupPath = modGroup.toString().replace('.' as char, '/' as char) +final String apiPackagePath = apiPackage.toString().replace('.' as char, '/' as char) + +String targetPackageJava = javaSourceDir + modGroupPath +String targetPackageScala = scalaSourceDir + modGroupPath +String targetPackageKotlin = kotlinSourceDir + modGroupPath +if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) } -if(apiPackage) { - targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") - targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") - targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") - if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { +if (apiPackage) { + targetPackageJava = javaSourceDir + modGroupPath + "/" + apiPackagePath + targetPackageScala = scalaSourceDir + modGroupPath + "/" + apiPackagePath + targetPackageKotlin = kotlinSourceDir + modGroupPath + "/" + apiPackagePath + if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) } } -if(accessTransformersFile) { +if (accessTransformersFile) { String targetFile = "src/main/resources/META-INF/" + accessTransformersFile - if(!getFile(targetFile).exists()) { + if (!getFile(targetFile).exists()) { throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) } + tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(targetFile) + tasks.srgifyBinpatchedJar.accessTransformerFiles.from(targetFile) +} else { + boolean atsFound = false + for (File at : sourceSets.getByName("main").resources.files) { + if (at.name.toLowerCase().endsWith("_at.cfg")) { + atsFound = true + tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(at) + tasks.srgifyBinpatchedJar.accessTransformerFiles.from(at) + } + } + for (File at : sourceSets.getByName("api").resources.files) { + if (at.name.toLowerCase().endsWith("_at.cfg")) { + atsFound = true + tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(at) + tasks.srgifyBinpatchedJar.accessTransformerFiles.from(at) + } + } + if (atsFound) { + logger.warn("Found and added access transformers in the resources folder, please configure gradle.properties to explicitly mention them by name") + } } -if(usesMixins.toBoolean()) { - if(mixinsPackage.isEmpty() || mixinPlugin.isEmpty()) { - throw new GradleException("\"mixinPlugin\" requires \"mixinsPackage\" and \"mixinPlugin\" to be set!") +if (usesMixins.toBoolean()) { + if (mixinsPackage.isEmpty()) { + throw new GradleException("\"usesMixins\" requires \"mixinsPackage\" to be set!") } - - targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") - targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") - targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") - if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { - throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) + final String mixinPackagePath = mixinsPackage.toString().replaceAll("\\.", "/") + final String mixinPluginPath = mixinPlugin.toString().replaceAll("\\.", "/") + + targetPackageJava = javaSourceDir + modGroupPath + "/" + mixinPackagePath + targetPackageScala = scalaSourceDir + modGroupPath + "/" + mixinPackagePath + targetPackageKotlin = kotlinSourceDir + modGroupPath + "/" + mixinPackagePath + if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { + throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) } - String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" - String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala" - String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" - String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".kt" - if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { - throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) + if (!mixinPlugin.isEmpty()) { + String targetFileJava = javaSourceDir + modGroupPath + "/" + mixinPluginPath + ".java" + String targetFileScala = scalaSourceDir + modGroupPath + "/" + mixinPluginPath + ".scala" + String targetFileScalaJava = scalaSourceDir + modGroupPath + "/" + mixinPluginPath + ".java" + String targetFileKotlin = kotlinSourceDir + modGroupPath + "/" + mixinPluginPath + ".kt" + if (!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { + throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) + } } } -if(coreModClass) { - String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" - String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala" - String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" - String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".kt" - if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { +if (coreModClass) { + final String coreModPath = coreModClass.toString().replaceAll("\\.", "/") + String targetFileJava = javaSourceDir + modGroupPath + "/" + coreModPath + ".java" + String targetFileScala = scalaSourceDir + modGroupPath + "/" + coreModPath + ".scala" + String targetFileScalaJava = scalaSourceDir + modGroupPath + "/" + coreModPath + ".java" + String targetFileKotlin = kotlinSourceDir + modGroupPath + "/" + coreModPath + ".kt" + if (!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) } } -configurations.all { +configurations.configureEach { resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS) // Make sure GregTech build won't time out @@ -204,145 +293,239 @@ try { } catch (Exception ignored) { out.style(Style.Failure).text( - 'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' + + 'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' + 'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' + - 'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)' - ) + 'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)' + ) versionOverride = 'NO-GIT-TAG-SET' identifiedVersion = versionOverride } -version = minecraftVersion + '-' + identifiedVersion +version = identifiedVersion ext { modVersion = identifiedVersion } -if(identifiedVersion == versionOverride) { +if (identifiedVersion == versionOverride) { out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7') } group = modGroup -if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) { +if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) { archivesBaseName = customArchiveBaseName -} -else { +} else { archivesBaseName = modId } -def arguments = [] -def jvmArguments = [] - -if (usesMixins.toBoolean() || forceEnableMixins) { - arguments += [ - "--tweakClass org.spongepowered.asm.launch.MixinTweaker" - ] - if (usesMixinDebug.toBoolean()) { - jvmArguments += [ - "-Dmixin.debug.countInjections=true", - "-Dmixin.debug.verbose=true", - "-Dmixin.debug.export=true" - ] - } -} minecraft { - version = minecraftVersion + '-' + forgeVersion + '-' + minecraftVersion - runDir = 'run' - if (replaceGradleTokenInFile) { - replaceIn replaceGradleTokenInFile - if(gradleTokenModId) { - replace gradleTokenModId, modId - } - if(gradleTokenModName) { - replace gradleTokenModName, modName + for (f in replaceGradleTokenInFile.split(',')) { + tagReplacementFiles.add f } - if(gradleTokenVersion) { - replace gradleTokenVersion, modVersion - } - if(gradleTokenGroupName) { - replace gradleTokenGroupName, modGroup + } + if (gradleTokenModId) { + injectedTags.put gradleTokenModId, modId + } + if (gradleTokenModName) { + injectedTags.put gradleTokenModName, modName + } + if (gradleTokenVersion) { + injectedTags.put gradleTokenVersion, modVersion + } + if (gradleTokenGroupName) { + injectedTags.put gradleTokenGroupName, modGroup + } + if (enableGenericInjection.toBoolean()) { + injectMissingGenerics.set(true) + } + + // Enable assertions in the current mod + extraRunJvmArguments.add("-ea:${modGroup}") + + if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { + extraTweakClasses.add("org.spongepowered.asm.launch.MixinTweaker") + + if (usesMixinDebug.toBoolean()) { + extraRunJvmArguments.addAll([ + "-Dmixin.debug.countInjections=true", + "-Dmixin.debug.verbose=true", + "-Dmixin.debug.export=true" + ]) } } - clientIntellijRun { - args(arguments) - jvmArgs(jvmArguments) + // Blowdryer is present in some old mod builds, do not propagate it further as a dependency + // IC2 has no reobf jars in its Maven + groupsToExcludeFromAutoReobfMapping.addAll(["com.diffplug", "com.diffplug.durian", "net.industrial-craft"]) +} + +if (generateGradleTokenClass) { + tasks.injectTags.outputClassName.set(generateGradleTokenClass) +} - if(developmentEnvironmentUserName) { - args("--username", developmentEnvironmentUserName) +// Custom reobf auto-mappings +configurations.configureEach { + dependencies.configureEach { dep -> + if (dep instanceof org.gradle.api.artifacts.ExternalModuleDependency) { + if (dep.group == "net.industrial-craft" && dep.name == "industrialcraft-2") { + // https://www.curseforge.com/minecraft/mc-mods/industrial-craft/files/2353971 + project.dependencies.reobfJarConfiguration("curse.maven:ic2-242638:2353971") + } } } +} - serverIntellijRun { - args(arguments) - jvmArgs(jvmArguments) +// Ensure tests have access to minecraft classes +sourceSets { + test { + java { + compileClasspath += sourceSets.patchedMc.output + sourceSets.mcLauncher.output + runtimeClasspath += sourceSets.patchedMc.output + sourceSets.mcLauncher.output + } } } -if(file('addon.gradle').exists()) { +if (file('addon.gradle').exists()) { apply from: 'addon.gradle' } +// Allow unsafe repos but warn +repositories.configureEach { repo -> + if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) { + if (repo.getUrl() != null && repo.getUrl().getScheme() == "http" && !repo.allowInsecureProtocol) { + logger.warn("Deprecated: Allowing insecure connections for repo '${repo.name}' - add 'allowInsecureProtocol = true'") + repo.allowInsecureProtocol = true + } + } +} + apply from: 'repositories.gradle' configurations { - implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored - implementation.extendsFrom(shadowCompile) - implementation.extendsFrom(shadeCompile) + for (config in [compileClasspath, runtimeClasspath, testCompileClasspath, testRuntimeClasspath]) { + config.extendsFrom(runtimeOnlyNonPublishable) + if (usesShadowedDependencies.toBoolean()) { + config.extendsFrom(shadowImplementation) + // TODO: remove Compile after all uses are refactored to Implementation + config.extendsFrom(shadeCompile) + config.extendsFrom(shadowCompile) + } + } + // A "bag-of-dependencies"-style configuration for backwards compatibility, gets put in "api" + create("compile") { + description = "Deprecated: use api or implementation instead, gets put in api" + canBeConsumed = false + canBeResolved = false + visible = false + } + create("testCompile") { + description = "Deprecated: use testImplementation instead" + canBeConsumed = false + canBeResolved = false + visible = false + } + api.extendsFrom(compile) + testImplementation.extendsFrom(testCompile) +} + +afterEvaluate { + if (!configurations.compile.allDependencies.empty || !configurations.testCompile.allDependencies.empty) { + logger.warn("This project uses deprecated `compile` dependencies, please migrate to using `api` and `implementation`") + logger.warn("For more details, see https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/master/dependencies.gradle") + } } repositories { maven { name 'Overmind forge repo mirror' url 'https://gregtech.overminddl1.com/' + mavenContent { + excludeGroup("net.minecraftforge") // missing the `universal` artefact + } + } + maven { + name = "GTNH Maven" + url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" + allowInsecureProtocol = true } - if(usesMixins.toBoolean() || forceEnableMixins) { + if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { + if (usesMixinDebug.toBoolean()) { + maven { + name = "Fabric Maven" + url = "https://maven.fabricmc.net/" + } + } + } + if (includeWellKnownRepositories.toBoolean()) { + maven { + name "CurseMaven" + url "https://cursemaven.com" + content { + includeGroup "curse.maven" + } + } + maven { + name = "ic2" + url = "https://maven.ic2.player.to/" + metadataSources { + mavenPom() + artifact() + } + } maven { - name 'sponge' - url 'https://repo.spongepowered.org/repository/maven-public' + name = "ic2-mirror" + url = "https://maven2.ic2.player.to/" + metadataSources { + mavenPom() + artifact() + } } maven { - url 'https://jitpack.io' + name "MMD Maven" + url "https://maven.mcmoddev.com/" } } } dependencies { - if(usesMixins.toBoolean()) { + if (usesMixins.toBoolean()) { annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3') annotationProcessor('com.google.guava:guava:24.1.1-jre') annotationProcessor('com.google.code.gson:gson:2.8.6') - annotationProcessor('org.spongepowered:mixin:0.8-SNAPSHOT') - } - if(usesMixins.toBoolean() || forceEnableMixins) { - // using 0.8 to workaround a issue in 0.7 which fails mixin application - compile('com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH') { - // Mixin includes a lot of dependencies that are too up-to-date - exclude module: 'launchwrapper' - exclude module: 'guava' - exclude module: 'gson' - exclude module: 'commons-io' - exclude module: 'log4j-core' + annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.10:processor') + if (usesMixinDebug.toBoolean()) { + runtimeOnlyNonPublishable('org.jetbrains:intellij-fernflower:1.2.1.16') } - compile('com.github.GTNewHorizons:SpongeMixins:1.5.0') + } + if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { + implementation('com.gtnewhorizon:gtnhmixins:2.1.10') } } apply from: 'dependencies.gradle' def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' -def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap -def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg" - -task generateAssets { - if (usesMixins.toBoolean()) { - def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json"); +def mixinTmpDir = buildDir.path + File.separator + 'tmp' + File.separator + 'mixins' +def refMap = "${mixinTmpDir}" + File.separator + mixingConfigRefMap +def mixinSrg = "${mixinTmpDir}" + File.separator + "mixins.srg" + +tasks.register('generateAssets') { + group = "GTNH Buildscript" + description = "Generates a mixin config file at /src/main/resources/mixins.modid.json if needed" + onlyIf { usesMixins.toBoolean() } + doLast { + def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json") if (!mixinConfigFile.exists()) { + def mixinPluginLine = "" + if (!mixinPlugin.isEmpty()) { + // We might not have a mixin plugin if we're using early/late mixins + mixinPluginLine += """\n "plugin": "${modGroup}.${mixinPlugin}", """ + } + mixinConfigFile.text = """{ "required": true, - "minVersion": "0.7.11", - "package": "${modGroup}.${mixinsPackage}", - "plugin": "${modGroup}.${mixinPlugin}", + "minVersion": "0.8.5-GTNH", + "package": "${modGroup}.${mixinsPackage}",${mixinPluginLine} "refmap": "${mixingConfigRefMap}", "target": "@env(DEFAULT)", "compatibilityLevel": "JAVA_8", @@ -355,213 +538,142 @@ task generateAssets { } } -task relocateShadowJar(type: ConfigureShadowRelocation) { - target = tasks.shadowJar - prefix = modGroup + ".shadow" -} - -shadowJar { - project.configurations.shadeCompile.each { dep -> - from(project.zipTree(dep)) { - exclude 'META-INF', 'META-INF/**' - } - } - - manifest { - attributes(getManifestAttributes()) +if (usesMixins.toBoolean()) { + tasks.named("reobfJar", ReobfuscatedJar).configure { + extraSrgFiles.from(mixinSrg) } - - minimize() // This will only allow shading for actually used classes - configurations = [ - project.configurations.shadowImplementation, - project.configurations.shadowCompile - ] - dependsOn(relocateShadowJar) } -jar { - project.configurations.shadeCompile.each { dep -> - from(project.zipTree(dep)) { - exclude 'META-INF', 'META-INF/**' +if (usesMixins.toBoolean()) { + tasks.named("compileJava", JavaCompile).configure { + doFirst { + new File(mixinTmpDir).mkdirs() } - } - - manifest { - attributes(getManifestAttributes()) - } - - if(usesShadowedDependencies.toBoolean()) { - dependsOn(shadowJar) - enabled = false - } -} - -reobf { - if(usesMixins.toBoolean()) { - addExtraSrgFile mixinSrg - } -} - -afterEvaluate { - if(usesMixins.toBoolean()) { - tasks.compileJava { - options.compilerArgs += [ - "-AreobfSrgFile=${tasks.reobf.srg}", - "-AoutSrgFile=${mixinSrg}", - "-AoutRefMapFile=${refMap}", - // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code - "-XDenableSunApiLintControl", - "-XDignore.symbol.file" - ] - } - } -} - -runClient { - if(developmentEnvironmentUserName) { - arguments += [ - "--username", - developmentEnvironmentUserName + options.compilerArgs += [ + "-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}", + "-AoutSrgFile=${mixinSrg}", + "-AoutRefMapFile=${refMap}", + // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code + "-XDenableSunApiLintControl", + "-XDignore.symbol.file" ] } - - args(arguments) - jvmArgs(jvmArguments) -} - -runServer { - args(arguments) - jvmArgs(jvmArguments) } -tasks.withType(JavaExec).configureEach { - javaLauncher.set( - javaToolchains.launcherFor { - languageVersion = projectJavaVersion - } - ) -} - -processResources { +tasks.named("processResources", ProcessResources).configure { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.version + inputs.property "mcversion", project.minecraft.mcVersion exclude("spotless.gradle") - // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' - - // replace modVersion and minecraftVersion - expand "minecraftVersion": project.minecraft.version, - "modVersion": modVersion, - "modId": modId, - "modName": modName + // replace stuff in mcmod.info, nothing else. replaces ${key} with value in text + filesMatching("mcmod.info") { + expand "minecraftVersion": project.minecraft.mcVersion, + "modVersion": modVersion, + "modId": modId, + "modName": modName } - if(usesMixins.toBoolean()) { + if (usesMixins.toBoolean()) { from refMap } - - // copy everything else that's not the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - exclude 'spotless.gradle' - } } def getManifestAttributes() { def manifestAttributes = [:] - if(!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) { + if (!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) { manifestAttributes += ["FMLCorePluginContainsFMLMod": true] } - if(accessTransformersFile) { - manifestAttributes += ["FMLAT" : accessTransformersFile.toString()] + if (accessTransformersFile) { + manifestAttributes += ["FMLAT": accessTransformersFile.toString()] } - if(coreModClass) { + if (coreModClass) { manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass] } - if(usesMixins.toBoolean()) { + if (usesMixins.toBoolean()) { manifestAttributes += [ - "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", - "MixinConfigs" : "mixins." + modId + ".json", - "ForceLoadAsMod" : !containsMixinsAndOrCoreModOnly.toBoolean() + "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", + "MixinConfigs" : "mixins." + modId + ".json", + "ForceLoadAsMod": !containsMixinsAndOrCoreModOnly.toBoolean() ] } return manifestAttributes } -task sourcesJar(type: Jar) { - from (sourceSets.main.allSource) - from (file("$projectDir/LICENSE")) - getArchiveClassifier().set('sources') -} - -task shadowDevJar(type: ShadowJar) { - project.configurations.shadeCompile.each { dep -> - from(project.zipTree(dep)) { - exclude 'META-INF', 'META-INF/**' - } - } - - from sourceSets.main.output - getArchiveClassifier().set("dev") - +tasks.named("jar", Jar).configure { manifest { attributes(getManifestAttributes()) } - - minimize() // This will only allow shading for actually used classes - configurations = [ - project.configurations.shadowImplementation, - project.configurations.shadowCompile - ] -} - -task relocateShadowDevJar(type: ConfigureShadowRelocation) { - target = tasks.shadowDevJar - prefix = modGroup + ".shadow" } -task circularResolverJar(type: Jar) { - dependsOn(relocateShadowDevJar) - dependsOn(shadowDevJar) - enabled = false -} +if (usesShadowedDependencies.toBoolean()) { + tasks.register('relocateShadowJar', ConfigureShadowRelocation) { + target = tasks.shadowJar + prefix = modGroup + ".shadow" + } + tasks.named("shadowJar", ShadowJar).configure { + manifest { + attributes(getManifestAttributes()) + } -task devJar(type: Jar) { - project.configurations.shadeCompile.each { dep -> - from(project.zipTree(dep)) { - exclude 'META-INF', 'META-INF/**' + if (minimizeShadowedDependencies.toBoolean()) { + minimize() // This will only allow shading for actually used classes } + configurations = [ + project.configurations.shadowImplementation, + project.configurations.shadowCompile, + project.configurations.shadeCompile + ] + archiveClassifier.set('dev') + dependsOn(relocateShadowJar) } - - from sourceSets.main.output - getArchiveClassifier().set("dev") - - manifest { - attributes(getManifestAttributes()) + configurations.runtimeElements.outgoing.artifacts.clear() + configurations.apiElements.outgoing.artifacts.clear() + configurations.runtimeElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar)) + configurations.apiElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar)) + tasks.named("jar", Jar) { + enabled = false + finalizedBy(tasks.shadowJar) + } + tasks.named("reobfJar", ReobfuscatedJar) { + inputJar.set(tasks.named("shadowJar", ShadowJar).flatMap({it.archiveFile})) + } + AdhocComponentWithVariants javaComponent = (AdhocComponentWithVariants) project.components.findByName("java") + javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) { + skip() + } + for (runTask in ["runClient", "runServer"]) { + tasks.named(runTask).configure { + dependsOn("shadowJar") + } } +} +ext.publishableDevJar = usesShadowedDependencies.toBoolean() ? tasks.shadowJar : tasks.jar +ext.publishableObfJar = tasks.reobfJar - if(usesShadowedDependencies.toBoolean()) { - dependsOn(circularResolverJar) - enabled = false +tasks.named('extractForgeUserdev', Copy).configure { efu -> + doLast { + // Fix CoFH-repackaged CCL not finding mappings + project.copy { + from(mcpTasks.userdevDir("conf")) + into(new File(project.buildDir, "unpacked/conf")) + } } } -task apiJar(type: Jar) { - from (sourceSets.main.allSource) { - include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' +tasks.register('apiJar', Jar) { + from(sourceSets.main.allSource) { + include modGroupPath + "/" + apiPackagePath + '/**' } - from (sourceSets.main.output) { - include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' + from(sourceSets.main.output) { + include modGroupPath + "/" + apiPackagePath + '/**' } - from (sourceSets.main.resources.srcDirs) { + from(sourceSets.main.resources.srcDirs) { include("LICENSE") } @@ -569,19 +681,79 @@ task apiJar(type: Jar) { } artifacts { - if(!noPublishedSources) { - archives sourcesJar + if (!noPublishedSources) { + archives tasks.named("sourcesJar") } - archives devJar - if(apiPackage) { - archives apiJar + if (apiPackage) { + archives tasks.named("apiJar") } } -// The gradle metadata includes all of the additional deps that we disabled from POM generation (including forgeBin with no groupID), -// and isn't strictly needed with the POM so just disable it. -tasks.withType(GenerateModuleMetadata) { - enabled = false +idea { + module { + downloadJavadoc = true + downloadSources = true + } + project { + settings { + runConfigurations { + "1. Run Client"(Gradle) { + taskNames = ["runClient"] + } + "2. Run Server"(Gradle) { + taskNames = ["runServer"] + } + "3. Run Obfuscated Client"(Gradle) { + taskNames = ["runObfClient"] + } + "4. Run Obfuscated Server"(Gradle) { + taskNames = ["runObfServer"] + } + if (!disableSpotless) { + "5. Apply spotless"(Gradle) { + taskNames = ["spotlessApply"] + } + } + def coreModArgs = "" + if (coreModClass) { + coreModArgs = ' "-Dfml.coreMods.load=' + modGroup + '.' + coreModClass + '"' + } + "Run Client (IJ Native)"(Application) { + mainClass = "GradleStart" + moduleName = project.name + ".main" + afterEvaluate { + workingDirectory = tasks.runClient.workingDir.absolutePath + programParameters = tasks.runClient.calculateArgs(project).collect { '"' + it + '"' }.join(' ') + jvmArgs = tasks.runClient.calculateJvmArgs(project).collect { '"' + it + '"' }.join(' ') + + ' ' + tasks.runClient.systemProperties.collect { '"-D' + it.key + '=' + it.value.toString() + '"' }.join(' ') + + coreModArgs + } + } + "Run Server (IJ Native)"(Application) { + mainClass = "GradleStartServer" + moduleName = project.name + ".main" + afterEvaluate { + workingDirectory = tasks.runServer.workingDir.absolutePath + programParameters = tasks.runServer.calculateArgs(project).collect { '"' + it + '"' }.join(' ') + jvmArgs = tasks.runServer.calculateJvmArgs(project).collect { '"' + it + '"' }.join(' ') + + ' ' + tasks.runServer.systemProperties.collect { '"-D' + it.key + '=' + it.value.toString() + '"' }.join(' ') + + coreModArgs + } + } + } + compiler.javac { + afterEvaluate { + moduleJavacAdditionalOptions = [ + (project.name + ".main"): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ') + ] + } + } + } + } +} + +tasks.named("processIdeaSettings").configure { + dependsOn("injectTags") } // workaround variable hiding in pom processing @@ -589,51 +761,24 @@ def projectConfigs = project.configurations publishing { publications { - maven(MavenPublication) { + create("maven", MavenPublication) { from components.java - if(usesShadowedDependencies.toBoolean()) { - artifact source: shadowJar, classifier: "" - } - if(!noPublishedSources) { - artifact source: sourcesJar, classifier: "sources" - } - artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev" + if (apiPackage) { - artifact source: apiJar, classifier: "api" + artifact apiJar } groupId = System.getenv("ARTIFACT_GROUP_ID") ?: "com.github.GTNewHorizons" artifactId = System.getenv("ARTIFACT_ID") ?: project.name // Using the identified version, not project.version as it has the prepended 1.7.10 version = System.getenv("RELEASE_VERSION") ?: identifiedVersion - - // remove extra garbage from minecraft and minecraftDeps configuration - pom.withXml { - def badArtifacts = [:].withDefault {[] as Set} - for (configuration in [ - projectConfigs.minecraft, - projectConfigs.minecraftDeps - ]) { - for (dependency in configuration.allDependencies) { - badArtifacts[dependency.group == null ? "" : dependency.group] += dependency.name - } - } - // example for specifying extra stuff to ignore - // badArtifacts["org.example.group"] += "artifactName" - - Node pomNode = asNode() - pomNode.dependencies.'*'.findAll() { - badArtifacts[it.groupId.text()].contains(it.artifactId.text()) - }.each() { - it.parent().remove(it) - } - } } } repositories { maven { url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases" + allowInsecureProtocol = true credentials { username = System.getenv("MAVEN_USER") ?: "NONE" password = System.getenv("MAVEN_PASSWORD") ?: "NONE" @@ -642,52 +787,186 @@ publishing { } } +if (modrinthProjectId.size() != 0 && System.getenv("MODRINTH_TOKEN") != null) { + apply plugin: 'com.modrinth.minotaur' + + File changelogFile = new File(System.getenv("CHANGELOG_FILE") ?: "CHANGELOG.md") + + modrinth { + token = System.getenv("MODRINTH_TOKEN") + projectId = modrinthProjectId + versionNumber = identifiedVersion + versionType = identifiedVersion.endsWith("-pre") ? "beta" : "release" + changelog = changelogFile.exists() ? changelogFile.getText("UTF-8") : "" + uploadFile = publishableObfJar + additionalFiles = getSecondaryArtifacts() + gameVersions = [minecraftVersion] + loaders = ["forge"] + debugMode = false + } + + if (modrinthRelations.size() != 0) { + String[] deps = modrinthRelations.split(";") + deps.each { dep -> + if (dep.size() == 0) { + return + } + String[] parts = dep.split(":") + String[] qual = parts[0].split("-") + addModrinthDep(qual[0], qual[1], parts[1]) + } + } + if (usesMixins.toBoolean()) { + addModrinthDep("required", "project", "gtnhmixins") + } + tasks.modrinth.dependsOn(build) + tasks.publish.dependsOn(tasks.modrinth) +} + +if (curseForgeProjectId.size() != 0 && System.getenv("CURSEFORGE_TOKEN") != null) { + apply plugin: 'com.matthewprenger.cursegradle' + + File changelogFile = new File(System.getenv("CHANGELOG_FILE") ?: "CHANGELOG.md") + + curseforge { + apiKey = System.getenv("CURSEFORGE_TOKEN") + project { + id = curseForgeProjectId + if (changelogFile.exists()) { + changelogType = "markdown" + changelog = changelogFile + } + releaseType = identifiedVersion.endsWith("-pre") ? "beta" : "release" + addGameVersion minecraftVersion + addGameVersion "Forge" + mainArtifact publishableObfJar + for (artifact in getSecondaryArtifacts()) addArtifact artifact + } + + options { + javaIntegration = false + forgeGradleIntegration = false + debug = false + } + } + + if (curseForgeRelations.size() != 0) { + String[] deps = curseForgeRelations.split(";") + deps.each { dep -> + if (dep.size() == 0) { + return + } + String[] parts = dep.split(":") + addCurseForgeRelation(parts[0], parts[1]) + } + } + if (usesMixins.toBoolean()) { + addCurseForgeRelation("requiredDependency", "gtnhmixins") + } + tasks.curseforge.dependsOn(build) + tasks.publish.dependsOn(tasks.curseforge) +} + +def addModrinthDep(String scope, String type, String name) { + com.modrinth.minotaur.dependencies.Dependency dep; + if (!(scope in ["required", "optional", "incompatible", "embedded"])) { + throw new Exception("Invalid modrinth dependency scope: " + scope) + } + switch (type) { + case "project": + dep = new ModDependency(name, scope) + break + case "version": + dep = new VersionDependency(name, scope) + break + default: + throw new Exception("Invalid modrinth dependency type: " + type) + } + project.modrinth.dependencies.add(dep) +} + +def addCurseForgeRelation(String type, String name) { + if (!(type in ["requiredDependency", "embeddedLibrary", "optionalDependency", "tool", "incompatible"])) { + throw new Exception("Invalid CurseForge relation type: " + type) + } + CurseArtifact artifact = project.curseforge.curseProjects[0].mainArtifact + CurseRelation rel = (artifact.curseRelations ?: (artifact.curseRelations = new CurseRelation())) + rel."$type"(name) +} + // Updating -task updateBuildScript { +tasks.register('updateBuildScript') { + group = 'GTNH Buildscript' + description = 'Updates the build script to the latest version' + doLast { - if (performBuildScriptUpdate(projectDir.toString())) return + if (performBuildScriptUpdate()) return - print("Build script already up-to-date!") + print("Build script already up-to-date!") } } -if (isNewBuildScriptVersionAvailable(projectDir.toString())) { +if (!project.getGradle().startParameter.isOffline() && !Boolean.getBoolean('DISABLE_BUILDSCRIPT_UPDATE_CHECK') && isNewBuildScriptVersionAvailable()) { if (autoUpdateBuildScript.toBoolean()) { - performBuildScriptUpdate(projectDir.toString()) + performBuildScriptUpdate() } else { out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'") } } static URL availableBuildScriptUrl() { - new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/build.gradle") + new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/build.gradle") } + static URL exampleSettingsGradleUrl() { - new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/settings.gradle.example") + new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/settings.gradle.example") +} + +static URL exampleGitAttributesUrl() { + new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/.gitattributes") } -def verifySettingsGradle() { +boolean verifyGitAttributes() { + def gitattributesFile = getFile(".gitattributes") + if (!gitattributesFile.exists()) { + println("Downloading default .gitattributes") + exampleGitAttributesUrl().withInputStream { i -> gitattributesFile.withOutputStream { it << i } } + exec { + workingDir '.' + commandLine 'git', 'add', '--renormalize', '.' + } + return true + } + return false +} + +boolean verifySettingsGradle() { def settingsFile = getFile("settings.gradle") if (!settingsFile.exists()) { println("Downloading default settings.gradle") exampleSettingsGradleUrl().withInputStream { i -> settingsFile.withOutputStream { it << i } } - throw new GradleException("Settings.gradle has been updated, please re-run task.") + return true } + return false } -boolean performBuildScriptUpdate(String projectDir) { - if (isNewBuildScriptVersionAvailable(projectDir)) { +boolean performBuildScriptUpdate() { + if (isNewBuildScriptVersionAvailable()) { def buildscriptFile = getFile("build.gradle") availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } } + def out = services.get(StyledTextOutputFactory).create('buildscript-update-output') out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!") - verifySettingsGradle() + boolean settingsupdated = verifySettingsGradle() + settingsupdated = verifyGitAttributes() || settingsupdated + if (settingsupdated) + throw new GradleException("Settings has been updated, please re-run task.") return true } return false } -boolean isNewBuildScriptVersionAvailable(String projectDir) { +boolean isNewBuildScriptVersionAvailable() { Map parameters = ["connectTimeout": 2000, "readTimeout": 2000] String currentBuildScript = getFile("build.gradle").getText() @@ -701,21 +980,18 @@ boolean isNewBuildScriptVersionAvailable(String projectDir) { static String getVersionHash(String buildScriptContent) { String versionLine = buildScriptContent.find("^//version: [a-z0-9]*") - if(versionLine != null) { + if (versionLine != null) { return versionLine.split(": ").last() } return "" } -configure(updateBuildScript) { - group = 'forgegradle' - description = 'Updates the build script to the latest version' -} - // Parameter Deobfuscation -task deobfParams { - doLast { +tasks.register('deobfParams') { + group = 'GTNH Buildscript' + description = 'Rename all obfuscated parameter names inherited from Minecraft classes' + doLast { // TODO String mcpDir = "$project.gradle.gradleUserHomeDir/caches/minecraft/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion" String mcpZIP = "$mcpDir/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip" @@ -727,210 +1003,210 @@ task deobfParams { overwrite false } - if(!file(paramsCSV).exists()) { + if (!file(paramsCSV).exists()) { println("Extracting MCP archive ...") - unzip(mcpZIP, mcpDir) + copy { + from(zipTree(mcpZIP)) + into(mcpDir) + } } println("Parsing params.csv ...") Map params = new HashMap<>() - Files.lines(Paths.get(paramsCSV)).forEach{line -> + Files.lines(Paths.get(paramsCSV)).forEach { line -> String[] cells = line.split(",") - if(cells.length > 2 && cells[0].matches("p_i?\\d+_\\d+_")) { + if (cells.length > 2 && cells[0].matches("p_i?\\d+_\\d+_")) { params.put(cells[0], cells[1]) } } out.style(Style.Success).println("Modified ${replaceParams(file("$projectDir/src/main/java"), params)} files!") - out.style(Style.Failure).println("Don't forget to verify that the code still works as before!\n It could be broken due to duplicate variables existing now\n or parameters taking priority over other variables.") -} + out.style(Style.Failure).println("Don't forget to verify that the code still works as before!\n It could be broken due to duplicate variables existing now\n or parameters taking priority over other variables.") + } } static int replaceParams(File file, Map params) { -int fileCount = 0 - -if(file.isDirectory()) { - for(File f : file.listFiles()) { - fileCount += replaceParams(f, params) - } - return fileCount -} -println("Visiting ${file.getName()} ...") -try { - String content = new String(Files.readAllBytes(file.toPath())) - int hash = content.hashCode() - params.forEach{key, value -> - content = content.replaceAll(key, value) - } - if(hash != content.hashCode()) { - Files.write(file.toPath(), content.getBytes("UTF-8")) - return 1 - } -} catch(Exception e) { - e.printStackTrace() -} -return 0 -} + int fileCount = 0 -// Credit: bitsnaps (https://gist.github.com/bitsnaps/00947f2dce66f4bbdabc67d7e7b33681) -static unzip(String zipFileName, String outputDir) { -byte[] buffer = new byte[16384] -ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFileName)) -ZipEntry zipEntry = zis.getNextEntry() -while (zipEntry != null) { - File newFile = new File(outputDir + File.separator, zipEntry.name) - if (zipEntry.isDirectory()) { - if (!newFile.isDirectory() && !newFile.mkdirs()) { - throw new IOException("Failed to create directory $newFile") + if (file.isDirectory()) { + for (File f : file.listFiles()) { + fileCount += replaceParams(f, params) } - } else { - // fix for Windows-created archives - File parent = newFile.parentFile - if (!parent.isDirectory() && !parent.mkdirs()) { - throw new IOException("Failed to create directory $parent") + return fileCount + } + println("Visiting ${file.getName()} ...") + try { + String content = new String(Files.readAllBytes(file.toPath())) + int hash = content.hashCode() + params.forEach { key, value -> + content = content.replaceAll(key, value) } - // write file content - FileOutputStream fos = new FileOutputStream(newFile) - int len = 0 - while ((len = zis.read(buffer)) > 0) { - fos.write(buffer, 0, len) + if (hash != content.hashCode()) { + Files.write(file.toPath(), content.getBytes("UTF-8")) + return 1 } - fos.close() + } catch (Exception e) { + e.printStackTrace() } - zipEntry = zis.getNextEntry() -} -zis.closeEntry() -zis.close() -} - -configure(deobfParams) { -group = 'forgegradle' -description = 'Rename all obfuscated parameter names inherited from Minecraft classes' + return 0 } // Dependency Deobfuscation def deobf(String sourceURL) { -try { - URL url = new URL(sourceURL) - String fileName = url.getFile() + try { + URL url = new URL(sourceURL) + String fileName = url.getFile() + + //get rid of directories: + int lastSlash = fileName.lastIndexOf("/") + if (lastSlash > 0) { + fileName = fileName.substring(lastSlash + 1) + } + //get rid of extension: + if (fileName.endsWith(".jar") || fileName.endsWith(".litemod")) { + fileName = fileName.substring(0, fileName.lastIndexOf(".")) + } - //get rid of directories: - int lastSlash = fileName.lastIndexOf("/") - if(lastSlash > 0) { - fileName = fileName.substring(lastSlash + 1) - } - //get rid of extension: - if(fileName.endsWith(".jar") || fileName.endsWith(".litemod")) { - fileName = fileName.substring(0, fileName.lastIndexOf(".")) - } + String hostName = url.getHost() + if (hostName.startsWith("www.")) { + hostName = hostName.substring(4) + } + List parts = Arrays.asList(hostName.split("\\.")) + Collections.reverse(parts) + hostName = String.join(".", parts) - String hostName = url.getHost() - if(hostName.startsWith("www.")) { - hostName = hostName.substring(4) + return deobf(sourceURL, "$hostName/$fileName") + } catch (Exception ignored) { + return deobf(sourceURL, "deobf/${sourceURL.hashCode()}") } - List parts = Arrays.asList(hostName.split("\\.")) - Collections.reverse(parts) - hostName = String.join(".", parts) +} - return deobf(sourceURL, "$hostName/$fileName") -} catch(Exception e) { - return deobf(sourceURL, "deobf/${sourceURL.hashCode()}") +def deobfMaven(String repoURL, String mavenDep) { + if (!repoURL.endsWith("/")) { + repoURL += "/" + } + String[] parts = mavenDep.split(":") + parts[0] = parts[0].replace('.', '/') + def jarURL = repoURL + parts[0] + "/" + parts[1] + "/" + parts[2] + "/" + parts[1] + "-" + parts[2] + ".jar" + return deobf(jarURL) } + +def deobfCurse(String curseDep) { + try { + return deobfMaven("https://www.cursemaven.com/", "curse.maven:$curseDep") + } catch (Exception ignored) { + out.style(Style.Failure).println("Failed to get $curseDep from cursemaven.") + } } // The method above is to be preferred. Use this method if the filename is not at the end of the URL. def deobf(String sourceURL, String rawFileName) { -String bon2Version = "2.5.1" -String fileName = URLDecoder.decode(rawFileName, "UTF-8") -String cacheDir = "$project.gradle.gradleUserHomeDir/caches" -String bon2Dir = "$cacheDir/forge_gradle/deobf" -String bon2File = "$bon2Dir/BON2-${bon2Version}.jar" -String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar" -String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar" - -if(file(deobfFile).exists()) { - return files(deobfFile) -} + String bon2Version = "2.5.1" + String fileName = URLDecoder.decode(rawFileName, "UTF-8") + String cacheDir = "$project.gradle.gradleUserHomeDir/caches" + String bon2Dir = "$cacheDir/forge_gradle/deobf" + String bon2File = "$bon2Dir/BON2-${bon2Version}.jar" + String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar" + String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar" + + if (file(deobfFile).exists()) { + return files(deobfFile) + } -String mappingsVer -String remoteMappings = project.hasProperty('remoteMappings') ? project.remoteMappings : 'https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/' -if(remoteMappings) { - String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion" - String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip" + String mappingsVer + String remoteMappings = project.hasProperty('remoteMappings') ? project.remoteMappings : 'https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/' + if (remoteMappings) { + String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion" + String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip" - zipMappings(mappingsZIP, remoteMappings, bon2Dir) + zipMappings(mappingsZIP, remoteMappings, bon2Dir) - mappingsVer = "snapshot_$id" -} else { - mappingsVer = "${channel}_$mappingsVersion" -} + mappingsVer = "snapshot_$id" + } else { + mappingsVer = "${channel}_$mappingsVersion" + } -download.run { - src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar" - dest bon2File - quiet true - overwrite false -} + download.run { + src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar" + dest bon2File + quiet true + overwrite false + } -download.run { - src sourceURL - dest obfFile - quiet true - overwrite false -} + download.run { + src sourceURL + dest obfFile + quiet true + overwrite false + } -exec { - commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch' - workingDir bon2Dir - standardOutput = new FileOutputStream("${deobfFile}.log") -} + exec { + commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch' + workingDir bon2Dir + standardOutput = new FileOutputStream("${deobfFile}.log") + } -return files(deobfFile) + return files(deobfFile) } def zipMappings(String zipPath, String url, String bon2Dir) { -File zipFile = new File(zipPath) -if(zipFile.exists()) { - return -} + File zipFile = new File(zipPath) + if (zipFile.exists()) { + return + } -String fieldsCache = "$bon2Dir/data/fields.csv" -String methodsCache = "$bon2Dir/data/methods.csv" + String fieldsCache = "$bon2Dir/data/fields.csv" + String methodsCache = "$bon2Dir/data/methods.csv" -download.run { - src "${url}fields.csv" - dest fieldsCache - quiet true -} -download.run { - src "${url}methods.csv" - dest methodsCache - quiet true -} + download.run { + src "${url}fields.csv" + dest fieldsCache + quiet true + } + download.run { + src "${url}methods.csv" + dest methodsCache + quiet true + } -zipFile.getParentFile().mkdirs() -ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile)) + zipFile.getParentFile().mkdirs() + ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile)) -zos.putNextEntry(new ZipEntry("fields.csv")) -Files.copy(Paths.get(fieldsCache), zos) -zos.closeEntry() + zos.putNextEntry(new ZipEntry("fields.csv")) + Files.copy(Paths.get(fieldsCache), zos) + zos.closeEntry() -zos.putNextEntry(new ZipEntry("methods.csv")) -Files.copy(Paths.get(methodsCache), zos) -zos.closeEntry() + zos.putNextEntry(new ZipEntry("methods.csv")) + Files.copy(Paths.get(methodsCache), zos) + zos.closeEntry() -zos.close() + zos.close() } // Helper methods def checkPropertyExists(String propertyName) { -if (!project.hasProperty(propertyName)) { - throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties") + if (!project.hasProperty(propertyName)) { + throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties") + } } + +def propertyDefaultIfUnset(String propertyName, defaultValue) { + if (!project.hasProperty(propertyName) || project.property(propertyName) == "") { + project.ext.setProperty(propertyName, defaultValue) + } } def getFile(String relativePath) { -return new File(projectDir, relativePath) + return new File(projectDir, relativePath) +} + +def getSecondaryArtifacts() { + // Because noPublishedSources from the beginning of the script is somehow not visible here... + boolean noPublishedSources = project.hasProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false + def secondaryArtifacts = [publishableDevJar] + if (!noPublishedSources) secondaryArtifacts += [sourcesJar] + if (apiPackage) secondaryArtifacts += [apiJar] + return secondaryArtifacts } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 5c2d1cf016..ccebba7710 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3ab0b725ef..f398c33c4b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 83f2acfdc3..79a61d421c 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,78 +17,113 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # 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 +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac 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" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -97,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + 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 @@ -105,84 +140,105 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "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 +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac 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 +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # 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 +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # 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\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=$((i+1)) + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg 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 -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 9618d8d960..93e3f59f13 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,10 +25,14 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @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="-Xmx64m" "-Xms64m" @@ -37,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -51,7 +55,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -61,38 +65,26 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_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=%* - :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% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 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 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/settings.gradle b/settings.gradle index 97d8f71c52..01ea5f121a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,10 +1,28 @@ + +pluginManagement { + repositories { + maven { + // RetroFuturaGradle + name "GTNH Maven" + url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" + allowInsecureProtocol = true + mavenContent { + includeGroup("com.gtnewhorizons.retrofuturagradle") + } + } + gradlePluginPortal() + mavenCentral() + mavenLocal() + } +} + plugins { id 'com.diffplug.blowdryerSetup' version '1.6.0' + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains } -apply plugin: 'com.diffplug.blowdryerSetup' - blowdryerSetup { - github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.1.4') + repoSubfolder 'gtnhShared' + github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0') //devLocal '.' // Use this when testing config updates locally } -- cgit From 7b66e23199db44891c57865160afb5c66f6fd94f Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Sun, 29 Jan 2023 10:49:48 -0800 Subject: [ci skip] spotlessApply with the new settings --- dependencies.gradle | 2 +- .../java/pers/gwyog/gtneioreplugin/Config.java | 5 +- .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 21 ++- .../gwyog/gtneioreplugin/plugin/IMCForNEI.java | 4 +- .../gtneioreplugin/plugin/NEIPluginConfig.java | 4 +- .../gwyog/gtneioreplugin/plugin/PluginBase.java | 18 +- .../gtneioreplugin/plugin/block/ModBlocks.java | 4 +- .../plugin/gregtech5/PluginGT5Base.java | 25 ++- .../plugin/gregtech5/PluginGT5SmallOreStat.java | 51 +++--- .../gregtech5/PluginGT5UndergroundFluid.java | 34 ++-- .../plugin/gregtech5/PluginGT5VeinStat.java | 30 +-- .../plugin/item/ItemDimensionDisplay.java | 6 +- .../renderer/ItemDimensionDisplayRenderer.java | 13 +- .../pers/gwyog/gtneioreplugin/util/CSVMaker.java | 46 +++-- .../gwyog/gtneioreplugin/util/DimensionHelper.java | 180 ++++++++---------- .../gwyog/gtneioreplugin/util/GT5CFGHelper.java | 203 ++++++++++----------- .../gtneioreplugin/util/GT5OreLayerHelper.java | 41 ++--- .../gtneioreplugin/util/GT5OreSmallHelper.java | 50 +++-- .../util/GT5UndergroundFluidHelper.java | 44 ++--- .../gwyog/gtneioreplugin/util/GuiRecipeHelper.java | 11 +- .../gwyog/gtneioreplugin/util/OreVeinLayer.java | 9 +- .../gtneioreplugin/util/StringPaddingHack.java | 28 +-- .../pers/gwyog/gtneioreplugin/util/XtoBool.java | 15 +- 23 files changed, 416 insertions(+), 428 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 18093d7d3d..8278321642 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,7 +1,7 @@ // Add your dependencies here dependencies { - compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.39:dev') + compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.41.254:dev') compile('com.github.GTNewHorizons:NotEnoughItems:2.2.19-GTNH:dev') compile('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev') diff --git a/src/main/java/pers/gwyog/gtneioreplugin/Config.java b/src/main/java/pers/gwyog/gtneioreplugin/Config.java index eedd953316..e486ea9f1e 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/Config.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/Config.java @@ -1,10 +1,13 @@ package pers.gwyog.gtneioreplugin; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; import java.io.File; + import net.minecraftforge.common.config.Configuration; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; + public class Config { + public Configuration tConfig; public Config(FMLPreInitializationEvent preinit, String cfgname) { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index 9876e07276..7f88441ebc 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -1,22 +1,24 @@ package pers.gwyog.gtneioreplugin; -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.FMLPreInitializationEvent; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; + import pers.gwyog.gtneioreplugin.plugin.IMCForNEI; import pers.gwyog.gtneioreplugin.plugin.block.ModBlocks; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; import pers.gwyog.gtneioreplugin.util.GT5UndergroundFluidHelper; import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper; +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.FMLPreInitializationEvent; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; @Mod( modid = GTNEIOrePlugin.MODID, @@ -24,6 +26,7 @@ import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper; version = GTNEIOrePlugin.VERSION, dependencies = "required-after:gregtech;required-after:NotEnoughItems") public class GTNEIOrePlugin { + public static final String MODID = "GRADLETOKEN_MODID"; public static final String NAME = "GRADLETOKEN_MODNAME"; public static final String VERSION = "GRADLETOKEN_VERSION"; @@ -34,10 +37,10 @@ public class GTNEIOrePlugin { public static boolean toolTips = true; public static int maxTooltipLines = 11; public static final CreativeTabs creativeTab = new CreativeTabs(MODID) { + @Override public Item getTabIconItem() { - return GameRegistry.makeItemStack("gregtech:gt.blockores", 386, 1, null) - .getItem(); + return GameRegistry.makeItemStack("gregtech:gt.blockores", 386, 1, null).getItem(); } }; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java index 72aaf6fb85..961d29c2b3 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java @@ -1,10 +1,12 @@ package pers.gwyog.gtneioreplugin.plugin; -import cpw.mods.fml.common.event.FMLInterModComms; import net.minecraft.nbt.NBTTagCompound; + import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; +import cpw.mods.fml.common.event.FMLInterModComms; public class IMCForNEI { + public static void IMCSender() { // Though these 2 are already registered in NEI jar, we need to re-register // because new DimensionDisplayItems made tabs a bit taller. diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java index 17193b07fe..31405a2f7a 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java @@ -1,11 +1,11 @@ package pers.gwyog.gtneioreplugin.plugin; -import codechicken.nei.api.API; -import codechicken.nei.api.IConfigureNEI; import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5SmallOreStat; import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5UndergroundFluid; import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat; +import codechicken.nei.api.API; +import codechicken.nei.api.IConfigureNEI; public class NEIPluginConfig implements IConfigureNEI { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java index 71c770a86b..5509341696 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/PluginBase.java @@ -1,11 +1,13 @@ package pers.gwyog.gtneioreplugin.plugin; -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.recipe.TemplateRecipeHandler; import java.awt.*; + import net.minecraft.client.resources.I18n; import net.minecraft.util.EnumChatFormatting; +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.recipe.TemplateRecipeHandler; + public abstract class PluginBase extends TemplateRecipeHandler { @Override @@ -26,8 +28,10 @@ public abstract class PluginBase extends TemplateRecipeHandler { @Override public void loadTransferRects() { int stringLength = GuiDraw.getStringWidth(EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll")); - transferRects.add(new RecipeTransferRect( - new Rectangle(getGuiWidth() - stringLength - 3, 5, stringLength, 9), getOutputId())); + transferRects.add( + new RecipeTransferRect( + new Rectangle(getGuiWidth() - stringLength - 3, 5, stringLength, 9), + getOutputId())); } public abstract String getOutputId(); @@ -41,6 +45,10 @@ public abstract class PluginBase extends TemplateRecipeHandler { */ protected void drawSeeAllRecipesLabel() { GuiDraw.drawStringR( - EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), getGuiWidth() - 3, 5, 0x404040, false); + EnumChatFormatting.BOLD + I18n.format("gtnop.gui.nei.seeAll"), + getGuiWidth() - 3, + 5, + 0x404040, + false); } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/ModBlocks.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/ModBlocks.java index fce0a0883e..419dbe8d00 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/ModBlocks.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/ModBlocks.java @@ -1,11 +1,13 @@ package pers.gwyog.gtneioreplugin.plugin.block; -import cpw.mods.fml.common.registry.GameRegistry; import java.util.HashMap; import java.util.Map; + import net.minecraft.block.Block; + import pers.gwyog.gtneioreplugin.plugin.item.ItemDimensionDisplay; import pers.gwyog.gtneioreplugin.util.DimensionHelper; +import cpw.mods.fml.common.registry.GameRegistry; public class ModBlocks { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java index 1c7e14db79..f0a9433a70 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java @@ -1,15 +1,17 @@ package pers.gwyog.gtneioreplugin.plugin.gregtech5; -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.recipe.GuiRecipe; -import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; -import gregtech.api.util.GT_LanguageManager; import java.awt.Point; import java.awt.Rectangle; + import net.minecraft.client.resources.I18n; + import pers.gwyog.gtneioreplugin.plugin.PluginBase; import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper; +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.recipe.GuiRecipe; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.util.GT_LanguageManager; public abstract class PluginGT5Base extends PluginBase { @@ -33,7 +35,8 @@ public abstract class PluginGT5Base extends PluginBase { if (!getLocalizedNameForItem(GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)), index % 1000) .contains("Awakened")) return getLocalizedNameForItem( - GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)), index % 1000); + GT_LanguageManager.getTranslation(getGTOreUnlocalizedName(index)), + index % 1000); else return "Aw. Draconium Ore"; } @@ -56,8 +59,8 @@ public abstract class PluginGT5Base extends PluginBase { /** * Produce a rectangle covering the area of displayed dimension names * - * @param gui An instance of the currentscreen - * @param recipe The recipe index being handled + * @param gui An instance of the currentscreen + * @param recipe The recipe index being handled * @param dimNames Dimension names to produce a rectangle for * @return Rectangle area of dimension names */ @@ -74,9 +77,11 @@ public abstract class PluginGT5Base extends PluginBase { protected 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; + .equals(getGTOreUnlocalizedName((short) (meta + offset + 5000)))) + return 7; else if (!getGTOreLocalizedName((short) (meta + offset + 5000)) - .equals(getGTOreUnlocalizedName((short) (meta + offset + 5000)))) return 6; + .equals(getGTOreUnlocalizedName((short) (meta + offset + 5000)))) + return 6; else return 5; } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java index bf24ee186e..08c3d11411 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java @@ -1,18 +1,20 @@ package pers.gwyog.gtneioreplugin.plugin.gregtech5; -import codechicken.nei.PositionedStack; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_OreDictUnificator; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.List; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; + import pers.gwyog.gtneioreplugin.plugin.item.ItemDimensionDisplay; import pers.gwyog.gtneioreplugin.util.DimensionHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper.OreSmallWrapper; +import codechicken.nei.PositionedStack; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_OreDictUnificator; public class PluginGT5SmallOreStat extends PluginGT5Base { @@ -101,18 +103,18 @@ public class PluginGT5SmallOreStat extends PluginGT5Base { } private void addSmallOre(OreSmallWrapper smallOre, int maximumIndex) { - this.arecipes.add(new CachedOreSmallRecipe( - smallOre.oreGenName, - smallOre.getMaterialDrops(maximumIndex), - getStoneDusts(maximumIndex), - GT5OreSmallHelper.mapOreMetaToOreDrops.get(smallOre.oreMeta))); + this.arecipes.add( + new CachedOreSmallRecipe( + smallOre.oreGenName, + smallOre.getMaterialDrops(maximumIndex), + getStoneDusts(maximumIndex), + GT5OreSmallHelper.mapOreMetaToOreDrops.get(smallOre.oreMeta))); } private List getStoneDusts(int maximumIndex) { List materialDustStackList = new ArrayList<>(); - for (int i = 0; i < maximumIndex; i++) - materialDustStackList.add( - GT_OreDictUnificator.get(OrePrefixes.dust, GT5OreSmallHelper.getDroppedDusts()[i], 1L)); + for (int i = 0; i < maximumIndex; i++) materialDustStackList + .add(GT_OreDictUnificator.get(OrePrefixes.dust, GT5OreSmallHelper.getDroppedDusts()[i], 1L)); return materialDustStackList; } @@ -141,32 +143,33 @@ public class PluginGT5SmallOreStat extends PluginGT5Base { private String[] getDimNameArrayFromVeinName(String veinName) { OreSmallWrapper oreSmall = GT5OreSmallHelper.mapOreSmallWrapper.get(veinName); String[] dims = DimensionHelper.parseDimNames(GT5OreSmallHelper.bufferedDims.get(oreSmall)); - Arrays.sort(dims, Comparator.comparingInt(s -> Arrays.asList(DimensionHelper.DimNameDisplayed) - .indexOf(s))); + Arrays.sort(dims, Comparator.comparingInt(s -> Arrays.asList(DimensionHelper.DimNameDisplayed).indexOf(s))); return dims; } public class CachedOreSmallRecipe extends CachedRecipe { + public String oreGenName; public PositionedStack positionedStackOreSmall; public PositionedStack positionedStackMaterialDust; public List positionedDropStackList; private final List dimensionDisplayItems = new ArrayList<>(); - public CachedOreSmallRecipe( - String oreGenName, - List stackList, - List materialDustStackList, + public CachedOreSmallRecipe(String oreGenName, List stackList, List materialDustStackList, List dropStackList) { this.oreGenName = oreGenName; this.positionedStackOreSmall = new PositionedStack(stackList, 2, 0); - this.positionedStackMaterialDust = - new PositionedStack(materialDustStackList, 43, 79 + getRestrictBiomeOffset()); + this.positionedStackMaterialDust = new PositionedStack( + materialDustStackList, + 43, + 79 + getRestrictBiomeOffset()); List positionedDropStackList = new ArrayList<>(); int i = 1; - for (ItemStack stackDrop : dropStackList) - positionedDropStackList.add(new PositionedStack( - stackDrop, 43 + 20 * (i % 4), 79 + 16 * ((i++) / 4) + getRestrictBiomeOffset())); + for (ItemStack stackDrop : dropStackList) positionedDropStackList.add( + new PositionedStack( + stackDrop, + 43 + 20 * (i % 4), + 79 + 16 * ((i++) / 4) + getRestrictBiomeOffset())); this.positionedDropStackList = positionedDropStackList; setDimensionDisplayItems(); } @@ -202,8 +205,8 @@ public class PluginGT5SmallOreStat extends PluginGT5Base { public List getOtherStacks() { List outputs = new ArrayList<>(); positionedStackOreSmall.setPermutationToRender((cycleticks / 20) % positionedStackOreSmall.items.length); - positionedStackMaterialDust.setPermutationToRender( - (cycleticks / 20) % positionedStackMaterialDust.items.length); + positionedStackMaterialDust + .setPermutationToRender((cycleticks / 20) % positionedStackMaterialDust.items.length); outputs.add(positionedStackOreSmall); outputs.add(positionedStackMaterialDust); outputs.addAll(positionedDropStackList); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java index 0cdf2b53b7..4ce0d15047 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java @@ -1,21 +1,23 @@ package pers.gwyog.gtneioreplugin.plugin.gregtech5; -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.PositionedStack; -import gregtech.api.util.GT_Utility; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.List; import java.util.Map; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; + import pers.gwyog.gtneioreplugin.plugin.PluginBase; import pers.gwyog.gtneioreplugin.plugin.item.ItemDimensionDisplay; import pers.gwyog.gtneioreplugin.util.GT5UndergroundFluidHelper; import pers.gwyog.gtneioreplugin.util.GT5UndergroundFluidHelper.UndergroundFluidWrapper; +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import gregtech.api.util.GT_Utility; public class PluginGT5UndergroundFluid extends PluginBase { @@ -26,8 +28,8 @@ public class PluginGT5UndergroundFluid extends PluginBase { @Override public void loadCraftingRecipes(String outputId, Object... results) { if (outputId.equals(getOutputId())) { - for (Map.Entry> entry : - GT5UndergroundFluidHelper.getAllEntries().entrySet()) { + for (Map.Entry> entry : GT5UndergroundFluidHelper.getAllEntries() + .entrySet()) { Fluid fluid = FluidRegistry.getFluid(entry.getKey()); if (fluid != null) { this.arecipes.add(new CachedUndergroundFluidRecipe(fluid, entry.getValue())); @@ -63,8 +65,8 @@ public class PluginGT5UndergroundFluid extends PluginBase { public void loadUsageRecipes(ItemStack ingredient) { String dimension = ItemDimensionDisplay.getDimension(ingredient); if (dimension != null) { - for (Map.Entry> entry : - GT5UndergroundFluidHelper.getAllEntries().entrySet()) { + for (Map.Entry> entry : GT5UndergroundFluidHelper.getAllEntries() + .entrySet()) { boolean found = false; for (UndergroundFluidWrapper wrapper : entry.getValue()) { if (wrapper.dimension.equals(dimension)) { @@ -105,8 +107,7 @@ public class PluginGT5UndergroundFluid extends PluginBase { black, false); GuiDraw.drawStringC( - recipe.minAmounts.get(i).toString() + "-" - + recipe.maxAmounts.get(i).toString(), + recipe.minAmounts.get(i).toString() + "-" + recipe.maxAmounts.get(i).toString(), xAmount, y, black, @@ -134,16 +135,19 @@ public class PluginGT5UndergroundFluid extends PluginBase { private final List minAmounts = new ArrayList<>(); private CachedUndergroundFluidRecipe(Fluid fluid, List wrappers) { - targetFluidDisplay = - new PositionedStack(GT_Utility.getFluidDisplayStack(fluid), getGuiWidth() / 2 - halfItemLength, 3); + targetFluidDisplay = new PositionedStack( + GT_Utility.getFluidDisplayStack(fluid), + getGuiWidth() / 2 - halfItemLength, + 3); int y = 50 - halfItemLength; for (UndergroundFluidWrapper wrapper : wrappers) { ItemStack dimensionDisplay = ItemDimensionDisplay.getItem(wrapper.dimension); if (dimensionDisplay != null) { - dimensionDisplayItems.add(new PositionedStack( - dimensionDisplay, - xDimensionDisplay - halfItemLength, - y + GuiDraw.fontRenderer.FONT_HEIGHT / 2)); + dimensionDisplayItems.add( + new PositionedStack( + dimensionDisplay, + xDimensionDisplay - halfItemLength, + y + GuiDraw.fontRenderer.FONT_HEIGHT / 2)); y += lineSpace; chances.add(wrapper.chance); maxAmounts.add(wrapper.maxAmount); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java index cafb69a8f6..52fc458246 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -2,19 +2,21 @@ package pers.gwyog.gtneioreplugin.plugin.gregtech5; import static pers.gwyog.gtneioreplugin.util.OreVeinLayer.*; -import codechicken.nei.PositionedStack; -import cpw.mods.fml.common.Loader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Comparator; import java.util.List; + import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; + import pers.gwyog.gtneioreplugin.plugin.item.ItemDimensionDisplay; import pers.gwyog.gtneioreplugin.util.DimensionHelper; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; +import codechicken.nei.PositionedStack; +import cpw.mods.fml.common.Loader; public class PluginGT5VeinStat extends PluginGT5Base { @@ -57,12 +59,13 @@ public class PluginGT5VeinStat extends PluginGT5Base { } private void addVeinWithLayers(OreLayerWrapper oreVein, int maximumMaterialIndex) { - this.arecipes.add(new CachedVeinStatRecipe( - oreVein.veinName, - oreVein.getVeinLayerOre(maximumMaterialIndex, VEIN_PRIMARY), - oreVein.getVeinLayerOre(maximumMaterialIndex, VEIN_SECONDARY), - oreVein.getVeinLayerOre(maximumMaterialIndex, VEIN_BETWEEN), - oreVein.getVeinLayerOre(maximumMaterialIndex, VEIN_SPORADIC))); + this.arecipes.add( + new CachedVeinStatRecipe( + oreVein.veinName, + oreVein.getVeinLayerOre(maximumMaterialIndex, VEIN_PRIMARY), + oreVein.getVeinLayerOre(maximumMaterialIndex, VEIN_SECONDARY), + oreVein.getVeinLayerOre(maximumMaterialIndex, VEIN_BETWEEN), + oreVein.getVeinLayerOre(maximumMaterialIndex, VEIN_SPORADIC))); } private Collection getAllVeins() { @@ -144,12 +147,12 @@ public class PluginGT5VeinStat extends PluginGT5Base { private String[] getDimNameArrayFromVeinName(String veinName) { OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(veinName); String[] dims = DimensionHelper.parseDimNames(GT5OreLayerHelper.bufferedDims.get(oreLayer)); - Arrays.sort(dims, Comparator.comparingInt(s -> Arrays.asList(DimensionHelper.DimNameDisplayed) - .indexOf(s))); + Arrays.sort(dims, Comparator.comparingInt(s -> Arrays.asList(DimensionHelper.DimNameDisplayed).indexOf(s))); return dims; } public class CachedVeinStatRecipe extends CachedRecipe { + public String veinName; public PositionedStack positionedStackPrimary; public PositionedStack positionedStackSecondary; @@ -157,11 +160,8 @@ public class PluginGT5VeinStat extends PluginGT5Base { public PositionedStack positionedStackSporadic; private final List dimensionDisplayItems = new ArrayList<>(); - public CachedVeinStatRecipe( - String veinName, - List stackListPrimary, - List stackListSecondary, - List stackListBetween, + public CachedVeinStatRecipe(String veinName, List stackListPrimary, + List stackListSecondary, List stackListBetween, List stackListSporadic) { this.veinName = veinName; positionedStackPrimary = new PositionedStack(stackListPrimary, 2, 0); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java index 0e5bf0c24b..6595929e89 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java @@ -2,18 +2,20 @@ package pers.gwyog.gtneioreplugin.plugin.item; import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.LOG; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.relauncher.Side; import java.util.Objects; + import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraftforge.client.MinecraftForgeClient; + import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; import pers.gwyog.gtneioreplugin.plugin.block.BlockDimensionDisplay; import pers.gwyog.gtneioreplugin.plugin.block.ModBlocks; import pers.gwyog.gtneioreplugin.plugin.renderer.ItemDimensionDisplayRenderer; import pers.gwyog.gtneioreplugin.util.DimensionHelper; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.relauncher.Side; public class ItemDimensionDisplay extends ItemBlock { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java index c4cca1387c..a86482d17f 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java @@ -5,7 +5,9 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.item.ItemStack; import net.minecraftforge.client.IItemRenderer; + import org.lwjgl.opengl.GL11; + import pers.gwyog.gtneioreplugin.plugin.item.ItemDimensionDisplay; public class ItemDimensionDisplayRenderer implements IItemRenderer { @@ -31,7 +33,12 @@ public class ItemDimensionDisplayRenderer implements IItemRenderer { } renderItem.renderItemIntoGUI( - Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().renderEngine, stack, 0, 0, false); + Minecraft.getMinecraft().fontRenderer, + Minecraft.getMinecraft().renderEngine, + stack, + 0, + 0, + false); FontRenderer fontRender = Minecraft.getMinecraft().fontRenderer; float smallTextScale = 3F / 4F; @@ -43,8 +50,8 @@ public class ItemDimensionDisplayRenderer implements IItemRenderer { long prefix = getPrefix(dimension); String tooltipPrefix = prefix != -1 ? "T" + prefix : "INVALID. Please, report this to the GTNH team"; - fontRender.drawString( - tooltipPrefix, 0, (int) (16 / smallTextScale) - fontRender.FONT_HEIGHT + 1, 0xFFFFFF, true); + fontRender + .drawString(tooltipPrefix, 0, (int) (16 / smallTextScale) - fontRender.FONT_HEIGHT + 1, 0xFFFFFF, true); GL11.glPopMatrix(); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java b/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java index 24cc1dd023..05279919e6 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java @@ -1,9 +1,5 @@ package pers.gwyog.gtneioreplugin.util; -import com.opencsv.CSVWriter; -import com.opencsv.bean.ColumnPositionMappingStrategy; -import com.opencsv.bean.StatefulBeanToCsv; -import com.opencsv.bean.StatefulBeanToCsvBuilder; import java.io.BufferedWriter; import java.nio.file.Files; import java.nio.file.Paths; @@ -11,10 +7,16 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; + import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; +import com.opencsv.CSVWriter; +import com.opencsv.bean.ColumnPositionMappingStrategy; +import com.opencsv.bean.StatefulBeanToCsv; +import com.opencsv.bean.StatefulBeanToCsvBuilder; + public class CSVMaker implements Runnable { public CSVMaker() {} @@ -34,13 +36,8 @@ public class CSVMaker implements Runnable { schritt = (int) (schritt / 1.3); } for (int i = 0; i < liste2.size() - schritt; i++) { - if (liste2.get(i) - .getOreName() - .substring(0, 3) - .compareTo((liste2.get(i + schritt) - .getOreName() - .substring(0, 3))) - > 0) { + if (liste2.get(i).getOreName().substring(0, 3) + .compareTo((liste2.get(i + schritt).getOreName().substring(0, 3))) > 0) { Oremix tmp = (Oremix) liste2.get(i); liste2.set(i, liste2.get(i + schritt)); liste2.set(i + schritt, (Oremix) tmp); @@ -110,14 +107,11 @@ public class CSVMaker implements Runnable { BufferedWriter one = Files.newBufferedWriter(Paths.get(GTNEIOrePlugin.CSVnameSmall)); ColumnPositionMappingStrategy strat = new ColumnPositionMappingStrategy(); strat.setType(Oremix.class); - String[] columns = - "ORENAME,mix,DENSITY,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie" - .split("\\,"); + String[] columns = "ORENAME,mix,DENSITY,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie" + .split("\\,"); strat.setColumnMapping(columns); StatefulBeanToCsv beanToCsv = new StatefulBeanToCsvBuilder(one) - .withQuotechar(CSVWriter.NO_QUOTE_CHARACTER) - .withMappingStrategy(strat) - .build(); + .withQuotechar(CSVWriter.NO_QUOTE_CHARACTER).withMappingStrategy(strat).build(); List towrite = Combsort(OreVeins); one.write( "Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E"); @@ -155,8 +149,13 @@ public class CSVMaker implements Runnable { oremix.setHeight(oreLayer.worldGenHeightRange); oremix.setDensity(oreLayer.density); oremix.setWeight(oreLayer.randomWeight); - oremix.setMix(Integer.toString(oreLayer.Meta[0]) + "|" + Integer.toString(oreLayer.Meta[1]) + "|" - + Integer.toString(oreLayer.Meta[2]) + "|" + Integer.toString(oreLayer.Meta[3])); + oremix.setMix( + Integer.toString(oreLayer.Meta[0]) + "|" + + Integer.toString(oreLayer.Meta[1]) + + "|" + + Integer.toString(oreLayer.Meta[2]) + + "|" + + Integer.toString(oreLayer.Meta[3])); oremix.as = Dims.contains("As"); oremix.bc = Dims.contains("BC"); oremix.be = Dims.contains("BE"); @@ -199,14 +198,11 @@ public class CSVMaker implements Runnable { BufferedWriter one = Files.newBufferedWriter(Paths.get(GTNEIOrePlugin.CSVname)); ColumnPositionMappingStrategy strat = new ColumnPositionMappingStrategy(); strat.setType(Oremix.class); - String[] columns = - "ORENAME,PRIMARY,SECONDARY,INBETWEEN,AROUND,mix,TIER,HEIGHT,DENSITY,SIZE,WEIGHT,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie" - .split("\\,"); + String[] columns = "ORENAME,PRIMARY,SECONDARY,INBETWEEN,AROUND,mix,TIER,HEIGHT,DENSITY,SIZE,WEIGHT,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie" + .split("\\,"); strat.setColumnMapping(columns); StatefulBeanToCsv beanToCsv = new StatefulBeanToCsvBuilder(one) - .withQuotechar(CSVWriter.NO_QUOTE_CHARACTER) - .withMappingStrategy(strat) - .build(); + .withQuotechar(CSVWriter.NO_QUOTE_CHARACTER).withMappingStrategy(strat).build(); List towrite = Combsort(OreVeins); one.write( "Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E"); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java index 1b361cb86e..704ccc49c2 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -6,116 +6,88 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.stream.Collectors; + import net.minecraft.client.resources.I18n; public class DimensionHelper { public static String[] DimName = { - // Non GC dimensions in progression order instead of alphabetical - "Overworld", - "Nether", - "Twilight", - "TheEnd", - "Vanilla_EndAsteroids", - "EndAsteroid", - // T1 - "GalacticraftCore_Moon", - // T2 - "GalaxySpace_Deimos", - "GalacticraftMars_Mars", - "GalaxySpace_Phobos", - // T3 - "GalacticraftMars_Asteroids", - "GalaxySpace_Callisto", - "GalaxySpace_Ceres", - "GalaxySpace_Europa", - "GalaxySpace_Ganymede", - "Ross128b", - // T4 - "GalaxySpace_Io", - "GalaxySpace_Mercury", - "GalaxySpace_Venus", - // T5 - "GalaxySpace_Enceladus", - "GalaxySpace_Miranda", - "GalaxySpace_Oberon", - "GalaxySpace_Titan", - "Ross128ba", - // T6 - "GalaxySpace_Proteus", - "GalaxySpace_Triton", - // T7 - "GalaxySpace_Haumea", - "GalaxySpace_Kuiperbelt", - "GalaxySpace_MakeMake", - "GalaxySpace_Pluto", - // T8 - "GalaxySpace_BarnardC", - "GalaxySpace_BarnardE", - "GalaxySpace_BarnardF", - "GalaxySpace_CentauriA", - "GalaxySpace_TcetiE", - "Underdark", - "GalaxySpace_VegaB", - }; + // Non GC dimensions in progression order instead of alphabetical + "Overworld", "Nether", "Twilight", "TheEnd", "Vanilla_EndAsteroids", "EndAsteroid", + // T1 + "GalacticraftCore_Moon", + // T2 + "GalaxySpace_Deimos", "GalacticraftMars_Mars", "GalaxySpace_Phobos", + // T3 + "GalacticraftMars_Asteroids", "GalaxySpace_Callisto", "GalaxySpace_Ceres", "GalaxySpace_Europa", + "GalaxySpace_Ganymede", "Ross128b", + // T4 + "GalaxySpace_Io", "GalaxySpace_Mercury", "GalaxySpace_Venus", + // T5 + "GalaxySpace_Enceladus", "GalaxySpace_Miranda", "GalaxySpace_Oberon", "GalaxySpace_Titan", "Ross128ba", + // T6 + "GalaxySpace_Proteus", "GalaxySpace_Triton", + // T7 + "GalaxySpace_Haumea", "GalaxySpace_Kuiperbelt", "GalaxySpace_MakeMake", "GalaxySpace_Pluto", + // T8 + "GalaxySpace_BarnardC", "GalaxySpace_BarnardE", "GalaxySpace_BarnardF", "GalaxySpace_CentauriA", + "GalaxySpace_TcetiE", "Underdark", "GalaxySpace_VegaB", }; public static String[] DimNameTrimmed = Arrays.stream(DimName) - .map(n -> n.replaceAll("GalacticraftCore_", "") - .replaceAll("GalacticraftMars_", "") - .replaceAll("GalaxySpace_", "") - .replaceAll("Vanilla_", "Vanilla ")) - .collect(Collectors.toList()) - .toArray(new String[0]); + .map( + n -> n.replaceAll("GalacticraftCore_", "").replaceAll("GalacticraftMars_", "") + .replaceAll("GalaxySpace_", "").replaceAll("Vanilla_", "Vanilla ")) + .collect(Collectors.toList()).toArray(new String[0]); - public static String[] - DimNameDisplayed = { // first 2 letters if one word else 1 letter of every word, except capital letter in - // name, then 1rst + capital Moon = Mo, BarnardC = BC, EndAsteroid = EA - // Non GC dimensions in progression order instead of alphabetical - "Ow", // Overworld - "Ne", // Nether - "TF", // Twilight - "ED", // TheEnd because En = Encalus - "VA", // Vanilla_EndAsteroids - "EA", // EndAsteroid - // T1 - "Mo", // GalacticraftCore_Moon - // T2 - "De", // GalaxySpace_Deimos - "Ma", // GalacticraftMars_Mars - "Ph", // GalaxySpace_Phobos - // T3 - "As", // GalacticraftMars_Asteroids - "Ca", // GalaxySpace_Callisto - "Ce", // GalaxySpace_Ceres - "Eu", // GalaxySpace_Europa - "Ga", // GalaxySpace_Ganymede - "Rb", // Ross128b - // T4 - "Io", // GalaxySpace_Io - "Me", // GalaxySpace_Mercury - "Ve", // GalaxySpace_Venus - // T5 - "En", // GalaxySpace_Enceladus - "Mi", // GalaxySpace_Miranda - "Ob", // GalaxySpace_Oberon - "Ti", // GalaxySpace_Titan - "Ra", // Ross128ba - // T6 - "Pr", // GalaxySpace_Proteus - "Tr", // GalaxySpace_Triton - // T7 - "Ha", // GalaxySpace_Haumea - "KB", // GalaxySpace_Kuiperbelt - "MM", // GalaxySpace_MakeMake - "Pl", // GalaxySpace_Pluto - // T8 - "BC", // GalaxySpace_BarnardC - "BE", // GalaxySpace_BarnardE - "BF", // GalaxySpace_BarnardF - "CB", // GalaxySpace_CentauriA is actually αCentauri Bb - "TE", // GalaxySpace_TcetiE - "DD", // Underdark - "VB", // GalaxySpace_VegaB + public static String[] DimNameDisplayed = { // first 2 letters if one word else 1 letter of every word, except + // capital letter in + // name, then 1rst + capital Moon = Mo, BarnardC = BC, EndAsteroid = EA + // Non GC dimensions in progression order instead of alphabetical + "Ow", // Overworld + "Ne", // Nether + "TF", // Twilight + "ED", // TheEnd because En = Encalus + "VA", // Vanilla_EndAsteroids + "EA", // EndAsteroid + // T1 + "Mo", // GalacticraftCore_Moon + // T2 + "De", // GalaxySpace_Deimos + "Ma", // GalacticraftMars_Mars + "Ph", // GalaxySpace_Phobos + // T3 + "As", // GalacticraftMars_Asteroids + "Ca", // GalaxySpace_Callisto + "Ce", // GalaxySpace_Ceres + "Eu", // GalaxySpace_Europa + "Ga", // GalaxySpace_Ganymede + "Rb", // Ross128b + // T4 + "Io", // GalaxySpace_Io + "Me", // GalaxySpace_Mercury + "Ve", // GalaxySpace_Venus + // T5 + "En", // GalaxySpace_Enceladus + "Mi", // GalaxySpace_Miranda + "Ob", // GalaxySpace_Oberon + "Ti", // GalaxySpace_Titan + "Ra", // Ross128ba + // T6 + "Pr", // GalaxySpace_Proteus + "Tr", // GalaxySpace_Triton + // T7 + "Ha", // GalaxySpace_Haumea + "KB", // GalaxySpace_Kuiperbelt + "MM", // GalaxySpace_MakeMake + "Pl", // GalaxySpace_Pluto + // T8 + "BC", // GalaxySpace_BarnardC + "BE", // GalaxySpace_BarnardE + "BF", // GalaxySpace_BarnardF + "CB", // GalaxySpace_CentauriA is actually αCentauri Bb + "TE", // GalaxySpace_TcetiE + "DD", // Underdark + "VB", // GalaxySpace_VegaB }; private static final HashMap> tooltipBuffer = new HashMap<>(); @@ -187,7 +159,9 @@ public class DimensionHelper { if (dims.length > maxTooltipLines) { dims = StringPaddingHack.stringsToSpacedColumns( - dims, dims.length / maxTooltipLines + (dims.length % maxTooltipLines == 0 ? 0 : 1), 2); + dims, + dims.length / maxTooltipLines + (dims.length % maxTooltipLines == 0 ? 0 : 1), + 2); } return Arrays.asList(dims); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java index 9b12e3d007..3660d9877e 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java @@ -1,7 +1,5 @@ package pers.gwyog.gtneioreplugin.util; -import cpw.mods.fml.common.FMLLog; -import gregtech.api.GregTech_API; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -9,10 +7,14 @@ import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; import java.util.List; + import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; + import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; +import cpw.mods.fml.common.FMLLog; +import gregtech.api.GregTech_API; public class GT5CFGHelper { @@ -32,11 +34,10 @@ public class GT5CFGHelper { raw.add(p.getName() + "=" + p.getBoolean()); } } - if (!raw.isEmpty()) - for (int i = 0; i < raw.size(); i++) { - for (int j = 0; j < DimensionHelper.DimName.length; j++) - if (raw.get(i).contains(DimensionHelper.DimName[j])) rawbools.add(raw.get(i)); - } + if (!raw.isEmpty()) for (int i = 0; i < raw.size(); i++) { + for (int j = 0; j < DimensionHelper.DimName.length; j++) + if (raw.get(i).contains(DimensionHelper.DimName[j])) rawbools.add(raw.get(i)); + } else GTNEIOrePlugin.LOG.info("Config entry not found for Vein: " + Veinname); String ret = " "; @@ -44,11 +45,7 @@ public class GT5CFGHelper { HashSet rawboolsset = new HashSet(); if (!rawbools.isEmpty()) { for (int i = 0; i < rawbools.size(); i++) { - st = rawbools.get(i) - .replace("B:", "") - .replace("_true", "") - .replace("_false", "") - .replaceAll(" ", "") + st = rawbools.get(i).replace("B:", "").replace("_true", "").replace("_false", "").replaceAll(" ", "") .replaceAll("\"", ""); rawboolsset.add(st); } @@ -71,116 +68,110 @@ public class GT5CFGHelper { if (F == null) { FMLLog.bigWarning("GT_CFG_NOT_found[0]"); return "Error while Loading CFG"; - } else - try { - int buffer = (int) (0.1 * Runtime.getRuntime().freeMemory()); - if (buffer > F.length()) buffer = (int) F.length(); - // allocate 10% of free memory for read-in-buffer, if there is less than filesize memory available - // FMLLog.info("GT_CFG_found[0]"); - FileReader in = new FileReader(F); - // FMLLog.info("FileReader created"); - BufferedReader reader = new BufferedReader(in, buffer); - // FMLLog.info("BufferedReader" +Integer.toString(buffer)+"created"); - String st = null; - List raw = new ArrayList(); - List rawbools = new ArrayList(); - Boolean[] found = new Boolean[2]; - found[0] = false; - found[1] = false; + } else try { + int buffer = (int) (0.1 * Runtime.getRuntime().freeMemory()); + if (buffer > F.length()) buffer = (int) F.length(); + // allocate 10% of free memory for read-in-buffer, if there is less than filesize memory available + // FMLLog.info("GT_CFG_found[0]"); + FileReader in = new FileReader(F); + // FMLLog.info("FileReader created"); + BufferedReader reader = new BufferedReader(in, buffer); + // FMLLog.info("BufferedReader" +Integer.toString(buffer)+"created"); + String st = null; + List raw = new ArrayList(); + List rawbools = new ArrayList(); + Boolean[] found = new Boolean[2]; + found[0] = false; + found[1] = false; - do { - // FMLLog.info("erste"); - // read until reached eof or mix { - st = reader.readLine(); - // FMLLog.info("st: "+st); - if (st != null && st.trim().equals("mix {")) { - while (!((st == null) || ((st != null) && found[0]))) { - // FMLLog.info("zweite"); - st = reader.readLine(); - // read until reached eof or Veinname { - // FMLLog.info("MIXst: "+st); - if (st != null && st.trim().equals(Veinname + " {")) { - // FMLLog.info("VEINNAMEst: "+st); - while (!((st == null) || ((st != null) && found[0]))) { - st = reader.readLine(); - if ((!(st == null)) && st.trim().equals("}")) found[0] = true; - // FMLLog.info("dritte"); - // add everything below Veinname { undtil } to raw - raw.add(st); - } + do { + // FMLLog.info("erste"); + // read until reached eof or mix { + st = reader.readLine(); + // FMLLog.info("st: "+st); + if (st != null && st.trim().equals("mix {")) { + while (!((st == null) || ((st != null) && found[0]))) { + // FMLLog.info("zweite"); + st = reader.readLine(); + // read until reached eof or Veinname { + // FMLLog.info("MIXst: "+st); + if (st != null && st.trim().equals(Veinname + " {")) { + // FMLLog.info("VEINNAMEst: "+st); + while (!((st == null) || ((st != null) && found[0]))) { + st = reader.readLine(); + if ((!(st == null)) && st.trim().equals("}")) found[0] = true; + // FMLLog.info("dritte"); + // add everything below Veinname { undtil } to raw + raw.add(st); } } } + } - if (st != null && st.trim().equals("dimensions {")) { - while (!((st == null) || ((st != null) && found[1]))) { - // FMLLog.info("zweite"); - st = reader.readLine(); - if (st != null && (st.trim().equals("mix {"))) { - while (!((st == null) || ((st != null) && found[1]))) { - // FMLLog.info("dritte"); - st = reader.readLine(); - // read until reached eof or Veinname { - // FMLLog.info("MIXst: "+st); - if (st != null && st.trim().equals(Veinname + " {")) { - // FMLLog.info("VEINNAMEst: "+st); - while (!((st == null) || ((st != null) && found[1]))) { - st = reader.readLine(); - if ((!(st == null)) && st.trim().equals("}")) found[1] = true; - // FMLLog.info("vierte"); - // add everything below Veinname { undtil } to raw - raw.add(st); - } + if (st != null && st.trim().equals("dimensions {")) { + while (!((st == null) || ((st != null) && found[1]))) { + // FMLLog.info("zweite"); + st = reader.readLine(); + if (st != null && (st.trim().equals("mix {"))) { + while (!((st == null) || ((st != null) && found[1]))) { + // FMLLog.info("dritte"); + st = reader.readLine(); + // read until reached eof or Veinname { + // FMLLog.info("MIXst: "+st); + if (st != null && st.trim().equals(Veinname + " {")) { + // FMLLog.info("VEINNAMEst: "+st); + while (!((st == null) || ((st != null) && found[1]))) { + st = reader.readLine(); + if ((!(st == null)) && st.trim().equals("}")) found[1] = true; + // FMLLog.info("vierte"); + // add everything below Veinname { undtil } to raw + raw.add(st); } } } } } - } while (st != null); - reader.close(); // not needed anymore + } + } while (st != null); + reader.close(); // not needed anymore - if (!raw.isEmpty()) - for (int i = 0; i < raw.size(); i++) { - // filter needed booleans from raw - /// FMLLog.info("raw contains"+raw.get(i)); - for (int j = 0; j < DimensionHelper.DimName.length; j++) - if (raw.get(i).contains(DimensionHelper.DimName[j])) rawbools.add(raw.get(i)); - // FMLLog.info("rawbools: "+rawbools.get(i)); - } - else GTNEIOrePlugin.LOG.info("Config entry not found for Vein: " + Veinname); + if (!raw.isEmpty()) for (int i = 0; i < raw.size(); i++) { + // filter needed booleans from raw + /// FMLLog.info("raw contains"+raw.get(i)); + for (int j = 0; j < DimensionHelper.DimName.length; j++) + if (raw.get(i).contains(DimensionHelper.DimName[j])) rawbools.add(raw.get(i)); + // FMLLog.info("rawbools: "+rawbools.get(i)); + } + else GTNEIOrePlugin.LOG.info("Config entry not found for Vein: " + Veinname); - String ret = " "; + String ret = " "; - HashSet rawboolsset = new HashSet(); - if (!rawbools.isEmpty()) { - // remove dublicates + HashSet rawboolsset = new HashSet(); + if (!rawbools.isEmpty()) { + // remove dublicates + for (int i = 0; i < rawbools.size(); i++) { + st = rawbools.get(i).replace("B:", "").replace("_true", "").replace("_false", "") + .replaceAll(" ", "").replaceAll("\"", ""); + rawboolsset.add(st); + } + rawbools = new ArrayList(rawboolsset); + // filter for dims set to true + for (int j = 0; j < DimensionHelper.DimName.length; j++) { + // FMLLog.info("RawBools:"+st); for (int i = 0; i < rawbools.size(); i++) { - st = rawbools.get(i) - .replace("B:", "") - .replace("_true", "") - .replace("_false", "") - .replaceAll(" ", "") - .replaceAll("\"", ""); - rawboolsset.add(st); - } - rawbools = new ArrayList(rawboolsset); - // filter for dims set to true - for (int j = 0; j < DimensionHelper.DimName.length; j++) { - // FMLLog.info("RawBools:"+st); - for (int i = 0; i < rawbools.size(); i++) { - st = rawbools.get(i); - if (st.contains(DimensionHelper.DimName[j])) - if (st.contains("=true")) ret = (ret + DimensionHelper.DimNameDisplayed[j] + ","); - } + st = rawbools.get(i); + if (st.contains(DimensionHelper.DimName[j])) + if (st.contains("=true")) ret = (ret + DimensionHelper.DimNameDisplayed[j] + ","); } } - ret = ret.trim(); - // FMLLog.info("ret:"+ret); - if (ret.equals("") || ret.equals(" ")) ret = oreVeinNotInAnyDim; - return ret; - } catch (IOException e) { - e.printStackTrace(); - return "Error while Loading CFG"; } + ret = ret.trim(); + // FMLLog.info("ret:"+ret); + if (ret.equals("") || ret.equals(" ")) ret = oreVeinNotInAnyDim; + return ret; + } catch (IOException e) { + e.printStackTrace(); + return "Error while Loading CFG"; + } } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index 3df3d98242..feed3d0794 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -3,19 +3,22 @@ package pers.gwyog.gtneioreplugin.util; import static pers.gwyog.gtneioreplugin.util.GT5CFGHelper.oreVeinNotInAnyDim; import static pers.gwyog.gtneioreplugin.util.OreVeinLayer.*; -import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.common.GT_Worldgen_GT_Ore_Layer; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; + import net.minecraft.item.ItemStack; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.common.GT_Worldgen_GT_Ore_Layer; + public class GT5OreLayerHelper { public static class NormalOreDimensionWrapper { + public final ArrayList internalDimOreList = new ArrayList<>(); public final HashMap oreVeinToProbabilityInDimension = new HashMap<>(); @@ -57,8 +60,8 @@ public class GT5OreLayerHelper { for (String dim : dims.split(",")) { if (!dim.isEmpty()) { - NormalOreDimensionWrapper dimensionOres = - dimToOreWrapper.getOrDefault(dim, new NormalOreDimensionWrapper()); + NormalOreDimensionWrapper dimensionOres = dimToOreWrapper + .getOrDefault(dim, new NormalOreDimensionWrapper()); dimensionOres.internalDimOreList.add(veinInfo); dimToOreWrapper.put(dim, dimensionOres); } @@ -73,11 +76,11 @@ public class GT5OreLayerHelper { } public static String getDims(OreLayerWrapper oreLayer) { - return GT5CFGHelper.GT5CFG( - oreLayer.veinName.replace("ore.mix.custom" + ".", "").replace("ore.mix.", "")); + return GT5CFGHelper.GT5CFG(oreLayer.veinName.replace("ore.mix.custom" + ".", "").replace("ore.mix.", "")); } public static class OreLayerWrapper { + public String veinName, worldGenHeightRange; public short[] Meta = new short[4]; public short randomWeight, size, density; @@ -98,23 +101,14 @@ public class GT5OreLayerHelper { // Black magic, don't ask me how it works, I have no idea. try { this.mPrimaryVeinMaterial = GT_OreDictUnificator.getAssociation( - new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mPrimaryMeta)) - .mMaterial - .mMaterial; + new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mPrimaryMeta)).mMaterial.mMaterial; this.mSecondaryMaterial = GT_OreDictUnificator.getAssociation( - new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSecondaryMeta)) - .mMaterial - .mMaterial; + new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSecondaryMeta)).mMaterial.mMaterial; this.mBetweenMaterial = GT_OreDictUnificator.getAssociation( - new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mBetweenMeta)) - .mMaterial - .mMaterial; + new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mBetweenMeta)).mMaterial.mMaterial; this.mSporadicMaterial = GT_OreDictUnificator.getAssociation( - new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSporadicMeta)) - .mMaterial - .mMaterial; - } catch (Exception ignored) { - } + new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSporadicMeta)).mMaterial.mMaterial; + } catch (Exception ignored) {} this.size = worldGen.mSize; this.density = worldGen.mDensity; @@ -135,8 +129,7 @@ public class GT5OreLayerHelper { } public boolean containsOre(short materialIndex) { - return Meta[VEIN_PRIMARY] == materialIndex - || Meta[VEIN_SECONDARY] == materialIndex + return Meta[VEIN_PRIMARY] == materialIndex || Meta[VEIN_SECONDARY] == materialIndex || Meta[VEIN_BETWEEN] == materialIndex || Meta[VEIN_SPORADIC] == materialIndex; } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java index 9ea39398ea..56143c8068 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java @@ -2,19 +2,22 @@ package pers.gwyog.gtneioreplugin.util; import static pers.gwyog.gtneioreplugin.util.GT5CFGHelper.oreVeinNotInAnyDim; +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import net.minecraft.item.ItemStack; + 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 java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import net.minecraft.item.ItemStack; public class GT5OreSmallHelper { + private static final int SMALL_ORE_BASE_META = 16000; public static boolean restrictBiomeSupport = false; public static boolean gcBasicSupport = false; @@ -26,6 +29,7 @@ public class GT5OreSmallHelper { public static HashMap dimToSmallOreWrapper = new HashMap<>(); public static class SmallOreDimensionWrapper { + public final ArrayList internalDimOreList = new ArrayList<>(); public final HashMap oreVeinToProbabilityInDimension = new HashMap<>(); @@ -36,8 +40,8 @@ public class GT5OreSmallHelper { totalWeight += oreVein.amountPerChunk; } for (OreSmallWrapper oreVein : internalDimOreList) { - oreVeinToProbabilityInDimension.put( - oreVein, ((double) oreVein.amountPerChunk) / ((double) totalWeight)); + oreVeinToProbabilityInDimension + .put(oreVein, ((double) oreVein.amountPerChunk) / ((double) totalWeight)); } } } @@ -125,8 +129,8 @@ public class GT5OreSmallHelper { for (String dim : dims.split(",")) { if (!dim.isEmpty()) { - SmallOreDimensionWrapper dimensionSmallOres = - dimToSmallOreWrapper.getOrDefault(dim, new SmallOreDimensionWrapper()); + SmallOreDimensionWrapper dimensionSmallOres = dimToSmallOreWrapper + .getOrDefault(dim, new SmallOreDimensionWrapper()); dimensionSmallOres.internalDimOreList.add(veinInfo); dimToSmallOreWrapper.put(dim, dimensionSmallOres); } @@ -144,37 +148,27 @@ public class GT5OreSmallHelper { Class clazzGTOreSmall = null; try { clazzGTOreSmall = Class.forName("gregtech.common" + ".GT_Worldgen_GT_Ore_SmallPieces"); - } catch (ClassNotFoundException e) { - } + } catch (ClassNotFoundException e) {} if (clazzGTOreSmall != null) { try { Field fieldRestrictBiome = clazzGTOreSmall.getField("mRestrictBiome"); restrictBiomeSupport = true; - } catch (Exception e) { - } + } catch (Exception e) {} try { Field fieldGCMoon = clazzGTOreSmall.getField("mMoon"); Field fieldGCMars = clazzGTOreSmall.getField("mMars"); gcBasicSupport = true; - } catch (Exception e) { - } + } 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 - }; + return new Materials[] { Materials.Stone, Materials.Netherrack, Materials.Endstone, Materials.GraniteBlack, + Materials.GraniteRed, Materials.Marble, Materials.Basalt, Materials.Stone }; } public static class OreSmallWrapper { + public String oreGenName; public short oreMeta; public String worldGenHeightRange; @@ -193,10 +187,8 @@ public class GT5OreSmallHelper { this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; this.amountPerChunk = worldGen.mAmount; try { - this.oreMaterial = GT_OreDictUnificator.getAssociation( - new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mMeta)) - .mMaterial - .mMaterial; + this.oreMaterial = GT_OreDictUnificator + .getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mMeta)).mMaterial.mMaterial; } catch (Exception e) { e.printStackTrace(); } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java index 731867953d..171ee195a2 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java @@ -2,11 +2,6 @@ package pers.gwyog.gtneioreplugin.util; import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.LOG; -import com.google.common.collect.BiMap; -import gregtech.GT_Mod; -import gregtech.api.objects.GT_UO_Dimension; -import gregtech.api.objects.GT_UO_DimensionList; -import gregtech.api.objects.GT_UO_Fluid; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; @@ -17,16 +12,23 @@ import java.util.Hashtable; import java.util.List; import java.util.Map; import java.util.stream.Collectors; + import net.minecraft.world.WorldProvider; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; +import com.google.common.collect.BiMap; + +import gregtech.GT_Mod; +import gregtech.api.objects.GT_UO_Dimension; +import gregtech.api.objects.GT_UO_DimensionList; +import gregtech.api.objects.GT_UO_Fluid; + public class GT5UndergroundFluidHelper { /** - * Need to store fluid name instead of fluid - * because fluid instance might be different between gas and liquid + * Need to store fluid name instead of fluid because fluid instance might be different between gas and liquid */ private static final Map> fluidMap = new HashMap<>(); @@ -35,8 +37,8 @@ public class GT5UndergroundFluidHelper { try { Field fieldDimensionList = GT_UO_DimensionList.class.getDeclaredField("fDimensionList"); fieldDimensionList.setAccessible(true); - BiMap dimensionList = - (BiMap) fieldDimensionList.get(GT_Mod.gregtechproxy.mUndergroundOil); + BiMap dimensionList = (BiMap) fieldDimensionList + .get(GT_Mod.gregtechproxy.mUndergroundOil); for (Map.Entry dimensionEntry : dimensionList.entrySet()) { String rawDimension = dimensionEntry.getKey(); String dimension = null; @@ -45,20 +47,18 @@ public class GT5UndergroundFluidHelper { } catch (NumberFormatException ignored) { Field fieldProviders = DimensionManager.class.getDeclaredField("providers"); fieldProviders.setAccessible(true); - Hashtable> providers = - (Hashtable>) fieldProviders.get(null); + Hashtable> providers = (Hashtable>) fieldProviders + .get(null); // some short dimension names like Io might be caught by multiple dimension classes, // so we'll check them all. - // List dimensionCandidates = providers.values() + // List dimensionCandidates = providers.values() List> dimensionCandidates = providers.values().stream() - .filter(p -> p.getName().contains(rawDimension)) - .collect(Collectors.toList()); - loop: - for (Class candidate : dimensionCandidates) { + .filter(p -> p.getName().contains(rawDimension)).collect(Collectors.toList()); + loop: for (Class candidate : dimensionCandidates) { for (int i = 0; i < DimensionHelper.DimNameTrimmed.length; i++) { - if (DimensionHelper.DimNameTrimmed[i].equalsIgnoreCase( - candidate.newInstance().getDimensionName())) { + if (DimensionHelper.DimNameTrimmed[i] + .equalsIgnoreCase(candidate.newInstance().getDimensionName())) { dimension = DimensionHelper.DimNameDisplayed[i]; break loop; } @@ -76,8 +76,8 @@ public class GT5UndergroundFluidHelper { Field fieldFluids = GT_UO_Dimension.class.getDeclaredField("fFluids"); fieldFluids.setAccessible(true); - BiMap fluids = - (BiMap) fieldFluids.get(dimensionEntry.getValue()); + BiMap fluids = (BiMap) fieldFluids + .get(dimensionEntry.getValue()); int maxChance = 0; for (Map.Entry fluidEntry : fluids.entrySet()) { @@ -105,8 +105,8 @@ public class GT5UndergroundFluidHelper { } for (List wrappers : fluidMap.values()) { - wrappers.sort(Comparator.comparingInt( - w -> Arrays.asList(DimensionHelper.DimNameDisplayed).indexOf(w.dimension))); + wrappers.sort( + Comparator.comparingInt(w -> Arrays.asList(DimensionHelper.DimNameDisplayed).indexOf(w.dimension))); } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java index 8cf6a8faac..29eaf8c9f4 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java @@ -1,14 +1,17 @@ package pers.gwyog.gtneioreplugin.util; -import codechicken.nei.recipe.GuiRecipe; -import cpw.mods.fml.common.FMLLog; import java.lang.reflect.Field; + import net.minecraft.client.Minecraft; + import org.apache.logging.log4j.Level; +import codechicken.nei.recipe.GuiRecipe; +import cpw.mods.fml.common.FMLLog; + public class GuiRecipeHelper { - private static final String INIT_ERROR = - "pers.gwyog.gtneioreplugin.util.GuiRecipeHelper failed setting up reflection : "; + + private static final String INIT_ERROR = "pers.gwyog.gtneioreplugin.util.GuiRecipeHelper failed setting up reflection : "; private static final int DEFAULT_XSIZE = 176; public static Field xSizeField; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/OreVeinLayer.java b/src/main/java/pers/gwyog/gtneioreplugin/util/OreVeinLayer.java index 3bd684987e..bc32f2ce46 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/OreVeinLayer.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/OreVeinLayer.java @@ -1,17 +1,14 @@ package pers.gwyog.gtneioreplugin.util; public class OreVeinLayer { + public static final int VEIN_PRIMARY = 0; public static final int VEIN_SECONDARY = 1; public static final int VEIN_BETWEEN = 2; public static final int VEIN_SPORADIC = 3; - private static final String[] LAYER_NAMES = { - "gtnop.gui.nei.primaryOre", - "gtnop.gui.nei.secondaryOre", - "gtnop.gui.nei.betweenOre", - "gtnop.gui" + ".nei.sporadicOre" - }; + private static final String[] LAYER_NAMES = { "gtnop.gui.nei.primaryOre", "gtnop.gui.nei.secondaryOre", + "gtnop.gui.nei.betweenOre", "gtnop.gui" + ".nei.sporadicOre" }; public static String getOreVeinLayerName(int layerId) { return LAYER_NAMES[layerId]; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/StringPaddingHack.java b/src/main/java/pers/gwyog/gtneioreplugin/util/StringPaddingHack.java index 20e524ec41..59a55a82fa 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/StringPaddingHack.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/StringPaddingHack.java @@ -1,20 +1,23 @@ package pers.gwyog.gtneioreplugin.util; -import com.google.common.base.Strings; import java.util.Arrays; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import com.google.common.base.Strings; + public class StringPaddingHack { + private static final int SPACE_WIDTH = 4; private static final int BOLD_SPACE_WIDTH = 5; /** - * Given a list of strings, arrange them into the requested number of columns with the specified spacing. - * Up to 3 additional spaces might be added between columns because this function relies on quirky font behaviors. + * Given a list of strings, arrange them into the requested number of columns with the specified spacing. Up to 3 + * additional spaces might be added between columns because this function relies on quirky font behaviors. * - * @param strings List of strings to wrap into columns - * @param numColumns Number of columns, minimum of 1 + * @param strings List of strings to wrap into columns + * @param numColumns Number of columns, minimum of 1 * @param minColumnSpacing Minimum amount of extra spaces between columns. * @return strings wrapped into columns */ @@ -36,8 +39,8 @@ public class StringPaddingHack { remainder--; extra = 1; } - columns[i] = Arrays.copyOfRange( - strings, (sliceSize * i) + totalExtra, (sliceSize * (i + 1) + totalExtra + extra)); + columns[i] = Arrays + .copyOfRange(strings, (sliceSize * i) + totalExtra, (sliceSize * (i + 1) + totalExtra + extra)); totalExtra += extra; } @@ -60,14 +63,13 @@ public class StringPaddingHack { } /** - * Pads strings with spaces so that they are of equal length and adds to - * that the number of spaces specified and up to 3 if minExtraSpaces is - * below 3. Added spaces might be bold. + * Pads strings with spaces so that they are of equal length and adds to that the number of spaces specified and up + * to 3 if minExtraSpaces is below 3. Added spaces might be bold. * - * Relies on the quirk of bold space characters being 1 pixel wider than - * regular space characters in the default font renderer. + * Relies on the quirk of bold space characters being 1 pixel wider than regular space characters in the default + * font renderer. * - * @param strings List of strings + * @param strings List of strings * @param minExtraSpaces The minimum number of extra spaces to add * @return List of strings padded with spaces to an equal length */ diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java b/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java index 98be50d989..59dd82fa8e 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java @@ -1,13 +1,15 @@ package pers.gwyog.gtneioreplugin.util; -import com.opencsv.bean.AbstractBeanField; -import com.opencsv.exceptions.CsvConstraintViolationException; -import com.opencsv.exceptions.CsvDataTypeMismatchException; import java.util.ResourceBundle; + import org.apache.commons.beanutils.ConversionException; import org.apache.commons.beanutils.Converter; import org.apache.commons.beanutils.converters.BooleanConverter; +import com.opencsv.bean.AbstractBeanField; +import com.opencsv.exceptions.CsvConstraintViolationException; +import com.opencsv.exceptions.CsvDataTypeMismatchException; + public class XtoBool extends AbstractBeanField { @Override @@ -15,8 +17,8 @@ public class XtoBool extends AbstractBeanField { if (value.isEmpty()) { return null; } - String[] trueStrings = {"x", "X"}; - String[] falseStrings = {""}; + String[] trueStrings = { "x", "X" }; + String[] falseStrings = { "" }; Converter bc = new BooleanConverter(trueStrings, falseStrings); try { return bc.convert(Boolean.class, value.trim()); @@ -24,8 +26,7 @@ public class XtoBool extends AbstractBeanField { CsvDataTypeMismatchException csve = new CsvDataTypeMismatchException( value, field.getType(), - ResourceBundle.getBundle("convertGermanToBoolean", errorLocale) - .getString("input.not.boolean")); + ResourceBundle.getBundle("convertGermanToBoolean", errorLocale).getString("input.not.boolean")); csve.initCause(e); throw csve; } -- cgit From 13a4fdcdd6b55f56eb8dc4f8a5cd3fd85659789b Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Sun, 29 Jan 2023 10:49:48 -0800 Subject: [ci skip] Add git-blame-ignore-revs for spotlessApply --- .git-blame-ignore-revs | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .git-blame-ignore-revs diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000000..0175598d8e --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# Ignore spotlessApply reformat +7b66e23199db44891c57865160afb5c66f6fd94f -- cgit From d09e972f7e037b8776681c520918cd887202ab07 Mon Sep 17 00:00:00 2001 From: Raven Szewczyk Date: Tue, 31 Jan 2023 09:53:18 +0000 Subject: [ci skip] upgraded build system --- build.gradle | 90 ++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 70 insertions(+), 20 deletions(-) diff --git a/build.gradle b/build.gradle index 18afe431e9..fe8a2e7be2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1675013090 +//version: 1675110695 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -55,9 +55,9 @@ plugins { id 'eclipse' id 'scala' id 'maven-publish' - id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false - id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false - id 'com.google.devtools.ksp' version '1.5.30-1.0.0' apply false + id 'org.jetbrains.kotlin.jvm' version '1.8.0' apply false + id 'org.jetbrains.kotlin.kapt' version '1.8.0' apply false + id 'com.google.devtools.ksp' version '1.8.0-1.0.9' apply false id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version ,unused, available for addon.gradle id 'com.github.johnrengelman.shadow' version '7.1.2' apply false id 'com.palantir.git-version' version '0.13.0' apply false // 0.13.0 is the last jvm8 supporting version @@ -66,7 +66,7 @@ plugins { id 'com.diffplug.spotless' version '6.7.2' apply false id 'com.modrinth.minotaur' version '2.+' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false - id 'com.gtnewhorizons.retrofuturagradle' version '1.0.18' + id 'com.gtnewhorizons.retrofuturagradle' version '1.1.2' } boolean settingsupdated = verifySettingsGradle() settingsupdated = verifyGitAttributes() || settingsupdated @@ -113,6 +113,7 @@ propertyDefaultIfUnset("modrinthRelations", "") propertyDefaultIfUnset("curseForgeProjectId", "") propertyDefaultIfUnset("curseForgeRelations", "") propertyDefaultIfUnset("minimizeShadowedDependencies", true) +propertyDefaultIfUnset("relocateShadowedDependencies", true) // Deprecated properties (kept for backwards compat) propertyDefaultIfUnset("gradleTokenModId", "") propertyDefaultIfUnset("gradleTokenModName", "") @@ -149,6 +150,33 @@ java { } } +pluginManager.withPlugin('org.jetbrains.kotlin.jvm') { + // If Kotlin is enabled in the project + kotlin { + jvmToolchain(8) + } + // Kotlin hacks our source sets, so we hack Kotlin's tasks + def disabledKotlinTaskList = [ + "kaptGenerateStubsMcLauncherKotlin", + "kaptGenerateStubsPatchedMcKotlin", + "kaptGenerateStubsInjectedTagsKotlin", + "compileMcLauncherKotlin", + "compilePatchedMcKotlin", + "compileInjectedTagsKotlin", + "kaptMcLauncherKotlin", + "kaptPatchedMcKotlin", + "kaptInjectedTagsKotlin", + "kspMcLauncherKotlin", + "kspPatchedMcKotlin", + "kspInjectedTagsKotlin", + ] + tasks.configureEach { task -> + if (task.name in disabledKotlinTaskList) { + task.enabled = false + } + } +} + configurations { create("runtimeOnlyNonPublishable") { description = "Runtime only dependencies that are not published alongside the jar" @@ -309,7 +337,7 @@ if (identifiedVersion == versionOverride) { out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7') } -group = modGroup +group = "com.github.GTNewHorizons" if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) { archivesBaseName = customArchiveBaseName } else { @@ -502,6 +530,14 @@ dependencies { } } +pluginManager.withPlugin('org.jetbrains.kotlin.kapt') { + if (usesMixins.toBoolean()) { + dependencies { + kapt('com.gtnewhorizon:gtnhmixins:2.1.10:processor') + } + } +} + apply from: 'dependencies.gradle' def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' @@ -542,9 +578,11 @@ if (usesMixins.toBoolean()) { tasks.named("reobfJar", ReobfuscatedJar).configure { extraSrgFiles.from(mixinSrg) } -} -if (usesMixins.toBoolean()) { + tasks.named("processResources").configure { + dependsOn("generateAssets") + } + tasks.named("compileJava", JavaCompile).configure { doFirst { new File(mixinTmpDir).mkdirs() @@ -558,6 +596,25 @@ if (usesMixins.toBoolean()) { "-XDignore.symbol.file" ] } + + pluginManager.withPlugin('org.jetbrains.kotlin.kapt') { + kapt { + correctErrorTypes = true + javacOptions { + option("-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}") + option("-AoutSrgFile=$mixinSrg") + option("-AoutRefMapFile=$refMap") + } + } + tasks.configureEach { task -> + if (task.name == "kaptKotlin") { + task.doFirst { + new File(mixinTmpDir).mkdirs() + } + } + } + } + } tasks.named("processResources", ProcessResources).configure { @@ -613,6 +670,7 @@ if (usesShadowedDependencies.toBoolean()) { tasks.register('relocateShadowJar', ConfigureShadowRelocation) { target = tasks.shadowJar prefix = modGroup + ".shadow" + enabled = minimizeShadowedDependencies.toBoolean() } tasks.named("shadowJar", ShadowJar).configure { manifest { @@ -628,7 +686,9 @@ if (usesShadowedDependencies.toBoolean()) { project.configurations.shadeCompile ] archiveClassifier.set('dev') - dependsOn(relocateShadowJar) + if (minimizeShadowedDependencies.toBoolean()) { + dependsOn(relocateShadowJar) + } } configurations.runtimeElements.outgoing.artifacts.clear() configurations.apiElements.outgoing.artifacts.clear() @@ -654,16 +714,6 @@ if (usesShadowedDependencies.toBoolean()) { ext.publishableDevJar = usesShadowedDependencies.toBoolean() ? tasks.shadowJar : tasks.jar ext.publishableObfJar = tasks.reobfJar -tasks.named('extractForgeUserdev', Copy).configure { efu -> - doLast { - // Fix CoFH-repackaged CCL not finding mappings - project.copy { - from(mcpTasks.userdevDir("conf")) - into(new File(project.buildDir, "unpacked/conf")) - } - } -} - tasks.register('apiJar', Jar) { from(sourceSets.main.allSource) { include modGroupPath + "/" + apiPackagePath + '/**' @@ -768,7 +818,7 @@ publishing { artifact apiJar } - groupId = System.getenv("ARTIFACT_GROUP_ID") ?: "com.github.GTNewHorizons" + groupId = System.getenv("ARTIFACT_GROUP_ID") ?: project.group artifactId = System.getenv("ARTIFACT_ID") ?: project.name // Using the identified version, not project.version as it has the prepended 1.7.10 version = System.getenv("RELEASE_VERSION") ?: identifiedVersion -- cgit From a02cad10b2b069dab74d7f26a6bdfccd82b06e3e Mon Sep 17 00:00:00 2001 From: miozune Date: Thu, 16 Feb 2023 21:04:16 +0900 Subject: Proper fix for null ItemData (#31) --- build.gradle | 185 ++++++++++++++++++++- dependencies.gradle | 5 +- .../gtneioreplugin/util/GT5OreLayerHelper.java | 31 ++-- .../gtneioreplugin/util/GT5OreSmallHelper.java | 12 +- 4 files changed, 202 insertions(+), 31 deletions(-) diff --git a/build.gradle b/build.gradle index fe8a2e7be2..b808930520 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1675110695 +//version: 1676031737 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -9,11 +9,15 @@ import com.diffplug.blowdryer.Blowdryer import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import com.gtnewhorizons.retrofuturagradle.ObfuscationAttribute import com.gtnewhorizons.retrofuturagradle.mcp.ReobfuscatedJar +import com.gtnewhorizons.retrofuturagradle.minecraft.RunMinecraftTask import com.matthewprenger.cursegradle.CurseArtifact import com.matthewprenger.cursegradle.CurseRelation import com.modrinth.minotaur.dependencies.ModDependency import com.modrinth.minotaur.dependencies.VersionDependency +import cpw.mods.fml.relauncher.Side +import org.gradle.api.tasks.options.Option; import org.gradle.internal.logging.text.StyledTextOutput.Style import org.gradle.internal.logging.text.StyledTextOutputFactory import org.jetbrains.gradle.ext.* @@ -23,6 +27,7 @@ import java.nio.file.Paths import java.util.concurrent.TimeUnit import java.util.zip.ZipEntry import java.util.zip.ZipOutputStream +import javax.inject.Inject buildscript { repositories { @@ -66,7 +71,7 @@ plugins { id 'com.diffplug.spotless' version '6.7.2' apply false id 'com.modrinth.minotaur' version '2.+' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false - id 'com.gtnewhorizons.retrofuturagradle' version '1.1.2' + id 'com.gtnewhorizons.retrofuturagradle' version '1.1.6' } boolean settingsupdated = verifySettingsGradle() settingsupdated = verifyGitAttributes() || settingsupdated @@ -186,11 +191,21 @@ configurations { } if (enableModernJavaSyntax.toBoolean()) { + repositories { + mavenCentral { + mavenContent { + includeGroup("me.eigenraven.java8unsupported") + } + } + } + dependencies { annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0' compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') { transitive = false // We only care about the 1 annotation class } + // Allow using jdk.unsupported classes like sun.misc.Unsafe in the compiled code, working around JDK-8206937. + patchedMinecraft('me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0') } tasks.withType(JavaCompile).configureEach { @@ -401,6 +416,16 @@ configurations.configureEach { } } } + def obfuscationAttr = it.attributes.getAttribute(ObfuscationAttribute.OBFUSCATION_ATTRIBUTE) + if (obfuscationAttr != null && obfuscationAttr.name == ObfuscationAttribute.SRG) { + resolutionStrategy.eachDependency { DependencyResolveDetails details -> + // Remap CoFH core cursemaven dev jar to the obfuscated version for runObfClient/Server + if (details.requested.group == 'curse.maven' && details.requested.name.endsWith('-69162') && details.requested.version == '2388751') { + details.useVersion '2388750' + details.because 'Pick obfuscated jar' + } + } + } } // Ensure tests have access to minecraft classes @@ -520,20 +545,20 @@ dependencies { annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3') annotationProcessor('com.google.guava:guava:24.1.1-jre') annotationProcessor('com.google.code.gson:gson:2.8.6') - annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.10:processor') + annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.12:processor') if (usesMixinDebug.toBoolean()) { runtimeOnlyNonPublishable('org.jetbrains:intellij-fernflower:1.2.1.16') } } if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { - implementation('com.gtnewhorizon:gtnhmixins:2.1.10') + implementation('com.gtnewhorizon:gtnhmixins:2.1.12') } } pluginManager.withPlugin('org.jetbrains.kotlin.kapt') { if (usesMixins.toBoolean()) { dependencies { - kapt('com.gtnewhorizon:gtnhmixins:2.1.10:processor') + kapt('com.gtnewhorizon:gtnhmixins:2.1.12:processor') } } } @@ -633,9 +658,142 @@ tasks.named("processResources", ProcessResources).configure { if (usesMixins.toBoolean()) { from refMap + dependsOn("compileJava", "compileScala") + } +} + +ext.java17Toolchain = (JavaToolchainSpec spec) -> { + spec.languageVersion.set(JavaLanguageVersion.of(17)) + spec.vendor.set(JvmVendorSpec.matching("jetbrains")) +} + +ext.java17DependenciesCfg = configurations.create("java17Dependencies") +ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies") + +dependencies { + def lwjgl3ifyVersion = '1.1.21' + def asmVersion = '9.4' + if (modId != 'lwjgl3ify') { + java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") + } + if (modId != 'hodgepodge') { + java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.0.31') + } + + java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false} + java17PatchDependencies("org.ow2.asm:asm:${asmVersion}") + java17PatchDependencies("org.ow2.asm:asm-commons:${asmVersion}") + java17PatchDependencies("org.ow2.asm:asm-tree:${asmVersion}") + java17PatchDependencies("org.ow2.asm:asm-analysis:${asmVersion}") + java17PatchDependencies("org.ow2.asm:asm-util:${asmVersion}") + java17PatchDependencies('org.ow2.asm:asm-deprecated:7.1') + java17PatchDependencies("org.apache.commons:commons-lang3:3.12.0") + java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") +} + +ext.java17JvmArgs = [ + // Java 9+ support + "--illegal-access=warn", + "-Dfile.encoding=UTF-8", + "-Djava.security.manager=allow", + "--add-opens", "java.base/jdk.internal.loader=ALL-UNNAMED", + "--add-opens", "java.base/java.net=ALL-UNNAMED", + "--add-opens", "java.base/java.nio=ALL-UNNAMED", + "--add-opens", "java.base/java.io=ALL-UNNAMED", + "--add-opens", "java.base/java.lang=ALL-UNNAMED", + "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED", + "--add-opens", "java.base/java.text=ALL-UNNAMED", + "--add-opens", "java.base/java.util=ALL-UNNAMED", + "--add-opens", "java.base/jdk.internal.reflect=ALL-UNNAMED", + "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", + "--add-opens", "java.desktop/sun.awt.image=ALL-UNNAMED", + "--add-modules", "jdk.dynalink", + "--add-opens", "jdk.dynalink/jdk.dynalink.beans=ALL-UNNAMED", + "--add-modules", "java.sql.rowset", + "--add-opens", "java.sql.rowset/javax.sql.rowset.serial=ALL-UNNAMED" +] + +ext.hotswapJvmArgs = [ + // DCEVM advanced hot reload + "-XX:+AllowEnhancedClassRedefinition", + "-XX:HotswapAgent=fatjar" +] + +ext.setupHotswapAgentTask = tasks.register("setupHotswapAgent") { + group = "GTNH Buildscript" + description = "Installs a recent version of HotSwapAgent into the Java 17 JetBrains runtime directory" + def hsaUrl = 'https://github.com/HotswapProjects/HotswapAgent/releases/download/1.4.2-SNAPSHOT/hotswap-agent-1.4.2-SNAPSHOT.jar' + def targetFolderProvider = javaToolchains.launcherFor(java17Toolchain).map {it.metadata.installationPath.dir("lib/hotswap")} + def targetFilename = "hotswap-agent.jar" + onlyIf { + !targetFolderProvider.get().file(targetFilename).asFile.exists() + } + doLast { + def targetFolder = targetFolderProvider.get() + targetFolder.asFile.mkdirs() + download.run { + src hsaUrl + dest targetFolder.file(targetFilename).asFile + overwrite false + tempAndMove true + } + } +} + +public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask { + // IntelliJ doesn't seem to allow commandline arguments so we also support an env variable + private boolean enableHotswap = Boolean.valueOf(System.getenv("HOTSWAP")); + + @Input + public boolean getEnableHotswap() { return enableHotswap } + @Option(option = "hotswap", description = "Enables HotSwapAgent for enhanced class reloading under a debugger") + public boolean setEnableHotswap(boolean enable) { enableHotswap = enable } + + @Inject + public RunHotswappableMinecraftTask(Side side, String superTask) { + super(side) + + this.lwjglVersion = 3 + this.javaLauncher = project.javaToolchains.launcherFor(project.java17Toolchain) + this.extraJvmArgs.addAll(project.java17JvmArgs) + this.extraJvmArgs.addAll(project.provider(() -> enableHotswap ? project.hotswapJvmArgs : [])) + + this.classpath(project.java17PatchDependenciesCfg) + if (side == Side.CLIENT) { + this.classpath(project.minecraftTasks.lwjgl3Configuration) + } + // Use a raw provider instead of map to not create a dependency on the task + this.classpath(project.provider(() -> project.tasks.named(superTask, RunMinecraftTask).get().classpath)) + this.classpath.filter { file -> + !file.path.contains("2.9.4-nightly-20150209") // Remove lwjgl2 + } + this.classpath(project.java17DependenciesCfg) + + if (!(project.usesMixins.toBoolean() || project.forceEnableMixins.toBoolean())) { + this.extraArgs.addAll("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker") + } } } +def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Side.CLIENT, "runClient") +runClient17Task.configure { + setup(project) + group = "Modded Minecraft" + description = "Runs the modded client using Java 17, lwjgl3ify and Hodgepodge" + dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar') + mainClass = "GradleStart" +} + +def runServer17Task = tasks.register("runServer17", RunHotswappableMinecraftTask, Side.SERVER, "runServer") +runServer17Task.configure { + setup(project) + group = "Modded Minecraft" + description = "Runs the modded server using Java 17, lwjgl3ify and Hodgepodge" + dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar') + mainClass = "GradleStartServer" + extraArgs.add("nogui") +} + def getManifestAttributes() { def manifestAttributes = [:] if (!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) { @@ -705,7 +863,7 @@ if (usesShadowedDependencies.toBoolean()) { javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) { skip() } - for (runTask in ["runClient", "runServer"]) { + for (runTask in ["runClient", "runServer", "runClient17", "runServer17"]) { tasks.named(runTask).configure { dependsOn("shadowJar") } @@ -743,6 +901,7 @@ idea { module { downloadJavadoc = true downloadSources = true + inheritOutputDirs = true } project { settings { @@ -753,6 +912,20 @@ idea { "2. Run Server"(Gradle) { taskNames = ["runServer"] } + "1a. Run Client (Java 17)"(Gradle) { + taskNames = ["runClient17"] + } + "2a. Run Server (Java 17)"(Gradle) { + taskNames = ["runServer17"] + } + "1b. Run Client (Java 17, Hotswap)"(Gradle) { + taskNames = ["runClient17"] + envs = ["HOTSWAP": "true"] + } + "2b. Run Server (Java 17, Hotswap)"(Gradle) { + taskNames = ["runServer17"] + envs = ["HOTSWAP": "true"] + } "3. Run Obfuscated Client"(Gradle) { taskNames = ["runObfClient"] } diff --git a/dependencies.gradle b/dependencies.gradle index 8278321642..fc05938d87 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,10 +1,7 @@ // Add your dependencies here dependencies { - compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.41.254:dev') - compile('com.github.GTNewHorizons:NotEnoughItems:2.2.19-GTNH:dev') - - compile('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev') + api('com.github.GTNewHorizons:GT5-Unofficial:5.09.41.280:dev') compileOnly('com.opencsv:opencsv:4.0') } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index feed3d0794..996bef161a 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -12,6 +12,7 @@ import net.minecraft.item.ItemStack; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; +import gregtech.api.objects.ItemData; import gregtech.api.util.GT_OreDictUnificator; import gregtech.common.GT_Worldgen_GT_Ore_Layer; @@ -86,10 +87,10 @@ public class GT5OreLayerHelper { public short randomWeight, size, density; public List Weight = new ArrayList<>(); - public Materials mPrimaryVeinMaterial; - public Materials mSecondaryMaterial; - public Materials mBetweenMaterial; - public Materials mSporadicMaterial; + public final Materials mPrimaryVeinMaterial; + public final Materials mSecondaryMaterial; + public final Materials mBetweenMaterial; + public final Materials mSporadicMaterial; public OreLayerWrapper(GT_Worldgen_GT_Ore_Layer worldGen) { this.veinName = worldGen.mWorldGenName; @@ -99,16 +100,18 @@ public class GT5OreLayerHelper { this.Meta[3] = worldGen.mSporadicMeta; // Black magic, don't ask me how it works, I have no idea. - try { - this.mPrimaryVeinMaterial = GT_OreDictUnificator.getAssociation( - new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mPrimaryMeta)).mMaterial.mMaterial; - this.mSecondaryMaterial = GT_OreDictUnificator.getAssociation( - new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSecondaryMeta)).mMaterial.mMaterial; - this.mBetweenMaterial = GT_OreDictUnificator.getAssociation( - new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mBetweenMeta)).mMaterial.mMaterial; - this.mSporadicMaterial = GT_OreDictUnificator.getAssociation( - new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSporadicMeta)).mMaterial.mMaterial; - } catch (Exception ignored) {} + ItemData primaryVeinData = GT_OreDictUnificator + .getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mPrimaryMeta)); + this.mPrimaryVeinMaterial = primaryVeinData != null ? primaryVeinData.mMaterial.mMaterial : null; + ItemData secondaryVeinData = GT_OreDictUnificator + .getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSecondaryMeta)); + this.mSecondaryMaterial = secondaryVeinData != null ? secondaryVeinData.mMaterial.mMaterial : null; + ItemData betweenVeinData = GT_OreDictUnificator + .getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mBetweenMeta)); + this.mBetweenMaterial = betweenVeinData != null ? betweenVeinData.mMaterial.mMaterial : null; + ItemData sporadicVeinData = GT_OreDictUnificator + .getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mSporadicMeta)); + this.mSporadicMaterial = sporadicVeinData != null ? sporadicVeinData.mMaterial.mMaterial : null; this.size = worldGen.mSize; this.density = worldGen.mDensity; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java index 56143c8068..99308c42ce 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java @@ -12,6 +12,7 @@ import net.minecraft.item.ItemStack; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; +import gregtech.api.objects.ItemData; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.world.GT_Worldgen; import gregtech.common.GT_Worldgen_GT_Ore_SmallPieces; @@ -179,19 +180,16 @@ public class GT5OreSmallHelper { return oreMaterial; } - private Materials oreMaterial = null; + private final Materials oreMaterial; public OreSmallWrapper(GT_Worldgen_GT_Ore_SmallPieces worldGen) { this.oreGenName = worldGen.mWorldGenName; this.oreMeta = worldGen.mMeta; this.worldGenHeightRange = worldGen.mMinY + "-" + worldGen.mMaxY; this.amountPerChunk = worldGen.mAmount; - try { - this.oreMaterial = GT_OreDictUnificator - .getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mMeta)).mMaterial.mMaterial; - } catch (Exception e) { - e.printStackTrace(); - } + ItemData oreData = GT_OreDictUnificator + .getAssociation(new ItemStack(GregTech_API.sBlockOres1, 1, worldGen.mMeta)); + this.oreMaterial = oreData != null ? oreData.mMaterial.mMaterial : null; } public List getMaterialDrops(int maximumIndex) { -- cgit From 427df618fe8bfd3e5d69694494688c6f3b3c1c4d Mon Sep 17 00:00:00 2001 From: Maxim Date: Thu, 16 Feb 2023 22:18:44 +0100 Subject: Move helper methods out of client side (#32) * Moved GT5OreLayerHelper to both sides * Moved ore and fluid helper out of the client side --- src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index 7f88441ebc..9561a05784 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -85,10 +85,10 @@ public class GTNEIOrePlugin { @EventHandler public void onLoadComplete(FMLLoadCompleteEvent event) { + new GT5OreLayerHelper(); + new GT5OreSmallHelper(); + new GT5UndergroundFluidHelper(); if (event.getSide() == Side.CLIENT) { - new GT5OreLayerHelper(); - new GT5OreSmallHelper(); - new GT5UndergroundFluidHelper(); new GuiRecipeHelper(); if (csv) { new pers.gwyog.gtneioreplugin.util.CSVMaker().run(); -- cgit From dcff2acba4dfbba17352db5ef8a4f1b752b18a2f Mon Sep 17 00:00:00 2001 From: miozune Date: Sun, 12 Mar 2023 10:49:55 +0900 Subject: Fix server crash with I18n (#33) --- build.gradle | 151 +++++++++++++++++---- dependencies.gradle | 2 +- gradle/wrapper/gradle-wrapper.jar | Bin 61608 -> 61574 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- .../gwyog/gtneioreplugin/util/DimensionHelper.java | 4 +- 5 files changed, 129 insertions(+), 30 deletions(-) diff --git a/build.gradle b/build.gradle index b808930520..927ed20fdb 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1676031737 +//version: 1678003329 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -20,6 +20,7 @@ import cpw.mods.fml.relauncher.Side import org.gradle.api.tasks.options.Option; import org.gradle.internal.logging.text.StyledTextOutput.Style import org.gradle.internal.logging.text.StyledTextOutputFactory +import org.gradle.internal.xml.XmlTransformer import org.jetbrains.gradle.ext.* import java.nio.file.Files @@ -31,7 +32,6 @@ import javax.inject.Inject buildscript { repositories { - mavenLocal() mavenCentral() maven { @@ -52,6 +52,8 @@ buildscript { name 'Scala CI dependencies' url 'https://repo1.maven.org/maven2/' } + + mavenLocal() } } plugins { @@ -71,7 +73,7 @@ plugins { id 'com.diffplug.spotless' version '6.7.2' apply false id 'com.modrinth.minotaur' version '2.+' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false - id 'com.gtnewhorizons.retrofuturagradle' version '1.1.6' + id 'com.gtnewhorizons.retrofuturagradle' version '1.2.3' } boolean settingsupdated = verifySettingsGradle() settingsupdated = verifyGitAttributes() || settingsupdated @@ -127,6 +129,9 @@ propertyDefaultIfUnset("gradleTokenGroupName", "") propertyDefaultIfUnset("enableModernJavaSyntax", false) // On by default for new projects only propertyDefaultIfUnset("enableGenericInjection", false) // On by default for new projects only +// this is meant to be set using the user wide property file. by default we do nothing. +propertyDefaultIfUnset("ideaOverrideBuildType", "") // Can be nothing, "gradle" or "idea" + project.extensions.add(Blowdryer, "Blowdryer", Blowdryer) // Make blowdryer available in "apply from:" scripts if (!disableSpotless) { apply plugin: 'com.diffplug.spotless' @@ -148,7 +153,7 @@ java { } else { languageVersion.set(projectJavaVersion) } - vendor.set(JvmVendorSpec.ADOPTIUM) + vendor.set(JvmVendorSpec.AZUL) } if (!noPublishedSources) { withSourcesJar() @@ -217,7 +222,7 @@ if (enableModernJavaSyntax.toBoolean()) { javaCompiler.set(javaToolchains.compilerFor { languageVersion.set(JavaLanguageVersion.of(17)) - vendor.set(JvmVendorSpec.ADOPTIUM) + vendor.set(JvmVendorSpec.AZUL) }) } } @@ -249,12 +254,14 @@ if (apiPackage) { } if (accessTransformersFile) { - String targetFile = "src/main/resources/META-INF/" + accessTransformersFile - if (!getFile(targetFile).exists()) { - throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) + for (atFile in accessTransformersFile.split(",")) { + String targetFile = "src/main/resources/META-INF/" + atFile.trim() + if (!getFile(targetFile).exists()) { + throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) + } + tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(targetFile) + tasks.srgifyBinpatchedJar.accessTransformerFiles.from(targetFile) } - tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(targetFile) - tasks.srgifyBinpatchedJar.accessTransformerFiles.from(targetFile) } else { boolean atsFound = false for (File at : sourceSets.getByName("main").resources.files) { @@ -382,6 +389,10 @@ minecraft { injectMissingGenerics.set(true) } + username = developmentEnvironmentUserName.toString() + + lwjgl3Version = "3.3.2-SNAPSHOT" + // Enable assertions in the current mod extraRunJvmArguments.add("-ea:${modGroup}") @@ -455,8 +466,9 @@ repositories.configureEach { repo -> apply from: 'repositories.gradle' configurations { + runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable) + testRuntimeClasspath.extendsFrom(runtimeOnlyNonPublishable) for (config in [compileClasspath, runtimeClasspath, testCompileClasspath, testRuntimeClasspath]) { - config.extendsFrom(runtimeOnlyNonPublishable) if (usesShadowedDependencies.toBoolean()) { config.extendsFrom(shadowImplementation) // TODO: remove Compile after all uses are refactored to Implementation @@ -509,6 +521,13 @@ repositories { } } } + maven { + name 'sonatype' + url 'https://oss.sonatype.org/content/repositories/snapshots/' + content { + includeGroup "org.lwjgl" + } + } if (includeWellKnownRepositories.toBoolean()) { maven { name "CurseMaven" @@ -545,20 +564,20 @@ dependencies { annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3') annotationProcessor('com.google.guava:guava:24.1.1-jre') annotationProcessor('com.google.code.gson:gson:2.8.6') - annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.12:processor') + annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.13:processor') if (usesMixinDebug.toBoolean()) { runtimeOnlyNonPublishable('org.jetbrains:intellij-fernflower:1.2.1.16') } } if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { - implementation('com.gtnewhorizon:gtnhmixins:2.1.12') + implementation('com.gtnewhorizon:gtnhmixins:2.1.13') } } pluginManager.withPlugin('org.jetbrains.kotlin.kapt') { if (usesMixins.toBoolean()) { dependencies { - kapt('com.gtnewhorizon:gtnhmixins:2.1.12:processor') + kapt('com.gtnewhorizon:gtnhmixins:2.1.13:processor') } } } @@ -667,17 +686,22 @@ ext.java17Toolchain = (JavaToolchainSpec spec) -> { spec.vendor.set(JvmVendorSpec.matching("jetbrains")) } -ext.java17DependenciesCfg = configurations.create("java17Dependencies") -ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies") +ext.java17DependenciesCfg = configurations.create("java17Dependencies") { + extendsFrom(configurations.getByName("runtimeClasspath")) // Ensure consistent transitive dependency resolution + canBeConsumed = false +} +ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies") { + canBeConsumed = false +} dependencies { - def lwjgl3ifyVersion = '1.1.21' + def lwjgl3ifyVersion = '1.1.35' def asmVersion = '9.4' if (modId != 'lwjgl3ify') { java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") } if (modId != 'hodgepodge') { - java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.0.31') + java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.0.40') } java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false} @@ -688,14 +712,14 @@ dependencies { java17PatchDependencies("org.ow2.asm:asm-util:${asmVersion}") java17PatchDependencies('org.ow2.asm:asm-deprecated:7.1') java17PatchDependencies("org.apache.commons:commons-lang3:3.12.0") - java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") + java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false} } ext.java17JvmArgs = [ // Java 9+ support "--illegal-access=warn", - "-Dfile.encoding=UTF-8", "-Djava.security.manager=allow", + "-Dfile.encoding=UTF-8", "--add-opens", "java.base/jdk.internal.loader=ALL-UNNAMED", "--add-opens", "java.base/java.net=ALL-UNNAMED", "--add-opens", "java.base/java.nio=ALL-UNNAMED", @@ -706,6 +730,7 @@ ext.java17JvmArgs = [ "--add-opens", "java.base/java.util=ALL-UNNAMED", "--add-opens", "java.base/jdk.internal.reflect=ALL-UNNAMED", "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", + "--add-opens", "jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED,java.naming", "--add-opens", "java.desktop/sun.awt.image=ALL-UNNAMED", "--add-modules", "jdk.dynalink", "--add-opens", "jdk.dynalink/jdk.dynalink.beans=ALL-UNNAMED", @@ -750,8 +775,8 @@ public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask { public boolean setEnableHotswap(boolean enable) { enableHotswap = enable } @Inject - public RunHotswappableMinecraftTask(Side side, String superTask) { - super(side) + public RunHotswappableMinecraftTask(Side side, String superTask, org.gradle.api.invocation.Gradle gradle) { + super(side, gradle) this.lwjglVersion = 3 this.javaLauncher = project.javaToolchains.launcherFor(project.java17Toolchain) @@ -782,6 +807,8 @@ runClient17Task.configure { description = "Runs the modded client using Java 17, lwjgl3ify and Hodgepodge" dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar') mainClass = "GradleStart" + username = minecraft.username + userUUID = minecraft.userUUID } def runServer17Task = tasks.register("runServer17", RunHotswappableMinecraftTask, Side.SERVER, "runServer") @@ -828,7 +855,7 @@ if (usesShadowedDependencies.toBoolean()) { tasks.register('relocateShadowJar', ConfigureShadowRelocation) { target = tasks.shadowJar prefix = modGroup + ".shadow" - enabled = minimizeShadowedDependencies.toBoolean() + enabled = relocateShadowedDependencies.toBoolean() } tasks.named("shadowJar", ShadowJar).configure { manifest { @@ -844,7 +871,7 @@ if (usesShadowedDependencies.toBoolean()) { project.configurations.shadeCompile ] archiveClassifier.set('dev') - if (minimizeShadowedDependencies.toBoolean()) { + if (relocateShadowedDependencies.toBoolean()) { dependsOn(relocateShadowJar) } } @@ -905,6 +932,19 @@ idea { } project { settings { + if (ideaOverrideBuildType != "") { + delegateActions { + if ("gradle".equalsIgnoreCase(ideaOverrideBuildType)) { + delegateBuildRunToGradle = true + testRunner = org.jetbrains.gradle.ext.ActionDelegationConfig.TestRunner.GRADLE + } else if ("idea".equalsIgnoreCase(ideaOverrideBuildType)) { + delegateBuildRunToGradle = false + testRunner = org.jetbrains.gradle.ext.ActionDelegationConfig.TestRunner.PLATFORM + } else { + throw GradleScriptException('Accepted value for ideaOverrideBuildType is one of gradle or idea.') + } + } + } runConfigurations { "1. Run Client"(Gradle) { taskNames = ["runClient"] @@ -943,7 +983,7 @@ idea { } "Run Client (IJ Native)"(Application) { mainClass = "GradleStart" - moduleName = project.name + ".main" + moduleName = project.name + ".ideVirtualMain" afterEvaluate { workingDirectory = tasks.runClient.workingDir.absolutePath programParameters = tasks.runClient.calculateArgs(project).collect { '"' + it + '"' }.join(' ') @@ -954,7 +994,7 @@ idea { } "Run Server (IJ Native)"(Application) { mainClass = "GradleStartServer" - moduleName = project.name + ".main" + moduleName = project.name + ".ideVirtualMain" afterEvaluate { workingDirectory = tasks.runServer.workingDir.absolutePath programParameters = tasks.runServer.calculateArgs(project).collect { '"' + it + '"' }.join(' ') @@ -971,6 +1011,51 @@ idea { ] } } + withIDEADir { File ideaDir -> + if (!ideaDir.path.contains(".idea")) { + // If an .ipr file exists, the project root directory is passed here instead of the .idea subdirectory + ideaDir = new File(ideaDir, ".idea") + } + if (ideaDir.isDirectory()) { + def miscFile = new File(ideaDir, "misc.xml") + if (miscFile.isFile()) { + boolean dirty = false + def miscTransformer = new XmlTransformer() + miscTransformer.addAction { root -> + Node rootNode = root.asNode() + def rootManager = rootNode + .component.find { it.@name == 'ProjectRootManager' } + if (!rootManager) { + rootManager = rootNode.appendNode('component', ['name': 'ProjectRootManager', 'version': '2']) + dirty = true + } + def output = rootManager.output + if (!output) { + output = rootManager.appendNode('output') + dirty = true + } + if (!output.@url) { + // Only modify the output url if it doesn't yet have one, or if the existing one is blank somehow. + // This is a sensible default for most setups + output.@url = 'file://$PROJECT_DIR$/build/ideaBuild' + dirty = true + } + } + def result = miscTransformer.transform(miscFile.text) + if (dirty) { + miscFile.write(result) + } + } else { + miscFile.text = """ + + + + + +""" + } + } + } } } } @@ -1118,10 +1203,21 @@ def addCurseForgeRelation(String type, String name) { } // Updating + +def buildscriptGradleVersion = "8.0.1" + +tasks.named('wrapper', Wrapper).configure { + gradleVersion = buildscriptGradleVersion +} + tasks.register('updateBuildScript') { group = 'GTNH Buildscript' description = 'Updates the build script to the latest version' + if (gradle.gradleVersion != buildscriptGradleVersion && !Boolean.getBoolean('DISABLE_BUILDSCRIPT_GRADLE_UPDATE')) { + dependsOn('wrapper') + } + doLast { if (performBuildScriptUpdate()) return @@ -1134,6 +1230,9 @@ if (!project.getGradle().startParameter.isOffline() && !Boolean.getBoolean('DISA performBuildScriptUpdate() } else { out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'") + if (gradle.gradleVersion != buildscriptGradleVersion) { + out.style(Style.SuccessHeader).println("updateBuildScript can update gradle from ${gradle.gradleVersion} to ${buildscriptGradleVersion}\n") + } } } diff --git a/dependencies.gradle b/dependencies.gradle index fc05938d87..e262dcf8d3 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,7 +1,7 @@ // Add your dependencies here dependencies { - api('com.github.GTNewHorizons:GT5-Unofficial:5.09.41.280:dev') + api('com.github.GTNewHorizons:GT5-Unofficial:5.09.42.00:dev') compileOnly('com.opencsv:opencsv:4.0') } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index ccebba7710..943f0cbfa7 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f398c33c4b..fc10b601f7 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java index 704ccc49c2..be95356118 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -7,7 +7,7 @@ import java.util.HashMap; import java.util.List; import java.util.stream.Collectors; -import net.minecraft.client.resources.I18n; +import net.minecraft.util.StatCollector; public class DimensionHelper { @@ -99,7 +99,7 @@ public class DimensionHelper { for (int i = 0; i < DimNameDisplayed.length; i++) { if (s.equals(DimNameDisplayed[i])) { String k = DimNameTrimmed[i]; - s = I18n.format("gtnop.world." + k); + s = StatCollector.translateToLocal("gtnop.world." + k); switch (k) { case "Moon": s = "T1: " + s; -- cgit From 749ee1a1860b65ef516d97224aad964b68bfbe09 Mon Sep 17 00:00:00 2001 From: glowredman <35727266+glowredman@users.noreply.github.com> Date: Thu, 25 May 2023 18:12:29 +0200 Subject: Cleanup (#34) * Update buildscript and GT5U dependency * Cleanup * Apply spotless --- build.gradle | 226 +++++++++------------ dependencies.gradle | 2 +- gradle.properties | 111 ++++++++-- repositories.gradle | 21 +- .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 21 +- .../gwyog/gtneioreplugin/plugin/IMCForNEI.java | 2 +- .../gtneioreplugin/plugin/NEIPluginConfig.java | 4 +- .../gtneioreplugin/plugin/block/ModBlocks.java | 2 +- .../plugin/gregtech5/PluginGT5Base.java | 6 +- .../plugin/gregtech5/PluginGT5SmallOreStat.java | 6 +- .../gregtech5/PluginGT5UndergroundFluid.java | 6 +- .../plugin/gregtech5/PluginGT5VeinStat.java | 4 +- .../plugin/item/ItemDimensionDisplay.java | 4 +- .../pers/gwyog/gtneioreplugin/util/CSVMaker.java | 38 ++-- .../gwyog/gtneioreplugin/util/GT5CFGHelper.java | 2 +- .../gtneioreplugin/util/GT5OreSmallHelper.java | 7 +- .../util/GT5UndergroundFluidHelper.java | 2 +- .../gwyog/gtneioreplugin/util/GuiRecipeHelper.java | 7 +- 18 files changed, 255 insertions(+), 216 deletions(-) diff --git a/build.gradle b/build.gradle index 927ed20fdb..a8b7532dea 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1678003329 +//version: 1684218858 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -6,29 +6,25 @@ */ -import com.diffplug.blowdryer.Blowdryer -import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import com.gtnewhorizons.retrofuturagradle.ObfuscationAttribute import com.gtnewhorizons.retrofuturagradle.mcp.ReobfuscatedJar import com.gtnewhorizons.retrofuturagradle.minecraft.RunMinecraftTask +import com.gtnewhorizons.retrofuturagradle.util.Distribution import com.matthewprenger.cursegradle.CurseArtifact import com.matthewprenger.cursegradle.CurseRelation import com.modrinth.minotaur.dependencies.ModDependency import com.modrinth.minotaur.dependencies.VersionDependency -import cpw.mods.fml.relauncher.Side -import org.gradle.api.tasks.options.Option; import org.gradle.internal.logging.text.StyledTextOutput.Style import org.gradle.internal.logging.text.StyledTextOutputFactory import org.gradle.internal.xml.XmlTransformer -import org.jetbrains.gradle.ext.* +import org.jetbrains.gradle.ext.Application +import org.jetbrains.gradle.ext.Gradle +import javax.inject.Inject import java.nio.file.Files import java.nio.file.Paths import java.util.concurrent.TimeUnit -import java.util.zip.ZipEntry -import java.util.zip.ZipOutputStream -import javax.inject.Inject buildscript { repositories { @@ -65,22 +61,26 @@ plugins { id 'org.jetbrains.kotlin.jvm' version '1.8.0' apply false id 'org.jetbrains.kotlin.kapt' version '1.8.0' apply false id 'com.google.devtools.ksp' version '1.8.0-1.0.9' apply false - id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version ,unused, available for addon.gradle - id 'com.github.johnrengelman.shadow' version '7.1.2' apply false - id 'com.palantir.git-version' version '0.13.0' apply false // 0.13.0 is the last jvm8 supporting version - id 'de.undercouch.download' version '5.3.0' + id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version, unused, available for addon.gradle + id 'com.github.johnrengelman.shadow' version '8.1.1' apply false + id 'com.palantir.git-version' version '3.0.0' apply false + id 'de.undercouch.download' version '5.4.0' id 'com.github.gmazzo.buildconfig' version '3.1.0' apply false // Unused, available for addon.gradle - id 'com.diffplug.spotless' version '6.7.2' apply false + id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version id 'com.modrinth.minotaur' version '2.+' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false - id 'com.gtnewhorizons.retrofuturagradle' version '1.2.3' + id 'com.gtnewhorizons.retrofuturagradle' version '1.3.14' } + +print("You might want to check out './gradlew :faq' if your build fails.\n") + boolean settingsupdated = verifySettingsGradle() settingsupdated = verifyGitAttributes() || settingsupdated if (settingsupdated) throw new GradleException("Settings has been updated, please re-run task.") -if (project.file('.git/HEAD').isFile()) { +// In submodules, .git is a file pointing to the real git dir +if (project.file('.git/HEAD').isFile() || project.file('.git').isFile()) { apply plugin: 'com.palantir.git-version' } @@ -132,7 +132,7 @@ propertyDefaultIfUnset("enableGenericInjection", false) // On by default for new // this is meant to be set using the user wide property file. by default we do nothing. propertyDefaultIfUnset("ideaOverrideBuildType", "") // Can be nothing, "gradle" or "idea" -project.extensions.add(Blowdryer, "Blowdryer", Blowdryer) // Make blowdryer available in "apply from:" scripts +project.extensions.add(com.diffplug.blowdryer.Blowdryer, "Blowdryer", com.diffplug.blowdryer.Blowdryer) // Make blowdryer available in "apply from:" scripts if (!disableSpotless) { apply plugin: 'com.diffplug.spotless' apply from: Blowdryer.file('spotless.gradle') @@ -160,6 +160,14 @@ java { } } +tasks.withType(JavaCompile).configureEach { + options.encoding = "UTF-8" +} + +tasks.withType(ScalaCompile).configureEach { + options.encoding = "UTF-8" +} + pluginManager.withPlugin('org.jetbrains.kotlin.jvm') { // If Kotlin is enabled in the project kotlin { @@ -193,6 +201,14 @@ configurations { canBeConsumed = false canBeResolved = false } + + create("devOnlyNonPublishable") { + description = "Runtime and compiletime dependencies that are not published alongside the jar (compileOnly + runtimeOnlyNonPublishable)" + canBeConsumed = false + canBeResolved = false + } + compileOnly.extendsFrom(devOnlyNonPublishable) + runtimeOnlyNonPublishable.extendsFrom(devOnlyNonPublishable) } if (enableModernJavaSyntax.toBoolean()) { @@ -206,6 +222,8 @@ if (enableModernJavaSyntax.toBoolean()) { dependencies { annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0' + // workaround for https://github.com/bsideup/jabel/issues/174 + annotationProcessor 'net.java.dev.jna:jna-platform:5.13.0' compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') { transitive = false // We only care about the 1 annotation class } @@ -391,14 +409,12 @@ minecraft { username = developmentEnvironmentUserName.toString() - lwjgl3Version = "3.3.2-SNAPSHOT" + lwjgl3Version = "3.3.2" // Enable assertions in the current mod extraRunJvmArguments.add("-ea:${modGroup}") if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { - extraTweakClasses.add("org.spongepowered.asm.launch.MixinTweaker") - if (usesMixinDebug.toBoolean()) { extraRunJvmArguments.addAll([ "-Dmixin.debug.countInjections=true", @@ -513,14 +529,6 @@ repositories { url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" allowInsecureProtocol = true } - if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { - if (usesMixinDebug.toBoolean()) { - maven { - name = "Fabric Maven" - url = "https://maven.fabricmc.net/" - } - } - } maven { name 'sonatype' url 'https://oss.sonatype.org/content/repositories/snapshots/' @@ -559,29 +567,50 @@ repositories { } } +def mixinProviderGroup = "io.github.legacymoddingmc" +def mixinProviderModule = "unimixins" +def mixinProviderVersion = "0.1.7.1" +def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}" +def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev" +ext.mixinProviderSpec = mixinProviderSpec + dependencies { if (usesMixins.toBoolean()) { annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3') annotationProcessor('com.google.guava:guava:24.1.1-jre') annotationProcessor('com.google.code.gson:gson:2.8.6') - annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.13:processor') + annotationProcessor(mixinProviderSpec) if (usesMixinDebug.toBoolean()) { runtimeOnlyNonPublishable('org.jetbrains:intellij-fernflower:1.2.1.16') } } - if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { - implementation('com.gtnewhorizon:gtnhmixins:2.1.13') + if (usesMixins.toBoolean()) { + implementation(mixinProviderSpec) + } else if (forceEnableMixins.toBoolean()) { + runtimeOnlyNonPublishable(mixinProviderSpec) } } pluginManager.withPlugin('org.jetbrains.kotlin.kapt') { if (usesMixins.toBoolean()) { dependencies { - kapt('com.gtnewhorizon:gtnhmixins:2.1.13:processor') + kapt(mixinProviderSpec) } } } +// Replace old mixin mods with unimixins +// https://docs.gradle.org/8.0.2/userguide/resolution_rules.html#sec:substitution_with_classifier +configurations.all { + resolutionStrategy.dependencySubstitution { + substitute module('com.gtnewhorizon:gtnhmixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods") + substitute module('com.github.GTNewHorizons:Mixingasm') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods") + substitute module('com.github.GTNewHorizons:SpongePoweredMixin') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods") + substitute module('com.github.GTNewHorizons:SpongeMixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods") + substitute module('io.github.legacymoddingmc:unimixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Our previous unimixins upload was missing the dev classifier") + } +} + apply from: 'dependencies.gradle' def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' @@ -695,13 +724,13 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies" } dependencies { - def lwjgl3ifyVersion = '1.1.35' + def lwjgl3ifyVersion = '1.3.5' def asmVersion = '9.4' if (modId != 'lwjgl3ify') { java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") } if (modId != 'hodgepodge') { - java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.0.40') + java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.13') } java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false} @@ -775,7 +804,7 @@ public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask { public boolean setEnableHotswap(boolean enable) { enableHotswap = enable } @Inject - public RunHotswappableMinecraftTask(Side side, String superTask, org.gradle.api.invocation.Gradle gradle) { + public RunHotswappableMinecraftTask(Distribution side, String superTask, org.gradle.api.invocation.Gradle gradle) { super(side, gradle) this.lwjglVersion = 3 @@ -784,7 +813,7 @@ public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask { this.extraJvmArgs.addAll(project.provider(() -> enableHotswap ? project.hotswapJvmArgs : [])) this.classpath(project.java17PatchDependenciesCfg) - if (side == Side.CLIENT) { + if (side == Distribution.CLIENT) { this.classpath(project.minecraftTasks.lwjgl3Configuration) } // Use a raw provider instead of map to not create a dependency on the task @@ -793,14 +822,22 @@ public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask { !file.path.contains("2.9.4-nightly-20150209") // Remove lwjgl2 } this.classpath(project.java17DependenciesCfg) + } - if (!(project.usesMixins.toBoolean() || project.forceEnableMixins.toBoolean())) { - this.extraArgs.addAll("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker") + public void setup(Project project) { + super.setup(project) + if (project.usesMixins.toBoolean()) { + this.extraJvmArgs.addAll(project.provider(() -> { + def mixinCfg = project.configurations.detachedConfiguration(project.dependencies.create(project.mixinProviderSpec)) + mixinCfg.canBeConsumed = false + mixinCfg.transitive = false + enableHotswap ? ["-javaagent:" + mixinCfg.singleFile.absolutePath] : [] + })) } } } -def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Side.CLIENT, "runClient") +def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Distribution.CLIENT, "runClient") runClient17Task.configure { setup(project) group = "Modded Minecraft" @@ -811,7 +848,7 @@ runClient17Task.configure { userUUID = minecraft.userUUID } -def runServer17Task = tasks.register("runServer17", RunHotswappableMinecraftTask, Side.SERVER, "runServer") +def runServer17Task = tasks.register("runServer17", RunHotswappableMinecraftTask, Distribution.DEDICATED_SERVER, "runServer") runServer17Task.configure { setup(project) group = "Modded Minecraft" @@ -852,11 +889,6 @@ tasks.named("jar", Jar).configure { } if (usesShadowedDependencies.toBoolean()) { - tasks.register('relocateShadowJar', ConfigureShadowRelocation) { - target = tasks.shadowJar - prefix = modGroup + ".shadow" - enabled = relocateShadowedDependencies.toBoolean() - } tasks.named("shadowJar", ShadowJar).configure { manifest { attributes(getManifestAttributes()) @@ -872,7 +904,8 @@ if (usesShadowedDependencies.toBoolean()) { ] archiveClassifier.set('dev') if (relocateShadowedDependencies.toBoolean()) { - dependsOn(relocateShadowJar) + relocationPrefix = modGroup + ".shadow" + enableRelocation = true } } configurations.runtimeElements.outgoing.artifacts.clear() @@ -1006,6 +1039,7 @@ idea { } compiler.javac { afterEvaluate { + javacAdditionalOptions = "-encoding utf8" moduleJavacAdditionalOptions = [ (project.name + ".main"): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ') ] @@ -1125,7 +1159,7 @@ if (modrinthProjectId.size() != 0 && System.getenv("MODRINTH_TOKEN") != null) { } } if (usesMixins.toBoolean()) { - addModrinthDep("required", "project", "gtnhmixins") + addModrinthDep("required", "project", "unimixins") } tasks.modrinth.dependsOn(build) tasks.publish.dependsOn(tasks.modrinth) @@ -1169,7 +1203,7 @@ if (curseForgeProjectId.size() != 0 && System.getenv("CURSEFORGE_TOKEN") != null } } if (usesMixins.toBoolean()) { - addCurseForgeRelation("requiredDependency", "gtnhmixins") + addCurseForgeRelation("requiredDependency", "unimixins") } tasks.curseforge.dependsOn(build) tasks.publish.dependsOn(tasks.curseforge) @@ -1204,7 +1238,7 @@ def addCurseForgeRelation(String type, String name) { // Updating -def buildscriptGradleVersion = "8.0.1" +def buildscriptGradleVersion = "8.1.1" tasks.named('wrapper', Wrapper).configure { gradleVersion = buildscriptGradleVersion @@ -1236,6 +1270,21 @@ if (!project.getGradle().startParameter.isOffline() && !Boolean.getBoolean('DISA } } +// If you want to add more cases to this task, implement them as arguments if total amount to print gets too large +tasks.register('faq') { + group = 'GTNH Buildscript' + description = 'Prints frequently asked questions about building a project' + + doLast { + print("If your build fails to fetch dependencies, they might have been deleted and replaced by newer " + + "versions.\nCheck if the versions you try to fetch are still on the distributing sites.\n" + + "The links can be found in repositories.gradle and build.gradle:repositories, " + + "not build.gradle:buildscript.repositories - this one is for gradle plugin metadata.\n\n" + + "If your build fails to recognize the syntax of new Java versions, enable Jabel in your " + + "gradle.properties. See how it's done in GTNH ExampleMod/gradle.properties.") + } +} + static URL availableBuildScriptUrl() { new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/build.gradle") } @@ -1373,7 +1422,7 @@ static int replaceParams(File file, Map params) { return 0 } -// Dependency Deobfuscation +// Dependency Deobfuscation (Deprecated, use the new RFG API documented in dependencies.gradle) def deobf(String sourceURL) { try { @@ -1415,11 +1464,7 @@ def deobfMaven(String repoURL, String mavenDep) { } def deobfCurse(String curseDep) { - try { - return deobfMaven("https://www.cursemaven.com/", "curse.maven:$curseDep") - } catch (Exception ignored) { - out.style(Style.Failure).println("Failed to get $curseDep from cursemaven.") - } + return dependencies.rfg.deobf("curse.maven:$curseDep") } // The method above is to be preferred. Use this method if the filename is not at the end of the URL. @@ -1427,34 +1472,7 @@ def deobf(String sourceURL, String rawFileName) { String bon2Version = "2.5.1" String fileName = URLDecoder.decode(rawFileName, "UTF-8") String cacheDir = "$project.gradle.gradleUserHomeDir/caches" - String bon2Dir = "$cacheDir/forge_gradle/deobf" - String bon2File = "$bon2Dir/BON2-${bon2Version}.jar" String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar" - String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar" - - if (file(deobfFile).exists()) { - return files(deobfFile) - } - - String mappingsVer - String remoteMappings = project.hasProperty('remoteMappings') ? project.remoteMappings : 'https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/' - if (remoteMappings) { - String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion" - String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip" - - zipMappings(mappingsZIP, remoteMappings, bon2Dir) - - mappingsVer = "snapshot_$id" - } else { - mappingsVer = "${channel}_$mappingsVersion" - } - - download.run { - src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar" - dest bon2File - quiet true - overwrite false - } download.run { src sourceURL @@ -1462,50 +1480,8 @@ def deobf(String sourceURL, String rawFileName) { quiet true overwrite false } - - exec { - commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch' - workingDir bon2Dir - standardOutput = new FileOutputStream("${deobfFile}.log") - } - - return files(deobfFile) + return dependencies.rfg.deobf(files(obfFile)) } - -def zipMappings(String zipPath, String url, String bon2Dir) { - File zipFile = new File(zipPath) - if (zipFile.exists()) { - return - } - - String fieldsCache = "$bon2Dir/data/fields.csv" - String methodsCache = "$bon2Dir/data/methods.csv" - - download.run { - src "${url}fields.csv" - dest fieldsCache - quiet true - } - download.run { - src "${url}methods.csv" - dest methodsCache - quiet true - } - - zipFile.getParentFile().mkdirs() - ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile)) - - zos.putNextEntry(new ZipEntry("fields.csv")) - Files.copy(Paths.get(fieldsCache), zos) - zos.closeEntry() - - zos.putNextEntry(new ZipEntry("methods.csv")) - Files.copy(Paths.get(methodsCache), zos) - zos.closeEntry() - - zos.close() -} - // Helper methods def checkPropertyExists(String propertyName) { diff --git a/dependencies.gradle b/dependencies.gradle index e262dcf8d3..22247326b6 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,7 +1,7 @@ // Add your dependencies here dependencies { - api('com.github.GTNewHorizons:GT5-Unofficial:5.09.42.00:dev') + api('com.github.GTNewHorizons:GT5-Unofficial:5.09.43.50:dev') compileOnly('com.opencsv:opencsv:4.0') } diff --git a/gradle.properties b/gradle.properties index dd5be647af..691386d44a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,50 +15,129 @@ autoUpdateBuildScript = false minecraftVersion = 1.7.10 forgeVersion = 10.13.4.1614 -# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you +# Specify a MCP channel and mappings version for dependency deobfuscation and the deobfParams task. +channel = stable +mappingsVersion = 12 + +# Define other MCP mappings for dependency deobfuscation +remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/ + +# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you # restart Minecraft in development. Choose this dependent on your mod: # Do you need consistent player progressing (for example Thaumcraft)? -> Select a name # Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty -developmentEnvironmentUserName = "Developer" +developmentEnvironmentUserName = Developer + +# Enables using modern java syntax (up to version 17) via Jabel, while still targeting JVM 8. +# See https://github.com/bsideup/jabel for details on how this works. +enableModernJavaSyntax = true -# Define a source file of your project with: +# Enables injecting missing generics into the decompiled source code for a better coding experience +# Turns most publicly visible List, Map, etc. into proper List, Map types +enableGenericInjection = false + +# Generate a class with String fields for the mod id, name, version and group name named with the fields below +generateGradleTokenClass = pers.gwyog.gtneioreplugin.Tags +gradleTokenModId = +gradleTokenModName = +gradleTokenVersion = VERSION +gradleTokenGroupName = +# [DEPRECATED] +# Multiple source files can be defined here by providing a comma-seperated list: Class1.java,Class2.java,Class3.java # public static final String VERSION = "GRADLETOKEN_VERSION"; -# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's +# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's # version in @Mod([...], version = VERSION, [...]) # Leave these properties empty to skip individual token replacements -replaceGradleTokenInFile = GTNEIOrePlugin.java -gradleTokenModId = GRADLETOKEN_MODID -gradleTokenModName = GRADLETOKEN_MODNAME -gradleTokenVersion = GRADLETOKEN_VERSION -gradleTokenGroupName = +replaceGradleTokenInFile = -# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can +# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can # leave this property empty. # Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api apiPackage = -# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/ -# Example value: mymodid_at.cfg +# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/ +# There can be multiple files in a comma-separated list. +# Example value: mymodid_at.cfg,nei_at.cfg accessTransformersFile = # Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! usesMixins = false -# Specify the location of your implementation of IMixinPlugin. Leave it empty otherwise. +# Adds some debug arguments like verbose output and export +usesMixinDebug = false +# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise. mixinPlugin = # Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail! mixinsPackage = # Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin! -# This parameter is for legacy compatability only +# This parameter is for legacy compatibility only # Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin coreModClass = # If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class # that is annotated with @Mod) you want this to be true. When in doubt: leave it on false! containsMixinsAndOrCoreModOnly = false -# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your +# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins. +forceEnableMixins = false + +# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your # responsibility check the licence and request permission for distribution, if required. usesShadowedDependencies = false +# If disabled, won't remove unused classes from shaded dependencies. Some libraries use reflection to access +# their own classes, making the minimization unreliable. +minimizeShadowedDependencies = true +# If disabled, won't rename the shadowed classes. +relocateShadowedDependencies = true + +# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories +includeWellKnownRepositories = true + +# Publishing to modrinth requires you to set the MODRINTH_TOKEN environment variable to your current modrinth API token. + +# The project's ID on Modrinth. Can be either the slug or the ID. +# Leave this empty if you don't want to publish on Modrinth. +modrinthProjectId = + +# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth. +# Syntax: scope1-type1:name1;scope2-type2:name2;... +# Where scope can be one of [required, optional, incompatible, embedded], +# type can be one of [project, version], +# and the name is the Modrinth project or version slug/id of the other mod. +# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech +# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true +modrinthRelations = + + +# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens. + +# The project's numeric ID on CurseForge. You can find this in the About Project box. +# Leave this empty if you don't want to publish on CurseForge. +curseForgeProjectId = + +# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge. +# Syntax: type1:name1;type2:name2;... +# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible], +# and the name is the CurseForge project slug of the other mod. +# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft +# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true +curseForgeRelations = + # Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older # projects. New projects should not use this parameter. -#customArchiveBaseName = +# customArchiveBaseName = + +# Optional parameter to prevent the source code from being published +# noPublishedSources = + +# Uncomment this to disable spotless checks +# This should only be uncommented to keep it easier to sync with upstream/other forks. +# That is, if there is no other active fork/upstream, NEVER change this. +# disableSpotless = true + +# Override the IDEA build type. Valid value is "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle" +# (force use delegated build). +# This is meant to be set in $HOME/.gradle/gradle.properties. +# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be always native build. +# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want! +# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you. +# ideaOverrideBuildType = idea diff --git a/repositories.gradle b/repositories.gradle index e850975183..06b13d6cce 100644 --- a/repositories.gradle +++ b/repositories.gradle @@ -1,22 +1,3 @@ // Add any additional repositiroes for your dependencies here -repositories { - maven { - name 'GTNH Maven' - url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/' - } - maven { - name 'ic2' - url 'http://maven.ic2.player.to/' - metadataSources { - mavenPom() - artifact() - } - } - maven { - url 'https://cursemaven.com' - content { - includeGroup 'curse.maven' - } - } -} +repositories {} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index 9561a05784..6b0505e1a4 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -6,12 +6,6 @@ import net.minecraft.item.Item; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import pers.gwyog.gtneioreplugin.plugin.IMCForNEI; -import pers.gwyog.gtneioreplugin.plugin.block.ModBlocks; -import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; -import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; -import pers.gwyog.gtneioreplugin.util.GT5UndergroundFluidHelper; -import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; @@ -19,6 +13,13 @@ import cpw.mods.fml.common.event.FMLLoadCompleteEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; +import pers.gwyog.gtneioreplugin.plugin.IMCForNEI; +import pers.gwyog.gtneioreplugin.plugin.block.ModBlocks; +import pers.gwyog.gtneioreplugin.util.CSVMaker; +import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; +import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; +import pers.gwyog.gtneioreplugin.util.GT5UndergroundFluidHelper; +import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper; @Mod( modid = GTNEIOrePlugin.MODID, @@ -27,9 +28,9 @@ import cpw.mods.fml.relauncher.Side; dependencies = "required-after:gregtech;required-after:NotEnoughItems") public class GTNEIOrePlugin { - public static final String MODID = "GRADLETOKEN_MODID"; - public static final String NAME = "GRADLETOKEN_MODNAME"; - public static final String VERSION = "GRADLETOKEN_VERSION"; + public static final String MODID = "gtneioreplugin"; + public static final String NAME = "GT NEI Ore Plugin GT:NH Mod"; + public static final String VERSION = Tags.VERSION; public static final Logger LOG = LogManager.getLogger(NAME); public static boolean csv = false; public static String CSVname; @@ -91,7 +92,7 @@ public class GTNEIOrePlugin { if (event.getSide() == Side.CLIENT) { new GuiRecipeHelper(); if (csv) { - new pers.gwyog.gtneioreplugin.util.CSVMaker().run(); + new CSVMaker().run(); } } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java index 961d29c2b3..ea60054576 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java @@ -2,8 +2,8 @@ package pers.gwyog.gtneioreplugin.plugin; import net.minecraft.nbt.NBTTagCompound; -import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; import cpw.mods.fml.common.event.FMLInterModComms; +import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; public class IMCForNEI { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java index 31405a2f7a..17193b07fe 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java @@ -1,11 +1,11 @@ package pers.gwyog.gtneioreplugin.plugin; +import codechicken.nei.api.API; +import codechicken.nei.api.IConfigureNEI; import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5SmallOreStat; import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5UndergroundFluid; import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat; -import codechicken.nei.api.API; -import codechicken.nei.api.IConfigureNEI; public class NEIPluginConfig implements IConfigureNEI { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/ModBlocks.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/ModBlocks.java index 419dbe8d00..db953c7112 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/ModBlocks.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/ModBlocks.java @@ -5,9 +5,9 @@ import java.util.Map; import net.minecraft.block.Block; +import cpw.mods.fml.common.registry.GameRegistry; import pers.gwyog.gtneioreplugin.plugin.item.ItemDimensionDisplay; import pers.gwyog.gtneioreplugin.util.DimensionHelper; -import cpw.mods.fml.common.registry.GameRegistry; public class ModBlocks { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java index f0a9433a70..d086175849 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java @@ -5,13 +5,13 @@ import java.awt.Rectangle; import net.minecraft.client.resources.I18n; -import pers.gwyog.gtneioreplugin.plugin.PluginBase; -import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper; import codechicken.lib.gui.GuiDraw; import codechicken.nei.recipe.GuiRecipe; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.util.GT_LanguageManager; +import pers.gwyog.gtneioreplugin.plugin.PluginBase; +import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper; public abstract class PluginGT5Base extends PluginBase { @@ -64,7 +64,7 @@ public abstract class PluginGT5Base extends PluginBase { * @param dimNames Dimension names to produce a rectangle for * @return Rectangle area of dimension names */ - protected Rectangle getDimensionNamesRect(GuiRecipe gui, int recipe, String dimNames) { + protected Rectangle getDimensionNamesRect(GuiRecipe gui, int recipe, String dimNames) { int dimNamesHeight = dimNames.length() > 70 ? 30 : (dimNames.length() > 36 ? 20 : 10); Point offset = gui.getRecipePosition(recipe); return new Rectangle( diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java index 08c3d11411..512f966629 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java @@ -8,13 +8,13 @@ import java.util.List; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; +import codechicken.nei.PositionedStack; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_OreDictUnificator; import pers.gwyog.gtneioreplugin.plugin.item.ItemDimensionDisplay; import pers.gwyog.gtneioreplugin.util.DimensionHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper.OreSmallWrapper; -import codechicken.nei.PositionedStack; -import gregtech.api.enums.OrePrefixes; -import gregtech.api.util.GT_OreDictUnificator; public class PluginGT5SmallOreStat extends PluginGT5Base { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java index 4ce0d15047..17a8216b7e 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java @@ -11,13 +11,13 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import gregtech.api.util.GT_Utility; import pers.gwyog.gtneioreplugin.plugin.PluginBase; import pers.gwyog.gtneioreplugin.plugin.item.ItemDimensionDisplay; import pers.gwyog.gtneioreplugin.util.GT5UndergroundFluidHelper; import pers.gwyog.gtneioreplugin.util.GT5UndergroundFluidHelper.UndergroundFluidWrapper; -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.PositionedStack; -import gregtech.api.util.GT_Utility; public class PluginGT5UndergroundFluid extends PluginBase { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java index 52fc458246..556e32fcfe 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -11,12 +11,12 @@ import java.util.List; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; +import codechicken.nei.PositionedStack; +import cpw.mods.fml.common.Loader; import pers.gwyog.gtneioreplugin.plugin.item.ItemDimensionDisplay; import pers.gwyog.gtneioreplugin.util.DimensionHelper; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; -import codechicken.nei.PositionedStack; -import cpw.mods.fml.common.Loader; public class PluginGT5VeinStat extends PluginGT5Base { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java index 6595929e89..b999b8eab0 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java @@ -9,13 +9,13 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraftforge.client.MinecraftForgeClient; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.relauncher.Side; import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; import pers.gwyog.gtneioreplugin.plugin.block.BlockDimensionDisplay; import pers.gwyog.gtneioreplugin.plugin.block.ModBlocks; import pers.gwyog.gtneioreplugin.plugin.renderer.ItemDimensionDisplayRenderer; import pers.gwyog.gtneioreplugin.util.DimensionHelper; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.relauncher.Side; public class ItemDimensionDisplay extends ItemBlock { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java b/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java index 05279919e6..96af04051e 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java @@ -8,15 +8,15 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; -import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat; -import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; - import com.opencsv.CSVWriter; import com.opencsv.bean.ColumnPositionMappingStrategy; import com.opencsv.bean.StatefulBeanToCsv; import com.opencsv.bean.StatefulBeanToCsvBuilder; +import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; +import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat; +import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper.OreLayerWrapper; + public class CSVMaker implements Runnable { public CSVMaker() {} @@ -54,14 +54,15 @@ public class CSVMaker implements Runnable { public void runSmallOres() { try { - Iterator it = GT5OreSmallHelper.mapOreSmallWrapper.entrySet().iterator(); - List OreVeins = new ArrayList(); + Iterator> it = GT5OreSmallHelper.mapOreSmallWrapper + .entrySet().iterator(); + List OreVeins = new ArrayList<>(); while (it.hasNext()) { Oremix oremix = new Oremix(); - Map.Entry pair = (Map.Entry) it.next(); + Map.Entry pair = it.next(); String Dims = GT5OreSmallHelper.bufferedDims.get(pair.getValue()); - GT5OreSmallHelper.OreSmallWrapper oreLayer = (GT5OreSmallHelper.OreSmallWrapper) pair.getValue(); + GT5OreSmallHelper.OreSmallWrapper oreLayer = pair.getValue(); oremix.setOreName(oreLayer.oreGenName.split("\\.")[2]); oremix.setHeight(oreLayer.worldGenHeightRange); oremix.setDensity(oreLayer.amountPerChunk); @@ -105,14 +106,14 @@ public class CSVMaker implements Runnable { it.remove(); // avoids a ConcurrentModificationException } BufferedWriter one = Files.newBufferedWriter(Paths.get(GTNEIOrePlugin.CSVnameSmall)); - ColumnPositionMappingStrategy strat = new ColumnPositionMappingStrategy(); + ColumnPositionMappingStrategy strat = new ColumnPositionMappingStrategy<>(); strat.setType(Oremix.class); String[] columns = "ORENAME,mix,DENSITY,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie" .split("\\,"); strat.setColumnMapping(columns); - StatefulBeanToCsv beanToCsv = new StatefulBeanToCsvBuilder(one) + StatefulBeanToCsv beanToCsv = new StatefulBeanToCsvBuilder(one) .withQuotechar(CSVWriter.NO_QUOTE_CHARACTER).withMappingStrategy(strat).build(); - List towrite = Combsort(OreVeins); + List towrite = Combsort(OreVeins); one.write( "Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E"); one.newLine(); @@ -132,14 +133,15 @@ public class CSVMaker implements Runnable { public void runVeins() { try { - Iterator it = GT5OreLayerHelper.mapOreLayerWrapper.entrySet().iterator(); - List OreVeins = new ArrayList(); + Iterator> it = GT5OreLayerHelper.mapOreLayerWrapper.entrySet() + .iterator(); + List OreVeins = new ArrayList<>(); while (it.hasNext()) { Oremix oremix = new Oremix(); - Map.Entry pair = (Map.Entry) it.next(); + Map.Entry pair = it.next(); String Dims = GT5OreLayerHelper.bufferedDims.get(pair.getValue()); - OreLayerWrapper oreLayer = (OreLayerWrapper) pair.getValue(); + OreLayerWrapper oreLayer = pair.getValue(); oremix.setOreName(oreLayer.veinName.split("\\.")[2]); oremix.setPrimary(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[0])); oremix.setSecondary(PluginGT5VeinStat.getGTOreLocalizedName(oreLayer.Meta[1])); @@ -196,14 +198,14 @@ public class CSVMaker implements Runnable { it.remove(); // avoids a ConcurrentModificationException } BufferedWriter one = Files.newBufferedWriter(Paths.get(GTNEIOrePlugin.CSVname)); - ColumnPositionMappingStrategy strat = new ColumnPositionMappingStrategy(); + ColumnPositionMappingStrategy strat = new ColumnPositionMappingStrategy<>(); strat.setType(Oremix.class); String[] columns = "ORENAME,PRIMARY,SECONDARY,INBETWEEN,AROUND,mix,TIER,HEIGHT,DENSITY,SIZE,WEIGHT,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie" .split("\\,"); strat.setColumnMapping(columns); - StatefulBeanToCsv beanToCsv = new StatefulBeanToCsvBuilder(one) + StatefulBeanToCsv beanToCsv = new StatefulBeanToCsvBuilder(one) .withQuotechar(CSVWriter.NO_QUOTE_CHARACTER).withMappingStrategy(strat).build(); - List towrite = Combsort(OreVeins); + List towrite = Combsort(OreVeins); one.write( "Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E"); one.newLine(); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java index 3660d9877e..e6aecb3d85 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java @@ -12,9 +12,9 @@ import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; -import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; import cpw.mods.fml.common.FMLLog; import gregtech.api.GregTech_API; +import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; public class GT5CFGHelper { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java index 99308c42ce..3d673a4db7 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java @@ -2,7 +2,6 @@ package pers.gwyog.gtneioreplugin.util; import static pers.gwyog.gtneioreplugin.util.GT5CFGHelper.oreVeinNotInAnyDim; -import java.lang.reflect.Field; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -152,12 +151,12 @@ public class GT5OreSmallHelper { } catch (ClassNotFoundException e) {} if (clazzGTOreSmall != null) { try { - Field fieldRestrictBiome = clazzGTOreSmall.getField("mRestrictBiome"); + clazzGTOreSmall.getField("mRestrictBiome"); restrictBiomeSupport = true; } catch (Exception e) {} try { - Field fieldGCMoon = clazzGTOreSmall.getField("mMoon"); - Field fieldGCMars = clazzGTOreSmall.getField("mMars"); + clazzGTOreSmall.getField("mMoon"); + clazzGTOreSmall.getField("mMars"); gcBasicSupport = true; } catch (Exception e) {} } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java index 171ee195a2..5b80d4010f 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java @@ -58,7 +58,7 @@ public class GT5UndergroundFluidHelper { loop: for (Class candidate : dimensionCandidates) { for (int i = 0; i < DimensionHelper.DimNameTrimmed.length; i++) { if (DimensionHelper.DimNameTrimmed[i] - .equalsIgnoreCase(candidate.newInstance().getDimensionName())) { + .equalsIgnoreCase(candidate.getConstructor().newInstance().getDimensionName())) { dimension = DimensionHelper.DimNameDisplayed[i]; break loop; } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java index 29eaf8c9f4..a16524ab28 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java @@ -24,7 +24,7 @@ public class GuiRecipeHelper { * @param gui GuiRecipe object * @return Integer value of the xSize field of that object */ - public static int getXSize(GuiRecipe gui) { + public static int getXSize(GuiRecipe gui) { if (xSizeField != null) { try { return (int) xSizeField.get(gui); @@ -43,7 +43,7 @@ public class GuiRecipeHelper { * @param gui GuiRecipe object * @return Integer value of the guiLeft field of that object */ - public static int getGuiLeft(GuiRecipe gui) { + public static int getGuiLeft(GuiRecipe gui) { if (guiLeftField != null) { try { return (int) guiLeftField.get(gui); @@ -62,7 +62,7 @@ public class GuiRecipeHelper { * @param gui GuiRecipe object * @return Integer value of the guiTop field of that object */ - public static int getGuiTop(GuiRecipe gui) { + public static int getGuiTop(GuiRecipe gui) { if (guiTopField != null) { try { return (int) guiTopField.get(gui); @@ -81,6 +81,7 @@ public class GuiRecipeHelper { * Initialize the GuiRecipe Field accessors through reflection */ public GuiRecipeHelper() { + @SuppressWarnings("rawtypes") Class guiRecipeClass = GuiRecipe.class; try { guiLeftField = guiRecipeClass.getField("guiLeft"); -- cgit From aa3b5f43be8a58619b0bdc15a8a9e2309de8365e Mon Sep 17 00:00:00 2001 From: miozune Date: Sun, 18 Jun 2023 17:40:37 +0900 Subject: Cleanup (#36) * updateBuildScript * Remove unused members in PluginGT5Base * Remove GuiRecipeHelper * Use enhanced switch * Remove / suppress unused members * Fix empty catch block * Apply final where possible * Use toArray(IntFunction) * Fix redundant default parameters * Use enhanced for * Use addAll * Fix explicit type argument * Redundant throws * SameParameterValue * String concatenation in loop * constant condition * Redundant initializer * Redundant new String() * Redundant cast * Instantiation of utility class * Fix Javadoc * Don't instantiate DecimalFormat every time * Put curly brackets * Rename: liste -> list * Rename: vertauscht -> swapped * Rename: schritt -> step --- build.gradle | 14 ++- gradle/wrapper/gradle-wrapper.jar | Bin 61574 -> 61608 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- .../java/pers/gwyog/gtneioreplugin/Config.java | 2 +- .../pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java | 10 +- .../gwyog/gtneioreplugin/plugin/IMCForNEI.java | 2 + .../gtneioreplugin/plugin/NEIPluginConfig.java | 1 + .../plugin/block/BlockDimensionDisplay.java | 18 +-- .../plugin/gregtech5/PluginGT5Base.java | 34 +----- .../plugin/gregtech5/PluginGT5SmallOreStat.java | 23 +--- .../gregtech5/PluginGT5UndergroundFluid.java | 8 +- .../plugin/gregtech5/PluginGT5VeinStat.java | 25 +--- .../plugin/item/ItemDimensionDisplay.java | 10 -- .../renderer/ItemDimensionDisplayRenderer.java | 64 +++-------- .../pers/gwyog/gtneioreplugin/util/CSVMaker.java | 36 +++--- .../gwyog/gtneioreplugin/util/DimensionHelper.java | 74 +++--------- .../gwyog/gtneioreplugin/util/GT5CFGHelper.java | 128 ++++++++++++--------- .../gtneioreplugin/util/GT5OreLayerHelper.java | 19 ++- .../gtneioreplugin/util/GT5OreSmallHelper.java | 34 +++--- .../util/GT5UndergroundFluidHelper.java | 40 +++---- .../gwyog/gtneioreplugin/util/GuiRecipeHelper.java | 97 ---------------- .../pers/gwyog/gtneioreplugin/util/Oremix.java | 91 +++++++-------- .../gtneioreplugin/util/StringPaddingHack.java | 4 +- .../gwyog/gtneioreplugin/util/Veinrenamer.java | 6 +- .../pers/gwyog/gtneioreplugin/util/XtoBool.java | 3 +- 25 files changed, 249 insertions(+), 496 deletions(-) delete mode 100644 src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java diff --git a/build.gradle b/build.gradle index a8b7532dea..3930990407 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1684218858 +//version: 1685785062 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -1276,12 +1276,14 @@ tasks.register('faq') { description = 'Prints frequently asked questions about building a project' doLast { - print("If your build fails to fetch dependencies, they might have been deleted and replaced by newer " + - "versions.\nCheck if the versions you try to fetch are still on the distributing sites.\n" + - "The links can be found in repositories.gradle and build.gradle:repositories, " + - "not build.gradle:buildscript.repositories - this one is for gradle plugin metadata.\n\n" + + print("If your build fails to fetch dependencies, run './gradlew updateDependencies'. " + + "Or you can manually check if the versions are still on the distributing sites - " + + "the links can be found in repositories.gradle and build.gradle:repositories, " + + "but not build.gradle:buildscript.repositories - those ones are for gradle plugin metadata.\n\n" + "If your build fails to recognize the syntax of new Java versions, enable Jabel in your " + - "gradle.properties. See how it's done in GTNH ExampleMod/gradle.properties.") + "gradle.properties. See how it's done in GTNH ExampleMod/gradle.properties. " + + "However, keep in mind that Jabel enables only syntax features, but not APIs that were introduced in " + + "Java 9 or later.") } } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cbfa7..ccebba7710 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fc10b601f7..37aef8d3f0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/pers/gwyog/gtneioreplugin/Config.java b/src/main/java/pers/gwyog/gtneioreplugin/Config.java index e486ea9f1e..8501ebabb1 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/Config.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/Config.java @@ -8,7 +8,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent; public class Config { - public Configuration tConfig; + public final Configuration tConfig; public Config(FMLPreInitializationEvent preinit, String cfgname) { File tFile = new File(preinit.getModConfigurationDirectory(), cfgname); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java index 6b0505e1a4..f16fa148e0 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/GTNEIOrePlugin.java @@ -19,7 +19,6 @@ import pers.gwyog.gtneioreplugin.util.CSVMaker; import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; import pers.gwyog.gtneioreplugin.util.GT5UndergroundFluidHelper; -import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper; @Mod( modid = GTNEIOrePlugin.MODID, @@ -35,7 +34,6 @@ public class GTNEIOrePlugin { public static boolean csv = false; public static String CSVname; public static String CSVnameSmall; - public static boolean toolTips = true; public static int maxTooltipLines = 11; public static final CreativeTabs creativeTab = new CreativeTabs(MODID) { @@ -66,7 +64,6 @@ public class GTNEIOrePlugin { "ALL", event.getModConfigurationDirectory() + "/GTNH-Small-Ores-Sheet.csv", "rename the oresheet here, it will appear in /config"); - toolTips = c.tConfig.getBoolean("DimTooltip", "ALL", true, "Activates Dimension Tooltips"); maxTooltipLines = c.tConfig.getInt( "MaxToolTipLines", "ALL", @@ -86,11 +83,10 @@ public class GTNEIOrePlugin { @EventHandler public void onLoadComplete(FMLLoadCompleteEvent event) { - new GT5OreLayerHelper(); - new GT5OreSmallHelper(); - new GT5UndergroundFluidHelper(); + GT5OreLayerHelper.init(); + GT5OreSmallHelper.init(); + GT5UndergroundFluidHelper.init(); if (event.getSide() == Side.CLIENT) { - new GuiRecipeHelper(); if (csv) { new CSVMaker().run(); } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java index ea60054576..2c69b68a4a 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/IMCForNEI.java @@ -48,6 +48,7 @@ public class IMCForNEI { FMLInterModComms.sendMessage("NotEnoughItems", "registerHandlerInfo", aNBT); } + @SuppressWarnings("SameParameterValue") private static void sendCatalyst(String name, String itemStack, int priority) { NBTTagCompound aNBT = new NBTTagCompound(); aNBT.setString("handlerID", name); @@ -56,6 +57,7 @@ public class IMCForNEI { FMLInterModComms.sendMessage("NotEnoughItems", "registerCatalystInfo", aNBT); } + @SuppressWarnings("SameParameterValue") private static void sendCatalyst(String name, String itemStack) { sendCatalyst(name, itemStack, 0); } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java index 17193b07fe..6996cba220 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/NEIPluginConfig.java @@ -7,6 +7,7 @@ import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5SmallOreStat; import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5UndergroundFluid; import pers.gwyog.gtneioreplugin.plugin.gregtech5.PluginGT5VeinStat; +@SuppressWarnings("unused") public class NEIPluginConfig implements IConfigureNEI { @Override diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/BlockDimensionDisplay.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/BlockDimensionDisplay.java index 048ce84aff..9e5ab1885c 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/BlockDimensionDisplay.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/BlockDimensionDisplay.java @@ -12,6 +12,7 @@ public class BlockDimensionDisplay extends Block { private final String dimension; + @SuppressWarnings("unused") public long getDimensionRocketTier() { return dimensionRocketTier; } @@ -30,18 +31,11 @@ public class BlockDimensionDisplay extends Block { @Override public IIcon getIcon(int side, int meta) { EnumFacing direction = EnumFacing.getFront(side); - switch (direction) { - case NORTH: - case SOUTH: - return iconRight; - case WEST: - case EAST: - return iconLeft; - case UP: - case DOWN: - default: - return iconTop; - } + return switch (direction) { + case NORTH, SOUTH -> iconRight; + case WEST, EAST -> iconLeft; + default -> iconTop; + }; } @Override diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java index d086175849..646e6d2bc7 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5Base.java @@ -1,17 +1,12 @@ package pers.gwyog.gtneioreplugin.plugin.gregtech5; -import java.awt.Point; -import java.awt.Rectangle; - import net.minecraft.client.resources.I18n; import codechicken.lib.gui.GuiDraw; -import codechicken.nei.recipe.GuiRecipe; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.util.GT_LanguageManager; import pers.gwyog.gtneioreplugin.plugin.PluginBase; -import pers.gwyog.gtneioreplugin.util.GuiRecipeHelper; public abstract class PluginGT5Base extends PluginBase { @@ -48,32 +43,6 @@ public abstract class PluginGT5Base extends PluginBase { GuiDraw.drawString(I18n.format(lineKey) + ": " + value, x, y, 0x404040, false); } - /** - * The dimension names for a given recipe index - * - * @param recipe The recipe index being handled - * @return A CSV string of dimension name abbreviations - */ - protected abstract String getDimensionNames(int recipe); - - /** - * Produce a rectangle covering the area of displayed dimension names - * - * @param gui An instance of the currentscreen - * @param recipe The recipe index being handled - * @param dimNames Dimension names to produce a rectangle for - * @return Rectangle area of dimension names - */ - protected Rectangle getDimensionNamesRect(GuiRecipe gui, int recipe, String dimNames) { - int dimNamesHeight = dimNames.length() > 70 ? 30 : (dimNames.length() > 36 ? 20 : 10); - Point offset = gui.getRecipePosition(recipe); - return new Rectangle( - GuiRecipeHelper.getGuiLeft(gui) + offset.x + 2, - GuiRecipeHelper.getGuiTop(gui) + offset.y + 110, - GuiRecipeHelper.getXSize(gui) - 9, - dimNamesHeight); - } - protected int getMaximumMaterialIndex(short meta, boolean smallOre) { int offset = smallOre ? 16000 : 0; if (!getGTOreLocalizedName((short) (meta + offset + 5000)) @@ -88,9 +57,8 @@ public abstract class PluginGT5Base extends PluginBase { /** * Draw the dimension header and the dimension names over up to 3 lines * - * @param dimNames A CSV string of dimension name abbreviations */ - protected void drawDimNames(String dimNames) { + protected void drawDimNames() { GuiDraw.drawString(I18n.format("gtnop.gui.nei.worldNames") + ": ", 2, 100, 0x404040, false); } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java index 512f966629..76bd66d280 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5SmallOreStat.java @@ -27,8 +27,7 @@ public class PluginGT5SmallOreStat extends PluginGT5Base { drawSmallOreName(oreSmall); drawSmallOreInfo(oreSmall); - String sDimNames = GT5OreSmallHelper.bufferedDims.get(oreSmall); - drawDimNames(sDimNames); + drawDimNames(); drawSeeAllRecipesLabel(); } @@ -128,18 +127,6 @@ public class PluginGT5SmallOreStat extends PluginGT5Base { return I18n.format("gtnop.gui.smallOreStat.name"); } - /** - * The dimension names for a given recipe identifier - * - * @param recipe identifier - * @return A CSV string of dimension name abbreviations - */ - @Override - protected String getDimensionNames(int recipe) { - OreSmallWrapper oreSmall = getSmallOre(recipe); - return GT5OreSmallHelper.bufferedDims.get(oreSmall); - } - private String[] getDimNameArrayFromVeinName(String veinName) { OreSmallWrapper oreSmall = GT5OreSmallHelper.mapOreSmallWrapper.get(veinName); String[] dims = DimensionHelper.parseDimNames(GT5OreSmallHelper.bufferedDims.get(oreSmall)); @@ -149,10 +136,10 @@ public class PluginGT5SmallOreStat extends PluginGT5Base { public class CachedOreSmallRecipe extends CachedRecipe { - public String oreGenName; - public PositionedStack positionedStackOreSmall; - public PositionedStack positionedStackMaterialDust; - public List positionedDropStackList; + public final String oreGenName; + public final PositionedStack positionedStackOreSmall; + public final PositionedStack positionedStackMaterialDust; + public final List positionedDropStackList; private final List dimensionDisplayItems = new ArrayList<>(); public CachedOreSmallRecipe(String oreGenName, List stackList, List materialDustStackList, diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java index 17a8216b7e..8f7754bbde 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5UndergroundFluid.java @@ -24,6 +24,7 @@ public class PluginGT5UndergroundFluid extends PluginBase { private static final int lineSpace = 20; private static final int xDimensionDisplay = 30; private static final int halfItemLength = 16 / 2; + private static final DecimalFormat format = new DecimalFormat("0.#"); @Override public void loadCraftingRecipes(String outputId, Object... results) { @@ -100,12 +101,7 @@ public class PluginGT5UndergroundFluid extends PluginBase { int y = 50; CachedUndergroundFluidRecipe recipe = (CachedUndergroundFluidRecipe) this.arecipes.get(recipeIndex); for (int i = 0; i < recipe.dimensionDisplayItems.size(); i++) { - GuiDraw.drawStringC( - new DecimalFormat("0.#").format((double) recipe.chances.get(i) / 100) + "%", - xChance, - y, - black, - false); + GuiDraw.drawStringC(format.format((double) recipe.chances.get(i) / 100) + "%", xChance, y, black, false); GuiDraw.drawStringC( recipe.minAmounts.get(i).toString() + "-" + recipe.maxAmounts.get(i).toString(), xAmount, diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java index 556e32fcfe..98f168c2a7 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/gregtech5/PluginGT5VeinStat.java @@ -80,8 +80,7 @@ public class PluginGT5VeinStat extends PluginGT5Base { drawVeinLayerNames(oreLayer); drawVeinInfo(oreLayer); - String sDimNames = GT5OreLayerHelper.bufferedDims.get(oreLayer); - drawDimNames(sDimNames); + drawDimNames(); drawSeeAllRecipesLabel(); } @@ -132,18 +131,6 @@ public class PluginGT5VeinStat extends PluginGT5Base { return I18n.format("gtnop.gui.veinStat.name"); } - /** - * The dimension names for a given recipe identifier - * - * @param recipe identifier - * @return A CSV string of dimension name abbreviations - */ - @Override - protected String getDimensionNames(int recipe) { - OreLayerWrapper oreLayer = getOreLayer(recipe); - return GT5OreLayerHelper.bufferedDims.get(oreLayer); - } - private String[] getDimNameArrayFromVeinName(String veinName) { OreLayerWrapper oreLayer = GT5OreLayerHelper.mapOreLayerWrapper.get(veinName); String[] dims = DimensionHelper.parseDimNames(GT5OreLayerHelper.bufferedDims.get(oreLayer)); @@ -153,11 +140,11 @@ public class PluginGT5VeinStat extends PluginGT5Base { public class CachedVeinStatRecipe extends CachedRecipe { - public String veinName; - public PositionedStack positionedStackPrimary; - public PositionedStack positionedStackSecondary; - public PositionedStack positionedStackBetween; - public PositionedStack positionedStackSporadic; + public final String veinName; + public final PositionedStack positionedStackPrimary; + public final PositionedStack positionedStackSecondary; + public final PositionedStack positionedStackBetween; + public final PositionedStack positionedStackSporadic; private final List dimensionDisplayItems = new ArrayList<>(); public CachedVeinStatRecipe(String veinName, List stackListPrimary, diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java index b999b8eab0..b8e9301f3b 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/item/ItemDimensionDisplay.java @@ -2,8 +2,6 @@ package pers.gwyog.gtneioreplugin.plugin.item; import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.LOG; -import java.util.Objects; - import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; @@ -46,14 +44,6 @@ public class ItemDimensionDisplay extends ItemBlock { return null; } - public static boolean isDimensionEqual(ItemStack stack1, ItemStack stack2) { - if (!(stack1.getItem() instanceof ItemDimensionDisplay) - || !(stack2.getItem() instanceof ItemDimensionDisplay)) { - return false; - } - return Objects.equals(getDimension(stack1), getDimension(stack2)); - } - @Override public String getItemStackDisplayName(ItemStack stack) { String dimension = getDimension(stack); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java index a86482d17f..0c7617645c 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java @@ -60,56 +60,18 @@ public class ItemDimensionDisplayRenderer implements IItemRenderer { // See DimensionHelper.DimNameDisplayed for real names of these. public static long getPrefix(String dimName) { - switch (dimName) { - case "Ow": - case "Ne": - case "TF": - case "ED": - case "VA": - case "EA": - return 0L; - case "Mo": - return 1L; - case "De": - case "Ma": - case "Ph": - return 2L; - case "As": - case "Ca": - case "Ce": - case "Eu": - case "Ga": - case "Rb": - return 3L; - case "Io": - case "Me": - case "Ve": - return 4L; - case "En": - case "Mi": - case "Ob": - case "Ti": - case "Ra": - return 5L; - case "Pr": - case "Tr": - return 6L; - case "Ha": - case "KB": - case "MM": - case "Pl": - return 7L; - case "BC": - case "BE": - case "BF": - case "CB": - case "TE": - case "VB": - return 8L; - case "DD": - return 9L; - default: - return -1L; - } + return switch (dimName) { + case "Ow", "Ne", "TF", "ED", "VA", "EA" -> 0L; + case "Mo" -> 1L; + case "De", "Ma", "Ph" -> 2L; + case "As", "Ca", "Ce", "Eu", "Ga", "Rb" -> 3L; + case "Io", "Me", "Ve" -> 4L; + case "En", "Mi", "Ob", "Ti", "Ra" -> 5L; + case "Pr", "Tr" -> 6L; + case "Ha", "KB", "MM", "Pl" -> 7L; + case "BC", "BE", "BF", "CB", "TE", "VB" -> 8L; + case "DD" -> 9L; + default -> -1L; + }; } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java b/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java index 96af04051e..d19a1fdff9 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java @@ -21,31 +21,29 @@ public class CSVMaker implements Runnable { public CSVMaker() {} - public static List Combsort(List liste) { + public static List Combsort(List list) { try { - List liste2 = new ArrayList(liste.size()); - for (Oremix element : liste) { - liste2.add(element); - } + List list2 = new ArrayList<>(list.size()); + list2.addAll(list); - int schritt = liste2.size(); - boolean vertauscht = false; + int step = list2.size(); + boolean swapped; do { - vertauscht = false; - if (schritt > 1) { - schritt = (int) (schritt / 1.3); + swapped = false; + if (step > 1) { + step = (int) (step / 1.3); } - for (int i = 0; i < liste2.size() - schritt; i++) { - if (liste2.get(i).getOreName().substring(0, 3) - .compareTo((liste2.get(i + schritt).getOreName().substring(0, 3))) > 0) { - Oremix tmp = (Oremix) liste2.get(i); - liste2.set(i, liste2.get(i + schritt)); - liste2.set(i + schritt, (Oremix) tmp); - vertauscht = true; + for (int i = 0; i < list2.size() - step; i++) { + if (list2.get(i).getOreName().substring(0, 3) + .compareTo((list2.get(i + step).getOreName().substring(0, 3))) > 0) { + Oremix tmp = list2.get(i); + list2.set(i, list2.get(i + step)); + list2.set(i + step, tmp); + swapped = true; } } - } while (vertauscht || schritt > 1); - return liste2; + } while (swapped || step > 1); + return list2; } catch (Exception e) { e.printStackTrace(); return null; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java index be95356118..02ad143dd4 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -5,13 +5,12 @@ import static pers.gwyog.gtneioreplugin.GTNEIOrePlugin.maxTooltipLines; import java.util.Arrays; import java.util.HashMap; import java.util.List; -import java.util.stream.Collectors; import net.minecraft.util.StatCollector; public class DimensionHelper { - public static String[] DimName = { + public static final String[] DimName = { // Non GC dimensions in progression order instead of alphabetical "Overworld", "Nether", "Twilight", "TheEnd", "Vanilla_EndAsteroids", "EndAsteroid", // T1 @@ -33,14 +32,14 @@ public class DimensionHelper { "GalaxySpace_BarnardC", "GalaxySpace_BarnardE", "GalaxySpace_BarnardF", "GalaxySpace_CentauriA", "GalaxySpace_TcetiE", "Underdark", "GalaxySpace_VegaB", }; - public static String[] DimNameTrimmed = Arrays.stream(DimName) + public static final String[] DimNameTrimmed = Arrays.stream(DimName) .map( n -> n.replaceAll("GalacticraftCore_", "").replaceAll("GalacticraftMars_", "") .replaceAll("GalaxySpace_", "").replaceAll("Vanilla_", "Vanilla ")) - .collect(Collectors.toList()).toArray(new String[0]); + .toArray(String[]::new); - public static String[] DimNameDisplayed = { // first 2 letters if one word else 1 letter of every word, except - // capital letter in + public static final String[] DimNameDisplayed = { // first 2 letters if one word else 1 letter of every word, except + // capital letter in // name, then 1rst + capital Moon = Mo, BarnardC = BC, EndAsteroid = EA // Non GC dimensions in progression order instead of alphabetical "Ow", // Overworld @@ -100,57 +99,18 @@ public class DimensionHelper { if (s.equals(DimNameDisplayed[i])) { String k = DimNameTrimmed[i]; s = StatCollector.translateToLocal("gtnop.world." + k); - switch (k) { - case "Moon": - s = "T1: " + s; - break; - case "Deimos": - case "Mars": - case "Phobos": - s = "T2: " + s; - break; - case "Asteroids": - case "Callisto": - case "Ceres": - case "Europa": - case "Ganymede": - case "Ross128b": - s = "T3: " + s; - break; - case "Io": - case "Mercury": - case "Venus": - s = "T4: " + s; - break; - case "Enceladus": - case "Miranda": - case "Oberon": - case "Titan": - case "Ross128ba": - s = "T5: " + s; - break; - case "Proteus": - case "Triton": - s = "T6: " + s; - break; - case "Haumea": - case "Kuiperbelt": - case "MakeMake": - case "Pluto": - s = "T7: " + s; - break; - case "BarnardC": - case "BarnardE": - case "BarnardF": - case "CentauriA": - case "TcetiE": - case "VegaB": - s = "T8: " + s; - break; - case "Underdark": - s = "T9: " + s; - break; - } + s = switch (k) { + case "Moon" -> "T1: " + s; + case "Deimos", "Mars", "Phobos" -> "T2: " + s; + case "Asteroids", "Callisto", "Ceres", "Europa", "Ganymede", "Ross128b" -> "T3: " + s; + case "Io", "Mercury", "Venus" -> "T4: " + s; + case "Enceladus", "Miranda", "Oberon", "Titan", "Ross128ba" -> "T5: " + s; + case "Proteus", "Triton" -> "T6: " + s; + case "Haumea", "Kuiperbelt", "MakeMake", "Pluto" -> "T7: " + s; + case "BarnardC", "BarnardE", "BarnardF", "CentauriA", "TcetiE", "VegaB" -> "T8: " + s; + case "Underdark" -> "T9: " + s; + default -> s; + }; dims[j] = s; } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java index e6aecb3d85..ebc9956af1 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5CFGHelper.java @@ -19,14 +19,14 @@ import pers.gwyog.gtneioreplugin.GTNEIOrePlugin; public class GT5CFGHelper { // Do NOT ever put a comma in this or it will break split calls later in the code. Bad, but it is what it is. - public static String oreVeinNotInAnyDim = "Not available in any Galactic Dim!"; + public static final String oreVeinNotInAnyDim = "Not available in any Galactic Dim!"; - private static File F = GregTech_API.sWorldgenFile.mConfig.getConfigFile(); + private static final File F = GregTech_API.sWorldgenFile.mConfig.getConfigFile(); public static String GT5CFGSmallOres(String Veinname) { - List raw = new ArrayList(); - List rawbools = new ArrayList(); - String st = null; + List raw = new ArrayList<>(); + List rawbools = new ArrayList<>(); + String st; Configuration c = new Configuration(F); ConfigCategory configCategory = c.getCategory("worldgen." + Veinname); for (Property p : configCategory.getOrderedValues()) { @@ -34,33 +34,40 @@ public class GT5CFGHelper { raw.add(p.getName() + "=" + p.getBoolean()); } } - if (!raw.isEmpty()) for (int i = 0; i < raw.size(); i++) { - for (int j = 0; j < DimensionHelper.DimName.length; j++) - if (raw.get(i).contains(DimensionHelper.DimName[j])) rawbools.add(raw.get(i)); - } - else GTNEIOrePlugin.LOG.info("Config entry not found for Vein: " + Veinname); + if (!raw.isEmpty()) { + for (String s : raw) { + for (int j = 0; j < DimensionHelper.DimName.length; j++) { + if (s.contains(DimensionHelper.DimName[j])) { + rawbools.add(s); + } + } + } + } else GTNEIOrePlugin.LOG.info("Config entry not found for Vein: " + Veinname); - String ret = " "; + StringBuilder ret = new StringBuilder(" "); - HashSet rawboolsset = new HashSet(); + HashSet rawboolsset = new HashSet<>(); if (!rawbools.isEmpty()) { - for (int i = 0; i < rawbools.size(); i++) { - st = rawbools.get(i).replace("B:", "").replace("_true", "").replace("_false", "").replaceAll(" ", "") + for (String rawbool : rawbools) { + st = rawbool.replace("B:", "").replace("_true", "").replace("_false", "").replaceAll(" ", "") .replaceAll("\"", ""); rawboolsset.add(st); } - rawbools = new ArrayList(rawboolsset); + rawbools = new ArrayList<>(rawboolsset); for (int j = 0; j < DimensionHelper.DimName.length; j++) { - for (int i = 0; i < rawbools.size(); i++) { - st = rawbools.get(i); - if (st.contains(DimensionHelper.DimName[j])) - if (st.contains("=true")) ret = (ret + DimensionHelper.DimNameDisplayed[j] + ","); + for (String rawbool : rawbools) { + st = rawbool; + if (st.contains(DimensionHelper.DimName[j]) && st.contains("=true")) { + ret.append(DimensionHelper.DimNameDisplayed[j]).append(","); + } } } } - ret = ret.trim(); - if (ret.equals("") || ret.equals(" ")) ret = oreVeinNotInAnyDim; - return ret; + ret = new StringBuilder(ret.toString().trim()); + if (ret.toString().equals("") || ret.toString().equals(" ")) { + ret = new StringBuilder(oreVeinNotInAnyDim); + } + return ret.toString(); } public static String GT5CFG(String Veinname) { @@ -70,16 +77,18 @@ public class GT5CFGHelper { return "Error while Loading CFG"; } else try { int buffer = (int) (0.1 * Runtime.getRuntime().freeMemory()); - if (buffer > F.length()) buffer = (int) F.length(); + if (buffer > F.length()) { + buffer = (int) F.length(); + } // allocate 10% of free memory for read-in-buffer, if there is less than filesize memory available // FMLLog.info("GT_CFG_found[0]"); FileReader in = new FileReader(F); // FMLLog.info("FileReader created"); BufferedReader reader = new BufferedReader(in, buffer); // FMLLog.info("BufferedReader" +Integer.toString(buffer)+"created"); - String st = null; - List raw = new ArrayList(); - List rawbools = new ArrayList(); + String st; + List raw = new ArrayList<>(); + List rawbools = new ArrayList<>(); Boolean[] found = new Boolean[2]; found[0] = false; found[1] = false; @@ -90,16 +99,18 @@ public class GT5CFGHelper { st = reader.readLine(); // FMLLog.info("st: "+st); if (st != null && st.trim().equals("mix {")) { - while (!((st == null) || ((st != null) && found[0]))) { + while (!(st == null || found[0])) { // FMLLog.info("zweite"); st = reader.readLine(); // read until reached eof or Veinname { // FMLLog.info("MIXst: "+st); if (st != null && st.trim().equals(Veinname + " {")) { // FMLLog.info("VEINNAMEst: "+st); - while (!((st == null) || ((st != null) && found[0]))) { + while (!(st == null || found[0])) { st = reader.readLine(); - if ((!(st == null)) && st.trim().equals("}")) found[0] = true; + if ((!(st == null)) && st.trim().equals("}")) { + found[0] = true; + } // FMLLog.info("dritte"); // add everything below Veinname { undtil } to raw raw.add(st); @@ -109,20 +120,22 @@ public class GT5CFGHelper { } if (st != null && st.trim().equals("dimensions {")) { - while (!((st == null) || ((st != null) && found[1]))) { + while (!(st == null || found[1])) { // FMLLog.info("zweite"); st = reader.readLine(); if (st != null && (st.trim().equals("mix {"))) { - while (!((st == null) || ((st != null) && found[1]))) { + while (!(st == null || found[1])) { // FMLLog.info("dritte"); st = reader.readLine(); // read until reached eof or Veinname { // FMLLog.info("MIXst: "+st); if (st != null && st.trim().equals(Veinname + " {")) { // FMLLog.info("VEINNAMEst: "+st); - while (!((st == null) || ((st != null) && found[1]))) { + while (!(st == null || found[1])) { st = reader.readLine(); - if ((!(st == null)) && st.trim().equals("}")) found[1] = true; + if ((!(st == null)) && st.trim().equals("}")) { + found[1] = true; + } // FMLLog.info("vierte"); // add everything below Veinname { undtil } to raw raw.add(st); @@ -135,40 +148,49 @@ public class GT5CFGHelper { } while (st != null); reader.close(); // not needed anymore - if (!raw.isEmpty()) for (int i = 0; i < raw.size(); i++) { - // filter needed booleans from raw - /// FMLLog.info("raw contains"+raw.get(i)); - for (int j = 0; j < DimensionHelper.DimName.length; j++) - if (raw.get(i).contains(DimensionHelper.DimName[j])) rawbools.add(raw.get(i)); - // FMLLog.info("rawbools: "+rawbools.get(i)); + if (!raw.isEmpty()) { + for (String s : raw) { + // filter needed booleans from raw + /// FMLLog.info("raw contains"+raw.get(i)); + for (int j = 0; j < DimensionHelper.DimName.length; j++) { + if (s.contains(DimensionHelper.DimName[j])) { + rawbools.add(s); + } + } + // FMLLog.info("rawbools: "+rawbools.get(i)); + } + } else { + GTNEIOrePlugin.LOG.info("Config entry not found for Vein: " + Veinname); } - else GTNEIOrePlugin.LOG.info("Config entry not found for Vein: " + Veinname); - String ret = " "; + StringBuilder ret = new StringBuilder(" "); - HashSet rawboolsset = new HashSet(); + HashSet rawboolsset = new HashSet<>(); if (!rawbools.isEmpty()) { // remove dublicates - for (int i = 0; i < rawbools.size(); i++) { - st = rawbools.get(i).replace("B:", "").replace("_true", "").replace("_false", "") - .replaceAll(" ", "").replaceAll("\"", ""); + for (String rawbool : rawbools) { + st = rawbool.replace("B:", "").replace("_true", "").replace("_false", "").replaceAll(" ", "") + .replaceAll("\"", ""); rawboolsset.add(st); } - rawbools = new ArrayList(rawboolsset); + rawbools = new ArrayList<>(rawboolsset); // filter for dims set to true for (int j = 0; j < DimensionHelper.DimName.length; j++) { // FMLLog.info("RawBools:"+st); - for (int i = 0; i < rawbools.size(); i++) { - st = rawbools.get(i); - if (st.contains(DimensionHelper.DimName[j])) - if (st.contains("=true")) ret = (ret + DimensionHelper.DimNameDisplayed[j] + ","); + for (String rawbool : rawbools) { + st = rawbool; + if (st.contains(DimensionHelper.DimName[j]) && st.contains("=true")) { + ret.append(DimensionHelper.DimNameDisplayed[j]).append(","); + } } } } - ret = ret.trim(); + ret = new StringBuilder(ret.toString().trim()); // FMLLog.info("ret:"+ret); - if (ret.equals("") || ret.equals(" ")) ret = oreVeinNotInAnyDim; - return ret; + if (ret.toString().equals("") || ret.toString().equals(" ")) { + ret = new StringBuilder(oreVeinNotInAnyDim); + } + return ret.toString(); } catch (IOException e) { e.printStackTrace(); return "Error while Loading CFG"; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java index 996bef161a..c2c4fa9800 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreLayerHelper.java @@ -36,13 +36,13 @@ public class GT5OreLayerHelper { } private static final int DIMENSION_COUNT = 33; - public static Integer[] weightPerWorld = new Integer[DIMENSION_COUNT]; - public static Integer[] DimIDs = new Integer[DIMENSION_COUNT]; - public static HashMap mapOreLayerWrapper = new HashMap<>(); - public static HashMap bufferedDims = new HashMap<>(); - public static HashMap dimToOreWrapper = new HashMap<>(); + public static final Integer[] weightPerWorld = new Integer[DIMENSION_COUNT]; + public static final Integer[] DimIDs = new Integer[DIMENSION_COUNT]; + public static final HashMap mapOreLayerWrapper = new HashMap<>(); + public static final HashMap bufferedDims = new HashMap<>(); + public static final HashMap dimToOreWrapper = new HashMap<>(); - public GT5OreLayerHelper() { + public static void init() { Arrays.fill(weightPerWorld, 0); Arrays.fill(DimIDs, 0); for (GT_Worldgen_GT_Ore_Layer tWorldGen : GT_Worldgen_GT_Ore_Layer.sList) @@ -82,10 +82,9 @@ public class GT5OreLayerHelper { public static class OreLayerWrapper { - public String veinName, worldGenHeightRange; - public short[] Meta = new short[4]; - public short randomWeight, size, density; - public List Weight = new ArrayList<>(); + public final String veinName, worldGenHeightRange; + public final short[] Meta = new short[4]; + public final short randomWeight, size, density; public final Materials mPrimaryVeinMaterial; public final Materials mSecondaryMaterial; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java index 3d673a4db7..8a150967a0 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5OreSmallHelper.java @@ -20,13 +20,12 @@ public class GT5OreSmallHelper { private static final int SMALL_ORE_BASE_META = 16000; public static boolean restrictBiomeSupport = false; - public static boolean gcBasicSupport = false; - public static List oreSmallList = new ArrayList<>(); - public static HashMap mapOreSmallWrapper = new HashMap<>(); - public static HashMap mapOreDropUnlocalizedNameToOreMeta = new HashMap<>(); - public static HashMap> mapOreMetaToOreDrops = new HashMap<>(); - public static HashMap bufferedDims = new HashMap<>(); - public static HashMap dimToSmallOreWrapper = new HashMap<>(); + public static final List oreSmallList = new ArrayList<>(); + public static final HashMap mapOreSmallWrapper = new HashMap<>(); + public static final HashMap mapOreDropUnlocalizedNameToOreMeta = new HashMap<>(); + public static final HashMap> mapOreMetaToOreDrops = new HashMap<>(); + public static final HashMap bufferedDims = new HashMap<>(); + public static final HashMap dimToSmallOreWrapper = new HashMap<>(); public static class SmallOreDimensionWrapper { @@ -46,7 +45,7 @@ public class GT5OreSmallHelper { } } - public GT5OreSmallHelper() { + public static void init() { checkExtraSupport(); ItemStack stack; Materials material; @@ -148,17 +147,12 @@ public class GT5OreSmallHelper { Class clazzGTOreSmall = null; try { clazzGTOreSmall = Class.forName("gregtech.common" + ".GT_Worldgen_GT_Ore_SmallPieces"); - } catch (ClassNotFoundException e) {} + } catch (ClassNotFoundException ignored) {} if (clazzGTOreSmall != null) { try { clazzGTOreSmall.getField("mRestrictBiome"); restrictBiomeSupport = true; - } catch (Exception e) {} - try { - clazzGTOreSmall.getField("mMoon"); - clazzGTOreSmall.getField("mMars"); - gcBasicSupport = true; - } catch (Exception e) {} + } catch (Exception ignored) {} } } @@ -169,12 +163,12 @@ public class GT5OreSmallHelper { public static class OreSmallWrapper { - public String oreGenName; - public short oreMeta; - public String worldGenHeightRange; - public short amountPerChunk; - public String restrictBiome; + public final String oreGenName; + public final short oreMeta; + public final String worldGenHeightRange; + public final short amountPerChunk; + @SuppressWarnings("unused") public Materials getOreMaterial() { return oreMaterial; } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java index 5b80d4010f..9b47c757d8 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java @@ -33,7 +33,7 @@ public class GT5UndergroundFluidHelper { private static final Map> fluidMap = new HashMap<>(); @SuppressWarnings("unchecked") - public GT5UndergroundFluidHelper() { + public static void init() { try { Field fieldDimensionList = GT_UO_DimensionList.class.getDeclaredField("fDimensionList"); fieldDimensionList.setAccessible(true); @@ -119,31 +119,25 @@ public class GT5UndergroundFluidHelper { } @SuppressWarnings("SwitchStatementWithTooFewBranches") - private String getDimensionFromID(int id) { - switch (id) { - case 0: - return "Ow"; - default: - return null; - } + private static String getDimensionFromID(int id) { + return switch (id) { + case 0 -> "Ow"; + default -> null; + }; } - private String getDimensionForEdgeCase(String rawDimension) { - switch (rawDimension) { - case "aCentauriBb": - return "CB"; - case "BarnardaC": - return "BC"; - case "BarnardaE": - return "BE"; - case "BarnardaF": - return "BF"; - case "TCetiE": - return "TE"; - default: + private static String getDimensionForEdgeCase(String rawDimension) { + return switch (rawDimension) { + case "aCentauriBb" -> "CB"; + case "BarnardaC" -> "BC"; + case "BarnardaE" -> "BE"; + case "BarnardaF" -> "BF"; + case "TCetiE" -> "TE"; + default -> { LOG.warn("Unknown dimension name while parsing: " + rawDimension); - return null; - } + yield null; + } + }; } public static class UndergroundFluidWrapper { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java deleted file mode 100644 index a16524ab28..0000000000 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GuiRecipeHelper.java +++ /dev/null @@ -1,97 +0,0 @@ -package pers.gwyog.gtneioreplugin.util; - -import java.lang.reflect.Field; - -import net.minecraft.client.Minecraft; - -import org.apache.logging.log4j.Level; - -import codechicken.nei.recipe.GuiRecipe; -import cpw.mods.fml.common.FMLLog; - -public class GuiRecipeHelper { - - private static final String INIT_ERROR = "pers.gwyog.gtneioreplugin.util.GuiRecipeHelper failed setting up reflection : "; - private static final int DEFAULT_XSIZE = 176; - - public static Field xSizeField; - public static Field guiLeftField; - public static Field guiTopField; - - /** - * Access the xSize field of a GuiRecipe instance, or use a fallback hardcoded value if that fails - * - * @param gui GuiRecipe object - * @return Integer value of the xSize field of that object - */ - public static int getXSize(GuiRecipe gui) { - if (xSizeField != null) { - try { - return (int) xSizeField.get(gui); - } catch (IllegalAccessException e) { - // Fail silently, hoping that it it fails it will be during initialization - } - } - - // Fallback should work unless codechicken.nei.recipe.GuiRecipe implementation changes - return DEFAULT_XSIZE; - } - - /** - * Access the guiLeft field of a GuiRecipe instance, or use a fallback hardcoded value if that fails - * - * @param gui GuiRecipe object - * @return Integer value of the guiLeft field of that object - */ - public static int getGuiLeft(GuiRecipe gui) { - if (guiLeftField != null) { - try { - return (int) guiLeftField.get(gui); - } catch (IllegalAccessException e) { - // Fail silently, hoping that it it fails it will be during initialization - } - } - - // Fallback should work unless codechicken.nei.recipe.GuiRecipe implementation changes - return (Minecraft.getMinecraft().currentScreen.width - DEFAULT_XSIZE) / 2; - } - - /** - * Access the guiTop field of a GuiRecipe instance, or use a fallback hardcoded value if that fails - * - * @param gui GuiRecipe object - * @return Integer value of the guiTop field of that object - */ - public static int getGuiTop(GuiRecipe gui) { - if (guiTopField != null) { - try { - return (int) guiTopField.get(gui); - } catch (IllegalAccessException e) { - // Fail silently, hoping that it it fails it will be during initialization - } - } - - // Fallback should work unless codechicken.nei.recipe.GuiRecipe implementation changes - int height = Minecraft.getMinecraft().currentScreen.height; - int ySize = Math.min(Math.max(height - 68, 166), 370); - return (height - ySize) / 2 + 10; - } - - /** - * Initialize the GuiRecipe Field accessors through reflection - */ - public GuiRecipeHelper() { - @SuppressWarnings("rawtypes") - Class guiRecipeClass = GuiRecipe.class; - try { - guiLeftField = guiRecipeClass.getField("guiLeft"); - guiLeftField.setAccessible(true); - guiTopField = guiRecipeClass.getField("guiTop"); - guiTopField.setAccessible(true); - xSizeField = guiRecipeClass.getField("xSize"); - xSizeField.setAccessible(true); - } catch (NoSuchFieldException | SecurityException e) { - FMLLog.log(Level.ERROR, INIT_ERROR + e.getMessage()); - } - } -} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java b/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java index 69941b6ba2..d17e020db7 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java @@ -3,141 +3,142 @@ package pers.gwyog.gtneioreplugin.util; import com.opencsv.bean.CsvBindByName; import com.opencsv.bean.CsvCustomBindByName; +@SuppressWarnings("unused") public class Oremix { - @CsvCustomBindByName(column = "Moon", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Moon", converter = XtoBool.class) public boolean mo; - @CsvCustomBindByName(column = "End Asteroids", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "End Asteroids", converter = XtoBool.class) public boolean ea; - @CsvCustomBindByName(column = "AstroidBelt", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "AstroidBelt", converter = XtoBool.class) public boolean as; - @CsvCustomBindByName(column = "Barnard C", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Barnard C", converter = XtoBool.class) public boolean bc; - @CsvCustomBindByName(column = "Barnard E", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Barnard E", converter = XtoBool.class) public boolean be; - @CsvCustomBindByName(column = "Barnard F", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Barnard F", converter = XtoBool.class) public boolean bf; - @CsvCustomBindByName(column = "Mars", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Mars", converter = XtoBool.class) public boolean ma; - @CsvCustomBindByName(column = "Callisto", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Callisto", converter = XtoBool.class) public boolean ca; - @CsvCustomBindByName(column = "Centauri Bb", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Centauri Bb", converter = XtoBool.class) public boolean cb; - @CsvCustomBindByName(column = "Ceres", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Ceres", converter = XtoBool.class) public boolean ce; - @CsvCustomBindByName(column = "Twilight Forest", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Twilight Forest", converter = XtoBool.class) public boolean tf; - @CsvCustomBindByName(column = "Deep Dark", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Deep Dark", converter = XtoBool.class) public boolean dd; - @CsvCustomBindByName(column = "Phobos", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Phobos", converter = XtoBool.class) public boolean ph; - @CsvCustomBindByName(column = "Deimos", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Deimos", converter = XtoBool.class) public boolean de; - @CsvCustomBindByName(column = "Europa", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Europa", converter = XtoBool.class) public boolean eu; - @CsvCustomBindByName(column = "Ganymede", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Ganymede", converter = XtoBool.class) public boolean ga; - @CsvCustomBindByName(column = "Io", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Io", converter = XtoBool.class) public boolean io; - @CsvCustomBindByName(column = "Venus", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Venus", converter = XtoBool.class) public boolean ve; - @CsvCustomBindByName(column = "Mercury", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Mercury", converter = XtoBool.class) public boolean me; - @CsvCustomBindByName(column = "Enceladus", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Enceladus", converter = XtoBool.class) public boolean en; - @CsvCustomBindByName(column = "Titan", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Titan", converter = XtoBool.class) public boolean ti; - @CsvCustomBindByName(column = "Miranda", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Miranda", converter = XtoBool.class) public boolean mi; - @CsvCustomBindByName(column = "Oberon", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Oberon", converter = XtoBool.class) public boolean ob; - @CsvCustomBindByName(column = "Triton", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Triton", converter = XtoBool.class) public boolean tr; - @CsvCustomBindByName(column = "Proteus", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Proteus", converter = XtoBool.class) public boolean pr; - @CsvCustomBindByName(column = "Pluto", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Pluto", converter = XtoBool.class) public boolean pl; - @CsvCustomBindByName(column = "Kuiper Belt", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Kuiper Belt", converter = XtoBool.class) public boolean kb; - @CsvCustomBindByName(column = "Haumea", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Haumea", converter = XtoBool.class) public boolean ha; - @CsvCustomBindByName(column = "Makemake", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Makemake", converter = XtoBool.class) public boolean make; - @CsvCustomBindByName(column = "Vega B", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Vega B", converter = XtoBool.class) public boolean vb; - @CsvCustomBindByName(column = "T Ceti E", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "T Ceti E", converter = XtoBool.class) public boolean tcetie; @CsvCustomBindByName(column = "Ore Name", required = true, converter = Veinrenamer.class) private String oreName; - @CsvBindByName(column = "Primary", required = false) + @CsvBindByName(column = "Primary") private String primary = ""; - @CsvBindByName(column = "Secondary", required = false) + @CsvBindByName(column = "Secondary") private String secondary = ""; - @CsvBindByName(column = "Inbetween", required = false) + @CsvBindByName(column = "Inbetween") private String inbetween = ""; - @CsvBindByName(column = "Around", required = false) + @CsvBindByName(column = "Around") private String around = ""; - @CsvBindByName(column = "ID ", required = false) + @CsvBindByName(column = "ID ") private String mix = ""; - @CsvBindByName(column = "Tier", required = false) + @CsvBindByName(column = "Tier") private String tier = ""; - @CsvBindByName(column = "Height", required = false) + @CsvBindByName(column = "Height") private String height = ""; - @CsvBindByName(column = "Density", required = false) + @CsvBindByName(column = "Density") private int density; - @CsvBindByName(column = "Size", required = false) + @CsvBindByName(column = "Size") private int size; - @CsvBindByName(column = "Weight", required = false) + @CsvBindByName(column = "Weight") private int weight; - @CsvCustomBindByName(column = "Overworld", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Overworld", converter = XtoBool.class) private boolean overworld; - @CsvCustomBindByName(column = "Nether", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "Nether", converter = XtoBool.class) private boolean nether; - @CsvCustomBindByName(column = "End", required = false, converter = XtoBool.class) + @CsvCustomBindByName(column = "End", converter = XtoBool.class) private boolean end; private int miny, maxy; @@ -528,6 +529,6 @@ public class Oremix { } public String getHeightcalced() { - return new String(this.miny + "-" + this.maxy); + return this.miny + "-" + this.maxy; } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/StringPaddingHack.java b/src/main/java/pers/gwyog/gtneioreplugin/util/StringPaddingHack.java index 59a55a82fa..0b1d391a08 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/StringPaddingHack.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/StringPaddingHack.java @@ -65,13 +65,13 @@ public class StringPaddingHack { /** * Pads strings with spaces so that they are of equal length and adds to that the number of spaces specified and up * to 3 if minExtraSpaces is below 3. Added spaces might be bold. - * + *

* Relies on the quirk of bold space characters being 1 pixel wider than regular space characters in the default * font renderer. * * @param strings List of strings * @param minExtraSpaces The minimum number of extra spaces to add - * @return List of strings padded with spaces to an equal length + * @return Array of strings padded with spaces to an equal length */ public static String[] padStrings(String[] strings, int minExtraSpaces) { int[] widths = getStringWidths(strings); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java b/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java index e80d972b17..346573e2a9 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/Veinrenamer.java @@ -1,14 +1,12 @@ package pers.gwyog.gtneioreplugin.util; import com.opencsv.bean.AbstractBeanField; -import com.opencsv.exceptions.CsvConstraintViolationException; -import com.opencsv.exceptions.CsvDataTypeMismatchException; public class Veinrenamer extends AbstractBeanField { @Override - protected Object convert(String value) throws CsvDataTypeMismatchException, CsvConstraintViolationException { - String ret = null; + protected Object convert(String value) { + String ret; CharSequence s = "/"; if (value.contains(s)) { diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java b/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java index 59dd82fa8e..f3426d53dd 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/XtoBool.java @@ -7,13 +7,12 @@ import org.apache.commons.beanutils.Converter; import org.apache.commons.beanutils.converters.BooleanConverter; import com.opencsv.bean.AbstractBeanField; -import com.opencsv.exceptions.CsvConstraintViolationException; import com.opencsv.exceptions.CsvDataTypeMismatchException; public class XtoBool extends AbstractBeanField { @Override - protected Object convert(String value) throws CsvDataTypeMismatchException, CsvConstraintViolationException { + protected Object convert(String value) throws CsvDataTypeMismatchException { if (value.isEmpty()) { return null; } -- cgit From 0e59b438c9ee1da685a109db139eb82b8fcf6084 Mon Sep 17 00:00:00 2001 From: glowredman <35727266+glowredman@users.noreply.github.com> Date: Sun, 30 Jul 2023 12:36:48 +0200 Subject: T9 Planets + new Textures (#35) * Add T9 planets ... and move Deep Dark to T10 * Update buildscript * Apply spotless * Make all six side use different icons * Apply spotless --- build.gradle | 162 ++++++++++++++------- .../plugin/block/BlockDimensionDisplay.java | 32 ++-- .../renderer/ItemDimensionDisplayRenderer.java | 3 +- .../pers/gwyog/gtneioreplugin/util/CSVMaker.java | 20 ++- .../gwyog/gtneioreplugin/util/DimensionHelper.java | 25 +++- .../pers/gwyog/gtneioreplugin/util/Oremix.java | 66 +++++++++ .../assets/gtneioreplugin/lang/en_US.lang | 6 + .../gtneioreplugin/textures/blocks/An_back.png | Bin 0 -> 314 bytes .../gtneioreplugin/textures/blocks/An_bottom.png | Bin 0 -> 305 bytes .../gtneioreplugin/textures/blocks/An_front.png | Bin 0 -> 309 bytes .../gtneioreplugin/textures/blocks/An_left.png | Bin 0 -> 311 bytes .../gtneioreplugin/textures/blocks/An_right.png | Bin 0 -> 307 bytes .../gtneioreplugin/textures/blocks/An_top.png | Bin 0 -> 308 bytes .../gtneioreplugin/textures/blocks/As_back.png | Bin 0 -> 495 bytes .../gtneioreplugin/textures/blocks/As_bottom.png | Bin 0 -> 554 bytes .../gtneioreplugin/textures/blocks/As_front.png | Bin 0 -> 535 bytes .../gtneioreplugin/textures/blocks/As_left.png | Bin 301 -> 527 bytes .../gtneioreplugin/textures/blocks/As_right.png | Bin 310 -> 506 bytes .../gtneioreplugin/textures/blocks/As_top.png | Bin 319 -> 548 bytes .../gtneioreplugin/textures/blocks/BC_back.png | Bin 0 -> 268 bytes .../gtneioreplugin/textures/blocks/BC_bottom.png | Bin 0 -> 280 bytes .../gtneioreplugin/textures/blocks/BC_front.png | Bin 0 -> 292 bytes .../gtneioreplugin/textures/blocks/BC_left.png | Bin 395 -> 262 bytes .../gtneioreplugin/textures/blocks/BC_right.png | Bin 413 -> 278 bytes .../gtneioreplugin/textures/blocks/BC_top.png | Bin 389 -> 254 bytes .../gtneioreplugin/textures/blocks/BE_back.png | Bin 0 -> 327 bytes .../gtneioreplugin/textures/blocks/BE_bottom.png | Bin 0 -> 329 bytes .../gtneioreplugin/textures/blocks/BE_front.png | Bin 0 -> 325 bytes .../gtneioreplugin/textures/blocks/BE_left.png | Bin 329 -> 322 bytes .../gtneioreplugin/textures/blocks/BE_right.png | Bin 319 -> 318 bytes .../gtneioreplugin/textures/blocks/BE_top.png | Bin 312 -> 317 bytes .../gtneioreplugin/textures/blocks/BF_back.png | Bin 0 -> 370 bytes .../gtneioreplugin/textures/blocks/BF_bottom.png | Bin 0 -> 393 bytes .../gtneioreplugin/textures/blocks/BF_front.png | Bin 0 -> 392 bytes .../gtneioreplugin/textures/blocks/BF_left.png | Bin 420 -> 386 bytes .../gtneioreplugin/textures/blocks/BF_right.png | Bin 462 -> 386 bytes .../gtneioreplugin/textures/blocks/BF_top.png | Bin 375 -> 390 bytes .../gtneioreplugin/textures/blocks/CB_back.png | Bin 0 -> 351 bytes .../gtneioreplugin/textures/blocks/CB_bottom.png | Bin 0 -> 337 bytes .../gtneioreplugin/textures/blocks/CB_front.png | Bin 0 -> 479 bytes .../gtneioreplugin/textures/blocks/CB_left.png | Bin 383 -> 424 bytes .../gtneioreplugin/textures/blocks/CB_right.png | Bin 383 -> 318 bytes .../gtneioreplugin/textures/blocks/CB_top.png | Bin 387 -> 414 bytes .../gtneioreplugin/textures/blocks/Ca_back.png | Bin 0 -> 301 bytes .../gtneioreplugin/textures/blocks/Ca_bottom.png | Bin 0 -> 300 bytes .../gtneioreplugin/textures/blocks/Ca_front.png | Bin 0 -> 301 bytes .../gtneioreplugin/textures/blocks/Ca_left.png | Bin 489 -> 300 bytes .../gtneioreplugin/textures/blocks/Ca_right.png | Bin 268 -> 316 bytes .../gtneioreplugin/textures/blocks/Ca_top.png | Bin 540 -> 299 bytes .../gtneioreplugin/textures/blocks/Ce_back.png | Bin 0 -> 343 bytes .../gtneioreplugin/textures/blocks/Ce_bottom.png | Bin 0 -> 333 bytes .../gtneioreplugin/textures/blocks/Ce_front.png | Bin 0 -> 330 bytes .../gtneioreplugin/textures/blocks/Ce_left.png | Bin 232 -> 340 bytes .../gtneioreplugin/textures/blocks/Ce_right.png | Bin 235 -> 335 bytes .../gtneioreplugin/textures/blocks/Ce_top.png | Bin 229 -> 335 bytes .../gtneioreplugin/textures/blocks/DD_back.png | Bin 0 -> 325 bytes .../gtneioreplugin/textures/blocks/DD_bottom.png | Bin 0 -> 332 bytes .../gtneioreplugin/textures/blocks/DD_front.png | Bin 0 -> 339 bytes .../gtneioreplugin/textures/blocks/DD_left.png | Bin 520 -> 342 bytes .../gtneioreplugin/textures/blocks/DD_right.png | Bin 471 -> 350 bytes .../gtneioreplugin/textures/blocks/DD_top.png | Bin 541 -> 331 bytes .../gtneioreplugin/textures/blocks/De_back.png | Bin 0 -> 259 bytes .../gtneioreplugin/textures/blocks/De_bottom.png | Bin 0 -> 268 bytes .../gtneioreplugin/textures/blocks/De_front.png | Bin 0 -> 259 bytes .../gtneioreplugin/textures/blocks/De_left.png | Bin 451 -> 265 bytes .../gtneioreplugin/textures/blocks/De_right.png | Bin 482 -> 263 bytes .../gtneioreplugin/textures/blocks/De_top.png | Bin 415 -> 248 bytes .../gtneioreplugin/textures/blocks/EA_back.png | Bin 0 -> 517 bytes .../gtneioreplugin/textures/blocks/EA_bottom.png | Bin 0 -> 575 bytes .../gtneioreplugin/textures/blocks/EA_front.png | Bin 0 -> 478 bytes .../gtneioreplugin/textures/blocks/EA_left.png | Bin 299 -> 553 bytes .../gtneioreplugin/textures/blocks/EA_right.png | Bin 449 -> 520 bytes .../gtneioreplugin/textures/blocks/EA_top.png | Bin 336 -> 554 bytes .../gtneioreplugin/textures/blocks/ED_back.png | Bin 0 -> 321 bytes .../gtneioreplugin/textures/blocks/ED_bottom.png | Bin 0 -> 326 bytes .../gtneioreplugin/textures/blocks/ED_front.png | Bin 0 -> 319 bytes .../gtneioreplugin/textures/blocks/ED_left.png | Bin 430 -> 327 bytes .../gtneioreplugin/textures/blocks/ED_right.png | Bin 445 -> 319 bytes .../gtneioreplugin/textures/blocks/ED_top.png | Bin 508 -> 338 bytes .../gtneioreplugin/textures/blocks/En_back.png | Bin 0 -> 452 bytes .../gtneioreplugin/textures/blocks/En_bottom.png | Bin 0 -> 524 bytes .../gtneioreplugin/textures/blocks/En_front.png | Bin 0 -> 392 bytes .../gtneioreplugin/textures/blocks/En_left.png | Bin 270 -> 396 bytes .../gtneioreplugin/textures/blocks/En_right.png | Bin 274 -> 410 bytes .../gtneioreplugin/textures/blocks/En_top.png | Bin 276 -> 528 bytes .../gtneioreplugin/textures/blocks/Eu_back.png | Bin 0 -> 497 bytes .../gtneioreplugin/textures/blocks/Eu_bottom.png | Bin 0 -> 464 bytes .../gtneioreplugin/textures/blocks/Eu_front.png | Bin 0 -> 517 bytes .../gtneioreplugin/textures/blocks/Eu_left.png | Bin 253 -> 510 bytes .../gtneioreplugin/textures/blocks/Eu_right.png | Bin 247 -> 481 bytes .../gtneioreplugin/textures/blocks/Eu_top.png | Bin 261 -> 503 bytes .../gtneioreplugin/textures/blocks/Ga_back.png | Bin 0 -> 510 bytes .../gtneioreplugin/textures/blocks/Ga_bottom.png | Bin 0 -> 524 bytes .../gtneioreplugin/textures/blocks/Ga_front.png | Bin 0 -> 457 bytes .../gtneioreplugin/textures/blocks/Ga_left.png | Bin 415 -> 492 bytes .../gtneioreplugin/textures/blocks/Ga_right.png | Bin 394 -> 490 bytes .../gtneioreplugin/textures/blocks/Ga_top.png | Bin 425 -> 528 bytes .../gtneioreplugin/textures/blocks/Ha_back.png | Bin 0 -> 402 bytes .../gtneioreplugin/textures/blocks/Ha_bottom.png | Bin 0 -> 389 bytes .../gtneioreplugin/textures/blocks/Ha_front.png | Bin 0 -> 398 bytes .../gtneioreplugin/textures/blocks/Ha_left.png | Bin 286 -> 394 bytes .../gtneioreplugin/textures/blocks/Ha_right.png | Bin 289 -> 398 bytes .../gtneioreplugin/textures/blocks/Ha_top.png | Bin 282 -> 393 bytes .../gtneioreplugin/textures/blocks/Ho_back.png | Bin 0 -> 268 bytes .../gtneioreplugin/textures/blocks/Ho_bottom.png | Bin 0 -> 267 bytes .../gtneioreplugin/textures/blocks/Ho_front.png | Bin 0 -> 258 bytes .../gtneioreplugin/textures/blocks/Ho_left.png | Bin 0 -> 261 bytes .../gtneioreplugin/textures/blocks/Ho_right.png | Bin 0 -> 262 bytes .../gtneioreplugin/textures/blocks/Ho_top.png | Bin 0 -> 265 bytes .../gtneioreplugin/textures/blocks/Io_back.png | Bin 0 -> 337 bytes .../gtneioreplugin/textures/blocks/Io_bottom.png | Bin 0 -> 342 bytes .../gtneioreplugin/textures/blocks/Io_front.png | Bin 0 -> 330 bytes .../gtneioreplugin/textures/blocks/Io_left.png | Bin 458 -> 340 bytes .../gtneioreplugin/textures/blocks/Io_right.png | Bin 454 -> 336 bytes .../gtneioreplugin/textures/blocks/Io_top.png | Bin 457 -> 340 bytes .../gtneioreplugin/textures/blocks/KB_back.png | Bin 0 -> 463 bytes .../gtneioreplugin/textures/blocks/KB_bottom.png | Bin 0 -> 465 bytes .../gtneioreplugin/textures/blocks/KB_front.png | Bin 0 -> 455 bytes .../gtneioreplugin/textures/blocks/KB_left.png | Bin 408 -> 447 bytes .../gtneioreplugin/textures/blocks/KB_right.png | Bin 424 -> 475 bytes .../gtneioreplugin/textures/blocks/KB_top.png | Bin 380 -> 493 bytes .../gtneioreplugin/textures/blocks/MB_back.png | Bin 0 -> 352 bytes .../gtneioreplugin/textures/blocks/MB_bottom.png | Bin 0 -> 466 bytes .../gtneioreplugin/textures/blocks/MB_front.png | Bin 0 -> 432 bytes .../gtneioreplugin/textures/blocks/MB_left.png | Bin 0 -> 444 bytes .../gtneioreplugin/textures/blocks/MB_right.png | Bin 0 -> 449 bytes .../gtneioreplugin/textures/blocks/MB_top.png | Bin 0 -> 408 bytes .../gtneioreplugin/textures/blocks/MM_back.png | Bin 0 -> 345 bytes .../gtneioreplugin/textures/blocks/MM_bottom.png | Bin 0 -> 335 bytes .../gtneioreplugin/textures/blocks/MM_front.png | Bin 0 -> 331 bytes .../gtneioreplugin/textures/blocks/MM_left.png | Bin 376 -> 348 bytes .../gtneioreplugin/textures/blocks/MM_right.png | Bin 440 -> 329 bytes .../gtneioreplugin/textures/blocks/MM_top.png | Bin 384 -> 343 bytes .../gtneioreplugin/textures/blocks/Ma_back.png | Bin 0 -> 341 bytes .../gtneioreplugin/textures/blocks/Ma_bottom.png | Bin 0 -> 325 bytes .../gtneioreplugin/textures/blocks/Ma_front.png | Bin 0 -> 305 bytes .../gtneioreplugin/textures/blocks/Ma_left.png | Bin 320 -> 317 bytes .../gtneioreplugin/textures/blocks/Ma_right.png | Bin 304 -> 325 bytes .../gtneioreplugin/textures/blocks/Ma_top.png | Bin 323 -> 325 bytes .../gtneioreplugin/textures/blocks/Me_back.png | Bin 0 -> 338 bytes .../gtneioreplugin/textures/blocks/Me_bottom.png | Bin 0 -> 317 bytes .../gtneioreplugin/textures/blocks/Me_front.png | Bin 0 -> 331 bytes .../gtneioreplugin/textures/blocks/Me_left.png | Bin 491 -> 343 bytes .../gtneioreplugin/textures/blocks/Me_right.png | Bin 456 -> 311 bytes .../gtneioreplugin/textures/blocks/Me_top.png | Bin 559 -> 335 bytes .../gtneioreplugin/textures/blocks/Mh_back.png | Bin 0 -> 309 bytes .../gtneioreplugin/textures/blocks/Mh_bottom.png | Bin 0 -> 302 bytes .../gtneioreplugin/textures/blocks/Mh_front.png | Bin 0 -> 307 bytes .../gtneioreplugin/textures/blocks/Mh_left.png | Bin 0 -> 263 bytes .../gtneioreplugin/textures/blocks/Mh_right.png | Bin 0 -> 250 bytes .../gtneioreplugin/textures/blocks/Mh_top.png | Bin 0 -> 299 bytes .../gtneioreplugin/textures/blocks/Mi_back.png | Bin 0 -> 283 bytes .../gtneioreplugin/textures/blocks/Mi_bottom.png | Bin 0 -> 272 bytes .../gtneioreplugin/textures/blocks/Mi_front.png | Bin 0 -> 275 bytes .../gtneioreplugin/textures/blocks/Mi_left.png | Bin 262 -> 277 bytes .../gtneioreplugin/textures/blocks/Mi_right.png | Bin 265 -> 277 bytes .../gtneioreplugin/textures/blocks/Mi_top.png | Bin 266 -> 267 bytes .../gtneioreplugin/textures/blocks/Mo_back.png | Bin 0 -> 433 bytes .../gtneioreplugin/textures/blocks/Mo_bottom.png | Bin 0 -> 360 bytes .../gtneioreplugin/textures/blocks/Mo_front.png | Bin 0 -> 334 bytes .../gtneioreplugin/textures/blocks/Mo_left.png | Bin 402 -> 309 bytes .../gtneioreplugin/textures/blocks/Mo_right.png | Bin 343 -> 426 bytes .../gtneioreplugin/textures/blocks/Mo_top.png | Bin 389 -> 341 bytes .../gtneioreplugin/textures/blocks/Ne_back.png | Bin 0 -> 271 bytes .../gtneioreplugin/textures/blocks/Ne_bottom.png | Bin 0 -> 267 bytes .../gtneioreplugin/textures/blocks/Ne_front.png | Bin 0 -> 286 bytes .../gtneioreplugin/textures/blocks/Ne_left.png | Bin 227 -> 265 bytes .../gtneioreplugin/textures/blocks/Ne_right.png | Bin 218 -> 287 bytes .../gtneioreplugin/textures/blocks/Ne_top.png | Bin 226 -> 272 bytes .../gtneioreplugin/textures/blocks/Np_back.png | Bin 0 -> 254 bytes .../gtneioreplugin/textures/blocks/Np_bottom.png | Bin 0 -> 221 bytes .../gtneioreplugin/textures/blocks/Np_front.png | Bin 0 -> 254 bytes .../gtneioreplugin/textures/blocks/Np_left.png | Bin 0 -> 220 bytes .../gtneioreplugin/textures/blocks/Np_right.png | Bin 0 -> 203 bytes .../gtneioreplugin/textures/blocks/Np_top.png | Bin 0 -> 223 bytes .../gtneioreplugin/textures/blocks/Ob_back.png | Bin 0 -> 282 bytes .../gtneioreplugin/textures/blocks/Ob_bottom.png | Bin 0 -> 289 bytes .../gtneioreplugin/textures/blocks/Ob_front.png | Bin 0 -> 290 bytes .../gtneioreplugin/textures/blocks/Ob_left.png | Bin 411 -> 288 bytes .../gtneioreplugin/textures/blocks/Ob_right.png | Bin 349 -> 286 bytes .../gtneioreplugin/textures/blocks/Ob_top.png | Bin 345 -> 298 bytes .../gtneioreplugin/textures/blocks/Ow_back.png | Bin 0 -> 600 bytes .../gtneioreplugin/textures/blocks/Ow_bottom.png | Bin 0 -> 279 bytes .../gtneioreplugin/textures/blocks/Ow_front.png | Bin 0 -> 358 bytes .../gtneioreplugin/textures/blocks/Ow_left.png | Bin 229 -> 557 bytes .../gtneioreplugin/textures/blocks/Ow_right.png | Bin 222 -> 547 bytes .../gtneioreplugin/textures/blocks/Ow_top.png | Bin 241 -> 575 bytes .../gtneioreplugin/textures/blocks/Ph_back.png | Bin 0 -> 316 bytes .../gtneioreplugin/textures/blocks/Ph_bottom.png | Bin 0 -> 344 bytes .../gtneioreplugin/textures/blocks/Ph_front.png | Bin 0 -> 332 bytes .../gtneioreplugin/textures/blocks/Ph_left.png | Bin 208 -> 307 bytes .../gtneioreplugin/textures/blocks/Ph_right.png | Bin 368 -> 327 bytes .../gtneioreplugin/textures/blocks/Ph_top.png | Bin 381 -> 327 bytes .../gtneioreplugin/textures/blocks/Pl_back.png | Bin 0 -> 384 bytes .../gtneioreplugin/textures/blocks/Pl_bottom.png | Bin 0 -> 361 bytes .../gtneioreplugin/textures/blocks/Pl_front.png | Bin 0 -> 384 bytes .../gtneioreplugin/textures/blocks/Pl_left.png | Bin 285 -> 380 bytes .../gtneioreplugin/textures/blocks/Pl_right.png | Bin 314 -> 389 bytes .../gtneioreplugin/textures/blocks/Pl_top.png | Bin 423 -> 372 bytes .../gtneioreplugin/textures/blocks/Pr_back.png | Bin 0 -> 395 bytes .../gtneioreplugin/textures/blocks/Pr_bottom.png | Bin 0 -> 402 bytes .../gtneioreplugin/textures/blocks/Pr_front.png | Bin 0 -> 396 bytes .../gtneioreplugin/textures/blocks/Pr_left.png | Bin 304 -> 377 bytes .../gtneioreplugin/textures/blocks/Pr_right.png | Bin 306 -> 416 bytes .../gtneioreplugin/textures/blocks/Pr_top.png | Bin 251 -> 485 bytes .../gtneioreplugin/textures/blocks/Ra_back.png | Bin 0 -> 588 bytes .../gtneioreplugin/textures/blocks/Ra_bottom.png | Bin 0 -> 445 bytes .../gtneioreplugin/textures/blocks/Ra_front.png | Bin 0 -> 548 bytes .../gtneioreplugin/textures/blocks/Ra_left.png | Bin 224 -> 495 bytes .../gtneioreplugin/textures/blocks/Ra_right.png | Bin 229 -> 518 bytes .../gtneioreplugin/textures/blocks/Ra_top.png | Bin 210 -> 524 bytes .../gtneioreplugin/textures/blocks/Rb_back.png | Bin 0 -> 481 bytes .../gtneioreplugin/textures/blocks/Rb_bottom.png | Bin 0 -> 451 bytes .../gtneioreplugin/textures/blocks/Rb_front.png | Bin 0 -> 486 bytes .../gtneioreplugin/textures/blocks/Rb_left.png | Bin 221 -> 411 bytes .../gtneioreplugin/textures/blocks/Rb_right.png | Bin 214 -> 460 bytes .../gtneioreplugin/textures/blocks/Rb_top.png | Bin 221 -> 438 bytes .../gtneioreplugin/textures/blocks/Se_back.png | Bin 0 -> 330 bytes .../gtneioreplugin/textures/blocks/Se_bottom.png | Bin 0 -> 343 bytes .../gtneioreplugin/textures/blocks/Se_front.png | Bin 0 -> 339 bytes .../gtneioreplugin/textures/blocks/Se_left.png | Bin 0 -> 348 bytes .../gtneioreplugin/textures/blocks/Se_right.png | Bin 0 -> 342 bytes .../gtneioreplugin/textures/blocks/Se_top.png | Bin 0 -> 340 bytes .../gtneioreplugin/textures/blocks/TE_back.png | Bin 0 -> 402 bytes .../gtneioreplugin/textures/blocks/TE_bottom.png | Bin 0 -> 449 bytes .../gtneioreplugin/textures/blocks/TE_front.png | Bin 0 -> 459 bytes .../gtneioreplugin/textures/blocks/TE_left.png | Bin 343 -> 545 bytes .../gtneioreplugin/textures/blocks/TE_right.png | Bin 353 -> 511 bytes .../gtneioreplugin/textures/blocks/TE_top.png | Bin 422 -> 558 bytes .../gtneioreplugin/textures/blocks/TF_back.png | Bin 0 -> 379 bytes .../gtneioreplugin/textures/blocks/TF_bottom.png | Bin 0 -> 312 bytes .../gtneioreplugin/textures/blocks/TF_front.png | Bin 0 -> 337 bytes .../gtneioreplugin/textures/blocks/TF_left.png | Bin 219 -> 314 bytes .../gtneioreplugin/textures/blocks/TF_right.png | Bin 222 -> 393 bytes .../gtneioreplugin/textures/blocks/TF_top.png | Bin 219 -> 271 bytes .../gtneioreplugin/textures/blocks/Ti_back.png | Bin 0 -> 280 bytes .../gtneioreplugin/textures/blocks/Ti_bottom.png | Bin 0 -> 264 bytes .../gtneioreplugin/textures/blocks/Ti_front.png | Bin 0 -> 268 bytes .../gtneioreplugin/textures/blocks/Ti_left.png | Bin 206 -> 267 bytes .../gtneioreplugin/textures/blocks/Ti_right.png | Bin 215 -> 271 bytes .../gtneioreplugin/textures/blocks/Ti_top.png | Bin 223 -> 251 bytes .../gtneioreplugin/textures/blocks/Tr_back.png | Bin 0 -> 315 bytes .../gtneioreplugin/textures/blocks/Tr_bottom.png | Bin 0 -> 329 bytes .../gtneioreplugin/textures/blocks/Tr_front.png | Bin 0 -> 322 bytes .../gtneioreplugin/textures/blocks/Tr_left.png | Bin 262 -> 331 bytes .../gtneioreplugin/textures/blocks/Tr_right.png | Bin 291 -> 322 bytes .../gtneioreplugin/textures/blocks/Tr_top.png | Bin 312 -> 314 bytes .../gtneioreplugin/textures/blocks/VA_back.png | Bin 0 -> 460 bytes .../gtneioreplugin/textures/blocks/VA_bottom.png | Bin 0 -> 539 bytes .../gtneioreplugin/textures/blocks/VA_front.png | Bin 0 -> 327 bytes .../gtneioreplugin/textures/blocks/VA_left.png | Bin 351 -> 526 bytes .../gtneioreplugin/textures/blocks/VA_right.png | Bin 440 -> 305 bytes .../gtneioreplugin/textures/blocks/VA_top.png | Bin 284 -> 441 bytes .../gtneioreplugin/textures/blocks/VB_back.png | Bin 0 -> 425 bytes .../gtneioreplugin/textures/blocks/VB_bottom.png | Bin 0 -> 390 bytes .../gtneioreplugin/textures/blocks/VB_front.png | Bin 0 -> 404 bytes .../gtneioreplugin/textures/blocks/VB_left.png | Bin 217 -> 382 bytes .../gtneioreplugin/textures/blocks/VB_right.png | Bin 224 -> 390 bytes .../gtneioreplugin/textures/blocks/VB_top.png | Bin 230 -> 340 bytes .../gtneioreplugin/textures/blocks/Ve_back.png | Bin 0 -> 295 bytes .../gtneioreplugin/textures/blocks/Ve_bottom.png | Bin 0 -> 283 bytes .../gtneioreplugin/textures/blocks/Ve_front.png | Bin 0 -> 285 bytes .../gtneioreplugin/textures/blocks/Ve_left.png | Bin 407 -> 293 bytes .../gtneioreplugin/textures/blocks/Ve_right.png | Bin 399 -> 275 bytes .../gtneioreplugin/textures/blocks/Ve_top.png | Bin 382 -> 286 bytes 265 files changed, 235 insertions(+), 79 deletions(-) create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/An_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/An_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/An_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/An_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/An_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/An_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/As_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/As_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/As_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/BC_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/BC_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/BC_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/BE_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/BE_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/BE_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/BF_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/BF_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/BF_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/CB_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/CB_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/CB_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/DD_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/DD_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/DD_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/De_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/De_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/De_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/EA_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/EA_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/EA_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/ED_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/ED_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/ED_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/En_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/En_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/En_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Io_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Io_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Io_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/KB_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/KB_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/KB_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/MB_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/MB_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/MB_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/MB_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/MB_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/MB_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/MM_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/MM_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/MM_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Me_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Me_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Me_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Np_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Np_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Np_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Np_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Np_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Np_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Se_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Se_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Se_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Se_left.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Se_right.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Se_top.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/TE_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/TE_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/TE_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/TF_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/TF_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/TF_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/VA_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/VA_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/VA_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/VB_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/VB_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/VB_front.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_back.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_bottom.png create mode 100644 src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_front.png diff --git a/build.gradle b/build.gradle index 3930990407..d90330a85c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1685785062 +//version: 1689878047 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -69,7 +69,7 @@ plugins { id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version id 'com.modrinth.minotaur' version '2.+' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false - id 'com.gtnewhorizons.retrofuturagradle' version '1.3.14' + id 'com.gtnewhorizons.retrofuturagradle' version '1.3.21' } print("You might want to check out './gradlew :faq' if your build fails.\n") @@ -115,6 +115,8 @@ propertyDefaultIfUnset("usesMixinDebug", project.usesMixins) propertyDefaultIfUnset("forceEnableMixins", false) propertyDefaultIfUnset("channel", "stable") propertyDefaultIfUnset("mappingsVersion", "12") +propertyDefaultIfUnset("usesMavenPublishing", true) +propertyDefaultIfUnset("mavenPublishUrl", "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases") propertyDefaultIfUnset("modrinthProjectId", "") propertyDefaultIfUnset("modrinthRelations", "") propertyDefaultIfUnset("curseForgeProjectId", "") @@ -357,7 +359,27 @@ catch (Exception ignored) { String identifiedVersion String versionOverride = System.getenv("VERSION") ?: null try { - identifiedVersion = versionOverride == null ? gitVersion() : versionOverride + // Produce a version based on the tag, or for branches something like 0.2.2-configurable-maven-and-extras.38+43090270b6-dirty + if (versionOverride == null) { + def gitDetails = versionDetails() + def isDirty = gitVersion().endsWith(".dirty") // No public API for this, isCleanTag has a different meaning + String branchName = gitDetails.branchName ?: (System.getenv('GIT_BRANCH') ?: 'git') + if (branchName.startsWith('origin/')) { + branchName = branchName.minus('origin/') + } + branchName = branchName.replaceAll("[^a-zA-Z0-9-]+", "-") // sanitize branch names for semver + identifiedVersion = gitDetails.lastTag ?: '${gitDetails.gitHash}' + if (gitDetails.commitDistance > 0) { + identifiedVersion += "-${branchName}.${gitDetails.commitDistance}+${gitDetails.gitHash}" + if (isDirty) { + identifiedVersion += "-dirty" + } + } else if (isDirty) { + identifiedVersion += "-${branchName}+${gitDetails.gitHash}-dirty" + } + } else { + identifiedVersion = versionOverride + } } catch (Exception ignored) { out.style(Style.Failure).text( @@ -465,10 +487,19 @@ sourceSets { } } -if (file('addon.gradle').exists()) { +if (file('addon.gradle.kts').exists()) { + apply from: 'addon.gradle.kts' +} else if (file('addon.gradle').exists()) { apply from: 'addon.gradle' } +// File for local tweaks not commited to Git +if (file('addon.local.gradle.kts').exists()) { + apply from: 'addon.local.gradle.kts' +} else if (file('addon.local.gradle').exists()) { + apply from: 'addon.local.gradle' +} + // Allow unsafe repos but warn repositories.configureEach { repo -> if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) { @@ -479,7 +510,14 @@ repositories.configureEach { repo -> } } -apply from: 'repositories.gradle' +if (file('repositories.gradle.kts').exists()) { + apply from: 'repositories.gradle.kts' +} else if (file('repositories.gradle').exists()) { + apply from: 'repositories.gradle' +} else { + logger.error("Neither repositories.gradle.kts nor repositories.gradle was found, make sure you extracted the full ExampleMod template.") + throw new RuntimeException("Missing repositories.gradle[.kts]") +} configurations { runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable) @@ -585,7 +623,7 @@ dependencies { } } if (usesMixins.toBoolean()) { - implementation(mixinProviderSpec) + implementation(modUtils.enableMixins(mixinProviderSpec)) } else if (forceEnableMixins.toBoolean()) { runtimeOnlyNonPublishable(mixinProviderSpec) } @@ -611,12 +649,34 @@ configurations.all { } } -apply from: 'dependencies.gradle' +dependencies { + constraints { + def minGtnhLibVersion = "0.0.13" + implementation("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") { + because("fixes duplicate mod errors in java 17 configurations using old gtnhlib") + } + runtimeOnly("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") { + because("fixes duplicate mod errors in java 17 configurations using old gtnhlib") + } + devOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") { + because("fixes duplicate mod errors in java 17 configurations using old gtnhlib") + } + runtimeOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") { + because("fixes duplicate mod errors in java 17 configurations using old gtnhlib") + } + } +} + +if (file('dependencies.gradle.kts').exists()) { + apply from: 'dependencies.gradle.kts' +} else if (file('dependencies.gradle').exists()) { + apply from: 'dependencies.gradle' +} else { + logger.error("Neither dependencies.gradle.kts nor dependencies.gradle was found, make sure you extracted the full ExampleMod template.") + throw new RuntimeException("Missing dependencies.gradle[.kts]") +} def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' -def mixinTmpDir = buildDir.path + File.separator + 'tmp' + File.separator + 'mixins' -def refMap = "${mixinTmpDir}" + File.separator + mixingConfigRefMap -def mixinSrg = "${mixinTmpDir}" + File.separator + "mixins.srg" tasks.register('generateAssets') { group = "GTNH Buildscript" @@ -648,46 +708,17 @@ tasks.register('generateAssets') { } if (usesMixins.toBoolean()) { - tasks.named("reobfJar", ReobfuscatedJar).configure { - extraSrgFiles.from(mixinSrg) - } - tasks.named("processResources").configure { dependsOn("generateAssets") } tasks.named("compileJava", JavaCompile).configure { - doFirst { - new File(mixinTmpDir).mkdirs() - } options.compilerArgs += [ - "-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}", - "-AoutSrgFile=${mixinSrg}", - "-AoutRefMapFile=${refMap}", // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code "-XDenableSunApiLintControl", "-XDignore.symbol.file" ] } - - pluginManager.withPlugin('org.jetbrains.kotlin.kapt') { - kapt { - correctErrorTypes = true - javacOptions { - option("-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}") - option("-AoutSrgFile=$mixinSrg") - option("-AoutRefMapFile=$refMap") - } - } - tasks.configureEach { task -> - if (task.name == "kaptKotlin") { - task.doFirst { - new File(mixinTmpDir).mkdirs() - } - } - } - } - } tasks.named("processResources", ProcessResources).configure { @@ -705,7 +736,6 @@ tasks.named("processResources", ProcessResources).configure { } if (usesMixins.toBoolean()) { - from refMap dependsOn("compileJava", "compileScala") } } @@ -724,13 +754,13 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies" } dependencies { - def lwjgl3ifyVersion = '1.3.5' + def lwjgl3ifyVersion = '1.4.0' def asmVersion = '9.4' if (modId != 'lwjgl3ify') { java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") } if (modId != 'hodgepodge') { - java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.13') + java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.19') } java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false} @@ -979,6 +1009,9 @@ idea { } } runConfigurations { + "0. Build and Test"(Gradle) { + taskNames = ["build"] + } "1. Run Client"(Gradle) { taskNames = ["runClient"] } @@ -1098,6 +1131,11 @@ tasks.named("processIdeaSettings").configure { dependsOn("injectTags") } +tasks.named("ideVirtualMainClasses").configure { + // Make IntelliJ "Build project" build the mod jars + dependsOn("jar", "reobfJar", "spotlessCheck") +} + // workaround variable hiding in pom processing def projectConfigs = project.configurations @@ -1118,12 +1156,14 @@ publishing { } repositories { - maven { - url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases" - allowInsecureProtocol = true - credentials { - username = System.getenv("MAVEN_USER") ?: "NONE" - password = System.getenv("MAVEN_PASSWORD") ?: "NONE" + if (usesMavenPublishing.toBoolean()) { + maven { + url = mavenPublishUrl + allowInsecureProtocol = mavenPublishUrl.startsWith("http://") // Mostly for the GTNH maven + credentials { + username = System.getenv("MAVEN_USER") ?: "NONE" + password = System.getenv("MAVEN_PASSWORD") ?: "NONE" + } } } } @@ -1238,7 +1278,7 @@ def addCurseForgeRelation(String type, String name) { // Updating -def buildscriptGradleVersion = "8.1.1" +def buildscriptGradleVersion = "8.2.1" tasks.named('wrapper', Wrapper).configure { gradleVersion = buildscriptGradleVersion @@ -1344,8 +1384,14 @@ boolean isNewBuildScriptVersionAvailable() { String currentBuildScript = getFile("build.gradle").getText() String currentBuildScriptHash = getVersionHash(currentBuildScript) - String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText() - String availableBuildScriptHash = getVersionHash(availableBuildScript) + String availableBuildScriptHash + try { + String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText() + availableBuildScriptHash = getVersionHash(availableBuildScript) + } catch (IOException e) { + logger.warn("Could not check for buildscript update availability: {}", e.message) + return false + } boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash return !isUpToDate @@ -1510,3 +1556,17 @@ def getSecondaryArtifacts() { if (apiPackage) secondaryArtifacts += [apiJar] return secondaryArtifacts } + +// For easier scripting of things that require variables defined earlier in the buildscript +if (file('addon.late.gradle.kts').exists()) { + apply from: 'addon.late.gradle.kts' +} else if (file('addon.late.gradle').exists()) { + apply from: 'addon.late.gradle' +} + +// File for local tweaks not commited to Git +if (file('addon.late.local.gradle.kts').exists()) { + apply from: 'addon.late.local.gradle.kts' +} else if (file('addon.late.local.gradle').exists()) { + apply from: 'addon.late.local.gradle' +} diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/BlockDimensionDisplay.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/BlockDimensionDisplay.java index 9e5ab1885c..7d3b1eb5bc 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/BlockDimensionDisplay.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/block/BlockDimensionDisplay.java @@ -1,12 +1,12 @@ package pers.gwyog.gtneioreplugin.plugin.block; -import static pers.gwyog.gtneioreplugin.plugin.renderer.ItemDimensionDisplayRenderer.getPrefix; - import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.util.EnumFacing; import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; + +import pers.gwyog.gtneioreplugin.plugin.renderer.ItemDimensionDisplayRenderer; public class BlockDimensionDisplay extends Block { @@ -14,38 +14,34 @@ public class BlockDimensionDisplay extends Block { @SuppressWarnings("unused") public long getDimensionRocketTier() { - return dimensionRocketTier; + return this.dimensionRocketTier; } private final long dimensionRocketTier; - private IIcon iconTop; - private IIcon iconRight; - private IIcon iconLeft; + private final IIcon[] icons = new IIcon[6]; public BlockDimensionDisplay(String dimension) { super(Material.rock); this.dimension = dimension; - this.dimensionRocketTier = getPrefix(dimension); + this.dimensionRocketTier = ItemDimensionDisplayRenderer.getPrefix(dimension); } @Override public IIcon getIcon(int side, int meta) { - EnumFacing direction = EnumFacing.getFront(side); - return switch (direction) { - case NORTH, SOUTH -> iconRight; - case WEST, EAST -> iconLeft; - default -> iconTop; - }; + return this.icons[MathHelper.clamp_int(side, 0, 5)]; } @Override public void registerBlockIcons(IIconRegister iconRegister) { - this.iconTop = iconRegister.registerIcon("gtneioreplugin:" + dimension + "_top"); - this.iconRight = iconRegister.registerIcon("gtneioreplugin:" + dimension + "_right"); - this.iconLeft = iconRegister.registerIcon("gtneioreplugin:" + dimension + "_left"); + this.icons[0] = iconRegister.registerIcon("gtneioreplugin:" + dimension + "_bottom"); + this.icons[1] = iconRegister.registerIcon("gtneioreplugin:" + dimension + "_top"); + this.icons[2] = iconRegister.registerIcon("gtneioreplugin:" + dimension + "_back"); + this.icons[3] = iconRegister.registerIcon("gtneioreplugin:" + dimension + "_front"); + this.icons[4] = iconRegister.registerIcon("gtneioreplugin:" + dimension + "_left"); + this.icons[5] = iconRegister.registerIcon("gtneioreplugin:" + dimension + "_right"); } public String getDimension() { - return dimension; + return this.dimension; } } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java b/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java index 0c7617645c..0c670a6d3d 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/plugin/renderer/ItemDimensionDisplayRenderer.java @@ -70,7 +70,8 @@ public class ItemDimensionDisplayRenderer implements IItemRenderer { case "Pr", "Tr" -> 6L; case "Ha", "KB", "MM", "Pl" -> 7L; case "BC", "BE", "BF", "CB", "TE", "VB" -> 8L; - case "DD" -> 9L; + case "An", "Ho", "Np", "Mh", "MB", "Se" -> 9L; + case "DD" -> 10L; default -> -1L; }; } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java b/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java index d19a1fdff9..1a56044219 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/CSVMaker.java @@ -64,6 +64,7 @@ public class CSVMaker implements Runnable { oremix.setOreName(oreLayer.oreGenName.split("\\.")[2]); oremix.setHeight(oreLayer.worldGenHeightRange); oremix.setDensity(oreLayer.amountPerChunk); + oremix.an = Dims.contains("An"); oremix.as = Dims.contains("As"); oremix.bc = Dims.contains("BC"); oremix.be = Dims.contains("BE"); @@ -78,17 +79,22 @@ public class CSVMaker implements Runnable { oremix.eu = Dims.contains("Eu"); oremix.ga = Dims.contains("Ga"); oremix.ha = Dims.contains("Ha"); + oremix.ho = Dims.contains("Ho"); oremix.io = Dims.contains("Io"); oremix.kb = Dims.contains("KB"); oremix.make = Dims.contains("MM"); oremix.ma = Dims.contains("Ma"); + oremix.mb = Dims.contains("MB"); oremix.me = Dims.contains("Me"); + oremix.mh = Dims.contains("Mh"); oremix.mi = Dims.contains("Mi"); oremix.mo = Dims.contains("Mo"); + oremix.np = Dims.contains("Np"); oremix.ob = Dims.contains("Ob"); oremix.ph = Dims.contains("Ph"); oremix.pl = Dims.contains("Pl"); oremix.pr = Dims.contains("Pr"); + oremix.se = Dims.contains("Se"); oremix.tcetie = Dims.contains("TE"); oremix.tf = Dims.contains("TF"); oremix.ti = Dims.contains("Ti"); @@ -106,14 +112,14 @@ public class CSVMaker implements Runnable { BufferedWriter one = Files.newBufferedWriter(Paths.get(GTNEIOrePlugin.CSVnameSmall)); ColumnPositionMappingStrategy strat = new ColumnPositionMappingStrategy<>(); strat.setType(Oremix.class); - String[] columns = "ORENAME,mix,DENSITY,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie" + String[] columns = "ORENAME,mix,DENSITY,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie,an,ho,np,mh,mb,se" .split("\\,"); strat.setColumnMapping(columns); StatefulBeanToCsv beanToCsv = new StatefulBeanToCsvBuilder(one) .withQuotechar(CSVWriter.NO_QUOTE_CHARACTER).withMappingStrategy(strat).build(); List towrite = Combsort(OreVeins); one.write( - "Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E"); + "Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E,Anubis,Horus,Neper,Maahes,Mehen Belt,Seth"); one.newLine(); beanToCsv.write(towrite); one.flush(); @@ -156,6 +162,7 @@ public class CSVMaker implements Runnable { + Integer.toString(oreLayer.Meta[2]) + "|" + Integer.toString(oreLayer.Meta[3])); + oremix.an = Dims.contains("An"); oremix.as = Dims.contains("As"); oremix.bc = Dims.contains("BC"); oremix.be = Dims.contains("BE"); @@ -170,17 +177,22 @@ public class CSVMaker implements Runnable { oremix.eu = Dims.contains("Eu"); oremix.ga = Dims.contains("Ga"); oremix.ha = Dims.contains("Ha"); + oremix.ho = Dims.contains("Ho"); oremix.io = Dims.contains("Io"); oremix.kb = Dims.contains("KB"); oremix.make = Dims.contains("MM"); oremix.ma = Dims.contains("Ma"); + oremix.mb = Dims.contains("MB"); oremix.me = Dims.contains("Me"); + oremix.mh = Dims.contains("Mh"); oremix.mi = Dims.contains("Mi"); oremix.mo = Dims.contains("Mo"); + oremix.np = Dims.contains("Np"); oremix.ob = Dims.contains("Ob"); oremix.ph = Dims.contains("Ph"); oremix.pl = Dims.contains("Pl"); oremix.pr = Dims.contains("Pr"); + oremix.se = Dims.contains("Se"); oremix.tcetie = Dims.contains("TE"); oremix.tf = Dims.contains("TF"); oremix.ti = Dims.contains("Ti"); @@ -198,14 +210,14 @@ public class CSVMaker implements Runnable { BufferedWriter one = Files.newBufferedWriter(Paths.get(GTNEIOrePlugin.CSVname)); ColumnPositionMappingStrategy strat = new ColumnPositionMappingStrategy<>(); strat.setType(Oremix.class); - String[] columns = "ORENAME,PRIMARY,SECONDARY,INBETWEEN,AROUND,mix,TIER,HEIGHT,DENSITY,SIZE,WEIGHT,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie" + String[] columns = "ORENAME,PRIMARY,SECONDARY,INBETWEEN,AROUND,mix,TIER,HEIGHT,DENSITY,SIZE,WEIGHT,overworld,nether,end,ea,tf,mo,ma,ph,de,as,ce,eu,ga,ca,io,ve,me,en,ti,mi,ob,pr,tr,pl,kb,ha,make,dd,cb,vb,bc,be,bf,tcetie,an,ho,np,mh,mb,se" .split("\\,"); strat.setColumnMapping(columns); StatefulBeanToCsv beanToCsv = new StatefulBeanToCsvBuilder(one) .withQuotechar(CSVWriter.NO_QUOTE_CHARACTER).withMappingStrategy(strat).build(); List towrite = Combsort(OreVeins); one.write( - "Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E"); + "Ore Name,Primary,Secondary,Inbetween,Around,ID,Tier,Height,Density,Size,Weight,Overworld,Nether,End,End Asteroids,Twilight Forest,Moon,Mars,Phobos,Deimos,Asteroids,Ceres,Europa,Ganymede,Callisto,Io,Venus,Mercury,Enceladus,Titan,Miranda,Oberon,Proteus,Triton,Pluto,Kuiper Belt,Haumea,Makemake,Deep Dark,Centauri Bb,Vega B,Barnard C,Barnard E,Barnard F,T Ceti E,Anubis,Horus,Neper,Maahes,Mehen Belt,Seth"); one.newLine(); beanToCsv.write(towrite); one.flush(); diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java index 02ad143dd4..78224dc5ae 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -30,12 +30,18 @@ public class DimensionHelper { "GalaxySpace_Haumea", "GalaxySpace_Kuiperbelt", "GalaxySpace_MakeMake", "GalaxySpace_Pluto", // T8 "GalaxySpace_BarnardC", "GalaxySpace_BarnardE", "GalaxySpace_BarnardF", "GalaxySpace_CentauriA", - "GalaxySpace_TcetiE", "Underdark", "GalaxySpace_VegaB", }; + "GalaxySpace_TcetiE", "GalaxySpace_VegaB", + // T9 + "GalacticraftAmunRa_Anubis", "GalacticraftAmunRa_Horus", "GalacticraftAmunRa_Maahes", + "GalacticraftAmunRa_Mehen Belt", "GalacticraftAmunRa_Neper", "GalacticraftAmunRa_Seth", + // T10 + "Underdark", }; public static final String[] DimNameTrimmed = Arrays.stream(DimName) .map( n -> n.replaceAll("GalacticraftCore_", "").replaceAll("GalacticraftMars_", "") - .replaceAll("GalaxySpace_", "").replaceAll("Vanilla_", "Vanilla ")) + .replaceAll("GalaxySpace_", "").replaceAll("GalacticraftAmunRa_", "") + .replaceAll("Vanilla_", "Vanilla ")) .toArray(String[]::new); public static final String[] DimNameDisplayed = { // first 2 letters if one word else 1 letter of every word, except @@ -83,10 +89,18 @@ public class DimensionHelper { "BC", // GalaxySpace_BarnardC "BE", // GalaxySpace_BarnardE "BF", // GalaxySpace_BarnardF - "CB", // GalaxySpace_CentauriA is actually αCentauri Bb + "CB", // GalaxySpace_CentauriA is actually α Centauri Bb "TE", // GalaxySpace_TcetiE - "DD", // Underdark "VB", // GalaxySpace_VegaB + // T9 + "An", // GalacticraftAmunRa_Anubis + "Ho", // GalacticraftAmunRa_Horus + "Mh", // GalacticraftAmunRa_Maahes + "MB", // GalacticraftAmunRa_Mehen Belt + "Np", // GalacticraftAmunRa_Neper + "Se", // GalacticraftAmunRa_Seth + // T10 + "DD", // Underdark }; private static final HashMap> tooltipBuffer = new HashMap<>(); @@ -108,7 +122,8 @@ public class DimensionHelper { case "Proteus", "Triton" -> "T6: " + s; case "Haumea", "Kuiperbelt", "MakeMake", "Pluto" -> "T7: " + s; case "BarnardC", "BarnardE", "BarnardF", "CentauriA", "TcetiE", "VegaB" -> "T8: " + s; - case "Underdark" -> "T9: " + s; + case "Anubis", "Horus", "Maahes", "Mehen Belt", "Neper", "Seth" -> "T9: " + s; + case "Underdark" -> "T10: " + s; default -> s; }; diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java b/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java index d17e020db7..401cadc09f 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/Oremix.java @@ -99,6 +99,24 @@ public class Oremix { @CsvCustomBindByName(column = "T Ceti E", converter = XtoBool.class) public boolean tcetie; + @CsvCustomBindByName(column = "Anubis", required = false, converter = XtoBool.class) + public boolean an; + + @CsvCustomBindByName(column = "Horus", required = false, converter = XtoBool.class) + public boolean ho; + + @CsvCustomBindByName(column = "Neper", required = false, converter = XtoBool.class) + public boolean np; + + @CsvCustomBindByName(column = "Maahes", required = false, converter = XtoBool.class) + public boolean mh; + + @CsvCustomBindByName(column = "Mehen Belt", required = false, converter = XtoBool.class) + public boolean mb; + + @CsvCustomBindByName(column = "Seth", required = false, converter = XtoBool.class) + public boolean se; + @CsvCustomBindByName(column = "Ore Name", required = true, converter = Veinrenamer.class) private String oreName; @@ -393,6 +411,54 @@ public class Oremix { this.tcetie = tcetie; } + public boolean isAn() { + return an; + } + + public void setAn(boolean an) { + this.an = an; + } + + public boolean isHo() { + return ho; + } + + public void setHo(boolean ho) { + this.ho = ho; + } + + public boolean isNp() { + return np; + } + + public void setNp(boolean np) { + this.np = np; + } + + public boolean isMh() { + return mh; + } + + public void setMh(boolean mh) { + this.mh = mh; + } + + public boolean isMb() { + return mb; + } + + public void setMb(boolean mb) { + this.mb = mb; + } + + public boolean isSe() { + return se; + } + + public void setSe(boolean se) { + this.se = se; + } + public String getOreName() { return this.oreName; } diff --git a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang index e55dedc668..8f629b5893 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang @@ -75,6 +75,12 @@ gtnop.world.BarnardC=Barnard C gtnop.world.BarnardE=Barnard E gtnop.world.BarnardF=Barnard F gtnop.world.TcetiE=T Ceti E +gtnop.world.Anubis=Anubis +gtnop.world.Mehen Belt=Mehen Belt +gtnop.world.Horus=Horus +gtnop.world.Maahes=Maahes +gtnop.world.Neper=Neper +gtnop.world.Seth=Seth gtnop.world.Underdark=Deep Dark diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/An_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/An_back.png new file mode 100644 index 0000000000..f2d08d0fdb Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/An_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/An_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/An_bottom.png new file mode 100644 index 0000000000..f8d55a86d4 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/An_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/An_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/An_front.png new file mode 100644 index 0000000000..a1705da804 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/An_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/An_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/An_left.png new file mode 100644 index 0000000000..f542adf34e Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/An_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/An_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/An_right.png new file mode 100644 index 0000000000..e6588b0d94 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/An_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/An_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/An_top.png new file mode 100644 index 0000000000..bbd74fdeba Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/An_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/As_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_back.png new file mode 100644 index 0000000000..61ed0f9cb0 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/As_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_bottom.png new file mode 100644 index 0000000000..39c99cf717 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/As_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_front.png new file mode 100644 index 0000000000..e624c07c5f Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/As_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_left.png index c8a5799ea7..7a64cbc905 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/As_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/As_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_right.png index a455f19fb2..f4b0df9941 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/As_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/As_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_top.png index cb20e4040b..98302080d3 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/As_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/As_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_back.png new file mode 100644 index 0000000000..f0a18820b1 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_bottom.png new file mode 100644 index 0000000000..ee1a36f5ec Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_front.png new file mode 100644 index 0000000000..d899be871f Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_left.png index 5cbf4ca363..b183b6e8fa 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_right.png index f7c224e81a..7b47de7bc7 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_top.png index 4db601b87c..1d0cc9daa5 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BC_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_back.png new file mode 100644 index 0000000000..f1339bbe14 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_bottom.png new file mode 100644 index 0000000000..468a07f371 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_front.png new file mode 100644 index 0000000000..87d20dcc9c Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_left.png index 4dd37bc4ef..7adbcec533 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_right.png index df1a5e6373..73e0f18b2e 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_top.png index 5310cb6431..ce033b007c 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BE_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_back.png new file mode 100644 index 0000000000..8cf58d4533 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_bottom.png new file mode 100644 index 0000000000..88caa50906 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_front.png new file mode 100644 index 0000000000..a13ac2f873 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_left.png index 390fc007b2..93f4dd0b78 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_right.png index 2938c597e5..89724e99d7 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_top.png index a4e895b930..0c23684360 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/BF_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_back.png new file mode 100644 index 0000000000..1fa9422861 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_bottom.png new file mode 100644 index 0000000000..8fc7146a2b Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_front.png new file mode 100644 index 0000000000..e1169df0c3 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_left.png index 2f71e36023..2c03143156 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_right.png index 6c9ca752d4..0944851f58 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_top.png index ccf32f0d93..0bd21bf137 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/CB_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_back.png new file mode 100644 index 0000000000..32ba18f3ce Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_bottom.png new file mode 100644 index 0000000000..aa16dbbd78 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_front.png new file mode 100644 index 0000000000..7126c1e963 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_left.png index b7450c7953..0a30af13a2 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_right.png index 14d4203311..9edeb857a4 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_top.png index 4cc79ad20a..e373d0734e 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ca_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_back.png new file mode 100644 index 0000000000..12ab1359ff Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_bottom.png new file mode 100644 index 0000000000..4a0338965d Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_front.png new file mode 100644 index 0000000000..0dca11d18e Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_left.png index 103ab02488..9d1897eedd 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_right.png index 9ef6cc566a..5cfa14ac0b 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_top.png index f0dc57b878..5004459c22 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ce_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_back.png new file mode 100644 index 0000000000..c7b306e750 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_bottom.png new file mode 100644 index 0000000000..84ebb4bfbf Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_front.png new file mode 100644 index 0000000000..91154febb2 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_left.png index 0c9f97e32e..1323c381d2 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_right.png index 89cab33de8..42e38a869f 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_top.png index 01591ff484..9d748b3ded 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/DD_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/De_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_back.png new file mode 100644 index 0000000000..fa5166a961 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/De_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_bottom.png new file mode 100644 index 0000000000..3365acefd5 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/De_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_front.png new file mode 100644 index 0000000000..8fe0377ced Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/De_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_left.png index f04a2e3db8..5925bf6f11 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/De_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/De_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_right.png index f847bc0b54..19b930d22f 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/De_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/De_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_top.png index ff18590e1b..4ba16ec201 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/De_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/De_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_back.png new file mode 100644 index 0000000000..4fa4468fb3 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_bottom.png new file mode 100644 index 0000000000..668874eb29 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_front.png new file mode 100644 index 0000000000..9e74d13738 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_left.png index 83136e0dbf..36c3e029fb 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_right.png index 62c0a7847a..c0d0663c72 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_top.png index 06c210fa06..aa95252b96 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/EA_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_back.png new file mode 100644 index 0000000000..ccf2e31970 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_bottom.png new file mode 100644 index 0000000000..712a4f5c72 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_front.png new file mode 100644 index 0000000000..b300d3b81f Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_left.png index a35beb10da..df9ce0c3ce 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_right.png index c3acf3e395..e7a2ba020a 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_top.png index 486f602f00..b18188ebd2 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/ED_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/En_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_back.png new file mode 100644 index 0000000000..e1cf79d7e3 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/En_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_bottom.png new file mode 100644 index 0000000000..6ad83e05c3 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/En_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_front.png new file mode 100644 index 0000000000..04c9f5db89 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/En_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_left.png index 06dd795fad..19bb05d552 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/En_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/En_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_right.png index 51ada05bec..4a1ab27f86 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/En_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/En_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_top.png index f589cc7af7..8c0377756e 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/En_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/En_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_back.png new file mode 100644 index 0000000000..9d52efeea2 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_bottom.png new file mode 100644 index 0000000000..ba29c6d13b Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_front.png new file mode 100644 index 0000000000..c02f24a984 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_left.png index 71fca7f0f6..4de79f1f18 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_right.png index 00d5be9dd7..9f62b3aa4f 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_top.png index 06d28f7181..b0bd7eae95 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Eu_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_back.png new file mode 100644 index 0000000000..04c7ec4737 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_bottom.png new file mode 100644 index 0000000000..857a293309 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_front.png new file mode 100644 index 0000000000..732d84b3b4 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_left.png index e57eba6c06..5986c2f26a 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_right.png index bdcfec1cce..cb59b0fa58 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_top.png index 244f654369..822569d011 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ga_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_back.png new file mode 100644 index 0000000000..ee4f8aefd4 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_bottom.png new file mode 100644 index 0000000000..17f814a48a Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_front.png new file mode 100644 index 0000000000..e02495e47b Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_left.png index e3c3815718..eb348f8de3 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_right.png index adb1ea513a..142c425b0d 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_top.png index 484471ea0e..24c4aa0e81 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ha_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_back.png new file mode 100644 index 0000000000..8e699e8b8e Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_bottom.png new file mode 100644 index 0000000000..675cdcc06b Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_front.png new file mode 100644 index 0000000000..c651480787 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_left.png new file mode 100644 index 0000000000..0127638df5 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_right.png new file mode 100644 index 0000000000..38ae1dcbf6 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_top.png new file mode 100644 index 0000000000..d879ed670b Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ho_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_back.png new file mode 100644 index 0000000000..695e7dac06 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_bottom.png new file mode 100644 index 0000000000..e651421c92 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_front.png new file mode 100644 index 0000000000..2a8f827f35 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_left.png index 42b42e964c..5dcd4ed08a 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_right.png index 968f79d47b..554a4e9c8f 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_top.png index 9b2f739732..1c890577b0 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Io_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_back.png new file mode 100644 index 0000000000..8fd55e58f3 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_bottom.png new file mode 100644 index 0000000000..53b0b55f82 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_front.png new file mode 100644 index 0000000000..bb7cb871a9 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_left.png index 25166a16a8..5f695690f8 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_right.png index b894e9520c..7c1dcd796c 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_top.png index 087bfe7ef0..03cf93aa6b 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/KB_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/MB_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/MB_back.png new file mode 100644 index 0000000000..b8f380d5e3 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/MB_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/MB_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/MB_bottom.png new file mode 100644 index 0000000000..06d72cf0e1 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/MB_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/MB_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/MB_front.png new file mode 100644 index 0000000000..2ea9491775 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/MB_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/MB_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/MB_left.png new file mode 100644 index 0000000000..691181cfc4 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/MB_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/MB_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/MB_right.png new file mode 100644 index 0000000000..ad9b91bb1f Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/MB_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/MB_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/MB_top.png new file mode 100644 index 0000000000..cb2c0fe5cc Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/MB_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_back.png new file mode 100644 index 0000000000..8475bb7dbd Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_bottom.png new file mode 100644 index 0000000000..66c0b5d269 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_front.png new file mode 100644 index 0000000000..cc0796433d Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_left.png index c25c8cc4fd..9b3630abae 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_right.png index 75e9dfe812..9b19739c89 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_top.png index eaea4da1f2..18a1199e21 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/MM_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_back.png new file mode 100644 index 0000000000..04e3a7af10 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_bottom.png new file mode 100644 index 0000000000..c4bc98c9ab Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_front.png new file mode 100644 index 0000000000..a404bd111b Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_left.png index 009608cd1b..e3250ff058 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_right.png index 069ce0dd52..c2e82cd90a 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_top.png index ca0681b93b..7afef1ff44 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ma_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_back.png new file mode 100644 index 0000000000..4b1ab42f44 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_bottom.png new file mode 100644 index 0000000000..19686ed29d Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_front.png new file mode 100644 index 0000000000..ca62560d53 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_left.png index 6b0166b94e..a466dac504 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_right.png index f371e702ee..1e5256822a 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_top.png index 0868757746..91187d25b5 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Me_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_back.png new file mode 100644 index 0000000000..56ff32dfbf Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_bottom.png new file mode 100644 index 0000000000..1aa6abb122 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_front.png new file mode 100644 index 0000000000..ad2381fb3d Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_left.png new file mode 100644 index 0000000000..7d6574c5aa Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_right.png new file mode 100644 index 0000000000..4d17b0f85d Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_top.png new file mode 100644 index 0000000000..c3649e7737 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mh_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_back.png new file mode 100644 index 0000000000..1b3cbbb6fe Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_bottom.png new file mode 100644 index 0000000000..c67b1d6a4e Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_front.png new file mode 100644 index 0000000000..b9094df955 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_left.png index 0669efd353..d0d1d621f8 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_right.png index 9ae13115e7..51e91065dd 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_top.png index d20dc2a249..eccb730ea4 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mi_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_back.png new file mode 100644 index 0000000000..5b7c2e227c Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_bottom.png new file mode 100644 index 0000000000..0b738fef18 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_front.png new file mode 100644 index 0000000000..5d926bb7d4 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_left.png index 5980cfdad1..e9d8867322 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_right.png index 3b2eada1f5..d230130103 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_top.png index c06c86b6be..95979ed8e9 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Mo_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_back.png new file mode 100644 index 0000000000..5b0f798e88 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_bottom.png new file mode 100644 index 0000000000..cbd51db421 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_front.png new file mode 100644 index 0000000000..01c2a40b66 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_left.png index 98e8dee9f3..4a976ce376 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_right.png index a86ce29448..bd994ac25c 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_top.png index 9bcc7b12c9..7865ff41c8 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ne_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Np_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Np_back.png new file mode 100644 index 0000000000..82dfcb0e88 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Np_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Np_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Np_bottom.png new file mode 100644 index 0000000000..5de92b4ef7 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Np_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Np_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Np_front.png new file mode 100644 index 0000000000..79c8f0b72f Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Np_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Np_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Np_left.png new file mode 100644 index 0000000000..3368e3469f Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Np_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Np_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Np_right.png new file mode 100644 index 0000000000..9410ff9c36 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Np_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Np_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Np_top.png new file mode 100644 index 0000000000..ec9270bd47 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Np_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_back.png new file mode 100644 index 0000000000..30ef66e57e Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_bottom.png new file mode 100644 index 0000000000..c4047b475f Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_front.png new file mode 100644 index 0000000000..ab356203a5 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_left.png index 1ab939f012..8703ee5790 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_right.png index b8100cceb6..3bacd63ab7 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_top.png index dd3c5f48b3..58ead2babc 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ob_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_back.png new file mode 100644 index 0000000000..d95dc2445a Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_bottom.png new file mode 100644 index 0000000000..3b37660ece Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_front.png new file mode 100644 index 0000000000..bc9483935f Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_left.png index be7943782c..4c2182926c 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_right.png index b1ec2c836b..c6331fe528 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_top.png index c78e825e8d..e4dcf20613 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ow_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_back.png new file mode 100644 index 0000000000..b319f77587 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_bottom.png new file mode 100644 index 0000000000..663e45fa9a Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_front.png new file mode 100644 index 0000000000..a0774b7d97 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_left.png index 76619e4fb9..40e5bda10d 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_right.png index a7d13c71c1..ba983a38d5 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_top.png index 66614ac77a..f236cd8777 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ph_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_back.png new file mode 100644 index 0000000000..a4ae5e99dd Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_bottom.png new file mode 100644 index 0000000000..942545b6dc Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_front.png new file mode 100644 index 0000000000..e2646c909c Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_left.png index 392fc6b0ce..e5347f029f 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_right.png index 92864c3edd..4483587dd7 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_top.png index 890e3147f8..8c798b772c 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pl_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_back.png new file mode 100644 index 0000000000..78612d5069 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_bottom.png new file mode 100644 index 0000000000..be4f9ef151 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_front.png new file mode 100644 index 0000000000..2ee68f722a Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_left.png index 29318a5c3a..8815c1aff4 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_right.png index 2356c6af90..7ddebf0c78 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_top.png index a9d3ca1cb9..d787d0627e 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Pr_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_back.png new file mode 100644 index 0000000000..31dda6729b Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_bottom.png new file mode 100644 index 0000000000..686a7900af Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_front.png new file mode 100644 index 0000000000..001e10813f Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_left.png index faca5456e9..8ceb4e236a 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_right.png index 1bca8530c3..8deaab7f96 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_top.png index d40072f28e..5d54f82e81 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ra_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_back.png new file mode 100644 index 0000000000..0ef5ec6b6d Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_bottom.png new file mode 100644 index 0000000000..0f30a81c7c Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_front.png new file mode 100644 index 0000000000..940b5afab4 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_left.png index 6d71ed8b71..aac7654fdf 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_right.png index 51d4eec75b..070fbfd57b 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_top.png index 560ee6060d..611e8465ca 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Rb_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Se_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Se_back.png new file mode 100644 index 0000000000..d91d4d0a0b Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Se_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Se_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Se_bottom.png new file mode 100644 index 0000000000..9f793a07f4 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Se_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Se_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Se_front.png new file mode 100644 index 0000000000..69a81b170d Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Se_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Se_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Se_left.png new file mode 100644 index 0000000000..d95bac7c44 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Se_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Se_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Se_right.png new file mode 100644 index 0000000000..482bececa8 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Se_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Se_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Se_top.png new file mode 100644 index 0000000000..0ee4410f7f Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Se_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_back.png new file mode 100644 index 0000000000..37e3772027 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_bottom.png new file mode 100644 index 0000000000..f14d3dfcfc Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_front.png new file mode 100644 index 0000000000..2860e63017 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_left.png index 00be257e51..39e36d157e 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_right.png index 9fa5badcd6..39ec7a033f 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_top.png index f20c02d574..0de8efc71a 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/TE_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_back.png new file mode 100644 index 0000000000..94400c57fe Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_bottom.png new file mode 100644 index 0000000000..20fb6af755 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_front.png new file mode 100644 index 0000000000..40e9c39b5f Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_left.png index fc8bb231f4..d54f5eb7ba 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_right.png index 6f7fb5a50b..f8b0679830 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_top.png index c571c220b2..aaaf15b74b 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/TF_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_back.png new file mode 100644 index 0000000000..ce66c139d9 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_bottom.png new file mode 100644 index 0000000000..709f73b3e9 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_front.png new file mode 100644 index 0000000000..84cf339fa6 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_left.png index f0f2279512..66b2781465 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_right.png index c3df18ba09..f178106429 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_top.png index a71f77617f..6f89cc584e 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ti_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_back.png new file mode 100644 index 0000000000..1279107c48 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_bottom.png new file mode 100644 index 0000000000..0a3665f860 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_front.png new file mode 100644 index 0000000000..e5708769a4 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_left.png index 8826ed2343..fcbce713a4 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_right.png index 58075fe3a9..5ac04018ea 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_top.png index 0113778ed6..46ebcfed19 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Tr_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_back.png new file mode 100644 index 0000000000..5a196b30a6 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_bottom.png new file mode 100644 index 0000000000..341361249e Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_front.png new file mode 100644 index 0000000000..be735d2333 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_left.png index 7a05a6621e..3161bfc4f9 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_right.png index ed402f7b4a..67d6f4c4b5 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_top.png index 4fa64bd1f0..ce32aa3286 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VA_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_back.png new file mode 100644 index 0000000000..9273c3844d Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_bottom.png new file mode 100644 index 0000000000..5093952c2f Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_front.png new file mode 100644 index 0000000000..fefc66eeff Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_left.png index 3a5e1008d9..fe43658458 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_right.png index be5288e3ad..5656257592 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_top.png index 7331ff69fc..474a53eea6 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/VB_top.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_back.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_back.png new file mode 100644 index 0000000000..30aee3211a Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_back.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_bottom.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_bottom.png new file mode 100644 index 0000000000..fd3824b252 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_bottom.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_front.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_front.png new file mode 100644 index 0000000000..d902369df5 Binary files /dev/null and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_front.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_left.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_left.png index ac2e73207b..9927097ffc 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_left.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_left.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_right.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_right.png index dd3d79935c..2b07d2f6d5 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_right.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_right.png differ diff --git a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_top.png b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_top.png index 374d58e287..0bea9f826a 100644 Binary files a/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_top.png and b/src/main/resources/assets/gtneioreplugin/textures/blocks/Ve_top.png differ -- cgit From 81f9f8026af9eb63d5a574c8bb85c7193dde1d1d Mon Sep 17 00:00:00 2001 From: Raven Szewczyk Date: Mon, 8 Jan 2024 21:26:17 +0000 Subject: [ci skip] upgraded build system --- build.gradle | 175 ++++++++++++++++++------------- gradle.properties | 3 + gradle/wrapper/gradle-wrapper.jar | Bin 61608 -> 43462 bytes gradle/wrapper/gradle-wrapper.properties | 3 +- gradlew | 29 ++--- settings.gradle | 9 +- 6 files changed, 130 insertions(+), 89 deletions(-) diff --git a/build.gradle b/build.gradle index d90330a85c..952a3c59be 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1689878047 +//version: 1704650211 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -28,27 +28,11 @@ import java.util.concurrent.TimeUnit buildscript { repositories { - mavenCentral() - - maven { - name 'forge' - url 'https://maven.minecraftforge.net' - } maven { // GTNH RetroFuturaGradle and ASM Fork name "GTNH Maven" - url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" - allowInsecureProtocol = true - } - maven { - name 'sonatype' - url 'https://oss.sonatype.org/content/repositories/snapshots/' - } - maven { - name 'Scala CI dependencies' - url 'https://repo1.maven.org/maven2/' + url "https://nexus.gtnewhorizons.com/repository/public/" } - mavenLocal() } } @@ -64,12 +48,12 @@ plugins { id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version, unused, available for addon.gradle id 'com.github.johnrengelman.shadow' version '8.1.1' apply false id 'com.palantir.git-version' version '3.0.0' apply false - id 'de.undercouch.download' version '5.4.0' + id 'de.undercouch.download' version '5.5.0' id 'com.github.gmazzo.buildconfig' version '3.1.0' apply false // Unused, available for addon.gradle id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version id 'com.modrinth.minotaur' version '2.+' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false - id 'com.gtnewhorizons.retrofuturagradle' version '1.3.21' + id 'com.gtnewhorizons.retrofuturagradle' version '1.3.27' } print("You might want to check out './gradlew :faq' if your build fails.\n") @@ -89,6 +73,23 @@ def out = services.get(StyledTextOutputFactory).create('an-output') def projectJavaVersion = JavaLanguageVersion.of(8) boolean disableSpotless = project.hasProperty("disableSpotless") ? project.disableSpotless.toBoolean() : false +boolean disableCheckstyle = project.hasProperty("disableCheckstyle") ? project.disableCheckstyle.toBoolean() : false + +final String CHECKSTYLE_CONFIG = """ + + + + + + + + + + + +""" checkPropertyExists("modName") checkPropertyExists("modId") @@ -116,7 +117,7 @@ propertyDefaultIfUnset("forceEnableMixins", false) propertyDefaultIfUnset("channel", "stable") propertyDefaultIfUnset("mappingsVersion", "12") propertyDefaultIfUnset("usesMavenPublishing", true) -propertyDefaultIfUnset("mavenPublishUrl", "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases") +propertyDefaultIfUnset("mavenPublishUrl", "https://nexus.gtnewhorizons.com/repository/releases/") propertyDefaultIfUnset("modrinthProjectId", "") propertyDefaultIfUnset("modrinthRelations", "") propertyDefaultIfUnset("curseForgeProjectId", "") @@ -140,6 +141,17 @@ if (!disableSpotless) { apply from: Blowdryer.file('spotless.gradle') } +if (!disableCheckstyle) { + apply plugin: 'checkstyle' + tasks.named("checkstylePatchedMc") { enabled = false } + tasks.named("checkstyleMcLauncher") { enabled = false } + tasks.named("checkstyleIdeVirtualMain") { enabled = false } + tasks.named("checkstyleInjectedTags") { enabled = false } + checkstyle { + config = resources.text.fromString(CHECKSTYLE_CONFIG) + } +} + String javaSourceDir = "src/main/java/" String scalaSourceDir = "src/main/scala/" String kotlinSourceDir = "src/main/kotlin/" @@ -274,7 +286,7 @@ if (apiPackage) { } if (accessTransformersFile) { - for (atFile in accessTransformersFile.split(",")) { + for (atFile in accessTransformersFile.split(" ")) { String targetFile = "src/main/resources/META-INF/" + atFile.trim() if (!getFile(targetFile).exists()) { throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) @@ -401,9 +413,13 @@ if (identifiedVersion == versionOverride) { group = "com.github.GTNewHorizons" if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) { - archivesBaseName = customArchiveBaseName + base { + archivesName = customArchiveBaseName + } } else { - archivesBaseName = modId + base { + archivesName = modId + } } @@ -556,16 +572,15 @@ afterEvaluate { repositories { maven { - name 'Overmind forge repo mirror' - url 'https://gregtech.overminddl1.com/' - mavenContent { - excludeGroup("net.minecraftforge") // missing the `universal` artefact - } + name = "GTNH Maven" + url = "https://nexus.gtnewhorizons.com/repository/public/" + // Links for convenience: + // Simple HTML browsing: https://nexus.gtnewhorizons.com/service/rest/repository/browse/releases/ + // Rich web UI browsing: https://nexus.gtnewhorizons.com/#browse/browse:releases } maven { - name = "GTNH Maven" - url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" - allowInsecureProtocol = true + name 'Overmind forge repo mirror' + url 'https://gregtech.overminddl1.com/' } maven { name 'sonatype' @@ -575,24 +590,34 @@ repositories { } } if (includeWellKnownRepositories.toBoolean()) { - maven { - name "CurseMaven" - url "https://cursemaven.com" - content { + exclusiveContent { + forRepository { + maven { + name "CurseMaven" + url "https://cursemaven.com" + } + } + filter { includeGroup "curse.maven" } } - maven { - name = "ic2" - url = "https://maven.ic2.player.to/" - metadataSources { - mavenPom() - artifact() + exclusiveContent { + forRepository { + maven { + name = "Modrinth" + url = "https://api.modrinth.com/maven" + } + } + filter { + includeGroup "maven.modrinth" } } maven { - name = "ic2-mirror" - url = "https://maven2.ic2.player.to/" + name = "ic2" + url = getURL("https://maven2.ic2.player.to/", "https://maven.ic2.player.to/") + content { + includeGroup "net.industrial-craft" + } metadataSources { mavenPom() artifact() @@ -607,11 +632,13 @@ repositories { def mixinProviderGroup = "io.github.legacymoddingmc" def mixinProviderModule = "unimixins" -def mixinProviderVersion = "0.1.7.1" +def mixinProviderVersion = "0.1.13" def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}" def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev" ext.mixinProviderSpec = mixinProviderSpec +def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' + dependencies { if (usesMixins.toBoolean()) { annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3') @@ -623,7 +650,7 @@ dependencies { } } if (usesMixins.toBoolean()) { - implementation(modUtils.enableMixins(mixinProviderSpec)) + implementation(modUtils.enableMixins(mixinProviderSpec, mixingConfigRefMap)) } else if (forceEnableMixins.toBoolean()) { runtimeOnlyNonPublishable(mixinProviderSpec) } @@ -646,6 +673,8 @@ configurations.all { substitute module('com.github.GTNewHorizons:SpongePoweredMixin') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods") substitute module('com.github.GTNewHorizons:SpongeMixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods") substitute module('io.github.legacymoddingmc:unimixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Our previous unimixins upload was missing the dev classifier") + + substitute module('org.scala-lang:scala-library:2.11.1') using module('org.scala-lang:scala-library:2.11.5') because('To allow mixing with Java 8 targets') } } @@ -676,8 +705,6 @@ if (file('dependencies.gradle.kts').exists()) { throw new RuntimeException("Missing dependencies.gradle[.kts]") } -def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' - tasks.register('generateAssets') { group = "GTNH Buildscript" description = "Generates a mixin config file at /src/main/resources/mixins.modid.json if needed" @@ -754,23 +781,14 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies" } dependencies { - def lwjgl3ifyVersion = '1.4.0' - def asmVersion = '9.4' + def lwjgl3ifyVersion = '1.5.7' if (modId != 'lwjgl3ify') { java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") } if (modId != 'hodgepodge') { - java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.19') + java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.35') } - java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false} - java17PatchDependencies("org.ow2.asm:asm:${asmVersion}") - java17PatchDependencies("org.ow2.asm:asm-commons:${asmVersion}") - java17PatchDependencies("org.ow2.asm:asm-tree:${asmVersion}") - java17PatchDependencies("org.ow2.asm:asm-analysis:${asmVersion}") - java17PatchDependencies("org.ow2.asm:asm-util:${asmVersion}") - java17PatchDependencies('org.ow2.asm:asm-deprecated:7.1') - java17PatchDependencies("org.apache.commons:commons-lang3:3.12.0") java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false} } @@ -943,8 +961,7 @@ if (usesShadowedDependencies.toBoolean()) { configurations.runtimeElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar)) configurations.apiElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar)) tasks.named("jar", Jar) { - enabled = false - finalizedBy(tasks.shadowJar) + archiveClassifier.set('dev-preshadow') } tasks.named("reobfJar", ReobfuscatedJar) { inputJar.set(tasks.named("shadowJar", ShadowJar).flatMap({it.archiveFile})) @@ -953,11 +970,6 @@ if (usesShadowedDependencies.toBoolean()) { javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) { skip() } - for (runTask in ["runClient", "runServer", "runClient17", "runServer17"]) { - tasks.named(runTask).configure { - dependsOn("shadowJar") - } - } } ext.publishableDevJar = usesShadowedDependencies.toBoolean() ? tasks.shadowJar : tasks.jar ext.publishableObfJar = tasks.reobfJar @@ -1133,7 +1145,10 @@ tasks.named("processIdeaSettings").configure { tasks.named("ideVirtualMainClasses").configure { // Make IntelliJ "Build project" build the mod jars - dependsOn("jar", "reobfJar", "spotlessCheck") + dependsOn("jar", "reobfJar") + if (!disableSpotless) { + dependsOn("spotlessCheck") + } } // workaround variable hiding in pom processing @@ -1154,12 +1169,11 @@ publishing { version = System.getenv("RELEASE_VERSION") ?: identifiedVersion } } - repositories { - if (usesMavenPublishing.toBoolean()) { + if (usesMavenPublishing.toBoolean() && System.getenv("MAVEN_USER") != null) { maven { url = mavenPublishUrl - allowInsecureProtocol = mavenPublishUrl.startsWith("http://") // Mostly for the GTNH maven + allowInsecureProtocol = mavenPublishUrl.startsWith("http://") credentials { username = System.getenv("MAVEN_USER") ?: "NONE" password = System.getenv("MAVEN_PASSWORD") ?: "NONE" @@ -1278,7 +1292,7 @@ def addCurseForgeRelation(String type, String name) { // Updating -def buildscriptGradleVersion = "8.2.1" +def buildscriptGradleVersion = "8.5" tasks.named('wrapper', Wrapper).configure { gradleVersion = buildscriptGradleVersion @@ -1557,6 +1571,25 @@ def getSecondaryArtifacts() { return secondaryArtifacts } +def getURL(String main, String fallback) { + return pingURL(main, 10000) ? main : fallback +} + +// credit: https://stackoverflow.com/a/3584332 +def pingURL(String url, int timeout) { + url = url.replaceFirst("^https", "http") // Otherwise an exception may be thrown on invalid SSL certificates. + try { + HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection() + connection.setConnectTimeout(timeout) + connection.setReadTimeout(timeout) + connection.setRequestMethod("HEAD") + int responseCode = connection.getResponseCode() + return 200 <= responseCode && responseCode <= 399 + } catch (IOException ignored) { + return false + } +} + // For easier scripting of things that require variables defined earlier in the buildscript if (file('addon.late.gradle.kts').exists()) { apply from: 'addon.late.gradle.kts' diff --git a/gradle.properties b/gradle.properties index 691386d44a..a4e031edf9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -141,3 +141,6 @@ curseForgeRelations = # WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want! # Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you. # ideaOverrideBuildType = idea + +# TODO: Remove when you modify this repository, it's been put in for automatic buildscript updates +disableCheckstyle = true diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index ccebba7710..d64cd49177 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 37aef8d3f0..1af9e0930b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 79a61d421c..1aa94a4269 100755 --- a/gradlew +++ b/gradlew @@ -83,10 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,10 +131,13 @@ 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. + if ! command -v java >/dev/null 2>&1 + then + 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 fi # Increase the maximum file descriptors if we can. @@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/settings.gradle b/settings.gradle index 01ea5f121a..8a66026e3d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -4,10 +4,9 @@ pluginManagement { maven { // RetroFuturaGradle name "GTNH Maven" - url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" - allowInsecureProtocol = true + url "https://nexus.gtnewhorizons.com/repository/public/" mavenContent { - includeGroup("com.gtnewhorizons.retrofuturagradle") + includeGroupByRegex("com\\.gtnewhorizons\\..+") } } gradlePluginPortal() @@ -17,8 +16,8 @@ pluginManagement { } plugins { - id 'com.diffplug.blowdryerSetup' version '1.6.0' - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains + id 'com.diffplug.blowdryerSetup' version '1.7.1' + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' // Provides java toolchains } blowdryerSetup { -- cgit From c434cee4907d213a71d80c52f08903a170d7aa78 Mon Sep 17 00:00:00 2001 From: Martin Robertz Date: Fri, 12 Jan 2024 18:31:52 +0100 Subject: update deps+bs --- build.gradle | 4 ++-- dependencies.gradle | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 952a3c59be..3eb19a269d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1704650211 +//version: 1704751096 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -786,7 +786,7 @@ dependencies { java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") } if (modId != 'hodgepodge') { - java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.35') + java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.4.4') } java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false} diff --git a/dependencies.gradle b/dependencies.gradle index 22247326b6..a84e4ba606 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,7 +1,7 @@ // Add your dependencies here dependencies { - api('com.github.GTNewHorizons:GT5-Unofficial:5.09.43.50:dev') + api('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.25:dev') compileOnly('com.opencsv:opencsv:4.0') } -- cgit From 9cddf35b0270c757dbcec03a018ad47d202b37ec Mon Sep 17 00:00:00 2001 From: Raven Szewczyk Date: Sun, 4 Feb 2024 19:59:06 +0000 Subject: [ci skip] upgraded build system --- build.gradle | 1604 +----------------------------- gradle.properties | 131 ++- gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew.bat | 20 +- settings.gradle | 10 +- 5 files changed, 104 insertions(+), 1663 deletions(-) diff --git a/build.gradle b/build.gradle index 3eb19a269d..e57a16f9f1 100644 --- a/build.gradle +++ b/build.gradle @@ -1,1605 +1,5 @@ -//version: 1704751096 -/* - DO NOT CHANGE THIS FILE! - Also, you may replace this file at any time if there is an update available. - Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/master/build.gradle for updates. - */ +//version: 1707058017 - -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar -import com.gtnewhorizons.retrofuturagradle.ObfuscationAttribute -import com.gtnewhorizons.retrofuturagradle.mcp.ReobfuscatedJar -import com.gtnewhorizons.retrofuturagradle.minecraft.RunMinecraftTask -import com.gtnewhorizons.retrofuturagradle.util.Distribution -import com.matthewprenger.cursegradle.CurseArtifact -import com.matthewprenger.cursegradle.CurseRelation -import com.modrinth.minotaur.dependencies.ModDependency -import com.modrinth.minotaur.dependencies.VersionDependency -import org.gradle.internal.logging.text.StyledTextOutput.Style -import org.gradle.internal.logging.text.StyledTextOutputFactory -import org.gradle.internal.xml.XmlTransformer -import org.jetbrains.gradle.ext.Application -import org.jetbrains.gradle.ext.Gradle - -import javax.inject.Inject -import java.nio.file.Files -import java.nio.file.Paths -import java.util.concurrent.TimeUnit - -buildscript { - repositories { - maven { - // GTNH RetroFuturaGradle and ASM Fork - name "GTNH Maven" - url "https://nexus.gtnewhorizons.com/repository/public/" - } - mavenLocal() - } -} plugins { - id 'java-library' - id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7" - id 'eclipse' - id 'scala' - id 'maven-publish' - id 'org.jetbrains.kotlin.jvm' version '1.8.0' apply false - id 'org.jetbrains.kotlin.kapt' version '1.8.0' apply false - id 'com.google.devtools.ksp' version '1.8.0-1.0.9' apply false - id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version, unused, available for addon.gradle - id 'com.github.johnrengelman.shadow' version '8.1.1' apply false - id 'com.palantir.git-version' version '3.0.0' apply false - id 'de.undercouch.download' version '5.5.0' - id 'com.github.gmazzo.buildconfig' version '3.1.0' apply false // Unused, available for addon.gradle - id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version - id 'com.modrinth.minotaur' version '2.+' apply false - id 'com.matthewprenger.cursegradle' version '1.4.0' apply false - id 'com.gtnewhorizons.retrofuturagradle' version '1.3.27' -} - -print("You might want to check out './gradlew :faq' if your build fails.\n") - -boolean settingsupdated = verifySettingsGradle() -settingsupdated = verifyGitAttributes() || settingsupdated -if (settingsupdated) - throw new GradleException("Settings has been updated, please re-run task.") - -// In submodules, .git is a file pointing to the real git dir -if (project.file('.git/HEAD').isFile() || project.file('.git').isFile()) { - apply plugin: 'com.palantir.git-version' -} - -def out = services.get(StyledTextOutputFactory).create('an-output') - -def projectJavaVersion = JavaLanguageVersion.of(8) - -boolean disableSpotless = project.hasProperty("disableSpotless") ? project.disableSpotless.toBoolean() : false -boolean disableCheckstyle = project.hasProperty("disableCheckstyle") ? project.disableCheckstyle.toBoolean() : false - -final String CHECKSTYLE_CONFIG = """ - - - - - - - - - - - -""" - -checkPropertyExists("modName") -checkPropertyExists("modId") -checkPropertyExists("modGroup") -checkPropertyExists("autoUpdateBuildScript") -checkPropertyExists("minecraftVersion") -checkPropertyExists("forgeVersion") -checkPropertyExists("replaceGradleTokenInFile") -checkPropertyExists("gradleTokenVersion") -checkPropertyExists("apiPackage") -checkPropertyExists("accessTransformersFile") -checkPropertyExists("usesMixins") -checkPropertyExists("mixinPlugin") -checkPropertyExists("mixinsPackage") -checkPropertyExists("coreModClass") -checkPropertyExists("containsMixinsAndOrCoreModOnly") -checkPropertyExists("usesShadowedDependencies") -checkPropertyExists("developmentEnvironmentUserName") - -propertyDefaultIfUnset("generateGradleTokenClass", "") -propertyDefaultIfUnset("includeWellKnownRepositories", true) -propertyDefaultIfUnset("noPublishedSources", false) -propertyDefaultIfUnset("usesMixinDebug", project.usesMixins) -propertyDefaultIfUnset("forceEnableMixins", false) -propertyDefaultIfUnset("channel", "stable") -propertyDefaultIfUnset("mappingsVersion", "12") -propertyDefaultIfUnset("usesMavenPublishing", true) -propertyDefaultIfUnset("mavenPublishUrl", "https://nexus.gtnewhorizons.com/repository/releases/") -propertyDefaultIfUnset("modrinthProjectId", "") -propertyDefaultIfUnset("modrinthRelations", "") -propertyDefaultIfUnset("curseForgeProjectId", "") -propertyDefaultIfUnset("curseForgeRelations", "") -propertyDefaultIfUnset("minimizeShadowedDependencies", true) -propertyDefaultIfUnset("relocateShadowedDependencies", true) -// Deprecated properties (kept for backwards compat) -propertyDefaultIfUnset("gradleTokenModId", "") -propertyDefaultIfUnset("gradleTokenModName", "") -propertyDefaultIfUnset("gradleTokenGroupName", "") - -propertyDefaultIfUnset("enableModernJavaSyntax", false) // On by default for new projects only -propertyDefaultIfUnset("enableGenericInjection", false) // On by default for new projects only - -// this is meant to be set using the user wide property file. by default we do nothing. -propertyDefaultIfUnset("ideaOverrideBuildType", "") // Can be nothing, "gradle" or "idea" - -project.extensions.add(com.diffplug.blowdryer.Blowdryer, "Blowdryer", com.diffplug.blowdryer.Blowdryer) // Make blowdryer available in "apply from:" scripts -if (!disableSpotless) { - apply plugin: 'com.diffplug.spotless' - apply from: Blowdryer.file('spotless.gradle') -} - -if (!disableCheckstyle) { - apply plugin: 'checkstyle' - tasks.named("checkstylePatchedMc") { enabled = false } - tasks.named("checkstyleMcLauncher") { enabled = false } - tasks.named("checkstyleIdeVirtualMain") { enabled = false } - tasks.named("checkstyleInjectedTags") { enabled = false } - checkstyle { - config = resources.text.fromString(CHECKSTYLE_CONFIG) - } -} - -String javaSourceDir = "src/main/java/" -String scalaSourceDir = "src/main/scala/" -String kotlinSourceDir = "src/main/kotlin/" - -if (usesShadowedDependencies.toBoolean()) { - apply plugin: "com.github.johnrengelman.shadow" -} - -java { - toolchain { - if (enableModernJavaSyntax.toBoolean()) { - languageVersion.set(JavaLanguageVersion.of(17)) - } else { - languageVersion.set(projectJavaVersion) - } - vendor.set(JvmVendorSpec.AZUL) - } - if (!noPublishedSources) { - withSourcesJar() - } -} - -tasks.withType(JavaCompile).configureEach { - options.encoding = "UTF-8" -} - -tasks.withType(ScalaCompile).configureEach { - options.encoding = "UTF-8" -} - -pluginManager.withPlugin('org.jetbrains.kotlin.jvm') { - // If Kotlin is enabled in the project - kotlin { - jvmToolchain(8) - } - // Kotlin hacks our source sets, so we hack Kotlin's tasks - def disabledKotlinTaskList = [ - "kaptGenerateStubsMcLauncherKotlin", - "kaptGenerateStubsPatchedMcKotlin", - "kaptGenerateStubsInjectedTagsKotlin", - "compileMcLauncherKotlin", - "compilePatchedMcKotlin", - "compileInjectedTagsKotlin", - "kaptMcLauncherKotlin", - "kaptPatchedMcKotlin", - "kaptInjectedTagsKotlin", - "kspMcLauncherKotlin", - "kspPatchedMcKotlin", - "kspInjectedTagsKotlin", - ] - tasks.configureEach { task -> - if (task.name in disabledKotlinTaskList) { - task.enabled = false - } - } -} - -configurations { - create("runtimeOnlyNonPublishable") { - description = "Runtime only dependencies that are not published alongside the jar" - canBeConsumed = false - canBeResolved = false - } - - create("devOnlyNonPublishable") { - description = "Runtime and compiletime dependencies that are not published alongside the jar (compileOnly + runtimeOnlyNonPublishable)" - canBeConsumed = false - canBeResolved = false - } - compileOnly.extendsFrom(devOnlyNonPublishable) - runtimeOnlyNonPublishable.extendsFrom(devOnlyNonPublishable) -} - -if (enableModernJavaSyntax.toBoolean()) { - repositories { - mavenCentral { - mavenContent { - includeGroup("me.eigenraven.java8unsupported") - } - } - } - - dependencies { - annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0' - // workaround for https://github.com/bsideup/jabel/issues/174 - annotationProcessor 'net.java.dev.jna:jna-platform:5.13.0' - compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') { - transitive = false // We only care about the 1 annotation class - } - // Allow using jdk.unsupported classes like sun.misc.Unsafe in the compiled code, working around JDK-8206937. - patchedMinecraft('me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0') - } - - tasks.withType(JavaCompile).configureEach { - if (it.name in ["compileMcLauncherJava", "compilePatchedMcJava"]) { - return - } - sourceCompatibility = 17 // for the IDE support - options.release.set(8) - - javaCompiler.set(javaToolchains.compilerFor { - languageVersion.set(JavaLanguageVersion.of(17)) - vendor.set(JvmVendorSpec.AZUL) - }) - } -} - -eclipse { - classpath { - downloadSources = true - downloadJavadoc = true - } -} - -final String modGroupPath = modGroup.toString().replace('.' as char, '/' as char) -final String apiPackagePath = apiPackage.toString().replace('.' as char, '/' as char) - -String targetPackageJava = javaSourceDir + modGroupPath -String targetPackageScala = scalaSourceDir + modGroupPath -String targetPackageKotlin = kotlinSourceDir + modGroupPath -if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { - throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) -} - -if (apiPackage) { - targetPackageJava = javaSourceDir + modGroupPath + "/" + apiPackagePath - targetPackageScala = scalaSourceDir + modGroupPath + "/" + apiPackagePath - targetPackageKotlin = kotlinSourceDir + modGroupPath + "/" + apiPackagePath - if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { - throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) - } -} - -if (accessTransformersFile) { - for (atFile in accessTransformersFile.split(" ")) { - String targetFile = "src/main/resources/META-INF/" + atFile.trim() - if (!getFile(targetFile).exists()) { - throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) - } - tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(targetFile) - tasks.srgifyBinpatchedJar.accessTransformerFiles.from(targetFile) - } -} else { - boolean atsFound = false - for (File at : sourceSets.getByName("main").resources.files) { - if (at.name.toLowerCase().endsWith("_at.cfg")) { - atsFound = true - tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(at) - tasks.srgifyBinpatchedJar.accessTransformerFiles.from(at) - } - } - for (File at : sourceSets.getByName("api").resources.files) { - if (at.name.toLowerCase().endsWith("_at.cfg")) { - atsFound = true - tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(at) - tasks.srgifyBinpatchedJar.accessTransformerFiles.from(at) - } - } - if (atsFound) { - logger.warn("Found and added access transformers in the resources folder, please configure gradle.properties to explicitly mention them by name") - } -} - -if (usesMixins.toBoolean()) { - if (mixinsPackage.isEmpty()) { - throw new GradleException("\"usesMixins\" requires \"mixinsPackage\" to be set!") - } - final String mixinPackagePath = mixinsPackage.toString().replaceAll("\\.", "/") - final String mixinPluginPath = mixinPlugin.toString().replaceAll("\\.", "/") - - targetPackageJava = javaSourceDir + modGroupPath + "/" + mixinPackagePath - targetPackageScala = scalaSourceDir + modGroupPath + "/" + mixinPackagePath - targetPackageKotlin = kotlinSourceDir + modGroupPath + "/" + mixinPackagePath - if (!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { - throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) - } - - if (!mixinPlugin.isEmpty()) { - String targetFileJava = javaSourceDir + modGroupPath + "/" + mixinPluginPath + ".java" - String targetFileScala = scalaSourceDir + modGroupPath + "/" + mixinPluginPath + ".scala" - String targetFileScalaJava = scalaSourceDir + modGroupPath + "/" + mixinPluginPath + ".java" - String targetFileKotlin = kotlinSourceDir + modGroupPath + "/" + mixinPluginPath + ".kt" - if (!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { - throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) - } - } -} - -if (coreModClass) { - final String coreModPath = coreModClass.toString().replaceAll("\\.", "/") - String targetFileJava = javaSourceDir + modGroupPath + "/" + coreModPath + ".java" - String targetFileScala = scalaSourceDir + modGroupPath + "/" + coreModPath + ".scala" - String targetFileScalaJava = scalaSourceDir + modGroupPath + "/" + coreModPath + ".java" - String targetFileKotlin = kotlinSourceDir + modGroupPath + "/" + coreModPath + ".kt" - if (!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { - throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) - } -} - -configurations.configureEach { - resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS) - - // Make sure GregTech build won't time out - System.setProperty("org.gradle.internal.http.connectionTimeout", 120000 as String) - System.setProperty("org.gradle.internal.http.socketTimeout", 120000 as String) -} - -// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version -try { - 'git config core.fileMode false'.execute() -} -catch (Exception ignored) { - out.style(Style.Failure).println("git isn't installed at all") -} - -// Pulls version first from the VERSION env and then git tag -String identifiedVersion -String versionOverride = System.getenv("VERSION") ?: null -try { - // Produce a version based on the tag, or for branches something like 0.2.2-configurable-maven-and-extras.38+43090270b6-dirty - if (versionOverride == null) { - def gitDetails = versionDetails() - def isDirty = gitVersion().endsWith(".dirty") // No public API for this, isCleanTag has a different meaning - String branchName = gitDetails.branchName ?: (System.getenv('GIT_BRANCH') ?: 'git') - if (branchName.startsWith('origin/')) { - branchName = branchName.minus('origin/') - } - branchName = branchName.replaceAll("[^a-zA-Z0-9-]+", "-") // sanitize branch names for semver - identifiedVersion = gitDetails.lastTag ?: '${gitDetails.gitHash}' - if (gitDetails.commitDistance > 0) { - identifiedVersion += "-${branchName}.${gitDetails.commitDistance}+${gitDetails.gitHash}" - if (isDirty) { - identifiedVersion += "-dirty" - } - } else if (isDirty) { - identifiedVersion += "-${branchName}+${gitDetails.gitHash}-dirty" - } - } else { - identifiedVersion = versionOverride - } -} -catch (Exception ignored) { - out.style(Style.Failure).text( - 'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' + - 'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' + - 'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)' - ) - versionOverride = 'NO-GIT-TAG-SET' - identifiedVersion = versionOverride -} -version = identifiedVersion -ext { - modVersion = identifiedVersion -} - -if (identifiedVersion == versionOverride) { - out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7') -} - -group = "com.github.GTNewHorizons" -if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) { - base { - archivesName = customArchiveBaseName - } -} else { - base { - archivesName = modId - } -} - - -minecraft { - if (replaceGradleTokenInFile) { - for (f in replaceGradleTokenInFile.split(',')) { - tagReplacementFiles.add f - } - } - if (gradleTokenModId) { - injectedTags.put gradleTokenModId, modId - } - if (gradleTokenModName) { - injectedTags.put gradleTokenModName, modName - } - if (gradleTokenVersion) { - injectedTags.put gradleTokenVersion, modVersion - } - if (gradleTokenGroupName) { - injectedTags.put gradleTokenGroupName, modGroup - } - if (enableGenericInjection.toBoolean()) { - injectMissingGenerics.set(true) - } - - username = developmentEnvironmentUserName.toString() - - lwjgl3Version = "3.3.2" - - // Enable assertions in the current mod - extraRunJvmArguments.add("-ea:${modGroup}") - - if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { - if (usesMixinDebug.toBoolean()) { - extraRunJvmArguments.addAll([ - "-Dmixin.debug.countInjections=true", - "-Dmixin.debug.verbose=true", - "-Dmixin.debug.export=true" - ]) - } - } - - // Blowdryer is present in some old mod builds, do not propagate it further as a dependency - // IC2 has no reobf jars in its Maven - groupsToExcludeFromAutoReobfMapping.addAll(["com.diffplug", "com.diffplug.durian", "net.industrial-craft"]) -} - -if (generateGradleTokenClass) { - tasks.injectTags.outputClassName.set(generateGradleTokenClass) -} - -// Custom reobf auto-mappings -configurations.configureEach { - dependencies.configureEach { dep -> - if (dep instanceof org.gradle.api.artifacts.ExternalModuleDependency) { - if (dep.group == "net.industrial-craft" && dep.name == "industrialcraft-2") { - // https://www.curseforge.com/minecraft/mc-mods/industrial-craft/files/2353971 - project.dependencies.reobfJarConfiguration("curse.maven:ic2-242638:2353971") - } - } - } - def obfuscationAttr = it.attributes.getAttribute(ObfuscationAttribute.OBFUSCATION_ATTRIBUTE) - if (obfuscationAttr != null && obfuscationAttr.name == ObfuscationAttribute.SRG) { - resolutionStrategy.eachDependency { DependencyResolveDetails details -> - // Remap CoFH core cursemaven dev jar to the obfuscated version for runObfClient/Server - if (details.requested.group == 'curse.maven' && details.requested.name.endsWith('-69162') && details.requested.version == '2388751') { - details.useVersion '2388750' - details.because 'Pick obfuscated jar' - } - } - } -} - -// Ensure tests have access to minecraft classes -sourceSets { - test { - java { - compileClasspath += sourceSets.patchedMc.output + sourceSets.mcLauncher.output - runtimeClasspath += sourceSets.patchedMc.output + sourceSets.mcLauncher.output - } - } -} - -if (file('addon.gradle.kts').exists()) { - apply from: 'addon.gradle.kts' -} else if (file('addon.gradle').exists()) { - apply from: 'addon.gradle' -} - -// File for local tweaks not commited to Git -if (file('addon.local.gradle.kts').exists()) { - apply from: 'addon.local.gradle.kts' -} else if (file('addon.local.gradle').exists()) { - apply from: 'addon.local.gradle' -} - -// Allow unsafe repos but warn -repositories.configureEach { repo -> - if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) { - if (repo.getUrl() != null && repo.getUrl().getScheme() == "http" && !repo.allowInsecureProtocol) { - logger.warn("Deprecated: Allowing insecure connections for repo '${repo.name}' - add 'allowInsecureProtocol = true'") - repo.allowInsecureProtocol = true - } - } -} - -if (file('repositories.gradle.kts').exists()) { - apply from: 'repositories.gradle.kts' -} else if (file('repositories.gradle').exists()) { - apply from: 'repositories.gradle' -} else { - logger.error("Neither repositories.gradle.kts nor repositories.gradle was found, make sure you extracted the full ExampleMod template.") - throw new RuntimeException("Missing repositories.gradle[.kts]") -} - -configurations { - runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable) - testRuntimeClasspath.extendsFrom(runtimeOnlyNonPublishable) - for (config in [compileClasspath, runtimeClasspath, testCompileClasspath, testRuntimeClasspath]) { - if (usesShadowedDependencies.toBoolean()) { - config.extendsFrom(shadowImplementation) - // TODO: remove Compile after all uses are refactored to Implementation - config.extendsFrom(shadeCompile) - config.extendsFrom(shadowCompile) - } - } - // A "bag-of-dependencies"-style configuration for backwards compatibility, gets put in "api" - create("compile") { - description = "Deprecated: use api or implementation instead, gets put in api" - canBeConsumed = false - canBeResolved = false - visible = false - } - create("testCompile") { - description = "Deprecated: use testImplementation instead" - canBeConsumed = false - canBeResolved = false - visible = false - } - api.extendsFrom(compile) - testImplementation.extendsFrom(testCompile) -} - -afterEvaluate { - if (!configurations.compile.allDependencies.empty || !configurations.testCompile.allDependencies.empty) { - logger.warn("This project uses deprecated `compile` dependencies, please migrate to using `api` and `implementation`") - logger.warn("For more details, see https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/master/dependencies.gradle") - } -} - -repositories { - maven { - name = "GTNH Maven" - url = "https://nexus.gtnewhorizons.com/repository/public/" - // Links for convenience: - // Simple HTML browsing: https://nexus.gtnewhorizons.com/service/rest/repository/browse/releases/ - // Rich web UI browsing: https://nexus.gtnewhorizons.com/#browse/browse:releases - } - maven { - name 'Overmind forge repo mirror' - url 'https://gregtech.overminddl1.com/' - } - maven { - name 'sonatype' - url 'https://oss.sonatype.org/content/repositories/snapshots/' - content { - includeGroup "org.lwjgl" - } - } - if (includeWellKnownRepositories.toBoolean()) { - exclusiveContent { - forRepository { - maven { - name "CurseMaven" - url "https://cursemaven.com" - } - } - filter { - includeGroup "curse.maven" - } - } - exclusiveContent { - forRepository { - maven { - name = "Modrinth" - url = "https://api.modrinth.com/maven" - } - } - filter { - includeGroup "maven.modrinth" - } - } - maven { - name = "ic2" - url = getURL("https://maven2.ic2.player.to/", "https://maven.ic2.player.to/") - content { - includeGroup "net.industrial-craft" - } - metadataSources { - mavenPom() - artifact() - } - } - maven { - name "MMD Maven" - url "https://maven.mcmoddev.com/" - } - } -} - -def mixinProviderGroup = "io.github.legacymoddingmc" -def mixinProviderModule = "unimixins" -def mixinProviderVersion = "0.1.13" -def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}" -def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev" -ext.mixinProviderSpec = mixinProviderSpec - -def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' - -dependencies { - if (usesMixins.toBoolean()) { - annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3') - annotationProcessor('com.google.guava:guava:24.1.1-jre') - annotationProcessor('com.google.code.gson:gson:2.8.6') - annotationProcessor(mixinProviderSpec) - if (usesMixinDebug.toBoolean()) { - runtimeOnlyNonPublishable('org.jetbrains:intellij-fernflower:1.2.1.16') - } - } - if (usesMixins.toBoolean()) { - implementation(modUtils.enableMixins(mixinProviderSpec, mixingConfigRefMap)) - } else if (forceEnableMixins.toBoolean()) { - runtimeOnlyNonPublishable(mixinProviderSpec) - } -} - -pluginManager.withPlugin('org.jetbrains.kotlin.kapt') { - if (usesMixins.toBoolean()) { - dependencies { - kapt(mixinProviderSpec) - } - } -} - -// Replace old mixin mods with unimixins -// https://docs.gradle.org/8.0.2/userguide/resolution_rules.html#sec:substitution_with_classifier -configurations.all { - resolutionStrategy.dependencySubstitution { - substitute module('com.gtnewhorizon:gtnhmixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods") - substitute module('com.github.GTNewHorizons:Mixingasm') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods") - substitute module('com.github.GTNewHorizons:SpongePoweredMixin') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods") - substitute module('com.github.GTNewHorizons:SpongeMixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods") - substitute module('io.github.legacymoddingmc:unimixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Our previous unimixins upload was missing the dev classifier") - - substitute module('org.scala-lang:scala-library:2.11.1') using module('org.scala-lang:scala-library:2.11.5') because('To allow mixing with Java 8 targets') - } -} - -dependencies { - constraints { - def minGtnhLibVersion = "0.0.13" - implementation("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") { - because("fixes duplicate mod errors in java 17 configurations using old gtnhlib") - } - runtimeOnly("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") { - because("fixes duplicate mod errors in java 17 configurations using old gtnhlib") - } - devOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") { - because("fixes duplicate mod errors in java 17 configurations using old gtnhlib") - } - runtimeOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") { - because("fixes duplicate mod errors in java 17 configurations using old gtnhlib") - } - } -} - -if (file('dependencies.gradle.kts').exists()) { - apply from: 'dependencies.gradle.kts' -} else if (file('dependencies.gradle').exists()) { - apply from: 'dependencies.gradle' -} else { - logger.error("Neither dependencies.gradle.kts nor dependencies.gradle was found, make sure you extracted the full ExampleMod template.") - throw new RuntimeException("Missing dependencies.gradle[.kts]") -} - -tasks.register('generateAssets') { - group = "GTNH Buildscript" - description = "Generates a mixin config file at /src/main/resources/mixins.modid.json if needed" - onlyIf { usesMixins.toBoolean() } - doLast { - def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json") - if (!mixinConfigFile.exists()) { - def mixinPluginLine = "" - if (!mixinPlugin.isEmpty()) { - // We might not have a mixin plugin if we're using early/late mixins - mixinPluginLine += """\n "plugin": "${modGroup}.${mixinPlugin}", """ - } - - mixinConfigFile.text = """{ - "required": true, - "minVersion": "0.8.5-GTNH", - "package": "${modGroup}.${mixinsPackage}",${mixinPluginLine} - "refmap": "${mixingConfigRefMap}", - "target": "@env(DEFAULT)", - "compatibilityLevel": "JAVA_8", - "mixins": [], - "client": [], - "server": [] -} -""" - } - } -} - -if (usesMixins.toBoolean()) { - tasks.named("processResources").configure { - dependsOn("generateAssets") - } - - tasks.named("compileJava", JavaCompile).configure { - options.compilerArgs += [ - // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code - "-XDenableSunApiLintControl", - "-XDignore.symbol.file" - ] - } -} - -tasks.named("processResources", ProcessResources).configure { - // this will ensure that this task is redone when the versions change. - inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.mcVersion - exclude("spotless.gradle") - - // replace stuff in mcmod.info, nothing else. replaces ${key} with value in text - filesMatching("mcmod.info") { - expand "minecraftVersion": project.minecraft.mcVersion, - "modVersion": modVersion, - "modId": modId, - "modName": modName - } - - if (usesMixins.toBoolean()) { - dependsOn("compileJava", "compileScala") - } -} - -ext.java17Toolchain = (JavaToolchainSpec spec) -> { - spec.languageVersion.set(JavaLanguageVersion.of(17)) - spec.vendor.set(JvmVendorSpec.matching("jetbrains")) -} - -ext.java17DependenciesCfg = configurations.create("java17Dependencies") { - extendsFrom(configurations.getByName("runtimeClasspath")) // Ensure consistent transitive dependency resolution - canBeConsumed = false -} -ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies") { - canBeConsumed = false -} - -dependencies { - def lwjgl3ifyVersion = '1.5.7' - if (modId != 'lwjgl3ify') { - java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") - } - if (modId != 'hodgepodge') { - java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.4.4') - } - - java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false} -} - -ext.java17JvmArgs = [ - // Java 9+ support - "--illegal-access=warn", - "-Djava.security.manager=allow", - "-Dfile.encoding=UTF-8", - "--add-opens", "java.base/jdk.internal.loader=ALL-UNNAMED", - "--add-opens", "java.base/java.net=ALL-UNNAMED", - "--add-opens", "java.base/java.nio=ALL-UNNAMED", - "--add-opens", "java.base/java.io=ALL-UNNAMED", - "--add-opens", "java.base/java.lang=ALL-UNNAMED", - "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED", - "--add-opens", "java.base/java.text=ALL-UNNAMED", - "--add-opens", "java.base/java.util=ALL-UNNAMED", - "--add-opens", "java.base/jdk.internal.reflect=ALL-UNNAMED", - "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", - "--add-opens", "jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED,java.naming", - "--add-opens", "java.desktop/sun.awt.image=ALL-UNNAMED", - "--add-modules", "jdk.dynalink", - "--add-opens", "jdk.dynalink/jdk.dynalink.beans=ALL-UNNAMED", - "--add-modules", "java.sql.rowset", - "--add-opens", "java.sql.rowset/javax.sql.rowset.serial=ALL-UNNAMED" -] - -ext.hotswapJvmArgs = [ - // DCEVM advanced hot reload - "-XX:+AllowEnhancedClassRedefinition", - "-XX:HotswapAgent=fatjar" -] - -ext.setupHotswapAgentTask = tasks.register("setupHotswapAgent") { - group = "GTNH Buildscript" - description = "Installs a recent version of HotSwapAgent into the Java 17 JetBrains runtime directory" - def hsaUrl = 'https://github.com/HotswapProjects/HotswapAgent/releases/download/1.4.2-SNAPSHOT/hotswap-agent-1.4.2-SNAPSHOT.jar' - def targetFolderProvider = javaToolchains.launcherFor(java17Toolchain).map {it.metadata.installationPath.dir("lib/hotswap")} - def targetFilename = "hotswap-agent.jar" - onlyIf { - !targetFolderProvider.get().file(targetFilename).asFile.exists() - } - doLast { - def targetFolder = targetFolderProvider.get() - targetFolder.asFile.mkdirs() - download.run { - src hsaUrl - dest targetFolder.file(targetFilename).asFile - overwrite false - tempAndMove true - } - } -} - -public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask { - // IntelliJ doesn't seem to allow commandline arguments so we also support an env variable - private boolean enableHotswap = Boolean.valueOf(System.getenv("HOTSWAP")); - - @Input - public boolean getEnableHotswap() { return enableHotswap } - @Option(option = "hotswap", description = "Enables HotSwapAgent for enhanced class reloading under a debugger") - public boolean setEnableHotswap(boolean enable) { enableHotswap = enable } - - @Inject - public RunHotswappableMinecraftTask(Distribution side, String superTask, org.gradle.api.invocation.Gradle gradle) { - super(side, gradle) - - this.lwjglVersion = 3 - this.javaLauncher = project.javaToolchains.launcherFor(project.java17Toolchain) - this.extraJvmArgs.addAll(project.java17JvmArgs) - this.extraJvmArgs.addAll(project.provider(() -> enableHotswap ? project.hotswapJvmArgs : [])) - - this.classpath(project.java17PatchDependenciesCfg) - if (side == Distribution.CLIENT) { - this.classpath(project.minecraftTasks.lwjgl3Configuration) - } - // Use a raw provider instead of map to not create a dependency on the task - this.classpath(project.provider(() -> project.tasks.named(superTask, RunMinecraftTask).get().classpath)) - this.classpath.filter { file -> - !file.path.contains("2.9.4-nightly-20150209") // Remove lwjgl2 - } - this.classpath(project.java17DependenciesCfg) - } - - public void setup(Project project) { - super.setup(project) - if (project.usesMixins.toBoolean()) { - this.extraJvmArgs.addAll(project.provider(() -> { - def mixinCfg = project.configurations.detachedConfiguration(project.dependencies.create(project.mixinProviderSpec)) - mixinCfg.canBeConsumed = false - mixinCfg.transitive = false - enableHotswap ? ["-javaagent:" + mixinCfg.singleFile.absolutePath] : [] - })) - } - } -} - -def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Distribution.CLIENT, "runClient") -runClient17Task.configure { - setup(project) - group = "Modded Minecraft" - description = "Runs the modded client using Java 17, lwjgl3ify and Hodgepodge" - dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar') - mainClass = "GradleStart" - username = minecraft.username - userUUID = minecraft.userUUID -} - -def runServer17Task = tasks.register("runServer17", RunHotswappableMinecraftTask, Distribution.DEDICATED_SERVER, "runServer") -runServer17Task.configure { - setup(project) - group = "Modded Minecraft" - description = "Runs the modded server using Java 17, lwjgl3ify and Hodgepodge" - dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar') - mainClass = "GradleStartServer" - extraArgs.add("nogui") -} - -def getManifestAttributes() { - def manifestAttributes = [:] - if (!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) { - manifestAttributes += ["FMLCorePluginContainsFMLMod": true] - } - - if (accessTransformersFile) { - manifestAttributes += ["FMLAT": accessTransformersFile.toString()] - } - - if (coreModClass) { - manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass] - } - - if (usesMixins.toBoolean()) { - manifestAttributes += [ - "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", - "MixinConfigs" : "mixins." + modId + ".json", - "ForceLoadAsMod": !containsMixinsAndOrCoreModOnly.toBoolean() - ] - } - return manifestAttributes -} - -tasks.named("jar", Jar).configure { - manifest { - attributes(getManifestAttributes()) - } -} - -if (usesShadowedDependencies.toBoolean()) { - tasks.named("shadowJar", ShadowJar).configure { - manifest { - attributes(getManifestAttributes()) - } - - if (minimizeShadowedDependencies.toBoolean()) { - minimize() // This will only allow shading for actually used classes - } - configurations = [ - project.configurations.shadowImplementation, - project.configurations.shadowCompile, - project.configurations.shadeCompile - ] - archiveClassifier.set('dev') - if (relocateShadowedDependencies.toBoolean()) { - relocationPrefix = modGroup + ".shadow" - enableRelocation = true - } - } - configurations.runtimeElements.outgoing.artifacts.clear() - configurations.apiElements.outgoing.artifacts.clear() - configurations.runtimeElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar)) - configurations.apiElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar)) - tasks.named("jar", Jar) { - archiveClassifier.set('dev-preshadow') - } - tasks.named("reobfJar", ReobfuscatedJar) { - inputJar.set(tasks.named("shadowJar", ShadowJar).flatMap({it.archiveFile})) - } - AdhocComponentWithVariants javaComponent = (AdhocComponentWithVariants) project.components.findByName("java") - javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) { - skip() - } -} -ext.publishableDevJar = usesShadowedDependencies.toBoolean() ? tasks.shadowJar : tasks.jar -ext.publishableObfJar = tasks.reobfJar - -tasks.register('apiJar', Jar) { - from(sourceSets.main.allSource) { - include modGroupPath + "/" + apiPackagePath + '/**' - } - - from(sourceSets.main.output) { - include modGroupPath + "/" + apiPackagePath + '/**' - } - - from(sourceSets.main.resources.srcDirs) { - include("LICENSE") - } - - getArchiveClassifier().set('api') -} - -artifacts { - if (!noPublishedSources) { - archives tasks.named("sourcesJar") - } - if (apiPackage) { - archives tasks.named("apiJar") - } -} - -idea { - module { - downloadJavadoc = true - downloadSources = true - inheritOutputDirs = true - } - project { - settings { - if (ideaOverrideBuildType != "") { - delegateActions { - if ("gradle".equalsIgnoreCase(ideaOverrideBuildType)) { - delegateBuildRunToGradle = true - testRunner = org.jetbrains.gradle.ext.ActionDelegationConfig.TestRunner.GRADLE - } else if ("idea".equalsIgnoreCase(ideaOverrideBuildType)) { - delegateBuildRunToGradle = false - testRunner = org.jetbrains.gradle.ext.ActionDelegationConfig.TestRunner.PLATFORM - } else { - throw GradleScriptException('Accepted value for ideaOverrideBuildType is one of gradle or idea.') - } - } - } - runConfigurations { - "0. Build and Test"(Gradle) { - taskNames = ["build"] - } - "1. Run Client"(Gradle) { - taskNames = ["runClient"] - } - "2. Run Server"(Gradle) { - taskNames = ["runServer"] - } - "1a. Run Client (Java 17)"(Gradle) { - taskNames = ["runClient17"] - } - "2a. Run Server (Java 17)"(Gradle) { - taskNames = ["runServer17"] - } - "1b. Run Client (Java 17, Hotswap)"(Gradle) { - taskNames = ["runClient17"] - envs = ["HOTSWAP": "true"] - } - "2b. Run Server (Java 17, Hotswap)"(Gradle) { - taskNames = ["runServer17"] - envs = ["HOTSWAP": "true"] - } - "3. Run Obfuscated Client"(Gradle) { - taskNames = ["runObfClient"] - } - "4. Run Obfuscated Server"(Gradle) { - taskNames = ["runObfServer"] - } - if (!disableSpotless) { - "5. Apply spotless"(Gradle) { - taskNames = ["spotlessApply"] - } - } - def coreModArgs = "" - if (coreModClass) { - coreModArgs = ' "-Dfml.coreMods.load=' + modGroup + '.' + coreModClass + '"' - } - "Run Client (IJ Native)"(Application) { - mainClass = "GradleStart" - moduleName = project.name + ".ideVirtualMain" - afterEvaluate { - workingDirectory = tasks.runClient.workingDir.absolutePath - programParameters = tasks.runClient.calculateArgs(project).collect { '"' + it + '"' }.join(' ') - jvmArgs = tasks.runClient.calculateJvmArgs(project).collect { '"' + it + '"' }.join(' ') + - ' ' + tasks.runClient.systemProperties.collect { '"-D' + it.key + '=' + it.value.toString() + '"' }.join(' ') + - coreModArgs - } - } - "Run Server (IJ Native)"(Application) { - mainClass = "GradleStartServer" - moduleName = project.name + ".ideVirtualMain" - afterEvaluate { - workingDirectory = tasks.runServer.workingDir.absolutePath - programParameters = tasks.runServer.calculateArgs(project).collect { '"' + it + '"' }.join(' ') - jvmArgs = tasks.runServer.calculateJvmArgs(project).collect { '"' + it + '"' }.join(' ') + - ' ' + tasks.runServer.systemProperties.collect { '"-D' + it.key + '=' + it.value.toString() + '"' }.join(' ') + - coreModArgs - } - } - } - compiler.javac { - afterEvaluate { - javacAdditionalOptions = "-encoding utf8" - moduleJavacAdditionalOptions = [ - (project.name + ".main"): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ') - ] - } - } - withIDEADir { File ideaDir -> - if (!ideaDir.path.contains(".idea")) { - // If an .ipr file exists, the project root directory is passed here instead of the .idea subdirectory - ideaDir = new File(ideaDir, ".idea") - } - if (ideaDir.isDirectory()) { - def miscFile = new File(ideaDir, "misc.xml") - if (miscFile.isFile()) { - boolean dirty = false - def miscTransformer = new XmlTransformer() - miscTransformer.addAction { root -> - Node rootNode = root.asNode() - def rootManager = rootNode - .component.find { it.@name == 'ProjectRootManager' } - if (!rootManager) { - rootManager = rootNode.appendNode('component', ['name': 'ProjectRootManager', 'version': '2']) - dirty = true - } - def output = rootManager.output - if (!output) { - output = rootManager.appendNode('output') - dirty = true - } - if (!output.@url) { - // Only modify the output url if it doesn't yet have one, or if the existing one is blank somehow. - // This is a sensible default for most setups - output.@url = 'file://$PROJECT_DIR$/build/ideaBuild' - dirty = true - } - } - def result = miscTransformer.transform(miscFile.text) - if (dirty) { - miscFile.write(result) - } - } else { - miscFile.text = """ - - - - - -""" - } - } - } - } - } -} - -tasks.named("processIdeaSettings").configure { - dependsOn("injectTags") -} - -tasks.named("ideVirtualMainClasses").configure { - // Make IntelliJ "Build project" build the mod jars - dependsOn("jar", "reobfJar") - if (!disableSpotless) { - dependsOn("spotlessCheck") - } -} - -// workaround variable hiding in pom processing -def projectConfigs = project.configurations - -publishing { - publications { - create("maven", MavenPublication) { - from components.java - - if (apiPackage) { - artifact apiJar - } - - groupId = System.getenv("ARTIFACT_GROUP_ID") ?: project.group - artifactId = System.getenv("ARTIFACT_ID") ?: project.name - // Using the identified version, not project.version as it has the prepended 1.7.10 - version = System.getenv("RELEASE_VERSION") ?: identifiedVersion - } - } - repositories { - if (usesMavenPublishing.toBoolean() && System.getenv("MAVEN_USER") != null) { - maven { - url = mavenPublishUrl - allowInsecureProtocol = mavenPublishUrl.startsWith("http://") - credentials { - username = System.getenv("MAVEN_USER") ?: "NONE" - password = System.getenv("MAVEN_PASSWORD") ?: "NONE" - } - } - } - } -} - -if (modrinthProjectId.size() != 0 && System.getenv("MODRINTH_TOKEN") != null) { - apply plugin: 'com.modrinth.minotaur' - - File changelogFile = new File(System.getenv("CHANGELOG_FILE") ?: "CHANGELOG.md") - - modrinth { - token = System.getenv("MODRINTH_TOKEN") - projectId = modrinthProjectId - versionNumber = identifiedVersion - versionType = identifiedVersion.endsWith("-pre") ? "beta" : "release" - changelog = changelogFile.exists() ? changelogFile.getText("UTF-8") : "" - uploadFile = publishableObfJar - additionalFiles = getSecondaryArtifacts() - gameVersions = [minecraftVersion] - loaders = ["forge"] - debugMode = false - } - - if (modrinthRelations.size() != 0) { - String[] deps = modrinthRelations.split(";") - deps.each { dep -> - if (dep.size() == 0) { - return - } - String[] parts = dep.split(":") - String[] qual = parts[0].split("-") - addModrinthDep(qual[0], qual[1], parts[1]) - } - } - if (usesMixins.toBoolean()) { - addModrinthDep("required", "project", "unimixins") - } - tasks.modrinth.dependsOn(build) - tasks.publish.dependsOn(tasks.modrinth) -} - -if (curseForgeProjectId.size() != 0 && System.getenv("CURSEFORGE_TOKEN") != null) { - apply plugin: 'com.matthewprenger.cursegradle' - - File changelogFile = new File(System.getenv("CHANGELOG_FILE") ?: "CHANGELOG.md") - - curseforge { - apiKey = System.getenv("CURSEFORGE_TOKEN") - project { - id = curseForgeProjectId - if (changelogFile.exists()) { - changelogType = "markdown" - changelog = changelogFile - } - releaseType = identifiedVersion.endsWith("-pre") ? "beta" : "release" - addGameVersion minecraftVersion - addGameVersion "Forge" - mainArtifact publishableObfJar - for (artifact in getSecondaryArtifacts()) addArtifact artifact - } - - options { - javaIntegration = false - forgeGradleIntegration = false - debug = false - } - } - - if (curseForgeRelations.size() != 0) { - String[] deps = curseForgeRelations.split(";") - deps.each { dep -> - if (dep.size() == 0) { - return - } - String[] parts = dep.split(":") - addCurseForgeRelation(parts[0], parts[1]) - } - } - if (usesMixins.toBoolean()) { - addCurseForgeRelation("requiredDependency", "unimixins") - } - tasks.curseforge.dependsOn(build) - tasks.publish.dependsOn(tasks.curseforge) -} - -def addModrinthDep(String scope, String type, String name) { - com.modrinth.minotaur.dependencies.Dependency dep; - if (!(scope in ["required", "optional", "incompatible", "embedded"])) { - throw new Exception("Invalid modrinth dependency scope: " + scope) - } - switch (type) { - case "project": - dep = new ModDependency(name, scope) - break - case "version": - dep = new VersionDependency(name, scope) - break - default: - throw new Exception("Invalid modrinth dependency type: " + type) - } - project.modrinth.dependencies.add(dep) -} - -def addCurseForgeRelation(String type, String name) { - if (!(type in ["requiredDependency", "embeddedLibrary", "optionalDependency", "tool", "incompatible"])) { - throw new Exception("Invalid CurseForge relation type: " + type) - } - CurseArtifact artifact = project.curseforge.curseProjects[0].mainArtifact - CurseRelation rel = (artifact.curseRelations ?: (artifact.curseRelations = new CurseRelation())) - rel."$type"(name) -} - -// Updating - -def buildscriptGradleVersion = "8.5" - -tasks.named('wrapper', Wrapper).configure { - gradleVersion = buildscriptGradleVersion -} - -tasks.register('updateBuildScript') { - group = 'GTNH Buildscript' - description = 'Updates the build script to the latest version' - - if (gradle.gradleVersion != buildscriptGradleVersion && !Boolean.getBoolean('DISABLE_BUILDSCRIPT_GRADLE_UPDATE')) { - dependsOn('wrapper') - } - - doLast { - if (performBuildScriptUpdate()) return - - print("Build script already up-to-date!") - } -} - -if (!project.getGradle().startParameter.isOffline() && !Boolean.getBoolean('DISABLE_BUILDSCRIPT_UPDATE_CHECK') && isNewBuildScriptVersionAvailable()) { - if (autoUpdateBuildScript.toBoolean()) { - performBuildScriptUpdate() - } else { - out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'") - if (gradle.gradleVersion != buildscriptGradleVersion) { - out.style(Style.SuccessHeader).println("updateBuildScript can update gradle from ${gradle.gradleVersion} to ${buildscriptGradleVersion}\n") - } - } -} - -// If you want to add more cases to this task, implement them as arguments if total amount to print gets too large -tasks.register('faq') { - group = 'GTNH Buildscript' - description = 'Prints frequently asked questions about building a project' - - doLast { - print("If your build fails to fetch dependencies, run './gradlew updateDependencies'. " + - "Or you can manually check if the versions are still on the distributing sites - " + - "the links can be found in repositories.gradle and build.gradle:repositories, " + - "but not build.gradle:buildscript.repositories - those ones are for gradle plugin metadata.\n\n" + - "If your build fails to recognize the syntax of new Java versions, enable Jabel in your " + - "gradle.properties. See how it's done in GTNH ExampleMod/gradle.properties. " + - "However, keep in mind that Jabel enables only syntax features, but not APIs that were introduced in " + - "Java 9 or later.") - } -} - -static URL availableBuildScriptUrl() { - new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/build.gradle") -} - -static URL exampleSettingsGradleUrl() { - new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/settings.gradle.example") -} - -static URL exampleGitAttributesUrl() { - new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/.gitattributes") -} - - -boolean verifyGitAttributes() { - def gitattributesFile = getFile(".gitattributes") - if (!gitattributesFile.exists()) { - println("Downloading default .gitattributes") - exampleGitAttributesUrl().withInputStream { i -> gitattributesFile.withOutputStream { it << i } } - exec { - workingDir '.' - commandLine 'git', 'add', '--renormalize', '.' - } - return true - } - return false -} - -boolean verifySettingsGradle() { - def settingsFile = getFile("settings.gradle") - if (!settingsFile.exists()) { - println("Downloading default settings.gradle") - exampleSettingsGradleUrl().withInputStream { i -> settingsFile.withOutputStream { it << i } } - return true - } - return false -} - -boolean performBuildScriptUpdate() { - if (isNewBuildScriptVersionAvailable()) { - def buildscriptFile = getFile("build.gradle") - availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } } - def out = services.get(StyledTextOutputFactory).create('buildscript-update-output') - out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!") - boolean settingsupdated = verifySettingsGradle() - settingsupdated = verifyGitAttributes() || settingsupdated - if (settingsupdated) - throw new GradleException("Settings has been updated, please re-run task.") - return true - } - return false -} - -boolean isNewBuildScriptVersionAvailable() { - Map parameters = ["connectTimeout": 2000, "readTimeout": 2000] - - String currentBuildScript = getFile("build.gradle").getText() - String currentBuildScriptHash = getVersionHash(currentBuildScript) - String availableBuildScriptHash - try { - String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText() - availableBuildScriptHash = getVersionHash(availableBuildScript) - } catch (IOException e) { - logger.warn("Could not check for buildscript update availability: {}", e.message) - return false - } - - boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash - return !isUpToDate -} - -static String getVersionHash(String buildScriptContent) { - String versionLine = buildScriptContent.find("^//version: [a-z0-9]*") - if (versionLine != null) { - return versionLine.split(": ").last() - } - return "" -} - -// Parameter Deobfuscation - -tasks.register('deobfParams') { - group = 'GTNH Buildscript' - description = 'Rename all obfuscated parameter names inherited from Minecraft classes' - doLast { // TODO - - String mcpDir = "$project.gradle.gradleUserHomeDir/caches/minecraft/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion" - String mcpZIP = "$mcpDir/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip" - String paramsCSV = "$mcpDir/params.csv" - - download.run { - src "https://maven.minecraftforge.net/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion-$minecraftVersion/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip" - dest mcpZIP - overwrite false - } - - if (!file(paramsCSV).exists()) { - println("Extracting MCP archive ...") - copy { - from(zipTree(mcpZIP)) - into(mcpDir) - } - } - - println("Parsing params.csv ...") - Map params = new HashMap<>() - Files.lines(Paths.get(paramsCSV)).forEach { line -> - String[] cells = line.split(",") - if (cells.length > 2 && cells[0].matches("p_i?\\d+_\\d+_")) { - params.put(cells[0], cells[1]) - } - } - - out.style(Style.Success).println("Modified ${replaceParams(file("$projectDir/src/main/java"), params)} files!") - out.style(Style.Failure).println("Don't forget to verify that the code still works as before!\n It could be broken due to duplicate variables existing now\n or parameters taking priority over other variables.") - } -} - -static int replaceParams(File file, Map params) { - int fileCount = 0 - - if (file.isDirectory()) { - for (File f : file.listFiles()) { - fileCount += replaceParams(f, params) - } - return fileCount - } - println("Visiting ${file.getName()} ...") - try { - String content = new String(Files.readAllBytes(file.toPath())) - int hash = content.hashCode() - params.forEach { key, value -> - content = content.replaceAll(key, value) - } - if (hash != content.hashCode()) { - Files.write(file.toPath(), content.getBytes("UTF-8")) - return 1 - } - } catch (Exception e) { - e.printStackTrace() - } - return 0 -} - -// Dependency Deobfuscation (Deprecated, use the new RFG API documented in dependencies.gradle) - -def deobf(String sourceURL) { - try { - URL url = new URL(sourceURL) - String fileName = url.getFile() - - //get rid of directories: - int lastSlash = fileName.lastIndexOf("/") - if (lastSlash > 0) { - fileName = fileName.substring(lastSlash + 1) - } - //get rid of extension: - if (fileName.endsWith(".jar") || fileName.endsWith(".litemod")) { - fileName = fileName.substring(0, fileName.lastIndexOf(".")) - } - - String hostName = url.getHost() - if (hostName.startsWith("www.")) { - hostName = hostName.substring(4) - } - List parts = Arrays.asList(hostName.split("\\.")) - Collections.reverse(parts) - hostName = String.join(".", parts) - - return deobf(sourceURL, "$hostName/$fileName") - } catch (Exception ignored) { - return deobf(sourceURL, "deobf/${sourceURL.hashCode()}") - } -} - -def deobfMaven(String repoURL, String mavenDep) { - if (!repoURL.endsWith("/")) { - repoURL += "/" - } - String[] parts = mavenDep.split(":") - parts[0] = parts[0].replace('.', '/') - def jarURL = repoURL + parts[0] + "/" + parts[1] + "/" + parts[2] + "/" + parts[1] + "-" + parts[2] + ".jar" - return deobf(jarURL) -} - -def deobfCurse(String curseDep) { - return dependencies.rfg.deobf("curse.maven:$curseDep") -} - -// The method above is to be preferred. Use this method if the filename is not at the end of the URL. -def deobf(String sourceURL, String rawFileName) { - String bon2Version = "2.5.1" - String fileName = URLDecoder.decode(rawFileName, "UTF-8") - String cacheDir = "$project.gradle.gradleUserHomeDir/caches" - String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar" - - download.run { - src sourceURL - dest obfFile - quiet true - overwrite false - } - return dependencies.rfg.deobf(files(obfFile)) -} -// Helper methods - -def checkPropertyExists(String propertyName) { - if (!project.hasProperty(propertyName)) { - throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties") - } -} - -def propertyDefaultIfUnset(String propertyName, defaultValue) { - if (!project.hasProperty(propertyName) || project.property(propertyName) == "") { - project.ext.setProperty(propertyName, defaultValue) - } -} - -def getFile(String relativePath) { - return new File(projectDir, relativePath) -} - -def getSecondaryArtifacts() { - // Because noPublishedSources from the beginning of the script is somehow not visible here... - boolean noPublishedSources = project.hasProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false - def secondaryArtifacts = [publishableDevJar] - if (!noPublishedSources) secondaryArtifacts += [sourcesJar] - if (apiPackage) secondaryArtifacts += [apiJar] - return secondaryArtifacts -} - -def getURL(String main, String fallback) { - return pingURL(main, 10000) ? main : fallback -} - -// credit: https://stackoverflow.com/a/3584332 -def pingURL(String url, int timeout) { - url = url.replaceFirst("^https", "http") // Otherwise an exception may be thrown on invalid SSL certificates. - try { - HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection() - connection.setConnectTimeout(timeout) - connection.setReadTimeout(timeout) - connection.setRequestMethod("HEAD") - int responseCode = connection.getResponseCode() - return 200 <= responseCode && responseCode <= 399 - } catch (IOException ignored) { - return false - } -} - -// For easier scripting of things that require variables defined earlier in the buildscript -if (file('addon.late.gradle.kts').exists()) { - apply from: 'addon.late.gradle.kts' -} else if (file('addon.late.gradle').exists()) { - apply from: 'addon.late.gradle' -} - -// File for local tweaks not commited to Git -if (file('addon.late.local.gradle.kts').exists()) { - apply from: 'addon.late.local.gradle.kts' -} else if (file('addon.late.local.gradle').exists()) { - apply from: 'addon.late.local.gradle' + id 'com.gtnewhorizons.gtnhconvention' } diff --git a/gradle.properties b/gradle.properties index a4e031edf9..03dcc4bbe1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,77 +1,101 @@ +# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable. +# LOCAL to test local config updates. +gtnh.settings.blowdryerTag = 0.2.0 + +# Human-readable mod name, available for mcmod.info population. modName = GT NEI Ore Plugin GT:NH Mod -# This is a case-sensitive string to identify your mod. Convention is to use lower case. +# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation. +# Conventionally lowercase. modId = gtneioreplugin +# Root package of the mod, used to find various classes in other properties, +# mcmod.info substitution, enabling assertions in run tasks, etc. modGroup = pers.gwyog.gtneioreplugin -# WHY is there no version field? -# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the -# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/ +# Whether to use modGroup as the maven publishing group. +# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods. +useModGroupForPublishing = false -# Will update your build.gradle automatically whenever an update is available +# Updates your build.gradle and settings.gradle automatically whenever an update is available. autoUpdateBuildScript = false +# Version of Minecraft to target minecraftVersion = 1.7.10 + +# Version of Minecraft Forge to target forgeVersion = 10.13.4.1614 -# Specify a MCP channel and mappings version for dependency deobfuscation and the deobfParams task. +# Specify an MCP channel for dependency deobfuscation and the deobfParams task. channel = stable + +# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task. mappingsVersion = 12 -# Define other MCP mappings for dependency deobfuscation +# Defines other MCP mappings for dependency deobfuscation. remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/ -# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you -# restart Minecraft in development. Choose this dependent on your mod: -# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name -# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty +# Select a default username for testing your mod. You can always override this per-run by running +# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE. developmentEnvironmentUserName = Developer -# Enables using modern java syntax (up to version 17) via Jabel, while still targeting JVM 8. +# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8. # See https://github.com/bsideup/jabel for details on how this works. enableModernJavaSyntax = true -# Enables injecting missing generics into the decompiled source code for a better coding experience -# Turns most publicly visible List, Map, etc. into proper List, Map types +# Enables injecting missing generics into the decompiled source code for a better coding experience. +# Turns most publicly visible List, Map, etc. into proper List, Map types. enableGenericInjection = false -# Generate a class with String fields for the mod id, name, version and group name named with the fields below +# Generate a class with a String field for the mod version named as defined below. +# If generateGradleTokenClass is empty or not missing, no such class will be generated. +# If gradleTokenVersion is empty or missing, the field will not be present in the class. generateGradleTokenClass = pers.gwyog.gtneioreplugin.Tags + +# Name of the token containing the project's current version to generate/replace. +gradleTokenVersion = VERSION + +# [DEPRECATED] Mod ID replacement token. gradleTokenModId = + +# [DEPRECATED] Mod name replacement token. gradleTokenModName = -gradleTokenVersion = VERSION -gradleTokenGroupName = + # [DEPRECATED] -# Multiple source files can be defined here by providing a comma-seperated list: Class1.java,Class2.java,Class3.java +# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java # public static final String VERSION = "GRADLETOKEN_VERSION"; # The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's -# version in @Mod([...], version = VERSION, [...]) -# Leave these properties empty to skip individual token replacements +# version in @Mod([...], version = VERSION, [...]). +# Leave these properties empty to skip individual token replacements. replaceGradleTokenInFile = # In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can # leave this property empty. -# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api +# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api apiPackage = # Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/ -# There can be multiple files in a comma-separated list. -# Example value: mymodid_at.cfg,nei_at.cfg +# There can be multiple files in a space-separated list. +# Example value: mymodid_at.cfg nei_at.cfg accessTransformersFile = # Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! usesMixins = false -# Adds some debug arguments like verbose output and export + +# Adds some debug arguments like verbose output and class export. usesMixinDebug = false + # Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise. mixinPlugin = + # Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail! mixinsPackage = + # Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin! # This parameter is for legacy compatibility only -# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin +# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin coreModClass = + # If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class # that is annotated with @Mod) you want this to be true. When in doubt: leave it on false! containsMixinsAndOrCoreModOnly = false @@ -79,22 +103,32 @@ containsMixinsAndOrCoreModOnly = false # Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins. forceEnableMixins = false -# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your -# responsibility check the licence and request permission for distribution, if required. +# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your +# responsibility to check the license and request permission for distribution if required. usesShadowedDependencies = false -# If disabled, won't remove unused classes from shaded dependencies. Some libraries use reflection to access + +# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access # their own classes, making the minimization unreliable. minimizeShadowedDependencies = true + # If disabled, won't rename the shadowed classes. relocateShadowedDependencies = true -# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories +# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories. includeWellKnownRepositories = true -# Publishing to modrinth requires you to set the MODRINTH_TOKEN environment variable to your current modrinth API token. +# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven. +# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables. +# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle. +usesMavenPublishing = true +# Maven repository to publish the mod to. +# mavenPublishUrl = https://nexus.gtnewhorizons.com/repository/releases/ + +# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token. +# # The project's ID on Modrinth. Can be either the slug or the ID. -# Leave this empty if you don't want to publish on Modrinth. +# Leave this empty if you don't want to publish to Modrinth. modrinthProjectId = # The project's relations on Modrinth. You can use this to refer to other projects on Modrinth. @@ -106,9 +140,8 @@ modrinthProjectId = # Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true modrinthRelations = - # Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens. - +# # The project's numeric ID on CurseForge. You can find this in the About Project box. # Leave this empty if you don't want to publish on CurseForge. curseForgeProjectId = @@ -118,29 +151,41 @@ curseForgeProjectId = # Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible], # and the name is the CurseForge project slug of the other mod. # Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft -# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true +# Note: UniMixins is automatically set as a required dependency if usesMixins = true. curseForgeRelations = - -# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older +# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older # projects. New projects should not use this parameter. # customArchiveBaseName = -# Optional parameter to prevent the source code from being published -# noPublishedSources = +# Optional parameter to have the build automatically fail if an illegal version is used. +# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'. +# The check is ONLY performed if the version is a git tag. +# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+ +# versionPattern = -# Uncomment this to disable spotless checks +# Uncomment to prevent the source code from being published. +# noPublishedSources = true + +# Uncomment this to disable Spotless checks. # This should only be uncommented to keep it easier to sync with upstream/other forks. # That is, if there is no other active fork/upstream, NEVER change this. # disableSpotless = true -# Override the IDEA build type. Valid value is "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle" +# Uncomment this to disable Checkstyle checks (currently wildcard import check). +disableCheckstyle = true + +# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle" # (force use delegated build). # This is meant to be set in $HOME/.gradle/gradle.properties. -# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be always native build. +# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build. # WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want! # Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you. # ideaOverrideBuildType = idea -# TODO: Remove when you modify this repository, it's been put in for automatic buildscript updates -disableCheckstyle = true +# Whether IDEA should run spotless checks when pressing the Build button. +# This is meant to be set in $HOME/.gradle/gradle.properties. +# ideaCheckSpotlessOnBuild = true + +# Non-GTNH properties +gradleTokenGroupName = diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1af9e0930b..a80b22ce5c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew.bat b/gradlew.bat index 93e3f59f13..25da30dbde 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -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. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -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. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/settings.gradle b/settings.gradle index 8a66026e3d..e8946ada27 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,6 +6,7 @@ pluginManagement { name "GTNH Maven" url "https://nexus.gtnewhorizons.com/repository/public/" mavenContent { + includeGroup("com.gtnewhorizons") includeGroupByRegex("com\\.gtnewhorizons\\..+") } } @@ -16,12 +17,7 @@ pluginManagement { } plugins { - id 'com.diffplug.blowdryerSetup' version '1.7.1' - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' // Provides java toolchains + id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.8' } -blowdryerSetup { - repoSubfolder 'gtnhShared' - github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0') - //devLocal '.' // Use this when testing config updates locally -} + -- cgit From a30ab18f4f81726401bb1f3c826d2aa1f80d144f Mon Sep 17 00:00:00 2001 From: RealSilverMoon <31100241+RealSilverMoon@users.noreply.github.com> Date: Tue, 28 May 2024 20:39:19 +0800 Subject: Remove unnecessary check (#37) --- .../util/GT5UndergroundFluidHelper.java | 32 +++++----------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java index 9b47c757d8..85c4ee3004 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/GT5UndergroundFluidHelper.java @@ -8,13 +8,9 @@ import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; -import java.util.Hashtable; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; -import net.minecraft.world.WorldProvider; -import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; @@ -41,37 +37,23 @@ public class GT5UndergroundFluidHelper { .get(GT_Mod.gregtechproxy.mUndergroundOil); for (Map.Entry dimensionEntry : dimensionList.entrySet()) { String rawDimension = dimensionEntry.getKey(); - String dimension = null; + String dimension; try { dimension = getDimensionFromID(Integer.parseInt(rawDimension)); } catch (NumberFormatException ignored) { - Field fieldProviders = DimensionManager.class.getDeclaredField("providers"); - fieldProviders.setAccessible(true); - Hashtable> providers = (Hashtable>) fieldProviders - .get(null); - - // some short dimension names like Io might be caught by multiple dimension classes, - // so we'll check them all. - // List dimensionCandidates = providers.values() - List> dimensionCandidates = providers.values().stream() - .filter(p -> p.getName().contains(rawDimension)).collect(Collectors.toList()); - loop: for (Class candidate : dimensionCandidates) { + dimension = getDimensionForEdgeCase(rawDimension); + if (dimension == null) { for (int i = 0; i < DimensionHelper.DimNameTrimmed.length; i++) { - if (DimensionHelper.DimNameTrimmed[i] - .equalsIgnoreCase(candidate.getConstructor().newInstance().getDimensionName())) { + if (DimensionHelper.DimNameTrimmed[i].equalsIgnoreCase(rawDimension)) { dimension = DimensionHelper.DimNameDisplayed[i]; - break loop; + break; } } } } - if (dimension == null) { - dimension = getDimensionForEdgeCase(rawDimension); - if (dimension == null) { - LOG.warn("Unknown dimension found in GT5 config: " + rawDimension); - continue; - } + LOG.warn("Unknown dimension found in GT5 config: " + rawDimension); + continue; } Field fieldFluids = GT_UO_Dimension.class.getDeclaredField("fFluids"); -- cgit From c85896e7579bbb47c4fec0fd2b34f23a1f9bf958 Mon Sep 17 00:00:00 2001 From: Martin Robertz Date: Tue, 28 May 2024 21:07:42 +0200 Subject: update --- dependencies.gradle | 2 +- gradle.properties | 13 +++++++------ gradle/wrapper/gradle-wrapper.jar | Bin 43462 -> 43453 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index a84e4ba606..53de291e83 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,7 +1,7 @@ // Add your dependencies here dependencies { - api('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.25:dev') + api('com.github.GTNewHorizons:GT5-Unofficial:5.09.48.09:dev') compileOnly('com.opencsv:opencsv:4.0') } diff --git a/gradle.properties b/gradle.properties index 03dcc4bbe1..ab2336ae43 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ gtnh.settings.blowdryerTag = 0.2.0 # Human-readable mod name, available for mcmod.info population. -modName = GT NEI Ore Plugin GT:NH Mod +modName = GT NEI Ore Plugin GT\:NH Mod # Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation. # Conventionally lowercase. @@ -33,7 +33,7 @@ channel = stable mappingsVersion = 12 # Defines other MCP mappings for dependency deobfuscation. -remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/ +remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/ # Select a default username for testing your mod. You can always override this per-run by running # `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE. @@ -61,6 +61,9 @@ gradleTokenModId = # [DEPRECATED] Mod name replacement token. gradleTokenModName = +# [DEPRECATED] Mod Group replacement token. +gradleTokenGroupName = + # [DEPRECATED] # Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java # public static final String VERSION = "GRADLETOKEN_VERSION"; @@ -114,7 +117,7 @@ minimizeShadowedDependencies = true # If disabled, won't rename the shadowed classes. relocateShadowedDependencies = true -# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories. +# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories. includeWellKnownRepositories = true # Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven. @@ -123,7 +126,7 @@ includeWellKnownRepositories = true usesMavenPublishing = true # Maven repository to publish the mod to. -# mavenPublishUrl = https://nexus.gtnewhorizons.com/repository/releases/ +# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/ # Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token. # @@ -187,5 +190,3 @@ disableCheckstyle = true # This is meant to be set in $HOME/.gradle/gradle.properties. # ideaCheckSpotlessOnBuild = true -# Non-GTNH properties -gradleTokenGroupName = diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index d64cd49177..e6441136f3 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a80b22ce5c..b82aa23a4f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/settings.gradle b/settings.gradle index e8946ada27..94c2daf35c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,7 +17,7 @@ pluginManagement { } plugins { - id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.8' + id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22' } -- cgit From 41a26333ac38e0f1f19b2f9ac6beef5d475803e3 Mon Sep 17 00:00:00 2001 From: chochem <40274384+chochem@users.noreply.github.com> Date: Tue, 28 May 2024 22:55:32 +0100 Subject: exclude circular dep (#38) * exclude circular dep * Update dependencies.gradle --- dependencies.gradle | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dependencies.gradle b/dependencies.gradle index 53de291e83..46247aa536 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,7 +1,10 @@ // Add your dependencies here dependencies { - api('com.github.GTNewHorizons:GT5-Unofficial:5.09.48.09:dev') + // this is a circular dep, remove asap + api('com.github.GTNewHorizons:GT5-Unofficial:5.09.48.09:dev'){ + exclude group: 'com.github.GTNewHorizons', module: 'GTNEIOrePlugin' + } compileOnly('com.opencsv:opencsv:4.0') } -- cgit From e080e3d7f938039b598649ede2019ef8d0f5e2e8 Mon Sep 17 00:00:00 2001 From: glowredman <35727266+glowredman@users.noreply.github.com> Date: Tue, 25 Jun 2024 11:43:02 +0200 Subject: Disable `useDependencyInformation` --- src/main/resources/mcmod.info | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index f46fb75db6..58ce9cb92d 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -11,10 +11,6 @@ "authorList": ["GWYOG", "bartimaeusnek"], "credits": "", "logoFile": "", - "screenshots": [], - "requiredMods": ["Forge", "gregtech", "NotEnoughItems"], - "dependencies": ["gregtech", "NotEnoughItems"], - "dependants": [], - "useDependencyInformation": true + "screenshots": [] }] } -- cgit From a47404887f259f2897abc3cb808b873569646891 Mon Sep 17 00:00:00 2001 From: Martin Robertz Date: Fri, 28 Jun 2024 22:45:05 +0200 Subject: update --- dependencies.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 2 +- settings.gradle | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 46247aa536..6d2ae520f6 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -2,7 +2,7 @@ dependencies { // this is a circular dep, remove asap - api('com.github.GTNewHorizons:GT5-Unofficial:5.09.48.09:dev'){ + api('com.github.GTNewHorizons:GT5-Unofficial:5.09.48.56:dev'){ exclude group: 'com.github.GTNewHorizons', module: 'GTNEIOrePlugin' } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23a4f..a4413138c9 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a4269..b740cf1339 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. diff --git a/settings.gradle b/settings.gradle index 94c2daf35c..6fe010ce8b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,7 +17,7 @@ pluginManagement { } plugins { - id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22' + id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.23' } -- cgit From b95ed37e55d8fa580c9848cf17b3f8e14e8c0e3d Mon Sep 17 00:00:00 2001 From: glowredman <35727266+glowredman@users.noreply.github.com> Date: Wed, 17 Jul 2024 05:55:53 +0200 Subject: Remove Space from "Mehen Belt" (#40) * Update deps * Remove space in "Mehen Belt" --- dependencies.gradle | 2 +- src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 6d2ae520f6..05ef20e382 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -2,7 +2,7 @@ dependencies { // this is a circular dep, remove asap - api('com.github.GTNewHorizons:GT5-Unofficial:5.09.48.56:dev'){ + api('com.github.GTNewHorizons:GT5-Unofficial:5.09.48.80:dev'){ exclude group: 'com.github.GTNewHorizons', module: 'GTNEIOrePlugin' } diff --git a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java index 78224dc5ae..b82cb63f58 100644 --- a/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java +++ b/src/main/java/pers/gwyog/gtneioreplugin/util/DimensionHelper.java @@ -33,7 +33,7 @@ public class DimensionHelper { "GalaxySpace_TcetiE", "GalaxySpace_VegaB", // T9 "GalacticraftAmunRa_Anubis", "GalacticraftAmunRa_Horus", "GalacticraftAmunRa_Maahes", - "GalacticraftAmunRa_Mehen Belt", "GalacticraftAmunRa_Neper", "GalacticraftAmunRa_Seth", + "GalacticraftAmunRa_MehenBelt", "GalacticraftAmunRa_Neper", "GalacticraftAmunRa_Seth", // T10 "Underdark", }; @@ -96,7 +96,7 @@ public class DimensionHelper { "An", // GalacticraftAmunRa_Anubis "Ho", // GalacticraftAmunRa_Horus "Mh", // GalacticraftAmunRa_Maahes - "MB", // GalacticraftAmunRa_Mehen Belt + "MB", // GalacticraftAmunRa_MehenBelt "Np", // GalacticraftAmunRa_Neper "Se", // GalacticraftAmunRa_Seth // T10 @@ -122,7 +122,7 @@ public class DimensionHelper { case "Proteus", "Triton" -> "T6: " + s; case "Haumea", "Kuiperbelt", "MakeMake", "Pluto" -> "T7: " + s; case "BarnardC", "BarnardE", "BarnardF", "CentauriA", "TcetiE", "VegaB" -> "T8: " + s; - case "Anubis", "Horus", "Maahes", "Mehen Belt", "Neper", "Seth" -> "T9: " + s; + case "Anubis", "Horus", "Maahes", "MehenBelt", "Neper", "Seth" -> "T9: " + s; case "Underdark" -> "T10: " + s; default -> s; }; -- cgit From 1bd2b04655f096feef84a3f69adb838193374225 Mon Sep 17 00:00:00 2001 From: chochem <40274384+chochem@users.noreply.github.com> Date: Thu, 8 Aug 2024 19:34:17 +0100 Subject: fix mehen belt lang (#41) --- src/main/resources/assets/gtneioreplugin/lang/en_US.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang index 8f629b5893..0540870c92 100644 --- a/src/main/resources/assets/gtneioreplugin/lang/en_US.lang +++ b/src/main/resources/assets/gtneioreplugin/lang/en_US.lang @@ -76,7 +76,7 @@ gtnop.world.BarnardE=Barnard E gtnop.world.BarnardF=Barnard F gtnop.world.TcetiE=T Ceti E gtnop.world.Anubis=Anubis -gtnop.world.Mehen Belt=Mehen Belt +gtnop.world.MehenBelt=Mehen Belt gtnop.world.Horus=Horus gtnop.world.Maahes=Maahes gtnop.world.Neper=Neper -- cgit From 2ccf8c43d8d25b10239f5bcc48e5be9ac4a0ab65 Mon Sep 17 00:00:00 2001 From: Dream Master Date: Fri, 9 Aug 2024 10:38:20 +0700 Subject: update --- dependencies.gradle | 2 +- gradle.properties | 13 ++++++++++++- gradle/wrapper/gradle-wrapper.jar | Bin 43453 -> 43504 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 5 ++++- gradlew.bat | 2 ++ settings.gradle | 2 +- 7 files changed, 21 insertions(+), 5 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 05ef20e382..6477cb1426 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -2,7 +2,7 @@ dependencies { // this is a circular dep, remove asap - api('com.github.GTNewHorizons:GT5-Unofficial:5.09.48.80:dev'){ + api('com.github.GTNewHorizons:GT5-Unofficial:5.09.48.142:dev'){ exclude group: 'com.github.GTNewHorizons', module: 'GTNEIOrePlugin' } diff --git a/gradle.properties b/gradle.properties index ab2336ae43..219ee2e97d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -85,6 +85,11 @@ accessTransformersFile = # Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! usesMixins = false +# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main. +# This can speed up compile times thanks to not running the mixin annotation processor on all input sources. +# Mixin classes will have access to "main" classes, but not the other way around. +separateMixinSourceSet = + # Adds some debug arguments like verbose output and class export. usesMixinDebug = false @@ -117,9 +122,15 @@ minimizeShadowedDependencies = true # If disabled, won't rename the shadowed classes. relocateShadowedDependencies = true -# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories. +# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories. includeWellKnownRepositories = true +# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated +# list of strings, with the acceptable keys being(case does not matter): +# cursemaven +# modrinth +excludeWellKnownRepositories = + # Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven. # Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables. # If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle. diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e6441136f3..2c3521197d 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a4413138c9..09523c0e54 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index b740cf1339..f5feea6d6b 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -84,7 +86,8 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/gradlew.bat b/gradlew.bat index 25da30dbde..9d21a21834 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## diff --git a/settings.gradle b/settings.gradle index 6fe010ce8b..242692e5d7 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,7 +17,7 @@ pluginManagement { } plugins { - id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.23' + id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.26' } -- cgit