ChestCleaner module

ChestCleaner: 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/ModuleChestCleaner.ktKotlin · 73 lines · 3.2 KB

Automatically drops unwanted items from a chest.

SettingsFilterItemsAutoClose
ModuleChestCleaner.ktKotlin · Minecraft 26.2 · 73 lines · 3.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
20
package net.ccbluex.liquidbounce.features.module.modules.player
21
22
import net.ccbluex.liquidbounce.event.events.ScheduleInventoryActionEvent
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.ccbluex.liquidbounce.utils.collection.Filter
27
import net.ccbluex.liquidbounce.utils.collection.itemSortedSetOf
28
import net.ccbluex.liquidbounce.utils.inventory.CheckScreenHandlerTypeValueGroup
29
import net.ccbluex.liquidbounce.utils.inventory.CheckScreenTitleValueGroup
30
import net.ccbluex.liquidbounce.utils.inventory.InventoryAction
31
import net.ccbluex.liquidbounce.utils.inventory.PlayerInventoryConstraints
32
import net.ccbluex.liquidbounce.utils.inventory.findItemsInContainer
33
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen
34
import net.minecraft.client.gui.screens.inventory.InventoryScreen
35
36
/**
37
 * ChestCleaner module
38
 *
39
 * Automatically drops unwanted items from a chest.
40
 *
41
 */
42
object ModuleChestCleaner : ClientModule(
43
    "ChestCleaner", ModuleCategories.PLAYER,
44
    aliases = listOf("ContainerCleaner")
45
) {
46
    private val filter by enumChoice("Filter", Filter.WHITELIST)
47
    private val itemsList by items("Items", itemSortedSetOf())
48
    private val autoClose by boolean("AutoClose", true)
49
50
    private val inventoryConstraints = tree(PlayerInventoryConstraints())
51
    private val checkScreenHandlerType = tree(CheckScreenHandlerTypeValueGroup(this))
52
    private val checkScreenTitle = tree(CheckScreenTitleValueGroup(this))
53
54
    @Suppress("unused")
55
    private val scheduleInventoryAction = handler<ScheduleInventoryActionEvent> { event ->
56
        val screen = mc.gui.screen() as? AbstractContainerScreen<*> ?: return@handler
57
        if (screen is InventoryScreen) return@handler
58
        if (!checkScreenHandlerType.isValid(screen) || !checkScreenTitle.isValid(screen)) return@handler
59
60
        val slots = screen.findItemsInContainer()
61
        val selectedSlots = slots.filter { !it.itemStack.isEmpty && filter(it.itemStack.item, itemsList) }
62
63
        if (selectedSlots.isEmpty()) {
64
            if (autoClose) {
65
                event.schedule(inventoryConstraints, InventoryAction.CloseScreen(screen))
66
            }
67
        } else {
68
            val actions = selectedSlots.map { slot -> InventoryAction.Click.performThrow(screen, slot) }
69
            event.schedule(inventoryConstraints, actions)
70
        }
71
    }
72
}
73