chore: Merge branch 'leahs-dev-branch' of https://github.com/ThePixelMoon/4jcraft into leahs-dev-branch

This commit is contained in:
Mohamed Ashraf 2026-03-02 22:36:16 +04:00
commit 19da56305e
7 changed files with 39 additions and 39 deletions

View file

@ -3,7 +3,7 @@
#include "InputOutputStream.h"
#include "PacketListener.h"
#include "GameEventPacket.h"
#include "../Minecraft.Client/PS3Media/strings.h"
const int GameEventPacket::NO_RESPAWN_BED_AVAILABLE = 0;

View file

@ -27,14 +27,14 @@ void InteractPacket::read(DataInputStream *dis) //throws IOException
{
source = dis->readInt();
target = dis->readInt();
action = dis->readByte();
action = (int)dis->readByte();
}
void InteractPacket::write(DataOutputStream *dos) // throws IOException
{
dos->writeInt(source);
dos->writeInt(target);
dos->writeByte(action);
dos->writeByte((std::byte)action);
}
void InteractPacket::handle(PacketListener *listener)

View file

@ -23,12 +23,12 @@ void KickPlayerPacket::handle(PacketListener *listener)
void KickPlayerPacket::read(DataInputStream *dis) //throws IOException
{
m_networkSmallId = dis->readByte();
m_networkSmallId = (int)dis->readByte();
}
void KickPlayerPacket::write(DataOutputStream *dos) //throws IOException
{
dos->writeByte(m_networkSmallId);
dos->writeByte((std::byte)m_networkSmallId);
}
int KickPlayerPacket::getEstimatedSize()

View file

@ -28,7 +28,7 @@ void LevelEventPacket::read(DataInputStream *dis) //throws IOException
{
type = dis->readInt();
x = dis->readInt();
y = dis->readByte() & 0xff;
y = (int)(dis->readByte() & (std::byte)0xff);
z = dis->readInt();
data = dis->readInt();
}
@ -37,7 +37,7 @@ void LevelEventPacket::write(DataOutputStream *dos) //throws IOException
{
dos->writeInt(type);
dos->writeInt(x);
dos->writeByte(y & 0xff);
dos->writeByte((std::byte)(y & 0xff));
dos->writeInt(z);
dos->writeInt(data);
}

View file

@ -5,7 +5,7 @@
#include "PacketListener.h"
#include "LoginPacket.h"
#include "LevelType.h"
#include "../Minecraft.Client/Windows64/Windows64_App.h"
LoginPacket::LoginPacket()
@ -106,16 +106,16 @@ void LoginPacket::read(DataInputStream *dis) //throws IOException
}
seed = dis->readLong();
gameType = dis->readInt();
dimension = dis->readByte();
mapHeight = dis->readByte();
maxPlayers = dis->readByte();
dimension = (int)dis->readByte();
mapHeight = (int)dis->readByte();
maxPlayers = (int)dis->readByte();
m_offlineXuid = dis->readPlayerUID();
m_onlineXuid = dis->readPlayerUID();
m_friendsOnlyUGC = dis->readBoolean();
m_ugcPlayersVersion = dis->readInt();
difficulty = dis->readByte();
difficulty = (int)dis->readByte();
m_multiplayerInstanceId = dis->readInt();
m_playerIndex = dis->readByte();
m_playerIndex = (int)dis->readByte();
INT skinId = dis->readInt();
m_playerSkinId = *(DWORD *)&skinId;
INT capeId = dis->readInt();
@ -145,16 +145,16 @@ void LoginPacket::write(DataOutputStream *dos) //throws IOException
}
dos->writeLong(seed);
dos->writeInt(gameType);
dos->writeByte(dimension);
dos->writeByte(mapHeight);
dos->writeByte(maxPlayers);
dos->writeByte((std::byte)dimension);
dos->writeByte((std::byte)mapHeight);
dos->writeByte((std::byte)maxPlayers);
dos->writePlayerUID(m_offlineXuid);
dos->writePlayerUID(m_onlineXuid);
dos->writeBoolean(m_friendsOnlyUGC);
dos->writeInt(m_ugcPlayersVersion);
dos->writeByte(difficulty);
dos->writeByte((std::byte)difficulty);
dos->writeInt(m_multiplayerInstanceId);
dos->writeByte(m_playerIndex);
dos->writeByte((std::byte)m_playerIndex);
dos->writeInt(m_playerSkinId);
dos->writeInt(m_playerCapeId);
dos->writeBoolean(m_isGuest);

View file

@ -82,21 +82,21 @@ MoveEntityPacket::PosRot::PosRot(int id, char xa, char ya, char za, char yRot, c
void MoveEntityPacket::PosRot::read(DataInputStream *dis) //throws IOException
{
MoveEntityPacket::read(dis);
xa = dis->readByte();
ya = dis->readByte();
za = dis->readByte();
yRot = dis->readByte();
xRot = dis->readByte();
xa = (int)dis->readByte();
ya = (int)dis->readByte();
za = (int)dis->readByte();
yRot = (int)dis->readByte();
xRot = (int)dis->readByte();
}
void MoveEntityPacket::PosRot::write(DataOutputStream *dos) //throws IOException
{
MoveEntityPacket::write(dos);
dos->writeByte(xa);
dos->writeByte(ya);
dos->writeByte(za);
dos->writeByte(yRot);
dos->writeByte(xRot);
dos->writeByte((std::byte)xa);
dos->writeByte((std::byte)ya);
dos->writeByte((std::byte)za);
dos->writeByte((std::byte)yRot);
dos->writeByte((std::byte)xRot);
}
int MoveEntityPacket::PosRot::getEstimatedSize()
@ -118,17 +118,17 @@ MoveEntityPacket::Pos::Pos(int id, char xa, char ya, char za) : MoveEntityPacket
void MoveEntityPacket::Pos::read(DataInputStream *dis) //throws IOException
{
MoveEntityPacket::read(dis);
xa = dis->readByte();
ya = dis->readByte();
za = dis->readByte();
xa = (int)dis->readByte();
ya = (int)dis->readByte();
za = (int)dis->readByte();
}
void MoveEntityPacket::Pos::write(DataOutputStream *dos) //throws IOException
{
MoveEntityPacket::write(dos);
dos->writeByte(xa);
dos->writeByte(ya);
dos->writeByte(za);
dos->writeByte((std::byte)xa);
dos->writeByte((std::byte)ya);
dos->writeByte((std::byte)za);
}
int MoveEntityPacket::Pos::getEstimatedSize()
@ -151,15 +151,15 @@ MoveEntityPacket::Rot::Rot(int id, char yRot, char xRot) : MoveEntityPacket(id)
void MoveEntityPacket::Rot::read(DataInputStream *dis) //throws IOException
{
MoveEntityPacket::read(dis);
yRot = dis->readByte();
xRot = dis->readByte();
yRot = (int)dis->readByte();
xRot = (int)dis->readByte();
}
void MoveEntityPacket::Rot::write(DataOutputStream *dos) //throws IOException
{
MoveEntityPacket::write(dos);
dos->writeByte(yRot);
dos->writeByte(xRot);
dos->writeByte((std::byte)yRot);
dos->writeByte((std::byte)xRot);
}
int MoveEntityPacket::Rot::getEstimatedSize()

View file

@ -146,7 +146,7 @@ void MoveEntityPacketSmall::Pos::write(DataOutputStream *dos) //throws IOExcepti
short idAndY = id | ya << 11;
dos->writeShort(idAndY);
char XandZ = ( xa << 4 ) | ( za & 0x0f );
dos->writeByte(XandZ);
dos->writeByte((std::byte)XandZ);
}
int MoveEntityPacketSmall::Pos::getEstimatedSize()