diff --git a/README.md b/README.md index e04b703..922b9e0 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,7 @@ - `Random characters` (Ported from [BleachHack](https://github.com/BleachDrinker420/BleachHack)) - Module - `Duplicate names` +- KillAura & Aim Assist: FoV option ## Commands - `.center` diff --git a/src/main/java/anticope/rejects/mixin/ChestBlockEntityRendererMixin.java b/src/main/java/anticope/rejects/mixin/ChestBlockEntityRendererMixin.java deleted file mode 100644 index e26070c..0000000 --- a/src/main/java/anticope/rejects/mixin/ChestBlockEntityRendererMixin.java +++ /dev/null @@ -1,34 +0,0 @@ -package anticope.rejects.mixin; - -import net.minecraft.client.model.ModelPart; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.block.entity.ChestBlockEntityRenderer; -import net.minecraft.client.util.math.MatrixStack; - -import anticope.rejects.modules.Rendering; -import meteordevelopment.meteorclient.systems.modules.Modules; - -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; - -@Mixin(ChestBlockEntityRenderer.class) -public class ChestBlockEntityRendererMixin { - @Shadow private boolean christmas; - - @Inject(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;Lnet/minecraft/client/model/ModelPart;Lnet/minecraft/client/model/ModelPart;Lnet/minecraft/client/model/ModelPart;FII)V", at = @At("HEAD"), cancellable = true) - public void render1(MatrixStack matrices, VertexConsumer vertices, ModelPart lid, ModelPart latch, ModelPart base, float openFactor, int light, int overlay, CallbackInfo ci) { - Rendering rendering = Modules.get().get(Rendering.class); - if (rendering != null) - this.christmas = rendering.chistmas(); - } - - @Inject(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;Lnet/minecraft/client/model/ModelPart;Lnet/minecraft/client/model/ModelPart;Lnet/minecraft/client/model/ModelPart;FII)V", at = @At("RETURN")) - public void render2(MatrixStack matrices, VertexConsumer vertices, ModelPart lid, ModelPart latch, ModelPart base, float openFactor, int light, int overlay, CallbackInfo ci) { - Rendering rendering = Modules.get().get(Rendering.class); - if (rendering != null) - this.christmas = rendering.chistmas(); - } -} diff --git a/src/main/java/anticope/rejects/mixin/TexturedRenderLayersMixin.java b/src/main/java/anticope/rejects/mixin/TexturedRenderLayersMixin.java new file mode 100644 index 0000000..661fbb0 --- /dev/null +++ b/src/main/java/anticope/rejects/mixin/TexturedRenderLayersMixin.java @@ -0,0 +1,19 @@ +package anticope.rejects.mixin; + +import anticope.rejects.modules.Rendering; +import meteordevelopment.meteorclient.systems.modules.Modules; +import net.minecraft.client.render.TexturedRenderLayers; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyVariable; + +@Mixin(TexturedRenderLayers.class) +public class TexturedRenderLayersMixin { + @ModifyVariable(method = "getChestTexture(Lnet/minecraft/block/entity/BlockEntity;Lnet/minecraft/block/enums/ChestType;Z)Lnet/minecraft/client/util/SpriteIdentifier;", at = @At("LOAD"), name = "christmas") + private static boolean chrsitmas(boolean christmas) { + Rendering rendering = Modules.get().get(Rendering.class); + if (rendering != null && rendering.chistmas()) + return true; + return christmas; + } +} diff --git a/src/main/java/anticope/rejects/mixin/meteor/ModuleMixin.java b/src/main/java/anticope/rejects/mixin/meteor/ModuleMixin.java index b3b14bf..2cc1eb4 100644 --- a/src/main/java/anticope/rejects/mixin/meteor/ModuleMixin.java +++ b/src/main/java/anticope/rejects/mixin/meteor/ModuleMixin.java @@ -12,13 +12,13 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@Mixin(Module.class) +@Mixin(value = Module.class, remap = false) public class ModuleMixin { - @Mutable @Shadow(remap = false) public String name; + @Mutable @Shadow public String name; - @Mutable @Shadow(remap = false) public String title; + @Mutable @Shadow public String title; - @Inject(method = "", at = @At("TAIL"), remap = false) + @Inject(method = "", at = @At("TAIL")) private void onInit(Category category, String name, String description, CallbackInfo info) { if (RejectsConfig.get().duplicateModuleNames) { this.name = RejectsUtils.getModuleName(name); diff --git a/src/main/java/anticope/rejects/mixin/meteor/modules/AimAssistMixin.java b/src/main/java/anticope/rejects/mixin/meteor/modules/AimAssistMixin.java new file mode 100644 index 0000000..58a2ba2 --- /dev/null +++ b/src/main/java/anticope/rejects/mixin/meteor/modules/AimAssistMixin.java @@ -0,0 +1,39 @@ +package anticope.rejects.mixin.meteor.modules; + +import anticope.rejects.utils.RejectsUtils; +import meteordevelopment.meteorclient.settings.DoubleSetting; +import meteordevelopment.meteorclient.settings.Setting; +import meteordevelopment.meteorclient.settings.SettingGroup; +import meteordevelopment.meteorclient.systems.modules.combat.AimAssist; +import net.minecraft.entity.Entity; +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; + +@Mixin(value = AimAssist.class, remap = false) +public class AimAssistMixin { + @Shadow @Final private SettingGroup sgGeneral; + + private Setting fov; + + @Inject(method = "", at = @At("TAIL")) + private void onInit(CallbackInfo info) { + fov = sgGeneral.add(new DoubleSetting.Builder() + .name("fov") + .description("Will only aim entities in the fov.") + .defaultValue(360) + .min(0) + .max(360) + .build() + ); + } + + @Inject(method = "lambda$onTick$1", at = @At(value = "RETURN", ordinal = 5), cancellable = true) + private void onCheckEntity(Entity entity, CallbackInfoReturnable info) { + info.setReturnValue(RejectsUtils.inFov(entity, fov.get())); + } +} diff --git a/src/main/java/anticope/rejects/mixin/meteor/modules/InventoryTweaksMixin.java b/src/main/java/anticope/rejects/mixin/meteor/modules/InventoryTweaksMixin.java index 48ba5e4..4b0ed31 100644 --- a/src/main/java/anticope/rejects/mixin/meteor/modules/InventoryTweaksMixin.java +++ b/src/main/java/anticope/rejects/mixin/meteor/modules/InventoryTweaksMixin.java @@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; public abstract class InventoryTweaksMixin implements IInventoryTweaks { private Runnable callback; - @Inject(method = "lambda$steal$3", at = @At("RETURN")) + @Inject(method = "lambda$steal$4", at = @At("RETURN")) private void afterSteal(ScreenHandler handler, CallbackInfo info) { if (callback != null) { callback.run(); diff --git a/src/main/java/anticope/rejects/mixin/meteor/modules/KillAuraMixin.java b/src/main/java/anticope/rejects/mixin/meteor/modules/KillAuraMixin.java new file mode 100644 index 0000000..cd8d62a --- /dev/null +++ b/src/main/java/anticope/rejects/mixin/meteor/modules/KillAuraMixin.java @@ -0,0 +1,41 @@ +package anticope.rejects.mixin.meteor.modules; + +import anticope.rejects.utils.RejectsUtils; +import meteordevelopment.meteorclient.settings.DoubleSetting; +import meteordevelopment.meteorclient.settings.Setting; +import meteordevelopment.meteorclient.settings.SettingGroup; +import meteordevelopment.meteorclient.systems.modules.combat.KillAura; +import net.minecraft.entity.Entity; +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; + +@Mixin(value = KillAura.class, remap = false) +public class KillAuraMixin { + @Shadow + @Final + private SettingGroup sgGeneral; + + private Setting fov; + + @Inject(method = "", at = @At("TAIL")) + private void onInit(CallbackInfo info) { + fov = sgGeneral.add(new DoubleSetting.Builder() + .name("fov") + .description("Will only aim entities in the fov.") + .defaultValue(360) + .min(0) + .max(360) + .build() + ); + } + + @Inject(method = "entityCheck", at = @At(value = "RETURN", ordinal = 14), cancellable = true) + private void onReturn(Entity entity, CallbackInfoReturnable info) { + info.setReturnValue(info.getReturnValueZ() && RejectsUtils.inFov(entity, fov.get())); + } +} diff --git a/src/main/java/anticope/rejects/utils/RejectsUtils.java b/src/main/java/anticope/rejects/utils/RejectsUtils.java index 1b730de..d6134e9 100644 --- a/src/main/java/anticope/rejects/utils/RejectsUtils.java +++ b/src/main/java/anticope/rejects/utils/RejectsUtils.java @@ -5,9 +5,14 @@ import meteordevelopment.meteorclient.MeteorClient; import meteordevelopment.meteorclient.systems.modules.Module; import meteordevelopment.meteorclient.systems.modules.Modules; import meteordevelopment.meteorclient.utils.PostInit; +import meteordevelopment.meteorclient.utils.player.PlayerUtils; +import net.minecraft.entity.Entity; +import net.minecraft.util.math.MathHelper; import java.util.Random; +import static meteordevelopment.meteorclient.MeteorClient.mc; + public class RejectsUtils { @PostInit @@ -40,4 +45,12 @@ public class RejectsUtils { } return sb.toString(); } + + public static boolean inFov(Entity entity, double fov) { + float[] angle = PlayerUtils.calculateAngle(entity.getBoundingBox().getCenter()); + double xDist = MathHelper.angleBetween(angle[0], mc.player.getYaw()); + double yDist = MathHelper.angleBetween(angle[1], mc.player.getPitch()); + double angleDistance = Math.hypot(xDist, yDist); + return angleDistance <= fov; + } } diff --git a/src/main/resources/meteor-rejects-meteor.mixins.json b/src/main/resources/meteor-rejects-meteor.mixins.json index 1aaaab3..6cb2bd7 100644 --- a/src/main/resources/meteor-rejects-meteor.mixins.json +++ b/src/main/resources/meteor-rejects-meteor.mixins.json @@ -13,6 +13,8 @@ "modules.FlightMixin", "modules.NoRenderAccessor", "modules.AutoSignMixin", - "modules.InventoryTweaksMixin" + "modules.InventoryTweaksMixin", + "modules.KillAuraMixin", + "modules.AimAssistMixin" ] } diff --git a/src/main/resources/meteor-rejects.mixins.json b/src/main/resources/meteor-rejects.mixins.json index c462b7f..65979a2 100644 --- a/src/main/resources/meteor-rejects.mixins.json +++ b/src/main/resources/meteor-rejects.mixins.json @@ -3,7 +3,7 @@ "package": "anticope.rejects.mixin", "compatibilityLevel": "JAVA_16", "client": [ - "ChestBlockEntityRendererMixin", + "TexturedRenderLayersMixin", "ClientPlayNetworkHandlerMixin", "ClientPlayerInteractionManagerMixin", "CommandSuggestorMixin",