Skip to content

Commit

Permalink
2.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
tanishisherewithhh committed May 19, 2023
1 parent fb2d4f4 commit e87efa5
Show file tree
Hide file tree
Showing 61 changed files with 4,831 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_mappings=1.19.4+build.2
loader_version=0.14.19

# Mod Properties
mod_version = 2.4.3
mod_version = 2.4.4
maven_group = net.smphack
archives_base_name = smp-hack

Expand Down
56 changes: 56 additions & 0 deletions src/main/java/net/fabricmc/smphack/GeneralConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package net.fabricmc.smphack;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.smphack.Hacks.Freecam.CameraEntity;
import net.fabricmc.smphack.config.ConfigUtil;
import net.fabricmc.smphack.config.ControllersConfig;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import org.lwjgl.glfw.GLFW;

public class GeneralConfig implements ModInitializer {

public static boolean enabled = false;
private static boolean spectator;
public static final KeyBinding FreecamKey = KeyBindingHelper.registerKeyBinding(new KeyBinding("Freecam toggle", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_UNKNOWN, "Hacks Keybind"));


@Override
public void onInitialize() {
ConfigUtil.loadConfig();


ClientTickEvents.START_CLIENT_TICK.register(client -> {
while (FreecamKey.wasPressed()) {
toggleFreecam(client);

}
});
}

public static void toggleFreecam(MinecraftClient client) {
enabled = !enabled;
if (enabled) {
CameraEntity.createCamera(MinecraftClient.getInstance());
} else {
CameraEntity.removeCamera();
}

}

public static ControllersConfig getConfig() {
return ConfigUtil.getConfig();
}

public static boolean isEnabled() {
return enabled;
}

public static boolean isSpectator() {
return spectator;
}

}
178 changes: 178 additions & 0 deletions src/main/java/net/fabricmc/smphack/HUDoverlay.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
package net.fabricmc.smphack;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
import net.fabricmc.smphack.Hacks.AimBot.AutoAim;
import net.fabricmc.smphack.Hacks.AntiHunger.AntiHunger;
import net.fabricmc.smphack.Hacks.AutoSprint.AutoSprint;
import net.fabricmc.smphack.Hacks.Autoclicker.Autoclicker;
import net.fabricmc.smphack.Hacks.CrystalAura.EndCrystalBreaker;
import net.fabricmc.smphack.Hacks.Fly.Fly;
import net.fabricmc.smphack.Hacks.Jesus.jesus;
import net.fabricmc.smphack.Hacks.Killaura.KillAura;
import net.fabricmc.smphack.Hacks.Nofall.Nofall;
import net.fabricmc.smphack.Hacks.Scaffold.Scaffold;
import net.fabricmc.smphack.Hacks.Speed.Speed;
import net.fabricmc.smphack.Hacks.SpeedMine.SpeedMine;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Formatting;
import net.minecraft.util.math.MathHelper;
import org.lwjgl.glfw.GLFW;


// I know no one is going to check the source code but for the few people who do and might need help, I am glad for you;
// This is not supposed to be a full on hack client (atleast I think so)
// Use this for fun with your friends and on shitty servers with shitty AntiCheat.

@Environment(EnvType.CLIENT)
public class HUDoverlay implements HudRenderCallback {
Fly fly = new Fly();
Scaffold scaffold = new Scaffold();
Nofall noFall = new Nofall();
Speed speed = new Speed();
public static jesus jes = new jesus();
Autoclicker autoclicker=new Autoclicker();
EndCrystalBreaker endCrystalBreaker = new EndCrystalBreaker();
KillAura killAura = new KillAura();
AutoAim Aimbot = new AutoAim();
AutoSprint autoSprint = new AutoSprint();
AntiHunger antiHunger=new AntiHunger();
rendertext text = new rendertext();

int tw = 10;
int th = 10;
public static final KeyBinding FlyKey = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"Fly toggle",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_Z,
"Hacks Keybind"
));

public static final KeyBinding Nofallkey = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"Nofall toggle",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_N,
"Hacks Keybind"
));

public static final KeyBinding Jesuskey = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"Jesus toggle",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_K,
"Hacks Keybind"
));
public static final KeyBinding SpeedKey = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"Speed toggle",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_V,
"Hacks Keybind"
));

public static final KeyBinding AutoCrystalBreakerKey = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"AutoCrystal Breaker toggle",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_UNKNOWN,
"Hacks Keybind"
));

public static final KeyBinding KillauraKey = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"Killaura toggle",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_UNKNOWN,
"Hacks Keybind"
));

public static final KeyBinding AimBotKey = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"AimBot toggle",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_UNKNOWN,
"Hacks Keybind"
));
public static final KeyBinding ScaffoldKey = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"Scaffold toggle",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_Y,
"Hacks Keybind"
));
public static final KeyBinding AutoClickerKey = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"AutoClicker for autocrystal",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_UNKNOWN,
"Smphack Mod"
));
public static final KeyBinding ConfigScreenOpenerKey = KeyBindingHelper.registerKeyBinding(new KeyBinding(
"Smphack Config Opener",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_RIGHT_SHIFT,
"Smphack Mod"
));


MinecraftClient mc = MinecraftClient.getInstance();

private final double EntityX = -30;
private final double EntityY = 5;

@Override
public void onHudRender(MatrixStack matrices, float tickDelta) {
//To avoid stupid crashes
if (mc != null )
{
assert mc.player != null;
assert MinecraftClient.getInstance().world != null;


//To stop rendering if debug screen or F3 menu is enabled
if (mc.options.debugEnabled) {return;}
//To avoid null crashes
if (Formatting.RED.getColorValue() == null || Formatting.BLUE.getColorValue() == null || Formatting.WHITE.getColorValue() == null || Formatting.GREEN.getColorValue() == null)
{
return;
}
TextRenderer font = mc.textRenderer;
ClientPlayerEntity player= MinecraftClient.getInstance().player;
if(font==null || player==null){return;}
SpeedMine Speedmine = new SpeedMine();
Speedmine.toggled();
boolean showMuppet= GeneralConfig.getConfig().getShowMuppet();
MinecraftClient mc=MinecraftClient.getInstance();

//SHOW MUPPET
if (showMuppet) {
float yaw = MathHelper.wrapDegrees(player.prevYaw + (player.getYaw() - player.prevYaw) * mc.getTickDelta());
float pitch = player.getPitch();
InventoryScreen.drawEntity(matrices, (int) (EntityX + MinecraftClient.getInstance().getWindow().getScaledWidth()), (int) EntityY + 80, (int) 25.0, -yaw, -pitch, player);
}

text.run();

text.renderFreecam(matrices,tw,th,font);
text.renderFlyMode(matrices,tw,th,font,fly);
text.renderJesus(matrices,tw,th,font,jes);
text.renderNofall(matrices,tw,th,font,noFall);
text.renderAutoCrystalBreaker(matrices,tw,th,font,endCrystalBreaker);
text.renderKillAura(matrices,tw,th,font,killAura);
text.renderSpeed(matrices,tw,th,font,speed);
text.renderAutoClicker(matrices,tw,th,font);
text.renderAimBot(matrices,tw,th,font,Aimbot);
text.renderScaffold(matrices,th,tw,font, scaffold);

text.AutoSprint(autoSprint);
text.AntiHunger(antiHunger);
text.AutoClicker(autoclicker);
text.NoWeather();
text.Fullbright();


}
}
}

89 changes: 89 additions & 0 deletions src/main/java/net/fabricmc/smphack/Hacks/AimBot/AutoAim.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package net.fabricmc.smphack.Hacks.AimBot;

import net.fabricmc.smphack.MainGui;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.decoration.ArmorStandEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.RangedWeaponItem;
import net.minecraft.util.math.Vec3d;

import static net.fabricmc.smphack.Hacks.AimBot.WorldUtils.mc;

public class AutoAim extends MainGui {

@Override
public void toggled() {
enabled=!enabled;
}
private LivingEntity getNearestLivingEntity(PlayerEntity player) {
double range = 64.0D;
Vec3d playerPos = player.getPos();
LivingEntity nearestEntity = null;
double nearestDistance = Double.MAX_VALUE;

assert MinecraftClient.getInstance().world != null;
for (Entity entity : MinecraftClient.getInstance().world.getEntities()) {
if (!(entity instanceof ArmorStandEntity)) {
if (!(entity instanceof LivingEntity) || entity == player) continue;

double distance = entity.getPos().distanceTo(playerPos);

if (distance < range && distance < nearestDistance) {
// Check if there is a clear line of sight to the target
if (player.canSee((LivingEntity) entity)) {
nearestDistance = distance;
nearestEntity = (LivingEntity) entity;
}
}
}
}
return nearestEntity;
}
@Override
public void update() {
MinecraftClient client = MinecraftClient.getInstance();
assert mc.player != null;
if (!(mc.player.getMainHandStack().getItem() instanceof RangedWeaponItem) || !mc.player.isUsingItem())
return;
if (client.player == null) {return;}

PlayerEntity player = client.player;

LivingEntity target = getNearestLivingEntity(player);
if (target == null) {
return;
}
assert mc.player != null;
float velocity = (72000 - mc.player.getItemUseTimeLeft()) / 20F;
velocity = Math.min(1f, (velocity * velocity + velocity * 2) / 3);

// set position to aim at
Vec3d newTargetVec = target.getPos().add(target.getVelocity());
double d = mc.player.getEyePos().distanceTo(target.getBoundingBox().offset(target.getVelocity()).getCenter());
double x = newTargetVec.x + (newTargetVec.x - target.getX()) * d - mc.player.getX();
double y = newTargetVec.y + (newTargetVec.y - target.getY()) * d + target.getHeight() * 0.5 - mc.player.getY() - mc.player.getEyeHeight(mc.player.getPose());
double z = newTargetVec.z + (newTargetVec.z - target.getZ()) * d - mc.player.getZ();

// set yaw
mc.player.setYaw((float) Math.toDegrees(Math.atan2(z, x)) - 90);

// calculate needed pitch
double hDistance = Math.sqrt(x * x + z * z);
double hDistanceSq = hDistance * hDistance;
float g = 0.006F;
float velocitySq = velocity * velocity;
float velocityPow4 = velocitySq * velocitySq;
float neededPitch = (float) -Math.toDegrees(Math.atan((velocitySq - Math
.sqrt(velocityPow4 - g * (g * hDistanceSq + 2 * y * velocitySq)))
/ (g * hDistance)));

// set pitch
if (Float.isNaN(neededPitch)) {
WorldUtils.facePos(target.getX(), target.getY() + target.getHeight() / 2 -2.25f, target.getZ());
} else {
mc.player.setPitch(neededPitch-2f);
}
}
}
31 changes: 31 additions & 0 deletions src/main/java/net/fabricmc/smphack/Hacks/AimBot/WorldUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package net.fabricmc.smphack.Hacks.AimBot;

import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.MathHelper;

//Credits: Bleachhack
public class WorldUtils {
protected static final MinecraftClient mc = MinecraftClient.getInstance();
public static void facePos(double x, double y, double z) {
assert mc.player != null;
float[] rot = getViewingRotation(mc.player, x, y, z);

mc.player.setYaw(mc.player.getYaw() + MathHelper.wrapDegrees(rot[0] - mc.player.getYaw()));
mc.player.setPitch(mc.player.getPitch() + MathHelper.wrapDegrees(rot[1] - mc.player.getPitch()));
}


public static float[] getViewingRotation(Entity entity, double x, double y, double z) {
double diffX = x - entity.getX();
double diffY = y - entity.getEyeY();
double diffZ = z - entity.getZ();

double diffXZ = Math.sqrt(diffX * diffX + diffZ * diffZ);

return new float[] {
(float) Math.toDegrees(Math.atan2(diffZ, diffX)) - 90f,
(float) -Math.toDegrees(Math.atan2(diffY, diffXZ)) };
}

}
Loading

0 comments on commit e87efa5

Please sign in to comment.