the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 60 lines 1.6 kB view raw
1#pragma once 2class ServerPlayer; 3class Level; 4class ItemInstance; 5class ServerLevel; 6class GameRulesInstance; 7class GameType; 8 9class ServerPlayerGameMode 10{ 11public: 12 Level *level; 13 shared_ptr<ServerPlayer> player; 14 15private: 16 GameType *gameModeForPlayer; 17 18private: 19 bool isDestroyingBlock; 20 int destroyProgressStart; 21 int xDestroyBlock, yDestroyBlock, zDestroyBlock; 22 int gameTicks; 23 24 bool hasDelayedDestroy; 25 int delayedDestroyX, delayedDestroyY, delayedDestroyZ; 26 int delayedTickStart; 27 int lastSentState; 28 29private: 30 // 4J Added 31 GameRulesInstance *m_gameRules; 32public: 33 void setGameRules(GameRulesInstance *rules); 34 GameRulesInstance *getGameRules() { return m_gameRules; } 35 36public: 37 ServerPlayerGameMode(Level *level); 38 ~ServerPlayerGameMode(); 39 40 void setGameModeForPlayer(GameType *gameModeForPlayer); 41 GameType *getGameModeForPlayer(); 42 bool isSurvival(); 43 bool isCreative(); 44 void updateGameMode(GameType *gameType); 45 46 void tick(); 47 void startDestroyBlock(int x, int y, int z, int face); 48 void stopDestroyBlock(int x, int y, int z); 49 void abortDestroyBlock(int x, int y, int z); 50 51private: 52 bool superDestroyBlock(int x, int y, int z); 53 54public: 55 bool destroyBlock(int x, int y, int z); 56 bool useItem(shared_ptr<Player> player, Level *level, shared_ptr<ItemInstance> item, bool bTestUseOnly=false); 57 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=NULL); 58 59 void setLevel(ServerLevel *newLevel); 60};