aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/ServerLevel.h
diff options
context:
space:
mode:
authorLoki Rautio <lokirautio@gmail.com>2026-03-04 03:56:03 -0600
committerLoki Rautio <lokirautio@gmail.com>2026-03-04 03:56:03 -0600
commit42aec6dac53dffa6afe072560a7e1d4986112538 (patch)
tree0836426857391df1b6a83f6368a183f83ec9b104 /Minecraft.Client/ServerLevel.h
parentc9d58eeac7c72f0b3038e084667b4d89a6249fce (diff)
parentef9b6fd500dfabd9463267b0dd9e29577eea8a2b (diff)
Merge branch 'main' into pr/win64-world-saves
# Conflicts: # Minecraft.Client/MinecraftServer.cpp # README.md
Diffstat (limited to 'Minecraft.Client/ServerLevel.h')
-rw-r--r--Minecraft.Client/ServerLevel.h41
1 files changed, 27 insertions, 14 deletions
diff --git a/Minecraft.Client/ServerLevel.h b/Minecraft.Client/ServerLevel.h
index 644c15c0..45f3114d 100644
--- a/Minecraft.Client/ServerLevel.h
+++ b/Minecraft.Client/ServerLevel.h
@@ -11,7 +11,7 @@ using namespace std;
class ServerLevel : public Level
{
private:
- static const int EMPTY_TIME_NO_TICK = SharedConstants::TICKS_PER_SECOND * 3;
+ static const int EMPTY_TIME_NO_TICK = SharedConstants::TICKS_PER_SECOND * 60;
MinecraftServer *server;
EntityTracker *tracker;
@@ -29,10 +29,12 @@ protected:
public:
ServerChunkCache *cache;
- bool canEditSpawn;
- bool noSave;
+ bool canEditSpawn;
+ bool noSave;
private:
bool allPlayersSleeping;
+ PortalForcer *portalForcer;
+ MobSpawner *mobSpawner;
int emptyTime;
bool m_bAtLeastOnePlayerSleeping; // 4J Added
static WeighedTreasureArray RANDOM_BONUS_ITEMS; // 4J - brought forward from 1.3.2
@@ -59,21 +61,27 @@ public:
protected:
void tickTiles();
+private:
+ vector<TickNextTickData> toBeTicked;
+
public:
+ bool isTileToBeTickedAt(int x, int y, int z, int tileId);
void addToTickNextTick(int x, int y, int z, int tileId, int tickDelay);
- void forceAddTileTick(int x, int y, int z, int tileId, int tickDelay);
+ void addToTickNextTick(int x, int y, int z, int tileId, int tickDelay, int priorityTilt);
+ void forceAddTileTick(int x, int y, int z, int tileId, int tickDelay, int prioTilt);
void tickEntities();
+ void resetEmptyTime();
bool tickPendingTicks(bool force);
vector<TickNextTickData> *fetchTicksInChunk(LevelChunk *chunk, bool remove);
- virtual void tick(shared_ptr<Entity> e, bool actual);
- void forceTick(shared_ptr<Entity> e, bool actual);
+ virtual void tick(shared_ptr<Entity> e, bool actual);
+ void forceTick(shared_ptr<Entity> e, bool actual);
bool AllPlayersAreSleeping() { return allPlayersSleeping;} // 4J added for a message to other players
bool isAtLeastOnePlayerSleeping() { return m_bAtLeastOnePlayerSleeping;}
protected:
ChunkSource *createChunkSource(); // 4J - was virtual, but was called from parent ctor
public:
vector<shared_ptr<TileEntity> > *getTileEntitiesInRegion(int x0, int y0, int z0, int x1, int y1, int z1);
- virtual bool mayInteract(shared_ptr<Player> player, int xt, int yt, int zt, int id);
+ virtual bool mayInteract(shared_ptr<Player> player, int xt, int yt, int zt, int content);
protected:
virtual void initializeLevel(LevelSettings *settings);
virtual void setInitialSpawn(LevelSettings *settings);
@@ -94,20 +102,20 @@ private:
intEntityMap entitiesById; // 4J - was IntHashMap, using same hashing function as this uses
protected:
virtual void entityAdded(shared_ptr<Entity> e);
- virtual void entityRemoved(shared_ptr<Entity> e);
+ virtual void entityRemoved(shared_ptr<Entity> e);
public:
shared_ptr<Entity> getEntity(int id);
- virtual bool addGlobalEntity(shared_ptr<Entity> e);
- void broadcastEntityEvent(shared_ptr<Entity> e, byte event);
- virtual shared_ptr<Explosion> explode(shared_ptr<Entity> source, double x, double y, double z, float r, bool fire, bool destroyBlocks);
- virtual void tileEvent(int x, int y, int z, int tile, int b0, int b1);
+ virtual bool addGlobalEntity(shared_ptr<Entity> e);
+ void broadcastEntityEvent(shared_ptr<Entity> e, byte event);
+ virtual shared_ptr<Explosion> explode(shared_ptr<Entity> source, double x, double y, double z, float r, bool fire, bool destroyBlocks);
+ virtual void tileEvent(int x, int y, int z, int tile, int b0, int b1);
private:
void runTileEvents();
bool doTileEvent(TileEventData *te);
public:
- void closeLevelStorage();
+ void closeLevelStorage();
protected:
virtual void tickWeather();
@@ -116,6 +124,9 @@ public:
EntityTracker *getTracker();
void setTimeAndAdjustTileTicks(__int64 newTime);
PlayerChunkMap *getChunkMap();
+ PortalForcer *getPortalForcer();
+ void sendParticles(const wstring &name, double x, double y, double z, int count);
+ void sendParticles(const wstring &name, double x, double y, double z, int count, double xDist, double yDist, double zDist, double speed);
void queueSendTileUpdate(int x, int y, int z); // 4J Added
private:
@@ -142,7 +153,9 @@ public:
virtual bool addEntity(shared_ptr<Entity> e);
void entityAddedExtra(shared_ptr<Entity> e);
void entityRemovedExtra(shared_ptr<Entity> e);
-
+
+ bool atEntityLimit(shared_ptr<Entity> e); // 4J: Added
+
virtual bool newPrimedTntAllowed();
virtual bool newFallingTileAllowed();