Skip to content

Commit

Permalink
feat: port to 1.16
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelHillcox committed Jul 3, 2023
1 parent f5c00a0 commit f6e86fb
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 19 deletions.
Binary file removed .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ classes/
.metadata
.vscode
.settings
*.launch
*.launch
.DS_Store
11 changes: 9 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.2-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.1-SNAPSHOT" apply false
}

architectury {
Expand Down Expand Up @@ -45,7 +45,14 @@ allprojects {

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.release = 17

// The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too
// JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.
// We'll use that if it's available, but otherwise we'll use the older option.
def targetVersion = 8
if (JavaVersion.current().isJava9Compatible()) {
options.release = targetVersion
}
}

java {
Expand Down
Binary file removed common/.DS_Store
Binary file not shown.
Binary file removed common/src/.DS_Store
Binary file not shown.
Binary file removed common/src/main/.DS_Store
Binary file not shown.
6 changes: 3 additions & 3 deletions common/src/main/java/dev/nanite/dsp/DSPMod.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package dev.nanite.dsp;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class DSPMod {
public static final String MOD_ID = "dsp";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
public static final Logger LOGGER = LogManager.getLogger(MOD_ID);

public static void init() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import dev.nanite.dsp.DSPExpectedPlatform;
import dev.nanite.dsp.DSPMod;
import net.minecraft.core.RegistryAccess;
import net.minecraft.server.dedicated.DedicatedServerProperties;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -14,8 +15,8 @@

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

try {
Files.writeString(localMarkerFile, "");
Files.createFile(localMarkerFile);
} catch (IOException e) {
DSPMod.LOGGER.error("Unable to create marker so avoiding default properties injection...", e);
return;
}

// 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
DedicatedServerProperties dedicatedServerProperties = new DedicatedServerProperties(DedicatedServerProperties.loadFromFile(defaultSettingPath));
DedicatedServerProperties dedicatedServerProperties = new DedicatedServerProperties(DedicatedServerProperties.loadFromFile(defaultSettingPath), registryAccess);
DSPMod.LOGGER.info("Replacing server properties with default properties!");
info.setReturnValue(dedicatedServerProperties);
}
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/resources/dsp-common.mixins.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"required": true,
"package": "dev.nanite.dsp.mixin",
"compatibilityLevel": "JAVA_17",
"compatibilityLevel": "JAVA_8",
"minVersion": "0.8",
"server": [
"DedicatedServerPropertiesMixin"
Expand Down
2 changes: 1 addition & 1 deletion fabric/src/main/resources/dsp.mixins.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"required": true,
"package": "dev.nanite.dsp.mixin.fabric",
"compatibilityLevel": "JAVA_17",
"compatibilityLevel": "JAVA_8",
"minVersion": "0.8",
"client": [
],
Expand Down
Binary file removed forge/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion forge/src/main/resources/dsp.mixins.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"required": true,
"package": "dev.nanite.dsp.mixin.forge",
"compatibilityLevel": "JAVA_17",
"compatibilityLevel": "JAVA_8",
"minVersion": "0.8",
"client": [
],
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
org.gradle.jvmargs=-Xmx2048M

minecraft_version=1.20.1
minecraft_version=1.16.5
enabled_platforms=fabric,forge

archives_base_name=default-server-properties
mod_version=81.1.0
mod_version=69.1.0
maven_group=dev.nanite.mods

fabric_loader_version=0.14.21
fabric_api_version=0.83.1+1.20.1
fabric_loader_version=0.14.19
fabric_api_version=0.42.0+1.16

forge_version=1.20.1-47.0.6
forge_version=1.16.5-36.2.39

curseforge_id=676811
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 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit f6e86fb

Please sign in to comment.