Cuberite
A lightweight, fast and extensible game server for Minecraft
DispenserEntity.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "DropSpenserEntity.h"
5 
6 
7 
8 
9 
10 // tolua_begin
12  public cDropSpenserEntity
13 {
14  // tolua_end
15 
17 
18 public: // tolua_export
19 
21  cDispenserEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld * a_World);
22 
23  // tolua_begin
24 
29  Vector3i a_BlockPos,
31  const Vector3d & a_Speed,
32  const cItem * a_Item = nullptr
33  );
34 
40  int a_BlockX, int a_BlockY, int a_BlockZ,
42  const Vector3d & a_Speed,
43  const cItem * a_Item = nullptr
44  )
45  {
46  return SpawnProjectileFromDispenser({a_BlockX, a_BlockY, a_BlockZ}, a_Kind, a_Speed, a_Item);
47  }
48 
50  static Vector3d GetShootVector(NIBBLETYPE a_BlockMeta);
51 
52  // tolua_end
53 
54 private:
55 
56  // cDropSpenser overrides:
57  virtual void DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) override;
58 
60  bool ScoopUpLiquid(int a_SlotNum, short a_ResultingBucketItemType);
61 
64  bool EmptyLiquidBucket(BLOCKTYPE a_BlockInFront, int a_SlotNum);
65 } ; // tolua_export
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
unsigned int UInt32
Definition: Globals.h:157
cDispenserEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World)
Constructor used for normal operation.
static Vector3d GetShootVector(NIBBLETYPE a_BlockMeta)
Returns a unit vector in the cardinal direction of where the dispenser with the specified meta would ...
bool EmptyLiquidBucket(BLOCKTYPE a_BlockInFront, int a_SlotNum)
If the a_BlockInFront can be washed away by liquid and the empty bucket can fit, does the m_Contents ...
bool ScoopUpLiquid(int a_SlotNum, short a_ResultingBucketItemType)
If such a bucket can fit, adds it to m_Contents and returns true.
virtual void DropSpenseFromSlot(cChunk &a_Chunk, int a_SlotNum) override
Override this function to provide the specific behavior for item dropspensing (drop / shoot / pour / ...
UInt32 SpawnProjectileFromDispenser(int a_BlockX, int a_BlockY, int a_BlockZ, cProjectileEntity::eKind a_Kind, const Vector3d &a_Speed, const cItem *a_Item=nullptr)
OBSOLETE, use the Vector3i-based overload instead.
UInt32 SpawnProjectileFromDispenser(Vector3i a_BlockPos, cProjectileEntity::eKind a_Kind, const Vector3d &a_Speed, const cItem *a_Item=nullptr)
Spawns a projectile of the given kind in front of the dispenser with the specified speed.
cDropSpenserEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World)
Definition: Chunk.h:36
eKind
The kind of the projectile.
Definition: Item.h:37
Definition: World.h:53