3 Commits

Author SHA1 Message Date
9365282f2b 更新readme
Some checks failed
Build / build (push) Failing after 8s
2025-05-19 03:59:28 +08:00
1e278af96e 为构建成品添加MC版本
Some checks failed
Build / build (push) Failing after 3m44s
2025-05-19 03:39:31 +08:00
26c4556498 重构设置,添加自动工具对玩家判断
Some checks failed
Build / build (push) Failing after 1m39s
2025-05-17 01:44:36 +08:00
16 changed files with 114 additions and 84 deletions

View File

@ -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-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.3.4\b9fc14968d63a8b8a8a2c1885fe3e90564239708\commons-logging-1.3.4.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.14\1194890e6f56ec29177673f2f12d0b8e627dec98\httpclient-4.5.14.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\com.mojang\text2speech\1.18.11\e853a12cdd6ba4f4836e8f4bf3b37844a13482b6\text2speech-1.18.11.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-codec\commons-codec\1.17.1\973638b7149d333563584137ebf13a691bb60579\commons-codec-1.17.1.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.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\com.ibm.icu\icu4j\76.1\215f3a8e936d4069344bd75f2b1368fd58112894\icu4j-76.1.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.apache.commons\commons-compress\1.27.1\a19151084758e2fbb6b41eddaa88e7b8ff4e6599\commons-compress-1.27.1.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.3\29589b5f87ed335a6c7e7ee6a5775f81f97ecb84\lwjgl-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-freetype\3.3.3\a0db6c84a8becc8ca05f9dbfa985edc348a824c7\lwjgl-freetype-3.3.3.jar"/></classpathModifications></configuration> <classpathModifications><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.apache.commons\commons-compress\1.27.1\a19151084758e2fbb6b41eddaa88e7b8ff4e6599\commons-compress-1.27.1.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\text2speech\1.18.11\e853a12cdd6ba4f4836e8f4bf3b37844a13482b6\text2speech-1.18.11.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpclient\4.5.14\1194890e6f56ec29177673f2f12d0b8e627dec98\httpclient-4.5.14.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\com.ibm.icu\icu4j\76.1\215f3a8e936d4069344bd75f2b1368fd58112894\icu4j-76.1.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.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\3.3.3\29589b5f87ed335a6c7e7ee6a5775f81f97ecb84\lwjgl-3.3.3.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\commons-codec\commons-codec\1.17.1\973638b7149d333563584137ebf13a691bb60579\commons-codec-1.17.1.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.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-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.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.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\commons-logging\commons-logging\1.3.4\b9fc14968d63a8b8a8a2c1885fe3e90564239708\commons-logging-1.3.4.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.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-glfw\3.3.3\efa1eb78c5ccd840e9f329717109b5e892d72f8e\lwjgl-glfw-3.3.3.jar"/></classpathModifications></configuration>
</component> </component>

View File

@ -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()

View File

@ -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)

View 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();
}

View File

@ -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;
}

View File

@ -1,6 +1,6 @@
package com.expvintl.mctools.commands; 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.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.CommandUtils;
@ -22,14 +22,14 @@ 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",Globals.autoFish,dispatcher); 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) {
Globals.autoFish.set(context.getArgument("开关", Boolean.class)); FeaturesSettings.INSTANCE.autoFish.setValue(context.getArgument("开关", Boolean.class));
if(Globals.autoFish.get()){ if(FeaturesSettings.INSTANCE.autoFish.getValue()){
context.getSource().getPlayer().sendMessage(Text.literal("已启用自动钓鱼!"),false); context.getSource().getPlayer().sendMessage(Text.literal("已启用自动钓鱼!"),false);
}else{ }else{
context.getSource().getPlayer().sendMessage(Text.literal("已禁用自动钓鱼!"),false); context.getSource().getPlayer().sendMessage(Text.literal("已禁用自动钓鱼!"),false);
@ -38,7 +38,7 @@ public class CAutoFishCommand {
} }
@Subscribe @Subscribe
private void onPlaySound(PlaySoundEvent event){ private void onPlaySound(PlaySoundEvent event){
if(Globals.autoFish.get()) { 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")) {
//收杆 //收杆

View File

@ -1,6 +1,6 @@
package com.expvintl.mctools.commands; 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.MCEventBus;
import com.expvintl.mctools.events.client.OpenScreenEvent; import com.expvintl.mctools.events.client.OpenScreenEvent;
import com.expvintl.mctools.utils.CommandUtils; import com.expvintl.mctools.utils.CommandUtils;
@ -21,13 +21,13 @@ 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",Globals.autoRespawn,dispatcher); 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) {
Globals.autoRespawn.set(context.getArgument("开关", Boolean.class)); FeaturesSettings.INSTANCE.autoRespawn.setValue(context.getArgument("开关", Boolean.class));
if(Globals.autoRespawn.get()){ if(FeaturesSettings.INSTANCE.autoRespawn.getValue()){
context.getSource().getPlayer().sendMessage(Text.literal("已启用自动重生!"),false); context.getSource().getPlayer().sendMessage(Text.literal("已启用自动重生!"),false);
}else{ }else{
context.getSource().getPlayer().sendMessage(Text.literal("已禁用自动重生!"),false); context.getSource().getPlayer().sendMessage(Text.literal("已禁用自动重生!"),false);
@ -36,7 +36,7 @@ public class CAutoRespawnCommand {
} }
@Subscribe @Subscribe
private void onOpenScreen(OpenScreenEvent event){ private void onOpenScreen(OpenScreenEvent event){
if(Globals.autoRespawn.get()) { 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) {

View File

@ -1,10 +1,9 @@
package com.expvintl.mctools.commands; 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.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.PlayerAttackEntityEvent;
import com.expvintl.mctools.events.player.PlayerBreakBlockEvent;
import com.expvintl.mctools.mixin.interfaces.ClientPlayerInteractionManagerAccessor; import com.expvintl.mctools.mixin.interfaces.ClientPlayerInteractionManagerAccessor;
import com.expvintl.mctools.utils.CommandUtils; import com.expvintl.mctools.utils.CommandUtils;
import com.expvintl.mctools.utils.Utils; import com.expvintl.mctools.utils.Utils;
@ -23,11 +22,12 @@ import net.minecraft.entity.*;
import net.minecraft.entity.attribute.EntityAttribute; import net.minecraft.entity.attribute.EntityAttribute;
import net.minecraft.entity.attribute.EntityAttributeModifier; import net.minecraft.entity.attribute.EntityAttributeModifier;
import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.entity.mob.HostileEntity; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.*; import net.minecraft.item.*;
import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.registry.tag.EntityTypeTags; import net.minecraft.registry.tag.EntityTypeTags;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.world.GameMode;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
@ -38,35 +38,44 @@ public class CAutoToolCommand {
private static final CAutoToolCommand INSTANCE=new CAutoToolCommand(); private static final CAutoToolCommand INSTANCE=new CAutoToolCommand();
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher){ public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher){
MCEventBus.INSTANCE.register(INSTANCE); MCEventBus.INSTANCE.register(INSTANCE);
CommandUtils.CreateStatusCommand("cautotool",Globals.autoTool,dispatcher); CommandUtils.CreateStatusCommand("cautotool", FeaturesSettings.INSTANCE.autoTool, dispatcher);
dispatcher.register(literal("cautotool").then(argument("开关", BoolArgumentType.bool()).executes(CAutoToolCommand::execute))); 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) {
Globals.autoTool.set(context.getArgument("开关", Boolean.class)); FeaturesSettings.INSTANCE.autoTool.setValue(context.getArgument("开关", Boolean.class));
if(Globals.autoTool.get()){ try{
context.getSource().getPlayer().sendMessage(Text.literal("已启用智能工具!"),false); 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("已禁用智能工具!"),false); context.getSource().getPlayer().sendMessage(Text.literal("已禁用智能工具!"),false);
} }
return Command.SINGLE_SUCCESS; return Command.SINGLE_SUCCESS;
} }
@Subscribe // @Subscribe
private void onBreakBlock(PlayerBreakBlockEvent event){ // private void onBreakBlock(PlayerBreakBlockEvent event){
if(!Globals.autoTool.get()) return; // if(!Globals.autoTool.get()) return;
MinecraftClient mc=MinecraftClient.getInstance(); // MinecraftClient mc=MinecraftClient.getInstance();
if (mc.world == null||mc.player==null) return; // if (mc.world == null||mc.player==null) return;
} // }
@Subscribe @Subscribe
private void onAttackEntity(PlayerAttackEntityEvent event){ private void onAttackEntity(PlayerAttackEntityEvent event){
if(!Globals.autoTool.get()) return; if(!FeaturesSettings.INSTANCE.autoTool.getValue()) return;
if(event.target.hasCustomName()) return; if(event.target.hasCustomName()) return;
//对玩家使用 //对玩家使用
if(event.target.isPlayer()) return; if(FeaturesSettings.INSTANCE.autoToolIncludePlayer.getValue()&&event.target.isPlayer()) return;
float bestScore=-1; float bestScore=-1;
int slot=-1; int slot=-1;
for(int i=0;i<9;i++) { for(int i=0;i<PlayerInventory.HOTBAR_SIZE;i++) {
ItemStack item = event.player.getInventory().getStack(i); ItemStack item = event.player.getInventory().getStack(i);
if(!isSwordItem(item.getItem())&&!isToolItem(item.getItem())) continue; if(!isSwordItem(item.getItem())&&!isToolItem(item.getItem())) continue;
float score=getWeaponScore(event.target, item); float score=getWeaponScore(event.target, item);
@ -92,10 +101,11 @@ public class CAutoToolCommand {
//方块挖掘 //方块挖掘
@Subscribe @Subscribe
private void onAttackBlock(PlayerAttackBlockEvent event){ private void onAttackBlock(PlayerAttackBlockEvent event){
if(!Globals.autoTool.get()) return; if(!FeaturesSettings.INSTANCE.autoTool.getValue()) return;
//自动工具 //自动工具
MinecraftClient mc=MinecraftClient.getInstance(); MinecraftClient mc=MinecraftClient.getInstance();
if (mc.world == null||mc.player==null) return; if (mc.world == null||mc.player==null) return;
if(mc.player.getGameMode() != GameMode.SURVIVAL) return; //跳过不符合条件的游戏模式
BlockState state= mc.world.getBlockState(event.blockPos); BlockState state= mc.world.getBlockState(event.blockPos);
//跳过不可破坏 //跳过不可破坏
if(state.getHardness(mc.world, event.blockPos) < 0) return; if(state.getHardness(mc.world, event.blockPos) < 0) return;
@ -104,7 +114,7 @@ public class CAutoToolCommand {
//工具槽 //工具槽
int slot=-1; int slot=-1;
//遍历每一个物品槽 //遍历每一个物品槽
for(int i=0;i<9;i++){ for(int i = 0; i< PlayerInventory.HOTBAR_SIZE; i++){
ItemStack item = mc.player.getInventory().getStack(i); ItemStack item = mc.player.getInventory().getStack(i);
float score= getToolsScore(item,state); float score= getToolsScore(item,state);
if(score<=0) continue; if(score<=0) continue;
@ -177,13 +187,11 @@ public class CAutoToolCommand {
return true; return true;
} }
if (block == Blocks.GLOWSTONE || // 荧石 // 海晶灯
return block == Blocks.GLOWSTONE || // 荧石
block == Blocks.MELON || // 西瓜 block == Blocks.MELON || // 西瓜
block == Blocks.GRAVEL || // 沙砾 (影响燧石掉落概率) block == Blocks.GRAVEL || // 沙砾 (影响燧石掉落概率)
block == Blocks.SEA_LANTERN){ // 海晶灯 block == Blocks.SEA_LANTERN;
return true;
}
return false;
} }
public float getToolsScore(ItemStack item, BlockState state){ public float getToolsScore(ItemStack item, BlockState state){
float score=0; float score=0;
@ -205,7 +213,7 @@ public class CAutoToolCommand {
if (isSwordItem(item.getItem()) && (state.getBlock() instanceof BambooBlock|| state.getBlock() instanceof BambooShootBlock)) { if (isSwordItem(item.getItem()) && (state.getBlock() instanceof BambooBlock|| state.getBlock() instanceof BambooShootBlock)) {
if((item.getItem().getComponents().get(DataComponentTypes.TOOL)!=null)){ if((item.getItem().getComponents().get(DataComponentTypes.TOOL)!=null)){
//根据挖掘等级加分 //根据挖掘等级加分
score += 90 + (item.getItem().getComponents().get(DataComponentTypes.TOOL).getSpeed(state)); score += 90 + item.getMiningSpeedMultiplier(state);
} }
} }
} }

View File

@ -1,6 +1,6 @@
package com.expvintl.mctools.commands; 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.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;
@ -23,14 +23,14 @@ 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",Globals.noFallPacket,dispatcher); 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) {
Globals.noFallPacket.set(context.getArgument("开关", Boolean.class)); FeaturesSettings.INSTANCE.noFallPacket.setValue(context.getArgument("开关", Boolean.class));
if(Globals.noFallPacket.get()){ if(FeaturesSettings.INSTANCE.noFallPacket.getValue()){
context.getSource().getPlayer().sendMessage(Text.literal("已启用摔落伤害!"),false); context.getSource().getPlayer().sendMessage(Text.literal("已启用摔落伤害!"),false);
}else{ }else{
context.getSource().getPlayer().sendMessage(Text.literal("已禁用摔落伤害!"),false); context.getSource().getPlayer().sendMessage(Text.literal("已禁用摔落伤害!"),false);
@ -42,7 +42,7 @@ public class CNoFallPacketCommand {
//跳过非移动的数据包 //跳过非移动的数据包
if(!(event.packet instanceof PlayerMoveC2SPacket)) return; if(!(event.packet instanceof PlayerMoveC2SPacket)) return;
//跳过创造 //跳过创造
if(Globals.noFallPacket.get()&& !mc.player.getAbilities().creativeMode){ if(FeaturesSettings.INSTANCE.noFallPacket.getValue()&& !mc.player.getAbilities().creativeMode){
if(mc.player.fallDistance<=mc.player.getSafeFallDistance()) 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;
//直接发送在地面的数据包来免伤 //直接发送在地面的数据包来免伤

View File

@ -1,6 +1,6 @@
package com.expvintl.mctools.commands; 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.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);
Globals.checkBukkitPlugins.set(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() {
Globals.checkBukkitPlugins.set(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()&& Globals.checkBukkitPlugins.get()) { 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');
@ -54,7 +54,7 @@ public class CQServerPluginsCommand {
if(MinecraftClient.getInstance().player!=null){ if(MinecraftClient.getInstance().player!=null){
MinecraftClient.getInstance().player.sendMessage(Text.literal(buf.toString()),false); MinecraftClient.getInstance().player.sendMessage(Text.literal(buf.toString()),false);
} }
Globals.checkBukkitPlugins.set(false); FeaturesSettings.INSTANCE.checkBukkitPlugins.setValue(false);
//取消事件注册 //取消事件注册
MCEventBus.INSTANCE.unregister(INSTANCE); MCEventBus.INSTANCE.unregister(INSTANCE);
} }

View File

@ -1,6 +1,6 @@
package com.expvintl.mctools.commands; package com.expvintl.mctools.commands;
import com.expvintl.mctools.Globals; import com.expvintl.mctools.FeaturesSettings;
import com.expvintl.mctools.utils.CommandUtils; 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;
@ -14,14 +14,14 @@ 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",Globals.selfWalk,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) {
Globals.selfWalk.set(context.getArgument("开关", Boolean.class)); FeaturesSettings.INSTANCE.safeWalk.setValue(context.getArgument("开关", Boolean.class));
if(Globals.selfWalk.get()){ if(FeaturesSettings.INSTANCE.safeWalk.getValue()){
context.getSource().getPlayer().sendMessage(Text.literal("已启用自动挂边!"),false); context.getSource().getPlayer().sendMessage(Text.literal("已启用自动挂边!"),false);
}else{ }else{
context.getSource().getPlayer().sendMessage(Text.literal("已禁用自动挂边!"),false); context.getSource().getPlayer().sendMessage(Text.literal("已禁用自动挂边!"),false);

View File

@ -1,6 +1,6 @@
package com.expvintl.mctools.mixin.player; package com.expvintl.mctools.mixin.player;
import com.expvintl.mctools.Globals; 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 (Globals.selfWalk.get() && !MinecraftClient.getInstance().player.isSneaking()) cir.setReturnValue(true); if (FeaturesSettings.INSTANCE.safeWalk.getValue() && !MinecraftClient.getInstance().player.isSneaking()) cir.setReturnValue(true);
} }
} }
} }

View File

@ -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;
}
}

View File

@ -6,7 +6,6 @@ import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.RenderTickCounter; import net.minecraft.client.render.RenderTickCounter;
import net.minecraft.client.resource.language.I18n; import net.minecraft.client.resource.language.I18n;
import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.util.Colors;
import java.util.Collection; import java.util.Collection;

View File

@ -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;
}
}

View File

@ -1,15 +1,16 @@
package com.expvintl.mctools.utils; 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.Command;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.text.Text; 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 CommandUtils { 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 -> { dispatcher.register(literal(cmd).executes((context -> {
context.getSource().getPlayer().sendMessage(Text.literal("当前启用状态: "+toggle.get()),false); context.getSource().getPlayer().sendMessage(Text.literal("当前启用状态: "+setting.getValue()),false);
return Command.SINGLE_SUCCESS; return Command.SINGLE_SUCCESS;
}))); })));
} }