mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/GabsPuNs-MinecraftConsoles.git
synced 2026-05-21 23:56:50 +00:00
TU25 additions to the code
This commit is contained in:
@@ -265,9 +265,9 @@ Icon *ArmorItem::getEmptyIcon(int slot)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
shared_ptr<ItemInstance> ArmorItem::use(shared_ptr<ItemInstance> item, Level *level, shared_ptr<Player> player)
|
||||
{
|
||||
//TODO Play Equip Sound
|
||||
if ((player->getArmor(Mob::getEquipmentSlotForItem(item) - 1)) == nullptr)
|
||||
{
|
||||
shared_ptr<ItemInstance> equip = item->copy();
|
||||
|
||||
@@ -41,9 +41,8 @@ float Bat::getVoicePitch()
|
||||
int Bat::getAmbientSound()
|
||||
{
|
||||
if (isResting() && random->nextInt(4) != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return eSoundType_MOB_BAT_IDLE; //"mob.bat.idle";
|
||||
}
|
||||
|
||||
@@ -89,13 +88,9 @@ void Bat::setResting(bool value)
|
||||
{
|
||||
char current = entityData->getByte(DATA_ID_FLAGS);
|
||||
if (value)
|
||||
{
|
||||
entityData->set(DATA_ID_FLAGS, static_cast<char>(current | FLAG_RESTING));
|
||||
}
|
||||
else
|
||||
{
|
||||
entityData->set(DATA_ID_FLAGS, static_cast<char>(current & ~FLAG_RESTING));
|
||||
}
|
||||
}
|
||||
|
||||
bool Bat::useNewAi()
|
||||
@@ -105,7 +100,6 @@ bool Bat::useNewAi()
|
||||
|
||||
void Bat::tick()
|
||||
{
|
||||
|
||||
AmbientCreature::tick();
|
||||
|
||||
if (isResting())
|
||||
@@ -114,10 +108,7 @@ void Bat::tick()
|
||||
y = Mth::floor(y) + 1.0 - bbHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
yd *= .6f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inline int signum(double x) { return (x > 0) - (x < 0); }
|
||||
@@ -135,11 +126,8 @@ void Bat::newServerAiStep()
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (random->nextInt(200) == 0)
|
||||
{
|
||||
yHeadRot = random->nextInt(360);
|
||||
}
|
||||
|
||||
if (level->getNearestPlayer(shared_from_this(), 4.0f) != nullptr)
|
||||
{
|
||||
@@ -176,10 +164,7 @@ void Bat::newServerAiStep()
|
||||
yRot += rotDiff;
|
||||
|
||||
if (random->nextInt(100) == 0 && level->isSolidBlockingTile(Mth::floor(x), static_cast<int>(y) + 1, Mth::floor(z)))
|
||||
{
|
||||
setResting(true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,9 +173,7 @@ bool Bat::makeStepSound()
|
||||
return false;
|
||||
}
|
||||
|
||||
void Bat::causeFallDamage(float distance)
|
||||
{
|
||||
}
|
||||
void Bat::causeFallDamage(float distance) {}
|
||||
|
||||
void Bat::checkFallDamage(double ya, bool onGround)
|
||||
{
|
||||
@@ -205,13 +188,13 @@ bool Bat::isIgnoringTileTriggers()
|
||||
|
||||
bool Bat::hurt(DamageSource *source, float dmg)
|
||||
{
|
||||
if (isInvulnerable()) return false;
|
||||
if (isInvulnerable())
|
||||
return false;
|
||||
|
||||
if (!level->isClientSide)
|
||||
{
|
||||
if (isResting())
|
||||
{
|
||||
setResting(false);
|
||||
}
|
||||
}
|
||||
|
||||
return AmbientCreature::hurt(source, dmg);
|
||||
@@ -231,11 +214,11 @@ void Bat::addAdditonalSaveData(CompoundTag *entityTag)
|
||||
entityTag->putByte(L"BatFlags", entityData->getByte(DATA_ID_FLAGS));
|
||||
}
|
||||
|
||||
|
||||
bool Bat::canSpawn()
|
||||
{
|
||||
int yt = Mth::floor(bb->y0);
|
||||
if (yt >= level->seaLevel) return false;
|
||||
if (yt >= level->seaLevel)
|
||||
return false;
|
||||
|
||||
int xt = Mth::floor(x);
|
||||
int zt = Mth::floor(z);
|
||||
@@ -244,15 +227,18 @@ bool Bat::canSpawn()
|
||||
int maxLight = 4;
|
||||
|
||||
if ((Calendar::GetDayOfMonth() + 1 == 10 && Calendar::GetDayOfMonth() >= 20) || (Calendar::GetMonth() + 1 == 11 && Calendar::GetMonth() <= 3))
|
||||
{
|
||||
maxLight = 7;
|
||||
}
|
||||
else if (random->nextBoolean())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (br > random->nextInt(maxLight)) return false;
|
||||
if (br > random->nextInt(maxLight))
|
||||
return false;
|
||||
|
||||
return AmbientCreature::canSpawn();
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
float Bat::getEyeHeight()
|
||||
{
|
||||
return bbHeight * 0.5f;
|
||||
}
|
||||
@@ -55,4 +55,6 @@ public:
|
||||
virtual void readAdditionalSaveData(CompoundTag *tag);
|
||||
virtual void addAdditonalSaveData(CompoundTag *entityTag);
|
||||
virtual bool canSpawn();
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
};
|
||||
@@ -60,4 +60,10 @@ MobGroupData *CaveSpider::finalizeMobSpawn(MobGroupData *groupData, int extraDat
|
||||
{
|
||||
// do nothing
|
||||
return groupData;
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
float CaveSpider::getEyeHeight()
|
||||
{
|
||||
return 0.45f;
|
||||
}
|
||||
@@ -17,4 +17,6 @@ protected:
|
||||
public:
|
||||
virtual bool doHurtTarget(shared_ptr<Entity> target);
|
||||
MobGroupData *finalizeMobSpawn(MobGroupData *groupData, int extraData = 0); // 4J Added extraData param
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
};
|
||||
@@ -155,3 +155,9 @@ bool Chicken::isFood(shared_ptr<ItemInstance> itemInstance)
|
||||
{
|
||||
return (itemInstance->id == Item::seeds_wheat_Id) || (itemInstance->id == Item::netherwart_seeds_Id) || (itemInstance->id == Item::seeds_melon_Id) || (itemInstance->id == Item::seeds_pumpkin_Id);
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
float Chicken::getEyeHeight()
|
||||
{
|
||||
return bbHeight;
|
||||
}
|
||||
@@ -43,5 +43,6 @@ protected:
|
||||
public:
|
||||
virtual shared_ptr<AgableMob> getBreedOffspring(shared_ptr<AgableMob> target);
|
||||
virtual bool isFood(shared_ptr<ItemInstance> itemInstance);
|
||||
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
};
|
||||
|
||||
@@ -136,3 +136,9 @@ shared_ptr<AgableMob> Cow::getBreedOffspring(shared_ptr<AgableMob> target)
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
float Cow::getEyeHeight()
|
||||
{
|
||||
return bbHeight;
|
||||
}
|
||||
|
||||
@@ -30,4 +30,6 @@ protected:
|
||||
public:
|
||||
virtual bool mobInteract(shared_ptr<Player> player);
|
||||
virtual shared_ptr<AgableMob> getBreedOffspring(shared_ptr<AgableMob> target);
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
};
|
||||
|
||||
@@ -90,9 +90,7 @@ shared_ptr<Entity> EnderMan::findAttackTarget()
|
||||
{
|
||||
#ifndef _FINAL_BUILD
|
||||
if(app.GetMobsDontAttackEnabled())
|
||||
{
|
||||
return shared_ptr<Player>();
|
||||
}
|
||||
#endif
|
||||
|
||||
shared_ptr<Player> player = level->getNearestAttackablePlayer(shared_from_this(), 64);
|
||||
@@ -101,7 +99,8 @@ shared_ptr<Entity> EnderMan::findAttackTarget()
|
||||
if (isLookingAtMe(player))
|
||||
{
|
||||
aggroedByPlayer = true;
|
||||
if (aggroTime == 0) level->playEntitySound(player, eSoundType_MOB_ENDERMAN_STARE, 1, 1);
|
||||
if (aggroTime == 0)
|
||||
level->playEntitySound(player, eSoundType_MOB_ENDERMAN_STARE, 1, 1);
|
||||
if (aggroTime++ == 5)
|
||||
{
|
||||
aggroTime = 0;
|
||||
@@ -110,9 +109,7 @@ shared_ptr<Entity> EnderMan::findAttackTarget()
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aggroTime = 0;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@@ -120,7 +117,8 @@ shared_ptr<Entity> EnderMan::findAttackTarget()
|
||||
bool EnderMan::isLookingAtMe(shared_ptr<Player> player)
|
||||
{
|
||||
shared_ptr<ItemInstance> helmet = player->inventory->armor[3];
|
||||
if (helmet != nullptr && helmet->id == Tile::pumpkin_Id) return false;
|
||||
if (helmet != nullptr && helmet->id == Tile::pumpkin_Id)
|
||||
return false;
|
||||
|
||||
Vec3 *look = player->getViewVector(1)->normalize();
|
||||
Vec3 *dir = Vec3::newTemp(x - player->x, (bb->y0 + bbHeight / 2) - (player->y + player->getHeadHeight()), z - player->z);
|
||||
@@ -128,9 +126,8 @@ bool EnderMan::isLookingAtMe(shared_ptr<Player> player)
|
||||
dir = dir->normalize();
|
||||
double dot = look->dot(dir);
|
||||
if (dot > 1 - 0.025 / dist)
|
||||
{
|
||||
return player->canSee(shared_from_this());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -144,9 +141,7 @@ void EnderMan::aiStep()
|
||||
speed->removeModifier(SPEED_MODIFIER_ATTACKING);
|
||||
|
||||
if (attackTarget != nullptr)
|
||||
{
|
||||
speed->addModifier(new AttributeModifier(*SPEED_MODIFIER_ATTACKING));
|
||||
}
|
||||
}
|
||||
|
||||
lastAttackTarget = attackTarget;
|
||||
@@ -190,7 +185,6 @@ void EnderMan::aiStep()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
level->addParticle(eParticleType_ender, x + (random->nextDouble() - 0.5) * bbWidth, y + random->nextDouble() * bbHeight - 0.25f, z + (random->nextDouble() - 0.5) * bbWidth,
|
||||
@@ -221,15 +215,11 @@ void EnderMan::aiStep()
|
||||
}
|
||||
|
||||
if (isCreepy() && !aggroedByPlayer && random->nextInt(100) == 0)
|
||||
{
|
||||
setCreepy(false);
|
||||
}
|
||||
|
||||
jumping = false;
|
||||
if (attackTarget != nullptr)
|
||||
{
|
||||
lookAt(attackTarget, 100, 100);
|
||||
}
|
||||
|
||||
if (!level->isClientSide && isAlive())
|
||||
{
|
||||
@@ -238,9 +228,8 @@ void EnderMan::aiStep()
|
||||
if ( attackTarget->instanceof(eTYPE_PLAYER) && isLookingAtMe(dynamic_pointer_cast<Player>(attackTarget)))
|
||||
{
|
||||
if (attackTarget->distanceToSqr(shared_from_this()) < 4 * 4)
|
||||
{
|
||||
teleport();
|
||||
}
|
||||
|
||||
teleportTime = 0;
|
||||
}
|
||||
else if (attackTarget->distanceToSqr(shared_from_this()) > 16 * 16)
|
||||
@@ -248,9 +237,7 @@ void EnderMan::aiStep()
|
||||
if (teleportTime++ >= 30)
|
||||
{
|
||||
if (teleportTowards(attackTarget))
|
||||
{
|
||||
teleportTime = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -309,21 +296,16 @@ bool EnderMan::teleport(double xx, double yy, double zz)
|
||||
yt--;
|
||||
}
|
||||
else
|
||||
{
|
||||
landed = true;
|
||||
}
|
||||
}
|
||||
if (landed)
|
||||
{
|
||||
setPos(x, y, z);
|
||||
if (level->getCubes(shared_from_this(), bb)->empty() && !level->containsAnyLiquid(bb))
|
||||
{
|
||||
ok = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ok)
|
||||
{
|
||||
int count = 128;
|
||||
@@ -411,22 +393,17 @@ bool EnderMan::hurt(DamageSource *source, float damage)
|
||||
if ( dynamic_cast<EntityDamageSource *>(source) != nullptr && source->getEntity()->instanceof(eTYPE_PLAYER))
|
||||
{
|
||||
if (!dynamic_pointer_cast<Player>(source->getEntity())->abilities.invulnerable)
|
||||
{
|
||||
aggroedByPlayer = true;
|
||||
}
|
||||
else setCreepy(false);
|
||||
}
|
||||
|
||||
|
||||
if (dynamic_cast<IndirectEntityDamageSource *>(source) != nullptr)
|
||||
{
|
||||
aggroedByPlayer = false;
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
if (teleport())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -441,4 +418,10 @@ bool EnderMan::isCreepy()
|
||||
void EnderMan::setCreepy(bool creepy)
|
||||
{
|
||||
entityData->set(DATA_CREEPY, static_cast<byte>(creepy ? 1 : 0));
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
float EnderMan::getEyeHeight()
|
||||
{
|
||||
return 2.55f;
|
||||
}
|
||||
@@ -63,4 +63,6 @@ public:
|
||||
virtual bool hurt(DamageSource *source, float damage);
|
||||
bool isCreepy();
|
||||
void setCreepy(bool creepy);
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
};
|
||||
@@ -2116,6 +2116,28 @@ wstring Entity::getNetworkName()
|
||||
return getDisplayName();
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
bool Entity::hasCustomName()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool Entity::shouldShowName()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
AABB *Entity::getBoundingBox()
|
||||
{
|
||||
return this->bb;
|
||||
}
|
||||
void Entity::setBoundingBox(AABB *bb)
|
||||
{
|
||||
this->bb = bb;
|
||||
}
|
||||
float Entity::getEyeHeight()
|
||||
{
|
||||
return this->bbHeight * 0.85F;
|
||||
}
|
||||
|
||||
void Entity::setAnimOverrideBitmask(unsigned int uiBitmask)
|
||||
{
|
||||
m_uiAnimOverrideBitmask=uiBitmask;
|
||||
|
||||
@@ -419,6 +419,12 @@ public:
|
||||
virtual bool isPushedByWater();
|
||||
virtual wstring getDisplayName();
|
||||
virtual wstring getNetworkName(); // 4J: Added
|
||||
//TU25 Addition
|
||||
virtual bool hasCustomName();
|
||||
virtual bool shouldShowName();
|
||||
virtual AABB *getBoundingBox();
|
||||
virtual void setBoundingBox(AABB *bb);
|
||||
virtual float getEyeHeight();
|
||||
|
||||
private:
|
||||
unsigned int m_uiAnimOverrideBitmask;
|
||||
|
||||
@@ -1841,4 +1841,10 @@ bool EntityHorse::onLadder()
|
||||
shared_ptr<Player> EntityHorse::getOwner()
|
||||
{
|
||||
return level->getPlayerByUUID(getOwnerName());
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
float EntityHorse::getEyeHeight()
|
||||
{
|
||||
return bbHeight;
|
||||
}
|
||||
@@ -342,4 +342,6 @@ public:
|
||||
|
||||
static bool isHorseArmor(int itemId);
|
||||
virtual bool onLadder();
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
};
|
||||
@@ -15,8 +15,6 @@
|
||||
#include "LevelEvent.h"
|
||||
#include "SoundTypes.h"
|
||||
|
||||
|
||||
|
||||
void Ghast::_init()
|
||||
{
|
||||
explosionPower = 1;
|
||||
@@ -121,14 +119,13 @@ void Ghast::serverAiStep()
|
||||
}
|
||||
}
|
||||
|
||||
if (target != nullptr && target->removed) target = nullptr;
|
||||
if (target != nullptr && target->removed)
|
||||
target = nullptr;
|
||||
if (target == nullptr || retargetTime-- <= 0)
|
||||
{
|
||||
target = level->getNearestAttackablePlayer(shared_from_this(), 100);
|
||||
if (target != nullptr)
|
||||
{
|
||||
retargetTime = 20;
|
||||
}
|
||||
}
|
||||
|
||||
double maxDist = 64.0f;
|
||||
@@ -162,10 +159,8 @@ void Ghast::serverAiStep()
|
||||
charge = -40;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (charge > 0) charge--;
|
||||
}
|
||||
else if (charge > 0)
|
||||
charge--;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -178,9 +173,7 @@ void Ghast::serverAiStep()
|
||||
byte old = entityData->getByte(DATA_IS_CHARGING);
|
||||
byte current = static_cast<byte>(charge > 10 ? 1 : 0);
|
||||
if (old != current)
|
||||
{
|
||||
entityData->set(DATA_IS_CHARGING, current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,14 +217,11 @@ void Ghast::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel)
|
||||
{
|
||||
int count = random->nextInt(2) + random->nextInt(1 + playerBonusLevel);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
spawnAtLocation(Item::ghastTear_Id, 1);
|
||||
}
|
||||
|
||||
count = random->nextInt(3) + random->nextInt(1 + playerBonusLevel);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
spawnAtLocation(Item::gunpowder_Id, 1);
|
||||
}
|
||||
}
|
||||
|
||||
float Ghast::getSoundVolume()
|
||||
@@ -248,6 +238,7 @@ int Ghast::getMaxSpawnClusterSize()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Ghast::addAdditonalSaveData(CompoundTag *tag)
|
||||
{
|
||||
FlyingMob::addAdditonalSaveData(tag);
|
||||
@@ -258,4 +249,10 @@ void Ghast::readAdditionalSaveData(CompoundTag *tag)
|
||||
{
|
||||
FlyingMob::readAdditionalSaveData(tag);
|
||||
if (tag->contains(L"ExplosionPower")) explosionPower = tag->getInt(L"ExplosionPower");
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
float Ghast::getEyeHeight()
|
||||
{
|
||||
return 2.6f;
|
||||
}
|
||||
@@ -63,4 +63,6 @@ public:
|
||||
virtual int getMaxSpawnClusterSize();
|
||||
virtual void addAdditonalSaveData(CompoundTag *tag);
|
||||
virtual void readAdditionalSaveData(CompoundTag *tag);
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
};
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
#include "Giant.h"
|
||||
#include "..\Minecraft.Client\Textures.h"
|
||||
|
||||
|
||||
|
||||
Giant::Giant(Level *level) : Monster( level )
|
||||
{
|
||||
// 4J Stu - This function call had to be moved here from the Entity ctor to ensure that
|
||||
@@ -30,4 +28,10 @@ void Giant::registerAttributes()
|
||||
float Giant::getWalkTargetValue(int x, int y, int z)
|
||||
{
|
||||
return level->getBrightness(x, y, z)-0.5f;
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
float Giant::getEyeHeight()
|
||||
{
|
||||
return 1.62f * 6.0f;
|
||||
}
|
||||
@@ -18,4 +18,6 @@ protected:
|
||||
|
||||
public:
|
||||
virtual float getWalkTargetValue(int x, int y, int z);
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
};
|
||||
|
||||
@@ -154,4 +154,10 @@ shared_ptr<LeashFenceKnotEntity> LeashFenceKnotEntity::findKnotAt(Level *level,
|
||||
delete knots;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
float LeashFenceKnotEntity::getEyeHeight()
|
||||
{
|
||||
return -0.0625f;
|
||||
}
|
||||
@@ -33,4 +33,6 @@ public:
|
||||
virtual bool survives();
|
||||
static shared_ptr<LeashFenceKnotEntity> createAndAddKnot(Level *level, int x, int y, int z);
|
||||
static shared_ptr<LeashFenceKnotEntity> findKnotAt(Level *level, int x, int y, int z);
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -390,6 +390,8 @@ public:
|
||||
virtual Team *getTeam();
|
||||
virtual void setAbsorptionAmount(float absorptionAmount);
|
||||
virtual float getAbsorptionAmount();
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
|
||||
//////// 4J /////////////////
|
||||
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
#include "net.minecraft.world.level.h"
|
||||
#include "PrimedTnt.h"
|
||||
|
||||
|
||||
|
||||
void PrimedTnt::_init()
|
||||
{
|
||||
life = 0;
|
||||
@@ -47,9 +45,7 @@ PrimedTnt::PrimedTnt(Level *level, double x, double y, double z, shared_ptr<Livi
|
||||
this->owner = weak_ptr<LivingEntity>(owner);
|
||||
}
|
||||
|
||||
void PrimedTnt::defineSynchedData()
|
||||
{
|
||||
}
|
||||
void PrimedTnt::defineSynchedData() {}
|
||||
|
||||
bool PrimedTnt::makeStepSound()
|
||||
{
|
||||
@@ -84,25 +80,18 @@ void PrimedTnt::tick()
|
||||
{
|
||||
remove();
|
||||
if (!level->isClientSide)
|
||||
{
|
||||
explode();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
level->addParticle(eParticleType_smoke, x, y + 0.5f, z, 0, 0, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void PrimedTnt::explode()
|
||||
{
|
||||
float r = 4.0f;
|
||||
level->explode(shared_from_this(), x, y, z, r, true);
|
||||
}
|
||||
|
||||
|
||||
void PrimedTnt::addAdditonalSaveData(CompoundTag *entityTag)
|
||||
{
|
||||
entityTag->putByte(L"Fuse", static_cast<byte>(life));
|
||||
@@ -121,4 +110,10 @@ float PrimedTnt::getShadowHeightOffs()
|
||||
shared_ptr<LivingEntity> PrimedTnt::getOwner()
|
||||
{
|
||||
return owner.lock();
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
float PrimedTnt::getEyeHeight()
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
@@ -36,4 +36,6 @@ protected:
|
||||
public:
|
||||
virtual float getShadowHeightOffs();
|
||||
virtual shared_ptr<LivingEntity> getOwner();
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
};
|
||||
|
||||
@@ -313,6 +313,12 @@ MobGroupData *Sheep::finalizeMobSpawn(MobGroupData *groupData, int extraData /*=
|
||||
return groupData;
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
float Sheep::getEyeHeight()
|
||||
{
|
||||
return 0.95f * bbHeight;
|
||||
}
|
||||
|
||||
int Sheep::getOffspringColor(shared_ptr<Animal> animal, shared_ptr<Animal> partner)
|
||||
{
|
||||
int parent1DyeColor = getDyeColor(animal);
|
||||
@@ -339,3 +345,4 @@ int Sheep::getDyeColor(shared_ptr<Animal> animal)
|
||||
{
|
||||
return 15 - dynamic_pointer_cast<Sheep>(animal)->getColor();
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,9 @@ public:
|
||||
|
||||
MobGroupData *finalizeMobSpawn(MobGroupData *groupData, int extraData = 0); // 4J Added extraData param
|
||||
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
|
||||
private:
|
||||
int getOffspringColor(shared_ptr<Animal> animal, shared_ptr<Animal> partner);
|
||||
int getDyeColor(shared_ptr<Animal> animal);
|
||||
|
||||
@@ -224,4 +224,10 @@ bool Silverfish::canSpawn()
|
||||
MobType Silverfish::getMobType()
|
||||
{
|
||||
return ARTHROPOD;
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
float Silverfish::getEyeHeight()
|
||||
{
|
||||
return 0.1f;
|
||||
}
|
||||
@@ -45,4 +45,6 @@ protected:
|
||||
public:
|
||||
virtual bool canSpawn();
|
||||
virtual MobType getMobType();
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
};
|
||||
@@ -356,4 +356,13 @@ void Skeleton::setEquippedSlot(int slot, shared_ptr<ItemInstance> item)
|
||||
double Skeleton::getRidingHeight()
|
||||
{
|
||||
return Monster::getRidingHeight() - .5;
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
float Skeleton::getEyeHeight()
|
||||
{
|
||||
if (getSkeletonType() == TYPE_WITHER)
|
||||
return Entity::getEyeHeight();
|
||||
else
|
||||
return 1.62f;
|
||||
}
|
||||
@@ -66,4 +66,6 @@ public:
|
||||
virtual void addAdditonalSaveData(CompoundTag *entityTag);
|
||||
virtual void setEquippedSlot(int slot, shared_ptr<ItemInstance> item);
|
||||
virtual double getRidingHeight();
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
};
|
||||
|
||||
@@ -290,6 +290,12 @@ int Slime::getMaxHeadXRot()
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
float Slime::getEyeHeight()
|
||||
{
|
||||
return 0.625f * bbHeight;
|
||||
}
|
||||
|
||||
bool Slime::doPlayJumpSound()
|
||||
{
|
||||
return getSize() > 0;
|
||||
|
||||
@@ -70,6 +70,8 @@ protected:
|
||||
|
||||
public:
|
||||
virtual int getMaxHeadXRot();
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
|
||||
protected:
|
||||
virtual bool doPlayJumpSound();
|
||||
|
||||
@@ -105,6 +105,7 @@ void SnowMan::performRangedAttack(shared_ptr<LivingEntity> target, float power)
|
||||
level->addEntity(snowball);
|
||||
}
|
||||
|
||||
// TU23 Fix: MCCE-622 – Snow Golem impervious to melee damage
|
||||
bool SnowMan::hurt(DamageSource *source, float dmg)
|
||||
{
|
||||
// 4J: Protect owned golem from untrusted players
|
||||
@@ -118,4 +119,10 @@ bool SnowMan::hurt(DamageSource *source, float dmg)
|
||||
}
|
||||
|
||||
return Golem::hurt(source, dmg);
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
float SnowMan::getEyeHeight()
|
||||
{
|
||||
return 1.7f;
|
||||
}
|
||||
@@ -26,4 +26,6 @@ protected:
|
||||
public:
|
||||
virtual void performRangedAttack(shared_ptr<LivingEntity> target, float power);
|
||||
virtual bool hurt(DamageSource *source, float dmg);
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
};
|
||||
@@ -223,6 +223,12 @@ MobGroupData *Spider::finalizeMobSpawn(MobGroupData *groupData, int extraData /*
|
||||
return groupData;
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
float Spider::getEyeHeight()
|
||||
{
|
||||
return 0.65f;
|
||||
}
|
||||
|
||||
const float Spider::SPIDER_SPECIAL_EFFECT_CHANCE = .1f;
|
||||
|
||||
Spider::SpiderEffectsGroupData::SpiderEffectsGroupData()
|
||||
|
||||
@@ -42,6 +42,8 @@ public:
|
||||
virtual bool isClimbing();
|
||||
virtual void setClimbing(bool value);
|
||||
virtual MobGroupData *finalizeMobSpawn(MobGroupData *groupData, int extraData = 0); // 4J Added extraData param
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
|
||||
private:
|
||||
static const float SPIDER_SPECIAL_EFFECT_CHANCE;
|
||||
|
||||
@@ -191,3 +191,9 @@ bool Squid::canSpawn()
|
||||
{
|
||||
return y > 45 && y < level->seaLevel && WaterAnimal::canSpawn();
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
float Squid::getEyeHeight()
|
||||
{
|
||||
return bbHeight * 0.5f;
|
||||
}
|
||||
@@ -50,4 +50,6 @@ protected:
|
||||
|
||||
public:
|
||||
virtual bool canSpawn();
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
};
|
||||
|
||||
@@ -776,3 +776,15 @@ wstring Villager::getDisplayName()
|
||||
};
|
||||
return app.GetString(name);
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
float Villager::getEyeHeight()
|
||||
{
|
||||
//TODO: Use LCE instead of JAVA
|
||||
float f = 1.62F;
|
||||
|
||||
if (isBaby())
|
||||
f -= 0.81;
|
||||
|
||||
return f;
|
||||
}
|
||||
@@ -147,4 +147,6 @@ public:
|
||||
virtual shared_ptr<AgableMob> getBreedOffspring(shared_ptr<AgableMob> target);
|
||||
virtual bool canBeLeashed();
|
||||
virtual wstring getDisplayName();
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
};
|
||||
@@ -221,4 +221,10 @@ void Witch::performRangedAttack(shared_ptr<LivingEntity> target, float power)
|
||||
potion->shoot(xd, yd + dist * 0.2f, zd, 0.75f, 8);
|
||||
|
||||
level->addEntity(potion);
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
float Witch::getEyeHeight()
|
||||
{
|
||||
return 1.62f;
|
||||
}
|
||||
@@ -45,4 +45,6 @@ protected:
|
||||
|
||||
public:
|
||||
virtual void performRangedAttack(shared_ptr<LivingEntity> target, float power);
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
};
|
||||
@@ -596,4 +596,10 @@ bool Wolf::wantsToAttack(shared_ptr<LivingEntity> target, shared_ptr<LivingEntit
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
float Wolf::getEyeHeight()
|
||||
{
|
||||
return bbHeight * 0.8f;
|
||||
}
|
||||
@@ -89,4 +89,6 @@ protected:
|
||||
|
||||
public:
|
||||
virtual bool wantsToAttack(shared_ptr<LivingEntity> target, shared_ptr<LivingEntity> owner);
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
};
|
||||
|
||||
@@ -238,6 +238,18 @@ void Zombie::updateSize(bool isBaby)
|
||||
setSize(0.6f, 1.8f * scale);
|
||||
}
|
||||
|
||||
// TU25 Addition
|
||||
float Zombie::getEyeHeight()
|
||||
{
|
||||
//TODO: Use LCE one instead of JAVA
|
||||
float f = 1.74F;
|
||||
|
||||
if (isBaby())
|
||||
f -= 0.81;
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
int Zombie::getAmbientSound()
|
||||
{
|
||||
return eSoundType_MOB_ZOMBIE_AMBIENT;
|
||||
@@ -502,4 +514,4 @@ Zombie::ZombieGroupData::ZombieGroupData(bool baby, bool villager)
|
||||
{
|
||||
isBaby = baby;
|
||||
isVillager = villager;
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,8 @@ public:
|
||||
virtual void tick();
|
||||
virtual bool doHurtTarget(shared_ptr<Entity> target);
|
||||
virtual void updateSize(bool isBaby);
|
||||
// TU25 Addition
|
||||
virtual float getEyeHeight();
|
||||
|
||||
protected:
|
||||
virtual int getAmbientSound();
|
||||
|
||||
Reference in New Issue
Block a user