auto Sprint and Clock
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package org.saturnclient.modules.interfaces;
|
||||
|
||||
public interface AutoSprintInterface {
|
||||
|
||||
boolean hasPlayer();
|
||||
|
||||
boolean hasNetwork();
|
||||
|
||||
boolean isForwardPressed();
|
||||
|
||||
boolean isBackPressed();
|
||||
|
||||
boolean isSneaking();
|
||||
|
||||
boolean hasHorizontalCollision();
|
||||
|
||||
boolean isUsingItem();
|
||||
|
||||
void setSprinting(boolean sprinting);
|
||||
}
|
||||
+16
-12
@@ -1,36 +1,40 @@
|
||||
package org.saturnclient.modules.mods;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import org.saturnclient.modules.Module;
|
||||
import org.saturnclient.modules.ModuleDetails;
|
||||
import org.saturnclient.saturnclient.SaturnClient;
|
||||
import org.saturnclient.modules.interfaces.AutoSprintInterface;
|
||||
import org.saturnclient.config.manager.Property;
|
||||
|
||||
public class AutoSprint extends Module {
|
||||
|
||||
private static Property<Boolean> enabled = Property.bool(false);
|
||||
|
||||
public AutoSprint() {
|
||||
private final AutoSprintInterface minecraft;
|
||||
|
||||
public AutoSprint(AutoSprintInterface minecraft) {
|
||||
super(
|
||||
new ModuleDetails("Auto Sprint", "sprint")
|
||||
.description("Makes the player always sprint")
|
||||
.tags("Movement")
|
||||
.version("v0.1.0"),
|
||||
enabled.named("Enabled"));
|
||||
|
||||
this.minecraft = minecraft;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
if (SaturnClient.client.player == null || SaturnClient.client.getNetworkHandler() == null) {
|
||||
if (!minecraft.hasPlayer() || !minecraft.hasNetwork()) {
|
||||
return;
|
||||
}
|
||||
if (SaturnClient.client.options.forwardKey.isPressed()
|
||||
&& !SaturnClient.client.options.backKey.isPressed()
|
||||
&& !SaturnClient.client.player.isSneaking()
|
||||
&& !SaturnClient.client.player.horizontalCollision
|
||||
&& !SaturnClient.client.player.isUsingItem()) {
|
||||
|
||||
Objects.requireNonNull(SaturnClient.client.player).setSprinting(true);
|
||||
if (minecraft.isForwardPressed()
|
||||
&& !minecraft.isBackPressed()
|
||||
&& !minecraft.isSneaking()
|
||||
&& !minecraft.hasHorizontalCollision()
|
||||
&& !minecraft.isUsingItem()) {
|
||||
|
||||
minecraft.setSprinting(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,4 +47,4 @@ public class AutoSprint extends Module {
|
||||
public void onEnabled(boolean e) {
|
||||
enabled.value = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
package org.saturnclient.impl;
|
||||
|
||||
import org.saturnclient.impl.modules.ArmorDisplayFabric;
|
||||
import org.saturnclient.modules.Module;
|
||||
import org.saturnclient.modules.ModManager.ModuleProvider;
|
||||
import org.saturnclient.modules.mods.*;
|
||||
import org.saturnclient.impl.modules.*;
|
||||
|
||||
public class FabricModuleProvider implements ModuleProvider {
|
||||
public static Module[] MODS = {
|
||||
new ArmorDisplay(new ArmorDisplayFabric())
|
||||
new ArmorDisplay(new ArmorDisplayFabric()),
|
||||
new AutoSprint(new AutoSprintFabric())
|
||||
};
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.saturnclient.impl.modules;
|
||||
|
||||
import org.saturnclient.modules.interfaces.AutoSprintInterface;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
|
||||
public class AutoSprintFabric implements AutoSprintInterface {
|
||||
|
||||
private final MinecraftClient mc = MinecraftClient.getInstance();
|
||||
|
||||
@Override
|
||||
public boolean hasPlayer() {
|
||||
return mc.player != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNetwork() {
|
||||
return mc.getNetworkHandler() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isForwardPressed() {
|
||||
return mc.options.forwardKey.isPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBackPressed() {
|
||||
return mc.options.backKey.isPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSneaking() {
|
||||
return mc.player.isSneaking();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasHorizontalCollision() {
|
||||
return mc.player.horizontalCollision;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsingItem() {
|
||||
return mc.player.isUsingItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSprinting(boolean sprinting) {
|
||||
mc.player.setSprinting(sprinting);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user