Add entity.getType()
This commit is contained in:
parent
800b1441a9
commit
6b9ef075ba
@ -325,6 +325,20 @@ std::string CommandServer_parse_injection(CommandServer_parse_t old, CommandServ
|
|||||||
} else {
|
} else {
|
||||||
return api_get_output(misc_get_entity_name(entity), false) + '\n';
|
return api_get_output(misc_get_entity_name(entity), false) + '\n';
|
||||||
}
|
}
|
||||||
|
} else if (cmd == "entity.getType") {
|
||||||
|
// Parse
|
||||||
|
next_int(id);
|
||||||
|
// Return
|
||||||
|
Entity *entity = server->minecraft->level->getEntity(id);
|
||||||
|
if (entity == nullptr) {
|
||||||
|
return CommandServer::NullString;
|
||||||
|
} else {
|
||||||
|
int type = entity->getEntityTypeId();
|
||||||
|
if (api_compat_mode) {
|
||||||
|
api_convert_to_rj_entity_type(type);
|
||||||
|
}
|
||||||
|
return std::to_string(type) + '\n';
|
||||||
|
}
|
||||||
} else if (cmd == "world.getEntities") {
|
} else if (cmd == "world.getEntities") {
|
||||||
// Parse
|
// Parse
|
||||||
next_int(type);
|
next_int(type);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user