Skip to content

Commit 5efdd20

Browse files
committed
feat: progress
1. fix ElytraBot 2. fix AutoEat 3. fix conflict with 4. add log display
1 parent ce0c76a commit 5efdd20

23 files changed

Lines changed: 682 additions & 230 deletions

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727

2828
但是该模组与以下模组均有关联,推荐同时安装
2929

30-
- ViaFabricPlus
30+
注: 不是必须安装
31+
32+
- ViaFabricPlus(强烈推荐安装)
3133
- Litematica
3234
- JsMacros
3335
- Baritone

src/main/java/me/matl114/accessors/hacks/PlayerInteractionAccess.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
import net.minecraft.client.MinecraftClient;
77
import net.minecraft.client.network.ClientPlayerInteractionManager;
88
import net.minecraft.item.ItemStack;
9+
import net.minecraft.util.ActionResult;
10+
import net.minecraft.util.Hand;
11+
import net.minecraft.util.hit.BlockHitResult;
912
import net.minecraft.util.math.BlockPos;
1013
import net.minecraft.util.math.Direction;
1114
import net.minecraft.util.math.Vec3d;
@@ -219,6 +222,10 @@ default boolean setStartFailBreakPos(@Nullable BlockPos pos) {
219222

220223
public boolean sendFailBreakCurrentPos(@Nullable Direction direction);
221224

225+
public ActionResult simulateInteractBlock(Hand hand, BlockHitResult hitResult);
226+
227+
public ActionResult simulateInteractItem(Hand hand);
228+
222229
/**
223230
* 把原版 {@link ClientPlayerInteractionManager} 视为本接口语义边界。
224231
*/

src/main/java/me/matl114/events/Listener.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,8 @@ public static EventChannel<Packet<?>> getPacketSendPoint() {
666666
@Getter
667667
@Cancelable
668668
@Modifiable
669-
private static final EventChannel<Hand> prePlayerUseItem = new EventChannel<>();
669+
@ExtraArgs({Hand.class})
670+
private static final EventChannel<ActionResult> prePlayerUseItem = new EventChannel<>();
670671

671672
@Getter
672673
@Modifiable

src/main/java/me/matl114/hacks/RenderTasks.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,9 @@ public void render(MatrixStack stack, float partialTicks) {
524524
@Getter
525525
public static Hud hud;
526526

527+
@Getter
528+
public static ModuleListHud moduleListHud;
529+
527530
@Getter
528531
public static InvHud invHud;
529532

@@ -555,6 +558,7 @@ private static void initModules(ModuleManager m) {
555558
freecam = new Freecam().register(m);
556559
renderOptimize = new RenderOptimize().register(m);
557560
hud = new Hud().register(m);
561+
moduleListHud = new ModuleListHud().register(m);
558562
invHud = new InvHud().register(m);
559563
playerStatistic = new PlayerStatistic().register(m);
560564
equipmentHud = new EquipmentHud().register(m);

src/main/java/me/matl114/hacks/modules/combat/AttackArua.java

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ public AttackArua() {
5050
public final FlagRef doNotAttackWhenEat =
5151
flagBuilder(attBot.add("stop-attack-when-eat")).build();
5252

53-
public final FlagRef doNotAttackWhenSpear = flagBuilder(attBot.add("stop-attack-when-spear")).build();
53+
public final FlagRef doNotAttackWhenSpear =
54+
flagBuilder(attBot.add("stop-attack-when-spear")).build();
5455

5556
@Override
5657
public void registerAll() {
@@ -60,6 +61,22 @@ public void registerAll() {
6061

6162
private int interval;
6263

64+
public boolean checkEating() {
65+
return doNotAttackWhenEat.get()
66+
&& mc.player.isUsingItem()
67+
&& VItem.getInstance().isEatable(mc.player.getActiveItem());
68+
}
69+
70+
public boolean checkSpear() {
71+
return doNotAttackWhenSpear.get()
72+
&& mc.player.isUsingItem()
73+
&& VItem.getInstance().isSpear(mc.player.getActiveItem());
74+
}
75+
76+
public boolean checkUsing() {
77+
return checkEating() || checkSpear();
78+
}
79+
6380
public void onTick(Event<ClientPlayerEntity> tickEvent) {
6481
if (mc.player == null) return;
6582
if (enable.get()) {
@@ -69,18 +86,11 @@ public void onTick(Event<ClientPlayerEntity> tickEvent) {
6986
interval += 1;
7087
int custom = customRate.get();
7188
if (custom <= interval) {
72-
if (doNotAttackWhenEat.get()
73-
&& mc.player.isUsingItem()
74-
&& VItem.getInstance().isEatable(mc.player.getActiveItem())) {
75-
return;
76-
}
77-
if(doNotAttackWhenSpear.get() && mc.player.isUsingItem() && VItem.getInstance().isSpear(mc.player.getActiveItem())) {
78-
return;
79-
}
89+
8090
if (attack.legalMode.get()
8191
|| ((holdingWeapon && cooldownWeapon.get()) || (!holdingWeapon && cooldownHand.get()))) {
8292
// do not attack because of legal mode
83-
93+
if (checkUsing()) return;
8494
if (mc.player.getAttackCooldownProgress(0.5F) > 0.98) {
8595
// ready for attack
8696
// force attack

0 commit comments

Comments
 (0)