diff --git a/build.gradle b/build.gradle index 5053e9f1bc..fcf1d925a0 100644 --- a/build.gradle +++ b/build.gradle @@ -17,6 +17,7 @@ import net.minecraftforge.gradle.common.tasks.ExtractInheritance import net.minecraftforge.gradle.common.tasks.SignJar import net.minecraftforge.gradle.patcher.tasks.GeneratePatches import net.minecraftforge.gradle.userdev.tasks.RenameJar +import net.minecraftforge.gradleutils.PomUtils import org.apache.tools.ant.filters.ReplaceTokens import org.gradle.plugins.ide.eclipse.model.SourceFolder import org.objectweb.asm.Opcodes @@ -24,7 +25,7 @@ import org.objectweb.asm.Opcodes plugins { id 'org.cadixdev.licenser' version '0.6.1' id 'com.github.ben-manes.versions' version '0.46.0' - id 'net.minecraftforge.gradleutils' version '2.+' + id 'net.minecraftforge.gradleutils' version '[2.1.3,)' id 'eclipse' id 'de.undercouch.download' version '5.4.0' id 'net.minecraftforge.gradle.patcher' version '[6.0.14,6.2)' apply false @@ -49,35 +50,7 @@ ext { MCP_VERSION = '20230921.100330' SNAPSHOT = false - SPI_VERSION = '7.0.1' - MERGETOOL_VERSION = '1.1.5' - ACCESSTRANSFORMERS_VERSION = '8.0.4' - COREMODS_VERSION = '5.0.1' - EVENTBUS_VERSION = '6.0.5' - MODLAUNCHER_VERSION = '10.0.9' - SECUREJARHANDLER_VERSION = '2.1.10' - BOOTSTRAPLAUNCHER_VERSION = '1.1.2' - ASM_VERSION = '9.5' INSTALLER_VERSION = '2.1.+' - MIXIN_VERSION = '0.8.5' - TERMINALCONSOLEAPPENDER_VERSION = '1.2.0' - JLINE_VERSION = '3.12.+' - NIGHTCONFIG_VERSION = '3.6.4' - JETBRAINS_ANNOTATIONS_VERSION = '23.0.0' - SLF4J_API_VERSION = '1.8.0-beta4' - APACHE_MAVEN_ARTIFACT_VERSION = '3.8.5' - JARJAR_VERSION = '0.3.19' - JIMFS_VERSION = '1.3.0' // Google's InMemory File System. Used by ForgeDev Tests for now, but could be useful for a lot of things. - - // These versions should be kept in sync with the version manifest JSON - // To use a version newer than the version manifest JSON, the dependency must be added to the installer configuration - MOJANG_LOGGING_VERSION = '1.1.1' - LOG4J_VERSION = '2.19.0' - GUAVA_VERSION = '32.1.2-jre' - GSON_VERSION = '2.10.1' - APACHE_COMMONS_LANG3_VERSION = '3.12.0' - JOPT_SIMPLE_VERSION = '5.0.4' - COMMONS_IO_VERSION = '2.13.0' GIT_INFO = gradleutils.gitInfo VERSION = gradleutils.getFilteredMCTagOffsetBranchVersion(true, '[0-9]', MC_VERSION) @@ -151,16 +124,9 @@ subprojects { //println(name + ' Version: ' + version) repositories { - mavenLocal() mavenCentral() - maven { - name = 'forge' - url = 'https://maven.minecraftforge.net/' - } - maven { - name = 'minecraft' - url = 'https://libraries.minecraft.net/' - } + maven gradleutils.forgeMaven + maven gradleutils.minecraftLibsMaven } java.toolchain.languageVersion = JavaLanguageVersion.of(17) @@ -185,30 +151,13 @@ subprojects { name = project.name description = 'Modifactions to Minecraft to enable mod developers.' url = 'https://github.com/MinecraftForge/MinecraftForge' - - scm { - url = 'https://github.com/MinecraftForge/MinecraftForge' - connection = 'scm:git:git://github.com/MinecraftForge/MinecraftForge.git' - developerConnection = 'scm:git:git@github.com:MinecraftForge/MinecraftForge.git' - } - - issueManagement { - system = 'github' - url = 'https://github.com/MinecraftForge/MinecraftForge/issues' - } - - licenses { - license { - name = 'LGPL 2.1' - url = 'https://github.com/MinecraftForge/MinecraftForge/blob/1.13-pre/LICENSE.txt' - distribution = 'repo' - } - } + PomUtils.setGitHubDetails(pom, 'MinecraftForge') + license PomUtils.Licenses.LGPLv2_1 } } } repositories { - maven gradleutils.getPublishingForgeMaven() + maven gradleutils.publishingForgeMaven } } @@ -227,53 +176,6 @@ project(':mcp') { } } -def sharedDeps = { - moduleonly("cpw.mods:securejarhandler:${SECUREJARHANDLER_VERSION}") - moduleonly("org.ow2.asm:asm:${ASM_VERSION}") - moduleonly("org.ow2.asm:asm-commons:${ASM_VERSION}") - moduleonly("org.ow2.asm:asm-tree:${ASM_VERSION}") - moduleonly("org.ow2.asm:asm-util:${ASM_VERSION}") - moduleonly("org.ow2.asm:asm-analysis:${ASM_VERSION}") - moduleonly("cpw.mods:bootstraplauncher:${BOOTSTRAPLAUNCHER_VERSION}") - moduleonly("net.minecraftforge:JarJarFileSystems:${JARJAR_VERSION}") - moduleonly("com.google.jimfs:jimfs:${JIMFS_VERSION}") - moduleonly("com.google.guava:guava:${GUAVA_VERSION}") // Need by jimfs - moduleonly("com.google.guava:failureaccess:1.0.1") // Needed by guava - - installer "cpw.mods:securejarhandler:${SECUREJARHANDLER_VERSION}" - installer "org.ow2.asm:asm:${ASM_VERSION}" - installer "org.ow2.asm:asm-commons:${ASM_VERSION}" - installer "org.ow2.asm:asm-tree:${ASM_VERSION}" - installer "org.ow2.asm:asm-util:${ASM_VERSION}" - installer "org.ow2.asm:asm-analysis:${ASM_VERSION}" - installer "net.minecraftforge:accesstransformers:${ACCESSTRANSFORMERS_VERSION}" - installer 'org.antlr:antlr4-runtime:4.9.1' // Dep of AccessTransformer - installer "net.minecraftforge:eventbus:${EVENTBUS_VERSION}" - installer "net.minecraftforge:forgespi:${SPI_VERSION}" - installer "net.minecraftforge:coremods:${COREMODS_VERSION}" - installer "cpw.mods:modlauncher:${MODLAUNCHER_VERSION}" - installer 'net.minecraftforge:unsafe:0.2.+' - installer "net.minecraftforge:mergetool:${MERGETOOL_VERSION}:api" - installer "com.electronwill.night-config:core:${NIGHTCONFIG_VERSION}" - installer "com.electronwill.night-config:toml:${NIGHTCONFIG_VERSION}" - installer "org.apache.maven:maven-artifact:${APACHE_MAVEN_ARTIFACT_VERSION}" - installer 'net.jodah:typetools:0.6.3' - installer "net.minecrell:terminalconsoleappender:${TERMINALCONSOLEAPPENDER_VERSION}" - installer "org.jline:jline-reader:${JLINE_VERSION}" // Dep of TerminalConsoleAppender - installer "org.jline:jline-terminal:${JLINE_VERSION}" // Dep of TerminalConsoleAppender - installer "org.spongepowered:mixin:${MIXIN_VERSION}" - installer 'org.openjdk.nashorn:nashorn-core:15.3' - installer "net.minecraftforge:JarJarSelector:${JARJAR_VERSION}" - installer "net.minecraftforge:JarJarMetadata:${JARJAR_VERSION}" - - /* - installer 'org.lwjgl:lwjgl:3.2.2' - installer 'org.lwjgl:lwjgl-glfw:3.2.2' - installer 'org.lwjgl:lwjgl-opengl:3.2.2' - installer 'org.lwjgl:lwjgl-stb:3.2.2' - */ -} - def sharedFmlonlyForge = { Project prj -> prj.afterEvaluate { [prj.tasks.universalJar, prj.tasks.installerJar].each { t -> @@ -343,7 +245,7 @@ def sharedFmlonlyForge = { Project prj -> for (def run : prj.patcher.runs + userdevRuns) { if (run.parents) continue // We already added this to the parent run config //run.property 'bsl.debug', 'true' - run.main 'cpw.mods.bootstraplauncher.BootstrapLauncher' + run.main 'net.minecraftforge.bootstrap.BootstrapLauncher' run.args '--gameDir', '.' run.args '--fml.forgeVersion', FORGE_VERSION @@ -368,9 +270,6 @@ def sharedFmlonlyForge = { Project prj -> } run.jvmArgs '--add-modules', 'ALL-MODULE-PATH' // Additions to these JVM module args should be mirrored to server_files/args.txt and other similar blocks in the buildscript - run.jvmArgs '--add-opens', 'java.base/java.util.jar=cpw.mods.securejarhandler' - run.jvmArgs '--add-opens', 'java.base/java.lang.invoke=cpw.mods.securejarhandler' - run.jvmArgs '--add-exports', 'java.base/sun.security.util=cpw.mods.securejarhandler' run.jvmArgs '--add-exports', 'jdk.naming.dns/com.sun.jndi.dns=java.naming' } for (def run : prj.patcher.runs) { @@ -460,8 +359,7 @@ project(':forge') { java { srcDirs = [ "$rootDir/src/main/java", - "$rootDir/src/fmlcommon/java", - SNAPSHOT ? "$rootDir/src/snapshots/java" : "$rootDir/src/snapshots_disabled/java" + "$rootDir/src/fmlcommon/java" ] } resources { @@ -522,20 +420,41 @@ project(':forge') { api.extendsFrom(installer) } - dependencies { - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testImplementation 'org.junit.vintage:junit-vintage-engine:5.+' - testImplementation 'org.opentest4j:opentest4j:1.2.0' // needed for junit 5 - testImplementation 'org.hamcrest:hamcrest-all:1.3' // needs advanced matching for list order + dependencies { + moduleonly(libs.bootstrap) + moduleonly(libs.securemodules) // Needed by bootstrap + moduleonly(libs.unsafe) // Needed by securemodules + moduleonly(libs.bundles.asm) // Needed by all the black magic + moduleonly(libs.jarjar.fs) // Filesystems need to be on the bootstrap? I think thats why this is here. + moduleonly(libs.bundles.jimfs) // In memory file system used for ForgeDev launches + + installer(libs.unsafe) + installer(libs.securemodules) + installer(libs.bundles.asm) // Needed by all the black magic + installer(libs.accesstransformers) + installer(libs.antlr.runtime) // Dep of AccessTransformer + installer(libs.eventbus) + installer(libs.typetools) // Dep of EventBus + installer(libs.forgespi) + installer(libs.coremods) + installer(libs.nashorn) // Dep of Coremods + installer(libs.modlauncher) + installer(libs.mergetool.api) + installer(libs.bundles.night.config) + installer(libs.maven.artifact) + installer(libs.bundles.terminalconsoleappender) + installer(libs.mixin) + installer(libs.bundles.jarjar) + implementation project(':fmlcore') implementation project(':fmlloader') implementation project(':fmlearlydisplay') implementation project(':javafmllanguage') implementation project(':lowcodelanguage') implementation project(':mclanguage') - runtimeOnly "cpw.mods:bootstraplauncher:${BOOTSTRAPLAUNCHER_VERSION}" + + runtimeOnly(libs.bootstrap) } - dependencies sharedDeps patcher { excs.from file("$rootDir/src/main/resources/forge.exc") @@ -919,7 +838,7 @@ project(':forge') { time: timestamp, releaseTime: timestamp, type: 'release', - mainClass: 'cpw.mods.bootstraplauncher.BootstrapLauncher', + mainClass: 'net.minecraftforge.bootstrap.BootstrapLauncher', inheritsFrom: MC_VERSION, logging: {}, arguments: [ @@ -935,9 +854,6 @@ project(':forge') { '-p', Util.getArtifacts(project, configurations.moduleonly, false).values().collect{'${library_directory}/' + it.downloads.artifact.path}.join('${classpath_separator}'), '--add-modules', 'ALL-MODULE-PATH', // Additions to these JVM module args should be mirrored to server_files/args.txt and other similar blocks in the buildscript - '--add-opens', 'java.base/java.util.jar=cpw.mods.securejarhandler', - '--add-opens', 'java.base/java.lang.invoke=cpw.mods.securejarhandler', - '--add-exports', 'java.base/sun.security.util=cpw.mods.securejarhandler', '--add-exports', 'jdk.naming.dns/com.sun.jndi.dns=java.naming' ] ], @@ -1197,6 +1113,10 @@ project(':forge') { rename { 'data/server.lzma' } } } + + tasks.register('devInstallerJar', DevInstallerJar) { + input = installerJar.archiveFile + } task makeMdk(type: Zip) { archiveBaseName = project.name diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/DevInstallerJar.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/DevInstallerJar.groovy new file mode 100644 index 0000000000..cb7b922091 --- /dev/null +++ b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/DevInstallerJar.groovy @@ -0,0 +1,67 @@ +package net.minecraftforge.forge.tasks + +import org.gradle.api.tasks.* +import org.gradle.api.DefaultTask +import org.gradle.api.file.RegularFileProperty +import groovy.json.JsonSlurper +import java.util.zip.ZipEntry +import java.util.zip.ZipFile +import java.util.zip.ZipOutputStream + +abstract class DevInstallerJar extends DefaultTask { + @OutputFile abstract RegularFileProperty getOutput() + @InputFile abstract RegularFileProperty getInput() + + DevInstallerJar() { + output.convention(project.layout.buildDirectory.file('libs/' + project.name + '-' + project.version + '-installer-dev.jar')) + } + + @TaskAction + protected void exec() { + try (def zos = new ZipOutputStream(output.get().asFile.newDataOutputStream())) { + def seen = [] as Set + def deps = [:] as java.util.TreeMap + try (def base = new ZipFile(input.get().asFile)) { + base.entries().each { entry -> + zos.putNextEntry(entry) + def data = base.getInputStream(entry).bytes + zos.write(data) + + if (entry.name == 'install_profile.json' || entry.name == 'version.json') { + def json = new JsonSlurper().parse(data) + json.libraries.each { lib -> + deps.put(lib.name, lib.downloads.artifact) + } + } + + if (entry.name.startsWith('maven/')) + seen.add(entry.name.substring(6)) + } + } + + def resolved = project.configurations.installer.resolvedConfiguration.resolvedArtifacts + + deps.each { name, info -> + if (seen.contains(info.path)) + return + + def art = resolved.find { "${it.moduleVersion.id.group}:${it.moduleVersion.id.name}:${it.moduleVersion.id.version}" == name } + + def file = null + if (art != null) { + if (!Util.checkExists(info.url)) + file = art.file + } else { + // TODO download missing things + } + + if (file != null) { + //println('maven/' + info.path) + zos.putNextEntry(new ZipEntry('maven/' + info.path)) + zos.write(file.bytes) + seen.add(info.path) + } + } + } + } +} diff --git a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/Util.groovy b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/Util.groovy index 8b66408515..6c810e7131 100644 --- a/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/Util.groovy +++ b/buildSrc/src/main/groovy/net/minecraftforge/forge/tasks/Util.groovy @@ -127,7 +127,7 @@ public class Util { return getArtifacts(project, cfg, true) } - private static boolean checkExists(url) { + static boolean checkExists(url) { try { def code = new URL(url).openConnection().with { requestMethod = 'HEAD' diff --git a/build_clean.gradle b/build_clean.gradle index d0472d28b8..87767b3257 100644 --- a/build_clean.gradle +++ b/build_clean.gradle @@ -8,7 +8,7 @@ plugins { evaluationDependsOn(':mcp') dependencies { - implementation 'net.minecraftforge:forgespi:' + SPI_VERSION + implementation(libs.forgespi) } patcher { diff --git a/fmlcore/build.gradle b/fmlcore/build.gradle index b5fa345444..700beedf50 100644 --- a/fmlcore/build.gradle +++ b/fmlcore/build.gradle @@ -9,12 +9,12 @@ plugins { dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) } dependencies { - compileOnly("org.jetbrains:annotations:${JETBRAINS_ANNOTATIONS_VERSION}") + compileOnly(libs.nulls) - api("net.minecraftforge:eventbus:${EVENTBUS_VERSION}") + api(libs.eventbus) implementation(project(':fmlloader')) - implementation("commons-io:commons-io:${COMMONS_IO_VERSION}") + implementation(libs.commons.io) } task sourcesJar(type: Jar) { diff --git a/fmlearlydisplay/build.gradle b/fmlearlydisplay/build.gradle index 986f070204..4cd94dc2d4 100644 --- a/fmlearlydisplay/build.gradle +++ b/fmlearlydisplay/build.gradle @@ -1,5 +1,4 @@ plugins { - id 'com.github.ben-manes.versions' id 'org.javamodularity.moduleplugin' version '1.8.7' apply false id 'org.cadixdev.licenser' id 'java-library' @@ -7,7 +6,6 @@ plugins { } import org.gradle.internal.os.OperatingSystem - switch (OperatingSystem.current()) { case OperatingSystem.LINUX: project.ext.lwjglNatives = "natives-linux" @@ -20,22 +18,15 @@ switch (OperatingSystem.current()) { break } - -dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) } - java.withSourcesJar() dependencies { - compileOnly('org.jetbrains:annotations:23.0.0') + compileOnly(libs.nulls) implementation(project(':fmlloader')) implementation(project(':fmlcore')) - implementation('org.lwjgl:lwjgl:3.3.1') - implementation('org.lwjgl:lwjgl-glfw:3.3.1') - implementation('org.lwjgl:lwjgl-opengl:3.3.1') - implementation('org.lwjgl:lwjgl-stb:3.3.1') - implementation('org.lwjgl:lwjgl-tinyfd:3.3.1') + implementation(libs.bundles.lwjgl) implementation('org.slf4j:slf4j-api:1.8.0-beta4') - implementation("net.sf.jopt-simple:jopt-simple:${JOPT_SIMPLE_VERSION}") + implementation(libs.jopt.simple) testImplementation('org.junit.jupiter:junit-jupiter-api:5.8.2') testImplementation('org.powermock:powermock-core:2.0.9') testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.8.2') @@ -50,31 +41,16 @@ test { useJUnitPlatform() } -ext { - MANIFESTS = [ - '': [ - 'Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), - 'Git-Commit': GIT_INFO.abbreviatedId, - 'Git-Branch': GIT_INFO.branch, - 'Build-Number': "${System.getenv('BUILD_NUMBER')?:0}", - ] as LinkedHashMap, - 'net/minecraftforge/fml/earlydisplay/': [ +jar { + manifest { + attributes([ 'Specification-Title': 'FMLEarlyDisplay', 'Specification-Vendor': 'Forge Development LLC', 'Specification-Version': '1', 'Implementation-Title': 'FML Early Display', 'Implementation-Version': '1.0', 'Implementation-Vendor': 'Forge' - ] as LinkedHashMap - ] -} - -jar.doFirst { - MANIFESTS.each { pkg, values -> - if (pkg == '') - manifest.attributes(values) - else - manifest.attributes(values, pkg) + ] as LinkedHashMap, 'net/minecraftforge/fml/earlydisplay/') } } diff --git a/fmlloader/build.gradle b/fmlloader/build.gradle index ffacc03c0a..7f9ae834a7 100644 --- a/fmlloader/build.gradle +++ b/fmlloader/build.gradle @@ -10,39 +10,35 @@ dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) } configurations.forEach{ it.transitive = false } dependencies { - compileOnly("org.jetbrains:annotations:${JETBRAINS_ANNOTATIONS_VERSION}") + compileOnly(libs.nulls) - api("org.ow2.asm:asm:${ASM_VERSION}") - api("org.ow2.asm:asm-tree:${ASM_VERSION}") - api("org.ow2.asm:asm-commons:${ASM_VERSION}") - api("net.minecraftforge:forgespi:${SPI_VERSION}") - api("net.minecraftforge:mergetool:${MERGETOOL_VERSION}:api") - api("org.apache.logging.log4j:log4j-api:${LOG4J_VERSION}") - api("org.slf4j:slf4j-api:${SLF4J_API_VERSION}") - api("com.google.guava:guava:${GUAVA_VERSION}") - api("com.google.code.gson:gson:${GSON_VERSION}") - api("org.apache.maven:maven-artifact:${APACHE_MAVEN_ARTIFACT_VERSION}") - api("org.apache.commons:commons-lang3:${APACHE_COMMONS_LANG3_VERSION}") - api("com.electronwill.night-config:core:${NIGHTCONFIG_VERSION}") - api("com.electronwill.night-config:toml:${NIGHTCONFIG_VERSION}") - api("cpw.mods:modlauncher:${MODLAUNCHER_VERSION}") - api("net.minecraftforge:coremods:${COREMODS_VERSION}") - api("com.mojang:logging:${MOJANG_LOGGING_VERSION}") - api "net.minecraftforge:JarJarSelector:${JARJAR_VERSION}" - api "net.minecraftforge:JarJarMetadata:${JARJAR_VERSION}" + api(libs.bundles.asm) // Needed by all the black magic + api(libs.forgespi) + api(libs.mergetool.api) + api(libs.log4j.api) + api(libs.slf4j.api) + api(libs.guava) + api(libs.gson) + api(libs.maven.artifact) + api(libs.apache.commons) + api(libs.bundles.night.config) + api(libs.modlauncher) + api(libs.coremods) + api(libs.mojang.logging) + api(libs.jarjar.selector) + api(libs.jarjar.meta) - implementation("net.sf.jopt-simple:jopt-simple:${JOPT_SIMPLE_VERSION}") - implementation("cpw.mods:securejarhandler:${SECUREJARHANDLER_VERSION}") - implementation("net.minecraftforge:accesstransformers:${ACCESSTRANSFORMERS_VERSION}") - implementation("net.minecrell:terminalconsoleappender:${TERMINALCONSOLEAPPENDER_VERSION}") - implementation("com.google.jimfs:jimfs:${JIMFS_VERSION}") - // implementation("org.jline:jline:${JLINE_VERSION}") + implementation(libs.jopt.simple) + implementation(libs.securemodules) + implementation(libs.accesstransformers) + implementation(libs.terminalconsoleappender) + implementation(libs.jimfs) - implementation("org.apache.logging.log4j:log4j-core:${LOG4J_VERSION}") - annotationProcessor("org.apache.logging.log4j:log4j-core:${LOG4J_VERSION}") + implementation(libs.log4j.core) + annotationProcessor(libs.log4j.core) - testCompileOnly("org.jetbrains:annotations:${JETBRAINS_ANNOTATIONS_VERSION}") - testRuntimeOnly("cpw.mods:bootstraplauncher:${BOOTSTRAPLAUNCHER_VERSION}") + testCompileOnly(libs.nulls) + testRuntimeOnly(libs.bootstrap) } task sourcesJar(type: Jar) { @@ -52,12 +48,6 @@ task sourcesJar(type: Jar) { ext { MANIFESTS = [ - '/': [ - 'Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), - 'Git-Commit': GIT_INFO.abbreviatedId, - 'Git-Branch': GIT_INFO.branch, - 'Build-Number': "${System.getenv('BUILD_NUMBER')?:0}", - ] as LinkedHashMap, 'net/minecraftforge/fml/loading/': [ 'Specification-Title': 'FMLLoader', 'Specification-Vendor': 'Forge Development LLC', diff --git a/javafmllanguage/build.gradle b/javafmllanguage/build.gradle index d6dfcdd0c1..a6ba148b64 100644 --- a/javafmllanguage/build.gradle +++ b/javafmllanguage/build.gradle @@ -9,7 +9,7 @@ plugins { dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) } dependencies { - compileOnly("org.jetbrains:annotations:${JETBRAINS_ANNOTATIONS_VERSION}") + compileOnly(libs.nulls) implementation(project(':fmlloader')) implementation(project(':fmlcore')) } diff --git a/lowcodelanguage/build.gradle b/lowcodelanguage/build.gradle index 89f5f08134..060573e8c5 100644 --- a/lowcodelanguage/build.gradle +++ b/lowcodelanguage/build.gradle @@ -1,49 +1,33 @@ plugins { - id 'com.github.ben-manes.versions' id 'org.javamodularity.moduleplugin' version '1.8.3' apply false id 'org.cadixdev.licenser' id 'java-library' id 'jacoco' } -dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) } - java.withSourcesJar() dependencies { - compileOnly("org.jetbrains:annotations:${JETBRAINS_ANNOTATIONS_VERSION}") + compileOnly(libs.nulls) implementation(project(':fmlloader')) implementation(project(':fmlcore')) } -ext { - MANIFESTS = [ - '': [ - 'FMLModType': 'LANGPROVIDER', - 'Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), - 'Git-Commit': GIT_INFO.abbreviatedId, - 'Git-Branch': GIT_INFO.branch, - 'Build-Number': "${System.getenv('BUILD_NUMBER')?:0}", - ] as LinkedHashMap, - 'net/minecraftforge/fml/loading/': [ - 'Specification-Title': 'FMLLoader', +tasks.named('jar', Jar).configure { + manifest { + attributes([ + 'Automatic-Module-Name': project.name.toLowerCase(), + 'FMLModType': 'LANGPROVIDER' + ] as java.util.LinkedHashMap) + attributes([ + 'Specification-Title': 'LowCodeMod', 'Specification-Vendor': 'Forge Development LLC', - 'Specification-Version': '1', - 'Implementation-Title': 'FML Loader', - 'Implementation-Version': '1.0', - 'Implementation-Vendor': 'Forge' - ] as LinkedHashMap - ] -} - -jar.doFirst { - manifest.attributes['Automatic-Module-Name'] = project.name - MANIFESTS.each { pkg, values -> - if (pkg == '') - manifest.attributes(values) - else - manifest.attributes(values, pkg) + 'Specification-Version': '1.0', + 'Implementation-Title': project.name, + 'Implementation-Version': project.version, + 'Implementation-Vendor': 'Forge Development LLC' + ] as java.util.LinkedHashMap, 'net/minecraftforge/fml/lowcodemod/') } } diff --git a/mclanguage/build.gradle b/mclanguage/build.gradle index 8c11f250be..dead425218 100644 --- a/mclanguage/build.gradle +++ b/mclanguage/build.gradle @@ -1,51 +1,33 @@ plugins { - id 'com.github.ben-manes.versions' - id 'org.javamodularity.moduleplugin' version '1.8.3' apply false id 'org.cadixdev.licenser' id 'java-library' id 'jacoco' } -dependencyUpdates.rejectVersionIf { isNonStable(it.candidate.version) } - dependencies { - compileOnly("org.jetbrains:annotations:${JETBRAINS_ANNOTATIONS_VERSION}") + compileOnly(libs.nulls) implementation(project(':fmlloader')) implementation(project(':fmlcore')) } -task sourcesJar(type: Jar) { - archiveClassifier = 'sources' - from sourceSets.main.allSource +java { + withSourcesJar() } -ext { - MANIFESTS = [ - '': [ +tasks.named('jar', Jar).configure { + manifest { + attributes([ + 'Automatic-Module-Name': project.name.toLowerCase(), 'FMLModType': 'LANGPROVIDER', - 'Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), - 'Git-Commit': GIT_INFO.abbreviatedId, - 'Git-Branch': GIT_INFO.branch, - 'Build-Number': "${System.getenv('BUILD_NUMBER')?:0}", - ] as LinkedHashMap, - 'net/minecraftforge/fml/mclanguageprovider/': [ - 'Specification-Title': 'FMLLoader', + ] as LinkedHashMap) + attributes([ + 'Specification-Title': 'MCLanguage', 'Specification-Vendor': 'Forge Development LLC', 'Specification-Version': '1', - 'Implementation-Title': 'FML Loader', + 'Implementation-Title': 'MCLanguage', 'Implementation-Version': '1.0', - 'Implementation-Vendor': 'Forge' - ] as LinkedHashMap - ] -} - -jar.doFirst { - manifest.attributes['Automatic-Module-Name'] = project.name - MANIFESTS.each { pkg, values -> - if (pkg == '') - manifest.attributes(values) - else - manifest.attributes(values, pkg) + 'Implementation-Vendor': 'Forge Development LLC', + ] as LinkedHashMap, 'net/minecraftforge/fml/mclanguageprovider/') } } @@ -55,16 +37,9 @@ tasks.withType(JavaCompile) { license { header = rootProject.file('LICENSE-header.txt') - include 'net/minecraftforge/' } -artifacts { - archives jar - archives sourcesJar -} - publishing.publications.mavenJava(MavenPublication) { from components.java - artifact sourcesJar } \ No newline at end of file diff --git a/patches/minecraft/net/minecraft/CrashReport.java.patch b/patches/minecraft/net/minecraft/CrashReport.java.patch index 6060930f29..aa5b48961a 100644 --- a/patches/minecraft/net/minecraft/CrashReport.java.patch +++ b/patches/minecraft/net/minecraft/CrashReport.java.patch @@ -26,7 +26,7 @@ this.systemReport.appendToCrashReportString(p_127520_); } -@@ -91,23 +_,13 @@ +@@ -91,18 +_,7 @@ throwable.setStackTrace(this.exception.getStackTrace()); } @@ -46,9 +46,3 @@ } public String getFriendlyReport() { - StringBuilder stringbuilder = new StringBuilder(); - stringbuilder.append("---- Minecraft Crash Report ----\n"); -+ net.minecraftforge.logging.CrashReportExtender.addCrashReportHeader(stringbuilder, this); - stringbuilder.append("// "); - stringbuilder.append(getErrorComment()); - stringbuilder.append("\n\n"); diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index 36d8c9a4b4..68da344091 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -96,7 +96,7 @@ StringBuilder stringbuilder = new StringBuilder("Minecraft"); if (checkModStatus().shouldReportAsModified()) { - stringbuilder.append("*"); -+ stringbuilder.append(' ').append(net.minecraftforge.forge.snapshots.ForgeSnapshotsMod.BRANDING_NAME).append('*'); ++ stringbuilder.append(" Forge").append('*'); } stringbuilder.append(" "); diff --git a/patches/minecraft/net/minecraft/client/Options.java.patch b/patches/minecraft/net/minecraft/client/Options.java.patch index b288df9d16..98794e69c6 100644 --- a/patches/minecraft/net/minecraft/client/Options.java.patch +++ b/patches/minecraft/net/minecraft/client/Options.java.patch @@ -18,11 +18,10 @@ this.minecraft = p_92138_; this.optionsFile = new File(p_92139_, "options.txt"); boolean flag = p_92138_.is64Bit(); -@@ -957,11 +_,21 @@ +@@ -957,11 +_,20 @@ p_168428_.process("telemetryOptInExtra", this.telemetryOptInExtra); this.onboardAccessibility = p_168428_.process("onboardAccessibility", this.onboardAccessibility); -+ net.minecraftforge.forge.snapshots.ForgeSnapshotsMod.processOptions(p_168428_); + processOptionsForge(p_168428_); + } + // FORGE: split off to allow reloading options after mod loading is done diff --git a/server_files/args.txt b/server_files/args.txt index 84df94b0e5..02061863ea 100644 --- a/server_files/args.txt +++ b/server_files/args.txt @@ -1,14 +1,11 @@ -p @MODULE_PATH@ --add-modules @MODULES@ ---add-opens java.base/java.util.jar=cpw.mods.securejarhandler ---add-opens java.base/java.lang.invoke=cpw.mods.securejarhandler ---add-exports java.base/sun.security.util=cpw.mods.securejarhandler --add-exports jdk.naming.dns/com.sun.jndi.dns=java.naming -Djava.net.preferIPv6Addresses=system -DignoreList=@IGNORE_LIST@ -DlibraryDirectory=libraries -DlegacyClassPath=@CLASS_PATH@ -cpw.mods.bootstraplauncher.BootstrapLauncher +net.minecraftforge.bootstrap.BootstrapLauncher --launchTarget @TASK@ --fml.forgeVersion @FORGE_VERSION@ --fml.mcVersion @MC_VERSION@ diff --git a/settings.gradle b/settings.gradle index 09ea6898da..79417946ae 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,5 @@ +import org.gradle.internal.os.OperatingSystem + pluginManagement { repositories { gradlePluginPortal() @@ -20,6 +22,84 @@ plugins { id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' } +dependencyResolutionManagement { + versionCatalogs { + libs { + library('forgespi', 'net.minecraftforge:forgespi:7.1.0') // Needs modlauncher + library('bootstrap', 'net.minecraftforge:bootstrap:1.2.0') // Needs modlauncher + library('modlauncher', 'net.minecraftforge:modlauncher:10.1.1') // Needs securemodules + library('securemodules', 'net.minecraftforge:securemodules:2.2.3') // Needs unsafe + library('unsafe', 'net.minecraftforge:unsafe:0.9.2') + library('accesstransformers', 'net.minecraftforge:accesstransformers:8.1.1') + library('antlr-runtime', 'org.antlr:antlr4-runtime:4.9.1') // Needed by Access Transformer because parsing a simple text file was too complicated + library('coremods', 'net.minecraftforge:coremods:5.1.0') + library('nashorn', 'org.openjdk.nashorn:nashorn-core:15.3') // Needed by coremods, because the JRE no longer ships JS + library('eventbus', 'net.minecraftforge:eventbus:6.2.0') + library('typetools', 'net.jodah:typetools:0.6.3') // Needed by EventBus because of lambdas + library('mergetool-api', 'net.minecraftforge:mergetool-api:1.0') + + library('mixin', 'org.spongepowered:mixin:0.8.5') + library('nulls', 'org.jetbrains:annotations:23.0.0') // Got to have our null annotations! + library('slf4j-api', 'org.slf4j:slf4j-api:1.8.0-beta4') + library('maven-artifact', 'org.apache.maven:maven-artifact:3.8.5') + + // Google's InMemory File System. Used by ForgeDev Tests for now, but could be useful for a lot of things. + library('jimfs', 'com.google.jimfs:jimfs:1.3.0') + bundle('jimfs', ['guava', 'failureaccess']) + + // ASM it's used for so many of our hacks + version('asm', '9.6') + library('asm', 'org.ow2.asm', 'asm' ).versionRef('asm') + library('asm-tree', 'org.ow2.asm', 'asm-tree' ).versionRef('asm') + library('asm-util', 'org.ow2.asm', 'asm-util' ).versionRef('asm') + library('asm-commons', 'org.ow2.asm', 'asm-commons' ).versionRef('asm') + library('asm-analysis', 'org.ow2.asm', 'asm-analysis').versionRef('asm') + bundle('asm', ['asm', 'asm-tree', 'asm-util', 'asm-commons', 'asm-analysis']) + + // Terminal Console Appender.. essentually make pretty colors in the console, but it's been a PITA + library('terminalconsoleappender', 'net.minecrell:terminalconsoleappender:1.2.0') + version('jline', '3.12.1') + library('jline-reader', 'org.jline', 'jline-reader' ).versionRef('jline') + library('jline-terminal', 'org.jline', 'jline-terminal').versionRef('jline') + bundle('terminalconsoleappender', ['terminalconsoleappender', 'jline-reader', 'jline-terminal']) + + // The core of our configuration system, it has many flaws, but it works for the most part + version('night-config', '3.6.4') + library('night-config-toml', 'com.electronwill.night-config', 'toml').versionRef('night-config') + library('night-config-core', 'com.electronwill.night-config', 'core').versionRef('night-config') + bundle('night-config', ['night-config-toml', 'night-config-core']) + + // Jar in Jar FileSystem + version('jarjar', '0.3.19') + library('jarjar-fs', 'net.minecraftforge', 'JarJarFileSystems').versionRef('jarjar') + library('jarjar-meta', 'net.minecraftforge', 'JarJarMetadata' ).versionRef('jarjar') + library('jarjar-selector', 'net.minecraftforge', 'JarJarSelector' ).versionRef('jarjar') + bundle('jarjar', ['jarjar-fs', 'jarjar-selector', 'jarjar-meta']) + + // These are libraries shipped by the MC launcher, try and keep them in sync with the manifest + // but honestly if we don't it just means we ship them as normal libraries by adding them to the installer config in the forge project + library('gson', 'com.google.code.gson:gson:2.10.1') + library('guava', 'com.google.guava:guava:32.1.2-jre') + library('failureaccess', 'com.google.guava:failureaccess:1.0.1') + version('log4j', '2.19.0') + library('log4j-api', 'org.apache.logging.log4j', 'log4j-api' ).versionRef('log4j') + library('log4j-core', 'org.apache.logging.log4j', 'log4j-core').versionRef('log4j') + library('apache-commons', 'org.apache.commons:commons-lang3:3.12.0') + library('mojang-logging', 'com.mojang:logging:1.1.1') + library('jopt-simple', 'net.sf.jopt-simple:jopt-simple:5.0.4') + library('commons-io', 'commons-io:commons-io:2.13.0') + + version('lwjgl', '3.3.1') + library('lwjgl', 'org.lwjgl', 'lwjgl' ).versionRef('lwjgl') + library('lwjgl-glfw', 'org.lwjgl', 'lwjgl-glfw' ).versionRef('lwjgl') + library('lwjgl-opengl', 'org.lwjgl', 'lwjgl-opengl').versionRef('lwjgl') + library('lwjgl-stb', 'org.lwjgl', 'lwjgl-stb' ).versionRef('lwjgl') + library('lwjgl-tinyfd', 'org.lwjgl', 'lwjgl-tinyfd').versionRef('lwjgl') + bundle('lwjgl', ['lwjgl', 'lwjgl-glfw', 'lwjgl-opengl', 'lwjgl-stb', 'lwjgl-tinyfd']) + } + } +} + rootProject.name = 'ForgeRoot' include 'fmlloader' diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 913ac60acb..104a33dfc4 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -16,6 +16,8 @@ import com.mojang.blaze3d.vertex.SheetedDecalTextureGenerator; import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.datafixers.util.Either; import com.mojang.math.Constants; + +import net.minecraft.ChatFormatting; import net.minecraft.FileUtil; import net.minecraft.client.Camera; import net.minecraft.client.KeyMapping; @@ -155,7 +157,6 @@ import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.ModLoader; import net.minecraftforge.fml.VersionChecker; import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.forge.snapshots.ForgeSnapshotsModClient; import net.minecraftforge.gametest.ForgeGameTestHooks; import net.minecraftforge.network.NetworkContext; import net.minecraftforge.network.NetworkInitialization; @@ -344,9 +345,16 @@ public class ForgeHooksClient { //RenderingRegistry.registerBlockHandler(RenderBlockFluid.instance); } - public static void renderMainMenu(TitleScreen gui, GuiGraphics guiGraphics, Font font, int width, int height, int alpha) { + public static void renderMainMenu(TitleScreen gui, GuiGraphics graphics, Font font, int width, int height, int alpha) { VersionChecker.Status status = ForgeVersion.getStatus(); - ForgeSnapshotsModClient.renderMainMenuWarning(status, gui, guiGraphics, font, width, height, alpha); + + if (status == VersionChecker.Status.BETA || status == VersionChecker.Status.BETA_OUTDATED) { + // Render a warning at the top of the screen + Component line = Component.translatable("forge.update.beta.1", ChatFormatting.RED, ChatFormatting.RESET).withStyle(ChatFormatting.RED); + graphics.drawCenteredString(font, line, width / 2, 4 + (0 * (font.lineHeight + 1)), 0xFFFFFF | alpha); + line = Component.translatable("forge.update.beta.2"); + graphics.drawCenteredString(font, line, width / 2, 4 + (1 * (font.lineHeight + 1)), 0xFFFFFF | alpha); + } forgeStatusLine = switch(status) { // case FAILED -> " Version check failed"; diff --git a/src/main/java/net/minecraftforge/common/ForgeMod.java b/src/main/java/net/minecraftforge/common/ForgeMod.java index 2b5a345186..dc413efeec 100644 --- a/src/main/java/net/minecraftforge/common/ForgeMod.java +++ b/src/main/java/net/minecraftforge/common/ForgeMod.java @@ -64,7 +64,6 @@ import net.minecraftforge.fluids.ForgeFlowingFluid; import net.minecraftforge.fml.*; import net.minecraftforge.fml.config.ModConfig; import net.minecraftforge.fml.event.lifecycle.*; -import net.minecraftforge.forge.snapshots.ForgeSnapshotsMod; import net.minecraftforge.registries.*; import net.minecraftforge.registries.holdersets.AndHolderSet; import net.minecraftforge.registries.holdersets.AnyHolderSet; @@ -389,7 +388,6 @@ public class ForgeMod { public ForgeMod() { LOGGER.info(FORGEMOD,"Forge mod loading, version {}, for MC {} with MCP {}", ForgeVersion.getVersion(), MCPVersion.getMCVersion(), MCPVersion.getMCPVersion()); - ForgeSnapshotsMod.logStartupWarning(); INSTANCE = this; MinecraftForge.initialize(); CrashReportCallables.registerCrashCallable("Crash Report UUID", ()-> { diff --git a/src/main/java/net/minecraftforge/internal/BrandingControl.java b/src/main/java/net/minecraftforge/internal/BrandingControl.java index 684abe5dc7..3c18302484 100644 --- a/src/main/java/net/minecraftforge/internal/BrandingControl.java +++ b/src/main/java/net/minecraftforge/internal/BrandingControl.java @@ -16,23 +16,18 @@ import net.minecraft.server.packs.resources.ResourceManagerReloadListener; import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.common.ForgeI18n; import net.minecraftforge.fml.ModList; -import net.minecraftforge.forge.snapshots.ForgeSnapshotsMod; import net.minecraftforge.versions.forge.ForgeVersion; import net.minecraftforge.versions.mcp.MCPVersion; - -public class BrandingControl -{ +public class BrandingControl { private static List brandings; private static List brandingsNoMC; private static List overCopyrightBrandings; - private static void computeBranding() - { - if (brandings == null) - { + private static void computeBranding() { + if (brandings == null) { ImmutableList.Builder brd = ImmutableList.builder(); - brd.add(ForgeSnapshotsMod.BRANDING_NAME + ' ' + ForgeVersion.getVersion()); + brd.add("Forge " + ForgeVersion.getVersion()); brd.add("Minecraft " + MCPVersion.getMCVersion()); brd.add("MCP " + MCPVersion.getMCPVersion()); int tModCount = ModList.get().size(); @@ -42,14 +37,12 @@ public class BrandingControl } } - private static List getBrandings(boolean includeMC, boolean reverse) - { + private static List getBrandings(boolean includeMC, boolean reverse) { computeBranding(); - if (includeMC) { + if (includeMC) return reverse ? Lists.reverse(brandings) : brandings; - } else { + else return reverse ? Lists.reverse(brandingsNoMC) : brandingsNoMC; - } } private static void computeOverCopyrightBrandings() { @@ -71,11 +64,11 @@ public class BrandingControl } public static String getClientBranding() { - return ForgeSnapshotsMod.BRANDING_ID; + return "forge"; } public static String getServerBranding() { - return ForgeSnapshotsMod.BRANDING_ID; + return "forge"; } public static ResourceManagerReloadListener resourceManagerReloadListener() { diff --git a/src/main/java/net/minecraftforge/logging/CrashReportExtender.java b/src/main/java/net/minecraftforge/logging/CrashReportExtender.java index 66b8c1353f..2bc2c1bdc8 100644 --- a/src/main/java/net/minecraftforge/logging/CrashReportExtender.java +++ b/src/main/java/net/minecraftforge/logging/CrashReportExtender.java @@ -21,25 +21,14 @@ import java.io.File; import java.text.SimpleDateFormat; import java.util.*; -public class CrashReportExtender -{ - - public static void extendSystemReport(final SystemReport systemReport) - { - for (final ISystemReportExtender call : CrashReportCallables.allCrashCallables()) - { +public class CrashReportExtender { + public static void extendSystemReport(final SystemReport systemReport) { + for (final ISystemReportExtender call : CrashReportCallables.allCrashCallables()) { if (call.isActive()) - { systemReport.setDetail(call.getLabel(), call); - } } } - public static void addCrashReportHeader(StringBuilder stringbuilder, CrashReport crashReport) - { - net.minecraftforge.forge.snapshots.ForgeSnapshotsMod.addCrashReportHeader(stringbuilder, crashReport); - } - public static String generateEnhancedStackTrace(final Throwable throwable) { return generateEnhancedStackTrace(throwable, true); } @@ -55,7 +44,6 @@ public class CrashReportExtender return header ? s : s.substring(s.indexOf(Strings.LINE_SEPARATOR)); } - public static File dumpModLoadingCrashReport(final Logger logger, final LoadingFailedException error, final File topLevelDir) { final CrashReport crashReport = CrashReport.forThrowable(new Exception("Mod Loading has failed"), "Mod loading error has occurred"); error.getErrors().forEach(mle -> { diff --git a/src/snapshots/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsMod.java b/src/snapshots/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsMod.java deleted file mode 100644 index 5fd161a520..0000000000 --- a/src/snapshots/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsMod.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.forge.snapshots; - -import com.mojang.logging.LogUtils; -import net.minecraft.CrashReport; -import net.minecraft.client.Options; -import org.slf4j.Logger; - -public class ForgeSnapshotsMod -{ - public static final String BRANDING_NAME = "Froge"; - public static final String BRANDING_ID = "froge"; - private static final Logger LOGGER = LogUtils.getLogger(); - static boolean seenSnapshotWarning = false; - - public static void processOptions(Options.FieldAccess fieldAccess) - { - seenSnapshotWarning = fieldAccess.process("seenSnapshotWarning", seenSnapshotWarning); - } - - public static void logStartupWarning() - { - LOGGER.warn("Froge is not officially supported. Bugs and instability are expected."); - } - - public static void addCrashReportHeader(StringBuilder builder, CrashReport crashReport) - { - builder.append("---- Please note that Minecraft Forge DOES NOT support Froge builds. Bugs and instability are expected. ----\n"); - } -} diff --git a/src/snapshots/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsModClient.java b/src/snapshots/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsModClient.java deleted file mode 100644 index e0d958fae2..0000000000 --- a/src/snapshots/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsModClient.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.forge.snapshots; - -import com.mojang.blaze3d.vertex.PoseStack; -import net.minecraft.ChatFormatting; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.screens.ConfirmScreen; -import net.minecraft.client.gui.screens.TitleScreen; -import net.minecraft.network.chat.CommonComponents; -import net.minecraft.network.chat.Component; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.event.ScreenEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.VersionChecker; -import net.minecraftforge.fml.common.Mod; - -@Mod.EventBusSubscriber(value = Dist.CLIENT) -public class ForgeSnapshotsModClient -{ - public static void renderMainMenuWarning(VersionChecker.Status status, TitleScreen gui, GuiGraphics guiGraphics, Font font, int width, int height, int alpha) - { - // Render a warning at the top of the screen - Component line = Component.translatable("forge.froge.supportWarning").withStyle(ChatFormatting.RED); - guiGraphics.drawCenteredString(font, line, width / 2, 4 + (font.lineHeight + 1) / 2, 0xFFFFFF | alpha); - } - - @SubscribeEvent - static void onScreenOpen(final ScreenEvent.Opening event) - { - if (ForgeSnapshotsMod.seenSnapshotWarning || !(event.getNewScreen() instanceof TitleScreen titleScreen)) - return; - - event.setNewScreen(new ConfirmScreen(confirmed -> { - if (confirmed) - { - ForgeSnapshotsMod.seenSnapshotWarning = true; - Minecraft.getInstance().options.save(); - Minecraft.getInstance().setScreen(titleScreen); - } - else - { - System.exit(0); - } - }, Component.translatable("forge.froge.warningScreen.title"), Component.translatable("forge.froge.warningScreen.text"), - CommonComponents.GUI_ACKNOWLEDGE, Component.translatable("forge.gui.exit"))); - } - - // @SubscribeEvent(priority = EventPriority.LOWEST) - // static void onGuiOverlayDebugText(final CustomizeGuiOverlayEvent.DebugText event) - // { - // if (Minecraft.getInstance().options.renderDebug) - // { - // event.getLeft().add(0, "Minecraft Froge"); - // event.getRight().add(0, "NOT SUPPORTED"); - // } - // } -} diff --git a/src/snapshots_disabled/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsMod.java b/src/snapshots_disabled/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsMod.java deleted file mode 100644 index a7d47104a2..0000000000 --- a/src/snapshots_disabled/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsMod.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.forge.snapshots; - -import net.minecraft.CrashReport; -import net.minecraft.client.Options; - -public class ForgeSnapshotsMod -{ - public static final String BRANDING_NAME = "Forge"; - public static final String BRANDING_ID = "forge"; - - public static void processOptions(Options.FieldAccess fieldAccess) {} - - public static void logStartupWarning() {} - - public static void addCrashReportHeader(StringBuilder builder, CrashReport crashReport) {} -} diff --git a/src/snapshots_disabled/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsModClient.java b/src/snapshots_disabled/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsModClient.java deleted file mode 100644 index 6e17c373f8..0000000000 --- a/src/snapshots_disabled/java/net/minecraftforge/forge/snapshots/ForgeSnapshotsModClient.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) Forge Development LLC and contributors - * SPDX-License-Identifier: LGPL-2.1-only - */ - -package net.minecraftforge.forge.snapshots; - -import net.minecraft.ChatFormatting; -import net.minecraft.client.gui.Font; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.screens.TitleScreen; -import net.minecraft.network.chat.Component; -import net.minecraftforge.fml.VersionChecker; - -public class ForgeSnapshotsModClient -{ - public static void renderMainMenuWarning(VersionChecker.Status status, TitleScreen gui, GuiGraphics graphics, Font font, int width, int height, int alpha) - { - if (status == VersionChecker.Status.BETA || status == VersionChecker.Status.BETA_OUTDATED) - { - // Render a warning at the top of the screen - Component line = Component.translatable("forge.update.beta.1", ChatFormatting.RED, ChatFormatting.RESET).withStyle(ChatFormatting.RED); - graphics.drawCenteredString(font, line, width / 2, 4 + (0 * (font.lineHeight + 1)), 0xFFFFFF | alpha); - line = Component.translatable("forge.update.beta.2"); - graphics.drawCenteredString(font, line, width / 2, 4 + (1 * (font.lineHeight + 1)), 0xFFFFFF | alpha); - } - } -}