Skip to content

Commit

Permalink
Fixed FullFlight/NoClip (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
yorik100 authored Jun 15, 2023
1 parent 27174e7 commit 275fa1d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 8 deletions.
24 changes: 24 additions & 0 deletions src/main/java/anticope/rejects/mixin/MixinEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package anticope.rejects.mixin;

import meteordevelopment.meteorclient.systems.modules.Modules;
import anticope.rejects.modules.FullFlight;
import anticope.rejects.modules.FullNoClip;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.util.math.Vec3d;
import net.minecraft.block.BlockState;
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(Entity.class)
public abstract class MixinEntity {
@Inject(method = "slowMovement", at = @At("HEAD"), cancellable = true)
public void slowMovement(BlockState blockState, Vec3d multiplier, CallbackInfo ci) {
if (Modules.get().isActive(FullFlight.class) || Modules.get().isActive(FullNoClip.class)) ci.cancel();
}
}
7 changes: 7 additions & 0 deletions src/main/java/anticope/rejects/mixin/PlayerEntityMixin.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package anticope.rejects.mixin;

import anticope.rejects.events.OffGroundSpeedEvent;
import anticope.rejects.modules.FullNoClip;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.MeteorClient;
import net.minecraft.entity.player.PlayerEntity;
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.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(PlayerEntity.class)
Expand All @@ -14,4 +17,8 @@ public class PlayerEntityMixin {
private void onGetOffGroundSpeed(CallbackInfoReturnable<Float> cir) {
cir.setReturnValue(MeteorClient.EVENT_BUS.post(OffGroundSpeedEvent.get(cir.getReturnValueF())).speed);
}
@Redirect(method = {"tick", "updatePose"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;isSpectator()Z"))
private boolean FullNoClip(PlayerEntity player) {
return Modules.get().isActive(FullNoClip.class);
}
}
7 changes: 0 additions & 7 deletions src/main/java/anticope/rejects/modules/FullNoClip.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package anticope.rejects.modules;

import anticope.rejects.MeteorRejectsAddon;
import meteordevelopment.meteorclient.events.world.CollisionShapeEvent;
import meteordevelopment.meteorclient.events.entity.player.PlayerMoveEvent;
import meteordevelopment.meteorclient.mixininterface.IVec3d;
import meteordevelopment.meteorclient.systems.modules.Module;
Expand Down Expand Up @@ -32,12 +31,6 @@ public class FullNoClip extends Module {
public FullNoClip() {
super(MeteorRejectsAddon.CATEGORY, "fullnoclip", "FullNoClip.");
}

@EventHandler
private void onCollision(CollisionShapeEvent event) {
if (mc.player.getVehicle() == null)
event.shape = VoxelShapes.empty();
}

private double getDir() {
double dir = 0;
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/meteor-rejects.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"TexturedRenderLayersMixin",
"ToastManagerMixin",
"VehicleMoveC2SPacketAccessor",
"baritone.MineProcessMixin"
"baritone.MineProcessMixin",
"MixinEntity"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 275fa1d

Please sign in to comment.