2013-02-18 11:48:50 -05:00
|
|
|
|
|
|
|
// Minecart.h
|
|
|
|
|
|
|
|
// Declares the cMinecart class representing a minecart in the world
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Entity.h"
|
2013-03-09 09:35:43 -05:00
|
|
|
#include "Item.h"
|
2013-02-18 11:48:50 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cMinecart :
|
|
|
|
public cEntity
|
|
|
|
{
|
|
|
|
typedef cEntity super;
|
|
|
|
|
|
|
|
public:
|
2013-02-27 05:02:06 -05:00
|
|
|
CLASS_PROTODEF(cMinecart);
|
|
|
|
|
2013-02-18 11:48:50 -05:00
|
|
|
enum ePayload
|
|
|
|
{
|
2013-02-27 05:02:06 -05:00
|
|
|
mpNone, // Empty minecart, ridable by player or mobs
|
|
|
|
mpChest, // Minecart-with-chest, can store a grid of 3*8 items
|
2013-02-18 11:48:50 -05:00
|
|
|
mpFurnace, // Minecart-with-furnace, can be powered
|
|
|
|
// TODO: Other 1.5 features: hopper, tnt, dispenser, spawner
|
|
|
|
} ;
|
2013-02-27 05:02:06 -05:00
|
|
|
|
2013-02-18 11:48:50 -05:00
|
|
|
// cEntity overrides:
|
|
|
|
virtual void Initialize(cWorld * a_World) override;
|
|
|
|
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
|
|
|
|
virtual void Tick(float a_Dt, MTRand & a_TickRandom) override;
|
|
|
|
|
|
|
|
ePayload GetPayload(void) const { return m_Payload; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
ePayload m_Payload;
|
2013-03-03 14:05:11 -05:00
|
|
|
|
|
|
|
cMinecart(ePayload a_Payload, double a_X, double a_Y, double a_Z);
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cEmptyMinecart :
|
|
|
|
public cMinecart
|
|
|
|
{
|
|
|
|
typedef cMinecart super;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CLASS_PROTODEF(cEmptyMinecart);
|
|
|
|
|
|
|
|
cEmptyMinecart(double a_X, double a_Y, double a_Z);
|
|
|
|
|
|
|
|
// cEntity overrides:
|
|
|
|
virtual void OnRightClicked(cPlayer & a_Player) override;
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cMinecartWithChest :
|
|
|
|
public cMinecart
|
|
|
|
{
|
|
|
|
typedef cMinecart super;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CLASS_PROTODEF(cMinecartWithChest);
|
|
|
|
|
2013-03-09 09:35:43 -05:00
|
|
|
/// Number of item slots in the chest
|
|
|
|
static const int NumSlots = 9 * 3;
|
|
|
|
|
2013-03-03 14:05:11 -05:00
|
|
|
cMinecartWithChest(double a_X, double a_Y, double a_Z);
|
|
|
|
|
2013-03-09 09:35:43 -05:00
|
|
|
const cItem & GetItem(int a_Idx) const { return m_Items[a_Idx]; }
|
|
|
|
cItem & GetItem(int a_Idx) { return m_Items[a_Idx]; }
|
|
|
|
|
|
|
|
void SetItem(int a_Idx, const cItem & a_Item);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
/// The chest contents:
|
|
|
|
cItem m_Items[NumSlots];
|
|
|
|
|
2013-03-03 14:05:11 -05:00
|
|
|
// cEntity overrides:
|
|
|
|
virtual void OnRightClicked(cPlayer & a_Player) override;
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cMinecartWithFurnace :
|
|
|
|
public cMinecart
|
|
|
|
{
|
|
|
|
typedef cMinecart super;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CLASS_PROTODEF(cMinecartWithFurnace);
|
|
|
|
|
|
|
|
cMinecartWithFurnace(double a_X, double a_Y, double a_Z);
|
|
|
|
|
|
|
|
// cEntity overrides:
|
|
|
|
virtual void OnRightClicked(cPlayer & a_Player) override;
|
2013-02-18 11:48:50 -05:00
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|