Исходник AspectRatio Expensive 4.0

Начинающий
Статус
Оффлайн
Регистрация
31 Авг 2023
Сообщения
14
Реакции[?]
0
Поинты[?]
0

Перед прочтением основного контента ниже, пожалуйста, обратите внимание на обновление внутри секции Майна на нашем форуме. У нас появились:

  • бесплатные читы для Майнкрафт — любое использование на свой страх и риск;
  • маркетплейс Майнкрафт — абсолютно любая коммерция, связанная с игрой, за исключением продажи читов (аккаунты, предоставления услуг, поиск кодеров читов и так далее);
  • приватные читы для Minecraft — в этом разделе только платные хаки для игры, покупайте группу "Продавец" и выставляйте на продажу свой софт;
  • обсуждения и гайды — всё тот же раздел с вопросами, но теперь модернизированный: поиск нужных хаков, пати с игроками-читерами и другая полезная информация.

Спасибо!

AspectRatio:
package ru.triplex.implement.features.modules.render;

import ru.triplex.api.event.EventManager;
import ru.triplex.api.feature.module.Module;
import ru.triplex.api.feature.module.ModuleCategory;
import ru.triplex.api.feature.module.setting.implement.ValueSetting;
import ru.triplex.implement.events.render.AspectRatioEvent;

public class AspectRatio extends Module {
    ValueSetting ratio = new ValueSetting("Соотношение", "Устанавливает соотношение сторон для игры")
            .setValue(1.5F).range(0.6F, 2.2F);
    AspectRatioEvent aspectRatioEvent = new AspectRatioEvent();

    public AspectRatio() {
        super("AspectRatio", ModuleCategory.RENDER);
        setup(ratio);
    }

    @Override
    public void activate() {
        super.activate();
        updateAspectRatio();
    }

    @Override
    public void deactivate() {
        super.deactivate();
        aspectRatioEvent.setRatio(1.8f);
        EventManager.callEvent(aspectRatioEvent);
    }

    public void updateAspectRatio() {
        aspectRatioEvent.setRatio(ratio.getValue());
        EventManager.callEvent(aspectRatioEvent);
    }
    public float getRatio() {
        return ratio.getValue();
    }
}
GameRendererMixin:
package ru.triplex.asm.mixins;

import com.mojang.datafixers.util.Pair;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gl.ShaderProgram;
import net.minecraft.client.gl.ShaderStage;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import net.minecraft.resource.ResourceFactory;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.Vec3d;
import org.joml.Matrix4f;
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.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import ru.triplex.api.event.EventManager;
import ru.triplex.core.Triplex;
import ru.triplex.implement.events.render.WorldRenderEvent;
import ru.triplex.api.system.shader.Shader;
import ru.triplex.implement.features.modules.combat.killaura.rotation.Angle;
import ru.triplex.implement.features.modules.combat.killaura.rotation.RaytracingUtil;
import ru.triplex.implement.features.modules.combat.killaura.rotation.RotationController;
import ru.triplex.implement.features.modules.render.AspectRatio;

import java.util.List;
import java.util.function.Consumer;

@Mixin(GameRenderer.class)
public class GameRendererMixin {
    [USER=8455]@Shadow[/USER]
    [USER=346354]@FINAL[/USER]
    MinecraftClient client;
    [USER=8455]@Shadow[/USER]
    private float zoom;

    [USER=8455]@Shadow[/USER]
    private float zoomX;
    [USER=8455]@Shadow[/USER]
    [USER=346354]@FINAL[/USER]
    private Camera camera;
    [USER=8455]@Shadow[/USER]
    private float zoomY;
    [USER=8455]@Shadow[/USER]
    private float viewDistance;

    @Inject(method = "loadPrograms", at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD)
    void loadAllTheShaders(ResourceFactory factory, CallbackInfo ci, List<ShaderStage> stages, List<Pair<ShaderProgram, Consumer<ShaderProgram>>> shadersToLoad) {
        Shader.REGISTERED_PROGRAMS.forEach(loader -> shadersToLoad.add(
                        new Pair<>(
                                loader.getLeft().apply(factory),
                                loader.getRight()
                        )
                )
        );
    }

    @Redirect(method = "updateTargetedEntity", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;raycast(DFZ)Lnet/minecraft/util/hit/HitResult;"))
    private HitResult hookRaycast(Entity instance, double maxDistance, float tickDelta, boolean includeFluids) {
        if (instance != client.player) return instance.raycast(maxDistance, tickDelta, includeFluids);

        Angle currentAngle = RotationController.INSTANCE.getCurrentAngle();
        Angle angle = currentAngle != null ? currentAngle : new Angle(instance.getYaw(tickDelta), instance.getPitch(tickDelta));

        return RaytracingUtil.raycast(maxDistance, angle, includeFluids);
    }

    @Redirect(method = "updateTargetedEntity", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getRotationVec(F)Lnet/minecraft/util/math/Vec3d;"))
    private Vec3d hookRotationVector(Entity instance, float tickDelta) {
        Angle angle = RotationController.INSTANCE.getCurrentAngle();

        return angle != null ? angle.toVector() : instance.getRotationVec(tickDelta);
    }


    @Inject(method = "getBasicProjectionMatrix", at = @At("TAIL"), cancellable = true)
    public void getBasicProjectionMatrixHook(double fov, CallbackInfoReturnable<Matrix4f> cir) {
        AspectRatio aspectRatioModule = (AspectRatio) Triplex.getInstance().getModuleProvider().module("AspectRatio");
        if (aspectRatioModule != null && aspectRatioModule.isState()) {
            aspectRatioModule.updateAspectRatio();

            MatrixStack matrixStack = new MatrixStack();
            matrixStack.peek().getPositionMatrix().identity();
            if (zoom != 1.0f) {
                matrixStack.translate(zoomX, -zoomY, 0.0f);
                matrixStack.scale(zoom, zoom, 1.0f);
            }
            matrixStack.peek().getPositionMatrix().mul(new Matrix4f().setPerspective((float) (fov * 0.01745329238474369), aspectRatioModule.getRatio(), 0.05f, viewDistance * 4.0f));
            cir.setReturnValue(matrixStack.peek().getPositionMatrix());
        }
    }

    @Inject(method = "renderWorld", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", args = "ldc=hand", shift = At.Shift.BEFORE))
    public void renderWorld(float tickDelta, long limitTime, MatrixStack matrices, CallbackInfo ci) {
        EventManager.callEvent(new WorldRenderEvent(matrices, tickDelta));
    }
}
 
Начинающий
Статус
Оффлайн
Регистрация
25 Янв 2024
Сообщения
367
Реакции[?]
0
Поинты[?]
1K
AspectRatio:
package ru.triplex.implement.features.modules.render;

import ru.triplex.api.event.EventManager;
import ru.triplex.api.feature.module.Module;
import ru.triplex.api.feature.module.ModuleCategory;
import ru.triplex.api.feature.module.setting.implement.ValueSetting;
import ru.triplex.implement.events.render.AspectRatioEvent;

public class AspectRatio extends Module {
    ValueSetting ratio = new ValueSetting("Соотношение", "Устанавливает соотношение сторон для игры")
            .setValue(1.5F).range(0.6F, 2.2F);
    AspectRatioEvent aspectRatioEvent = new AspectRatioEvent();

    public AspectRatio() {
        super("AspectRatio", ModuleCategory.RENDER);
        setup(ratio);
    }

    @Override
    public void activate() {
        super.activate();
        updateAspectRatio();
    }

    @Override
    public void deactivate() {
        super.deactivate();
        aspectRatioEvent.setRatio(1.8f);
        EventManager.callEvent(aspectRatioEvent);
    }

    public void updateAspectRatio() {
        aspectRatioEvent.setRatio(ratio.getValue());
        EventManager.callEvent(aspectRatioEvent);
    }
    public float getRatio() {
        return ratio.getValue();
    }
}
GameRendererMixin:
package ru.triplex.asm.mixins;

import com.mojang.datafixers.util.Pair;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gl.ShaderProgram;
import net.minecraft.client.gl.ShaderStage;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import net.minecraft.resource.ResourceFactory;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.Vec3d;
import org.joml.Matrix4f;
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.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import ru.triplex.api.event.EventManager;
import ru.triplex.core.Triplex;
import ru.triplex.implement.events.render.WorldRenderEvent;
import ru.triplex.api.system.shader.Shader;
import ru.triplex.implement.features.modules.combat.killaura.rotation.Angle;
import ru.triplex.implement.features.modules.combat.killaura.rotation.RaytracingUtil;
import ru.triplex.implement.features.modules.combat.killaura.rotation.RotationController;
import ru.triplex.implement.features.modules.render.AspectRatio;

import java.util.List;
import java.util.function.Consumer;

@Mixin(GameRenderer.class)
public class GameRendererMixin {
    [USER=8455]@Shadow[/USER]
    [USER=346354]@FINAL[/USER]
    MinecraftClient client;
    [USER=8455]@Shadow[/USER]
    private float zoom;

    [USER=8455]@Shadow[/USER]
    private float zoomX;
    [USER=8455]@Shadow[/USER]
    [USER=346354]@FINAL[/USER]
    private Camera camera;
    [USER=8455]@Shadow[/USER]
    private float zoomY;
    [USER=8455]@Shadow[/USER]
    private float viewDistance;

    @Inject(method = "loadPrograms", at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z", ordinal = 0), locals = LocalCapture.CAPTURE_FAILHARD)
    void loadAllTheShaders(ResourceFactory factory, CallbackInfo ci, List<ShaderStage> stages, List<Pair<ShaderProgram, Consumer<ShaderProgram>>> shadersToLoad) {
        Shader.REGISTERED_PROGRAMS.forEach(loader -> shadersToLoad.add(
                        new Pair<>(
                                loader.getLeft().apply(factory),
                                loader.getRight()
                        )
                )
        );
    }

    @Redirect(method = "updateTargetedEntity", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;raycast(DFZ)Lnet/minecraft/util/hit/HitResult;"))
    private HitResult hookRaycast(Entity instance, double maxDistance, float tickDelta, boolean includeFluids) {
        if (instance != client.player) return instance.raycast(maxDistance, tickDelta, includeFluids);

        Angle currentAngle = RotationController.INSTANCE.getCurrentAngle();
        Angle angle = currentAngle != null ? currentAngle : new Angle(instance.getYaw(tickDelta), instance.getPitch(tickDelta));

        return RaytracingUtil.raycast(maxDistance, angle, includeFluids);
    }

    @Redirect(method = "updateTargetedEntity", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getRotationVec(F)Lnet/minecraft/util/math/Vec3d;"))
    private Vec3d hookRotationVector(Entity instance, float tickDelta) {
        Angle angle = RotationController.INSTANCE.getCurrentAngle();

        return angle != null ? angle.toVector() : instance.getRotationVec(tickDelta);
    }


    @Inject(method = "getBasicProjectionMatrix", at = @At("TAIL"), cancellable = true)
    public void getBasicProjectionMatrixHook(double fov, CallbackInfoReturnable<Matrix4f> cir) {
        AspectRatio aspectRatioModule = (AspectRatio) Triplex.getInstance().getModuleProvider().module("AspectRatio");
        if (aspectRatioModule != null && aspectRatioModule.isState()) {
            aspectRatioModule.updateAspectRatio();

            MatrixStack matrixStack = new MatrixStack();
            matrixStack.peek().getPositionMatrix().identity();
            if (zoom != 1.0f) {
                matrixStack.translate(zoomX, -zoomY, 0.0f);
                matrixStack.scale(zoom, zoom, 1.0f);
            }
            matrixStack.peek().getPositionMatrix().mul(new Matrix4f().setPerspective((float) (fov * 0.01745329238474369), aspectRatioModule.getRatio(), 0.05f, viewDistance * 4.0f));
            cir.setReturnValue(matrixStack.peek().getPositionMatrix());
        }
    }

    @Inject(method = "renderWorld", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", args = "ldc=hand", shift = At.Shift.BEFORE))
    public void renderWorld(float tickDelta, long limitTime, MatrixStack matrices, CallbackInfo ci) {
        EventManager.callEvent(new WorldRenderEvent(matrices, tickDelta));
    }
}
Нахуй сливать то что есть в моем слитом сурсе?
 
Сверху Снизу