1
0

Many api fixes, add vanilla names to mob type -> string functions and mob spawner fixes.

This commit is contained in:
Howaner 2014-11-29 15:20:44 +01:00
parent 648fee1a08
commit 2478e290f9
13 changed files with 137 additions and 122 deletions

View File

@ -1668,13 +1668,14 @@ a_Player:OpenWindow(Window);
SetCustomName = { Params = "string", Return = "", Notes = "Sets the custom name of the monster. You see the name over the monster. If you want to disable the custom name, simply set an empty string." }, SetCustomName = { Params = "string", Return = "", Notes = "Sets the custom name of the monster. You see the name over the monster. If you want to disable the custom name, simply set an empty string." },
IsCustomNameAlwaysVisible = { Params = "", Return = "bool", Notes = "Is the custom name of this monster always visible? If not, you only see the name when you sight the mob." }, IsCustomNameAlwaysVisible = { Params = "", Return = "bool", Notes = "Is the custom name of this monster always visible? If not, you only see the name when you sight the mob." },
SetCustomNameAlwaysVisible = { Params = "bool", Return = "", Notes = "Sets the custom name visiblity of this monster. If it's false, you only see the name when you sight the mob. If it's true, you always see the custom name." }, SetCustomNameAlwaysVisible = { Params = "bool", Return = "", Notes = "Sets the custom name visiblity of this monster. If it's false, you only see the name when you sight the mob. If it's true, you always see the custom name." },
FamilyFromType = { Params = "{{cMonster#MobType|MobType}}", Return = "{{cMonster#MobFamily|MobFamily}}", Notes = "(STATIC) Returns the mob family ({{cMonster#MobFamily|mfXXX}} constants) based on the mob type ({{cMonster#MobType|mtXXX}} constants)" }, FamilyFromType = { Params = "{{Globals#MobType|MobType}}", Return = "{{cMonster#MobFamily|MobFamily}}", Notes = "(STATIC) Returns the mob family ({{cMonster#MobFamily|mfXXX}} constants) based on the mob type ({{Globals#MobType|mtXXX}} constants)" },
GetMobFamily = { Params = "", Return = "{{cMonster#MobFamily|MobFamily}}", Notes = "Returns this mob's family ({{cMonster#MobFamily|mfXXX}} constant)" }, GetMobFamily = { Params = "", Return = "{{cMonster#MobFamily|MobFamily}}", Notes = "Returns this mob's family ({{cMonster#MobFamily|mfXXX}} constant)" },
GetMobType = { Params = "", Return = "{{cMonster#MobType|MobType}}", Notes = "Returns the type of this mob ({{cMonster#MobType|mtXXX}} constant)" }, GetMobType = { Params = "", Return = "{{Globals#MobType|MobType}}", Notes = "Returns the type of this mob ({{Globals#MobType|mtXXX}} constant)" },
GetSpawnDelay = { Params = "{{cMonster#MobFamily|MobFamily}}", Return = "number", Notes = "(STATIC) Returns the spawn delay - the number of game ticks between spawn attempts - for the specified mob family." }, GetSpawnDelay = { Params = "{{cMonster#MobFamily|MobFamily}}", Return = "number", Notes = "(STATIC) Returns the spawn delay - the number of game ticks between spawn attempts - for the specified mob family." },
MobTypeToString = { Params = "{{cMonster#MobType|MobType}}", Return = "string", Notes = "(STATIC) Returns the string representing the given mob type ({{cMonster#MobType|mtXXX}} constant), or empty string if unknown type." }, MobTypeToString = { Params = "{{Globals#MobType|MobType}}", Return = "string", Notes = "(STATIC) Returns the string representing the given mob type ({{Globals#MobType|mtXXX}} constant), or empty string if unknown type." },
MobTypeToVanillaName = { Params = "{{Globals#MobType|MobType}}", Return = "string", Notes = "(STATIC) Returns the correct vanilla name of the given mob type, or empty string if unknown type." },
MoveToPosition = { Params = "Position", Return = "", Notes = "Moves mob to the specified position" }, MoveToPosition = { Params = "Position", Return = "", Notes = "Moves mob to the specified position" },
StringToMobType = { Params = "string", Return = "{{cMonster#MobType|MobType}}", Notes = "(STATIC) Returns the mob type ({{cMonster#MobType|mtXXX}} constant) parsed from the string type (\"creeper\"), or mtInvalidType if unrecognized." }, StringToMobType = { Params = "string", Return = "{{Globals#MobType|MobType}}", Notes = "(STATIC) Returns the mob type ({{Globals#MobType|mtXXX}} constant) parsed from the string type (\"creeper\"), or mtInvalidType if unrecognized." },
GetRelativeWalkSpeed = { Params = "", Return = "number", Notes = "Returns the relative walk speed of this mob. Standard is 1.0" }, GetRelativeWalkSpeed = { Params = "", Return = "number", Notes = "Returns the relative walk speed of this mob. Standard is 1.0" },
SetRelativeWalkSpeed = { Params = "number", Return = "", Notes = "Sets the relative walk speed of this mob. Standard is 1.0" }, SetRelativeWalkSpeed = { Params = "number", Return = "", Notes = "Sets the relative walk speed of this mob. Standard is 1.0" },
}, },
@ -2571,7 +2572,7 @@ World:ForEachEntity(
return; return;
end end
local Monster = tolua.cast(a_Entity, "cMonster"); -- Get the cMonster out of cEntity, now that we know the entity represents one. local Monster = tolua.cast(a_Entity, "cMonster"); -- Get the cMonster out of cEntity, now that we know the entity represents one.
if (Monster:GetMobType() == cMonster.mtSpider) then if (Monster:GetMobType() == mtSpider) then
Monster:TeleportToCoords(Monster:GetPosX(), Monster:GetPosY() + 100, Monster:GetPosZ()); Monster:TeleportToCoords(Monster:GetPosX(), Monster:GetPosY() + 100, Monster:GetPosZ());
end end
end end
@ -2928,7 +2929,7 @@ end
StringToDamageType = {Params = "string", Return = "{{Globals#DamageType|DamageType}}", Notes = "Converts a string representation to a {{Globals#DamageType|DamageType}} enumerated value."}, StringToDamageType = {Params = "string", Return = "{{Globals#DamageType|DamageType}}", Notes = "Converts a string representation to a {{Globals#DamageType|DamageType}} enumerated value."},
StringToDimension = {Params = "string", Return = "{{Globals#WorldDimension|Dimension}}", Notes = "Converts a string representation to a {{Globals#WorldDimension|Dimension}} enumerated value"}, StringToDimension = {Params = "string", Return = "{{Globals#WorldDimension|Dimension}}", Notes = "Converts a string representation to a {{Globals#WorldDimension|Dimension}} enumerated value"},
StringToItem = {Params = "string, {{cItem|cItem}}", Return = "bool", Notes = "Parses the given string and sets the item; returns true if successful"}, StringToItem = {Params = "string, {{cItem|cItem}}", Return = "bool", Notes = "Parses the given string and sets the item; returns true if successful"},
StringToMobType = {Params = "string", Return = "{{cMonster#MobType|MobType}}", Notes = "Converts a string representation to a {{cMonster#MobType|MobType}} enumerated value"}, StringToMobType = {Params = "string", Return = "{{Globals#MobType|MobType}}", Notes = "Converts a string representation to a {{Globals#MobType|MobType}} enumerated value"},
StripColorCodes = {Params = "string", Return = "string", Notes = "Removes all control codes used by MC for colors and styles"}, StripColorCodes = {Params = "string", Return = "string", Notes = "Removes all control codes used by MC for colors and styles"},
TrimString = {Params = "string", Return = "string", Notes = "Trims whitespace at both ends of the string"}, TrimString = {Params = "string", Return = "string", Notes = "Trims whitespace at both ends of the string"},
md5 = {Params = "string", Return = "string", Notes = "converts a string to an md5 hash"}, md5 = {Params = "string", Return = "string", Notes = "converts a string to an md5 hash"},
@ -3014,6 +3015,13 @@ end
gmXXX constants, the eGameMode_ constants are deprecated and will be removed from the API. gmXXX constants, the eGameMode_ constants are deprecated and will be removed from the API.
]], ]],
}, },
MobType =
{
Include = { "^mt.*" },
TextBefore = [[
The following constants are used for the mob types.
]],
},
Weather = Weather =
{ {
Include = { "^eWeather_.*", "wSunny", "wRain", "wStorm", "wThunderstorm" }, Include = { "^eWeather_.*", "wSunny", "wRain", "wStorm", "wThunderstorm" },

View File

@ -231,6 +231,43 @@ World:ForEachChestInChunk(Player:GetChunkX(), Player:GetChunkZ(),
}, },
}, -- cJukeboxEntity }, -- cJukeboxEntity
cMobHeadEntity =
{
Desc = [[
This class represents a mob head block entity in the world.
]],
Inherits = "cBlockEntity",
Functions =
{
SetType = { Params = "eMobHeadType", Return = "", Notes = "Set the type of the mob head" },
SetRotation = { Params = "eMobHeadRotation", Return = "", Notes = "Sets the rotation of the mob head" },
SetOwner = { Params = "string", Return = "", Notes = "Set the player name for mob heads with player type" },
GetType = { Params = "", Return = "eMobHeadType", Notes = "Returns the type of the mob head" },
GetRotation = { Params = "", Return = "eMobHeadRotation", Notes = "Returns the rotation of the mob head" },
GetOwner = { Params = "", Return = "string", Notes = "Returns the player name of the mob head" },
},
}, -- cMobHeadEntity
cMobSpawnerEntity =
{
Desc = [[
This class represents a mob spawner block entity in the world.
]],
Inherits = "cBlockEntity",
Functions =
{
UpdateActiveState = { Params = "", Return = "", Notes = "Upate the active flag from the mob spawner. This function will called every 5 seconds from the Tick() function." },
ResetTimer = { Params = "", Return = "", Notes = "Sets the spawn delay to a new random value." },
SpawnEntity = { Params = "", Return = "", Notes = "Spawns the entity. This function automaticly change the spawn delay!" },
GetEntity = { Params = "", Return = "{{Globals#MobType|MobType}}", Notes = "Returns the entity type that will be spawn by this mob spawner." },
SetEntity = { Params = "{{Globals#MobType|MobType}}", Return = "", Notes = "Sets the entity type who will be spawn by this mob spawner." },
GetSpawnDelay = { Params = "", Return = "number", Notes = "Returns the spawn delay. This is the tick delay that is needed to spawn new monsters." },
SetSpawnDelay = { Params = "number", Return = "", Notes = "Sets the spawn delay." },
GetNearbyPlayersNum = { Params = "", Return = "number", Notes = "Returns the amount of the nearby players in a 16-block radius." },
GetNearbyMonsterNum = { Params = "", Return = "number", Notes = "Returns the amount of this monster type in a 8-block radius (Y: 4-block radius)." },
},
}, -- cMobSpawnerEntity
cNoteEntity = cNoteEntity =
{ {
Desc = [[ Desc = [[

View File

@ -74,6 +74,7 @@ $cfile "../BlockEntities/JukeboxEntity.h"
$cfile "../BlockEntities/NoteEntity.h" $cfile "../BlockEntities/NoteEntity.h"
$cfile "../BlockEntities/SignEntity.h" $cfile "../BlockEntities/SignEntity.h"
$cfile "../BlockEntities/MobHeadEntity.h" $cfile "../BlockEntities/MobHeadEntity.h"
$cfile "../BlockEntities/MobSpawnerEntity.h"
$cfile "../BlockEntities/FlowerPotEntity.h" $cfile "../BlockEntities/FlowerPotEntity.h"
$cfile "../WebAdmin.h" $cfile "../WebAdmin.h"
$cfile "../Root.h" $cfile "../Root.h"

View File

@ -33,22 +33,22 @@ public:
// tolua_begin // tolua_begin
/** Set the Type */ /** Set the type of the mob head */
void SetType(const eMobHeadType & a_SkullType); void SetType(const eMobHeadType & a_SkullType);
/** Set the Rotation */ /** Set the rotation of the mob head */
void SetRotation(eMobHeadRotation a_Rotation); void SetRotation(eMobHeadRotation a_Rotation);
/** Set the Player Name for Mobheads with Player type */ /** Set the player name for mob heads with player type */
void SetOwner(const AString & a_Owner); void SetOwner(const AString & a_Owner);
/** Get the Type */ /** Returns the type of the mob head */
eMobHeadType GetType(void) const { return m_Type; } eMobHeadType GetType(void) const { return m_Type; }
/** Get the Rotation */ /** Returns the rotation of the mob head */
eMobHeadRotation GetRotation(void) const { return m_Rotation; } eMobHeadRotation GetRotation(void) const { return m_Rotation; }
/** Get the setted Player Name */ /** Returns the player name of the mob head */
AString GetOwner(void) const { return m_Owner; } AString GetOwner(void) const { return m_Owner; }
// tolua_end // tolua_end

View File

@ -49,7 +49,7 @@ void cMobSpawnerEntity::UsedBy(cPlayer * a_Player)
{ {
a_Player->GetInventory().RemoveOneEquippedItem(); a_Player->GetInventory().RemoveOneEquippedItem();
} }
LOGD("Changed monster spawner at {%d, %d, %d} to type %s.", GetPosX(), GetPosY(), GetPosZ(), GetEntityName().c_str()); LOGD("Changed monster spawner at {%d, %d, %d} to type %s.", GetPosX(), GetPosY(), GetPosZ(), cMonster::MobTypeToString(MonsterType).c_str());
} }
} }
@ -195,51 +195,6 @@ void cMobSpawnerEntity::SpawnEntity(void)
AString cMobSpawnerEntity::GetEntityName() const
{
switch (m_Entity)
{
case mtBat: return "Bat";
case mtBlaze: return "Blaze";
case mtCaveSpider: return "CaveSpider";
case mtChicken: return "Chicken";
case mtCow: return "Cow";
case mtCreeper: return "Creeper";
case mtEnderDragon: return "EnderDragon";
case mtEnderman: return "Enderman";
case mtGhast: return "Ghast";
case mtGiant: return "Giant";
case mtHorse: return "EntityHorse";
case mtIronGolem: return "VillagerGolem";
case mtMagmaCube: return "LavaSlime";
case mtMooshroom: return "MushroomCow";
case mtOcelot: return "Ozelot";
case mtPig: return "Pig";
case mtSheep: return "Sheep";
case mtSilverfish: return "Silverfish";
case mtSkeleton: return "Skeleton";
case mtSlime: return "Slime";
case mtSnowGolem: return "SnowMan";
case mtSpider: return "Spider";
case mtSquid: return "Squid";
case mtVillager: return "Villager";
case mtWitch: return "Witch";
case mtWither: return "WitherBoss";
case mtWolf: return "Wolf";
case mtZombie: return "Zombie";
case mtZombiePigman: return "PigZombie";
default:
{
ASSERT(!"Unknown monster type!");
return "Pig";
}
}
}
int cMobSpawnerEntity::GetNearbyPlayersNum(void) int cMobSpawnerEntity::GetNearbyPlayersNum(void)
{ {
Vector3d SpawnerPos(m_PosX + 0.5, m_PosY + 0.5, m_PosZ + 0.5); Vector3d SpawnerPos(m_PosX + 0.5, m_PosY + 0.5, m_PosZ + 0.5);

View File

@ -35,22 +35,22 @@ public:
/** Spawns the entity. This function automaticly change the spawn delay! */ /** Spawns the entity. This function automaticly change the spawn delay! */
void SpawnEntity(void); void SpawnEntity(void);
/** Returns the entity type who will be spawn by this mob spawner. */ /** Returns the entity type that will be spawn by this mob spawner. */
eMonsterType GetEntity(void) const { return m_Entity; } eMonsterType GetEntity(void) const { return m_Entity; }
/** Sets the entity type who will be spawn by this mob spawner. */ /** Sets the entity type who will be spawn by this mob spawner. */
void SetEntity(eMonsterType a_EntityType) { m_Entity = a_EntityType; } void SetEntity(eMonsterType a_EntityType) { m_Entity = a_EntityType; }
/** Returns the entity name. (Required by the protocol) */ /** Returns the spawn delay. This is the tick delay that is needed to spawn new monsters. */
AString GetEntityName(void) const;
/** Returns the spawn delay. */
short GetSpawnDelay(void) const { return m_SpawnDelay; } short GetSpawnDelay(void) const { return m_SpawnDelay; }
/** Sets the spawn delay. */ /** Sets the spawn delay. */
void SetSpawnDelay(short a_Delay) { m_SpawnDelay = a_Delay; } void SetSpawnDelay(short a_Delay) { m_SpawnDelay = a_Delay; }
/** Returns the amount of the nearby players in a 16-block radius. */
int GetNearbyPlayersNum(void); int GetNearbyPlayersNum(void);
/** Returns the amount of this monster type in a 8-block radius (Y: 4-block radius). */
int GetNearbyMonsterNum(eMonsterType a_EntityType); int GetNearbyMonsterNum(eMonsterType a_EntityType);
// tolua_end // tolua_end

View File

@ -26,36 +26,37 @@ static const struct
{ {
eMonsterType m_Type; eMonsterType m_Type;
const char * m_lcName; const char * m_lcName;
const char * m_VanillaName;
} g_MobTypeNames[] = } g_MobTypeNames[] =
{ {
{mtBat, "bat"}, {mtBat, "bat", "Bat"},
{mtBlaze, "blaze"}, {mtBlaze, "blaze", "Blaze"},
{mtCaveSpider, "cavespider"}, {mtCaveSpider, "cavespider", "CaveSpider"},
{mtChicken, "chicken"}, {mtChicken, "chicken", "Chicken"},
{mtCow, "cow"}, {mtCow, "cow", "Cow"},
{mtCreeper, "creeper"}, {mtCreeper, "creeper", "Creeper"},
{mtEnderman, "enderman"}, {mtEnderman, "enderman", "Enderman"},
{mtEnderDragon, "enderdragon"}, {mtEnderDragon, "enderdragon", "EnderDragon"},
{mtGhast, "ghast"}, {mtGhast, "ghast", "Ghast"},
{mtHorse, "horse"}, {mtHorse, "horse", "EntityHorse"},
{mtIronGolem, "irongolem"}, {mtIronGolem, "irongolem", "VillagerGolem"},
{mtMagmaCube, "magmacube"}, {mtMagmaCube, "magmacube", "LavaSlime"},
{mtMooshroom, "mooshroom"}, {mtMooshroom, "mooshroom", "MushroomCow"},
{mtOcelot, "ocelot"}, {mtOcelot, "ocelot", "Ozelot"},
{mtPig, "pig"}, {mtPig, "pig", "Pig"},
{mtSheep, "sheep"}, {mtSheep, "sheep", "Sheep"},
{mtSilverfish, "silverfish"}, {mtSilverfish, "silverfish", "Silverfish"},
{mtSkeleton, "skeleton"}, {mtSkeleton, "skeleton", "Skeleton"},
{mtSlime, "slime"}, {mtSlime, "slime", "Slime"},
{mtSnowGolem, "snowgolem"}, {mtSnowGolem, "snowgolem", "SnowMan"},
{mtSpider, "spider"}, {mtSpider, "spider", "Spider"},
{mtSquid, "squid"}, {mtSquid, "squid", "Squid"},
{mtVillager, "villager"}, {mtVillager, "villager", "Villager"},
{mtWitch, "witch"}, {mtWitch, "witch", "Witch"},
{mtWither, "wither"}, {mtWither, "wither", "WitherBoss"},
{mtWolf, "wolf"}, {mtWolf, "wolf", "Wolf"},
{mtZombie, "zombie"}, {mtZombie, "zombie", "Zombie"},
{mtZombiePigman, "zombiepigman"}, {mtZombiePigman, "zombiepigman", "PigZombie"},
} ; } ;
@ -784,39 +785,47 @@ AString cMonster::MobTypeToString(eMonsterType a_MobType)
AString cMonster::MobTypeToVanillaName(eMonsterType a_MobType)
{
// Mob types aren't sorted, so we need to search linearly:
for (size_t i = 0; i < ARRAYCOUNT(g_MobTypeNames); i++)
{
if (g_MobTypeNames[i].m_Type == a_MobType)
{
return g_MobTypeNames[i].m_VanillaName;
}
}
// Not found:
return "";
}
eMonsterType cMonster::StringToMobType(const AString & a_Name) eMonsterType cMonster::StringToMobType(const AString & a_Name)
{ {
AString lcName = StrToLower(a_Name); AString lcName = StrToLower(a_Name);
// Binary-search for the lowercase name: // Search MCServer name:
int lo = 0, hi = ARRAYCOUNT(g_MobTypeNames) - 1; for (size_t i = 0; i < ARRAYCOUNT(g_MobTypeNames); i++)
while (hi - lo > 1)
{ {
int mid = (lo + hi) / 2; if (strcmp(g_MobTypeNames[i].m_lcName, lcName.c_str()) == 0)
int res = strcmp(g_MobTypeNames[mid].m_lcName, lcName.c_str());
if (res == 0)
{ {
return g_MobTypeNames[mid].m_Type; return g_MobTypeNames[i].m_Type;
}
if (res < 0)
{
lo = mid;
}
else
{
hi = mid;
} }
} }
// Range has collapsed to at most two elements, compare each:
if (strcmp(g_MobTypeNames[lo].m_lcName, lcName.c_str()) == 0) // Not found. Search Vanilla name:
for (size_t i = 0; i < ARRAYCOUNT(g_MobTypeNames); i++)
{ {
return g_MobTypeNames[lo].m_Type; if (strcmp(StrToLower(g_MobTypeNames[i].m_VanillaName).c_str(), lcName.c_str()) == 0)
{
return g_MobTypeNames[i].m_Type;
}
} }
if ((lo != hi) && (strcmp(g_MobTypeNames[hi].m_lcName, lcName.c_str()) == 0))
{
return g_MobTypeNames[hi].m_Type;
}
// Not found: // Not found:
return mtInvalidType; return mtInvalidType;
} }

View File

@ -133,16 +133,19 @@ public:
If it's false, you only see the name when you sight the mob. If it's true, you always see the custom name. */ If it's false, you only see the name when you sight the mob. If it's true, you always see the custom name. */
void SetCustomNameAlwaysVisible(bool a_CustomNameAlwaysVisible); void SetCustomNameAlwaysVisible(bool a_CustomNameAlwaysVisible);
/// Translates MobType enum to a string, empty string if unknown /** Translates MobType enum to a string, empty string if unknown */
static AString MobTypeToString(eMonsterType a_MobType); static AString MobTypeToString(eMonsterType a_MobType);
/// Translates MobType string to the enum, mtInvalidType if not recognized /** Translates MobType enum to the correct vanilla name of the mob, empty string if unknown. */
static AString MobTypeToVanillaName(eMonsterType a_MobType);
/** Translates MobType string to the enum, mtInvalidType if not recognized */
static eMonsterType StringToMobType(const AString & a_MobTypeName); static eMonsterType StringToMobType(const AString & a_MobTypeName);
/// Returns the mob family based on the type /** Returns the mob family based on the type */
static eFamily FamilyFromType(eMonsterType a_MobType); static eFamily FamilyFromType(eMonsterType a_MobType);
/// Returns the spawn delay (number of game ticks between spawn attempts) for the given mob family /** Returns the spawn delay (number of game ticks between spawn attempts) for the given mob family */
static int GetSpawnDelay(cMonster::eFamily a_MobFamily); static int GetSpawnDelay(cMonster::eFamily a_MobFamily);
// tolua_end // tolua_end

View File

@ -2670,7 +2670,7 @@ void cProtocol172::cPacketizer::WriteBlockEntity(const cBlockEntity & a_BlockEnt
Writer.AddInt("x", MobSpawnerEntity.GetPosX()); Writer.AddInt("x", MobSpawnerEntity.GetPosX());
Writer.AddInt("y", MobSpawnerEntity.GetPosY()); Writer.AddInt("y", MobSpawnerEntity.GetPosY());
Writer.AddInt("z", MobSpawnerEntity.GetPosZ()); Writer.AddInt("z", MobSpawnerEntity.GetPosZ());
Writer.AddString("EntityId", MobSpawnerEntity.GetEntityName()); Writer.AddString("EntityId", cMonster::MobTypeToVanillaName(MobSpawnerEntity.GetEntity()));
Writer.AddShort("Delay", MobSpawnerEntity.GetSpawnDelay()); Writer.AddShort("Delay", MobSpawnerEntity.GetSpawnDelay());
Writer.AddString("id", "MobSpawner"); Writer.AddString("id", "MobSpawner");
break; break;

View File

@ -33,6 +33,7 @@ Declares the 1.7.x protocol classes:
#include "PolarSSL++/AesCfb128Decryptor.h" #include "PolarSSL++/AesCfb128Decryptor.h"
#include "PolarSSL++/AesCfb128Encryptor.h" #include "PolarSSL++/AesCfb128Encryptor.h"
#include "../Mobs/MonsterTypes.h"

View File

@ -2980,7 +2980,7 @@ void cProtocol180::cPacketizer::WriteBlockEntity(const cBlockEntity & a_BlockEnt
Writer.AddInt("x", MobSpawnerEntity.GetPosX()); Writer.AddInt("x", MobSpawnerEntity.GetPosX());
Writer.AddInt("y", MobSpawnerEntity.GetPosY()); Writer.AddInt("y", MobSpawnerEntity.GetPosY());
Writer.AddInt("z", MobSpawnerEntity.GetPosZ()); Writer.AddInt("z", MobSpawnerEntity.GetPosZ());
Writer.AddString("EntityId", MobSpawnerEntity.GetEntityName()); Writer.AddString("EntityId", cMonster::MobTypeToVanillaName(MobSpawnerEntity.GetEntity()));
Writer.AddShort("Delay", MobSpawnerEntity.GetSpawnDelay()); Writer.AddShort("Delay", MobSpawnerEntity.GetSpawnDelay());
Writer.AddString("id", "MobSpawner"); Writer.AddString("id", "MobSpawner");
break; break;

View File

@ -32,6 +32,7 @@ Declares the 1.8.x protocol classes:
#include "PolarSSL++/AesCfb128Decryptor.h" #include "PolarSSL++/AesCfb128Decryptor.h"
#include "PolarSSL++/AesCfb128Encryptor.h" #include "PolarSSL++/AesCfb128Encryptor.h"
#include "../Mobs/MonsterTypes.h"

View File

@ -296,7 +296,7 @@ void cNBTChunkSerializer::AddMobSpawnerEntity(cMobSpawnerEntity * a_MobSpawner)
m_Writer.BeginCompound(""); m_Writer.BeginCompound("");
AddBasicTileEntity(a_MobSpawner, "MobSpawner"); AddBasicTileEntity(a_MobSpawner, "MobSpawner");
m_Writer.AddShort("Entity", static_cast<short>(a_MobSpawner->GetEntity())); m_Writer.AddShort("Entity", static_cast<short>(a_MobSpawner->GetEntity()));
m_Writer.AddString("EntityId", a_MobSpawner->GetEntityName()); m_Writer.AddString("EntityId", cMonster::MobTypeToVanillaName(a_MobSpawner->GetEntity()));
m_Writer.AddShort("Delay", a_MobSpawner->GetSpawnDelay()); m_Writer.AddShort("Delay", a_MobSpawner->GetSpawnDelay());
m_Writer.EndCompound(); m_Writer.EndCompound();
} }