Compat with GT change

This commit is contained in:
miozune committed 2023-12-01 11:33:55 +09:00
1 parent 3077326c16
commit c1c30cf1ad
4 files changed
+46 -16

No files matched your search

+2 -2
View File
@@ -1,4 +1,4 @@
//version: 1699290261
//version: 1700844281
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
@@ -302,7 +302,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)
-1
View File
@@ -52,7 +52,6 @@ dependencies {
compileOnly('com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:OpenComputers:1.9.19-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.5.0-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:GTplusplus:1.10.30:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.3.31:dev") { transitive = false }
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.1.7:dev")
@@ -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,6 @@ 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;
public class DefaultExtractorLoader implements Runnable {
@@ -32,12 +32,19 @@ public class DefaultExtractorLoader implements Runnable {
FluidRecipe.addRecipeMap("crafting2x2", new VanillaRecipeExtractor(true));
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);
}
}
@@ -47,11 +54,21 @@ 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());
if (ModAndClassUtil.GTPP && !ModAndClassUtil.GT5NH) {
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) {
throw new RuntimeException(e);
}
}
@@ -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;