Cuberite
A lightweight, fast and extensible game server for Minecraft
JukeboxEntity.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "BlockEntity.h"
5 #include "../BlockType.h"
6 
7 
8 
9 
10 
11 // tolua_begin
12 
14  public cBlockEntity
15 {
16  // tolua_end
17 
19 
20 public: // tolua_export
21 
22  cJukeboxEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
23 
24  // tolua_begin
25 
26  int GetRecord(void);
27  void SetRecord(int a_Record);
28 
31  bool PlayRecord(int a_Record);
32 
34  bool EjectRecord(void);
35 
37  bool IsPlayingRecord(void) const;
38 
39  static bool IsRecordItem(int a_Item)
40  {
41  return ((a_Item >= E_ITEM_FIRST_DISC) && (a_Item <= E_ITEM_LAST_DISC));
42  }
43 
44  // tolua_end
45 
46  // cBlockEntity overrides:
47  virtual void Destroy(void) override;
48  virtual cItems ConvertToPickups() const override;
49  virtual void CopyFrom(const cBlockEntity & a_Src) override;
50  virtual bool UsedBy(cPlayer * a_Player) override;
51  virtual void SendTo(cClientHandle &) override {}
52 
53 private:
54  int m_Record;
55 } ; // tolua_end
@ E_ITEM_LAST_DISC
Maximum disc itemtype number used.
Definition: BlockType.h:522
@ E_ITEM_FIRST_DISC
Definition: BlockType.h:505
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:44
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:41
cBlockEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World)
Definition: BlockEntity.cpp:32
virtual void SendTo(cClientHandle &) override
Sends the packet defining the block entity to the client specified.
Definition: JukeboxEntity.h:51
bool PlayRecord(int a_Record)
Plays the specified Record.
virtual void CopyFrom(const cBlockEntity &a_Src) override
Copies all properties of a_Src into this entity, except for its m_World and location.
bool IsPlayingRecord(void) const
Is in the Jukebox a Record?
virtual cItems ConvertToPickups() const override
Returns the contents of this block entity that it would drop if broken.
bool EjectRecord(void)
Ejects the currently held record as a pickup.
cJukeboxEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World)
int GetRecord(void)
virtual void Destroy(void) override
Called when this block entity's associated block is destroyed.
virtual bool UsedBy(cPlayer *a_Player) override
Called when a player uses this entity; should open the UI window.
static bool IsRecordItem(int a_Item)
Definition: JukeboxEntity.h:39
void SetRecord(int a_Record)
Definition: Player.h:29
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:215
Definition: World.h:53