-
-
Notifications
You must be signed in to change notification settings - Fork 685
feat(JumpEffect): add image mode #8793
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e3abf9e
feat(jump-effect): add Image mode and modularize architecture
minecrrrr 9dd0fd1
fix: invert rotation
minecrrrr 7c66805
feat(render): add drawSquareTextureGradient & extend jump effect life…
minecrrrr 77f0572
fix(JumpEffect): clear all lists on disable
minecrrrr 44bef5e
refactor(JumpEffect): address review feedback
minecrrrr 0caa06d
refactor(JumpEffect): address review feedback and fix potential bugs
minecrrrr 7f55cf9
fix(TargetRenderer): fix positioning in "ghost" mode
minecrrrr 757ad44
make old ones private
MukjepScarlet c506808
refactor(ClientRenderPipelines): revert changes in forWorldRender
minecrrrr 5e5864a
Merge branch 'CCBlueX:nextgen' into Jump-circles
minecrrrr 8e0d7dc
other changes...
MukjepScarlet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 0 additions & 92 deletions
92
src/main/kotlin/net/ccbluex/liquidbounce/features/module/modules/render/ModuleJumpEffect.kt
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
...ccbluex/liquidbounce/features/module/modules/render/jumpeffect/JumpEffectColorSettings.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| /* | ||
| * This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce) | ||
| * | ||
| * Copyright (c) 2015 - 2026 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.features.module.modules.render.jumpeffect | ||
|
|
||
| import net.ccbluex.liquidbounce.config.types.group.ValueGroup | ||
| import net.ccbluex.liquidbounce.render.engine.type.Color4b | ||
|
|
||
| class JumpEffectColorSettings : ValueGroup("Colors") { | ||
|
|
||
| val innerColor by color("InnerColor", Color4b.LIQUID_BOUNCE.alpha(50)) | ||
| val outerColor by color("OuterColor", Color4b.LIQUID_BOUNCE.alpha(150)) | ||
|
|
||
| } |
86 changes: 86 additions & 0 deletions
86
...tlin/net/ccbluex/liquidbounce/features/module/modules/render/jumpeffect/JumpEffectMode.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| /* | ||
| * This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce) | ||
| * | ||
| * Copyright (c) 2015 - 2026 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.features.module.modules.render.jumpeffect | ||
|
|
||
| import net.ccbluex.liquidbounce.config.types.group.Mode | ||
| import net.ccbluex.liquidbounce.config.types.group.ModeValueGroup | ||
| import net.ccbluex.liquidbounce.event.events.WorldRenderEvent | ||
| import net.ccbluex.liquidbounce.event.handler | ||
| import net.ccbluex.liquidbounce.features.module.modules.render.jumpeffect.ModuleJumpEffect.circles | ||
| import net.ccbluex.liquidbounce.features.module.modules.render.jumpeffect.ModuleJumpEffect.modes | ||
| import net.ccbluex.liquidbounce.render.WorldRenderEnvironment | ||
| import net.ccbluex.liquidbounce.render.engine.type.Color4b | ||
| import net.ccbluex.liquidbounce.render.renderEnvironment | ||
| import net.ccbluex.liquidbounce.render.utils.shiftHue | ||
| import net.ccbluex.liquidbounce.render.withPositionRelativeToCamera | ||
| import net.ccbluex.liquidbounce.render.withPush | ||
| import net.ccbluex.liquidbounce.utils.math.Easing | ||
|
|
||
| abstract class JumpEffectMode(name: String) : Mode(name) { | ||
| final override val parent: ModeValueGroup<*> | ||
| get() = modes | ||
|
|
||
| protected val endRadius by floatRange("EndRadius", 0.15F..0.8F, 0F..3F) | ||
|
|
||
| protected val animCurve by easing("AnimCurve", Easing.QUAD_OUT) | ||
|
|
||
| protected val hueOffsetAnim by int("HueOffsetAnim", 63, -360..360) | ||
|
|
||
| val lifetime by intRange("Lifetime", 15..15, 1..120, "anim/life") | ||
| protected val canBeCovered by boolean("CanBeCovered", false) | ||
|
|
||
| protected abstract fun WorldRenderEnvironment.drawJumpEffect(progress: Float, age: Float) | ||
|
|
||
| @Suppress("unused") | ||
| private val renderHandler = handler<WorldRenderEvent> { event -> | ||
| event.renderEnvironment { | ||
| circles.forEach { | ||
| val age = lifetime.last - circles.timeToDie(it) + event.partialTicks | ||
|
|
||
| val progress = animCurve | ||
| .transform(age / lifetime.first) | ||
| .coerceIn(0f, 1f) | ||
|
|
||
| // small offset to exclude artifacts | ||
| withPositionRelativeToCamera(it.value.add(0.0, 0.01, 0.0)) { | ||
| poseStack.withPush { | ||
| drawJumpEffect(progress, age) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| fun animateColor(baseColor: Color4b, age: Float): Color4b { | ||
| val fadeProgress = when { | ||
| lifetime.last > lifetime.first -> | ||
| ((age - lifetime.first) / (lifetime.last - lifetime.first).toFloat()).coerceIn(0f, 1f) | ||
| else -> (age / lifetime.last.toFloat()).coerceIn(0f, 1f) | ||
| } | ||
|
|
||
| val color = baseColor.fade(1.0f - fadeProgress) | ||
|
|
||
| if (hueOffsetAnim == 0) return color | ||
|
|
||
| val lifeProgress = (age / lifetime.last.toFloat()).coerceIn(0f, 1f) | ||
| return shiftHue(color, (hueOffsetAnim * lifeProgress).toInt()) | ||
| } | ||
|
|
||
| } |
56 changes: 56 additions & 0 deletions
56
...in/net/ccbluex/liquidbounce/features/module/modules/render/jumpeffect/ModuleJumpEffect.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| /* | ||
| * This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce) | ||
| * | ||
| * Copyright (c) 2015 - 2026 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.features.module.modules.render.jumpeffect | ||
|
|
||
| import net.ccbluex.liquidbounce.event.events.PlayerJumpEvent | ||
| import net.ccbluex.liquidbounce.event.handler | ||
| import net.ccbluex.liquidbounce.features.module.ClientModule | ||
| import net.ccbluex.liquidbounce.features.module.ModuleCategories | ||
| import net.ccbluex.liquidbounce.features.module.modules.render.jumpeffect.modes.JumpEffectImage | ||
| import net.ccbluex.liquidbounce.features.module.modules.render.jumpeffect.modes.JumpEffectSimple | ||
| import net.ccbluex.liquidbounce.utils.collection.ExpiringList.Companion.ExpiringList | ||
| import net.minecraft.world.phys.Vec3 | ||
|
|
||
| object ModuleJumpEffect : ClientModule("JumpEffect", ModuleCategories.RENDER) { | ||
|
|
||
| val circles = ExpiringList<Vec3>() | ||
|
|
||
| val modes = choices("Mode", 0) { | ||
| arrayOf( | ||
| JumpEffectSimple, | ||
| JumpEffectImage | ||
| ) | ||
| }.apply { | ||
| tagBy(this) | ||
| onChanged { | ||
| circles.clear() | ||
| } | ||
| } | ||
|
|
||
| @Suppress("unused") | ||
| val playerJumpHandler = handler<PlayerJumpEvent> { _ -> | ||
| // Adds new circle when the player jumps | ||
| circles.add(player.position(), modes.activeMode.lifetime.last) | ||
| } | ||
|
|
||
| override fun onDisabled() { | ||
| circles.clear() | ||
| } | ||
|
|
||
| } |
79 changes: 79 additions & 0 deletions
79
...t/ccbluex/liquidbounce/features/module/modules/render/jumpeffect/modes/JumpEffectImage.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| /* | ||
| * This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce) | ||
| * | ||
| * Copyright (c) 2015 - 2026 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.features.module.modules.render.jumpeffect.modes | ||
|
|
||
| import com.mojang.math.Axis | ||
| import net.ccbluex.fastutil.enumSetAllOf | ||
| import net.ccbluex.liquidbounce.LiquidBounce | ||
| import net.ccbluex.liquidbounce.LiquidBounce.CLIENT_NAME | ||
| import net.ccbluex.liquidbounce.config.utils.TextureMode | ||
| import net.ccbluex.liquidbounce.features.module.modules.render.jumpeffect.JumpEffectColorSettings | ||
| import net.ccbluex.liquidbounce.features.module.modules.render.jumpeffect.JumpEffectMode | ||
| import net.ccbluex.liquidbounce.render.AnchorPoint | ||
| import net.ccbluex.liquidbounce.render.WorldRenderEnvironment | ||
| import net.ccbluex.liquidbounce.render.drawSquareTextureGradient | ||
| import net.ccbluex.liquidbounce.render.withPush | ||
| import net.ccbluex.liquidbounce.utils.render.asTexture | ||
| import net.ccbluex.liquidbounce.utils.render.readNativeImage | ||
|
|
||
| internal object JumpEffectImage : JumpEffectMode("Image") { | ||
|
|
||
| private val colors = JumpEffectColorSettings() | ||
| private val rotationSpeed by int("RotationSpeed", 10, -360..360) | ||
|
|
||
| private val textureMode = modes("Source", 0) { | ||
| arrayOf( | ||
| TextureMode.Builtin(it, PresetTexture.LIQUIDBOUNCE, enumSetAllOf<PresetTexture>()), | ||
| TextureMode.Custom(it), | ||
| ) | ||
| } | ||
|
|
||
| init { | ||
| tree(colors) | ||
| } | ||
|
|
||
| override fun WorldRenderEnvironment.drawJumpEffect(progress: Float, age: Float) { | ||
| val texture = textureMode.activeMode.texture ?: return | ||
| poseStack.withPush { | ||
| val currentRotation = rotationSpeed * age | ||
|
|
||
| mulPose(Axis.XP.rotationDegrees(90f)) | ||
| mulPose(Axis.ZP.rotationDegrees(currentRotation)) | ||
| drawSquareTextureGradient( | ||
| sampler0 = texture, | ||
| outerRadius = endRadius.endInclusive * progress, | ||
| innerRadius = endRadius.start * progress, | ||
| animateColor(colors.outerColor, age), | ||
| animateColor(colors.innerColor, age), | ||
| anchor = AnchorPoint.CENTER, | ||
| startOffset = 0.8f, | ||
| noDepthTest = !canBeCovered | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| private enum class PresetTexture(override val tag: String, val path: String) : TextureMode.Builtin.Preset { | ||
| LIQUIDBOUNCE(CLIENT_NAME, "jump_effect/liquidbounce.png"), | ||
| LIQUIDBOUNCE_LOGO(CLIENT_NAME + "WithLogo", "jump_effect/liquidbounce_with_logo.png"); | ||
|
|
||
| override val texture = LiquidBounce.resource(this.path) | ||
| .readNativeImage().asTexture { "JumpEffect Image $tag" } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.