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

Add reach slider

This commit is contained in:
Alexander01998 2021-02-28 13:21:43 +01:00
parent f8dc42addd
commit d283fe82e9
3 changed files with 20 additions and 23 deletions

View File

@ -10,25 +10,24 @@ package net.wurstclient.hacks;
import net.wurstclient.Category;
import net.wurstclient.SearchTags;
import net.wurstclient.hack.Hack;
import net.wurstclient.settings.SliderSetting;
import net.wurstclient.settings.SliderSetting.ValueDisplay;
@SearchTags({"range"})
public final class ReachHack extends Hack
{
private final SliderSetting range =
new SliderSetting("Range", 6, 1, 10, 0.05, ValueDisplay.DECIMAL);
public ReachHack()
{
super("Reach", "Allows you to reach further.");
setCategory(Category.OTHER);
addSetting(range);
}
@Override
public void onEnable()
public float getReachDistance()
{
IMC.getInteractionManager().setOverrideReach(true);
}
@Override
public void onDisable()
{
IMC.getInteractionManager().setOverrideReach(false);
return range.getValueF();
}
}

View File

@ -29,8 +29,10 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.wurstclient.WurstClient;
import net.wurstclient.event.EventManager;
import net.wurstclient.events.BlockBreakingProgressListener.BlockBreakingProgressEvent;
import net.wurstclient.hack.HackList;
import net.wurstclient.mixinterface.IClientPlayerInteractionManager;
@Mixin(ClientPlayerInteractionManager.class)
@ -50,8 +52,6 @@ public abstract class ClientPlayerInteractionManagerMixin
@Shadow
private int blockBreakingCooldown;
private boolean overrideReach;
@Inject(at = {@At(value = "INVOKE",
target = "Lnet/minecraft/client/network/ClientPlayerEntity;getEntityId()I",
ordinal = 0)},
@ -70,8 +70,11 @@ public abstract class ClientPlayerInteractionManagerMixin
cancellable = true)
private void onGetReachDistance(CallbackInfoReturnable<Float> ci)
{
if(overrideReach)
ci.setReturnValue(10F);
HackList hax = WurstClient.INSTANCE.getHax();
if(hax == null || !hax.reachHack.isEnabled())
return;
ci.setReturnValue(hax.reachHack.getReachDistance());
}
@Inject(at = {@At("HEAD")},
@ -79,8 +82,11 @@ public abstract class ClientPlayerInteractionManagerMixin
cancellable = true)
private void hasExtendedReach(CallbackInfoReturnable<Boolean> cir)
{
if(overrideReach)
cir.setReturnValue(true);
HackList hax = WurstClient.INSTANCE.getHax();
if(hax == null || !hax.reachHack.isEnabled())
return;
cir.setReturnValue(true);
}
@Override
@ -134,12 +140,6 @@ public abstract class ClientPlayerInteractionManagerMixin
sendPlayerAction(action, blockPos, direction);
}
@Override
public void setOverrideReach(boolean overrideReach)
{
this.overrideReach = overrideReach;
}
@Shadow
private void sendPlayerAction(
PlayerActionC2SPacket.Action playerActionC2SPacket$Action_1,

View File

@ -33,6 +33,4 @@ public interface IClientPlayerInteractionManager
BlockPos blockPos, Direction direction);
public void setBlockHitDelay(int delay);
public void setOverrideReach(boolean overrideReach);
}