Add Some Symbols From MCPI-Addons

This commit is contained in:
TheBrokenRail 2024-01-07 02:59:04 -05:00
parent 34c24378f3
commit d32fa2d265
31 changed files with 118 additions and 73 deletions

@ -1 +1 @@
Subproject commit 1062e048c493607b7b57faf83570562fa44c0f9c Subproject commit 00b223a6adb8808b34f49371b6f2f30c182f147a

View File

@ -8,17 +8,17 @@
// Fix Grass And Leaves Inventory Rendering When The gui_blocks Atlas Is Disabled // Fix Grass And Leaves Inventory Rendering When The gui_blocks Atlas Is Disabled
static void ItemRenderer_renderGuiItemCorrect_injection(Font *font, Textures *textures, ItemInstance *item_instance, int32_t param_1, int32_t param_2) { static void ItemRenderer_renderGuiItemCorrect_injection(Font *font, Textures *textures, ItemInstance *item_instance, int32_t param_1, int32_t param_2) {
int32_t leaves_id = (*Tile_leaves)->id; int32_t leaves_id = Tile_leaves->id;
int32_t grass_id = (*Tile_grass)->id; int32_t grass_id = Tile_grass->id;
// Replace Rendered Item With Carried Variant // Replace Rendered Item With Carried Variant
ItemInstance carried_item_instance; ItemInstance carried_item_instance;
bool use_carried = false; bool use_carried = false;
if (item_instance != NULL) { if (item_instance != NULL) {
if (item_instance->id == leaves_id) { if (item_instance->id == leaves_id) {
(*ItemInstance_constructor_tile_extra)(&carried_item_instance, *Tile_leaves_carried, item_instance->count, item_instance->auxiliary); (*ItemInstance_constructor_tile_extra)(&carried_item_instance, Tile_leaves_carried, item_instance->count, item_instance->auxiliary);
use_carried = true; use_carried = true;
} else if (item_instance->id == grass_id) { } else if (item_instance->id == grass_id) {
(*ItemInstance_constructor_tile_extra)(&carried_item_instance, *Tile_grass_carried, item_instance->count, item_instance->auxiliary); (*ItemInstance_constructor_tile_extra)(&carried_item_instance, Tile_grass_carried, item_instance->count, item_instance->auxiliary);
use_carried = true; use_carried = true;
} }
} }

View File

@ -10,18 +10,18 @@ Item *bucket = NULL;
// Description And Texture // Description And Texture
static std::string BucketItem_getDescriptionId(__attribute__((unused)) Item *item, ItemInstance *item_instance) { static std::string BucketItem_getDescriptionId(__attribute__((unused)) Item *item, ItemInstance *item_instance) {
if (item_instance->auxiliary == (*Tile_water)->id) { if (item_instance->auxiliary == Tile_water->id) {
return "item.bucketWater"; return "item.bucketWater";
} else if (item_instance->auxiliary == (*Tile_lava)->id) { } else if (item_instance->auxiliary == Tile_lava->id) {
return "item.bucketLava"; return "item.bucketLava";
} else { } else {
return "item.bucket"; return "item.bucket";
} }
} }
static int32_t BucketItem_getIcon(__attribute__((unused)) Item *item, int32_t auxiliary) { static int32_t BucketItem_getIcon(__attribute__((unused)) Item *item, int32_t auxiliary) {
if (auxiliary == (*Tile_water)->id) { if (auxiliary == Tile_water->id) {
return 75; return 75;
} else if (auxiliary == (*Tile_lava)->id) { } else if (auxiliary == Tile_lava->id) {
return 76; return 76;
} else { } else {
return 74; return 74;
@ -36,10 +36,10 @@ static int32_t BucketItem_useOn(__attribute__((unused)) Item *item, ItemInstance
// Empty Bucket // Empty Bucket
int32_t new_auxiliary = 0; int32_t new_auxiliary = 0;
int32_t tile = level->vtable->getTile(level, x, y, z); int32_t tile = level->vtable->getTile(level, x, y, z);
if (tile == (*Tile_calmWater)->id) { if (tile == Tile_calmWater->id) {
new_auxiliary = (*Tile_water)->id; new_auxiliary = Tile_water->id;
} else if (tile == (*Tile_calmLava)->id) { } else if (tile == Tile_calmLava->id) {
new_auxiliary = (*Tile_lava)->id; new_auxiliary = Tile_lava->id;
} }
if (new_auxiliary != 0) { if (new_auxiliary != 0) {
// Valid // Valid
@ -103,7 +103,7 @@ static int32_t BucketItem_useOn(__attribute__((unused)) Item *item, ItemInstance
if (material != NULL) { if (material != NULL) {
valid = !material->vtable->isSolid(material); valid = !material->vtable->isSolid(material);
} }
if (item_instance->auxiliary != (*Tile_water)->id && item_instance->auxiliary != (*Tile_lava)->id) { if (item_instance->auxiliary != Tile_water->id && item_instance->auxiliary != Tile_lava->id) {
valid = false; valid = false;
} }
if (valid) { if (valid) {
@ -177,8 +177,8 @@ static void inventory_add_item(FillingContainer *inventory, Item *item, int32_t
} }
static void Inventory_setupDefault_FillingContainer_addItem_call_injection(FillingContainer *filling_container) { static void Inventory_setupDefault_FillingContainer_addItem_call_injection(FillingContainer *filling_container) {
inventory_add_item(filling_container, bucket, 0); inventory_add_item(filling_container, bucket, 0);
inventory_add_item(filling_container, bucket, (*Tile_water)->id); inventory_add_item(filling_container, bucket, Tile_water->id);
inventory_add_item(filling_container, bucket, (*Tile_lava)->id); inventory_add_item(filling_container, bucket, Tile_lava->id);
} }
// Make Liquids Selectable // Make Liquids Selectable
@ -203,9 +203,9 @@ static void handle_tick(Minecraft *minecraft) {
// Prevent Breaking Liquid // Prevent Breaking Liquid
static bool is_calm_liquid(int32_t id) { static bool is_calm_liquid(int32_t id) {
if (id == (*Tile_calmWater)->id) { if (id == Tile_calmWater->id) {
return true; return true;
} else if (id == (*Tile_calmLava)->id) { } else if (id == Tile_calmLava->id) {
return true; return true;
} else { } else {
return false; return false;
@ -254,7 +254,7 @@ static void Recipes_injection(Recipes *recipes) {
// Custom Furnace Fuel // Custom Furnace Fuel
static int32_t FurnaceTileEntity_getBurnDuration_injection(ItemInstance *item_instance) { static int32_t FurnaceTileEntity_getBurnDuration_injection(ItemInstance *item_instance) {
if (item_instance->count > 0 && item_instance->id == bucket->id && item_instance->auxiliary == (*Tile_lava)->id) { if (item_instance->count > 0 && item_instance->id == bucket->id && item_instance->auxiliary == Tile_lava->id) {
return 20000; return 20000;
} else { } else {
// Call Original Method // Call Original Method

View File

@ -68,7 +68,7 @@ void chat_handle_packet_send(Minecraft *minecraft, ChatPacket *packet) {
// Hosting Multiplayer // Hosting Multiplayer
char *message = packet->message; char *message = packet->message;
ServerSideNetworkHandler *server_side_network_handler = (ServerSideNetworkHandler *) minecraft->network_handler; ServerSideNetworkHandler *server_side_network_handler = (ServerSideNetworkHandler *) minecraft->network_handler;
chat_send_message(server_side_network_handler, *Strings_default_username, message); chat_send_message(server_side_network_handler, Strings_default_username, message);
} else { } else {
// Client // Client
rak_net_instance->vtable->send(rak_net_instance, (Packet *) packet); rak_net_instance->vtable->send(rak_net_instance, (Packet *) packet);

View File

@ -24,10 +24,10 @@ static void inventory_add_item(FillingContainer *inventory, Tile *item) {
// Expand Creative Inventory // Expand Creative Inventory
static void Inventory_setupDefault_FillingContainer_addItem_call_injection(FillingContainer *filling_container) { static void Inventory_setupDefault_FillingContainer_addItem_call_injection(FillingContainer *filling_container) {
// Add Items // Add Items
inventory_add_item(filling_container, *Item_flintAndSteel); inventory_add_item(filling_container, Item_flintAndSteel);
inventory_add_item(filling_container, *Item_snowball); inventory_add_item(filling_container, Item_snowball);
inventory_add_item(filling_container, *Item_egg); inventory_add_item(filling_container, Item_egg);
inventory_add_item(filling_container, *Item_shears); inventory_add_item(filling_container, Item_shears);
// Dyes // Dyes
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
if (i == 15) { if (i == 15) {
@ -36,23 +36,23 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli
} }
ItemInstance *new_item_instance = new ItemInstance; ItemInstance *new_item_instance = new ItemInstance;
ALLOC_CHECK(new_item_instance); ALLOC_CHECK(new_item_instance);
new_item_instance = (*ItemInstance_constructor_item_extra)(new_item_instance, *Item_dye_powder, 1, i); new_item_instance = (*ItemInstance_constructor_item_extra)(new_item_instance, Item_dye_powder, 1, i);
(*FillingContainer_addItem)(filling_container, new_item_instance); (*FillingContainer_addItem)(filling_container, new_item_instance);
} }
inventory_add_item(filling_container, *Item_camera); inventory_add_item(filling_container, Item_camera);
// Add Tiles // Add Tiles
inventory_add_item(filling_container, *Tile_water); inventory_add_item(filling_container, Tile_water);
inventory_add_item(filling_container, *Tile_lava); inventory_add_item(filling_container, Tile_lava);
inventory_add_item(filling_container, *Tile_calmWater); inventory_add_item(filling_container, Tile_calmWater);
inventory_add_item(filling_container, *Tile_calmLava); inventory_add_item(filling_container, Tile_calmLava);
inventory_add_item(filling_container, *Tile_glowingObsidian); inventory_add_item(filling_container, Tile_glowingObsidian);
inventory_add_item(filling_container, *Tile_web); inventory_add_item(filling_container, Tile_web);
inventory_add_item(filling_container, *Tile_topSnow); inventory_add_item(filling_container, Tile_topSnow);
inventory_add_item(filling_container, *Tile_ice); inventory_add_item(filling_container, Tile_ice);
inventory_add_item(filling_container, *Tile_invisible_bedrock); inventory_add_item(filling_container, Tile_invisible_bedrock);
inventory_add_item(filling_container, *Tile_bedrock); inventory_add_item(filling_container, Tile_bedrock);
inventory_add_item(filling_container, *Tile_info_updateGame1); inventory_add_item(filling_container, Tile_info_updateGame1);
inventory_add_item(filling_container, *Tile_info_updateGame2); inventory_add_item(filling_container, Tile_info_updateGame2);
// Nether Reactor // Nether Reactor
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
if (i == 0) { if (i == 0) {
@ -61,7 +61,7 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli
} }
ItemInstance *new_item_instance = new ItemInstance; ItemInstance *new_item_instance = new ItemInstance;
ALLOC_CHECK(new_item_instance); ALLOC_CHECK(new_item_instance);
new_item_instance = (*ItemInstance_constructor_tile_extra)(new_item_instance, *Tile_netherReactor, 1, i); new_item_instance = (*ItemInstance_constructor_tile_extra)(new_item_instance, Tile_netherReactor, 1, i);
(*FillingContainer_addItem)(filling_container, new_item_instance); (*FillingContainer_addItem)(filling_container, new_item_instance);
} }
// Tall Grass // Tall Grass
@ -72,14 +72,14 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli
} }
ItemInstance *new_item_instance = new ItemInstance; ItemInstance *new_item_instance = new ItemInstance;
ALLOC_CHECK(new_item_instance); ALLOC_CHECK(new_item_instance);
new_item_instance = (*ItemInstance_constructor_tile_extra)(new_item_instance, *Tile_tallgrass, 1, i); new_item_instance = (*ItemInstance_constructor_tile_extra)(new_item_instance, Tile_tallgrass, 1, i);
(*FillingContainer_addItem)(filling_container, new_item_instance); (*FillingContainer_addItem)(filling_container, new_item_instance);
} }
// Smooth Stone Slab // Smooth Stone Slab
{ {
ItemInstance *new_item_instance = new ItemInstance; ItemInstance *new_item_instance = new ItemInstance;
ALLOC_CHECK(new_item_instance); ALLOC_CHECK(new_item_instance);
new_item_instance = (*ItemInstance_constructor_tile_extra)(new_item_instance, *Tile_stoneSlab, 1, 6); new_item_instance = (*ItemInstance_constructor_tile_extra)(new_item_instance, Tile_stoneSlab, 1, 6);
(*FillingContainer_addItem)(filling_container, new_item_instance); (*FillingContainer_addItem)(filling_container, new_item_instance);
} }
} }

View File

@ -24,7 +24,7 @@ __attribute__((destructor)) static void _free_home() {
// Init // Init
void init_home() { void init_home() {
// Store Data In ~/.minecraft-pi Instead Of ~/.minecraft // Store Data In ~/.minecraft-pi Instead Of ~/.minecraft
patch_address((void *) Strings_default_path, (void *) HOME_SUBDIRECTORY_FOR_GAME_DATA); patch_address((void *) Strings_default_path_pointer, (void *) HOME_SUBDIRECTORY_FOR_GAME_DATA);
// The override code resolves assets manually, // The override code resolves assets manually,
// making changing directory redundant. // making changing directory redundant.

View File

@ -32,8 +32,8 @@ static int use_classic_hud = 0;
static void Gui_renderHearts_GuiComponent_blit_hearts_injection(Gui *component, int32_t x_dest, int32_t y_dest, int32_t x_src, int32_t y_src, int32_t width_dest, int32_t height_dest, int32_t width_src, int32_t height_src) { static void Gui_renderHearts_GuiComponent_blit_hearts_injection(Gui *component, int32_t x_dest, int32_t y_dest, int32_t x_src, int32_t y_src, int32_t width_dest, int32_t height_dest, int32_t width_src, int32_t height_src) {
Minecraft *minecraft = component->minecraft; Minecraft *minecraft = component->minecraft;
x_dest -= DEFAULT_HUD_PADDING; x_dest -= DEFAULT_HUD_PADDING;
float width = ((float) minecraft->screen_width) * *Gui_InvGuiScale; float width = ((float) minecraft->screen_width) * Gui_InvGuiScale;
float height = ((float) minecraft->screen_height) * *Gui_InvGuiScale; float height = ((float) minecraft->screen_height) * Gui_InvGuiScale;
x_dest += (width - (NUMBER_OF_SLOTS * SLOT_WIDTH)) / 2; x_dest += (width - (NUMBER_OF_SLOTS * SLOT_WIDTH)) / 2;
y_dest -= DEFAULT_HUD_PADDING; y_dest -= DEFAULT_HUD_PADDING;
y_dest += height - HUD_ELEMENT_HEIGHT - TOOLBAR_HEIGHT - NEW_HUD_PADDING; y_dest += height - HUD_ELEMENT_HEIGHT - TOOLBAR_HEIGHT - NEW_HUD_PADDING;
@ -43,8 +43,8 @@ static void Gui_renderHearts_GuiComponent_blit_hearts_injection(Gui *component,
static void Gui_renderHearts_GuiComponent_blit_armor_injection(Gui *component, int32_t x_dest, int32_t y_dest, int32_t x_src, int32_t y_src, int32_t width_dest, int32_t height_dest, int32_t width_src, int32_t height_src) { static void Gui_renderHearts_GuiComponent_blit_armor_injection(Gui *component, int32_t x_dest, int32_t y_dest, int32_t x_src, int32_t y_src, int32_t width_dest, int32_t height_dest, int32_t width_src, int32_t height_src) {
Minecraft *minecraft = component->minecraft; Minecraft *minecraft = component->minecraft;
x_dest -= DEFAULT_HUD_PADDING + HUD_ELEMENT_WIDTH; x_dest -= DEFAULT_HUD_PADDING + HUD_ELEMENT_WIDTH;
float width = ((float) minecraft->screen_width) * *Gui_InvGuiScale; float width = ((float) minecraft->screen_width) * Gui_InvGuiScale;
float height = ((float) minecraft->screen_height) * *Gui_InvGuiScale; float height = ((float) minecraft->screen_height) * Gui_InvGuiScale;
x_dest += width - ((width - (NUMBER_OF_SLOTS * SLOT_WIDTH)) / 2) - HUD_ELEMENT_WIDTH; x_dest += width - ((width - (NUMBER_OF_SLOTS * SLOT_WIDTH)) / 2) - HUD_ELEMENT_WIDTH;
y_dest -= DEFAULT_HUD_PADDING; y_dest -= DEFAULT_HUD_PADDING;
y_dest += height - HUD_ELEMENT_HEIGHT - TOOLBAR_HEIGHT - NEW_HUD_PADDING; y_dest += height - HUD_ELEMENT_HEIGHT - TOOLBAR_HEIGHT - NEW_HUD_PADDING;
@ -54,8 +54,8 @@ static void Gui_renderHearts_GuiComponent_blit_armor_injection(Gui *component, i
static void Gui_renderBubbles_GuiComponent_blit_injection(Gui *component, int32_t x_dest, int32_t y_dest, int32_t x_src, int32_t y_src, int32_t width_dest, int32_t height_dest, int32_t width_src, int32_t height_src) { static void Gui_renderBubbles_GuiComponent_blit_injection(Gui *component, int32_t x_dest, int32_t y_dest, int32_t x_src, int32_t y_src, int32_t width_dest, int32_t height_dest, int32_t width_src, int32_t height_src) {
Minecraft *minecraft = component->minecraft; Minecraft *minecraft = component->minecraft;
x_dest -= DEFAULT_HUD_PADDING; x_dest -= DEFAULT_HUD_PADDING;
float width = ((float) minecraft->screen_width) * *Gui_InvGuiScale; float width = ((float) minecraft->screen_width) * Gui_InvGuiScale;
float height = ((float) minecraft->screen_height) * *Gui_InvGuiScale; float height = ((float) minecraft->screen_height) * Gui_InvGuiScale;
x_dest += (width - (NUMBER_OF_SLOTS * SLOT_WIDTH)) / 2; x_dest += (width - (NUMBER_OF_SLOTS * SLOT_WIDTH)) / 2;
y_dest -= DEFAULT_HUD_PADDING + DEFAULT_BUBBLES_PADDING + HUD_ELEMENT_HEIGHT; y_dest -= DEFAULT_HUD_PADDING + DEFAULT_BUBBLES_PADDING + HUD_ELEMENT_HEIGHT;
y_dest += height - HUD_ELEMENT_HEIGHT - TOOLBAR_HEIGHT - HUD_ELEMENT_HEIGHT - NEW_HUD_PADDING; y_dest += height - HUD_ELEMENT_HEIGHT - TOOLBAR_HEIGHT - HUD_ELEMENT_HEIGHT - NEW_HUD_PADDING;
@ -87,7 +87,7 @@ static void Gui_renderChatMessages_injection(Gui *gui, int32_t y_offset, uint32_
// Calculate Selected Item Text Scale // Calculate Selected Item Text Scale
Minecraft *minecraft = gui->minecraft; Minecraft *minecraft = gui->minecraft;
int32_t screen_width = minecraft->screen_width; int32_t screen_width = minecraft->screen_width;
float scale = ((float) screen_width) * *Gui_InvGuiScale; float scale = ((float) screen_width) * Gui_InvGuiScale;
// Render Selected Item Text // Render Selected Item Text
(*Gui_renderOnSelectItemNameText)(gui, (int32_t) scale, font, y_offset - 0x13); (*Gui_renderOnSelectItemNameText)(gui, (int32_t) scale, font, y_offset - 0x13);
} }
@ -275,8 +275,8 @@ static void GameRenderer_render_injection(GameRenderer *game_renderer, float par
// Fix GL Mode // Fix GL Mode
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// Get X And Y // Get X And Y
float x = (*Mouse_getX)() * (*Gui_InvGuiScale); float x = (*Mouse_getX)() * Gui_InvGuiScale;
float y = (*Mouse_getY)() * (*Gui_InvGuiScale); float y = (*Mouse_getY)() * Gui_InvGuiScale;
// Render Cursor // Render Cursor
Minecraft *minecraft = game_renderer->minecraft; Minecraft *minecraft = game_renderer->minecraft;
(*Common_renderCursor)(x, y, minecraft); (*Common_renderCursor)(x, y, minecraft);
@ -418,7 +418,7 @@ static Entity *PathfinderMob_findAttackTarget_injection(PathfinderMob *mob) {
// 3D Chests // 3D Chests
static int32_t Tile_getRenderShape_injection(Tile *tile) { static int32_t Tile_getRenderShape_injection(Tile *tile) {
if (tile == *Tile_chest) { if (tile == Tile_chest) {
// Don't Render "Simple" Chest Model // Don't Render "Simple" Chest Model
return -1; return -1;
} else { } else {
@ -502,7 +502,7 @@ static void glColor4f_injection(__attribute__((unused)) GLfloat red, __attribute
line_width = strtof(custom_line_width, NULL); line_width = strtof(custom_line_width, NULL);
} else { } else {
// Guess // Guess
line_width = 2 / (*Gui_InvGuiScale); line_width = 2 / Gui_InvGuiScale;
} }
// Clamp Line Width // Clamp Line Width
float range[2]; float range[2];

View File

@ -74,7 +74,7 @@ static void Minecraft_init_injection(Minecraft *minecraft) {
// Smooth Lighting // Smooth Lighting
static void TileRenderer_tesselateBlockInWorld_injection(TileRenderer *tile_renderer, Tile *tile, int32_t x, int32_t y, int32_t z) { static void TileRenderer_tesselateBlockInWorld_injection(TileRenderer *tile_renderer, Tile *tile, int32_t x, int32_t y, int32_t z) {
// Set Variable // Set Variable
*Minecraft_useAmbientOcclusion = stored_options->ambient_occlusion; Minecraft_useAmbientOcclusion = stored_options->ambient_occlusion;
// Call Original Method // Call Original Method
(*TileRenderer_tesselateBlockInWorld)(tile_renderer, tile, x, y, z); (*TileRenderer_tesselateBlockInWorld)(tile_renderer, tile, x, y, z);
@ -98,11 +98,11 @@ void init_options() {
// Change Username // Change Username
const char *username = get_username(); const char *username = get_username();
DEBUG("Setting Username: %s", username); DEBUG("Setting Username: %s", username);
if (strcmp(*Strings_default_username, "StevePi") != 0) { if (strcmp(Strings_default_username, "StevePi") != 0) {
ERR("Default Username Is Invalid"); ERR("Default Username Is Invalid");
} }
safe_username = to_cp437(username); safe_username = to_cp437(username);
patch_address((void *) Strings_default_username, (void *) safe_username); patch_address((void *) Strings_default_username_pointer, (void *) safe_username);
// Disable Autojump By Default // Disable Autojump By Default
if (feature_has("Disable Autojump By Default", server_disabled)) { if (feature_has("Disable Autojump By Default", server_disabled)) {

View File

@ -99,9 +99,9 @@ static void OptionsPane_unknown_toggle_creating_function_injection(OptionsPane *
std::string name = *name_ptr; std::string name = *name_ptr;
std::string new_name = name; std::string new_name = name;
if (name == "Fancy Graphics") { if (name == "Fancy Graphics") {
option = Options_Option_GRAPHICS; option = &Options_Option_GRAPHICS;
} else if (name == "Soft shadows") { } else if (name == "Soft shadows") {
option = Options_Option_AMBIENT_OCCLUSION; option = &Options_Option_AMBIENT_OCCLUSION;
} else if (name == "Fancy Skies" || name == "Animated water") { } else if (name == "Fancy Skies" || name == "Animated water") {
// These have no corresponding option, so disable the toggle. // These have no corresponding option, so disable the toggle.
return; return;
@ -123,16 +123,16 @@ static void OptionsPane_unknown_toggle_creating_function_injection(OptionsPane *
(*OptionsPane_unknown_toggle_creating_function)(options_pane, group_id, &new_name, option); (*OptionsPane_unknown_toggle_creating_function)(options_pane, group_id, &new_name, option);
// Add 3D Anaglyph // Add 3D Anaglyph
if (option == Options_Option_GRAPHICS) { if (option == &Options_Option_GRAPHICS) {
std::string cpp_string = "3D Anaglyph"; std::string cpp_string = "3D Anaglyph";
(*OptionsPane_unknown_toggle_creating_function)(options_pane, group_id, &cpp_string, Options_Option_ANAGLYPH); (*OptionsPane_unknown_toggle_creating_function)(options_pane, group_id, &cpp_string, &Options_Option_ANAGLYPH);
} }
} }
// Add Missing Options To Options::getBooleanValue // Add Missing Options To Options::getBooleanValue
static bool Options_getBooleanValue_injection(Options *options, Options_Option *option) { static bool Options_getBooleanValue_injection(Options *options, Options_Option *option) {
// Check // Check
if (option == Options_Option_GRAPHICS) { if (option == &Options_Option_GRAPHICS) {
return options->fancy_graphics; return options->fancy_graphics;
} else { } else {
// Call Original Method // Call Original Method
@ -169,9 +169,9 @@ void _init_options_cpp() {
// Actually Save options.txt // Actually Save options.txt
overwrite_call((void *) 0x197fc, (void *) Options_save_Options_addOptionToSaveOutput_injection); overwrite_call((void *) 0x197fc, (void *) Options_save_Options_addOptionToSaveOutput_injection);
// Fix options.txt Path // Fix options.txt Path
patch_address((void *) Strings_options_txt_path, (void *) get_new_options_txt_path()); patch_address((void *) Strings_options_txt_path_pointer, (void *) get_new_options_txt_path());
// When Loading, options.txt Should Be Opened In Read Mode // When Loading, options.txt Should Be Opened In Read Mode
patch_address((void *) Strings_options_txt_fopen_mode_when_loading, (void *) "r"); patch_address((void *) Strings_options_txt_fopen_mode_when_loading_pointer, (void *) "r");
// Fix OptionsFile::getOptionStrings // Fix OptionsFile::getOptionStrings
overwrite_calls((void *) OptionsFile_getOptionStrings, (void *) OptionsFile_getOptionStrings_injection); overwrite_calls((void *) OptionsFile_getOptionStrings, (void *) OptionsFile_getOptionStrings_injection);
@ -191,8 +191,8 @@ void _init_options_cpp() {
{ {
// Replace String // Replace String
static const char *new_feedback_vibration_options_txt_name = "gfx_ao"; static const char *new_feedback_vibration_options_txt_name = "gfx_ao";
patch_address((void *) Strings_feedback_vibration_options_txt_name_1, (void *) &new_feedback_vibration_options_txt_name); patch_address((void *) Strings_feedback_vibration_options_txt_name_1_pointer, (void *) &new_feedback_vibration_options_txt_name);
patch_address((void *) Strings_feedback_vibration_options_txt_name_2, (void *) &new_feedback_vibration_options_txt_name); patch_address((void *) Strings_feedback_vibration_options_txt_name_2_pointer, (void *) &new_feedback_vibration_options_txt_name);
// Loading // Loading
unsigned char offset = (unsigned char) offsetof(Options, ambient_occlusion); unsigned char offset = (unsigned char) offsetof(Options, ambient_occlusion);
unsigned char gfx_ao_loading_patch[4] = {offset, 0x10, 0x84, 0xe2}; // "add r1, r4, #OFFSET" unsigned char gfx_ao_loading_patch[4] = {offset, 0x10, 0x84, 0xe2}; // "add r1, r4, #OFFSET"
@ -206,7 +206,7 @@ void _init_options_cpp() {
{ {
// Replace String // Replace String
static const char *new_gfx_lowquality_options_txt_name = "gfx_anaglyph"; static const char *new_gfx_lowquality_options_txt_name = "gfx_anaglyph";
patch_address((void *) Strings_gfx_lowquality_options_txt_name, (void *) &new_gfx_lowquality_options_txt_name); patch_address((void *) Strings_gfx_lowquality_options_txt_name_pointer, (void *) &new_gfx_lowquality_options_txt_name);
// Loading // Loading
unsigned char offset = (unsigned char) offsetof(Options, anaglyph_3d); unsigned char offset = (unsigned char) offsetof(Options, anaglyph_3d);
unsigned char gfx_anaglyph_loading_patch[4] = {offset, 0x10, 0x84, 0xe2}; // "add r1, r4, #OFFSET" unsigned char gfx_anaglyph_loading_patch[4] = {offset, 0x10, 0x84, 0xe2}; // "add r1, r4, #OFFSET"

View File

@ -69,7 +69,7 @@ static int32_t Textures_loadAndBindTexture_injection(Textures *textures, __attri
// Change Texture // Change Texture
static std::string new_texture; static std::string new_texture;
if (new_texture.length() == 0) { if (new_texture.length() == 0) {
std::string username = base64_encode(*Strings_default_username); std::string username = base64_encode(Strings_default_username);
new_texture = '$' + username; new_texture = '$' + username;
} }

View File

@ -79,7 +79,7 @@ void init_title_screen() {
} }
// Rename "Create" Button To "Quit" // Rename "Create" Button To "Quit"
patch_address((void *) Strings_classic_create_button_text, (void *) "Quit"); patch_address((void *) Strings_classic_create_button_text_pointer, (void *) "Quit");
// Add Functionality To Quit Button // Add Functionality To Quit Button
patch_address(StartMenuScreen_buttonClicked_vtable_addr, (void *) StartMenuScreen_buttonClicked_injection); patch_address(StartMenuScreen_buttonClicked_vtable_addr, (void *) StartMenuScreen_buttonClicked_injection);

View File

@ -18,8 +18,8 @@ static unsigned char *operator_new_IngameBlockSelectionScreen_injection(__attrib
// Improved Button Hover Behavior // Improved Button Hover Behavior
static int32_t Button_hovered_injection(__attribute__((unused)) Button *button, __attribute__((unused)) Minecraft *minecraft, __attribute__((unused)) int32_t click_x, __attribute__((unused)) int32_t click_y) { static int32_t Button_hovered_injection(__attribute__((unused)) Button *button, __attribute__((unused)) Minecraft *minecraft, __attribute__((unused)) int32_t click_x, __attribute__((unused)) int32_t click_y) {
// Get Mouse Position // Get Mouse Position
int32_t x = (*Mouse_getX)() * (*Gui_InvGuiScale); int32_t x = (*Mouse_getX)() * Gui_InvGuiScale;
int32_t y = (*Mouse_getY)() * (*Gui_InvGuiScale); int32_t y = (*Mouse_getY)() * Gui_InvGuiScale;
// Get Button Position // Get Button Position
int32_t button_x1 = button->x; int32_t button_x1 = button->x;

View File

@ -9,7 +9,7 @@ char *version_get() {
static char *version = NULL; static char *version = NULL;
// Load // Load
if (version == NULL) { if (version == NULL) {
safe_asprintf(&version, "%s / Reborn v%s", *Strings_minecraft_pi_version, reborn_get_version()); safe_asprintf(&version, "%s / Reborn v%s", Strings_minecraft_pi_version, reborn_get_version());
} }
// Return // Return
return version; return version;
@ -30,7 +30,7 @@ void init_version() {
// Touch GUI // Touch GUI
overwrite((void *) Common_getGameVersionString, (void *) Common_getGameVersionString_injection); overwrite((void *) Common_getGameVersionString, (void *) Common_getGameVersionString_injection);
// Normal GUI // Normal GUI
patch_address((void *) Strings_minecraft_pi_version, version_get()); patch_address((void *) Strings_minecraft_pi_version_pointer, version_get());
// Log // Log
INFO("Starting Minecraft: Pi Edition (%s)", version_get()); INFO("Starting Minecraft: Pi Edition (%s)", version_get());

View File

@ -118,6 +118,16 @@ set(SRC
src/Options_Option.def src/Options_Option.def
src/LevelStorageSource.def src/LevelStorageSource.def
src/SignTileEntity.def src/SignTileEntity.def
src/AgableMob.def
src/PrimedTnt.def
src/ItemEntity.def
src/Arrow.def
src/OffsetPosTranslator.def
src/EntityFactory.def
src/MobFactory.def
src/Animal.def
src/Sheep.def
src/PingedCompatibleServer.def
) )
# Resolve Definition Files # Resolve Definition Files
set(RESOLVED_SRC "") set(RESOLVED_SRC "")

View File

@ -0,0 +1,5 @@
extends PathfinderMob;
method void setAge(int age) = 0x7a058;
property int age = 0xbfc;

1
symbols/src/Animal.def Normal file
View File

@ -0,0 +1 @@
extends AgableMob;

3
symbols/src/Arrow.def Normal file
View File

@ -0,0 +1,3 @@
extends Entity;
property bool is_critical = 0xd8;

View File

@ -1,4 +1,6 @@
virtual-method bool hurt(Entity *attacker, int damage) = 0xa4; virtual-method bool hurt(Entity *attacker, int damage) = 0xa4;
virtual-method int getEntityTypeId() = 0xdc;
method void moveTo(float x, float y, float z, float pitch, float yaw) = 0x7a834;
property float x = 0x4; property float x = 0x4;
property float y = 0x8; property float y = 0x8;
@ -10,3 +12,4 @@ property float old_y = 0x2c;
property float old_z = 0x30; property float old_z = 0x30;
property float old_yaw = 0x48; property float old_yaw = 0x48;
property float old_pitch = 0x4c; property float old_pitch = 0x4c;
property int id = 0x1c;

View File

@ -0,0 +1 @@
static-method Entity *CreateEntity(int id, Level *level) = 0x7d794;

View File

@ -18,6 +18,9 @@ property int category = 0x10;
property int max_damage = 0x8; property int max_damage = 0x8;
property int max_stack_size = 0x14; property int max_stack_size = 0x14;
// Globals
static-property-array Item *items = 0x17b250;
// Items // Items
static-property Item *flintAndSteel = 0x17ba70; static-property Item *flintAndSteel = 0x17ba70;
static-property Item *snowball = 0x17bbb0; static-property Item *snowball = 0x17bbb0;

View File

@ -0,0 +1,3 @@
extends Item;
property ItemInstance item = 0xd0;

View File

@ -6,5 +6,8 @@ method void saveLevelData() = 0xa2e94;
method void setTileAndData(int x, int y, int z, int id, int data) = 0xa38b4; method void setTileAndData(int x, int y, int z, int id, int data) = 0xa38b4;
method HitResult clip(uchar *param_1, uchar *param_2, bool clip_liquids, bool param_3) = 0xa3db0; method HitResult clip(uchar *param_1, uchar *param_2, bool clip_liquids, bool param_3) = 0xa3db0;
method void addParticle(std::string *particle, float x, float y, float z, float deltaX, float deltaY, float deltaZ, int count) = 0xa449c; method void addParticle(std::string *particle, float x, float y, float z, float deltaX, float deltaY, float deltaZ, int count) = 0xa449c;
method Entity *getEntity(int id) = 0xa45a4;
method bool addEntity(Entity *entity) = 0xa7cbc;
property std::vector<Player*> players = 0x60; property std::vector<Player*> players = 0x60;
property std::vector<Entity*> entities = 0x20;

View File

@ -19,6 +19,7 @@ method uchar *getCreator() = 0x17538;
method LevelStorageSource *getLevelSource() = 0x16e84; method LevelStorageSource *getLevelSource() = 0x16e84;
method void handleMouseDown(int param_1, bool can_destroy) = 0x1584c; method void handleMouseDown(int param_1, bool can_destroy) = 0x1584c;
virtual-method void selectLevel(std::string *level_dir, std::string *level_name, LevelSettings *settings) = 0x40; virtual-method void selectLevel(std::string *level_dir, std::string *level_name, LevelSettings *settings) = 0x40;
method void joinMultiplayer(PingedCompatibleServer *server) = 0x165f4;
property int screen_width = 0x20; property int screen_width = 0x20;
property int screen_height = 0x24; property int screen_height = 0x24;

View File

@ -0,0 +1,2 @@
static-method Mob *getStaticTestMob(int id, Level *level) = 0x18844;
static-method Mob *CreateMob(int id, Level *level) = 0x18184;

View File

@ -0,0 +1 @@
method void from(int *x, int *y, int *z) = 0x27c98;

View File

View File

@ -6,6 +6,7 @@ method int isUsingItem() = 0x8f15c;
virtual-method void drop(ItemInstance *item_instance, bool is_death) = 0x208; virtual-method void drop(ItemInstance *item_instance, bool is_death) = 0x208;
virtual-method void stopSleepInBed(bool param_1, bool param_2, bool param_3) = 0x228; virtual-method void stopSleepInBed(bool param_1, bool param_2, bool param_3) = 0x228;
virtual-method void openTextEdit(TileEntity *sign) = 0x230; virtual-method void openTextEdit(TileEntity *sign) = 0x230;
method ItemInstance *getArmor(int slot) = 0x8fda4;
property std::string username = 0xbf4; property std::string username = 0xbf4;
property Inventory *inventory = 0xbe0; property Inventory *inventory = 0xbe0;

View File

@ -0,0 +1,3 @@
extends Entity;
property int fuse = 0xd0;

3
symbols/src/Sheep.def Normal file
View File

@ -0,0 +1,3 @@
extends Animal;
method void setColor(int color) = 0x86274;

View File

@ -19,7 +19,7 @@ property int id = 0x8;
property int category = 0x3c; property int category = 0x3c;
// Globals // Globals
static-property Tile *tiles = 0x180e08; static-property-array Tile *tiles = 0x180e08;
// Tiles // Tiles
static-property Tile *chest = 0x181d60; static-property Tile *chest = 0x181d60;

View File

@ -1,3 +1,5 @@
property int id = 0x18; property int id = 0x18;
property int renderer_id = 0x24; property int renderer_id = 0x24;
property bool is_client = 0x20; property bool is_client = 0x20;
property int tile = 0xd0;
property int lifetime = 0xd8;