Revert " applied changes requested by tropicaaal"

This reverts commit 41d8202c47.

# Conflicts:
#	Minecraft.World/Network/Packets/MoveEntityPacket.cpp
This commit is contained in:
MathiewMay 2026-03-11 08:29:24 -04:00
parent 6c24d32a79
commit 702839176e
9 changed files with 64 additions and 65 deletions

View file

@ -1407,7 +1407,7 @@ void GameRenderer::renderLevel(float a, __int64 until)
#endif
PIXEndNamedEvent();
PIXBeginNamedEvent(0,"Particle render");
turnOnLightLayer(a); // 4J - brought forward from 1.8.2
//turnOnLightLayer(a); // 4J - brought forward from 1.8.2
particleEngine->renderLit(cameraEntity, a);
Lighting::turnOff();
setupFog(0, a);

View file

@ -69,24 +69,24 @@ MoveEntityPacket::PosRot::PosRot()
hasRot = true;
}
MoveEntityPacket::PosRot::PosRot(int id, int8_t xa, int8_t ya, int8_t za, int8_t yRot, int8_t xRot) : MoveEntityPacket( id )
MoveEntityPacket::PosRot::PosRot(int id, char xa, char ya, char za, char yRot, char xRot) : MoveEntityPacket( id )
{
this->xa = xa;
this->ya = ya;
this->za = za;
this->yRot = yRot;
this->xRot = xRot;
this->xa = (int)(signed char)xa;
this->ya = (int)(signed char)ya;
this->za = (int)(signed char)za;
this->yRot = (int)(signed char)yRot;
this->xRot = (int)(signed char)xRot;
hasRot = true;
}
void MoveEntityPacket::PosRot::read(DataInputStream *dis) //throws IOException
{
MoveEntityPacket::read(dis);
xa = (int8_t)dis->readByte();
ya = (int8_t)dis->readByte();
za = (int8_t)dis->readByte();
yRot = (int8_t)dis->readByte();
xRot = (int8_t)dis->readByte();
xa = (int)(signed char)dis->readByte();
ya = (int)(signed char)dis->readByte();
za = (int)(signed char)dis->readByte();
yRot = (int)(signed char)dis->readByte();
xRot = (int)(signed char)dis->readByte();
}
void MoveEntityPacket::PosRot::write(DataOutputStream *dos) //throws IOException
@ -108,7 +108,7 @@ MoveEntityPacket::Pos::Pos()
{
}
MoveEntityPacket::Pos::Pos(int id, int8_t xa, int8_t ya, int8_t za) : MoveEntityPacket(id)
MoveEntityPacket::Pos::Pos(int id, char xa, char ya, char za) : MoveEntityPacket(id)
{
this->xa = xa;
this->ya = ya;
@ -118,9 +118,9 @@ MoveEntityPacket::Pos::Pos(int id, int8_t xa, int8_t ya, int8_t za) : MoveEntity
void MoveEntityPacket::Pos::read(DataInputStream *dis) //throws IOException
{
MoveEntityPacket::read(dis);
xa = (int8_t)dis->readByte();
ya = (int8_t)dis->readByte();
za = (int8_t)dis->readByte();
xa = (int)(signed char)dis->readByte();
ya = (int)(signed char)dis->readByte();
za = (int)(signed char)dis->readByte();
}
void MoveEntityPacket::Pos::write(DataOutputStream *dos) //throws IOException
@ -141,7 +141,7 @@ MoveEntityPacket::Rot::Rot()
hasRot = true;
}
MoveEntityPacket::Rot::Rot(int id, int8_t yRot, int8_t xRot) : MoveEntityPacket(id)
MoveEntityPacket::Rot::Rot(int id, char yRot, char xRot) : MoveEntityPacket(id)
{
this->yRot = yRot;
this->xRot = xRot;
@ -151,8 +151,8 @@ MoveEntityPacket::Rot::Rot(int id, int8_t yRot, int8_t xRot) : MoveEntityPacket(
void MoveEntityPacket::Rot::read(DataInputStream *dis) //throws IOException
{
MoveEntityPacket::read(dis);
yRot = (int8_t)dis->readByte();
xRot = (int8_t)dis->readByte();
yRot = (int)(signed char)dis->readByte();
xRot = (int)(signed char)dis->readByte();
}
void MoveEntityPacket::Rot::write(DataOutputStream *dos) //throws IOException

View file

@ -13,7 +13,7 @@ public:
class Rot;
int id;
int8_t xa, ya, za, yRot, xRot;
char xa, ya, za, yRot, xRot;
bool hasRot;
MoveEntityPacket();
@ -35,7 +35,7 @@ class MoveEntityPacket::PosRot : public MoveEntityPacket
{
public:
PosRot();
PosRot(int id, int8_t xa, int8_t ya, int8_t za, int8_t yRot, int8_t xRot);
PosRot(int id, char xa, char ya, char za, char yRot, char xRot);
virtual void read(DataInputStream *dis);
virtual void write(DataOutputStream *dos);
@ -50,7 +50,7 @@ class MoveEntityPacket::Pos : public MoveEntityPacket
{
public:
Pos();
Pos(int id, int8_t xa, int8_t ya, int8_t za);
Pos(int id, char xa, char ya, char za);
virtual void read(DataInputStream *dis);
virtual void write(DataOutputStream *dos);
@ -65,7 +65,7 @@ class MoveEntityPacket::Rot : public MoveEntityPacket
{
public:
Rot();
Rot(int id, int8_t yRot, int8_t xRot);
Rot(int id, char yRot, char xRot);
virtual void read(DataInputStream *dis);
virtual void write(DataOutputStream *dos);

View file

@ -1,6 +1,5 @@
#include "../../Platform/stdafx.h"
#include <iostream>
#include <limits>
#include "../../IO/Streams/InputOutputStream.h"
#include "PacketListener.h"
#include "MoveEntityPacketSmall.h"
@ -32,7 +31,7 @@ void MoveEntityPacketSmall::read(DataInputStream *dis) //throws IOException
void MoveEntityPacketSmall::write(DataOutputStream *dos) //throws IOException
{
if(id < 0 || id > std::numeric_limits<int16_t>::max() )
if(id < 0 || id > 32767 )
{
// We shouln't be tracking an entity that doesn't have a short type of id
__debugbreak();
@ -66,7 +65,7 @@ MoveEntityPacketSmall::PosRot::PosRot()
hasRot = true;
}
MoveEntityPacketSmall::PosRot::PosRot(int id, int8_t xa, int8_t ya, int8_t za, int8_t yRot, int8_t xRot) : MoveEntityPacketSmall( id )
MoveEntityPacketSmall::PosRot::PosRot(int id, char xa, char ya, char za, char yRot, char xRot) : MoveEntityPacketSmall( id )
{
this->xa = xa;
this->ya = ya;
@ -78,22 +77,22 @@ MoveEntityPacketSmall::PosRot::PosRot(int id, int8_t xa, int8_t ya, int8_t za, i
void MoveEntityPacketSmall::PosRot::read(DataInputStream *dis) //throws IOException
{
MoveEntityPacketSmall::read(dis);
xa = (int8_t)dis->readByte();
ya = (int8_t)dis->readByte();
za = (int8_t)dis->readByte();
yRot = (int8_t)dis->readByte();
xRot = (int8_t)dis->readByte();
MoveEntityPacketSmall::read(dis);
xa = (signed char)dis->readByte();
ya = (signed char)dis->readByte();
za = (signed char)dis->readByte();
yRot = (signed char)dis->readByte();
xRot = (signed char)dis->readByte();
}
void MoveEntityPacketSmall::PosRot::write(DataOutputStream *dos) //throws IOException
{
MoveEntityPacketSmall::write(dos);
dos->writeByte((uint8_t)(xa & 0xFF));
dos->writeByte((uint8_t)(ya & 0xFF));
dos->writeByte((uint8_t)(za & 0xFF));
dos->writeByte((uint8_t)(yRot & 0xFF));
dos->writeByte((uint8_t)(xRot & 0xFF));
MoveEntityPacketSmall::write(dos);
dos->writeByte((uint8_t)(xa & 0xFF));
dos->writeByte((uint8_t)(ya & 0xFF));
dos->writeByte((uint8_t)(za & 0xFF));
dos->writeByte((uint8_t)(yRot & 0xFF));
dos->writeByte((uint8_t)(xRot & 0xFF));
}
int MoveEntityPacketSmall::PosRot::getEstimatedSize()
@ -105,7 +104,7 @@ MoveEntityPacketSmall::Pos::Pos()
{
}
MoveEntityPacketSmall::Pos::Pos(int id, int8_t xa, int8_t ya, int8_t za) : MoveEntityPacketSmall(id)
MoveEntityPacketSmall::Pos::Pos(int id, char xa, char ya, char za) : MoveEntityPacketSmall(id)
{
this->xa = xa;
this->ya = ya;
@ -114,10 +113,10 @@ MoveEntityPacketSmall::Pos::Pos(int id, int8_t xa, int8_t ya, int8_t za) : MoveE
void MoveEntityPacketSmall::Pos::read(DataInputStream *dis) //throws IOException
{
MoveEntityPacketSmall::read(dis);
xa = (int8_t)dis->readByte();
ya = (int8_t)dis->readByte();
za = (int8_t)dis->readByte();
MoveEntityPacketSmall::read(dis);
xa = (signed char)dis->readByte();
ya = (signed char)dis->readByte();
za = (signed char)dis->readByte();
}
void MoveEntityPacketSmall::Pos::write(DataOutputStream *dos) //throws IOException
@ -138,7 +137,7 @@ MoveEntityPacketSmall::Rot::Rot()
hasRot = true;
}
MoveEntityPacketSmall::Rot::Rot(int id, int8_t yRot, int8_t xRot) : MoveEntityPacketSmall(id)
MoveEntityPacketSmall::Rot::Rot(int id, char yRot, char xRot) : MoveEntityPacketSmall(id)
{
this->yRot = yRot;
@ -148,8 +147,8 @@ MoveEntityPacketSmall::Rot::Rot(int id, int8_t yRot, int8_t xRot) : MoveEntityPa
void MoveEntityPacketSmall::Rot::read(DataInputStream *dis) //throws IOException
{
MoveEntityPacketSmall::read(dis);
yRot = (int8_t)dis->readByte();
MoveEntityPacketSmall::read(dis);
yRot = (signed char)dis->readByte();
}
void MoveEntityPacketSmall::Rot::write(DataOutputStream *dos) //throws IOException

View file

@ -13,8 +13,8 @@ public:
class Rot;
int id;
int8_t xa, ya, za, yRot, xRot;
bool hasRot;
char xa, ya, za, yRot, xRot;
bool hasRot;
MoveEntityPacketSmall();
MoveEntityPacketSmall(int id);
@ -34,8 +34,8 @@ public:
class MoveEntityPacketSmall::PosRot : public MoveEntityPacketSmall
{
public:
PosRot();
PosRot(int id, int8_t xa, int8_t ya, int8_t za, int8_t yRot, int8_t xRot);
PosRot();
PosRot(int id, char xa, char ya, char za, char yRot, char xRot);
virtual void read(DataInputStream *dis);
virtual void write(DataOutputStream *dos);
@ -50,7 +50,7 @@ class MoveEntityPacketSmall::Pos : public MoveEntityPacketSmall
{
public:
Pos();
Pos(int id, int8_t xa, int8_t ya, int8_t za);
Pos(int id, char xa, char ya, char za);
virtual void read(DataInputStream *dis);
virtual void write(DataOutputStream *dos);
@ -66,7 +66,7 @@ class MoveEntityPacketSmall::Rot : public MoveEntityPacketSmall
{
public:
Rot();
Rot(int id, int8_t yRot, int8_t xRot);
Rot(int id, char yRot, char xRot);
virtual void read(DataInputStream *dis);
virtual void write(DataOutputStream *dos);

View file

@ -17,9 +17,9 @@ void SetEntityMotionPacket::_init(int id, double xd, double yd, double zd)
if (xd > m) xd = m;
if (yd > m) yd = m;
if (zd > m) zd = m;
xa = (int16_t) (xd * 8000.0);
ya = (int16_t) (yd * 8000.0);
za = (int16_t) (zd * 8000.0);
xa = (int) (xd * 8000.0);
ya = (int) (yd * 8000.0);
za = (int) (zd * 8000.0);
useBytes = false;
}

View file

@ -7,7 +7,7 @@ class SetEntityMotionPacket : public Packet, public std::enable_shared_from_this
{
public:
int id;
int16_t xa, ya, za;
int xa, ya, za;
bool useBytes; // 4J added
private:

View file

@ -17,7 +17,7 @@ TeleportEntityPacket::TeleportEntityPacket()
xRot = 0;
}
TeleportEntityPacket::TeleportEntityPacket(std::shared_ptr<Entity> e)
TeleportEntityPacket::TeleportEntityPacket(std::shared_ptr<Entity> e)
{
id = e->entityId;
x = Mth::floor(e->x * 32);
@ -27,7 +27,7 @@ TeleportEntityPacket::TeleportEntityPacket(std::shared_ptr<Entity> e)
xRot = (uint8_t) (e->xRot * 256 / 360);
}
TeleportEntityPacket::TeleportEntityPacket(int id, int32_t x, int32_t y, int32_t z, uint8_t yRot, uint8_t xRot)
TeleportEntityPacket::TeleportEntityPacket(int id, int x, int y, int z, uint8_t yRot, uint8_t xRot)
{
this->id = id;
this->x = x;
@ -53,7 +53,7 @@ void TeleportEntityPacket::read(DataInputStream *dis) //throws IOException
xRot = (uint8_t) dis->read();
}
void TeleportEntityPacket::write(DataOutputStream *dos) //throws IOException
void TeleportEntityPacket::write(DataOutputStream *dos) //throws IOException
{
dos->writeShort((short)id);
dos->writeInt(x);
@ -63,12 +63,12 @@ void TeleportEntityPacket::write(DataOutputStream *dos) //throws IOException
dos->write(xRot);
}
void TeleportEntityPacket::handle(PacketListener *listener)
void TeleportEntityPacket::handle(PacketListener *listener)
{
listener->handleTeleportEntity(shared_from_this());
}
int TeleportEntityPacket::getEstimatedSize()
int TeleportEntityPacket::getEstimatedSize()
{
return 2 + 2 + 2 + 2 + 1 + 1;
}

View file

@ -7,19 +7,19 @@ class TeleportEntityPacket : public Packet, public std::enable_shared_from_this<
{
public:
int id;
int32_t x, y, z;
uint8_t yRot, xRot;
int x, y, z;
uint8_t yRot, xRot;
TeleportEntityPacket();
TeleportEntityPacket(std::shared_ptr<Entity> e);
TeleportEntityPacket(int id, int32_t x, int32_t y, int32_t z, uint8_t yRot, uint8_t xRot);
TeleportEntityPacket(int id, int x, int y, int z, uint8_t yRot, uint8_t xRot);
virtual void read(DataInputStream *dis);
virtual void write(DataOutputStream *dos);
virtual void handle(PacketListener *listener);
virtual int getEstimatedSize();
virtual bool canBeInvalidated();
virtual bool isInvalidatedBy(std::shared_ptr<Packet> packet);
virtual bool isInvalidatedBy(std::shared_ptr<Packet> packet);
public:
static std::shared_ptr<Packet> create() { return std::shared_ptr<Packet>(new TeleportEntityPacket()); }