| 1458 | } |
| 1459 | |
| 1460 | Maybe<Json> WorldEntityCallbacks::entityNametag(World* world, EntityId entityId) { |
| 1461 | auto entity = world->entity(entityId); |
| 1462 | |
| 1463 | Json result; |
| 1464 | if (auto nametagEntity = as<NametagEntity>(entity)) { |
| 1465 | result = JsonObject{ |
| 1466 | {"nametag", nametagEntity->nametag()}, |
| 1467 | {"displayed", nametagEntity->displayNametag()}, |
| 1468 | {"color", jsonFromColor(Color::rgb(nametagEntity->nametagColor()))}, |
| 1469 | {"origin", jsonFromVec2F(nametagEntity->nametagOrigin())}, |
| 1470 | }; |
| 1471 | if (auto status = nametagEntity->statusText()) |
| 1472 | result.set("status", *status); |
| 1473 | } |
| 1474 | |
| 1475 | return result; |
| 1476 | } |
| 1477 | |
| 1478 | Maybe<String> WorldEntityCallbacks::entityDescription(World* world, EntityId entityId, Maybe<String> const& species) { |
| 1479 | if (auto entity = world->entity(entityId)) { |
nothing calls this directly
no test coverage detected