Skip to content

Commit

Permalink
fixes and resolve todos
Browse files Browse the repository at this point in the history
  • Loading branch information
Wide-Cat committed Apr 25, 2024
1 parent e3c0209 commit e478060
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,36 @@

package meteordevelopment.meteorclient.mixin;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.modules.render.Freecam;
import net.minecraft.client.item.CompassAnglePredicateProvider;
import net.minecraft.client.render.Camera;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

import static meteordevelopment.meteorclient.MeteorClient.mc;

@Mixin(CompassAnglePredicateProvider.class)
public abstract class CompassAnglePredicateProviderMixin {
// TODO: I don't fucking know, someone fix this
/*@Redirect(method = "method_43213", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getBodyYaw()F"))
private float callLivingEntityGetYaw(Entity entity) {
@ModifyExpressionValue(method = "getBodyYaw", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getBodyYaw()F"))
private float callLivingEntityGetYaw(float original) {
if (Modules.get().isActive(Freecam.class)) return mc.gameRenderer.getCamera().getYaw();
return entity.getYaw();
}*/
return original;
}

/*@Inject(method = "getAngleTo", at = @At("HEAD"), cancellable = true)
private void onGetAngleToPos(Entity entity, long time, BlockPos pos, CallbackInfoReturnable<Float> info) {
@ModifyReturnValue(method = "getAngleTo(Lnet/minecraft/entity/Entity;Lnet/minecraft/util/math/BlockPos;)D", at = @At("RETURN"))
private double modifyGetAngleTo(double original, Entity entity, BlockPos pos) {
if (Modules.get().isActive(Freecam.class)) {
Vec3d vec3d = Vec3d.ofCenter(pos);
Camera camera = mc.gameRenderer.getCamera();
info.setReturnValue((float) Math.atan2(pos.getZ() - camera.getPos().z, pos.getX() - camera.getPos().x));
return Math.atan2(vec3d.getZ() - camera.getPos().z, vec3d.getX() - camera.getPos().x) / (float) (Math.PI * 2);
}
}*/

return original;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.modules.player.LiquidInteract;
import meteordevelopment.meteorclient.systems.modules.player.NoMiningTrace;
import meteordevelopment.meteorclient.systems.modules.player.Reach;
import meteordevelopment.meteorclient.systems.modules.render.Freecam;
import meteordevelopment.meteorclient.systems.modules.render.NoRender;
import meteordevelopment.meteorclient.systems.modules.render.Zoom;
Expand All @@ -38,7 +37,6 @@
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.ModifyVariable;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
Expand Down Expand Up @@ -212,14 +210,4 @@ private void renderHand(Camera camera, float tickDelta, Matrix4f matrix4f, Callb
!Modules.get().get(Zoom.class).renderHands())
ci.cancel();
}

@ModifyVariable(method = "findCrosshairTarget", at = @At("HEAD"), ordinal = 0, argsOnly = true)
private double modifyBlockInteractionReach(double blockInteractionRange) {
return Modules.get().get(Reach.class).blockReach();
}

@ModifyVariable(method = "findCrosshairTarget", at = @At("HEAD"), ordinal = 1, argsOnly = true)
private double modifyEntityInteractionReach(double entityInteractionRange) {
return Modules.get().get(Reach.class).entityReach();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,6 @@ private boolean onCanWalkOnFluid(boolean original, FluidState fluidState) {
return event.walkOnFluid;
}

/* todo need to fix this
@ModifyExpressionValue(method = "travel", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getFinalGravity()D"))
private double travelHasNoGravityProxy(double original) {
if (activeStatusEffects.containsKey(StatusEffects.LEVITATION) && Modules.get().get(PotionSpoof.class).shouldBlock(StatusEffects.LEVITATION.value())) {
return !Modules.get().get(PotionSpoof.class).applyGravity.get();
}
return original;
}
*/

@Inject(method = "spawnItemParticles", at = @At("HEAD"), cancellable = true)
private void spawnItemParticles(ItemStack stack, int count, CallbackInfo info) {
NoRender noRender = Modules.get().get(NoRender.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import meteordevelopment.meteorclient.systems.modules.movement.Flight;
import meteordevelopment.meteorclient.systems.modules.movement.NoSlow;
import meteordevelopment.meteorclient.systems.modules.movement.Scaffold;
import meteordevelopment.meteorclient.systems.modules.player.Reach;
import meteordevelopment.meteorclient.systems.modules.player.SpeedMine;
import meteordevelopment.meteorclient.utils.world.BlockUtils;
import net.minecraft.block.BlockState;
Expand Down Expand Up @@ -112,8 +113,7 @@ private void onGetOffGroundSpeed(CallbackInfoReturnable<Float> info) {
if (speed != -1) info.setReturnValue(speed);
}

// FIXME might not be needed?
/*

@ModifyReturnValue(method = "getBlockInteractionRange", at = @At("RETURN"))
private double modifyBlockInteractionRange(double original) {
return Modules.get().get(Reach.class).blockReach();
Expand All @@ -123,6 +123,4 @@ private double modifyBlockInteractionRange(double original) {
private double modifyEntityInteractionRange(double original) {
return Modules.get().get(Reach.class).entityReach();
}
*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public abstract class SplashTextResourceSupplierMixin {
@Unique
private boolean override = true;
@Unique
private final Random random = new Random();
private static final Random random = new Random();
@Unique
private final List<String> meteorSplashes = getMeteorSplashes();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import meteordevelopment.meteorclient.settings.SettingGroup;
import meteordevelopment.meteorclient.systems.modules.Categories;
import meteordevelopment.meteorclient.systems.modules.Module;
import net.minecraft.entity.attribute.EntityAttributes;

public class Reach extends Module {
private final SettingGroup sgGeneral = settings.getDefaultGroup();
Expand All @@ -36,13 +37,13 @@ public Reach() {
super(Categories.Player, "reach", "Gives you super long arms.");
}

public float blockReach() {
if (!isActive()) return mc.interactionManager.getCurrentGameMode().isCreative() ? 5.0F : 4.5F;
public double blockReach() {
if (!isActive()) return mc.player.getAttributeValue(EntityAttributes.PLAYER_BLOCK_INTERACTION_RANGE);
return blockReach.get().floatValue();
}

public float entityReach() {
if (!isActive()) return 3;
public double entityReach() {
if (!isActive()) return mc.player.getAttributeValue(EntityAttributes.PLAYER_ENTITY_INTERACTION_RANGE);
return entityReach.get().floatValue();
}
}

0 comments on commit e478060

Please sign in to comment.