Remove BYTE from mob effect packets

This commit is contained in:
notmatthewbeshay 2026-03-10 07:53:04 +11:00
parent 97d12ae2d8
commit 3da761347f
2 changed files with 5 additions and 4 deletions

View file

@ -17,7 +17,7 @@ UpdateMobEffectPacket::UpdateMobEffectPacket()
UpdateMobEffectPacket::UpdateMobEffectPacket(int entityId, MobEffectInstance *effect) UpdateMobEffectPacket::UpdateMobEffectPacket(int entityId, MobEffectInstance *effect)
{ {
this->entityId = entityId; this->entityId = entityId;
this->effectId = (BYTE) (effect->getId() & 0xff); this->effectId = static_cast<std::uint8_t>(effect->getId() & 0xff);
this->effectAmplifier = (char) (effect->getAmplifier() & 0xff); this->effectAmplifier = (char) (effect->getAmplifier() & 0xff);
this->effectDurationTicks = (short) effect->getDuration(); this->effectDurationTicks = (short) effect->getDuration();
} }
@ -57,4 +57,4 @@ bool UpdateMobEffectPacket::isInvalidatedBy(std::shared_ptr<Packet> packet)
{ {
std::shared_ptr<UpdateMobEffectPacket> target = std::dynamic_pointer_cast<UpdateMobEffectPacket>(packet); std::shared_ptr<UpdateMobEffectPacket> target = std::dynamic_pointer_cast<UpdateMobEffectPacket>(packet);
return target->entityId == entityId && target->effectId == effectId; return target->entityId == entityId && target->effectId == effectId;
} }

View file

@ -1,4 +1,5 @@
#pragma once #pragma once
#include <cstdint>
#include "Packet.h" #include "Packet.h"
@ -8,7 +9,7 @@ class UpdateMobEffectPacket : public Packet, public std::enable_shared_from_this
{ {
public: public:
int entityId; int entityId;
BYTE effectId; std::uint8_t effectId;
char effectAmplifier; char effectAmplifier;
short effectDurationTicks; short effectDurationTicks;
@ -25,4 +26,4 @@ public:
public: public:
static std::shared_ptr<Packet> create() { return std::shared_ptr<Packet>(new UpdateMobEffectPacket()); } static std::shared_ptr<Packet> create() { return std::shared_ptr<Packet>(new UpdateMobEffectPacket()); }
virtual int getId() { return 41; } virtual int getId() { return 41; }
}; };