1
0

Fourth round of fixes

* Switchified WriteMobMetadata
* Renamed Horse functions to be better
This commit is contained in:
Tiger Wang 2013-10-11 01:00:16 +01:00
parent d7b2c534fd
commit ee2df34d03
2 changed files with 160 additions and 142 deletions

View File

@ -27,10 +27,10 @@ public:
bool IsRearing (void) const {return m_bIsRearing; }
bool IsMthOpen (void) const {return m_bIsMouthOpen; }
bool IsTame (void) const {return m_bIsTame; }
int GetHType (void) const {return m_Type; }
int GetHColor (void) const {return m_Color; }
int GetHStyle (void) const {return m_Style; }
int GetHArmour (void) const {return m_Armour;}
int GetHorseType (void) const {return m_Type; }
int GetHorseColor (void) const {return m_Color; }
int GetHorseStyle (void) const {return m_Style; }
int GetHorseArmour (void) const {return m_Armour;}
private:

View File

@ -1709,29 +1709,35 @@ void cProtocol125::WriteEntityMetadata(const cEntity & a_Entity)
void cProtocol125::WriteMobMetadata(const cMonster & a_Mob)
{
if (a_Mob.GetMobType() == E_META_SPAWN_EGG_CREEPER)
switch (a_Mob.GetMobType())
{
case E_META_SPAWN_EGG_CREEPER:
{
WriteByte(0x10);
WriteByte(((const cCreeper &)a_Mob).IsBlowing() ? 1 : -1); // Blowing up?
WriteByte(0x11);
WriteByte(((const cCreeper &)a_Mob).IsCharged() ? 1 : 0); // Lightning-charged?
break;
}
else if (a_Mob.GetMobType() == E_META_SPAWN_EGG_BAT)
case E_META_SPAWN_EGG_BAT:
{
WriteByte(0x10);
WriteByte(((const cBat &)a_Mob).IsHanging() ? 1 : 0); // Upside down?
break;
}
else if (a_Mob.GetMobType() == E_META_SPAWN_EGG_PIG)
case E_META_SPAWN_EGG_PIG:
{
WriteByte(0x10);
WriteByte(((const cPig &)a_Mob).IsSaddled() ? 1 : 0); // Saddled?
break;
}
else if (a_Mob.GetMobType() == E_META_SPAWN_EGG_VILLAGER)
case E_META_SPAWN_EGG_VILLAGER:
{
WriteByte(0x50);
WriteInt(((const cVillager &)a_Mob).GetVilType()); // What sort of TESTIFICATE?
break;
}
else if (a_Mob.GetMobType() == E_META_SPAWN_EGG_ZOMBIE)
case E_META_SPAWN_EGG_ZOMBIE:
{
WriteByte(0xC);
WriteByte(((const cZombie &)a_Mob).IsBaby() ? 1 : 0); // Babby zombie?
@ -1739,18 +1745,21 @@ void cProtocol125::WriteMobMetadata(const cMonster & a_Mob)
WriteByte(((const cZombie &)a_Mob).IsVillagerZombie() ? 1 : 0); // Converted zombie?
WriteByte(0xE);
WriteByte(((const cZombie &)a_Mob).IsConverting() ? 1 : 0); // Converted-but-converting-back zombllager?
break;
}
else if (a_Mob.GetMobType() == E_META_SPAWN_EGG_GHAST)
case E_META_SPAWN_EGG_GHAST:
{
WriteByte(0x10);
WriteByte(((const cGhast &)a_Mob).IsCharging()); // About to eject un flamé-bol? :P
break;
}
else if (a_Mob.GetMobType() == E_META_SPAWN_EGG_ARROW)
case E_META_SPAWN_EGG_ARROW:
{
WriteByte(0x10);
WriteByte(((const cArrowEntity &)a_Mob).IsCritical() ? 1 : 0); // Critical hitting arrow?
break;
}
else if (a_Mob.GetMobType() == E_META_SPAWN_EGG_WOLF)
case E_META_SPAWN_EGG_WOLF:
{
Byte WolfStatus = 0;
if (((const cWolf &)a_Mob).IsSitting())
@ -1772,8 +1781,9 @@ void cProtocol125::WriteMobMetadata(const cMonster & a_Mob)
WriteFloat((float)(a_Mob.GetHealth())); // Tail health-o-meter (only shown when tamed, by the way)
WriteByte(0x13);
WriteByte(((const cWolf &)a_Mob).IsBegging() ? 1 : 0); // Ultra cute mode?
break;
}
else if (a_Mob.GetMobType() == E_META_SPAWN_EGG_SHEEP)
case E_META_SPAWN_EGG_SHEEP:
{
// [1](1111)
// [] = Is sheared? () = Color, from 0 to 15
@ -1787,8 +1797,9 @@ void cProtocol125::WriteMobMetadata(const cMonster & a_Mob)
SheepMetadata |= 0x16;
}
WriteByte(SheepMetadata);
break;
}
else if (a_Mob.GetMobType() == E_META_SPAWN_EGG_ENDERMAN)
case E_META_SPAWN_EGG_ENDERMAN:
{
WriteByte(0x10);
WriteByte((Byte)(((const cEnderman &)a_Mob).GetCarriedBlock())); // Block that he stole from your house
@ -1796,18 +1807,22 @@ void cProtocol125::WriteMobMetadata(const cMonster & a_Mob)
WriteByte((Byte)(((const cEnderman &)a_Mob).GetCarriedMeta())); // Meta of block that he stole from your house
WriteByte(0x12);
WriteByte(((const cEnderman &)a_Mob).IsScreaming() ? 1 : 0); // Screaming at your face?
break;
}
else if (a_Mob.GetMobType() == E_META_SPAWN_EGG_SKELETON)
case E_META_SPAWN_EGG_SKELETON:
{
WriteByte(0xD);
WriteByte(((const cSkeleton &)a_Mob).IsWither() ? 1 : 0); // It's a skeleton, but it's not
break;
}
else if (a_Mob.GetMobType() == E_META_SPAWN_EGG_WITCH)
case E_META_SPAWN_EGG_WITCH:
{
WriteByte(0x15);
WriteByte(((const cWitch &)a_Mob).IsAngry() ? 1 : 0); // Aggravated? Doesn't seem to do anything
break;
}
else if ((a_Mob.GetMobType() == E_META_SPAWN_EGG_SLIME) || (a_Mob.GetMobType() == E_META_SPAWN_EGG_MAGMA_CUBE))
case E_META_SPAWN_EGG_SLIME:
case E_META_SPAWN_EGG_MAGMA_CUBE:
{
WriteByte(0x10);
if (a_Mob.GetMobType() == E_META_SPAWN_EGG_SLIME)
@ -1818,8 +1833,9 @@ void cProtocol125::WriteMobMetadata(const cMonster & a_Mob)
{
WriteByte(((const cMagmaCube &)a_Mob).GetSize()); // Size of slime - HEWGE, meh, cute BABBY SLIME
}
break;
}
else if (a_Mob.GetMobType() == E_META_SPAWN_EGG_HORSE)
case E_META_SPAWN_EGG_HORSE:
{
int Flags = 0;
if (((const cHorse &)a_Mob).IsTame())
@ -1854,16 +1870,18 @@ void cProtocol125::WriteMobMetadata(const cMonster & a_Mob)
WriteInt(Flags);
WriteByte(0x13);
WriteByte(((const cHorse &)a_Mob).GetHType()); // Type of horse (donkey, chestnut, etc.)
WriteByte(((const cHorse &)a_Mob).GetHorseType()); // Type of horse (donkey, chestnut, etc.)
WriteByte(0x54);
int Appearance = 0;
Appearance = ((const cHorse &)a_Mob).GetHColor(); // Mask FF
Appearance |= ((const cHorse &)a_Mob).GetHStyle() * 256; // Mask FF00, so multiply by 256
Appearance = ((const cHorse &)a_Mob).GetHorseColor(); // Mask FF
Appearance |= ((const cHorse &)a_Mob).GetHorseStyle() * 256; // Mask FF00, so multiply by 256
WriteInt(Appearance);
WriteByte(0x56);
WriteInt(((const cHorse &)a_Mob).GetHArmour()); // Horshey armour
WriteInt(((const cHorse &)a_Mob).GetHorseArmour()); // Horshey armour
break;
}
}
}