Use New Method Call Style
Some checks failed
CI / Build (ARM64, Client) (push) Waiting to run
CI / Build (ARM64, Server) (push) Waiting to run
CI / Build (ARMHF, Client) (push) Waiting to run
CI / Build (ARMHF, Server) (push) Waiting to run
CI / Test (Client) (push) Waiting to run
CI / Test (Server) (push) Waiting to run
CI / Build Example Mods (push) Waiting to run
CI / Release (push) Blocked by required conditions
CI / Build (AMD64, Client) (push) Has been cancelled
CI / Build (AMD64, Server) (push) Has been cancelled
Some checks failed
CI / Build (ARM64, Client) (push) Waiting to run
CI / Build (ARM64, Server) (push) Waiting to run
CI / Build (ARMHF, Client) (push) Waiting to run
CI / Build (ARMHF, Server) (push) Waiting to run
CI / Test (Client) (push) Waiting to run
CI / Test (Server) (push) Waiting to run
CI / Build Example Mods (push) Waiting to run
CI / Release (push) Blocked by required conditions
CI / Build (AMD64, Client) (push) Has been cancelled
CI / Build (AMD64, Server) (push) Has been cancelled
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);
|
||||
#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) \
|
||||
static name##_t _original_for_##target = start; \
|
||||
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
|
||||
#define _check_if_method_is_new(name) \
|
||||
{ \
|
||||
if (!__is_new_method_##name()) { \
|
||||
ERR("Method Is Not \"New\""); \
|
||||
} \
|
||||
}
|
||||
#define overwrite_virtual_calls(start, target) \
|
||||
{ \
|
||||
_check_if_method_is_new(start); \
|
||||
|
@ -15,10 +15,10 @@ static void ItemRenderer_renderGuiItemCorrect_injection(ItemRenderer_renderGuiIt
|
||||
bool use_carried = false;
|
||||
if (item_instance != nullptr) {
|
||||
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;
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
@ -64,12 +64,12 @@ static void Tesselator_begin_injection(Tesselator_begin_t original, Tesselator *
|
||||
// Fix Furnace UI
|
||||
if (item_color_fix_mode != 0) {
|
||||
// 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) {
|
||||
// Call Original Method
|
||||
Tesselator_color(tesselator, r, g, b, 0xff);
|
||||
tesselator->color(r, g, b, 0xff);
|
||||
|
||||
// Enable Item Color Fix
|
||||
item_color_fix_mode = 2;
|
||||
@ -86,7 +86,7 @@ static void FurnaceScreen_render_ItemRenderer_renderGuiItem_one_injection(Font *
|
||||
item_color_fix_mode = 1;
|
||||
|
||||
// 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
|
||||
@ -107,3 +107,4 @@ void init_atlas() {
|
||||
overwrite_call((void *) 0x1e21c, (void *) InventoryPane_renderBatch_Tesselator_color_injection);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,18 +32,18 @@ static void start_world(Minecraft *minecraft) {
|
||||
settings.seed = BENCHMARK_SEED;
|
||||
|
||||
// Delete World If It Already Exists
|
||||
LevelStorageSource *level_source = Minecraft_getLevelSource(minecraft);
|
||||
LevelStorageSource *level_source = minecraft->getLevelSource();
|
||||
std::string name = BENCHMARK_WORLD_NAME;
|
||||
level_source->vtable->deleteLevel(level_source, &name);
|
||||
level_source->deleteLevel(&name);
|
||||
|
||||
// Select Level
|
||||
minecraft->vtable->selectLevel(minecraft, &name, &name, &settings);
|
||||
minecraft->selectLevel(&name, &name, &settings);
|
||||
|
||||
// Open ProgressScreen
|
||||
ProgressScreen *screen = alloc_ProgressScreen();
|
||||
ALLOC_CHECK(screen);
|
||||
screen = ProgressScreen_constructor(screen);
|
||||
Minecraft_setScreen(minecraft, (Screen *) screen);
|
||||
screen = screen->constructor();
|
||||
minecraft->setScreen((Screen *) screen);
|
||||
}
|
||||
|
||||
// Track Frames
|
||||
@ -93,7 +93,7 @@ static void Minecraft_update_injection(Minecraft *minecraft) {
|
||||
}
|
||||
|
||||
// Detect World Loaded
|
||||
if (!world_loaded && Minecraft_isLevelGenerated(minecraft)) {
|
||||
if (!world_loaded && minecraft->isLevelGenerated()) {
|
||||
world_loaded = 1;
|
||||
world_loaded_time = get_time();
|
||||
#ifndef MCPI_HEADLESS_MODE
|
||||
@ -171,3 +171,4 @@ void init_benchmark() {
|
||||
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.auxiliary = new_auxiliary;
|
||||
Inventory *inventory = player->inventory;
|
||||
if (inventory->vtable->add(inventory, &new_item)) {
|
||||
if (inventory->add(&new_item)) {
|
||||
// Added To Inventory
|
||||
success = true;
|
||||
item_instance->count -= 1;
|
||||
@ -62,7 +62,7 @@ static int32_t BucketItem_useOn(__attribute__((unused)) FoodItem *item, ItemInst
|
||||
} else if (item_instance->auxiliary == 0) {
|
||||
// Empty Bucket
|
||||
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) {
|
||||
new_auxiliary = Tile_water->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) {
|
||||
// Valid
|
||||
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;
|
||||
} else {
|
||||
return 0;
|
||||
@ -110,15 +110,15 @@ static int32_t BucketItem_useOn(__attribute__((unused)) FoodItem *item, ItemInst
|
||||
}
|
||||
// Get Current Tile
|
||||
bool valid = false;
|
||||
Material *material = level->vtable->getMaterial(level, x, y, z);
|
||||
Material *material = level->getMaterial(x, y, z);
|
||||
if (material != nullptr) {
|
||||
valid = !material->vtable->isSolid(material);
|
||||
valid = !material->isSolid();
|
||||
}
|
||||
if (item_instance->auxiliary != Tile_water->id && item_instance->auxiliary != Tile_lava->id) {
|
||||
valid = false;
|
||||
}
|
||||
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;
|
||||
return 1;
|
||||
} else {
|
||||
@ -188,14 +188,14 @@ static FoodItem *create_bucket(int32_t id, int32_t texture_x, int32_t texture_y,
|
||||
// Construct
|
||||
FoodItem *item = alloc_FoodItem();
|
||||
ALLOC_CHECK(item);
|
||||
Item_constructor((Item *) item, id);
|
||||
Item_constructor((Item *) item, id); // FoodItem's Constructor Was Inlined
|
||||
|
||||
// Set VTable
|
||||
item->vtable = get_bucket_vtable();
|
||||
|
||||
// Setup
|
||||
item->vtable->setIcon(item, texture_x, texture_y);
|
||||
item->vtable->setDescriptionId(item, &name);
|
||||
item->setIcon(texture_x, texture_y);
|
||||
item->setDescriptionId(&name);
|
||||
item->is_stacked_by_data = 1;
|
||||
item->category = 2;
|
||||
item->max_damage = 0;
|
||||
@ -224,7 +224,7 @@ static int32_t ItemInstance_getMaxStackSize_injection(ItemInstance_getMaxStackSi
|
||||
|
||||
// Milking
|
||||
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) {
|
||||
// Fill with milk
|
||||
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) {
|
||||
ItemInstance *item_instance = new ItemInstance;
|
||||
ALLOC_CHECK(item_instance);
|
||||
item_instance = ItemInstance_constructor_item_extra(item_instance, (Item *) item, 1, auxiliary);
|
||||
FillingContainer_addItem(inventory, item_instance);
|
||||
item_instance = item_instance->constructor_item_extra((Item *) item, 1, auxiliary);
|
||||
inventory->addItem(item_instance);
|
||||
}
|
||||
static void Inventory_setupDefault_FillingContainer_addItem_call_injection(FillingContainer *filling_container) {
|
||||
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 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
|
||||
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) {
|
||||
LocalPlayer *player = minecraft->player;
|
||||
@ -261,7 +261,7 @@ static void handle_tick(Minecraft *minecraft) {
|
||||
Inventory *inventory = player->inventory;
|
||||
|
||||
// Get Item
|
||||
ItemInstance *inventory_item = inventory->vtable->getItem(inventory, selected_slot);
|
||||
ItemInstance *inventory_item = inventory->getItem(selected_slot);
|
||||
// Check
|
||||
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 y = minecraft->hit_result.y;
|
||||
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)) {
|
||||
can_destroy = false;
|
||||
}
|
||||
@ -315,7 +315,7 @@ static void Recipes_injection(Recipes *recipes) {
|
||||
std::string line1 = "# #";
|
||||
std::string line2 = " # ";
|
||||
std::vector<Recipes_Type> types = {type1};
|
||||
Recipes_addShapedRecipe_2(recipes, &result, &line1, &line2, &types);
|
||||
recipes->addShapedRecipe_2(&result, &line1, &line2, &types);
|
||||
}
|
||||
|
||||
// Custom Furnace Fuel
|
||||
@ -372,3 +372,4 @@ void init_bucket() {
|
||||
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) {
|
||||
// Eaten face
|
||||
if (face == 3) {
|
||||
int data = level->vtable->getData(level, x, y, z);
|
||||
int data = level->getData(x, y, z);
|
||||
if (data != 0 && data < 6) {
|
||||
// Sliced texture
|
||||
return 123;
|
||||
@ -59,8 +59,7 @@ static bool Cake_isCubeShaped(__attribute__((unused)) Tile *tile) {
|
||||
// Size
|
||||
static void Cake_updateDefaultShape(Tile *tile) {
|
||||
// Set the default shape
|
||||
tile->vtable->setShape(
|
||||
tile,
|
||||
tile->setShape(
|
||||
CAKE_LEN, 0.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) {
|
||||
// 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;
|
||||
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) {
|
||||
// Set cake
|
||||
int data = level->vtable->getData(level, x, y, z);
|
||||
int data = level->getData(x, y, z);
|
||||
if (data >= 6) data = 0;
|
||||
// Get slice amount
|
||||
float slice_size = (1.0 / 7.0) * (float) data;
|
||||
tile->vtable->setShape(
|
||||
tile,
|
||||
tile->setShape(
|
||||
CAKE_LEN, 0.0, CAKE_LEN,
|
||||
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
|
||||
static int Cake_use(__attribute__((unused)) Tile *tile, Level *level, int x, int y, int z, Player *player) {
|
||||
// Eat
|
||||
SimpleFoodData_eat(&player->foodData, 3);
|
||||
player->foodData.eat(3);
|
||||
// Set the new tile
|
||||
int data = level->vtable->getData(level, x, y, z);
|
||||
int data = level->getData(x, y, z);
|
||||
if (data >= 5) {
|
||||
// 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 {
|
||||
// Remove a slice
|
||||
Level_setTileAndData(level, x, y, z, 92, data + 1);
|
||||
level->setTileAndData(x, y, z, 92, data + 1);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -121,7 +119,7 @@ static void make_cake() {
|
||||
cake = alloc_Tile();
|
||||
ALLOC_CHECK(cake);
|
||||
int texture = 122;
|
||||
Tile_constructor(cake, 92, texture, Material_dirt);
|
||||
cake->constructor(92, texture, Material_dirt);
|
||||
cake->texture = texture;
|
||||
|
||||
// Set VTable
|
||||
@ -129,8 +127,7 @@ static void make_cake() {
|
||||
ALLOC_CHECK(cake->vtable);
|
||||
|
||||
// Set shape
|
||||
cake->vtable->setShape(
|
||||
cake,
|
||||
cake->setShape(
|
||||
CAKE_LEN, 0.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;
|
||||
|
||||
// Init
|
||||
Tile_init(cake);
|
||||
cake->vtable->setDestroyTime(cake, 1.0f);
|
||||
cake->vtable->setExplodeable(cake, 20.0f);
|
||||
cake->init();
|
||||
cake->setDestroyTime(1.0f);
|
||||
cake->setExplodeable(20.0f);
|
||||
cake->category = 4;
|
||||
std::string name = "Cake";
|
||||
cake->vtable->setDescriptionId(cake, &name);
|
||||
cake->setDescriptionId(&name);
|
||||
}
|
||||
|
||||
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->auxiliary = 0;
|
||||
cake_instance->id = 92;
|
||||
FillingContainer_addItem(filling_container, cake_instance);
|
||||
filling_container->addItem(cake_instance);
|
||||
}
|
||||
|
||||
// Recipe (only when buckets are enabled)
|
||||
@ -227,7 +224,7 @@ static void Recipes_injection(Recipes *recipes) {
|
||||
std::string line2 = "ses";
|
||||
std::string line3 = "www";
|
||||
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() {
|
||||
@ -241,3 +238,4 @@ void init_cake() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@ static EntityRenderDispatcher *EntityRenderDispatcher_injection(EntityRenderDisp
|
||||
// Register TripodCameraRenderer
|
||||
TripodCameraRenderer *renderer = alloc_TripodCameraRenderer();
|
||||
ALLOC_CHECK(renderer);
|
||||
TripodCameraRenderer_constructor(renderer);
|
||||
EntityRenderDispatcher_assign(dispatcher, (unsigned char) 0x5, (EntityRenderer *) renderer);
|
||||
renderer->constructor();
|
||||
dispatcher->assign((unsigned char) 0x5, (EntityRenderer *) renderer);
|
||||
|
||||
return dispatcher;
|
||||
}
|
||||
@ -30,7 +30,7 @@ static EntityRenderDispatcher *EntityRenderDispatcher_injection(EntityRenderDisp
|
||||
// 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) {
|
||||
// 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
|
||||
@ -46,3 +46,4 @@ void init_camera() {
|
||||
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;
|
||||
CommandServer *command_server = minecraft->command_server;
|
||||
if (command_server != nullptr) {
|
||||
return CommandServer_parse(command_server, &client, &str);
|
||||
return command_server->parse(&client, &str);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
@ -43,19 +43,19 @@ void chat_send_message(ServerSideNetworkHandler *server_side_network_handler, ch
|
||||
sanitize_string(&full_message, MAX_CHAT_MESSAGE_LENGTH, 0);
|
||||
std::string cpp_string = full_message;
|
||||
free(full_message);
|
||||
ServerSideNetworkHandler_displayGameMessage(server_side_network_handler, &cpp_string);
|
||||
server_side_network_handler->displayGameMessage(&cpp_string);
|
||||
}
|
||||
// Handle Chat packet Send
|
||||
void chat_handle_packet_send(Minecraft *minecraft, ChatPacket *packet) {
|
||||
RakNetInstance *rak_net_instance = minecraft->rak_net_instance;
|
||||
if (rak_net_instance->vtable->isServer(rak_net_instance)) {
|
||||
if (rak_net_instance->isServer()) {
|
||||
// Hosting Multiplayer
|
||||
const char *message = packet->message.c_str();
|
||||
ServerSideNetworkHandler *server_side_network_handler = (ServerSideNetworkHandler *) minecraft->network_handler;
|
||||
chat_send_message(server_side_network_handler, Strings_default_username, (char *) message);
|
||||
} else {
|
||||
// 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
|
||||
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) {
|
||||
const char *username = player->username.c_str();
|
||||
const char *message = chat_packet->message.c_str();
|
||||
@ -99,3 +99,4 @@ void init_chat() {
|
||||
patch((void *) 0x6b4c0, message_limit_patch);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,15 +51,15 @@ CUSTOM_VTABLE(chat_screen, Screen) {
|
||||
is_in_chat = false;
|
||||
ChatScreen *self = (ChatScreen *) super;
|
||||
delete self->chat;
|
||||
self->send->vtable->destructor_deleting(self->send);
|
||||
self->send->destructor_deleting();
|
||||
};
|
||||
// Rendering
|
||||
static Screen_render_t original_render = vtable->render;
|
||||
vtable->render = [](Screen *super, int x, int y, float param_1) {
|
||||
// Background
|
||||
super->vtable->renderBackground(super);
|
||||
super->renderBackground();
|
||||
// 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
|
||||
original_render(super, x, y, param_1);
|
||||
};
|
||||
@ -91,7 +91,7 @@ CUSTOM_VTABLE(chat_screen, Screen) {
|
||||
}
|
||||
_chat_send_message(super->minecraft, text.c_str());
|
||||
}
|
||||
Minecraft_setScreen(super->minecraft, nullptr);
|
||||
super->minecraft->setScreen(nullptr);
|
||||
} else if (key == 0x26) {
|
||||
// Up
|
||||
local_history.at(self->history_pos) = self->chat->getText();
|
||||
@ -120,7 +120,7 @@ CUSTOM_VTABLE(chat_screen, Screen) {
|
||||
if (button == self->send) {
|
||||
// Send
|
||||
self->chat->setFocused(true);
|
||||
super->vtable->keyPressed(super, 0x0d);
|
||||
super->keyPressed(0x0d);
|
||||
} else {
|
||||
// Call Original Method
|
||||
original_buttonClicked(super, button);
|
||||
@ -131,7 +131,7 @@ static Screen *create_chat_screen() {
|
||||
// Construct
|
||||
ChatScreen *screen = new ChatScreen;
|
||||
ALLOC_CHECK(screen);
|
||||
Screen_constructor(&screen->super.super);
|
||||
screen->super.super.constructor();
|
||||
|
||||
// Set 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) {
|
||||
if (key == 0x54) {
|
||||
if (Minecraft_isLevelGenerated(minecraft) && minecraft->screen == nullptr) {
|
||||
Minecraft_setScreen(minecraft, create_chat_screen());
|
||||
minecraft->setScreen(create_chat_screen());
|
||||
}
|
||||
return true;
|
||||
} 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 *) 0x12624, (void *) do_nothing); // vc_dispmanx_update_submit_sync
|
||||
}
|
||||
|
||||
|
@ -140,3 +140,4 @@ void compat_request_exit() {
|
||||
// Request
|
||||
exit_requested = 1;
|
||||
}
|
||||
|
||||
|
@ -38,3 +38,4 @@ void _patch_egl_calls() {
|
||||
patch((void *) 0x12504, nop_patch); // eglDestroySurface #2
|
||||
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 *) 0x132d4, (void *) XTranslateCoordinates_injection); // XTranslateCoordinates
|
||||
}
|
||||
|
||||
|
@ -11,14 +11,14 @@
|
||||
static void inventory_add_item(FillingContainer *inventory, Item *item) {
|
||||
ItemInstance *item_instance = new ItemInstance;
|
||||
ALLOC_CHECK(item_instance);
|
||||
item_instance = ItemInstance_constructor_item(item_instance, item);
|
||||
FillingContainer_addItem(inventory, item_instance);
|
||||
item_instance = item_instance->constructor_item(item);
|
||||
inventory->addItem(item_instance);
|
||||
}
|
||||
static void inventory_add_item(FillingContainer *inventory, Tile *item) {
|
||||
ItemInstance *item_instance = new ItemInstance;
|
||||
ALLOC_CHECK(item_instance);
|
||||
item_instance = ItemInstance_constructor_tile(item_instance, item);
|
||||
FillingContainer_addItem(inventory, item_instance);
|
||||
item_instance = item_instance->constructor_tile(item);
|
||||
inventory->addItem(item_instance);
|
||||
}
|
||||
|
||||
// Expand Creative Inventory
|
||||
@ -36,8 +36,8 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli
|
||||
}
|
||||
ItemInstance *new_item_instance = new ItemInstance;
|
||||
ALLOC_CHECK(new_item_instance);
|
||||
new_item_instance = ItemInstance_constructor_item_extra(new_item_instance, Item_dye_powder, 1, i);
|
||||
FillingContainer_addItem(filling_container, new_item_instance);
|
||||
new_item_instance = new_item_instance->constructor_item_extra(Item_dye_powder, 1, i);
|
||||
filling_container->addItem(new_item_instance);
|
||||
}
|
||||
inventory_add_item(filling_container, Item_camera);
|
||||
// Add Tiles
|
||||
@ -61,8 +61,8 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli
|
||||
}
|
||||
ItemInstance *new_item_instance = new ItemInstance;
|
||||
ALLOC_CHECK(new_item_instance);
|
||||
new_item_instance = ItemInstance_constructor_tile_extra(new_item_instance, Tile_netherReactor, 1, i);
|
||||
FillingContainer_addItem(filling_container, new_item_instance);
|
||||
new_item_instance = new_item_instance->constructor_tile_extra(Tile_netherReactor, 1, i);
|
||||
filling_container->addItem(new_item_instance);
|
||||
}
|
||||
// Tall Grass
|
||||
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;
|
||||
ALLOC_CHECK(new_item_instance);
|
||||
new_item_instance = ItemInstance_constructor_tile_extra(new_item_instance, Tile_tallgrass, 1, i);
|
||||
FillingContainer_addItem(filling_container, new_item_instance);
|
||||
new_item_instance = new_item_instance->constructor_tile_extra(Tile_tallgrass, 1, i);
|
||||
filling_container->addItem(new_item_instance);
|
||||
}
|
||||
// Smooth Stone Slab
|
||||
{
|
||||
ItemInstance *new_item_instance = new ItemInstance;
|
||||
ALLOC_CHECK(new_item_instance);
|
||||
new_item_instance = ItemInstance_constructor_tile_extra(new_item_instance, Tile_stoneSlab, 1, 6);
|
||||
FillingContainer_addItem(filling_container, new_item_instance);
|
||||
new_item_instance = new_item_instance->constructor_tile_extra(Tile_stoneSlab, 1, 6);
|
||||
filling_container->addItem(new_item_instance);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -88,7 +88,7 @@ static void Inventory_setupDefault_FillingContainer_addItem_call_injection(Filli
|
||||
// Hook Specific TileItem Constructor
|
||||
static TileItem *Tile_initTiles_TileItem_injection(TileItem *tile_item, int32_t id) {
|
||||
// Call Original Method
|
||||
TileItem_constructor(tile_item, id);
|
||||
tile_item->constructor(id);
|
||||
|
||||
// Switch VTable
|
||||
tile_item->vtable = (TileItem_vtable *) AuxDataTileItem_vtable_base;
|
||||
@ -173,3 +173,4 @@ void init_creative() {
|
||||
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;
|
||||
if (cause) {
|
||||
// Entity cause
|
||||
int type_id = cause->vtable->getEntityTypeId(cause);
|
||||
int aux = cause->vtable->getAuxData(cause);
|
||||
bool is_player = cause->vtable->isPlayer(cause);
|
||||
if (cause->vtable->getCreatureBaseType(cause) != 0 || is_player) {
|
||||
int type_id = cause->getEntityTypeId();
|
||||
int aux = cause->getAuxData();
|
||||
bool is_player = cause->isPlayer();
|
||||
if (cause->getCreatureBaseType() != 0 || is_player) {
|
||||
// Killed by a creature
|
||||
if (was_shot) {
|
||||
message += " was shot by ";
|
||||
@ -38,12 +38,12 @@ std::string get_death_message(Player *player, Entity *cause, bool was_shot = fal
|
||||
} else if (aux) {
|
||||
// Killed by a throwable with owner
|
||||
Level *level = player->level;
|
||||
Entity *shooter = Level_getEntity(level, aux);
|
||||
Entity *shooter = level->getEntity(aux);
|
||||
return get_death_message(player, shooter, true);
|
||||
} else if (type_id == 65) {
|
||||
// Blown up by TNT
|
||||
return message + " was blown apart";
|
||||
} else if (cause->vtable->isHangingEntity(cause)) {
|
||||
} else if (cause->isHangingEntity()) {
|
||||
// Painting?
|
||||
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 */ \
|
||||
RakNetInstance *rak_net_instance = player->minecraft->rak_net_instance; \
|
||||
/* Only Run On Server-Side */ \
|
||||
if (rak_net_instance->vtable->isServer(rak_net_instance)) { \
|
||||
if (rak_net_instance->isServer()) { \
|
||||
/* Get Death Message */ \
|
||||
std::string message = get_death_message((Player *) player, cause); \
|
||||
\
|
||||
/* Post Death Message */ \
|
||||
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) \
|
||||
@ -105,7 +105,7 @@ static bool Mob_hurt_injection(Mob_hurt_t original, Mob *mob, Entity *source, in
|
||||
/* Get Variables */ \
|
||||
RakNetInstance *rak_net_instance = player->minecraft->rak_net_instance; \
|
||||
/* Only Run On Server-Side */ \
|
||||
if (rak_net_instance->vtable->isServer(rak_net_instance)) { \
|
||||
if (rak_net_instance->isServer()) { \
|
||||
/* Check Health */ \
|
||||
if (new_health < 1 && old_health >= 1) { \
|
||||
/* Get Death Message */ \
|
||||
@ -113,7 +113,7 @@ static bool Mob_hurt_injection(Mob_hurt_t original, Mob *mob, Entity *source, in
|
||||
\
|
||||
/* Post Death Message */ \
|
||||
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]"
|
||||
patch((void *) 0x8799c, ldr_r0_24_patch);
|
||||
}
|
||||
|
||||
|
@ -27,3 +27,4 @@ bool _feature_has(const char *name) {
|
||||
// Return
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -52,3 +52,4 @@ void init_fps() {
|
||||
misc_run_on_tick(print_fps);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,3 +76,4 @@ void init_game_mode() {
|
||||
patch((void *) 0x6dc70, server_patch);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,9 +70,9 @@ CUSTOM_VTABLE(create_world_screen, Screen) {
|
||||
CreateWorldScreen *self = (CreateWorldScreen *) super;
|
||||
delete self->name;
|
||||
delete self->seed;
|
||||
self->game_mode->vtable->destructor_deleting(self->game_mode);
|
||||
self->back->vtable->destructor_deleting(self->back);
|
||||
self->create->vtable->destructor_deleting(self->create);
|
||||
self->game_mode->destructor_deleting();
|
||||
self->back->destructor_deleting();
|
||||
self->create->destructor_deleting();
|
||||
};
|
||||
// Rendering
|
||||
static Screen_render_t original_render = vtable->render;
|
||||
@ -125,7 +125,7 @@ CUSTOM_VTABLE(create_world_screen, Screen) {
|
||||
// ESC
|
||||
vtable->handleBackEvent = [](Screen *super, bool do_nothing) {
|
||||
if (!do_nothing) {
|
||||
ScreenChooser_setScreen(&super->minecraft->screen_chooser, 5);
|
||||
super->minecraft->screen_chooser.setScreen(5);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
@ -138,7 +138,7 @@ CUSTOM_VTABLE(create_world_screen, Screen) {
|
||||
self->game_mode->text = is_creative ? SURVIVAL_STR : CREATIVE_STR;
|
||||
} else if (button == self->back) {
|
||||
// Back
|
||||
super->vtable->handleBackEvent(super, false);
|
||||
super->handleBackEvent(false);
|
||||
} else if (button == self->create) {
|
||||
// Create
|
||||
create_world(super->minecraft, self->name->getText(), is_creative, self->seed->getText());
|
||||
@ -149,7 +149,7 @@ static Screen *create_create_world_screen() {
|
||||
// Construct
|
||||
CreateWorldScreen *screen = new CreateWorldScreen;
|
||||
ALLOC_CHECK(screen);
|
||||
Screen_constructor(&screen->super.super);
|
||||
screen->super.super.constructor();
|
||||
|
||||
// Set 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) {
|
||||
std::set<std::string> maps;
|
||||
std::vector<LevelSummary> vls;
|
||||
source->vtable->getLevelList(source, &vls);
|
||||
source->getLevelList(&vls);
|
||||
for (int i = 0; i < int(vls.size()); i++) {
|
||||
const LevelSummary &ls = vls[i];
|
||||
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) {
|
||||
// Get Seed
|
||||
int seed;
|
||||
seed_str = Util_stringTrim(&seed_str);
|
||||
seed_str = Util::stringTrim(&seed_str);
|
||||
if (!seed_str.empty()) {
|
||||
int num;
|
||||
if (sscanf(seed_str.c_str(), "%d", &num) > 0) {
|
||||
seed = num;
|
||||
} else {
|
||||
seed = Util_hashCode(&seed_str);
|
||||
seed = Util::hashCode(&seed_str);
|
||||
}
|
||||
} else {
|
||||
seed = Common_getEpochTimeS();
|
||||
seed = Common::getEpochTimeS();
|
||||
}
|
||||
|
||||
// Get Folder Name
|
||||
name = Util_stringTrim(&name);
|
||||
name = Util::stringTrim(&name);
|
||||
std::string folder = "";
|
||||
for (char c : name) {
|
||||
if (
|
||||
@ -221,16 +221,16 @@ static void create_world(Minecraft *minecraft, std::string name, bool is_creativ
|
||||
settings.seed = seed;
|
||||
|
||||
// Create World
|
||||
minecraft->vtable->selectLevel(minecraft, &folder, &name, &settings);
|
||||
minecraft->selectLevel(&folder, &name, &settings);
|
||||
|
||||
// Multiplayer
|
||||
Minecraft_hostMultiplayer(minecraft, 19132);
|
||||
minecraft->hostMultiplayer(19132);
|
||||
|
||||
// Open ProgressScreen
|
||||
ProgressScreen *screen = alloc_ProgressScreen();
|
||||
ALLOC_CHECK(screen);
|
||||
screen = ProgressScreen_constructor(screen);
|
||||
Minecraft_setScreen(minecraft, (Screen *) screen);
|
||||
screen = screen->constructor();
|
||||
minecraft->setScreen((Screen *) screen);
|
||||
}
|
||||
|
||||
// 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) { \
|
||||
if (screen->should_create_world) { \
|
||||
/* Open Screen */ \
|
||||
Minecraft_setScreen(screen->minecraft, create_create_world_screen()); \
|
||||
screen->minecraft->setScreen(create_create_world_screen()); \
|
||||
/* Finish */ \
|
||||
screen->should_create_world = false; \
|
||||
} else { \
|
||||
@ -254,4 +254,4 @@ void _init_game_mode_ui() {
|
||||
// Hijack Create World Button
|
||||
overwrite_virtual_calls(SelectWorldScreen_tick, SelectWorldScreen_tick_injection);
|
||||
overwrite_virtual_calls(Touch_SelectWorldScreen_tick, Touch_SelectWorldScreen_tick_injection);
|
||||
}
|
||||
}
|
||||
|
@ -31,3 +31,4 @@ void init_home() {
|
||||
unsigned char nop_patch[4] = {0x00, 0xf0, 0x20, 0xe3}; // "nop"
|
||||
patch((void *) 0xe0ac, nop_patch);
|
||||
}
|
||||
|
||||
|
@ -40,3 +40,4 @@ __attribute__((constructor)) static void init() {
|
||||
init_benchmark();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ static int32_t MouseBuildInput_tickBuild_injection(MouseBuildInput_tickBuild_t o
|
||||
static bool last_player_attack_successful = false;
|
||||
static bool Player_attack_Entity_hurt_injection(Entity *entity, Entity *attacker, int32_t damage) {
|
||||
// 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;
|
||||
}
|
||||
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
|
||||
return Inventory_getSelected(inventory);
|
||||
return inventory->getSelected();
|
||||
}
|
||||
|
||||
// Init
|
||||
@ -63,3 +63,4 @@ void _init_attack() {
|
||||
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;
|
||||
LocalPlayer *player = minecraft->player;
|
||||
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);
|
||||
input_run_on_tick(_handle_bow);
|
||||
}
|
||||
|
||||
|
@ -18,8 +18,8 @@ static void _handle_open_crafting(Minecraft *minecraft) {
|
||||
if (!creative_is_restricted() || !Minecraft_isCreativeMode(minecraft)) {
|
||||
WorkbenchScreen *screen = alloc_WorkbenchScreen();
|
||||
ALLOC_CHECK(screen);
|
||||
screen = WorkbenchScreen_constructor(screen, 0);
|
||||
Minecraft_setScreen(minecraft, (Screen *) screen);
|
||||
screen = screen->constructor(0);
|
||||
minecraft->setScreen((Screen *) screen);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -28,3 +28,4 @@ static void _handle_open_crafting(Minecraft *minecraft) {
|
||||
void _init_crafting() {
|
||||
input_run_on_tick(_handle_open_crafting);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ static void _handle_drop(Minecraft *minecraft) {
|
||||
Inventory *inventory = player->inventory;
|
||||
|
||||
// Get Item
|
||||
ItemInstance *inventory_item = inventory->vtable->getItem(inventory, selected_slot);
|
||||
ItemInstance *inventory_item = inventory->getItem(selected_slot);
|
||||
// Check
|
||||
if (inventory_item != nullptr && inventory_item->count > 0) {
|
||||
// Copy
|
||||
@ -64,7 +64,7 @@ static void _handle_drop(Minecraft *minecraft) {
|
||||
}
|
||||
|
||||
// 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);
|
||||
input_run_on_tick(_handle_drop);
|
||||
}
|
||||
|
||||
|
@ -57,3 +57,4 @@ void init_input() {
|
||||
media_set_raw_mouse_motion_enabled(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ static void _handle_back(Minecraft *minecraft) {
|
||||
}
|
||||
// Send Event
|
||||
for (int i = 0; i < back_button_presses; i++) {
|
||||
minecraft->vtable->handleBack(minecraft, 0);
|
||||
minecraft->handleBack(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) {
|
||||
if (!do_nothing) {
|
||||
Minecraft *minecraft = screen->minecraft;
|
||||
Minecraft_setScreen(minecraft, nullptr);
|
||||
minecraft->setScreen(nullptr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -48,11 +48,11 @@ static bool InBedScreen_handleBackEvent_injection(InBedScreen *screen, bool do_n
|
||||
if (!do_nothing) {
|
||||
// Close Screen
|
||||
Minecraft *minecraft = screen->minecraft;
|
||||
Minecraft_setScreen(minecraft, nullptr);
|
||||
minecraft->setScreen(nullptr);
|
||||
// Stop Sleeping
|
||||
LocalPlayer *player = minecraft->player;
|
||||
if (player != nullptr) {
|
||||
player->vtable->stopSleepInBed(player, 1, 1, 1);
|
||||
player->stopSleepInBed(1, 1, 1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -68,10 +68,10 @@ void input_set_mouse_grab_state(int state) {
|
||||
static void _handle_mouse_grab(Minecraft *minecraft) {
|
||||
if (mouse_grab_state == -1) {
|
||||
// Grab
|
||||
Minecraft_grabMouse(minecraft);
|
||||
minecraft->grabMouse();
|
||||
} else if (mouse_grab_state == 1) {
|
||||
// Un-Grab
|
||||
Minecraft_releaseMouse(minecraft);
|
||||
minecraft->releaseMouse();
|
||||
}
|
||||
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;
|
||||
if (!enable_misc || (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_OFF && is_in_game)) {
|
||||
// Call Original Method
|
||||
return creative_is_restricted() && Minecraft_isCreativeMode(minecraft);
|
||||
return creative_is_restricted() && minecraft->isCreativeMode();
|
||||
} else {
|
||||
// Disable Item Drop Ticking
|
||||
return 1;
|
||||
@ -115,3 +115,4 @@ void _init_misc() {
|
||||
input_run_on_tick(_handle_back);
|
||||
input_run_on_tick(_handle_mouse_grab);
|
||||
}
|
||||
|
||||
|
@ -97,3 +97,4 @@ void _init_toggle() {
|
||||
overwrite_calls(ParticleEngine_render, ParticleEngine_render_injection);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ SETUP_CALLBACK(creative_inventory_setup, FillingContainer);
|
||||
// Handle Custom Creative Inventory Setup Behavior
|
||||
static void Inventory_setupDefault_FillingContainer_addItem_call_injection(FillingContainer *filling_container, ItemInstance *item_instance) {
|
||||
// Call Original Method
|
||||
FillingContainer_addItem(filling_container, item_instance);
|
||||
filling_container->addItem(item_instance);
|
||||
|
||||
// Run Functions
|
||||
handle_misc_creative_inventory_setup(filling_container);
|
||||
@ -183,3 +183,4 @@ void _init_misc_api() {
|
||||
// Handle Key Presses
|
||||
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 const char *last_message = nullptr;
|
||||
static void print_progress(Minecraft *minecraft) {
|
||||
const char *message = Minecraft_getProgressMessage(minecraft);
|
||||
const char *message = minecraft->getProgressMessage();
|
||||
int32_t progress = minecraft->progress;
|
||||
if (Minecraft_isLevelGenerated(minecraft)) {
|
||||
message = "Ready";
|
||||
@ -97,3 +97,4 @@ void _init_misc_logging() {
|
||||
// Disable stdout Buffering
|
||||
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;
|
||||
|
||||
Inventory *inventory = gui->minecraft->player->inventory;
|
||||
ItemInstance *held_ii = Inventory_getSelected(inventory);
|
||||
ItemInstance *held_ii = inventory->getSelected();
|
||||
if (held_ii) {
|
||||
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 cur_health = gui->minecraft->player->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;
|
||||
float scale = ((float) screen_width) * Gui_InvGuiScale;
|
||||
// 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
|
||||
@ -235,7 +235,7 @@ static void LoginPacket_read_injection(LoginPacket_read_t original, LoginPacket
|
||||
ALLOC_CHECK(new_username);
|
||||
sanitize_string(&new_username, MAX_USERNAME_LENGTH, 0);
|
||||
// Set New Username
|
||||
RakNet_RakString_Assign(rak_string, new_username);
|
||||
rak_string->Assign(new_username);
|
||||
// Free
|
||||
free(new_username);
|
||||
}
|
||||
@ -272,7 +272,7 @@ static const char *RAKNET_ERROR_NAMES[] = {
|
||||
#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) {
|
||||
// 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
|
||||
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) {
|
||||
// Close Screen
|
||||
Minecraft *minecraft = entity->minecraft;
|
||||
Minecraft_setScreen(minecraft, nullptr);
|
||||
minecraft->setScreen(nullptr);
|
||||
|
||||
// Call Original Method
|
||||
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) {
|
||||
// Get Existing Item
|
||||
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
|
||||
int valid;
|
||||
@ -349,11 +349,11 @@ static void GameRenderer_render_injection(GameRenderer_render_t original, GameRe
|
||||
// Fix GL Mode
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||