diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 9fa9abf..211b291 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,22 +1,38 @@
-name: Java CI with Gradle
+name: Build
-on: [ push, pull_request ]
+on:
+ push:
+ branches:
+ - master
+ pull_request:
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+concurrency:
+ group: build-${{ github.ref }}
+ cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
+ timeout-minutes: 15
steps:
- name: Checkout
- uses: actions/checkout@v3.0.1
- - name: Set up JDK 17
- uses: actions/setup-java@v3.1.1
+ uses: actions/checkout@v4
+ - name: Set up JDK 21
+ uses: actions/setup-java@v4
with:
distribution: temurin
- java-version: 17
+ java-version: '21'
+ - name: Set up Gradle
+ uses: gradle/actions/setup-gradle@v4
- name: Build
- run: ./gradlew build
+ run: ./gradlew --no-daemon clean build
- name: Upload artifact
- uses: actions/upload-artifact@v3.0.0
+ uses: actions/upload-artifact@v4
with:
name: framedImage
- path: build/libs/framedimage*.jar
\ No newline at end of file
+ path: build/libs/framedimage*.jar
+ if-no-files-found: error
diff --git a/README.md b/README.md
index ef69923..e7a72e1 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,8 @@
High performance Bukkit/Folia plugin for map-arts.
+Requires Java 21+.
+
Features:
- Performance. The plugin inserts thousands of frames in just a few seconds (during testing, the plugin inserted ~3000 frames in 2 seconds)
diff --git a/build.gradle b/build.gradle
index 60c9059..899c67a 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,10 +1,10 @@
plugins {
id 'java'
- id 'com.github.johnrengelman.shadow' version '7.1.2'
+ id 'com.gradleup.shadow' version '9.3.1'
}
group = 'com.jnngl'
-version = '1.8.0'
+version = '1.8.1'
repositories {
mavenCentral()
@@ -21,14 +21,14 @@ repositories {
dependencies {
implementation 'net.elytrium:elytrium-java-commons:1.0.8'
implementation 'com.jnngl:mapcolor:1.0.1'
- implementation 'org.bstats:bstats-bukkit:3.0.0'
+ implementation 'org.bstats:bstats-bukkit:3.1.0'
- compileOnly 'dev.folia:folia-api:1.19.4-R0.1-SNAPSHOT'
+ compileOnly 'dev.folia:folia-api:1.21.11-R0.1-SNAPSHOT'
- compileOnly 'io.netty:netty-all:4.1.85.Final'
+ compileOnly 'io.netty:netty-all:4.2.10.Final'
}
-def targetJavaVersion = 17
+def targetJavaVersion = 21
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
@@ -47,16 +47,16 @@ tasks.withType(JavaCompile).configureEach {
processResources {
def props = [version: version]
inputs.properties props
- filteringCharset 'UTF-8'
+ filteringCharset = 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
shadowJar {
- getArchiveClassifier() set ''
+ archiveClassifier.set('')
relocate 'org.bstats', 'com.jnngl.framedimage.thirdparty.org.bstats'
}
-assemble.dependsOn shadowJar
\ No newline at end of file
+assemble.dependsOn shadowJar
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 7454180..61285a6 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index ae04661..37f78a6 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
+networkTimeout=10000
+validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index 1b6c787..adff685 100755
--- a/gradlew
+++ b/gradlew
@@ -1,7 +1,7 @@
#!/bin/sh
#
-# Copyright © 2015-2021 the original authors.
+# Copyright © 2015 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,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+# SPDX-License-Identifier: Apache-2.0
+#
##############################################################################
#
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
-# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,13 +82,11 @@ do
esac
done
-APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
-
-APP_NAME="Gradle"
+# This is normally unused
+# 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.
-DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+# 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
@@ -114,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -133,22 +132,29 @@ 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.
+ if ! command -v java >/dev/null 2>&1
+ then
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
+ fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
+ # shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -165,7 +171,6 @@ fi
# 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" )
@@ -193,18 +198,27 @@ if "$cygwin" || "$msys" ; then
done
fi
-# Collect all arguments for the java command;
-# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
-# shell script including quotes and variable substitutions, so put them in
-# double quotes to make sure that they get re-expanded; and
-# * put everything else in single quotes, so that it's not re-expanded.
+
+# 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, 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 \
+ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
+# 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.
diff --git a/gradlew.bat b/gradlew.bat
index 107acd3..e509b2d 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,89 +1,93 @@
-@rem
-@rem Copyright 2015 the original author or authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem You may obtain a copy of the License at
-@rem
-@rem https://www.apache.org/licenses/LICENSE-2.0
-@rem
-@rem Unless required by applicable law or agreed to in writing, software
-@rem distributed under the License is distributed on an "AS IS" BASIS,
-@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@rem See the License for the specific language governing permissions and
-@rem limitations under the License.
-@rem
-
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Resolve any "." and ".." in APP_HOME to make it shorter.
-for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto execute
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto execute
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+@rem SPDX-License-Identifier: Apache-2.0
+@rem
+
+@if "%DEBUG%"=="" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%"=="" set DIRNAME=.
+@rem This is normally unused
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if %ERRORLEVEL% equ 0 goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo. 1>&2
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
+echo. 1>&2
+echo Please set the JAVA_HOME variable in your environment to match the 1>&2
+echo location of your Java installation. 1>&2
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if %ERRORLEVEL% equ 0 goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+set EXIT_CODE=%ERRORLEVEL%
+if %EXIT_CODE% equ 0 set EXIT_CODE=1
+if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
+exit /b %EXIT_CODE%
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/src/main/java/com/jnngl/framedimage/FrameDisplay.java b/src/main/java/com/jnngl/framedimage/FrameDisplay.java
index 7d7199d..67e6789 100644
--- a/src/main/java/com/jnngl/framedimage/FrameDisplay.java
+++ b/src/main/java/com/jnngl/framedimage/FrameDisplay.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/FramedImage.java b/src/main/java/com/jnngl/framedimage/FramedImage.java
index f5fcc3b..5c5a22b 100644
--- a/src/main/java/com/jnngl/framedimage/FramedImage.java
+++ b/src/main/java/com/jnngl/framedimage/FramedImage.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/command/FiCommand.java b/src/main/java/com/jnngl/framedimage/command/FiCommand.java
index 09ad110..4bf2641 100644
--- a/src/main/java/com/jnngl/framedimage/command/FiCommand.java
+++ b/src/main/java/com/jnngl/framedimage/command/FiCommand.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/command/SubCommand.java b/src/main/java/com/jnngl/framedimage/command/SubCommand.java
index 2692d32..838a83e 100644
--- a/src/main/java/com/jnngl/framedimage/command/SubCommand.java
+++ b/src/main/java/com/jnngl/framedimage/command/SubCommand.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/command/SubCommandExecutor.java b/src/main/java/com/jnngl/framedimage/command/SubCommandExecutor.java
index 22960c1..853c5b9 100644
--- a/src/main/java/com/jnngl/framedimage/command/SubCommandExecutor.java
+++ b/src/main/java/com/jnngl/framedimage/command/SubCommandExecutor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/command/fi/CreateSubcommand.java b/src/main/java/com/jnngl/framedimage/command/fi/CreateSubcommand.java
index 4b5d27f..f473877 100644
--- a/src/main/java/com/jnngl/framedimage/command/fi/CreateSubcommand.java
+++ b/src/main/java/com/jnngl/framedimage/command/fi/CreateSubcommand.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/command/fi/ReloadSubcommand.java b/src/main/java/com/jnngl/framedimage/command/fi/ReloadSubcommand.java
index bff41aa..531995e 100644
--- a/src/main/java/com/jnngl/framedimage/command/fi/ReloadSubcommand.java
+++ b/src/main/java/com/jnngl/framedimage/command/fi/ReloadSubcommand.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/command/fi/RemoveSubcommand.java b/src/main/java/com/jnngl/framedimage/command/fi/RemoveSubcommand.java
index 7628137..5fca986 100644
--- a/src/main/java/com/jnngl/framedimage/command/fi/RemoveSubcommand.java
+++ b/src/main/java/com/jnngl/framedimage/command/fi/RemoveSubcommand.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/config/Config.java b/src/main/java/com/jnngl/framedimage/config/Config.java
index 33a778f..90d529d 100644
--- a/src/main/java/com/jnngl/framedimage/config/Config.java
+++ b/src/main/java/com/jnngl/framedimage/config/Config.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/config/Frames.java b/src/main/java/com/jnngl/framedimage/config/Frames.java
index c79c6fb..44c2a06 100644
--- a/src/main/java/com/jnngl/framedimage/config/Frames.java
+++ b/src/main/java/com/jnngl/framedimage/config/Frames.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/config/Messages.java b/src/main/java/com/jnngl/framedimage/config/Messages.java
index 86449cd..b2973f6 100644
--- a/src/main/java/com/jnngl/framedimage/config/Messages.java
+++ b/src/main/java/com/jnngl/framedimage/config/Messages.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/injection/ChannelInjectionHandler.java b/src/main/java/com/jnngl/framedimage/injection/ChannelInjectionHandler.java
index 0e0c03e..8609679 100644
--- a/src/main/java/com/jnngl/framedimage/injection/ChannelInjectionHandler.java
+++ b/src/main/java/com/jnngl/framedimage/injection/ChannelInjectionHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/injection/ChannelInjector.java b/src/main/java/com/jnngl/framedimage/injection/ChannelInjector.java
index 4dbf618..62e7c3c 100644
--- a/src/main/java/com/jnngl/framedimage/injection/ChannelInjector.java
+++ b/src/main/java/com/jnngl/framedimage/injection/ChannelInjector.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/injection/InjectionException.java b/src/main/java/com/jnngl/framedimage/injection/InjectionException.java
index 39db772..120eb1c 100644
--- a/src/main/java/com/jnngl/framedimage/injection/InjectionException.java
+++ b/src/main/java/com/jnngl/framedimage/injection/InjectionException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/injection/Injector.java b/src/main/java/com/jnngl/framedimage/injection/Injector.java
index 8824992..133dfd3 100644
--- a/src/main/java/com/jnngl/framedimage/injection/Injector.java
+++ b/src/main/java/com/jnngl/framedimage/injection/Injector.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/listener/DisconnectHandler.java b/src/main/java/com/jnngl/framedimage/listener/DisconnectHandler.java
index 4a85fc4..204a0c9 100644
--- a/src/main/java/com/jnngl/framedimage/listener/DisconnectHandler.java
+++ b/src/main/java/com/jnngl/framedimage/listener/DisconnectHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/listener/HandshakeListener.java b/src/main/java/com/jnngl/framedimage/listener/HandshakeListener.java
index 9e0ae04..d5e7aab 100644
--- a/src/main/java/com/jnngl/framedimage/listener/HandshakeListener.java
+++ b/src/main/java/com/jnngl/framedimage/listener/HandshakeListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/listener/LoginListener.java b/src/main/java/com/jnngl/framedimage/listener/LoginListener.java
index 0279a27..086ed01 100644
--- a/src/main/java/com/jnngl/framedimage/listener/LoginListener.java
+++ b/src/main/java/com/jnngl/framedimage/listener/LoginListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/listener/PlayerListener.java b/src/main/java/com/jnngl/framedimage/listener/PlayerListener.java
index 2956216..1402213 100644
--- a/src/main/java/com/jnngl/framedimage/listener/PlayerListener.java
+++ b/src/main/java/com/jnngl/framedimage/listener/PlayerListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/protocol/IdMapping.java b/src/main/java/com/jnngl/framedimage/protocol/IdMapping.java
index 7554e63..29f58cc 100644
--- a/src/main/java/com/jnngl/framedimage/protocol/IdMapping.java
+++ b/src/main/java/com/jnngl/framedimage/protocol/IdMapping.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/protocol/LpVec3Codec.java b/src/main/java/com/jnngl/framedimage/protocol/LpVec3Codec.java
new file mode 100644
index 0000000..665f742
--- /dev/null
+++ b/src/main/java/com/jnngl/framedimage/protocol/LpVec3Codec.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2022-2026 JNNGL
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.jnngl.framedimage.protocol;
+
+import io.netty.buffer.ByteBuf;
+
+public final class LpVec3Codec {
+
+ private static final int SCALE_MASK = 0x03;
+ private static final int CONTINUATION_FLAG = 0x04;
+ private static final double MAX_QUANTIZED_VALUE = 32766.0;
+ private static final double ABS_MIN_VALUE = 3.051944088384301E-5;
+ private static final double ABS_MAX_VALUE = 1.7179869183E10;
+
+ private LpVec3Codec() {
+ }
+
+ public static void write(ByteBuf buf, double x, double y, double z) {
+ double sanitizedX = sanitizeVelocity(x);
+ double sanitizedY = sanitizeVelocity(y);
+ double sanitizedZ = sanitizeVelocity(z);
+
+ double maxAbs = Math.max(Math.abs(sanitizedX), Math.max(Math.abs(sanitizedY), Math.abs(sanitizedZ)));
+ if (maxAbs < ABS_MIN_VALUE) {
+ buf.writeByte(0);
+ return;
+ }
+
+ int scale = (int) Math.ceil(maxAbs);
+ boolean needsContinuation = (scale & SCALE_MASK) != scale;
+ int scaleByte = needsContinuation
+ ? ((scale & SCALE_MASK) | CONTINUATION_FLAG)
+ : (scale & SCALE_MASK);
+
+ long packedX = packVelocityComponent(sanitizedX / scale);
+ long packedY = packVelocityComponent(sanitizedY / scale);
+ long packedZ = packVelocityComponent(sanitizedZ / scale);
+
+ long low32 = (long) scaleByte | (packedX << 3) | (packedY << 18);
+ int high16 = (int) (((packedY >> 14) & 0x01L) | (packedZ << 1));
+
+ buf.writeIntLE((int) low32);
+ buf.writeShortLE(high16);
+
+ if (needsContinuation) {
+ ProtocolUtils.writeVarInt(buf, scale >> 2);
+ }
+ }
+
+ private static double sanitizeVelocity(double value) {
+ if (Double.isNaN(value)) {
+ return 0.0;
+ }
+
+ return Math.max(-ABS_MAX_VALUE, Math.min(value, ABS_MAX_VALUE));
+ }
+
+ private static long packVelocityComponent(double value) {
+ return Math.round((value * 0.5 + 0.5) * MAX_QUANTIZED_VALUE);
+ }
+}
diff --git a/src/main/java/com/jnngl/framedimage/protocol/MinecraftVersion.java b/src/main/java/com/jnngl/framedimage/protocol/MinecraftVersion.java
index b85b86c..764fbc5 100644
--- a/src/main/java/com/jnngl/framedimage/protocol/MinecraftVersion.java
+++ b/src/main/java/com/jnngl/framedimage/protocol/MinecraftVersion.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -63,7 +63,14 @@ public enum MinecraftVersion {
MINECRAFT_1_20_2(764),
MINECRAFT_1_20_3(765),
MINECRAFT_1_20_5(766),
- MINECRAFT_1_21(767);
+ MINECRAFT_1_21(767),
+ MINECRAFT_1_21_2(768),
+ MINECRAFT_1_21_4(769),
+ MINECRAFT_1_21_5(770),
+ MINECRAFT_1_21_6(771),
+ MINECRAFT_1_21_7(772),
+ MINECRAFT_1_21_9(773),
+ MINECRAFT_1_21_11(774);
public static final MinecraftVersion MINIMUM_VERSION = MINECRAFT_1_7_2;
public static final MinecraftVersion MAXIMUM_VERSION = values()[values().length - 1];
diff --git a/src/main/java/com/jnngl/framedimage/protocol/Packet.java b/src/main/java/com/jnngl/framedimage/protocol/Packet.java
index 4481461..fd4ed60 100644
--- a/src/main/java/com/jnngl/framedimage/protocol/Packet.java
+++ b/src/main/java/com/jnngl/framedimage/protocol/Packet.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/protocol/PacketEncoder.java b/src/main/java/com/jnngl/framedimage/protocol/PacketEncoder.java
index b7747d0..05829a1 100644
--- a/src/main/java/com/jnngl/framedimage/protocol/PacketEncoder.java
+++ b/src/main/java/com/jnngl/framedimage/protocol/PacketEncoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/protocol/ProtocolUtils.java b/src/main/java/com/jnngl/framedimage/protocol/ProtocolUtils.java
index dd5e2b5..a5e53a7 100644
--- a/src/main/java/com/jnngl/framedimage/protocol/ProtocolUtils.java
+++ b/src/main/java/com/jnngl/framedimage/protocol/ProtocolUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/protocol/data/EntityMetadata.java b/src/main/java/com/jnngl/framedimage/protocol/data/EntityMetadata.java
index 9398429..20c7510 100644
--- a/src/main/java/com/jnngl/framedimage/protocol/data/EntityMetadata.java
+++ b/src/main/java/com/jnngl/framedimage/protocol/data/EntityMetadata.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@
import com.jnngl.framedimage.protocol.data.nbt.Nbt;
import com.jnngl.framedimage.protocol.data.nbt.NbtTag;
import io.netty.buffer.ByteBuf;
+import com.jnngl.framedimage.protocol.IdMapping;
import com.jnngl.framedimage.protocol.MinecraftVersion;
import com.jnngl.framedimage.protocol.ProtocolUtils;
@@ -37,6 +38,14 @@ public interface Entry {
public static class SlotEntry implements Entry {
+ private static final IdMapping MAP_ID_COMPONENT_MAPPING =
+ new IdMapping()
+ .add(MinecraftVersion.MINECRAFT_1_20_5, 26)
+ .add(MinecraftVersion.MINECRAFT_1_21_2, 36)
+ .add(MinecraftVersion.MINECRAFT_1_21_5, 37)
+ .add(MinecraftVersion.MINECRAFT_1_21_11, 44)
+ .build();
+
private final boolean present;
private final Function item;
private final int count;
@@ -62,11 +71,16 @@ public SlotEntry() {
@Override
public void encode(ByteBuf buf, MinecraftVersion protocolVersion) {
if (protocolVersion.compareTo(MinecraftVersion.MINECRAFT_1_20_5) >= 0) {
- ProtocolUtils.writeVarInt(buf, 1);
+ if (!present) {
+ ProtocolUtils.writeVarInt(buf, 0);
+ return;
+ }
+
+ ProtocolUtils.writeVarInt(buf, count);
ProtocolUtils.writeVarInt(buf, item.apply(protocolVersion));
ProtocolUtils.writeVarInt(buf, 1);
ProtocolUtils.writeVarInt(buf, 0);
- ProtocolUtils.writeVarInt(buf, 26);
+ ProtocolUtils.writeVarInt(buf, MAP_ID_COMPONENT_MAPPING.getID(protocolVersion));
ProtocolUtils.writeVarInt(buf, this.data);
return;
}
diff --git a/src/main/java/com/jnngl/framedimage/protocol/data/Facing.java b/src/main/java/com/jnngl/framedimage/protocol/data/Facing.java
index 549e733..365b82f 100644
--- a/src/main/java/com/jnngl/framedimage/protocol/data/Facing.java
+++ b/src/main/java/com/jnngl/framedimage/protocol/data/Facing.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/protocol/data/FilledMap.java b/src/main/java/com/jnngl/framedimage/protocol/data/FilledMap.java
index b5f6654..9d4e901 100644
--- a/src/main/java/com/jnngl/framedimage/protocol/data/FilledMap.java
+++ b/src/main/java/com/jnngl/framedimage/protocol/data/FilledMap.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,6 +36,11 @@ public class FilledMap {
.add(MinecraftVersion.MINECRAFT_1_20, 941)
.add(MinecraftVersion.MINECRAFT_1_20_3, 979)
.add(MinecraftVersion.MINECRAFT_1_20_5, 982)
+ .add(MinecraftVersion.MINECRAFT_1_21_2, 1022)
+ .add(MinecraftVersion.MINECRAFT_1_21_4, 1031)
+ .add(MinecraftVersion.MINECRAFT_1_21_5, 1042)
+ .add(MinecraftVersion.MINECRAFT_1_21_6, 1059)
+ .add(MinecraftVersion.MINECRAFT_1_21_9, 1104)
.build();
public static int getID(MinecraftVersion version) {
diff --git a/src/main/java/com/jnngl/framedimage/protocol/data/ItemFrame.java b/src/main/java/com/jnngl/framedimage/protocol/data/ItemFrame.java
index 774d323..b2a1759 100644
--- a/src/main/java/com/jnngl/framedimage/protocol/data/ItemFrame.java
+++ b/src/main/java/com/jnngl/framedimage/protocol/data/ItemFrame.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -39,6 +39,11 @@ public class ItemFrame {
.add(MinecraftVersion.MINECRAFT_1_19_4, 56)
.add(MinecraftVersion.MINECRAFT_1_20_3, 57)
.add(MinecraftVersion.MINECRAFT_1_20_5, 60)
+ .add(MinecraftVersion.MINECRAFT_1_21_2, 71)
+ .add(MinecraftVersion.MINECRAFT_1_21_4, 70)
+ .add(MinecraftVersion.MINECRAFT_1_21_6, 71)
+ .add(MinecraftVersion.MINECRAFT_1_21_9, 72)
+ .add(MinecraftVersion.MINECRAFT_1_21_11, 73)
.build();
private static final IdMapping GLOWING_ID_MAPPING =
@@ -53,6 +58,11 @@ public class ItemFrame {
.add(MinecraftVersion.MINECRAFT_1_19_4, 43)
.add(MinecraftVersion.MINECRAFT_1_20_3, 44)
.add(MinecraftVersion.MINECRAFT_1_20_5, 47)
+ .add(MinecraftVersion.MINECRAFT_1_21_2, 58)
+ .add(MinecraftVersion.MINECRAFT_1_21_4, 57)
+ .add(MinecraftVersion.MINECRAFT_1_21_6, 58)
+ .add(MinecraftVersion.MINECRAFT_1_21_9, 59)
+ .add(MinecraftVersion.MINECRAFT_1_21_11, 60)
.build();
private static final IdMapping METADATA_INDEX_MAPPING =
@@ -63,6 +73,7 @@ public class ItemFrame {
.add(MinecraftVersion.MINECRAFT_1_10, 6)
.add(MinecraftVersion.MINECRAFT_1_14, 7)
.add(MinecraftVersion.MINECRAFT_1_17, 8)
+ .add(MinecraftVersion.MINECRAFT_1_21_6, 9)
.build();
public static int getID(MinecraftVersion protocolVersion) {
diff --git a/src/main/java/com/jnngl/framedimage/protocol/data/nbt/Nbt.java b/src/main/java/com/jnngl/framedimage/protocol/data/nbt/Nbt.java
index d73256b..aa263bd 100644
--- a/src/main/java/com/jnngl/framedimage/protocol/data/nbt/Nbt.java
+++ b/src/main/java/com/jnngl/framedimage/protocol/data/nbt/Nbt.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/protocol/data/nbt/NbtTag.java b/src/main/java/com/jnngl/framedimage/protocol/data/nbt/NbtTag.java
index 51ee4e0..45a7d31 100644
--- a/src/main/java/com/jnngl/framedimage/protocol/data/nbt/NbtTag.java
+++ b/src/main/java/com/jnngl/framedimage/protocol/data/nbt/NbtTag.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/protocol/data/nbt/TagCompound.java b/src/main/java/com/jnngl/framedimage/protocol/data/nbt/TagCompound.java
index 9b9571c..daf6445 100644
--- a/src/main/java/com/jnngl/framedimage/protocol/data/nbt/TagCompound.java
+++ b/src/main/java/com/jnngl/framedimage/protocol/data/nbt/TagCompound.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/protocol/data/nbt/TagInt.java b/src/main/java/com/jnngl/framedimage/protocol/data/nbt/TagInt.java
index d85c40f..9636adf 100644
--- a/src/main/java/com/jnngl/framedimage/protocol/data/nbt/TagInt.java
+++ b/src/main/java/com/jnngl/framedimage/protocol/data/nbt/TagInt.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/protocol/packets/DestroyEntity.java b/src/main/java/com/jnngl/framedimage/protocol/packets/DestroyEntity.java
index 9f22b3a..8014e7f 100644
--- a/src/main/java/com/jnngl/framedimage/protocol/packets/DestroyEntity.java
+++ b/src/main/java/com/jnngl/framedimage/protocol/packets/DestroyEntity.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -42,6 +42,9 @@ public class DestroyEntity implements Packet {
.add(MinecraftVersion.MINECRAFT_1_19_4, 0x3E)
.add(MinecraftVersion.MINECRAFT_1_20_2, 0x40)
.add(MinecraftVersion.MINECRAFT_1_20_5, 0x42)
+ .add(MinecraftVersion.MINECRAFT_1_21_2, 0x47)
+ .add(MinecraftVersion.MINECRAFT_1_21_5, 0x46)
+ .add(MinecraftVersion.MINECRAFT_1_21_9, 0x4B)
.build();
private final int entity;
diff --git a/src/main/java/com/jnngl/framedimage/protocol/packets/MapData.java b/src/main/java/com/jnngl/framedimage/protocol/packets/MapData.java
index fbf324b..17009d1 100644
--- a/src/main/java/com/jnngl/framedimage/protocol/packets/MapData.java
+++ b/src/main/java/com/jnngl/framedimage/protocol/packets/MapData.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -43,6 +43,9 @@ public class MapData implements Packet {
.add(MinecraftVersion.MINECRAFT_1_19_4, 0x29)
.add(MinecraftVersion.MINECRAFT_1_20_2, 0x2A)
.add(MinecraftVersion.MINECRAFT_1_20_5, 0x2C)
+ .add(MinecraftVersion.MINECRAFT_1_21_2, 0x2D)
+ .add(MinecraftVersion.MINECRAFT_1_21_5, 0x2C)
+ .add(MinecraftVersion.MINECRAFT_1_21_9, 0x31)
.build();
private final int mapID;
diff --git a/src/main/java/com/jnngl/framedimage/protocol/packets/SetMetadata.java b/src/main/java/com/jnngl/framedimage/protocol/packets/SetMetadata.java
index aaaa57f..f80a449 100644
--- a/src/main/java/com/jnngl/framedimage/protocol/packets/SetMetadata.java
+++ b/src/main/java/com/jnngl/framedimage/protocol/packets/SetMetadata.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -43,6 +43,9 @@ public class SetMetadata implements Packet {
.add(MinecraftVersion.MINECRAFT_1_20_2, 0x54)
.add(MinecraftVersion.MINECRAFT_1_20_3, 0x56)
.add(MinecraftVersion.MINECRAFT_1_20_5, 0x58)
+ .add(MinecraftVersion.MINECRAFT_1_21_2, 0x5D)
+ .add(MinecraftVersion.MINECRAFT_1_21_5, 0x5C)
+ .add(MinecraftVersion.MINECRAFT_1_21_9, 0x61)
.build();
private final int entityId;
diff --git a/src/main/java/com/jnngl/framedimage/protocol/packets/SpawnEntity.java b/src/main/java/com/jnngl/framedimage/protocol/packets/SpawnEntity.java
index a2f240a..af5787f 100644
--- a/src/main/java/com/jnngl/framedimage/protocol/packets/SpawnEntity.java
+++ b/src/main/java/com/jnngl/framedimage/protocol/packets/SpawnEntity.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
import io.netty.buffer.ByteBuf;
import com.jnngl.framedimage.protocol.IdMapping;
+import com.jnngl.framedimage.protocol.LpVec3Codec;
import com.jnngl.framedimage.protocol.MinecraftVersion;
import com.jnngl.framedimage.protocol.Packet;
import com.jnngl.framedimage.protocol.ProtocolUtils;
@@ -86,6 +87,11 @@ public void encode(ByteBuf buf, MinecraftVersion protocolVersion) {
buf.writeInt((int) (positionY * 32.0));
buf.writeInt((int) (positionZ * 32.0));
}
+
+ if (protocolVersion.compareTo(MinecraftVersion.MINECRAFT_1_21_9) >= 0) {
+ LpVec3Codec.write(buf, velocityX, velocityY, velocityZ);
+ }
+
buf.writeByte((int) (pitch * (256.0F / 360.0F)));
buf.writeByte((int) (yaw * (256.0F / 360.0F)));
if (protocolVersion.compareTo(MinecraftVersion.MINECRAFT_1_18_2) > 0) {
@@ -94,9 +100,12 @@ public void encode(ByteBuf buf, MinecraftVersion protocolVersion) {
} else {
buf.writeInt(data.apply(protocolVersion));
}
- buf.writeShort((int) (velocityX * 8000.0F));
- buf.writeShort((int) (velocityY * 8000.0F));
- buf.writeShort((int) (velocityZ * 8000.0F));
+
+ if (protocolVersion.compareTo(MinecraftVersion.MINECRAFT_1_21_9) < 0) {
+ buf.writeShort((int) (velocityX * 8000.0F));
+ buf.writeShort((int) (velocityY * 8000.0F));
+ buf.writeShort((int) (velocityZ * 8000.0F));
+ }
}
@Override
diff --git a/src/main/java/com/jnngl/framedimage/util/BlockUtil.java b/src/main/java/com/jnngl/framedimage/util/BlockUtil.java
index af4cba0..cacf7eb 100644
--- a/src/main/java/com/jnngl/framedimage/util/BlockUtil.java
+++ b/src/main/java/com/jnngl/framedimage/util/BlockUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/util/GifReader.java b/src/main/java/com/jnngl/framedimage/util/GifReader.java
index 499e1c2..87e6fb3 100644
--- a/src/main/java/com/jnngl/framedimage/util/GifReader.java
+++ b/src/main/java/com/jnngl/framedimage/util/GifReader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/main/java/com/jnngl/framedimage/util/ImageUtil.java b/src/main/java/com/jnngl/framedimage/util/ImageUtil.java
index b739241..0ea8bc5 100644
--- a/src/main/java/com/jnngl/framedimage/util/ImageUtil.java
+++ b/src/main/java/com/jnngl/framedimage/util/ImageUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 JNNGL
+ * Copyright (C) 2022-2026 JNNGL
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by