Initial commit: claude derived solution
This commit is contained in:
14
.gitignore
vendored
Normal file
14
.gitignore
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
.gradle/
|
||||
build/
|
||||
out/
|
||||
.idea/
|
||||
*.iml
|
||||
.vscode/
|
||||
.eclipse/
|
||||
.classpath
|
||||
.project
|
||||
.settings/
|
||||
.DS_Store
|
||||
run/
|
||||
runs/
|
||||
libs/
|
||||
99
README.md
Normal file
99
README.md
Normal file
@@ -0,0 +1,99 @@
|
||||
# Gravestone × Sable Compatibility Patch
|
||||
|
||||
A minimal patch mod for Minecraft **1.21.1 / NeoForge** that fixes gravestone
|
||||
placement when a player dies on a Sable sub-level (e.g. a **Create Aeronautics**
|
||||
airship). Without this mod, dying mid-flight makes gravestone place its block
|
||||
(and a dirt support block) in the parent world at the player's visible position.
|
||||
The blocks then clip into the airship's collision shape and stall its physics.
|
||||
|
||||
With this mod installed, the grave is placed inside the airship's plot area, so
|
||||
it lands on the deck and travels with the airship like any other block on it.
|
||||
|
||||
## How it works (one paragraph)
|
||||
|
||||
Sable stores each sub-level's blocks in a far-away "plot" region of the same
|
||||
`Level`. The visible airship position is a logical pose that's applied at render
|
||||
and collision time only. Gravestone's `DeathEvents.playerDeath` calls
|
||||
`GraveUtils.getGraveStoneLocation(level, deathPos)` with the player's world
|
||||
position — but that position is empty space, so the search either fails or
|
||||
places the grave clipping into the airship. This mod uses Mixin Extras'
|
||||
`@WrapOperation` to intercept that single call and substitute the player's
|
||||
position transformed into the sub-level's plot-local frame
|
||||
(`subLevel.logicalPose().transformPositionInverse(playerPos)`). Gravestone's
|
||||
existing search routine then finds the deck above the player's feet and places
|
||||
the grave correctly inside the contraption. If the player isn't on a sub-level
|
||||
when they die, the mod is a no-op.
|
||||
|
||||
The mod uses **Sable Companion** rather than depending on Sable directly, so
|
||||
it's safe to ship in packs without Sable (the companion's default
|
||||
implementation just returns null for all sub-level queries → graves behave
|
||||
exactly like vanilla gravestone).
|
||||
|
||||
## Build
|
||||
|
||||
Requires **JDK 21**.
|
||||
|
||||
If you don't already have a Gradle wrapper jar in `gradle/wrapper/`, bootstrap
|
||||
one first (one-time, needs any system Gradle ≥ 8.10 — `sdk install gradle 8.10`,
|
||||
`brew install gradle`, `apt install gradle`, etc.):
|
||||
|
||||
```bash
|
||||
gradle wrapper --gradle-version 8.10
|
||||
```
|
||||
|
||||
Alternatively, copy `gradlew`, `gradlew.bat`, and `gradle/wrapper/` from any
|
||||
recent NeoForge 1.21.1 mod template (e.g. the official
|
||||
[NeoForge MDK](https://github.com/neoforged/MDK)).
|
||||
|
||||
Then build the mod:
|
||||
|
||||
```bash
|
||||
./gradlew build
|
||||
```
|
||||
|
||||
The output jar is at `build/libs/gravestone_sable_compat-1.0.0.jar`.
|
||||
|
||||
If the Modrinth maven can't resolve `gravestone-mod` for your machine, drop
|
||||
`gravestone-1.21.1-1.0.19.jar` (or any 1.21.1 build of gravestone) into a
|
||||
`libs/` folder at the project root, comment out the `compileOnly
|
||||
"maven.modrinth:gravestone-mod:..."` line in `build.gradle`, and uncomment the
|
||||
`compileOnly fileTree(dir: 'libs', ...)` line.
|
||||
|
||||
## Runtime requirements
|
||||
|
||||
Drop the built jar into your modpack alongside:
|
||||
|
||||
| Mod | Version |
|
||||
|---|---|
|
||||
| NeoForge | 21.1.x (1.21.1) |
|
||||
| [Gravestone (henkelmax)](https://modrinth.com/mod/gravestone-mod) | 1.21.1-1.0.19 or later |
|
||||
| [Sable](https://modrinth.com/mod/sable) | 1.0+ |
|
||||
| [Sable Companion](https://github.com/ryanhcode/sable-companion) | 1.6+ (bundled inside this jar via JarInJar; no separate install needed) |
|
||||
| Create Aeronautics | any version that uses Sable |
|
||||
|
||||
The mixin only attaches to `de.maxhenkel.gravestone.events.DeathEvents.playerDeath`'s
|
||||
single call to `GraveUtils.getGraveStoneLocation(Level, BlockPos)`. The signature
|
||||
of that call has been stable across gravestone 1.21.1-1.0.19 → 1.0.37, so the
|
||||
mod should work with any of them. If a future build refactors that method, the
|
||||
mixin will fail loudly at load time (`defaultRequire: 1`) rather than silently
|
||||
no-op.
|
||||
|
||||
## File layout
|
||||
|
||||
```
|
||||
gravestone-sable-compat/
|
||||
├─ build.gradle
|
||||
├─ gradle.properties
|
||||
├─ settings.gradle
|
||||
├─ src/main/java/com/example/gravestonesablecompat/
|
||||
│ ├─ GravestoneSableCompat.java # tiny @Mod entry point
|
||||
│ └─ mixin/DeathEventsMixin.java # the actual fix (one @WrapOperation)
|
||||
└─ src/main/resources/
|
||||
├─ META-INF/neoforge.mods.toml
|
||||
├─ gravestone_sable_compat.mixins.json
|
||||
└─ pack.mcmeta
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT — go wild.
|
||||
132
build.gradle
Normal file
132
build.gradle
Normal file
@@ -0,0 +1,132 @@
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'net.neoforged.moddev' version '2.0.74'
|
||||
}
|
||||
|
||||
version = mod_version
|
||||
group = mod_group_id
|
||||
|
||||
base {
|
||||
archivesName = mod_id
|
||||
}
|
||||
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
// Sable Companion (lightweight shim — works whether Sable is installed or not).
|
||||
exclusiveContent {
|
||||
forRepository {
|
||||
maven {
|
||||
name = 'RyanHCode Maven'
|
||||
url = 'https://maven.ryanhcode.dev/releases'
|
||||
}
|
||||
}
|
||||
filter {
|
||||
includeGroup 'dev.ryanhcode.sable'
|
||||
includeGroup 'dev.ryanhcode.sable-companion'
|
||||
}
|
||||
}
|
||||
|
||||
// Modrinth maven (used for gravestone-mod jar to compile against).
|
||||
exclusiveContent {
|
||||
forRepository {
|
||||
maven {
|
||||
name = 'Modrinth'
|
||||
url = 'https://api.modrinth.com/maven'
|
||||
}
|
||||
}
|
||||
filter {
|
||||
includeGroup 'maven.modrinth'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
neoForge {
|
||||
version = neoforge_version
|
||||
|
||||
parchment {
|
||||
mappingsVersion = parchment_version
|
||||
minecraftVersion = parchment_minecraft
|
||||
}
|
||||
|
||||
validateAccessTransformers = true
|
||||
|
||||
runs {
|
||||
configureEach {
|
||||
systemProperty 'forge.logging.markers', 'REGISTRIES'
|
||||
logLevel = org.slf4j.event.Level.DEBUG
|
||||
}
|
||||
client {
|
||||
client()
|
||||
}
|
||||
server {
|
||||
server()
|
||||
programArgument '--nogui'
|
||||
}
|
||||
}
|
||||
|
||||
mods {
|
||||
"${mod_id}" {
|
||||
sourceSet sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
runtimeClasspath.extendsFrom localRuntime
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Sable Companion: includes a default no-op implementation so this jar runs even
|
||||
// when Sable itself is absent. Bundle it via jarJar so users only need our jar +
|
||||
// Sable + Gravestone in their mods folder.
|
||||
jarJar(implementation("dev.ryanhcode.sable-companion:sable-companion-common-${minecraft_version}:[${sable_companion_version},)")) {
|
||||
version {
|
||||
prefer sable_companion_version
|
||||
}
|
||||
}
|
||||
|
||||
// Gravestone Mod — compile against the published jar from Modrinth.
|
||||
// The shadowed jar contains relocated classes under de.maxhenkel.gravestone.*
|
||||
// We only reference de.maxhenkel.gravestone.events.DeathEvents (target) and
|
||||
// de.maxhenkel.gravestone.GraveUtils (referenced in @At target descriptor).
|
||||
compileOnly "maven.modrinth:gravestone-mod:${gravestone_version}"
|
||||
|
||||
// Optional fallback if the modrinth jar can't be resolved: drop a gravestone JAR
|
||||
// into a 'libs/' folder in this project root, then uncomment the next line.
|
||||
// compileOnly fileTree(dir: 'libs', include: ['*.jar'])
|
||||
}
|
||||
|
||||
tasks.withType(ProcessResources).configureEach {
|
||||
var replaceProperties = [
|
||||
minecraft_version: minecraft_version,
|
||||
minecraft_version_range: minecraft_version_range,
|
||||
neoforge_version: neoforge_version,
|
||||
neoforge_loader_version_range: neoforge_loader_version_range,
|
||||
mod_id: mod_id,
|
||||
mod_name: mod_name,
|
||||
mod_license: mod_license,
|
||||
mod_version: mod_version,
|
||||
mod_authors: mod_authors,
|
||||
mod_description: mod_description,
|
||||
]
|
||||
inputs.properties(replaceProperties)
|
||||
filesMatching(['META-INF/neoforge.mods.toml', 'pack.mcmeta']) {
|
||||
expand replaceProperties + [project: project]
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named('jar', Jar).configure {
|
||||
manifest {
|
||||
attributes([
|
||||
'Specification-Title' : mod_id,
|
||||
'Specification-Vendor' : mod_authors,
|
||||
'Specification-Version' : '1',
|
||||
'Implementation-Title' : mod_name,
|
||||
'Implementation-Version' : mod_version,
|
||||
'Implementation-Vendor' : mod_authors,
|
||||
])
|
||||
}
|
||||
}
|
||||
26
gradle.properties
Normal file
26
gradle.properties
Normal file
@@ -0,0 +1,26 @@
|
||||
org.gradle.jvmargs=-Xmx2G
|
||||
org.gradle.daemon=false
|
||||
org.gradle.parallel=true
|
||||
|
||||
# Minecraft / NeoForge
|
||||
minecraft_version=1.21.1
|
||||
minecraft_version_range=[1.21.1]
|
||||
neoforge_version=21.1.219
|
||||
neoforge_loader_version_range=[4,)
|
||||
|
||||
# Parchment mappings (optional, but matches Sable's setup)
|
||||
parchment_minecraft=1.21
|
||||
parchment_version=2024.11.10
|
||||
|
||||
# This mod
|
||||
mod_id=gravestone_sable_compat
|
||||
mod_name=Gravestone Sable Compat
|
||||
mod_license=MIT
|
||||
mod_version=1.0.0
|
||||
mod_group_id=com.example.gravestonesablecompat
|
||||
mod_authors=YourName
|
||||
mod_description=Places gravestones on the correct Sable sub-level (e.g. Create Aeronautics airships) when a player dies on one.
|
||||
|
||||
# Dependencies
|
||||
sable_companion_version=1.6.0
|
||||
gravestone_version=1.21.1-1.0.19
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
252
gradlew
vendored
Executable file
252
gradlew
vendored
Executable file
@@ -0,0 +1,252 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# 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/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# 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 -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
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
94
gradlew.bat
vendored
Normal file
94
gradlew.bat
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@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 ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
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
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
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
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
15
settings.gradle
Normal file
15
settings.gradle
Normal file
@@ -0,0 +1,15 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven {
|
||||
name = 'NeoForged'
|
||||
url = 'https://maven.neoforged.net/releases'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
|
||||
}
|
||||
|
||||
rootProject.name = 'gravestone-sable-compat'
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.example.gravestonesablecompat;
|
||||
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Entry point for the Gravestone <-> Sable compatibility patch mod.
|
||||
*
|
||||
* <p>This mod has no runtime logic of its own — the entire fix lives in
|
||||
* {@link com.example.gravestonesablecompat.mixin.DeathEventsMixin}, which redirects
|
||||
* gravestone's grave-placement target into the player's tracking sub-level when one
|
||||
* is present (e.g. a Create Aeronautics / Sable airship).</p>
|
||||
*/
|
||||
@Mod(GravestoneSableCompat.MOD_ID)
|
||||
public class GravestoneSableCompat {
|
||||
|
||||
public static final String MOD_ID = "gravestone_sable_compat";
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
|
||||
|
||||
public GravestoneSableCompat() {
|
||||
LOGGER.info("Gravestone Sable Compat loaded — graves will now follow Sable sub-levels.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.example.gravestonesablecompat.mixin;
|
||||
|
||||
import com.example.gravestonesablecompat.GravestoneSableCompat;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import de.maxhenkel.gravestone.events.DeathEvents;
|
||||
import dev.ryanhcode.sable.companion.SableCompanion;
|
||||
import dev.ryanhcode.sable.companion.SubLevelAccess;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
||||
/**
|
||||
* Compatibility patch for gravestone + Sable (used by Create Aeronautics / Eureka-style mods).
|
||||
*
|
||||
* <p><b>The bug:</b> Sable stores the blocks of an airship/contraption in a far-away
|
||||
* "plot" region of the same {@link Level}. While the airship moves, those plot blocks
|
||||
* stay put — only their visible {@link dev.ryanhcode.sable.companion.math.Pose3dc pose}
|
||||
* changes. The player's world-space position reflects the airship's <i>visible</i>
|
||||
* location, so when gravestone calls
|
||||
* {@code GraveUtils.getGraveStoneLocation(level, deathPos)} on death, the search starts
|
||||
* in empty world-space air, walks upward, and either fails or places the grave at some
|
||||
* arbitrary point in the parent world. Worse, gravestone also drops a dirt block below
|
||||
* the grave when the support block is replaceable — which it is in midair. The grave
|
||||
* and dirt then clip into the airship's collision shape, halting its physics.</p>
|
||||
*
|
||||
* <p><b>The fix:</b> Just before the search, transform the player's world-space position
|
||||
* back into the sub-level's plot-local frame using the inverse of its current pose.
|
||||
* Pass that local position into the (unchanged) gravestone search routine. The search
|
||||
* then runs entirely inside the airship's plot area; the grave lands on the deck
|
||||
* (first replaceable block above the player's feet) and Sable treats it as part of
|
||||
* the contraption's chunks, so it travels with the airship correctly. The dirt-support
|
||||
* placement now only triggers if there's actual air below that grave inside the
|
||||
* contraption, eliminating the stray world-space dirt blocks.</p>
|
||||
*
|
||||
* <p>If the player isn't on / riding a sub-level (vanilla death), {@code subLevel} is
|
||||
* null and we just call the original method unchanged.</p>
|
||||
*
|
||||
* <p>We use Sable Companion's interface (which falls back to a no-op implementation
|
||||
* when Sable isn't loaded) so this jar is safe to ship even in packs without Sable.</p>
|
||||
*
|
||||
* <p>Both {@code remap = false} flags are required because gravestone's classes are
|
||||
* not in the official Mojang/Mojmap namespace (they're a third-party mod's own
|
||||
* package/method names).</p>
|
||||
*/
|
||||
@Mixin(value = DeathEvents.class, remap = false)
|
||||
public class DeathEventsMixin {
|
||||
|
||||
@WrapOperation(
|
||||
method = "playerDeath",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lde/maxhenkel/gravestone/GraveUtils;getGraveStoneLocation(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)Lnet/minecraft/core/BlockPos;"
|
||||
),
|
||||
remap = false
|
||||
)
|
||||
private BlockPos gravestone_sable_compat$redirectToSubLevel(
|
||||
final Level level,
|
||||
final BlockPos worldPos,
|
||||
final Operation<BlockPos> original,
|
||||
@Local final Player player
|
||||
) {
|
||||
// Companion returns null if (a) the player isn't tracked on / riding a sub-level
|
||||
// or (b) Sable isn't installed at all. Either way, fall through to vanilla behavior.
|
||||
final SubLevelAccess subLevel = SableCompanion.INSTANCE.getTrackingOrVehicleSubLevel(player);
|
||||
if (subLevel == null) {
|
||||
return original.call(level, worldPos);
|
||||
}
|
||||
|
||||
// World-space player position -> plot-local position via the sub-level's inverse pose.
|
||||
// We use the player's current position rather than `death.getBlockPos()` to (a) avoid
|
||||
// touching gravestone's relocated corelib classes and (b) get a continuous double-precision
|
||||
// value rather than a rounded BlockPos, which matters near plot-chunk boundaries.
|
||||
final Vec3 worldPlayerPos = player.position();
|
||||
final Vec3 localPlayerPos = subLevel.logicalPose().transformPositionInverse(worldPlayerPos);
|
||||
final BlockPos localPos = BlockPos.containing(localPlayerPos);
|
||||
|
||||
if (GravestoneSableCompat.LOGGER.isDebugEnabled()) {
|
||||
GravestoneSableCompat.LOGGER.debug(
|
||||
"Player {} died on sub-level {} (name='{}'). Redirecting grave search: world {} -> plot {}",
|
||||
player.getName().getString(), subLevel.getUniqueId(), subLevel.getName(),
|
||||
worldPos, localPos
|
||||
);
|
||||
}
|
||||
|
||||
return original.call(level, localPos);
|
||||
}
|
||||
}
|
||||
46
src/main/resources/META-INF/neoforge.mods.toml
Normal file
46
src/main/resources/META-INF/neoforge.mods.toml
Normal file
@@ -0,0 +1,46 @@
|
||||
modLoader="javafml"
|
||||
loaderVersion="${neoforge_loader_version_range}"
|
||||
license="${mod_license}"
|
||||
issueTrackerURL="https://example.com"
|
||||
|
||||
[[mods]]
|
||||
modId="${mod_id}"
|
||||
version="${mod_version}"
|
||||
displayName="${mod_name}"
|
||||
authors="${mod_authors}"
|
||||
description='''${mod_description}'''
|
||||
|
||||
[[mixins]]
|
||||
config="${mod_id}.mixins.json"
|
||||
|
||||
# Required by Mixin (matches NeoForge runtime).
|
||||
[[dependencies.${mod_id}]]
|
||||
modId="neoforge"
|
||||
type="required"
|
||||
versionRange="${neoforge_loader_version_range}"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
[[dependencies.${mod_id}]]
|
||||
modId="minecraft"
|
||||
type="required"
|
||||
versionRange="${minecraft_version_range}"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
# Both target mods are required: this jar exists *solely* to patch the interaction
|
||||
# between them, so loading it without either is meaningless. AFTER ordering ensures
|
||||
# the targets' classes are loaded by the time mixins apply.
|
||||
[[dependencies.${mod_id}]]
|
||||
modId="sable"
|
||||
type="required"
|
||||
versionRange="[1.0,)"
|
||||
ordering="AFTER"
|
||||
side="BOTH"
|
||||
|
||||
[[dependencies.${mod_id}]]
|
||||
modId="gravestone"
|
||||
type="required"
|
||||
versionRange="[1.21.1-1.0.19,)"
|
||||
ordering="AFTER"
|
||||
side="BOTH"
|
||||
13
src/main/resources/gravestone_sable_compat.mixins.json
Normal file
13
src/main/resources/gravestone_sable_compat.mixins.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8.5",
|
||||
"package": "com.example.gravestonesablecompat.mixin",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"refmap": "gravestone_sable_compat.refmap.json",
|
||||
"mixins": [
|
||||
"DeathEventsMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
8
src/main/resources/pack.mcmeta
Normal file
8
src/main/resources/pack.mcmeta
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "${mod_name}",
|
||||
"pack_format": 34,
|
||||
"forge:resource_pack_format": 34,
|
||||
"forge:data_pack_format": 48
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user