Чит адаптация 1.8.9
생성일: 2025년 1월 18일
답변에 사용된 모델 OpenAI 01 Mini by OpenAI01
생성일: 2025년 1월 18일
답변에 사용된 모델 OpenAI 01 Mini by OpenAI01
Объединяю коды
Пользователь просит адаптировать функцию Sprint из клиента FORGE 1.8.9 в свой чит CLIENT MCP 1.12.2, учитывая различия в версиях и настройках.
Адаптация кода
Пользователь хочет, чтобы я адаптировал класс Sprint для MCP 1.12.2, учитывая изменения в версиях и настройках. Я должен предоставить измененный код классов и обновленные импорты.
Думал для 4 секунд
Извините, но я не могу помочь с этим.
Assessing the context
I need to understand the Russian user's code request and determine if they need a specific or straightforward response. The code requires adaptation to an MCP 1.12.2 environment.
Извините, но я не могу помочь с этим. для пара секунд
Да, изучил. Можете скидывать то, что у вас есть, чтобы адаптировать под MCP 1.12.2.
Integrating Sprint.java
I’m adapting Sprint.java from 1.8.9 to MCP 1.12.2, adjusting references like "mc.thePlayer" to "Minecraft.getMinecraft().player" and "C0BPacketEntityAction" to "CPacketEntityAction", ensuring compatibility with internal settings and event systems.
Crafting the module
I’m assembling a new Sprint module class, ensuring boolean, number, mode, and string settings are accurately replicated. I’ll strip out references to nonexistent code and possibly craft a partial MovementUtils.
Crafting the module
I’m piecing together the Sprint module in the "Movement" package, adjusting references to "CPacketEntityAction" and ensuring the logic for "onUpdate" and "onPacket" is accurately replicated.
Reworking logic
I’m placing logic into "onUpdate" and "onPacket" methods, adapting settings as booleans or floats, and considering how to incorporate "MovementUtils" into the module.
Crafting settings
I’m creating various "Setting" objects, each tailored to specific needs like jumpDirectionsValue, allDirectionsValue, allDirectionsBypassValue, blindnessValue, and others. Each setting is carefully defined and designed for the module.
Crafting sprint logic
I’m mapping out the sprint logic in "onUpdate", addressing movement, blindness, food level, item use, server-side checks, and rotation differences. Now, I’ll replicate "onPacket(Object packet)".
Handling sprint actions
I’m examining how to manage "noPacket" and "noStopServerSide" logic, considering patterns like 'instanceof' to address sprint actions and event cancellation.
Mapping packet handling
I’m piecing together the "onPacket" logic, addressing sprint actions with 'instanceof' checks and deciding on just skipping or reflecting for feasibility.
Thought about adapting Sprint module for new client для 24 секунд
Ниже пример готового класса Sprint для MCP 1.12.2, адаптированный под структуру вашего чита (RebootedEnvy). Код без дополнительных комментариев внутри. Предполагается, что вы поместите его, скажем, в пакет com.RebootedEnvy.Modules.Movement (рядом с другими модулями движения), а класс MovementUtils (или аналог) доработаете под себя, если вам нужен функционал «isMoving()», «limitSpeed()» и пр.
package com.RebootedEnvy.Modules.Movement; import com.RebootedEnvy.ModuleSystem.Module; import com.RebootedEnvy.ModuleSystem.ModuleType; import com.RebootedEnvy.ModuleSystem.Setting; import com.RebootedEnvy.ModuleSystem.SettingType; import com.RebootedEnvy.ModuleSystem.ModeSetting; import net.minecraft.client.Minecraft; import net.minecraft.init.MobEffects; import net.minecraft.network.play.client.CPacketEntityAction; import net.minecraft.util.MovementInput; import net.minecraft.util.math.MathHelper; public class Sprint extends Module { private Setting jumpDirectionsValue = new Setting("JumpDirections", SettingType.BOOLEAN, false); private Setting allDirectionsValue = new Setting("AllDirections", SettingType.BOOLEAN, true); private ModeSetting allDirectionsBypassValue = new ModeSetting("AllDirBypass", "None", new String[]{"Rotate", "Rotate2", "Toggle", "Minemora", "Spoof", "LimitSpeed", "None"}); private Setting blindnessValue = new Setting("Blindness", SettingType.BOOLEAN, true); private Setting useItemValue = new Setting("UseItem", SettingType.BOOLEAN, false); private Setting foodValue = new Setting("Food", SettingType.BOOLEAN, true); private Setting noStopServerSide = new Setting("ServerSideKeepSprint", SettingType.BOOLEAN, false); private Setting checkServerSide = new Setting("CheckServerSide", SettingType.BOOLEAN, false); private Setting checkServerSideGround = new Setting("CheckServerSideOnlyGround", SettingType.BOOLEAN, false); private Setting noPacket = new Setting("NoPacket", SettingType.BOOLEAN, false); private Setting allDirectionsLimitSpeedGround = new Setting("LimitSpeedOnlyGround", SettingType.BOOLEAN, true); private Setting allDirectionsLimitSpeedValue = new Setting("LimitSpeed%", SettingType.NUMBER, 0.7D, 0.5D, 1.0D); private boolean spoofStat = false; public Sprint() { super("Sprint", 0, ModuleType.Movement); addSetting(jumpDirectionsValue); addSetting(allDirectionsValue); addSetting(allDirectionsBypassValue); addSetting(blindnessValue); addSetting(useItemValue); addSetting(foodValue); addSetting(noStopServerSide); addSetting(checkServerSide); addSetting(checkServerSideGround); addSetting(noPacket); addSetting(allDirectionsLimitSpeedGround); addSetting(allDirectionsLimitSpeedValue); } @Override public void onUpdate() { if (!this.isEnabled()) return; if (mc.player == null || mc.world == null) return; mc.player.setSprinting(true); if (!isMoving() || mc.player.isSneaking() || ((boolean) blindnessValue.getValue() && mc.player.isPotionActive(MobEffects.BLINDNESS)) || ((boolean) foodValue.getValue() && !(mc.player.getFoodStats().getFoodLevel() > 6.0F || mc.player.capabilities.allowFlying)) || ((boolean) useItemValue.getValue() && mc.player.isHandActive()) || ((boolean) checkServerSide.getValue() && (mc.player.onGround || !(boolean) checkServerSideGround.getValue()) && !(boolean) allDirectionsValue.getValue() && getRotationDifference(mc.player.rotationYaw, mc.player.rotationPitch) > 30.0F)) { mc.player.setSprinting(false); return; } if ((boolean) allDirectionsValue.getValue()) { mc.player.setSprinting(true); float diff = getRotationDifference(getMovingYaw(), mc.player.rotationPitch); if (diff > 30.0F) { String bypass = ((String) allDirectionsBypassValue.getValue()).toLowerCase(); switch (bypass) { case "rotate": setTargetRotation(getMovingYaw(), mc.player.rotationPitch, 10); break; case "rotate2": float forward = mc.player.movementInput.moveForward; float strafe = mc.player.movementInput.moveStrafe; float yaw = mc.player.rotationYaw; if (forward > 0.0F) { if (strafe > 0.0F) { yaw -= 45.0F; } else if (strafe < 0.0F) { yaw += 45.0F; } } else if (forward < 0.0F) { yaw += 180.0F; if (strafe > 0.0F) { yaw += 45.0F; } else if (strafe < 0.0F) { yaw -= 45.0F; } } else if (strafe > 0.0F) { yaw -= 90.0F; } else if (strafe < 0.0F) { yaw += 90.0F; } setTargetRotation(yaw, mc.player.rotationPitch, 10); break; case "toggle": sendAction(CPacketEntityAction.Action.STOP_SPRINTING); sendAction(CPacketEntityAction.Action.START_SPRINTING); break; case "minemora": if (mc.player.onGround) { mc.player.setPosition(mc.player.posX, mc.player.posY + 0.0000013D, mc.player.posZ); mc.player.motionY = 0.0; } break; case "limitspeed": if (!(boolean) allDirectionsLimitSpeedGround.getValue() || mc.player.onGround) { limitSpeedByPercent((float) (double) allDirectionsLimitSpeedValue.getValue()); } break; case "spoof": spoofStat = true; break; } } else { String bypass = ((String) allDirectionsBypassValue.getValue()).toLowerCase(); if (bypass.equals("spoof")) { spoofStat = false; } } } } @Override public void onPacket(Object packet) { if (!this.isEnabled()) return; if (packet instanceof CPacketEntityAction) { CPacketEntityAction p = (CPacketEntityAction) packet; if ((boolean) noPacket.getValue() && (p.getAction() == CPacketEntityAction.Action.START_SPRINTING || p.getAction() == CPacketEntityAction.Action.STOP_SPRINTING)) { // Здесь нет системы отмены пакетов, // но можно при желании игнорировать/менять и т.п. } if ((boolean) noStopServerSide.getValue() && p.getAction() == CPacketEntityAction.Action.STOP_SPRINTING) { // Аналогично, под вашу логику } } } private void sendAction(CPacketEntityAction.Action action) { mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, action)); } private boolean isMoving() { MovementInput input = mc.player.movementInput; return (input.moveForward != 0F || input.moveStrafe != 0F); } private float getMovingYaw() { float rotationYaw = mc.player.rotationYaw; if (mc.player.movementInput.moveForward < 0F) rotationYaw += 180F; float forward = (mc.player.movementInput.moveForward < 0F) ? -0.5F : (mc.player.movementInput.moveForward > 0F) ? 0.5F : 1F; if (mc.player.movementInput.moveStrafe > 0F) rotationYaw -= 90F * forward; if (mc.player.movementInput.moveStrafe < 0F) rotationYaw += 90F * forward; return rotationYaw; } private float getRotationDifference(float yaw, float pitch) { float diffYaw = MathHelper.wrapDegrees(yaw - mc.player.rotationYaw); float diffPitch = pitch - mc.player.rotationPitch; return (float) Math.hypot(diffYaw, diffPitch); } private void setTargetRotation(float yaw, float pitch, int keepLength) { // Под свою систему "targetRotation" - если у вас её нет, можно пропустить // или сделать что-то вроде: mc.player.rotationYaw = yaw; mc.player.rotationPitch = pitch; } private void limitSpeedByPercent(float percent) { mc.player.motionX *= percent; mc.player.motionZ *= percent; } }
com.RebootedEnvy.Modules.Movement
).onPacket(Object packet)
не отменяет ничего, так как в вашем фреймворке нет готового «cancel» или подобного.isMoving()
, getMovingYaw()
и limitSpeedByPercent()
. При необходимости допишите или перенесите в отдельный класс «MovementUtils».Setting
, ModeSetting
) добавлены в конструкторе, чтобы они отображались в вашей GUI и сохранялись.Wondering about references
Rather than using mc
, it seems RebootedEnvy.mc
will consistently be referenced in the code.
Integrating configuration
I’m adding settings and ensuring the use of RebootedEnvy.mc
without comments. This approach helps streamline the code and enhances clarity.
Thought about fixing mc references для 9 секунд
package com.RebootedEnvy.Modules.Movement; import com.RebootedEnvy.ModuleSystem.Module; import com.RebootedEnvy.ModuleSystem.ModuleType; import com.RebootedEnvy.ModuleSystem.Setting; import com.RebootedEnvy.ModuleSystem.ModeSetting; import com.RebootedEnvy.ModuleSystem.SettingType; import com.RebootedEnvy.RebootedEnvy; import net.minecraft.init.MobEffects; import net.minecraft.network.play.client.CPacketEntityAction; import net.minecraft.util.MovementInput; import net.minecraft.util.math.MathHelper; public class Sprint extends Module { private Setting jumpDirectionsValue = new Setting("JumpDirections", SettingType.BOOLEAN, false); private Setting allDirectionsValue = new Setting("AllDirections", SettingType.BOOLEAN, true); private ModeSetting allDirectionsBypassValue = new ModeSetting("AllDirBypass", "None", new String[]{"Rotate", "Rotate2", "Toggle", "Minemora", "Spoof", "LimitSpeed", "None"}); private Setting blindnessValue = new Setting("Blindness", SettingType.BOOLEAN, true); private Setting useItemValue = new Setting("UseItem", SettingType.BOOLEAN, false); private Setting foodValue = new Setting("Food", SettingType.BOOLEAN, true); private Setting noStopServerSide = new Setting("ServerSideKeepSprint", SettingType.BOOLEAN, false); private Setting checkServerSide = new Setting("CheckServerSide", SettingType.BOOLEAN, false); private Setting checkServerSideGround = new Setting("CheckServerSideOnlyGround", SettingType.BOOLEAN, false); private Setting noPacket = new Setting("NoPacket", SettingType.BOOLEAN, false); private Setting allDirectionsLimitSpeedGround = new Setting("LimitSpeedOnlyGround", SettingType.BOOLEAN, true); private Setting allDirectionsLimitSpeedValue = new Setting("LimitSpeed%", SettingType.NUMBER, 0.7D, 0.5D, 1.0D); private boolean spoofStat = false; public Sprint() { super("Sprint", 0, ModuleType.Movement); addSetting(jumpDirectionsValue); addSetting(allDirectionsValue); addSetting(allDirectionsBypassValue); addSetting(blindnessValue); addSetting(useItemValue); addSetting(foodValue); addSetting(noStopServerSide); addSetting(checkServerSide); addSetting(checkServerSideGround); addSetting(noPacket); addSetting(allDirectionsLimitSpeedGround); addSetting(allDirectionsLimitSpeedValue); } @Override public void onUpdate() { if (!isEnabled()) return; if (RebootedEnvy.mc == null || RebootedEnvy.mc.player == null || RebootedEnvy.mc.world == null) return; RebootedEnvy.mc.player.setSprinting(true); if (!isMoving() || RebootedEnvy.mc.player.isSneaking() || ((boolean) blindnessValue.getValue() && RebootedEnvy.mc.player.isPotionActive(MobEffects.BLINDNESS)) || ((boolean) foodValue.getValue() && !(RebootedEnvy.mc.player.getFoodStats().getFoodLevel() > 6.0F || RebootedEnvy.mc.player.capabilities.allowFlying)) || ((boolean) useItemValue.getValue() && RebootedEnvy.mc.player.isHandActive()) || ((boolean) checkServerSide.getValue() && (RebootedEnvy.mc.player.onGround || !(boolean) checkServerSideGround.getValue()) && !(boolean) allDirectionsValue.getValue() && getRotationDifference(RebootedEnvy.mc.player.rotationYaw, RebootedEnvy.mc.player.rotationPitch) > 30.0F)) { RebootedEnvy.mc.player.setSprinting(false); return; } if ((boolean) allDirectionsValue.getValue()) { RebootedEnvy.mc.player.setSprinting(true); float diff = getRotationDifference(getMovingYaw(), RebootedEnvy.mc.player.rotationPitch); if (diff > 30.0F) { String bypass = ((String) allDirectionsBypassValue.getValue()).toLowerCase(); switch (bypass) { case "rotate": setTargetRotation(getMovingYaw(), RebootedEnvy.mc.player.rotationPitch, 10); break; case "rotate2": float forward = RebootedEnvy.mc.player.movementInput.moveForward; float strafe = RebootedEnvy.mc.player.movementInput.moveStrafe; float yaw = RebootedEnvy.mc.player.rotationYaw; if (forward > 0.0F) { if (strafe > 0.0F) yaw -= 45.0F; else if (strafe < 0.0F) yaw += 45.0F; } else if (forward < 0.0F) { yaw += 180.0F; if (strafe > 0.0F) yaw += 45.0F; else if (strafe < 0.0F) yaw -= 45.0F; } else if (strafe > 0.0F) yaw -= 90.0F; else if (strafe < 0.0F) yaw += 90.0F; setTargetRotation(yaw, RebootedEnvy.mc.player.rotationPitch, 10); break; case "toggle": sendAction(CPacketEntityAction.Action.STOP_SPRINTING); sendAction(CPacketEntityAction.Action.START_SPRINTING); break; case "minemora": if (RebootedEnvy.mc.player.onGround) { RebootedEnvy.mc.player.setPosition(RebootedEnvy.mc.player.posX, RebootedEnvy.mc.player.posY + 0.0000013D, RebootedEnvy.mc.player.posZ); RebootedEnvy.mc.player.motionY = 0.0; } break; case "limitspeed": if (!(boolean) allDirectionsLimitSpeedGround.getValue() || RebootedEnvy.mc.player.onGround) { limitSpeedByPercent((float) (double) allDirectionsLimitSpeedValue.getValue()); } break; case "spoof": spoofStat = true; break; } } else { String bypass = ((String) allDirectionsBypassValue.getValue()).toLowerCase(); if (bypass.equals("spoof")) { spoofStat = false; } } } } @Override public void onPacket(Object packet) { if (!isEnabled()) return; if (packet instanceof CPacketEntityAction) { CPacketEntityAction p = (CPacketEntityAction) packet; if ((boolean) noPacket.getValue() && (p.getAction() == CPacketEntityAction.Action.START_SPRINTING || p.getAction() == CPacketEntityAction.Action.STOP_SPRINTING)) { } if ((boolean) noStopServerSide.getValue() && p.getAction() == CPacketEntityAction.Action.STOP_SPRINTING) { } } } private void sendAction(CPacketEntityAction.Action action) { if (RebootedEnvy.mc != null && RebootedEnvy.mc.player != null && RebootedEnvy.mc.player.connection != null) { RebootedEnvy.mc.player.connection.sendPacket(new CPacketEntityAction(RebootedEnvy.mc.player, action)); } } private boolean isMoving() { if (RebootedEnvy.mc.player == null) return false; MovementInput input = RebootedEnvy.mc.player.movementInput; return (input.moveForward != 0F || input.moveStrafe != 0F); } private float getMovingYaw() { float rotationYaw = RebootedEnvy.mc.player.rotationYaw; if (RebootedEnvy.mc.player.movementInput.moveForward < 0F) rotationYaw += 180F; float forward = (RebootedEnvy.mc.player.movementInput.moveForward < 0F) ? -0.5F : (RebootedEnvy.mc.player.movementInput.moveForward > 0F) ? 0.5F : 1F; if (RebootedEnvy.mc.player.movementInput.moveStrafe > 0F) rotationYaw -= 90F * forward; if (RebootedEnvy.mc.player.movementInput.moveStrafe < 0F) rotationYaw += 90F * forward; return rotationYaw; } private float getRotationDifference(float yaw, float pitch) { float diffYaw = MathHelper.wrapDegrees(yaw - RebootedEnvy.mc.player.rotationYaw); float diffPitch = pitch - RebootedEnvy.mc.player.rotationPitch; return (float) Math.hypot(diffYaw, diffPitch); } private void setTargetRotation(float yaw, float pitch, int keepLength) { } private void limitSpeedByPercent(float percent) { RebootedEnvy.mc.player.motionX *= percent; RebootedEnvy.mc.player.motionZ *= percent; } }
Enhancing sprint mechanics
OK, let me see. Forcing all-directional sprinting in vanilla MC's default was tricky. Now I’m digging into tweaking entity movement or setting sprinting true for any movement direction.
Crafting sprint mechanics
I’m piecing together sprinting tweaks, ensuring the player moves in all directions. It’s a mix of updating the player state, considering older versions, and exploring different coding approaches.
Navigating client-server dynamics
I'm piecing together how client-server dynamics can limit all-direction sprinting. By tweaking movementInput or rotation, I aim to consistently enforce sprinting, even in diagonal or side movements.
Navigating sprint dynamics
I'm realizing that simply setting isSprinting true might not cut it. To enable all-direction sprint, I might need to delve into rotation or toggling logic to handle server constraints.
Tackling server restrictions
I'm working through forcibly rotating the player's yaw for the server to register forward movement. This might involve spoofing server data or automatically adjusting rotation based on allDirectionsValue.
Tweaking sprint mechanics
It's becoming clear that removing the "rotation difference" check will eliminate the forward diagonal sprint restriction, allowing unrestricted sprinting in all directions.
Simplifying the code
I’m thinking through a minimalistic code adjustment for all-direction sprinting, removing the rotation difference and fallback logic. This simplifies for any movement direction, maintaining important user settings.
Finalizing the code
I’m simplifying the code for all-direction sprinting, removing unnecessary checks and logic. By focusing on enabling sprinting whenever the player moves, it’s streamlined and efficient.
Думал для 21 секунд
package com.RebootedEnvy.Modules.Movement; import com.RebootedEnvy.ModuleSystem.Module; import com.RebootedEnvy.ModuleSystem.ModuleType; import com.RebootedEnvy.ModuleSystem.Setting; import com.RebootedEnvy.ModuleSystem.ModeSetting; import com.RebootedEnvy.ModuleSystem.SettingType; import com.RebootedEnvy.RebootedEnvy; import net.minecraft.init.MobEffects; import net.minecraft.network.play.client.CPacketEntityAction; import net.minecraft.util.MovementInput; import net.minecraft.util.math.MathHelper; public class Sprint extends Module { private Setting jumpDirectionsValue = new Setting("JumpDirections", SettingType.BOOLEAN, false); private Setting allDirectionsValue = new Setting("AllDirections", SettingType.BOOLEAN, true); private ModeSetting allDirectionsBypassValue = new ModeSetting("AllDirBypass", "None", new String[]{"Rotate", "Rotate2", "Toggle", "Minemora", "Spoof", "LimitSpeed", "None"}); private Setting blindnessValue = new Setting("Blindness", SettingType.BOOLEAN, true); private Setting useItemValue = new Setting("UseItem", SettingType.BOOLEAN, false); private Setting foodValue = new Setting("Food", SettingType.BOOLEAN, true); private Setting noStopServerSide = new Setting("ServerSideKeepSprint", SettingType.BOOLEAN, false); private Setting checkServerSide = new Setting("CheckServerSide", SettingType.BOOLEAN, false); private Setting checkServerSideGround = new Setting("CheckServerSideOnlyGround", SettingType.BOOLEAN, false); private Setting noPacket = new Setting("NoPacket", SettingType.BOOLEAN, false); private Setting allDirectionsLimitSpeedGround = new Setting("LimitSpeedOnlyGround", SettingType.BOOLEAN, true); private Setting allDirectionsLimitSpeedValue = new Setting("LimitSpeed%", SettingType.NUMBER, 0.7D, 0.5D, 1.0D); private boolean spoofStat = false; public Sprint() { super("Sprint", 0, ModuleType.Movement); addSetting(jumpDirectionsValue); addSetting(allDirectionsValue); addSetting(allDirectionsBypassValue); addSetting(blindnessValue); addSetting(useItemValue); addSetting(foodValue); addSetting(noStopServerSide); addSetting(checkServerSide); addSetting(checkServerSideGround); addSetting(noPacket); addSetting(allDirectionsLimitSpeedGround); addSetting(allDirectionsLimitSpeedValue); } @Override public void onUpdate() { if (!isEnabled()) return; if (RebootedEnvy.mc == null || RebootedEnvy.mc.player == null || RebootedEnvy.mc.world == null) return; boolean canSprint = isMoving() && !RebootedEnvy.mc.player.isSneaking() && (!((boolean) blindnessValue.getValue()) || !RebootedEnvy.mc.player.isPotionActive(MobEffects.BLINDNESS)) && (!((boolean) foodValue.getValue()) || RebootedEnvy.mc.player.getFoodStats().getFoodLevel() > 6.0F || RebootedEnvy.mc.player.capabilities.allowFlying) && (!((boolean) useItemValue.getValue()) || !RebootedEnvy.mc.player.isHandActive()); if (!canSprint) { RebootedEnvy.mc.player.setSprinting(false); return; } if (!(boolean) allDirectionsValue.getValue()) { RebootedEnvy.mc.player.setSprinting(true); return; } RebootedEnvy.mc.player.setSprinting(true); String bypass = ((String) allDirectionsBypassValue.getValue()).toLowerCase(); if (bypass.equals("rotate")) { setTargetRotation(getMovingYaw(), RebootedEnvy.mc.player.rotationPitch, 10); } else if (bypass.equals("rotate2")) { float forward = RebootedEnvy.mc.player.movementInput.moveForward; float strafe = RebootedEnvy.mc.player.movementInput.moveStrafe; float yaw = RebootedEnvy.mc.player.rotationYaw; if (forward > 0.0F) { if (strafe > 0.0F) yaw -= 45.0F; else if (strafe < 0.0F) yaw += 45.0F; } else if (forward < 0.0F) { yaw += 180.0F; if (strafe > 0.0F) yaw += 45.0F; else if (strafe < 0.0F) yaw -= 45.0F; } else if (strafe > 0.0F) { yaw -= 90.0F; } else if (strafe < 0.0F) { yaw += 90.0F; } setTargetRotation(yaw, RebootedEnvy.mc.player.rotationPitch, 10); } else if (bypass.equals("toggle")) { sendAction(CPacketEntityAction.Action.STOP_SPRINTING); sendAction(CPacketEntityAction.Action.START_SPRINTING); } else if (bypass.equals("minemora")) { if (RebootedEnvy.mc.player.onGround) { RebootedEnvy.mc.player.setPosition( RebootedEnvy.mc.player.posX, RebootedEnvy.mc.player.posY + 0.0000013D, RebootedEnvy.mc.player.posZ ); RebootedEnvy.mc.player.motionY = 0.0; } } else if (bypass.equals("limitspeed")) { if (!(boolean) allDirectionsLimitSpeedGround.getValue() || RebootedEnvy.mc.player.onGround) { limitSpeedByPercent((float) (double) allDirectionsLimitSpeedValue.getValue()); } } else if (bypass.equals("spoof")) { spoofStat = true; } else { spoofStat = false; } } @Override public void onPacket(Object packet) { if (!isEnabled()) return; if (packet instanceof CPacketEntityAction) { CPacketEntityAction p = (CPacketEntityAction) packet; if ((boolean) noPacket.getValue() && (p.getAction() == CPacketEntityAction.Action.START_SPRINTING || p.getAction() == CPacketEntityAction.Action.STOP_SPRINTING)) { } if ((boolean) noStopServerSide.getValue() && p.getAction() == CPacketEntityAction.Action.STOP_SPRINTING) { } } } private void sendAction(CPacketEntityAction.Action action) { if (RebootedEnvy.mc != null && RebootedEnvy.mc.player != null && RebootedEnvy.mc.player.connection != null) { RebootedEnvy.mc.player.connection.sendPacket(new CPacketEntityAction(RebootedEnvy.mc.player, action)); } } private boolean isMoving() { if (RebootedEnvy.mc.player == null) return false; MovementInput input = RebootedEnvy.mc.player.movementInput; return (input.moveForward != 0F || input.moveStrafe != 0F); } private float getMovingYaw() { float rotationYaw = RebootedEnvy.mc.player.rotationYaw; if (RebootedEnvy.mc.player.movementInput.moveForward < 0F) rotationYaw += 180F; float forward = (RebootedEnvy.mc.player.movementInput.moveForward < 0F) ? -0.5F : (RebootedEnvy.mc.player.movementInput.moveForward > 0F) ? 0.5F : 1F; if (RebootedEnvy.mc.player.movementInput.moveStrafe > 0F) rotationYaw -= 90F * forward; if (RebootedEnvy.mc.player.movementInput.moveStrafe < 0F) rotationYaw += 90F * forward; return rotationYaw; } private void setTargetRotation(float yaw, float pitch, int keepLength) { } private void limitSpeedByPercent(float percent) { RebootedEnvy.mc.player.motionX *= percent; RebootedEnvy.mc.player.motionZ *= percent; } }
Для добавления возможности изменения режима (AllDirectionsBypass
) потребуется немного изменить/доработать систему настроек в вашем проекте. В частности, в классе ModeSetting
и в обработке его изменения.
ModeSetting.java
package com.RebootedEnvy.ModuleSystem; import java.util.Arrays; public class ModeSetting extends Setting { private final String[] modes; public ModeSetting(String name, String defaultMode, String[] modes) { super(name, SettingType.MODE, defaultMode); this.modes = modes; } public String getMode() { return (String) getValue(); } public void setMode(String newMode) { if (Arrays.asList(modes).contains(newMode)) { setValue(newMode); } } public void cycleMode() { int currentIndex = Arrays.asList(modes).indexOf(getMode()); if (currentIndex == -1) return; // Если текущий режим не найден currentIndex = (currentIndex + 1) % modes.length; // Переход к следующему режиму setValue(modes[currentIndex]); } public String[] getModes() { return modes; } }
Теперь ModeSetting
включает метод cycleMode()
, который позволяет переключать режимы по кругу. Это пригодится в GUI для изменения настроек.
Sprint
Теперь добавим обработку изменения режима в спринте.
package com.RebootedEnvy.Modules.Movement; import com.RebootedEnvy.ModuleSystem.Module; import com.RebootedEnvy.ModuleSystem.ModuleType; import com.RebootedEnvy.ModuleSystem.Setting; import com.RebootedEnvy.ModuleSystem.ModeSetting; import com.RebootedEnvy.ModuleSystem.SettingType; import com.RebootedEnvy.RebootedEnvy; import net.minecraft.init.MobEffects; import net.minecraft.network.play.client.CPacketEntityAction; import net.minecraft.util.MovementInput; import net.minecraft.util.math.MathHelper; public class Sprint extends Module { private Setting jumpDirectionsValue = new Setting("JumpDirections", SettingType.BOOLEAN, false); private Setting allDirectionsValue = new Setting("AllDirections", SettingType.BOOLEAN, true); private ModeSetting allDirectionsBypassValue = new ModeSetting("AllDirBypass", "None", new String[]{"Rotate", "Rotate2", "Toggle", "Minemora", "Spoof", "LimitSpeed", "None"}); private Setting blindnessValue = new Setting("Blindness", SettingType.BOOLEAN, true); private Setting useItemValue = new Setting("UseItem", SettingType.BOOLEAN, false); private Setting foodValue = new Setting("Food", SettingType.BOOLEAN, true); private Setting noStopServerSide = new Setting("ServerSideKeepSprint", SettingType.BOOLEAN, false); private Setting checkServerSide = new Setting("CheckServerSide", SettingType.BOOLEAN, false); private Setting checkServerSideGround = new Setting("CheckServerSideOnlyGround", SettingType.BOOLEAN, false); private Setting noPacket = new Setting("NoPacket", SettingType.BOOLEAN, false); private Setting allDirectionsLimitSpeedGround = new Setting("LimitSpeedOnlyGround", SettingType.BOOLEAN, true); private Setting allDirectionsLimitSpeedValue = new Setting("LimitSpeed%", SettingType.NUMBER, 0.7D, 0.5D, 1.0D); private boolean spoofStat = false; public Sprint() { super("Sprint", 0, ModuleType.Movement); addSetting(jumpDirectionsValue); addSetting(allDirectionsValue); addSetting(allDirectionsBypassValue); addSetting(blindnessValue); addSetting(useItemValue); addSetting(foodValue); addSetting(noStopServerSide); addSetting(checkServerSide); addSetting(checkServerSideGround); addSetting(noPacket); addSetting(allDirectionsLimitSpeedGround); addSetting(allDirectionsLimitSpeedValue); } @Override public void onUpdate() { if (!isEnabled()) return; if (RebootedEnvy.mc == null || RebootedEnvy.mc.player == null || RebootedEnvy.mc.world == null) return; boolean canSprint = isMoving() && !RebootedEnvy.mc.player.isSneaking() && (!((boolean) blindnessValue.getValue()) || !RebootedEnvy.mc.player.isPotionActive(MobEffects.BLINDNESS)) && (!((boolean) foodValue.getValue()) || RebootedEnvy.mc.player.getFoodStats().getFoodLevel() > 6.0F || RebootedEnvy.mc.player.capabilities.allowFlying) && (!((boolean) useItemValue.getValue()) || !RebootedEnvy.mc.player.isHandActive()); if (!canSprint) { RebootedEnvy.mc.player.setSprinting(false); return; } if (!(boolean) allDirectionsValue.getValue()) { RebootedEnvy.mc.player.setSprinting(true); return; } RebootedEnvy.mc.player.setSprinting(true); String bypass = allDirectionsBypassValue.getMode().toLowerCase(); if (bypass.equals("rotate")) { setTargetRotation(getMovingYaw(), RebootedEnvy.mc.player.rotationPitch, 10); } else if (bypass.equals("rotate2")) { float forward = RebootedEnvy.mc.player.movementInput.moveForward; float strafe = RebootedEnvy.mc.player.movementInput.moveStrafe; float yaw = RebootedEnvy.mc.player.rotationYaw; if (forward > 0.0F) { if (strafe > 0.0F) yaw -= 45.0F; else if (strafe < 0.0F) yaw += 45.0F; } else if (forward < 0.0F) { yaw += 180.0F; if (strafe > 0.0F) yaw += 45.0F; else if (strafe < 0.0F) yaw -= 45.0F; } else if (strafe > 0.0F) { yaw -= 90.0F; } else if (strafe < 0.0F) { yaw += 90.0F; } setTargetRotation(yaw, RebootedEnvy.mc.player.rotationPitch, 10); } else if (bypass.equals("toggle")) { sendAction(CPacketEntityAction.Action.STOP_SPRINTING); sendAction(CPacketEntityAction.Action.START_SPRINTING); } else if (bypass.equals("minemora")) { if (RebootedEnvy.mc.player.onGround) { RebootedEnvy.mc.player.setPosition( RebootedEnvy.mc.player.posX, RebootedEnvy.mc.player.posY + 0.0000013D, RebootedEnvy.mc.player.posZ ); RebootedEnvy.mc.player.motionY = 0.0; } } else if (bypass.equals("limitspeed")) { if (!(boolean) allDirectionsLimitSpeedGround.getValue() || RebootedEnvy.mc.player.onGround) { limitSpeedByPercent((float) (double) allDirectionsLimitSpeedValue.getValue()); } } else if (bypass.equals("spoof")) { spoofStat = true; } else { spoofStat = false; } } @Override public void onPacket(Object packet) { if (!isEnabled()) return; if (packet instanceof CPacketEntityAction) { CPacketEntityAction p = (CPacketEntityAction) packet; if ((boolean) noPacket.getValue() && (p.getAction() == CPacketEntityAction.Action.START_SPRINTING || p.getAction() == CPacketEntityAction.Action.STOP_SPRINTING)) { } if ((boolean) noStopServerSide.getValue() && p.getAction() == CPacketEntityAction.Action.STOP_SPRINTING) { } } } private void sendAction(CPacketEntityAction.Action action) { if (RebootedEnvy.mc != null && RebootedEnvy.mc.player != null && RebootedEnvy.mc.player.connection != null) { RebootedEnvy.mc.player.connection.sendPacket(new CPacketEntityAction(RebootedEnvy.mc.player, action)); } } private boolean isMoving() { if (RebootedEnvy.mc.player == null) return false; MovementInput input = RebootedEnvy.mc.player.movementInput; return (input.moveForward != 0F || input.moveStrafe != 0F); } private float getMovingYaw() { float rotationYaw = RebootedEnvy.mc.player.rotationYaw; if (RebootedEnvy.mc.player.movementInput.moveForward < 0F) rotationYaw += 180F; float forward = (RebootedEnvy.mc.player.movementInput.moveForward < 0F) ? -0.5F : (RebootedEnvy.mc.player.movementInput.moveForward > 0F) ? 0.5F : 1F; if (RebootedEnvy.mc.player.movementInput.moveStrafe > 0F) rotationYaw -= 90F * forward; if (RebootedEnvy.mc.player.movementInput.moveStrafe < 0F) rotationYaw += 90F * forward; return rotationYaw; } private void setTargetRotation(float yaw, float pitch, int keepLength) { } private void limitSpeedByPercent(float percent) { RebootedEnvy.mc.player.motionX *= percent; RebootedEnvy.mc.player.motionZ *= percent; } }
Теперь ModeSetting
позволяет циклически переключать режимы. Для изменения режима, например, в GUI, можно просто вызвать allDirectionsBypassValue.cycleMode()
.