Fix ShieldBypass unable to perform criticals and stuck in blocks (#275)

Co-authored-by: Cloudburst <18114966+C10udburst@users.noreply.github.com>
This commit is contained in:
OnlyRain233
2023-07-28 20:31:11 +08:00
committed by GitHub
parent 699d510003
commit ecf2d1a19b
6 changed files with 102 additions and 70 deletions

View File

@@ -2,6 +2,7 @@ package anticope.rejects.modules;
import anticope.rejects.MeteorRejectsAddon;
import anticope.rejects.utils.WorldUtils;
import meteordevelopment.meteorclient.events.entity.player.BreakBlockEvent;
import meteordevelopment.meteorclient.events.world.TickEvent;
import meteordevelopment.meteorclient.settings.*;
import meteordevelopment.meteorclient.systems.modules.Module;
@@ -139,6 +140,21 @@ public class AutoFarm extends Module {
replantMap.clear();
}
@EventHandler
private void onBreakBlock(BreakBlockEvent event) {
BlockState state = mc.world.getBlockState(event.blockPos);
Block block = state.getBlock();
if (onlyReplant.get()) {
Item item = null;
if (block == Blocks.WHEAT) item = Items.WHEAT_SEEDS;
else if (block == Blocks.CARROTS) item = Items.CARROT;
else if (block == Blocks.POTATOES) item = Items.POTATO;
else if (block == Blocks.BEETROOTS) item = Items.BEETROOT_SEEDS;
else if (block == Blocks.NETHER_WART) item = Items.NETHER_WART;
if (item != null) replantMap.put(event.blockPos, item);
}
}
@EventHandler
private void onTick(TickEvent.Pre event) {
actions = 0;
@@ -187,15 +203,6 @@ public class AutoFarm extends Module {
mc.interactionManager.interactBlock(mc.player, Hand.MAIN_HAND, new BlockHitResult(Utils.vec3d(pos), Direction.UP, pos, false));
else {
mc.interactionManager.updateBlockBreakingProgress(pos, Direction.UP);
if (onlyReplant.get()) {
Item item = null;
if (block == Blocks.WHEAT) item = Items.WHEAT_SEEDS;
else if (block == Blocks.CARROTS) item = Items.CARROT;
else if (block == Blocks.POTATOES) item = Items.POTATO;
else if (block == Blocks.BEETROOTS) item = Items.BEETROOT_SEEDS;
else if (block == Blocks.NETHER_WART) item = Items.NETHER_WART;
if (item != null) replantMap.put(pos, item);
}
}
return true;
}