summaryrefslogtreecommitdiffstats
path: root/src/BlockID.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-11-18 14:56:32 +0100
committerHowaner <franzi.moos@googlemail.com>2014-11-18 14:56:32 +0100
commit42120e2ea5db0cdb9920ff1c5efef33e0f496d48 (patch)
tree20ba1ae0a53f757cb8814b6cd6a466fe5acf1308 /src/BlockID.cpp
parentFixed compile errors. (diff)
parentMerge pull request #1598 from mc-server/SignEditor (diff)
downloadcuberite-42120e2ea5db0cdb9920ff1c5efef33e0f496d48.tar
cuberite-42120e2ea5db0cdb9920ff1c5efef33e0f496d48.tar.gz
cuberite-42120e2ea5db0cdb9920ff1c5efef33e0f496d48.tar.bz2
cuberite-42120e2ea5db0cdb9920ff1c5efef33e0f496d48.tar.lz
cuberite-42120e2ea5db0cdb9920ff1c5efef33e0f496d48.tar.xz
cuberite-42120e2ea5db0cdb9920ff1c5efef33e0f496d48.tar.zst
cuberite-42120e2ea5db0cdb9920ff1c5efef33e0f496d48.zip
Diffstat (limited to 'src/BlockID.cpp')
-rw-r--r--src/BlockID.cpp60
1 files changed, 7 insertions, 53 deletions
diff --git a/src/BlockID.cpp b/src/BlockID.cpp
index 9026d81f2..c98e0cad1 100644
--- a/src/BlockID.cpp
+++ b/src/BlockID.cpp
@@ -4,7 +4,7 @@
#include "Globals.h"
#include "BlockID.h"
-#include "inifile/iniFile.h"
+#include "IniFile.h"
#include "Item.h"
#include "Mobs/Monster.h"
@@ -217,7 +217,12 @@ BLOCKTYPE BlockStringToType(const AString & a_BlockTypeString)
bool StringToItem(const AString & a_ItemTypeString, cItem & a_Item)
{
- return gsBlockIDMap.ResolveItem(TrimString(a_ItemTypeString), a_Item);
+ AString ItemName = TrimString(a_ItemTypeString);
+ if (ItemName.substr(0, 10) == "minecraft:")
+ {
+ ItemName = ItemName.substr(10);
+ }
+ return gsBlockIDMap.ResolveItem(ItemName, a_Item);
}
@@ -253,57 +258,6 @@ AString ItemToFullString(const cItem & a_Item)
-int StringToMobType(const AString & a_MobString)
-{
- static struct
- {
- int m_MobType;
- const char * m_String;
- } MobMap [] =
- {
- {mtCreeper, "Creeper"},
- {mtSkeleton, "Skeleton"},
- {mtSpider, "Spider"},
- {mtGiant, "Giant"},
- {mtZombie, "Zombie"},
- {mtSlime, "Slime"},
- {mtGhast, "Ghast"},
- {mtZombiePigman, "ZombiePigman"},
- {mtEnderman, "Enderman"},
- {mtCaveSpider, "CaveSpider"},
- {mtSilverfish, "SilverFish"},
- {mtBlaze, "Blaze"},
- {mtMagmaCube, "MagmaCube"},
- {mtEnderDragon, "EnderDragon"},
- {mtWither, "Wither"},
- {mtBat, "Bat"},
- {mtWitch, "Witch"},
- {mtPig, "Pig"},
- {mtSheep, "Sheep"},
- {mtCow, "Cow"},
- {mtChicken, "Chicken"},
- {mtSquid, "Squid"},
- {mtWolf, "Wolf"},
- {mtMooshroom, "Mooshroom"},
- {mtSnowGolem, "SnowGolem"},
- {mtOcelot, "Ocelot"},
- {mtIronGolem, "IronGolem"},
- {mtVillager, "Villager"},
- };
- for (size_t i = 0; i < ARRAYCOUNT(MobMap); i++)
- {
- if (NoCaseCompare(MobMap[i].m_String, a_MobString) == 0)
- {
- return MobMap[i].m_MobType;
- }
- } // for i - MobMap[]
- return -1;
-}
-
-
-
-
-
eDimension StringToDimension(const AString & a_DimensionString)
{
// First try decoding as a number