TotemFX module

TotemFX: Minecraft 26.3 cheat module, full source for every implementation (1 client: Combatant).

1 implementationVISUALS

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.

CombatantVISUALSsrc/main/java/combatant/client/features/module/modules/visuals/TotemFX.javaJava · 249 lines · 9.6 KB
SettingstotemFxIntensitytotemFxDistortiontotemFxScaletotemFxSpeedtotemFxVignettetotemFxVignetteRadiustotemFxVignetteSoftnesstotemFxFadeIntotemFxHoldtotemFxFadeOuttotemFxPulseSpeedtotemFxPulseAmount
TotemFX.javaJava · Minecraft 26.2 · 249 lines · 9.6 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of the Combatant Client distribution.
3
 * Copyright (c) 2026 pivosos2007.
4
 *
5
 * Licensed under the GNU General Public License v3.0.
6
 */
7
8
package combatant.client.features.module.modules.visuals;
9
10
import com.mojang.blaze3d.textures.GpuTextureView;
11
import net.minecraft.client.Minecraft;
12
import net.minecraft.util.Mth;
13
import combatant.client.config.values.NumberValue;
14
import combatant.client.features.module.Module;
15
import combatant.client.features.module.ModuleCategory;
16
import combatant.client.features.module.ModuleInfo;
17
import combatant.client.features.module.WorldPhase;
18
import combatant.client.render.engine.pipeline.CombatantRenderPipelines;
19
import combatant.client.render.engine.postprocess.PostProcessManager;
20
import combatant.client.render.engine.postprocess.PostProcessExecutionContext;
21
import combatant.client.render.engine.postprocess.PostProcessPass;
22
import combatant.client.render.engine.renderer.FullScreenRenderer;
23
import combatant.client.render.engine.renderer.Renderer3D;
24
import combatant.client.render.engine.uniform.impl.HeatUniforms;
25
import combatant.client.render.effects.CurrentTransientEffectBackend;
26
import combatant.client.render.effects.EffectBudget;
27
import combatant.client.render.effects.area.CurrentWorldAreaPreviewRenderer;
28
import combatant.client.render.effects.area.WorldAreaPreviewDescriptor;
29
import combatant.client.render.effects.kernels.TransientAttackKernels;
30
import net.minecraft.world.phys.Vec3;
31
32
//todo Description
33
@ModuleInfo(id = "totemfx", displayName = "TotemFX", category = ModuleCategory.VISUALS)
34
public class TotemFX extends Module implements PostProcessPass {
35
36
    private static final String SETTING_INTENSITY = "intensity";
37
    private static final String SETTING_DISTORTION = "distortion";
38
    private static final String SETTING_SCALE = "scale";
39
    private static final String SETTING_SPEED = "speed";
40
    private static final String SETTING_VIGNETTE = "vignette";
41
    private static final String SETTING_VIGNETTE_RADIUS = "vignette_radius";
42
    private static final String SETTING_VIGNETTE_SOFTNESS = "vignette_softness";
43
    private static final String SETTING_FADE_IN = "fade_in";
44
    private static final String SETTING_HOLD = "hold";
45
    private static final String SETTING_FADE_OUT = "fade_out";
46
    private static final String SETTING_PULSE_SPEED = "pulse_speed";
47
    private static final String SETTING_PULSE_AMOUNT = "pulse_amount";
48
    private final Minecraft mc = Minecraft.getInstance();
49
    private final NumberValue<Float> intensity =
50
            num("totemFxIntensity", SETTING_INTENSITY, 0.65f, 0.0f, 2.0f);
51
    private final NumberValue<Float> distortion =
52
            num("totemFxDistortion", SETTING_DISTORTION, 0.7f, 0.0f, 2.0f);
53
    private final NumberValue<Float> scale =
54
            num("totemFxScale", SETTING_SCALE, 1.0f, 0.2f, 3.0f);
55
    private final NumberValue<Float> speed =
56
            num("totemFxSpeed", SETTING_SPEED, 1.2f, 0.0f, 4.0f);
57
    private final NumberValue<Float> vignette =
58
            num("totemFxVignette", SETTING_VIGNETTE, 0.45f, 0.0f, 1.0f);
59
    private final NumberValue<Float> vignetteRadius =
60
            num("totemFxVignetteRadius", SETTING_VIGNETTE_RADIUS, 0.45f, 0.1f, 0.9f);
61
    private final NumberValue<Float> vignetteSoftness =
62
            num("totemFxVignetteSoftness", SETTING_VIGNETTE_SOFTNESS, 0.35f, 0.05f, 0.9f);
63
    private final NumberValue<Float> fadeIn =
64
            num("totemFxFadeIn", SETTING_FADE_IN, 0.25f, 0.05f, 1.5f);
65
    private final NumberValue<Float> hold =
66
            num("totemFxHold", SETTING_HOLD, 0.9f, 0.0f, 4.0f);
67
    private final NumberValue<Float> fadeOut =
68
            num("totemFxFadeOut", SETTING_FADE_OUT, 0.6f, 0.05f, 2.5f);
69
    private final NumberValue<Float> pulseSpeed =
70
            num("totemFxPulseSpeed", SETTING_PULSE_SPEED, 1.6f, 0.1f, 6.0f);
71
    private final NumberValue<Float> pulseAmount =
72
            num("totemFxPulseAmount", SETTING_PULSE_AMOUNT, 0.35f, 0.0f, 1.0f);
73
74
    private static final long WORLD_RING_LIFETIME_MS = 620L;
75
    private static final int TOTEM_GOLD = 0xFFFFD36A;
76
    private static final int TOTEM_MINT = 0xFF68FFD5;
77
78
    private final CurrentTransientEffectBackend worldEffects =
79
            new CurrentTransientEffectBackend(new EffectBudget(64, 16, Integer.MIN_VALUE));
80
    private long startMs = -1L;
81
    private long nextEffectId = 1L;
82
    private volatile WorldBurst worldBurst;
83
84
    {
85
        TransientAttackKernels.register(worldEffects);
86
        PostProcessManager.register(this);
87
    }
88
89
    public void onTotemPop() {
90
        if (!isEnabled()) return;
91
        long now = System.currentTimeMillis();
92
        startMs = now;
93
        if (mc.player == null) return;
94
95
        Vec3 center = mc.player.position().add(0.0, mc.player.getBbHeight() * 0.48, 0.0);
96
        Vec3 ground = mc.player.position().add(0.0, 0.035, 0.0);
97
        worldBurst = new WorldBurst(ground, now);
98
        worldEffects.beginTick(mc.player.tickCount);
99
        worldEffects.spawn(TransientAttackKernels.plasma(
100
                nextEffectId++, center, now, 540L, now ^ 0x6A09E667F3BCC909L,
101
                mc.player.getId(), TOTEM_GOLD, TOTEM_MINT, 1.55f, 1.2f, 100
102
        ));
103
        worldEffects.spawn(TransientAttackKernels.sparks(
104
                nextEffectId++, center, now, 680L, now ^ 0xBB67AE8584CAA73BL,
105
                mc.player.getId(), TOTEM_MINT, TOTEM_GOLD, 2.6f, 24, 1.15f, 100
106
        ));
107
    }
108
109
    @Override
110
    public boolean isActive() {
111
        return isEnabled()
112
                && mc.player != null
113
                && mc.level != null
114
                && startMs >= 0L;
115
    }
116
117
118
    @Override
119
    public WorldPhase getWorldPhase() {
120
        return WorldPhase.END_MAIN;
121
    }
122
123
    @Override
124
    public void onRenderWorldEngine(Renderer3D renderer, Renderer3D depthRenderer, float tickDelta) {
125
        if (!isEnabled() || renderer == null || mc.level == null || mc.player == null) return;
126
        long now = System.currentTimeMillis();
127
        worldEffects.render(renderer, tickDelta, now);
128
129
        WorldBurst burst = worldBurst;
130
        if (burst == null) return;
131
        float t = Math.max(0.0f, Math.min(1.0f, (now - burst.startedMs()) / (float) WORLD_RING_LIFETIME_MS));
132
        if (t >= 1.0f) {
133
            worldBurst = null;
134
            return;
135
        }
136
        float eased = t * t * (3.0f - 2.0f * t);
137
        float radius = 0.35f + eased * 3.25f;
138
        float thickness = 0.22f - eased * 0.12f;
139
        float alpha = (float) Math.pow(1.0f - t, 1.45);
140
        CurrentWorldAreaPreviewRenderer.render(renderer, new WorldAreaPreviewDescriptor(
141
                WorldAreaPreviewDescriptor.Shape.RING,
142
                burst.center(),
143
                radius,
144
                Math.max(0.0f, radius - thickness),
145
                0.0f,
146
                Vec3.ZERO,
147
                0.0f,
148
                (float) (Math.PI * 2.0),
149
                72,
150
                java.util.List.of(),
151
                TOTEM_MINT,
152
                TOTEM_GOLD,
153
                0.16f * alpha,
154
                0.92f * alpha,
155
                true
156
        ));
157
    }
158
159
    @Override
160
    public void onDisable() {
161
        startMs = -1L;
162
        worldBurst = null;
163
        worldEffects.clear();
164
    }
165
166
    @Override
167
    public int getPriority() {
168
        return 12;
169
    }
170
171
    @Override
172
    public Phase getPhase() {
173
        return Phase.POST_HAND;
174
    }
175
176
    @Override
177
    public boolean render(PostProcessExecutionContext execution) {
178
        if (execution == null) return false;
179
        GpuTextureView src = execution.source();
180
        GpuTextureView dst = execution.destination();
181
        if (!isEnabled() || mc.player == null || mc.level == null) return false;
182
        if (src == null || dst == null) return false;
183
184
        float env = getEnvelope();
185
        if (env <= 0.001f) return false;
186
187
        float heat = intensity.get() * env;
188
        float dist = distortion.get() * env;
189
        float vig = vignette.get() * env;
190
        if (heat <= 0.001f && dist <= 0.001f && vig <= 0.001f) return false;
191
192
        float radius = Mth.clamp(vignetteRadius.get(), 0.05f, 0.95f);
193
        float softness = Mth.clamp(vignetteSoftness.get(), 0.01f, 1.0f);
194
195
        float time = (System.currentTimeMillis() % 100000L) / 1000.0f;
196
        float pulse = 1.0f + (Mth.sin(time * pulseSpeed.get() * 6.2831855f) * pulseAmount.get());
197
        pulse = Mth.clamp(pulse, 0.0f, 2.0f);
198
        vig *= pulse;
199
        HeatUniforms.update(
200
                heat,
201
                dist,
202
                scale.get(),
203
                speed.get(),
204
                vig,
205
                radius,
206
                softness,
207
                time
208
        );
209
210
        FullScreenRenderer.ensureInit();
211
        FullScreenRenderer.begin("Combatant Fullscreen Pass")
212
                .attachment(dst)
213
                .pipeline(CombatantRenderPipelines.HEAT_FX)
214
                .uniform("Heat", HeatUniforms.get())
215
                .sampler("u_Texture", src, PostProcessManager.getSampler())
216
                .end();
217
218
        return true;
219
    }
220
221
    private record WorldBurst(Vec3 center, long startedMs) { }
222
223
    private float getEnvelope() {
224
        if (startMs < 0L) return 0.0f;
225
        float t = (System.currentTimeMillis() - startMs) / 1000.0f;
226
        float in = Math.max(0.01f, fadeIn.get());
227
        float mid = Math.max(0.0f, hold.get());
228
        float out = Math.max(0.01f, fadeOut.get());
229
        float total = in + mid + out;
230
        if (t >= total) {
231
            startMs = -1L;
232
            return 0.0f;
233
        }
234
235
        float env;
236
        if (t < in) {
237
            env = t / in;
238
        } else if (t < in + mid) {
239
            env = 1.0f;
240
        } else {
241
            float u = (t - in - mid) / out;
242
            env = 1.0f - u;
243
        }
244
245
        env = Mth.clamp(env, 0.0f, 1.0f);
246
        return env * env * (3.0f - 2.0f * env);
247
    }
248
}
249