[BUG] Fix Adventure Serializer being configured wrong
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -23,3 +23,7 @@ run
|
||||
|
||||
artifacts
|
||||
src/test/**
|
||||
|
||||
workspace
|
||||
upstream
|
||||
rejects
|
@@ -1,7 +1,9 @@
|
||||
def JDK = "21"
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
docker {
|
||||
image "registry.firstdark.dev/java21:latest"
|
||||
image "registry.firstdark.dev/java${JDK}:latest"
|
||||
alwaysPull true
|
||||
args '-v gradle-cache:/home/gradle/.gradle'
|
||||
}
|
||||
|
@@ -1,10 +1,15 @@
|
||||
def projectName = "CraterLib";
|
||||
def projectIcon = "https://cdn.modrinth.com/data/Nn8Wasaq/a172c634683a11a2e9ae593e56eba7885743bb44.png";
|
||||
def JDK = "21";
|
||||
def majorMc = "Port";
|
||||
def modLoaders = "neoforge|fabric|quilt";
|
||||
def supportedMc = "1.21";
|
||||
def reltype = "port";
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
docker {
|
||||
image "registry.firstdark.dev/java21:latest"
|
||||
image "registry.firstdark.dev/java${JDK}:latest"
|
||||
alwaysPull true
|
||||
args '-v gradle-cache:/home/gradle/.gradle'
|
||||
}
|
||||
@@ -18,7 +23,7 @@ pipeline {
|
||||
stage("Notify Discord") {
|
||||
steps {
|
||||
discordSend webhookURL: env.SSS_WEBHOOK,
|
||||
title: "Deploy Started: ${projectName} Port Deploy #${BUILD_NUMBER}",
|
||||
title: "Deploy Started: ${projectName} ${majorMc} Deploy #${BUILD_NUMBER}",
|
||||
link: env.BUILD_URL,
|
||||
result: 'SUCCESS',
|
||||
description: "Build: [${BUILD_NUMBER}](${env.BUILD_URL})"
|
||||
@@ -28,12 +33,6 @@ pipeline {
|
||||
stage("Prepare") {
|
||||
steps {
|
||||
sh "chmod +x ./gradlew"
|
||||
sh "./gradlew clean"
|
||||
}
|
||||
}
|
||||
|
||||
stage("Build") {
|
||||
steps {
|
||||
sh "./gradlew build -PreleaseType=port"
|
||||
}
|
||||
}
|
||||
@@ -41,7 +40,7 @@ pipeline {
|
||||
stage("Publish to Maven") {
|
||||
steps {
|
||||
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
|
||||
sh "./gradlew publish -PreleaseType=port"
|
||||
sh "./gradlew publish -PreleaseType=${reltype}"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,14 +49,13 @@ pipeline {
|
||||
post {
|
||||
always {
|
||||
sh "./gradlew --stop"
|
||||
archiveArtifacts artifacts: 'artifacts/*.jar'
|
||||
|
||||
fddsnapshotter apiKey: env.PLATFORM_KEY,
|
||||
projectSlug: "craterlib",
|
||||
projectName: "${projectName}",
|
||||
projectIcon: "${projectIcon}",
|
||||
modLoaders: "neoforge|fabric|quilt",
|
||||
minecraftVersions: "1.21",
|
||||
modLoaders: "${modLoaders}",
|
||||
minecraftVersions: "${supportedMc}",
|
||||
failWebhook: env.SSS_WEBHOOK,
|
||||
publishWebhooks: "${env.SSS_WEBHOOK}|${env.FDD_WH}"
|
||||
|
||||
|
@@ -5,22 +5,30 @@ import me.hypherionmc.mcdiscordformatter.discord.DiscordSerializer;
|
||||
import me.hypherionmc.mcdiscordformatter.minecraft.MinecraftSerializer;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import net.kyori.adventure.text.serializer.json.JSONOptions;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.Style;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class ChatUtils {
|
||||
|
||||
private static final GsonComponentSerializer adventureSerializer = GsonComponentSerializer.builder().options(
|
||||
JSONOptions.byDataVersion().at(SharedConstants.getCurrentVersion().getDataVersion().getVersion())
|
||||
).build();
|
||||
|
||||
public static Component adventureToMojang(net.kyori.adventure.text.Component inComponent) {
|
||||
final String serialised = GsonComponentSerializer.gson().serialize(inComponent);
|
||||
final String serialised = adventureSerializer.serialize(inComponent);
|
||||
return Component.Serializer.fromJson(serialised, RegistryAccess.EMPTY);
|
||||
}
|
||||
|
||||
public static net.kyori.adventure.text.Component mojangToAdventure(Component inComponent) {
|
||||
final String serialised = Component.Serializer.toJson(inComponent, RegistryAccess.EMPTY);
|
||||
return GsonComponentSerializer.gson().deserialize(serialised);
|
||||
return adventureSerializer.deserialize(serialised);
|
||||
}
|
||||
|
||||
// Some text components contain duplicate text, resulting in duplicate messages
|
||||
@@ -87,4 +95,5 @@ public class ChatUtils {
|
||||
|
||||
return mojangToAdventure(Component.translatable(Util.makeDescriptionId("biome", identifier.toMojang())));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -15,7 +15,8 @@ A Library mod and modding api for easier multi-version minecraft and mod loader
|
||||
| < 1.18.2 | ❌ |
|
||||
| 1.18.2-1.20.2 | ✳️ |
|
||||
| 1.20.4 | ✳️ |
|
||||
| 1.20.6 | 🚧 |
|
||||
| 1.20.6 | ❌ |
|
||||
| 1.21 | ✳️ |
|
||||
|
||||
- ❌ - Not Supported; no bug fixes or new features.
|
||||
- 🚧 - Work in Progress; not ready for release.
|
||||
|
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"action": "port",
|
||||
"devBranch": "porting"
|
||||
}
|
Reference in New Issue
Block a user