Creative Mode
#4
You have a giant bug in the cPacket_CreateInventoryAction packet.

Code:
static const unsigned int c_Size = 1 + 4 + 2 + 2 + 2;
This totals 11 bytes, while the protcol documentation says it's 9 bytes (which makes sense: 4 shorts (8bytes) + packet id (1byte) = 9bytes)

I'm still looking at the other changes you made

---------
Code:
short m_Short;
Should be m_Damage;

--------
Code:
if( m_ItemID <= 0 ) m_ItemID = -1; // Fix, to make sure no invalid values are sent.
                        // WARNING: HERE ITS -1, BUT IN NAMED ENTITY SPAWN PACKET ITS 0 !!
Make sure this is true for this packet, minecraft is not consistent with this. Sometimes empty is 0, and sometimes it's -1, the client WILL crash if it's wrong

--------
You made some unnecessary changes to cPlugin.h, cInventory.h and Bindings.cpp.
cPlugin.h and cInventory.h both have some classes Forward declared, you only have to do that when you actually use the classes (in this case you're not using cPacket_CreateInventoryAction in those files)
Bindings.cpp is automagically generated by "trunk/source/AllToLua.bat", it's a windows executable that reads several *.h files and creates Lua bindings.

--------
You added
Code:
static const int GAMEMODE = 1; //0 = Survival, 1 = Creative;
to cPacket.h, this is not the right place for this, and packets should not be initialized with a gamemode. I suggest moving this to the cWorld class, and reading the gamemode from cWorld while filling in a packet before sending it.

For example:
Code:
// Create Respawn player packet
cPacket_Respawn Packet;
Packet.m_CreativeMode = cRoot::Get()->GetWorld()->GetGameMode();
// .. fill in some more stuff
// Send packet
// ???
// profit
Same goes for the login packet

--------
Since players might want to switch to creative/survival mode on the fly, GAMEMODE should not be a constant value in cClientHandle, just make it a regular int m_GameMode (in cClientHandle OR cPlayer) and initialize it to the current cWorld value (see above) then when a player decides to change game mode, just switch the integer to 0 or 1
(I see you moved it to one spot, but above still applies, and it should actually be in 2 places)
Reply
Thanks given by:


Messages In This Thread
Creative Mode - by rs2k - 10-27-2011, 02:39 AM
RE: Creative Mode - by rs2k - 10-27-2011, 04:16 AM
RE: Creative Mode - by rs2k - 10-27-2011, 05:17 AM
RE: Creative Mode - by FakeTruth - 10-27-2011, 05:26 AM
RE: Creative Mode - by rs2k - 10-27-2011, 05:38 AM
RE: Creative Mode - by FakeTruth - 10-27-2011, 05:53 AM
RE: Creative Mode - by rs2k - 10-27-2011, 06:06 AM
RE: Creative Mode - by rs2k - 11-02-2011, 03:54 AM
RE: Creative Mode - by FakeTruth - 11-02-2011, 07:04 AM
RE: Creative Mode - by rs2k - 11-02-2011, 06:12 AM
RE: Creative Mode - by rs2k - 11-02-2011, 07:15 AM
RE: Creative Mode - by FakeTruth - 11-02-2011, 07:21 AM
RE: Creative Mode - by rs2k - 11-02-2011, 07:23 AM
RE: Creative Mode - by FakeTruth - 11-02-2011, 08:13 AM
RE: Creative Mode - by rs2k - 11-02-2011, 08:17 AM
RE: Creative Mode - by FakeTruth - 11-02-2011, 08:24 AM
RE: Creative Mode - by rs2k - 11-02-2011, 08:30 AM
RE: Creative Mode - by FakeTruth - 11-02-2011, 09:39 AM
RE: Creative Mode - by rs2k - 11-02-2011, 06:35 PM
RE: Creative Mode - by rs2k - 11-02-2011, 09:43 AM
RE: Creative Mode - by FakeTruth - 11-03-2011, 03:17 AM
RE: Creative Mode - by rs2k - 11-03-2011, 03:50 AM
RE: Creative Mode - by FraNkYWIllS - 12-20-2011, 08:24 PM



Users browsing this thread: 2 Guest(s)