mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2026-05-23 23:10:00 +08:00
Format code [skip actions]
This commit is contained in:
@@ -13,13 +13,12 @@ import emu.grasscutter.game.world.Position;
|
||||
import it.unimi.dsi.fastutil.floats.FloatArrayList;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import lombok.val;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
import lombok.val;
|
||||
|
||||
public interface JsonAdapters {
|
||||
class DynamicFloatAdapter extends TypeAdapter<DynamicFloat> {
|
||||
@@ -40,18 +39,19 @@ public interface JsonAdapters {
|
||||
val opStack = new ArrayList<DynamicFloat.StackOp>();
|
||||
while (reader.hasNext()) {
|
||||
opStack.add(
|
||||
switch (reader.peek()) {
|
||||
case STRING -> new DynamicFloat.StackOp(reader.nextString());
|
||||
case NUMBER -> new DynamicFloat.StackOp((float) reader.nextDouble());
|
||||
case BOOLEAN -> new DynamicFloat.StackOp(reader.nextBoolean());
|
||||
default -> throw new IOException(
|
||||
"Invalid DynamicFloat definition - " + reader.peek().name());
|
||||
});
|
||||
switch (reader.peek()) {
|
||||
case STRING -> new DynamicFloat.StackOp(reader.nextString());
|
||||
case NUMBER -> new DynamicFloat.StackOp((float) reader.nextDouble());
|
||||
case BOOLEAN -> new DynamicFloat.StackOp(reader.nextBoolean());
|
||||
default -> throw new IOException(
|
||||
"Invalid DynamicFloat definition - " + reader.peek().name());
|
||||
});
|
||||
}
|
||||
reader.endArray();
|
||||
return new DynamicFloat(opStack);
|
||||
}
|
||||
default -> throw new IOException("Invalid DynamicFloat definition - " + reader.peek().name());
|
||||
default -> throw new IOException(
|
||||
"Invalid DynamicFloat definition - " + reader.peek().name());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public interface JsonAdapters {
|
||||
public void write(JsonWriter writer, IntList l) throws IOException {
|
||||
writer.beginArray();
|
||||
for (val i : l) // .forEach() doesn't appreciate exceptions
|
||||
writer.value(i);
|
||||
writer.value(i);
|
||||
writer.endArray();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user