From 5822703b7d770ec67a4c4ca00192006b8f0cb9b9 Mon Sep 17 00:00:00 2001 From: Wyvest <45589059+Wyvest@users.noreply.github.com> Date: Tue, 17 Jan 2023 09:44:34 -0500 Subject: smooth messages / scrolling animation speed fix sending messages (again lol) --- src/main/kotlin/cc/woverflow/chatting/Chatting.kt | 7 +++++++ .../kotlin/cc/woverflow/chatting/config/ChattingConfig.kt | 14 ++++++++++++++ .../kotlin/cc/woverflow/chatting/utils/EaseOutQuart.kt | 7 +++++++ 3 files changed, 28 insertions(+) create mode 100644 src/main/kotlin/cc/woverflow/chatting/utils/EaseOutQuart.kt (limited to 'src/main/kotlin/cc/woverflow/chatting') diff --git a/src/main/kotlin/cc/woverflow/chatting/Chatting.kt b/src/main/kotlin/cc/woverflow/chatting/Chatting.kt index 7560537..85204d8 100644 --- a/src/main/kotlin/cc/woverflow/chatting/Chatting.kt +++ b/src/main/kotlin/cc/woverflow/chatting/Chatting.kt @@ -154,6 +154,13 @@ object Chatting { } } + @SubscribeEvent + fun onRenderTickEnd(event: RenderTickEvent) { + if (event.phase == TickEvent.Phase.END) { + deltaTicks = 0f + } + } + @SubscribeEvent fun onTickEvent(event: TickEvent.ClientTickEvent) { if (event.phase == TickEvent.Phase.START && Minecraft.getMinecraft().theWorld != null && Minecraft.getMinecraft().thePlayer != null && (Minecraft.getMinecraft().currentScreen == null || Minecraft.getMinecraft().currentScreen is GuiChat)) { diff --git a/src/main/kotlin/cc/woverflow/chatting/config/ChattingConfig.kt b/src/main/kotlin/cc/woverflow/chatting/config/ChattingConfig.kt index 599f101..9fa67ed 100644 --- a/src/main/kotlin/cc/woverflow/chatting/config/ChattingConfig.kt +++ b/src/main/kotlin/cc/woverflow/chatting/config/ChattingConfig.kt @@ -60,12 +60,26 @@ object ChattingConfig : Config( ) var smoothChat = true + @Slider( + name = "Message Animation Speed", + category = "Animations", subcategory = "Messages", + min = 0.0f, max = 1.0f + ) + var messageSpeed = 0.5f + @Switch( name = "Smooth Chat Scrolling", category = "Animations", subcategory = "Scrolling" ) var smoothScrolling = true + @Slider( + name = "Scrolling Animation Speed", + category = "Animations", subcategory = "Scrolling", + min = 0.0f, max = 1.0f + ) + var scrollingSpeed = 0.15f + @Switch( name = "Remove Scroll Bar", category = "Animations", subcategory = "Scrolling" diff --git a/src/main/kotlin/cc/woverflow/chatting/utils/EaseOutQuart.kt b/src/main/kotlin/cc/woverflow/chatting/utils/EaseOutQuart.kt new file mode 100644 index 0000000..7943b4d --- /dev/null +++ b/src/main/kotlin/cc/woverflow/chatting/utils/EaseOutQuart.kt @@ -0,0 +1,7 @@ +package cc.woverflow.chatting.utils + +import cc.polyfrost.oneconfig.gui.animations.Animation + +class EaseOutQuart(duration: Float, start: Float, end: Float, reverse: Boolean) : Animation(duration, start, end, reverse) { + override fun animate(x: Float) = -1 * (x - 1) * (x - 1) * (x - 1) * (x - 1) + 1 +} \ No newline at end of file -- cgit