Can has json version of a scarpet value

This commit is contained in:
gnembon committed 2020-08-21 01:44:19 -03:00
1 parent b48c52cce4
commit e759a368b9
5 files changed
+57 -3

No files matched your search

@@ -2,6 +2,8 @@ package carpet.script.value;
import carpet.script.LazyValue;
import carpet.script.exception.InternalExpressionException;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.AbstractNumberTag;
import net.minecraft.nbt.CompoundTag;
@@ -525,4 +527,13 @@ public class ListValue extends AbstractListValue implements ContainerValueInterf
}
return tag;
}
@Override
public JsonElement toJson()
{
JsonArray array = new JsonArray();
for (Value el: items)
array.add(el.toJson());
return array;
}
}