Skip to content

Commit

Permalink
Merge pull request #11 from Ramb0N05/master
Browse files Browse the repository at this point in the history
Updated to Forge 1.18.2-40.1.80
  • Loading branch information
rheimus authored Nov 4, 2022
2 parents eae3fff + 7dd7ee2 commit bceb252
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 26 deletions.
47 changes: 27 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,37 @@ import org.apache.tools.ant.types.Parameter

buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
// These repositories are only for Gradle plugins, put any other repositories in the repository block further below
maven { url = 'https://maven.minecraftforge.net' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
}
}

plugins {
id 'maven-publish'
id 'eclipse'
id 'maven-publish'
}

apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.

version = '2.1.0'
version = '3.0.0'
group = 'serversync.forge.loader' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'serversync-forge-loader'
archivesBaseName = 'serversync_forge_loader'

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
//sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '17' // Need this here so eclipse task generates correctly.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)

println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
minecraft {
// The mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD Snapshot are built nightly.
// stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'snapshot', version: '20200514-1.16'
mappings channel: 'official', version: '1.18.2'
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.

// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
Expand Down Expand Up @@ -81,7 +82,7 @@ minecraft {
// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'

args '--mod', 'serversync-forge-loader', '--all', '--output', file('src/generated/resources/')
args '--mod', 'serversync_forge_loader', '--all', '--output', file('src/generated/resources/')

mods {
serversyncforgeloader {
Expand All @@ -92,11 +93,13 @@ minecraft {
}
}

sourceSets.main.resources { srcDir 'src/generated/resources' }

dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.16.3-34.1.0'
minecraft 'net.minecraftforge:forge:1.18.2-40.1.80'

// You may put jars on which you depend on in ./libs or you may define them like so..
// compile "some.group:artifact:version:classifier"
Expand Down Expand Up @@ -126,7 +129,7 @@ jar {
"Specification-Vendor" : "serversyncforgeloader",
"Specification-Version" : "1", // We are version 1 of ourselves
"Implementation-Title" : project.name,
"Implementation-Version" : "${version}",
"Implementation-Version" : project.jar.archiveVersion,
"Implementation-Vendor" : "serversyncforgeloader",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
Expand All @@ -137,16 +140,20 @@ jar {
// we define a custom artifact that is sourced from the reobfJar output task
// and then declare that to be published
// Note you'll need to add a repository here
def reobfFile = file("$buildDir/reobfJar/output.jar")
def reobfArtifact = artifacts.add('default', reobfFile) {
type 'jar'
builtBy 'reobfJar'
}
// def reobfFile = file("$buildDir/reobfJar/output.jar")
// def reobfArtifact = artifacts.add('default', reobfFile) {
// type 'jar'
// builtBy 'reobfJar'
// }
jar.finalizedBy('reobfJar')

publishing {
publications {
gpr(MavenPublication) {
from components.java
// gpr(MavenPublication) {
// from components.java
// }
mavenJava(MavenPublication) {
artifact jar
}
}
repositories {
Expand Down Expand Up @@ -205,4 +212,4 @@ processResources {
line.replaceAll('\\s*#.*', '')
}
}
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Thu Mar 26 18:01:34 NZDT 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/serversync/forge/loader/ServerSyncLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent;
import net.minecraftforge.fml.event.server.FMLServerStoppingEvent;
import net.minecraftforge.event.server.ServerAboutToStartEvent;
import net.minecraftforge.event.server.ServerStoppingEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import serversync.generated.Reference;
Expand Down Expand Up @@ -33,7 +33,7 @@ public ServerSyncLoader() {
}

@SubscribeEvent
public void onServerAboutToStart(FMLServerAboutToStartEvent event) {
public void onServerAboutToStart(ServerAboutToStartEvent event) {
// ** We should be in the root folder for Minecraft as our CWD when forge loads.

try (Stream<Path> fileStream = Files.list(Paths.get(""))) {
Expand Down Expand Up @@ -68,12 +68,13 @@ public void onServerAboutToStart(FMLServerAboutToStartEvent event) {
serverThread = (Thread) runServer.invoke(ssi);
} catch (IOException | ClassNotFoundException | NoSuchMethodException | NoSuchFieldException | IllegalAccessException | InvocationTargetException | InstantiationException e) {
// Filth!!, but meh
LOGGER.error("Failed to run ServerSync!");
e.printStackTrace();
}
}

@SubscribeEvent
public void onServerStopping(FMLServerStoppingEvent event) {
public void onServerStopping(ServerStoppingEvent event) {
serverThread.interrupt();
}
}
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ license="MIT"
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory
# The modid of the mod
modId="serversync-forge-loader" #mandatory
modId="serversync_forge_loader" #mandatory
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
version="${version}" #mandatory
# A display name for the mod
Expand Down

0 comments on commit bceb252

Please sign in to comment.