mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-15 20:23:52 +00:00
Initial commit
This commit is contained in:
parent
def8cb4153
commit
b691c43c44
19437 changed files with 4363922 additions and 0 deletions
42
Minecraft.World/SetCreativeModeSlotPacket.cpp
Normal file
42
Minecraft.World/SetCreativeModeSlotPacket.cpp
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#include "stdafx.h"
|
||||
#include "InputOutputStream.h"
|
||||
#include "PacketListener.h"
|
||||
#include "SetCreativeModeSlotPacket.h"
|
||||
|
||||
|
||||
|
||||
SetCreativeModeSlotPacket::SetCreativeModeSlotPacket()
|
||||
{
|
||||
this->slotNum = 0;
|
||||
this->item = nullptr;
|
||||
}
|
||||
|
||||
SetCreativeModeSlotPacket::SetCreativeModeSlotPacket(int slotNum, shared_ptr<ItemInstance> item)
|
||||
{
|
||||
this->slotNum = slotNum;
|
||||
// 4J - take copy of item as we want our packets to have full ownership of any referenced data
|
||||
this->item = item ? item->copy() : 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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue