mirror of
https://github.com/celisej567/mcpe.git
synced 2026-01-03 05:49:04 +03:00
Merge devel into master (#78)
* * Turn survival back on for now. * * Add TP command. * * Fix fall damage reset. * * Mob hitting works. I've disabled entity shading though. Will get back to it at some point, promise! * * Knockback * * Mobs now rotate when they die. * * Fire fix
This commit is contained in:
@@ -403,6 +403,7 @@ void ServerSideNetworkHandler::setupCommands()
|
||||
m_commands["stats"] = &ServerSideNetworkHandler::commandStats;
|
||||
m_commands["time"] = &ServerSideNetworkHandler::commandTime;
|
||||
m_commands["seed"] = &ServerSideNetworkHandler::commandSeed;
|
||||
m_commands["tp"] = &ServerSideNetworkHandler::commandTP;
|
||||
}
|
||||
|
||||
void ServerSideNetworkHandler::commandHelp(OnlinePlayer* player, const std::vector<std::string>& parms)
|
||||
@@ -473,3 +474,49 @@ void ServerSideNetworkHandler::commandSeed(OnlinePlayer* player, const std::vect
|
||||
ss << m_pLevel->getSeed();
|
||||
sendMessage(player, ss.str());
|
||||
}
|
||||
|
||||
void ServerSideNetworkHandler::commandTP(OnlinePlayer* player, const std::vector<std::string>& parms)
|
||||
{
|
||||
if (!m_pLevel)
|
||||
return;
|
||||
|
||||
if (parms.size() != 3)
|
||||
{
|
||||
sendMessage(player, "Usage: /tp <x> <y> <z>");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player->m_pPlayer != this->m_pMinecraft->m_pLocalPlayer)
|
||||
{
|
||||
sendMessage(player, "Sorry, only the host can use this command at the moment");
|
||||
return;
|
||||
}
|
||||
|
||||
Vec3 pos = player->m_pPlayer->getPos(1.0f);
|
||||
|
||||
float x = pos.x, y = pos.y, z = pos.z;
|
||||
|
||||
std::stringstream ss;
|
||||
if (parms[0] != "~")
|
||||
{
|
||||
ss = std::stringstream(parms[0]);
|
||||
ss >> x;
|
||||
}
|
||||
if (parms[1] != "~")
|
||||
{
|
||||
ss = std::stringstream(parms[1]);
|
||||
ss >> y;
|
||||
}
|
||||
if (parms[2] != "~")
|
||||
{
|
||||
ss = std::stringstream(parms[2]);
|
||||
ss >> z;
|
||||
}
|
||||
|
||||
ss = std::stringstream();
|
||||
ss << "Teleported to " << x << ", " << y << ", " << z;
|
||||
|
||||
player->m_pPlayer->setPos(x, y, z);
|
||||
|
||||
sendMessage(player, ss.str());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user