Skip to content

Commit

Permalink
feat(game.chat): static text style deserializer
Browse files Browse the repository at this point in the history
  • Loading branch information
WakelessSloth56 committed Nov 26, 2022
1 parent c389354 commit dee772d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/java/org/auioc/mcmod/arnicalib/game/chat/TextUtils.java
@@ -1,6 +1,8 @@
package org.auioc.mcmod.arnicalib.game.chat;

import java.util.List;
import javax.annotation.Nullable;
import com.google.gson.JsonElement;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.HoverEvent;
Expand Down Expand Up @@ -60,4 +62,12 @@ public static MutableComponent join(List<Component> texts) {
return join(texts, literal(", "));
}


private static final Style.Serializer STYLE_SERIALIZER = new Style.Serializer();

@Nullable
public static Style deserializeStyle(JsonElement json) {
return STYLE_SERIALIZER.deserialize(json, null, null);
}

}

0 comments on commit dee772d

Please sign in to comment.