some work

This commit is contained in:
core 2023-03-07 20:52:16 -05:00
parent 1d2191c0c0
commit 17fd5ac188
Signed by: core
GPG Key ID: FDBF740DADDCEECF
8 changed files with 85 additions and 93 deletions

2
.gitignore vendored
View File

@ -30,8 +30,6 @@ bin/
# fabric # fabric
run/
# java # java
hs_err_*.log hs_err_*.log

View File

@ -1,34 +1,11 @@
package dev.coredoes.clientmod.commands; package dev.coredoes.clientmod.commands;
import dev.coredoes.clientmod.util.ConnectionInterface; import dev.coredoes.clientmod.util.AirTP;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
public class AirTPCommand extends Command { public class AirTPCommand extends Command {
private void doAirTpTo(MinecraftClient client, double x, double y, double z) {
// STEP 1: Massively increase our movement cap
PlayerMoveC2SPacket packet = new PlayerMoveC2SPacket.PositionAndOnGround(
client.player.getX(),
client.player.getY(),
client.player.getZ(),
client.player.isOnGround()
);
for (int i = 0; i < 8; i++) {
((ConnectionInterface) client.getNetworkHandler().getConnection()).sendVolatile(packet, null);
}
// STEP 2: Send the teleport packet
PlayerMoveC2SPacket realPacket = new PlayerMoveC2SPacket.PositionAndOnGround(
x,
y,
z,
client.player.isOnGround()
);
((ConnectionInterface) client.getNetworkHandler().getConnection()).sendVolatile(realPacket, null);
client.player.setPosition(x, y, z);
}
@Override @Override
void execute(String[] argv) { void execute(String[] argv) {
@ -41,7 +18,7 @@ public class AirTPCommand extends Command {
double atY = client.player.getY() - 51; double atY = client.player.getY() - 51;
doAirTpTo(client, client.player.getX(), atY, client.player.getZ()); AirTP.doAirTp(client, true, client.player.getX(), atY, client.player.getZ());
// STEP 5: Update the client // STEP 5: Update the client
//client.player.setPositio n(x, client.player.getY() + 300, z); //client.player.setPositio n(x, client.player.getY() + 300, z);

View File

@ -3,6 +3,7 @@ package dev.coredoes.clientmod.commands;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import dev.coredoes.clientmod.ClientMod; import dev.coredoes.clientmod.ClientMod;
import dev.coredoes.clientmod.util.AirTP;
import dev.coredoes.clientmod.util.ConnectionInterface; import dev.coredoes.clientmod.util.ConnectionInterface;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
@ -69,6 +70,8 @@ public class CommandParser {
ClientMod.moduleManager.getModuleById("Mate").enable(); ClientMod.moduleManager.getModuleById("Mate").enable();
} else if (Objects.equals(command, "stopMate")) { } else if (Objects.equals(command, "stopMate")) {
ClientMod.moduleManager.getModuleById("Mate").disable(); ClientMod.moduleManager.getModuleById("Mate").disable();
} else if (Objects.equals(command, "fountain")) {
AirTP.doAirTp(MinecraftClient.getInstance(), true, 142, 319, -139);
} }
} }
} }

View File

@ -1,38 +1,17 @@
package dev.coredoes.clientmod.commands; package dev.coredoes.clientmod.commands;
import dev.coredoes.clientmod.util.ConnectionInterface;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; import net.minecraft.text.Text;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
public class Vault extends Command { import dev.coredoes.clientmod.util.AirTP;
private void doAirTpTo(MinecraftClient client, double x, double y, double z) { public class Vault extends Command {
// STEP 1: Massively increase our movement cap
PlayerMoveC2SPacket packet = new PlayerMoveC2SPacket.PositionAndOnGround(
client.player.getX(),
client.player.getY(),
client.player.getZ(),
client.player.isOnGround()
);
for (int i = 0; i < 7; i++) {
((ConnectionInterface) client.getNetworkHandler().getConnection()).sendVolatile(packet, null);
}
// STEP 2: Send the teleport packet
PlayerMoveC2SPacket realPacket = new PlayerMoveC2SPacket.PositionAndOnGround(
x,
y,
z,
client.player.isOnGround()
);
((ConnectionInterface) client.getNetworkHandler().getConnection()).sendVolatile(realPacket, null);
client.player.setPosition(x, y, z);
}
@Override @Override
void execute(String[] argv) { void execute(String[] argv) {
@ -41,40 +20,39 @@ public class Vault extends Command {
ClientPlayerEntity player = client.player; ClientPlayerEntity player = client.player;
// press ze button // press ze button
BlockPos blockPos = new BlockPos(4780, 125, 1286); BlockPos blockPos = new BlockPos(4780, 125, 1286);
Direction direction = Direction.NORTH; Direction direction = Direction.NORTH;
BlockHitResult blockHitResult = new BlockHitResult(new Vec3d(blockPos.getX(), blockPos.getY(), blockPos.getZ()), direction, blockPos, false); BlockHitResult blockHitResult = new BlockHitResult(new Vec3d(blockPos.getX(), blockPos.getY(), blockPos.getZ()), direction, blockPos, false);
client.interactionManager.interactBlock(client.player, Hand.MAIN_HAND, blockHitResult); client.interactionManager.interactBlock(client.player, Hand.MAIN_HAND, blockHitResult);
// STEP 1: Teleport into the sky // STEP 1: Teleport into the sky
assert client.player != null; assert client.player != null;
double atY = client.player.getY() + 60;
doAirTpTo(client, client.player.getX(), atY, client.player.getZ()); client.player.sendMessage(Text.of("-- START VAULT INSTRUMENTATION --"));
try { Thread.sleep(50); } catch (InterruptedException ignored) {} client.player.sendMessage(Text.of("START (first tp): " + System.currentTimeMillis()));
doAirTpTo(client, client.player.getX(), client.player.getY() - 3, client.player.getZ() + 52);
try { Thread.sleep(50); } catch (InterruptedException ignored) {}
doAirTpTo(client, client.player.getX(), client.player.getY() - 55, client.player.getZ()); AirTP.doAirTp(client, true, client.player.getX(), client.player.getY() + 60, client.player.getZ());
try { Thread.sleep(10); } catch (InterruptedException ignored) {} try { Thread.sleep(2); } catch (InterruptedException ignored) {}
AirTP.doAirTp(client, true, client.player.getX(), client.player.getY() - 3, client.player.getZ() + 52);
AirTP.doAirTp(client, false, client.player.getX(), client.player.getY() - 55, client.player.getZ());
BlockPos blockPos2 = new BlockPos(4780, 125, 1336); BlockPos blockPos2 = new BlockPos(4780, 125, 1336);
Direction direction2 = Direction.NORTH; Direction direction2 = Direction.NORTH;
BlockHitResult blockHitResult2 = new BlockHitResult(new Vec3d(blockPos2.getX(), blockPos2.getY(), blockPos2.getZ()), direction2, blockPos2, false); BlockHitResult blockHitResult2 = new BlockHitResult(new Vec3d(blockPos2.getX(), blockPos2.getY(), blockPos2.getZ()), direction2, blockPos2, false);
client.interactionManager.interactBlock(client.player, Hand.MAIN_HAND, blockHitResult2); client.interactionManager.interactBlock(client.player, Hand.MAIN_HAND, blockHitResult2);
try { Thread.sleep(20); } catch (InterruptedException ignored) {} client.player.sendMessage(Text.of("END (button press): " + System.currentTimeMillis()));
client.player.sendMessage(Text.of("-- END VAULT INSTRUMENTATION --"));
doAirTpTo(client, client.player.getX(), client.player.getY() + 56, client.player.getZ()); /*
try { Thread.sleep(10); } catch (InterruptedException ignored) {} AirTP.doAirTp(client, true, client.player.getX(), client.player.getY() + 2, client.player.getZ());
AirTP.doAirTp(client, true, client.player.getX(), client.player.getY() + 51, client.player.getZ());
doAirTpTo(client, client.player.getX(), client.player.getY(), client.player.getZ() - 52); try { Thread.sleep(500); } catch (InterruptedException ignored) {}
try { Thread.sleep(20); } catch (InterruptedException ignored) {} AirTP.doAirTp(client, true, client.player.getX(), client.player.getY(), client.player.getZ() - 52);
*/
doAirTpTo(client, client.player.getX(), client.player.getY() - 55, client.player.getZ());
try { Thread.sleep(10); } catch (InterruptedException ignored) {}
} }
} }

View File

@ -1,6 +1,7 @@
package dev.coredoes.clientmod.modules; package dev.coredoes.clientmod.modules;
import dev.coredoes.clientmod.ClientMod; import dev.coredoes.clientmod.ClientMod;
import dev.coredoes.clientmod.util.AirTP;
import dev.coredoes.clientmod.util.ConnectionInterface; import dev.coredoes.clientmod.util.ConnectionInterface;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
@ -56,25 +57,7 @@ public class BunkerBuster implements Module {
protected void bunkerBust(MinecraftClient client) { protected void bunkerBust(MinecraftClient client) {
// STEP 1: Send a bunch of teleports to our current location // STEP 1: Send a bunch of teleports to our current location
PlayerMoveC2SPacket packet = new PlayerMoveC2SPacket.PositionAndOnGround( AirTP.doAirTp(client, true, client.player.getX(), client.player.getY() + this.amount, client.player.getZ());
client.player.getX(),
client.player.getY(),
client.player.getZ(),
client.player.isOnGround()
);
for (int i = 0; i < 50; i++) {
((ConnectionInterface)client.getNetworkHandler().getConnection()).sendVolatile(packet, null);
}
// STEP 2: Send the real teleport
PlayerMoveC2SPacket realTeleport = new PlayerMoveC2SPacket.PositionAndOnGround(
client.player.getX(),
client.player.getY() + this.amount,
client.player.getZ(),
false
);
((ConnectionInterface)client.getNetworkHandler().getConnection()).sendVolatile(realTeleport, null);
client.player.setPosition(client.player.getX(), client.player.getY() + this.amount, client.player.getZ());
} }
class ModuleUI extends Screen { class ModuleUI extends Screen {
private final Screen parent; private final Screen parent;
@ -95,11 +78,11 @@ public class BunkerBuster implements Module {
DecimalFormat df = new DecimalFormat("#.00"); DecimalFormat df = new DecimalFormat("#.00");
this.addDrawableChild(new ButtonWidget(5, 55, 20, 20, Text.of("++"), (button) -> { this.addDrawableChild(new ButtonWidget(5, 55, 20, 20, Text.of("++"), (button) -> {
this.parentModule.amount += 1; this.parentModule.amount += 10;
this.amtBtn.setMessage(Text.of("BunkerBust: " + df.format((this.parentModule.amount)))); this.amtBtn.setMessage(Text.of("BunkerBust: " + df.format((this.parentModule.amount))));
})); }));
this.addDrawableChild(new ButtonWidget(30, 55, 20, 20, Text.of("+"), (button) -> { this.addDrawableChild(new ButtonWidget(30, 55, 20, 20, Text.of("+"), (button) -> {
this.parentModule.amount += 0.1; this.parentModule.amount += 1;
this.amtBtn.setMessage(Text.of("BunkerBust: " + df.format((this.parentModule.amount)))); this.amtBtn.setMessage(Text.of("BunkerBust: " + df.format((this.parentModule.amount))));
})); }));
@ -109,11 +92,11 @@ public class BunkerBuster implements Module {
this.addDrawableChild(this.amtBtn); this.addDrawableChild(this.amtBtn);
this.addDrawableChild(new ButtonWidget(150, 55, 20, 20, Text.of("-"), (button) -> { this.addDrawableChild(new ButtonWidget(150, 55, 20, 20, Text.of("-"), (button) -> {
this.parentModule.amount -= 0.1; this.parentModule.amount -= 1;
this.amtBtn.setMessage(Text.of("BunkerBust: " + df.format((this.parentModule.amount)))); this.amtBtn.setMessage(Text.of("BunkerBust: " + df.format((this.parentModule.amount))));
})); }));
this.addDrawableChild(new ButtonWidget(175, 55, 20, 20, Text.of("--"), (button) -> { this.addDrawableChild(new ButtonWidget(175, 55, 20, 20, Text.of("--"), (button) -> {
this.parentModule.amount -= 1; this.parentModule.amount -= 10;
this.amtBtn.setMessage(Text.of("BunkerBust: " + df.format((this.parentModule.amount)))); this.amtBtn.setMessage(Text.of("BunkerBust: " + df.format((this.parentModule.amount))));
})); }));

View File

@ -1,5 +1,7 @@
package dev.coredoes.clientmod.modules; package dev.coredoes.clientmod.modules;
import dev.coredoes.clientmod.ClientMod;
import dev.coredoes.clientmod.util.AirTP;
import dev.coredoes.clientmod.util.ConnectionInterface; import dev.coredoes.clientmod.util.ConnectionInterface;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
@ -37,17 +39,21 @@ public class Mate implements Module {
if (!this.enabled) return; if (!this.enabled) return;
doAirTpTo(client, 1332, 80, 1297); AirTP.doAirTp(client, true, 1332, 80, 1297);
try { Thread.sleep(2); } catch (InterruptedException ignored) {} try { Thread.sleep(2); } catch (InterruptedException ignored) {}
doAirTpTo(client, client.player.getX(), client.player.getY(), client.player.getZ() + 40); AirTP.doAirTp(client, true, client.player.getX(), client.player.getY(), client.player.getZ() + 40);
// 1335 80 1339 // 1335 80 1339
BlockPos blockPos = new BlockPos(1335, 80, 1339); BlockPos blockPos = new BlockPos(1335, 80, 1339);
Direction direction = Direction.NORTH; Direction direction = Direction.NORTH;
BlockHitResult blockHitResult = new BlockHitResult(new Vec3d(blockPos.getX(), blockPos.getY(), blockPos.getZ()), direction, blockPos, false); BlockHitResult blockHitResult = new BlockHitResult(new Vec3d(blockPos.getX(), blockPos.getY(), blockPos.getZ()), direction, blockPos, false);
client.interactionManager.interactBlock(client.player, Hand.MAIN_HAND, blockHitResult); client.interactionManager.interactBlock(client.player, Hand.MAIN_HAND, blockHitResult);
// sent back to: 1282 130 1288 // sent back to: 1282 130 1288
ClientMod.moduleManager.getModuleById("Mate").disable();
} }
private static void doAirTpTo(MinecraftClient client, double x, double y, double z) { private static void doAirTpTo(MinecraftClient client, double x, double y, double z) {

View File

@ -2,6 +2,7 @@ package dev.coredoes.clientmod.modules;
import dev.coredoes.clientmod.ClientMod; import dev.coredoes.clientmod.ClientMod;
import dev.coredoes.clientmod.events.ConnectEvent; import dev.coredoes.clientmod.events.ConnectEvent;
import dev.coredoes.clientmod.events.DisconnectEvent;
import dev.coredoes.clientmod.events.PacketEvent; import dev.coredoes.clientmod.events.PacketEvent;
import dev.coredoes.clientmod.events.SendPacketEvent; import dev.coredoes.clientmod.events.SendPacketEvent;
import dev.coredoes.clientmod.hud.HudColor; import dev.coredoes.clientmod.hud.HudColor;
@ -60,6 +61,11 @@ public class PacketFreezer implements Module {
} }
} }
@EventHandler
public void onPacketRecv(PacketEvent.Receive event) {
ClientMod.LOGGER.info("At " + System.currentTimeMillis() + " recv pkt " + event.packet.toString());
}
private void sendAllQueuedPackets(MinecraftClient client) { private void sendAllQueuedPackets(MinecraftClient client) {
if (!this.enabled) { if (!this.enabled) {
ArrayList<Packet<?>> packetQueueClone = this.packets; ArrayList<Packet<?>> packetQueueClone = this.packets;
@ -77,6 +83,12 @@ public class PacketFreezer implements Module {
this.disable(); this.disable();
} }
@EventHandler
public void onDisconnect(DisconnectEvent e) {
this.packets = new ArrayList<>();
this.disable();
}
@EventHandler @EventHandler
public void onSendPacket(SendPacketEvent e) { public void onSendPacket(SendPacketEvent e) {
ClientMod.LOGGER.info("Sending queued packet " + e.packet.toString()); ClientMod.LOGGER.info("Sending queued packet " + e.packet.toString());

View File

@ -0,0 +1,35 @@
package dev.coredoes.clientmod.util;
import net.minecraft.client.MinecraftClient;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
public class AirTP {
public static void doAirTpBuildup(MinecraftClient client, double x, double y, double z) {
// Thanks https://github.com/MeteorDevelopment/meteor-client/pull/3403/files
/*
double a = Math.pow((x - client.player.getX()), 2);
double b = Math.pow((y - client.player.getY()), 2);
double c = Math.pow((z - client.player.getZ()), 2);
double distance = Math.sqrt(a + b + c);
int packetsRequired = (int) Math.ceil(distance / 10);
*/
int packetsRequired = 10;
PlayerMoveC2SPacket uselessPacket = new PlayerMoveC2SPacket.PositionAndOnGround(client.player.getX(), client.player.getY(), client.player.getZ(), client.player.isOnGround());
for (int packetNumber = 1; packetNumber < packetsRequired; packetNumber++) {
((ConnectionInterface)client.getNetworkHandler().getConnection()).sendVolatile(uselessPacket, null);
}
}
public static void doAirTpSlingshot(MinecraftClient client, double x, double y, double z) {
// Now send the real teleport
PlayerMoveC2SPacket actualPacket = new PlayerMoveC2SPacket.PositionAndOnGround(x, y, z, client.player.isOnGround());
((ConnectionInterface)client.getNetworkHandler().getConnection()).sendVolatile(actualPacket, null);
client.player.setPosition(x, y, z);
}
public static void doAirTp(MinecraftClient client, boolean withBuildup, double x, double y, double z) {
if (withBuildup) { doAirTpBuildup(client, x, y, z); }
doAirTpSlingshot(client, x, y, z);
}
}