Allow serializing FormattedText values to json (#1291)
This commit is contained in:
1 parent
d57323e14f
commit
77092924bc
1 file changed
+6
@@ -1,5 +1,6 @@
|
||||
package carpet.script.value;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import net.minecraft.nbt.StringTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.network.chat.BaseComponent;
|
||||
@@ -81,6 +82,11 @@ public class FormattedTextValue extends StringValue
|
||||
return StringTag.valueOf(Component.Serializer.toJson(text));
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonElement toJson() {
|
||||
return Component.Serializer.toJsonTree(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Value add(Value o) {
|
||||
return combine(this, o);
|
||||
|
||||
Reference in new issue
Block a user