summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-10-09 22:02:59 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-10-09 22:02:59 +0200
commitfe6fa23a97421af3d02b9faf92b8df2f73abb556 (patch)
treea080fa2de23b3123dc2d13ab8ee5565c3eac9ad6
parentInitial round of fixes (diff)
downloadcuberite-fe6fa23a97421af3d02b9faf92b8df2f73abb556.tar
cuberite-fe6fa23a97421af3d02b9faf92b8df2f73abb556.tar.gz
cuberite-fe6fa23a97421af3d02b9faf92b8df2f73abb556.tar.bz2
cuberite-fe6fa23a97421af3d02b9faf92b8df2f73abb556.tar.lz
cuberite-fe6fa23a97421af3d02b9faf92b8df2f73abb556.tar.xz
cuberite-fe6fa23a97421af3d02b9faf92b8df2f73abb556.tar.zst
cuberite-fe6fa23a97421af3d02b9faf92b8df2f73abb556.zip
-rw-r--r--source/Entities/Entity.h67
-rw-r--r--source/Entities/Minecart.cpp4
-rw-r--r--source/Entities/Minecart.h2
-rw-r--r--source/Mobs/Bat.h2
-rw-r--r--source/Mobs/Creeper.cpp21
-rw-r--r--source/Mobs/Creeper.h9
-rw-r--r--source/Mobs/Enderman.cpp5
-rw-r--r--source/Mobs/Enderman.h11
-rw-r--r--source/Mobs/Ghast.h2
-rw-r--r--source/Mobs/Horse.cpp1
-rw-r--r--source/Mobs/Horse.h4
-rw-r--r--source/Mobs/Monster.h6
-rw-r--r--source/Mobs/Witch.h2
-rw-r--r--source/Mobs/Zombie.cpp6
-rw-r--r--source/Mobs/Zombie.h10
-rw-r--r--source/Protocol/Protocol125.cpp98
-rw-r--r--source/World.cpp2
17 files changed, 140 insertions, 112 deletions
diff --git a/source/Entities/Entity.h b/source/Entities/Entity.h
index fdc047cf9..07bc84937 100644
--- a/source/Entities/Entity.h
+++ b/source/Entities/Entity.h
@@ -334,78 +334,13 @@ public:
// tolua_begin
- // Metadata flags; descendants may override the defaults:
+ // COMMON metadata flags; descendants may override the defaults:
virtual bool IsOnFire (void) const {return (m_TicksLeftBurning > 0); }
virtual bool IsCrouched (void) const {return false; }
virtual bool IsRiding (void) const {return false; }
virtual bool IsSprinting(void) const {return false; }
virtual bool IsRclking (void) const {return false; }
virtual bool IsInvisible(void) const {return false; }
-
- // Ageables + Tameables
- virtual bool IsBaby (void) const {return false; }
- virtual bool IsSitting (void) const {return false; }
- virtual bool IsTame (void) const {return false; }
-
- // Creepers
- virtual bool IsCharged (void) const {return false; }
- virtual bool IsBlowing (void) const {return false; }
-
- // Furnace Minecarts & Minecarts
- virtual int LastDamage (void) const {return 0; }
- virtual bool IsFueled (void) const {return false; }
-
- // Bat
- virtual bool IsHanging (void) const {return false; }
-
- // Pig
- virtual bool IsSaddled (void) const {return false; }
-
- // TESTIFICATE
- virtual int GetVilType (void) const {return 0; }
-
- // Zombie
- virtual bool IsVillZomb (void) const {return false; }
- virtual bool IsConvert (void) const {return false; }
-
- // Ghast
- virtual bool IsCharging (void) const {return false; }
-
- // Arrow
- virtual bool IsCritical (void) const {return false; }
-
- // Wolf
- virtual bool IsAngry (void) const {return false; }
- virtual bool IsBegging (void) const {return false; }
- virtual int GetCollar (void) const {return 0; }
-
- // Sheep
- virtual int GetFurColor (void) const {return 0; }
- virtual bool IsSheared (void) const {return false; }
-
- // Enderman
- virtual BLOCKTYPE CarriedBlock (void) const {return E_BLOCK_AIR; }
- virtual NIBBLETYPE CarriedMeta (void) const {return 0; }
- virtual bool IsScream (void) const {return false; }
-
- // Skeleton || Wither Skeleton
- virtual bool IsWither (void) const {return false; }
-
- // Witch
- virtual bool IsNosey (void) const {return false; }
-
- // Slimes and Magma cubes
- virtual int GetSize (void) const {return 1; }
-
- // Horsheys
- virtual bool IsChested (void) const {return false; }
- virtual bool IsEating (void) const {return false; }
- virtual bool IsRearing (void) const {return false; }
- virtual bool IsMthOpen (void) const {return false; }
- virtual int GetHType (void) const {return 0; }
- virtual int GetHColor (void) const {return 0; }
- virtual int GetHStyle (void) const {return 0; }
- virtual int GetHArmour (void) const {return 0; }
// tolua_end
diff --git a/source/Entities/Minecart.cpp b/source/Entities/Minecart.cpp
index 1711e296f..4787f9157 100644
--- a/source/Entities/Minecart.cpp
+++ b/source/Entities/Minecart.cpp
@@ -374,12 +374,12 @@ void cMinecart::DoTakeDamage(TakeDamageInfo & TDI)
}
case mpTNT:
{
- Drops.push_back(cItem(0, 1, 0));
+ Drops.push_back(cItem(E_ITEM_MINECART_WITH_TNT, 1, 0));
break;
}
case mpHopper:
{
- Drops.push_back(cItem(0, 1, 0));
+ Drops.push_back(cItem(E_ITEM_MINECART_WITH_HOPPER, 1, 0));
break;
}
default:
diff --git a/source/Entities/Minecart.h b/source/Entities/Minecart.h
index f974ea76a..b1b48be4e 100644
--- a/source/Entities/Minecart.h
+++ b/source/Entities/Minecart.h
@@ -51,8 +51,8 @@ public:
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
virtual void HandlePhysics(float a_Dt, cChunk & a_Chunk) override;
virtual void DoTakeDamage(TakeDamageInfo & TDI) override;
- int LastDamage(void) const { return m_LastDamage; }
+ int LastDamage(void) const { return m_LastDamage; }
void HandleRailPhysics(float a_Dt, cChunk & a_Chunk);
ePayload GetPayload(void) const { return m_Payload; }
diff --git a/source/Mobs/Bat.h b/source/Mobs/Bat.h
index 8e4cde29f..7aaec361b 100644
--- a/source/Mobs/Bat.h
+++ b/source/Mobs/Bat.h
@@ -20,6 +20,8 @@ public:
}
CLASS_PROTODEF(cBat);
+
+ bool IsHanging(void) const {return false; }
} ;
diff --git a/source/Mobs/Creeper.cpp b/source/Mobs/Creeper.cpp
index 9b1b68b79..b41b05f42 100644
--- a/source/Mobs/Creeper.cpp
+++ b/source/Mobs/Creeper.cpp
@@ -2,13 +2,16 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Creeper.h"
+#include "../World.h"
cCreeper::cCreeper(void) :
- super("Creeper", 50, "mob.creeper.say", "mob.creeper.say", 0.6, 1.8)
+ super("Creeper", 50, "mob.creeper.say", "mob.creeper.say", 0.6, 1.8),
+ m_bIsBlowing(false),
+ m_bIsCharged(false)
{
}
@@ -26,3 +29,19 @@ void cCreeper::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+
+void cCreeper::DoTakeDamage(TakeDamageInfo & a_TDI)
+{
+ super::DoTakeDamage(a_TDI);
+
+ if (a_TDI.DamageType == dtLightning)
+ {
+ m_bIsCharged = true;
+ }
+
+ m_World->BroadcastEntityMetadata(*this);
+}
+
+
+
+
diff --git a/source/Mobs/Creeper.h b/source/Mobs/Creeper.h
index c1d46f462..c3d4edeae 100644
--- a/source/Mobs/Creeper.h
+++ b/source/Mobs/Creeper.h
@@ -18,6 +18,15 @@ public:
CLASS_PROTODEF(cCreeper);
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+ virtual void DoTakeDamage(TakeDamageInfo & a_TDI) override;
+
+ bool IsBlowing(void) const {return m_bIsBlowing; }
+ bool IsCharged(void) const {return m_bIsCharged; }
+
+private:
+
+ bool m_bIsBlowing, m_bIsCharged;
+
} ;
diff --git a/source/Mobs/Enderman.cpp b/source/Mobs/Enderman.cpp
index 1dc47876f..04c1a60e1 100644
--- a/source/Mobs/Enderman.cpp
+++ b/source/Mobs/Enderman.cpp
@@ -9,7 +9,10 @@
cEnderman::cEnderman(void) :
// TODO: The size is only a guesstimate, measure in vanilla and fix the size values here
- super("Enderman", 58, "mob.endermen.hit", "mob.endermen.death", 0.5, 2.5)
+ super("Enderman", 58, "mob.endermen.hit", "mob.endermen.death", 0.5, 2.5),
+ m_bIsScreaming(false),
+ CarriedBlock(E_BLOCK_AIR),
+ CarriedMeta(0)
{
}
diff --git a/source/Mobs/Enderman.h b/source/Mobs/Enderman.h
index c4f4ee364..32e40e70b 100644
--- a/source/Mobs/Enderman.h
+++ b/source/Mobs/Enderman.h
@@ -18,6 +18,17 @@ public:
CLASS_PROTODEF(cEnderman);
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+
+ bool IsScreaming(void) const {return m_bIsScreaming; }
+ BLOCKTYPE GetCarriedBlock(void) const {return CarriedBlock; }
+ NIBBLETYPE GetCarriedMeta(void) const {return CarriedMeta; }
+
+private:
+
+ bool m_bIsScreaming;
+ BLOCKTYPE CarriedBlock;
+ NIBBLETYPE CarriedMeta;
+
} ;
diff --git a/source/Mobs/Ghast.h b/source/Mobs/Ghast.h
index f9b60dfcf..a2adc21b9 100644
--- a/source/Mobs/Ghast.h
+++ b/source/Mobs/Ghast.h
@@ -18,6 +18,8 @@ public:
CLASS_PROTODEF(cGhast);
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+
+ bool IsCharging(void) const {return false; }
} ;
diff --git a/source/Mobs/Horse.cpp b/source/Mobs/Horse.cpp
index ec6154d26..caa1a3deb 100644
--- a/source/Mobs/Horse.cpp
+++ b/source/Mobs/Horse.cpp
@@ -16,6 +16,7 @@ cHorse::cHorse(int Type, int Color, int Style, int TameTimes) :
m_bIsRearing(false),
m_bIsMouthOpen(false),
m_bIsTame(false),
+ m_bIsSaddled(false),
m_Type(Type),
m_Color(Color),
m_Style(Style),
diff --git a/source/Mobs/Horse.h b/source/Mobs/Horse.h
index bca2e5327..bf39c8b13 100644
--- a/source/Mobs/Horse.h
+++ b/source/Mobs/Horse.h
@@ -20,6 +20,8 @@ public:
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
virtual void OnRightClicked(cPlayer & a_Player) override;
+
+ bool IsSaddled (void) const {return m_bIsSaddled; }
bool IsChested (void) const {return m_bHasChest; }
bool IsEating (void) const {return m_bIsEating; }
bool IsRearing (void) const {return m_bIsRearing; }
@@ -32,7 +34,7 @@ public:
private:
- bool m_bHasChest, m_bIsEating, m_bIsRearing, m_bIsMouthOpen, m_bIsTame;
+ bool m_bHasChest, m_bIsEating, m_bIsRearing, m_bIsMouthOpen, m_bIsTame, m_bIsSaddled;
int m_Type, m_Color, m_Style, m_Armour, m_TimesToTame, m_TameAttemptTimes;
} ;
diff --git a/source/Mobs/Monster.h b/source/Mobs/Monster.h
index b2676f5b1..d784f2eec 100644
--- a/source/Mobs/Monster.h
+++ b/source/Mobs/Monster.h
@@ -113,6 +113,11 @@ public:
/// Sets whether the mob burns in daylight. Only evaluated at next burn-decision tick
void SetBurnsInDaylight(bool a_BurnsInDaylight) { m_BurnsInDaylight = a_BurnsInDaylight; }
+
+ // Overridables to handle ageable mobs
+ virtual bool IsBaby (void) const { return false; }
+ virtual bool IsTame (void) const { return false; }
+ virtual bool IsSitting (void) const { return false; }
enum MState{ATTACKING, IDLE, CHASING, ESCAPING} m_EMState;
enum MPersonality{PASSIVE,AGGRESSIVE,COWARDLY} m_EMPersonality;
@@ -147,6 +152,7 @@ protected:
void AddRandomDropItem(cItems & a_Drops, unsigned int a_Min, unsigned int a_Max, short a_Item, short a_ItemHealth = 0);
void HandleDaylightBurning(cChunk & a_Chunk);
+
} ; // tolua_export
diff --git a/source/Mobs/Witch.h b/source/Mobs/Witch.h
index ce0b49deb..4e637beea 100644
--- a/source/Mobs/Witch.h
+++ b/source/Mobs/Witch.h
@@ -18,6 +18,8 @@ public:
CLASS_PROTODEF(cWitch);
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+
+ bool IsAngry(void) const {return ((m_EMState == ATTACKING) || (m_EMState == CHASING)); }
} ;
diff --git a/source/Mobs/Zombie.cpp b/source/Mobs/Zombie.cpp
index 9b238baef..f495fe5ee 100644
--- a/source/Mobs/Zombie.cpp
+++ b/source/Mobs/Zombie.cpp
@@ -8,8 +8,10 @@
-cZombie::cZombie(void) :
- super("Zombie", 54, "mob.zombie.hurt", "mob.zombie.death", 0.6, 1.8)
+cZombie::cZombie(bool IsVillagerZombie) :
+ super("Zombie", 54, "mob.zombie.hurt", "mob.zombie.death", 0.6, 1.8),
+ m_bIsConverting(false),
+ m_bIsVillagerZombie(IsVillagerZombie)
{
SetBurnsInDaylight(true);
}
diff --git a/source/Mobs/Zombie.h b/source/Mobs/Zombie.h
index 4835a53c4..148b1121e 100644
--- a/source/Mobs/Zombie.h
+++ b/source/Mobs/Zombie.h
@@ -12,11 +12,19 @@ class cZombie :
typedef cAggressiveMonster super;
public:
- cZombie(void);
+ cZombie(bool IsVillagerZombie);
CLASS_PROTODEF(cZombie);
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+
+ bool IsVillagerZombie(void) const {return m_bIsVillagerZombie; }
+ bool IsConverting(void) const {return m_bIsConverting; }
+
+private:
+
+ bool m_bIsVillagerZombie, m_bIsConverting;
+
} ;
diff --git a/source/Protocol/Protocol125.cpp b/source/Protocol/Protocol125.cpp
index e2309c295..0f5f3a616 100644
--- a/source/Protocol/Protocol125.cpp
+++ b/source/Protocol/Protocol125.cpp
@@ -24,8 +24,27 @@ Documentation:
#include "../UI/Window.h"
#include "../Root.h"
#include "../Server.h"
+
+#include "../Entities/ProjectileEntity.h"
+#include "../Entities/Minecart.h"
#include "../Entities/FallingBlock.h"
+#include "../Mobs/Monster.h"
+#include "../Mobs/Creeper.h"
+#include "../Mobs/Bat.h"
+#include "../Mobs/Pig.h"
+#include "../Mobs/Villager.h"
+#include "../Mobs/Zombie.h"
+#include "../Mobs/Ghast.h"
+#include "../Mobs/Wolf.h"
+#include "../Mobs/Sheep.h"
+#include "../Mobs/Enderman.h"
+#include "../Mobs/Skeleton.h"
+#include "../Mobs/Witch.h"
+#include "../Mobs/Slime.h"
+#include "../Mobs/Magmacube.h"
+#include "../Mobs/Horse.h"
+
@@ -1655,70 +1674,70 @@ void cProtocol125::WriteMetadata(const cEntity & a_Entity)
{
WriteByte(0x51);
// No idea how Mojang makes their carts shakey shakey, so here is a complicated one-liner expression that does something similar
- WriteInt( (((a_Entity.GetMaxHealth() / 2) - (a_Entity.GetHealth() - (a_Entity.GetMaxHealth() / 2))) * a_Entity.LastDamage()) * 4 );
+ WriteInt( (((a_Entity.GetMaxHealth() / 2) - (a_Entity.GetHealth() - (a_Entity.GetMaxHealth() / 2))) * ((cMinecart &)a_Entity).LastDamage()) * 4 );
WriteByte(0x52);
WriteInt(1); // Shaking direction, doesn't seem to affect anything
WriteByte(0x73);
- WriteFloat((float)(a_Entity.LastDamage() + 10)); // Damage taken / shake effect multiplyer
+ WriteFloat((float)(((cMinecart &)a_Entity).LastDamage() + 10)); // Damage taken / shake effect multiplyer
}
else if (a_Entity.IsA("cCreeper"))
{
WriteByte(0x10);
- WriteByte(a_Entity.IsBlowing() ? 1 : -1); // Blowing up?
+ WriteByte(((cCreeper &)a_Entity).IsBlowing() ? 1 : -1); // Blowing up?
WriteByte(0x11);
- WriteByte(a_Entity.IsCharged() ? 1 : 0); // Lightning-charged?
+ WriteByte(((cCreeper &)a_Entity).IsCharged() ? 1 : 0); // Lightning-charged?
}
else if (a_Entity.IsA("cMinecartWithFurnace"))
{
WriteByte(0x10);
- WriteByte(a_Entity.IsFueled() ? 1 : 0); // Fueled?
+ WriteByte(((const cMinecartWithFurnace &)a_Entity).IsFueled() ? 1 : 0); // Fueled?
}
else if (a_Entity.IsA("cBat"))
{
WriteByte(0x10);
- WriteByte(a_Entity.IsHanging() ? 1 : 0); // Upside down?
+ WriteByte(((const cBat &)a_Entity).IsHanging() ? 1 : 0); // Upside down?
}
else if (a_Entity.IsA("cPig"))
{
WriteByte(0x10);
- WriteByte(a_Entity.IsSaddled() ? 1 : 0); // Saddled?
+ WriteByte(((const cPig &)a_Entity).IsSaddled() ? 1 : 0); // Saddled?
}
else if (a_Entity.IsA("cVillager"))
{
WriteByte(0x50);
- WriteInt(a_Entity.GetVilType()); // What sort of TESTIFICATE?
+ WriteInt(((const cVillager &)a_Entity).GetVilType()); // What sort of TESTIFICATE?
}
else if (a_Entity.IsA("cZombie"))
{
WriteByte(0xC);
- WriteByte(a_Entity.IsBaby() ? 1 : 0); // Babby zombie?
+ WriteByte(((const cZombie &)a_Entity).IsBaby() ? 1 : 0); // Babby zombie?
WriteByte(0xD);
- WriteByte(a_Entity.IsVillZomb() ? 1 : 0); // Converted zombie?
+ WriteByte(((const cZombie &)a_Entity).IsVillagerZombie() ? 1 : 0); // Converted zombie?
WriteByte(0xE);
- WriteByte(a_Entity.IsConvert() ? 1 : 0); // Converted-but-converting-back zombllager?
+ WriteByte(((const cZombie &)a_Entity).IsConverting() ? 1 : 0); // Converted-but-converting-back zombllager?
}
else if (a_Entity.IsA("cGhast"))
{
WriteByte(0x10);
- WriteByte(a_Entity.IsCharging()); // About to eject un flamé-bol? :P
+ WriteByte(((const cGhast &)a_Entity).IsCharging()); // About to eject un flamé-bol? :P
}
else if (a_Entity.IsA("cArrowEntity"))
{
WriteByte(0x10);
- WriteByte(a_Entity.IsCritical() ? 1 : 0); // Critical hitting arrow?
+ WriteByte(((const cArrowEntity &)a_Entity).IsCritical() ? 1 : 0); // Critical hitting arrow?
}
else if (a_Entity.IsA("cWolf"))
{
Byte WolfStatus = 0;
- if (a_Entity.IsSitting())
+ if (((const cWolf &)a_Entity).IsSitting())
{
WolfStatus |= 0x1;
}
- if (a_Entity.IsAngry())
+ if (((const cWolf &)a_Entity).IsAngry())
{
WolfStatus |= 0x2;
}
- if (a_Entity.IsTame())
+ if (((const cWolf &)a_Entity).IsTame())
{
WolfStatus |= 0x4;
}
@@ -1728,7 +1747,7 @@ void cProtocol125::WriteMetadata(const cEntity & a_Entity)
WriteByte(0x72);
WriteFloat((float)(a_Entity.GetHealth())); // Tail health-o-meter (only shown when tamed, by the way)
WriteByte(0x13);
- WriteByte(a_Entity.IsBegging() ? 1 : 0); // Ultra cute mode?
+ WriteByte(((const cWolf &)a_Entity).IsBegging() ? 1 : 0); // Ultra cute mode?
}
else if (a_Entity.IsA("cSheep"))
{
@@ -1737,9 +1756,9 @@ void cProtocol125::WriteMetadata(const cEntity & a_Entity)
WriteByte(0x10);
Byte SheepMetadata = 0;
- SheepMetadata = a_Entity.GetFurColor(); // Fur colour
+ SheepMetadata = ((const cSheep &)a_Entity).GetFurColor(); // Fur colour
- if (a_Entity.IsSheared()) // Is sheared?
+ if (((const cSheep &)a_Entity).IsSheared()) // Is sheared?
{
SheepMetadata |= 0x16;
}
@@ -1748,55 +1767,62 @@ void cProtocol125::WriteMetadata(const cEntity & a_Entity)
else if (a_Entity.IsA("cEnderman"))
{
WriteByte(0x10);
- WriteByte(a_Entity.CarriedBlock()); // Stolen block
+ WriteByte((Byte)(((cEnderman &)a_Entity).GetCarriedBlock())); // Block that he stole from your house
WriteByte(0x11);
- WriteByte(a_Entity.CarriedMeta()); // Stolen metea
+ WriteByte((Byte)(((cEnderman &)a_Entity).GetCarriedMeta())); // Meta of block that he stole from your house
WriteByte(0x12);
- WriteByte(a_Entity.IsScream() ? 1 : 0); // I HATE YER FACE, I SCWEAM AT YER FACE
+ WriteByte(((cEnderman &)a_Entity).IsScreaming() ? 1 : 0); // Screaming at your face?
}
else if (a_Entity.IsA("cSkeleton"))
{
WriteByte(0xD);
- WriteByte(a_Entity.IsWither() ? 1 : 0); // It's a skeleton, but it's not
+ WriteByte(((const cSkeleton &)a_Entity).IsWither() ? 1 : 0); // It's a skeleton, but it's not
}
else if (a_Entity.IsA("cWitch"))
{
WriteByte(0x15);
- WriteByte(a_Entity.IsNosey() ? 1 : 0); // Drinking-nose: like Squidward
+ WriteByte(((cWitch &)a_Entity).IsAngry() ? 1 : 0); // Aggravated? Doesn't seem to do anything
}
else if ((a_Entity.IsA("cSlime")) || (a_Entity.IsA("cMagmaCube")))
{
WriteByte(0x10);
- WriteByte(a_Entity.GetSize()); // Size of slime - HEWGE, meh, cute BABBY SLIME
+ if (a_Entity.IsA("cSlime"))
+ {
+ WriteByte(((const cSlime &)a_Entity).GetSize()); // Size of slime - HEWGE, meh, cute BABBY SLIME
+ }
+ else
+ {
+ WriteByte(((const cMagmaCube &)a_Entity).GetSize()); // Size of slime - HEWGE, meh, cute BABBY SLIME
+ }
}
else if (a_Entity.IsA("cHorse"))
{
int Flags = 0;
- if (a_Entity.IsTame())
+ if (((const cHorse &)a_Entity).IsTame())
{
Flags |= 0x2;
}
- if (a_Entity.IsSaddled())
+ if (((const cHorse &)a_Entity).IsSaddled())
{
Flags |= 0x4;
}
- if (a_Entity.IsChested())
+ if (((const cHorse &)a_Entity).IsChested())
{
Flags |= 0x8;
}
- if (a_Entity.IsBaby())
+ if (((const cHorse &)a_Entity).IsBaby())
{
Flags |= 0x10; // IsBred flag, according to wiki.vg - don't think it does anything in multiplayer
}
- if (a_Entity.IsEating())
+ if (((const cHorse &)a_Entity).IsEating())
{
Flags |= 0x20;
}
- if (a_Entity.IsRearing())
+ if (((const cHorse &)a_Entity).IsRearing())
{
Flags |= 0x40;
}
- if (a_Entity.IsMthOpen())
+ if (((const cHorse &)a_Entity).IsMthOpen())
{
Flags |= 0x80;
}
@@ -1804,16 +1830,16 @@ void cProtocol125::WriteMetadata(const cEntity & a_Entity)
WriteInt(Flags);
WriteByte(0x13);
- WriteByte(a_Entity.GetHType()); // Type of horse (donkey, chestnut, etc.)
+ WriteByte(((const cHorse &)a_Entity).GetHType()); // Type of horse (donkey, chestnut, etc.)
WriteByte(0x54);
int Appearance = 0;
- Appearance = a_Entity.GetHColor(); // Mask FF
- Appearance |= a_Entity.GetHStyle() * 256; // Mask FF00, so multiply by 256
+ Appearance = ((const cHorse &)a_Entity).GetHColor(); // Mask FF
+ Appearance |= ((const cHorse &)a_Entity).GetHStyle() * 256; // Mask FF00, so multiply by 256
WriteInt(Appearance);
WriteByte(0x56);
- WriteInt(a_Entity.GetHArmour()); // Horshey armour
+ WriteInt(((const cHorse &)a_Entity).GetHArmour()); // Horshey armour
}
// End Specific Metadata
diff --git a/source/World.cpp b/source/World.cpp
index 784df49f3..6346a7cb8 100644
--- a/source/World.cpp
+++ b/source/World.cpp
@@ -2616,7 +2616,7 @@ int cWorld::SpawnMob(double a_PosX, double a_PosY, double a_PosZ, cMonster::eTyp
case cMonster::mtWitch: Monster = new cWitch(); break;
case cMonster::mtWither: Monster = new cWither(); break;
case cMonster::mtWolf: Monster = new cWolf(); break;
- case cMonster::mtZombie: Monster = new cZombie(); break;
+ case cMonster::mtZombie: Monster = new cZombie(false); break; // TODO: Villager infection
case cMonster::mtZombiePigman: Monster = new cZombiePigman(); break;
default: