22w16b with massive Component changes

This commit is contained in:
gnembon committed 2022-04-21 00:26:39 +02:00
1 parent 8101abb431
commit 746c8548e9
31 files changed
+153 -162

No files matched your search

@@ -3,9 +3,8 @@ 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;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.MutableComponent;
public class FormattedTextValue extends StringValue
{
@@ -17,16 +16,16 @@ public class FormattedTextValue extends StringValue
}
public static Value combine(Value left, Value right) {
BaseComponent text;
MutableComponent text;
if (left instanceof FormattedTextValue)
{
text = (BaseComponent) ((FormattedTextValue) left).getText().copy();
text = ((FormattedTextValue) left).getText().copy();
}
else
{
if (left.isNull())
return right;
text = new TextComponent(left.getString());
text = Component.literal(left.getString());
}
if (right instanceof FormattedTextValue)
@@ -103,7 +102,7 @@ public class FormattedTextValue extends StringValue
}
public static Component getTextByValue(Value value) {
return (value instanceof FormattedTextValue) ? ((FormattedTextValue) value).getText() : new TextComponent(value.getString());
return (value instanceof FormattedTextValue) ? ((FormattedTextValue) value).getText() : Component.literal(value.getString());
}
}