This commit is contained in:
commit
09262655bc
5
.gitattributes
vendored
Normal file
5
.gitattributes
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Disable autocrlf on generated files, they always generate with LF
|
||||||
|
# Add any extra files or paths here to make git stop saying they
|
||||||
|
# are changed when only line endings change.
|
||||||
|
src/generated/**/.cache/cache text eol=lf
|
||||||
|
src/generated/**/*.json text eol=lf
|
27
.github/workflows/ci_build_1.20.6.yml
vendored
Normal file
27
.github/workflows/ci_build_1.20.6.yml
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
name: Build1.21
|
||||||
|
|
||||||
|
on: push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: 拉取项目
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: 初始化环境
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'liberica'
|
||||||
|
java-version: '21'
|
||||||
|
- name: 初始化Gradle
|
||||||
|
uses: gradle/actions/setup-gradle@v4
|
||||||
|
- name: 构建项目
|
||||||
|
run: |
|
||||||
|
chmod 755 ./gradlew
|
||||||
|
./gradlew build
|
||||||
|
- name: 上传构建
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: MCTools_Neoforge1.20.6.jar
|
||||||
|
path: build/libs/mctoolsneo-1.0.0.jar
|
||||||
|
retention-days: 16
|
26
.gitignore
vendored
Normal file
26
.gitignore
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# eclipse
|
||||||
|
bin
|
||||||
|
*.launch
|
||||||
|
.settings
|
||||||
|
.metadata
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
|
||||||
|
# idea
|
||||||
|
out
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
.idea
|
||||||
|
|
||||||
|
# gradle
|
||||||
|
build
|
||||||
|
.gradle
|
||||||
|
|
||||||
|
# other
|
||||||
|
eclipse
|
||||||
|
run
|
||||||
|
runs
|
||||||
|
run-data
|
||||||
|
|
||||||
|
repo
|
4
README.md
Normal file
4
README.md
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
MCTools NeoForge Version
|
||||||
|
======
|
||||||
|
|
||||||
|
NeoForge版本的MC工具包_适用于1.20.6
|
164
build.gradle
Normal file
164
build.gradle
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java-library'
|
||||||
|
id 'eclipse'
|
||||||
|
id 'idea'
|
||||||
|
id 'maven-publish'
|
||||||
|
id 'net.neoforged.gradle.userdev' version '7.0.142'
|
||||||
|
}
|
||||||
|
|
||||||
|
version = mod_version
|
||||||
|
group = mod_group_id
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
}
|
||||||
|
|
||||||
|
base {
|
||||||
|
archivesName = mod_id
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mojang ships Java 21 to end users starting in 1.20.5, so mods should target Java 21.
|
||||||
|
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
|
||||||
|
|
||||||
|
//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||||
|
//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager
|
||||||
|
|
||||||
|
// Default run configurations.
|
||||||
|
// These can be tweaked, removed, or duplicated as needed.
|
||||||
|
runs {
|
||||||
|
// applies to all the run configs below
|
||||||
|
configureEach {
|
||||||
|
// Recommended logging data for a userdev environment
|
||||||
|
// The markers can be added/remove as needed separated by commas.
|
||||||
|
// "SCAN": For mods scan.
|
||||||
|
// "REGISTRIES": For firing of registry events.
|
||||||
|
// "REGISTRYDUMP": For getting the contents of all registries.
|
||||||
|
systemProperty 'forge.logging.markers', 'REGISTRIES'
|
||||||
|
|
||||||
|
// Recommended logging level for the console
|
||||||
|
// You can set various levels here.
|
||||||
|
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
|
||||||
|
systemProperty 'forge.logging.console.level', 'debug'
|
||||||
|
|
||||||
|
modSource project.sourceSets.main
|
||||||
|
}
|
||||||
|
|
||||||
|
client {
|
||||||
|
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
||||||
|
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
|
||||||
|
programArgument '--nogui'
|
||||||
|
}
|
||||||
|
|
||||||
|
// This run config launches GameTestServer and runs all registered gametests, then exits.
|
||||||
|
// By default, the server will crash when no gametests are provided.
|
||||||
|
// The gametest system is also enabled by default for other run configs under the /test command.
|
||||||
|
gameTestServer {
|
||||||
|
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
|
||||||
|
}
|
||||||
|
|
||||||
|
data {
|
||||||
|
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
|
||||||
|
// workingDirectory project.file('run-data')
|
||||||
|
|
||||||
|
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
||||||
|
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Include resources generated by data generators.
|
||||||
|
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
||||||
|
|
||||||
|
// Sets up a dependency configuration called 'localRuntime'.
|
||||||
|
// This configuration should be used instead of 'runtimeOnly' to declare
|
||||||
|
// a dependency that will be present for runtime testing but that is
|
||||||
|
// "optional", meaning it will not be pulled by dependents of this mod.
|
||||||
|
configurations {
|
||||||
|
runtimeClasspath.extendsFrom localRuntime
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// Specify the version of Minecraft to use.
|
||||||
|
// Depending on the plugin applied there are several options. We will assume you applied the userdev plugin as shown above.
|
||||||
|
// The group for userdev is net.neoforged, the module name is neoforge, and the version is the same as the neoforge version.
|
||||||
|
// You can however also use the vanilla plugin (net.neoforged.gradle.vanilla) to use a version of Minecraft without the neoforge loader.
|
||||||
|
// And its provides the option to then use net.minecraft as the group, and one of; client, server or joined as the module name, plus the game version as version.
|
||||||
|
// For all intends and purposes: You can treat this dependency as if it is a normal library you would use.
|
||||||
|
implementation "net.neoforged:neoforge:${neo_version}"
|
||||||
|
|
||||||
|
// Example optional mod dependency with JEI
|
||||||
|
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
|
||||||
|
// compileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}"
|
||||||
|
// compileOnly "mezz.jei:jei-${mc_version}-neoforge-api:${jei_version}"
|
||||||
|
// We add the full version to localRuntime, not runtimeOnly, so that we do not publish a dependency on it
|
||||||
|
// localRuntime "mezz.jei:jei-${mc_version}-neoforge:${jei_version}"
|
||||||
|
|
||||||
|
// Example mod dependency using a mod jar from ./libs with a flat dir repository
|
||||||
|
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
|
||||||
|
// The group id is ignored when searching -- in this case, it is "blank"
|
||||||
|
// implementation "blank:coolmod-${mc_version}:${coolmod_version}"
|
||||||
|
|
||||||
|
// Example mod dependency using a file as dependency
|
||||||
|
// implementation files("libs/coolmod-${mc_version}-${coolmod_version}.jar")
|
||||||
|
|
||||||
|
// Example project dependency using a sister or child project:
|
||||||
|
// implementation project(":myproject")
|
||||||
|
|
||||||
|
// For more info:
|
||||||
|
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
||||||
|
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||||
|
}
|
||||||
|
|
||||||
|
// This block of code expands all declared replace properties in the specified resource targets.
|
||||||
|
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
|
||||||
|
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
|
||||||
|
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||||
|
tasks.withType(ProcessResources).configureEach {
|
||||||
|
var replaceProperties = [
|
||||||
|
minecraft_version : minecraft_version,
|
||||||
|
minecraft_version_range: minecraft_version_range,
|
||||||
|
neo_version : neo_version,
|
||||||
|
neo_version_range : neo_version_range,
|
||||||
|
loader_version_range : loader_version_range,
|
||||||
|
mod_id : mod_id,
|
||||||
|
mod_name : mod_name,
|
||||||
|
mod_license : mod_license,
|
||||||
|
mod_version : mod_version,
|
||||||
|
mod_authors : mod_authors,
|
||||||
|
mod_description : mod_description
|
||||||
|
]
|
||||||
|
inputs.properties replaceProperties
|
||||||
|
|
||||||
|
filesMatching(['META-INF/neoforge.mods.toml']) {
|
||||||
|
expand replaceProperties
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Example configuration to allow publishing using the maven-publish plugin
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
register('mavenJava', MavenPublication) {
|
||||||
|
from components.java
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
url "file://${project.projectDir}/repo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile).configureEach {
|
||||||
|
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
|
||||||
|
idea {
|
||||||
|
module {
|
||||||
|
downloadSources = true
|
||||||
|
downloadJavadoc = true
|
||||||
|
}
|
||||||
|
}
|
43
gradle.properties
Normal file
43
gradle.properties
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||||
|
org.gradle.jvmargs=-Xmx1G
|
||||||
|
org.gradle.daemon=false
|
||||||
|
org.gradle.debug=false
|
||||||
|
|
||||||
|
#read more on this at https://github.com/neoforged/NeoGradle/blob/NG_7.0/README.md#apply-parchment-mappings
|
||||||
|
# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started
|
||||||
|
neogradle.subsystems.parchment.minecraftVersion=1.20.6
|
||||||
|
neogradle.subsystems.parchment.mappingsVersion=2024.06.16
|
||||||
|
# Environment Properties
|
||||||
|
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
|
||||||
|
# The Minecraft version must agree with the Neo version to get a valid artifact
|
||||||
|
minecraft_version=1.20.6
|
||||||
|
# The Minecraft version range can use any release version of Minecraft as bounds.
|
||||||
|
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
|
||||||
|
# as they do not follow standard versioning conventions.
|
||||||
|
minecraft_version_range=[1.20.6,1.21)
|
||||||
|
# The Neo version must agree with the Minecraft version to get a valid artifact
|
||||||
|
neo_version=20.6.119
|
||||||
|
# The Neo version range can use any version of Neo as bounds
|
||||||
|
neo_version_range=[20.6,)
|
||||||
|
# The loader version range can only use the major version of FML as bounds
|
||||||
|
loader_version_range=[2,)
|
||||||
|
|
||||||
|
## Mod Properties
|
||||||
|
|
||||||
|
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
|
||||||
|
# Must match the String constant located in the main mod class annotated with @Mod.
|
||||||
|
mod_id=mctoolsneo
|
||||||
|
# The human-readable display name for the mod.
|
||||||
|
mod_name=McTools_Neoforge
|
||||||
|
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||||
|
mod_license=All Rights Reserved
|
||||||
|
# The mod version. See https://semver.org/
|
||||||
|
mod_version=1.0.0
|
||||||
|
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||||
|
# This should match the base package used for the mod sources.
|
||||||
|
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
|
mod_group_id=com.expvintl.mctoolsneo
|
||||||
|
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
|
||||||
|
mod_authors=YourNameHere, OtherNameHere
|
||||||
|
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
|
||||||
|
mod_description=Example mod description.\nNewline characters can be used and will be replaced properly.
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
252
gradlew
vendored
Normal file
252
gradlew
vendored
Normal file
@ -0,0 +1,252 @@
|
|||||||
|
#!/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.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
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
|
||||||
|
' "$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
|
||||||
|
|
||||||
|
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
|
||||||
|
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" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
94
gradlew.bat
vendored
Normal file
94
gradlew.bat
vendored
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%"=="" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
|
echo. 1>&2
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
|
echo. 1>&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo. 1>&2
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
|
echo. 1>&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
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% equ 0 goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
11
settings.gradle
Normal file
11
settings.gradle
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
gradlePluginPortal()
|
||||||
|
maven { url = 'https://maven.neoforged.net/releases' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
|
||||||
|
}
|
13
src/main/java/com/expvintl/mctoolsneo/Globals.java
Normal file
13
src/main/java/com/expvintl/mctoolsneo/Globals.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package com.expvintl.mctoolsneo;
|
||||||
|
|
||||||
|
import com.expvintl.mctoolsneo.types.Setting;
|
||||||
|
|
||||||
|
public class Globals {
|
||||||
|
public static Setting autoRespawn=new Setting();
|
||||||
|
public static Setting selfWalk=new Setting();
|
||||||
|
public static Setting checkBukkitPlugins=new Setting();
|
||||||
|
public static Setting autoTool=new Setting();
|
||||||
|
public static Setting autoFish=new Setting();
|
||||||
|
public static Setting noFallPacket=new Setting();
|
||||||
|
public static int TPS=0;
|
||||||
|
}
|
38
src/main/java/com/expvintl/mctoolsneo/MainClient.java
Normal file
38
src/main/java/com/expvintl/mctoolsneo/MainClient.java
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package com.expvintl.mctoolsneo;
|
||||||
|
|
||||||
|
import com.expvintl.mctoolsneo.commands.CAutoToolCommand;
|
||||||
|
import com.expvintl.mctoolsneo.commands.CFullbirghtCommand;
|
||||||
|
import com.expvintl.mctoolsneo.hud.MCInfo;
|
||||||
|
import com.expvintl.mctoolsneo.hud.PotionInfo;
|
||||||
|
import com.expvintl.mctoolsneo.modules.PlayerListTextLatency;
|
||||||
|
import com.mojang.logging.LogUtils;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.neoforged.bus.api.IEventBus;
|
||||||
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
|
import net.neoforged.fml.ModContainer;
|
||||||
|
import net.neoforged.fml.common.Mod;
|
||||||
|
import net.neoforged.neoforge.client.event.RegisterClientCommandsEvent;
|
||||||
|
import net.neoforged.neoforge.client.event.RenderGuiEvent;
|
||||||
|
import net.neoforged.neoforge.common.NeoForge;
|
||||||
|
import net.neoforged.neoforge.event.RegisterCommandsEvent;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
@Mod(MainClient.MODID)
|
||||||
|
public class MainClient {
|
||||||
|
public static final String MODID = "mctoolsneo";
|
||||||
|
|
||||||
|
public MainClient(IEventBus bus, ModContainer container){
|
||||||
|
NeoForge.EVENT_BUS.register(MCInfo.class);
|
||||||
|
NeoForge.EVENT_BUS.register(PotionInfo.class);
|
||||||
|
|
||||||
|
NeoForge.EVENT_BUS.register(this);
|
||||||
|
|
||||||
|
//初始化模块
|
||||||
|
PlayerListTextLatency.INSTANCE.init();
|
||||||
|
}
|
||||||
|
@SubscribeEvent
|
||||||
|
public void registerCommands(RegisterClientCommandsEvent event){
|
||||||
|
CFullbirghtCommand.register(event.getDispatcher());
|
||||||
|
CAutoToolCommand.register(event.getDispatcher());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,168 @@
|
|||||||
|
package com.expvintl.mctoolsneo.commands;
|
||||||
|
|
||||||
|
import com.expvintl.mctoolsneo.Globals;
|
||||||
|
import com.expvintl.mctoolsneo.events.MCEventBus;
|
||||||
|
import com.expvintl.mctoolsneo.events.player.PlayerAttackBlockEvent;
|
||||||
|
import com.expvintl.mctoolsneo.events.player.PlayerAttackEntityEvent;
|
||||||
|
import com.expvintl.mctoolsneo.events.player.PlayerBreakBlockEvent;
|
||||||
|
import com.expvintl.mctoolsneo.mixin.interfaces.ClientPlayerInteractionManagerAccessor;
|
||||||
|
import com.expvintl.mctoolsneo.utils.CommandUtils;
|
||||||
|
import com.expvintl.mctoolsneo.utils.Utils;
|
||||||
|
import com.google.common.eventbus.Subscribe;
|
||||||
|
import com.mojang.brigadier.Command;
|
||||||
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
import com.mojang.brigadier.arguments.BoolArgumentType;
|
||||||
|
import com.mojang.brigadier.context.CommandContext;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
import net.minecraft.core.component.DataComponents;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.server.commands.data.DataCommands;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.item.*;
|
||||||
|
import net.minecraft.world.item.enchantment.Enchantments;
|
||||||
|
import net.minecraft.world.level.block.BambooSaplingBlock;
|
||||||
|
import net.minecraft.world.level.block.BambooStalkBlock;
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
|
||||||
|
import static net.minecraft.commands.Commands.argument;
|
||||||
|
import static net.minecraft.commands.Commands.literal;
|
||||||
|
|
||||||
|
public class CAutoToolCommand {
|
||||||
|
private static final CAutoToolCommand INSTANCE=new CAutoToolCommand();
|
||||||
|
private int lastSlot=-1;
|
||||||
|
public static void register(CommandDispatcher<CommandSourceStack> dispatcher){
|
||||||
|
MCEventBus.INSTANCE.register(INSTANCE);
|
||||||
|
CommandUtils.CreateStatusCommand("cautotool", Globals.autoTool,dispatcher);
|
||||||
|
dispatcher.register(literal("cautotool").then(argument("开关", BoolArgumentType.bool()).executes(CAutoToolCommand::execute)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int execute(CommandContext<CommandSourceStack> context) {
|
||||||
|
Globals.autoTool.set(context.getArgument("开关", Boolean.class));
|
||||||
|
if(Globals.autoTool.get()){
|
||||||
|
context.getSource().source.sendSystemMessage(Component.literal("已启用智能工具!"));
|
||||||
|
}else{
|
||||||
|
context.getSource().source.sendSystemMessage(Component.literal("已禁用智能工具!"));
|
||||||
|
}
|
||||||
|
return Command.SINGLE_SUCCESS;
|
||||||
|
}
|
||||||
|
@Subscribe
|
||||||
|
private void onBreakBlock(PlayerBreakBlockEvent event){
|
||||||
|
if(!Globals.autoTool.get()) return;
|
||||||
|
Minecraft mc= Minecraft.getInstance();
|
||||||
|
if (mc.level == null||mc.player==null) return;
|
||||||
|
if (lastSlot!=-1){
|
||||||
|
//破坏方块后切换回去
|
||||||
|
mc.player.getInventory().selected=lastSlot;
|
||||||
|
lastSlot=-1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Subscribe
|
||||||
|
private void onAttackEntity(PlayerAttackEntityEvent event){
|
||||||
|
if(!Globals.autoTool.get()) return;
|
||||||
|
if(event.target.hasCustomName()) return;
|
||||||
|
//不对玩家使用
|
||||||
|
if(event.target.isAlwaysTicking()) return;
|
||||||
|
float bestScore=-1;
|
||||||
|
int slot=-1;
|
||||||
|
for(int i=0;i<9;i++) {
|
||||||
|
float score=getWeaponScore(event.player,event.target,i);
|
||||||
|
if(score<0) continue;
|
||||||
|
//选出最好分数的工具
|
||||||
|
if(score>bestScore){
|
||||||
|
bestScore=score;
|
||||||
|
slot=i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(slot==-1) return;
|
||||||
|
ItemStack currentItem = event.player.getInventory().getItem(slot);
|
||||||
|
//低耐久测试
|
||||||
|
if(!lowDurability(currentItem)) {
|
||||||
|
//切换过去
|
||||||
|
event.player.getInventory().selected = slot;
|
||||||
|
Minecraft mc=Minecraft.getInstance();
|
||||||
|
if(mc.gameMode!=null) {
|
||||||
|
((ClientPlayerInteractionManagerAccessor) mc.gameMode).syncSelectedSlot();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Subscribe
|
||||||
|
private void onAttackBlock(PlayerAttackBlockEvent event){
|
||||||
|
if(!Globals.autoTool.get()) return;
|
||||||
|
//自动工具
|
||||||
|
Minecraft mc=Minecraft.getInstance();
|
||||||
|
if (mc.level == null||mc.player==null) return;
|
||||||
|
BlockState state= mc.level.getBlockState(event.blockPos);
|
||||||
|
//跳过不可破坏
|
||||||
|
if(state.getDestroySpeed(mc.level, event.blockPos) < 0) return;
|
||||||
|
//统计最好的挖掘分数
|
||||||
|
float bestScore=-1;
|
||||||
|
//工具槽
|
||||||
|
int slot=-1;
|
||||||
|
//遍历每一个物品槽
|
||||||
|
for(int i=0;i<9;i++){
|
||||||
|
ItemStack item = mc.player.getInventory().getItem(i);
|
||||||
|
float score= getToolsScore(item,state);
|
||||||
|
if(score<0) continue;
|
||||||
|
//选出最好分数的工具
|
||||||
|
if(score>bestScore){
|
||||||
|
bestScore=score;
|
||||||
|
slot=i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(slot==-1) return;
|
||||||
|
ItemStack currentItem = mc.player.getInventory().getItem(slot);
|
||||||
|
//确定已经选择好了工具就切换
|
||||||
|
if(!lowDurability(currentItem)) {
|
||||||
|
//记住上一次的槽方便恢复
|
||||||
|
lastSlot=mc.player.getInventory().selected;
|
||||||
|
//切换过去
|
||||||
|
mc.player.getInventory().selected = slot;
|
||||||
|
if(mc.gameMode!=null) {
|
||||||
|
((ClientPlayerInteractionManagerAccessor) mc.gameMode).syncSelectedSlot();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public float getToolsScore(ItemStack item, BlockState state){
|
||||||
|
float score=0;
|
||||||
|
if(item.getItem() instanceof TieredItem || item.getItem() instanceof ShearsItem){
|
||||||
|
//根据挖掘速度提升评分
|
||||||
|
score+=item.getDestroySpeed(state)*30;
|
||||||
|
//附魔加分
|
||||||
|
//耐久
|
||||||
|
score+= Utils.GetEnchantLevel(Enchantments.UNBREAKING, item);
|
||||||
|
//效率
|
||||||
|
score+=Utils.GetEnchantLevel(Enchantments.EFFICIENCY,item);
|
||||||
|
//经验修补
|
||||||
|
score+=Utils.GetEnchantLevel(Enchantments.MENDING,item);
|
||||||
|
if (item.getItem() instanceof SwordItem item1 && (state.getBlock() instanceof BambooStalkBlock || state.getBlock() instanceof BambooSaplingBlock))
|
||||||
|
//根据挖掘等级加分
|
||||||
|
score += 90 + (item1.components().get(DataComponents.TOOL).getMiningSpeed(state) * 10);
|
||||||
|
}
|
||||||
|
return score;
|
||||||
|
}
|
||||||
|
public float getWeaponScore(Player player, Entity target, int slot) {
|
||||||
|
float damageScore = 0;
|
||||||
|
ItemStack item = player.getInventory().getItem(slot);
|
||||||
|
//剑优先
|
||||||
|
if(item.getItem() instanceof SwordItem) damageScore+=10;
|
||||||
|
//使用所有工具组
|
||||||
|
if (item.getItem() instanceof TieredItem tool) {
|
||||||
|
damageScore += tool.getTier().getAttackDamageBonus();
|
||||||
|
//锋利加分
|
||||||
|
damageScore += Utils.GetEnchantLevel(Enchantments.SHARPNESS, item) * 2;
|
||||||
|
//精修
|
||||||
|
damageScore+=Utils.GetEnchantLevel(Enchantments.MENDING,item);
|
||||||
|
//火焰附加
|
||||||
|
damageScore+=Utils.GetEnchantLevel(Enchantments.FIRE_ASPECT,item)*3;
|
||||||
|
//击退
|
||||||
|
damageScore+=Utils.GetEnchantLevel(Enchantments.KNOCKBACK,item)*2;
|
||||||
|
}
|
||||||
|
return damageScore;
|
||||||
|
}
|
||||||
|
//停用低耐久度
|
||||||
|
private boolean lowDurability(ItemStack itemStack) {
|
||||||
|
return (itemStack.getMaxDamage() - itemStack.getDamageValue()) < (itemStack.getMaxDamage() * 10 / 100);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.expvintl.mctoolsneo.commands;
|
||||||
|
|
||||||
|
import com.expvintl.mctoolsneo.mixin.interfaces.SimpleOptionAccessor;
|
||||||
|
import com.mojang.brigadier.Command;
|
||||||
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
import com.mojang.brigadier.context.CommandContext;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
|
||||||
|
import static net.minecraft.commands.Commands.literal;
|
||||||
|
|
||||||
|
public class CFullbirghtCommand {
|
||||||
|
public static void register(CommandDispatcher<CommandSourceStack> dispatcher){
|
||||||
|
dispatcher.register(literal("cfullbirght").executes(CFullbirghtCommand::execute));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int execute(CommandContext<CommandSourceStack> context) {
|
||||||
|
((SimpleOptionAccessor)(Object) Minecraft.getInstance().options.gamma()).forceSetValue(32767.0);
|
||||||
|
context.getSource().source.sendSystemMessage(Component.literal("已应用高亮"));
|
||||||
|
return Command.SINGLE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.expvintl.mctoolsneo.events;
|
||||||
|
|
||||||
|
import com.google.common.eventbus.EventBus;
|
||||||
|
|
||||||
|
public class MCEventBus {
|
||||||
|
public static EventBus INSTANCE=new EventBus();
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.expvintl.mctoolsneo.events.client;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
|
|
||||||
|
public class OpenScreenEvent {
|
||||||
|
private static final OpenScreenEvent INSTANCE=new OpenScreenEvent();
|
||||||
|
public Screen screen;
|
||||||
|
public static OpenScreenEvent get(Screen screen){
|
||||||
|
INSTANCE.screen=screen;
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.expvintl.mctoolsneo.events.client;
|
||||||
|
|
||||||
|
public class PreTickEvent {
|
||||||
|
private static final PreTickEvent INSTANCE=new PreTickEvent();
|
||||||
|
public static PreTickEvent get(){
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.expvintl.mctoolsneo.events.client.sounds;
|
||||||
|
|
||||||
|
import net.minecraft.client.resources.sounds.SoundInstance;
|
||||||
|
|
||||||
|
public class PlaySoundEvent {
|
||||||
|
private static final PlaySoundEvent INSTANCE=new PlaySoundEvent();
|
||||||
|
public SoundInstance soundInstance;
|
||||||
|
public static PlaySoundEvent get(SoundInstance instance){
|
||||||
|
INSTANCE.soundInstance=instance;
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.expvintl.mctoolsneo.events.hud;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
|
import net.minecraft.client.multiplayer.PlayerInfo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
public class RenderLatencyIconEvent {
|
||||||
|
public static RenderLatencyIconEvent INSTANCE=new RenderLatencyIconEvent();
|
||||||
|
public GuiGraphics draw;
|
||||||
|
public PlayerInfo entry;
|
||||||
|
public CallbackInfo callback;
|
||||||
|
public int x,y,width;
|
||||||
|
public static RenderLatencyIconEvent get(GuiGraphics draw, int width, int x, int y, PlayerInfo entry, CallbackInfo callback){
|
||||||
|
INSTANCE.draw=draw;
|
||||||
|
INSTANCE.callback=callback;
|
||||||
|
INSTANCE.entry=entry;
|
||||||
|
INSTANCE.y=y;
|
||||||
|
INSTANCE.x=x;
|
||||||
|
INSTANCE.width=width;
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.expvintl.mctoolsneo.events.item;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ItemStackTooltipEvent {
|
||||||
|
public static ItemStackTooltipEvent INSTANCE=new ItemStackTooltipEvent();
|
||||||
|
public ItemStack item;
|
||||||
|
public List<Component> textList;
|
||||||
|
|
||||||
|
public static ItemStackTooltipEvent get(ItemStack item,List<Component> list){
|
||||||
|
INSTANCE.item=item;
|
||||||
|
INSTANCE.textList=list;
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.expvintl.mctoolsneo.events.network;
|
||||||
|
|
||||||
|
import net.minecraft.network.protocol.Packet;
|
||||||
|
|
||||||
|
public class PacketReceiveEvent {
|
||||||
|
private static final PacketReceiveEvent INSTANCE=new PacketReceiveEvent();
|
||||||
|
public Packet<?> packet;
|
||||||
|
public static PacketReceiveEvent get(Packet<?> pack){
|
||||||
|
INSTANCE.packet=pack;
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.expvintl.mctoolsneo.events.network;
|
||||||
|
|
||||||
|
import net.minecraft.network.protocol.Packet;
|
||||||
|
|
||||||
|
public class PacketSendEvent {
|
||||||
|
private static final PacketSendEvent INSTANCE=new PacketSendEvent();
|
||||||
|
public Packet<?> packet;
|
||||||
|
public static PacketSendEvent get(Packet<?> pack){
|
||||||
|
INSTANCE.packet=pack;
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.expvintl.mctoolsneo.events.player;
|
||||||
|
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Direction;
|
||||||
|
|
||||||
|
public class PlayerAttackBlockEvent {
|
||||||
|
private static final PlayerAttackBlockEvent INSTANCE=new PlayerAttackBlockEvent();
|
||||||
|
public BlockPos blockPos;
|
||||||
|
public Direction direction;
|
||||||
|
public static PlayerAttackBlockEvent get(BlockPos blockPos, Direction direction){
|
||||||
|
INSTANCE.blockPos=blockPos;
|
||||||
|
INSTANCE.direction=direction;
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.expvintl.mctoolsneo.events.player;
|
||||||
|
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
|
||||||
|
public class PlayerAttackEntityEvent {
|
||||||
|
private static final PlayerAttackEntityEvent INSTANCE=new PlayerAttackEntityEvent();
|
||||||
|
public Player player;
|
||||||
|
public Entity target;
|
||||||
|
public static PlayerAttackEntityEvent get(Player playerEntity, Entity target){
|
||||||
|
INSTANCE.player=playerEntity;
|
||||||
|
INSTANCE.target=target;
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.expvintl.mctoolsneo.events.player;
|
||||||
|
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
public class PlayerBreakBlockEvent {
|
||||||
|
private static final PlayerBreakBlockEvent INSTANCE=new PlayerBreakBlockEvent();
|
||||||
|
public BlockPos pos;
|
||||||
|
|
||||||
|
public static PlayerBreakBlockEvent get(BlockPos blockPos){
|
||||||
|
INSTANCE.pos=blockPos;
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
}
|
75
src/main/java/com/expvintl/mctoolsneo/hud/MCInfo.java
Normal file
75
src/main/java/com/expvintl/mctoolsneo/hud/MCInfo.java
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
package com.expvintl.mctoolsneo.hud;
|
||||||
|
|
||||||
|
import com.expvintl.mctoolsneo.utils.DrawUtils;
|
||||||
|
import com.expvintl.mctoolsneo.utils.Utils;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.player.LocalPlayer;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
|
import net.neoforged.neoforge.client.event.RenderGuiEvent;
|
||||||
|
|
||||||
|
public class MCInfo {
|
||||||
|
private static String gameDayToRealTimeFormat(long gameDays) {
|
||||||
|
// 游戏 1 小时等于 20 分钟
|
||||||
|
long totalMinutes = gameDays * 20;
|
||||||
|
|
||||||
|
long days = totalMinutes / (60 * 24); // 计算天数
|
||||||
|
long remainingMinutesAfterDays = totalMinutes % (60 * 24);
|
||||||
|
|
||||||
|
long hours = remainingMinutesAfterDays / 60; // 计算小时数
|
||||||
|
long minutes = remainingMinutesAfterDays % 60; // 计算剩余分钟数
|
||||||
|
|
||||||
|
StringBuilder timeString = new StringBuilder();
|
||||||
|
|
||||||
|
if (days > 0) {
|
||||||
|
timeString.append(days).append(" 天");
|
||||||
|
}
|
||||||
|
if (hours > 0) {
|
||||||
|
if (!timeString.isEmpty()) {
|
||||||
|
timeString.append(" ");
|
||||||
|
}
|
||||||
|
timeString.append(hours).append(" 小时");
|
||||||
|
}
|
||||||
|
if (minutes > 0 || timeString.isEmpty()) {
|
||||||
|
if (!timeString.isEmpty()) {
|
||||||
|
timeString.append(" ");
|
||||||
|
}
|
||||||
|
timeString.append(minutes).append(" 分钟");
|
||||||
|
}
|
||||||
|
|
||||||
|
return timeString.toString();
|
||||||
|
}
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onDraw(RenderGuiEvent.Post event){
|
||||||
|
Minecraft mc=Minecraft.getInstance();
|
||||||
|
if(mc.getDebugOverlay().showDebugScreen()||mc.options.hideGui) return;
|
||||||
|
if(mc.level==null||mc.player==null) return;
|
||||||
|
DrawUtils.leftTextY =1;
|
||||||
|
int selfPing=0;
|
||||||
|
LocalPlayer p=mc.player;
|
||||||
|
if(p.connection.getPlayerInfo(mc.player.getGameProfile().getId())!=null){
|
||||||
|
selfPing=p.connection.getPlayerInfo(mc.player.getGameProfile().getId()).getLatency();
|
||||||
|
}
|
||||||
|
Vec3 playerPos=p.getPosition(0);
|
||||||
|
DrawUtils.AddLeftText(event.getGuiGraphics(),String.format("%d FPS",mc.getFps()));
|
||||||
|
DrawUtils.AddLeftText(event.getGuiGraphics(),String.format("Ping: %d 毫秒",selfPing));
|
||||||
|
DrawUtils.AddLeftText(event.getGuiGraphics(),String.format("亮度:%d",mc.level.getChunkSource().getLightEngine().getRawBrightness(mc.player.blockPosition(), 0)));
|
||||||
|
DrawUtils.AddLeftText(event.getGuiGraphics(),String.format("当前维度:%s", Utils.getCurrentDimensionName()));
|
||||||
|
DrawUtils.AddLeftText(event.getGuiGraphics(),String.format("当前群系:%s",Utils.getCurrentBiomeName()));
|
||||||
|
if(Utils.getCurrentDimensionName().equals("下界")){
|
||||||
|
DrawUtils.AddLeftText(event.getGuiGraphics(),String.format("X:%.2f Y:%.2f Z:%.2f (主世界 X:%.2f Z:%.2f)",playerPos.x,playerPos.y,playerPos.z,playerPos.x*8,playerPos.z*8));
|
||||||
|
}else if(Utils.getCurrentDimensionName().equals("主世界")){
|
||||||
|
DrawUtils.AddLeftText(event.getGuiGraphics(),String.format("X:%.2f Y:%.2f Z:%.2f (下界 X:%.2f Z:%.2f)",playerPos.x,playerPos.y,playerPos.z,playerPos.x/8,playerPos.z/8));
|
||||||
|
}else{
|
||||||
|
DrawUtils.AddLeftText(event.getGuiGraphics(),String.format("X:%.2f Y:%.2f Z:%.2f",playerPos.x,playerPos.y,playerPos.z));
|
||||||
|
}
|
||||||
|
DrawUtils.AddLeftText(event.getGuiGraphics(),String.format("世界时间: %d天 (%s)",mc.level.getDayTime()/24000,gameDayToRealTimeFormat(mc.level.dayTime()/24000)));
|
||||||
|
DrawUtils.AddLeftText(event.getGuiGraphics(),String.format("当前区块: [%d,%d]",mc.player.chunkPosition().x,mc.player.chunkPosition().z));
|
||||||
|
DrawUtils.AddLeftText(event.getGuiGraphics(),String.format("本地难度:%.2f",mc.level.getCurrentDifficultyAt(mc.player.blockPosition()).getEffectiveDifficulty()));
|
||||||
|
ItemStack currentItem=p.getInventory().player.getMainHandItem();
|
||||||
|
if(currentItem!=null&¤tItem.isDamageableItem()){
|
||||||
|
DrawUtils.AddLeftText(event.getGuiGraphics(),String.format("耐久度:%d/%d",currentItem.getMaxDamage()-currentItem.getDamageValue(),currentItem.getMaxDamage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
44
src/main/java/com/expvintl/mctoolsneo/hud/PotionInfo.java
Normal file
44
src/main/java/com/expvintl/mctoolsneo/hud/PotionInfo.java
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
package com.expvintl.mctoolsneo.hud;
|
||||||
|
|
||||||
|
|
||||||
|
import com.expvintl.mctoolsneo.utils.DrawUtils;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
|
import net.minecraft.client.resources.language.I18n;
|
||||||
|
import net.minecraft.world.effect.MobEffect;
|
||||||
|
import net.minecraft.world.effect.MobEffectInstance;
|
||||||
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
|
import net.neoforged.neoforge.client.event.RenderGuiEvent;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
public class PotionInfo {
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void drawHUD(RenderGuiEvent.Post drawContext) {
|
||||||
|
Minecraft mc=Minecraft.getInstance();
|
||||||
|
//跳过调试
|
||||||
|
if(mc.getDebugOverlay().showDebugScreen()||mc.options.hideGui) return;
|
||||||
|
|
||||||
|
if(mc.level!=null&&mc.player!=null) {
|
||||||
|
DrawUtils.rightBottomY=1;
|
||||||
|
Collection<MobEffectInstance> effects=mc.player.getActiveEffects();
|
||||||
|
for(MobEffectInstance instance:effects){
|
||||||
|
DrawUtils.AddRightBottomText(drawContext.getGuiGraphics(),String.format("%s%d (%s)", I18n.get(instance.getDescriptionId()),
|
||||||
|
instance.getAmplifier()+1,
|
||||||
|
instance.isInfiniteDuration()?"无限":formatPotionDuration(instance.getDuration())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static String formatPotionDuration(int ticks) {
|
||||||
|
int totalSeconds = ticks / 20; // 将ticks转换为秒
|
||||||
|
int hours = totalSeconds / 3600; // 1小时 = 3600秒
|
||||||
|
int minutes = (totalSeconds % 3600) / 60; // 获取剩余的分钟
|
||||||
|
int seconds = totalSeconds % 60; // 获取剩余的秒数
|
||||||
|
|
||||||
|
if (hours > 0) {
|
||||||
|
return String.format("%d:%02d:%02d", hours, minutes, seconds);
|
||||||
|
} else {
|
||||||
|
return String.format("%02d:%02d", minutes, seconds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.expvintl.mctoolsneo.mixin.hud;
|
||||||
|
|
||||||
|
import com.expvintl.mctoolsneo.utils.DrawUtils;
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyReceiver;
|
||||||
|
import com.llamalad7.mixinextras.sugar.Local;
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
import net.minecraft.client.GuiMessage;
|
||||||
|
import net.minecraft.client.gui.Font;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
|
import net.minecraft.client.gui.components.ChatComponent;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.util.FormattedCharSequence;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
|
@Mixin(ChatComponent.class)
|
||||||
|
public class ChatHudMixin {
|
||||||
|
//聊天头像
|
||||||
|
@ModifyReceiver(method = "render",at=@At(value = "INVOKE",target = "Lnet/minecraft/client/gui/GuiGraphics;drawString(Lnet/minecraft/client/gui/Font;Lnet/minecraft/util/FormattedCharSequence;III)I"))
|
||||||
|
private GuiGraphics onRenderDrawTextWithShadow(GuiGraphics instance, Font pFont, FormattedCharSequence pText, int pX, int pY, int pColor, @Local GuiMessage.Line line){
|
||||||
|
RenderSystem.enableBlend();
|
||||||
|
RenderSystem.setShaderColor(1,1,1,((pColor >> 24) & 0x000000FF)/255f);
|
||||||
|
DrawUtils.DrawHeadIcon(instance,line,pY);
|
||||||
|
RenderSystem.setShaderColor(1,1,1,1);
|
||||||
|
RenderSystem.disableBlend();
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.expvintl.mctoolsneo.mixin.hud;
|
||||||
|
|
||||||
|
import com.expvintl.mctoolsneo.events.MCEventBus;
|
||||||
|
import com.expvintl.mctoolsneo.events.hud.RenderLatencyIconEvent;
|
||||||
|
import com.expvintl.mctoolsneo.utils.Utils;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
|
import net.minecraft.client.gui.components.PlayerTabOverlay;
|
||||||
|
import net.minecraft.client.multiplayer.PlayerInfo;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
@Mixin(PlayerTabOverlay.class)
|
||||||
|
public class PlayerListHudMixin {
|
||||||
|
@ModifyArg(method = "render",at=@At(value = "INVOKE",target = "Ljava/lang/Math;min(II)I"),index = 0)
|
||||||
|
private int fixWidth(int width){
|
||||||
|
return width+25;
|
||||||
|
}
|
||||||
|
@Inject(method = "getNameForDisplay",at=@At("HEAD"),cancellable = true)
|
||||||
|
private void getPlayerName(PlayerInfo info, CallbackInfoReturnable<Component> cir){
|
||||||
|
if(Utils.isReady()){
|
||||||
|
Component name=info.getTabListDisplayName();
|
||||||
|
if(Minecraft.getInstance().player==null||name==null) return;
|
||||||
|
if(info.getProfile().getId().toString().equals(Minecraft.getInstance().player.getGameProfile().getId().toString())){
|
||||||
|
cir.setReturnValue(Component.literal(name.getString()).setStyle(name.getStyle().withColor(0xff0000)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "renderPingIcon",at=@At("HEAD"),cancellable = true)
|
||||||
|
private void onRenderLatencyIcon(GuiGraphics pGuiGraphics, int pWidth, int pX, int pY, PlayerInfo pPlayerInfo, CallbackInfo ci){
|
||||||
|
MCEventBus.INSTANCE.post(RenderLatencyIconEvent.get(pGuiGraphics,pWidth,pX,pY,pPlayerInfo,ci));
|
||||||
|
}
|
||||||
|
|
||||||
|
//强制离线Tab显示头像
|
||||||
|
@ModifyVariable(method = "render",at = @At(value = "STORE",ordinal = 0),ordinal = 0)
|
||||||
|
private boolean hackShowPlayerHeadIcon(boolean b1){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.expvintl.mctoolsneo.mixin.interfaces;
|
||||||
|
|
||||||
|
import net.minecraft.client.multiplayer.MultiPlayerGameMode;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
|
|
||||||
|
@Mixin(MultiPlayerGameMode.class)
|
||||||
|
public interface ClientPlayerInteractionManagerAccessor {
|
||||||
|
@Invoker("ensureHasSentCarriedItem")
|
||||||
|
void syncSelectedSlot();
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.expvintl.mctoolsneo.mixin.interfaces;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
|
|
||||||
|
@Mixin(Minecraft.class)
|
||||||
|
public interface MinecraftClientAccessor {
|
||||||
|
@Invoker("startUseItem")
|
||||||
|
void doItemUse();
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.expvintl.mctoolsneo.mixin.interfaces;
|
||||||
|
|
||||||
|
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Mutable;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
@Mixin(ServerboundMovePlayerPacket.class)
|
||||||
|
public interface PlayerMoveC2SPacketAccessor {
|
||||||
|
@Mutable
|
||||||
|
@Accessor("y")
|
||||||
|
void setY(double y);
|
||||||
|
|
||||||
|
@Mutable
|
||||||
|
@Accessor("onGround")
|
||||||
|
void setOnGround(boolean ground);
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.expvintl.mctoolsneo.mixin.interfaces;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.client.OptionInstance;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
@Mixin(OptionInstance.class)
|
||||||
|
public interface SimpleOptionAccessor {
|
||||||
|
@Accessor("value")
|
||||||
|
<T> void forceSetValue(T value);
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.expvintl.mctoolsneo.mixin.player;
|
||||||
|
|
||||||
|
import com.expvintl.mctoolsneo.events.MCEventBus;
|
||||||
|
import com.expvintl.mctoolsneo.events.player.PlayerAttackBlockEvent;
|
||||||
|
import com.expvintl.mctoolsneo.events.player.PlayerAttackEntityEvent;
|
||||||
|
import com.expvintl.mctoolsneo.events.player.PlayerBreakBlockEvent;
|
||||||
|
import net.minecraft.client.multiplayer.MultiPlayerGameMode;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Direction;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
@Mixin(MultiPlayerGameMode.class)
|
||||||
|
public class ClientPlayerInteractionManagerMixin {
|
||||||
|
@Inject(method = "destroyBlock",at=@At("HEAD"))
|
||||||
|
private void breakBlock(BlockPos pPos, CallbackInfoReturnable<Boolean> cir){
|
||||||
|
MCEventBus.INSTANCE.post(PlayerBreakBlockEvent.get(pPos));
|
||||||
|
}
|
||||||
|
@Inject(method = "startDestroyBlock",at=@At("HEAD"))
|
||||||
|
private void onAttackBlock(BlockPos pLoc, Direction pFace, CallbackInfoReturnable<Boolean> cir){
|
||||||
|
MCEventBus.INSTANCE.post(PlayerAttackBlockEvent.get(pLoc,pFace));
|
||||||
|
}
|
||||||
|
@Inject(method = "attack",at=@At("HEAD"))
|
||||||
|
private void onAttackEntity(Player pPlayer, Entity pTargetEntity, CallbackInfo ci){
|
||||||
|
MCEventBus.INSTANCE.post(PlayerAttackEntityEvent.get(pPlayer,pTargetEntity));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.expvintl.mctoolsneo.modules;
|
||||||
|
|
||||||
|
import com.expvintl.mctoolsneo.events.MCEventBus;
|
||||||
|
import com.expvintl.mctoolsneo.events.hud.RenderLatencyIconEvent;
|
||||||
|
import com.google.common.eventbus.Subscribe;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.Font;
|
||||||
|
|
||||||
|
public class PlayerListTextLatency {
|
||||||
|
public static PlayerListTextLatency INSTANCE=new PlayerListTextLatency();
|
||||||
|
public void init(){
|
||||||
|
MCEventBus.INSTANCE.register(INSTANCE);
|
||||||
|
}
|
||||||
|
private int calcLatencyColor(int latency){
|
||||||
|
if(latency>=0&&latency<=60){ //0-60
|
||||||
|
return 0x00FF00; //绿色
|
||||||
|
}else if(latency>60&&latency<=120){ //60-120
|
||||||
|
return 0xFFFF00; //黄色
|
||||||
|
}else if(latency>120&&latency<=200){//120-200
|
||||||
|
return 0xFFA500; //橙色
|
||||||
|
}else if(latency>200){ //>200
|
||||||
|
return 0xFF0000; //红色
|
||||||
|
}
|
||||||
|
return 0xFFFFFF; //默认白色
|
||||||
|
}
|
||||||
|
@Subscribe
|
||||||
|
public void onRenderLatencyIcon(RenderLatencyIconEvent event){
|
||||||
|
Font renderer= Minecraft.getInstance().font;
|
||||||
|
int latency=Math.clamp(event.entry.getLatency(),0,999);
|
||||||
|
String text=latency+" ms";
|
||||||
|
event.draw.drawString(renderer,text, event.x+event.width-renderer.width(text),event.y,calcLatencyColor(latency));
|
||||||
|
event.callback.cancel();
|
||||||
|
}
|
||||||
|
}
|
11
src/main/java/com/expvintl/mctoolsneo/types/Setting.java
Normal file
11
src/main/java/com/expvintl/mctoolsneo/types/Setting.java
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package com.expvintl.mctoolsneo.types;
|
||||||
|
|
||||||
|
public class Setting {
|
||||||
|
public boolean value=false;
|
||||||
|
public boolean get(){
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
public void set(boolean value){
|
||||||
|
this.value=value;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.expvintl.mctoolsneo.utils;
|
||||||
|
|
||||||
|
import com.expvintl.mctoolsneo.types.Setting;
|
||||||
|
import com.mojang.brigadier.Command;
|
||||||
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
|
||||||
|
import static net.minecraft.commands.Commands.literal;
|
||||||
|
|
||||||
|
public class CommandUtils {
|
||||||
|
public static void CreateStatusCommand(String cmd, Setting toggle, CommandDispatcher<CommandSourceStack> dispatcher){
|
||||||
|
dispatcher.register(literal(cmd).executes((context -> {
|
||||||
|
context.getSource().source.sendSystemMessage(Component.literal("当前启用状态: "+toggle.get()));
|
||||||
|
return Command.SINGLE_SUCCESS;
|
||||||
|
})));
|
||||||
|
}
|
||||||
|
}
|
51
src/main/java/com/expvintl/mctoolsneo/utils/DrawUtils.java
Normal file
51
src/main/java/com/expvintl/mctoolsneo/utils/DrawUtils.java
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
package com.expvintl.mctoolsneo.utils;
|
||||||
|
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import net.minecraft.client.GuiMessage;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
|
import net.minecraft.client.gui.components.ChatComponent;
|
||||||
|
import net.minecraft.client.multiplayer.PlayerInfo;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
||||||
|
import static com.expvintl.mctoolsneo.utils.Utils.getChatSender;
|
||||||
|
|
||||||
|
public class DrawUtils {
|
||||||
|
public static int leftTextY=1;
|
||||||
|
public static int rightTextY=1;
|
||||||
|
public static int rightBottomY=1;
|
||||||
|
public static void AddLeftText(GuiGraphics drawContext, String text){
|
||||||
|
Minecraft mc=Minecraft.getInstance();
|
||||||
|
drawContext.drawString(mc.font,text,0,leftTextY, 0xffffff,false);
|
||||||
|
leftTextY+=10;
|
||||||
|
}
|
||||||
|
public static void AddRightText(GuiGraphics drawContext, String text){
|
||||||
|
Minecraft mc=Minecraft.getInstance();
|
||||||
|
drawContext.drawString(mc.font,text,drawContext.guiWidth()-2-mc.font.width(text),rightTextY, 0xffffff,false);
|
||||||
|
rightTextY+=10;
|
||||||
|
}
|
||||||
|
public static void AddRightBottomText(GuiGraphics drawContext, String text){
|
||||||
|
Minecraft mc=Minecraft.getInstance();
|
||||||
|
drawContext.drawString(mc.font,text,drawContext.guiWidth()-2-mc.font.width(text),drawContext.guiHeight()-10-rightBottomY, 0xffffff,false);
|
||||||
|
rightBottomY+=10;
|
||||||
|
}
|
||||||
|
public static void DrawHeadIcon(GuiGraphics draw, GuiMessage.Line text, int y){
|
||||||
|
StringBuffer buf=new StringBuffer();
|
||||||
|
Minecraft mc=Minecraft.getInstance();
|
||||||
|
text.content().accept((idx,style,codePoint)->{
|
||||||
|
buf.appendCodePoint(codePoint);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
String txt=buf.toString();
|
||||||
|
GameProfile sender=getChatSender(txt);
|
||||||
|
if(sender==null) return;
|
||||||
|
PlayerInfo entry = mc.getConnection().getPlayerInfo(sender.getId());
|
||||||
|
if (entry == null) return;
|
||||||
|
|
||||||
|
ResourceLocation skin = entry.getSkin().texture();
|
||||||
|
|
||||||
|
draw.blit(skin, 0, y, 8, 8, 8, 8, 8, 8, 64, 64);
|
||||||
|
draw.blit(skin, 0, y, 8, 8, 40, 8, 8, 8, 64, 64);
|
||||||
|
draw.pose().translate(10, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
203
src/main/java/com/expvintl/mctoolsneo/utils/Utils.java
Normal file
203
src/main/java/com/expvintl/mctoolsneo/utils/Utils.java
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
package com.expvintl.mctoolsneo.utils;
|
||||||
|
|
||||||
|
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.multiplayer.PlayerInfo;
|
||||||
|
import net.minecraft.core.Holder;
|
||||||
|
import net.minecraft.core.RegistryAccess;
|
||||||
|
import net.minecraft.resources.ResourceKey;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.Items;
|
||||||
|
import net.minecraft.world.item.enchantment.Enchantment;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public class Utils {
|
||||||
|
private static final Minecraft mc = Minecraft.getInstance();
|
||||||
|
private static final Pattern usernameRegex = Pattern.compile("^(?:<[0-9]{2}:[0-9]{2}>\\s)?<(.*?)>.*");
|
||||||
|
|
||||||
|
public static String getCurrentDimensionName() {
|
||||||
|
if (mc.level != null) {
|
||||||
|
String dismenName = mc.level.dimension().location().toString();
|
||||||
|
switch (dismenName) {
|
||||||
|
case "minecraft:overworld":
|
||||||
|
return "主世界";
|
||||||
|
case "minecraft:the_nether":
|
||||||
|
return "下界";
|
||||||
|
case "minecraft:the_end":
|
||||||
|
return "末地";
|
||||||
|
default:
|
||||||
|
return dismenName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "未知";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getCurrentBiomeName() {
|
||||||
|
if (Objects.nonNull(mc.level) && Objects.nonNull(mc.player)) {
|
||||||
|
String name = mc.level.getBiome(mc.player.blockPosition()).getRegisteredName();
|
||||||
|
switch (name) {
|
||||||
|
case "minecraft:badlands":
|
||||||
|
return "恶地 (badlands)";
|
||||||
|
case "minecraft:bamboo_jungle":
|
||||||
|
return "竹林 (bamboo_jungle)";
|
||||||
|
case "minecraft:basalt_deltas":
|
||||||
|
return "玄武岩三角洲 (basalt_deltas)";
|
||||||
|
case "minecraft:beach":
|
||||||
|
return "沙滩 (beach)";
|
||||||
|
case "minecraft:ocean":
|
||||||
|
return "海洋 (ocean)";
|
||||||
|
case "minecraft:plains":
|
||||||
|
return "平原 (plains)";
|
||||||
|
case "minecraft:river":
|
||||||
|
return "河流 (river)";
|
||||||
|
case "minecraft:birch_forest":
|
||||||
|
return "桦木森林 (birch_forest)";
|
||||||
|
case "minecraft:cherry_grove":
|
||||||
|
return "樱花树林 (cherry_grove)";
|
||||||
|
case "minecraft:cold_ocean":
|
||||||
|
return "冷水海洋 (cold_ocean)";
|
||||||
|
case "minecraft:crimson_forest":
|
||||||
|
return "绯红森林 (crimson_forest)";
|
||||||
|
case "minecraft:dark_forest":
|
||||||
|
return "黑森林 (dark_forest)";
|
||||||
|
case "minecraft:deep_cold_ocean":
|
||||||
|
return "冷水深海 (deep_cold_ocean)";
|
||||||
|
case "minecraft:deep_dark":
|
||||||
|
return "深暗之域 (deep_dark)";
|
||||||
|
case "minecraft:deep_frozen_ocean":
|
||||||
|
return "冰冻深海 (deep_frozen_ocean)";
|
||||||
|
case "minecraft:deep_lukewarm_ocean":
|
||||||
|
return "温水深海 (deep_lukewarm_ocean)";
|
||||||
|
case "minecraft:deep_ocean":
|
||||||
|
return "深海 (deep_ocean)";
|
||||||
|
case "minecraft:desert":
|
||||||
|
return "沙漠 (desert)";
|
||||||
|
case "minecraft:dripstone_caves":
|
||||||
|
return "溶洞 (dripstone_caves)";
|
||||||
|
case "minecraft:end_barrens":
|
||||||
|
return "末地荒地 (end_barrens)";
|
||||||
|
case "minecraft:end_highlands":
|
||||||
|
return "末地高地 (end_highlands)";
|
||||||
|
case "minecraft:eroded_badlands":
|
||||||
|
return "风蚀恶地 (eroded_badlands)";
|
||||||
|
case "minecraft:flower_forest":
|
||||||
|
return "繁花森林 (flower_forest)";
|
||||||
|
case "minecraft:forest":
|
||||||
|
return "森林 (forest)";
|
||||||
|
case "minecraft:frozen_ocean":
|
||||||
|
return "冻洋 (frozen_ocean)";
|
||||||
|
case "minecraft:frozen_peaks":
|
||||||
|
return "冰封山峰 (frozen_peaks)";
|
||||||
|
case "minecraft:frozen_river":
|
||||||
|
return "冻河 (frozen_river)";
|
||||||
|
case "minecraft:grove":
|
||||||
|
return "雪林 (grove)";
|
||||||
|
case "minecraft:ice_spikes":
|
||||||
|
return "冰刺之地 (ice_spikes)";
|
||||||
|
case "minecraft:jagged_peaks":
|
||||||
|
return "尖峭山峰 (jagged_peaks)";
|
||||||
|
case "minecraft:jungle":
|
||||||
|
return "丛林 (jungle)";
|
||||||
|
case "minecraft:lukewarm_ocean":
|
||||||
|
return "温水海洋 (lukewarm_ocean)";
|
||||||
|
case "minecraft:lush_caves":
|
||||||
|
return "繁茂洞穴 (lush_caves)";
|
||||||
|
case "minecraft:mangrove_swamp":
|
||||||
|
return "红树林沼泽 (mangrove_swamp)";
|
||||||
|
case "minecraft:meadow":
|
||||||
|
return "草甸 (meadow)";
|
||||||
|
case "minecraft:mushroom_fields":
|
||||||
|
return "蘑菇岛 (mushroom_fields)";
|
||||||
|
case "minecraft:nether_wastes":
|
||||||
|
return "下界荒地 (nether_wastes)";
|
||||||
|
case "minecraft:old_growth_birch_forest":
|
||||||
|
return "原始桦木森林 (old_growth_birch_forest)";
|
||||||
|
case "minecraft:old_growth_pine_taiga":
|
||||||
|
return "原始松木针叶林 (old_growth_pine_taiga)";
|
||||||
|
case "minecraft:old_growth_spruce_taiga":
|
||||||
|
return "原始云杉针叶林 (old_growth_spruce_taiga)";
|
||||||
|
case "minecraft:savanna":
|
||||||
|
return "热带草原 (savanna)";
|
||||||
|
case "minecraft:savanna_plateau":
|
||||||
|
return "热带高原 (savanna_plateau)";
|
||||||
|
case "minecraft:small_end_islands":
|
||||||
|
return "末地小型岛屿 (small_end_islands)";
|
||||||
|
case "minecraft:snowy_beach":
|
||||||
|
return "积雪沙滩 (snowy_beach)";
|
||||||
|
case "minecraft:snowy_plains":
|
||||||
|
return "雪原 (snowy_plains)";
|
||||||
|
case "minecraft:snowy_slopes":
|
||||||
|
return "积雪山坡 (snowy_slopes)";
|
||||||
|
case "minecraft:snowy_taiga":
|
||||||
|
return "积雪针叶林 (snowy_taiga)";
|
||||||
|
case "minecraft:soul_sand_valley":
|
||||||
|
return "灵魂沙峡谷 (soul_sand_valley)";
|
||||||
|
case "minecraft:sparse_jungle":
|
||||||
|
return "稀疏丛林 (sparse_jungle)";
|
||||||
|
case "minecraft:stony_peaks":
|
||||||
|
return "裸岩山峰 (stony_peaks)";
|
||||||
|
case "minecraft:stony_shore":
|
||||||
|
return "石岸 (stony_shore)";
|
||||||
|
case "minecraft:sunflower_plains":
|
||||||
|
return "向日葵平原 (sunflower_plains)";
|
||||||
|
case "minecraft:swamp":
|
||||||
|
return "沼泽 (swamp)";
|
||||||
|
case "minecraft:taiga":
|
||||||
|
return "针叶林 (taiga)";
|
||||||
|
case "minecraft:the_end":
|
||||||
|
return "末地 (the_end)";
|
||||||
|
case "minecraft:the_void":
|
||||||
|
return "虚空 (the_void)";
|
||||||
|
case "minecraft:warm_ocean":
|
||||||
|
return "暖水海洋 (warm_ocean)";
|
||||||
|
case "minecraft:warped_forest":
|
||||||
|
return "诡异森林 (warped_forest)";
|
||||||
|
case "minecraft:windswept_forest":
|
||||||
|
return "风袭森林 (windswept_forest)";
|
||||||
|
case "minecraft:windswept_gravelly_hills":
|
||||||
|
return "风袭沙砾丘陵 (windswept_gravelly_hills)";
|
||||||
|
case "minecraft:windswept_hills":
|
||||||
|
return "风袭丘陵 (windswept_hills)";
|
||||||
|
case "minecraft:windswept_savanna":
|
||||||
|
return "风袭热带草原 (windswept_savanna)";
|
||||||
|
case "minecraft:wooded_badlands":
|
||||||
|
return "疏林恶地 (wooded_badlands)";
|
||||||
|
default:
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "未知";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GameProfile getChatSender(String text){
|
||||||
|
Matcher usernameMatcher=usernameRegex.matcher(text);
|
||||||
|
if(usernameMatcher.matches()){
|
||||||
|
String username=usernameMatcher.group(1);
|
||||||
|
PlayerInfo entry=mc.getConnection().getPlayerInfo(username);
|
||||||
|
if(entry!=null) return entry.getProfile();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public static boolean isReady(){
|
||||||
|
Minecraft cli=Minecraft.getInstance();
|
||||||
|
return cli.level!=null&&cli.player!=null;
|
||||||
|
}
|
||||||
|
public static int GetEnchantLevel(Enchantment enchantName, ItemStack item){
|
||||||
|
//跳过附魔书
|
||||||
|
if(item.getItem()== Items.ENCHANTED_BOOK) return 0;
|
||||||
|
Set<Object2IntMap.Entry<Holder<Enchantment>>> enchants=item.getEnchantments().entrySet();
|
||||||
|
for(Object2IntMap.Entry<Holder<Enchantment>> entry:enchants){
|
||||||
|
//返回找到的附魔等级
|
||||||
|
if(entry.getKey().value()==enchantName) {
|
||||||
|
return entry.getIntValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
95
src/main/resources/META-INF/neoforge.mods.toml
Normal file
95
src/main/resources/META-INF/neoforge.mods.toml
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
|
||||||
|
modLoader="javafml" #mandatory
|
||||||
|
|
||||||
|
loaderVersion="${loader_version_range}" #mandatory
|
||||||
|
|
||||||
|
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
|
||||||
|
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
|
||||||
|
license="${mod_license}"
|
||||||
|
|
||||||
|
# A URL to refer people to when problems occur with this mod
|
||||||
|
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
|
||||||
|
[[mixins]]
|
||||||
|
config = "mctools.mixins.json"
|
||||||
|
# A list of mods - how many allowed here is determined by the individual mod loader
|
||||||
|
[[mods]] #mandatory
|
||||||
|
|
||||||
|
# The modid of the mod
|
||||||
|
modId="${mod_id}" #mandatory
|
||||||
|
|
||||||
|
# The version number of the mod
|
||||||
|
version="${mod_version}" #mandatory
|
||||||
|
|
||||||
|
# A display name for the mod
|
||||||
|
displayName="${mod_name}" #mandatory
|
||||||
|
|
||||||
|
# A URL to query for updates for this mod. See the JSON update specification https://docs.neoforged.net/docs/misc/updatechecker/
|
||||||
|
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
|
||||||
|
|
||||||
|
# A URL for the "homepage" for this mod, displayed in the mod UI
|
||||||
|
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
|
||||||
|
|
||||||
|
# A file name (in the root of the mod JAR) containing a logo for display
|
||||||
|
#logoFile="examplemod.png" #optional
|
||||||
|
|
||||||
|
# A text field displayed in the mod UI
|
||||||
|
#credits="" #optional
|
||||||
|
|
||||||
|
# A text field displayed in the mod UI
|
||||||
|
authors="${mod_authors}" #optional
|
||||||
|
|
||||||
|
# Display Test controls the display for your mod in the server connection screen
|
||||||
|
# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod.
|
||||||
|
# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod.
|
||||||
|
# IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component.
|
||||||
|
# NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value.
|
||||||
|
# IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself.
|
||||||
|
#displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional)
|
||||||
|
|
||||||
|
# The description text for the mod (multi line!) (#mandatory)
|
||||||
|
description='''${mod_description}'''
|
||||||
|
|
||||||
|
# The [[mixins]] block allows you to declare your mixin config to FML so that it gets loaded.
|
||||||
|
#[[mixins]]
|
||||||
|
#config="${mod_id}.mixins.json"
|
||||||
|
|
||||||
|
# The [[accessTransformers]] block allows you to declare where your AT file is.
|
||||||
|
# If this block is omitted, a fallback attempt will be made to load an AT from META-INF/accesstransformer.cfg
|
||||||
|
#[[accessTransformers]]
|
||||||
|
#file="META-INF/accesstransformer.cfg"
|
||||||
|
|
||||||
|
# The coremods config file path is not configurable and is always loaded from META-INF/coremods.json
|
||||||
|
|
||||||
|
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
|
||||||
|
[[dependencies.${mod_id}]] #optional
|
||||||
|
# the modid of the dependency
|
||||||
|
modId="neoforge" #mandatory
|
||||||
|
# The type of the dependency. Can be one of "required", "optional", "incompatible" or "discouraged" (case insensitive).
|
||||||
|
# 'required' requires the mod to exist, 'optional' does not
|
||||||
|
# 'incompatible' will prevent the game from loading when the mod exists, and 'discouraged' will show a warning
|
||||||
|
type="required" #mandatory
|
||||||
|
# Optional field describing why the dependency is required or why it is incompatible
|
||||||
|
# reason="..."
|
||||||
|
# The version range of the dependency
|
||||||
|
versionRange="${neo_version_range}" #mandatory
|
||||||
|
# An ordering relationship for the dependency.
|
||||||
|
# BEFORE - This mod is loaded BEFORE the dependency
|
||||||
|
# AFTER - This mod is loaded AFTER the dependency
|
||||||
|
ordering="NONE"
|
||||||
|
# Side this dependency is applied on - BOTH, CLIENT, or SERVER
|
||||||
|
side="BOTH"
|
||||||
|
|
||||||
|
# Here's another dependency
|
||||||
|
[[dependencies.${mod_id}]]
|
||||||
|
modId="minecraft"
|
||||||
|
type="required"
|
||||||
|
# This version range declares a minimum of the current minecraft version up to but not including the next major version
|
||||||
|
versionRange="${minecraft_version_range}"
|
||||||
|
ordering="NONE"
|
||||||
|
side="BOTH"
|
||||||
|
|
||||||
|
# Features are specific properties of the game environment, that you may want to declare you require. This example declares
|
||||||
|
# that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't
|
||||||
|
# stop your mod loading on the server for example.
|
||||||
|
#[features.${mod_id}]
|
||||||
|
#openGLVersion="[3.2,)"
|
19
src/main/resources/mctools.mixins.json
Normal file
19
src/main/resources/mctools.mixins.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"required": true,
|
||||||
|
"minVersion": "0.8",
|
||||||
|
"package": "com.expvintl.mctoolsneo.mixin",
|
||||||
|
"compatibilityLevel": "JAVA_21",
|
||||||
|
"mixins": [
|
||||||
|
"hud.PlayerListHudMixin",
|
||||||
|
"interfaces.PlayerMoveC2SPacketAccessor"
|
||||||
|
],
|
||||||
|
"client": [
|
||||||
|
"hud.ChatHudMixin",
|
||||||
|
"interfaces.ClientPlayerInteractionManagerAccessor",
|
||||||
|
"interfaces.SimpleOptionAccessor",
|
||||||
|
"player.ClientPlayerInteractionManagerMixin"
|
||||||
|
],
|
||||||
|
"injectors": {
|
||||||
|
"defaultRequire": 1
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user