mirror of
https://github.com/Wurst-Imperium/Wurst7.git
synced 2024-09-20 01:12:13 +02:00
Add activation chance slider to FastBreak
This commit is contained in:
parent
c967e02262
commit
04df20e3b9
@ -7,6 +7,8 @@
|
||||
*/
|
||||
package net.wurstclient.hacks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket.Action;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@ -18,6 +20,8 @@ import net.wurstclient.events.UpdateListener;
|
||||
import net.wurstclient.hack.Hack;
|
||||
import net.wurstclient.mixinterface.IClientPlayerInteractionManager;
|
||||
import net.wurstclient.settings.CheckboxSetting;
|
||||
import net.wurstclient.settings.SliderSetting;
|
||||
import net.wurstclient.settings.SliderSetting.ValueDisplay;
|
||||
|
||||
@SearchTags({"FastMine", "SpeedMine", "SpeedyGonzales", "fast break",
|
||||
"fast mine", "speed mine", "speedy gonzales", "NoBreakDelay",
|
||||
@ -25,15 +29,30 @@ import net.wurstclient.settings.CheckboxSetting;
|
||||
public final class FastBreakHack extends Hack
|
||||
implements UpdateListener, BlockBreakingProgressListener
|
||||
{
|
||||
private final SliderSetting activationChance = new SliderSetting(
|
||||
"Activation chance",
|
||||
"Only FastBreaks some of the blocks you break with the given chance,"
|
||||
+ " which makes it harder for anti-cheat plugins to detect.\n\n"
|
||||
+ "This setting does nothing if Legit mode is enabled.",
|
||||
1, 0, 1, 0.01, ValueDisplay.PERCENTAGE);
|
||||
|
||||
private final CheckboxSetting legitMode = new CheckboxSetting("Legit mode",
|
||||
"Only removes the delay between breaking blocks, without speeding up the breaking process itself.\n\n"
|
||||
+ "This is slower, but usually bypasses anti-cheat plugins. Use it if regular FastBreak is not working.",
|
||||
"Only removes the delay between breaking blocks, without speeding up"
|
||||
+ " the breaking process itself.\n\n"
|
||||
+ "This is much slower, but great at bypassing anti-cheat plugins."
|
||||
+ " Use this if regular FastBreak is not working and the Activation"
|
||||
+ " chance slider doesn't help.",
|
||||
false);
|
||||
|
||||
private final Random random = new Random();
|
||||
private BlockPos lastBlockPos;
|
||||
private boolean fastBreakBlock;
|
||||
|
||||
public FastBreakHack()
|
||||
{
|
||||
super("FastBreak");
|
||||
setCategory(Category.BLOCKS);
|
||||
addSetting(activationChance);
|
||||
addSetting(legitMode);
|
||||
}
|
||||
|
||||
@ -57,6 +76,7 @@ public final class FastBreakHack extends Hack
|
||||
{
|
||||
EVENTS.remove(UpdateListener.class, this);
|
||||
EVENTS.remove(BlockBreakingProgressListener.class, this);
|
||||
lastBlockPos = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -76,8 +96,17 @@ public final class FastBreakHack extends Hack
|
||||
if(im.getCurrentBreakingProgress() >= 1)
|
||||
return;
|
||||
|
||||
Action action = PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK;
|
||||
BlockPos blockPos = event.getBlockPos();
|
||||
if(!blockPos.equals(lastBlockPos))
|
||||
{
|
||||
lastBlockPos = blockPos;
|
||||
fastBreakBlock = random.nextDouble() <= activationChance.getValue();
|
||||
}
|
||||
|
||||
if(!fastBreakBlock)
|
||||
return;
|
||||
|
||||
Action action = PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK;
|
||||
Direction direction = event.getDirection();
|
||||
im.sendPlayerActionC2SPacket(action, blockPos, direction);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user