From 7f87d6c3d6a116742f25f1846d747a33afdc63f0 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 16 Aug 2013 11:23:24 +0100 Subject: Feature and bugfixes [SEE DESC] Added TNT and Hopper minecarts Fixed piston code failing without an extension set Repeaters are now broken Fixed not being able to place a minecart on an activator rail Added much needed comments on piston code Fixed minor formatting issue --- source/WorldStorage/NBTChunkSerializer.cpp | 2 ++ source/WorldStorage/NBTChunkSerializer.h | 2 ++ source/WorldStorage/WSSAnvil.cpp | 2 ++ source/WorldStorage/WSSAnvil.h | 2 ++ 4 files changed, 8 insertions(+) (limited to 'source/WorldStorage') diff --git a/source/WorldStorage/NBTChunkSerializer.cpp b/source/WorldStorage/NBTChunkSerializer.cpp index da1b9e1c4..fe8630318 100644 --- a/source/WorldStorage/NBTChunkSerializer.cpp +++ b/source/WorldStorage/NBTChunkSerializer.cpp @@ -274,6 +274,8 @@ void cNBTChunkSerializer::AddMinecartEntity(cMinecart * a_Minecart) case cMinecart::mpNone: EntityClass = "MinecartRideable"; break; case cMinecart::mpChest: EntityClass = "MinecartChest"; break; case cMinecart::mpFurnace: EntityClass = "MinecartFurnace"; break; + case cMinecart::mpTNT: EntityClass = "MinecartTNT"; break; + case cMinecart::mpHopper: EntityClass = "MinecartHopper"; break; default: { ASSERT(!"Unhandled minecart payload type"); diff --git a/source/WorldStorage/NBTChunkSerializer.h b/source/WorldStorage/NBTChunkSerializer.h index 1ccd356b0..cd1388f89 100644 --- a/source/WorldStorage/NBTChunkSerializer.h +++ b/source/WorldStorage/NBTChunkSerializer.h @@ -31,6 +31,8 @@ class cFallingBlock; class cMinecart; class cMinecartWithChest; class cMinecartWithFurnace; +class cMinecartWithTNT; +class cMinecartWithHopper; class cMonster; class cPickup; class cItemGrid; diff --git a/source/WorldStorage/WSSAnvil.cpp b/source/WorldStorage/WSSAnvil.cpp index 8f23cc773..3648d4462 100644 --- a/source/WorldStorage/WSSAnvil.cpp +++ b/source/WorldStorage/WSSAnvil.cpp @@ -928,6 +928,8 @@ void cWSSAnvil::LoadEntityFromNBT(cEntityList & a_Entities, const cParsedNBT & a case 0: LoadMinecartRFromNBT(a_Entities, a_NBT, a_EntityTagIdx); break; // Rideable minecart case 1: LoadMinecartCFromNBT(a_Entities, a_NBT, a_EntityTagIdx); break; // Minecart with chest case 2: LoadMinecartFFromNBT(a_Entities, a_NBT, a_EntityTagIdx); break; // Minecart with furnace + case 3: LoadMinecartTFromNBT(a_Entities, a_NBT, a_EntityTagIdx); break; // Minecart with TNT + case 4: LoadMinecartHFromNBT(a_Entities, a_NBT, a_EntityTagIdx); break; // Minecart with Hopper } } else if (strncmp(a_IDTag, "MinecartRideable", a_IDTagLength) == 0) diff --git a/source/WorldStorage/WSSAnvil.h b/source/WorldStorage/WSSAnvil.h index bd2108b30..47fda3f7b 100644 --- a/source/WorldStorage/WSSAnvil.h +++ b/source/WorldStorage/WSSAnvil.h @@ -142,6 +142,8 @@ protected: void LoadMinecartRFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx); void LoadMinecartCFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx); void LoadMinecartFFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx); + void LoadMinecartTFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx); + void LoadMinecartHFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx); void LoadPickupFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx); /// Loads entity common data from the NBT compound; returns true if successful -- cgit v1.2.3 From e64c40115ecb5ed843c7aa036f3b03e3c58ca033 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 16 Aug 2013 13:04:06 +0100 Subject: Compilation and Minecart fixes --- source/WorldStorage/WSSAnvil.cpp | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'source/WorldStorage') 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 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 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"); -- cgit v1.2.3