diff --git a/src/main/java/cally72jhb/addon/VectorAddon.java b/src/main/java/cally72jhb/addon/VectorAddon.java index 6b5c9d36..ec11f7a5 100644 --- a/src/main/java/cally72jhb/addon/VectorAddon.java +++ b/src/main/java/cally72jhb/addon/VectorAddon.java @@ -2,30 +2,17 @@ import cally72jhb.addon.system.Systems; import cally72jhb.addon.system.categories.Categories; -import cally72jhb.addon.system.players.Player; -import cally72jhb.addon.system.players.Players; import cally72jhb.addon.utils.VectorUtils; -import cally72jhb.addon.utils.config.VectorConfig; import meteordevelopment.meteorclient.MeteorClient; -import meteordevelopment.meteorclient.addons.GithubRepo; import meteordevelopment.meteorclient.addons.MeteorAddon; import meteordevelopment.meteorclient.events.game.GameJoinedEvent; -import meteordevelopment.meteorclient.events.game.ReceiveMessageEvent; import meteordevelopment.meteorclient.events.world.TickEvent; import meteordevelopment.meteorclient.systems.modules.Modules; -import meteordevelopment.meteorclient.utils.misc.text.ColoredText; -import meteordevelopment.meteorclient.utils.misc.text.TextUtils; import meteordevelopment.meteorclient.utils.player.ChatUtils; import meteordevelopment.orbit.EventHandler; -import net.minecraft.text.LiteralText; -import net.minecraft.text.Style; -import net.minecraft.text.Text; -import net.minecraft.util.Formatting; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.util.ArrayList; - public class VectorAddon extends MeteorAddon { public static final Logger LOG = LogManager.getLogger(); @@ -38,7 +25,6 @@ public void onInitialize() { MeteorClient.EVENT_BUS.subscribe(this); - VectorUtils.members(); VectorUtils.changeIcon(); VectorUtils.postInit(); @@ -56,16 +42,6 @@ public void onRegisterCategories() { Modules.registerCategory(Categories.Combat); } - @Override - public GithubRepo getRepo() { - return new GithubRepo("cally72jhb", "vector-addon"); - } - - @Override - public String getWebsite() { - return "https://cally72jhb.github.io/website"; - } - @EventHandler private void onPreTick(TickEvent.Pre event) { if (VectorUtils.screen != null) { @@ -76,51 +52,6 @@ private void onPreTick(TickEvent.Pre event) { @EventHandler private void onGameJoin(GameJoinedEvent event) { - VectorUtils.members(); - ChatUtils.registerCustomPrefix("cally72jhb.addon", VectorUtils::getPrefix); } - - @EventHandler - private void onMessageReceive(ReceiveMessageEvent event) { - LiteralText finalText = new LiteralText(""); - Text message = event.getMessage(); - - boolean replace = false; - - ArrayList strings = new ArrayList<>(); - if (VectorConfig.get() != null && VectorConfig.get().highlightMembers && VectorUtils.members != null && !VectorUtils.members.isEmpty()) strings.addAll(VectorUtils.members); - - for (String string : strings) { - for (ColoredText text : TextUtils.toColoredTextList(message)) { - if (text.getText().contains(string)) { - replace = true; - - String first = text.getText().substring(0, text.getText().indexOf(string)); - String middle = text.getText().substring(text.getText().indexOf(string), text.getText().indexOf(string) + string.length()); - String last = text.getText().substring(text.getText().indexOf(string) + string.length()); - - finalText.append(new LiteralText(first).setStyle(Style.EMPTY.withColor(text.getColor().getPacked()))); - finalText.append(new LiteralText(middle).formatted(Formatting.GOLD)); - finalText.append(new LiteralText(last).setStyle(Style.EMPTY.withColor(text.getColor().getPacked()))); - } else { - finalText.append(new LiteralText(text.getText()).setStyle(Style.EMPTY.withColor(text.getColor().getPacked()))); - } - } - - message = finalText; - finalText = new LiteralText(""); - } - - if (replace) event.setMessage(message); - - if (Players.get() != null) { - for (Player player : Players.get()) { - if (!event.getMessage().getString().contains("muted " + player.name) && player.muted && event.getMessage().getString().contains(player.name)) { - System.out.println(event.getMessage().getString()); - event.cancel(); - } - } - } - } } diff --git a/src/main/java/cally72jhb/addon/gui/tabs/VectorConfigTab.java b/src/main/java/cally72jhb/addon/gui/tabs/VectorConfigTab.java index 50635876..845d2001 100644 --- a/src/main/java/cally72jhb/addon/gui/tabs/VectorConfigTab.java +++ b/src/main/java/cally72jhb/addon/gui/tabs/VectorConfigTab.java @@ -93,27 +93,6 @@ public class VectorConfigTab extends Tab { }).build() ); - public static final Setting highlightMembers = sgMisc.add(new BoolSetting.Builder() - .name("highlight-members") - .description("Highlights Vector Users for you.") - .defaultValue(true) - .onChanged(bool -> VectorConfig.get().highlightMembers = bool) - .onModuleActivated(bool -> { - bool.set(VectorConfig.get().highlightMembers); - VectorUtils.members(); - }).build() - ); - - public static final Setting memberColor = sgMisc.add(new ColorSetting.Builder() - .name("member-color") - .description("The color the Vector Users will be highlighted with.") - .defaultValue(new SettingColor(255, 255, 145)) - .onChanged(color -> VectorConfig.get().memberColor = color) - .onModuleActivated(color -> color.set(VectorConfig.get().memberColor)) - .visible(highlightMembers::get) - .build() - ); - public static ConfigScreen currentScreen; public VectorConfigTab() { @@ -140,14 +119,6 @@ public ConfigScreen(GuiTheme theme, Tab tab) { @Override public void initWidgets() { add(theme.settings(settings)).expandX(); - - WTable table = add(theme.table()).expandX().minWidth(300).widget(); - - WButton reload = table.add(theme.button("Reload")).widget(); - - reload.action = VectorUtils::members; - - table.row(); } @Override diff --git a/src/main/java/cally72jhb/addon/mixin/EntityMixin.java b/src/main/java/cally72jhb/addon/mixin/EntityMixin.java index 0fcdcb9d..2f3fbfe1 100644 --- a/src/main/java/cally72jhb/addon/mixin/EntityMixin.java +++ b/src/main/java/cally72jhb/addon/mixin/EntityMixin.java @@ -1,8 +1,8 @@ package cally72jhb.addon.mixin; import cally72jhb.addon.system.modules.movement.AntiPistonPush; -import cally72jhb.addon.system.modules.movement.NoFluid; import cally72jhb.addon.system.modules.movement.AntiProne; +import cally72jhb.addon.system.modules.movement.NoFluid; import meteordevelopment.meteorclient.systems.modules.Modules; import net.minecraft.block.piston.PistonBehavior; import net.minecraft.entity.Entity; diff --git a/src/main/java/cally72jhb/addon/mixin/MinecraftClientMixin.java b/src/main/java/cally72jhb/addon/mixin/MinecraftClientMixin.java new file mode 100644 index 00000000..26ea005b --- /dev/null +++ b/src/main/java/cally72jhb/addon/mixin/MinecraftClientMixin.java @@ -0,0 +1,25 @@ +package cally72jhb.addon.mixin; + +import cally72jhb.addon.system.events.InteractEvent; +import cally72jhb.addon.system.modules.player.MultiTask; +import meteordevelopment.meteorclient.MeteorClient; +import meteordevelopment.meteorclient.systems.modules.Modules; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.client.network.ClientPlayerInteractionManager; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(MinecraftClient.class) +public class MinecraftClientMixin { + @Redirect(method = "handleBlockBreaking", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isUsingItem()Z")) + public boolean onHandleBlockBreaking(ClientPlayerEntity player) { + return !Modules.get().isActive(MultiTask.class) && MeteorClient.EVENT_BUS.post(InteractEvent.get(player.isUsingItem())).usingItem; + } + + @Redirect(method = "doItemUse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;isBreakingBlock()Z")) + public boolean onDoItemUse(ClientPlayerInteractionManager manager) { + return !Modules.get().isActive(MultiTask.class) && MeteorClient.EVENT_BUS.post(InteractEvent.get(manager.isBreakingBlock())).usingItem; + } +} diff --git a/src/main/java/cally72jhb/addon/system/Systems.java b/src/main/java/cally72jhb/addon/system/Systems.java index 77052d59..1ae9df8c 100644 --- a/src/main/java/cally72jhb/addon/system/Systems.java +++ b/src/main/java/cally72jhb/addon/system/Systems.java @@ -10,6 +10,7 @@ import cally72jhb.addon.system.hud.StatsHud; import cally72jhb.addon.system.modules.combat.BedBomb; import cally72jhb.addon.system.modules.combat.BowBomb; +import cally72jhb.addon.system.modules.combat.PacketBurrow; import cally72jhb.addon.system.modules.combat.VectorSurround; import cally72jhb.addon.system.modules.misc.*; import cally72jhb.addon.system.modules.movement.*; @@ -62,13 +63,16 @@ public static void init() { add(new BorderBypass()); add(new BowBomb()); //add(new CevBreaker()); + add(new ChatEncryption()); add(new ChorusPredict()); add(new DeathAnimations()); add(new EntityFly()); add(new InstaMinePlus()); add(new InventoryScroll()); add(new ItemRelease()); + add(new MultiTask()); add(new NoFluid()); + add(new PacketBurrow()); add(new PacketConsume()); add(new PacketFly()); add(new PacketLogger()); @@ -81,6 +85,7 @@ public static void init() { add(new SpeedBypass()); add(new StepPlus()); add(new StorageViewer()); + add(new TickShift()); add(new Tower()); add(new VectorPresence()); add(new VectorSurround()); diff --git a/src/main/java/cally72jhb/addon/system/commands/TrashCommand.java b/src/main/java/cally72jhb/addon/system/commands/TrashCommand.java index c9a1a017..373499b3 100644 --- a/src/main/java/cally72jhb/addon/system/commands/TrashCommand.java +++ b/src/main/java/cally72jhb/addon/system/commands/TrashCommand.java @@ -1,7 +1,6 @@ package cally72jhb.addon.system.commands; import com.google.common.collect.Lists; -import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; diff --git a/src/main/java/cally72jhb/addon/system/events/InteractEvent.java b/src/main/java/cally72jhb/addon/system/events/InteractEvent.java new file mode 100644 index 00000000..fc7294bd --- /dev/null +++ b/src/main/java/cally72jhb/addon/system/events/InteractEvent.java @@ -0,0 +1,11 @@ +package cally72jhb.addon.system.events; + +public class InteractEvent { + private static final InteractEvent INSTANCE = new InteractEvent(); + public boolean usingItem; + + public static InteractEvent get(boolean usingItem) { + INSTANCE.usingItem = usingItem; + return INSTANCE; + } +} diff --git a/src/main/java/cally72jhb/addon/system/modules/combat/BedBomb.java b/src/main/java/cally72jhb/addon/system/modules/combat/BedBomb.java index c1389c76..28ffc9b5 100644 --- a/src/main/java/cally72jhb/addon/system/modules/combat/BedBomb.java +++ b/src/main/java/cally72jhb/addon/system/modules/combat/BedBomb.java @@ -61,7 +61,6 @@ import net.minecraft.sound.SoundCategory; import net.minecraft.state.property.Properties; import net.minecraft.util.Hand; -import net.minecraft.util.Pair; import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.HitResult; @@ -71,9 +70,13 @@ import net.minecraft.world.RaycastContext; import net.minecraft.world.World; import net.minecraft.world.explosion.Explosion; +import oshi.util.tuples.Pair; import oshi.util.tuples.Triplet; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; import java.util.stream.Collectors; public class BedBomb extends Module { @@ -85,7 +88,6 @@ public class BedBomb extends Module { private final SettingGroup sgBreak = settings.createGroup("Break"); private final SettingGroup sgCity = settings.createGroup("Auto City"); private final SettingGroup sgCraft = settings.createGroup("Craft"); - private final SettingGroup sgKeys = settings.createGroup("Keybindings"); private final SettingGroup sgPause = settings.createGroup("Pause"); private final SettingGroup sgDisplay = settings.createGroup("Display"); private final SettingGroup sgRender = settings.createGroup("Render"); @@ -206,11 +208,41 @@ public class BedBomb extends Module { .build() ); - private final Setting randomOffset = sgBypass.add(new BoolSetting.Builder() - .name("random-offset") - .description("Offsets the placement hit position randomly the actual position isn't affected.") - .defaultValue(false) - .visible(packetPlace::get) + + // Keybindings + + + private final Setting speedPlace = sgBypass.add(new KeybindSetting.Builder() + .name("speed-place") + .description("The keybinding used to speed up placement.") + .defaultValue(Keybind.fromKey(-1)) + .build() + ); + + private final Setting speedBreak = sgBypass.add(new KeybindSetting.Builder() + .name("speed-break") + .description("The keybinding used to speed up bed breaking.") + .defaultValue(Keybind.fromKey(-1)) + .build() + ); + + private final Setting speedPlaceDelay = sgBypass.add(new IntSetting.Builder() + .name("speed-place-delay") + .description("How many ticks to wait before placing a bed when the force speed place key is pressed.") + .defaultValue(5) + .sliderMin(0) + .sliderMax(8) + .min(0) + .build() + ); + + private final Setting speedBreakDelay = sgBypass.add(new IntSetting.Builder() + .name("speed-break-delay") + .description("How many ticks to wait before breaking a bed when the force speed break key is pressed.") + .defaultValue(0) + .sliderMin(0) + .sliderMax(8) + .min(0) .build() ); @@ -227,7 +259,7 @@ public class BedBomb extends Module { private final Setting smartCalc = sgCalc.add(new BoolSetting.Builder() .name("smart-calc") - .description("Will not raycast from the irrelevant blocks that will probablyy not hurt any target.") + .description("Will not raycast from the irrelevant blocks that will probably not hurt any target.") .defaultValue(true) .build() ); @@ -282,6 +314,13 @@ public class BedBomb extends Module { .name("place-threading") .description("Calculates the placing in a separate thread to remove lag spikes.") .defaultValue(true) + .onChanged(bool -> { + multiThread = new ArrayList<>(); + bestPositions = new ArrayList<>(); + + placeThread = null; + breakThread = null; + }) .build() ); @@ -308,7 +347,7 @@ public class BedBomb extends Module { .sliderMax(16) .min(2) .max(128) - .onChanged(bool -> { + .onChanged(integer -> { multiThread = new ArrayList<>(); bestPositions = new ArrayList<>(); @@ -320,6 +359,20 @@ public class BedBomb extends Module { .build() ); + private final Setting smartPlaceThreading = sgCalc.add(new BoolSetting.Builder() + .name("smart-place-threading") + .description("Decides whether to use threads or not.") + .defaultValue(false) + .onChanged(bool -> { + multiThread = new ArrayList<>(); + bestPositions = new ArrayList<>(); + + placeThread = null; + breakThread = null; + }) + .build() + ); + private final Setting breakThreading = sgCalc.add(new BoolSetting.Builder() .name("break-threading") .description("Calculates the breaking in a separate thread to remove lag spikes.") @@ -420,7 +473,7 @@ public class BedBomb extends Module { .sliderMax(9) .min(1) .max(9) - .visible(() -> autoMove.get() && fixedMove.get() && tableMove.get()) + .visible(() -> autoMove.get() && fixedMove.get() && bedMove.get()) .noSlider() .build() ); @@ -433,7 +486,7 @@ public class BedBomb extends Module { .sliderMax(9) .min(1) .max(9) - .visible(() -> autoMove.get() && fixedMove.get() && bedMove.get()) + .visible(() -> autoMove.get() && fixedMove.get() && tableMove.get()) .noSlider() .build() ); @@ -890,44 +943,6 @@ public class BedBomb extends Module { ); - // Keybindings - - - private final Setting speedPlace = sgKeys.add(new KeybindSetting.Builder() - .name("speed-place") - .description("The keybinding used to speed up placement.") - .defaultValue(Keybind.fromKey(-1)) - .build() - ); - - private final Setting speedBreak = sgKeys.add(new KeybindSetting.Builder() - .name("speed-break") - .description("The keybinding used to speed up bed breaking.") - .defaultValue(Keybind.fromKey(-1)) - .build() - ); - - private final Setting speedPlaceDelay = sgKeys.add(new IntSetting.Builder() - .name("speed-place-delay") - .description("How many ticks to wait before placing a bed when the force speed place key is pressed.") - .defaultValue(5) - .sliderMin(0) - .sliderMax(8) - .min(0) - .build() - ); - - private final Setting speedBreakDelay = sgKeys.add(new IntSetting.Builder() - .name("speed-break-delay") - .description("How many ticks to wait before breaking a bed when the force speed break key is pressed.") - .defaultValue(0) - .sliderMin(0) - .sliderMax(8) - .min(0) - .build() - ); - - // Pause @@ -1175,8 +1190,6 @@ public class BedBomb extends Module { .build() ); - private final Random random = new Random(); - private List targets = new ArrayList<>(); private final Pool renderBlockPool = new Pool<>(RenderBlock::new); @@ -1215,7 +1228,7 @@ public class BedBomb extends Module { private long calcTime; public BedBomb() { - super(Categories.Combat, "bed-bomber", "Places and blows up beds near your targets."); + super(Categories.Combat, "bed-bomber", "Places and blows up beds near targets to deal alot of damage."); } @Override @@ -1344,7 +1357,7 @@ private void onPreTick(TickEvent.Pre event) { clickSlot(0, tableSlot.get() + 35, 1, SlotActionType.PICKUP); if (extraClick) slot = table.getSlot(); } else { - clickSlot(0, table.getSlot() - 1, tableSlot.get(), SlotActionType.SWAP); + clickSlot(0, table.getSlot(), tableSlot.get(), SlotActionType.SWAP); } } else if (fillEmptySlots.get()) { for (int i = 0; i < 9; i++) { @@ -1373,7 +1386,7 @@ private void onPreTick(TickEvent.Pre event) { clickSlot(0, (bedSlot.get().equals(tableSlot.get()) ? (tableSlot.get() >= 8 ? tableSlot.get() - 1 : tableSlot.get() + 1) : bedSlot.get()) + 35, 1, SlotActionType.PICKUP); if (extraClick) slot = bed.getSlot(); } else { - clickSlot(0, bed.getSlot() - 1, bedSlot.get(), SlotActionType.SWAP); + clickSlot(0, bed.getSlot(), bedSlot.get(), SlotActionType.SWAP); } } } else if (fillEmptySlots.get()) { @@ -1435,7 +1448,7 @@ private void onPreTick(TickEvent.Pre event) { } if (pos != null) { - BlockHitResult result = new BlockHitResult(randomOffset.get() ? offsetRandom(Vec3d.of(pos)) : Vec3d.ofCenter(pos), getSide(pos), pos, false); + BlockHitResult result = new BlockHitResult(Vec3d.ofCenter(pos), getSide(pos), pos, false); mc.getNetworkHandler().sendPacket(new PlayerInteractBlockC2SPacket(Hand.MAIN_HAND, result)); @@ -1443,13 +1456,15 @@ private void onPreTick(TickEvent.Pre event) { } else if (!placePositions.isEmpty() && craftPlace.get()) { List insecure = smartTablePlace.get() ? getAffectedBlocks(mc.player.getBlockPos()) : new ArrayList<>(); + placePositions.sort(Comparator.comparingDouble(position -> VectorUtils.distance(mc.player.getPos(), Vec3d.ofCenter(position)))); + for (BlockPos position : placePositions) { if (canPlace(position, Blocks.CRAFTING_TABLE.getDefaultState(), true) && (!smartTablePlace.get() || smartTablePlace.get() && !insecure.contains(position)) && (switchMode.get() != SwitchMode.None || (switchMode.get() == SwitchMode.None && mc.player.getOffHandStack().getItem() == Items.CRAFTING_TABLE && mc.player.getMainHandStack().getItem() == Items.CRAFTING_TABLE))) { - place(position, null, table, renderSwing.get(), true, randomOffset.get()); + place(position, null, table, renderSwing.get(), true); break; } } @@ -1495,7 +1510,7 @@ private void onPreTick(TickEvent.Pre event) { } } - if (grabTimes.get() == 1) clickSlot(handler.syncId, 0, 1, SlotActionType.QUICK_MOVE); + clickSlot(handler.syncId, 0, 1, SlotActionType.QUICK_MOVE); craftTicks = 0; break; @@ -1674,10 +1689,10 @@ && bedCount(0, 35) > 0 && bed.found() PlayerEntity target = targets.get(i); for (BlockPos position : surround) { - double damage = 0; - BlockPos pos = target.getBlockPos().add(position); + double damage = 0; + if (VectorUtils.distance(pX, pY, pZ, pos.getX(), pos.getY(), pos.getZ()) <= placeRangeSq) { if ((!smartCalc.get() || smartCalc.get() && canDealDamageToTargets(pos, calcRange.get())) && canPlace(pos, Blocks.RED_BED.getDefaultState(), false) && !getDirectionsForBlock(pos).isEmpty()) { @@ -1979,7 +1994,7 @@ && canPlace(pos, Blocks.RED_BED.getDefaultState(), false) && !getDirectionsForBl if (!renderOnlyOnce.get() || renderOnlyOnce.get() && shouldRender) renderBlocks.add(renderBlockPool.get().set(placePos, placeDir)); } - place(placePos, placeDir, bed, renderSwing.get(), true, randomOffset.get()); + place(placePos, placeDir, bed, renderSwing.get(), true); if (breakDelay.get() == 0) breakPos = placePos; if (resetDelayOnPlace.get()) breakTicks = 0; @@ -1988,8 +2003,6 @@ && canPlace(pos, Blocks.RED_BED.getDefaultState(), false) && !getDirectionsForBl placePos = null; placeTicks = 0; - state = State.Idling; - if (breakDelay.get() != 0) return; } } @@ -2130,7 +2143,7 @@ && getDamageToFriends(head, ignoreBed) <= maxFriendDamage.get()) { // Actual Placement - if (shouldPlace() && bed.found() && placeTicking.get() == PlaceTicking.Pre) { + if (shouldPlace() && bed.found() && placeTicking.get() == PlaceTicking.Post) { if (placePos == null || placeDir == null) { if ((!placeThreading.get() || placeThreading.get() && !multiPlaceThreading.get()) && placeThread != null && placeThread.getState() == Thread.State.NEW) { if (placeThreading.get()) { @@ -2177,7 +2190,7 @@ && getDamageToFriends(head, ignoreBed) <= maxFriendDamage.get()) { if (!renderOnlyOnce.get() || renderOnlyOnce.get() && shouldRender) renderBlocks.add(renderBlockPool.get().set(placePos, placeDir)); } - place(placePos, placeDir, bed, renderSwing.get(), true, randomOffset.get()); + place(placePos, placeDir, bed, renderSwing.get(), true); if (breakDelay.get() == 0) breakPos = placePos; if (resetDelayOnPlace.get()) breakTicks = 0; @@ -2185,8 +2198,6 @@ && getDamageToFriends(head, ignoreBed) <= maxFriendDamage.get()) { placeDir = null; placePos = null; placeTicks = 0; - - state = State.Idling; } } } @@ -2470,54 +2481,6 @@ && isVisibleToTargets(head, bed)) { // Valid Bed Directions - private Pair getBed(BlockPos pos) { - BlockPos foot = null; - BlockPos head = null; - BlockState state = VectorUtils.getBlockState(pos); - - if (state.get(Properties.BED_PART) == BedPart.FOOT && !getBreakDirections(pos).isEmpty()) { - Direction direction = state.get(HorizontalFacingBlock.FACING); - - if (direction != null - && VectorUtils.getBlock(pos.offset(direction)) instanceof BedBlock - && VectorUtils.getBlockState(pos.offset(direction)).get(Properties.BED_PART) == BedPart.HEAD - && VectorUtils.getBlockState(pos.offset(direction)).get(HorizontalFacingBlock.FACING).getOpposite() == direction) { - head = pos.offset(direction); - } - - if (head == null) { - for (Direction dir : getBreakDirections(pos)) { - if (VectorUtils.getBlock(pos.offset(dir)) instanceof BedBlock - && VectorUtils.getBlockState(pos.offset(dir)).get(Properties.BED_PART) == BedPart.HEAD) { - head = pos.offset(dir); - break; - } - } - } - } else if (state.get(Properties.BED_PART) == BedPart.FOOT && !getBreakDirections(pos).isEmpty()) { - Direction direction = state.get(HorizontalFacingBlock.FACING); - - if (direction != null - && VectorUtils.getBlock(pos.offset(direction)) instanceof BedBlock - && VectorUtils.getBlockState(pos.offset(direction)).get(Properties.BED_PART) == BedPart.FOOT - && VectorUtils.getBlockState(pos.offset(direction)).get(HorizontalFacingBlock.FACING).getOpposite() == direction) { - foot = pos.offset(direction); - } - - if (foot == null) { - for (Direction dir : getBreakDirections(pos)) { - if (VectorUtils.getBlock(pos.offset(dir)) instanceof BedBlock - && VectorUtils.getBlockState(pos.offset(dir)).get(Properties.BED_PART) == BedPart.FOOT) { - foot = pos.offset(dir); - break; - } - } - } - } - - return new Pair<>(head, foot); - } - private List getDirectionsForBlock(BlockPos pos) { if (placeScanMode.get() == PlaceScanMode.Lock) return List.of(mc.player.getHorizontalFacing()); List directions = new ArrayList<>(); @@ -2672,7 +2635,7 @@ private boolean isVisible(Vec3d start, BlockPos end, Entity entity, Pair { BlockState state = mc.world.getBlockState(pos); - if (bed != null && state.getBlock() instanceof BedBlock && (pos.equals(bed.getLeft()) || pos.equals(bed.getRight()))) state = Blocks.AIR.getDefaultState(); + if (bed != null && state.getBlock() instanceof BedBlock && (pos.equals(bed.getA()) || pos.equals(bed.getB()))) state = Blocks.AIR.getDefaultState(); BlockHitResult blockResult = mc.world.raycastBlock(start, raycast.getEnd(), pos, raycast.getBlockShape(state, mc.world, pos), state); BlockHitResult emptyResult = VoxelShapes.empty().raycast(start, raycast.getEnd(), pos); @@ -2759,7 +2722,7 @@ private BlockHitResult raycast(RaycastContext context, Pair return BlockView.raycast(context.getStart(), context.getEnd(), context, (raycast, pos) -> { BlockState state = mc.world.getBlockState(pos); if (ignoreTerrain && state.getBlock().getBlastResistance() < 600 && !(state.getBlock() instanceof BedBlock)) state = Blocks.AIR.getDefaultState(); - if (bed != null && state.getBlock() instanceof BedBlock && (pos.equals(bed.getLeft()) || pos.equals(bed.getRight()))) state = Blocks.AIR.getDefaultState(); + if (bed != null && state.getBlock() instanceof BedBlock && (pos.equals(bed.getA()) || pos.equals(bed.getB()))) state = Blocks.AIR.getDefaultState(); if (stabilize.get() && state.getBlock() instanceof BedBlock) { boolean inside = false; @@ -2842,19 +2805,20 @@ private List getAffectedBlocks(BlockPos pos) { // Placing - private void place(BlockPos pos, Direction dir, FindItemResult item, boolean swingHand, boolean checkEntities, boolean randomOffset) { - if (item != null && item.found()) { + private void place(BlockPos pos, Direction dir, FindItemResult item, boolean swingHand, boolean checkEntities) { + if (pos != null && item != null && item.found()) { if (item.isOffhand()) { - place(pos, dir, Hand.OFF_HAND, mc.player.getInventory().selectedSlot, swingHand, checkEntities, randomOffset); + place(pos, dir, Hand.OFF_HAND, mc.player.getInventory().selectedSlot, swingHand, checkEntities); } else if (item.isHotbar()) { - place(pos, dir, Hand.MAIN_HAND, item.getSlot(), swingHand, checkEntities, randomOffset); + place(pos, dir, Hand.MAIN_HAND, item.getSlot(), swingHand, checkEntities); } } } - private void place(BlockPos pos, Direction dir, Hand hand, int slot, boolean swingHand, boolean checkEntities, boolean offsetRandom) { - if (slot >= 0 && slot <= 9 || slot == 45) { - Vec3d hitPos = getHitPos(pos, offsetRandom); + private void place(BlockPos pos, Direction dir, Hand hand, int slot, boolean swingHand, boolean checkEntities) { + if ((slot >= 0 && slot <= 9 || slot == 45) && pos != null) { + Vec3d hitPos = Vec3d.ofCenter(pos); + BlockPos neighbour = getNeighbourPos(pos); Direction side = getSide(pos); @@ -2903,23 +2867,6 @@ private void place(BlockHitResult result, Hand hand, boolean packetPlace, boolea } } - private Vec3d getHitPos(BlockPos pos, boolean offsetRandom) { - Vec3d hitPos = offsetRandom ? offsetRandom(Vec3d.of(pos)) : Vec3d.ofCenter(pos); - Direction side = getPlaceSide(pos); - - if (side != null) hitPos.add(side.getOffsetX() * 0.5D, side.getOffsetY() * 0.5D, side.getOffsetZ() * 0.5D); - - return hitPos; - } - - private Vec3d offsetRandom(Vec3d vec) { - double px = random.nextDouble(0.9) + 0.5; - double py = random.nextDouble(0.9) + 0.5; - double pz = random.nextDouble(0.9) + 0.5; - - return new Vec3d(vec.getX() + px, vec.getY() + py, vec.getZ() + pz); - } - private BlockPos getNeighbourPos(BlockPos pos) { Direction side = getPlaceSide(pos); BlockPos neighbour; @@ -2957,7 +2904,7 @@ private boolean canPlace(BlockPos pos, BlockState state, boolean checkEntities) // Breaking private void breakBed(BlockPos pos) { - breakBed(new BlockHitResult(randomOffset.get() ? offsetRandom(Vec3d.of(pos)) : Vec3d.ofCenter(pos), getBestSide(pos), pos, false), Hand.OFF_HAND); + if (pos != null) breakBed(new BlockHitResult(Vec3d.ofCenter(pos), getBestSide(pos), pos, false), Hand.OFF_HAND); } private void breakBed(BlockHitResult result, Hand hand) { diff --git a/src/main/java/cally72jhb/addon/system/modules/combat/PacketBurrow.java b/src/main/java/cally72jhb/addon/system/modules/combat/PacketBurrow.java new file mode 100644 index 00000000..275e5f8d --- /dev/null +++ b/src/main/java/cally72jhb/addon/system/modules/combat/PacketBurrow.java @@ -0,0 +1,373 @@ +package cally72jhb.addon.system.modules.combat; + +import cally72jhb.addon.system.categories.Categories; +import cally72jhb.addon.utils.VectorUtils; +import meteordevelopment.meteorclient.events.meteor.KeyEvent; +import meteordevelopment.meteorclient.events.world.TickEvent; +import meteordevelopment.meteorclient.settings.*; +import meteordevelopment.meteorclient.systems.modules.Module; +import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.world.Timer; +import meteordevelopment.meteorclient.utils.misc.input.KeyAction; +import meteordevelopment.meteorclient.utils.player.FindItemResult; +import meteordevelopment.meteorclient.utils.player.InvUtils; +import meteordevelopment.meteorclient.utils.player.PlayerUtils; +import meteordevelopment.meteorclient.utils.player.Rotations; +import meteordevelopment.orbit.EventHandler; +import net.minecraft.block.AnvilBlock; +import net.minecraft.block.BlockState; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.item.Items; +import net.minecraft.network.packet.c2s.play.HandSwingC2SPacket; +import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; +import net.minecraft.util.Hand; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.registry.Registry; + +import java.util.ArrayList; + +public class PacketBurrow extends Module { + private final SettingGroup sgGeneral = settings.getDefaultGroup(); + private final SettingGroup sgCheck = settings.createGroup("Check"); + + private final Setting bypassMode = sgGeneral.add(new EnumSetting.Builder() + .name("bypass-mode") + .description("How to bypass the anti-cheat.") + .defaultValue(BypassMode.Rubberband) + .build() + ); + + private final Setting block = sgGeneral.add(new EnumSetting.Builder() + .name("block-to-use") + .description("Which block to use for burrow.") + .defaultValue(Block.Anvil) + .build() + ); + + private final Setting instant = sgGeneral.add(new BoolSetting.Builder() + .name("instant") + .description("Jumps with packets rather than vanilla jump.") + .defaultValue(true) + .build() + ); + + private final Setting automatic = sgGeneral.add(new BoolSetting.Builder() + .name("automatic") + .description("Automatically burrows on activate rather than waiting for jump.") + .defaultValue(true) + .build() + ); + + private final Setting triggerHeight = sgGeneral.add(new DoubleSetting.Builder() + .name("trigger-height") + .description("How high you have to jump before a rubberband is triggered.") + .defaultValue(1.12) + .sliderMin(0) + .sliderMax(1.5) + .min(0) + .max(1.5) + .build() + ); + + private final Setting rubberbandHeight = sgGeneral.add(new DoubleSetting.Builder() + .name("rubberband-height") + .description("How far to attempt to cause rubberband.") + .defaultValue(12) + .sliderMin(-30) + .sliderMax(30) + .build() + ); + + private final Setting timer = sgGeneral.add(new DoubleSetting.Builder() + .name("timer") + .description("Timer override.") + .defaultValue(1) + .sliderMin(0.01) + .sliderMax(10) + .min(0.01) + .build() + ); + + private final Setting placePosition = sgGeneral.add(new IntSetting.Builder() + .name("place-position") + .description("When the block is placed.") + .defaultValue(6) + .sliderMin(0) + .sliderMax(12) + .min(0) + .max(12) + .noSlider() + .visible(() -> bypassMode.get() == BypassMode.PacketJump) + .build() + ); + + private final Setting spoofOnGround = sgGeneral.add(new BoolSetting.Builder() + .name("spoof-on-ground") + .description("Spoofs you on ground server-side.") + .defaultValue(false) + .build() + ); + + private final Setting center = sgGeneral.add(new BoolSetting.Builder() + .name("center") + .description("Centers you to the middle of the block before burrowing.") + .defaultValue(false) + .build() + ); + + private final Setting rotate = sgGeneral.add(new BoolSetting.Builder() + .name("rotate") + .description("Faces the block you place server-side.") + .defaultValue(true) + .build() + ); + + // Checking + + private final Setting onlyInHole = sgCheck.add(new BoolSetting.Builder() + .name("only-in-holes") + .description("Stops you from burrowing when not in a hole.") + .defaultValue(false) + .build() + ); + + private final Setting onlyOnGround = sgCheck.add(new BoolSetting.Builder() + .name("only-on-ground") + .description("Stops you from burrowing when not in a hole.") + .defaultValue(false) + .build() + ); + + private final Setting checkHead = sgCheck.add(new BoolSetting.Builder() + .name("check-head") + .description("Only burrows when there is enough headroom to burrow.") + .defaultValue(true) + .build() + ); + + private final Setting reburrow = sgCheck.add(new BoolSetting.Builder() + .name("reburrow") + .description("Allows you to burrow even if already burrowed.") + .defaultValue(true) + .build() + ); + + private BlockPos pos; + private boolean shouldBurrow; + + public PacketBurrow() { + super(Categories.Combat, "packet-burrow", "Attempts to clip you into a block to prevent loads of damage."); + } + + @Override + public void onActivate() { + if (!VectorUtils.getBlockState(mc.player.getBlockPos()).getMaterial().isReplaceable() && !reburrow.get()) { + error("Already burrowed, disabling."); + toggle(); + return; + } + + if (!isInHole() && onlyInHole.get()) { + error("Not in a hole, disabling."); + toggle(); + return; + } + + if (!mc.player.isOnGround() && onlyOnGround.get()) { + error("Not on Ground, disabling."); + toggle(); + return; + } + + if (!checkHead() && checkHead.get()) { + error("Not enough headroom to burrow, disabling."); + toggle(); + return; + } + + FindItemResult block = getBestBlock(); + + if (!block.isHotbar() && !block.isOffhand()) { + error("No burrow block found, disabling."); + toggle(); + return; + } + + Modules.get().get(Timer.class).setOverride(timer.get()); + + pos = mc.player.getBlockPos(); + shouldBurrow = false; + + if (automatic.get()) { + if (instant.get()) shouldBurrow = true; + else mc.player.jump(); + } else { + info("Waiting for manual jump."); + } + } + + @Override + public void onDeactivate() { + Modules.get().get(Timer.class).setOverride(Timer.OFF); + } + + @EventHandler + private void onTick(TickEvent.Pre event) { + if (!instant.get()) shouldBurrow = mc.player.getY() > (pos.getY() + triggerHeight.get()); + if (!shouldBurrow && instant.get()) pos = mc.player.getBlockPos(); + + if (shouldBurrow) { + if (rotate.get()) { + Rotations.rotate(Rotations.getYaw(mc.player.getBlockPos()), Rotations.getPitch(mc.player.getBlockPos()), 50, this::burrow); + } else { + burrow(); + } + + toggle(); + } + } + + @EventHandler + private void onKey(KeyEvent event) { + if (instant.get() && !shouldBurrow) { + if (event.action == KeyAction.Press && mc.options.jumpKey.matchesKey(event.key, 0)) shouldBurrow = true; + + pos = mc.player.getBlockPos(); + } + } + + private void burrow() { + if (center.get()) PlayerUtils.centerPlayer(); + + boolean onGround = spoofOnGround.get(); + + if (bypassMode.get() == BypassMode.Rubberband) { + if (instant.get()) { + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + 0.4, mc.player.getZ(), onGround)); + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + 0.75, mc.player.getZ(), onGround)); + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + 1.01, mc.player.getZ(), onGround)); + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + 1.15, mc.player.getZ(), onGround)); + } + + place(); + + if (instant.get()) { + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + rubberbandHeight.get(), mc.player.getZ(), false)); + } else { + mc.player.updatePosition(mc.player.getX(), mc.player.getY() + rubberbandHeight.get(), mc.player.getZ()); + } + } else { + double x = mc.player.getX(); + double y = mc.player.getY(); + double z = mc.player.getZ(); + + if (placePosition.get() == 0) place(); + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y, z, onGround)); + if (placePosition.get() == 1) place(); + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 0.41999998688698, z, onGround)); + if (placePosition.get() == 2) place(); + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 0.75319998052120, z, onGround)); + if (placePosition.get() == 3) place(); + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 1.00133597911214, z, onGround)); + if (placePosition.get() == 4) place(); + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 1.16610926093821, z, onGround)); + if (placePosition.get() == 5) place(); + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 1.24918707874468, z, onGround)); + if (placePosition.get() == 6) place(); + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 1.17675927506424, z, onGround)); + if (placePosition.get() == 7) place(); + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 1.02442408821369, z, onGround)); + if (placePosition.get() == 8) place(); + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 0.79673560066871, z, onGround)); + if (placePosition.get() == 9) place(); + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 0.49520087700593, z, onGround)); + if (placePosition.get() == 10) place(); + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 0.12129684053920, z, onGround)); + if (placePosition.get() == 11) place(); + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y, z, onGround)); + if (placePosition.get() == 12) place(); + + if (instant.get()) { + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + rubberbandHeight.get(), mc.player.getZ(), false)); + } else { + mc.player.updatePosition(mc.player.getX(), mc.player.getY() + rubberbandHeight.get(), mc.player.getZ()); + } + } + } + + // Utils + + private void place() { + FindItemResult block = getBestBlock(); + + if (!(mc.player.getInventory().getStack(block.slot()).getItem() instanceof BlockItem)) return; + InvUtils.swap(block.slot(), true); + + mc.interactionManager.interactBlock(mc.player, mc.world, Hand.MAIN_HAND, new BlockHitResult(Vec3d.ofCenter(pos), Direction.UP, pos, false)); + mc.player.networkHandler.sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND)); + + InvUtils.swapBack(); + } + + private boolean checkHead() { + BlockState state1 = VectorUtils.getBlockState(new BlockPos(mc.player.getX() + 0.3, mc.player.getY() + 2.3, mc.player.getZ() + 0.3)); + BlockState state2 = VectorUtils.getBlockState(new BlockPos(mc.player.getX() + 0.3, mc.player.getY() + 2.3, mc.player.getZ() - 0.3)); + BlockState state3 = VectorUtils.getBlockState(new BlockPos(mc.player.getX() - 0.3, mc.player.getY() + 2.3, mc.player.getZ() - 0.3)); + BlockState state4 = VectorUtils.getBlockState(new BlockPos(mc.player.getX() - 0.3, mc.player.getY() + 2.3, mc.player.getZ() + 0.3)); + + return state1.getMaterial().isReplaceable() & state2.getMaterial().isReplaceable() & state3.getMaterial().isReplaceable() & state4.getMaterial().isReplaceable(); + } + + private boolean isInHole() { + int i = 0; + + for (BlockPos pos : surround) { + net.minecraft.block.Block block = VectorUtils.getBlock(mc.player.getBlockPos().add(pos)); + if (block != null && block.getBlastResistance() >= 600.0F) i++; + } + + return i == 4; + } + + private FindItemResult getBestBlock() { + return switch (block.get()) { + case Chest -> InvUtils.findInHotbar(stack -> stack.getItem() == Items.CHEST || stack.getItem() == Items.TRAPPED_CHEST || stack.getItem() == Items.ENDER_CHEST); + case Anvil -> InvUtils.findInHotbar(itemStack -> net.minecraft.block.Block.getBlockFromItem(itemStack.getItem()) instanceof AnvilBlock); + case Held -> new FindItemResult(mc.player.getInventory().selectedSlot, mc.player.getMainHandStack().getCount()); + case Inexplodable -> InvUtils.findInHotbar(stack -> isInexplodable(stack.getItem())); + default -> InvUtils.findInHotbar(Items.OBSIDIAN, Items.CRYING_OBSIDIAN); + }; + } + + private boolean isInexplodable(Item item) { + return Registry.BLOCK.stream().allMatch(block -> block.getBlastResistance() >= 600.0F && block.asItem() == item); + } + + // Constants + + private final ArrayList surround = new ArrayList<>() {{ + add(new BlockPos(1, 0, 0)); + add(new BlockPos(-1, 0, 0)); + add(new BlockPos(0, 0, 1)); + add(new BlockPos(0, 0, -1)); + }}; + + // Enums + + public enum BypassMode { + PacketJump, + Rubberband + } + + public enum Block { + Chest, + Obsidian, + Inexplodable, + Anvil, + Held + } +} diff --git a/src/main/java/cally72jhb/addon/system/modules/misc/ChatEncryption.java b/src/main/java/cally72jhb/addon/system/modules/misc/ChatEncryption.java new file mode 100644 index 00000000..ee3750f8 --- /dev/null +++ b/src/main/java/cally72jhb/addon/system/modules/misc/ChatEncryption.java @@ -0,0 +1,185 @@ +package cally72jhb.addon.system.modules.misc; + +import cally72jhb.addon.system.categories.Categories; +import cally72jhb.addon.system.events.SendRawMessageEvent; +import cally72jhb.addon.utils.encryption.EncryptUtils; +import meteordevelopment.meteorclient.events.game.ReceiveMessageEvent; +import meteordevelopment.meteorclient.events.game.SendMessageEvent; +import meteordevelopment.meteorclient.settings.*; +import meteordevelopment.meteorclient.systems.modules.Module; +import meteordevelopment.orbit.EventHandler; +import net.minecraft.text.HoverEvent; +import net.minecraft.text.LiteralText; +import net.minecraft.text.Style; +import net.minecraft.util.Formatting; + +public class ChatEncryption extends Module { + private final SettingGroup sgGeneral = settings.getDefaultGroup(); + + private final Setting key = sgGeneral.add(new StringSetting.Builder() + .name("key") + .description("What key is used to encrypt and decrypt messages.") + .defaultValue("vector") + .build() + ); + + private final Setting secretKey = sgGeneral.add(new StringSetting.Builder() + .name("secret-key") + .description("A secondary key to ensure safety.") + .defaultValue(":>") + .build() + ); + + private final Setting encryptionPrefix = sgGeneral.add(new StringSetting.Builder() + .name("encryption-prefix") + .description("What is used as prefix to encrypt messages.") + .defaultValue("!enc:") + .build() + ); + + private final Setting decryptionPrefix = sgGeneral.add(new StringSetting.Builder() + .name("encryption-prefix") + .description("What is used as prefix to decrypt messages.") + .defaultValue("!dnc:") + .build() + ); + + private final Setting alwaysEncrypt = sgGeneral.add(new BoolSetting.Builder() + .name("always-encrypt") + .description("Always encrypts your messages automatically.") + .defaultValue(false) + .build() + ); + + private final Setting wrapLength = sgGeneral.add(new IntSetting.Builder() + .name("wrap-length") + .description("How many characters to fit in one line.") + .defaultValue(50) + .sliderMin(40) + .sliderMax(75) + .min(1) + .max(256) + .noSlider() + .build() + ); + + public ChatEncryption() { + super(Categories.Misc, "chat-encryption", "Encrypts your chat messages to make them unreadable to other people."); + } + + @EventHandler + private void onSendMessage(SendMessageEvent event) { + event.message = encrypt(alwaysEncrypt.get() ? encryptionPrefix.get() + event.message + ";" : event.message); + } + + @EventHandler + private void onSendRawMessage(SendRawMessageEvent event) { + event.message = encrypt(event.message); + } + + private String encrypt(String string) { + if (string.contains(encryptionPrefix.get()) && string.contains(";") && string.indexOf(encryptionPrefix.get()) < string.indexOf(";", string.indexOf(encryptionPrefix.get()))) { + try { + int index; + + while ((index = string.indexOf(encryptionPrefix.get())) != -1) { + String toEncrypt = string.substring(index + encryptionPrefix.get().length(), string.indexOf(";", index)); + String encrypted; + + try { + encrypted = EncryptUtils.encrypt(toEncrypt.concat(secretKey.get()), key.get()); + } catch (Exception exception) { + exception.printStackTrace(); + warning("Encryption failed: " + exception + " Exception."); + + return string; + } + + string = string.substring(0, index).concat(string.substring(index).replaceFirst(encryptionPrefix.get() + toEncrypt + ";", decryptionPrefix.get() + encrypted + ";")); + } + + if (string.length() > 256) { + warning("The encrypted string is above 256 characters. Unable to encrypt."); + + return string; + } + + return string; + } catch (Exception exception) { + exception.printStackTrace(); + warning("Encryption failed: Invalid format caused a " + exception + " Exception."); + + return string; + } + } + + return string; + } + + @EventHandler + public void onReceiveMessage(ReceiveMessageEvent event) { + StringBuilder builder = new StringBuilder(); + + event.getMessage().asOrderedText().accept((i, style, codePoint) -> { + builder.append(new String(Character.toChars(codePoint))); + return true; + }); + + String string = builder.toString(); + String original = builder.toString(); + + if (string.contains(decryptionPrefix.get()) && string.contains(";") && string.indexOf(decryptionPrefix.get()) < string.indexOf(";", string.indexOf(decryptionPrefix.get()))) { + try{ + int index; + + while ((index = string.indexOf(decryptionPrefix.get())) != -1) { + String toDecrypt = string.substring(string.indexOf(decryptionPrefix.get(), index) + decryptionPrefix.get().length(), string.indexOf(";", index)); + String decrypted; + + try { + decrypted = EncryptUtils.decrypt(toDecrypt, key.get()); + + if (!decrypted.endsWith(secretKey.get())) return; + + decrypted = decrypted.substring(0, decrypted.length() - secretKey.get().length()); + } catch (Exception exception) { + exception.printStackTrace(); + warning("Decryption failed: " + exception + " Exception."); + + return; + } + + string = string.substring(0, index).concat(string.substring(index).replace(decryptionPrefix.get() + toDecrypt + ";", decrypted)); + } + + StringBuilder wrap = new StringBuilder(); + + int i = 0; + + if (!original.isEmpty()) { + for (char c : original.toCharArray()) { + i++; + + if (i > wrapLength.get()) { + wrap.append("\n"); + i = 0; + } + + wrap.append(c); + } + } + + event.setMessage(new LiteralText(string + " ").append(new LiteralText("[Decrypted]") + .setStyle(Style.EMPTY.withColor(Formatting.GOLD) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText(wrap.toString()) + .setStyle(Style.EMPTY.withColor(Formatting.LIGHT_PURPLE)) + )) + ) + )); + } catch (Exception exception) { + exception.printStackTrace(); + warning("Decryption failed: Invalid format caused a " + exception + " Exception"); + } + } + } +} diff --git a/src/main/java/cally72jhb/addon/system/modules/misc/PacketLogger.java b/src/main/java/cally72jhb/addon/system/modules/misc/PacketLogger.java index 5afa692c..93e193bf 100644 --- a/src/main/java/cally72jhb/addon/system/modules/misc/PacketLogger.java +++ b/src/main/java/cally72jhb/addon/system/modules/misc/PacketLogger.java @@ -12,7 +12,11 @@ import meteordevelopment.orbit.EventHandler; import meteordevelopment.orbit.EventPriority; import net.minecraft.network.Packet; +import net.minecraft.network.listener.ClientPlayPacketListener; +import net.minecraft.network.listener.ServerPlayPacketListener; +import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket; +import java.lang.reflect.Constructor; import java.util.Set; public class PacketLogger extends Module { @@ -25,6 +29,14 @@ public class PacketLogger extends Module { .build() ); + private final Setting s2cConstructor = sgGeneral.add(new BoolSetting.Builder() + .name("s2c-constructor") + .description("Prints out the packets constructors.") + .defaultValue(false) + .visible(s2c::get) + .build() + ); + private final Setting c2s = sgGeneral.add(new BoolSetting.Builder() .name("client-to-server") .description("Prints out the client-to-server packets in chat.") @@ -32,17 +44,27 @@ public class PacketLogger extends Module { .build() ); + private final Setting c2sConstructor = sgGeneral.add(new BoolSetting.Builder() + .name("c2s-constructor") + .description("Prints out the packets constructors.") + .defaultValue(true) + .visible(c2s::get) + .build() + ); + private final Setting>>> s2cPackets = sgGeneral.add(new PacketListSetting.Builder() - .name("S2C-packets") - .description("Server-to-client packets to ignore.") + .name("s2c-packets") + .description("Server-to-client packets to not print out.") .filter(klass -> PacketUtils.getS2CPackets().contains(klass)) + .visible(s2c::get) .build() ); private final Setting>>> c2sPackets = sgGeneral.add(new PacketListSetting.Builder() - .name("C2S-packets") - .description("Client-to-server packets to ignore.") + .name("c2s-packets") + .description("Client-to-server packets to not print out.") .filter(klass -> PacketUtils.getC2SPackets().contains(klass)) + .visible(c2s::get) .build() ); @@ -56,18 +78,42 @@ private class Listener { @EventHandler(priority = EventPriority.HIGHEST + 1) private void onReceivePacket(PacketEvent.Receive event) { if (isActive() && s2c.get() && !s2cPackets.get().contains(event.packet.getClass()) && !s2cPackets.get().contains(event.packet.getClass().getSuperclass())) { - String name = PacketUtils.getName((Class>) event.packet.getClass()); - if (name == null) name = PacketUtils.getName((Class>) event.packet.getClass().getSuperclass()); - info("" + name); + Class> packet = (Class>) event.packet.getClass(); + + String name = PacketUtils.getName(packet); + + if (name == null) { + packet = (Class>) event.packet.getClass().getSuperclass(); + name = PacketUtils.getName(packet); + } + + info(name); + + if (s2cConstructor.get()) { + for (Constructor constructor : packet.getConstructors()) info("constructor: " + constructor); + for (Constructor constructor : packet.getDeclaredConstructors()) info("declared constructor: " + constructor); + } } } @EventHandler(priority = EventPriority.HIGHEST + 1) private void onSendPacket(PacketEvent.Send event) { if (isActive() && c2s.get() && !c2sPackets.get().contains(event.packet.getClass()) && !c2sPackets.get().contains(event.packet.getClass().getSuperclass())) { - String name = PacketUtils.getName((Class>) event.packet.getClass()); - if (name == null) name = PacketUtils.getName((Class>) event.packet.getClass().getSuperclass()); - info("" + name); + Class> packet = (Class>) event.packet.getClass(); + + String name = PacketUtils.getName(packet); + + if (name == null) { + packet = (Class>) event.packet.getClass().getSuperclass(); + name = PacketUtils.getName(packet); + } + + info(name); + + if (c2sConstructor.get()) { + for (Constructor constructor : packet.getConstructors()) info("constructor: " + constructor); + for (Constructor constructor : packet.getDeclaredConstructors()) info("declared constructor: " + constructor); + } } } } diff --git a/src/main/java/cally72jhb/addon/system/modules/movement/StepPlus.java b/src/main/java/cally72jhb/addon/system/modules/movement/StepPlus.java index 5d44d27d..b2c0676c 100644 --- a/src/main/java/cally72jhb/addon/system/modules/movement/StepPlus.java +++ b/src/main/java/cally72jhb/addon/system/modules/movement/StepPlus.java @@ -3,7 +3,10 @@ import cally72jhb.addon.system.categories.Categories; import cally72jhb.addon.utils.VectorUtils; import meteordevelopment.meteorclient.events.entity.player.PlayerMoveEvent; -import meteordevelopment.meteorclient.settings.*; +import meteordevelopment.meteorclient.settings.BoolSetting; +import meteordevelopment.meteorclient.settings.EnumSetting; +import meteordevelopment.meteorclient.settings.Setting; +import meteordevelopment.meteorclient.settings.SettingGroup; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.world.Timer; diff --git a/src/main/java/cally72jhb/addon/system/modules/movement/TickShift.java b/src/main/java/cally72jhb/addon/system/modules/movement/TickShift.java new file mode 100644 index 00000000..7e4ac7ad --- /dev/null +++ b/src/main/java/cally72jhb/addon/system/modules/movement/TickShift.java @@ -0,0 +1,245 @@ +package cally72jhb.addon.system.modules.movement; + +import cally72jhb.addon.system.categories.Categories; +import cally72jhb.addon.utils.VectorUtils; +import meteordevelopment.meteorclient.events.packets.PacketEvent; +import meteordevelopment.meteorclient.events.render.Render3DEvent; +import meteordevelopment.meteorclient.events.world.TickEvent; +import meteordevelopment.meteorclient.renderer.ShapeMode; +import meteordevelopment.meteorclient.settings.*; +import meteordevelopment.meteorclient.systems.modules.Module; +import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.world.Timer; +import meteordevelopment.meteorclient.utils.render.RenderUtils; +import meteordevelopment.meteorclient.utils.render.color.SettingColor; +import meteordevelopment.orbit.EventHandler; +import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; + +public class TickShift extends Module { + private final SettingGroup sgGeneral = settings.getDefaultGroup(); + private final SettingGroup sgRender = settings.createGroup("Render"); + + private final Setting ticks = sgGeneral.add(new IntSetting.Builder() + .name("tick-duration") + .description("The duration of the timer phase.") + .defaultValue(50) + .sliderMin(25) + .sliderMax(75) + .min(1) + .build() + ); + + private final Setting timer = sgGeneral.add(new DoubleSetting.Builder() + .name("timer") + .description("How much to speed up the game when in the timer phase.") + .defaultValue(2) + .sliderMin(1.5) + .sliderMax(15) + .min(1) + .build() + ); + + private final Setting onlyOnGround = sgGeneral.add(new BoolSetting.Builder() + .name("only-on-ground") + .description("Whether or not to tick-shift in the air.") + .defaultValue(true) + .build() + ); + + private final Setting activeWhen = sgGeneral.add(new EnumSetting.Builder() + .name("active-when") + .description("When the module should be active.") + .defaultValue(ActiveWhen.Always) + .build() + ); + + private final Setting rubberbandMode = sgGeneral.add(new EnumSetting.Builder() + .name("rubberband-mode") + .description("What to do when rubberbanding.") + .defaultValue(RubberbandMode.Disable) + .build() + ); + + private final Setting rubberbandInfo = sgGeneral.add(new BoolSetting.Builder() + .name("rubberband-info") + .description("Informs you when you got rubberbanded.") + .defaultValue(true) + .build() + ); + + private final Setting messageCooldown = sgGeneral.add(new IntSetting.Builder() + .name("message-cooldown") + .description("How long to wait befor informing you another time.") + .defaultValue(500) + .sliderMin(450) + .sliderMax(750) + .min(0) + .visible(rubberbandInfo::get) + .build() + ); + + private final Setting maxTimerDistance = sgGeneral.add(new DoubleSetting.Builder() + .name("max-timer-distance") + .description("The maximum distance in which you can timer.") + .defaultValue(5) + .sliderMin(1.5) + .sliderMax(10) + .min(0) + .build() + ); + + // Render + + private final Setting render = sgRender.add(new BoolSetting.Builder() + .name("render") + .description("Whether or not to render your starting position.") + .defaultValue(true) + .build() + ); + + private final Setting accurate = sgRender.add(new BoolSetting.Builder() + .name("accurate") + .description("Whether or not to render the position accurate.") + .defaultValue(true) + .visible(render::get) + .build() + ); + + private final Setting shapeMode = sgRender.add(new EnumSetting.Builder() + .name("shape-mode") + .description("How the shapes are rendered.") + .defaultValue(ShapeMode.Both) + .visible(render::get) + .build() + ); + + private final Setting sideColor = sgRender.add(new ColorSetting.Builder() + .name("side-color") + .description("The side color of the start position rendering.") + .defaultValue(new SettingColor(255, 255, 255, 10)) + .visible(render::get) + .build() + ); + + private final Setting lineColor = sgRender.add(new ColorSetting.Builder() + .name("line-color") + .description("The line color of the start position rendering.") + .defaultValue(new SettingColor(255, 255, 255)) + .visible(render::get) + .build() + ); + + private final Setting tracerColor = sgRender.add(new ColorSetting.Builder() + .name("tracer-color") + .description("The color of the tracer.") + .defaultValue(new SettingColor(255, 255, 255, 255)) + .visible(render::get) + .build() + ); + + private int tick; + private int messageTicks; + private Vec3d startVec; + + public TickShift() { + super(Categories.Movement, "tick-shift", "Allows to essentially timer for a certain time."); + } + + @Override + public void onActivate() { + tick = 0; + messageTicks = messageCooldown.get(); + + startVec = null; + } + + @Override + public void onDeactivate() { + Modules.get().get(Timer.class).setOverride(Timer.OFF); + } + + @Override + public String getInfoString() { + return isMoving() && tick > 0 ? "[" + tick + "]" : null; + } + + @EventHandler + private void onPreTick(TickEvent.Pre event) { + messageTicks++; + + Modules.get().get(Timer.class).setOverride(Timer.OFF); + + if (tick <= 0) tick = 0; + + if ((activeWhen.get() == ActiveWhen.Sneaking && mc.player.isSneaking()) + || (activeWhen.get() == ActiveWhen.NotSneaking && !mc.player.isSneaking()) + || (onlyOnGround.get() && mc.player.isOnGround())) { + + if (isMoving() && (maxTimerDistance.get() == 0 || maxTimerDistance.get() != 0 && startVec != null && VectorUtils.distance(mc.player.getPos(), startVec) <= maxTimerDistance.get())) { + if (tick > 0) { + Modules.get().get(Timer.class).setOverride(timer.get()); + tick--; + } + } + + if (!isMoving()) startVec = mc.player.getPos(); + } + + if (!isMoving()) tick++; + if (tick >= ticks.get()) tick = ticks.get(); + } + + @EventHandler + private void onPacketReceive(PacketEvent.Receive event) { + if (event.packet instanceof PlayerPositionLookS2CPacket && rubberbandMode.get() != RubberbandMode.None) { + if (rubberbandInfo.get() && (messageCooldown.get() == 0 || messageTicks >= messageCooldown.get())) { + info("Rubberband detected! Disabling..."); + messageTicks = 0; + } + + if (rubberbandMode.get() == RubberbandMode.Disable) { + toggle(); + } else if (rubberbandMode.get() == RubberbandMode.Toggle) { + tick = 0; + startVec = null; + } + } + } + + // Render + + @EventHandler + private void onRender(Render3DEvent event) { + if (render.get()) { + if (startVec != null && !accurate.get()) { + event.renderer.box(new BlockPos(startVec.x, startVec.y, startVec.z), sideColor.get(), lineColor.get(), shapeMode.get(), 0); + event.renderer.line(RenderUtils.center.x, RenderUtils.center.y, RenderUtils.center.z, startVec.getX() + 0.5, startVec.getY() + 0.5, startVec.getZ() + 0.5, tracerColor.get()); + } else if (startVec != null && accurate.get()) { + event.renderer.box(startVec.x - 0.25, startVec.y, startVec.z - 0.25, startVec.x + 0.25, startVec.y + 1.5, startVec.z + 0.25, sideColor.get(), lineColor.get(), shapeMode.get(), 0); + event.renderer.line(RenderUtils.center.x, RenderUtils.center.y, RenderUtils.center.z, startVec.getX(), startVec.getY() + 0.75, startVec.getZ(), tracerColor.get()); + } + } + } + + // Utils + + private boolean isMoving() { + return mc.player.forwardSpeed != 0 || mc.player.sidewaysSpeed != 0; + } + + // Constants + + public enum ActiveWhen { + Always, + Sneaking, + NotSneaking + } + + public enum RubberbandMode { + None, + Disable, + Toggle + } +} diff --git a/src/main/java/cally72jhb/addon/system/modules/movement/Tower.java b/src/main/java/cally72jhb/addon/system/modules/movement/Tower.java index a18a0e55..12145fb0 100644 --- a/src/main/java/cally72jhb/addon/system/modules/movement/Tower.java +++ b/src/main/java/cally72jhb/addon/system/modules/movement/Tower.java @@ -32,7 +32,8 @@ public class Tower extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); - private final SettingGroup sgSafe = settings.createGroup("Extra Safe"); + private final SettingGroup sgJump = settings.createGroup("Packet Jump"); + private final SettingGroup sgCheck = settings.createGroup("Check"); private final Setting> blocks = sgGeneral.add(new BlockListSetting.Builder() .name("blocks") @@ -135,9 +136,9 @@ public class Tower extends Module { .build() ); - private final Setting onGround = sgGeneral.add(new BoolSetting.Builder() - .name("only-on-ground") - .description("Sends packets to the server as if you are on ground.") + private final Setting onGroundSpoof = sgGeneral.add(new BoolSetting.Builder() + .name("on-ground-spoof") + .description("Spoofs you on ground server-side.") .defaultValue(true) .build() ); @@ -150,23 +151,68 @@ public class Tower extends Module { .build() ); + // Packet Jump + + private final Setting jumpStart = sgJump.add(new IntSetting.Builder() + .name("jump-start") + .description("From what point on the start sending the jump packets.") + .defaultValue(0) + .sliderMin(0) + .sliderMax(12) + .min(0) + .max(12) + .noSlider() + .build() + ); + + private final Setting jumpEnd = sgJump.add(new IntSetting.Builder() + .name("jump-end") + .description("Till what point to send the jump packets.") + .defaultValue(12) + .sliderMin(1) + .sliderMax(12) + .min(1) + .max(12) + .noSlider() + .build() + ); + + private final Setting placePosition = sgJump.add(new IntSetting.Builder() + .name("place-position") + .description("When the block is placed.") + .defaultValue(6) + .sliderMin(0) + .sliderMax(12) + .min(0) + .max(12) + .noSlider() + .build() + ); + // Extra Safe - private final Setting safe = sgSafe.add(new BoolSetting.Builder() + private final Setting safe = sgCheck.add(new BoolSetting.Builder() .name("safe") .description("Doesn't tower if you are in a non full block.") .defaultValue(true) .build() ); - private final Setting antikick = sgSafe.add(new BoolSetting.Builder() + private final Setting onlyOnGround = sgGeneral.add(new BoolSetting.Builder() + .name("only-on-ground") + .description("Sends packets to the server as if you are on ground.") + .defaultValue(true) + .build() + ); + + private final Setting antikick = sgCheck.add(new BoolSetting.Builder() .name("anti-kick") .description("Stops you from getting kicked for fly while towering.") .defaultValue(true) .build() ); - private final Setting stopmove = sgSafe.add(new BoolSetting.Builder() + private final Setting stopmove = sgCheck.add(new BoolSetting.Builder() .name("stop-move") .description("Stops your movement.") .defaultValue(true) @@ -190,7 +236,7 @@ private void onPreTick(TickEvent.Pre event) { FindItemResult item = VectorUtils.findInHotbar(itemStack -> validItem(itemStack, mc.player.getBlockPos())); - if (!item.found()) return; + if (!item.found() || onlyOnGround.get() && !mc.player.isOnGround()) return; if (mode.get() == Mode.Bypass) { if (validBlock(mc.player.getBlockPos()) || validBlock(mc.player.getBlockPos().down())) return; @@ -208,13 +254,51 @@ private void onPreTick(TickEvent.Pre event) { timer++; } - } else if (!jump.get() || (mc.options.jumpKey.isPressed() && jump.get())) { + } else if (mode.get() == Mode.Normal && !jump.get() || (mc.options.jumpKey.isPressed() && jump.get())) { Vec3d velocity = mc.player.getVelocity(); if (mc.player.isOnGround()) mc.player.setVelocity(velocity.x * 0.3, up.get() / 100, mc.player.getVelocity().z * 0.3); if (VectorUtils.getCollision(mc.player.getBlockPos().down()) == null || VectorUtils.getCollision(mc.player.getBlockPos().down()).isEmpty()) { mc.player.setVelocity(velocity.x * 0.3, -(down.get() / 100), velocity.z * 0.3); } + } else if (mode.get() == Mode.PacketJump && !jump.get() || (mc.options.jumpKey.isPressed() && jump.get())) { + double x = mc.player.getX(); + double y = mc.player.getY(); + double z = mc.player.getZ(); + + BlockPos pos = mc.player.getBlockPos(); + + int start = jumpStart.get(); + int end = jumpEnd.get(); + int position = placePosition.get(); + + boolean onGround = onGroundSpoof.get(); + + if (position == 0) place(pos, item); + if (start >= 0 && end <= 0) mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y, z, onGround)); + if (position == 1) place(pos, item); + if (start >= 1 && end <= 1) mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 0.41999998688698, z, onGround)); + if (position == 2) place(pos, item); + if (start >= 2 && end <= 2) mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 0.75319998052120, z, onGround)); + if (position == 3) place(pos, item); + if (start >= 3 && end <= 3) mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 1.00133597911214, z, onGround)); + if (position == 4) place(pos, item); + if (start >= 4 && end <= 4) mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 1.16610926093821, z, onGround)); + if (position == 5) place(pos, item); + if (start >= 5 && end <= 5) mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 1.24918707874468, z, onGround)); + if (position == 6) place(pos, item); + if (start >= 6 && end <= 6) mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 1.17675927506424, z, onGround)); + if (position == 7) place(pos, item); + if (start >= 7 && end <= 7) mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 1.02442408821369, z, onGround)); + if (position == 8) place(pos, item); + if (start >= 8 && end <= 8) mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 0.79673560066871, z, onGround)); + if (position == 9) place(pos, item); + if (start >= 9 && end <= 9) mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 0.49520087700593, z, onGround)); + if (position == 10) place(pos, item); + if (start >= 10 && end <= 10) mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 0.12129684053920, z, onGround)); + if (position == 11) place(pos, item); + if (start >= 11 && end <= 11) mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y, z, onGround)); + if (position == 12) place(pos, item); } if (packet.get() && !jump.get() || (mc.options.jumpKey.isPressed() && jump.get())) { @@ -284,6 +368,8 @@ private void tower() { BlockPos pos = mc.player.getBlockPos(); FindItemResult block = VectorUtils.findInHotbar(itemStack -> validItem(itemStack, pos)); + boolean onGround = onGroundSpoof.get(); + if (!block.found() || !checkHead(pos)) return; if (mc.player.getY() != mc.player.getBlockPos().getY() && antikick.get()) { @@ -291,10 +377,10 @@ private void tower() { } if (instant.get()) { - mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + 0.4, mc.player.getZ(), onGround.get())); - mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + 0.75, mc.player.getZ(), onGround.get())); - mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + 1.01, mc.player.getZ(), onGround.get())); - mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + 1.15, mc.player.getZ(), onGround.get())); + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + 0.4, mc.player.getZ(), onGround)); + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + 0.75, mc.player.getZ(), onGround)); + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + 1.01, mc.player.getZ(), onGround)); + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + 1.15, mc.player.getZ(), onGround)); } InvUtils.swap(block.getSlot(), true); @@ -309,12 +395,23 @@ private void tower() { double height = bypass.get() ? -mc.player.getY() - 2.5 : speed.get(); if (instant.get()) { - mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), (int) (mc.player.getY() + height), mc.player.getZ(), onGround.get())); + mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), (int) (mc.player.getY() + height), mc.player.getZ(), onGround)); } else { mc.player.updatePosition(mc.player.getX(), (int) (mc.player.getY() + height), mc.player.getZ()); } } + private void place(BlockPos pos, FindItemResult item) { + InvUtils.swap(item.getSlot(), true); + + if (shouldSneak(pos)) mc.player.setSneaking(true); + + mc.interactionManager.interactBlock(mc.player, mc.world, Hand.MAIN_HAND, new BlockHitResult(Utils.vec3d(pos), Direction.UP, pos, false)); + mc.getNetworkHandler().sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND)); + + InvUtils.swapBack(); + } + private boolean shouldSneak(BlockPos pos) { return VectorUtils.getBlock(pos) == Blocks.ANVIL || VectorUtils.getBlock(pos) == Blocks.CRAFTING_TABLE || VectorUtils.getBlock(pos.down()) == Blocks.ANVIL || VectorUtils.getBlock(pos.down()) == Blocks.CRAFTING_TABLE; } @@ -342,6 +439,7 @@ public enum ListMode { } public enum Mode { + PacketJump, Normal, Bypass } diff --git a/src/main/java/cally72jhb/addon/system/modules/player/AutoEz.java b/src/main/java/cally72jhb/addon/system/modules/player/AutoEz.java index b2d7d5bb..a66ceefc 100644 --- a/src/main/java/cally72jhb/addon/system/modules/player/AutoEz.java +++ b/src/main/java/cally72jhb/addon/system/modules/player/AutoEz.java @@ -24,7 +24,6 @@ public class AutoEz extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); private final SettingGroup sgPops = settings.createGroup("Pops"); private final SettingGroup sgKills = settings.createGroup("Kills"); - private final SettingGroup sgLogs = settings.createGroup("Logs"); private final SettingGroup sgTargeting = settings.createGroup("Targeting"); @@ -139,59 +138,6 @@ public class AutoEz extends Module { ); - // Combat Log - - - private final Setting logMsg = sgLogs.add(new BoolSetting.Builder() - .name("combat-log") - .description("Sends a messages everytime you make a player combat log.") - .defaultValue(true) - .build() - ); - - private final Setting logString = sgLogs.add(new StringSetting.Builder() - .name("log-message") - .description("The message to send when you made someone log.") - .defaultValue("ez log {player}") - .visible(() -> logMsg.get() && !randomMsg.get()) - .build() - ); - - private final Setting> logMessages = sgLogs.add(new StringListSetting.Builder() - .name("log-messages") - .description("The random messages to send when you made someone log.") - .defaultValue(List.of("ez log {player}", "ez {player} just logged", "made {player} log with vector")) - .visible(() -> logMsg.get() && randomMsg.get()) - .build() - ); - - private final Setting logDelay = sgLogs.add(new IntSetting.Builder() - .name("log-delay") - .description("How long to wait in ticks before sending a log message.") - .defaultValue(5) - .min(0) - .visible(logMsg::get) - .build() - ); - - private final Setting logRange = sgLogs.add(new DoubleSetting.Builder() - .name("log-detection-range") - .description("How far players have to be away from you to send a log message.") - .defaultValue(15) - .min(0) - .visible(logMsg::get) - .build() - ); - - private final Setting checkTargetsOnLog = sgTargeting.add(new BoolSetting.Builder() - .name("check-targets-on-log") - .description("Checks the current target form each module when players log off.") - .defaultValue(false) - .visible(logMsg::get) - .build() - ); - - // Targeting @@ -285,18 +231,6 @@ private void onReceivePacket(PacketEvent.Receive event) { } } - // Combat Logging - - @EventHandler - private void onEntityRemoved(EntityRemovedEvent event) { - if (logMsg.get() && event.entity instanceof PlayerEntity player && !(player instanceof FakePlayerEntity) - && check(player, logRange.get(), checkTargetsOnLog.get()) && (logTimer >= logDelay.get() || logDelay.get() == 0)) { - - sendLogMsg(player); - logTimer = 0; - } - } - // Ticking Timers & updating Pops @EventHandler @@ -310,10 +244,6 @@ private void onPostTick(TickEvent.Post event) { // Messaging - private void sendLogMsg(PlayerEntity player) { - sendMsg(apply(player, randomMsg.get() && !logMessages.get().isEmpty() ? (logMessages.get().size() > 1 ? logMessages.get().get(random.nextInt(logMessages.get().size())) : logMessages.get().get(0)) : logString.get())); - } - private void sendPopMsg(PlayerEntity player) { sendMsg(apply(player, randomMsg.get() && !popMessages.get().isEmpty() ? (popMessages.get().size() > 1 ? popMessages.get().get(random.nextInt(popMessages.get().size())) : popMessages.get().get(0)) : popString.get())); } diff --git a/src/main/java/cally72jhb/addon/system/modules/player/ChorusPredict.java b/src/main/java/cally72jhb/addon/system/modules/player/ChorusPredict.java index dc75633b..57fe7e40 100644 --- a/src/main/java/cally72jhb/addon/system/modules/player/ChorusPredict.java +++ b/src/main/java/cally72jhb/addon/system/modules/player/ChorusPredict.java @@ -21,13 +21,6 @@ public class ChorusPredict extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); private final SettingGroup sgRender = settings.createGroup("Render"); - private final Setting accurate = sgGeneral.add(new BoolSetting.Builder() - .name("accurate") - .description("Whether or not to render the position accurate.") - .defaultValue(false) - .build() - ); - private final Setting onSneak = sgGeneral.add(new BoolSetting.Builder() .name("on-sneak") .description("Only predicts when you are sneaking.") @@ -42,6 +35,15 @@ public class ChorusPredict extends Module { .build() ); + // Render + + private final Setting accurate = sgRender.add(new BoolSetting.Builder() + .name("accurate") + .description("Whether or not to render the position accurate.") + .defaultValue(false) + .build() + ); + private final Setting shapeMode = sgRender.add(new EnumSetting.Builder() .name("shape-mode") .description("How the shapes are rendered.") diff --git a/src/main/java/cally72jhb/addon/system/modules/player/DeathAnimations.java b/src/main/java/cally72jhb/addon/system/modules/player/DeathAnimations.java index 4c210e42..7029c656 100644 --- a/src/main/java/cally72jhb/addon/system/modules/player/DeathAnimations.java +++ b/src/main/java/cally72jhb/addon/system/modules/player/DeathAnimations.java @@ -6,12 +6,12 @@ import meteordevelopment.meteorclient.systems.friends.Friends; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.orbit.EventHandler; - import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LightningEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.network.packet.s2c.play.EntityStatusS2CPacket; +import net.minecraft.util.math.Vec3d; public class DeathAnimations extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); @@ -35,37 +35,42 @@ public class DeathAnimations extends Module { .build() ); - - // Effect - - - private final Setting lightning = sgEffect.add(new BoolSetting.Builder() - .name("summon-lightning") - .description("Summons a lightning on a players death.") - .defaultValue(true) + private final Setting playEffectOnPop = sgGeneral.add(new BoolSetting.Builder() + .name("play-effect-on-pop") + .description("Plays a effect when a player pops a totem.") + .defaultValue(false) .build() ); - private final Setting silentLightning = sgEffect.add(new BoolSetting.Builder() - .name("silent-lightning") - .description("Makes the lightning bold silent.") - .defaultValue(false) - .visible(lightning::get) + private final Setting playEffectOnDeath = sgGeneral.add(new BoolSetting.Builder() + .name("play-effect-on-death") + .description("Plays a effect when a player dies.") + .defaultValue(true) .build() ); - private final Setting lightningAmount = sgEffect.add(new IntSetting.Builder() - .name("lightning-amount") + + // Effect + + + private final Setting effectAmount = sgEffect.add(new IntSetting.Builder() + .name("effect-amount") .description("How many lightning bolts to spawn.") .defaultValue(1) .sliderMin(1) .sliderMax(5) .min(1) - .visible(lightning::get) .noSlider() .build() ); + private final Setting silentLightning = sgEffect.add(new BoolSetting.Builder() + .name("silent-lightning") + .description("Makes the lightning bold silent.") + .defaultValue(false) + .build() + ); + public DeathAnimations() { super(Categories.Misc, "death-animations", "Creates an animation when a player dies."); } @@ -73,21 +78,22 @@ public DeathAnimations() { @EventHandler private void onReceivePacket(PacketEvent.Receive event) { if (event.packet instanceof EntityStatusS2CPacket packet) { - if (packet.getStatus() != 35 && packet.getStatus() != 3) return; + if (packet.getStatus() == 35 && playEffectOnPop.get() || packet.getStatus() == 3 && playEffectOnDeath.get()) { + Entity entity = packet.getEntity(mc.world); - Entity entity = packet.getEntity(mc.world); + if (entity instanceof PlayerEntity + && (!ignoreSelf.get() || ignoreSelf.get() && entity != mc.player) + && (!ignoreFriends.get() || ignoreFriends.get() && Friends.get() != null && !Friends.get().isFriend((PlayerEntity) entity))) { - if (entity instanceof PlayerEntity - && (!ignoreSelf.get() || ignoreSelf.get() && entity != mc.player) - && (!ignoreFriends.get() || ignoreFriends.get() && Friends.get() != null && !Friends.get().isFriend((PlayerEntity) entity))) { + Vec3d pos = entity.getPos(); - if (lightning.get()) { - for (int i = 0; i < lightningAmount.get(); i++) { + for (int i = 0; i < effectAmount.get(); i++) { LightningEntity lightning = new LightningEntity(EntityType.LIGHTNING_BOLT, mc.world); - lightning.setPos(entity.getX(), entity.getY(), entity.getZ()); + lightning.setPos(pos.x, pos.y, pos.z); lightning.setSilent(silentLightning.get()); + lightning.refreshPositionAfterTeleport(pos); - mc.world.spawnEntity(lightning); + mc.world.addEntity(lightning.getId(), lightning); } } } diff --git a/src/main/java/cally72jhb/addon/system/modules/player/MultiTask.java b/src/main/java/cally72jhb/addon/system/modules/player/MultiTask.java new file mode 100644 index 00000000..dbd82bcb --- /dev/null +++ b/src/main/java/cally72jhb/addon/system/modules/player/MultiTask.java @@ -0,0 +1,17 @@ +package cally72jhb.addon.system.modules.player; + +import cally72jhb.addon.system.categories.Categories; +import cally72jhb.addon.system.events.InteractEvent; +import meteordevelopment.meteorclient.systems.modules.Module; +import meteordevelopment.orbit.EventHandler; + +public class MultiTask extends Module { + public MultiTask() { + super(Categories.Misc, "multi-task", "Allows you to mine a block while consuming a item at the same time."); + } + + @EventHandler + private void onInteract(InteractEvent event) { + event.usingItem = false; + } +} diff --git a/src/main/java/cally72jhb/addon/utils/VectorUtils.java b/src/main/java/cally72jhb/addon/utils/VectorUtils.java index 11c22819..f273c42d 100644 --- a/src/main/java/cally72jhb/addon/utils/VectorUtils.java +++ b/src/main/java/cally72jhb/addon/utils/VectorUtils.java @@ -3,7 +3,6 @@ import cally72jhb.addon.VectorAddon; import cally72jhb.addon.utils.config.VectorConfig; import cally72jhb.addon.utils.misc.FindItemResult; -import cally72jhb.addon.utils.misc.Members; import cally72jhb.addon.utils.misc.Stats; import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.mixininterface.IClientPlayerInteractionManager; @@ -20,7 +19,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.network.packet.c2s.play.HandSwingC2SPacket; -import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; import net.minecraft.text.LiteralText; import net.minecraft.text.Style; import net.minecraft.text.Text; @@ -348,27 +346,6 @@ public static double[] directionSpeed(float speed) { return new double[] {posX, posZ}; } - // Movement - - private void packetJump(boolean onGround) { - double x = mc.player.getX(); - double y = mc.player.getY(); - double z = mc.player.getZ(); - - mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y, z, onGround)); - mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 0.41999998688698, z, onGround)); - mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 0.75319998052120, z, onGround)); - mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 1.00133597911214, z, onGround)); - mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 1.16610926093821, z, onGround)); - mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 1.24918707874468, z, onGround)); - mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 1.17675927506424, z, onGround)); - mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 1.02442408821369, z, onGround)); - mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 0.79673560066871, z, onGround)); - mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 0.49520087700593, z, onGround)); - mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y + 0.1212968405392, z, onGround)); - mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(x, y, z, onGround)); - } - // Finding Items public static FindItemResult findInHotbar(Predicate isGood) { @@ -442,18 +419,4 @@ public static void changeIcon() { } } } - - public static List members = new ArrayList<>(); - - public static void members() { - Thread thread = new Thread(() -> { - try { - members = Members.getUserNames(); - } catch (IOException | InterruptedException ex) { - ex.printStackTrace(); - } - }); - - thread.start(); - } } diff --git a/src/main/java/cally72jhb/addon/utils/config/VectorConfig.java b/src/main/java/cally72jhb/addon/utils/config/VectorConfig.java index d9d1256a..6bf5ce76 100644 --- a/src/main/java/cally72jhb/addon/utils/config/VectorConfig.java +++ b/src/main/java/cally72jhb/addon/utils/config/VectorConfig.java @@ -22,9 +22,6 @@ public class VectorConfig extends System { public SettingColor otherColor = VectorConfigTab.otherColor.get(); public boolean windowIcon = VectorConfigTab.windowIcon.get(); - public boolean highlightMembers = VectorConfigTab.highlightMembers.get(); - - public SettingColor memberColor = VectorConfigTab.memberColor.get(); public VectorConfig() { super("vector-config"); @@ -47,7 +44,6 @@ public static VectorConfig get() { @Override public void init() { RainbowColors.add(nameColor); - RainbowColors.add(memberColor); } @Override @@ -60,8 +56,6 @@ public NbtCompound toTag() { tag.put("name-color", nameColor.toTag()); tag.put("other-color", otherColor.toTag()); tag.putBoolean("icon", windowIcon); - tag.putBoolean("members", highlightMembers); - tag.put("member-color", memberColor.toTag()); return tag; } @@ -72,11 +66,9 @@ public VectorConfig fromTag(NbtCompound tag) { prefix = getString(tag, "prefix", VectorConfigTab.prefix); suffix = getString(tag, "suffix", VectorConfigTab.suffix); windowIcon = getBoolean(tag, "icon", VectorConfigTab.windowIcon); - highlightMembers = getBoolean(tag, "members", VectorConfigTab.highlightMembers); nameColor = getColor(tag, "name-color", VectorConfigTab.nameColor); otherColor = getColor(tag, "other-color", VectorConfigTab.otherColor); - memberColor = getColor(tag, "member-color", VectorConfigTab.memberColor); return this; } diff --git a/src/main/java/cally72jhb/addon/utils/encryption/EncryptUtils.java b/src/main/java/cally72jhb/addon/utils/encryption/EncryptUtils.java new file mode 100644 index 00000000..e79e9531 --- /dev/null +++ b/src/main/java/cally72jhb/addon/utils/encryption/EncryptUtils.java @@ -0,0 +1,30 @@ +package cally72jhb.addon.utils.encryption; + +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.util.Arrays; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.spec.SecretKeySpec; + +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.codec.digest.DigestUtils; + +public class EncryptUtils { + public static String encrypt(String text, String key) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException { + Cipher cipher = Cipher.getInstance("AES"); + cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(Arrays.copyOf(DigestUtils.sha1(key), 16), "AES")); + + return Base64.encodeBase64String(cipher.doFinal(text.getBytes())); + } + + public static String decrypt(String text, String key) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException { + Cipher cipher = Cipher.getInstance("AES"); + cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(Arrays.copyOf(DigestUtils.sha1(key), 16), "AES")); + + return new String(cipher.doFinal(Base64.decodeBase64(text))); + } +} diff --git a/src/main/resources/vector-addon-meteor.mixins.json b/src/main/resources/vector-addon-meteor.mixins.json index d406cbfa..e1710f52 100644 --- a/src/main/resources/vector-addon-meteor.mixins.json +++ b/src/main/resources/vector-addon-meteor.mixins.json @@ -4,8 +4,6 @@ "compatibilityLevel": "JAVA_16", "client": [ "FakePlayerCommandMixin", - "PlayerUtilsMixin", - "SettingCommandMixin", "TargetUtilsMixin" ] } diff --git a/src/main/resources/vector-addon.mixins.json b/src/main/resources/vector-addon.mixins.json index c9e0080d..43fe1af0 100644 --- a/src/main/resources/vector-addon.mixins.json +++ b/src/main/resources/vector-addon.mixins.json @@ -6,6 +6,7 @@ "ClientPlayerEntityMixin", "EmitterParticleMixin", "EntityMixin", + "MinecraftClientMixin", "NamespaceResourceManagerMixin", "ParticleMixin", "RecipeResultCollectionAccessor",