Merge pull request #3 from 4jcraft/leahs-dev-branch

more casting errors fixed
This commit is contained in:
DecalOverdose 2026-03-02 21:55:24 +04:00 committed by GitHub
commit 60b954cda3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 15 additions and 14 deletions

View file

@ -30,18 +30,18 @@ EntityActionAtPositionPacket::EntityActionAtPositionPacket(shared_ptr<Entity> e,
void EntityActionAtPositionPacket::read(DataInputStream *dis) //throws IOException
{
id = dis->readInt();
action = dis->readByte();
action = (int)dis->readByte();
x = dis->readInt();
y = dis->readByte();
y = (int)dis->readByte();
z = dis->readInt();
}
void EntityActionAtPositionPacket::write(DataOutputStream *dos) //throws IOException
{
dos->writeInt(id);
dos->writeByte(action);
dos->writeByte((std::byte)action);
dos->writeInt(x);
dos->writeByte(y);
dos->writeByte((std::byte)y);
dos->writeInt(z);
}

View file

@ -9,7 +9,7 @@
EntityEventPacket::EntityEventPacket()
{
entityId = 0;
eventId = 0;
eventId = (std::byte)0;
}
EntityEventPacket::EntityEventPacket(int entityId, byte eventId)

View file

@ -99,9 +99,9 @@ void ExplodePacket::write(DataOutputStream *dos) //throws IOException
int xx = tp.x-xp;
int yy = tp.y-yp;
int zz = tp.z-zp;
dos->writeByte(xx);
dos->writeByte(yy);
dos->writeByte(zz);
dos->writeByte((std::byte)xx);
dos->writeByte((std::byte)yy);
dos->writeByte((std::byte)zz);
}
}
@ -133,4 +133,4 @@ float ExplodePacket::getKnockbackY()
float ExplodePacket::getKnockbackZ()
{
return knockbackZ;
}
}

View file

@ -3,6 +3,7 @@
#include "PacketListener.h"
#include "BasicTypeContainers.h"
#include "GameCommandPacket.h"
#include "../Minecraft.Client/Windows64/Windows64_App.h"
GameCommandPacket::GameCommandPacket()
{
@ -69,4 +70,4 @@ void GameCommandPacket::handle(PacketListener *listener)
int GameCommandPacket::getEstimatedSize()
{
return 2 + 2 + length;
}
}

View file

@ -38,14 +38,14 @@ GameEventPacket::GameEventPacket(int _event, int param)
void GameEventPacket::read(DataInputStream *dis) //throws IOException
{
_event = dis->readByte();
param = dis->readByte();
_event = (int)dis->readByte();
param = (int)dis->readByte();
}
void GameEventPacket::write(DataOutputStream *dos) //throws IOException
{
dos->writeByte(_event);
dos->writeByte(param);
dos->writeByte((std::byte)_event);
dos->writeByte((std::byte)param);
}
void GameEventPacket::handle(PacketListener *listener)