2026.01.24-6e2d4fc36
This commit is contained in:
30
.gitignore
vendored
30
.gitignore
vendored
@@ -1,8 +1,4 @@
|
||||
.gradle
|
||||
build/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
.kotlin
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
@@ -17,27 +13,7 @@ out/
|
||||
!**/src/main/**/out/
|
||||
!**/src/test/**/out/
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.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
|
||||
gradlew
|
||||
.gradle
|
||||
gradle
|
||||
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
|
||||
1
.idea/misc.xml
generated
1
.idea/misc.xml
generated
@@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="FrameworkDetectionExcludesConfiguration">
|
||||
|
||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</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 {
|
||||
id("java")
|
||||
}
|
||||
@@ -10,9 +12,14 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation(platform("org.junit:junit-bom:5.10.0"))
|
||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||
implementation(files("${System.getenv("APPDATA")}/Hytale/install/release/package/game/latest/Server/HytaleServer.jar"))
|
||||
}
|
||||
}
|
||||
|
||||
tasks.wrapper {
|
||||
gradleVersion = "8.14"
|
||||
distributionType = Wrapper.DistributionType.ALL
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
public class SneakyThrow {
|
||||
public SneakyThrow() {
|
||||
}
|
||||
|
||||
public static RuntimeException sneakyThrow(Throwable t) {
|
||||
if (t == null) {
|
||||
throw new NullPointerException("t");
|
||||
|
||||
@@ -9,9 +9,6 @@ public class TLRUtil {
|
||||
private static final Unsafe UNSAFE;
|
||||
private static final long PROBE;
|
||||
|
||||
public TLRUtil() {
|
||||
}
|
||||
|
||||
public static void localInit() {
|
||||
ThreadLocalRandom.current();
|
||||
}
|
||||
|
||||
@@ -12,9 +12,6 @@ import java.util.Map.Entry;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class LateMain {
|
||||
public LateMain() {
|
||||
}
|
||||
|
||||
public static void lateMain(String[] args) {
|
||||
try {
|
||||
if (!Options.parse(args)) {
|
||||
|
||||
@@ -13,9 +13,6 @@ import java.util.Locale;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public final class Main {
|
||||
public Main() {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Locale.setDefault(Locale.ENGLISH);
|
||||
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_VALUES_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;
|
||||
|
||||
public abstract class AssetMap<K, T extends JsonAsset<K>> {
|
||||
public AssetMap() {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
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> CLIENT_TAG_MAP = new Object2IntOpenHashMap<>();
|
||||
|
||||
public AssetRegistry() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static Map<Class<? extends JsonAssetWithMap>, AssetStore<?, ?, ?>> getStoreMap() {
|
||||
return storeMapUnmodifiable;
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
|
||||
|
||||
public class AssetValidationResults extends ValidationResults {
|
||||
private Set<Class<? extends JsonAsset>> disabledMissingAssetClasses;
|
||||
@@ -40,11 +39,11 @@ public class AssetValidationResults extends ValidationResults {
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
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()) {
|
||||
for (ValidationResults.ValidatorResultsHolder holder : this.validatorExceptions) {
|
||||
String file = "unknown";
|
||||
|
||||
@@ -227,8 +227,5 @@ public class ContainedAssetCodec<K, T extends JsonAssetWithMap<K, M>, M extends
|
||||
INHERIT_ID,
|
||||
INHERIT_ID_AND_PARENT,
|
||||
INJECT_PARENT;
|
||||
|
||||
private Mode() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,4 @@ import com.hypixel.hytale.assetstore.JsonAsset;
|
||||
import com.hypixel.hytale.event.IEvent;
|
||||
|
||||
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> unmodifiableIndexedTagStorage = new Int2ObjectConcurrentHashMap<>();
|
||||
|
||||
public AssetMapWithIndexes() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void clear() {
|
||||
super.clear();
|
||||
|
||||
@@ -5,9 +5,6 @@ import it.unimi.dsi.fastutil.Hash.Strategy;
|
||||
public class CaseInsensitiveHashStrategy<K> implements Strategy<K> {
|
||||
private static final CaseInsensitiveHashStrategy INSTANCE = new CaseInsensitiveHashStrategy();
|
||||
|
||||
public CaseInsensitiveHashStrategy() {
|
||||
}
|
||||
|
||||
public static <K> CaseInsensitiveHashStrategy<K> getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@@ -45,9 +45,6 @@ public class CameraShakeConfig implements NetworkSerializable<com.hypixel.hytale
|
||||
protected CameraShakeConfig.OffsetNoise offset = CameraShakeConfig.OffsetNoise.NONE;
|
||||
protected CameraShakeConfig.RotationNoise rotation = CameraShakeConfig.RotationNoise.NONE;
|
||||
|
||||
public CameraShakeConfig() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public com.hypixel.hytale.protocol.CameraShakeConfig toPacket() {
|
||||
boolean continuous = this.startTime == null;
|
||||
@@ -97,9 +94,6 @@ public class CameraShakeConfig implements NetworkSerializable<com.hypixel.hytale
|
||||
protected NoiseConfig[] y;
|
||||
protected NoiseConfig[] z;
|
||||
|
||||
public OffsetNoise() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
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));
|
||||
@@ -140,9 +134,6 @@ public class CameraShakeConfig implements NetworkSerializable<com.hypixel.hytale
|
||||
protected NoiseConfig[] yaw;
|
||||
protected NoiseConfig[] roll;
|
||||
|
||||
public RotationNoise() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
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));
|
||||
|
||||
@@ -27,9 +27,6 @@ public class EasingConfig implements NetworkSerializable<com.hypixel.hytale.prot
|
||||
@Nonnull
|
||||
protected EasingType type = EasingType.Linear;
|
||||
|
||||
public EasingConfig() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public com.hypixel.hytale.protocol.EasingConfig toPacket() {
|
||||
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 amplitude;
|
||||
|
||||
public NoiseConfig() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
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());
|
||||
@@ -118,9 +115,6 @@ public class NoiseConfig implements NetworkSerializable<com.hypixel.hytale.proto
|
||||
protected float max = 1.0F;
|
||||
protected boolean normalize = true;
|
||||
|
||||
public ClampConfig() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public com.hypixel.hytale.protocol.ClampConfig toPacket() {
|
||||
return new com.hypixel.hytale.protocol.ClampConfig(this.min, this.max, this.normalize);
|
||||
|
||||
@@ -40,9 +40,6 @@ public class CameraShakeEffect extends CameraEffect {
|
||||
@Nullable
|
||||
protected ShakeIntensity intensity;
|
||||
|
||||
public CameraShakeEffect() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public AccumulationMode getAccumulationMode() {
|
||||
return this.intensity == null ? ShakeIntensity.DEFAULT_ACCUMULATION_MODE : this.intensity.getAccumulationMode();
|
||||
|
||||
@@ -51,9 +51,6 @@ public class ShakeIntensity {
|
||||
@Nullable
|
||||
protected ShakeIntensity.Modifier modifier;
|
||||
|
||||
public ShakeIntensity() {
|
||||
}
|
||||
|
||||
public float getValue() {
|
||||
return this.value;
|
||||
}
|
||||
@@ -99,9 +96,6 @@ public class ShakeIntensity {
|
||||
private float[] input;
|
||||
private float[] output;
|
||||
|
||||
public Modifier() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float apply(float intensityContext) {
|
||||
float inputMin = this.input[0];
|
||||
|
||||
@@ -13,9 +13,6 @@ import java.util.Map.Entry;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class CameraShakePacketGenerator extends SimpleAssetPacketGenerator<String, CameraShake, IndexedAssetMap<String, CameraShake>> {
|
||||
public CameraShakePacketGenerator() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public Packet generateInitPacket(@Nonnull IndexedAssetMap<String, CameraShake> assetMap, @Nonnull Map<String, CameraShake> assets) {
|
||||
return toCachedPacket(UpdateType.Init, assetMap, assets);
|
||||
|
||||
@@ -34,9 +34,6 @@ public class ViewBobbing
|
||||
@Nonnull
|
||||
protected CameraShakeConfig firstPerson;
|
||||
|
||||
public ViewBobbing() {
|
||||
}
|
||||
|
||||
public MovementType getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@@ -14,9 +14,6 @@ import java.util.Map.Entry;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class ViewBobbingPacketGenerator extends SimpleAssetPacketGenerator<MovementType, ViewBobbing, AssetMap<MovementType, ViewBobbing>> {
|
||||
public ViewBobbingPacketGenerator() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
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.storage.EntityStore;
|
||||
import javax.annotation.Nonnull;
|
||||
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
|
||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class CameraEffectCommand extends AbstractCommandCollection {
|
||||
@Nonnull
|
||||
@@ -52,12 +51,12 @@ public class CameraEffectCommand extends AbstractCommandCollection {
|
||||
|
||||
@Override
|
||||
protected void execute(
|
||||
@NonNullDecl CommandContext context,
|
||||
@NullableDecl Ref<EntityStore> sourceRef,
|
||||
@NonNullDecl Ref<EntityStore> ref,
|
||||
@NonNullDecl PlayerRef playerRef,
|
||||
@NonNullDecl World world,
|
||||
@NonNullDecl Store<EntityStore> store
|
||||
@Nonnull CommandContext context,
|
||||
@Nullable Ref<EntityStore> sourceRef,
|
||||
@Nonnull Ref<EntityStore> ref,
|
||||
@Nonnull PlayerRef playerRef,
|
||||
@Nonnull World world,
|
||||
@Nonnull Store<EntityStore> store
|
||||
) {
|
||||
DamageCause damageCause = context.get(this.causeArg);
|
||||
float damageAmount = context.get(this.damageArg);
|
||||
@@ -95,12 +94,12 @@ public class CameraEffectCommand extends AbstractCommandCollection {
|
||||
|
||||
@Override
|
||||
protected void execute(
|
||||
@NonNullDecl CommandContext context,
|
||||
@NullableDecl Ref<EntityStore> sourceRef,
|
||||
@NonNullDecl Ref<EntityStore> ref,
|
||||
@NonNullDecl PlayerRef playerRef,
|
||||
@NonNullDecl World world,
|
||||
@NonNullDecl Store<EntityStore> store
|
||||
@Nonnull CommandContext context,
|
||||
@Nullable Ref<EntityStore> sourceRef,
|
||||
@Nonnull Ref<EntityStore> ref,
|
||||
@Nonnull PlayerRef playerRef,
|
||||
@Nonnull World world,
|
||||
@Nonnull Store<EntityStore> store
|
||||
) {
|
||||
CameraEffect cameraEffect = context.get(this.effectArg);
|
||||
float intensity = context.get(this.intensityArg);
|
||||
|
||||
@@ -40,9 +40,6 @@ public class CameraShakeInteraction extends SimpleInstantInteraction {
|
||||
protected String effectId;
|
||||
protected int effectIndex = Integer.MIN_VALUE;
|
||||
|
||||
public CameraShakeInteraction() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void firstRun(@Nonnull InteractionType type, @Nonnull InteractionContext context, @Nonnull CooldownHandler cooldownHandler) {
|
||||
if (this.effectIndex != Integer.MIN_VALUE) {
|
||||
|
||||
@@ -28,9 +28,6 @@ public class CameraEffectSystem extends DamageEventSystem {
|
||||
@Nonnull
|
||||
private static final Query<EntityStore> QUERY = Query.and(PLAYER_REF_COMPONENT_TYPE, ENTITY_STAT_MAP_COMPONENT_TYPE);
|
||||
|
||||
public CameraEffectSystem() {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public SystemGroup<EntityStore> getGroup() {
|
||||
|
||||
@@ -46,11 +46,25 @@ import java.util.UUID;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
|
||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
||||
|
||||
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) {
|
||||
@@ -79,9 +93,6 @@ public class FarmingSystems {
|
||||
public static class CoopResidentEntitySystem extends RefSystem<EntityStore> {
|
||||
private static final ComponentType<EntityStore, CoopResidentComponent> componentType = CoopResidentComponent.getComponentType();
|
||||
|
||||
public CoopResidentEntitySystem() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Query<EntityStore> getQuery() {
|
||||
return componentType;
|
||||
@@ -89,19 +100,13 @@ public class FarmingSystems {
|
||||
|
||||
@Override
|
||||
public void onEntityAdded(
|
||||
@NonNullDecl Ref<EntityStore> ref,
|
||||
@NonNullDecl AddReason reason,
|
||||
@NonNullDecl Store<EntityStore> store,
|
||||
@NonNullDecl CommandBuffer<EntityStore> commandBuffer
|
||||
@Nonnull Ref<EntityStore> ref, @Nonnull AddReason reason, @Nonnull Store<EntityStore> store, @Nonnull CommandBuffer<EntityStore> commandBuffer
|
||||
) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityRemove(
|
||||
@NonNullDecl Ref<EntityStore> ref,
|
||||
@NonNullDecl RemoveReason reason,
|
||||
@NonNullDecl Store<EntityStore> store,
|
||||
@NonNullDecl CommandBuffer<EntityStore> commandBuffer
|
||||
@Nonnull Ref<EntityStore> ref, @Nonnull RemoveReason reason, @Nonnull Store<EntityStore> store, @Nonnull CommandBuffer<EntityStore> commandBuffer
|
||||
) {
|
||||
if (reason != RemoveReason.UNLOAD) {
|
||||
UUIDComponent uuidComponent = commandBuffer.getComponent(ref, UUIDComponent.getComponentType());
|
||||
@@ -148,9 +153,6 @@ public class FarmingSystems {
|
||||
public static class CoopResidentTicking extends EntityTickingSystem<EntityStore> {
|
||||
private static final ComponentType<EntityStore, CoopResidentComponent> componentType = CoopResidentComponent.getComponentType();
|
||||
|
||||
public CoopResidentTicking() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Query<EntityStore> getQuery() {
|
||||
return componentType;
|
||||
@@ -160,9 +162,9 @@ public class FarmingSystems {
|
||||
public void tick(
|
||||
float dt,
|
||||
int index,
|
||||
@NonNullDecl ArchetypeChunk<EntityStore> archetypeChunk,
|
||||
@NonNullDecl Store<EntityStore> store,
|
||||
@NonNullDecl CommandBuffer<EntityStore> commandBuffer
|
||||
@Nonnull ArchetypeChunk<EntityStore> archetypeChunk,
|
||||
@Nonnull Store<EntityStore> store,
|
||||
@Nonnull CommandBuffer<EntityStore> commandBuffer
|
||||
) {
|
||||
CoopResidentComponent coopResidentComponent = archetypeChunk.getComponent(index, CoopResidentComponent.getComponentType());
|
||||
if (coopResidentComponent != null) {
|
||||
@@ -175,9 +177,6 @@ public class FarmingSystems {
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public static class MigrateFarming extends BlockModule.MigrationSystem {
|
||||
public MigrateFarming() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityAdd(@Nonnull Holder<ChunkStore> holder, @Nonnull AddReason reason, @Nonnull Store<ChunkStore> store) {
|
||||
FarmingBlockState oldState = holder.getComponent(FarmingPlugin.get().getFarmingBlockStateComponentType());
|
||||
@@ -203,15 +202,9 @@ public class FarmingSystems {
|
||||
public static class OnCoopAdded extends RefSystem<ChunkStore> {
|
||||
private static final Query<ChunkStore> QUERY = Query.and(BlockModule.BlockStateInfo.getComponentType(), CoopBlock.getComponentType());
|
||||
|
||||
public OnCoopAdded() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityAdded(
|
||||
@NonNullDecl Ref<ChunkStore> ref,
|
||||
@NonNullDecl AddReason reason,
|
||||
@NonNullDecl Store<ChunkStore> store,
|
||||
@NonNullDecl CommandBuffer<ChunkStore> commandBuffer
|
||||
@Nonnull Ref<ChunkStore> ref, @Nonnull AddReason reason, @Nonnull Store<ChunkStore> store, @Nonnull CommandBuffer<ChunkStore> commandBuffer
|
||||
) {
|
||||
CoopBlock coopBlock = commandBuffer.getComponent(ref, CoopBlock.getComponentType());
|
||||
if (coopBlock != null) {
|
||||
@@ -238,10 +231,7 @@ public class FarmingSystems {
|
||||
|
||||
@Override
|
||||
public void onEntityRemove(
|
||||
@NonNullDecl Ref<ChunkStore> ref,
|
||||
@NonNullDecl RemoveReason reason,
|
||||
@NonNullDecl Store<ChunkStore> store,
|
||||
@NonNullDecl CommandBuffer<ChunkStore> commandBuffer
|
||||
@Nonnull Ref<ChunkStore> ref, @Nonnull RemoveReason reason, @Nonnull Store<ChunkStore> store, @Nonnull CommandBuffer<ChunkStore> commandBuffer
|
||||
) {
|
||||
if (reason != RemoveReason.UNLOAD) {
|
||||
CoopBlock coop = commandBuffer.getComponent(ref, CoopBlock.getComponentType());
|
||||
@@ -284,7 +274,7 @@ public class FarmingSystems {
|
||||
}
|
||||
}
|
||||
|
||||
@NullableDecl
|
||||
@Nullable
|
||||
@Override
|
||||
public Query<ChunkStore> getQuery() {
|
||||
return QUERY;
|
||||
@@ -294,9 +284,6 @@ public class FarmingSystems {
|
||||
public static class OnFarmBlockAdded extends RefSystem<ChunkStore> {
|
||||
private static final Query<ChunkStore> QUERY = Query.and(BlockModule.BlockStateInfo.getComponentType(), FarmingBlock.getComponentType());
|
||||
|
||||
public OnFarmBlockAdded() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityAdded(
|
||||
@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;
|
||||
|
||||
BlockChunk blockChunk = commandBuffer.getComponent(info.getChunkRef(), BlockChunk.getComponentType());
|
||||
if (farmingBlock.getLastTickGameTime() == null) {
|
||||
BlockChunk blockChunk = commandBuffer.getComponent(info.getChunkRef(), BlockChunk.getComponentType());
|
||||
int blockId = blockChunk.getBlock(
|
||||
ChunkUtil.xFromBlockInColumn(info.getIndex()), ChunkUtil.yFromBlockInColumn(info.getIndex()), ChunkUtil.zFromBlockInColumn(info.getIndex())
|
||||
);
|
||||
@@ -323,6 +310,7 @@ public class FarmingSystems {
|
||||
farmingBlock.setLastTickGameTime(
|
||||
store.getExternalData().getWorld().getEntityStore().getStore().getResource(WorldTimeResource.getResourceType()).getGameTime()
|
||||
);
|
||||
blockChunk.markNeedsSaving();
|
||||
if (blockType.getFarming().getStages() != null) {
|
||||
FarmingStageData[] stages = blockType.getFarming().getStages().get(blockType.getFarming().getStartingStageSet());
|
||||
if (stages != null && stages.length > 0) {
|
||||
@@ -370,6 +358,7 @@ public class FarmingSystems {
|
||||
farmingBlock.setLastTickGameTime(
|
||||
store.getExternalData().getWorld().getEntityStore().getStore().getResource(WorldTimeResource.getResourceType()).getGameTime()
|
||||
);
|
||||
blockChunk.markNeedsSaving();
|
||||
}
|
||||
|
||||
int x = ChunkUtil.xFromBlockInColumn(info.getIndex());
|
||||
@@ -385,7 +374,7 @@ public class FarmingSystems {
|
||||
|
||||
Ref<ChunkStore> section = column.getSection(ChunkUtil.chunkCoordinate(y));
|
||||
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
|
||||
@@ -404,9 +393,6 @@ public class FarmingSystems {
|
||||
public static class OnSoilAdded extends RefSystem<ChunkStore> {
|
||||
private static final Query<ChunkStore> QUERY = Query.and(BlockModule.BlockStateInfo.getComponentType(), TilledSoilBlock.getComponentType());
|
||||
|
||||
public OnSoilAdded() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityAdded(
|
||||
@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> {
|
||||
private static final Query<ChunkStore> QUERY = Query.and(BlockSection.getComponentType(), ChunkSection.getComponentType());
|
||||
|
||||
public Ticking() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(
|
||||
float dt,
|
||||
@@ -481,39 +464,45 @@ public class FarmingSystems {
|
||||
|
||||
assert section != null;
|
||||
|
||||
BlockComponentChunk blockComponentChunk = commandBuffer.getComponent(section.getChunkColumnReference(), BlockComponentChunk.getComponentType());
|
||||
if (section.getChunkColumnReference() != null && section.getChunkColumnReference().isValid()) {
|
||||
BlockComponentChunk blockComponentChunk = commandBuffer.getComponent(section.getChunkColumnReference(), BlockComponentChunk.getComponentType());
|
||||
|
||||
assert blockComponentChunk != null;
|
||||
assert blockComponentChunk != null;
|
||||
|
||||
Ref<ChunkStore> ref = archetypeChunk.getReferenceTo(index);
|
||||
blocks.forEachTicking(
|
||||
blockComponentChunk, commandBuffer, section.getY(), (blockComponentChunk1, commandBuffer1, localX, localY, localZ, blockId) -> {
|
||||
Ref<ChunkStore> blockRef = blockComponentChunk1.getEntityReference(ChunkUtil.indexBlockInColumn(localX, localY, localZ));
|
||||
if (blockRef == null) {
|
||||
return BlockTickStrategy.IGNORED;
|
||||
} else {
|
||||
FarmingBlock farming = commandBuffer1.getComponent(blockRef, FarmingBlock.getComponentType());
|
||||
if (farming != null) {
|
||||
FarmingUtil.tickFarming(commandBuffer1, blocks, ref, blockRef, farming, localX, localY, localZ, false);
|
||||
return BlockTickStrategy.SLEEP;
|
||||
Ref<ChunkStore> ref = archetypeChunk.getReferenceTo(index);
|
||||
BlockChunk blockChunk = commandBuffer.getComponent(section.getChunkColumnReference(), BlockChunk.getComponentType());
|
||||
|
||||
assert blockChunk != null;
|
||||
|
||||
blocks.forEachTicking(
|
||||
blockComponentChunk, commandBuffer, section.getY(), (blockComponentChunk1, commandBuffer1, localX, localY, localZ, blockId) -> {
|
||||
Ref<ChunkStore> blockRef = blockComponentChunk1.getEntityReference(ChunkUtil.indexBlockInColumn(localX, localY, localZ));
|
||||
if (blockRef == null) {
|
||||
return BlockTickStrategy.IGNORED;
|
||||
} else {
|
||||
TilledSoilBlock soil = commandBuffer1.getComponent(blockRef, TilledSoilBlock.getComponentType());
|
||||
if (soil != null) {
|
||||
tickSoil(commandBuffer1, blockComponentChunk1, blockRef, soil);
|
||||
FarmingBlock farming = commandBuffer1.getComponent(blockRef, FarmingBlock.getComponentType());
|
||||
if (farming != null) {
|
||||
FarmingUtil.tickFarming(commandBuffer1, blockChunk, blocks, ref, blockRef, farming, localX, localY, localZ, false);
|
||||
return BlockTickStrategy.SLEEP;
|
||||
} else {
|
||||
CoopBlock coop = commandBuffer1.getComponent(blockRef, CoopBlock.getComponentType());
|
||||
if (coop != null) {
|
||||
tickCoop(commandBuffer1, blockComponentChunk1, blockRef, coop);
|
||||
TilledSoilBlock soil = commandBuffer1.getComponent(blockRef, TilledSoilBlock.getComponentType());
|
||||
if (soil != null) {
|
||||
tickSoil(commandBuffer1, blockComponentChunk1, blockRef, soil);
|
||||
return BlockTickStrategy.SLEEP;
|
||||
} else {
|
||||
return BlockTickStrategy.IGNORED;
|
||||
CoopBlock coop = commandBuffer1.getComponent(blockRef, CoopBlock.getComponentType());
|
||||
if (coop != null) {
|
||||
tickCoop(commandBuffer1, blockComponentChunk1, blockRef, coop);
|
||||
return BlockTickStrategy.SLEEP;
|
||||
} else {
|
||||
return BlockTickStrategy.IGNORED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -528,14 +517,6 @@ public class FarmingSystems {
|
||||
int y = ChunkUtil.yFromBlockInColumn(info.getIndex());
|
||||
int z = ChunkUtil.zFromBlockInColumn(info.getIndex());
|
||||
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;
|
||||
|
||||
BlockChunk blockChunk = commandBuffer.getComponent(info.getChunkRef(), BlockChunk.getComponentType());
|
||||
@@ -543,6 +524,7 @@ public class FarmingSystems {
|
||||
assert blockChunk != null;
|
||||
|
||||
BlockSection blockSection = blockChunk.getSectionAtBlockY(y);
|
||||
boolean hasCrop = FarmingSystems.hasCropAbove(blockChunk, x, y, z);
|
||||
BlockType blockType = BlockType.getAssetMap().getAsset(blockSection.get(x, y, z));
|
||||
Instant currentTime = commandBuffer.getExternalData()
|
||||
.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.time.WorldTimeResource;
|
||||
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.WorldChunk;
|
||||
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.util.Map;
|
||||
import javax.annotation.Nonnull;
|
||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class FarmingUtil {
|
||||
private static final int MAX_SECONDS_BETWEEN_TICKS = 15;
|
||||
private static final int BETWEEN_RANDOM = 10;
|
||||
|
||||
public FarmingUtil() {
|
||||
}
|
||||
|
||||
public static void tickFarming(
|
||||
CommandBuffer<ChunkStore> commandBuffer,
|
||||
BlockChunk blockChunk,
|
||||
BlockSection blockSection,
|
||||
Ref<ChunkStore> sectionRef,
|
||||
Ref<ChunkStore> blockRef,
|
||||
@@ -68,7 +67,18 @@ public class FarmingUtil {
|
||||
float currentProgress = farmingBlock.getGrowthProgress();
|
||||
int currentStage = (int)currentProgress;
|
||||
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 (currentStage < 0) {
|
||||
currentStage = 0;
|
||||
@@ -88,6 +98,7 @@ public class FarmingUtil {
|
||||
while (currentStage < stages.length) {
|
||||
FarmingStageData stage = stages[currentStage];
|
||||
if (stage.shouldStop(commandBuffer, sectionRef, blockRef, x, y, z)) {
|
||||
blockChunk.markNeedsSaving();
|
||||
farmingBlock.setGrowthProgress(stages.length);
|
||||
commandBuffer.removeEntity(blockRef, RemoveReason.REMOVE);
|
||||
break;
|
||||
@@ -95,6 +106,7 @@ public class FarmingUtil {
|
||||
|
||||
Rangef range = stage.getDuration();
|
||||
if (range == null) {
|
||||
blockChunk.markNeedsSaving();
|
||||
commandBuffer.removeEntity(blockRef, RemoveReason.REMOVE);
|
||||
break;
|
||||
}
|
||||
@@ -131,6 +143,7 @@ public class FarmingUtil {
|
||||
remainingTimeSeconds -= remainingDurationSeconds;
|
||||
currentProgress = ++currentStage;
|
||||
farmingBlock.setGrowthProgress(currentProgress);
|
||||
blockChunk.markNeedsSaving();
|
||||
farmingBlock.setGeneration(farmingBlock.getGeneration() + 1);
|
||||
if (currentStage >= stages.length) {
|
||||
if (stages[currentStage - 1].implementsShouldStop()) {
|
||||
@@ -168,8 +181,10 @@ public class FarmingUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@NullableDecl
|
||||
public static CapturedNPCMetadata generateCapturedNPCMetadata(ComponentAccessor<EntityStore> componentAccessor, Ref<EntityStore> entityRef, int roleIndex) {
|
||||
@Nullable
|
||||
public static CapturedNPCMetadata generateCapturedNPCMetadata(
|
||||
@Nonnull ComponentAccessor<EntityStore> componentAccessor, @Nonnull Ref<EntityStore> entityRef, int roleIndex
|
||||
) {
|
||||
PersistentModel persistentModel = componentAccessor.getComponent(entityRef, PersistentModel.getComponentType());
|
||||
if (persistentModel == null) {
|
||||
return null;
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.hypixel.hytale.component.Component;
|
||||
import com.hypixel.hytale.component.ComponentType;
|
||||
import com.hypixel.hytale.math.vector.Vector3i;
|
||||
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 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 boolean markedForDespawn;
|
||||
|
||||
public CoopResidentComponent() {
|
||||
}
|
||||
|
||||
public static ComponentType<EntityStore, CoopResidentComponent> getComponentType() {
|
||||
return FarmingPlugin.get().getCoopResidentComponentType();
|
||||
}
|
||||
@@ -46,7 +43,7 @@ public class CoopResidentComponent implements Component<EntityStore> {
|
||||
return this.markedForDespawn;
|
||||
}
|
||||
|
||||
@NullableDecl
|
||||
@Nullable
|
||||
@Override
|
||||
public Component<EntityStore> clone() {
|
||||
CoopResidentComponent component = new CoopResidentComponent();
|
||||
|
||||
@@ -16,9 +16,6 @@ public class FertilizerGrowthModifierAsset extends GrowthModifierAsset {
|
||||
)
|
||||
.build();
|
||||
|
||||
public FertilizerGrowthModifierAsset() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCurrentGrowthMultiplier(
|
||||
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 boolean requireBoth;
|
||||
|
||||
public LightLevelGrowthModifierAsset() {
|
||||
}
|
||||
|
||||
public LightLevelGrowthModifierAsset.ArtificialLight getArtificialLight() {
|
||||
return this.artificialLight;
|
||||
}
|
||||
@@ -131,9 +128,6 @@ public class LightLevelGrowthModifierAsset extends GrowthModifierAsset {
|
||||
protected Range green;
|
||||
protected Range blue;
|
||||
|
||||
public ArtificialLight() {
|
||||
}
|
||||
|
||||
public Range getRed() {
|
||||
return this.red;
|
||||
}
|
||||
|
||||
@@ -62,9 +62,6 @@ public class WaterGrowthModifierAsset extends GrowthModifierAsset {
|
||||
protected IntOpenHashSet weatherIds;
|
||||
protected int rainDuration;
|
||||
|
||||
public WaterGrowthModifierAsset() {
|
||||
}
|
||||
|
||||
public String[] getFluids() {
|
||||
return this.fluids;
|
||||
}
|
||||
|
||||
@@ -23,9 +23,6 @@ public class BlockStateFarmingStageData extends FarmingStageData {
|
||||
.build();
|
||||
protected String state;
|
||||
|
||||
public BlockStateFarmingStageData() {
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return this.state;
|
||||
}
|
||||
|
||||
@@ -24,9 +24,6 @@ public class BlockTypeFarmingStageData extends FarmingStageData {
|
||||
.build();
|
||||
protected String block;
|
||||
|
||||
public BlockTypeFarmingStageData() {
|
||||
}
|
||||
|
||||
public String getBlock() {
|
||||
return this.block;
|
||||
}
|
||||
|
||||
@@ -71,9 +71,6 @@ public class PrefabFarmingStageData extends FarmingStageData {
|
||||
private String[] replaceMaskTags = EMPTY_REPLACE_MASK;
|
||||
private int[] replaceMaskTagIndices;
|
||||
|
||||
public PrefabFarmingStageData() {
|
||||
}
|
||||
|
||||
private static double computeParticlesRate(@Nonnull IPrefabBuffer prefab) {
|
||||
double xLength = prefab.getMaxX() - prefab.getMinX();
|
||||
double yLength = prefab.getMaxY() - prefab.getMinY();
|
||||
@@ -350,9 +347,6 @@ public class PrefabFarmingStageData extends FarmingStageData {
|
||||
protected int weight = 1;
|
||||
protected String path;
|
||||
|
||||
public PrefabStage() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWeight() {
|
||||
return this.weight;
|
||||
|
||||
@@ -74,9 +74,6 @@ public class DirectionalGrowthBehaviour extends SpreadGrowthBehaviour {
|
||||
protected IntRange verticalRange;
|
||||
protected DirectionalGrowthBehaviour.VerticalDirection verticalDirection = DirectionalGrowthBehaviour.VerticalDirection.BOTH;
|
||||
|
||||
public DirectionalGrowthBehaviour() {
|
||||
}
|
||||
|
||||
public IWeightedMap<DirectionalGrowthBehaviour.BlockTypeWeight> getBlockTypes() {
|
||||
return this.blockTypes;
|
||||
}
|
||||
@@ -236,9 +233,6 @@ public class DirectionalGrowthBehaviour extends SpreadGrowthBehaviour {
|
||||
protected double weight = 1.0;
|
||||
protected String blockTypeKey;
|
||||
|
||||
public BlockTypeWeight() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWeight() {
|
||||
return this.weight;
|
||||
|
||||
@@ -66,9 +66,6 @@ public class SpreadFarmingStageData extends FarmingStageData {
|
||||
protected IntRange spreadDecayPercent;
|
||||
protected SpreadGrowthBehaviour[] spreadGrowthBehaviours;
|
||||
|
||||
public SpreadFarmingStageData() {
|
||||
}
|
||||
|
||||
public IntRange getExecutions() {
|
||||
return this.executions;
|
||||
}
|
||||
|
||||
@@ -23,9 +23,6 @@ public abstract class SpreadGrowthBehaviour {
|
||||
.build();
|
||||
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);
|
||||
|
||||
protected boolean validatePosition(World world, int worldX, int worldY, int worldZ) {
|
||||
|
||||
@@ -81,9 +81,6 @@ public class ChangeFarmingStageInteraction extends SimpleBlockInteraction {
|
||||
@Nullable
|
||||
protected String targetStageSet = null;
|
||||
|
||||
public ChangeFarmingStageInteraction() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public WaitForDataFrom getWaitForDataFrom() {
|
||||
|
||||
@@ -38,9 +38,6 @@ public class FertilizeSoilInteraction extends SimpleBlockInteraction {
|
||||
.build();
|
||||
protected String[] refreshModifiers;
|
||||
|
||||
public FertilizeSoilInteraction() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public WaitForDataFrom getWaitForDataFrom() {
|
||||
|
||||
@@ -28,9 +28,6 @@ public class HarvestCropInteraction extends SimpleBlockInteraction {
|
||||
.documentation("Harvests the resources from the target farmable block.")
|
||||
.build();
|
||||
|
||||
public HarvestCropInteraction() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void interactWithBlock(
|
||||
@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.entities.NPCEntity;
|
||||
import com.hypixel.hytale.server.npc.metadata.CapturedNPCMetadata;
|
||||
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
|
||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class UseCaptureCrateInteraction extends SimpleBlockInteraction {
|
||||
public static final BuilderCodec<UseCaptureCrateInteraction> CODEC = BuilderCodec.builder(
|
||||
@@ -69,12 +69,9 @@ public class UseCaptureCrateInteraction extends SimpleBlockInteraction {
|
||||
protected int[] acceptedNpcGroupIndexes;
|
||||
protected String fullIcon;
|
||||
|
||||
public UseCaptureCrateInteraction() {
|
||||
}
|
||||
|
||||
@Override
|
||||
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();
|
||||
if (commandBuffer == null) {
|
||||
@@ -84,59 +81,62 @@ public class UseCaptureCrateInteraction extends SimpleBlockInteraction {
|
||||
if (item == null) {
|
||||
context.getState().state = InteractionState.Failed;
|
||||
} else {
|
||||
Ref<EntityStore> playerRef = context.getEntity();
|
||||
LivingEntity playerEntity = (LivingEntity)EntityUtils.getEntity(playerRef, commandBuffer);
|
||||
Inventory playerInventory = playerEntity.getInventory();
|
||||
byte activeHotbarSlot = playerInventory.getActiveHotbarSlot();
|
||||
ItemStack inHandItemStack = playerInventory.getActiveHotbarItem();
|
||||
CapturedNPCMetadata existingMeta = item.getFromMetadataOrNull("CapturedEntity", CapturedNPCMetadata.CODEC);
|
||||
if (existingMeta != null) {
|
||||
super.tick0(firstRun, time, type, context, cooldownHandler);
|
||||
Ref<EntityStore> ref = context.getEntity();
|
||||
if (!(EntityUtils.getEntity(ref, commandBuffer) instanceof LivingEntity livingEntity)) {
|
||||
context.getState().state = InteractionState.Failed;
|
||||
} else {
|
||||
Ref<EntityStore> targetEntity = context.getTargetEntity();
|
||||
if (targetEntity == null) {
|
||||
context.getState().state = InteractionState.Failed;
|
||||
Inventory inventory = livingEntity.getInventory();
|
||||
byte activeHotbarSlot = inventory.getActiveHotbarSlot();
|
||||
ItemStack inHandItemStack = inventory.getActiveHotbarItem();
|
||||
CapturedNPCMetadata existingMeta = item.getFromMetadataOrNull("CapturedEntity", CapturedNPCMetadata.CODEC);
|
||||
if (existingMeta != null) {
|
||||
super.tick0(firstRun, time, type, context, cooldownHandler);
|
||||
} else {
|
||||
NPCEntity npc = commandBuffer.getComponent(targetEntity, NPCEntity.getComponentType());
|
||||
if (npc == null) {
|
||||
Ref<EntityStore> targetEntity = context.getTargetEntity();
|
||||
if (targetEntity == null) {
|
||||
context.getState().state = InteractionState.Failed;
|
||||
} else {
|
||||
TagSetPlugin.TagSetLookup tagSetPlugin = TagSetPlugin.get(NPCGroup.class);
|
||||
boolean tagFound = false;
|
||||
|
||||
for (int group : this.acceptedNpcGroupIndexes) {
|
||||
if (tagSetPlugin.tagInSet(group, npc.getRoleIndex())) {
|
||||
tagFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!tagFound) {
|
||||
NPCEntity npcComponent = commandBuffer.getComponent(targetEntity, NPCEntity.getComponentType());
|
||||
if (npcComponent == null) {
|
||||
context.getState().state = InteractionState.Failed;
|
||||
} else {
|
||||
PersistentModel persistentModel = commandBuffer.getComponent(targetEntity, PersistentModel.getComponentType());
|
||||
if (persistentModel == null) {
|
||||
TagSetPlugin.TagSetLookup tagSetPlugin = TagSetPlugin.get(NPCGroup.class);
|
||||
boolean tagFound = false;
|
||||
|
||||
for (int group : this.acceptedNpcGroupIndexes) {
|
||||
if (tagSetPlugin.tagInSet(group, npcComponent.getRoleIndex())) {
|
||||
tagFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!tagFound) {
|
||||
context.getState().state = InteractionState.Failed;
|
||||
} else {
|
||||
ModelAsset modelAsset = ModelAsset.getAssetMap().getAsset(persistentModel.getModelReference().getModelAssetId());
|
||||
CapturedNPCMetadata meta = inHandItemStack.getFromMetadataOrDefault("CapturedEntity", CapturedNPCMetadata.CODEC);
|
||||
if (modelAsset != null) {
|
||||
meta.setIconPath(modelAsset.getIcon());
|
||||
}
|
||||
PersistentModel persistentModel = commandBuffer.getComponent(targetEntity, PersistentModel.getComponentType());
|
||||
if (persistentModel == null) {
|
||||
context.getState().state = InteractionState.Failed;
|
||||
} else {
|
||||
ModelAsset modelAsset = ModelAsset.getAssetMap().getAsset(persistentModel.getModelReference().getModelAssetId());
|
||||
CapturedNPCMetadata meta = inHandItemStack.getFromMetadataOrDefault("CapturedEntity", CapturedNPCMetadata.CODEC);
|
||||
if (modelAsset != null) {
|
||||
meta.setIconPath(modelAsset.getIcon());
|
||||
}
|
||||
|
||||
meta.setRoleIndex(npc.getRoleIndex());
|
||||
String npcName = NPCPlugin.get().getName(npc.getRoleIndex());
|
||||
if (npcName != null) {
|
||||
meta.setNpcNameKey(npcName);
|
||||
}
|
||||
meta.setRoleIndex(npcComponent.getRoleIndex());
|
||||
String npcName = NPCPlugin.get().getName(npcComponent.getRoleIndex());
|
||||
if (npcName != null) {
|
||||
meta.setNpcNameKey(npcName);
|
||||
}
|
||||
|
||||
if (this.fullIcon != null) {
|
||||
meta.setFullItemIcon(this.fullIcon);
|
||||
}
|
||||
if (this.fullIcon != null) {
|
||||
meta.setFullItemIcon(this.fullIcon);
|
||||
}
|
||||
|
||||
ItemStack itemWithNPC = inHandItemStack.withMetadata(CapturedNPCMetadata.KEYED_CODEC, meta);
|
||||
playerInventory.getHotbar().replaceItemStackInSlot(activeHotbarSlot, item, itemWithNPC);
|
||||
commandBuffer.removeEntity(targetEntity, RemoveReason.REMOVE);
|
||||
ItemStack itemWithNPC = inHandItemStack.withMetadata(CapturedNPCMetadata.KEYED_CODEC, meta);
|
||||
inventory.getHotbar().replaceItemStackInSlot(activeHotbarSlot, item, itemWithNPC);
|
||||
commandBuffer.removeEntity(targetEntity, RemoveReason.REMOVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,82 +148,81 @@ public class UseCaptureCrateInteraction extends SimpleBlockInteraction {
|
||||
|
||||
@Override
|
||||
protected void interactWithBlock(
|
||||
@NonNullDecl World world,
|
||||
@NonNullDecl CommandBuffer<EntityStore> commandBuffer,
|
||||
@NonNullDecl InteractionType type,
|
||||
@NonNullDecl InteractionContext context,
|
||||
@NullableDecl ItemStack itemInHand,
|
||||
@NonNullDecl Vector3i targetBlock,
|
||||
@NonNullDecl CooldownHandler cooldownHandler
|
||||
@Nonnull World world,
|
||||
@Nonnull CommandBuffer<EntityStore> commandBuffer,
|
||||
@Nonnull InteractionType type,
|
||||
@Nonnull InteractionContext context,
|
||||
@Nullable ItemStack itemInHand,
|
||||
@Nonnull Vector3i targetBlock,
|
||||
@Nonnull CooldownHandler cooldownHandler
|
||||
) {
|
||||
ItemStack item = context.getHeldItem();
|
||||
if (item == null) {
|
||||
context.getState().state = InteractionState.Failed;
|
||||
} else {
|
||||
Ref<EntityStore> playerRef = context.getEntity();
|
||||
LivingEntity playerEntity = (LivingEntity)EntityUtils.getEntity(playerRef, commandBuffer);
|
||||
Inventory playerInventory = playerEntity.getInventory();
|
||||
byte activeHotbarSlot = playerInventory.getActiveHotbarSlot();
|
||||
CapturedNPCMetadata existingMeta = item.getFromMetadataOrNull("CapturedEntity", CapturedNPCMetadata.CODEC);
|
||||
if (existingMeta == null) {
|
||||
context.getState().state = InteractionState.Failed;
|
||||
} else {
|
||||
BlockPosition pos = context.getTargetBlock();
|
||||
if (pos == null) {
|
||||
Ref<EntityStore> ref = context.getEntity();
|
||||
if (EntityUtils.getEntity(ref, commandBuffer) instanceof LivingEntity livingEntity) {
|
||||
Inventory inventory = livingEntity.getInventory();
|
||||
byte activeHotbarSlot = inventory.getActiveHotbarSlot();
|
||||
CapturedNPCMetadata existingMeta = item.getFromMetadataOrNull("CapturedEntity", CapturedNPCMetadata.CODEC);
|
||||
if (existingMeta == null) {
|
||||
context.getState().state = InteractionState.Failed;
|
||||
} else {
|
||||
WorldChunk worldChunk = world.getChunk(ChunkUtil.indexChunkFromBlock(pos.x, pos.z));
|
||||
Ref<ChunkStore> blockRef = worldChunk.getBlockComponentEntity(pos.x, pos.y, pos.z);
|
||||
if (blockRef == null) {
|
||||
blockRef = BlockModule.ensureBlockEntity(worldChunk, pos.x, pos.y, pos.z);
|
||||
}
|
||||
BlockPosition pos = context.getTargetBlock();
|
||||
if (pos == null) {
|
||||
context.getState().state = InteractionState.Failed;
|
||||
} else {
|
||||
WorldChunk worldChunk = world.getChunk(ChunkUtil.indexChunkFromBlock(pos.x, pos.z));
|
||||
Ref<ChunkStore> blockRef = worldChunk.getBlockComponentEntity(pos.x, pos.y, pos.z);
|
||||
if (blockRef == null) {
|
||||
blockRef = BlockModule.ensureBlockEntity(worldChunk, pos.x, pos.y, pos.z);
|
||||
}
|
||||
|
||||
ItemStack noMetaItemStack = item.withMetadata(null);
|
||||
if (blockRef != null) {
|
||||
Store<ChunkStore> chunkStore = world.getChunkStore().getStore();
|
||||
CoopBlock coopBlockState = chunkStore.getComponent(blockRef, CoopBlock.getComponentType());
|
||||
if (coopBlockState != null) {
|
||||
WorldTimeResource worldTimeResource = commandBuffer.getResource(WorldTimeResource.getResourceType());
|
||||
if (coopBlockState.tryPutResident(existingMeta, worldTimeResource)) {
|
||||
world.execute(
|
||||
() -> coopBlockState.ensureSpawnResidentsInWorld(
|
||||
world, world.getEntityStore().getStore(), new Vector3d(pos.x, pos.y, pos.z), new Vector3d().assign(Vector3d.FORWARD)
|
||||
)
|
||||
);
|
||||
playerInventory.getHotbar().replaceItemStackInSlot(activeHotbarSlot, item, noMetaItemStack);
|
||||
} else {
|
||||
context.getState().state = InteractionState.Failed;
|
||||
ItemStack noMetaItemStack = item.withMetadata(null);
|
||||
if (blockRef != null) {
|
||||
Store<ChunkStore> chunkStore = world.getChunkStore().getStore();
|
||||
CoopBlock coopBlockState = chunkStore.getComponent(blockRef, CoopBlock.getComponentType());
|
||||
if (coopBlockState != null) {
|
||||
WorldTimeResource worldTimeResource = commandBuffer.getResource(WorldTimeResource.getResourceType());
|
||||
if (coopBlockState.tryPutResident(existingMeta, worldTimeResource)) {
|
||||
world.execute(
|
||||
() -> coopBlockState.ensureSpawnResidentsInWorld(
|
||||
world, world.getEntityStore().getStore(), new Vector3d(pos.x, pos.y, pos.z), new Vector3d().assign(Vector3d.FORWARD)
|
||||
)
|
||||
);
|
||||
inventory.getHotbar().replaceItemStackInSlot(activeHotbarSlot, item, noMetaItemStack);
|
||||
} else {
|
||||
context.getState().state = InteractionState.Failed;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Vector3d spawnPos = new Vector3d(pos.x + 0.5F, pos.y, pos.z + 0.5F);
|
||||
if (context.getClientState() != null) {
|
||||
BlockFace blockFace = BlockFace.fromProtocolFace(context.getClientState().blockFace);
|
||||
if (blockFace != null) {
|
||||
spawnPos.add(blockFace.getDirection());
|
||||
Vector3d spawnPos = new Vector3d(pos.x + 0.5F, pos.y, pos.z + 0.5F);
|
||||
if (context.getClientState() != null) {
|
||||
BlockFace blockFace = BlockFace.fromProtocolFace(context.getClientState().blockFace);
|
||||
if (blockFace != null) {
|
||||
spawnPos.add(blockFace.getDirection());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NPCPlugin npcModule = NPCPlugin.get();
|
||||
Store<EntityStore> store = context.getCommandBuffer().getStore();
|
||||
int roleIndex = existingMeta.getRoleIndex();
|
||||
commandBuffer.run(_store -> npcModule.spawnEntity(store, roleIndex, spawnPos, Vector3f.ZERO, null, null));
|
||||
playerInventory.getHotbar().replaceItemStackInSlot(activeHotbarSlot, item, noMetaItemStack);
|
||||
NPCPlugin npcModule = NPCPlugin.get();
|
||||
Store<EntityStore> store = context.getCommandBuffer().getStore();
|
||||
int roleIndex = existingMeta.getRoleIndex();
|
||||
commandBuffer.run(_store -> npcModule.spawnEntity(store, roleIndex, spawnPos, Vector3f.ZERO, null, null));
|
||||
inventory.getHotbar().replaceItemStackInSlot(activeHotbarSlot, item, noMetaItemStack);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
context.getState().state = InteractionState.Failed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void simulateInteractWithBlock(
|
||||
@NonNullDecl InteractionType type,
|
||||
@NonNullDecl InteractionContext context,
|
||||
@NullableDecl ItemStack itemInHand,
|
||||
@NonNullDecl World world,
|
||||
@NonNullDecl Vector3i targetBlock
|
||||
@Nonnull InteractionType type, @Nonnull InteractionContext context, @Nullable ItemStack itemInHand, @Nonnull World world, @Nonnull 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.storage.ChunkStore;
|
||||
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
||||
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
|
||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class UseCoopInteraction extends SimpleBlockInteraction {
|
||||
public static final BuilderCodec<UseCoopInteraction> CODEC = BuilderCodec.builder(
|
||||
@@ -31,18 +31,15 @@ public class UseCoopInteraction extends SimpleBlockInteraction {
|
||||
)
|
||||
.build();
|
||||
|
||||
public UseCoopInteraction() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void interactWithBlock(
|
||||
@NonNullDecl World world,
|
||||
@NonNullDecl CommandBuffer<EntityStore> commandBuffer,
|
||||
@NonNullDecl InteractionType type,
|
||||
@NonNullDecl InteractionContext context,
|
||||
@NullableDecl ItemStack itemInHand,
|
||||
@NonNullDecl Vector3i targetBlock,
|
||||
@NonNullDecl CooldownHandler cooldownHandler
|
||||
@Nonnull World world,
|
||||
@Nonnull CommandBuffer<EntityStore> commandBuffer,
|
||||
@Nonnull InteractionType type,
|
||||
@Nonnull InteractionContext context,
|
||||
@Nullable ItemStack itemInHand,
|
||||
@Nonnull Vector3i targetBlock,
|
||||
@Nonnull CooldownHandler cooldownHandler
|
||||
) {
|
||||
int x = targetBlock.getX();
|
||||
int z = targetBlock.getZ();
|
||||
@@ -85,11 +82,7 @@ public class UseCoopInteraction extends SimpleBlockInteraction {
|
||||
|
||||
@Override
|
||||
protected void simulateInteractWithBlock(
|
||||
@NonNullDecl InteractionType type,
|
||||
@NonNullDecl InteractionContext context,
|
||||
@NullableDecl ItemStack itemInHand,
|
||||
@NonNullDecl World world,
|
||||
@NonNullDecl Vector3i targetBlock
|
||||
@Nonnull InteractionType type, @Nonnull InteractionContext context, @Nullable ItemStack itemInHand, @Nonnull World world, @Nonnull Vector3i targetBlock
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,9 +43,6 @@ public class UseWateringCanInteraction extends SimpleBlockInteraction {
|
||||
protected long duration;
|
||||
protected String[] refreshModifiers;
|
||||
|
||||
public UseWateringCanInteraction() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
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.SpawningContext;
|
||||
import it.unimi.dsi.fastutil.Pair;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -55,7 +56,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class CoopBlock implements Component<ChunkStore> {
|
||||
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)
|
||||
.add()
|
||||
.build();
|
||||
HytaleLogger LOGGER = HytaleLogger.forEnclosingClass();
|
||||
protected String coopAssetId;
|
||||
protected List<CoopBlock.CoopResident> residents = new ArrayList<>();
|
||||
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);
|
||||
}
|
||||
|
||||
@NullableDecl
|
||||
@Nullable
|
||||
public FarmingCoopAsset getCoopAsset() {
|
||||
return FarmingCoopAsset.getAssetMap().getAsset(this.coopAssetId);
|
||||
}
|
||||
@@ -94,7 +94,7 @@ public class CoopBlock implements Component<ChunkStore> {
|
||||
this.coopAssetId = farmingCoopId;
|
||||
this.residents.addAll(residents);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ public class CoopBlock implements Component<ChunkStore> {
|
||||
}
|
||||
}
|
||||
|
||||
@NullableDecl
|
||||
@Nullable
|
||||
public Instant getNextScheduledTick(WorldTimeResource worldTimeResource) {
|
||||
Instant gameTime = worldTimeResource.getGameTime();
|
||||
LocalDateTime gameDateTime = worldTimeResource.getGameDateTime();
|
||||
@@ -431,7 +431,7 @@ public class CoopBlock implements Component<ChunkStore> {
|
||||
.add()
|
||||
.build();
|
||||
protected CapturedNPCMetadata metadata;
|
||||
@NullableDecl
|
||||
@Nullable
|
||||
protected PersistentRef persistentRef;
|
||||
protected boolean deployedToWorld;
|
||||
protected Instant lastProduced;
|
||||
@@ -449,12 +449,12 @@ public class CoopBlock implements Component<ChunkStore> {
|
||||
return this.metadata;
|
||||
}
|
||||
|
||||
@NullableDecl
|
||||
@Nullable
|
||||
public PersistentRef getPersistentRef() {
|
||||
return this.persistentRef;
|
||||
}
|
||||
|
||||
public void setPersistentRef(@NullableDecl PersistentRef persistentRef) {
|
||||
public void setPersistentRef(@Nullable PersistentRef persistentRef) {
|
||||
this.persistentRef = persistentRef;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,9 +43,6 @@ public class FarmingBlockState implements Component<ChunkStore> {
|
||||
public double lastGrowthMultiplier;
|
||||
public float spreadRate = 1.0F;
|
||||
|
||||
public FarmingBlockState() {
|
||||
}
|
||||
|
||||
public String getCurrentFarmingStageSetName() {
|
||||
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_LOADING = 5;
|
||||
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.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.model.config.ModelParticle;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -37,13 +38,28 @@ public class MemoriesGameplayConfig {
|
||||
.addValidator(Validators.nonNull())
|
||||
.addValidator(Item.VALIDATOR_CACHE.getValidator())
|
||||
.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();
|
||||
private int[] memoriesAmountPerLevel;
|
||||
private String memoriesRecordParticles;
|
||||
private String memoriesCatchItemId;
|
||||
|
||||
public MemoriesGameplayConfig() {
|
||||
}
|
||||
private ModelParticle memoriesCatchEntityParticle;
|
||||
private int memoriesCatchParticleViewDistance = 64;
|
||||
|
||||
@Nullable
|
||||
public static MemoriesGameplayConfig get(@Nonnull GameplayConfig config) {
|
||||
@@ -61,4 +77,12 @@ public class MemoriesGameplayConfig {
|
||||
public String getMemoriesCatchItemId() {
|
||||
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.page.MemoriesPage;
|
||||
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.TempleRespawnPlayersSystem;
|
||||
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.Object2DoubleMaps;
|
||||
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 java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
@@ -70,7 +72,7 @@ public class MemoriesPlugin extends JavaPlugin {
|
||||
private static MemoriesPlugin instance;
|
||||
private final Config<MemoriesPlugin.MemoriesPluginConfig> config = this.withConfig(MemoriesPlugin.MemoriesPluginConfig.CODEC);
|
||||
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;
|
||||
@Nullable
|
||||
private MemoriesPlugin.RecordedMemories recordedMemories;
|
||||
@@ -90,6 +92,7 @@ public class MemoriesPlugin extends JavaPlugin {
|
||||
ComponentRegistryProxy<EntityStore> entityStoreRegistry = this.getEntityStoreRegistry();
|
||||
this.getCommandRegistry().registerCommand(new MemoriesCommand());
|
||||
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);
|
||||
this.playerMemoriesComponentType = entityStoreRegistry.registerComponent(PlayerMemories.class, "PlayerMemories", PlayerMemories.CODEC);
|
||||
NPCMemoryProvider npcMemoryProvider = new NPCMemoryProvider();
|
||||
@@ -129,14 +132,16 @@ public class MemoriesPlugin extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
protected void shutdown() {
|
||||
this.recordedMemories.lock.readLock().lock();
|
||||
if (this.hasInitializedMemories) {
|
||||
this.recordedMemories.lock.readLock().lock();
|
||||
|
||||
try {
|
||||
BsonUtil.writeSync(Constants.UNIVERSE_PATH.resolve("memories.json"), MemoriesPlugin.RecordedMemories.CODEC, this.recordedMemories, this.getLogger());
|
||||
} catch (IOException var5) {
|
||||
throw new RuntimeException(var5);
|
||||
} finally {
|
||||
this.recordedMemories.lock.readLock().unlock();
|
||||
try {
|
||||
BsonUtil.writeSync(Constants.UNIVERSE_PATH.resolve("memories.json"), MemoriesPlugin.RecordedMemories.CODEC, this.recordedMemories, this.getLogger());
|
||||
} catch (IOException var5) {
|
||||
throw new RuntimeException(var5);
|
||||
} finally {
|
||||
this.recordedMemories.lock.readLock().unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,30 +182,16 @@ public class MemoriesPlugin extends JavaPlugin {
|
||||
int recordedMemoriesCount = this.getRecordedMemories().size();
|
||||
int[] memoriesAmountPerLevel = config.getMemoriesAmountPerLevel();
|
||||
|
||||
for (int i = 0; i < memoriesAmountPerLevel.length && recordedMemoriesCount >= memoriesAmountPerLevel[i]; i++) {
|
||||
memoriesLevel += i + 1;
|
||||
for (int i = memoriesAmountPerLevel.length - 1; i >= 0; i--) {
|
||||
if (recordedMemoriesCount >= memoriesAmountPerLevel[i]) {
|
||||
return i + 2;
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
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 final BuilderCodec<MemoriesPlugin.MemoriesPluginConfig> CODEC = BuilderCodec.builder(
|
||||
MemoriesPlugin.MemoriesPluginConfig.class, MemoriesPlugin.MemoriesPluginConfig::new
|
||||
@@ -287,9 +311,6 @@ public class MemoriesPlugin extends JavaPlugin {
|
||||
.build();
|
||||
private Object2DoubleMap<String> collectionRadius;
|
||||
|
||||
public MemoriesPluginConfig() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public Object2DoubleMap<String> getCollectionRadius() {
|
||||
return (Object2DoubleMap<String>)(this.collectionRadius != null ? this.collectionRadius : Object2DoubleMaps.EMPTY_MAP);
|
||||
@@ -302,9 +323,6 @@ public class MemoriesPlugin extends JavaPlugin {
|
||||
@Nonnull
|
||||
private final Query<EntityStore> query = Query.and(Player.getComponentType(), PlayerRef.getComponentType());
|
||||
|
||||
public PlayerAddedSystem() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Query<EntityStore> getQuery() {
|
||||
@@ -355,8 +373,5 @@ public class MemoriesPlugin extends JavaPlugin {
|
||||
.build();
|
||||
private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
||||
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 MemoriesLevelCommand());
|
||||
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 int memoriesCapacity;
|
||||
|
||||
public PlayerMemories() {
|
||||
}
|
||||
|
||||
public static ComponentType<EntityStore, PlayerMemories> getComponentType() {
|
||||
return MemoriesPlugin.get().getPlayerMemoriesComponentType();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry;
|
||||
import java.util.Arrays;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
|
||||
|
||||
public class MemoriesConditionInteraction extends Interaction {
|
||||
@Nonnull
|
||||
@@ -68,12 +67,9 @@ public class MemoriesConditionInteraction extends Interaction {
|
||||
@Nullable
|
||||
private String failed;
|
||||
|
||||
public MemoriesConditionInteraction() {
|
||||
}
|
||||
|
||||
@Override
|
||||
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();
|
||||
|
||||
@@ -95,7 +91,7 @@ public class MemoriesConditionInteraction extends Interaction {
|
||||
|
||||
@Override
|
||||
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 labelIndex = this.levelToLabel.get(memoriesLevel);
|
||||
|
||||
@@ -33,9 +33,6 @@ public class SetMemoriesCapacityInteraction extends SimpleInstantInteraction {
|
||||
.build();
|
||||
private int capacity;
|
||||
|
||||
public SetMemoriesCapacityInteraction() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void firstRun(@Nonnull InteractionType type, @Nonnull InteractionContext context, @Nonnull CooldownHandler cooldownHandler) {
|
||||
Ref<EntityStore> ref = context.getEntity();
|
||||
|
||||
@@ -8,9 +8,6 @@ import javax.annotation.Nullable;
|
||||
public abstract class Memory {
|
||||
public static final CodecMapCodec<Memory> CODEC = new CodecMapCodec<>();
|
||||
|
||||
public Memory() {
|
||||
}
|
||||
|
||||
public abstract String getId();
|
||||
|
||||
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.query.Query;
|
||||
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.math.util.MathUtil;
|
||||
import com.hypixel.hytale.math.vector.Vector3d;
|
||||
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.asset.type.model.config.ModelParticle;
|
||||
import com.hypixel.hytale.server.core.entity.entities.Player;
|
||||
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.TransformComponent;
|
||||
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.tracker.NetworkId;
|
||||
import com.hypixel.hytale.server.core.modules.i18n.I18nModule;
|
||||
import com.hypixel.hytale.server.core.universe.PlayerRef;
|
||||
import com.hypixel.hytale.server.core.universe.world.World;
|
||||
@@ -229,6 +234,7 @@ public class NPCMemory extends Memory {
|
||||
|
||||
assert playerRefComponent != null;
|
||||
|
||||
Ref<EntityStore> ref = archetypeChunk.getReferenceTo(index);
|
||||
MemoriesPlugin memoriesPlugin = MemoriesPlugin.get();
|
||||
PlayerMemories playerMemoriesComponent = archetypeChunk.getComponent(index, PlayerMemories.getComponentType());
|
||||
|
||||
@@ -269,17 +275,22 @@ public class NPCMemory extends Memory {
|
||||
if (memoriesGameplayConfig != null) {
|
||||
ItemStack memoryItemStack = new ItemStack(memoriesGameplayConfig.getMemoriesCatchItemId());
|
||||
Vector3d memoryItemHolderPosition = npcTransformComponent.getPosition().clone();
|
||||
BoundingBox boundingBox = commandBuffer.getComponent(npcRef, BoundingBox.getComponentType());
|
||||
if (boundingBox != null) {
|
||||
memoryItemHolderPosition.y = memoryItemHolderPosition.y + boundingBox.getBoundingBox().middleY();
|
||||
BoundingBox boundingBoxComponent = commandBuffer.getComponent(npcRef, BoundingBox.getComponentType());
|
||||
if (boundingBoxComponent != null) {
|
||||
memoryItemHolderPosition.y = memoryItemHolderPosition.y + boundingBoxComponent.getBoundingBox().middleY();
|
||||
}
|
||||
|
||||
Holder<EntityStore> memoryItemHolder = ItemComponent.generatePickedUpItem(
|
||||
memoryItemStack, memoryItemHolderPosition, commandBuffer, playerRefComponent.getReference()
|
||||
memoryItemStack, memoryItemHolderPosition, commandBuffer, ref
|
||||
);
|
||||
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);
|
||||
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
|
||||
@Override
|
||||
public Query<EntityStore> getQuery() {
|
||||
|
||||
@@ -18,7 +18,6 @@ import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
||||
|
||||
public class NPCMemoryProvider extends MemoryProvider<NPCMemory> {
|
||||
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) {
|
||||
if (builder instanceof ISpawnableWithModel spawnableWithModel) {
|
||||
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("#TotalCollected.Text", String.valueOf(recordedMemories.size()));
|
||||
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();
|
||||
PlayerMemories playerMemories = store.getComponent(ref, PlayerMemories.getComponentType());
|
||||
int i = 0;
|
||||
@@ -267,6 +270,12 @@ public class MemoriesPage extends InteractiveCustomUIPage<MemoriesPage.PageEvent
|
||||
this.selectedMemory = null;
|
||||
this.rebuild();
|
||||
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:
|
||||
if (data.memoryId == null || this.currentCategory == null) {
|
||||
return;
|
||||
@@ -366,12 +375,10 @@ public class MemoriesPage extends InteractiveCustomUIPage<MemoriesPage.PageEvent
|
||||
Record,
|
||||
ViewCategory,
|
||||
Back,
|
||||
MemoriesInfo,
|
||||
SelectMemory;
|
||||
|
||||
public static final Codec<MemoriesPage.PageAction> CODEC = new EnumCodec<>(MemoriesPage.PageAction.class);
|
||||
|
||||
private PageAction() {
|
||||
}
|
||||
}
|
||||
|
||||
public static class PageEventData {
|
||||
@@ -395,8 +402,5 @@ public class MemoriesPage extends InteractiveCustomUIPage<MemoriesPage.PageEvent
|
||||
public MemoriesPage.PageAction action;
|
||||
public String category;
|
||||
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.universe.PlayerRef;
|
||||
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 MemoriesPageSupplier() {
|
||||
}
|
||||
|
||||
@NullableDecl
|
||||
@Nullable
|
||||
@Override
|
||||
public CustomUIPage tryCreate(Ref<EntityStore> ref, ComponentAccessor<EntityStore> componentAccessor, PlayerRef playerRef, InteractionContext context) {
|
||||
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 String respawnSound;
|
||||
|
||||
public ForgottenTempleConfig() {
|
||||
}
|
||||
|
||||
public double getMinYRespawn() {
|
||||
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.spawn.ISpawnProvider;
|
||||
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
||||
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
|
||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class TempleRespawnPlayersSystem extends DelayedEntitySystem<EntityStore> {
|
||||
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(
|
||||
float dt,
|
||||
int index,
|
||||
@NonNullDecl ArchetypeChunk<EntityStore> archetypeChunk,
|
||||
@NonNullDecl Store<EntityStore> store,
|
||||
@NonNullDecl CommandBuffer<EntityStore> commandBuffer
|
||||
@Nonnull ArchetypeChunk<EntityStore> archetypeChunk,
|
||||
@Nonnull Store<EntityStore> store,
|
||||
@Nonnull CommandBuffer<EntityStore> commandBuffer
|
||||
) {
|
||||
World world = store.getExternalData().getWorld();
|
||||
GameplayConfig gameplayConfig = world.getGameplayConfig();
|
||||
ForgottenTempleConfig config = gameplayConfig.getPluginConfig().get(ForgottenTempleConfig.class);
|
||||
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())) {
|
||||
Ref<EntityStore> ref = archetypeChunk.getReferenceTo(index);
|
||||
ISpawnProvider spawnProvider = world.getWorldConfig().getSpawnProvider();
|
||||
Transform spawnPoint = spawnProvider.getSpawnPoint(ref, commandBuffer);
|
||||
commandBuffer.addComponent(ref, Teleport.getComponentType(), new Teleport(null, spawnPoint));
|
||||
Transform spawnTransform = spawnProvider.getSpawnPoint(ref, commandBuffer);
|
||||
Teleport teleportComponent = Teleport.createForPlayer(null, spawnTransform);
|
||||
commandBuffer.addComponent(ref, Teleport.getComponentType(), teleportComponent);
|
||||
PlayerRef playerRef = archetypeChunk.getComponent(index, PlayerRef.getComponentType());
|
||||
SoundUtil.playSoundEvent2dToPlayer(playerRef, config.getRespawnSoundIndex(), SoundCategory.SFX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NullableDecl
|
||||
@Nullable
|
||||
@Override
|
||||
public Query<EntityStore> getQuery() {
|
||||
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.memories.Memory;
|
||||
import com.hypixel.hytale.codec.EmptyExtraInfo;
|
||||
import com.hypixel.hytale.component.ComponentAccessor;
|
||||
import com.hypixel.hytale.component.Ref;
|
||||
import com.hypixel.hytale.component.Store;
|
||||
import com.hypixel.hytale.protocol.packets.window.WindowType;
|
||||
import com.hypixel.hytale.server.core.Message;
|
||||
import com.hypixel.hytale.server.core.entity.entities.player.windows.Window;
|
||||
@@ -32,14 +34,13 @@ public class MemoriesWindow extends Window {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOpen0() {
|
||||
public boolean onOpen0(@Nonnull Ref<EntityStore> ref, @Nonnull Store<EntityStore> store) {
|
||||
JsonArray array = new JsonArray();
|
||||
Ref<EntityStore> ref = this.getPlayerRef().getReference();
|
||||
PlayerMemories playerMemories = ref.getStore().getComponent(ref, PlayerMemories.getComponentType());
|
||||
if (playerMemories != null) {
|
||||
this.windowData.addProperty("capacity", playerMemories.getMemoriesCapacity());
|
||||
PlayerMemories playerMemoriesComponent = store.getComponent(ref, PlayerMemories.getComponentType());
|
||||
if (playerMemoriesComponent != null) {
|
||||
this.windowData.addProperty("capacity", playerMemoriesComponent.getMemoriesCapacity());
|
||||
|
||||
for (Memory memory : playerMemories.getRecordedMemories()) {
|
||||
for (Memory memory : playerMemoriesComponent.getRecordedMemories()) {
|
||||
JsonObject obj = new JsonObject();
|
||||
obj.addProperty("title", memory.getTitle());
|
||||
obj.add("tooltipText", BsonUtil.translateBsonToJson(Message.CODEC.encode(memory.getTooltipText(), EmptyExtraInfo.EMPTY).asDocument()));
|
||||
@@ -79,6 +80,6 @@ public class MemoriesWindow extends Window {
|
||||
}
|
||||
|
||||
@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 WorldLocationProvider worldLocationProvider;
|
||||
|
||||
public ObjectiveSpawnBeacon() {
|
||||
}
|
||||
|
||||
public String getSpawnBeaconId() {
|
||||
return this.spawnBeaconId;
|
||||
}
|
||||
|
||||
@@ -13,9 +13,6 @@ import javax.annotation.Nonnull;
|
||||
public class BuilderActionCompleteTask extends BuilderActionPlayAnimation {
|
||||
protected final BooleanHolder playAnimation = new BooleanHolder();
|
||||
|
||||
public BuilderActionCompleteTask() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
|
||||
@@ -14,9 +14,6 @@ import javax.annotation.Nonnull;
|
||||
public class BuilderActionStartObjective extends BuilderActionBase {
|
||||
protected final AssetHolder objectiveId = new AssetHolder();
|
||||
|
||||
public BuilderActionStartObjective() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
|
||||
@@ -17,9 +17,6 @@ import javax.annotation.Nullable;
|
||||
public class BuilderSensorHasTask extends BuilderSensorBase {
|
||||
protected final StringArrayHolder tasksById = new StringArrayHolder();
|
||||
|
||||
public BuilderSensorHasTask() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
|
||||
@@ -12,9 +12,6 @@ import javax.annotation.Nonnull;
|
||||
public class KillTrackerResource implements Resource<EntityStore> {
|
||||
private final List<KillTaskTransaction> killTasks = new ObjectArrayList<>();
|
||||
|
||||
public KillTrackerResource() {
|
||||
}
|
||||
|
||||
public static ResourceType<EntityStore, KillTrackerResource> getResourceType() {
|
||||
return NPCObjectivesPlugin.get().getKillTrackerResourceType();
|
||||
}
|
||||
|
||||
@@ -15,9 +15,6 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class KillTrackerSystem extends DeathSystems.OnDeathSystem {
|
||||
public KillTrackerSystem() {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Query<EntityStore> getQuery() {
|
||||
|
||||
@@ -14,9 +14,6 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class SpawnBeaconCheckRemovalSystem extends HolderSystem<EntityStore> {
|
||||
public SpawnBeaconCheckRemovalSystem() {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Query<EntityStore> getQuery() {
|
||||
|
||||
@@ -13,9 +13,6 @@ import javax.annotation.Nonnull;
|
||||
public class ReputationAttitudeSystem extends StoreSystem<EntityStore> {
|
||||
private final ResourceType<EntityStore, Blackboard> resourceType = Blackboard.getResourceType();
|
||||
|
||||
public ReputationAttitudeSystem() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSystemAddedToStore(@Nonnull Store<EntityStore> store) {
|
||||
Blackboard blackboard = store.getResource(this.resourceType);
|
||||
|
||||
@@ -15,9 +15,6 @@ import javax.annotation.Nonnull;
|
||||
public class BuilderActionOpenBarterShop extends BuilderActionBase {
|
||||
protected final AssetHolder shopId = new AssetHolder();
|
||||
|
||||
public BuilderActionOpenBarterShop() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
|
||||
@@ -15,9 +15,6 @@ import javax.annotation.Nonnull;
|
||||
public class BuilderActionOpenShop extends BuilderActionBase {
|
||||
protected final AssetHolder shopId = new AssetHolder();
|
||||
|
||||
public BuilderActionOpenShop() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getShortDescription() {
|
||||
|
||||
@@ -45,8 +45,5 @@ public class DialogPage extends InteractiveCustomUIPage<DialogPage.DialogPageEve
|
||||
DialogPage.DialogPageEventData.class, DialogPage.DialogPageEventData::new
|
||||
)
|
||||
.build();
|
||||
|
||||
public DialogPageEventData() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -899,9 +899,6 @@ public class ObjectivePlugin extends JavaPlugin {
|
||||
.build();
|
||||
private DataStoreProvider dataStoreProvider = new DiskDataStoreProvider("objectives");
|
||||
|
||||
public ObjectivePluginConfig() {
|
||||
}
|
||||
|
||||
public DataStoreProvider getDataStoreProvider() {
|
||||
return this.dataStoreProvider;
|
||||
}
|
||||
|
||||
@@ -47,9 +47,6 @@ public class TreasureChestState extends ItemContainerState implements BreakValid
|
||||
protected UUID chestUUID;
|
||||
protected boolean opened;
|
||||
|
||||
public TreasureChestState() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canOpen(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor) {
|
||||
if (!this.opened) {
|
||||
|
||||
@@ -31,17 +31,6 @@ import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
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() {
|
||||
super("locationmarker", "server.commands.objective.locationMarker");
|
||||
this.addAliases("marker");
|
||||
@@ -71,9 +60,9 @@ public class ObjectiveLocationMarkerCommand extends AbstractCommandCollection {
|
||||
|
||||
String objectiveLocationMarkerId = this.locationMarkerArg.get(context);
|
||||
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(
|
||||
ObjectiveLocationMarkerCommand.MESSAGE_GENERAL_FAILED_DID_YOU_MEAN
|
||||
Message.translation("server.general.failed.didYouMean")
|
||||
.param(
|
||||
"choices",
|
||||
StringUtil.sortByFuzzyDistance(
|
||||
@@ -95,7 +84,7 @@ public class ObjectiveLocationMarkerCommand extends AbstractCommandCollection {
|
||||
holder.ensureComponent(Intangible.getComponentType());
|
||||
holder.ensureComponent(HiddenFromAdventurePlayers.getComponentType());
|
||||
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.setObjectiveMarkersEnabled(false);
|
||||
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.setObjectiveMarkersEnabled(true);
|
||||
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;
|
||||
|
||||
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() {
|
||||
super("reachlocationmarker", "server.commands.objective.reachLocationMarker");
|
||||
this.addSubCommand(new ObjectiveReachLocationMarkerCommand.AddReachLocationMarkerCommand());
|
||||
@@ -61,11 +50,9 @@ public class ObjectiveReachLocationMarkerCommand extends AbstractCommandCollecti
|
||||
) {
|
||||
String reachLocationMarkerId = this.reachLocationMarkerArg.get(context);
|
||||
if (ReachLocationMarkerAsset.getAssetMap().getAsset(reachLocationMarkerId) == null) {
|
||||
context.sendMessage(Message.translation("server.commands.objective.reachLocationMarker.notFound").param("id", reachLocationMarkerId));
|
||||
context.sendMessage(
|
||||
ObjectiveReachLocationMarkerCommand.MESSAGE_COMMANDS_OBJECTIVE_REACH_LOCATION_MARKER_NOT_FOUND.param("id", reachLocationMarkerId)
|
||||
);
|
||||
context.sendMessage(
|
||||
ObjectiveReachLocationMarkerCommand.MESSAGE_GENERAL_FAILED_DID_YOU_MEAN
|
||||
Message.translation("server.general.failed.didYouMean")
|
||||
.param(
|
||||
"choices",
|
||||
StringUtil.sortByFuzzyDistance(
|
||||
@@ -91,7 +78,7 @@ public class ObjectiveReachLocationMarkerCommand extends AbstractCommandCollecti
|
||||
holder.ensureComponent(Intangible.getComponentType());
|
||||
holder.ensureComponent(HiddenFromAdventurePlayers.getComponentType());
|
||||
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 {
|
||||
@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
|
||||
private final RequiredArg<String> objectiveArg = this.withRequiredArg(
|
||||
"objectiveId", "server.commands.objective.start.objective.arg.objectiveId.desc", ArgTypes.STRING
|
||||
@@ -49,12 +45,13 @@ public class ObjectiveStartCommand extends AbstractCommandCollection {
|
||||
String objectiveId = this.objectiveArg.get(context);
|
||||
ObjectiveAsset asset = ObjectiveAsset.getAssetMap().getAsset(objectiveId);
|
||||
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(
|
||||
MESSAGE_GENERAL_FAILED_DID_YOU_MEAN.param(
|
||||
"choices",
|
||||
StringUtil.sortByFuzzyDistance(objectiveId, ObjectiveAsset.getAssetMap().getAssetMap().keySet(), CommandUtil.RECOMMEND_COUNT).toString()
|
||||
)
|
||||
Message.translation("server.general.failed.didYouMean")
|
||||
.param(
|
||||
"choices",
|
||||
StringUtil.sortByFuzzyDistance(objectiveId, ObjectiveAsset.getAssetMap().getAssetMap().keySet(), CommandUtil.RECOMMEND_COUNT).toString()
|
||||
)
|
||||
);
|
||||
} else {
|
||||
HashSet<UUID> playerSet = new HashSet<>();
|
||||
@@ -68,10 +65,6 @@ public class ObjectiveStartCommand extends AbstractCommandCollection {
|
||||
}
|
||||
|
||||
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
|
||||
private final RequiredArg<String> objectiveLineArg = this.withRequiredArg(
|
||||
"objectiveLineId", "server.commands.objective.start.objectiveLine.arg.objectiveLineId.desc", ArgTypes.STRING
|
||||
@@ -87,13 +80,14 @@ public class ObjectiveStartCommand extends AbstractCommandCollection {
|
||||
) {
|
||||
String objectiveLineId = this.objectiveLineArg.get(context);
|
||||
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(
|
||||
MESSAGE_GENERAL_FAILED_DID_YOU_MEAN.param(
|
||||
"choices",
|
||||
StringUtil.sortByFuzzyDistance(objectiveLineId, ObjectiveLineAsset.getAssetMap().getAssetMap().keySet(), CommandUtil.RECOMMEND_COUNT)
|
||||
.toString()
|
||||
)
|
||||
Message.translation("server.general.failed.didYouMean")
|
||||
.param(
|
||||
"choices",
|
||||
StringUtil.sortByFuzzyDistance(objectiveLineId, ObjectiveLineAsset.getAssetMap().getAssetMap().keySet(), CommandUtil.RECOMMEND_COUNT)
|
||||
.toString()
|
||||
)
|
||||
);
|
||||
} else {
|
||||
HashSet<UUID> playerSet = new HashSet<>();
|
||||
|
||||
@@ -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.interactions.StartObjectiveInteraction;
|
||||
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.LivingEntity;
|
||||
import com.hypixel.hytale.server.core.inventory.ItemStack;
|
||||
@@ -27,9 +26,8 @@ public class ClearObjectiveItemsCompletion extends ObjectiveCompletion {
|
||||
@Override
|
||||
public void handle(@Nonnull Objective objective, @Nonnull ComponentAccessor<EntityStore> componentAccessor) {
|
||||
objective.forEachParticipant((participantReference, objectiveUuid) -> {
|
||||
Entity entity = EntityUtils.getEntity(participantReference, componentAccessor);
|
||||
if (entity instanceof LivingEntity) {
|
||||
CombinedItemContainer inventory = ((LivingEntity)entity).getInventory().getCombinedHotbarFirst();
|
||||
if (EntityUtils.getEntity(participantReference, componentAccessor) instanceof LivingEntity livingEntity) {
|
||||
CombinedItemContainer inventory = livingEntity.getInventory().getCombinedHotbarFirst();
|
||||
|
||||
for (short i = 0; i < inventory.getCapacity(); 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, ObjectiveLineHistoryData> objectiveLineHistoryMap = new Object2ObjectOpenHashMap<>();
|
||||
|
||||
public ObjectiveHistoryComponent() {
|
||||
}
|
||||
|
||||
public Map<String, ObjectiveHistoryData> getObjectiveHistoryMap() {
|
||||
return this.objectiveHistoryMap;
|
||||
}
|
||||
|
||||
@@ -96,9 +96,6 @@ public class ObjectiveLocationMarkerAsset implements JsonAssetWithMap<String, De
|
||||
return (DefaultAssetMap<String, ObjectiveLocationMarkerAsset>)getAssetStore().getAssetMap();
|
||||
}
|
||||
|
||||
public ObjectiveLocationMarkerAsset() {
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@@ -25,9 +25,6 @@ public class ObjectiveGameplayConfig {
|
||||
.build();
|
||||
protected Map<String, String> starterObjectiveLinePerWorld;
|
||||
|
||||
public ObjectiveGameplayConfig() {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ObjectiveGameplayConfig get(@Nonnull GameplayConfig config) {
|
||||
return config.getPluginConfig().get(ObjectiveGameplayConfig.class);
|
||||
|
||||
@@ -18,9 +18,6 @@ public abstract class ObjectiveLocationMarkerArea {
|
||||
protected Box entryAreaBox;
|
||||
protected Box exitAreaBox;
|
||||
|
||||
public ObjectiveLocationMarkerArea() {
|
||||
}
|
||||
|
||||
public abstract void getPlayersInEntryArea(
|
||||
@Nonnull SpatialResource<Ref<EntityStore>, EntityStore> var1, @Nonnull List<Ref<EntityStore>> var2, @Nonnull Vector3d var3
|
||||
);
|
||||
|
||||
@@ -13,9 +13,6 @@ public abstract class ObjectiveTypeSetup {
|
||||
@Nonnull
|
||||
public static final CodecMapCodec<ObjectiveTypeSetup> CODEC = new CodecMapCodec<>("Type");
|
||||
|
||||
public ObjectiveTypeSetup() {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public abstract String getObjectiveIdToStart();
|
||||
|
||||
|
||||
@@ -25,9 +25,6 @@ public class SetupObjective extends ObjectiveTypeSetup {
|
||||
.build();
|
||||
protected String objectiveId;
|
||||
|
||||
public SetupObjective() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectiveIdToStart() {
|
||||
return this.objectiveId;
|
||||
|
||||
@@ -27,9 +27,6 @@ public class SetupObjectiveLine extends ObjectiveTypeSetup {
|
||||
.build();
|
||||
protected String objectiveLineId;
|
||||
|
||||
public SetupObjectiveLine() {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getObjectiveIdToStart() {
|
||||
|
||||
@@ -104,9 +104,6 @@ public abstract class ObjectiveTaskAsset {
|
||||
MARKER,
|
||||
PLAYER_AND_MARKER;
|
||||
|
||||
private TaskScope() {
|
||||
}
|
||||
|
||||
public boolean isTaskPossibleForMarker() {
|
||||
return this == MARKER || this == PLAYER_AND_MARKER;
|
||||
}
|
||||
|
||||
@@ -21,9 +21,6 @@ public class ReachLocationTaskAsset extends ObjectiveTaskAsset {
|
||||
.build();
|
||||
protected String targetLocationId;
|
||||
|
||||
public ReachLocationTaskAsset() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ObjectiveTaskAsset.TaskScope getTaskScope() {
|
||||
|
||||
@@ -112,9 +112,6 @@ public class TreasureMapObjectiveTaskAsset extends ObjectiveTaskAsset {
|
||||
protected WorldLocationProvider worldLocationProvider;
|
||||
protected String chestBlockTypeKey;
|
||||
|
||||
public ChestConfig() {
|
||||
}
|
||||
|
||||
public float getMinRadius() {
|
||||
return this.minRadius;
|
||||
}
|
||||
|
||||
@@ -50,9 +50,6 @@ public class SoloInventoryCondition extends TaskConditionAsset {
|
||||
protected boolean consumeOnCompletion;
|
||||
protected boolean holdInHand;
|
||||
|
||||
public SoloInventoryCondition() {
|
||||
}
|
||||
|
||||
public BlockTagOrItemIdField getBlockTypeOrTagTask() {
|
||||
return this.blockTypeOrTagTask;
|
||||
}
|
||||
|
||||
@@ -30,9 +30,6 @@ public class HourRangeTriggerCondition extends ObjectiveLocationTriggerCondition
|
||||
protected int minHour;
|
||||
protected int maxHour;
|
||||
|
||||
public HourRangeTriggerCondition() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConditionMet(
|
||||
@Nonnull ComponentAccessor<EntityStore> componentAccessor, Ref<EntityStore> ref, ObjectiveLocationMarker objectiveLocationMarker
|
||||
|
||||
@@ -10,9 +10,6 @@ import javax.annotation.Nonnull;
|
||||
public abstract class ObjectiveLocationTriggerCondition {
|
||||
public static final CodecMapCodec<ObjectiveLocationTriggerCondition> CODEC = new CodecMapCodec<>("Type");
|
||||
|
||||
public ObjectiveLocationTriggerCondition() {
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user