Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
cvs0 committed Jan 26, 2025
2 parents a0f3013 + 89577e4 commit 10f173c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 14 deletions.
16 changes: 11 additions & 5 deletions src/main/java/net/aoba/mixin/CameraMixin.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package net.aoba.mixin;

import net.aoba.module.modules.movement.Freecam;
import net.aoba.module.modules.render.NoRender;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -10,6 +8,9 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import net.aoba.Aoba;
import net.aoba.AobaClient;
import net.aoba.module.modules.movement.Freecam;
import net.aoba.module.modules.render.NoRender;
import net.minecraft.block.enums.CameraSubmersionType;
import net.minecraft.client.render.Camera;
import net.minecraft.entity.Entity;
Expand All @@ -33,7 +34,8 @@ public class CameraMixin {
@At("HEAD") }, method = "update(Lnet/minecraft/world/BlockView;Lnet/minecraft/entity/Entity;ZZF)V", cancellable = true)
private void onCameraUdate(BlockView area, Entity focusedEntity, boolean thirdPerson, boolean inverseView,
float tickDelta, CallbackInfo ci) {
if (Aoba.getInstance().moduleManager.freecam.state.getValue()) {
AobaClient aoba = Aoba.getInstance();
if (aoba != null && aoba.moduleManager.freecam.state.getValue()) {
this.ready = true;
this.area = area;
this.lastTickDelta = tickDelta;
Expand All @@ -45,8 +47,12 @@ private void onCameraUdate(BlockView area, Entity focusedEntity, boolean thirdPe
@Inject(at = {
@At("HEAD") }, method = "getSubmersionType()Lnet/minecraft/block/enums/CameraSubmersionType;", cancellable = true)
private void onGetSubmersionType(CallbackInfoReturnable<CameraSubmersionType> cir) {
Freecam freecam = Aoba.getInstance().moduleManager.freecam;
NoRender norender = Aoba.getInstance().moduleManager.norender;
AobaClient aoba = Aoba.getInstance();
if (aoba == null)
return;

Freecam freecam = aoba.moduleManager.freecam;
NoRender norender = aoba.moduleManager.norender;

if (freecam.state.getValue() || (norender.state.getValue() && norender.getNoLiquidOverlay())) {
cir.setReturnValue(CameraSubmersionType.NONE);
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/net/aoba/mixin/GameOptionsMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ private void onGetGamma(CallbackInfoReturnable<SimpleOption<Double>> cir) {
return;

AobaClient aoba = Aoba.getInstance();
if (aoba == null)
return;

if (aoba.moduleManager.fullbright.state.getValue() || aoba.moduleManager.xray.state.getValue()) {
cir.setReturnValue(fullbrightOption);
}
Expand Down
28 changes: 19 additions & 9 deletions src/main/java/net/aoba/mixin/GameRendererMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@

package net.aoba.mixin;

import com.llamalad7.mixinextras.sugar.Local;
import net.aoba.utils.render.Render2D;
import net.minecraft.client.render.RenderTickCounter;
import org.joml.Matrix4f;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand All @@ -29,11 +26,16 @@
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import com.llamalad7.mixinextras.sugar.Local;

import net.aoba.Aoba;
import net.aoba.AobaClient;
import net.aoba.module.modules.render.NoRender;
import net.aoba.utils.render.Render2D;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.render.RenderTickCounter;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
Expand All @@ -50,22 +52,26 @@ public abstract class GameRendererMixin {
@Inject(at = { @At("HEAD") }, method = {
"bobView(Lnet/minecraft/client/util/math/MatrixStack;F)V" }, cancellable = true)
private void onBobViewWhenHurt(MatrixStack matrixStack, float f, CallbackInfo ci) {
if (Aoba.getInstance().moduleManager.norender.state.getValue()) {
AobaClient aoba = Aoba.getInstance();
if (aoba != null && aoba.moduleManager.norender.state.getValue()) {
ci.cancel();
}
}

@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;lerp(FFF)F", ordinal = 0), method = {
"renderWorld(Lnet/minecraft/client/render/RenderTickCounter;)V" })
private float nauseaLerp(float delta, float first, float second) {
if (Aoba.getInstance().moduleManager.norender.state.getValue()) {
AobaClient aoba = Aoba.getInstance();
if (aoba != null && aoba.moduleManager.norender.state.getValue())
return 0;
}

return MathHelper.lerp(delta, first, second);
}

@Inject(method = "renderWorld", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", args = {"ldc=hand"}))
private void onRenderWorld(RenderTickCounter tickCounter, CallbackInfo ci, @Local(ordinal = 2) Matrix4f matrix4f3, @Local(ordinal = 1) float tickDelta, @Local MatrixStack matrixStack) {
@Inject(method = "renderWorld", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", args = {
"ldc=hand" }))
private void onRenderWorld(RenderTickCounter tickCounter, CallbackInfo ci, @Local(ordinal = 2) Matrix4f matrix4f3,
@Local(ordinal = 1) float tickDelta, @Local MatrixStack matrixStack) {
if (client == null && client.world == null && client.player == null) {
return;
}
Expand All @@ -75,7 +81,11 @@ private void onRenderWorld(RenderTickCounter tickCounter, CallbackInfo ci, @Loca

@Inject(method = "showFloatingItem", at = @At("HEAD"), cancellable = true)
private void onShowFloatingItem(ItemStack floatingItem, CallbackInfo info) {
NoRender norender = (NoRender) Aoba.getInstance().moduleManager.norender;
AobaClient aoba = Aoba.getInstance();
if (aoba == null)
return;

NoRender norender = (NoRender) aoba.moduleManager.norender;
if (floatingItem.getItem() == Items.TOTEM_OF_UNDYING && norender.state.getValue()
&& norender.getNoTotemAnimation()) {
info.cancel();
Expand Down

0 comments on commit 10f173c

Please sign in to comment.