Compare commits

..

No commits in common. "bd1f4889bccb980dd7bffa8d5b27a8ad415deb0b" and "cc92ab41fe410bcb0f04c6ae381f6848a5f8b053" have entirely different histories.

18 changed files with 197 additions and 259 deletions

View File

@ -12,7 +12,7 @@ jobs:
matrix: matrix:
# Use these Java versions # Use these Java versions
java: [ java: [
21, # Minimum supported by Minecraft 17, # Minimum supported by Minecraft
] ]
# and run on both Linux and Windows # and run on both Linux and Windows
os: [ubuntu-20.04, windows-latest] os: [ubuntu-20.04, windows-latest]
@ -32,8 +32,8 @@ jobs:
- name: build - name: build
run: ./gradlew build run: ./gradlew build
- name: capture build artifacts - name: capture build artifacts
if: ${{ runner.os == 'Linux' }} if: ${{ runner.os == 'Linux' && matrix.java == '16' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: Artifacts name: Artifacts
path: build/libs/ path: build/libs/

View File

@ -2,17 +2,13 @@
# Save Coordinates Fabric Mod # Save Coordinates Fabric Mod
<img src = "https://img.shields.io/github/v/release/cool-mist/SaveCoordinates?style=flat-square" /> <img src = "https://img.shields.io/github/v/release/cool-mist/SaveCoordinates?style=flat-square" /> <a href = "https://www.curseforge.com/minecraft/mc-mods/savecoordinates/files"><img src = "http://cf.way2muchnoise.eu/versions/savecoordinates.svg"/> </a>
<a href = "https://www.curseforge.com/minecraft/mc-mods/savecoordinates/files"><img src = "http://cf.way2muchnoise.eu/versions/savecoordinates.svg"/> </a>
## Dependencies ## Dependencies
This mod|Minecraft|[Fabric API](https://www.curseforge.com/minecraft/mc-mods/fabric-api/files)|[Mod Menu](https://www.curseforge.com/minecraft/mc-mods/modmenu/files) (optional) This mod|Minecraft|[Fabric API](https://www.curseforge.com/minecraft/mc-mods/fabric-api/files)|[Mod Menu](https://www.curseforge.com/minecraft/mc-mods/modmenu/files) (optional)
--|--|--|-- --|--|--|--
**1.21.4-1.5.0**|**1.21.5+**|*0.119.2+1.21.4**|**13.0.3** **1.18.1-1.3.0**|1.18.x|0.44.0+1.18|3.0.0
1.20.1-1.4.1|1.20.1+|0.85.0+1.20.1|7.1.0
1.19.2-1.3.1|1.19.2+|0.60.0+1.19.2|4.1.0
1.18.1-1.3.0|1.18.x|0.44.0+1.18|3.0.0
1.17.1-1.2.1|1.17.1|0.41.0+1.17|2.0.14 1.17.1-1.2.1|1.17.1|0.41.0+1.17|2.0.14
1.17-1.1.1 |1.17.1|0.34.9+1.17+|2.0.2 1.17-1.1.1 |1.17.1|0.34.9+1.17+|2.0.2
1.17-1.1.1 |1.17|0.34.9+1.17+|2.0.0-beta.7+ 1.17-1.1.1 |1.17|0.34.9+1.17+|2.0.0-beta.7+
@ -51,3 +47,7 @@ This mod|Minecraft|[Fabric API](https://www.curseforge.com/minecraft/mc-mods/fab
- This is reachable through mod menu as well when available. - This is reachable through mod menu as well when available.
<hr/> <hr/>
## Discord
https://discord.gg/9xnv2gQbJt

View File

@ -1,21 +1,21 @@
plugins { plugins {
id 'fabric-loom' version '1.10-SNAPSHOT' id 'fabric-loom' version '0.10-SNAPSHOT'
id 'maven-publish' id 'maven-publish'
} }
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
archivesBaseName = project.archives_base_name
version = project.mod_version version = project.mod_version
group = project.maven_group group = project.maven_group
base {
archivesName = project.archives_base_name
}
repositories { repositories {
maven { maven {
name = "CottonMC" name = "CottonMC"
url = "https://server.bbkr.space/artifactory/libs-release" url = "https://server.bbkr.space/artifactory/libs-release"
} }
maven { maven {
name = "TerraformersMC" name = "TerraformersMC"
url = "https://maven.terraformersmc.com/releases" url = "https://maven.terraformersmc.com/releases"
@ -39,40 +39,37 @@ processResources {
filesMatching("fabric.mod.json") { filesMatching("fabric.mod.json") {
expand "version": project.version expand "version": project.version
} }
exclude("**/icon.pdn") exclude("**/icon.pdn")
exclude("**/icon400.png") exclude("**/icon400.png")
} }
test {
useJUnit()
maxHeapSize = '1G'
}
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is // ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly // this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too. // If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8" it.options.encoding = "UTF-8"
it.options.release = 21 // Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
} }
java { java {
withSourcesJar() withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
} }
jar { jar {
inputs.property "archivesName", project.base.archivesName
from("LICENSE") { from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"} rename { "${it}_${project.archivesBaseName}"}
} }
} }
test {
useJUnit()
maxHeapSize = '1G'
}
publishing { publishing {
publications { publications {

View File

@ -1,17 +1,23 @@
# Done to increase the memory available to gradle. # Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G org.gradle.jvmargs=-Xmx1G
mod_version = 1.21.4-1.5.0 # Fabric Properties
maven_group = me.neophyte.mods.savecoords # check these on https://fabricmc.net/use
archives_base_name = save-coordinates minecraft_version=1.18.1
yarn_mappings=1.18.1+build.1
loader_version=0.12.12
# Lookup versions from https://fabricmc.net/develop/ # Mod Properties
minecraft_version=1.21.4 mod_version = 1.18.1-1.3.0
yarn_mappings=1.21.4+build.8 maven_group = me.neophyte.mods.savecoords
loader_version=0.16.10 archives_base_name = save-coordinates
fabric_version=0.119.2+1.21.4
# https://github.com/CottonMC/LibGui/wiki/Setup # Dependencies
libgui_version=12.0.1+1.21.2 # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
# https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu/ fabric_version=0.44.0+1.18
modmenu_version=13.0.3
# https://github.com/CottonMC/LibGui/wiki/Setup
libgui_version=5.1.0+1.18
#https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu/
modmenu_version=3.0.0

Binary file not shown.

View File

@ -1,7 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

284
gradlew vendored
View File

@ -1,7 +1,7 @@
#!/bin/sh #!/usr/bin/env sh
# #
# Copyright © 2015-2021 the original authors. # Copyright 2015 the original author or authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -15,103 +15,69 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# ##
# Gradle start up script for POSIX generated by Gradle. ## Gradle start up script for UN*X
# ##
# 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 # Attempt to set APP_HOME
# Resolve links: $0 may be a link # Resolve links: $0 may be a link
app_path=$0 PRG="$0"
# Need this for relative symlinks.
# Need this for daisy-chained symlinks. while [ -h "$PRG" ] ; do
while ls=`ls -ld "$PRG"`
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path link=`expr "$ls" : '.*-> \(.*\)$'`
[ -h "$app_path" ] if expr "$link" : '/.*' > /dev/null; then
do PRG="$link"
ls=$( ls -ld "$app_path" ) else
link=${ls#*' -> '} PRG=`dirname "$PRG"`"/$link"
case $link in #( fi
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
# This is normally unused APP_NAME="Gradle"
# shellcheck disable=SC2034 APP_BASE_NAME=`basename "$0"`
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD="maximum"
warn () { warn () {
echo "$*" echo "$*"
} >&2 }
die () { die () {
echo echo
echo "$*" echo "$*"
echo echo
exit 1 exit 1
} >&2 }
# OS specific support (must be 'true' or 'false'). # OS specific support (must be 'true' or 'false').
cygwin=false cygwin=false
msys=false msys=false
darwin=false darwin=false
nonstop=false nonstop=false
case "$( uname )" in #( case "`uname`" in
CYGWIN* ) cygwin=true ;; #( CYGWIN* )
Darwin* ) darwin=true ;; #( cygwin=true
MSYS* | MINGW* ) msys=true ;; #( ;;
NONSTOP* ) nonstop=true ;; Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@ -121,9 +87,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables # IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java JAVACMD="$JAVA_HOME/jre/sh/java"
else else
JAVACMD=$JAVA_HOME/bin/java JAVACMD="$JAVA_HOME/bin/java"
fi fi
if [ ! -x "$JAVACMD" ] ; then if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@ -132,120 +98,88 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
else else
JAVACMD=java JAVACMD="java"
if ! command -v java >/dev/null 2>&1 which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
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 Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
case $MAX_FD in #( MAX_FD_LIMIT=`ulimit -H -n`
max*) if [ $? -eq 0 ] ; then
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
# shellcheck disable=SC2039,SC3045 MAX_FD="$MAX_FD_LIMIT"
MAX_FD=$( ulimit -H -n ) || fi
warn "Could not query maximum file descriptor limit" ulimit -n $MAX_FD
esac if [ $? -ne 0 ] ; then
case $MAX_FD in #( warn "Could not set maximum file descriptor limit: $MAX_FD"
'' | soft) :;; #( fi
*) else
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
# shellcheck disable=SC2039,SC3045 fi
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi fi
# Collect all arguments for the java command, stacking in reverse order: # For Darwin, add options to specify how the application appears in the dock
# * args from the command line if $darwin; then
# * the main class name GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
# * -classpath fi
# * -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 # For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=$( cygpath --unix "$JAVACMD" ) JAVACMD=`cygpath --unix "$JAVACMD"`
# Now convert the arguments - kludge to limit ourselves to /bin/sh # We build the pattern for arguments to be converted via cygpath
for arg do ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
if SEP=""
case $arg in #( for dir in $ROOTDIRSRAW ; do
-*) false ;; # don't mess with options #( ROOTDIRS="$ROOTDIRS$SEP$dir"
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath SEP="|"
[ -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 done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Collect all arguments for the java command, following the shell quoting and substitution rules
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# 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" "$@" exec "$JAVACMD" "$@"

View File

@ -5,7 +5,7 @@ import me.neophyte.mods.savecoords.gui.impl.DIContainer;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text; import net.minecraft.text.TranslatableText;
public class SaveCoordinatesClient implements ClientModInitializer { public class SaveCoordinatesClient implements ClientModInitializer {
@ -35,7 +35,7 @@ public class SaveCoordinatesClient implements ClientModInitializer {
translationKey = TranslationKeys.TOOLTIP_PING_ENABLED; translationKey = TranslationKeys.TOOLTIP_PING_ENABLED;
} }
MinecraftClient.getInstance().player.sendMessage(Text.translatable(translationKey), true); MinecraftClient.getInstance().player.sendMessage(new TranslatableText(translationKey), true);
} }
while(pingKeyBinding.wasPressed()) { while(pingKeyBinding.wasPressed()) {

View File

@ -15,7 +15,9 @@ import me.neophyte.mods.savecoords.IKeyBinds.IKeyBinding;
import me.neophyte.mods.savecoords.gui.IRootPanel; import me.neophyte.mods.savecoords.gui.IRootPanel;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.InputUtil.Type; import net.minecraft.client.util.InputUtil.Type;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
// TODO: // TODO:
// Clean the mess below on order of event handling // Clean the mess below on order of event handling
@ -31,9 +33,9 @@ class ConfigViewHandler extends ViewHandlerBase<List<IKeyBinding>> {
private ConfigListPanel listPanel; private ConfigListPanel listPanel;
public ConfigViewHandler() { public ConfigViewHandler() {
this.saveButton = new WButton(Text.translatable(TranslationKeys.MENU_SAVE)); this.saveButton = new WButton(new TranslatableText(TranslationKeys.MENU_SAVE));
this.backButton = new WButton(Text.translatable(TranslationKeys.MENU_BACK)); this.backButton = new WButton(new TranslatableText(TranslationKeys.MENU_BACK));
this.resetButton = new WButton(Text.translatable(TranslationKeys.MENU_RESET)); this.resetButton = new WButton(new TranslatableText(TranslationKeys.MENU_RESET));
} }
@Override @Override
@ -215,9 +217,9 @@ class ConfigViewHandler extends ViewHandlerBase<List<IKeyBinding>> {
private int code; private int code;
ConfigItemPanel() { ConfigItemPanel() {
this.configLabel = new WLabel(Text.of("")); this.configLabel = new WLabel("");
this.configButton = new WButton(); this.configButton = new WButton();
this.resetButton = new WButton(Text.translatable(TranslationKeys.MENU_RESET)); this.resetButton = new WButton(new TranslatableText(TranslationKeys.MENU_RESET));
} }
void setInitialConfig(IKeyBinding config) { void setInitialConfig(IKeyBinding config) {
@ -275,7 +277,7 @@ class ConfigViewHandler extends ViewHandlerBase<List<IKeyBinding>> {
private void updateWidgetData(Type type, int code) { private void updateWidgetData(Type type, int code) {
if(focussing) { if(focussing) {
this.configButton.setLabel(Text.of("_")); this.configButton.setLabel(new LiteralText("_"));
return; return;
} }

View File

@ -6,7 +6,7 @@ import me.neophyte.mods.savecoords.IFileStore;
import me.neophyte.mods.savecoords.TranslationKeys; import me.neophyte.mods.savecoords.TranslationKeys;
import me.neophyte.mods.savecoords.model.PlayerRawPosition; import me.neophyte.mods.savecoords.model.PlayerRawPosition;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text; import net.minecraft.text.TranslatableText;
public class CurrentPositionPingOperation extends PingPositionOperation{ public class CurrentPositionPingOperation extends PingPositionOperation{
@ -28,7 +28,7 @@ public class CurrentPositionPingOperation extends PingPositionOperation{
if (enabled) { if (enabled) {
super.executeOperation(fileStore, position); super.executeOperation(fileStore, position);
} else { } else {
MinecraftClient.getInstance().player.sendMessage(Text.translatable(TranslationKeys.TOOLTIP_PING_LOCK), MinecraftClient.getInstance().player.sendMessage(new TranslatableText(TranslationKeys.TOOLTIP_PING_LOCK),
true); true);
} }
} }

View File

@ -16,7 +16,8 @@ import me.neophyte.mods.savecoords.model.PlayerPosition;
import me.neophyte.mods.savecoords.model.PlayerRawPosition; import me.neophyte.mods.savecoords.model.PlayerRawPosition;
import me.neophyte.mods.savecoords.model.PositionMetadata; import me.neophyte.mods.savecoords.model.PositionMetadata;
import me.neophyte.mods.savecoords.util.ResourceUtils; import me.neophyte.mods.savecoords.util.ResourceUtils;
import net.minecraft.text.Text; import net.minecraft.text.LiteralText;
import net.minecraft.text.TranslatableText;
class DefaultViewHandler extends ViewHandlerBase<PlayerPosition> { class DefaultViewHandler extends ViewHandlerBase<PlayerPosition> {
@ -172,7 +173,7 @@ class DefaultViewHandler extends ViewHandlerBase<PlayerPosition> {
} }
private WWidget CreateLabelForCoordinate(String label) { private WWidget CreateLabelForCoordinate(String label) {
WButton labelButton = new WButton(Text.of(label)); WButton labelButton = new WButton(new LiteralText(label));
labelButton.setEnabled(false); labelButton.setEnabled(false);
return labelButton; return labelButton;
} }
@ -186,7 +187,7 @@ class DefaultViewHandler extends ViewHandlerBase<PlayerPosition> {
} }
private WTextField CreateLocationField(PlayerPosition existingPosition) { private WTextField CreateLocationField(PlayerPosition existingPosition) {
WTextField location = new WTextField(Text.translatable(TranslationKeys.MENU_LOCATION)); WTextField location = new WTextField(new TranslatableText(TranslationKeys.MENU_LOCATION));
if (existingPosition != null) { if (existingPosition != null) {
location.setText(existingPosition.getLocationName()); location.setText(existingPosition.getLocationName());
@ -198,7 +199,7 @@ class DefaultViewHandler extends ViewHandlerBase<PlayerPosition> {
} }
private WTextField CreateNotesField(PlayerPosition existingPosition) { private WTextField CreateNotesField(PlayerPosition existingPosition) {
WTextField notes = new WTextField(Text.translatable(TranslationKeys.MENU_NOTES)); WTextField notes = new WTextField(new TranslatableText(TranslationKeys.MENU_NOTES));
if (existingPosition != null && existingPosition.getPositionMetadata() != null) { if (existingPosition != null && existingPosition.getPositionMetadata() != null) {
notes.setText(existingPosition.getPositionMetadata().getNotes()); notes.setText(existingPosition.getPositionMetadata().getNotes());
@ -208,7 +209,7 @@ class DefaultViewHandler extends ViewHandlerBase<PlayerPosition> {
} }
private WTextField CreateWorldField(String defaultWorld) { private WTextField CreateWorldField(String defaultWorld) {
WTextField world = new WTextField(Text.translatable(TranslationKeys.MENU_WORLD_NAME)); WTextField world = new WTextField(new TranslatableText(TranslationKeys.MENU_WORLD_NAME));
world.setMaxLength(7); world.setMaxLength(7);
world.setText(defaultWorld); world.setText(defaultWorld);
return world; return world;
@ -221,6 +222,6 @@ class DefaultViewHandler extends ViewHandlerBase<PlayerPosition> {
} }
private WButton CreateButton(String translationKey) { private WButton CreateButton(String translationKey) {
return new WButton(Text.translatable(translationKey)); return new WButton(new TranslatableText(translationKey));
} }
} }

View File

@ -6,7 +6,7 @@ import me.neophyte.mods.savecoords.IDimensionAware;
import me.neophyte.mods.savecoords.IDimensionAware.IDimension; import me.neophyte.mods.savecoords.IDimensionAware.IDimension;
import me.neophyte.mods.savecoords.model.PlayerRawPosition; import me.neophyte.mods.savecoords.model.PlayerRawPosition;
import me.neophyte.mods.savecoords.util.PartialCircularList; import me.neophyte.mods.savecoords.util.PartialCircularList;
import net.minecraft.text.Text; import net.minecraft.text.LiteralText;
public class DimensionButton extends WButton { public class DimensionButton extends WButton {
@ -27,13 +27,13 @@ public class DimensionButton extends WButton {
IDimension currentDimension = allDimensions.current(); IDimension currentDimension = allDimensions.current();
sprite.setImage(currentDimension.getSpriteIdentifier()); sprite.setImage(currentDimension.getSpriteIdentifier());
setLabel(Text.of(currentDimension.getName())); setLabel(new LiteralText(currentDimension.getName()));
setOnClick(() -> { setOnClick(() -> {
allDimensions.next(); allDimensions.next();
IDimension current = getDimension(); IDimension current = getDimension();
sprite.setImage(current.getSpriteIdentifier()); sprite.setImage(current.getSpriteIdentifier());
setLabel(Text.of(current.getName())); setLabel(new LiteralText(current.getName()));
}); });
} }

View File

@ -19,7 +19,8 @@ import me.neophyte.mods.savecoords.gui.IRootPanel;
import me.neophyte.mods.savecoords.model.PlayerPosition; import me.neophyte.mods.savecoords.model.PlayerPosition;
import me.neophyte.mods.savecoords.model.PlayerRawPosition; import me.neophyte.mods.savecoords.model.PlayerRawPosition;
import me.neophyte.mods.savecoords.util.ResourceUtils; import me.neophyte.mods.savecoords.util.ResourceUtils;
import net.minecraft.text.Text; import net.minecraft.text.LiteralText;
import net.minecraft.text.TranslatableText;
class ListViewHandler extends ViewHandlerBase<Void> { class ListViewHandler extends ViewHandlerBase<Void> {
@ -57,7 +58,7 @@ class ListViewHandler extends ViewHandlerBase<Void> {
} }
private WButton createBackButton() { private WButton createBackButton() {
return new WButton(Text.translatable(TranslationKeys.MENU_BACK)); return new WButton(new TranslatableText(TranslationKeys.MENU_BACK));
} }
private WListPanel<PlayerPosition, CoordinatesListItemPanel> createListPanel(List<PlayerPosition> positions) { private WListPanel<PlayerPosition, CoordinatesListItemPanel> createListPanel(List<PlayerPosition> positions) {
@ -121,14 +122,14 @@ class ListViewHandler extends ViewHandlerBase<Void> {
this.netherCalculator = netherCalculator; this.netherCalculator = netherCalculator;
this.coordinateConvertState = true; this.coordinateConvertState = true;
this.coordinates = new WLabel(Text.of("")); this.coordinates = new WLabel("");
this.location = new WLabel(Text.of("")); this.location = new WLabel("");
this.world = new WLabel(Text.of("")); this.world = new WLabel("");
this.icon = new WSprite(ResourceUtils.getIdentifier("close")); this.icon = new WSprite(ResourceUtils.getIdentifier("close"));
this.deleteButton = createDeleteButton(); this.deleteButton = createDeleteButton();
this.detailButton = new WButton(Text.of("")); this.detailButton = new WButton(new LiteralText(""));
this.pingButton = new WButton(Text.of("")); this.pingButton = new WButton(new LiteralText(""));
this.convertButton = new WButton(Text.of("")); this.convertButton = new WButton(new LiteralText(""));
this.pingButton.setIcon(ResourceUtils.createPingIcon()); this.pingButton.setIcon(ResourceUtils.createPingIcon());
this.detailButton.setIcon(ResourceUtils.createDetailsIcon()); this.detailButton.setIcon(ResourceUtils.createDetailsIcon());
@ -156,17 +157,17 @@ class ListViewHandler extends ViewHandlerBase<Void> {
} }
private WButton createDeleteButton() { private WButton createDeleteButton() {
TexturedButton button = new TexturedButton(Text.of("x")); TexturedButton button = new TexturedButton(new LiteralText("x"));
button.setTexture(ResourceUtils.getIdentifier("close")); button.setTexture(ResourceUtils.getIdentifier("close"));
return button; return button;
} }
void setPosition(PlayerPosition position) { void setPosition(PlayerPosition position) {
this.location.setText(Text.of(position.getLocationName())); this.location.setText(new LiteralText(position.getLocationName()));
this.location.setColor(0x3939ac); this.location.setColor(0x3939ac);
if (position.getPositionMetadata() != null) { if (position.getPositionMetadata() != null) {
this.world.setText(Text.of("[" + position.getPositionMetadata().getWorldName() + "]")); this.world.setText(new LiteralText("[" + position.getPositionMetadata().getWorldName() + "]"));
this.world.setColor(0xb80000); this.world.setColor(0xb80000);
} }
@ -182,7 +183,7 @@ class ListViewHandler extends ViewHandlerBase<Void> {
this.icon.setImage(ResourceUtils.getIdentifier(position.getWorldDimension())); this.icon.setImage(ResourceUtils.getIdentifier(position.getWorldDimension()));
this.coordinates this.coordinates
.setText(Text.of(position.getX() + ", " + position.getY() + ", " + position.getZ())); .setText(new LiteralText(position.getX() + ", " + position.getY() + ", " + position.getZ()));
this.convertButton.setOnClick(() -> setRawPosition(netherCalculator.convert(position))); this.convertButton.setOnClick(() -> setRawPosition(netherCalculator.convert(position)));
this.pingButton.setOnClick(() -> onPing.accept(position)); this.pingButton.setOnClick(() -> onPing.accept(position));
this.coordinateConvertState = !coordinateConvertState; this.coordinateConvertState = !coordinateConvertState;

View File

@ -5,7 +5,6 @@ import java.util.function.Supplier;
import me.neophyte.mods.savecoords.IFileStore; import me.neophyte.mods.savecoords.IFileStore;
import me.neophyte.mods.savecoords.model.PlayerRawPosition; import me.neophyte.mods.savecoords.model.PlayerRawPosition;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;
class PingPositionOperation extends ViewOperationBase<PlayerRawPosition> { class PingPositionOperation extends ViewOperationBase<PlayerRawPosition> {
@ -16,6 +15,6 @@ class PingPositionOperation extends ViewOperationBase<PlayerRawPosition> {
@SuppressWarnings("resource") @SuppressWarnings("resource")
@Override @Override
protected void executeOperation(IFileStore fileStore, PlayerRawPosition position) throws Exception { protected void executeOperation(IFileStore fileStore, PlayerRawPosition position) throws Exception {
MinecraftClient.getInstance().player.sendMessage(Text.of(position.toString()), true); MinecraftClient.getInstance().player.sendChatMessage(position.toString());
} }
} }

View File

@ -3,7 +3,6 @@ package me.neophyte.mods.savecoords.gui.impl;
import io.github.cottonmc.cotton.gui.client.ScreenDrawing; import io.github.cottonmc.cotton.gui.client.ScreenDrawing;
import io.github.cottonmc.cotton.gui.widget.WButton; import io.github.cottonmc.cotton.gui.widget.WButton;
import io.github.cottonmc.cotton.gui.widget.data.HorizontalAlignment; import io.github.cottonmc.cotton.gui.widget.data.HorizontalAlignment;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
@ -21,7 +20,7 @@ public class TexturedButton extends WButton {
} }
@Override @Override
public void paint(DrawContext matrices, int x, int y, int mouseX, int mouseY) { public void paint(MatrixStack matrices, int x, int y, int mouseX, int mouseY) {
super.paint(matrices, x, y, mouseX, mouseY); super.paint(matrices, x, y, mouseX, mouseY);
if (texture != null) { if (texture != null) {

View File

@ -18,6 +18,7 @@ import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil; import net.minecraft.client.util.InputUtil;
import net.minecraft.client.util.InputUtil.Type; import net.minecraft.client.util.InputUtil.Type;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
class KeyBinds implements IKeyBinds { class KeyBinds implements IKeyBinds {
@ -119,7 +120,7 @@ class KeyBinds implements IKeyBinds {
@Override @Override
public Text getNameLocalizedText() { public Text getNameLocalizedText() {
return Text.translatable(getTranslationKey()); return new TranslatableText(getTranslationKey());
} }
@Override @Override

View File

@ -39,6 +39,6 @@ public class IdentifiersCache {
} }
private static Identifier createIdentifier(String file) { private static Identifier createIdentifier(String file) {
return Identifier.of("savecoords", "textures/gui/" + file + ".png"); return new Identifier("savecoords", "textures/gui/" + file + ".png");
} }
} }

View File

@ -10,7 +10,7 @@
"contact": { "contact": {
"homepage": "https://github.com/cool-mist/SaveCoordinates", "homepage": "https://github.com/cool-mist/SaveCoordinates",
"sources": "https://github.com/cool-mist/SaveCoordinates", "sources": "https://github.com/cool-mist/SaveCoordinates",
"issues": "https://github.com/cool-mist/SaveCoordinates/issues" "issues" : "https://github.com/cool-mist/SaveCoordinates/issues"
}, },
"license": "LGPLv3", "license": "LGPLv3",
"icon": "assets/savecoords/icon.png", "icon": "assets/savecoords/icon.png",
@ -25,12 +25,12 @@
}, },
"mixins": [], "mixins": [],
"depends": { "depends": {
"fabricloader": ">=0.14.9", "fabricloader": ">=0.11.3",
"fabric": "*", "fabric": "*",
"minecraft": "1.21.x", "minecraft": "1.18.x",
"java": ">=21" "java": ">=17"
}, },
"suggests": { "suggests": {
"another-mod": "modmenu" "another-mod": "modmenu"
} }
} }