Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NeoForge support #356

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

.PHONY: clean
clean:
rm -rf build common/build fabric/build forge/build
rm -rf build common/build fabric/build neoforge/build #forge/build


.PHONY: jar
jar:
./gradlew remapJar
ls -1 fabric/build/libs
ls -1 neoforge/build/libs
# ls -1 forge/build/libs

test:
Expand Down Expand Up @@ -39,14 +40,18 @@ deps:
.PHONY: inst
inst:
# rm -f ~/minecraft/instances/1.20.1-forge-dev/.minecraft/mods/fastback*
rm -f ~/minecraft/instances/1.20.1-neoforge-dev/.minecraft/mods/fastback*
rm -f ~/minecraft/instances/1.20.1-fabric-dev/.minecraft/mods/fasback*
cp fabric/build/libs/fastback*-fabric.jar ~/minecraft/instances/1.20.1-fabric-dev/.minecraft/mods/
cp neoforge/build/libs/fastback*-neoforge.jar ~/minecraft/instances/1.20.1-neoforge-dev/.minecraft/mods/
# cp forge/build/libs/fastback*-forge.jar ~/minecraft/instances/1.20.1-forge-dev/.minecraft/mods/

.PHONY: tvf
tvf:
jar -tvf neoforge/build/libs/fastback*-neoforge.jar
# jar -tvf forge/build/libs/fastback*-forge.jar

.PHONY: tvfs
tvfs:
jar -tvf neoforge/build/libs/fastback*-shadow.jar
# jar -tvf forge/build/libs/fastback*-shadow.jar
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ of disk space.

## Features

* **Now with NeoForge support!**
* Incrementally backup just the changed files
* Faster, smaller backups than zipping
* Back up locally
Expand All @@ -31,7 +32,6 @@ of disk space.
* Support for restoring remote snapshots
* Better management of remote snapshots
* UI for managing backups from the title screen
* ~~Forge support (maybe)~~

## Acknowledgements

Expand Down
3 changes: 2 additions & 1 deletion 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.6-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
}


Expand All @@ -19,6 +19,7 @@ subprojects {
maven { url 'https://maven.fabricmc.net/' }
maven { url 'https://maven.nucleoid.xyz' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://maven.neoforged.net/releases/' }
}

java {
Expand Down
1 change: 1 addition & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

architectury {
common("fabric")
common("neoforge")
// NOTE: Forge is no longer supported and the build has been disabled
// See: https://github.com/pcal43/fastback/issues/333
//common("forge")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ public void warn(String message) {
this.log4j.warn(message);
}

@Override
public void warn(String message, Throwable t) {
this.log4j.warn(message, t);
}

@Override
public void info(String message) {
this.log4j.info(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ default void error(Throwable e) {

void warn(String message);

void warn(String message, Throwable t);

void info(String message);

void debug(String message);
Expand Down
13 changes: 9 additions & 4 deletions common/src/main/java/net/pcal/fastback/mod/ModImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.nio.file.Path;
import java.util.Collection;
import java.util.Map;
import java.util.ServiceConfigurationError;

import static java.nio.file.Files.createTempDirectory;
import static java.util.Objects.requireNonNull;
Expand Down Expand Up @@ -162,10 +163,14 @@ public void onInitialize() {
syslog().info("git-lfs is installed: " + gitLfsVersion);
}
}
if (SshSessionFactory.getInstance() == null) {
syslog().warn("An ssh provider was not initialized for jgit. Operations on a remote repo over ssh will fail.");
} else {
syslog().info("SshSessionFactory: " + SshSessionFactory.getInstance().toString());
try {
if (SshSessionFactory.getInstance() == null) {
syslog().warn("An ssh provider was not initialized for jgit. Operations on a remote repo over ssh will fail.");
} else {
syslog().info("SshSessionFactory: " + SshSessionFactory.getInstance().toString());
}
} catch (Exception | ServiceConfigurationError e) {
syslog().warn("An ssh provider was not initialized for jgit. Operations on a remote repo over ssh will fail.", e);
}
syslog().debug("onInitialize complete");
}
Expand Down
4 changes: 3 additions & 1 deletion etc/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ fi
#

FABRIC_LIBS_DIR='fabric/build/libs'
NEOFORGE_LIBS_DIR='neoforge/build/libs'

# NOTE: Forge is no longer supported and the build has been disabled
# See: https://github.com/pcal43/fastback/issues/333
Expand All @@ -69,6 +70,7 @@ rm gradle.properties
mv gradle.properties.temp gradle.properties

rm -rf "${FABRIC_LIBS_DIR}"
rm -rf "${NEOFORGE_LIBS_DIR}"

# NOTE: Forge is no longer supported and the build has been disabled
# See: https://github.com/pcal43/fastback/issues/333
Expand All @@ -84,7 +86,7 @@ git push
# Do github release
#
set -x
gh release create --generate-notes --title "${RELEASE_VERSION}" --notes "release ${RELEASE_VERSION}" ${RELEASE_VERSION} "${FABRIC_LIBS_DIR}"/* # "${FORGE_LIBS_DIR}"/*
gh release create --generate-notes --title "${RELEASE_VERSION}" --notes "release ${RELEASE_VERSION}" ${RELEASE_VERSION} "${FABRIC_LIBS_DIR}"/* "${NEOFORGE_LIBS_DIR}"/* # "${FORGE_LIBS_DIR}"/*
set +x


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.level.storage.LevelStorageSource;
import net.minecraft.world.level.storage.LevelSummary;
import net.pcal.fastback.logging.Log4jLogger;
import net.pcal.fastback.logging.SystemLogger;
import net.pcal.fastback.logging.UserMessage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class MinecraftServerMixin {
* Intercept the call to saveAll that triggers on autosave, pass it through and then send out notification that
* the autosave is done.
*/
@Redirect(method = "tickServer(Ljava/util/function/BooleanSupplier;)V",
@Redirect(method = "autoSave()V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;saveEverything(ZZZ)Z"))
public boolean fastback_saveAll(MinecraftServer instance, boolean suppressLogs, boolean flush, boolean force) {
boolean result = instance.saveEverything(suppressLogs, flush, force);
Expand Down
2 changes: 1 addition & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"fastback.mixins.json"
],
"depends": {
"fabricloader": ">=0.15.11",
"fabricloader": ">=0.16.4",
"fabric": "*",
"minecraft": "1.21.x",
"java": ">=21"
Expand Down
25 changes: 15 additions & 10 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# Fastback
#
mod_version = 0.19.1+1.21-prerelease
mod_version = 0.19.2+1.21.3-prerelease
maven_group = net.pcal
maven_name = fastback
archives_base_name = fastback
Expand All @@ -10,9 +10,9 @@ archives_base_name = fastback
#
# Fabric & Minecraft - https://fabricmc.net/develop
#
minecraft_version=1.21
loader_version=0.15.11
fabric_version=0.100.6+1.21
minecraft_version=1.21.3
loader_version=0.16.4
fabric_version=0.106.1+1.21.3

#
# Forge
Expand All @@ -22,15 +22,20 @@ fabric_version=0.100.6+1.21
# NOTE: Forge is no longer supported and the build has been disabled
# See: https://github.com/pcal43/fastback/issues/333

# NeoForge
#
# https://projects.neoforged.net/neoforged/neoforge
neo_version = 21.3.31-beta

#
# common dependencies
#

# https://mvnrepository.com/artifact/org.eclipse.jgit/org.eclipse.jgit
jgit_version = 6.8.0.202311291450-r
jgit_version = 6.10.0.202406032230-r

# https://mvnrepository.com/artifact/org.apache.sshd/sshd-core
apache_sshd_version = 2.12.1
apache_sshd_version = 2.14.0

# https://mvnrepository.com/artifact/com.googlecode.javaewah/JavaEWAH
JavaEWAH_version = 1.2.3
Expand All @@ -39,10 +44,10 @@ JavaEWAH_version = 1.2.3
eddsa_version = 0.3.0

# https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core
test_log4j_version = 2.23.1
test_log4j_version = 2.24.1

# https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine
junit_jupiter_version = 5.10.2
junit_jupiter_version = 5.11.2


#
Expand All @@ -54,13 +59,13 @@ fabric_permissions_version = 0.3.1

# https://github.com/NucleoidMC/Server-Translations/releases
# https://maven.nucleoid.xyz/xyz/nucleoid/server-translations-api/
server_translations_version = 2.3.1+1.21-pre2
server_translations_version = 2.4.0+1.21.2-rc1


#
# Build settings
#
architectury_version = 12.1.2
architectury_version = 13.0.8
org.gradle.daemon = true
org.gradle.parallel = true
org.gradle.jvmargs = -Xmx4G
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
Loading