mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-19 12:25:12 -04:00
text rendering: fix max size[y] checking, chat: force 3 lines of text
This commit is contained in:
parent
af49b9b2cb
commit
4dfcfc1b61
@ -61,7 +61,7 @@ object TextComponentRenderer : ChatComponentRenderer<TextComponent> {
|
||||
fun addY(height: Int): Boolean {
|
||||
val nextY = offset.y + height
|
||||
val nextSizeY = nextY - initialOffset.y + renderInfo.charHeight // add initial height for chars + end margin
|
||||
if (nextSizeY >= elementMaxSize.y) {
|
||||
if (nextSizeY > elementMaxSize.y) {
|
||||
return true
|
||||
}
|
||||
offset.y = nextY
|
||||
|
@ -113,8 +113,8 @@ open class TextElement(
|
||||
|
||||
init {
|
||||
this.parent = parent
|
||||
this.chatComponent = ChatComponent.of(text)
|
||||
this.noBorder = noBorder
|
||||
this.chatComponent = ChatComponent.of(text)
|
||||
}
|
||||
|
||||
override fun forceSilentApply() {
|
||||
|
@ -19,6 +19,7 @@ import de.bixilon.minosoft.config.key.KeyCodes
|
||||
import de.bixilon.minosoft.config.profile.delegate.watcher.SimpleProfileDelegateWatcher.Companion.profileWatchRendering
|
||||
import de.bixilon.minosoft.data.ChatTextPositions
|
||||
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||
import de.bixilon.minosoft.gui.rendering.font.Font
|
||||
import de.bixilon.minosoft.gui.rendering.gui.GUIRenderer
|
||||
import de.bixilon.minosoft.gui.rendering.gui.elements.Element
|
||||
import de.bixilon.minosoft.gui.rendering.gui.elements.LayoutedElement
|
||||
@ -83,8 +84,7 @@ class ChatElement(guiRenderer: GUIRenderer) : Element(guiRenderer), LayoutedElem
|
||||
messages += it.message
|
||||
})
|
||||
|
||||
renderWindow.inputHandler.registerKeyCallback("minosoft:open_chat".toResourceLocation(),
|
||||
KeyBinding(
|
||||
renderWindow.inputHandler.registerKeyCallback("minosoft:open_chat".toResourceLocation(), KeyBinding(
|
||||
mapOf(
|
||||
KeyAction.PRESS to setOf(KeyCodes.KEY_T),
|
||||
),
|
||||
@ -150,7 +150,7 @@ class ChatElement(guiRenderer: GUIRenderer) : Element(guiRenderer), LayoutedElem
|
||||
|
||||
companion object : HUDBuilder<LayoutedGUIElement<ChatElement>>, GUIBuilder<LayoutedGUIElement<ChatElement>> {
|
||||
override val RESOURCE_LOCATION: ResourceLocation = "minosoft:chat_hud".toResourceLocation()
|
||||
private const val CHAT_INPUT_HEIGHT = 30
|
||||
private const val CHAT_INPUT_HEIGHT = Font.TOTAL_CHAR_HEIGHT * 3 + Font.CHAR_MARGIN * 2
|
||||
private const val CHAT_INPUT_MARGIN = 2
|
||||
|
||||
override fun build(guiRenderer: GUIRenderer): LayoutedGUIElement<ChatElement> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user