@@ -6,7 +6,7 @@ import com.dwarslooper.cactus.client.systems.config.settings.impl.IntegerSetting
66import com.dwarslooper.cactus.client.systems.config.settings.impl.Setting
77import com.dwarslooper.cactus.client.util.CactusConstants.mc
88import com.dwarslooper.cactus.client.util.generic.TextUtils
9- import net.minecraft.client.gui.GuiGraphics
9+ import net.minecraft.client.gui.GuiGraphicsExtractor
1010import net.minecraft.client.renderer.RenderPipelines
1111import org.endlesssource.mediainterface.api.PlaybackState
1212import org.joml.Vector2i
@@ -64,7 +64,7 @@ class TrackViewHudElement : DynamicHudElement<TrackViewHudElement>("trackView",
6464 TrackViewMediaService .start()
6565 }
6666
67- override fun render (context : GuiGraphics , x : Int , y : Int , screenWidth : Int , screenHeight : Int , delta : Float , inEditor : Boolean ) {
67+ override fun render (context : GuiGraphicsExtractor , x : Int , y : Int , screenWidth : Int , screenHeight : Int , delta : Float , inEditor : Boolean ) {
6868 val snapshot = if (inEditor) editorSnapshot else TrackViewMediaService .snapshot()
6969 if (! inEditor && hideWhenNoMedia.get() && ! snapshot.hasMedia) {
7070 return
@@ -75,7 +75,7 @@ class TrackViewHudElement : DynamicHudElement<TrackViewHudElement>("trackView",
7575 }
7676
7777 override fun renderContent (
78- context : GuiGraphics ,
78+ context : GuiGraphicsExtractor ,
7979 x : Int ,
8080 y : Int ,
8181 width : Int ,
@@ -116,16 +116,16 @@ class TrackViewHudElement : DynamicHudElement<TrackViewHudElement>("trackView",
116116 val title = TextUtils .trimToWidth(" $statePrefix $rawTitle " , textSpace, " ..." )
117117 val artist = TextUtils .trimToWidth(rawArtist, textSpace, " ..." )
118118
119- context.drawString (mc.font, title, drawX, drawY, textColorValue, textShadows())
119+ context.text (mc.font, title, drawX, drawY, textColorValue, textShadows())
120120
121121 val secondLineY = drawY + mc.font.lineHeight + lineSpacing
122- context.drawString (mc.font, artist, drawX, secondLineY, accentTitleColor, textShadows())
122+ context.text (mc.font, artist, drawX, secondLineY, accentTitleColor, textShadows())
123123
124124 if (showSourceApp.get()) {
125125 val source = snapshot.sourceApp.ifBlank { " Unknown player" }
126126 val sourceY = secondLineY + mc.font.lineHeight + if (compact) compactExtraSourceOffset else defaultSourceOffset
127127 val sourceText = TextUtils .trimToWidth(source, textSpace, " ..." )
128- context.drawString (mc.font, sourceText, drawX, sourceY, accentSourceColor, textShadows())
128+ context.text (mc.font, sourceText, drawX, sourceY, accentSourceColor, textShadows())
129129 }
130130
131131 if (showProgressBar.get() && snapshot.durationMillis != null && snapshot.durationMillis > 0L && snapshot.positionMillis != null ) {
@@ -144,8 +144,8 @@ class TrackViewHudElement : DynamicHudElement<TrackViewHudElement>("trackView",
144144 return getSize()
145145 }
146146
147- private fun drawNoMediaFallback (context : GuiGraphics , x : Int , y : Int , width : Int , height : Int , color : Int ) {
148- context.drawCenteredString (mc.font, " No active media" , x + width / 2 , y + (height - mc.font.lineHeight) / 2 + 1 , color)
147+ private fun drawNoMediaFallback (context : GuiGraphicsExtractor , x : Int , y : Int , width : Int , height : Int , color : Int ) {
148+ context.centeredText (mc.font, " No active media" , x + width / 2 , y + (height - mc.font.lineHeight) / 2 + 1 , color)
149149 }
150150
151151 private fun resolveThumbnailSize (compact : Boolean , height : Int ): Int {
@@ -158,15 +158,15 @@ class TrackViewHudElement : DynamicHudElement<TrackViewHudElement>("trackView",
158158 return base.coerceAtMost((height - padding * 2 ).coerceAtLeast(0 ))
159159 }
160160
161- private fun renderThumbnail (context : GuiGraphics , snapshot : TrackViewSnapshot , x : Int , y : Int , size : Int ) {
161+ private fun renderThumbnail (context : GuiGraphicsExtractor , snapshot : TrackViewSnapshot , x : Int , y : Int , size : Int ) {
162162 val artworkId = snapshot.artworkToken?.let (TrackViewArtworkCache ::request)
163163 if (artworkId != null ) {
164164 context.blit(RenderPipelines .GUI_TEXTURED , artworkId, x, y, 0f , 0f , size, size, size, size)
165165 return
166166 }
167167
168168 context.fill(x, y, x + size, y + size, placeholderColor)
169- context.drawCenteredString (mc.font, " ♪" , x + size / 2 , y + (size - mc.font.lineHeight) / 2 + 1 , placeholderNoteColor)
169+ context.centeredText (mc.font, " ♪" , x + size / 2 , y + (size - mc.font.lineHeight) / 2 + 1 , placeholderNoteColor)
170170 }
171171
172172 private fun statePrefix (state : PlaybackState ): String {
0 commit comments