-
-
Notifications
You must be signed in to change notification settings - Fork 448
/
LiquidBounce.kt
136 lines (114 loc) · 4.12 KB
/
LiquidBounce.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2016 - 2021 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce
import net.ccbluex.liquidbounce.config.ConfigSystem
import net.ccbluex.liquidbounce.event.*
import net.ccbluex.liquidbounce.features.chat.Chat
import net.ccbluex.liquidbounce.features.command.CommandManager
import net.ccbluex.liquidbounce.features.misc.FriendManager
import net.ccbluex.liquidbounce.features.misc.ProxyManager
import net.ccbluex.liquidbounce.features.module.ModuleManager
import net.ccbluex.liquidbounce.features.tabs.Tabs
import net.ccbluex.liquidbounce.render.engine.RenderEngine
import net.ccbluex.liquidbounce.render.ultralight.UltralightEngine
import net.ccbluex.liquidbounce.render.ultralight.theme.ThemeManager
import net.ccbluex.liquidbounce.script.ScriptManager
import net.ccbluex.liquidbounce.utils.aiming.RotationManager
import net.ccbluex.liquidbounce.utils.block.ChunkScanner
import net.ccbluex.liquidbounce.utils.combat.globalEnemyConfigurable
import net.ccbluex.liquidbounce.utils.mappings.McMappings
import org.apache.logging.log4j.LogManager
import kotlin.system.exitProcess
/**
* LiquidBounce
*
* A free mixin-based injection hacked-client for Minecraft using FabricMC.
*
* @author kawaiinekololis (@team CCBlueX)
*/
object LiquidBounce : Listenable {
/**
* CLIENT INFORMATION
*
* WARNING: Please read the GNU General Public License
*/
const val CLIENT_NAME = "LiquidBounce"
const val CLIENT_VERSION = "1.0.0"
const val CLIENT_AUTHOR = "CCBlueX"
const val CLIENT_CLOUD = "https://cloud.liquidbounce.net/LiquidBounce"
/**
* Client logger to print out console messages
*/
val logger = LogManager.getLogger(CLIENT_NAME)!!
/**
* Should be executed to start the client.
*/
val startHandler = handler<ClientStartEvent> {
runCatching {
logger.info("Launching $CLIENT_NAME v$CLIENT_VERSION by $CLIENT_AUTHOR")
logger.debug("Loading from cloud: '$CLIENT_CLOUD'")
// Load mappings
McMappings.load()
// Initialize client features
EventManager
// Config
ConfigSystem
globalEnemyConfigurable
RotationManager
ChunkScanner
// Features
ModuleManager
CommandManager
ThemeManager
ScriptManager
RotationManager
FriendManager
ProxyManager
Tabs
Chat
// Initialize the render engine
RenderEngine.init()
// Load up web platform
UltralightEngine.init()
// Register commands and modules
CommandManager.registerInbuilt()
ModuleManager.registerInbuilt()
// Load user scripts
ScriptManager.loadScripts()
// Load config system from disk
ConfigSystem.load()
// Connect to chat server
Chat.connect()
}.onSuccess {
logger.info("Successfully loaded client!")
}.onFailure {
logger.error("Unable to load client.", it)
exitProcess(1)
}
}
/**
* Should be executed to stop the client.
*/
val shutdownHandler = handler<ClientShutdownEvent> {
logger.info("Shutting down client...")
ConfigSystem.store()
UltralightEngine.shutdown()
ChunkScanner.ChunkScannerThread.stopThread()
}
}