aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/ItemFrame.h
blob: 06c1f111e9efff17a8bfaf257edc6b3fa3a59f02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once
using namespace std;
#include "Entity.h"
#include "HangingEntity.h"

class Level;

class ItemFrame : public HangingEntity
{
public:
	eINSTANCEOF GetType() { return eTYPE_ITEM_FRAME; };
	static Entity *create(Level *level) { return new ItemFrame(level); }
private:
	static const int DATA_ITEM = 2;
	static const int DATA_ROTATION = 3;

	float dropChance;

private:

	void _init();

public:
	ItemFrame(Level *level);
	ItemFrame(Level *level, int xTile, int yTile, int zTile, int dir);

protected:
	virtual void defineSynchedData();

public:
	virtual int getWidth() {return 9;}
	virtual int getHeight() {return 9;}
	virtual bool shouldRenderAtSqrDistance(double distance);
	virtual void dropItem(shared_ptr<Entity> causedBy);

private:
	void removeFramedMap(shared_ptr<ItemInstance> item);

public:
	shared_ptr<ItemInstance> getItem();
	void setItem(shared_ptr<ItemInstance> item);
	int getRotation();
	void setRotation(int rotation);

	virtual void addAdditonalSaveData(CompoundTag *tag);
	virtual void readAdditionalSaveData(CompoundTag *tag);
	virtual bool interact(shared_ptr<Player> player);
};