Начинающий
- Статус
- Оффлайн
- Регистрация
- 8 Авг 2024
- Сообщения
- 454
- Реакции
- 1
- Выберите загрузчик игры
- Forge
- OptiFine
- ForgeOptiFine
- Прочие моды
Стрефы для ExcellentRecode. А именно ванильные (дефолт) для школо серверов, итд. Матрикс (более слабые, медленные), МетаХВХ (быстрые, сильные) если чо, МетаХВХ бустят до 7БПС! 
Если чо, матрикс можн сделать быстрее , но и так сойдет))
сс:
(noad)
сразу говорю - есть немного чат гпт, но там впринципе процентов 70 $S$elfcode

Если чо, матрикс можн сделать быстрее , но и так сойдет))
сс:
strafe:
package wtf.tokyoware.client.managers.module.impl.movement;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import net.minecraft.block.SoulSandBlock;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.network.play.client.CEntityActionPacket;
import net.minecraft.network.play.server.SPlayerPositionLookPacket;
import net.minecraft.potion.Effects;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d;
import wtf.tokyoware.client.api.events.orbit.EventHandler;
import wtf.tokyoware.client.managers.events.other.PacketEvent;
import wtf.tokyoware.client.managers.events.player.MoveEvent;
import wtf.tokyoware.client.managers.events.player.UpdateEvent;
import wtf.tokyoware.client.managers.module.Category;
import wtf.tokyoware.client.managers.module.Module;
import wtf.tokyoware.client.managers.module.ModuleInfo;
import wtf.tokyoware.client.managers.module.impl.combat.KillAura;
import wtf.tokyoware.client.managers.module.settings.impl.BooleanSetting;
import wtf.tokyoware.client.managers.module.settings.impl.ModeSetting;
import wtf.tokyoware.client.managers.module.settings.impl.SliderSetting;
import wtf.tokyoware.client.utils.other.Instance;
import wtf.tokyoware.lib.util.time.StopWatch;
import java.util.Random;
@Getter
@Accessors(fluent = true)
@FieldDefaults(level = AccessLevel.PRIVATE)
@ModuleInfo(name = "Strafe", category = Category.MOVEMENT, desc = "Стрейфы, как в кс")
public class Strafe extends Module {
private final ModeSetting mode = new ModeSetting(this, "Режим", "Default", "Matrix", "MetaHVH");
private final BooleanSetting damageBoost = new BooleanSetting(this, "Буст от Урона", false);
private final BooleanSetting targetStrafe = new BooleanSetting(this, "Tаргет Стрейф", false);
private final BooleanSetting onlyGround = new BooleanSetting(this, "Только на Земле", false).setVisible(() -> mode.getValue().equals("MetaHVH"));
private final SliderSetting boostSpeed = new SliderSetting(this, "Буст скорости", 0.7F, 0.1F, 5.0F, 0.1F).setVisible(damageBoost::getValue);
private final StopWatch damageTimer = new StopWatch();
private double oldSpeed = 0;
private boolean needSwap = false;
private final boolean NDS = true;
private double lastHorizontalMove = 0;
private int waterTicks = 0;
public static Strafe getInstance() {
return Instance.get(Strafe.class);
}
public Strafe() {
}
@Override
public void onEnable() {
oldSpeed = 0;
lastHorizontalMove = 0;
waterTicks = 0;
super.onEnable();
}
@Override
public void onDisable() {
if (mc.player != null) {
mc.player.motion.x *= 0.7f;
mc.player.motion.z *= 0.7f;
}
oldSpeed = 0;
lastHorizontalMove = 0;
waterTicks = 0;
super.onDisable();
}
@EventHandler
public void onUpdate(UpdateEvent event) {
if (!strafes()) return;
if (CEntityActionPacket.lastUpdatedSprint != NDS) {
mc.player.connection.sendPacket(new CEntityActionPacket(mc.player,
NDS ? CEntityActionPacket.Action.START_SPRINTING : CEntityActionPacket.Action.STOP_SPRINTING));
CEntityActionPacket.lastUpdatedSprint = NDS;
}
if (needSwap) {
mc.player.connection.sendPacket(new CEntityActionPacket(mc.player,
mc.player.isServerSprintState() ? CEntityActionPacket.Action.STOP_SPRINTING : CEntityActionPacket.Action.START_SPRINTING));
needSwap = false;
}
if (lastHorizontalMove > 0) {
oldSpeed = lastHorizontalMove;
lastHorizontalMove = 0;
}
// Уменьшение waterTicks
if (mc.player.isInWater() || mc.player.isInLava()) {
waterTicks = 10;
} else if (waterTicks > 0) {
waterTicks--;
}
}
@EventHandler
public void onMove(MoveEvent event) {
if (!strafes()) {
oldSpeed = 0;
lastHorizontalMove = 0;
return;
}
float forward = getForwardInput();
float strafe = getStrafeInput();
// Сброс при отсутствии ввода
if (forward == 0 && strafe == 0 && !mode.getValue().equals("Matrix")) {
oldSpeed = 0;
lastHorizontalMove = 0;
return;
}
String currentMode = mode.getValue();
if (currentMode.equals("MetaHVH") && onlyGround.getValue() && !mc.player.isOnGround()) {
return;
}
boolean canBoost = damageBoost.getValue() && damageTimer.hasPassed(700L);
if (canBoost) {
damageTimer.reset(); // Сброс таймера после применения
}
double speed;
if (currentMode.equals("Matrix")) {
handleMatrixMode(event);
return;
} else if (currentMode.equals("MetaHVH")) {
speed = calculateSpeed(forward, strafe, canBoost, boostSpeed.getValue() / 10.0F);
} else {
speed = calculateSpeed(forward, strafe, canBoost, boostSpeed.getValue() / 10.0F);
}
setMoveMotion(event, speed);
lastHorizontalMove = speed;
}
private void handleMatrixMode(MoveEvent event) {
if (waterTicks > 0) return;
if (isMoving() && getMotion() <= 0.289385188) {
if (!isToGround()) {
double strafeSpeed = 0.245f - (new Random().nextFloat() * 0.000001f);
setMoveMotion(event, strafeSpeed);
lastHorizontalMove = strafeSpeed;
}
}
}
@EventHandler
public void onPacket(PacketEvent event) {
if (!event.isReceive()) return;
if (event.getPacket() instanceof SPlayerPositionLookPacket && oldSpeed != 0) {
oldSpeed = 0;
lastHorizontalMove = 0;
waterTicks = 0;
}
}
private boolean strafes() {
if (mc.player == null || mc.world == null) {
return false;
}
if (mc.player.isSneaking() || mc.player.isElytraFlying()) {
return false;
}
if (mc.player.isInWater() || mc.player.isInLava() || waterTicks > 0) {
return false;
}
BlockPos playerPos = new BlockPos(mc.player.getPosX(), mc.player.getPosY(), mc.player.getPosZ());
if (mc.world.getBlockState(playerPos).getMaterial() == Material.WEB
|| mc.world.getBlockState(playerPos.down()).getBlock() instanceof SoulSandBlock) {
return false;
}
return !mc.player.abilities.isFlying && !mc.player.isPotionActive(Effects.LEVITATION);
}
private double calculateSpeed(float forward, float strafe, boolean isBoosting, float damageSpeed) {
double baseSpeed = 0.2873;
if (mode.getValue().equals("MetaHVH")) {
baseSpeed = 0.35;
}
if (mc.player.isPotionActive(Effects.SPEED)) {
int amplifier = mc.player.getActivePotionEffect(Effects.SPEED).getAmplifier() + 1;
if (amplifier > 3) amplifier = 3;
baseSpeed *= 1.0 + 0.2 * amplifier;
}
double speed = baseSpeed;
if (isBoosting) {
if (mode.getValue().equals("MetaHVH")) {
speed += damageSpeed * 2;
} else {
speed += damageSpeed;
}
}
if (oldSpeed > speed && (forward != 0 || strafe != 0)) {
speed = oldSpeed;
}
return speed;
}
private void setMoveMotion(MoveEvent event, double speed) {
float yaw = mc.player.rotationYaw;
float forward = getForwardInput();
float strafe = getStrafeInput();
if (forward == 0 && strafe == 0 && !mode.getValue().equals("Matrix")) {
setX(event, 0);
setZ(event, 0);
return;
}
double inputMagnitude = Math.sqrt(forward * forward + strafe * strafe);
if (inputMagnitude > 1.0) {
forward /= inputMagnitude;
strafe /= inputMagnitude;
}
double radYaw = Math.toRadians(yaw);
double newX = (strafe * Math.cos(radYaw) - forward * Math.sin(radYaw)) * speed;
double newZ = (strafe * Math.sin(radYaw) + forward * Math.cos(radYaw)) * speed;
setX(event, newX);
setZ(event, newZ);
}
private float getForwardInput() {
float forward = 0;
if (targetStrafe.getValue()) {
KillAura aura = KillAura.getInstance();
Entity target = aura.getCurrentTarget();
if (target != null) {
double distance = mc.player.getDistance(target);
if (distance > 0.5) {
forward += 1;
}
return forward;
}
}
if (mc.gameSettings.keyBindForward.isKeyDown()) {
forward += 1;
}
if (mc.gameSettings.keyBindBack.isKeyDown()) {
forward -= 1;
}
return forward;
}
private float getStrafeInput() {
float strafe = 0;
if (mc.gameSettings.keyBindLeft.isKeyDown()) {
strafe += 1;
}
if (mc.gameSettings.keyBindRight.isKeyDown()) {
strafe -= 1;
}
return strafe;
}
private double getX(MoveEvent event) {
return event.getMotion().x;
}
private double getZ(MoveEvent event) {
return event.getMotion().z;
}
private void setX(MoveEvent event, double x) {
Vector3d motion = event.getMotion();
event.setMotion(new Vector3d(x, motion.y, motion.z));
}
private void setY(MoveEvent event, double y) {
Vector3d motion = event.getMotion();
event.setMotion(new Vector3d(motion.x, y, motion.z));
}
private void setZ(MoveEvent event, double z) {
Vector3d motion = event.getMotion();
event.setMotion(new Vector3d(motion.x, motion.y, z));
}
private boolean isMoving() {
return getForwardInput() != 0 || getStrafeInput() != 0;
}
private double getMotion() {
return Math.sqrt(mc.player.motion.x * mc.player.motion.x + mc.player.motion.z * mc.player.motion.z);
}
private boolean isToGround() {
return mc.player.isOnGround();
}
}
utilka:
//по-моему, утилка не нужна, я уже не помню
package wtf.tokyoware.client.utils.player;
import lombok.Data;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.potion.Effects;
import net.minecraft.util.math.BlockPos;
import wtf.tokyoware.client.api.interfaces.IMinecraft;
import wtf.tokyoware.client.managers.events.player.MoveEvent;
@Data
public class StrafeMovement implements IMinecraft {
private double oldSpeed, contextFriction;
private boolean needSwap;
private boolean NDS;
private int counter, noSlowTicks;
public double calcSpeed(MoveEvent move, boolean damageBoost, boolean hasTime, boolean autoJump, float damageSpeed) {
boolean isOnGround = mc.player.isOnGround();
boolean isLanding = move.isToGround();
boolean isJumping = move.getMotion().y > 0;
float moveSpeed = getAIMoveSpeed(mc.player);
float friction = getFrictionFactor(mc.player, move);
float adjustedFriction = mc.player.isPotionActive(Effects.JUMP_BOOST) && mc.player.isHandActive() ? 0.88f : 0.9103f;
if (isOnGround) {
adjustedFriction = friction;
}
float frictionAdjustment = 0.16277136f / (adjustedFriction * adjustedFriction * adjustedFriction);
float calculatedSpeed;
if (isOnGround) {
calculatedSpeed = moveSpeed * frictionAdjustment;
if (isJumping) {
calculatedSpeed += 0.2f;
}
} else {
calculatedSpeed = (damageBoost && hasTime && (autoJump || mc.gameSettings.keyBindJump.isKeyDown())) ? damageSpeed : 0.0255f;
}
boolean isSlowed = false;
double maxSpeed = oldSpeed + calculatedSpeed;
double currentSpeed = 0.0;
if (mc.player.isHandActive() && !isJumping) {
double adjustedSpeed = oldSpeed + calculatedSpeed * 0.25;
double verticalMotion = move.getMotion().y;
if (verticalMotion != 0.0 && Math.abs(verticalMotion) < 0.08) {
adjustedSpeed += 0.055;
}
if (maxSpeed > (currentSpeed = Math.max(0.043, adjustedSpeed))) {
isSlowed = true;
++noSlowTicks;
} else {
noSlowTicks = Math.max(noSlowTicks - 1, 0);
}
} else {
noSlowTicks = 0;
}
if (noSlowTicks > 3) {
maxSpeed = currentSpeed - (mc.player.isPotionActive(Effects.JUMP_BOOST) && mc.player.isHandActive() ? 0.3 : 0.019);
} else {
maxSpeed = Math.max(isSlowed ? 0 : 0.249984 - (++counter % 2) * 0.0001D, maxSpeed);
}
contextFriction = adjustedFriction;
if (!isLanding && !isOnGround) {
needSwap = true;
}
if (!isOnGround && !isLanding) {
NDS = !mc.player.isServerSprintState();
}
if (isLanding && isOnGround) {
NDS = false;
}
return maxSpeed;
}
public void postMove(final double horizontal) {
oldSpeed = horizontal * contextFriction;
}
private float getAIMoveSpeed(final ClientPlayerEntity contextPlayer) {
boolean prevSprinting = contextPlayer.isSprinting();
contextPlayer.setSprinting(false);
float speed = contextPlayer.getAIMoveSpeed() * 1.3f;
contextPlayer.setSprinting(prevSprinting);
return speed;
}
private float getFrictionFactor(final ClientPlayerEntity contextPlayer, final MoveEvent move) {
BlockPos.Mutable pos = new BlockPos.Mutable();
pos.setPos(move.getFrom().x, move.getAabbFrom().minY - 1.0D, move.getFrom().z);
return contextPlayer.world.getBlockState(pos).getBlock().getSlipperiness() * 0.91F;
}
}
сразу говорю - есть немного чат гпт, но там впринципе процентов 70 $S$elfcode