Open Source AutoSprint C++ DLL Minecraft

axes444

Gold Üye
Katılım
17 Ara 2020
Mesajlar
226
Beğeniler
47
1.8.9 üzerinde çalışıyor, bunun için jni'ye ihtiyacınız var.

dllmain.cpp


C++:
#include <Windows.h>
#include "Java.h"
#include "Cheat.h"

void initialise()
{
    jsize count;

    if (JNI_GetCreatedJavaVMs(&ct.vm, 1, &count) != JNI_OK || count == 0)
        return;

    jint rest = ct.vm->GetEnv((void**)&ct.env, JNI_VERSION_1_6);

    if (rest == JNI_EDETACHED)
        rest = ct.vm->AttachCurrentThread((void**)&ct.env, nullptr);

    if (ct.env != nullptr)
        runModules();
}

BOOL APIENTRY DllMain(
    HMODULE hModule,
    DWORD ul_reason_for_call,
    LPVOID lpReserved)
{
    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
        CreateThread(0, 0, (LPTHREAD_START_ROUTINE)initialise, 0, 0, 0);
        break;
    case DLL_THREAD_ATTACH:
    case DLL_THREAD_DETACH:
    case DLL_PROCESS_DETACH:
        break;
    }
    return TRUE;
}

Cheat.cpp


C++:
#include "Cheat.h"
#include "Java.h"
#include <thread>
#include <chrono>

cheat ct;

jclass getMinecraftClass()
{
    return ct.env->FindClass("ave");
}

jobject getMinecraft()
{
    jmethodID getMinecraftMethod = ct.env->GetStaticMethodID(getMinecraftClass(), "A", "()Lave;");
    return ct.env->CallStaticObjectMethod(getMinecraftClass(), getMinecraftMethod);
}

jobject getWorld()
{
    jfieldID getWorldField = ct.env->GetFieldID(getMinecraftClass(), "f", "Lbdb;");
    return ct.env->GetObjectField(getMinecraftClass(), getWorldField);
}

jobject getPlayer()
{
    jfieldID getPlayerField = ct.env->GetFieldID(getMinecraftClass(), "h", "Lbew;");
    return ct.env->GetObjectField(getMinecraft(), getPlayerField);
}

void setPlayerSprint()
{
    jmethodID setSprintingMethod = ct.env->GetMethodID(ct.env->GetObjectClass(getPlayer()), "d", "(Z)V");

    ct.env->CallBooleanMethod(getPlayer(), setSprintingMethod, true);
}

void runModules()
{
    while (true)
    {
        jobject minecraft = getMinecraft();
        if (minecraft == nullptr) continue;

        jobject world = getWorld();
        if (world == nullptr) continue;

        jobject player = getPlayer();
        if (player == nullptr) continue;

        setPlayerSprint();

        std::this_thread::sleep_for(std::chrono::milliseconds(5));
    }
}

cheat.h

Kod:
void runModules();

Java.h

Kod:
#ifndef CHEAT_H
#define CHEAT_H

#include "JNI/jni.h"

class cheat
{
public:
    JavaVM* vm;
    JNIEnv* env;

    JavaVMInitArgs args;
};

extern cheat ct;

#endif
 

  Şuanda konuyu görüntüleyen kullanıcılar


Üst Alt