Possible hotfix for empty NMS lists.
This commit is contained in:
parent
303f91430a
commit
79c42a56e6
@ -75,13 +75,11 @@ public class NbtGsonConverter
|
|||||||
if (type == NBType.LIST)
|
if (type == NBType.LIST)
|
||||||
{
|
{
|
||||||
JsonElement elemtypeElement = jsonObject.get(ELEMTYPE);
|
JsonElement elemtypeElement = jsonObject.get(ELEMTYPE);
|
||||||
if (elemtypeElement == null)
|
if (elemtypeElement != null)
|
||||||
{
|
{
|
||||||
// must have an elemtype
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
elemtype = NBType.getByName(elemtypeElement.getAsString());
|
elemtype = NBType.getByName(elemtypeElement.getAsString());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch the value field
|
// Fetch the value field
|
||||||
JsonElement val = jsonObject.get(VAL);
|
JsonElement val = jsonObject.get(VAL);
|
||||||
@ -215,7 +213,13 @@ public class NbtGsonConverter
|
|||||||
|
|
||||||
if (type == NBType.LIST)
|
if (type == NBType.LIST)
|
||||||
{
|
{
|
||||||
ret.addProperty(ELEMTYPE, NBType.getByTag(((NBTTagList)nbt).get(0)).getName());
|
NBType elemtype = NBType.UNKNOWN;
|
||||||
|
NBTTagList nbtl = (NBTTagList)nbt;
|
||||||
|
if (nbtl.size() > 0)
|
||||||
|
{
|
||||||
|
elemtype = NBType.getByTag(nbtl.get(0));
|
||||||
|
}
|
||||||
|
ret.addProperty(ELEMTYPE, elemtype.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonElement val = nbtToGsonVal(nbt);
|
JsonElement val = nbtToGsonVal(nbt);
|
||||||
|
Loading…
Reference in New Issue
Block a user