neoLegacy/Minecraft.World/ItemFrame.h
Lord Cambion 9c55f80368
feat: Comparator +Item Frame (#106)
* feat: rotation in 8 directions

i implemented rotation in 8 directions for the item frames using decompilation

* fix: map render + normal items

map renders only explorated zones.
also fixed the size of the item and place inside item frame

* feat: itemframe drops items when hurt

* feat: comparator detects itemframe
2026-05-25 00:16:05 +03:00

53 lines
1.3 KiB
C++

#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, bool notifyNeighbors);
void setItem(shared_ptr<ItemInstance> item);
int getRotation();
void setRotation(int rotation, bool notifyNeighbors);
void setRotation(int rotation);
virtual bool hurt(DamageSource *source, float damage) override;
virtual int getAnalogOutput();
virtual float getPickRadius()override;
virtual void addAdditonalSaveData(CompoundTag *tag);
virtual void readAdditionalSaveData(CompoundTag *tag);
virtual bool interact(shared_ptr<Player> player);
};