Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

remove adventure work-arounds (& update version) #79

Merged
merged 5 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ flkVersion = 1.10.19+kotlin.1.9.23

# required dependency mods
required.adventure-platform-fabric.artifact = net.kyori:adventure-platform-fabric
required.adventure-platform-fabric.version = 5.11.0
required.adventure-platform-fabric.version = 5.12.0
required.adventure-platform-fabric.versionSpec = ~

required.libgui.artifact = io.github.cottonmc:LibGui
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import io.github.homchom.recode.feature.AddsFeature
import io.github.homchom.recode.feature.registerFeature
import io.github.homchom.recode.id
import io.github.homchom.recode.render.RGB
import io.github.homchom.recode.ui.text.VanillaComponent
import io.github.homchom.recode.ui.text.VanillaStyle
import io.github.homchom.recode.ui.text.toVanilla
import net.fabricmc.fabric.api.resource.ResourceManagerHelper
import net.fabricmc.fabric.api.resource.ResourcePackActivationType
import net.kyori.adventure.text.Component
import net.kyori.adventure.text.format.TextColor

@OptIn(AddsFeature::class)
object FBuiltInResourcePacks {
Expand All @@ -24,16 +25,16 @@ object FBuiltInResourcePacks {
displayColor: RGB,
activationType: ResourcePackActivationType = ResourcePackActivationType.DEFAULT_ENABLED
) {
// https://github.com/KyoriPowered/adventure-platform-fabric/issues/122
val packDescription = VanillaComponent.literal("[$MOD_ID] ")
.append(VanillaComponent.translatable("resourcePack.recode.$id")
.withStyle(VanillaStyle.EMPTY.withColor(displayColor.hex))

val packDescription = Component.text("[$MOD_ID] ")
RedVortexDev marked this conversation as resolved.
Show resolved Hide resolved
.append(Component.translatable("resourcePack.recode.$id")
.color(TextColor.color(displayColor.hex))
)

ResourceManagerHelper.registerBuiltinResourcePack(
id(id),
Recode,
packDescription,
packDescription.toVanilla(),
activationType
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,7 @@ class ExpressionHighlighter {

val text = builder.build().toFormattedCharSequence(false)
val preview = if (parseMiniMessage) {
try {
miniMessage.deserialize(string).toFormattedCharSequence()
} catch (e: Exception) {
// https://github.com/KyoriPowered/adventure/issues/1011
null
}
miniMessage.deserialize(string).toFormattedCharSequence()
} else null
return HighlightedExpression(text, preview)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.github.homchom.recode.render

import com.mojang.authlib.GameProfile
import net.kyori.adventure.identity.Identity
import net.minecraft.Util
import net.minecraft.client.Minecraft
import net.minecraft.client.player.RemotePlayer
Expand All @@ -17,7 +16,4 @@ class StaticSkinRender(client: Minecraft, private val skin: PlayerSkin) : Remote
) {
override fun getSkin() = skin
override fun isModelPartShown(part: PlayerModelPart) = true

// https://github.com/KyoriPowered/adventure-platform-fabric/issues/120
override fun identity() = gameProfile as Identity
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,7 @@ class MiniMessageHighlighter(private val standardTags: TagResolver) {
}
}

val root = try {
instance.deserializeToTree(input)
} catch (e: Exception) {
// https://github.com/KyoriPowered/adventure/issues/1011
return literalText(input, style().red()).asComponent()
}
val root = instance.deserializeToTree(input)
buildNewInput(root)
return instance.deserialize(newInput.toString())
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"pack_format": 18,
"pack_format": 22,
"description": "vanilla-style unicode symbols.\n§8BetterUnicode by Electrosolt"
}
}