-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Delete src/main directory * Autoclicker
- Loading branch information
1 parent
9c26b52
commit ec185b3
Showing
23 changed files
with
745 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
src/main/java/net/fabricmc/smphack/Hacks/AntiHunger/AntiHunger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package net.fabricmc.smphack.Hacks.AntiHunger; | ||
|
||
import net.fabricmc.smphack.GeneralConfig; | ||
import net.fabricmc.smphack.MainGui; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.network.Packet; | ||
import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket; | ||
|
||
import java.util.Objects; | ||
|
||
public class AntiHunger extends MainGui { | ||
|
||
private MinecraftClient mc = MinecraftClient.getInstance(); | ||
private int sprintTick = 0; | ||
private boolean isSprinting = false; | ||
private int walkTick = 0; | ||
private boolean isWalking = false; | ||
boolean AntiHunger; | ||
|
||
@Override | ||
public void toggled() | ||
{ | ||
AntiHunger= GeneralConfig.getConfig().getAntiHunger(); | ||
if (AntiHunger) | ||
{ | ||
update(); | ||
} | ||
|
||
} | ||
|
||
|
||
@Override | ||
public void update() { | ||
if (mc.player == null) return; | ||
|
||
// check if the player is sprinting | ||
if (mc.options.forwardKey.isPressed() && !mc.player.isSprinting() && mc.player.getHungerManager().getFoodLevel() > 6) { | ||
// send player start sprinting packet | ||
sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.START_SPRINTING)); | ||
sprintTick = 0; | ||
isSprinting = true; | ||
} else if (mc.player.isSprinting()) { | ||
sprintTick++; | ||
if (sprintTick >= 10) { | ||
// slow down hunger every 10 ticks while sprinting | ||
mc.player.getHungerManager().addExhaustion(0.06f); | ||
sprintTick = 0; | ||
} | ||
if (!mc.options.forwardKey.isPressed() || mc.player.getHungerManager().getFoodLevel() <= 6) { | ||
// send player stop sprinting packet | ||
sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.STOP_SPRINTING)); | ||
isSprinting = false; | ||
} | ||
} | ||
|
||
// check if the player is walking | ||
if ((mc.options.forwardKey.isPressed() || mc.options.leftKey.isPressed() || mc.options.rightKey.isPressed() || mc.options.backKey.isPressed()) | ||
&& !mc.player.isSprinting() && mc.player.getHungerManager().getFoodLevel() > 6) { | ||
walkTick = 0; | ||
isWalking = true; | ||
} else if (isWalking) { | ||
walkTick++; | ||
if (walkTick >= 40) { | ||
// slow down hunger every 40 ticks while walking | ||
mc.player.getHungerManager().addExhaustion(0.06f); | ||
walkTick = 0; | ||
} | ||
if (!mc.options.forwardKey.isPressed() && !mc.options.leftKey.isPressed() && !mc.options.rightKey.isPressed() && !mc.options.backKey.isPressed() | ||
|| mc.player.getHungerManager().getFoodLevel() <= 6) { | ||
isWalking = false; | ||
} | ||
} | ||
} | ||
|
||
private void sendPacket(Packet<?> packet) { | ||
Objects.requireNonNull(mc.getNetworkHandler()).sendPacket(packet); | ||
} | ||
} | ||
|
21 changes: 21 additions & 0 deletions
21
src/main/java/net/fabricmc/smphack/Hacks/AutoSprint/AutoSprint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package net.fabricmc.smphack.Hacks.AutoSprint; | ||
|
||
import net.fabricmc.smphack.GeneralConfig; | ||
import net.fabricmc.smphack.MainGui; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.entity.Entity; | ||
|
||
public class AutoSprint extends MainGui { | ||
|
||
MinecraftClient mc = MinecraftClient.getInstance(); | ||
boolean AutoSprint; | ||
|
||
|
||
@Override | ||
public void update() { | ||
AutoSprint= GeneralConfig.getConfig().getAutoSprint(); | ||
assert mc.player != null; | ||
Entity e = mc.player.getRootVehicle(); | ||
e.setSprinting(AutoSprint); | ||
} | ||
} |
Oops, something went wrong.