Cuberite Forum
Joining the packet sources - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: Joining the packet sources (/thread-524.html)

Pages: 1 2 3 4 5 6 7


RE: Joining the packet sources - NiLSPACE - 12-15-2013

I thought I'd work on the HandlePlayerAbilities, but i'm stuck already. How do those "Flags" work?


RE: Joining the packet sources - xoft - 12-15-2013

Those flags are just a bitfield, similar to how some block metadata work in MC. Bit 0 says if the player thinks they are in Creative mode, bit 1 says if they think they are flying, bit 2 says if they think they are allowed to fly, etc.
To construct such a value, you OR the bit values together:
Byte ValueToSend = 1 | 2 | 4;  // Creative, flying, can fly
To query such value, you AND it with the respective bitmasks:
if ((ValueReceived & 1) != 0)
{
  // Creative
}
if ((ValueReceived & 2) != 0)
{
  // Flying
}
Note that the vanilla server ignores some of these, we should as well.


RE: Joining the packet sources - NiLSPACE - 12-15-2013

Look at me flying in survival Smile
[Image: 5NngQ.jpg]


RE: Joining the packet sources - tonibm19 - 12-15-2013

(12-15-2013, 11:26 PM)STR_Warrior Wrote: Look at me flying in survival Smile
[Image: 5NngQ.jpg]
Send me or post the plugin pleaseBig Grin
I always wanted the /fly command in MCServer.


RE: Joining the packet sources - NiLSPACE - 12-15-2013

It's not a plugin Wink I'm making the server able to control if a player can fly and is flying.


RE: Joining the packet sources - tigerw - 12-15-2013

It's awesome that you're doing more CPP :)


RE: Joining the packet sources - NiLSPACE - 12-15-2013

First Commit.

xoft are you okay with the names of the functions?


RE: Joining the packet sources - xoft - 12-16-2013

The names are great.

I have to say, you have really surprised me. When you started tinkering with MCS, I wouldn't have believed that you'd get so good. Keep surprising me in such good ways!