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

View File

@ -2,13 +2,17 @@
# 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
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.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+
@ -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.
<hr/>
## Discord
https://discord.gg/9xnv2gQbJt

View File

@ -1,21 +1,21 @@
plugins {
id 'fabric-loom' version '0.10-SNAPSHOT'
id 'fabric-loom' version '1.10-SNAPSHOT'
id 'maven-publish'
}
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
base {
archivesName = project.archives_base_name
}
repositories {
maven {
name = "CottonMC"
url = "https://server.bbkr.space/artifactory/libs-release"
}
maven {
name = "TerraformersMC"
url = "https://maven.terraformersmc.com/releases"
@ -39,37 +39,40 @@ processResources {
filesMatching("fabric.mod.json") {
expand "version": project.version
}
exclude("**/icon.pdn")
exclude("**/icon400.png")
}
test {
useJUnit()
maxHeapSize = '1G'
}
tasks.withType(JavaCompile).configureEach {
// 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
// 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.
it.options.encoding = "UTF-8"
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
it.options.release = 21
}
java {
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
jar {
inputs.property "archivesName", project.base.archivesName
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}
test {
useJUnit()
maxHeapSize = '1G'
}
publishing {
publications {

View File

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

Binary file not shown.

View File

@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
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
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");
# 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
# 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
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
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
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# 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"'
# 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\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
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
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
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
@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
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"
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
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."
fi
else
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.
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" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# 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" ;;
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
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# 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.
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# 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" "$@"

View File

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

View File

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

View File

@ -6,7 +6,7 @@ import me.neophyte.mods.savecoords.IFileStore;
import me.neophyte.mods.savecoords.TranslationKeys;
import me.neophyte.mods.savecoords.model.PlayerRawPosition;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
public class CurrentPositionPingOperation extends PingPositionOperation{
@ -28,7 +28,7 @@ public class CurrentPositionPingOperation extends PingPositionOperation{
if (enabled) {
super.executeOperation(fileStore, position);
} else {
MinecraftClient.getInstance().player.sendMessage(new TranslatableText(TranslationKeys.TOOLTIP_PING_LOCK),
MinecraftClient.getInstance().player.sendMessage(Text.translatable(TranslationKeys.TOOLTIP_PING_LOCK),
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.PositionMetadata;
import me.neophyte.mods.savecoords.util.ResourceUtils;
import net.minecraft.text.LiteralText;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
class DefaultViewHandler extends ViewHandlerBase<PlayerPosition> {
@ -173,7 +172,7 @@ class DefaultViewHandler extends ViewHandlerBase<PlayerPosition> {
}
private WWidget CreateLabelForCoordinate(String label) {
WButton labelButton = new WButton(new LiteralText(label));
WButton labelButton = new WButton(Text.of(label));
labelButton.setEnabled(false);
return labelButton;
}
@ -187,7 +186,7 @@ class DefaultViewHandler extends ViewHandlerBase<PlayerPosition> {
}
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) {
location.setText(existingPosition.getLocationName());
@ -199,7 +198,7 @@ class DefaultViewHandler extends ViewHandlerBase<PlayerPosition> {
}
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) {
notes.setText(existingPosition.getPositionMetadata().getNotes());
@ -209,7 +208,7 @@ class DefaultViewHandler extends ViewHandlerBase<PlayerPosition> {
}
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.setText(defaultWorld);
return world;
@ -222,6 +221,6 @@ class DefaultViewHandler extends ViewHandlerBase<PlayerPosition> {
}
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.model.PlayerRawPosition;
import me.neophyte.mods.savecoords.util.PartialCircularList;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
public class DimensionButton extends WButton {
@ -27,13 +27,13 @@ public class DimensionButton extends WButton {
IDimension currentDimension = allDimensions.current();
sprite.setImage(currentDimension.getSpriteIdentifier());
setLabel(new LiteralText(currentDimension.getName()));
setLabel(Text.of(currentDimension.getName()));
setOnClick(() -> {
allDimensions.next();
IDimension current = getDimension();
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.PlayerRawPosition;
import me.neophyte.mods.savecoords.util.ResourceUtils;
import net.minecraft.text.LiteralText;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
class ListViewHandler extends ViewHandlerBase<Void> {
@ -58,7 +57,7 @@ class ListViewHandler extends ViewHandlerBase<Void> {
}
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) {
@ -122,14 +121,14 @@ class ListViewHandler extends ViewHandlerBase<Void> {
this.netherCalculator = netherCalculator;
this.coordinateConvertState = true;
this.coordinates = new WLabel("");
this.location = new WLabel("");
this.world = new WLabel("");
this.coordinates = new WLabel(Text.of(""));
this.location = new WLabel(Text.of(""));
this.world = new WLabel(Text.of(""));
this.icon = new WSprite(ResourceUtils.getIdentifier("close"));
this.deleteButton = createDeleteButton();
this.detailButton = new WButton(new LiteralText(""));
this.pingButton = new WButton(new LiteralText(""));
this.convertButton = new WButton(new LiteralText(""));
this.detailButton = new WButton(Text.of(""));
this.pingButton = new WButton(Text.of(""));
this.convertButton = new WButton(Text.of(""));
this.pingButton.setIcon(ResourceUtils.createPingIcon());
this.detailButton.setIcon(ResourceUtils.createDetailsIcon());
@ -157,17 +156,17 @@ class ListViewHandler extends ViewHandlerBase<Void> {
}
private WButton createDeleteButton() {
TexturedButton button = new TexturedButton(new LiteralText("x"));
TexturedButton button = new TexturedButton(Text.of("x"));
button.setTexture(ResourceUtils.getIdentifier("close"));
return button;
}
void setPosition(PlayerPosition position) {
this.location.setText(new LiteralText(position.getLocationName()));
this.location.setText(Text.of(position.getLocationName()));
this.location.setColor(0x3939ac);
if (position.getPositionMetadata() != null) {
this.world.setText(new LiteralText("[" + position.getPositionMetadata().getWorldName() + "]"));
this.world.setText(Text.of("[" + position.getPositionMetadata().getWorldName() + "]"));
this.world.setColor(0xb80000);
}
@ -183,7 +182,7 @@ class ListViewHandler extends ViewHandlerBase<Void> {
this.icon.setImage(ResourceUtils.getIdentifier(position.getWorldDimension()));
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.pingButton.setOnClick(() -> onPing.accept(position));
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.model.PlayerRawPosition;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;
class PingPositionOperation extends ViewOperationBase<PlayerRawPosition> {
@ -15,6 +16,6 @@ class PingPositionOperation extends ViewOperationBase<PlayerRawPosition> {
@SuppressWarnings("resource")
@Override
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.widget.WButton;
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.text.Text;
import net.minecraft.util.Identifier;
@ -20,7 +21,7 @@ public class TexturedButton extends WButton {
}
@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);
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.Type;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
class KeyBinds implements IKeyBinds {
@ -120,7 +119,7 @@ class KeyBinds implements IKeyBinds {
@Override
public Text getNameLocalizedText() {
return new TranslatableText(getTranslationKey());
return Text.translatable(getTranslationKey());
}
@Override

View File

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

View File

@ -10,7 +10,7 @@
"contact": {
"homepage": "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",
"icon": "assets/savecoords/icon.png",
@ -25,12 +25,12 @@
},
"mixins": [],
"depends": {
"fabricloader": ">=0.11.3",
"fabricloader": ">=0.14.9",
"fabric": "*",
"minecraft": "1.18.x",
"java": ">=17"
"minecraft": "1.21.x",
"java": ">=21"
},
"suggests": {
"another-mod": "modmenu"
}
}
}