9 #include "../EffectID.h" 10 #include "../Entities/Player.h" 12 #include "../UI/DropSpenserWindow.h" 19 super(a_BlockType, a_BlockMeta, a_Pos, ContentsWidth, ContentsHeight, a_World),
20 m_ShouldDropSpense(false)
32 if (Window !=
nullptr)
53 LOGWARNING(
"%s: Unhandled direction: %d", __FUNCTION__, a_Direction);
70 OccupiedSlots[SlotsCnt] = i;
158 if (Window ==
nullptr)
164 if (Window !=
nullptr)
188 int PickupSpeedX = 0, PickupSpeedY = 0, PickupSpeedZ = 0;
199 double MicroX, MicroY, MicroZ;
200 MicroX = dispCoord.
x + 0.5;
201 MicroY = dispCoord.
y + 0.4;
202 MicroZ = dispCoord.
z + 0.5;
void AddDropSpenserDir(Vector3i &a_RelCoord, NIBBLETYPE a_Direction)
Modifies the block coords to match the dropspenser direction given (where the dropspensed pickups sho...
void CopyFrom(const cItemGrid &a_Src)
Copies all items from a_Src to this grid.
unsigned char BLOCKTYPE
The datatype used by blockdata.
MTRand & GetRandomProvider()
Returns the current thread's random number source.
virtual void DropSpenseFromSlot(cChunk &a_Chunk, int a_SlotNum)=0
Override this function to provide the specific behavior for item dropspensing (drop / shoot / pour / ...
cWindow * GetWindow(void)
virtual void CopyFrom(const cBlockEntity &a_Src) override
Copies all properties of a_Src into this entity, except for its m_World and location.
void OpenWindow(cWindow *a_Window)
void OwnerDestroyed(void)
void DropSpense(cChunk &a_Chunk)
Does the actual work on dropspensing an item.
void DropFromSlot(cChunk &a_Chunk, int a_SlotNum)
Helper function, drops one item from the specified slot (like a dropper)
cItem RemoveOneItem(int a_SlotNum)
Removes one item from the stack in the specified slot, and returns it.
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
void SpawnItemPickups(const cItems &a_Pickups, Vector3i a_BlockPos, double a_FlyAwaySpeed=1.0, bool a_IsPlayerCreated=false)
Spawns item pickups for each item in the list.
virtual void BroadcastSoundEffect(const AString &a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch, const cClientHandle *a_Exclude=nullptr) override
int GetTickRandomNumber(int a_Range)
Returns a random number in range [0 .
cWindow * GetWindow(void) const
virtual bool UsedBy(cPlayer *a_Player) override
Called when a player uses this entity; should open the UI window.
IntType RandInt(IntType a_Min, IntType a_Max)
Return a random IntType in the range [a_Min, a_Max].
Vector3i GetRelPos() const
virtual void BroadcastSoundParticleEffect(const EffectID a_EffectID, Vector3i a_SrcPos, int a_Data, const cClientHandle *a_Exclude=nullptr) override
NIBBLETYPE GetMeta(int a_RelX, int a_RelY, int a_RelZ) const
virtual void SendTo(cClientHandle &a_Client) override
Sends the packet defining the block entity to the client specified.
void Activate(void)
Sets the dropspenser to dropspense an item in the next tick.
void LOGWARNING(const char *a_Format, fmt::ArgList a_ArgList)
Vector3i m_Pos
Position in absolute block coordinates.
bool m_ShouldDropSpense
If true, the dropspenser will dropspense an item in the next tick.
virtual void CopyFrom(const cBlockEntity &a_Src) override
Copies all properties of a_Src into this entity, except for its m_World and location.
virtual bool Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
Ticks the entity; returns true if the chunk should be marked as dirty as a result of this ticking...
const cItem & GetSlot(int a_X, int a_Y) const
int GetNumSlots(void) const
void OpenWindow(cWindow &a_Window)
Opens the specified window; closes the current one first using CloseWindow()
This class bridges a vector of cItem for safe access via Lua.
cDropSpenserEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World)
virtual ~cDropSpenserEntity() override