Created
December 31, 2014 05:49
-
-
Save byteandahalf/94e7d02c0e3e33364eaa to your computer and use it in GitHub Desktop.
Adding a new item in C++ MCPE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static Item* newItem() { | |
Item* myItem = (Item*) ::operator new((std::size_t) 76); // allocate memory | |
Item::Item(myItem, 55); // call the MCPE Item constructor | |
Item::items[55] = myItem; // Add the item to MCPE's global item list | |
*((void***) myItem) = *((void***) Item::items[259]); // give it a normal item vtable, in this case we steal it from flint and steel | |
Item::setDescriptionId("myitem"); // give it a name | |
I18n::_strings["item.myitem.name"] = "My YOLO itemmm"; // register the name | |
myItem->maxStackSize = 30; // max stack of 30 lololol | |
return myItem; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment