Files
LCE-Revelations/Minecraft.Client/ServerPlayerGameMode.h
Revela 0ba923f085 Performance optimizations: sound caching, renderer culling, entity and lighting improvements
- Sound engine: cache filesystem probe results to avoid repeated file existence checks; add MA_SOUND_FLAG_DECODE for pre-decoded playback
- Level renderer: column-level frustum culling, compact visible chunk lists to skip empty iteration, lightweight second-pass render path, early-out for non-dirty chunks, scaled recheck period at high render distances
- Entity: cache shared_from_this() to reduce reference counting overhead in move() and checkInsideTiles()
- Level: skip checkLight() when tile light properties unchanged; enable entity locking on all platforms (not just Vita)
- LevelChunk: only rescan min height when the minimum column changes; defer lightGap processing
- LivingEntity: use raw pointer cast instead of dynamic_pointer_cast; cache friction tile lookup
- ServerPlayerGameMode: return whether block was destroyed to avoid redundant tile update packets
2026-03-18 17:22:04 -05:00

60 lines
1.6 KiB
C++

#pragma once
class ServerPlayer;
class Level;
class ItemInstance;
class ServerLevel;
class GameRulesInstance;
class GameType;
class ServerPlayerGameMode
{
public:
Level *level;
shared_ptr<ServerPlayer> player;
private:
GameType *gameModeForPlayer;
private:
bool isDestroyingBlock;
int destroyProgressStart;
int xDestroyBlock, yDestroyBlock, zDestroyBlock;
int gameTicks;
bool hasDelayedDestroy;
int delayedDestroyX, delayedDestroyY, delayedDestroyZ;
int delayedTickStart;
int lastSentState;
private:
// 4J Added
GameRulesInstance *m_gameRules;
public:
void setGameRules(GameRulesInstance *rules);
GameRulesInstance *getGameRules() { return m_gameRules; }
public:
ServerPlayerGameMode(Level *level);
~ServerPlayerGameMode();
void setGameModeForPlayer(GameType *gameModeForPlayer);
GameType *getGameModeForPlayer();
bool isSurvival();
bool isCreative();
void updateGameMode(GameType *gameType);
void tick();
void startDestroyBlock(int x, int y, int z, int face);
bool stopDestroyBlock(int x, int y, int z);
void abortDestroyBlock(int x, int y, int z);
private:
bool superDestroyBlock(int x, int y, int z);
public:
bool destroyBlock(int x, int y, int z);
bool useItem(shared_ptr<Player> player, Level *level, shared_ptr<ItemInstance> item, bool bTestUseOnly=false);
bool useItemOn(shared_ptr<Player> player, Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, int face, float clickX, float clickY, float clickZ, bool bTestUseOnOnly=false, bool *pbUsedItem=nullptr);
void setLevel(ServerLevel *newLevel);
};