-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
94acc50
commit f2cbb28
Showing
3 changed files
with
73 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/Minecraft.Network/protocol/game/UpdateProgressPacket.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include "Minecraft.Network/protocol/game/UpdateProgressPacket.h" | ||
#include "Minecraft.Client/multiplayer/PacketListener.h" | ||
#include "Minecraft.Core/io/DataInputStream.h" | ||
#include "Minecraft.Core/io/DataOutputStream.h" | ||
|
||
std::shared_ptr<Packet> UpdateProgressPacket::create() { | ||
return std::shared_ptr<Packet>(new UpdateProgressPacket()); | ||
} | ||
|
||
UpdateProgressPacket::UpdateProgressPacket() : Packet() { | ||
mProgress = 0; | ||
} | ||
|
||
UpdateProgressPacket::UpdateProgressPacket(int progress) : Packet() { | ||
mProgress = progress; | ||
} | ||
|
||
EPacketType UpdateProgressPacket::getPacketId() { | ||
return EPacketType::_UpdateProgressPacket; | ||
} | ||
|
||
void UpdateProgressPacket::read(DataInputStream* input) { | ||
mProgress = input->readByte(); | ||
} | ||
|
||
void UpdateProgressPacket::write(DataOutputStream* output) { | ||
output->writeByte(mProgress); | ||
} | ||
|
||
void UpdateProgressPacket::handle(PacketListener* listener) { | ||
listener->handleUpdateProgress(this->shared_from_this()); | ||
} | ||
|
||
int UpdateProgressPacket::getEstimatedSize() { | ||
return 1; | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Minecraft.Network/protocol/game/UpdateProgressPacket.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
|
||
#include "Minecraft.Network/protocol/Packet.h" | ||
|
||
class UpdateProgressPacket : public Packet, public std::enable_shared_from_this<UpdateProgressPacket> { | ||
public: | ||
static std::shared_ptr<Packet> create(); | ||
|
||
UpdateProgressPacket(); | ||
UpdateProgressPacket(int progress); | ||
|
||
virtual EPacketType getPacketId() override; | ||
virtual void read(DataInputStream* input) override; | ||
virtual void write(DataOutputStream* output) override; | ||
virtual void handle(PacketListener* listener) override; | ||
virtual int getEstimatedSize() override; | ||
|
||
int mProgress; | ||
}; |