比较提交
| 作者 | SHA1 | 提交日期 | |
|---|---|---|---|
|
|
d2a52199ae | ||
|
|
1f817199f7 | ||
|
|
9ee4b41630 | ||
|
|
15b4a40b6d | ||
|
|
b8e56dafcb | ||
|
|
d0ed839d9f | ||
|
|
20c9cb10a3 | ||
|
|
e8f6009a66 | ||
|
|
8a2c4a21d8 |
+22
@@ -0,0 +1,22 @@
|
|||||||
|
# Gradle
|
||||||
|
.gradle/
|
||||||
|
build/
|
||||||
|
|
||||||
|
# Secrets
|
||||||
|
.env
|
||||||
|
|
||||||
|
# IDE
|
||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
|
.vscode/
|
||||||
|
.settings/
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
bin/
|
||||||
|
|
||||||
|
# OS
|
||||||
|
Thumbs.db
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Build temp
|
||||||
|
.buildtmp/
|
||||||
@@ -7,7 +7,8 @@
|
|||||||
- 从远程 `markers.json` 拉取各国领土边界
|
- 从远程 `markers.json` 拉取各国领土边界
|
||||||
- 四种扩地策略:方形外扩、区域扩地、玩家周围、绕国一圈
|
- 四种扩地策略:方形外扩、区域扩地、玩家周围、绕国一圈
|
||||||
- 区域扩地采用 S 形扫描:从与现有领土接壤的区块开始,横向/纵向 S 形扫过整个矩形,不沿邦国边界,但保证每个新占领区块都与已占领领土接壤
|
- 区域扩地采用 S 形扫描:从与现有领土接壤的区块开始,横向/纵向 S 形扫过整个矩形,不沿邦国边界,但保证每个新占领区块都与已占领领土接壤
|
||||||
- 自动寻路(Baritone)前往目标区块
|
- 自动寻路(Baritone)前往目标区块,寻路优先走地面减少走入矿洞,超时自动 `/u return` 回城自救
|
||||||
|
- 目标有效性校验:寻路/等待/重试前实时校验目标是否仍与己方领土接壤,不接壤立即跳过并重新规划
|
||||||
- 自动进食(饥饿时自动吃背包食物)
|
- 自动进食(饥饿时自动吃背包食物)
|
||||||
- 实时地图 GUI(通过 Ctrl+R 打开)
|
- 实时地图 GUI(通过 Ctrl+R 打开)
|
||||||
- 监听聊天/字幕消息判断开垦结果
|
- 监听聊天/字幕消息判断开垦结果
|
||||||
@@ -15,7 +16,7 @@
|
|||||||
## 安装
|
## 安装
|
||||||
|
|
||||||
1. 安装 Fabric Loader 0.16.14+ 和 Fabric API
|
1. 安装 Fabric Loader 0.16.14+ 和 Fabric API
|
||||||
2. 将 `autostore-1.1.2.jar` 放入 `.minecraft/mods/` 目录
|
2. 将 `autostore-1.1.8.jar` 放入 `.minecraft/mods/` 目录
|
||||||
3. 启动游戏,按 `Ctrl+R` 打开 GUI
|
3. 启动游戏,按 `Ctrl+R` 打开 GUI
|
||||||
|
|
||||||
## 构建
|
## 构建
|
||||||
@@ -25,4 +26,4 @@
|
|||||||
./build_mod.sh
|
./build_mod.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
输出文件:`autostore-1.1.2.jar`
|
输出文件:`autostore-1.1.7.jar`
|
||||||
|
|||||||
+57
@@ -0,0 +1,57 @@
|
|||||||
|
plugins {
|
||||||
|
id 'fabric-loom' version '1.17.19'
|
||||||
|
id 'maven-publish'
|
||||||
|
}
|
||||||
|
|
||||||
|
version = project.mod_version
|
||||||
|
group = project.maven_group
|
||||||
|
|
||||||
|
base {
|
||||||
|
archivesName = project.archives_base_name
|
||||||
|
}
|
||||||
|
|
||||||
|
// 用于把 Baritone 原样打包进模组 jar 的资源(不放默认依赖里,避免 Gradle 误解析)
|
||||||
|
configurations {
|
||||||
|
nestedJar
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// Minecraft
|
||||||
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||||
|
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||||
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||||
|
|
||||||
|
// Fabric API
|
||||||
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||||
|
|
||||||
|
// Baritone API (local jar, compile only)
|
||||||
|
modImplementation files("libs/baritone-api-fabric-1.13.1.jar")
|
||||||
|
|
||||||
|
// 标记需要嵌套打包的 jar
|
||||||
|
nestedJar files("libs/baritone-api-fabric-1.13.1.jar")
|
||||||
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
inputs.property "version", project.version
|
||||||
|
filteringCharset "UTF-8"
|
||||||
|
|
||||||
|
filesMatching("fabric.mod.json") {
|
||||||
|
expand "version": project.version
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将 Baritone 嵌套打包进 META-INF/jars,匹配 fabric.mod.json 的 jars 声明,
|
||||||
|
// 使玩家无需单独安装 baritone 依赖即可运行
|
||||||
|
from(configurations.nestedJar) {
|
||||||
|
into "META-INF/jars"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile).configureEach {
|
||||||
|
it.options.release = 21
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion = JavaLanguageVersion.of(21)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
org.gradle.jvmargs=-Xmx2G
|
||||||
|
org.gradle.parallel=true
|
||||||
|
|
||||||
|
# Fabric Properties
|
||||||
|
minecraft_version=1.21.4
|
||||||
|
yarn_mappings=1.21.4+build.8
|
||||||
|
loader_version=0.19.3
|
||||||
|
|
||||||
|
# Mod Properties
|
||||||
|
mod_version=1.1.8
|
||||||
|
maven_group=autostore
|
||||||
|
archives_base_name=autostore
|
||||||
|
|
||||||
|
# Fabric API
|
||||||
|
fabric_version=0.119.4+1.21.4
|
||||||
二进制
二进制文件未显示。
@@ -0,0 +1,9 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-9.7.0-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
retries=0
|
||||||
|
retryBackOffMs=500
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
@@ -0,0 +1,248 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# gradlew 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 gradlew
|
||||||
|
#
|
||||||
|
# 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/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
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
|
||||||
|
|
||||||
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 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
|
||||||
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
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" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# 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" "$@"
|
||||||
第三方依赖
+82
@@ -0,0 +1,82 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%"=="" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem gradlew startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables, and ensure extensions are enabled
|
||||||
|
setlocal EnableExtensions
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
|
echo. 1>&2
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
|
echo. 1>&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
|
"%COMSPEC%" /c exit 1
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo. 1>&2
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
|
echo. 1>&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
|
"%COMSPEC%" /c exit 1
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute gradlew
|
||||||
|
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
|
||||||
|
@rem which allows us to clear the local environment before executing the java command
|
||||||
|
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
|
||||||
|
|
||||||
|
:exitWithErrorLevel
|
||||||
|
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
|
||||||
|
"%COMSPEC%" /c exit %ERRORLEVEL%
|
||||||
二进制文件未显示。
+12
@@ -0,0 +1,12 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = 'Fabric'
|
||||||
|
url = 'https://maven.fabricmc.net/'
|
||||||
|
}
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = 'autostore'
|
||||||
@@ -7,8 +7,6 @@ package autostore.client.bridge;
|
|||||||
import baritone.api.BaritoneAPI;
|
import baritone.api.BaritoneAPI;
|
||||||
import baritone.api.IBaritone;
|
import baritone.api.IBaritone;
|
||||||
import baritone.api.Settings;
|
import baritone.api.Settings;
|
||||||
import baritone.api.pathing.goals.Goal;
|
|
||||||
import baritone.api.pathing.goals.GoalXZ;
|
|
||||||
import autostore.client.config.ExpansionConfig;
|
import autostore.client.config.ExpansionConfig;
|
||||||
import autostore.client.territory.ChunkPos;
|
import autostore.client.territory.ChunkPos;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
@@ -39,7 +37,7 @@ public final class BaritoneBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 让 Baritone 寻路前往指定区块的中心。
|
* 让 Baritone 寻路前往指定区块(以“到达区块内”为完成条件)。
|
||||||
*
|
*
|
||||||
* @param chunk 目标区块
|
* @param chunk 目标区块
|
||||||
*/
|
*/
|
||||||
@@ -48,9 +46,11 @@ public final class BaritoneBridge {
|
|||||||
if (baritone == null) {
|
if (baritone == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 使用 GoalXZ 前往区块中心:Baritone 的 GoalXZ 自带约 10 格容差,
|
// 使用自定义 ChunkGoal:完成条件为“玩家脚下方块落在目标区块内”,
|
||||||
// 只需到达区块中心附近即可,避免中心点不可达导致寻路卡死
|
// 与控制器 playerChunk.equals(target) 的判定一致。避免 Baritone 自带
|
||||||
baritone.getCustomGoalProcess().setGoalAndPath(new GoalXZ(chunk.centerBlockX(), chunk.centerBlockZ()));
|
// GoalXZ(容差 0,精确到区块中心单格)在中心不可达时停在相邻区块,
|
||||||
|
// 造成目标区块错位与反复寻路。
|
||||||
|
baritone.getCustomGoalProcess().setGoalAndPath(new ChunkGoal(chunk));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 强制取消当前寻路任务。 */
|
/** 强制取消当前寻路任务。 */
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* 本文件为 AutoStore 模组自定义的 Baritone 寻路目标。
|
||||||
|
*/
|
||||||
|
package autostore.client.bridge;
|
||||||
|
|
||||||
|
import autostore.client.territory.ChunkPos;
|
||||||
|
import baritone.api.pathing.goals.Goal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 以“到达目标区块内”为完成条件的寻路目标。
|
||||||
|
*
|
||||||
|
* <p>修复“目标区块错位”问题:Baritone 自带的 {@code GoalXZ} 容差为 0,
|
||||||
|
* 会要求玩家精确站在区块中心的单个方块上(如 {@code x*16+8, z*16+8})。
|
||||||
|
* 一旦该方块不可达(被树、石头、水、建筑等占据),玩家会被停在区块边缘甚至
|
||||||
|
* 相邻区块,导致玩家所在区块与目标区块错位、反复寻路。</p>
|
||||||
|
*
|
||||||
|
* <p>本目标把完成条件放宽为“玩家脚下方块落在目标区块内”,与控制器中
|
||||||
|
* {@code playerChunk.equals(target)} 的判定完全一致,从而彻底消除
|
||||||
|
* 中心点不可达带来的错位。</p>
|
||||||
|
*/
|
||||||
|
public final class ChunkGoal implements Goal {
|
||||||
|
|
||||||
|
/** 目标区块 X 坐标 */
|
||||||
|
private final int targetX;
|
||||||
|
/** 目标区块 Z 坐标 */
|
||||||
|
private final int targetZ;
|
||||||
|
/** 目标区块中心的方块 X 坐标(用于启发式距离估算) */
|
||||||
|
private final int centerX;
|
||||||
|
/** 目标区块中心的方块 Z 坐标(用于启发式距离估算) */
|
||||||
|
private final int centerZ;
|
||||||
|
|
||||||
|
public ChunkGoal(ChunkPos chunk) {
|
||||||
|
this.targetX = chunk.x();
|
||||||
|
this.targetZ = chunk.z();
|
||||||
|
this.centerX = chunk.centerBlockX();
|
||||||
|
this.centerZ = chunk.centerBlockZ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 判断玩家脚下方块是否落在目标区块内 */
|
||||||
|
@Override
|
||||||
|
public boolean isInGoal(int x, int y, int z) {
|
||||||
|
return Math.floorDiv(x, 16) == this.targetX && Math.floorDiv(z, 16) == this.targetZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 启发式:到目标区块中心的水平欧几里得距离(可采纳,保证寻路效率) */
|
||||||
|
@Override
|
||||||
|
public double heuristic(int x, int y, int z) {
|
||||||
|
double dx = x - this.centerX;
|
||||||
|
double dz = z - this.centerZ;
|
||||||
|
return Math.sqrt(dx * dx + dz * dz);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -70,6 +70,12 @@ implements SubtitleChatMonitor.Listener {
|
|||||||
private int retryCount;
|
private int retryCount;
|
||||||
/** 当前阶段(寻路/等待)的开始时间戳 */
|
/** 当前阶段(寻路/等待)的开始时间戳 */
|
||||||
private long stageStartedMillis;
|
private long stageStartedMillis;
|
||||||
|
/** 发送 "/u return" 回城指令的时间戳;0 表示当前未处于回城恢复等待中 */
|
||||||
|
private long returnCommandAtMillis;
|
||||||
|
/** 回城后是否需要跳过当前目标(重试次数已耗尽则为 true) */
|
||||||
|
private boolean skipTargetAfterReturn;
|
||||||
|
/** 回城等待时长:发送 "/u return" 后等待传送回王城的毫秒数 */
|
||||||
|
private static final long RETURN_WAIT_MS = 10_000L;
|
||||||
/** 最近一次开垦进度(0-100) */
|
/** 最近一次开垦进度(0-100) */
|
||||||
private int lastProgress;
|
private int lastProgress;
|
||||||
/** 当前目标区块的哈希集合,用于去重(防止重复计数) */
|
/** 当前目标区块的哈希集合,用于去重(防止重复计数) */
|
||||||
@@ -168,6 +174,8 @@ implements SubtitleChatMonitor.Listener {
|
|||||||
this.claimedSet.clear();
|
this.claimedSet.clear();
|
||||||
this.target = null;
|
this.target = null;
|
||||||
this.eating = false;
|
this.eating = false;
|
||||||
|
this.returnCommandAtMillis = 0L;
|
||||||
|
this.skipTargetAfterReturn = false;
|
||||||
this.baritoneBridge.applyConfig(this.config);
|
this.baritoneBridge.applyConfig(this.config);
|
||||||
this.setState(State.PLANNING, "\u6b63\u5728\u751f\u6210\u6269\u5f20\u8ba1\u5212");
|
this.setState(State.PLANNING, "\u6b63\u5728\u751f\u6210\u6269\u5f20\u8ba1\u5212");
|
||||||
this.log("\u5f00\u59cb\u81ea\u52a8\u6269\u5730\uff0c\u90a6\u56fd\uff1a" + this.model.selfStateName());
|
this.log("\u5f00\u59cb\u81ea\u52a8\u6269\u5730\uff0c\u90a6\u56fd\uff1a" + this.model.selfStateName());
|
||||||
@@ -182,6 +190,8 @@ implements SubtitleChatMonitor.Listener {
|
|||||||
}
|
}
|
||||||
this.baritoneBridge.cancel();
|
this.baritoneBridge.cancel();
|
||||||
this.eating = false;
|
this.eating = false;
|
||||||
|
this.returnCommandAtMillis = 0L;
|
||||||
|
this.skipTargetAfterReturn = false;
|
||||||
this.setState(State.STOPPED, "\u5df2\u624b\u52a8\u505c\u6b62");
|
this.setState(State.STOPPED, "\u5df2\u624b\u52a8\u505c\u6b62");
|
||||||
this.log("\u5df2\u624b\u52a8\u505c\u6b62");
|
this.log("\u5df2\u624b\u52a8\u505c\u6b62");
|
||||||
}
|
}
|
||||||
@@ -284,6 +294,26 @@ implements SubtitleChatMonitor.Listener {
|
|||||||
this.setState(State.NEXT, "\u76ee\u6807\u4e3a\u7a7a");
|
this.setState(State.NEXT, "\u76ee\u6807\u4e3a\u7a7a");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 正处于"回城恢复等待"中(已发送 /u return):等待传送回王城,暂不处理超时/到达
|
||||||
|
if (this.returnCommandAtMillis > 0L) {
|
||||||
|
// 等待窗口未结束:静默等待,让 /u return 完成传送
|
||||||
|
if (System.currentTimeMillis() - this.returnCommandAtMillis < RETURN_WAIT_MS) {
|
||||||
|
this.status = "\u5bfb\u8def\u8d85\u65f6\uff0c\u6b63\u5728\u56de\u57ce\uff08/u return\uff09";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 等待窗口结束:取消回城等待;据重试次数决定重寻路或跳过
|
||||||
|
this.returnCommandAtMillis = 0L;
|
||||||
|
if (this.skipTargetAfterReturn) {
|
||||||
|
this.skipTargetAfterReturn = false;
|
||||||
|
this.log("\u5bfb\u8def\u8d85\u65f6\uff0c\u56de\u57ce\u540e\u8df3\u8fc7 " + this.target.x() + "," + this.target.z());
|
||||||
|
this.setState(State.FAIL, "\u5bfb\u8def\u8d85\u65f6");
|
||||||
|
this.dataService.refreshAsync();
|
||||||
|
} else {
|
||||||
|
this.log("\u5df2\u56de\u57ce\uff0c\u91cd\u65b0\u5bfb\u8def\u524d\u5f80 " + this.target.x() + "," + this.target.z());
|
||||||
|
this.retrySameTarget("\u5df2\u56de\u57ce\uff0c\u91cd\u65b0\u524d\u5f80 " + this.target.x() + "," + this.target.z());
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 目标已被他人占领(地图刷新后发现):立即跳过,避免继续寻路到无效区块
|
// 目标已被他人占领(地图刷新后发现):立即跳过,避免继续寻路到无效区块
|
||||||
if (this.skipIfTargetClaimed("\u76ee\u6807\u5df2\u88ab\u5360\u9886")) {
|
if (this.skipIfTargetClaimed("\u76ee\u6807\u5df2\u88ab\u5360\u9886")) {
|
||||||
return;
|
return;
|
||||||
@@ -299,13 +329,14 @@ implements SubtitleChatMonitor.Listener {
|
|||||||
++this.retryCount;
|
++this.retryCount;
|
||||||
// 主动刷新地图,尽快同步"区块已被占领"的最新状态,避免玩家被困
|
// 主动刷新地图,尽快同步"区块已被占领"的最新状态,避免玩家被困
|
||||||
this.dataService.refreshAsync();
|
this.dataService.refreshAsync();
|
||||||
if (this.retryCount >= this.config.retries) {
|
// 寻路超时:发送 /u return 回城,等待传送回王城后重新寻路;重试次数耗尽则回城后跳过
|
||||||
this.log("\u5bfb\u8def\u8d85\u65f6\uff0c\u8df3\u8fc7 " + this.target.x() + "," + this.target.z());
|
this.skipTargetAfterReturn = this.retryCount >= this.config.retries;
|
||||||
this.setState(State.FAIL, "\u5bfb\u8def\u8d85\u65f6");
|
if (this.skipTargetAfterReturn) {
|
||||||
|
this.log("\u5bfb\u8def\u8d85\u65f6\uff0c\u56de\u57ce\u540e\u8df3\u8fc7 " + this.target.x() + "," + this.target.z());
|
||||||
} else {
|
} else {
|
||||||
this.log("\u5bfb\u8def\u8d85\u65f6\uff0c\u91cd\u8bd5 " + this.retryCount + "/" + this.config.retries);
|
this.log("\u5bfb\u8def\u8d85\u65f6\uff0c\u56de\u57ce\u91cd\u8bd5 " + this.retryCount + "/" + this.config.retries);
|
||||||
this.retrySameTarget("\u91cd\u8bd5\u524d\u5f80 " + this.target.x() + "," + this.target.z());
|
|
||||||
}
|
}
|
||||||
|
this.issueReturnCommand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,6 +370,21 @@ implements SubtitleChatMonitor.Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送 "/u return" 回城指令,取消当前寻路,并记录发送时刻以进入回城恢复等待。
|
||||||
|
* 服务器会在约 10 秒后将玩家传送回邦国王城,届时由 tickPathing 重新寻路。
|
||||||
|
*/
|
||||||
|
private void issueReturnCommand() {
|
||||||
|
this.baritoneBridge.cancel();
|
||||||
|
MinecraftClient client = MinecraftClient.getInstance();
|
||||||
|
if (client != null && client.player != null && client.player.networkHandler != null) {
|
||||||
|
// sendChatCommand 需传不带斜杠的命令("/u return" -> "u return")
|
||||||
|
client.player.networkHandler.sendChatCommand("u return");
|
||||||
|
}
|
||||||
|
this.returnCommandAtMillis = System.currentTimeMillis();
|
||||||
|
this.status = "\u5bfb\u8def\u8d85\u65f6\uff0c\u5df2\u53d1\u9001 /u return \u56de\u57ce";
|
||||||
|
}
|
||||||
|
|
||||||
/** 重试当前目标:取消旧寻路,重新让 Baritone 前往同一目标区块 */
|
/** 重试当前目标:取消旧寻路,重新让 Baritone 前往同一目标区块 */
|
||||||
private void retrySameTarget(String statusText) {
|
private void retrySameTarget(String statusText) {
|
||||||
// 目标已被他人占领(地图刷新后发现):不再重试,直接跳过,避免玩家被困在已占领区块
|
// 目标已被他人占领(地图刷新后发现):不再重试,直接跳过,避免玩家被困在已占领区块
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import java.util.List;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
|
import net.minecraft.util.Util;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.client.font.TextRenderer;
|
import net.minecraft.client.font.TextRenderer;
|
||||||
@@ -38,6 +39,9 @@ import net.minecraft.text.StringVisitable;
|
|||||||
*/
|
*/
|
||||||
public final class AutoStoreGui
|
public final class AutoStoreGui
|
||||||
extends Screen {
|
extends Screen {
|
||||||
|
// ---- 外部链接 ----
|
||||||
|
private static final String GIT_REPO_URL = "https://git.bgjq.top/Lyizai/AutoStore/";
|
||||||
|
private static final String HOMEPAGE_URL = "https://8w.bgjq.top/";
|
||||||
private final AutoStoreModClient mod;
|
private final AutoStoreModClient mod;
|
||||||
private final ExpansionConfig config;
|
private final ExpansionConfig config;
|
||||||
private final ExpansionController controller;
|
private final ExpansionController controller;
|
||||||
@@ -99,6 +103,9 @@ extends Screen {
|
|||||||
|
|
||||||
// ===== 顶部控制按钮 =====
|
// ===== 顶部控制按钮 =====
|
||||||
int topX = this.panelX;
|
int topX = this.panelX;
|
||||||
|
// 左上角外部链接按钮:Git 仓库与官网(点击在系统浏览器打开)
|
||||||
|
this.addDrawableChild(ButtonWidget.builder(Text.literal((String)"Git \u4ed3\u5e93"), button -> this.openUrl(GIT_REPO_URL)).dimensions(this.mapX, 8, 70, 16).build());
|
||||||
|
this.addDrawableChild(ButtonWidget.builder(Text.literal((String)"\u5b98\u7f51"), button -> this.openUrl(HOMEPAGE_URL)).dimensions(this.mapX + 76, 8, 50, 16).build());
|
||||||
ButtonWidget startButton = ButtonWidget.builder(Text.literal((String)"\u5f00\u59cb\u81ea\u52a8\u6269\u5730"), button -> this.start()).dimensions(topX, 34, 154, 30).build();
|
ButtonWidget startButton = ButtonWidget.builder(Text.literal((String)"\u5f00\u59cb\u81ea\u52a8\u6269\u5730"), button -> this.start()).dimensions(topX, 34, 154, 30).build();
|
||||||
ButtonWidget stopButton = ButtonWidget.builder(Text.literal((String)"\u505c\u6b62"), button -> this.controller.stop()).dimensions(topX + 160, 34, 74, 30).build();
|
ButtonWidget stopButton = ButtonWidget.builder(Text.literal((String)"\u505c\u6b62"), button -> this.controller.stop()).dimensions(topX + 160, 34, 74, 30).build();
|
||||||
this.addDrawableChild(startButton);
|
this.addDrawableChild(startButton);
|
||||||
@@ -158,6 +165,15 @@ extends Screen {
|
|||||||
this.initializeMapView();
|
this.initializeMapView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 在系统默认浏览器中打开外部链接(失败时静默忽略) */
|
||||||
|
private void openUrl(String url) {
|
||||||
|
try {
|
||||||
|
Util.getOperatingSystem().open(new java.net.URI(url));
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
// 链接打开失败不影响界面正常使用
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 创建整数输入框(初始值为 value,最多 12 位) */
|
/** 创建整数输入框(初始值为 value,最多 12 位) */
|
||||||
private TextFieldWidget numberField(int value, int x, int y, int width) {
|
private TextFieldWidget numberField(int value, int x, int y, int width) {
|
||||||
TextFieldWidget field = new TextFieldWidget(this.textRenderer, x, y, width, 20, Text.literal((String)""));
|
TextFieldWidget field = new TextFieldWidget(this.textRenderer, x, y, width, 20, Text.literal((String)""));
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -65,6 +66,16 @@ public final class TerritoryDataService {
|
|||||||
private volatile long lastSuccessfulFetchMillis;
|
private volatile long lastSuccessfulFetchMillis;
|
||||||
/** 最近一次尝试拉取的时间戳(毫秒) */
|
/** 最近一次尝试拉取的时间戳(毫秒) */
|
||||||
private volatile long lastAttemptMillis;
|
private volatile long lastAttemptMillis;
|
||||||
|
/** 会话内新占领区块的本地记录时间(毫秒),用于刷新时判断该占领是否已被地图数据确认 */
|
||||||
|
private final Map<ChunkPos, Long> sessionClaimTimes = new ConcurrentHashMap<>();
|
||||||
|
/**
|
||||||
|
* 会话占领"确认宽限"时长(毫秒)。
|
||||||
|
*
|
||||||
|
* <p>占领成功后,服务器动态地图(Dynmap/markers.json)可能尚未同步该区块,
|
||||||
|
* 因此在宽限期内即使地图未确认也先保留"会话占领"标记,避免刚占领的区块被误判为假占领。
|
||||||
|
* 超过宽限期仍未在地图中确认的,视为未真正占领并丢弃,使空洞区块能重新进入规划。
|
||||||
|
*/
|
||||||
|
private static final long CLAIM_CONFIRM_GRACE_MS = 120_000L;
|
||||||
|
|
||||||
public TerritoryDataService() {
|
public TerritoryDataService() {
|
||||||
this.executor = TerritoryDataService.newExecutor();
|
this.executor = TerritoryDataService.newExecutor();
|
||||||
@@ -111,8 +122,8 @@ public final class TerritoryDataService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 异步刷新领土数据(在调度线程中执行)。
|
* 异步刷新领土数据(在调度线程中执行)。
|
||||||
* 拉取成功后解析 JSON,并把上一份模型中的"会话新占领区块"合并进新模型,
|
* 拉取成功后解析 JSON,并把上一份模型中的"会话新占领区块"与刚拉取的最新地图数据仔细核对,
|
||||||
* 避免刷新覆盖掉本次会话的占领记录。
|
* 只保留"已被地图确认"或"刚占领未超宽限期"的占领记录,避免刷新时把假占领永久留在模型里。
|
||||||
*/
|
*/
|
||||||
public void refreshAsync() {
|
public void refreshAsync() {
|
||||||
this.executor.execute(() -> {
|
this.executor.execute(() -> {
|
||||||
@@ -127,8 +138,25 @@ public final class TerritoryDataService {
|
|||||||
TerritoryModel parsed = TerritoryDataService.parse(response.body());
|
TerritoryModel parsed = TerritoryDataService.parse(response.body());
|
||||||
TerritoryModel previous = this.model;
|
TerritoryModel previous = this.model;
|
||||||
if (previous != null) {
|
if (previous != null) {
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
|
// 本次拉取到的己方领土区块(地图数据即最终依据,无需缓存旧数据)
|
||||||
|
Set<ChunkPos> freshOwn = new HashSet<>();
|
||||||
|
TerritoryState freshSelf = parsed.state(this.selectedStateName);
|
||||||
|
if (freshSelf != null) {
|
||||||
|
freshOwn.addAll(freshSelf.chunks());
|
||||||
|
}
|
||||||
for (ChunkPos sessionClaim : previous.sessionClaims()) {
|
for (ChunkPos sessionClaim : previous.sessionClaims()) {
|
||||||
|
Long claimTime = this.sessionClaimTimes.get(sessionClaim);
|
||||||
|
boolean confirmed = freshOwn.contains(sessionClaim);
|
||||||
|
boolean withinGrace = claimTime != null && now - claimTime < CLAIM_CONFIRM_GRACE_MS;
|
||||||
|
if (confirmed || withinGrace) {
|
||||||
|
// 地图已确认,或尚在宽限期(Dynmap 可能还没同步):保留会话占领标记
|
||||||
parsed.addSessionClaim(sessionClaim);
|
parsed.addSessionClaim(sessionClaim);
|
||||||
|
} else if (claimTime != null) {
|
||||||
|
// 地图始终未确认且超时:判定为假占领并移除,使空洞区块重新进入规划
|
||||||
|
this.sessionClaimTimes.remove(sessionClaim);
|
||||||
|
}
|
||||||
|
// claimTime 为 null(从未在本服务记录)也视为未确认:不保留
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
parsed.setSelfStateName(this.selectedStateName);
|
parsed.setSelfStateName(this.selectedStateName);
|
||||||
@@ -163,6 +191,7 @@ public final class TerritoryDataService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addSessionClaim(ChunkPos chunk) {
|
public void addSessionClaim(ChunkPos chunk) {
|
||||||
|
this.sessionClaimTimes.put(chunk, System.currentTimeMillis());
|
||||||
TerritoryModel current = this.model;
|
TerritoryModel current = this.model;
|
||||||
if (current != null) {
|
if (current != null) {
|
||||||
current.addSessionClaim(chunk);
|
current.addSessionClaim(chunk);
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"schemaVersion":1,"id":"autostore","version":"1.1.2","name":"AutoStore","description":"","authors":[],"contact":{},"license":"All-Rights-Reserved","environment":"client","entrypoints":{"fabric-datagen":["autostore.client.AutoStoreModDataGenerator"],"client":["autostore.client.AutoStoreModClient"],"main":["autostore.AutoStoreMod"]},"mixins":["autostore.mixins.json",{"config":"autostore.client.mixins.json","environment":"client"}],"depends":{"fabricloader":">=0.16.14","fabric-api":"*","minecraft":"1.21.4"},"jars":[{"file":"META-INF/jars/baritone-api-fabric-1.13.1.jar"}]}
|
{"schemaVersion":1,"id":"autostore","version":"1.1.8","name":"AutoStore","description":"","authors":[],"contact":{},"license":"All-Rights-Reserved","environment":"client","entrypoints":{"fabric-datagen":["autostore.client.AutoStoreModDataGenerator"],"client":["autostore.client.AutoStoreModClient"],"main":["autostore.AutoStoreMod"]},"mixins":["autostore.mixins.json",{"config":"autostore.client.mixins.json","environment":"client"}],"depends":{"fabricloader":">=0.16.14","fabric-api":"*","minecraft":"1.21.4"},"jars":[{"file":"META-INF/jars/baritone-api-fabric-1.13.1.jar"}]}
|
||||||
在新工单中引用
屏蔽一个用户