2026-03-01 12:16:08 +08:00
|
|
|
#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;
|
|
|
|
|
|
2026-03-03 03:04:10 +08:00
|
|
|
float dropChance;
|
|
|
|
|
|
2026-03-01 12:16:08 +08:00
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
void _init();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
ItemFrame(Level *level);
|
|
|
|
|
ItemFrame(Level *level, int xTile, int yTile, int zTile, int dir);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void defineSynchedData();
|
2026-03-03 03:04:10 +08:00
|
|
|
|
|
|
|
|
public:
|
2026-03-01 12:16:08 +08:00
|
|
|
virtual int getWidth() {return 9;}
|
|
|
|
|
virtual int getHeight() {return 9;}
|
2026-03-03 03:04:10 +08:00
|
|
|
virtual bool shouldRenderAtSqrDistance(double distance);
|
|
|
|
|
virtual void dropItem(shared_ptr<Entity> causedBy);
|
2026-03-01 12:16:08 +08:00
|
|
|
|
2026-03-03 03:04:10 +08:00
|
|
|
private:
|
|
|
|
|
void removeFramedMap(shared_ptr<ItemInstance> item);
|
2026-03-01 12:16:08 +08:00
|
|
|
|
2026-03-03 03:04:10 +08:00
|
|
|
public:
|
2026-03-02 17:37:16 +07:00
|
|
|
shared_ptr<ItemInstance> getItem();
|
|
|
|
|
void setItem(shared_ptr<ItemInstance> item);
|
2026-03-01 12:16:08 +08:00
|
|
|
int getRotation();
|
|
|
|
|
void setRotation(int rotation);
|
|
|
|
|
|
|
|
|
|
virtual void addAdditonalSaveData(CompoundTag *tag);
|
|
|
|
|
virtual void readAdditionalSaveData(CompoundTag *tag);
|
2026-03-02 17:37:16 +07:00
|
|
|
virtual bool interact(shared_ptr<Player> player);
|
2026-03-01 12:16:08 +08:00
|
|
|
};
|