FIX IT AHTUNG AHTUNG ALL DOESNT WORK FIX IT FIX IT FIX IT FIX IT BIG WARNING BIG WARNING

This commit is contained in:
InviseDivine
2026-03-29 16:53:46 +02:00
parent f016f00eab
commit 3cfa2d9ee7
5 changed files with 25 additions and 21 deletions

View File

@@ -730,7 +730,6 @@ void Gui::renderDebugInfo() {
// Position // Position
float px = p->x, py = p->y - p->heightOffset, pz = p->z; 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 bx = (int)floorf(px), by = (int)floorf(py), bz = (int)floorf(pz);
int cx = bx >> 4, cz = bz >> 4; int cx = bx >> 4, cz = bz >> 4;

View File

@@ -406,38 +406,45 @@ void ServerSideNetworkHandler::onReady_RequestedChunks(const RakNet::RakNetGUID&
void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, MovePlayerPacket* packet) void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, MovePlayerPacket* packet)
{ {
if (!level) return; if (!level) return;
//LOGI("MovePlayerPacket\n"); //LOGI("MovePlayerPacket\n");
if (Entity* entity = level->getEntity(packet->entityId)) if (Entity* entity = level->getEntity(packet->entityId)) {
{
ServerPlayer* player = (ServerPlayer*) getPlayer(source); ServerPlayer* player = (ServerPlayer*) getPlayer(source);
float vectorDist = sqrt( (packet->x - entity->x) * (packet->x - entity->x) + float vectorDist = sqrt( (packet->x - entity->x) * (packet->x - entity->x) +
(packet->z - entity->z) * (packet->z - entity->z)); (packet->z - entity->z) * (packet->z - entity->z));
float speed = vectorDist / (minecraft->getTicks() - player->getLastMoveTicks()); 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 < 1.f) {
LOGI("Packet: %f, %f, %f \n", packet->x, packet->y, packet->z);
// if (speed < 2.5f) {
LOGI("Packets: %f, %f, %f \n", packet->x, packet->y, packet->z);
LOGI("Entity before: %f, %f, %f \n", entity->x, entity->y, entity->z); LOGI("Entity before: %f, %f, %f \n", entity->x, entity->y, entity->z);
LOGI("OnGround: %d \n", entity->onGround); LOGI("OnGround: %d \n", entity->onGround);
//player->xd = player->yd = player->zd = 0;
player->setxxa(packet->x); // @note: packet->y contains y with subtracted entity->heightOffset
player->setYya(packet->z); float ya = packet->y - entity->y - entity->heightOffset;
// player->move(packet->x - entity->x, packet->y - entity->y, packet->z - entity->z);
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); for (unsigned int i = 0; i < aABBs.size(); i++)
// entity->lerpTo(packet->x, packet->y, packet->z, packet->yRot, packet->xRot, 3); 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); LOGI("Entity after: %f, %f, %f \n", entity->x, entity->y, entity->z);
// broadcast this packet to other clients // broadcast this packet to other clients
redistributePacket(packet, source); redistributePacket(packet, source);
// } else { } // else {
//MovePlayerPacket refuse(player->entityId, player->x, player->y, player->z, player->xRot, player->yRot); //MovePlayerPacket refuse(player->entityId, player->x, player->y, player->z, player->xRot, player->yRot);
//raknetInstance->send(refuse); //raknetInstance->send(refuse);
// } // }

View File

@@ -49,7 +49,6 @@ void ServerPlayer::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, boo
void ServerPlayer::aiStep() { void ServerPlayer::aiStep() {
updateAttackAnim(); updateAttackAnim();
super::aiStep(); super::aiStep();
Mob::aiStep();
} }
void ServerPlayer::tick() { void ServerPlayer::tick() {

View File

@@ -129,6 +129,7 @@ public:
virtual bool isHangingEntity(); virtual bool isHangingEntity();
virtual int getAuxData(); virtual int getAuxData();
virtual void checkFallDamage(float ya, bool onGround);
protected: protected:
virtual void setRot(float yRot, float xRot); virtual void setRot(float yRot, float xRot);
@@ -137,7 +138,6 @@ protected:
virtual void resetPos(bool clearMore); virtual void resetPos(bool clearMore);
virtual void outOfWorld(); virtual void outOfWorld();
virtual void checkFallDamage(float ya, bool onGround);
virtual void causeFallDamage(float fallDamage2); virtual void causeFallDamage(float fallDamage2);
virtual void markHurt(); virtual void markHurt();

View File

@@ -728,7 +728,6 @@ bool Mob::isWaterMob()
void Mob::aiStep() void Mob::aiStep()
{ {
printf("%f %f \n", xxa, yya);
//@todo? 30 lines of code here in java version //@todo? 30 lines of code here in java version
TIMER_PUSH("ai"); TIMER_PUSH("ai");
if (isImmobile()) { if (isImmobile()) {