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
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;

View File

@@ -408,36 +408,43 @@ void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, MovePlay
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));
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);
// player->travel(packet->x - entity->x, packet->z - entity->z);
// 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);
// }

View File

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

View File

@@ -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();

View File

@@ -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()) {