From d8f48db1698a72ddcdd73ca75628635dad1b10ce Mon Sep 17 00:00:00 2001 From: tyrannus <60930117+tyrannus00@users.noreply.github.com> Date: Fri, 16 Dec 2022 01:33:07 +0100 Subject: [PATCH 001/135] Surround and Crystal Aura fixes, and some other things (#3062) --- .../systems/modules/combat/CrystalAura.java | 44 ++++++++----------- .../systems/modules/misc/BetterChat.java | 5 ++- .../modules/player/MiddleClickExtra.java | 2 +- .../meteorclient/utils/player/InvUtils.java | 2 +- .../meteorclient/utils/world/BlockUtils.java | 2 +- 5 files changed, 25 insertions(+), 30 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/CrystalAura.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/CrystalAura.java index 79e81e1b26..3095613ec5 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/CrystalAura.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/CrystalAura.java @@ -24,7 +24,6 @@ import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.utils.entity.EntityUtils; import meteordevelopment.meteorclient.utils.entity.Target; -import meteordevelopment.meteorclient.utils.entity.fakeplayer.FakePlayerManager; import meteordevelopment.meteorclient.utils.misc.Keybind; import meteordevelopment.meteorclient.utils.player.*; import meteordevelopment.meteorclient.utils.render.NametagUtils; @@ -688,9 +687,10 @@ private double getBreakDamage(Entity entity, boolean checkCrystalAge) { // Check damage to targets and face place double damage = getDamageToTargets(entity.getPos(), blockPos, true, false); - boolean facePlaced = (facePlace.get() && shouldFacePlace(entity.getBlockPos()) || forceFacePlace.get().isPressed()); + boolean shouldFacePlace = shouldFacePlace(); + double minimumDamage = Math.min(minDamage.get(), shouldFacePlace ? 1.5 : minDamage.get()); - if (!facePlaced && damage < minDamage.get()) return 0; + if (damage < minimumDamage) return 0; return damage; } @@ -823,9 +823,10 @@ private void doPlace() { // Check damage to targets and face place double damage = getDamageToTargets(vec3d, bp, false, !hasBlock && support.get() == SupportMode.Fast); - boolean facePlaced = (facePlace.get() && shouldFacePlace(blockPos)) || (forceFacePlace.get().isPressed()); + boolean shouldFacePlace = shouldFacePlace(); + double minimumDamage = Math.min(minDamage.get(), shouldFacePlace ? 1.5 : minDamage.get()); - if (!facePlaced && damage < minDamage.get()) return; + if (damage < minimumDamage) return; // Check if it can be placed double x = bp.getX(); @@ -977,21 +978,21 @@ private static double distanceBetweenAngles(double alpha, double beta) { // Face place - private boolean shouldFacePlace(BlockPos crystal) { + private boolean shouldFacePlace() { + if (!facePlace.get()) return false; + + if (forceFacePlace.get().isPressed()) return true; + // Checks if the provided crystal position should face place to any target for (PlayerEntity target : targets) { - BlockPos pos = target.getBlockPos(); - - if (crystal.getY() == pos.getY() + 1 && Math.abs(pos.getX() - crystal.getX()) <= 1 && Math.abs(pos.getZ() - crystal.getZ()) <= 1) { - if (EntityUtils.getTotalHealth(target) <= facePlaceHealth.get()) return true; - - for (ItemStack itemStack : target.getArmorItems()) { - if (itemStack == null || itemStack.isEmpty()) { - if (facePlaceArmor.get()) return true; - } - else { - if ((double) (itemStack.getMaxDamage() - itemStack.getDamage()) / itemStack.getMaxDamage() * 100 <= facePlaceDurability.get()) return true; - } + if (EntityUtils.getTotalHealth(target) <= facePlaceHealth.get()) return true; + + for (ItemStack itemStack : target.getArmorItems()) { + if (itemStack == null || itemStack.isEmpty()) { + if (facePlaceArmor.get()) return true; + } + else { + if ((double) (itemStack.getMaxDamage() - itemStack.getDamage()) / itemStack.getMaxDamage() * 100 <= facePlaceDurability.get()) return true; } } } @@ -1070,13 +1071,6 @@ private void findTargets() { targets.add(player); } } - - // Fake players - FakePlayerManager.forEach(fp -> { - if (!fp.isDead() && fp.isAlive() && Friends.get().shouldAttack(fp) && PlayerUtils.isWithin(fp, targetRange.get())) { - targets.add(fp); - } - }); } private boolean intersectsWithEntities(Box box) { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterChat.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterChat.java index f59741bfda..16e4949838 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterChat.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterChat.java @@ -298,10 +298,11 @@ private Text appendAntiSpam(Text text) { ((ChatHudAccessor) mc.inGameHud.getChatHud()).getMessages().remove(messageIndex); List list = ChatMessages.breakRenderedChatMessageLines(originalMessage, MathHelper.floor((double)mc.inGameHud.getChatHud().getWidth() / mc.inGameHud.getChatHud().getChatScale()), mc.textRenderer); - int lines = list.size(); + List visibleMessages = ((ChatHudAccessor) mc.inGameHud.getChatHud()).getVisibleMessages(); + int lines = Math.min(list.size(), visibleMessages.size()); for (int i = 0; i < lines; i++) { - ((ChatHudAccessor) mc.inGameHud.getChatHud()).getVisibleMessages().remove(messageIndex); + visibleMessages.remove(messageIndex); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/MiddleClickExtra.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/MiddleClickExtra.java index 797b85542b..692073fbcf 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/MiddleClickExtra.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/MiddleClickExtra.java @@ -85,7 +85,7 @@ public void onDeactivate() { @EventHandler private void onMouseButton(MouseButtonEvent event) { - if (event.action != KeyAction.Press || event.button != GLFW_MOUSE_BUTTON_MIDDLE) return; + if (event.action != KeyAction.Press || event.button != GLFW_MOUSE_BUTTON_MIDDLE || mc.currentScreen != null) return; FindItemResult result = InvUtils.findInHotbar(mode.get().item); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/InvUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/player/InvUtils.java index 44976c083f..56fe9a20c7 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/InvUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/InvUtils.java @@ -122,7 +122,7 @@ public static FindItemResult find(Predicate isGood, int start, int en } public static FindItemResult findFastestTool(BlockState state) { - float bestScore = -1; + float bestScore = 1; int slot = -1; for (int i = 0; i < 9; i++) { diff --git a/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java index 10b9c0d812..9b00a1984e 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java @@ -135,7 +135,7 @@ public static boolean canPlace(BlockPos blockPos, boolean checkEntities) { if (!mc.world.getBlockState(blockPos).getMaterial().isReplaceable()) return false; // Check if intersects entities - return !checkEntities || mc.world.canPlace(mc.world.getBlockState(blockPos), blockPos, ShapeContext.absent()); + return !checkEntities || mc.world.canPlace(Blocks.OBSIDIAN.getDefaultState(), blockPos, ShapeContext.absent()); } public static boolean canPlace(BlockPos blockPos) { From 238401c7bba6968146dbbabec1225d48f165e2e5 Mon Sep 17 00:00:00 2001 From: Based Ricky <80427814+RickyTheRacc@users.noreply.github.com> Date: Thu, 15 Dec 2022 18:34:21 -0600 Subject: [PATCH 002/135] Improve Auto City (#3050) --- .../systems/modules/combat/AutoCity.java | 386 +++++++++++------- .../systems/modules/world/PacketMine.java | 47 +-- .../utils/entity/EntityUtils.java | 49 ++- .../meteorclient/utils/world/BlockUtils.java | 51 +++ .../resources/meteor-client.accesswidener | 1 + 5 files changed, 332 insertions(+), 202 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/AutoCity.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/AutoCity.java index 766bcc2d80..d8d61fe404 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/AutoCity.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/AutoCity.java @@ -1,146 +1,240 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.systems.modules.combat; - -import meteordevelopment.meteorclient.events.world.TickEvent; -import meteordevelopment.meteorclient.settings.BoolSetting; -import meteordevelopment.meteorclient.settings.DoubleSetting; -import meteordevelopment.meteorclient.settings.Setting; -import meteordevelopment.meteorclient.settings.SettingGroup; -import meteordevelopment.meteorclient.systems.modules.Categories; -import meteordevelopment.meteorclient.systems.modules.Module; -import meteordevelopment.meteorclient.utils.entity.EntityUtils; -import meteordevelopment.meteorclient.utils.entity.SortPriority; -import meteordevelopment.meteorclient.utils.entity.TargetUtils; -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.meteorclient.utils.world.BlockUtils; -import meteordevelopment.orbit.EventHandler; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Items; -import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; - -public class AutoCity extends Module { - private final SettingGroup sgGeneral = settings.getDefaultGroup(); - - private final Setting targetRange = sgGeneral.add(new DoubleSetting.Builder() - .name("target-range") - .description("The radius in which players get targeted.") - .defaultValue(4) - .min(0) - .sliderMax(5) - .build() - ); - - private final Setting autoSwitch = sgGeneral.add(new BoolSetting.Builder() - .name("auto-switch") - .description("Auto switches to a pickaxe when AutoCity is enabled.") - .defaultValue(true) - .build() - ); - - private final Setting support = sgGeneral.add(new BoolSetting.Builder() - .name("support") - .description("If there is no block below a city block it will place one before mining.") - .defaultValue(true) - .build() - ); - - private final Setting rotate = sgGeneral.add(new BoolSetting.Builder() - .name("rotate") - .description("Automatically rotates you towards the city block.") - .defaultValue(true) - .build() - ); - - private final Setting selfToggle = sgGeneral.add(new BoolSetting.Builder() - .name("self-toggle") - .description("Automatically toggles off after activation.") - .defaultValue(true) - .build() - ); - - private PlayerEntity target; - private BlockPos blockPosTarget; - private boolean sentMessage; - - public AutoCity() { - super(Categories.Combat, "auto-city", "Automatically cities a target by mining the nearest obsidian next to them."); - } - - @EventHandler - private void onTick(TickEvent.Pre event) { - if (TargetUtils.isBadTarget(target, targetRange.get())) { - PlayerEntity search = TargetUtils.getPlayerTarget(targetRange.get(), SortPriority.LowestDistance); - if (search != target) sentMessage = false; - target = search; - - if (TargetUtils.isBadTarget(target, targetRange.get())) { - target = null; - blockPosTarget = null; - if (selfToggle.get()) toggle(); - return; - } - } - - blockPosTarget = EntityUtils.getCityBlock(target); - - if (blockPosTarget == null) { - if (selfToggle.get()) { - error("No target block found... disabling."); - toggle(); - } - target = null; - return; - } - - if (!PlayerUtils.isWithinReach(blockPosTarget) && selfToggle.get()) { - error("Target block out of reach... disabling."); - toggle(); - return; - } - - if (!sentMessage) { - info("Attempting to city %s.", target.getEntityName()); - sentMessage = true; - } - - FindItemResult pickaxe = InvUtils.find(itemStack -> itemStack.getItem() == Items.DIAMOND_PICKAXE || itemStack.getItem() == Items.NETHERITE_PICKAXE); - - if (!pickaxe.isHotbar()) { - if (selfToggle.get()) { - error("No pickaxe found... disabling."); - toggle(); - } - return; - } - - if (support.get()) BlockUtils.place(blockPosTarget.down(1), InvUtils.findInHotbar(Items.OBSIDIAN), rotate.get(), 0, true); - - if (autoSwitch.get()) InvUtils.swap(pickaxe.slot(), false); - - if (rotate.get()) Rotations.rotate(Rotations.getYaw(blockPosTarget), Rotations.getPitch(blockPosTarget), () -> mine(blockPosTarget)); - else mine(blockPosTarget); - - if (selfToggle.get()) toggle(); - } - - private void mine(BlockPos blockPos) { - mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, blockPos, Direction.UP)); - mc.player.swingHand(Hand.MAIN_HAND); - mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, blockPos, Direction.UP)); - } - - @Override - public String getInfoString() { - return EntityUtils.getName(target); - } -} +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.systems.modules.combat; + +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.Categories; +import meteordevelopment.meteorclient.systems.modules.Module; +import meteordevelopment.meteorclient.systems.modules.world.PacketMine; +import meteordevelopment.meteorclient.utils.entity.EntityUtils; +import meteordevelopment.meteorclient.utils.entity.SortPriority; +import meteordevelopment.meteorclient.utils.entity.TargetUtils; +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.meteorclient.utils.render.color.SettingColor; +import meteordevelopment.meteorclient.utils.world.BlockUtils; +import meteordevelopment.orbit.EventHandler; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Items; +import net.minecraft.network.packet.c2s.play.HandSwingC2SPacket; +import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket; +import net.minecraft.util.Hand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; + +public class AutoCity extends Module { + private final SettingGroup sgGeneral = settings.getDefaultGroup(); + private final SettingGroup sgRender = settings.createGroup("Render"); + + + private final Setting targetRange = sgGeneral.add(new DoubleSetting.Builder() + .name("target-range") + .description("The radius in which players get targeted.") + .defaultValue(5.5) + .min(0) + .sliderMax(7) + .build() + ); + + private final Setting breakRange = sgGeneral.add(new DoubleSetting.Builder() + .name("break-range") + .description("How close a block must be to you to be considered.") + .defaultValue(4.5) + .min(0) + .sliderMax(6) + .build() + ); + + private final Setting switchMode = sgGeneral.add(new EnumSetting.Builder() + .name("switch-mode") + .description("How to switch to a pickaxe.") + .defaultValue(SwitchMode.Normal) + .build() + ); + + private final Setting support = sgGeneral.add(new BoolSetting.Builder() + .name("support") + .description("If there is no block below a city block it will place one before mining.") + .defaultValue(true) + .build() + ); + + private final Setting placeRange = sgGeneral.add(new DoubleSetting.Builder() + .name("place-range") + .description("How far away to try and place a block.") + .defaultValue(4.5) + .min(0) + .sliderMax(6) + .visible(support::get) + .build() + ); + + private final Setting rotate = sgGeneral.add(new BoolSetting.Builder() + .name("rotate") + .description("Automatically rotates you towards the city block.") + .defaultValue(true) + .build() + ); + + private final Setting chatInfo = sgGeneral.add(new BoolSetting.Builder() + .name("chat-info") + .description("Whether the module should send messages in chat.") + .defaultValue(true) + .build() + ); + + // Render + + private final Setting swingHand = sgRender.add(new BoolSetting.Builder() + .name("swing-hand") + .description("Whether to render your hand swinging.") + .defaultValue(false) + .build() + ); + + private final Setting renderBlock = sgRender.add(new BoolSetting.Builder() + .name("render-block") + .description("Whether to render the block being broken.") + .defaultValue(true) + .build() + ); + + private final Setting shapeMode = sgRender.add(new EnumSetting.Builder() + .name("shape-mode") + .description("How the shapes are rendered.") + .defaultValue(ShapeMode.Both) + .visible(renderBlock::get) + .build() + ); + + private final Setting sideColor = sgRender.add(new ColorSetting.Builder() + .name("side-color") + .description("The side color of the rendering.") + .defaultValue(new SettingColor(225, 0, 0, 75)) + .visible(() -> renderBlock.get() && shapeMode.get().sides()) + .build() + ); + + private final Setting lineColor = sgRender.add(new ColorSetting.Builder() + .name("line-color") + .description("The line color of the rendering.") + .defaultValue(new SettingColor(225, 0, 0, 255)) + .visible(() -> renderBlock.get() && shapeMode.get().lines()) + .build() + ); + + private PlayerEntity target; + private BlockPos targetPos; + private FindItemResult pick; + private float progress; + + public AutoCity() { + super(Categories.Combat, "auto-city", "Automatically mine blocks next to someone's feet."); + } + + @Override + public void onActivate() { + target = TargetUtils.getPlayerTarget(targetRange.get(), SortPriority.ClosestAngle); + if (TargetUtils.isBadTarget(target, targetRange.get())) { + if (chatInfo.get()) error("Couldn't find a target, disabling."); + toggle(); + return; + } + + targetPos = EntityUtils.getCityBlock(target); + if (targetPos == null || PlayerUtils.distanceTo(targetPos) > breakRange.get()) { + if (chatInfo.get()) error("Couldn't find a target, disabling."); + toggle(); + return; + } + + if (support.get()) { + BlockPos supportPos = targetPos.down(); + if (!(PlayerUtils.distanceTo(supportPos) > placeRange.get())) { + BlockUtils.place(supportPos, InvUtils.findInHotbar(Items.OBSIDIAN), rotate.get(), 0, true); + } + } + + pick = InvUtils.find(itemStack -> itemStack.getItem() == Items.DIAMOND_PICKAXE || itemStack.getItem() == Items.NETHERITE_PICKAXE); + if (!pick.isHotbar()) { + error("No pickaxe found... disabling."); + toggle(); + return; + } + + progress = 0.0f; + mine(false); + } + + @Override + public void onDeactivate() { + target = null; + targetPos = null; + } + + @EventHandler + private void onTick(TickEvent.Pre event) { + if (TargetUtils.isBadTarget(target, targetRange.get())) { + toggle(); + return; + } + + if (PlayerUtils.distanceTo(targetPos) > breakRange.get()) { + if (chatInfo.get()) error("Couldn't find a target, disabling."); + toggle(); + return; + } + + if (progress < 1.0f) { + pick = InvUtils.find(itemStack -> itemStack.getItem() == Items.DIAMOND_PICKAXE || itemStack.getItem() == Items.NETHERITE_PICKAXE); + if (!pick.isHotbar()) { + error("No pickaxe found... disabling."); + toggle(); + return; + } + progress += BlockUtils.getBreakDelta(pick.slot(), mc.world.getBlockState(targetPos)); + if (progress < 1.0f) return; + } + + mine(true); + toggle(); + } + + public void mine(boolean done) { + InvUtils.swap(pick.slot(), switchMode.get() == SwitchMode.Silent); + if (rotate.get()) Rotations.rotate(Rotations.getYaw(targetPos), Rotations.getPitch(targetPos)); + + Direction direction = (mc.player.getY() > targetPos.getY()) ? Direction.UP : Direction.DOWN; + if (!done) mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, targetPos, direction)); + mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, targetPos, direction)); + + if (swingHand.get()) mc.player.swingHand(Hand.MAIN_HAND); + else mc.getNetworkHandler().sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND)); + + if (switchMode.get() == SwitchMode.Silent) InvUtils.swapBack(); + } + + @EventHandler + private void onRender3D(Render3DEvent event) { + if (targetPos == null || !renderBlock.get()) return; + event.renderer.box(targetPos, sideColor.get(), lineColor.get(), shapeMode.get(), 0); + } + + @Override + public String getInfoString() { + return EntityUtils.getName(target); + } + + public enum SwitchMode { + Normal, + Silent + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/PacketMine.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/PacketMine.java index 9d9489dbe1..73f2f8d3f8 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/PacketMine.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/PacketMine.java @@ -202,51 +202,6 @@ private void onRender(Render3DEvent event) { } } - private double getBreakDelta(int slot, BlockState state) { - float hardness = state.getHardness(null, null); - if (hardness == -1) return 0; - else { - return getBlockBreakingSpeed(slot, state) / hardness / (!state.isToolRequired() || mc.player.getInventory().main.get(slot).isSuitableFor(state) ? 30 : 100); - } - } - - private double getBlockBreakingSpeed(int slot, BlockState block) { - double speed = mc.player.getInventory().main.get(slot).getMiningSpeedMultiplier(block); - - if (speed > 1) { - ItemStack tool = mc.player.getInventory().getStack(slot); - - int efficiency = EnchantmentHelper.getLevel(Enchantments.EFFICIENCY, tool); - - if (efficiency > 0 && !tool.isEmpty()) speed += efficiency * efficiency + 1; - } - - if (StatusEffectUtil.hasHaste(mc.player)) { - speed *= 1 + (StatusEffectUtil.getHasteAmplifier(mc.player) + 1) * 0.2F; - } - - if (mc.player.hasStatusEffect(StatusEffects.MINING_FATIGUE)) { - float k = switch (mc.player.getStatusEffect(StatusEffects.MINING_FATIGUE).getAmplifier()) { - case 0 -> 0.3F; - case 1 -> 0.09F; - case 2 -> 0.0027F; - default -> 8.1E-4F; - }; - - speed *= k; - } - - if (mc.player.isSubmergedIn(FluidTags.WATER) && !EnchantmentHelper.hasAquaAffinity(mc.player)) { - speed /= 5.0F; - } - - if (!mc.player.isOnGround()) { - speed /= 5.0F; - } - - return speed; - } - public class MyBlock { public BlockPos blockPos; public BlockState blockState; @@ -301,7 +256,7 @@ public void mine() { } } - progress += getBreakDelta(bestSlot != -1 ? bestSlot : mc.player.getInventory().selectedSlot, blockState); + progress += BlockUtils.getBreakDelta(bestSlot != -1 ? bestSlot : mc.player.getInventory().selectedSlot, blockState); } private void sendMinePackets() { diff --git a/src/main/java/meteordevelopment/meteorclient/utils/entity/EntityUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/entity/EntityUtils.java index de1f48ab54..7c309fd86e 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/entity/EntityUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/entity/EntityUtils.java @@ -14,6 +14,8 @@ import meteordevelopment.meteorclient.mixin.WorldAccessor; import meteordevelopment.meteorclient.utils.player.PlayerUtils; import meteordevelopment.meteorclient.utils.render.color.Color; +import net.minecraft.block.AirBlock; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.entity.BlockEntity; @@ -35,8 +37,8 @@ import net.minecraft.world.entity.SectionedEntityCache; import net.minecraft.world.entity.SimpleEntityLookup; +import javax.annotation.Nullable; import java.util.ArrayList; -import java.util.Comparator; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Predicate; @@ -111,26 +113,53 @@ public static boolean isInRenderDistance(double posX, double posZ) { public static List getSurroundBlocks(PlayerEntity player) { if (player == null) return null; + BlockPos.Mutable testPos = new BlockPos.Mutable(); List positions = new ArrayList<>(); - for (Direction direction : Direction.values()) { - if (direction == Direction.UP || direction == Direction.DOWN) continue; + for (Direction direction : Direction.HORIZONTAL) { + testPos.set(player.getBlockPos()).offset(direction); - BlockPos pos = player.getBlockPos().offset(direction); - - if (mc.world.getBlockState(pos).getBlock() == Blocks.OBSIDIAN) { - positions.add(pos); + if (mc.world.getBlockState(testPos).getBlock() == Blocks.OBSIDIAN) { + positions.add(testPos); } } return positions; } + @Nullable public static BlockPos getCityBlock(PlayerEntity player) { - List posList = getSurroundBlocks(player); - posList.sort(Comparator.comparingDouble(PlayerUtils::squaredDistanceTo)); - return posList.isEmpty() ? null : posList.get(0); + BlockPos bestPos = null; + int bestScore = 0; + BlockPos.Mutable testPos = new BlockPos.Mutable(); + + for (BlockPos pos : getSurroundBlocks(player)) { + int score = 1; + + for (Direction direction : Direction.values()) { + testPos.set(pos).offset(direction); + Block block = mc.world.getBlockState(testPos).getBlock(); + + if (direction == Direction.DOWN && block == Blocks.OBSIDIAN || block == Blocks.BEDROCK) { + score+= 2; + continue; + } + + if (direction != Direction.DOWN && block instanceof AirBlock) { + score++; + } + } + + score -= PlayerUtils.distanceTo(pos); + + if (score >= bestScore) { + bestPos = pos; + bestScore = score; + } + } + + return bestPos; } public static String getName(Entity entity) { diff --git a/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java index 9b00a1984e..3d6b5c79c6 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java @@ -17,7 +17,13 @@ import net.minecraft.block.*; import net.minecraft.block.enums.BlockHalf; import net.minecraft.block.enums.SlabType; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.enchantment.Enchantments; +import net.minecraft.entity.effect.StatusEffectUtil; +import net.minecraft.entity.effect.StatusEffects; +import net.minecraft.item.ItemStack; import net.minecraft.network.packet.c2s.play.HandSwingC2SPacket; +import net.minecraft.registry.tag.FluidTags; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; @@ -261,4 +267,49 @@ public static boolean isExposed(BlockPos blockPos) { return false; } + + public static double getBreakDelta(int slot, BlockState state) { + float hardness = state.getHardness(null, null); + if (hardness == -1) return 0; + else { + return getBlockBreakingSpeed(slot, state) / hardness / (!state.isToolRequired() || mc.player.getInventory().main.get(slot).isSuitableFor(state) ? 30 : 100); + } + } + + private static double getBlockBreakingSpeed(int slot, BlockState block) { + double speed = mc.player.getInventory().main.get(slot).getMiningSpeedMultiplier(block); + + if (speed > 1) { + ItemStack tool = mc.player.getInventory().getStack(slot); + + int efficiency = EnchantmentHelper.getLevel(Enchantments.EFFICIENCY, tool); + + if (efficiency > 0 && !tool.isEmpty()) speed += efficiency * efficiency + 1; + } + + if (StatusEffectUtil.hasHaste(mc.player)) { + speed *= 1 + (StatusEffectUtil.getHasteAmplifier(mc.player) + 1) * 0.2F; + } + + if (mc.player.hasStatusEffect(StatusEffects.MINING_FATIGUE)) { + float k = switch (mc.player.getStatusEffect(StatusEffects.MINING_FATIGUE).getAmplifier()) { + case 0 -> 0.3F; + case 1 -> 0.09F; + case 2 -> 0.0027F; + default -> 8.1E-4F; + }; + + speed *= k; + } + + if (mc.player.isSubmergedIn(FluidTags.WATER) && !EnchantmentHelper.hasAquaAffinity(mc.player)) { + speed /= 5.0F; + } + + if (!mc.player.isOnGround()) { + speed /= 5.0F; + } + + return speed; + } } diff --git a/src/main/resources/meteor-client.accesswidener b/src/main/resources/meteor-client.accesswidener index 8e2bb3ad5f..7c3d0c7ea1 100644 --- a/src/main/resources/meteor-client.accesswidener +++ b/src/main/resources/meteor-client.accesswidener @@ -70,5 +70,6 @@ accessible class net/minecraft/client/gui/screen/ingame/BeaconScreen$EffectB accessible class net/minecraft/client/resource/ResourceReloadLogger$ReloadState accessible field net/minecraft/block/AbstractBlock collidable Z +accessible field net/minecraft/util/math/Direction HORIZONTAL [Lnet/minecraft/util/math/Direction; accessible field net/minecraft/item/ItemGroups INVENTORY Lnet/minecraft/item/ItemGroup; From 8011a2b2b86f3ccc6b45aaa494ed8eb784211c32 Mon Sep 17 00:00:00 2001 From: Based Ricky <80427814+RickyTheRacc@users.noreply.github.com> Date: Thu, 15 Dec 2022 18:36:10 -0600 Subject: [PATCH 003/135] Improve Quiver (#3060) --- .../systems/modules/combat/Quiver.java | 183 +++++++++++++++--- 1 file changed, 157 insertions(+), 26 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Quiver.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Quiver.java index babab71dfe..c0efef35bd 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Quiver.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Quiver.java @@ -6,29 +6,36 @@ package meteordevelopment.meteorclient.systems.modules.combat; import meteordevelopment.meteorclient.events.world.TickEvent; -import meteordevelopment.meteorclient.settings.BoolSetting; -import meteordevelopment.meteorclient.settings.Setting; -import meteordevelopment.meteorclient.settings.SettingGroup; -import meteordevelopment.meteorclient.settings.StatusEffectListSetting; +import meteordevelopment.meteorclient.mixin.AbstractBlockAccessor; +import meteordevelopment.meteorclient.settings.*; import meteordevelopment.meteorclient.systems.modules.Categories; import meteordevelopment.meteorclient.systems.modules.Module; +import meteordevelopment.meteorclient.utils.entity.EntityUtils; import meteordevelopment.meteorclient.utils.player.FindItemResult; import meteordevelopment.meteorclient.utils.player.InvUtils; import meteordevelopment.orbit.EventHandler; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.BowItem; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; import net.minecraft.potion.PotionUtil; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; import java.util.ArrayList; import java.util.List; public class Quiver extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); + private final SettingGroup sgSafety = settings.createGroup("Safety"); + private final Setting> effects = sgGeneral.add(new StatusEffectListSetting.Builder() .name("effects") @@ -37,14 +44,66 @@ public class Quiver extends Module { .build() ); + private final Setting cooldown = sgGeneral.add(new IntSetting.Builder() + .name("cooldown") + .description("How many ticks between shooting effects (19 minimum for NCP).") + .defaultValue(10) + .range(0,40) + .sliderRange(0,40) + .build() + ); + private final Setting checkEffects = sgGeneral.add(new BoolSetting.Builder() - .name("check-existing-effects") + .name("check-effects") .description("Won't shoot you with effects you already have.") .defaultValue(true) .build() ); + private final Setting silentBow = sgGeneral.add(new BoolSetting.Builder() + .name("silent-bow") + .description("Takes a bow from your inventory to quiver.") + .defaultValue(true) + .build() + ); + + private final Setting chatInfo = sgGeneral.add(new BoolSetting.Builder() + .name("chat-info") + .description("Sends info about quiver checks in chat.") + .defaultValue(false) + .build() + ); + + // Safety + + private final Setting onlyInHoles = sgSafety.add(new BoolSetting.Builder() + .name("only-in-holes") + .description("Only quiver when you're in a hole.") + .defaultValue(true) + .build() + ); + + private final Setting onlyOnGround = sgSafety.add(new BoolSetting.Builder() + .name("only-on-ground") + .description("Only quiver when you're on the ground.") + .defaultValue(true) + .build() + ); + + private final Setting minHealth = sgSafety.add(new DoubleSetting.Builder() + .name("min-health") + .description("How much health you must have to quiver.") + .defaultValue(10) + .range(0,36) + .sliderRange(0,36) + .build() + ); + private final List arrowSlots = new ArrayList<>(); + private FindItemResult bow; + private boolean wasMainhand, wasHotbar; + private int timer, prevSlot; + private final BlockPos.Mutable testPos = new BlockPos.Mutable(); public Quiver() { super(Categories.Combat, "quiver", "Shoots arrows at yourself."); @@ -52,21 +111,22 @@ public Quiver() { @Override public void onActivate() { - - FindItemResult bow = InvUtils.findInHotbar(Items.BOW); - - if (!bow.isHotbar()) { - error("No bow found... disabling."); - toggle(); - } + bow = InvUtils.find(Items.BOW); + if (!shouldQuiver()) return; mc.options.useKey.setPressed(false); mc.interactionManager.stopUsingItem(mc.player); - InvUtils.swap(bow.slot(), true); + prevSlot = bow.slot(); + wasHotbar = bow.isHotbar(); + timer = 0; - arrowSlots.clear(); + if (!bow.isMainHand()) { + if (wasHotbar) InvUtils.swap(bow.slot(), true); + else InvUtils.move().from(mc.player.getInventory().selectedSlot).to(prevSlot); + } else wasMainhand = true; + arrowSlots.clear(); List usedEffects = new ArrayList<>(); for (int i = mc.player.getInventory().size(); i > 0; i--) { @@ -91,33 +151,34 @@ public void onActivate() { } } - private boolean hasEffect(StatusEffect effect) { - for (StatusEffectInstance statusEffect : mc.player.getStatusEffects()) { - if (statusEffect.getEffectType() == effect) return true; - } - - return false; - } - @Override public void onDeactivate() { - InvUtils.swapBack(); + if (!wasMainhand) { + if (wasHotbar) InvUtils.swapBack(); + else InvUtils.move().from(mc.player.getInventory().selectedSlot).to(prevSlot); + } } @EventHandler private void onTick(TickEvent.Pre event) { - if (arrowSlots.isEmpty() || !InvUtils.testInMainHand(Items.BOW)) { + bow = InvUtils.find(Items.BOW); + if (!shouldQuiver()) return; + if (arrowSlots.isEmpty()) { toggle(); return; } + if (timer > 0) { + timer--; + return; + } + boolean charging = mc.options.useKey.isPressed(); if (!charging) { InvUtils.move().from(arrowSlots.get(0)).to(9); mc.options.useKey.setPressed(true); - } - else { + } else { if (BowItem.getPullProgress(mc.player.getItemUseTime()) >= 0.12) { int targetSlot = arrowSlots.get(0); arrowSlots.remove(0); @@ -126,7 +187,77 @@ private void onTick(TickEvent.Pre event) { mc.options.useKey.setPressed(false); mc.interactionManager.stopUsingItem(mc.player); if (targetSlot != 9) InvUtils.move().from(9).to(targetSlot); + + timer = cooldown.get(); } } } + + private boolean shouldQuiver() { + if (!bow.found() || !bow.isHotbar() && !silentBow.get()) { + if (chatInfo.get()) error("Couldn't find a usable bow, disabling."); + toggle(); + return false; + } + + if (!headIsOpen()) { + if (chatInfo.get()) error("Not enough space to quiver, disabling."); + toggle(); + return false; + } + + if (EntityUtils.getTotalHealth(mc.player) < minHealth.get()) { + if (chatInfo.get()) error("Not enough health to quiver, disabling."); + toggle(); + return false; + } + + if (onlyOnGround.get() && !mc.player.isOnGround()) { + if (chatInfo.get()) error("You are not on the ground, disabling."); + toggle(); + return false; + } + + if (onlyInHoles.get() && !isSurrounded(mc.player)) { + if (chatInfo.get()) error("You are not in a hole, disabling."); + toggle(); + return false; + } + + return true; + } + + private boolean headIsOpen() { + testPos.set(mc.player.getBlockPos().add(0, 1, 0)); + BlockState pos1 = mc.world.getBlockState(testPos); + if (((AbstractBlockAccessor) pos1.getBlock()).isCollidable()) return false; + + testPos.add(0, 1, 0); + BlockState pos2 = mc.world.getBlockState(testPos); + return !((AbstractBlockAccessor) pos2.getBlock()).isCollidable(); + } + + private boolean hasEffect(StatusEffect effect) { + for (StatusEffectInstance statusEffect : mc.player.getStatusEffects()) { + if (statusEffect.getEffectType() == effect) return true; + } + + return false; + } + + private boolean isSurrounded(PlayerEntity target) { + for (Direction dir : Direction.values()) { + if (dir == Direction.UP || dir == Direction.DOWN) continue; + + testPos.set(target.getBlockPos()).offset(dir); + Block block = mc.world.getBlockState(testPos).getBlock(); + + if (block != Blocks.OBSIDIAN && block != Blocks.BEDROCK && block != Blocks.RESPAWN_ANCHOR + && block != Blocks.CRYING_OBSIDIAN && block != Blocks.NETHERITE_BLOCK) { + return false; + } + } + + return true; + } } From f1ca61b01dc283eda0cc1fd9d2094635d609512b Mon Sep 17 00:00:00 2001 From: RacoonDog <32882447+RacoonDog@users.noreply.github.com> Date: Wed, 16 Nov 2022 22:04:42 -0500 Subject: [PATCH 004/135] Rename Search to Block ESP --- .../meteorclient/systems/modules/Modules.java | 4 +- .../Search.java => blockesp/BlockESP.java} | 54 ++++++++-------- .../SBlock.java => blockesp/ESPBlock.java} | 32 +++++----- .../ESPBlockData.java} | 20 +++--- .../ESPBlockDataScreen.java} | 12 ++-- .../SChunk.java => blockesp/ESPChunk.java} | 28 ++++---- .../SGroup.java => blockesp/ESPGroup.java} | 64 +++++++++---------- 7 files changed, 107 insertions(+), 107 deletions(-) rename src/main/java/meteordevelopment/meteorclient/systems/modules/render/{search/Search.java => blockesp/BlockESP.java} (80%) rename src/main/java/meteordevelopment/meteorclient/systems/modules/render/{search/SBlock.java => blockesp/ESPBlock.java} (92%) rename src/main/java/meteordevelopment/meteorclient/systems/modules/render/{search/SBlockData.java => blockesp/ESPBlockData.java} (77%) rename src/main/java/meteordevelopment/meteorclient/systems/modules/render/{search/SBlockDataScreen.java => blockesp/ESPBlockDataScreen.java} (88%) rename src/main/java/meteordevelopment/meteorclient/systems/modules/render/{search/SChunk.java => blockesp/ESPChunk.java} (76%) rename src/main/java/meteordevelopment/meteorclient/systems/modules/render/{search/SGroup.java => blockesp/ESPGroup.java} (61%) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java index 8c1bf622d2..e05e1b9551 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java @@ -29,7 +29,7 @@ import meteordevelopment.meteorclient.systems.modules.player.*; import meteordevelopment.meteorclient.systems.modules.render.*; import meteordevelopment.meteorclient.systems.modules.render.marker.Marker; -import meteordevelopment.meteorclient.systems.modules.render.search.Search; +import meteordevelopment.meteorclient.systems.modules.render.blockesp.BlockESP; import meteordevelopment.meteorclient.systems.modules.world.Timer; import meteordevelopment.meteorclient.systems.modules.world.*; import meteordevelopment.meteorclient.utils.Utils; @@ -501,7 +501,7 @@ private void initRender() { add(new Marker()); add(new Nametags()); add(new NoRender()); - add(new Search()); + add(new BlockESP()); add(new StorageESP()); add(new TimeChanger()); add(new Tracers()); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/search/Search.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/blockesp/BlockESP.java similarity index 80% rename from src/main/java/meteordevelopment/meteorclient/systems/modules/render/search/Search.java rename to src/main/java/meteordevelopment/meteorclient/systems/modules/render/blockesp/BlockESP.java index b33230381d..2f9a9063bc 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/search/Search.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/blockesp/BlockESP.java @@ -3,7 +3,7 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.modules.render.search; +package meteordevelopment.meteorclient.systems.modules.render.blockesp; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; @@ -32,7 +32,7 @@ import java.util.List; import java.util.Map; -public class Search extends Module { +public class BlockESP extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); // General @@ -46,11 +46,11 @@ public class Search extends Module { .build() ); - private final Setting defaultBlockConfig = sgGeneral.add(new GenericSetting.Builder() + private final Setting defaultBlockConfig = sgGeneral.add(new GenericSetting.Builder() .name("default-block-config") .description("Default block config.") .defaultValue( - new SBlockData( + new ESPBlockData( ShapeMode.Lines, new SettingColor(0, 255, 200), new SettingColor(0, 255, 200, 25), @@ -61,7 +61,7 @@ public class Search extends Module { .build() ); - private final Setting> blockConfigs = sgGeneral.add(new BlockDataSetting.Builder() + private final Setting> blockConfigs = sgGeneral.add(new BlockDataSetting.Builder() .name("block-configs") .description("Config for each block.") .defaultData(defaultBlockConfig) @@ -77,13 +77,13 @@ public class Search extends Module { private final BlockPos.Mutable blockPos = new BlockPos.Mutable(); - private final Long2ObjectMap chunks = new Long2ObjectOpenHashMap<>(); - private final List groups = new UnorderedArrayList<>(); + private final Long2ObjectMap chunks = new Long2ObjectOpenHashMap<>(); + private final List groups = new UnorderedArrayList<>(); private Dimension lastDimension; - public Search() { - super(Categories.Render, "search", "Searches for specified blocks."); + public BlockESP() { + super(Categories.Render, "block-esp", "Renders specified blocks through walls."); RainbowColors.register(this::onTickRainbow); } @@ -114,38 +114,38 @@ private void onTickRainbow() { if (!isActive()) return; defaultBlockConfig.get().tickRainbow(); - for (SBlockData blockData : blockConfigs.get().values()) blockData.tickRainbow(); + for (ESPBlockData blockData : blockConfigs.get().values()) blockData.tickRainbow(); } - SBlockData getBlockData(Block block) { - SBlockData blockData = blockConfigs.get().get(block); + ESPBlockData getBlockData(Block block) { + ESPBlockData blockData = blockConfigs.get().get(block); return blockData == null ? defaultBlockConfig.get() : blockData; } private void updateChunk(int x, int z) { - SChunk chunk = chunks.get(ChunkPos.toLong(x, z)); + ESPChunk chunk = chunks.get(ChunkPos.toLong(x, z)); if (chunk != null) chunk.update(); } private void updateBlock(int x, int y, int z) { - SChunk chunk = chunks.get(ChunkPos.toLong(x >> 4, z >> 4)); + ESPChunk chunk = chunks.get(ChunkPos.toLong(x >> 4, z >> 4)); if (chunk != null) chunk.update(x, y, z); } - public SBlock getBlock(int x, int y, int z) { - SChunk chunk = chunks.get(ChunkPos.toLong(x >> 4, z >> 4)); + public ESPBlock getBlock(int x, int y, int z) { + ESPChunk chunk = chunks.get(ChunkPos.toLong(x >> 4, z >> 4)); return chunk == null ? null : chunk.get(x, y, z); } - public SGroup newGroup(Block block) { + public ESPGroup newGroup(Block block) { synchronized (chunks) { - SGroup group = new SGroup(block); + ESPGroup group = new ESPGroup(block); groups.add(group); return group; } } - public void removeGroup(SGroup group) { + public void removeGroup(ESPGroup group) { synchronized (chunks) { groups.remove(group); } @@ -159,7 +159,7 @@ private void onChunkData(ChunkDataEvent event) { private void searchChunk(Chunk chunk, ChunkDataEvent event) { MeteorExecutor.execute(() -> { if (!isActive()) return; - SChunk schunk = SChunk.searchChunk(chunk, blocks.get()); + ESPChunk schunk = ESPChunk.searchChunk(chunk, blocks.get()); if (schunk.size() > 0) { synchronized (chunks) { @@ -195,10 +195,10 @@ private void onBlockUpdate(BlockUpdateEvent event) { if (added || removed) { MeteorExecutor.execute(() -> { synchronized (chunks) { - SChunk chunk = chunks.get(key); + ESPChunk chunk = chunks.get(key); if (chunk == null) { - chunk = new SChunk(chunkX, chunkZ); + chunk = new ESPChunk(chunkX, chunkZ); if (chunk.shouldBeDeleted()) return; chunks.put(key, chunk); @@ -236,12 +236,12 @@ private void onPostTick(TickEvent.Post event) { @EventHandler private void onRender(Render3DEvent event) { synchronized (chunks) { - for (Iterator it = chunks.values().iterator(); it.hasNext();) { - SChunk chunk = it.next(); + for (Iterator it = chunks.values().iterator(); it.hasNext();) { + ESPChunk chunk = it.next(); if (chunk.shouldBeDeleted()) { MeteorExecutor.execute(() -> { - for (SBlock block : chunk.blocks.values()) { + for (ESPBlock block : chunk.blocks.values()) { block.group.remove(block, false); block.loaded = false; } @@ -253,8 +253,8 @@ private void onRender(Render3DEvent event) { } if (tracers.get()) { - for (Iterator it = groups.iterator(); it.hasNext();) { - SGroup group = it.next(); + for (Iterator it = groups.iterator(); it.hasNext();) { + ESPGroup group = it.next(); if (group.blocks.isEmpty()) it.remove(); else group.render(event); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/search/SBlock.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/blockesp/ESPBlock.java similarity index 92% rename from src/main/java/meteordevelopment/meteorclient/systems/modules/render/search/SBlock.java rename to src/main/java/meteordevelopment/meteorclient/systems/modules/render/blockesp/ESPBlock.java index e0725d8235..47e4f160a9 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/search/SBlock.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/blockesp/ESPBlock.java @@ -3,7 +3,7 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.modules.render.search; +package meteordevelopment.meteorclient.systems.modules.render.blockesp; import meteordevelopment.meteorclient.events.render.Render3DEvent; import meteordevelopment.meteorclient.renderer.ShapeMode; @@ -17,10 +17,10 @@ import static meteordevelopment.meteorclient.MeteorClient.mc; -public class SBlock { +public class ESPBlock { private static final BlockPos.Mutable blockPos = new BlockPos.Mutable(); - private static final Search search = Modules.get().get(Search.class); + private static final BlockESP blockEsp = Modules.get().get(BlockESP.class); public static final int FO = 1 << 1; public static final int FO_RI = 1 << 2; @@ -48,36 +48,36 @@ public class SBlock { private BlockState state; public int neighbours; - public SGroup group; + public ESPGroup group; public boolean loaded = true; - public SBlock(int x, int y, int z) { + public ESPBlock(int x, int y, int z) { this.x = x; this.y = y; this.z = z; } - public SBlock getSideBlock(int side) { + public ESPBlock getSideBlock(int side) { switch (side) { - case FO: return search.getBlock(x, y, z + 1); - case BA: return search.getBlock(x, y, z - 1); - case LE: return search.getBlock(x - 1, y, z); - case RI: return search.getBlock(x + 1, y, z); - case TO: return search.getBlock(x, y + 1, z); - case BO: return search.getBlock(x, y - 1, z); + case FO: return blockEsp.getBlock(x, y, z + 1); + case BA: return blockEsp.getBlock(x, y, z - 1); + case LE: return blockEsp.getBlock(x - 1, y, z); + case RI: return blockEsp.getBlock(x + 1, y, z); + case TO: return blockEsp.getBlock(x, y + 1, z); + case BO: return blockEsp.getBlock(x, y - 1, z); } return null; } private void assignGroup() { - SGroup firstGroup = null; + ESPGroup firstGroup = null; for (int side : SIDES) { if ((neighbours & side) != side) continue; - SBlock neighbour = getSideBlock(side); + ESPBlock neighbour = getSideBlock(side); if (neighbour == null || neighbour.group == null) continue; if (firstGroup == null) { @@ -89,7 +89,7 @@ private void assignGroup() { } if (firstGroup == null) { - firstGroup = search.newGroup(state.getBlock()); + firstGroup = blockEsp.newGroup(state.getBlock()); } firstGroup.add(this); @@ -188,7 +188,7 @@ public void render(Render3DEvent event) { z2 = z + shape.getMax(Direction.Axis.Z); } - SBlockData blockData = search.getBlockData(state.getBlock()); + ESPBlockData blockData = blockEsp.getBlockData(state.getBlock()); ShapeMode shapeMode = blockData.shapeMode; Color lineColor = blockData.lineColor; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/search/SBlockData.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/blockesp/ESPBlockData.java similarity index 77% rename from src/main/java/meteordevelopment/meteorclient/systems/modules/render/search/SBlockData.java rename to src/main/java/meteordevelopment/meteorclient/systems/modules/render/blockesp/ESPBlockData.java index fcc1817685..3905455cf0 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/search/SBlockData.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/blockesp/ESPBlockData.java @@ -3,7 +3,7 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.modules.render.search; +package meteordevelopment.meteorclient.systems.modules.render.blockesp; import meteordevelopment.meteorclient.gui.GuiTheme; import meteordevelopment.meteorclient.gui.WidgetScreen; @@ -18,7 +18,7 @@ import net.minecraft.block.Block; import net.minecraft.nbt.NbtCompound; -public class SBlockData implements ICopyable, ISerializable, IChangeable, IBlockData, IScreenFactory { +public class ESPBlockData implements ICopyable, ISerializable, IChangeable, IBlockData, IScreenFactory { public ShapeMode shapeMode; public SettingColor lineColor; public SettingColor sideColor; @@ -28,7 +28,7 @@ public class SBlockData implements ICopyable, ISerializable setting) { - return new SBlockDataScreen(theme, this, block, setting); + public WidgetScreen createScreen(GuiTheme theme, Block block, BlockDataSetting setting) { + return new ESPBlockDataScreen(theme, this, block, setting); } @Override public WidgetScreen createScreen(GuiTheme theme) { - return new SBlockDataScreen(theme, this, null, null); + return new ESPBlockDataScreen(theme, this, null, null); } @Override @@ -63,7 +63,7 @@ public void tickRainbow() { } @Override - public SBlockData set(SBlockData value) { + public ESPBlockData set(ESPBlockData value) { shapeMode = value.shapeMode; lineColor.set(value.lineColor); sideColor.set(value.sideColor); @@ -77,8 +77,8 @@ public SBlockData set(SBlockData value) { } @Override - public SBlockData copy() { - return new SBlockData(shapeMode, new SettingColor(lineColor), new SettingColor(sideColor), tracer, new SettingColor(tracerColor)); + public ESPBlockData copy() { + return new ESPBlockData(shapeMode, new SettingColor(lineColor), new SettingColor(sideColor), tracer, new SettingColor(tracerColor)); } @Override @@ -98,7 +98,7 @@ public NbtCompound toTag() { } @Override - public SBlockData fromTag(NbtCompound tag) { + public ESPBlockData fromTag(NbtCompound tag) { shapeMode = ShapeMode.valueOf(tag.getString("shapeMode")); lineColor.fromTag(tag.getCompound("lineColor")); sideColor.fromTag(tag.getCompound("sideColor")); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/search/SBlockDataScreen.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/blockesp/ESPBlockDataScreen.java similarity index 88% rename from src/main/java/meteordevelopment/meteorclient/systems/modules/render/search/SBlockDataScreen.java rename to src/main/java/meteordevelopment/meteorclient/systems/modules/render/blockesp/ESPBlockDataScreen.java index dd4a9e85c3..2686b88b6d 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/search/SBlockDataScreen.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/blockesp/ESPBlockDataScreen.java @@ -3,7 +3,7 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.modules.render.search; +package meteordevelopment.meteorclient.systems.modules.render.blockesp; import meteordevelopment.meteorclient.gui.GuiTheme; import meteordevelopment.meteorclient.gui.WindowScreen; @@ -12,12 +12,12 @@ import meteordevelopment.meteorclient.utils.render.color.SettingColor; import net.minecraft.block.Block; -public class SBlockDataScreen extends WindowScreen { - private final SBlockData blockData; +public class ESPBlockDataScreen extends WindowScreen { + private final ESPBlockData blockData; private final Block block; - private final BlockDataSetting setting; + private final BlockDataSetting setting; - public SBlockDataScreen(GuiTheme theme, SBlockData blockData, Block block, BlockDataSetting setting) { + public ESPBlockDataScreen(GuiTheme theme, ESPBlockData blockData, Block block, BlockDataSetting setting) { super(theme, "Configure Block"); this.blockData = blockData; @@ -95,7 +95,7 @@ public void initWidgets() { add(theme.settings(settings)).expandX(); } - private void changed(SBlockData blockData, Block block, BlockDataSetting setting) { + private void changed(ESPBlockData blockData, Block block, BlockDataSetting setting) { if (!blockData.isChanged() && block != null && setting != null) { setting.get().put(block, blockData); setting.onChanged(); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/search/SChunk.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/blockesp/ESPChunk.java similarity index 76% rename from src/main/java/meteordevelopment/meteorclient/systems/modules/render/search/SChunk.java rename to src/main/java/meteordevelopment/meteorclient/systems/modules/render/blockesp/ESPChunk.java index ffbc1a20f5..cc39ce2a30 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/search/SChunk.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/blockesp/ESPChunk.java @@ -3,7 +3,7 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.modules.render.search; +package meteordevelopment.meteorclient.systems.modules.render.blockesp; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; @@ -20,26 +20,26 @@ import static meteordevelopment.meteorclient.MeteorClient.mc; import static meteordevelopment.meteorclient.utils.Utils.getRenderDistance; -public class SChunk { +public class ESPChunk { private static final BlockPos.Mutable blockPos = new BlockPos.Mutable(); private final int x, z; - public Long2ObjectMap blocks; + public Long2ObjectMap blocks; - public SChunk(int x, int z) { + public ESPChunk(int x, int z) { this.x = x; this.z = z; } - public SBlock get(int x, int y, int z) { - return blocks == null ? null : blocks.get(SBlock.getKey(x, y, z)); + public ESPBlock get(int x, int y, int z) { + return blocks == null ? null : blocks.get(ESPBlock.getKey(x, y, z)); } public void add(BlockPos blockPos, boolean update) { - SBlock block = new SBlock(blockPos.getX(), blockPos.getY(), blockPos.getZ()); + ESPBlock block = new ESPBlock(blockPos.getX(), blockPos.getY(), blockPos.getZ()); if (blocks == null) blocks = new Long2ObjectOpenHashMap<>(64); - blocks.put(SBlock.getKey(blockPos), block); + blocks.put(ESPBlock.getKey(blockPos), block); if (update) block.update(); } @@ -50,20 +50,20 @@ public void add(BlockPos blockPos) { public void remove(BlockPos blockPos) { if (blocks != null) { - SBlock block = blocks.remove(SBlock.getKey(blockPos)); + ESPBlock block = blocks.remove(ESPBlock.getKey(blockPos)); if (block != null) block.group.remove(block); } } public void update() { if (blocks != null) { - for (SBlock block : blocks.values()) block.update(); + for (ESPBlock block : blocks.values()) block.update(); } } public void update(int x, int y, int z) { if (blocks != null) { - SBlock block = blocks.get(SBlock.getKey(x, y, z)); + ESPBlock block = blocks.get(ESPBlock.getKey(x, y, z)); if (block != null) block.update(); } } @@ -82,13 +82,13 @@ public boolean shouldBeDeleted() { public void render(Render3DEvent event) { if (blocks != null) { - for (SBlock block : blocks.values()) block.render(event); + for (ESPBlock block : blocks.values()) block.render(event); } } - public static SChunk searchChunk(Chunk chunk, List blocks) { - SChunk schunk = new SChunk(chunk.getPos().x, chunk.getPos().z); + public static ESPChunk searchChunk(Chunk chunk, List blocks) { + ESPChunk schunk = new ESPChunk(chunk.getPos().x, chunk.getPos().z); if (schunk.shouldBeDeleted()) return schunk; for (int x = chunk.getPos().getStartX(); x <= chunk.getPos().getEndX(); x++) { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/search/SGroup.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/blockesp/ESPGroup.java similarity index 61% rename from src/main/java/meteordevelopment/meteorclient/systems/modules/render/search/SGroup.java rename to src/main/java/meteordevelopment/meteorclient/systems/modules/render/blockesp/ESPGroup.java index 8950812c14..6f4c109f2f 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/search/SGroup.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/blockesp/ESPGroup.java @@ -3,7 +3,7 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.systems.modules.render.search; +package meteordevelopment.meteorclient.systems.modules.render.blockesp; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import meteordevelopment.meteorclient.events.render.Render3DEvent; @@ -16,20 +16,20 @@ import java.util.Queue; import java.util.Set; -public class SGroup { - private static final Search search = Modules.get().get(Search.class); +public class ESPGroup { + private static final BlockESP blockEsp = Modules.get().get(BlockESP.class); private final Block block; - public final UnorderedArrayList blocks = new UnorderedArrayList<>(); + public final UnorderedArrayList blocks = new UnorderedArrayList<>(); private double sumX, sumY, sumZ; - public SGroup(Block block) { + public ESPGroup(Block block) { this.block = block; } - public void add(SBlock block, boolean removeFromOld, boolean splitGroup) { + public void add(ESPBlock block, boolean removeFromOld, boolean splitGroup) { blocks.add(block); sumX += block.x; sumY += block.y; @@ -39,39 +39,39 @@ public void add(SBlock block, boolean removeFromOld, boolean splitGroup) { block.group = this; } - public void add(SBlock block) { + public void add(ESPBlock block) { add(block, true, true); } - public void remove(SBlock block, boolean splitGroup) { + public void remove(ESPBlock block, boolean splitGroup) { blocks.remove(block); sumX -= block.x; sumY -= block.y; sumZ -= block.z; - if (blocks.isEmpty()) search.removeGroup(block.group); + if (blocks.isEmpty()) blockEsp.removeGroup(block.group); else if (splitGroup) { trySplit(block); } } - public void remove(SBlock block) { + public void remove(ESPBlock block) { remove(block, true); } - private void trySplit(SBlock block) { - Set neighbours = new ObjectOpenHashSet<>(6); + private void trySplit(ESPBlock block) { + Set neighbours = new ObjectOpenHashSet<>(6); - for (int side : SBlock.SIDES) { + for (int side : ESPBlock.SIDES) { if ((block.neighbours & side) == side) { - SBlock neighbour = block.getSideBlock(side); + ESPBlock neighbour = block.getSideBlock(side); if (neighbour != null) neighbours.add(neighbour); } } if (neighbours.size() <= 1) return; - Set remainingBlocks = new ObjectOpenHashSet<>(blocks); - Queue blocksToCheck = new ArrayDeque<>(); + Set remainingBlocks = new ObjectOpenHashSet<>(blocks); + Queue blocksToCheck = new ArrayDeque<>(); blocksToCheck.offer(blocks.get(0)); remainingBlocks.remove(blocks.get(0)); @@ -79,11 +79,11 @@ private void trySplit(SBlock block) { loop: { while (!blocksToCheck.isEmpty()) { - SBlock b = blocksToCheck.poll(); + ESPBlock b = blocksToCheck.poll(); - for (int side : SBlock.SIDES) { + for (int side : ESPBlock.SIDES) { if ((b.neighbours & side) != side) continue; - SBlock neighbour = b.getSideBlock(side); + ESPBlock neighbour = b.getSideBlock(side); if (neighbour != null && remainingBlocks.contains(neighbour)) { blocksToCheck.offer(neighbour); @@ -97,12 +97,12 @@ private void trySplit(SBlock block) { } if (neighbours.size() > 0) { - SGroup group = search.newGroup(this.block); + ESPGroup group = blockEsp.newGroup(this.block); group.blocks.ensureCapacity(remainingBlocks.size()); blocks.removeIf(remainingBlocks::contains); - for (SBlock b : remainingBlocks) { + for (ESPBlock b : remainingBlocks) { group.add(b, false, false); sumX -= b.x; @@ -113,18 +113,18 @@ private void trySplit(SBlock block) { if (neighbours.size() > 1) { block.neighbours = 0; - for (SBlock b : neighbours) { + for (ESPBlock b : neighbours) { int x = b.x - block.x; - if (x == 1) block.neighbours |= SBlock.RI; - else if (x == -1) block.neighbours |= SBlock.LE; + if (x == 1) block.neighbours |= ESPBlock.RI; + else if (x == -1) block.neighbours |= ESPBlock.LE; int y = b.y - block.y; - if (y == 1) block.neighbours |= SBlock.TO; - else if (y == -1) block.neighbours |= SBlock.BO; + if (y == 1) block.neighbours |= ESPBlock.TO; + else if (y == -1) block.neighbours |= ESPBlock.BO; int z = b.z - block.z; - if (z == 1) block.neighbours |= SBlock.FO; - else if (z == -1) block.neighbours |= SBlock.BA; + if (z == 1) block.neighbours |= ESPBlock.FO; + else if (z == -1) block.neighbours |= ESPBlock.BA; } group.trySplit(block); @@ -132,14 +132,14 @@ private void trySplit(SBlock block) { } } - public void merge(SGroup group) { + public void merge(ESPGroup group) { blocks.ensureCapacity(blocks.size() + group.blocks.size()); - for (SBlock block : group.blocks) add(block, false, false); - search.removeGroup(group); + for (ESPBlock block : group.blocks) add(block, false, false); + blockEsp.removeGroup(group); } public void render(Render3DEvent event) { - SBlockData blockData = search.getBlockData(block); + ESPBlockData blockData = blockEsp.getBlockData(block); if (blockData.tracer) { event.renderer.line(RenderUtils.center.x, RenderUtils.center.y, RenderUtils.center.z, sumX / blocks.size() + 0.5, sumY / blocks.size() + 0.5, sumZ / blocks.size() + 0.5, blockData.tracerColor); From e0a12e419eebfcff0529100866199dabfc3b58da Mon Sep 17 00:00:00 2001 From: SodaXwX <62250232+ThebestkillerTBK@users.noreply.github.com> Date: Fri, 16 Dec 2022 08:44:01 +0800 Subject: [PATCH 005/135] NoBreakDelay -> BreakDelay, now you can modify the break cooldown (#2865) --- .../player/BlockBreakingCooldownEvent.java | 17 +++++++++ .../ClientPlayerInteractionManagerMixin.java | 22 +++++++----- .../meteorclient/systems/modules/Modules.java | 2 +- .../systems/modules/player/BreakDelay.java | 36 +++++++++++++++++++ .../systems/modules/player/NoBreakDelay.java | 15 -------- .../systems/modules/world/Nuker.java | 7 ++++ 6 files changed, 74 insertions(+), 25 deletions(-) create mode 100644 src/main/java/meteordevelopment/meteorclient/events/entity/player/BlockBreakingCooldownEvent.java create mode 100644 src/main/java/meteordevelopment/meteorclient/systems/modules/player/BreakDelay.java delete mode 100644 src/main/java/meteordevelopment/meteorclient/systems/modules/player/NoBreakDelay.java diff --git a/src/main/java/meteordevelopment/meteorclient/events/entity/player/BlockBreakingCooldownEvent.java b/src/main/java/meteordevelopment/meteorclient/events/entity/player/BlockBreakingCooldownEvent.java new file mode 100644 index 0000000000..837a8b977b --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/events/entity/player/BlockBreakingCooldownEvent.java @@ -0,0 +1,17 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.events.entity.player; + +public class BlockBreakingCooldownEvent { + private static final BlockBreakingCooldownEvent INSTANCE = new BlockBreakingCooldownEvent(); + + public int cooldown; + + public static BlockBreakingCooldownEvent get(int cooldown) { + INSTANCE.cooldown = cooldown; + return INSTANCE; + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerInteractionManagerMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerInteractionManagerMixin.java index 062397fdb4..b49ddd0eb5 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerInteractionManagerMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerInteractionManagerMixin.java @@ -11,9 +11,7 @@ import meteordevelopment.meteorclient.mixininterface.IClientPlayerInteractionManager; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.misc.InventoryTweaks; -import meteordevelopment.meteorclient.systems.modules.player.NoBreakDelay; import meteordevelopment.meteorclient.systems.modules.player.Reach; -import meteordevelopment.meteorclient.systems.modules.world.Nuker; import meteordevelopment.meteorclient.utils.player.Rotations; import meteordevelopment.meteorclient.utils.world.BlockUtils; import net.minecraft.client.network.ClientPlayerEntity; @@ -112,16 +110,22 @@ private void onGetReachDistance(CallbackInfoReturnable info) { info.setReturnValue(Modules.get().get(Reach.class).getReach()); } - @Redirect(method = "updateBlockBreakingProgress", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;blockBreakingCooldown:I", opcode = Opcodes.PUTFIELD)) - private void onMethod_2902SetField_3716Proxy(ClientPlayerInteractionManager interactionManager, int value) { - if (Modules.get().isActive(NoBreakDelay.class) || Modules.get().isActive(Nuker.class)) value = 0; - blockBreakingCooldown = value; + @Redirect(method = "updateBlockBreakingProgress", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;blockBreakingCooldown:I", ordinal = 3)) + private void updateBlockBreakingProgress3(ClientPlayerInteractionManager interactionManager, int value) { + BlockBreakingCooldownEvent event = MeteorClient.EVENT_BUS.post(BlockBreakingCooldownEvent.get(value)); + blockBreakingCooldown = event.cooldown; + } + + @Redirect(method = "updateBlockBreakingProgress", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;blockBreakingCooldown:I", ordinal = 4)) + private void updateBlockBreakingProgress4(ClientPlayerInteractionManager interactionManager, int value) { + BlockBreakingCooldownEvent event = MeteorClient.EVENT_BUS.post(BlockBreakingCooldownEvent.get(value)); + blockBreakingCooldown = event.cooldown; } @Redirect(method = "attackBlock", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;blockBreakingCooldown:I", opcode = Opcodes.PUTFIELD)) - private void onAttackBlockSetField_3719Proxy(ClientPlayerInteractionManager interactionManager, int value) { - if (Modules.get().isActive(NoBreakDelay.class) || Modules.get().isActive(Nuker.class)) value = 0; - blockBreakingCooldown = value; + private void attackBlock(ClientPlayerInteractionManager interactionManager, int value) { + BlockBreakingCooldownEvent event = MeteorClient.EVENT_BUS.post(BlockBreakingCooldownEvent.get(value)); + blockBreakingCooldown = event.cooldown; } @Inject(method = "breakBlock", at = @At("HEAD"), cancellable = true) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java index e05e1b9551..7894c2b2c8 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java @@ -427,7 +427,7 @@ private void initPlayer() { add(new GhostHand()); add(new LiquidInteract()); add(new MiddleClickExtra()); - add(new NoBreakDelay()); + add(new BreakDelay()); add(new NoInteract()); add(new NoMiningTrace()); add(new NoRotate()); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/BreakDelay.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/BreakDelay.java new file mode 100644 index 0000000000..d5608a2797 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/BreakDelay.java @@ -0,0 +1,36 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.systems.modules.player; + +import meteordevelopment.meteorclient.events.entity.player.BlockBreakingCooldownEvent; +import meteordevelopment.meteorclient.settings.IntSetting; +import meteordevelopment.meteorclient.settings.Setting; +import meteordevelopment.meteorclient.settings.SettingGroup; +import meteordevelopment.meteorclient.systems.modules.Categories; +import meteordevelopment.meteorclient.systems.modules.Module; +import meteordevelopment.orbit.EventHandler; + +public class BreakDelay extends Module { + SettingGroup sgGeneral = settings.getDefaultGroup(); + + private final Setting cooldown = sgGeneral.add(new IntSetting.Builder() + .name("cooldown") + .description("Block break cooldown in ticks.") + .defaultValue(0) + .min(0) + .sliderMax(5) + .build() + ); + + public BreakDelay() { + super(Categories.Player, "break-delay", "Changes the delay between breaking blocks."); + } + + @EventHandler() + private void onBlockBreakingCooldown(BlockBreakingCooldownEvent event) { + event.cooldown = cooldown.get(); + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/NoBreakDelay.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/NoBreakDelay.java deleted file mode 100644 index 089e77ac6f..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/NoBreakDelay.java +++ /dev/null @@ -1,15 +0,0 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.systems.modules.player; - -import meteordevelopment.meteorclient.systems.modules.Categories; -import meteordevelopment.meteorclient.systems.modules.Module; - -public class NoBreakDelay extends Module { - public NoBreakDelay() { - super(Categories.Player, "no-break-delay", "Completely removes the delay between breaking blocks."); - } -} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java index b4e6059e9f..ca691ea6cd 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java @@ -5,6 +5,7 @@ package meteordevelopment.meteorclient.systems.modules.world; +import meteordevelopment.meteorclient.events.entity.player.BlockBreakingCooldownEvent; import meteordevelopment.meteorclient.events.render.Render3DEvent; import meteordevelopment.meteorclient.events.world.TickEvent; import meteordevelopment.meteorclient.renderer.ShapeMode; @@ -18,6 +19,7 @@ import meteordevelopment.meteorclient.utils.world.BlockIterator; import meteordevelopment.meteorclient.utils.world.BlockUtils; import meteordevelopment.orbit.EventHandler; +import meteordevelopment.orbit.EventPriority; import net.minecraft.block.Block; import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket; import net.minecraft.util.Hand; @@ -419,6 +421,11 @@ else if (sortMode.get() != SortMode.None) blocks.clear(); }); } + + @EventHandler(priority = EventPriority.HIGHEST) + private void onBlockBreakingCooldown(BlockBreakingCooldownEvent event) { + event.cooldown = 0; + } public enum ListMode { Whitelist, From 9a1741b8fc7d4e43d3bdf88af3d4af5b2806acff Mon Sep 17 00:00:00 2001 From: SodaXwX <62250232+ThebestkillerTBK@users.noreply.github.com> Date: Fri, 16 Dec 2022 08:46:42 +0800 Subject: [PATCH 006/135] speed mine: prevent ghost blocks spawning (#2860) --- .../meteorclient/mixin/PlayerEntityMixin.java | 18 ++++++++++- .../meteorclient/utils/world/BlockUtils.java | 30 +++++++++++++++---- 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityMixin.java index 9c05671865..50bcb7693d 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityMixin.java @@ -11,12 +11,16 @@ import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.movement.Anchor; import meteordevelopment.meteorclient.systems.modules.player.SpeedMine; +import meteordevelopment.meteorclient.utils.world.BlockUtils; import net.minecraft.block.BlockState; import net.minecraft.entity.EntityType; import net.minecraft.entity.ItemEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.hit.HitResult; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -24,6 +28,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import static meteordevelopment.meteorclient.MeteorClient.mc; + @Mixin(PlayerEntity.class) public abstract class PlayerEntityMixin extends LivingEntity { protected PlayerEntityMixin(EntityType entityType, World world) { @@ -48,8 +54,18 @@ private void onDropItem(ItemStack stack, boolean bl, boolean bl2, CallbackInfoRe public void onGetBlockBreakingSpeed(BlockState block, CallbackInfoReturnable cir) { SpeedMine module = Modules.get().get(SpeedMine.class); if (!module.isActive() || module.mode.get() != SpeedMine.Mode.Normal) return; + float breakSpeed = cir.getReturnValue(); + float breakSpeedMod = (float) (breakSpeed * module.modifier.get()); + + HitResult result = mc.crosshairTarget; + if (result != null && result.getType() == HitResult.Type.BLOCK) { + BlockPos pos = ((BlockHitResult) result).getBlockPos(); + if (module.modifier.get() < 1 || (BlockUtils.canInstaBreak(pos, breakSpeed) == BlockUtils.canInstaBreak(pos, breakSpeedMod))) + cir.setReturnValue(breakSpeedMod); + else + cir.setReturnValue(0.9f / BlockUtils.calcBlockBreakingDelta2(pos, 1)); + } - cir.setReturnValue((float) (cir.getReturnValue() * module.modifier.get())); } @Inject(method = "jump", at = @At("HEAD"), cancellable = true) diff --git a/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java index 3d6b5c79c6..cdcf597a2b 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java @@ -182,14 +182,17 @@ private static void onTickPost(TickEvent.Post event) { } } - /** Needs to be used in {@link TickEvent.Pre} */ + /** + * Needs to be used in {@link TickEvent.Pre} + */ public static boolean breakBlock(BlockPos blockPos, boolean swing) { if (!canBreak(blockPos, mc.world.getBlockState(blockPos))) return false; // Creating new instance of block pos because minecraft assigns the parameter to a field and we don't want it to change when it has been stored in a field somewhere BlockPos pos = blockPos instanceof BlockPos.Mutable ? new BlockPos(blockPos) : blockPos; - if (mc.interactionManager.isBreakingBlock()) mc.interactionManager.updateBlockBreakingProgress(pos, Direction.UP); + if (mc.interactionManager.isBreakingBlock()) + mc.interactionManager.updateBlockBreakingProgress(pos, Direction.UP); else mc.interactionManager.attackBlock(pos, Direction.UP); if (swing) mc.player.swingHand(Hand.MAIN_HAND); @@ -205,15 +208,29 @@ public static boolean canBreak(BlockPos blockPos, BlockState state) { if (!mc.player.isCreative() && state.getHardness(mc.world, blockPos) < 0) return false; return state.getOutlineShape(mc.world, blockPos) != VoxelShapes.empty(); } + public static boolean canBreak(BlockPos blockPos) { return canBreak(blockPos, mc.world.getBlockState(blockPos)); } - public static boolean canInstaBreak(BlockPos blockPos, BlockState state) { - return mc.player.isCreative() || state.calcBlockBreakingDelta(mc.player, mc.world, blockPos) >= 1; + public static boolean canInstaBreak(BlockPos blockPos, float breakSpeed) { + return mc.player.isCreative() || calcBlockBreakingDelta2(blockPos, breakSpeed) >= 1; } + public static boolean canInstaBreak(BlockPos blockPos) { - return canInstaBreak(blockPos, mc.world.getBlockState(blockPos)); + BlockState state = mc.world.getBlockState(blockPos); + return canInstaBreak(blockPos, mc.player.getBlockBreakingSpeed(state)); + } + + public static float calcBlockBreakingDelta2(BlockPos blockPos, float breakSpeed) { + BlockState state = mc.world.getBlockState(blockPos); + float f = state.getHardness(mc.world, blockPos); + if (f == -1.0F) { + return 0.0F; + } else { + int i = mc.player.canHarvest(state) ? 30 : 100; + return breakSpeed / f / (float) i; + } } // Other @@ -237,7 +254,8 @@ public static MobSpawn isValidMobSpawn(BlockPos blockPos, boolean newMobSpawnLig mc.world.getBlockState(blockPos.down()).getBlock() == Blocks.BEDROCK) return MobSpawn.Never; if (!topSurface(mc.world.getBlockState(blockPos.down()))) { - if (mc.world.getBlockState(blockPos.down()).getCollisionShape(mc.world, blockPos.down()) != VoxelShapes.fullCube()) return MobSpawn.Never; + if (mc.world.getBlockState(blockPos.down()).getCollisionShape(mc.world, blockPos.down()) != VoxelShapes.fullCube()) + return MobSpawn.Never; if (mc.world.getBlockState(blockPos.down()).isTranslucent(mc.world, blockPos.down())) return MobSpawn.Never; } From da0a6f08e65ea7db8d08d37ddf72563bb3e67ef7 Mon Sep 17 00:00:00 2001 From: Based Ricky <80427814+RickyTheRacc@users.noreply.github.com> Date: Thu, 15 Dec 2022 18:54:26 -0600 Subject: [PATCH 007/135] Optimize validHole check (#3055) --- .../meteorclient/mixininterface/IBox.java | 6 ++ .../systems/modules/combat/HoleFiller.java | 72 +++++++++++-------- 2 files changed, 48 insertions(+), 30 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixininterface/IBox.java b/src/main/java/meteordevelopment/meteorclient/mixininterface/IBox.java index 03159d3316..daf97f8a1f 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixininterface/IBox.java +++ b/src/main/java/meteordevelopment/meteorclient/mixininterface/IBox.java @@ -5,8 +5,14 @@ package meteordevelopment.meteorclient.mixininterface; +import net.minecraft.util.math.BlockPos; + public interface IBox { void expand(double v); void set(double x1, double y1, double z1, double x2, double y2, double z2); + + default void set(BlockPos pos) { + set(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); + } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/HoleFiller.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/HoleFiller.java index 9db3afea09..7f724705b4 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/HoleFiller.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/HoleFiller.java @@ -8,6 +8,7 @@ import meteordevelopment.meteorclient.events.render.Render3DEvent; import meteordevelopment.meteorclient.events.world.TickEvent; import meteordevelopment.meteorclient.mixin.AbstractBlockAccessor; +import meteordevelopment.meteorclient.mixininterface.IBox; import meteordevelopment.meteorclient.renderer.ShapeMode; import meteordevelopment.meteorclient.settings.*; import meteordevelopment.meteorclient.systems.friends.Friends; @@ -26,9 +27,11 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.entity.TntEntity; +import net.minecraft.entity.decoration.EndCrystalEntity; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.BlockItem; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Box; import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; @@ -221,6 +224,10 @@ public class HoleFiller extends Module { private final List targets = new ArrayList<>(); private final List holes = new ArrayList<>(); + + private final BlockPos.Mutable testPos = new BlockPos.Mutable(); + private final Box box = new Box(0, 0, 0, 0, 0, 0); + private Vec3d testVec; private int timer; public HoleFiller() { @@ -312,23 +319,32 @@ private void onRender(Render3DEvent event) { } private boolean validHole(BlockPos pos) { - if (mc.player.getBlockPos().equals(pos)) return false; - if (distance(mc.player, pos, false) > placeRange.get()) return false; - if (mc.world.getBlockState(pos).getBlock() == Blocks.COBWEB) return false; - - if (smart.get() && !forceFill.get().isPressed()) { - boolean validHole = false; - for (PlayerEntity target : targets) { - if (target.getY() > pos.getY() - && !target.getBlockPos().equals(pos) - && (distance(target, pos, true) < feetRange.get()) - ) validHole = true; + testPos.set(pos); + + if (mc.player.getBlockPos().equals(testPos)) return false; + if (distance(mc.player, testPos, false) > placeRange.get()) return false; + if (mc.world.getBlockState(testPos).getBlock() == Blocks.COBWEB) return false; + + if (((AbstractBlockAccessor) mc.world.getBlockState(testPos).getBlock()).isCollidable()) return false; + testPos.add(0, 1, 0); + if (((AbstractBlockAccessor) mc.world.getBlockState(testPos).getBlock()).isCollidable()) return false; + testPos.add(0, -1, 0); + + ((IBox) box).set(pos); + if (!mc.world.getOtherEntities(null, box, entity -> entity instanceof PlayerEntity + || entity instanceof TntEntity || entity instanceof EndCrystalEntity).isEmpty()) return false; + + if (!smart.get() || forceFill.get().isPressed()) return true; + + boolean validHole = false; + for (PlayerEntity target : targets) { + if (target.getY() > testPos.getY() && (distance(target, testPos, true) < feetRange.get())) { + validHole = true; + break; } - if (!validHole) return false; } - if (((AbstractBlockAccessor) mc.world.getBlockState(pos).getBlock()).isCollidable()) return false; - return !((AbstractBlockAccessor) mc.world.getBlockState(pos.up()).getBlock()).isCollidable(); + return validHole; } private void setTargets() { @@ -343,12 +359,9 @@ private void setTargets() { ) continue; if (onlyMoving.get()) { - Vec3d velocity = new Vec3d( - player.getX() - player.prevX, - player.getY() - player.prevY, - player.getZ() - player.prevZ - ); - if (velocity.length() == 0) continue; + if (player.getX() - player.prevX != 0) continue; + if (player.getY() - player.prevY != 0) continue; + if (player.getZ() - player.prevZ != 0) continue; } if (ignoreSafe.get()) { @@ -363,7 +376,8 @@ private boolean isSurrounded(PlayerEntity target) { for (Direction dir : Direction.values()) { if (dir == Direction.UP || dir == Direction.DOWN) continue; - Block block = mc.world.getBlockState(target.getBlockPos().offset(dir)).getBlock(); + testPos.set(target.getBlockPos().offset(dir)); + Block block = mc.world.getBlockState(testPos).getBlock(); if (block != Blocks.OBSIDIAN && block != Blocks.BEDROCK && block != Blocks.RESPAWN_ANCHOR && block != Blocks.CRYING_OBSIDIAN && block != Blocks.NETHERITE_BLOCK) { return false; @@ -374,22 +388,20 @@ private boolean isSurrounded(PlayerEntity target) { } private double distance(PlayerEntity player, BlockPos pos, boolean feet) { - Vec3d center = new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5); - if (feet) center.add(0, 0.5, 0); + testVec = player.getPos(); + if (!feet) testVec.add(0, player.getEyeHeight(mc.player.getPose()), 0); - Vec3d playerPos = player.getPos(); - if (!feet) playerPos.add(0, player.getEyeHeight(mc.player.getPose()), 0); else if (predict.get()) { - playerPos.add( + testVec.add( player.getX() - player.prevX, player.getY() - player.prevY, player.getZ() - player.prevZ ); } - double i = playerPos.x - center.x; - double j = playerPos.y - center.y; - double k = playerPos.z - center.z; + double i = testVec.x - (pos.getX() + 0.5); + double j = testVec.y - (pos.getX() + ((feet) ? 1 : 0.5)); + double k = testVec.z - (pos.getZ() + 0.5); return (Math.sqrt(i * i + j * j + k * k)); } From 3bd0c8ba2487a6a223bf59af0e4924b4c57312bb Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Fri, 16 Dec 2022 18:16:31 +0800 Subject: [PATCH 008/135] fake player fixed --- .../utils/entity/fakeplayer/FakePlayerEntity.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/utils/entity/fakeplayer/FakePlayerEntity.java b/src/main/java/meteordevelopment/meteorclient/utils/entity/fakeplayer/FakePlayerEntity.java index a0ee18223b..4ddc217c9e 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/entity/fakeplayer/FakePlayerEntity.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/entity/fakeplayer/FakePlayerEntity.java @@ -5,18 +5,21 @@ package meteordevelopment.meteorclient.utils.entity.fakeplayer; +import com.mojang.authlib.GameProfile; import net.minecraft.client.network.OtherClientPlayerEntity; import net.minecraft.client.network.PlayerListEntry; import net.minecraft.entity.player.PlayerEntity; import org.jetbrains.annotations.Nullable; +import java.util.UUID; + import static meteordevelopment.meteorclient.MeteorClient.mc; public class FakePlayerEntity extends OtherClientPlayerEntity { public boolean doNotPush, hideWhenInsideCamera; public FakePlayerEntity(PlayerEntity player, String name, float health, boolean copyInv) { - super(mc.world, player.getGameProfile()); + super(mc.world, new GameProfile(UUID.randomUUID(), name)); copyPositionAndRotation(player); From 70f1a30c661d97da4ac11ce658e3f036bf62f052 Mon Sep 17 00:00:00 2001 From: MineGame159 Date: Fri, 16 Dec 2022 21:04:27 +0100 Subject: [PATCH 009/135] Regenerate PacketUtils.java --- .../utils/network/PacketUtils.java | 32 +++++++++++++------ .../utils/network/PacketUtilsUtil.java | 12 +++++-- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtils.java index 35ecc1fdef..2af0c944c2 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtils.java @@ -19,7 +19,6 @@ import net.minecraft.util.Identifier; import net.minecraft.util.math.random.Random; import org.jetbrains.annotations.NotNull; - import java.util.*; import java.util.stream.Stream; @@ -89,14 +88,16 @@ public class PacketUtils { C2S_PACKETS_R.put("PlayerMoveC2SPacket", net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.PickFromInventoryC2SPacket.class, "PickFromInventoryC2SPacket"); C2S_PACKETS_R.put("PickFromInventoryC2SPacket", net.minecraft.network.packet.c2s.play.PickFromInventoryC2SPacket.class); + C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.PlayerSessionC2SPacket.class, "PlayerSessionC2SPacket"); + C2S_PACKETS_R.put("PlayerSessionC2SPacket", net.minecraft.network.packet.c2s.play.PlayerSessionC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket.class, "CloseHandledScreenC2SPacket"); C2S_PACKETS_R.put("CloseHandledScreenC2SPacket", net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.BoatPaddleStateC2SPacket.class, "BoatPaddleStateC2SPacket"); C2S_PACKETS_R.put("BoatPaddleStateC2SPacket", net.minecraft.network.packet.c2s.play.BoatPaddleStateC2SPacket.class); - C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.ChatMessageC2SPacket.class, "ChatMessageC2SPacket"); - C2S_PACKETS_R.put("ChatMessageC2SPacket", net.minecraft.network.packet.c2s.play.ChatMessageC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.ButtonClickC2SPacket.class, "ButtonClickC2SPacket"); C2S_PACKETS_R.put("ButtonClickC2SPacket", net.minecraft.network.packet.c2s.play.ButtonClickC2SPacket.class); + C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.ChatMessageC2SPacket.class, "ChatMessageC2SPacket"); + C2S_PACKETS_R.put("ChatMessageC2SPacket", net.minecraft.network.packet.c2s.play.ChatMessageC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.UpdateBeaconC2SPacket.class, "UpdateBeaconC2SPacket"); C2S_PACKETS_R.put("UpdateBeaconC2SPacket", net.minecraft.network.packet.c2s.play.UpdateBeaconC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.UpdateSignC2SPacket.class, "UpdateSignC2SPacket"); @@ -117,18 +118,18 @@ public class PacketUtils { C2S_PACKETS_R.put("UpdateJigsawC2SPacket", net.minecraft.network.packet.c2s.play.UpdateJigsawC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.query.QueryPingC2SPacket.class, "QueryPingC2SPacket"); C2S_PACKETS_R.put("QueryPingC2SPacket", net.minecraft.network.packet.c2s.query.QueryPingC2SPacket.class); - C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.ResourcePackStatusC2SPacket.class, "ResourcePackStatusC2SPacket"); - C2S_PACKETS_R.put("ResourcePackStatusC2SPacket", net.minecraft.network.packet.c2s.play.ResourcePackStatusC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.PlayPongC2SPacket.class, "PlayPongC2SPacket"); C2S_PACKETS_R.put("PlayPongC2SPacket", net.minecraft.network.packet.c2s.play.PlayPongC2SPacket.class); + C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.ResourcePackStatusC2SPacket.class, "ResourcePackStatusC2SPacket"); + C2S_PACKETS_R.put("ResourcePackStatusC2SPacket", net.minecraft.network.packet.c2s.play.ResourcePackStatusC2SPacket.class); + C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.MessageAcknowledgmentC2SPacket.class, "MessageAcknowledgmentC2SPacket"); + C2S_PACKETS_R.put("MessageAcknowledgmentC2SPacket", net.minecraft.network.packet.c2s.play.MessageAcknowledgmentC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket.class, "CreativeInventoryActionC2SPacket"); C2S_PACKETS_R.put("CreativeInventoryActionC2SPacket", net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket.class, "VehicleMoveC2SPacket"); C2S_PACKETS_R.put("VehicleMoveC2SPacket", net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.BookUpdateC2SPacket.class, "BookUpdateC2SPacket"); C2S_PACKETS_R.put("BookUpdateC2SPacket", net.minecraft.network.packet.c2s.play.BookUpdateC2SPacket.class); - //C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.RequestChatPreviewC2SPacket.class, "RequestChatPreviewC2SPacket"); - //C2S_PACKETS_R.put("RequestChatPreviewC2SPacket", net.minecraft.network.packet.c2s.play.RequestChatPreviewC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.play.RecipeBookDataC2SPacket.class, "RecipeBookDataC2SPacket"); C2S_PACKETS_R.put("RecipeBookDataC2SPacket", net.minecraft.network.packet.c2s.play.RecipeBookDataC2SPacket.class); C2S_PACKETS.put(net.minecraft.network.packet.c2s.login.LoginQueryResponseC2SPacket.class, "LoginQueryResponseC2SPacket"); @@ -152,6 +153,8 @@ public class PacketUtils { S2C_PACKETS_R.put("WorldBorderSizeChangedS2CPacket", net.minecraft.network.packet.s2c.play.WorldBorderSizeChangedS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.AdvancementUpdateS2CPacket.class, "AdvancementUpdateS2CPacket"); S2C_PACKETS_R.put("AdvancementUpdateS2CPacket", net.minecraft.network.packet.s2c.play.AdvancementUpdateS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.FeaturesS2CPacket.class, "FeaturesS2CPacket"); + S2C_PACKETS_R.put("FeaturesS2CPacket", net.minecraft.network.packet.s2c.play.FeaturesS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket.class, "CustomPayloadS2CPacket"); S2C_PACKETS_R.put("CustomPayloadS2CPacket", net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.WorldBorderInterpolateSizeS2CPacket.class, "WorldBorderInterpolateSizeS2CPacket"); @@ -166,6 +169,8 @@ public class PacketUtils { S2C_PACKETS_R.put("PlayerListHeaderS2CPacket", net.minecraft.network.packet.s2c.play.PlayerListHeaderS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.EntitySpawnS2CPacket.class, "EntitySpawnS2CPacket"); S2C_PACKETS_R.put("EntitySpawnS2CPacket", net.minecraft.network.packet.s2c.play.EntitySpawnS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.RemoveMessageS2CPacket.class, "RemoveMessageS2CPacket"); + S2C_PACKETS_R.put("RemoveMessageS2CPacket", net.minecraft.network.packet.s2c.play.RemoveMessageS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.SetCameraEntityS2CPacket.class, "SetCameraEntityS2CPacket"); S2C_PACKETS_R.put("SetCameraEntityS2CPacket", net.minecraft.network.packet.s2c.play.SetCameraEntityS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.CraftFailedResponseS2CPacket.class, "CraftFailedResponseS2CPacket"); @@ -216,16 +221,18 @@ public class PacketUtils { S2C_PACKETS_R.put("CooldownUpdateS2CPacket", net.minecraft.network.packet.s2c.play.CooldownUpdateS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.OpenScreenS2CPacket.class, "OpenScreenS2CPacket"); S2C_PACKETS_R.put("OpenScreenS2CPacket", net.minecraft.network.packet.s2c.play.OpenScreenS2CPacket.class); - S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ExperienceOrbSpawnS2CPacket.class, "ExperienceOrbSpawnS2CPacket"); - S2C_PACKETS_R.put("ExperienceOrbSpawnS2CPacket", net.minecraft.network.packet.s2c.play.ExperienceOrbSpawnS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.EntityAnimationS2CPacket.class, "EntityAnimationS2CPacket"); S2C_PACKETS_R.put("EntityAnimationS2CPacket", net.minecraft.network.packet.s2c.play.EntityAnimationS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ExperienceOrbSpawnS2CPacket.class, "ExperienceOrbSpawnS2CPacket"); + S2C_PACKETS_R.put("ExperienceOrbSpawnS2CPacket", net.minecraft.network.packet.s2c.play.ExperienceOrbSpawnS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.PlayerAbilitiesS2CPacket.class, "PlayerAbilitiesS2CPacket"); S2C_PACKETS_R.put("PlayerAbilitiesS2CPacket", net.minecraft.network.packet.s2c.play.PlayerAbilitiesS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.WorldBorderWarningBlocksChangedS2CPacket.class, "WorldBorderWarningBlocksChangedS2CPacket"); S2C_PACKETS_R.put("WorldBorderWarningBlocksChangedS2CPacket", net.minecraft.network.packet.s2c.play.WorldBorderWarningBlocksChangedS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.EntitiesDestroyS2CPacket.class, "EntitiesDestroyS2CPacket"); S2C_PACKETS_R.put("EntitiesDestroyS2CPacket", net.minecraft.network.packet.s2c.play.EntitiesDestroyS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.PlayerRemoveS2CPacket.class, "PlayerRemoveS2CPacket"); + S2C_PACKETS_R.put("PlayerRemoveS2CPacket", net.minecraft.network.packet.s2c.play.PlayerRemoveS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.UnlockRecipesS2CPacket.class, "UnlockRecipesS2CPacket"); S2C_PACKETS_R.put("UnlockRecipesS2CPacket", net.minecraft.network.packet.s2c.play.UnlockRecipesS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.LightUpdateS2CPacket.class, "LightUpdateS2CPacket"); @@ -250,10 +257,14 @@ public class PacketUtils { S2C_PACKETS_R.put("ScreenHandlerPropertyUpdateS2CPacket", net.minecraft.network.packet.s2c.play.ScreenHandlerPropertyUpdateS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.SimulationDistanceS2CPacket.class, "SimulationDistanceS2CPacket"); S2C_PACKETS_R.put("SimulationDistanceS2CPacket", net.minecraft.network.packet.s2c.play.SimulationDistanceS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ChatSuggestionsS2CPacket.class, "ChatSuggestionsS2CPacket"); + S2C_PACKETS_R.put("ChatSuggestionsS2CPacket", net.minecraft.network.packet.s2c.play.ChatSuggestionsS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.EnterCombatS2CPacket.class, "EnterCombatS2CPacket"); S2C_PACKETS_R.put("EnterCombatS2CPacket", net.minecraft.network.packet.s2c.play.EnterCombatS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.DeathMessageS2CPacket.class, "DeathMessageS2CPacket"); S2C_PACKETS_R.put("DeathMessageS2CPacket", net.minecraft.network.packet.s2c.play.DeathMessageS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ProfilelessChatMessageS2CPacket.class, "ProfilelessChatMessageS2CPacket"); + S2C_PACKETS_R.put("ProfilelessChatMessageS2CPacket", net.minecraft.network.packet.s2c.play.ProfilelessChatMessageS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.MapUpdateS2CPacket.class, "MapUpdateS2CPacket"); S2C_PACKETS_R.put("MapUpdateS2CPacket", net.minecraft.network.packet.s2c.play.MapUpdateS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ScreenHandlerSlotUpdateS2CPacket.class, "ScreenHandlerSlotUpdateS2CPacket"); @@ -287,6 +298,7 @@ public class PacketUtils { S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ScoreboardPlayerUpdateS2CPacket.class, "ScoreboardPlayerUpdateS2CPacket"); S2C_PACKETS_R.put("ScoreboardPlayerUpdateS2CPacket", net.minecraft.network.packet.s2c.play.ScoreboardPlayerUpdateS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.query.QueryPongS2CPacket.class, "QueryPongS2CPacket"); + S2C_PACKETS_R.put("QueryPongS2CPacket", net.minecraft.network.packet.s2c.query.QueryPongS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ChatMessageS2CPacket.class, "ChatMessageS2CPacket"); S2C_PACKETS_R.put("ChatMessageS2CPacket", net.minecraft.network.packet.s2c.play.ChatMessageS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.OpenWrittenBookS2CPacket.class, "OpenWrittenBookS2CPacket"); @@ -322,6 +334,8 @@ public class PacketUtils { S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.CloseScreenS2CPacket.class, "CloseScreenS2CPacket"); S2C_PACKETS_R.put("CloseScreenS2CPacket", net.minecraft.network.packet.s2c.play.CloseScreenS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.ScoreboardDisplayS2CPacket.class, "ScoreboardDisplayS2CPacket"); + S2C_PACKETS_R.put("ScoreboardDisplayS2CPacket", net.minecraft.network.packet.s2c.play.ScoreboardDisplayS2CPacket.class); + S2C_PACKETS.put(net.minecraft.network.packet.s2c.login.LoginSuccessS2CPacket.class, "LoginSuccessS2CPacket"); S2C_PACKETS_R.put("LoginSuccessS2CPacket", net.minecraft.network.packet.s2c.login.LoginSuccessS2CPacket.class); S2C_PACKETS.put(net.minecraft.network.packet.s2c.play.GameMessageS2CPacket.class, "GameMessageS2CPacket"); S2C_PACKETS_R.put("GameMessageS2CPacket", net.minecraft.network.packet.s2c.play.GameMessageS2CPacket.class); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtilsUtil.java b/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtilsUtil.java index d92f229b7f..b909f39487 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtilsUtil.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtilsUtil.java @@ -156,10 +156,18 @@ public Set>>> getKeys() { } """; -// @PostInit + public static void main(String[] args) { + try { + init(); + } + catch (IOException e) { + throw new RuntimeException(e); + } + } + public static void init() throws IOException { // Generate PacketUtils.java - File file = new File(System.getProperty("user.dir") + "/PacketUtils.java"); + File file = new File("src/main/java/" + PacketUtilsUtil.class.getPackageName().replace('.', '/') + "/PacketUtils.java"); if (!file.exists()) { file.getParentFile().mkdirs(); file.createNewFile(); From 701fed4f3eeb80473f4abee89c215c8c3991a932 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Fri, 16 Dec 2022 17:41:45 +0800 Subject: [PATCH 010/135] resolve conflicts --- .../events/world/CollisionShapeEvent.java | 7 +- .../mixin/AbstractBlockMixin.java | 16 --- .../mixin/BlockCollisionSpliteratorMixin.java | 35 ++++++ .../meteorclient/mixin/CactusBlockMixin.java | 32 ----- .../meteorclient/mixin/FluidBlockMixin.java | 31 ----- .../meteorclient/mixin/WorldBorderMixin.java | 27 ++++ .../meteorclient/systems/modules/Modules.java | 2 +- .../systems/modules/movement/SafeWalk.java | 67 +--------- .../systems/modules/world/AntiCactus.java | 15 --- .../systems/modules/world/Collisions.java | 118 ++++++++++++++++++ src/main/resources/meteor-client.mixins.json | 4 +- 11 files changed, 189 insertions(+), 165 deletions(-) create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/BlockCollisionSpliteratorMixin.java delete mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/CactusBlockMixin.java delete mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/FluidBlockMixin.java create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/WorldBorderMixin.java delete mode 100644 src/main/java/meteordevelopment/meteorclient/systems/modules/world/AntiCactus.java create mode 100644 src/main/java/meteordevelopment/meteorclient/systems/modules/world/Collisions.java diff --git a/src/main/java/meteordevelopment/meteorclient/events/world/CollisionShapeEvent.java b/src/main/java/meteordevelopment/meteorclient/events/world/CollisionShapeEvent.java index f34f3a8bec..14d183c0c8 100644 --- a/src/main/java/meteordevelopment/meteorclient/events/world/CollisionShapeEvent.java +++ b/src/main/java/meteordevelopment/meteorclient/events/world/CollisionShapeEvent.java @@ -5,11 +5,12 @@ package meteordevelopment.meteorclient.events.world; +import meteordevelopment.meteorclient.events.Cancellable; import net.minecraft.block.BlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.util.shape.VoxelShape; -public class CollisionShapeEvent { +public class CollisionShapeEvent extends Cancellable { public enum CollisionType { BLOCK, FLUID @@ -22,10 +23,10 @@ public enum CollisionType { public VoxelShape shape; public CollisionType type; - public static CollisionShapeEvent get(BlockState state, BlockPos pos, CollisionType type) { + public static CollisionShapeEvent get(BlockState state, BlockPos pos, VoxelShape shape, CollisionType type) { INSTANCE.state = state; INSTANCE.pos = pos; - INSTANCE.shape = null; + INSTANCE.shape = shape; INSTANCE.type = type; return INSTANCE; } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/AbstractBlockMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/AbstractBlockMixin.java index 5b262cd667..acea24a485 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/AbstractBlockMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/AbstractBlockMixin.java @@ -7,12 +7,9 @@ import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.events.world.AmbientOcclusionEvent; -import meteordevelopment.meteorclient.events.world.CollisionShapeEvent; import net.minecraft.block.AbstractBlock; import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.BlockView; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -27,17 +24,4 @@ private void onGetAmbientOcclusionLightLevel(BlockState state, BlockView world, if (event.lightLevel != -1) info.setReturnValue(event.lightLevel); } - - @Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true) - private void onGetCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context, CallbackInfoReturnable info) { - if (!(state.getFluidState().isEmpty())) { - CollisionShapeEvent event = MeteorClient.EVENT_BUS.post(CollisionShapeEvent.get(state.getFluidState().getBlockState(), pos, CollisionShapeEvent.CollisionType.FLUID)); - - if (event.shape != null) info.setReturnValue(event.shape); - } else { - CollisionShapeEvent event = MeteorClient.EVENT_BUS.post(CollisionShapeEvent.get(state, pos, CollisionShapeEvent.CollisionType.BLOCK)); - - if (event.shape != null) info.setReturnValue(event.shape); - } - } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/BlockCollisionSpliteratorMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/BlockCollisionSpliteratorMixin.java new file mode 100644 index 0000000000..2fc9a0d734 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/BlockCollisionSpliteratorMixin.java @@ -0,0 +1,35 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import meteordevelopment.meteorclient.MeteorClient; +import meteordevelopment.meteorclient.events.world.CollisionShapeEvent; +import net.minecraft.block.BlockState; +import net.minecraft.block.ShapeContext; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.util.shape.VoxelShapes; +import net.minecraft.world.BlockCollisionSpliterator; +import net.minecraft.world.BlockView; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(BlockCollisionSpliterator.class) +public class BlockCollisionSpliteratorMixin { + @Redirect(method = "computeNext", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;getCollisionShape(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/ShapeContext;)Lnet/minecraft/util/shape/VoxelShape;")) + private VoxelShape onComputeNextCollisionBox(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + VoxelShape shape = state.getCollisionShape(world, pos, context); + CollisionShapeEvent event = state.getFluidState().isEmpty() + ? MeteorClient.EVENT_BUS.post(CollisionShapeEvent.get(state, pos, shape, CollisionShapeEvent.CollisionType.BLOCK)) + : MeteorClient.EVENT_BUS.post(CollisionShapeEvent.get(state.getFluidState().getBlockState(), pos, shape, CollisionShapeEvent.CollisionType.FLUID)); + + if (event.isCancelled()) + return VoxelShapes.empty(); + else + return event.shape; + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/CactusBlockMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/CactusBlockMixin.java deleted file mode 100644 index 7014cdba20..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/mixin/CactusBlockMixin.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.mixin; - -import meteordevelopment.meteorclient.systems.modules.Modules; -import meteordevelopment.meteorclient.systems.modules.world.AntiCactus; -import net.minecraft.block.BlockState; -import net.minecraft.block.CactusBlock; -import net.minecraft.block.ShapeContext; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(CactusBlock.class) -public class CactusBlockMixin { - @Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true) - private void onGetCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable info) { - Modules modules = Modules.get(); - - if (modules != null && modules.isActive(AntiCactus.class)) { - info.setReturnValue(VoxelShapes.fullCube()); - } - } -} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/FluidBlockMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/FluidBlockMixin.java deleted file mode 100644 index 8b1407aafd..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/mixin/FluidBlockMixin.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.mixin; - -import meteordevelopment.meteorclient.MeteorClient; -import meteordevelopment.meteorclient.events.world.CollisionShapeEvent; -import net.minecraft.block.*; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(FluidBlock.class) -public abstract class FluidBlockMixin extends Block implements FluidDrainable { - public FluidBlockMixin(Settings settings) { - super(settings); - } - - @Inject(method = "getCollisionShape", at = @At("HEAD"), cancellable = true) - private void onGetCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context, CallbackInfoReturnable info) { - CollisionShapeEvent event = MeteorClient.EVENT_BUS.post(CollisionShapeEvent.get(state, pos, CollisionShapeEvent.CollisionType.FLUID)); - - if (event.shape != null) info.setReturnValue(event.shape); - } -} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/WorldBorderMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/WorldBorderMixin.java new file mode 100644 index 0000000000..e92c975fcd --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/WorldBorderMixin.java @@ -0,0 +1,27 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.world.Collisions; +import net.minecraft.world.border.WorldBorder; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(WorldBorder.class) +public abstract class WorldBorderMixin { + @Inject(method = "canCollide", at = @At("HEAD"), cancellable = true) + private void canCollide(CallbackInfoReturnable info) { + if (Modules.get().get(Collisions.class).ignoreBorder()) info.setReturnValue(false); + } + + @Inject(method = "contains(Lnet/minecraft/util/math/BlockPos;)Z", at = @At("HEAD"), cancellable = true) + private void contains(CallbackInfoReturnable info) { + if (Modules.get().get(Collisions.class).ignoreBorder()) info.setReturnValue(true); + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java index 7894c2b2c8..b30d354da0 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java @@ -521,7 +521,7 @@ private void initRender() { private void initWorld() { add(new AirPlace()); add(new Ambience()); - add(new AntiCactus()); + add(new Collisions()); add(new AutoBreed()); add(new AutoBrewer()); add(new AutoMount()); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/SafeWalk.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/SafeWalk.java index 8db34ac51f..4c0118cf31 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/SafeWalk.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/SafeWalk.java @@ -6,80 +6,17 @@ package meteordevelopment.meteorclient.systems.modules.movement; import meteordevelopment.meteorclient.events.entity.player.ClipAtLedgeEvent; -import meteordevelopment.meteorclient.events.world.CollisionShapeEvent; -import meteordevelopment.meteorclient.settings.BlockListSetting; -import meteordevelopment.meteorclient.settings.BoolSetting; -import meteordevelopment.meteorclient.settings.Setting; -import meteordevelopment.meteorclient.settings.SettingGroup; import meteordevelopment.meteorclient.systems.modules.Categories; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.orbit.EventHandler; -import net.minecraft.block.*; -import net.minecraft.util.shape.VoxelShapes; - -import java.util.List; public class SafeWalk extends Module { - private final SettingGroup sgGeneral = settings.getDefaultGroup(); - - private final Setting ledge = sgGeneral.add(new BoolSetting.Builder() - .name("ledge") - .description("Prevents you from walking of blocks, like pressing shift.") - .defaultValue(true) - .build() - ); - - private final Setting> blocks = sgGeneral.add(new BlockListSetting.Builder() - .name("blocks") - .description("Which blocks to prevent on walking") - .filter(this::blockFilter) - .build() - ); - - private final Setting magma = sgGeneral.add(new BoolSetting.Builder() - .name("magma") - .description("Prevents you from walking over magma blocks.") - .defaultValue(false) - .build() - ); - public SafeWalk() { - super(Categories.Movement, "safe-walk", "Prevents you from walking off blocks or on blocks that you dont want."); + super(Categories.Movement, "safe-walk", "Prevents you from walking off blocks."); } @EventHandler private void onClipAtLedge(ClipAtLedgeEvent event) { - if (!mc.player.isSneaking()) event.setClip(ledge.get()); - } - - @EventHandler - private void onCollisionShape(CollisionShapeEvent event) { - if (mc.world == null || mc.player == null) return; - if (event.type != CollisionShapeEvent.CollisionType.BLOCK) return; - if (blocks.get().contains(event.state.getBlock())) { - event.shape = VoxelShapes.fullCube(); - } - else if (magma.get() && !mc.player.isSneaking() - && event.state.isAir() - && mc.world.getBlockState(event.pos.down()).getBlock() == Blocks.MAGMA_BLOCK) { - event.shape = VoxelShapes.fullCube(); - } - } - - private boolean blockFilter(Block block) { - return (block instanceof AbstractFireBlock - || block instanceof AbstractPressurePlateBlock - || block instanceof TripwireBlock - || block instanceof TripwireHookBlock - || block instanceof CobwebBlock - || block instanceof CampfireBlock - || block instanceof SweetBerryBushBlock - || block instanceof CactusBlock - || block instanceof AbstractRailBlock - || block instanceof TrapdoorBlock - || block instanceof PowderSnowBlock - || block instanceof AbstractCauldronBlock - || block instanceof HoneyBlock - ); + if (!mc.player.isSneaking()) event.setClip(true); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/AntiCactus.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/AntiCactus.java deleted file mode 100644 index 499c06ea22..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/AntiCactus.java +++ /dev/null @@ -1,15 +0,0 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.systems.modules.world; - -import meteordevelopment.meteorclient.systems.modules.Categories; -import meteordevelopment.meteorclient.systems.modules.Module; - -public class AntiCactus extends Module { - public AntiCactus() { - super(Categories.World, "anti-cactus", "Prevents you from taking damage from cacti."); - } -} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Collisions.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Collisions.java new file mode 100644 index 0000000000..d53feaa2b1 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Collisions.java @@ -0,0 +1,118 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.systems.modules.world; + +import meteordevelopment.meteorclient.events.entity.player.PlayerMoveEvent; +import meteordevelopment.meteorclient.events.packets.PacketEvent; +import meteordevelopment.meteorclient.events.world.CollisionShapeEvent; +import meteordevelopment.meteorclient.mixininterface.IVec3d; +import meteordevelopment.meteorclient.settings.BlockListSetting; +import meteordevelopment.meteorclient.settings.BoolSetting; +import meteordevelopment.meteorclient.settings.Setting; +import meteordevelopment.meteorclient.settings.SettingGroup; +import meteordevelopment.meteorclient.systems.modules.Categories; +import meteordevelopment.meteorclient.systems.modules.Module; +import meteordevelopment.orbit.EventHandler; +import net.minecraft.block.*; +import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; +import net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket; +import net.minecraft.util.shape.VoxelShapes; + +import java.util.List; + +public class Collisions extends Module { + private final SettingGroup sgGeneral = settings.getDefaultGroup(); + + public final Setting> blocks = sgGeneral.add(new BlockListSetting.Builder() + .name("blocks") + .description("What blocks should be added collision box.") + .filter(this::blockFilter) + .build() + ); + + private final Setting magma = sgGeneral.add(new BoolSetting.Builder() + .name("magma") + .description("Prevents you from walking over magma blocks.") + .defaultValue(false) + .build() + ); + + private final Setting unloadedChunks = sgGeneral.add(new BoolSetting.Builder() + .name("unloaded-chunks") + .description("Stops you from going into unloaded chunks.") + .defaultValue(false) + .build() + ); + + private final Setting ignoreBorder = sgGeneral.add(new BoolSetting.Builder() + .name("ignore-border") + .description("Removes world border collision.") + .defaultValue(false) + .build() + ); + + public Collisions() { + super(Categories.World, "collisions", "Adds collision boxes to certain blocks/areas."); + } + + @EventHandler + private void onCollisionShape(CollisionShapeEvent event) { + if (mc.world == null || mc.player == null) return; + if (event.type != CollisionShapeEvent.CollisionType.BLOCK) return; + if (blocks.get().contains(event.state.getBlock())) { + event.shape = VoxelShapes.fullCube(); + } else if (magma.get() && !mc.player.isSneaking() + && event.state.isAir() + && mc.world.getBlockState(event.pos.down()).getBlock() == Blocks.MAGMA_BLOCK) { + event.shape = VoxelShapes.fullCube(); + } + } + + @EventHandler + private void onPlayerMove(PlayerMoveEvent event) { + int x = (int) (mc.player.getX() + event.movement.x) >> 4; + int z = (int) (mc.player.getZ() + event.movement.z) >> 4; + if (unloadedChunks.get() && !mc.world.getChunkManager().isChunkLoaded(x, z)) { + ((IVec3d) event.movement).set(0, event.movement.y, 0); + } + } + + @EventHandler + private void onPacketSend(PacketEvent.Send event) { + if (!unloadedChunks.get()) return; + if (event.packet instanceof VehicleMoveC2SPacket packet) { + if (!mc.world.getChunkManager().isChunkLoaded((int) packet.getX() >> 4, (int) packet.getZ() >> 4)) { + mc.player.getVehicle().updatePosition(mc.player.getVehicle().prevX, mc.player.getVehicle().prevY, mc.player.getVehicle().prevZ); + event.cancel(); + } + } else if (event.packet instanceof PlayerMoveC2SPacket packet) { + if (!mc.world.getChunkManager().isChunkLoaded((int) packet.getX(mc.player.getX()) >> 4, (int) packet.getZ(mc.player.getZ()) >> 4)) { + event.cancel(); + } + } + } + + private boolean blockFilter(Block block) { + return (block instanceof AbstractFireBlock + || block instanceof AbstractPressurePlateBlock + || block instanceof TripwireBlock + || block instanceof TripwireHookBlock + || block instanceof CobwebBlock + || block instanceof CampfireBlock + || block instanceof SweetBerryBushBlock + || block instanceof CactusBlock + || block instanceof AbstractRailBlock + || block instanceof TrapdoorBlock + || block instanceof PowderSnowBlock + || block instanceof AbstractCauldronBlock + || block instanceof HoneyBlock + ); + } + + public boolean ignoreBorder() { + return isActive() && ignoreBorder.get(); + } +} diff --git a/src/main/resources/meteor-client.mixins.json b/src/main/resources/meteor-client.mixins.json index 78d8a73cb9..d530d323f4 100644 --- a/src/main/resources/meteor-client.mixins.json +++ b/src/main/resources/meteor-client.mixins.json @@ -16,6 +16,7 @@ "BannerBlockEntityRendererMixin", "BeaconScreenMixin", "BiomeColorsMixin", + "BlockCollisionSpliteratorMixin", "BlockEntityRenderDispatcherMixin", "BlockEntityTypeAccessor", "BlockHitResultAccessor", @@ -32,7 +33,6 @@ "BrewingStandScreenMixin", "BufferBuilderAccessor", "BufferRendererAccessor", - "CactusBlockMixin", "CameraMixin", "CapabilityTrackerMixin", "ChatHudAccessor", @@ -79,7 +79,6 @@ "FireworkRocketEntityMixin", "FireworksSparkParticleMixin", "FireworksSparkParticleSubMixin", - "FluidBlockMixin", "FluidRendererMixin", "FoliageColorsMixin", "GameOptionsMixin", @@ -153,6 +152,7 @@ "Vec3dMixin", "VertexBufferMixin", "WorldAccessor", + "WorldBorderMixin", "WorldChunkMixin", "WorldRendererAccessor", "WorldRendererMixin" From 666531848bac6bc6aa570f674fb872178eda39cf Mon Sep 17 00:00:00 2001 From: MineGame159 Date: Sat, 17 Dec 2022 13:42:36 +0100 Subject: [PATCH 011/135] Exclude slf4j-api from the built jar, fixes Quilt compatibility --- build.gradle | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build.gradle b/build.gradle index edcb798a11..1d3495bfc2 100644 --- a/build.gradle +++ b/build.gradle @@ -83,6 +83,12 @@ afterEvaluate { shadowJar { configurations = [ project.configurations.shadow ] + + dependencies { + exclude { + it.moduleGroup == "org.slf4j" + } + } } processResources { From 1a32c528d5dd43266fce167505c0c530715a46fc Mon Sep 17 00:00:00 2001 From: Cr7mbl3 <24521103+Cr7mbl3@users.noreply.github.com> Date: Mon, 19 Dec 2022 06:58:48 +0100 Subject: [PATCH 012/135] fix lag when adding friends --- .../meteorclient/gui/tabs/builtin/FriendsTab.java | 9 +++++++++ .../meteorclient/systems/friends/Friend.java | 15 +++++++++++---- .../meteorclient/systems/friends/Friends.java | 3 +++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/gui/tabs/builtin/FriendsTab.java b/src/main/java/meteordevelopment/meteorclient/gui/tabs/builtin/FriendsTab.java index c326c98a66..b5c1c305ec 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/tabs/builtin/FriendsTab.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/tabs/builtin/FriendsTab.java @@ -76,6 +76,15 @@ private void initTable(WTable table) { table.clear(); if (Friends.get().isEmpty()) return; + Friends.get().forEach(friend -> + MeteorExecutor.execute(() -> { + if (friend.headTextureNeedsUpdate()) { + friend.updateInfo(); + reload(); + } + }) + ); + for (Friend friend : Friends.get()) { table.add(theme.texture(32, 32, friend.getHead().needsRotate() ? 90 : 0, friend.getHead())); table.add(theme.label(friend.getName())); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/friends/Friend.java b/src/main/java/meteordevelopment/meteorclient/systems/friends/Friend.java index e8f591f7e0..5b6187301f 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/friends/Friend.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/friends/Friend.java @@ -19,14 +19,15 @@ import java.util.UUID; public class Friend implements ISerializable, Comparable { - public String name; - private @Nullable UUID id; - private @Nullable PlayerHeadTexture headTexture; + public volatile String name; + private volatile @Nullable UUID id; + private volatile @Nullable PlayerHeadTexture headTexture; + private volatile boolean updating; public Friend(String name, @Nullable UUID id) { this.name = name; this.id = id; - this.headTexture = PlayerHeadUtils.fetchHead(id); + this.headTexture = null; } public Friend(PlayerEntity player) { @@ -45,11 +46,17 @@ public PlayerHeadTexture getHead() { } public void updateInfo() { + updating = true; APIResponse res = Http.get("https://api.mojang.com/users/profiles/minecraft/" + name).sendJson(APIResponse.class); if (res == null || res.name == null || res.id == null) return; name = res.name; id = UUIDTypeAdapter.fromString(res.id); headTexture = PlayerHeadUtils.fetchHead(id); + updating = false; + } + + public boolean headTextureNeedsUpdate() { + return !this.updating && headTexture == null; } @Override diff --git a/src/main/java/meteordevelopment/meteorclient/systems/friends/Friends.java b/src/main/java/meteordevelopment/meteorclient/systems/friends/Friends.java index 065b464739..3bd7768469 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/friends/Friends.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/friends/Friends.java @@ -9,6 +9,7 @@ import meteordevelopment.meteorclient.systems.System; import meteordevelopment.meteorclient.systems.Systems; import meteordevelopment.meteorclient.utils.misc.NbtUtils; +import meteordevelopment.meteorclient.utils.network.MeteorExecutor; import net.minecraft.client.network.PlayerListEntry; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.nbt.NbtCompound; @@ -126,6 +127,8 @@ public Friends fromTag(NbtCompound tag) { Collections.sort(friends); + MeteorExecutor.execute(() -> friends.forEach(Friend::updateInfo)); + return this; } } From 8db58dfe2285cee7618437f1ba9ac3e473e2153d Mon Sep 17 00:00:00 2001 From: SodaXwX <62250232+ThebestkillerTBK@users.noreply.github.com> Date: Tue, 20 Dec 2022 02:31:37 +0800 Subject: [PATCH 013/135] Changes sendMessage mixin location (#3070), fixes macros using Meteor's commands --- .../meteorclient/mixin/ChatScreenMixin.java | 43 ------------------- .../mixin/ClientPlayNetworkHandlerMixin.java | 41 ++++++++++++++++++ 2 files changed, 41 insertions(+), 43 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ChatScreenMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ChatScreenMixin.java index a3b9597079..c2463e8fd8 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ChatScreenMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ChatScreenMixin.java @@ -5,65 +5,22 @@ package meteordevelopment.meteorclient.mixin; -import baritone.api.BaritoneAPI; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import meteordevelopment.meteorclient.MeteorClient; -import meteordevelopment.meteorclient.events.game.SendMessageEvent; -import meteordevelopment.meteorclient.systems.commands.Commands; -import meteordevelopment.meteorclient.systems.config.Config; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.misc.BetterChat; -import meteordevelopment.meteorclient.utils.player.ChatUtils; -import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.ChatScreen; import net.minecraft.client.gui.widget.TextFieldWidget; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(ChatScreen.class) public abstract class ChatScreenMixin { @Shadow protected TextFieldWidget chatField; - @Shadow public abstract boolean sendMessage(String chatText, boolean addToHistory); - - @Unique private boolean ignoreChatMessage; - @Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/TextFieldWidget;setMaxLength(I)V", shift = At.Shift.AFTER)) private void onInit(CallbackInfo info) { if (Modules.get().get(BetterChat.class).isInfiniteChatBox()) chatField.setMaxLength(Integer.MAX_VALUE); } - - @Inject(method = "sendMessage", at = @At("HEAD"), cancellable = true) - private void onSendChatMessage(String message, boolean addToHistory, CallbackInfoReturnable info) { - if (ignoreChatMessage) return; - - if (!message.startsWith(Config.get().prefix.get()) && !message.startsWith("/") && !message.startsWith(BaritoneAPI.getSettings().prefix.value)) { - SendMessageEvent event = MeteorClient.EVENT_BUS.post(SendMessageEvent.get(message)); - - if (!event.isCancelled()) { - ignoreChatMessage = true; - sendMessage(event.message, addToHistory); - ignoreChatMessage = false; - } - - info.setReturnValue(true); - return; - } - - if (message.startsWith(Config.get().prefix.get())) { - try { - Commands.get().dispatch(message.substring(Config.get().prefix.get().length())); - } catch (CommandSyntaxException e) { - ChatUtils.error(e.getMessage()); - } - - MinecraftClient.getInstance().inGameHud.getChatHud().addToMessageHistory(message); - info.setReturnValue(true); - } - } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayNetworkHandlerMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayNetworkHandlerMixin.java index 984cc324f5..1883835fd5 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayNetworkHandlerMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayNetworkHandlerMixin.java @@ -5,19 +5,25 @@ package meteordevelopment.meteorclient.mixin; +import baritone.api.BaritoneAPI; +import com.mojang.brigadier.exceptions.CommandSyntaxException; import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.events.entity.EntityDestroyEvent; import meteordevelopment.meteorclient.events.entity.player.PickItemsEvent; import meteordevelopment.meteorclient.events.game.GameJoinedEvent; import meteordevelopment.meteorclient.events.game.GameLeftEvent; +import meteordevelopment.meteorclient.events.game.SendMessageEvent; import meteordevelopment.meteorclient.events.packets.ContainerSlotUpdateEvent; import meteordevelopment.meteorclient.events.packets.InventoryEvent; import meteordevelopment.meteorclient.events.packets.PlaySoundPacketEvent; import meteordevelopment.meteorclient.events.world.ChunkDataEvent; import meteordevelopment.meteorclient.mixininterface.IExplosionS2CPacket; +import meteordevelopment.meteorclient.systems.commands.Commands; +import meteordevelopment.meteorclient.systems.config.Config; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.movement.Velocity; import meteordevelopment.meteorclient.systems.modules.render.NoRender; +import meteordevelopment.meteorclient.utils.player.ChatUtils; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.world.ClientWorld; @@ -28,6 +34,7 @@ import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -40,6 +47,12 @@ public abstract class ClientPlayNetworkHandlerMixin { @Shadow private ClientWorld world; + @Shadow + public abstract void sendChatMessage(String content); + + @Unique + private boolean ignoreChatMessage; + private boolean worldNotNull; @Inject(method = "onEntitySpawn", at = @At("HEAD"), cancellable = true) @@ -112,4 +125,32 @@ private void onItemPickupAnimation(ItemPickupAnimationS2CPacket packet, Callback MeteorClient.EVENT_BUS.post(PickItemsEvent.get(((ItemEntity) itemEntity).getStack(), packet.getStackAmount())); } } + + @Inject(method = "sendChatMessage", at = @At("HEAD"), cancellable = true) + private void onSendChatMessage(String message, CallbackInfo ci) { + if (ignoreChatMessage) return; + + if (!message.startsWith(Config.get().prefix.get()) && !message.startsWith(BaritoneAPI.getSettings().prefix.value)) { + SendMessageEvent event = MeteorClient.EVENT_BUS.post(SendMessageEvent.get(message)); + + if (!event.isCancelled()) { + ignoreChatMessage = true; + sendChatMessage(event.message); + ignoreChatMessage = false; + } + ci.cancel(); + return; + } + + if (message.startsWith(Config.get().prefix.get())) { + try { + Commands.get().dispatch(message.substring(Config.get().prefix.get().length())); + } catch (CommandSyntaxException e) { + ChatUtils.error(e.getMessage()); + } + + client.inGameHud.getChatHud().addToMessageHistory(message); + ci.cancel(); + } + } } From f2652a60935404159007f9ca234efedc93c614e5 Mon Sep 17 00:00:00 2001 From: RacoonDog <32882447+RacoonDog@users.noreply.github.com> Date: Mon, 19 Dec 2022 20:01:37 -0500 Subject: [PATCH 014/135] HoleFiller hotfix --- .../meteorclient/systems/modules/combat/HoleFiller.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/HoleFiller.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/HoleFiller.java index 7f724705b4..bfe8c081f6 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/HoleFiller.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/HoleFiller.java @@ -400,7 +400,7 @@ else if (predict.get()) { } double i = testVec.x - (pos.getX() + 0.5); - double j = testVec.y - (pos.getX() + ((feet) ? 1 : 0.5)); + double j = testVec.y - (pos.getY() + ((feet) ? 1 : 0.5)); double k = testVec.z - (pos.getZ() + 0.5); return (Math.sqrt(i * i + j * j + k * k)); From d31695de1374f50cb2cf3e9e6271d17140fe5232 Mon Sep 17 00:00:00 2001 From: Based Ricky <80427814+RickyTheRacc@users.noreply.github.com> Date: Wed, 21 Dec 2022 09:28:21 -0600 Subject: [PATCH 015/135] Merge EntityUtils.getCityBlock and EntityUtils.getSurroundBlock utils and correct error message for AutoCity (#3084) --- .../systems/modules/combat/AutoCity.java | 2 +- .../utils/entity/EntityUtils.java | 59 ++++++------------- 2 files changed, 18 insertions(+), 43 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/AutoCity.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/AutoCity.java index d8d61fe404..c100c99bcd 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/AutoCity.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/AutoCity.java @@ -151,7 +151,7 @@ public void onActivate() { targetPos = EntityUtils.getCityBlock(target); if (targetPos == null || PlayerUtils.distanceTo(targetPos) > breakRange.get()) { - if (chatInfo.get()) error("Couldn't find a target, disabling."); + if (chatInfo.get()) error("Couldn't find a good block, disabling."); toggle(); return; } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/entity/EntityUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/entity/EntityUtils.java index 7c309fd86e..42e8d0df08 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/entity/EntityUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/entity/EntityUtils.java @@ -27,6 +27,7 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluids; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.minecraft.util.math.ChunkSectionPos; @@ -38,14 +39,15 @@ import net.minecraft.world.entity.SimpleEntityLookup; import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.List; +import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.Predicate; import static meteordevelopment.meteorclient.MeteorClient.mc; public class EntityUtils { + private static BlockPos.Mutable testPos = new BlockPos.Mutable(); + public static boolean isAttackable(EntityType type) { return type != EntityType.AREA_EFFECT_CLOUD && type != EntityType.ARROW && type != EntityType.FALLING_BLOCK && type != EntityType.FIREWORK_ROCKET && type != EntityType.ITEM && type != EntityType.LLAMA_SPIT && type != EntityType.SPECTRAL_ARROW && type != EntityType.ENDER_PEARL && type != EntityType.EXPERIENCE_BOTTLE && type != EntityType.POTION && type != EntityType.TRIDENT && type != EntityType.LIGHTNING_BOLT && type != EntityType.FISHING_BOBBER && type != EntityType.EXPERIENCE_ORB && type != EntityType.EGG; } @@ -111,55 +113,28 @@ public static boolean isInRenderDistance(double posX, double posZ) { return x < d && z < d; } - public static List getSurroundBlocks(PlayerEntity player) { + public static BlockPos getCityBlock(PlayerEntity player) { if (player == null) return null; - BlockPos.Mutable testPos = new BlockPos.Mutable(); - List positions = new ArrayList<>(); + double bestDistance = 6; + Direction bestDirection = null; for (Direction direction : Direction.HORIZONTAL) { - testPos.set(player.getBlockPos()).offset(direction); - - if (mc.world.getBlockState(testPos).getBlock() == Blocks.OBSIDIAN) { - positions.add(testPos); - } - } - - return positions; - } - - @Nullable - public static BlockPos getCityBlock(PlayerEntity player) { - BlockPos bestPos = null; - int bestScore = 0; - BlockPos.Mutable testPos = new BlockPos.Mutable(); - - for (BlockPos pos : getSurroundBlocks(player)) { - int score = 1; - - for (Direction direction : Direction.values()) { - testPos.set(pos).offset(direction); - Block block = mc.world.getBlockState(testPos).getBlock(); - - if (direction == Direction.DOWN && block == Blocks.OBSIDIAN || block == Blocks.BEDROCK) { - score+= 2; - continue; - } - - if (direction != Direction.DOWN && block instanceof AirBlock) { - score++; - } - } + testPos.set(player.getBlockPos().offset(direction)); - score -= PlayerUtils.distanceTo(pos); + Block block = mc.world.getBlockState(testPos).getBlock(); + if (block != Blocks.OBSIDIAN && block != Blocks.NETHERITE_BLOCK && block != Blocks.CRYING_OBSIDIAN + && block != Blocks.RESPAWN_ANCHOR && block != Blocks.ANCIENT_DEBRIS) continue; - if (score >= bestScore) { - bestPos = pos; - bestScore = score; + double testDistance = PlayerUtils.distanceTo(testPos); + if (testDistance < bestDistance) { + bestDistance = testDistance; + bestDirection = direction; } } - return bestPos; + if (bestDirection == null) return null; + return player.getBlockPos().offset(bestDirection); } public static String getName(Entity entity) { From 8722ef565afa02ca4b6d9710a20fc9fcfd97bf05 Mon Sep 17 00:00:00 2001 From: Based Ricky <80427814+RickyTheRacc@users.noreply.github.com> Date: Wed, 21 Dec 2022 14:55:29 -0600 Subject: [PATCH 016/135] KillAura Improvements (#3085) --- .../systems/modules/combat/CrystalAura.java | 7 +- .../systems/modules/combat/KillAura.java | 293 ++++++++++-------- 2 files changed, 163 insertions(+), 137 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/CrystalAura.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/CrystalAura.java index 3095613ec5..52d1c9749b 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/CrystalAura.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/CrystalAura.java @@ -150,7 +150,7 @@ public class CrystalAura extends Module { .build() ); - private final Setting placeDelay = sgPlace.add(new IntSetting.Builder() + public final Setting placeDelay = sgPlace.add(new IntSetting.Builder() .name("place-delay") .description("The delay in ticks to wait to place a crystal after it's exploded.") .defaultValue(0) @@ -464,6 +464,7 @@ public class CrystalAura extends Module { private final IntSet placedCrystals = new IntOpenHashSet(); private boolean placing; private int placingTimer; + public int kaTimer; private final BlockPos.Mutable placingCrystalBlockPos = new BlockPos.Mutable(); private final IntSet removed = new IntOpenHashSet(); @@ -502,6 +503,7 @@ public void onActivate() { placing = false; placingTimer = 0; + kaTimer = 0; attacks = 0; @@ -546,6 +548,8 @@ private void onPreTick(TickEvent.Pre event) { else placing = false; } + if (kaTimer > 0) kaTimer--; + if (ticksPassed < 20) ticksPassed++; else { ticksPassed = 0; @@ -921,6 +925,7 @@ private void placeCrystal(BlockHitResult result, double damage, BlockPos support placing = true; placingTimer = 4; + kaTimer = 8; placingCrystalBlockPos.set(result.getBlockPos()).move(0, 1, 0); renderTimer = renderTime.get(); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/KillAura.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/KillAura.java index 6f71199012..3a2da61550 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/KillAura.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/KillAura.java @@ -9,10 +9,12 @@ import it.unimi.dsi.fastutil.objects.Object2BooleanMap; import meteordevelopment.meteorclient.events.packets.PacketEvent; import meteordevelopment.meteorclient.events.world.TickEvent; +import meteordevelopment.meteorclient.mixininterface.IVec3d; import meteordevelopment.meteorclient.settings.*; import meteordevelopment.meteorclient.systems.friends.Friends; import meteordevelopment.meteorclient.systems.modules.Categories; import meteordevelopment.meteorclient.systems.modules.Module; +import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.utils.entity.EntityUtils; import meteordevelopment.meteorclient.utils.entity.SortPriority; import meteordevelopment.meteorclient.utils.entity.Target; @@ -21,6 +23,7 @@ import meteordevelopment.meteorclient.utils.player.InvUtils; import meteordevelopment.meteorclient.utils.player.PlayerUtils; import meteordevelopment.meteorclient.utils.player.Rotations; +import meteordevelopment.meteorclient.utils.world.TickRate; import meteordevelopment.orbit.EventHandler; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; @@ -30,13 +33,15 @@ import net.minecraft.entity.mob.EndermanEntity; import net.minecraft.entity.mob.ZombifiedPiglinEntity; import net.minecraft.entity.passive.AnimalEntity; +import net.minecraft.entity.passive.LlamaEntity; import net.minecraft.entity.passive.WolfEntity; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.AxeItem; -import net.minecraft.item.Item; -import net.minecraft.item.SwordItem; +import net.minecraft.item.*; import net.minecraft.network.packet.c2s.play.UpdateSelectedSlotC2SPacket; import net.minecraft.util.Hand; +import net.minecraft.util.math.Box; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.GameMode; import java.util.ArrayList; @@ -45,7 +50,7 @@ public class KillAura extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); private final SettingGroup sgTargeting = settings.createGroup("Targeting"); - private final SettingGroup sgDelay = settings.createGroup("Delay"); + private final SettingGroup sgTiming = settings.createGroup("Timing"); // General @@ -56,6 +61,13 @@ public class KillAura extends Module { .build() ); + private final Setting rotation = sgGeneral.add(new EnumSetting.Builder() + .name("rotate") + .description("Determines when you should rotate towards the target.") + .defaultValue(RotationMode.Always) + .build() + ); + private final Setting autoSwitch = sgGeneral.add(new BoolSetting.Builder() .name("auto-switch") .description("Switches to your selected weapon when attacking the target.") @@ -70,72 +82,52 @@ public class KillAura extends Module { .build() ); - private final Setting onlyWhenLook = sgGeneral.add(new BoolSetting.Builder() - .name("only-when-look") - .description("Only attacks when you are looking at the entity.") + private final Setting onlyOnLook = sgGeneral.add(new BoolSetting.Builder() + .name("only-on-look") + .description("Only attacks when looking at an entity.") .defaultValue(false) .build() ); - private final Setting randomTeleport = sgGeneral.add(new BoolSetting.Builder() - .name("random-teleport") - .description("Randomly teleport around the target.") - .defaultValue(false) - .visible(() -> !onlyWhenLook.get()) - .build() - ); - - private final Setting rotation = sgGeneral.add(new EnumSetting.Builder() - .name("rotate") - .description("Determines when you should rotate towards the target.") - .defaultValue(RotationMode.Always) - .build() - ); - - private final Setting hitChance = sgGeneral.add(new DoubleSetting.Builder() - .name("hit-chance") - .description("The probability of your hits landing.") - .defaultValue(100) - .range(1, 100) - .sliderRange(1, 100) - .build() - ); - private final Setting pauseOnCombat = sgGeneral.add(new BoolSetting.Builder() - .name("pause-on-combat") + .name("pause-baritone") .description("Freezes Baritone temporarily until you are finished attacking the entity.") .defaultValue(true) .build() ); - private final Setting noRightClick = sgGeneral.add(new BoolSetting.Builder() - .name("pause-on-use") - .description("Does not attack if using an item.") - .defaultValue(true) + private final Setting shieldMode = sgGeneral.add(new EnumSetting.Builder() + .name("shield-mode") + .description("Will try and use an axe to break target shields.") + .defaultValue(ShieldMode.Break) + .visible(() -> autoSwitch.get() && weapon.get() != Weapon.Axe) .build() ); // Targeting - private final Setting ignorePassive = sgGeneral.add(new BoolSetting.Builder() - .name("ignore-passive") - .description("Will only attack sometimes passive mobs if they are targeting you.") - .defaultValue(true) + private final Setting>> entities = sgTargeting.add(new EntityTypeListSetting.Builder() + .name("entities") + .description("Entities to attack.") + .onlyAttackable() + .defaultValue(EntityType.PLAYER) .build() ); - private final Setting ignoreTamed = sgGeneral.add(new BoolSetting.Builder() - .name("ignore-tamed") - .description("Will avoid attacking mobs you tamed.") - .defaultValue(false) + private final Setting priority = sgTargeting.add(new EnumSetting.Builder() + .name("priority") + .description("How to filter targets within range.") + .defaultValue(SortPriority.ClosestAngle) .build() ); - - private final Setting>> entities = sgTargeting.add(new EntityTypeListSetting.Builder() - .name("entities") - .description("Entities to attack.") - .onlyAttackable() + private final Setting maxTargets = sgTargeting.add(new IntSetting.Builder() + .name("max-targets") + .description("How many entities to target at once.") + .defaultValue(1) + .min(1) + .sliderRange(1, 5) + .visible(() -> !onlyOnLook.get()) .build() ); @@ -157,90 +149,94 @@ public class KillAura extends Module { .build() ); - private final Setting priority = sgTargeting.add(new EnumSetting.Builder() - .name("priority") - .description("How to filter targets within range.") - .defaultValue(SortPriority.LowestHealth) + private final Setting ignoreBabies = sgTargeting.add(new BoolSetting.Builder() + .name("ignore-babies") + .description("Whether or not to attack baby variants of the entity.") + .defaultValue(true) .build() ); - private final Setting maxTargets = sgTargeting.add(new IntSetting.Builder() - .name("max-targets") - .description("How many entities to target at once.") - .defaultValue(1) - .min(1) - .sliderRange(1, 5) + private final Setting ignoreNamed = sgTargeting.add(new BoolSetting.Builder() + .name("ignore-named") + .description("Whether or not to attack mobs with a name.") + .defaultValue(false) .build() ); - private final Setting babies = sgTargeting.add(new BoolSetting.Builder() - .name("babies") - .description("Whether or not to attack baby variants of the entity.") + private final Setting ignorePassive = sgTargeting.add(new BoolSetting.Builder() + .name("ignore-passive") + .description("Will only attack sometimes passive mobs if they are targeting you.") .defaultValue(true) .build() ); - private final Setting nametagged = sgTargeting.add(new BoolSetting.Builder() - .name("nametagged") - .description("Whether or not to attack mobs with a name tag.") + private final Setting ignoreTamed = sgTargeting.add(new BoolSetting.Builder() + .name("ignore-tamed") + .description("Will avoid attacking mobs you tamed.") .defaultValue(false) .build() ); - private final Setting ignoreShield = sgGeneral.add(new BoolSetting.Builder() - .name("ignore-shield") - .description("Attacks only if the blow is not blocked by a shield.") + // Timing + + private final Setting pauseOnLag = sgTiming.add(new BoolSetting.Builder() + .name("pause-on-lag") + .description("Pauses if the server is lagging.") .defaultValue(true) .build() ); - // Delay + private final Setting pauseOnUse = sgTiming.add(new BoolSetting.Builder() + .name("pause-on-use") + .description("Does not attack while using an item.") + .defaultValue(false) + .build() + ); - private final Setting smartDelay = sgDelay.add(new BoolSetting.Builder() - .name("smart-delay") - .description("Uses the vanilla cooldown to attack entities.") + private final Setting pauseOnCA = sgTiming.add(new BoolSetting.Builder() + .name("pause-on-CA") + .description("Does not attack while CA is placing.") .defaultValue(true) .build() ); - private final Setting hitDelay = sgDelay.add(new IntSetting.Builder() - .name("hit-delay") - .description("How fast you hit the entity in ticks.") - .defaultValue(0) - .min(0) - .sliderMax(60) - .visible(() -> !smartDelay.get()) + private final Setting tpsSync = sgTiming.add(new BoolSetting.Builder() + .name("TPS-sync") + .description("Tries to sync attack delay with the server's TPS.") + .defaultValue(true) .build() ); - private final Setting randomDelayEnabled = sgDelay.add(new BoolSetting.Builder() - .name("random-delay-enabled") - .description("Adds a random delay between hits to attempt to bypass anti-cheats.") + private final Setting customDelay = sgTiming.add(new BoolSetting.Builder() + .name("custom-delay") + .description("Use a custom delay instead of the vanilla cooldown.") .defaultValue(false) - .visible(() -> !smartDelay.get()) .build() ); - private final Setting randomDelayMax = sgDelay.add(new IntSetting.Builder() - .name("random-delay-max") - .description("The maximum value for random delay.") - .defaultValue(4) + private final Setting hitDelay = sgTiming.add(new IntSetting.Builder() + .name("hit-delay") + .description("How fast you hit the entity in ticks.") + .defaultValue(11) .min(0) - .sliderMax(20) - .visible(() -> randomDelayEnabled.get() && !smartDelay.get()) + .sliderMax(60) + .visible(customDelay::get) .build() ); - private final Setting switchDelay = sgDelay.add(new IntSetting.Builder() + private final Setting switchDelay = sgTiming.add(new IntSetting.Builder() .name("switch-delay") .description("How many ticks to wait before hitting an entity after switching hotbar slots.") .defaultValue(0) .min(0) + .sliderMax(10) .build() ); + CrystalAura ca = Modules.get().get(CrystalAura.class); private final List targets = new ArrayList<>(); - private int hitDelayTimer, switchTimer; + private final Vec3d hitVec = new Vec3d(0, 0, 0); + private int switchTimer, hitTimer; private boolean wasPathing = false; public KillAura() { @@ -249,15 +245,29 @@ public KillAura() { @Override public void onDeactivate() { - hitDelayTimer = 0; targets.clear(); } @EventHandler private void onTick(TickEvent.Pre event) { if (!mc.player.isAlive() || PlayerUtils.getGameMode() == GameMode.SPECTATOR) return; + if (pauseOnUse.get() && (mc.interactionManager.isBreakingBlock() || mc.player.isUsingItem())) return; + if (onlyOnClick.get() && !mc.options.attackKey.isPressed()) return; + if (TickRate.INSTANCE.getTimeSinceLastTick() >= 1f && pauseOnLag.get()) return; + if (pauseOnCA.get() && ca.isActive() && ca.kaTimer > 0) return; + + if (onlyOnLook.get()) { + Entity targeted = mc.targetedEntity; - TargetUtils.getList(targets, this::entityCheck, priority.get(), maxTargets.get()); + if (targeted == null) return; + if (!entityCheck(targeted)) return; + + targets.clear(); + targets.add(mc.targetedEntity); + } else { + targets.clear(); + TargetUtils.getList(targets, this::entityCheck, priority.get(), maxTargets.get()); + } if (targets.isEmpty()) { if (wasPathing) { @@ -269,20 +279,6 @@ private void onTick(TickEvent.Pre event) { Entity primary = targets.get(0); - if (rotation.get() == RotationMode.Always) rotate(primary, null); - - if (onlyOnClick.get() && !mc.options.attackKey.isPressed()) return; - - if (onlyWhenLook.get()) { - primary = mc.targetedEntity; - - if (primary == null) return; - if (!entityCheck(primary)) return; - - targets.clear(); - targets.add(primary); - } - if (autoSwitch.get()) { FindItemResult weaponResult = InvUtils.findInHotbar(itemStack -> { Item item = itemStack.getItem(); @@ -295,21 +291,30 @@ private void onTick(TickEvent.Pre event) { }; }); + if (shouldShieldBreak()) { + FindItemResult axeResult = InvUtils.findInHotbar(itemStack -> itemStack.getItem() instanceof AxeItem); + if (axeResult.found()) weaponResult = axeResult; + } + InvUtils.swap(weaponResult.slot(), false); } if (!itemInHand()) return; + Box hitbox = primary.getBoundingBox(); + ((IVec3d) hitVec).set( + MathHelper.clamp(mc.player.getX(), hitbox.minX, hitbox.maxX), + MathHelper.clamp(mc.player.getY(), hitbox.minY, hitbox.maxY), + MathHelper.clamp(mc.player.getZ(), hitbox.minZ, hitbox.maxZ) + ); + + if (rotation.get() == RotationMode.Always) Rotations.rotate(Rotations.getYaw(primary), Rotations.getPitch(primary, Target.Body)); if (pauseOnCombat.get() && BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().isPathing() && !wasPathing) { BaritoneAPI.getProvider().getPrimaryBaritone().getCommandManager().execute("pause"); wasPathing = true; } if (delayCheck()) targets.forEach(this::attack); - - if (randomTeleport.get() && !onlyWhenLook.get()) { - mc.player.setPosition(primary.getX() + randomOffset(), primary.getY(), primary.getZ() + randomOffset()); - } } @EventHandler @@ -319,17 +324,32 @@ private void onSendPacket(PacketEvent.Send event) { } } - private double randomOffset() { - return Math.random() * 4 - 2; + private boolean shouldShieldBreak() { + for (Entity target : targets) { + if (target instanceof PlayerEntity player) { + if (player.blockedByShield(DamageSource.player(mc.player)) && shieldMode.get() == ShieldMode.Break) { + return true; + } + } + } + + return false; } private boolean entityCheck(Entity entity) { if (entity.equals(mc.player) || entity.equals(mc.cameraEntity)) return false; if ((entity instanceof LivingEntity && ((LivingEntity) entity).isDead()) || !entity.isAlive()) return false; - if (noRightClick.get() && (mc.interactionManager.isBreakingBlock() || mc.player.isUsingItem())) return false; - if (!PlayerUtils.isWithin(entity, range.get())) return false; + + Box hitbox = entity.getBoundingBox(); + ((IVec3d)hitVec).set( + MathHelper.clamp(mc.player.getX(), hitbox.minX, hitbox.maxX), + MathHelper.clamp(mc.player.getY(), hitbox.minY, hitbox.maxY), + MathHelper.clamp(mc.player.getZ(), hitbox.minZ, hitbox.maxZ) + ); + if (!PlayerUtils.isWithin(hitVec, range.get())) return false; + if (!entities.get().getBoolean(entity.getType())) return false; - if (!nametagged.get() && entity.hasCustomName()) return false; + if (ignoreNamed.get() && entity.hasCustomName()) return false; if (!PlayerUtils.canSeeEntity(entity) && !PlayerUtils.isWithin(entity, wallsRange.get())) return false; if (ignoreTamed.get()) { if (entity instanceof Tameable tameable @@ -341,13 +361,14 @@ private boolean entityCheck(Entity entity) { if (entity instanceof EndermanEntity enderman && !enderman.isAngryAt(mc.player)) return false; if (entity instanceof ZombifiedPiglinEntity piglin && !piglin.isAngryAt(mc.player)) return false; if (entity instanceof WolfEntity wolf && !wolf.isAttacking()) return false; + if (entity instanceof LlamaEntity llama && !llama.isAttacking()) return false; } if (entity instanceof PlayerEntity player) { if (player.isCreative()) return false; if (!Friends.get().shouldAttack(player)) return false; - if (ignoreShield.get() && player.blockedByShield(DamageSource.player(mc.player))) return false; + if (shieldMode.get() == ShieldMode.Ignore && player.blockedByShield(DamageSource.player(mc.player))) return false; } - return !(entity instanceof AnimalEntity animal) || babies.get() || !animal.isBaby(); + return !(entity instanceof AnimalEntity animal) || !ignoreBabies.get() || !animal.isBaby(); } private boolean delayCheck() { @@ -356,35 +377,29 @@ private boolean delayCheck() { return false; } - if (smartDelay.get()) return mc.player.getAttackCooldownProgress(0.5f) >= 1; + float delay = (customDelay.get()) ? hitDelay.get() : 0.5f; + if (tpsSync.get()) delay /= (TickRate.INSTANCE.getTickRate() / 20); - if (hitDelayTimer > 0) { - hitDelayTimer--; - return false; - } else { - hitDelayTimer = hitDelay.get(); - if (randomDelayEnabled.get()) hitDelayTimer += Math.round(Math.random() * randomDelayMax.get()); - return true; - } + if (customDelay.get()) { + if (hitTimer < delay) { + hitTimer++; + return false; + } else return true; + } else return mc.player.getAttackCooldownProgress(delay) >= 1; } private void attack(Entity target) { - if (Math.random() > hitChance.get() / 100) return; + if (rotation.get() == RotationMode.OnHit) Rotations.rotate(Rotations.getYaw(target), Rotations.getPitch(target, Target.Body)); - if (rotation.get() == RotationMode.OnHit) rotate(target, () -> hitEntity(target)); - else hitEntity(target); - } - - private void hitEntity(Entity target) { mc.interactionManager.attackEntity(mc.player, target); mc.player.swingHand(Hand.MAIN_HAND); - } - private void rotate(Entity target, Runnable callback) { - Rotations.rotate(Rotations.getYaw(target), Rotations.getPitch(target, Target.Body), callback); + hitTimer = 0; } private boolean itemInHand() { + if (shouldShieldBreak()) return mc.player.getMainHandStack().getItem() instanceof AxeItem; + return switch (weapon.get()) { case Axe -> mc.player.getMainHandStack().getItem() instanceof AxeItem; case Sword -> mc.player.getMainHandStack().getItem() instanceof SwordItem; @@ -416,4 +431,10 @@ public enum RotationMode { OnHit, None } + + public enum ShieldMode { + Ignore, + Break, + None + } } From e90e6771574dc321baa73eba3492fd44a6282060 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Thu, 22 Dec 2022 10:27:43 +0800 Subject: [PATCH 017/135] BetterTab fix --- .../meteorclient/mixin/PlayerListHudMixin.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerListHudMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerListHudMixin.java index bf7bbc271d..392b714d25 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerListHudMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerListHudMixin.java @@ -15,16 +15,14 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.text.Text; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyArg; +import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(PlayerListHud.class) public class PlayerListHudMixin { - @ModifyArg(method = "render", at = @At(value = "INVOKE", target = "Ljava/lang/Math;min(II)I", ordinal = 0), index = 1) - private int modifyCount(int count) { + @ModifyConstant(constant = @Constant(longValue = 80L), method = "render") + private long modifyCount(long count) { BetterTab module = Modules.get().get(BetterTab.class); return module.isActive() ? module.tabSize.get() : count; From d43aebba697361aeb583a167f938b42d9176029f Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Thu, 22 Dec 2022 10:43:46 +0800 Subject: [PATCH 018/135] FakePlayer Menu --- .../systems/modules/player/FakePlayer.java | 32 +++++++++++++++---- .../entity/fakeplayer/FakePlayerManager.java | 4 +++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/FakePlayer.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/FakePlayer.java index 94e79e70d9..6946dfddf7 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/FakePlayer.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/FakePlayer.java @@ -7,11 +7,13 @@ import meteordevelopment.meteorclient.gui.GuiTheme; import meteordevelopment.meteorclient.gui.widgets.WWidget; -import meteordevelopment.meteorclient.gui.widgets.containers.WHorizontalList; +import meteordevelopment.meteorclient.gui.widgets.containers.WTable; import meteordevelopment.meteorclient.gui.widgets.pressable.WButton; +import meteordevelopment.meteorclient.gui.widgets.pressable.WMinus; import meteordevelopment.meteorclient.settings.*; import meteordevelopment.meteorclient.systems.modules.Categories; import meteordevelopment.meteorclient.systems.modules.Module; +import meteordevelopment.meteorclient.utils.entity.fakeplayer.FakePlayerEntity; import meteordevelopment.meteorclient.utils.entity.fakeplayer.FakePlayerManager; public class FakePlayer extends Module { @@ -46,19 +48,37 @@ public FakePlayer() { @Override public WWidget getWidget(GuiTheme theme) { - WHorizontalList w = theme.horizontalList(); + WTable table = theme.table(); + fillTable(theme, table); - WButton spawn = w.add(theme.button("Spawn")).widget(); + return table; + } + + private void fillTable(GuiTheme theme, WTable table) { + for (FakePlayerEntity fakePlayer : FakePlayerManager.getFakePlayers()) { + table.add(theme.label(fakePlayer.getEntityName())); + WMinus delete = table.add(theme.minus()).expandCellX().right().widget(); + delete.action = () -> { + FakePlayerManager.remove(fakePlayer); + table.clear(); + fillTable(theme, table); + }; + table.row(); + } + + WButton spawn = table.add(theme.button("Spawn")).expandCellX().right().widget(); spawn.action = () -> { FakePlayerManager.add(name.get(), health.get(), copyInv.get()); + table.clear(); + fillTable(theme, table); }; - WButton clear = w.add(theme.button("Clear")).widget(); + WButton clear = table.add(theme.button("Clear All")).right().widget(); clear.action = () -> { FakePlayerManager.clear(); + table.clear(); + fillTable(theme, table); }; - - return w; } @Override diff --git a/src/main/java/meteordevelopment/meteorclient/utils/entity/fakeplayer/FakePlayerManager.java b/src/main/java/meteordevelopment/meteorclient/utils/entity/fakeplayer/FakePlayerManager.java index ff071968a4..b6fe58d550 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/entity/fakeplayer/FakePlayerManager.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/entity/fakeplayer/FakePlayerManager.java @@ -17,6 +17,10 @@ public class FakePlayerManager { private static final List ENTITIES = new ArrayList<>(); + public static List getFakePlayers() { + return ENTITIES; + } + public static FakePlayerEntity get(String name) { for (FakePlayerEntity fp : ENTITIES) { if (fp.getEntityName().equals(name)) return fp; From 635c025053cf403b87787b8c7c7cbd2f23466517 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Thu, 22 Dec 2022 19:44:24 +0800 Subject: [PATCH 019/135] Fix FOV crash --- .../meteorclient/mixin/SimpleOptionMixin.java | 91 ++----------------- 1 file changed, 10 insertions(+), 81 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/SimpleOptionMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/SimpleOptionMixin.java index 650e3c87db..06c7dd05cb 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/SimpleOptionMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/SimpleOptionMixin.java @@ -5,46 +5,29 @@ package meteordevelopment.meteorclient.mixin; -import com.mojang.datafixers.util.Either; import com.mojang.serialization.Codec; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.widget.ClickableWidget; import net.minecraft.client.option.GameOptions; import net.minecraft.client.option.SimpleOption; -import org.jetbrains.annotations.NotNull; -import org.spongepowered.asm.mixin.*; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.util.Optional; -import java.util.function.Consumer; -import java.util.function.Function; - @Mixin(SimpleOption.class) public class SimpleOptionMixin { - @Shadow @Final @Mutable private SimpleOption.Callbacks callbacks; - - @Unique private SimpleOption.Callbacks aCallbacks; + @Shadow T value; - @Inject(method = "setValue", at = @At("HEAD")) + @Inject(method = "setValue", at = @At("HEAD"), cancellable = true) private void onSetValueHead(T value, CallbackInfo info) { - if (MinecraftClient.getInstance().options == null) return; - - SimpleOption.Callbacks c = getCallbacks(); - - if (c != null) { - aCallbacks = this.callbacks; - this.callbacks = c; - } - } + GameOptions options = MinecraftClient.getInstance().options; + if (options == null) return; - @Inject(method = "setValue", at = @At("RETURN")) - public void onSetValueReturn(T value, CallbackInfo info) { - if (aCallbacks != null) { - this.callbacks = aCallbacks; - aCallbacks = null; + if ((Object) this == options.getGamma() || (Object) this == options.getFov()) { + this.value = value; + info.cancel(); } } @@ -55,61 +38,7 @@ public void onGetCodec(CallbackInfoReturnable> info) { if (options == null) return; if ((Object) this == options.getGamma()) { - info.setReturnValue((Codec) Codec.either(Codec.doubleRange(Double.MIN_VALUE, Double.MAX_VALUE), Codec.BOOL).xmap(either -> either.map(value -> value, value -> value ? 1.0 : 0.0), Either::left)); + info.setReturnValue((Codec) Codec.DOUBLE); } } - - @Unique - public SimpleOption.Callbacks getCallbacks() { - GameOptions options = MinecraftClient.getInstance().options; - - if ((Object) this == options.getGamma()) { - return createCallback(); - } - else if ((Object) this == options.getFov()) { - return createCallback(); - } - - return null; - } - - @NotNull - private SimpleOption.Callbacks createCallback() { - return new SimpleOption.Callbacks<>() { - @Override - public Function, ClickableWidget> getButtonCreator(SimpleOption.TooltipFactory tooltipFactory, GameOptions gameOptions, int x, int y, int width, Consumer changeCallback) { - return null; - } - - @Override - public Optional validate(T value) { - return Optional.of(value); - } - - @Override - public Codec codec() { - return null; - } - }; - } - @Shadow - T value; -// Credit to https://github.com/seasnale/custom-fov - @Shadow @Final - private Consumer changeCallback; - - @Inject( - method = "setValue", - at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/SimpleOption$Callbacks;validate(Ljava/lang/Object;)Ljava/util/Optional;", shift = At.Shift.BEFORE), - cancellable = true - ) - private void earlyReturn(T value, CallbackInfo ci) { - this.value = value; - - if (MinecraftClient.getInstance().isRunning()) { - changeCallback.accept(value); - } - - ci.cancel(); - } } From b7d8481b806a05107489002d56f748b255624075 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Thu, 22 Dec 2022 21:39:39 +0800 Subject: [PATCH 020/135] Fix FOV crash --- .../meteorclient/mixin/SimpleOptionMixin.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/SimpleOptionMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/SimpleOptionMixin.java index 06c7dd05cb..8579431bd4 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/SimpleOptionMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/SimpleOptionMixin.java @@ -9,6 +9,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.option.GameOptions; import net.minecraft.client.option.SimpleOption; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -16,17 +17,27 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import java.util.function.Consumer; + @Mixin(SimpleOption.class) public class SimpleOptionMixin { @Shadow T value; + @Shadow @Final + private Consumer changeCallback; + @Inject(method = "setValue", at = @At("HEAD"), cancellable = true) - private void onSetValueHead(T value, CallbackInfo info) { + private void onSetValue(T value, CallbackInfo info) { GameOptions options = MinecraftClient.getInstance().options; if (options == null) return; if ((Object) this == options.getGamma() || (Object) this == options.getFov()) { this.value = value; + + if (MinecraftClient.getInstance().isRunning()) { + changeCallback.accept(value); + } + info.cancel(); } } From 70876a916910b351d90aa63ce46a31407ae359a4 Mon Sep 17 00:00:00 2001 From: RacoonDog <32882447+RacoonDog@users.noreply.github.com> Date: Thu, 22 Dec 2022 22:49:03 -0500 Subject: [PATCH 021/135] fix player head rendering --- .../meteorclient/mixin/ChatHudMixin.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ChatHudMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ChatHudMixin.java index 98e15f55e2..5e91d136ee 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ChatHudMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ChatHudMixin.java @@ -27,6 +27,7 @@ import net.minecraft.network.message.MessageSignatureData; import net.minecraft.text.Text; import net.minecraft.util.Identifier; +import net.minecraft.util.math.MathHelper; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -111,8 +112,12 @@ private void onRender(MatrixStack matrices, int currentTick, int mouseX, int mou double g = 9.0D * (mc.options.getChatLineSpacing().getValue() + 1.0D); double h = -8.0D * (mc.options.getChatLineSpacing().getValue() + 1.0D) + 4.0D * mc.options.getChatLineSpacing().getValue() + 8.0D; + float chatScale = (float) this.getChatScale(); + float scaledHeight = mc.getWindow().getScaledHeight(); + matrices.push(); - matrices.translate(2, -0.1f, 10); + matrices.scale(chatScale, chatScale, 1.0f); + matrices.translate(2.0f, MathHelper.floor((scaledHeight - 40) / chatScale) - g - 0.1f, 10.0f); RenderSystem.enableBlend(); for(int m = 0; m + this.scrolledLines < this.visibleMessages.size() && m < maxLineCount; ++m) { ChatHudLine.Visible chatHudLine = this.visibleMessages.get(m + this.scrolledLines); @@ -153,6 +158,9 @@ private static double getMessageOpacityMultiplier(int age) { @Final private List messages; + @Shadow + public abstract double getChatScale(); + private void drawIcon(MatrixStack matrices, String line, int y, float opacity) { if (METEOR_PREFIX_REGEX.matcher(line).find()) { RenderSystem.setShaderTexture(0, METEOR_CHAT_ICON); From 7c8857db61aedca5ddf031eb5bfbc0891636d78b Mon Sep 17 00:00:00 2001 From: Based Ricky <80427814+RickyTheRacc@users.noreply.github.com> Date: Fri, 23 Dec 2022 10:05:50 -0600 Subject: [PATCH 022/135] Improve Crystal Aura (reorder settings, change pause settings, rendering changes) (#3102) --- .../systems/modules/combat/CrystalAura.java | 421 ++++++++++++++---- .../utils/render/RenderUtils.java | 12 +- 2 files changed, 336 insertions(+), 97 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/CrystalAura.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/CrystalAura.java index 52d1c9749b..c6623ebe82 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/CrystalAura.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/CrystalAura.java @@ -27,9 +27,12 @@ import meteordevelopment.meteorclient.utils.misc.Keybind; import meteordevelopment.meteorclient.utils.player.*; import meteordevelopment.meteorclient.utils.render.NametagUtils; +import meteordevelopment.meteorclient.utils.render.RenderUtils; +import meteordevelopment.meteorclient.utils.render.color.Color; import meteordevelopment.meteorclient.utils.render.color.SettingColor; import meteordevelopment.meteorclient.utils.world.BlockIterator; import meteordevelopment.meteorclient.utils.world.BlockUtils; +import meteordevelopment.meteorclient.utils.world.TickRate; import meteordevelopment.orbit.EventHandler; import meteordevelopment.orbit.EventPriority; import net.minecraft.block.Blocks; @@ -54,6 +57,7 @@ public class CrystalAura extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); + private final SettingGroup sgSwitch = settings.createGroup("Switch"); private final SettingGroup sgPlace = settings.createGroup("Place"); private final SettingGroup sgFacePlace = settings.createGroup("Face Place"); private final SettingGroup sgBreak = settings.createGroup("Break"); @@ -103,10 +107,17 @@ public class CrystalAura extends Module { .build() ); - private final Setting autoSwitch = sgGeneral.add(new EnumSetting.Builder() - .name("auto-switch") - .description("Switches to crystals in your hotbar once a target is found.") - .defaultValue(AutoSwitchMode.Normal) + private final Setting antiSuicide = sgGeneral.add(new BoolSetting.Builder() + .name("anti-suicide") + .description("Will not place and break crystals if they will kill you.") + .defaultValue(true) + .build() + ); + + private final Setting ignoreNakeds = sgGeneral.add(new BoolSetting.Builder() + .name("ignore-nakeds") + .description("Ignore players with no items.") + .defaultValue(false) .build() ); @@ -134,9 +145,41 @@ public class CrystalAura extends Module { .build() ); - private final Setting antiSuicide = sgGeneral.add(new BoolSetting.Builder() - .name("anti-suicide") - .description("Will not place and break crystals if they will kill you.") + // Switch + + private final Setting autoSwitch = sgSwitch.add(new EnumSetting.Builder() + .name("auto-switch") + .description("Switches to crystals in your hotbar once a target is found.") + .defaultValue(AutoSwitchMode.Normal) + .build() + ); + + private final Setting switchDelay = sgSwitch.add(new IntSetting.Builder() + .name("switch-delay") + .description("The delay in ticks to wait to break a crystal after switching hotbar slot.") + .defaultValue(0) + .min(0) + .build() + ); + + private final Setting noGapSwitch = sgSwitch.add(new BoolSetting.Builder() + .name("no-gap-switch") + .description("Won't auto switch if you're holding a gapple.") + .defaultValue(true) + .visible(() -> autoSwitch.get() == AutoSwitchMode.Normal) + .build() + ); + + private final Setting noBowSwitch = sgSwitch.add(new BoolSetting.Builder() + .name("no-bow-switch") + .description("Won't auto switch if you're holding a bow.") + .defaultValue(true) + .build() + ); + + private final Setting antiWeakness = sgSwitch.add(new BoolSetting.Builder() + .name("anti-weakness") + .description("Switches to tools with so you can break crystals with the weakness effect.") .defaultValue(true) .build() ); @@ -169,7 +212,7 @@ public class CrystalAura extends Module { ); private final Setting placeWallsRange = sgPlace.add(new DoubleSetting.Builder() - .name("place-walls-range") + .name("walls-range") .description("Range in which to place crystals when behind blocks.") .defaultValue(4.5) .min(0) @@ -271,14 +314,6 @@ public class CrystalAura extends Module { .build() ); - private final Setting switchDelay = sgBreak.add(new IntSetting.Builder() - .name("switch-delay") - .description("The delay in ticks to wait to break a crystal after switching hotbar slot.") - .defaultValue(0) - .min(0) - .build() - ); - private final Setting breakRange = sgBreak.add(new DoubleSetting.Builder() .name("break-range") .description("Range in which to break crystals.") @@ -289,7 +324,7 @@ public class CrystalAura extends Module { ); private final Setting breakWallsRange = sgBreak.add(new DoubleSetting.Builder() - .name("break-walls-range") + .name("walls-range") .description("Range in which to break crystals when behind blocks.") .defaultValue(4.5) .min(0) @@ -337,56 +372,124 @@ public class CrystalAura extends Module { .build() ); - private final Setting antiWeakness = sgBreak.add(new BoolSetting.Builder() - .name("anti-weakness") - .description("Switches to tools with high enough damage to explode the crystal with weakness effect.") - .defaultValue(true) + // Pause + + public final Setting pauseOnUse = sgPause.add(new EnumSetting.Builder() + .name("pause-on-use") + .description("Which processes should be paused while using an item.") + .defaultValue(PauseMode.Place) .build() ); - // Pause + public final Setting pauseOnMine = sgPause.add(new EnumSetting.Builder() + .name("pause-on-mine") + .description("Which processes should be paused while mining a block.") + .defaultValue(PauseMode.None) + .build() + ); - private final Setting eatPause = sgPause.add(new BoolSetting.Builder() - .name("pause-on-eat") - .description("Pauses Crystal Aura when eating.") + private final Setting pauseOnLag = sgPause.add(new BoolSetting.Builder() + .name("pause-on-lag") + .description("Whether to pause if the server is not responding.") .defaultValue(true) .build() ); - private final Setting drinkPause = sgPause.add(new BoolSetting.Builder() - .name("pause-on-drink") - .description("Pauses Crystal Aura when drinking.") - .defaultValue(true) + public final Setting> pauseModules = sgPause.add(new ModuleListSetting.Builder() + .name("pause-modules") + .description("Pauses while any of the selected modules are active.") + .defaultValue(BedAura.class) .build() ); - private final Setting minePause = sgPause.add(new BoolSetting.Builder() - .name("pause-on-mine") - .description("Pauses Crystal Aura when mining.") - .defaultValue(false) + public final Setting pauseHealth = sgPause.add(new DoubleSetting.Builder() + .name("pause-health") + .description("Pauses when you go below a certain health.") + .defaultValue(5) + .range(0,36) + .sliderRange(0,36) .build() ); // Render - private final Setting renderSwing = sgRender.add(new BoolSetting.Builder() - .name("swing") - .description("Renders hand swinging client-side.") - .defaultValue(true) + public final Setting swingMode = sgRender.add(new EnumSetting.Builder() + .name("swing-mode") + .description("How to swing when placing.") + .defaultValue(SwingMode.Both) .build() ); - private final Setting render = sgRender.add(new BoolSetting.Builder() - .name("render") + private final Setting renderMode = sgRender.add(new EnumSetting.Builder() + .name("render-mode") + .description("The mode to render in.") + .defaultValue(RenderMode.Normal) + .build() + ); + + private final Setting renderPlace = sgRender.add(new BoolSetting.Builder() + .name("render-place") .description("Renders a block overlay over the block the crystals are being placed on.") .defaultValue(true) + .visible(() -> renderMode.get() == RenderMode.Normal) + .build() + ); + + private final Setting placeRenderTime = sgRender.add(new IntSetting.Builder() + .name("place-time") + .description("How long to render placements.") + .defaultValue(10) + .min(0) + .sliderMax(20) + .visible(() -> renderMode.get() == RenderMode.Normal && renderPlace.get()) .build() ); private final Setting renderBreak = sgRender.add(new BoolSetting.Builder() - .name("break") + .name("render-break") .description("Renders a block overlay over the block the crystals are broken on.") .defaultValue(false) + .visible(() -> renderMode.get() == RenderMode.Normal) + .build() + ); + + private final Setting breakRenderTime = sgRender.add(new IntSetting.Builder() + .name("break-time") + .description("How long to render breaking for.") + .defaultValue(13) + .min(0) + .sliderMax(20) + .visible(() -> renderMode.get() == RenderMode.Normal && renderBreak.get()) + .build() + ); + + private final Setting smoothness = sgRender.add(new IntSetting.Builder() + .name("smoothness") + .description("How smoothly the render should move around.") + .defaultValue(10) + .min(0) + .sliderMax(20) + .visible(() -> renderMode.get() == RenderMode.Smooth) + .build() + ); + + private final Setting height = sgRender.add(new DoubleSetting.Builder() + .name("height") + .description("How tall the gradient should be.") + .defaultValue(0.7) + .min(0) + .sliderMax(1) + .visible(() -> renderMode.get() == RenderMode.Gradient) + .build() + ); + + private final Setting renderTime = sgRender.add(new IntSetting.Builder() + .name("render-time") + .description("How long to render placements.") + .defaultValue(10) + .min(0) + .sliderMax(20) + .visible(() -> renderMode.get() == RenderMode.Smooth || renderMode.get() == RenderMode.Fading) .build() ); @@ -394,6 +497,7 @@ public class CrystalAura extends Module { .name("shape-mode") .description("How the shapes are rendered.") .defaultValue(ShapeMode.Both) + .visible(() -> renderMode.get() != RenderMode.None) .build() ); @@ -401,6 +505,7 @@ public class CrystalAura extends Module { .name("side-color") .description("The side color of the block overlay.") .defaultValue(new SettingColor(255, 255, 255, 45)) + .visible(() -> shapeMode.get().sides() && renderMode.get() != RenderMode.None) .build() ); @@ -408,6 +513,7 @@ public class CrystalAura extends Module { .name("line-color") .description("The line color of the block overlay.") .defaultValue(new SettingColor(255, 255, 255)) + .visible(() -> shapeMode.get().lines() && renderMode.get() != RenderMode.None) .build() ); @@ -415,6 +521,15 @@ public class CrystalAura extends Module { .name("damage") .description("Renders crystal damage text in the block overlay.") .defaultValue(true) + .visible(() -> renderMode.get() != RenderMode.None) + .build() + ); + + private final Setting damageColor = sgRender.add(new ColorSetting.Builder() + .name("damage-color") + .description("The color of the damage text.") + .defaultValue(new SettingColor(255, 255, 255)) + .visible(() -> renderMode.get() != RenderMode.None && renderDamageText.get()) .build() ); @@ -424,31 +539,14 @@ public class CrystalAura extends Module { .defaultValue(1.25) .min(1) .sliderMax(4) - .visible(renderDamageText::get) - .build() - ); - - private final Setting renderTime = sgRender.add(new IntSetting.Builder() - .name("render-time") - .description("How long to render for.") - .defaultValue(10) - .min(0) - .sliderMax(20) - .build() - ); - - private final Setting renderBreakTime = sgRender.add(new IntSetting.Builder() - .name("break-time") - .description("How long to render breaking for.") - .defaultValue(13) - .min(0) - .sliderMax(20) - .visible(renderBreak::get) + .visible(() -> renderMode.get() != RenderMode.None && renderDamageText.get()) .build() ); // Fields + private Item mainItem, offItem; + private int breakTimer, placeTimer, switchTimer, ticksPassed; private final List targets = new ArrayList<>(); @@ -484,9 +582,11 @@ public class CrystalAura extends Module { private double lastYaw, lastPitch; private int lastRotationTimer; - private int renderTimer, breakRenderTimer; - private final BlockPos.Mutable renderPos = new BlockPos.Mutable(); + private int placeRenderTimer, breakRenderTimer; + private final BlockPos.Mutable placeRenderPos = new BlockPos.Mutable(); private final BlockPos.Mutable breakRenderPos = new BlockPos.Mutable(); + private Box renderBoxOne, renderBoxTwo; + private double renderDamage; public CrystalAura() { @@ -514,7 +614,7 @@ public void onActivate() { lastRotationTimer = getLastRotationStopDelay(); - renderTimer = 0; + placeRenderTimer = 0; breakRenderTimer = 0; } @@ -566,9 +666,12 @@ private void onPreTick(TickEvent.Pre event) { if (switchTimer > 0) switchTimer--; // Decrement render timers - if (renderTimer > 0) renderTimer--; + if (placeRenderTimer > 0) placeRenderTimer--; if (breakRenderTimer > 0) breakRenderTimer--; + mainItem = mc.player.getMainHandStack().getItem(); + offItem = mc.player.getOffHandStack().getItem(); + // Update waiting to explode crystals and mark them as existing if reached threshold for (IntIterator it = waitingToExplode.keySet().iterator(); it.hasNext();) { int id = it.nextInt(); @@ -583,9 +686,6 @@ private void onPreTick(TickEvent.Pre event) { } } - // Check pause settings - if (PlayerUtils.shouldPause(minePause.get(), eatPause.get(), drinkPause.get())) return; - // Set player eye pos ((IVec3d) playerEyePos).set(mc.player.getPos().x, mc.player.getPos().y + mc.player.getEyeHeight(mc.player.getPose()), mc.player.getPos().z); @@ -648,6 +748,7 @@ private void setRotation(boolean isPos, Vec3d pos, double yaw, double pitch) { private void doBreak() { if (!doBreak.get() || breakTimer > 0 || switchTimer > 0 || attacks >= attackFrequency.get()) return; + if (shouldPause(PauseMode.Break)) return; double bestDamage = 0; Entity crystal = null; @@ -748,7 +849,7 @@ private void doBreak(Entity crystal) { // Break render breakRenderPos.set(crystal.getBlockPos().down()); - breakRenderTimer = renderBreakTime.get(); + breakRenderTimer = breakRenderTime.get(); } } @@ -766,8 +867,8 @@ private void attackCrystal(Entity entity) { Hand hand = InvUtils.findInHotbar(Items.END_CRYSTAL).getHand(); if (hand == null) hand = Hand.MAIN_HAND; - if (renderSwing.get()) mc.player.swingHand(hand); - else mc.getNetworkHandler().sendPacket(new HandSwingC2SPacket(hand)); + if (swingMode.get().client()) mc.player.swingHand(hand); + if (swingMode.get().packet()) mc.getNetworkHandler().sendPacket(new HandSwingC2SPacket(hand)); attacks++; } @@ -783,12 +884,21 @@ private void onPacketSend(PacketEvent.Send event) { private void doPlace() { if (!doPlace.get() || placeTimer > 0) return; + if (shouldPause(PauseMode.Place)) return; // Return if there are no crystals in hotbar or offhand if (!InvUtils.testInHotbar(Items.END_CRYSTAL)) return; // Return if there are no crystals in either hand and auto switch mode is none - if (autoSwitch.get() == AutoSwitchMode.None && mc.player.getOffHandStack().getItem() != Items.END_CRYSTAL && mc.player.getMainHandStack().getItem() != Items.END_CRYSTAL) return; + if (autoSwitch.get() != AutoSwitchMode.None) { + if (noGapSwitch.get() && autoSwitch.get() == AutoSwitchMode.Normal && offItem != Items.END_CRYSTAL) { + if (mainItem == Items.ENCHANTED_GOLDEN_APPLE + || offItem == Items.ENCHANTED_GOLDEN_APPLE + || mainItem == Items.GOLDEN_APPLE + || offItem == Items.GOLDEN_APPLE) return; + } + if (noBowSwitch.get() && (mainItem == Items.BOW || offItem == Items.BOW)) return; + } else if (mainItem != Items.END_CRYSTAL && offItem != Items.END_CRYSTAL) return; // Check for multiplace for (Entity entity : mc.world.getEntities()) { @@ -920,21 +1030,34 @@ private void placeCrystal(BlockHitResult result, double damage, BlockPos support // Place crystal mc.player.networkHandler.sendPacket(new PlayerInteractBlockC2SPacket(hand, result, 0)); - if (renderSwing.get()) mc.player.swingHand(hand); - else mc.getNetworkHandler().sendPacket(new HandSwingC2SPacket(hand)); + if (swingMode.get().client()) mc.player.swingHand(hand); + if (swingMode.get().packet()) mc.getNetworkHandler().sendPacket(new HandSwingC2SPacket(hand)); placing = true; placingTimer = 4; kaTimer = 8; placingCrystalBlockPos.set(result.getBlockPos()).move(0, 1, 0); - renderTimer = renderTime.get(); - renderPos.set(result.getBlockPos()); + placeRenderPos.set(result.getBlockPos()); renderDamage = damage; + + if (renderMode.get() == RenderMode.Normal) { + placeRenderTimer = placeRenderTime.get(); + } else { + placeRenderTimer = renderTime.get(); + if (renderMode.get() == RenderMode.Fading) { + RenderUtils.renderTickingBlock( + placeRenderPos, sideColor.get(), + lineColor.get(), shapeMode.get(), + 0, renderTime.get(), true, + false + ); + } + } } else { // Place support block - BlockUtils.place(supportBlock, item, false, 0, renderSwing.get(), true, false); + BlockUtils.place(supportBlock, item, false, 0, swingMode.get().client(), true, false); placeTimer += supportDelay.get(); if (supportDelay.get() == 0) placeCrystal(result, damage, null); @@ -1007,6 +1130,17 @@ private boolean shouldFacePlace() { // Others + private boolean shouldPause(PauseMode process) { + if (mc.player.isUsingItem() || mc.options.useKey.isPressed()) { + if (pauseOnUse.get().equals(process)) return true; + } + + if (pauseOnLag.get() && TickRate.INSTANCE.getTimeSinceLastTick() >= 1.0f) return true; + for (Module module : pauseModules.get()) if (module.isActive()) return true; + if (pauseOnMine.get().equals(process) && mc.interactionManager.isBreakingBlock()) return true; + return (EntityUtils.getTotalHealth(mc.player) <= pauseHealth.get()); + } + private boolean isOutOfRange(Vec3d vec3d, BlockPos blockPos, boolean place) { ((IRaycastContext) raycastContext).set(playerEyePos, vec3d, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.NONE, mc.player); @@ -1071,10 +1205,20 @@ private void findTargets() { // Players for (PlayerEntity player : mc.world.getPlayers()) { if (player.getAbilities().creativeMode || player == mc.player) continue; - - if (!player.isDead() && player.isAlive() && Friends.get().shouldAttack(player) && PlayerUtils.isWithin(player, targetRange.get())) { - targets.add(player); + if (!player.isAlive() || !Friends.get().shouldAttack(player)) continue; + if (player.distanceTo(mc.player) > targetRange.get()) continue; + + if (ignoreNakeds.get()) { + if (player.getOffHandStack().isEmpty() + && player.getMainHandStack().isEmpty() + && player.getInventory().armor.get(0).isEmpty() + && player.getInventory().armor.get(1).isEmpty() + && player.getInventory().armor.get(2).isEmpty() + && player.getInventory().armor.get(3).isEmpty() + ) continue; } + + targets.add(player); } } @@ -1082,35 +1226,86 @@ private boolean intersectsWithEntities(Box box) { return EntityUtils.intersectsWithEntity(box, entity -> !entity.isSpectator() && !removed.contains(entity.getId())); } - // Render + // Rendering @EventHandler private void onRender(Render3DEvent event) { - if (renderTimer > 0 && render.get()) { - event.renderer.box(renderPos, sideColor.get(), lineColor.get(), shapeMode.get(), 0); - } + if (renderMode.get() == RenderMode.None) return; + + switch (renderMode.get()) { + case Normal -> { + if (renderPlace.get() && placeRenderTimer > 0) { + event.renderer.box(placeRenderPos, sideColor.get(), lineColor.get(), shapeMode.get(), 0); + } + if (renderBreak.get() && breakRenderTimer > 0) { + event.renderer.box(breakRenderPos, sideColor.get(), lineColor.get(), shapeMode.get(), 0); + } + } + + case Smooth -> { + if (placeRenderTimer <= 0) return; + + if (renderBoxOne == null) renderBoxOne = new Box(placeRenderPos); + if (renderBoxTwo == null) renderBoxTwo = new Box(placeRenderPos); + else ((IBox) renderBoxTwo).set(placeRenderPos); - if (breakRenderTimer > 0 && renderBreak.get() && !mc.world.getBlockState(breakRenderPos).isAir()) { - int preSideA = sideColor.get().a; - sideColor.get().a -= 20; - sideColor.get().validate(); + double offsetX = (renderBoxTwo.minX - renderBoxOne.minX) / smoothness.get(); + double offsetY = (renderBoxTwo.minY - renderBoxOne.minY) / smoothness.get(); + double offsetZ = (renderBoxTwo.minZ - renderBoxOne.minZ) / smoothness.get(); - int preLineA = lineColor.get().a; - lineColor.get().a -= 20; - lineColor.get().validate(); + ((IBox) renderBoxOne).set( + renderBoxOne.minX + offsetX, + renderBoxOne.minY + offsetY, + renderBoxOne.minZ + offsetZ, + renderBoxOne.maxX + offsetX, + renderBoxOne.maxY + offsetY, + renderBoxOne.maxZ + offsetZ + ); - event.renderer.box(breakRenderPos, sideColor.get(), lineColor.get(), shapeMode.get(), 0); + event.renderer.box(renderBoxOne, sideColor.get(), lineColor.get(), shapeMode.get(), 0); + } + + case Gradient -> { + if (placeRenderTimer <= 0) return; + + Color bottom = new Color(0, 0, 0, 0); - sideColor.get().a = preSideA; - lineColor.get().a = preLineA; + int x = placeRenderPos.getX(); + int y = placeRenderPos.getY() + 1; + int z = placeRenderPos.getZ(); + + if (shapeMode.get().sides()) { + event.renderer.quadHorizontal(x, y, z, x + 1, z + 1, sideColor.get()); + event.renderer.gradientQuadVertical(x, y, z, x + 1, y - height.get(), z, bottom, sideColor.get()); + event.renderer.gradientQuadVertical(x, y, z, x, y - height.get(), z + 1, bottom, sideColor.get()); + event.renderer.gradientQuadVertical(x + 1, y, z, x + 1, y - height.get(), z + 1, bottom, sideColor.get()); + event.renderer.gradientQuadVertical(x, y, z + 1, x + 1, y - height.get(), z + 1, bottom, sideColor.get()); + } + + if (shapeMode.get().lines()) { + event.renderer.line(x, y, z, x + 1, y, z, lineColor.get()); + event.renderer.line(x, y, z, x, y, z + 1, lineColor.get()); + event.renderer.line(x + 1, y, z, x + 1, y, z + 1, lineColor.get()); + event.renderer.line(x, y, z + 1, x + 1, y, z + 1, lineColor.get()); + + event.renderer.line(x, y, z, x, y - height.get(), z, lineColor.get(), bottom); + event.renderer.line(x + 1, y, z, x + 1, y - height.get(), z, lineColor.get(), bottom); + event.renderer.line(x, y, z + 1, x, y - height.get(), z + 1, lineColor.get(), bottom); + event.renderer.line(x + 1, y, z + 1, x + 1, y - height.get(), z + 1, lineColor.get(), bottom); + } + } } } @EventHandler private void onRender2D(Render2DEvent event) { - if (!render.get() || renderTimer <= 0 || !renderDamageText.get()) return; + if (renderMode.get() == RenderMode.None || !renderDamageText.get()) return; + if (placeRenderTimer <= 0 && breakRenderTimer <= 0) return; - vec3.set(renderPos.getX() + 0.5, renderPos.getY() + 0.5, renderPos.getZ() + 0.5); + if (renderMode.get() == RenderMode.Smooth) { + if (renderBoxOne == null) return; + vec3.set(renderBoxOne.minX + 0.5, renderBoxOne.minY + 0.5, renderBoxOne.minZ + 0.5); + } else vec3.set(placeRenderPos.getX() + 0.5, placeRenderPos.getY() + 0.5, placeRenderPos.getZ() + 0.5); if (NametagUtils.to2D(vec3, damageTextScale.get())) { NametagUtils.begin(vec3); @@ -1118,7 +1313,7 @@ private void onRender2D(Render2DEvent event) { String text = String.format("%.1f", renderDamage); double w = TextRenderer.get().getWidth(text) / 2; - TextRenderer.get().render(text, -w, 0, lineColor.get(), true); + TextRenderer.get().render(text, -w, 0, damageColor.get(), true); TextRenderer.get().end(); NametagUtils.end(); @@ -1141,4 +1336,38 @@ public enum SupportMode { Accurate, Fast } + + public enum PauseMode { + Both, + Place, + Break, + None; + + public boolean equals(PauseMode process) { + return this == process || this == PauseMode.Both; + } + } + + public enum SwingMode { + Both, + Packet, + Client, + None; + + public boolean packet() { + return this == Packet || this == Both; + } + + public boolean client() { + return this == Client || this == Both; + } + } + + public enum RenderMode { + Normal, + Smooth, + Fading, + Gradient, + None + } } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/render/RenderUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/render/RenderUtils.java index e774ea39d6..2a56d1eeec 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/render/RenderUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/render/RenderUtils.java @@ -89,13 +89,23 @@ private static void bobView(MatrixStack matrices) { float h = -(playerEntity.horizontalSpeed + g * f); float i = MathHelper.lerp(f, playerEntity.prevStrideDistance, playerEntity.strideDistance); - matrices.translate(-(MathHelper.sin(h * 3.1415927f) * i * 0.5), -(-Math.abs(MathHelper.cos(h * 3.1415927f) * i)), 0); + matrices.translate(-(MathHelper.sin(h * 3.1415927f) * i * 0.5), Math.abs(MathHelper.cos(h * 3.1415927f) * i), 0); matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(MathHelper.sin(h * 3.1415927f) * i * 3)); matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(Math.abs(MathHelper.cos(h * 3.1415927f - 0.2f) * i) * 5)); } } public static void renderTickingBlock(BlockPos blockPos, Color sideColor, Color lineColor, ShapeMode shapeMode, int excludeDir, int duration, boolean fade, boolean shrink) { + // Ensure there aren't multiple fading blocks in one pos + Iterator iterator = renderBlocks.iterator(); + while (iterator.hasNext()) { + RenderBlock next = iterator.next(); + if (next.pos.equals(blockPos)) { + iterator.remove(); + renderBlockPool.free(next); + } + } + renderBlocks.add(renderBlockPool.get().set(blockPos, sideColor, lineColor, shapeMode, excludeDir, duration, fade, shrink)); } From ecbcf2f252ba9b0cde767dd78a7d074b3478073e Mon Sep 17 00:00:00 2001 From: Based Ricky <80427814+RickyTheRacc@users.noreply.github.com> Date: Fri, 23 Dec 2022 10:22:14 -0600 Subject: [PATCH 023/135] Improve Nametags (reorder settings and add a few settings for colors) (#3103) --- .../systems/modules/misc/Notifier.java | 2 +- .../systems/modules/render/Nametags.java | 165 ++++++++++-------- 2 files changed, 98 insertions(+), 69 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notifier.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notifier.java index ac64f81e2c..6e5a78e3a3 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notifier.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notifier.java @@ -85,7 +85,7 @@ public class Notifier extends Module { private final Setting>> entities = sgVisualRange.add(new EntityTypeListSetting.Builder() .name("entities") - .description("Which entities to nofity about.") + .description("Which entities to notify about.") .defaultValue(EntityType.PLAYER) .build() ); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Nametags.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Nametags.java index 99527b6af3..6417fd81dc 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Nametags.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Nametags.java @@ -26,6 +26,7 @@ import meteordevelopment.orbit.EventHandler; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.enchantment.Enchantments; import net.minecraft.entity.*; import net.minecraft.entity.decoration.ItemFrameEntity; import net.minecraft.entity.player.PlayerEntity; @@ -41,6 +42,7 @@ public class Nametags extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); private final SettingGroup sgPlayers = settings.createGroup("Players"); private final SettingGroup sgItems = settings.createGroup("Items"); + private final SettingGroup sgRender = settings.createGroup("Render"); // General @@ -54,29 +56,22 @@ public class Nametags extends Module { private final Setting scale = sgGeneral.add(new DoubleSetting.Builder() .name("scale") .description("The scale of the nametag.") - .defaultValue(1.5) + .defaultValue(1.1) .min(0.1) .build() ); - private final Setting yourself = sgGeneral.add(new BoolSetting.Builder() - .name("self") - .description("Displays a nametag on your player if you're in Freecam or third person.") + private final Setting ignoreSelf = sgGeneral.add(new BoolSetting.Builder() + .name("ignore-self") + .description("Ignore yourself when in third person or freecam.") .defaultValue(true) .build() ); - private final Setting background = sgGeneral.add(new ColorSetting.Builder() - .name("background-color") - .description("The color of the nametag background.") - .defaultValue(new SettingColor(0, 0, 0, 75)) - .build() - ); - - private final Setting names = sgGeneral.add(new ColorSetting.Builder() - .name("primary-color") - .description("The color of the nametag names.") - .defaultValue(new SettingColor()) + private final Setting ignoreBots = sgGeneral.add(new BoolSetting.Builder() + .name("ignore-bots") + .description("Only render non-bot nametags.") + .defaultValue(true) .build() ); @@ -109,16 +104,29 @@ public class Nametags extends Module { //Players - private final Setting excludeBots = sgPlayers.add(new BoolSetting.Builder() - .name("exclude-bots") - .description("Only render non-bot nametags.") - .defaultValue(true) + private final Setting displayGameMode = sgPlayers.add(new BoolSetting.Builder() + .name("gamemode") + .description("Shows the player's GameMode.") + .defaultValue(false) + .build() + ); + + private final Setting displayDistance = sgPlayers.add(new BoolSetting.Builder() + .name("distance") + .description("Shows the distance between you and the player.") + .defaultValue(false) .build() ); + private final Setting displayPing = sgPlayers.add(new BoolSetting.Builder() + .name("ping") + .description("Shows the player's ping.") + .defaultValue(true) + .build() + ); private final Setting displayItems = sgPlayers.add(new BoolSetting.Builder() - .name("display-items") + .name("items") .description("Displays armor and hand items above the name tags.") .defaultValue(true) .build() @@ -141,19 +149,32 @@ public class Nametags extends Module { .build() ); - private final Setting displayItemEnchants = sgPlayers.add(new BoolSetting.Builder() + private final Setting displayEnchants = sgPlayers.add(new BoolSetting.Builder() .name("display-enchants") .description("Displays item enchantments on the items.") - .defaultValue(true) + .defaultValue(false) .visible(displayItems::get) .build() ); + private final Setting> shownEnchantments = sgPlayers.add(new EnchantmentListSetting.Builder() + .name("shown-enchantments") + .description("The enchantments that are shown on nametags.") + .visible(() -> displayItems.get() && displayEnchants.get()) + .defaultValue( + Enchantments.PROTECTION, + Enchantments.BLAST_PROTECTION, + Enchantments.FIRE_PROTECTION, + Enchantments.PROJECTILE_PROTECTION + ) + .build() + ); + private final Setting enchantPos = sgPlayers.add(new EnumSetting.Builder() .name("enchantment-position") .description("Where the enchantments are rendered.") .defaultValue(Position.Above) - .visible(displayItemEnchants::get) + .visible(() -> displayItems.get() && displayEnchants.get()) .build() ); @@ -163,14 +184,7 @@ public class Nametags extends Module { .defaultValue(3) .range(1, 5) .sliderRange(1, 5) - .visible(displayItemEnchants::get) - .build() - ); - - private final Setting> ignoredEnchantments = sgPlayers.add(new EnchantmentListSetting.Builder() - .name("ignored-enchantments") - .description("The enchantments that aren't shown on nametags.") - .visible(displayItemEnchants::get) + .visible(() -> displayItems.get() && displayEnchants.get()) .build() ); @@ -180,37 +194,56 @@ public class Nametags extends Module { .defaultValue(1) .range(0.1, 2) .sliderRange(0.1, 2) - .visible(displayItemEnchants::get) + .visible(() -> displayItems.get() && displayEnchants.get()) .build() ); - private final Setting displayGameMode = sgPlayers.add(new BoolSetting.Builder() - .name("gamemode") - .description("Shows the player's GameMode.") + //Items + + private final Setting itemCount = sgItems.add(new BoolSetting.Builder() + .name("show-count") + .description("Displays the number of items in the stack.") .defaultValue(true) .build() ); - private final Setting displayPing = sgPlayers.add(new BoolSetting.Builder() - .name("ping") - .description("Shows the player's ping.") - .defaultValue(true) + // Render + + private final Setting background = sgRender.add(new ColorSetting.Builder() + .name("background-color") + .description("The color of the nametag background.") + .defaultValue(new SettingColor(0, 0, 0, 75)) .build() ); - private final Setting displayDistance = sgPlayers.add(new BoolSetting.Builder() - .name("distance") - .description("Shows the distance between you and the player.") - .defaultValue(true) + private final Setting nameColor = sgRender.add(new ColorSetting.Builder() + .name("name-color") + .description("The color of the nametag names.") + .defaultValue(new SettingColor()) .build() ); - //Items + private final Setting pingColor = sgRender.add(new ColorSetting.Builder() + .name("ping-color") + .description("The color of the nametag names.") + .defaultValue(new SettingColor(20, 170, 170)) + .visible(displayPing::get) + .build() + ); - private final Setting itemCount = sgItems.add(new BoolSetting.Builder() - .name("show-count") - .description("Displays the number of items in the stack.") - .defaultValue(true) + private final Setting gamemodeColor = sgRender.add(new ColorSetting.Builder() + .name("gamemode-color") + .description("The color of the nametag names.") + .defaultValue(new SettingColor(232, 185, 35)) + .visible(displayGameMode::get) + .build() + ); + + private final Setting distanceColor = sgRender.add(new ColorSetting.Builder() + .name("distance-color") + .description("The color of the nametag names.") + .defaultValue(new SettingColor(150, 150, 150)) + .visible(displayDistance::get) .build() ); @@ -219,8 +252,6 @@ public class Nametags extends Module { private final Color AMBER = new Color(255, 105, 25); private final Color GREEN = new Color(25, 252, 25); private final Color GOLD = new Color(232, 185, 35); - private final Color GREY = new Color(150, 150, 150); - private final Color BLUE = new Color(20, 170, 170); private final Vector3d pos = new Vector3d(); private final double[] itemWidths = new double[6]; @@ -258,8 +289,8 @@ private void onTick(TickEvent.Post event) { if (!entities.get().containsKey(type)) continue; if (type == EntityType.PLAYER) { - if ((!yourself.get() || (freecamNotActive && notThirdPerson)) && entity == mc.player) continue; - if (EntityUtils.getGameMode((PlayerEntity) entity) == null && excludeBots.get()) continue; + if ((ignoreSelf.get() || (freecamNotActive && notThirdPerson)) && entity == mc.player) continue; + if (EntityUtils.getGameMode((PlayerEntity) entity) == null && ignoreBots.get()) continue; } if (!culling.get() || PlayerUtils.isWithinCamera(entity, maxCullRange.get())) { @@ -335,7 +366,7 @@ private void renderNametagPlayer(PlayerEntity player, boolean shadow) { // Name String name; - Color nameColor = PlayerUtils.getPlayerColor(player, names.get()); + Color nameColor = PlayerUtils.getPlayerColor(player, this.nameColor.get()); if (player == mc.player) name = Modules.get().get(NameProtect.class).getName(player.getEntityName()); else name = player.getEntityName(); @@ -374,8 +405,7 @@ private void renderNametagPlayer(PlayerEntity player, boolean shadow) { if (displayGameMode.get()) width += gmWidth; if (displayPing.get()) width += pingWidth; - if (displayDistance.get() && renderPlayerDistance) - width += distWidth; + if (displayDistance.get() && renderPlayerDistance) width += distWidth; double widthHalf = width / 2; double heightDown = text.getHeight(shadow); @@ -387,13 +417,12 @@ private void renderNametagPlayer(PlayerEntity player, boolean shadow) { double hX = -widthHalf; double hY = -heightDown; - if (displayGameMode.get()) hX = text.render(gmText, hX, hY, GOLD, shadow); + if (displayGameMode.get()) hX = text.render(gmText, hX, hY, gamemodeColor.get(), shadow); hX = text.render(name, hX, hY, nameColor, shadow); hX = text.render(healthText, hX, hY, healthColor, shadow); - if (displayPing.get()) hX = text.render(pingText, hX, hY, BLUE, shadow); - if (displayDistance.get() && renderPlayerDistance) - text.render(distText, hX, hY, GREY, shadow); + if (displayPing.get()) hX = text.render(pingText, hX, hY, pingColor.get(), shadow); + if (displayDistance.get() && renderPlayerDistance) text.render(distText, hX, hY, distanceColor.get(), shadow); text.end(); if (displayItems.get()) { @@ -411,12 +440,12 @@ private void renderNametagPlayer(PlayerEntity player, boolean shadow) { if (!itemStack.isEmpty()) hasItems = true; - if (displayItemEnchants.get()) { + if (displayEnchants.get()) { Map enchantments = EnchantmentHelper.get(itemStack); int size = 0; for (var enchantment : enchantments.keySet()) { - if (ignoredEnchantments.get().contains(enchantment)) continue; + if (!shownEnchantments.get().contains(enchantment)) continue; String enchantName = Utils.getEnchantSimpleName(enchantment, enchantLength.get()) + " " + enchantments.get(enchantment); itemWidths[i] = Math.max(itemWidths[i], (text.getWidth(enchantName, shadow) / 2)); size++; @@ -440,14 +469,14 @@ private void renderNametagPlayer(PlayerEntity player, boolean shadow) { RenderUtils.drawItem(stack, (int) x, (int) y, 2, true); - if (maxEnchantCount > 0 && displayItemEnchants.get()) { + if (maxEnchantCount > 0 && displayEnchants.get()) { text.begin(0.5 * enchantTextScale.get(), false, true); Map enchantments = EnchantmentHelper.get(stack); Map enchantmentsToShow = new HashMap<>(); for (Enchantment enchantment : enchantments.keySet()) { - if (!ignoredEnchantments.get().contains(enchantment)) { + if (shownEnchantments.get().contains(enchantment)) { enchantmentsToShow.put(enchantment, enchantments.get(enchantment)); } } @@ -483,7 +512,7 @@ private void renderNametagPlayer(PlayerEntity player, boolean shadow) { x += itemWidths[i]; } - } else if (displayItemEnchants.get()) displayItemEnchants.set(false); + } else if (displayEnchants.get()) displayEnchants.set(false); NametagUtils.end(); } @@ -509,7 +538,7 @@ private void renderNametagItem(ItemStack stack, boolean shadow) { double hX = -widthHalf; double hY = -heightDown; - hX = text.render(name, hX, hY, names.get(), shadow); + hX = text.render(name, hX, hY, nameColor.get(), shadow); if (itemCount.get()) text.render(count, hX, hY, GOLD, shadow); text.end(); @@ -549,7 +578,7 @@ private void renderGenericNametag(LivingEntity entity, boolean shadow) { double hX = -widthHalf; double hY = -heightDown; - hX = text.render(nameText, hX, hY, names.get(), shadow); + hX = text.render(nameText, hX, hY, nameColor.get(), shadow); text.render(healthText, hX, hY, healthColor, shadow); text.end(); @@ -573,7 +602,7 @@ private void renderTntNametag(TntEntity entity, boolean shadow) { double hX = -widthHalf; double hY = -heightDown; - text.render(fuseText, hX, hY, names.get(), shadow); + text.render(fuseText, hX, hY, nameColor.get(), shadow); text.end(); NametagUtils.end(); @@ -603,7 +632,7 @@ public enum Position { } public boolean excludeBots() { - return excludeBots.get(); + return ignoreBots.get(); } public boolean playerNametags() { From 2ca1c399357209e3fe9ec691153a319626e17e14 Mon Sep 17 00:00:00 2001 From: RacoonDog <32882447+RacoonDog@users.noreply.github.com> Date: Wed, 28 Dec 2022 16:51:46 -0500 Subject: [PATCH 024/135] use try with resources --- .../systems/commands/arguments/NotebotSongArgumentType.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/NotebotSongArgumentType.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/NotebotSongArgumentType.java index 33cca861f4..784b565a78 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/NotebotSongArgumentType.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/NotebotSongArgumentType.java @@ -37,8 +37,8 @@ public Path parse(StringReader reader) throws CommandSyntaxException { @Override public CompletableFuture listSuggestions(CommandContext context, SuggestionsBuilder builder) { - try { - return CommandSource.suggestMatching(Files.list(MeteorClient.FOLDER.toPath().resolve("notebot")) + try (var suggestions = Files.list(MeteorClient.FOLDER.toPath().resolve("notebot"))) { + return CommandSource.suggestMatching(suggestions .filter(SongDecoders::hasDecoder) .map(path -> path.getFileName().toString()), builder From 17e2dfdb97dd184bfe29fde1f82071b4345bf5ad Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Sun, 25 Dec 2022 17:10:42 +0800 Subject: [PATCH 025/135] Update anti packet kick mixins to accept large packets instead of throwing it --- .../mixin/ClientConnectionMixin.java | 8 ------- .../mixin/CustomPayloadS2CPacketMixin.java | 21 ++++++++++++++++++ .../mixin/PacketByteBufMixin.java | 22 +++++++++++++++++++ .../mixin/PacketInflaterMixin.java | 21 ++++++++++++++++++ src/main/resources/meteor-client.mixins.json | 3 +++ 5 files changed, 67 insertions(+), 8 deletions(-) create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/CustomPayloadS2CPacketMixin.java create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/PacketByteBufMixin.java create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/PacketInflaterMixin.java diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ClientConnectionMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ClientConnectionMixin.java index 6608801bde..9db3fbcc58 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ClientConnectionMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ClientConnectionMixin.java @@ -5,12 +5,10 @@ package meteordevelopment.meteorclient.mixin; -import io.netty.channel.ChannelHandlerContext; import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.events.packets.PacketEvent; import meteordevelopment.meteorclient.events.world.ConnectToServerEvent; import meteordevelopment.meteorclient.systems.modules.Modules; -import meteordevelopment.meteorclient.systems.modules.misc.AntiPacketKick; import meteordevelopment.meteorclient.systems.modules.world.HighwayBuilder; import net.minecraft.network.ClientConnection; import net.minecraft.network.Packet; @@ -24,7 +22,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.io.IOException; import java.net.InetSocketAddress; @Mixin(ClientConnection.class) @@ -49,11 +46,6 @@ private static void onConnect(InetSocketAddress address, boolean useEpoll, Callb MeteorClient.EVENT_BUS.post(ConnectToServerEvent.get()); } - @Inject(method = "exceptionCaught", at = @At("HEAD"), cancellable = true) - private void exceptionCaught(ChannelHandlerContext context, Throwable throwable, CallbackInfo ci) { - if (throwable instanceof IOException && Modules.get().isActive(AntiPacketKick.class)) ci.cancel(); - } - @Inject(at = @At("HEAD"), method = "send(Lnet/minecraft/network/Packet;)V", cancellable = true) private void onSendPacketHead(Packet packet, CallbackInfo info) { if (MeteorClient.EVENT_BUS.post(PacketEvent.Send.get(packet)).isCancelled()) info.cancel(); diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/CustomPayloadS2CPacketMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/CustomPayloadS2CPacketMixin.java new file mode 100644 index 0000000000..553e0fe18e --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/CustomPayloadS2CPacketMixin.java @@ -0,0 +1,21 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.misc.AntiPacketKick; +import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.Constant; +import org.spongepowered.asm.mixin.injection.ModifyConstant; + +@Mixin(CustomPayloadS2CPacket.class) +public class CustomPayloadS2CPacketMixin { + @ModifyConstant(method = "", constant = @Constant(intValue = 1048576)) + private int maxValue(int value) { + return Modules.get().isActive(AntiPacketKick.class) ? Integer.MAX_VALUE : value; + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/PacketByteBufMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/PacketByteBufMixin.java new file mode 100644 index 0000000000..78401930af --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/PacketByteBufMixin.java @@ -0,0 +1,22 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.misc.AntiPacketKick; +import net.minecraft.nbt.NbtTagSizeTracker; +import net.minecraft.network.PacketByteBuf; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyArg; + +@Mixin(PacketByteBuf.class) +public class PacketByteBufMixin { + @ModifyArg(method = "readNbt()Lnet/minecraft/nbt/NbtCompound;", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/PacketByteBuf;readNbt(Lnet/minecraft/nbt/NbtTagSizeTracker;)Lnet/minecraft/nbt/NbtCompound;")) + private NbtTagSizeTracker xlPackets(NbtTagSizeTracker sizeTracker) { + return Modules.get().isActive(AntiPacketKick.class) ? NbtTagSizeTracker.EMPTY : sizeTracker; + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/PacketInflaterMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/PacketInflaterMixin.java new file mode 100644 index 0000000000..049bb87cd0 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/PacketInflaterMixin.java @@ -0,0 +1,21 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.misc.AntiPacketKick; +import net.minecraft.network.PacketInflater; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.Constant; +import org.spongepowered.asm.mixin.injection.ModifyConstant; + +@Mixin(PacketInflater.class) +public class PacketInflaterMixin { + @ModifyConstant(method = "decode", constant = @Constant(intValue = 8388608)) + private int maxValue(int value) { + return Modules.get().isActive(AntiPacketKick.class) ? Integer.MAX_VALUE : value; + } +} diff --git a/src/main/resources/meteor-client.mixins.json b/src/main/resources/meteor-client.mixins.json index d530d323f4..d7fe44e493 100644 --- a/src/main/resources/meteor-client.mixins.json +++ b/src/main/resources/meteor-client.mixins.json @@ -63,6 +63,7 @@ "CreativeSlotMixin", "CrossbowItemAccessor", "CustomPayloadC2SPacketAccessor", + "CustomPayloadS2CPacketMixin", "DefaultSkinHelperMixin", "DisconnectedScreenMixin", "EnchantingTableBlockEntityRendererMixin", @@ -113,6 +114,8 @@ "MobSpawnerBlockEntityRendererMixin", "MouseMixin", "MultiplayerScreenMixin", + "PacketInflaterMixin", + "PacketByteBufMixin", "ParticleManagerMixin", "PlayerArmorSlotMixin", "PlayerEntityMixin", From 2c4e93e344e4028dfbea59712a494f4e496bd9bf Mon Sep 17 00:00:00 2001 From: Soda-dcd <62250232+ThebestkillerTBK@users.noreply.github.com> Date: Sat, 31 Dec 2022 23:11:03 +0800 Subject: [PATCH 026/135] No Slow Update (#3108) --- .../player/CobwebEntityCollisionEvent.java | 24 ------------- .../meteorclient/mixin/BlockMixin.java | 4 +++ .../meteorclient/mixin/CobwebBlockMixin.java | 10 +++--- .../meteorclient/mixin/PlayerEntityMixin.java | 17 +++++++++ .../mixin/SweetBerryBushBlockMixin.java | 28 +++++++++++++++ .../systems/modules/movement/NoSlow.java | 36 ++++++++++++++----- src/main/resources/meteor-client.mixins.json | 1 + 7 files changed, 83 insertions(+), 37 deletions(-) delete mode 100644 src/main/java/meteordevelopment/meteorclient/events/entity/player/CobwebEntityCollisionEvent.java create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/SweetBerryBushBlockMixin.java diff --git a/src/main/java/meteordevelopment/meteorclient/events/entity/player/CobwebEntityCollisionEvent.java b/src/main/java/meteordevelopment/meteorclient/events/entity/player/CobwebEntityCollisionEvent.java deleted file mode 100644 index 662a700cd7..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/events/entity/player/CobwebEntityCollisionEvent.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.events.entity.player; - -import meteordevelopment.meteorclient.events.Cancellable; -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; - -public class CobwebEntityCollisionEvent extends Cancellable { - private static final CobwebEntityCollisionEvent INSTANCE = new CobwebEntityCollisionEvent(); - - public BlockState state; - public BlockPos blockPos; - - public static CobwebEntityCollisionEvent get(BlockState state, BlockPos blockPos) { - INSTANCE.setCancelled(false); - INSTANCE.state = state; - INSTANCE.blockPos = blockPos; - return INSTANCE; - } -} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/BlockMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/BlockMixin.java index e231337e93..b9e5ebd376 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/BlockMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/BlockMixin.java @@ -6,11 +6,13 @@ package meteordevelopment.meteorclient.mixin; import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.movement.NoSlow; import meteordevelopment.meteorclient.systems.modules.movement.Slippy; import meteordevelopment.meteorclient.systems.modules.render.Xray; import net.minecraft.block.AbstractBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; import net.minecraft.item.ItemConvertible; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -46,5 +48,7 @@ public void getSlipperiness(CallbackInfoReturnable info) { if (slippy.isActive() && !slippy.ignoredBlocks.get().contains(block)) { info.setReturnValue(slippy.friction.get().floatValue()); } + + if (block == Blocks.SLIME_BLOCK && Modules.get().get(NoSlow.class).slimeBlock()) info.setReturnValue(0.6F); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/CobwebBlockMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/CobwebBlockMixin.java index 340982b0aa..59c0655bf6 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/CobwebBlockMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/CobwebBlockMixin.java @@ -5,8 +5,8 @@ package meteordevelopment.meteorclient.mixin; -import meteordevelopment.meteorclient.MeteorClient; -import meteordevelopment.meteorclient.events.entity.player.CobwebEntityCollisionEvent; +import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.movement.NoSlow; import net.minecraft.block.BlockState; import net.minecraft.block.CobwebBlock; import net.minecraft.entity.Entity; @@ -17,12 +17,12 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import static meteordevelopment.meteorclient.MeteorClient.mc; + @Mixin(CobwebBlock.class) public class CobwebBlockMixin { @Inject(method = "onEntityCollision", at = @At("HEAD"), cancellable = true) private void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity, CallbackInfo info) { - CobwebEntityCollisionEvent event = MeteorClient.EVENT_BUS.post(CobwebEntityCollisionEvent.get(state, pos)); - - if (event.isCancelled()) info.cancel(); + if (entity == mc.player && Modules.get().get(NoSlow.class).cobweb()) info.cancel(); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityMixin.java index 50bcb7693d..f1fef3d181 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityMixin.java @@ -10,12 +10,14 @@ import meteordevelopment.meteorclient.events.entity.player.ClipAtLedgeEvent; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.movement.Anchor; +import meteordevelopment.meteorclient.systems.modules.movement.NoSlow; import meteordevelopment.meteorclient.systems.modules.player.SpeedMine; import meteordevelopment.meteorclient.utils.world.BlockUtils; import net.minecraft.block.BlockState; import net.minecraft.entity.EntityType; import net.minecraft.entity.ItemEntity; import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerAbilities; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.hit.BlockHitResult; @@ -23,6 +25,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -32,6 +35,9 @@ @Mixin(PlayerEntity.class) public abstract class PlayerEntityMixin extends LivingEntity { + @Shadow + public abstract PlayerAbilities getAbilities(); + protected PlayerEntityMixin(EntityType entityType, World world) { super(entityType, world); } @@ -73,4 +79,15 @@ public void dontJump(CallbackInfo info) { Anchor module = Modules.get().get(Anchor.class); if (module.isActive() && module.cancelJump) info.cancel(); } + + @Inject(method = "getMovementSpeed", at = @At("RETURN"), cancellable = true) + private void onGetMovementSpeed(CallbackInfoReturnable info) { + if (!Modules.get().get(NoSlow.class).slowness()) return; + float walkSpeed = getAbilities().getWalkSpeed(); + if (info.getReturnValueF() < walkSpeed) { + if (isSprinting()) info.setReturnValue((float) (walkSpeed * 1.30000001192092896)); + else info.setReturnValue(walkSpeed); + } + } + } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/SweetBerryBushBlockMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/SweetBerryBushBlockMixin.java new file mode 100644 index 0000000000..342e5f9cd8 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/SweetBerryBushBlockMixin.java @@ -0,0 +1,28 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.movement.NoSlow; +import net.minecraft.block.BlockState; +import net.minecraft.block.SweetBerryBushBlock; +import net.minecraft.entity.Entity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import static meteordevelopment.meteorclient.MeteorClient.mc; + +@Mixin(SweetBerryBushBlock.class) +public class SweetBerryBushBlockMixin { + @Inject(method = "onEntityCollision", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;slowMovement(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/Vec3d;)V"), cancellable = true) + private void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity, CallbackInfo info) { + if (entity == mc.player && Modules.get().get(NoSlow.class).berryBush()) info.cancel(); + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/NoSlow.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/NoSlow.java index 95d05cc648..979d9e88fe 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/NoSlow.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/NoSlow.java @@ -5,7 +5,6 @@ package meteordevelopment.meteorclient.systems.modules.movement; -import meteordevelopment.meteorclient.events.entity.player.CobwebEntityCollisionEvent; import meteordevelopment.meteorclient.events.world.TickEvent; import meteordevelopment.meteorclient.settings.*; import meteordevelopment.meteorclient.systems.modules.Categories; @@ -25,14 +24,14 @@ public class NoSlow extends Module { .build() ); - public final Setting web = sgGeneral.add(new EnumSetting.Builder() + private final Setting web = sgGeneral.add(new EnumSetting.Builder() .name("web") .description("Whether or not cobwebs will not slow you down.") .defaultValue(WebMode.Vanilla) .build() ); - public final Setting webTimer = sgGeneral.add(new IntSetting.Builder() + private final Setting webTimer = sgGeneral.add(new IntSetting.Builder() .name("web-timer") .description("The timer value for WebMode Timer.") .defaultValue(10) @@ -44,14 +43,14 @@ public class NoSlow extends Module { private final Setting honeyBlock = sgGeneral.add(new BoolSetting.Builder() .name("honey-block") - .description("Whether or not Honey Block will not slow you down.") + .description("Whether or not honey blocks will not slow you down.") .defaultValue(true) .build() ); private final Setting soulSand = sgGeneral.add(new BoolSetting.Builder() .name("soul-sand") - .description("Whether or not Soul Sand will not slow you down.") + .description("Whether or not soul sand will not slow you down.") .defaultValue(true) .build() ); @@ -63,6 +62,13 @@ public class NoSlow extends Module { .build() ); + private final Setting berryBush = sgGeneral.add(new BoolSetting.Builder() + .name("berry-bush") + .description("Whether or not berry bushes will not slow you down.") + .defaultValue(true) + .build() + ); + private final Setting airStrict = sgGeneral.add(new BoolSetting.Builder() .name("air-strict") .description("Will attempt to bypass anti-cheats like 2b2t's. Only works while in air.") @@ -77,6 +83,13 @@ public class NoSlow extends Module { .build() ); + private final Setting slowness = sgGeneral.add(new BoolSetting.Builder() + .name("slowness") + .description("Whether or not slowness will not slow you down.") + .defaultValue(false) + .build() + ); + private boolean resetTimer; public NoSlow() { @@ -108,13 +121,20 @@ public boolean slimeBlock() { return isActive() && slimeBlock.get(); } + public boolean cobweb() { + return isActive() && web.get() == WebMode.Vanilla; + } + + public boolean berryBush() { + return isActive() && berryBush.get(); + } + public boolean sneaking() { return isActive() && sneaking.get(); } - @EventHandler - private void onWebEntityCollision(CobwebEntityCollisionEvent event) { - if (web.get() == WebMode.Vanilla) event.cancel(); + public boolean slowness() { + return isActive() && slowness.get(); } @EventHandler diff --git a/src/main/resources/meteor-client.mixins.json b/src/main/resources/meteor-client.mixins.json index d7fe44e493..62a19f7252 100644 --- a/src/main/resources/meteor-client.mixins.json +++ b/src/main/resources/meteor-client.mixins.json @@ -148,6 +148,7 @@ "SplashTextResourceSupplierMixin", "StatusEffectInstanceAccessor", "StatusEffectInstanceMixin", + "SweetBerryBushBlockMixin", "TextHandlerAccessor", "TextVisitFactoryMixin", "TitleScreenMixin", From 8db1ec69919c362035dd11fa4861f9a23db48f94 Mon Sep 17 00:00:00 2001 From: RacoonDog <32882447+RacoonDog@users.noreply.github.com> Date: Sat, 31 Dec 2022 10:32:15 -0500 Subject: [PATCH 027/135] Cleaner HUD crash fix (#3126) --- .../meteorclient/systems/hud/elements/CombatHud.java | 6 ++++-- .../meteorclient/systems/hud/elements/PlayerModelHud.java | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/CombatHud.java b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/CombatHud.java index cb475454e5..70fa9f3b89 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/CombatHud.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/CombatHud.java @@ -196,16 +196,18 @@ public void render(HudRenderer renderer) { Color primaryColor = TextHud.getSectionColor(0); Color secondaryColor = TextHud.getSectionColor(1); - if (isInEditor()) playerEntity = FakeClientPlayer.getPlayer(); + if (isInEditor()) playerEntity = mc.player; else playerEntity = TargetUtils.getPlayerTarget(range.get(), SortPriority.LowestDistance); - if (playerEntity == null) return; + if (playerEntity == null && !isInEditor()) return; // Background Renderer2D.COLOR.begin(); Renderer2D.COLOR.quad(x, y, getWidth(), getHeight(), backgroundColor.get()); Renderer2D.COLOR.render(null); + if (playerEntity == null) return; + // Player Model InventoryScreen.drawEntity( (int) (x + (25 * scale.get())), diff --git a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/PlayerModelHud.java b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/PlayerModelHud.java index 43cc608dce..8eb4b214e0 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/PlayerModelHud.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/PlayerModelHud.java @@ -10,7 +10,6 @@ import meteordevelopment.meteorclient.systems.hud.HudElement; import meteordevelopment.meteorclient.systems.hud.HudElementInfo; import meteordevelopment.meteorclient.systems.hud.HudRenderer; -import meteordevelopment.meteorclient.utils.misc.FakeClientPlayer; import meteordevelopment.meteorclient.utils.render.color.SettingColor; import net.minecraft.client.gui.screen.ingame.InventoryScreen; import net.minecraft.entity.player.PlayerEntity; @@ -96,7 +95,7 @@ public void render(HudRenderer renderer) { renderer.post(() -> { PlayerEntity player = mc.player; - if (isInEditor()) player = FakeClientPlayer.getPlayer(); + if (player == null) return; float yaw = copyYaw.get() ? MathHelper.wrapDegrees(player.prevYaw + (player.getYaw() - player.prevYaw) * mc.getTickDelta()) : (float) customYaw.get(); float pitch = copyPitch.get() ? player.getPitch() : (float) customPitch.get(); From 07d93c8f6f8d078a5b19a561d61e3270158259c4 Mon Sep 17 00:00:00 2001 From: Wide-Cat Date: Sat, 31 Dec 2022 23:48:47 +0000 Subject: [PATCH 028/135] fix the enchant command crashing --- .../systems/commands/commands/EnchantCommand.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/EnchantCommand.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/EnchantCommand.java index c72164e5d7..ace8bffd01 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/EnchantCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/EnchantCommand.java @@ -20,6 +20,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.registry.Registries; import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.text.Text; import java.util.function.Function; @@ -89,8 +90,8 @@ public void build(LiteralArgumentBuilder builder) { private void one(CommandContext context, Function level) throws CommandSyntaxException { ItemStack itemStack = tryGetItemStack(); - Enchantment enchantment = context.getArgument("enchantment", Enchantment.class); - Utils.addEnchantment(itemStack, enchantment, level.apply(enchantment)); + RegistryEntry.Reference enchantment = context.getArgument("enchantment", RegistryEntry.Reference.class); + Utils.addEnchantment(itemStack, enchantment.value(), level.apply(enchantment.value())); syncItem(); } From fc3515b12eec41fdb419069050de51903d6b0e38 Mon Sep 17 00:00:00 2001 From: RacoonDog <32882447+RacoonDog@users.noreply.github.com> Date: Mon, 2 Jan 2023 06:59:02 -0500 Subject: [PATCH 029/135] Fix crash in Discord Presence (#3142) --- .../systems/modules/misc/DiscordPresence.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/DiscordPresence.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/DiscordPresence.java index 5a14d46108..cc82297167 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/DiscordPresence.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/DiscordPresence.java @@ -257,13 +257,15 @@ private void onTick(TickEvent.Post event) { else if (mc.currentScreen instanceof CreditsScreen) rpc.setState("Reading credits"); else if (mc.currentScreen instanceof RealmsScreen) rpc.setState("Browsing Realms"); else { - String className = mc.currentScreen.getClass().getName(); boolean setState = false; - for (var pair : customStates) { - if (className.startsWith(pair.getLeft())) { - rpc.setState(pair.getRight()); - setState = true; - break; + if (mc.currentScreen != null) { + String className = mc.currentScreen.getClass().getName(); + for (var pair : customStates) { + if (className.startsWith(pair.getLeft())) { + rpc.setState(pair.getRight()); + setState = true; + break; + } } } if (!setState) rpc.setState("In main menu"); From 7072a453358705215a2c5f2e375159af826edb01 Mon Sep 17 00:00:00 2001 From: nwroot Date: Sat, 7 Jan 2023 12:04:32 -0300 Subject: [PATCH 030/135] Fix the donation link (was 404'ing before) (#3156) [skip ci] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eb94dda089..92292a6032 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Please provide as much information as you can to best help us understand your is All of our work is completely free and non-profit, therefore we are very grateful for all donations made to help support us in running our community. All of the money made through donations is used to pay for our servers, none of it is taken for profit. -Donations can be made via our [website](https://meteorclient.com/donations) and the minimum amount to get donor benefits is €5. +Donations can be made via our [website](https://meteorclient.com/donate) and the minimum amount to get donor benefits is €5. You will be rewarded with a role on our Discord server, an in-game cape, and an extra kit as well as donor status on our [PvP server](https://namemc.com/server/pvp.meteorclient.com). ⚠️ _Make sure to create a Meteor account and link your Discord and Minecraft accounts to fully experience your rewards._ ⚠️ From 85831f9e63c018f861a35a7e47fc79b67f19ec0d Mon Sep 17 00:00:00 2001 From: Wide-Cat Date: Sat, 7 Jan 2023 15:09:41 +0000 Subject: [PATCH 031/135] fix font screen enter action crashing if search returns no fonts --- .../meteorclient/gui/widgets/containers/WTable.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/meteordevelopment/meteorclient/gui/widgets/containers/WTable.java b/src/main/java/meteordevelopment/meteorclient/gui/widgets/containers/WTable.java index 858edaae21..fa8baecb9c 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/widgets/containers/WTable.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/widgets/containers/WTable.java @@ -65,6 +65,7 @@ public void removeRow(int i) { } public List> getRow(int i) { + if (i < 0 || i >= rows.size()) return null; return rows.get(i); } From 01786bf55094342a388ce993d9020eaf67f4ae2f Mon Sep 17 00:00:00 2001 From: Wide-Cat <74723656+Wide-Cat@users.noreply.github.com> Date: Sun, 8 Jan 2023 19:26:32 +0000 Subject: [PATCH 032/135] Fix .enchant remove crashing Did it in 2 minutes on my phone --- .../meteorclient/systems/commands/commands/EnchantCommand.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/EnchantCommand.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/EnchantCommand.java index ace8bffd01..17e33d383a 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/EnchantCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/EnchantCommand.java @@ -80,7 +80,8 @@ public void build(LiteralArgumentBuilder builder) { builder.then(literal("remove").then(argument("enchantment", RegistryEntryArgumentType.registryEntry(Commands.REGISTRY_ACCESS, RegistryKeys.ENCHANTMENT)).executes(context -> { ItemStack itemStack = tryGetItemStack(); - Utils.removeEnchantment(itemStack, context.getArgument("enchantment", Enchantment.class)); + RegistryEntry.Reference enchantment = context.getArgument("enchantment", RegistryEntry.Reference.class); + Utils.removeEnchantment(itemStack, enchantment.value()); syncItem(); return SINGLE_SUCCESS; From 52d2d4a656a730f1b06d01324f9caefdea0a8fe2 Mon Sep 17 00:00:00 2001 From: Lovecraft's_Cat <52252627+Lovecrafts-Cat@users.noreply.github.com> Date: Tue, 10 Jan 2023 18:01:19 +0100 Subject: [PATCH 033/135] Implement Alphabetical sorting for ActiveModules HUD (#3163) --- .../hud/elements/ActiveModulesHud.java | 44 ++++++++----------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/ActiveModulesHud.java b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/ActiveModulesHud.java index fad5e70d0f..4c9da3fd77 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/ActiveModulesHud.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/ActiveModulesHud.java @@ -137,7 +137,8 @@ public class ActiveModulesHud extends HudElement { private final List modules = new ArrayList<>(); private final Color rainbow = new Color(255, 255, 255); - private double rainbowHue1, rainbowHue2; + private double rainbowHue1; + private double rainbowHue2; private double prevX; private double prevTextLength; @@ -160,19 +161,10 @@ public void tick(HudRenderer renderer) { if (!hiddenModules.get().contains(module)) modules.add(module); } - modules.sort((o1, o2) -> { - double _1 = getModuleWidth(renderer, o1); - double _2 = getModuleWidth(renderer, o2); - - if (sort.get() == Sort.Smallest) { - double temp = _1; - _1 = _2; - _2 = temp; - } - - int a = Double.compare(_1, _2); - if (a == 0) return 0; - return a < 0 ? 1 : -1; + modules.sort((e1, e2) -> switch (sort.get()) { + case Alphabetical -> e1.title.compareTo(e2.title); + case Biggest -> Double.compare(getModuleWidth(renderer, e2), getModuleWidth(renderer, e1)); + case Smallest -> Double.compare(getModuleWidth(renderer, e1), getModuleWidth(renderer, e2)); }); double width = 0; @@ -220,22 +212,21 @@ private void renderModule(HudRenderer renderer, List modules, int index, Module module = modules.get(index); Color color = flatColor.get(); - ColorMode colorMode = this.colorMode.get(); - if (colorMode == ColorMode.Random) color = module.color; - else if (colorMode == ColorMode.Rainbow) { - rainbowHue2 += rainbowSpread.get(); - int c = java.awt.Color.HSBtoRGB((float) rainbowHue2, rainbowSaturation.get().floatValue(), rainbowBrightness.get().floatValue()); - - rainbow.r = Color.toRGBAR(c); - rainbow.g = Color.toRGBAG(c); - rainbow.b = Color.toRGBAB(c); - - color = rainbow; + switch (colorMode.get()) { + case Random -> color = module.color; + case Rainbow -> { + rainbowHue2 += rainbowSpread.get(); + int c = java.awt.Color.HSBtoRGB((float) rainbowHue2, rainbowSaturation.get().floatValue(), rainbowBrightness.get().floatValue()); + rainbow.r = Color.toRGBAR(c); + rainbow.g = Color.toRGBAG(c); + rainbow.b = Color.toRGBAB(c); + color = rainbow; + } } renderer.text(module.title, x, y, color, shadow.get()); - double emptySpace = renderer.textWidth(" ", shadow.get()); + double emptySpace = renderer.textWidth(" ", shadow.get()); double textHeight = renderer.textHeight(shadow.get()); double textLength = renderer.textWidth(module.title, shadow.get()); @@ -296,6 +287,7 @@ private double getModuleWidth(HudRenderer renderer, Module module) { } public enum Sort { + Alphabetical, Biggest, Smallest } From 3365571776dde9e90c1a129633eb9fd89d2c26e3 Mon Sep 17 00:00:00 2001 From: Soda5601 <62250232+ThebestkillerTBK@users.noreply.github.com> Date: Tue, 17 Jan 2023 02:16:35 +0800 Subject: [PATCH 034/135] SimpleOptionMixin Update and fix Random Sneaking issue (#3145) --- .../meteorclient/mixin/SimpleOptionMixin.java | 45 +++++-------------- .../mixininterface/ISimpleOption.java | 10 +++++ .../systems/commands/commands/FOVCommand.java | 3 +- 3 files changed, 24 insertions(+), 34 deletions(-) create mode 100644 src/main/java/meteordevelopment/meteorclient/mixininterface/ISimpleOption.java diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/SimpleOptionMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/SimpleOptionMixin.java index 8579431bd4..ee22308152 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/SimpleOptionMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/SimpleOptionMixin.java @@ -5,51 +5,30 @@ package meteordevelopment.meteorclient.mixin; -import com.mojang.serialization.Codec; +import meteordevelopment.meteorclient.mixininterface.ISimpleOption; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.option.GameOptions; import net.minecraft.client.option.SimpleOption; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import java.util.Objects; import java.util.function.Consumer; @Mixin(SimpleOption.class) -public class SimpleOptionMixin { - @Shadow T value; +public class SimpleOptionMixin implements ISimpleOption { + @Shadow Object value; + @Shadow @Final private Consumer changeCallback; - @Shadow @Final - private Consumer changeCallback; - - @Inject(method = "setValue", at = @At("HEAD"), cancellable = true) - private void onSetValue(T value, CallbackInfo info) { - GameOptions options = MinecraftClient.getInstance().options; - if (options == null) return; - - if ((Object) this == options.getGamma() || (Object) this == options.getFov()) { + @Override + public void set(Object value) { + if (!MinecraftClient.getInstance().isRunning()) { this.value = value; - - if (MinecraftClient.getInstance().isRunning()) { - changeCallback.accept(value); + } else { + if (!Objects.equals(this.value, value)) { + this.value = value; + this.changeCallback.accept(this.value); } - - info.cancel(); - } - } - - @SuppressWarnings("unchecked") - @Inject(method = "getCodec", at = @At("HEAD"), cancellable = true) - public void onGetCodec(CallbackInfoReturnable> info) { - GameOptions options = MinecraftClient.getInstance().options; - if (options == null) return; - - if ((Object) this == options.getGamma()) { - info.setReturnValue((Codec) Codec.DOUBLE); } } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixininterface/ISimpleOption.java b/src/main/java/meteordevelopment/meteorclient/mixininterface/ISimpleOption.java new file mode 100644 index 0000000000..12ebbebd21 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixininterface/ISimpleOption.java @@ -0,0 +1,10 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixininterface; + +public interface ISimpleOption { + void set(Object value); +} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FOVCommand.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FOVCommand.java index 1ed59250fe..0d7e9aeaae 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FOVCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FOVCommand.java @@ -7,6 +7,7 @@ import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import meteordevelopment.meteorclient.mixininterface.ISimpleOption; import meteordevelopment.meteorclient.systems.commands.Command; import net.minecraft.command.CommandSource; @@ -20,7 +21,7 @@ public FOVCommand() { @Override public void build(LiteralArgumentBuilder builder) { builder.then(argument("fov", IntegerArgumentType.integer(0, 180)).executes(context -> { - mc.options.getFov().setValue(context.getArgument("fov", Integer.class)); + ((ISimpleOption) (Object) mc.options.getFov()).set(context.getArgument("fov", Integer.class)); return SINGLE_SUCCESS; })); } From 8341183d6dc7b1c975659918325bda17650a60d3 Mon Sep 17 00:00:00 2001 From: EpicPlayerA10 <62206933+EpicPlayerA10@users.noreply.github.com> Date: Mon, 16 Jan 2023 19:17:26 +0100 Subject: [PATCH 035/135] Notebot - Add sanity checks and remove debugging (#3180) --- .../commands/arguments/NotebotSongArgumentType.java | 1 - .../meteorclient/utils/notebot/decoder/NBSSongDecoder.java | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/NotebotSongArgumentType.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/NotebotSongArgumentType.java index 784b565a78..e0582073f2 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/NotebotSongArgumentType.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/NotebotSongArgumentType.java @@ -31,7 +31,6 @@ public static NotebotSongArgumentType create() { public Path parse(StringReader reader) throws CommandSyntaxException { final String text = reader.getRemaining(); reader.setCursor(reader.getTotalLength()); - System.out.println("READER: " + text); return MeteorClient.FOLDER.toPath().resolve("notebot/" + text); } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/NBSSongDecoder.java b/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/NBSSongDecoder.java index ec282271ab..89e8941d14 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/NBSSongDecoder.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/NBSSongDecoder.java @@ -162,6 +162,13 @@ private static int readInt(DataInputStream dataInputStream) throws IOException { private static String readString(DataInputStream dataInputStream) throws IOException { int length = readInt(dataInputStream); + if (length < 0) { + throw new EOFException("Length can't be negative! Length: " + length); + } + if (length > dataInputStream.available()) { + throw new EOFException("Can't read string that is larger than a buffer! Length: " + length + " Readable Bytes Length: " + dataInputStream.available()); + } + StringBuilder builder = new StringBuilder(length); for (; length > 0; --length) { char c = (char) dataInputStream.readByte(); From b1f762d63b0da81451829e65f26a23aaa6b2dc3a Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Thu, 12 Jan 2023 20:54:00 +0800 Subject: [PATCH 036/135] Fix AntiAFK Display issue motor client --- .../meteorclient/systems/modules/movement/AntiAFK.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/AntiAFK.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/AntiAFK.java index d3f9a4a8ca..1ab24dfebe 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/AntiAFK.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/AntiAFK.java @@ -230,6 +230,7 @@ public WWidget getWidget(GuiTheme theme) { private void fillTable(GuiTheme theme, WTable table) { table.add(theme.horizontalSeparator("Message List")).expandX(); + table.row(); // Messages for (int i = 0; i < messages.size(); i++) { From a9af2048c8f77fae8f0e188c9f5784600526dbcc Mon Sep 17 00:00:00 2001 From: DesiCow <80271842+DesiCow@users.noreply.github.com> Date: Mon, 16 Jan 2023 23:49:56 +0530 Subject: [PATCH 037/135] Added "NoBeaconBeams" to NoRender module (#3185) --- .../mixin/BeaconBlockEntityRendererMixin.java | 25 +++++++++++++++++++ .../systems/modules/render/NoRender.java | 11 ++++++++ src/main/resources/meteor-client.mixins.json | 1 + 3 files changed, 37 insertions(+) create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/BeaconBlockEntityRendererMixin.java diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/BeaconBlockEntityRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/BeaconBlockEntityRendererMixin.java new file mode 100644 index 0000000000..32d90dacff --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/BeaconBlockEntityRendererMixin.java @@ -0,0 +1,25 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.render.NoRender; +import net.minecraft.block.entity.BeaconBlockEntity; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.block.entity.BeaconBlockEntityRenderer; +import net.minecraft.client.util.math.MatrixStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(BeaconBlockEntityRenderer.class) +public class BeaconBlockEntityRendererMixin { + @Inject(method = "render", at = @At("HEAD"), cancellable = true) + private void onRender(BeaconBlockEntity beaconBlockEntity, float f, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, int j, CallbackInfo info) { + if (Modules.get().get(NoRender.class).noBeaconBeams()) info.cancel(); + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/NoRender.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/NoRender.java index 22a3cf7851..8449f2d932 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/NoRender.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/NoRender.java @@ -227,6 +227,13 @@ public class NoRender extends Module { .build() ); + private final Setting noBeaconBeams = sgWorld.add(new BoolSetting.Builder() + .name("beacon-beams") + .description("Disables rendering of beacon beams.") + .defaultValue(false) + .build() + ); + private final Setting noFallingBlocks = sgWorld.add(new BoolSetting.Builder() .name("falling-blocks") .description("Disables rendering of falling blocks.") @@ -454,6 +461,10 @@ public boolean noSkylightUpdates() { return isActive() && noSkylightUpdates.get(); } + public boolean noBeaconBeams() { + return isActive() && noBeaconBeams.get(); + } + public boolean noFallingBlocks() { return isActive() && noFallingBlocks.get(); } diff --git a/src/main/resources/meteor-client.mixins.json b/src/main/resources/meteor-client.mixins.json index 62a19f7252..f5b7739733 100644 --- a/src/main/resources/meteor-client.mixins.json +++ b/src/main/resources/meteor-client.mixins.json @@ -14,6 +14,7 @@ "ArmorFeatureRendererMixin", "BackgroundRendererMixin", "BannerBlockEntityRendererMixin", + "BeaconBlockEntityRendererMixin", "BeaconScreenMixin", "BiomeColorsMixin", "BlockCollisionSpliteratorMixin", From 7d2bd52733603830c1148bbc1b041e059b94c25f Mon Sep 17 00:00:00 2001 From: Lovecraft's_Cat <52252627+Lovecrafts-Cat@users.noreply.github.com> Date: Mon, 23 Jan 2023 23:46:01 +0100 Subject: [PATCH 038/135] EntityTypeListSetting: implement filter like in other filtered settings (#3210) --- .../settings/EntityTypeListSettingScreen.java | 4 ++-- .../settings/EntityTypeListSetting.java | 21 ++++++++++++------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/EntityTypeListSettingScreen.java b/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/EntityTypeListSettingScreen.java index 12aa7991b1..4d8f23c0b6 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/EntityTypeListSettingScreen.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/EntityTypeListSettingScreen.java @@ -69,7 +69,7 @@ public void initWidgets() { for (EntityType entityType : setting.get().keySet()) { if (!setting.get().getBoolean(entityType)) continue; - if (!setting.onlyAttackable || EntityUtils.isAttackable(entityType)) { + if (setting.filter == null || setting.filter.test(entityType)) { switch (entityType.getSpawnGroup()) { case CREATURE -> hasAnimal++; case WATER_AMBIENT, WATER_CREATURE, UNDERGROUND_WATER_CREATURE, AXOLOTLS -> hasWaterAnimal++; @@ -133,7 +133,7 @@ public void initWidgets() { miscT = misc.add(theme.table()).expandX().widget(); Consumer> entityTypeForEach = entityType -> { - if (!setting.onlyAttackable || EntityUtils.isAttackable(entityType)) { + if (setting.filter == null || setting.filter.test(entityType)) { switch (entityType.getSpawnGroup()) { case CREATURE -> { animalsE.add(entityType); diff --git a/src/main/java/meteordevelopment/meteorclient/settings/EntityTypeListSetting.java b/src/main/java/meteordevelopment/meteorclient/settings/EntityTypeListSetting.java index b863a6d241..b6a10a0277 100644 --- a/src/main/java/meteordevelopment/meteorclient/settings/EntityTypeListSetting.java +++ b/src/main/java/meteordevelopment/meteorclient/settings/EntityTypeListSetting.java @@ -18,15 +18,15 @@ import net.minecraft.util.Identifier; import java.util.function.Consumer; +import java.util.function.Predicate; -// TODO: Change onlyAttackable to a filter public class EntityTypeListSetting extends Setting>> { - public final boolean onlyAttackable; + public final Predicate> filter; - public EntityTypeListSetting(String name, String description, Object2BooleanMap> defaultValue, Consumer>> onChanged, Consumer>>> onModuleActivated, IVisible visible, boolean onlyAttackable) { + public EntityTypeListSetting(String name, String description, Object2BooleanMap> defaultValue, Consumer>> onChanged, Consumer>>> onModuleActivated, IVisible visible, Predicate> filter) { super(name, description, defaultValue, onChanged, onModuleActivated, visible); - this.onlyAttackable = onlyAttackable; + this.filter = filter; } @Override @@ -79,14 +79,14 @@ public Object2BooleanMap> load(NbtCompound tag) { NbtList valueTag = tag.getList("value", 8); for (NbtElement tagI : valueTag) { EntityType type = Registries.ENTITY_TYPE.get(new Identifier(tagI.asString())); - if (!onlyAttackable || EntityUtils.isAttackable(type)) get().put(type, true); + if (filter == null || filter.test(type)) get().put(type, true); } return get(); } public static class Builder extends SettingBuilder>, EntityTypeListSetting> { - private boolean onlyAttackable = false; + private Predicate> filter; public Builder() { super(new Object2BooleanOpenHashMap<>(0)); @@ -97,13 +97,18 @@ public Builder defaultValue(EntityType... defaults) { } public Builder onlyAttackable() { - onlyAttackable = true; + filter = EntityUtils::isAttackable; + return this; + } + + public Builder filter(Predicate> filter){ + this.filter = filter; return this; } @Override public EntityTypeListSetting build() { - return new EntityTypeListSetting(name, description, defaultValue, onChanged, onModuleActivated, visible, onlyAttackable); + return new EntityTypeListSetting(name, description, defaultValue, onChanged, onModuleActivated, visible, filter); } } } From 131f5a45f2fc94c963cc3d4d24300cb5a50218c0 Mon Sep 17 00:00:00 2001 From: arlo Date: Wed, 25 Jan 2023 12:31:25 +0000 Subject: [PATCH 039/135] speed up loading time --- .../meteorclient/utils/ReflectInit.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/utils/ReflectInit.java b/src/main/java/meteordevelopment/meteorclient/utils/ReflectInit.java index 47ca5ca2b3..1baf3b15ad 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/ReflectInit.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/ReflectInit.java @@ -18,27 +18,31 @@ import java.util.stream.Collectors; public class ReflectInit { - private static final List packages = new ArrayList<>(); + private static final List reflections = new ArrayList<>(); public static void registerPackages() { - packages.add(MeteorClient.ADDON.getPackage()); + add(MeteorClient.ADDON); + for (MeteorAddon addon : AddonManager.ADDONS) { try { - String pkg = addon.getPackage(); - if (pkg != null && !pkg.isBlank()) { - packages.add(pkg); - } + add(addon); } catch (AbstractMethodError e) { throw new RuntimeException("Addon \"%s\" is too old and cannot be ran.".formatted(addon.name), e); } } } + private static void add(MeteorAddon addon) { + String pkg = addon.getPackage(); + if (pkg == null || pkg.isBlank()) return; + reflections.add(new Reflections(pkg, Scanners.MethodsAnnotated)); + } + public static void init(Class annotation) { - for (String pkg : packages) { - Reflections reflections = new Reflections(pkg, Scanners.MethodsAnnotated); - Set initTasks = reflections.getMethodsAnnotatedWith(annotation); + for (Reflections reflection : reflections) { + Set initTasks = reflection.getMethodsAnnotatedWith(annotation); if (initTasks == null) return; + Map, List> byClass = initTasks.stream().collect(Collectors.groupingBy(Method::getDeclaringClass)); Set left = new HashSet<>(initTasks); From 1792da425046fdcbdd07d94c157424b14baadec9 Mon Sep 17 00:00:00 2001 From: arlo Date: Wed, 25 Jan 2023 12:55:56 +0000 Subject: [PATCH 040/135] fix gui scaling on retina displays --- .../meteorclient/gui/themes/meteor/MeteorGuiTheme.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/gui/themes/meteor/MeteorGuiTheme.java b/src/main/java/meteordevelopment/meteorclient/gui/themes/meteor/MeteorGuiTheme.java index c740bae6d8..81be5995cd 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/themes/meteor/MeteorGuiTheme.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/themes/meteor/MeteorGuiTheme.java @@ -32,6 +32,7 @@ import meteordevelopment.meteorclient.utils.render.color.SettingColor; import static meteordevelopment.meteorclient.MeteorClient.mc; +import static net.minecraft.client.MinecraftClient.IS_SYSTEM_MAC; public class MeteorGuiTheme extends GuiTheme { private final SettingGroup sgGeneral = settings.getDefaultGroup(); @@ -357,7 +358,13 @@ public TextRenderer textRenderer() { @Override public double scale(double value) { - return value * scale.get(); + double scaled = value * scale.get(); + + if (IS_SYSTEM_MAC) { + scaled /= (double) mc.getWindow().getWidth() / mc.getWindow().getFramebufferWidth(); + } + + return scaled; } @Override From f4e8747b2e6c38f92e66b5b7f75ca68ef551665a Mon Sep 17 00:00:00 2001 From: arlo Date: Thu, 26 Jan 2023 12:56:41 +0000 Subject: [PATCH 041/135] fix weird keybind setting styling --- .../gui/DefaultSettingsWidgetFactory.java | 7 ++++++- .../meteorclient/gui/screens/ModuleScreen.java | 12 +++++++++++- .../gui/utils/SettingsWidgetFactory.java | 3 +-- .../meteorclient/gui/widgets/WKeybind.java | 12 ++---------- .../meteorclient/systems/hud/Hud.java | 4 ++-- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/gui/DefaultSettingsWidgetFactory.java b/src/main/java/meteordevelopment/meteorclient/gui/DefaultSettingsWidgetFactory.java index 379827e369..4e2e1e497a 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/DefaultSettingsWidgetFactory.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/DefaultSettingsWidgetFactory.java @@ -229,9 +229,14 @@ private void colorW(WTable table, ColorSetting setting) { } private void keybindW(WTable table, KeybindSetting setting) { - WKeybind keybind = table.add(theme.keybind(setting.get(), setting.getDefaultValue())).expandX().widget(); + WHorizontalList list = table.add(theme.horizontalList()).expandX().widget(); + + WKeybind keybind = list.add(theme.keybind(setting.get(), setting.getDefaultValue())).expandX().widget(); keybind.action = setting::onChanged; setting.widget = keybind; + + WButton reset = list.add(theme.button(GuiRenderer.RESET)).expandCellX().right().widget(); + reset.action = keybind::resetBind; } private void blockW(WTable table, BlockSetting setting) { diff --git a/src/main/java/meteordevelopment/meteorclient/gui/screens/ModuleScreen.java b/src/main/java/meteordevelopment/meteorclient/gui/screens/ModuleScreen.java index 46ab561b4e..d42a2f98ad 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/screens/ModuleScreen.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/screens/ModuleScreen.java @@ -8,12 +8,14 @@ import meteordevelopment.meteorclient.events.meteor.ModuleBindChangedEvent; import meteordevelopment.meteorclient.gui.GuiTheme; import meteordevelopment.meteorclient.gui.WindowScreen; +import meteordevelopment.meteorclient.gui.renderer.GuiRenderer; import meteordevelopment.meteorclient.gui.utils.Cell; import meteordevelopment.meteorclient.gui.widgets.WKeybind; import meteordevelopment.meteorclient.gui.widgets.WWidget; import meteordevelopment.meteorclient.gui.widgets.containers.WContainer; import meteordevelopment.meteorclient.gui.widgets.containers.WHorizontalList; import meteordevelopment.meteorclient.gui.widgets.containers.WSection; +import meteordevelopment.meteorclient.gui.widgets.pressable.WButton; import meteordevelopment.meteorclient.gui.widgets.pressable.WCheckbox; import meteordevelopment.meteorclient.gui.widgets.pressable.WFavorite; import meteordevelopment.meteorclient.systems.modules.Module; @@ -59,9 +61,17 @@ public void initWidgets() { // Bind WSection section = add(theme.section("Bind", true)).expandX().widget(); - keybind = section.add(theme.keybind(module.keybind)).expandX().widget(); + + // Keybind + WHorizontalList bind = section.add(theme.horizontalList()).expandX().widget(); + + bind.add(theme.label("Bind: ")); + keybind = bind.add(theme.keybind(module.keybind)).expandX().widget(); keybind.actionOnSet = () -> Modules.get().setModuleToBind(module); + WButton reset = bind.add(theme.button(GuiRenderer.RESET)).expandCellX().right().widget(); + reset.action = keybind::resetBind; + // Toggle on bind release WHorizontalList tobr = section.add(theme.horizontalList()).widget(); diff --git a/src/main/java/meteordevelopment/meteorclient/gui/utils/SettingsWidgetFactory.java b/src/main/java/meteordevelopment/meteorclient/gui/utils/SettingsWidgetFactory.java index ae5c238247..6e890fadf7 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/utils/SettingsWidgetFactory.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/utils/SettingsWidgetFactory.java @@ -5,7 +5,6 @@ package meteordevelopment.meteorclient.gui.utils; -import meteordevelopment.meteorclient.gui.DefaultSettingsWidgetFactory; import meteordevelopment.meteorclient.gui.GuiTheme; import meteordevelopment.meteorclient.gui.widgets.WWidget; import meteordevelopment.meteorclient.gui.widgets.containers.WTable; @@ -17,7 +16,7 @@ import java.util.function.Function; public abstract class SettingsWidgetFactory { - private static final Map, Function> customFactories = new HashMap<>(); + private static final Map, Function> customFactories = new HashMap<>(); protected final GuiTheme theme; protected final Map, Factory> factories = new HashMap<>(); diff --git a/src/main/java/meteordevelopment/meteorclient/gui/widgets/WKeybind.java b/src/main/java/meteordevelopment/meteorclient/gui/widgets/WKeybind.java index 3dc952d822..6115d26865 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/widgets/WKeybind.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/widgets/WKeybind.java @@ -5,7 +5,6 @@ package meteordevelopment.meteorclient.gui.widgets; -import meteordevelopment.meteorclient.gui.renderer.GuiRenderer; import meteordevelopment.meteorclient.gui.widgets.containers.WHorizontalList; import meteordevelopment.meteorclient.gui.widgets.pressable.WButton; import meteordevelopment.meteorclient.systems.modules.Modules; @@ -33,14 +32,11 @@ public void init() { WButton set = add(theme.button("Set")).widget(); set.action = () -> { listening = true; - label.set(appendBindText("...")); + label.set("..."); if (actionOnSet != null) actionOnSet.run(); }; - WButton reset = add(theme.button(GuiRenderer.RESET)).expandCellX().right().widget(); - reset.action = this::resetBind; - refreshLabel(); } @@ -69,10 +65,6 @@ public void reset() { } private void refreshLabel() { - label.set(appendBindText(keybind.toString())); - } - - private String appendBindText(String text) { - return "Bind: " + text; + label.set(keybind.toString()); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/hud/Hud.java b/src/main/java/meteordevelopment/meteorclient/systems/hud/Hud.java index c211a529e2..0be2713b1f 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/hud/Hud.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/hud/Hud.java @@ -37,7 +37,7 @@ public class Hud extends System implements Iterable { private final SettingGroup sgGeneral = settings.getDefaultGroup(); private final SettingGroup sgEditor = settings.createGroup("Editor"); - private final SettingGroup sgKeybind = settings.createGroup("Keybindings"); + private final SettingGroup sgKeybind = settings.createGroup("Bind"); // General @@ -87,7 +87,7 @@ public class Hud extends System implements Iterable { // Keybindings private final Setting keybind = sgKeybind.add(new KeybindSetting.Builder() - .name("keybind") + .name("bind") .defaultValue(Keybind.none()) .action(() -> active = !active) .build() From 4971b781358651d49b6c5fcf44114c2ed9084932 Mon Sep 17 00:00:00 2001 From: DesiCow Date: Wed, 18 Jan 2023 09:38:11 +0530 Subject: [PATCH 042/135] Added noObfuscation option to NoRender module --- .../meteorclient/mixin/TextRendererMixin.java | 21 +++++++++++++++++++ .../systems/modules/render/NoRender.java | 11 ++++++++++ src/main/resources/meteor-client.mixins.json | 3 ++- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/TextRendererMixin.java diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/TextRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/TextRendererMixin.java new file mode 100644 index 0000000000..d90845dc90 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/TextRendererMixin.java @@ -0,0 +1,21 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.render.NoRender; +import net.minecraft.text.Style; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(targets = "net.minecraft.client.font.TextRenderer$Drawer") +public class TextRendererMixin { + @Redirect(method = "accept", at = @At(value = "INVOKE", target = "Lnet/minecraft/text/Style;isObfuscated()Z")) + private boolean onRenderObfuscatedStyle(Style instance) { + return !Modules.get().get(NoRender.class).noObfuscation() && instance.isObfuscated(); + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/NoRender.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/NoRender.java index 8449f2d932..c94e74b607 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/NoRender.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/NoRender.java @@ -148,6 +148,13 @@ public class NoRender extends Module { .build() ); + private final Setting noObfuscation = sgHUD.add(new BoolSetting.Builder() + .name("obfuscation") + .description("Disables obfuscation styling of characters.") + .defaultValue(false) + .build() + ); + private final Setting noPotionIcons = sgHUD.add(new BoolSetting.Builder() .name("potion-icons") .description("Disables rendering of status effect icons.") @@ -415,6 +422,10 @@ public boolean noHeldItemName() { return isActive() && noHeldItemName.get(); } + public boolean noObfuscation() { + return isActive() && noObfuscation.get(); + } + public boolean noPotionIcons() { return isActive() && noPotionIcons.get(); } diff --git a/src/main/resources/meteor-client.mixins.json b/src/main/resources/meteor-client.mixins.json index f5b7739733..37d2c317ef 100644 --- a/src/main/resources/meteor-client.mixins.json +++ b/src/main/resources/meteor-client.mixins.json @@ -115,8 +115,8 @@ "MobSpawnerBlockEntityRendererMixin", "MouseMixin", "MultiplayerScreenMixin", - "PacketInflaterMixin", "PacketByteBufMixin", + "PacketInflaterMixin", "ParticleManagerMixin", "PlayerArmorSlotMixin", "PlayerEntityMixin", @@ -151,6 +151,7 @@ "StatusEffectInstanceMixin", "SweetBerryBushBlockMixin", "TextHandlerAccessor", + "TextRendererMixin", "TextVisitFactoryMixin", "TitleScreenMixin", "TridentItemMixin", From dba1addb7c6a93d2c373b0f747ccd3ad82812c40 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Sat, 21 Jan 2023 19:36:48 +0800 Subject: [PATCH 043/135] AutoSteal improvement #2254 Filter Fixed initial delay Steal drop and rotate --- .../systems/modules/misc/InventoryTweaks.java | 135 ++++++++++++++---- 1 file changed, 110 insertions(+), 25 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java index 7b8feb2ce5..5c441dc437 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java @@ -29,7 +29,10 @@ import net.minecraft.client.gui.screen.ingame.InventoryScreen; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.LivingEntity; -import net.minecraft.item.*; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Wearable; import net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket; import net.minecraft.screen.GenericContainerScreenHandler; import net.minecraft.screen.ScreenHandler; @@ -45,27 +48,21 @@ public class InventoryTweaks extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); private final SettingGroup sgSorting = settings.createGroup("Sorting"); private final SettingGroup sgAutoDrop = settings.createGroup("Auto Drop"); + private final SettingGroup sgStealDump = settings.createGroup("Steal and Dump"); private final SettingGroup sgAutoSteal = settings.createGroup("Auto Steal"); // General private final Setting mouseDragItemMove = sgGeneral.add(new BoolSetting.Builder() - .name("mouse-drag-item-move") - .description("Moving mouse over items while holding shift will transfer it to the other container.") - .defaultValue(true) - .build() + .name("mouse-drag-item-move") + .description("Moving mouse over items while holding shift will transfer it to the other container.") + .defaultValue(true) + .build() ); private final Setting> antiDropItems = sgGeneral.add(new ItemListSetting.Builder() - .name("anti-drop-items") - .description("Items to prevent dropping. Doesn't work in creative inventory screen.") - .build() - ); - - private final Setting buttons = sgGeneral.add(new BoolSetting.Builder() - .name("inventory-buttons") - .description("Shows steal and dump buttons in container guis.") - .defaultValue(true) + .name("anti-drop-items") + .description("Items to prevent dropping. Doesn't work in creative inventory screen.") .build() ); @@ -143,7 +140,57 @@ public class InventoryTweaks extends Module { .build() ); - // Auto steal + // Steal & Dump + + private final Setting buttons = sgStealDump.add(new BoolSetting.Builder() + .name("inventory-buttons") + .description("Shows steal and dump buttons in container guis.") + .defaultValue(true) + .build() + ); + + private final Setting stealDrop = sgStealDump.add(new BoolSetting.Builder() + .name("steal-drop") + .description("Drop items to the ground instead of stealing them.") + .defaultValue(false) + .build() + ); + + private final Setting dropBackwards = sgStealDump.add(new BoolSetting.Builder() + .name("drop-backwards") + .description("Drop items behind you.") + .defaultValue(false) + .visible(stealDrop::get) + .build() + ); + + private final Setting dumpFilter = sgStealDump.add(new EnumSetting.Builder() + .name("dump-filter") + .description("Dump mode.") + .defaultValue(ListMode.None) + .build() + ); + + private final Setting> dumpItems = sgStealDump.add(new ItemListSetting.Builder() + .name("dump-items") + .description("Items to dump.") + .build() + ); + + private final Setting stealFilter = sgStealDump.add(new EnumSetting.Builder() + .name("steal-filter") + .description("Steal mode.") + .defaultValue(ListMode.None) + .build() + ); + + private final Setting> stealItems = sgStealDump.add(new ItemListSetting.Builder() + .name("steal-items") + .description("Items to steal.") + .build() + ); + + // Auto Steal private final Setting autoSteal = sgAutoSteal.add(new BoolSetting.Builder() .name("auto-steal") @@ -169,6 +216,14 @@ public class InventoryTweaks extends Module { .build() ); + private final Setting autoStealInitDelay = sgAutoSteal.add(new IntSetting.Builder() + .name("initial-delay") + .description("The initial delay before stealing in milliseconds. 0 to use normal delay instead.") + .defaultValue(50) + .sliderMax(1000) + .build() + ); + private final Setting autoStealRandomDelay = sgAutoSteal.add(new IntSetting.Builder() .name("random") .description("Randomly adds a delay of up to the specified time in milliseconds.") @@ -178,7 +233,6 @@ public class InventoryTweaks extends Module { .build() ); - private InventorySorter sorter; private boolean invOpened; @@ -227,7 +281,8 @@ private void onMouseButton(MouseButtonEvent event) { } private boolean sort() { - if (!sortingEnabled.get() || !(mc.currentScreen instanceof HandledScreen screen) || sorter != null) return false; + if (!sortingEnabled.get() || !(mc.currentScreen instanceof HandledScreen screen) || sorter != null) + return false; if (!mc.player.currentScreenHandler.getCursorStack().isEmpty()) { FindItemResult empty = InvUtils.findEmpty(); @@ -296,7 +351,8 @@ private void onTickPost(TickEvent.Post event) { ItemStack itemStack = mc.player.getInventory().getStack(i); if (autoDropItems.get().contains(itemStack.getItem())) { - if (!autoDropOnlyFullStacks.get() || itemStack.getCount() == itemStack.getMaxCount()) InvUtils.drop().slot(i); + if (!autoDropOnlyFullStacks.get() || itemStack.getCount() == itemStack.getMaxCount()) + InvUtils.drop().slot(i); } } } @@ -335,11 +391,16 @@ private int getRows(ScreenHandler handler) { return (handler instanceof GenericContainerScreenHandler ? ((GenericContainerScreenHandler) handler).getRows() : 3); } - private void moveSlots(ScreenHandler handler, int start, int end) { + private void moveSlots(ScreenHandler handler, int start, int end, boolean steal) { + boolean initial = autoStealInitDelay.get() != 0; for (int i = start; i < end; i++) { if (!handler.getSlot(i).hasStack()) continue; - int sleep = getSleepTime(); + int sleep; + if (initial) { + sleep = autoStealInitDelay.get(); + initial = false; + } else sleep = getSleepTime(); if (sleep > 0) { try { Thread.sleep(sleep); @@ -348,20 +409,38 @@ private void moveSlots(ScreenHandler handler, int start, int end) { } } - // Exit if user closes screen - if (mc.currentScreen == null) break; + // Exit if user closes screen or exit world + if (mc.currentScreen == null || !Utils.canUpdate()) break; + + Item item = handler.getSlot(i).getStack().getItem(); + if (steal) { + if (stealFilter.get() == ListMode.Whitelist && !stealItems.get().contains(item)) + continue; + if (stealFilter.get() == ListMode.Blacklist && stealItems.get().contains(item)) + continue; + } else { + if (dumpFilter.get() == ListMode.Whitelist && !dumpItems.get().contains(item)) + continue; + if (dumpFilter.get() == ListMode.Blacklist && dumpItems.get().contains(item)) + continue; + } - InvUtils.quickMove().slotId(i); + if (steal && stealDrop.get()) { + if (dropBackwards.get()) { + int iCopy = i; + Rotations.rotate(mc.player.getYaw() - 180, mc.player.getPitch(), () -> InvUtils.drop().slotId(iCopy)); + } + } else InvUtils.quickMove().slotId(i); } } public void steal(ScreenHandler handler) { - MeteorExecutor.execute(() -> moveSlots(handler, 0, getRows(handler) * 9)); + MeteorExecutor.execute(() -> moveSlots(handler, 0, getRows(handler) * 9, true)); } public void dump(ScreenHandler handler) { int playerInvOffset = getRows(handler) * 9; - MeteorExecutor.execute(() -> moveSlots(handler, playerInvOffset, playerInvOffset + 4 * 9)); + MeteorExecutor.execute(() -> moveSlots(handler, playerInvOffset, playerInvOffset + 4 * 9, false)); } public boolean showButtons() { @@ -393,4 +472,10 @@ private void onInventory(InventoryEvent event) { } } } + + public enum ListMode { + Whitelist, + Blacklist, + None + } } From 7379d6fbbbb296177b374d3fd7cde47d7e06f02e Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Sun, 22 Jan 2023 01:52:38 +0800 Subject: [PATCH 044/135] hmm --- .../mixin/GenericContainerScreenMixin.java | 47 ------------------- .../mixin/HandledScreenMixin.java | 23 +++++++++ .../mixin/ShulkerBoxScreenMixin.java | 46 ------------------ .../systems/modules/misc/InventoryTweaks.java | 18 +++---- src/main/resources/meteor-client.mixins.json | 2 - 5 files changed, 29 insertions(+), 107 deletions(-) delete mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/GenericContainerScreenMixin.java delete mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/ShulkerBoxScreenMixin.java diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/GenericContainerScreenMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/GenericContainerScreenMixin.java deleted file mode 100644 index d7d9a90308..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/mixin/GenericContainerScreenMixin.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.mixin; - -import meteordevelopment.meteorclient.systems.modules.Modules; -import meteordevelopment.meteorclient.systems.modules.misc.InventoryTweaks; -import net.minecraft.client.gui.screen.ingame.GenericContainerScreen; -import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider; -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.GenericContainerScreenHandler; -import net.minecraft.text.Text; -import org.spongepowered.asm.mixin.Mixin; - -@Mixin(GenericContainerScreen.class) -public abstract class GenericContainerScreenMixin extends HandledScreen implements ScreenHandlerProvider { - public GenericContainerScreenMixin(GenericContainerScreenHandler container, PlayerInventory playerInventory, Text name) { - super(container, playerInventory, name); - } - - @Override - protected void init() { - super.init(); - - InventoryTweaks invTweaks = Modules.get().get(InventoryTweaks.class); - - if (invTweaks.isActive() && invTweaks.showButtons()) { - addDrawableChild( - new ButtonWidget.Builder(Text.literal("Steal"), button -> invTweaks.steal(handler)) - .position(x + backgroundWidth - 88, y + 3) - .size(40, 12) - .build() - ); - - addDrawableChild( - new ButtonWidget.Builder(Text.literal("Dump"), button -> invTweaks.dump(handler)) - .position(x + backgroundWidth - 46, y + 3) - .size(40, 12) - .build() - ); - } - } -} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/HandledScreenMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/HandledScreenMixin.java index 0788e6ea43..7faddc3cc5 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/HandledScreenMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/HandledScreenMixin.java @@ -13,6 +13,7 @@ import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider; +import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; @@ -21,6 +22,7 @@ import net.minecraft.screen.slot.SlotActionType; import net.minecraft.text.Text; import org.lwjgl.glfw.GLFW; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -52,6 +54,27 @@ public HandledScreenMixin(Text title) { super(title); } + @Inject(method = "init", at = @At("TAIL")) + private void onInit(CallbackInfo info) { + InventoryTweaks invTweaks = Modules.get().get(InventoryTweaks.class); + + if (invTweaks.isActive() && invTweaks.showButtons()) { + addDrawableChild( + new ButtonWidget.Builder(Text.literal("Steal"), button -> invTweaks.steal(getScreenHandler())) + .position(width / 2 - 40, 3) + .size(40, 20) + .build() + ); + + addDrawableChild( + new ButtonWidget.Builder(Text.literal("Dump"), button -> invTweaks.dump(getScreenHandler())) + .position(width / 2 - 40, 26) + .size(40, 20) + .build() + ); + } + } + // Inventory Tweaks @Inject(method = "mouseDragged", at = @At("TAIL")) private void onMouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY, CallbackInfoReturnable info) { diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ShulkerBoxScreenMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ShulkerBoxScreenMixin.java deleted file mode 100644 index ae9a35f5d4..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ShulkerBoxScreenMixin.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.mixin; - -import meteordevelopment.meteorclient.systems.modules.Modules; -import meteordevelopment.meteorclient.systems.modules.misc.InventoryTweaks; -import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.client.gui.screen.ingame.ShulkerBoxScreen; -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.ShulkerBoxScreenHandler; -import net.minecraft.text.Text; -import org.spongepowered.asm.mixin.Mixin; - -@Mixin(ShulkerBoxScreen.class) -public abstract class ShulkerBoxScreenMixin extends HandledScreen { - public ShulkerBoxScreenMixin(ShulkerBoxScreenHandler handler, PlayerInventory inventory, Text title) { - super(handler, inventory, title); - } - - @Override - protected void init() { - super.init(); - - InventoryTweaks invTweaks = Modules.get().get(InventoryTweaks.class); - - if (invTweaks.isActive() && invTweaks.showButtons()) { - addDrawableChild( - new ButtonWidget.Builder(Text.literal("Steal"), button -> invTweaks.steal(handler)) - .position(x + backgroundWidth - 88, y + 3) - .size(40, 12) - .build() - ); - - addDrawableChild( - new ButtonWidget.Builder(Text.literal("Dump"), button -> invTweaks.dump(handler)) - .position(x + backgroundWidth - 46, y + 3) - .size(40, 12) - .build() - ); - } - } -} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java index 5c441dc437..bc799b1453 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java @@ -387,10 +387,6 @@ private int getSleepTime() { return autoStealDelay.get() + (autoStealRandomDelay.get() > 0 ? ThreadLocalRandom.current().nextInt(0, autoStealRandomDelay.get()) : 0); } - private int getRows(ScreenHandler handler) { - return (handler instanceof GenericContainerScreenHandler ? ((GenericContainerScreenHandler) handler).getRows() : 3); - } - private void moveSlots(ScreenHandler handler, int start, int end, boolean steal) { boolean initial = autoStealInitDelay.get() != 0; for (int i = start; i < end; i++) { @@ -435,11 +431,11 @@ private void moveSlots(ScreenHandler handler, int start, int end, boolean steal) } public void steal(ScreenHandler handler) { - MeteorExecutor.execute(() -> moveSlots(handler, 0, getRows(handler) * 9, true)); + MeteorExecutor.execute(() -> moveSlots(handler, 0, SlotUtils.indexToId(handler.slots.size()), true)); } public void dump(ScreenHandler handler) { - int playerInvOffset = getRows(handler) * 9; + int playerInvOffset = SlotUtils.indexToId(SlotUtils.HOTBAR_START); MeteorExecutor.execute(() -> moveSlots(handler, playerInvOffset, playerInvOffset + 4 * 9, false)); } @@ -463,12 +459,10 @@ public boolean armorSwap() { private void onInventory(InventoryEvent event) { ScreenHandler handler = mc.player.currentScreenHandler; if (event.packet.getSyncId() == handler.syncId) { - if (handler instanceof GenericContainerScreenHandler || handler instanceof ShulkerBoxScreenHandler) { - if (autoSteal.get()) { - steal(handler); - } else if (autoDump.get()) { - dump(handler); - } + if (autoSteal.get()) { + steal(handler); + } else if (autoDump.get()) { + dump(handler); } } } diff --git a/src/main/resources/meteor-client.mixins.json b/src/main/resources/meteor-client.mixins.json index 37d2c317ef..0aa5e1c57d 100644 --- a/src/main/resources/meteor-client.mixins.json +++ b/src/main/resources/meteor-client.mixins.json @@ -85,7 +85,6 @@ "FoliageColorsMixin", "GameOptionsMixin", "GameRendererMixin", - "GenericContainerScreenMixin", "HandledScreenAccessor", "HandledScreenMixin", "HeldItemRendererMixin", @@ -138,7 +137,6 @@ "SectionedEntityCacheAccessor", "ShapeIndexBufferAccessor", "ShulkerBoxBlockMixin", - "ShulkerBoxScreenMixin", "SignBlockEntityRendererMixin", "SimpleEntityLookupAccessor", "SimpleOptionMixin", From a5cf719060551ec82ae4656469d5886943166598 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Sun, 22 Jan 2023 14:26:02 +0800 Subject: [PATCH 045/135] AutoSteal/Dump support more screens --- .../meteorclient/systems/modules/misc/InventoryTweaks.java | 6 ++---- .../meteorclient/utils/player/SlotUtils.java | 4 +++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java index bc799b1453..15a67974a3 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java @@ -34,9 +34,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.Wearable; import net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket; -import net.minecraft.screen.GenericContainerScreenHandler; import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ShulkerBoxScreenHandler; import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.SlotActionType; import org.lwjgl.glfw.GLFW; @@ -431,11 +429,11 @@ private void moveSlots(ScreenHandler handler, int start, int end, boolean steal) } public void steal(ScreenHandler handler) { - MeteorExecutor.execute(() -> moveSlots(handler, 0, SlotUtils.indexToId(handler.slots.size()), true)); + MeteorExecutor.execute(() -> moveSlots(handler, 0, SlotUtils.indexToId(SlotUtils.MAIN_START, handler), true)); } public void dump(ScreenHandler handler) { - int playerInvOffset = SlotUtils.indexToId(SlotUtils.HOTBAR_START); + int playerInvOffset = SlotUtils.indexToId(SlotUtils.MAIN_START, handler); MeteorExecutor.execute(() -> moveSlots(handler, playerInvOffset, playerInvOffset + 4 * 9, false)); } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/SlotUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/player/SlotUtils.java index 82b6c56fcd..d2bf7abe95 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/SlotUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/SlotUtils.java @@ -33,8 +33,10 @@ public class SlotUtils { public static int indexToId(int i) { if (mc.player == null) return -1; - ScreenHandler handler = mc.player.currentScreenHandler; + return indexToId(i, mc.player.currentScreenHandler); + } + public static int indexToId(int i, ScreenHandler handler) { if (handler instanceof PlayerScreenHandler) return survivalInventory(i); else if (handler instanceof CreativeInventoryScreen.CreativeScreenHandler) return creativeInventory(i); else if (handler instanceof GenericContainerScreenHandler) return genericContainer(i, ((GenericContainerScreenHandler) handler).getRows()); From 62b588021e0634cc87a472ec19e64e4403e6ef0d Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Sun, 22 Jan 2023 15:01:51 +0800 Subject: [PATCH 046/135] Add Steal Screens --- .../gui/DefaultSettingsWidgetFactory.java | 5 + .../settings/ScreenHandlerSettingScreen.java | 30 ++++++ .../mixin/HandledScreenMixin.java | 3 +- .../settings/ScreenHandlerListSetting.java | 96 +++++++++++++++++++ .../systems/modules/misc/InventoryTweaks.java | 23 ++++- .../meteorclient/utils/player/SlotUtils.java | 4 +- 6 files changed, 153 insertions(+), 8 deletions(-) create mode 100644 src/main/java/meteordevelopment/meteorclient/gui/screens/settings/ScreenHandlerSettingScreen.java create mode 100644 src/main/java/meteordevelopment/meteorclient/settings/ScreenHandlerListSetting.java diff --git a/src/main/java/meteordevelopment/meteorclient/gui/DefaultSettingsWidgetFactory.java b/src/main/java/meteordevelopment/meteorclient/gui/DefaultSettingsWidgetFactory.java index 4e2e1e497a..f127ad39ac 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/DefaultSettingsWidgetFactory.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/DefaultSettingsWidgetFactory.java @@ -61,6 +61,7 @@ public DefaultSettingsWidgetFactory(GuiTheme theme) { factories.put(StatusEffectAmplifierMapSetting.class, (table, setting) -> statusEffectAmplifierMapW(table, (StatusEffectAmplifierMapSetting) setting)); factories.put(StatusEffectListSetting.class, (table, setting) -> statusEffectListW(table, (StatusEffectListSetting) setting)); factories.put(StorageBlockListSetting.class, (table, setting) -> storageBlockListW(table, (StorageBlockListSetting) setting)); + factories.put(ScreenHandlerListSetting.class, (table, setting) -> screenHandlerListW(table, (ScreenHandlerListSetting) setting)); factories.put(BlockDataSetting.class, (table, setting) -> blockDataW(table, (BlockDataSetting) setting)); factories.put(PotionSetting.class, (table, setting) -> potionW(table, (PotionSetting) setting)); factories.put(StringListSetting.class, (table, setting) -> stringListW(table, (StringListSetting) setting)); @@ -325,6 +326,10 @@ private void storageBlockListW(WTable table, StorageBlockListSetting setting) { selectW(table, setting, () -> mc.setScreen(new StorageBlockListSettingScreen(theme, setting))); } + private void screenHandlerListW(WTable table, ScreenHandlerListSetting setting) { + selectW(table, setting, () -> mc.setScreen(new ScreenHandlerSettingScreen(theme, setting))); + } + private void blockDataW(WTable table, BlockDataSetting setting) { WButton button = table.add(theme.button(GuiRenderer.EDIT)).expandCellX().widget(); button.action = () -> mc.setScreen(new BlockDataSettingScreen(theme, setting)); diff --git a/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/ScreenHandlerSettingScreen.java b/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/ScreenHandlerSettingScreen.java new file mode 100644 index 0000000000..8e6443b8b4 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/ScreenHandlerSettingScreen.java @@ -0,0 +1,30 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.gui.screens.settings; + +import meteordevelopment.meteorclient.gui.GuiTheme; +import meteordevelopment.meteorclient.gui.widgets.WWidget; +import meteordevelopment.meteorclient.settings.Setting; +import net.minecraft.registry.Registries; +import net.minecraft.screen.ScreenHandlerType; + +import java.util.List; + +public class ScreenHandlerSettingScreen extends LeftRightListSettingScreen> { + public ScreenHandlerSettingScreen(GuiTheme theme, Setting>> setting) { + super(theme, "Select Screen Handlers", setting, setting.get(), Registries.SCREEN_HANDLER); + } + + @Override + protected WWidget getValueWidget(ScreenHandlerType value) { + return theme.label(getValueName(value)); + } + + @Override + protected String getValueName(ScreenHandlerType type) { + return Registries.SCREEN_HANDLER.getId(type).toString(); + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/HandledScreenMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/HandledScreenMixin.java index 7faddc3cc5..80b24a9520 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/HandledScreenMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/HandledScreenMixin.java @@ -22,7 +22,6 @@ import net.minecraft.screen.slot.SlotActionType; import net.minecraft.text.Text; import org.lwjgl.glfw.GLFW; -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -58,7 +57,7 @@ public HandledScreenMixin(Text title) { private void onInit(CallbackInfo info) { InventoryTweaks invTweaks = Modules.get().get(InventoryTweaks.class); - if (invTweaks.isActive() && invTweaks.showButtons()) { + if (invTweaks.canSteal(getScreenHandler())&& invTweaks.isActive() && invTweaks.showButtons()) { addDrawableChild( new ButtonWidget.Builder(Text.literal("Steal"), button -> invTweaks.steal(getScreenHandler())) .position(width / 2 - 40, 3) diff --git a/src/main/java/meteordevelopment/meteorclient/settings/ScreenHandlerListSetting.java b/src/main/java/meteordevelopment/meteorclient/settings/ScreenHandlerListSetting.java new file mode 100644 index 0000000000..30f624c9c0 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/settings/ScreenHandlerListSetting.java @@ -0,0 +1,96 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.settings; + +import net.minecraft.nbt.NbtCompound; +import net.minecraft.nbt.NbtElement; +import net.minecraft.nbt.NbtList; +import net.minecraft.nbt.NbtString; +import net.minecraft.registry.Registries; +import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.util.Identifier; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.function.Consumer; + +public class ScreenHandlerListSetting extends Setting>> { + public ScreenHandlerListSetting(String name, String description, List> defaultValue, Consumer>> onChanged, Consumer>>> onModuleActivated, IVisible visible) { + super(name, description, defaultValue, onChanged, onModuleActivated, visible); + } + + @Override + public void resetImpl() { + value = new ArrayList<>(defaultValue); + } + + @Override + protected List> parseImpl(String str) { + String[] values = str.split(","); + List> handlers = new ArrayList<>(values.length); + + try { + for (String value : values) { + ScreenHandlerType handler = parseId(Registries.SCREEN_HANDLER, value); + if (handler != null) handlers.add(handler); + } + } catch (Exception ignored) { + } + + return handlers; + } + + @Override + protected boolean isValueValid(List> value) { + return true; + } + + @Override + public Iterable getIdentifierSuggestions() { + return Registries.SCREEN_HANDLER.getIds(); + } + + @Override + public NbtCompound save(NbtCompound tag) { + NbtList valueTag = new NbtList(); + for (ScreenHandlerType type : get()) { + Identifier id = Registries.SCREEN_HANDLER.getId(type); + if (id != null) valueTag.add(NbtString.of(id.toString())); + } + tag.put("value", valueTag); + + return tag; + } + + @Override + public List> load(NbtCompound tag) { + get().clear(); + + NbtList valueTag = tag.getList("value", 8); + for (NbtElement tagI : valueTag) { + ScreenHandlerType type = Registries.SCREEN_HANDLER.get(new Identifier(tagI.asString())); + if (type != null) get().add(type); + } + + return get(); + } + + public static class Builder extends SettingBuilder>, ScreenHandlerListSetting> { + public Builder() { + super(new ArrayList<>(0)); + } + + public Builder defaultValue(ScreenHandlerType... defaults) { + return defaultValue(defaults != null ? Arrays.asList(defaults) : new ArrayList<>()); + } + + @Override + public ScreenHandlerListSetting build() { + return new ScreenHandlerListSetting(name, description, defaultValue, onChanged, onModuleActivated, visible); + } + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java index 15a67974a3..da0650b250 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java @@ -35,10 +35,12 @@ import net.minecraft.item.Wearable; import net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket; import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.ScreenHandlerType; import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.SlotActionType; import org.lwjgl.glfw.GLFW; +import java.util.Arrays; import java.util.List; import java.util.concurrent.ThreadLocalRandom; @@ -140,6 +142,13 @@ public class InventoryTweaks extends Module { // Steal & Dump + public final Setting>> stealScreens = sgStealDump.add(new ScreenHandlerListSetting.Builder() + .name("steal-screens") + .description("Select the screens to display buttons and auto steal.") + .defaultValue(Arrays.asList(ScreenHandlerType.GENERIC_9X3, ScreenHandlerType.GENERIC_9X6)) + .build() + ); + private final Setting buttons = sgStealDump.add(new BoolSetting.Builder() .name("inventory-buttons") .description("Shows steal and dump buttons in container guis.") @@ -429,11 +438,11 @@ private void moveSlots(ScreenHandler handler, int start, int end, boolean steal) } public void steal(ScreenHandler handler) { - MeteorExecutor.execute(() -> moveSlots(handler, 0, SlotUtils.indexToId(SlotUtils.MAIN_START, handler), true)); + MeteorExecutor.execute(() -> moveSlots(handler, 0, SlotUtils.indexToId(SlotUtils.MAIN_START), true)); } public void dump(ScreenHandler handler) { - int playerInvOffset = SlotUtils.indexToId(SlotUtils.MAIN_START, handler); + int playerInvOffset = SlotUtils.indexToId(SlotUtils.MAIN_START); MeteorExecutor.execute(() -> moveSlots(handler, playerInvOffset, playerInvOffset + 4 * 9, false)); } @@ -453,10 +462,18 @@ public boolean armorSwap() { return isActive() && armorSwap.get(); } + public boolean canSteal(ScreenHandler handler) { + try { + return (stealScreens.get().contains(handler.getType())); + } catch (UnsupportedClassVersionError e) { + return false; + } + } + @EventHandler private void onInventory(InventoryEvent event) { ScreenHandler handler = mc.player.currentScreenHandler; - if (event.packet.getSyncId() == handler.syncId) { + if (canSteal(handler) && event.packet.getSyncId() == handler.syncId) { if (autoSteal.get()) { steal(handler); } else if (autoDump.get()) { diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/SlotUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/player/SlotUtils.java index d2bf7abe95..82b6c56fcd 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/SlotUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/SlotUtils.java @@ -33,10 +33,8 @@ public class SlotUtils { public static int indexToId(int i) { if (mc.player == null) return -1; - return indexToId(i, mc.player.currentScreenHandler); - } + ScreenHandler handler = mc.player.currentScreenHandler; - public static int indexToId(int i, ScreenHandler handler) { if (handler instanceof PlayerScreenHandler) return survivalInventory(i); else if (handler instanceof CreativeInventoryScreen.CreativeScreenHandler) return creativeInventory(i); else if (handler instanceof GenericContainerScreenHandler) return genericContainer(i, ((GenericContainerScreenHandler) handler).getRows()); From 90fb81a8ba4ad03d569d7ee934d73d8398091c65 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Sun, 22 Jan 2023 15:06:41 +0800 Subject: [PATCH 047/135] fix crash --- .../meteorclient/mixin/HandledScreenMixin.java | 2 +- .../meteorclient/systems/modules/misc/InventoryTweaks.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/HandledScreenMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/HandledScreenMixin.java index 80b24a9520..7165c04f64 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/HandledScreenMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/HandledScreenMixin.java @@ -57,7 +57,7 @@ public HandledScreenMixin(Text title) { private void onInit(CallbackInfo info) { InventoryTweaks invTweaks = Modules.get().get(InventoryTweaks.class); - if (invTweaks.canSteal(getScreenHandler())&& invTweaks.isActive() && invTweaks.showButtons()) { + if (invTweaks.isActive() && invTweaks.showButtons() && invTweaks.canSteal(getScreenHandler())) { addDrawableChild( new ButtonWidget.Builder(Text.literal("Steal"), button -> invTweaks.steal(getScreenHandler())) .position(width / 2 - 40, 3) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java index da0650b250..6817624a0b 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java @@ -465,7 +465,7 @@ public boolean armorSwap() { public boolean canSteal(ScreenHandler handler) { try { return (stealScreens.get().contains(handler.getType())); - } catch (UnsupportedClassVersionError e) { + } catch (UnsupportedOperationException e) { return false; } } From d7b122b0c8ac8c710b9282b8738e5eb50562e278 Mon Sep 17 00:00:00 2001 From: DesiCow Date: Sat, 21 Jan 2023 18:35:36 +0530 Subject: [PATCH 048/135] Add distance colors to Nametags module --- .../systems/modules/render/Nametags.java | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Nametags.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Nametags.java index 6417fd81dc..3eb6c4bd68 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Nametags.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Nametags.java @@ -225,7 +225,7 @@ public class Nametags extends Module { private final Setting pingColor = sgRender.add(new ColorSetting.Builder() .name("ping-color") - .description("The color of the nametag names.") + .description("The color of the nametag ping.") .defaultValue(new SettingColor(20, 170, 170)) .visible(displayPing::get) .build() @@ -233,17 +233,25 @@ public class Nametags extends Module { private final Setting gamemodeColor = sgRender.add(new ColorSetting.Builder() .name("gamemode-color") - .description("The color of the nametag names.") + .description("The color of the nametag gamemode.") .defaultValue(new SettingColor(232, 185, 35)) .visible(displayGameMode::get) .build() ); + private final Setting distanceColorMode = sgRender.add(new EnumSetting.Builder() + .name("distance-color-mode") + .description("The mode to color the nametag distance with.") + .defaultValue(DistanceColorMode.Gradient) + .visible(displayDistance::get) + .build() + ); + private final Setting distanceColor = sgRender.add(new ColorSetting.Builder() .name("distance-color") - .description("The color of the nametag names.") + .description("The color of the nametag distance.") .defaultValue(new SettingColor(150, 150, 150)) - .visible(displayDistance::get) + .visible(() -> displayDistance.get() && distanceColorMode.get() == DistanceColorMode.Flat) .build() ); @@ -422,7 +430,13 @@ private void renderNametagPlayer(PlayerEntity player, boolean shadow) { hX = text.render(healthText, hX, hY, healthColor, shadow); if (displayPing.get()) hX = text.render(pingText, hX, hY, pingColor.get(), shadow); - if (displayDistance.get() && renderPlayerDistance) text.render(distText, hX, hY, distanceColor.get(), shadow); + if (displayDistance.get() && renderPlayerDistance) { + switch (distanceColorMode.get()) { + case Flat -> text.render(distText, hX, hY, distanceColor.get(), shadow); + case Gradient -> text.render(distText, hX, hY, EntityUtils.getColorFromDistance(mc.player), shadow); + } + } + text.end(); if (displayItems.get()) { @@ -631,6 +645,11 @@ public enum Position { OnTop } + public enum DistanceColorMode { + Gradient, + Flat; + } + public boolean excludeBots() { return ignoreBots.get(); } From e8621c27a4f7da0a6aa2b8d0d5ebc33819ce3a42 Mon Sep 17 00:00:00 2001 From: EpicPlayerA10 Date: Sun, 22 Jan 2023 00:48:36 +0100 Subject: [PATCH 049/135] Note Detect Mode --- .../systems/modules/misc/Notebot.java | 10 ++++++- .../utils/notebot/NotebotUtils.java | 6 +++-- .../notedetect/NoteDetectFunction.java | 21 +++++++++++++++ .../notebot/notedetect/NoteDetectMode.java | 26 +++++++++++++++++++ 4 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 src/main/java/meteordevelopment/meteorclient/utils/notebot/notedetect/NoteDetectFunction.java create mode 100644 src/main/java/meteordevelopment/meteorclient/utils/notebot/notedetect/NoteDetectMode.java diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notebot.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notebot.java index 9203afc208..b137970d70 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notebot.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notebot.java @@ -24,6 +24,7 @@ import meteordevelopment.meteorclient.utils.notebot.NotebotUtils; import meteordevelopment.meteorclient.utils.notebot.decoder.SongDecoder; import meteordevelopment.meteorclient.utils.notebot.decoder.SongDecoders; +import meteordevelopment.meteorclient.utils.notebot.notedetect.NoteDetectMode; import meteordevelopment.meteorclient.utils.notebot.song.Note; import meteordevelopment.meteorclient.utils.notebot.song.Song; import meteordevelopment.meteorclient.utils.player.Rotations; @@ -87,6 +88,13 @@ public class Notebot extends Module { .build() ); + public final Setting noteDetectMode = sgGeneral.add(new EnumSetting.Builder() + .name("note-detect-mode") + .description("Select a note detect mode. Can be useful when server has a plugin that modifies noteblock state (e.g ItemsAdder) but noteblock can still play the right note") + .defaultValue(NoteDetectMode.BlockState) + .build() + ); + public final Setting polyphonic = sgGeneral.add(new BoolSetting.Builder() .name("polyphonic") .description("Whether or not to allow multiple notes to be played at the same time") @@ -750,7 +758,7 @@ private void scanForNoteblocks() { if (!isValidScanSpot(pos)) continue; - Note note = NotebotUtils.getNoteFromNoteBlock(blockState, mode.get()); + Note note = NotebotUtils.getNoteFromNoteBlock(blockState, pos, mode.get(), noteDetectMode.get().getNoteDetectFunction()); scannedNoteblocks.put(note, pos); } } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/notebot/NotebotUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/notebot/NotebotUtils.java index 5d8113fe5b..436521f578 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/notebot/NotebotUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/notebot/NotebotUtils.java @@ -5,10 +5,12 @@ package meteordevelopment.meteorclient.utils.notebot; +import meteordevelopment.meteorclient.utils.notebot.notedetect.NoteDetectFunction; import meteordevelopment.meteorclient.utils.notebot.song.Note; import net.minecraft.block.BlockState; import net.minecraft.block.NoteBlock; import net.minecraft.block.enums.Instrument; +import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.Nullable; import java.util.HashMap; @@ -16,11 +18,11 @@ public class NotebotUtils { - public static Note getNoteFromNoteBlock(BlockState noteBlock, NotebotMode mode) { + public static Note getNoteFromNoteBlock(BlockState noteBlock, BlockPos blockPos, NotebotMode mode, NoteDetectFunction noteDetectFunction) { Instrument instrument = null; int level = noteBlock.get(NoteBlock.NOTE); if (mode == NotebotMode.ExactInstruments) { - instrument = noteBlock.get(NoteBlock.INSTRUMENT); + instrument = noteDetectFunction.detectInstrument(noteBlock, blockPos); } return new Note(instrument, level); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/notebot/notedetect/NoteDetectFunction.java b/src/main/java/meteordevelopment/meteorclient/utils/notebot/notedetect/NoteDetectFunction.java new file mode 100644 index 0000000000..97ff643e0f --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/utils/notebot/notedetect/NoteDetectFunction.java @@ -0,0 +1,21 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.utils.notebot.notedetect; + +import net.minecraft.block.BlockState; +import net.minecraft.block.enums.Instrument; +import net.minecraft.util.math.BlockPos; + +public interface NoteDetectFunction { + /** + * Detects an instrument for noteblock + * + * @param noteBlock Noteblock state + * @param blockPos Noteblock position + * @return Detected instrument + */ + Instrument detectInstrument(BlockState noteBlock, BlockPos blockPos); +} diff --git a/src/main/java/meteordevelopment/meteorclient/utils/notebot/notedetect/NoteDetectMode.java b/src/main/java/meteordevelopment/meteorclient/utils/notebot/notedetect/NoteDetectMode.java new file mode 100644 index 0000000000..7e1bb62816 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/utils/notebot/notedetect/NoteDetectMode.java @@ -0,0 +1,26 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.utils.notebot.notedetect; + +import net.minecraft.block.NoteBlock; +import net.minecraft.block.enums.Instrument; +import net.minecraft.client.MinecraftClient; + +public enum NoteDetectMode { + BlockState(((noteBlock, blockPos) -> noteBlock.get(NoteBlock.INSTRUMENT))), + BelowBlock(((noteBlock, blockPos) -> Instrument.fromBelowState(MinecraftClient.getInstance().world.getBlockState(blockPos.down())))) + ; + + private final NoteDetectFunction noteDetectFunction; + + NoteDetectMode(NoteDetectFunction noteDetectFunction) { + this.noteDetectFunction = noteDetectFunction; + } + + public NoteDetectFunction getNoteDetectFunction() { + return noteDetectFunction; + } +} From 136edab8d26685bfe8b5310a8dbbc29aea2ac531 Mon Sep 17 00:00:00 2001 From: EpicPlayerA10 Date: Sun, 22 Jan 2023 00:53:50 +0100 Subject: [PATCH 050/135] Change name to InstrumentDetectMode --- .../meteorclient/systems/modules/misc/Notebot.java | 12 ++++++------ .../meteorclient/utils/notebot/NotebotUtils.java | 6 +++--- .../InstrumentDetectFunction.java} | 4 ++-- .../InstrumentDetectMode.java} | 14 +++++++------- 4 files changed, 18 insertions(+), 18 deletions(-) rename src/main/java/meteordevelopment/meteorclient/utils/notebot/{notedetect/NoteDetectFunction.java => instrumentdetect/InstrumentDetectFunction.java} (82%) rename src/main/java/meteordevelopment/meteorclient/utils/notebot/{notedetect/NoteDetectMode.java => instrumentdetect/InstrumentDetectMode.java} (55%) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notebot.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notebot.java index b137970d70..5073911c27 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notebot.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notebot.java @@ -24,7 +24,7 @@ import meteordevelopment.meteorclient.utils.notebot.NotebotUtils; import meteordevelopment.meteorclient.utils.notebot.decoder.SongDecoder; import meteordevelopment.meteorclient.utils.notebot.decoder.SongDecoders; -import meteordevelopment.meteorclient.utils.notebot.notedetect.NoteDetectMode; +import meteordevelopment.meteorclient.utils.notebot.instrumentdetect.InstrumentDetectMode; import meteordevelopment.meteorclient.utils.notebot.song.Note; import meteordevelopment.meteorclient.utils.notebot.song.Song; import meteordevelopment.meteorclient.utils.player.Rotations; @@ -88,10 +88,10 @@ public class Notebot extends Module { .build() ); - public final Setting noteDetectMode = sgGeneral.add(new EnumSetting.Builder() - .name("note-detect-mode") - .description("Select a note detect mode. Can be useful when server has a plugin that modifies noteblock state (e.g ItemsAdder) but noteblock can still play the right note") - .defaultValue(NoteDetectMode.BlockState) + public final Setting instrumentDetectMode = sgGeneral.add(new EnumSetting.Builder() + .name("instrument-detect-mode") + .description("Select an instrument detect mode. Can be useful when server has a plugin that modifies noteblock state (e.g ItemsAdder) but noteblock can still play the right note") + .defaultValue(InstrumentDetectMode.BlockState) .build() ); @@ -758,7 +758,7 @@ private void scanForNoteblocks() { if (!isValidScanSpot(pos)) continue; - Note note = NotebotUtils.getNoteFromNoteBlock(blockState, pos, mode.get(), noteDetectMode.get().getNoteDetectFunction()); + Note note = NotebotUtils.getNoteFromNoteBlock(blockState, pos, mode.get(), instrumentDetectMode.get().getNoteDetectFunction()); scannedNoteblocks.put(note, pos); } } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/notebot/NotebotUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/notebot/NotebotUtils.java index 436521f578..e0383f20c0 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/notebot/NotebotUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/notebot/NotebotUtils.java @@ -5,7 +5,7 @@ package meteordevelopment.meteorclient.utils.notebot; -import meteordevelopment.meteorclient.utils.notebot.notedetect.NoteDetectFunction; +import meteordevelopment.meteorclient.utils.notebot.instrumentdetect.InstrumentDetectFunction; import meteordevelopment.meteorclient.utils.notebot.song.Note; import net.minecraft.block.BlockState; import net.minecraft.block.NoteBlock; @@ -18,11 +18,11 @@ public class NotebotUtils { - public static Note getNoteFromNoteBlock(BlockState noteBlock, BlockPos blockPos, NotebotMode mode, NoteDetectFunction noteDetectFunction) { + public static Note getNoteFromNoteBlock(BlockState noteBlock, BlockPos blockPos, NotebotMode mode, InstrumentDetectFunction instrumentDetectFunction) { Instrument instrument = null; int level = noteBlock.get(NoteBlock.NOTE); if (mode == NotebotMode.ExactInstruments) { - instrument = noteDetectFunction.detectInstrument(noteBlock, blockPos); + instrument = instrumentDetectFunction.detectInstrument(noteBlock, blockPos); } return new Note(instrument, level); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/notebot/notedetect/NoteDetectFunction.java b/src/main/java/meteordevelopment/meteorclient/utils/notebot/instrumentdetect/InstrumentDetectFunction.java similarity index 82% rename from src/main/java/meteordevelopment/meteorclient/utils/notebot/notedetect/NoteDetectFunction.java rename to src/main/java/meteordevelopment/meteorclient/utils/notebot/instrumentdetect/InstrumentDetectFunction.java index 97ff643e0f..96a6fbfe15 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/notebot/notedetect/NoteDetectFunction.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/notebot/instrumentdetect/InstrumentDetectFunction.java @@ -3,13 +3,13 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.utils.notebot.notedetect; +package meteordevelopment.meteorclient.utils.notebot.instrumentdetect; import net.minecraft.block.BlockState; import net.minecraft.block.enums.Instrument; import net.minecraft.util.math.BlockPos; -public interface NoteDetectFunction { +public interface InstrumentDetectFunction { /** * Detects an instrument for noteblock * diff --git a/src/main/java/meteordevelopment/meteorclient/utils/notebot/notedetect/NoteDetectMode.java b/src/main/java/meteordevelopment/meteorclient/utils/notebot/instrumentdetect/InstrumentDetectMode.java similarity index 55% rename from src/main/java/meteordevelopment/meteorclient/utils/notebot/notedetect/NoteDetectMode.java rename to src/main/java/meteordevelopment/meteorclient/utils/notebot/instrumentdetect/InstrumentDetectMode.java index 7e1bb62816..942459ca56 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/notebot/notedetect/NoteDetectMode.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/notebot/instrumentdetect/InstrumentDetectMode.java @@ -3,24 +3,24 @@ * Copyright (c) Meteor Development. */ -package meteordevelopment.meteorclient.utils.notebot.notedetect; +package meteordevelopment.meteorclient.utils.notebot.instrumentdetect; import net.minecraft.block.NoteBlock; import net.minecraft.block.enums.Instrument; import net.minecraft.client.MinecraftClient; -public enum NoteDetectMode { +public enum InstrumentDetectMode { BlockState(((noteBlock, blockPos) -> noteBlock.get(NoteBlock.INSTRUMENT))), BelowBlock(((noteBlock, blockPos) -> Instrument.fromBelowState(MinecraftClient.getInstance().world.getBlockState(blockPos.down())))) ; - private final NoteDetectFunction noteDetectFunction; + private final InstrumentDetectFunction instrumentDetectFunction; - NoteDetectMode(NoteDetectFunction noteDetectFunction) { - this.noteDetectFunction = noteDetectFunction; + InstrumentDetectMode(InstrumentDetectFunction instrumentDetectFunction) { + this.instrumentDetectFunction = instrumentDetectFunction; } - public NoteDetectFunction getNoteDetectFunction() { - return noteDetectFunction; + public InstrumentDetectFunction getNoteDetectFunction() { + return instrumentDetectFunction; } } From ba1568f97c761316e2cbf98e45e32ed47fb7bee8 Mon Sep 17 00:00:00 2001 From: EpicPlayerA10 Date: Sun, 22 Jan 2023 00:55:42 +0100 Subject: [PATCH 051/135] Change this name in one place --- .../meteorclient/systems/modules/misc/Notebot.java | 2 +- .../utils/notebot/instrumentdetect/InstrumentDetectMode.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notebot.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notebot.java index 5073911c27..f4fe8d7af2 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notebot.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notebot.java @@ -758,7 +758,7 @@ private void scanForNoteblocks() { if (!isValidScanSpot(pos)) continue; - Note note = NotebotUtils.getNoteFromNoteBlock(blockState, pos, mode.get(), instrumentDetectMode.get().getNoteDetectFunction()); + Note note = NotebotUtils.getNoteFromNoteBlock(blockState, pos, mode.get(), instrumentDetectMode.get().getInstrumentDetectFunction()); scannedNoteblocks.put(note, pos); } } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/notebot/instrumentdetect/InstrumentDetectMode.java b/src/main/java/meteordevelopment/meteorclient/utils/notebot/instrumentdetect/InstrumentDetectMode.java index 942459ca56..37d0da24ba 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/notebot/instrumentdetect/InstrumentDetectMode.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/notebot/instrumentdetect/InstrumentDetectMode.java @@ -20,7 +20,7 @@ public enum InstrumentDetectMode { this.instrumentDetectFunction = instrumentDetectFunction; } - public InstrumentDetectFunction getNoteDetectFunction() { + public InstrumentDetectFunction getInstrumentDetectFunction() { return instrumentDetectFunction; } } From 1a6183000af4d00ea0a621345277db51dc8fae0f Mon Sep 17 00:00:00 2001 From: DesiCow Date: Sun, 22 Jan 2023 19:40:17 +0530 Subject: [PATCH 052/135] Add onlyOnClick setting to Scaffold module --- .../meteorclient/mixin/ClientPlayerEntityMixin.java | 2 +- .../systems/modules/movement/Scaffold.java | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java index ab54e5df7a..31e36e79e1 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java @@ -55,7 +55,7 @@ private boolean redirectUsingItem(ClientPlayerEntity player) { @Inject(method = "isSneaking", at = @At("HEAD"), cancellable = true) private void onIsSneaking(CallbackInfoReturnable info) { - if (Modules.get().isActive(Scaffold.class)) info.setReturnValue(false); + if (Modules.get().get(Scaffold.class).scaffolding()) info.setReturnValue(false); } @Inject(method = "shouldSlowDown", at = @At("HEAD"), cancellable = true) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java index 880959248a..e6b7707f66 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java @@ -55,6 +55,13 @@ public class Scaffold extends Module { .build() ); + private final Setting onlyOnClick = sgGeneral.add(new BoolSetting.Builder() + .name("only-on-click") + .description("Only places blocks when holding right click.") + .defaultValue(false) + .build() + ); + private final Setting renderSwing = sgGeneral.add(new BoolSetting.Builder() .name("swing") .description("Renders your client-side swing.") @@ -153,6 +160,8 @@ public void onActivate() { @EventHandler private void onTick(TickEvent.Pre event) { + if (onlyOnClick.get() && !mc.options.useKey.isPressed()) return; + if (airPlace.get()) { Vec3d vec = mc.player.getPos().add(mc.player.getVelocity()).add(0, -0.5f, 0); bp.set(vec.getX(), vec.getY(), vec.getZ()); @@ -238,6 +247,10 @@ private void onTick(TickEvent.Pre event) { } } + public boolean scaffolding() { + return isActive() && (!onlyOnClick.get() || (onlyOnClick.get() && mc.options.useKey.isPressed())); + } + private boolean validItem(ItemStack itemStack, BlockPos pos) { if (!(itemStack.getItem() instanceof BlockItem)) return false; From 8cb27b1f6013c0f1caa55ddf2357ecc60f001a11 Mon Sep 17 00:00:00 2001 From: tyrannus <60930117+tyrannus00@users.noreply.github.com> Date: Sat, 28 Jan 2023 23:53:40 +0100 Subject: [PATCH 053/135] Fixed AutoTool selecting wrong slot --- .../meteorclient/systems/modules/player/AutoTool.java | 2 +- .../meteorclient/utils/player/InvUtils.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoTool.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoTool.java index b1b30a4184..64e7f45d0f 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoTool.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoTool.java @@ -183,7 +183,7 @@ private boolean shouldStopUsing(ItemStack itemStack) { } public static double getScore(ItemStack itemStack, BlockState state, boolean silkTouchEnderChest, EnchantPreference enchantPreference, Predicate good) { - if (!good.test(itemStack) || !isTool(itemStack)) return -1; + if (!itemStack.isSuitableFor(state) || !good.test(itemStack) || !isTool(itemStack)) return -1; if (silkTouchEnderChest && state.getBlock() == Blocks.ENDER_CHEST diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/InvUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/player/InvUtils.java index 56fe9a20c7..0d9e900369 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/InvUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/InvUtils.java @@ -126,7 +126,10 @@ public static FindItemResult findFastestTool(BlockState state) { int slot = -1; for (int i = 0; i < 9; i++) { - float score = mc.player.getInventory().getStack(i).getMiningSpeedMultiplier(state); + ItemStack stack = mc.player.getInventory().getStack(i); + if (!stack.isSuitableFor(state)) continue; + + float score = stack.getMiningSpeedMultiplier(state); if (score > bestScore) { bestScore = score; slot = i; From b67f0a599333d407284f5f6c3fcdf256a4182506 Mon Sep 17 00:00:00 2001 From: DesiCow <80271842+DesiCow@users.noreply.github.com> Date: Sun, 29 Jan 2023 06:29:02 +0530 Subject: [PATCH 054/135] Fix nametags distance color gradient #3235 --- .../meteorclient/systems/modules/render/Nametags.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Nametags.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Nametags.java index 3eb6c4bd68..50fff44629 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Nametags.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Nametags.java @@ -433,7 +433,7 @@ private void renderNametagPlayer(PlayerEntity player, boolean shadow) { if (displayDistance.get() && renderPlayerDistance) { switch (distanceColorMode.get()) { case Flat -> text.render(distText, hX, hY, distanceColor.get(), shadow); - case Gradient -> text.render(distText, hX, hY, EntityUtils.getColorFromDistance(mc.player), shadow); + case Gradient -> text.render(distText, hX, hY, EntityUtils.getColorFromDistance(player), shadow); } } From 06016dec714832210d388e75b783cb0c759a24cc Mon Sep 17 00:00:00 2001 From: RacoonDog <32882447+RacoonDog@users.noreply.github.com> Date: Mon, 30 Jan 2023 19:11:36 -0500 Subject: [PATCH 055/135] massive HoleESP optimization --- .../systems/modules/render/HoleESP.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/HoleESP.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/HoleESP.java index 16bf43e1ba..473db231e1 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/HoleESP.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/HoleESP.java @@ -20,10 +20,13 @@ import meteordevelopment.meteorclient.utils.world.BlockIterator; import meteordevelopment.meteorclient.utils.world.Dir; import meteordevelopment.orbit.EventHandler; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.ChunkSectionPos; import net.minecraft.util.math.Direction; +import net.minecraft.world.chunk.WorldChunk; import java.util.ArrayList; import java.util.List; @@ -177,17 +180,17 @@ private void onTick(TickEvent.Pre event) { for (Direction direction : Direction.values()) { if (direction == Direction.UP) continue; - - BlockState state = mc.world.getBlockState(blockPos.offset(direction)); + BlockPos offsetPos = blockPos.offset(direction); + BlockState state = mc.world.getBlockState(offsetPos); if (state.getBlock() == Blocks.BEDROCK) bedrock++; else if (state.getBlock() == Blocks.OBSIDIAN) obsidian++; else if (direction == Direction.DOWN) return; - else if (validHole(blockPos.offset(direction)) && air == null) { + else if (doubles.get() && air == null && validHole(offsetPos)) { for (Direction dir : Direction.values()) { if (dir == direction.getOpposite() || dir == Direction.UP) continue; - BlockState blockState1 = mc.world.getBlockState(blockPos.offset(direction).offset(dir)); + BlockState blockState1 = mc.world.getBlockState(offsetPos.offset(dir)); if (blockState1.getBlock() == Blocks.BEDROCK) bedrock++; else if (blockState1.getBlock() == Blocks.OBSIDIAN) obsidian++; @@ -210,12 +213,14 @@ else if (obsidian + bedrock == 8 && doubles.get() && air != null) { private boolean validHole(BlockPos pos) { if ((ignoreOwn.get() && (mc.player.getBlockPos().equals(pos)))) return false; - if (!webs.get() && mc.world.getBlockState(pos).getBlock() == Blocks.COBWEB) return false; + WorldChunk chunk = mc.world.getChunk(ChunkSectionPos.getSectionCoord(pos.getX()), ChunkSectionPos.getSectionCoord(pos.getZ())); + Block block = chunk.getBlockState(pos).getBlock(); + if (!webs.get() && block == Blocks.COBWEB) return false; - if (((AbstractBlockAccessor) mc.world.getBlockState(pos).getBlock()).isCollidable()) return false; + if (((AbstractBlockAccessor) block).isCollidable()) return false; for (int i = 0; i < holeHeight.get(); i++) { - if (((AbstractBlockAccessor) mc.world.getBlockState(pos.up(i)).getBlock()).isCollidable()) return false; + if (((AbstractBlockAccessor) chunk.getBlockState(pos.up(i)).getBlock()).isCollidable()) return false; } return true; From 7905167bcb6177c24638dbc1b657c5971988df1b Mon Sep 17 00:00:00 2001 From: RacoonDog <32882447+RacoonDog@users.noreply.github.com> Date: Mon, 30 Jan 2023 19:31:39 -0500 Subject: [PATCH 056/135] who added these :skull: --- .../meteorclient/systems/modules/render/HoleESP.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/HoleESP.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/HoleESP.java index 473db231e1..e3df88edc6 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/HoleESP.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/HoleESP.java @@ -211,7 +211,7 @@ else if (obsidian + bedrock == 8 && doubles.get() && air != null) { } private boolean validHole(BlockPos pos) { - if ((ignoreOwn.get() && (mc.player.getBlockPos().equals(pos)))) return false; + if (ignoreOwn.get() && mc.player.getBlockPos().equals(pos)) return false; WorldChunk chunk = mc.world.getChunk(ChunkSectionPos.getSectionCoord(pos.getX()), ChunkSectionPos.getSectionCoord(pos.getZ())); Block block = chunk.getBlockState(pos).getBlock(); From 8df696fe1d71f07f1e9aae90d5f67770090cdbac Mon Sep 17 00:00:00 2001 From: RacoonDog <32882447+RacoonDog@users.noreply.github.com> Date: Wed, 1 Feb 2023 17:13:41 -0500 Subject: [PATCH 057/135] speed --- .../mixin/WorldRendererMixin.java | 11 ++++++--- .../systems/modules/render/ESP.java | 5 +++- .../utils/misc/text/TextUtils.java | 24 ++++++++++--------- .../utils/player/PlayerUtils.java | 4 ++-- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/WorldRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/WorldRendererMixin.java index 2bb5c5ab59..5dca416814 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/WorldRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/WorldRendererMixin.java @@ -28,6 +28,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import java.util.function.Supplier; + @Mixin(WorldRenderer.class) public abstract class WorldRendererMixin { @Shadow @@ -72,13 +74,16 @@ private void onRenderHead(MatrixStack matrices, float tickDelta, long limitTime, @Inject(method = "renderEntity", at = @At("HEAD")) private void renderEntity(Entity entity, double cameraX, double cameraY, double cameraZ, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, CallbackInfo info) { - draw(entity, cameraX, cameraY, cameraZ, tickDelta, vertexConsumers, matrices, PostProcessShaders.CHAMS, Color.WHITE); - draw(entity, cameraX, cameraY, cameraZ, tickDelta, vertexConsumers, matrices, PostProcessShaders.ENTITY_OUTLINE, Modules.get().get(ESP.class).getColor(entity)); + draw(entity, cameraX, cameraY, cameraZ, tickDelta, vertexConsumers, matrices, PostProcessShaders.CHAMS, () -> Color.WHITE); + draw(entity, cameraX, cameraY, cameraZ, tickDelta, vertexConsumers, matrices, PostProcessShaders.ENTITY_OUTLINE, () -> Modules.get().get(ESP.class).getColor(entity)); } @Unique - private void draw(Entity entity, double cameraX, double cameraY, double cameraZ, float tickDelta, VertexConsumerProvider vertexConsumers, MatrixStack matrices, EntityShader shader, Color color) { + private void draw(Entity entity, double cameraX, double cameraY, double cameraZ, float tickDelta, VertexConsumerProvider vertexConsumers, MatrixStack matrices, EntityShader shader, Supplier colorSupplier) { if (shader.shouldDraw(entity) && !PostProcessShaders.isCustom(vertexConsumers)) { + Color color = colorSupplier.get(); + if (color == null) return; + Framebuffer prevBuffer = this.entityOutlinesFramebuffer; this.entityOutlinesFramebuffer = shader.framebuffer; PostProcessShaders.rendering = true; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/ESP.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/ESP.java index 2f4a3fc066..d85a2390cb 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/ESP.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/ESP.java @@ -29,6 +29,8 @@ import net.minecraft.util.math.MathHelper; import org.joml.Vector3d; +import javax.annotation.Nullable; + public class ESP extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); private final SettingGroup sgColors = settings.createGroup("Colors"); @@ -296,9 +298,10 @@ public boolean shouldSkip(Entity entity) { if (!entities.get().getBoolean(entity.getType())) return true; if (entity == mc.player && ignoreSelf.get()) return true; if (entity == mc.cameraEntity && mc.options.getPerspective().isFirstPerson()) return true; - return !EntityUtils.isInRenderDistance(entity) || getFadeAlpha(entity) == 0; + return !EntityUtils.isInRenderDistance(entity); } + @Nullable public Color getColor(Entity entity) { if (!entities.get().getBoolean(entity.getType())) return null; diff --git a/src/main/java/meteordevelopment/meteorclient/utils/misc/text/TextUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/misc/text/TextUtils.java index d31e31f62b..a89ab36e81 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/misc/text/TextUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/misc/text/TextUtils.java @@ -5,6 +5,8 @@ package meteordevelopment.meteorclient.utils.misc.text; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import meteordevelopment.meteorclient.utils.render.color.Color; import net.minecraft.text.MutableText; import net.minecraft.text.OrderedText; @@ -21,7 +23,7 @@ public static List toColoredTextList(Text text) { Stack stack = new Stack<>(); List coloredTexts = new ArrayList<>(); preOrderTraverse(text, stack, coloredTexts); - coloredTexts.removeIf(e -> e.getText().equals("")); + coloredTexts.removeIf(e -> e.getText().isEmpty()); return coloredTexts; } @@ -44,15 +46,15 @@ public static MutableText parseOrderedText(OrderedText orderedText) { * Returns the {@link Color} that is most prevalent through the given {@link Text} * * @param text the {@link Text} to scan through - * @return You know what it returns. Read the docs! Also, returns white if the internal {@link Optional} is empty + * @return You know what it returns. Read the docs! Also, returns white if the internal {@link Object2IntMap.Entry} is null */ public static Color getMostPopularColor(Text text) { - Comparator integerComparator = Comparator.naturalOrder(); - Optional> optionalColor = getColoredCharacterCount(toColoredTextList(text)) - .entrySet().stream() - .max((a, b) -> integerComparator.compare(a.getValue(), b.getValue())); - - return optionalColor.map(Map.Entry::getKey).orElse(new Color(255, 255, 255)); + Object2IntMap.Entry biggestEntry = null; + for (var entry : getColoredCharacterCount(toColoredTextList(text)).object2IntEntrySet()) { + if (biggestEntry == null) biggestEntry = entry; + else if (entry.getIntValue() > biggestEntry.getIntValue()) biggestEntry = entry; + } + return biggestEntry == null ? new Color(255, 255, 255) : biggestEntry.getKey(); } /** @@ -64,13 +66,13 @@ public static Color getMostPopularColor(Text text) { * if the argument for this function is fed from the return from {@link #toColoredTextList(Text)}), and the corresponding values being {@link Integer}s * representing the number of occurrences of text that bear that color. The order of the keys are in no particular order */ - public static Map getColoredCharacterCount(List coloredTexts) { - Map colorCount = new HashMap<>(); + public static Object2IntMap getColoredCharacterCount(List coloredTexts) { + Object2IntMap colorCount = new Object2IntOpenHashMap<>(); for (ColoredText coloredText : coloredTexts) { if (colorCount.containsKey(coloredText.getColor())) { // Since color was already catalogued, simply update the record by adding the length of the new text segment to the old one - colorCount.put(coloredText.getColor(), colorCount.get(coloredText.getColor()) + coloredText.getText().length()); + colorCount.put(coloredText.getColor(), colorCount.getInt(coloredText.getColor()) + coloredText.getText().length()); } else { // Add new entry to the hashmap colorCount.put(coloredText.getColor(), coloredText.getText().length()); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/PlayerUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/player/PlayerUtils.java index 2f0ff7a725..602558a8e8 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/PlayerUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/PlayerUtils.java @@ -50,8 +50,8 @@ public static Color getPlayerColor(PlayerEntity entity, Color defaultColor) { return color.set(Config.get().friendColor.get()).a(defaultColor.a); } - if (!color.set(TextUtils.getMostPopularColor(entity.getDisplayName())).equals(WHITE) && Config.get().useTeamColor.get()) { - return color.set(color).a(defaultColor.a); + if (Config.get().useTeamColor.get() && !color.set(TextUtils.getMostPopularColor(entity.getDisplayName())).equals(WHITE)) { + return color.a(defaultColor.a); } return defaultColor; From 77d2df16d8514c60e1907c5f7014f275d68b7891 Mon Sep 17 00:00:00 2001 From: RacoonDog <32882447+RacoonDog@users.noreply.github.com> Date: Wed, 1 Feb 2023 20:52:24 -0500 Subject: [PATCH 058/135] PlayerUtils distance math --- .../utils/player/PlayerUtils.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/PlayerUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/player/PlayerUtils.java index 602558a8e8..0a24635cdb 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/PlayerUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/PlayerUtils.java @@ -256,10 +256,14 @@ public static double squaredDistanceTo(BlockPos blockPos) { } public static double squaredDistanceTo(double x, double y, double z) { - float f = (float) (mc.player.getX() - x); - float g = (float) (mc.player.getY() - y); - float h = (float) (mc.player.getZ() - z); - return f * f + g * g + h * h; + return squaredDistance(mc.player.getX(), mc.player.getY(), mc.player.getZ(), x, y, z); + } + + public static double squaredDistance(double x1, double y1, double z1, double x2, double y2, double z2) { + float f = (float) (x1 - x2); + float g = (float) (y1 - y2); + float h = (float) (z1 - z2); + return org.joml.Math.fma(f, f, org.joml.Math.fma(g, g, h * h)); } public static boolean isWithin(Entity entity, double r) { @@ -287,7 +291,8 @@ public static double distanceToCamera(Entity entity) { } public static double squaredDistanceToCamera(double x, double y, double z) { - return mc.gameRenderer.getCamera().getPos().squaredDistanceTo(x, y, z); + Vec3d cameraPos = mc.gameRenderer.getCamera().getPos(); + return squaredDistance(cameraPos.x, cameraPos.y, cameraPos.z, x, y, z); } public static double squaredDistanceToCamera(Entity entity) { @@ -323,10 +328,7 @@ public static boolean isWithinReach(BlockPos blockPos) { } public static boolean isWithinReach(double x, double y, double z) { - float f = (float) (mc.player.getX() - x); - float g = (float) (mc.player.getEyeY() - y); - float h = (float) (mc.player.getZ() - z); - return (f * f + g * g + h * h) <= mc.interactionManager.getReachDistance() * mc.interactionManager.getReachDistance(); + return squaredDistanceTo(x, y, z) <= mc.interactionManager.getReachDistance() * mc.interactionManager.getReachDistance(); } public static Dimension getDimension() { From 78342306f20c294fd2e77b735373201a96003de5 Mon Sep 17 00:00:00 2001 From: RacoonDog <32882447+RacoonDog@users.noreply.github.com> Date: Wed, 1 Feb 2023 21:30:03 -0500 Subject: [PATCH 059/135] remove AW + prefix getter --- .../commands/commands/NameHistoryCommand.java | 2 +- .../meteorclient/systems/modules/misc/BetterTab.java | 2 +- .../meteorclient/utils/player/ChatUtils.java | 6 +++++- .../meteorclient/utils/render/MeteorToast.java | 12 ++++++------ .../meteorclient/utils/render/color/Color.java | 2 +- src/main/resources/meteor-client.accesswidener | 2 -- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/NameHistoryCommand.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/NameHistoryCommand.java index 27afeb9fee..7fd402604b 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/NameHistoryCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/NameHistoryCommand.java @@ -52,7 +52,7 @@ public void build(LiteralArgumentBuilder builder) { Color nameColor = PlayerUtils.getPlayerColor(mc.world.getPlayerByUuid(uuid), Utils.WHITE); initial.setStyle(initial.getStyle() - .withColor(new TextColor(nameColor.getPacked())) + .withColor(TextColor.fromRgb(nameColor.getPacked())) .withClickEvent(new ClickEvent( ClickEvent.Action.OPEN_URL, "https://laby.net/@" + name diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterTab.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterTab.java index cc68abe870..de5b3bd10b 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterTab.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterTab.java @@ -96,7 +96,7 @@ else if (friends.get() && Friends.get().isFriend(playerListEntry)) { if (format.isColor()) nameString = nameString.replace(format.toString(), ""); } - name = Text.literal(nameString).setStyle(name.getStyle().withColor(new TextColor(color.getPacked()))); + name = Text.literal(nameString).setStyle(name.getStyle().withColor(TextColor.fromRgb(color.getPacked()))); } if (gamemode.get()) { diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/ChatUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/player/ChatUtils.java index e160a67132..160b7d0cd3 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/ChatUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/ChatUtils.java @@ -33,10 +33,14 @@ public static void init() { PREFIX = Text.literal("") .setStyle(Style.EMPTY.withFormatting(Formatting.GRAY)) .append("[") - .append(Text.literal("Meteor").setStyle(Style.EMPTY.withColor(new TextColor(MeteorClient.ADDON.color.getPacked())))) + .append(Text.literal("Meteor").setStyle(Style.EMPTY.withColor(TextColor.fromRgb(MeteorClient.ADDON.color.getPacked())))) .append("] "); } + public static Text getMeteorPrefix() { + return PREFIX; + } + /** Registers a custom prefix to be used when calling from a class in the specified package. When null is returned from the supplier the default Meteor prefix is used. */ public static void registerCustomPrefix(String packageName, Supplier supplier) { for (Pair> pair : customPrefixes) { diff --git a/src/main/java/meteordevelopment/meteorclient/utils/render/MeteorToast.java b/src/main/java/meteordevelopment/meteorclient/utils/render/MeteorToast.java index 509c88ae7f..44c839db4e 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/render/MeteorToast.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/render/MeteorToast.java @@ -35,15 +35,15 @@ public class MeteorToast implements Toast { public MeteorToast(@Nullable Item item, @NotNull String title, @Nullable String text, long duration) { this.icon = item != null ? item.getDefaultStack() : null; - this.title = Text.literal(title).setStyle(Style.EMPTY.withColor(new TextColor(TITLE_COLOR))); - this.text = text != null ? Text.literal(text).setStyle(Style.EMPTY.withColor(new TextColor(TEXT_COLOR))) : null; + this.title = Text.literal(title).setStyle(Style.EMPTY.withColor(TextColor.fromRgb(TITLE_COLOR))); + this.text = text != null ? Text.literal(text).setStyle(Style.EMPTY.withColor(TextColor.fromRgb(TEXT_COLOR))) : null; this.duration = duration; } public MeteorToast(@Nullable Item item, @NotNull String title, @Nullable String text) { this.icon = item != null ? item.getDefaultStack() : null; - this.title = Text.literal(title).setStyle(Style.EMPTY.withColor(new TextColor(TITLE_COLOR))); - this.text = text != null ? Text.literal(text).setStyle(Style.EMPTY.withColor(new TextColor(TEXT_COLOR))) : null; + this.title = Text.literal(title).setStyle(Style.EMPTY.withColor(TextColor.fromRgb(TITLE_COLOR))); + this.text = text != null ? Text.literal(text).setStyle(Style.EMPTY.withColor(TextColor.fromRgb(TEXT_COLOR))) : null; this.duration = 6000; } @@ -85,12 +85,12 @@ public void setIcon(@Nullable Item item) { } public void setTitle(@NotNull String title) { - this.title = Text.literal(title).setStyle(Style.EMPTY.withColor(new TextColor(TITLE_COLOR))); + this.title = Text.literal(title).setStyle(Style.EMPTY.withColor(TextColor.fromRgb(TITLE_COLOR))); justUpdated = true; } public void setText(@Nullable String text) { - this.text = text != null ? Text.literal(text).setStyle(Style.EMPTY.withColor(new TextColor(TEXT_COLOR))) : null; + this.text = text != null ? Text.literal(text).setStyle(Style.EMPTY.withColor(TextColor.fromRgb(TEXT_COLOR))) : null; justUpdated = true; } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/render/color/Color.java b/src/main/java/meteordevelopment/meteorclient/utils/render/color/Color.java index e4eec5b823..d0f89d390a 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/render/color/Color.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/render/color/Color.java @@ -277,7 +277,7 @@ public SettingColor toSetting() { } public TextColor toTextColor() { - return new TextColor(getPacked()); + return TextColor.fromRgb(getPacked()); } public Style toStyle() { diff --git a/src/main/resources/meteor-client.accesswidener b/src/main/resources/meteor-client.accesswidener index 7c3d0c7ea1..39f93577bd 100644 --- a/src/main/resources/meteor-client.accesswidener +++ b/src/main/resources/meteor-client.accesswidener @@ -7,8 +7,6 @@ accessible class net/minecraft/network/packet/c2s/play/PlayerInteractEntityC accessible class net/minecraft/network/packet/c2s/play/PlayerInteractEntityC2SPacket$InteractTypeHandler accessible class net/minecraft/client/world/ClientChunkManager$ClientChunkMap -accessible method net/minecraft/text/TextColor (I)V - accessible field net/minecraft/client/network/AbstractClientPlayerEntity playerListEntry Lnet/minecraft/client/network/PlayerListEntry; accessible field net/minecraft/client/model/ModelPart cuboids Ljava/util/List; From 3a17c4ffe70528f3adf82d974c26c350767521eb Mon Sep 17 00:00:00 2001 From: Soda5601 <62250232+ThebestkillerTBK@users.noreply.github.com> Date: Fri, 3 Feb 2023 02:19:38 +0800 Subject: [PATCH 060/135] ESP crash hotfix and InvTweaks button pos (#3273) --- .../meteorclient/mixin/EntityMixin.java | 4 +++- .../mixin/HandledScreenMixin.java | 4 ++-- .../mixin/WorldRendererMixin.java | 13 ++++-------- .../systems/modules/render/ESP.java | 20 +++++++++---------- 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/EntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/EntityMixin.java index 21d1282856..328b254fc6 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/EntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/EntityMixin.java @@ -18,6 +18,7 @@ import meteordevelopment.meteorclient.systems.modules.render.NoRender; import meteordevelopment.meteorclient.utils.Utils; import meteordevelopment.meteorclient.utils.entity.fakeplayer.FakePlayerEntity; +import meteordevelopment.meteorclient.utils.render.color.Color; import meteordevelopment.meteorclient.utils.render.postprocess.PostProcessShaders; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -105,7 +106,8 @@ else if ((Object) this instanceof LivingEntity) { @Inject(method = "getTeamColorValue", at = @At("HEAD"), cancellable = true) private void onGetTeamColorValue(CallbackInfoReturnable info) { if (PostProcessShaders.rendering) { - info.setReturnValue(Modules.get().get(ESP.class).getColor((Entity) (Object) this).getPacked()); + Color color = Modules.get().get(ESP.class).getColor((Entity) (Object) this); + if (color != null) info.setReturnValue(color.getPacked()); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/HandledScreenMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/HandledScreenMixin.java index 7165c04f64..0ddd1638c2 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/HandledScreenMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/HandledScreenMixin.java @@ -60,14 +60,14 @@ private void onInit(CallbackInfo info) { if (invTweaks.isActive() && invTweaks.showButtons() && invTweaks.canSteal(getScreenHandler())) { addDrawableChild( new ButtonWidget.Builder(Text.literal("Steal"), button -> invTweaks.steal(getScreenHandler())) - .position(width / 2 - 40, 3) + .position(width / 2 - 41, 3) .size(40, 20) .build() ); addDrawableChild( new ButtonWidget.Builder(Text.literal("Dump"), button -> invTweaks.dump(getScreenHandler())) - .position(width / 2 - 40, 26) + .position(width / 2 + 2, 3) .size(40, 20) .build() ); diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/WorldRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/WorldRendererMixin.java index 5dca416814..5e08df776c 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/WorldRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/WorldRendererMixin.java @@ -28,8 +28,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.util.function.Supplier; - @Mixin(WorldRenderer.class) public abstract class WorldRendererMixin { @Shadow @@ -74,16 +72,13 @@ private void onRenderHead(MatrixStack matrices, float tickDelta, long limitTime, @Inject(method = "renderEntity", at = @At("HEAD")) private void renderEntity(Entity entity, double cameraX, double cameraY, double cameraZ, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, CallbackInfo info) { - draw(entity, cameraX, cameraY, cameraZ, tickDelta, vertexConsumers, matrices, PostProcessShaders.CHAMS, () -> Color.WHITE); - draw(entity, cameraX, cameraY, cameraZ, tickDelta, vertexConsumers, matrices, PostProcessShaders.ENTITY_OUTLINE, () -> Modules.get().get(ESP.class).getColor(entity)); + draw(entity, cameraX, cameraY, cameraZ, tickDelta, vertexConsumers, matrices, PostProcessShaders.CHAMS, Color.WHITE); + draw(entity, cameraX, cameraY, cameraZ, tickDelta, vertexConsumers, matrices, PostProcessShaders.ENTITY_OUTLINE, Modules.get().get(ESP.class).getColor(entity)); } @Unique - private void draw(Entity entity, double cameraX, double cameraY, double cameraZ, float tickDelta, VertexConsumerProvider vertexConsumers, MatrixStack matrices, EntityShader shader, Supplier colorSupplier) { - if (shader.shouldDraw(entity) && !PostProcessShaders.isCustom(vertexConsumers)) { - Color color = colorSupplier.get(); - if (color == null) return; - + private void draw(Entity entity, double cameraX, double cameraY, double cameraZ, float tickDelta, VertexConsumerProvider vertexConsumers, MatrixStack matrices, EntityShader shader, Color color) { + if (shader.shouldDraw(entity) && !PostProcessShaders.isCustom(vertexConsumers) && color != null) { Framebuffer prevBuffer = this.entityOutlinesFramebuffer; this.entityOutlinesFramebuffer = shader.framebuffer; PostProcessShaders.rendering = true; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/ESP.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/ESP.java index d85a2390cb..d1d7792092 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/ESP.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/ESP.java @@ -29,8 +29,6 @@ import net.minecraft.util.math.MathHelper; import org.joml.Vector3d; -import javax.annotation.Nullable; - public class ESP extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); private final SettingGroup sgColors = settings.createGroup("Colors"); @@ -83,7 +81,7 @@ public class ESP extends Module { .name("fill-opacity") .description("The opacity of the shape fill.") .visible(() -> shapeMode.get() != ShapeMode.Lines) - .defaultValue(0.8) + .defaultValue(0.3) .range(0, 1) .sliderMax(1) .build() @@ -202,8 +200,10 @@ private void onRender3D(Render3DEvent event) { private void drawBoundingBox(Render3DEvent event, Entity entity) { Color color = getColor(entity); - lineColor.set(color); - sideColor.set(color).a((int) (sideColor.a * fillOpacity.get())); + if (color != null) { + lineColor.set(color); + sideColor.set(color).a((int) (sideColor.a * fillOpacity.get())); + } if (mode.get() == Mode.Box) { double x = MathHelper.lerp(event.tickDelta, entity.lastRenderX, entity.getX()) - entity.getX(); @@ -212,8 +212,7 @@ private void drawBoundingBox(Render3DEvent event, Entity entity) { Box box = entity.getBoundingBox(); event.renderer.box(x + box.minX, y + box.minY, z + box.minZ, x + box.maxX, y + box.maxY, z + box.maxZ, sideColor, lineColor, shapeMode.get(), 0); - } - else { + } else { WireframeEntityRenderer.render(event, entity, 1, sideColor, lineColor, shapeMode.get()); } } @@ -254,8 +253,10 @@ private void onRender2D(Render2DEvent event) { // Setup color Color color = getColor(entity); - lineColor.set(color); - sideColor.set(color).a((int) (sideColor.a * fillOpacity.get())); + if (color != null) { + lineColor.set(color); + sideColor.set(color).a((int) (sideColor.a * fillOpacity.get())); + } // Render if (shapeMode.get() != ShapeMode.Lines && sideColor.a > 0) { @@ -301,7 +302,6 @@ public boolean shouldSkip(Entity entity) { return !EntityUtils.isInRenderDistance(entity); } - @Nullable public Color getColor(Entity entity) { if (!entities.get().getBoolean(entity.getType())) return null; From 98a78d62e8594688081d6ff3541448cece5e8277 Mon Sep 17 00:00:00 2001 From: DesiCow Date: Wed, 1 Feb 2023 20:22:58 +0530 Subject: [PATCH 061/135] Fixed ChestSwap module feedback --- .../meteorclient/systems/modules/player/ChestSwap.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/ChestSwap.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/ChestSwap.java index a4098e097c..92e12dbc9f 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/ChestSwap.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/ChestSwap.java @@ -132,6 +132,6 @@ private void equip(int slot) { @Override public void sendToggledMsg() { if (stayOn.get()) super.sendToggledMsg(); - else if (Config.get().chatFeedback.get()) info("Triggered (highlight)%s(default).", title); + else if (Config.get().chatFeedback.get() && chatFeedback) info("Triggered (highlight)%s(default).", title); } } From f0fe2bde21896965ec0e77e20e7e8d7ba427f475 Mon Sep 17 00:00:00 2001 From: DesiCow <80271842+DesiCow@users.noreply.github.com> Date: Fri, 3 Feb 2023 00:05:47 +0530 Subject: [PATCH 062/135] Added direction to Rotate command (#3233) --- .../arguments/DirectionArgumentType.java | 19 +++++++++++++++++++ .../commands/commands/RotationCommand.java | 9 +++++++++ .../systems/modules/player/Rotation.java | 2 ++ 3 files changed, 30 insertions(+) create mode 100644 src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/DirectionArgumentType.java diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/DirectionArgumentType.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/DirectionArgumentType.java new file mode 100644 index 0000000000..80cdccf56e --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/DirectionArgumentType.java @@ -0,0 +1,19 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.systems.commands.arguments; + +import net.minecraft.command.argument.EnumArgumentType; +import net.minecraft.util.math.Direction; + +public class DirectionArgumentType extends EnumArgumentType { + private DirectionArgumentType() { + super(Direction.CODEC, Direction::values); + } + + public static DirectionArgumentType create() { + return new DirectionArgumentType(); + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/RotationCommand.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/RotationCommand.java index 005f3426bc..4e3c43b3f1 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/RotationCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/RotationCommand.java @@ -8,7 +8,9 @@ import com.mojang.brigadier.arguments.FloatArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import meteordevelopment.meteorclient.systems.commands.Command; +import meteordevelopment.meteorclient.systems.commands.arguments.DirectionArgumentType; import net.minecraft.command.CommandSource; +import net.minecraft.util.math.Direction; import net.minecraft.util.math.MathHelper; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; @@ -22,6 +24,13 @@ public RotationCommand() { public void build(LiteralArgumentBuilder builder) { builder .then(literal("set") + .then(argument("direction", DirectionArgumentType.create()) + .executes(context -> { + mc.player.setPitch(context.getArgument("direction", Direction.class).getVector().getY() * -90); + mc.player.setYaw(context.getArgument("direction", Direction.class).asRotation()); + + return SINGLE_SUCCESS; + })) .then(argument("pitch", FloatArgumentType.floatArg(-90, 90)) .executes(context -> { mc.player.setPitch(context.getArgument("pitch", Float.class)); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/Rotation.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/Rotation.java index ad2c01db5b..3f5d5fb8bd 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/Rotation.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/Rotation.java @@ -33,6 +33,7 @@ public class Rotation extends Module { .defaultValue(0) .sliderMax(360) .max(360) + .visible(() -> yawLockMode.get() == LockMode.Simple) .build() ); @@ -51,6 +52,7 @@ public class Rotation extends Module { .defaultValue(0) .range(-90, 90) .sliderRange(-90, 90) + .visible(() -> pitchLockMode.get() == LockMode.Simple) .build() ); From 974b0b413b43e7e71cfb871373f6017aa6cc5f98 Mon Sep 17 00:00:00 2001 From: DesiCow Date: Fri, 3 Feb 2023 20:39:34 +0530 Subject: [PATCH 063/135] NoFall: Added AntiBounce option Disables bouncing on slime-block and bed upon landing. --- .../meteorclient/mixin/BedBlockMixin.java | 25 +++++++++++++++++++ .../meteorclient/mixin/SlimeBlockMixin.java | 6 +++++ .../systems/modules/movement/NoFall.java | 11 ++++++++ src/main/resources/meteor-client.mixins.json | 1 + 4 files changed, 43 insertions(+) create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/BedBlockMixin.java diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/BedBlockMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/BedBlockMixin.java new file mode 100644 index 0000000000..f53340d819 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/BedBlockMixin.java @@ -0,0 +1,25 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.movement.NoFall; +import net.minecraft.block.BedBlock; +import net.minecraft.entity.Entity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import static meteordevelopment.meteorclient.MeteorClient.mc; + +@Mixin(BedBlock.class) +public class BedBlockMixin { + @Inject(method = "bounceEntity", at = @At("HEAD"), cancellable = true) + private void onBounceEntity(Entity entity, CallbackInfo info) { + if (Modules.get().get(NoFall.class).cancelBounce() && entity == mc.player) info.cancel(); + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/SlimeBlockMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/SlimeBlockMixin.java index 27a0d7455e..89faf7390b 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/SlimeBlockMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/SlimeBlockMixin.java @@ -6,6 +6,7 @@ package meteordevelopment.meteorclient.mixin; import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.movement.NoFall; import meteordevelopment.meteorclient.systems.modules.movement.NoSlow; import net.minecraft.block.BlockState; import net.minecraft.block.SlimeBlock; @@ -25,4 +26,9 @@ public class SlimeBlockMixin { private void onSteppedOn(World world, BlockPos pos, BlockState state, Entity entity, CallbackInfo info) { if (Modules.get().get(NoSlow.class).slimeBlock() && entity == mc.player) info.cancel(); } + + @Inject(method = "bounce", at = @At("HEAD"), cancellable = true) + private void onBounce(Entity entity, CallbackInfo info) { + if (Modules.get().get(NoFall.class).cancelBounce() && entity == mc.player) info.cancel(); + } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/NoFall.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/NoFall.java index 821d3e6edc..6bc05b35bb 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/NoFall.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/NoFall.java @@ -82,6 +82,13 @@ public class NoFall extends Module { .build() ); + private final Setting antiBounce = sgGeneral.add(new BoolSetting.Builder() + .name("anti-bounce") + .description("Disables bouncing on slime-block and bed upon landing.") + .defaultValue(true) + .build() + ); + private boolean placedWater; private BlockPos targetPos; private int timer; @@ -184,6 +191,10 @@ else if (mode.get() == Mode.Place) { } } + public boolean cancelBounce() { + return isActive() && antiBounce.get(); + } + private void useItem(FindItemResult item, boolean placedWater, BlockPos blockPos, boolean interactItem) { if (!item.found()) return; diff --git a/src/main/resources/meteor-client.mixins.json b/src/main/resources/meteor-client.mixins.json index 0aa5e1c57d..3d58689c99 100644 --- a/src/main/resources/meteor-client.mixins.json +++ b/src/main/resources/meteor-client.mixins.json @@ -16,6 +16,7 @@ "BannerBlockEntityRendererMixin", "BeaconBlockEntityRendererMixin", "BeaconScreenMixin", + "BedBlockMixin", "BiomeColorsMixin", "BlockCollisionSpliteratorMixin", "BlockEntityRenderDispatcherMixin", From 91a014508829107640eda7eebf1c9b6c92bcb20e Mon Sep 17 00:00:00 2001 From: DesiCow Date: Fri, 3 Feb 2023 20:32:28 +0530 Subject: [PATCH 064/135] Nametags: Ignore friends --- .../meteorclient/systems/friends/Friends.java | 2 +- .../meteorclient/systems/modules/render/Nametags.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/friends/Friends.java b/src/main/java/meteordevelopment/meteorclient/systems/friends/Friends.java index 3bd7768469..8df4f22ebe 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/friends/Friends.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/friends/Friends.java @@ -73,7 +73,7 @@ public Friend get(PlayerListEntry player) { } public boolean isFriend(PlayerEntity player) { - return get(player) != null; + return player != null && get(player) != null; } public boolean isFriend(PlayerListEntry player) { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Nametags.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Nametags.java index 50fff44629..8fbe41bf73 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Nametags.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Nametags.java @@ -12,6 +12,7 @@ import meteordevelopment.meteorclient.renderer.text.TextRenderer; import meteordevelopment.meteorclient.settings.*; import meteordevelopment.meteorclient.systems.config.Config; +import meteordevelopment.meteorclient.systems.friends.Friends; import meteordevelopment.meteorclient.systems.modules.Categories; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.systems.modules.Modules; @@ -68,6 +69,13 @@ public class Nametags extends Module { .build() ); + private final Setting ignoreFriends = sgGeneral.add(new BoolSetting.Builder() + .name("ignore-friends") + .description("Ignore rendering nametags for friends.") + .defaultValue(false) + .build() + ); + private final Setting ignoreBots = sgGeneral.add(new BoolSetting.Builder() .name("ignore-bots") .description("Only render non-bot nametags.") @@ -299,6 +307,7 @@ private void onTick(TickEvent.Post event) { if (type == EntityType.PLAYER) { if ((ignoreSelf.get() || (freecamNotActive && notThirdPerson)) && entity == mc.player) continue; if (EntityUtils.getGameMode((PlayerEntity) entity) == null && ignoreBots.get()) continue; + if (Friends.get().isFriend((PlayerEntity) entity) && ignoreFriends.get()) continue; } if (!culling.get() || PlayerUtils.isWithinCamera(entity, maxCullRange.get())) { From 672b2ac4ff7ca062ba631d270344cfc454b5d1da Mon Sep 17 00:00:00 2001 From: DesiCow Date: Fri, 3 Feb 2023 20:28:03 +0530 Subject: [PATCH 065/135] InvTweaks: Auto drop Item only if equipped in armor slot --- .../systems/modules/misc/InventoryTweaks.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java index 6817624a0b..aec04ccd07 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java @@ -126,15 +126,22 @@ public class InventoryTweaks extends Module { .build() ); + private final Setting autoDropExcludeEquipped = sgAutoDrop.add(new BoolSetting.Builder() + .name("exclude-equipped") + .description("Whether or not to drop items equipped in armor slots.") + .defaultValue(true) + .build() + ); + private final Setting autoDropExcludeHotbar = sgAutoDrop.add(new BoolSetting.Builder() - .name("auto-drop-exclude-hotbar") + .name("exclude-hotbar") .description("Whether or not to drop items from your hotbar.") .defaultValue(false) .build() ); private final Setting autoDropOnlyFullStacks = sgAutoDrop.add(new BoolSetting.Builder() - .name("auto-drop-only-full-stacks") + .name("only-full-stacks") .description("Only drops the items if the stack is full.") .defaultValue(false) .build() @@ -358,8 +365,8 @@ private void onTickPost(TickEvent.Post event) { ItemStack itemStack = mc.player.getInventory().getStack(i); if (autoDropItems.get().contains(itemStack.getItem())) { - if (!autoDropOnlyFullStacks.get() || itemStack.getCount() == itemStack.getMaxCount()) - InvUtils.drop().slot(i); + if ((!autoDropOnlyFullStacks.get() || itemStack.getCount() == itemStack.getMaxCount()) && + !(autoDropExcludeEquipped.get() && SlotUtils.isArmor(i))) InvUtils.drop().slot(i); } } } From 2114516039bf50417a707f91885d8ee9148c58fd Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Fri, 3 Feb 2023 15:03:19 +0800 Subject: [PATCH 066/135] Skin Protect closes #1285 --- .../mixin/PlayerEntityRendererMixin.java | 15 +++++++++++++ .../systems/modules/misc/NameProtect.java | 22 ++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityRendererMixin.java index ea35d8defe..ffe42987c7 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityRendererMixin.java @@ -6,6 +6,7 @@ package meteordevelopment.meteorclient.mixin; import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.misc.NameProtect; import meteordevelopment.meteorclient.systems.modules.render.Chams; import meteordevelopment.meteorclient.systems.modules.render.HandView; import meteordevelopment.meteorclient.utils.render.color.Color; @@ -15,16 +16,30 @@ import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.PlayerEntityRenderer; +import net.minecraft.client.util.DefaultSkinHelper; import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.entity.Entity; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyArgs; import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.invoke.arg.Args; @Mixin(PlayerEntityRenderer.class) public class PlayerEntityRendererMixin { + @Inject(method = "getTexture(Lnet/minecraft/client/network/AbstractClientPlayerEntity;)Lnet/minecraft/util/Identifier;", at = @At("HEAD"), cancellable = true) + private void onGetTexture(AbstractClientPlayerEntity abstractClientPlayerEntity, CallbackInfoReturnable info) { + if (Modules.get().get(NameProtect.class).skinProtect()) info.setReturnValue(DefaultSkinHelper.getTexture()); + } + + @Redirect(method = "renderArm", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;getSkinTexture()Lnet/minecraft/util/Identifier;")) + private Identifier onGetTexture(AbstractClientPlayerEntity player) { + return Modules.get().get(NameProtect.class).skinProtect() ? DefaultSkinHelper.getTexture() : player.getSkinTexture(); + } + @ModifyArgs(method = "renderArm", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelPart;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;II)V", ordinal = 0)) private void modifyRenderLayer(Args args, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, AbstractClientPlayerEntity player, ModelPart arm, ModelPart sleeve) { Chams chams = Modules.get().get(Chams.class); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/NameProtect.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/NameProtect.java index a7cb5e7674..a3bfdbd8cd 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/NameProtect.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/NameProtect.java @@ -5,6 +5,7 @@ package meteordevelopment.meteorclient.systems.modules.misc; +import meteordevelopment.meteorclient.settings.BoolSetting; import meteordevelopment.meteorclient.settings.Setting; import meteordevelopment.meteorclient.settings.SettingGroup; import meteordevelopment.meteorclient.settings.StringSetting; @@ -14,17 +15,32 @@ public class NameProtect extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); + private final Setting nameProtect = sgGeneral.add(new BoolSetting.Builder() + .name("name-protect") + .description("Hides your name client-side.") + .defaultValue(true) + .build() + ); + private final Setting name = sgGeneral.add(new StringSetting.Builder() .name("name") .description("Name to be replaced with.") .defaultValue("seasnail") + .visible(nameProtect::get) .build() ); + private final Setting skinProtect = sgGeneral.add(new BoolSetting.Builder() + .name("skin-protect") + .description("Make players become Steves.") + .defaultValue(true) + .build() + ); + private String username = "If you see this, something is wrong."; public NameProtect() { - super(Categories.Player, "name-protect", "Hides your name client-side."); + super(Categories.Player, "name-protect", "Hide player names and skins."); } @Override @@ -47,4 +63,8 @@ public String getName(String original) { return original; } + + public boolean skinProtect() { + return isActive() && skinProtect.get(); + } } From 8dd4c523ff75cb53018e5e139f15d8a0b2325402 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Fri, 3 Feb 2023 15:10:51 +0800 Subject: [PATCH 067/135] Mixing into PlayerListEntry --- .../mixin/PlayerEntityRendererMixin.java | 15 ------------ .../mixin/PlayerListEntryMixin.java | 24 +++++++++++++++++++ src/main/resources/meteor-client.mixins.json | 1 + 3 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/PlayerListEntryMixin.java diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityRendererMixin.java index ffe42987c7..ea35d8defe 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityRendererMixin.java @@ -6,7 +6,6 @@ package meteordevelopment.meteorclient.mixin; import meteordevelopment.meteorclient.systems.modules.Modules; -import meteordevelopment.meteorclient.systems.modules.misc.NameProtect; import meteordevelopment.meteorclient.systems.modules.render.Chams; import meteordevelopment.meteorclient.systems.modules.render.HandView; import meteordevelopment.meteorclient.utils.render.color.Color; @@ -16,30 +15,16 @@ import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.PlayerEntityRenderer; -import net.minecraft.client.util.DefaultSkinHelper; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.Entity; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyArgs; import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.invoke.arg.Args; @Mixin(PlayerEntityRenderer.class) public class PlayerEntityRendererMixin { - @Inject(method = "getTexture(Lnet/minecraft/client/network/AbstractClientPlayerEntity;)Lnet/minecraft/util/Identifier;", at = @At("HEAD"), cancellable = true) - private void onGetTexture(AbstractClientPlayerEntity abstractClientPlayerEntity, CallbackInfoReturnable info) { - if (Modules.get().get(NameProtect.class).skinProtect()) info.setReturnValue(DefaultSkinHelper.getTexture()); - } - - @Redirect(method = "renderArm", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;getSkinTexture()Lnet/minecraft/util/Identifier;")) - private Identifier onGetTexture(AbstractClientPlayerEntity player) { - return Modules.get().get(NameProtect.class).skinProtect() ? DefaultSkinHelper.getTexture() : player.getSkinTexture(); - } - @ModifyArgs(method = "renderArm", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelPart;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;II)V", ordinal = 0)) private void modifyRenderLayer(Args args, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, AbstractClientPlayerEntity player, ModelPart arm, ModelPart sleeve) { Chams chams = Modules.get().get(Chams.class); diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerListEntryMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerListEntryMixin.java new file mode 100644 index 0000000000..30f4a5aac1 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerListEntryMixin.java @@ -0,0 +1,24 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.misc.NameProtect; +import net.minecraft.client.network.PlayerListEntry; +import net.minecraft.client.util.DefaultSkinHelper; +import net.minecraft.util.Identifier; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(PlayerListEntry.class) +public class PlayerListEntryMixin { + @Inject(method = "getSkinTexture", at = @At("HEAD"), cancellable = true) + private void onGetTexture(CallbackInfoReturnable info) { + if (Modules.get().get(NameProtect.class).skinProtect()) info.setReturnValue(DefaultSkinHelper.getTexture()); + } +} diff --git a/src/main/resources/meteor-client.mixins.json b/src/main/resources/meteor-client.mixins.json index 3d58689c99..2d3918a6db 100644 --- a/src/main/resources/meteor-client.mixins.json +++ b/src/main/resources/meteor-client.mixins.json @@ -122,6 +122,7 @@ "PlayerEntityMixin", "PlayerEntityRendererMixin", "PlayerInteractEntityC2SPacketMixin", + "PlayerListEntryMixin", "PlayerListHudMixin", "PlayerMoveC2SPacketAccessor", "PlayerMoveC2SPacketMixin", From 5d2ccda8a14598a88c16ee0653fe41cabe4e7ee0 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Fri, 3 Feb 2023 15:14:55 +0800 Subject: [PATCH 068/135] Only hide own --- .../meteorclient/mixin/PlayerListEntryMixin.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerListEntryMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerListEntryMixin.java index 30f4a5aac1..7c5a0c1068 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerListEntryMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerListEntryMixin.java @@ -5,20 +5,30 @@ package meteordevelopment.meteorclient.mixin; +import com.mojang.authlib.GameProfile; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.misc.NameProtect; +import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.PlayerListEntry; import net.minecraft.client.util.DefaultSkinHelper; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(PlayerListEntry.class) -public class PlayerListEntryMixin { +public abstract class PlayerListEntryMixin { + @Shadow + public abstract GameProfile getProfile(); + @Inject(method = "getSkinTexture", at = @At("HEAD"), cancellable = true) private void onGetTexture(CallbackInfoReturnable info) { - if (Modules.get().get(NameProtect.class).skinProtect()) info.setReturnValue(DefaultSkinHelper.getTexture()); + if (getProfile().getName().equals(MinecraftClient.getInstance().getSession().getUsername())) { + if (Modules.get().get(NameProtect.class).skinProtect()) { + info.setReturnValue(DefaultSkinHelper.getTexture()); + } + } } } From abdf75b5cc7cdd02443c310dfe489ab87c37317b Mon Sep 17 00:00:00 2001 From: Wide-Cat Date: Fri, 3 Feb 2023 00:17:12 +0000 Subject: [PATCH 069/135] Add enchant glint to no render --- .../meteorclient/mixin/ItemRendererMixin.java | 39 +++++++++++++++++++ .../systems/modules/render/NoRender.java | 11 ++++++ src/main/resources/meteor-client.mixins.json | 1 + 3 files changed, 51 insertions(+) create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/ItemRendererMixin.java diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ItemRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ItemRendererMixin.java new file mode 100644 index 0000000000..3dc2b3fe99 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ItemRendererMixin.java @@ -0,0 +1,39 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.render.NoRender; +import net.minecraft.block.StainedGlassPaneBlock; +import net.minecraft.block.TransparentBlock; +import net.minecraft.client.render.RenderLayers; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.item.ItemRenderer; +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.json.ModelTransformation; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.item.BlockItem; +import net.minecraft.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyArgs; +import org.spongepowered.asm.mixin.injection.invoke.arg.Args; + +@Mixin(ItemRenderer.class) +public class ItemRendererMixin { + @ModifyArgs( + method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformation$Mode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/render/model/BakedModel;)V", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/render/item/ItemRenderer;renderBakedItemModel(Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/item/ItemStack;IILnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;)V" + ) + ) + private void modifyEnchant(Args args, ItemStack stack, ModelTransformation.Mode renderMode, boolean leftHanded, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, BakedModel model) { + if (!Modules.get().get(NoRender.class).noEnchantGlint()) return; + boolean bl = (renderMode == ModelTransformation.Mode.GUI || renderMode.isFirstPerson() || !(stack.getItem() instanceof BlockItem blockItem) || !(blockItem.getBlock() instanceof TransparentBlock) && !(blockItem.getBlock() instanceof StainedGlassPaneBlock)); + args.set(5, vertexConsumers.getBuffer(RenderLayers.getItemLayer(stack, bl))); + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/NoRender.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/NoRender.java index c94e74b607..d88c3134a5 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/NoRender.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/NoRender.java @@ -118,6 +118,13 @@ public class NoRender extends Module { .build() ); + private final Setting noEnchantGlint = sgOverlay.add(new BoolSetting.Builder() + .name("enchantment-glint") + .description("Disables rending of the enchantment glint.") + .defaultValue(false) + .build() + ); + // HUD private final Setting noBossBar = sgHUD.add(new BoolSetting.Builder() @@ -404,6 +411,10 @@ public boolean noEatParticles() { return isActive() && noEatParticles.get(); } + public boolean noEnchantGlint() { + return isActive() && noEnchantGlint.get(); + } + // HUD public boolean noBossBar() { diff --git a/src/main/resources/meteor-client.mixins.json b/src/main/resources/meteor-client.mixins.json index 2d3918a6db..b135698c5f 100644 --- a/src/main/resources/meteor-client.mixins.json +++ b/src/main/resources/meteor-client.mixins.json @@ -97,6 +97,7 @@ "ItemEntityMixin", "ItemEntityRendererMixin", "ItemMixin", + "ItemRendererMixin", "ItemStackAccessor", "ItemStackMixin", "KeyBindingAccessor", From 887dafe213eb838756c5ae62c94d22247b6c557e Mon Sep 17 00:00:00 2001 From: DesiCow Date: Thu, 2 Feb 2023 21:55:59 +0530 Subject: [PATCH 070/135] Added blocks filter to SpeedMine module --- .../meteorclient/mixin/PlayerEntityMixin.java | 2 +- .../systems/modules/player/SpeedMine.java | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityMixin.java index f1fef3d181..1d2a5f0a5a 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityMixin.java @@ -59,7 +59,7 @@ private void onDropItem(ItemStack stack, boolean bl, boolean bl2, CallbackInfoRe @Inject(method = "getBlockBreakingSpeed", at = @At(value = "RETURN"), cancellable = true) public void onGetBlockBreakingSpeed(BlockState block, CallbackInfoReturnable cir) { SpeedMine module = Modules.get().get(SpeedMine.class); - if (!module.isActive() || module.mode.get() != SpeedMine.Mode.Normal) return; + if (!module.isActive() || !module.filter(block.getBlock()) || module.mode.get() != SpeedMine.Mode.Normal) return; float breakSpeed = cir.getReturnValue(); float breakSpeedMod = (float) (breakSpeed * module.modifier.get()); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/SpeedMine.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/SpeedMine.java index 63afe2eb48..bd50a7b516 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/SpeedMine.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/SpeedMine.java @@ -7,6 +7,7 @@ import meteordevelopment.meteorclient.events.world.TickEvent; import meteordevelopment.meteorclient.mixin.StatusEffectInstanceAccessor; +import meteordevelopment.meteorclient.settings.BlockListSetting; import meteordevelopment.meteorclient.settings.DoubleSetting; import meteordevelopment.meteorclient.settings.EnumSetting; import meteordevelopment.meteorclient.settings.Setting; @@ -14,13 +15,30 @@ import meteordevelopment.meteorclient.systems.modules.Categories; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.orbit.EventHandler; +import net.minecraft.block.Block; import net.minecraft.entity.effect.StatusEffectInstance; +import java.util.List; + import static net.minecraft.entity.effect.StatusEffects.HASTE; public class SpeedMine extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); + private final Setting> blocks = sgGeneral.add(new BlockListSetting.Builder() + .name("blocks") + .description("Selected blocks.") + .filter(block -> block.getHardness() > 0) + .build() + ); + + private final Setting blocksFilter = sgGeneral.add(new EnumSetting.Builder() + .name("blocks-filter") + .description("How to use the blocks setting.") + .defaultValue(ListMode.Blacklist) + .build() + ); + public final Setting mode = sgGeneral.add(new EnumSetting.Builder() .name("mode") .defaultValue(Mode.Normal) @@ -53,9 +71,21 @@ private void onTick(TickEvent.Post event) { if (effect.getDuration() < 20) ((StatusEffectInstanceAccessor) effect).setDuration(20); } + public boolean filter(Block block) { + if (blocksFilter.get() == ListMode.Blacklist && !blocks.get().contains(block)) return true; + else if (blocksFilter.get() == ListMode.Whitelist && blocks.get().contains(block)) return true; + + return false; + } + public enum Mode { Normal, Haste1, Haste2 } + + public enum ListMode { + Whitelist, + Blacklist + } } From db2383a7b6a5c9d625f17978ae06ad2bf14e3556 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Wed, 1 Feb 2023 23:53:05 +0800 Subject: [PATCH 071/135] Scaffold code cleanup --- .../systems/modules/movement/Scaffold.java | 113 ++++++------------ 1 file changed, 34 insertions(+), 79 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java index e6b7707f66..bbe8df751d 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java @@ -5,7 +5,6 @@ package meteordevelopment.meteorclient.systems.modules.movement; -import meteordevelopment.meteorclient.events.render.Render3DEvent; import meteordevelopment.meteorclient.events.world.TickEvent; import meteordevelopment.meteorclient.renderer.ShapeMode; import meteordevelopment.meteorclient.settings.*; @@ -15,7 +14,6 @@ import meteordevelopment.meteorclient.utils.player.InvUtils; import meteordevelopment.meteorclient.utils.player.PlayerUtils; import meteordevelopment.meteorclient.utils.render.RenderUtils; -import meteordevelopment.meteorclient.utils.render.color.Color; import meteordevelopment.meteorclient.utils.render.color.SettingColor; import meteordevelopment.meteorclient.utils.world.BlockUtils; import meteordevelopment.orbit.EventHandler; @@ -133,15 +131,6 @@ public class Scaffold extends Module { .build() ); - private final Setting fadeDuration = sgRender.add(new IntSetting.Builder() - .name("fade-duration") - .description("How long for the rendered blocks to fade in ticks.") - .min(2) - .defaultValue(10) - .visible(render::get) - .build() - ); - private final BlockPos.Mutable bp = new BlockPos.Mutable(); private final BlockPos.Mutable prevBp = new BlockPos.Mutable(); @@ -165,50 +154,46 @@ private void onTick(TickEvent.Pre event) { if (airPlace.get()) { Vec3d vec = mc.player.getPos().add(mc.player.getVelocity()).add(0, -0.5f, 0); bp.set(vec.getX(), vec.getY(), vec.getZ()); - + } else if (BlockUtils.getPlaceSide(mc.player.getBlockPos().down()) != null) { + bp.set(mc.player.getBlockPos().down()); } else { - if (BlockUtils.getPlaceSide(mc.player.getBlockPos().down()) != null) { - bp.set(mc.player.getBlockPos().down()); - - } else { - Vec3d pos = mc.player.getPos(); - pos = pos.add(0, -0.98f, 0); - pos.add(mc.player.getVelocity()); - - if (!PlayerUtils.isWithin(prevBp, placeRange.get())) { - List blockPosArray = new ArrayList<>(); - - for (int x = (int) (mc.player.getX() - placeRange.get()); x < mc.player.getX() + placeRange.get(); x++) { - for (int z = (int) (mc.player.getZ() - placeRange.get()); z < mc.player.getZ() + placeRange.get(); z++) { - for (int y = (int) Math.max(mc.world.getBottomY(), mc.player.getY() - placeRange.get()); y < Math.min(mc.world.getTopY(), mc.player.getY() + placeRange.get()); y++) { - bp.set(x, y, z); - if (!mc.world.getBlockState(bp).isAir()) blockPosArray.add(new BlockPos(bp)); - } + Vec3d pos = mc.player.getPos(); + pos = pos.add(0, -0.98f, 0); + pos.add(mc.player.getVelocity()); + + if (!PlayerUtils.isWithin(prevBp, placeRange.get())) { + List blockPosArray = new ArrayList<>(); + + for (int x = (int) (mc.player.getX() - placeRange.get()); x < mc.player.getX() + placeRange.get(); x++) { + for (int z = (int) (mc.player.getZ() - placeRange.get()); z < mc.player.getZ() + placeRange.get(); z++) { + for (int y = (int) Math.max(mc.world.getBottomY(), mc.player.getY() - placeRange.get()); y < Math.min(mc.world.getTopY(), mc.player.getY() + placeRange.get()); y++) { + bp.set(x, y, z); + if (!mc.world.getBlockState(bp).isAir()) blockPosArray.add(new BlockPos(bp)); } } - if (blockPosArray.size() == 0) { - return; - } + } + if (blockPosArray.size() == 0) { + return; + } - blockPosArray.sort(Comparator.comparingDouble(PlayerUtils::squaredDistanceTo)); + blockPosArray.sort(Comparator.comparingDouble(PlayerUtils::squaredDistanceTo)); - prevBp.set(blockPosArray.get(0)); - } + prevBp.set(blockPosArray.get(0)); + } - Vec3d vecPrevBP = new Vec3d((double) prevBp.getX() + 0.5f, - (double) prevBp.getY() + 0.5f, - (double) prevBp.getZ() + 0.5f); + Vec3d vecPrevBP = new Vec3d((double) prevBp.getX() + 0.5f, + (double) prevBp.getY() + 0.5f, + (double) prevBp.getZ() + 0.5f); - Vec3d sub = pos.subtract(vecPrevBP); - Direction facing; - if (sub.getY() < -0.5f) { - facing = Direction.DOWN; - } else if (sub.getY() > 0.5f) { - facing = Direction.UP; - } else facing = Direction.getFacing(sub.getX(), 0, sub.getZ()); + Vec3d sub = pos.subtract(vecPrevBP); + Direction facing; + if (sub.getY() < -0.5f) { + facing = Direction.DOWN; + } else if (sub.getY() > 0.5f) { + facing = Direction.UP; + } else facing = Direction.getFacing(sub.getX(), 0, sub.getZ()); - bp.set(prevBp.offset(facing)); - } + bp.set(prevBp.offset(facing)); } FindItemResult item = InvUtils.findInHotbar(itemStack -> validItem(itemStack, bp)); @@ -234,7 +219,8 @@ private void onTick(TickEvent.Pre event) { if (BlockUtils.place(bp, item, rotate.get(), 50, renderSwing.get(), true)) { // Render block if was placed - if (render.get()) RenderUtils.renderTickingBlock(bp.toImmutable(), sideColor.get(), lineColor.get(), shapeMode.get(), 0, 8, true, false); + if (render.get()) + RenderUtils.renderTickingBlock(bp.toImmutable(), sideColor.get(), lineColor.get(), shapeMode.get(), 0, 8, true, false); // Move player down so they are on top of the placed block ready to jump again if (mc.options.jumpKey.isPressed() && !mc.options.sneakKey.isPressed() && !mc.player.isOnGround() && !mc.world.getBlockState(bp).isAir() && fastTower.get()) { @@ -263,39 +249,8 @@ private boolean validItem(ItemStack itemStack, BlockPos pos) { return !(block instanceof FallingBlock) || !FallingBlock.canFallThrough(mc.world.getBlockState(pos)); } - // Rendering - public enum ListMode { Whitelist, Blacklist } - - public static class RenderBlock { - public BlockPos.Mutable pos = new BlockPos.Mutable(); - public int ticks; - - public RenderBlock set(BlockPos blockPos) { - pos.set(blockPos); - ticks = 8; - - return this; - } - - public void tick() { - ticks--; - } - - public void render(Render3DEvent event, Color sides, Color lines, ShapeMode shapeMode) { - int preSideA = sides.a; - int preLineA = lines.a; - - sides.a *= (double) ticks / 8; - lines.a *= (double) ticks / 8; - - event.renderer.box(pos, sides, lines, shapeMode, 0); - - sides.a = preSideA; - lines.a = preLineA; - } - } } From 1c8c8ff35f2d2eae0789d6cc106a2626971f64af Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Thu, 2 Feb 2023 14:35:52 +0800 Subject: [PATCH 072/135] Scaffold Radius, also fixed buggy BlockUtils placement when bpt > 1 --- .../systems/modules/movement/Scaffold.java | 80 +++++++++++++++---- .../meteorclient/utils/world/BlockUtils.java | 13 ++- 2 files changed, 72 insertions(+), 21 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java index bbe8df751d..ddf18d376b 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java @@ -53,6 +53,14 @@ public class Scaffold extends Module { .build() ); + private final Setting cancelVelocity = sgGeneral.add(new BoolSetting.Builder() + .name("cancel-velocity") + .description("Whether or not to cancel velocity when towering.") + .defaultValue(false) + .visible(fastTower::get) + .build() + ); + private final Setting onlyOnClick = sgGeneral.add(new BoolSetting.Builder() .name("only-on-click") .description("Only places blocks when holding right click.") @@ -98,6 +106,25 @@ public class Scaffold extends Module { .build() ); + private final Setting range = sgGeneral.add(new DoubleSetting.Builder() + .name("range") + .description("Scaffold radius.") + .defaultValue(3) + .min(0) + .max(6) + .visible(() -> !airPlace.get()) + .build() + ); + + private final Setting blocksPerTick = sgGeneral.add(new IntSetting.Builder() + .name("blocks-per-tick") + .description("How many blocks to place in one tick.") + .defaultValue(3) + .min(1) + .visible(() -> !airPlace.get()) + .build() + ); + // Render private final Setting render = sgRender.add(new BoolSetting.Builder() @@ -196,12 +223,6 @@ private void onTick(TickEvent.Pre event) { bp.set(prevBp.offset(facing)); } - FindItemResult item = InvUtils.findInHotbar(itemStack -> validItem(itemStack, bp)); - if (!item.found()) return; - - - if (item.getHand() == null && !autoSwitch.get()) return; - // Move down if shifting if (mc.options.sneakKey.isPressed() && !mc.options.jumpKey.isPressed()) { if (lastSneakingY - mc.player.getY() < 0.1) { @@ -214,20 +235,36 @@ private void onTick(TickEvent.Pre event) { if (!lastWasSneaking) lastSneakingY = mc.player.getY(); if (mc.options.jumpKey.isPressed() && !mc.options.sneakKey.isPressed() && fastTower.get()) { - mc.player.setVelocity(0, 0.42f, 0); + Vec3d vel = mc.player.getVelocity(); + mc.player.setVelocity(cancelVelocity.get() ? 0 : vel.x, 0.42, cancelVelocity.get() ? 0 : vel.z); } - if (BlockUtils.place(bp, item, rotate.get(), 50, renderSwing.get(), true)) { - // Render block if was placed - if (render.get()) - RenderUtils.renderTickingBlock(bp.toImmutable(), sideColor.get(), lineColor.get(), shapeMode.get(), 0, 8, true, false); + if (!airPlace.get()) { + List blocks = new ArrayList<>(); + for (double x = mc.player.getX() - range.get(); x <= mc.player.getX() + range.get(); x = x + 0.5) { + for (double z = mc.player.getZ() - range.get(); z <= mc.player.getZ() + range.get(); z = z + 0.5) { + blocks.add(new BlockPos(x, mc.player.getY() - 0.5, z)); + } + } + + if (!blocks.isEmpty()) { + blocks.sort(Comparator.comparingDouble(PlayerUtils::squaredDistanceTo)); + int counter = 0; + for (BlockPos block : blocks) { + if (place(block)) counter++; - // Move player down so they are on top of the placed block ready to jump again - if (mc.options.jumpKey.isPressed() && !mc.options.sneakKey.isPressed() && !mc.player.isOnGround() && !mc.world.getBlockState(bp).isAir() && fastTower.get()) { - mc.player.setVelocity(0, -0.28f, 0); + if (counter >= blocksPerTick.get()) { + break; + } + } } } + // Move player down so they are on top of the placed block ready to jump again + if (place(bp) && fastTower.get() && mc.options.jumpKey.isPressed() && !mc.options.sneakKey.isPressed() && !mc.player.isOnGround() && !mc.world.getBlockState(bp).isAir()) { + mc.player.setVelocity(0, -0.28f, 0); + } + if (!mc.world.getBlockState(bp).isAir()) { prevBp.set(bp); } @@ -249,6 +286,21 @@ private boolean validItem(ItemStack itemStack, BlockPos pos) { return !(block instanceof FallingBlock) || !FallingBlock.canFallThrough(mc.world.getBlockState(pos)); } + private boolean place(BlockPos bp) { + FindItemResult item = InvUtils.findInHotbar(itemStack -> validItem(itemStack, bp)); + if (!item.found()) return false; + + if (item.getHand() == null && !autoSwitch.get()) return false; + + if (BlockUtils.place(bp, item, rotate.get(), 50, renderSwing.get(), true)) { + // Render block if was placed + if (render.get()) + RenderUtils.renderTickingBlock(bp.toImmutable(), sideColor.get(), lineColor.get(), shapeMode.get(), 0, 8, true, false); + return true; + } + return false; + } + public enum ListMode { Whitelist, Blacklist diff --git a/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java index cdcf597a2b..da8aed1727 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java @@ -7,7 +7,6 @@ import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.events.world.TickEvent; -import meteordevelopment.meteorclient.mixininterface.IVec3d; import meteordevelopment.meteorclient.utils.PreInit; import meteordevelopment.meteorclient.utils.player.FindItemResult; import meteordevelopment.meteorclient.utils.player.InvUtils; @@ -37,8 +36,6 @@ import static meteordevelopment.meteorclient.MeteorClient.mc; public class BlockUtils { - private static final Vec3d hitPos = new Vec3d(0, 0, 0); - public static boolean breaking; private static boolean breakingThisTick; @@ -82,7 +79,7 @@ public static boolean place(BlockPos blockPos, Hand hand, int slot, boolean rota if (slot < 0 || slot > 8) return false; if (!canPlace(blockPos, checkEntities)) return false; - ((IVec3d) hitPos).set(blockPos.getX() + 0.5, blockPos.getY() + 0.5, blockPos.getZ() + 0.5); + Vec3d hitPos = Vec3d.ofCenter(blockPos); BlockPos neighbour; Direction side = getPlaceSide(blockPos); @@ -97,18 +94,20 @@ public static boolean place(BlockPos blockPos, Hand hand, int slot, boolean rota Direction s = side; + BlockHitResult bhr = new BlockHitResult(hitPos, s, neighbour, false); + if (rotate) { Rotations.rotate(Rotations.getYaw(hitPos), Rotations.getPitch(hitPos), rotationPriority, () -> { InvUtils.swap(slot, swapBack); - place(new BlockHitResult(hitPos, s, neighbour, false), hand, swingHand); + interact(bhr, hand, swingHand); if (swapBack) InvUtils.swapBack(); }); } else { InvUtils.swap(slot, swapBack); - place(new BlockHitResult(hitPos, s, neighbour, false), hand, swingHand); + interact(bhr, hand, swingHand); if (swapBack) InvUtils.swapBack(); } @@ -117,7 +116,7 @@ public static boolean place(BlockPos blockPos, Hand hand, int slot, boolean rota return true; } - private static void place(BlockHitResult blockHitResult, Hand hand, boolean swing) { + public static void interact(BlockHitResult blockHitResult, Hand hand, boolean swing) { boolean wasSneaking = mc.player.input.sneaking; mc.player.input.sneaking = false; From 94f9cb3b30d19368f4867ac08ccbb80952f72170 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Thu, 2 Feb 2023 15:05:45 +0800 Subject: [PATCH 073/135] update --- .../systems/modules/movement/Scaffold.java | 60 +++++++++++-------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java index ddf18d376b..47b8385476 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java @@ -98,7 +98,7 @@ public class Scaffold extends Module { private final Setting placeRange = sgGeneral.add(new DoubleSetting.Builder() .name("closest-block-range") - .description("How far can scaffold place blocks.") + .description("How far can scaffold place blocks when you are in air.") .defaultValue(4) .min(0) .sliderMax(8) @@ -106,13 +106,13 @@ public class Scaffold extends Module { .build() ); - private final Setting range = sgGeneral.add(new DoubleSetting.Builder() - .name("range") - .description("Scaffold radius.") - .defaultValue(3) + private final Setting radius = sgGeneral.add(new DoubleSetting.Builder() + .name("radius") + .description("Scaffold radius. 0 means one block.") + .defaultValue(0) .min(0) .max(6) - .visible(() -> !airPlace.get()) + .visible(() -> airPlace.get()) .build() ); @@ -121,7 +121,7 @@ public class Scaffold extends Module { .description("How many blocks to place in one tick.") .defaultValue(3) .min(1) - .visible(() -> !airPlace.get()) + .visible(() -> airPlace.get()) .build() ); @@ -234,15 +234,12 @@ private void onTick(TickEvent.Pre event) { } if (!lastWasSneaking) lastSneakingY = mc.player.getY(); - if (mc.options.jumpKey.isPressed() && !mc.options.sneakKey.isPressed() && fastTower.get()) { - Vec3d vel = mc.player.getVelocity(); - mc.player.setVelocity(cancelVelocity.get() ? 0 : vel.x, 0.42, cancelVelocity.get() ? 0 : vel.z); - } + fastTower(false, null); - if (!airPlace.get()) { + if (airPlace.get()) { List blocks = new ArrayList<>(); - for (double x = mc.player.getX() - range.get(); x <= mc.player.getX() + range.get(); x = x + 0.5) { - for (double z = mc.player.getZ() - range.get(); z <= mc.player.getZ() + range.get(); z = z + 0.5) { + for (double x = mc.player.getX() - radius.get(); x <= mc.player.getX() + radius.get(); x = x + 0.5) { + for (double z = mc.player.getZ() - radius.get(); z <= mc.player.getZ() + radius.get(); z = z + 0.5) { blocks.add(new BlockPos(x, mc.player.getY() - 0.5, z)); } } @@ -251,22 +248,21 @@ private void onTick(TickEvent.Pre event) { blocks.sort(Comparator.comparingDouble(PlayerUtils::squaredDistanceTo)); int counter = 0; for (BlockPos block : blocks) { - if (place(block)) counter++; + if (place(block)) { + fastTower(true, block); + counter++; + } if (counter >= blocksPerTick.get()) { break; } } } - } - - // Move player down so they are on top of the placed block ready to jump again - if (place(bp) && fastTower.get() && mc.options.jumpKey.isPressed() && !mc.options.sneakKey.isPressed() && !mc.player.isOnGround() && !mc.world.getBlockState(bp).isAir()) { - mc.player.setVelocity(0, -0.28f, 0); - } - - if (!mc.world.getBlockState(bp).isAir()) { - prevBp.set(bp); + } else { + if (place(bp)) fastTower(true, bp); + if (!mc.world.getBlockState(bp).isAir()) { + prevBp.set(bp); + } } } @@ -301,6 +297,22 @@ private boolean place(BlockPos bp) { return false; } + private void fastTower(boolean down, BlockPos checkBlock) { + if (down) { + // Move player down so they are on top of the placed block ready to jump again + if (fastTower.get() && mc.options.jumpKey.isPressed() && !mc.options.sneakKey.isPressed() && !mc.player.isOnGround()) { + // The chunk hasn't updated yet so we check the block we were standing on + if (!mc.world.getBlockState(checkBlock.down()).isReplaceable()) + mc.player.setVelocity(0, -0.28f, 0); + } + } else { + if (mc.options.jumpKey.isPressed() && !mc.options.sneakKey.isPressed() && fastTower.get()) { + Vec3d vel = mc.player.getVelocity(); + mc.player.setVelocity(cancelVelocity.get() ? 0 : vel.x, 0.42, cancelVelocity.get() ? 0 : vel.z); + } + } + } + public enum ListMode { Whitelist, Blacklist From 78e363c510f4321414e7d3056ed4cdfd4ed4a367 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Thu, 2 Feb 2023 15:18:49 +0800 Subject: [PATCH 074/135] fix weird square --- .../meteorclient/systems/modules/movement/Scaffold.java | 8 ++++---- .../meteorclient/utils/world/BlockUtils.java | 4 +--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java index 47b8385476..7e489f6847 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java @@ -91,7 +91,7 @@ public class Scaffold extends Module { private final Setting airPlace = sgGeneral.add(new BoolSetting.Builder() .name("air-place") - .description("Allow air place.") + .description("Allow air place. This also allows you to modify scaffold radius.") .defaultValue(false) .build() ); @@ -108,7 +108,7 @@ public class Scaffold extends Module { private final Setting radius = sgGeneral.add(new DoubleSetting.Builder() .name("radius") - .description("Scaffold radius. 0 means one block.") + .description("Scaffold radius.") .defaultValue(0) .min(0) .max(6) @@ -238,8 +238,8 @@ private void onTick(TickEvent.Pre event) { if (airPlace.get()) { List blocks = new ArrayList<>(); - for (double x = mc.player.getX() - radius.get(); x <= mc.player.getX() + radius.get(); x = x + 0.5) { - for (double z = mc.player.getZ() - radius.get(); z <= mc.player.getZ() + radius.get(); z = z + 0.5) { + for (int x = (int) (mc.player.getX() - radius.get()); x < mc.player.getX() + radius.get(); x++) { + for (int z = (int) (mc.player.getZ() - radius.get()); z < mc.player.getZ() + radius.get(); z++) { blocks.add(new BlockPos(x, mc.player.getY() - 0.5, z)); } } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java index da8aed1727..e17be780c7 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java @@ -92,9 +92,7 @@ public static boolean place(BlockPos blockPos, Hand hand, int slot, boolean rota hitPos.add(side.getOffsetX() * 0.5, side.getOffsetY() * 0.5, side.getOffsetZ() * 0.5); } - Direction s = side; - - BlockHitResult bhr = new BlockHitResult(hitPos, s, neighbour, false); + BlockHitResult bhr = new BlockHitResult(hitPos, side, neighbour, false); if (rotate) { Rotations.rotate(Rotations.getYaw(hitPos), Rotations.getPitch(hitPos), rotationPriority, () -> { From 165e284ef5ef4bfa0e72f12f85e3bafdee182e5b Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Wed, 1 Feb 2023 22:49:13 +0800 Subject: [PATCH 075/135] Fast climb timer closes #1875 --- .../mixin/LivingEntityAccessor.java | 3 + .../systems/modules/movement/FastClimb.java | 65 ++++++++++++++++--- .../systems/modules/movement/NoSlow.java | 2 +- 3 files changed, 60 insertions(+), 10 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityAccessor.java b/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityAccessor.java index 6cf8ec0f8b..c7d4630c92 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityAccessor.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityAccessor.java @@ -17,6 +17,9 @@ public interface LivingEntityAccessor { @Invoker("swimUpward") void swimUpwards(TagKey fluid); + @Accessor("jumping") + boolean isJumping(); + @Accessor("jumpingCooldown") int getJumpCooldown(); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/FastClimb.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/FastClimb.java index 462616da41..e1ad6ba08c 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/FastClimb.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/FastClimb.java @@ -6,35 +6,82 @@ package meteordevelopment.meteorclient.systems.modules.movement; import meteordevelopment.meteorclient.events.world.TickEvent; +import meteordevelopment.meteorclient.mixin.LivingEntityAccessor; +import meteordevelopment.meteorclient.settings.BoolSetting; import meteordevelopment.meteorclient.settings.DoubleSetting; import meteordevelopment.meteorclient.settings.Setting; import meteordevelopment.meteorclient.settings.SettingGroup; import meteordevelopment.meteorclient.systems.modules.Categories; import meteordevelopment.meteorclient.systems.modules.Module; +import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.world.Timer; import meteordevelopment.orbit.EventHandler; +import net.minecraft.block.Blocks; +import net.minecraft.block.PowderSnowBlock; import net.minecraft.util.math.Vec3d; public class FastClimb extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); + private final Setting timerMode = sgGeneral.add(new BoolSetting.Builder() + .name("timer-mode") + .description("Use timer.") + .defaultValue(false) + .build() + ); + private final Setting speed = sgGeneral.add(new DoubleSetting.Builder() - .name("climb-speed") - .description("Your climb speed.") - .defaultValue(0.2872) - .min(0.0) - .build() + .name("climb-speed") + .description("Your climb speed.") + .defaultValue(0.2872) + .min(0.0) + .visible(() -> !timerMode.get()) + .build() + ); + + private final Setting timer = sgGeneral.add(new DoubleSetting.Builder() + .name("timer") + .description("The timer value for Timer.") + .defaultValue(10) + .min(1) + .sliderMin(1) + .visible(timerMode::get) + .build() ); + private boolean resetTimer; + public FastClimb() { super(Categories.Movement, "fast-climb", "Allows you to climb faster."); } + @Override + public void onActivate() { + resetTimer = false; + } + + @EventHandler + private void onPreTick(TickEvent.Pre event) { + if (timerMode.get()) { + if (climbing()) { + resetTimer = false; + Modules.get().get(Timer.class).setOverride(timer.get()); + } else if (!resetTimer) { + Modules.get().get(Timer.class).setOverride(Timer.OFF); + resetTimer = true; + } + } + } + @EventHandler private void onTick(TickEvent.Post event) { - if (!mc.player.isClimbing() || !mc.player.horizontalCollision) return; - if (mc.player.input.movementForward == 0 && mc.player.input.movementSideways == 0) return; + if (climbing()) { + Vec3d velocity = mc.player.getVelocity(); + mc.player.setVelocity(velocity.x, speed.get(), velocity.z); + } + } - Vec3d velocity = mc.player.getVelocity(); - mc.player.setVelocity(velocity.x, speed.get(), velocity.z); + private boolean climbing() { + return (mc.player.horizontalCollision || ((LivingEntityAccessor) mc.player).isJumping()) && (mc.player.isClimbing() || mc.player.getBlockStateAtPos().isOf(Blocks.POWDER_SNOW) && PowderSnowBlock.canWalkOnPowderSnow(mc.player)); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/NoSlow.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/NoSlow.java index 979d9e88fe..20dac9a481 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/NoSlow.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/NoSlow.java @@ -31,7 +31,7 @@ public class NoSlow extends Module { .build() ); - private final Setting webTimer = sgGeneral.add(new IntSetting.Builder() + private final Setting webTimer = sgGeneral.add(new DoubleSetting.Builder() .name("web-timer") .description("The timer value for WebMode Timer.") .defaultValue(10) From 14a49978cdb012d55e24614206459666713610c1 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Wed, 1 Feb 2023 22:51:19 +0800 Subject: [PATCH 076/135] way too fast --- .../meteorclient/systems/modules/movement/FastClimb.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/FastClimb.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/FastClimb.java index e1ad6ba08c..ca1886690b 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/FastClimb.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/FastClimb.java @@ -42,7 +42,7 @@ public class FastClimb extends Module { private final Setting timer = sgGeneral.add(new DoubleSetting.Builder() .name("timer") .description("The timer value for Timer.") - .defaultValue(10) + .defaultValue(1.436) .min(1) .sliderMin(1) .visible(timerMode::get) From 93584536e1289570f6712e485656a23df996e394 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Wed, 1 Feb 2023 22:54:27 +0800 Subject: [PATCH 077/135] forgot that check --- .../meteorclient/systems/modules/movement/FastClimb.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/FastClimb.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/FastClimb.java index ca1886690b..ed86438a8a 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/FastClimb.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/FastClimb.java @@ -75,7 +75,7 @@ private void onPreTick(TickEvent.Pre event) { @EventHandler private void onTick(TickEvent.Post event) { - if (climbing()) { + if (!timerMode.get() && climbing()) { Vec3d velocity = mc.player.getVelocity(); mc.player.setVelocity(velocity.x, speed.get(), velocity.z); } From e8d9fc5c8ba52eb1e96b726da4dc6e6d2d453a2a Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Wed, 1 Feb 2023 18:15:39 +0800 Subject: [PATCH 078/135] Pearl notifier, closes #692 --- .../systems/modules/misc/Notifier.java | 93 ++++++++++++++----- 1 file changed, 72 insertions(+), 21 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notifier.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notifier.java index 6e5a78e3a3..8a18a6ec93 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notifier.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notifier.java @@ -23,11 +23,15 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.projectile.thrown.EnderPearlEntity; import net.minecraft.network.packet.s2c.play.EntityStatusS2CPacket; import net.minecraft.text.MutableText; import net.minecraft.text.Text; import net.minecraft.util.Formatting; +import net.minecraft.util.math.Vec3d; +import java.util.HashMap; +import java.util.Map; import java.util.Random; import java.util.UUID; @@ -36,6 +40,7 @@ public class Notifier extends Module { private final SettingGroup sgTotemPops = settings.createGroup("Totem Pops"); private final SettingGroup sgVisualRange = settings.createGroup("Visual Range"); + private final SettingGroup sgPearl = settings.createGroup("Pearl"); // Totem Pops @@ -104,8 +109,32 @@ public class Notifier extends Module { .build() ); + // Pearl + + private final Setting pearl = sgPearl.add(new BoolSetting.Builder() + .name("pearl") + .description("Notifies you when a player is teleported using an ender pearl.") + .defaultValue(true) + .build() + ); + + private final Setting pearlIgnoreOwn = sgPearl.add(new BoolSetting.Builder() + .name("ignore-own") + .description("Ignores your own pearls.") + .defaultValue(false) + .build() + ); + + private final Setting pearlIgnoreFriends = sgPearl.add(new BoolSetting.Builder() + .name("ignore-friends") + .description("Ignores friends pearls.") + .defaultValue(false) + .build() + ); + private final Object2IntMap totemPopMap = new Object2IntOpenHashMap<>(); private final Object2IntMap chatIdMap = new Object2IntOpenHashMap<>(); + private final Map pearlStartPosMap = new HashMap<>(); private final Random random = new Random(); @@ -117,36 +146,56 @@ public Notifier() { @EventHandler private void onEntityAdded(EntityAddedEvent event) { - if (event.entity.getUuid().equals(mc.player.getUuid()) || !entities.get().getBoolean(event.entity.getType()) || !visualRange.get() || this.event.get() == Event.Despawn) return; - - if (event.entity instanceof PlayerEntity) { - if ((!visualRangeIgnoreFriends.get() || !Friends.get().isFriend(((PlayerEntity) event.entity))) && (!visualRangeIgnoreFakes.get() || !(event.entity instanceof FakePlayerEntity))) { - ChatUtils.sendMsg(event.entity.getId() + 100, Formatting.GRAY, "(highlight)%s(default) has entered your visual range!", event.entity.getEntityName()); + if (!event.entity.getUuid().equals(mc.player.getUuid()) && entities.get().getBoolean(event.entity.getType()) && visualRange.get() && this.event.get() != Event.Despawn) { + if (event.entity instanceof PlayerEntity) { + if ((!visualRangeIgnoreFriends.get() || !Friends.get().isFriend(((PlayerEntity) event.entity))) && (!visualRangeIgnoreFakes.get() || !(event.entity instanceof FakePlayerEntity))) { + ChatUtils.sendMsg(event.entity.getId() + 100, Formatting.GRAY, "(highlight)%s(default) has entered your visual range!", event.entity.getEntityName()); + } + } else { + MutableText text = Text.literal(event.entity.getType().getName().getString()).formatted(Formatting.WHITE); + text.append(Text.literal(" has spawned at ").formatted(Formatting.GRAY)); + text.append(formatCoords(event.entity.getPos())); + text.append(Text.literal(".").formatted(Formatting.GRAY)); + info(text); } } - else { - MutableText text = Text.literal(event.entity.getType().getName().getString()).formatted(Formatting.WHITE); - text.append(Text.literal(" has spawned at ").formatted(Formatting.GRAY)); - text.append(formatCoords(event.entity.getPos())); - text.append(Text.literal(".").formatted(Formatting.GRAY)); - info(text); + + if (pearl.get()) { + if (event.entity instanceof EnderPearlEntity pearl) { + pearlStartPosMap.put(pearl.getId(), new Vec3d(pearl.getX(), pearl.getY(), pearl.getZ())); + } } } @EventHandler private void onEntityRemoved(EntityRemovedEvent event) { - if (event.entity.getUuid().equals(mc.player.getUuid()) || !entities.get().getBoolean(event.entity.getType()) || !visualRange.get() || this.event.get() == Event.Spawn) return; + if (!event.entity.getUuid().equals(mc.player.getUuid()) && entities.get().getBoolean(event.entity.getType()) && visualRange.get() && this.event.get() != Event.Spawn) { + if (event.entity instanceof PlayerEntity) { + if ((!visualRangeIgnoreFriends.get() || !Friends.get().isFriend(((PlayerEntity) event.entity))) && (!visualRangeIgnoreFakes.get() || !(event.entity instanceof FakePlayerEntity))) { + ChatUtils.sendMsg(event.entity.getId() + 100, Formatting.GRAY, "(highlight)%s(default) has left your visual range!", event.entity.getEntityName()); + } + } else { + MutableText text = Text.literal(event.entity.getType().getName().getString()).formatted(Formatting.WHITE); + text.append(Text.literal(" has despawned at ").formatted(Formatting.GRAY)); + text.append(formatCoords(event.entity.getPos())); + text.append(Text.literal(".").formatted(Formatting.GRAY)); + info(text); + } + } - if (event.entity instanceof PlayerEntity) { - if ((!visualRangeIgnoreFriends.get() || !Friends.get().isFriend(((PlayerEntity) event.entity))) && (!visualRangeIgnoreFakes.get() || !(event.entity instanceof FakePlayerEntity))) { - ChatUtils.sendMsg(event.entity.getId() + 100, Formatting.GRAY, "(highlight)%s(default) has left your visual range!", event.entity.getEntityName()); + if (pearl.get()) { + Entity e = event.entity; + int i = e.getId(); + if (pearlStartPosMap.containsKey(i)) { + EnderPearlEntity pearl = (EnderPearlEntity) e; + if (pearl.getOwner() != null && pearl.getOwner() instanceof PlayerEntity p) { + double d = pearlStartPosMap.get(i).distanceTo(e.getPos()); + if ((!Friends.get().isFriend(p) || !pearlIgnoreFriends.get()) && (!p.equals(mc.player) || !pearlIgnoreOwn.get())) { + info("(highlight)%s's(default) pearl landed at %d, %d, %d (highlight)(%.1fm away, travelled %.1fm)(default).", pearl.getOwner().getEntityName(), pearl.getBlockPos().getX(), pearl.getBlockPos().getY(), pearl.getBlockPos().getZ(), pearl.distanceTo(mc.player), d); + } + } + pearlStartPosMap.remove(i); } - } else { - MutableText text = Text.literal(event.entity.getType().getName().getString()).formatted(Formatting.WHITE); - text.append(Text.literal(" has despawned at ").formatted(Formatting.GRAY)); - text.append(formatCoords(event.entity.getPos())); - text.append(Text.literal(".").formatted(Formatting.GRAY)); - info(text); } } @@ -156,12 +205,14 @@ private void onEntityRemoved(EntityRemovedEvent event) { public void onActivate() { totemPopMap.clear(); chatIdMap.clear(); + pearlStartPosMap.clear(); } @EventHandler private void onGameJoin(GameJoinedEvent event) { totemPopMap.clear(); chatIdMap.clear(); + pearlStartPosMap.clear(); } @EventHandler From c1b781c0b0f00a70200667bdb715298be03b6c94 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Fri, 3 Feb 2023 01:03:45 +0800 Subject: [PATCH 079/135] AntiLevitation -> AntiPotion --- .../meteorclient/mixin/LivingEntityMixin.java | 29 +++++++---- .../meteorclient/systems/modules/Modules.java | 2 +- .../modules/movement/AntiLevitation.java | 31 ------------ .../systems/modules/player/AntiPotion.java | 49 +++++++++++++++++++ 4 files changed, 69 insertions(+), 42 deletions(-) delete mode 100644 src/main/java/meteordevelopment/meteorclient/systems/modules/movement/AntiLevitation.java create mode 100644 src/main/java/meteordevelopment/meteorclient/systems/modules/player/AntiPotion.java diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityMixin.java index 38d975bbb9..fbc70857e0 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityMixin.java @@ -9,8 +9,8 @@ import meteordevelopment.meteorclient.events.entity.DamageEvent; import meteordevelopment.meteorclient.events.entity.player.CanWalkOnFluidEvent; import meteordevelopment.meteorclient.systems.modules.Modules; -import meteordevelopment.meteorclient.systems.modules.movement.AntiLevitation; import meteordevelopment.meteorclient.systems.modules.movement.elytrafly.ElytraFly; +import meteordevelopment.meteorclient.systems.modules.player.AntiPotion; import meteordevelopment.meteorclient.systems.modules.player.OffhandCrash; import meteordevelopment.meteorclient.systems.modules.render.HandView; import meteordevelopment.meteorclient.systems.modules.render.NoRender; @@ -21,27 +21,37 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.effect.StatusEffect; +import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; import net.minecraft.fluid.FluidState; import net.minecraft.item.ItemStack; import net.minecraft.util.Hand; import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import java.util.Map; + import static meteordevelopment.meteorclient.MeteorClient.mc; @Mixin(LivingEntity.class) public abstract class LivingEntityMixin extends Entity { + @Shadow + @Final + private Map activeStatusEffects; + public LivingEntityMixin(EntityType type, World world) { super(type, world); } @Inject(method = "damage", at = @At("HEAD")) private void onDamageHead(DamageSource source, float amount, CallbackInfoReturnable info) { - if (Utils.canUpdate() && world.isClient) MeteorClient.EVENT_BUS.post(DamageEvent.get((LivingEntity) (Object) this, source)); + if (Utils.canUpdate() && world.isClient) + MeteorClient.EVENT_BUS.post(DamageEvent.get((LivingEntity) (Object) this, source)); } @Inject(method = "canWalkOnFluid", at = @At("HEAD"), cancellable = true) @@ -52,16 +62,10 @@ private void onCanWalkOnFluid(FluidState fluidState, CallbackInfoReturnable info) { info.setReturnValue(true); } } + + @Inject(method = "hasStatusEffect", at = @At("HEAD"), cancellable = true) + private void hasStatusEffect(StatusEffect effect, CallbackInfoReturnable info) { + if (Modules.get().get(AntiPotion.class).shouldBlock(effect)) info.setReturnValue(false); + } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java index b30d354da0..6fe5a71fe5 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java @@ -414,6 +414,7 @@ private void initCombat() { private void initPlayer() { add(new AntiHunger()); + add(new AntiPotion()); add(new AutoEat()); add(new AutoFish()); add(new AutoGap()); @@ -445,7 +446,6 @@ private void initMovement() { add(new AirJump()); add(new Anchor()); add(new AntiAFK()); - add(new AntiLevitation()); add(new AntiVoid()); add(new AutoJump()); add(new AutoWalk()); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/AntiLevitation.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/AntiLevitation.java deleted file mode 100644 index c27339daeb..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/AntiLevitation.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.systems.modules.movement; - -import meteordevelopment.meteorclient.settings.BoolSetting; -import meteordevelopment.meteorclient.settings.Setting; -import meteordevelopment.meteorclient.settings.SettingGroup; -import meteordevelopment.meteorclient.systems.modules.Categories; -import meteordevelopment.meteorclient.systems.modules.Module; - -public class AntiLevitation extends Module { - private final SettingGroup sgGeneral = settings.getDefaultGroup(); - - private final Setting applyGravity = sgGeneral.add(new BoolSetting.Builder() - .name("gravity") - .description("Applies gravity.") - .defaultValue(false) - .build() - ); - - public AntiLevitation() { - super(Categories.Movement, "anti-levitation", "Prevents the levitation effect from working."); - } - - public boolean isApplyGravity() { - return applyGravity.get(); - } -} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AntiPotion.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AntiPotion.java new file mode 100644 index 0000000000..9a5e64fe6e --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AntiPotion.java @@ -0,0 +1,49 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.systems.modules.player; + +import meteordevelopment.meteorclient.settings.BoolSetting; +import meteordevelopment.meteorclient.settings.Setting; +import meteordevelopment.meteorclient.settings.SettingGroup; +import meteordevelopment.meteorclient.settings.StatusEffectListSetting; +import meteordevelopment.meteorclient.systems.modules.Categories; +import meteordevelopment.meteorclient.systems.modules.Module; +import net.minecraft.entity.effect.StatusEffect; + +import java.util.List; + +import static net.minecraft.entity.effect.StatusEffects.*; + +public class AntiPotion extends Module { + private final SettingGroup sgGeneral = settings.getDefaultGroup(); + + private final Setting> effects = sgGeneral.add(new StatusEffectListSetting.Builder() + .name("effects") + .description("The effects to block.") + .defaultValue( + LEVITATION, + JUMP_BOOST, + SLOW_FALLING, + DOLPHINS_GRACE + ) + .build() + ); + + public final Setting applyGravity = sgGeneral.add(new BoolSetting.Builder() + .name("gravity") + .description("Applies gravity when levitating.") + .defaultValue(false) + .build() + ); + + public AntiPotion() { + super(Categories.Player, "anti-potion", "Block some potion effects, but won't work for some effects like speed."); + } + + public boolean shouldBlock(StatusEffect effect) { + return isActive() && effects.get().contains(effect); + } +} From 930f08322a0b6c9572e5045c280c5a16c81a7ac0 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Sat, 4 Feb 2023 00:10:43 +0800 Subject: [PATCH 080/135] Merge AntiPotion and PotionSpoof --- .../meteorclient/mixin/LivingEntityMixin.java | 8 +-- .../meteorclient/systems/modules/Modules.java | 3 +- .../systems/modules/player/AntiPotion.java | 49 ---------------- .../player/{PotionSpoof.java => Potions.java} | 56 +++++++++++++------ 4 files changed, 45 insertions(+), 71 deletions(-) delete mode 100644 src/main/java/meteordevelopment/meteorclient/systems/modules/player/AntiPotion.java rename src/main/java/meteordevelopment/meteorclient/systems/modules/player/{PotionSpoof.java => Potions.java} (54%) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityMixin.java index fbc70857e0..6b65fff148 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityMixin.java @@ -10,8 +10,8 @@ import meteordevelopment.meteorclient.events.entity.player.CanWalkOnFluidEvent; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.movement.elytrafly.ElytraFly; -import meteordevelopment.meteorclient.systems.modules.player.AntiPotion; import meteordevelopment.meteorclient.systems.modules.player.OffhandCrash; +import meteordevelopment.meteorclient.systems.modules.player.Potions; import meteordevelopment.meteorclient.systems.modules.render.HandView; import meteordevelopment.meteorclient.systems.modules.render.NoRender; import meteordevelopment.meteorclient.utils.Utils; @@ -64,8 +64,8 @@ private void onCanWalkOnFluid(FluidState fluidState, CallbackInfoReturnable info) { @Inject(method = "hasStatusEffect", at = @At("HEAD"), cancellable = true) private void hasStatusEffect(StatusEffect effect, CallbackInfoReturnable info) { - if (Modules.get().get(AntiPotion.class).shouldBlock(effect)) info.setReturnValue(false); + if (Modules.get().get(Potions.class).shouldBlock(effect)) info.setReturnValue(false); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java index 6fe5a71fe5..85bd22672e 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java @@ -414,7 +414,6 @@ private void initCombat() { private void initPlayer() { add(new AntiHunger()); - add(new AntiPotion()); add(new AutoEat()); add(new AutoFish()); add(new AutoGap()); @@ -436,7 +435,7 @@ private void initPlayer() { add(new PacketMine()); add(new Portals()); add(new PotionSaver()); - add(new PotionSpoof()); + add(new Potions()); add(new Reach()); add(new Rotation()); add(new SpeedMine()); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AntiPotion.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AntiPotion.java deleted file mode 100644 index 9a5e64fe6e..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AntiPotion.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.systems.modules.player; - -import meteordevelopment.meteorclient.settings.BoolSetting; -import meteordevelopment.meteorclient.settings.Setting; -import meteordevelopment.meteorclient.settings.SettingGroup; -import meteordevelopment.meteorclient.settings.StatusEffectListSetting; -import meteordevelopment.meteorclient.systems.modules.Categories; -import meteordevelopment.meteorclient.systems.modules.Module; -import net.minecraft.entity.effect.StatusEffect; - -import java.util.List; - -import static net.minecraft.entity.effect.StatusEffects.*; - -public class AntiPotion extends Module { - private final SettingGroup sgGeneral = settings.getDefaultGroup(); - - private final Setting> effects = sgGeneral.add(new StatusEffectListSetting.Builder() - .name("effects") - .description("The effects to block.") - .defaultValue( - LEVITATION, - JUMP_BOOST, - SLOW_FALLING, - DOLPHINS_GRACE - ) - .build() - ); - - public final Setting applyGravity = sgGeneral.add(new BoolSetting.Builder() - .name("gravity") - .description("Applies gravity when levitating.") - .defaultValue(false) - .build() - ); - - public AntiPotion() { - super(Categories.Player, "anti-potion", "Block some potion effects, but won't work for some effects like speed."); - } - - public boolean shouldBlock(StatusEffect effect) { - return isActive() && effects.get().contains(effect); - } -} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/PotionSpoof.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/Potions.java similarity index 54% rename from src/main/java/meteordevelopment/meteorclient/systems/modules/player/PotionSpoof.java rename to src/main/java/meteordevelopment/meteorclient/systems/modules/player/Potions.java index 8cb896553a..a7c3ac02e2 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/PotionSpoof.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/Potions.java @@ -8,10 +8,7 @@ import it.unimi.dsi.fastutil.objects.Object2IntMap; import meteordevelopment.meteorclient.events.world.TickEvent; import meteordevelopment.meteorclient.mixin.StatusEffectInstanceAccessor; -import meteordevelopment.meteorclient.settings.BoolSetting; -import meteordevelopment.meteorclient.settings.Setting; -import meteordevelopment.meteorclient.settings.SettingGroup; -import meteordevelopment.meteorclient.settings.StatusEffectAmplifierMapSetting; +import meteordevelopment.meteorclient.settings.*; import meteordevelopment.meteorclient.systems.modules.Categories; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.utils.Utils; @@ -19,14 +16,18 @@ import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffectInstance; -public class PotionSpoof extends Module { +import java.util.List; + +import static net.minecraft.entity.effect.StatusEffects.*; + +public class Potions extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); - private final Setting> potions = sgGeneral.add(new StatusEffectAmplifierMapSetting.Builder() - .name("potions") - .description("Potions to add.") - .defaultValue(Utils.createStatusEffectMap()) - .build() + private final Setting> spoofPotions = sgGeneral.add(new StatusEffectAmplifierMapSetting.Builder() + .name("spoofed-potions") + .description("Potions to add.") + .defaultValue(Utils.createStatusEffectMap()) + .build() ); private final Setting clearEffects = sgGeneral.add(new BoolSetting.Builder() @@ -36,24 +37,43 @@ public class PotionSpoof extends Module { .build() ); - public PotionSpoof() { - super(Categories.Player, "potion-spoof", "Spoofs specified potion effects for you. SOME effects DO NOT work."); + private final Setting> antiPotion = sgGeneral.add(new StatusEffectListSetting.Builder() + .name("blocked-potions") + .description("Potions to block.") + .defaultValue( + LEVITATION, + JUMP_BOOST, + SLOW_FALLING, + DOLPHINS_GRACE + ) + .build() + ); + + public final Setting applyGravity = sgGeneral.add(new BoolSetting.Builder() + .name("gravity") + .description("Applies gravity when levitating.") + .defaultValue(false) + .build() + ); + + public Potions() { + super(Categories.Player, "potions", "Spoofs potion statuses for you. SOME effects DO NOT work."); } @Override public void onDeactivate() { if (!clearEffects.get() || !Utils.canUpdate()) return; - for (StatusEffect effect : potions.get().keySet()) { - if (potions.get().getInt(effect) <= 0) continue; + for (StatusEffect effect : spoofPotions.get().keySet()) { + if (spoofPotions.get().getInt(effect) <= 0) continue; if (mc.player.hasStatusEffect(effect)) mc.player.removeStatusEffect(effect); } } @EventHandler private void onTick(TickEvent.Post event) { - for (StatusEffect statusEffect : potions.get().keySet()) { - int level = potions.get().getInt(statusEffect); + for (StatusEffect statusEffect : spoofPotions.get().keySet()) { + int level = spoofPotions.get().getInt(statusEffect); if (level <= 0) continue; if (mc.player.hasStatusEffect(statusEffect)) { @@ -65,4 +85,8 @@ private void onTick(TickEvent.Post event) { } } } + + public boolean shouldBlock(StatusEffect effect) { + return isActive() && antiPotion.get().contains(effect); + } } From 1282199d7e867613eb08edfcdbc0505e326b00a5 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Sat, 4 Feb 2023 00:11:54 +0800 Subject: [PATCH 081/135] Revert name change --- .../meteorclient/mixin/LivingEntityMixin.java | 8 ++++---- .../meteorclient/systems/modules/Modules.java | 2 +- .../modules/player/{Potions.java => PotionSpoof.java} | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) rename src/main/java/meteordevelopment/meteorclient/systems/modules/player/{Potions.java => PotionSpoof.java} (94%) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityMixin.java index 6b65fff148..fc630f2b7e 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/LivingEntityMixin.java @@ -11,7 +11,7 @@ import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.movement.elytrafly.ElytraFly; import meteordevelopment.meteorclient.systems.modules.player.OffhandCrash; -import meteordevelopment.meteorclient.systems.modules.player.Potions; +import meteordevelopment.meteorclient.systems.modules.player.PotionSpoof; import meteordevelopment.meteorclient.systems.modules.render.HandView; import meteordevelopment.meteorclient.systems.modules.render.NoRender; import meteordevelopment.meteorclient.utils.Utils; @@ -64,8 +64,8 @@ private void onCanWalkOnFluid(FluidState fluidState, CallbackInfoReturnable info) { @Inject(method = "hasStatusEffect", at = @At("HEAD"), cancellable = true) private void hasStatusEffect(StatusEffect effect, CallbackInfoReturnable info) { - if (Modules.get().get(Potions.class).shouldBlock(effect)) info.setReturnValue(false); + if (Modules.get().get(PotionSpoof.class).shouldBlock(effect)) info.setReturnValue(false); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java index 85bd22672e..a70086c0e1 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/Modules.java @@ -435,7 +435,7 @@ private void initPlayer() { add(new PacketMine()); add(new Portals()); add(new PotionSaver()); - add(new Potions()); + add(new PotionSpoof()); add(new Reach()); add(new Rotation()); add(new SpeedMine()); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/Potions.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/PotionSpoof.java similarity index 94% rename from src/main/java/meteordevelopment/meteorclient/systems/modules/player/Potions.java rename to src/main/java/meteordevelopment/meteorclient/systems/modules/player/PotionSpoof.java index a7c3ac02e2..24af8ac2b4 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/Potions.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/PotionSpoof.java @@ -20,7 +20,7 @@ import static net.minecraft.entity.effect.StatusEffects.*; -public class Potions extends Module { +public class PotionSpoof extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); private final Setting> spoofPotions = sgGeneral.add(new StatusEffectAmplifierMapSetting.Builder() @@ -56,8 +56,8 @@ public class Potions extends Module { .build() ); - public Potions() { - super(Categories.Player, "potions", "Spoofs potion statuses for you. SOME effects DO NOT work."); + public PotionSpoof() { + super(Categories.Player, "potion-spoof", "Spoofs potion statuses for you. SOME effects DO NOT work."); } @Override From 58c4a0ab6d46f45be7b8e7f156a0bbb0f54d1d67 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Tue, 31 Jan 2023 12:23:15 +0800 Subject: [PATCH 082/135] Anti packet kick update --- .../mixin/ClientConnectionMixin.java | 12 +++++++++++ .../systems/modules/misc/AntiPacketKick.java | 20 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ClientConnectionMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ClientConnectionMixin.java index 9db3fbcc58..7f191e369f 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ClientConnectionMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ClientConnectionMixin.java @@ -5,11 +5,14 @@ package meteordevelopment.meteorclient.mixin; +import io.netty.channel.ChannelHandlerContext; import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.events.packets.PacketEvent; import meteordevelopment.meteorclient.events.world.ConnectToServerEvent; import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.misc.AntiPacketKick; import meteordevelopment.meteorclient.systems.modules.world.HighwayBuilder; +import meteordevelopment.meteorclient.utils.player.ChatUtils; import net.minecraft.network.ClientConnection; import net.minecraft.network.Packet; import net.minecraft.network.listener.PacketListener; @@ -22,6 +25,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import java.io.IOException; import java.net.InetSocketAddress; @Mixin(ClientConnection.class) @@ -55,4 +59,12 @@ private void onSendPacketHead(Packet packet, CallbackInfo info) { private void onSendPacketTail(Packet packet, CallbackInfo info) { MeteorClient.EVENT_BUS.post(PacketEvent.Sent.get(packet)); } + + @Inject(method = "exceptionCaught", at = @At("HEAD"), cancellable = true) + private void exceptionCaught(ChannelHandlerContext context, Throwable throwable, CallbackInfo ci) { + if (throwable instanceof IOException && Modules.get().get(AntiPacketKick.class).catchExceptions.get()) { + if (Modules.get().get(AntiPacketKick.class).logExceptions.get()) ChatUtils.warning("Caught exception: %s", throwable); + ci.cancel(); + } + } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/AntiPacketKick.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/AntiPacketKick.java index ebca15adfc..6e197717ed 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/AntiPacketKick.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/AntiPacketKick.java @@ -5,10 +5,30 @@ package meteordevelopment.meteorclient.systems.modules.misc; +import meteordevelopment.meteorclient.settings.BoolSetting; +import meteordevelopment.meteorclient.settings.Setting; +import meteordevelopment.meteorclient.settings.SettingGroup; import meteordevelopment.meteorclient.systems.modules.Categories; import meteordevelopment.meteorclient.systems.modules.Module; public class AntiPacketKick extends Module { + private final SettingGroup sgGeneral = settings.getDefaultGroup(); + + public final Setting catchExceptions = sgGeneral.add(new BoolSetting.Builder() + .name("catch-exceptions") + .description("Drops corrupted packets.") + .defaultValue(false) + .build() + ); + + public final Setting logExceptions = sgGeneral.add(new BoolSetting.Builder() + .name("log-exceptions") + .description("Logs caught exceptions.") + .defaultValue(false) + .visible(catchExceptions::get) + .build() + ); + public AntiPacketKick() { super(Categories.Misc, "anti-packet-kick", "Attempts to prevent you from being disconnected by large packets."); } From 10f48b989a841cd19904ad18e0379b546d4de585 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Wed, 1 Feb 2023 00:41:27 +0800 Subject: [PATCH 083/135] Anti packet kick update --- .../meteorclient/mixin/ClientConnectionMixin.java | 2 +- .../meteorclient/systems/modules/misc/AntiPacketKick.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ClientConnectionMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ClientConnectionMixin.java index 7f191e369f..57f6c85d06 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ClientConnectionMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ClientConnectionMixin.java @@ -62,7 +62,7 @@ private void onSendPacketTail(Packet packet, CallbackInfo info) { @Inject(method = "exceptionCaught", at = @At("HEAD"), cancellable = true) private void exceptionCaught(ChannelHandlerContext context, Throwable throwable, CallbackInfo ci) { - if (throwable instanceof IOException && Modules.get().get(AntiPacketKick.class).catchExceptions.get()) { + if (throwable instanceof IOException && Modules.get().get(AntiPacketKick.class).catchExceptions()) { if (Modules.get().get(AntiPacketKick.class).logExceptions.get()) ChatUtils.warning("Caught exception: %s", throwable); ci.cancel(); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/AntiPacketKick.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/AntiPacketKick.java index 6e197717ed..cf23ec9f5d 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/AntiPacketKick.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/AntiPacketKick.java @@ -32,4 +32,8 @@ public class AntiPacketKick extends Module { public AntiPacketKick() { super(Categories.Misc, "anti-packet-kick", "Attempts to prevent you from being disconnected by large packets."); } + + public boolean catchExceptions() { + return isActive() && catchExceptions.get(); + } } From e1f3e6da8dcc3644ba81612de9ffb147d41515c1 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Fri, 3 Feb 2023 13:56:39 +0800 Subject: [PATCH 084/135] Use module warnings --- .../meteorclient/mixin/ClientConnectionMixin.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ClientConnectionMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ClientConnectionMixin.java index 57f6c85d06..33cebf9864 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ClientConnectionMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ClientConnectionMixin.java @@ -6,15 +6,16 @@ package meteordevelopment.meteorclient.mixin; import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.timeout.TimeoutException; import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.events.packets.PacketEvent; import meteordevelopment.meteorclient.events.world.ConnectToServerEvent; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.misc.AntiPacketKick; import meteordevelopment.meteorclient.systems.modules.world.HighwayBuilder; -import meteordevelopment.meteorclient.utils.player.ChatUtils; import net.minecraft.network.ClientConnection; import net.minecraft.network.Packet; +import net.minecraft.network.PacketEncoderException; import net.minecraft.network.listener.PacketListener; import net.minecraft.text.MutableText; import net.minecraft.text.Text; @@ -25,7 +26,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.io.IOException; import java.net.InetSocketAddress; @Mixin(ClientConnection.class) @@ -62,8 +62,9 @@ private void onSendPacketTail(Packet packet, CallbackInfo info) { @Inject(method = "exceptionCaught", at = @At("HEAD"), cancellable = true) private void exceptionCaught(ChannelHandlerContext context, Throwable throwable, CallbackInfo ci) { - if (throwable instanceof IOException && Modules.get().get(AntiPacketKick.class).catchExceptions()) { - if (Modules.get().get(AntiPacketKick.class).logExceptions.get()) ChatUtils.warning("Caught exception: %s", throwable); + AntiPacketKick apk = Modules.get().get(AntiPacketKick.class); + if (!(throwable instanceof TimeoutException) && !(throwable instanceof PacketEncoderException) && apk.catchExceptions()) { + if (apk.logExceptions.get()) apk.warning("Caught exception: %s", throwable); ci.cancel(); } } From 6a57f5394d93b6139081b3ed72f5d16178d19aa3 Mon Sep 17 00:00:00 2001 From: DesiCow Date: Sun, 29 Jan 2023 20:43:40 +0530 Subject: [PATCH 085/135] AutoEat utilise offhand --- .../meteorclient/systems/modules/player/AutoEat.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoEat.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoEat.java index d48997ef43..57725b8cd8 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoEat.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoEat.java @@ -18,6 +18,7 @@ import meteordevelopment.meteorclient.systems.modules.combat.KillAura; import meteordevelopment.meteorclient.utils.Utils; import meteordevelopment.meteorclient.utils.player.InvUtils; +import meteordevelopment.meteorclient.utils.player.SlotUtils; import meteordevelopment.orbit.EventHandler; import meteordevelopment.orbit.EventPriority; import net.minecraft.item.Item; @@ -231,6 +232,9 @@ private int findSlot() { } } + Item offHandItem = mc.player.getOffHandStack().getItem(); + if (offHandItem.isFood() && !blacklist.get().contains(offHandItem) && offHandItem.getFoodComponent().getHunger() > bestHunger) slot = SlotUtils.OFFHAND; + return slot; } } From fbeb682f0f69b9f1262c4d813da297929d89cb38 Mon Sep 17 00:00:00 2001 From: Cloudburst <18114966+C10udburst@users.noreply.github.com> Date: Sat, 28 Jan 2023 13:04:45 +0100 Subject: [PATCH 086/135] Create issue-moderator.yml --- .github/workflows/issue-moderator.yml | 40 +++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/issue-moderator.yml diff --git a/.github/workflows/issue-moderator.yml b/.github/workflows/issue-moderator.yml new file mode 100644 index 0000000000..d7f60d4b3b --- /dev/null +++ b/.github/workflows/issue-moderator.yml @@ -0,0 +1,40 @@ +name: Issue automatic actions + +on: + issues: + types: [opened] + +permissions: + issues: write + +jobs: + issue-moderator: + runs-on: ubuntu-latest + steps: + - name: Similarity analysis + uses: actions-cool/issues-similarity-analysis@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + filter-threshold: 0.60 + title-excludes: '' + comment-title: | + ### Your issue looks similar to these issues: + Please close if duplicate. + comment-body: '${index}. ${similarity} #${number}' + - uses: actions/checkout@v2 + - name: Automatically close issues that dont follow the issue template + uses: lucasbento/auto-close-issues@v1.0.2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + issue-close-message: | + @${issue.user.login}: hello! :wave: + This issue is being automatically closed because it does not follow the issue template." + closed-issues-label: "invalid" + - name: Add eyes reaction to all issues + uses: actions-cool/emoji-helper@v1.0.0 + with: + type: 'issue' + token: ${{ secrets.GITHUB_TOKEN }} + emoji: 'eyes' + + From 10084074789076fb5312517cea9e24729e608aef Mon Sep 17 00:00:00 2001 From: Cloudburst <18114966+C10udburst@users.noreply.github.com> Date: Sat, 28 Jan 2023 14:14:38 +0100 Subject: [PATCH 087/135] literally doesnt matter --- .github/workflows/issue-moderator.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/issue-moderator.yml b/.github/workflows/issue-moderator.yml index d7f60d4b3b..c4db81fed7 100644 --- a/.github/workflows/issue-moderator.yml +++ b/.github/workflows/issue-moderator.yml @@ -22,7 +22,7 @@ jobs: Please close if duplicate. comment-body: '${index}. ${similarity} #${number}' - uses: actions/checkout@v2 - - name: Automatically close issues that dont follow the issue template + - name: Automatically close issues that don't follow the issue template uses: lucasbento/auto-close-issues@v1.0.2 with: github-token: ${{ secrets.GITHUB_TOKEN }} From 94f90b6953217d078ac1adb7177b06f97b019abb Mon Sep 17 00:00:00 2001 From: Cloudburst <18114966+C10udburst@users.noreply.github.com> Date: Sat, 28 Jan 2023 16:32:24 +0100 Subject: [PATCH 088/135] =?UTF-8?q?remove=20=F0=9F=91=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/issue-moderator.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/issue-moderator.yml b/.github/workflows/issue-moderator.yml index c4db81fed7..dc686c7d2a 100644 --- a/.github/workflows/issue-moderator.yml +++ b/.github/workflows/issue-moderator.yml @@ -30,11 +30,4 @@ jobs: @${issue.user.login}: hello! :wave: This issue is being automatically closed because it does not follow the issue template." closed-issues-label: "invalid" - - name: Add eyes reaction to all issues - uses: actions-cool/emoji-helper@v1.0.0 - with: - type: 'issue' - token: ${{ secrets.GITHUB_TOKEN }} - emoji: 'eyes' - From fa7f2d1eb888d5331c8ec1a930a4a9d901beaad4 Mon Sep 17 00:00:00 2001 From: Lovecrafts-Cat Date: Fri, 27 Jan 2023 22:00:58 +0100 Subject: [PATCH 089/135] Bugfix: removed duplicate check in setTargets() Also made some readability changes. --- .../systems/modules/combat/HoleFiller.java | 75 ++++++++----------- 1 file changed, 30 insertions(+), 45 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/HoleFiller.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/HoleFiller.java index bfe8c081f6..562b3133c7 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/HoleFiller.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/HoleFiller.java @@ -227,7 +227,6 @@ public class HoleFiller extends Module { private final BlockPos.Mutable testPos = new BlockPos.Mutable(); private final Box box = new Box(0, 0, 0, 0, 0, 0); - private Vec3d testVec; private int timer; public HoleFiller() { @@ -283,18 +282,15 @@ else if (obsidian + bedrock == 8 && doubles.get() && air != null) { }); BlockIterator.after(() -> { - if (timer <= 0 && !holes.isEmpty()) { - int bpt = 0; + if (timer > 0 || holes.isEmpty()) return; - for (Hole hole : holes) { - if (bpt >= blocksPerTick.get()) continue; - if (BlockUtils.place(hole.blockPos, block, rotate.get(), 10, swing.get(), true)) { - bpt++; - } - } - - timer = placeDelay.get(); + int bpt = 0; + for (Hole hole : holes) { + if (bpt >= blocksPerTick.get()) continue; + if (BlockUtils.place(hole.blockPos, block, rotate.get(), 10, swing.get(), true)) bpt++; } + + timer = placeDelay.get(); }); timer--; @@ -331,43 +327,31 @@ private boolean validHole(BlockPos pos) { testPos.add(0, -1, 0); ((IBox) box).set(pos); - if (!mc.world.getOtherEntities(null, box, entity -> entity instanceof PlayerEntity - || entity instanceof TntEntity || entity instanceof EndCrystalEntity).isEmpty()) return false; + if (!mc.world.getOtherEntities(null, box, entity + -> entity instanceof PlayerEntity + || entity instanceof TntEntity + || entity instanceof EndCrystalEntity).isEmpty()) return false; if (!smart.get() || forceFill.get().isPressed()) return true; - boolean validHole = false; - for (PlayerEntity target : targets) { - if (target.getY() > testPos.getY() && (distance(target, testPos, true) < feetRange.get())) { - validHole = true; - break; - } - } - - return validHole; + return targets.stream().anyMatch(target + -> target.getY() > testPos.getY() + && (distance(target, testPos, true) < feetRange.get())); } private void setTargets() { targets.clear(); for (PlayerEntity player : mc.world.getPlayers()) { - if (player.distanceTo(mc.player) > targetRange.get()) continue; - - if (player.isCreative() || player == mc.player - || player.isDead() || !Friends.get().shouldAttack(player) - || (isSurrounded(player) && ignoreSafe.get()) + if (player.distanceTo(mc.player) > targetRange.get() || + player.isCreative() || + player == mc.player || + player.isDead() || + !Friends.get().shouldAttack(player) || + (ignoreSafe.get() && isSurrounded(player)) || + (onlyMoving.get() && (player.getX() - player.prevX != 0 || player.getY() - player.prevY != 0 || player.getZ() - player.prevZ != 0)) ) continue; - if (onlyMoving.get()) { - if (player.getX() - player.prevX != 0) continue; - if (player.getY() - player.prevY != 0) continue; - if (player.getZ() - player.prevZ != 0) continue; - } - - if (ignoreSafe.get()) { - if (isSurrounded(player)) continue; - } - targets.add(player); } } @@ -378,17 +362,18 @@ private boolean isSurrounded(PlayerEntity target) { testPos.set(target.getBlockPos().offset(dir)); Block block = mc.world.getBlockState(testPos).getBlock(); - if (block != Blocks.OBSIDIAN && block != Blocks.BEDROCK && block != Blocks.RESPAWN_ANCHOR - && block != Blocks.CRYING_OBSIDIAN && block != Blocks.NETHERITE_BLOCK) { - return false; - } + if (block != Blocks.OBSIDIAN && + block != Blocks.BEDROCK && + block != Blocks.RESPAWN_ANCHOR && + block != Blocks.CRYING_OBSIDIAN && + block != Blocks.NETHERITE_BLOCK) return false; } return true; } private double distance(PlayerEntity player, BlockPos pos, boolean feet) { - testVec = player.getPos(); + Vec3d testVec = player.getPos(); if (!feet) testVec.add(0, player.getEyeHeight(mc.player.getPose()), 0); else if (predict.get()) { @@ -403,12 +388,12 @@ else if (predict.get()) { double j = testVec.y - (pos.getY() + ((feet) ? 1 : 0.5)); double k = testVec.z - (pos.getZ() + 0.5); - return (Math.sqrt(i * i + j * j + k * k)); + return Math.sqrt(i * i + j * j + k * k); } private static class Hole { - public BlockPos.Mutable blockPos = new BlockPos.Mutable(); - public byte exclude; + private final BlockPos.Mutable blockPos = new BlockPos.Mutable(); + private final byte exclude; public Hole(BlockPos blockPos, byte exclude) { this.blockPos.set(blockPos); From f511cd10ebdd0913181064dba0152063cf5ed5bb Mon Sep 17 00:00:00 2001 From: DesiCow Date: Thu, 26 Jan 2023 15:55:12 +0530 Subject: [PATCH 090/135] Added NoHunger-slowdown to NoSlow module --- .../meteorclient/mixin/ClientPlayerEntityMixin.java | 8 ++++++++ .../meteorclient/systems/modules/movement/NoSlow.java | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java index 31e36e79e1..79c4483c55 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java @@ -25,7 +25,9 @@ import net.minecraft.entity.damage.DamageSource; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Constant; import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyConstant; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @@ -78,6 +80,12 @@ private void onDamage(DamageSource source, float amount, CallbackInfoReturnable< if (Utils.canUpdate() && world.isClient && canTakeDamage()) MeteorClient.EVENT_BUS.post(DamageEvent.get(this, source)); } + @ModifyConstant(method = "canSprint", constant = @Constant(floatValue = 6.0f)) + private float onHunger(float constant) { + if (Modules.get().get(NoSlow.class).hunger()) return 0; + return constant; + } + // Rotations @Inject(method = "sendMovementPackets", at = @At("HEAD")) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/NoSlow.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/NoSlow.java index 20dac9a481..331b5d02fb 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/NoSlow.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/NoSlow.java @@ -83,6 +83,13 @@ public class NoSlow extends Module { .build() ); + private final Setting hunger = sgGeneral.add(new BoolSetting.Builder() + .name("hunger") + .description("Whether or not hunger will not slow you down.") + .defaultValue(false) + .build() + ); + private final Setting slowness = sgGeneral.add(new BoolSetting.Builder() .name("slowness") .description("Whether or not slowness will not slow you down.") @@ -133,6 +140,10 @@ public boolean sneaking() { return isActive() && sneaking.get(); } + public boolean hunger() { + return isActive() && hunger.get(); + } + public boolean slowness() { return isActive() && slowness.get(); } From 280519c097f9cc0e84cbc6d4fd86ecac05c4c8ba Mon Sep 17 00:00:00 2001 From: DesiCow Date: Thu, 26 Jan 2023 16:09:48 +0530 Subject: [PATCH 091/135] AntiBreak improvements and minor code refactoring --- .../systems/modules/combat/BowAimbot.java | 5 +-- .../systems/modules/player/AutoFish.java | 16 ++++++- .../systems/modules/world/AutoShearer.java | 42 ++++++------------- .../systems/modules/world/Flamethrower.java | 37 +++++----------- .../meteorclient/utils/player/InvUtils.java | 1 + 5 files changed, 39 insertions(+), 62 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/BowAimbot.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/BowAimbot.java index 1003d30608..5e30648b77 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/BowAimbot.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/BowAimbot.java @@ -25,8 +25,7 @@ import net.minecraft.entity.passive.AnimalEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ArrowItem; -import net.minecraft.item.BowItem; -import net.minecraft.item.CrossbowItem; +import net.minecraft.item.Items; import net.minecraft.util.math.Vec3d; public class BowAimbot extends Module { @@ -127,7 +126,7 @@ private void onRender(Render3DEvent event) { } private boolean itemInHand() { - return mc.player.getMainHandStack().getItem() instanceof BowItem || mc.player.getMainHandStack().getItem() instanceof CrossbowItem; + return InvUtils.testInMainHand(Items.BOW, Items.CROSSBOW); } private void aim(double tickDelta) { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoFish.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoFish.java index cf51c8b5b3..cac2bb83fd 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoFish.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoFish.java @@ -12,10 +12,11 @@ import meteordevelopment.meteorclient.systems.modules.Categories; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.utils.Utils; +import meteordevelopment.meteorclient.utils.player.InvUtils; import meteordevelopment.orbit.EventHandler; import net.minecraft.client.sound.SoundInstance; import net.minecraft.entity.projectile.FishingBobberEntity; -import net.minecraft.item.FishingRodItem; +import net.minecraft.item.Items; public class AutoFish extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); @@ -57,6 +58,13 @@ public class AutoFish extends Module { .build() ); + private final Setting antiBreak = sgGeneral.add(new BoolSetting.Builder() + .name("anti-break") + .description("Prevents fishing rod from being broken.") + .defaultValue(false) + .build() + ); + // Splash Detection private final Setting splashDetectionRangeEnabled = sgSplashRangeDetection.add(new BoolSetting.Builder() @@ -114,7 +122,7 @@ private void onTick(TickEvent.Post event) { if (autoCastCheckTimer <= 0) { autoCastCheckTimer = 30; - if (autoCast.get() && !ticksEnabled && !autoCastEnabled && mc.player.fishHook == null && mc.player.getMainHandStack().getItem() instanceof FishingRodItem) { + if (autoCast.get() && !ticksEnabled && !autoCastEnabled && mc.player.fishHook == null && hasFishingRod()) { autoCastTimer = 0; autoCastEnabled = true; } @@ -152,4 +160,8 @@ else if (ticksData == 1) { private void onKey(KeyEvent event) { if (mc.options.useKey.isPressed()) ticksEnabled = false; } + + private boolean hasFishingRod() { + return InvUtils.swap(InvUtils.findInHotbar(itemStack -> itemStack.getItem() == Items.FISHING_ROD && (!antiBreak.get() || itemStack.getDamage() < itemStack.getMaxDamage() - 1)).slot(), false); + } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/AutoShearer.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/AutoShearer.java index eca4c48b3a..201a91ba9f 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/AutoShearer.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/AutoShearer.java @@ -20,7 +20,6 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.passive.SheepEntity; import net.minecraft.item.Items; -import net.minecraft.item.ShearsItem; import net.minecraft.util.Hand; public class AutoShearer extends Module { @@ -49,7 +48,7 @@ public class AutoShearer extends Module { ); private Entity entity; - private boolean offHand; + private Hand hand; public AutoShearer() { super(Categories.World, "auto-shearer", "Automatically shears sheep."); @@ -67,38 +66,21 @@ private void onTick(TickEvent.Pre event) { for (Entity entity : mc.world.getEntities()) { if (!(entity instanceof SheepEntity) || ((SheepEntity) entity).isSheared() || ((SheepEntity) entity).isBaby() || !PlayerUtils.isWithin(entity, distance.get())) continue; - boolean findNewShears = false; - if (mc.player.getInventory().getMainHandStack().getItem() instanceof ShearsItem) { - if (antiBreak.get() && mc.player.getInventory().getMainHandStack().getDamage() >= mc.player.getInventory().getMainHandStack().getMaxDamage() - 1) findNewShears = true; - } - else if (mc.player.getInventory().offHand.get(0).getItem() instanceof ShearsItem) { - if (antiBreak.get() && mc.player.getInventory().offHand.get(0).getDamage() >= mc.player.getInventory().offHand.get(0).getMaxDamage() - 1) findNewShears = true; - else offHand = true; - } - else { - findNewShears = true; - } - - boolean foundShears = !findNewShears; - if (findNewShears) { - FindItemResult shears = InvUtils.findInHotbar(itemStack -> (!antiBreak.get() || (antiBreak.get() && itemStack.getDamage() < itemStack.getMaxDamage() - 1)) && itemStack.getItem() == Items.SHEARS); - - if (InvUtils.swap(shears.slot(), true)) foundShears = true; - } - - if (foundShears) { - this.entity = entity; - - if (rotate.get()) Rotations.rotate(Rotations.getYaw(entity), Rotations.getPitch(entity), -100, this::interact); - else interact(); - - return; - } + FindItemResult findShear = InvUtils.findInHotbar(itemStack -> itemStack.getItem() == Items.SHEARS && (!antiBreak.get() || itemStack.getDamage() < itemStack.getMaxDamage() - 1)); + if (!InvUtils.swap(findShear.slot(), true)) return; + + this.hand = findShear.isOffhand() ? Hand.OFF_HAND : Hand.MAIN_HAND; + this.entity = entity; + + if (rotate.get()) Rotations.rotate(Rotations.getYaw(entity), Rotations.getPitch(entity), -100, this::interact); + else interact(); + + return; } } private void interact() { - mc.interactionManager.interactEntity(mc.player, entity, offHand ? Hand.OFF_HAND : Hand.MAIN_HAND); + mc.interactionManager.interactEntity(mc.player, entity, hand); InvUtils.swapBack(); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Flamethrower.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Flamethrower.java index 52a636653d..4c7ad73358 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Flamethrower.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Flamethrower.java @@ -10,6 +10,7 @@ import meteordevelopment.meteorclient.settings.*; import meteordevelopment.meteorclient.systems.modules.Categories; import meteordevelopment.meteorclient.systems.modules.Module; +import meteordevelopment.meteorclient.utils.player.FindItemResult; import meteordevelopment.meteorclient.utils.player.InvUtils; import meteordevelopment.meteorclient.utils.player.PlayerUtils; import meteordevelopment.meteorclient.utils.player.Rotations; @@ -85,6 +86,7 @@ public class Flamethrower extends Module { private Entity entity; private int ticks = 0; + private Hand hand; public Flamethrower() { super(Categories.World, "flamethrower", "Ignites every alive piece of food."); @@ -105,16 +107,16 @@ private void onTick(TickEvent.Pre event) { if (entity == mc.player) continue; if (!targetBabies.get() && entity instanceof LivingEntity && ((LivingEntity)entity).isBaby()) continue; - boolean success = selectSlot(); + FindItemResult findFlintAndSteel = InvUtils.findInHotbar(itemStack -> itemStack.getItem() == Items.FLINT_AND_STEEL && (!antiBreak.get() || itemStack.getDamage() < itemStack.getMaxDamage() - 1)); + if (!InvUtils.swap(findFlintAndSteel.slot(), true)) return; - if (success) { - this.entity = entity; + this.hand = findFlintAndSteel.isOffhand() ? Hand.OFF_HAND : Hand.MAIN_HAND; + this.entity = entity; - if (rotate.get()) Rotations.rotate(Rotations.getYaw(entity.getBlockPos()), Rotations.getPitch(entity.getBlockPos()), -100, this::interact); - else interact(); + if (rotate.get()) Rotations.rotate(Rotations.getYaw(entity.getBlockPos()), Rotations.getPitch(entity.getBlockPos()), -100, this::interact); + else interact(); - return; - } + return; } } @@ -132,7 +134,7 @@ private void interact() { mc.interactionManager.attackBlock(entity.getBlockPos().south(), Direction.DOWN); } else { if (ticks >= tickInterval.get() && !entity.isOnFire()) { - mc.interactionManager.interactBlock(mc.player, Hand.MAIN_HAND, new BlockHitResult( + mc.interactionManager.interactBlock(mc.player, hand, new BlockHitResult( entity.getPos().subtract(new Vec3d(0, 1, 0)), Direction.UP, entity.getBlockPos().down(), false)); ticks = 0; } @@ -140,23 +142,4 @@ private void interact() { InvUtils.swapBack(); } - - private boolean selectSlot() { - boolean findNewFlintAndSteel = false; - if (mc.player.getInventory().getMainHandStack().getItem() == Items.FLINT_AND_STEEL) { - if (antiBreak.get() && mc.player.getInventory().getMainHandStack().getDamage() >= mc.player.getInventory().getMainHandStack().getMaxDamage() - 1) - findNewFlintAndSteel = true; - } else if (mc.player.getInventory().offHand.get(0).getItem() == Items.FLINT_AND_STEEL) { - if (antiBreak.get() && mc.player.getInventory().offHand.get(0).getDamage() >= mc.player.getInventory().offHand.get(0).getMaxDamage() - 1) - findNewFlintAndSteel = true; - } else { - findNewFlintAndSteel = true; - } - - boolean foundFlintAndSteel = !findNewFlintAndSteel; - if (findNewFlintAndSteel) { - foundFlintAndSteel = InvUtils.swap(InvUtils.findInHotbar(itemStack -> (!antiBreak.get() || (antiBreak.get() && itemStack.getDamage() < itemStack.getMaxDamage() - 1)) && itemStack.getItem() == Items.FLINT_AND_STEEL).slot(), true); - } - return foundFlintAndSteel; - } } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/InvUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/player/InvUtils.java index 0d9e900369..f7d09ae261 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/InvUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/InvUtils.java @@ -142,6 +142,7 @@ public static FindItemResult findFastestTool(BlockState state) { // Interactions public static boolean swap(int slot, boolean swapBack) { + if (slot == SlotUtils.OFFHAND) return true; if (slot < 0 || slot > 8) return false; if (swapBack && previousSlot == -1) previousSlot = mc.player.getInventory().selectedSlot; else if (!swapBack) previousSlot = -1; From 854426eb8d35fdc87b60142b798f200ed6d52b8e Mon Sep 17 00:00:00 2001 From: DesiCow Date: Sun, 29 Jan 2023 19:35:01 +0530 Subject: [PATCH 092/135] update --- .../meteorclient/systems/modules/world/AutoShearer.java | 2 +- .../meteorclient/systems/modules/world/Flamethrower.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/AutoShearer.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/AutoShearer.java index 201a91ba9f..c18b473d95 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/AutoShearer.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/AutoShearer.java @@ -69,7 +69,7 @@ private void onTick(TickEvent.Pre event) { FindItemResult findShear = InvUtils.findInHotbar(itemStack -> itemStack.getItem() == Items.SHEARS && (!antiBreak.get() || itemStack.getDamage() < itemStack.getMaxDamage() - 1)); if (!InvUtils.swap(findShear.slot(), true)) return; - this.hand = findShear.isOffhand() ? Hand.OFF_HAND : Hand.MAIN_HAND; + this.hand = findShear.getHand(); this.entity = entity; if (rotate.get()) Rotations.rotate(Rotations.getYaw(entity), Rotations.getPitch(entity), -100, this::interact); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Flamethrower.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Flamethrower.java index 4c7ad73358..4fc268ce4b 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Flamethrower.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Flamethrower.java @@ -110,7 +110,7 @@ private void onTick(TickEvent.Pre event) { FindItemResult findFlintAndSteel = InvUtils.findInHotbar(itemStack -> itemStack.getItem() == Items.FLINT_AND_STEEL && (!antiBreak.get() || itemStack.getDamage() < itemStack.getMaxDamage() - 1)); if (!InvUtils.swap(findFlintAndSteel.slot(), true)) return; - this.hand = findFlintAndSteel.isOffhand() ? Hand.OFF_HAND : Hand.MAIN_HAND; + this.hand = findFlintAndSteel.getHand(); this.entity = entity; if (rotate.get()) Rotations.rotate(Rotations.getYaw(entity.getBlockPos()), Rotations.getPitch(entity.getBlockPos()), -100, this::interact); From cc2fce45898a3008b478a10e0276d41f4be46f54 Mon Sep 17 00:00:00 2001 From: DesiCow Date: Wed, 25 Jan 2023 20:16:06 +0530 Subject: [PATCH 093/135] Added Macro execute command .macro to execute a macro directly --- .../meteorclient/systems/Systems.java | 2 +- .../systems/commands/Commands.java | 1 + .../commands/arguments/MacroArgumentType.java | 59 +++++++++++++++++++ .../commands/commands/MacroCommand.java | 31 ++++++++++ .../meteorclient/systems/macros/Macro.java | 9 +-- .../meteorclient/systems/macros/Macros.java | 8 +++ 6 files changed, 105 insertions(+), 5 deletions(-) create mode 100644 src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/MacroArgumentType.java create mode 100644 src/main/java/meteordevelopment/meteorclient/systems/commands/commands/MacroCommand.java diff --git a/src/main/java/meteordevelopment/meteorclient/systems/Systems.java b/src/main/java/meteordevelopment/meteorclient/systems/Systems.java index 1eceea784e..8b7a06bb31 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/Systems.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/Systems.java @@ -40,9 +40,9 @@ public static void init() { config.load(); add(new Modules()); + add(new Macros()); add(new Commands()); add(new Friends()); - add(new Macros()); add(new Accounts()); add(new Waypoints()); add(new Profiles()); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java index 8afa1c8020..e0ad503b92 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java @@ -67,6 +67,7 @@ public void init() { add(new GamemodeCommand()); add(new SaveMapCommand()); add(new ModulesCommand()); + add(new MacroCommand()); add(new BindsCommand()); add(new GiveCommand()); add(new NameHistoryCommand()); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/MacroArgumentType.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/MacroArgumentType.java new file mode 100644 index 0000000000..04b8fb7ed6 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/MacroArgumentType.java @@ -0,0 +1,59 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.systems.commands.arguments; + +import com.mojang.brigadier.StringReader; +import com.mojang.brigadier.arguments.ArgumentType; +import com.mojang.brigadier.context.CommandContext; +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; +import com.mojang.brigadier.suggestion.Suggestions; +import com.mojang.brigadier.suggestion.SuggestionsBuilder; +import meteordevelopment.meteorclient.systems.macros.Macro; +import meteordevelopment.meteorclient.systems.macros.Macros; +import net.minecraft.command.CommandSource; +import net.minecraft.text.Text; + +import java.util.Collection; +import java.util.concurrent.CompletableFuture; +import java.util.stream.Collectors; + +public class MacroArgumentType implements ArgumentType { + private static final DynamicCommandExceptionType NO_SUCH_MACRO = new DynamicCommandExceptionType(name -> Text.literal("Macro with name " + name + " doesn't exist.")); + + private static final Collection EXAMPLES = Macros.get().getAll() + .stream() + .limit(3) + .map(macro -> macro.name.get()) + .collect(Collectors.toList()); + + public static MacroArgumentType create() { + return new MacroArgumentType(); + } + + public static Macro get(CommandContext context) { + return context.getArgument("macro", Macro.class); + } + + @Override + public Macro parse(StringReader reader) throws CommandSyntaxException { + String argument = reader.readString(); + Macro macro = Macros.get().get(argument); + if (macro == null) throw NO_SUCH_MACRO.create(argument); + + return macro; + } + + @Override + public CompletableFuture listSuggestions(CommandContext context, SuggestionsBuilder builder) { + return CommandSource.suggestMatching(Macros.get().getAll().stream().map(macro -> macro.name.get()), builder); + } + + @Override + public Collection getExamples() { + return EXAMPLES; + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/MacroCommand.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/MacroCommand.java new file mode 100644 index 0000000000..4dfb782567 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/MacroCommand.java @@ -0,0 +1,31 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.systems.commands.commands; + +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import meteordevelopment.meteorclient.systems.commands.Command; +import meteordevelopment.meteorclient.systems.commands.arguments.MacroArgumentType; +import meteordevelopment.meteorclient.systems.macros.Macro; +import net.minecraft.command.CommandSource; + +import static com.mojang.brigadier.Command.SINGLE_SUCCESS; + +public class MacroCommand extends Command { + public MacroCommand() { + super("macro", "Allows you to execute macros."); + } + + @Override + public void build(LiteralArgumentBuilder builder) { + builder.then( + argument("macro", MacroArgumentType.create()) + .executes(context -> { + Macro macro = context.getArgument("macro", Macro.class); + macro.onAction(); + return SINGLE_SUCCESS; + })); + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/macros/Macro.java b/src/main/java/meteordevelopment/meteorclient/systems/macros/Macro.java index 83eb2c4ace..81d7f31e6a 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/macros/Macro.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/macros/Macro.java @@ -56,7 +56,11 @@ public Macro(NbtElement tag) { } public boolean onAction(boolean isKey, int value) { - if (keybind.get().matches(isKey, value) && mc.currentScreen == null) { + if (!keybind.get().matches(isKey, value) || mc.currentScreen != null) return false; + return onAction(); + } + + public boolean onAction() { if (dirty) { scripts.clear(); @@ -77,9 +81,6 @@ public boolean onAction(boolean isKey, int value) { } return true; - } - - return false; } @Override diff --git a/src/main/java/meteordevelopment/meteorclient/systems/macros/Macros.java b/src/main/java/meteordevelopment/meteorclient/systems/macros/Macros.java index 24f13946db..5cd469baa3 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/macros/Macros.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/macros/Macros.java @@ -37,6 +37,14 @@ public void add(Macro macro) { save(); } + public Macro get(String name) { + for (Macro macro : macros) { + if (macro.name.get().equalsIgnoreCase(name)) return macro; + } + + return null; + } + public List getAll() { return macros; } From 7156d71880dc1bae1fc8e10d35124ebedae8169f Mon Sep 17 00:00:00 2001 From: DesiCow Date: Wed, 25 Jan 2023 20:19:17 +0530 Subject: [PATCH 094/135] refactor --- .../meteorclient/systems/commands/Commands.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java index e0ad503b92..ece2f9db20 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java @@ -66,8 +66,8 @@ public void init() { add(new SpectateCommand()); add(new GamemodeCommand()); add(new SaveMapCommand()); - add(new ModulesCommand()); add(new MacroCommand()); + add(new ModulesCommand()); add(new BindsCommand()); add(new GiveCommand()); add(new NameHistoryCommand()); From 3eeb1d04c3fc17d0ba41e7004d8ae3eba5d175ad Mon Sep 17 00:00:00 2001 From: DesiCow Date: Fri, 3 Feb 2023 16:58:34 +0530 Subject: [PATCH 095/135] dynamic examples --- .../systems/commands/arguments/MacroArgumentType.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/MacroArgumentType.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/MacroArgumentType.java index 04b8fb7ed6..d56bafb96a 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/MacroArgumentType.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/arguments/MacroArgumentType.java @@ -24,12 +24,6 @@ public class MacroArgumentType implements ArgumentType { private static final DynamicCommandExceptionType NO_SUCH_MACRO = new DynamicCommandExceptionType(name -> Text.literal("Macro with name " + name + " doesn't exist.")); - private static final Collection EXAMPLES = Macros.get().getAll() - .stream() - .limit(3) - .map(macro -> macro.name.get()) - .collect(Collectors.toList()); - public static MacroArgumentType create() { return new MacroArgumentType(); } @@ -54,6 +48,6 @@ public CompletableFuture listSuggestions(CommandContext context, Su @Override public Collection getExamples() { - return EXAMPLES; + return Macros.get().getAll().stream().limit(3).map(macro -> macro.name.get()).collect(Collectors.toList()); } } From c3fa5368edb5109d62bceb387dd9bc99a6de01f9 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Wed, 25 Jan 2023 21:47:16 +0800 Subject: [PATCH 096/135] Fix a trolling code --- .../meteorclient/systems/commands/Command.java | 6 +++--- .../systems/commands/commands/ResetCommand.java | 6 +++--- .../meteorclient/systems/modules/Module.java | 6 +++--- .../systems/modules/misc/swarm/SwarmConnection.java | 8 ++++---- .../systems/modules/misc/swarm/SwarmHost.java | 8 ++++---- .../systems/modules/misc/swarm/SwarmWorker.java | 10 +++++----- .../meteorclient/utils/misc/MeteorStarscript.java | 12 ++++++------ .../meteorclient/utils/player/ChatUtils.java | 6 +++--- 8 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/Command.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/Command.java index 7f74b7d692..e071e4670f 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/Command.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/Command.java @@ -89,16 +89,16 @@ public void info(Text message) { public void info(String message, Object... args) { ChatUtils.forceNextPrefixClass(getClass()); - ChatUtils.info(title, message, args); + ChatUtils.infoP(title, message, args); } public void warning(String message, Object... args) { ChatUtils.forceNextPrefixClass(getClass()); - ChatUtils.warning(title, message, args); + ChatUtils.warningP(title, message, args); } public void error(String message, Object... args) { ChatUtils.forceNextPrefixClass(getClass()); - ChatUtils.error(title, message, args); + ChatUtils.errorP(title, message, args); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ResetCommand.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ResetCommand.java index fb3b595155..24872a797b 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ResetCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ResetCommand.java @@ -36,7 +36,7 @@ public void build(LiteralArgumentBuilder builder) { })) .then(literal("all").executes(context -> { Modules.get().getAll().forEach(module -> module.settings.forEach(group -> group.forEach(Setting::reset))); - ChatUtils.info("Modules", "Reset all module settings"); + ChatUtils.infoP("Modules", "Reset all module settings"); return SINGLE_SUCCESS; })) ).then(literal("gui").executes(context -> { @@ -54,12 +54,12 @@ public void build(LiteralArgumentBuilder builder) { })) .then(literal("all").executes(context -> { Modules.get().getAll().forEach(module -> module.keybind.set(true, -1)); - ChatUtils.info("Modules", "Reset all binds."); + ChatUtils.infoP("Modules", "Reset all binds."); return SINGLE_SUCCESS; })) ).then(literal("hud").executes(context -> { Systems.get(Hud.class).resetToDefaultElements(); - ChatUtils.info("HUD", "Reset all elements."); + ChatUtils.infoP("HUD", "Reset all elements."); return SINGLE_SUCCESS; })); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/Module.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/Module.java index 9d8bd9bf1e..5611f6bae8 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/Module.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/Module.java @@ -99,17 +99,17 @@ public void info(Text message) { public void info(String message, Object... args) { ChatUtils.forceNextPrefixClass(getClass()); - ChatUtils.info(title, message, args); + ChatUtils.infoP(title, message, args); } public void warning(String message, Object... args) { ChatUtils.forceNextPrefixClass(getClass()); - ChatUtils.warning(title, message, args); + ChatUtils.warningP(title, message, args); } public void error(String message, Object... args) { ChatUtils.forceNextPrefixClass(getClass()); - ChatUtils.error(title, message, args); + ChatUtils.errorP(title, message, args); } public boolean isActive() { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmConnection.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmConnection.java index b5a7c51e53..5edab85ab1 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmConnection.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmConnection.java @@ -22,7 +22,7 @@ public SwarmConnection(Socket socket) { @Override public void run() { - ChatUtils.info("Swarm", "New worker connected on %s.", getIp(socket.getInetAddress().getHostAddress())); + ChatUtils.infoP("Swarm", "New worker connected on %s.", getIp(socket.getInetAddress().getHostAddress())); try { DataOutputStream out = new DataOutputStream(socket.getOutputStream()); @@ -33,7 +33,7 @@ public void run() { out.writeUTF(messageToSend); out.flush(); } catch (Exception e) { - ChatUtils.error("Swarm", "Encountered error when sending command."); + ChatUtils.errorP("Swarm", "Encountered error when sending command."); e.printStackTrace(); } @@ -43,7 +43,7 @@ public void run() { out.close(); } catch (IOException e) { - ChatUtils.info("Swarm", "Error creating a connection with %s on port %s.", getIp(socket.getInetAddress().getHostAddress()), socket.getPort()); + ChatUtils.infoP("Swarm", "Error creating a connection with %s on port %s.", getIp(socket.getInetAddress().getHostAddress()), socket.getPort()); e.printStackTrace(); } } @@ -55,7 +55,7 @@ public void disconnect() { e.printStackTrace(); } - ChatUtils.info("Swarm", "Worker disconnected on ip: %s.", socket.getInetAddress().getHostAddress()); + ChatUtils.infoP("Swarm", "Worker disconnected on ip: %s.", socket.getInetAddress().getHostAddress()); interrupt(); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmHost.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmHost.java index 1e2af763a2..be6683495b 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmHost.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmHost.java @@ -21,7 +21,7 @@ public SwarmHost(int port) { socket = new ServerSocket(port); } catch (IOException e) { socket = null; - ChatUtils.error("Swarm", "Couldn't start a server on port %s.", port); + ChatUtils.errorP("Swarm", "Couldn't start a server on port %s.", port); e.printStackTrace(); } @@ -30,14 +30,14 @@ public SwarmHost(int port) { @Override public void run() { - ChatUtils.info("Swarm", "Listening for incoming connections on port %s.", socket.getLocalPort()); + ChatUtils.infoP("Swarm", "Listening for incoming connections on port %s.", socket.getLocalPort()); while (!isInterrupted()) { try { Socket connection = socket.accept(); assignConnectionToSubServer(connection); } catch (IOException e) { - ChatUtils.error("Swarm", "Error making a connection to worker."); + ChatUtils.errorP("Swarm", "Error making a connection to worker."); e.printStackTrace(); } } @@ -63,7 +63,7 @@ public void disconnect() { e.printStackTrace(); } - ChatUtils.info("Swarm", "Server closed on port %s.", socket.getLocalPort()); + ChatUtils.infoP("Swarm", "Server closed on port %s.", socket.getLocalPort()); interrupt(); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmWorker.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmWorker.java index a5055fdff6..af15b77c95 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmWorker.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmWorker.java @@ -23,7 +23,7 @@ public SwarmWorker(String ip, int port) { socket = new Socket(ip, port); } catch (Exception e) { socket = null; - ChatUtils.warning("Swarm", "Server not found at %s on port %s.", ip, port); + ChatUtils.warningP("Swarm", "Server not found at %s on port %s.", ip, port); e.printStackTrace(); } @@ -32,7 +32,7 @@ public SwarmWorker(String ip, int port) { @Override public void run() { - ChatUtils.info("Swarm", "Connected to Swarm host on at %s on port %s.", getIp(socket.getInetAddress().getHostAddress()), socket.getPort()); + ChatUtils.infoP("Swarm", "Connected to Swarm host on at %s on port %s.", getIp(socket.getInetAddress().getHostAddress()), socket.getPort()); try { DataInputStream in = new DataInputStream(socket.getInputStream()); @@ -42,7 +42,7 @@ public void run() { String read = in.readUTF(); if (!read.equals("")) { - ChatUtils.info("Swarm", "Received command: (highlight)%s", read); + ChatUtils.infoP("Swarm", "Received command: (highlight)%s", read); try { Commands.get().dispatch(read); @@ -55,7 +55,7 @@ public void run() { in.close(); } catch (IOException e) { - ChatUtils.error("Swarm", "Error in connection to host."); + ChatUtils.errorP("Swarm", "Error in connection to host."); e.printStackTrace(); disconnect(); } @@ -70,7 +70,7 @@ public void disconnect() { BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().cancelEverything(); - ChatUtils.info("Swarm", "Disconnected from host."); + ChatUtils.infoP("Swarm", "Disconnected from host."); interrupt(); } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java b/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java index e0b2c2f83f..c75fd2d547 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java @@ -221,12 +221,12 @@ public static void printChatError(int i, Error error) { String caller = getCallerName(); if (caller != null) { - if (i != -1) ChatUtils.error("Starscript", "%d, %d '%c': %s (from %s)", i, error.character, error.ch, error.message, caller); - else ChatUtils.error("Starscript", "%d '%c': %s (from %s)", error.character, error.ch, error.message, caller); + if (i != -1) ChatUtils.errorP("Starscript", "%d, %d '%c': %s (from %s)", i, error.character, error.ch, error.message, caller); + else ChatUtils.errorP("Starscript", "%d '%c': %s (from %s)", error.character, error.ch, error.message, caller); } else { - if (i != -1) ChatUtils.error("Starscript", "%d, %d '%c': %s", i, error.character, error.ch, error.message); - else ChatUtils.error("Starscript", "%d '%c': %s", error.character, error.ch, error.message); + if (i != -1) ChatUtils.errorP("Starscript", "%d, %d '%c': %s", i, error.character, error.ch, error.message); + else ChatUtils.errorP("Starscript", "%d '%c': %s", error.character, error.ch, error.message); } } @@ -237,8 +237,8 @@ public static void printChatError(Error error) { public static void printChatError(StarscriptError e) { String caller = getCallerName(); - if (caller != null) ChatUtils.error("Starscript", "%s (from %s)", e.getMessage(), caller); - else ChatUtils.error("Starscript", "%s", e.getMessage()); + if (caller != null) ChatUtils.errorP("Starscript", "%s (from %s)", e.getMessage(), caller); + else ChatUtils.errorP("Starscript", "%s", e.getMessage()); } private static String getCallerName() { diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/ChatUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/player/ChatUtils.java index 160b7d0cd3..891b9aff4c 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/ChatUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/ChatUtils.java @@ -78,7 +78,7 @@ public static void info(String message, Object... args) { sendMsg(Formatting.GRAY, message, args); } - public static void info(String prefix, String message, Object... args) { + public static void infoP(String prefix, String message, Object... args) { sendMsg(0, prefix, Formatting.LIGHT_PURPLE, Formatting.GRAY, message, args); } @@ -88,7 +88,7 @@ public static void warning(String message, Object... args) { sendMsg(Formatting.YELLOW, message, args); } - public static void warning(String prefix, String message, Object... args) { + public static void warningP(String prefix, String message, Object... args) { sendMsg(0, prefix, Formatting.LIGHT_PURPLE, Formatting.YELLOW, message, args); } @@ -98,7 +98,7 @@ public static void error(String message, Object... args) { sendMsg(Formatting.RED, message, args); } - public static void error(String prefix, String message, Object... args) { + public static void errorP(String prefix, String message, Object... args) { sendMsg(0, prefix, Formatting.LIGHT_PURPLE, Formatting.RED, message, args); } From ae7a00f5d426e1f8e7f6322477a8012e5d6e38e5 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Fri, 3 Feb 2023 14:03:00 +0800 Subject: [PATCH 097/135] Rename ...P to ...Prefix --- .../meteorclient/systems/commands/Command.java | 6 +++--- .../systems/commands/commands/ResetCommand.java | 6 +++--- .../meteorclient/systems/modules/Module.java | 6 +++--- .../systems/modules/misc/InventoryTweaks.java | 2 +- .../systems/modules/misc/swarm/SwarmConnection.java | 8 ++++---- .../systems/modules/misc/swarm/SwarmHost.java | 8 ++++---- .../systems/modules/misc/swarm/SwarmWorker.java | 10 +++++----- .../meteorclient/utils/misc/MeteorStarscript.java | 12 ++++++------ .../meteorclient/utils/player/ChatUtils.java | 6 +++--- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/Command.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/Command.java index e071e4670f..f5ccd15a18 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/Command.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/Command.java @@ -89,16 +89,16 @@ public void info(Text message) { public void info(String message, Object... args) { ChatUtils.forceNextPrefixClass(getClass()); - ChatUtils.infoP(title, message, args); + ChatUtils.infoPrefix(title, message, args); } public void warning(String message, Object... args) { ChatUtils.forceNextPrefixClass(getClass()); - ChatUtils.warningP(title, message, args); + ChatUtils.warningPrefix(title, message, args); } public void error(String message, Object... args) { ChatUtils.forceNextPrefixClass(getClass()); - ChatUtils.errorP(title, message, args); + ChatUtils.errorPrefix(title, message, args); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ResetCommand.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ResetCommand.java index 24872a797b..64467ded90 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ResetCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/ResetCommand.java @@ -36,7 +36,7 @@ public void build(LiteralArgumentBuilder builder) { })) .then(literal("all").executes(context -> { Modules.get().getAll().forEach(module -> module.settings.forEach(group -> group.forEach(Setting::reset))); - ChatUtils.infoP("Modules", "Reset all module settings"); + ChatUtils.infoPrefix("Modules", "Reset all module settings"); return SINGLE_SUCCESS; })) ).then(literal("gui").executes(context -> { @@ -54,12 +54,12 @@ public void build(LiteralArgumentBuilder builder) { })) .then(literal("all").executes(context -> { Modules.get().getAll().forEach(module -> module.keybind.set(true, -1)); - ChatUtils.infoP("Modules", "Reset all binds."); + ChatUtils.infoPrefix("Modules", "Reset all binds."); return SINGLE_SUCCESS; })) ).then(literal("hud").executes(context -> { Systems.get(Hud.class).resetToDefaultElements(); - ChatUtils.infoP("HUD", "Reset all elements."); + ChatUtils.infoPrefix("HUD", "Reset all elements."); return SINGLE_SUCCESS; })); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/Module.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/Module.java index 5611f6bae8..d864fddfa6 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/Module.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/Module.java @@ -99,17 +99,17 @@ public void info(Text message) { public void info(String message, Object... args) { ChatUtils.forceNextPrefixClass(getClass()); - ChatUtils.infoP(title, message, args); + ChatUtils.infoPrefix(title, message, args); } public void warning(String message, Object... args) { ChatUtils.forceNextPrefixClass(getClass()); - ChatUtils.warningP(title, message, args); + ChatUtils.warningPrefix(title, message, args); } public void error(String message, Object... args) { ChatUtils.forceNextPrefixClass(getClass()); - ChatUtils.errorP(title, message, args); + ChatUtils.errorPrefix(title, message, args); } public boolean isActive() { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java index aec04ccd07..aee7348e48 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java @@ -392,7 +392,7 @@ private void onSendPacket(PacketEvent.Send event) { private void checkAutoStealSettings() { if (autoSteal.get() && autoDump.get()) { - ChatUtils.error("You can't enable Auto Steal and Auto Dump at the same time!"); + error("You can't enable Auto Steal and Auto Dump at the same time!"); autoDump.set(false); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmConnection.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmConnection.java index 5edab85ab1..0ba20420bf 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmConnection.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmConnection.java @@ -22,7 +22,7 @@ public SwarmConnection(Socket socket) { @Override public void run() { - ChatUtils.infoP("Swarm", "New worker connected on %s.", getIp(socket.getInetAddress().getHostAddress())); + ChatUtils.infoPrefix("Swarm", "New worker connected on %s.", getIp(socket.getInetAddress().getHostAddress())); try { DataOutputStream out = new DataOutputStream(socket.getOutputStream()); @@ -33,7 +33,7 @@ public void run() { out.writeUTF(messageToSend); out.flush(); } catch (Exception e) { - ChatUtils.errorP("Swarm", "Encountered error when sending command."); + ChatUtils.errorPrefix("Swarm", "Encountered error when sending command."); e.printStackTrace(); } @@ -43,7 +43,7 @@ public void run() { out.close(); } catch (IOException e) { - ChatUtils.infoP("Swarm", "Error creating a connection with %s on port %s.", getIp(socket.getInetAddress().getHostAddress()), socket.getPort()); + ChatUtils.infoPrefix("Swarm", "Error creating a connection with %s on port %s.", getIp(socket.getInetAddress().getHostAddress()), socket.getPort()); e.printStackTrace(); } } @@ -55,7 +55,7 @@ public void disconnect() { e.printStackTrace(); } - ChatUtils.infoP("Swarm", "Worker disconnected on ip: %s.", socket.getInetAddress().getHostAddress()); + ChatUtils.infoPrefix("Swarm", "Worker disconnected on ip: %s.", socket.getInetAddress().getHostAddress()); interrupt(); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmHost.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmHost.java index be6683495b..6e645760a8 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmHost.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmHost.java @@ -21,7 +21,7 @@ public SwarmHost(int port) { socket = new ServerSocket(port); } catch (IOException e) { socket = null; - ChatUtils.errorP("Swarm", "Couldn't start a server on port %s.", port); + ChatUtils.errorPrefix("Swarm", "Couldn't start a server on port %s.", port); e.printStackTrace(); } @@ -30,14 +30,14 @@ public SwarmHost(int port) { @Override public void run() { - ChatUtils.infoP("Swarm", "Listening for incoming connections on port %s.", socket.getLocalPort()); + ChatUtils.infoPrefix("Swarm", "Listening for incoming connections on port %s.", socket.getLocalPort()); while (!isInterrupted()) { try { Socket connection = socket.accept(); assignConnectionToSubServer(connection); } catch (IOException e) { - ChatUtils.errorP("Swarm", "Error making a connection to worker."); + ChatUtils.errorPrefix("Swarm", "Error making a connection to worker."); e.printStackTrace(); } } @@ -63,7 +63,7 @@ public void disconnect() { e.printStackTrace(); } - ChatUtils.infoP("Swarm", "Server closed on port %s.", socket.getLocalPort()); + ChatUtils.infoPrefix("Swarm", "Server closed on port %s.", socket.getLocalPort()); interrupt(); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmWorker.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmWorker.java index af15b77c95..0946071251 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmWorker.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/swarm/SwarmWorker.java @@ -23,7 +23,7 @@ public SwarmWorker(String ip, int port) { socket = new Socket(ip, port); } catch (Exception e) { socket = null; - ChatUtils.warningP("Swarm", "Server not found at %s on port %s.", ip, port); + ChatUtils.warningPrefix("Swarm", "Server not found at %s on port %s.", ip, port); e.printStackTrace(); } @@ -32,7 +32,7 @@ public SwarmWorker(String ip, int port) { @Override public void run() { - ChatUtils.infoP("Swarm", "Connected to Swarm host on at %s on port %s.", getIp(socket.getInetAddress().getHostAddress()), socket.getPort()); + ChatUtils.infoPrefix("Swarm", "Connected to Swarm host on at %s on port %s.", getIp(socket.getInetAddress().getHostAddress()), socket.getPort()); try { DataInputStream in = new DataInputStream(socket.getInputStream()); @@ -42,7 +42,7 @@ public void run() { String read = in.readUTF(); if (!read.equals("")) { - ChatUtils.infoP("Swarm", "Received command: (highlight)%s", read); + ChatUtils.infoPrefix("Swarm", "Received command: (highlight)%s", read); try { Commands.get().dispatch(read); @@ -55,7 +55,7 @@ public void run() { in.close(); } catch (IOException e) { - ChatUtils.errorP("Swarm", "Error in connection to host."); + ChatUtils.errorPrefix("Swarm", "Error in connection to host."); e.printStackTrace(); disconnect(); } @@ -70,7 +70,7 @@ public void disconnect() { BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().cancelEverything(); - ChatUtils.infoP("Swarm", "Disconnected from host."); + ChatUtils.infoPrefix("Swarm", "Disconnected from host."); interrupt(); } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java b/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java index c75fd2d547..acaafe5197 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java @@ -221,12 +221,12 @@ public static void printChatError(int i, Error error) { String caller = getCallerName(); if (caller != null) { - if (i != -1) ChatUtils.errorP("Starscript", "%d, %d '%c': %s (from %s)", i, error.character, error.ch, error.message, caller); - else ChatUtils.errorP("Starscript", "%d '%c': %s (from %s)", error.character, error.ch, error.message, caller); + if (i != -1) ChatUtils.errorPrefix("Starscript", "%d, %d '%c': %s (from %s)", i, error.character, error.ch, error.message, caller); + else ChatUtils.errorPrefix("Starscript", "%d '%c': %s (from %s)", error.character, error.ch, error.message, caller); } else { - if (i != -1) ChatUtils.errorP("Starscript", "%d, %d '%c': %s", i, error.character, error.ch, error.message); - else ChatUtils.errorP("Starscript", "%d '%c': %s", error.character, error.ch, error.message); + if (i != -1) ChatUtils.errorPrefix("Starscript", "%d, %d '%c': %s", i, error.character, error.ch, error.message); + else ChatUtils.errorPrefix("Starscript", "%d '%c': %s", error.character, error.ch, error.message); } } @@ -237,8 +237,8 @@ public static void printChatError(Error error) { public static void printChatError(StarscriptError e) { String caller = getCallerName(); - if (caller != null) ChatUtils.errorP("Starscript", "%s (from %s)", e.getMessage(), caller); - else ChatUtils.errorP("Starscript", "%s", e.getMessage()); + if (caller != null) ChatUtils.errorPrefix("Starscript", "%s (from %s)", e.getMessage(), caller); + else ChatUtils.errorPrefix("Starscript", "%s", e.getMessage()); } private static String getCallerName() { diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/ChatUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/player/ChatUtils.java index 891b9aff4c..1eced81b0b 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/ChatUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/ChatUtils.java @@ -78,7 +78,7 @@ public static void info(String message, Object... args) { sendMsg(Formatting.GRAY, message, args); } - public static void infoP(String prefix, String message, Object... args) { + public static void infoPrefix(String prefix, String message, Object... args) { sendMsg(0, prefix, Formatting.LIGHT_PURPLE, Formatting.GRAY, message, args); } @@ -88,7 +88,7 @@ public static void warning(String message, Object... args) { sendMsg(Formatting.YELLOW, message, args); } - public static void warningP(String prefix, String message, Object... args) { + public static void warningPrefix(String prefix, String message, Object... args) { sendMsg(0, prefix, Formatting.LIGHT_PURPLE, Formatting.YELLOW, message, args); } @@ -98,7 +98,7 @@ public static void error(String message, Object... args) { sendMsg(Formatting.RED, message, args); } - public static void errorP(String prefix, String message, Object... args) { + public static void errorPrefix(String prefix, String message, Object... args) { sendMsg(0, prefix, Formatting.LIGHT_PURPLE, Formatting.RED, message, args); } From 774ddbe82f234ac112c0747b5fe802c1d96aa435 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Wed, 25 Jan 2023 14:59:02 +0800 Subject: [PATCH 098/135] No insta break --- .../ClientPlayerInteractionManagerMixin.java | 29 +++++++++++++------ .../systems/modules/player/BreakDelay.java | 8 +++++ 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerInteractionManagerMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerInteractionManagerMixin.java index b49ddd0eb5..9abf07156c 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerInteractionManagerMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerInteractionManagerMixin.java @@ -11,9 +11,11 @@ import meteordevelopment.meteorclient.mixininterface.IClientPlayerInteractionManager; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.misc.InventoryTweaks; +import meteordevelopment.meteorclient.systems.modules.player.BreakDelay; import meteordevelopment.meteorclient.systems.modules.player.Reach; import meteordevelopment.meteorclient.utils.player.Rotations; import meteordevelopment.meteorclient.utils.world.BlockUtils; +import net.minecraft.block.BlockState; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.network.ClientPlayerInteractionManager; import net.minecraft.entity.Entity; @@ -27,13 +29,11 @@ import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.world.BlockView; import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyArgs; -import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.invoke.arg.Args; @@ -110,24 +110,35 @@ private void onGetReachDistance(CallbackInfoReturnable info) { info.setReturnValue(Modules.get().get(Reach.class).getReach()); } - @Redirect(method = "updateBlockBreakingProgress", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;blockBreakingCooldown:I", ordinal = 3)) - private void updateBlockBreakingProgress3(ClientPlayerInteractionManager interactionManager, int value) { + @Redirect(method = "updateBlockBreakingProgress", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;blockBreakingCooldown:I", opcode = Opcodes.PUTFIELD, ordinal = 1)) + private void creativeBreakDelayChange(ClientPlayerInteractionManager interactionManager, int value) { BlockBreakingCooldownEvent event = MeteorClient.EVENT_BUS.post(BlockBreakingCooldownEvent.get(value)); blockBreakingCooldown = event.cooldown; } - @Redirect(method = "updateBlockBreakingProgress", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;blockBreakingCooldown:I", ordinal = 4)) - private void updateBlockBreakingProgress4(ClientPlayerInteractionManager interactionManager, int value) { + @Redirect(method = "updateBlockBreakingProgress", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;blockBreakingCooldown:I", opcode = Opcodes.PUTFIELD, ordinal = 2)) + private void survivalBreakDelayChange(ClientPlayerInteractionManager interactionManager, int value) { BlockBreakingCooldownEvent event = MeteorClient.EVENT_BUS.post(BlockBreakingCooldownEvent.get(value)); blockBreakingCooldown = event.cooldown; } @Redirect(method = "attackBlock", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;blockBreakingCooldown:I", opcode = Opcodes.PUTFIELD)) - private void attackBlock(ClientPlayerInteractionManager interactionManager, int value) { + private void creativeBreakDelayChange2(ClientPlayerInteractionManager interactionManager, int value) { BlockBreakingCooldownEvent event = MeteorClient.EVENT_BUS.post(BlockBreakingCooldownEvent.get(value)); blockBreakingCooldown = event.cooldown; } + @Redirect(method = "method_41930",at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;calcBlockBreakingDelta(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)F"), remap = false) + private float deltaChange(BlockState blockState, PlayerEntity player, BlockView world, BlockPos pos) { + float delta = blockState.calcBlockBreakingDelta(player, world, pos); + if (Modules.get().get(BreakDelay.class).noInstaBreak.get() && delta >= 1) { + BlockBreakingCooldownEvent event = MeteorClient.EVENT_BUS.post(BlockBreakingCooldownEvent.get(blockBreakingCooldown)); + blockBreakingCooldown = event.cooldown; + return 0; + } + return delta; + } + @Inject(method = "breakBlock", at = @At("HEAD"), cancellable = true) private void onBreakBlock(BlockPos blockPos, CallbackInfoReturnable info) { final BreakBlockEvent event = BreakBlockEvent.get(blockPos); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/BreakDelay.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/BreakDelay.java index d5608a2797..8c03db2ad6 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/BreakDelay.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/BreakDelay.java @@ -6,6 +6,7 @@ package meteordevelopment.meteorclient.systems.modules.player; import meteordevelopment.meteorclient.events.entity.player.BlockBreakingCooldownEvent; +import meteordevelopment.meteorclient.settings.BoolSetting; import meteordevelopment.meteorclient.settings.IntSetting; import meteordevelopment.meteorclient.settings.Setting; import meteordevelopment.meteorclient.settings.SettingGroup; @@ -25,6 +26,13 @@ public class BreakDelay extends Module { .build() ); + public final Setting noInstaBreak = sgGeneral.add(new BoolSetting.Builder() + .name("no-insta-break") + .description("Prevent you from breaking blocks instantly.") + .defaultValue(false) + .build() + ); + public BreakDelay() { super(Categories.Player, "break-delay", "Changes the delay between breaking blocks."); } From 7a641b65539d30bfdf1752e8f1b0fecc1d6cb789 Mon Sep 17 00:00:00 2001 From: arlo Date: Wed, 1 Feb 2023 14:38:59 +0000 Subject: [PATCH 099/135] read more info from mod meta --- build.gradle | 14 ++++++------- .../meteorclient/MeteorClient.java | 21 ++++++++++++------- .../meteorclient/systems/config/Config.java | 2 +- .../systems/hud/elements/MeteorTextHud.java | 2 +- .../systems/hud/elements/TextHud.java | 3 ++- .../systems/modules/misc/DiscordPresence.java | 4 ++-- .../utils/misc/MeteorStarscript.java | 3 ++- 7 files changed, 29 insertions(+), 20 deletions(-) diff --git a/build.gradle b/build.gradle index 1d3495bfc2..fa90cdb209 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { - id 'fabric-loom' version '1.0-SNAPSHOT' - id 'maven-publish' - id 'com.github.johnrengelman.shadow' version '7.1.2' + id "fabric-loom" version "1.1-SNAPSHOT" + id "maven-publish" + id "com.github.johnrengelman.shadow" version "7.1.2" } sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17 @@ -46,9 +46,9 @@ configurations { dependencies { // Fabric - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + minecraft "com.mojang:minecraft:${project.minecraft_version}" + mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" + modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modInclude fabricApi.module("fabric-resource-loader-v0", project.fapi_version) // Compat fixes @@ -113,7 +113,7 @@ remapJar { } javadoc { - options.addStringOption('Xdoclint:none', '-quiet') + options.addStringOption("Xdoclint:none", "-quiet") options.encoding = "UTF-8" } diff --git a/src/main/java/meteordevelopment/meteorclient/MeteorClient.java b/src/main/java/meteordevelopment/meteorclient/MeteorClient.java index 8cabcbbd9b..e814c99b9b 100644 --- a/src/main/java/meteordevelopment/meteorclient/MeteorClient.java +++ b/src/main/java/meteordevelopment/meteorclient/MeteorClient.java @@ -44,18 +44,25 @@ public class MeteorClient implements ClientModInitializer { public static final String MOD_ID = "meteor-client"; - public static final ModMetadata MOD_META = FabricLoader.getInstance().getModContainer(MOD_ID).get().getMetadata(); - public final static Version VERSION; - public final static String DEV_BUILD; + public static final ModMetadata MOD_META; + public static final String NAME; + public static final Version VERSION; + public static final String DEV_BUILD; + + public static MeteorClient INSTANCE; public static MeteorAddon ADDON; public static MinecraftClient mc; - public static MeteorClient INSTANCE; public static final IEventBus EVENT_BUS = new EventBus(); - public static final File FOLDER = new File(FabricLoader.getInstance().getGameDir().toString(), MOD_ID); - public static final Logger LOG = LoggerFactory.getLogger("Meteor Client"); + public static final File FOLDER = FabricLoader.getInstance().getGameDir().resolve(MOD_ID).toFile(); + public static final Logger LOG; static { + MOD_META = FabricLoader.getInstance().getModContainer(MOD_ID).orElseThrow().getMetadata(); + + NAME = MOD_META.getName(); + LOG = LoggerFactory.getLogger(NAME); + String versionString = MOD_META.getVersion().getFriendlyString(); if (versionString.contains("-")) versionString = versionString.split("-")[0]; @@ -70,7 +77,7 @@ public void onInitializeClient() { return; } - LOG.info("Initializing Meteor Client"); + LOG.info("Initializing {}", NAME); // Global minecraft client accessor mc = MinecraftClient.getInstance(); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/config/Config.java b/src/main/java/meteordevelopment/meteorclient/systems/config/Config.java index fd6721c58c..92239d2f5e 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/config/Config.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/config/Config.java @@ -82,7 +82,7 @@ public class Config extends System { .name("window-title-text") .description("The text it displays in the window title.") .visible(customWindowTitle::get) - .defaultValue("Minecraft {mc_version} - Meteor Client {version}") + .defaultValue("Minecraft {mc_version} - {meteor.name} {meteor.version}") .onChanged(value -> mc.updateWindowTitle()) .build() ); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/MeteorTextHud.java b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/MeteorTextHud.java index 2420f14985..9188959a38 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/MeteorTextHud.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/MeteorTextHud.java @@ -50,7 +50,7 @@ public class MeteorTextHud { ROTATION = addPreset("Rotation", "{camera.direction} #1({round(camera.yaw, 1)}, {round(camera.pitch, 1)})", 0); MODULE_ENABLED = addPreset("Module enabled", "Kill Aura: {meteor.is_module_active(\"kill-aura\") ? #2 \"ON\" : #3 \"OFF\"}", 0); MODULE_ENABLED_WITH_INFO = addPreset("Module enabled with info", "Kill Aura: {meteor.is_module_active(\"kill-aura\") ? #2 \"ON\" : #3 \"OFF\"} #1{meteor.get_module_info(\"kill-aura\")}", 0); - WATERMARK = addPreset("Watermark", "Meteor Client #1{version}", Integer.MAX_VALUE); + WATERMARK = addPreset("Watermark", "{meteor.name} #1{meteor.version}"); BARITONE = addPreset("Baritone", "Baritone: #1{baritone.process_name}"); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/TextHud.java b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/TextHud.java index 01794548eb..3bf670b0ed 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/TextHud.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/TextHud.java @@ -5,6 +5,7 @@ package meteordevelopment.meteorclient.systems.hud.elements; +import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.gui.utils.StarscriptTextBoxRenderer; import meteordevelopment.meteorclient.settings.*; import meteordevelopment.meteorclient.systems.hud.Hud; @@ -40,7 +41,7 @@ public class TextHud extends HudElement { public final Setting text = sgGeneral.add(new StringSetting.Builder() .name("text") .description("Text to display with Starscript.") - .defaultValue("Meteor Client") + .defaultValue(MeteorClient.NAME) .onChanged(s -> recompile()) .wide() .renderer(StarscriptTextBoxRenderer.class) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/DiscordPresence.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/DiscordPresence.java index cc82297167..3750694c38 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/DiscordPresence.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/DiscordPresence.java @@ -149,7 +149,7 @@ public void onActivate() { rpc.setStart(System.currentTimeMillis() / 1000L); - String largeText = "Meteor Client " + MeteorClient.VERSION; + String largeText = "%s %s".formatted(MeteorClient.NAME, MeteorClient.VERSION); if (!MeteorClient.DEV_BUILD.isEmpty()) largeText += " Dev Build: " + MeteorClient.DEV_BUILD; rpc.setLargeImage("meteor_client", largeText); @@ -242,7 +242,7 @@ private void onTick(TickEvent.Post event) { } else { if (!lastWasInMainMenu) { - rpc.setDetails("Meteor Client " + (MeteorClient.DEV_BUILD.isEmpty() ? MeteorClient.VERSION : MeteorClient.VERSION + " " + MeteorClient.DEV_BUILD)); + rpc.setDetails(MeteorClient.NAME + " " + (MeteorClient.DEV_BUILD.isEmpty() ? MeteorClient.VERSION : MeteorClient.VERSION + " " + MeteorClient.DEV_BUILD)); if (mc.currentScreen instanceof TitleScreen) rpc.setState("Looking at title screen"); else if (mc.currentScreen instanceof SelectWorldScreen) rpc.setState("Selecting world"); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java b/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java index acaafe5197..fb001ab840 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java @@ -74,7 +74,6 @@ public static void init() { StandardLib.init(ss); // General - ss.set("version", MeteorClient.VERSION != null ? (MeteorClient.DEV_BUILD.isEmpty() ? MeteorClient.VERSION.toString() : MeteorClient.VERSION + " " + MeteorClient.DEV_BUILD) : ""); ss.set("mc_version", SharedConstants.getGameVersion().getName()); ss.set("fps", () -> Value.number(MinecraftClientAccessor.getFps())); ss.set("ping", MeteorStarscript::ping); @@ -82,6 +81,8 @@ public static void init() { // Meteor ss.set("meteor", new ValueMap() + .set("name", MeteorClient.NAME) + .set("version", MeteorClient.VERSION != null ? (MeteorClient.DEV_BUILD.isEmpty() ? MeteorClient.VERSION.toString() : MeteorClient.VERSION + " " + MeteorClient.DEV_BUILD) : "") .set("modules", () -> Value.number(Modules.get().getAll().size())) .set("active_modules", () -> Value.number(Modules.get().getActive().size())) .set("is_module_active", MeteorStarscript::isModuleActive) From 8f47909bc0b99538d0545829a79e1043fa055ed9 Mon Sep 17 00:00:00 2001 From: arlo Date: Fri, 3 Feb 2023 17:13:21 +0000 Subject: [PATCH 100/135] fix BreakDelay mixin --- .../meteorclient/mixin/ClientPlayerInteractionManagerMixin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerInteractionManagerMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerInteractionManagerMixin.java index 9abf07156c..29927e0be2 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerInteractionManagerMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerInteractionManagerMixin.java @@ -128,7 +128,7 @@ private void creativeBreakDelayChange2(ClientPlayerInteractionManager interactio blockBreakingCooldown = event.cooldown; } - @Redirect(method = "method_41930",at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;calcBlockBreakingDelta(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)F"), remap = false) + @Redirect(method = "method_41930",at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;calcBlockBreakingDelta(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)F")) private float deltaChange(BlockState blockState, PlayerEntity player, BlockView world, BlockPos pos) { float delta = blockState.calcBlockBreakingDelta(player, world, pos); if (Modules.get().get(BreakDelay.class).noInstaBreak.get() && delta >= 1) { From 79a321f0a9e8c7eea02d091a9b99d4fa2ac29008 Mon Sep 17 00:00:00 2001 From: arlomcwalter Date: Fri, 3 Feb 2023 17:19:23 +0000 Subject: [PATCH 101/135] Create pull_request_template.md --- .github/pull_request_template.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000000..e91c4ffc88 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,22 @@ +## Type of change + +- [ ] Bug fix +- [ ] New feature + +## Description + +A summary of the changes along with the reasoning behind the changes. + +## Related issues + +Mention any issues that this pr relates to. + +# How Has This Been Tested? + +Videos or screenshots of the changes if applicable. + +# Checklist: + +- [ ] My code follows the style guidelines of this project. +- [ ] I have added comments to my code in more complex areas. +- [ ] I have tested the code in both development and production environments. From 69c3d31677293a8f1d99985a0fb3f655cab6bf51 Mon Sep 17 00:00:00 2001 From: RacoonDog <32882447+RacoonDog@users.noreply.github.com> Date: Fri, 3 Feb 2023 23:53:35 -0500 Subject: [PATCH 102/135] Update PlayerUtils.java --- .../meteorclient/utils/player/PlayerUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/PlayerUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/player/PlayerUtils.java index 0a24635cdb..13b7604ef1 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/PlayerUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/PlayerUtils.java @@ -328,7 +328,7 @@ public static boolean isWithinReach(BlockPos blockPos) { } public static boolean isWithinReach(double x, double y, double z) { - return squaredDistanceTo(x, y, z) <= mc.interactionManager.getReachDistance() * mc.interactionManager.getReachDistance(); + return squaredDistance(mc.player.getX(), mc.player.getEyeY(), mc.player.getZ(), x, y, z) <= mc.interactionManager.getReachDistance() * mc.interactionManager.getReachDistance(); } public static Dimension getDimension() { From 54e5d47f0e504c333664c9e8fadf420561adcf44 Mon Sep 17 00:00:00 2001 From: DesiCow Date: Fri, 3 Feb 2023 20:24:45 +0530 Subject: [PATCH 103/135] Added onlyOnWeapon option to Hitboxes module Only modifies hitbox when holding a weapon in hand. --- .../systems/modules/combat/Hitboxes.java | 18 +++++++++++++++++- .../meteorclient/utils/player/InvUtils.java | 15 +++++++++++---- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Hitboxes.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Hitboxes.java index fb8e436a51..15f3d81c4e 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Hitboxes.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/Hitboxes.java @@ -6,14 +6,18 @@ package meteordevelopment.meteorclient.systems.modules.combat; import it.unimi.dsi.fastutil.objects.Object2BooleanMap; +import meteordevelopment.meteorclient.settings.BoolSetting; import meteordevelopment.meteorclient.settings.DoubleSetting; import meteordevelopment.meteorclient.settings.EntityTypeListSetting; import meteordevelopment.meteorclient.settings.Setting; import meteordevelopment.meteorclient.settings.SettingGroup; import meteordevelopment.meteorclient.systems.modules.Categories; import meteordevelopment.meteorclient.systems.modules.Module; +import meteordevelopment.meteorclient.utils.player.InvUtils; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; +import net.minecraft.item.AxeItem; +import net.minecraft.item.SwordItem; public class Hitboxes extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); @@ -32,13 +36,25 @@ public class Hitboxes extends Module { .build() ); + private final Setting onlyOnWeapon = sgGeneral.add(new BoolSetting.Builder() + .name("only-on-weapon") + .description("Only modifies hitbox when holding a weapon in hand.") + .defaultValue(false) + .build() + ); + public Hitboxes() { super(Categories.Combat, "hitboxes", "Expands an entity's hitboxes."); } public double getEntityValue(Entity entity) { - if (!isActive()) return 0; + if (!(isActive() && testWeapon())) return 0; if (entities.get().getBoolean(entity.getType())) return value.get(); return 0; } + + private boolean testWeapon() { + if (!onlyOnWeapon.get()) return true; + return InvUtils.testInHands(itemStack -> itemStack.getItem() instanceof SwordItem || itemStack.getItem() instanceof AxeItem); + } } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/InvUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/player/InvUtils.java index f7d09ae261..11e5602a81 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/InvUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/InvUtils.java @@ -44,9 +44,16 @@ public static boolean testInOffHand(Item... items) { }); } + public static boolean testInHands(Predicate predicate) { + return testInMainHand(predicate) || testInOffHand(predicate); + } + + public static boolean testInHands(Item... items) { + return testInMainHand(items) || testInOffHand(items); + } + public static boolean testInHotbar(Predicate predicate) { - if (testInMainHand(predicate)) return true; - if (testInOffHand(predicate)) return true; + if (testInHands(predicate)) return true; for (int i = SlotUtils.HOTBAR_START; i < SlotUtils.HOTBAR_END; i++) { ItemStack stack = mc.player.getInventory().getStack(i); @@ -79,11 +86,11 @@ public static FindItemResult findInHotbar(Item... items) { } public static FindItemResult findInHotbar(Predicate isGood) { - if (isGood.test(mc.player.getOffHandStack())) { + if (testInOffHand(isGood)) { return new FindItemResult(SlotUtils.OFFHAND, mc.player.getOffHandStack().getCount()); } - if (isGood.test(mc.player.getMainHandStack())) { + if (testInMainHand(isGood)) { return new FindItemResult(mc.player.getInventory().selectedSlot, mc.player.getMainHandStack().getCount()); } From 75012ab9b02b83f1abed6e3625234979bbef44ec Mon Sep 17 00:00:00 2001 From: Wide-Cat Date: Sun, 5 Feb 2023 12:01:11 +0000 Subject: [PATCH 104/135] Fix some issues with the most recent prs --- .../meteorclient/mixin/BedBlockMixin.java | 25 ------------------- .../mixin/ClientPlayerEntityMixin.java | 8 ++---- .../meteorclient/mixin/EntityMixin.java | 6 +++++ .../meteorclient/mixin/SlimeBlockMixin.java | 6 ----- src/main/resources/meteor-client.mixins.json | 1 - 5 files changed, 8 insertions(+), 38 deletions(-) delete mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/BedBlockMixin.java diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/BedBlockMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/BedBlockMixin.java deleted file mode 100644 index f53340d819..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/mixin/BedBlockMixin.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.mixin; - -import meteordevelopment.meteorclient.systems.modules.Modules; -import meteordevelopment.meteorclient.systems.modules.movement.NoFall; -import net.minecraft.block.BedBlock; -import net.minecraft.entity.Entity; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import static meteordevelopment.meteorclient.MeteorClient.mc; - -@Mixin(BedBlock.class) -public class BedBlockMixin { - @Inject(method = "bounceEntity", at = @At("HEAD"), cancellable = true) - private void onBounceEntity(Entity entity, CallbackInfo info) { - if (Modules.get().get(NoFall.class).cancelBounce() && entity == mc.player) info.cancel(); - } -} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java index 79c4483c55..515d77cd4e 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java @@ -24,11 +24,7 @@ import net.minecraft.client.world.ClientWorld; import net.minecraft.entity.damage.DamageSource; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Constant; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyConstant; -import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @@ -82,7 +78,7 @@ private void onDamage(DamageSource source, float amount, CallbackInfoReturnable< @ModifyConstant(method = "canSprint", constant = @Constant(floatValue = 6.0f)) private float onHunger(float constant) { - if (Modules.get().get(NoSlow.class).hunger()) return 0; + if (Modules.get().get(NoSlow.class).hunger()) return -1; return constant; } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/EntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/EntityMixin.java index 328b254fc6..e6bb1d3585 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/EntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/EntityMixin.java @@ -11,6 +11,7 @@ import meteordevelopment.meteorclient.events.entity.player.PlayerMoveEvent; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.combat.Hitboxes; +import meteordevelopment.meteorclient.systems.modules.movement.NoFall; import meteordevelopment.meteorclient.systems.modules.movement.NoSlow; import meteordevelopment.meteorclient.systems.modules.movement.Velocity; import meteordevelopment.meteorclient.systems.modules.movement.elytrafly.ElytraFly; @@ -147,4 +148,9 @@ private void getPoseHook(CallbackInfoReturnable info) { info.setReturnValue(EntityPose.FALL_FLYING); } } + + @Inject(method = "bypassesLandingEffects", at = @At("RETURN"), cancellable = true) + private void cancelBounce(CallbackInfoReturnable cir) { + cir.setReturnValue(Modules.get().get(NoFall.class).cancelBounce() || cir.getReturnValue()); + } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/SlimeBlockMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/SlimeBlockMixin.java index 89faf7390b..27a0d7455e 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/SlimeBlockMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/SlimeBlockMixin.java @@ -6,7 +6,6 @@ package meteordevelopment.meteorclient.mixin; import meteordevelopment.meteorclient.systems.modules.Modules; -import meteordevelopment.meteorclient.systems.modules.movement.NoFall; import meteordevelopment.meteorclient.systems.modules.movement.NoSlow; import net.minecraft.block.BlockState; import net.minecraft.block.SlimeBlock; @@ -26,9 +25,4 @@ public class SlimeBlockMixin { private void onSteppedOn(World world, BlockPos pos, BlockState state, Entity entity, CallbackInfo info) { if (Modules.get().get(NoSlow.class).slimeBlock() && entity == mc.player) info.cancel(); } - - @Inject(method = "bounce", at = @At("HEAD"), cancellable = true) - private void onBounce(Entity entity, CallbackInfo info) { - if (Modules.get().get(NoFall.class).cancelBounce() && entity == mc.player) info.cancel(); - } } diff --git a/src/main/resources/meteor-client.mixins.json b/src/main/resources/meteor-client.mixins.json index b135698c5f..6c621a300d 100644 --- a/src/main/resources/meteor-client.mixins.json +++ b/src/main/resources/meteor-client.mixins.json @@ -16,7 +16,6 @@ "BannerBlockEntityRendererMixin", "BeaconBlockEntityRendererMixin", "BeaconScreenMixin", - "BedBlockMixin", "BiomeColorsMixin", "BlockCollisionSpliteratorMixin", "BlockEntityRenderDispatcherMixin", From 3fc3d6cff57f669d5f3672a5dc8148e1331b82a7 Mon Sep 17 00:00:00 2001 From: MineGame159 Date: Mon, 6 Feb 2023 20:20:51 +0100 Subject: [PATCH 105/135] Updated* to Sodium 0.4.9 --- gradle.properties | 2 +- .../sodium/SodiumBlockRendererMixin.java | 98 +++++-------------- .../sodium/SodiumFluidRendererMixin.java | 14 ++- 3 files changed, 29 insertions(+), 85 deletions(-) diff --git a/gradle.properties b/gradle.properties index 414487e2d3..c3a8159efa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,7 +14,7 @@ archives_base_name=meteor-client # Dependency Versions # Sodium (https://github.com/CaffeineMC/sodium-fabric) -sodium_version=mc1.19.3-0.4.6 +sodium_version=mc1.19.3-0.4.9 # Orbit (https://github.com/MeteorDevelopment/orbit) orbit_version=0.2.3 diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/sodium/SodiumBlockRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/sodium/SodiumBlockRendererMixin.java index 1cd58332be..a5922e33b6 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/sodium/SodiumBlockRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/sodium/SodiumBlockRendererMixin.java @@ -5,104 +5,50 @@ package meteordevelopment.meteorclient.mixin.sodium; -import me.jellysquid.mods.sodium.client.model.IndexBufferBuilder; -import me.jellysquid.mods.sodium.client.model.light.data.QuadLightData; -import me.jellysquid.mods.sodium.client.model.quad.ModelQuadView; -import me.jellysquid.mods.sodium.client.model.quad.blender.ColorBlender; -import me.jellysquid.mods.sodium.client.model.quad.blender.ColorSampler; -import me.jellysquid.mods.sodium.client.model.quad.properties.ModelQuadOrientation; -import me.jellysquid.mods.sodium.client.model.quad.properties.ModelQuadWinding; import me.jellysquid.mods.sodium.client.render.chunk.compile.buffers.ChunkModelBuilder; -import me.jellysquid.mods.sodium.client.render.chunk.format.ModelVertexSink; -import me.jellysquid.mods.sodium.client.render.pipeline.BlockRenderer; +import me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockRenderContext; +import me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockRenderer; import me.jellysquid.mods.sodium.client.util.color.ColorABGR; import meteordevelopment.meteorclient.systems.modules.render.Xray; -import net.minecraft.block.BlockState; -import net.minecraft.client.render.model.BakedModel; -import net.minecraft.client.render.model.BakedQuad; -import net.minecraft.client.texture.Sprite; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.BlockRenderView; -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import java.util.Arrays; + @Mixin(value = BlockRenderer.class, remap = false) public class SodiumBlockRendererMixin { - @Shadow @Final private ColorBlender colorBlender; - @Unique private final ThreadLocal alphas = new ThreadLocal<>(); + @Unique private final ThreadLocal colors = ThreadLocal.withInitial(() -> new int[4]); @Inject(method = "renderModel", at = @At("HEAD"), cancellable = true) - private void onRenderModel(BlockRenderView world, BlockState state, BlockPos pos, BlockPos origin, BakedModel model, ChunkModelBuilder buffers, boolean cull, long seed, CallbackInfoReturnable info) { - int alpha = Xray.getAlpha(state, pos); + private void onRenderModel(BlockRenderContext ctx, ChunkModelBuilder buffers, CallbackInfoReturnable info) { + int alpha = Xray.getAlpha(ctx.state(), ctx.pos()); if (alpha == 0) info.setReturnValue(false); else alphas.set(alpha); } - @Inject(method = "renderQuad", at = @At(value = "HEAD"), cancellable = true) - private void onRenderQuad(BlockRenderView world, BlockState state, BlockPos pos, BlockPos origin, ModelVertexSink vertices, IndexBufferBuilder indices, Vec3d blockOffset, ColorSampler colorSampler, BakedQuad bakedQuad, QuadLightData light, ChunkModelBuilder model, CallbackInfo info) { + // TODO: Looks like Sodium disables transparency on blocks that aren't supposed to be transparent + @ModifyVariable(method = "writeGeometry", at = @At("HEAD"), argsOnly = true, index = 6) + private int[] onWriteGeometryModifyColors(int[] colors) { int alpha = alphas.get(); - if (alpha == 0) info.cancel(); - else if (alpha != -1) { - whRenderQuad(world, state, pos, origin, vertices, indices, blockOffset, colorSampler, bakedQuad, light, model, alpha); - info.cancel(); - } - } - - // https://github.com/CaffeineMC/sodium-fabric/blob/8b3015efe85be9336a150ff7c26085ea3d2d43d0/src/main/java/me/jellysquid/mods/sodium/client/render/pipeline/BlockRenderer.java#L119 - // Copied from Sodium, for now, can't think of a better way, because of the nature of the locals, and for loop. - // Mixin seems to freak out when I try to do this the "right" way - Wala (sobbing) - @Unique - private void whRenderQuad(BlockRenderView world, BlockState state, BlockPos pos, BlockPos origin, ModelVertexSink vertices, IndexBufferBuilder indices, Vec3d blockOffset, ColorSampler colorSampler, BakedQuad bakedQuad, QuadLightData light, ChunkModelBuilder model, int alpha) { - ModelQuadView src = (ModelQuadView) bakedQuad; - ModelQuadOrientation orientation = ModelQuadOrientation.orientByBrightness(light.br); - - int[] colors = null; - - if (bakedQuad.hasColor()) { - colors = this.colorBlender.getColors(world, pos, src, colorSampler, state); - } - - int vertexStart = vertices.getVertexCount(); - - for (int i = 0; i < 4; i++) { - int j = orientation.getVertexIndex(i); - - float x = src.getX(j) + (float) blockOffset.getX(); - float y = src.getY(j) + (float) blockOffset.getY(); - float z = src.getZ(j) + (float) blockOffset.getZ(); - - int color = ColorABGR.mul(colors != null ? colors[j] : 0xFFFFFFFF, light.br[j]); - - int blue = ColorABGR.unpackBlue(color); - int green = ColorABGR.unpackGreen(color); - int red = ColorABGR.unpackRed(color); - - color = ColorABGR.pack(red, green, blue, alpha); - - float u = src.getTexU(j); - float v = src.getTexV(j); - - int lm = light.lm[j]; - - vertices.writeVertex(origin, x, y, z, color, u, v, lm, model.getChunkId()); + if (alpha != -1) { + if (colors == null) { + colors = this.colors.get(); + Arrays.fill(colors, ColorABGR.pack(255, 255, 255, alpha)); + } + else { + for (int i = 0; i < colors.length; i++) { + colors[i] = ColorABGR.withAlpha(colors[i], alpha / 255f); + } + } } - indices.add(vertexStart, ModelQuadWinding.CLOCKWISE); - - Sprite sprite = src.getSprite(); - - if (sprite != null) { - model.addSprite(sprite); - } + return colors; } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/sodium/SodiumFluidRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/sodium/SodiumFluidRendererMixin.java index d464339dd9..22a9f1bd5e 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/sodium/SodiumFluidRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/sodium/SodiumFluidRendererMixin.java @@ -9,7 +9,8 @@ import me.jellysquid.mods.sodium.client.model.quad.ModelQuadView; import me.jellysquid.mods.sodium.client.model.quad.blender.ColorSampler; import me.jellysquid.mods.sodium.client.render.chunk.compile.buffers.ChunkModelBuilder; -import me.jellysquid.mods.sodium.client.render.pipeline.FluidRenderer; +import me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.FluidRenderer; +import me.jellysquid.mods.sodium.client.util.color.ColorABGR; import me.jellysquid.mods.sodium.client.util.color.ColorARGB; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.render.Xray; @@ -47,8 +48,8 @@ private void onRender(BlockRenderView world, FluidState fluidState, BlockPos pos /** * @author Walaryne */ - @Inject(method = "calculateQuadColors", at = @At("TAIL")) - private void onCalculateQuadColors(ModelQuadView quad, BlockRenderView world, BlockPos pos, LightPipeline lighter, Direction dir, float brightness, ColorSampler colorSampler, FluidState fluidState, CallbackInfo info) { + @Inject(method = "updateQuad", at = @At("TAIL")) + private void onUpdateQuad(ModelQuadView quad, BlockRenderView world, BlockPos pos, LightPipeline lighter, Direction dir, float brightness, ColorSampler colorSampler, FluidState fluidState, CallbackInfo info) { // Ambience Ambience ambience = Modules.get().get(Ambience.class); @@ -59,11 +60,8 @@ private void onCalculateQuadColors(ModelQuadView quad, BlockRenderView world, Bl // XRay and Wallhack int alpha = alphas.get(); - if (alpha != -1) { - quadColors[0] = (alpha << 24) | (quadColors[0] & 0x00FFFFFF); - quadColors[1] = (alpha << 24) | (quadColors[1] & 0x00FFFFFF); - quadColors[2] = (alpha << 24) | (quadColors[2] & 0x00FFFFFF); - quadColors[3] = (alpha << 24) | (quadColors[3] & 0x00FFFFFF); + for (int i = 0; i < quadColors.length; i++) { + quadColors[i] = ColorABGR.withAlpha(quadColors[i], alpha / 255f); } } } From c7bdca16fb29cadd1930cb906cfa332831d58849 Mon Sep 17 00:00:00 2001 From: arlo Date: Fri, 24 Feb 2023 21:57:33 +0000 Subject: [PATCH 106/135] remove .b (baritone prefix alias) --- .../systems/commands/Commands.java | 3 +- .../commands/commands/BaritoneCommand.java | 30 ------------------- .../{FOVCommand.java => FovCommand.java} | 6 ++-- 3 files changed, 4 insertions(+), 35 deletions(-) delete mode 100644 src/main/java/meteordevelopment/meteorclient/systems/commands/commands/BaritoneCommand.java rename src/main/java/meteordevelopment/meteorclient/systems/commands/commands/{FOVCommand.java => FovCommand.java} (89%) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java index ece2f9db20..cedcfe9d15 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java @@ -40,7 +40,6 @@ public static Commands get() { @Override public void init() { - add(new BaritoneCommand()); add(new VClipCommand()); add(new HClipCommand()); add(new DismountCommand()); @@ -72,7 +71,7 @@ public void init() { add(new GiveCommand()); add(new NameHistoryCommand()); add(new BindCommand()); - add(new FOVCommand()); + add(new FovCommand()); add(new RotationCommand()); add(new WaypointCommand()); add(new InputCommand()); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/BaritoneCommand.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/BaritoneCommand.java deleted file mode 100644 index 615560e7d1..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/BaritoneCommand.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.systems.commands.commands; - -import baritone.api.BaritoneAPI; -import com.mojang.brigadier.arguments.StringArgumentType; -import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; -import net.minecraft.command.CommandSource; - -import static com.mojang.brigadier.Command.SINGLE_SUCCESS; - -public class BaritoneCommand extends Command { - public BaritoneCommand() { - super("baritone", "Executes baritone commands.", "b"); - } - - @Override - public void build(LiteralArgumentBuilder builder) { - builder.then(argument("command", StringArgumentType.greedyString()) - .executes(context -> { - String command = context.getArgument("command", String.class); - BaritoneAPI.getProvider().getPrimaryBaritone().getCommandManager().execute(command); - return SINGLE_SUCCESS; - })); - } -} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FOVCommand.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FovCommand.java similarity index 89% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FOVCommand.java rename to src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FovCommand.java index 0d7e9aeaae..f81130b4a9 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FOVCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FovCommand.java @@ -13,9 +13,9 @@ import static com.mojang.brigadier.Command.SINGLE_SUCCESS; -public class FOVCommand extends Command { - public FOVCommand() { - super("fov", "Changes your FOV."); +public class FovCommand extends Command { + public FovCommand() { + super("fov", "Changes your fov."); } @Override From 6e362ba2b93126833686e6c6ce5e6be714e55194 Mon Sep 17 00:00:00 2001 From: arlo Date: Fri, 24 Feb 2023 22:12:49 +0000 Subject: [PATCH 107/135] refactor Commands.java --- .../mixin/ChatInputSuggestorMixin.java | 19 +++---- .../systems/commands/Command.java | 4 +- .../systems/commands/Commands.java | 51 ++++++------------- .../commands/commands/CommandsCommand.java | 2 +- .../systems/modules/misc/BetterChat.java | 3 +- 5 files changed, 26 insertions(+), 53 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ChatInputSuggestorMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ChatInputSuggestorMixin.java index b4765f1e4a..517767018d 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ChatInputSuggestorMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ChatInputSuggestorMixin.java @@ -5,13 +5,11 @@ package meteordevelopment.meteorclient.mixin; -import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.ParseResults; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.suggestion.Suggestions; import meteordevelopment.meteorclient.systems.commands.Commands; import meteordevelopment.meteorclient.systems.config.Config; -import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.ChatInputSuggestor; import net.minecraft.client.gui.widget.TextFieldWidget; import net.minecraft.command.CommandSource; @@ -29,7 +27,6 @@ public abstract class ChatInputSuggestorMixin { @Shadow private ParseResults parse; @Shadow @Final TextFieldWidget textField; - @Shadow @Final MinecraftClient client; @Shadow boolean completingSuggestions; @Shadow private CompletableFuture pendingSuggestions; @Shadow private ChatInputSuggestor.SuggestionWindow window; @@ -38,30 +35,30 @@ public abstract class ChatInputSuggestorMixin { protected abstract void showCommandSuggestions(); @Inject(method = "refresh", - at = @At(value = "INVOKE", target = "Lcom/mojang/brigadier/StringReader;canRead()Z", remap = false), - cancellable = true, - locals = LocalCapture.CAPTURE_FAILHARD) + at = @At(value = "INVOKE", target = "Lcom/mojang/brigadier/StringReader;canRead()Z", remap = false), + cancellable = true, + locals = LocalCapture.CAPTURE_FAILHARD) public void onRefresh(CallbackInfo ci, String string, StringReader reader) { String prefix = Config.get().prefix.get(); int length = prefix.length(); + if (reader.canRead(length) && reader.getString().startsWith(prefix, reader.getCursor())) { reader.setCursor(reader.getCursor() + length); - assert this.client.player != null; - // Pretty much copy&paste from the refresh method - CommandDispatcher commandDispatcher = Commands.get().getDispatcher(); + if (this.parse == null) { - this.parse = commandDispatcher.parse(reader, Commands.get().getCommandSource()); + this.parse = Commands.DISPATCHER.parse(reader, Commands.COMMAND_SOURCE); } int cursor = textField.getCursor(); if (cursor >= 1 && (this.window == null || !this.completingSuggestions)) { - this.pendingSuggestions = commandDispatcher.getCompletionSuggestions(this.parse, cursor); + this.pendingSuggestions = Commands.DISPATCHER.getCompletionSuggestions(this.parse, cursor); this.pendingSuggestions.thenRun(() -> { if (this.pendingSuggestions.isDone()) { this.showCommandSuggestions(); } }); } + ci.cancel(); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/Command.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/Command.java index f5ccd15a18..973f001c74 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/Command.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/Command.java @@ -76,9 +76,7 @@ public String toString() { public String toString(String... args) { StringBuilder base = new StringBuilder(toString()); - for (String arg : args) - base.append(' ').append(arg); - + for (String arg : args) base.append(' ').append(arg); return base.toString(); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java index cedcfe9d15..fa1a1ecd5f 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java @@ -11,7 +11,6 @@ import meteordevelopment.meteorclient.systems.System; import meteordevelopment.meteorclient.systems.Systems; import meteordevelopment.meteorclient.systems.commands.commands.*; -import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientCommandSource; import net.minecraft.command.CommandRegistryAccess; import net.minecraft.command.CommandSource; @@ -25,10 +24,10 @@ public class Commands extends System { public static final CommandRegistryAccess REGISTRY_ACCESS = CommandManager.createRegistryAccess(BuiltinRegistries.createWrapperLookup()); - private final CommandDispatcher DISPATCHER = new CommandDispatcher<>(); - private final CommandSource COMMAND_SOURCE = new ChatCommandSource(mc); + public static final CommandDispatcher DISPATCHER = new CommandDispatcher<>(); + public static final CommandSource COMMAND_SOURCE = new ClientCommandSource(null, mc); + private final List commands = new ArrayList<>(); - private final Map, Command> commandInstances = new HashMap<>(); public Commands() { super(null); @@ -79,48 +78,28 @@ public void init() { commands.sort(Comparator.comparing(Command::getName)); } - public void dispatch(String message) throws CommandSyntaxException { - dispatch(message, new ChatCommandSource(mc)); - } - - public void dispatch(String message, CommandSource source) throws CommandSyntaxException { - ParseResults results = DISPATCHER.parse(message, source); - DISPATCHER.execute(results); - } - - public CommandDispatcher getDispatcher() { - return DISPATCHER; - } - - public CommandSource getCommandSource() { - return COMMAND_SOURCE; - } - - private final static class ChatCommandSource extends ClientCommandSource { - public ChatCommandSource(MinecraftClient client) { - super(null, client); - } - } - public void add(Command command) { - commands.removeIf(command1 -> command1.getName().equals(command.getName())); - commandInstances.values().removeIf(command1 -> command1.getName().equals(command.getName())); - + commands.removeIf(existing -> existing.getName().equals(command.getName())); command.registerTo(DISPATCHER); commands.add(command); - commandInstances.put(command.getClass(), command); } - public int getCount() { - return commands.size(); + public void dispatch(String message) throws CommandSyntaxException { + ParseResults results = DISPATCHER.parse(message, COMMAND_SOURCE); + DISPATCHER.execute(results); } public List getAll() { return commands; } - @SuppressWarnings("unchecked") - public T get(Class klass) { - return (T) commandInstances.get(klass); + public Command get(String name) { + for (Command command : commands) { + if (command.getName().equals(name)) { + return command; + } + } + + return null; } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/CommandsCommand.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/CommandsCommand.java index 63d95d192d..a93628e9df 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/CommandsCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/CommandsCommand.java @@ -28,7 +28,7 @@ public CommandsCommand() { @Override public void build(LiteralArgumentBuilder builder) { builder.executes(context -> { - ChatUtils.info("--- Commands ((highlight)%d(default)) ---", Commands.get().getCount()); + ChatUtils.info("--- Commands ((highlight)%d(default)) ---", Commands.get().getAll().size()); MutableText commands = Text.literal(""); Commands.get().getAll().forEach(command -> commands.append(getCommandText(command))); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterChat.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterChat.java index 16e4949838..a4f2449bdb 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterChat.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterChat.java @@ -12,7 +12,6 @@ import meteordevelopment.meteorclient.mixin.ChatHudAccessor; import meteordevelopment.meteorclient.settings.*; import meteordevelopment.meteorclient.systems.commands.Commands; -import meteordevelopment.meteorclient.systems.commands.commands.SayCommand; import meteordevelopment.meteorclient.systems.modules.Categories; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.utils.Utils; @@ -415,7 +414,7 @@ private MutableText getSendButton(String message) { .withFormatting(Formatting.DARK_RED) .withClickEvent(new ClickEvent( ClickEvent.Action.RUN_COMMAND, - Commands.get().get(SayCommand.class).toString(message) + Commands.get().get("say").toString(message) )) .withHoverEvent(new HoverEvent( HoverEvent.Action.SHOW_TEXT, From c60f9bae7bd0ef42fe3f457fe107086adbef9bbc Mon Sep 17 00:00:00 2001 From: MineGame159 Date: Fri, 24 Feb 2023 23:15:31 +0100 Subject: [PATCH 108/135] Revert "remove .b (baritone prefix alias)" This reverts commit c7bdca16fb29cadd1930cb906cfa332831d58849. --- .../systems/commands/Commands.java | 3 +- .../commands/commands/BaritoneCommand.java | 30 +++++++++++++++++++ .../{FovCommand.java => FOVCommand.java} | 6 ++-- 3 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 src/main/java/meteordevelopment/meteorclient/systems/commands/commands/BaritoneCommand.java rename src/main/java/meteordevelopment/meteorclient/systems/commands/commands/{FovCommand.java => FOVCommand.java} (89%) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java index fa1a1ecd5f..79270dc3ac 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java @@ -39,6 +39,7 @@ public static Commands get() { @Override public void init() { + add(new BaritoneCommand()); add(new VClipCommand()); add(new HClipCommand()); add(new DismountCommand()); @@ -70,7 +71,7 @@ public void init() { add(new GiveCommand()); add(new NameHistoryCommand()); add(new BindCommand()); - add(new FovCommand()); + add(new FOVCommand()); add(new RotationCommand()); add(new WaypointCommand()); add(new InputCommand()); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/BaritoneCommand.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/BaritoneCommand.java new file mode 100644 index 0000000000..615560e7d1 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/BaritoneCommand.java @@ -0,0 +1,30 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.systems.commands.commands; + +import baritone.api.BaritoneAPI; +import com.mojang.brigadier.arguments.StringArgumentType; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import meteordevelopment.meteorclient.systems.commands.Command; +import net.minecraft.command.CommandSource; + +import static com.mojang.brigadier.Command.SINGLE_SUCCESS; + +public class BaritoneCommand extends Command { + public BaritoneCommand() { + super("baritone", "Executes baritone commands.", "b"); + } + + @Override + public void build(LiteralArgumentBuilder builder) { + builder.then(argument("command", StringArgumentType.greedyString()) + .executes(context -> { + String command = context.getArgument("command", String.class); + BaritoneAPI.getProvider().getPrimaryBaritone().getCommandManager().execute(command); + return SINGLE_SUCCESS; + })); + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FovCommand.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FOVCommand.java similarity index 89% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FovCommand.java rename to src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FOVCommand.java index f81130b4a9..0d7e9aeaae 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FovCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FOVCommand.java @@ -13,9 +13,9 @@ import static com.mojang.brigadier.Command.SINGLE_SUCCESS; -public class FovCommand extends Command { - public FovCommand() { - super("fov", "Changes your fov."); +public class FOVCommand extends Command { + public FOVCommand() { + super("fov", "Changes your FOV."); } @Override From 1020ff838daf7a209ff5a6dbe55fb059c0159758 Mon Sep 17 00:00:00 2001 From: arlo Date: Fri, 24 Feb 2023 22:16:34 +0000 Subject: [PATCH 109/135] Revert "Revert "remove .b (baritone prefix alias)"" This reverts commit c60f9bae7bd0ef42fe3f457fe107086adbef9bbc. --- .../systems/commands/Commands.java | 3 +- .../commands/commands/BaritoneCommand.java | 30 ------------------- .../{FOVCommand.java => FovCommand.java} | 6 ++-- 3 files changed, 4 insertions(+), 35 deletions(-) delete mode 100644 src/main/java/meteordevelopment/meteorclient/systems/commands/commands/BaritoneCommand.java rename src/main/java/meteordevelopment/meteorclient/systems/commands/commands/{FOVCommand.java => FovCommand.java} (89%) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java index 79270dc3ac..fa1a1ecd5f 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java @@ -39,7 +39,6 @@ public static Commands get() { @Override public void init() { - add(new BaritoneCommand()); add(new VClipCommand()); add(new HClipCommand()); add(new DismountCommand()); @@ -71,7 +70,7 @@ public void init() { add(new GiveCommand()); add(new NameHistoryCommand()); add(new BindCommand()); - add(new FOVCommand()); + add(new FovCommand()); add(new RotationCommand()); add(new WaypointCommand()); add(new InputCommand()); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/BaritoneCommand.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/BaritoneCommand.java deleted file mode 100644 index 615560e7d1..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/BaritoneCommand.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.systems.commands.commands; - -import baritone.api.BaritoneAPI; -import com.mojang.brigadier.arguments.StringArgumentType; -import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import meteordevelopment.meteorclient.systems.commands.Command; -import net.minecraft.command.CommandSource; - -import static com.mojang.brigadier.Command.SINGLE_SUCCESS; - -public class BaritoneCommand extends Command { - public BaritoneCommand() { - super("baritone", "Executes baritone commands.", "b"); - } - - @Override - public void build(LiteralArgumentBuilder builder) { - builder.then(argument("command", StringArgumentType.greedyString()) - .executes(context -> { - String command = context.getArgument("command", String.class); - BaritoneAPI.getProvider().getPrimaryBaritone().getCommandManager().execute(command); - return SINGLE_SUCCESS; - })); - } -} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FOVCommand.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FovCommand.java similarity index 89% rename from src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FOVCommand.java rename to src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FovCommand.java index 0d7e9aeaae..f81130b4a9 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FOVCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/FovCommand.java @@ -13,9 +13,9 @@ import static com.mojang.brigadier.Command.SINGLE_SUCCESS; -public class FOVCommand extends Command { - public FOVCommand() { - super("fov", "Changes your FOV."); +public class FovCommand extends Command { + public FovCommand() { + super("fov", "Changes your fov."); } @Override From f3d490e44299bb19beb8a1a7321d319b4a12fbd1 Mon Sep 17 00:00:00 2001 From: Wide-Cat Date: Sat, 4 Mar 2023 13:59:15 +0000 Subject: [PATCH 110/135] fix RUN_COMMAND click actions not working --- .../meteorclient/mixin/ScreenMixin.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ScreenMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ScreenMixin.java index 28338fadf9..dd3042c8fc 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ScreenMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ScreenMixin.java @@ -5,6 +5,9 @@ package meteordevelopment.meteorclient.mixin; +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import meteordevelopment.meteorclient.systems.commands.Commands; +import meteordevelopment.meteorclient.systems.config.Config; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.render.NoRender; import meteordevelopment.meteorclient.utils.Utils; @@ -12,15 +15,17 @@ import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.tooltip.TooltipComponent; import net.minecraft.client.item.TooltipData; +import net.minecraft.text.Style; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import java.util.List; -@Mixin(Screen.class) +@Mixin(value = Screen.class, priority = 500) // needs to be before baritone public abstract class ScreenMixin { @Inject(method = "renderBackground(Lnet/minecraft/client/util/math/MatrixStack;)V", at = @At("HEAD"), cancellable = true) private void onRenderBackground(CallbackInfo info) { @@ -35,4 +40,18 @@ private static void onComponentConstruct(List list, TooltipDat info.cancel(); } } + + @Inject(method = "handleTextClick", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;)V", ordinal = 1, remap = false), cancellable = true) + private void onRunCommand(Style style, CallbackInfoReturnable cir) { + if (style.getClickEvent().getValue().startsWith(Config.get().prefix.get())) { + try { + Commands.get().dispatch(style.getClickEvent().getValue().substring(Config.get().prefix.get().length())); + + cir.setReturnValue(true); + cir.cancel(); + } catch (CommandSyntaxException e) { + e.printStackTrace(); + } + } + } } From 3c89088e0793cb0c5085fcec5a1a9eb7b1d6cb69 Mon Sep 17 00:00:00 2001 From: DAM Date: Sat, 4 Mar 2023 21:22:36 +0100 Subject: [PATCH 111/135] PaperClip implementation into vclip PaperClip implementation of "PaperClip" aka "TPX" aka "VaultClip" into vclip Allows you to teleport up to 200 blocks in one go (as you can send 20 move packets per tick) Paper allows you to teleport 10 blocks for each move packet you send in that tick Video explanation by LiveOverflow: https://www.youtube.com/watch?v=3HSnDsfkJT8 --- .../commands/commands/VClipCommand.java | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/VClipCommand.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/VClipCommand.java index e6f914ce96..11aac18a13 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/VClipCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/VClipCommand.java @@ -10,7 +10,8 @@ import meteordevelopment.meteorclient.systems.commands.Command; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.command.CommandSource; -import net.minecraft.entity.Entity; +import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; +import net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; @@ -22,15 +23,33 @@ public VClipCommand() { @Override public void build(LiteralArgumentBuilder builder) { builder.then(argument("blocks", DoubleArgumentType.doubleArg()).executes(context -> { - ClientPlayerEntity player = mc.player; - assert player != null; double blocks = context.getArgument("blocks", Double.class); - if (player.hasVehicle()) { - Entity vehicle = player.getVehicle(); - vehicle.setPosition(vehicle.getX(), vehicle.getY() + blocks, vehicle.getZ()); + + // Implementation of "PaperClip" aka "TPX" aka "VaultClip" into vclip + // Allows you to teleport up to 200 blocks in one go (as you can send 20 move packets per tick) + // Paper allows you to teleport 10 blocks for each move packet you send in that tick + // Video explanation by LiveOverflow: https://www.youtube.com/watch?v=3HSnDsfkJT8 + int packetsRequired = (int) Math.ceil(blocks / 10); + if (mc.player.hasVehicle()) { + // Vehicle version + // For each 10 blocks, send a vehicle move packet with no delta + for (int packetNumber = 0; packetNumber < (packetsRequired - 1); packetNumber++) { + mc.player.networkHandler.sendPacket(new VehicleMoveC2SPacket(mc.player.getVehicle())); + } + // Now send the final vehicle move packet + mc.player.getVehicle().setPosition(mc.player.getVehicle().getX(), mc.player.getVehicle().getY() + blocks, mc.player.getVehicle().getZ()); + mc.player.networkHandler.sendPacket(new VehicleMoveC2SPacket(mc.player.getVehicle())); + } else { + // No vehicle version + // For each 10 blocks, send a player move packet with no delta + for (int packetNumber = 0; packetNumber < (packetsRequired - 1); packetNumber++) { + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(true)); + } + // Now send the final player move packet + mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + blocks, mc.player.getZ(), true)); + mc.player.setPosition(mc.player.getX(), mc.player.getY() + blocks, mc.player.getZ()); } - player.setPosition(player.getX(), player.getY() + blocks, player.getZ()); return SINGLE_SUCCESS; })); From fa287c2aedb7b590404f5dda5a36aac379b8b34f Mon Sep 17 00:00:00 2001 From: DAM Date: Sat, 4 Mar 2023 21:29:54 +0100 Subject: [PATCH 112/135] Added item damage indicator to WItem --- .../java/meteordevelopment/meteorclient/gui/widgets/WItem.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/meteordevelopment/meteorclient/gui/widgets/WItem.java b/src/main/java/meteordevelopment/meteorclient/gui/widgets/WItem.java index e003fc4b0e..88c1aff673 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/widgets/WItem.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/widgets/WItem.java @@ -40,6 +40,7 @@ protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, doub matrices.translate(x / s, y / s, 0); mc.getItemRenderer().renderGuiItemIcon(itemStack, 0, 0); + mc.getItemRenderer().renderGuiItemOverlay(mc.textRenderer, itemStack, 0, 0); matrices.pop(); }); From fb0fe6e0b51f8f8698cda1327cd101d3f4a6cbf7 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Thu, 26 Jan 2023 15:09:42 +0800 Subject: [PATCH 113/135] Active checkbox changes on toggle event fixes #3223 --- .../meteorclient/gui/screens/ModuleScreen.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/gui/screens/ModuleScreen.java b/src/main/java/meteordevelopment/meteorclient/gui/screens/ModuleScreen.java index d42a2f98ad..8beaac7239 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/screens/ModuleScreen.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/screens/ModuleScreen.java @@ -5,6 +5,7 @@ package meteordevelopment.meteorclient.gui.screens; +import meteordevelopment.meteorclient.events.meteor.ActiveModulesChangedEvent; import meteordevelopment.meteorclient.events.meteor.ModuleBindChangedEvent; import meteordevelopment.meteorclient.gui.GuiTheme; import meteordevelopment.meteorclient.gui.WindowScreen; @@ -31,6 +32,7 @@ public class ModuleScreen extends WindowScreen { private WContainer settingsContainer; private WKeybind keybind; + private WCheckbox active; public ModuleScreen(GuiTheme theme, Module module) { super(theme, theme.favorite(module.favorite), module.title); @@ -93,7 +95,7 @@ public void initWidgets() { // Active bottom.add(theme.label("Active: ")); - WCheckbox active = bottom.add(theme.checkbox(module.isActive())).expandCellX().widget(); + active = bottom.add(theme.checkbox(module.isActive())).expandCellX().widget(); active.action = () -> { if (module.isActive() != active.checked) module.toggle(); }; @@ -116,6 +118,11 @@ private void onModuleBindChanged(ModuleBindChangedEvent event) { keybind.reset(); } + @EventHandler + private void onActiveModulesChanged(ActiveModulesChangedEvent event) { + this.active.checked = Modules.get().getActive().contains(module); + } + @Override public boolean toClipboard() { return NbtUtils.toClipboard(module.title, module.toTag()); From 695ff5a2dfd991fdc2efc207486ff77f9c1fbd99 Mon Sep 17 00:00:00 2001 From: ThebestkillerTBK <2593828650@qq.com> Date: Sat, 4 Feb 2023 01:27:52 +0800 Subject: [PATCH 114/135] oke --- .../meteorclient/gui/screens/ModuleScreen.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/gui/screens/ModuleScreen.java b/src/main/java/meteordevelopment/meteorclient/gui/screens/ModuleScreen.java index 8beaac7239..22e14a8596 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/screens/ModuleScreen.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/screens/ModuleScreen.java @@ -120,7 +120,7 @@ private void onModuleBindChanged(ModuleBindChangedEvent event) { @EventHandler private void onActiveModulesChanged(ActiveModulesChangedEvent event) { - this.active.checked = Modules.get().getActive().contains(module); + this.active.checked = module.isActive(); } @Override From bbdf93c3a9f891933b047da5d78d49d3be5c84ad Mon Sep 17 00:00:00 2001 From: DesiCow Date: Mon, 13 Feb 2023 19:56:51 +0530 Subject: [PATCH 115/135] Added .ender-chest command Allows users to preview memory of their Ender chest. --- .../systems/commands/Commands.java | 1 + .../commands/commands/EnderChestCommand.java | 29 +++++++++++++++++++ .../commands/commands/MacroCommand.java | 2 +- .../systems/modules/render/ItemHighlight.java | 2 +- .../meteorclient/utils/render/PeekScreen.java | 4 +-- 5 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 src/main/java/meteordevelopment/meteorclient/systems/commands/commands/EnderChestCommand.java diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java index fa1a1ecd5f..95673f1576 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/Commands.java @@ -53,6 +53,7 @@ public void init() { add(new NbtCommand()); add(new NotebotCommand()); add(new PeekCommand()); + add(new EnderChestCommand()); add(new ProfilesCommand()); add(new ReloadCommand()); add(new ResetCommand()); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/EnderChestCommand.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/EnderChestCommand.java new file mode 100644 index 0000000000..7736d9a998 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/EnderChestCommand.java @@ -0,0 +1,29 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.systems.commands.commands; + +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import meteordevelopment.meteorclient.systems.commands.Command; +import meteordevelopment.meteorclient.utils.Utils; +import net.minecraft.command.CommandSource; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; + +import static com.mojang.brigadier.Command.SINGLE_SUCCESS; + +public class EnderChestCommand extends Command { + public EnderChestCommand() { + super("ender-chest", "Allows you to preview memory of your ender chest.", "ec", "echest"); + } + + @Override + public void build(LiteralArgumentBuilder builder) { + builder.executes(context -> { + Utils.openContainer(Items.ENDER_CHEST.getDefaultStack(), new ItemStack[27], true); + return SINGLE_SUCCESS; + }); + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/MacroCommand.java b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/MacroCommand.java index 4dfb782567..5a97a302e9 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/MacroCommand.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/commands/commands/MacroCommand.java @@ -23,7 +23,7 @@ public void build(LiteralArgumentBuilder builder) { builder.then( argument("macro", MacroArgumentType.create()) .executes(context -> { - Macro macro = context.getArgument("macro", Macro.class); + Macro macro = MacroArgumentType.get(context); macro.onAction(); return SINGLE_SUCCESS; })); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/ItemHighlight.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/ItemHighlight.java index d8b62961bf..617efca004 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/ItemHighlight.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/ItemHighlight.java @@ -38,7 +38,7 @@ public ItemHighlight() { } public int getColor(ItemStack stack) { - if (items.get().contains(stack.getItem()) && isActive()) return color.get().getPacked(); + if (stack != null && items.get().contains(stack.getItem()) && isActive()) return color.get().getPacked(); return -1; } } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/render/PeekScreen.java b/src/main/java/meteordevelopment/meteorclient/utils/render/PeekScreen.java index 1227b2e97d..71d7f72070 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/render/PeekScreen.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/render/PeekScreen.java @@ -34,9 +34,9 @@ public PeekScreen(ItemStack storageBlock, ItemStack[] contents) { @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { - BetterTooltips toolips = Modules.get().get(BetterTooltips.class); + BetterTooltips tooltips = Modules.get().get(BetterTooltips.class); - if (button == GLFW.GLFW_MOUSE_BUTTON_MIDDLE && focusedSlot != null && !focusedSlot.getStack().isEmpty() && mc.player.currentScreenHandler.getCursorStack().isEmpty() && toolips.middleClickOpen()) { + if (button == GLFW.GLFW_MOUSE_BUTTON_MIDDLE && focusedSlot != null && !focusedSlot.getStack().isEmpty() && mc.player.currentScreenHandler.getCursorStack().isEmpty() && tooltips.middleClickOpen()) { return Utils.openContainer(focusedSlot.getStack(), contents, false); } return false; From d9e1be831e857cbd889ef5a38aaacef4d61764c1 Mon Sep 17 00:00:00 2001 From: DesiCow Date: Sun, 19 Feb 2023 23:08:34 +0530 Subject: [PATCH 116/135] Stash finder count Displays found stashes count on Active Modules hud --- .../meteorclient/systems/modules/world/StashFinder.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/StashFinder.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/StashFinder.java index 373c5111b9..5c8ae85e55 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/StashFinder.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/StashFinder.java @@ -270,6 +270,11 @@ private File getCsvFile() { return new File(new File(new File(MeteorClient.FOLDER, "stashes"), Utils.getFileWorldName()), "stashes.csv"); } + @Override + public String getInfoString() { + return String.valueOf(chunks.size()); + } + public enum Mode { Chat, Toast, From 8984b29399156a8a856063cdbf0c3be2b22ffd17 Mon Sep 17 00:00:00 2001 From: Damian <43420467+DAMcraft@users.noreply.github.com> Date: Tue, 7 Mar 2023 20:03:12 +0100 Subject: [PATCH 117/135] Removed duplicate module getting --- src/main/java/meteordevelopment/meteorclient/utils/Utils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/utils/Utils.java b/src/main/java/meteordevelopment/meteorclient/utils/Utils.java index 66f4a7487c..910d436c84 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/Utils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/Utils.java @@ -95,7 +95,7 @@ public static double getPlayerSpeed() { double length = Math.sqrt(tX * tX + tZ * tZ); Timer timer = Modules.get().get(Timer.class); - if (timer.isActive()) length *= Modules.get().get(Timer.class).getMultiplier(); + if (timer.isActive()) length *= timer.getMultiplier(); return length * 20; } From f63d9ee85097bb473ec0b7d08748372e78b4bfe5 Mon Sep 17 00:00:00 2001 From: Wide-Cat Date: Fri, 10 Mar 2023 23:13:17 +0000 Subject: [PATCH 118/135] fixed getting an invalid signature error after logging into a new ms account --- .../mixin/MinecraftClientAccessor.java | 16 ++++++++++++++++ .../meteorclient/systems/accounts/Account.java | 16 +++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/MinecraftClientAccessor.java b/src/main/java/meteordevelopment/meteorclient/mixin/MinecraftClientAccessor.java index af8f4cd401..66a3b79381 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/MinecraftClientAccessor.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/MinecraftClientAccessor.java @@ -5,8 +5,10 @@ package meteordevelopment.meteorclient.mixin; +import com.mojang.authlib.minecraft.UserApiService; import net.minecraft.client.MinecraftClient; import net.minecraft.client.resource.ResourceReloadLogger; +import net.minecraft.client.util.ProfileKeys; import net.minecraft.client.util.Session; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mutable; @@ -40,4 +42,18 @@ static int getFps() { @Invoker("doAttack") boolean leftClick(); + + @Mutable + @Accessor("profileKeys") + void setProfileKeys(ProfileKeys keys); + + @Accessor("userApiService") + UserApiService getUserApiService(); + + @Mutable + @Accessor + void setUserApiService(UserApiService apiService); + + @Accessor("session") + Session getSession(); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/accounts/Account.java b/src/main/java/meteordevelopment/meteorclient/systems/accounts/Account.java index 5e202bb564..9e840b28f9 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/accounts/Account.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/accounts/Account.java @@ -5,11 +5,15 @@ package meteordevelopment.meteorclient.systems.accounts; +import com.mojang.authlib.exceptions.AuthenticationException; import com.mojang.authlib.yggdrasil.YggdrasilEnvironment; import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService; +import com.mojang.authlib.yggdrasil.YggdrasilUserApiService; +import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.mixin.MinecraftClientAccessor; import meteordevelopment.meteorclient.utils.misc.ISerializable; import meteordevelopment.meteorclient.utils.misc.NbtException; +import net.minecraft.client.util.ProfileKeys; import net.minecraft.client.util.Session; import net.minecraft.nbt.NbtCompound; @@ -52,8 +56,18 @@ public AccountCache getCache() { } protected void setSession(Session session) { - ((MinecraftClientAccessor) mc).setSession(session); + MinecraftClientAccessor mca = (MinecraftClientAccessor) mc; + + mca.setSession(session); mc.getSessionProperties().clear(); + + try { + mca.setUserApiService(new YggdrasilUserApiService(mca.getSession().getAccessToken(), mc.getNetworkProxy(), YggdrasilEnvironment.PROD.getEnvironment())); + mca.setProfileKeys(ProfileKeys.create(mca.getUserApiService(), mca.getSession(), mc.runDirectory.toPath())); + } catch (AuthenticationException e) { + e.printStackTrace(); + MeteorClient.LOG.error("Failed to log into the new account. Try again, or restart your game."); + } } @Override From b4278c0cc512ea92b78861d15b31136bcebd85b0 Mon Sep 17 00:00:00 2001 From: MineGame159 Date: Wed, 15 Mar 2023 14:28:42 +0100 Subject: [PATCH 119/135] Fixed StorageESP and Sodium compatibility --- .../mixin/sodium/MeshVertexConsumerMixin.java | 35 +++++++++++++++++++ .../render/MeshVertexConsumerProvider.java | 2 +- .../meteor-client-sodium.mixins.json | 3 +- 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/sodium/MeshVertexConsumerMixin.java diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/sodium/MeshVertexConsumerMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/sodium/MeshVertexConsumerMixin.java new file mode 100644 index 0000000000..7c361703a2 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/sodium/MeshVertexConsumerMixin.java @@ -0,0 +1,35 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin.sodium; + +import me.jellysquid.mods.sodium.client.render.vertex.VertexBufferWriter; +import me.jellysquid.mods.sodium.client.render.vertex.VertexFormatDescription; +import me.jellysquid.mods.sodium.client.render.vertex.transform.CommonVertexElement; +import meteordevelopment.meteorclient.utils.render.MeshVertexConsumerProvider; +import net.minecraft.client.render.VertexConsumer; +import org.lwjgl.system.MemoryStack; +import org.lwjgl.system.MemoryUtil; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(value = MeshVertexConsumerProvider.MeshVertexConsumer.class, remap = false) +public abstract class MeshVertexConsumerMixin implements VertexConsumer, VertexBufferWriter { + @Override + public void push(MemoryStack stack, long ptr, int count, VertexFormatDescription format) { + int positionOffset = format.elementOffsets[CommonVertexElement.POSITION.ordinal()]; + if (positionOffset == -1) return; + + for (int i = 0; i < count; i++) { + long positionPtr = ptr + (long) format.stride * i + positionOffset; + + float x = MemoryUtil.memGetFloat(positionPtr); + float y = MemoryUtil.memGetFloat(positionPtr + 4); + float z = MemoryUtil.memGetFloat(positionPtr + 8); + + vertex(x, y, z); + next(); + } + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/utils/render/MeshVertexConsumerProvider.java b/src/main/java/meteordevelopment/meteorclient/utils/render/MeshVertexConsumerProvider.java index d550c084f4..fec0384191 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/render/MeshVertexConsumerProvider.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/render/MeshVertexConsumerProvider.java @@ -31,7 +31,7 @@ public void setOffset(double offsetX, double offsetY, double offsetZ) { vertexConsumer.setOffset(offsetX, offsetY, offsetZ); } - private static class MeshVertexConsumer implements VertexConsumer { + public static class MeshVertexConsumer implements VertexConsumer { private final Mesh mesh; private double offsetX, offsetY, offsetZ; diff --git a/src/main/resources/meteor-client-sodium.mixins.json b/src/main/resources/meteor-client-sodium.mixins.json index 977bc715f4..cb45f45d3d 100644 --- a/src/main/resources/meteor-client-sodium.mixins.json +++ b/src/main/resources/meteor-client-sodium.mixins.json @@ -7,7 +7,8 @@ "LightDataAccessMixin", "SodiumBlockOcculsionCacheMixin", "SodiumBlockRendererMixin", - "SodiumFluidRendererMixin" + "SodiumFluidRendererMixin", + "MeshVertexConsumerMixin" ], "injectors": { "defaultRequire": 1 From 0f6ed01a695aaae7ae4ad45902074e09ed4e610f Mon Sep 17 00:00:00 2001 From: Wide-Cat <74723656+Wide-Cat@users.noreply.github.com> Date: Thu, 16 Mar 2023 12:29:00 +0000 Subject: [PATCH 120/135] fix infinite chatbox (#3440) --- .../mixin/ClientPlayNetworkHandlerMixin.java | 2 +- .../meteorclient/mixin/StringHelperMixin.java | 22 +++++++++++++++++++ src/main/resources/meteor-client.mixins.json | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/StringHelperMixin.java diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayNetworkHandlerMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayNetworkHandlerMixin.java index 1883835fd5..a3927cd858 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayNetworkHandlerMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayNetworkHandlerMixin.java @@ -149,7 +149,7 @@ private void onSendChatMessage(String message, CallbackInfo ci) { ChatUtils.error(e.getMessage()); } - client.inGameHud.getChatHud().addToMessageHistory(message); + client.inGameHud.getChatHud().addToMessageHistory(message); ci.cancel(); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/StringHelperMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/StringHelperMixin.java new file mode 100644 index 0000000000..f4daffb9a7 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/StringHelperMixin.java @@ -0,0 +1,22 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import meteordevelopment.meteorclient.systems.modules.Modules; +import meteordevelopment.meteorclient.systems.modules.misc.BetterChat; +import net.minecraft.util.StringHelper; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyArg; + +@Mixin(StringHelper.class) +public class StringHelperMixin { + + @ModifyArg(method = "truncateChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/StringHelper;truncate(Ljava/lang/String;IZ)Ljava/lang/String;"), index = 1) + private static int injected(int maxLength) { // this method is only used in one place, to truncate chat messages, so it's fine to do this + return (Modules.get().get(BetterChat.class).isInfiniteChatBox() ? Integer.MAX_VALUE : maxLength); + } +} diff --git a/src/main/resources/meteor-client.mixins.json b/src/main/resources/meteor-client.mixins.json index 6c621a300d..d6e509064c 100644 --- a/src/main/resources/meteor-client.mixins.json +++ b/src/main/resources/meteor-client.mixins.json @@ -149,6 +149,7 @@ "SplashTextResourceSupplierMixin", "StatusEffectInstanceAccessor", "StatusEffectInstanceMixin", + "StringHelperMixin", "SweetBerryBushBlockMixin", "TextHandlerAccessor", "TextRendererMixin", From 82b5ab3ca0062a6af2d7758a3e40825d8c6a9919 Mon Sep 17 00:00:00 2001 From: Soda5601 <62250232+Soda5601@users.noreply.github.com> Date: Sat, 11 Mar 2023 20:47:15 +0800 Subject: [PATCH 121/135] fix typo --- .../meteorclient/systems/modules/render/Tracers.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Tracers.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Tracers.java index 7313e9c492..91eb51e149 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Tracers.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/Tracers.java @@ -32,7 +32,7 @@ public class Tracers extends Module { // General private final Setting>> entities = sgGeneral.add(new EntityTypeListSetting.Builder() - .name("entites") + .name("entities") .description("Select specific entities.") .defaultValue(EntityType.PLAYER) .build() From c74ecf5d60fc08f9492a6849733b425dd829c082 Mon Sep 17 00:00:00 2001 From: Soda5601 <62250232+Soda5601@users.noreply.github.com> Date: Thu, 16 Mar 2023 20:40:57 +0800 Subject: [PATCH 122/135] Fix and improve Alts (#3435) --- .../mixin/MinecraftClientAccessor.java | 35 +++++++++++++-- .../mixin/PlayerSkinProviderAccessor.java | 18 ++++++++ ...drasilMinecraftSessionServiceAccessor.java | 20 +++++++++ .../systems/accounts/Account.java | 42 +++++++++++------- .../systems/accounts/AccountUtils.java | 44 ------------------- .../accounts/types/CrackedAccount.java | 3 +- .../accounts/types/TheAlteningAccount.java | 16 +++---- src/main/resources/meteor-client.mixins.json | 4 +- 8 files changed, 106 insertions(+), 76 deletions(-) create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/PlayerSkinProviderAccessor.java create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/YggdrasilMinecraftSessionServiceAccessor.java delete mode 100644 src/main/java/meteordevelopment/meteorclient/systems/accounts/AccountUtils.java diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/MinecraftClientAccessor.java b/src/main/java/meteordevelopment/meteorclient/mixin/MinecraftClientAccessor.java index 66a3b79381..b4929a7ff1 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/MinecraftClientAccessor.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/MinecraftClientAccessor.java @@ -5,11 +5,17 @@ package meteordevelopment.meteorclient.mixin; +import com.mojang.authlib.minecraft.MinecraftSessionService; import com.mojang.authlib.minecraft.UserApiService; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.SocialInteractionsManager; +import net.minecraft.client.report.AbuseReportContext; import net.minecraft.client.resource.ResourceReloadLogger; +import net.minecraft.client.texture.PlayerSkinProvider; import net.minecraft.client.util.ProfileKeys; import net.minecraft.client.util.Session; +import net.minecraft.network.encryption.SignatureVerifier; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mutable; import org.spongepowered.asm.mixin.gen.Accessor; @@ -47,13 +53,34 @@ static int getFps() { @Accessor("profileKeys") void setProfileKeys(ProfileKeys keys); - @Accessor("userApiService") - UserApiService getUserApiService(); + @Accessor("authenticationService") + YggdrasilAuthenticationService getAuthenticationService(); @Mutable @Accessor void setUserApiService(UserApiService apiService); - @Accessor("session") - Session getSession(); + @Mutable + @Accessor("sessionService") + void setSessionService(MinecraftSessionService sessionService); + + @Mutable + @Accessor("authenticationService") + void setAuthenticationService(YggdrasilAuthenticationService authenticationService); + + @Mutable + @Accessor("servicesSignatureVerifier") + void setServicesSignatureVerifier(SignatureVerifier servicesSignatureVerifier); + + @Mutable + @Accessor("skinProvider") + void setSkinProvider(PlayerSkinProvider skinProvider); + + @Mutable + @Accessor("socialInteractionsManager") + void setSocialInteractionsManager(SocialInteractionsManager socialInteractionsManager); + + @Mutable + @Accessor("abuseReportContext") + void setAbuseReportContext(AbuseReportContext abuseReportContext); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerSkinProviderAccessor.java b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerSkinProviderAccessor.java new file mode 100644 index 0000000000..5f2dc2f56e --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerSkinProviderAccessor.java @@ -0,0 +1,18 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import net.minecraft.client.texture.PlayerSkinProvider; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +import java.io.File; + +@Mixin(PlayerSkinProvider.class) +public interface PlayerSkinProviderAccessor { + @Accessor("skinCacheDir") + File getSkinCacheDir(); +} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/YggdrasilMinecraftSessionServiceAccessor.java b/src/main/java/meteordevelopment/meteorclient/mixin/YggdrasilMinecraftSessionServiceAccessor.java new file mode 100644 index 0000000000..36dc719950 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/YggdrasilMinecraftSessionServiceAccessor.java @@ -0,0 +1,20 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin; + +import com.mojang.authlib.Environment; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; +import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Invoker; + +@Mixin(YggdrasilMinecraftSessionService.class) +public interface YggdrasilMinecraftSessionServiceAccessor { + @Invoker("") + static YggdrasilMinecraftSessionService createYggdrasilMinecraftSessionService(final YggdrasilAuthenticationService service, final Environment env) { + throw new UnsupportedOperationException(); + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/accounts/Account.java b/src/main/java/meteordevelopment/meteorclient/systems/accounts/Account.java index 9e840b28f9..263895ec17 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/accounts/Account.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/accounts/Account.java @@ -6,16 +6,21 @@ package meteordevelopment.meteorclient.systems.accounts; import com.mojang.authlib.exceptions.AuthenticationException; -import com.mojang.authlib.yggdrasil.YggdrasilEnvironment; -import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService; -import com.mojang.authlib.yggdrasil.YggdrasilUserApiService; -import meteordevelopment.meteorclient.MeteorClient; +import com.mojang.authlib.minecraft.MinecraftSessionService; +import com.mojang.authlib.minecraft.UserApiService; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; import meteordevelopment.meteorclient.mixin.MinecraftClientAccessor; +import meteordevelopment.meteorclient.mixin.PlayerSkinProviderAccessor; import meteordevelopment.meteorclient.utils.misc.ISerializable; import meteordevelopment.meteorclient.utils.misc.NbtException; +import net.minecraft.client.network.SocialInteractionsManager; +import net.minecraft.client.report.AbuseReportContext; +import net.minecraft.client.report.ReporterEnvironment; +import net.minecraft.client.texture.PlayerSkinProvider; import net.minecraft.client.util.ProfileKeys; import net.minecraft.client.util.Session; import net.minecraft.nbt.NbtCompound; +import net.minecraft.network.encryption.SignatureVerifier; import static meteordevelopment.meteorclient.MeteorClient.mc; @@ -34,10 +39,8 @@ public Account(AccountType type, String name) { public abstract boolean fetchInfo(); public boolean login() { - YggdrasilMinecraftSessionService service = (YggdrasilMinecraftSessionService) mc.getSessionService(); - AccountUtils.setBaseUrl(service, YggdrasilEnvironment.PROD.getEnvironment().getSessionHost() + "/session/minecraft/"); - AccountUtils.setJoinUrl(service, YggdrasilEnvironment.PROD.getEnvironment().getSessionHost() + "/session/minecraft/join"); - AccountUtils.setCheckUrl(service, YggdrasilEnvironment.PROD.getEnvironment().getSessionHost() + "/session/minecraft/hasJoined"); + YggdrasilAuthenticationService authenticationService = new YggdrasilAuthenticationService(((MinecraftClientAccessor) mc).getProxy()); + applyLoginEnvironment(authenticationService, authenticationService.createMinecraftSessionService()); return true; } @@ -55,19 +58,28 @@ public AccountCache getCache() { return cache; } - protected void setSession(Session session) { + public static void setSession(Session session) { MinecraftClientAccessor mca = (MinecraftClientAccessor) mc; - mca.setSession(session); mc.getSessionProperties().clear(); - + UserApiService apiService; try { - mca.setUserApiService(new YggdrasilUserApiService(mca.getSession().getAccessToken(), mc.getNetworkProxy(), YggdrasilEnvironment.PROD.getEnvironment())); - mca.setProfileKeys(ProfileKeys.create(mca.getUserApiService(), mca.getSession(), mc.runDirectory.toPath())); + apiService = mca.getAuthenticationService().createUserApiService(session.getAccessToken()); } catch (AuthenticationException e) { - e.printStackTrace(); - MeteorClient.LOG.error("Failed to log into the new account. Try again, or restart your game."); + apiService = UserApiService.OFFLINE; } + mca.setUserApiService(apiService); + mca.setSocialInteractionsManager(new SocialInteractionsManager(mc, apiService)); + mca.setProfileKeys(ProfileKeys.create(apiService, session, mc.runDirectory.toPath())); + mca.setAbuseReportContext(AbuseReportContext.create(ReporterEnvironment.ofIntegratedServer(), apiService)); + } + + public static void applyLoginEnvironment(YggdrasilAuthenticationService authService, MinecraftSessionService sessService) { + MinecraftClientAccessor mca = (MinecraftClientAccessor) mc; + mca.setAuthenticationService(authService); + mca.setServicesSignatureVerifier(SignatureVerifier.create(authService.getServicesKey())); + mca.setSessionService(sessService); + mca.setSkinProvider(new PlayerSkinProvider(mc.getTextureManager(), ((PlayerSkinProviderAccessor) mc.getSkinProvider()).getSkinCacheDir(), sessService)); } @Override diff --git a/src/main/java/meteordevelopment/meteorclient/systems/accounts/AccountUtils.java b/src/main/java/meteordevelopment/meteorclient/systems/accounts/AccountUtils.java deleted file mode 100644 index 205982a18e..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/systems/accounts/AccountUtils.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.systems.accounts; - -import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService; - -import java.lang.reflect.Field; -import java.net.MalformedURLException; -import java.net.URL; - -public class AccountUtils { - public static void setBaseUrl(YggdrasilMinecraftSessionService service, String url) { - try { - Field field = service.getClass().getDeclaredField("baseUrl"); - field.setAccessible(true); - field.set(service, url); - } catch (IllegalAccessException | NoSuchFieldException e) { - e.printStackTrace(); - } - } - - public static void setJoinUrl(YggdrasilMinecraftSessionService service, String url) { - try { - Field field = service.getClass().getDeclaredField("joinUrl"); - field.setAccessible(true); - field.set(service, new URL(url)); - } catch (IllegalAccessException | NoSuchFieldException | MalformedURLException e) { - e.printStackTrace(); - } - } - - public static void setCheckUrl(YggdrasilMinecraftSessionService service, String url) { - try { - Field field = service.getClass().getDeclaredField("checkUrl"); - field.setAccessible(true); - field.set(service, new URL(url)); - } catch (IllegalAccessException | NoSuchFieldException | MalformedURLException e) { - e.printStackTrace(); - } - } -} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/accounts/types/CrackedAccount.java b/src/main/java/meteordevelopment/meteorclient/systems/accounts/types/CrackedAccount.java index 086c96c03f..447bb623b5 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/accounts/types/CrackedAccount.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/accounts/types/CrackedAccount.java @@ -8,6 +8,7 @@ import meteordevelopment.meteorclient.systems.accounts.Account; import meteordevelopment.meteorclient.systems.accounts.AccountType; import net.minecraft.client.util.Session; +import net.minecraft.util.Uuids; import java.util.Optional; @@ -27,7 +28,7 @@ public boolean login() { super.login(); cache.loadHead(); - setSession(new Session(name, "", "", Optional.empty(), Optional.empty(), Session.AccountType.MOJANG)); + setSession(new Session(name, Uuids.getOfflinePlayerUuid(name).toString(), "", Optional.empty(), Optional.empty(), Session.AccountType.MOJANG)); return true; } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/accounts/types/TheAlteningAccount.java b/src/main/java/meteordevelopment/meteorclient/systems/accounts/types/TheAlteningAccount.java index 644da0b25e..2da37aeb27 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/accounts/types/TheAlteningAccount.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/accounts/types/TheAlteningAccount.java @@ -9,13 +9,12 @@ import com.mojang.authlib.Environment; import com.mojang.authlib.exceptions.AuthenticationException; import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; -import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService; import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication; import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.mixin.MinecraftClientAccessor; +import meteordevelopment.meteorclient.mixin.YggdrasilMinecraftSessionServiceAccessor; import meteordevelopment.meteorclient.systems.accounts.Account; import meteordevelopment.meteorclient.systems.accounts.AccountType; -import meteordevelopment.meteorclient.systems.accounts.AccountUtils; import net.minecraft.client.util.Session; import java.util.Optional; @@ -23,10 +22,8 @@ import static meteordevelopment.meteorclient.MeteorClient.mc; public class TheAlteningAccount extends Account { - private static final String AUTH = "http://authserver.thealtening.com"; - private static final String ACCOUNT = "https://api.mojang.com"; - private static final String SESSION = "http://sessionserver.thealtening.com"; - private static final String SERVICES = "https://api.minecraftservices.com"; + private static final Environment ENVIRONMENT = Environment.create("http://authserver.thealtening.com", "https://api.mojang.com", "http://sessionserver.thealtening.com", "https://api.minecraftservices.com", "The Altening"); + private static final YggdrasilAuthenticationService SERVICE = new YggdrasilAuthenticationService(((MinecraftClientAccessor) mc).getProxy(), "", ENVIRONMENT); public TheAlteningAccount(String token) { super(AccountType.TheAltening, token); @@ -50,10 +47,7 @@ public boolean fetchInfo() { @Override public boolean login() { - YggdrasilMinecraftSessionService service = (YggdrasilMinecraftSessionService) mc.getSessionService(); - AccountUtils.setBaseUrl(service, SESSION + "/session/minecraft/"); - AccountUtils.setJoinUrl(service, SESSION + "/session/minecraft/join"); - AccountUtils.setCheckUrl(service, SESSION + "/session/minecraft/hasJoined"); + applyLoginEnvironment(SERVICE, YggdrasilMinecraftSessionServiceAccessor.createYggdrasilMinecraftSessionService(SERVICE, ENVIRONMENT)); YggdrasilUserAuthentication auth = getAuth(); @@ -72,7 +66,7 @@ public boolean login() { } private YggdrasilUserAuthentication getAuth() { - YggdrasilUserAuthentication auth = (YggdrasilUserAuthentication) new YggdrasilAuthenticationService(((MinecraftClientAccessor) mc).getProxy(), "", Environment.create(AUTH, ACCOUNT, SESSION, SERVICES, "The Altening")).createUserAuthentication(Agent.MINECRAFT); + YggdrasilUserAuthentication auth = (YggdrasilUserAuthentication) SERVICE.createUserAuthentication(Agent.MINECRAFT); auth.setUsername(name); auth.setPassword("Meteor on Crack!"); diff --git a/src/main/resources/meteor-client.mixins.json b/src/main/resources/meteor-client.mixins.json index d6e509064c..edbf1d1277 100644 --- a/src/main/resources/meteor-client.mixins.json +++ b/src/main/resources/meteor-client.mixins.json @@ -127,6 +127,7 @@ "PlayerMoveC2SPacketAccessor", "PlayerMoveC2SPacketMixin", "PlayerPositionLookS2CPacketAccessor", + "PlayerSkinProviderAccessor", "PowderSnowBlockMixin", "ProjectileEntityAccessor", "ProjectileInGroundAccessor", @@ -162,7 +163,8 @@ "WorldBorderMixin", "WorldChunkMixin", "WorldRendererAccessor", - "WorldRendererMixin" + "WorldRendererMixin", + "YggdrasilMinecraftSessionServiceAccessor" ], "injectors": { "defaultRequire": 1 From 2566fe8e3fa9dce05ad24ecdecc7c8e450d7825d Mon Sep 17 00:00:00 2001 From: Damian <43420467+DAMcraft@users.noreply.github.com> Date: Thu, 16 Mar 2023 13:42:23 +0100 Subject: [PATCH 123/135] Added KeepHistory to BetterChat (#3432) --- .../meteorclient/mixin/ChatHudMixin.java | 8 ++++++++ .../meteorclient/systems/modules/misc/BetterChat.java | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ChatHudMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ChatHudMixin.java index 5e91d136ee..0a9fa62af6 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ChatHudMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ChatHudMixin.java @@ -102,6 +102,14 @@ private int addMessageListSizeProxy(List list) { return list.size(); } + @Inject(method = "clear(Z)V", at = @At("HEAD"), cancellable = true) + private void onClear(CallbackInfo info) { + BetterChat betterChat = Modules.get().get(BetterChat.class); + if (betterChat.antiHistClear.get()) { + info.cancel(); + } + } + @Inject(method = "render", at = @At("TAIL")) private void onRender(MatrixStack matrices, int currentTick, int mouseX, int mouseY, CallbackInfo info) { if (!Modules.get().get(BetterChat.class).displayPlayerHeads()) return; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterChat.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterChat.java index a4f2449bdb..0e936e5122 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterChat.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/BetterChat.java @@ -73,6 +73,13 @@ public class BetterChat extends Module { .build() ); + public final Setting antiHistClear = sgGeneral.add(new BoolSetting.Builder() + .name("keep-history") + .description("Prevents the chat history from being cleared when disconnecting.") + .defaultValue(true) + .build() + ); + // Filter private final Setting antiSpam = sgFilter.add(new BoolSetting.Builder() From d214e9144b7c35058fb3418707e134104658a84a Mon Sep 17 00:00:00 2001 From: Damian <43420467+DAMcraft@users.noreply.github.com> Date: Thu, 16 Mar 2023 13:44:19 +0100 Subject: [PATCH 124/135] Fixed sendPlayerMsg not sending commands that require signature (#3428) --- .../meteordevelopment/meteorclient/utils/player/ChatUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/ChatUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/player/ChatUtils.java index 1eced81b0b..ad1fef9c71 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/ChatUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/ChatUtils.java @@ -68,7 +68,7 @@ public static void forceNextPrefixClass(Class klass) { public static void sendPlayerMsg(String message) { mc.inGameHud.getChatHud().addToMessageHistory(message); - if (message.startsWith("/")) mc.player.networkHandler.sendCommand(message.substring(1)); + if (message.startsWith("/")) mc.player.networkHandler.sendChatCommand(message.substring(1)); else mc.player.networkHandler.sendChatMessage(message); } From 60d76f98a0ae5de166694273f97831629ed10619 Mon Sep 17 00:00:00 2001 From: Damian <43420467+DAMcraft@users.noreply.github.com> Date: Thu, 16 Mar 2023 13:59:58 +0100 Subject: [PATCH 125/135] Removed useless square-rooting (#3423) --- .../meteorclient/utils/entity/TargetUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/utils/entity/TargetUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/entity/TargetUtils.java index cb174d4274..b1721767ce 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/entity/TargetUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/entity/TargetUtils.java @@ -101,6 +101,6 @@ private static int sortAngle(Entity e1, Entity e2) { double e1pitch = Math.abs(Rotations.getPitch(e1) - mc.player.getPitch()); double e2pitch = Math.abs(Rotations.getPitch(e2) - mc.player.getPitch()); - return Double.compare(Math.sqrt(e1yaw * e1yaw + e1pitch * e1pitch), Math.sqrt(e2yaw * e2yaw + e2pitch * e2pitch)); + return Double.compare(e1yaw * e1yaw + e1pitch * e1pitch, e2yaw * e2yaw + e2pitch * e2pitch); } } From e50858b98c0adc51335ce85bee5b10e1283b8e8a Mon Sep 17 00:00:00 2001 From: DesiCow <80271842+DesiCow@users.noreply.github.com> Date: Thu, 16 Mar 2023 18:42:18 +0530 Subject: [PATCH 126/135] Fixed auto gap not eating normal gapples (#3439) --- .../systems/modules/player/AutoGap.java | 44 ++++++------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoGap.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoGap.java index 0811c469cf..988767ddc4 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoGap.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/AutoGap.java @@ -42,9 +42,9 @@ public class AutoGap extends Module { // General - private final Setting preferEGap = sgGeneral.add(new BoolSetting.Builder() - .name("prefer-egap") - .description("Prefers to eat E-Gap over Gaps if found.") + private final Setting allowEgap = sgGeneral.add(new BoolSetting.Builder() + .name("allow-egap") + .description("Allow eating E-Gaps over Gaps if found.") .defaultValue(true) .build() ); @@ -83,6 +83,7 @@ public class AutoGap extends Module { .name("potions-fire-resistance") .description("If it should eat when Fire Resistance runs out. Requires E-Gaps.") .defaultValue(true) + .visible(allowEgap::get) .build() ); @@ -90,6 +91,7 @@ public class AutoGap extends Module { .name("potions-absorption") .description("If it should eat when Resistance runs out. Requires E-Gaps.") .defaultValue(false) + .visible(allowEgap::get) .build() ); @@ -276,11 +278,8 @@ private boolean shouldEatHealth() { } private int findSlot() { - boolean preferEGap = this.preferEGap.get(); - if (requiresEGap) preferEGap = true; - + boolean preferEGap = this.allowEgap.get() || requiresEGap; int slot = -1; - Item currentItem = null; for (int i = 0; i < 9; i++) { // Skip if item stack is empty @@ -291,35 +290,18 @@ private int findSlot() { if (isNotGapOrEGap(stack)) continue; Item item = stack.getItem(); - // If this is the first apple found then set it without looking at preferEGap setting - if (currentItem == null) { + // If egap was found and preferEGap is true we can return the current slot + if (item == Items.ENCHANTED_GOLDEN_APPLE && preferEGap) { slot = i; - currentItem = item; + break; } - else { - // Skip if current item and item are the same - if (currentItem == item) continue; - - // If egap was found and preferEGap is true we can return the current slot - if (item == Items.ENCHANTED_GOLDEN_APPLE && preferEGap) { - slot = i; - currentItem = item; - - break; - } - // If gap was found and preferEGap is false we can return the current slot - else if (item == Items.GOLDEN_APPLE && !preferEGap) { - slot = i; - currentItem = item; - - break; - } + // If gap was found and egap is not required we can return the current slot + else if (item == Items.GOLDEN_APPLE && !requiresEGap) { + slot = i; + if (!preferEGap) break; } } - // If requiresEGap is true but no egap was found return -1 - if (requiresEGap && currentItem != Items.ENCHANTED_GOLDEN_APPLE) return -1; - return slot; } From 9852ee17a514876d913b525fe08610f6c9b4da85 Mon Sep 17 00:00:00 2001 From: Damian <43420467+DAMcraft@users.noreply.github.com> Date: Thu, 16 Mar 2023 14:19:53 +0100 Subject: [PATCH 127/135] Added support for player.speed_all in starscript (#3415) --- .../meteorclient/utils/Utils.java | 22 +++++++++++++------ .../utils/misc/MeteorStarscript.java | 9 +++++++- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/utils/Utils.java b/src/main/java/meteordevelopment/meteorclient/utils/Utils.java index 910d436c84..8c33c08a80 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/Utils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/Utils.java @@ -87,17 +87,25 @@ private static void onTick(TickEvent.Post event) { } } - public static double getPlayerSpeed() { - if (mc.player == null) return 0; + public static Vec3d getPlayerSpeed() { + if (mc.player == null) return Vec3d.ZERO; - double tX = Math.abs(mc.player.getX() - mc.player.prevX); - double tZ = Math.abs(mc.player.getZ() - mc.player.prevZ); - double length = Math.sqrt(tX * tX + tZ * tZ); + double tX = mc.player.getX() - mc.player.prevX; + double tY = mc.player.getY() - mc.player.prevY; + double tZ = mc.player.getZ() - mc.player.prevZ; Timer timer = Modules.get().get(Timer.class); - if (timer.isActive()) length *= timer.getMultiplier(); + if (timer.isActive()) { + tX *= timer.getMultiplier(); + tY *= timer.getMultiplier(); + tZ *= timer.getMultiplier(); + } + + tX *= 20; + tY *= 20; + tZ *= 20; - return length * 20; + return new Vec3d(tX, tY, tZ); } public static String getWorldTime() { diff --git a/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java b/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java index fb001ab840..faf0dae40f 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/misc/MeteorStarscript.java @@ -123,7 +123,14 @@ public static void init() { .set("_toString", () -> Value.string(mc.getSession().getUsername())) .set("health", () -> Value.number(mc.player != null ? mc.player.getHealth() : 0)) .set("hunger", () -> Value.number(mc.player != null ? mc.player.getHungerManager().getFoodLevel() : 0)) - .set("speed", () -> Value.number(Utils.getPlayerSpeed())) + + .set("speed", () -> Value.number(Utils.getPlayerSpeed().horizontalLength())) + .set("speed_all", new ValueMap() + .set("_toString", () -> Value.string(mc.player != null ? Utils.getPlayerSpeed().toString() : "")) + .set("x", () -> Value.number(mc.player != null ? Utils.getPlayerSpeed().x : 0)) + .set("y", () -> Value.number(mc.player != null ? Utils.getPlayerSpeed().y : 0)) + .set("z", () -> Value.number(mc.player != null ? Utils.getPlayerSpeed().z : 0)) + ) .set("breaking_progress", () -> Value.number(mc.interactionManager != null ? ((ClientPlayerInteractionManagerAccessor) mc.interactionManager).getBreakingProgress() : 0)) .set("biome", MeteorStarscript::biome) From 2803d51d11adb9ef443d0c9ed0efb017740d90e9 Mon Sep 17 00:00:00 2001 From: Soda6501 Date: Sun, 5 Mar 2023 23:12:53 +0800 Subject: [PATCH 128/135] Fix invisible players become visible --- .../java/meteordevelopment/meteorclient/mixin/EntityMixin.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/EntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/EntityMixin.java index e6bb1d3585..14a2291fea 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/EntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/EntityMixin.java @@ -123,7 +123,8 @@ private Block getVelocityMultiplierGetBlockProxy(BlockState blockState) { @Inject(method = "isInvisibleTo(Lnet/minecraft/entity/player/PlayerEntity;)Z", at = @At("HEAD"), cancellable = true) private void isInvisibleToCanceller(PlayerEntity player, CallbackInfoReturnable info) { if (!Utils.canUpdate()) return; - if (Modules.get().get(NoRender.class).noInvisibility() || !Modules.get().get(ESP.class).shouldSkip((Entity) (Object) this)) info.setReturnValue(false); + ESP esp = Modules.get().get(ESP.class); + if (Modules.get().get(NoRender.class).noInvisibility() || esp.isActive() && !esp.shouldSkip((Entity) (Object) this)) info.setReturnValue(false); } @Inject(method = "isGlowing", at = @At("HEAD"), cancellable = true) From ce30df8e678e43be27112d9b75ce40d7feb7dbd3 Mon Sep 17 00:00:00 2001 From: Soda6501 Date: Sat, 4 Mar 2023 17:13:52 +0800 Subject: [PATCH 129/135] fix indigo mixin failure --- gradle.properties | 2 +- .../indigo/TerrainRenderContextMixin.java | 30 ------------------- .../meteor-client-indigo.mixins.json | 3 +- 3 files changed, 2 insertions(+), 33 deletions(-) delete mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/indigo/TerrainRenderContextMixin.java diff --git a/gradle.properties b/gradle.properties index c3a8159efa..ea7a628d32 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx2G minecraft_version=1.19.3 yarn_mappings=1.19.3+build.2 loader_version=0.14.11 -fapi_version=0.68.1+1.19.3 +fapi_version=0.75.1+1.19.3 # Mod Properties mod_version=0.5.2 diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/indigo/TerrainRenderContextMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/indigo/TerrainRenderContextMixin.java deleted file mode 100644 index 4089fbf284..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/mixin/indigo/TerrainRenderContextMixin.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.mixin.indigo; - -import meteordevelopment.meteorclient.systems.modules.Modules; -import meteordevelopment.meteorclient.systems.modules.render.Xray; -import net.fabricmc.fabric.impl.client.indigo.renderer.render.TerrainRenderContext; -import net.minecraft.block.BlockState; -import net.minecraft.client.render.model.BakedModel; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.BlockPos; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(value = TerrainRenderContext.class, remap = false) -public class TerrainRenderContextMixin { - @Inject(method = "tessellateBlock", at = @At("HEAD"), cancellable = true) - private void onTessellateBlock(BlockState blockState, BlockPos blockPos, BakedModel model, MatrixStack matrixStack, CallbackInfoReturnable info) { - Xray xray = Modules.get().get(Xray.class); - - if (xray.isActive() && xray.isBlocked(blockState.getBlock(), blockPos)) { -// info.cancel(); - } - } -} diff --git a/src/main/resources/meteor-client-indigo.mixins.json b/src/main/resources/meteor-client-indigo.mixins.json index 3b51d68352..8a7f2a6389 100644 --- a/src/main/resources/meteor-client-indigo.mixins.json +++ b/src/main/resources/meteor-client-indigo.mixins.json @@ -4,8 +4,7 @@ "compatibilityLevel": "JAVA_17", "plugin": "meteordevelopment.meteorclient.MixinPlugin", "client": [ - "AbstractQuadRendererMixin", - "TerrainRenderContextMixin" + "AbstractQuadRendererMixin" ], "injectors": { "defaultRequire": 1 From c72d2aa8f1d88cf53cde04a0ee5766d5dabfaf82 Mon Sep 17 00:00:00 2001 From: EpicPlayerA10 <62206933+EpicPlayerA10@users.noreply.github.com> Date: Thu, 16 Mar 2023 14:29:01 +0100 Subject: [PATCH 130/135] Notebot - Fix bugs and add some documentation (#3298) --- .../systems/modules/misc/Notebot.java | 109 +++++++++---- .../utils/notebot/decoder/NBSSongDecoder.java | 150 ++++++++---------- .../utils/notebot/decoder/SongDecoder.java | 8 +- .../utils/notebot/decoder/SongDecoders.java | 17 +- .../notebot/decoder/TextSongDecoder.java | 11 +- 5 files changed, 165 insertions(+), 130 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notebot.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notebot.java index f4fe8d7af2..772b97bbb5 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notebot.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/Notebot.java @@ -46,11 +46,13 @@ import net.minecraft.util.math.Direction; import net.minecraft.util.math.Vec3d; import org.apache.commons.io.FilenameUtils; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.joml.Vector3d; import java.io.File; import java.util.*; +import java.util.concurrent.CancellationException; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; @@ -238,6 +240,7 @@ public class Notebot extends Module { private final Multimap scannedNoteblocks = MultimapBuilder.linkedHashKeys().arrayListValues().build(); // Found noteblocks private final List clickedBlocks = new ArrayList<>(); private Stage stage = Stage.None; + private PlayingMode playingMode = PlayingMode.None; private boolean isPlaying = false; private int currentTick = 0; private int ticks = 0; @@ -267,7 +270,11 @@ public Notebot() { @Override public String getInfoString() { - return stage.toString(); + if (stage == Stage.None) { + return "None"; + } else { + return playingMode.toString() + " | " + stage.toString(); + } } @Override @@ -285,6 +292,7 @@ private void resetVariables() { tuneHits.clear(); anyNoteblockTuned = false; currentTick = 0; + playingMode = PlayingMode.None; isPlaying = false; stage = Stage.None; song = null; @@ -432,7 +440,7 @@ else if (stage == Stage.SetUp) { else if (stage == Stage.Tune) { tune(); } - else if (stage == Stage.Preview || stage == Stage.Playing) { + else if (stage == Stage.Playing) { if (!isPlaying) return; if (mc.player == null || currentTick > song.getLastTick()) { @@ -442,7 +450,7 @@ else if (stage == Stage.Preview || stage == Stage.Playing) { } if (song.getNotesMap().containsKey(currentTick)) { - if (stage == Stage.Preview) onTickPreview(); + if (playingMode == PlayingMode.Preview) onTickPreview(); else if (mc.player.getAbilities().creativeMode) { error("You need to be in survival mode."); stop(); @@ -463,7 +471,9 @@ else if (mc.player.getAbilities().creativeMode) { private void setupNoteblocksMap() { noteBlockPositions.clear(); + // Modifiable list of unique notes List uniqueNotesToUse = new ArrayList<>(song.getRequirements()); + // A map with noteblocks that have incorrect note level Map> incorrectNoteBlocks = new HashMap<>(); // Check if there are already tuned noteblocks @@ -472,12 +482,13 @@ private void setupNoteblocksMap() { List noteblocks = new ArrayList<>(entry.getValue()); if (uniqueNotesToUse.contains(note)) { + // Add correct noteblock position to a noteBlockPositions noteBlockPositions.put(note, noteblocks.remove(0)); uniqueNotesToUse.remove(note); } if (!noteblocks.isEmpty()) { - // Add excess for mapping process note -> block pos + // Add excess noteblocks for mapping process [note -> block pos] if (!incorrectNoteBlocks.containsKey(note.getInstrument())) { incorrectNoteBlocks.put(note.getInstrument(), new ArrayList<>()); @@ -487,7 +498,7 @@ private void setupNoteblocksMap() { } } - // Map note -> block pos + // Map [note -> block pos] for (var entry : incorrectNoteBlocks.entrySet()) { List positions = entry.getValue(); @@ -592,7 +603,7 @@ public String getStatus() { if (!this.isActive()) return "Module disabled."; if (song == null) return "No song loaded."; if (isPlaying) return String.format("Playing song. %d/%d", currentTick, song.getLastTick()); - if (stage == Stage.Playing || stage == Stage.Preview) return "Ready to play."; + if (stage == Stage.Playing) return "Ready to play."; if (stage == Stage.SetUp || stage == Stage.Tune || stage == Stage.WaitingToCheckNoteblocks) return "Setting up the noteblocks."; else return String.format("Stage: %s.", stage.toString()); } @@ -602,9 +613,9 @@ public String getStatus() { */ public void play() { if (mc.player == null) return; - if (mc.player.getAbilities().creativeMode && stage != Stage.Preview) { + if (mc.player.getAbilities().creativeMode && playingMode != PlayingMode.Preview) { error("You need to be in survival mode."); - } else if (stage == Stage.Preview || stage == Stage.Playing) { + } else if (stage == Stage.Playing) { isPlaying = true; info("Playing."); } else { @@ -625,18 +636,12 @@ public void pause() { public void stop() { info("Stopping."); - if (stage == Stage.SetUp || stage == Stage.Tune || stage == Stage.WaitingToCheckNoteblocks || stage == Stage.LoadingSong) { - resetVariables(); - } else { - isPlaying = false; - currentTick = 0; - } - updateStatus(); disable(); + updateStatus(); } public void onSongEnd() { - if (autoPlay.get() && stage != Stage.Preview) { + if (autoPlay.get() && playingMode != PlayingMode.Preview) { playRandomSong(); } else { stop(); @@ -667,10 +672,12 @@ public void disable() { */ public void loadSong(File file) { if (!isActive()) toggle(); + resetVariables(); + + this.playingMode = PlayingMode.Noteblocks; if (!loadFileToMap(file, () -> stage = Stage.SetUp)) { - if (autoPlay.get()) { - playRandomSong(); - } + onSongEnd(); + return; } updateStatus(); } @@ -682,8 +689,11 @@ public void loadSong(File file) { */ public void previewSong(File file) { if (!isActive()) toggle(); + resetVariables(); + + this.playingMode = PlayingMode.Preview; loadFileToMap(file, () -> { - stage = Stage.Preview; + stage = Stage.Playing; play(); }); updateStatus(); @@ -706,26 +716,43 @@ public boolean loadFileToMap(File file, Runnable callback) { error("File is in wrong format. Decoder not found."); return false; } - resetVariables(); + info("Loading song \"%s\".", FilenameUtils.getBaseName(file.getName())); - loadingSongFuture = CompletableFuture.supplyAsync(() -> SongDecoders.parse(file)); - loadingSongFuture.completeOnTimeout(null, 10, TimeUnit.SECONDS); + // Start loading song + loadingSongFuture = CompletableFuture.supplyAsync(() -> { + try { + return SongDecoders.parse(file); + } catch (Exception e) { + throw new RuntimeException(e); + } + }); + loadingSongFuture.completeOnTimeout(null, 60, TimeUnit.SECONDS); stage = Stage.LoadingSong; long time1 = System.currentTimeMillis(); - loadingSongFuture.thenAccept(song -> { - if (song != null) { + loadingSongFuture.whenComplete((song ,ex) -> { + if (ex == null) { + // Song is null only when it times out + if (song == null) { + error("Loading song '" + FilenameUtils.getBaseName(file.getName()) + "' timed out."); + onSongEnd(); + return; + } + this.song = song; long time2 = System.currentTimeMillis(); long diff = time2 - time1; - info("Song '"+FilenameUtils.getBaseName(file.getName())+"' has been loaded to the memory! Took "+diff+"ms"); + info("Song '" + FilenameUtils.getBaseName(file.getName()) + "' has been loaded to the memory! Took "+diff+"ms"); callback.run(); } else { - error("Could not load song '"+FilenameUtils.getBaseName(file.getName())+"'"); - if (autoPlay.get()) { - playRandomSong(); + if (ex instanceof CancellationException) { + error("Loading song '" + FilenameUtils.getBaseName(file.getName()) + "' was cancelled."); + } else { + error("An error occurred while loading song '" + FilenameUtils.getBaseName(file.getName()) + "'. See the logs for more details"); + MeteorClient.LOG.error("An error occurred while loading song '" + FilenameUtils.getBaseName(file.getName()) + "'", ex); + onSongEnd(); } } }); @@ -864,6 +891,8 @@ private static int calcNumberOfHits(int from, int to) { private void onTickPlay() { Collection notes = song.getNotesMap().get(this.currentTick); if (!notes.isEmpty()) { + + // Rotate player's head if (autoRotate.get()) { Optional firstNote = notes.stream().findFirst(); if (firstNote.isPresent()) { @@ -875,10 +904,12 @@ private void onTickPlay() { } } + // Swing arm if (swingArm.get()) { mc.player.swingHand(Hand.MAIN_HAND); } + // Play notes for (Note note : notes) { BlockPos pos = noteBlockPositions.get(note); if (pos == null) { @@ -907,10 +938,17 @@ private boolean isValidScanSpot(BlockPos pos) { return mc.world.getBlockState(pos.up()).isAir(); } + /** + * Gets an Instrument from Note Map + * + * @param inst An instrument + * @return A new instrument mapped by instrument given in parameters + */ @Nullable - public Instrument getMappedInstrument(Instrument inst) { + public Instrument getMappedInstrument(@NotNull Instrument inst) { if (mode.get() == NotebotUtils.NotebotMode.ExactInstruments) { - return ((NotebotUtils.OptionalInstrument) sgNoteMap.getByIndex(inst.ordinal()).get()).toMinecraftInstrument(); + NotebotUtils.OptionalInstrument optionalInstrument = (NotebotUtils.OptionalInstrument) sgNoteMap.getByIndex(inst.ordinal()).get(); + return optionalInstrument.toMinecraftInstrument(); } else { return inst; } @@ -935,7 +973,12 @@ public enum Stage { SetUp, Tune, WaitingToCheckNoteblocks, - Playing, - Preview + Playing + } + + public enum PlayingMode { + None, + Preview, + Noteblocks } } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/NBSSongDecoder.java b/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/NBSSongDecoder.java index 89e8941d14..222cd5991e 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/NBSSongDecoder.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/NBSSongDecoder.java @@ -7,10 +7,10 @@ import com.google.common.collect.Multimap; import com.google.common.collect.MultimapBuilder; -import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.utils.notebot.song.Note; import meteordevelopment.meteorclient.utils.notebot.song.Song; import net.minecraft.block.enums.Instrument; +import org.jetbrains.annotations.NotNull; import java.io.*; @@ -31,109 +31,89 @@ public class NBSSongDecoder extends SongDecoder { * @return Song object representing a Note Block Studio project */ @Override - public Song parse(File songFile) { - try { - return parse(new FileInputStream(songFile), songFile); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } - return null; - } - - /** - * Parses a Song from an InputStream - * @see Song - * @param inputStream of a Note Block Studio project file (.nbs) - * @return Song object from the InputStream - */ - public Song parse(InputStream inputStream) { - return parse(inputStream, null); // Source is unknown -> no file + @NotNull + public Song parse(File songFile) throws Exception { + return parse(new FileInputStream(songFile)); } /** * Parses a Song from an InputStream and a Note Block Studio project file (.nbs) * @see Song * @param inputStream of a .nbs file - * @param songFile representing a .nbs file * @return Song object representing the given .nbs file */ - private Song parse(InputStream inputStream, File songFile) { + @NotNull + private Song parse(InputStream inputStream) throws Exception { Multimap notesMap = MultimapBuilder.linkedHashKeys().arrayListValues().build(); - try { - DataInputStream dataInputStream = new DataInputStream(inputStream); - short length = readShort(dataInputStream); - int nbsversion = 0; - if (length == 0) { - nbsversion = dataInputStream.readByte(); - dataInputStream.readByte(); // first custom instrument - if (nbsversion >= 3) { - length = readShort(dataInputStream); - } - } - readShort(dataInputStream); // Song Height - String title = readString(dataInputStream); - String author = readString(dataInputStream); - readString(dataInputStream); // original author - readString(dataInputStream); // description - float speed = readShort(dataInputStream) / 100f; - dataInputStream.readBoolean(); // auto-save - dataInputStream.readByte(); // auto-save duration - dataInputStream.readByte(); // x/4ths, time signature - readInt(dataInputStream); // minutes spent on project - readInt(dataInputStream); // left clicks (why?) - readInt(dataInputStream); // right clicks (why?) - readInt(dataInputStream); // blocks added - readInt(dataInputStream); // blocks removed - readString(dataInputStream); // .mid/.schematic file name - if (nbsversion >= 4) { - dataInputStream.readByte(); // loop on/off - dataInputStream.readByte(); // max loop count - readShort(dataInputStream); // loop start tick + DataInputStream dataInputStream = new DataInputStream(inputStream); + short length = readShort(dataInputStream); + int nbsversion = 0; + if (length == 0) { + nbsversion = dataInputStream.readByte(); + dataInputStream.readByte(); // first custom instrument + if (nbsversion >= 3) { + length = readShort(dataInputStream); } + } + readShort(dataInputStream); // Song Height + String title = readString(dataInputStream); + String author = readString(dataInputStream); + readString(dataInputStream); // original author + readString(dataInputStream); // description + float speed = readShort(dataInputStream) / 100f; + dataInputStream.readBoolean(); // auto-save + dataInputStream.readByte(); // auto-save duration + dataInputStream.readByte(); // x/4ths, time signature + readInt(dataInputStream); // minutes spent on project + readInt(dataInputStream); // left clicks (why?) + readInt(dataInputStream); // right clicks (why?) + readInt(dataInputStream); // blocks added + readInt(dataInputStream); // blocks removed + readString(dataInputStream); // .mid/.schematic file name + if (nbsversion >= 4) { + dataInputStream.readByte(); // loop on/off + dataInputStream.readByte(); // max loop count + readShort(dataInputStream); // loop start tick + } - double tick = -1; + double tick = -1; + while (true) { + short jumpTicks = readShort(dataInputStream); // jumps till next tick + //System.out.println("Jumps to next tick: " + jumpTicks); + if (jumpTicks == 0) { + break; + } + tick += jumpTicks * (20f / speed); + //System.out.println("Tick: " + tick); + short layer = -1; while (true) { - short jumpTicks = readShort(dataInputStream); // jumps till next tick - //System.out.println("Jumps to next tick: " + jumpTicks); - if (jumpTicks == 0) { + short jumpLayers = readShort(dataInputStream); // jumps till next layer + if (jumpLayers == 0) { break; } - tick += jumpTicks * (20f / speed); - //System.out.println("Tick: " + tick); - short layer = -1; - while (true) { - short jumpLayers = readShort(dataInputStream); // jumps till next layer - if (jumpLayers == 0) { - break; - } - layer += jumpLayers; - //System.out.println("Layer: " + layer); - byte instrument = dataInputStream.readByte(); - - byte key = dataInputStream.readByte(); - if (nbsversion >= 4) { - dataInputStream.readByte(); // note block velocity - dataInputStream.readUnsignedByte(); // note panning, 0 is right in nbs format - readShort(dataInputStream); // note block pitch - } - - Note note = new Note(fromNBSInstrument(instrument) /* instrument */, key - NOTE_OFFSET /* note */); - setNote((int) Math.round(tick), note, notesMap); + layer += jumpLayers; + //System.out.println("Layer: " + layer); + byte instrument = dataInputStream.readByte(); + + byte key = dataInputStream.readByte(); + if (nbsversion >= 4) { + dataInputStream.readUnsignedByte(); // note block velocity + dataInputStream.readUnsignedByte(); // note panning, 0 is right in nbs format + readShort(dataInputStream); // note block pitch } - } - return new Song(notesMap, title, author); - } catch (EOFException e) { - String file = ""; - if (songFile != null) { - file = songFile.getName(); + Instrument inst = fromNBSInstrument(instrument); + + // Probably a custom instrument. Ignore this note + if (inst == null) continue; + + Note note = new Note(inst /* instrument */, key - NOTE_OFFSET /* note */); + setNote((int) Math.round(tick), note, notesMap); } - MeteorClient.LOG.error("Song is corrupted: " + file, e); - } catch (IOException e) { - e.printStackTrace(); } - return null; + + return new Song(notesMap, title, author); } /** diff --git a/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/SongDecoder.java b/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/SongDecoder.java index 455266e7b6..24a447fa61 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/SongDecoder.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/SongDecoder.java @@ -14,5 +14,11 @@ public abstract class SongDecoder { protected Notebot notebot = Modules.get().get(Notebot.class); - public abstract Song parse(File file); + /** + * Parse file to a {@link Song} object + * + * @param file Song file + * @return A {@link Song} object + */ + public abstract Song parse(File file) throws Exception; } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/SongDecoders.java b/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/SongDecoders.java index 48d485ae31..2233b3bc6c 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/SongDecoders.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/SongDecoders.java @@ -12,6 +12,7 @@ import meteordevelopment.meteorclient.utils.notebot.song.Song; import net.minecraft.block.enums.Instrument; import org.apache.commons.io.FilenameUtils; +import org.jetbrains.annotations.NotNull; import java.io.File; import java.nio.file.Path; @@ -43,8 +44,15 @@ public static boolean hasDecoder(Path path) { return hasDecoder(path.toFile()); } - public static Song parse(File file) { - if (!hasDecoder(file)) return null; + /** + * Parse file to one of {@link SongDecoder} + * + * @param file A song file + * @return A {@link Song} object + */ + @NotNull + public static Song parse(File file) throws Exception { + if (!hasDecoder(file)) throw new IllegalStateException("Decoder for this file does not exists!"); SongDecoder decoder = getDecoder(file); Song song = decoder.parse(file); @@ -55,6 +63,11 @@ public static Song parse(File file) { return song; } + /** + * This method adapts {@link Song} to settings in Notebot module + * + * @param song A song + */ private static void fixSong(Song song) { Notebot notebot = Modules.get().get(Notebot.class); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/TextSongDecoder.java b/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/TextSongDecoder.java index b8d3c4dbd9..cfe0be8233 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/TextSongDecoder.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/notebot/decoder/TextSongDecoder.java @@ -13,21 +13,14 @@ import org.apache.commons.io.FilenameUtils; import java.io.File; -import java.io.IOException; import java.nio.file.Files; import java.util.List; public class TextSongDecoder extends SongDecoder { @Override - public Song parse(File file) { - List data; - try { - data = Files.readAllLines(file.toPath()); - } catch (IOException e) { - notebot.error("Error while reading \"%s\"", file.getName()); - return null; - } + public Song parse(File file) throws Exception { + List data = Files.readAllLines(file.toPath()); Multimap notesMap = MultimapBuilder.linkedHashKeys().arrayListValues().build(); String title = FilenameUtils.getBaseName(file.getName()); From ffe66fecc493fd46fceb4075260130508b611d56 Mon Sep 17 00:00:00 2001 From: Soda5601 <62250232+Soda5601@users.noreply.github.com> Date: Thu, 16 Mar 2023 21:41:51 +0800 Subject: [PATCH 131/135] Lithium compatibility (#3214) --- build.gradle | 1 + gradle.properties | 3 ++ .../meteorclient/MixinPlugin.java | 5 ++++ .../events/world/CollisionShapeEvent.java | 9 +----- .../mixin/BlockCollisionSpliteratorMixin.java | 11 ++------ .../ChunkAwareBlockCollisionSweeperMixin.java | 28 +++++++++++++++++++ .../systems/modules/movement/Jesus.java | 3 +- .../systems/modules/world/Collisions.java | 2 +- src/main/resources/fabric.mod.json | 3 +- .../meteor-client-lithium.mixins.json | 12 ++++++++ 10 files changed, 57 insertions(+), 20 deletions(-) create mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/lithium/ChunkAwareBlockCollisionSweeperMixin.java create mode 100644 src/main/resources/meteor-client-lithium.mixins.json diff --git a/build.gradle b/build.gradle index fa90cdb209..ce223855b9 100644 --- a/build.gradle +++ b/build.gradle @@ -54,6 +54,7 @@ dependencies { // Compat fixes modCompileOnly fabricApi.module("fabric-renderer-indigo", project.fapi_version) modCompileOnly("maven.modrinth:sodium:${project.sodium_version}") { transitive = false } + modCompileOnly("maven.modrinth:lithium:${project.lithium_version}") { transitive = false } //modCompileOnly("io.vram:canvas-fabric-mc119:1.0.+") { transitive = false } // TODO: 1.19.3 // Baritone (https://github.com/MeteorDevelopment/baritone) diff --git a/gradle.properties b/gradle.properties index ea7a628d32..dd457fd768 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,6 +16,9 @@ archives_base_name=meteor-client # Sodium (https://github.com/CaffeineMC/sodium-fabric) sodium_version=mc1.19.3-0.4.9 +# Lithium (https://github.com/CaffeineMC/lithium-fabric) +lithium_version=mc1.19.3-0.10.4 + # Orbit (https://github.com/MeteorDevelopment/orbit) orbit_version=0.2.3 diff --git a/src/main/java/meteordevelopment/meteorclient/MixinPlugin.java b/src/main/java/meteordevelopment/meteorclient/MixinPlugin.java index a0e5e2b70a..5740b076fe 100644 --- a/src/main/java/meteordevelopment/meteorclient/MixinPlugin.java +++ b/src/main/java/meteordevelopment/meteorclient/MixinPlugin.java @@ -26,6 +26,7 @@ public class MixinPlugin implements IMixinConfigPlugin { private static boolean isIndigoPresent; private static boolean isSodiumPresent; private static boolean isCanvasPresent; + private static boolean isLithiumPresent; @Override public void onLoad(String mixinPackage) { @@ -68,6 +69,7 @@ public void onLoad(String mixinPackage) { isOriginsPresent = FabricLoader.getInstance().isModLoaded("origins"); isSodiumPresent = FabricLoader.getInstance().isModLoaded("sodium"); isCanvasPresent = FabricLoader.getInstance().isModLoaded("canvas"); + isLithiumPresent = FabricLoader.getInstance().isModLoaded("lithium"); loaded = true; } @@ -94,6 +96,9 @@ else if (mixinClassName.startsWith(mixinPackage + ".indigo")) { else if (mixinClassName.startsWith(mixinPackage + ".canvas")) { return isCanvasPresent; } + else if (mixinClassName.startsWith(mixinPackage + ".lithium")) { + return isLithiumPresent; + } return true; diff --git a/src/main/java/meteordevelopment/meteorclient/events/world/CollisionShapeEvent.java b/src/main/java/meteordevelopment/meteorclient/events/world/CollisionShapeEvent.java index 14d183c0c8..492c23d300 100644 --- a/src/main/java/meteordevelopment/meteorclient/events/world/CollisionShapeEvent.java +++ b/src/main/java/meteordevelopment/meteorclient/events/world/CollisionShapeEvent.java @@ -11,23 +11,16 @@ import net.minecraft.util.shape.VoxelShape; public class CollisionShapeEvent extends Cancellable { - public enum CollisionType { - BLOCK, - FLUID - } - private static final CollisionShapeEvent INSTANCE = new CollisionShapeEvent(); public BlockState state; public BlockPos pos; public VoxelShape shape; - public CollisionType type; - public static CollisionShapeEvent get(BlockState state, BlockPos pos, VoxelShape shape, CollisionType type) { + public static CollisionShapeEvent get(BlockState state, BlockPos pos, VoxelShape shape) { INSTANCE.state = state; INSTANCE.pos = pos; INSTANCE.shape = shape; - INSTANCE.type = type; return INSTANCE; } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/BlockCollisionSpliteratorMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/BlockCollisionSpliteratorMixin.java index 2fc9a0d734..026acc0e73 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/BlockCollisionSpliteratorMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/BlockCollisionSpliteratorMixin.java @@ -22,14 +22,7 @@ public class BlockCollisionSpliteratorMixin { @Redirect(method = "computeNext", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;getCollisionShape(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/ShapeContext;)Lnet/minecraft/util/shape/VoxelShape;")) private VoxelShape onComputeNextCollisionBox(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - VoxelShape shape = state.getCollisionShape(world, pos, context); - CollisionShapeEvent event = state.getFluidState().isEmpty() - ? MeteorClient.EVENT_BUS.post(CollisionShapeEvent.get(state, pos, shape, CollisionShapeEvent.CollisionType.BLOCK)) - : MeteorClient.EVENT_BUS.post(CollisionShapeEvent.get(state.getFluidState().getBlockState(), pos, shape, CollisionShapeEvent.CollisionType.FLUID)); - - if (event.isCancelled()) - return VoxelShapes.empty(); - else - return event.shape; + CollisionShapeEvent event = MeteorClient.EVENT_BUS.post(CollisionShapeEvent.get(state, pos, state.getCollisionShape(world, pos, context))); + return event.isCancelled() ? VoxelShapes.empty() : event.shape; } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/lithium/ChunkAwareBlockCollisionSweeperMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/lithium/ChunkAwareBlockCollisionSweeperMixin.java new file mode 100644 index 0000000000..1ada66b788 --- /dev/null +++ b/src/main/java/meteordevelopment/meteorclient/mixin/lithium/ChunkAwareBlockCollisionSweeperMixin.java @@ -0,0 +1,28 @@ +/* + * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). + * Copyright (c) Meteor Development. + */ + +package meteordevelopment.meteorclient.mixin.lithium; + +import me.jellysquid.mods.lithium.common.entity.movement.ChunkAwareBlockCollisionSweeper; +import meteordevelopment.meteorclient.MeteorClient; +import meteordevelopment.meteorclient.events.world.CollisionShapeEvent; +import net.minecraft.block.BlockState; +import net.minecraft.block.ShapeContext; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.util.shape.VoxelShapes; +import net.minecraft.world.BlockView; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(value = ChunkAwareBlockCollisionSweeper.class) +public abstract class ChunkAwareBlockCollisionSweeperMixin { + @Redirect(method = "computeNext", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;getCollisionShape(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/ShapeContext;)Lnet/minecraft/util/shape/VoxelShape;")) + private VoxelShape onComputeNextCollisionBox(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + CollisionShapeEvent event = MeteorClient.EVENT_BUS.post(CollisionShapeEvent.get(state, pos, state.getCollisionShape(world, pos, context))); + return event.isCancelled() ? VoxelShapes.empty() : event.shape; + } +} diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Jesus.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Jesus.java index 3838d3f4a7..ec7e1fed85 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Jesus.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Jesus.java @@ -213,7 +213,8 @@ else if ((event.fluidState.getFluid() == Fluids.LAVA || event.fluidState.getFlui @EventHandler private void onFluidCollisionShape(CollisionShapeEvent event) { - if (event.type != CollisionShapeEvent.CollisionType.FLUID) return; + if (event.state.getFluidState().isEmpty()) return; + if (event.state.getMaterial() == Material.WATER && !mc.player.isTouchingWater() && waterShouldBeSolid()) { event.shape = VoxelShapes.fullCube(); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Collisions.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Collisions.java index d53feaa2b1..0c441ba7c5 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Collisions.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/world/Collisions.java @@ -61,7 +61,7 @@ public Collisions() { @EventHandler private void onCollisionShape(CollisionShapeEvent event) { if (mc.world == null || mc.player == null) return; - if (event.type != CollisionShapeEvent.CollisionType.BLOCK) return; + if (!event.state.getFluidState().isEmpty()) return; if (blocks.get().contains(event.state.getBlock())) { event.shape = VoxelShapes.fullCube(); } else if (magma.get() && !mc.player.isSneaking() diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 144e9f94b6..1a1a711a16 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -28,7 +28,8 @@ "meteor-client-baritone.mixins.json", "meteor-client-indigo.mixins.json", "meteor-client-sodium.mixins.json", - "meteor-client-canvas.mixins.json" + "meteor-client-canvas.mixins.json", + "meteor-client-lithium.mixins.json" ], "accessWidener": "meteor-client.accesswidener", "custom": { diff --git a/src/main/resources/meteor-client-lithium.mixins.json b/src/main/resources/meteor-client-lithium.mixins.json new file mode 100644 index 0000000000..53450f38f3 --- /dev/null +++ b/src/main/resources/meteor-client-lithium.mixins.json @@ -0,0 +1,12 @@ +{ + "required": false, + "package": "meteordevelopment.meteorclient.mixin.lithium", + "compatibilityLevel": "JAVA_17", + "plugin": "meteordevelopment.meteorclient.MixinPlugin", + "client": [ + "ChunkAwareBlockCollisionSweeperMixin" + ], + "injectors": { + "defaultRequire": 1 + } +} From 5d51cb6e9a2a3576a15a0fc842f4632cb299c671 Mon Sep 17 00:00:00 2001 From: MineGame159 Date: Thu, 16 Mar 2023 19:13:11 +0100 Subject: [PATCH 132/135] Future version 0.5.3 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index dd457fd768..013261ef8d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ loader_version=0.14.11 fapi_version=0.75.1+1.19.3 # Mod Properties -mod_version=0.5.2 +mod_version=0.5.3 maven_group=meteordevelopment archives_base_name=meteor-client From b0d1686255fe8957e1e4361fd4eedf60cd1f5c04 Mon Sep 17 00:00:00 2001 From: Big Iron <52252627+Big-Iron-Cheems@users.noreply.github.com> Date: Sat, 18 Mar 2023 13:12:45 +0100 Subject: [PATCH 133/135] 1.19.4 update (#3451) --- gradle.properties | 12 ++--- gradle/wrapper/gradle-wrapper.jar | Bin 59536 -> 60756 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 16 +++++-- gradlew.bat | 14 +++--- .../events/packets/PacketEvent.java | 2 +- .../settings/PacketBoolSettingScreen.java | 2 +- .../meteorclient/gui/widgets/WItem.java | 17 ++++--- .../gui/widgets/WItemWithLabel.java | 7 ++- .../mixin/BannerBlockEntityRendererMixin.java | 2 +- .../mixin/BeaconBlockEntityRendererMixin.java | 2 +- .../mixin/BlockCollisionSpliteratorMixin.java | 2 +- .../mixin/BlockRenderManagerMixin.java | 2 - .../mixin/ChunkSkyLightProviderMixin.java | 1 - .../mixin/ClientConnectionMixin.java | 6 +-- .../mixin/ClientPlayNetworkHandlerMixin.java | 2 +- .../mixin/ClientPlayerEntityMixin.java | 4 +- ...chantingTableBlockEntityRendererMixin.java | 2 +- .../meteorclient/mixin/GameRendererMixin.java | 4 +- .../mixin/HeldItemRendererMixin.java | 2 +- .../meteorclient/mixin/InGameHudMixin.java | 14 +++--- .../mixin/ItemEntityRendererMixin.java | 2 +- .../meteorclient/mixin/ItemRendererMixin.java | 8 ++-- .../MobSpawnerBlockEntityRendererMixin.java | 2 +- .../mixin/PlayerArmorSlotMixin.java | 1 - .../meteorclient/mixin/PlayerEntityMixin.java | 6 +++ .../mixin/PlayerListHudMixin.java | 2 +- .../mixin/StarscriptAccessor.java | 7 --- .../meteorclient/mixin/StringHelperMixin.java | 1 - .../meteorclient/mixin/TitleScreenMixin.java | 2 +- .../meteorclient/mixin/WorldAccessor.java | 7 --- .../mixin/WorldRendererMixin.java | 4 +- .../renderer/text/VanillaTextRenderer.java | 3 +- .../settings/PacketListSetting.java | 2 +- .../systems/hud/elements/CombatHud.java | 4 +- .../systems/hud/elements/InventoryHud.java | 4 +- .../systems/hud/elements/ItemHud.java | 14 +++--- .../systems/hud/elements/PlayerModelHud.java | 5 +- .../systems/hud/elements/PotionTimersHud.java | 2 +- .../systems/modules/combat/AnchorAura.java | 5 +- .../systems/modules/combat/ArrowDodge.java | 2 +- .../systems/modules/combat/KillAura.java | 5 +- .../systems/modules/misc/InventoryTweaks.java | 4 +- .../systems/modules/misc/PacketCanceller.java | 2 +- .../systems/modules/movement/BoatFly.java | 2 +- .../systems/modules/movement/EntitySpeed.java | 2 +- .../systems/modules/movement/Flight.java | 21 +++++--- .../systems/modules/movement/Jesus.java | 2 +- .../systems/modules/movement/Scaffold.java | 2 +- .../systems/modules/movement/Step.java | 8 ++-- .../systems/modules/player/GhostHand.java | 4 +- .../modules/render/BetterTooltips.java | 4 +- .../systems/modules/render/ItemPhysics.java | 4 +- .../modules/render/WaypointsModule.java | 2 +- .../utils/network/PacketUtils.java | 2 +- .../utils/network/PacketUtilsUtil.java | 4 +- .../utils/player/DamageUtils.java | 10 ++-- .../meteorclient/utils/player/PathFinder.java | 2 +- .../utils/render/ContainerButtonWidget.java | 45 ------------------ .../utils/render/MeteorToast.java | 2 +- .../utils/render/RenderUtils.java | 14 +++--- .../utils/render/WireframeEntityRenderer.java | 4 +- .../utils/tooltip/BannerTooltipComponent.java | 4 +- .../utils/tooltip/BookTooltipComponent.java | 6 +-- .../tooltip/ContainerTooltipComponent.java | 4 +- .../utils/tooltip/EntityTooltipComponent.java | 4 +- .../utils/tooltip/MapTooltipComponent.java | 6 +-- .../meteorclient/utils/world/BlockUtils.java | 2 +- src/main/resources/fabric.mod.json | 4 +- 69 files changed, 170 insertions(+), 203 deletions(-) delete mode 100644 src/main/java/meteordevelopment/meteorclient/mixin/StarscriptAccessor.java delete mode 100644 src/main/java/meteordevelopment/meteorclient/utils/render/ContainerButtonWidget.java diff --git a/gradle.properties b/gradle.properties index 013261ef8d..8f17c3db53 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,10 +1,10 @@ org.gradle.jvmargs=-Xmx2G # Fabric (https://fabricmc.net/develop) -minecraft_version=1.19.3 -yarn_mappings=1.19.3+build.2 -loader_version=0.14.11 -fapi_version=0.75.1+1.19.3 +minecraft_version=1.19.4 +yarn_mappings=1.19.4+build.1 +loader_version=0.14.17 +fapi_version=0.75.3+1.19.4 # Mod Properties mod_version=0.5.3 @@ -14,10 +14,10 @@ archives_base_name=meteor-client # Dependency Versions # Sodium (https://github.com/CaffeineMC/sodium-fabric) -sodium_version=mc1.19.3-0.4.9 +sodium_version=mc1.19.4-0.4.10 # Lithium (https://github.com/CaffeineMC/lithium-fabric) -lithium_version=mc1.19.3-0.10.4 +lithium_version=mc1.19.4-0.11.1 # Orbit (https://github.com/MeteorDevelopment/orbit) orbit_version=0.2.3 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180f2ae8848c63b8b4dea2cb829da983f2fa..249e5832f090a2944b7473328c07c9755baa3196 100644 GIT binary patch delta 10158 zcmaKSbyOWsmn~e}-QC?axCPf>!2<-jxI0|j{UX8L-QC?axDz};a7}ppGBe+Nv*x{5 zy?WI?=j^WT(_Md5*V*xNP>X9&wM>xUvNiMuKDK=Xg!N%oM>Yru2rh7#yD-sW0Ov#$ zCKBSOD3>TM%&1T5t&#FK@|@1f)Ze+EE6(7`}J(Ek4})CD@I+W;L{ zO>K;wokKMA)EC6C|D@nz%D2L3U=Nm(qc>e4GM3WsHGu-T?l^PV6m-T-(igun?PZ8U z{qbiLDMcGSF1`FiKhlsV@qPMRm~h9@z3DZmWp;Suh%5BdP6jqHn}$-gu`_xNg|j{PSJ0n$ zbE;Azwq8z6IBlgKIEKc4V?*##hGW#t*rh=f<;~RFWotXS$vr;Mqz>A99PMH3N5BMi zWLNRjc57*z`2)gBV0o4rcGM(u*EG8_H5(|kThAnp|}u2xz>>X6tN zv)$|P2Nr1D*fk4wvqf(7;NmdRV3eL{!>DO-B98(s*-4$g{)EnRYAw+DP-C`=k)B!* zHU7!ejcbavGCYuz9k@$aZQaU%#K%6`D}=N_m?~^)IcmQZun+K)fSIoS>Ws zwvZ%Rfmw>%c!kCd~Pmf$E%LCj2r>+FzKGDm+%u88|hHprot{*OIVpi`Vd^^aumtx2L}h} zPu$v~zdHaWPF<`LVQX4i7bk82h#RwRyORx*z3I}o&>>eBDCif%s7&*vF6kU%1` zf(bvILch^~>cQ{=Y#?nx(8C-Uuv7!2_YeCfo?zkP;FK zX+KdjKS;HQ+7 zj>MCBI=d$~9KDJ1I2sb_3=T6D+Mu9{O&vcTnDA(I#<=L8csjEqsOe=&`=QBc7~>u2 zfdcO44PUOST%PcN+8PzKFYoR0;KJ$-Nwu#MgSM{_!?r&%rVM}acp>53if|vpH)q=O z;6uAi__am8g$EjZ33?PmCrg@(M!V_@(^+#wAWNu&e3*pGlfhF2<3NobAC zlusz>wMV--3ytd@S047g)-J@eOD;DMnC~@zvS=Gnw3=LnRzkeV`LH4#JGPklE4!Q3 zq&;|yGR0FiuE-|&1p2g{MG!Z3)oO9Jf4@0h*3!+RHv=SiEf*oGQCSRQf=LqT5~sajcJ8XjE>E*@q$n z!4|Rz%Lv8TgI23JV6%)N&`Otk6&RBdS|lCe7+#yAfdyEWNTfFb&*S6-;Q}d`de!}*3vM(z71&3 z37B%@GWjeQ_$lr%`m-8B&Zl4Gv^X{+N{GCsQGr!LLU4SHmLt3{B*z-HP{73G8u>nK zHxNQ4eduv>lARQfULUtIlLx#7ea+O;w?LH}FF28c9pg#*M`pB~{jQmPB*gA;Hik#e zZpz&X#O}}r#O_#oSr4f`zN^wedt>ST791bAZ5(=g<Oj)m9X8J^>Th}fznPY0T zsD9ayM7Hrlb6?jHXL<{kdA*Q#UPCYce0p`fHxoZ7_P`cF-$1YY9Pi;0QFt{CCf%C# zuF60A_NTstTQeFR3)O*ThlWKk08}7Nshh}J-sGY=gzE!?(_ZI4ovF6oZ$)&Zt~WZi z_0@Bk!~R4+<&b6CjI{nGj+P{*+9}6;{RwZ7^?H)xjhiRi;?A|wb0UxjPr?L@$^v|0= z@6d3+eU|&re3+G*XgFS}tih3;>2-R1x>`2hmUb5+Z~eM4P|$ zAxvE$l@sIhf_#YLnF|Wcfp(Gh@@dJ-yh|FhKqsyQp_>7j1)w|~5OKETx2P$~`}5huK;{gw_~HXP6=RsG)FKSZ=VYkt+0z&D zr?`R3bqVV?Zmqj&PQ`G3b^PIrd{_K|Hhqt zAUS#|*WpEOeZ{@h*j6%wYsrL`oHNV=z*^}yT1NCTgk1-Gl(&+TqZhODTKb9|0$3;| z;{UUq7X9Oz`*gwbi|?&USWH?Fr;6=@Be4w=8zu>DLUsrwf+7A`)lpdGykP`^SA8{ok{KE3sM$N@l}kB2GDe7MEN? zWcQ2I0fJ1ZK%s-YKk?QbEBO6`C{bg$%le0FTgfmSan-Kih0A7)rGy|2gd)_gRH7qp z*bNlP0u|S^5<)kFcd&wQg*6QP5;y(3ZgI%vUgWk#`g!sMf`02>@xz{Ie9_-fXllyw zh>P%cK+-HkQ;D$Jh=ig(ASN^zJ7|q*#m;}2M*T#s0a^nF_>jI(L(|*}#|$O&B^t!W zv-^-vP)kuu+b%(o3j)B@do)n*Y0x%YNy`sYj*-z2ncYoggD6l z6{1LndTQUh+GCX;7rCrT z@=vy&^1zyl{#7vRPv;R^PZPaIks8okq)To8!Cks0&`Y^Xy5iOWC+MmCg0Jl?1ufXO zaK8Q5IO~J&E|<;MnF_oXLc=LU#m{6yeomA^Ood;)fEqGPeD|fJiz(`OHF_f*{oWJq z1_$NF&Mo7@GKae#f4AD|KIkGVi~ubOj1C>>WCpQq>MeDTR_2xL01^+K1+ zr$}J>d=fW{65hi2bz&zqRKs8zpDln z*7+Gtfz6rkgfj~#{MB=49FRP;ge*e0=x#czw5N{@T1{EAl;G&@tpS!+&2&Stf<%<+55R18u2%+}`?PZo8xg|Y9Xli(fSQyC7 z+O5{;ZyW$!eYR~gy>;l6cA+e`oXN6a6t(&kUkWus*Kf<m$W7L)w5uXYF)->OeWMSUVXi;N#sY zvz4c?GkBU{D;FaQ)9|HU7$?BX8DFH%hC11a@6s4lI}y{XrB~jd{w1x&6bD?gemdlV z-+ZnCcldFanu`P=S0S7XzwXO(7N9KV?AkgZzm|J&f{l-Dp<)|-S7?*@HBIfRxmo1% zcB4`;Al{w-OFD08g=Qochf9=gb56_FPc{C9N5UAjTcJ(`$>)wVhW=A<8i#!bmKD#6~wMBak^2(p56d2vs&O6s4>#NB0UVr24K z%cw|-Yv}g5`_zcEqrZBaRSoBm;BuXJM^+W$yUVS9?u(`87t)IokPgC_bQ3g_#@0Yg zywb?u{Di7zd3XQ$y!m^c`6~t-7@g-hwnTppbOXckS-^N?w1`kRMpC!mfMY?K#^Ldm zYL>771%d{+iqh4a&4RdLNt3_(^^*{U2!A>u^b{7e@}Azd_PiZ>d~(@(Q@EYElLAx3LgQ5(ZUf*I%EbGiBTG!g#=t zXbmPhWH`*B;aZI)$+PWX+W)z?3kTOi{2UY9*b9bpSU!GWcVu+)!^b4MJhf=U9c?jj z%V)EOF8X3qC5~+!Pmmmd@gXzbycd5Jdn!N#i^50a$4u}8^O}DG2$w-U|8QkR-WU1mk4pF z#_imS#~c2~Z{>!oE?wfYc+T+g=eJL`{bL6=Gf_lat2s=|RxgP!e#L|6XA8w{#(Po(xk1~rNQ4UiG``U`eKy7`ot;xv4 zdv54BHMXIq;#^B%W(b8xt%JRueW5PZsB2eW=s3k^Pe1C$-NN8~UA~)=Oy->22yJ%e zu=(XD^5s{MkmWB)AF_qCFf&SDH%ytqpt-jgs35XK8Ez5FUj?uD3++@2%*9+-65LGQ zvu1eopeQoFW98@kzU{+He9$Yj#`vaQkqu%?1wCoBd%G=)TROYl2trZa{AZ@#^LARR zdzg-?EUnt9dK2;W=zCcVj18RTj-%w^#pREbgpD0aL@_v-XV2&Cd@JB^(}GRBU}9gV z6sWmVZmFZ9qrBN%4b?seOcOdOZ+6cx8-#R(+LYKJu~Y%pF5#85aF9$MnP7r^Bu%D? zT{b-KBujiy>7_*9{8u0|mTJ(atnnnS%qBDM_Gx5>3V+2~Wt=EeT4cXOdud$+weM(>wdBg+cV$}6%(ccP;`!~CzW{0O2aLY z?rQtBB6`ZztPP@_&`kzDzxc==?a{PUPUbbX31Vy?_(;c+>3q*!df!K(LQYZNrZ>$A*8<4M%e8vj1`%(x9)d~);ym4p zoo518$>9Pe| zZaFGj);h?khh*kgUI-Xvj+Dr#r&~FhU=eQ--$ZcOY9;x%&3U(&)q}eJs=)K5kUgi5 zNaI-m&4?wlwFO^`5l-B?17w4RFk(IKy5fpS0K%txp0qOj$e=+1EUJbLd-u>TYNna~ z+m?gU0~xlcnP>J>%m_y_*7hVMj3d&)2xV8>F%J;6ncm)ILGzF2sPAV|uYk5!-F%jL(53^51BKr zc3g7+v^w<4WIhk7a#{N6Ku_u{F`eo;X+u!C(lIaiY#*V5!sMed39%-AgV*`(nI)Im zemHE^2foBMPyIP<*yuD21{6I?Co?_{pqp-*#N6sZRQAzEBV4HQheOyZT5UBd)>G85 zw^xHvCEP4AJk<{v2kQQ;g;C)rCY=X!c8rNpNJ4mHETN}t1rwSe7=s8u&LzW-+6AEB z)LX0o7`EqC94HM{4p}d2wOwj2EB|O;?&^FeG9ZrT%c!J&x`Z3D2!cm(UZbFBb`+h ztfhjq75yuSn2~|Pc)p$Ul6=)}7cfXtBsvc15f&(K{jnEsw5Gh0GM^O=JC+X-~@r1kI$=FH=yBzsO#PxR1xU9+T{KuPx7sMe~GX zSP>AT3%(Xs@Ez**e@GAn{-GvB^oa6}5^2s+Mg~Gw?#$u&ZP;u~mP|FXsVtr>3k9O?%v>`Ha-3QsOG<7KdXlqKrsN25R|K<<;- z8kFY!&J&Yrqx3ptevOHiqPxKo_wwAPD)$DWMz{0>{T5qM%>rMqGZ!dJdK(&tP1#89 zVcu}I1I-&3%nMyF62m%MDpl~p)PM(%YoR zD)=W)E7kjwzAr!?^P*`?=fMHd1q4yjLGTTRUidem^Ocjrfgk2Jp|6SabEVHKC3c>RX@tNx=&Z7gC z0ztZoZx+#o36xH8mv6;^e{vU;G{JW17kn(RO&0L%q^fpWSYSkr1Cb92@bV->VO5P z;=V{hS5wcROQfbah6ND{2a$zFnj>@yuOcw}X~E20g7)5=Z#(y)RC878{_rObmGQ;9 zUy>&`YT^2R@jqR1z9Fx&x)WBstIE#*UhAa>WrMm<10={@$UN@Cog+#pxq{W@l0DOf zJGs^Jv?t8HgIXk(;NFHXun$J{{p})cJ^BWn4BeQo6dMNp%JO@$9z{(}qqEHuZOUQP zZiwo70Oa@lMYL(W*R4(!oj`)9kRggJns-A|w+XL=P07>QBMTEbG^gPS)H zu^@MFTFZtsKGFHgj|hupbK({r>PX3_kc@|4Jdqr@gyyKrHw8Tu<#0&32Hh?S zsVm_kQ2K`4+=gjw1mVhdOz7dI7V!Iu8J1LgI+_rF`Wgx5-XwU~$h>b$%#$U3wWC-ea0P(At2SjPAm57kd;!W5k{do1}X681o}`!c*(w!kCjtGTh7`=!M)$9 zWjTns{<-WX+Xi;&d!lyV&1KT9dKL??8)fu2(?Ox<^?EAzt_(#5bp4wAfgIADYgLU` z;J7f8g%-tfmTI1ZHjgufKcAT4SO(vx?xSo4pdWh`3#Yk;DqPGQE0GD?!_CfXb(E8WoJt6*Yutnkvmb?7H9B zVICAYowwxK;VM4(#~|}~Ooyzm*1ddU_Yg%Ax*_FcZm^AzYc$<+9bv;Eucr(SSF}*JsjTfb*DY>qmmkt z;dRkB#~SylP~Jcmr&Bl9TxHf^DcGUelG%rA{&s)5*$|-ww}Kwx-lWnNeghVm@z zqi3@-oJnN%r2O4t9`5I5Zfc;^ROHmY6C9 z1VRRX*1+aBlbO_p>B+50f1p&%?_A*16R0n+l}HKWI$yIH3oq2`k4O?tEVd~a4~>iI zo{d}b8tr+$q<%%K%Ett*i|RAJEMnk9hU7LtL!lxOB45xO1g)ycDBd=NbpaE3j?Gw& z0M&xx13EkCgNHu%Z8rBLo93XH-zQUfF3{Iy>65-KSPniqIzF+?x$3>`L?oBOBeEsv zs_y7@7>IbS&w2Vju^#vBpPWQuUv=dDRGm(-MH|l+8T?vfgD;{nE_*-h?@D;GN>4hA z9{!G@ANfHZOxMq5kkoh4h*p3+zE7z$13ocDJR$XA*7uKtG5Cn_-ibn%2h{ z;J0m5aCjg(@_!G>i2FDAvcn5-Aby8b;J0u%u)!`PK#%0FS-C3(cq9J{V`DJEbbE|| zYpTDd+ulcjEd5`&v!?=hVgz&S0|C^We?2|>9|2T6?~nn^_CpLn&kuI|VG7_E{Ofu9 zAqe0Reuq5Zunlx@zyTqEL+ssT15X|Z0LUfZAr-i$1_SJ{j}BHmBm}s8{OgK3lm%4F zzC%jz!y!8WUJo2FLkU(mVh7-uzC+gcbkV^bM}&Y6=HTTca{!7ZSoB!)l|v<(3ly!jq&P5A2q(U5~h)))aj-`-6&aM~LBySnAy zA0{Z{FHiUb8rW|Yo%kQwi`Kh>EEE$0g7UxeeeVkcY%~87yCmSjYyxoqq(%Jib*lH; zz`t5y094U`k_o{-*U^dFH~+1I@GsgwqmGsQC9-Vr0X94TLhlV;Kt#`9h-N?oKHqpx zzVAOxltd%gzb_Qu{NHnE8vPp=G$#S)Y%&6drobF_#NeY%VLzeod delta 9041 zcmY*t@kVBCBP!g$Qih>$!M(|j-I?-C8+=cK0w!?cVWy9LXH zd%I}(h%K_>9Qvap&`U=={XcolW-VA%#t9ljo~WmY8+Eb|zcKX3eyx7qiuU|a)zU5cYm5{k5IAa3ibZf_B&=YT!-XyLap%QRdebT+PIcg$KjM3HqA3uZ5|yBj2vv8$L{#$>P=xi+J&zLILkooDarGpiupEiuy`9uy&>yEr95d)64m+~`y*NClGrY|5MLlv!)d5$QEtqW)BeBhrd)W5g1{S@J-t8_J1 zthp@?CJY}$LmSecnf3aicXde(pXfeCei4=~ZN=7VoeU|rEEIW^!UBtxGc6W$x6;0fjRs7Nn)*b9JW5*9uVAwi) zj&N7W;i<Qy80(5gsyEIEQm>_+4@4Ol)F?0{YzD(6V~e=zXmc2+R~P~< zuz5pju;(akH2+w5w!vnpoikD5_{L<6T`uCCi@_Uorr`L(8zh~x!yEK*!LN02Q1Iri z>v*dEX<(+_;6ZAOIzxm@PbfY4a>ws4D82&_{9UHCfll!x`6o8*i0ZB+B#Ziv%RgtG z*S}<4!&COp)*ZMmXzl0A8mWA$)fCEzk$Wex*YdB}_-v|k9>jKy^Y>3me;{{|Ab~AL zQC(naNU=JtU3aP6P>Fm-!_k1XbhdS0t~?uJ$ZvLbvow10>nh*%_Kh>7AD#IflU8SL zMRF1fmMX#v8m=MGGb7y5r!Qf~Y}vBW}fsG<{1CHX7Yz z=w*V9(vOs6eO>CDuhurDTf3DVVF^j~rqP*7S-$MLSW7Ab>8H-80ly;9Q0BWoNV zz8Wr2CdK!rW0`sMD&y{Ue{`mEkXm0%S2k;J^iMe|sV5xQbt$ojzfQE+6aM9LWH`t& z8B;Ig7S<1Dwq`3W*w59L(opjq)ll4E-c?MivCh!4>$0^*=DKI&T2&j?;Z82_iZV$H zKmK7tEs7;MI-Vo(9wc1b)kc(t(Yk? z#Hgo8PG_jlF1^|6ge%;(MG~6fuKDFFd&}>BlhBTh&mmuKsn>2buYS=<5BWw^`ncCb zrCRWR5`IwKC@URU8^aOJjSrhvO>s}O&RBD8&V=Fk2@~zYY?$qO&!9%s>YecVY0zhK zBxKGTTyJ(uF`p27CqwPU1y7*)r}y;{|0FUO)-8dKT^>=LUoU_6P^^utg|* zuj}LBA*gS?4EeEdy$bn#FGex)`#y|vg77NVEjTUn8%t z@l|7T({SM!y$PZy9lb2N;BaF}MfGM%rZk10aqvUF`CDaC)&Av|eED$x_;qSoAka*2 z2rR+OTZTAPBx`vQ{;Z{B4Ad}}qOBqg>P4xf%ta|}9kJ2$od>@gyC6Bf&DUE>sqqBT zYA>(sA=Scl2C_EF8)9d8xwdBSnH5uL=I4hch6KCHj-{99IywUD{HR`d(vk@Kvl)WD zXC(v{ZTsyLy{rio*6Wi6Lck%L(7T~Is-F_`2R}q z!H1ylg_)Mv&_|b1{tVl!t{;PDa!0v6^Zqs_`RdxI%@vR)n|`i`7O<>CIMzqI00y{;` zhoMyy>1}>?kAk~ND6}`qlUR=B+a&bvA)BWf%`@N)gt@@Ji2`p1GzRGC$r1<2KBO3N z++YMLD9c|bxC;za_UVJ*r6&Ea;_YC>-Ebe-H=VAgDmx+?Q=DxCE4=yQXrn z7(0X#oIjyfZUd}fv2$;4?8y|0!L^ep_rMz|1gU-hcgVYIlI~o>o$K&)$rwo(KJO~R zDcGKo-@im7C<&2$6+q-xtxlR`I4vL|wFd<`a|T}*Nt;(~Vwx&2QG_j$r0DktR+6I4W)gUx*cDVBwGe00aa803ZYiwy;d{1p)y0?*IT8ddPS`E~MiS z1d%Vm0Hb4LN2*f8FZ|6xRQev@ZK-?(oPs+mT*{%NqhGL_0dJ$?rAxA{2 z`r3MBv&)xblcd>@hArncJpL~C(_HTo&D&CS!_J5Giz$^2EfR_)xjgPg`Bq^u%1C*+ z7W*HGp|{B?dOM}|E)Cs$61y8>&-rHBw;A8 zgkWw}r$nT%t(1^GLeAVyj1l@)6UkHdM!%LJg|0%BO74M593&LlrksrgoO{iEz$}HK z4V>WXgk|7Ya!Vgm#WO^ZLtVjxwZ&k5wT6RteViH3ds{VO+2xMJZ`hToOz~_+hRfY{ z%M;ZDKRNTsK5#h6goUF(h#VXSB|7byWWle*d0$IHP+FA`y)Q^5W!|&N$ndaHexdTn z{vf?T$(9b&tI&O`^+IqpCheAFth;KY(kSl2su_9|Y1B{o9`mm)z^E`Bqw!n+JCRO) zGbIpJ@spvz=*Jki{wufWm|m`)XmDsxvbJR5dLF=kuf_C>dl}{nGO(g4I$8 zSSW#5$?vqUDZHe_%`Zm?Amd^>I4SkBvy+i}wiQYBxj0F1a$*%T+6}Yz?lX&iQ}zaU zI@%8cwVGtF3!Ke3De$dL5^j-$Bh3+By zrSR3c2a>XtaE#TB}^#hq@!vnZ1(An#bk_eKR{?;Z&0cgh4$cMNU2HL=m=YjMTI zT$BRltXs4T=im;Ao+$Bk3Dz(3!C;rTqelJ?RF)d~dP9>$_6dbz=_8#MQFMMX0S$waWxY#mtDn}1U{4PGeRH5?a>{>TU@1UlucMAmzrd@PCwr|il)m1fooO7Z{Vyr z6wn=2A5z(9g9-OU10X_ei50@~)$}w4u)b+mt)z-sz0X32m}NKTt4>!O{^4wA(|3A8 zkr(DxtMnl$Hol>~XNUE?h9;*pGG&kl*q_pb z&*$lH70zI=D^s)fU~A7cg4^tUF6*Oa+3W0=7FFB*bf$Kbqw1&amO50YeZM)SDScqy zTw$-M$NA<_We!@4!|-?V3CEPnfN4t}AeM9W$iSWYz8f;5H)V$pRjMhRV@Z&jDz#FF zXyWh7UiIc7=0U9L35=$G54RjAupR&4j`(O3i?qjOk6gb!WjNtl1Fj-VmltDTos-Bl z*OLfOleS~o3`?l!jTYIG!V7?c<;Xu(&#~xf-f(-jwow-0Hv7JZG>}YKvB=rRbdMyv zmao*-!L?)##-S#V^}oRm7^Db zT5C2RFY4>ov~?w!3l_H}t=#X=vY-*LQy(w>u%r`zQ`_RukSqIv@WyGXa-ppbk-X=g zyn?TH(`-m*in(w=Ny$%dHNSVxsL|_+X=+kM+v_w{ZC(okof9k1RP5qDvcA-d&u{5U z?)a9LXht1f6|Tdy5FgXo;sqR|CKxDKruU9RjK~P6xN+4;0eAc|^x%UO^&NM4!nK_! z6X14Zkk=5tqpl&d6FYuMmlLGQZep0UE3`fT>xzgH>C*hQ2VzCQlO`^kThU6q%3&K^ zf^kfQm|7SeU#c%f8e?A<9mALLJ-;)p_bv6$pp~49_o;>Y=GyUQ)*prjFbkU;z%HkOW_*a#j^0b@GF|`6c}7>=W{Ef!#dz5lpkN>@IH+(sx~QMEFe4 z1GeKK67;&P%ExtO>}^JxBeHii)ykX8W@aWhJO!H(w)DH4sPatQ$F-Phiqx_clj`9m zK;z7X6gD2)8kG^aTr|oY>vmgOPQ4`_W+xj2j!$YT9x(DH6pF~ zd_C#8c>Gfb)k2Ku4~t=Xb>T^8KW;2HPN#%}@@hC1lNf~Xk)~oj=w-Y11a@DtIyYk8 z9^|_RIAA(1qUSs3rowxr&OuRVFL8(zSqU_rGlqHpkeYT4z7DGdS0q4V-b!3fsv$Yb zPq4UP^3XFd(G%JAN|0y>?&sLzNir30K(lyzNYvCtE2gDyy-nthPlrXXU75fhoS7kA zg%GYyBEFQ(xgdjtv+>?>Q!G!8& z3+F>)4|N+F1a^T?XC8 zxRRx7-{DV%uUYt&*$z2uQTbZDbUn)PozID*(i^{JDjNq`v?;&OW^&~{ZPE_e+?RMk z!7O5CUKJSnGZvjTbLX2$zwYRZs_$f{T!hvVHuTg77|O;zBHlA|GIUu_bh4`Bl?7KE zYB~a`b?O;0SfD?0EZiPYpVf=P4=|zr(u_w}oP0S`YOZziX9cuwpll&%QMv4bBC_JdP#rT3>MliqySv0& zh)r=vw?no&;5T}QVTkHKY%t`%{#*#J;aw!wPs}?q2$(e0Y#cdBG1T09ypI@#-y24+fzhJem1NSZ$TCAjU2|ebYG&&6p(0f>wQoNqVa#6J^W!3$gIWEw7d<^k!U~O5v=8goq$jC`p8CS zrox#Jw3w`k&Ty7UVbm35nZ}FYT5`fN)TO6R`tEUFotxr^BTXZGt|n(Ymqmr^pCu^^w?uX!ONbm?q{y9FehdmcJuV8V%A-ma zgl=n9+op{wkj-}N;6t;(JA1A#VF3S9AFh6EXRa0~7qop~3^~t1>hc6rdS_4!+D?Xh z5y?j}*p@*-pmlTb#7C0x{E(E@%eepK_YycNkhrYH^0m)YR&gRuQi4ZqJNv6Rih0zQ zqjMuSng>Ps;?M0YVyh<;D3~;60;>exDe)Vq3x@GRf!$wgFY5w4=Jo=g*E{76%~jqr zxTtb_L4Cz_E4RTfm@0eXfr1%ho?zP(>dsRarS>!^uAh~bd0lEhe2x7AEZQmBc%rU; z&FUrs&mIt8DL`L4JpiFp3NNyk3N>iL6;Nohp*XbZZn%BDhF_y{&{X3UtX(7aAyG63P zELC;>2L`jnFS#vC->A(hZ!tGi7N7^YtW7-LB6!SVdEM&7N?g}r4rW2wLn{Ni*I~$Y z@#;KwJIl0^?eX{JWiHQxDvccnNKBhHW0h6`j=)OH1`)7)69B$XNT@)l1s25M+~o2_ zpa&X<_vHxN_oR|B#ir2p*VNB~o6Z1OE&~a+_|AxS)(@Dgznq(b(|K8BN_nQ7+>N`= zXOx_@AhcmmcRvp6eX#4z6sn=V0%KonKFVY@+m&)Rx!Z5U@WdyHMCF4_qzJNpzc9Fw z7Bdzx54(e7>wcEqHKqH-Paiut;~ZVJpS6_q>ub)zD#TQ4j*i(I8DvS$BfyX~A%<#} z*=g2$8s;YYjEHl`7cKw!a9PFRt8tVR zM&X|bs?B1#ycjl>AzgbdRkr-@NmBc^ys)aoT75F(yweV&Y-3hNNXj-valA&=)G{NL zX?smr5sQWi3n;GGPW{%vW)xw-#D0QY%zjXxYj?($b4JzpW0sWY!fkwC5bJMkhTp$J z6CNVLd=-Ktt7D<^-f|=wjNjf0l%@iu2dR+zdQ&9NLa(B_okKdRy^!Q!F$Ro=hF$-r z!3@ocUs^7?cvdTMPbn*8S-o!PsF;>FcBkBkg&ET`W`lp?j`Z}4>DF|}9407lK9y~^No&pT7J|rVQ9Dh>qg|%=gxxg=! z>WX$!;7s~gDPmPF<--(?CvEnvV*E1KdXpr>XVv!DN~PyISE7d+K_9+W^pnR6cX&?E ziLr{0`JIs@NcA|;8L|p!3H~9y8mga2Dsm4I?rBS7$3wcT!_l*$^8U3hKUri|_I3N2 zz$xY`)IWA7P*Y1BJtyBEh?8EEvs8Oyl^{(+`gi{9hwpcN#I%Z0j$^yBp?z<;Ny!G$ zra3J_^i0(~LiKuITs%v)qE+YrJr?~w+)`Rcte^O=nwmPg@&!Q7FGTtjpTdI6wH&ZV z)2}VZY6(MbP`tgoew++(pt$jVj- zvPK)pSJ)U(XfUqBqZNo|za#Xx+IVEb?HGQ^wUVH&wTdWgP(z#ijyvXjwk>tFBUn*2 zuj5ENQjT{2&T`k;q54*Z>O~djuUBNwc6l(BzY?Ed4SIt9QA&8+>qaRIck?WdD0rh@ zh`VTZPwSNNCcLH3J}(q zdEtu@HfxDTpEqWruG=86m;QVO{}E&q8qYWhmA>(FjW`V&rg!CEL1oZCZcAX@yX(2tg8`>m1psG0ZpO+Rnph@Bhjj!~|+S=@+U{*ukwGrBj{5xfIHHP7|} z^7@g2;d%FMO8f(MS&6c##mrX2i(5uiX1o(=Vw89IQcHw)n{ZTS@``xT$Af@CQTP#w zl3kn6+MJP+l(;K-rWgjpdBU|CB4>W%cObZBH^Am~EvRO%D>uU^HVRXi$1 zb?Pr~ZlopLfT5l%03SjI7>YiGZZs=n(A!c;N9%%aByY~5(-hS4z_i2wgKYsG%OhhxH#^5i%&9ESb(@# zV_f5${Gf=$BK)1VY=NX#f+M}6f`OWmpC*OU3&+P@n>$Xvco*Nm$c<=`S|lY6S}Ut- z80}ztIpkV>W%^Ox`enpk<25_i7`RPiDugxHfUDBD8$bp9XR15>a?r^#&!1Ne6n{MI z){H`!jwrx}8b-w@@E8H0v)l!5!W8En=u67v+`iNoz<_h4{V*qQK+@)JP^JqsKAedZ zNh4toE+I7;^}7kkj|hzNVFWkZ$N9rxPl9|_@2kbW*4}&o%(L`WpQCN2M?gz>cyWHk zulMwRxpdpx+~P(({@%UY20LwM7sA&1M|`bEoq)Id zyUHt>@vfu**UOL9wiW*C75cc&qBX37qLd`<;$gS+mvL^v3Z8i4p6(@Wv`N|U6Exn< zd`@WxqU^8u^Aw+uw#vuDEIByaD)vucU2{4xRseczf_TJXUwaUK+E_IoItXJq88${0 z=K5jGehPa2)CnH&Lcxv&1jQ=T8>*vgp1^%)c&C2TL69;vSN)Q)e#Hj7!oS0 zlrEmJ=w4N9pID5KEY5qz;?2Q}0|4ESEio&cLrp221LTt~j3KjUB`LU?tP=p;B=WSXo;C?8(pnF6@?-ZD0m3DYZ* z#SzaXh|)hmTC|zQOG>aEMw%4&2XU?prlk5(M3ay-YC^QLRMN+TIB*;TB=wL_atpeD zh-!sS%A`3 z=^?niQx+^za_wQd2hRR=hsR0uzUoyOcrY!z7W)G2|C-_gqc`wrG5qCuU!Z?g*GL^H z?j^<_-A6BC^Dp`p(i0!1&?U{YlF@!|W{E@h=qQ&5*|U~V8wS;m!RK(Q6aX~oH9ToE zZYKXZoRV~!?P1ADJ74J-PFk2A{e&gh2o)@yZOZuBi^0+Hkp`dX;cZs9CRM+##;P!*BlA%M48TuR zWUgfD1DLsLs+-4XC>o>wbv-B)!t*47ON5wgoMX%llnmXG%L8209Vi;yZ`+N2v2Ox+ zMe7JHunQE$ckHHhEYRA+e`A3=XO5L%fMau71`XL7v)b{f1rkTY+WWSIkH#sG=pLqe zA(xZIp>_=4$zKq0t_G7q9@L zZ5D-0{8o%7f>0szA#c;rjL;4Y%hl}wYrx1R`Viq|Pz}c-{{LJY070ym@E~mt*pTyG z79bfcWTGGEje;PLD;N-XHw=`wS^howfzb$%oP8n)lN$o$ZWjZx|6iSsi2piI_7s7z zX#b$@z6kIJ^9{-Y^~wJ!s0V^Td5V7#4&pyU#NHw#9)N&qbpNFDR1jqC00W}91OnnS z{$J@GBz%bka`xsz;rb_iJ|rgmpUVyEZ)Xi*SO5U&|NFkTHb3y@e@%{WrvE&Jp#Lw^ zcj13CbsW+V>i@rj@SEfFf0@yjS@nbPB0)6D`lA;e%61nh`-qhydO!uS7jXGQd%i7opEnOL;| zDn!3EUm(V796;f?fA+RDF<@%qKlo)`0VtL74`!~516_aogYP%QfG#<2kQ!pijthz2 zpaFX3|D$%C7!bL242U?-e@2QZ`q$~lgZbvgfLLyVfT1OC5<8@6lLi=A{stK#zJmWd zlx+(HbgX)l$RGwH|2rV@P3o@xCrxch0$*z1ASpy(n+d4d2XWd~2AYjQm`xZU3af8F p+x$Nxf1895@0bJirXkdpJh+N7@Nb7x007(DEB&^Lm}dWn{T~m64-^0Z diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae04661ee7..e1bef7e873 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index c53aefaa5f..a69d9cb6c2 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright � 2015-2021 the original authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,10 +32,10 @@ # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: # * functions; -# * expansions �$var�, �${var}�, �${var:-default}�, �${var+SET}�, -# �${var#prefix}�, �${var%suffix}�, and �$( cmd )�; -# * compound commands having a testable exit status, especially �case�; -# * various built-in commands including �command�, �set�, and �ulimit�. +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». # # Important for patching: # @@ -205,6 +205,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd32c4..f127cfd49d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/src/main/java/meteordevelopment/meteorclient/events/packets/PacketEvent.java b/src/main/java/meteordevelopment/meteorclient/events/packets/PacketEvent.java index db2faa63fa..bac2ba9376 100644 --- a/src/main/java/meteordevelopment/meteorclient/events/packets/PacketEvent.java +++ b/src/main/java/meteordevelopment/meteorclient/events/packets/PacketEvent.java @@ -6,7 +6,7 @@ package meteordevelopment.meteorclient.events.packets; import meteordevelopment.meteorclient.events.Cancellable; -import net.minecraft.network.Packet; +import net.minecraft.network.packet.Packet; public class PacketEvent extends Cancellable { public Packet packet; diff --git a/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/PacketBoolSettingScreen.java b/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/PacketBoolSettingScreen.java index f899199bb9..c88d59137f 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/PacketBoolSettingScreen.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/screens/settings/PacketBoolSettingScreen.java @@ -10,7 +10,7 @@ import meteordevelopment.meteorclient.settings.PacketListSetting; import meteordevelopment.meteorclient.settings.Setting; import meteordevelopment.meteorclient.utils.network.PacketUtils; -import net.minecraft.network.Packet; +import net.minecraft.network.packet.Packet; import java.util.Set; import java.util.function.Predicate; diff --git a/src/main/java/meteordevelopment/meteorclient/gui/widgets/WItem.java b/src/main/java/meteordevelopment/meteorclient/gui/widgets/WItem.java index 88c1aff673..4a8f4071d7 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/widgets/WItem.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/widgets/WItem.java @@ -5,7 +5,6 @@ package meteordevelopment.meteorclient.gui.widgets; -import com.mojang.blaze3d.systems.RenderSystem; import meteordevelopment.meteorclient.gui.renderer.GuiRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; @@ -13,6 +12,8 @@ import static meteordevelopment.meteorclient.MeteorClient.mc; public class WItem extends WWidget { + private static final MatrixStack MATRICES = new MatrixStack(); + protected ItemStack itemStack; public WItem(ItemStack itemStack) { @@ -33,16 +34,14 @@ protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, doub renderer.post(() -> { double s = theme.scale(2); - MatrixStack matrices = RenderSystem.getModelViewStack(); - - matrices.push(); - matrices.scale((float) s, (float) s, 1); - matrices.translate(x / s, y / s, 0); + MATRICES.push(); + MATRICES.scale((float) s, (float) s, 1); + MATRICES.translate(x / s, y / s, 0); - mc.getItemRenderer().renderGuiItemIcon(itemStack, 0, 0); - mc.getItemRenderer().renderGuiItemOverlay(mc.textRenderer, itemStack, 0, 0); + mc.getItemRenderer().renderGuiItemIcon(MATRICES, itemStack, 0, 0); + mc.getItemRenderer().renderGuiItemOverlay(MATRICES, mc.textRenderer, itemStack, 0, 0); - matrices.pop(); + MATRICES.pop(); }); } } diff --git a/src/main/java/meteordevelopment/meteorclient/gui/widgets/WItemWithLabel.java b/src/main/java/meteordevelopment/meteorclient/gui/widgets/WItemWithLabel.java index 14a132a4b3..caaeeeed51 100644 --- a/src/main/java/meteordevelopment/meteorclient/gui/widgets/WItemWithLabel.java +++ b/src/main/java/meteordevelopment/meteorclient/gui/widgets/WItemWithLabel.java @@ -34,15 +34,20 @@ public void init() { private String getStringToAppend() { String str = ""; + if (itemStack.getItem() == Items.POTION) { List effects = PotionUtil.getPotion(itemStack).getEffects(); + if (effects.size() > 0) { str += " "; + StatusEffectInstance effect = effects.get(0); if (effect.getAmplifier() > 0) str += effect.getAmplifier() + 1 + " "; - str += "(" + StatusEffectUtil.durationToString(effect, 1) + ")"; + + str += "(" + StatusEffectUtil.durationToString(effect, 1).getString() + ")"; } } + return str; } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/BannerBlockEntityRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/BannerBlockEntityRendererMixin.java index e251cb20bb..c91b941616 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/BannerBlockEntityRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/BannerBlockEntityRendererMixin.java @@ -34,7 +34,7 @@ public class BannerBlockEntityRendererMixin { @Final @Shadow private ModelPart crossbar; - @Inject(method = "render", at = @At("HEAD"), cancellable = true) + @Inject(method = "render(Lnet/minecraft/block/entity/BannerBlockEntity;FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;II)V", at = @At("HEAD"), cancellable = true) private void render(BannerBlockEntity bannerBlockEntity, float f, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, int j, CallbackInfo ci) { if (bannerBlockEntity.getWorld() != null) { //Don't modify banners in item form NoRender.BannerRenderMode renderMode = Modules.get().get(NoRender.class).getBannerRenderMode(); diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/BeaconBlockEntityRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/BeaconBlockEntityRendererMixin.java index 32d90dacff..7d2dc86390 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/BeaconBlockEntityRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/BeaconBlockEntityRendererMixin.java @@ -18,7 +18,7 @@ @Mixin(BeaconBlockEntityRenderer.class) public class BeaconBlockEntityRendererMixin { - @Inject(method = "render", at = @At("HEAD"), cancellable = true) + @Inject(method = "render(Lnet/minecraft/block/entity/BeaconBlockEntity;FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;II)V", at = @At("HEAD"), cancellable = true) private void onRender(BeaconBlockEntity beaconBlockEntity, float f, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, int j, CallbackInfo info) { if (Modules.get().get(NoRender.class).noBeaconBeams()) info.cancel(); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/BlockCollisionSpliteratorMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/BlockCollisionSpliteratorMixin.java index 026acc0e73..c1c26a9240 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/BlockCollisionSpliteratorMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/BlockCollisionSpliteratorMixin.java @@ -20,7 +20,7 @@ @Mixin(BlockCollisionSpliterator.class) public class BlockCollisionSpliteratorMixin { - @Redirect(method = "computeNext", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;getCollisionShape(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/ShapeContext;)Lnet/minecraft/util/shape/VoxelShape;")) + @Redirect(method = "computeNext()Lnet/minecraft/util/shape/VoxelShape;", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;getCollisionShape(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/ShapeContext;)Lnet/minecraft/util/shape/VoxelShape;")) private VoxelShape onComputeNextCollisionBox(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { CollisionShapeEvent event = MeteorClient.EVENT_BUS.post(CollisionShapeEvent.get(state, pos, state.getCollisionShape(world, pos, context))); return event.isCancelled() ? VoxelShapes.empty() : event.shape; diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/BlockRenderManagerMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/BlockRenderManagerMixin.java index 6ebf6bdfd3..05ae764d48 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/BlockRenderManagerMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/BlockRenderManagerMixin.java @@ -21,10 +21,8 @@ @Mixin(BlockRenderManager.class) public class BlockRenderManagerMixin { - @Inject(method = "renderDamage", at = @At("HEAD"), cancellable = true) private void renderDamage(BlockState state, BlockPos pos, BlockRenderView world, MatrixStack matrix, VertexConsumer vertexConsumer, CallbackInfo info) { if (Modules.get().isActive(BreakIndicators.class) || Modules.get().get(NoRender.class).noBlockBreakOverlay()) info.cancel(); } - } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ChunkSkyLightProviderMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ChunkSkyLightProviderMixin.java index ce7a89806b..26bf7870d0 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ChunkSkyLightProviderMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ChunkSkyLightProviderMixin.java @@ -17,7 +17,6 @@ public class ChunkSkyLightProviderMixin { @Inject(at = @At("HEAD"), method = "recalculateLevel", cancellable = true) private void recalculateLevel(long long_1, long long_2, int int_1, CallbackInfoReturnable ci) { - if (Modules.get().get(NoRender.class).noSkylightUpdates()) { //return; ci.setReturnValue(15); diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ClientConnectionMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ClientConnectionMixin.java index 33cebf9864..06aa9f0384 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ClientConnectionMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ClientConnectionMixin.java @@ -14,7 +14,7 @@ import meteordevelopment.meteorclient.systems.modules.misc.AntiPacketKick; import meteordevelopment.meteorclient.systems.modules.world.HighwayBuilder; import net.minecraft.network.ClientConnection; -import net.minecraft.network.Packet; +import net.minecraft.network.packet.Packet; import net.minecraft.network.PacketEncoderException; import net.minecraft.network.listener.PacketListener; import net.minecraft.text.MutableText; @@ -50,12 +50,12 @@ private static void onConnect(InetSocketAddress address, boolean useEpoll, Callb MeteorClient.EVENT_BUS.post(ConnectToServerEvent.get()); } - @Inject(at = @At("HEAD"), method = "send(Lnet/minecraft/network/Packet;)V", cancellable = true) + @Inject(at = @At("HEAD"), method = "send(Lnet/minecraft/network/packet/Packet;)V", cancellable = true) private void onSendPacketHead(Packet packet, CallbackInfo info) { if (MeteorClient.EVENT_BUS.post(PacketEvent.Send.get(packet)).isCancelled()) info.cancel(); } - @Inject(method = "send(Lnet/minecraft/network/Packet;)V", at = @At("TAIL")) + @Inject(method = "send(Lnet/minecraft/network/packet/Packet;)V", at = @At("TAIL")) private void onSendPacketTail(Packet packet, CallbackInfo info) { MeteorClient.EVENT_BUS.post(PacketEvent.Sent.get(packet)); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayNetworkHandlerMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayNetworkHandlerMixin.java index a3927cd858..fc9413f4f8 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayNetworkHandlerMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayNetworkHandlerMixin.java @@ -106,7 +106,7 @@ private void onEntitiesDestroy(EntitiesDestroyS2CPacket packet, CallbackInfo ci) } } - @Inject(method = "onExplosion", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER)) + @Inject(method = "onExplosion", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER)) private void onExplosionVelocity(ExplosionS2CPacket packet, CallbackInfo ci) { Velocity velocity = Modules.get().get(Velocity.class); if (!velocity.explosions.get()) return; diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java index 515d77cd4e..7938565636 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayerEntityMixin.java @@ -89,7 +89,7 @@ private void onSendMovementPacketsHead(CallbackInfo info) { MeteorClient.EVENT_BUS.post(SendMovementPacketsEvent.Pre.get()); } - @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V", ordinal = 0)) + @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V", ordinal = 0)) private void onTickHasVehicleBeforeSendPackets(CallbackInfo info) { MeteorClient.EVENT_BUS.post(SendMovementPacketsEvent.Pre.get()); } @@ -99,7 +99,7 @@ private void onSendMovementPacketsTail(CallbackInfo info) { MeteorClient.EVENT_BUS.post(SendMovementPacketsEvent.Post.get()); } - @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V", ordinal = 1, shift = At.Shift.AFTER)) + @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V", ordinal = 1, shift = At.Shift.AFTER)) private void onTickHasVehicleAfterSendPackets(CallbackInfo info) { MeteorClient.EVENT_BUS.post(SendMovementPacketsEvent.Post.get()); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/EnchantingTableBlockEntityRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/EnchantingTableBlockEntityRendererMixin.java index 3ab3cb020d..695ee129cc 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/EnchantingTableBlockEntityRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/EnchantingTableBlockEntityRendererMixin.java @@ -17,7 +17,7 @@ @Mixin(EnchantingTableBlockEntityRenderer.class) public class EnchantingTableBlockEntityRendererMixin { - @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/model/BookModel;renderBook(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;IIFFFF)V")) + @Redirect(method = "render(Lnet/minecraft/block/entity/EnchantingTableBlockEntity;FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;II)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/model/BookModel;renderBook(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;IIFFFF)V")) private void onRenderBookModelRenderProxy(BookModel model, MatrixStack matrixStack, VertexConsumer vertexConsumer, int i, int j, float f, float g, float h, float k) { if (!Modules.get().get(NoRender.class).noEnchTableBook()) model.renderBook(matrixStack, vertexConsumer, i, j, f, g, h, k); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/GameRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/GameRendererMixin.java index 1e23a7f456..ce5b0fa3ba 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/GameRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/GameRendererMixin.java @@ -96,8 +96,8 @@ private HitResult updateTargetedEntityEntityRayTraceProxy(Entity entity, double return entity.raycast(maxDistance, tickDelta, includeFluids); } - @Inject(method = "bobViewWhenHurt", at = @At("HEAD"), cancellable = true) - private void onBobViewWhenHurt(MatrixStack matrixStack, float f, CallbackInfo info) { + @Inject(method = "tiltViewWhenHurt", at = @At("HEAD"), cancellable = true) + private void onTiltViewWhenHurt(MatrixStack matrixStack, float f, CallbackInfo info) { if (Modules.get().get(NoRender.class).noHurtCam()) info.cancel(); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/HeldItemRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/HeldItemRendererMixin.java index 7c6cdd65ad..9ab6a1520e 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/HeldItemRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/HeldItemRendererMixin.java @@ -44,7 +44,7 @@ private float modifySwing(float swingProgress) { return swingProgress; } - @Inject(method = "renderFirstPersonItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformation$Mode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V")) + @Inject(method = "renderFirstPersonItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V")) private void onRenderItem(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { MeteorClient.EVENT_BUS.post(HeldItemRendererEvent.get(hand, matrices)); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/InGameHudMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/InGameHudMixin.java index b2083f60f8..19d86cb108 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/InGameHudMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/InGameHudMixin.java @@ -58,22 +58,22 @@ private void onRenderStatusEffectOverlay(CallbackInfo info) { } @Inject(method = "renderPortalOverlay", at = @At("HEAD"), cancellable = true) - private void onRenderPortalOverlay(float f, CallbackInfo info) { + private void onRenderPortalOverlay(MatrixStack matrices, float f, CallbackInfo info) { if (Modules.get().get(NoRender.class).noPortalOverlay()) info.cancel(); } - @ModifyArgs(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;renderOverlay(Lnet/minecraft/util/Identifier;F)V", ordinal = 0)) + @ModifyArgs(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;renderOverlay(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/util/Identifier;F)V", ordinal = 0)) private void onRenderPumpkinOverlay(Args args) { - if (Modules.get().get(NoRender.class).noPumpkinOverlay()) args.set(1, 0f); + if (Modules.get().get(NoRender.class).noPumpkinOverlay()) args.set(2, 0f); } - @ModifyArgs(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;renderOverlay(Lnet/minecraft/util/Identifier;F)V", ordinal = 1)) + @ModifyArgs(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;renderOverlay(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/util/Identifier;F)V", ordinal = 1)) private void onRenderPowderedSnowOverlay(Args args) { - if (Modules.get().get(NoRender.class).noPowderedSnowOverlay()) args.set(1, 0f); + if (Modules.get().get(NoRender.class).noPowderedSnowOverlay()) args.set(2, 0f); } @Inject(method = "renderVignetteOverlay", at = @At("HEAD"), cancellable = true) - private void onRenderVignetteOverlay(Entity entity, CallbackInfo info) { + private void onRenderVignetteOverlay(MatrixStack matrices, Entity entity, CallbackInfo info) { if (Modules.get().get(NoRender.class).noVignette()) info.cancel(); } @@ -83,7 +83,7 @@ private void onRenderScoreboardSidebar(MatrixStack matrixStack, ScoreboardObject } @Inject(method = "renderSpyglassOverlay", at = @At("HEAD"), cancellable = true) - private void onRenderSpyglassOverlay(float scale, CallbackInfo info) { + private void onRenderSpyglassOverlay(MatrixStack matrices, float scale, CallbackInfo info) { if (Modules.get().get(NoRender.class).noSpyglassOverlay()) info.cancel(); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ItemEntityRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ItemEntityRendererMixin.java index 3d828e8e50..fe556b2b7c 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ItemEntityRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ItemEntityRendererMixin.java @@ -25,7 +25,7 @@ public abstract class ItemEntityRendererMixin { @Shadow @Final private Random random; @Shadow @Final private ItemRenderer itemRenderer; - @Inject(method = "render", at = @At("HEAD"), cancellable = true) + @Inject(method = "render(Lnet/minecraft/entity/ItemEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At("HEAD"), cancellable = true) private void render(ItemEntity itemEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo ci) { RenderItemEntityEvent event = MeteorClient.EVENT_BUS.post(RenderItemEntityEvent.get(itemEntity, f, g, matrixStack, vertexConsumerProvider, i, random, itemRenderer)); if (event.isCancelled()) ci.cancel(); diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/ItemRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/ItemRendererMixin.java index 3dc2b3fe99..fca37ed5ad 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/ItemRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/ItemRendererMixin.java @@ -13,7 +13,7 @@ import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.render.model.BakedModel; -import net.minecraft.client.render.model.json.ModelTransformation; +import net.minecraft.client.render.model.json.ModelTransformationMode; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; @@ -25,15 +25,15 @@ @Mixin(ItemRenderer.class) public class ItemRendererMixin { @ModifyArgs( - method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformation$Mode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/render/model/BakedModel;)V", + method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/render/model/BakedModel;)V", at = @At( value = "INVOKE", target = "Lnet/minecraft/client/render/item/ItemRenderer;renderBakedItemModel(Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/item/ItemStack;IILnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;)V" ) ) - private void modifyEnchant(Args args, ItemStack stack, ModelTransformation.Mode renderMode, boolean leftHanded, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, BakedModel model) { + private void modifyEnchant(Args args, ItemStack stack, ModelTransformationMode renderMode, boolean leftHanded, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, BakedModel model) { if (!Modules.get().get(NoRender.class).noEnchantGlint()) return; - boolean bl = (renderMode == ModelTransformation.Mode.GUI || renderMode.isFirstPerson() || !(stack.getItem() instanceof BlockItem blockItem) || !(blockItem.getBlock() instanceof TransparentBlock) && !(blockItem.getBlock() instanceof StainedGlassPaneBlock)); + boolean bl = (renderMode == ModelTransformationMode.GUI || renderMode.isFirstPerson() || !(stack.getItem() instanceof BlockItem blockItem) || !(blockItem.getBlock() instanceof TransparentBlock) && !(blockItem.getBlock() instanceof StainedGlassPaneBlock)); args.set(5, vertexConsumers.getBuffer(RenderLayers.getItemLayer(stack, bl))); } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/MobSpawnerBlockEntityRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/MobSpawnerBlockEntityRendererMixin.java index 37314c71a4..6f6313d1b9 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/MobSpawnerBlockEntityRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/MobSpawnerBlockEntityRendererMixin.java @@ -15,7 +15,7 @@ @Mixin(MobSpawnerBlockEntityRenderer.class) public class MobSpawnerBlockEntityRendererMixin { - @Inject(method = "render", at = @At("HEAD"), cancellable = true) + @Inject(method = "render(Lnet/minecraft/block/entity/MobSpawnerBlockEntity;FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;II)V", at = @At("HEAD"), cancellable = true) private void onRender(CallbackInfo ci) { if (Modules.get().get(NoRender.class).noMobInSpawner()) ci.cancel(); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerArmorSlotMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerArmorSlotMixin.java index e91e8f3981..e23fc32ab4 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerArmorSlotMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerArmorSlotMixin.java @@ -16,7 +16,6 @@ @Mixin(targets = "net/minecraft/screen/PlayerScreenHandler$1") public class PlayerArmorSlotMixin { - @Inject(method = "getMaxItemCount", at = @At("HEAD"), cancellable = true) private void onGetMaxItemCount(CallbackInfoReturnable cir) { if (Modules.get().get(InventoryTweaks.class).armorStorage()) cir.setReturnValue(64); diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityMixin.java index 1d2a5f0a5a..36d748e37d 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerEntityMixin.java @@ -10,6 +10,7 @@ import meteordevelopment.meteorclient.events.entity.player.ClipAtLedgeEvent; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.systems.modules.movement.Anchor; +import meteordevelopment.meteorclient.systems.modules.movement.Flight; import meteordevelopment.meteorclient.systems.modules.movement.NoSlow; import meteordevelopment.meteorclient.systems.modules.player.SpeedMine; import meteordevelopment.meteorclient.utils.world.BlockUtils; @@ -90,4 +91,9 @@ private void onGetMovementSpeed(CallbackInfoReturnable info) { } } + @Inject(method = "getOffGroundSpeed", at = @At("HEAD"), cancellable = true) + private void onGetOffGroundSpeed(CallbackInfoReturnable info) { + float speed = Modules.get().get(Flight.class).getOffGroundSpeed(); + if (speed != -1) info.setReturnValue(speed); + } } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerListHudMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerListHudMixin.java index 392b714d25..76cbec2240 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/PlayerListHudMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/PlayerListHudMixin.java @@ -21,7 +21,7 @@ @Mixin(PlayerListHud.class) public class PlayerListHudMixin { - @ModifyConstant(constant = @Constant(longValue = 80L), method = "render") + @ModifyConstant(constant = @Constant(longValue = 80L), method = "collectPlayerEntries") private long modifyCount(long count) { BetterTab module = Modules.get().get(BetterTab.class); diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/StarscriptAccessor.java b/src/main/java/meteordevelopment/meteorclient/mixin/StarscriptAccessor.java deleted file mode 100644 index f142235b0b..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/mixin/StarscriptAccessor.java +++ /dev/null @@ -1,7 +0,0 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.mixin;public interface StarscriptAccessor { -} diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/StringHelperMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/StringHelperMixin.java index f4daffb9a7..1375bbb0b8 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/StringHelperMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/StringHelperMixin.java @@ -14,7 +14,6 @@ @Mixin(StringHelper.class) public class StringHelperMixin { - @ModifyArg(method = "truncateChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/StringHelper;truncate(Ljava/lang/String;IZ)Ljava/lang/String;"), index = 1) private static int injected(int maxLength) { // this method is only used in one place, to truncate chat messages, so it's fine to do this return (Modules.get().get(BetterChat.class).isInfiniteChatBox() ? Integer.MAX_VALUE : maxLength); diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/TitleScreenMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/TitleScreenMixin.java index e3b501d669..5d6ceaff90 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/TitleScreenMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/TitleScreenMixin.java @@ -33,7 +33,7 @@ public TitleScreenMixin(Text title) { super(title); } - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/TitleScreen;drawStringWithShadow(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/font/TextRenderer;Ljava/lang/String;III)V", ordinal = 0)) + @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/TitleScreen;drawTextWithShadow(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/font/TextRenderer;Ljava/lang/String;III)V", ordinal = 0)) private void onRenderIdkDude(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo info) { if (Utils.firstTimeTitleScreen) { Utils.firstTimeTitleScreen = false; diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/WorldAccessor.java b/src/main/java/meteordevelopment/meteorclient/mixin/WorldAccessor.java index e6a248c9a6..2c61eb7a38 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/WorldAccessor.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/WorldAccessor.java @@ -7,19 +7,12 @@ import net.minecraft.entity.Entity; import net.minecraft.world.World; -import net.minecraft.world.chunk.BlockEntityTickInvoker; import net.minecraft.world.entity.EntityLookup; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.gen.Invoker; -import java.util.List; - @Mixin(World.class) public interface WorldAccessor { - @Accessor("blockEntityTickers") - List getBlockEntityTickers(); - @Invoker("getEntityLookup") EntityLookup getEntityLookup(); } diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/WorldRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/WorldRendererMixin.java index 5e08df776c..c6538a7396 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/WorldRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/WorldRendererMixin.java @@ -58,8 +58,8 @@ private void onRenderWeather(LightmapTextureManager manager, float f, double d, if (Modules.get().get(NoRender.class).noWeather()) info.cancel(); } - @Inject(method = "method_43788(Lnet/minecraft/client/render/Camera;)Z", at = @At("HEAD"), cancellable = true) - private void method_43788(Camera camera, CallbackInfoReturnable info) { + @Inject(method = "hasBlindnessOrDarkness(Lnet/minecraft/client/render/Camera;)Z", at = @At("HEAD"), cancellable = true) + private void hasBlindnessOrDarkness(Camera camera, CallbackInfoReturnable info) { if (Modules.get().get(NoRender.class).noBlindness() || Modules.get().get(NoRender.class).noDarkness()) info.setReturnValue(null); } diff --git a/src/main/java/meteordevelopment/meteorclient/renderer/text/VanillaTextRenderer.java b/src/main/java/meteordevelopment/meteorclient/renderer/text/VanillaTextRenderer.java index 6c5d6e62f3..5e41938cbc 100644 --- a/src/main/java/meteordevelopment/meteorclient/renderer/text/VanillaTextRenderer.java +++ b/src/main/java/meteordevelopment/meteorclient/renderer/text/VanillaTextRenderer.java @@ -7,6 +7,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import meteordevelopment.meteorclient.utils.render.color.Color; +import net.minecraft.client.font.TextRenderer.TextLayerType; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.LightmapTextureManager; import net.minecraft.client.render.VertexConsumerProvider; @@ -78,7 +79,7 @@ public double render(String text, double x, double y, Color color, boolean shado matrix = matrices.peek().getPositionMatrix(); } - double x2 = mc.textRenderer.draw(text, (float) (x / scale), (float) (y / scale), color.getPacked(), shadow, matrix, immediate, false, 0, LightmapTextureManager.MAX_LIGHT_COORDINATE); + double x2 = mc.textRenderer.draw(text, (float) (x / scale), (float) (y / scale), color.getPacked(), shadow, matrix, immediate, TextLayerType.NORMAL, 0, LightmapTextureManager.MAX_LIGHT_COORDINATE); if (scaleIndividually) matrices.pop(); diff --git a/src/main/java/meteordevelopment/meteorclient/settings/PacketListSetting.java b/src/main/java/meteordevelopment/meteorclient/settings/PacketListSetting.java index c1855775da..a115af1dee 100644 --- a/src/main/java/meteordevelopment/meteorclient/settings/PacketListSetting.java +++ b/src/main/java/meteordevelopment/meteorclient/settings/PacketListSetting.java @@ -11,7 +11,7 @@ import net.minecraft.nbt.NbtElement; import net.minecraft.nbt.NbtList; import net.minecraft.nbt.NbtString; -import net.minecraft.network.Packet; +import net.minecraft.network.packet.Packet; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/CombatHud.java b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/CombatHud.java index 70fa9f3b89..c86cd5c311 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/CombatHud.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/CombatHud.java @@ -19,7 +19,6 @@ import meteordevelopment.meteorclient.utils.entity.EntityUtils; import meteordevelopment.meteorclient.utils.entity.SortPriority; import meteordevelopment.meteorclient.utils.entity.TargetUtils; -import meteordevelopment.meteorclient.utils.misc.FakeClientPlayer; import meteordevelopment.meteorclient.utils.player.PlayerUtils; import meteordevelopment.meteorclient.utils.render.RenderUtils; import meteordevelopment.meteorclient.utils.render.color.Color; @@ -51,6 +50,8 @@ public class CombatHud extends HudElement { public static final HudElementInfo INFO = new HudElementInfo<>(Hud.GROUP, "combat", "Displays information about your combat target.", CombatHud::new); + private static final MatrixStack MATRICES = new MatrixStack(); + private final SettingGroup sgGeneral = settings.getDefaultGroup(); private final Setting scale = sgGeneral.add(new DoubleSetting.Builder() @@ -210,6 +211,7 @@ public void render(HudRenderer renderer) { // Player Model InventoryScreen.drawEntity( + MATRICES, (int) (x + (25 * scale.get())), (int) (y + (66 * scale.get())), (int) (30 * scale.get()), diff --git a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/InventoryHud.java b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/InventoryHud.java index de5c6fd289..d6de0054b7 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/InventoryHud.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/InventoryHud.java @@ -81,7 +81,7 @@ public void render(HudRenderer renderer) { drawBackground(renderer, (int) x, (int) y, drawColor); } - if (mc.player != null) { + renderer.post(() -> { for (int row = 0; row < 3; row++) { for (int i = 0; i < 9; i++) { int index = row * 9 + i; @@ -94,7 +94,7 @@ public void render(HudRenderer renderer) { RenderUtils.drawItem(stack, itemX, itemY, scale.get(), true); } } - } + }); } private void drawBackground(HudRenderer renderer, int x, int y, Color color) { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/ItemHud.java b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/ItemHud.java index 6231ce6d06..da75286de0 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/ItemHud.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/ItemHud.java @@ -24,6 +24,8 @@ public class ItemHud extends HudElement { public static HudElementInfo INFO = new HudElementInfo<>(Hud.GROUP, "item", "Displays the item count.", ItemHud::new); + private static final MatrixStack MATRICES = new MatrixStack(); + private final SettingGroup sgGeneral = settings.getDefaultGroup(); private final SettingGroup sgBackground = settings.createGroup("Background"); @@ -127,22 +129,22 @@ public void render(HudRenderer renderer) { private void render(ItemStack itemStack, int x, int y) { switch (noneMode.get()) { case HideItem -> { - mc.getItemRenderer().renderGuiItemIcon(itemStack, x, y); - mc.getItemRenderer().renderGuiItemOverlay(mc.textRenderer, itemStack, x, y, Integer.toString(itemStack.getCount())); + mc.getItemRenderer().renderGuiItemIcon(MATRICES, itemStack, x, y); + mc.getItemRenderer().renderGuiItemOverlay(MATRICES, mc.textRenderer, itemStack, x, y, Integer.toString(itemStack.getCount())); } case HideCount -> { if (itemStack.getCount() == 0) itemStack.setCount(Integer.MAX_VALUE); - mc.getItemRenderer().renderGuiItemIcon(itemStack, x, y); + mc.getItemRenderer().renderGuiItemIcon(MATRICES, itemStack, x, y); if (itemStack.getCount() == Integer.MAX_VALUE) itemStack.setCount(0); if (!itemStack.isEmpty()) { - mc.getItemRenderer().renderGuiItemOverlay(mc.textRenderer, itemStack, x, y, Integer.toString(itemStack.getCount())); + mc.getItemRenderer().renderGuiItemOverlay(MATRICES, mc.textRenderer, itemStack, x, y, Integer.toString(itemStack.getCount())); } } case ShowCount -> { if (itemStack.getCount() == 0) itemStack.setCount(Integer.MAX_VALUE); - mc.getItemRenderer().renderGuiItemIcon(itemStack, x, y); - mc.getItemRenderer().renderGuiItemOverlay(mc.textRenderer, itemStack, x, y, Integer.toString(itemStack.getCount() == Integer.MAX_VALUE ? 0 : itemStack.getCount())); + mc.getItemRenderer().renderGuiItemIcon(MATRICES, itemStack, x, y); + mc.getItemRenderer().renderGuiItemOverlay(MATRICES, mc.textRenderer, itemStack, x, y, Integer.toString(itemStack.getCount() == Integer.MAX_VALUE ? 0 : itemStack.getCount())); if (itemStack.getCount() == Integer.MAX_VALUE) itemStack.setCount(0); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/PlayerModelHud.java b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/PlayerModelHud.java index 8eb4b214e0..a1e5bc3c6a 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/PlayerModelHud.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/PlayerModelHud.java @@ -12,6 +12,7 @@ import meteordevelopment.meteorclient.systems.hud.HudRenderer; import meteordevelopment.meteorclient.utils.render.color.SettingColor; import net.minecraft.client.gui.screen.ingame.InventoryScreen; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.math.MathHelper; @@ -20,6 +21,8 @@ public class PlayerModelHud extends HudElement { public static final HudElementInfo INFO = new HudElementInfo<>(Hud.GROUP, "player-model", "Displays a model of your player.", PlayerModelHud::new); + private static final MatrixStack MATRICES = new MatrixStack(); + private final SettingGroup sgGeneral = settings.getDefaultGroup(); private final SettingGroup sgBackground = settings.createGroup("Background"); @@ -100,7 +103,7 @@ public void render(HudRenderer renderer) { float yaw = copyYaw.get() ? MathHelper.wrapDegrees(player.prevYaw + (player.getYaw() - player.prevYaw) * mc.getTickDelta()) : (float) customYaw.get(); float pitch = copyPitch.get() ? player.getPitch() : (float) customPitch.get(); - InventoryScreen.drawEntity((int) (x + (25 * scale.get())), (int) (y + (66 * scale.get())), (int) (30 * scale.get()), -yaw, -pitch, player); + InventoryScreen.drawEntity(MATRICES, (int) (x + (25 * scale.get())), (int) (y + (66 * scale.get())), (int) (30 * scale.get()), -yaw, -pitch, player); }); if (background.get()) { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/PotionTimersHud.java b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/PotionTimersHud.java index 2ec767977e..b4965dabde 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/PotionTimersHud.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/hud/elements/PotionTimersHud.java @@ -147,7 +147,7 @@ public void render(HudRenderer renderer) { } private String getString(StatusEffectInstance statusEffectInstance) { - return String.format("%s %d (%s)", Names.get(statusEffectInstance.getEffectType()), statusEffectInstance.getAmplifier() + 1, StatusEffectUtil.durationToString(statusEffectInstance, 1)); + return String.format("%s %d (%s)", Names.get(statusEffectInstance.getEffectType()), statusEffectInstance.getAmplifier() + 1, StatusEffectUtil.durationToString(statusEffectInstance, 1).getString()); } private double getScale() { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/AnchorAura.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/AnchorAura.java index 2a68ea0f30..c272a4ba7d 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/AnchorAura.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/AnchorAura.java @@ -11,7 +11,6 @@ import meteordevelopment.meteorclient.settings.*; import meteordevelopment.meteorclient.systems.modules.Categories; import meteordevelopment.meteorclient.systems.modules.Module; -import meteordevelopment.meteorclient.utils.Utils; import meteordevelopment.meteorclient.utils.entity.EntityUtils; import meteordevelopment.meteorclient.utils.entity.SortPriority; import meteordevelopment.meteorclient.utils.entity.TargetUtils; @@ -342,11 +341,11 @@ private BlockPos findBreakPos(BlockPos targetPos) { } private boolean getDamagePlace(BlockPos pos) { - return placeMode.get() == Safety.Suicide || DamageUtils.bedDamage(mc.player, Utils.vec3d(pos.add(0.5, 0.5, 0.5))) <= maxDamage.get(); + return placeMode.get() == Safety.Suicide || DamageUtils.bedDamage(mc.player, pos.toCenterPos()) <= maxDamage.get(); } private boolean getDamageBreak(BlockPos pos) { - return breakMode.get() == Safety.Suicide || DamageUtils.anchorDamage(mc.player, Utils.vec3d(pos.add(0.5, 0.5, 0.5))) <= maxDamage.get(); + return breakMode.get() == Safety.Suicide || DamageUtils.anchorDamage(mc.player, pos.toCenterPos()) <= maxDamage.get(); } private boolean isValidPlace(BlockPos pos) { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/ArrowDodge.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/ArrowDodge.java index b94c859ee1..ed08eee3d5 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/ArrowDodge.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/ArrowDodge.java @@ -172,7 +172,7 @@ private boolean isValid(Vec3d velocity, boolean checkGround) { } if (checkGround) { - BlockPos blockPos = mc.player.getBlockPos().add(velocity.x, velocity.y, velocity.z); + BlockPos blockPos = mc.player.getBlockPos().add(BlockPos.ofFloored(velocity.x, velocity.y, velocity.z)); // check if target pos is air if (!mc.world.getBlockState(blockPos).getCollisionShape(mc.world, blockPos).isEmpty()) return false; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/KillAura.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/KillAura.java index 3a2da61550..984cea6e0f 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/KillAura.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/combat/KillAura.java @@ -29,7 +29,6 @@ import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.Tameable; -import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.mob.EndermanEntity; import net.minecraft.entity.mob.ZombifiedPiglinEntity; import net.minecraft.entity.passive.AnimalEntity; @@ -327,7 +326,7 @@ private void onSendPacket(PacketEvent.Send event) { private boolean shouldShieldBreak() { for (Entity target : targets) { if (target instanceof PlayerEntity player) { - if (player.blockedByShield(DamageSource.player(mc.player)) && shieldMode.get() == ShieldMode.Break) { + if (player.blockedByShield(mc.world.getDamageSources().playerAttack(mc.player)) && shieldMode.get() == ShieldMode.Break) { return true; } } @@ -366,7 +365,7 @@ private boolean entityCheck(Entity entity) { if (entity instanceof PlayerEntity player) { if (player.isCreative()) return false; if (!Friends.get().shouldAttack(player)) return false; - if (shieldMode.get() == ShieldMode.Ignore && player.blockedByShield(DamageSource.player(mc.player))) return false; + if (shieldMode.get() == ShieldMode.Ignore && player.blockedByShield(mc.world.getDamageSources().playerAttack(mc.player))) return false; } return !(entity instanceof AnimalEntity animal) || !ignoreBabies.get() || !animal.isBaby(); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java index aee7348e48..965f2d07c2 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java @@ -32,7 +32,7 @@ import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.item.Wearable; +import net.minecraft.item.Equipment; import net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket; import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.ScreenHandlerType; @@ -339,7 +339,7 @@ private boolean swapArmor() { // would mixin to use method in ArmorItem, but it private boolean isWearable(ItemStack itemStack) { Item item = itemStack.getItem(); - if (item instanceof Wearable) return true; + if (item instanceof Equipment) return true; return item instanceof BlockItem blockItem && (blockItem.getBlock() instanceof AbstractSkullBlock || blockItem.getBlock() instanceof CarvedPumpkinBlock); } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/PacketCanceller.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/PacketCanceller.java index 7c2410bccd..219b9395c6 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/PacketCanceller.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/PacketCanceller.java @@ -14,7 +14,7 @@ import meteordevelopment.meteorclient.utils.network.PacketUtils; import meteordevelopment.orbit.EventHandler; import meteordevelopment.orbit.EventPriority; -import net.minecraft.network.Packet; +import net.minecraft.network.packet.Packet; import java.util.Set; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/BoatFly.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/BoatFly.java index 6995ca4b9c..445cd4b1a7 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/BoatFly.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/BoatFly.java @@ -61,7 +61,7 @@ public BoatFly() { @EventHandler private void onBoatMove(BoatMoveEvent event) { - if (event.boat.getPrimaryPassenger() != mc.player) return; + if (event.boat.getControllingPassenger() != mc.player) return; event.boat.setYaw(mc.player.getYaw()); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/EntitySpeed.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/EntitySpeed.java index f89be6dcc3..e7f54194bf 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/EntitySpeed.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/EntitySpeed.java @@ -50,7 +50,7 @@ public EntitySpeed() { @EventHandler private void onLivingEntityMove(LivingEntityMoveEvent event) { - if (event.entity.getPrimaryPassenger() != mc.player) return; + if (event.entity.getControllingPassenger() != mc.player) return; // Check for onlyOnGround and inWater LivingEntity entity = event.entity; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Flight.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Flight.java index d8291cbaab..ae5fc5f0d5 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Flight.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Flight.java @@ -22,7 +22,7 @@ public class Flight extends Module { private final SettingGroup sgGeneral = settings.getDefaultGroup(); private final SettingGroup sgAntiKick = settings.createGroup("Anti Kick"); //Pog - + private final Setting mode = sgGeneral.add(new EnumSetting.Builder() .name("mode") .description("The mode for Flight.") @@ -33,6 +33,7 @@ public class Flight extends Module { }) .build() ); + private final Setting speed = sgGeneral.add(new DoubleSetting.Builder() .name("speed") .description("Your speed when flying.") @@ -40,18 +41,21 @@ public class Flight extends Module { .min(0.0) .build() ); + private final Setting verticalSpeedMatch = sgGeneral.add(new BoolSetting.Builder() .name("vertical-speed-match") .description("Matches your vertical speed to your horizontal speed, otherwise uses vanilla ratio.") .defaultValue(false) .build() ); + private final Setting antiKickMode = sgAntiKick.add(new EnumSetting.Builder() .name("mode") .description("The mode for anti kick.") .defaultValue(AntiKickMode.Packet) .build() ); + private final Setting delay = sgAntiKick.add(new IntSetting.Builder() .name("delay") .description("The amount of delay, in ticks, between flying down a bit and return to original position") @@ -70,7 +74,7 @@ public class Flight extends Module { .sliderRange(1, 20) .build() ); - + private int delayLeft = delay.get(); private int offLeft = offTime.get(); private boolean flip; @@ -141,13 +145,9 @@ private void onPostTick(TickEvent.Post event) { switch (mode.get()) { case Velocity -> { - - /*TODO: deal with underwater movement, find a way to "spoof" not being in water - also, all of the multiplication below is to get the speed to roughly match the speed - you get when using vanilla fly*/ + // TODO: deal with underwater movement, find a way to "spoof" not being in water mc.player.getAbilities().flying = false; - mc.player.airStrafingSpeed = speed.get().floatValue() * (mc.player.isSprinting() ? 15f : 10f); mc.player.setVelocity(0, 0, 0); Vec3d initialVelocity = mc.player.getVelocity(); if (mc.options.jumpKey.isPressed()) @@ -232,6 +232,13 @@ private boolean isEntityOnAir(Entity entity) { return entity.world.getStatesInBox(entity.getBoundingBox().expand(0.0625).stretch(0.0, -0.55, 0.0)).allMatch(AbstractBlock.AbstractBlockState::isAir); } + public float getOffGroundSpeed() { + // All the multiplication below is to get the speed to roughly match the speed you get when using vanilla fly + + if (!isActive() || mode.get() != Mode.Velocity) return -1; + return speed.get().floatValue() * (mc.player.isSprinting() ? 15f : 10f); + } + public enum Mode { Abilities, Velocity diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Jesus.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Jesus.java index ec7e1fed85..8a9772e4b2 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Jesus.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Jesus.java @@ -22,7 +22,7 @@ import net.minecraft.enchantment.ProtectionEnchantment; import net.minecraft.entity.effect.StatusEffects; import net.minecraft.fluid.Fluids; -import net.minecraft.network.Packet; +import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; import net.minecraft.registry.tag.FluidTags; import net.minecraft.util.math.BlockPos; diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java index 7e489f6847..8ae2c1221d 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Scaffold.java @@ -240,7 +240,7 @@ private void onTick(TickEvent.Pre event) { List blocks = new ArrayList<>(); for (int x = (int) (mc.player.getX() - radius.get()); x < mc.player.getX() + radius.get(); x++) { for (int z = (int) (mc.player.getZ() - radius.get()); z < mc.player.getZ() + radius.get(); z++) { - blocks.add(new BlockPos(x, mc.player.getY() - 0.5, z)); + blocks.add(BlockPos.ofFloored(x, mc.player.getY() - 0.5, z)); } } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Step.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Step.java index e05adc6496..63b2994f3d 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Step.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/movement/Step.java @@ -63,7 +63,7 @@ public Step() { @Override public void onActivate() { - prevStepHeight = mc.player.stepHeight; + prevStepHeight = mc.player.getStepHeight(); prevBaritoneAssumeStep = BaritoneAPI.getSettings().assumeStep.value; BaritoneAPI.getSettings().assumeStep.value = true; @@ -74,16 +74,16 @@ private void onTick(TickEvent.Post event) { boolean work = (activeWhen.get() == ActiveWhen.Always) || (activeWhen.get() == ActiveWhen.Sneaking && mc.player.isSneaking()) || (activeWhen.get() == ActiveWhen.NotSneaking && !mc.player.isSneaking()); mc.player.setBoundingBox(mc.player.getBoundingBox().offset(0, 1, 0)); if (work && (!safeStep.get() || (getHealth() > stepHealth.get() && getHealth() - getExplosionDamage() > stepHealth.get()))){ - mc.player.stepHeight = height.get().floatValue(); + mc.player.setStepHeight(height.get().floatValue()); } else { - mc.player.stepHeight = prevStepHeight; + mc.player.setStepHeight(prevStepHeight); } mc.player.setBoundingBox(mc.player.getBoundingBox().offset(0, -1, 0)); } @Override public void onDeactivate() { - mc.player.stepHeight = prevStepHeight; + mc.player.setStepHeight(prevStepHeight); BaritoneAPI.getSettings().assumeStep.value = prevBaritoneAssumeStep; } diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/GhostHand.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/GhostHand.java index 78c7b5b14e..d8413a2b15 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/player/GhostHand.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/player/GhostHand.java @@ -32,7 +32,7 @@ private void onTick(TickEvent.Pre event) { if (!mc.options.useKey.isPressed() || mc.player.isSneaking()) return; for (BlockEntity blockEntity : Utils.blockEntities()) { - if (new BlockPos(mc.player.raycast(mc.interactionManager.getReachDistance(), mc.getTickDelta(), false).getPos()).equals(blockEntity.getPos())) return; + if (BlockPos.ofFloored(mc.player.raycast(mc.interactionManager.getReachDistance(), mc.getTickDelta(), false).getPos()).equals(blockEntity.getPos())) return; } Vec3d direction = new Vec3d(0, 0, 0.1) @@ -42,7 +42,7 @@ private void onTick(TickEvent.Pre event) { posList.clear(); for (int i = 1; i < mc.interactionManager.getReachDistance() * 10; i++) { - BlockPos pos = new BlockPos(mc.player.getCameraPosVec(mc.getTickDelta()).add(direction.multiply(i))); + BlockPos pos = BlockPos.ofFloored(mc.player.getCameraPosVec(mc.getTickDelta()).add(direction.multiply(i))); if (posList.contains(pos)) continue; posList.add(pos); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/BetterTooltips.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/BetterTooltips.java index ccdd6a035b..dadaa19f96 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/BetterTooltips.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/BetterTooltips.java @@ -414,10 +414,10 @@ public void applyCompactShulkerTooltip(ItemStack stack, List tooltip) { private MutableText getStatusText(StatusEffectInstance effect) { MutableText text = Text.translatable(effect.getTranslationKey()); if (effect.getAmplifier() != 0) { - text.append(String.format(" %d (%s)", effect.getAmplifier() + 1, StatusEffectUtil.durationToString(effect, 1))); + text.append(String.format(" %d (%s)", effect.getAmplifier() + 1, StatusEffectUtil.durationToString(effect, 1).getString())); } else { - text.append(String.format(" (%s)", StatusEffectUtil.durationToString(effect, 1))); + text.append(String.format(" (%s)", StatusEffectUtil.durationToString(effect, 1).getString())); } if (effect.getEffectType().isBeneficial()) return text.formatted(Formatting.BLUE); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/ItemPhysics.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/ItemPhysics.java index fb98497672..0a7febe06c 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/ItemPhysics.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/ItemPhysics.java @@ -16,7 +16,7 @@ import net.minecraft.block.SkullBlock; import net.minecraft.client.render.OverlayTexture; import net.minecraft.client.render.model.BakedModel; -import net.minecraft.client.render.model.json.ModelTransformation; +import net.minecraft.client.render.model.json.ModelTransformationMode; import net.minecraft.item.AliasedBlockItem; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; @@ -141,7 +141,7 @@ private void onRenderItemEntity(RenderItemEntityEvent event) { } } - event.itemRenderer.renderItem(itemStack, ModelTransformation.Mode.GROUND, false, event.matrixStack, event.vertexConsumerProvider, event.light, OverlayTexture.DEFAULT_UV, bakedModel); + event.itemRenderer.renderItem(itemStack, ModelTransformationMode.GROUND, false, event.matrixStack, event.vertexConsumerProvider, event.light, OverlayTexture.DEFAULT_UV, bakedModel); event.matrixStack.pop(); diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/WaypointsModule.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/WaypointsModule.java index 52e754f94c..45b64bf019 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/WaypointsModule.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/WaypointsModule.java @@ -98,7 +98,7 @@ public void addDeath(Vec3d deathPos) { Waypoint waypoint = new Waypoint.Builder() .name("Death " + time) .icon("skull") - .pos(new BlockPos(deathPos).up(2)) + .pos(BlockPos.ofFloored(deathPos).up(2)) .dimension(PlayerUtils.getDimension()) .build(); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtils.java index 2af0c944c2..a84f836088 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtils.java @@ -9,7 +9,7 @@ import com.mojang.datafixers.util.Pair; import com.mojang.serialization.Lifecycle; import meteordevelopment.meteorclient.utils.misc.MeteorIdentifier; -import net.minecraft.network.Packet; +import net.minecraft.network.packet.Packet; import net.minecraft.registry.Registry; import net.minecraft.registry.RegistryKey; import net.minecraft.registry.SimpleRegistry; diff --git a/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtilsUtil.java b/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtilsUtil.java index b909f39487..3e01148d1b 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtilsUtil.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/network/PacketUtilsUtil.java @@ -5,7 +5,7 @@ package meteordevelopment.meteorclient.utils.network; -import net.minecraft.network.Packet; +import net.minecraft.network.packet.Packet; import org.reflections.Reflections; import org.reflections.scanners.Scanners; @@ -187,7 +187,7 @@ public static void init() throws IOException { writer.write("import com.mojang.datafixers.util.Pair;\n"); writer.write("import com.mojang.serialization.Lifecycle;\n"); writer.write("import meteordevelopment.meteorclient.utils.misc.MeteorIdentifier;\n"); - writer.write("import net.minecraft.network.Packet;\n"); + writer.write("import net.minecraft.network.packet.Packet;\n"); writer.write("import net.minecraft.registry.Registry;\n"); writer.write("import net.minecraft.registry.RegistryKey;\n"); writer.write("import net.minecraft.registry.SimpleRegistry;\n"); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/DamageUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/player/DamageUtils.java index 25104fee25..2da57562df 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/DamageUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/DamageUtils.java @@ -164,9 +164,9 @@ public static double bedDamage(LivingEntity player, Vec3d bed) { // Anchor damage public static double anchorDamage(LivingEntity player, Vec3d anchor) { - mc.world.removeBlock(new BlockPos(anchor), false); + mc.world.removeBlock(BlockPos.ofFloored(anchor), false); double damage = bedDamage(player, anchor); - mc.world.setBlockState(new BlockPos(anchor), Blocks.RESPAWN_ANCHOR.getDefaultState()); + mc.world.setBlockState(BlockPos.ofFloored(anchor), Blocks.RESPAWN_ANCHOR.getDefaultState()); return damage; } @@ -182,7 +182,7 @@ private static double getDamageForDifficulty(double damage) { } private static double normalProtReduction(Entity player, double damage) { - int protLevel = EnchantmentHelper.getProtectionAmount(player.getArmorItems(), DamageSource.GENERIC); + int protLevel = EnchantmentHelper.getProtectionAmount(player.getArmorItems(), mc.world.getDamageSources().generic()); if (protLevel > 20) protLevel = 20; damage *= 1 - (protLevel / 25.0); @@ -190,7 +190,7 @@ private static double normalProtReduction(Entity player, double damage) { } private static double blastProtReduction(Entity player, double damage, Explosion explosion) { - int protLevel = EnchantmentHelper.getProtectionAmount(player.getArmorItems(), DamageSource.explosion(explosion)); + int protLevel = EnchantmentHelper.getProtectionAmount(player.getArmorItems(), mc.world.getDamageSources().explosion(explosion)); if (protLevel > 20) protLevel = 20; damage *= (1 - (protLevel / 25.0)); @@ -269,7 +269,7 @@ private static BlockHitResult raycast(RaycastContext context, BlockPos obsidianP return d <= e ? blockHitResult : blockHitResult2; }, (raycastContext) -> { Vec3d vec3d = raycastContext.getStart().subtract(raycastContext.getEnd()); - return BlockHitResult.createMissed(raycastContext.getEnd(), Direction.getFacing(vec3d.x, vec3d.y, vec3d.z), new BlockPos(raycastContext.getEnd())); + return BlockHitResult.createMissed(raycastContext.getEnd(), Direction.getFacing(vec3d.x, vec3d.y, vec3d.z), BlockPos.ofFloored(raycastContext.getEnd())); }); } } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/player/PathFinder.java b/src/main/java/meteordevelopment/meteorclient/utils/player/PathFinder.java index efb389ee66..20f9747d2f 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/player/PathFinder.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/player/PathFinder.java @@ -28,7 +28,7 @@ public class PathFinder { private PathBlock currentPathBlock; public PathBlock getNextPathBlock() { - PathBlock nextBlock = new PathBlock(new BlockPos(getNextStraightPos())); + PathBlock nextBlock = new PathBlock(BlockPos.ofFloored(getNextStraightPos())); if (isSolidFloor(nextBlock.blockPos) && isAirAbove(nextBlock.blockPos)) { return nextBlock; } else if (!isSolidFloor(nextBlock.blockPos) && isAirAbove(nextBlock.blockPos)) { diff --git a/src/main/java/meteordevelopment/meteorclient/utils/render/ContainerButtonWidget.java b/src/main/java/meteordevelopment/meteorclient/utils/render/ContainerButtonWidget.java deleted file mode 100644 index 08455a0196..0000000000 --- a/src/main/java/meteordevelopment/meteorclient/utils/render/ContainerButtonWidget.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client). - * Copyright (c) Meteor Development. - */ - -package meteordevelopment.meteorclient.utils.render; - -import com.mojang.blaze3d.systems.RenderSystem; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.render.GameRenderer; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.text.Text; -import net.minecraft.util.math.MathHelper; - -public class ContainerButtonWidget extends ButtonWidget { - public ContainerButtonWidget(int x, int y, int width, int height, Text message, PressAction onPress, NarrationSupplier narrationSupplier) { - super(x, y, width, height, message, onPress, narrationSupplier); - } - - @Override - public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta) { - MinecraftClient minecraftClient = MinecraftClient.getInstance(); - TextRenderer textRenderer = minecraftClient.textRenderer; - RenderSystem.setShader(GameRenderer::getPositionTexProgram); - RenderSystem.setShaderTexture(0, WIDGETS_TEXTURE); - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, alpha); - RenderSystem.enableBlend(); - RenderSystem.defaultBlendFunc(); - RenderSystem.enableDepthTest(); - - int halfWidth = width / 2; - int halfHeight = height / 2; - int texY = getYImage(isHovered()) * 20; - - drawTexture(matrices, getX(), getY(), 0, 46 + texY, halfWidth, halfHeight); - drawTexture(matrices, getX(), getY() + halfHeight, 0, 46 + texY + 14, halfWidth, halfHeight); - - drawTexture(matrices, getX() + halfWidth, getY(), 200 - halfWidth, 46 + texY, halfWidth, halfHeight); - drawTexture(matrices, getX() + halfWidth, getY() + halfHeight, 200 - halfWidth, 46 + texY + 14, halfWidth, halfHeight); - - drawCenteredText(matrices, textRenderer, getMessage(), getX() + width / 2, (getY() + height / 2) - 4, active ? 16777215 : 10526880 | MathHelper.ceil(alpha * 255.0F) << 24); - } -} diff --git a/src/main/java/meteordevelopment/meteorclient/utils/render/MeteorToast.java b/src/main/java/meteordevelopment/meteorclient/utils/render/MeteorToast.java index 44c839db4e..e44391f0de 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/render/MeteorToast.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/render/MeteorToast.java @@ -69,7 +69,7 @@ public Visibility draw(MatrixStack matrices, ToastManager toastManager, long cur mc.textRenderer.draw(matrices, title, x, titleY, TITLE_COLOR); - if (icon != null) mc.getItemRenderer().renderInGui(icon, 8, 8); + if (icon != null) mc.getItemRenderer().renderInGui(matrices, icon, 8, 8); if (!playedSound) { mc.getSoundManager().play(getSound()); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/render/RenderUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/render/RenderUtils.java index 2a56d1eeec..f643a9eb98 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/render/RenderUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/render/RenderUtils.java @@ -32,6 +32,8 @@ import static meteordevelopment.meteorclient.MeteorClient.mc; public class RenderUtils { + private static final MatrixStack MATRICES = new MatrixStack(); + public static Vec3d center; private static final Pool renderBlockPool = new Pool<>(RenderBlock::new); @@ -46,15 +48,13 @@ public static void init() { public static void drawItem(ItemStack itemStack, int x, int y, double scale, boolean overlay) { //RenderSystem.disableDepthTest(); - MatrixStack matrices = RenderSystem.getModelViewStack(); - - matrices.push(); - matrices.scale((float) scale, (float) scale, 1); + MATRICES.push(); + MATRICES.scale((float) scale, (float) scale, 1); - mc.getItemRenderer().renderGuiItemIcon(itemStack, (int) (x / scale), (int) (y / scale)); - if (overlay) mc.getItemRenderer().renderGuiItemOverlay(mc.textRenderer, itemStack, (int) (x / scale), (int) (y / scale), null); + mc.getItemRenderer().renderGuiItemIcon(MATRICES, itemStack, (int) (x / scale), (int) (y / scale)); + if (overlay) mc.getItemRenderer().renderGuiItemOverlay(MATRICES, mc.textRenderer, itemStack, (int) (x / scale), (int) (y / scale), null); - matrices.pop(); + MATRICES.pop(); //RenderSystem.enableDepthTest(); } diff --git a/src/main/java/meteordevelopment/meteorclient/utils/render/WireframeEntityRenderer.java b/src/main/java/meteordevelopment/meteorclient/utils/render/WireframeEntityRenderer.java index bbf9541862..f808114a21 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/render/WireframeEntityRenderer.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/render/WireframeEntityRenderer.java @@ -110,8 +110,8 @@ public static void render(Render3DEvent event, Entity entity, double scale, Colo float limbAngle = 0; if (!livingEntity.hasVehicle() && livingEntity.isAlive()) { - limbDistance = MathHelper.lerp(event.tickDelta, livingEntity.lastLimbDistance, livingEntity.limbDistance); - limbAngle = livingEntity.limbAngle - livingEntity.limbDistance * (1 - event.tickDelta); + limbDistance = livingEntity.limbAnimator.getSpeed(event.tickDelta); + limbAngle = livingEntity.limbAnimator.getPos(event.tickDelta); if (livingEntity.isBaby()) limbAngle *= 3; if (limbDistance > 1) limbDistance = 1; diff --git a/src/main/java/meteordevelopment/meteorclient/utils/tooltip/BannerTooltipComponent.java b/src/main/java/meteordevelopment/meteorclient/utils/tooltip/BannerTooltipComponent.java index 730be9648e..a77c4a48d9 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/tooltip/BannerTooltipComponent.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/tooltip/BannerTooltipComponent.java @@ -47,10 +47,10 @@ public int getWidth(TextRenderer textRenderer) { } @Override - public void drawItems(TextRenderer textRenderer, int x, int y, MatrixStack matrices, ItemRenderer itemRenderer, int z) { + public void drawItems(TextRenderer textRenderer, int x, int y, MatrixStack matrices, ItemRenderer itemRenderer) { DiffuseLighting.disableGuiDepthLighting(); matrices.push(); - matrices.translate(x + 8, y + 8, z); + matrices.translate(x + 8, y + 8, 0); matrices.push(); matrices.translate(0.5, 16, 0); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/tooltip/BookTooltipComponent.java b/src/main/java/meteordevelopment/meteorclient/utils/tooltip/BookTooltipComponent.java index aef1541d75..11d66d6ca4 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/tooltip/BookTooltipComponent.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/tooltip/BookTooltipComponent.java @@ -41,15 +41,15 @@ public int getWidth(TextRenderer textRenderer) { } @Override - public void drawItems(TextRenderer textRenderer, int x, int y, MatrixStack matrices, ItemRenderer itemRenderer, int z) { + public void drawItems(TextRenderer textRenderer, int x, int y, MatrixStack matrices, ItemRenderer itemRenderer) { // Background RenderSystem.setShader(GameRenderer::getPositionTexProgram); RenderSystem.setShaderTexture(0, TEXTURE_BOOK_BACKGROUND); - DrawableHelper.drawTexture(matrices, x, y, z, 12, 0, 112, 134, 179, 179); + DrawableHelper.drawTexture(matrices, x, y, 0, 12, 0, 112, 134, 179, 179); // Content matrices.push(); - matrices.translate(x + 16, y + 12, z + 1); + matrices.translate(x + 16, y + 12, 1); matrices.scale(0.7f, 0.7f, 1f); int offset = 0; for (OrderedText line : textRenderer.wrapLines(page, 112)) { diff --git a/src/main/java/meteordevelopment/meteorclient/utils/tooltip/ContainerTooltipComponent.java b/src/main/java/meteordevelopment/meteorclient/utils/tooltip/ContainerTooltipComponent.java index 6244c1734a..c30e4bfffb 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/tooltip/ContainerTooltipComponent.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/tooltip/ContainerTooltipComponent.java @@ -46,13 +46,13 @@ public int getWidth(TextRenderer textRenderer) { } @Override - public void drawItems(TextRenderer textRenderer, int x, int y, MatrixStack matrices, ItemRenderer itemRenderer, int z) { + public void drawItems(TextRenderer textRenderer, int x, int y, MatrixStack matrices, ItemRenderer itemRenderer) { // Background RenderSystem.setShader(GameRenderer::getPositionTexProgram); RenderSystem.setShaderColor(color.r / 255f, color.g / 255f, color.b / 255f, color.a / 255f); RenderSystem.setShaderTexture(0, TEXTURE_CONTAINER_BACKGROUND); - DrawableHelper.drawTexture(matrices, x, y, z, 0, 0, 176, 67, 176, 67); + DrawableHelper.drawTexture(matrices, x, y, 0, 0, 0, 176, 67, 176, 67); //Contents int row = 0; diff --git a/src/main/java/meteordevelopment/meteorclient/utils/tooltip/EntityTooltipComponent.java b/src/main/java/meteordevelopment/meteorclient/utils/tooltip/EntityTooltipComponent.java index 15b7070a56..5dc7eb0b29 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/tooltip/EntityTooltipComponent.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/tooltip/EntityTooltipComponent.java @@ -46,9 +46,9 @@ public int getWidth(TextRenderer textRenderer) { } @Override - public void drawItems(TextRenderer textRenderer, int x, int y, MatrixStack matrices, ItemRenderer itemRenderer, int z) { + public void drawItems(TextRenderer textRenderer, int x, int y, MatrixStack matrices, ItemRenderer itemRenderer) { matrices.push(); - matrices.translate(15, 2, z); + matrices.translate(15, 2, 0); this.entity.setVelocity(1.f, 1.f, 1.f); this.renderEntity(matrices, x, y); matrices.pop(); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/tooltip/MapTooltipComponent.java b/src/main/java/meteordevelopment/meteorclient/utils/tooltip/MapTooltipComponent.java index f3625966df..bc3173791f 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/tooltip/MapTooltipComponent.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/tooltip/MapTooltipComponent.java @@ -47,12 +47,12 @@ public TooltipComponent getComponent() { } @Override - public void drawItems(TextRenderer textRenderer, int x, int y, MatrixStack matrices, ItemRenderer itemRenderer, int z) { + public void drawItems(TextRenderer textRenderer, int x, int y, MatrixStack matrices, ItemRenderer itemRenderer) { double scale = Modules.get().get(BetterTooltips.class).mapsScale.get(); // Background matrices.push(); - matrices.translate(x, y, z); + matrices.translate(x, y, 0); matrices.scale((float) (scale) * 2, (float) (scale) * 2, 0); matrices.scale((64 + 8) / 64f, (64 + 8) / 64f, 0); RenderSystem.setShader(GameRenderer::getPositionTexProgram); @@ -65,7 +65,7 @@ public void drawItems(TextRenderer textRenderer, int x, int y, MatrixStack matri MapState mapState = FilledMapItem.getMapState(this.mapId, mc.world); if (mapState == null) return; matrices.push(); - matrices.translate(x, y, z); + matrices.translate(x, y, 0); matrices.scale((float) scale, (float) scale, 0); matrices.translate(8, 8, 0); mc.gameRenderer.getMapRenderer().draw(matrices, consumer, this.mapId, mapState, false, 0xF000F0); diff --git a/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java b/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java index e17be780c7..c151027bef 100644 --- a/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java +++ b/src/main/java/meteordevelopment/meteorclient/utils/world/BlockUtils.java @@ -253,7 +253,7 @@ public static MobSpawn isValidMobSpawn(BlockPos blockPos, boolean newMobSpawnLig if (!topSurface(mc.world.getBlockState(blockPos.down()))) { if (mc.world.getBlockState(blockPos.down()).getCollisionShape(mc.world, blockPos.down()) != VoxelShapes.fullCube()) return MobSpawn.Never; - if (mc.world.getBlockState(blockPos.down()).isTranslucent(mc.world, blockPos.down())) return MobSpawn.Never; + if (mc.world.getBlockState(blockPos.down()).isTransparent(mc.world, blockPos.down())) return MobSpawn.Never; } if (mc.world.getLightLevel(blockPos, 0) <= spawnLightLimit) return MobSpawn.Potential; diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 1a1a711a16..6fe4842487 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -44,8 +44,8 @@ }, "depends": { "java": ">=17", - "minecraft": ">=1.19.3", - "fabricloader": ">=0.14.11" + "minecraft": ">=1.19.4", + "fabricloader": ">=0.14.17" }, "breaks": { "optifabric": "*", From 1ce86d289635fd9ea251dc54bd41e4ff9ec4ee2f Mon Sep 17 00:00:00 2001 From: MineGame159 Date: Sat, 18 Mar 2023 15:48:23 +0100 Subject: [PATCH 134/135] Removed ArmorSwap from InventoryTweaks as it's now a Vanilla feature --- .../systems/modules/misc/InventoryTweaks.java | 48 +------------------ 1 file changed, 1 insertion(+), 47 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java index 965f2d07c2..729e372a65 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/misc/InventoryTweaks.java @@ -26,18 +26,14 @@ import net.minecraft.block.AbstractSkullBlock; import net.minecraft.block.CarvedPumpkinBlock; import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.client.gui.screen.ingame.InventoryScreen; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.LivingEntity; import net.minecraft.item.BlockItem; +import net.minecraft.item.Equipment; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.item.Equipment; import net.minecraft.network.packet.c2s.play.CloseHandledScreenC2SPacket; import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.ScreenHandlerType; import net.minecraft.screen.slot.Slot; -import net.minecraft.screen.slot.SlotActionType; import org.lwjgl.glfw.GLFW; import java.util.Arrays; @@ -85,13 +81,6 @@ public class InventoryTweaks extends Module { .build() ); - private final Setting armorSwap = sgGeneral.add(new BoolSetting.Builder() - .name("armor-swap") - .description("Lets you swap between pieces of armor by right clicking on it.") - .defaultValue(true) - .build() - ); - // Sorting private final Setting sortingEnabled = sgSorting.add(new BoolSetting.Builder() @@ -277,9 +266,6 @@ private void onKey(KeyEvent event) { if (sortingKey.get().matches(true, event.key)) { if (sort()) event.cancel(); } - if (mc.options.useKey.matchesKey(event.key, 0) && armorSwap()) { - if (swapArmor()) event.cancel(); - } } @EventHandler @@ -289,9 +275,6 @@ private void onMouseButton(MouseButtonEvent event) { if (sortingKey.get().matches(false, event.button)) { if (sort()) event.cancel(); } - if (mc.options.useKey.matchesMouse(event.button) && armorSwap()) { - if (swapArmor()) event.cancel(); - } } private boolean sort() { @@ -311,31 +294,6 @@ private boolean sort() { return true; } - private boolean swapArmor() { // would mixin to use method in ArmorItem, but it's buggy and unreliable on servers - if (mc.currentScreen != null) { - if (!(mc.currentScreen instanceof InventoryScreen screen)) return false; - Slot focusedSlot = ((HandledScreenAccessor) screen).getFocusedSlot(); - if (focusedSlot == null || !isWearable(focusedSlot.getStack())) return false; - - ItemStack itemStack = focusedSlot.getStack(); - EquipmentSlot equipmentSlot = LivingEntity.getPreferredEquipmentSlot(itemStack); - - //the way mojang handles the inventory is awful, and it took me too long to figure this out - mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, SlotUtils.indexToId(focusedSlot.getIndex()), - SlotUtils.ARMOR_START + equipmentSlot.getEntitySlotId(), SlotActionType.SWAP, mc.player); - - } else { - ItemStack itemStack = mc.player.getMainHandStack(); - if (!isWearable(itemStack)) return false; - EquipmentSlot equipmentSlot = LivingEntity.getPreferredEquipmentSlot(itemStack); - - mc.interactionManager.clickSlot(mc.player.currentScreenHandler.syncId, SlotUtils.indexToId(SlotUtils.ARMOR_START + (3 - equipmentSlot.getEntitySlotId())), - mc.player.getInventory().selectedSlot, SlotActionType.SWAP, mc.player); - - } - return true; - } - private boolean isWearable(ItemStack itemStack) { Item item = itemStack.getItem(); @@ -465,10 +423,6 @@ public boolean armorStorage() { return isActive() && armorStorage.get(); } - public boolean armorSwap() { - return isActive() && armorSwap.get(); - } - public boolean canSteal(ScreenHandler handler) { try { return (stealScreens.get().contains(handler.getType())); From 35456ff97dfa8859cf4893b7e7cdd683efb86b2a Mon Sep 17 00:00:00 2001 From: Soda6501 Date: Sat, 18 Mar 2023 23:12:12 +0800 Subject: [PATCH 135/135] Remove NoHurtCam as it's in Vanilla --- .../meteorclient/mixin/GameRendererMixin.java | 5 ----- .../meteorclient/systems/modules/render/NoRender.java | 11 ----------- 2 files changed, 16 deletions(-) diff --git a/src/main/java/meteordevelopment/meteorclient/mixin/GameRendererMixin.java b/src/main/java/meteordevelopment/meteorclient/mixin/GameRendererMixin.java index ce5b0fa3ba..e11c67fdba 100644 --- a/src/main/java/meteordevelopment/meteorclient/mixin/GameRendererMixin.java +++ b/src/main/java/meteordevelopment/meteorclient/mixin/GameRendererMixin.java @@ -96,11 +96,6 @@ private HitResult updateTargetedEntityEntityRayTraceProxy(Entity entity, double return entity.raycast(maxDistance, tickDelta, includeFluids); } - @Inject(method = "tiltViewWhenHurt", at = @At("HEAD"), cancellable = true) - private void onTiltViewWhenHurt(MatrixStack matrixStack, float f, CallbackInfo info) { - if (Modules.get().get(NoRender.class).noHurtCam()) info.cancel(); - } - @Inject(method = "showFloatingItem", at = @At("HEAD"), cancellable = true) private void onShowFloatingItem(ItemStack floatingItem, CallbackInfo info) { if (floatingItem.getItem() == Items.TOTEM_OF_UNDYING && Modules.get().get(NoRender.class).noTotemAnimation()) { diff --git a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/NoRender.java b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/NoRender.java index d88c3134a5..25a4297d7f 100644 --- a/src/main/java/meteordevelopment/meteorclient/systems/modules/render/NoRender.java +++ b/src/main/java/meteordevelopment/meteorclient/systems/modules/render/NoRender.java @@ -27,13 +27,6 @@ public class NoRender extends Module { // Overlay - private final Setting noHurtCam = sgOverlay.add(new BoolSetting.Builder() - .name("hurt-cam") - .description("Disables rendering of the hurt camera effect.") - .defaultValue(false) - .build() - ); - private final Setting noPortalOverlay = sgOverlay.add(new BoolSetting.Builder() .name("portal-overlay") .description("Disables rendering of the nether portal overlay.") @@ -359,10 +352,6 @@ public NoRender() { // Overlay - public boolean noHurtCam() { - return isActive() && noHurtCam.get(); - } - public boolean noPortalOverlay() { return isActive() && noPortalOverlay.get(); }