diff --git a/.gitignore b/.gitignore index 39a19e4a..5e80e0ae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,38 @@ -*.bat -.gradle/ -.idea/ -out/ +.gradle +.settings +/.idea/ +/.vscode/ +/run/ +/build/ +/eclipse/ +.classpath +.project +/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 -run/ -build/ +src/main/resources/mixins.*([!.]).json +*.bat +*.DS_Store +!gradlew.bat +.factorypath +addon.local.gradle +addon.local.gradle.kts +addon.late.local.gradle +addon.late.local.gradle.kts +layout.json diff --git a/build.gradle b/build.gradle index 6a54d13b..621bc62f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1695474595 +//version: 1696265388 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -798,7 +798,7 @@ dependencies { java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") } if (modId != 'hodgepodge') { - java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.5') + java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.7') } java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false} diff --git a/dependencies.gradle b/dependencies.gradle index 6635daa3..63631915 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -12,7 +12,7 @@ dependencies { compileOnly('com.github.GTNewHorizons:ForestryMC:4.6.14:dev') compileOnly('com.github.GTNewHorizons:EnderIO:2.5.0:dev') - compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.44.27:dev') { + compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.44.33-pre:dev') { exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework' } compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..93e3f59f --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,92 @@ +@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 +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +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" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +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. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +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. + +goto fail + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +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! +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 + +:omega diff --git a/src/main/java/com/glodblock/github/nei/recipes/DefaultExtractorLoader.java b/src/main/java/com/glodblock/github/nei/recipes/DefaultExtractorLoader.java index 90329a1c..e01e659d 100644 --- a/src/main/java/com/glodblock/github/nei/recipes/DefaultExtractorLoader.java +++ b/src/main/java/com/glodblock/github/nei/recipes/DefaultExtractorLoader.java @@ -1,5 +1,7 @@ package com.glodblock.github.nei.recipes; +import java.util.Collection; + import com.glodblock.github.nei.recipes.extractor.AvaritiaRecipeExtractor; import com.glodblock.github.nei.recipes.extractor.EnderIORecipeExtractor; import com.glodblock.github.nei.recipes.extractor.ForestryRecipeExtractor; @@ -19,8 +21,7 @@ import forestry.factory.recipes.nei.NEIHandlerMoistener; import forestry.factory.recipes.nei.NEIHandlerSqueezer; import forestry.factory.recipes.nei.NEIHandlerStill; import gregapi.recipes.Recipe; -import gregtech.api.util.GTPP_Recipe; -import gregtech.api.util.GT_Recipe; +import gregtech.api.recipe.RecipeMap; public class DefaultExtractorLoader implements Runnable { @@ -31,13 +32,32 @@ public class DefaultExtractorLoader implements Runnable { FluidRecipe.addRecipeMap("crafting", new VanillaRecipeExtractor(true)); FluidRecipe.addRecipeMap("crafting2x2", new VanillaRecipeExtractor(true)); + if (ModAndClassUtil.GT5NH) { + for (RecipeMap recipeMap : RecipeMap.ALL_RECIPE_MAPS.values()) { + if (recipeMap.getFrontend().getNEIProperties().registerNEI) { + FluidRecipe.addRecipeMap( + recipeMap.unlocalizedName, + new GregTech5RecipeExtractor( + recipeMap.unlocalizedName.equals("gt.recipe.scanner") + || recipeMap.unlocalizedName.equals("gt.recipe.fakeAssemblylineProcess"))); + } + } + } + if (ModAndClassUtil.GT5) { - for (GT_Recipe.GT_Recipe_Map tMap : GT_Recipe.GT_Recipe_Map.sMappings) { - FluidRecipe.addRecipeMap( - tMap.mNEIName, - new GregTech5RecipeExtractor( - tMap.mNEIName.equals("gt.recipe.scanner") - || tMap.mNEIName.equals("gt.recipe.fakeAssemblylineProcess"))); + try { + Class recipeMapClazz = Class.forName("gregtech.api.util.GT_Recipe$GT_Recipe_Map"); + Collection sMappings = (Collection) recipeMapClazz.getDeclaredField("sMappings").get(null); + for (Object tMap : sMappings) { + String mNEIName = (String) recipeMapClazz.getDeclaredField("mNEIName").get(tMap); + FluidRecipe.addRecipeMap( + mNEIName, + new GregTech5RecipeExtractor( + mNEIName.equals("gt.recipe.scanner") + || mNEIName.equals("gt.recipe.fakeAssemblylineProcess"))); + } + } catch (Exception e) { + throw new RuntimeException(e); } } @@ -48,10 +68,20 @@ public class DefaultExtractorLoader implements Runnable { } if (ModAndClassUtil.GTPP) { - for (GTPP_Recipe.GTPP_Recipe_Map_Internal gtppMap : GTPP_Recipe.GTPP_Recipe_Map_Internal.sMappingsEx) { - if (gtppMap.mNEIAllowed) { - FluidRecipe.addRecipeMap(gtppMap.mNEIName, new GTPPRecipeExtractor()); + try { + Class gtRecipeMapClazz = Class.forName("gregtech.api.util.GT_Recipe$GT_Recipe_Map"); + Class gtppRecipeMapClazz = Class.forName("gregtech.api.util.GTPP_Recipe$GTPP_Recipe_Map_Internal"); + Collection sMappingsEx = (Collection) gtppRecipeMapClazz.getDeclaredField("sMappingsEx") + .get(null); + for (Object gtppMap : sMappingsEx) { + boolean mNEIAllowed = gtRecipeMapClazz.getDeclaredField("mNEIAllowed").getBoolean(gtppMap); + if (mNEIAllowed) { + String mNEIName = (String) gtRecipeMapClazz.getDeclaredField("mNEIName").get(gtppMap); + FluidRecipe.addRecipeMap(mNEIName, new GTPPRecipeExtractor()); + } } + } catch (Exception e) { + // GTNH fork of GT++ doesn't use its own recipemap class } } diff --git a/src/main/java/com/glodblock/github/util/ModAndClassUtil.java b/src/main/java/com/glodblock/github/util/ModAndClassUtil.java index a32af0ae..ed1b18b2 100644 --- a/src/main/java/com/glodblock/github/util/ModAndClassUtil.java +++ b/src/main/java/com/glodblock/github/util/ModAndClassUtil.java @@ -12,6 +12,13 @@ import cpw.mods.fml.common.Loader; public final class ModAndClassUtil { + /** + * GTNH fork of GregTech5 Unofficial + */ + public static boolean GT5NH = false; + /** + * GregTech5 / GregTech5 Unofficial (Blood-Asp's "official" GT5u) + */ public static boolean GT5 = false; public static boolean GT6 = false; public static boolean EC2 = false; @@ -119,7 +126,14 @@ public final class ModAndClassUtil { isTypeFilter = false; } - if (Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi")) GT5 = true; + if (Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi")) { + try { + Class.forName("gregtech.api.recipe.RecipeMap"); + GT5NH = true; + } catch (ClassNotFoundException e) { + GT5 = true; + } + } if (Loader.isModLoaded("gregapi") && Loader.isModLoaded("gregapi_post")) GT6 = true; if (Loader.isModLoaded("extracells")) EC2 = true; if (Loader.isModLoaded("EnderIO")) EIO = true;