mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-03-20 06:53:30 +00:00
Fixes and enhancements from my MCPE repository. (https://github.com/mschiller890/mcpe64)
This commit is contained in:
@@ -134,6 +134,11 @@ void ServerSideNetworkHandler::displayGameMessage(const std::string& message)
|
||||
raknetInstance->send(packet);
|
||||
}
|
||||
|
||||
void ServerSideNetworkHandler::handle(const RakNet::RakNetGUID& source, ChatPacket* packet)
|
||||
{
|
||||
displayGameMessage(packet->message);
|
||||
}
|
||||
|
||||
void ServerSideNetworkHandler::onNewClient(const RakNet::RakNetGUID& clientGuid)
|
||||
{
|
||||
LOGI("onNewClient, client guid: %s\n", clientGuid.ToString());
|
||||
@@ -256,6 +261,11 @@ void ServerSideNetworkHandler::onReady_ClientGeneration(const RakNet::RakNetGUID
|
||||
SetTimePacket(level->getTime()).write(&bitStream);
|
||||
rakPeer->Send(&bitStream, HIGH_PRIORITY, RELIABLE_ORDERED, 0, source, false);
|
||||
|
||||
// send adventure settings (includes showNameTags, etc.)
|
||||
bitStream.Reset();
|
||||
AdventureSettingsPacket(level->adventureSettings).write(&bitStream);
|
||||
rakPeer->Send(&bitStream, HIGH_PRIORITY, RELIABLE_ORDERED, 0, source, false);
|
||||
|
||||
// send all pre-existing players to the new player
|
||||
const PlayerList& players = level->players;
|
||||
for (unsigned int i = 0; i < players.size(); i++) {
|
||||
|
||||
@@ -57,18 +57,18 @@ public:
|
||||
virtual void handle(const RakNet::RakNetGUID& source, ContainerSetSlotPacket* packet);
|
||||
virtual void handle(const RakNet::RakNetGUID& source, ContainerClosePacket* packet);
|
||||
virtual void handle(const RakNet::RakNetGUID& source, SignUpdatePacket* packet);
|
||||
virtual void handle(const RakNet::RakNetGUID& source, ChatPacket* packet);
|
||||
|
||||
bool allowsIncomingConnections() { return _allowIncoming; }
|
||||
void allowIncomingConnections(bool doAllow);
|
||||
|
||||
Player* popPendingPlayer(const RakNet::RakNetGUID& source);
|
||||
|
||||
void displayGameMessage(const std::string& message);
|
||||
private:
|
||||
|
||||
void redistributePacket(Packet* packet, const RakNet::RakNetGUID& fromPlayer);
|
||||
void displayGameMessage(const std::string& message);
|
||||
|
||||
Player* getPlayer(const RakNet::RakNetGUID& source);
|
||||
private:
|
||||
|
||||
Minecraft* minecraft;
|
||||
Level* level;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
//package net.minecraft.network.packet;
|
||||
|
||||
#include "../Packet.h"
|
||||
#include <cstdint>
|
||||
|
||||
class SetTimePacket: public Packet {
|
||||
public:
|
||||
@@ -11,7 +12,7 @@ public:
|
||||
}
|
||||
|
||||
SetTimePacket(long time)
|
||||
: time(time)
|
||||
: time((int32_t)time)
|
||||
{}
|
||||
|
||||
void write(RakNet::BitStream* bitStream)
|
||||
@@ -30,7 +31,7 @@ public:
|
||||
callback->handle(source, (SetTimePacket*)this);
|
||||
}
|
||||
|
||||
long time;
|
||||
int32_t time;
|
||||
};
|
||||
|
||||
#endif /*NET_MINECRAFT_NETWORK_PACKET__SetTimePacket_H__*/
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
#define NET_MINECRAFT_NETWORK_PACKET__StartGamePacket_H__
|
||||
|
||||
#include "../Packet.h"
|
||||
#include <cstdint>
|
||||
|
||||
class StartGamePacket : public Packet
|
||||
{
|
||||
public:
|
||||
long levelSeed;
|
||||
int32_t levelSeed;
|
||||
int levelGeneratorVersion;
|
||||
int gameType;
|
||||
|
||||
@@ -18,7 +19,7 @@ public:
|
||||
}
|
||||
|
||||
StartGamePacket(long seed, int levelGeneratorVersion, int gameType, int entityId, float x, float y, float z)
|
||||
: levelSeed(seed),
|
||||
: levelSeed((int32_t)seed),
|
||||
levelGeneratorVersion(levelGeneratorVersion),
|
||||
gameType(gameType),
|
||||
entityId(entityId),
|
||||
|
||||
Reference in New Issue
Block a user