diff options
| author | ModMaker101 <119018978+ModMaker101@users.noreply.github.com> | 2026-03-07 21:56:03 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-08 09:56:03 +0700 |
| commit | a9be52c41a02d207233199e98898fe7483d7e817 (patch) | |
| tree | 71dfaec3a86b05e9ca409b97d8eb9d7f993bfdd0 /Minecraft.World/AddMobPacket.cpp | |
| parent | 1be5faaea781402e7de06b263eeca4c688b7712c (diff) | |
Project modernization (#630)
* Fixed boats falling and a TP glitch #266
* Replaced every C-style cast with C++ ones
* Replaced every C-style cast with C++ ones
* Fixed boats falling and a TP glitch #266
* Updated NULL to nullptr and fixing some type issues
* Modernized and fixed a few bugs
- Replaced most instances of `NULL` with `nullptr`.
- Replaced most `shared_ptr(new ...)` with `make_shared`.
- Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances.
* Fixing more conflicts
* Replace int loops with size_t and start work on overrides
Diffstat (limited to 'Minecraft.World/AddMobPacket.cpp')
| -rw-r--r-- | Minecraft.World/AddMobPacket.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Minecraft.World/AddMobPacket.cpp b/Minecraft.World/AddMobPacket.cpp index 878e2ee7..d5ccfe08 100644 --- a/Minecraft.World/AddMobPacket.cpp +++ b/Minecraft.World/AddMobPacket.cpp @@ -17,7 +17,7 @@ AddMobPacket::AddMobPacket() yRot = 0; xRot = 0; entityData = nullptr; - unpack = NULL; + unpack = nullptr; } AddMobPacket::~AddMobPacket() @@ -29,7 +29,7 @@ AddMobPacket::AddMobPacket(shared_ptr<LivingEntity> mob, int yRotp, int xRotp, i { id = mob->entityId; - type = (byte) EntityIO::getId(mob); + type = static_cast<byte>(EntityIO::getId(mob)); // 4J Stu - We should add entities at their "last sent" position so that the relative update packets // put them in the correct place x = xp;//Mth::floor(mob->x * 32); @@ -54,14 +54,14 @@ AddMobPacket::AddMobPacket(shared_ptr<LivingEntity> mob, int yRotp, int xRotp, i if (xd > m) xd = m; if (yd > m) yd = m; if (zd > m) zd = m; - this->xd = (int) (xd * 8000.0); - this->yd = (int) (yd * 8000.0); - this->zd = (int) (zd * 8000.0); + this->xd = static_cast<int>(xd * 8000.0); + this->yd = static_cast<int>(yd * 8000.0); + this->zd = static_cast<int>(zd * 8000.0); // printf("%d: New add mob rot %d\n",id,yRot); entityData = mob->getEntityData(); - unpack = NULL; + unpack = nullptr; } void AddMobPacket::read(DataInputStream *dis) //throws IOException @@ -118,11 +118,11 @@ void AddMobPacket::handle(PacketListener *listener) int AddMobPacket::getEstimatedSize() { int size = 11; - if( entityData != NULL ) + if( entityData != nullptr ) { size += entityData->getSizeInBytes(); } - else if( unpack != NULL ) + else if( unpack != nullptr ) { // 4J Stu - This is an incoming value which we aren't currently analysing //size += unpack->get @@ -132,7 +132,7 @@ int AddMobPacket::getEstimatedSize() vector<shared_ptr<SynchedEntityData::DataItem> > *AddMobPacket::getUnpackedData() { - if (unpack == NULL) + if (unpack == nullptr) { unpack = entityData->getAll(); } |
