the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 72 lines 1.6 kB view raw
1#include "stdafx.h" 2#include "com.mojang.nbt.h" 3#include "net.minecraft.network.packet.h" 4#include "SkullTileEntity.h" 5 6SkullTileEntity::SkullTileEntity() 7{ 8 skullType = 0; 9 rotation = 0; 10 extraType = L""; 11} 12 13void SkullTileEntity::save(CompoundTag *tag) 14{ 15 TileEntity::save(tag); 16 tag->putByte(L"SkullType", (BYTE) (skullType & 0xff)); 17 tag->putByte(L"Rot", (BYTE) (rotation & 0xff)); 18 tag->putString(L"ExtraType", extraType); 19} 20 21void SkullTileEntity::load(CompoundTag *tag) 22{ 23 TileEntity::load(tag); 24 skullType = tag->getByte(L"SkullType"); 25 rotation = tag->getByte(L"Rot"); 26 if (tag->contains(L"ExtraType")) extraType = tag->getString(L"ExtraType"); 27} 28 29shared_ptr<Packet> SkullTileEntity::getUpdatePacket() 30{ 31 CompoundTag *tag = new CompoundTag(); 32 save(tag); 33 return shared_ptr<TileEntityDataPacket>(new TileEntityDataPacket(x, y, z, TileEntityDataPacket::TYPE_SKULL, tag)); 34} 35 36void SkullTileEntity::setSkullType(int skullType, const wstring &extra) 37{ 38 this->skullType = skullType; 39 this->extraType = extra; 40} 41 42int SkullTileEntity::getSkullType() 43{ 44 return skullType; 45} 46 47int SkullTileEntity::getRotation() 48{ 49 return rotation; 50} 51 52void SkullTileEntity::setRotation(int rot) 53{ 54 rotation = rot; 55} 56 57wstring SkullTileEntity::getExtraType() 58{ 59 return extraType; 60} 61 62// 4J Added 63shared_ptr<TileEntity> SkullTileEntity::clone() 64{ 65 shared_ptr<SkullTileEntity> result = shared_ptr<SkullTileEntity>( new SkullTileEntity() ); 66 TileEntity::clone(result); 67 68 result->skullType = skullType; 69 result->rotation = rotation; 70 result->extraType = extraType; 71 return result; 72}