2012-06-14 09:06:06 -04:00
|
|
|
// BlockID.cpp
|
|
|
|
|
|
|
|
// Implements the helper functions for converting Block ID string to int etc.
|
|
|
|
|
|
|
|
#include "Globals.h"
|
|
|
|
#include "BlockID.h"
|
|
|
|
#include "../iniFile/iniFile.h"
|
2012-09-23 18:09:57 -04:00
|
|
|
#include "Item.h"
|
2013-08-16 04:48:19 -04:00
|
|
|
#include "Mobs/Monster.h"
|
2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NIBBLETYPE g_BlockLightValue[256];
|
|
|
|
NIBBLETYPE g_BlockSpreadLightFalloff[256];
|
|
|
|
bool g_BlockTransparent[256];
|
|
|
|
bool g_BlockOneHitDig[256];
|
|
|
|
bool g_BlockPistonBreakable[256];
|
|
|
|
bool g_BlockIsSnowable[256];
|
2012-08-14 04:32:23 -04:00
|
|
|
bool g_BlockRequiresSpecialTool[256];
|
2012-10-23 14:13:37 -04:00
|
|
|
bool g_BlockIsSolid[256];
|
2013-09-15 10:55:35 -04:00
|
|
|
bool g_BlockIsTorchPlaceable[256];
|
2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cBlockIDMap
|
|
|
|
{
|
2012-09-08 12:38:27 -04:00
|
|
|
// Making the map case-insensitive:
|
|
|
|
struct Comparator
|
|
|
|
{
|
2012-09-08 13:02:11 -04:00
|
|
|
bool operator()(const AString & a_Item1, const AString & a_Item2) const
|
2012-09-08 12:38:27 -04:00
|
|
|
{
|
|
|
|
return (NoCaseCompare(a_Item1, a_Item2) > 0);
|
|
|
|
}
|
|
|
|
} ;
|
|
|
|
|
|
|
|
typedef std::map<AString, std::pair<short, short>, Comparator> ItemMap;
|
2012-09-08 12:08:29 -04:00
|
|
|
|
2012-06-14 09:06:06 -04:00
|
|
|
public:
|
2012-09-08 12:08:29 -04:00
|
|
|
cBlockIDMap(void)
|
2012-06-14 09:06:06 -04:00
|
|
|
{
|
2013-10-25 05:15:44 -04:00
|
|
|
cIniFile Ini;
|
|
|
|
if (!Ini.ReadFile("items.ini"))
|
2012-09-08 12:08:29 -04:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2013-10-25 05:38:14 -04:00
|
|
|
int KeyID = Ini.FindKey("Items");
|
2012-09-08 12:08:29 -04:00
|
|
|
if (KeyID == cIniFile::noID)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2013-10-25 05:38:14 -04:00
|
|
|
int NumValues = Ini.GetNumValues(KeyID);
|
|
|
|
for (int i = 0; i < NumValues; i++)
|
2012-09-08 12:08:29 -04:00
|
|
|
{
|
2013-10-25 05:38:14 -04:00
|
|
|
AString Name = Ini.GetValueName(KeyID, i);
|
2012-09-08 12:08:29 -04:00
|
|
|
if (Name.empty())
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
AString Value = Ini.GetValue(KeyID, i);
|
|
|
|
AddToMap(Name, Value);
|
|
|
|
} // for i - Ini.Values[]
|
2012-06-14 09:06:06 -04:00
|
|
|
}
|
|
|
|
|
2012-09-08 12:08:29 -04:00
|
|
|
|
2012-06-14 09:06:06 -04:00
|
|
|
int Resolve(const AString & a_ItemName)
|
|
|
|
{
|
2012-09-08 12:08:29 -04:00
|
|
|
ItemMap::iterator itr = m_Map.find(a_ItemName);
|
|
|
|
if (itr == m_Map.end())
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return itr->second.first;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool ResolveItem(const AString & a_ItemName, cItem & a_Item)
|
|
|
|
{
|
2013-10-18 12:13:20 -04:00
|
|
|
// Split into parts divided by either ':' or '^'
|
|
|
|
AStringVector Split = StringSplitAndTrim(a_ItemName, ":^");
|
|
|
|
if (Split.empty())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
ItemMap::iterator itr = m_Map.find(Split[0]);
|
2012-09-08 12:08:29 -04:00
|
|
|
if (itr != m_Map.end())
|
|
|
|
{
|
2013-10-18 12:13:20 -04:00
|
|
|
// Resolved as a string, assign the type and the default damage / count
|
2012-09-08 12:08:29 -04:00
|
|
|
a_Item.m_ItemType = itr->second.first;
|
|
|
|
a_Item.m_ItemDamage = itr->second.second;
|
2012-09-08 17:20:36 -04:00
|
|
|
if (a_Item.m_ItemDamage == -1)
|
|
|
|
{
|
|
|
|
a_Item.m_ItemDamage = 0;
|
|
|
|
}
|
2012-09-08 12:08:29 -04:00
|
|
|
}
|
2013-10-18 12:13:20 -04:00
|
|
|
else
|
2012-09-08 12:08:29 -04:00
|
|
|
{
|
2013-10-18 12:13:20 -04:00
|
|
|
// Not a resolvable string, try pure numbers: "45:6", "45^6" etc.
|
|
|
|
a_Item.m_ItemType = (short)atoi(Split[0].c_str());
|
|
|
|
if ((a_Item.m_ItemType == 0) && (Split[0] != "0"))
|
|
|
|
{
|
|
|
|
// Parsing the number failed
|
|
|
|
return false;
|
|
|
|
}
|
2012-09-08 12:08:29 -04:00
|
|
|
}
|
2013-10-18 12:13:20 -04:00
|
|
|
|
|
|
|
// Parse the damage, if present:
|
2012-09-08 12:08:29 -04:00
|
|
|
if (Split.size() < 2)
|
|
|
|
{
|
2013-10-18 12:13:20 -04:00
|
|
|
// Not present, set the item as valid and return success:
|
2012-09-08 17:33:53 -04:00
|
|
|
a_Item.m_ItemCount = 1;
|
2012-09-08 12:08:29 -04:00
|
|
|
return true;
|
|
|
|
}
|
2013-10-18 12:13:20 -04:00
|
|
|
|
2012-09-08 12:08:29 -04:00
|
|
|
a_Item.m_ItemDamage = atoi(Split[1].c_str());
|
|
|
|
if ((a_Item.m_ItemDamage == 0) && (Split[1] != "0"))
|
|
|
|
{
|
|
|
|
// Parsing the number failed
|
|
|
|
return false;
|
|
|
|
}
|
2012-09-08 17:33:53 -04:00
|
|
|
a_Item.m_ItemCount = 1;
|
2012-09-08 12:08:29 -04:00
|
|
|
return true;
|
2012-06-14 09:06:06 -04:00
|
|
|
}
|
|
|
|
|
2012-09-08 12:08:29 -04:00
|
|
|
|
|
|
|
AString Desolve(short a_ItemType, short a_ItemDamage)
|
2012-06-14 09:06:06 -04:00
|
|
|
{
|
2012-09-08 17:49:27 -04:00
|
|
|
// First try an exact match, both ItemType and ItemDamage ("birchplanks=5:2"):
|
2012-09-08 12:08:29 -04:00
|
|
|
for (ItemMap::iterator itr = m_Map.begin(), end = m_Map.end(); itr != end; ++itr)
|
|
|
|
{
|
|
|
|
if ((itr->second.first == a_ItemType) && (itr->second.second == a_ItemDamage))
|
|
|
|
{
|
|
|
|
return itr->first;
|
|
|
|
}
|
|
|
|
} // for itr - m_Map[]
|
2012-09-08 17:49:27 -04:00
|
|
|
|
|
|
|
// There is no exact match, try matching ItemType only ("planks=5"):
|
|
|
|
if (a_ItemDamage == 0)
|
|
|
|
{
|
|
|
|
for (ItemMap::iterator itr = m_Map.begin(), end = m_Map.end(); itr != end; ++itr)
|
|
|
|
{
|
|
|
|
if ((itr->second.first == a_ItemType) && (itr->second.second == -1))
|
|
|
|
{
|
|
|
|
return itr->first;
|
|
|
|
}
|
|
|
|
} // for itr - m_Map[]
|
|
|
|
}
|
|
|
|
|
|
|
|
// No match at all, synthesize a string ("5:1"):
|
2012-09-08 12:08:29 -04:00
|
|
|
AString res;
|
|
|
|
if (a_ItemDamage == -1)
|
|
|
|
{
|
|
|
|
Printf(res, "%d", a_ItemType);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Printf(res, "%d:%d", a_ItemType, a_ItemDamage);
|
|
|
|
}
|
|
|
|
return res;
|
2012-06-14 09:06:06 -04:00
|
|
|
}
|
|
|
|
|
2012-09-08 12:08:29 -04:00
|
|
|
|
2012-06-14 09:06:06 -04:00
|
|
|
protected:
|
2012-09-08 12:08:29 -04:00
|
|
|
ItemMap m_Map;
|
|
|
|
|
|
|
|
|
|
|
|
void AddToMap(const AString & a_Name, const AString & a_Value)
|
|
|
|
{
|
|
|
|
AStringVector Split = StringSplit(a_Value, ":");
|
|
|
|
if (Split.size() == 1)
|
|
|
|
{
|
|
|
|
Split = StringSplit(a_Value, "^");
|
|
|
|
}
|
|
|
|
if (Split.empty())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
short ItemType = (short)atoi(Split[0].c_str());
|
|
|
|
short ItemDamage = (Split.size() > 1) ? (short)atoi(Split[1].c_str()) : -1;
|
|
|
|
m_Map[a_Name] = std::make_pair(ItemType, ItemDamage);
|
|
|
|
}
|
2012-06-14 09:06:06 -04:00
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static cBlockIDMap gsBlockIDMap;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-08 12:08:29 -04:00
|
|
|
/*
|
|
|
|
// Quick self-test:
|
|
|
|
class Tester
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Tester(void)
|
|
|
|
{
|
|
|
|
cItem Item;
|
|
|
|
gsBlockIDMap.ResolveItem("charcoal", Item);
|
|
|
|
AString Charcoal = gsBlockIDMap.Desolve(Item.m_ItemType, Item.m_ItemDamage);
|
|
|
|
ASSERT(Charcoal == "charcoal");
|
|
|
|
}
|
|
|
|
} test;
|
|
|
|
//*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-07-16 15:20:37 -04:00
|
|
|
BLOCKTYPE BlockStringToType(const AString & a_BlockTypeString)
|
2012-06-14 09:06:06 -04:00
|
|
|
{
|
|
|
|
int res = atoi(a_BlockTypeString.c_str());
|
|
|
|
if ((res != 0) || (a_BlockTypeString.compare("0") == 0))
|
|
|
|
{
|
|
|
|
// It was a valid number, return that
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
return gsBlockIDMap.Resolve(TrimString(a_BlockTypeString));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool StringToItem(const AString & a_ItemTypeString, cItem & a_Item)
|
|
|
|
{
|
2012-09-08 12:08:29 -04:00
|
|
|
return gsBlockIDMap.ResolveItem(TrimString(a_ItemTypeString), a_Item);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AString ItemToString(const cItem & a_Item)
|
|
|
|
{
|
|
|
|
return gsBlockIDMap.Desolve(a_Item.m_ItemType, a_Item.m_ItemDamage);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AString ItemTypeToString(short a_ItemType)
|
|
|
|
{
|
|
|
|
return gsBlockIDMap.Desolve(a_ItemType, -1);
|
2012-06-14 09:06:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-20 09:25:54 -04:00
|
|
|
AString ItemToFullString(const cItem & a_Item)
|
|
|
|
{
|
|
|
|
AString res;
|
2013-01-11 23:46:01 -05:00
|
|
|
Printf(res, "%s:%d * %d", ItemToString(a_Item).c_str(), a_Item.m_ItemDamage, a_Item.m_ItemCount);
|
2012-09-20 09:25:54 -04:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-06-14 09:06:06 -04:00
|
|
|
EMCSBiome StringToBiome(const AString & a_BiomeString)
|
|
|
|
{
|
|
|
|
// If it is a number, return it:
|
|
|
|
int res = atoi(a_BiomeString.c_str());
|
|
|
|
if ((res != 0) || (a_BiomeString.compare("0") == 0))
|
|
|
|
{
|
|
|
|
// It was a valid number
|
|
|
|
return (EMCSBiome)res;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Convert using the built-in map:
|
|
|
|
static struct {
|
|
|
|
EMCSBiome m_Biome;
|
|
|
|
const char * m_String;
|
|
|
|
} BiomeMap[] =
|
|
|
|
{
|
|
|
|
{biOcean, "Ocean"} ,
|
|
|
|
{biPlains, "Plains"},
|
|
|
|
{biDesert, "Desert"},
|
|
|
|
{biExtremeHills, "ExtremeHills"},
|
|
|
|
{biForest, "Forest"},
|
|
|
|
{biTaiga, "Taiga"},
|
|
|
|
{biSwampland, "Swampland"},
|
|
|
|
{biRiver, "River"},
|
2013-08-16 04:48:19 -04:00
|
|
|
{biNether, "Hell"},
|
|
|
|
{biNether, "Nether"},
|
|
|
|
{biEnd, "Sky"},
|
|
|
|
{biEnd, "End"},
|
2012-06-14 09:06:06 -04:00
|
|
|
{biFrozenOcean, "FrozenOcean"},
|
|
|
|
{biFrozenRiver, "FrozenRiver"},
|
|
|
|
{biIcePlains, "IcePlains"},
|
|
|
|
{biIcePlains, "Tundra"},
|
|
|
|
{biIceMountains, "IceMountains"},
|
|
|
|
{biMushroomIsland, "MushroomIsland"},
|
|
|
|
{biMushroomShore, "MushroomShore"},
|
|
|
|
{biBeach, "Beach"},
|
|
|
|
{biDesertHills, "DesertHills"},
|
|
|
|
{biForestHills, "ForestHills"},
|
|
|
|
{biTaigaHills, "TaigaHills"},
|
|
|
|
{biExtremeHillsEdge, "ExtremeHillsEdge"},
|
|
|
|
{biJungle, "Jungle"},
|
|
|
|
{biJungleHills, "JungleHills"},
|
2013-10-12 17:49:55 -04:00
|
|
|
|
|
|
|
// Release 1.7 biomes:
|
|
|
|
{biJungleEdge, "JungleEdge"},
|
|
|
|
{biDeepOcean, "DeepOcean"},
|
|
|
|
{biStoneBeach, "StoneBeach"},
|
|
|
|
{biColdBeach, "ColdBeach"},
|
|
|
|
{biBirchForest, "BirchForest"},
|
|
|
|
{biBirchForestHills, "BirchForestHills"},
|
|
|
|
{biRoofedForest, "RoofedForest"},
|
|
|
|
{biColdTaiga, "ColdTaiga"},
|
|
|
|
{biColdTaigaHills, "ColdTaigaHills"},
|
|
|
|
{biMegaTaiga, "MegaTaiga"},
|
|
|
|
{biMegaTaigaHills, "MegaTaigaHills"},
|
|
|
|
{biExtremeHillsPlus, "ExtremeHillsPlus"},
|
|
|
|
{biSavanna, "Savanna"},
|
|
|
|
{biSavannaPlateau, "SavannaPlateau"},
|
|
|
|
{biMesa, "Mesa"},
|
|
|
|
{biMesaPlateauF, "MesaPlateauF"},
|
|
|
|
{biMesaPlateau, "MesaPlateau"},
|
|
|
|
|
|
|
|
// Release 1.7 variants:
|
|
|
|
{biSunflowerPlains, "SunflowerPlains"},
|
|
|
|
{biDesertM, "DesertM"},
|
|
|
|
{biExtremeHillsM, "ExtremeHillsM"},
|
|
|
|
{biFlowerForest, "FlowerForest"},
|
|
|
|
{biTaigaM, "TaigaM"},
|
|
|
|
{biSwamplandM, "SwamplandM"},
|
|
|
|
{biIcePlainsSpikes, "IcePlainsSpikes"},
|
|
|
|
{biJungleM, "JungleM"},
|
|
|
|
{biJungleEdgeM, "JungleEdgeM"},
|
|
|
|
{biBirchForestM, "BirchForestM"},
|
|
|
|
{biBirchForestHillsM, "BirchForestHillsM"},
|
|
|
|
{biRoofedForestM, "RoofedForestM"},
|
|
|
|
{biColdTaigaM, "ColdTaigaM"},
|
|
|
|
{biMegaSpruceTaiga, "MegaSpruceTaiga"},
|
|
|
|
{biMegaSpruceTaigaHills, "MegaSpruceTaigaHills"},
|
|
|
|
{biExtremeHillsPlusM, "ExtremeHillsPlusM"},
|
|
|
|
{biSavannaM, "SavannaM"},
|
|
|
|
{biSavannaPlateauM, "SavannaPlateauM"},
|
|
|
|
{biMesaBryce, "MesaBryce"},
|
|
|
|
{biMesaPlateauFM, "MesaPlateauFM"},
|
|
|
|
{biMesaPlateauM, "MesaPlateauM"},
|
2012-06-14 09:06:06 -04:00
|
|
|
} ;
|
|
|
|
|
|
|
|
for (int i = 0; i < ARRAYCOUNT(BiomeMap); i++)
|
|
|
|
{
|
|
|
|
if (NoCaseCompare(BiomeMap[i].m_String, a_BiomeString) == 0)
|
|
|
|
{
|
|
|
|
return BiomeMap[i].m_Biome;
|
|
|
|
}
|
|
|
|
} // for i - BiomeMap[]
|
|
|
|
return (EMCSBiome)-1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-12 16:28:41 -04:00
|
|
|
int StringToMobType(const AString & a_MobString)
|
|
|
|
{
|
|
|
|
static struct {
|
|
|
|
int m_MobType;
|
|
|
|
const char * m_String;
|
|
|
|
} MobMap [] =
|
|
|
|
{
|
2013-08-16 04:48:19 -04:00
|
|
|
{cMonster::mtCreeper, "Creeper"},
|
|
|
|
{cMonster::mtSkeleton, "Skeleton"},
|
|
|
|
{cMonster::mtSpider, "Spider"},
|
|
|
|
{cMonster::mtGiant, "Giant"},
|
|
|
|
{cMonster::mtZombie, "Zombie"},
|
|
|
|
{cMonster::mtSlime, "Slime"},
|
|
|
|
{cMonster::mtGhast, "Ghast"},
|
|
|
|
{cMonster::mtZombiePigman, "ZombiePigman"},
|
|
|
|
{cMonster::mtEnderman, "Enderman"},
|
|
|
|
{cMonster::mtCaveSpider, "CaveSpider"},
|
|
|
|
{cMonster::mtSilverfish, "SilverFish"},
|
|
|
|
{cMonster::mtBlaze, "Blaze"},
|
|
|
|
{cMonster::mtMagmaCube, "MagmaCube"},
|
|
|
|
{cMonster::mtEnderDragon, "EnderDragon"},
|
|
|
|
{cMonster::mtWither, "Wither"},
|
|
|
|
{cMonster::mtBat, "Bat"},
|
|
|
|
{cMonster::mtWitch, "Witch"},
|
|
|
|
{cMonster::mtPig, "Pig"},
|
|
|
|
{cMonster::mtSheep, "Sheep"},
|
|
|
|
{cMonster::mtCow, "Cow"},
|
|
|
|
{cMonster::mtChicken, "Chicken"},
|
|
|
|
{cMonster::mtSquid, "Squid"},
|
|
|
|
{cMonster::mtWolf, "Wolf"},
|
|
|
|
{cMonster::mtMooshroom, "Mooshroom"},
|
|
|
|
{cMonster::mtSnowGolem, "SnowGolem"},
|
|
|
|
{cMonster::mtOcelot, "Ocelot"},
|
|
|
|
{cMonster::mtIronGolem, "IronGolem"},
|
|
|
|
{cMonster::mtVillager, "Villager"},
|
2013-07-12 16:28:41 -04:00
|
|
|
};
|
|
|
|
for (int i = 0; i < ARRAYCOUNT(MobMap); i++)
|
|
|
|
{
|
|
|
|
if (NoCaseCompare(MobMap[i].m_String, a_MobString) == 0)
|
|
|
|
{
|
|
|
|
return MobMap[i].m_MobType;
|
|
|
|
}
|
|
|
|
} // for i - MobMap[]
|
2013-08-16 04:48:19 -04:00
|
|
|
return -1;
|
2013-07-12 16:28:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-22 14:41:08 -04:00
|
|
|
eDimension StringToDimension(const AString & a_DimensionString)
|
|
|
|
{
|
2013-07-01 14:46:45 -04:00
|
|
|
// First try decoding as a number
|
2013-06-22 14:41:08 -04:00
|
|
|
int res = atoi(a_DimensionString.c_str());
|
|
|
|
if ((res != 0) || (a_DimensionString == "0"))
|
|
|
|
{
|
|
|
|
// It was a valid number
|
|
|
|
return (eDimension)res;
|
|
|
|
}
|
|
|
|
|
2013-07-01 14:46:45 -04:00
|
|
|
// Decode using a built-in map:
|
2013-06-22 14:41:08 -04:00
|
|
|
static struct
|
|
|
|
{
|
|
|
|
eDimension m_Dimension;
|
|
|
|
const char * m_String;
|
|
|
|
} DimensionMap [] =
|
|
|
|
{
|
|
|
|
{ dimOverworld, "Overworld"},
|
|
|
|
{ dimOverworld, "Normal"},
|
|
|
|
{ dimOverworld, "World"},
|
|
|
|
{ dimNether, "Nether"},
|
|
|
|
{ dimNether, "Hell"}, // Alternate name for End
|
|
|
|
{ dimEnd, "End"},
|
|
|
|
{ dimEnd, "Sky"}, // Old name for End
|
|
|
|
} ;
|
|
|
|
for (int i = 0; i < ARRAYCOUNT(DimensionMap); i++)
|
|
|
|
{
|
|
|
|
if (NoCaseCompare(DimensionMap[i].m_String, a_DimensionString) == 0)
|
|
|
|
{
|
|
|
|
return DimensionMap[i].m_Dimension;
|
|
|
|
}
|
|
|
|
} // for i - DimensionMap[]
|
|
|
|
|
|
|
|
// Not found
|
|
|
|
return (eDimension)-1000;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-07-01 14:46:45 -04:00
|
|
|
/// Translates damage type constant to a string representation (built-in).
|
|
|
|
AString DamageTypeToString(eDamageType a_DamageType)
|
|
|
|
{
|
2013-11-13 15:13:35 -05:00
|
|
|
// Make sure to keep this alpha-sorted.
|
2013-07-01 14:46:45 -04:00
|
|
|
switch (a_DamageType)
|
|
|
|
{
|
2013-11-13 15:13:35 -05:00
|
|
|
case dtAdmin: return "dtAdmin";
|
2013-07-01 14:46:45 -04:00
|
|
|
case dtAttack: return "dtAttack";
|
|
|
|
case dtCactusContact: return "dtCactusContact";
|
2013-11-13 15:13:35 -05:00
|
|
|
case dtDrowning: return "dtDrowning";
|
|
|
|
case dtEnderPearl: return "dtEnderPearl";
|
|
|
|
case dtFalling: return "dtFalling";
|
2013-07-01 14:46:45 -04:00
|
|
|
case dtFireContact: return "dtFireContact";
|
|
|
|
case dtInVoid: return "dtInVoid";
|
2013-11-13 15:13:35 -05:00
|
|
|
case dtLavaContact: return "dtLavaContact";
|
|
|
|
case dtLightning: return "dtLightning";
|
|
|
|
case dtOnFire: return "dtOnFire";
|
|
|
|
case dtPoisoning: return "dtPoisoning";
|
2013-07-01 14:46:45 -04:00
|
|
|
case dtPotionOfHarming: return "dtPotionOfHarming";
|
2013-11-13 15:13:35 -05:00
|
|
|
case dtRangedAttack: return "dtRangedAttack";
|
|
|
|
case dtStarving: return "dtStarving";
|
|
|
|
case dtSuffocating: return "dtSuffocation";
|
|
|
|
|
2013-07-01 14:46:45 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Unknown damage type:
|
|
|
|
ASSERT(!"Unknown DamageType");
|
|
|
|
return Printf("dtUnknown_%d", (int)a_DamageType);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Translates a damage type string to damage type. Takes either a number or a damage type alias (built-in). Returns -1 on failure
|
|
|
|
eDamageType StringToDamageType(const AString & a_DamageTypeString)
|
|
|
|
{
|
|
|
|
// First try decoding as a number:
|
|
|
|
int res = atoi(a_DamageTypeString.c_str());
|
|
|
|
if ((res != 0) || (a_DamageTypeString == "0"))
|
|
|
|
{
|
|
|
|
// It was a valid number
|
|
|
|
return (eDamageType)res;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Decode using a built-in map:
|
|
|
|
static struct
|
|
|
|
{
|
|
|
|
eDamageType m_DamageType;
|
|
|
|
const char * m_String;
|
|
|
|
} DamageTypeMap [] =
|
|
|
|
{
|
|
|
|
// Cannonical names:
|
|
|
|
{ dtAttack, "dtAttack"},
|
2013-09-01 14:06:49 -04:00
|
|
|
{ dtRangedAttack, "dtRangedAttack"},
|
2013-07-01 14:46:45 -04:00
|
|
|
{ dtLightning, "dtLightning"},
|
|
|
|
{ dtFalling, "dtFalling"},
|
|
|
|
{ dtDrowning, "dtDrowning"},
|
|
|
|
{ dtSuffocating, "dtSuffocation"},
|
|
|
|
{ dtStarving, "dtStarving"},
|
|
|
|
{ dtCactusContact, "dtCactusContact"},
|
|
|
|
{ dtLavaContact, "dtLavaContact"},
|
|
|
|
{ dtPoisoning, "dtPoisoning"},
|
|
|
|
{ dtOnFire, "dtOnFire"},
|
|
|
|
{ dtFireContact, "dtFireContact"},
|
|
|
|
{ dtInVoid, "dtInVoid"},
|
|
|
|
{ dtPotionOfHarming, "dtPotionOfHarming"},
|
|
|
|
{ dtAdmin, "dtAdmin"},
|
|
|
|
|
|
|
|
// Common synonyms:
|
2013-09-01 14:06:49 -04:00
|
|
|
{ dtAttack, "dtPawnAttack"},
|
|
|
|
{ dtAttack, "dtEntityAttack"},
|
|
|
|
{ dtAttack, "dtMob"},
|
|
|
|
{ dtAttack, "dtMobAttack"},
|
|
|
|
{ dtRangedAttack, "dtArrowAttack"},
|
|
|
|
{ dtRangedAttack, "dtArrow"},
|
|
|
|
{ dtRangedAttack, "dtProjectile"},
|
|
|
|
{ dtFalling, "dtFall"},
|
|
|
|
{ dtDrowning, "dtDrown"},
|
|
|
|
{ dtSuffocating, "dtSuffocation"},
|
|
|
|
{ dtStarving, "dtStarvation"},
|
|
|
|
{ dtStarving, "dtHunger"},
|
|
|
|
{ dtCactusContact, "dtCactus"},
|
|
|
|
{ dtCactusContact, "dtCactuses"},
|
|
|
|
{ dtCactusContact, "dtCacti"},
|
|
|
|
{ dtLavaContact, "dtLava"},
|
|
|
|
{ dtPoisoning, "dtPoison"},
|
|
|
|
{ dtOnFire, "dtBurning"},
|
|
|
|
{ dtFireContact, "dtInFire"},
|
|
|
|
{ dtAdmin, "dtPlugin"},
|
2013-07-01 14:46:45 -04:00
|
|
|
} ;
|
|
|
|
for (int i = 0; i < ARRAYCOUNT(DamageTypeMap); i++)
|
|
|
|
{
|
|
|
|
if (NoCaseCompare(DamageTypeMap[i].m_String, a_DamageTypeString) == 0)
|
|
|
|
{
|
|
|
|
return DamageTypeMap[i].m_DamageType;
|
|
|
|
}
|
|
|
|
} // for i - DamageTypeMap[]
|
|
|
|
|
|
|
|
// Not found:
|
|
|
|
return (eDamageType)-1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-10-11 04:12:36 -04:00
|
|
|
cItem GetIniItemSet(cIniFile & a_IniFile, const char * a_Section, const char * a_Key, const char * a_Default)
|
|
|
|
{
|
|
|
|
AString ItemStr = a_IniFile.GetValueSet(a_Section, a_Key, a_Default);
|
|
|
|
cItem res;
|
|
|
|
if (!StringToItem(ItemStr, res))
|
|
|
|
{
|
|
|
|
res.Empty();
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-06-14 09:06:06 -04:00
|
|
|
// This is actually just some code that needs to run at program startup, so it is wrapped into a global var's constructor:
|
|
|
|
class cBlockPropertiesInitializer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cBlockPropertiesInitializer(void)
|
|
|
|
{
|
2012-08-14 04:32:23 -04:00
|
|
|
memset(g_BlockLightValue, 0x00, sizeof(g_BlockLightValue));
|
|
|
|
memset(g_BlockSpreadLightFalloff, 0x0f, sizeof(g_BlockSpreadLightFalloff)); // 0x0f means total falloff
|
|
|
|
memset(g_BlockTransparent, 0x00, sizeof(g_BlockTransparent));
|
|
|
|
memset(g_BlockOneHitDig, 0x00, sizeof(g_BlockOneHitDig));
|
|
|
|
memset(g_BlockPistonBreakable, 0x00, sizeof(g_BlockPistonBreakable));
|
2013-09-15 10:55:35 -04:00
|
|
|
memset(g_BlockIsTorchPlaceable, 0x00, sizeof(g_BlockIsTorchPlaceable));
|
2012-11-18 16:50:05 -05:00
|
|
|
|
|
|
|
// Setting bools to true must be done manually, see http://forum.mc-server.org/showthread.php?tid=629&pid=5415#pid5415
|
|
|
|
for (int i = 0; i < ARRAYCOUNT(g_BlockIsSnowable); i++)
|
|
|
|
{
|
|
|
|
g_BlockIsSnowable[i] = true;
|
|
|
|
}
|
2012-08-14 04:32:23 -04:00
|
|
|
memset(g_BlockRequiresSpecialTool, 0x00, sizeof(g_BlockRequiresSpecialTool)); // Set all blocks to false
|
2012-11-18 16:50:05 -05:00
|
|
|
|
|
|
|
// Setting bools to true must be done manually, see http://forum.mc-server.org/showthread.php?tid=629&pid=5415#pid5415
|
|
|
|
for (int i = 0; i < ARRAYCOUNT(g_BlockIsSolid); i++)
|
|
|
|
{
|
|
|
|
g_BlockIsSolid[i] = true;
|
|
|
|
}
|
2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
// Emissive blocks
|
|
|
|
g_BlockLightValue[E_BLOCK_FIRE] = 15;
|
|
|
|
g_BlockLightValue[E_BLOCK_GLOWSTONE] = 15;
|
|
|
|
g_BlockLightValue[E_BLOCK_JACK_O_LANTERN] = 15;
|
|
|
|
g_BlockLightValue[E_BLOCK_LAVA] = 15;
|
|
|
|
g_BlockLightValue[E_BLOCK_STATIONARY_LAVA] = 15;
|
|
|
|
g_BlockLightValue[E_BLOCK_END_PORTAL] = 15;
|
|
|
|
g_BlockLightValue[E_BLOCK_REDSTONE_LAMP_ON] = 15;
|
|
|
|
g_BlockLightValue[E_BLOCK_TORCH] = 14;
|
|
|
|
g_BlockLightValue[E_BLOCK_BURNING_FURNACE] = 13;
|
|
|
|
g_BlockLightValue[E_BLOCK_NETHER_PORTAL] = 11;
|
|
|
|
g_BlockLightValue[E_BLOCK_REDSTONE_ORE_GLOWING] = 9;
|
|
|
|
g_BlockLightValue[E_BLOCK_REDSTONE_REPEATER_ON] = 9;
|
|
|
|
g_BlockLightValue[E_BLOCK_REDSTONE_TORCH_ON] = 7;
|
|
|
|
g_BlockLightValue[E_BLOCK_BREWING_STAND] = 1;
|
|
|
|
g_BlockLightValue[E_BLOCK_BROWN_MUSHROOM] = 1;
|
|
|
|
g_BlockLightValue[E_BLOCK_DRAGON_EGG] = 1;
|
|
|
|
|
|
|
|
// Spread blocks
|
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_AIR] = 1;
|
2012-06-16 14:44:07 -04:00
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_CAKE] = 1;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_CHEST] = 1;
|
2013-04-01 17:36:28 -04:00
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_COBWEB] = 1;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_CROPS] = 1;
|
2012-06-16 14:44:07 -04:00
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_FENCE] = 1;
|
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_FENCE_GATE] = 1;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_FIRE] = 1;
|
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_GLASS] = 1;
|
2013-02-16 06:12:56 -05:00
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_GLASS_PANE] = 1;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_GLOWSTONE] = 1;
|
2012-06-16 14:44:07 -04:00
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_IRON_BARS] = 1;
|
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_IRON_DOOR] = 1;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_LEAVES] = 1;
|
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_SIGN_POST] = 1;
|
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_TORCH] = 1;
|
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_VINES] = 1;
|
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_WALLSIGN] = 1;
|
2012-06-16 14:44:07 -04:00
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_WOODEN_DOOR] = 1;
|
2012-10-23 15:48:16 -04:00
|
|
|
|
2012-06-14 09:06:06 -04:00
|
|
|
// Light in water and lava dissapears faster:
|
2013-05-05 10:48:18 -04:00
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_LAVA] = 3;
|
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_STATIONARY_LAVA] = 3;
|
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_STATIONARY_WATER] = 3;
|
|
|
|
g_BlockSpreadLightFalloff[E_BLOCK_WATER] = 3;
|
2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
// Transparent blocks
|
2013-08-20 15:15:21 -04:00
|
|
|
g_BlockTransparent[E_BLOCK_ACTIVATOR_RAIL] = true;
|
2013-11-12 16:08:33 -05:00
|
|
|
g_BlockTransparent[E_BLOCK_AIR] = true;
|
2013-11-12 13:26:35 -05:00
|
|
|
g_BlockTransparent[E_BLOCK_BIG_FLOWER] = true;
|
2012-12-26 20:01:16 -05:00
|
|
|
g_BlockTransparent[E_BLOCK_BROWN_MUSHROOM] = true;
|
2013-04-05 09:45:00 -04:00
|
|
|
g_BlockTransparent[E_BLOCK_CARROTS] = true;
|
2012-12-26 20:01:16 -05:00
|
|
|
g_BlockTransparent[E_BLOCK_CHEST] = true;
|
|
|
|
g_BlockTransparent[E_BLOCK_COBWEB] = true;
|
|
|
|
g_BlockTransparent[E_BLOCK_CROPS] = true;
|
2013-11-12 13:26:35 -05:00
|
|
|
g_BlockTransparent[E_BLOCK_DANDELION] = true;
|
2012-12-26 20:01:16 -05:00
|
|
|
g_BlockTransparent[E_BLOCK_DETECTOR_RAIL] = true;
|
|
|
|
g_BlockTransparent[E_BLOCK_FENCE] = true;
|
|
|
|
g_BlockTransparent[E_BLOCK_FENCE_GATE] = true;
|
|
|
|
g_BlockTransparent[E_BLOCK_FIRE] = true;
|
2013-11-12 13:26:35 -05:00
|
|
|
g_BlockTransparent[E_BLOCK_FLOWER] = true;
|
2012-12-26 20:01:16 -05:00
|
|
|
g_BlockTransparent[E_BLOCK_FLOWER_POT] = true;
|
|
|
|
g_BlockTransparent[E_BLOCK_GLASS] = true;
|
2013-10-01 13:48:07 -04:00
|
|
|
g_BlockTransparent[E_BLOCK_GLASS_PANE] = true;
|
2013-11-12 13:12:26 -05:00
|
|
|
g_BlockTransparent[E_BLOCK_STAINED_GLASS] = true;
|
|
|
|
g_BlockTransparent[E_BLOCK_STAINED_GLASS_PANE] = true;
|
2012-12-26 20:01:16 -05:00
|
|
|
g_BlockTransparent[E_BLOCK_ICE] = true;
|
|
|
|
g_BlockTransparent[E_BLOCK_IRON_DOOR] = true;
|
2013-09-07 14:00:04 -04:00
|
|
|
g_BlockTransparent[E_BLOCK_LAVA] = true;
|
2012-12-26 20:01:16 -05:00
|
|
|
g_BlockTransparent[E_BLOCK_LEAVES] = true;
|
|
|
|
g_BlockTransparent[E_BLOCK_LEVER] = true;
|
2013-04-05 09:45:00 -04:00
|
|
|
g_BlockTransparent[E_BLOCK_MELON_STEM] = true;
|
2012-12-26 20:01:16 -05:00
|
|
|
g_BlockTransparent[E_BLOCK_NETHER_BRICK_FENCE] = true;
|
2013-11-12 16:08:33 -05:00
|
|
|
g_BlockTransparent[E_BLOCK_NEW_LEAVES] = true;
|
2013-04-05 09:45:00 -04:00
|
|
|
g_BlockTransparent[E_BLOCK_POTATOES] = true;
|
2012-12-26 20:01:16 -05:00
|
|
|
g_BlockTransparent[E_BLOCK_POWERED_RAIL] = true;
|
2013-08-20 15:15:21 -04:00
|
|
|
g_BlockTransparent[E_BLOCK_PISTON_EXTENSION] = true;
|
2013-04-05 09:45:00 -04:00
|
|
|
g_BlockTransparent[E_BLOCK_PUMPKIN_STEM] = true;
|
2012-12-26 20:01:16 -05:00
|
|
|
g_BlockTransparent[E_BLOCK_RAIL] = true;
|
|
|
|
g_BlockTransparent[E_BLOCK_RED_MUSHROOM] = true;
|
|
|
|
g_BlockTransparent[E_BLOCK_SIGN_POST] = true;
|
2013-11-12 16:08:33 -05:00
|
|
|
g_BlockTransparent[E_BLOCK_SNOW] = true;
|
2013-09-07 14:00:04 -04:00
|
|
|
g_BlockTransparent[E_BLOCK_STATIONARY_LAVA] = true;
|
|
|
|
g_BlockTransparent[E_BLOCK_STATIONARY_WATER] = true;
|
2012-12-26 20:01:16 -05:00
|
|
|
g_BlockTransparent[E_BLOCK_STONE_PRESSURE_PLATE] = true;
|
|
|
|
g_BlockTransparent[E_BLOCK_TALL_GRASS] = true;
|
|
|
|
g_BlockTransparent[E_BLOCK_TORCH] = true;
|
|
|
|
g_BlockTransparent[E_BLOCK_VINES] = true;
|
|
|
|
g_BlockTransparent[E_BLOCK_WALLSIGN] = true;
|
2013-11-12 16:08:33 -05:00
|
|
|
g_BlockTransparent[E_BLOCK_WATER] = true;
|
2012-12-26 20:01:16 -05:00
|
|
|
g_BlockTransparent[E_BLOCK_WOODEN_DOOR] = true;
|
|
|
|
g_BlockTransparent[E_BLOCK_WOODEN_PRESSURE_PLATE] = true;
|
2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
// TODO: Any other transparent blocks?
|
|
|
|
|
|
|
|
// One hit break blocks
|
2013-09-18 13:27:21 -04:00
|
|
|
g_BlockOneHitDig[E_BLOCK_ACTIVE_COMPARATOR] = true;
|
2013-11-12 13:12:26 -05:00
|
|
|
g_BlockOneHitDig[E_BLOCK_BIG_FLOWER] = true;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockOneHitDig[E_BLOCK_BROWN_MUSHROOM] = true;
|
2013-04-05 09:45:00 -04:00
|
|
|
g_BlockOneHitDig[E_BLOCK_CARROTS] = true;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockOneHitDig[E_BLOCK_CROPS] = true;
|
2013-11-12 13:12:26 -05:00
|
|
|
g_BlockOneHitDig[E_BLOCK_DANDELION] = true;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockOneHitDig[E_BLOCK_FIRE] = true;
|
2013-11-12 13:12:26 -05:00
|
|
|
g_BlockOneHitDig[E_BLOCK_FLOWER] = true;
|
2012-12-26 20:01:16 -05:00
|
|
|
g_BlockOneHitDig[E_BLOCK_FLOWER_POT] = true;
|
2013-09-18 13:27:21 -04:00
|
|
|
g_BlockOneHitDig[E_BLOCK_INACTIVE_COMPARATOR] = true;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockOneHitDig[E_BLOCK_LOCKED_CHEST] = true;
|
2013-04-05 09:45:00 -04:00
|
|
|
g_BlockOneHitDig[E_BLOCK_MELON_STEM] = true;
|
|
|
|
g_BlockOneHitDig[E_BLOCK_POTATOES] = true;
|
|
|
|
g_BlockOneHitDig[E_BLOCK_PUMPKIN_STEM] = true;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockOneHitDig[E_BLOCK_REDSTONE_REPEATER_OFF] = true;
|
|
|
|
g_BlockOneHitDig[E_BLOCK_REDSTONE_REPEATER_ON] = true;
|
|
|
|
g_BlockOneHitDig[E_BLOCK_REDSTONE_TORCH_OFF] = true;
|
|
|
|
g_BlockOneHitDig[E_BLOCK_REDSTONE_TORCH_ON] = true;
|
|
|
|
g_BlockOneHitDig[E_BLOCK_REDSTONE_WIRE] = true;
|
|
|
|
g_BlockOneHitDig[E_BLOCK_RED_MUSHROOM] = true;
|
|
|
|
g_BlockOneHitDig[E_BLOCK_REEDS] = true;
|
|
|
|
g_BlockOneHitDig[E_BLOCK_SAPLING] = true;
|
|
|
|
g_BlockOneHitDig[E_BLOCK_TNT] = true;
|
|
|
|
g_BlockOneHitDig[E_BLOCK_TALL_GRASS] = true;
|
|
|
|
g_BlockOneHitDig[E_BLOCK_TORCH] = true;
|
|
|
|
|
|
|
|
// Blocks that breaks when pushed by piston
|
2013-09-18 13:27:21 -04:00
|
|
|
g_BlockPistonBreakable[E_BLOCK_ACTIVE_COMPARATOR] = true;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockPistonBreakable[E_BLOCK_AIR] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_BED] = true;
|
2013-11-12 13:12:26 -05:00
|
|
|
g_BlockPistonBreakable[E_BLOCK_BIG_FLOWER] = true;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockPistonBreakable[E_BLOCK_BROWN_MUSHROOM] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_COBWEB] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_CROPS] = true;
|
2013-11-12 13:12:26 -05:00
|
|
|
g_BlockPistonBreakable[E_BLOCK_DANDELION] = true;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockPistonBreakable[E_BLOCK_DEAD_BUSH] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_FIRE] = true;
|
2013-11-12 13:12:26 -05:00
|
|
|
g_BlockPistonBreakable[E_BLOCK_FLOWER] = true;
|
2013-09-18 13:27:21 -04:00
|
|
|
g_BlockPistonBreakable[E_BLOCK_INACTIVE_COMPARATOR] = true;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockPistonBreakable[E_BLOCK_IRON_DOOR] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_JACK_O_LANTERN] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_LADDER] = true;
|
2013-08-14 06:50:21 -04:00
|
|
|
g_BlockPistonBreakable[E_BLOCK_LAVA] = true;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockPistonBreakable[E_BLOCK_LEVER] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_MELON] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_MELON_STEM] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_PUMPKIN] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_PUMPKIN_STEM] = true;
|
2013-08-16 06:23:24 -04:00
|
|
|
g_BlockPistonBreakable[E_BLOCK_REDSTONE_REPEATER_OFF] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_REDSTONE_REPEATER_ON] = true;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockPistonBreakable[E_BLOCK_REDSTONE_TORCH_OFF] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_REDSTONE_TORCH_ON] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_REDSTONE_WIRE] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_RED_MUSHROOM] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_REEDS] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_SNOW] = true;
|
2013-08-14 06:44:02 -04:00
|
|
|
g_BlockPistonBreakable[E_BLOCK_STATIONARY_LAVA] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_STATIONARY_WATER] = true;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockPistonBreakable[E_BLOCK_STONE_BUTTON] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_STONE_PRESSURE_PLATE] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_TALL_GRASS] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_TORCH] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_VINES] = true;
|
2013-08-14 06:50:21 -04:00
|
|
|
g_BlockPistonBreakable[E_BLOCK_WATER] = true;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockPistonBreakable[E_BLOCK_WOODEN_DOOR] = true;
|
|
|
|
g_BlockPistonBreakable[E_BLOCK_WOODEN_PRESSURE_PLATE] = true;
|
|
|
|
|
2013-08-14 06:50:21 -04:00
|
|
|
|
2012-06-14 09:06:06 -04:00
|
|
|
// Blocks that can be snowed over:
|
2013-09-18 13:27:21 -04:00
|
|
|
g_BlockIsSnowable[E_BLOCK_ACTIVE_COMPARATOR] = false;
|
2012-10-21 17:15:57 -04:00
|
|
|
g_BlockIsSnowable[E_BLOCK_AIR] = false;
|
2013-11-12 13:12:26 -05:00
|
|
|
g_BlockIsSnowable[E_BLOCK_BIG_FLOWER] = false;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockIsSnowable[E_BLOCK_BROWN_MUSHROOM] = false;
|
|
|
|
g_BlockIsSnowable[E_BLOCK_CACTUS] = false;
|
|
|
|
g_BlockIsSnowable[E_BLOCK_CHEST] = false;
|
|
|
|
g_BlockIsSnowable[E_BLOCK_CROPS] = false;
|
2013-11-12 13:12:26 -05:00
|
|
|
g_BlockIsSnowable[E_BLOCK_DANDELION] = false;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockIsSnowable[E_BLOCK_FIRE] = false;
|
2013-11-12 13:12:26 -05:00
|
|
|
g_BlockIsSnowable[E_BLOCK_FLOWER] = false;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockIsSnowable[E_BLOCK_GLASS] = false;
|
|
|
|
g_BlockIsSnowable[E_BLOCK_ICE] = false;
|
2013-09-18 13:27:21 -04:00
|
|
|
g_BlockIsSnowable[E_BLOCK_INACTIVE_COMPARATOR] = false;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockIsSnowable[E_BLOCK_LAVA] = false;
|
2013-09-08 12:39:35 -04:00
|
|
|
g_BlockIsSnowable[E_BLOCK_LILY_PAD] = false;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockIsSnowable[E_BLOCK_LOCKED_CHEST] = false;
|
|
|
|
g_BlockIsSnowable[E_BLOCK_REDSTONE_REPEATER_OFF] = false;
|
|
|
|
g_BlockIsSnowable[E_BLOCK_REDSTONE_REPEATER_ON] = false;
|
|
|
|
g_BlockIsSnowable[E_BLOCK_REDSTONE_TORCH_OFF] = false;
|
|
|
|
g_BlockIsSnowable[E_BLOCK_REDSTONE_TORCH_ON] = false;
|
|
|
|
g_BlockIsSnowable[E_BLOCK_REDSTONE_WIRE] = false;
|
|
|
|
g_BlockIsSnowable[E_BLOCK_RED_MUSHROOM] = false;
|
|
|
|
g_BlockIsSnowable[E_BLOCK_REEDS] = false;
|
|
|
|
g_BlockIsSnowable[E_BLOCK_SAPLING] = false;
|
|
|
|
g_BlockIsSnowable[E_BLOCK_SIGN_POST] = false;
|
|
|
|
g_BlockIsSnowable[E_BLOCK_SNOW] = false;
|
|
|
|
g_BlockIsSnowable[E_BLOCK_STATIONARY_LAVA] = false;
|
|
|
|
g_BlockIsSnowable[E_BLOCK_STATIONARY_WATER] = false;
|
|
|
|
g_BlockIsSnowable[E_BLOCK_TALL_GRASS] = false;
|
|
|
|
g_BlockIsSnowable[E_BLOCK_TNT] = false;
|
|
|
|
g_BlockIsSnowable[E_BLOCK_TORCH] = false;
|
2012-09-07 12:05:10 -04:00
|
|
|
g_BlockIsSnowable[E_BLOCK_VINES] = false;
|
2012-06-14 09:06:06 -04:00
|
|
|
g_BlockIsSnowable[E_BLOCK_WALLSIGN] = false;
|
|
|
|
g_BlockIsSnowable[E_BLOCK_WATER] = false;
|
2013-09-08 12:33:53 -04:00
|
|
|
|
2012-07-15 16:36:34 -04:00
|
|
|
|
2013-09-08 12:39:35 -04:00
|
|
|
// Blocks that don't drop without a special tool
|
2012-10-23 15:48:16 -04:00
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_BRICK] = true;
|
2012-12-29 06:49:00 -05:00
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_CAULDRON] = true;
|
2012-10-23 15:48:16 -04:00
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_COAL_ORE] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_COBBLESTONE] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_COBBLESTONE_STAIRS] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_COBWEB] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_DIAMOND_BLOCK] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_DIAMOND_ORE] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_DOUBLE_STONE_SLAB] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_EMERALD_ORE] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_END_STONE] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_GOLD_BLOCK] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_GOLD_ORE] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_IRON_BLOCK] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_IRON_ORE] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_LAPIS_BLOCK] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_LAPIS_ORE] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_MOSSY_COBBLESTONE] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_NETHERRACK] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_NETHER_BRICK] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_NETHER_BRICK_STAIRS] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_OBSIDIAN] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_REDSTONE_ORE] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_REDSTONE_ORE_GLOWING] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_SANDSTONE] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_SANDSTONE_STAIRS] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_SNOW] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_STONE] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_STONE_BRICKS] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_STONE_BRICK_STAIRS] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_STONE_PRESSURE_PLATE] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_STONE_SLAB] = true;
|
|
|
|
g_BlockRequiresSpecialTool[E_BLOCK_VINES] = true;
|
2012-07-15 16:36:34 -04:00
|
|
|
|
2012-10-23 14:13:37 -04:00
|
|
|
// Nonsolid Blocks:
|
2013-09-15 10:55:35 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_ACTIVATOR_RAIL] = false;
|
2012-10-23 14:13:37 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_AIR] = false;
|
2013-11-12 13:12:26 -05:00
|
|
|
g_BlockIsSolid[E_BLOCK_BIG_FLOWER] = false;
|
2012-10-23 14:13:37 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_BROWN_MUSHROOM] = false;
|
2013-09-15 10:55:35 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_CARROTS] = false;
|
|
|
|
g_BlockIsSolid[E_BLOCK_COBWEB] = false;
|
2012-10-23 14:13:37 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_CROPS] = false;
|
2013-11-12 13:12:26 -05:00
|
|
|
g_BlockIsSolid[E_BLOCK_DANDELION] = false;
|
2013-09-15 10:55:35 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_DETECTOR_RAIL] = false;
|
2012-10-23 15:48:16 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_END_PORTAL] = false;
|
2012-10-23 14:13:37 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_FIRE] = false;
|
2013-11-12 13:12:26 -05:00
|
|
|
g_BlockIsSolid[E_BLOCK_FLOWER] = false;
|
2013-09-15 10:55:35 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE] = false;
|
2012-10-23 14:13:37 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_LAVA] = false;
|
2012-10-23 15:48:16 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_LEVER] = false;
|
2013-09-15 10:55:35 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE] = false;
|
|
|
|
g_BlockIsSolid[E_BLOCK_MELON_STEM] = false;
|
2012-10-23 15:48:16 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_NETHER_PORTAL] = false;
|
|
|
|
g_BlockIsSolid[E_BLOCK_PISTON] = false;
|
|
|
|
g_BlockIsSolid[E_BLOCK_PISTON_EXTENSION] = false;
|
2013-09-15 10:55:35 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_RAIL] = false;
|
2012-10-23 14:13:37 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_REDSTONE_REPEATER_OFF] = false;
|
|
|
|
g_BlockIsSolid[E_BLOCK_REDSTONE_REPEATER_ON] = false;
|
|
|
|
g_BlockIsSolid[E_BLOCK_REDSTONE_TORCH_OFF] = false;
|
|
|
|
g_BlockIsSolid[E_BLOCK_REDSTONE_TORCH_ON] = false;
|
|
|
|
g_BlockIsSolid[E_BLOCK_REDSTONE_WIRE] = false;
|
|
|
|
g_BlockIsSolid[E_BLOCK_RED_MUSHROOM] = false;
|
|
|
|
g_BlockIsSolid[E_BLOCK_REEDS] = false;
|
|
|
|
g_BlockIsSolid[E_BLOCK_SAPLING] = false;
|
|
|
|
g_BlockIsSolid[E_BLOCK_SIGN_POST] = false;
|
|
|
|
g_BlockIsSolid[E_BLOCK_SNOW] = false;
|
|
|
|
g_BlockIsSolid[E_BLOCK_STATIONARY_LAVA] = false;
|
|
|
|
g_BlockIsSolid[E_BLOCK_STATIONARY_WATER] = false;
|
2012-10-23 15:48:16 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_STONE_BUTTON] = false;
|
|
|
|
g_BlockIsSolid[E_BLOCK_STONE_PRESSURE_PLATE] = false;
|
2012-10-23 14:13:37 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_TALL_GRASS] = false;
|
|
|
|
g_BlockIsSolid[E_BLOCK_TORCH] = false;
|
2013-09-15 10:55:35 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_TRIPWIRE] = false;
|
2012-10-23 14:13:37 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_VINES] = false;
|
|
|
|
g_BlockIsSolid[E_BLOCK_WALLSIGN] = false;
|
|
|
|
g_BlockIsSolid[E_BLOCK_WATER] = false;
|
2012-10-23 15:48:16 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_WOODEN_BUTTON] = false;
|
2012-10-23 14:13:37 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_WOODEN_PRESSURE_PLATE] = false;
|
2012-10-23 15:48:16 -04:00
|
|
|
g_BlockIsSolid[E_BLOCK_WOODEN_SLAB] = false;
|
2013-09-15 10:55:35 -04:00
|
|
|
|
|
|
|
// Torch placeable
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_BEDROCK] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_BLOCK_OF_COAL] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_BLOCK_OF_REDSTONE] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_BOOKCASE] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_BRICK] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_CLAY] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_COAL_ORE] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_COBBLESTONE] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_COMMAND_BLOCK] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_CRAFTING_TABLE] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_DIAMOND_BLOCK] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_DIAMOND_ORE] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_DIRT] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_DISPENSER] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_DOUBLE_STONE_SLAB] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_DOUBLE_WOODEN_SLAB] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_DROPPER] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_EMERALD_BLOCK] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_EMERALD_ORE] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_END_STONE] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_FURNACE] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_GLOWSTONE] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_GOLD_BLOCK] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_GOLD_ORE] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_GRASS] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_GRAVEL] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_HARDENED_CLAY] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_HAY_BALE] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_HUGE_BROWN_MUSHROOM] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_HUGE_RED_MUSHROOM] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_IRON_BLOCK] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_IRON_ORE] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_JACK_O_LANTERN] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_JUKEBOX] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_LAPIS_BLOCK] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_LAPIS_ORE] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_LOG] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_MELON] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_MOSSY_COBBLESTONE] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_MYCELIUM] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_NETHERRACK] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_NETHER_BRICK] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_NETHER_QUARTZ_ORE] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_NOTE_BLOCK] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_OBSIDIAN] = true;
|
2013-11-12 16:01:30 -05:00
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_PACKED_ICE] = true;
|
2013-09-15 10:55:35 -04:00
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_PLANKS] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_PUMPKIN] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_QUARTZ_BLOCK] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_REDSTONE_LAMP_OFF] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_REDSTONE_LAMP_ON] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_REDSTONE_ORE] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_REDSTONE_ORE_GLOWING] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_SANDSTONE] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_SAND] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_SILVERFISH_EGG] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_SPONGE] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_STAINED_CLAY] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_WOOL] = true;
|
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_STONE] = true;
|
2013-10-14 18:46:32 -04:00
|
|
|
g_BlockIsTorchPlaceable[E_BLOCK_STONE_BRICKS] = true;
|
2012-10-23 15:48:16 -04:00
|
|
|
}
|
2012-06-14 09:06:06 -04:00
|
|
|
} BlockPropertiesInitializer;
|
2012-10-23 15:48:16 -04:00
|
|
|
|
2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
|