PotionSpoof module

PotionSpoof: Minecraft 26.3 cheat module, full source for every implementation (1 client: LiquidBounce (Kotlin)).

1 implementationPLAYER

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.

LiquidBounce (Kotlin)PLAYERsrc/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/player/ModulePotionSpoof.ktKotlin · 93 lines · 3.5 KB

Allows the player to have potion effects without actually having the potion.

ModulePotionSpoof.ktKotlin · Minecraft 26.2 · 93 lines · 3.5 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
3
 *
4
 * Copyright (c) 2015 - 2026 CCBlueX
5
 *
6
 * LiquidBounce is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * LiquidBounce is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
18
 */
19
package net.ccbluex.liquidbounce.features.module.modules.player
20
21
import net.ccbluex.liquidbounce.config.types.group.ToggleableValueGroup
22
import net.ccbluex.liquidbounce.event.events.PlayerTickEvent
23
import net.ccbluex.liquidbounce.event.handler
24
import net.ccbluex.liquidbounce.features.module.ClientModule
25
import net.ccbluex.liquidbounce.features.module.ModuleCategories
26
import net.minecraft.core.Holder
27
import net.minecraft.core.registries.BuiltInRegistries
28
import net.minecraft.locale.Language
29
import net.minecraft.world.effect.MobEffect
30
import net.minecraft.world.effect.MobEffectInstance
31
32
/**
33
 * PotionSpoof
34
 *
35
 * Allows the player to have potion effects without actually having the potion.
36
 */
37
object ModulePotionSpoof : ClientModule("PotionSpoof", ModuleCategories.PLAYER) {
38
39
    private class StatusEffectValueGroup(
40
        val registryEntry: Holder<MobEffect>,
41
        specifiedLanguage: Map<String, String>,
42
    ) : ToggleableValueGroup(
43
        parent = this,
44
        // Value name (en_us)
45
        name = specifiedLanguage.getOrDefault(registryEntry.value().descriptionId, "Unknown"),
46
        enabled = false,
47
    ) {
48
        private val level = int("Level", 1, 1..10).onChanged {
49
            instance = MobEffectInstance(registryEntry, 0, it - 1)
50
        }
51
52
        var instance: MobEffectInstance = MobEffectInstance(registryEntry, 0, level.get() - 1)
53
            private set
54
    }
55
56
    private val statusEffectValues = run {
57
        /** @see Language.loadDefault */
58
        val language = Language::class.java.getResourceAsStream("/assets/minecraft/lang/en_us.json").let { stream ->
59
            val map = HashMap<String, String>(8192)
60
            Language.loadFromJson(stream, map::put)
61
            map
62
        }
63
64
        BuiltInRegistries.MOB_EFFECT.listElements().map {
65
            tree(StatusEffectValueGroup(it, specifiedLanguage = language))
66
        }.toList()
67
    }
68
69
    override fun onDisabled() {
70
        for (spoofedEffect in statusEffectValues) {
71
            if (spoofedEffect.enabled && player.getEffect(spoofedEffect.registryEntry)?.duration == 0) {
72
                player.removeEffect(spoofedEffect.registryEntry)
73
            }
74
        }
75
    }
76
77
    @Suppress("unused")
78
    private val tickHandler = handler<PlayerTickEvent> {
79
        for (effect in statusEffectValues) {
80
            if (effect.enabled) {
81
                player.addEffect(effect.instance)
82
                effect.instance.effect.value().addAttributeModifiers(
83
                    player.attributes,
84
                    effect.instance.amplifier
85
                )
86
            } else if (player.getEffect(effect.registryEntry)?.duration == 0) {
87
                player.removeEffect(effect.registryEntry)
88
                effect.instance.effect.value().removeAttributeModifiers(player.attributes)
89
            }
90
        }
91
    }
92
}
93