Skip to content

Commit

Permalink
Popup line fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
toxicity188 committed Nov 12, 2024
1 parent d016196 commit 12ef101
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import net.minecraft.resources.ResourceLocation
import net.minecraft.server.MinecraftServer
import net.minecraft.server.level.ServerLevel
import net.minecraft.server.level.ServerPlayer
import net.minecraft.world.level.storage.ServerLevelData
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import java.io.File
Expand Down Expand Up @@ -260,7 +259,7 @@ class FabricBootstrapImpl : FabricBootstrap, DedicatedServerModInitializer {
}

fun wrap(world: ServerLevel): WorldWrapper {
val levelName = (world.levelData as ServerLevelData).levelName
val levelName = world.dimension().location().path
return WorldWrapper(
levelName,
createUUID(levelName)
Expand Down
4 changes: 2 additions & 2 deletions dist/src/main/kotlin/kr/toxicity/hud/popup/PopupLayout.kt
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ class PopupLayout(
pixel.opacity,
textLayout.property
)
val group = ShaderGroup(textShader, textLayout.text.name, textLayout.scale, pixel.y)
val imageCodepointMap = textLayout.text.imageCharWidth.map {
it.value.name to it.key
}.toMap()
val index = ++textIndex
val keys = (0..<textLayout.line).map { lineIndex ->
val group = ShaderGroup(textShader, textLayout.text.name, textLayout.scale, pixel.y + lineIndex * textLayout.lineWidth)
TextManagerImpl.getKey(group) ?: run {
val array = textLayout.startJson()
HudImpl.createBit(textShader, pixel.y + lineIndex * textLayout.lineWidth) { y ->
Expand All @@ -213,7 +213,7 @@ class PopupLayout(
}
}
val imageMap = HashMap<String, WidthComponent>()
val textEncoded = "popup_${parent.name}_text_${index}".encodeKey()
val textEncoded = "popup_${parent.name}_text_${index}_${lineIndex + 1}".encodeKey()
val key = createAdventureKey(textEncoded)
var imageTextIndex = TEXT_IMAGE_START_CODEPOINT + textLayout.text.imageCharWidth.size
textLayout.text.imageCharWidth.forEach {
Expand Down

0 comments on commit 12ef101

Please sign in to comment.