summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-08-16 14:04:06 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-08-16 14:04:06 +0200
commite64c40115ecb5ed843c7aa036f3b03e3c58ca033 (patch)
treecd9a532f3b34d7674291c23d12590214f0fc4c31 /source
parentMerge remote-tracking branch 'upstream/master' (diff)
downloadcuberite-e64c40115ecb5ed843c7aa036f3b03e3c58ca033.tar
cuberite-e64c40115ecb5ed843c7aa036f3b03e3c58ca033.tar.gz
cuberite-e64c40115ecb5ed843c7aa036f3b03e3c58ca033.tar.bz2
cuberite-e64c40115ecb5ed843c7aa036f3b03e3c58ca033.tar.lz
cuberite-e64c40115ecb5ed843c7aa036f3b03e3c58ca033.tar.xz
cuberite-e64c40115ecb5ed843c7aa036f3b03e3c58ca033.tar.zst
cuberite-e64c40115ecb5ed843c7aa036f3b03e3c58ca033.zip
Diffstat (limited to '')
-rw-r--r--source/Items/ItemMinecart.h8
-rw-r--r--source/Minecart.cpp12
-rw-r--r--source/WorldStorage/WSSAnvil.cpp42
3 files changed, 53 insertions, 9 deletions
diff --git a/source/Items/ItemMinecart.h b/source/Items/ItemMinecart.h
index 8be3baada..df970638e 100644
--- a/source/Items/ItemMinecart.h
+++ b/source/Items/ItemMinecart.h
@@ -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");
diff --git a/source/Minecart.cpp b/source/Minecart.cpp
index 19ea861a1..07a38692c 100644
--- a/source/Minecart.cpp
+++ b/source/Minecart.cpp
@@ -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");
diff --git a/source/WorldStorage/WSSAnvil.cpp b/source/WorldStorage/WSSAnvil.cpp
index 3648d4462..efa0e9d3e 100644
--- a/source/WorldStorage/WSSAnvil.cpp
+++ b/source/WorldStorage/WSSAnvil.cpp
@@ -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");