2026.01.24-6e2d4fc36
This commit is contained in:
35
.gitignore
vendored
35
.gitignore
vendored
@@ -1,9 +1,7 @@
|
|||||||
.gradle
|
|
||||||
build/
|
build/
|
||||||
!gradle/wrapper/gradle-wrapper.jar
|
bin/
|
||||||
!**/src/main/**/build/
|
|
||||||
!**/src/test/**/build/
|
|
||||||
.kotlin
|
.kotlin
|
||||||
|
.idea
|
||||||
|
|
||||||
### IntelliJ IDEA ###
|
### IntelliJ IDEA ###
|
||||||
.idea/modules.xml
|
.idea/modules.xml
|
||||||
@@ -17,27 +15,8 @@ out/
|
|||||||
!**/src/main/**/out/
|
!**/src/main/**/out/
|
||||||
!**/src/test/**/out/
|
!**/src/test/**/out/
|
||||||
|
|
||||||
### Eclipse ###
|
# Gradle Wrapper
|
||||||
.apt_generated
|
gradlew
|
||||||
.classpath
|
gradlew.bat
|
||||||
.factorypath
|
.gradle
|
||||||
.project
|
gradle
|
||||||
.settings
|
|
||||||
.springBeans
|
|
||||||
.sts4-cache
|
|
||||||
bin/
|
|
||||||
!**/src/main/**/bin/
|
|
||||||
!**/src/test/**/bin/
|
|
||||||
|
|
||||||
### NetBeans ###
|
|
||||||
/nbproject/private/
|
|
||||||
/nbbuild/
|
|
||||||
/dist/
|
|
||||||
/nbdist/
|
|
||||||
/.nb-gradle/
|
|
||||||
|
|
||||||
### VS Code ###
|
|
||||||
.vscode/
|
|
||||||
|
|
||||||
### Mac OS ###
|
|
||||||
.DS_Store
|
|
||||||
8
.idea/.gitignore
generated
vendored
8
.idea/.gitignore
generated
vendored
@@ -1,8 +0,0 @@
|
|||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Editor-based HTTP Client requests
|
|
||||||
/httpRequests/
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
||||||
1
.idea/.name
generated
1
.idea/.name
generated
@@ -1 +0,0 @@
|
|||||||
Hytale-Server
|
|
||||||
6
.idea/AndroidProjectSystem.xml
generated
6
.idea/AndroidProjectSystem.xml
generated
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="AndroidProjectSystem">
|
|
||||||
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
16
.idea/gradle.xml
generated
16
.idea/gradle.xml
generated
@@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="GradleSettings">
|
|
||||||
<option name="linkedExternalProjectsSettings">
|
|
||||||
<GradleProjectSettings>
|
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
||||||
<option name="gradleHome" value="" />
|
|
||||||
<option name="modules">
|
|
||||||
<set>
|
|
||||||
<option value="$PROJECT_DIR$" />
|
|
||||||
</set>
|
|
||||||
</option>
|
|
||||||
</GradleProjectSettings>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
10
.idea/misc.xml
generated
10
.idea/misc.xml
generated
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
|
||||||
<component name="FrameworkDetectionExcludesConfiguration">
|
|
||||||
<file type="web" url="file://$PROJECT_DIR$" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="corretto-21" project-jdk-type="JavaSDK">
|
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
|
# Move to the git root if we arn't already there
|
||||||
|
git rev-parse --show-toplevel | Set-Location
|
||||||
|
|
||||||
|
# get the server jar from the install directory ( in future support pre-release )
|
||||||
|
$server_jar = resolve-path "$env:APPDATA/Hytale/install/release/package/game/latest/Server/HytaleServer.jar"
|
||||||
|
|
||||||
|
# clear the source directory
|
||||||
|
Get-ChildItem -Path "src" | Remove-Item -Recurse -Force -Confirm:$false
|
||||||
|
|
||||||
|
# Decompile hytale
|
||||||
|
java -jar "_decomp/vineflower-1.11.2-slim.jar" --only="com/hypixel" $server_jar "./src"
|
||||||
|
|
||||||
|
# Extract the version before deleting the meta inf file
|
||||||
|
$version = (Get-Content "src/META-INF/MANIFEST.MF" | Select-String "^Implementation-Version:\s*(.+)$").Matches.Groups[1].Value
|
||||||
|
|
||||||
|
# delete anything not in com hypixel
|
||||||
|
Get-ChildItem "src/" -Exclude @("com", "manifests.json") | Remove-Item -Recurse -Force -Confirm:$false
|
||||||
|
Get-ChildItem "src/com/" -Exclude @("hypixel") | Remove-Item -Recurse -Force -Confirm:$false
|
||||||
|
|
||||||
|
git add "./src"
|
||||||
|
git commit -am "$version"
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import org.apache.tools.ant.taskdefs.condition.Os
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("java")
|
id("java")
|
||||||
}
|
}
|
||||||
@@ -10,9 +12,14 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation(platform("org.junit:junit-bom:5.10.0"))
|
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
implementation(files("${System.getenv("APPDATA")}/Hytale/install/release/package/game/latest/Server/HytaleServer.jar"))
|
||||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.wrapper {
|
||||||
|
gradleVersion = "8.14"
|
||||||
|
distributionType = Wrapper.DistributionType.ALL
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
|||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
6
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +0,0 @@
|
|||||||
#Sat Jan 24 07:48:30 EST 2026
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
|
||||||
distributionPath=wrapper/dists
|
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
|
||||||
234
gradlew
vendored
234
gradlew
vendored
@@ -1,234 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
#
|
|
||||||
# Copyright © 2015-2021 the original authors.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
|
|
||||||
##############################################################################
|
|
||||||
#
|
|
||||||
# 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/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
|
||||||
# within the Gradle project.
|
|
||||||
#
|
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
|
||||||
#
|
|
||||||
##############################################################################
|
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
|
||||||
|
|
||||||
# Resolve links: $0 may be a link
|
|
||||||
app_path=$0
|
|
||||||
|
|
||||||
# Need this for daisy-chained symlinks.
|
|
||||||
while
|
|
||||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
|
||||||
[ -h "$app_path" ]
|
|
||||||
do
|
|
||||||
ls=$( ls -ld "$app_path" )
|
|
||||||
link=${ls#*' -> '}
|
|
||||||
case $link in #(
|
|
||||||
/*) app_path=$link ;; #(
|
|
||||||
*) app_path=$APP_HOME$link ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
|
||||||
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"'
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
||||||
MAX_FD=maximum
|
|
||||||
|
|
||||||
warn () {
|
|
||||||
echo "$*"
|
|
||||||
} >&2
|
|
||||||
|
|
||||||
die () {
|
|
||||||
echo
|
|
||||||
echo "$*"
|
|
||||||
echo
|
|
||||||
exit 1
|
|
||||||
} >&2
|
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
|
||||||
cygwin=false
|
|
||||||
msys=false
|
|
||||||
darwin=false
|
|
||||||
nonstop=false
|
|
||||||
case "$( uname )" in #(
|
|
||||||
CYGWIN* ) cygwin=true ;; #(
|
|
||||||
Darwin* ) darwin=true ;; #(
|
|
||||||
MSYS* | MINGW* ) msys=true ;; #(
|
|
||||||
NONSTOP* ) nonstop=true ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
|
||||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
|
||||||
else
|
|
||||||
JAVACMD=$JAVA_HOME/bin/java
|
|
||||||
fi
|
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
|
||||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
|
||||||
location of your Java installation."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
JAVACMD=java
|
|
||||||
which java >/dev/null 2>&1 || 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
|
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
|
||||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|
||||||
case $MAX_FD in #(
|
|
||||||
max*)
|
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
|
||||||
warn "Could not query maximum file descriptor limit"
|
|
||||||
esac
|
|
||||||
case $MAX_FD in #(
|
|
||||||
'' | soft) :;; #(
|
|
||||||
*)
|
|
||||||
ulimit -n "$MAX_FD" ||
|
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Collect all arguments for the java command, stacking in reverse order:
|
|
||||||
# * args from the command line
|
|
||||||
# * the main class name
|
|
||||||
# * -classpath
|
|
||||||
# * -D...appname settings
|
|
||||||
# * --module-path (only if needed)
|
|
||||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
||||||
if "$cygwin" || "$msys" ; then
|
|
||||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
|
||||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
|
||||||
|
|
||||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
|
||||||
|
|
||||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
||||||
for arg do
|
|
||||||
if
|
|
||||||
case $arg in #(
|
|
||||||
-*) false ;; # don't mess with options #(
|
|
||||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
|
||||||
[ -e "$t" ] ;; #(
|
|
||||||
*) false ;;
|
|
||||||
esac
|
|
||||||
then
|
|
||||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
|
||||||
fi
|
|
||||||
# Roll the args list around exactly as many times as the number of
|
|
||||||
# args, so each arg winds up back in the position where it started, but
|
|
||||||
# possibly modified.
|
|
||||||
#
|
|
||||||
# NB: a `for` loop captures its iteration list before it begins, so
|
|
||||||
# changing the positional parameters here affects neither the number of
|
|
||||||
# iterations, nor the values presented in `arg`.
|
|
||||||
shift # remove old arg
|
|
||||||
set -- "$@" "$arg" # push replacement arg
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
set -- \
|
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
|
||||||
-classpath "$CLASSPATH" \
|
|
||||||
org.gradle.wrapper.GradleWrapperMain \
|
|
||||||
"$@"
|
|
||||||
|
|
||||||
# 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" "$@"
|
|
||||||
89
gradlew.bat
vendored
89
gradlew.bat
vendored
@@ -1,89 +0,0 @@
|
|||||||
@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
|
|
||||||
@@ -1,9 +1,6 @@
|
|||||||
package com.hypixel.fastutil.util;
|
package com.hypixel.fastutil.util;
|
||||||
|
|
||||||
public class SneakyThrow {
|
public class SneakyThrow {
|
||||||
public SneakyThrow() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static RuntimeException sneakyThrow(Throwable t) {
|
public static RuntimeException sneakyThrow(Throwable t) {
|
||||||
if (t == null) {
|
if (t == null) {
|
||||||
throw new NullPointerException("t");
|
throw new NullPointerException("t");
|
||||||
|
|||||||
@@ -9,9 +9,6 @@ public class TLRUtil {
|
|||||||
private static final Unsafe UNSAFE;
|
private static final Unsafe UNSAFE;
|
||||||
private static final long PROBE;
|
private static final long PROBE;
|
||||||
|
|
||||||
public TLRUtil() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void localInit() {
|
public static void localInit() {
|
||||||
ThreadLocalRandom.current();
|
ThreadLocalRandom.current();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,6 @@ import java.util.Map.Entry;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class LateMain {
|
public class LateMain {
|
||||||
public LateMain() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void lateMain(String[] args) {
|
public static void lateMain(String[] args) {
|
||||||
try {
|
try {
|
||||||
if (!Options.parse(args)) {
|
if (!Options.parse(args)) {
|
||||||
|
|||||||
@@ -13,9 +13,6 @@ import java.util.Locale;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public final class Main {
|
public final class Main {
|
||||||
public Main() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Locale.setDefault(Locale.ENGLISH);
|
Locale.setDefault(Locale.ENGLISH);
|
||||||
System.setProperty("java.awt.headless", "true");
|
System.setProperty("java.awt.headless", "true");
|
||||||
|
|||||||
@@ -5,7 +5,4 @@ public class AssetConstants {
|
|||||||
public static final int EXPECTED_ASSETS_PER_PATH = 1;
|
public static final int EXPECTED_ASSETS_PER_PATH = 1;
|
||||||
public static final int EXPECTED_VALUES_PER_TAG = 3;
|
public static final int EXPECTED_VALUES_PER_TAG = 3;
|
||||||
public static final int EXPECTED_ASSETS_PER_TAG = 3;
|
public static final int EXPECTED_ASSETS_PER_TAG = 3;
|
||||||
|
|
||||||
public AssetConstants() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,6 @@ import javax.annotation.Nonnull;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public abstract class AssetMap<K, T extends JsonAsset<K>> {
|
public abstract class AssetMap<K, T extends JsonAsset<K>> {
|
||||||
public AssetMap() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public abstract T getAsset(K var1);
|
public abstract T getAsset(K var1);
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,6 @@ public class AssetRegistry {
|
|||||||
private static final Object2IntMap<String> TAG_MAP = new Object2IntOpenHashMap<>();
|
private static final Object2IntMap<String> TAG_MAP = new Object2IntOpenHashMap<>();
|
||||||
private static final Object2IntMap<String> CLIENT_TAG_MAP = new Object2IntOpenHashMap<>();
|
private static final Object2IntMap<String> CLIENT_TAG_MAP = new Object2IntOpenHashMap<>();
|
||||||
|
|
||||||
public AssetRegistry() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public static Map<Class<? extends JsonAssetWithMap>, AssetStore<?, ?, ?>> getStoreMap() {
|
public static Map<Class<? extends JsonAssetWithMap>, AssetStore<?, ?, ?>> getStoreMap() {
|
||||||
return storeMapUnmodifiable;
|
return storeMapUnmodifiable;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import java.util.HashSet;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
|
|
||||||
|
|
||||||
public class AssetValidationResults extends ValidationResults {
|
public class AssetValidationResults extends ValidationResults {
|
||||||
private Set<Class<? extends JsonAsset>> disabledMissingAssetClasses;
|
private Set<Class<? extends JsonAsset>> disabledMissingAssetClasses;
|
||||||
@@ -40,11 +39,11 @@ public class AssetValidationResults extends ValidationResults {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void logOrThrowValidatorExceptions(@NonNullDecl HytaleLogger logger, @NonNullDecl String msg) {
|
public void logOrThrowValidatorExceptions(@Nonnull HytaleLogger logger, @Nonnull String msg) {
|
||||||
this.logOrThrowValidatorExceptions(logger, msg, null, 0);
|
this.logOrThrowValidatorExceptions(logger, msg, null, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logOrThrowValidatorExceptions(@NonNullDecl HytaleLogger logger, @NonNullDecl String msg, @Nullable Path path, int lineOffset) {
|
public void logOrThrowValidatorExceptions(@Nonnull HytaleLogger logger, @Nonnull String msg, @Nullable Path path, int lineOffset) {
|
||||||
if (GithubMessageUtil.isGithub() && this.validatorExceptions != null && !this.validatorExceptions.isEmpty()) {
|
if (GithubMessageUtil.isGithub() && this.validatorExceptions != null && !this.validatorExceptions.isEmpty()) {
|
||||||
for (ValidationResults.ValidatorResultsHolder holder : this.validatorExceptions) {
|
for (ValidationResults.ValidatorResultsHolder holder : this.validatorExceptions) {
|
||||||
String file = "unknown";
|
String file = "unknown";
|
||||||
|
|||||||
@@ -227,8 +227,5 @@ public class ContainedAssetCodec<K, T extends JsonAssetWithMap<K, M>, M extends
|
|||||||
INHERIT_ID,
|
INHERIT_ID,
|
||||||
INHERIT_ID_AND_PARENT,
|
INHERIT_ID_AND_PARENT,
|
||||||
INJECT_PARENT;
|
INJECT_PARENT;
|
||||||
|
|
||||||
private Mode() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,4 @@ import com.hypixel.hytale.assetstore.JsonAsset;
|
|||||||
import com.hypixel.hytale.event.IEvent;
|
import com.hypixel.hytale.event.IEvent;
|
||||||
|
|
||||||
public abstract class AssetsEvent<K, T extends JsonAsset<K>> implements IEvent<Class<T>> {
|
public abstract class AssetsEvent<K, T extends JsonAsset<K>> implements IEvent<Class<T>> {
|
||||||
public AssetsEvent() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ public abstract class AssetMapWithIndexes<K, T extends JsonAsset<K>> extends Def
|
|||||||
protected final Int2ObjectConcurrentHashMap<IntSet> indexedTagStorage = new Int2ObjectConcurrentHashMap<>();
|
protected final Int2ObjectConcurrentHashMap<IntSet> indexedTagStorage = new Int2ObjectConcurrentHashMap<>();
|
||||||
protected final Int2ObjectConcurrentHashMap<IntSet> unmodifiableIndexedTagStorage = new Int2ObjectConcurrentHashMap<>();
|
protected final Int2ObjectConcurrentHashMap<IntSet> unmodifiableIndexedTagStorage = new Int2ObjectConcurrentHashMap<>();
|
||||||
|
|
||||||
public AssetMapWithIndexes() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void clear() {
|
protected void clear() {
|
||||||
super.clear();
|
super.clear();
|
||||||
|
|||||||
@@ -5,9 +5,6 @@ import it.unimi.dsi.fastutil.Hash.Strategy;
|
|||||||
public class CaseInsensitiveHashStrategy<K> implements Strategy<K> {
|
public class CaseInsensitiveHashStrategy<K> implements Strategy<K> {
|
||||||
private static final CaseInsensitiveHashStrategy INSTANCE = new CaseInsensitiveHashStrategy();
|
private static final CaseInsensitiveHashStrategy INSTANCE = new CaseInsensitiveHashStrategy();
|
||||||
|
|
||||||
public CaseInsensitiveHashStrategy() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <K> CaseInsensitiveHashStrategy<K> getInstance() {
|
public static <K> CaseInsensitiveHashStrategy<K> getInstance() {
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,9 +45,6 @@ public class CameraShakeConfig implements NetworkSerializable<com.hypixel.hytale
|
|||||||
protected CameraShakeConfig.OffsetNoise offset = CameraShakeConfig.OffsetNoise.NONE;
|
protected CameraShakeConfig.OffsetNoise offset = CameraShakeConfig.OffsetNoise.NONE;
|
||||||
protected CameraShakeConfig.RotationNoise rotation = CameraShakeConfig.RotationNoise.NONE;
|
protected CameraShakeConfig.RotationNoise rotation = CameraShakeConfig.RotationNoise.NONE;
|
||||||
|
|
||||||
public CameraShakeConfig() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public com.hypixel.hytale.protocol.CameraShakeConfig toPacket() {
|
public com.hypixel.hytale.protocol.CameraShakeConfig toPacket() {
|
||||||
boolean continuous = this.startTime == null;
|
boolean continuous = this.startTime == null;
|
||||||
@@ -97,9 +94,6 @@ public class CameraShakeConfig implements NetworkSerializable<com.hypixel.hytale
|
|||||||
protected NoiseConfig[] y;
|
protected NoiseConfig[] y;
|
||||||
protected NoiseConfig[] z;
|
protected NoiseConfig[] z;
|
||||||
|
|
||||||
public OffsetNoise() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public com.hypixel.hytale.protocol.OffsetNoise toPacket() {
|
public com.hypixel.hytale.protocol.OffsetNoise toPacket() {
|
||||||
return new com.hypixel.hytale.protocol.OffsetNoise(NoiseConfig.toPacket(this.x), NoiseConfig.toPacket(this.y), NoiseConfig.toPacket(this.z));
|
return new com.hypixel.hytale.protocol.OffsetNoise(NoiseConfig.toPacket(this.x), NoiseConfig.toPacket(this.y), NoiseConfig.toPacket(this.z));
|
||||||
@@ -140,9 +134,6 @@ public class CameraShakeConfig implements NetworkSerializable<com.hypixel.hytale
|
|||||||
protected NoiseConfig[] yaw;
|
protected NoiseConfig[] yaw;
|
||||||
protected NoiseConfig[] roll;
|
protected NoiseConfig[] roll;
|
||||||
|
|
||||||
public RotationNoise() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public com.hypixel.hytale.protocol.RotationNoise toPacket() {
|
public com.hypixel.hytale.protocol.RotationNoise toPacket() {
|
||||||
return new com.hypixel.hytale.protocol.RotationNoise(NoiseConfig.toPacket(this.pitch), NoiseConfig.toPacket(this.yaw), NoiseConfig.toPacket(this.roll));
|
return new com.hypixel.hytale.protocol.RotationNoise(NoiseConfig.toPacket(this.pitch), NoiseConfig.toPacket(this.yaw), NoiseConfig.toPacket(this.roll));
|
||||||
|
|||||||
@@ -27,9 +27,6 @@ public class EasingConfig implements NetworkSerializable<com.hypixel.hytale.prot
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
protected EasingType type = EasingType.Linear;
|
protected EasingType type = EasingType.Linear;
|
||||||
|
|
||||||
public EasingConfig() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public com.hypixel.hytale.protocol.EasingConfig toPacket() {
|
public com.hypixel.hytale.protocol.EasingConfig toPacket() {
|
||||||
return new com.hypixel.hytale.protocol.EasingConfig(this.time, this.type);
|
return new com.hypixel.hytale.protocol.EasingConfig(this.time, this.type);
|
||||||
|
|||||||
@@ -49,9 +49,6 @@ public class NoiseConfig implements NetworkSerializable<com.hypixel.hytale.proto
|
|||||||
protected float frequency;
|
protected float frequency;
|
||||||
protected float amplitude;
|
protected float amplitude;
|
||||||
|
|
||||||
public NoiseConfig() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public com.hypixel.hytale.protocol.NoiseConfig toPacket() {
|
public com.hypixel.hytale.protocol.NoiseConfig toPacket() {
|
||||||
return new com.hypixel.hytale.protocol.NoiseConfig(this.seed, this.type, this.frequency, this.amplitude, this.clamp.toPacket());
|
return new com.hypixel.hytale.protocol.NoiseConfig(this.seed, this.type, this.frequency, this.amplitude, this.clamp.toPacket());
|
||||||
@@ -118,9 +115,6 @@ public class NoiseConfig implements NetworkSerializable<com.hypixel.hytale.proto
|
|||||||
protected float max = 1.0F;
|
protected float max = 1.0F;
|
||||||
protected boolean normalize = true;
|
protected boolean normalize = true;
|
||||||
|
|
||||||
public ClampConfig() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public com.hypixel.hytale.protocol.ClampConfig toPacket() {
|
public com.hypixel.hytale.protocol.ClampConfig toPacket() {
|
||||||
return new com.hypixel.hytale.protocol.ClampConfig(this.min, this.max, this.normalize);
|
return new com.hypixel.hytale.protocol.ClampConfig(this.min, this.max, this.normalize);
|
||||||
|
|||||||
@@ -40,9 +40,6 @@ public class CameraShakeEffect extends CameraEffect {
|
|||||||
@Nullable
|
@Nullable
|
||||||
protected ShakeIntensity intensity;
|
protected ShakeIntensity intensity;
|
||||||
|
|
||||||
public CameraShakeEffect() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public AccumulationMode getAccumulationMode() {
|
public AccumulationMode getAccumulationMode() {
|
||||||
return this.intensity == null ? ShakeIntensity.DEFAULT_ACCUMULATION_MODE : this.intensity.getAccumulationMode();
|
return this.intensity == null ? ShakeIntensity.DEFAULT_ACCUMULATION_MODE : this.intensity.getAccumulationMode();
|
||||||
|
|||||||
@@ -51,9 +51,6 @@ public class ShakeIntensity {
|
|||||||
@Nullable
|
@Nullable
|
||||||
protected ShakeIntensity.Modifier modifier;
|
protected ShakeIntensity.Modifier modifier;
|
||||||
|
|
||||||
public ShakeIntensity() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getValue() {
|
public float getValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
@@ -99,9 +96,6 @@ public class ShakeIntensity {
|
|||||||
private float[] input;
|
private float[] input;
|
||||||
private float[] output;
|
private float[] output;
|
||||||
|
|
||||||
public Modifier() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float apply(float intensityContext) {
|
public float apply(float intensityContext) {
|
||||||
float inputMin = this.input[0];
|
float inputMin = this.input[0];
|
||||||
|
|||||||
@@ -13,9 +13,6 @@ import java.util.Map.Entry;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class CameraShakePacketGenerator extends SimpleAssetPacketGenerator<String, CameraShake, IndexedAssetMap<String, CameraShake>> {
|
public class CameraShakePacketGenerator extends SimpleAssetPacketGenerator<String, CameraShake, IndexedAssetMap<String, CameraShake>> {
|
||||||
public CameraShakePacketGenerator() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public Packet generateInitPacket(@Nonnull IndexedAssetMap<String, CameraShake> assetMap, @Nonnull Map<String, CameraShake> assets) {
|
public Packet generateInitPacket(@Nonnull IndexedAssetMap<String, CameraShake> assetMap, @Nonnull Map<String, CameraShake> assets) {
|
||||||
return toCachedPacket(UpdateType.Init, assetMap, assets);
|
return toCachedPacket(UpdateType.Init, assetMap, assets);
|
||||||
|
|||||||
@@ -34,9 +34,6 @@ public class ViewBobbing
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
protected CameraShakeConfig firstPerson;
|
protected CameraShakeConfig firstPerson;
|
||||||
|
|
||||||
public ViewBobbing() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public MovementType getId() {
|
public MovementType getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,9 +14,6 @@ import java.util.Map.Entry;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class ViewBobbingPacketGenerator extends SimpleAssetPacketGenerator<MovementType, ViewBobbing, AssetMap<MovementType, ViewBobbing>> {
|
public class ViewBobbingPacketGenerator extends SimpleAssetPacketGenerator<MovementType, ViewBobbing, AssetMap<MovementType, ViewBobbing>> {
|
||||||
public ViewBobbingPacketGenerator() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public Packet generateInitPacket(AssetMap<MovementType, ViewBobbing> assetMap, @Nonnull Map<MovementType, ViewBobbing> assets) {
|
public Packet generateInitPacket(AssetMap<MovementType, ViewBobbing> assetMap, @Nonnull Map<MovementType, ViewBobbing> assets) {
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ import com.hypixel.hytale.server.core.universe.PlayerRef;
|
|||||||
import com.hypixel.hytale.server.core.universe.world.World;
|
import com.hypixel.hytale.server.core.universe.world.World;
|
||||||
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
|
import javax.annotation.Nullable;
|
||||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
|
||||||
|
|
||||||
public class CameraEffectCommand extends AbstractCommandCollection {
|
public class CameraEffectCommand extends AbstractCommandCollection {
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@@ -52,12 +51,12 @@ public class CameraEffectCommand extends AbstractCommandCollection {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void execute(
|
protected void execute(
|
||||||
@NonNullDecl CommandContext context,
|
@Nonnull CommandContext context,
|
||||||
@NullableDecl Ref<EntityStore> sourceRef,
|
@Nullable Ref<EntityStore> sourceRef,
|
||||||
@NonNullDecl Ref<EntityStore> ref,
|
@Nonnull Ref<EntityStore> ref,
|
||||||
@NonNullDecl PlayerRef playerRef,
|
@Nonnull PlayerRef playerRef,
|
||||||
@NonNullDecl World world,
|
@Nonnull World world,
|
||||||
@NonNullDecl Store<EntityStore> store
|
@Nonnull Store<EntityStore> store
|
||||||
) {
|
) {
|
||||||
DamageCause damageCause = context.get(this.causeArg);
|
DamageCause damageCause = context.get(this.causeArg);
|
||||||
float damageAmount = context.get(this.damageArg);
|
float damageAmount = context.get(this.damageArg);
|
||||||
@@ -95,12 +94,12 @@ public class CameraEffectCommand extends AbstractCommandCollection {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void execute(
|
protected void execute(
|
||||||
@NonNullDecl CommandContext context,
|
@Nonnull CommandContext context,
|
||||||
@NullableDecl Ref<EntityStore> sourceRef,
|
@Nullable Ref<EntityStore> sourceRef,
|
||||||
@NonNullDecl Ref<EntityStore> ref,
|
@Nonnull Ref<EntityStore> ref,
|
||||||
@NonNullDecl PlayerRef playerRef,
|
@Nonnull PlayerRef playerRef,
|
||||||
@NonNullDecl World world,
|
@Nonnull World world,
|
||||||
@NonNullDecl Store<EntityStore> store
|
@Nonnull Store<EntityStore> store
|
||||||
) {
|
) {
|
||||||
CameraEffect cameraEffect = context.get(this.effectArg);
|
CameraEffect cameraEffect = context.get(this.effectArg);
|
||||||
float intensity = context.get(this.intensityArg);
|
float intensity = context.get(this.intensityArg);
|
||||||
|
|||||||
@@ -40,9 +40,6 @@ public class CameraShakeInteraction extends SimpleInstantInteraction {
|
|||||||
protected String effectId;
|
protected String effectId;
|
||||||
protected int effectIndex = Integer.MIN_VALUE;
|
protected int effectIndex = Integer.MIN_VALUE;
|
||||||
|
|
||||||
public CameraShakeInteraction() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void firstRun(@Nonnull InteractionType type, @Nonnull InteractionContext context, @Nonnull CooldownHandler cooldownHandler) {
|
protected void firstRun(@Nonnull InteractionType type, @Nonnull InteractionContext context, @Nonnull CooldownHandler cooldownHandler) {
|
||||||
if (this.effectIndex != Integer.MIN_VALUE) {
|
if (this.effectIndex != Integer.MIN_VALUE) {
|
||||||
|
|||||||
@@ -28,9 +28,6 @@ public class CameraEffectSystem extends DamageEventSystem {
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
private static final Query<EntityStore> QUERY = Query.and(PLAYER_REF_COMPONENT_TYPE, ENTITY_STAT_MAP_COMPONENT_TYPE);
|
private static final Query<EntityStore> QUERY = Query.and(PLAYER_REF_COMPONENT_TYPE, ENTITY_STAT_MAP_COMPONENT_TYPE);
|
||||||
|
|
||||||
public CameraEffectSystem() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public SystemGroup<EntityStore> getGroup() {
|
public SystemGroup<EntityStore> getGroup() {
|
||||||
|
|||||||
@@ -46,11 +46,25 @@ import java.util.UUID;
|
|||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
|
|
||||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
|
||||||
|
|
||||||
public class FarmingSystems {
|
public class FarmingSystems {
|
||||||
public FarmingSystems() {
|
private static boolean hasCropAbove(BlockChunk blockChunk, int x, int y, int z) {
|
||||||
|
if (y + 1 >= 320) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
BlockSection aboveBlockSection = blockChunk.getSectionAtBlockY(y + 1);
|
||||||
|
if (aboveBlockSection == null) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
BlockType aboveBlockType = BlockType.getAssetMap().getAsset(aboveBlockSection.get(x, y + 1, z));
|
||||||
|
if (aboveBlockType == null) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
FarmingData farmingConfig = aboveBlockType.getFarming();
|
||||||
|
return farmingConfig != null && farmingConfig.getStages() != null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean updateSoilDecayTime(CommandBuffer<ChunkStore> commandBuffer, TilledSoilBlock soilBlock, BlockType blockType) {
|
private static boolean updateSoilDecayTime(CommandBuffer<ChunkStore> commandBuffer, TilledSoilBlock soilBlock, BlockType blockType) {
|
||||||
@@ -79,9 +93,6 @@ public class FarmingSystems {
|
|||||||
public static class CoopResidentEntitySystem extends RefSystem<EntityStore> {
|
public static class CoopResidentEntitySystem extends RefSystem<EntityStore> {
|
||||||
private static final ComponentType<EntityStore, CoopResidentComponent> componentType = CoopResidentComponent.getComponentType();
|
private static final ComponentType<EntityStore, CoopResidentComponent> componentType = CoopResidentComponent.getComponentType();
|
||||||
|
|
||||||
public CoopResidentEntitySystem() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Query<EntityStore> getQuery() {
|
public Query<EntityStore> getQuery() {
|
||||||
return componentType;
|
return componentType;
|
||||||
@@ -89,19 +100,13 @@ public class FarmingSystems {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityAdded(
|
public void onEntityAdded(
|
||||||
@NonNullDecl Ref<EntityStore> ref,
|
@Nonnull Ref<EntityStore> ref, @Nonnull AddReason reason, @Nonnull Store<EntityStore> store, @Nonnull CommandBuffer<EntityStore> commandBuffer
|
||||||
@NonNullDecl AddReason reason,
|
|
||||||
@NonNullDecl Store<EntityStore> store,
|
|
||||||
@NonNullDecl CommandBuffer<EntityStore> commandBuffer
|
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityRemove(
|
public void onEntityRemove(
|
||||||
@NonNullDecl Ref<EntityStore> ref,
|
@Nonnull Ref<EntityStore> ref, @Nonnull RemoveReason reason, @Nonnull Store<EntityStore> store, @Nonnull CommandBuffer<EntityStore> commandBuffer
|
||||||
@NonNullDecl RemoveReason reason,
|
|
||||||
@NonNullDecl Store<EntityStore> store,
|
|
||||||
@NonNullDecl CommandBuffer<EntityStore> commandBuffer
|
|
||||||
) {
|
) {
|
||||||
if (reason != RemoveReason.UNLOAD) {
|
if (reason != RemoveReason.UNLOAD) {
|
||||||
UUIDComponent uuidComponent = commandBuffer.getComponent(ref, UUIDComponent.getComponentType());
|
UUIDComponent uuidComponent = commandBuffer.getComponent(ref, UUIDComponent.getComponentType());
|
||||||
@@ -148,9 +153,6 @@ public class FarmingSystems {
|
|||||||
public static class CoopResidentTicking extends EntityTickingSystem<EntityStore> {
|
public static class CoopResidentTicking extends EntityTickingSystem<EntityStore> {
|
||||||
private static final ComponentType<EntityStore, CoopResidentComponent> componentType = CoopResidentComponent.getComponentType();
|
private static final ComponentType<EntityStore, CoopResidentComponent> componentType = CoopResidentComponent.getComponentType();
|
||||||
|
|
||||||
public CoopResidentTicking() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Query<EntityStore> getQuery() {
|
public Query<EntityStore> getQuery() {
|
||||||
return componentType;
|
return componentType;
|
||||||
@@ -160,9 +162,9 @@ public class FarmingSystems {
|
|||||||
public void tick(
|
public void tick(
|
||||||
float dt,
|
float dt,
|
||||||
int index,
|
int index,
|
||||||
@NonNullDecl ArchetypeChunk<EntityStore> archetypeChunk,
|
@Nonnull ArchetypeChunk<EntityStore> archetypeChunk,
|
||||||
@NonNullDecl Store<EntityStore> store,
|
@Nonnull Store<EntityStore> store,
|
||||||
@NonNullDecl CommandBuffer<EntityStore> commandBuffer
|
@Nonnull CommandBuffer<EntityStore> commandBuffer
|
||||||
) {
|
) {
|
||||||
CoopResidentComponent coopResidentComponent = archetypeChunk.getComponent(index, CoopResidentComponent.getComponentType());
|
CoopResidentComponent coopResidentComponent = archetypeChunk.getComponent(index, CoopResidentComponent.getComponentType());
|
||||||
if (coopResidentComponent != null) {
|
if (coopResidentComponent != null) {
|
||||||
@@ -175,9 +177,6 @@ public class FarmingSystems {
|
|||||||
|
|
||||||
@Deprecated(forRemoval = true)
|
@Deprecated(forRemoval = true)
|
||||||
public static class MigrateFarming extends BlockModule.MigrationSystem {
|
public static class MigrateFarming extends BlockModule.MigrationSystem {
|
||||||
public MigrateFarming() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityAdd(@Nonnull Holder<ChunkStore> holder, @Nonnull AddReason reason, @Nonnull Store<ChunkStore> store) {
|
public void onEntityAdd(@Nonnull Holder<ChunkStore> holder, @Nonnull AddReason reason, @Nonnull Store<ChunkStore> store) {
|
||||||
FarmingBlockState oldState = holder.getComponent(FarmingPlugin.get().getFarmingBlockStateComponentType());
|
FarmingBlockState oldState = holder.getComponent(FarmingPlugin.get().getFarmingBlockStateComponentType());
|
||||||
@@ -203,15 +202,9 @@ public class FarmingSystems {
|
|||||||
public static class OnCoopAdded extends RefSystem<ChunkStore> {
|
public static class OnCoopAdded extends RefSystem<ChunkStore> {
|
||||||
private static final Query<ChunkStore> QUERY = Query.and(BlockModule.BlockStateInfo.getComponentType(), CoopBlock.getComponentType());
|
private static final Query<ChunkStore> QUERY = Query.and(BlockModule.BlockStateInfo.getComponentType(), CoopBlock.getComponentType());
|
||||||
|
|
||||||
public OnCoopAdded() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityAdded(
|
public void onEntityAdded(
|
||||||
@NonNullDecl Ref<ChunkStore> ref,
|
@Nonnull Ref<ChunkStore> ref, @Nonnull AddReason reason, @Nonnull Store<ChunkStore> store, @Nonnull CommandBuffer<ChunkStore> commandBuffer
|
||||||
@NonNullDecl AddReason reason,
|
|
||||||
@NonNullDecl Store<ChunkStore> store,
|
|
||||||
@NonNullDecl CommandBuffer<ChunkStore> commandBuffer
|
|
||||||
) {
|
) {
|
||||||
CoopBlock coopBlock = commandBuffer.getComponent(ref, CoopBlock.getComponentType());
|
CoopBlock coopBlock = commandBuffer.getComponent(ref, CoopBlock.getComponentType());
|
||||||
if (coopBlock != null) {
|
if (coopBlock != null) {
|
||||||
@@ -238,10 +231,7 @@ public class FarmingSystems {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityRemove(
|
public void onEntityRemove(
|
||||||
@NonNullDecl Ref<ChunkStore> ref,
|
@Nonnull Ref<ChunkStore> ref, @Nonnull RemoveReason reason, @Nonnull Store<ChunkStore> store, @Nonnull CommandBuffer<ChunkStore> commandBuffer
|
||||||
@NonNullDecl RemoveReason reason,
|
|
||||||
@NonNullDecl Store<ChunkStore> store,
|
|
||||||
@NonNullDecl CommandBuffer<ChunkStore> commandBuffer
|
|
||||||
) {
|
) {
|
||||||
if (reason != RemoveReason.UNLOAD) {
|
if (reason != RemoveReason.UNLOAD) {
|
||||||
CoopBlock coop = commandBuffer.getComponent(ref, CoopBlock.getComponentType());
|
CoopBlock coop = commandBuffer.getComponent(ref, CoopBlock.getComponentType());
|
||||||
@@ -284,7 +274,7 @@ public class FarmingSystems {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@NullableDecl
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public Query<ChunkStore> getQuery() {
|
public Query<ChunkStore> getQuery() {
|
||||||
return QUERY;
|
return QUERY;
|
||||||
@@ -294,9 +284,6 @@ public class FarmingSystems {
|
|||||||
public static class OnFarmBlockAdded extends RefSystem<ChunkStore> {
|
public static class OnFarmBlockAdded extends RefSystem<ChunkStore> {
|
||||||
private static final Query<ChunkStore> QUERY = Query.and(BlockModule.BlockStateInfo.getComponentType(), FarmingBlock.getComponentType());
|
private static final Query<ChunkStore> QUERY = Query.and(BlockModule.BlockStateInfo.getComponentType(), FarmingBlock.getComponentType());
|
||||||
|
|
||||||
public OnFarmBlockAdded() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityAdded(
|
public void onEntityAdded(
|
||||||
@Nonnull Ref<ChunkStore> ref, @Nonnull AddReason reason, @Nonnull Store<ChunkStore> store, @Nonnull CommandBuffer<ChunkStore> commandBuffer
|
@Nonnull Ref<ChunkStore> ref, @Nonnull AddReason reason, @Nonnull Store<ChunkStore> store, @Nonnull CommandBuffer<ChunkStore> commandBuffer
|
||||||
@@ -309,8 +296,8 @@ public class FarmingSystems {
|
|||||||
|
|
||||||
assert info != null;
|
assert info != null;
|
||||||
|
|
||||||
if (farmingBlock.getLastTickGameTime() == null) {
|
|
||||||
BlockChunk blockChunk = commandBuffer.getComponent(info.getChunkRef(), BlockChunk.getComponentType());
|
BlockChunk blockChunk = commandBuffer.getComponent(info.getChunkRef(), BlockChunk.getComponentType());
|
||||||
|
if (farmingBlock.getLastTickGameTime() == null) {
|
||||||
int blockId = blockChunk.getBlock(
|
int blockId = blockChunk.getBlock(
|
||||||
ChunkUtil.xFromBlockInColumn(info.getIndex()), ChunkUtil.yFromBlockInColumn(info.getIndex()), ChunkUtil.zFromBlockInColumn(info.getIndex())
|
ChunkUtil.xFromBlockInColumn(info.getIndex()), ChunkUtil.yFromBlockInColumn(info.getIndex()), ChunkUtil.zFromBlockInColumn(info.getIndex())
|
||||||
);
|
);
|
||||||
@@ -323,6 +310,7 @@ public class FarmingSystems {
|
|||||||
farmingBlock.setLastTickGameTime(
|
farmingBlock.setLastTickGameTime(
|
||||||
store.getExternalData().getWorld().getEntityStore().getStore().getResource(WorldTimeResource.getResourceType()).getGameTime()
|
store.getExternalData().getWorld().getEntityStore().getStore().getResource(WorldTimeResource.getResourceType()).getGameTime()
|
||||||
);
|
);
|
||||||
|
blockChunk.markNeedsSaving();
|
||||||
if (blockType.getFarming().getStages() != null) {
|
if (blockType.getFarming().getStages() != null) {
|
||||||
FarmingStageData[] stages = blockType.getFarming().getStages().get(blockType.getFarming().getStartingStageSet());
|
FarmingStageData[] stages = blockType.getFarming().getStages().get(blockType.getFarming().getStartingStageSet());
|
||||||
if (stages != null && stages.length > 0) {
|
if (stages != null && stages.length > 0) {
|
||||||
@@ -370,6 +358,7 @@ public class FarmingSystems {
|
|||||||
farmingBlock.setLastTickGameTime(
|
farmingBlock.setLastTickGameTime(
|
||||||
store.getExternalData().getWorld().getEntityStore().getStore().getResource(WorldTimeResource.getResourceType()).getGameTime()
|
store.getExternalData().getWorld().getEntityStore().getStore().getResource(WorldTimeResource.getResourceType()).getGameTime()
|
||||||
);
|
);
|
||||||
|
blockChunk.markNeedsSaving();
|
||||||
}
|
}
|
||||||
|
|
||||||
int x = ChunkUtil.xFromBlockInColumn(info.getIndex());
|
int x = ChunkUtil.xFromBlockInColumn(info.getIndex());
|
||||||
@@ -385,7 +374,7 @@ public class FarmingSystems {
|
|||||||
|
|
||||||
Ref<ChunkStore> section = column.getSection(ChunkUtil.chunkCoordinate(y));
|
Ref<ChunkStore> section = column.getSection(ChunkUtil.chunkCoordinate(y));
|
||||||
BlockSection blockSection = commandBuffer.getComponent(section, BlockSection.getComponentType());
|
BlockSection blockSection = commandBuffer.getComponent(section, BlockSection.getComponentType());
|
||||||
FarmingUtil.tickFarming(commandBuffer, blockSection, section, ref, farmingBlock, x, y, z, true);
|
FarmingUtil.tickFarming(commandBuffer, blockChunk, blockSection, section, ref, farmingBlock, x, y, z, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -404,9 +393,6 @@ public class FarmingSystems {
|
|||||||
public static class OnSoilAdded extends RefSystem<ChunkStore> {
|
public static class OnSoilAdded extends RefSystem<ChunkStore> {
|
||||||
private static final Query<ChunkStore> QUERY = Query.and(BlockModule.BlockStateInfo.getComponentType(), TilledSoilBlock.getComponentType());
|
private static final Query<ChunkStore> QUERY = Query.and(BlockModule.BlockStateInfo.getComponentType(), TilledSoilBlock.getComponentType());
|
||||||
|
|
||||||
public OnSoilAdded() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityAdded(
|
public void onEntityAdded(
|
||||||
@Nonnull Ref<ChunkStore> ref, @Nonnull AddReason reason, @Nonnull Store<ChunkStore> store, @Nonnull CommandBuffer<ChunkStore> commandBuffer
|
@Nonnull Ref<ChunkStore> ref, @Nonnull AddReason reason, @Nonnull Store<ChunkStore> store, @Nonnull CommandBuffer<ChunkStore> commandBuffer
|
||||||
@@ -461,9 +447,6 @@ public class FarmingSystems {
|
|||||||
public static class Ticking extends EntityTickingSystem<ChunkStore> {
|
public static class Ticking extends EntityTickingSystem<ChunkStore> {
|
||||||
private static final Query<ChunkStore> QUERY = Query.and(BlockSection.getComponentType(), ChunkSection.getComponentType());
|
private static final Query<ChunkStore> QUERY = Query.and(BlockSection.getComponentType(), ChunkSection.getComponentType());
|
||||||
|
|
||||||
public Ticking() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick(
|
public void tick(
|
||||||
float dt,
|
float dt,
|
||||||
@@ -481,11 +464,16 @@ public class FarmingSystems {
|
|||||||
|
|
||||||
assert section != null;
|
assert section != null;
|
||||||
|
|
||||||
|
if (section.getChunkColumnReference() != null && section.getChunkColumnReference().isValid()) {
|
||||||
BlockComponentChunk blockComponentChunk = commandBuffer.getComponent(section.getChunkColumnReference(), BlockComponentChunk.getComponentType());
|
BlockComponentChunk blockComponentChunk = commandBuffer.getComponent(section.getChunkColumnReference(), BlockComponentChunk.getComponentType());
|
||||||
|
|
||||||
assert blockComponentChunk != null;
|
assert blockComponentChunk != null;
|
||||||
|
|
||||||
Ref<ChunkStore> ref = archetypeChunk.getReferenceTo(index);
|
Ref<ChunkStore> ref = archetypeChunk.getReferenceTo(index);
|
||||||
|
BlockChunk blockChunk = commandBuffer.getComponent(section.getChunkColumnReference(), BlockChunk.getComponentType());
|
||||||
|
|
||||||
|
assert blockChunk != null;
|
||||||
|
|
||||||
blocks.forEachTicking(
|
blocks.forEachTicking(
|
||||||
blockComponentChunk, commandBuffer, section.getY(), (blockComponentChunk1, commandBuffer1, localX, localY, localZ, blockId) -> {
|
blockComponentChunk, commandBuffer, section.getY(), (blockComponentChunk1, commandBuffer1, localX, localY, localZ, blockId) -> {
|
||||||
Ref<ChunkStore> blockRef = blockComponentChunk1.getEntityReference(ChunkUtil.indexBlockInColumn(localX, localY, localZ));
|
Ref<ChunkStore> blockRef = blockComponentChunk1.getEntityReference(ChunkUtil.indexBlockInColumn(localX, localY, localZ));
|
||||||
@@ -494,7 +482,7 @@ public class FarmingSystems {
|
|||||||
} else {
|
} else {
|
||||||
FarmingBlock farming = commandBuffer1.getComponent(blockRef, FarmingBlock.getComponentType());
|
FarmingBlock farming = commandBuffer1.getComponent(blockRef, FarmingBlock.getComponentType());
|
||||||
if (farming != null) {
|
if (farming != null) {
|
||||||
FarmingUtil.tickFarming(commandBuffer1, blocks, ref, blockRef, farming, localX, localY, localZ, false);
|
FarmingUtil.tickFarming(commandBuffer1, blockChunk, blocks, ref, blockRef, farming, localX, localY, localZ, false);
|
||||||
return BlockTickStrategy.SLEEP;
|
return BlockTickStrategy.SLEEP;
|
||||||
} else {
|
} else {
|
||||||
TilledSoilBlock soil = commandBuffer1.getComponent(blockRef, TilledSoilBlock.getComponentType());
|
TilledSoilBlock soil = commandBuffer1.getComponent(blockRef, TilledSoilBlock.getComponentType());
|
||||||
@@ -516,6 +504,7 @@ public class FarmingSystems {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void tickSoil(
|
private static void tickSoil(
|
||||||
CommandBuffer<ChunkStore> commandBuffer, BlockComponentChunk blockComponentChunk, Ref<ChunkStore> blockRef, TilledSoilBlock soilBlock
|
CommandBuffer<ChunkStore> commandBuffer, BlockComponentChunk blockComponentChunk, Ref<ChunkStore> blockRef, TilledSoilBlock soilBlock
|
||||||
@@ -528,14 +517,6 @@ public class FarmingSystems {
|
|||||||
int y = ChunkUtil.yFromBlockInColumn(info.getIndex());
|
int y = ChunkUtil.yFromBlockInColumn(info.getIndex());
|
||||||
int z = ChunkUtil.zFromBlockInColumn(info.getIndex());
|
int z = ChunkUtil.zFromBlockInColumn(info.getIndex());
|
||||||
if (y < 320) {
|
if (y < 320) {
|
||||||
int checkIndex = ChunkUtil.indexBlockInColumn(x, y + 1, z);
|
|
||||||
Ref<ChunkStore> aboveBlockRef = blockComponentChunk.getEntityReference(checkIndex);
|
|
||||||
boolean hasCrop = false;
|
|
||||||
if (aboveBlockRef != null) {
|
|
||||||
FarmingBlock farmingBlock = commandBuffer.getComponent(aboveBlockRef, FarmingBlock.getComponentType());
|
|
||||||
hasCrop = farmingBlock != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert info.getChunkRef() != null;
|
assert info.getChunkRef() != null;
|
||||||
|
|
||||||
BlockChunk blockChunk = commandBuffer.getComponent(info.getChunkRef(), BlockChunk.getComponentType());
|
BlockChunk blockChunk = commandBuffer.getComponent(info.getChunkRef(), BlockChunk.getComponentType());
|
||||||
@@ -543,6 +524,7 @@ public class FarmingSystems {
|
|||||||
assert blockChunk != null;
|
assert blockChunk != null;
|
||||||
|
|
||||||
BlockSection blockSection = blockChunk.getSectionAtBlockY(y);
|
BlockSection blockSection = blockChunk.getSectionAtBlockY(y);
|
||||||
|
boolean hasCrop = FarmingSystems.hasCropAbove(blockChunk, x, y, z);
|
||||||
BlockType blockType = BlockType.getAssetMap().getAsset(blockSection.get(x, y, z));
|
BlockType blockType = BlockType.getAssetMap().getAsset(blockSection.get(x, y, z));
|
||||||
Instant currentTime = commandBuffer.getExternalData()
|
Instant currentTime = commandBuffer.getExternalData()
|
||||||
.getWorld()
|
.getWorld()
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import com.hypixel.hytale.server.core.modules.entity.component.PersistentModel;
|
|||||||
import com.hypixel.hytale.server.core.modules.interaction.BlockHarvestUtils;
|
import com.hypixel.hytale.server.core.modules.interaction.BlockHarvestUtils;
|
||||||
import com.hypixel.hytale.server.core.modules.time.WorldTimeResource;
|
import com.hypixel.hytale.server.core.modules.time.WorldTimeResource;
|
||||||
import com.hypixel.hytale.server.core.universe.world.World;
|
import com.hypixel.hytale.server.core.universe.world.World;
|
||||||
|
import com.hypixel.hytale.server.core.universe.world.chunk.BlockChunk;
|
||||||
import com.hypixel.hytale.server.core.universe.world.chunk.BlockComponentChunk;
|
import com.hypixel.hytale.server.core.universe.world.chunk.BlockComponentChunk;
|
||||||
import com.hypixel.hytale.server.core.universe.world.chunk.WorldChunk;
|
import com.hypixel.hytale.server.core.universe.world.chunk.WorldChunk;
|
||||||
import com.hypixel.hytale.server.core.universe.world.chunk.section.BlockSection;
|
import com.hypixel.hytale.server.core.universe.world.chunk.section.BlockSection;
|
||||||
@@ -35,17 +36,15 @@ import com.hypixel.hytale.server.npc.metadata.CapturedNPCMetadata;
|
|||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class FarmingUtil {
|
public class FarmingUtil {
|
||||||
private static final int MAX_SECONDS_BETWEEN_TICKS = 15;
|
private static final int MAX_SECONDS_BETWEEN_TICKS = 15;
|
||||||
private static final int BETWEEN_RANDOM = 10;
|
private static final int BETWEEN_RANDOM = 10;
|
||||||
|
|
||||||
public FarmingUtil() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void tickFarming(
|
public static void tickFarming(
|
||||||
CommandBuffer<ChunkStore> commandBuffer,
|
CommandBuffer<ChunkStore> commandBuffer,
|
||||||
|
BlockChunk blockChunk,
|
||||||
BlockSection blockSection,
|
BlockSection blockSection,
|
||||||
Ref<ChunkStore> sectionRef,
|
Ref<ChunkStore> sectionRef,
|
||||||
Ref<ChunkStore> blockRef,
|
Ref<ChunkStore> blockRef,
|
||||||
@@ -68,7 +67,18 @@ public class FarmingUtil {
|
|||||||
float currentProgress = farmingBlock.getGrowthProgress();
|
float currentProgress = farmingBlock.getGrowthProgress();
|
||||||
int currentStage = (int)currentProgress;
|
int currentStage = (int)currentProgress;
|
||||||
String currentStageSet = farmingBlock.getCurrentStageSet();
|
String currentStageSet = farmingBlock.getCurrentStageSet();
|
||||||
FarmingStageData[] stages = farmingConfig.getStages().get(currentStageSet);
|
FarmingStageData[] stages = currentStageSet != null ? farmingConfig.getStages().get(currentStageSet) : null;
|
||||||
|
if (stages == null) {
|
||||||
|
currentStageSet = farmingConfig.getStartingStageSet();
|
||||||
|
if (currentStageSet == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
farmingBlock.setCurrentStageSet(currentStageSet);
|
||||||
|
stages = farmingConfig.getStages().get(currentStageSet);
|
||||||
|
blockChunk.markNeedsSaving();
|
||||||
|
}
|
||||||
|
|
||||||
if (stages != null) {
|
if (stages != null) {
|
||||||
if (currentStage < 0) {
|
if (currentStage < 0) {
|
||||||
currentStage = 0;
|
currentStage = 0;
|
||||||
@@ -88,6 +98,7 @@ public class FarmingUtil {
|
|||||||
while (currentStage < stages.length) {
|
while (currentStage < stages.length) {
|
||||||
FarmingStageData stage = stages[currentStage];
|
FarmingStageData stage = stages[currentStage];
|
||||||
if (stage.shouldStop(commandBuffer, sectionRef, blockRef, x, y, z)) {
|
if (stage.shouldStop(commandBuffer, sectionRef, blockRef, x, y, z)) {
|
||||||
|
blockChunk.markNeedsSaving();
|
||||||
farmingBlock.setGrowthProgress(stages.length);
|
farmingBlock.setGrowthProgress(stages.length);
|
||||||
commandBuffer.removeEntity(blockRef, RemoveReason.REMOVE);
|
commandBuffer.removeEntity(blockRef, RemoveReason.REMOVE);
|
||||||
break;
|
break;
|
||||||
@@ -95,6 +106,7 @@ public class FarmingUtil {
|
|||||||
|
|
||||||
Rangef range = stage.getDuration();
|
Rangef range = stage.getDuration();
|
||||||
if (range == null) {
|
if (range == null) {
|
||||||
|
blockChunk.markNeedsSaving();
|
||||||
commandBuffer.removeEntity(blockRef, RemoveReason.REMOVE);
|
commandBuffer.removeEntity(blockRef, RemoveReason.REMOVE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -131,6 +143,7 @@ public class FarmingUtil {
|
|||||||
remainingTimeSeconds -= remainingDurationSeconds;
|
remainingTimeSeconds -= remainingDurationSeconds;
|
||||||
currentProgress = ++currentStage;
|
currentProgress = ++currentStage;
|
||||||
farmingBlock.setGrowthProgress(currentProgress);
|
farmingBlock.setGrowthProgress(currentProgress);
|
||||||
|
blockChunk.markNeedsSaving();
|
||||||
farmingBlock.setGeneration(farmingBlock.getGeneration() + 1);
|
farmingBlock.setGeneration(farmingBlock.getGeneration() + 1);
|
||||||
if (currentStage >= stages.length) {
|
if (currentStage >= stages.length) {
|
||||||
if (stages[currentStage - 1].implementsShouldStop()) {
|
if (stages[currentStage - 1].implementsShouldStop()) {
|
||||||
@@ -168,8 +181,10 @@ public class FarmingUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@NullableDecl
|
@Nullable
|
||||||
public static CapturedNPCMetadata generateCapturedNPCMetadata(ComponentAccessor<EntityStore> componentAccessor, Ref<EntityStore> entityRef, int roleIndex) {
|
public static CapturedNPCMetadata generateCapturedNPCMetadata(
|
||||||
|
@Nonnull ComponentAccessor<EntityStore> componentAccessor, @Nonnull Ref<EntityStore> entityRef, int roleIndex
|
||||||
|
) {
|
||||||
PersistentModel persistentModel = componentAccessor.getComponent(entityRef, PersistentModel.getComponentType());
|
PersistentModel persistentModel = componentAccessor.getComponent(entityRef, PersistentModel.getComponentType());
|
||||||
if (persistentModel == null) {
|
if (persistentModel == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import com.hypixel.hytale.component.Component;
|
|||||||
import com.hypixel.hytale.component.ComponentType;
|
import com.hypixel.hytale.component.ComponentType;
|
||||||
import com.hypixel.hytale.math.vector.Vector3i;
|
import com.hypixel.hytale.math.vector.Vector3i;
|
||||||
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
||||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class CoopResidentComponent implements Component<EntityStore> {
|
public class CoopResidentComponent implements Component<EntityStore> {
|
||||||
public static final BuilderCodec<CoopResidentComponent> CODEC = BuilderCodec.builder(CoopResidentComponent.class, CoopResidentComponent::new)
|
public static final BuilderCodec<CoopResidentComponent> CODEC = BuilderCodec.builder(CoopResidentComponent.class, CoopResidentComponent::new)
|
||||||
@@ -23,9 +23,6 @@ public class CoopResidentComponent implements Component<EntityStore> {
|
|||||||
private Vector3i coopLocation = new Vector3i();
|
private Vector3i coopLocation = new Vector3i();
|
||||||
private boolean markedForDespawn;
|
private boolean markedForDespawn;
|
||||||
|
|
||||||
public CoopResidentComponent() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ComponentType<EntityStore, CoopResidentComponent> getComponentType() {
|
public static ComponentType<EntityStore, CoopResidentComponent> getComponentType() {
|
||||||
return FarmingPlugin.get().getCoopResidentComponentType();
|
return FarmingPlugin.get().getCoopResidentComponentType();
|
||||||
}
|
}
|
||||||
@@ -46,7 +43,7 @@ public class CoopResidentComponent implements Component<EntityStore> {
|
|||||||
return this.markedForDespawn;
|
return this.markedForDespawn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NullableDecl
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public Component<EntityStore> clone() {
|
public Component<EntityStore> clone() {
|
||||||
CoopResidentComponent component = new CoopResidentComponent();
|
CoopResidentComponent component = new CoopResidentComponent();
|
||||||
|
|||||||
@@ -16,9 +16,6 @@ public class FertilizerGrowthModifierAsset extends GrowthModifierAsset {
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public FertilizerGrowthModifierAsset() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getCurrentGrowthMultiplier(
|
public double getCurrentGrowthMultiplier(
|
||||||
CommandBuffer<ChunkStore> commandBuffer, Ref<ChunkStore> sectionRef, Ref<ChunkStore> blockRef, int x, int y, int z, boolean initialTick
|
CommandBuffer<ChunkStore> commandBuffer, Ref<ChunkStore> sectionRef, Ref<ChunkStore> blockRef, int x, int y, int z, boolean initialTick
|
||||||
|
|||||||
@@ -37,9 +37,6 @@ public class LightLevelGrowthModifierAsset extends GrowthModifierAsset {
|
|||||||
protected Rangef sunlight;
|
protected Rangef sunlight;
|
||||||
protected boolean requireBoth;
|
protected boolean requireBoth;
|
||||||
|
|
||||||
public LightLevelGrowthModifierAsset() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public LightLevelGrowthModifierAsset.ArtificialLight getArtificialLight() {
|
public LightLevelGrowthModifierAsset.ArtificialLight getArtificialLight() {
|
||||||
return this.artificialLight;
|
return this.artificialLight;
|
||||||
}
|
}
|
||||||
@@ -131,9 +128,6 @@ public class LightLevelGrowthModifierAsset extends GrowthModifierAsset {
|
|||||||
protected Range green;
|
protected Range green;
|
||||||
protected Range blue;
|
protected Range blue;
|
||||||
|
|
||||||
public ArtificialLight() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Range getRed() {
|
public Range getRed() {
|
||||||
return this.red;
|
return this.red;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,9 +62,6 @@ public class WaterGrowthModifierAsset extends GrowthModifierAsset {
|
|||||||
protected IntOpenHashSet weatherIds;
|
protected IntOpenHashSet weatherIds;
|
||||||
protected int rainDuration;
|
protected int rainDuration;
|
||||||
|
|
||||||
public WaterGrowthModifierAsset() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String[] getFluids() {
|
public String[] getFluids() {
|
||||||
return this.fluids;
|
return this.fluids;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,9 +23,6 @@ public class BlockStateFarmingStageData extends FarmingStageData {
|
|||||||
.build();
|
.build();
|
||||||
protected String state;
|
protected String state;
|
||||||
|
|
||||||
public BlockStateFarmingStageData() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getState() {
|
public String getState() {
|
||||||
return this.state;
|
return this.state;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,9 +24,6 @@ public class BlockTypeFarmingStageData extends FarmingStageData {
|
|||||||
.build();
|
.build();
|
||||||
protected String block;
|
protected String block;
|
||||||
|
|
||||||
public BlockTypeFarmingStageData() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBlock() {
|
public String getBlock() {
|
||||||
return this.block;
|
return this.block;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,9 +71,6 @@ public class PrefabFarmingStageData extends FarmingStageData {
|
|||||||
private String[] replaceMaskTags = EMPTY_REPLACE_MASK;
|
private String[] replaceMaskTags = EMPTY_REPLACE_MASK;
|
||||||
private int[] replaceMaskTagIndices;
|
private int[] replaceMaskTagIndices;
|
||||||
|
|
||||||
public PrefabFarmingStageData() {
|
|
||||||
}
|
|
||||||
|
|
||||||
private static double computeParticlesRate(@Nonnull IPrefabBuffer prefab) {
|
private static double computeParticlesRate(@Nonnull IPrefabBuffer prefab) {
|
||||||
double xLength = prefab.getMaxX() - prefab.getMinX();
|
double xLength = prefab.getMaxX() - prefab.getMinX();
|
||||||
double yLength = prefab.getMaxY() - prefab.getMinY();
|
double yLength = prefab.getMaxY() - prefab.getMinY();
|
||||||
@@ -350,9 +347,6 @@ public class PrefabFarmingStageData extends FarmingStageData {
|
|||||||
protected int weight = 1;
|
protected int weight = 1;
|
||||||
protected String path;
|
protected String path;
|
||||||
|
|
||||||
public PrefabStage() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getWeight() {
|
public double getWeight() {
|
||||||
return this.weight;
|
return this.weight;
|
||||||
|
|||||||
@@ -74,9 +74,6 @@ public class DirectionalGrowthBehaviour extends SpreadGrowthBehaviour {
|
|||||||
protected IntRange verticalRange;
|
protected IntRange verticalRange;
|
||||||
protected DirectionalGrowthBehaviour.VerticalDirection verticalDirection = DirectionalGrowthBehaviour.VerticalDirection.BOTH;
|
protected DirectionalGrowthBehaviour.VerticalDirection verticalDirection = DirectionalGrowthBehaviour.VerticalDirection.BOTH;
|
||||||
|
|
||||||
public DirectionalGrowthBehaviour() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public IWeightedMap<DirectionalGrowthBehaviour.BlockTypeWeight> getBlockTypes() {
|
public IWeightedMap<DirectionalGrowthBehaviour.BlockTypeWeight> getBlockTypes() {
|
||||||
return this.blockTypes;
|
return this.blockTypes;
|
||||||
}
|
}
|
||||||
@@ -236,9 +233,6 @@ public class DirectionalGrowthBehaviour extends SpreadGrowthBehaviour {
|
|||||||
protected double weight = 1.0;
|
protected double weight = 1.0;
|
||||||
protected String blockTypeKey;
|
protected String blockTypeKey;
|
||||||
|
|
||||||
public BlockTypeWeight() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getWeight() {
|
public double getWeight() {
|
||||||
return this.weight;
|
return this.weight;
|
||||||
|
|||||||
@@ -66,9 +66,6 @@ public class SpreadFarmingStageData extends FarmingStageData {
|
|||||||
protected IntRange spreadDecayPercent;
|
protected IntRange spreadDecayPercent;
|
||||||
protected SpreadGrowthBehaviour[] spreadGrowthBehaviours;
|
protected SpreadGrowthBehaviour[] spreadGrowthBehaviours;
|
||||||
|
|
||||||
public SpreadFarmingStageData() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public IntRange getExecutions() {
|
public IntRange getExecutions() {
|
||||||
return this.executions;
|
return this.executions;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,9 +23,6 @@ public abstract class SpreadGrowthBehaviour {
|
|||||||
.build();
|
.build();
|
||||||
protected WorldLocationCondition[] worldLocationConditions;
|
protected WorldLocationCondition[] worldLocationConditions;
|
||||||
|
|
||||||
public SpreadGrowthBehaviour() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void execute(ComponentAccessor<ChunkStore> var1, Ref<ChunkStore> var2, Ref<ChunkStore> var3, int var4, int var5, int var6, float var7);
|
public abstract void execute(ComponentAccessor<ChunkStore> var1, Ref<ChunkStore> var2, Ref<ChunkStore> var3, int var4, int var5, int var6, float var7);
|
||||||
|
|
||||||
protected boolean validatePosition(World world, int worldX, int worldY, int worldZ) {
|
protected boolean validatePosition(World world, int worldX, int worldY, int worldZ) {
|
||||||
|
|||||||
@@ -81,9 +81,6 @@ public class ChangeFarmingStageInteraction extends SimpleBlockInteraction {
|
|||||||
@Nullable
|
@Nullable
|
||||||
protected String targetStageSet = null;
|
protected String targetStageSet = null;
|
||||||
|
|
||||||
public ChangeFarmingStageInteraction() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public WaitForDataFrom getWaitForDataFrom() {
|
public WaitForDataFrom getWaitForDataFrom() {
|
||||||
|
|||||||
@@ -38,9 +38,6 @@ public class FertilizeSoilInteraction extends SimpleBlockInteraction {
|
|||||||
.build();
|
.build();
|
||||||
protected String[] refreshModifiers;
|
protected String[] refreshModifiers;
|
||||||
|
|
||||||
public FertilizeSoilInteraction() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public WaitForDataFrom getWaitForDataFrom() {
|
public WaitForDataFrom getWaitForDataFrom() {
|
||||||
|
|||||||
@@ -28,9 +28,6 @@ public class HarvestCropInteraction extends SimpleBlockInteraction {
|
|||||||
.documentation("Harvests the resources from the target farmable block.")
|
.documentation("Harvests the resources from the target farmable block.")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public HarvestCropInteraction() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void interactWithBlock(
|
protected void interactWithBlock(
|
||||||
@Nonnull World world,
|
@Nonnull World world,
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
|||||||
import com.hypixel.hytale.server.npc.NPCPlugin;
|
import com.hypixel.hytale.server.npc.NPCPlugin;
|
||||||
import com.hypixel.hytale.server.npc.entities.NPCEntity;
|
import com.hypixel.hytale.server.npc.entities.NPCEntity;
|
||||||
import com.hypixel.hytale.server.npc.metadata.CapturedNPCMetadata;
|
import com.hypixel.hytale.server.npc.metadata.CapturedNPCMetadata;
|
||||||
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
|
import javax.annotation.Nonnull;
|
||||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class UseCaptureCrateInteraction extends SimpleBlockInteraction {
|
public class UseCaptureCrateInteraction extends SimpleBlockInteraction {
|
||||||
public static final BuilderCodec<UseCaptureCrateInteraction> CODEC = BuilderCodec.builder(
|
public static final BuilderCodec<UseCaptureCrateInteraction> CODEC = BuilderCodec.builder(
|
||||||
@@ -69,12 +69,9 @@ public class UseCaptureCrateInteraction extends SimpleBlockInteraction {
|
|||||||
protected int[] acceptedNpcGroupIndexes;
|
protected int[] acceptedNpcGroupIndexes;
|
||||||
protected String fullIcon;
|
protected String fullIcon;
|
||||||
|
|
||||||
public UseCaptureCrateInteraction() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tick0(
|
protected void tick0(
|
||||||
boolean firstRun, float time, @NonNullDecl InteractionType type, @NonNullDecl InteractionContext context, @NonNullDecl CooldownHandler cooldownHandler
|
boolean firstRun, float time, @Nonnull InteractionType type, @Nonnull InteractionContext context, @Nonnull CooldownHandler cooldownHandler
|
||||||
) {
|
) {
|
||||||
CommandBuffer<EntityStore> commandBuffer = context.getCommandBuffer();
|
CommandBuffer<EntityStore> commandBuffer = context.getCommandBuffer();
|
||||||
if (commandBuffer == null) {
|
if (commandBuffer == null) {
|
||||||
@@ -84,11 +81,13 @@ public class UseCaptureCrateInteraction extends SimpleBlockInteraction {
|
|||||||
if (item == null) {
|
if (item == null) {
|
||||||
context.getState().state = InteractionState.Failed;
|
context.getState().state = InteractionState.Failed;
|
||||||
} else {
|
} else {
|
||||||
Ref<EntityStore> playerRef = context.getEntity();
|
Ref<EntityStore> ref = context.getEntity();
|
||||||
LivingEntity playerEntity = (LivingEntity)EntityUtils.getEntity(playerRef, commandBuffer);
|
if (!(EntityUtils.getEntity(ref, commandBuffer) instanceof LivingEntity livingEntity)) {
|
||||||
Inventory playerInventory = playerEntity.getInventory();
|
context.getState().state = InteractionState.Failed;
|
||||||
byte activeHotbarSlot = playerInventory.getActiveHotbarSlot();
|
} else {
|
||||||
ItemStack inHandItemStack = playerInventory.getActiveHotbarItem();
|
Inventory inventory = livingEntity.getInventory();
|
||||||
|
byte activeHotbarSlot = inventory.getActiveHotbarSlot();
|
||||||
|
ItemStack inHandItemStack = inventory.getActiveHotbarItem();
|
||||||
CapturedNPCMetadata existingMeta = item.getFromMetadataOrNull("CapturedEntity", CapturedNPCMetadata.CODEC);
|
CapturedNPCMetadata existingMeta = item.getFromMetadataOrNull("CapturedEntity", CapturedNPCMetadata.CODEC);
|
||||||
if (existingMeta != null) {
|
if (existingMeta != null) {
|
||||||
super.tick0(firstRun, time, type, context, cooldownHandler);
|
super.tick0(firstRun, time, type, context, cooldownHandler);
|
||||||
@@ -97,15 +96,15 @@ public class UseCaptureCrateInteraction extends SimpleBlockInteraction {
|
|||||||
if (targetEntity == null) {
|
if (targetEntity == null) {
|
||||||
context.getState().state = InteractionState.Failed;
|
context.getState().state = InteractionState.Failed;
|
||||||
} else {
|
} else {
|
||||||
NPCEntity npc = commandBuffer.getComponent(targetEntity, NPCEntity.getComponentType());
|
NPCEntity npcComponent = commandBuffer.getComponent(targetEntity, NPCEntity.getComponentType());
|
||||||
if (npc == null) {
|
if (npcComponent == null) {
|
||||||
context.getState().state = InteractionState.Failed;
|
context.getState().state = InteractionState.Failed;
|
||||||
} else {
|
} else {
|
||||||
TagSetPlugin.TagSetLookup tagSetPlugin = TagSetPlugin.get(NPCGroup.class);
|
TagSetPlugin.TagSetLookup tagSetPlugin = TagSetPlugin.get(NPCGroup.class);
|
||||||
boolean tagFound = false;
|
boolean tagFound = false;
|
||||||
|
|
||||||
for (int group : this.acceptedNpcGroupIndexes) {
|
for (int group : this.acceptedNpcGroupIndexes) {
|
||||||
if (tagSetPlugin.tagInSet(group, npc.getRoleIndex())) {
|
if (tagSetPlugin.tagInSet(group, npcComponent.getRoleIndex())) {
|
||||||
tagFound = true;
|
tagFound = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -124,8 +123,8 @@ public class UseCaptureCrateInteraction extends SimpleBlockInteraction {
|
|||||||
meta.setIconPath(modelAsset.getIcon());
|
meta.setIconPath(modelAsset.getIcon());
|
||||||
}
|
}
|
||||||
|
|
||||||
meta.setRoleIndex(npc.getRoleIndex());
|
meta.setRoleIndex(npcComponent.getRoleIndex());
|
||||||
String npcName = NPCPlugin.get().getName(npc.getRoleIndex());
|
String npcName = NPCPlugin.get().getName(npcComponent.getRoleIndex());
|
||||||
if (npcName != null) {
|
if (npcName != null) {
|
||||||
meta.setNpcNameKey(npcName);
|
meta.setNpcNameKey(npcName);
|
||||||
}
|
}
|
||||||
@@ -135,7 +134,7 @@ public class UseCaptureCrateInteraction extends SimpleBlockInteraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ItemStack itemWithNPC = inHandItemStack.withMetadata(CapturedNPCMetadata.KEYED_CODEC, meta);
|
ItemStack itemWithNPC = inHandItemStack.withMetadata(CapturedNPCMetadata.KEYED_CODEC, meta);
|
||||||
playerInventory.getHotbar().replaceItemStackInSlot(activeHotbarSlot, item, itemWithNPC);
|
inventory.getHotbar().replaceItemStackInSlot(activeHotbarSlot, item, itemWithNPC);
|
||||||
commandBuffer.removeEntity(targetEntity, RemoveReason.REMOVE);
|
commandBuffer.removeEntity(targetEntity, RemoveReason.REMOVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,25 +144,26 @@ public class UseCaptureCrateInteraction extends SimpleBlockInteraction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void interactWithBlock(
|
protected void interactWithBlock(
|
||||||
@NonNullDecl World world,
|
@Nonnull World world,
|
||||||
@NonNullDecl CommandBuffer<EntityStore> commandBuffer,
|
@Nonnull CommandBuffer<EntityStore> commandBuffer,
|
||||||
@NonNullDecl InteractionType type,
|
@Nonnull InteractionType type,
|
||||||
@NonNullDecl InteractionContext context,
|
@Nonnull InteractionContext context,
|
||||||
@NullableDecl ItemStack itemInHand,
|
@Nullable ItemStack itemInHand,
|
||||||
@NonNullDecl Vector3i targetBlock,
|
@Nonnull Vector3i targetBlock,
|
||||||
@NonNullDecl CooldownHandler cooldownHandler
|
@Nonnull CooldownHandler cooldownHandler
|
||||||
) {
|
) {
|
||||||
ItemStack item = context.getHeldItem();
|
ItemStack item = context.getHeldItem();
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
context.getState().state = InteractionState.Failed;
|
context.getState().state = InteractionState.Failed;
|
||||||
} else {
|
} else {
|
||||||
Ref<EntityStore> playerRef = context.getEntity();
|
Ref<EntityStore> ref = context.getEntity();
|
||||||
LivingEntity playerEntity = (LivingEntity)EntityUtils.getEntity(playerRef, commandBuffer);
|
if (EntityUtils.getEntity(ref, commandBuffer) instanceof LivingEntity livingEntity) {
|
||||||
Inventory playerInventory = playerEntity.getInventory();
|
Inventory inventory = livingEntity.getInventory();
|
||||||
byte activeHotbarSlot = playerInventory.getActiveHotbarSlot();
|
byte activeHotbarSlot = inventory.getActiveHotbarSlot();
|
||||||
CapturedNPCMetadata existingMeta = item.getFromMetadataOrNull("CapturedEntity", CapturedNPCMetadata.CODEC);
|
CapturedNPCMetadata existingMeta = item.getFromMetadataOrNull("CapturedEntity", CapturedNPCMetadata.CODEC);
|
||||||
if (existingMeta == null) {
|
if (existingMeta == null) {
|
||||||
context.getState().state = InteractionState.Failed;
|
context.getState().state = InteractionState.Failed;
|
||||||
@@ -190,7 +190,7 @@ public class UseCaptureCrateInteraction extends SimpleBlockInteraction {
|
|||||||
world, world.getEntityStore().getStore(), new Vector3d(pos.x, pos.y, pos.z), new Vector3d().assign(Vector3d.FORWARD)
|
world, world.getEntityStore().getStore(), new Vector3d(pos.x, pos.y, pos.z), new Vector3d().assign(Vector3d.FORWARD)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
playerInventory.getHotbar().replaceItemStackInSlot(activeHotbarSlot, item, noMetaItemStack);
|
inventory.getHotbar().replaceItemStackInSlot(activeHotbarSlot, item, noMetaItemStack);
|
||||||
} else {
|
} else {
|
||||||
context.getState().state = InteractionState.Failed;
|
context.getState().state = InteractionState.Failed;
|
||||||
}
|
}
|
||||||
@@ -211,19 +211,18 @@ public class UseCaptureCrateInteraction extends SimpleBlockInteraction {
|
|||||||
Store<EntityStore> store = context.getCommandBuffer().getStore();
|
Store<EntityStore> store = context.getCommandBuffer().getStore();
|
||||||
int roleIndex = existingMeta.getRoleIndex();
|
int roleIndex = existingMeta.getRoleIndex();
|
||||||
commandBuffer.run(_store -> npcModule.spawnEntity(store, roleIndex, spawnPos, Vector3f.ZERO, null, null));
|
commandBuffer.run(_store -> npcModule.spawnEntity(store, roleIndex, spawnPos, Vector3f.ZERO, null, null));
|
||||||
playerInventory.getHotbar().replaceItemStackInSlot(activeHotbarSlot, item, noMetaItemStack);
|
inventory.getHotbar().replaceItemStackInSlot(activeHotbarSlot, item, noMetaItemStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
context.getState().state = InteractionState.Failed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void simulateInteractWithBlock(
|
protected void simulateInteractWithBlock(
|
||||||
@NonNullDecl InteractionType type,
|
@Nonnull InteractionType type, @Nonnull InteractionContext context, @Nullable ItemStack itemInHand, @Nonnull World world, @Nonnull Vector3i targetBlock
|
||||||
@NonNullDecl InteractionContext context,
|
|
||||||
@NullableDecl ItemStack itemInHand,
|
|
||||||
@NonNullDecl World world,
|
|
||||||
@NonNullDecl Vector3i targetBlock
|
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ import com.hypixel.hytale.server.core.universe.world.World;
|
|||||||
import com.hypixel.hytale.server.core.universe.world.chunk.WorldChunk;
|
import com.hypixel.hytale.server.core.universe.world.chunk.WorldChunk;
|
||||||
import com.hypixel.hytale.server.core.universe.world.storage.ChunkStore;
|
import com.hypixel.hytale.server.core.universe.world.storage.ChunkStore;
|
||||||
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
||||||
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
|
import javax.annotation.Nonnull;
|
||||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class UseCoopInteraction extends SimpleBlockInteraction {
|
public class UseCoopInteraction extends SimpleBlockInteraction {
|
||||||
public static final BuilderCodec<UseCoopInteraction> CODEC = BuilderCodec.builder(
|
public static final BuilderCodec<UseCoopInteraction> CODEC = BuilderCodec.builder(
|
||||||
@@ -31,18 +31,15 @@ public class UseCoopInteraction extends SimpleBlockInteraction {
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public UseCoopInteraction() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void interactWithBlock(
|
protected void interactWithBlock(
|
||||||
@NonNullDecl World world,
|
@Nonnull World world,
|
||||||
@NonNullDecl CommandBuffer<EntityStore> commandBuffer,
|
@Nonnull CommandBuffer<EntityStore> commandBuffer,
|
||||||
@NonNullDecl InteractionType type,
|
@Nonnull InteractionType type,
|
||||||
@NonNullDecl InteractionContext context,
|
@Nonnull InteractionContext context,
|
||||||
@NullableDecl ItemStack itemInHand,
|
@Nullable ItemStack itemInHand,
|
||||||
@NonNullDecl Vector3i targetBlock,
|
@Nonnull Vector3i targetBlock,
|
||||||
@NonNullDecl CooldownHandler cooldownHandler
|
@Nonnull CooldownHandler cooldownHandler
|
||||||
) {
|
) {
|
||||||
int x = targetBlock.getX();
|
int x = targetBlock.getX();
|
||||||
int z = targetBlock.getZ();
|
int z = targetBlock.getZ();
|
||||||
@@ -85,11 +82,7 @@ public class UseCoopInteraction extends SimpleBlockInteraction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void simulateInteractWithBlock(
|
protected void simulateInteractWithBlock(
|
||||||
@NonNullDecl InteractionType type,
|
@Nonnull InteractionType type, @Nonnull InteractionContext context, @Nullable ItemStack itemInHand, @Nonnull World world, @Nonnull Vector3i targetBlock
|
||||||
@NonNullDecl InteractionContext context,
|
|
||||||
@NullableDecl ItemStack itemInHand,
|
|
||||||
@NonNullDecl World world,
|
|
||||||
@NonNullDecl Vector3i targetBlock
|
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,9 +43,6 @@ public class UseWateringCanInteraction extends SimpleBlockInteraction {
|
|||||||
protected long duration;
|
protected long duration;
|
||||||
protected String[] refreshModifiers;
|
protected String[] refreshModifiers;
|
||||||
|
|
||||||
public UseWateringCanInteraction() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public WaitForDataFrom getWaitForDataFrom() {
|
public WaitForDataFrom getWaitForDataFrom() {
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import com.hypixel.hytale.server.spawning.ISpawnableWithModel;
|
|||||||
import com.hypixel.hytale.server.spawning.SpawnTestResult;
|
import com.hypixel.hytale.server.spawning.SpawnTestResult;
|
||||||
import com.hypixel.hytale.server.spawning.SpawningContext;
|
import com.hypixel.hytale.server.spawning.SpawningContext;
|
||||||
import it.unimi.dsi.fastutil.Pair;
|
import it.unimi.dsi.fastutil.Pair;
|
||||||
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -55,7 +56,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class CoopBlock implements Component<ChunkStore> {
|
public class CoopBlock implements Component<ChunkStore> {
|
||||||
public static final String STATE_PRODUCE = "Produce_Ready";
|
public static final String STATE_PRODUCE = "Produce_Ready";
|
||||||
@@ -71,7 +72,6 @@ public class CoopBlock implements Component<ChunkStore> {
|
|||||||
.append(new KeyedCodec<>("Storage", ItemContainer.CODEC), (coop, storage) -> coop.itemContainer = storage, coop -> coop.itemContainer)
|
.append(new KeyedCodec<>("Storage", ItemContainer.CODEC), (coop, storage) -> coop.itemContainer = storage, coop -> coop.itemContainer)
|
||||||
.add()
|
.add()
|
||||||
.build();
|
.build();
|
||||||
HytaleLogger LOGGER = HytaleLogger.forEnclosingClass();
|
|
||||||
protected String coopAssetId;
|
protected String coopAssetId;
|
||||||
protected List<CoopBlock.CoopResident> residents = new ArrayList<>();
|
protected List<CoopBlock.CoopResident> residents = new ArrayList<>();
|
||||||
protected ItemContainer itemContainer = EmptyItemContainer.INSTANCE;
|
protected ItemContainer itemContainer = EmptyItemContainer.INSTANCE;
|
||||||
@@ -85,7 +85,7 @@ public class CoopBlock implements Component<ChunkStore> {
|
|||||||
this.itemContainer = ItemContainer.ensureContainerCapacity(this.itemContainer, (short)5, SimpleItemContainer::new, remainder);
|
this.itemContainer = ItemContainer.ensureContainerCapacity(this.itemContainer, (short)5, SimpleItemContainer::new, remainder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NullableDecl
|
@Nullable
|
||||||
public FarmingCoopAsset getCoopAsset() {
|
public FarmingCoopAsset getCoopAsset() {
|
||||||
return FarmingCoopAsset.getAssetMap().getAsset(this.coopAssetId);
|
return FarmingCoopAsset.getAssetMap().getAsset(this.coopAssetId);
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ public class CoopBlock implements Component<ChunkStore> {
|
|||||||
this.coopAssetId = farmingCoopId;
|
this.coopAssetId = farmingCoopId;
|
||||||
this.residents.addAll(residents);
|
this.residents.addAll(residents);
|
||||||
this.itemContainer = itemContainer.clone();
|
this.itemContainer = itemContainer.clone();
|
||||||
ArrayList<ItemStack> remainder = new ArrayList<>();
|
List<ItemStack> remainder = new ObjectArrayList<>();
|
||||||
this.itemContainer = ItemContainer.ensureContainerCapacity(this.itemContainer, (short)5, SimpleItemContainer::new, remainder);
|
this.itemContainer = ItemContainer.ensureContainerCapacity(this.itemContainer, (short)5, SimpleItemContainer::new, remainder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,7 +336,7 @@ public class CoopBlock implements Component<ChunkStore> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@NullableDecl
|
@Nullable
|
||||||
public Instant getNextScheduledTick(WorldTimeResource worldTimeResource) {
|
public Instant getNextScheduledTick(WorldTimeResource worldTimeResource) {
|
||||||
Instant gameTime = worldTimeResource.getGameTime();
|
Instant gameTime = worldTimeResource.getGameTime();
|
||||||
LocalDateTime gameDateTime = worldTimeResource.getGameDateTime();
|
LocalDateTime gameDateTime = worldTimeResource.getGameDateTime();
|
||||||
@@ -431,7 +431,7 @@ public class CoopBlock implements Component<ChunkStore> {
|
|||||||
.add()
|
.add()
|
||||||
.build();
|
.build();
|
||||||
protected CapturedNPCMetadata metadata;
|
protected CapturedNPCMetadata metadata;
|
||||||
@NullableDecl
|
@Nullable
|
||||||
protected PersistentRef persistentRef;
|
protected PersistentRef persistentRef;
|
||||||
protected boolean deployedToWorld;
|
protected boolean deployedToWorld;
|
||||||
protected Instant lastProduced;
|
protected Instant lastProduced;
|
||||||
@@ -449,12 +449,12 @@ public class CoopBlock implements Component<ChunkStore> {
|
|||||||
return this.metadata;
|
return this.metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NullableDecl
|
@Nullable
|
||||||
public PersistentRef getPersistentRef() {
|
public PersistentRef getPersistentRef() {
|
||||||
return this.persistentRef;
|
return this.persistentRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPersistentRef(@NullableDecl PersistentRef persistentRef) {
|
public void setPersistentRef(@Nullable PersistentRef persistentRef) {
|
||||||
this.persistentRef = persistentRef;
|
this.persistentRef = persistentRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,9 +43,6 @@ public class FarmingBlockState implements Component<ChunkStore> {
|
|||||||
public double lastGrowthMultiplier;
|
public double lastGrowthMultiplier;
|
||||||
public float spreadRate = 1.0F;
|
public float spreadRate = 1.0F;
|
||||||
|
|
||||||
public FarmingBlockState() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCurrentFarmingStageSetName() {
|
public String getCurrentFarmingStageSetName() {
|
||||||
return this.currentFarmingStageSetName;
|
return this.currentFarmingStageSetName;
|
||||||
}
|
}
|
||||||
@@ -115,8 +112,5 @@ public class FarmingBlockState implements Component<ChunkStore> {
|
|||||||
protected static final int ON_UNLOADING = 3;
|
protected static final int ON_UNLOADING = 3;
|
||||||
protected static final int ON_LOADING = 5;
|
protected static final int ON_LOADING = 5;
|
||||||
protected static final int NONE = 0;
|
protected static final int NONE = 0;
|
||||||
|
|
||||||
protected RefreshFlags() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.hypixel.hytale.codec.builder.BuilderCodec;
|
|||||||
import com.hypixel.hytale.codec.validation.Validators;
|
import com.hypixel.hytale.codec.validation.Validators;
|
||||||
import com.hypixel.hytale.server.core.asset.type.gameplay.GameplayConfig;
|
import com.hypixel.hytale.server.core.asset.type.gameplay.GameplayConfig;
|
||||||
import com.hypixel.hytale.server.core.asset.type.item.config.Item;
|
import com.hypixel.hytale.server.core.asset.type.item.config.Item;
|
||||||
|
import com.hypixel.hytale.server.core.asset.type.model.config.ModelParticle;
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
@@ -37,13 +38,28 @@ public class MemoriesGameplayConfig {
|
|||||||
.addValidator(Validators.nonNull())
|
.addValidator(Validators.nonNull())
|
||||||
.addValidator(Item.VALIDATOR_CACHE.getValidator())
|
.addValidator(Item.VALIDATOR_CACHE.getValidator())
|
||||||
.add()
|
.add()
|
||||||
|
.<ModelParticle>appendInherited(
|
||||||
|
new KeyedCodec<>("MemoriesCatchEntityParticle", ModelParticle.CODEC),
|
||||||
|
(activationEffects, s) -> activationEffects.memoriesCatchEntityParticle = s,
|
||||||
|
activationEffects -> activationEffects.memoriesCatchEntityParticle,
|
||||||
|
(activationEffects, parent) -> activationEffects.memoriesCatchEntityParticle = parent.memoriesCatchEntityParticle
|
||||||
|
)
|
||||||
|
.addValidator(Validators.nonNull())
|
||||||
|
.add()
|
||||||
|
.<Integer>appendInherited(
|
||||||
|
new KeyedCodec<>("MemoriesCatchParticleViewDistance", Codec.INTEGER),
|
||||||
|
(memoriesGameplayConfig, integer) -> memoriesGameplayConfig.memoriesCatchParticleViewDistance = integer,
|
||||||
|
memoriesGameplayConfig -> memoriesGameplayConfig.memoriesCatchParticleViewDistance,
|
||||||
|
(memoriesGameplayConfig, parent) -> memoriesGameplayConfig.memoriesCatchParticleViewDistance = parent.memoriesCatchParticleViewDistance
|
||||||
|
)
|
||||||
|
.addValidator(Validators.greaterThan(16))
|
||||||
|
.add()
|
||||||
.build();
|
.build();
|
||||||
private int[] memoriesAmountPerLevel;
|
private int[] memoriesAmountPerLevel;
|
||||||
private String memoriesRecordParticles;
|
private String memoriesRecordParticles;
|
||||||
private String memoriesCatchItemId;
|
private String memoriesCatchItemId;
|
||||||
|
private ModelParticle memoriesCatchEntityParticle;
|
||||||
public MemoriesGameplayConfig() {
|
private int memoriesCatchParticleViewDistance = 64;
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static MemoriesGameplayConfig get(@Nonnull GameplayConfig config) {
|
public static MemoriesGameplayConfig get(@Nonnull GameplayConfig config) {
|
||||||
@@ -61,4 +77,12 @@ public class MemoriesGameplayConfig {
|
|||||||
public String getMemoriesCatchItemId() {
|
public String getMemoriesCatchItemId() {
|
||||||
return this.memoriesCatchItemId;
|
return this.memoriesCatchItemId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ModelParticle getMemoriesCatchEntityParticle() {
|
||||||
|
return this.memoriesCatchEntityParticle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMemoriesCatchParticleViewDistance() {
|
||||||
|
return this.memoriesCatchParticleViewDistance;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import com.hypixel.hytale.builtin.adventure.memories.memories.npc.NPCMemory;
|
|||||||
import com.hypixel.hytale.builtin.adventure.memories.memories.npc.NPCMemoryProvider;
|
import com.hypixel.hytale.builtin.adventure.memories.memories.npc.NPCMemoryProvider;
|
||||||
import com.hypixel.hytale.builtin.adventure.memories.page.MemoriesPage;
|
import com.hypixel.hytale.builtin.adventure.memories.page.MemoriesPage;
|
||||||
import com.hypixel.hytale.builtin.adventure.memories.page.MemoriesPageSupplier;
|
import com.hypixel.hytale.builtin.adventure.memories.page.MemoriesPageSupplier;
|
||||||
|
import com.hypixel.hytale.builtin.adventure.memories.page.MemoriesUnlockedPage;
|
||||||
|
import com.hypixel.hytale.builtin.adventure.memories.page.MemoriesUnlockedPageSuplier;
|
||||||
import com.hypixel.hytale.builtin.adventure.memories.temple.ForgottenTempleConfig;
|
import com.hypixel.hytale.builtin.adventure.memories.temple.ForgottenTempleConfig;
|
||||||
import com.hypixel.hytale.builtin.adventure.memories.temple.TempleRespawnPlayersSystem;
|
import com.hypixel.hytale.builtin.adventure.memories.temple.TempleRespawnPlayersSystem;
|
||||||
import com.hypixel.hytale.builtin.adventure.memories.window.MemoriesWindow;
|
import com.hypixel.hytale.builtin.adventure.memories.window.MemoriesWindow;
|
||||||
@@ -51,7 +53,7 @@ import com.hypixel.hytale.server.npc.AllNPCsLoadedEvent;
|
|||||||
import it.unimi.dsi.fastutil.objects.Object2DoubleMap;
|
import it.unimi.dsi.fastutil.objects.Object2DoubleMap;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2DoubleMaps;
|
import it.unimi.dsi.fastutil.objects.Object2DoubleMaps;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2DoubleOpenHashMap;
|
import it.unimi.dsi.fastutil.objects.Object2DoubleOpenHashMap;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.objects.Object2ObjectRBTreeMap;
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@@ -70,7 +72,7 @@ public class MemoriesPlugin extends JavaPlugin {
|
|||||||
private static MemoriesPlugin instance;
|
private static MemoriesPlugin instance;
|
||||||
private final Config<MemoriesPlugin.MemoriesPluginConfig> config = this.withConfig(MemoriesPlugin.MemoriesPluginConfig.CODEC);
|
private final Config<MemoriesPlugin.MemoriesPluginConfig> config = this.withConfig(MemoriesPlugin.MemoriesPluginConfig.CODEC);
|
||||||
private final List<MemoryProvider<?>> providers = new ObjectArrayList<>();
|
private final List<MemoryProvider<?>> providers = new ObjectArrayList<>();
|
||||||
private final Map<String, Set<Memory>> allMemories = new Object2ObjectOpenHashMap<>();
|
private final Map<String, Set<Memory>> allMemories = new Object2ObjectRBTreeMap<>();
|
||||||
private ComponentType<EntityStore, PlayerMemories> playerMemoriesComponentType;
|
private ComponentType<EntityStore, PlayerMemories> playerMemoriesComponentType;
|
||||||
@Nullable
|
@Nullable
|
||||||
private MemoriesPlugin.RecordedMemories recordedMemories;
|
private MemoriesPlugin.RecordedMemories recordedMemories;
|
||||||
@@ -90,6 +92,7 @@ public class MemoriesPlugin extends JavaPlugin {
|
|||||||
ComponentRegistryProxy<EntityStore> entityStoreRegistry = this.getEntityStoreRegistry();
|
ComponentRegistryProxy<EntityStore> entityStoreRegistry = this.getEntityStoreRegistry();
|
||||||
this.getCommandRegistry().registerCommand(new MemoriesCommand());
|
this.getCommandRegistry().registerCommand(new MemoriesCommand());
|
||||||
OpenCustomUIInteraction.registerCustomPageSupplier(this, MemoriesPage.class, "Memories", new MemoriesPageSupplier());
|
OpenCustomUIInteraction.registerCustomPageSupplier(this, MemoriesPage.class, "Memories", new MemoriesPageSupplier());
|
||||||
|
OpenCustomUIInteraction.registerCustomPageSupplier(this, MemoriesUnlockedPage.class, "MemoriesUnlocked", new MemoriesUnlockedPageSuplier());
|
||||||
Window.CLIENT_REQUESTABLE_WINDOW_TYPES.put(WindowType.Memories, MemoriesWindow::new);
|
Window.CLIENT_REQUESTABLE_WINDOW_TYPES.put(WindowType.Memories, MemoriesWindow::new);
|
||||||
this.playerMemoriesComponentType = entityStoreRegistry.registerComponent(PlayerMemories.class, "PlayerMemories", PlayerMemories.CODEC);
|
this.playerMemoriesComponentType = entityStoreRegistry.registerComponent(PlayerMemories.class, "PlayerMemories", PlayerMemories.CODEC);
|
||||||
NPCMemoryProvider npcMemoryProvider = new NPCMemoryProvider();
|
NPCMemoryProvider npcMemoryProvider = new NPCMemoryProvider();
|
||||||
@@ -129,6 +132,7 @@ public class MemoriesPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void shutdown() {
|
protected void shutdown() {
|
||||||
|
if (this.hasInitializedMemories) {
|
||||||
this.recordedMemories.lock.readLock().lock();
|
this.recordedMemories.lock.readLock().lock();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -139,6 +143,7 @@ public class MemoriesPlugin extends JavaPlugin {
|
|||||||
this.recordedMemories.lock.readLock().unlock();
|
this.recordedMemories.lock.readLock().unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void onAssetsLoad() {
|
private void onAssetsLoad() {
|
||||||
if (this.hasInitializedMemories) {
|
if (this.hasInitializedMemories) {
|
||||||
@@ -177,30 +182,16 @@ public class MemoriesPlugin extends JavaPlugin {
|
|||||||
int recordedMemoriesCount = this.getRecordedMemories().size();
|
int recordedMemoriesCount = this.getRecordedMemories().size();
|
||||||
int[] memoriesAmountPerLevel = config.getMemoriesAmountPerLevel();
|
int[] memoriesAmountPerLevel = config.getMemoriesAmountPerLevel();
|
||||||
|
|
||||||
for (int i = 0; i < memoriesAmountPerLevel.length && recordedMemoriesCount >= memoriesAmountPerLevel[i]; i++) {
|
for (int i = memoriesAmountPerLevel.length - 1; i >= 0; i--) {
|
||||||
memoriesLevel += i + 1;
|
if (recordedMemoriesCount >= memoriesAmountPerLevel[i]) {
|
||||||
|
return i + 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return memoriesLevel;
|
return memoriesLevel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMemoriesForNextLevel(@Nonnull GameplayConfig gameplayConfig) {
|
|
||||||
MemoriesGameplayConfig memoriesConfig = MemoriesGameplayConfig.get(gameplayConfig);
|
|
||||||
if (memoriesConfig == null) {
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
int memoriesLevel = this.getMemoriesLevel(gameplayConfig);
|
|
||||||
int[] memoriesAmountPerLevel = memoriesConfig.getMemoriesAmountPerLevel();
|
|
||||||
if (memoriesLevel >= memoriesAmountPerLevel.length) {
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
int recordedMemoriesCount = this.getRecordedMemories().size();
|
|
||||||
return memoriesAmountPerLevel[memoriesLevel] - recordedMemoriesCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasRecordedMemory(Memory memory) {
|
public boolean hasRecordedMemory(Memory memory) {
|
||||||
this.recordedMemories.lock.readLock().lock();
|
this.recordedMemories.lock.readLock().lock();
|
||||||
|
|
||||||
@@ -274,6 +265,39 @@ public class MemoriesPlugin extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int setRecordedMemoriesCount(int count) {
|
||||||
|
if (count < 0) {
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.recordedMemories.lock.writeLock().lock();
|
||||||
|
|
||||||
|
int var12;
|
||||||
|
try {
|
||||||
|
this.recordedMemories.memories.clear();
|
||||||
|
List<Memory> allAvailableMemories = new ObjectArrayList<>();
|
||||||
|
|
||||||
|
for (Entry<String, Set<Memory>> entry : this.allMemories.entrySet()) {
|
||||||
|
allAvailableMemories.addAll(entry.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
int actualCount = Math.min(count, allAvailableMemories.size());
|
||||||
|
|
||||||
|
for (int i = 0; i < actualCount; i++) {
|
||||||
|
this.recordedMemories.memories.add(allAvailableMemories.get(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
BsonUtil.writeSync(Constants.UNIVERSE_PATH.resolve("memories.json"), MemoriesPlugin.RecordedMemories.CODEC, this.recordedMemories, this.getLogger());
|
||||||
|
var12 = actualCount;
|
||||||
|
} catch (IOException var8) {
|
||||||
|
throw new RuntimeException(var8);
|
||||||
|
} finally {
|
||||||
|
this.recordedMemories.lock.writeLock().unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
return var12;
|
||||||
|
}
|
||||||
|
|
||||||
public static class MemoriesPluginConfig {
|
public static class MemoriesPluginConfig {
|
||||||
public static final BuilderCodec<MemoriesPlugin.MemoriesPluginConfig> CODEC = BuilderCodec.builder(
|
public static final BuilderCodec<MemoriesPlugin.MemoriesPluginConfig> CODEC = BuilderCodec.builder(
|
||||||
MemoriesPlugin.MemoriesPluginConfig.class, MemoriesPlugin.MemoriesPluginConfig::new
|
MemoriesPlugin.MemoriesPluginConfig.class, MemoriesPlugin.MemoriesPluginConfig::new
|
||||||
@@ -287,9 +311,6 @@ public class MemoriesPlugin extends JavaPlugin {
|
|||||||
.build();
|
.build();
|
||||||
private Object2DoubleMap<String> collectionRadius;
|
private Object2DoubleMap<String> collectionRadius;
|
||||||
|
|
||||||
public MemoriesPluginConfig() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public Object2DoubleMap<String> getCollectionRadius() {
|
public Object2DoubleMap<String> getCollectionRadius() {
|
||||||
return (Object2DoubleMap<String>)(this.collectionRadius != null ? this.collectionRadius : Object2DoubleMaps.EMPTY_MAP);
|
return (Object2DoubleMap<String>)(this.collectionRadius != null ? this.collectionRadius : Object2DoubleMaps.EMPTY_MAP);
|
||||||
@@ -302,9 +323,6 @@ public class MemoriesPlugin extends JavaPlugin {
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
private final Query<EntityStore> query = Query.and(Player.getComponentType(), PlayerRef.getComponentType());
|
private final Query<EntityStore> query = Query.and(Player.getComponentType(), PlayerRef.getComponentType());
|
||||||
|
|
||||||
public PlayerAddedSystem() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public Query<EntityStore> getQuery() {
|
public Query<EntityStore> getQuery() {
|
||||||
@@ -355,8 +373,5 @@ public class MemoriesPlugin extends JavaPlugin {
|
|||||||
.build();
|
.build();
|
||||||
private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
||||||
private final Set<Memory> memories = new HashSet<>();
|
private final Set<Memory> memories = new HashSet<>();
|
||||||
|
|
||||||
private RecordedMemories() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,5 +9,6 @@ public class MemoriesCommand extends AbstractCommandCollection {
|
|||||||
this.addSubCommand(new MemoriesCapacityCommand());
|
this.addSubCommand(new MemoriesCapacityCommand());
|
||||||
this.addSubCommand(new MemoriesLevelCommand());
|
this.addSubCommand(new MemoriesLevelCommand());
|
||||||
this.addSubCommand(new MemoriesUnlockCommand());
|
this.addSubCommand(new MemoriesUnlockCommand());
|
||||||
|
this.addSubCommand(new MemoriesSetCountCommand());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.hypixel.hytale.builtin.adventure.memories.commands;
|
||||||
|
|
||||||
|
import com.hypixel.hytale.builtin.adventure.memories.MemoriesPlugin;
|
||||||
|
import com.hypixel.hytale.component.Store;
|
||||||
|
import com.hypixel.hytale.server.core.Message;
|
||||||
|
import com.hypixel.hytale.server.core.command.system.CommandContext;
|
||||||
|
import com.hypixel.hytale.server.core.command.system.arguments.system.RequiredArg;
|
||||||
|
import com.hypixel.hytale.server.core.command.system.arguments.types.ArgTypes;
|
||||||
|
import com.hypixel.hytale.server.core.command.system.basecommands.AbstractWorldCommand;
|
||||||
|
import com.hypixel.hytale.server.core.universe.world.World;
|
||||||
|
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class MemoriesSetCountCommand extends AbstractWorldCommand {
|
||||||
|
@Nonnull
|
||||||
|
private static final Message MESSAGE_COMMANDS_MEMORIES_SETCOUNT_INVALID = Message.translation("server.commands.memories.setCount.invalid");
|
||||||
|
@Nonnull
|
||||||
|
private final RequiredArg<Integer> countArg = this.withRequiredArg("count", "server.commands.memories.setCount.count.desc", ArgTypes.INTEGER);
|
||||||
|
|
||||||
|
public MemoriesSetCountCommand() {
|
||||||
|
super("setCount", "server.commands.memories.setCount.desc");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void execute(@Nonnull CommandContext context, @Nonnull World world, @Nonnull Store<EntityStore> store) {
|
||||||
|
int count = this.countArg.get(context);
|
||||||
|
if (count < 0) {
|
||||||
|
context.sendMessage(MESSAGE_COMMANDS_MEMORIES_SETCOUNT_INVALID);
|
||||||
|
} else {
|
||||||
|
int actualCount = MemoriesPlugin.get().setRecordedMemoriesCount(count);
|
||||||
|
context.sendMessage(Message.translation("server.commands.memories.setCount.success").param("requested", count).param("actual", actualCount));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,9 +32,6 @@ public class PlayerMemories implements Component<EntityStore> {
|
|||||||
private final Set<Memory> memories = new LinkedHashSet<>();
|
private final Set<Memory> memories = new LinkedHashSet<>();
|
||||||
private int memoriesCapacity;
|
private int memoriesCapacity;
|
||||||
|
|
||||||
public PlayerMemories() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ComponentType<EntityStore, PlayerMemories> getComponentType() {
|
public static ComponentType<EntityStore, PlayerMemories> getComponentType() {
|
||||||
return MemoriesPlugin.get().getPlayerMemoriesComponentType();
|
return MemoriesPlugin.get().getPlayerMemoriesComponentType();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
|
|
||||||
|
|
||||||
public class MemoriesConditionInteraction extends Interaction {
|
public class MemoriesConditionInteraction extends Interaction {
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@@ -68,12 +67,9 @@ public class MemoriesConditionInteraction extends Interaction {
|
|||||||
@Nullable
|
@Nullable
|
||||||
private String failed;
|
private String failed;
|
||||||
|
|
||||||
public MemoriesConditionInteraction() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tick0(
|
protected void tick0(
|
||||||
boolean firstRun, float time, @NonNullDecl InteractionType type, @NonNullDecl InteractionContext context, @NonNullDecl CooldownHandler cooldownHandler
|
boolean firstRun, float time, @Nonnull InteractionType type, @Nonnull InteractionContext context, @Nonnull CooldownHandler cooldownHandler
|
||||||
) {
|
) {
|
||||||
CommandBuffer<EntityStore> commandBuffer = context.getCommandBuffer();
|
CommandBuffer<EntityStore> commandBuffer = context.getCommandBuffer();
|
||||||
|
|
||||||
@@ -95,7 +91,7 @@ public class MemoriesConditionInteraction extends Interaction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void simulateTick0(
|
protected void simulateTick0(
|
||||||
boolean firstRun, float time, @NonNullDecl InteractionType type, @NonNullDecl InteractionContext context, @NonNullDecl CooldownHandler cooldownHandler
|
boolean firstRun, float time, @Nonnull InteractionType type, @Nonnull InteractionContext context, @Nonnull CooldownHandler cooldownHandler
|
||||||
) {
|
) {
|
||||||
int memoriesLevel = context.getServerState().chainingIndex;
|
int memoriesLevel = context.getServerState().chainingIndex;
|
||||||
int labelIndex = this.levelToLabel.get(memoriesLevel);
|
int labelIndex = this.levelToLabel.get(memoriesLevel);
|
||||||
|
|||||||
@@ -33,9 +33,6 @@ public class SetMemoriesCapacityInteraction extends SimpleInstantInteraction {
|
|||||||
.build();
|
.build();
|
||||||
private int capacity;
|
private int capacity;
|
||||||
|
|
||||||
public SetMemoriesCapacityInteraction() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void firstRun(@Nonnull InteractionType type, @Nonnull InteractionContext context, @Nonnull CooldownHandler cooldownHandler) {
|
protected void firstRun(@Nonnull InteractionType type, @Nonnull InteractionContext context, @Nonnull CooldownHandler cooldownHandler) {
|
||||||
Ref<EntityStore> ref = context.getEntity();
|
Ref<EntityStore> ref = context.getEntity();
|
||||||
|
|||||||
@@ -8,9 +8,6 @@ import javax.annotation.Nullable;
|
|||||||
public abstract class Memory {
|
public abstract class Memory {
|
||||||
public static final CodecMapCodec<Memory> CODEC = new CodecMapCodec<>();
|
public static final CodecMapCodec<Memory> CODEC = new CodecMapCodec<>();
|
||||||
|
|
||||||
public Memory() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract String getId();
|
public abstract String getId();
|
||||||
|
|
||||||
public abstract String getTitle();
|
public abstract String getTitle();
|
||||||
|
|||||||
@@ -18,17 +18,22 @@ import com.hypixel.hytale.component.Ref;
|
|||||||
import com.hypixel.hytale.component.Store;
|
import com.hypixel.hytale.component.Store;
|
||||||
import com.hypixel.hytale.component.query.Query;
|
import com.hypixel.hytale.component.query.Query;
|
||||||
import com.hypixel.hytale.component.spatial.SpatialResource;
|
import com.hypixel.hytale.component.spatial.SpatialResource;
|
||||||
|
import com.hypixel.hytale.component.spatial.SpatialStructure;
|
||||||
import com.hypixel.hytale.component.system.tick.EntityTickingSystem;
|
import com.hypixel.hytale.component.system.tick.EntityTickingSystem;
|
||||||
import com.hypixel.hytale.math.util.MathUtil;
|
import com.hypixel.hytale.math.util.MathUtil;
|
||||||
import com.hypixel.hytale.math.vector.Vector3d;
|
import com.hypixel.hytale.math.vector.Vector3d;
|
||||||
import com.hypixel.hytale.protocol.GameMode;
|
import com.hypixel.hytale.protocol.GameMode;
|
||||||
|
import com.hypixel.hytale.protocol.packets.entities.SpawnModelParticles;
|
||||||
import com.hypixel.hytale.server.core.Message;
|
import com.hypixel.hytale.server.core.Message;
|
||||||
|
import com.hypixel.hytale.server.core.asset.type.model.config.ModelParticle;
|
||||||
import com.hypixel.hytale.server.core.entity.entities.Player;
|
import com.hypixel.hytale.server.core.entity.entities.Player;
|
||||||
import com.hypixel.hytale.server.core.inventory.ItemStack;
|
import com.hypixel.hytale.server.core.inventory.ItemStack;
|
||||||
|
import com.hypixel.hytale.server.core.modules.entity.EntityModule;
|
||||||
import com.hypixel.hytale.server.core.modules.entity.component.BoundingBox;
|
import com.hypixel.hytale.server.core.modules.entity.component.BoundingBox;
|
||||||
import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
|
import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
|
||||||
import com.hypixel.hytale.server.core.modules.entity.item.ItemComponent;
|
import com.hypixel.hytale.server.core.modules.entity.item.ItemComponent;
|
||||||
import com.hypixel.hytale.server.core.modules.entity.item.PickupItemComponent;
|
import com.hypixel.hytale.server.core.modules.entity.item.PickupItemComponent;
|
||||||
|
import com.hypixel.hytale.server.core.modules.entity.tracker.NetworkId;
|
||||||
import com.hypixel.hytale.server.core.modules.i18n.I18nModule;
|
import com.hypixel.hytale.server.core.modules.i18n.I18nModule;
|
||||||
import com.hypixel.hytale.server.core.universe.PlayerRef;
|
import com.hypixel.hytale.server.core.universe.PlayerRef;
|
||||||
import com.hypixel.hytale.server.core.universe.world.World;
|
import com.hypixel.hytale.server.core.universe.world.World;
|
||||||
@@ -229,6 +234,7 @@ public class NPCMemory extends Memory {
|
|||||||
|
|
||||||
assert playerRefComponent != null;
|
assert playerRefComponent != null;
|
||||||
|
|
||||||
|
Ref<EntityStore> ref = archetypeChunk.getReferenceTo(index);
|
||||||
MemoriesPlugin memoriesPlugin = MemoriesPlugin.get();
|
MemoriesPlugin memoriesPlugin = MemoriesPlugin.get();
|
||||||
PlayerMemories playerMemoriesComponent = archetypeChunk.getComponent(index, PlayerMemories.getComponentType());
|
PlayerMemories playerMemoriesComponent = archetypeChunk.getComponent(index, PlayerMemories.getComponentType());
|
||||||
|
|
||||||
@@ -269,17 +275,22 @@ public class NPCMemory extends Memory {
|
|||||||
if (memoriesGameplayConfig != null) {
|
if (memoriesGameplayConfig != null) {
|
||||||
ItemStack memoryItemStack = new ItemStack(memoriesGameplayConfig.getMemoriesCatchItemId());
|
ItemStack memoryItemStack = new ItemStack(memoriesGameplayConfig.getMemoriesCatchItemId());
|
||||||
Vector3d memoryItemHolderPosition = npcTransformComponent.getPosition().clone();
|
Vector3d memoryItemHolderPosition = npcTransformComponent.getPosition().clone();
|
||||||
BoundingBox boundingBox = commandBuffer.getComponent(npcRef, BoundingBox.getComponentType());
|
BoundingBox boundingBoxComponent = commandBuffer.getComponent(npcRef, BoundingBox.getComponentType());
|
||||||
if (boundingBox != null) {
|
if (boundingBoxComponent != null) {
|
||||||
memoryItemHolderPosition.y = memoryItemHolderPosition.y + boundingBox.getBoundingBox().middleY();
|
memoryItemHolderPosition.y = memoryItemHolderPosition.y + boundingBoxComponent.getBoundingBox().middleY();
|
||||||
}
|
}
|
||||||
|
|
||||||
Holder<EntityStore> memoryItemHolder = ItemComponent.generatePickedUpItem(
|
Holder<EntityStore> memoryItemHolder = ItemComponent.generatePickedUpItem(
|
||||||
memoryItemStack, memoryItemHolderPosition, commandBuffer, playerRefComponent.getReference()
|
memoryItemStack, memoryItemHolderPosition, commandBuffer, ref
|
||||||
);
|
);
|
||||||
float memoryCatchItemLifetimeS = 0.62F;
|
float memoryCatchItemLifetimeS = 0.62F;
|
||||||
memoryItemHolder.getComponent(PickupItemComponent.getComponentType()).setInitialLifeTime(memoryCatchItemLifetimeS);
|
PickupItemComponent pickupItemComponent = memoryItemHolder.getComponent(PickupItemComponent.getComponentType());
|
||||||
|
|
||||||
|
assert pickupItemComponent != null;
|
||||||
|
|
||||||
|
pickupItemComponent.setInitialLifeTime(0.62F);
|
||||||
commandBuffer.addEntity(memoryItemHolder, AddReason.SPAWN);
|
commandBuffer.addEntity(memoryItemHolder, AddReason.SPAWN);
|
||||||
|
displayCatchEntityParticles(memoriesGameplayConfig, memoryItemHolderPosition, npcRef, commandBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -308,6 +319,31 @@ public class NPCMemory extends Memory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void displayCatchEntityParticles(
|
||||||
|
MemoriesGameplayConfig memoriesGameplayConfig, Vector3d targetPosition, Ref<EntityStore> targetRef, @Nonnull CommandBuffer<EntityStore> commandBuffer
|
||||||
|
) {
|
||||||
|
ModelParticle particle = memoriesGameplayConfig.getMemoriesCatchEntityParticle();
|
||||||
|
if (particle != null) {
|
||||||
|
NetworkId networkIdComponent = commandBuffer.getComponent(targetRef, NetworkId.getComponentType());
|
||||||
|
if (networkIdComponent != null) {
|
||||||
|
com.hypixel.hytale.protocol.ModelParticle[] modelParticlesProtocol = new com.hypixel.hytale.protocol.ModelParticle[]{particle.toPacket()};
|
||||||
|
SpawnModelParticles packet = new SpawnModelParticles(networkIdComponent.getId(), modelParticlesProtocol);
|
||||||
|
SpatialResource<Ref<EntityStore>, EntityStore> spatialResource = commandBuffer.getResource(EntityModule.get().getPlayerSpatialResourceType());
|
||||||
|
SpatialStructure<Ref<EntityStore>> spatialStructure = spatialResource.getSpatialStructure();
|
||||||
|
ObjectList<Ref<EntityStore>> results = SpatialResource.getThreadLocalReferenceList();
|
||||||
|
spatialStructure.ordered(targetPosition, memoriesGameplayConfig.getMemoriesCatchParticleViewDistance(), results);
|
||||||
|
|
||||||
|
for (Ref<EntityStore> ref : results) {
|
||||||
|
PlayerRef playerRefComponent = commandBuffer.getComponent(ref, PlayerRef.getComponentType());
|
||||||
|
|
||||||
|
assert playerRefComponent != null;
|
||||||
|
|
||||||
|
playerRefComponent.getPacketHandler().write(packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public Query<EntityStore> getQuery() {
|
public Query<EntityStore> getQuery() {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import java.util.Set;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
|
||||||
|
|
||||||
public class NPCMemoryProvider extends MemoryProvider<NPCMemory> {
|
public class NPCMemoryProvider extends MemoryProvider<NPCMemory> {
|
||||||
public static final double DEFAULT_RADIUS = 10.0;
|
public static final double DEFAULT_RADIUS = 10.0;
|
||||||
@@ -82,7 +81,7 @@ public class NPCMemoryProvider extends MemoryProvider<NPCMemory> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@NullableDecl
|
@Nullable
|
||||||
private static String getMemoriesNameOverride(@Nonnull Builder<?> builder) {
|
private static String getMemoriesNameOverride(@Nonnull Builder<?> builder) {
|
||||||
if (builder instanceof ISpawnableWithModel spawnableWithModel) {
|
if (builder instanceof ISpawnableWithModel spawnableWithModel) {
|
||||||
ExecutionContext executionContext = new ExecutionContext();
|
ExecutionContext executionContext = new ExecutionContext();
|
||||||
|
|||||||
@@ -76,6 +76,9 @@ public class MemoriesPage extends InteractiveCustomUIPage<MemoriesPage.PageEvent
|
|||||||
commandBuilder.set("#MemoriesProgressBarTexture.Value", (float)recordedMemories.size() / totalMemories);
|
commandBuilder.set("#MemoriesProgressBarTexture.Value", (float)recordedMemories.size() / totalMemories);
|
||||||
commandBuilder.set("#TotalCollected.Text", String.valueOf(recordedMemories.size()));
|
commandBuilder.set("#TotalCollected.Text", String.valueOf(recordedMemories.size()));
|
||||||
commandBuilder.set("#MemoriesTotal.Text", String.valueOf(totalMemories));
|
commandBuilder.set("#MemoriesTotal.Text", String.valueOf(totalMemories));
|
||||||
|
eventBuilder.addEventBinding(
|
||||||
|
CustomUIEventBindingType.Activating, "#MemoriesInfoButton", new EventData().append("Action", MemoriesPage.PageAction.MemoriesInfo)
|
||||||
|
);
|
||||||
GameplayConfig gameplayConfig = store.getExternalData().getWorld().getGameplayConfig();
|
GameplayConfig gameplayConfig = store.getExternalData().getWorld().getGameplayConfig();
|
||||||
PlayerMemories playerMemories = store.getComponent(ref, PlayerMemories.getComponentType());
|
PlayerMemories playerMemories = store.getComponent(ref, PlayerMemories.getComponentType());
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -267,6 +270,12 @@ public class MemoriesPage extends InteractiveCustomUIPage<MemoriesPage.PageEvent
|
|||||||
this.selectedMemory = null;
|
this.selectedMemory = null;
|
||||||
this.rebuild();
|
this.rebuild();
|
||||||
break;
|
break;
|
||||||
|
case MemoriesInfo:
|
||||||
|
BlockPosition blockPostion = new BlockPosition(
|
||||||
|
(int)this.recordMemoriesParticlesPosition.x, (int)this.recordMemoriesParticlesPosition.y, (int)this.recordMemoriesParticlesPosition.z
|
||||||
|
);
|
||||||
|
player.getPageManager().openCustomPage(ref, store, new MemoriesUnlockedPage(this.playerRef, blockPostion));
|
||||||
|
break;
|
||||||
case SelectMemory:
|
case SelectMemory:
|
||||||
if (data.memoryId == null || this.currentCategory == null) {
|
if (data.memoryId == null || this.currentCategory == null) {
|
||||||
return;
|
return;
|
||||||
@@ -366,12 +375,10 @@ public class MemoriesPage extends InteractiveCustomUIPage<MemoriesPage.PageEvent
|
|||||||
Record,
|
Record,
|
||||||
ViewCategory,
|
ViewCategory,
|
||||||
Back,
|
Back,
|
||||||
|
MemoriesInfo,
|
||||||
SelectMemory;
|
SelectMemory;
|
||||||
|
|
||||||
public static final Codec<MemoriesPage.PageAction> CODEC = new EnumCodec<>(MemoriesPage.PageAction.class);
|
public static final Codec<MemoriesPage.PageAction> CODEC = new EnumCodec<>(MemoriesPage.PageAction.class);
|
||||||
|
|
||||||
private PageAction() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PageEventData {
|
public static class PageEventData {
|
||||||
@@ -395,8 +402,5 @@ public class MemoriesPage extends InteractiveCustomUIPage<MemoriesPage.PageEvent
|
|||||||
public MemoriesPage.PageAction action;
|
public MemoriesPage.PageAction action;
|
||||||
public String category;
|
public String category;
|
||||||
public String memoryId;
|
public String memoryId;
|
||||||
|
|
||||||
public PageEventData() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,13 +7,10 @@ import com.hypixel.hytale.server.core.entity.entities.player.pages.CustomUIPage;
|
|||||||
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.server.OpenCustomUIInteraction;
|
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.server.OpenCustomUIInteraction;
|
||||||
import com.hypixel.hytale.server.core.universe.PlayerRef;
|
import com.hypixel.hytale.server.core.universe.PlayerRef;
|
||||||
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
||||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class MemoriesPageSupplier implements OpenCustomUIInteraction.CustomPageSupplier {
|
public class MemoriesPageSupplier implements OpenCustomUIInteraction.CustomPageSupplier {
|
||||||
public MemoriesPageSupplier() {
|
@Nullable
|
||||||
}
|
|
||||||
|
|
||||||
@NullableDecl
|
|
||||||
@Override
|
@Override
|
||||||
public CustomUIPage tryCreate(Ref<EntityStore> ref, ComponentAccessor<EntityStore> componentAccessor, PlayerRef playerRef, InteractionContext context) {
|
public CustomUIPage tryCreate(Ref<EntityStore> ref, ComponentAccessor<EntityStore> componentAccessor, PlayerRef playerRef, InteractionContext context) {
|
||||||
return new MemoriesPage(playerRef, context.getTargetBlock());
|
return new MemoriesPage(playerRef, context.getTargetBlock());
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package com.hypixel.hytale.builtin.adventure.memories.page;
|
||||||
|
|
||||||
|
import com.hypixel.hytale.builtin.adventure.memories.MemoriesPlugin;
|
||||||
|
import com.hypixel.hytale.codec.Codec;
|
||||||
|
import com.hypixel.hytale.codec.KeyedCodec;
|
||||||
|
import com.hypixel.hytale.codec.builder.BuilderCodec;
|
||||||
|
import com.hypixel.hytale.codec.codecs.EnumCodec;
|
||||||
|
import com.hypixel.hytale.component.Ref;
|
||||||
|
import com.hypixel.hytale.component.Store;
|
||||||
|
import com.hypixel.hytale.protocol.BlockPosition;
|
||||||
|
import com.hypixel.hytale.protocol.packets.interface_.CustomPageLifetime;
|
||||||
|
import com.hypixel.hytale.protocol.packets.interface_.CustomUIEventBindingType;
|
||||||
|
import com.hypixel.hytale.server.core.entity.entities.Player;
|
||||||
|
import com.hypixel.hytale.server.core.entity.entities.player.pages.InteractiveCustomUIPage;
|
||||||
|
import com.hypixel.hytale.server.core.ui.builder.EventData;
|
||||||
|
import com.hypixel.hytale.server.core.ui.builder.UICommandBuilder;
|
||||||
|
import com.hypixel.hytale.server.core.ui.builder.UIEventBuilder;
|
||||||
|
import com.hypixel.hytale.server.core.universe.PlayerRef;
|
||||||
|
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class MemoriesUnlockedPage extends InteractiveCustomUIPage<MemoriesUnlockedPage.PageEventData> {
|
||||||
|
private final BlockPosition blockPosition;
|
||||||
|
|
||||||
|
public MemoriesUnlockedPage(@Nonnull PlayerRef playerRef, BlockPosition blockPosition) {
|
||||||
|
super(playerRef, CustomPageLifetime.CanDismissOrCloseThroughInteraction, MemoriesUnlockedPage.PageEventData.CODEC);
|
||||||
|
this.blockPosition = blockPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void build(
|
||||||
|
@Nonnull Ref<EntityStore> ref, @Nonnull UICommandBuilder commandBuilder, @Nonnull UIEventBuilder eventBuilder, @Nonnull Store<EntityStore> store
|
||||||
|
) {
|
||||||
|
MemoriesPlugin memoriesPlugin = MemoriesPlugin.get();
|
||||||
|
commandBuilder.append("Pages/Memories/MemoriesUnlocked.ui");
|
||||||
|
eventBuilder.addEventBinding(
|
||||||
|
CustomUIEventBindingType.Activating, "#DiscoverMemoriesButton", new EventData().append("Action", MemoriesUnlockedPage.PageAction.DiscoverMemories)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleDataEvent(@Nonnull Ref<EntityStore> ref, @Nonnull Store<EntityStore> store, @Nonnull MemoriesUnlockedPage.PageEventData data) {
|
||||||
|
Player player = store.getComponent(ref, Player.getComponentType());
|
||||||
|
|
||||||
|
assert player != null;
|
||||||
|
|
||||||
|
if (data.action == MemoriesUnlockedPage.PageAction.DiscoverMemories) {
|
||||||
|
player.getPageManager().openCustomPage(ref, store, new MemoriesPage(this.playerRef, this.blockPosition));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static enum PageAction {
|
||||||
|
DiscoverMemories;
|
||||||
|
|
||||||
|
public static final Codec<MemoriesUnlockedPage.PageAction> CODEC = new EnumCodec<>(MemoriesUnlockedPage.PageAction.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class PageEventData {
|
||||||
|
public static final String KEY_ACTION = "Action";
|
||||||
|
public static final BuilderCodec<MemoriesUnlockedPage.PageEventData> CODEC = BuilderCodec.builder(
|
||||||
|
MemoriesUnlockedPage.PageEventData.class, MemoriesUnlockedPage.PageEventData::new
|
||||||
|
)
|
||||||
|
.append(
|
||||||
|
new KeyedCodec<>("Action", MemoriesUnlockedPage.PageAction.CODEC),
|
||||||
|
(pageEventData, pageAction) -> pageEventData.action = pageAction,
|
||||||
|
pageEventData -> pageEventData.action
|
||||||
|
)
|
||||||
|
.add()
|
||||||
|
.build();
|
||||||
|
public MemoriesUnlockedPage.PageAction action;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.hypixel.hytale.builtin.adventure.memories.page;
|
||||||
|
|
||||||
|
import com.hypixel.hytale.component.ComponentAccessor;
|
||||||
|
import com.hypixel.hytale.component.Ref;
|
||||||
|
import com.hypixel.hytale.server.core.entity.InteractionContext;
|
||||||
|
import com.hypixel.hytale.server.core.entity.entities.player.pages.CustomUIPage;
|
||||||
|
import com.hypixel.hytale.server.core.modules.interaction.interaction.config.server.OpenCustomUIInteraction;
|
||||||
|
import com.hypixel.hytale.server.core.universe.PlayerRef;
|
||||||
|
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public class MemoriesUnlockedPageSuplier implements OpenCustomUIInteraction.CustomPageSupplier {
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public CustomUIPage tryCreate(Ref<EntityStore> ref, ComponentAccessor<EntityStore> componentAccessor, PlayerRef playerRef, InteractionContext context) {
|
||||||
|
return new MemoriesUnlockedPage(playerRef, context.getTargetBlock());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,9 +17,6 @@ public class ForgottenTempleConfig {
|
|||||||
private double minYRespawn = 5.0;
|
private double minYRespawn = 5.0;
|
||||||
private String respawnSound;
|
private String respawnSound;
|
||||||
|
|
||||||
public ForgottenTempleConfig() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getMinYRespawn() {
|
public double getMinYRespawn() {
|
||||||
return this.minYRespawn;
|
return this.minYRespawn;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ import com.hypixel.hytale.server.core.universe.world.SoundUtil;
|
|||||||
import com.hypixel.hytale.server.core.universe.world.World;
|
import com.hypixel.hytale.server.core.universe.world.World;
|
||||||
import com.hypixel.hytale.server.core.universe.world.spawn.ISpawnProvider;
|
import com.hypixel.hytale.server.core.universe.world.spawn.ISpawnProvider;
|
||||||
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
||||||
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
|
import javax.annotation.Nonnull;
|
||||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class TempleRespawnPlayersSystem extends DelayedEntitySystem<EntityStore> {
|
public class TempleRespawnPlayersSystem extends DelayedEntitySystem<EntityStore> {
|
||||||
public static final Query<EntityStore> QUERY = Query.and(PlayerRef.getComponentType(), TransformComponent.getComponentType());
|
public static final Query<EntityStore> QUERY = Query.and(PlayerRef.getComponentType(), TransformComponent.getComponentType());
|
||||||
@@ -31,27 +31,32 @@ public class TempleRespawnPlayersSystem extends DelayedEntitySystem<EntityStore>
|
|||||||
public void tick(
|
public void tick(
|
||||||
float dt,
|
float dt,
|
||||||
int index,
|
int index,
|
||||||
@NonNullDecl ArchetypeChunk<EntityStore> archetypeChunk,
|
@Nonnull ArchetypeChunk<EntityStore> archetypeChunk,
|
||||||
@NonNullDecl Store<EntityStore> store,
|
@Nonnull Store<EntityStore> store,
|
||||||
@NonNullDecl CommandBuffer<EntityStore> commandBuffer
|
@Nonnull CommandBuffer<EntityStore> commandBuffer
|
||||||
) {
|
) {
|
||||||
World world = store.getExternalData().getWorld();
|
World world = store.getExternalData().getWorld();
|
||||||
GameplayConfig gameplayConfig = world.getGameplayConfig();
|
GameplayConfig gameplayConfig = world.getGameplayConfig();
|
||||||
ForgottenTempleConfig config = gameplayConfig.getPluginConfig().get(ForgottenTempleConfig.class);
|
ForgottenTempleConfig config = gameplayConfig.getPluginConfig().get(ForgottenTempleConfig.class);
|
||||||
if (config != null) {
|
if (config != null) {
|
||||||
Vector3d position = archetypeChunk.getComponent(index, TransformComponent.getComponentType()).getPosition();
|
TransformComponent transformComponent = archetypeChunk.getComponent(index, TransformComponent.getComponentType());
|
||||||
|
|
||||||
|
assert transformComponent != null;
|
||||||
|
|
||||||
|
Vector3d position = transformComponent.getPosition();
|
||||||
if (!(position.getY() > config.getMinYRespawn())) {
|
if (!(position.getY() > config.getMinYRespawn())) {
|
||||||
Ref<EntityStore> ref = archetypeChunk.getReferenceTo(index);
|
Ref<EntityStore> ref = archetypeChunk.getReferenceTo(index);
|
||||||
ISpawnProvider spawnProvider = world.getWorldConfig().getSpawnProvider();
|
ISpawnProvider spawnProvider = world.getWorldConfig().getSpawnProvider();
|
||||||
Transform spawnPoint = spawnProvider.getSpawnPoint(ref, commandBuffer);
|
Transform spawnTransform = spawnProvider.getSpawnPoint(ref, commandBuffer);
|
||||||
commandBuffer.addComponent(ref, Teleport.getComponentType(), new Teleport(null, spawnPoint));
|
Teleport teleportComponent = Teleport.createForPlayer(null, spawnTransform);
|
||||||
|
commandBuffer.addComponent(ref, Teleport.getComponentType(), teleportComponent);
|
||||||
PlayerRef playerRef = archetypeChunk.getComponent(index, PlayerRef.getComponentType());
|
PlayerRef playerRef = archetypeChunk.getComponent(index, PlayerRef.getComponentType());
|
||||||
SoundUtil.playSoundEvent2dToPlayer(playerRef, config.getRespawnSoundIndex(), SoundCategory.SFX);
|
SoundUtil.playSoundEvent2dToPlayer(playerRef, config.getRespawnSoundIndex(), SoundCategory.SFX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@NullableDecl
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public Query<EntityStore> getQuery() {
|
public Query<EntityStore> getQuery() {
|
||||||
return QUERY;
|
return QUERY;
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import com.hypixel.hytale.builtin.adventure.memories.MemoriesPlugin;
|
|||||||
import com.hypixel.hytale.builtin.adventure.memories.component.PlayerMemories;
|
import com.hypixel.hytale.builtin.adventure.memories.component.PlayerMemories;
|
||||||
import com.hypixel.hytale.builtin.adventure.memories.memories.Memory;
|
import com.hypixel.hytale.builtin.adventure.memories.memories.Memory;
|
||||||
import com.hypixel.hytale.codec.EmptyExtraInfo;
|
import com.hypixel.hytale.codec.EmptyExtraInfo;
|
||||||
|
import com.hypixel.hytale.component.ComponentAccessor;
|
||||||
import com.hypixel.hytale.component.Ref;
|
import com.hypixel.hytale.component.Ref;
|
||||||
|
import com.hypixel.hytale.component.Store;
|
||||||
import com.hypixel.hytale.protocol.packets.window.WindowType;
|
import com.hypixel.hytale.protocol.packets.window.WindowType;
|
||||||
import com.hypixel.hytale.server.core.Message;
|
import com.hypixel.hytale.server.core.Message;
|
||||||
import com.hypixel.hytale.server.core.entity.entities.player.windows.Window;
|
import com.hypixel.hytale.server.core.entity.entities.player.windows.Window;
|
||||||
@@ -32,14 +34,13 @@ public class MemoriesWindow extends Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOpen0() {
|
public boolean onOpen0(@Nonnull Ref<EntityStore> ref, @Nonnull Store<EntityStore> store) {
|
||||||
JsonArray array = new JsonArray();
|
JsonArray array = new JsonArray();
|
||||||
Ref<EntityStore> ref = this.getPlayerRef().getReference();
|
PlayerMemories playerMemoriesComponent = store.getComponent(ref, PlayerMemories.getComponentType());
|
||||||
PlayerMemories playerMemories = ref.getStore().getComponent(ref, PlayerMemories.getComponentType());
|
if (playerMemoriesComponent != null) {
|
||||||
if (playerMemories != null) {
|
this.windowData.addProperty("capacity", playerMemoriesComponent.getMemoriesCapacity());
|
||||||
this.windowData.addProperty("capacity", playerMemories.getMemoriesCapacity());
|
|
||||||
|
|
||||||
for (Memory memory : playerMemories.getRecordedMemories()) {
|
for (Memory memory : playerMemoriesComponent.getRecordedMemories()) {
|
||||||
JsonObject obj = new JsonObject();
|
JsonObject obj = new JsonObject();
|
||||||
obj.addProperty("title", memory.getTitle());
|
obj.addProperty("title", memory.getTitle());
|
||||||
obj.add("tooltipText", BsonUtil.translateBsonToJson(Message.CODEC.encode(memory.getTooltipText(), EmptyExtraInfo.EMPTY).asDocument()));
|
obj.add("tooltipText", BsonUtil.translateBsonToJson(Message.CODEC.encode(memory.getTooltipText(), EmptyExtraInfo.EMPTY).asDocument()));
|
||||||
@@ -79,6 +80,6 @@ public class MemoriesWindow extends Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClose0() {
|
public void onClose0(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,9 +97,6 @@ public class KillSpawnBeaconObjectiveTaskAsset extends KillObjectiveTaskAsset {
|
|||||||
protected Vector3d offset;
|
protected Vector3d offset;
|
||||||
protected WorldLocationProvider worldLocationProvider;
|
protected WorldLocationProvider worldLocationProvider;
|
||||||
|
|
||||||
public ObjectiveSpawnBeacon() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSpawnBeaconId() {
|
public String getSpawnBeaconId() {
|
||||||
return this.spawnBeaconId;
|
return this.spawnBeaconId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,6 @@ import javax.annotation.Nonnull;
|
|||||||
public class BuilderActionCompleteTask extends BuilderActionPlayAnimation {
|
public class BuilderActionCompleteTask extends BuilderActionPlayAnimation {
|
||||||
protected final BooleanHolder playAnimation = new BooleanHolder();
|
protected final BooleanHolder playAnimation = new BooleanHolder();
|
||||||
|
|
||||||
public BuilderActionCompleteTask() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public String getShortDescription() {
|
public String getShortDescription() {
|
||||||
|
|||||||
@@ -14,9 +14,6 @@ import javax.annotation.Nonnull;
|
|||||||
public class BuilderActionStartObjective extends BuilderActionBase {
|
public class BuilderActionStartObjective extends BuilderActionBase {
|
||||||
protected final AssetHolder objectiveId = new AssetHolder();
|
protected final AssetHolder objectiveId = new AssetHolder();
|
||||||
|
|
||||||
public BuilderActionStartObjective() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public String getShortDescription() {
|
public String getShortDescription() {
|
||||||
|
|||||||
@@ -17,9 +17,6 @@ import javax.annotation.Nullable;
|
|||||||
public class BuilderSensorHasTask extends BuilderSensorBase {
|
public class BuilderSensorHasTask extends BuilderSensorBase {
|
||||||
protected final StringArrayHolder tasksById = new StringArrayHolder();
|
protected final StringArrayHolder tasksById = new StringArrayHolder();
|
||||||
|
|
||||||
public BuilderSensorHasTask() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public String getShortDescription() {
|
public String getShortDescription() {
|
||||||
|
|||||||
@@ -12,9 +12,6 @@ import javax.annotation.Nonnull;
|
|||||||
public class KillTrackerResource implements Resource<EntityStore> {
|
public class KillTrackerResource implements Resource<EntityStore> {
|
||||||
private final List<KillTaskTransaction> killTasks = new ObjectArrayList<>();
|
private final List<KillTaskTransaction> killTasks = new ObjectArrayList<>();
|
||||||
|
|
||||||
public KillTrackerResource() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ResourceType<EntityStore, KillTrackerResource> getResourceType() {
|
public static ResourceType<EntityStore, KillTrackerResource> getResourceType() {
|
||||||
return NPCObjectivesPlugin.get().getKillTrackerResourceType();
|
return NPCObjectivesPlugin.get().getKillTrackerResourceType();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ import javax.annotation.Nonnull;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class KillTrackerSystem extends DeathSystems.OnDeathSystem {
|
public class KillTrackerSystem extends DeathSystems.OnDeathSystem {
|
||||||
public KillTrackerSystem() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public Query<EntityStore> getQuery() {
|
public Query<EntityStore> getQuery() {
|
||||||
|
|||||||
@@ -14,9 +14,6 @@ import javax.annotation.Nonnull;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class SpawnBeaconCheckRemovalSystem extends HolderSystem<EntityStore> {
|
public class SpawnBeaconCheckRemovalSystem extends HolderSystem<EntityStore> {
|
||||||
public SpawnBeaconCheckRemovalSystem() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public Query<EntityStore> getQuery() {
|
public Query<EntityStore> getQuery() {
|
||||||
|
|||||||
@@ -13,9 +13,6 @@ import javax.annotation.Nonnull;
|
|||||||
public class ReputationAttitudeSystem extends StoreSystem<EntityStore> {
|
public class ReputationAttitudeSystem extends StoreSystem<EntityStore> {
|
||||||
private final ResourceType<EntityStore, Blackboard> resourceType = Blackboard.getResourceType();
|
private final ResourceType<EntityStore, Blackboard> resourceType = Blackboard.getResourceType();
|
||||||
|
|
||||||
public ReputationAttitudeSystem() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSystemAddedToStore(@Nonnull Store<EntityStore> store) {
|
public void onSystemAddedToStore(@Nonnull Store<EntityStore> store) {
|
||||||
Blackboard blackboard = store.getResource(this.resourceType);
|
Blackboard blackboard = store.getResource(this.resourceType);
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ import javax.annotation.Nonnull;
|
|||||||
public class BuilderActionOpenBarterShop extends BuilderActionBase {
|
public class BuilderActionOpenBarterShop extends BuilderActionBase {
|
||||||
protected final AssetHolder shopId = new AssetHolder();
|
protected final AssetHolder shopId = new AssetHolder();
|
||||||
|
|
||||||
public BuilderActionOpenBarterShop() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public String getShortDescription() {
|
public String getShortDescription() {
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ import javax.annotation.Nonnull;
|
|||||||
public class BuilderActionOpenShop extends BuilderActionBase {
|
public class BuilderActionOpenShop extends BuilderActionBase {
|
||||||
protected final AssetHolder shopId = new AssetHolder();
|
protected final AssetHolder shopId = new AssetHolder();
|
||||||
|
|
||||||
public BuilderActionOpenShop() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public String getShortDescription() {
|
public String getShortDescription() {
|
||||||
|
|||||||
@@ -45,8 +45,5 @@ public class DialogPage extends InteractiveCustomUIPage<DialogPage.DialogPageEve
|
|||||||
DialogPage.DialogPageEventData.class, DialogPage.DialogPageEventData::new
|
DialogPage.DialogPageEventData.class, DialogPage.DialogPageEventData::new
|
||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public DialogPageEventData() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -899,9 +899,6 @@ public class ObjectivePlugin extends JavaPlugin {
|
|||||||
.build();
|
.build();
|
||||||
private DataStoreProvider dataStoreProvider = new DiskDataStoreProvider("objectives");
|
private DataStoreProvider dataStoreProvider = new DiskDataStoreProvider("objectives");
|
||||||
|
|
||||||
public ObjectivePluginConfig() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public DataStoreProvider getDataStoreProvider() {
|
public DataStoreProvider getDataStoreProvider() {
|
||||||
return this.dataStoreProvider;
|
return this.dataStoreProvider;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,9 +47,6 @@ public class TreasureChestState extends ItemContainerState implements BreakValid
|
|||||||
protected UUID chestUUID;
|
protected UUID chestUUID;
|
||||||
protected boolean opened;
|
protected boolean opened;
|
||||||
|
|
||||||
public TreasureChestState() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canOpen(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor) {
|
public boolean canOpen(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor) {
|
||||||
if (!this.opened) {
|
if (!this.opened) {
|
||||||
|
|||||||
@@ -31,17 +31,6 @@ import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class ObjectiveLocationMarkerCommand extends AbstractCommandCollection {
|
public class ObjectiveLocationMarkerCommand extends AbstractCommandCollection {
|
||||||
@Nonnull
|
|
||||||
private static final Message MESSAGE_COMMANDS_OBJECTIVE_LOCATION_MARKER_NOT_FOUND = Message.translation("server.commands.objective.locationMarker.notFound");
|
|
||||||
@Nonnull
|
|
||||||
private static final Message MESSAGE_GENERAL_FAILED_DID_YOU_MEAN = Message.translation("server.general.failed.didYouMean");
|
|
||||||
@Nonnull
|
|
||||||
private static final Message MESSAGE_COMMANDS_OBJECTIVE_LOCATION_MARKER_ADDED = Message.translation("server.commands.objective.locationMarker.added");
|
|
||||||
@Nonnull
|
|
||||||
private static final Message MESSAGE_COMMANDS_OBJECTIVE_LOCATION_MARKER_ENABLED = Message.translation("server.commands.objective.locationMarker.enabled");
|
|
||||||
@Nonnull
|
|
||||||
private static final Message MESSAGE_COMMANDS_OBJECTIVE_LOCATION_MARKER_DISABLED = Message.translation("server.commands.objective.locationMarker.disabled");
|
|
||||||
|
|
||||||
public ObjectiveLocationMarkerCommand() {
|
public ObjectiveLocationMarkerCommand() {
|
||||||
super("locationmarker", "server.commands.objective.locationMarker");
|
super("locationmarker", "server.commands.objective.locationMarker");
|
||||||
this.addAliases("marker");
|
this.addAliases("marker");
|
||||||
@@ -71,9 +60,9 @@ public class ObjectiveLocationMarkerCommand extends AbstractCommandCollection {
|
|||||||
|
|
||||||
String objectiveLocationMarkerId = this.locationMarkerArg.get(context);
|
String objectiveLocationMarkerId = this.locationMarkerArg.get(context);
|
||||||
if (ObjectiveLocationMarkerAsset.getAssetMap().getAsset(objectiveLocationMarkerId) == null) {
|
if (ObjectiveLocationMarkerAsset.getAssetMap().getAsset(objectiveLocationMarkerId) == null) {
|
||||||
context.sendMessage(ObjectiveLocationMarkerCommand.MESSAGE_COMMANDS_OBJECTIVE_LOCATION_MARKER_NOT_FOUND.param("id", objectiveLocationMarkerId));
|
context.sendMessage(Message.translation("server.commands.objective.locationMarker.notFound").param("id", objectiveLocationMarkerId));
|
||||||
context.sendMessage(
|
context.sendMessage(
|
||||||
ObjectiveLocationMarkerCommand.MESSAGE_GENERAL_FAILED_DID_YOU_MEAN
|
Message.translation("server.general.failed.didYouMean")
|
||||||
.param(
|
.param(
|
||||||
"choices",
|
"choices",
|
||||||
StringUtil.sortByFuzzyDistance(
|
StringUtil.sortByFuzzyDistance(
|
||||||
@@ -95,7 +84,7 @@ public class ObjectiveLocationMarkerCommand extends AbstractCommandCollection {
|
|||||||
holder.ensureComponent(Intangible.getComponentType());
|
holder.ensureComponent(Intangible.getComponentType());
|
||||||
holder.ensureComponent(HiddenFromAdventurePlayers.getComponentType());
|
holder.ensureComponent(HiddenFromAdventurePlayers.getComponentType());
|
||||||
store.addEntity(holder, AddReason.SPAWN);
|
store.addEntity(holder, AddReason.SPAWN);
|
||||||
context.sendMessage(ObjectiveLocationMarkerCommand.MESSAGE_COMMANDS_OBJECTIVE_LOCATION_MARKER_ADDED.param("id", objectiveLocationMarkerId));
|
context.sendMessage(Message.translation("server.commands.objective.locationMarker.added").param("id", objectiveLocationMarkerId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,7 +99,7 @@ public class ObjectiveLocationMarkerCommand extends AbstractCommandCollection {
|
|||||||
WorldConfig worldConfig = world.getWorldConfig();
|
WorldConfig worldConfig = world.getWorldConfig();
|
||||||
worldConfig.setObjectiveMarkersEnabled(false);
|
worldConfig.setObjectiveMarkersEnabled(false);
|
||||||
worldConfig.markChanged();
|
worldConfig.markChanged();
|
||||||
context.sendMessage(ObjectiveLocationMarkerCommand.MESSAGE_COMMANDS_OBJECTIVE_LOCATION_MARKER_DISABLED.param("worldName", world.getName()));
|
context.sendMessage(Message.translation("server.commands.objective.locationMarker.disabled").param("worldName", world.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +113,7 @@ public class ObjectiveLocationMarkerCommand extends AbstractCommandCollection {
|
|||||||
WorldConfig worldConfig = world.getWorldConfig();
|
WorldConfig worldConfig = world.getWorldConfig();
|
||||||
worldConfig.setObjectiveMarkersEnabled(true);
|
worldConfig.setObjectiveMarkersEnabled(true);
|
||||||
worldConfig.markChanged();
|
worldConfig.markChanged();
|
||||||
context.sendMessage(ObjectiveLocationMarkerCommand.MESSAGE_COMMANDS_OBJECTIVE_LOCATION_MARKER_ENABLED.param("worldName", world.getName()));
|
context.sendMessage(Message.translation("server.commands.objective.locationMarker.enabled").param("worldName", world.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,17 +29,6 @@ import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class ObjectiveReachLocationMarkerCommand extends AbstractCommandCollection {
|
public class ObjectiveReachLocationMarkerCommand extends AbstractCommandCollection {
|
||||||
@Nonnull
|
|
||||||
private static final Message MESSAGE_COMMANDS_OBJECTIVE_REACH_LOCATION_MARKER_NOT_FOUND = Message.translation(
|
|
||||||
"server.commands.objective.reachLocationMarker.notFound"
|
|
||||||
);
|
|
||||||
@Nonnull
|
|
||||||
private static final Message MESSAGE_GENERAL_FAILED_DID_YOU_MEAN = Message.translation("server.general.failed.didYouMean");
|
|
||||||
@Nonnull
|
|
||||||
private static final Message MESSAGE_COMMANDS_OBJECTIVE_REACH_LOCATION_MARKER_ADDED = Message.translation(
|
|
||||||
"server.commands.objective.reachLocationMarker.added"
|
|
||||||
);
|
|
||||||
|
|
||||||
public ObjectiveReachLocationMarkerCommand() {
|
public ObjectiveReachLocationMarkerCommand() {
|
||||||
super("reachlocationmarker", "server.commands.objective.reachLocationMarker");
|
super("reachlocationmarker", "server.commands.objective.reachLocationMarker");
|
||||||
this.addSubCommand(new ObjectiveReachLocationMarkerCommand.AddReachLocationMarkerCommand());
|
this.addSubCommand(new ObjectiveReachLocationMarkerCommand.AddReachLocationMarkerCommand());
|
||||||
@@ -61,11 +50,9 @@ public class ObjectiveReachLocationMarkerCommand extends AbstractCommandCollecti
|
|||||||
) {
|
) {
|
||||||
String reachLocationMarkerId = this.reachLocationMarkerArg.get(context);
|
String reachLocationMarkerId = this.reachLocationMarkerArg.get(context);
|
||||||
if (ReachLocationMarkerAsset.getAssetMap().getAsset(reachLocationMarkerId) == null) {
|
if (ReachLocationMarkerAsset.getAssetMap().getAsset(reachLocationMarkerId) == null) {
|
||||||
|
context.sendMessage(Message.translation("server.commands.objective.reachLocationMarker.notFound").param("id", reachLocationMarkerId));
|
||||||
context.sendMessage(
|
context.sendMessage(
|
||||||
ObjectiveReachLocationMarkerCommand.MESSAGE_COMMANDS_OBJECTIVE_REACH_LOCATION_MARKER_NOT_FOUND.param("id", reachLocationMarkerId)
|
Message.translation("server.general.failed.didYouMean")
|
||||||
);
|
|
||||||
context.sendMessage(
|
|
||||||
ObjectiveReachLocationMarkerCommand.MESSAGE_GENERAL_FAILED_DID_YOU_MEAN
|
|
||||||
.param(
|
.param(
|
||||||
"choices",
|
"choices",
|
||||||
StringUtil.sortByFuzzyDistance(
|
StringUtil.sortByFuzzyDistance(
|
||||||
@@ -91,7 +78,7 @@ public class ObjectiveReachLocationMarkerCommand extends AbstractCommandCollecti
|
|||||||
holder.ensureComponent(Intangible.getComponentType());
|
holder.ensureComponent(Intangible.getComponentType());
|
||||||
holder.ensureComponent(HiddenFromAdventurePlayers.getComponentType());
|
holder.ensureComponent(HiddenFromAdventurePlayers.getComponentType());
|
||||||
store.addEntity(holder, AddReason.SPAWN);
|
store.addEntity(holder, AddReason.SPAWN);
|
||||||
context.sendMessage(ObjectiveReachLocationMarkerCommand.MESSAGE_COMMANDS_OBJECTIVE_REACH_LOCATION_MARKER_ADDED.param("id", reachLocationMarkerId));
|
context.sendMessage(Message.translation("server.commands.objective.reachLocationMarker.added").param("id", reachLocationMarkerId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,10 +29,6 @@ public class ObjectiveStartCommand extends AbstractCommandCollection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class StartObjectiveCommand extends AbstractPlayerCommand {
|
public static class StartObjectiveCommand extends AbstractPlayerCommand {
|
||||||
@Nonnull
|
|
||||||
private static final Message MESSAGE_COMMANDS_OBJECTIVE_OBJECTIVE_NOT_FOUND = Message.translation("server.commands.objective.objectiveNotFound");
|
|
||||||
@Nonnull
|
|
||||||
private static final Message MESSAGE_GENERAL_FAILED_DID_YOU_MEAN = Message.translation("server.general.failed.didYouMean");
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private final RequiredArg<String> objectiveArg = this.withRequiredArg(
|
private final RequiredArg<String> objectiveArg = this.withRequiredArg(
|
||||||
"objectiveId", "server.commands.objective.start.objective.arg.objectiveId.desc", ArgTypes.STRING
|
"objectiveId", "server.commands.objective.start.objective.arg.objectiveId.desc", ArgTypes.STRING
|
||||||
@@ -49,9 +45,10 @@ public class ObjectiveStartCommand extends AbstractCommandCollection {
|
|||||||
String objectiveId = this.objectiveArg.get(context);
|
String objectiveId = this.objectiveArg.get(context);
|
||||||
ObjectiveAsset asset = ObjectiveAsset.getAssetMap().getAsset(objectiveId);
|
ObjectiveAsset asset = ObjectiveAsset.getAssetMap().getAsset(objectiveId);
|
||||||
if (asset == null) {
|
if (asset == null) {
|
||||||
context.sendMessage(MESSAGE_COMMANDS_OBJECTIVE_OBJECTIVE_NOT_FOUND.param("id", objectiveId));
|
context.sendMessage(Message.translation("server.commands.objective.objectiveNotFound").param("id", objectiveId));
|
||||||
context.sendMessage(
|
context.sendMessage(
|
||||||
MESSAGE_GENERAL_FAILED_DID_YOU_MEAN.param(
|
Message.translation("server.general.failed.didYouMean")
|
||||||
|
.param(
|
||||||
"choices",
|
"choices",
|
||||||
StringUtil.sortByFuzzyDistance(objectiveId, ObjectiveAsset.getAssetMap().getAssetMap().keySet(), CommandUtil.RECOMMEND_COUNT).toString()
|
StringUtil.sortByFuzzyDistance(objectiveId, ObjectiveAsset.getAssetMap().getAssetMap().keySet(), CommandUtil.RECOMMEND_COUNT).toString()
|
||||||
)
|
)
|
||||||
@@ -68,10 +65,6 @@ public class ObjectiveStartCommand extends AbstractCommandCollection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class StartObjectiveLineCommand extends AbstractPlayerCommand {
|
public static class StartObjectiveLineCommand extends AbstractPlayerCommand {
|
||||||
@Nonnull
|
|
||||||
private static final Message MESSAGE_COMMANDS_OBJECTIVE_OBJECTIVE_LINE_NOT_FOUND = Message.translation("server.commands.objective.objectiveLineNotFound");
|
|
||||||
@Nonnull
|
|
||||||
private static final Message MESSAGE_GENERAL_FAILED_DID_YOU_MEAN = Message.translation("server.general.failed.didYouMean");
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
private final RequiredArg<String> objectiveLineArg = this.withRequiredArg(
|
private final RequiredArg<String> objectiveLineArg = this.withRequiredArg(
|
||||||
"objectiveLineId", "server.commands.objective.start.objectiveLine.arg.objectiveLineId.desc", ArgTypes.STRING
|
"objectiveLineId", "server.commands.objective.start.objectiveLine.arg.objectiveLineId.desc", ArgTypes.STRING
|
||||||
@@ -87,9 +80,10 @@ public class ObjectiveStartCommand extends AbstractCommandCollection {
|
|||||||
) {
|
) {
|
||||||
String objectiveLineId = this.objectiveLineArg.get(context);
|
String objectiveLineId = this.objectiveLineArg.get(context);
|
||||||
if (ObjectiveLineAsset.getAssetMap().getAsset(objectiveLineId) == null) {
|
if (ObjectiveLineAsset.getAssetMap().getAsset(objectiveLineId) == null) {
|
||||||
context.sendMessage(MESSAGE_COMMANDS_OBJECTIVE_OBJECTIVE_LINE_NOT_FOUND.param("id", objectiveLineId));
|
context.sendMessage(Message.translation("server.commands.objective.objectiveLineNotFound").param("id", objectiveLineId));
|
||||||
context.sendMessage(
|
context.sendMessage(
|
||||||
MESSAGE_GENERAL_FAILED_DID_YOU_MEAN.param(
|
Message.translation("server.general.failed.didYouMean")
|
||||||
|
.param(
|
||||||
"choices",
|
"choices",
|
||||||
StringUtil.sortByFuzzyDistance(objectiveLineId, ObjectiveLineAsset.getAssetMap().getAssetMap().keySet(), CommandUtil.RECOMMEND_COUNT)
|
StringUtil.sortByFuzzyDistance(objectiveLineId, ObjectiveLineAsset.getAssetMap().getAssetMap().keySet(), CommandUtil.RECOMMEND_COUNT)
|
||||||
.toString()
|
.toString()
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.hypixel.hytale.builtin.adventure.objectives.config.completion.ClearOb
|
|||||||
import com.hypixel.hytale.builtin.adventure.objectives.config.completion.ObjectiveCompletionAsset;
|
import com.hypixel.hytale.builtin.adventure.objectives.config.completion.ObjectiveCompletionAsset;
|
||||||
import com.hypixel.hytale.builtin.adventure.objectives.interactions.StartObjectiveInteraction;
|
import com.hypixel.hytale.builtin.adventure.objectives.interactions.StartObjectiveInteraction;
|
||||||
import com.hypixel.hytale.component.ComponentAccessor;
|
import com.hypixel.hytale.component.ComponentAccessor;
|
||||||
import com.hypixel.hytale.server.core.entity.Entity;
|
|
||||||
import com.hypixel.hytale.server.core.entity.EntityUtils;
|
import com.hypixel.hytale.server.core.entity.EntityUtils;
|
||||||
import com.hypixel.hytale.server.core.entity.LivingEntity;
|
import com.hypixel.hytale.server.core.entity.LivingEntity;
|
||||||
import com.hypixel.hytale.server.core.inventory.ItemStack;
|
import com.hypixel.hytale.server.core.inventory.ItemStack;
|
||||||
@@ -27,9 +26,8 @@ public class ClearObjectiveItemsCompletion extends ObjectiveCompletion {
|
|||||||
@Override
|
@Override
|
||||||
public void handle(@Nonnull Objective objective, @Nonnull ComponentAccessor<EntityStore> componentAccessor) {
|
public void handle(@Nonnull Objective objective, @Nonnull ComponentAccessor<EntityStore> componentAccessor) {
|
||||||
objective.forEachParticipant((participantReference, objectiveUuid) -> {
|
objective.forEachParticipant((participantReference, objectiveUuid) -> {
|
||||||
Entity entity = EntityUtils.getEntity(participantReference, componentAccessor);
|
if (EntityUtils.getEntity(participantReference, componentAccessor) instanceof LivingEntity livingEntity) {
|
||||||
if (entity instanceof LivingEntity) {
|
CombinedItemContainer inventory = livingEntity.getInventory().getCombinedHotbarFirst();
|
||||||
CombinedItemContainer inventory = ((LivingEntity)entity).getInventory().getCombinedHotbarFirst();
|
|
||||||
|
|
||||||
for (short i = 0; i < inventory.getCapacity(); i++) {
|
for (short i = 0; i < inventory.getCapacity(); i++) {
|
||||||
ItemStack itemStack = inventory.getItemStack(i);
|
ItemStack itemStack = inventory.getItemStack(i);
|
||||||
|
|||||||
@@ -29,9 +29,6 @@ public class ObjectiveHistoryComponent implements Component<EntityStore> {
|
|||||||
private Map<String, ObjectiveHistoryData> objectiveHistoryMap = new Object2ObjectOpenHashMap<>();
|
private Map<String, ObjectiveHistoryData> objectiveHistoryMap = new Object2ObjectOpenHashMap<>();
|
||||||
private Map<String, ObjectiveLineHistoryData> objectiveLineHistoryMap = new Object2ObjectOpenHashMap<>();
|
private Map<String, ObjectiveLineHistoryData> objectiveLineHistoryMap = new Object2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
public ObjectiveHistoryComponent() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, ObjectiveHistoryData> getObjectiveHistoryMap() {
|
public Map<String, ObjectiveHistoryData> getObjectiveHistoryMap() {
|
||||||
return this.objectiveHistoryMap;
|
return this.objectiveHistoryMap;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,9 +96,6 @@ public class ObjectiveLocationMarkerAsset implements JsonAssetWithMap<String, De
|
|||||||
return (DefaultAssetMap<String, ObjectiveLocationMarkerAsset>)getAssetStore().getAssetMap();
|
return (DefaultAssetMap<String, ObjectiveLocationMarkerAsset>)getAssetStore().getAssetMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObjectiveLocationMarkerAsset() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,9 +25,6 @@ public class ObjectiveGameplayConfig {
|
|||||||
.build();
|
.build();
|
||||||
protected Map<String, String> starterObjectiveLinePerWorld;
|
protected Map<String, String> starterObjectiveLinePerWorld;
|
||||||
|
|
||||||
public ObjectiveGameplayConfig() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static ObjectiveGameplayConfig get(@Nonnull GameplayConfig config) {
|
public static ObjectiveGameplayConfig get(@Nonnull GameplayConfig config) {
|
||||||
return config.getPluginConfig().get(ObjectiveGameplayConfig.class);
|
return config.getPluginConfig().get(ObjectiveGameplayConfig.class);
|
||||||
|
|||||||
@@ -18,9 +18,6 @@ public abstract class ObjectiveLocationMarkerArea {
|
|||||||
protected Box entryAreaBox;
|
protected Box entryAreaBox;
|
||||||
protected Box exitAreaBox;
|
protected Box exitAreaBox;
|
||||||
|
|
||||||
public ObjectiveLocationMarkerArea() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void getPlayersInEntryArea(
|
public abstract void getPlayersInEntryArea(
|
||||||
@Nonnull SpatialResource<Ref<EntityStore>, EntityStore> var1, @Nonnull List<Ref<EntityStore>> var2, @Nonnull Vector3d var3
|
@Nonnull SpatialResource<Ref<EntityStore>, EntityStore> var1, @Nonnull List<Ref<EntityStore>> var2, @Nonnull Vector3d var3
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -13,9 +13,6 @@ public abstract class ObjectiveTypeSetup {
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
public static final CodecMapCodec<ObjectiveTypeSetup> CODEC = new CodecMapCodec<>("Type");
|
public static final CodecMapCodec<ObjectiveTypeSetup> CODEC = new CodecMapCodec<>("Type");
|
||||||
|
|
||||||
public ObjectiveTypeSetup() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public abstract String getObjectiveIdToStart();
|
public abstract String getObjectiveIdToStart();
|
||||||
|
|
||||||
|
|||||||
@@ -25,9 +25,6 @@ public class SetupObjective extends ObjectiveTypeSetup {
|
|||||||
.build();
|
.build();
|
||||||
protected String objectiveId;
|
protected String objectiveId;
|
||||||
|
|
||||||
public SetupObjective() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getObjectiveIdToStart() {
|
public String getObjectiveIdToStart() {
|
||||||
return this.objectiveId;
|
return this.objectiveId;
|
||||||
|
|||||||
@@ -27,9 +27,6 @@ public class SetupObjectiveLine extends ObjectiveTypeSetup {
|
|||||||
.build();
|
.build();
|
||||||
protected String objectiveLineId;
|
protected String objectiveLineId;
|
||||||
|
|
||||||
public SetupObjectiveLine() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public String getObjectiveIdToStart() {
|
public String getObjectiveIdToStart() {
|
||||||
|
|||||||
@@ -104,9 +104,6 @@ public abstract class ObjectiveTaskAsset {
|
|||||||
MARKER,
|
MARKER,
|
||||||
PLAYER_AND_MARKER;
|
PLAYER_AND_MARKER;
|
||||||
|
|
||||||
private TaskScope() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isTaskPossibleForMarker() {
|
public boolean isTaskPossibleForMarker() {
|
||||||
return this == MARKER || this == PLAYER_AND_MARKER;
|
return this == MARKER || this == PLAYER_AND_MARKER;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,6 @@ public class ReachLocationTaskAsset extends ObjectiveTaskAsset {
|
|||||||
.build();
|
.build();
|
||||||
protected String targetLocationId;
|
protected String targetLocationId;
|
||||||
|
|
||||||
public ReachLocationTaskAsset() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public ObjectiveTaskAsset.TaskScope getTaskScope() {
|
public ObjectiveTaskAsset.TaskScope getTaskScope() {
|
||||||
|
|||||||
@@ -112,9 +112,6 @@ public class TreasureMapObjectiveTaskAsset extends ObjectiveTaskAsset {
|
|||||||
protected WorldLocationProvider worldLocationProvider;
|
protected WorldLocationProvider worldLocationProvider;
|
||||||
protected String chestBlockTypeKey;
|
protected String chestBlockTypeKey;
|
||||||
|
|
||||||
public ChestConfig() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getMinRadius() {
|
public float getMinRadius() {
|
||||||
return this.minRadius;
|
return this.minRadius;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,9 +50,6 @@ public class SoloInventoryCondition extends TaskConditionAsset {
|
|||||||
protected boolean consumeOnCompletion;
|
protected boolean consumeOnCompletion;
|
||||||
protected boolean holdInHand;
|
protected boolean holdInHand;
|
||||||
|
|
||||||
public SoloInventoryCondition() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockTagOrItemIdField getBlockTypeOrTagTask() {
|
public BlockTagOrItemIdField getBlockTypeOrTagTask() {
|
||||||
return this.blockTypeOrTagTask;
|
return this.blockTypeOrTagTask;
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user