mirror of
https://github.com/Wurst-Imperium/Wurst7.git
synced 2024-09-20 01:12:13 +02:00
Use Gaussian randomness in AntiAFK timer
This commit is contained in:
parent
bdb607ce94
commit
6359b40a89
@ -8,7 +8,6 @@
|
|||||||
package net.wurstclient.hacks;
|
package net.wurstclient.hacks;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
|
||||||
@ -16,6 +15,7 @@ import net.minecraft.client.render.GameRenderer;
|
|||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.util.math.random.Random;
|
||||||
import net.wurstclient.Category;
|
import net.wurstclient.Category;
|
||||||
import net.wurstclient.SearchTags;
|
import net.wurstclient.SearchTags;
|
||||||
import net.wurstclient.ai.PathFinder;
|
import net.wurstclient.ai.PathFinder;
|
||||||
@ -63,7 +63,7 @@ public final class AntiAfkHack extends Hack
|
|||||||
ValueDisplay.DECIMAL.withPrefix("\u00b1").withSuffix("s"));
|
ValueDisplay.DECIMAL.withPrefix("\u00b1").withSuffix("s"));
|
||||||
|
|
||||||
private int timer;
|
private int timer;
|
||||||
private Random random = new Random();
|
private Random random = Random.createLocal();
|
||||||
private BlockPos start;
|
private BlockPos start;
|
||||||
private BlockPos nextBlock;
|
private BlockPos nextBlock;
|
||||||
|
|
||||||
@ -112,15 +112,6 @@ public final class AntiAfkHack extends Hack
|
|||||||
PathProcessor.releaseControls();
|
PathProcessor.releaseControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTimer()
|
|
||||||
{
|
|
||||||
int baseTime = (int)(waitTime.getValue() * 20);
|
|
||||||
int randTime = (int)(waitTimeRand.getValue() * 20);
|
|
||||||
int randOffset = random.nextInt(randTime * 2 + 1) - randTime;
|
|
||||||
randOffset = Math.max(randOffset, -baseTime);
|
|
||||||
timer = baseTime + randOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUpdate()
|
public void onUpdate()
|
||||||
{
|
{
|
||||||
@ -176,7 +167,7 @@ public final class AntiAfkHack extends Hack
|
|||||||
pathFinder = new RandomPathFinder(
|
pathFinder = new RandomPathFinder(
|
||||||
randomize(start, aiRange.getValueI(), true));
|
randomize(start, aiRange.getValueI(), true));
|
||||||
|
|
||||||
// wait 2 - 3 seconds (40 - 60 ticks)
|
// wait for timer
|
||||||
if(processor.isDone())
|
if(processor.isDone())
|
||||||
{
|
{
|
||||||
PathProcessor.releaseControls();
|
PathProcessor.releaseControls();
|
||||||
@ -222,6 +213,15 @@ public final class AntiAfkHack extends Hack
|
|||||||
pathCmd.isDepthTest());
|
pathCmd.isDepthTest());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setTimer()
|
||||||
|
{
|
||||||
|
int baseTime = (int)(waitTime.getValue() * 20);
|
||||||
|
double randTime = waitTimeRand.getValue() * 20;
|
||||||
|
int randOffset = (int)(random.nextGaussian() * randTime);
|
||||||
|
randOffset = Math.max(randOffset, -baseTime);
|
||||||
|
timer = baseTime + randOffset;
|
||||||
|
}
|
||||||
|
|
||||||
private BlockPos randomize(BlockPos pos, int range, boolean includeY)
|
private BlockPos randomize(BlockPos pos, int range, boolean includeY)
|
||||||
{
|
{
|
||||||
int x = random.nextInt(2 * range + 1) - range;
|
int x = random.nextInt(2 * range + 1) - range;
|
||||||
|
Loading…
Reference in New Issue
Block a user