diff --git a/HotSpot/HotSpot.cpp b/HotSpot/HotSpot.cpp index a7deeb8..aa4955a 100644 --- a/HotSpot/HotSpot.cpp +++ b/HotSpot/HotSpot.cpp @@ -528,6 +528,27 @@ unsigned short* HotSpot::Method::get_flags() return (unsigned short*)((uint8_t*)this + vm_entry->offset); } +void HotSpot::Method::set_dont_inline(bool enabled) +{ + unsigned short* _flags = get_flags(); + if (!_flags) + { + static VMStructEntry* vm_entry = find_VMStructEntry("Method", "_intrinsic_id", false); + if (!vm_entry) return; + unsigned char* flags = ((uint8_t*)this + vm_entry->offset + 1); + if (enabled) + *flags |= (1 << 4); + else + *flags &= ~(1 << 4); + return; + } + + if (enabled) + *_flags |= _dont_inline; + else + *_flags &= ~_dont_inline; +} + int HotSpot::Thread::get_thread_state_offset() { static VMStructEntry* vm_entry = find_VMStructEntry("JavaThread", "_thread_state", false); diff --git a/HotSpot/HotSpot.hpp b/HotSpot/HotSpot.hpp index 6faf3d3..b551d6c 100644 --- a/HotSpot/HotSpot.hpp +++ b/HotSpot/HotSpot.hpp @@ -206,6 +206,7 @@ namespace HotSpot void set_from_compiled_entry(void* entry); void* get_i2i_entry(); unsigned short* get_flags(); + void set_dont_inline(bool enabled); }; struct Array diff --git a/README.md b/README.md index 7f55309..45b0da6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# RiptermsGhost +# RiptermsGhost An example injectable cheat for minecraft using java native interface, jvmti, java method hooking, and constant pool editing. @@ -16,7 +16,7 @@ Any question ? Contact me on discord: lefraudeur ### Supported versions : x64 windows only. Because of the way ripterms hooks java methods, it supports only some jvm versions (tested on zulu17, openjdk8, openjdk17). Please open an issue if it doesn't work on your jvm version. -- Lunar Client: 1.7.10, 1.8.9, 1.16.5, 1.17.1, 1.19.4, 1.20.4 +- 🌙Lunar Client: 1.7.10, 1.8.9, 1.16.5, 1.17.1, 1.19.4, 1.20.4 - Forge: 1.7.10 - Badlion Client: 1.8.9 - Vanilla: 1.8.9 @@ -28,7 +28,7 @@ Change mappings to add new versions - Reach (uses constant pool editing) - Left Clicker - Full Bright -- Velocity +- Velocity / VelocityPacket (uses channelRead0 event) - Client Brand Changer (modifies the getClientModName return value) (to troll staffs lol, sent to the server on login and displayed by some anticheats) - Blink (hooks and cancels addToSendQueue) - FastPlace @@ -41,6 +41,10 @@ Change mappings to add new versions - Glide - VelocityFly - Speed +- BackTrack (set the hitbox of the target to a previous position) +- AttackLag (delay received packet when attacking someone) +- NoMiss +- BlockOnAttack ![image](https://github.com/Lefraudeur/RiptermsGhost/assets/91006387/39690baa-859a-4ea2-a9b0-dfbc8cbfe472) @@ -49,17 +53,19 @@ Insert to open the gui / end key to self destruct ![image](https://github.com/Lefraudeur/RiptermsGhost/assets/73477238/0d8f6308-1036-4480-b487-eaf02d07259d) -### Event system (hook, modifiy parameters, cancel, modify return value): +### ⚓Event system (hook, modifiy parameters, cancel, modify return value): - onAddToSendQueue (edit sent packets) - onUpdateWalkingPlayer - onAttackTargetEntityWithCurrentItem +- onChannelRead0 (edit received packets) +##### ⚠java method hooking is still unreliable, and might cause crash the game on some methods -To test it, just build the project with visual studio 2022, and inject the dll using any injector (process hacker, extreme injector...). +To test it, just build the project with visual studio 2022 (compile on x64 Release config), and inject the dll using any injector (process hacker, extreme injector...). You can also take a look at RiptermsInjector: https://github.com/Lefraudeur/RiptermsInjector Help would be appreciated, this repo is here to share your knowledge with other people. You can also make suggestions. (open an issue or a pull request to dev branch) -TODO: +📃TODO: - Good world to screen, to make player and block ESP (missing w2s for 1.16.5) - Customizable key binds - Enabled modules list diff --git a/Ripterms Ghost.vcxproj b/Ripterms Ghost.vcxproj index c46045f..3f61840 100644 --- a/Ripterms Ghost.vcxproj +++ b/Ripterms Ghost.vcxproj @@ -176,6 +176,7 @@ + @@ -203,10 +204,12 @@ + + @@ -246,6 +249,7 @@ + @@ -272,10 +276,12 @@ + + diff --git a/Ripterms Ghost.vcxproj.filters b/Ripterms Ghost.vcxproj.filters index 2952eea..d5f78e3 100644 --- a/Ripterms Ghost.vcxproj.filters +++ b/Ripterms Ghost.vcxproj.filters @@ -243,6 +243,15 @@ Fichiers sources + + Fichiers sources + + + Fichiers sources + + + Fichiers sources + @@ -413,5 +422,14 @@ Fichiers d%27en-tête + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + + + Fichiers d%27en-tête + \ No newline at end of file diff --git a/Ripterms/Cache/Cache.cpp b/Ripterms/Cache/Cache.cpp index d5e3522..bafa75f 100644 --- a/Ripterms/Cache/Cache.cpp +++ b/Ripterms/Cache/Cache.cpp @@ -13,7 +13,7 @@ bool Ripterms::Cache::fillCache() return false; } thePlayer = theMinecraft.getThePlayer(); - if (!thePlayer.isValid()) + if (!thePlayer.isValid() || thePlayer.getTicksExisted() < 10) { is_valid = false; return false; diff --git a/Ripterms/GUI/GUI.cpp b/Ripterms/GUI/GUI.cpp index 11e45af..fad835a 100644 --- a/Ripterms/GUI/GUI.cpp +++ b/Ripterms/GUI/GUI.cpp @@ -76,9 +76,9 @@ static LRESULT CALLBACK detour_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARA if (msg == WM_KEYDOWN) { - for (const std::pair>& category : Ripterms::Modules::categories) + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) { - for (Ripterms::Modules::IModule* m : category.second) + for (Ripterms::Modules::IModule* m : category.modules) { m->onKeyBind(wParam); } @@ -161,9 +161,9 @@ static BOOL WINAPI detour_wglSwapBuffers(HDC unnamedParam1) ImGuiWindowFlags_NoBackground); { Ripterms::JNIFrame jni_frame(Ripterms::p_env, 30); - for (const std::pair>& category : Ripterms::Modules::categories) + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) { - for (Ripterms::Modules::IModule* m : category.second) + for (Ripterms::Modules::IModule* m : category.modules) { m->render(); } @@ -212,28 +212,29 @@ static BOOL WINAPI detour_wglSwapBuffers(HDC unnamedParam1) } ImGui::EndChild(); - static std::string current_tab = "Combat"; + static uint8_t current_category_id = 0; + constexpr uint8_t settings_id = sizeof(Ripterms::Modules::categories) / sizeof(Ripterms::Modules::Category); ImGui::SetCursorPosY(55); ImGui::BeginChild("##categories", ImVec2(100, 345), 0, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse); { ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 2.f); - for (const std::pair>& category : Ripterms::Modules::categories) + for (uint8_t i = 0; i < sizeof(Ripterms::Modules::categories) / sizeof(Ripterms::Modules::Category); ++i) { - bool is_selected = category.first == current_tab; + bool is_selected = i == current_category_id; if(is_selected) ImGui::PushStyleColor(ImGuiCol_Button, Ripterms::GUI::color_active_tab); - if (ImGui::Button(category.first.c_str(), Ripterms::GUI::category_button_size)) - current_tab = category.first; + if (ImGui::Button(Ripterms::Modules::categories[i].name, Ripterms::GUI::category_button_size)) + current_category_id = i; if (is_selected) ImGui::PopStyleColor(); } ImGui::SetCursorPos(ImVec2(0, ImGui::GetWindowSize()[1] - Ripterms::GUI::category_button_size[1])); - if (current_tab == "Settings") { ImGui::PushStyleColor(ImGuiCol_Button, Ripterms::GUI::color_active_tab); } - if (ImGui::Button("Settings", Ripterms::GUI::category_button_size)) { current_tab = "Settings"; } - if (current_tab == "Settings") { ImGui::PopStyleColor(); } + if (current_category_id == settings_id) { ImGui::PushStyleColor(ImGuiCol_Button, Ripterms::GUI::color_active_tab); } + if (ImGui::Button("Settings", Ripterms::GUI::category_button_size)) { current_category_id = settings_id; } + if (current_category_id == settings_id) { ImGui::PopStyleColor(); } ImGui::PopStyleVar(); } @@ -244,7 +245,7 @@ static BOOL WINAPI detour_wglSwapBuffers(HDC unnamedParam1) ImGui::SetCursorPosX(115); ImGui::BeginChild("##modules"); { - if (current_tab == "Settings") + if (current_category_id == settings_id) { ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2(20.0f, 0.0f)); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(250.0f, ImGui::GetStyle().FramePadding.y)); @@ -298,11 +299,11 @@ static BOOL WINAPI detour_wglSwapBuffers(HDC unnamedParam1) else { ImGui::SetCursorPos(ImVec2(4, 2)); - ImGui::Text(current_tab.c_str()); + ImGui::Text(Ripterms::Modules::categories[current_category_id].name); ImGui::Separator(); { Ripterms::JNIFrame jni_frame(Ripterms::p_env, 30); - for (Ripterms::Modules::IModule* module : Ripterms::Modules::categories[current_tab]) + for (Ripterms::Modules::IModule* module : Ripterms::Modules::categories[current_category_id].modules) { module->renderGUI(); } diff --git a/Ripterms/Hook/JavaHook.cpp b/Ripterms/Hook/JavaHook.cpp index f0dfb03..af1e572 100644 --- a/Ripterms/Hook/JavaHook.cpp +++ b/Ripterms/Hook/JavaHook.cpp @@ -30,6 +30,7 @@ void Ripterms::JavaHook::clean() } for (HookedMethod& hm : hooked_methods) { + hm.method->set_dont_inline(false); int* flags = (int*)hm.method->get_access_flags(); *flags &= ~(NO_COMPILE); } @@ -52,6 +53,9 @@ bool Ripterms::JavaHook::hook(jmethodID methodID, i2i_detour_t detour) if (hk.method == method) return true; } + + + method->set_dont_inline(true); int* flags = (int*)method->get_access_flags(); *flags |= (NO_COMPILE); @@ -61,6 +65,8 @@ bool Ripterms::JavaHook::hook(jmethodID methodID, i2i_detour_t detour) Ripterms::p_env->DeleteLocalRef(owner); method = *(HotSpot::Method**)methodID; + + method->set_dont_inline(true); flags = (int*)method->get_access_flags(); *flags |= (NO_COMPILE); @@ -148,20 +154,14 @@ void* find_correct_hook_place(void* _i2i_entry) void common_detour(HotSpot::frame* frame, HotSpot::Thread* thread, bool* cancel) { + if (!(*(void**)thread->get_env()) || thread->get_thread_state() != HotSpot::_thread_in_Java) return; for (HookedMethod& hk : hooked_methods) { if (hk.method == frame->get_method()) { - HotSpot::JavaThreadState state = thread->get_thread_state(); - if (state == HotSpot::_thread_in_Java) - thread->set_thread_state(HotSpot::_thread_in_native); - else return; - { - Ripterms::JNIFrame jni_frame(thread->get_env(), 30); - hk.detour(frame, thread, cancel); - } + hk.detour(frame, thread, cancel); thread->set_thread_state(HotSpot::_thread_in_Java); - break; + return; } } } diff --git a/Ripterms/Hook/JavaHook.h b/Ripterms/Hook/JavaHook.h index 9b112ea..b0269dd 100644 --- a/Ripterms/Hook/JavaHook.h +++ b/Ripterms/Hook/JavaHook.h @@ -8,7 +8,7 @@ namespace Ripterms::JavaHook template inline void set_return_value(bool* cancel, T return_value) { - *(T*)((void**)cancel + 8) = return_value; + *(T*)((void**)cancel + 8) = return_value; //see asm code to understand that } //param from left to right (arg0 beeing this for non static methods) diff --git a/Ripterms/Mappings/mappings_forge_1_7_10.h b/Ripterms/Mappings/mappings_forge_1_7_10.h index a6b2bbc..8ae3624 100644 --- a/Ripterms/Mappings/mappings_forge_1_7_10.h +++ b/Ripterms/Mappings/mappings_forge_1_7_10.h @@ -127,6 +127,11 @@ namespace Mappings } ] }, + "io/netty/channel/ChannelHandlerContext": { + "obfuscated": "io/netty/channel/ChannelHandlerContext", + "fields": [], + "methods": [] + }, )" R"( "net/minecraft/client/Minecraft": { @@ -371,6 +376,12 @@ R"( "obfuscated": "field_70127_C", "signature": "F", "static": false + }, + { + "name": "entityId", + "obfuscated": "field_145783_c", + "signature": "I", + "static": false } ], "methods": [ @@ -514,6 +525,12 @@ R"( "obfuscated": "BLOCK", "signature": "Lnet/minecraft/util/MovingObjectPosition$MovingObjectType;", "static": true + }, + { + "name": "MISS", + "obfuscated": "MISS", + "signature": "Lnet/minecraft/util/MovingObjectPosition$MovingObjectType;", + "static": true } ], "methods": [] @@ -751,6 +768,48 @@ R"( } ], "methods": [] + }, + "net/minecraft/network/NetworkManager": { + "obfuscated": "net/minecraft/network/NetworkManager", + "fields": [], + "methods": [ + { + "name": "channelRead0", + "obfuscated": "channelRead0", + "signature": "(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/Packet;)V", + "static": false + } + ] + }, + "net/minecraft/network/play/server/S12PacketEntityVelocity": { + "obfuscated": "net/minecraft/network/play/server/S12PacketEntityVelocity", + "fields": [ + { + "name": "entityID", + "obfuscated": "field_149417_a", + "signature": "I", + "static": false + }, + { + "name": "motionX", + "obfuscated": "field_149415_b", + "signature": "I", + "static": false + }, + { + "name": "motionY", + "obfuscated": "field_149416_c", + "signature": "I", + "static": false + }, + { + "name": "motionZ", + "obfuscated": "field_149414_d", + "signature": "I", + "static": false + } + ], + "methods": [] } } )"; diff --git a/Ripterms/Mappings/mappings_lunar_1_16_5.h b/Ripterms/Mappings/mappings_lunar_1_16_5.h index af7b62b..10a3087 100644 --- a/Ripterms/Mappings/mappings_lunar_1_16_5.h +++ b/Ripterms/Mappings/mappings_lunar_1_16_5.h @@ -127,6 +127,11 @@ namespace Mappings } ] }, + "io/netty/channel/ChannelHandlerContext": { + "obfuscated": "io/netty/channel/ChannelHandlerContext", + "fields": [], + "methods": [] + }, )" R"( "net/minecraft/client/Minecraft": { @@ -335,6 +340,12 @@ R"( "obfuscated": "xRotO", "signature": "F", "static": false + }, + { + "name": "entityId", + "obfuscated": "id", + "signature": "I", + "static": false } ], "methods": [ @@ -497,6 +508,12 @@ R"( "obfuscated": "BLOCK", "signature": "Lnet/minecraft/world/phys/HitResult$Type;", "static": true + }, + { + "name": "MISS", + "obfuscated": "MISS", + "signature": "Lnet/minecraft/world/phys/HitResult$Type;", + "static": true } ], "methods": [] @@ -733,6 +750,48 @@ R"( "fields": [], "methods": [ ] + }, + "net/minecraft/network/NetworkManager": { + "obfuscated": "net/minecraft/network/Connection", + "fields": [], + "methods": [ + { + "name": "channelRead0", + "obfuscated": "channelRead0", + "signature": "(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/protocol/Packet;)V", + "static": false + } + ] + }, + "net/minecraft/network/play/server/S12PacketEntityVelocity": { + "obfuscated": "net/minecraft/network/protocol/game/ClientboundSetEntityMotionPacket", + "fields": [ + { + "name": "entityID", + "obfuscated": "id", + "signature": "I", + "static": false + }, + { + "name": "motionX", + "obfuscated": "xa", + "signature": "I", + "static": false + }, + { + "name": "motionY", + "obfuscated": "ya", + "signature": "I", + "static": false + }, + { + "name": "motionZ", + "obfuscated": "za", + "signature": "I", + "static": false + } + ], + "methods": [] } } )"; diff --git a/Ripterms/Mappings/mappings_lunar_1_19_4.h b/Ripterms/Mappings/mappings_lunar_1_19_4.h index 2deb92f..037c72e 100644 --- a/Ripterms/Mappings/mappings_lunar_1_19_4.h +++ b/Ripterms/Mappings/mappings_lunar_1_19_4.h @@ -127,6 +127,11 @@ namespace Mappings } ] }, + "io/netty/channel/ChannelHandlerContext": { + "obfuscated": "io/netty/channel/ChannelHandlerContext", + "fields": [], + "methods": [] + }, )" R"( "net/minecraft/client/Minecraft": { @@ -335,6 +340,12 @@ R"( "obfuscated": "xRotO", "signature": "F", "static": false + }, + { + "name": "entityId", + "obfuscated": "id", + "signature": "I", + "static": false } ], "methods": [ @@ -497,6 +508,12 @@ R"( "obfuscated": "BLOCK", "signature": "Lnet/minecraft/world/phys/HitResult$Type;", "static": true + }, + { + "name": "MISS", + "obfuscated": "MISS", + "signature": "Lnet/minecraft/world/phys/HitResult$Type;", + "static": true } ], "methods": [] @@ -738,6 +755,48 @@ R"( } ], "methods": [] + }, + "net/minecraft/network/NetworkManager": { + "obfuscated": "net/minecraft/network/Connection", + "fields": [], + "methods": [ + { + "name": "channelRead0", + "obfuscated": "channelRead0", + "signature": "(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/protocol/Packet;)V", + "static": false + } + ] + }, + "net/minecraft/network/play/server/S12PacketEntityVelocity": { + "obfuscated": "net/minecraft/network/protocol/game/ClientboundSetEntityMotionPacket", + "fields": [ + { + "name": "entityID", + "obfuscated": "id", + "signature": "I", + "static": false + }, + { + "name": "motionX", + "obfuscated": "xa", + "signature": "I", + "static": false + }, + { + "name": "motionY", + "obfuscated": "ya", + "signature": "I", + "static": false + }, + { + "name": "motionZ", + "obfuscated": "za", + "signature": "I", + "static": false + } + ], + "methods": [] } } )"; diff --git a/Ripterms/Mappings/mappings_lunar_1_7_10.h b/Ripterms/Mappings/mappings_lunar_1_7_10.h index 44ffabb..a19e0cc 100644 --- a/Ripterms/Mappings/mappings_lunar_1_7_10.h +++ b/Ripterms/Mappings/mappings_lunar_1_7_10.h @@ -127,6 +127,11 @@ namespace Mappings } ] }, + "io/netty/channel/ChannelHandlerContext": { + "obfuscated": "io/netty/channel/ChannelHandlerContext", + "fields": [], + "methods": [] + }, )" R"( "net/minecraft/client/Minecraft": { @@ -371,6 +376,12 @@ R"( "obfuscated": "prevRotationPitch", "signature": "F", "static": false + }, + { + "name": "entityId", + "obfuscated": "entityId", + "signature": "I", + "static": false } ], "methods": [ @@ -514,6 +525,12 @@ R"( "obfuscated": "BLOCK", "signature": "Lnet/minecraft/util/MovingObjectPosition$MovingObjectType;", "static": true + }, + { + "name": "MISS", + "obfuscated": "MISS", + "signature": "Lnet/minecraft/util/MovingObjectPosition$MovingObjectType;", + "static": true } ], "methods": [] @@ -751,6 +768,48 @@ R"( } ], "methods": [] + }, + "net/minecraft/network/NetworkManager": { + "obfuscated": "net/minecraft/network/NetworkManager", + "fields": [], + "methods": [ + { + "name": "channelRead0", + "obfuscated": "channelRead0", + "signature": "(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/Packet;)V", + "static": false + } + ] + }, + "net/minecraft/network/play/server/S12PacketEntityVelocity": { + "obfuscated": "net/minecraft/network/play/server/S12PacketEntityVelocity", + "fields": [ + { + "name": "entityID", + "obfuscated": "field_149417_a", + "signature": "I", + "static": false + }, + { + "name": "motionX", + "obfuscated": "field_149415_b", + "signature": "I", + "static": false + }, + { + "name": "motionY", + "obfuscated": "field_149416_c", + "signature": "I", + "static": false + }, + { + "name": "motionZ", + "obfuscated": "field_149414_d", + "signature": "I", + "static": false + } + ], + "methods": [] } } )"; diff --git a/Ripterms/Mappings/mappings_lunar_1_8_9.h b/Ripterms/Mappings/mappings_lunar_1_8_9.h index cf71cff..39cbc8c 100644 --- a/Ripterms/Mappings/mappings_lunar_1_8_9.h +++ b/Ripterms/Mappings/mappings_lunar_1_8_9.h @@ -127,6 +127,11 @@ namespace Mappings } ] }, + "io/netty/channel/ChannelHandlerContext": { + "obfuscated": "io/netty/channel/ChannelHandlerContext", + "fields": [], + "methods": [] + }, )" R"( "net/minecraft/client/Minecraft": { @@ -359,6 +364,12 @@ R"( "obfuscated": "prevRotationPitch", "signature": "F", "static": false + }, + { + "name": "entityId", + "obfuscated": "entityId", + "signature": "I", + "static": false } ], "methods": [ @@ -508,6 +519,12 @@ R"( "obfuscated": "BLOCK", "signature": "Lnet/minecraft/util/MovingObjectPosition$MovingObjectType;", "static": true + }, + { + "name": "MISS", + "obfuscated": "MISS", + "signature": "Lnet/minecraft/util/MovingObjectPosition$MovingObjectType;", + "static": true } ], "methods": [] @@ -762,6 +779,48 @@ R"( } ], "methods": [] + }, + "net/minecraft/network/NetworkManager": { + "obfuscated": "net/minecraft/network/NetworkManager", + "fields": [], + "methods": [ + { + "name": "channelRead0", + "obfuscated": "channelRead0", + "signature": "(Lio/netty/channel/ChannelHandlerContext;Lnet/minecraft/network/Packet;)V", + "static": false + } + ] + }, + "net/minecraft/network/play/server/S12PacketEntityVelocity": { + "obfuscated": "net/minecraft/network/play/server/S12PacketEntityVelocity", + "fields": [ + { + "name": "entityID", + "obfuscated": "entityID", + "signature": "I", + "static": false + }, + { + "name": "motionX", + "obfuscated": "motionX", + "signature": "I", + "static": false + }, + { + "name": "motionY", + "obfuscated": "motionY", + "signature": "I", + "static": false + }, + { + "name": "motionZ", + "obfuscated": "motionZ", + "signature": "I", + "static": false + } + ], + "methods": [] } } )"; diff --git a/Ripterms/Mappings/mappings_vanilla_1_8_9.h b/Ripterms/Mappings/mappings_vanilla_1_8_9.h index ce0dce0..8040782 100644 --- a/Ripterms/Mappings/mappings_vanilla_1_8_9.h +++ b/Ripterms/Mappings/mappings_vanilla_1_8_9.h @@ -127,6 +127,11 @@ namespace Mappings } ] }, + "io/netty/channel/ChannelHandlerContext": { + "obfuscated": "io/netty/channel/ChannelHandlerContext", + "fields": [], + "methods": [] + }, )" R"( "net/minecraft/client/Minecraft": { @@ -359,6 +364,12 @@ R"( "obfuscated": "B", "signature": "F", "static": false + }, + { + "name": "entityId", + "obfuscated": "c", + "signature": "I", + "static": false } ], "methods": [ @@ -508,6 +519,12 @@ R"( "obfuscated": "b", "signature": "Lauh$a;", "static": true + }, + { + "name": "MISS", + "obfuscated": "a", + "signature": "Lauh$a;", + "static": true } ], "methods": [] @@ -761,6 +778,48 @@ R"( } ], "methods": [] + }, + "net/minecraft/network/NetworkManager": { + "obfuscated": "ek", + "fields": [], + "methods": [ + { + "name": "channelRead0", + "obfuscated": "a", + "signature": "(Lio/netty/channel/ChannelHandlerContext;Lff;)V", + "static": false + } + ] + }, + "net/minecraft/network/play/server/S12PacketEntityVelocity": { + "obfuscated": "net/minecraft/network/play/server/S12PacketEntityVelocity", + "fields": [ + { + "name": "entityID", + "obfuscated": "a", + "signature": "I", + "static": false + }, + { + "name": "motionX", + "obfuscated": "b", + "signature": "I", + "static": false + }, + { + "name": "motionY", + "obfuscated": "c", + "signature": "I", + "static": false + }, + { + "name": "motionZ", + "obfuscated": "d", + "signature": "I", + "static": false + } + ], + "methods": [] } } )"; diff --git a/Ripterms/Modules/AimAssist.cpp b/Ripterms/Modules/AimAssist.cpp index b0010a0..3eba5ef 100644 --- a/Ripterms/Modules/AimAssist.cpp +++ b/Ripterms/Modules/AimAssist.cpp @@ -28,7 +28,7 @@ void Ripterms::Modules::AimAssist::run() for (EntityPlayer& target : Ripterms::cache->playerEntities.toVector()) { - if (target.isEqualTo(cache->thePlayer)) + if (!target.isValid() || target.isEqualTo(cache->thePlayer) || target.getTicksExisted() < 10) continue; AxisAlignedBB targetBB = target.getBoundingBox(); @@ -186,7 +186,7 @@ void Ripterms::Modules::AimAssist::renderGUI() ImGui::SliderFloat("Max Distance", &max_distance, 1.0f, 6.0f, "%.1f"); ImGui::SliderFloat("Max Angle", &max_angle, 10.0f, 180.0f, "%.1f"); ImGui::SliderFloat("Multiplier Yaw", &multiplier, 0.1f, 2.0f, "%.1f"); - ImGui::SliderFloat("Multiplier Pitch", &multiplierPitch, 0.1f, 2.0f, "%.1f"); + ImGui::SliderFloat("Multiplier Pitch", &multiplierPitch, 0.0f, 2.0f, "%.1f"); ImGui::EndGroup(); } } diff --git a/Ripterms/Modules/BackTrack.cpp b/Ripterms/Modules/BackTrack.cpp index 880e33c..5a86888 100644 --- a/Ripterms/Modules/BackTrack.cpp +++ b/Ripterms/Modules/BackTrack.cpp @@ -31,16 +31,19 @@ void Ripterms::Modules::BackTrack::run() if (!timer.isElapsed()) return; + Ripterms::Maths::Vector3d thePlayerPos = Ripterms::cache->thePlayer.getPosition(); for (EntityPlayer& player : Ripterms::cache->playerEntities.toVector()) { - if (player.isEqualTo(Ripterms::cache->thePlayer)) continue; + if (!player.isValid() || player.isEqualTo(Ripterms::cache->thePlayer)) continue; + if (player.getTicksExisted() < 10 || (player.getPosition() - thePlayerPos).distance() > 6.0) continue; Ripterms::Maths::Vector3d vector = player.getMovementVector(partialTicks); AxisAlignedBB bb = player.getBoundingBox(); Ripterms::Maths::Vector3d minbb(bb.getMinX(), bb.getMinY(), bb.getMinZ()); Ripterms::Maths::Vector3d maxbb(bb.getMaxX(), bb.getMaxY(), bb.getMaxZ()); minbb = minbb - vector; maxbb = maxbb - vector; - bb.setMinX(minbb.x); bb.setMinY(minbb.y); bb.setMinZ(minbb.z); - bb.setMaxX(maxbb.x); bb.setMaxY(maxbb.y); bb.setMaxZ(maxbb.z); + + bb.setMinX(min(minbb.x, bb.getMinX())); bb.setMinY(min(minbb.y, bb.getMinY())); bb.setMinZ(min(minbb.z, bb.getMinZ())); + bb.setMaxX(max(maxbb.x, bb.getMaxX())); bb.setMaxY(max(maxbb.y, bb.getMaxY())); bb.setMaxZ(max(maxbb.z, bb.getMaxZ())); } } \ No newline at end of file diff --git a/Ripterms/Modules/Blink.cpp b/Ripterms/Modules/Blink.cpp index 2489e5f..c14d0ad 100644 --- a/Ripterms/Modules/Blink.cpp +++ b/Ripterms/Modules/Blink.cpp @@ -30,7 +30,6 @@ void Ripterms::Modules::Blink::onAddToSendQueue(JNIEnv* env, NetHandlerPlayClien sendPackets(sendQueue); return; } - Ripterms::JavaHook::set_return_value(cancel, 0); *cancel = true; packets.push_back(Packet(packet, env, true)); } diff --git a/Ripterms/Modules/Glide.cpp b/Ripterms/Modules/Glide.cpp index afad272..b78d8ea 100644 --- a/Ripterms/Modules/Glide.cpp +++ b/Ripterms/Modules/Glide.cpp @@ -2,7 +2,6 @@ void Ripterms::Modules::Glide::renderGUI() { - static bool display_options = false; ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2(20.0f, 0.0f)); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(250.0f, ImGui::GetStyle().FramePadding.y)); ImGui::Checkbox("Glide", &enabled); diff --git a/Ripterms/Modules/HitBoxes.cpp b/Ripterms/Modules/HitBoxes.cpp index 2866d53..6ea0c5f 100644 --- a/Ripterms/Modules/HitBoxes.cpp +++ b/Ripterms/Modules/HitBoxes.cpp @@ -29,12 +29,15 @@ void Ripterms::Modules::HitBoxes::run() if (!enabled || !timer.isElapsed()) return; - Ripterms::Maths::Vector3d thePlayer_position = cache->thePlayer.getPosition(); + Ripterms::Maths::Vector3d thePlayerPos = Ripterms::cache->thePlayer.getPosition(); for (EntityPlayer& target : cache->playerEntities.toVector()) { + if (!target.isValid()) continue; if (target.isEqualTo(cache->thePlayer)) continue; + if (target.getTicksExisted() < 10 || (target.getPosition() - thePlayerPos).distance() > 6.0) continue; + AxisAlignedBB target_bb = target.getBoundingBox(); if diff --git a/Ripterms/Modules/Modules.cpp b/Ripterms/Modules/Modules.cpp index 573ec4a..b39d8c5 100644 --- a/Ripterms/Modules/Modules.cpp +++ b/Ripterms/Modules/Modules.cpp @@ -3,6 +3,7 @@ #include #include "../../net/minecraft/network/play/client/C03PacketPlayer/C03PacketPlayer.h" #include "../Hook/JavaHook.h" +#include "../../net/minecraft/network/play/server/S12PacketEntityVelocity/S12PacketEntityVelocity.h" void Ripterms::Modules::IModule::run() { @@ -41,6 +42,14 @@ void Ripterms::Modules::IModule::onGetClientModName(JNIEnv* env, bool* cancel) { } +void Ripterms::Modules::IModule::onChannelRead0(JNIEnv* env, NetworkManager& this_networkManager, ChannelHandlerContext& context, Packet& packet, bool* cancel) +{ +} + +void Ripterms::Modules::IModule::onClickMouse(JNIEnv* env, Minecraft& theMinecraft, bool* cancel) +{ +} + void Ripterms::Modules::IModule::onKeyBind(int keyBind) { if (!keyBind || keyBind != this->keyBind) return; @@ -53,13 +62,14 @@ static void addToSendQueue_callback(HotSpot::frame* frame, HotSpot::Thread* thre if (Ripterms::Modules::IModule::onAddToSendQueueNoEvent) return; JNIEnv* env = thread->get_env(); - NetHandlerPlayClient sendQueue(Ripterms::JavaHook::get_jobject_param_at(frame, 0), env); - Packet packet(Ripterms::JavaHook::get_jobject_param_at(frame, 1), env); + NetHandlerPlayClient sendQueue(Ripterms::JavaHook::get_jobject_param_at(frame, 0), env, true); + Packet packet(Ripterms::JavaHook::get_jobject_param_at(frame, 1), env, true); - for (const std::pair>& category : Ripterms::Modules::categories) + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) { - for (Ripterms::Modules::IModule* module : category.second) + for (Ripterms::Modules::IModule* module : category.modules) { + Ripterms::JNIFrame frame(env); module->onAddToSendQueue(env, sendQueue, packet, cancel); } } @@ -73,9 +83,9 @@ static void getMouseOver_callback(HotSpot::frame* frame, HotSpot::Thread* thread JNIEnv* env = thread->get_env(); float f = Ripterms::JavaHook::get_primitive_param_at(frame, 1); - for (const std::pair>& category : Ripterms::Modules::categories) + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) { - for (Ripterms::Modules::IModule* module : category.second) + for (Ripterms::Modules::IModule* module : category.modules) { module->onGetMouseOver(env, f, cancel); } @@ -88,13 +98,14 @@ static void attackTargetEntityWithCurrentItem_callback(HotSpot::frame* frame, Ho if (!Ripterms::p_env) return; JNIEnv* env = thread->get_env(); - EntityPlayer this_player(Ripterms::JavaHook::get_jobject_param_at(frame, 0), env); - Entity entity(Ripterms::JavaHook::get_jobject_param_at(frame, 1), env); + EntityPlayer this_player(Ripterms::JavaHook::get_jobject_param_at(frame, 0), env, true); + Entity entity(Ripterms::JavaHook::get_jobject_param_at(frame, 1), env, true); - for (const std::pair>& category : Ripterms::Modules::categories) + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) { - for (Ripterms::Modules::IModule* module : category.second) + for (Ripterms::Modules::IModule* module : category.modules) { + Ripterms::JNIFrame frame(env); module->onAttackTargetEntityWithCurrentItem(env, this_player, entity, cancel); } } @@ -107,12 +118,13 @@ static void onUpdateWalkingPlayer_callback(HotSpot::frame* frame, HotSpot::Threa if (!Ripterms::p_env) return; JNIEnv* env = thread->get_env(); - EntityPlayerSP this_player(Ripterms::JavaHook::get_jobject_param_at(frame, 0), env); + EntityPlayerSP this_player(Ripterms::JavaHook::get_jobject_param_at(frame, 0), env, true); - for (const std::pair>& category : Ripterms::Modules::categories) + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) { - for (Ripterms::Modules::IModule* module : category.second) + for (Ripterms::Modules::IModule* module : category.modules) { + Ripterms::JNIFrame frame(env); module->onUpdateWalkingPlayer(env, this_player, cancel); } } @@ -125,16 +137,55 @@ static void getClientModName_callback(HotSpot::frame* frame, HotSpot::Thread* th if (!Ripterms::p_env) return; JNIEnv* env = thread->get_env(); - for (const std::pair>& category : Ripterms::Modules::categories) + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) { - for (Ripterms::Modules::IModule* module : category.second) + for (Ripterms::Modules::IModule* module : category.modules) { + Ripterms::JNIFrame frame(env); module->onGetClientModName(env, cancel); } } return; } +static void channelRead0_callback(HotSpot::frame* frame, HotSpot::Thread* thread, bool* cancel) +{ + if (!Ripterms::p_env) return; + JNIEnv* env = thread->get_env(); + + NetworkManager this_networkManager(Ripterms::JavaHook::get_jobject_param_at(frame, 0), env, true); + ChannelHandlerContext context(Ripterms::JavaHook::get_jobject_param_at(frame, 1), env, true); + Packet packet(Ripterms::JavaHook::get_jobject_param_at(frame, 2), env, true); + + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) + { + for (Ripterms::Modules::IModule* module : category.modules) + { + Ripterms::JNIFrame frame(env); + module->onChannelRead0(env, this_networkManager, context, packet, cancel); + } + } + return; +} + +static void clickMouse_callback(HotSpot::frame* frame, HotSpot::Thread* thread, bool* cancel) +{ + if (!Ripterms::p_env) return; + JNIEnv* env = thread->get_env(); + + Minecraft theMinecraft(Ripterms::JavaHook::get_jobject_param_at(frame, 0), env, true); + + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) + { + for (Ripterms::Modules::IModule* module : category.modules) + { + Ripterms::JNIFrame frame(env); + module->onClickMouse(env, theMinecraft, cancel); + } + } + return; +} + void Ripterms::Modules::setupEventHooks() { Ripterms::JavaClassV2 NetHandlerPlayClient("net/minecraft/client/network/NetHandlerPlayClient"); @@ -160,13 +211,21 @@ void Ripterms::Modules::setupEventHooks() Ripterms::JavaClassV2 ClientBrandRetriever("net/minecraft/client/ClientBrandRetriever"); jmethodID getClientModName = ClientBrandRetriever.getMethodID("getClientModName"); Ripterms::JavaHook::hook(getClientModName, getClientModName_callback); + + Ripterms::JavaClassV2 NetworkManager("net/minecraft/network/NetworkManager"); + jmethodID channelRead0 = NetworkManager.getMethodID("channelRead0"); + Ripterms::JavaHook::hook(channelRead0, channelRead0_callback); + + Ripterms::JavaClassV2 Minecraft("net/minecraft/client/Minecraft"); + jmethodID clickMouse = Minecraft.getMethodID("clickMouse"); + Ripterms::JavaHook::hook(clickMouse, clickMouse_callback); } void Ripterms::Modules::runAll() { - for (const std::pair>& category : categories) + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) { - for (IModule* m : category.second) + for (IModule* m : category.modules) { m->run(); } @@ -175,12 +234,11 @@ void Ripterms::Modules::runAll() void Ripterms::Modules::cleanAll() { - for (const std::pair>& category : categories) + for (Ripterms::Modules::Category& category : Ripterms::Modules::categories) { - for (IModule* m : category.second) + for (IModule* m : category.modules) { m->disable(); - delete m; } } } @@ -189,3 +247,116 @@ void Ripterms::Modules::cleanAll() void Ripterms::Modules::ESP::render() { } + +void Ripterms::Modules::AttackLag::renderGUI() +{ + static bool display_options = false; + ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2(20.0f, 0.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(250.0f, ImGui::GetStyle().FramePadding.y)); + ImGui::Checkbox("AttackLag", &enabled); + ImGui::PopStyleVar(); + ImGui::PopStyleVar(); + if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) + display_options = !display_options; + ImGui::SameLine(); + ImGui::SetCursorPosX(ImGui::GetWindowWidth() - 30.0f); + if (ImGui::ArrowButton("aimopt", ImGuiDir_Down)) + display_options = !display_options; + if (display_options) + { + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 10.0f); + ImGui::BeginGroup(); + ImGui::SliderInt("Packet Receive delay ms", &delay, 10, 1000, "%d"); + ImGui::EndGroup(); + } +} + +void Ripterms::Modules::AttackLag::onChannelRead0(JNIEnv* env, NetworkManager& this_networkManager, ChannelHandlerContext& context, Packet& packet, bool* cancel) +{ + if (lag) + { + std::this_thread::sleep_for(std::chrono::milliseconds(delay)); + lag = false; + } +} + +void Ripterms::Modules::AttackLag::onAttackTargetEntityWithCurrentItem(JNIEnv* env, EntityPlayer& this_player, Entity& entity, bool* cancel) +{ + if (!enabled) return; + lag = true; +} + +void Ripterms::Modules::NoMiss::renderGUI() +{ + ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2(20.0f, 0.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(250.0f, ImGui::GetStyle().FramePadding.y)); + ImGui::Checkbox("NoMiss", &enabled); + ImGui::PopStyleVar(); + ImGui::PopStyleVar(); +} + +void Ripterms::Modules::NoMiss::onClickMouse(JNIEnv* env, Minecraft& theMinecraft, bool* cancel) +{ + if (!enabled) return; + if (theMinecraft.getObjectMouseOver().getType().isEqualTo(MovingObjectType::getType("MISS", env))) + { + *cancel = true; + } +} + +void Ripterms::Modules::BlockOnAttack::renderGUI() +{ + ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2(20.0f, 0.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(250.0f, ImGui::GetStyle().FramePadding.y)); + ImGui::Checkbox("BlockOnAttack", &enabled); + ImGui::PopStyleVar(); + ImGui::PopStyleVar(); +} + +void Ripterms::Modules::BlockOnAttack::onAttackTargetEntityWithCurrentItem(JNIEnv* env, EntityPlayer& this_player, Entity& entity, bool* cancel) +{ + if (!enabled) return; + POINT cursorPos{}; + GetCursorPos(&cursorPos); + PostMessageA(Ripterms::window, WM_RBUTTONDOWN, MK_RBUTTON, MAKELPARAM(cursorPos.x, cursorPos.y)); + PostMessageA(Ripterms::window, WM_RBUTTONUP, MK_RBUTTON, MAKELPARAM(cursorPos.x, cursorPos.y)); +} + +void Ripterms::Modules::VelocityPacket::renderGUI() +{ + static bool display_options = false; + ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2(20.0f, 0.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(250.0f, ImGui::GetStyle().FramePadding.y)); + ImGui::Checkbox("VelocityPacket", &enabled); + ImGui::PopStyleVar(); + ImGui::PopStyleVar(); + + if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) + display_options = !display_options; + ImGui::SameLine(); + ImGui::SetCursorPosX(ImGui::GetWindowWidth() - 30.0f); + if (ImGui::ArrowButton("aimopt", ImGuiDir_Down)) + display_options = !display_options; + if (display_options) + { + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 10.0f); + ImGui::BeginGroup(); + ImGui::SliderFloat("motionX multiplier", &motionX_multiplier, -2.0f, 2.0f, "%.2f"); + ImGui::SliderFloat("motionY multiplier", &motionY_multiplier, -2.0f, 2.0f, "%.2f"); + ImGui::SliderFloat("motionZ multiplier", &motionZ_multiplier, -2.0f, 2.0f, "%.2f"); + ImGui::EndGroup(); + } +} + +void Ripterms::Modules::VelocityPacket::onChannelRead0(JNIEnv* env, NetworkManager& this_networkManager, ChannelHandlerContext& context, Packet& packet, bool* cancel) +{ + if (!enabled) return; + if (!packet.isValid()) return; + if (!packet.instanceOf(Ripterms::JavaClassV2("net/minecraft/network/play/server/S12PacketEntityVelocity").get_jclass(env))) return; + + S12PacketEntityVelocity velocityPacket(packet, env); + if (velocityPacket.getEntityID() != Minecraft::getTheMinecraft(env).getThePlayer().getEntityId()) return; + velocityPacket.setMotionX(int(velocityPacket.getMotionX() * motionX_multiplier)); + velocityPacket.setMotionY(int(velocityPacket.getMotionY() * motionY_multiplier)); + velocityPacket.setMotionZ(int(velocityPacket.getMotionZ() * motionZ_multiplier)); +} diff --git a/Ripterms/Modules/Modules.h b/Ripterms/Modules/Modules.h index f6f3767..9957afc 100644 --- a/Ripterms/Modules/Modules.h +++ b/Ripterms/Modules/Modules.h @@ -11,8 +11,11 @@ #include "../../net/minecraft/world/World/World.h" #include "../../net/minecraft/client/entity/EntityPlayerSP/EntityPlayerSP.h" #include -#include #include +#include +#include +#include "../../net/minecraft/network/NetworkManager/NetworkManager.h" +#include "../../net/minecraft/client/Minecraft/Minecraft.h" namespace Ripterms { @@ -26,13 +29,15 @@ namespace Ripterms virtual void render(); virtual void disable(); - inline static std::atomic onAddToSendQueueNoEvent = false; + inline static bool onAddToSendQueueNoEvent = false; virtual void onAddToSendQueue(JNIEnv* env, NetHandlerPlayClient& sendQueue, Packet& packet, bool* cancel); virtual void onUpdateWalkingPlayer(JNIEnv* env, EntityPlayerSP& this_player, bool* cancel); virtual void onAttackTargetEntityWithCurrentItem(JNIEnv* env, EntityPlayer& this_player, Entity& entity, bool* cancel); virtual void onGetMouseOver(JNIEnv* env, float partialTicks, bool* cancel); virtual void onGetClientModName(JNIEnv* env, bool* cancel); + virtual void onChannelRead0(JNIEnv* env, NetworkManager& this_networkManager, ChannelHandlerContext& context, Packet& packet, bool* cancel); + virtual void onClickMouse(JNIEnv* env, Minecraft& theMinecraft, bool* cancel); void onKeyBind(int keyBind); protected: @@ -56,7 +61,7 @@ namespace Ripterms float max_distance = 6.0f; float max_angle = 80.0f; float multiplier = 1.0f; - float multiplierPitch = 0.5f; + float multiplierPitch = 0.4f; EntityPlayer prev_selected_target{ Ripterms::p_env, true }; }; @@ -266,16 +271,74 @@ namespace Ripterms void renderGUI() override; void run() override; private: - float partialTicks = 1.0f; + float partialTicks = 0.3f; }; - inline std::map> categories = + class AttackLag : public IModule { - {"Combat", {new AimAssist(), new Reach(), new LeftClicker(), new WTap(), new HitBoxes(), new BackTrack()}}, - {"Player", {new FastPlace(), new Blink(), new LegitScaffold(), new NoFall()}}, - {"Movement", {new Velocity(), new Sprint(), new Glide(), new VelocityFly(), new Speed()}}, - {"Render", {new Xray(), new FullBright(), new ESP()}}, - {"Whatever", {new ClientBrandChanger(), new Test()}} + public: + void renderGUI() override; + void onChannelRead0(JNIEnv* env, NetworkManager& this_networkManager, ChannelHandlerContext& context, Packet& packet, bool* cancel) override; + void onAttackTargetEntityWithCurrentItem(JNIEnv* env, EntityPlayer& this_player, Entity& entity, bool* cancel) override; + private: + bool lag = false; + int delay = 420; + }; + + class NoMiss : public IModule + { + public: + void renderGUI() override; + void onClickMouse(JNIEnv* env, Minecraft& theMinecraft, bool* cancel) override; + }; + + class BlockOnAttack : public IModule + { + public: + void renderGUI() override; + void onAttackTargetEntityWithCurrentItem(JNIEnv* env, EntityPlayer& this_player, Entity& entity, bool* cancel) override; + }; + + class VelocityPacket : public IModule + { + public: + void renderGUI() override; + void onChannelRead0(JNIEnv* env, NetworkManager& this_networkManager, ChannelHandlerContext& context, Packet& packet, bool* cancel) override; + private: + float motionX_multiplier; + float motionY_multiplier; + float motionZ_multiplier; + }; + + + class Category + { + public: + Category(const Category& cat) = delete; + ~Category() { for (IModule* module : modules) delete module; } + + template && ...))>> + inline static Category create(const char* name) + { + std::vector modules{}; + modules.reserve(sizeof...(T)); + (modules.push_back(new T()), ...); + return Category(name, std::move(modules)); + } + + const char* name; + std::vector modules; + private: + Category(const char* name, std::vector&& modules) : name(name), modules(std::move(modules)) {} + }; + + inline Category categories[] = + { + Category::create("Combat"), + Category::create("Player"), + Category::create("Movement"), + Category::create("Render"), + Category::create("Whatever") }; void setupEventHooks(); diff --git a/Ripterms/Modules/Test.cpp b/Ripterms/Modules/Test.cpp index 076016e..9079bf0 100644 --- a/Ripterms/Modules/Test.cpp +++ b/Ripterms/Modules/Test.cpp @@ -60,6 +60,8 @@ void Ripterms::Modules::Test::renderGUI() //0000000003121341 //0x261 + std::cout << Ripterms::p_env->functions->CallBooleanMethod << '\n'; + /* std::thread a([mid] { JNIEnv* env = Ripterms::get_current_thread_env(); @@ -74,7 +76,5 @@ void Ripterms::Modules::Test::renderGUI() }); a.detach(); */ - - Ripterms::cache->thePlayer.getSendQueue().addToSendQueue(C03PacketPlayer::newObject(true)); } } \ No newline at end of file diff --git a/io/netty/ChannelHandlerContext/ChannelHandlerContext.cpp b/io/netty/ChannelHandlerContext/ChannelHandlerContext.cpp new file mode 100644 index 0000000..e69de29 diff --git a/io/netty/ChannelHandlerContext/ChannelHandlerContext.h b/io/netty/ChannelHandlerContext/ChannelHandlerContext.h new file mode 100644 index 0000000..4a83c79 --- /dev/null +++ b/io/netty/ChannelHandlerContext/ChannelHandlerContext.h @@ -0,0 +1,10 @@ +#pragma once +#include "../../../java/lang/Object/Object.h" + +class ChannelHandlerContext : public Object +{ +public: + using Object::Object; +protected: + inline static Ripterms::JavaClassV2 ChannelHandlerContextClass{ "io/netty/channel/ChannelHandlerContext" }; +}; \ No newline at end of file diff --git a/java/lang/Object/Object.h b/java/lang/Object/Object.h index af9b33c..4090e9e 100644 --- a/java/lang/Object/Object.h +++ b/java/lang/Object/Object.h @@ -7,8 +7,10 @@ class Object { public: //make global if you want to preserve the reference accross local frames, //so if you want to reuse it in another Modules::run() call + //becareful to set correct env when in hooks Object(jobject instance, JNIEnv* env = Ripterms::p_env, bool is_global=false); Object(const Object& other_Object); + //becareful to set correct env when in hooks Object(JNIEnv* env = Ripterms::p_env, bool is_global = false); ~Object(); diff --git a/net/minecraft/entity/Entity/Entity.cpp b/net/minecraft/entity/Entity/Entity.cpp index c41cc07..5f3be26 100644 --- a/net/minecraft/entity/Entity/Entity.cpp +++ b/net/minecraft/entity/Entity/Entity.cpp @@ -121,6 +121,12 @@ Entity Entity::getRidingEntity() const ); } +int Entity::getEntityId() const +{ + if (!instance) return 0; + return env->GetIntField(instance, EntityClass.getFieldID("entityId")); +} + void Entity::setPosition(const Ripterms::Maths::Vector3d& position) { if (!instance) return; diff --git a/net/minecraft/entity/Entity/Entity.h b/net/minecraft/entity/Entity/Entity.h index 4649539..ebac666 100644 --- a/net/minecraft/entity/Entity/Entity.h +++ b/net/minecraft/entity/Entity/Entity.h @@ -23,6 +23,7 @@ class Entity : public Object AxisAlignedBB getBoundingBox() const; float getEyeHeight() const; Entity getRidingEntity() const; + int getEntityId() const; void setPosition(const Ripterms::Maths::Vector3d& position); void setRidingEntity(Entity& entity); diff --git a/net/minecraft/network/NetworkManager/NetworkManager.cpp b/net/minecraft/network/NetworkManager/NetworkManager.cpp new file mode 100644 index 0000000..903fb43 --- /dev/null +++ b/net/minecraft/network/NetworkManager/NetworkManager.cpp @@ -0,0 +1,7 @@ +#include "NetworkManager.h" + +void NetworkManager::channelRead0(ChannelHandlerContext& context, Packet& packet) +{ + if (!instance) return; + env->CallVoidMethod(instance, NetworkManagerClass.getMethodID("channelRead0"), context.getInstance(), packet.getInstance()); +} diff --git a/net/minecraft/network/NetworkManager/NetworkManager.h b/net/minecraft/network/NetworkManager/NetworkManager.h new file mode 100644 index 0000000..bc839df --- /dev/null +++ b/net/minecraft/network/NetworkManager/NetworkManager.h @@ -0,0 +1,14 @@ +#pragma once +#include "../../../../java/lang/Object/Object.h" +#include "../../../../io/netty/ChannelHandlerContext/ChannelHandlerContext.h" +#include "../Packet/Packet.h" + +class NetworkManager : public Object +{ +public: + using Object::Object; + + void channelRead0(ChannelHandlerContext& context, Packet& packet); +protected: + inline static Ripterms::JavaClassV2 NetworkManagerClass{ "net/minecraft/network/NetworkManager" }; +}; \ No newline at end of file diff --git a/net/minecraft/network/play/server/S12PacketEntityVelocity/S12PacketEntityVelocity.cpp b/net/minecraft/network/play/server/S12PacketEntityVelocity/S12PacketEntityVelocity.cpp new file mode 100644 index 0000000..dd7fd1c --- /dev/null +++ b/net/minecraft/network/play/server/S12PacketEntityVelocity/S12PacketEntityVelocity.cpp @@ -0,0 +1,49 @@ +#include "S12PacketEntityVelocity.h" + +int S12PacketEntityVelocity::getEntityID() const +{ + if (!instance) return 0; + return env->GetIntField(instance, S12PacketEntityVelocityClass.getFieldID("entityID")); +} + +int S12PacketEntityVelocity::getMotionX() const +{ + if (!instance) return 0; + return env->GetIntField(instance, S12PacketEntityVelocityClass.getFieldID("motionX")); +} + +int S12PacketEntityVelocity::getMotionY() const +{ + if (!instance) return 0; + return env->GetIntField(instance, S12PacketEntityVelocityClass.getFieldID("motionY")); +} + +int S12PacketEntityVelocity::getMotionZ() const +{ + if (!instance) return 0; + return env->GetIntField(instance, S12PacketEntityVelocityClass.getFieldID("motionZ")); +} + +void S12PacketEntityVelocity::setEntityID(int value) +{ + if (!instance) return; + env->SetIntField(instance, S12PacketEntityVelocityClass.getFieldID("entityID"), (jint)value); +} + +void S12PacketEntityVelocity::setMotionX(int value) +{ + if (!instance) return; + env->SetIntField(instance, S12PacketEntityVelocityClass.getFieldID("motionX"), (jint)value); +} + +void S12PacketEntityVelocity::setMotionY(int value) +{ + if (!instance) return; + env->SetIntField(instance, S12PacketEntityVelocityClass.getFieldID("motionY"), (jint)value); +} + +void S12PacketEntityVelocity::setMotionZ(int value) +{ + if (!instance) return; + env->SetIntField(instance, S12PacketEntityVelocityClass.getFieldID("motionZ"), (jint)value); +} diff --git a/net/minecraft/network/play/server/S12PacketEntityVelocity/S12PacketEntityVelocity.h b/net/minecraft/network/play/server/S12PacketEntityVelocity/S12PacketEntityVelocity.h new file mode 100644 index 0000000..d3b5919 --- /dev/null +++ b/net/minecraft/network/play/server/S12PacketEntityVelocity/S12PacketEntityVelocity.h @@ -0,0 +1,20 @@ +#pragma once +#include "../../../Packet/Packet.h" + +class S12PacketEntityVelocity : public Packet +{ +public: + using Packet::Packet; + + int getEntityID() const; + int getMotionX() const; + int getMotionY() const; + int getMotionZ() const; + + void setEntityID(int value); + void setMotionX(int value); + void setMotionY(int value); + void setMotionZ(int value); +private: + inline static Ripterms::JavaClassV2 S12PacketEntityVelocityClass{ "net/minecraft/network/play/server/S12PacketEntityVelocity" }; +}; \ No newline at end of file