mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-05-26 03:46:28 +00:00
chore: format Minecraft.World
This commit is contained in:
@@ -4,57 +4,45 @@
|
||||
#include "PacketListener.h"
|
||||
#include "UpdateMobEffectPacket.h"
|
||||
|
||||
|
||||
|
||||
UpdateMobEffectPacket::UpdateMobEffectPacket()
|
||||
{
|
||||
this->entityId = 0;
|
||||
this->effectId = 0;
|
||||
this->effectAmplifier = 0;
|
||||
this->effectDurationTicks = 0;
|
||||
UpdateMobEffectPacket::UpdateMobEffectPacket() {
|
||||
this->entityId = 0;
|
||||
this->effectId = 0;
|
||||
this->effectAmplifier = 0;
|
||||
this->effectDurationTicks = 0;
|
||||
}
|
||||
|
||||
UpdateMobEffectPacket::UpdateMobEffectPacket(int entityId, MobEffectInstance *effect)
|
||||
{
|
||||
this->entityId = entityId;
|
||||
this->effectId = static_cast<std::uint8_t>(effect->getId() & 0xff);
|
||||
this->effectAmplifier = (char) (effect->getAmplifier() & 0xff);
|
||||
this->effectDurationTicks = (short) effect->getDuration();
|
||||
UpdateMobEffectPacket::UpdateMobEffectPacket(int entityId,
|
||||
MobEffectInstance* effect) {
|
||||
this->entityId = entityId;
|
||||
this->effectId = static_cast<std::uint8_t>(effect->getId() & 0xff);
|
||||
this->effectAmplifier = (char)(effect->getAmplifier() & 0xff);
|
||||
this->effectDurationTicks = (short)effect->getDuration();
|
||||
}
|
||||
|
||||
void UpdateMobEffectPacket::read(DataInputStream *dis)
|
||||
{
|
||||
entityId = dis->readInt();
|
||||
effectId = dis->readByte();
|
||||
effectAmplifier = dis->readByte();
|
||||
effectDurationTicks = dis->readShort();
|
||||
void UpdateMobEffectPacket::read(DataInputStream* dis) {
|
||||
entityId = dis->readInt();
|
||||
effectId = dis->readByte();
|
||||
effectAmplifier = dis->readByte();
|
||||
effectDurationTicks = dis->readShort();
|
||||
}
|
||||
|
||||
void UpdateMobEffectPacket::write(DataOutputStream *dos)
|
||||
{
|
||||
dos->writeInt(entityId);
|
||||
dos->writeByte(effectId);
|
||||
dos->writeByte(effectAmplifier);
|
||||
dos->writeShort(effectDurationTicks);
|
||||
void UpdateMobEffectPacket::write(DataOutputStream* dos) {
|
||||
dos->writeInt(entityId);
|
||||
dos->writeByte(effectId);
|
||||
dos->writeByte(effectAmplifier);
|
||||
dos->writeShort(effectDurationTicks);
|
||||
}
|
||||
|
||||
void UpdateMobEffectPacket::handle(PacketListener *listener)
|
||||
{
|
||||
listener->handleUpdateMobEffect(shared_from_this());
|
||||
void UpdateMobEffectPacket::handle(PacketListener* listener) {
|
||||
listener->handleUpdateMobEffect(shared_from_this());
|
||||
}
|
||||
|
||||
int UpdateMobEffectPacket::getEstimatedSize()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
int UpdateMobEffectPacket::getEstimatedSize() { return 8; }
|
||||
|
||||
bool UpdateMobEffectPacket::canBeInvalidated()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool UpdateMobEffectPacket::canBeInvalidated() { return true; }
|
||||
|
||||
bool UpdateMobEffectPacket::isInvalidatedBy(std::shared_ptr<Packet> packet)
|
||||
{
|
||||
std::shared_ptr<UpdateMobEffectPacket> target = std::dynamic_pointer_cast<UpdateMobEffectPacket>(packet);
|
||||
return target->entityId == entityId && target->effectId == effectId;
|
||||
bool UpdateMobEffectPacket::isInvalidatedBy(std::shared_ptr<Packet> packet) {
|
||||
std::shared_ptr<UpdateMobEffectPacket> target =
|
||||
std::dynamic_pointer_cast<UpdateMobEffectPacket>(packet);
|
||||
return target->entityId == entityId && target->effectId == effectId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user