zhuowei / MCPELauncher

Source code for BlockLauncher, a launcher that patches Minecraft for Android
Apache License 2.0
670 stars 193 forks source link

How did you find out the method to unlock Mojang scripting? #1511

Closed TripleCamera closed 2 years ago

TripleCamera commented 3 years ago

Hi, zhuowei. I am trying to unlock Mojang scripting in 1.16, and I have studied your code:

static bool bl_AppPlatform_supportsScripting_hook(void* self) {
    __android_log_print(ANDROID_LOG_ERROR, "BlockLauncher", "scripting hook");
    return true;
}
static bool (*bl_ScriptEngine_isScriptingEnabled_real)();
static bool bl_ScriptEngine_isScriptingEnabled_hook() {
    bool realret = bl_ScriptEngine_isScriptingEnabled_real();
    //__android_log_print(ANDROID_LOG_ERROR, "BlockLauncher", "script engine hook: overriding %s with true", realret? "true" : "false");
    //v8Init();
    return true;
}
static bool (*bl_FeatureToggles_isEnabled_real)(void* toggles, int id);
static bool bl_FeatureToggles_isEnabled_hook(void* toggles, int id) {
    //__android_log_print(ANDROID_LOG_ERROR, "BlockLauncher", "feature enabled? %d", id);
    if (id == 9) return true;
    if (id == 7) return true;
    return bl_FeatureToggles_isEnabled_real(toggles, id);
}

static bool bl_hbui_Feature_isEnabled_hook(void* feature) {
    //__android_log_print(ANDROID_LOG_ERROR, "BlockLauncher", "hbui feature enabled");
    return true;
}

I wonder how you found out the way of unlocking Mojang scripting. How did you find out these 4 functions to hook? And why did you enable feature 9 and 7?
By the way, is there anything I should pay attention to in 1.16? Do I have to edit that code to make it work properly? Thanks.

Andrea-Miele commented 3 years ago

@zhuowei Yes how did you unlock? @zhuowei

TripleCamera commented 3 years ago

@zhuowei I have hooked a lot of functions, so that all these functions always return true now:

Now I can enter worlds with scripts, but the scripts are not working. I don't know what is missing. Could you help me?

Andrea-Miele commented 3 years ago

@zhuowei I know you're not working on this project anymore, but at least give the necessary information for making a new similar project like Modded BE

TripleCamera commented 3 years ago

@ zhuowei I know you're not working on this project anymore, but at least give the necessary information for making a new similar project like Modded BE

Maybe we shouldn't @ him so many times... He is probably busy these days.

zhuowei commented 3 years ago

I do keep an eye on these issues, and no, hooking those methods was enough on 1.13 and below, not sure what changed.

JRBros2346 commented 2 years ago

@TripleCamera if you developed the app please post the link here i can use it

TripleCamera commented 2 years ago

Well, actually, Mojang has removed Scripting(aka Additional Modding Capabilities) in Beta 1.18.20.21. I guess there is no need to keep this issue open, so I will close it very soon.

@ TripleCamera if you developed the app please post the link here i can use it

I don't think it is polite to promote my app here. You can check out my profile for more info.

TripleCamera commented 2 years ago

I'm going to close it now. The issue list is so crowded.