Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: HUD Editor, Native Theme and Mixing Components and Wallpapers #3884

Draft
wants to merge 63 commits into
base: nextgen
Choose a base branch
from

Conversation

1zun4
Copy link
Member

@1zun4 1zun4 commented Sep 6, 2024

Theme Sytem

Drawing Support

  • Web Drawer
  • Native Drawer
  • Drawer Reference System
  • Fonts Through Themes System

Component Overlay

  • Component Standards
  • Component Factory
  • Editor Boundaries Support
  • Creation and Deletion of Components via Rest API
  • Serializing and Deserializing Components from Disk

Editor (Assign @SenkJu)

  • Dragging Components
  • Managment Panel
  • Component Editor (Settings)
  • Snapping

Wallpaper

  • Drawing (supports .png, .frag)
  • Selection via Rest API

LiquidBounce Theme

  • Font Selector
  • Wallpaper Selector

Generic Theme (Native)

  • Native Theme System
  • Standarised Design
  • Title Screen
  • Alt Manager
  • Proxy Manager
  • Click GUI

@1zun4 1zun4 added this to the 0.14.0 milestone Sep 6, 2024
@larryngton2
Copy link
Contributor

get detekted

@superblaubeere27
Copy link
Contributor

get detekted

If detekt complaints, the code probably sucks ;)

@larryngton2
Copy link
Contributor

get detekted

If detekt complaints, the code probably sucks ;)

🔥

@liquidsquid1
Copy link
Contributor

get detekted

If detekt complaints, the code probably sucks ;)

detekt will complain at any code, no matter who writes it. one time detekt just shouted at me because i didn't make 17 new lines for this one really easy to use function.

@larryngton2
Copy link
Contributor

get detekted

If detekt complaints, the code probably sucks ;)

detekt will complain at any code, no matter who writes it. one time detekt just shouted at me because i didn't make 17 new lines for this one really easy to use function.

stop dickriding izuna

@1zun4
Copy link
Member Author

1zun4 commented Sep 7, 2024

get detekted

If detekt complaints, the code probably sucks ;)

detekt will complain at any code, no matter who writes it. one time detekt just shouted at me because i didn't make 17 new lines for this one really easy to use function.

stop dickriding izuna

"Draft", yk that?

@superblaubeere27
Copy link
Contributor

superblaubeere27 commented Sep 7, 2024

@liquidsquid1

detekt will complain at any code, no matter who writes it. one time detekt just shouted at me because i didn't make 17 new lines for this one really easy to use function.

Detekt will give you warnings about symptoms of bad code style (= code smells). 99% of the complaints are legit - even though we only care about 95% because the rest is just too minor. I added it to prevent people from writing code like this which might work great but is a pain to understand and debug. I know it is annoying, but it works The number of if statements with 6 conditions, lines longer than the line limit, 4x nested loops and functions longer than two screens went down drastically.

@1zun4 1zun4 modified the milestones: 0.14.0, 0.15.0 Sep 7, 2024
@larryngton2
Copy link
Contributor

get detekted

If detekt complaints, the code probably sucks ;)

detekt will complain at any code, no matter who writes it. one time detekt just shouted at me because i didn't make 17 new lines for this one really easy to use function.

stop dickriding izuna

"Draft", yk that?

I know it's a draft, but he should stop dickriding in general

@1zun4 1zun4 changed the title feat: support native theme + custom components feat: Custom HUD, Native Theme Support and Mixing Components and Wallpapers Sep 10, 2024
@1zun4
Copy link
Member Author

1zun4 commented Sep 10, 2024

image

3 Themes at once and CustomHUD demo (with fixed boundaries)

@larryngton2
Copy link
Contributor

image

3 Themes at once and CustomHUD demo (with fixed boundaries)

looks both nice and goofy

@1zun4 1zun4 modified the milestones: 0.15.0, 0.16.0 Sep 29, 2024
1zun4 added a commit that referenced this pull request Oct 5, 2024
1zun4 added a commit that referenced this pull request Oct 5, 2024
@1zun4 1zun4 mentioned this pull request Oct 8, 2024
@1zun4 1zun4 modified the milestones: 0.16.0, 0.17.0 Oct 14, 2024
@1zun4 1zun4 closed this Oct 25, 2024
@1zun4 1zun4 force-pushed the feat/theme-system branch from 2e58af1 to 35824fa Compare October 25, 2024 21:54
### Drawing Support
- Added Web Drawer
- Added Native Drawer
- Implemented Drawer Reference System

### Component Overlay
- Established Component Standards
- Built Component Factory
- Added Editor Boundaries Support
- Enabled Creation and Deletion of Components via REST API

### Editor
- Enabled Dragging of Components

### Wallpaper
- Added File Support (.png, .frag formats)
- Enabled Wallpaper Selection via REST API

### Generic Theme (Native)
- Implemented Native Theme System
@1zun4 1zun4 reopened this Oct 25, 2024
@1zun4 1zun4 changed the title feat: Custom HUD, Native Theme Support and Mixing Components and Wallpapers feat: HUD Editor, Native Theme and Mixing Components and Wallpapers Oct 25, 2024
1zun4 added 2 commits October 26, 2024 20:48
# Conflicts:
#	src-theme/src/routes/hud/Hud.svelte
#	src/main/java/net/ccbluex/liquidbounce/injection/mixins/minecraft/client/MixinMinecraftClient.java
#	src/main/kotlin/net/ccbluex/liquidbounce/integration/interop/protocol/rest/v1/InteropFunctionRegistry.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/integration/theme/ComponentSerializer.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/integration/theme/component/types/TextComponent.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/integration/theme/type/native/components/minimap/MinimapTextureAtlasManager.kt
@1zun4 1zun4 modified the milestones: 0.18.0, 0.19.0, 0.20.0 Nov 16, 2024
# Conflicts:
#	config/detekt/baseline.xml
#	src-theme/src/routes/clickgui/ClickGui.svelte
#	src/main/kotlin/net/ccbluex/liquidbounce/LiquidBounce.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/api/IpInfoApi.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/config/types/ChoiceConfigurable.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/config/types/Configurable.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/config/types/Value.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/event/events/ClientEvents.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/features/command/commands/client/CommandLocalConfig.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/features/misc/HideAppearance.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/crystalaura/ModuleCrystalAura.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/combat/crystalaura/SubmoduleCrystalPlacer.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/movement/speed/modes/intave/SpeedIntave14.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/render/ModuleClickGui.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/render/ModuleHoleESP.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/render/ModuleHud.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/world/scaffold/ModuleScaffold.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/integration/browser/supports/JcefBrowser.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/integration/interop/protocol/rest/v1/client/ProxyFunctions.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/integration/interop/protocol/rest/v1/client/SessionFunctions.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/integration/interop/protocol/rest/v1/game/PlayerFunctions.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/integration/interop/protocol/rest/v1/game/ServerListFunctions.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/integration/theme/ThemeManager.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/utils/aiming/PointTracker.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/utils/block/BlockExtensions.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/utils/block/placer/BlockPlacerRotationModes.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/utils/client/NetworkUtils.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/utils/validation/HashValidator.kt
# Conflicts:
#	src/main/kotlin/net/ccbluex/liquidbounce/config/gson/GsonInstance.kt
@1zun4 1zun4 removed this from the 0.20.0 milestone Nov 24, 2024

}

fun update(route: RouteType) {

Check warning

Code scanning / detekt

Prefer splitting up complex methods into smaller, easier to understand methods. Warning

The function update appears to be too complex based on Cognitive Complexity (complexity: 15). Defined complexity threshold for methods is set to '15'
Comment on lines +57 to +60
val availableThemes = arrayOf(
NativeTheme,
*themesFolder.listFiles()?.filter(File::isDirectory)?.map(::WebTheme)?.toTypedArray() ?: emptyArray()
)

Check warning

Code scanning / detekt

In most cases using a spread operator causes a full copy of the array to be created before calling a method. This may result in a performance penalty. Warning

In most cases using a spread operator causes a full copy of the array to be created before calling a method. This may result in a performance penalty.
Comment on lines +105 to +111
var activeComponents: MutableList<Component> = mutableListOf(
// Weather we support web themes, it might also load native theme defaults instead
*fallbackTheme.components
// Check if the component is enabled by default
.filter { factory -> factory.default }
// Create a new component instance
.map { factory -> factory.new(fallbackTheme) }.toTypedArray())

Check warning

Code scanning / detekt

In most cases using a spread operator causes a full copy of the array to be created before calling a method. This may result in a performance penalty. Warning

In most cases using a spread operator causes a full copy of the array to be created before calling a method. This may result in a performance penalty.
}

abstract fun load(): Boolean
abstract fun draw(context: DrawContext, width: Int, height: Int, mouseX: Int, mouseY: Int, delta: Float): Boolean

Check warning

Code scanning / detekt

The more parameters a function has the more complex it is. Long parameter lists are often used to control complex algorithms and violate the Single Responsibility Principle. Prefer functions with short parameter lists. Warning

The function draw(context: DrawContext, width: Int, height: Int, mouseX: Int, mouseY: Int, delta: Float) has too many parameters. The current threshold is set to 6.
}

val matStack = MatrixStack()
override fun render(context: DrawContext, delta: Float) {

Check warning

Code scanning / detekt

One method should have one responsibility. Long methods tend to handle many things at once. Prefer smaller methods to make them easier to understand. Warning

The function render is too long (75). The maximum length is 60.
import net.minecraft.client.gui.DrawContext

class EmptyDrawableRoute : NativeDrawableRoute() {
override fun render(context: DrawContext, delta: Float) {}

Check warning

Code scanning / detekt

Empty block of code detected. As they serve no purpose they should be removed. Warning

This empty block of code can be removed.
*
* @param jsonObject JsonObject
*/
private fun configureConfigurable(configurable: Configurable, jsonObject: JsonObject) {

Check warning

Code scanning / detekt

One method should have one responsibility. Long methods tend to handle many things at once. Prefer smaller methods to make them easier to understand. Warning

The function configureConfigurable is too long (66). The maximum length is 60.
// todo: might replace this with serious deserialization
when (type) {
"BOOLEAN" -> {
val default = jsonObject["default"].asBoolean

Check warning

Code scanning / detekt

Multiple occurrences of the same string literal within a single file detected. Prefer extracting the string literal into a property or constant. Warning

Multiple occurrences of the same string literal within a single file detected. Prefer extracting the string literal into a property or constant.

"INT" -> {
val default = jsonObject["default"].asInt
val min = jsonObject["range"].asJsonObject["min"].asInt

Check warning

Code scanning / detekt

Multiple occurrences of the same string literal within a single file detected. Prefer extracting the string literal into a property or constant. Warning

Multiple occurrences of the same string literal within a single file detected. Prefer extracting the string literal into a property or constant.
name.endsWith(".png")
}?.associateBy { it.nameWithoutExtension }?.mapValues { (name, file) ->
lazy {
val identifier = Identifier.of("liquidbounce", "theme-${this.name.lowercase()}-texture-${name.lowercase()}")

Check warning

Code scanning / detekt

Line detected, which is longer than the defined maximum line length in the code style. Warning

Line detected, which is longer than the defined maximum line length in the code style.
1zun4 and others added 12 commits December 30, 2024 09:48
# Conflicts:
#	src/main/java/net/ccbluex/liquidbounce/injection/mixins/minecraft/entity/MixinClientPlayerEntity.java
#	src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/render/ModuleRotations.kt
# Conflicts:
#	src/main/kotlin/net/ccbluex/liquidbounce/config/gson/serializer/ComponentSerializer.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/integration/theme/component/ComponentType.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/integration/theme/component/types/IntegratedComponent.kt
#	src/main/kotlin/net/ccbluex/liquidbounce/integration/theme/component/types/TextComponent.kt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants