Compare commits

..

15 Commits

Author SHA1 Message Date
bd1f4889bc use artifacts v4
Some checks failed
build / build (21, ubuntu-20.04) (push) Has been cancelled
build / build (21, windows-latest) (push) Has been cancelled
2025-03-23 00:00:35 +05:30
09f697322e Fix workflow 2025-03-22 23:56:18 +05:30
e4beb77080 To 1.21.5 2025-03-22 23:52:46 +05:30
d3d4d6f524 Update readme 2023-07-09 19:11:17 +05:30
6de4a49d20 Migrate to 1.20.1 2023-07-09 19:05:01 +05:30
6138a77cd2
Update required versions for 1.19.2 2022-11-13 16:01:54 +05:30
a458f0546d Update new Text() to Text.of or Text.translatable 2022-11-13 15:47:44 +05:30
da3dd53e91 Initial migrate to 1.19 2022-11-13 14:48:18 +05:30
6e86a669c6
Merge pull request #4 from cool-mist/dev/1.17.x
Port to 1.18
2021-12-17 17:00:45 +05:30
61e59755db
Merge branch 'dev/1.18.x' into dev/1.17.x 2021-12-17 17:00:08 +05:30
821875d5fd Update package name 2021-12-17 16:06:40 +05:30
de4c391e18 Make ping position text clearer 2021-12-17 16:06:40 +05:30
c230057dfc Add keybind to directly list coordinates, Add coordinate convert assets 2021-12-17 16:06:40 +05:30
8d12a99fd7 Add nether coordinate calculator 2021-12-17 16:06:40 +05:30
509ede5424 Fix backward compatibility while printing dimension sprite in list coordinates view 2021-12-17 16:06:40 +05:30
18 changed files with 265 additions and 203 deletions

View File

@ -12,7 +12,7 @@ jobs:
matrix: matrix:
# Use these Java versions # Use these Java versions
java: [ java: [
17, # Minimum supported by Minecraft 21, # 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' && matrix.java == '16' }} # Only upload artifacts built from latest java on one OS if: ${{ runner.os == 'Linux' }}
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v4
with: with:
name: Artifacts name: Artifacts
path: build/libs/ path: build/libs/

View File

@ -2,13 +2,17 @@
# Save Coordinates Fabric Mod # Save Coordinates Fabric Mod
<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> <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>
## 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.18.1-1.3.0**|1.18.x|0.44.0+1.18|3.0.0 **1.21.4-1.5.0**|**1.21.5+**|*0.119.2+1.21.4**|**13.0.3**
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+
@ -47,7 +51,3 @@ 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,15 +1,15 @@
plugins { plugins {
id 'fabric-loom' version '0.10-SNAPSHOT' id 'fabric-loom' version '1.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"
@ -44,11 +44,6 @@ processResources {
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
@ -56,20 +51,28 @@ tasks.withType(JavaCompile).configureEach {
// 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"
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17. it.options.release = 21
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,23 +1,17 @@
# Done to increase the memory available to gradle. # Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G org.gradle.jvmargs=-Xmx1G
# Fabric Properties mod_version = 1.21.4-1.5.0
# check these on https://fabricmc.net/use
minecraft_version=1.18.1
yarn_mappings=1.18.1+build.1
loader_version=0.12.12
# Mod Properties
mod_version = 1.18.1-1.3.0
maven_group = me.neophyte.mods.savecoords maven_group = me.neophyte.mods.savecoords
archives_base_name = save-coordinates archives_base_name = save-coordinates
# Dependencies # Lookup versions from https://fabricmc.net/develop/
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api minecraft_version=1.21.4
fabric_version=0.44.0+1.18 yarn_mappings=1.21.4+build.8
loader_version=0.16.10
fabric_version=0.119.2+1.21.4
# https://github.com/CottonMC/LibGui/wiki/Setup # https://github.com/CottonMC/LibGui/wiki/Setup
libgui_version=5.1.0+1.18 libgui_version=12.0.1+1.21.2
# https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu/ # https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu/
modmenu_version=3.0.0 modmenu_version=13.0.3

Binary file not shown.

View File

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

296
gradlew vendored
View File

@ -1,7 +1,7 @@
#!/usr/bin/env sh #!/bin/sh
# #
# Copyright 2015 the original author or authors. # Copyright © 2015-2021 the original 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,69 +15,103 @@
# 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 UN*X # 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 # Attempt to set APP_HOME
# Resolve links: $0 may be a link # Resolve links: $0 may be a link
PRG="$0" app_path=$0
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do # Need this for daisy-chained symlinks.
ls=`ls -ld "$PRG"` while
link=`expr "$ls" : '.*-> \(.*\)$'` APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
if expr "$link" : '/.*' > /dev/null; then [ -h "$app_path" ]
PRG="$link" do
else ls=$( ls -ld "$app_path" )
PRG=`dirname "$PRG"`"/$link" link=${ls#*' -> '}
fi case $link in #(
/*) 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
APP_NAME="Gradle" # This is normally unused
APP_BASE_NAME=`basename "$0"` # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# 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* ) cygwin=true ;; #(
cygwin=true Darwin* ) darwin=true ;; #(
;; MSYS* | MINGW* ) msys=true ;; #(
Darwin* ) NONSTOP* ) nonstop=true ;;
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
@ -87,9 +121,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
@ -98,88 +132,120 @@ 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
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 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 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" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
MAX_FD_LIMIT=`ulimit -H -n` case $MAX_FD in #(
if [ $? -eq 0 ] ; then max*)
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
MAX_FD="$MAX_FD_LIMIT" # shellcheck disable=SC2039,SC3045
fi MAX_FD=$( ulimit -H -n ) ||
ulimit -n $MAX_FD warn "Could not query maximum file descriptor limit"
if [ $? -ne 0 ] ; then esac
warn "Could not set maximum file descriptor limit: $MAX_FD" case $MAX_FD in #(
fi '' | soft) :;; #(
else *)
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
fi # shellcheck disable=SC2039,SC3045
fi ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
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 esac
fi fi
# Escape application args # Collect all arguments for the java command, stacking in reverse order:
save () { # * args from the command line
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done # * the main class name
echo " " # * -classpath
} # * -D...appname settings
APP_ARGS=`save "$@"` # * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules # For Cygwin or MSYS, switch paths to Windows format before running java
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 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" "$@" 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.TranslatableText; import net.minecraft.text.Text;
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(new TranslatableText(translationKey), true); MinecraftClient.getInstance().player.sendMessage(Text.translatable(translationKey), true);
} }
while(pingKeyBinding.wasPressed()) { while(pingKeyBinding.wasPressed()) {

View File

@ -15,9 +15,7 @@ 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
@ -33,9 +31,9 @@ class ConfigViewHandler extends ViewHandlerBase<List<IKeyBinding>> {
private ConfigListPanel listPanel; private ConfigListPanel listPanel;
public ConfigViewHandler() { public ConfigViewHandler() {
this.saveButton = new WButton(new TranslatableText(TranslationKeys.MENU_SAVE)); this.saveButton = new WButton(Text.translatable(TranslationKeys.MENU_SAVE));
this.backButton = new WButton(new TranslatableText(TranslationKeys.MENU_BACK)); this.backButton = new WButton(Text.translatable(TranslationKeys.MENU_BACK));
this.resetButton = new WButton(new TranslatableText(TranslationKeys.MENU_RESET)); this.resetButton = new WButton(Text.translatable(TranslationKeys.MENU_RESET));
} }
@Override @Override
@ -217,9 +215,9 @@ class ConfigViewHandler extends ViewHandlerBase<List<IKeyBinding>> {
private int code; private int code;
ConfigItemPanel() { ConfigItemPanel() {
this.configLabel = new WLabel(""); this.configLabel = new WLabel(Text.of(""));
this.configButton = new WButton(); this.configButton = new WButton();
this.resetButton = new WButton(new TranslatableText(TranslationKeys.MENU_RESET)); this.resetButton = new WButton(Text.translatable(TranslationKeys.MENU_RESET));
} }
void setInitialConfig(IKeyBinding config) { void setInitialConfig(IKeyBinding config) {
@ -277,7 +275,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(new LiteralText("_")); this.configButton.setLabel(Text.of("_"));
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.TranslatableText; import net.minecraft.text.Text;
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(new TranslatableText(TranslationKeys.TOOLTIP_PING_LOCK), MinecraftClient.getInstance().player.sendMessage(Text.translatable(TranslationKeys.TOOLTIP_PING_LOCK),
true); true);
} }
} }

View File

@ -16,8 +16,7 @@ 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.LiteralText; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
class DefaultViewHandler extends ViewHandlerBase<PlayerPosition> { class DefaultViewHandler extends ViewHandlerBase<PlayerPosition> {
@ -173,7 +172,7 @@ class DefaultViewHandler extends ViewHandlerBase<PlayerPosition> {
} }
private WWidget CreateLabelForCoordinate(String label) { private WWidget CreateLabelForCoordinate(String label) {
WButton labelButton = new WButton(new LiteralText(label)); WButton labelButton = new WButton(Text.of(label));
labelButton.setEnabled(false); labelButton.setEnabled(false);
return labelButton; return labelButton;
} }
@ -187,7 +186,7 @@ class DefaultViewHandler extends ViewHandlerBase<PlayerPosition> {
} }
private WTextField CreateLocationField(PlayerPosition existingPosition) { private WTextField CreateLocationField(PlayerPosition existingPosition) {
WTextField location = new WTextField(new TranslatableText(TranslationKeys.MENU_LOCATION)); WTextField location = new WTextField(Text.translatable(TranslationKeys.MENU_LOCATION));
if (existingPosition != null) { if (existingPosition != null) {
location.setText(existingPosition.getLocationName()); location.setText(existingPosition.getLocationName());
@ -199,7 +198,7 @@ class DefaultViewHandler extends ViewHandlerBase<PlayerPosition> {
} }
private WTextField CreateNotesField(PlayerPosition existingPosition) { private WTextField CreateNotesField(PlayerPosition existingPosition) {
WTextField notes = new WTextField(new TranslatableText(TranslationKeys.MENU_NOTES)); WTextField notes = new WTextField(Text.translatable(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());
@ -209,7 +208,7 @@ class DefaultViewHandler extends ViewHandlerBase<PlayerPosition> {
} }
private WTextField CreateWorldField(String defaultWorld) { private WTextField CreateWorldField(String defaultWorld) {
WTextField world = new WTextField(new TranslatableText(TranslationKeys.MENU_WORLD_NAME)); WTextField world = new WTextField(Text.translatable(TranslationKeys.MENU_WORLD_NAME));
world.setMaxLength(7); world.setMaxLength(7);
world.setText(defaultWorld); world.setText(defaultWorld);
return world; return world;
@ -222,6 +221,6 @@ class DefaultViewHandler extends ViewHandlerBase<PlayerPosition> {
} }
private WButton CreateButton(String translationKey) { private WButton CreateButton(String translationKey) {
return new WButton(new TranslatableText(translationKey)); return new WButton(Text.translatable(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.LiteralText; import net.minecraft.text.Text;
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(new LiteralText(currentDimension.getName())); setLabel(Text.of(currentDimension.getName()));
setOnClick(() -> { setOnClick(() -> {
allDimensions.next(); allDimensions.next();
IDimension current = getDimension(); IDimension current = getDimension();
sprite.setImage(current.getSpriteIdentifier()); sprite.setImage(current.getSpriteIdentifier());
setLabel(new LiteralText(current.getName())); setLabel(Text.of(current.getName()));
}); });
} }

View File

@ -19,8 +19,7 @@ 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.LiteralText; import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
class ListViewHandler extends ViewHandlerBase<Void> { class ListViewHandler extends ViewHandlerBase<Void> {
@ -58,7 +57,7 @@ class ListViewHandler extends ViewHandlerBase<Void> {
} }
private WButton createBackButton() { private WButton createBackButton() {
return new WButton(new TranslatableText(TranslationKeys.MENU_BACK)); return new WButton(Text.translatable(TranslationKeys.MENU_BACK));
} }
private WListPanel<PlayerPosition, CoordinatesListItemPanel> createListPanel(List<PlayerPosition> positions) { private WListPanel<PlayerPosition, CoordinatesListItemPanel> createListPanel(List<PlayerPosition> positions) {
@ -122,14 +121,14 @@ class ListViewHandler extends ViewHandlerBase<Void> {
this.netherCalculator = netherCalculator; this.netherCalculator = netherCalculator;
this.coordinateConvertState = true; this.coordinateConvertState = true;
this.coordinates = new WLabel(""); this.coordinates = new WLabel(Text.of(""));
this.location = new WLabel(""); this.location = new WLabel(Text.of(""));
this.world = new WLabel(""); this.world = new WLabel(Text.of(""));
this.icon = new WSprite(ResourceUtils.getIdentifier("close")); this.icon = new WSprite(ResourceUtils.getIdentifier("close"));
this.deleteButton = createDeleteButton(); this.deleteButton = createDeleteButton();
this.detailButton = new WButton(new LiteralText("")); this.detailButton = new WButton(Text.of(""));
this.pingButton = new WButton(new LiteralText("")); this.pingButton = new WButton(Text.of(""));
this.convertButton = new WButton(new LiteralText("")); this.convertButton = new WButton(Text.of(""));
this.pingButton.setIcon(ResourceUtils.createPingIcon()); this.pingButton.setIcon(ResourceUtils.createPingIcon());
this.detailButton.setIcon(ResourceUtils.createDetailsIcon()); this.detailButton.setIcon(ResourceUtils.createDetailsIcon());
@ -157,17 +156,17 @@ class ListViewHandler extends ViewHandlerBase<Void> {
} }
private WButton createDeleteButton() { private WButton createDeleteButton() {
TexturedButton button = new TexturedButton(new LiteralText("x")); TexturedButton button = new TexturedButton(Text.of("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(new LiteralText(position.getLocationName())); this.location.setText(Text.of(position.getLocationName()));
this.location.setColor(0x3939ac); this.location.setColor(0x3939ac);
if (position.getPositionMetadata() != null) { if (position.getPositionMetadata() != null) {
this.world.setText(new LiteralText("[" + position.getPositionMetadata().getWorldName() + "]")); this.world.setText(Text.of("[" + position.getPositionMetadata().getWorldName() + "]"));
this.world.setColor(0xb80000); this.world.setColor(0xb80000);
} }
@ -183,7 +182,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(new LiteralText(position.getX() + ", " + position.getY() + ", " + position.getZ())); .setText(Text.of(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,6 +5,7 @@ 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> {
@ -15,6 +16,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.sendChatMessage(position.toString()); MinecraftClient.getInstance().player.sendMessage(Text.of(position.toString()), true);
} }
} }

View File

@ -3,6 +3,7 @@ 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;
@ -20,7 +21,7 @@ public class TexturedButton extends WButton {
} }
@Override @Override
public void paint(MatrixStack matrices, int x, int y, int mouseX, int mouseY) { public void paint(DrawContext 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,7 +18,6 @@ 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 {
@ -120,7 +119,7 @@ class KeyBinds implements IKeyBinds {
@Override @Override
public Text getNameLocalizedText() { public Text getNameLocalizedText() {
return new TranslatableText(getTranslationKey()); return Text.translatable(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 new Identifier("savecoords", "textures/gui/" + file + ".png"); return Identifier.of("savecoords", "textures/gui/" + file + ".png");
} }
} }

View File

@ -25,10 +25,10 @@
}, },
"mixins": [], "mixins": [],
"depends": { "depends": {
"fabricloader": ">=0.11.3", "fabricloader": ">=0.14.9",
"fabric": "*", "fabric": "*",
"minecraft": "1.18.x", "minecraft": "1.21.x",
"java": ">=17" "java": ">=21"
}, },
"suggests": { "suggests": {
"another-mod": "modmenu" "another-mod": "modmenu"