add aabb drop models support

This commit is contained in:
MihailRis
2024-07-03 19:21:05 +03:00
parent fa450c1c15
commit 4b084dffad
2 changed files with 40 additions and 10 deletions
+17 -1
View File
@@ -280,8 +280,23 @@ static int l_get_model(lua::State* L) {
case BlockModel::custom: return lua::pushstring(L, "custom");
case BlockModel::none: return lua::pushstring(L, "none");
}
return 0;
}
return 0;
}
static int l_get_hitbox(lua::State* L) {
if (auto def = require_block(L)) {
auto& hitbox = def->rt.hitboxes[0].at(lua::tointeger(L, 2));
lua::createtable(L, 2, 0);
lua::pushvec3_arr(L, hitbox.min());
lua::rawseti(L, 1);
lua::pushvec3_arr(L, hitbox.size());
lua::rawseti(L, 2);
return 1;
}
return 0;
}
const luaL_Reg blocklib [] = {
@@ -309,5 +324,6 @@ const luaL_Reg blocklib [] = {
{"seek_origin", lua::wrap<l_seek_origin>},
{"get_textures", lua::wrap<l_get_textures>},
{"get_model", lua::wrap<l_get_model>},
{"get_hitbox", lua::wrap<l_get_hitbox>},
{NULL, NULL}
};