mirror of
https://github.com/GTNewHorizons/NotEnoughEnergistics.git
synced 2026-10-25 20:32:19 +00:00
Lwjgl3ify fixes (#33)
* Update buildscript and dependencies * Remove unnecessary transformer exclusion Closes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/12580> * Fix scroll step calculation on lwjgl3
This commit is contained in:
1 parent
4d93950d6e
commit
8bedd98a51
5 files changed
+194
-54
No files matched your search
+179
-6
@@ -1,4 +1,4 @@
|
||||
//version: 1675110695
|
||||
//version: 1676679815
|
||||
/*
|
||||
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.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")
|
||||
}
|
||||
|
||||
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"]
|
||||
}
|
||||
|
||||
+4
-6
@@ -1,10 +1,8 @@
|
||||
dependencies {
|
||||
compile("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-152-GTNH:dev")
|
||||
compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.5:dev")
|
||||
compile("com.github.GTNewHorizons:CodeChickenCore:1.1.6:dev")
|
||||
compile("com.github.GTNewHorizons:NotEnoughItems:2.3.21-GTNH:dev")
|
||||
compile("com.github.GTNewHorizons:Baubles:1.0.1.14:dev")
|
||||
compile("com.github.GTNewHorizons:WirelessCraftingTerminal:1.8.9.1:dev")
|
||||
api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-159-GTNH:dev")
|
||||
api("com.github.GTNewHorizons:NotEnoughItems:2.3.32-GTNH:dev")
|
||||
implementation("com.github.GTNewHorizons:Baubles:1.0.1.14:dev")
|
||||
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.8.9.3:dev")
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.0.70-gtnh:dev") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:Avaritiaddons:1.5.4-GTNH:dev") { transitive = false }
|
||||
|
||||
@@ -1,43 +1,4 @@
|
||||
// Add any additional repositories for your dependencies here
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name 'GTNH Maven'
|
||||
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
|
||||
allowInsecureProtocol
|
||||
}
|
||||
maven {
|
||||
name 'ic2'
|
||||
url 'http://maven.ic2.player.to/'
|
||||
metadataSources {
|
||||
mavenPom()
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
maven {
|
||||
// IC2
|
||||
name = "ic2"
|
||||
url = "https://maven2.ic2.player.to/"
|
||||
metadataSources {
|
||||
mavenPom()
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name 'CurseForge Maven'
|
||||
url 'https://minecraft.curseforge.com/api/maven/'
|
||||
metadataSources {
|
||||
mavenPom()
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
maven {
|
||||
url 'https://cursemaven.com'
|
||||
content {
|
||||
includeGroup 'curse.maven'
|
||||
}
|
||||
}
|
||||
maven {
|
||||
url 'https://jitpack.io'
|
||||
}
|
||||
}
|
||||
@@ -26,9 +26,18 @@ import com.github.vfyjxf.nee.network.packet.PacketSlotStackChange;
|
||||
import com.github.vfyjxf.nee.network.packet.PacketStackCountChange;
|
||||
import com.github.vfyjxf.nee.utils.GuiUtils;
|
||||
import com.github.vfyjxf.nee.utils.ItemUtils;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
public class AppengHelper {
|
||||
|
||||
private static boolean hasLwjgl3 = Loader.isModLoaded("lwjgl3ify");
|
||||
|
||||
// LWJGL2 reports different scroll values for every platform, 120 for one tick on Windows.
|
||||
// LWJGL3 reports the delta in exact scroll ticks.
|
||||
private static int dwheelToScrollSteps(int dWheel) {
|
||||
return hasLwjgl3 ? dWheel : dWheel / 120;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent the scroll bar from being triggered when modifying the number of items This method is not intended to be
|
||||
* called by NEE. Do not use this method for any reason.
|
||||
@@ -49,7 +58,7 @@ public class AppengHelper {
|
||||
handleRecipeIngredientChange((GuiContainer) mc.currentScreen, currentSlot, dWheel);
|
||||
return true;
|
||||
} else if (Keyboard.isKeyDown(NEIClientConfig.getKeyBinding("nee.count"))) {
|
||||
int changeCount = dWheel / 120;
|
||||
int changeCount = dwheelToScrollSteps(dWheel);
|
||||
NEENetworkHandler.getInstance()
|
||||
.sendToServer(new PacketStackCountChange(currentSlot.slotNumber, changeCount));
|
||||
return true;
|
||||
@@ -67,7 +76,7 @@ public class AppengHelper {
|
||||
if (currentIngredients != null && currentIngredients.items.length > 1) {
|
||||
int currentStackIndex = ItemUtils.getIngredientIndex(currentSlot.getStack(), currentIngredients);
|
||||
if (currentStackIndex >= 0) {
|
||||
int nextStackIndex = dWheel / 120;
|
||||
int nextStackIndex = dwheelToScrollSteps(dWheel);
|
||||
for (int j = 0; j < Math.abs(nextStackIndex); j++) {
|
||||
currentStackIndex = nextStackIndex > 0 ? currentStackIndex + 1 : currentStackIndex - 1;
|
||||
if (currentStackIndex >= currentIngredients.items.length) {
|
||||
|
||||
@@ -6,7 +6,6 @@ import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
||||
|
||||
@IFMLLoadingPlugin.Name("NEELoadingPlugin")
|
||||
@IFMLLoadingPlugin.MCVersion("1.7.10")
|
||||
@IFMLLoadingPlugin.TransformerExclusions("com.github.vfyjxf.nee.asm")
|
||||
public class NEELoadingPlugin implements IFMLLoadingPlugin {
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user