chore: format Minecraft.World

This commit is contained in:
Tropical
2026-03-13 17:06:56 -05:00
parent bd6284025d
commit 33d0737d1d
1511 changed files with 108661 additions and 115521 deletions

View File

@@ -16,80 +16,58 @@
#include "../../../Minecraft.Client/Textures/Textures.h"
#include "../../Util/SoundTypes.h"
Skeleton::Skeleton(Level* level) : Monster(level) {
// 4J Stu - This function call had to be moved here from the Entity ctor to
// ensure that the derived version of the function is called
this->defineSynchedData();
// 4J Stu - This function call had to be moved here from the Entity ctor to
// ensure that the derived version of the function is called
health = getMaxHealth();
Skeleton::Skeleton(Level *level) : Monster( level )
{
// 4J Stu - This function call had to be moved here from the Entity ctor to ensure that
// the derived version of the function is called
this->defineSynchedData();
this->textureIdx = TN_MOB_SKELETON; // 4J was L"/mob/skeleton.png";
// 4J Stu - This function call had to be moved here from the Entity ctor to ensure that the derived version of the function is called
health = getMaxHealth();
runSpeed = 0.25f;
this->textureIdx = TN_MOB_SKELETON; // 4J was L"/mob/skeleton.png";
goalSelector.addGoal(1, new FloatGoal(this));
goalSelector.addGoal(2, new RestrictSunGoal(this));
goalSelector.addGoal(3, new FleeSunGoal(this, runSpeed));
goalSelector.addGoal(
4, new ArrowAttackGoal(this, runSpeed, ArrowAttackGoal::ArrowType,
SharedConstants::TICKS_PER_SECOND * 3));
goalSelector.addGoal(5, new RandomStrollGoal(this, runSpeed));
goalSelector.addGoal(6, new LookAtPlayerGoal(this, typeid(Player), 8));
goalSelector.addGoal(6, new RandomLookAroundGoal(this));
runSpeed = 0.25f;
goalSelector.addGoal(1, new FloatGoal(this));
goalSelector.addGoal(2, new RestrictSunGoal(this));
goalSelector.addGoal(3, new FleeSunGoal(this, runSpeed));
goalSelector.addGoal(4, new ArrowAttackGoal(this, runSpeed, ArrowAttackGoal::ArrowType, SharedConstants::TICKS_PER_SECOND * 3));
goalSelector.addGoal(5, new RandomStrollGoal(this, runSpeed));
goalSelector.addGoal(6, new LookAtPlayerGoal(this, typeid(Player), 8));
goalSelector.addGoal(6, new RandomLookAroundGoal(this));
targetSelector.addGoal(1, new HurtByTargetGoal(this, false));
targetSelector.addGoal(2, new NearestAttackableTargetGoal(this, typeid(Player), 16, 0, true));
targetSelector.addGoal(1, new HurtByTargetGoal(this, false));
targetSelector.addGoal(
2, new NearestAttackableTargetGoal(this, typeid(Player), 16, 0, true));
}
bool Skeleton::useNewAi()
{
return true;
}
bool Skeleton::useNewAi() { return true; }
int Skeleton::getMaxHealth()
{
return 20;
}
int Skeleton::getMaxHealth() { return 20; }
int Skeleton::getAmbientSound()
{
return eSoundType_MOB_SKELETON_AMBIENT;
}
int Skeleton::getAmbientSound() { return eSoundType_MOB_SKELETON_AMBIENT; }
int Skeleton::getHurtSound()
{
return eSoundType_MOB_SKELETON_HURT;
}
int Skeleton::getHurtSound() { return eSoundType_MOB_SKELETON_HURT; }
int Skeleton::getDeathSound()
{
return eSoundType_MOB_SKELETON_HURT;
}
int Skeleton::getDeathSound() { return eSoundType_MOB_SKELETON_HURT; }
std::shared_ptr<ItemInstance> Skeleton::bow;
std::shared_ptr<ItemInstance> Skeleton::getCarriedItem()
{
return bow;
}
std::shared_ptr<ItemInstance> Skeleton::getCarriedItem() { return bow; }
MobType Skeleton::getMobType()
{
return UNDEAD;
}
MobType Skeleton::getMobType() { return UNDEAD; }
void Skeleton::aiStep()
{
// isClientSide check brought forward from 1.8 (I assume it's related to the lighting changes)
if (level->isDay() && !level->isClientSide)
{
void Skeleton::aiStep() {
// isClientSide check brought forward from 1.8 (I assume it's related to
// the lighting changes)
if (level->isDay() && !level->isClientSide) {
float br = getBrightness(1);
if (br > 0.5f)
{
if (level->canSeeSky( Mth::floor(x), Mth::floor(y), Mth::floor(z)) && random->nextFloat() * 30 < (br - 0.4f) * 2)
{
if (br > 0.5f) {
if (level->canSeeSky(Mth::floor(x), Mth::floor(y), Mth::floor(z)) &&
random->nextFloat() * 30 < (br - 0.4f) * 2) {
setOnFire(8);
}
}
@@ -98,57 +76,48 @@ void Skeleton::aiStep()
Monster::aiStep();
}
void Skeleton::die(DamageSource *source)
{
Monster::die(source);
std::shared_ptr<Player> player = std::dynamic_pointer_cast<Player>( source->getEntity() );
if ( std::dynamic_pointer_cast<Arrow>( source->getDirectEntity() ) != NULL && player != NULL)
{
double xd = player->x - x;
double zd = player->z - z;
if (xd * xd + zd * zd >= 50 * 50)
{
player->awardStat(GenericStats::snipeSkeleton(), GenericStats::param_snipeSkeleton());
}
}
void Skeleton::die(DamageSource* source) {
Monster::die(source);
std::shared_ptr<Player> player =
std::dynamic_pointer_cast<Player>(source->getEntity());
if (std::dynamic_pointer_cast<Arrow>(source->getDirectEntity()) != NULL &&
player != NULL) {
double xd = player->x - x;
double zd = player->z - z;
if (xd * xd + zd * zd >= 50 * 50) {
player->awardStat(GenericStats::snipeSkeleton(),
GenericStats::param_snipeSkeleton());
}
}
}
int Skeleton::getDeathLoot()
{
return Item::arrow->id;
}
int Skeleton::getDeathLoot() { return Item::arrow->id; }
void Skeleton::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel)
{
void Skeleton::dropDeathLoot(bool wasKilledByPlayer, int playerBonusLevel) {
// drop some arrows
int count = random->nextInt(3 + playerBonusLevel);
for (int i = 0; i < count; i++)
{
for (int i = 0; i < count; i++) {
spawnAtLocation(Item::arrow->id, 1);
}
// and some bones
count = random->nextInt(3 + playerBonusLevel);
for (int i = 0; i < count; i++)
{
for (int i = 0; i < count; i++) {
spawnAtLocation(Item::bone->id, 1);
}
}
void Skeleton::dropRareDeathLoot(int rareLootLevel)
{
if (rareLootLevel > 0)
{
std::shared_ptr<ItemInstance> bow = std::shared_ptr<ItemInstance>( new ItemInstance(Item::bow) );
EnchantmentHelper::enchantItem(random, bow, 5);
spawnAtLocation(bow, 0);
}
else
{
spawnAtLocation(Item::bow_Id, 1);
}
void Skeleton::dropRareDeathLoot(int rareLootLevel) {
if (rareLootLevel > 0) {
std::shared_ptr<ItemInstance> bow =
std::shared_ptr<ItemInstance>(new ItemInstance(Item::bow));
EnchantmentHelper::enchantItem(random, bow, 5);
spawnAtLocation(bow, 0);
} else {
spawnAtLocation(Item::bow_Id, 1);
}
}
void Skeleton::staticCtor()
{
Skeleton::bow = std::shared_ptr<ItemInstance>( new ItemInstance(Item::bow, 1) );
void Skeleton::staticCtor() {
Skeleton::bow =
std::shared_ptr<ItemInstance>(new ItemInstance(Item::bow, 1));
}