Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compat with GT change #175

Merged
merged 3 commits into from
Dec 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 4 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1700844281
//version: 1701530445
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
Expand Down Expand Up @@ -28,27 +28,12 @@ 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/'
}

mavenLocal()
}
}
Expand Down Expand Up @@ -793,12 +778,12 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies"
}

dependencies {
def lwjgl3ifyVersion = '1.5.1'
def lwjgl3ifyVersion = '1.5.7'
if (modId != 'lwjgl3ify') {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
}
if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.17')
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.35')
}

java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false}
Expand Down Expand Up @@ -1310,7 +1295,7 @@ def addCurseForgeRelation(String type, String name) {

// Updating

def buildscriptGradleVersion = "8.2.1"
def buildscriptGradleVersion = "8.5"

tasks.named('wrapper', Wrapper).configure {
gradleVersion = buildscriptGradleVersion
Expand Down
15 changes: 7 additions & 8 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,25 @@
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
*/
dependencies {
api('com.github.GTNewHorizons:NotEnoughItems:2.4.12-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-286-GTNH:dev')
api('com.github.GTNewHorizons:NotEnoughItems:2.4.13-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-291-GTNH:dev')
api('curse.maven:cofh-core-69162:2388751')
api('com.github.GTNewHorizons:waila:1.6.5:dev')

implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.10.1:dev")

compileOnly('com.github.GTNewHorizons:Baubles:1.0.1.16:dev')
compileOnly('com.github.GTNewHorizons:Baubles:1.0.3:dev')
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.34:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ForestryMC:4.7.0:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.5.5:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.44.83:dev') {
compileOnly('com.github.GTNewHorizons:EnderIO:2.5.6:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.44.96:dev') {
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
}
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
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 }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.5.3-GTNH:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.3.38:dev") { transitive = false }

runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.1.7:dev")
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.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
5 changes: 4 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -19,8 +21,6 @@
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 {

Expand All @@ -32,12 +32,19 @@ public void run() {
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);
}
}

Expand All @@ -47,11 +54,21 @@ public void run() {
}
}

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);
}
}

Expand Down
16 changes: 15 additions & 1 deletion src/main/java/com/glodblock/github/util/ModAndClassUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@

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;
Expand Down Expand Up @@ -119,7 +126,14 @@ public static void init() {
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;
Expand Down