Skip to content

Commit

Permalink
fixed mappings vanilla, improved backtrack
Browse files Browse the repository at this point in the history
fixed mappings vanilla, improved backtrack
  • Loading branch information
Lefraudeur authored Feb 25, 2024
2 parents b48f568 + 834761a commit 46e1c3a
Show file tree
Hide file tree
Showing 22 changed files with 442 additions and 138 deletions.
6 changes: 6 additions & 0 deletions Ripterms Ghost.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@
<ClCompile Include="net\minecraft\network\play\client\C03PacketPlayer\C04PacketPlayerPosition\C04PacketPlayerPosition.cpp" />
<ClCompile Include="net\minecraft\network\play\client\C03PacketPlayer\C06PacketPlayerPosLook\C06PacketPlayerPosLook.cpp" />
<ClCompile Include="net\minecraft\network\play\server\S12PacketEntityVelocity\S12PacketEntityVelocity.cpp" />
<ClCompile Include="net\minecraft\network\play\server\S19PacketEntityStatus\S19PacketEntityStatus.cpp" />
<ClCompile Include="net\minecraft\network\protocol\game\ClientboundDamageEventPacket\ClientboundDamageEventPacket.cpp" />
<ClCompile Include="net\minecraft\util\AxisAlignedBB\AxisAlignedBB.cpp" />
<ClCompile Include="net\minecraft\util\BlockPos\BlockPos.cpp" />
<ClCompile Include="net\minecraft\util\MovingObjectPosition\MovingObjectPosition.cpp" />
Expand All @@ -236,12 +238,14 @@
<ClCompile Include="Ripterms\Modules\LegitScaffold.cpp" />
<ClCompile Include="Ripterms\Modules\Modules.cpp" />
<ClCompile Include="Ripterms\Modules\NoFall.cpp" />
<ClCompile Include="Ripterms\Modules\NoMiss.cpp" />
<ClCompile Include="Ripterms\Modules\Reach.cpp" />
<ClCompile Include="Ripterms\Modules\Speed.cpp" />
<ClCompile Include="Ripterms\Modules\Sprint.cpp" />
<ClCompile Include="Ripterms\Modules\Test.cpp" />
<ClCompile Include="Ripterms\Modules\Velocity.cpp" />
<ClCompile Include="Ripterms\Modules\VelocityFly.cpp" />
<ClCompile Include="Ripterms\Modules\VelocityPacket.cpp" />
<ClCompile Include="Ripterms\Modules\WTap.cpp" />
<ClCompile Include="Ripterms\Modules\Xray.cpp" />
<ClCompile Include="Ripterms\Ripterms.cpp" />
Expand Down Expand Up @@ -282,6 +286,8 @@
<ClInclude Include="net\minecraft\network\play\client\C03PacketPlayer\C04PacketPlayerPosition\C04PacketPlayerPosition.h" />
<ClInclude Include="net\minecraft\network\play\client\C03PacketPlayer\C06PacketPlayerPosLook\C06PacketPlayerPosLook.h" />
<ClInclude Include="net\minecraft\network\play\server\S12PacketEntityVelocity\S12PacketEntityVelocity.h" />
<ClInclude Include="net\minecraft\network\play\server\S19PacketEntityStatus\S19PacketEntityStatus.h" />
<ClInclude Include="net\minecraft\network\protocol\game\ClientboundDamageEventPacket\ClientboundDamageEventPacket.h" />
<ClInclude Include="net\minecraft\util\AxisAlignedBB\AxisAlignedBB.h" />
<ClInclude Include="net\minecraft\util\BlockPos\BlockPos.h" />
<ClInclude Include="net\minecraft\util\MovingObjectPosition\MovingObjectPosition.h" />
Expand Down
18 changes: 18 additions & 0 deletions Ripterms Ghost.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,18 @@
<ClCompile Include="net\minecraft\network\play\server\S12PacketEntityVelocity\S12PacketEntityVelocity.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="net\minecraft\network\play\server\S19PacketEntityStatus\S19PacketEntityStatus.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="Ripterms\Modules\NoMiss.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="Ripterms\Modules\VelocityPacket.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="net\minecraft\network\protocol\game\ClientboundDamageEventPacket\ClientboundDamageEventPacket.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Ripterms\Ripterms.h">
Expand Down Expand Up @@ -431,5 +443,11 @@
<ClInclude Include="net\minecraft\network\play\server\S12PacketEntityVelocity\S12PacketEntityVelocity.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="net\minecraft\network\play\server\S19PacketEntityStatus\S19PacketEntityStatus.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="net\minecraft\network\protocol\game\ClientboundDamageEventPacket\ClientboundDamageEventPacket.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Ripterms/GUI/GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static BOOL WINAPI detour_wglSwapBuffers(HDC unnamedParam1)
io.Fonts->AddFontFromMemoryTTF((void*)Custom.data(), (int)Custom.size(), 17.5f, &CustomFont);
io.Fonts->AddFontDefault(); ImGui::StyleColorsDark();

io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
//io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;

//ImGui::StyleColorsDark();
Expand Down
18 changes: 18 additions & 0 deletions Ripterms/Mappings/mappings_forge_1_7_10.h
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,24 @@ R"(
}
],
"methods": []
},
"net/minecraft/network/play/server/S19PacketEntityStatus": {
"obfuscated": "net/minecraft/network/play/server/S19PacketEntityStatus",
"fields": [
{
"name": "entityId",
"obfuscated": "field_149164_a",
"signature": "I",
"static": false
},
{
"name": "logicOpcode",
"obfuscated": "field_149163_b",
"signature": "B",
"static": false
}
],
"methods": []
}
}
)";
Expand Down
18 changes: 18 additions & 0 deletions Ripterms/Mappings/mappings_lunar_1_16_5.h
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,24 @@ R"(
}
],
"methods": []
},
"net/minecraft/network/play/server/S19PacketEntityStatus": {
"obfuscated": "net/minecraft/network/protocol/game/ClientboundEntityEventPacket",
"fields": [
{
"name": "entityId",
"obfuscated": "entityId",
"signature": "I",
"static": false
},
{
"name": "logicOpcode",
"obfuscated": "eventId",
"signature": "B",
"static": false
}
],
"methods": []
}
}
)";
Expand Down
30 changes: 30 additions & 0 deletions Ripterms/Mappings/mappings_lunar_1_19_4.h
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,36 @@ R"(
}
],
"methods": []
},
"net/minecraft/network/play/server/S19PacketEntityStatus": {
"obfuscated": "net/minecraft/network/protocol/game/ClientboundEntityEventPacket",
"fields": [
{
"name": "entityId",
"obfuscated": "entityId",
"signature": "I",
"static": false
},
{
"name": "logicOpcode",
"obfuscated": "eventId",
"signature": "B",
"static": false
}
],
"methods": []
},
"net/minecraft/network/protocol/game/ClientboundDamageEventPacket": {
"obfuscated": "net/minecraft/network/protocol/game/ClientboundDamageEventPacket",
"fields": [
{
"name": "entityId",
"obfuscated": "entityId",
"signature": "I",
"static": false
}
],
"methods": []
}
}
)";
Expand Down
18 changes: 18 additions & 0 deletions Ripterms/Mappings/mappings_lunar_1_7_10.h
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,24 @@ R"(
}
],
"methods": []
},
"net/minecraft/network/play/server/S19PacketEntityStatus": {
"obfuscated": "net/minecraft/network/play/server/S19PacketEntityStatus",
"fields": [
{
"name": "entityId",
"obfuscated": "field_149164_a",
"signature": "I",
"static": false
},
{
"name": "logicOpcode",
"obfuscated": "field_149163_b",
"signature": "B",
"static": false
}
],
"methods": []
}
}
)";
Expand Down
18 changes: 18 additions & 0 deletions Ripterms/Mappings/mappings_lunar_1_8_9.h
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,24 @@ R"(
}
],
"methods": []
},
"net/minecraft/network/play/server/S19PacketEntityStatus": {
"obfuscated": "net/minecraft/network/play/server/S19PacketEntityStatus",
"fields": [
{
"name": "entityId",
"obfuscated": "entityId",
"signature": "I",
"static": false
},
{
"name": "logicOpcode",
"obfuscated": "logicOpcode",
"signature": "B",
"static": false
}
],
"methods": []
}
}
)";
Expand Down
20 changes: 19 additions & 1 deletion Ripterms/Mappings/mappings_vanilla_1_8_9.h
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ R"(
]
},
"net/minecraft/network/play/server/S12PacketEntityVelocity": {
"obfuscated": "net/minecraft/network/play/server/S12PacketEntityVelocity",
"obfuscated": "hm",
"fields": [
{
"name": "entityID",
Expand Down Expand Up @@ -820,6 +820,24 @@ R"(
}
],
"methods": []
},
"net/minecraft/network/play/server/S19PacketEntityStatus": {
"obfuscated": "gi",
"fields": [
{
"name": "entityId",
"obfuscated": "a",
"signature": "I",
"static": false
},
{
"name": "logicOpcode",
"obfuscated": "b",
"signature": "B",
"static": false
}
],
"methods": []
}
}
)";
Expand Down
94 changes: 74 additions & 20 deletions Ripterms/Modules/BackTrack.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "Modules.h"
#include "../Cache/Cache.h"
#include "../../net/minecraft/network/play/server/S19PacketEntityStatus/S19PacketEntityStatus.h"
#include "../../net/minecraft/network/protocol/game/ClientboundDamageEventPacket/ClientboundDamageEventPacket.h"

void Ripterms::Modules::BackTrack::renderGUI()
{
Expand All @@ -8,42 +10,94 @@ void Ripterms::Modules::BackTrack::renderGUI()
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(250.0f, ImGui::GetStyle().FramePadding.y));
ImGui::Checkbox("BackTrack", &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("BackTrackopt", ImGuiDir_Down))
if (ImGui::ArrowButton("BackTrackOpt", ImGuiDir_Down))
display_options = !display_options;
if (display_options)
{
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 10.0f);
ImGui::BeginGroup();
ImGui::SliderFloat("PartialTicks in advance", &partialTicks, 0.01f, 2.0f, "%.2f");
ImGui::SliderInt("Packet ReceiveDelay ms", &delay, 10, 1000, "%d");
ImGui::Checkbox("disableOnHit", &disableOnHit);
ImGui::EndGroup();
}

ImGui::PopStyleVar();
}

void Ripterms::Modules::BackTrack::run()
void Ripterms::Modules::BackTrack::onChannelRead0(JNIEnv* env, NetworkManager& this_networkManager, ChannelHandlerContext& context, Packet& packet, bool* cancel)
{
if (!enabled) return;
static Ripterms::CTimer timer = std::chrono::milliseconds(10);
if (!timer.isElapsed())
static Ripterms::CTimer timer{ std::chrono::milliseconds(delay) };
static int prev_delay = delay;
if (!enabled)
{
lag = false;
if (!packets.empty()) sendPackets(env);
return;
}
if (lag)
{
if (!packet.isValid()) return;
if (timer.isElapsed() || (disableOnHit && isAttackPacket(packet, env)))
{
lag = false;
if (!packets.empty()) sendPackets(env);
return;
}
*cancel = true;
addPacket({ this_networkManager , context, packet });
}
if (prev_delay != delay)
{
timer.setEvery(std::chrono::milliseconds(delay));
prev_delay = delay;
}
}

Ripterms::Maths::Vector3d thePlayerPos = Ripterms::cache->thePlayer.getPosition();
for (EntityPlayer& player : Ripterms::cache->playerEntities.toVector<EntityPlayer>())
void Ripterms::Modules::BackTrack::onAttackTargetEntityWithCurrentItem(JNIEnv* env, EntityPlayer& this_player, Entity& entity, bool* cancel)
{
if (!enabled) return;
lag = true;
}

bool Ripterms::Modules::BackTrack::isAttackPacket(Packet& packet, JNIEnv* env)
{
if (Ripterms::version.type == Ripterms::Version::MAJOR_1_19_4)
{
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(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()));
if (!packet.instanceOf(Ripterms::JavaClassV2("net/minecraft/network/protocol/game/ClientboundDamageEventPacket").get_jclass(env))) return false;
ClientboundDamageEventPacket damagePacket(packet, env, true);
return damagePacket.getEntityId() == Minecraft::getTheMinecraft(env).getThePlayer().getEntityId();
}
if (!packet.instanceOf(Ripterms::JavaClassV2("net/minecraft/network/play/server/S19PacketEntityStatus").get_jclass(env))) return false;
S19PacketEntityStatus statusPacket(packet, env, true);
if (statusPacket.getEntityId() != Minecraft::getTheMinecraft(env).getThePlayer().getEntityId()) return false;

jbyte opcode = statusPacket.getLogicOpcode();

if (Ripterms::version.type == Ripterms::Version::MAJOR_1_16_5)
return Ripterms::is_any_of(opcode, 2, 33, 36, 37, 44);

return opcode == (jbyte)2;
}

void Ripterms::Modules::BackTrack::sendPackets(JNIEnv* env)
{
onChannelRead0NoEvent = true;
std::lock_guard lock{ packets_mutex };
for (PacketData& data : packets)
{
data.this_networkManager.set_env(env);
data.this_networkManager.channelRead0(data.context, data.packet);
}
packets.clear();
onChannelRead0NoEvent = false;
}

void Ripterms::Modules::BackTrack::addPacket(const PacketData& data)
{
std::lock_guard lock{ packets_mutex };
packets.push_back(data);
}
Loading

0 comments on commit 46e1c3a

Please sign in to comment.