mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-27 23:53:38 +00:00
TU19: fix build fallout across Client, World, NBT and Network
This commit is contained in:
parent
d9aa793075
commit
91b13bccee
|
|
@ -1,10 +1,12 @@
|
|||
#pragma once
|
||||
#include "../../Minecraft.World/Headers/net.minecraft.network.h"
|
||||
|
||||
class Minecraft;
|
||||
class MultiPlayerLevel;
|
||||
class SavedDataStorage;
|
||||
class Socket;
|
||||
class MultiplayerLocalPlayer;
|
||||
class SetRidingPacket;
|
||||
|
||||
class ClientConnection : public PacketListener {
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
#pragma once
|
||||
#include "TileEntities/EntityTile.h"
|
||||
#include "BaseEntityTile.h"
|
||||
#include <cstdint>
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
class IconRegister;
|
||||
|
||||
class TheEndPortal : public BaseEntityTile {
|
||||
public:
|
||||
#if defined(_WIN32)
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public:
|
|||
return std::wstring(buf);
|
||||
}
|
||||
|
||||
void print(char* prefix, std::ostream out) {
|
||||
void print(char* prefix, std::wostream& out) {
|
||||
Tag::print(prefix, out);
|
||||
|
||||
out << prefix << "{" << std::endl;
|
||||
|
|
@ -62,8 +62,9 @@ public:
|
|||
strcpy(newPrefix, prefix);
|
||||
strcat(newPrefix, " ");
|
||||
AUTO_VAR(itEnd, list.end());
|
||||
for (AUTO_VAR(it, list.begin()); it != itEnd; it++)
|
||||
for (AUTO_VAR(it, list.begin()); it != itEnd; it++) {
|
||||
(*it)->print(newPrefix, out);
|
||||
}
|
||||
delete[] newPrefix;
|
||||
out << prefix << "}" << std::endl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@ bool Tag::equals(Tag* obj) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void Tag::print(std::ostream out) { out << ""; }
|
||||
void Tag::print(std::ostream& out) { out << ""; }
|
||||
|
||||
void Tag::print(char* prefix, std::wostream out) {
|
||||
void Tag::print(char* prefix, std::wostream& out) {
|
||||
std::wstring name = getName();
|
||||
|
||||
out << prefix;
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ public:
|
|||
virtual void load(DataInput* dis, int tagDepth) = 0;
|
||||
virtual std::wstring toString() = 0;
|
||||
virtual uint8_t getId() = 0;
|
||||
void print(std::ostream out);
|
||||
void print(char* prefix, std::wostream out);
|
||||
void print(std::ostream& out);
|
||||
void print(char* prefix, std::wostream& out);
|
||||
std::wstring getName();
|
||||
Tag* setName(const std::wstring& name);
|
||||
static Tag* readNamedTag(DataInput* dis);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "../../Platform/stdafx.h"
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include "../../IO/Streams/InputOutputStream.h"
|
||||
#include "../../Headers/net.minecraft.world.entity.player.h"
|
||||
|
|
@ -44,9 +43,9 @@ AddPlayerPacket::AddPlayerPacket(std::shared_ptr<Player> player, PlayerUID xuid,
|
|||
// this in sync with other clients
|
||||
yRot = yRotp;
|
||||
xRot = xRotp;
|
||||
yHeadRot = static_cast<std::uint8_t>(yHeadRotp); // 4J Added
|
||||
// yRot = (std::uint8_t) (player->yRot * 256 / 360);
|
||||
// xRot = (std::uint8_t) (player->xRot * 256 / 360);
|
||||
yHeadRot = yHeadRotp; // 4J Added
|
||||
// yRot = (byte) (player->yRot * 256 / 360);
|
||||
// xRot = (byte) (player->xRot * 256 / 360);
|
||||
|
||||
// printf("%d: New add player (%f,%f,%f) : (%d,%d,%d) : xRot %d, yRot
|
||||
// %d\n",id,player->x,player->y,player->z,x,y,z,xRot,yRot);
|
||||
|
|
@ -57,7 +56,7 @@ AddPlayerPacket::AddPlayerPacket(std::shared_ptr<Player> player, PlayerUID xuid,
|
|||
|
||||
this->xuid = xuid;
|
||||
this->OnlineXuid = OnlineXuid;
|
||||
m_playerIndex = static_cast<std::uint8_t>(player->getPlayerIndex());
|
||||
m_playerIndex = (BYTE)player->getPlayerIndex();
|
||||
m_skinId = player->getCustomSkin();
|
||||
m_capeId = player->getCustomCape();
|
||||
m_uiGamePrivileges = player->getAllPlayerGamePrivileges();
|
||||
|
|
@ -73,17 +72,19 @@ void AddPlayerPacket::read(DataInputStream* dis) // throws IOException
|
|||
x = dis->readInt();
|
||||
y = dis->readInt();
|
||||
z = dis->readInt();
|
||||
yRot = static_cast<char>(dis->readByte());
|
||||
xRot = static_cast<char>(dis->readByte());
|
||||
yRot = dis->readByte();
|
||||
xRot = dis->readByte();
|
||||
yHeadRot = dis->readByte(); // 4J Added
|
||||
carriedItem = dis->readShort();
|
||||
xuid = dis->readPlayerUID();
|
||||
OnlineXuid = dis->readPlayerUID();
|
||||
m_playerIndex = dis->readByte();
|
||||
m_skinId = static_cast<std::uint32_t>(dis->readInt());
|
||||
m_capeId = static_cast<std::uint32_t>(dis->readInt());
|
||||
int privileges = dis->readInt();
|
||||
m_uiGamePrivileges = static_cast<unsigned int>(privileges);
|
||||
INT skinId = dis->readInt();
|
||||
m_skinId = *(DWORD*)&skinId;
|
||||
INT capeId = dis->readInt();
|
||||
m_capeId = *(DWORD*)&capeId;
|
||||
INT privileges = dis->readInt();
|
||||
m_uiGamePrivileges = *(unsigned int*)&privileges;
|
||||
MemSect(1);
|
||||
unpack = SynchedEntityData::unpack(dis);
|
||||
MemSect(0);
|
||||
|
|
@ -98,13 +99,13 @@ void AddPlayerPacket::write(DataOutputStream* dos) // throws IOException
|
|||
dos->writeInt(z);
|
||||
dos->writeByte(static_cast<std::uint8_t>(yRot));
|
||||
dos->writeByte(static_cast<std::uint8_t>(xRot));
|
||||
dos->writeByte(static_cast<std::uint8_t>(m_playerIndex)); // 4J Added
|
||||
dos->writeByte(static_cast<std::uint8_t>(yHeadRot)); // 4J Added
|
||||
dos->writeShort(carriedItem);
|
||||
dos->writePlayerUID(xuid);
|
||||
dos->writePlayerUID(OnlineXuid);
|
||||
dos->writeByte(static_cast<std::uint8_t>(m_playerIndex)); // 4J Added
|
||||
dos->writeInt(static_cast<int>(m_skinId));
|
||||
dos->writeInt(static_cast<int>(m_capeId));
|
||||
dos->writeByte(static_cast<std::uint8_t>(m_playerIndex));
|
||||
dos->writeInt(m_skinId);
|
||||
dos->writeInt(m_capeId);
|
||||
dos->writeInt(m_uiGamePrivileges);
|
||||
entityData->packAll(dos);
|
||||
}
|
||||
|
|
@ -115,10 +116,10 @@ void AddPlayerPacket::handle(PacketListener* listener) {
|
|||
|
||||
int AddPlayerPacket::getEstimatedSize() {
|
||||
int iSize = sizeof(int) + Player::MAX_NAME_LENGTH + sizeof(int) +
|
||||
sizeof(int) + sizeof(int) + sizeof(std::uint8_t) +
|
||||
sizeof(std::uint8_t) + sizeof(short) + sizeof(PlayerUID) +
|
||||
sizeof(PlayerUID) + sizeof(int) + sizeof(std::uint8_t) +
|
||||
sizeof(unsigned int) + sizeof(std::uint8_t);
|
||||
sizeof(int) + sizeof(int) + sizeof(BYTE) + sizeof(BYTE) +
|
||||
sizeof(short) + sizeof(PlayerUID) + sizeof(PlayerUID) +
|
||||
sizeof(int) + sizeof(BYTE) + sizeof(unsigned int) +
|
||||
sizeof(uint8_t);
|
||||
|
||||
if (entityData != NULL) {
|
||||
iSize += entityData->getSizeInBytes();
|
||||
|
|
|
|||
|
|
@ -12,30 +12,34 @@ LevelEventPacket::LevelEventPacket() {
|
|||
z = 0;
|
||||
}
|
||||
|
||||
LevelEventPacket::LevelEventPacket(int type, int x, int y, int z, int data) {
|
||||
LevelEventPacket::LevelEventPacket(int type, int x, int y, int z, int data,
|
||||
bool globalEvent) {
|
||||
this->type = type;
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->z = z;
|
||||
this->data = data;
|
||||
this->globalEvent = globalEvent;
|
||||
}
|
||||
|
||||
void LevelEventPacket::read(DataInputStream* dis) // throws IOException
|
||||
{
|
||||
type = dis->readInt();
|
||||
x = dis->readInt();
|
||||
y = (int)(dis->readByte() & (uint8_t)0xff);
|
||||
y = dis->readByte() & 0xff;
|
||||
z = dis->readInt();
|
||||
data = dis->readInt();
|
||||
globalEvent = dis->readBoolean();
|
||||
}
|
||||
|
||||
void LevelEventPacket::write(DataOutputStream* dos) // throws IOException
|
||||
{
|
||||
dos->writeInt(type);
|
||||
dos->writeInt(x);
|
||||
dos->writeByte((uint8_t)(y & 0xff));
|
||||
dos->writeByte(y & 0xff);
|
||||
dos->writeInt(z);
|
||||
dos->writeInt(data);
|
||||
dos->writeBoolean(globalEvent);
|
||||
}
|
||||
|
||||
void LevelEventPacket::handle(PacketListener* listener) {
|
||||
|
|
@ -43,3 +47,5 @@ void LevelEventPacket::handle(PacketListener* listener) {
|
|||
}
|
||||
|
||||
int LevelEventPacket::getEstimatedSize() { return 4 * 5 + 1; }
|
||||
|
||||
bool LevelEventPacket::isGlobalEvent() { return globalEvent; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue