Vomit module

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

1 implementationFUN

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)FUNsrc/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/fun/ModuleVomit.ktKotlin · 95 lines · 4.2 KB

Vomit items out of your inventory.

ModuleVomit.ktKotlin · Minecraft 26.2 · 95 lines · 4.2 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.`fun`
20
21
import net.ccbluex.liquidbounce.event.events.ScheduleInventoryActionEvent
22
import net.ccbluex.liquidbounce.event.handler
23
import net.ccbluex.liquidbounce.features.module.ClientModule
24
import net.ccbluex.liquidbounce.features.module.ModuleCategories
25
import net.ccbluex.liquidbounce.utils.inventory.InventoryAction
26
import net.ccbluex.liquidbounce.utils.inventory.PlayerInventoryConstraints
27
import net.ccbluex.liquidbounce.utils.inventory.findEmptyStorageSlotsInInventory
28
import net.ccbluex.liquidbounce.utils.inventory.findItemsInContainer
29
import net.ccbluex.liquidbounce.utils.inventory.findNonEmptyStorageSlotsInInventory
30
import net.minecraft.client.gui.screens.inventory.ContainerScreen
31
import net.minecraft.core.registries.BuiltInRegistries
32
import net.minecraft.util.RandomSource
33
import net.minecraft.world.item.ItemStack
34
35
/**
36
 * Vomit module
37
 *
38
 * Drops items from the inventory in a random order to make it look like the player is vomiting.
39
 * If the player is in creative mode, the player will drop random block items.
40
 */
41
object ModuleVomit : ClientModule("Vomit", ModuleCategories.FUN) {
42
43
    private val inventoryConstraints = tree(PlayerInventoryConstraints())
44
    private val random = RandomSource.create()
45
46
    @Suppress("unused")
47
    private val vomitHandler = handler<ScheduleInventoryActionEvent> { event ->
48
        if (player.isCreative) {
49
            val blockItem = BuiltInRegistries.BLOCK.getRandom(random).get().value()
50
            val randomStack = ItemStack(blockItem, 64)
51
            val emptySlots = findEmptyStorageSlotsInInventory()
52
53
            if (emptySlots.isEmpty()) {
54
                // Throw only - this will rate limit after a few stacks
55
                event.schedule(inventoryConstraints, InventoryAction.Creative.performThrow(randomStack))
56
                return@handler
57
            }
58
59
            // Fill and throw - this bypasses the creative drop limit
60
            event.schedule(inventoryConstraints, if (inventoryConstraints.clickDelay.last <= 0) {
61
                // Depending on how many empty slots we have, this might kick in the packet rate limit
62
                // of ViaVersion or Minecraft/Paper itself
63
                emptySlots.map { slot -> InventoryAction.Creative.performFillSlot(randomStack, slot) } +
64
                    emptySlots.map { slot -> InventoryAction.Click.performThrow(null, slot) }
65
            } else {
66
                val slot = emptySlots.random()
67
68
                listOf(
69
                    InventoryAction.Creative.performFillSlot(randomStack, slot),
70
                    InventoryAction.Click.performThrow(null, slot)
71
                )
72
            })
73
        } else {
74
            // We specifically only want to choose slots that we can store items in, as
75
            // e.g. the offhand slot is not a storage slot on 1.8 servers and therefore can cause issues
76
            val playerSlot = findNonEmptyStorageSlotsInInventory()
77
            val container = mc.gui.screen() as? ContainerScreen
78
79
            val randomSlot = if (playerSlot.isEmpty()) {
80
                // Attempt to drop from the container
81
                val slots = (container ?: return@handler).findItemsInContainer()
82
                if (slots.isEmpty()) return@handler
83
84
                slots.random()
85
            } else {
86
                playerSlot.random()
87
            }
88
89
            event.schedule(inventoryConstraints, InventoryAction.Click.performThrow(container, randomSlot))
90
        }
91
    }
92
93
94
}
95