1
0

Update entity sizes

This commit is contained in:
Tiger Wang 2021-04-06 16:09:16 +01:00
parent 1394fc8eb5
commit 6e80f7544d
70 changed files with 124 additions and 112 deletions

View File

@ -10,7 +10,7 @@
cArrowEntity::cArrowEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed):
Super(pkArrow, a_Creator, a_Pos, a_Speed, 0.5, 0.5),
Super(pkArrow, a_Creator, a_Pos, a_Speed, 0.5f, 0.5f),
m_PickupState(psNoPickup),
m_DamageCoeff(2),
m_IsCritical(false),

View File

@ -15,7 +15,7 @@
cBoat::cBoat(Vector3d a_Pos, eMaterial a_Material) :
Super(etBoat, a_Pos, 0.98, 0.7),
Super(etBoat, a_Pos, 1.375f, 0.5625f),
m_LastDamage(0), m_ForwardDirection(0),
m_DamageTaken(0.0f), m_Material(a_Material),
m_RightPaddleUsed(false), m_LeftPaddleUsed(false)

View File

@ -20,7 +20,7 @@ cEnderCrystal::cEnderCrystal(Vector3d a_Pos, bool a_ShowBottom) :
cEnderCrystal::cEnderCrystal(Vector3d a_Pos, Vector3i a_BeamTarget, bool a_DisplayBeam, bool a_ShowBottom) :
Super(etEnderCrystal, a_Pos, 1.0, 1.0),
Super(etEnderCrystal, a_Pos, 2.0f, 2.0f),
m_BeamTarget(a_BeamTarget),
m_DisplayBeam(a_DisplayBeam),
m_ShowBottom(a_ShowBottom)
@ -92,7 +92,7 @@ void cEnderCrystal::KilledBy(TakeDamageInfo & a_TDI)
// Destroy first so the Explodinator doesn't find us (when iterating through entities):
Destroy();
m_World->DoExplosionAt(6.0, GetPosX(), GetPosY() + (GetHeight() / 2.0), GetPosZ(), true, esEnderCrystal, this);
m_World->DoExplosionAt(6.0, GetPosX(), GetPosY() + GetHeight() / 2, GetPosZ(), true, esEnderCrystal, this);
const auto Position = GetPosition().Floor();
if (cChunkDef::IsValidHeight(Position.y))

View File

@ -33,7 +33,7 @@ static UInt32 GetNextUniqueID(void)
////////////////////////////////////////////////////////////////////////////////
// cEntity:
cEntity::cEntity(eEntityType a_EntityType, Vector3d a_Pos, double a_Width, double a_Height):
cEntity::cEntity(eEntityType a_EntityType, Vector3d a_Pos, float a_Width, float a_Height):
m_UniqueID(GetNextUniqueID()),
m_Health(1),
m_MaxHealth(1),
@ -59,8 +59,6 @@ cEntity::cEntity(eEntityType a_EntityType, Vector3d a_Pos, double a_Width, doubl
m_IsInLava(false),
m_IsInWater(false),
m_IsHeadInWater(false),
m_Width(a_Width),
m_Height(a_Height),
m_AirLevel(MAX_AIR_LEVEL),
m_AirTickTimer(DROWNING_TICKS),
m_TicksAlive(0),
@ -71,6 +69,8 @@ cEntity::cEntity(eEntityType a_EntityType, Vector3d a_Pos, double a_Width, doubl
m_Position(a_Pos),
m_WaterSpeed(0, 0, 0),
m_Mass (0.001), // Default 1g
m_Width(a_Width),
m_Height(a_Height),
m_InvulnerableTicks(0)
{
m_WorldChangeInfo.m_NewWorld = nullptr;
@ -1098,7 +1098,7 @@ void cEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
NextPos = HitCoords;
// Avoid movement in the direction of the blockface that has been hit and correct for collision box:
double HalfWidth = GetWidth() / 2.0;
const auto HalfWidth = GetWidth() / 2;
switch (HitBlockFace)
{
case BLOCK_FACE_XM:
@ -1714,6 +1714,16 @@ void cEntity::SetIsTicking(bool a_IsTicking)
void cEntity::SetSize(const float a_Width, const float a_Height)
{
m_Width = a_Width;
m_Height = a_Height;
}
void cEntity::HandleAir(void)
{
// Ref.: https://minecraft.gamepedia.com/Chunk_format

View File

@ -169,7 +169,7 @@ public:
static const UInt32 INVALID_ID = 0; // Exported to Lua in ManualBindings.cpp, ToLua doesn't parse initialized constants.
cEntity(eEntityType a_EntityType, Vector3d a_Pos, double a_Width, double a_Height);
cEntity(eEntityType a_EntityType, Vector3d a_Pos, float a_Width, float a_Height);
virtual ~cEntity() = default;
/** Spawns the entity in the world; returns true if spawned, false if not (plugin disallowed).
@ -225,7 +225,7 @@ public:
cWorld * GetWorld(void) const { return m_World; }
double GetHeadYaw (void) const { return m_HeadYaw; } // In degrees
double GetHeight (void) const { return m_Height; }
float GetHeight (void) const { return m_Height; }
double GetMass (void) const { return m_Mass; }
double GetPosX (void) const { return m_Position.x; }
double GetPosY (void) const { return m_Position.y; }
@ -237,7 +237,7 @@ public:
double GetSpeedX (void) const { return m_Speed.x; }
double GetSpeedY (void) const { return m_Speed.y; }
double GetSpeedZ (void) const { return m_Speed.z; }
double GetWidth (void) const { return m_Width; }
float GetWidth (void) const { return m_Width; }
int GetChunkX(void) const { return FloorC(m_Position.x / cChunkDef::Width); }
int GetChunkZ(void) const { return FloorC(m_Position.z / cChunkDef::Width); }
@ -579,6 +579,9 @@ public:
/** Set the entity's status to either ticking or not ticking. */
void SetIsTicking(bool a_IsTicking);
/** Update an entity's size, for example, on body stance changes. */
void SetSize(float a_Width, float a_Height);
/** Adds a mob to the leashed list of mobs. */
void AddLeashedMob(cMonster * a_Monster);
@ -686,12 +689,6 @@ protected:
/** If the entity's head is in a water block */
bool m_IsHeadInWater;
/** Width of the entity, in the XZ plane. Since entities are represented as cylinders, this is more of a diameter. */
double m_Width;
/** Height of the entity (Y axis). */
double m_Height;
/** Air level of a mobile */
int m_AirLevel;
int m_AirTickTimer;
@ -748,6 +745,12 @@ private:
/** Measured in Kilograms (Kg) */
double m_Mass;
/** Width of the entity, in the XZ plane. Since entities are represented as cylinders, this is more of a diameter. */
float m_Width;
/** Height of the entity (Y axis). */
float m_Height;
/** If a player hit a entity, the entity receive a invulnerable of 10 ticks.
While this ticks, a player can't hit this entity. */
int m_InvulnerableTicks;

View File

@ -9,7 +9,7 @@
cExpBottleEntity::cExpBottleEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed) :
Super(pkExpBottle, a_Creator, a_Pos, 0.25, 0.25)
Super(pkExpBottle, a_Creator, a_Pos, 0.25f, 0.25f)
{
SetSpeed(a_Speed);
}

View File

@ -6,7 +6,7 @@
cExpOrb::cExpOrb(Vector3d a_Pos, int a_Reward):
Super(etExpOrb, a_Pos, 0.98, 0.98), // TODO: Check size
Super(etExpOrb, a_Pos, 0.5f, 0.5f),
m_Reward(a_Reward),
m_Timer(0)
{

View File

@ -12,7 +12,7 @@
cFallingBlock::cFallingBlock(Vector3d a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta):
Super(etFallingBlock, a_Position, 0.98, 0.98),
Super(etFallingBlock, a_Position, 0.98f, 0.98f),
m_BlockType(a_BlockType),
m_BlockMeta(a_BlockMeta)
{

View File

@ -8,7 +8,7 @@
cFireChargeEntity::cFireChargeEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed):
Super(pkFireCharge, a_Creator, a_Pos, 0.3125, 0.3125)
Super(pkFireCharge, a_Creator, a_Pos, 0.3125f, 0.3125f)
{
SetSpeed(a_Speed);
SetGravity(0);

View File

@ -9,7 +9,7 @@
cFireworkEntity::cFireworkEntity(cEntity * a_Creator, Vector3d a_Pos, const cItem & a_Item) :
Super(pkFirework, a_Creator, a_Pos, 0.25, 0.25),
Super(pkFirework, a_Creator, a_Pos, 0.25f, 0.25f),
m_TicksToExplosion(a_Item.m_FireworkItem.m_FlightTimeInTicks),
m_FireworkItem(a_Item)
{

View File

@ -75,7 +75,7 @@ protected:
cFloater::cFloater(Vector3d a_Pos, Vector3d a_Speed, UInt32 a_PlayerID, int a_CountDownTime) :
Super(etFloater, a_Pos, 0.2, 0.2),
Super(etFloater, a_Pos, 0.25f, 0.25f),
m_BitePos(a_Pos),
m_CanPickupItem(false),
m_PickupCountDown(0),

View File

@ -10,7 +10,7 @@
cHangingEntity::cHangingEntity(eEntityType a_EntityType, eBlockFace a_Facing, Vector3d a_Pos) :
Super(a_EntityType, a_Pos, 0.8, 0.8),
Super(a_EntityType, a_Pos, 0.5f, 0.5f),
m_Facing(cHangingEntity::BlockFaceToProtocolFace(a_Facing))
{
SetMaxHealth(1);

View File

@ -95,7 +95,7 @@ protected:
// cMinecart:
cMinecart::cMinecart(ePayload a_Payload, Vector3d a_Pos):
Super(etMinecart, a_Pos, 0.98, 0.7),
Super(etMinecart, a_Pos, 0.98f, 0.7f),
m_Payload(a_Payload),
m_LastDamage(0),
m_DetectorRailPosition(0, 0, 0),

View File

@ -14,7 +14,7 @@
cPawn::cPawn(eEntityType a_EntityType, double a_Width, double a_Height) :
cPawn::cPawn(eEntityType a_EntityType, float a_Width, float a_Height) :
Super(a_EntityType, Vector3d(), a_Width, a_Height),
m_EntityEffects(tEffectMap()),
m_LastGroundHeight(0),

View File

@ -22,7 +22,7 @@ public:
CLASS_PROTODEF(cPawn)
cPawn(eEntityType a_EntityType, double a_Width, double a_Height);
cPawn(eEntityType a_EntityType, float a_Width, float a_Height);
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
virtual void KilledBy(TakeDamageInfo & a_TDI) override;

View File

@ -94,7 +94,7 @@ protected:
// cPickup:
cPickup::cPickup(Vector3d a_Pos, const cItem & a_Item, bool IsPlayerCreated, Vector3f a_Speed, int a_LifetimeTicks, bool a_CanCombine):
Super(etPickup, a_Pos, 0.2, 0.2),
Super(etPickup, a_Pos, 0.25f, 0.25f),
m_Timer(0),
m_Item(a_Item),
m_bCollected(false),

View File

@ -104,7 +104,7 @@ cPlayer::BodyStanceGliding::BodyStanceGliding(cPlayer & a_Player) :
cPlayer::cPlayer(const std::shared_ptr<cClientHandle> & a_Client) :
Super(etPlayer, 0.6, 1.8),
Super(etPlayer, 0.6f, 1.8f),
m_BodyStance(BodyStanceStanding(*this)),
m_FoodLevel(MAX_FOOD_LEVEL),
m_FoodSaturationLevel(5.0),
@ -2821,16 +2821,6 @@ void cPlayer::AddKnownItem(const cItem & a_Item)
void cPlayer::SetSize(const float a_Width, const float a_Height)
{
m_Width = a_Width;
m_Height = a_Height;
}
void cPlayer::AddKnownRecipe(UInt32 a_RecipeId)
{
auto Response = m_KnownRecipes.insert(a_RecipeId);

View File

@ -592,9 +592,6 @@ public:
If the item is already known, does nothing. */
void AddKnownItem(const cItem & a_Item);
/** Update a player's size, for example, on body stance changes. */
void SetSize(float a_Width, float a_Height);
// cEntity overrides:
virtual void AttachTo(cEntity * a_AttachTo) override;
virtual void Detach(void) override;

View File

@ -219,7 +219,7 @@ protected:
////////////////////////////////////////////////////////////////////////////////
// cProjectileEntity:
cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, Vector3d a_Pos, double a_Width, double a_Height):
cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, Vector3d a_Pos, float a_Width, float a_Height):
Super(etProjectile, a_Pos, a_Width, a_Height),
m_ProjectileKind(a_Kind),
m_CreatorData(
@ -237,7 +237,7 @@ cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, Vector3d
cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed, double a_Width, double a_Height):
cProjectileEntity::cProjectileEntity(eKind a_Kind, cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed, float a_Width, float a_Height):
cProjectileEntity(a_Kind, a_Creator, a_Pos, a_Width, a_Height)
{
SetSpeed(a_Speed);

View File

@ -48,8 +48,8 @@ public:
CLASS_PROTODEF(cProjectileEntity)
cProjectileEntity(eKind a_Kind, cEntity * a_Creator, Vector3d a_Pos, double a_Width, double a_Height);
cProjectileEntity(eKind a_Kind, cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed, double a_Width, double a_Height);
cProjectileEntity(eKind a_Kind, cEntity * a_Creator, Vector3d a_Pos, float a_Width, float a_Height);
cProjectileEntity(eKind a_Kind, cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed, float a_Width, float a_Height);
/** Creates a new instance of the specified projectile entity.
a_Item is the item from which the projectile originated (such as firework or arrow). */

View File

@ -17,7 +17,7 @@ cSplashPotionEntity::cSplashPotionEntity(
Vector3d a_Speed,
const cItem & a_Item
):
Super(pkSplashPotion, a_Creator, a_Pos, 0.25, 0.25),
Super(pkSplashPotion, a_Creator, a_Pos, 0.25f, 0.25f),
m_Item(a_Item),
m_DestroyTimer(-1)
{

View File

@ -9,7 +9,7 @@
cTNTEntity::cTNTEntity(Vector3d a_Pos, unsigned a_FuseTicks) :
Super(etTNT, a_Pos, 0.98, 0.98),
Super(etTNT, a_Pos, 0.98f, 0.98f),
m_FuseTicks(a_FuseTicks)
{
SetGravity(-16.0f);

View File

@ -8,7 +8,7 @@
cThrownEggEntity::cThrownEggEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed):
Super(pkEgg, a_Creator, a_Pos, 0.25, 0.25),
Super(pkEgg, a_Creator, a_Pos, 0.25f, 0.25f),
m_DestroyTimer(-1)
{
SetSpeed(a_Speed);

View File

@ -9,7 +9,7 @@
cThrownEnderPearlEntity::cThrownEnderPearlEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed):
Super(pkEnderPearl, a_Creator, a_Pos, 0.25, 0.25),
Super(pkEnderPearl, a_Creator, a_Pos, 0.25f, 0.25f),
m_DestroyTimer(-1)
{
SetSpeed(a_Speed);

View File

@ -8,7 +8,7 @@
cThrownSnowballEntity::cThrownSnowballEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed):
Super(pkSnowball, a_Creator, a_Pos, 0.25, 0.25),
Super(pkSnowball, a_Creator, a_Pos, 0.25f, 0.25f),
m_DestroyTimer(-1)
{
SetSpeed(a_Speed);

View File

@ -13,7 +13,7 @@
cWitherSkullEntity::cWitherSkullEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed):
Super(pkWitherSkull, a_Creator, a_Pos, 0.25, 0.25)
Super(pkWitherSkull, a_Creator, a_Pos, 0.3125f, 0.3125f)
{
SetSpeed(a_Speed);
SetGravity(0);

View File

@ -11,7 +11,7 @@
cAggressiveMonster::cAggressiveMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, const AString & a_SoundAmbient, double a_Width, double a_Height) :
cAggressiveMonster::cAggressiveMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, const AString & a_SoundAmbient, float a_Width, float a_Height) :
Super(a_ConfigName, a_MobType, a_SoundHurt, a_SoundDeath, a_SoundAmbient, a_Width, a_Height)
{
m_EMPersonality = AGGRESSIVE;

View File

@ -20,8 +20,8 @@ public:
const AString & a_SoundHurt,
const AString & a_SoundDeath,
const AString & a_SoundAmbient,
double a_Width,
double a_Height
float a_Width,
float a_Height
);
virtual void Tick (std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;

View File

@ -6,7 +6,7 @@
cBat::cBat(void) :
Super("Bat", mtBat, "entity.bat.hurt", "entity.bat.death", "entity.bat.ambient", 0.5, 0.9)
Super("Bat", mtBat, "entity.bat.hurt", "entity.bat.death", "entity.bat.ambient", 0.5f, 0.9f)
{
SetGravity(-2.0f);
SetAirDrag(0.05f);

View File

@ -9,7 +9,7 @@
cBlaze::cBlaze(void) :
Super("Blaze", mtBlaze, "entity.blaze.hurt", "entity.blaze.death", "entity.blaze.ambient", 0.6, 1.8),
Super("Blaze", mtBlaze, "entity.blaze.hurt", "entity.blaze.death", "entity.blaze.ambient", 0.6f, 1.8f),
m_IsCharging(false),
m_ChargeTimer(0)
{

View File

@ -8,7 +8,7 @@
cCaveSpider::cCaveSpider(void) :
Super("CaveSpider", mtCaveSpider, "entity.spider.hurt", "entity.spider.death", "entity.spider.ambient", 0.7, 0.5)
Super("CaveSpider", mtCaveSpider, "entity.spider.hurt", "entity.spider.death", "entity.spider.ambient", 0.7f, 0.5f)
{
}

View File

@ -8,7 +8,7 @@
cChicken::cChicken(void) :
Super("Chicken", mtChicken, "entity.chicken.hurt", "entity.chicken.death", "entity.chicken.ambient", 0.4, 0.7),
Super("Chicken", mtChicken, "entity.chicken.hurt", "entity.chicken.death", "entity.chicken.ambient", 0.4f, 0.7f),
m_EggDropTimer(0)
{
SetGravity(-2.0f);

View File

@ -9,7 +9,7 @@
cCow::cCow(void) :
Super("Cow", mtCow, "entity.cow.hurt", "entity.cow.death", "entity.cow.ambient", 0.9, 1.3)
Super("Cow", mtCow, "entity.cow.hurt", "entity.cow.death", "entity.cow.ambient", 0.9f, 1.4f)
{
}

View File

@ -11,7 +11,7 @@
cCreeper::cCreeper(void) :
Super("Creeper", mtCreeper, "entity.creeper.hurt", "entity.creeper.death", "entity.creeper.ambient", 0.6, 1.8),
Super("Creeper", mtCreeper, "entity.creeper.hurt", "entity.creeper.death", "entity.creeper.ambient", 0.6f, 1.7f),
m_bIsBlowing(false),
m_bIsCharged(false),
m_BurnedWithFlintAndSteel(false),

View File

@ -10,8 +10,7 @@
cEnderDragon::cEnderDragon(void) :
// TODO: Vanilla source says this, but is it right? Dragons fly, they don't stand
Super("EnderDragon", mtEnderDragon, "entity.enderdragon.hurt", "entity.enderdragon.death", "entity.enderdragon.ambient", 16.0, 8.0)
Super("EnderDragon", mtEnderDragon, "entity.enderdragon.hurt", "entity.enderdragon.death", "entity.enderdragon.ambient", 16, 8)
{
}

View File

@ -79,7 +79,7 @@ protected:
cEnderman::cEnderman(void) :
Super("Enderman", mtEnderman, "entity.endermen.hurt", "entity.endermen.death", "entity.endermen.ambient", 0.5, 2.9),
Super("Enderman", mtEnderman, "entity.endermen.hurt", "entity.endermen.death", "entity.endermen.ambient", 0.6f, 2.9f),
m_bIsScreaming(false),
m_CarriedBlock(E_BLOCK_AIR),
m_CarriedMeta(0)

View File

@ -8,7 +8,7 @@
cGiant::cGiant(void) :
Super("Giant", mtGiant, "entity.zombie.hurt", "entity.zombie.death", "entity.zombie.ambient", 3.6, 10.8)
Super("Giant", mtGiant, "entity.zombie.hurt", "entity.zombie.death", "entity.zombie.ambient", 3.6f, 12)
{
}

View File

@ -9,7 +9,7 @@
cGuardian::cGuardian(void) :
Super("Guardian", mtGuardian, "entity.guardian.hurt", "entity.guardian.death", "entity.guardian.ambient", 0.875, 0.8)
Super("Guardian", mtGuardian, "entity.guardian.hurt", "entity.guardian.death", "entity.guardian.ambient", 0.85f, 0.85f)
{
}

View File

@ -11,7 +11,7 @@
cHorse::cHorse(int Type, int Color, int Style, int TameTimes) :
Super("Horse", mtHorse, "entity.horse.hurt", "entity.horse.death", "entity.horse.ambient", 1.4, 1.6),
Super("Horse", mtHorse, "entity.horse.hurt", "entity.horse.death", "entity.horse.ambient", 1.4f, 1.6f),
cEntityWindowOwner(this),
m_bHasChest(false),
m_bIsEating(false),

View File

@ -8,7 +8,7 @@
cIronGolem::cIronGolem(void) :
Super("IronGolem", mtIronGolem, "entity.irongolem.hurt", "entity.irongolem.death", "entity.irongolem.ambient", 1.4, 2.9)
Super("IronGolem", mtIronGolem, "entity.irongolem.hurt", "entity.irongolem.death", "entity.irongolem.ambient", 1.4f, 2.7f)
{
}

View File

@ -7,7 +7,15 @@
cMagmaCube::cMagmaCube(int a_Size) :
Super("MagmaCube", mtMagmaCube, Printf("entity.%smagmacube.hurt", GetSizeName(a_Size).c_str()), Printf("entity.%smagmacube.death", GetSizeName(a_Size).c_str()), "", 0.6 * a_Size, 0.6 * a_Size),
Super(
"MagmaCube",
mtMagmaCube,
Printf("entity.%smagmacube.hurt", GetSizeName(a_Size).c_str()),
Printf("entity.%smagmacube.death", GetSizeName(a_Size).c_str()),
"",
0.51f * a_Size,
0.51f * a_Size
),
m_Size(a_Size)
{
}

View File

@ -80,7 +80,7 @@ static const struct
////////////////////////////////////////////////////////////////////////////////
// cMonster:
cMonster::cMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, const AString & a_SoundAmbient, double a_Width, double a_Height)
cMonster::cMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, const AString & a_SoundAmbient, float a_Width, float a_Height)
: Super(etMonster, a_Width, a_Height)
, m_EMState(IDLE)
, m_EMPersonality(AGGRESSIVE)

View File

@ -45,7 +45,7 @@ public:
a_MobType is the type of the mob (also used in the protocol ( http://wiki.vg/Entities#Mobs 2012_12_22))
a_SoundHurt and a_SoundDeath are assigned into m_SoundHurt and m_SoundDeath, respectively
*/
cMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, const AString & a_SoundAmbient, double a_Width, double a_Height);
cMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, const AString & a_SoundAmbient, float a_Width, float a_Height);
CLASS_PROTODEF(cMonster)

View File

@ -9,7 +9,7 @@
cMooshroom::cMooshroom(void) :
Super("Mooshroom", mtMooshroom, "entity.cow.hurt", "entity.cow.death", "entity.cow.ambient", 0.9, 1.3)
Super("Mooshroom", mtMooshroom, "entity.cow.hurt", "entity.cow.death", "entity.cow.ambient", 0.9f, 1.4f)
{
}

View File

@ -21,7 +21,7 @@
*/
cOcelot::cOcelot(void) :
Super("Ocelot", mtOcelot, "entity.cat.hurt", "entity.cat.death", "entity.cat.ambient", 0.6, 0.8),
Super("Ocelot", mtOcelot, "entity.cat.hurt", "entity.cat.death", "entity.cat.ambient", 0.6f, 0.7f),
m_IsSitting(false),
m_IsTame(false),
m_IsBegging(false),

View File

@ -9,7 +9,7 @@
cPassiveAggressiveMonster::cPassiveAggressiveMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, const AString & a_SoundAmbient, double a_Width, double a_Height) :
cPassiveAggressiveMonster::cPassiveAggressiveMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, const AString & a_SoundAmbient, float a_Width, float a_Height) :
Super(a_ConfigName, a_MobType, a_SoundHurt, a_SoundDeath, a_SoundAmbient, a_Width, a_Height)
{
m_EMPersonality = PASSIVE;

View File

@ -20,8 +20,8 @@ public:
const AString & a_SoundHurt,
const AString & a_SoundDeath,
const AString & a_SoundAmbient,
double a_Width,
double a_Height
float a_Width,
float a_Height
);
virtual bool DoTakeDamage(TakeDamageInfo & a_TDI) override;

View File

@ -10,7 +10,7 @@
cPassiveMonster::cPassiveMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, const AString & a_SoundAmbient, double a_Width, double a_Height) :
cPassiveMonster::cPassiveMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, const AString & a_SoundAmbient, float a_Width, float a_Height) :
Super(a_ConfigName, a_MobType, a_SoundHurt, a_SoundDeath, a_SoundAmbient, a_Width, a_Height)
{
m_EMPersonality = PASSIVE;

View File

@ -21,8 +21,8 @@ public:
const AString & a_SoundHurt,
const AString & a_SoundDeath,
const AString & a_SoundAmbient,
double a_Width,
double a_Height
float a_Width,
float a_Height
);
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;

View File

@ -8,13 +8,12 @@
cPathFinder::cPathFinder(double a_MobWidth, double a_MobHeight) :
m_Path(),
cPathFinder::cPathFinder(float a_MobWidth, float a_MobHeight) :
m_Width(a_MobWidth),
m_Height(a_MobHeight),
m_GiveUpCounter(0),
m_NotFoundCooldown(0)
{
m_Width = a_MobWidth;
m_Height = a_MobHeight;
}

View File

@ -16,7 +16,7 @@ public:
@param a_MobWidth The mob width.
@param a_MobHeight The mob height.
*/
cPathFinder(double a_MobWidth, double a_MobHeight);
cPathFinder(float a_MobWidth, float a_MobHeight);
/** Updates the PathFinder's internal state and returns a waypoint.
A waypoint is a coordinate which the mob can safely move to from its current position in a straight line.
@ -41,10 +41,10 @@ public:
private:
/** The width of the Mob which owns this PathFinder. */
double m_Width;
float m_Width;
/** The height of the Mob which owns this PathFinder. */
double m_Height;
float m_Height;
/** The current cPath instance we have. This is discarded and recreated when a path recalculation is needed. */
std::unique_ptr<cPath> m_Path;

View File

@ -10,7 +10,7 @@
cPig::cPig(void) :
Super("Pig", mtPig, "entity.pig.hurt", "entity.pig.death", "entity.pig.ambient", 0.9, 0.9),
Super("Pig", mtPig, "entity.pig.hurt", "entity.pig.death", "entity.pig.ambient", 0.9f, 0.9f),
m_bIsSaddled(false)
{
}

View File

@ -21,7 +21,7 @@ cRabbit::cRabbit(void) :
cRabbit::cRabbit(eRabbitType Type, int MoreCarrotTicks) :
Super("Rabbit", mtRabbit, "entity.rabbit.hurt", "entity.rabbit.death", "entity.rabbit.ambient", 0.82, 0.68),
Super("Rabbit", mtRabbit, "entity.rabbit.hurt", "entity.rabbit.death", "entity.rabbit.ambient", 0.4f, 0.5f),
m_Type(Type),
m_MoreCarrotTicks(MoreCarrotTicks)
{

View File

@ -12,7 +12,7 @@
cSheep::cSheep(int a_Color) :
Super("Sheep", mtSheep, "entity.sheep.hurt", "entity.sheep.death", "entity.sheep.ambient", 0.6, 1.3),
Super("Sheep", mtSheep, "entity.sheep.hurt", "entity.sheep.death", "entity.sheep.ambient", 0.9f, 1.3f),
m_IsSheared(false),
m_WoolColor(a_Color),
m_TimeToStopEating(-1)

View File

@ -12,6 +12,15 @@
cSilverfish::cSilverfish() :
Super("Silverfish", mtSilverfish, "entity.silverfish.hurt", "entity.silverfish.death", "entity.silverfish.ambient", 0.4f, 0.3f)
{
}
bool cSilverfish::DoTakeDamage(TakeDamageInfo &a_TDI)
{
// Call on our brethren to attack!

View File

@ -14,10 +14,7 @@ class cSilverfish:
public:
cSilverfish():
Super("Silverfish", mtSilverfish, "entity.silverfish.hurt", "entity.silverfish.death", "entity.silverfish.ambient", 0.3, 0.4)
{
}
cSilverfish();
CLASS_PROTODEF(cSilverfish)

View File

@ -10,7 +10,7 @@
cSkeleton::cSkeleton(void) :
Super("Skeleton", mtSkeleton, "entity.skeleton.hurt", "entity.skeleton.death", "entity.skeleton.ambient", 0.6, 1.8)
Super("Skeleton", mtSkeleton, "entity.skeleton.hurt", "entity.skeleton.death", "entity.skeleton.ambient", 0.6f, 1.99f)
{
}

View File

@ -15,8 +15,8 @@ cSlime::cSlime(int a_Size) :
Printf("entity.%sslime.hurt", GetSizeName(a_Size).c_str()),
Printf("entity.%sslime.death", GetSizeName(a_Size).c_str()),
"",
0.6 * a_Size,
0.6 * a_Size
0.51f * a_Size,
0.51f * a_Size
),
m_Size(a_Size)
{

View File

@ -11,7 +11,7 @@
cSnowGolem::cSnowGolem(void) :
Super("SnowGolem", mtSnowGolem, "entity.snowman.hurt", "entity.snowman.death", "entity.snowman.ambient", 0.4, 1.8)
Super("SnowGolem", mtSnowGolem, "entity.snowman.hurt", "entity.snowman.death", "entity.snowman.ambient", 0.7f, 1.9f)
{
}

View File

@ -9,7 +9,7 @@
cSpider::cSpider(void) :
Super("Spider", mtSpider, "entity.spider.hurt", "entity.spider.death", "entity.spider.ambient", 1.4, 0.9)
Super("Spider", mtSpider, "entity.spider.hurt", "entity.spider.death", "entity.spider.ambient", 1.4f, 0.9f)
{
}

View File

@ -9,7 +9,7 @@
cSquid::cSquid(void) :
Super("Squid", mtSquid, "entity.squid.hurt", "entity.squid.death", "entity.squid.ambient", 0.95, 0.95)
Super("Squid", mtSquid, "entity.squid.hurt", "entity.squid.death", "entity.squid.ambient", 0.8f, 0.8f)
{
}

View File

@ -12,7 +12,7 @@
cVillager::cVillager(eVillagerType VillagerType) :
Super("Villager", mtVillager, "entity.villager.hurt", "entity.villager.death", "entity.villager.ambient", 0.6, 1.8),
Super("Villager", mtVillager, "entity.villager.hurt", "entity.villager.death", "entity.villager.ambient", 0.6f, 1.95f),
m_ActionCountDown(-1),
m_Type(VillagerType),
m_VillagerAction(false)

View File

@ -9,7 +9,7 @@
cWitch::cWitch(void) :
Super("Witch", mtWitch, "entity.witch.hurt", "entity.witch.death", "entity.witch.ambient", 0.6, 1.8)
Super("Witch", mtWitch, "entity.witch.hurt", "entity.witch.death", "entity.witch.ambient", 0.6f, 1.95f)
{
}

View File

@ -13,7 +13,7 @@
cWither::cWither(void) :
Super("Wither", mtWither, "entity.wither.hurt", "entity.wither.death", "entity.wither.ambient", 0.9, 4.0),
Super("Wither", mtWither, "entity.wither.hurt", "entity.wither.death", "entity.wither.ambient", 0.9f, 3.5f),
m_WitherInvulnerableTicks(220)
{
SetMaxHealth(300);

View File

@ -9,7 +9,7 @@
cWitherSkeleton::cWitherSkeleton(void) :
Super("WitherSkeleton", mtWitherSkeleton, "entity.wither_skeleton.hurt", "entity.wither_skeleton.death", "entity.wither_skeleton.ambient", 0.7, 2.4)
Super("WitherSkeleton", mtWitherSkeleton, "entity.wither_skeleton.hurt", "entity.wither_skeleton.death", "entity.wither_skeleton.ambient", 0.7f, 2.4f)
{
}

View File

@ -12,7 +12,7 @@
cWolf::cWolf(void) :
Super("Wolf", mtWolf, "entity.wolf.hurt", "entity.wolf.death", "entity.wolf.ambient", 0.6, 0.8),
Super("Wolf", mtWolf, "entity.wolf.hurt", "entity.wolf.death", "entity.wolf.ambient", 0.6f, 0.85f),
m_IsSitting(false),
m_IsTame(false),
m_IsBegging(false),

View File

@ -10,7 +10,7 @@
cZombie::cZombie() :
Super("Zombie", mtZombie, "entity.zombie.hurt", "entity.zombie.death", "entity.zombie.ambient", 0.6, 1.8)
Super("Zombie", mtZombie, "entity.zombie.hurt", "entity.zombie.death", "entity.zombie.ambient", 0.6f, 1.95f)
{
}

View File

@ -9,7 +9,7 @@
cZombiePigman::cZombiePigman(void) :
Super("ZombiePigman", mtZombiePigman, "entity.zombie_pig.hurt", "entity.zombie_pig.death", "entity.zombie_pig.ambient", 0.6, 1.8)
Super("ZombiePigman", mtZombiePigman, "entity.zombie_pig.hurt", "entity.zombie_pig.death", "entity.zombie_pig.ambient", 0.6f, 1.95f)
{
}

View File

@ -11,7 +11,7 @@
cZombieVillager::cZombieVillager(cVillager::eVillagerType a_Profession) :
Super("ZombieVillager", mtZombieVillager, "entity.zombie_villager.hurt", "entity.zombie_villager.death", "entity.ambient", 0.6, 1.8),
Super("ZombieVillager", mtZombieVillager, "entity.zombie_villager.hurt", "entity.zombie_villager.death", "entity.ambient", 0.6f, 1.95f),
m_ConversionTime(-1),
m_Profession(a_Profession)
{

View File

@ -446,7 +446,7 @@ void cEnderCrystal::KilledBy(struct TakeDamageInfo & a_TakeDamageInfo)
cEntity::cEntity(enum cEntity::eEntityType a_EntityType, class Vector3<double> a_Pos, double a_Height, double a_Width)
cEntity::cEntity(enum cEntity::eEntityType a_EntityType, class Vector3<double> a_Pos, float a_Height, float a_Width)
{
}
@ -790,7 +790,7 @@ void cEntity::ResetPosition(class Vector3<double> a_Pos)
cPawn::cPawn(enum cEntity::eEntityType,double a_Width, double a_Height) :
cPawn::cPawn(enum cEntity::eEntityType, float a_Width, float a_Height) :
cEntity(etMonster, Vector3d(), a_Height, a_Width)
{
}
@ -862,7 +862,7 @@ void cPawn::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
cMonster::cMonster(const AString & a_StringA, enum eMonsterType a_MonsterType, const AString & a_StringB, const AString & a_StringC, const AString & a_StringD, double a_Width, double a_Height) :
cMonster::cMonster(const AString & a_StringA, enum eMonsterType a_MonsterType, const AString & a_StringB, const AString & a_StringC, const AString & a_StringD, float a_Width, float a_Height) :
cPawn(etMonster, a_Width, a_Height),
m_PathFinder(a_Width, a_Height)
{
@ -870,7 +870,7 @@ cMonster::cMonster(const AString & a_StringA, enum eMonsterType a_MonsterType, c
cPathFinder::cPathFinder(double a_Width, double a_Height)
cPathFinder::cPathFinder(float a_Width, float a_Height)
{
}
@ -1002,7 +1002,7 @@ void cMonster::InStateEscaping(std::chrono::milliseconds a_Dt ,class cChunk & a_
cAggressiveMonster::cAggressiveMonster(const AString & a_StringA, enum eMonsterType a_MonsterType, const AString & a_StringB, const AString & a_StringC, const AString & a_StringD, double a_Width, double a_Height) :
cAggressiveMonster::cAggressiveMonster(const AString & a_StringA, enum eMonsterType a_MonsterType, const AString & a_StringB, const AString & a_StringC, const AString & a_StringD, float a_Width, float a_Height) :
cMonster(a_StringA, a_MonsterType, a_StringB, a_StringC, a_StringD, a_Width, a_Height)
{
}