Compare commits
19 Commits
daaa80eed3
...
1.20.4
Author | SHA1 | Date | |
---|---|---|---|
4b9ffc3600 | |||
0c00184c92 | |||
b79d28ac4f | |||
470e79e3bd | |||
d8c271b246 | |||
57d5c7ebe9 | |||
f68046edae | |||
987edc2250 | |||
2b9d2b60cf | |||
e4b2ca67d7 | |||
1d6b3db118 | |||
5a613de1a9 | |||
07a266d928 | |||
20131e4879 | |||
3be8c26d60 | |||
0947bc0675 | |||
694fa42ce7 | |||
3e69fb7512 | |||
2d360b24f1 |
27
.github/workflows/ci_build.yml
vendored
Normal file
27
.github/workflows/ci_build.yml
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
name: Build
|
||||||
|
|
||||||
|
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.jar
|
||||||
|
path: build/libs/MCTools-1.0.jar
|
||||||
|
retention-days: 16
|
Binary file not shown.
@ -1,2 +0,0 @@
|
|||||||
#Mon Jul 29 23:26:49 HKT 2024
|
|
||||||
gradle.version=8.6
|
|
Binary file not shown.
Binary file not shown.
@ -1,11 +0,0 @@
|
|||||||
commonProperties
|
|
||||||
fabric.development=true
|
|
||||||
fabric.remapClasspathFile=D:\MinecraftProjects\MCTools\.gradle\loom-cache\remapClasspath.txt
|
|
||||||
log4j.configurationFile=D:\MinecraftProjects\MCTools\.gradle\loom-cache\log4j.xml
|
|
||||||
log4j2.formatMsgNoLookups=true
|
|
||||||
fabric.log.disableAnsi=false
|
|
||||||
clientArgs
|
|
||||||
--assetIndex
|
|
||||||
1.21-17
|
|
||||||
--assetsDir
|
|
||||||
C:\Users\expvintl\.gradle\caches\fabric-loom\assets
|
|
@ -1,68 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Configuration status="WARN" packages="com.mojang.util,net.minecrell.terminalconsole.util">
|
|
||||||
<Appenders>
|
|
||||||
|
|
||||||
<!-- System out -->
|
|
||||||
<Console name="SysOut" target="SYSTEM_OUT">
|
|
||||||
<!-- Filter out the authentication errors when starting in development -->
|
|
||||||
<Filters>
|
|
||||||
<RegexFilter regex="^Failed to verify authentication$" onMatch="DENY" onMismatch="NEUTRAL"/>
|
|
||||||
<RegexFilter regex="^Failed to fetch user properties$" onMatch="DENY" onMismatch="NEUTRAL"/>
|
|
||||||
<RegexFilter regex="^Couldn't connect to realms$" onMatch="DENY" onMismatch="NEUTRAL"/>
|
|
||||||
</Filters>
|
|
||||||
<PatternLayout>
|
|
||||||
<LoggerNamePatternSelector defaultPattern="%style{[%d{HH:mm:ss}]}{blue} %highlight{[%t/%level]}{FATAL=red, ERROR=red, WARN=yellow, INFO=green, DEBUG=green, TRACE=blue} %style{(%logger{1})}{cyan} %highlight{%msg%n}{FATAL=red, ERROR=red, WARN=normal, INFO=normal, DEBUG=normal, TRACE=normal}" disableAnsi="${sys:fabric.log.disableAnsi:-true}">
|
|
||||||
<!-- Dont show the logger name for minecraft classes-->
|
|
||||||
<PatternMatch key="net.minecraft.,com.mojang." pattern="%style{[%d{HH:mm:ss}]}{blue} %highlight{[%t/%level]}{FATAL=red, ERROR=red, WARN=yellow, INFO=green, DEBUG=green, TRACE=blue} %style{(Minecraft)}{cyan} %highlight{%msg{nolookups}%n}{FATAL=red, ERROR=red, WARN=normal, INFO=normal, DEBUG=normal, TRACE=normal}"/>
|
|
||||||
</LoggerNamePatternSelector>
|
|
||||||
</PatternLayout>
|
|
||||||
</Console>
|
|
||||||
|
|
||||||
<!-- Vanilla server gui -->
|
|
||||||
<Queue name="ServerGuiConsole" ignoreExceptions="true">
|
|
||||||
<PatternLayout>
|
|
||||||
<LoggerNamePatternSelector defaultPattern="[%d{HH:mm:ss} %level] (%logger{1}) %msg{nolookups}%n">
|
|
||||||
<!-- Dont show the logger name for minecraft classes-->
|
|
||||||
<PatternMatch key="net.minecraft.,com.mojang." pattern="[%d{HH:mm:ss} %level] %msg{nolookups}%n"/>
|
|
||||||
</LoggerNamePatternSelector>
|
|
||||||
</PatternLayout>
|
|
||||||
</Queue>
|
|
||||||
|
|
||||||
<!-- latest.log same as vanilla -->
|
|
||||||
<RollingRandomAccessFile name="LatestFile" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
|
|
||||||
<PatternLayout>
|
|
||||||
<LoggerNamePatternSelector defaultPattern="[%d{HH:mm:ss}] [%t/%level] (%logger{1}) %msg{nolookups}%n">
|
|
||||||
<!-- Dont show the logger name for minecraft classes-->
|
|
||||||
<PatternMatch key="net.minecraft.,com.mojang." pattern="[%d{HH:mm:ss}] [%t/%level] (Minecraft) %msg{nolookups}%n"/>
|
|
||||||
</LoggerNamePatternSelector>
|
|
||||||
</PatternLayout>
|
|
||||||
<Policies>
|
|
||||||
<TimeBasedTriggeringPolicy />
|
|
||||||
<OnStartupTriggeringPolicy />
|
|
||||||
</Policies>
|
|
||||||
</RollingRandomAccessFile>
|
|
||||||
|
|
||||||
<!-- Debug log file -->
|
|
||||||
<RollingRandomAccessFile name="DebugFile" fileName="logs/debug.log" filePattern="logs/debug-%i.log.gz">
|
|
||||||
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level] (%logger) %msg{nolookups}%n" />
|
|
||||||
|
|
||||||
<!-- Keep 5 files max -->
|
|
||||||
<DefaultRolloverStrategy max="5" fileIndex="min"/>
|
|
||||||
|
|
||||||
<Policies>
|
|
||||||
<SizeBasedTriggeringPolicy size="200MB"/>
|
|
||||||
<OnStartupTriggeringPolicy />
|
|
||||||
</Policies>
|
|
||||||
|
|
||||||
</RollingRandomAccessFile>
|
|
||||||
</Appenders>
|
|
||||||
<Loggers>
|
|
||||||
<Logger level="${sys:fabric.log.level:-info}" name="net.minecraft"/>
|
|
||||||
<Root level="all">
|
|
||||||
<AppenderRef ref="DebugFile" level="${sys:fabric.log.debug.level:-debug}"/>
|
|
||||||
<AppenderRef ref="SysOut" level="${sys:fabric.log.level:-info}"/>
|
|
||||||
<AppenderRef ref="LatestFile" level="${sys:fabric.log.level:-info}"/>
|
|
||||||
<AppenderRef ref="ServerGuiConsole" level="${sys:fabric.log.level:-info}"/>
|
|
||||||
</Root>
|
|
||||||
</Loggers>
|
|
||||||
</Configuration>
|
|
File diff suppressed because one or more lines are too long
2
.idea/compiler.xml
generated
2
.idea/compiler.xml
generated
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="CompilerConfiguration">
|
<component name="CompilerConfiguration">
|
||||||
<bytecodeTargetLevel target="17" />
|
<bytecodeTargetLevel target="21" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
3
.idea/misc.xml
generated
3
.idea/misc.xml
generated
@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="liberica-21" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="liberica-21" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
8
.idea/modules.xml
generated
8
.idea/modules.xml
generated
@ -2,12 +2,8 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectModuleManager">
|
<component name="ProjectModuleManager">
|
||||||
<modules>
|
<modules>
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/MCTools.main.iml" filepath="$PROJECT_DIR$/.idea/modules/MCTools.main.iml" />
|
<module fileurl="file://$PROJECT_DIR$/.idea/modules/MCTools.main~1.iml" filepath="$PROJECT_DIR$/.idea/modules/MCTools.main~1.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/MCTools.test.iml" filepath="$PROJECT_DIR$/.idea/modules/MCTools.test.iml" />
|
<module fileurl="file://$PROJECT_DIR$/.idea/modules/MCTools.test~1.iml" filepath="$PROJECT_DIR$/.idea/modules/MCTools.test~1.iml" />
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/MinecraftProjects.MCTools.main.iml" filepath="$PROJECT_DIR$/.idea/modules/MinecraftProjects.MCTools.main.iml" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/MinecraftProjects.MCTools.test.iml" filepath="$PROJECT_DIR$/.idea/modules/MinecraftProjects.MCTools.test.iml" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/com.expvintl.MCTools.main.iml" filepath="$PROJECT_DIR$/.idea/modules/com.expvintl.MCTools.main.iml" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/com.expvintl.MCTools.test.iml" filepath="$PROJECT_DIR$/.idea/modules/com.expvintl.MCTools.test.iml" />
|
|
||||||
</modules>
|
</modules>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
4
.idea/modules/MCTools.main.iml
generated
4
.idea/modules/MCTools.main.iml
generated
@ -14,4 +14,8 @@
|
|||||||
<component name="McpModuleSettings">
|
<component name="McpModuleSettings">
|
||||||
<option name="srgType" value="SRG" />
|
<option name="srgType" value="SRG" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
</module>
|
</module>
|
17
.idea/modules/MinecraftProjects.MCTools.main.iml
generated
Normal file
17
.idea/modules/MinecraftProjects.MCTools.main.iml
generated
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="minecraft" name="Minecraft">
|
||||||
|
<configuration>
|
||||||
|
<autoDetectTypes>
|
||||||
|
<platformType>FABRIC</platformType>
|
||||||
|
<platformType>MIXIN</platformType>
|
||||||
|
<platformType>MCP</platformType>
|
||||||
|
</autoDetectTypes>
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
<component name="McpModuleSettings">
|
||||||
|
<option name="srgType" value="SRG" />
|
||||||
|
</component>
|
||||||
|
</module>
|
17
.idea/modules/MinecraftProjects.MCTools.test.iml
generated
Normal file
17
.idea/modules/MinecraftProjects.MCTools.test.iml
generated
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="minecraft" name="Minecraft">
|
||||||
|
<configuration>
|
||||||
|
<autoDetectTypes>
|
||||||
|
<platformType>FABRIC</platformType>
|
||||||
|
<platformType>MIXIN</platformType>
|
||||||
|
<platformType>MCP</platformType>
|
||||||
|
</autoDetectTypes>
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
<component name="McpModuleSettings">
|
||||||
|
<option name="srgType" value="SRG" />
|
||||||
|
</component>
|
||||||
|
</module>
|
11
.idea/modules/com.expvintl.MCTools.main.iml
generated
11
.idea/modules/com.expvintl.MCTools.main.iml
generated
@ -1,16 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module version="4">
|
<module version="4">
|
||||||
<component name="FacetManager">
|
|
||||||
<facet type="minecraft" name="Minecraft">
|
|
||||||
<configuration>
|
|
||||||
<autoDetectTypes>
|
|
||||||
<platformType>FABRIC</platformType>
|
|
||||||
<platformType>MIXIN</platformType>
|
|
||||||
<platformType>MCP</platformType>
|
|
||||||
</autoDetectTypes>
|
|
||||||
</configuration>
|
|
||||||
</facet>
|
|
||||||
</component>
|
|
||||||
<component name="McpModuleSettings">
|
<component name="McpModuleSettings">
|
||||||
<option name="srgType" value="SRG" />
|
<option name="srgType" value="SRG" />
|
||||||
</component>
|
</component>
|
||||||
|
11
.idea/modules/com.expvintl.MCTools.test.iml
generated
11
.idea/modules/com.expvintl.MCTools.test.iml
generated
@ -1,16 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module version="4">
|
<module version="4">
|
||||||
<component name="FacetManager">
|
|
||||||
<facet type="minecraft" name="Minecraft">
|
|
||||||
<configuration>
|
|
||||||
<autoDetectTypes>
|
|
||||||
<platformType>FABRIC</platformType>
|
|
||||||
<platformType>MIXIN</platformType>
|
|
||||||
<platformType>MCP</platformType>
|
|
||||||
</autoDetectTypes>
|
|
||||||
</configuration>
|
|
||||||
</facet>
|
|
||||||
</component>
|
|
||||||
<component name="McpModuleSettings">
|
<component name="McpModuleSettings">
|
||||||
<option name="srgType" value="SRG" />
|
<option name="srgType" value="SRG" />
|
||||||
</component>
|
</component>
|
||||||
|
2
.idea/runConfigurations/Minecraft_Server.xml
generated
2
.idea/runConfigurations/Minecraft_Server.xml
generated
@ -12,5 +12,5 @@
|
|||||||
|
|
||||||
</envs>
|
</envs>
|
||||||
<shortenClasspath name="ARGS_FILE"/>
|
<shortenClasspath name="ARGS_FILE"/>
|
||||||
<classpathModifications><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-stb\3.3.3\25dd6161988d7e65f71d5065c99902402ee32746\lwjgl-stb-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-freetype\3.3.3\a0db6c84a8becc8ca05f9dbfa985edc348a824c7\lwjgl-freetype-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpcore\4.4.16\51cf043c87253c9f58b539c9f7e44c8894223850\httpcore-4.4.16.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\com.ibm.icu\icu4j\73.2\61ad4ef7f9131fcf6d25c34b817f90d6da06c9e9\icu4j-73.2.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-opengl\3.3.3\2f6b0147078396a58979125a4c947664e98293a\lwjgl-opengl-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\com.mojang\text2speech\1.17.9\3cad216e3a7f0c19b4b394388bc9ffc446f13b14\text2speech-1.17.9.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-openal\3.3.3\daada81ceb5fc0c291fbfdd4433cb8d9423577f2\lwjgl-openal-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpclient\4.5.13\e5f6cae5ca7ecaac1ec2827a9e2d65ae2869cada\httpclient-4.5.13.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.jcraft\jorbis\0.0.17\8872d22b293e8f5d7d56ff92be966e6dc28ebdc6\jorbis-0.0.17.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-jemalloc\3.3.3\b543467b7ff3c6920539a88ee602d34098628be5\lwjgl-jemalloc-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\com.mojang\blocklist\1.0.10\5c685c5ffa94c4cd39496c7184c1d122e515ecef\blocklist-1.0.10.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.apache.commons\commons-compress\1.26.0\659feffdd12280201c8aacb8f7be94f9a883c824\commons-compress-1.26.0.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl\3.3.3\29589b5f87ed335a6c7e7ee6a5775f81f97ecb84\lwjgl-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\com.mojang\patchy\2.2.10\da05971b07cbb379d002cf7eaec6a2048211fefc\patchy-2.2.10.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-glfw\3.3.3\efa1eb78c5ccd840e9f329717109b5e892d72f8e\lwjgl-glfw-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\commons-logging\commons-logging\1.2\4bfc12adfe4842bf07b657f0369c4cb522955686\commons-logging-1.2.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\commons-codec\commons-codec\1.16.0\4e3eb3d79888d76b54e28b350915b5dc3919c9de\commons-codec-1.16.0.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-tinyfd\3.3.3\82d755ca94b102e9ca77283b9e2dc46d1b15fbe5\lwjgl-tinyfd-3.3.3.jar"/></classpathModifications></configuration>
|
<classpathModifications><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\com.ibm.icu\icu4j\73.2\61ad4ef7f9131fcf6d25c34b817f90d6da06c9e9\icu4j-73.2.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-opengl\3.3.2\ee8e95be0b438602038bc1f02dc5e3d011b1b216\lwjgl-opengl-3.3.2.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.apache.commons\commons-compress\1.22\691a8b4e6cf4248c3bc72c8b719337d5cb7359fa\commons-compress-1.22.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\com.mojang\text2speech\1.17.9\3cad216e3a7f0c19b4b394388bc9ffc446f13b14\text2speech-1.17.9.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\com.mojang\patchy\2.2.10\da05971b07cbb379d002cf7eaec6a2048211fefc\patchy-2.2.10.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-openal\3.3.2\ae5357ed6d934546d3533993ea84c0cfb75eed95\lwjgl-openal-3.3.2.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpcore\4.4.16\51cf043c87253c9f58b539c9f7e44c8894223850\httpcore-4.4.16.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpclient\4.5.13\e5f6cae5ca7ecaac1ec2827a9e2d65ae2869cada\httpclient-4.5.13.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-glfw\3.3.2\757920418805fb90bfebb3d46b1d9e7669fca2eb\lwjgl-glfw-3.3.2.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\commons-codec\commons-codec\1.16.0\4e3eb3d79888d76b54e28b350915b5dc3919c9de\commons-codec-1.16.0.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\com.mojang\blocklist\1.0.10\5c685c5ffa94c4cd39496c7184c1d122e515ecef\blocklist-1.0.10.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl\3.3.2\4421d94af68e35dcaa31737a6fc59136a1e61b94\lwjgl-3.3.2.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\commons-logging\commons-logging\1.2\4bfc12adfe4842bf07b657f0369c4cb522955686\commons-logging-1.2.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-jemalloc\3.3.2\877e17e39ebcd58a9c956dc3b5b777813de0873a\lwjgl-jemalloc-3.3.2.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-stb\3.3.2\a2550795014d622b686e9caac50b14baa87d2c70\lwjgl-stb-3.3.2.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-tinyfd\3.3.2\9f65c248dd77934105274fcf8351abb75b34327c\lwjgl-tinyfd-3.3.2.jar"/></classpathModifications></configuration>
|
||||||
</component>
|
</component>
|
@ -3,7 +3,7 @@ plugins {
|
|||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
version = project.mod_version
|
version = project.findProperty("minecraft_version")?.toString()?:"1.0"
|
||||||
group = project.maven_group
|
group = project.maven_group
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
@ -1,70 +0,0 @@
|
|||||||
{
|
|
||||||
"mappings": {
|
|
||||||
"com/expvintl/mctools/mixin/MinecraftClientMixin": {
|
|
||||||
"setScreen": "Lnet/minecraft/class_310;method_1507(Lnet/minecraft/class_437;)V",
|
|
||||||
"tick": "Lnet/minecraft/class_310;method_1574()V"
|
|
||||||
},
|
|
||||||
"com/expvintl/mctools/mixin/SoundSystemMixin": {
|
|
||||||
"play(Lnet/minecraft/client/sound/SoundInstance;)V": "Lnet/minecraft/class_1140;method_4854(Lnet/minecraft/class_1113;)V"
|
|
||||||
},
|
|
||||||
"com/expvintl/mctools/mixin/interfaces/ClientPlayerInteractionManagerAccessor": {
|
|
||||||
"syncSelectedSlot": "method_2911()V"
|
|
||||||
},
|
|
||||||
"com/expvintl/mctools/mixin/interfaces/MinecraftClientAccessor": {
|
|
||||||
"doItemUse": "method_1583()V"
|
|
||||||
},
|
|
||||||
"com/expvintl/mctools/mixin/interfaces/PlayerMoveC2SPacketAccessor": {
|
|
||||||
"onGround": "field_29179:Z",
|
|
||||||
"y": "field_12886:D"
|
|
||||||
},
|
|
||||||
"com/expvintl/mctools/mixin/interfaces/SimpleOptionAccessor": {
|
|
||||||
"value": "field_37868:Ljava/lang/Object;"
|
|
||||||
},
|
|
||||||
"com/expvintl/mctools/mixin/network/ClientConnectionMixin": {
|
|
||||||
"handlePacket": "Lnet/minecraft/class_2535;method_10759(Lnet/minecraft/class_2596;Lnet/minecraft/class_2547;)V",
|
|
||||||
"send(Lnet/minecraft/network/packet/Packet;)V": "Lnet/minecraft/class_2535;method_10743(Lnet/minecraft/class_2596;)V"
|
|
||||||
},
|
|
||||||
"com/expvintl/mctools/mixin/player/ClientPlayerInteractionManagerMixin": {
|
|
||||||
"attackBlock": "Lnet/minecraft/class_636;method_2910(Lnet/minecraft/class_2338;Lnet/minecraft/class_2350;)Z",
|
|
||||||
"breakBlock": "Lnet/minecraft/class_636;method_2899(Lnet/minecraft/class_2338;)Z"
|
|
||||||
},
|
|
||||||
"com/expvintl/mctools/mixin/player/PlayerEntityMixin": {
|
|
||||||
"clipAtLedge": "Lnet/minecraft/class_1657;method_21825()Z"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"data": {
|
|
||||||
"named:intermediary": {
|
|
||||||
"com/expvintl/mctools/mixin/MinecraftClientMixin": {
|
|
||||||
"setScreen": "Lnet/minecraft/class_310;method_1507(Lnet/minecraft/class_437;)V",
|
|
||||||
"tick": "Lnet/minecraft/class_310;method_1574()V"
|
|
||||||
},
|
|
||||||
"com/expvintl/mctools/mixin/SoundSystemMixin": {
|
|
||||||
"play(Lnet/minecraft/client/sound/SoundInstance;)V": "Lnet/minecraft/class_1140;method_4854(Lnet/minecraft/class_1113;)V"
|
|
||||||
},
|
|
||||||
"com/expvintl/mctools/mixin/interfaces/ClientPlayerInteractionManagerAccessor": {
|
|
||||||
"syncSelectedSlot": "method_2911()V"
|
|
||||||
},
|
|
||||||
"com/expvintl/mctools/mixin/interfaces/MinecraftClientAccessor": {
|
|
||||||
"doItemUse": "method_1583()V"
|
|
||||||
},
|
|
||||||
"com/expvintl/mctools/mixin/interfaces/PlayerMoveC2SPacketAccessor": {
|
|
||||||
"onGround": "field_29179:Z",
|
|
||||||
"y": "field_12886:D"
|
|
||||||
},
|
|
||||||
"com/expvintl/mctools/mixin/interfaces/SimpleOptionAccessor": {
|
|
||||||
"value": "field_37868:Ljava/lang/Object;"
|
|
||||||
},
|
|
||||||
"com/expvintl/mctools/mixin/network/ClientConnectionMixin": {
|
|
||||||
"handlePacket": "Lnet/minecraft/class_2535;method_10759(Lnet/minecraft/class_2596;Lnet/minecraft/class_2547;)V",
|
|
||||||
"send(Lnet/minecraft/network/packet/Packet;)V": "Lnet/minecraft/class_2535;method_10743(Lnet/minecraft/class_2596;)V"
|
|
||||||
},
|
|
||||||
"com/expvintl/mctools/mixin/player/ClientPlayerInteractionManagerMixin": {
|
|
||||||
"attackBlock": "Lnet/minecraft/class_636;method_2910(Lnet/minecraft/class_2338;Lnet/minecraft/class_2350;)Z",
|
|
||||||
"breakBlock": "Lnet/minecraft/class_636;method_2899(Lnet/minecraft/class_2338;)Z"
|
|
||||||
},
|
|
||||||
"com/expvintl/mctools/mixin/player/PlayerEntityMixin": {
|
|
||||||
"clipAtLedge": "Lnet/minecraft/class_1657;method_21825()Z"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,26 +0,0 @@
|
|||||||
{
|
|
||||||
"schemaVersion": 1,
|
|
||||||
"id": "mctools",
|
|
||||||
"version": "1.0",
|
|
||||||
"name": "MCTools",
|
|
||||||
"description": "",
|
|
||||||
"authors": [],
|
|
||||||
"contact": {
|
|
||||||
"repo": "https://github.com/expvintl/MCTools"
|
|
||||||
},
|
|
||||||
"license": "All-Rights-Reserved",
|
|
||||||
"environment": "client",
|
|
||||||
"entrypoints": {
|
|
||||||
"client": [
|
|
||||||
"com.expvintl.mctools.MCToolsClient"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"mixins": [
|
|
||||||
"mctools.mixins.json"
|
|
||||||
],
|
|
||||||
"depends": {
|
|
||||||
"fabricloader": ">=0.8.0",
|
|
||||||
"fabric": "*",
|
|
||||||
"minecraft": "~1.21"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"required": true,
|
|
||||||
"minVersion": "0.8",
|
|
||||||
"package": "com.expvintl.mctools.mixin",
|
|
||||||
"compatibilityLevel": "JAVA_21",
|
|
||||||
"mixins": [
|
|
||||||
"interfaces.PlayerMoveC2SPacketAccessor",
|
|
||||||
"network.ClientConnectionMixin",
|
|
||||||
"player.PlayerEntityMixin"
|
|
||||||
],
|
|
||||||
"client": [
|
|
||||||
"MinecraftClientMixin",
|
|
||||||
"SoundSystemMixin",
|
|
||||||
"interfaces.ClientPlayerInteractionManagerAccessor",
|
|
||||||
"interfaces.MinecraftClientAccessor",
|
|
||||||
"interfaces.SimpleOptionAccessor",
|
|
||||||
"player.ClientPlayerInteractionManagerMixin"
|
|
||||||
],
|
|
||||||
"injectors": {
|
|
||||||
"defaultRequire": 1
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
@ -1,2 +0,0 @@
|
|||||||
Manifest-Version: 1.0
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
|||||||
Manifest-Version: 1.0
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
|||||||
Manifest-Version: 1.0
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
|||||||
Manifest-Version: 1.0
|
|
||||||
|
|
@ -2,15 +2,15 @@
|
|||||||
org.gradle.jvmargs=-Xmx2G
|
org.gradle.jvmargs=-Xmx2G
|
||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://modmuss50.me/fabric.html
|
# check these on https://modmuss50.me/fabric.html
|
||||||
minecraft_version=1.21
|
minecraft_version=1.20.4
|
||||||
yarn_mappings=1.21+build.9
|
yarn_mappings=1.20.4+build.3
|
||||||
loader_version=0.16.0
|
loader_version=0.16.0
|
||||||
|
|
||||||
#Fabric api
|
#Fabric api
|
||||||
fabric_version=0.100.8+1.21
|
fabric_version=0.97.2+1.20.4
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.0
|
mod_version = 1.0
|
||||||
maven_group = com.expvintl
|
maven_group = com.expvintl
|
||||||
archives_base_name = MCTools
|
archives_base_name = MCTools
|
23
readme.md
23
readme.md
@ -1 +1,22 @@
|
|||||||
## MCTools
|
<div align="center">
|
||||||
|
|
||||||
|
# Minecraft 工具集(Fabric)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
## 支持功能
|
||||||
|
此mod的所有功能为**c开头**
|
||||||
|
1. 自动工具(挖掘、砍伐、亡灵、锋利、伤害等评级)(/cautotool)
|
||||||
|
2. 自动钓鱼 (/cautofish)
|
||||||
|
3. 自动武器(与工具为合并功能)
|
||||||
|
4. 伽马高亮(/fullbirght)
|
||||||
|
5. C键放大
|
||||||
|
6. 基本信息HUD
|
||||||
|
7. 药水状态HUD
|
||||||
|
8. 聊天栏头像补丁
|
||||||
|
9. 强制Tab列表显示头像补丁
|
||||||
|
10. 查询Bukkit系服务器插件(/cqserverplugins)
|
||||||
|
11. 自动重生(/cautorespawn)
|
||||||
|
12. 自动挂边(/csafewalk)
|
||||||
|
13. 无衰落伤害(/cnofallpacket)
|
||||||
|
14. 快速丢弃(WIP)(/cfastdrop)
|
@ -1,10 +0,0 @@
|
|||||||
package com.expvintl.mctools;
|
|
||||||
|
|
||||||
public class FeaturesBool {
|
|
||||||
public static boolean autoRespawn=false;
|
|
||||||
public static boolean selfWalk=false;
|
|
||||||
public static boolean checkBukkitPlugins=false;
|
|
||||||
public static boolean autoTool=false;
|
|
||||||
public static boolean autoFish=false;
|
|
||||||
public static boolean noFallPacket=false;
|
|
||||||
}
|
|
14
src/main/java/com/expvintl/mctools/FeaturesSettings.java
Normal file
14
src/main/java/com/expvintl/mctools/FeaturesSettings.java
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package com.expvintl.mctools;
|
||||||
|
|
||||||
|
import com.expvintl.mctools.settingtype.BooleanSetting;
|
||||||
|
|
||||||
|
public class FeaturesSettings {
|
||||||
|
public final static FeaturesSettings INSTANCE=new FeaturesSettings();
|
||||||
|
public final BooleanSetting autoRespawn = new BooleanSetting();
|
||||||
|
public final BooleanSetting safeWalk = new BooleanSetting();
|
||||||
|
public final BooleanSetting checkBukkitPlugins = new BooleanSetting();
|
||||||
|
public final BooleanSetting autoTool = new BooleanSetting();
|
||||||
|
public final BooleanSetting autoToolIncludePlayer = new BooleanSetting();
|
||||||
|
public final BooleanSetting autoFish = new BooleanSetting();
|
||||||
|
public final BooleanSetting noFallPacket = new BooleanSetting();
|
||||||
|
}
|
@ -1,84 +1,34 @@
|
|||||||
package com.expvintl.mctools;
|
package com.expvintl.mctools;
|
||||||
|
|
||||||
import com.expvintl.mctools.commands.*;
|
import com.expvintl.mctools.commands.*;
|
||||||
import com.expvintl.mctools.utils.Utils;
|
import com.expvintl.mctools.modules.BetterTooltip;
|
||||||
|
import com.expvintl.mctools.modules.CameraZoom;
|
||||||
|
import com.expvintl.mctools.modules.PlayerListTextLatency;
|
||||||
|
import com.expvintl.mctools.texthud.MCInfo;
|
||||||
|
import com.expvintl.mctools.texthud.PotionInfo;
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
|
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
|
||||||
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
|
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
|
||||||
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
|
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
|
||||||
import net.minecraft.client.MinecraftClient;
|
|
||||||
import net.minecraft.client.font.TextRenderer;
|
|
||||||
import net.minecraft.client.gui.DrawContext;
|
|
||||||
import net.minecraft.client.network.ClientPlayerEntity;
|
|
||||||
import net.minecraft.client.render.RenderTickCounter;
|
|
||||||
import net.minecraft.command.CommandRegistryAccess;
|
import net.minecraft.command.CommandRegistryAccess;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.Colors;
|
|
||||||
import net.minecraft.util.math.Vec3d;
|
|
||||||
|
|
||||||
|
|
||||||
public class MCToolsClient implements ClientModInitializer {
|
public class MCToolsClient implements ClientModInitializer {
|
||||||
private static int infoY=1;
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
|
|
||||||
//初始化命令注册回调
|
//初始化命令注册回调
|
||||||
ClientCommandRegistrationCallback.EVENT.register(MCToolsClient::registerCommands);
|
ClientCommandRegistrationCallback.EVENT.register(MCToolsClient::registerCommands);
|
||||||
HudRenderCallback.EVENT.register(MCToolsClient::drawHUD);
|
HudRenderCallback.EVENT.register(MCInfo::drawHUD);
|
||||||
|
HudRenderCallback.EVENT.register(PotionInfo::drawHUD);
|
||||||
|
InitModules();
|
||||||
|
}
|
||||||
|
public void InitModules(){
|
||||||
|
BetterTooltip.INSTANCE.init();
|
||||||
|
PlayerListTextLatency.INSTANCE.init();
|
||||||
|
CameraZoom.INSTANCE.init();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
private static String gameDayToRealTimeFormat(long gameDays){
|
|
||||||
long min=gameDays*20;
|
|
||||||
if(min<60){
|
|
||||||
return String.format("%d 分钟",min);
|
|
||||||
}else if(min>60&&min<1440){
|
|
||||||
return String.format("%d 小时",min/60);
|
|
||||||
}else if(min>1440){
|
|
||||||
return String.format("%d 天",(min/60)/24);
|
|
||||||
}else {
|
|
||||||
return String.format("%d 分钟",min);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private static void drawHUD(DrawContext drawContext, RenderTickCounter v) {
|
|
||||||
MinecraftClient mc=MinecraftClient.getInstance();
|
|
||||||
//跳过调试
|
|
||||||
if(mc.options.hudHidden) return;
|
|
||||||
|
|
||||||
if(mc.world!=null&&mc.player!=null) {
|
|
||||||
infoY=1;
|
|
||||||
int selfPing=0;
|
|
||||||
ClientPlayerEntity p=mc.player;
|
|
||||||
if(mc.getNetworkHandler()!=null&&mc.getNetworkHandler().getPlayerListEntry(mc.player.getGameProfile().getId())!=null) {
|
|
||||||
selfPing=mc.getNetworkHandler().getPlayerListEntry(mc.player.getGameProfile().getId()).getLatency();
|
|
||||||
}
|
|
||||||
Vec3d playerPos=p.getPos();
|
|
||||||
AddText(drawContext,String.format("%d FPS",mc.getCurrentFps()));
|
|
||||||
AddText(drawContext,String.format("Ping: %d 毫秒",selfPing));
|
|
||||||
AddText(drawContext,String.format("亮度:%d",mc.world.getLightLevel(p.getBlockPos())));
|
|
||||||
AddText(drawContext,String.format("当前维度:%s", Utils.getCurrentDimensionName()));
|
|
||||||
AddText(drawContext,String.format("当前群系:%s",Utils.getCurrentBiomeName()));
|
|
||||||
if(Utils.getCurrentDimensionName().equals("下界")){
|
|
||||||
AddText(drawContext,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("主世界")){
|
|
||||||
AddText(drawContext,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{
|
|
||||||
AddText(drawContext,String.format("X:%.2f Y:%.2f Z:%.2f",playerPos.x,playerPos.y,playerPos.z));
|
|
||||||
}
|
|
||||||
AddText(drawContext,String.format("世界时间: %d天 (%s)",mc.world.getTimeOfDay()/24000,gameDayToRealTimeFormat(mc.world.getTimeOfDay()/24000)));
|
|
||||||
AddText(drawContext,String.format("当前区块: [%d,%d]",mc.player.getChunkPos().x,mc.player.getChunkPos().z));
|
|
||||||
AddText(drawContext,String.format("本地难度:%.2f",mc.world.getLocalDifficulty(mc.player.getBlockPos()).getLocalDifficulty()));
|
|
||||||
ItemStack currentItem=p.getInventory().getMainHandStack();
|
|
||||||
if(currentItem!=null&¤tItem.isDamageable()){
|
|
||||||
AddText(drawContext,String.format("耐久度:%d/%d",currentItem.getMaxDamage()-currentItem.getDamage(),currentItem.getMaxDamage()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private static void AddText(DrawContext drawContext,String text){
|
|
||||||
TextRenderer renderer=MinecraftClient.getInstance().textRenderer;
|
|
||||||
drawContext.drawText(renderer,text,0,infoY,Colors.WHITE,false);
|
|
||||||
infoY+=10;
|
|
||||||
}
|
|
||||||
private static void registerCommands(CommandDispatcher<FabricClientCommandSource> dispatcher, CommandRegistryAccess registryAccess) {
|
private static void registerCommands(CommandDispatcher<FabricClientCommandSource> dispatcher, CommandRegistryAccess registryAccess) {
|
||||||
//注册命令
|
//注册命令
|
||||||
CFullbirghtCommand.register(dispatcher);
|
CFullbirghtCommand.register(dispatcher);
|
||||||
@ -88,6 +38,6 @@ public class MCToolsClient implements ClientModInitializer {
|
|||||||
CAutoToolCommand.register(dispatcher);
|
CAutoToolCommand.register(dispatcher);
|
||||||
CQServerPluginsCommand.register(dispatcher);
|
CQServerPluginsCommand.register(dispatcher);
|
||||||
CNoFallPacketCommand.register(dispatcher);
|
CNoFallPacketCommand.register(dispatcher);
|
||||||
CFindBlockCommand.register(dispatcher);
|
CFastDropCommand.register(dispatcher,registryAccess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package com.expvintl.mctools.commands;
|
package com.expvintl.mctools.commands;
|
||||||
|
|
||||||
import com.expvintl.mctools.FeaturesBool;
|
import com.expvintl.mctools.FeaturesSettings;
|
||||||
import com.expvintl.mctools.events.MCEventBus;
|
import com.expvintl.mctools.events.MCEventBus;
|
||||||
import com.expvintl.mctools.events.client.sounds.PlaySoundEvent;
|
import com.expvintl.mctools.events.client.sounds.PlaySoundEvent;
|
||||||
|
import com.expvintl.mctools.utils.CommandUtils;
|
||||||
import com.expvintl.mctools.utils.Utils;
|
import com.expvintl.mctools.utils.Utils;
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import com.mojang.brigadier.Command;
|
import com.mojang.brigadier.Command;
|
||||||
@ -21,21 +22,23 @@ public class CAutoFishCommand {
|
|||||||
private static final CAutoFishCommand INSTANCE=new CAutoFishCommand();
|
private static final CAutoFishCommand INSTANCE=new CAutoFishCommand();
|
||||||
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher){
|
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher){
|
||||||
MCEventBus.INSTANCE.register(INSTANCE);
|
MCEventBus.INSTANCE.register(INSTANCE);
|
||||||
|
CommandUtils.CreateStatusCommand("cautofish", FeaturesSettings.INSTANCE.autoFish, dispatcher);
|
||||||
|
|
||||||
dispatcher.register(literal("cautofish").then(argument("开关", BoolArgumentType.bool()).executes(CAutoFishCommand::execute)));
|
dispatcher.register(literal("cautofish").then(argument("开关", BoolArgumentType.bool()).executes(CAutoFishCommand::execute)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
||||||
FeaturesBool.autoFish=context.getArgument("开关", Boolean.class);
|
FeaturesSettings.INSTANCE.autoFish.setValue(context.getArgument("开关", Boolean.class));
|
||||||
if(FeaturesBool.autoFish){
|
if(FeaturesSettings.INSTANCE.autoFish.getValue()){
|
||||||
context.getSource().getPlayer().sendMessage(Text.literal("已启用自动钓鱼!"));
|
context.getSource().getPlayer().sendMessage(Text.literal("已启用自动钓鱼!"),false);
|
||||||
}else{
|
}else{
|
||||||
context.getSource().getPlayer().sendMessage(Text.literal("已禁用自动钓鱼!"));
|
context.getSource().getPlayer().sendMessage(Text.literal("已禁用自动钓鱼!"),false);
|
||||||
}
|
}
|
||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
}
|
}
|
||||||
@Subscribe
|
@Subscribe
|
||||||
private void onPlaySound(PlaySoundEvent event){
|
private void onPlaySound(PlaySoundEvent event){
|
||||||
if(FeaturesBool.autoFish) {
|
if(FeaturesSettings.INSTANCE.autoFish.getValue()) {
|
||||||
//自动钓鱼
|
//自动钓鱼
|
||||||
if (event.soundInstance.getId().getPath().equals("entity.fishing_bobber.splash")) {
|
if (event.soundInstance.getId().getPath().equals("entity.fishing_bobber.splash")) {
|
||||||
//收杆
|
//收杆
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package com.expvintl.mctools.commands;
|
package com.expvintl.mctools.commands;
|
||||||
|
|
||||||
import com.expvintl.mctools.FeaturesBool;
|
import com.expvintl.mctools.FeaturesSettings;
|
||||||
import com.expvintl.mctools.events.MCEventBus;
|
import com.expvintl.mctools.events.MCEventBus;
|
||||||
import com.expvintl.mctools.events.client.OpenScreenEvent;
|
import com.expvintl.mctools.events.client.OpenScreenEvent;
|
||||||
|
import com.expvintl.mctools.utils.CommandUtils;
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import com.mojang.brigadier.Command;
|
import com.mojang.brigadier.Command;
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
@ -20,21 +21,22 @@ public class CAutoRespawnCommand {
|
|||||||
private static final CAutoRespawnCommand INSTANCE=new CAutoRespawnCommand();
|
private static final CAutoRespawnCommand INSTANCE=new CAutoRespawnCommand();
|
||||||
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher){
|
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher){
|
||||||
MCEventBus.INSTANCE.register(INSTANCE);
|
MCEventBus.INSTANCE.register(INSTANCE);
|
||||||
|
CommandUtils.CreateStatusCommand("cautorespawn", FeaturesSettings.INSTANCE.autoRespawn, dispatcher);
|
||||||
dispatcher.register(literal("cautorespawn").then(argument("开关", BoolArgumentType.bool()).executes(CAutoRespawnCommand::execute)));
|
dispatcher.register(literal("cautorespawn").then(argument("开关", BoolArgumentType.bool()).executes(CAutoRespawnCommand::execute)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
||||||
FeaturesBool.autoRespawn=context.getArgument("开关", Boolean.class);
|
FeaturesSettings.INSTANCE.autoRespawn.setValue(context.getArgument("开关", Boolean.class));
|
||||||
if(FeaturesBool.autoRespawn){
|
if(FeaturesSettings.INSTANCE.autoRespawn.getValue()){
|
||||||
context.getSource().getPlayer().sendMessage(Text.literal("已启用自动重生!"));
|
context.getSource().getPlayer().sendMessage(Text.literal("已启用自动重生!"),false);
|
||||||
}else{
|
}else{
|
||||||
context.getSource().getPlayer().sendMessage(Text.literal("已禁用自动重生!"));
|
context.getSource().getPlayer().sendMessage(Text.literal("已禁用自动重生!"),false);
|
||||||
}
|
}
|
||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
}
|
}
|
||||||
@Subscribe
|
@Subscribe
|
||||||
private void onOpenScreen(OpenScreenEvent event){
|
private void onOpenScreen(OpenScreenEvent event){
|
||||||
if(FeaturesBool.autoRespawn) {
|
if(FeaturesSettings.INSTANCE.autoRespawn.getValue()) {
|
||||||
//自动重生
|
//自动重生
|
||||||
if (event.screen instanceof DeathScreen) {
|
if (event.screen instanceof DeathScreen) {
|
||||||
if (MinecraftClient.getInstance().player != null) {
|
if (MinecraftClient.getInstance().player != null) {
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
package com.expvintl.mctools.commands;
|
package com.expvintl.mctools.commands;
|
||||||
|
|
||||||
import com.expvintl.mctools.FeaturesBool;
|
import com.expvintl.mctools.FeaturesSettings;
|
||||||
import com.expvintl.mctools.events.MCEventBus;
|
import com.expvintl.mctools.events.MCEventBus;
|
||||||
import com.expvintl.mctools.events.player.PlayerAttackBlockEvent;
|
import com.expvintl.mctools.events.player.PlayerAttackBlockEvent;
|
||||||
import com.expvintl.mctools.events.player.PlayerBreakBlockEvent;
|
import com.expvintl.mctools.events.player.PlayerAttackEntityEvent;
|
||||||
import com.expvintl.mctools.mixin.interfaces.ClientPlayerInteractionManagerAccessor;
|
import com.expvintl.mctools.mixin.interfaces.ClientPlayerInteractionManagerAccessor;
|
||||||
import com.expvintl.mctools.utils.Utils;
|
import com.expvintl.mctools.utils.CommandUtils;
|
||||||
|
import com.google.common.collect.Multimap;
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import com.mojang.brigadier.Command;
|
import com.mojang.brigadier.Command;
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
@ -13,109 +14,256 @@ import com.mojang.brigadier.arguments.BoolArgumentType;
|
|||||||
import com.mojang.brigadier.context.CommandContext;
|
import com.mojang.brigadier.context.CommandContext;
|
||||||
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
|
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
|
||||||
import net.minecraft.block.BambooBlock;
|
import net.minecraft.block.BambooBlock;
|
||||||
import net.minecraft.block.BambooShootBlock;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.component.DataComponentTypes;
|
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
import net.minecraft.enchantment.Enchantments;
|
import net.minecraft.enchantment.Enchantments;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.entity.*;
|
||||||
import net.minecraft.item.ShearsItem;
|
import net.minecraft.entity.attribute.EntityAttribute;
|
||||||
import net.minecraft.item.SwordItem;
|
import net.minecraft.entity.attribute.EntityAttributeModifier;
|
||||||
import net.minecraft.item.ToolItem;
|
import net.minecraft.entity.attribute.EntityAttributes;
|
||||||
|
import net.minecraft.item.*;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.argument;
|
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.argument;
|
||||||
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal;
|
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal;
|
||||||
|
|
||||||
public class CAutoToolCommand {
|
public class CAutoToolCommand {
|
||||||
private static final CAutoToolCommand INSTANCE=new CAutoToolCommand();
|
private static final CAutoToolCommand INSTANCE=new CAutoToolCommand();
|
||||||
private int lastSlot=-1;
|
|
||||||
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher){
|
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher){
|
||||||
MCEventBus.INSTANCE.register(INSTANCE);
|
MCEventBus.INSTANCE.register(INSTANCE);
|
||||||
dispatcher.register(literal("cautotool").then(argument("开关", BoolArgumentType.bool()).executes(CAutoToolCommand::execute)));
|
CommandUtils.CreateStatusCommand("cautotool", FeaturesSettings.INSTANCE.autoTool, dispatcher);
|
||||||
|
dispatcher.register(
|
||||||
|
literal("cautotool")
|
||||||
|
.then(argument("开关", BoolArgumentType.bool())
|
||||||
|
.executes(CAutoToolCommand::execute)
|
||||||
|
.then(argument("包含玩家",BoolArgumentType.bool())
|
||||||
|
.executes(CAutoToolCommand::execute))));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
||||||
FeaturesBool.autoTool=context.getArgument("开关", Boolean.class);
|
FeaturesSettings.INSTANCE.autoTool.setValue(context.getArgument("开关", Boolean.class));
|
||||||
if(FeaturesBool.autoTool){
|
try{
|
||||||
context.getSource().getPlayer().sendMessage(Text.literal("已启用智能工具!"));
|
FeaturesSettings.INSTANCE.autoToolIncludePlayer.setValue(context.getArgument("包含玩家", Boolean.class));
|
||||||
|
}catch (IllegalArgumentException ignored){
|
||||||
|
}
|
||||||
|
if(FeaturesSettings.INSTANCE.autoTool.getValue()){
|
||||||
|
context.getSource().getPlayer().sendMessage(Text.literal("已启用智能工具! 对玩家使用智能武器:"+FeaturesSettings.INSTANCE.autoToolIncludePlayer.getValue()),false);
|
||||||
}else{
|
}else{
|
||||||
context.getSource().getPlayer().sendMessage(Text.literal("已禁用智能工具!"));
|
context.getSource().getPlayer().sendMessage(Text.literal("已禁用智能工具!"),false);
|
||||||
}
|
}
|
||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Subscribe
|
||||||
|
// private void onBreakBlock(PlayerBreakBlockEvent event){
|
||||||
|
// if(!Globals.autoTool.get()) return;
|
||||||
|
// MinecraftClient mc=MinecraftClient.getInstance();
|
||||||
|
// if (mc.world == null||mc.player==null) return;
|
||||||
|
// }
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
private void onBreakBlock(PlayerBreakBlockEvent event){
|
private void onAttackEntity(PlayerAttackEntityEvent event){
|
||||||
if(!FeaturesBool.autoTool) return;
|
if(!FeaturesSettings.INSTANCE.autoTool.getValue()) return;
|
||||||
MinecraftClient mc=MinecraftClient.getInstance();
|
if(event.target.hasCustomName()) return;
|
||||||
if (mc.world == null||mc.player==null) return;
|
//对玩家使用
|
||||||
if (lastSlot!=-1){
|
if(FeaturesSettings.INSTANCE.autoToolIncludePlayer.getValue()&&event.target.isPlayer()) return;
|
||||||
//破坏方块后切换回去
|
float bestScore=-1;
|
||||||
mc.player.getInventory().selectedSlot=lastSlot;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Subscribe
|
|
||||||
private void onAttackBlock(PlayerAttackBlockEvent event){
|
|
||||||
if(!FeaturesBool.autoTool) return;
|
|
||||||
//自动工具
|
|
||||||
MinecraftClient mc=MinecraftClient.getInstance();
|
|
||||||
if (mc.world == null||mc.player==null) return;
|
|
||||||
BlockState state= mc.world.getBlockState(event.blockPos);
|
|
||||||
//跳过不可破坏
|
|
||||||
if(state.getHardness(mc.world, event.blockPos) < 0) return;
|
|
||||||
ItemStack currentItem = mc.player.getMainHandStack();
|
|
||||||
//统计最好的挖掘分数
|
|
||||||
double bestScore=-1;
|
|
||||||
//工具槽
|
|
||||||
int slot=-1;
|
int slot=-1;
|
||||||
//遍历每一个物品槽
|
for(int i=0;i<9;i++) {
|
||||||
for(int i=0;i<9;i++){
|
ItemStack item = event.player.getInventory().getStack(i);
|
||||||
ItemStack item = mc.player.getInventory().getStack(i);
|
if(!isSwordItem(item.getItem())&&!isToolItem(item.getItem())) continue;
|
||||||
double score=getScore(item,state);
|
float score=getWeaponScore(event.target, item);
|
||||||
if(score<0) continue;
|
if(score<=0) continue;
|
||||||
//选出最好分数的工具
|
//选出最好分数的工具
|
||||||
if(score>bestScore){
|
if(score>bestScore){
|
||||||
bestScore=score;
|
bestScore=score;
|
||||||
slot=i;
|
slot=i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//确定已经选择好了工具就切换
|
if(slot==-1) return;
|
||||||
if((slot!=-1&&bestScore>getScore(currentItem,state)&&!lowDurability(currentItem))||!isTools(currentItem)) {
|
ItemStack currentItem = event.player.getInventory().getStack(slot);
|
||||||
//记住上一次的槽方便恢复
|
//低耐久测试
|
||||||
lastSlot=mc.player.getInventory().selectedSlot;
|
if(!isLowDurability(currentItem)) {
|
||||||
//切换过去
|
//切换过去
|
||||||
mc.player.getInventory().selectedSlot = slot;
|
event.player.getInventory().selectedSlot=slot;
|
||||||
|
MinecraftClient mc=MinecraftClient.getInstance();
|
||||||
if(mc.interactionManager!=null) {
|
if(mc.interactionManager!=null) {
|
||||||
((ClientPlayerInteractionManagerAccessor) mc.interactionManager).syncSelectedSlot();
|
((ClientPlayerInteractionManagerAccessor) mc.interactionManager).syncSelectedSlot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public double getScore(ItemStack item, BlockState state){
|
//方块挖掘
|
||||||
double score=0;
|
@Subscribe
|
||||||
//Is Tool!!
|
private void onAttackBlock(PlayerAttackBlockEvent event){
|
||||||
if(item.getItem() instanceof ToolItem || item.getItem() instanceof ShearsItem){
|
if(!FeaturesSettings.INSTANCE.autoTool.getValue()) return;
|
||||||
|
//自动工具
|
||||||
|
MinecraftClient mc=MinecraftClient.getInstance();
|
||||||
|
if (mc.world == null||mc.player==null) return;
|
||||||
|
BlockState state= mc.world.getBlockState(event.blockPos);
|
||||||
|
//跳过不可破坏
|
||||||
|
if(state.getHardness(mc.world, event.blockPos) < 0) return;
|
||||||
|
//统计最好的挖掘分数
|
||||||
|
float bestScore=-1;
|
||||||
|
//工具槽
|
||||||
|
int slot=-1;
|
||||||
|
//遍历每一个物品槽
|
||||||
|
for(int i=0;i<9;i++){
|
||||||
|
ItemStack item = mc.player.getInventory().getStack(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().getStack(slot);
|
||||||
|
//确定已经选择好了工具就切换
|
||||||
|
if(!isLowDurability(currentItem)) {
|
||||||
|
//切换过去
|
||||||
|
mc.player.getInventory().selectedSlot=slot;
|
||||||
|
if(mc.interactionManager!=null) {
|
||||||
|
((ClientPlayerInteractionManagerAccessor) mc.interactionManager).syncSelectedSlot();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public boolean isSwordItem(Item item){
|
||||||
|
return item==Items.STONE_SWORD||item==Items.DIAMOND_SWORD||item==Items.GOLDEN_SWORD||item==Items.IRON_SWORD||item==Items.NETHERITE_SWORD||item==Items.WOODEN_SWORD;
|
||||||
|
}
|
||||||
|
public boolean isToolItem(Item item){
|
||||||
|
return item == Items.WOODEN_PICKAXE || item == Items.STONE_PICKAXE || item == Items.IRON_PICKAXE || item == Items.GOLDEN_PICKAXE || item == Items.DIAMOND_PICKAXE || item == Items.NETHERITE_PICKAXE
|
||||||
|
|| item == Items.WOODEN_AXE || item == Items.STONE_AXE || item == Items.IRON_AXE || item == Items.GOLDEN_AXE || item == Items.DIAMOND_AXE || item == Items.NETHERITE_AXE
|
||||||
|
|| item == Items.WOODEN_SHOVEL || item == Items.STONE_SHOVEL || item == Items.IRON_SHOVEL || item == Items.GOLDEN_SHOVEL || item == Items.DIAMOND_SHOVEL || item == Items.NETHERITE_SHOVEL
|
||||||
|
|| item == Items.WOODEN_HOE || item == Items.STONE_HOE || item == Items.IRON_HOE || item == Items.GOLDEN_HOE || item == Items.DIAMOND_HOE || item == Items.NETHERITE_HOE
|
||||||
|
|| item == Items.WOODEN_SWORD || item == Items.STONE_SWORD || item == Items.IRON_SWORD || item == Items.GOLDEN_SWORD || item == Items.DIAMOND_SWORD || item == Items.NETHERITE_SWORD;
|
||||||
|
}
|
||||||
|
public boolean isOreBlock(Item item) {
|
||||||
|
return item == Items.COAL_ORE || // 煤矿石
|
||||||
|
item == Items.DEEPSLATE_COAL_ORE || // 深层煤矿石
|
||||||
|
item == Items.IRON_ORE || // 铁矿石
|
||||||
|
item == Items.DEEPSLATE_IRON_ORE || // 深层铁矿石
|
||||||
|
item == Items.COPPER_ORE || // 铜矿石
|
||||||
|
item == Items.DEEPSLATE_COPPER_ORE || // 深层铜矿石
|
||||||
|
item == Items.GOLD_ORE || // 金矿石
|
||||||
|
item == Items.DEEPSLATE_GOLD_ORE || // 深层金矿石
|
||||||
|
item == Items.REDSTONE_ORE || // 红石矿石
|
||||||
|
item == Items.DEEPSLATE_REDSTONE_ORE ||// 深层红石矿石
|
||||||
|
item == Items.EMERALD_ORE || // 绿宝石矿石
|
||||||
|
item == Items.DEEPSLATE_EMERALD_ORE ||// 深层绿宝石矿石
|
||||||
|
item == Items.LAPIS_ORE || // 青金石矿石
|
||||||
|
item == Items.DEEPSLATE_LAPIS_ORE || // 深层青金石矿石
|
||||||
|
item == Items.DIAMOND_ORE || // 钻石矿石
|
||||||
|
item == Items.DEEPSLATE_DIAMOND_ORE ||// 深层钻石矿石
|
||||||
|
item == Items.NETHER_GOLD_ORE || // 下界金矿石
|
||||||
|
item == Items.NETHER_QUARTZ_ORE; // 下界石英矿石
|
||||||
|
}
|
||||||
|
private boolean isBlockFortune(Block block) {
|
||||||
|
if (block == Blocks.COAL_ORE || block == Blocks.DEEPSLATE_COAL_ORE ||
|
||||||
|
block == Blocks.COPPER_ORE || block == Blocks.DEEPSLATE_COPPER_ORE ||
|
||||||
|
block == Blocks.IRON_ORE || block == Blocks.DEEPSLATE_IRON_ORE ||
|
||||||
|
block == Blocks.GOLD_ORE || block == Blocks.DEEPSLATE_GOLD_ORE ||
|
||||||
|
block == Blocks.REDSTONE_ORE || block == Blocks.DEEPSLATE_REDSTONE_ORE ||
|
||||||
|
block == Blocks.LAPIS_ORE || block == Blocks.DEEPSLATE_LAPIS_ORE ||
|
||||||
|
block == Blocks.DIAMOND_ORE || block == Blocks.DEEPSLATE_DIAMOND_ORE ||
|
||||||
|
block == Blocks.EMERALD_ORE || block == Blocks.DEEPSLATE_EMERALD_ORE ||
|
||||||
|
block == Blocks.NETHER_QUARTZ_ORE || block == Blocks.NETHER_GOLD_ORE ||
|
||||||
|
block == Blocks.AMETHYST_CLUSTER) { // 紫水晶簇也受时运影响
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (block == Blocks.WHEAT || // 小麦
|
||||||
|
block == Blocks.CARROTS || // 胡萝卜
|
||||||
|
block == Blocks.POTATOES || // 马铃薯
|
||||||
|
block == Blocks.BEETROOTS || // 甜菜根
|
||||||
|
block == Blocks.NETHER_WART) { // 下界疣
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (block == Blocks.GLOWSTONE || // 荧石
|
||||||
|
block == Blocks.MELON || // 西瓜
|
||||||
|
block == Blocks.GRAVEL || // 沙砾 (影响燧石掉落概率)
|
||||||
|
block == Blocks.SEA_LANTERN){ // 海晶灯
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
public float getToolsScore(ItemStack item, BlockState state){
|
||||||
|
float score=0;
|
||||||
|
if(isToolItem(item.getItem())||item.getItem() instanceof ShearsItem){
|
||||||
//根据挖掘速度提升评分
|
//根据挖掘速度提升评分
|
||||||
score+=item.getMiningSpeedMultiplier(state)*10;
|
score+=item.getMiningSpeedMultiplier(state)*2;
|
||||||
//附魔加分
|
//附魔加分
|
||||||
//TODO: 这里仍存在一些问题,来自附魔
|
|
||||||
//耐久
|
//耐久
|
||||||
score+= Utils.GetEnchantLevel(Enchantments.UNBREAKING, item)*10;
|
score+= EnchantmentHelper.getLevel(Enchantments.UNBREAKING, item);
|
||||||
//效率
|
//效率
|
||||||
score+=Utils.GetEnchantLevel(Enchantments.EFFICIENCY,item)*5;
|
score+=EnchantmentHelper.getLevel(Enchantments.EFFICIENCY,item);
|
||||||
//经验修补(此项最优先)
|
//经验修补
|
||||||
score+=Utils.GetEnchantLevel(Enchantments.MENDING,item)*20;
|
score+=EnchantmentHelper.getLevel(Enchantments.MENDING,item);
|
||||||
if (item.getItem() instanceof SwordItem item1 && (state.getBlock() instanceof BambooBlock|| state.getBlock() instanceof BambooShootBlock))
|
|
||||||
//根据挖掘等级加分
|
if(isBlockFortune(state.getBlock())){
|
||||||
score += 90 + (item1.getComponents().get(DataComponentTypes.TOOL).getSpeed(state) * 10);
|
score+=EnchantmentHelper.getLevel(Enchantments.FORTUNE,item);//时运
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isSwordItem(item.getItem()) && (state.getBlock() instanceof BambooBlock)) {
|
||||||
|
if(item.getItem() instanceof ToolItem tool){
|
||||||
|
//根据挖掘等级加分
|
||||||
|
score += 90 + tool.getMaterial().getMiningSpeedMultiplier();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
//停用低耐久度
|
public float getWeaponScore(Entity ent, ItemStack item) {
|
||||||
private boolean lowDurability(ItemStack itemStack) {
|
float damageScore = 0;
|
||||||
return (itemStack.getMaxDamage() - itemStack.getDamage()) < (itemStack.getMaxDamage() * 10 / 100);
|
//剑优先
|
||||||
|
if (isSwordItem(item.getItem())) damageScore += 100;
|
||||||
|
//计算物品的基础伤害属性(较为复杂)
|
||||||
|
Multimap<EntityAttribute, EntityAttributeModifier> modifiers = item.getAttributeModifiers(EquipmentSlot.MAINHAND);
|
||||||
|
Collection<EntityAttributeModifier> damageModifiers = modifiers.get(EntityAttributes.GENERIC_ATTACK_DAMAGE);
|
||||||
|
for (EntityAttributeModifier modifier : damageModifiers) {
|
||||||
|
if (modifier.getOperation() == EntityAttributeModifier.Operation.ADDITION) {
|
||||||
|
damageScore+=(float) modifier.getValue();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//节肢杀手
|
||||||
|
EntityType<?> id=ent.getType();
|
||||||
|
if(id==EntityType.SPIDER||id==EntityType.CAVE_SPIDER||id==EntityType.SILVERFISH||id==EntityType.ENDERMITE||id==EntityType.BEE) {
|
||||||
|
damageScore += EnchantmentHelper.getLevel(Enchantments.BANE_OF_ARTHROPODS, item) * 3;
|
||||||
|
}
|
||||||
|
//亡灵杀手(这伤害通常更高)
|
||||||
|
if(((LivingEntity)ent).getGroup()== EntityGroup.UNDEAD){
|
||||||
|
damageScore+=EnchantmentHelper.getLevel(Enchantments.SMITE,item)*3;// 3倍
|
||||||
|
}
|
||||||
|
//锋利加分
|
||||||
|
damageScore += EnchantmentHelper.getLevel(Enchantments.SHARPNESS, item) * 2;
|
||||||
|
//精修
|
||||||
|
damageScore += EnchantmentHelper.getLevel(Enchantments.MENDING, item);
|
||||||
|
//火焰附加
|
||||||
|
damageScore += EnchantmentHelper.getLevel(Enchantments.FIRE_ASPECT, item);
|
||||||
|
//击退
|
||||||
|
damageScore += EnchantmentHelper.getLevel(Enchantments.KNOCKBACK, item);
|
||||||
|
return damageScore;
|
||||||
}
|
}
|
||||||
public boolean isTools(ItemStack item){
|
//停用低耐久度
|
||||||
return item.getItem() instanceof ToolItem || item.getItem() instanceof ShearsItem;
|
private boolean isLowDurability(ItemStack itemStack) {
|
||||||
|
Item item = itemStack.getItem();
|
||||||
|
boolean isWooden = item == Items.WOODEN_SWORD || item == Items.WOODEN_PICKAXE ||
|
||||||
|
item == Items.WOODEN_AXE || item == Items.WOODEN_SHOVEL ||
|
||||||
|
item == Items.WOODEN_HOE;
|
||||||
|
boolean isStone = item == Items.STONE_SWORD || item == Items.STONE_PICKAXE ||
|
||||||
|
item == Items.STONE_AXE || item == Items.STONE_SHOVEL ||
|
||||||
|
item == Items.STONE_HOE;
|
||||||
|
boolean isIron = item == Items.IRON_SWORD || item == Items.IRON_PICKAXE ||
|
||||||
|
item == Items.IRON_AXE || item == Items.IRON_SHOVEL ||
|
||||||
|
item == Items.IRON_HOE;
|
||||||
|
return !(isWooden||isStone||isIron) //忽略木/石/铁工具
|
||||||
|
&&(itemStack.getMaxDamage() - itemStack.getDamage()) < (itemStack.getMaxDamage() * 2 / 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,117 @@
|
|||||||
|
package com.expvintl.mctools.commands;
|
||||||
|
|
||||||
|
import com.expvintl.mctools.utils.PlayerUtils;
|
||||||
|
import com.mojang.brigadier.Command;
|
||||||
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
import com.mojang.brigadier.context.CommandContext;
|
||||||
|
import com.mojang.brigadier.suggestion.Suggestions;
|
||||||
|
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
||||||
|
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
|
||||||
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
|
import net.minecraft.command.CommandRegistryAccess;
|
||||||
|
import net.minecraft.command.argument.ItemStackArgumentType;
|
||||||
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
|
import net.minecraft.registry.Registries;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.argument;
|
||||||
|
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal;
|
||||||
|
|
||||||
|
public class CFastDropCommand {
|
||||||
|
public static List<Item> trashItem=new ArrayList<>();
|
||||||
|
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher , CommandRegistryAccess access){
|
||||||
|
dispatcher.register(literal("cfastdrop").executes(CFastDropCommand::execute));
|
||||||
|
dispatcher.register(literal("cfastdrop").then(literal("list").executes((context -> {
|
||||||
|
StringBuilder sb=new StringBuilder();
|
||||||
|
sb.append("已添加:\n");
|
||||||
|
for(Item i:trashItem){
|
||||||
|
sb.append(i.getName().getString()).append(",");
|
||||||
|
}
|
||||||
|
context.getSource().getPlayer().sendMessage(Text.literal(sb.toString()),false);
|
||||||
|
return Command.SINGLE_SUCCESS;
|
||||||
|
}))));
|
||||||
|
dispatcher.register(literal("cfastdrop").then(literal("clear").executes((context -> {
|
||||||
|
trashItem.clear();
|
||||||
|
context.getSource().getPlayer().sendMessage(Text.literal("已清除全部物品!"),false);
|
||||||
|
return Command.SINGLE_SUCCESS;
|
||||||
|
}))));
|
||||||
|
dispatcher.register(literal("cfastdrop").then(literal("del").then(argument("物品", ItemStackArgumentType.itemStack(access)).suggests(((context, builder) -> suggestItems(builder))).executes(cmd->{
|
||||||
|
Item item=ItemStackArgumentType.getItemStackArgument(cmd,"物品").getItem();
|
||||||
|
if (item != Items.AIR) { // 确保找到的物品是有效的
|
||||||
|
if (trashItem.contains(item)) {
|
||||||
|
trashItem.remove(item);
|
||||||
|
cmd.getSource().getPlayer().sendMessage(Text.literal("已移除 " + item.getName().getString()),false);
|
||||||
|
}else{
|
||||||
|
cmd.getSource().getPlayer().sendMessage(Text.literal("没有找到 " + item.getName().getString()),false);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
cmd.getSource().getPlayer().sendMessage(Text.literal("无效物品!"),false);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return Command.SINGLE_SUCCESS;
|
||||||
|
}))));
|
||||||
|
dispatcher.register(literal("cfastdrop").then(literal("add").then(argument("物品", ItemStackArgumentType.itemStack(access)).suggests(((context, builder) -> suggestItems(builder))).executes(cmd->{
|
||||||
|
Item item=ItemStackArgumentType.getItemStackArgument(cmd,"物品").getItem();
|
||||||
|
if (item != Items.AIR) { // 确保找到的物品是有效的
|
||||||
|
if(trashItem.contains(item)){
|
||||||
|
cmd.getSource().getPlayer().sendMessage(Text.literal( item.getName().getString() + " 已存在!"),false);
|
||||||
|
}else {
|
||||||
|
trashItem.add(item);
|
||||||
|
cmd.getSource().getPlayer().sendMessage(Text.literal("已添加 " + item.getName().getString() + " 到垃圾物品列表"),false);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
cmd.getSource().getPlayer().sendMessage(Text.literal("无效物品!"),false);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return Command.SINGLE_SUCCESS;
|
||||||
|
}))));
|
||||||
|
trashItem.add(Items.COBBLESTONE);
|
||||||
|
trashItem.add(Items.GRANITE);//花岗岩
|
||||||
|
trashItem.add(Items.ANDESITE);//安山岩
|
||||||
|
trashItem.add(Items.DIORITE);//闪长岩
|
||||||
|
trashItem.add(Items.GRAVEL);//沙砾
|
||||||
|
trashItem.add(Items.NETHERRACK);//地狱岩
|
||||||
|
trashItem.add(Items.BLACKSTONE);//黑石
|
||||||
|
trashItem.add(Items.BASALT); //玄武岩
|
||||||
|
trashItem.add(Items.DIRT);//泥土
|
||||||
|
trashItem.add(Items.PUFFERFISH);//河豚
|
||||||
|
trashItem.add(Items.DANDELION);
|
||||||
|
trashItem.add(Items.SUNFLOWER);
|
||||||
|
trashItem.add(Items.CORNFLOWER);
|
||||||
|
trashItem.add(Items.TUFF); //凝灰岩
|
||||||
|
trashItem.add(Items.DEEPSLATE); //深板岩
|
||||||
|
trashItem.add(Items.SANDSTONE); //砂岩
|
||||||
|
trashItem.add(Items.DEEPSLATE_BRICKS);//深板岩砖
|
||||||
|
trashItem.add(Items.COBBLED_DEEPSLATE); //深板岩圆石
|
||||||
|
}
|
||||||
|
private static CompletableFuture<Suggestions> suggestItems(SuggestionsBuilder builder) {
|
||||||
|
// 遍历所有注册的物品并将其添加到建议列表中
|
||||||
|
Registries.ITEM.getIds().forEach(id -> builder.suggest(id.toString()));
|
||||||
|
return builder.buildFuture();
|
||||||
|
}
|
||||||
|
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
||||||
|
ClientPlayerEntity player=context.getSource().getPlayer();
|
||||||
|
if(player==null){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
PlayerInventory inv=player.getInventory();
|
||||||
|
for(int i=0;i<inv.size();i++) {
|
||||||
|
ItemStack item = inv.getStack(i);
|
||||||
|
for (Item trash : trashItem) {
|
||||||
|
if (item.getItem() == trash) {
|
||||||
|
PlayerUtils.DropItem(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
player.sendMessage(Text.literal("已丢弃无用物品!"),false);
|
||||||
|
return Command.SINGLE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,36 +0,0 @@
|
|||||||
package com.expvintl.mctools.commands;
|
|
||||||
|
|
||||||
import com.expvintl.mctools.FeaturesBool;
|
|
||||||
import com.expvintl.mctools.events.MCEventBus;
|
|
||||||
import com.expvintl.mctools.events.client.RenderWorldEvent;
|
|
||||||
import com.expvintl.mctools.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.arguments.StringArgumentType;
|
|
||||||
import com.mojang.brigadier.context.CommandContext;
|
|
||||||
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
|
||||||
|
|
||||||
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.argument;
|
|
||||||
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal;
|
|
||||||
|
|
||||||
public class CFindBlockCommand {
|
|
||||||
private static final MinecraftClient mc=MinecraftClient.getInstance();
|
|
||||||
private static final CFindBlockCommand INSTANCE=new CFindBlockCommand();
|
|
||||||
|
|
||||||
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher){
|
|
||||||
MCEventBus.INSTANCE.register(INSTANCE);
|
|
||||||
dispatcher.register(literal("cfindblock").then(argument("方块名字", StringArgumentType.string()).executes(CFindBlockCommand::execute)));
|
|
||||||
}
|
|
||||||
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
|
||||||
String blockName=context.getArgument("方块名字", String.class);
|
|
||||||
Utils.findBlock(mc.player,blockName,10);
|
|
||||||
return Command.SINGLE_SUCCESS;
|
|
||||||
}
|
|
||||||
@Subscribe
|
|
||||||
private void onRenderWorld(RenderWorldEvent event){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -9,14 +9,14 @@ import net.minecraft.text.Text;
|
|||||||
|
|
||||||
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal;
|
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal;
|
||||||
|
|
||||||
public class CFullbirghtCommand{
|
public class CFullbirghtCommand {
|
||||||
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher){
|
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher) {
|
||||||
dispatcher.register(literal("cfullbirght").executes(CFullbirghtCommand::execute));
|
dispatcher.register(literal("cfullbirght").executes(CFullbirghtCommand::execute));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
||||||
((SimpleOptionAccessor)(Object)context.getSource().getClient().options.getGamma()).forceSetValue(32767.0);
|
((SimpleOptionAccessor) (Object) context.getSource().getClient().options.getGamma()).forceSetValue(32767.0);
|
||||||
context.getSource().getPlayer().sendMessage(Text.literal("已应用高亮"));
|
context.getSource().getPlayer().sendMessage(Text.literal("已应用高亮"), false);
|
||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
package com.expvintl.mctools.commands;
|
package com.expvintl.mctools.commands;
|
||||||
|
|
||||||
import com.expvintl.mctools.FeaturesBool;
|
import com.expvintl.mctools.FeaturesSettings;
|
||||||
import com.expvintl.mctools.events.MCEventBus;
|
import com.expvintl.mctools.events.MCEventBus;
|
||||||
import com.expvintl.mctools.events.network.PacketSendEvent;
|
import com.expvintl.mctools.events.network.PacketSendEvent;
|
||||||
import com.expvintl.mctools.mixin.interfaces.PlayerMoveC2SPacketAccessor;
|
import com.expvintl.mctools.mixin.interfaces.PlayerMoveC2SPacketAccessor;
|
||||||
|
import com.expvintl.mctools.utils.CommandUtils;
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import com.mojang.brigadier.Command;
|
import com.mojang.brigadier.Command;
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
@ -22,15 +23,17 @@ public class CNoFallPacketCommand {
|
|||||||
private static final MinecraftClient mc=MinecraftClient.getInstance();
|
private static final MinecraftClient mc=MinecraftClient.getInstance();
|
||||||
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher){
|
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher){
|
||||||
MCEventBus.INSTANCE.register(INSTANCE);
|
MCEventBus.INSTANCE.register(INSTANCE);
|
||||||
|
CommandUtils.CreateStatusCommand("cnofallpacket", FeaturesSettings.INSTANCE.noFallPacket, dispatcher);
|
||||||
|
|
||||||
dispatcher.register(literal("cnofallpacket").then(argument("开关", BoolArgumentType.bool()).executes(CNoFallPacketCommand::execute)));
|
dispatcher.register(literal("cnofallpacket").then(argument("开关", BoolArgumentType.bool()).executes(CNoFallPacketCommand::execute)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
||||||
FeaturesBool.noFallPacket=context.getArgument("开关", Boolean.class);
|
FeaturesSettings.INSTANCE.noFallPacket.setValue(context.getArgument("开关", Boolean.class));
|
||||||
if(FeaturesBool.noFallPacket){
|
if(FeaturesSettings.INSTANCE.noFallPacket.getValue()){
|
||||||
context.getSource().getPlayer().sendMessage(Text.literal("已启用无坠落数据包!"));
|
context.getSource().getPlayer().sendMessage(Text.literal("已启用摔落伤害!"),false);
|
||||||
}else{
|
}else{
|
||||||
context.getSource().getPlayer().sendMessage(Text.literal("已禁用无坠落数据包!"));
|
context.getSource().getPlayer().sendMessage(Text.literal("已禁用摔落伤害!"),false);
|
||||||
}
|
}
|
||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -39,9 +42,9 @@ public class CNoFallPacketCommand {
|
|||||||
//跳过非移动的数据包
|
//跳过非移动的数据包
|
||||||
if(!(event.packet instanceof PlayerMoveC2SPacket)) return;
|
if(!(event.packet instanceof PlayerMoveC2SPacket)) return;
|
||||||
//跳过创造
|
//跳过创造
|
||||||
if(FeaturesBool.noFallPacket&& !mc.player.getAbilities().creativeMode){
|
if(FeaturesSettings.INSTANCE.noFallPacket.getValue()&& !mc.player.getAbilities().creativeMode){
|
||||||
if(mc.player.isFallFlying()) return;
|
if(mc.player.fallDistance<=mc.player.getSafeFallDistance()) return;
|
||||||
if(mc.player.getVelocity().y>-0.5) return;
|
if(mc.player.getVelocity().y> -0.5) return;
|
||||||
//直接发送在地面的数据包来免伤
|
//直接发送在地面的数据包来免伤
|
||||||
((PlayerMoveC2SPacketAccessor)event.packet).setOnGround(true);
|
((PlayerMoveC2SPacketAccessor)event.packet).setOnGround(true);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.expvintl.mctools.commands;
|
package com.expvintl.mctools.commands;
|
||||||
|
|
||||||
import com.expvintl.mctools.FeaturesBool;
|
import com.expvintl.mctools.FeaturesSettings;
|
||||||
import com.expvintl.mctools.events.MCEventBus;
|
import com.expvintl.mctools.events.MCEventBus;
|
||||||
import com.expvintl.mctools.events.network.PacketReceiveEvent;
|
import com.expvintl.mctools.events.network.PacketReceiveEvent;
|
||||||
import com.expvintl.mctools.utils.Utils;
|
import com.expvintl.mctools.utils.Utils;
|
||||||
@ -29,13 +29,13 @@ public class CQServerPluginsCommand {
|
|||||||
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
||||||
//注册数据包接受事件
|
//注册数据包接受事件
|
||||||
MCEventBus.INSTANCE.register(INSTANCE);
|
MCEventBus.INSTANCE.register(INSTANCE);
|
||||||
FeaturesBool.checkBukkitPlugins=true;
|
FeaturesSettings.INSTANCE.checkBukkitPlugins.setValue(true);
|
||||||
context.getSource().getPlayer().networkHandler.sendPacket(new RequestCommandCompletionsC2SPacket(new Random().nextInt(200),"bukkit:ver "));
|
context.getSource().getPlayer().networkHandler.sendPacket(new RequestCommandCompletionsC2SPacket(new Random().nextInt(200),"bukkit:ver "));
|
||||||
//1秒后关闭避免识别其他命令提示
|
//1秒后关闭避免识别其他命令提示
|
||||||
Utils.timer.schedule(new TimerTask() {
|
Utils.timer.schedule(new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
FeaturesBool.checkBukkitPlugins=false;
|
FeaturesSettings.INSTANCE.checkBukkitPlugins.setValue(false);
|
||||||
MCEventBus.INSTANCE.unregister(INSTANCE);
|
MCEventBus.INSTANCE.unregister(INSTANCE);
|
||||||
}
|
}
|
||||||
},1000);
|
},1000);
|
||||||
@ -44,7 +44,7 @@ public class CQServerPluginsCommand {
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onReceivePacket(PacketReceiveEvent p){
|
public void onReceivePacket(PacketReceiveEvent p){
|
||||||
//探测bukkit服务器插件
|
//探测bukkit服务器插件
|
||||||
if (!MinecraftClient.getInstance().isIntegratedServerRunning()&&FeaturesBool.checkBukkitPlugins) {
|
if (!MinecraftClient.getInstance().isIntegratedServerRunning()&& FeaturesSettings.INSTANCE.checkBukkitPlugins.getValue()) {
|
||||||
if (p.packet instanceof CommandSuggestionsS2CPacket sg) {
|
if (p.packet instanceof CommandSuggestionsS2CPacket sg) {
|
||||||
StringBuilder buf=new StringBuilder();
|
StringBuilder buf=new StringBuilder();
|
||||||
buf.append(String.format("找到%d个插件:",sg.getSuggestions().getList().size())).append('\n');
|
buf.append(String.format("找到%d个插件:",sg.getSuggestions().getList().size())).append('\n');
|
||||||
@ -52,9 +52,9 @@ public class CQServerPluginsCommand {
|
|||||||
buf.append('[').append(s.getText()).append(']').append(' ');
|
buf.append('[').append(s.getText()).append(']').append(' ');
|
||||||
}
|
}
|
||||||
if(MinecraftClient.getInstance().player!=null){
|
if(MinecraftClient.getInstance().player!=null){
|
||||||
MinecraftClient.getInstance().player.sendMessage(Text.literal(buf.toString()));
|
MinecraftClient.getInstance().player.sendMessage(Text.literal(buf.toString()),false);
|
||||||
}
|
}
|
||||||
FeaturesBool.checkBukkitPlugins=false;
|
FeaturesSettings.INSTANCE.checkBukkitPlugins.setValue(false);
|
||||||
//取消事件注册
|
//取消事件注册
|
||||||
MCEventBus.INSTANCE.unregister(INSTANCE);
|
MCEventBus.INSTANCE.unregister(INSTANCE);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.expvintl.mctools.commands;
|
package com.expvintl.mctools.commands;
|
||||||
|
|
||||||
import com.expvintl.mctools.FeaturesBool;
|
import com.expvintl.mctools.FeaturesSettings;
|
||||||
|
import com.expvintl.mctools.utils.CommandUtils;
|
||||||
import com.mojang.brigadier.Command;
|
import com.mojang.brigadier.Command;
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
import com.mojang.brigadier.arguments.BoolArgumentType;
|
import com.mojang.brigadier.arguments.BoolArgumentType;
|
||||||
@ -13,15 +14,17 @@ import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.lit
|
|||||||
|
|
||||||
public class CSafeWalkCommand {
|
public class CSafeWalkCommand {
|
||||||
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher){
|
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher){
|
||||||
|
CommandUtils.CreateStatusCommand("cselfwalk", FeaturesSettings.INSTANCE.safeWalk, dispatcher);
|
||||||
|
|
||||||
dispatcher.register(literal("cselfwalk").then(argument("开关", BoolArgumentType.bool()).executes(CSafeWalkCommand::execute)));
|
dispatcher.register(literal("cselfwalk").then(argument("开关", BoolArgumentType.bool()).executes(CSafeWalkCommand::execute)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
||||||
FeaturesBool.selfWalk=context.getArgument("开关", Boolean.class);
|
FeaturesSettings.INSTANCE.safeWalk.setValue(context.getArgument("开关", Boolean.class));
|
||||||
if(FeaturesBool.selfWalk){
|
if(FeaturesSettings.INSTANCE.safeWalk.getValue()){
|
||||||
context.getSource().getPlayer().sendMessage(Text.literal("已启用自动挂边!"));
|
context.getSource().getPlayer().sendMessage(Text.literal("已启用自动挂边!"),false);
|
||||||
}else{
|
}else{
|
||||||
context.getSource().getPlayer().sendMessage(Text.literal("已禁用自动挂边!"));
|
context.getSource().getPlayer().sendMessage(Text.literal("已禁用自动挂边!"),false);
|
||||||
}
|
}
|
||||||
return Command.SINGLE_SUCCESS;
|
return Command.SINGLE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.expvintl.mctools.events.hud;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.network.PlayerListEntry;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
public class RenderLatencyIconEvent {
|
||||||
|
public static RenderLatencyIconEvent INSTANCE=new RenderLatencyIconEvent();
|
||||||
|
public DrawContext draw;
|
||||||
|
public PlayerListEntry entry;
|
||||||
|
public CallbackInfo callback;
|
||||||
|
public int x,y,width;
|
||||||
|
public static RenderLatencyIconEvent get(DrawContext draw,int width,int x,int y,PlayerListEntry 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,18 @@
|
|||||||
|
package com.expvintl.mctools.events.item;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ItemStackTooltipEvent {
|
||||||
|
public static ItemStackTooltipEvent INSTANCE=new ItemStackTooltipEvent();
|
||||||
|
public ItemStack item;
|
||||||
|
public List<Text> textList;
|
||||||
|
|
||||||
|
public static ItemStackTooltipEvent get(ItemStack item,List<Text> list){
|
||||||
|
INSTANCE.item=item;
|
||||||
|
INSTANCE.textList=list;
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.expvintl.mctools.events.player;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
|
||||||
|
public class PlayerAttackEntityEvent {
|
||||||
|
private static final PlayerAttackEntityEvent INSTANCE=new PlayerAttackEntityEvent();
|
||||||
|
public PlayerEntity player;
|
||||||
|
public Entity target;
|
||||||
|
public static PlayerAttackEntityEvent get(PlayerEntity playerEntity, Entity target){
|
||||||
|
INSTANCE.player=playerEntity;
|
||||||
|
INSTANCE.target=target;
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.expvintl.mctools.mixin.client;
|
||||||
|
|
||||||
|
import com.expvintl.mctools.modules.CameraZoom;
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||||
|
import net.minecraft.client.render.GameRenderer;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
|
@Mixin(GameRenderer.class)
|
||||||
|
public class GameRendererMixin {
|
||||||
|
@ModifyReturnValue(method = "getFov",at=@At("RETURN"))
|
||||||
|
private double getFov(double original){
|
||||||
|
return CameraZoom.INSTANCE.isZoom?20.f:original;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.expvintl.mctools.mixin.hud;
|
||||||
|
|
||||||
|
import com.expvintl.mctools.utils.Utils;
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyReceiver;
|
||||||
|
import com.llamalad7.mixinextras.sugar.Local;
|
||||||
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.gui.hud.ChatHud;
|
||||||
|
import net.minecraft.client.gui.hud.ChatHudLine;
|
||||||
|
import net.minecraft.text.OrderedText;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
|
@Mixin(ChatHud.class)
|
||||||
|
public class ChatHudMixin {
|
||||||
|
@ModifyReceiver(method = "render",at=@At(value = "INVOKE",target = "Lnet/minecraft/client/gui/DrawContext;drawTextWithShadow(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/text/OrderedText;III)I"))
|
||||||
|
private DrawContext onRenderDrawTextWithShadow(DrawContext context, TextRenderer renderer, OrderedText text, int x, int y, int color, @Local ChatHudLine.Visible line){
|
||||||
|
Utils.DrawHeadIcon(context,line,y);
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.expvintl.mctools.mixin.hud;
|
||||||
|
|
||||||
|
import com.expvintl.mctools.events.MCEventBus;
|
||||||
|
import com.expvintl.mctools.events.hud.RenderLatencyIconEvent;
|
||||||
|
import com.expvintl.mctools.utils.Utils;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.gui.hud.PlayerListHud;
|
||||||
|
import net.minecraft.client.network.PlayerListEntry;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
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(PlayerListHud.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 = "getPlayerName",at=@At("HEAD"),cancellable = true)
|
||||||
|
private void getPlayerName(PlayerListEntry entry, CallbackInfoReturnable<Text> info){
|
||||||
|
if(Utils.isReady()){
|
||||||
|
Text name=entry.getDisplayName();
|
||||||
|
if(MinecraftClient.getInstance().player==null||name==null) return;
|
||||||
|
if(entry.getProfile().getId().toString().equals(MinecraftClient.getInstance().player.getGameProfile().getId().toString())){
|
||||||
|
info.setReturnValue(Text.literal(name.getString()).setStyle(name.getStyle().withColor(0xff0000)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "renderLatencyIcon",at=@At("HEAD"),cancellable = true)
|
||||||
|
private void onRenderLatencyIcon(DrawContext draw, int width, int x, int y, PlayerListEntry entry, CallbackInfo info){
|
||||||
|
MCEventBus.INSTANCE.post(RenderLatencyIconEvent.get(draw,width,x,y,entry,info));
|
||||||
|
}
|
||||||
|
|
||||||
|
//强制启用Tab列表玩家头像
|
||||||
|
@ModifyVariable(method = "render",at = @At(value = "STORE",ordinal = 0),ordinal = 0)
|
||||||
|
private boolean hackShowPlayerHeadIcon(boolean b1){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.expvintl.mctools.mixin.item;
|
||||||
|
|
||||||
|
import com.expvintl.mctools.events.MCEventBus;
|
||||||
|
import com.expvintl.mctools.events.item.ItemStackTooltipEvent;
|
||||||
|
import com.expvintl.mctools.utils.Utils;
|
||||||
|
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mixin(ItemStack.class)
|
||||||
|
public class ItemStackMixin {
|
||||||
|
@ModifyReturnValue(method = "getTooltip",at=@At("RETURN"))
|
||||||
|
private List<Text> onGetTooltip(List<Text> list) {
|
||||||
|
if(Utils.isReady()) {
|
||||||
|
ItemStackTooltipEvent event=ItemStackTooltipEvent.get((ItemStack) (Object) this, list);
|
||||||
|
MCEventBus.INSTANCE.post(event);
|
||||||
|
return event.textList;
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
@ -2,13 +2,17 @@ package com.expvintl.mctools.mixin.player;
|
|||||||
|
|
||||||
import com.expvintl.mctools.events.MCEventBus;
|
import com.expvintl.mctools.events.MCEventBus;
|
||||||
import com.expvintl.mctools.events.player.PlayerAttackBlockEvent;
|
import com.expvintl.mctools.events.player.PlayerAttackBlockEvent;
|
||||||
|
import com.expvintl.mctools.events.player.PlayerAttackEntityEvent;
|
||||||
import com.expvintl.mctools.events.player.PlayerBreakBlockEvent;
|
import com.expvintl.mctools.events.player.PlayerBreakBlockEvent;
|
||||||
import net.minecraft.client.network.ClientPlayerInteractionManager;
|
import net.minecraft.client.network.ClientPlayerInteractionManager;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
@Mixin(ClientPlayerInteractionManager.class)
|
@Mixin(ClientPlayerInteractionManager.class)
|
||||||
@ -21,4 +25,8 @@ public class ClientPlayerInteractionManagerMixin {
|
|||||||
private void onAttackBlock(BlockPos blockPos, Direction direction, CallbackInfoReturnable<Boolean> info){
|
private void onAttackBlock(BlockPos blockPos, Direction direction, CallbackInfoReturnable<Boolean> info){
|
||||||
MCEventBus.INSTANCE.post(PlayerAttackBlockEvent.get(blockPos,direction));
|
MCEventBus.INSTANCE.post(PlayerAttackBlockEvent.get(blockPos,direction));
|
||||||
}
|
}
|
||||||
|
@Inject(method = "attackEntity",at=@At("HEAD"))
|
||||||
|
private void onAttackEntity(PlayerEntity player, Entity target, CallbackInfo info){
|
||||||
|
MCEventBus.INSTANCE.post(PlayerAttackEntityEvent.get(player,target));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.expvintl.mctools.mixin.player;
|
package com.expvintl.mctools.mixin.player;
|
||||||
|
|
||||||
import com.expvintl.mctools.FeaturesBool;
|
import com.expvintl.mctools.FeaturesSettings;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@ -15,7 +15,7 @@ public class PlayerEntityMixin {
|
|||||||
if(MinecraftClient.getInstance().world!=null&&MinecraftClient.getInstance().player!=null) {
|
if(MinecraftClient.getInstance().world!=null&&MinecraftClient.getInstance().player!=null) {
|
||||||
if (!MinecraftClient.getInstance().world.isClient) return;
|
if (!MinecraftClient.getInstance().world.isClient) return;
|
||||||
//挂住边缘
|
//挂住边缘
|
||||||
if (FeaturesBool.selfWalk && !MinecraftClient.getInstance().player.isSneaking()) cir.setReturnValue(true);
|
if (FeaturesSettings.INSTANCE.safeWalk.getValue() && !MinecraftClient.getInstance().player.isSneaking()) cir.setReturnValue(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.expvintl.mctools.modules;
|
||||||
|
|
||||||
|
import com.expvintl.mctools.events.MCEventBus;
|
||||||
|
import com.expvintl.mctools.events.item.ItemStackTooltipEvent;
|
||||||
|
import com.google.common.eventbus.Subscribe;
|
||||||
|
|
||||||
|
public class BetterTooltip {
|
||||||
|
public static BetterTooltip INSTANCE=new BetterTooltip();
|
||||||
|
public void init(){
|
||||||
|
MCEventBus.INSTANCE.register(INSTANCE);
|
||||||
|
}
|
||||||
|
@Subscribe
|
||||||
|
public void onGetTooltip(ItemStackTooltipEvent event){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
19
src/main/java/com/expvintl/mctools/modules/CameraZoom.java
Normal file
19
src/main/java/com/expvintl/mctools/modules/CameraZoom.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package com.expvintl.mctools.modules;
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||||
|
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
||||||
|
import net.minecraft.client.option.KeyBinding;
|
||||||
|
import net.minecraft.client.util.InputUtil;
|
||||||
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
|
public class CameraZoom {
|
||||||
|
public static CameraZoom INSTANCE=new CameraZoom();
|
||||||
|
public boolean isZoom=false;
|
||||||
|
public void init(){
|
||||||
|
KeyBinding zoom= KeyBindingHelper.registerKeyBinding(new KeyBinding("镜头放大", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_C,"MyTools"));
|
||||||
|
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||||
|
isZoom=zoom.isPressed();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.expvintl.mctools.modules;
|
||||||
|
|
||||||
|
import com.expvintl.mctools.events.MCEventBus;
|
||||||
|
import com.expvintl.mctools.events.hud.RenderLatencyIconEvent;
|
||||||
|
import com.google.common.eventbus.Subscribe;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
|
||||||
|
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<=100){ //60-100
|
||||||
|
return 0xFFFF00; //黄色
|
||||||
|
}else if(latency>100&&latency<=200){//100-200
|
||||||
|
return 0xFFA500; //橙色
|
||||||
|
}else if(latency>200){ //>200
|
||||||
|
return 0xFF0000; //红色
|
||||||
|
}
|
||||||
|
return 0xFFFFFF; //默认白色
|
||||||
|
}
|
||||||
|
@Subscribe
|
||||||
|
public void onRenderLatencyIcon(RenderLatencyIconEvent event){
|
||||||
|
TextRenderer renderer=MinecraftClient.getInstance().textRenderer;
|
||||||
|
int latency=Math.clamp(event.entry.getLatency(),0,999);
|
||||||
|
String text=latency+" ms";
|
||||||
|
event.draw.drawTextWithShadow(renderer,text, event.x+event.width-renderer.getWidth(text),event.y,calcLatencyColor(latency));
|
||||||
|
event.callback.cancel();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.expvintl.mctools.settingtype;
|
||||||
|
|
||||||
|
public class BooleanSetting {
|
||||||
|
private boolean value;
|
||||||
|
|
||||||
|
public void setValue(boolean value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
78
src/main/java/com/expvintl/mctools/texthud/MCInfo.java
Normal file
78
src/main/java/com/expvintl/mctools/texthud/MCInfo.java
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
package com.expvintl.mctools.texthud;
|
||||||
|
|
||||||
|
import com.expvintl.mctools.utils.DrawUtils;
|
||||||
|
import com.expvintl.mctools.utils.Utils;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
|
import net.minecraft.client.render.RenderTickCounter;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
public static void drawHUD(DrawContext drawContext, float v) {
|
||||||
|
MinecraftClient mc=MinecraftClient.getInstance();
|
||||||
|
//跳过调试
|
||||||
|
if(mc.getDebugHud().shouldShowDebugHud()||mc.options.hudHidden) return;
|
||||||
|
if(mc.world!=null&&mc.player!=null) {
|
||||||
|
DrawUtils.leftTextY =1;
|
||||||
|
int selfPing=0;
|
||||||
|
ClientPlayerEntity p=mc.player;
|
||||||
|
if(mc.getNetworkHandler()!=null&&mc.getNetworkHandler().getPlayerListEntry(mc.player.getGameProfile().getId())!=null) {
|
||||||
|
selfPing=mc.getNetworkHandler().getPlayerListEntry(mc.player.getGameProfile().getId()).getLatency();
|
||||||
|
}
|
||||||
|
Vec3d playerPos=p.getPos();
|
||||||
|
DrawUtils.AddLeftText(drawContext,String.format("%d FPS",mc.getCurrentFps()));
|
||||||
|
DrawUtils.AddLeftText(drawContext,String.format("Ping: %d 毫秒",selfPing));
|
||||||
|
DrawUtils.AddLeftText(drawContext,String.format("亮度:%d",mc.world.getLightLevel(p.getBlockPos())));
|
||||||
|
DrawUtils.AddLeftText(drawContext,String.format("当前维度:%s", Utils.getCurrentDimensionName()));
|
||||||
|
DrawUtils.AddLeftText(drawContext,String.format("当前群系:%s",Utils.getCurrentBiomeName()));
|
||||||
|
if(Utils.getCurrentDimensionName().equals("下界")){
|
||||||
|
DrawUtils.AddLeftText(drawContext,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(drawContext,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(drawContext,String.format("X:%.2f Y:%.2f Z:%.2f",playerPos.x,playerPos.y,playerPos.z));
|
||||||
|
}
|
||||||
|
DrawUtils.AddLeftText(drawContext,String.format("世界时间: %d天 (%s)",mc.world.getTimeOfDay()/24000,gameDayToRealTimeFormat(mc.world.getTimeOfDay()/24000)));
|
||||||
|
DrawUtils.AddLeftText(drawContext,String.format("当前区块: %d,%d 方块:[%d,%d]",mc.player.getChunkPos().x,mc.player.getChunkPos().z,mc.player.getBlockX()&0xf,mc.player.getBlockZ()&0xf));
|
||||||
|
DrawUtils.AddLeftText(drawContext,String.format("本地难度:%.2f",mc.world.getLocalDifficulty(mc.player.getBlockPos()).getLocalDifficulty()));
|
||||||
|
ItemStack currentItem=p.getMainHandStack();
|
||||||
|
if(Objects.nonNull(currentItem)&¤tItem.isDamageable()){
|
||||||
|
DrawUtils.AddLeftText(drawContext,String.format("耐久度:%d/%d",currentItem.getMaxDamage()-currentItem.getDamage(),currentItem.getMaxDamage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
40
src/main/java/com/expvintl/mctools/texthud/PotionInfo.java
Normal file
40
src/main/java/com/expvintl/mctools/texthud/PotionInfo.java
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package com.expvintl.mctools.texthud;
|
||||||
|
|
||||||
|
import com.expvintl.mctools.utils.DrawUtils;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.render.RenderTickCounter;
|
||||||
|
import net.minecraft.client.resource.language.I18n;
|
||||||
|
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
public class PotionInfo {
|
||||||
|
public static void drawHUD(DrawContext drawContext, float v) {
|
||||||
|
MinecraftClient mc=MinecraftClient.getInstance();
|
||||||
|
//跳过调试
|
||||||
|
if(mc.getDebugHud().shouldShowDebugHud()||mc.options.hudHidden) return;
|
||||||
|
|
||||||
|
if(mc.world!=null&&mc.player!=null) {
|
||||||
|
DrawUtils.rightBottomY=1;
|
||||||
|
Collection<StatusEffectInstance> effects=mc.player.getStatusEffects();
|
||||||
|
for(StatusEffectInstance instance:effects){
|
||||||
|
DrawUtils.AddRightBottomText(drawContext,String.format("%s%d (%s)", I18n.translate(instance.getTranslationKey()),
|
||||||
|
instance.getAmplifier()+1,
|
||||||
|
instance.isInfinite()?"无限":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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
17
src/main/java/com/expvintl/mctools/utils/CommandUtils.java
Normal file
17
src/main/java/com/expvintl/mctools/utils/CommandUtils.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package com.expvintl.mctools.utils;
|
||||||
|
|
||||||
|
import com.expvintl.mctools.settingtype.BooleanSetting;
|
||||||
|
import com.mojang.brigadier.Command;
|
||||||
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
|
||||||
|
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal;
|
||||||
|
public class CommandUtils {
|
||||||
|
public static void CreateStatusCommand(String cmd, BooleanSetting setting, CommandDispatcher<FabricClientCommandSource> dispatcher){
|
||||||
|
dispatcher.register(literal(cmd).executes((context -> {
|
||||||
|
context.getSource().getPlayer().sendMessage(Text.literal("当前启用状态: "+setting.getValue()),false);
|
||||||
|
return Command.SINGLE_SUCCESS;
|
||||||
|
})));
|
||||||
|
}
|
||||||
|
}
|
26
src/main/java/com/expvintl/mctools/utils/DrawUtils.java
Normal file
26
src/main/java/com/expvintl/mctools/utils/DrawUtils.java
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package com.expvintl.mctools.utils;
|
||||||
|
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.util.Colors;
|
||||||
|
|
||||||
|
public class DrawUtils {
|
||||||
|
public static int leftTextY=1;
|
||||||
|
public static int rightTextY=1;
|
||||||
|
public static int rightBottomY=1;
|
||||||
|
public static void AddLeftText(DrawContext drawContext, String text){
|
||||||
|
MinecraftClient mc=MinecraftClient.getInstance();
|
||||||
|
drawContext.drawText(mc.textRenderer,text,0,leftTextY, Colors.WHITE,false);
|
||||||
|
leftTextY+=10;
|
||||||
|
}
|
||||||
|
public static void AddRightText(DrawContext drawContext, String text){
|
||||||
|
MinecraftClient mc=MinecraftClient.getInstance();
|
||||||
|
drawContext.drawText(mc.textRenderer,text,drawContext.getScaledWindowWidth()-2-mc.textRenderer.getWidth(text),rightTextY, Colors.WHITE,false);
|
||||||
|
rightTextY+=10;
|
||||||
|
}
|
||||||
|
public static void AddRightBottomText(DrawContext drawContext, String text){
|
||||||
|
MinecraftClient mc=MinecraftClient.getInstance();
|
||||||
|
drawContext.drawText(mc.textRenderer,text,drawContext.getScaledWindowWidth()-2-mc.textRenderer.getWidth(text),drawContext.getScaledWindowHeight()-10-rightBottomY, Colors.WHITE,false);
|
||||||
|
rightBottomY+=10;
|
||||||
|
}
|
||||||
|
}
|
12
src/main/java/com/expvintl/mctools/utils/PlayerUtils.java
Normal file
12
src/main/java/com/expvintl/mctools/utils/PlayerUtils.java
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package com.expvintl.mctools.utils;
|
||||||
|
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.screen.slot.SlotActionType;
|
||||||
|
|
||||||
|
public class PlayerUtils {
|
||||||
|
public static void DropItem(int slot){
|
||||||
|
MinecraftClient mc=MinecraftClient.getInstance();
|
||||||
|
if(mc.interactionManager==null||mc.player==null) return;
|
||||||
|
mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, slot,1, SlotActionType.THROW,mc.player);
|
||||||
|
}
|
||||||
|
}
|
@ -1,42 +1,34 @@
|
|||||||
package com.expvintl.mctools.utils;
|
package com.expvintl.mctools.utils;
|
||||||
|
|
||||||
import com.expvintl.mctools.mixin.interfaces.MinecraftClientAccessor;
|
import com.expvintl.mctools.mixin.interfaces.MinecraftClientAccessor;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.authlib.GameProfile;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.client.gui.PlayerSkinDrawer;
|
||||||
import net.minecraft.client.gui.hud.ChatHudLine;
|
import net.minecraft.client.gui.hud.ChatHudLine;
|
||||||
import net.minecraft.client.network.ClientPlayerEntity;
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
import net.minecraft.client.network.PlayerListEntry;
|
import net.minecraft.client.network.PlayerListEntry;
|
||||||
import net.minecraft.enchantment.Enchantment;
|
|
||||||
import net.minecraft.enchantment.Enchantments;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.Items;
|
|
||||||
import net.minecraft.registry.RegistryKey;
|
import net.minecraft.registry.RegistryKey;
|
||||||
import net.minecraft.registry.entry.RegistryEntry;
|
|
||||||
import net.minecraft.text.MutableText;
|
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.biome.Biome;
|
import net.minecraft.world.biome.Biome;
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.logging.Logger;
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class Utils {
|
public class Utils {
|
||||||
private static final MinecraftClient mc = MinecraftClient.getInstance();
|
private static final MinecraftClient mc = MinecraftClient.getInstance();
|
||||||
public static final Timer timer = new Timer();
|
public static final Timer timer = new Timer();
|
||||||
|
private static final Pattern usernameRegex = Pattern.compile("^(?:<[0-9]{2}:[0-9]{2}>\\s)?<(.*?)>.*");
|
||||||
|
|
||||||
public static String getCurrentDimensionName() {
|
public static String getCurrentDimensionName() {
|
||||||
if (mc.world != null) {
|
if (mc.world != null) {
|
||||||
String dismenName = mc.world.getDimensionEntry().getIdAsString();
|
String dismenName = mc.world.getDimensionKey().getValue().toString();
|
||||||
switch (dismenName) {
|
switch (dismenName) {
|
||||||
case "minecraft:overworld":
|
case "minecraft:overworld":
|
||||||
return "主世界";
|
return "主世界";
|
||||||
@ -191,18 +183,6 @@ public class Utils {
|
|||||||
return "未知";
|
return "未知";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetEnchantLevel(RegistryKey<Enchantment> enchantName, ItemStack item){
|
|
||||||
//跳过附魔书
|
|
||||||
if(item.getItem()== Items.ENCHANTED_BOOK) return 0;
|
|
||||||
Set<Object2IntMap.Entry<RegistryEntry<Enchantment>>> enchants=item.getEnchantments().getEnchantmentEntries();
|
|
||||||
for(Object2IntMap.Entry<RegistryEntry<Enchantment>> entry:enchants){
|
|
||||||
//返回找到的附魔等级
|
|
||||||
if(entry.getKey().matchesKey(enchantName)) {
|
|
||||||
return entry.getIntValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
public static void rightClick() {
|
public static void rightClick() {
|
||||||
((MinecraftClientAccessor) mc).doItemUse();
|
((MinecraftClientAccessor) mc).doItemUse();
|
||||||
}
|
}
|
||||||
@ -215,10 +195,38 @@ public class Utils {
|
|||||||
for (int z = (int) -pos.z; z < (pos.z + radius); z++) {
|
for (int z = (int) -pos.z; z < (pos.z + radius); z++) {
|
||||||
BlockState b = mc.world.getBlockState(new BlockPos(x, hight, z));
|
BlockState b = mc.world.getBlockState(new BlockPos(x, hight, z));
|
||||||
if (b.getBlock().asItem().getName().getString().equals(itemName)) {
|
if (b.getBlock().asItem().getName().getString().equals(itemName)) {
|
||||||
mc.player.sendMessage(Text.literal(String.format("找到方块:%d,%d,%d", x, hight, z)));
|
mc.player.sendMessage(Text.literal(String.format("找到方块:%d,%d,%d", x, hight, z)),false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static boolean isReady(){
|
||||||
|
MinecraftClient cli=MinecraftClient.getInstance();
|
||||||
|
return cli!=null&&cli.world!=null&&cli.player!=null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DrawHeadIcon(DrawContext draw, ChatHudLine.Visible text,int y){
|
||||||
|
StringBuffer buf=new StringBuffer();
|
||||||
|
text.content().accept((idx,style,codePoint)->{
|
||||||
|
buf.appendCodePoint(codePoint);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
String txt=buf.toString();
|
||||||
|
GameProfile sender=getChatSender(txt);
|
||||||
|
if(sender==null) return;
|
||||||
|
PlayerListEntry entry = mc.getNetworkHandler().getPlayerListEntry(sender.getId());
|
||||||
|
if (entry == null) return;
|
||||||
|
PlayerSkinDrawer.draw(draw,entry.getSkinTextures(),0,y,8);
|
||||||
|
draw.getMatrices().translate(10, 0, 0);
|
||||||
|
}
|
||||||
|
public static GameProfile getChatSender(String text){
|
||||||
|
Matcher usernameMatcher=usernameRegex.matcher(text);
|
||||||
|
if(usernameMatcher.matches()){
|
||||||
|
String username=usernameMatcher.group(1);
|
||||||
|
PlayerListEntry entry=mc.getNetworkHandler().getPlayerListEntry(username);
|
||||||
|
if(entry!=null) return entry.getProfile();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,6 @@
|
|||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.8.0",
|
"fabricloader": ">=0.8.0",
|
||||||
"fabric": "*",
|
"fabric": "*",
|
||||||
"minecraft": "~1.21"
|
"minecraft": "~1.20.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,19 @@
|
|||||||
"required": true,
|
"required": true,
|
||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"package": "com.expvintl.mctools.mixin",
|
"package": "com.expvintl.mctools.mixin",
|
||||||
"compatibilityLevel": "JAVA_21",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
|
"hud.ChatHudMixin",
|
||||||
|
"hud.PlayerListHudMixin",
|
||||||
"interfaces.PlayerMoveC2SPacketAccessor",
|
"interfaces.PlayerMoveC2SPacketAccessor",
|
||||||
|
"item.ItemStackMixin",
|
||||||
"network.ClientConnectionMixin",
|
"network.ClientConnectionMixin",
|
||||||
"player.PlayerEntityMixin"
|
"player.PlayerEntityMixin"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"MinecraftClientMixin",
|
"MinecraftClientMixin",
|
||||||
"SoundSystemMixin",
|
"SoundSystemMixin",
|
||||||
|
"client.GameRendererMixin",
|
||||||
"interfaces.ClientPlayerInteractionManagerAccessor",
|
"interfaces.ClientPlayerInteractionManagerAccessor",
|
||||||
"interfaces.MinecraftClientAccessor",
|
"interfaces.MinecraftClientAccessor",
|
||||||
"interfaces.SimpleOptionAccessor",
|
"interfaces.SimpleOptionAccessor",
|
||||||
|
Reference in New Issue
Block a user