use of ladysnake.gaspunk.api.basetype.GasTypes in project Gaspunk by Ladysnake.
the class GasDeserializer method write.
@Override
public void write(JsonWriter out, AbstractGas value) throws IOException {
out.beginObject();
if (value.getType() instanceof GasTypes) {
GasTypes type = (GasTypes) value.getType();
out.name("gasType");
out.value(type.name());
} else
throw new RuntimeException("Cannot serialize unknown type " + value.getType());
if (value.getParticleType() instanceof GasParticleTypes) {
GasParticleTypes type = (GasParticleTypes) value.getParticleType();
out.name("particleType");
out.value(type.name());
} else
throw new RuntimeException("Cannot serialize unknown type " + value.getParticleType());
out.name("color");
out.value(Long.toString(value.getColor(), 16));
out.name("bottleColor");
out.value(Long.toString(value.getBottleColor(), 16));
out.name("agents");
out.beginArray();
for (Gas.AgentEffect effect : value.getAgents()) {
out.beginObject();
out.name("agent");
out.value(GasAgents.getId(effect.getAgent()).toString());
out.name("potency");
out.value(effect.getPotency());
out.endObject();
}
out.endArray();
String[] tooltipLines = value.getTooltipLines();
if (tooltipLines.length > 0) {
out.name("tooltipLines");
out.beginArray();
for (String s : value.getTooltipLines()) out.value(s);
out.endArray();
}
out.endObject();
}
Aggregations