summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemMinecart.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Items/ItemMinecart.h19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/Items/ItemMinecart.h b/src/Items/ItemMinecart.h
index 623342d41..05f375f06 100644
--- a/src/Items/ItemMinecart.h
+++ b/src/Items/ItemMinecart.h
@@ -59,24 +59,9 @@ public:
double x = static_cast<double>(a_BlockX) + 0.5;
double y = static_cast<double>(a_BlockY) + 0.5;
double z = static_cast<double>(a_BlockZ) + 0.5;
- cMinecart * Minecart = nullptr;
- switch (m_ItemType)
- {
- case E_ITEM_MINECART: Minecart = new cRideableMinecart (x, y, z, cItem(), 1); 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");
- return false;
- }
- } // switch (m_ItemType)
- if (!Minecart->Initialize(*a_World))
+
+ if (a_World->SpawnMinecart(x, y, z, m_ItemType) == cEntity::INVALID_ID)
{
- delete Minecart;
- Minecart = nullptr;
return false;
}