Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
❤️ skid stealer because someone asked
Browse files Browse the repository at this point in the history
someone wanted mlegend to do this skull it literally took me 5 seconds
  • Loading branch information
Tryflle committed Feb 7, 2024
1 parent e8f2e99 commit 932bcce
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 41 deletions.
144 changes: 106 additions & 38 deletions src/main/java/dev/stormy/client/module/modules/player/Stealer.java
Original file line number Diff line number Diff line change
@@ -1,66 +1,134 @@
package dev.stormy.client.module.modules.player;

import dev.stormy.client.module.Module;
import dev.stormy.client.module.setting.impl.DescriptionSetting;
import dev.stormy.client.module.setting.impl.DoubleSliderSetting;
import dev.stormy.client.utils.client.ClientUtils;
import dev.stormy.client.utils.player.PlayerUtils;
import dev.stormy.client.module.setting.impl.TickSetting;
import dev.stormy.client.utils.math.MathUtils;
import dev.stormy.client.utils.math.TimerUtils;
import dev.stormy.client.utils.player.ItemUtils;
import me.tryfle.stormy.events.UpdateEvent;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.entity.EntityList;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.util.BlockPos;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.weavemc.loader.api.event.SubscribeEvent;
import net.weavemc.loader.api.event.TickEvent;

import java.util.ArrayList;
import java.util.List;

/**
* @author sassan
* 24.11.2023, 2023
*/
public class Stealer extends Module {
public static DoubleSliderSetting delay;

private final List<BlockPos> chests = new ArrayList<>();
public static TickSetting menuCheck, ignoreTrash;

public Stealer() {
super("Stealer", ModuleCategory.Player, 0);
this.registerSetting(new DescriptionSetting("No logic yet"));
this.registerSetting(delay = new DoubleSliderSetting("Delay", 0, 1000, 0, 1000, 1));
super("Stealer", Module.ModuleCategory.Player, 0);
this.registerSetting(delay = new DoubleSliderSetting("Delay", 100, 150, 0, 500, 50));
this.registerSetting(menuCheck = new TickSetting("Menu Check", true));
this.registerSetting(ignoreTrash = new TickSetting("Ignore Trash", true));
}

@Override
public void onEnable() {
chests.clear();
private final TimerUtils stopwatch = new TimerUtils();
private long nextClick;
private int lastClick;
private int lastSteal;
private static boolean userInterface;

@SubscribeEvent
public void onUpdate(UpdateEvent event) {
if (!event.isPre()) return;
if (mc.currentScreen instanceof GuiChest) {
final ContainerChest container = (ContainerChest) mc.thePlayer.openContainer;
final String containerName = container.getLowerChestInventory().getDisplayName().getUnformattedText();

if (menuCheck.isToggled() && inGUI()) {
return;
}

if (!this.stopwatch.hasReached(this.nextClick)) {
return;
}

this.lastSteal++;

for (int i = 0; i < container.inventorySlots.size(); i++) {
final ItemStack stack = container.getLowerChestInventory().getStackInSlot(i);

if (stack == null || this.lastSteal <= 1) {
continue;
}

if (ignoreTrash.isToggled() && !ItemUtils.useful(stack)) {
continue;
}

this.nextClick = Math.round(MathUtils.randomInt((int)delay.getInputMin(), (int)delay.getInputMax()));
mc.playerController.windowClick(container.windowId, i, 0, 1, mc.thePlayer);
this.stopwatch.reset();
this.lastClick = 0;
if (this.nextClick > 0) return;
}

this.lastClick++;

if (this.lastClick > 1) {
mc.thePlayer.closeScreen();
}
} else {
this.lastClick = 0;
this.lastSteal = 0;
}
}

@SubscribeEvent
public void onTick(TickEvent e) {
if(ClientUtils.currentScreenMinecraft()) return;
public void onUpdate2(UpdateEvent event) {
if (!event.isPre()) return;

if (!PlayerUtils.isPlayerInGame()) return;
userInterface = false;

if (mc.thePlayer.openContainer instanceof ContainerChest) {
ContainerChest chest = (ContainerChest) mc.thePlayer.openContainer;
if (mc.currentScreen instanceof GuiChest) {
final ContainerChest container = (ContainerChest) mc.thePlayer.openContainer;

if (chests.contains(chest.getLowerChestInventory().getName())) {
for (int i = 0; i < chest.getLowerChestInventory().getSizeInventory(); i++) {
if (chest.getLowerChestInventory().getStackInSlot(i) != null) {
if (!isInventoryFull()) {
mc.playerController.windowClick(chest.windowId, i, 0, 1, mc.thePlayer);
}
int confidence = 0, totalSlots = 0, amount = 0;

for (final Slot slot : container.inventorySlots) {
if (slot.getHasStack() && amount++ <= 26) {
final ItemStack itemStack = slot.getStack();

if (itemStack == null) {
continue;
}

final String name = itemStack.getDisplayName();
final String expectedName = expectedName(itemStack);
final String strippedName = name.toLowerCase().replace(" ", "");
final String strippedExpectedName = expectedName.toLowerCase().replace(" ", "");

if (strippedName.contains(strippedExpectedName)) {
confidence -= 0.1;
} else {
confidence++;
}

totalSlots++;
}
}

userInterface = (float) confidence / (float) totalSlots > 0.5f;
}
};

public static boolean inGUI() {
return userInterface;
}

private boolean isInventoryFull() {
for (int i = 9; i < 36; i++) {
if (mc.thePlayer.inventoryContainer.getSlot(i).getStack() == null) {
return false;
}
private String expectedName(final ItemStack stack) {
String s = (StatCollector.translateToLocal(stack.getUnlocalizedName() + ".name")).trim();
final String s1 = EntityList.getStringFromID(stack.getMetadata());

if (s1 != null) {
s = s + " " + StatCollector.translateToLocal("entity." + s1 + ".name");
}

return true;
return s;
}
}

}
6 changes: 3 additions & 3 deletions src/main/java/dev/stormy/client/utils/math/MathUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/**
* @author sassan
* 23.11.2023, 2023
* hi sassan
*/
public class MathUtils implements IMethods {
public static Random rand() {
Expand All @@ -21,8 +22,7 @@ public static double round(double n, int d) {
}
}

// will be implemented soon
public static int randomInt(double inputMin, double v) {
return (int) (Math.random() * (v - inputMin) + inputMin);
public static int randomInt(double inputMin, double inputMax) {
return (int) (Math.random() * (inputMax - inputMin) + inputMin);
}
}

0 comments on commit 932bcce

Please sign in to comment.