Skip to content

Commit f6e86fb

Browse files
feat: port to 1.16
1 parent f5c00a0 commit f6e86fb

File tree

14 files changed

+28
-19
lines changed

14 files changed

+28
-19
lines changed

.DS_Store

-8 KB
Binary file not shown.

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ classes/
1616
.metadata
1717
.vscode
1818
.settings
19-
*.launch
19+
*.launch
20+
.DS_Store

build.gradle

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
id "architectury-plugin" version "3.4-SNAPSHOT"
3-
id "dev.architectury.loom" version "1.2-SNAPSHOT" apply false
3+
id "dev.architectury.loom" version "1.1-SNAPSHOT" apply false
44
}
55

66
architectury {
@@ -45,7 +45,14 @@ allprojects {
4545

4646
tasks.withType(JavaCompile) {
4747
options.encoding = "UTF-8"
48-
options.release = 17
48+
49+
// The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too
50+
// JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.
51+
// We'll use that if it's available, but otherwise we'll use the older option.
52+
def targetVersion = 8
53+
if (JavaVersion.current().isJava9Compatible()) {
54+
options.release = targetVersion
55+
}
4956
}
5057

5158
java {

common/.DS_Store

-6 KB
Binary file not shown.

common/src/.DS_Store

-6 KB
Binary file not shown.

common/src/main/.DS_Store

-6 KB
Binary file not shown.

common/src/main/java/dev/nanite/dsp/DSPMod.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package dev.nanite.dsp;
22

3-
import org.slf4j.Logger;
4-
import org.slf4j.LoggerFactory;
3+
import org.apache.logging.log4j.LogManager;
4+
import org.apache.logging.log4j.Logger;
55

66
public class DSPMod {
77
public static final String MOD_ID = "dsp";
8-
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
8+
public static final Logger LOGGER = LogManager.getLogger(MOD_ID);
99

1010
public static void init() {
1111
}

common/src/main/java/dev/nanite/dsp/mixin/DedicatedServerPropertiesMixin.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import dev.nanite.dsp.DSPExpectedPlatform;
44
import dev.nanite.dsp.DSPMod;
5+
import net.minecraft.core.RegistryAccess;
56
import net.minecraft.server.dedicated.DedicatedServerProperties;
67
import org.spongepowered.asm.mixin.Mixin;
78
import org.spongepowered.asm.mixin.injection.At;
@@ -14,8 +15,8 @@
1415

1516
@Mixin(DedicatedServerProperties.class)
1617
public abstract class DedicatedServerPropertiesMixin {
17-
@Inject(at = @At("HEAD"), method = "fromFile(Ljava/nio/file/Path;)Lnet/minecraft/server/dedicated/DedicatedServerProperties;", cancellable = true)
18-
private static void fromFile(Path path, CallbackInfoReturnable<DedicatedServerProperties> info) {
18+
@Inject(at = @At("HEAD"), method = "fromFile(Lnet/minecraft/core/RegistryAccess;Ljava/nio/file/Path;)Lnet/minecraft/server/dedicated/DedicatedServerProperties;", cancellable = true)
19+
private static void fromFile(RegistryAccess registryAccess, Path path, CallbackInfoReturnable<DedicatedServerProperties> info) {
1920
Path defaultSettingPath = DSPExpectedPlatform.getGameDir().resolve("default-server.properties");
2021
if (!Files.exists(defaultSettingPath)) {
2122
DSPMod.LOGGER.info("No default-server.properties exist in the games root path... ignoring default injection");
@@ -38,14 +39,14 @@ private static void fromFile(Path path, CallbackInfoReturnable<DedicatedServerPr
3839
}
3940

4041
try {
41-
Files.writeString(localMarkerFile, "");
42+
Files.createFile(localMarkerFile);
4243
} catch (IOException e) {
4344
DSPMod.LOGGER.error("Unable to create marker so avoiding default properties injection...", e);
4445
return;
4546
}
4647

4748
// Natively defaults back to the original so if there is no default prop defined then this will just mimic the original creations of the server props file
48-
DedicatedServerProperties dedicatedServerProperties = new DedicatedServerProperties(DedicatedServerProperties.loadFromFile(defaultSettingPath));
49+
DedicatedServerProperties dedicatedServerProperties = new DedicatedServerProperties(DedicatedServerProperties.loadFromFile(defaultSettingPath), registryAccess);
4950
DSPMod.LOGGER.info("Replacing server properties with default properties!");
5051
info.setReturnValue(dedicatedServerProperties);
5152
}

common/src/main/resources/dsp-common.mixins.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"required": true,
33
"package": "dev.nanite.dsp.mixin",
4-
"compatibilityLevel": "JAVA_17",
4+
"compatibilityLevel": "JAVA_8",
55
"minVersion": "0.8",
66
"server": [
77
"DedicatedServerPropertiesMixin"

fabric/src/main/resources/dsp.mixins.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"required": true,
33
"package": "dev.nanite.dsp.mixin.fabric",
4-
"compatibilityLevel": "JAVA_17",
4+
"compatibilityLevel": "JAVA_8",
55
"minVersion": "0.8",
66
"client": [
77
],

forge/.DS_Store

-6 KB
Binary file not shown.

forge/src/main/resources/dsp.mixins.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"required": true,
33
"package": "dev.nanite.dsp.mixin.forge",
4-
"compatibilityLevel": "JAVA_17",
4+
"compatibilityLevel": "JAVA_8",
55
"minVersion": "0.8",
66
"client": [
77
],

gradle.properties

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
org.gradle.jvmargs=-Xmx2048M
22

3-
minecraft_version=1.20.1
3+
minecraft_version=1.16.5
44
enabled_platforms=fabric,forge
55

66
archives_base_name=default-server-properties
7-
mod_version=81.1.0
7+
mod_version=69.1.0
88
maven_group=dev.nanite.mods
99

10-
fabric_loader_version=0.14.21
11-
fabric_api_version=0.83.1+1.20.1
10+
fabric_loader_version=0.14.19
11+
fabric_api_version=0.42.0+1.16
1212

13-
forge_version=1.20.1-47.0.6
13+
forge_version=1.16.5-36.2.39
1414

1515
curseforge_id=676811
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)