m_Player->GetRotation(): always returns 0.000000
#1
I'm playing around with getting redstone going and while adding the redstone repeater I noticed that m_Player->GetRotation() always returns 0.000000

I started tracing the problem back and can see that when the PLAYERLOOK and PLAYERMOVELOOK packets are sent, m_Rotation is always 0. I don't know if the client is always sending a 0 or something's wrong with how the program's reading the packets.

right now it's not possible to place redstone repeaters or stairs in the direction you face.
Reply
Thanks given by:
#2
Let me guess, you were running the game under Linux? I've encountered this before, this is a really weird bug. Minecraft seems to always send 0 for player rotation when running under Linux.
Reply
Thanks given by:
#3
(11-04-2011, 12:03 AM)FakeTruth Wrote: Let me guess, you were running the game under Linux? I've encountered this before, this is a really weird bug. Minecraft seems to always send 0 for player rotation when running under Linux.

Yup, 64 bit linux.
Reply
Thanks given by:
#4
So it has nothing to do with MCServer I think
Reply
Thanks given by:
#5
(11-04-2011, 02:26 AM)FakeTruth Wrote: So it has nothing to do with MCServer I think
I found a "fix" for it, but I don't understand it.




adding this to Endianness.h allowed it to read the packet correctly:
(void)printf("",(unsigned long)buf);

Code:
inline float NetworkToHostFloat4( void* a_Value )
{
        u_long buf = *(u_long*)a_Value;
        buf = ntohl( (unsigned long)buf );
        (void)printf("",(unsigned long)buf);
        return *(float*)reinterpret_cast<float *>(&buf);
}


Any ideas? It works, but I don't like not knowing why.
Reply
Thanks given by:
#6
Interesting, I have no clue why that would fix it
Reply
Thanks given by:
#7
I changed it again, please try if it works now.
I think it screws up because of optimizations, but this should prevent that from happening.
Reply
Thanks given by:
#8
Downloaded and recompiled. Seems to be working just fine. Redstone repeaters and stairs are going the right direction.Big Grin
Reply
Thanks given by:




Users browsing this thread: 2 Guest(s)