TotemAnimation module

TotemAnimation: Minecraft 26.3 cheat module, full source for every implementation (1 client: MelaHack (ThunderHack fork)).

1 implementationRENDER

Clients with this module

Full module source: 1 implementation

Every implementation below is the complete module file, verbatim. Expand a client to read its code.

MelaHack (ThunderHack fork)RENDERsrc/main/java/thunder/hack/features/modules/render/TotemAnimation.javaJava · 134 lines · 6.1 KB
SettingsModeSpeed
TotemAnimation.javaJava · Minecraft 26.2 · 134 lines · 6.1 KB · complete file, verbatimOriginal ↗
1
package thunder.hack.features.modules.render;
2
3
import thunder.hack.utility.render.compat.RenderSystem;
4
import com.mojang.blaze3d.vertex.PoseStack;
5
import com.mojang.math.Axis;
6
import net.minecraft.client.gui.GuiGraphicsExtractor;
7
import net.minecraft.util.Mth;
8
import net.minecraft.world.item.ItemDisplayContext;
9
import net.minecraft.world.item.ItemStack;
10
import thunder.hack.features.modules.Module;
11
import thunder.hack.setting.Setting;
12
13
public class TotemAnimation extends Module {
14
    public TotemAnimation() {
15
        super("TotemAnimation", Category.RENDER);
16
    }
17
18
    private final Setting<Mode> mode = new Setting<>("Mode", Mode.FadeOut);
19
    private final Setting<Integer> speed = new Setting<>("Speed", 40, 1, 100);
20
21
    private ItemStack floatingItem = null;
22
    private int floatingItemTimeLeft;
23
24
    public void showFloatingItem(ItemStack floatingItem) {
25
        this.floatingItem = floatingItem;
26
        floatingItemTimeLeft = getTime();
27
    }
28
29
    @Override
30
    public void onUpdate() {
31
        if (floatingItemTimeLeft > 0) {
32
            --floatingItemTimeLeft;
33
            if (floatingItemTimeLeft == 0) {
34
                floatingItem = null;
35
            }
36
        }
37
    }
38
39
    public void renderFloatingItem(GuiGraphicsExtractor context, float tickDelta) {
40
        if (floatingItem != null && floatingItemTimeLeft > 0 && !mode.is(Mode.Off)) {
41
            int scaledWidth = mc.getWindow().getGuiScaledWidth();
42
            int scaledHeight = mc.getWindow().getGuiScaledHeight();
43
44
            int elapsedTime = getTime() - floatingItemTimeLeft;
45
            float animationProgress = ((float) elapsedTime + tickDelta) / (float) getTime();
46
            float progressSquared = animationProgress * animationProgress;
47
            float progressCubed = animationProgress * progressSquared;
48
            float oscillationFactor = 10.25F * progressCubed * progressSquared - 24.95F * progressSquared * progressSquared + 25.5F * progressCubed - 13.8F * progressSquared + 4.0F * animationProgress;
49
            float oscillationRadians = oscillationFactor * 3.1415927F;
50
            RenderSystem.enableDepthTest();
51
            RenderSystem.disableCull();
52
            RenderSystem.enableBlend();
53
            RenderSystem.defaultBlendFunc();
54
            PoseStack matrixStack = new PoseStack();
55
            matrixStack.pushPose();
56
            float adjustedProgress = ((float) elapsedTime + tickDelta);
57
            float scale = 50.0F + 175.0F * Mth.sin(oscillationRadians);
58
59
            switch (mode.getValue()) {
60
                case FadeOut -> {
61
                    final float x2 = (float) (Math.sin(((adjustedProgress * 112) / 180f)) * 100);
62
                    final float y2 = (float) (Math.cos(((adjustedProgress * 112) / 180f)) * 50);
63
                    matrixStack.translate((float) (scaledWidth / 2) + x2, (float) (scaledHeight / 2) + y2, -50.0F);
64
                    matrixStack.scale(scale, -scale, scale);
65
                }
66
67
                case Size -> {
68
                    matrixStack.translate((float) (scaledWidth / 2), (float) (scaledHeight / 2), -50.0F);
69
                    matrixStack.scale(scale, -scale, scale);
70
                }
71
72
                case Otkisuli -> {
73
                    matrixStack.translate((float) (scaledWidth / 2), (float) (scaledHeight / 2), -50.0F);
74
                    matrixStack.mulPose(Axis.XP.rotationDegrees(adjustedProgress * 2));
75
                    matrixStack.mulPose(Axis.ZP.rotationDegrees(adjustedProgress * 2));
76
                    matrixStack.scale(200 - adjustedProgress * 1.5f, -200 + adjustedProgress * 1.5f, 200 - adjustedProgress * 1.5f);
77
                }
78
79
                case Insert -> {
80
                    matrixStack.translate((float) (scaledWidth / 2), (float) (scaledHeight / 2), -50.0F);
81
                    matrixStack.mulPose(Axis.XP.rotationDegrees(adjustedProgress * 3));
82
                    matrixStack.scale(200 - adjustedProgress * 1.5f, -200 + adjustedProgress * 1.5f, 200 - adjustedProgress * 1.5f);
83
                }
84
85
                case Fall -> {
86
                    float downFactor = (float) (Math.pow(adjustedProgress, 3) * 0.2f);
87
                    matrixStack.translate((float) (scaledWidth / 2), (float) (scaledHeight / 2) + downFactor, -50.0F);
88
                    matrixStack.mulPose(Axis.ZP.rotationDegrees(adjustedProgress * 5));
89
                    matrixStack.scale(200 - adjustedProgress * 1.5f, -200 + adjustedProgress * 1.5f, 200 - adjustedProgress * 1.5f);
90
                }
91
92
                case Rocket -> {
93
                    float downFactor = (float) (Math.pow(adjustedProgress, 3) * 0.2f) - 20;
94
                    matrixStack.translate((float) (scaledWidth / 2), (float) (scaledHeight / 2) - downFactor, -50.0F);
95
                    matrixStack.mulPose(Axis.YP.rotationDegrees(adjustedProgress * floatingItemTimeLeft * 2));
96
                    matrixStack.scale(200 - adjustedProgress * 1.5f, -200 + adjustedProgress * 1.5f, 200 - adjustedProgress * 1.5f);
97
                }
98
99
                case Roll -> {
100
                    float rightFactor = (float) (Math.pow(adjustedProgress, 2) * 4.5f);
101
                    matrixStack.translate((float) (scaledWidth / 2) + rightFactor, (float) (scaledHeight / 2), -50.0F);
102
                    matrixStack.mulPose(Axis.ZP.rotationDegrees(adjustedProgress * 40));
103
                    matrixStack.scale(200 - adjustedProgress * 1.5f, -200 + adjustedProgress * 1.5f, 200 - adjustedProgress * 1.5f);
104
                }
105
            }
106
107
            RenderSystem.setShaderColor(1f, 1f, 1f, 1f - animationProgress);
108
            context.item(floatingItem, scaledWidth / 2 - 8, scaledHeight / 2 - 8);
109
            matrixStack.popPose();
110
            RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
111
112
            RenderSystem.disableBlend();
113
            RenderSystem.enableCull();
114
            RenderSystem.disableDepthTest();
115
        }
116
    }
117
118
    private int getTime() {
119
        int invertedSpeed = 101 - speed.getValue();
120
121
        if (mode.is(Mode.FadeOut))
122
            return invertedSpeed / 4;
123
124
        if (mode.is(Mode.Insert))
125
            return invertedSpeed / 2;
126
127
        return invertedSpeed;
128
    }
129
130
    private enum Mode {
131
        FadeOut, Size, Otkisuli, Insert, Fall, Rocket, Roll, Off
132
    }
133
}
134