Files
MinecraftConsoles/Minecraft.World/Village.h
void_17 7074f35e4b shared_ptr -> std::shared_ptr
This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today.
2026-03-02 15:58:20 +07:00

81 lines
2.0 KiB
C++

#pragma once
class Village
{
private:
Level *level;
vector<std::shared_ptr<DoorInfo> > doorInfos;
Pos *accCenter;
Pos *center;
int radius;
int stableSince;
int _tick;
int populationSize;
int noBreedTimer;
unordered_map<wstring, int> playerStanding;
class Aggressor
{
public:
std::shared_ptr<Mob> mob;
int timeStamp;
Aggressor(std::shared_ptr<Mob> mob, int timeStamp);
};
vector<Aggressor *> aggressors;
int golemCount;
public:
Village();
Village(Level *level);
~Village();
void setLevel(Level *level);
void tick(int tick);
private:
Vec3 *findRandomSpawnPos(int x, int y, int z, int sx, int sy, int sz);
bool canSpawnAt(int x, int y, int z, int sx, int sy, int sz);
void countGolem();
void countPopulation();
public:
Pos *getCenter();
int getRadius();
int getDoorCount();
int getStableAge();
int getPopulationSize();
bool isInside(int xx, int yy, int zz);
vector<std::shared_ptr<DoorInfo> > *getDoorInfos();
std::shared_ptr<DoorInfo> getClosestDoorInfo(int x, int y, int z);
std::shared_ptr<DoorInfo> getBestDoorInfo(int x, int y, int z);
bool hasDoorInfo(int x, int y, int z);
std::shared_ptr<DoorInfo> getDoorInfo(int x, int y, int z);
void addDoorInfo(std::shared_ptr<DoorInfo> di);
bool canRemove();
void addAggressor(std::shared_ptr<Mob> mob);
std::shared_ptr<Mob> getClosestAggressor(std::shared_ptr<Mob> from);
std::shared_ptr<Player> getClosestBadStandingPlayer(std::shared_ptr<Mob> from); // 4J Stu - Should be LivingEntity when we add that
private:
void updateAggressors();
void updateDoors();
bool isDoor(int x, int y, int z);
void calcInfo();
public:
int getStanding(const wstring &playerName);
int modifyStanding(const wstring &playerName, int delta);
bool isGoodStanding(const wstring &playerName);
bool isBadStanding(const wstring &playerName);
bool isVeryBadStanding(const wstring playerName);
void readAdditionalSaveData(CompoundTag *tag);
void addAdditonalSaveData(CompoundTag *tag);
void resetNoBreedTimer();
bool isBreedTimerOk();
void rewardAllPlayers(int amount);
};