0
0
mirror of https://github.com/Wurst-Imperium/Wurst7.git synced 2024-09-20 01:12:13 +02:00

add delay setting to AutoTotemHack

This commit is contained in:
pcm1k 2022-10-06 02:26:38 -04:00
parent 970e423cd6
commit 4abd077c01

View File

@ -18,6 +18,8 @@ import net.wurstclient.events.UpdateListener;
import net.wurstclient.hack.Hack; import net.wurstclient.hack.Hack;
import net.wurstclient.mixinterface.IClientPlayerInteractionManager; import net.wurstclient.mixinterface.IClientPlayerInteractionManager;
import net.wurstclient.settings.CheckboxSetting; import net.wurstclient.settings.CheckboxSetting;
import net.wurstclient.settings.SliderSetting;
import net.wurstclient.settings.SliderSetting.ValueDisplay;
@SearchTags({"auto totem"}) @SearchTags({"auto totem"})
public final class AutoTotemHack extends Hack implements UpdateListener public final class AutoTotemHack extends Hack implements UpdateListener
@ -25,14 +27,20 @@ public final class AutoTotemHack extends Hack implements UpdateListener
private final CheckboxSetting showCounter = new CheckboxSetting( private final CheckboxSetting showCounter = new CheckboxSetting(
"Show totem counter", "Displays the number of totems you have.", true); "Show totem counter", "Displays the number of totems you have.", true);
private final SliderSetting delay = new SliderSetting("Delay",
"Amount of ticks to wait before moving the totem.", 0, 0, 20, 1,
ValueDisplay.INTEGER);
private int nextTickSlot; private int nextTickSlot;
private int totems; private int totems;
private int timer;
public AutoTotemHack() public AutoTotemHack()
{ {
super("AutoTotem"); super("AutoTotem");
setCategory(Category.COMBAT); setCategory(Category.COMBAT);
addSetting(showCounter); addSetting(showCounter);
addSetting(delay);
} }
@Override @Override
@ -56,6 +64,7 @@ public final class AutoTotemHack extends Hack implements UpdateListener
{ {
nextTickSlot = -1; nextTickSlot = -1;
totems = 0; totems = 0;
timer = -1;
EVENTS.add(UpdateListener.class, this); EVENTS.add(UpdateListener.class, this);
} }
@ -68,6 +77,9 @@ public final class AutoTotemHack extends Hack implements UpdateListener
@Override @Override
public void onUpdate() public void onUpdate()
{ {
int timerSaved = timer;
timer = -1;
finishMovingTotem(); finishMovingTotem();
PlayerInventory inventory = MC.player.getInventory(); PlayerInventory inventory = MC.player.getInventory();
@ -85,7 +97,17 @@ public final class AutoTotemHack extends Hack implements UpdateListener
return; return;
if(nextTotemSlot != -1) if(nextTotemSlot != -1)
moveTotem(nextTotemSlot, offhandStack); {
timer = timerSaved;
if(timer == -1)
timer = delay.getValueI();
if(timer == 0)
moveTotem(nextTotemSlot, offhandStack);
timer--;
}
} }
private void moveTotem(int nextTotemSlot, ItemStack offhandStack) private void moveTotem(int nextTotemSlot, ItemStack offhandStack)