5 #include "../Simulator/FluidSimulator.h" 6 #include "../Entities/Boat.h" 9 #include "../Defines.h" 11 #include "../Entities/ProjectileEntity.h" 17 super(a_BlockType, a_BlockMeta, a_Pos, a_World)
29 auto meta = a_Chunk.
GetMeta(dispRelCoord);
32 if (dispChunk ==
nullptr)
39 auto dispAbsCoord = dispChunk->RelativeToAbsolute(dispRelCoord);
55 LOGD(
"Dispensing empty bucket in slot %d; dispBlock is \"%s\" (%d).", a_SlotNum,
ItemTypeToString(dispBlock).c_str(), dispBlock);
87 LOGD(
"Dispensing water bucket in slot %d; dispBlock is \"%s\" (%d).", a_SlotNum,
ItemTypeToString(dispBlock).c_str(), dispBlock);
101 LOGD(
"Dispensing lava bucket in slot %d; dispBlock is \"%s\" (%d).", a_SlotNum,
ItemTypeToString(dispBlock).c_str(), dispBlock);
115 double MobX = 0.5 + dispAbsCoord.x;
116 double MobZ = 0.5 + dispAbsCoord.z;
246 spawnPos +=
Vector3d(0.5, 0.5, 0.5);
279 a_Kind,
nullptr, a_Item, &a_ShootVector
298 LOGWARNING(
"Unhandled dispenser meta: %d", a_Meta);
299 ASSERT(!
"Unhandled dispenser facing");
309 cItem LiquidBucket(a_ResultingBucketItemType, 1);
void AddDropSpenserDir(Vector3i &a_RelCoord, NIBBLETYPE a_Direction)
Modifies the block coords to match the dropspenser direction given (where the dropspensed pickups sho...
virtual UInt32 SpawnMob(double a_PosX, double a_PosY, double a_PosZ, eMonsterType a_MonsterType, bool a_Baby=false) override
Spawns a mob of the specified type.
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 IsBlockWater(BLOCKTYPE a_BlockType)
cChunk * GetRelNeighborChunkAdjustCoords(Vector3i &a_RelPos) const
Returns the chunk into which the relatively-specified block belongs.
static bool IsSolid(BLOCKTYPE a_Type)
unsigned char BLOCKTYPE
The datatype used by blockdata.
cDispenserEntity(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Vector3i a_Pos, cWorld *a_World)
Constructor used for normal operation.
int ChangeSlotCount(int a_SlotNum, int a_AddToCount)
Adds (or subtracts, if a_AddToCount is negative) to the count of items in the specified slot...
void DropFromSlot(cChunk &a_Chunk, int a_SlotNum)
Helper function, drops one item from the specified slot (like a dropper)
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
eKind
The kind of the projectile.
bool ScoopUpLiquid(int a_SlotNum, short a_ResultingBucketItemType)
If such a bucket can fit, adds it to m_Contents and returns true.
UInt32 SpawnBoat(double a_X, double a_Y, double a_Z, cBoat::eMaterial a_Material)
Vector3< T > addedY(T a_AddY) const
Returns a copy of this vector moved by the specified amount on the y axis.
bool IsMinecart(short a_ItemType)
static bool CanWashAway(BLOCKTYPE a_BlockType)
bool IsBlockLiquid(BLOCKTYPE a_BlockType)
Vector3i GetRelPos() const
static eMaterial ItemToMaterial(const cItem &a_Item)
Returns the eMaterial that should be used for a boat created from the specified item.
NIBBLETYPE GetMeta(int a_RelX, int a_RelY, int a_RelZ) const
bool GrowRipePlant(Vector3i a_BlockPos)
Grows the plant at the specified block to its ripe stage.
Vector3< double > Vector3d
int AddItem(cItem &a_ItemStack, bool a_AllowNewStacks=true, int a_PrioritySlot=-1)
Adds as many items out of a_ItemStack as can fit.
UInt32 CreateProjectile(Vector3d a_Pos, cProjectileEntity::eKind a_Kind, cEntity *a_Creator, const cItem *a_Item, const Vector3d *a_Speed=nullptr)
Creates a projectile of the specified type.
void LOGWARNING(const char *a_Format, fmt::ArgList a_ArgList)
UInt32 SpawnMinecart(Vector3d a_Pos, int a_MinecartType, const cItem &a_Content=cItem(), int a_BlockHeight=1)
Spawns an minecart at the given coordinates.
bool IsBlockRail(BLOCKTYPE a_BlockType)
int HowManyCanFit(const cItem &a_ItemStack, bool a_AllowNewStacks=true)
Returns number of items out of a_ItemStack that can fit in the storage.
BLOCKTYPE GetBlock(int a_RelX, int a_RelY, int a_RelZ) const
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...
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 SpawnPrimedTNT(double a_X, double a_Y, double a_Z, int a_FuseTimeInSec=80, double a_InitialVelocityCoeff=1)
const cItem & GetSlot(int a_X, int a_Y) const
static const UInt32 INVALID_ID
Special ID that is considered an "invalid value", signifying no entity.
AString ItemTypeToString(short a_ItemType)
Translates itemtype into a string.
static Vector3d GetShootVector(NIBBLETYPE a_BlockMeta)
Returns a unit vector in the cardinal direction of where the dispenser with the specified meta would ...
bool DamageItem(int a_SlotNum, short a_Amount)
Adds the specified damage to the specified item; returns true if the item broke (but the item is left...
void SetSlot(int a_X, int a_Y, const cItem &a_Item)