Use New Method Call Style
This commit is contained in:
parent
73454adc22
commit
51bbad15f4
2
dependencies/symbol-processor/src
vendored
2
dependencies/symbol-processor/src
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 9697b35de4d783282afdd3a4c643951ce49a0158
|
Subproject commit eca52455c3d8a520aba30b81d17031340b76ff88
|
@ -14,13 +14,6 @@ void reborn_init_patch();
|
|||||||
void _overwrite_call(const char *file, int line, void *start, void *target);
|
void _overwrite_call(const char *file, int line, void *start, void *target);
|
||||||
#define overwrite_call(start, target) _overwrite_call(__FILE__, __LINE__, start, target)
|
#define overwrite_call(start, target) _overwrite_call(__FILE__, __LINE__, start, target)
|
||||||
|
|
||||||
#define _check_if_method_is_new(name) \
|
|
||||||
{ \
|
|
||||||
if (!__is_new_method_##name()) { \
|
|
||||||
ERR("Method Is Not \"New\""); \
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define _setup_fancy_overwrite(start, name, target) \
|
#define _setup_fancy_overwrite(start, name, target) \
|
||||||
static name##_t _original_for_##target = start; \
|
static name##_t _original_for_##target = start; \
|
||||||
static name##_t _helper_for_##target = __overwrite_helper_for_##name(target, _original_for_##target)
|
static name##_t _helper_for_##target = __overwrite_helper_for_##name(target, _original_for_##target)
|
||||||
@ -35,6 +28,12 @@ void *_overwrite_calls(const char *file, int line, void *start, void *target);
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Replace All Calls To Virtual Method start With target
|
// Replace All Calls To Virtual Method start With target
|
||||||
|
#define _check_if_method_is_new(name) \
|
||||||
|
{ \
|
||||||
|
if (!__is_new_method_##name()) { \
|
||||||
|
ERR("Method Is Not \"New\""); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
#define overwrite_virtual_calls(start, target) \
|
#define overwrite_virtual_calls(start, target) \
|
||||||
{ \
|
{ \
|
||||||
_check_if_method_is_new(start); \
|
_check_if_method_is_new(start); \
|
||||||
|
@ -15,10 +15,10 @@ static void ItemRenderer_renderGuiItemCorrect_injection(ItemRenderer_renderGuiIt
|
|||||||
bool use_carried = false;
|
bool use_carried = false;
|
||||||
if (item_instance != nullptr) {
|
if (item_instance != nullptr) {
|
||||||
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);
|
carried_item_instance.constructor_tile_extra(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);
|
carried_item_instance.constructor_tile_extra(Tile_grass_carried, item_instance->count, item_instance->auxiliary);
|
||||||
use_carried = true;
|
use_carried = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,12 +64,12 @@ static void Tesselator_begin_injection(Tesselator_begin_t original, Tesselator *
|
|||||||
// Fix Furnace UI
|
// Fix Furnace UI
|
||||||
if (item_color_fix_mode != 0) {
|
if (item_color_fix_mode != 0) {
|
||||||
// Implict Translucent
|
// Implict Translucent
|
||||||
Tesselator_color(tesselator, 0xff, 0xff, 0xff, 0xff);
|
tesselator->color(0xff, 0xff, 0xff, 0xff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void InventoryPane_renderBatch_Tesselator_color_injection(Tesselator *tesselator, int32_t r, int32_t g, int32_t b) {
|
static void InventoryPane_renderBatch_Tesselator_color_injection(Tesselator *tesselator, int32_t r, int32_t g, int32_t b) {
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
Tesselator_color(tesselator, r, g, b, 0xff);
|
tesselator->color(r, g, b, 0xff);
|
||||||
|
|
||||||
// Enable Item Color Fix
|
// Enable Item Color Fix
|
||||||
item_color_fix_mode = 2;
|
item_color_fix_mode = 2;
|
||||||
@ -86,7 +86,7 @@ static void FurnaceScreen_render_ItemRenderer_renderGuiItem_one_injection(Font *
|
|||||||
item_color_fix_mode = 1;
|
item_color_fix_mode = 1;
|
||||||
|
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
ItemRenderer_renderGuiItem_one(font, textures, item_instance, param_1, param_2, param_3);
|
ItemRenderer::renderGuiItem_one(font, textures, item_instance, param_1, param_2, param_3);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
@ -107,3 +107,4 @@ void init_atlas() {
|
|||||||
overwrite_call((void *) 0x1e21c, (void *) InventoryPane_renderBatch_Tesselator_color_injection);
|
overwrite_call((void *) 0x1e21c, (void *) InventoryPane_renderBatch_Tesselator_color_injection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,18 +32,18 @@ static void start_world(Minecraft *minecraft) {
|
|||||||
settings.seed = BENCHMARK_SEED;
|
settings.seed = BENCHMARK_SEED;
|
||||||
|
|
||||||
// Delete World If It Already Exists
|
// Delete World If It Already Exists
|
||||||
LevelStorageSource *level_source = Minecraft_getLevelSource(minecraft);
|
LevelStorageSource *level_source = minecraft->getLevelSource();
|
||||||
std::string name = BENCHMARK_WORLD_NAME;
|
std::string name = BENCHMARK_WORLD_NAME;
|
||||||
level_source->vtable->deleteLevel(level_source, &name);
|
level_source->deleteLevel(&name);
|
||||||
|
|
||||||
// Select Level
|
// Select Level
|
||||||
minecraft->vtable->selectLevel(minecraft, &name, &name, &settings);
|
minecraft->selectLevel(&name, &name, &settings);
|
||||||
|
|
||||||
// Open ProgressScreen
|
// Open ProgressScreen
|
||||||
ProgressScreen *screen = alloc_ProgressScreen();
|
ProgressScreen *screen = alloc_ProgressScreen();
|
||||||
ALLOC_CHECK(screen);
|
ALLOC_CHECK(screen);
|
||||||
screen = ProgressScreen_constructor(screen);
|
screen = screen->constructor();
|
||||||
Minecraft_setScreen(minecraft, (Screen *) screen);
|
minecraft->setScreen((Screen *) screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Track Frames
|
// Track Frames
|
||||||
@ -93,7 +93,7 @@ static void Minecraft_update_injection(Minecraft *minecraft) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Detect World Loaded
|
// Detect World Loaded
|
||||||
if (!world_loaded && Minecraft_isLevelGenerated(minecraft)) {
|
if (!world_loaded && minecraft->isLevelGenerated()) {
|
||||||
world_loaded = 1;
|
world_loaded = 1;
|
||||||
world_loaded_time = get_time();
|
world_loaded_time = get_time();
|
||||||
#ifndef MCPI_HEADLESS_MODE
|
#ifndef MCPI_HEADLESS_MODE
|
||||||
@ -171,3 +171,4 @@ void init_benchmark() {
|
|||||||
media_disable_vsync();
|
media_disable_vsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ static bool fill_bucket(ItemInstance *item_instance, Player *player, int new_aux
|
|||||||
new_item.count = 1;
|
new_item.count = 1;
|
||||||
new_item.auxiliary = new_auxiliary;
|
new_item.auxiliary = new_auxiliary;
|
||||||
Inventory *inventory = player->inventory;
|
Inventory *inventory = player->inventory;
|
||||||
if (inventory->vtable->add(inventory, &new_item)) {
|
if (inventory->add(&new_item)) {
|
||||||
// Added To Inventory
|
// Added To Inventory
|
||||||
success = true;
|
success = true;
|
||||||
item_instance->count -= 1;
|
item_instance->count -= 1;
|
||||||
@ -62,7 +62,7 @@ static int32_t BucketItem_useOn(__attribute__((unused)) FoodItem *item, ItemInst
|
|||||||
} else if (item_instance->auxiliary == 0) {
|
} else if (item_instance->auxiliary == 0) {
|
||||||
// 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->getTile(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) {
|
||||||
@ -71,7 +71,7 @@ static int32_t BucketItem_useOn(__attribute__((unused)) FoodItem *item, ItemInst
|
|||||||
if (new_auxiliary != 0) {
|
if (new_auxiliary != 0) {
|
||||||
// Valid
|
// Valid
|
||||||
if (fill_bucket(item_instance, player, new_auxiliary)) {
|
if (fill_bucket(item_instance, player, new_auxiliary)) {
|
||||||
Level_setTileAndData(level, x, y, z, 0, 0);
|
level->setTileAndData(x, y, z, 0, 0);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
@ -110,15 +110,15 @@ static int32_t BucketItem_useOn(__attribute__((unused)) FoodItem *item, ItemInst
|
|||||||
}
|
}
|
||||||
// Get Current Tile
|
// Get Current Tile
|
||||||
bool valid = false;
|
bool valid = false;
|
||||||
Material *material = level->vtable->getMaterial(level, x, y, z);
|
Material *material = level->getMaterial(x, y, z);
|
||||||
if (material != nullptr) {
|
if (material != nullptr) {
|
||||||
valid = !material->vtable->isSolid(material);
|
valid = !material->isSolid();
|
||||||
}
|
}
|
||||||
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) {
|
||||||
Level_setTileAndData(level, x, y, z, item_instance->auxiliary, 0);
|
level->setTileAndData(x, y, z, item_instance->auxiliary, 0);
|
||||||
item_instance->auxiliary = 0;
|
item_instance->auxiliary = 0;
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
@ -188,14 +188,14 @@ static FoodItem *create_bucket(int32_t id, int32_t texture_x, int32_t texture_y,
|
|||||||
// Construct
|
// Construct
|
||||||
FoodItem *item = alloc_FoodItem();
|
FoodItem *item = alloc_FoodItem();
|
||||||
ALLOC_CHECK(item);
|
ALLOC_CHECK(item);
|
||||||
Item_constructor((Item *) item, id);
|
Item_constructor((Item *) item, id); // FoodItem's Constructor Was Inlined
|
||||||
|
|
||||||
// Set VTable
|
// Set VTable
|
||||||
item->vtable = get_bucket_vtable();
|
item->vtable = get_bucket_vtable();
|
||||||
|
|
||||||
// Setup
|
// Setup
|
||||||
item->vtable->setIcon(item, texture_x, texture_y);
|
item->setIcon(texture_x, texture_y);
|
||||||
item->vtable->setDescriptionId(item, &name);
|
item->setDescriptionId(&name);
|
||||||
item->is_stacked_by_data = 1;
|
item->is_stacked_by_data = 1;
|
||||||
item->category = 2;
|
item->category = 2;
|
||||||
item->max_damage = 0;
|
item->max_damage = 0;
|
||||||
@ -224,7 +224,7 @@ static int32_t ItemInstance_getMaxStackSize_injection(ItemInstance_getMaxStackSi
|
|||||||
|
|
||||||
// Milking
|
// Milking
|
||||||
bool Cow_interact_injection(Cow_interact_t original, Cow *self, Player *player) {
|
bool Cow_interact_injection(Cow_interact_t original, Cow *self, Player *player) {
|
||||||
ItemInstance *item = Inventory_getSelected(player->inventory);
|
ItemInstance *item = player->inventory->getSelected();
|
||||||
if (item && item->id == bucket->id && item->auxiliary == 0) {
|
if (item && item->id == bucket->id && item->auxiliary == 0) {
|
||||||
// Fill with milk
|
// Fill with milk
|
||||||
fill_bucket(item, player, 1);
|
fill_bucket(item, player, 1);
|
||||||
@ -237,8 +237,8 @@ bool Cow_interact_injection(Cow_interact_t original, Cow *self, Player *player)
|
|||||||
static void inventory_add_item(FillingContainer *inventory, FoodItem *item, int32_t auxiliary) {
|
static void inventory_add_item(FillingContainer *inventory, FoodItem *item, int32_t auxiliary) {
|
||||||
ItemInstance *item_instance = new ItemInstance;
|
ItemInstance *item_instance = new ItemInstance;
|
||||||
ALLOC_CHECK(item_instance);
|
ALLOC_CHECK(item_instance);
|
||||||
item_instance = ItemInstance_constructor_item_extra(item_instance, (Item *) item, 1, auxiliary);
|
item_instance = item_instance->constructor_item_extra((Item *) item, 1, auxiliary);
|
||||||
FillingContainer_addItem(inventory, item_instance);
|
inventory->addItem(item_instance);
|
||||||
}
|
}
|
||||||
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);
|
||||||
@ -251,7 +251,7 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli
|
|||||||
static bool is_holding_bucket = false;
|
static bool is_holding_bucket = false;
|
||||||
static HitResult Mob_pick_Level_clip_injection(Level *level, unsigned char *param_1, unsigned char *param_2, __attribute__((unused)) bool clip_liquids, bool param_3) {
|
static HitResult Mob_pick_Level_clip_injection(Level *level, unsigned char *param_1, unsigned char *param_2, __attribute__((unused)) bool clip_liquids, bool param_3) {
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
return Level_clip(level, param_1, param_2, is_holding_bucket, param_3);
|
return level->clip(param_1, param_2, is_holding_bucket, param_3);
|
||||||
}
|
}
|
||||||
static void handle_tick(Minecraft *minecraft) {
|
static void handle_tick(Minecraft *minecraft) {
|
||||||
LocalPlayer *player = minecraft->player;
|
LocalPlayer *player = minecraft->player;
|
||||||
@ -261,7 +261,7 @@ static void handle_tick(Minecraft *minecraft) {
|
|||||||
Inventory *inventory = player->inventory;
|
Inventory *inventory = player->inventory;
|
||||||
|
|
||||||
// Get Item
|
// Get Item
|
||||||
ItemInstance *inventory_item = inventory->vtable->getItem(inventory, selected_slot);
|
ItemInstance *inventory_item = inventory->getItem(selected_slot);
|
||||||
// Check
|
// Check
|
||||||
is_holding_bucket = inventory_item != nullptr && inventory_item->id == bucket->id && inventory_item->auxiliary == 0;
|
is_holding_bucket = inventory_item != nullptr && inventory_item->id == bucket->id && inventory_item->auxiliary == 0;
|
||||||
}
|
}
|
||||||
@ -284,7 +284,7 @@ static void Minecraft_handleMouseDown_injection(Minecraft_handleMouseDown_t orig
|
|||||||
int32_t x = minecraft->hit_result.x;
|
int32_t x = minecraft->hit_result.x;
|
||||||
int32_t y = minecraft->hit_result.y;
|
int32_t y = minecraft->hit_result.y;
|
||||||
int32_t z = minecraft->hit_result.z;
|
int32_t z = minecraft->hit_result.z;
|
||||||
int32_t tile = level->vtable->getTile(level, x, y, z);
|
int32_t tile = level->getTile(x, y, z);
|
||||||
if (is_calm_liquid(tile)) {
|
if (is_calm_liquid(tile)) {
|
||||||
can_destroy = false;
|
can_destroy = false;
|
||||||
}
|
}
|
||||||
@ -315,7 +315,7 @@ static void Recipes_injection(Recipes *recipes) {
|
|||||||
std::string line1 = "# #";
|
std::string line1 = "# #";
|
||||||
std::string line2 = " # ";
|
std::string line2 = " # ";
|
||||||
std::vector<Recipes_Type> types = {type1};
|
std::vector<Recipes_Type> types = {type1};
|
||||||
Recipes_addShapedRecipe_2(recipes, &result, &line1, &line2, &types);
|
recipes->addShapedRecipe_2(&result, &line1, &line2, &types);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom Furnace Fuel
|
// Custom Furnace Fuel
|
||||||
@ -372,3 +372,4 @@ void init_bucket() {
|
|||||||
misc_run_on_language_setup(Language_injection);
|
misc_run_on_language_setup(Language_injection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ static int Cake_getTexture2(__attribute__((unused)) Tile *tile, int face, __attr
|
|||||||
static int Cake_getTexture3(__attribute__((unused)) Tile *tile, LevelSource *level, int x, int y, int z, int face) {
|
static int Cake_getTexture3(__attribute__((unused)) Tile *tile, LevelSource *level, int x, int y, int z, int face) {
|
||||||
// Eaten face
|
// Eaten face
|
||||||
if (face == 3) {
|
if (face == 3) {
|
||||||
int data = level->vtable->getData(level, x, y, z);
|
int data = level->getData(x, y, z);
|
||||||
if (data != 0 && data < 6) {
|
if (data != 0 && data < 6) {
|
||||||
// Sliced texture
|
// Sliced texture
|
||||||
return 123;
|
return 123;
|
||||||
@ -59,8 +59,7 @@ static bool Cake_isCubeShaped(__attribute__((unused)) Tile *tile) {
|
|||||||
// Size
|
// Size
|
||||||
static void Cake_updateDefaultShape(Tile *tile) {
|
static void Cake_updateDefaultShape(Tile *tile) {
|
||||||
// Set the default shape
|
// Set the default shape
|
||||||
tile->vtable->setShape(
|
tile->setShape(
|
||||||
tile,
|
|
||||||
CAKE_LEN, 0.0, CAKE_LEN,
|
CAKE_LEN, 0.0, CAKE_LEN,
|
||||||
1.0 - CAKE_LEN, 0.5, 1.0 - CAKE_LEN
|
1.0 - CAKE_LEN, 0.5, 1.0 - CAKE_LEN
|
||||||
);
|
);
|
||||||
@ -68,7 +67,7 @@ static void Cake_updateDefaultShape(Tile *tile) {
|
|||||||
|
|
||||||
static AABB *Cake_getAABB(Tile *tile, Level *level, int x, int y, int z) {
|
static AABB *Cake_getAABB(Tile *tile, Level *level, int x, int y, int z) {
|
||||||
// Get the size of the slices
|
// Get the size of the slices
|
||||||
int data = level->vtable->getData(level, x, y, z);
|
int data = level->getData(x, y, z);
|
||||||
if (data >= 6) data = 0;
|
if (data >= 6) data = 0;
|
||||||
float slice_size = (1.0 / 7.0) * (float) data;
|
float slice_size = (1.0 / 7.0) * (float) data;
|
||||||
|
|
||||||
@ -88,12 +87,11 @@ static AABB *Cake_getAABB(Tile *tile, Level *level, int x, int y, int z) {
|
|||||||
|
|
||||||
static void Cake_updateShape(Tile *tile, LevelSource *level, int x, int y, int z) {
|
static void Cake_updateShape(Tile *tile, LevelSource *level, int x, int y, int z) {
|
||||||
// Set cake
|
// Set cake
|
||||||
int data = level->vtable->getData(level, x, y, z);
|
int data = level->getData(x, y, z);
|
||||||
if (data >= 6) data = 0;
|
if (data >= 6) data = 0;
|
||||||
// Get slice amount
|
// Get slice amount
|
||||||
float slice_size = (1.0 / 7.0) * (float) data;
|
float slice_size = (1.0 / 7.0) * (float) data;
|
||||||
tile->vtable->setShape(
|
tile->setShape(
|
||||||
tile,
|
|
||||||
CAKE_LEN, 0.0, CAKE_LEN,
|
CAKE_LEN, 0.0, CAKE_LEN,
|
||||||
1.0 - CAKE_LEN, 0.5, (1.0 - CAKE_LEN) - slice_size
|
1.0 - CAKE_LEN, 0.5, (1.0 - CAKE_LEN) - slice_size
|
||||||
);
|
);
|
||||||
@ -102,15 +100,15 @@ static void Cake_updateShape(Tile *tile, LevelSource *level, int x, int y, int z
|
|||||||
// Eating
|
// Eating
|
||||||
static int Cake_use(__attribute__((unused)) Tile *tile, Level *level, int x, int y, int z, Player *player) {
|
static int Cake_use(__attribute__((unused)) Tile *tile, Level *level, int x, int y, int z, Player *player) {
|
||||||
// Eat
|
// Eat
|
||||||
SimpleFoodData_eat(&player->foodData, 3);
|
player->foodData.eat(3);
|
||||||
// Set the new tile
|
// Set the new tile
|
||||||
int data = level->vtable->getData(level, x, y, z);
|
int data = level->getData(x, y, z);
|
||||||
if (data >= 5) {
|
if (data >= 5) {
|
||||||
// Remove the cake, it has been completely gobbled up
|
// Remove the cake, it has been completely gobbled up
|
||||||
Level_setTileAndData(level, x, y, z, 0, 0);
|
level->setTileAndData(x, y, z, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
// Remove a slice
|
// Remove a slice
|
||||||
Level_setTileAndData(level, x, y, z, 92, data + 1);
|
level->setTileAndData(x, y, z, 92, data + 1);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -121,7 +119,7 @@ static void make_cake() {
|
|||||||
cake = alloc_Tile();
|
cake = alloc_Tile();
|
||||||
ALLOC_CHECK(cake);
|
ALLOC_CHECK(cake);
|
||||||
int texture = 122;
|
int texture = 122;
|
||||||
Tile_constructor(cake, 92, texture, Material_dirt);
|
cake->constructor(92, texture, Material_dirt);
|
||||||
cake->texture = texture;
|
cake->texture = texture;
|
||||||
|
|
||||||
// Set VTable
|
// Set VTable
|
||||||
@ -129,8 +127,7 @@ static void make_cake() {
|
|||||||
ALLOC_CHECK(cake->vtable);
|
ALLOC_CHECK(cake->vtable);
|
||||||
|
|
||||||
// Set shape
|
// Set shape
|
||||||
cake->vtable->setShape(
|
cake->setShape(
|
||||||
cake,
|
|
||||||
CAKE_LEN, 0.0, CAKE_LEN,
|
CAKE_LEN, 0.0, CAKE_LEN,
|
||||||
1.0 - CAKE_LEN, 0.5, 1.0 - CAKE_LEN
|
1.0 - CAKE_LEN, 0.5, 1.0 - CAKE_LEN
|
||||||
);
|
);
|
||||||
@ -148,12 +145,12 @@ static void make_cake() {
|
|||||||
cake->vtable->use = Cake_use;
|
cake->vtable->use = Cake_use;
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
Tile_init(cake);
|
cake->init();
|
||||||
cake->vtable->setDestroyTime(cake, 1.0f);
|
cake->setDestroyTime(1.0f);
|
||||||
cake->vtable->setExplodeable(cake, 20.0f);
|
cake->setExplodeable(20.0f);
|
||||||
cake->category = 4;
|
cake->category = 4;
|
||||||
std::string name = "Cake";
|
std::string name = "Cake";
|
||||||
cake->vtable->setDescriptionId(cake, &name);
|
cake->setDescriptionId(&name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Tile_initTiles_injection(__attribute__((unused)) void *null) {
|
static void Tile_initTiles_injection(__attribute__((unused)) void *null) {
|
||||||
@ -167,7 +164,7 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli
|
|||||||
cake_instance->count = 255;
|
cake_instance->count = 255;
|
||||||
cake_instance->auxiliary = 0;
|
cake_instance->auxiliary = 0;
|
||||||
cake_instance->id = 92;
|
cake_instance->id = 92;
|
||||||
FillingContainer_addItem(filling_container, cake_instance);
|
filling_container->addItem(cake_instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recipe (only when buckets are enabled)
|
// Recipe (only when buckets are enabled)
|
||||||
@ -227,7 +224,7 @@ static void Recipes_injection(Recipes *recipes) {
|
|||||||
std::string line2 = "ses";
|
std::string line2 = "ses";
|
||||||
std::string line3 = "www";
|
std::string line3 = "www";
|
||||||
std::vector<Recipes_Type> ingredients = {milk, sugar, wheat, eggs};
|
std::vector<Recipes_Type> ingredients = {milk, sugar, wheat, eggs};
|
||||||
Recipes_addShapedRecipe_3(recipes, &cake_item, &line1, &line2, &line3, &ingredients);
|
recipes->addShapedRecipe_3(&cake_item, &line1, &line2, &line3, &ingredients);
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_cake() {
|
void init_cake() {
|
||||||
@ -241,3 +238,4 @@ void init_cake() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ static EntityRenderDispatcher *EntityRenderDispatcher_injection(EntityRenderDisp
|
|||||||
// Register TripodCameraRenderer
|
// Register TripodCameraRenderer
|
||||||
TripodCameraRenderer *renderer = alloc_TripodCameraRenderer();
|
TripodCameraRenderer *renderer = alloc_TripodCameraRenderer();
|
||||||
ALLOC_CHECK(renderer);
|
ALLOC_CHECK(renderer);
|
||||||
TripodCameraRenderer_constructor(renderer);
|
renderer->constructor();
|
||||||
EntityRenderDispatcher_assign(dispatcher, (unsigned char) 0x5, (EntityRenderer *) renderer);
|
dispatcher->assign((unsigned char) 0x5, (EntityRenderer *) renderer);
|
||||||
|
|
||||||
return dispatcher;
|
return dispatcher;
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ static EntityRenderDispatcher *EntityRenderDispatcher_injection(EntityRenderDisp
|
|||||||
// Display Smoke From TripodCamera Higher
|
// Display Smoke From TripodCamera Higher
|
||||||
static void TripodCamera_tick_Level_addParticle_call_injection(Level *level, std::string *particle, float x, float y, float z, float deltaX, float deltaY, float deltaZ, int count) {
|
static void TripodCamera_tick_Level_addParticle_call_injection(Level *level, std::string *particle, float x, float y, float z, float deltaX, float deltaY, float deltaZ, int count) {
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
Level_addParticle(level, particle, x, y + 0.5, z, deltaX, deltaY, deltaZ, count);
|
level->addParticle(particle, x, y + 0.5, z, deltaX, deltaY, deltaZ, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
@ -46,3 +46,4 @@ void init_camera() {
|
|||||||
overwrite_call((void *) 0x87dc4, (void *) TripodCamera_tick_Level_addParticle_call_injection);
|
overwrite_call((void *) 0x87dc4, (void *) TripodCamera_tick_Level_addParticle_call_injection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ std::string chat_send_api_command(Minecraft *minecraft, std::string str) {
|
|||||||
client.time = 0;
|
client.time = 0;
|
||||||
CommandServer *command_server = minecraft->command_server;
|
CommandServer *command_server = minecraft->command_server;
|
||||||
if (command_server != nullptr) {
|
if (command_server != nullptr) {
|
||||||
return CommandServer_parse(command_server, &client, &str);
|
return command_server->parse(&client, &str);
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -43,19 +43,19 @@ void chat_send_message(ServerSideNetworkHandler *server_side_network_handler, ch
|
|||||||
sanitize_string(&full_message, MAX_CHAT_MESSAGE_LENGTH, 0);
|
sanitize_string(&full_message, MAX_CHAT_MESSAGE_LENGTH, 0);
|
||||||
std::string cpp_string = full_message;
|
std::string cpp_string = full_message;
|
||||||
free(full_message);
|
free(full_message);
|
||||||
ServerSideNetworkHandler_displayGameMessage(server_side_network_handler, &cpp_string);
|
server_side_network_handler->displayGameMessage(&cpp_string);
|
||||||
}
|
}
|
||||||
// Handle Chat packet Send
|
// Handle Chat packet Send
|
||||||
void chat_handle_packet_send(Minecraft *minecraft, ChatPacket *packet) {
|
void chat_handle_packet_send(Minecraft *minecraft, ChatPacket *packet) {
|
||||||
RakNetInstance *rak_net_instance = minecraft->rak_net_instance;
|
RakNetInstance *rak_net_instance = minecraft->rak_net_instance;
|
||||||
if (rak_net_instance->vtable->isServer(rak_net_instance)) {
|
if (rak_net_instance->isServer()) {
|
||||||
// Hosting Multiplayer
|
// Hosting Multiplayer
|
||||||
const char *message = packet->message.c_str();
|
const char *message = packet->message.c_str();
|
||||||
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, (char *) message);
|
chat_send_message(server_side_network_handler, Strings_default_username, (char *) message);
|
||||||
} else {
|
} else {
|
||||||
// Client
|
// Client
|
||||||
rak_net_instance->vtable->send(rak_net_instance, (Packet *) packet);
|
rak_net_instance->send((Packet *) packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ static void CommandServer_parse_CommandServer_dispatchPacket_injection(CommandSe
|
|||||||
|
|
||||||
// Handle ChatPacket Server-Side
|
// Handle ChatPacket Server-Side
|
||||||
static void ServerSideNetworkHandler_handle_ChatPacket_injection(ServerSideNetworkHandler *server_side_network_handler, RakNet_RakNetGUID *rak_net_guid, ChatPacket *chat_packet) {
|
static void ServerSideNetworkHandler_handle_ChatPacket_injection(ServerSideNetworkHandler *server_side_network_handler, RakNet_RakNetGUID *rak_net_guid, ChatPacket *chat_packet) {
|
||||||
Player *player = ServerSideNetworkHandler_getPlayer(server_side_network_handler, rak_net_guid);
|
Player *player = server_side_network_handler->getPlayer(rak_net_guid);
|
||||||
if (player != nullptr) {
|
if (player != nullptr) {
|
||||||
const char *username = player->username.c_str();
|
const char *username = player->username.c_str();
|
||||||
const char *message = chat_packet->message.c_str();
|
const char *message = chat_packet->message.c_str();
|
||||||
@ -99,3 +99,4 @@ void init_chat() {
|
|||||||
patch((void *) 0x6b4c0, message_limit_patch);
|
patch((void *) 0x6b4c0, message_limit_patch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,15 +51,15 @@ CUSTOM_VTABLE(chat_screen, Screen) {
|
|||||||
is_in_chat = false;
|
is_in_chat = false;
|
||||||
ChatScreen *self = (ChatScreen *) super;
|
ChatScreen *self = (ChatScreen *) super;
|
||||||
delete self->chat;
|
delete self->chat;
|
||||||
self->send->vtable->destructor_deleting(self->send);
|
self->send->destructor_deleting();
|
||||||
};
|
};
|
||||||
// Rendering
|
// Rendering
|
||||||
static Screen_render_t original_render = vtable->render;
|
static Screen_render_t original_render = vtable->render;
|
||||||
vtable->render = [](Screen *super, int x, int y, float param_1) {
|
vtable->render = [](Screen *super, int x, int y, float param_1) {
|
||||||
// Background
|
// Background
|
||||||
super->vtable->renderBackground(super);
|
super->renderBackground();
|
||||||
// Render Chat
|
// Render Chat
|
||||||
Gui_renderChatMessages(&super->minecraft->gui, super->height, 20, true, super->font);
|
super->minecraft->gui.renderChatMessages(super->height, 20, true, super->font);
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
original_render(super, x, y, param_1);
|
original_render(super, x, y, param_1);
|
||||||
};
|
};
|
||||||
@ -91,7 +91,7 @@ CUSTOM_VTABLE(chat_screen, Screen) {
|
|||||||
}
|
}
|
||||||
_chat_send_message(super->minecraft, text.c_str());
|
_chat_send_message(super->minecraft, text.c_str());
|
||||||
}
|
}
|
||||||
Minecraft_setScreen(super->minecraft, nullptr);
|
super->minecraft->setScreen(nullptr);
|
||||||
} else if (key == 0x26) {
|
} else if (key == 0x26) {
|
||||||
// Up
|
// Up
|
||||||
local_history.at(self->history_pos) = self->chat->getText();
|
local_history.at(self->history_pos) = self->chat->getText();
|
||||||
@ -120,7 +120,7 @@ CUSTOM_VTABLE(chat_screen, Screen) {
|
|||||||
if (button == self->send) {
|
if (button == self->send) {
|
||||||
// Send
|
// Send
|
||||||
self->chat->setFocused(true);
|
self->chat->setFocused(true);
|
||||||
super->vtable->keyPressed(super, 0x0d);
|
super->keyPressed(0x0d);
|
||||||
} else {
|
} else {
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
original_buttonClicked(super, button);
|
original_buttonClicked(super, button);
|
||||||
@ -131,7 +131,7 @@ static Screen *create_chat_screen() {
|
|||||||
// Construct
|
// Construct
|
||||||
ChatScreen *screen = new ChatScreen;
|
ChatScreen *screen = new ChatScreen;
|
||||||
ALLOC_CHECK(screen);
|
ALLOC_CHECK(screen);
|
||||||
Screen_constructor(&screen->super.super);
|
screen->super.super.constructor();
|
||||||
|
|
||||||
// Set VTable
|
// Set VTable
|
||||||
screen->super.super.vtable = get_chat_screen_vtable();
|
screen->super.super.vtable = get_chat_screen_vtable();
|
||||||
@ -145,7 +145,7 @@ void _init_chat_ui() {
|
|||||||
misc_run_on_game_key_press([](Minecraft *minecraft, int key) {
|
misc_run_on_game_key_press([](Minecraft *minecraft, int key) {
|
||||||
if (key == 0x54) {
|
if (key == 0x54) {
|
||||||
if (Minecraft_isLevelGenerated(minecraft) && minecraft->screen == nullptr) {
|
if (Minecraft_isLevelGenerated(minecraft) && minecraft->screen == nullptr) {
|
||||||
Minecraft_setScreen(minecraft, create_chat_screen());
|
minecraft->setScreen(create_chat_screen());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -153,3 +153,4 @@ void _init_chat_ui() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,3 +17,4 @@ void _patch_bcm_host_calls() {
|
|||||||
overwrite_call((void *) 0x12618, (void *) do_nothing); // vc_dispmanx_element_add
|
overwrite_call((void *) 0x12618, (void *) do_nothing); // vc_dispmanx_element_add
|
||||||
overwrite_call((void *) 0x12624, (void *) do_nothing); // vc_dispmanx_update_submit_sync
|
overwrite_call((void *) 0x12624, (void *) do_nothing); // vc_dispmanx_update_submit_sync
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,3 +140,4 @@ void compat_request_exit() {
|
|||||||
// Request
|
// Request
|
||||||
exit_requested = 1;
|
exit_requested = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,3 +38,4 @@ void _patch_egl_calls() {
|
|||||||
patch((void *) 0x12504, nop_patch); // eglDestroySurface #2
|
patch((void *) 0x12504, nop_patch); // eglDestroySurface #2
|
||||||
overwrite_call((void *) 0x12594, (void *) eglCreateContext_injection); // eglCreateContext
|
overwrite_call((void *) 0x12594, (void *) eglCreateContext_injection); // eglCreateContext
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,3 +27,4 @@ void _patch_x11_calls() {
|
|||||||
overwrite_call((void *) 0x132a4, (void *) XGetWindowAttributes_injection); // XGetWindowAttributes
|
overwrite_call((void *) 0x132a4, (void *) XGetWindowAttributes_injection); // XGetWindowAttributes
|
||||||
overwrite_call((void *) 0x132d4, (void *) XTranslateCoordinates_injection); // XTranslateCoordinates
|
overwrite_call((void *) 0x132d4, (void *) XTranslateCoordinates_injection); // XTranslateCoordinates
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,14 +11,14 @@
|
|||||||
static void inventory_add_item(FillingContainer *inventory, Item *item) {
|
static void inventory_add_item(FillingContainer *inventory, Item *item) {
|
||||||
ItemInstance *item_instance = new ItemInstance;
|
ItemInstance *item_instance = new ItemInstance;
|
||||||
ALLOC_CHECK(item_instance);
|
ALLOC_CHECK(item_instance);
|
||||||
item_instance = ItemInstance_constructor_item(item_instance, item);
|
item_instance = item_instance->constructor_item(item);
|
||||||
FillingContainer_addItem(inventory, item_instance);
|
inventory->addItem(item_instance);
|
||||||
}
|
}
|
||||||
static void inventory_add_item(FillingContainer *inventory, Tile *item) {
|
static void inventory_add_item(FillingContainer *inventory, Tile *item) {
|
||||||
ItemInstance *item_instance = new ItemInstance;
|
ItemInstance *item_instance = new ItemInstance;
|
||||||
ALLOC_CHECK(item_instance);
|
ALLOC_CHECK(item_instance);
|
||||||
item_instance = ItemInstance_constructor_tile(item_instance, item);
|
item_instance = item_instance->constructor_tile(item);
|
||||||
FillingContainer_addItem(inventory, item_instance);
|
inventory->addItem(item_instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expand Creative Inventory
|
// Expand Creative Inventory
|
||||||
@ -36,8 +36,8 @@ 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 = new_item_instance->constructor_item_extra(Item_dye_powder, 1, i);
|
||||||
FillingContainer_addItem(filling_container, new_item_instance);
|
filling_container->addItem(new_item_instance);
|
||||||
}
|
}
|
||||||
inventory_add_item(filling_container, Item_camera);
|
inventory_add_item(filling_container, Item_camera);
|
||||||
// Add Tiles
|
// Add Tiles
|
||||||
@ -61,8 +61,8 @@ 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 = new_item_instance->constructor_tile_extra(Tile_netherReactor, 1, i);
|
||||||
FillingContainer_addItem(filling_container, new_item_instance);
|
filling_container->addItem(new_item_instance);
|
||||||
}
|
}
|
||||||
// Tall Grass
|
// Tall Grass
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
@ -72,15 +72,15 @@ 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 = new_item_instance->constructor_tile_extra(Tile_tallgrass, 1, i);
|
||||||
FillingContainer_addItem(filling_container, new_item_instance);
|
filling_container->addItem(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 = new_item_instance->constructor_tile_extra(Tile_stoneSlab, 1, 6);
|
||||||
FillingContainer_addItem(filling_container, new_item_instance);
|
filling_container->addItem(new_item_instance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -88,7 +88,7 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli
|
|||||||
// Hook Specific TileItem Constructor
|
// Hook Specific TileItem Constructor
|
||||||
static TileItem *Tile_initTiles_TileItem_injection(TileItem *tile_item, int32_t id) {
|
static TileItem *Tile_initTiles_TileItem_injection(TileItem *tile_item, int32_t id) {
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
TileItem_constructor(tile_item, id);
|
tile_item->constructor(id);
|
||||||
|
|
||||||
// Switch VTable
|
// Switch VTable
|
||||||
tile_item->vtable = (TileItem_vtable *) AuxDataTileItem_vtable_base;
|
tile_item->vtable = (TileItem_vtable *) AuxDataTileItem_vtable_base;
|
||||||
@ -173,3 +173,4 @@ void init_creative() {
|
|||||||
patch((void *) 0x8e104, maximize_stack_patch);
|
patch((void *) 0x8e104, maximize_stack_patch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,10 +13,10 @@ std::string get_death_message(Player *player, Entity *cause, bool was_shot = fal
|
|||||||
std::string message = player->username;
|
std::string message = player->username;
|
||||||
if (cause) {
|
if (cause) {
|
||||||
// Entity cause
|
// Entity cause
|
||||||
int type_id = cause->vtable->getEntityTypeId(cause);
|
int type_id = cause->getEntityTypeId();
|
||||||
int aux = cause->vtable->getAuxData(cause);
|
int aux = cause->getAuxData();
|
||||||
bool is_player = cause->vtable->isPlayer(cause);
|
bool is_player = cause->isPlayer();
|
||||||
if (cause->vtable->getCreatureBaseType(cause) != 0 || is_player) {
|
if (cause->getCreatureBaseType() != 0 || is_player) {
|
||||||
// Killed by a creature
|
// Killed by a creature
|
||||||
if (was_shot) {
|
if (was_shot) {
|
||||||
message += " was shot by ";
|
message += " was shot by ";
|
||||||
@ -38,12 +38,12 @@ std::string get_death_message(Player *player, Entity *cause, bool was_shot = fal
|
|||||||
} else if (aux) {
|
} else if (aux) {
|
||||||
// Killed by a throwable with owner
|
// Killed by a throwable with owner
|
||||||
Level *level = player->level;
|
Level *level = player->level;
|
||||||
Entity *shooter = Level_getEntity(level, aux);
|
Entity *shooter = level->getEntity(aux);
|
||||||
return get_death_message(player, shooter, true);
|
return get_death_message(player, shooter, true);
|
||||||
} else if (type_id == 65) {
|
} else if (type_id == 65) {
|
||||||
// Blown up by TNT
|
// Blown up by TNT
|
||||||
return message + " was blown apart";
|
return message + " was blown apart";
|
||||||
} else if (cause->vtable->isHangingEntity(cause)) {
|
} else if (cause->isHangingEntity()) {
|
||||||
// Painting?
|
// Painting?
|
||||||
return message + " admired too much art";
|
return message + " admired too much art";
|
||||||
}
|
}
|
||||||
@ -81,13 +81,13 @@ static bool Mob_hurt_injection(Mob_hurt_t original, Mob *mob, Entity *source, in
|
|||||||
/* Get Variable */ \
|
/* Get Variable */ \
|
||||||
RakNetInstance *rak_net_instance = player->minecraft->rak_net_instance; \
|
RakNetInstance *rak_net_instance = player->minecraft->rak_net_instance; \
|
||||||
/* Only Run On Server-Side */ \
|
/* Only Run On Server-Side */ \
|
||||||
if (rak_net_instance->vtable->isServer(rak_net_instance)) { \
|
if (rak_net_instance->isServer()) { \
|
||||||
/* Get Death Message */ \
|
/* Get Death Message */ \
|
||||||
std::string message = get_death_message((Player *) player, cause); \
|
std::string message = get_death_message((Player *) player, cause); \
|
||||||
\
|
\
|
||||||
/* Post Death Message */ \
|
/* Post Death Message */ \
|
||||||
ServerSideNetworkHandler *server_side_network_handler = (ServerSideNetworkHandler *) player->minecraft->network_handler; \
|
ServerSideNetworkHandler *server_side_network_handler = (ServerSideNetworkHandler *) player->minecraft->network_handler; \
|
||||||
ServerSideNetworkHandler_displayGameMessage(server_side_network_handler, &message); \
|
server_side_network_handler->displayGameMessage(&message); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#define Player_actuallyHurt_injections(type) \
|
#define Player_actuallyHurt_injections(type) \
|
||||||
@ -105,7 +105,7 @@ static bool Mob_hurt_injection(Mob_hurt_t original, Mob *mob, Entity *source, in
|
|||||||
/* Get Variables */ \
|
/* Get Variables */ \
|
||||||
RakNetInstance *rak_net_instance = player->minecraft->rak_net_instance; \
|
RakNetInstance *rak_net_instance = player->minecraft->rak_net_instance; \
|
||||||
/* Only Run On Server-Side */ \
|
/* Only Run On Server-Side */ \
|
||||||
if (rak_net_instance->vtable->isServer(rak_net_instance)) { \
|
if (rak_net_instance->isServer()) { \
|
||||||
/* Check Health */ \
|
/* Check Health */ \
|
||||||
if (new_health < 1 && old_health >= 1) { \
|
if (new_health < 1 && old_health >= 1) { \
|
||||||
/* Get Death Message */ \
|
/* Get Death Message */ \
|
||||||
@ -113,7 +113,7 @@ static bool Mob_hurt_injection(Mob_hurt_t original, Mob *mob, Entity *source, in
|
|||||||
\
|
\
|
||||||
/* Post Death Message */ \
|
/* Post Death Message */ \
|
||||||
ServerSideNetworkHandler *server_side_network_handler = (ServerSideNetworkHandler *) player->minecraft->network_handler; \
|
ServerSideNetworkHandler *server_side_network_handler = (ServerSideNetworkHandler *) player->minecraft->network_handler; \
|
||||||
ServerSideNetworkHandler_displayGameMessage(server_side_network_handler, &message); \
|
server_side_network_handler->displayGameMessage(&message); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
@ -144,3 +144,4 @@ void init_death() {
|
|||||||
unsigned char ldr_r0_24_patch[4] = {0x24, 0x00, 0x90, 0xe5}; // "ldr r0, [r0, #0x24]"
|
unsigned char ldr_r0_24_patch[4] = {0x24, 0x00, 0x90, 0xe5}; // "ldr r0, [r0, #0x24]"
|
||||||
patch((void *) 0x8799c, ldr_r0_24_patch);
|
patch((void *) 0x8799c, ldr_r0_24_patch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,3 +27,4 @@ bool _feature_has(const char *name) {
|
|||||||
// Return
|
// Return
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,3 +52,4 @@ void init_fps() {
|
|||||||
misc_run_on_tick(print_fps);
|
misc_run_on_tick(print_fps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,3 +76,4 @@ void init_game_mode() {
|
|||||||
patch((void *) 0x6dc70, server_patch);
|
patch((void *) 0x6dc70, server_patch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,9 +70,9 @@ CUSTOM_VTABLE(create_world_screen, Screen) {
|
|||||||
CreateWorldScreen *self = (CreateWorldScreen *) super;
|
CreateWorldScreen *self = (CreateWorldScreen *) super;
|
||||||
delete self->name;
|
delete self->name;
|
||||||
delete self->seed;
|
delete self->seed;
|
||||||
self->game_mode->vtable->destructor_deleting(self->game_mode);
|
self->game_mode->destructor_deleting();
|
||||||
self->back->vtable->destructor_deleting(self->back);
|
self->back->destructor_deleting();
|
||||||
self->create->vtable->destructor_deleting(self->create);
|
self->create->destructor_deleting();
|
||||||
};
|
};
|
||||||
// Rendering
|
// Rendering
|
||||||
static Screen_render_t original_render = vtable->render;
|
static Screen_render_t original_render = vtable->render;
|
||||||
@ -125,7 +125,7 @@ CUSTOM_VTABLE(create_world_screen, Screen) {
|
|||||||
// ESC
|
// ESC
|
||||||
vtable->handleBackEvent = [](Screen *super, bool do_nothing) {
|
vtable->handleBackEvent = [](Screen *super, bool do_nothing) {
|
||||||
if (!do_nothing) {
|
if (!do_nothing) {
|
||||||
ScreenChooser_setScreen(&super->minecraft->screen_chooser, 5);
|
super->minecraft->screen_chooser.setScreen(5);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -138,7 +138,7 @@ CUSTOM_VTABLE(create_world_screen, Screen) {
|
|||||||
self->game_mode->text = is_creative ? SURVIVAL_STR : CREATIVE_STR;
|
self->game_mode->text = is_creative ? SURVIVAL_STR : CREATIVE_STR;
|
||||||
} else if (button == self->back) {
|
} else if (button == self->back) {
|
||||||
// Back
|
// Back
|
||||||
super->vtable->handleBackEvent(super, false);
|
super->handleBackEvent(false);
|
||||||
} else if (button == self->create) {
|
} else if (button == self->create) {
|
||||||
// Create
|
// Create
|
||||||
create_world(super->minecraft, self->name->getText(), is_creative, self->seed->getText());
|
create_world(super->minecraft, self->name->getText(), is_creative, self->seed->getText());
|
||||||
@ -149,7 +149,7 @@ static Screen *create_create_world_screen() {
|
|||||||
// Construct
|
// Construct
|
||||||
CreateWorldScreen *screen = new CreateWorldScreen;
|
CreateWorldScreen *screen = new CreateWorldScreen;
|
||||||
ALLOC_CHECK(screen);
|
ALLOC_CHECK(screen);
|
||||||
Screen_constructor(&screen->super.super);
|
screen->super.super.constructor();
|
||||||
|
|
||||||
// Set VTable
|
// Set VTable
|
||||||
screen->super.super.vtable = get_create_world_screen_vtable();
|
screen->super.super.vtable = get_create_world_screen_vtable();
|
||||||
@ -162,7 +162,7 @@ static Screen *create_create_world_screen() {
|
|||||||
static std::string getUniqueLevelName(LevelStorageSource *source, const std::string &in) {
|
static std::string getUniqueLevelName(LevelStorageSource *source, const std::string &in) {
|
||||||
std::set<std::string> maps;
|
std::set<std::string> maps;
|
||||||
std::vector<LevelSummary> vls;
|
std::vector<LevelSummary> vls;
|
||||||
source->vtable->getLevelList(source, &vls);
|
source->getLevelList(&vls);
|
||||||
for (int i = 0; i < int(vls.size()); i++) {
|
for (int i = 0; i < int(vls.size()); i++) {
|
||||||
const LevelSummary &ls = vls[i];
|
const LevelSummary &ls = vls[i];
|
||||||
maps.insert(ls.folder);
|
maps.insert(ls.folder);
|
||||||
@ -178,20 +178,20 @@ static std::string getUniqueLevelName(LevelStorageSource *source, const std::str
|
|||||||
static void create_world(Minecraft *minecraft, std::string name, bool is_creative, std::string seed_str) {
|
static void create_world(Minecraft *minecraft, std::string name, bool is_creative, std::string seed_str) {
|
||||||
// Get Seed
|
// Get Seed
|
||||||
int seed;
|
int seed;
|
||||||
seed_str = Util_stringTrim(&seed_str);
|
seed_str = Util::stringTrim(&seed_str);
|
||||||
if (!seed_str.empty()) {
|
if (!seed_str.empty()) {
|
||||||
int num;
|
int num;
|
||||||
if (sscanf(seed_str.c_str(), "%d", &num) > 0) {
|
if (sscanf(seed_str.c_str(), "%d", &num) > 0) {
|
||||||
seed = num;
|
seed = num;
|
||||||
} else {
|
} else {
|
||||||
seed = Util_hashCode(&seed_str);
|
seed = Util::hashCode(&seed_str);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
seed = Common_getEpochTimeS();
|
seed = Common::getEpochTimeS();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Folder Name
|
// Get Folder Name
|
||||||
name = Util_stringTrim(&name);
|
name = Util::stringTrim(&name);
|
||||||
std::string folder = "";
|
std::string folder = "";
|
||||||
for (char c : name) {
|
for (char c : name) {
|
||||||
if (
|
if (
|
||||||
@ -221,16 +221,16 @@ static void create_world(Minecraft *minecraft, std::string name, bool is_creativ
|
|||||||
settings.seed = seed;
|
settings.seed = seed;
|
||||||
|
|
||||||
// Create World
|
// Create World
|
||||||
minecraft->vtable->selectLevel(minecraft, &folder, &name, &settings);
|
minecraft->selectLevel(&folder, &name, &settings);
|
||||||
|
|
||||||
// Multiplayer
|
// Multiplayer
|
||||||
Minecraft_hostMultiplayer(minecraft, 19132);
|
minecraft->hostMultiplayer(19132);
|
||||||
|
|
||||||
// Open ProgressScreen
|
// Open ProgressScreen
|
||||||
ProgressScreen *screen = alloc_ProgressScreen();
|
ProgressScreen *screen = alloc_ProgressScreen();
|
||||||
ALLOC_CHECK(screen);
|
ALLOC_CHECK(screen);
|
||||||
screen = ProgressScreen_constructor(screen);
|
screen = screen->constructor();
|
||||||
Minecraft_setScreen(minecraft, (Screen *) screen);
|
minecraft->setScreen((Screen *) screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redirect Create World Button
|
// Redirect Create World Button
|
||||||
@ -238,7 +238,7 @@ static void create_world(Minecraft *minecraft, std::string name, bool is_creativ
|
|||||||
static void prefix##SelectWorldScreen_tick_injection(prefix##SelectWorldScreen_tick_t original, prefix##SelectWorldScreen *screen) { \
|
static void prefix##SelectWorldScreen_tick_injection(prefix##SelectWorldScreen_tick_t original, prefix##SelectWorldScreen *screen) { \
|
||||||
if (screen->should_create_world) { \
|
if (screen->should_create_world) { \
|
||||||
/* Open Screen */ \
|
/* Open Screen */ \
|
||||||
Minecraft_setScreen(screen->minecraft, create_create_world_screen()); \
|
screen->minecraft->setScreen(create_create_world_screen()); \
|
||||||
/* Finish */ \
|
/* Finish */ \
|
||||||
screen->should_create_world = false; \
|
screen->should_create_world = false; \
|
||||||
} else { \
|
} else { \
|
||||||
|
@ -31,3 +31,4 @@ void init_home() {
|
|||||||
unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
||||||
patch((void *) 0xe0ac, nop_patch);
|
patch((void *) 0xe0ac, nop_patch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,3 +40,4 @@ __attribute__((constructor)) static void init() {
|
|||||||
init_benchmark();
|
init_benchmark();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ static int32_t MouseBuildInput_tickBuild_injection(MouseBuildInput_tickBuild_t o
|
|||||||
static bool last_player_attack_successful = false;
|
static bool last_player_attack_successful = false;
|
||||||
static bool Player_attack_Entity_hurt_injection(Entity *entity, Entity *attacker, int32_t damage) {
|
static bool Player_attack_Entity_hurt_injection(Entity *entity, Entity *attacker, int32_t damage) {
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
last_player_attack_successful = entity->vtable->hurt(entity, attacker, damage);
|
last_player_attack_successful = entity->hurt(attacker, damage);
|
||||||
return last_player_attack_successful;
|
return last_player_attack_successful;
|
||||||
}
|
}
|
||||||
static ItemInstance *Player_attack_Inventory_getSelected_injection(Inventory *inventory) {
|
static ItemInstance *Player_attack_Inventory_getSelected_injection(Inventory *inventory) {
|
||||||
@ -49,7 +49,7 @@ static ItemInstance *Player_attack_Inventory_getSelected_injection(Inventory *in
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
return Inventory_getSelected(inventory);
|
return inventory->getSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
@ -63,3 +63,4 @@ void _init_attack() {
|
|||||||
overwrite_call((void *) 0x8fc24, (void *) Player_attack_Inventory_getSelected_injection);
|
overwrite_call((void *) 0x8fc24, (void *) Player_attack_Inventory_getSelected_injection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ static void _handle_bow(Minecraft *minecraft) {
|
|||||||
GameMode *game_mode = minecraft->game_mode;
|
GameMode *game_mode = minecraft->game_mode;
|
||||||
LocalPlayer *player = minecraft->player;
|
LocalPlayer *player = minecraft->player;
|
||||||
if (player != nullptr && game_mode != nullptr && player->isUsingItem()) {
|
if (player != nullptr && game_mode != nullptr && player->isUsingItem()) {
|
||||||
game_mode->vtable->releaseUsingItem(game_mode, (Player *) player);
|
game_mode->releaseUsingItem((Player *) player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,3 +31,4 @@ void _init_bow() {
|
|||||||
fix_bow = feature_has("Fix Bow & Arrow", server_disabled);
|
fix_bow = feature_has("Fix Bow & Arrow", server_disabled);
|
||||||
input_run_on_tick(_handle_bow);
|
input_run_on_tick(_handle_bow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@ static void _handle_open_crafting(Minecraft *minecraft) {
|
|||||||
if (!creative_is_restricted() || !Minecraft_isCreativeMode(minecraft)) {
|
if (!creative_is_restricted() || !Minecraft_isCreativeMode(minecraft)) {
|
||||||
WorkbenchScreen *screen = alloc_WorkbenchScreen();
|
WorkbenchScreen *screen = alloc_WorkbenchScreen();
|
||||||
ALLOC_CHECK(screen);
|
ALLOC_CHECK(screen);
|
||||||
screen = WorkbenchScreen_constructor(screen, 0);
|
screen = screen->constructor(0);
|
||||||
Minecraft_setScreen(minecraft, (Screen *) screen);
|
minecraft->setScreen((Screen *) screen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -28,3 +28,4 @@ static void _handle_open_crafting(Minecraft *minecraft) {
|
|||||||
void _init_crafting() {
|
void _init_crafting() {
|
||||||
input_run_on_tick(_handle_open_crafting);
|
input_run_on_tick(_handle_open_crafting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ static void _handle_drop(Minecraft *minecraft) {
|
|||||||
Inventory *inventory = player->inventory;
|
Inventory *inventory = player->inventory;
|
||||||
|
|
||||||
// Get Item
|
// Get Item
|
||||||
ItemInstance *inventory_item = inventory->vtable->getItem(inventory, selected_slot);
|
ItemInstance *inventory_item = inventory->getItem(selected_slot);
|
||||||
// Check
|
// Check
|
||||||
if (inventory_item != nullptr && inventory_item->count > 0) {
|
if (inventory_item != nullptr && inventory_item->count > 0) {
|
||||||
// Copy
|
// Copy
|
||||||
@ -64,7 +64,7 @@ static void _handle_drop(Minecraft *minecraft) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Drop
|
// Drop
|
||||||
player->vtable->drop(player, dropped_item, false);
|
player->drop(dropped_item, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,3 +78,4 @@ void _init_drop() {
|
|||||||
enable_drop = feature_has("Bind \"Q\" Key To Item Dropping", server_disabled);
|
enable_drop = feature_has("Bind \"Q\" Key To Item Dropping", server_disabled);
|
||||||
input_run_on_tick(_handle_drop);
|
input_run_on_tick(_handle_drop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,3 +57,4 @@ void init_input() {
|
|||||||
media_set_raw_mouse_motion_enabled(0);
|
media_set_raw_mouse_motion_enabled(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ static void _handle_back(Minecraft *minecraft) {
|
|||||||
}
|
}
|
||||||
// Send Event
|
// Send Event
|
||||||
for (int i = 0; i < back_button_presses; i++) {
|
for (int i = 0; i < back_button_presses; i++) {
|
||||||
minecraft->vtable->handleBack(minecraft, 0);
|
minecraft->handleBack(0);
|
||||||
}
|
}
|
||||||
back_button_presses = 0;
|
back_button_presses = 0;
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ static void _handle_back(Minecraft *minecraft) {
|
|||||||
static bool OptionsScreen_handleBackEvent_injection(OptionsScreen *screen, bool do_nothing) {
|
static bool OptionsScreen_handleBackEvent_injection(OptionsScreen *screen, bool do_nothing) {
|
||||||
if (!do_nothing) {
|
if (!do_nothing) {
|
||||||
Minecraft *minecraft = screen->minecraft;
|
Minecraft *minecraft = screen->minecraft;
|
||||||
Minecraft_setScreen(minecraft, nullptr);
|
minecraft->setScreen(nullptr);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -48,11 +48,11 @@ static bool InBedScreen_handleBackEvent_injection(InBedScreen *screen, bool do_n
|
|||||||
if (!do_nothing) {
|
if (!do_nothing) {
|
||||||
// Close Screen
|
// Close Screen
|
||||||
Minecraft *minecraft = screen->minecraft;
|
Minecraft *minecraft = screen->minecraft;
|
||||||
Minecraft_setScreen(minecraft, nullptr);
|
minecraft->setScreen(nullptr);
|
||||||
// Stop Sleeping
|
// Stop Sleeping
|
||||||
LocalPlayer *player = minecraft->player;
|
LocalPlayer *player = minecraft->player;
|
||||||
if (player != nullptr) {
|
if (player != nullptr) {
|
||||||
player->vtable->stopSleepInBed(player, 1, 1, 1);
|
player->stopSleepInBed(1, 1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -68,10 +68,10 @@ void input_set_mouse_grab_state(int state) {
|
|||||||
static void _handle_mouse_grab(Minecraft *minecraft) {
|
static void _handle_mouse_grab(Minecraft *minecraft) {
|
||||||
if (mouse_grab_state == -1) {
|
if (mouse_grab_state == -1) {
|
||||||
// Grab
|
// Grab
|
||||||
Minecraft_grabMouse(minecraft);
|
minecraft->grabMouse();
|
||||||
} else if (mouse_grab_state == 1) {
|
} else if (mouse_grab_state == 1) {
|
||||||
// Un-Grab
|
// Un-Grab
|
||||||
Minecraft_releaseMouse(minecraft);
|
minecraft->releaseMouse();
|
||||||
}
|
}
|
||||||
mouse_grab_state = 0;
|
mouse_grab_state = 0;
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ static bool Gui_tickItemDrop_Minecraft_isCreativeMode_call_injection(Minecraft *
|
|||||||
bool is_in_game = minecraft->screen == nullptr || minecraft->screen->vtable == (Screen_vtable *) Touch_IngameBlockSelectionScreen_vtable_base;
|
bool is_in_game = minecraft->screen == nullptr || minecraft->screen->vtable == (Screen_vtable *) Touch_IngameBlockSelectionScreen_vtable_base;
|
||||||
if (!enable_misc || (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_OFF && is_in_game)) {
|
if (!enable_misc || (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_OFF && is_in_game)) {
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
return creative_is_restricted() && Minecraft_isCreativeMode(minecraft);
|
return creative_is_restricted() && minecraft->isCreativeMode();
|
||||||
} else {
|
} else {
|
||||||
// Disable Item Drop Ticking
|
// Disable Item Drop Ticking
|
||||||
return 1;
|
return 1;
|
||||||
@ -115,3 +115,4 @@ void _init_misc() {
|
|||||||
input_run_on_tick(_handle_back);
|
input_run_on_tick(_handle_back);
|
||||||
input_run_on_tick(_handle_mouse_grab);
|
input_run_on_tick(_handle_mouse_grab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,3 +97,4 @@ void _init_toggle() {
|
|||||||
overwrite_calls(ParticleEngine_render, ParticleEngine_render_injection);
|
overwrite_calls(ParticleEngine_render, ParticleEngine_render_injection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ SETUP_CALLBACK(creative_inventory_setup, FillingContainer);
|
|||||||
// Handle Custom Creative Inventory Setup Behavior
|
// Handle Custom Creative Inventory Setup Behavior
|
||||||
static void Inventory_setupDefault_FillingContainer_addItem_call_injection(FillingContainer *filling_container, ItemInstance *item_instance) {
|
static void Inventory_setupDefault_FillingContainer_addItem_call_injection(FillingContainer *filling_container, ItemInstance *item_instance) {
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
FillingContainer_addItem(filling_container, item_instance);
|
filling_container->addItem(item_instance);
|
||||||
|
|
||||||
// Run Functions
|
// Run Functions
|
||||||
handle_misc_creative_inventory_setup(filling_container);
|
handle_misc_creative_inventory_setup(filling_container);
|
||||||
@ -183,3 +183,4 @@ void _init_misc_api() {
|
|||||||
// Handle Key Presses
|
// Handle Key Presses
|
||||||
overwrite_calls(Gui_handleKeyPressed, Gui_handleKeyPressed_injection);
|
overwrite_calls(Gui_handleKeyPressed, Gui_handleKeyPressed_injection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ static void Gui_addMessage_injection(Gui_addMessage_t original, Gui *gui, std::s
|
|||||||
static int last_progress = -1;
|
static int last_progress = -1;
|
||||||
static const char *last_message = nullptr;
|
static const char *last_message = nullptr;
|
||||||
static void print_progress(Minecraft *minecraft) {
|
static void print_progress(Minecraft *minecraft) {
|
||||||
const char *message = Minecraft_getProgressMessage(minecraft);
|
const char *message = minecraft->getProgressMessage();
|
||||||
int32_t progress = minecraft->progress;
|
int32_t progress = minecraft->progress;
|
||||||
if (Minecraft_isLevelGenerated(minecraft)) {
|
if (Minecraft_isLevelGenerated(minecraft)) {
|
||||||
message = "Ready";
|
message = "Ready";
|
||||||
@ -97,3 +97,4 @@ void _init_misc_logging() {
|
|||||||
// Disable stdout Buffering
|
// Disable stdout Buffering
|
||||||
setvbuf(stdout, nullptr, _IONBF, 0);
|
setvbuf(stdout, nullptr, _IONBF, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,10 +75,10 @@ static void Gui_renderHearts_injection(Gui_renderHearts_t original, Gui *gui) {
|
|||||||
heal_amount = heal_amount_drawing = 0;
|
heal_amount = heal_amount_drawing = 0;
|
||||||
|
|
||||||
Inventory *inventory = gui->minecraft->player->inventory;
|
Inventory *inventory = gui->minecraft->player->inventory;
|
||||||
ItemInstance *held_ii = Inventory_getSelected(inventory);
|
ItemInstance *held_ii = inventory->getSelected();
|
||||||
if (held_ii) {
|
if (held_ii) {
|
||||||
Item *held = Item_items[held_ii->id];
|
Item *held = Item_items[held_ii->id];
|
||||||
if (held->vtable->isFood(held) && held_ii->id) {
|
if (held->isFood() && held_ii->id) {
|
||||||
int nutrition = ((FoodItem *) held)->nutrition;
|
int nutrition = ((FoodItem *) held)->nutrition;
|
||||||
int cur_health = gui->minecraft->player->health;
|
int cur_health = gui->minecraft->player->health;
|
||||||
int heal_num = fmin(cur_health + nutrition, 20) - cur_health;
|
int heal_num = fmin(cur_health + nutrition, 20) - cur_health;
|
||||||
@ -151,7 +151,7 @@ static void Gui_renderChatMessages_injection(Gui_renderChatMessages_t original,
|
|||||||
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((int32_t) scale, font, y_offset - 0x13);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Reset Selected Item Text Timer On Slot Select
|
// Reset Selected Item Text Timer On Slot Select
|
||||||
@ -235,7 +235,7 @@ static void LoginPacket_read_injection(LoginPacket_read_t original, LoginPacket
|
|||||||
ALLOC_CHECK(new_username);
|
ALLOC_CHECK(new_username);
|
||||||
sanitize_string(&new_username, MAX_USERNAME_LENGTH, 0);
|
sanitize_string(&new_username, MAX_USERNAME_LENGTH, 0);
|
||||||
// Set New Username
|
// Set New Username
|
||||||
RakNet_RakString_Assign(rak_string, new_username);
|
rak_string->Assign(new_username);
|
||||||
// Free
|
// Free
|
||||||
free(new_username);
|
free(new_username);
|
||||||
}
|
}
|
||||||
@ -272,7 +272,7 @@ static const char *RAKNET_ERROR_NAMES[] = {
|
|||||||
#endif
|
#endif
|
||||||
static RakNet_StartupResult RakNetInstance_host_RakNet_RakPeer_Startup_injection(RakNet_RakPeer *rak_peer, unsigned short maxConnections, unsigned char *socketDescriptors, uint32_t socketDescriptorCount, int32_t threadPriority) {
|
static RakNet_StartupResult RakNetInstance_host_RakNet_RakPeer_Startup_injection(RakNet_RakPeer *rak_peer, unsigned short maxConnections, unsigned char *socketDescriptors, uint32_t socketDescriptorCount, int32_t threadPriority) {
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
RakNet_StartupResult result = rak_peer->vtable->Startup(rak_peer, maxConnections, socketDescriptors, socketDescriptorCount, threadPriority);
|
RakNet_StartupResult result = rak_peer->Startup(maxConnections, socketDescriptors, socketDescriptorCount, threadPriority);
|
||||||
|
|
||||||
// Print Error
|
// Print Error
|
||||||
if (result != RAKNET_STARTED) {
|
if (result != RAKNET_STARTED) {
|
||||||
@ -297,7 +297,7 @@ static RakNetInstance *RakNetInstance_injection(RakNetInstance_constructor_t ori
|
|||||||
static void LocalPlayer_die_injection(LocalPlayer_die_t original, LocalPlayer *entity, Entity *cause) {
|
static void LocalPlayer_die_injection(LocalPlayer_die_t original, LocalPlayer *entity, Entity *cause) {
|
||||||
// Close Screen
|
// Close Screen
|
||||||
Minecraft *minecraft = entity->minecraft;
|
Minecraft *minecraft = entity->minecraft;
|
||||||
Minecraft_setScreen(minecraft, nullptr);
|
minecraft->setScreen(nullptr);
|
||||||
|
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
original(entity, cause);
|
original(entity, cause);
|
||||||
@ -307,7 +307,7 @@ static void LocalPlayer_die_injection(LocalPlayer_die_t original, LocalPlayer *e
|
|||||||
static int32_t FurnaceScreen_handleAddItem_injection(FurnaceScreen_handleAddItem_t original, FurnaceScreen *furnace_screen, int32_t slot, ItemInstance *item) {
|
static int32_t FurnaceScreen_handleAddItem_injection(FurnaceScreen_handleAddItem_t original, FurnaceScreen *furnace_screen, int32_t slot, ItemInstance *item) {
|
||||||
// Get Existing Item
|
// Get Existing Item
|
||||||
FurnaceTileEntity *tile_entity = furnace_screen->tile_entity;
|
FurnaceTileEntity *tile_entity = furnace_screen->tile_entity;
|
||||||
ItemInstance *existing_item = tile_entity->vtable->getItem(tile_entity, slot);
|
ItemInstance *existing_item = tile_entity->getItem(slot);
|
||||||
|
|
||||||
// Check Item
|
// Check Item
|
||||||
int valid;
|
int valid;
|
||||||
@ -349,11 +349,11 @@ static void GameRenderer_render_injection(GameRenderer_render_t original, GameRe
|
|||||||
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -410,7 +410,7 @@ HOOK(bind, int, (int sockfd, const struct sockaddr *addr, socklen_t addrlen)) {
|
|||||||
|
|
||||||
// Change Grass Color
|
// Change Grass Color
|
||||||
static int32_t get_color(LevelSource *level_source, int32_t x, int32_t z) {
|
static int32_t get_color(LevelSource *level_source, int32_t x, int32_t z) {
|
||||||
Biome *biome = level_source->vtable->getBiome(level_source, x, z);
|
Biome *biome = level_source->getBiome(x, z);
|
||||||
if (biome == nullptr) {
|
if (biome == nullptr) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -459,7 +459,7 @@ static void RandomLevelSource_buildSurface_injection(RandomLevelSource_buildSurf
|
|||||||
LargeCaveFeature *cave_feature = &random_level_source->cave_feature;
|
LargeCaveFeature *cave_feature = &random_level_source->cave_feature;
|
||||||
|
|
||||||
// Generate
|
// Generate
|
||||||
cave_feature->vtable->apply(cave_feature, (ChunkSource *) random_level_source, level, chunk_x, chunk_y, chunk_data, 0);
|
cave_feature->apply((ChunkSource *) random_level_source, level, chunk_x, chunk_y, chunk_data, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// No Block Tinting
|
// No Block Tinting
|
||||||
@ -471,15 +471,15 @@ static int32_t Tile_getColor_injection(__attribute__((unused)) T original, __att
|
|||||||
// Disable Hostile AI In Creative Mode
|
// Disable Hostile AI In Creative Mode
|
||||||
static Entity *PathfinderMob_findAttackTarget_injection(PathfinderMob *mob) {
|
static Entity *PathfinderMob_findAttackTarget_injection(PathfinderMob *mob) {
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
Entity *target = mob->vtable->findAttackTarget(mob);
|
Entity *target = mob->findAttackTarget();
|
||||||
|
|
||||||
// Only modify the AI of monsters
|
// Only modify the AI of monsters
|
||||||
if (mob->vtable->getCreatureBaseType(mob) != 1) {
|
if (mob->getCreatureBaseType() != 1) {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check If Creative Mode
|
// Check If Creative Mode
|
||||||
if (target != nullptr && target->vtable->isPlayer(target)) {
|
if (target != nullptr && target->isPlayer()) {
|
||||||
Player *player = (Player *) target;
|
Player *player = (Player *) target;
|
||||||
Inventory *inventory = player->inventory;
|
Inventory *inventory = player->inventory;
|
||||||
bool is_creative = inventory->is_creative;
|
bool is_creative = inventory->is_creative;
|
||||||
@ -499,7 +499,7 @@ static int32_t Tile_getRenderShape_injection(Tile *tile) {
|
|||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
return tile->vtable->getRenderShape(tile);
|
return tile->getRenderShape();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static ChestTileEntity *ChestTileEntity_injection(ChestTileEntity_constructor_t original, ChestTileEntity *tile_entity) {
|
static ChestTileEntity *ChestTileEntity_injection(ChestTileEntity_constructor_t original, ChestTileEntity *tile_entity) {
|
||||||
@ -518,7 +518,7 @@ static void ModelPart_render_injection(ModelPart *model_part, float scale) {
|
|||||||
is_rendering_chest = true;
|
is_rendering_chest = true;
|
||||||
|
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
ModelPart_render(model_part, scale);
|
model_part->render(scale);
|
||||||
|
|
||||||
// Stop
|
// Stop
|
||||||
is_rendering_chest = false;
|
is_rendering_chest = false;
|
||||||
@ -545,7 +545,7 @@ static ContainerMenu *ContainerMenu_injection(ContainerMenu_constructor_t origin
|
|||||||
ChestTileEntity *tile_entity = (ChestTileEntity *) (((unsigned char *) container) - offsetof(ChestTileEntity, container));
|
ChestTileEntity *tile_entity = (ChestTileEntity *) (((unsigned char *) container) - offsetof(ChestTileEntity, container));
|
||||||
bool is_client = tile_entity->is_client;
|
bool is_client = tile_entity->is_client;
|
||||||
if (!is_client) {
|
if (!is_client) {
|
||||||
container->vtable->startOpen(container);
|
container->startOpen();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
@ -557,7 +557,7 @@ static ContainerMenu *ContainerMenu_destructor_injection(ContainerMenu_destructo
|
|||||||
ChestTileEntity *tile_entity = (ChestTileEntity *) (((unsigned char *) container) - offsetof(ChestTileEntity, container));
|
ChestTileEntity *tile_entity = (ChestTileEntity *) (((unsigned char *) container) - offsetof(ChestTileEntity, container));
|
||||||
bool is_client = tile_entity->is_client;
|
bool is_client = tile_entity->is_client;
|
||||||
if (!is_client) {
|
if (!is_client) {
|
||||||
container->vtable->stopOpen(container);
|
container->stopOpen();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
@ -666,7 +666,7 @@ static void PauseScreen_init_injection(PauseScreen_init_t original, PauseScreen
|
|||||||
Minecraft *minecraft = screen->minecraft;
|
Minecraft *minecraft = screen->minecraft;
|
||||||
RakNetInstance *rak_net_instance = minecraft->rak_net_instance;
|
RakNetInstance *rak_net_instance = minecraft->rak_net_instance;
|
||||||
if (rak_net_instance != nullptr) {
|
if (rak_net_instance != nullptr) {
|
||||||
if (rak_net_instance->vtable->isServer(rak_net_instance)) {
|
if (rak_net_instance->isServer()) {
|
||||||
// Add Button
|
// Add Button
|
||||||
std::vector<Button *> *rendered_buttons = &screen->rendered_buttons;
|
std::vector<Button *> *rendered_buttons = &screen->rendered_buttons;
|
||||||
std::vector<Button *> *selectable_buttons = &screen->selectable_buttons;
|
std::vector<Button *> *selectable_buttons = &screen->selectable_buttons;
|
||||||
@ -675,7 +675,7 @@ static void PauseScreen_init_injection(PauseScreen_init_t original, PauseScreen
|
|||||||
selectable_buttons->push_back(button);
|
selectable_buttons->push_back(button);
|
||||||
|
|
||||||
// Update Button Text
|
// Update Button Text
|
||||||
PauseScreen_updateServerVisibilityText(screen);
|
screen->updateServerVisibilityText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -687,18 +687,18 @@ void PaneCraftingScreen_craftSelectedItem_PaneCraftingScreen_recheckRecipes_inje
|
|||||||
for (size_t i = 0; i < item->ingredients.size(); i++) {
|
for (size_t i = 0; i < item->ingredients.size(); i++) {
|
||||||
ItemInstance requested_item_instance = item->ingredients[i].requested_item;
|
ItemInstance requested_item_instance = item->ingredients[i].requested_item;
|
||||||
Item *requested_item = Item_items[requested_item_instance.id];
|
Item *requested_item = Item_items[requested_item_instance.id];
|
||||||
ItemInstance *craftingRemainingItem = requested_item->vtable->getCraftingRemainingItem(requested_item, &requested_item_instance);
|
ItemInstance *craftingRemainingItem = requested_item->getCraftingRemainingItem(&requested_item_instance);
|
||||||
if (craftingRemainingItem != nullptr) {
|
if (craftingRemainingItem != nullptr) {
|
||||||
// Add or drop remainder
|
// Add or drop remainder
|
||||||
LocalPlayer *player = self->minecraft->player;
|
LocalPlayer *player = self->minecraft->player;
|
||||||
if (!player->inventory->vtable->add(player->inventory, craftingRemainingItem)) {
|
if (!player->inventory->add(craftingRemainingItem)) {
|
||||||
// Drop
|
// Drop
|
||||||
player->vtable->drop(player, craftingRemainingItem, false);
|
player->drop(craftingRemainingItem, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
PaneCraftingScreen_recheckRecipes(self);
|
self->recheckRecipes();
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemInstance *Item_getCraftingRemainingItem_injection(__attribute__((unused)) Item_getCraftingRemainingItem_t original, Item *self, ItemInstance *item_instance) {
|
ItemInstance *Item_getCraftingRemainingItem_injection(__attribute__((unused)) Item_getCraftingRemainingItem_t original, Item *self, ItemInstance *item_instance) {
|
||||||
@ -727,7 +727,7 @@ static void sort_chunks(Chunk **chunks_begin, Chunk **chunks_end, DistanceChunkS
|
|||||||
}
|
}
|
||||||
for (int i = 0; i < chunks_size; i++) {
|
for (int i = 0; i < chunks_size; i++) {
|
||||||
Chunk *chunk = chunks_begin[i];
|
Chunk *chunk = chunks_begin[i];
|
||||||
float distance = Chunk_distanceToSqr(chunk, (Entity *) sorter.mob);
|
float distance = chunk->distanceToSqr((Entity *) sorter.mob);
|
||||||
if ((1024.0 <= distance) && chunk->y < 0x40) {
|
if ((1024.0 <= distance) && chunk->y < 0x40) {
|
||||||
distance *= 10.0;
|
distance *= 10.0;
|
||||||
}
|
}
|
||||||
@ -997,3 +997,4 @@ void init_misc() {
|
|||||||
_init_misc_logging();
|
_init_misc_logging();
|
||||||
_init_misc_api();
|
_init_misc_api();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ static void RakNetInstance_pingForHosts_injection(RakNetInstance_pingForHosts_t
|
|||||||
|
|
||||||
// Add External Servers
|
// Add External Servers
|
||||||
iterate_servers([rak_peer](const char *address, int port) {
|
iterate_servers([rak_peer](const char *address, int port) {
|
||||||
rak_peer->vtable->Ping(rak_peer, address, port, 1, 0);
|
rak_peer->Ping(address, port, 1, 0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,3 +133,4 @@ void init_multiplayer() {
|
|||||||
overwrite_virtual_calls(RakNetInstance_pingForHosts, RakNetInstance_pingForHosts_injection);
|
overwrite_virtual_calls(RakNetInstance_pingForHosts, RakNetInstance_pingForHosts_injection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,17 +89,17 @@ static bool TileRenderer_tesselateBlockInWorld_injection(TileRenderer_tesselateB
|
|||||||
// Hook Last Options::addOptionToSaveOutput Call
|
// Hook Last Options::addOptionToSaveOutput Call
|
||||||
static void Options_save_Options_addOptionToSaveOutput_injection(Options *options, std::vector<std::string> *data, std::string option, int32_t value) {
|
static void Options_save_Options_addOptionToSaveOutput_injection(Options *options, std::vector<std::string> *data, std::string option, int32_t value) {
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
Options_addOptionToSaveOutput(options, data, option, value);
|
options->addOptionToSaveOutput(data, option, value);
|
||||||
|
|
||||||
// Save Fancy Graphics
|
// Save Fancy Graphics
|
||||||
Options_addOptionToSaveOutput(options, data, "gfx_fancygraphics", options->fancy_graphics);
|
options->addOptionToSaveOutput(data, "gfx_fancygraphics", options->fancy_graphics);
|
||||||
|
|
||||||
// Save 3D Anaglyph
|
// Save 3D Anaglyph
|
||||||
Options_addOptionToSaveOutput(options, data, "gfx_anaglyph", options->anaglyph_3d);
|
options->addOptionToSaveOutput(data, "gfx_anaglyph", options->anaglyph_3d);
|
||||||
|
|
||||||
// Save File
|
// Save File
|
||||||
OptionsFile *options_file = &options->options_file;
|
OptionsFile *options_file = &options->options_file;
|
||||||
OptionsFile_save(options_file, data);
|
options_file->save(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// MCPI's OptionsFile::getOptionStrings is broken, this is the version in v0.7.0
|
// MCPI's OptionsFile::getOptionStrings is broken, this is the version in v0.7.0
|
||||||
@ -247,3 +247,4 @@ void init_options() {
|
|||||||
// UI
|
// UI
|
||||||
_init_options_ui();
|
_init_options_ui();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
// The calling function doesn't exist in MCPE v0.6.1, so its name is unknown.
|
// The calling function doesn't exist in MCPE v0.6.1, so its name is unknown.
|
||||||
static OptionButton *OptionsPane_unknown_toggle_creating_function_OptionButton_injection(OptionButton *option_button, Options_Option *option) {
|
static OptionButton *OptionsPane_unknown_toggle_creating_function_OptionButton_injection(OptionButton *option_button, Options_Option *option) {
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
OptionButton *ret = OptionButton_constructor(option_button, option);
|
OptionButton *ret = option_button->constructor(option);
|
||||||
|
|
||||||
// Setup Image
|
// Setup Image
|
||||||
OptionButton_updateImage(option_button, stored_options);
|
option_button->updateImage(stored_options);
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
return ret;
|
return ret;
|
||||||
@ -87,7 +87,7 @@ static void OptionButton_toggle_Options_save_injection(Options *self) {
|
|||||||
self->game_difficulty = 0;
|
self->game_difficulty = 0;
|
||||||
}
|
}
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
Options_save(self);
|
self->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add "Reborn" Info Button
|
// Add "Reborn" Info Button
|
||||||
|
@ -104,3 +104,4 @@ HOOK(fopen64, FILE *, (const char *filename, const char *mode)) {
|
|||||||
// Return File
|
// Return File
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,3 +20,4 @@ dirent *readdir(DIR *dirp) {
|
|||||||
new_dirent.d_type = original->d_type;
|
new_dirent.d_type = original->d_type;
|
||||||
return &new_dirent;
|
return &new_dirent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,3 +104,4 @@ void screenshot_take(char *home) {
|
|||||||
free(screenshots);
|
free(screenshots);
|
||||||
free(pixels);
|
free(pixels);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,21 +84,21 @@ static void start_world(Minecraft *minecraft) {
|
|||||||
settings.seed = seed;
|
settings.seed = seed;
|
||||||
|
|
||||||
// Select Level
|
// Select Level
|
||||||
minecraft->vtable->selectLevel(minecraft, &world_name, &world_name, &settings);
|
minecraft->selectLevel(&world_name, &world_name, &settings);
|
||||||
|
|
||||||
// Don't Open Port When Using --only-generate
|
// Don't Open Port When Using --only-generate
|
||||||
if (!only_generate) {
|
if (!only_generate) {
|
||||||
// Open Port
|
// Open Port
|
||||||
int port = get_server_properties().get_int("port", DEFAULT_PORT);
|
int port = get_server_properties().get_int("port", DEFAULT_PORT);
|
||||||
INFO("Listening On: %i", port);
|
INFO("Listening On: %i", port);
|
||||||
Minecraft_hostMultiplayer(minecraft, port);
|
minecraft->hostMultiplayer(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open ProgressScreen
|
// Open ProgressScreen
|
||||||
ProgressScreen *screen = alloc_ProgressScreen();
|
ProgressScreen *screen = alloc_ProgressScreen();
|
||||||
ALLOC_CHECK(screen);
|
ALLOC_CHECK(screen);
|
||||||
screen = ProgressScreen_constructor(screen);
|
screen = screen->constructor();
|
||||||
Minecraft_setScreen(minecraft, (Screen *) screen);
|
minecraft->setScreen((Screen *) screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check If Running In Whitelist Mode
|
// Check If Running In Whitelist Mode
|
||||||
@ -156,7 +156,7 @@ static RakNet_RakNetGUID get_rak_net_guid(Player *player) {
|
|||||||
}
|
}
|
||||||
static RakNet_SystemAddress get_system_address(RakNet_RakPeer *rak_peer, RakNet_RakNetGUID guid) {
|
static RakNet_SystemAddress get_system_address(RakNet_RakPeer *rak_peer, RakNet_RakNetGUID guid) {
|
||||||
// Get SystemAddress
|
// Get SystemAddress
|
||||||
return rak_peer->vtable->GetSystemAddressFromGuid(rak_peer, guid);
|
return rak_peer->GetSystemAddressFromGuid(guid);
|
||||||
}
|
}
|
||||||
static RakNet_RakPeer *get_rak_peer(Minecraft *minecraft) {
|
static RakNet_RakPeer *get_rak_peer(Minecraft *minecraft) {
|
||||||
return minecraft->rak_net_instance->peer;
|
return minecraft->rak_net_instance->peer;
|
||||||
@ -164,7 +164,7 @@ static RakNet_RakPeer *get_rak_peer(Minecraft *minecraft) {
|
|||||||
static char *get_rak_net_guid_ip(RakNet_RakPeer *rak_peer, RakNet_RakNetGUID guid) {
|
static char *get_rak_net_guid_ip(RakNet_RakPeer *rak_peer, RakNet_RakNetGUID guid) {
|
||||||
RakNet_SystemAddress address = get_system_address(rak_peer, guid);
|
RakNet_SystemAddress address = get_system_address(rak_peer, guid);
|
||||||
// Get IP
|
// Get IP
|
||||||
return RakNet_SystemAddress_ToString(&address, false, '|');
|
return address.ToString(false, '|');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get IP From Player
|
// Get IP From Player
|
||||||
@ -199,7 +199,7 @@ static void ban_callback(Minecraft *minecraft, std::string username, Player *pla
|
|||||||
|
|
||||||
// Kill Player
|
// Kill Player
|
||||||
static void kill_callback(__attribute__((unused)) Minecraft *minecraft, __attribute__((unused)) std::string username, Player *player) {
|
static void kill_callback(__attribute__((unused)) Minecraft *minecraft, __attribute__((unused)) std::string username, Player *player) {
|
||||||
player->vtable->hurt(player, nullptr, INT32_MAX);
|
player->hurt(nullptr, INT32_MAX);
|
||||||
INFO("Killed: %s", username.c_str());
|
INFO("Killed: %s", username.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,9 +215,9 @@ static void handle_server_stop(Minecraft *minecraft) {
|
|||||||
// Save And Exit
|
// Save And Exit
|
||||||
Level *level = get_level(minecraft);
|
Level *level = get_level(minecraft);
|
||||||
if (level != nullptr) {
|
if (level != nullptr) {
|
||||||
Level_saveLevelData(level);
|
level->saveLevelData();
|
||||||
}
|
}
|
||||||
Minecraft_leaveGame(minecraft, false);
|
minecraft->leaveGame(false);
|
||||||
// Stop Game
|
// Stop Game
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_QUIT;
|
event.type = SDL_QUIT;
|
||||||
@ -325,7 +325,7 @@ static void handle_commands(Minecraft *minecraft) {
|
|||||||
char *safe_message = to_cp437(message.c_str());
|
char *safe_message = to_cp437(message.c_str());
|
||||||
std::string cpp_string = safe_message;
|
std::string cpp_string = safe_message;
|
||||||
// Post Message To Chat
|
// Post Message To Chat
|
||||||
ServerSideNetworkHandler_displayGameMessage(server_side_network_handler, &cpp_string);
|
server_side_network_handler->displayGameMessage(&cpp_string);
|
||||||
// Free
|
// Free
|
||||||
free(safe_message);
|
free(safe_message);
|
||||||
} else if (data == list_command) {
|
} else if (data == list_command) {
|
||||||
@ -373,7 +373,7 @@ static void Minecraft_update_injection(Minecraft *minecraft) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle --only-generate
|
// Handle --only-generate
|
||||||
if (only_generate && Minecraft_isLevelGenerated(minecraft)) {
|
if (only_generate && minecraft->isLevelGenerated()) {
|
||||||
// Request Exit
|
// Request Exit
|
||||||
compat_request_exit();
|
compat_request_exit();
|
||||||
// Disable Special Behavior After Requesting Exit
|
// Disable Special Behavior After Requesting Exit
|
||||||
@ -438,7 +438,7 @@ static bool RakNet_RakPeer_IsBanned_injection(__attribute__((unused)) RakNet_Rak
|
|||||||
// Log IPs
|
// Log IPs
|
||||||
static Player *ServerSideNetworkHandler_onReady_ClientGeneration_ServerSideNetworkHandler_popPendingPlayer_injection(ServerSideNetworkHandler *server_side_network_handler, RakNet_RakNetGUID *guid) {
|
static Player *ServerSideNetworkHandler_onReady_ClientGeneration_ServerSideNetworkHandler_popPendingPlayer_injection(ServerSideNetworkHandler *server_side_network_handler, RakNet_RakNetGUID *guid) {
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
Player *player = ServerSideNetworkHandler_popPendingPlayer(server_side_network_handler, guid);
|
Player *player = server_side_network_handler->popPendingPlayer(guid);
|
||||||
|
|
||||||
// Check If Player Is Null
|
// Check If Player Is Null
|
||||||
if (player != nullptr) {
|
if (player != nullptr) {
|
||||||
@ -594,3 +594,4 @@ void init_server() {
|
|||||||
set_and_print_env("MCPI_RENDER_DISTANCE", "Tiny");
|
set_and_print_env("MCPI_RENDER_DISTANCE", "Tiny");
|
||||||
set_and_print_env("MCPI_USERNAME", get_motd().c_str());
|
set_and_print_env("MCPI_USERNAME", get_motd().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,3 +35,4 @@ bool ServerProperties::get_bool(std::string const& name, std::string const& def)
|
|||||||
}
|
}
|
||||||
return is_true(def);
|
return is_true(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,8 +35,8 @@ static void LocalPlayer_openTextEdit_injection(LocalPlayer *local_player, TileEn
|
|||||||
Minecraft *minecraft = local_player->minecraft;
|
Minecraft *minecraft = local_player->minecraft;
|
||||||
TextEditScreen *screen = alloc_TextEditScreen();
|
TextEditScreen *screen = alloc_TextEditScreen();
|
||||||
ALLOC_CHECK(screen);
|
ALLOC_CHECK(screen);
|
||||||
screen = TextEditScreen_constructor(screen, (SignTileEntity *) sign);
|
screen = screen->constructor((SignTileEntity *) sign);
|
||||||
Minecraft_setScreen(minecraft, (Screen *) screen);
|
minecraft->setScreen((Screen *) screen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,3 +55,4 @@ void init_sign() {
|
|||||||
// Handle Backspace
|
// Handle Backspace
|
||||||
overwrite_calls(Common_sdl_key_to_minecraft_key, sdl_key_to_minecraft_key_injection);
|
overwrite_calls(Common_sdl_key_to_minecraft_key, sdl_key_to_minecraft_key_injection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,3 +142,4 @@ void _init_skin_loader() {
|
|||||||
// Log
|
// Log
|
||||||
DEBUG("Skin Server: %s", get_skin_server().c_str());
|
DEBUG("Skin Server: %s", get_skin_server().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ static int32_t Textures_loadAndBindTexture_injection(Textures *textures, __attri
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
return Textures_loadAndBindTexture(textures, &new_texture);
|
return textures->loadAndBindTexture(&new_texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
@ -95,3 +95,4 @@ void init_skin() {
|
|||||||
_init_skin_loader();
|
_init_skin_loader();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,3 +377,4 @@ void _sound_resolve_all() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,3 +125,4 @@ void init_sound() {
|
|||||||
overwrite_calls(SoundEngine_init, SoundEngine_init_injection);
|
overwrite_calls(SoundEngine_init, SoundEngine_init_injection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,3 +20,4 @@ void run_tests() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
TextInputBox *TextInputBox::create(const std::string &placeholder, const std::string &text) {
|
TextInputBox *TextInputBox::create(const std::string &placeholder, const std::string &text) {
|
||||||
// Construct
|
// Construct
|
||||||
TextInputBox *self = new TextInputBox;
|
TextInputBox *self = new TextInputBox;
|
||||||
GuiComponent_constructor(&self->super);
|
self->super.constructor();
|
||||||
|
|
||||||
// Setup
|
// Setup
|
||||||
self->m_xPos = 0;
|
self->m_xPos = 0;
|
||||||
@ -111,7 +111,7 @@ void TextInputBox::keyPressed(int key) {
|
|||||||
|
|
||||||
void TextInputBox::tick() {
|
void TextInputBox::tick() {
|
||||||
if (!m_lastFlashed) {
|
if (!m_lastFlashed) {
|
||||||
m_lastFlashed = Common_getTimeMs();
|
m_lastFlashed = Common::getTimeMs();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_bFocused) {
|
if (m_bFocused) {
|
||||||
@ -131,7 +131,7 @@ void TextInputBox::setFocused(bool b) {
|
|||||||
|
|
||||||
m_bFocused = b;
|
m_bFocused = b;
|
||||||
if (b) {
|
if (b) {
|
||||||
m_lastFlashed = Common_getTimeMs();
|
m_lastFlashed = Common::getTimeMs();
|
||||||
m_bCursorOn = true;
|
m_bCursorOn = true;
|
||||||
m_insertHead = int(m_text.size());
|
m_insertHead = int(m_text.size());
|
||||||
recalculateScroll();
|
recalculateScroll();
|
||||||
@ -176,8 +176,8 @@ static std::string get_rendered_text(Font *font, int width, int scroll_pos, std:
|
|||||||
static char CURSOR_CHAR = '_';
|
static char CURSOR_CHAR = '_';
|
||||||
|
|
||||||
void TextInputBox::render() {
|
void TextInputBox::render() {
|
||||||
GuiComponent_fill(&super, m_xPos, m_yPos, m_xPos + m_width, m_yPos + m_height, 0xFFAAAAAA);
|
super.fill(m_xPos, m_yPos, m_xPos + m_width, m_yPos + m_height, 0xFFAAAAAA);
|
||||||
GuiComponent_fill(&super, m_xPos + 1, m_yPos + 1, m_xPos + m_width - 1, m_yPos + m_height - 1, 0xFF000000);
|
super.fill(m_xPos + 1, m_yPos + 1, m_xPos + m_width - 1, m_yPos + m_height - 1, 0xFF000000);
|
||||||
|
|
||||||
int text_color;
|
int text_color;
|
||||||
int scroll_pos;
|
int scroll_pos;
|
||||||
@ -194,17 +194,17 @@ void TextInputBox::render() {
|
|||||||
rendered_text = get_rendered_text(m_pFont, m_width, scroll_pos, rendered_text);
|
rendered_text = get_rendered_text(m_pFont, m_width, scroll_pos, rendered_text);
|
||||||
|
|
||||||
int textYPos = (m_height - 8) / 2;
|
int textYPos = (m_height - 8) / 2;
|
||||||
GuiComponent_drawString(&super, m_pFont, &rendered_text, m_xPos + PADDING, m_yPos + textYPos, text_color);
|
super.drawString(m_pFont, &rendered_text, m_xPos + PADDING, m_yPos + textYPos, text_color);
|
||||||
|
|
||||||
if (m_bCursorOn) {
|
if (m_bCursorOn) {
|
||||||
int cursor_pos = m_insertHead - m_scrollPos;
|
int cursor_pos = m_insertHead - m_scrollPos;
|
||||||
if (cursor_pos >= 0 && cursor_pos <= int(rendered_text.length())) {
|
if (cursor_pos >= 0 && cursor_pos <= int(rendered_text.length())) {
|
||||||
std::string substr = rendered_text.substr(0, cursor_pos);
|
std::string substr = rendered_text.substr(0, cursor_pos);
|
||||||
int xPos = PADDING + Font_width(m_pFont, &substr);
|
int xPos = PADDING + m_pFont->width(&substr);
|
||||||
|
|
||||||
std::string str;
|
std::string str;
|
||||||
str += CURSOR_CHAR;
|
str += CURSOR_CHAR;
|
||||||
GuiComponent_drawString(&super, m_pFont, &str, m_xPos + xPos, m_yPos + textYPos + 2, 0xffffff);
|
super.drawString(m_pFont, &str, m_xPos + xPos, m_yPos + textYPos + 2, 0xffffff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -297,3 +297,4 @@ bool TextInputBox::isFocused() {
|
|||||||
void TextInputBox::setMaxLength(int max_length) {
|
void TextInputBox::setMaxLength(int max_length) {
|
||||||
m_maxLength = max_length;
|
m_maxLength = max_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,3 +54,4 @@ void TextInputScreen::setup(Screen_vtable *vtable) {
|
|||||||
delete self->m_textInputs;
|
delete self->m_textInputs;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,3 +21,4 @@ void init_textures() {
|
|||||||
// Disable Texture Loading
|
// Disable Texture Loading
|
||||||
overwrite_virtual_calls(AppPlatform_linux_loadTexture, AppPlatform_linux_loadTexture_injection);
|
overwrite_virtual_calls(AppPlatform_linux_loadTexture, AppPlatform_linux_loadTexture_injection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ static DynamicTexture *create_lava_texture() {
|
|||||||
// Construct
|
// Construct
|
||||||
LavaTexture *texture = new LavaTexture;
|
LavaTexture *texture = new LavaTexture;
|
||||||
ALLOC_CHECK(texture);
|
ALLOC_CHECK(texture);
|
||||||
DynamicTexture_constructor(&texture->super, Tile_lava->texture);
|
texture->super.constructor(Tile_lava->texture);
|
||||||
// Set VTable
|
// Set VTable
|
||||||
texture->super.vtable = get_lava_texture_vtable();
|
texture->super.vtable = get_lava_texture_vtable();
|
||||||
// Setup
|
// Setup
|
||||||
@ -146,7 +146,7 @@ static DynamicTexture *create_lava_side_texture() {
|
|||||||
// Construct
|
// Construct
|
||||||
LavaSideTexture *texture = new LavaSideTexture;
|
LavaSideTexture *texture = new LavaSideTexture;
|
||||||
ALLOC_CHECK(texture);
|
ALLOC_CHECK(texture);
|
||||||
DynamicTexture_constructor(&texture->super, Tile_lava->texture + 1);
|
texture->super.constructor(Tile_lava->texture + 1);
|
||||||
// Set VTable
|
// Set VTable
|
||||||
texture->super.vtable = get_lava_side_texture_vtable();
|
texture->super.vtable = get_lava_side_texture_vtable();
|
||||||
// Setup
|
// Setup
|
||||||
@ -189,7 +189,7 @@ CUSTOM_VTABLE(fire_texture, DynamicTexture) {
|
|||||||
uint32_t x;
|
uint32_t x;
|
||||||
uint8_t b[4];
|
uint8_t b[4];
|
||||||
} a;
|
} a;
|
||||||
a.x = Random_genrand_int32(&self->m_random);
|
a.x = self->m_random.genrand_int32();
|
||||||
self->m_data2[i + j * 16] = 0.2f + (((a.b[3] / 256.0f) * 0.1f) + ((((a.b[0] / 256.0f) * (a.b[1] / 256.0f)) * (a.b[2] / 256.0f)) * 4.0f));
|
self->m_data2[i + j * 16] = 0.2f + (((a.b[3] / 256.0f) * 0.1f) + ((((a.b[0] / 256.0f) * (a.b[1] / 256.0f)) * (a.b[2] / 256.0f)) * 4.0f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -214,11 +214,11 @@ static DynamicTexture *create_fire_texture(int a2) {
|
|||||||
// Construct
|
// Construct
|
||||||
FireTexture *texture = new FireTexture;
|
FireTexture *texture = new FireTexture;
|
||||||
ALLOC_CHECK(texture);
|
ALLOC_CHECK(texture);
|
||||||
DynamicTexture_constructor(&texture->super, Tile_fire->texture + (16 * a2));
|
texture->super.constructor(Tile_fire->texture + (16 * a2));
|
||||||
// Set VTable
|
// Set VTable
|
||||||
texture->super.vtable = get_fire_texture_vtable();
|
texture->super.vtable = get_fire_texture_vtable();
|
||||||
// Setup Random
|
// Setup Random
|
||||||
int seed = Common_getTimeMs();
|
int seed = Common::getTimeMs();
|
||||||
texture->m_random.seed = seed;
|
texture->m_random.seed = seed;
|
||||||
texture->m_random.param_1 = 0x271;
|
texture->m_random.param_1 = 0x271;
|
||||||
texture->m_random.param_2 = false;
|
texture->m_random.param_2 = false;
|
||||||
@ -238,17 +238,17 @@ static bool animated_fire = false;
|
|||||||
static void Textures_addDynamicTexture_injection(Textures *textures, DynamicTexture *dynamic_texture) {
|
static void Textures_addDynamicTexture_injection(Textures *textures, DynamicTexture *dynamic_texture) {
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
if (animated_water) {
|
if (animated_water) {
|
||||||
Textures_addDynamicTexture(textures, dynamic_texture);
|
textures->addDynamicTexture(dynamic_texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add Lava
|
// Add Lava
|
||||||
if (animated_lava) {
|
if (animated_lava) {
|
||||||
Textures_addDynamicTexture(textures, create_lava_texture());
|
textures->addDynamicTexture(create_lava_texture());
|
||||||
Textures_addDynamicTexture(textures, create_lava_side_texture());
|
textures->addDynamicTexture(create_lava_side_texture());
|
||||||
}
|
}
|
||||||
if (animated_fire) {
|
if (animated_fire) {
|
||||||
Textures_addDynamicTexture(textures, create_fire_texture(0));
|
textures->addDynamicTexture(create_fire_texture(0));
|
||||||
Textures_addDynamicTexture(textures, create_fire_texture(1));
|
textures->addDynamicTexture(create_fire_texture(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,3 +259,4 @@ void _init_textures_lava(bool animated_water_param, bool animated_lava_param, bo
|
|||||||
animated_fire = animated_fire_param;
|
animated_fire = animated_fire_param;
|
||||||
overwrite_call((void *) 0x170b4, (void *) Textures_addDynamicTexture_injection);
|
overwrite_call((void *) 0x170b4, (void *) Textures_addDynamicTexture_injection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ static void Minecraft_tick_injection(Minecraft *minecraft) {
|
|||||||
// Tick Dynamic Textures
|
// Tick Dynamic Textures
|
||||||
Textures *textures = minecraft->textures;
|
Textures *textures = minecraft->textures;
|
||||||
if (textures != nullptr) {
|
if (textures != nullptr) {
|
||||||
Textures_tick(textures, true);
|
textures->tick(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,3 +236,4 @@ void init_textures() {
|
|||||||
// Load Textures
|
// Load Textures
|
||||||
overwrite_virtual_calls(AppPlatform_linux_loadTexture, AppPlatform_linux_loadTexture_injection);
|
overwrite_virtual_calls(AppPlatform_linux_loadTexture, AppPlatform_linux_loadTexture_injection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ static void StartMenuScreen_render_Screen_renderBackground_injection(Screen *scr
|
|||||||
Minecraft *minecraft = screen->minecraft;
|
Minecraft *minecraft = screen->minecraft;
|
||||||
Textures *textures = minecraft->textures;
|
Textures *textures = minecraft->textures;
|
||||||
std::string texture = "gui/titleBG.png";
|
std::string texture = "gui/titleBG.png";
|
||||||
Textures_loadAndBindTexture(textures, &texture);
|
textures->loadAndBindTexture(&texture);
|
||||||
screen->blit(0, 0, 0, 0, screen->width, screen->height, 0x100, 0x100);
|
screen->blit(0, 0, 0, 0, screen->width, screen->height, 0x100, 0x100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,9 +99,9 @@ static void StartMenuScreen_render_Screen_render_injection(Screen *screen, int x
|
|||||||
glTranslatef(splash_x, splash_y, 0.0f);
|
glTranslatef(splash_x, splash_y, 0.0f);
|
||||||
glRotatef(-20.0f, 0.0f, 0.0f, 1.0f);
|
glRotatef(-20.0f, 0.0f, 0.0f, 1.0f);
|
||||||
// Scale
|
// Scale
|
||||||
int textWidth = Font_width(screen->font, ¤t_splash);
|
int textWidth = screen->font->width(¤t_splash);
|
||||||
float timeMS = float(Common_getTimeMs() % 1000) / 1000.0f;
|
float timeMS = float(Common_getTimeMs() % 1000) / 1000.0f;
|
||||||
float scale = max_scale - Mth_abs(0.1f * Mth_sin(2.0f * float(M_PI) * timeMS));
|
float scale = max_scale - Mth::abs(0.1f * Mth::sin(2.0f * float(M_PI) * timeMS));
|
||||||
float real_text_width = textWidth * max_scale;
|
float real_text_width = textWidth * max_scale;
|
||||||
if (real_text_width > max_width) {
|
if (real_text_width > max_width) {
|
||||||
scale *= max_width / real_text_width;
|
scale *= max_width / real_text_width;
|
||||||
@ -166,3 +166,4 @@ void init_title_screen() {
|
|||||||
srand(time(nullptr));
|
srand(time(nullptr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,8 +19,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;
|
||||||
@ -38,25 +38,24 @@ static void LargeImageButton_render_GuiComponent_drawCenteredString_injection(Gu
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
GuiComponent_drawCenteredString(component, font, text, x, y, color);
|
component->drawCenteredString(font, text, x, y, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create Button
|
// Create Button
|
||||||
int touch_gui = 0;
|
int touch_gui = 0;
|
||||||
Button *touch_create_button(int id, std::string text) {
|
template <typename T>
|
||||||
Button *button = nullptr;
|
static Button *create_button(T *(*allocator)(), int id, std::string text) {
|
||||||
if (touch_gui) {
|
T *button = allocator();
|
||||||
button = (Button *) new Touch_TButton;
|
|
||||||
} else {
|
|
||||||
button = new Button;
|
|
||||||
}
|
|
||||||
ALLOC_CHECK(button);
|
ALLOC_CHECK(button);
|
||||||
|
button->constructor(id, &text);
|
||||||
|
return (Button *) button;
|
||||||
|
}
|
||||||
|
Button *touch_create_button(int id, std::string text) {
|
||||||
if (touch_gui) {
|
if (touch_gui) {
|
||||||
Touch_TButton_constructor((Touch_TButton *) button, id, &text);
|
return create_button(alloc_Touch_TButton, id, text);
|
||||||
} else {
|
} else {
|
||||||
Button_constructor(button, id, &text);
|
return create_button(alloc_Button, id, text);
|
||||||
}
|
}
|
||||||
return button;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init
|
// Init
|
||||||
@ -107,3 +106,4 @@ void init_touch() {
|
|||||||
unsigned char outline_patch[4] = {(unsigned char) (block_outlines ? !touch_gui : touch_gui), 0x00, 0x50, 0xe3}; // "cmp r0, #0x1" or "cmp r0, #0x0"
|
unsigned char outline_patch[4] = {(unsigned char) (block_outlines ? !touch_gui : touch_gui), 0x00, 0x50, 0xe3}; // "cmp r0, #0x1" or "cmp r0, #0x0"
|
||||||
patch((void *) 0x4a210, outline_patch);
|
patch((void *) 0x4a210, outline_patch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,3 +35,4 @@ void init_version() {
|
|||||||
// Log
|
// Log
|
||||||
INFO("Starting Minecraft: Pi Edition (%s)", version_get());
|
INFO("Starting Minecraft: Pi Edition (%s)", version_get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user