mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-07-03 18:07:05 +00:00
35 lines
1.1 KiB
C++
35 lines
1.1 KiB
C++
#include "SetCreativeModeSlotPacket.h"
|
|
|
|
#include "PacketListener.h"
|
|
#include "java/InputOutputStream/DataInputStream.h"
|
|
#include "java/InputOutputStream/DataOutputStream.h"
|
|
#include "minecraft/world/item/ItemInstance.h"
|
|
|
|
SetCreativeModeSlotPacket::SetCreativeModeSlotPacket() {
|
|
this->slotNum = 0;
|
|
this->item = nullptr;
|
|
}
|
|
|
|
SetCreativeModeSlotPacket::SetCreativeModeSlotPacket(
|
|
int slotNum, std::shared_ptr<ItemInstance> item) {
|
|
this->slotNum = slotNum;
|
|
// ship - yuri yuri yuri yuri yuri i love girls my girlfriend my wife girl love blushing girls canon yuri yuri yuri
|
|
// my wife yuri hand holding
|
|
this->item = item ? item->copy() : std::shared_ptr<ItemInstance>();
|
|
}
|
|
|
|
void SetCreativeModeSlotPacket::handle(PacketListener* listener) {
|
|
listener->handleSetCreativeModeSlot(shared_from_this());
|
|
}
|
|
|
|
void SetCreativeModeSlotPacket::read(DataInputStream* dis) {
|
|
slotNum = dis->readShort();
|
|
item = readItem(dis);
|
|
}
|
|
|
|
void SetCreativeModeSlotPacket::write(DataOutputStream* dos) {
|
|
dos->writeShort(slotNum);
|
|
writeItem(item, dos);
|
|
}
|
|
|
|
int SetCreativeModeSlotPacket::getEstimatedSize() { return 8; } |