Compare commits
8 Commits
e4b2ca67d7
...
64cf681e6d
Author | SHA1 | Date | |
---|---|---|---|
64cf681e6d | |||
9365282f2b | |||
1e278af96e | |||
26c4556498 | |||
57d5c7ebe9 | |||
f68046edae | |||
987edc2250 | |||
2b9d2b60cf |
2
.github/workflows/ci_build.yml
vendored
2
.github/workflows/ci_build.yml
vendored
@ -1,4 +1,4 @@
|
||||
name: Build1.21
|
||||
name: Build
|
||||
|
||||
on: push
|
||||
|
||||
|
2
.idea/compiler.xml
generated
2
.idea/compiler.xml
generated
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="17" />
|
||||
<bytecodeTargetLevel target="21" />
|
||||
</component>
|
||||
</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">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_22" 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" />
|
||||
</component>
|
||||
</project>
|
6
.idea/modules.xml
generated
6
.idea/modules.xml
generated
@ -2,14 +2,8 @@
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<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>
|
||||
</component>
|
||||
</project>
|
2
.idea/runConfigurations/Minecraft_Server.xml
generated
2
.idea/runConfigurations/Minecraft_Server.xml
generated
@ -12,5 +12,5 @@
|
||||
|
||||
</envs>
|
||||
<shortenClasspath name="ARGS_FILE"/>
|
||||
<classpathModifications><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\3.3.3\29589b5f87ed335a6c7e7ee6a5775f81f97ecb84\lwjgl-3.3.3.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-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\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-tinyfd\3.3.3\82d755ca94b102e9ca77283b9e2dc46d1b15fbe5\lwjgl-tinyfd-3.3.3.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-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-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\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\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\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-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\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-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\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.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.apache.httpcomponents\httpcore\4.4.16\51cf043c87253c9f58b539c9f7e44c8894223850\httpcore-4.4.16.jar"/></classpathModifications></configuration>
|
||||
<classpathModifications><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\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\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-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\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\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\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.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.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.3\efa1eb78c5ccd840e9f329717109b5e892d72f8e\lwjgl-glfw-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\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-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\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-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\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.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-tinyfd\3.3.3\82d755ca94b102e9ca77283b9e2dc46d1b15fbe5\lwjgl-tinyfd-3.3.3.jar"/></classpathModifications></configuration>
|
||||
</component>
|
@ -3,7 +3,7 @@ plugins {
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
version = project.mod_version
|
||||
version = project.findProperty("minecraft_version")?.toString()?:"1.0"
|
||||
group = project.maven_group
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
@ -2,15 +2,15 @@
|
||||
org.gradle.jvmargs=-Xmx2G
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://modmuss50.me/fabric.html
|
||||
minecraft_version=1.21
|
||||
yarn_mappings=1.21+build.9
|
||||
loader_version=0.16.0
|
||||
# check these on https://modmuss50.me/fabric.html
|
||||
minecraft_version=1.21
|
||||
yarn_mappings=1.21+build.9
|
||||
loader_version=0.16.0
|
||||
|
||||
#Fabric api
|
||||
fabric_version=0.100.8+1.21
|
||||
#Fabric api
|
||||
fabric_version=0.100.8+1.21
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.0
|
||||
maven_group = com.expvintl
|
||||
archives_base_name = MCTools
|
||||
mod_version = 1.0
|
||||
maven_group = com.expvintl
|
||||
archives_base_name = MCTools
|
23
readme.md
23
readme.md
@ -1,3 +1,22 @@
|
||||
## 一个MC工具组
|
||||
<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)
|
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,13 +0,0 @@
|
||||
package com.expvintl.mctools;
|
||||
|
||||
import com.expvintl.mctools.types.Setting;
|
||||
|
||||
public class Globals {
|
||||
public static Setting autoRespawn=new Setting();
|
||||
public static Setting selfWalk=new Setting();
|
||||
public static Setting checkBukkitPlugins=new Setting();
|
||||
public static Setting autoTool=new Setting();
|
||||
public static Setting autoFish=new Setting();
|
||||
public static Setting noFallPacket=new Setting();
|
||||
public static int TPS=0;
|
||||
}
|
@ -2,6 +2,7 @@ package com.expvintl.mctools;
|
||||
|
||||
import com.expvintl.mctools.commands.*;
|
||||
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;
|
||||
@ -34,6 +35,7 @@ public class MCToolsClient implements ClientModInitializer {
|
||||
public void InitModules(){
|
||||
BetterTooltip.INSTANCE.init();
|
||||
PlayerListTextLatency.INSTANCE.init();
|
||||
CameraZoom.INSTANCE.init();
|
||||
}
|
||||
|
||||
private static void registerCommands(CommandDispatcher<FabricClientCommandSource> dispatcher, CommandRegistryAccess registryAccess) {
|
||||
@ -45,7 +47,6 @@ public class MCToolsClient implements ClientModInitializer {
|
||||
CAutoToolCommand.register(dispatcher);
|
||||
CQServerPluginsCommand.register(dispatcher);
|
||||
CNoFallPacketCommand.register(dispatcher);
|
||||
CFindBlockCommand.register(dispatcher);
|
||||
CFastDropCommand.register(dispatcher,registryAccess);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.expvintl.mctools.commands;
|
||||
|
||||
import com.expvintl.mctools.Globals;
|
||||
import com.expvintl.mctools.FeaturesSettings;
|
||||
import com.expvintl.mctools.events.MCEventBus;
|
||||
import com.expvintl.mctools.events.client.sounds.PlaySoundEvent;
|
||||
import com.expvintl.mctools.utils.CommandUtils;
|
||||
@ -22,23 +22,23 @@ public class CAutoFishCommand {
|
||||
private static final CAutoFishCommand INSTANCE=new CAutoFishCommand();
|
||||
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher){
|
||||
MCEventBus.INSTANCE.register(INSTANCE);
|
||||
CommandUtils.CreateStatusCommand("cautofish",Globals.autoFish,dispatcher);
|
||||
CommandUtils.CreateStatusCommand("cautofish", FeaturesSettings.INSTANCE.autoFish, dispatcher);
|
||||
|
||||
dispatcher.register(literal("cautofish").then(argument("开关", BoolArgumentType.bool()).executes(CAutoFishCommand::execute)));
|
||||
}
|
||||
|
||||
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
||||
Globals.autoFish.set(context.getArgument("开关", Boolean.class));
|
||||
if(Globals.autoFish.get()){
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已启用自动钓鱼!"));
|
||||
FeaturesSettings.INSTANCE.autoFish.setValue(context.getArgument("开关", Boolean.class));
|
||||
if(FeaturesSettings.INSTANCE.autoFish.getValue()){
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已启用自动钓鱼!"),false);
|
||||
}else{
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已禁用自动钓鱼!"));
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已禁用自动钓鱼!"),false);
|
||||
}
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
@Subscribe
|
||||
private void onPlaySound(PlaySoundEvent event){
|
||||
if(Globals.autoFish.get()) {
|
||||
if(FeaturesSettings.INSTANCE.autoFish.getValue()) {
|
||||
//自动钓鱼
|
||||
if (event.soundInstance.getId().getPath().equals("entity.fishing_bobber.splash")) {
|
||||
//收杆
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.expvintl.mctools.commands;
|
||||
|
||||
import com.expvintl.mctools.Globals;
|
||||
import com.expvintl.mctools.FeaturesSettings;
|
||||
import com.expvintl.mctools.events.MCEventBus;
|
||||
import com.expvintl.mctools.events.client.OpenScreenEvent;
|
||||
import com.expvintl.mctools.utils.CommandUtils;
|
||||
@ -21,22 +21,22 @@ public class CAutoRespawnCommand {
|
||||
private static final CAutoRespawnCommand INSTANCE=new CAutoRespawnCommand();
|
||||
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher){
|
||||
MCEventBus.INSTANCE.register(INSTANCE);
|
||||
CommandUtils.CreateStatusCommand("cautorespawn",Globals.autoRespawn,dispatcher);
|
||||
CommandUtils.CreateStatusCommand("cautorespawn", FeaturesSettings.INSTANCE.autoRespawn, dispatcher);
|
||||
dispatcher.register(literal("cautorespawn").then(argument("开关", BoolArgumentType.bool()).executes(CAutoRespawnCommand::execute)));
|
||||
}
|
||||
|
||||
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
||||
Globals.autoRespawn.set(context.getArgument("开关", Boolean.class));
|
||||
if(Globals.autoRespawn.get()){
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已启用自动重生!"));
|
||||
FeaturesSettings.INSTANCE.autoRespawn.setValue(context.getArgument("开关", Boolean.class));
|
||||
if(FeaturesSettings.INSTANCE.autoRespawn.getValue()){
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已启用自动重生!"),false);
|
||||
}else{
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已禁用自动重生!"));
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已禁用自动重生!"),false);
|
||||
}
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
@Subscribe
|
||||
private void onOpenScreen(OpenScreenEvent event){
|
||||
if(Globals.autoRespawn.get()) {
|
||||
if(FeaturesSettings.INSTANCE.autoRespawn.getValue()) {
|
||||
//自动重生
|
||||
if (event.screen instanceof DeathScreen) {
|
||||
if (MinecraftClient.getInstance().player != null) {
|
||||
|
@ -1,10 +1,9 @@
|
||||
package com.expvintl.mctools.commands;
|
||||
|
||||
import com.expvintl.mctools.Globals;
|
||||
import com.expvintl.mctools.FeaturesSettings;
|
||||
import com.expvintl.mctools.events.MCEventBus;
|
||||
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.mixin.interfaces.ClientPlayerInteractionManagerAccessor;
|
||||
import com.expvintl.mctools.utils.CommandUtils;
|
||||
import com.expvintl.mctools.utils.Utils;
|
||||
@ -14,61 +13,74 @@ import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.BoolArgumentType;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
|
||||
import net.minecraft.block.BambooBlock;
|
||||
import net.minecraft.block.BambooShootBlock;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
import net.minecraft.component.DataComponentTypes;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.component.type.AttributeModifiersComponent;
|
||||
import net.minecraft.enchantment.Enchantments;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.entity.attribute.EntityAttribute;
|
||||
import net.minecraft.entity.attribute.EntityAttributeModifier;
|
||||
import net.minecraft.entity.attribute.EntityAttributes;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.registry.entry.RegistryEntry;
|
||||
import net.minecraft.registry.tag.EntityTypeTags;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.world.GameMode;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.argument;
|
||||
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal;
|
||||
|
||||
public class CAutoToolCommand {
|
||||
private static final CAutoToolCommand INSTANCE=new CAutoToolCommand();
|
||||
private int lastSlot=-1;
|
||||
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher){
|
||||
MCEventBus.INSTANCE.register(INSTANCE);
|
||||
CommandUtils.CreateStatusCommand("cautotool",Globals.autoTool,dispatcher);
|
||||
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) {
|
||||
Globals.autoTool.set(context.getArgument("开关", Boolean.class));
|
||||
if(Globals.autoTool.get()){
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已启用智能工具!"));
|
||||
FeaturesSettings.INSTANCE.autoTool.setValue(context.getArgument("开关", Boolean.class));
|
||||
try{
|
||||
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{
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已禁用智能工具!"));
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已禁用智能工具!"),false);
|
||||
}
|
||||
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;
|
||||
if (lastSlot!=-1){
|
||||
//破坏方块后切换回去
|
||||
mc.player.getInventory().selectedSlot=lastSlot;
|
||||
lastSlot=-1;
|
||||
}
|
||||
}
|
||||
|
||||
// @Subscribe
|
||||
// private void onBreakBlock(PlayerBreakBlockEvent event){
|
||||
// if(!Globals.autoTool.get()) return;
|
||||
// MinecraftClient mc=MinecraftClient.getInstance();
|
||||
// if (mc.world == null||mc.player==null) return;
|
||||
// }
|
||||
@Subscribe
|
||||
private void onAttackEntity(PlayerAttackEntityEvent event){
|
||||
if(!Globals.autoTool.get()) return;
|
||||
if(!FeaturesSettings.INSTANCE.autoTool.getValue()) return;
|
||||
if(event.target.hasCustomName()) return;
|
||||
//不对玩家使用
|
||||
if(event.target.isPlayer()) return;
|
||||
//对玩家使用
|
||||
if(FeaturesSettings.INSTANCE.autoToolIncludePlayer.getValue()&&event.target.isPlayer()) return;
|
||||
float bestScore=-1;
|
||||
int slot=-1;
|
||||
for(int i=0;i<9;i++) {
|
||||
float score=getWeaponScore(event.player,i);
|
||||
if(score<0) continue;
|
||||
for(int i=0;i<PlayerInventory.getHotbarSize();i++) {
|
||||
ItemStack item = event.player.getInventory().getStack(i);
|
||||
if(!isSwordItem(item.getItem())&&!isToolItem(item.getItem())) continue;
|
||||
float score=getWeaponScore(event.target, item);
|
||||
if(score<=0) continue;
|
||||
//选出最好分数的工具
|
||||
if(score>bestScore){
|
||||
bestScore=score;
|
||||
@ -78,21 +90,25 @@ public class CAutoToolCommand {
|
||||
if(slot==-1) return;
|
||||
ItemStack currentItem = event.player.getInventory().getStack(slot);
|
||||
//低耐久测试
|
||||
if(!lowDurability(currentItem)) {
|
||||
if(!isLowDurability(currentItem)) {
|
||||
//切换过去
|
||||
event.player.getInventory().selectedSlot = slot;
|
||||
event.player.getInventory().selectedSlot=slot;
|
||||
MinecraftClient mc=MinecraftClient.getInstance();
|
||||
if(mc.interactionManager!=null) {
|
||||
((ClientPlayerInteractionManagerAccessor) mc.interactionManager).syncSelectedSlot();
|
||||
}
|
||||
}
|
||||
}
|
||||
//方块挖掘
|
||||
@Subscribe
|
||||
private void onAttackBlock(PlayerAttackBlockEvent event){
|
||||
if(!Globals.autoTool.get()) return;
|
||||
if(!FeaturesSettings.INSTANCE.autoTool.getValue()) return;
|
||||
//自动工具
|
||||
MinecraftClient mc=MinecraftClient.getInstance();
|
||||
if (mc.world == null||mc.player==null) return;
|
||||
PlayerListEntry entry=mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid());
|
||||
if(entry==null) return;
|
||||
if(entry.getGameMode() != GameMode.SURVIVAL) return; //跳过不符合条件的游戏模式
|
||||
BlockState state= mc.world.getBlockState(event.blockPos);
|
||||
//跳过不可破坏
|
||||
if(state.getHardness(mc.world, event.blockPos) < 0) return;
|
||||
@ -101,10 +117,10 @@ public class CAutoToolCommand {
|
||||
//工具槽
|
||||
int slot=-1;
|
||||
//遍历每一个物品槽
|
||||
for(int i=0;i<9;i++){
|
||||
for(int i = 0; i< PlayerInventory.getHotbarSize(); i++){
|
||||
ItemStack item = mc.player.getInventory().getStack(i);
|
||||
float score= getToolsScore(item,state);
|
||||
if(score<0) continue;
|
||||
if(score<=0) continue;
|
||||
//选出最好分数的工具
|
||||
if(score>bestScore){
|
||||
bestScore=score;
|
||||
@ -114,21 +130,77 @@ public class CAutoToolCommand {
|
||||
if(slot==-1) return;
|
||||
ItemStack currentItem = mc.player.getInventory().getStack(slot);
|
||||
//确定已经选择好了工具就切换
|
||||
if(!lowDurability(currentItem)) {
|
||||
//记住上一次的槽方便恢复
|
||||
lastSlot=mc.player.getInventory().selectedSlot;
|
||||
if(!isLowDurability(currentItem)) {
|
||||
//切换过去
|
||||
mc.player.getInventory().selectedSlot = slot;
|
||||
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;
|
||||
}
|
||||
|
||||
// 海晶灯
|
||||
return block == Blocks.GLOWSTONE || // 荧石
|
||||
block == Blocks.MELON || // 西瓜
|
||||
block == Blocks.GRAVEL || // 沙砾 (影响燧石掉落概率)
|
||||
block == Blocks.SEA_LANTERN;
|
||||
}
|
||||
public float getToolsScore(ItemStack item, BlockState state){
|
||||
float score=0;
|
||||
if(item.getItem() instanceof ToolItem || item.getItem() instanceof ShearsItem){
|
||||
if(isToolItem(item.getItem())||item.getItem() instanceof ShearsItem){
|
||||
//根据挖掘速度提升评分
|
||||
score+=item.getMiningSpeedMultiplier(state)*30;
|
||||
score+=item.getMiningSpeedMultiplier(state)*2;
|
||||
//附魔加分
|
||||
//耐久
|
||||
score+= Utils.GetEnchantLevel(Enchantments.UNBREAKING, item);
|
||||
@ -136,36 +208,67 @@ public class CAutoToolCommand {
|
||||
score+=Utils.GetEnchantLevel(Enchantments.EFFICIENCY,item);
|
||||
//经验修补
|
||||
score+=Utils.GetEnchantLevel(Enchantments.MENDING,item);
|
||||
if (item.getItem() instanceof SwordItem item1 && (state.getBlock() instanceof BambooBlock|| state.getBlock() instanceof BambooShootBlock)) {
|
||||
if((item1.getComponents().get(DataComponentTypes.TOOL)!=null)){
|
||||
|
||||
if(isBlockFortune(state.getBlock())){
|
||||
score+=Utils.GetEnchantLevel(Enchantments.FORTUNE,item);//时运
|
||||
}
|
||||
|
||||
if (isSwordItem(item.getItem()) && (state.getBlock() instanceof BambooBlock|| state.getBlock() instanceof BambooShootBlock)) {
|
||||
if((item.getItem().getComponents().get(DataComponentTypes.TOOL)!=null)){
|
||||
//根据挖掘等级加分
|
||||
score += 90 + (item1.getComponents().get(DataComponentTypes.TOOL).getSpeed(state) * 10);
|
||||
score += 90 + item.getMiningSpeedMultiplier(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
return score;
|
||||
}
|
||||
public float getWeaponScore(PlayerEntity player,int slot) {
|
||||
public float getWeaponScore(Entity ent, ItemStack item) {
|
||||
float damageScore = 0;
|
||||
ItemStack item = player.getInventory().getStack(slot);
|
||||
//剑优先
|
||||
if(item.getItem() instanceof SwordItem) damageScore+=10;
|
||||
//使用所有工具组
|
||||
if (item.getItem() instanceof ToolItem tool) {
|
||||
damageScore += tool.getMaterial().getAttackDamage();
|
||||
//锋利加分
|
||||
damageScore += Utils.GetEnchantLevel(Enchantments.SHARPNESS, item) * 2;
|
||||
//精修
|
||||
damageScore+=Utils.GetEnchantLevel(Enchantments.MENDING,item);
|
||||
//火焰附加
|
||||
damageScore+=Utils.GetEnchantLevel(Enchantments.FIRE_ASPECT,item)*3;
|
||||
//击退
|
||||
damageScore+=Utils.GetEnchantLevel(Enchantments.KNOCKBACK,item)*2;
|
||||
if (isSwordItem(item.getItem())) damageScore += 100;
|
||||
//计算物品的基础伤害属性(较为复杂)
|
||||
AttributeModifiersComponent comp=item.getOrDefault(DataComponentTypes.ATTRIBUTE_MODIFIERS, AttributeModifiersComponent.DEFAULT);
|
||||
final float[] damageHolder = {0.0f};
|
||||
BiConsumer<RegistryEntry<EntityAttribute>, EntityAttributeModifier> baseDamage=(attentry, modify)->{
|
||||
if(attentry.matches(EntityAttributes.GENERIC_ATTACK_DAMAGE)){
|
||||
//计算基础伤害
|
||||
damageHolder [0]= (float)modify.value();
|
||||
}
|
||||
};
|
||||
comp.applyModifiers(EquipmentSlot.MAINHAND,baseDamage);//计算主手时的伤害
|
||||
damageScore+=damageHolder[0];
|
||||
//节肢杀手
|
||||
EntityType<?> id=ent.getType();
|
||||
if(id==EntityType.SPIDER||id==EntityType.CAVE_SPIDER||id==EntityType.SILVERFISH||id==EntityType.ENDERMITE||id==EntityType.BEE) {
|
||||
damageScore += Utils.GetEnchantLevel(Enchantments.BANE_OF_ARTHROPODS, item) * 3;
|
||||
}
|
||||
//亡灵杀手(这伤害通常更高)
|
||||
if(ent.getType().isIn(EntityTypeTags.UNDEAD)){
|
||||
damageScore+=Utils.GetEnchantLevel(Enchantments.SMITE,item)*3;// 3倍
|
||||
}
|
||||
//锋利加分
|
||||
damageScore += Utils.GetEnchantLevel(Enchantments.SHARPNESS, item) * 2;
|
||||
//精修
|
||||
damageScore += Utils.GetEnchantLevel(Enchantments.MENDING, item);
|
||||
//火焰附加
|
||||
damageScore += Utils.GetEnchantLevel(Enchantments.FIRE_ASPECT, item);
|
||||
//击退
|
||||
damageScore += Utils.GetEnchantLevel(Enchantments.KNOCKBACK, item);
|
||||
return damageScore;
|
||||
}
|
||||
//停用低耐久度
|
||||
private boolean lowDurability(ItemStack itemStack) {
|
||||
return (itemStack.getMaxDamage() - itemStack.getDamage()) < (itemStack.getMaxDamage() * 10 / 100);
|
||||
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() * 10 / 100);
|
||||
}
|
||||
}
|
||||
|
@ -36,12 +36,12 @@ public class CFastDropCommand {
|
||||
for(Item i:trashItem){
|
||||
sb.append(i.getName().getString()).append(",");
|
||||
}
|
||||
context.getSource().getPlayer().sendMessage(Text.literal(sb.toString()));
|
||||
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("已清除全部物品!"));
|
||||
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->{
|
||||
@ -49,12 +49,12 @@ public class CFastDropCommand {
|
||||
if (item != Items.AIR) { // 确保找到的物品是有效的
|
||||
if (trashItem.contains(item)) {
|
||||
trashItem.remove(item);
|
||||
cmd.getSource().getPlayer().sendMessage(Text.literal("已移除 " + item.getName().getString()));
|
||||
cmd.getSource().getPlayer().sendMessage(Text.literal("已移除 " + item.getName().getString()),false);
|
||||
}else{
|
||||
cmd.getSource().getPlayer().sendMessage(Text.literal("没有找到 " + item.getName().getString()));
|
||||
cmd.getSource().getPlayer().sendMessage(Text.literal("没有找到 " + item.getName().getString()),false);
|
||||
}
|
||||
}else{
|
||||
cmd.getSource().getPlayer().sendMessage(Text.literal("无效物品!"));
|
||||
cmd.getSource().getPlayer().sendMessage(Text.literal("无效物品!"),false);
|
||||
return 0;
|
||||
}
|
||||
return Command.SINGLE_SUCCESS;
|
||||
@ -63,13 +63,13 @@ public class CFastDropCommand {
|
||||
Item item=ItemStackArgumentType.getItemStackArgument(cmd,"物品").getItem();
|
||||
if (item != Items.AIR) { // 确保找到的物品是有效的
|
||||
if(trashItem.contains(item)){
|
||||
cmd.getSource().getPlayer().sendMessage(Text.literal( item.getName().getString() + " 已存在!"));
|
||||
cmd.getSource().getPlayer().sendMessage(Text.literal( item.getName().getString() + " 已存在!"),false);
|
||||
}else {
|
||||
trashItem.add(item);
|
||||
cmd.getSource().getPlayer().sendMessage(Text.literal("已添加 " + item.getName().getString() + " 到垃圾物品列表"));
|
||||
cmd.getSource().getPlayer().sendMessage(Text.literal("已添加 " + item.getName().getString() + " 到垃圾物品列表"),false);
|
||||
}
|
||||
}else{
|
||||
cmd.getSource().getPlayer().sendMessage(Text.literal("无效物品!"));
|
||||
cmd.getSource().getPlayer().sendMessage(Text.literal("无效物品!"),false);
|
||||
return 0;
|
||||
}
|
||||
return Command.SINGLE_SUCCESS;
|
||||
@ -104,15 +104,15 @@ public class CFastDropCommand {
|
||||
return 0;
|
||||
}
|
||||
PlayerInventory inv=player.getInventory();
|
||||
for(int i=0;i<inv.main.size();i++) {
|
||||
ItemStack item = inv.main.get(i);
|
||||
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("已丢弃无用物品!"));
|
||||
player.sendMessage(Text.literal("已丢弃无用物品!"),false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1,34 +0,0 @@
|
||||
package com.expvintl.mctools.commands;
|
||||
|
||||
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.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){
|
||||
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@ public class CFullbirghtCommand{
|
||||
|
||||
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
||||
((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;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.expvintl.mctools.commands;
|
||||
|
||||
import com.expvintl.mctools.Globals;
|
||||
import com.expvintl.mctools.FeaturesSettings;
|
||||
import com.expvintl.mctools.events.MCEventBus;
|
||||
import com.expvintl.mctools.events.network.PacketSendEvent;
|
||||
import com.expvintl.mctools.mixin.interfaces.PlayerMoveC2SPacketAccessor;
|
||||
@ -23,17 +23,17 @@ public class CNoFallPacketCommand {
|
||||
private static final MinecraftClient mc=MinecraftClient.getInstance();
|
||||
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher){
|
||||
MCEventBus.INSTANCE.register(INSTANCE);
|
||||
CommandUtils.CreateStatusCommand("cnofallpacket",Globals.noFallPacket,dispatcher);
|
||||
CommandUtils.CreateStatusCommand("cnofallpacket", FeaturesSettings.INSTANCE.noFallPacket, dispatcher);
|
||||
|
||||
dispatcher.register(literal("cnofallpacket").then(argument("开关", BoolArgumentType.bool()).executes(CNoFallPacketCommand::execute)));
|
||||
}
|
||||
|
||||
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
||||
Globals.noFallPacket.set(context.getArgument("开关", Boolean.class));
|
||||
if(Globals.noFallPacket.get()){
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已启用摔落伤害!"));
|
||||
FeaturesSettings.INSTANCE.noFallPacket.setValue(context.getArgument("开关", Boolean.class));
|
||||
if(FeaturesSettings.INSTANCE.noFallPacket.getValue()){
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已启用摔落伤害!"),false);
|
||||
}else{
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已禁用摔落伤害!"));
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已禁用摔落伤害!"),false);
|
||||
}
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
@ -42,8 +42,8 @@ public class CNoFallPacketCommand {
|
||||
//跳过非移动的数据包
|
||||
if(!(event.packet instanceof PlayerMoveC2SPacket)) return;
|
||||
//跳过创造
|
||||
if(Globals.noFallPacket.get()&& !mc.player.getAbilities().creativeMode){
|
||||
if(mc.player.isFallFlying()) return;
|
||||
if(FeaturesSettings.INSTANCE.noFallPacket.getValue()&& !mc.player.getAbilities().creativeMode){
|
||||
if(mc.player.fallDistance<=mc.player.getSafeFallDistance()) return;
|
||||
if(mc.player.getVelocity().y> -0.5) return;
|
||||
//直接发送在地面的数据包来免伤
|
||||
((PlayerMoveC2SPacketAccessor)event.packet).setOnGround(true);
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.expvintl.mctools.commands;
|
||||
|
||||
import com.expvintl.mctools.Globals;
|
||||
import com.expvintl.mctools.FeaturesSettings;
|
||||
import com.expvintl.mctools.events.MCEventBus;
|
||||
import com.expvintl.mctools.events.network.PacketReceiveEvent;
|
||||
import com.expvintl.mctools.utils.Utils;
|
||||
@ -29,13 +29,13 @@ public class CQServerPluginsCommand {
|
||||
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
||||
//注册数据包接受事件
|
||||
MCEventBus.INSTANCE.register(INSTANCE);
|
||||
Globals.checkBukkitPlugins.set(true);
|
||||
FeaturesSettings.INSTANCE.checkBukkitPlugins.setValue(true);
|
||||
context.getSource().getPlayer().networkHandler.sendPacket(new RequestCommandCompletionsC2SPacket(new Random().nextInt(200),"bukkit:ver "));
|
||||
//1秒后关闭避免识别其他命令提示
|
||||
Utils.timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
Globals.checkBukkitPlugins.set(false);
|
||||
FeaturesSettings.INSTANCE.checkBukkitPlugins.setValue(false);
|
||||
MCEventBus.INSTANCE.unregister(INSTANCE);
|
||||
}
|
||||
},1000);
|
||||
@ -44,7 +44,7 @@ public class CQServerPluginsCommand {
|
||||
@Subscribe
|
||||
public void onReceivePacket(PacketReceiveEvent p){
|
||||
//探测bukkit服务器插件
|
||||
if (!MinecraftClient.getInstance().isIntegratedServerRunning()&& Globals.checkBukkitPlugins.get()) {
|
||||
if (!MinecraftClient.getInstance().isIntegratedServerRunning()&& FeaturesSettings.INSTANCE.checkBukkitPlugins.getValue()) {
|
||||
if (p.packet instanceof CommandSuggestionsS2CPacket sg) {
|
||||
StringBuilder buf=new StringBuilder();
|
||||
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(' ');
|
||||
}
|
||||
if(MinecraftClient.getInstance().player!=null){
|
||||
MinecraftClient.getInstance().player.sendMessage(Text.literal(buf.toString()));
|
||||
MinecraftClient.getInstance().player.sendMessage(Text.literal(buf.toString()),false);
|
||||
}
|
||||
Globals.checkBukkitPlugins.set(false);
|
||||
FeaturesSettings.INSTANCE.checkBukkitPlugins.setValue(false);
|
||||
//取消事件注册
|
||||
MCEventBus.INSTANCE.unregister(INSTANCE);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.expvintl.mctools.commands;
|
||||
|
||||
import com.expvintl.mctools.Globals;
|
||||
import com.expvintl.mctools.FeaturesSettings;
|
||||
import com.expvintl.mctools.utils.CommandUtils;
|
||||
import com.mojang.brigadier.Command;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
@ -14,17 +14,17 @@ import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.lit
|
||||
|
||||
public class CSafeWalkCommand {
|
||||
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher){
|
||||
CommandUtils.CreateStatusCommand("cselfwalk",Globals.selfWalk,dispatcher);
|
||||
CommandUtils.CreateStatusCommand("cselfwalk", FeaturesSettings.INSTANCE.safeWalk, dispatcher);
|
||||
|
||||
dispatcher.register(literal("cselfwalk").then(argument("开关", BoolArgumentType.bool()).executes(CSafeWalkCommand::execute)));
|
||||
}
|
||||
|
||||
private static int execute(CommandContext<FabricClientCommandSource> context) {
|
||||
Globals.selfWalk.set(context.getArgument("开关", Boolean.class));
|
||||
if(Globals.selfWalk.get()){
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已启用自动挂边!"));
|
||||
FeaturesSettings.INSTANCE.safeWalk.setValue(context.getArgument("开关", Boolean.class));
|
||||
if(FeaturesSettings.INSTANCE.safeWalk.getValue()){
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已启用自动挂边!"),false);
|
||||
}else{
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已禁用自动挂边!"));
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("已禁用自动挂边!"),false);
|
||||
}
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
package com.expvintl.mctools.mixin.client;
|
||||
|
||||
import com.expvintl.mctools.modules.CameraZoom;
|
||||
import com.expvintl.mctools.utils.Utils;
|
||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
|
||||
@Mixin(GameRenderer.class)
|
||||
public class GameRendererMixin {
|
||||
@ModifyReturnValue(method = "getFov",at=@At("RETURN"))
|
||||
private float getFov(float origin){
|
||||
return CameraZoom.INSTANCE.isZoom?20.f:origin;
|
||||
}
|
||||
}
|
@ -17,11 +17,7 @@ import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
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){
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.setShaderColor(1,1,1,((color >> 24) & 0x000000FF)/255f);
|
||||
Utils.DrawHeadIcon(context,line,y);
|
||||
RenderSystem.setShaderColor(1,1,1,1);
|
||||
RenderSystem.disableBlend();
|
||||
return context;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.expvintl.mctools.mixin.player;
|
||||
|
||||
import com.expvintl.mctools.Globals;
|
||||
import com.expvintl.mctools.FeaturesSettings;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
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.isClient) return;
|
||||
//挂住边缘
|
||||
if (Globals.selfWalk.get() && !MinecraftClient.getInstance().player.isSneaking()) cir.setReturnValue(true);
|
||||
if (FeaturesSettings.INSTANCE.safeWalk.getValue() && !MinecraftClient.getInstance().player.isSneaking()) cir.setReturnValue(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
20
src/main/java/com/expvintl/mctools/modules/CameraZoom.java
Normal file
20
src/main/java/com/expvintl/mctools/modules/CameraZoom.java
Normal file
@ -0,0 +1,20 @@
|
||||
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.MinecraftClient;
|
||||
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();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -14,9 +14,9 @@ public class PlayerListTextLatency {
|
||||
private int calcLatencyColor(int latency){
|
||||
if(latency>=0&&latency<=60){ //0-60
|
||||
return 0x00FF00; //绿色
|
||||
}else if(latency>60&&latency<=120){ //60-120
|
||||
}else if(latency>60&&latency<=100){ //60-100
|
||||
return 0xFFFF00; //黄色
|
||||
}else if(latency>120&&latency<=200){//120-200
|
||||
}else if(latency>100&&latency<=200){//100-200
|
||||
return 0xFFA500; //橙色
|
||||
}else if(latency>200){ //>200
|
||||
return 0xFF0000; //红色
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -11,6 +11,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Colors;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class MCInfo {
|
||||
private static String gameDayToRealTimeFormat(long gameDays) {
|
||||
// 游戏 1 小时等于 20 分钟
|
||||
@ -67,10 +69,10 @@ public class MCInfo {
|
||||
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]",mc.player.getChunkPos().x,mc.player.getChunkPos().z));
|
||||
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.getInventory().getMainHandStack();
|
||||
if(currentItem!=null&¤tItem.isDamageable()){
|
||||
ItemStack currentItem=p.getMainHandStack();
|
||||
if(Objects.nonNull(currentItem)&¤tItem.isDamageable()){
|
||||
DrawUtils.AddLeftText(drawContext,String.format("耐久度:%d/%d",currentItem.getMaxDamage()-currentItem.getDamage(),currentItem.getMaxDamage()));
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ 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 net.minecraft.util.Colors;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
|
@ -1,11 +0,0 @@
|
||||
package com.expvintl.mctools.types;
|
||||
|
||||
public class Setting {
|
||||
public boolean value=false;
|
||||
public boolean get(){
|
||||
return this.value;
|
||||
}
|
||||
public void set(boolean value){
|
||||
this.value=value;
|
||||
}
|
||||
}
|
@ -1,15 +1,16 @@
|
||||
package com.expvintl.mctools.utils;
|
||||
|
||||
import com.expvintl.mctools.types.Setting;
|
||||
import com.expvintl.mctools.FeaturesSettings;
|
||||
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, Setting toggle, CommandDispatcher<FabricClientCommandSource> dispatcher){
|
||||
public static void CreateStatusCommand(String cmd, BooleanSetting setting, CommandDispatcher<FabricClientCommandSource> dispatcher){
|
||||
dispatcher.register(literal(cmd).executes((context -> {
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("当前启用状态: "+toggle.get()));
|
||||
context.getSource().getPlayer().sendMessage(Text.literal("当前启用状态: "+setting.getValue()),false);
|
||||
return Command.SINGLE_SUCCESS;
|
||||
})));
|
||||
}
|
||||
|
@ -8,9 +8,11 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.PlayerSkinDrawer;
|
||||
import net.minecraft.client.gui.hud.ChatHudLine;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
import net.minecraft.client.network.PlayerListEntry;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.Enchantments;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -30,6 +32,7 @@ import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.Timer;
|
||||
import java.util.function.Function;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@ -220,7 +223,7 @@ public class Utils {
|
||||
for (int z = (int) -pos.z; z < (pos.z + radius); z++) {
|
||||
BlockState b = mc.world.getBlockState(new BlockPos(x, hight, z));
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -242,11 +245,7 @@ public class Utils {
|
||||
if(sender==null) return;
|
||||
PlayerListEntry entry = mc.getNetworkHandler().getPlayerListEntry(sender.getId());
|
||||
if (entry == null) return;
|
||||
|
||||
Identifier skin = entry.getSkinTextures().texture();
|
||||
|
||||
draw.drawTexture(skin, 0, y, 8, 8, 8, 8, 8, 8, 64, 64);
|
||||
draw.drawTexture(skin, 0, y, 8, 8, 40, 8, 8, 8, 64, 64);
|
||||
PlayerSkinDrawer.draw(draw,entry.getSkinTextures(),0,y,8);
|
||||
draw.getMatrices().translate(10, 0, 0);
|
||||
}
|
||||
public static GameProfile getChatSender(String text){
|
||||
|
@ -14,6 +14,7 @@
|
||||
"client": [
|
||||
"MinecraftClientMixin",
|
||||
"SoundSystemMixin",
|
||||
"client.GameRendererMixin",
|
||||
"interfaces.ClientPlayerInteractionManagerAccessor",
|
||||
"interfaces.MinecraftClientAccessor",
|
||||
"interfaces.SimpleOptionAccessor",
|
||||
|
Reference in New Issue
Block a user