mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-03-30 12:03:30 +00:00
FIX IT AHTUNG AHTUNG ALL DOESNT WORK FIX IT FIX IT FIX IT FIX IT BIG WARNING BIG WARNING
This commit is contained in:
@@ -730,7 +730,6 @@ void Gui::renderDebugInfo() {
|
||||
|
||||
// Position
|
||||
float px = p->x, py = p->y - p->heightOffset, pz = p->z;
|
||||
posTranslator.to(px, py, pz);
|
||||
int bx = (int)floorf(px), by = (int)floorf(py), bz = (int)floorf(pz);
|
||||
int cx = bx >> 4, cz = bz >> 4;
|
||||
|
||||
|
||||
@@ -406,38 +406,45 @@ void ServerSideNetworkHandler::onReady_RequestedChunks(const RakNet::RakNetGUID&
|
||||
void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, MovePlayerPacket* packet)
|
||||
{
|
||||
if (!level) return;
|
||||
|
||||
|
||||
//LOGI("MovePlayerPacket\n");
|
||||
if (Entity* entity = level->getEntity(packet->entityId))
|
||||
{
|
||||
if (Entity* entity = level->getEntity(packet->entityId)) {
|
||||
ServerPlayer* player = (ServerPlayer*) getPlayer(source);
|
||||
|
||||
float vectorDist = sqrt( (packet->x - entity->x) * (packet->x - entity->x) +
|
||||
(packet->z - entity->z) * (packet->z - entity->z));
|
||||
float speed = vectorDist / (minecraft->getTicks() - player->getLastMoveTicks());
|
||||
|
||||
player->xRot = player->xRotO = packet->xRot;
|
||||
player->yRot = player->yRotO = packet->yRot;
|
||||
|
||||
// packet->y += 1.62f;
|
||||
|
||||
// if (speed < 2.5f) {
|
||||
LOGI("Packets: %f, %f, %f \n", packet->x, packet->y, packet->z);
|
||||
if (speed < 1.f) {
|
||||
LOGI("Packet: %f, %f, %f \n", packet->x, packet->y, packet->z);
|
||||
LOGI("Entity before: %f, %f, %f \n", entity->x, entity->y, entity->z);
|
||||
LOGI("OnGround: %d \n", entity->onGround);
|
||||
//player->xd = player->yd = player->zd = 0;
|
||||
|
||||
player->setxxa(packet->x);
|
||||
player->setYya(packet->z);
|
||||
// player->move(packet->x - entity->x, packet->y - entity->y, packet->z - entity->z);
|
||||
// @note: packet->y contains y with subtracted entity->heightOffset
|
||||
float ya = packet->y - entity->y - entity->heightOffset;
|
||||
|
||||
LOGI("y: %f \n", ya);
|
||||
|
||||
float yaOrg = ya;
|
||||
|
||||
// @BIGWARNING @fixme: blocks around work as shit
|
||||
std::vector<AABB>& aABBs = level->getCubes(entity, entity->bb.expand(0, ya, 0));
|
||||
|
||||
// player->travel(packet->x - entity->x, packet->z - entity->z);
|
||||
// entity->lerpTo(packet->x, packet->y, packet->z, packet->yRot, packet->xRot, 3);
|
||||
for (unsigned int i = 0; i < aABBs.size(); i++)
|
||||
ya = aABBs[i].clipYCollide(entity->bb, ya);
|
||||
|
||||
bool og = yaOrg != ya && yaOrg < 0;
|
||||
|
||||
entity->onGround = og;
|
||||
entity->checkFallDamage(ya, og);
|
||||
entity->xd = entity->yd = entity->zd = 0;
|
||||
entity->lerpTo(packet->x, packet->y, packet->z, packet->yRot, packet->xRot, 3);
|
||||
|
||||
LOGI("Entity after: %f, %f, %f \n", entity->x, entity->y, entity->z);
|
||||
|
||||
// broadcast this packet to other clients
|
||||
redistributePacket(packet, source);
|
||||
// } else {
|
||||
} // else {
|
||||
//MovePlayerPacket refuse(player->entityId, player->x, player->y, player->z, player->xRot, player->yRot);
|
||||
//raknetInstance->send(refuse);
|
||||
// }
|
||||
|
||||
@@ -49,7 +49,6 @@ void ServerPlayer::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, boo
|
||||
void ServerPlayer::aiStep() {
|
||||
updateAttackAnim();
|
||||
super::aiStep();
|
||||
Mob::aiStep();
|
||||
}
|
||||
|
||||
void ServerPlayer::tick() {
|
||||
|
||||
@@ -129,6 +129,7 @@ public:
|
||||
virtual bool isHangingEntity();
|
||||
|
||||
virtual int getAuxData();
|
||||
virtual void checkFallDamage(float ya, bool onGround);
|
||||
|
||||
protected:
|
||||
virtual void setRot(float yRot, float xRot);
|
||||
@@ -137,7 +138,6 @@ protected:
|
||||
virtual void resetPos(bool clearMore);
|
||||
virtual void outOfWorld();
|
||||
|
||||
virtual void checkFallDamage(float ya, bool onGround);
|
||||
virtual void causeFallDamage(float fallDamage2);
|
||||
virtual void markHurt();
|
||||
|
||||
|
||||
@@ -728,7 +728,6 @@ bool Mob::isWaterMob()
|
||||
|
||||
void Mob::aiStep()
|
||||
{
|
||||
printf("%f %f \n", xxa, yya);
|
||||
//@todo? 30 lines of code here in java version
|
||||
TIMER_PUSH("ai");
|
||||
if (isImmobile()) {
|
||||
|
||||
Reference in New Issue
Block a user