Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import meteordevelopment.meteorclient.systems.modules.world.HighwayBuilder;
import meteordevelopment.meteorclient.utils.Utils;
import meteordevelopment.meteorclient.utils.entity.fakeplayer.FakePlayerEntity;
import meteordevelopment.meteorclient.utils.player.Rotations;
import net.minecraft.client.Camera;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.MoverType;
Expand Down Expand Up @@ -107,6 +108,12 @@ private void onMove(MoverType moverType, Vec3 delta, CallbackInfo ci) {
}
}

@ModifyExpressionValue(method = "moveRelative", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;getYRot()F"))
private float moveRelativeYaw(float original) {
if ((Object) this == mc.player && Rotations.shouldCorrectPlayerInput()) return Rotations.serverYaw;
return original;
}

@ModifyExpressionValue(method = "getBlockSpeedFactor", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/state/BlockState;getBlock()Lnet/minecraft/world/level/block/Block;"))
private Block modifyBlockSpeedFactor(Block original) {
if ((Object) this != mc.player) return original;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,23 @@

package meteordevelopment.meteorclient.mixin;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.modules.movement.ElytraBoost;
import meteordevelopment.meteorclient.utils.player.Rotations;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.FireworkRocketEntity;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.Vec3;
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 static meteordevelopment.meteorclient.MeteorClient.mc;

@Mixin(FireworkRocketEntity.class)
public abstract class FireworkRocketEntityMixin {
@Shadow
Expand All @@ -24,6 +30,15 @@ public abstract class FireworkRocketEntityMixin {
@Shadow
private int lifetime;

@Shadow
private LivingEntity attachedToEntity;

@ModifyExpressionValue(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;getLookAngle()Lnet/minecraft/world/phys/Vec3;"))
private Vec3 fixRocketBoostDirection(Vec3 original) {
if (attachedToEntity == mc.player && mc.player != null && Rotations.shouldCorrectPlayerInput()) return Rotations.getServerDirection();
return original;
}

@Inject(method = "tick", at = @At("TAIL"))
private void onTick(CallbackInfo ci) {
FireworkRocketEntity firework = ((FireworkRocketEntity) (Object) this);
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/meteordevelopment/meteorclient/mixin/ItemMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,26 @@

package meteordevelopment.meteorclient.mixin;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.events.render.TooltipDataEvent;
import meteordevelopment.meteorclient.utils.player.Rotations;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.tooltip.TooltipComponent;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.ClipContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
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;

import java.util.Optional;

import static meteordevelopment.meteorclient.MeteorClient.mc;

@Mixin(Item.class)
public abstract class ItemMixin {
@Inject(method = "getTooltipImage", at = @At("HEAD"), cancellable = true)
Expand All @@ -26,4 +34,10 @@ private void onTooltipData(ItemStack itemStack, CallbackInfoReturnable<Optional<
cir.setReturnValue(Optional.of(event.tooltipData));
}
}

@ModifyExpressionValue(method = "getPlayerPOVHitResult", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/player/Player;calculateViewVector(FF)Lnet/minecraft/world/phys/Vec3;"))
private static Vec3 fixRotation(Vec3 original, Level level, Player player, ClipContext.Fluid fluid) {
if (player == mc.player && Rotations.rotating) return Rotations.getServerDirection();
return original;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import meteordevelopment.meteorclient.systems.modules.player.NoStatusEffects;
import meteordevelopment.meteorclient.systems.modules.render.HandView;
import meteordevelopment.meteorclient.systems.modules.render.NoRender;
import meteordevelopment.meteorclient.utils.player.Rotations;
import net.minecraft.core.Holder;
import net.minecraft.core.component.DataComponents;
import net.minecraft.util.Prediction;
Expand All @@ -31,6 +32,7 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.phys.Vec3;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.*;
Expand Down Expand Up @@ -107,6 +109,7 @@ private boolean hasEffect(boolean original, Holder<MobEffect> effect) {
@ModifyExpressionValue(method = "jumpFromGround", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;getYRot()F"))
private float modifyGetYaw(float original) {
if ((Object) this != mc.player) return original;
if (Rotations.shouldCorrectPlayerInput()) original = Rotations.serverYaw;
if (!Modules.get().get(Sprint.class).rageSprint()) return original;

float forward = Math.signum(mc.player.zza);
Expand Down Expand Up @@ -141,4 +144,16 @@ private void onDropItem(ItemStack itemStack, boolean thrownFromHand, Prediction
if (MeteorClient.EVENT_BUS.post(DropItemsEvent.get(itemStack)).isCancelled()) cir.setReturnValue(null);
}
}

@ModifyExpressionValue(method = "updateFallFlyingMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;getLookAngle()Lnet/minecraft/world/phys/Vec3;"))
private Vec3 fixFallFlyingLookAngle(Vec3 original) {
if ((Object) this == mc.player && Rotations.shouldCorrectPlayerInput()) return Rotations.getServerDirection();
return original;
}

@ModifyExpressionValue(method = "updateFallFlyingMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;getXRot()F"))
private float fixFallFlyingPitch(float original) {
if ((Object) this == mc.player && Rotations.shouldCorrectPlayerInput()) return Rotations.serverPitch;
return original;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import com.mojang.authlib.GameProfile;
import meteordevelopment.meteorclient.MeteorClient;
Expand All @@ -20,6 +22,7 @@
import meteordevelopment.meteorclient.systems.modules.player.Portals;
import meteordevelopment.meteorclient.systems.modules.render.NoRender;
import meteordevelopment.meteorclient.utils.entity.fakeplayer.FakePlayerEntity;
import meteordevelopment.meteorclient.utils.player.Rotations;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.player.AbstractClientPlayer;
Expand Down Expand Up @@ -103,6 +106,12 @@ private void preAiStep(CallbackInfo ci) {
MeteorClient.EVENT_BUS.post(PlayerTickMovementEvent.get());
}

@WrapOperation(method = "aiStep", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/ClientInput;tick()V"))
private void wrapTick(ClientInput input, Operation<Void> original) {
original.call(input);
if (Rotations.shouldCorrectPlayerInput()) Rotations.setCorrectedPlayerInput(input);
}

@ModifyReturnValue(method = "getJumpRidingScale", at = @At("RETURN"))
private float modifyJumpRidingScale(float original) {
if (Modules.get().get(EntityControl.class).maxJump()) return 1f;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.events.entity.DropItemsEvent;
import meteordevelopment.meteorclient.events.entity.player.*;
import meteordevelopment.meteorclient.mixininterface.IMultiPlayerGameMode;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.modules.player.BreakDelay;
import meteordevelopment.meteorclient.systems.modules.player.SpeedMine;
import meteordevelopment.meteorclient.utils.player.Rotations;
import meteordevelopment.meteorclient.utils.world.BlockUtils;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.multiplayer.MultiPlayerGameMode;
Expand All @@ -23,6 +25,7 @@
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.protocol.game.ServerboundPlayerActionPacket;
import net.minecraft.network.protocol.game.ServerboundUseItemPacket;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.Entity;
Expand Down Expand Up @@ -153,6 +156,12 @@ private void onUseItem(Player player, InteractionHand hand, CallbackInfoReturnab
if (event.toReturn != null) cir.setReturnValue(event.toReturn);
}

@WrapOperation(method = "lambda$useItem$0", at = @At(value = "NEW", target = "(Lnet/minecraft/world/InteractionHand;IFF)Lnet/minecraft/network/protocol/game/ServerboundUseItemPacket;"))
private ServerboundUseItemPacket fixItemRotation(InteractionHand hand, int sequence, float yaw, float pitch, Operation<ServerboundUseItemPacket> original, @Local(argsOnly = true) Player player) {
if (player == mc.player && Rotations.rotating) return original.call(hand, sequence, Rotations.serverYaw, Rotations.serverPitch);
return original.call(hand, sequence, yaw, pitch);
}

@Inject(method = "stopDestroyBlock", at = @At("HEAD"), cancellable = true)
private void onStopDestroyBlock(CallbackInfo ci) {
if (BlockUtils.breaking) ci.cancel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package meteordevelopment.meteorclient.mixin;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import meteordevelopment.meteorclient.MeteorClient;
Expand All @@ -15,6 +16,7 @@
import meteordevelopment.meteorclient.systems.modules.movement.Sprint;
import meteordevelopment.meteorclient.systems.modules.player.Reach;
import meteordevelopment.meteorclient.systems.modules.player.SpeedMine;
import meteordevelopment.meteorclient.utils.player.Rotations;
import meteordevelopment.meteorclient.utils.world.BlockUtils;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.EntityType;
Expand Down Expand Up @@ -115,6 +117,12 @@ private void onGetFlyingSpeed(CallbackInfoReturnable<Float> cir) {
return Modules.get().get(Sprint.class).stopSprinting();
}

@ModifyExpressionValue(method = {"causeExtraKnockback", "doSweepAttack"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/player/Player;getYRot()F"))
private float fixAttackYaw(float original) {
if ((Object) this == mc.player && Rotations.shouldCorrectPlayerInput()) return Rotations.serverYaw;
return original;
}

@ModifyReturnValue(method = "blockInteractionRange", at = @At("RETURN"))
private double modifyBlockInteractionRange(double original) {
return Math.max(0, original + Modules.get().get(Reach.class).blockReach());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,14 @@ public class Config extends System<Config> {
public final Setting<Integer> rotationHoldTicks = sgMisc.add(new IntSetting.Builder()
.name("rotation-hold")
.description("Hold long to hold server side rotation when not sending any packets.")
.defaultValue(4)
.defaultValue(2)
.build()
);

public final Setting<Boolean> rotationMovementCorrection = sgMisc.add(new BoolSetting.Builder()
.name("rotation-movement-correction")
.description("Adjust player movement depending on server side rotation (Grim movefix).")
.defaultValue(true)
.build()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class KillAura extends Module {
.build()
);

private final Setting<RotationMode> rotation = sgGeneral.add(new EnumSetting.Builder<RotationMode>()
private final Setting<RotationMode> rotate = sgGeneral.add(new EnumSetting.Builder<RotationMode>()
.name("rotate")
.description("Determines when you should rotate towards the target.")
.defaultValue(RotationMode.Always)
Expand Down Expand Up @@ -350,14 +350,17 @@ private void onTick(TickEvent.Pre event) {
}

attacking = true;
if (rotation.get() == RotationMode.Always)
Rotations.rotate(Rotations.getYaw(primary), Rotations.getPitch(primary, Target.Body));

if (pauseOnCombat.get() && PathManagers.get().isPathing() && !wasPathing) {
PathManagers.get().pause();
wasPathing = true;
}

if (delayCheck()) targets.forEach(this::attack);
if (rotate.get() == RotationMode.Always) {
Rotations.rotate(primary, 30, () -> attackTargets());
} else {
attackTargets();
}
}

@EventHandler
Expand Down Expand Up @@ -456,11 +459,20 @@ private boolean delayCheck() {
} else return true;
} else return mc.player.getAttackStrengthScale(delay) >= 1;
}

private void attackTargets() {
if (!delayCheck()) return;

private void attack(Entity target) {
if (rotation.get() == RotationMode.OnHit)
Rotations.rotate(Rotations.getYaw(target), Rotations.getPitch(target, Target.Body));
for (Entity target : targets) {
if (rotate.get() == RotationMode.OnHit) {
Rotations.rotate(target, 30, () -> attack(target));
} else {
attack(target);
}
}
}

private void attack(Entity target) {
mc.gameMode.attack(mc.player, target);
SwingMode.Both.attackSwing(InteractionHand.MAIN_HAND);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ private void queueBucketUse(FindItemResult item, BlockHitResult hit, PlacedItem
boolean useNow = pickup || isWithinPlaceReach(hit.getLocation());
Vec3 aim = pickup ? Vec3.atCenterOf(hit.getBlockPos()) : hit.getLocation();
if (rotate.get()) Rotations.rotate(Rotations.getYaw(aim), Rotations.getPitch(aim),
Integer.MAX_VALUE, true, useNow ? null : use);
Integer.MAX_VALUE, useNow ? null : use);
else if (!useNow) pendingBucketUse = use;
if (useNow) use.run();
}
Expand Down
Loading
Loading