25w09a, broken shapes
This commit is contained in:
1 parent
1928b4f866
commit
9a62566b2a
9 files changed
+81
-80
No files matched your search
@@ -64,6 +64,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
|
||||
private Tag nbtTag = null;
|
||||
private Supplier<Tag> nbtSupplier = null;
|
||||
private boolean owned = false;
|
||||
private static TagParser<Tag> tagParser = TagParser.create(NbtOps.INSTANCE);
|
||||
|
||||
private NBTSerializableValue()
|
||||
{
|
||||
@@ -75,7 +76,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
|
||||
{
|
||||
try
|
||||
{
|
||||
return TagParser.parseAsArgument(NbtOps.INSTANCE, new StringReader(nbtString));
|
||||
return tagParser.parseAsArgument( new StringReader(nbtString));
|
||||
}
|
||||
catch (CommandSyntaxException e)
|
||||
{
|
||||
@@ -128,7 +129,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
|
||||
{
|
||||
try
|
||||
{
|
||||
Tag tag = TagParser.parseAsArgument(NbtOps.INSTANCE, new StringReader(nbtString));
|
||||
Tag tag = tagParser.parseAsArgument(new StringReader(nbtString));
|
||||
NBTSerializableValue value = new NBTSerializableValue(tag);
|
||||
value.nbtString = null;
|
||||
return value;
|
||||
@@ -386,11 +387,11 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
|
||||
if (t instanceof final NumericTag number)
|
||||
{
|
||||
// short and byte will never exceed float's precision, even int won't
|
||||
return t instanceof LongTag || t instanceof IntTag ? NumericValue.of(number.getAsLong()) : NumericValue.of(number.getAsNumber());
|
||||
return t instanceof LongTag || t instanceof IntTag ? NumericValue.of(number.longValue()) : NumericValue.of(number.asNumber().orElseThrow());
|
||||
}
|
||||
if (t instanceof StringTag)
|
||||
if (t instanceof StringTag stringTag)
|
||||
{
|
||||
return StringValue.of(t.getAsString());
|
||||
return StringValue.of(stringTag.value());
|
||||
}
|
||||
if (t instanceof EndTag)
|
||||
{
|
||||
@@ -409,13 +410,13 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
|
||||
if (t instanceof final CompoundTag ctag)
|
||||
{
|
||||
Map<Value, Value> pairs = new HashMap<>();
|
||||
for (String key : ctag.getAllKeys())
|
||||
for (String key : ctag.keySet())
|
||||
{
|
||||
pairs.put(new StringValue(key), decodeTagDeep(ctag.get(key)));
|
||||
}
|
||||
return MapValue.wrap(pairs);
|
||||
}
|
||||
if (t instanceof final CollectionTag<?> ltag)
|
||||
if (t instanceof final CollectionTag ltag)
|
||||
{
|
||||
List<Value> elems = new ArrayList<>();
|
||||
for (Tag elem : ltag)
|
||||
@@ -478,17 +479,17 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
|
||||
{
|
||||
return !(ctag).isEmpty();
|
||||
}
|
||||
if (tag instanceof final CollectionTag<?> ltag)
|
||||
if (tag instanceof final CollectionTag ltag)
|
||||
{
|
||||
return !(ltag).isEmpty();
|
||||
}
|
||||
if (tag instanceof final NumericTag number)
|
||||
{
|
||||
return number.getAsDouble() != 0.0;
|
||||
return number.doubleValue() != 0.0;
|
||||
}
|
||||
if (tag instanceof StringTag)
|
||||
if (tag instanceof StringTag st)
|
||||
{
|
||||
return !tag.getAsString().isEmpty();
|
||||
return !st.value().isEmpty();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -570,7 +571,7 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
|
||||
boolean modified = false;
|
||||
for (Tag target : targets)
|
||||
{
|
||||
if (!(target instanceof final CollectionTag<?> targetList))
|
||||
if (!(target instanceof final CollectionTag targetList))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user