1
0

Compilation and Minecart fixes

This commit is contained in:
Tiger Wang 2013-08-16 13:04:06 +01:00
parent cbde4f546a
commit e64c40115e
3 changed files with 53 additions and 9 deletions

View File

@ -61,9 +61,11 @@ public:
cMinecart * Minecart = NULL;
switch (m_ItemType)
{
case E_ITEM_MINECART: Minecart = new cEmptyMinecart (x, y, z); break;
case E_ITEM_CHEST_MINECART: Minecart = new cMinecartWithChest (x, y, z); break;
case E_ITEM_FURNACE_MINECART: Minecart = new cMinecartWithFurnace(x, y, z); break;
case E_ITEM_MINECART: Minecart = new cEmptyMinecart (x, y, z); break;
case E_ITEM_CHEST_MINECART: Minecart = new cMinecartWithChest (x, y, z); break;
case E_ITEM_FURNACE_MINECART: Minecart = new cMinecartWithFurnace (x, y, z); break;
case E_ITEM_MINECART_WITH_TNT: Minecart = new cMinecartWithTNT (x, y, z); break;
case E_ITEM_MINECART_WITH_HOPPER: Minecart = new cMinecartWithHopper (x, y, z); break;
default:
{
ASSERT(!"Unhandled minecart item");

View File

@ -39,13 +39,13 @@ bool cMinecart::Initialize(cWorld * a_World)
void cMinecart::SpawnOn(cClientHandle & a_ClientHandle)
{
char Type = 0;
switch (m_Payload)
switch (m_Payload) //Wiki.vg is outdated on this!!
{
case mpNone: Type = 10; break;
case mpChest: Type = 11; break;
case mpFurnace: Type = 12; break;
case mpTNT: Type = 13; break;
case mpHopper: Type = 14; break;
case mpNone: Type = 15; break; //?
case mpChest: Type = 10; break;
case mpFurnace: Type = 11; break; //?
case mpTNT: Type = 12; break; //?
case mpHopper: Type = 14; break; //?
default:
{
ASSERT(!"Unknown payload, cannot spawn on client");

View File

@ -944,6 +944,14 @@ void cWSSAnvil::LoadEntityFromNBT(cEntityList & a_Entities, const cParsedNBT & a
{
LoadMinecartFFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
}
else if (strncmp(a_IDTag, "MinecartTNT", a_IDTagLength) == 0)
{
LoadMinecartTFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
}
else if (strncmp(a_IDTag, "MinecartHopper", a_IDTagLength) == 0)
{
LoadMinecartHFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
}
if (strncmp(a_IDTag, "Item", a_IDTagLength) == 0)
{
LoadPickupFromNBT(a_Entities, a_NBT, a_EntityTagIdx);
@ -1027,6 +1035,40 @@ void cWSSAnvil::LoadMinecartFFromNBT(cEntityList & a_Entities, const cParsedNBT
void cWSSAnvil::LoadMinecartTFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
std::auto_ptr<cMinecartWithTNT> Minecart(new cMinecartWithTNT(0, 0, 0));
if (!LoadEntityBaseFromNBT(*Minecart.get(), a_NBT, a_TagIdx))
{
return;
}
//TODO: Everything to do with TNT carts
a_Entities.push_back(Minecart.release());
}
void cWSSAnvil::LoadMinecartHFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
std::auto_ptr<cMinecartWithHopper> Minecart(new cMinecartWithHopper(0, 0, 0));
if (!LoadEntityBaseFromNBT(*Minecart.get(), a_NBT, a_TagIdx))
{
return;
}
//TODO: Everything to do with hopper carts
a_Entities.push_back(Minecart.release());
}
void cWSSAnvil::LoadPickupFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
int ItemTag = a_NBT.FindChildByName(a_TagIdx, "Item");