the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 69 lines 2.9 kB view raw
1#pragma once 2#include "GameMode.h" 3class ClientConnection; 4class GameType; 5class Vec3; 6 7class MultiPlayerGameMode 8{ 9private: 10 int xDestroyBlock; 11 int yDestroyBlock; 12 int zDestroyBlock; 13 shared_ptr<ItemInstance> destroyingItem; 14 float destroyProgress; 15 int destroyTicks; // 4J was float but doesn't seem to need to be 16 int destroyDelay; 17 bool isDestroying; 18 GameType *localPlayerMode; 19 ClientConnection *connection; 20 21protected: 22 Minecraft *minecraft; 23 24public: 25 MultiPlayerGameMode(Minecraft *minecraft, ClientConnection *connection); 26 static void creativeDestroyBlock(Minecraft *minecraft, MultiPlayerGameMode *gameMode, int x, int y, int z, int face); 27 void adjustPlayer(shared_ptr<Player> player); 28 bool isCutScene(); 29 void setLocalMode(GameType *mode); 30 virtual void initPlayer(shared_ptr<Player> player); 31 virtual bool canHurtPlayer(); 32 virtual bool destroyBlock(int x, int y, int z, int face); 33 virtual void startDestroyBlock(int x, int y, int z, int face); 34 virtual void stopDestroyBlock(); 35 virtual void continueDestroyBlock(int x, int y, int z, int face); 36 virtual float getPickRange(); 37 virtual void tick(); 38private: 39 int carriedItem; 40 41private: 42 bool sameDestroyTarget(int x, int y, int z); 43 void ensureHasSentCarriedItem(); 44public: 45 virtual bool useItemOn(shared_ptr<Player> player, Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=NULL); 46 virtual bool useItem(shared_ptr<Player> player, Level *level, shared_ptr<ItemInstance> item, bool bTestUseOnly=false); 47 virtual shared_ptr<MultiplayerLocalPlayer> createPlayer(Level *level); 48 virtual void attack(shared_ptr<Player> player, shared_ptr<Entity> entity); 49 virtual bool interact(shared_ptr<Player> player, shared_ptr<Entity> entity); 50 virtual shared_ptr<ItemInstance> handleInventoryMouseClick(int containerId, int slotNum, int buttonNum, bool quickKeyHeld, shared_ptr<Player> player); 51 virtual void handleInventoryButtonClick(int containerId, int buttonId); 52 virtual void handleCreativeModeItemAdd(shared_ptr<ItemInstance> clicked, int slot); 53 virtual void handleCreativeModeItemDrop(shared_ptr<ItemInstance> clicked); 54 virtual void releaseUsingItem(shared_ptr<Player> player); 55 virtual bool hasExperience(); 56 virtual bool hasMissTime(); 57 virtual bool hasInfiniteItems(); 58 virtual bool hasFarPickRange(); 59 virtual bool isServerControlledInventory(); 60 61 // 4J Stu - Added so we can send packets for this in the network game 62 virtual bool handleCraftItem(int recipe, shared_ptr<Player> player); 63 virtual void handleDebugOptions(unsigned int uiVal, shared_ptr<Player> player); 64 65 // 4J Stu - Added for tutorial checks 66 virtual bool isInputAllowed(int mapping) { return true; } 67 virtual bool isTutorial() { return false; } 68 virtual Tutorial *getTutorial() { return NULL; } 69};