2 Commits

Author SHA1 Message Date
470e79e3bd 跟进新版1.20.1
Some checks failed
Build / build (push) Failing after 9s
2025-05-19 03:58:35 +08:00
d8c271b246 1.20.1支持
Some checks failed
Build / build (push) Failing after 1m32s
2025-05-16 17:24:20 +08:00
23 changed files with 150 additions and 140 deletions

View File

@ -12,5 +12,5 @@
</envs>
<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.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\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.1\ae58664f88e18a9bb2c77b063833ca7aaec484cb\lwjgl-3.3.1.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.lwjgl\lwjgl-stb\3.3.1\b119297cf8ed01f247abe8685857f8e7fcf5980f\lwjgl-stb-3.3.1.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-jemalloc\3.3.1\a817bcf213db49f710603677457567c37d53e103\lwjgl-jemalloc-3.3.1.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.1\2623a6b8ae1dfcd880738656a9f0243d2e6840bd\lwjgl-openal-3.3.1.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\commons-codec\commons-codec\1.15\49d94806b6e3dc933dacbd8acb0fdbab8ebd1e5d\commons-codec-1.15.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\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.2\ee8e95be0b438602038bc1f02dc5e3d011b1b216\lwjgl-opengl-3.3.2.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-glfw\3.3.1\cbac1b8d30cb4795149c1ef540f912671a8616d0\lwjgl-glfw-3.3.1.jar"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-opengl\3.3.1\831a5533a21a5f4f81bbc51bb13e9899319b5411\lwjgl-opengl-3.3.1.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\com.ibm.icu\icu4j\71.1\9e7d3304c23f9ba5cb71915f7cce23231a57a445\icu4j-71.1.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-tinyfd\3.3.1\ff1914111ef2e3e0110ef2dabc8d8cdaad82347\lwjgl-tinyfd-3.3.1.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"/><entry exclude="true" path="C:\Users\expvintl\.gradle\caches\modules-2\files-2.1\org.apache.commons\commons-compress\1.21\4ec95b60d4e86b5c95a0e919cb172a0af98011ef\commons-compress-1.21.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\org.apache.httpcomponents\httpcore\4.4.15\7f2e0c573eaa7a74bac2e89b359e1f73d92a0a1d\httpcore-4.4.15.jar"/></classpathModifications></configuration>
</component>

View File

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

View File

@ -3,12 +3,12 @@ org.gradle.jvmargs=-Xmx2G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.21.5
yarn_mappings=1.21.5+build.1
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
loader_version=0.16.12
#Fabric api
fabric_version=0.119.9+1.21.5
fabric_version=0.92.5+1.20.1
# Mod Properties
mod_version = 1.0

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;
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,14 +22,14 @@ 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()){
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("已禁用自动钓鱼!"),false);
@ -38,7 +38,7 @@ public class CAutoFishCommand {
}
@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")) {
//收杆

View File

@ -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,13 +21,13 @@ 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()){
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("已禁用自动重生!"),false);
@ -36,7 +36,7 @@ public class CAutoRespawnCommand {
}
@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) {

View File

@ -1,13 +1,13 @@
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;
import com.google.common.collect.Multimap;
import com.google.common.eventbus.Subscribe;
import com.mojang.brigadier.Command;
import com.mojang.brigadier.CommandDispatcher;
@ -16,20 +16,16 @@ import com.mojang.brigadier.context.CommandContext;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.block.*;
import net.minecraft.client.MinecraftClient;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.AttributeModifiersComponent;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
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.mob.HostileEntity;
import net.minecraft.item.*;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.registry.tag.EntityTypeTags;
import net.minecraft.text.Text;
import java.util.function.BiConsumer;
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.literal;
@ -38,32 +34,42 @@ public class CAutoToolCommand {
private static final CAutoToolCommand INSTANCE=new CAutoToolCommand();
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("已启用智能工具!"),false);
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("已禁用智能工具!"),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;
}
// @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++) {
@ -82,7 +88,7 @@ public class CAutoToolCommand {
//低耐久测试
if(!isLowDurability(currentItem)) {
//切换过去
event.player.getInventory().setSelectedSlot(slot);
event.player.getInventory().selectedSlot=slot;
MinecraftClient mc=MinecraftClient.getInstance();
if(mc.interactionManager!=null) {
((ClientPlayerInteractionManagerAccessor) mc.interactionManager).syncSelectedSlot();
@ -92,7 +98,7 @@ public class CAutoToolCommand {
//方块挖掘
@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;
@ -119,7 +125,7 @@ public class CAutoToolCommand {
//确定已经选择好了工具就切换
if(!isLowDurability(currentItem)) {
//切换过去
mc.player.getInventory().setSelectedSlot(slot);
mc.player.getInventory().selectedSlot=slot;
if(mc.interactionManager!=null) {
((ClientPlayerInteractionManagerAccessor) mc.interactionManager).syncSelectedSlot();
}
@ -192,20 +198,20 @@ public class CAutoToolCommand {
score+=item.getMiningSpeedMultiplier(state)*2;
//附魔加分
//耐久
score+= Utils.GetEnchantLevel(Enchantments.UNBREAKING, item);
score+= EnchantmentHelper.getLevel(Enchantments.UNBREAKING, item);
//效率
score+=Utils.GetEnchantLevel(Enchantments.EFFICIENCY,item);
score+=EnchantmentHelper.getLevel(Enchantments.EFFICIENCY,item);
//经验修补
score+=Utils.GetEnchantLevel(Enchantments.MENDING,item);
score+=EnchantmentHelper.getLevel(Enchantments.MENDING,item);
if(isBlockFortune(state.getBlock())){
score+=Utils.GetEnchantLevel(Enchantments.FORTUNE,item);//时运
score+=EnchantmentHelper.getLevel(Enchantments.FORTUNE,item);//时运
}
if (isSwordItem(item.getItem()) && (state.getBlock() instanceof BambooBlock|| state.getBlock() instanceof BambooShootBlock)) {
if((item.getItem().getComponents().get(DataComponentTypes.TOOL)!=null)){
if (isSwordItem(item.getItem()) && (state.getBlock() instanceof BambooBlock)) {
if(item.getItem() instanceof ToolItem tool){
//根据挖掘等级加分
score += 90 + (item.getItem().getComponents().get(DataComponentTypes.TOOL).getSpeed(state));
score += 90 + tool.getMaterial().getMiningSpeedMultiplier();
}
}
}
@ -216,33 +222,31 @@ public class CAutoToolCommand {
//剑优先
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.ATTACK_DAMAGE)){
//计算基础伤害
damageHolder [0]= (float)modify.value();
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;
}
};
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;
damageScore += EnchantmentHelper.getLevel(Enchantments.BANE_OF_ARTHROPODS, item) * 3;
}
//亡灵杀手(这伤害通常更高)
if(ent.getType().isIn(EntityTypeTags.UNDEAD)){
damageScore+=Utils.GetEnchantLevel(Enchantments.SMITE,item)*3;// 3倍
if(((LivingEntity)ent).getGroup()==EntityGroup.UNDEAD){
damageScore+=EnchantmentHelper.getLevel(Enchantments.SMITE,item)*3;// 3倍
}
//锋利加分
damageScore += Utils.GetEnchantLevel(Enchantments.SHARPNESS, item) * 2;
damageScore += EnchantmentHelper.getLevel(Enchantments.SHARPNESS, item) * 2;
//精修
damageScore += Utils.GetEnchantLevel(Enchantments.MENDING, item);
damageScore += EnchantmentHelper.getLevel(Enchantments.MENDING, item);
//火焰附加
damageScore += Utils.GetEnchantLevel(Enchantments.FIRE_ASPECT, item);
damageScore += EnchantmentHelper.getLevel(Enchantments.FIRE_ASPECT, item);
//击退
damageScore += Utils.GetEnchantLevel(Enchantments.KNOCKBACK, item);
damageScore += EnchantmentHelper.getLevel(Enchantments.KNOCKBACK, item);
return damageScore;
}
//停用低耐久度
@ -258,6 +262,6 @@ public class CAutoToolCommand {
item == Items.IRON_AXE || item == Items.IRON_SHOVEL ||
item == Items.IRON_HOE;
return !(isWooden||isStone||isIron) //忽略木/石/铁工具
&&(itemStack.getMaxDamage() - itemStack.getDamage()) < (itemStack.getMaxDamage() * 10 / 100);
&&(itemStack.getMaxDamage() - itemStack.getDamage()) < (itemStack.getMaxDamage() * 2 / 100);
}
}

View File

@ -9,14 +9,14 @@ import net.minecraft.text.Text;
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal;
public class CFullbirghtCommand{
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher){
public class CFullbirghtCommand {
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher) {
dispatcher.register(literal("cfullbirght").executes(CFullbirghtCommand::execute));
}
private static int execute(CommandContext<FabricClientCommandSource> context) {
((SimpleOptionAccessor)(Object)context.getSource().getClient().options.getGamma()).forceSetValue(32767.0);
context.getSource().getPlayer().sendMessage(Text.literal("已应用高亮"),false);
((SimpleOptionAccessor) (Object) context.getSource().getClient().options.getGamma()).forceSetValue(32767.0);
context.getSource().getPlayer().sendMessage(Text.literal("已应用高亮"), false);
return Command.SINGLE_SUCCESS;
}

View File

@ -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,14 +23,14 @@ 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()){
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("已禁用摔落伤害!"),false);
@ -42,7 +42,7 @@ public class CNoFallPacketCommand {
//跳过非移动的数据包
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.getVelocity().y> -0.5) return;
//直接发送在地面的数据包来免伤

View File

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

View File

@ -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,14 +14,14 @@ 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()){
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("已禁用自动挂边!"),false);

View File

@ -1,19 +1,15 @@
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;
private double getFov(double original){
return CameraZoom.INSTANCE.isZoom?20.f:original;
}
}

View File

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

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

@ -44,10 +44,10 @@ public class MCInfo {
return timeString.toString();
}
public static void drawHUD(DrawContext drawContext, RenderTickCounter v) {
public static void drawHUD(DrawContext drawContext, float v) {
MinecraftClient mc=MinecraftClient.getInstance();
//跳过调试
if(mc.getDebugHud().shouldShowDebugHud()||mc.options.hudHidden) return;
if(mc.options.debugEnabled||mc.options.hudHidden) return;
if(mc.world!=null&&mc.player!=null) {
DrawUtils.leftTextY =1;
int selfPing=0;

View File

@ -6,15 +6,14 @@ 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;
public class PotionInfo {
public static void drawHUD(DrawContext drawContext, RenderTickCounter v) {
public static void drawHUD(DrawContext drawContext, float v) {
MinecraftClient mc=MinecraftClient.getInstance();
//跳过调试
if(mc.getDebugHud().shouldShowDebugHud()||mc.options.hudHidden) return;
if(mc.options.debugEnabled||mc.options.hudHidden) return;
if(mc.world!=null&&mc.player!=null) {
DrawUtils.rightBottomY=1;

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;
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()),false);
context.getSource().getPlayer().sendMessage(Text.literal("当前启用状态: "+setting.getValue()),false);
return Command.SINGLE_SUCCESS;
})));
}

View File

@ -44,7 +44,7 @@ public class Utils {
public static String getCurrentDimensionName() {
if (mc.world != null) {
String dismenName = mc.world.getDimensionEntry().getIdAsString();
String dismenName = mc.world.getDimensionKey().getValue().toString();
switch (dismenName) {
case "minecraft:overworld":
return "主世界";
@ -199,18 +199,6 @@ public class Utils {
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() {
((MinecraftClientAccessor) mc).doItemUse();
}
@ -245,7 +233,7 @@ public class Utils {
if(sender==null) return;
PlayerListEntry entry = mc.getNetworkHandler().getPlayerListEntry(sender.getId());
if (entry == null) return;
PlayerSkinDrawer.draw(draw,entry.getSkinTextures(),0,y,8);
PlayerSkinDrawer.draw(draw,entry.getSkinTexture(),0,y,8);
draw.getMatrices().translate(10, 0, 0);
}
public static GameProfile getChatSender(String text){

View File

@ -21,6 +21,6 @@
"depends": {
"fabricloader": ">=0.8.0",
"fabric": "*",
"minecraft": "~1.21"
"minecraft": "~1.20.1"
}
}

View File

@ -2,7 +2,7 @@
"required": true,
"minVersion": "0.8",
"package": "com.expvintl.mctools.mixin",
"compatibilityLevel": "JAVA_21",
"compatibilityLevel": "JAVA_17",
"mixins": [
"hud.ChatHudMixin",
"hud.PlayerListHudMixin",