【Java】我的世界Java版外挂制作 [4] - 移动类模块合集
ROOT
:挂端主文件夹
4x001 AutoWalk
AutoWalk顾名思义,就是自动走路,可以防止服务器因为AFK把你踢了。在movement
包下创建一个新类,叫做AutoWalk
,并在里面输入以下代码:
package me.hack.hackedclient.module.movement;import me.hack.hackedclient.module.Category;
import me.hack.hackedclient.module.Module;public class AutoWalk extends Module {public AutoWalk() {super("AutoWalk", 0, Category.MOVEMENT);}@Overridepublic void onUpdate() {if(this.isToggled()) {mc.gameSettings.keyBindForward.pressed = true;}super.onUpdate();}@Overridepublic void onDisable() {mc.gameSettings.keyBindForward.pressed = false;super.onDisable();}}
这段代码很容易理解,就是在开启这个模块的时候,让我的世界以为你按下了前进键,关闭的时候就让我的世界以为你松开了前进键。
现在,在ModuleManager
中MOVEMENT
注释下添加:
newMod(new AutoWalk());
4x002 Dolphin
Dolphin就是可以让你在水里时自动向上移动,像海豚一样。在movement
包下创建一个新类,叫Dolphin
,并输入以下代码:
package me.hack.hackedclient.module.movement;import me.hack.hackedclient.module.Category;
import me.hack.hackedclient.module.Module;public class Dolphin extends Module {public Dolphin() {super("Dolphin", 0, Category.MOVEMENT);}@Overridepublic void onUpdate() {if(this.isToggled()) {if(mc.thePlayer.isInWater()) {mc.thePlayer.motionY += 0.04;}}super.onUpdate();}}
在ModuleManager
中MOVEMENT
注释下添加:
newMod(new Dolphin());
4x003 Flight
就是可以让你飞起来,但是容易被ban。在movement
包下创建一个新类,叫Flight
并添加以下代码:
package me.hack.hackedclient.module.movement;import me.hack.hackedclient.module.Category;
import me.hack.hackedclient.module.Module;public class Flight extends Module {public static float flyHackSpeed = 0.1F;public Flight() {super("Flight", 0, Category.MOVEMENT);}@Overridepublic void onDisable() {mc.thePlayer.capabilities.isFlying = false;super.onDisable();}@Overridepublic void onUpdate() {if(this.isToggled()) {mc.thePlayer.capabilities.isFlying = true;if(mc.gameSettings.keyBindJump.isPressed()) {mc.thePlayer.motionY += 0.2F;}if(mc.gameSettings.keyBindSneak.isPressed()) {mc.thePlayer.motionY -= 0.2F;}if(mc.gameSettings.keyBindForward.isPressed()) {mc.thePlayer.capabilities.setFlySpeed(flyHackSpeed);}}super.onUpdate();}}
在ModuleManager
中MOVEMENT
注释下添加:
newMod(new Flight());
4x004 NoFall
让你免掉落伤害。在movement
包下创建一个新类,叫NoFall
并添加以下代码:
package me.hack.hackedclient.module.movement;import me.hack.hackedclient.module.Category;
import me.hack.hackedclient.module.Module;
import net.minecraft.network.play.client.C03PacketPlayer;public class NoFall extends Module {public NoFall() {super("NoFall", 0, Category.MOVEMENT);}@Overridepublic void onUpdate() {if(this.isToggled()) {if(mc.thePlayer.fallDistance > 2F) {mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer(true));}}super.onUpdate();}}
在ModuleManager
中MOVEMENT
注释下添加:
newMod(new NoFall());
4x005 Glide
就是可以让你在掉落时滑翔。在movement
包下创建一个新类,叫Glide
并添加以下代码:
package me.hack.hackedclient.module.movement;import me.hack.hackedclient.module.Category;
import me.hack.hackedclient.module.Module;
import net.minecraft.block.material.Material;public class Glide extends Module {public Glide() {super("Glide", 0, Category.MOVEMENT);}@Overridepublic void onUpdate() {double oldY = mc.thePlayer.motionY;float oldJ = mc.thePlayer.jumpMovementFactor;if(this.isToggled()) {if((mc.thePlayer.motionY < 0.0D)&& (mc.thePlayer.isAirBorne)&& (!mc.thePlayer.isInWater())&& (!mc.thePlayer.isOnLadder())&& (!mc.thePlayer.isInsideOfMaterial(Material.lava))) {mc.thePlayer.motionY = -.125D;mc.thePlayer.jumpMovementFactor *= 1.12337F;}} else {mc.thePlayer.motionY = oldY;mc.thePlayer.jumpMovementFactor = oldJ;}super.onUpdate();}}
在ModuleManager
中MOVEMENT
注释下添加:
newMod(new Glide());
4x006 Jetpack
让你在长按空格的时候可以飞起来。在movement
包下创建一个新类,叫Jetpack
并添加以下代码:
package me.hack.hackedclient.module.movement;import me.hack.hackedclient.module.Category;
import me.hack.hackedclient.module.Module;public class Jetpack extends Module {public Jetpack() {super("Jetpack", 0, Category.MOVEMENT);}@Overridepublic void onUpdate() {if(this.isToggled()) {if(mc.gameSettings.keyBindJump.pressed) {mc.thePlayer.jump();}}super.onUpdate();}}
在ModuleManager
中MOVEMENT
注释下添加:
newMod(new Jetpack());
4x007 Parkour
让你自动在一个方块的边缘按空格来跳跃,对于跑酷来说非常有用。在movement
包下创建一个新类,叫Parkour
并添加以下代码:
package me.hack.hackedclient.module.movement;import me.hack.hackedclient.module.Category;
import me.hack.hackedclient.module.Module;
import net.minecraft.entity.Entity;public