Cuberite
A lightweight, fast and extensible game server for Minecraft
HopperEntity.h
Go to the documentation of this file.
1 
2 // HopperEntity.h
3 
4 // Declares the cHopperEntity representing a hopper block entity
5 
6 
7 
8 
9 
10 #pragma once
11 
12 #include "BlockEntityWithItems.h"
13 
14 
15 
16 
17 
18 // tolua_begin
21 {
22  // tolua_end
23 
25 
26  // tolua_begin
27 
28 public:
29  enum
30  {
34  } ;
35 
36  // tolua_end
37 
39 
40 
41  cHopperEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
42 
46  std::pair<bool, Vector3i> GetOutputBlockPos(NIBBLETYPE a_BlockMeta);
47 
48 protected:
49 
52 
53  // cBlockEntity overrides:
54  virtual void CopyFrom(const cBlockEntity & a_Src) override;
55  virtual bool Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
56  virtual void SendTo(cClientHandle & a_Client) override;
57  virtual bool UsedBy(cPlayer * a_Player) override;
58 
60  void OpenNewWindow(void);
61 
63  bool MoveItemsIn(cChunk & a_Chunk, Int64 a_CurrentTick);
64 
66  bool MovePickupsIn(cChunk & a_Chunk, Int64 a_CurrentTick);
67 
69  bool MoveItemsOut(cChunk & a_Chunk, Int64 a_CurrentTick);
70 
72  bool MoveItemsFromChest(cChunk & a_Chunk);
73 
75  bool MoveItemsFromFurnace(cChunk & a_Chunk);
76 
79 
81  bool MoveItemsFromSlot(cBlockEntityWithItems & a_Entity, int a_SrcSlotNum);
82 
84  bool MoveItemsToChest(cChunk & a_Chunk, Vector3i a_Coords);
85 
87  bool MoveItemsToFurnace(cChunk & a_Chunk, Vector3i a_Coords, NIBBLETYPE a_HopperMeta);
88 
90  bool MoveItemsToGrid(cBlockEntityWithItems & a_Entity);
91 
93  bool MoveItemsToSlot(cBlockEntityWithItems & a_Entity, int a_DstSlotNum);
94 } ; // tolua_export
95 
96 
97 
98 
Definition: FastNBT.h:131
bool MoveItemsFromChest(cChunk &a_Chunk)
Moves items from a chest (dblchest) above the hopper into this hopper.
cBlockEntityWithItems(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, int a_ItemGridWidth, int a_ItemGridHeight, cWorld *a_World)
Int64 m_LastMoveItemsInTick
Definition: HopperEntity.h:50
std::pair< bool, Vector3i > GetOutputBlockPos(NIBBLETYPE a_BlockMeta)
Returns the block coords of the block receiving the output items, based on the meta Returns <false...
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:42
bool MoveItemsFromSlot(cBlockEntityWithItems &a_Entity, int a_SrcSlotNum)
Moves one piece from the specified itemstack into this hopper.
Definition: Player.h:27
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:45
Definition: Chunk.h:49
bool MoveItemsToSlot(cBlockEntityWithItems &a_Entity, int a_DstSlotNum)
Moves one piece to the specified entity&#39;s contents&#39; slot.
bool MoveItemsToChest(cChunk &a_Chunk, Vector3i a_Coords)
Moves items to the chest at the specified absolute coords.
Definition: World.h:65
bool MoveItemsToGrid(cBlockEntityWithItems &a_Entity)
Moves items to the specified ItemGrid.
bool MoveItemsToFurnace(cChunk &a_Chunk, Vector3i a_Coords, NIBBLETYPE a_HopperMeta)
Moves items to the furnace at the specified absolute coords.
Int64 m_LastMoveItemsOutTick
Definition: HopperEntity.h:51
bool MovePickupsIn(cChunk &a_Chunk, Int64 a_CurrentTick)
Moves pickups from above this hopper into it.
bool MoveItemsFromFurnace(cChunk &a_Chunk)
Moves items from a furnace above the hopper into this hopper.
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...
bool MoveItemsFromGrid(cBlockEntityWithItems &a_Entity)
Moves items from the specified a_Entity&#39;s Contents into this hopper.
How many ticks at minimum between two item transfers to or from the hopper.
Definition: HopperEntity.h:33
#define BLOCKENTITY_PROTODEF(classname)
Place this macro in the declaration of each cBlockEntity descendant.
Definition: BlockEntity.h:9
bool MoveItemsIn(cChunk &a_Chunk, Int64 a_CurrentTick)
Moves items from the container above it into this hopper.
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 UsedBy(cPlayer *a_Player) override
Called when a player uses this entity; should open the UI window.
bool MoveItemsOut(cChunk &a_Chunk, Int64 a_CurrentTick)
Moves items out from this hopper into the destination.
signed long long Int64
Definition: Globals.h:107
void OpenNewWindow(void)
Opens a new chest window for this chest.
virtual void SendTo(cClientHandle &a_Client) override
Sends the packet defining the block entity to the client specified.