Added cWorld::SpawnMinecart.
This commit is contained in:
parent
83bdbafaa3
commit
6ff375273b
@ -16,6 +16,7 @@
|
||||
// Entities (except mobs):
|
||||
#include "Entities/ExpOrb.h"
|
||||
#include "Entities/FallingBlock.h"
|
||||
#include "Entities/Minecart.h"
|
||||
#include "Entities/Pickup.h"
|
||||
#include "Entities/Player.h"
|
||||
#include "Entities/TNTEntity.h"
|
||||
@ -1647,6 +1648,29 @@ int cWorld::SpawnExperienceOrb(double a_X, double a_Y, double a_Z, int a_Reward)
|
||||
|
||||
|
||||
|
||||
int cWorld::SpawnMinecart(double a_X, double a_Y, double a_Z, int a_MinecartType)
|
||||
{
|
||||
cMinecart * Minecart;
|
||||
switch (a_MinecartType)
|
||||
{
|
||||
case E_ITEM_MINECART: Minecart = new cEmptyMinecart (a_X, a_Y, a_Z); break;
|
||||
case E_ITEM_CHEST_MINECART: Minecart = new cMinecartWithChest (a_X, a_Y, a_Z); break;
|
||||
case E_ITEM_FURNACE_MINECART: Minecart = new cMinecartWithFurnace (a_X, a_Y, a_Z); break;
|
||||
case E_ITEM_MINECART_WITH_TNT: Minecart = new cMinecartWithTNT (a_X, a_Y, a_Z); break;
|
||||
case E_ITEM_MINECART_WITH_HOPPER: Minecart = new cMinecartWithHopper (a_X, a_Y, a_Z); break;
|
||||
default:
|
||||
{
|
||||
ASSERT(!"Unhandled minecart item");
|
||||
return -1;
|
||||
}
|
||||
} // switch (a_MinecartType)
|
||||
Minecart->Initialize(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cWorld::SpawnPrimedTNT(double a_X, double a_Y, double a_Z, double a_FuseTimeInSec, double a_InitialVelocityCoeff)
|
||||
{
|
||||
UNUSED(a_InitialVelocityCoeff);
|
||||
|
@ -363,6 +363,9 @@ public:
|
||||
/// Spawns an falling block entity at the given position. It returns the UniqueID of the spawned falling block.
|
||||
int SpawnFallingBlock(int a_X, int a_Y, int a_Z, BLOCKTYPE BlockType, NIBBLETYPE BlockMeta);
|
||||
|
||||
/// Spawns an minecart at the given coordinates.
|
||||
int SpawnMinecart(double a_X, double a_Y, double a_Z, int a_MinecartType);
|
||||
|
||||
/// Spawns an experience orb at the given location with the given reward. It returns the UniqueID of the spawned experience orb.
|
||||
int SpawnExperienceOrb(double a_X, double a_Y, double a_Z, int a_Reward);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user