the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 61 lines 2.0 kB view raw
1#pragma once 2using namespace std; 3 4#include "Entity.h" 5#include "JavaIntHash.h" 6 7class Level; 8class CompoundTag; 9typedef Entity *(*entityCreateFn)(Level *); 10class EntityIO 11{ 12public: 13 class SpawnableMobInfo 14 { 15 public: 16 int id; 17 eMinecraftColour eggColor1; 18 eMinecraftColour eggColor2; 19 int nameId; // 4J Added 20 21 SpawnableMobInfo(int id, eMinecraftColour eggColor1, eMinecraftColour eggColor2, int nameId) 22 { 23 this->id = id; 24 this->eggColor1 = eggColor1; 25 this->eggColor2 = eggColor2; 26 this->nameId = nameId; 27 } 28 }; 29 30private: 31 static unordered_map<wstring, entityCreateFn> *idCreateMap; 32 static unordered_map<eINSTANCEOF, wstring, eINSTANCEOFKeyHash, eINSTANCEOFKeyEq> *classIdMap; 33 static unordered_map<int, entityCreateFn> *numCreateMap; 34 static unordered_map<int, eINSTANCEOF> *numClassMap; 35 static unordered_map<eINSTANCEOF, int, eINSTANCEOFKeyHash, eINSTANCEOFKeyEq> *classNumMap; 36 static unordered_map<wstring, int> *idNumMap; 37 38public: 39 static unordered_map<int, SpawnableMobInfo *> idsSpawnableInCreative; 40 41private: 42 static void setId(entityCreateFn createFn, eINSTANCEOF clas, const wstring &id, int idNum); 43 static void setId(entityCreateFn createFn, eINSTANCEOF clas, const wstring &id, int idNum, eMinecraftColour color1, eMinecraftColour color2, int nameId); 44 45public: 46 static void staticCtor(); 47 static shared_ptr<Entity> newEntity(const wstring& id, Level *level); 48 static shared_ptr<Entity> loadStatic(CompoundTag *tag, Level *level); 49 static shared_ptr<Entity> newById(int id, Level *level); 50 static shared_ptr<Entity> newByEnumType(eINSTANCEOF eType, Level *level); 51 static int getId(shared_ptr<Entity> entity); 52 static wstring getEncodeId(shared_ptr<Entity> entity); 53 static int getId(const wstring &encodeId); 54 static wstring getEncodeId(int entityIoValue); 55 static int getNameId(int entityIoValue); 56 static eINSTANCEOF getType(const wstring &idString); 57 static eINSTANCEOF getClass(int id); 58 59 // 4J-JEV, added for enumerating mobs. 60 static int eTypeToIoid(eINSTANCEOF eType); 61};