diff --git a/.run/Raven-XD [build].run.xml b/.run/Raven-XD [build].run.xml index 341ebf1a..c5a62ea6 100644 --- a/.run/Raven-XD [build].run.xml +++ b/.run/Raven-XD [build].run.xml @@ -4,7 +4,7 @@ - + diff --git a/build.gradle b/build.gradle index df0d76e5..24a1d39d 100644 --- a/build.gradle +++ b/build.gradle @@ -62,7 +62,7 @@ configurations { } dependencies { - implementation group: 'commons-io', name: 'commons-io', version: '2.11.0' + implementation group: 'commons-io', name: 'commons-io', version: '2.14.0' embed('org.spongepowered:mixin:0.6-SNAPSHOT') { exclude module: 'gson' exclude module: 'guava' diff --git a/logo/logo_small.png b/logo/logo_small.png new file mode 100644 index 00000000..b50f7a29 Binary files /dev/null and b/logo/logo_small.png differ diff --git a/src/main/java/keystrokesmod/event/BlockAABBEvent.java b/src/main/java/keystrokesmod/event/BlockAABBEvent.java index 40b78b1f..0a8bf06f 100644 --- a/src/main/java/keystrokesmod/event/BlockAABBEvent.java +++ b/src/main/java/keystrokesmod/event/BlockAABBEvent.java @@ -12,8 +12,8 @@ public class BlockAABBEvent extends Event { private final World world; private final Block block; private final BlockPos blockPos; - private AxisAlignedBB boundingBox; private final AxisAlignedBB maskBoundingBox; + private AxisAlignedBB boundingBox; public BlockAABBEvent(World world, Block block, BlockPos blockPos, AxisAlignedBB boundingBox, AxisAlignedBB maskBoundingBox) { this.world = world; diff --git a/src/main/java/keystrokesmod/event/BlockWebEvent.java b/src/main/java/keystrokesmod/event/BlockWebEvent.java index 02886d03..c02bfb8c 100644 --- a/src/main/java/keystrokesmod/event/BlockWebEvent.java +++ b/src/main/java/keystrokesmod/event/BlockWebEvent.java @@ -4,7 +4,6 @@ import lombok.AllArgsConstructor; import lombok.Getter; import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.Entity; import net.minecraft.util.BlockPos; import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; diff --git a/src/main/java/keystrokesmod/event/PreMotionEvent.java b/src/main/java/keystrokesmod/event/PreMotionEvent.java index c1772a1f..de2d6e11 100644 --- a/src/main/java/keystrokesmod/event/PreMotionEvent.java +++ b/src/main/java/keystrokesmod/event/PreMotionEvent.java @@ -9,12 +9,13 @@ @Cancelable public class PreMotionEvent extends Event { + private static boolean setRenderYaw; @Setter @Getter - private double posX; + public double posY; @Setter @Getter - public double posY; + private double posX; @Setter @Getter private double posZ; @@ -26,7 +27,6 @@ public class PreMotionEvent extends Event { @Setter @Getter private boolean onGround; - private static boolean setRenderYaw; private boolean isSprinting; private boolean isSneaking; @@ -41,18 +41,19 @@ public PreMotionEvent(double posX, double posY, double posZ, float yaw, float pi this.isSneaking = isSneaking; } + public static boolean setRenderYaw() { + return setRenderYaw; + } + public void setYaw(float yaw) { this.yaw = yaw; setRenderYaw = true; } - public static boolean setRenderYaw() { - return setRenderYaw; - } - public void setRenderYaw(boolean setRenderYaw) { PreMotionEvent.setRenderYaw = setRenderYaw; } + public boolean isSprinting() { return isSprinting; } diff --git a/src/main/java/keystrokesmod/event/PreOrientCameraEvent.java b/src/main/java/keystrokesmod/event/PreOrientCameraEvent.java new file mode 100644 index 00000000..78f99043 --- /dev/null +++ b/src/main/java/keystrokesmod/event/PreOrientCameraEvent.java @@ -0,0 +1,13 @@ +package keystrokesmod.event; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import net.minecraftforge.fml.common.eventhandler.Event; + +@EqualsAndHashCode(callSuper = true) +@AllArgsConstructor +@Data +public class PreOrientCameraEvent extends Event { + private float smooth; +} diff --git a/src/main/java/keystrokesmod/mixins/impl/client/MixinMinecraft.java b/src/main/java/keystrokesmod/mixins/impl/client/MixinMinecraft.java index 9d854328..33346f89 100644 --- a/src/main/java/keystrokesmod/mixins/impl/client/MixinMinecraft.java +++ b/src/main/java/keystrokesmod/mixins/impl/client/MixinMinecraft.java @@ -101,7 +101,7 @@ private void onCrashed(CrashReport crashReport, CallbackInfo ci) { @Inject(method = "createDisplay", at = @At(value = "RETURN")) private void onSetTitle(@NotNull CallbackInfo ci) { - Display.setTitle("Opai " + Watermark.VERSION); + Display.setTitle("Raven XD " + Watermark.VERSION); } @Inject(method = "", at = @At("RETURN")) diff --git a/src/main/java/keystrokesmod/mixins/impl/gui/MixinGuiButton.java b/src/main/java/keystrokesmod/mixins/impl/gui/MixinGuiButton.java index 78c451df..1da647f2 100644 --- a/src/main/java/keystrokesmod/mixins/impl/gui/MixinGuiButton.java +++ b/src/main/java/keystrokesmod/mixins/impl/gui/MixinGuiButton.java @@ -3,7 +3,9 @@ import keystrokesmod.module.ModuleManager; import keystrokesmod.utility.font.FontManager; import keystrokesmod.utility.font.IFont; -import keystrokesmod.utility.render.*; +import keystrokesmod.utility.render.ColorUtils; +import keystrokesmod.utility.render.RRectUtils; +import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.render.blur.GaussianBlur; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; @@ -21,36 +23,44 @@ import java.awt.*; -import static keystrokesmod.Raven.mc; - @Mixin(GuiButton.class) public abstract class MixinGuiButton extends Gui { - @Shadow public boolean visible; - - @Shadow @Final protected static ResourceLocation buttonTextures; - - @Shadow protected boolean hovered; - - @Shadow public int xPosition; - - @Shadow public int yPosition; - - @Shadow public int width; - - @Shadow public int height; - - @Shadow protected abstract int getHoverState(boolean p_getHoverState_1_); - - @Shadow protected abstract void mouseDragged(Minecraft p_mouseDragged_1_, int p_mouseDragged_2_, int p_mouseDragged_3_); + @Shadow + @Final + protected static ResourceLocation buttonTextures; + @Shadow + public boolean visible; + @Shadow + public int xPosition; + @Shadow + public int yPosition; + @Shadow + public int width; + @Shadow + public int height; + @Shadow + public boolean enabled; + @Shadow + public String displayString; + @Shadow + protected boolean hovered; + @Unique + private int ravenXD$hoverValue; - @Shadow public boolean enabled; + @Unique + @Contract("_, _, _ -> new") + private static @NotNull Color raven_XD$interpolateColorC(final @NotNull Color color1, final @NotNull Color color2, float amount) { + amount = Math.min(1.0f, Math.max(0.0f, amount)); + return new Color(ColorUtils.interpolateInt(color1.getRed(), color2.getRed(), amount), ColorUtils.interpolateInt(color1.getGreen(), color2.getGreen(), amount), ColorUtils.interpolateInt(color1.getBlue(), color2.getBlue(), amount), ColorUtils.interpolateInt(color1.getAlpha(), color2.getAlpha(), amount)); + } - @Shadow public String displayString; + @Shadow + protected abstract int getHoverState(boolean p_getHoverState_1_); - @Unique - private int ravenXD$hoverValue; + @Shadow + protected abstract void mouseDragged(Minecraft p_mouseDragged_1_, int p_mouseDragged_2_, int p_mouseDragged_3_); @Inject(method = "drawButton", at = @At("HEAD"), cancellable = true) public void onDrawButton(Minecraft minecraft, int x, int y, CallbackInfo ci) { @@ -72,8 +82,8 @@ public void onDrawButton(Minecraft minecraft, int x, int y, CallbackInfo ci) { RRectUtils.drawRoundOutline(xPosition, this.yPosition, width, height, 3.5F, 0.0015f, rectColor, new Color(30, 30, 30, 100)); if (ModuleManager.clientTheme.buttonBlur.isToggled()) GaussianBlur.startBlur(); - RRectUtils.drawRoundOutline(xPosition, this.yPosition, width, height, 3.5F, 0.0015f, new Color(0, 0, 0, 5) , new Color(0, 0, 0, 5)); - RRectUtils.drawRoundOutline(xPosition, yPosition, width, height, 3.5F, 0.0015f, new Color(0, 0, 0, 50) , new Color(200, 200, 200, 60)); + RRectUtils.drawRoundOutline(xPosition, this.yPosition, width, height, 3.5F, 0.0015f, new Color(0, 0, 0, 5), new Color(0, 0, 0, 5)); + RRectUtils.drawRoundOutline(xPosition, yPosition, width, height, 3.5F, 0.0015f, new Color(0, 0, 0, 50), new Color(200, 200, 200, 60)); if (ModuleManager.clientTheme.buttonBlur.isToggled()) GaussianBlur.endBlur(20, 5); @@ -84,11 +94,4 @@ public void onDrawButton(Minecraft minecraft, int x, int y, CallbackInfo ci) { ci.cancel(); } - - @Unique - @Contract("_, _, _ -> new") - private static @NotNull Color raven_XD$interpolateColorC(final @NotNull Color color1, final @NotNull Color color2, float amount) { - amount = Math.min(1.0f, Math.max(0.0f, amount)); - return new Color(ColorUtils.interpolateInt(color1.getRed(), color2.getRed(), amount), ColorUtils.interpolateInt(color1.getGreen(), color2.getGreen(), amount), ColorUtils.interpolateInt(color1.getBlue(), color2.getBlue(), amount), ColorUtils.interpolateInt(color1.getAlpha(), color2.getAlpha(), amount)); - } } diff --git a/src/main/java/keystrokesmod/mixins/impl/gui/MixinGuiConnecting.java b/src/main/java/keystrokesmod/mixins/impl/gui/MixinGuiConnecting.java index e604c450..000efb0c 100644 --- a/src/main/java/keystrokesmod/mixins/impl/gui/MixinGuiConnecting.java +++ b/src/main/java/keystrokesmod/mixins/impl/gui/MixinGuiConnecting.java @@ -16,15 +16,14 @@ @Mixin(GuiConnecting.class) public abstract class MixinGuiConnecting extends GuiScreen { - @Shadow - private NetworkManager networkManager; - @Unique public PreConnectEvent raven_bS$preConnectEvent = null; + @Shadow + private NetworkManager networkManager; @Inject(method = "connect", at = @At("HEAD"), cancellable = true) public void onConnect(String p_connect_1_, int p_connect_2_, CallbackInfo ci) { - raven_bS$preConnectEvent = new PreConnectEvent((GuiConnecting)(Object) this, p_connect_1_, p_connect_2_); + raven_bS$preConnectEvent = new PreConnectEvent((GuiConnecting) (Object) this, p_connect_1_, p_connect_2_); MinecraftForge.EVENT_BUS.post(raven_bS$preConnectEvent); if (raven_bS$preConnectEvent.isCanceled()) { ci.cancel(); diff --git a/src/main/java/keystrokesmod/mixins/impl/gui/MixinGuiMainMenu.java b/src/main/java/keystrokesmod/mixins/impl/gui/MixinGuiMainMenu.java index 67659190..c9bc6e29 100644 --- a/src/main/java/keystrokesmod/mixins/impl/gui/MixinGuiMainMenu.java +++ b/src/main/java/keystrokesmod/mixins/impl/gui/MixinGuiMainMenu.java @@ -19,8 +19,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.awt.*; -import java.util.Calendar; -import java.util.Date; import java.util.List; @@ -29,11 +27,13 @@ public abstract class MixinGuiMainMenu extends GuiScreen { @Unique private static final int LOGO_COLOR = new Color(255, 255, 255, 200).getRGB(); - @Shadow private int field_92022_t; + @Shadow + private int field_92022_t; + @Shadow + private GuiScreen field_183503_M; - @Shadow protected abstract boolean func_183501_a(); - - @Shadow private GuiScreen field_183503_M; + @Shadow + protected abstract boolean func_183501_a(); @Inject(method = "drawScreen", at = @At("HEAD"), cancellable = true) public void onDrawScreen(int p_drawScreen_1_, int p_drawScreen_2_, float p_drawScreen_3_, CallbackInfo ci) { @@ -46,7 +46,7 @@ public void onDrawScreen(int p_drawScreen_1_, int p_drawScreen_2_, float p_drawS List branding = Lists.reverse(FMLCommonHandler.instance().getBrandings(true)); - for(int breadline = 0; breadline < branding.size(); ++breadline) { + for (int breadline = 0; breadline < branding.size(); ++breadline) { String brd = branding.get(breadline); if (!Strings.isNullOrEmpty(brd)) { this.drawString(this.fontRendererObj, brd, 2, this.height - (10 + breadline * (this.fontRendererObj.FONT_HEIGHT + 1)), 16777215); diff --git a/src/main/java/keystrokesmod/mixins/impl/gui/MixinGuiScreen.java b/src/main/java/keystrokesmod/mixins/impl/gui/MixinGuiScreen.java index 4a6ac6f0..b7db3f5d 100644 --- a/src/main/java/keystrokesmod/mixins/impl/gui/MixinGuiScreen.java +++ b/src/main/java/keystrokesmod/mixins/impl/gui/MixinGuiScreen.java @@ -1,8 +1,8 @@ package keystrokesmod.mixins.impl.gui; import keystrokesmod.module.ModuleManager; -import keystrokesmod.module.impl.render.NoBackground; import keystrokesmod.module.impl.player.ChestStealer; +import keystrokesmod.module.impl.render.NoBackground; import keystrokesmod.utility.Utils; import keystrokesmod.utility.render.BackgroundUtils; import net.minecraft.client.gui.GuiScreen; diff --git a/src/main/java/keystrokesmod/mixins/impl/render/MixinEntityRenderer.java b/src/main/java/keystrokesmod/mixins/impl/render/MixinEntityRenderer.java index 5dcb5632..cc81fb32 100644 --- a/src/main/java/keystrokesmod/mixins/impl/render/MixinEntityRenderer.java +++ b/src/main/java/keystrokesmod/mixins/impl/render/MixinEntityRenderer.java @@ -1,5 +1,6 @@ package keystrokesmod.mixins.impl.render; +import keystrokesmod.event.PreOrientCameraEvent; import keystrokesmod.module.ModuleManager; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; @@ -10,6 +11,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraft.util.MathHelper; import net.minecraftforge.client.ForgeHooksClient; @@ -20,6 +22,8 @@ import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyArg; +import org.spongepowered.asm.mixin.injection.ModifyVariable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(EntityRenderer.class) @@ -61,6 +65,12 @@ private void hurtCameraEffect(float p_hurtCameraEffect_1_) { } } + @ModifyVariable(method = "orientCamera", at = @At("HEAD"), ordinal = 0, argsOnly = true) + public float modifySmooth(float smooth) { + PreOrientCameraEvent event = new PreOrientCameraEvent(smooth); + MinecraftForge.EVENT_BUS.post(event); + return event.getSmooth(); + } @Inject(method = "orientCamera", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Vec3;distanceTo(Lnet/minecraft/util/Vec3;)D"), cancellable = true) public void orientCamera(float partialTicks, CallbackInfo ci) { @@ -74,7 +84,7 @@ public void orientCamera(float partialTicks, CallbackInfo ci) { GlStateManager.translate(0.0F, 0.3F, 0.0F); if (!this.mc.gameSettings.debugCamEnable) { BlockPos blockpos = new BlockPos(entity); - IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos); + IBlockState iblockstate = Blocks.air.getDefaultState(); // for no clip when in the block ForgeHooksClient.orientBedCamera(this.mc.theWorld, blockpos, iblockstate, entity); GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F, 0.0F, -1.0F, 0.0F); GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, -1.0F, 0.0F, 0.0F); diff --git a/src/main/java/keystrokesmod/module/Module.java b/src/main/java/keystrokesmod/module/Module.java index 2cbb9876..294cca1b 100644 --- a/src/main/java/keystrokesmod/module/Module.java +++ b/src/main/java/keystrokesmod/module/Module.java @@ -21,34 +21,32 @@ import scala.reflect.internal.util.WeakHashSet; import java.util.ArrayList; -import java.util.Iterator; public class Module { - @Getter - @Setter - private @Nullable I18nModule i18nObject = null; - + protected static Minecraft mc; @Getter protected final ArrayList settings; private final WeakHashSet settingsWeak; private final String moduleName; - private String prettyName; - private String prettyInfo = ""; private final Module.category moduleCategory; - @Getter - @Setter - private boolean enabled; - @Getter - private int keycode; private final @Nullable String toolTip; - protected static Minecraft mc; - private boolean isToggled = false; public boolean canBeEnabled = true; public boolean ignoreOnSave = false; @Setter @Getter public boolean hidden = false; public Script script = null; + @Getter + @Setter + private @Nullable I18nModule i18nObject = null; + private String prettyName; + private String prettyInfo = ""; + @Getter + @Setter + private boolean enabled; + @Getter + private int keycode; + private boolean isToggled = false; public Module(String moduleName, Module.category moduleCategory, int keycode) { this(moduleName, moduleCategory, keycode, null); @@ -90,8 +88,7 @@ public void keybind() { } else if ((this.keycode >= 1000 ? !Mouse.isButtonDown(this.keycode - 1000) : !Keyboard.isKeyDown(this.keycode))) { this.isToggled = false; } - } - catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); Utils.sendMessage("&cFailed to check keybinding. Setting to none"); this.keycode = 0; @@ -118,8 +115,7 @@ public final void enable() { if (this.script != null) { Raven.scriptManager.onEnable(script); - } - else { + } else { try { MinecraftForge.EVENT_BUS.register(this); this.onEnable(); @@ -136,8 +132,7 @@ public final void disable() { ModuleManager.organizedModules.remove(this); if (this.script != null) { Raven.scriptManager.onDisable(script); - } - else { + } else { try { MinecraftForge.EVENT_BUS.unregister(this); this.onDisable(); @@ -156,6 +151,11 @@ public String getPrettyInfo() { : getInfo(); } + public final void setPrettyInfo(String name) { + this.prettyInfo = name; + ModuleManager.sort(); + } + public String getName() { return this.moduleName; } @@ -166,6 +166,11 @@ public String getPrettyName() { : i18nObject != null ? i18nObject.getName() : getName(); } + public final void setPrettyName(String name) { + this.prettyName = name; + ModuleManager.sort(); + } + public @Nullable String getToolTip() { return toolTip; } @@ -182,16 +187,6 @@ public String getRawPrettyInfo() { return prettyInfo.isEmpty() ? getInfo() : prettyInfo; } - public final void setPrettyName(String name) { - this.prettyName = name; - ModuleManager.sort(); - } - - public final void setPrettyInfo(String name) { - this.prettyInfo = name; - ModuleManager.sort(); - } - public void registerSetting(Setting setting) { synchronized (settings) { if (settingsWeak.contains(setting)) diff --git a/src/main/java/keystrokesmod/module/ModuleManager.java b/src/main/java/keystrokesmod/module/ModuleManager.java index 30dc5e39..26bfa4d1 100644 --- a/src/main/java/keystrokesmod/module/ModuleManager.java +++ b/src/main/java/keystrokesmod/module/ModuleManager.java @@ -17,9 +17,7 @@ import java.util.List; public class ModuleManager { - static List modules = new ArrayList<>(); public static List organizedModules = new ArrayList<>(); - public static Module longJump; public static Blink blink; public static Module nameHider; @@ -118,7 +116,7 @@ public class ModuleManager { public static BedDefender bedDefender; public static ChestAura chestAura; public static AutoRod autoRod; -// public static AbilitiesBedWars abilitiesBedWars; + // public static AbilitiesBedWars abilitiesBedWars; public static ClientTheme clientTheme; public static AutoChest autoChest; public static Teleport teleport; @@ -130,6 +128,22 @@ public class ModuleManager { public static ChatAI chatAI; public static keystrokesmod.module.impl.render.ArrayList arrayList; + static List modules = new ArrayList<>(); + + private static double getWidth(@NotNull Module module) { + String text = module.getPrettyName() + + ((HUD.showInfo.isToggled() && !module.getPrettyInfo().isEmpty()) ? " " + module.getPrettyInfo() : ""); + return HUD.getFontRenderer().width(HUD.lowercase.isToggled() ? text.toLowerCase() : text); + } + + public static void sort() { + if (HUD.alphabeticalSort.isToggled()) { + organizedModules.sort(Comparator.comparing(Module::getPrettyName)); + } else { + organizedModules.sort((c1, c2) -> Double.compare(getWidth(c2), getWidth(c1))); + } + } + public void register() { // client @@ -351,18 +365,4 @@ public Module getModule(String moduleName) { } return null; } - - private static double getWidth(@NotNull Module module) { - String text = module.getPrettyName() - + ((HUD.showInfo.isToggled() && !module.getPrettyInfo().isEmpty()) ? " " + module.getPrettyInfo() : ""); - return HUD.getFontRenderer().width(HUD.lowercase.isToggled() ? text.toLowerCase() : text); - } - - public static void sort() { - if (HUD.alphabeticalSort.isToggled()) { - organizedModules.sort(Comparator.comparing(Module::getPrettyName)); - } else { - organizedModules.sort((c1, c2) -> Double.compare(getWidth(c2), getWidth(c1))); - } - } } \ No newline at end of file diff --git a/src/main/java/keystrokesmod/module/impl/client/CommandChat.java b/src/main/java/keystrokesmod/module/impl/client/CommandChat.java index 542bb1b5..5db8fcc7 100644 --- a/src/main/java/keystrokesmod/module/impl/client/CommandChat.java +++ b/src/main/java/keystrokesmod/module/impl/client/CommandChat.java @@ -13,6 +13,7 @@ public class CommandChat extends Module { private static final String[] IDENTIFIERS = new String[]{".", "#", "@"}; private static final ModeSetting identifier = new ModeSetting("Identifier", IDENTIFIERS, 0); + public CommandChat() { super("Command chat", category.client); this.registerSetting(identifier); @@ -20,6 +21,10 @@ public CommandChat() { MinecraftForge.EVENT_BUS.register(this); } + public static String getIdentifier() { + return IDENTIFIERS[(int) identifier.getInput()]; + } + @SubscribeEvent(priority = EventPriority.LOWEST) public void onSendPacket(@NotNull SendPacketEvent event) { if (event.getPacket() instanceof C01PacketChatMessage) { @@ -32,8 +37,4 @@ public void onSendPacket(@NotNull SendPacketEvent event) { } } } - - public static String getIdentifier() { - return IDENTIFIERS[(int) identifier.getInput()]; - } } diff --git a/src/main/java/keystrokesmod/module/impl/client/DynamicManager.java b/src/main/java/keystrokesmod/module/impl/client/DynamicManager.java index e2affb7c..8a545c77 100644 --- a/src/main/java/keystrokesmod/module/impl/client/DynamicManager.java +++ b/src/main/java/keystrokesmod/module/impl/client/DynamicManager.java @@ -25,17 +25,16 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.*; import java.util.List; +import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; public final class DynamicManager extends Module { - public static File directory = null; - public static File cacheDirectory = null; public static final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); - private static final Set activeDynamics = new HashSet<>(); + public static File directory = null; + public static File cacheDirectory = null; private boolean needToLoad = false; public DynamicManager() { @@ -44,15 +43,14 @@ public DynamicManager() { this.registerSetting(new ButtonSetting("Open folder", () -> { try { Desktop.getDesktop().open(directory); - } - catch (IOException ex) { + } catch (IOException ex) { directory.mkdirs(); Utils.sendMessage("&cError locating folder, recreated."); } })); this.registerSetting(new DescriptionSetting("Dynamics:", () -> !activeDynamics.isEmpty())); this.canBeEnabled = false; - + directory = new File(Raven.mc.mcDataDir + File.separator + "keystrokes", "dynamics"); if (!directory.exists()) { boolean success = directory.mkdirs(); @@ -73,6 +71,33 @@ public DynamicManager() { loadDynamics(); } + private static @NotNull Set getClassPath() { + Set classPath = new HashSet<>(); + + for (File file : Objects.requireNonNull(new File(mc.mcDataDir, "mods").listFiles())) { + if (file.exists() && file.isFile() && file.getName().endsWith(".jar")) + classPath.add(file); + } + classPath.add(new File(Raven.class.getProtectionDomain().getCodeSource().getLocation().getFile())); + classPath.add(new File(Minecraft.class.getProtectionDomain().getCodeSource().getLocation().getFile())); + return classPath; + } + + private static List findClassFiles(String dir) { + try (Stream stream = Files.walk(Paths.get(dir))) { + return stream.filter(file -> !Files.isDirectory(file) && file.toString().endsWith(".class")) + .map(Path::toFile) + .collect(Collectors.toList()); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private static @NotNull String getClassName(@NotNull String outputDir, @NotNull File classFile) { + String relativePath = classFile.getAbsolutePath().substring(outputDir.length() + 1); + return relativePath.replace(File.separator, ".").replace(".class", ""); + } + @SubscribeEvent public void onPreUpdate(PreUpdateEvent event) { if (needToLoad) { @@ -194,31 +219,4 @@ public void loadDynamics() { } catch (NullPointerException ignored) { } } - - private static @NotNull Set getClassPath() { - Set classPath = new HashSet<>(); - - for (File file : Objects.requireNonNull(new File(mc.mcDataDir, "mods").listFiles())) { - if (file.exists() && file.isFile() && file.getName().endsWith(".jar")) - classPath.add(file); - } - classPath.add(new File(Raven.class.getProtectionDomain().getCodeSource().getLocation().getFile())); - classPath.add(new File(Minecraft.class.getProtectionDomain().getCodeSource().getLocation().getFile())); - return classPath; - } - - private static List findClassFiles(String dir) { - try (Stream stream = Files.walk(Paths.get(dir))) { - return stream.filter(file -> !Files.isDirectory(file) && file.toString().endsWith(".class")) - .map(Path::toFile) - .collect(Collectors.toList()); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - private static @NotNull String getClassName(@NotNull String outputDir, @NotNull File classFile) { - String relativePath = classFile.getAbsolutePath().substring(outputDir.length() + 1); - return relativePath.replace(File.separator, ".").replace(".class", ""); - } } diff --git a/src/main/java/keystrokesmod/module/impl/client/MiddleClick.java b/src/main/java/keystrokesmod/module/impl/client/MiddleClick.java index 5f5554f4..a2ce2d46 100644 --- a/src/main/java/keystrokesmod/module/impl/client/MiddleClick.java +++ b/src/main/java/keystrokesmod/module/impl/client/MiddleClick.java @@ -13,8 +13,8 @@ import org.lwjgl.input.Mouse; public class MiddleClick extends Module { - int prevSlot; public static ModeSetting middleClick; + int prevSlot; private boolean hasClicked; private int pearlEvent; diff --git a/src/main/java/keystrokesmod/module/impl/client/Notifications.java b/src/main/java/keystrokesmod/module/impl/client/Notifications.java index a757361f..01695071 100644 --- a/src/main/java/keystrokesmod/module/impl/client/Notifications.java +++ b/src/main/java/keystrokesmod/module/impl/client/Notifications.java @@ -22,6 +22,7 @@ public class Notifications extends Module { public static ModeValue mode; public static ButtonSetting chatNoti; public static ButtonSetting moduleToggled; + public Notifications() { super("Notifications", category.client); this.registerSetting(mode = new ModeValue("Mode", this) @@ -31,17 +32,6 @@ public Notifications() { this.registerSetting(moduleToggled = new ButtonSetting("Module toggled", true)); } - @Override - public void onEnable() { - mode.enable(); - notifs.clear(); - } - - @Override - public void onDisable() { - mode.disable(); - } - public static void sendNotification(NotificationTypes notificationType, String message) { sendNotification(notificationType, message, 3000); } @@ -65,6 +55,17 @@ public static void sendNotification(NotificationTypes notificationType, String m } } + @Override + public void onEnable() { + mode.enable(); + notifs.clear(); + } + + @Override + public void onDisable() { + mode.disable(); + } + @SubscribeEvent public void onTick(TickEvent.RenderTickEvent event) { ScaledResolution sr = new ScaledResolution(mc); diff --git a/src/main/java/keystrokesmod/module/impl/client/discordrpc/LunarClientRPC.java b/src/main/java/keystrokesmod/module/impl/client/discordrpc/LunarClientRPC.java index 8076d52b..255081f7 100644 --- a/src/main/java/keystrokesmod/module/impl/client/discordrpc/LunarClientRPC.java +++ b/src/main/java/keystrokesmod/module/impl/client/discordrpc/LunarClientRPC.java @@ -16,16 +16,15 @@ import java.net.URL; import java.util.HashMap; import java.util.Map; -import java.util.Set; import java.util.stream.Collectors; public class LunarClientRPC extends SubMode { - private final String clientId = "562286213059444737"; - private final String mappingUrl = "https://servermappings.lunarclientcdn.com/servers.json"; private static final String DEFAULT_SERVER_NAME = "Active in the launcher"; private static final String DEFAULT_IMAGE = "logo-default"; private static final String DEFAULT_SMALL_IMAGE = "logo-blue"; - private Map serverDataMap = new HashMap<>(); + private final String clientId = "562286213059444737"; + private final String mappingUrl = "https://servermappings.lunarclientcdn.com/servers.json"; + private final Map serverDataMap = new HashMap<>(); private boolean started; private String serverName; private String bigImage; @@ -35,9 +34,10 @@ public LunarClientRPC(String name, DiscordRpc parent) { super(name, parent); } - private static class ServerData { - String name; - String logo; + private static String readFromConnection(HttpURLConnection connection) throws IOException { + try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) { + return reader.lines().collect(Collectors.joining("\n")); + } } @Override @@ -116,12 +116,6 @@ private void fetchServerMappings() throws IOException { } } - private static String readFromConnection(HttpURLConnection connection) throws IOException { - try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) { - return reader.lines().collect(Collectors.joining("\n")); - } - } - private boolean findServerData(String serverIP) { if (serverIP == null) return false; serverIP = serverIP.toLowerCase(); @@ -146,7 +140,6 @@ private boolean findServerData(String serverIP) { return false; } - private void updatePrivateRPC() { bigImage = DEFAULT_IMAGE; serverName = "Playing Private Server"; @@ -168,4 +161,9 @@ public DiscordRichPresence makeRPC(String small, String smallText, String bigTex .setStartTimestamps(System.currentTimeMillis()) .build(); } + + private static class ServerData { + String name; + String logo; + } } diff --git a/src/main/java/keystrokesmod/module/impl/combat/AimAssist.java b/src/main/java/keystrokesmod/module/impl/combat/AimAssist.java index fb46241e..0b263ef5 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/AimAssist.java +++ b/src/main/java/keystrokesmod/module/impl/combat/AimAssist.java @@ -2,7 +2,8 @@ import keystrokesmod.module.Module; -import keystrokesmod.module.impl.combat.aimassist.*; +import keystrokesmod.module.impl.combat.aimassist.NormalAimAssist; +import keystrokesmod.module.impl.combat.aimassist.TejasAssist; import keystrokesmod.module.setting.impl.ModeValue; public class AimAssist extends Module { diff --git a/src/main/java/keystrokesmod/module/impl/combat/AutoClicker.java b/src/main/java/keystrokesmod/module/impl/combat/AutoClicker.java index d2bfa50d..1a0798d6 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/AutoClicker.java +++ b/src/main/java/keystrokesmod/module/impl/combat/AutoClicker.java @@ -18,8 +18,6 @@ import net.minecraft.util.MovingObjectPosition; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import java.util.List; - public class AutoClicker extends IAutoClicker { private final ModeValue mode; private final ButtonSetting breakBlocks; diff --git a/src/main/java/keystrokesmod/module/impl/combat/AutoGapple.java b/src/main/java/keystrokesmod/module/impl/combat/AutoGapple.java index 2688b1e7..22d0a4ed 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/AutoGapple.java +++ b/src/main/java/keystrokesmod/module/impl/combat/AutoGapple.java @@ -1,7 +1,8 @@ package keystrokesmod.module.impl.combat; -import keystrokesmod.event.*; -import keystrokesmod.mixins.impl.network.S14PacketEntityAccessor; +import keystrokesmod.event.PreMoveEvent; +import keystrokesmod.event.PreUpdateEvent; +import keystrokesmod.event.SendPacketEvent; import keystrokesmod.module.Module; import keystrokesmod.module.impl.other.SlotHandler; import keystrokesmod.module.impl.player.Blink; @@ -18,11 +19,9 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.network.Packet; -import net.minecraft.network.play.INetHandlerPlayClient; -import net.minecraft.network.play.client.*; -import net.minecraft.network.play.server.*; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; +import net.minecraft.network.play.client.C03PacketPlayer; +import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; +import net.minecraft.network.play.client.C09PacketHeldItemChange; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -33,24 +32,21 @@ import java.util.concurrent.ConcurrentLinkedQueue; public class AutoGapple extends Module { + public final ButtonSetting disableKillAura; private final SliderSetting minHealth; private final SliderSetting delayBetweenHeal; - public final ButtonSetting disableKillAura; private final ButtonSetting airStuck; private final ButtonSetting blink; private final ButtonSetting visual; private final ButtonSetting onlyWhileKillAura; - - public boolean working = false; - private int eatingTicksLeft = 0; - private int releaseLeft = 0; - private int foodSlot; - private final Queue> delayedSend = new ConcurrentLinkedQueue<>(); private final HashMap realPositions = new HashMap<>(); - private final Animation animation = new Animation(Easing.EASE_OUT_CIRC, 500); private final Progress progress = new Progress("AutoGapple"); + public boolean working = false; + private int eatingTicksLeft = 0; + private int releaseLeft = 0; + private int foodSlot; public AutoGapple() { super("AutoGapple", category.combat, "Made for QuickMacro."); diff --git a/src/main/java/keystrokesmod/module/impl/combat/AutoRod.java b/src/main/java/keystrokesmod/module/impl/combat/AutoRod.java index b5dd9df1..750ab640 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/AutoRod.java +++ b/src/main/java/keystrokesmod/module/impl/combat/AutoRod.java @@ -2,7 +2,6 @@ import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.event.RotationEvent; -import keystrokesmod.module.ModuleManager; import keystrokesmod.module.impl.combat.autoclicker.IAutoClicker; import keystrokesmod.module.impl.combat.autoclicker.LowCPSAutoClicker; import keystrokesmod.module.impl.combat.autoclicker.NormalAutoClicker; @@ -17,7 +16,9 @@ import keystrokesmod.module.setting.impl.ModeValue; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.script.classes.Vec3; -import keystrokesmod.utility.*; +import keystrokesmod.utility.MoveUtil; +import keystrokesmod.utility.RotationUtils; +import keystrokesmod.utility.Utils; import keystrokesmod.utility.aim.AimSimulator; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Items; diff --git a/src/main/java/keystrokesmod/module/impl/combat/BlockHit.java b/src/main/java/keystrokesmod/module/impl/combat/BlockHit.java index 56292c4e..cf2e492d 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/BlockHit.java +++ b/src/main/java/keystrokesmod/module/impl/combat/BlockHit.java @@ -2,7 +2,10 @@ import keystrokesmod.module.Module; import keystrokesmod.module.impl.world.AntiBot; -import keystrokesmod.module.setting.impl.*; +import keystrokesmod.module.setting.impl.ButtonSetting; +import keystrokesmod.module.setting.impl.DescriptionSetting; +import keystrokesmod.module.setting.impl.ModeSetting; +import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.CoolDown; import keystrokesmod.utility.Utils; import net.minecraft.client.settings.KeyBinding; @@ -19,11 +22,12 @@ public class BlockHit extends Module { public static SliderSetting range, chance, waitMsMin, waitMsMax, hitPerMin, hitPerMax, postDelayMin, postDelayMax; public static DescriptionSetting eventTypeDesc; public static ModeSetting eventType; - private final String[] MODES = new String[]{"PRE", "POST"}; public static ButtonSetting onlyPlayers, onRightMBHold; public static boolean executingAction, hitCoolDown, alreadyHit, safeGuard; public static int hitTimeout, hitsWaited; - private CoolDown actionTimer = new CoolDown(0), postDelayTimer = new CoolDown(0); + private final String[] MODES = new String[]{"PRE", "POST"}; + private final CoolDown actionTimer = new CoolDown(0); + private final CoolDown postDelayTimer = new CoolDown(0); private boolean waitingForPostDelay; public BlockHit() { @@ -34,13 +38,28 @@ public BlockHit() { this.registerSetting(waitMsMax = new SliderSetting("Action Time Max (MS)", 150, 1, 500, 1)); this.registerSetting(hitPerMin = new SliderSetting("Once every Min hits", 1, 1, 10, 1)); this.registerSetting(hitPerMax = new SliderSetting("Once every Max hits", 1, 1, 10, 1)); - this.registerSetting(postDelayMin = new SliderSetting("Post Delay Min (MS)", 10, 0, 500, 1)); + this.registerSetting(postDelayMin = new SliderSetting("Post Delay Min (MS)", 10, 0, 500, 1)); this.registerSetting(postDelayMax = new SliderSetting("Post Delay Max (MS)", 40, 0, 500, 1)); - this.registerSetting(chance = new SliderSetting("Chance %", 100, 0, 100, 1)); + this.registerSetting(chance = new SliderSetting("Chance %", 100, 0, 100, 1)); this.registerSetting(range = new SliderSetting("Range: ", 3, 1, 6, 0.05)); this.registerSetting(eventType = new ModeSetting("Value: ", MODES, 1)); } + private static void finishCombo() { + int key = mc.gameSettings.keyBindUseItem.getKeyCode(); + KeyBinding.setKeyBindState(key, false); + Utils.setMouseButtonState(1, false); + } + + private static void startCombo() { + if (Keyboard.isKeyDown(mc.gameSettings.keyBindForward.getKeyCode())) { + int key = mc.gameSettings.keyBindUseItem.getKeyCode(); + KeyBinding.setKeyBindState(key, true); + KeyBinding.onTick(key); + Utils.setMouseButtonState(1, true); + } + } + public void guiUpdate() { Utils.correctValue(waitMsMin, waitMsMax); Utils.correctValue(hitPerMin, hitPerMax); @@ -49,48 +68,48 @@ public void guiUpdate() { @SubscribeEvent public void onTick(TickEvent.RenderTickEvent e) { - if(!Utils.nullCheck()) + if (!Utils.nullCheck()) return; - if(onRightMBHold.isToggled() && !Utils.tryingToCombo()){ - if(!safeGuard || Utils.holdingWeapon() && Mouse.isButtonDown(0)) { + if (onRightMBHold.isToggled() && !Utils.tryingToCombo()) { + if (!safeGuard || Utils.holdingWeapon() && Mouse.isButtonDown(0)) { safeGuard = true; finishCombo(); } return; } - if(waitingForPostDelay){ - if(postDelayTimer.hasFinished()){ + if (waitingForPostDelay) { + if (postDelayTimer.hasFinished()) { executingAction = true; startCombo(); waitingForPostDelay = false; - if(safeGuard) safeGuard = false; + if (safeGuard) safeGuard = false; actionTimer.start(); } return; } - if(executingAction) { - if(actionTimer.hasFinished()){ + if (executingAction) { + if (actionTimer.hasFinished()) { executingAction = false; finishCombo(); return; - }else { + } else { return; } } - if(onRightMBHold.isToggled() && Utils.tryingToCombo()) { - if(mc.objectMouseOver == null || mc.objectMouseOver.entityHit == null) { - if(!safeGuard || Utils.holdingWeapon() && Mouse.isButtonDown(0)) { + if (onRightMBHold.isToggled() && Utils.tryingToCombo()) { + if (mc.objectMouseOver == null || mc.objectMouseOver.entityHit == null) { + if (!safeGuard || Utils.holdingWeapon() && Mouse.isButtonDown(0)) { safeGuard = true; finishCombo(); } return; } else { Entity target = mc.objectMouseOver.entityHit; - if(target.isDead) { - if(!safeGuard || Utils.holdingWeapon() && Mouse.isButtonDown(0)) { + if (target.isDead) { + if (!safeGuard || Utils.holdingWeapon() && Mouse.isButtonDown(0)) { safeGuard = true; finishCombo(); } @@ -101,9 +120,9 @@ public void onTick(TickEvent.RenderTickEvent e) { if (mc.objectMouseOver != null && mc.objectMouseOver.entityHit instanceof Entity && Mouse.isButtonDown(0)) { Entity target = mc.objectMouseOver.entityHit; - if(target.isDead) { - if(onRightMBHold.isToggled() && Mouse.isButtonDown(1) && Mouse.isButtonDown(0)) { - if(!safeGuard || Utils.holdingWeapon() && Mouse.isButtonDown(0)) { + if (target.isDead) { + if (onRightMBHold.isToggled() && Mouse.isButtonDown(1) && Mouse.isButtonDown(0)) { + if (!safeGuard || Utils.holdingWeapon() && Mouse.isButtonDown(0)) { safeGuard = true; finishCombo(); } @@ -114,20 +133,20 @@ public void onTick(TickEvent.RenderTickEvent e) { if (mc.thePlayer.getDistanceToEntity(target) <= range.getInput()) { if ((target.hurtResistantTime >= 10 && MODES[(int) eventType.getInput()] == MODES[1]) || (target.hurtResistantTime <= 10 && MODES[(int) eventType.getInput()] == MODES[0])) { - if (onlyPlayers.isToggled()){ - if (!(target instanceof EntityPlayer)){ + if (onlyPlayers.isToggled()) { + if (!(target instanceof EntityPlayer)) { return; } } - if(AntiBot.isBot(target)){ + if (AntiBot.isBot(target)) { return; } if (hitCoolDown && !alreadyHit) { hitsWaited++; - if(hitsWaited >= hitTimeout){ + if (hitsWaited >= hitTimeout) { hitCoolDown = false; hitsWaited = 0; } else { @@ -136,13 +155,13 @@ public void onTick(TickEvent.RenderTickEvent e) { } } - if(!(chance.getInput() == 100 || Math.random() <= chance.getInput() / 100)) + if (!(chance.getInput() == 100 || Math.random() <= chance.getInput() / 100)) return; - if(!alreadyHit){ + if (!alreadyHit) { guiUpdate(); - if(hitPerMin.getInput() == hitPerMax.getInput()) { - hitTimeout = (int) hitPerMin.getInput(); + if (hitPerMin.getInput() == hitPerMax.getInput()) { + hitTimeout = (int) hitPerMin.getInput(); } else { hitTimeout = ThreadLocalRandom.current().nextInt((int) hitPerMin.getInput(), (int) hitPerMax.getInput()); @@ -150,9 +169,9 @@ public void onTick(TickEvent.RenderTickEvent e) { hitCoolDown = true; hitsWaited = 0; - actionTimer.setCooldown((long)ThreadLocalRandom.current().nextDouble(waitMsMin.getInput(), waitMsMax.getInput()+0.01)); - if(postDelayMax.getInput() != 0){ - postDelayTimer.setCooldown((long)ThreadLocalRandom.current().nextDouble(postDelayMin.getInput(), postDelayMax.getInput()+0.01)); + actionTimer.setCooldown((long) ThreadLocalRandom.current().nextDouble(waitMsMin.getInput(), waitMsMax.getInput() + 0.01)); + if (postDelayMax.getInput() != 0) { + postDelayTimer.setCooldown((long) ThreadLocalRandom.current().nextDouble(postDelayMin.getInput(), postDelayMax.getInput() + 0.01)); postDelayTimer.start(); waitingForPostDelay = true; } else { @@ -160,33 +179,18 @@ public void onTick(TickEvent.RenderTickEvent e) { startCombo(); actionTimer.start(); alreadyHit = true; - if(safeGuard) safeGuard = false; + if (safeGuard) safeGuard = false; } alreadyHit = true; } } else { - if(alreadyHit){ + if (alreadyHit) { alreadyHit = false; } - if(safeGuard) safeGuard = false; + if (safeGuard) safeGuard = false; } } } } - - private static void finishCombo() { - int key = mc.gameSettings.keyBindUseItem.getKeyCode(); - KeyBinding.setKeyBindState(key, false); - Utils.setMouseButtonState(1, false); - } - - private static void startCombo() { - if(Keyboard.isKeyDown(mc.gameSettings.keyBindForward.getKeyCode())) { - int key = mc.gameSettings.keyBindUseItem.getKeyCode(); - KeyBinding.setKeyBindState(key, true); - KeyBinding.onTick(key); - Utils.setMouseButtonState(1, true); - } - } } \ No newline at end of file diff --git a/src/main/java/keystrokesmod/module/impl/combat/ClickAssist.java b/src/main/java/keystrokesmod/module/impl/combat/ClickAssist.java index 511012de..057ef9c0 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/ClickAssist.java +++ b/src/main/java/keystrokesmod/module/impl/combat/ClickAssist.java @@ -5,8 +5,8 @@ import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.DescriptionSetting; import keystrokesmod.module.setting.impl.SliderSetting; -import keystrokesmod.utility.clicks.CPSCalculator; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.clicks.CPSCalculator; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraftforge.client.event.MouseEvent; @@ -17,9 +17,16 @@ import java.awt.*; public class ClickAssist extends Module { - private DescriptionSetting description; - private SliderSetting chanceLeft, chanceRight; - private ButtonSetting rightClick, blocksOnly, weaponOnly, onlyWhileTargeting, aboveCPS, leftClick, disableInCreative; + private final DescriptionSetting description; + private final SliderSetting chanceLeft; + private final SliderSetting chanceRight; + private final ButtonSetting rightClick; + private final ButtonSetting blocksOnly; + private final ButtonSetting weaponOnly; + private final ButtonSetting onlyWhileTargeting; + private final ButtonSetting aboveCPS; + private final ButtonSetting leftClick; + private final ButtonSetting disableInCreative; private Robot bot; private boolean ignNL = false; private boolean ignNR = false; @@ -64,8 +71,7 @@ public void onMouseUpdate(MouseEvent ev) { if (ev.button == 0 && leftClick.isToggled() && chanceLeft.getInput() != 0.0D) { if (this.ignNL) { this.ignNL = false; - } - else { + } else { if (chanceLeft.getInput() == 0) { return; } @@ -86,12 +92,10 @@ public void onMouseUpdate(MouseEvent ev) { this.bot.mousePress(16); this.ignNL = true; } - } - else if (ev.button == 1 && rightClick.isToggled()) { + } else if (ev.button == 1 && rightClick.isToggled()) { if (this.ignNR) { this.ignNR = false; - } - else { + } else { if (chanceRight.getInput() == 0) { return; } @@ -123,13 +127,13 @@ else if (ev.button == 1 && rightClick.isToggled()) { this.fix(1); } } + private void fix(int t) { if (t == 0) { if (this.ignNL && !Mouse.isButtonDown(0)) { this.bot.mouseRelease(16); } - } - else if (t == 1 && this.ignNR && !Mouse.isButtonDown(1)) { + } else if (t == 1 && this.ignNR && !Mouse.isButtonDown(1)) { this.bot.mouseRelease(4); } diff --git a/src/main/java/keystrokesmod/module/impl/combat/HitBox.java b/src/main/java/keystrokesmod/module/impl/combat/HitBox.java index abf0f9b9..3121b0a5 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/HitBox.java +++ b/src/main/java/keystrokesmod/module/impl/combat/HitBox.java @@ -25,10 +25,10 @@ public class HitBox extends Module { public static SliderSetting multiplier; - public ButtonSetting showHitbox; public static ButtonSetting playersOnly; public static ButtonSetting weaponOnly; private static MovingObjectPosition mv; + public ButtonSetting showHitbox; public HitBox() { super("HitBox", category.combat, 0); @@ -38,21 +38,6 @@ public HitBox() { this.registerSetting(weaponOnly = new ButtonSetting("Weapon only", false)); } - @Override - public String getInfo() { - return ((int) multiplier.getInput() == multiplier.getInput() ? (int) multiplier.getInput() + "" : multiplier.getInput()) + " " + multiplier.getPrettyInfo(); - } - - @SubscribeEvent(priority = EventPriority.HIGHEST) - public void m(MouseEvent e) { - if (Utils.nullCheck()) { - if (e.button != 0 || !e.buttonstate || multiplier.getInput() == 1 || mc.thePlayer.isBlocking() || mc.currentScreen != null) { - return; - } - call(); - } - } - public static void call() { if (!ModuleManager.hitBox.isEnabled()) return; if (weaponOnly.isToggled() && !Utils.holdingWeapon()) { @@ -72,17 +57,6 @@ public static void call() { mc.objectMouseOver = mv; } - @SubscribeEvent - public void onRenderWorld(RenderWorldLastEvent e) { - if (showHitbox.isToggled() && Utils.nullCheck()) { - for (Entity en : mc.theWorld.loadedEntityList) { - if (en != mc.thePlayer && en instanceof EntityLivingBase && ((EntityLivingBase) en).deathTime == 0 && !(en instanceof EntityArmorStand) && !en.isInvisible()) { - this.rh(en, Color.WHITE); - } - } - } - } - public static double getExpand(Entity en) { return multiplier.getInput(); } @@ -104,14 +78,14 @@ public static EntityLivingBase getEntity(float partialTicks) { Vec3 vec5 = vec3.addVector(vec4.xCoord * d0, vec4.yCoord * d0, vec4.zCoord * d0); Vec3 vec6 = null; float f1 = 1.0F; - List list = mc.theWorld.getEntitiesWithinAABBExcludingEntity(mc.getRenderViewEntity(), mc.getRenderViewEntity().getEntityBoundingBox().addCoord(vec4.xCoord * d0, vec4.yCoord * d0, vec4.zCoord * d0).expand((double) f1, (double) f1, (double) f1)); + List list = mc.theWorld.getEntitiesWithinAABBExcludingEntity(mc.getRenderViewEntity(), mc.getRenderViewEntity().getEntityBoundingBox().addCoord(vec4.xCoord * d0, vec4.yCoord * d0, vec4.zCoord * d0).expand(f1, f1, f1)); double d3 = d2; for (Object o : list) { Entity entity = (Entity) o; if (entity.canBeCollidedWith()) { float ex = (float) ((double) entity.getCollisionBorderSize() * getExpand(entity)); - AxisAlignedBB ax = entity.getEntityBoundingBox().expand((double) ex, (double) ex, (double) ex); + AxisAlignedBB ax = entity.getEntityBoundingBox().expand(ex, ex, ex); MovingObjectPosition mop = ax.calculateIntercept(vec3, vec5); if (ax.isVecInside(vec3)) { if (0.0D < d3 || d3 == 0.0D) { @@ -147,13 +121,39 @@ public static EntityLivingBase getEntity(float partialTicks) { return null; } + @Override + public String getInfo() { + return ((int) multiplier.getInput() == multiplier.getInput() ? (int) multiplier.getInput() + "" : multiplier.getInput()) + " " + multiplier.getPrettyInfo(); + } + + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void m(MouseEvent e) { + if (Utils.nullCheck()) { + if (e.button != 0 || !e.buttonstate || multiplier.getInput() == 1 || mc.thePlayer.isBlocking() || mc.currentScreen != null) { + return; + } + call(); + } + } + + @SubscribeEvent + public void onRenderWorld(RenderWorldLastEvent e) { + if (showHitbox.isToggled() && Utils.nullCheck()) { + for (Entity en : mc.theWorld.loadedEntityList) { + if (en != mc.thePlayer && en instanceof EntityLivingBase && ((EntityLivingBase) en).deathTime == 0 && !(en instanceof EntityArmorStand) && !en.isInvisible()) { + this.rh(en, Color.WHITE); + } + } + } + } + private void rh(Entity e, Color c) { if (e instanceof EntityLivingBase) { double x = e.lastTickPosX + (e.posX - e.lastTickPosX) * (double) Utils.getTimer().renderPartialTicks - mc.getRenderManager().viewerPosX; double y = e.lastTickPosY + (e.posY - e.lastTickPosY) * (double) Utils.getTimer().renderPartialTicks - mc.getRenderManager().viewerPosY; double z = e.lastTickPosZ + (e.posZ - e.lastTickPosZ) * (double) Utils.getTimer().renderPartialTicks - mc.getRenderManager().viewerPosZ; float ex = (float) ((double) e.getCollisionBorderSize() * multiplier.getInput()); - AxisAlignedBB bbox = e.getEntityBoundingBox().expand((double) ex, (double) ex, (double) ex); + AxisAlignedBB bbox = e.getEntityBoundingBox().expand(ex, ex, ex); AxisAlignedBB axis = new AxisAlignedBB(bbox.minX - e.posX + x, bbox.minY - e.posY + y, bbox.minZ - e.posZ + z, bbox.maxX - e.posX + x, bbox.maxY - e.posY + y, bbox.maxZ - e.posZ + z); GL11.glBlendFunc(770, 771); GL11.glEnable(3042); @@ -161,7 +161,7 @@ private void rh(Entity e, Color c) { GL11.glDisable(2929); GL11.glDepthMask(false); GL11.glLineWidth(2.0F); - GL11.glColor3d((double) c.getRed(), (double) c.getGreen(), (double) c.getBlue()); + GL11.glColor3d(c.getRed(), c.getGreen(), c.getBlue()); RenderGlobal.drawSelectionBoundingBox(axis); GL11.glEnable(3553); GL11.glEnable(2929); diff --git a/src/main/java/keystrokesmod/module/impl/combat/HitSelect.java b/src/main/java/keystrokesmod/module/impl/combat/HitSelect.java index a46d4ce1..0c20d478 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/HitSelect.java +++ b/src/main/java/keystrokesmod/module/impl/combat/HitSelect.java @@ -15,19 +15,18 @@ public class HitSelect extends Module { private static final String[] MODES = new String[]{"Pause", "Active"}; private static final String[] PREFERENCES = new String[]{"Move speed", "KB reduction", "Critical hits"}; + private static long attackTime = -1; + private static boolean currentShouldAttack = false; private final ModeSetting preference; private final ModeSetting mode; private final SliderSetting delay; private final SliderSetting chance; - private static long attackTime = -1; - private static boolean currentShouldAttack = false; - public HitSelect() { super("HitSelect", category.combat, "Chooses the best time to hit."); this.registerSetting(mode = new ModeSetting("Mode", MODES, 0, "Pause: Legitimate pause clicking\n" + - "Active: Cancel attack but allow click")); + "Active: Cancel attack but allow click")); this.registerSetting(preference = new ModeSetting("Preference", PREFERENCES, 0, "Move speed: Keep sprint but legitimate\n" + "KB reduction: KnockBack reduction\n" + @@ -36,6 +35,15 @@ public HitSelect() { this.registerSetting(chance = new SliderSetting("Chance", 80, 0, 100, 1)); } + public static boolean canAttack() { + return canSwing(); + } + + public static boolean canSwing() { + if (!hitSelect.isEnabled() || hitSelect.mode.getInput() == 1) return true; + return currentShouldAttack; + } + @Override public String getInfo() { return MODES[(int) mode.getInput()]; @@ -72,13 +80,4 @@ public void onPreUpdate(PreUpdateEvent event) { currentShouldAttack = System.currentTimeMillis() - HitSelect.attackTime >= hitSelect.delay.getInput(); } } - - public static boolean canAttack() { - return canSwing(); - } - - public static boolean canSwing() { - if (!hitSelect.isEnabled() || hitSelect.mode.getInput() == 1) return true; - return currentShouldAttack; - } } diff --git a/src/main/java/keystrokesmod/module/impl/combat/KillAura.java b/src/main/java/keystrokesmod/module/impl/combat/KillAura.java index 91d6cb18..d596deea 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/KillAura.java +++ b/src/main/java/keystrokesmod/module/impl/combat/KillAura.java @@ -45,8 +45,10 @@ import org.jetbrains.annotations.Nullable; import org.lwjgl.input.Mouse; -import java.util.*; +import java.util.ArrayList; +import java.util.Comparator; import java.util.List; +import java.util.Objects; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.atomic.AtomicBoolean; @@ -54,19 +56,16 @@ public class KillAura extends IAutoClicker { public static EntityLivingBase target; + public final SliderSetting attackRange; private final ModeValue clickMode; private final ModeSetting attackMode; - public ModeSetting autoBlockMode; private final ButtonSetting smartBlock; private final ButtonSetting blockOnlyWhileSwinging; private final ButtonSetting blockOnlyWhileHurt; - public SliderSetting slowdown; private final SliderSetting fov; - public final SliderSetting attackRange; private final SliderSetting swingRange; private final SliderSetting blockRange; private final SliderSetting preAimRange; - private final ModeSetting rotationMode; private final ModeSetting moveFixMode; private final ModeSetting rayCastMode; @@ -92,14 +91,12 @@ public class KillAura extends IAutoClicker { private final SliderSetting offsetHorizontal; private final SliderSetting offsetVertical; private final ModeSetting offsetTiming; - private final ModeSetting sortMode; private final SliderSetting switchDelay; private final SliderSetting targets; private final ButtonSetting targetInvisible; private final ButtonSetting targetPlayer; private final ButtonSetting targetEntity; - private final ButtonSetting disableInInventory; private final ButtonSetting disableWhileBlocking; private final ButtonSetting disableWhileMining; @@ -108,17 +105,22 @@ public class KillAura extends IAutoClicker { private final SliderSetting postDelay; private final ButtonSetting hitThroughBlocks; private final ButtonSetting ignoreTeammates; - public ButtonSetting manualBlock; private final ButtonSetting requireMouseDown; private final ButtonSetting silentSwing; private final ButtonSetting weaponOnly; - private final ButtonSetting dot; private final SliderSetting dotSize; - private final String[] rotationModes = new String[]{"None", "Silent", "Lock view"}; private final List availableTargets = new ArrayList<>(); + private final ConcurrentLinkedQueue> blinkedPackets = new ConcurrentLinkedQueue<>(); + private final AimSimulator aimSimulator = new AimSimulator(); + public ModeSetting autoBlockMode; + public SliderSetting slowdown; + public ButtonSetting manualBlock; public AtomicBoolean block = new AtomicBoolean(); + public boolean blinking; + public boolean lag; + public boolean rmbDown; private long lastSwitched = System.currentTimeMillis(); private boolean switchTargets; private byte entityIndex; @@ -126,16 +128,10 @@ public class KillAura extends IAutoClicker { @Getter private boolean attack; private boolean blocking; - public boolean blinking; - public boolean lag; private boolean swapped; - public boolean rmbDown; private float[] rotations = new float[]{0, 0}; - private final ConcurrentLinkedQueue> blinkedPackets = new ConcurrentLinkedQueue<>(); private EntityLivingBase lastAttackTarget = null; - private int blockingTime = 0; - private final AimSimulator aimSimulator = new AimSimulator(); private @Nullable Animation animationX; private @Nullable Animation animationY; private @Nullable Animation animationZ; @@ -149,7 +145,7 @@ public KillAura() { .setDefaultValue("Normal") ); this.registerSetting(attackMode = new ModeSetting("Attack mode", new String[]{"Legit", "Packet"}, 1)); - String[] autoBlockModes = new String[]{"Manual", "Vanilla", "Post", "Swap", "Interact A", "Interact B", "Fake", "Partial", "QuickMacro"}; + String[] autoBlockModes = new String[]{"Manual", "Vanilla", "Post", "Swap", "Interact A", "Interact B", "Fake", "Partial", "QuickMacro", "Hypixel"}; this.registerSetting(autoBlockMode = new ModeSetting("Autoblock", autoBlockModes, 0)); final ModeOnly autoBlock = new ModeOnly(autoBlockMode, 0).reserve(); this.registerSetting(smartBlock = new ButtonSetting("Smart block", false, autoBlock)); @@ -215,6 +211,19 @@ public KillAura() { this.registerSetting(dotSize = new SliderSetting("Dot size", 0.1, 0.05, 0.2, 0.05, dot::isToggled)); } + public static boolean behindBlocks(float[] rotations, EntityLivingBase target) { + try { + Vec3 eyePos = Utils.getEyePos(); + MovingObjectPosition hitResult = RotationUtils.rayCast( + RotationUtils.getNearestPoint(target.getEntityBoundingBox(), eyePos).distanceTo(eyePos) - 0.05, + rotations[0], rotations[1] + ); + return hitResult != null; + } catch (NullPointerException ignored) { + } + return false; + } + public void onEnable() { clickMode.enable(); this.rotations = new float[]{mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch}; @@ -346,7 +355,7 @@ public void onPreUpdate(PreUpdateEvent event) { if (lag) { blinking = true; if (Raven.badPacketsHandler.playerSlot != mc.thePlayer.inventory.currentItem % 8 + 1) { - mc.thePlayer.sendQueue.addToSendQueue(new C09PacketHeldItemChange( mc.thePlayer.inventory.currentItem % 8 + 1)); + mc.thePlayer.sendQueue.addToSendQueue(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem % 8 + 1)); Raven.badPacketsHandler.playerSlot = mc.thePlayer.inventory.currentItem % 8 + 1; swapped = true; } @@ -368,8 +377,7 @@ public void onPreUpdate(PreUpdateEvent event) { blinking = true; unBlock(); lag = false; - } - else { + } else { attackAndInteract(target, autoBlockMode.getInput() == 5); // attack while blinked releasePackets(); // release sendBlock(); // block after releasing unblock @@ -386,10 +394,21 @@ public void onPreUpdate(PreUpdateEvent event) { sendBlock(); } break; + case 9: + if (lag) { + blinking = true; + unBlock(); + lag = false; + } else { + attackAndInteract(target, true, Utils.getEyePos(target)); // attack while blinked + releasePackets(); // release + sendBlock(); // block after releasing unblock + lag = true; + } + break; } return; - } - else if (blinking || lag) { + } else if (blinking || lag) { resetBlinkState(true); } if (target == null) { @@ -476,8 +495,7 @@ public void onMouse(final @NotNull MouseEvent mouseEvent) { if (target != null || swing) { mouseEvent.setCanceled(true); } - } - else if (mouseEvent.button == 1) { + } else if (mouseEvent.button == 1) { rmbDown = mouseEvent.buttonstate; if (autoBlockMode.getInput() >= 1 && Utils.holdingSword() && block.get() && autoBlockMode.getInput() != 7) { KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.getKeyCode(), false); @@ -552,7 +570,7 @@ private void block() { case 0: // manual setBlockState(false, false, true); break; - case 8: + case 8: // quickmacro case 1: // vanilla setBlockState(block.get(), true, true); break; @@ -562,6 +580,7 @@ private void block() { case 3: // interact case 4: case 5: + case 9: // hypixel setBlockState(block.get(), false, false); break; case 6: // fake @@ -669,10 +688,10 @@ private void setTarget(float[] rotations) { Comparator comparator = null; switch ((int) sortMode.getInput()) { case 0: - comparator = Comparator.comparingDouble(entityPlayer -> (double)entityPlayer.getHealth()); + comparator = Comparator.comparingDouble(entityPlayer -> (double) entityPlayer.getHealth()); break; case 1: - comparator = Comparator.comparingDouble(entityPlayer2 -> (double)entityPlayer2.hurtTime); + comparator = Comparator.comparingDouble(entityPlayer2 -> (double) entityPlayer2.hurtTime); break; case 2: comparator = Comparator.comparingDouble(entity -> mc.thePlayer.getDistanceSqToEntity(entity)); @@ -720,10 +739,13 @@ private boolean playerNoAction() { } private void attackAndInteract(EntityLivingBase target, boolean sendInteractAt) { + attackAndInteract(target, sendInteractAt, aimSimulator.getHitPos()); + } + + private void attackAndInteract(EntityLivingBase target, boolean sendInteractAt, Vec3 hitVec) { if (target != null && attack) { if (!attack(target)) return; if (sendInteractAt) { - Vec3 hitVec = aimSimulator.getHitPos(); if (hitVec != null) { hitVec = new Vec3(hitVec.x - target.posX, hitVec.y - target.posY, hitVec.z - target.posZ); mc.thePlayer.sendQueue.addToSendQueue(new C02PacketUseEntity(target, hitVec.toVec3())); @@ -798,19 +820,6 @@ private void releasePackets() { blinking = false; } - public static boolean behindBlocks(float[] rotations, EntityLivingBase target) { - try { - Vec3 eyePos = Utils.getEyePos(); - MovingObjectPosition hitResult = RotationUtils.rayCast( - RotationUtils.getNearestPoint(target.getEntityBoundingBox(), eyePos).distanceTo(eyePos) - 0.01, - RotationHandler.getRotationYaw(), RotationHandler.getRotationPitch() - ); - return hitResult != null; - } catch (NullPointerException ignored) { - } - return false; - } - @Override public boolean click() { if (swing) diff --git a/src/main/java/keystrokesmod/module/impl/combat/RageBot.java b/src/main/java/keystrokesmod/module/impl/combat/RageBot.java index 554e08c0..d445eae3 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/RageBot.java +++ b/src/main/java/keystrokesmod/module/impl/combat/RageBot.java @@ -4,7 +4,10 @@ import keystrokesmod.Raven; import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.event.RotationEvent; -import keystrokesmod.module.impl.combat.autoclicker.*; +import keystrokesmod.module.impl.combat.autoclicker.IAutoClicker; +import keystrokesmod.module.impl.combat.autoclicker.LowCPSAutoClicker; +import keystrokesmod.module.impl.combat.autoclicker.NormalAutoClicker; +import keystrokesmod.module.impl.combat.autoclicker.RecordAutoClicker; import keystrokesmod.module.impl.combat.ragebot.IRageBotFeature; import keystrokesmod.module.impl.combat.ragebot.nospread.LegitNoSpread; import keystrokesmod.module.impl.combat.ragebot.nospread.SwitchNoSpread; @@ -14,10 +17,14 @@ import keystrokesmod.module.impl.other.SlotHandler; import keystrokesmod.module.impl.other.anticheats.utils.world.PlayerRotation; import keystrokesmod.module.impl.world.AntiBot; -import keystrokesmod.module.setting.impl.*; +import keystrokesmod.module.setting.impl.ButtonSetting; +import keystrokesmod.module.setting.impl.ModeSetting; +import keystrokesmod.module.setting.impl.ModeValue; +import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.utils.ModeOnly; import keystrokesmod.script.classes.Vec3; -import keystrokesmod.utility.*; +import keystrokesmod.utility.RageBotUtils; +import keystrokesmod.utility.Utils; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.monster.EntityGiantZombie; @@ -27,7 +34,6 @@ import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.MovingObjectPosition; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.apache.commons.lang3.tuple.Triple; @@ -35,12 +41,12 @@ import java.util.*; public class RageBot extends IAutoClicker { + public final ModeSetting weaponMode; + public final ModeSetting priorityHitBox; private final ModeValue clickMode; private final ModeSetting mode; private final SliderSetting switchDelay; private final ModeSetting sortMode; - public final ModeSetting weaponMode; - public final ModeSetting priorityHitBox; private final SliderSetting range; private final SliderSetting fov; private final ButtonSetting perfect; @@ -58,12 +64,11 @@ public class RageBot extends IAutoClicker { private final ButtonSetting ignoreTeammates; private final ButtonSetting ignoreTeammatesCSGO; private final ButtonSetting notWhileKillAura; - + private final Set switchedTarget = new HashSet<>(); public boolean targeted = false; - private boolean armed = false; public Pair, Triple> target = null; + private boolean armed = false; private int predTicks = 0; - private final Set switchedTarget = new HashSet<>(); private long lastSwitched = -1; public RageBot() { diff --git a/src/main/java/keystrokesmod/module/impl/combat/Reach.java b/src/main/java/keystrokesmod/module/impl/combat/Reach.java index d992c9f6..c89848b7 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/Reach.java +++ b/src/main/java/keystrokesmod/module/impl/combat/Reach.java @@ -39,17 +39,6 @@ public Reach() { this.registerSetting(hitThroughBlocks = new ButtonSetting("Hit through blocks", false)); } - public void guiUpdate() { - Utils.correctValue(min, max); - } - - @SubscribeEvent(priority = EventPriority.HIGHEST) - public void e(@NotNull MouseEvent ev) { - if (ev.button >= 0 && ev.buttonstate && Utils.nullCheck()) { - call(); - } - } - public static void call() { if (!ModuleManager.reach.isEnabled()) return; if (Utils.nullCheck() @@ -93,8 +82,7 @@ public static Object[] getEntity(double reach, double expand, float[] rotations) Vec3 zz4; if (rotations != null) { zz4 = RotationUtils.getVectorForRotation(rotations[1], rotations[0]); - } - else { + } else { zz4 = zz2.getLook(1.0F); } Vec3 zz5 = zz3.addVector(zz4.xCoord * reach, zz4.yCoord * reach, zz4.zCoord * reach); @@ -145,4 +133,15 @@ public static Object[] getEntity(double reach, double expand, float[] rotations) } } } + + public void guiUpdate() { + Utils.correctValue(min, max); + } + + @SubscribeEvent(priority = EventPriority.HIGHEST) + public void e(@NotNull MouseEvent ev) { + if (ev.button >= 0 && ev.buttonstate && Utils.nullCheck()) { + call(); + } + } } \ No newline at end of file diff --git a/src/main/java/keystrokesmod/module/impl/combat/RightClicker.java b/src/main/java/keystrokesmod/module/impl/combat/RightClicker.java index 64dc0587..cc4dbe43 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/RightClicker.java +++ b/src/main/java/keystrokesmod/module/impl/combat/RightClicker.java @@ -9,7 +9,6 @@ import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.ModeSetting; import keystrokesmod.module.setting.impl.ModeValue; -import keystrokesmod.utility.BlockUtils; import keystrokesmod.utility.ContainerUtils; import keystrokesmod.utility.CoolDown; import keystrokesmod.utility.Utils; diff --git a/src/main/java/keystrokesmod/module/impl/combat/TimerRange.java b/src/main/java/keystrokesmod/module/impl/combat/TimerRange.java index 8632f741..4d50da08 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/TimerRange.java +++ b/src/main/java/keystrokesmod/module/impl/combat/TimerRange.java @@ -36,11 +36,10 @@ public class TimerRange extends Module { private final ButtonSetting clearMotion; private final ButtonSetting notWhileKB; private final ButtonSetting notWhileScaffold; - + private final Queue> delayedPackets = new ConcurrentLinkedQueue<>(); private State state = State.NONE; private int hasLag = 0; private long lastTimerTime = -1; - private final Queue> delayedPackets = new ConcurrentLinkedQueue<>(); private float yaw, pitch; private double motionX, motionY, motionZ; diff --git a/src/main/java/keystrokesmod/module/impl/combat/aimassist/NormalAimAssist.java b/src/main/java/keystrokesmod/module/impl/combat/aimassist/NormalAimAssist.java index e8b3ecd4..cad9f5fe 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/aimassist/NormalAimAssist.java +++ b/src/main/java/keystrokesmod/module/impl/combat/aimassist/NormalAimAssist.java @@ -9,9 +9,9 @@ import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.impl.SubMode; import keystrokesmod.script.classes.Vec3; -import keystrokesmod.utility.aim.AimSimulator; import keystrokesmod.utility.RotationUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.aim.AimSimulator; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MovingObjectPosition; diff --git a/src/main/java/keystrokesmod/module/impl/combat/autoclicker/DragClickAutoClicker.java b/src/main/java/keystrokesmod/module/impl/combat/autoclicker/DragClickAutoClicker.java index ca7911bb..304a2756 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/autoclicker/DragClickAutoClicker.java +++ b/src/main/java/keystrokesmod/module/impl/combat/autoclicker/DragClickAutoClicker.java @@ -13,11 +13,9 @@ public class DragClickAutoClicker extends SubMode { private final SliderSetting maxLength = new SliderSetting("Max Length", 18, 1, 50, 1); private final SliderSetting minDelay = new SliderSetting("Min delay between", 6, 1, 20, 1); private final SliderSetting maxDelay = new SliderSetting("Max delay between", 6, 1, 20, 1); - - private int nextLength, nextDelay; - private final boolean left; private final boolean always; + private int nextLength, nextDelay; public DragClickAutoClicker(String name, @NotNull IAutoClicker parent, boolean left, boolean always) { super(name, parent); diff --git a/src/main/java/keystrokesmod/module/impl/combat/autoclicker/LowCPSAutoClicker.java b/src/main/java/keystrokesmod/module/impl/combat/autoclicker/LowCPSAutoClicker.java index 5692373c..da831fab 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/autoclicker/LowCPSAutoClicker.java +++ b/src/main/java/keystrokesmod/module/impl/combat/autoclicker/LowCPSAutoClicker.java @@ -1,7 +1,6 @@ package keystrokesmod.module.impl.combat.autoclicker; import keystrokesmod.event.PreMotionEvent; -import keystrokesmod.module.impl.combat.HitSelect; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.impl.SubMode; import keystrokesmod.utility.CoolDown; diff --git a/src/main/java/keystrokesmod/module/impl/combat/criticals/AirStuckCriticals.java b/src/main/java/keystrokesmod/module/impl/combat/criticals/AirStuckCriticals.java index 7182ba79..ec5434de 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/criticals/AirStuckCriticals.java +++ b/src/main/java/keystrokesmod/module/impl/combat/criticals/AirStuckCriticals.java @@ -3,6 +3,7 @@ import keystrokesmod.event.PostVelocityEvent; import keystrokesmod.event.PreMotionEvent; import keystrokesmod.event.PreMoveEvent; +import keystrokesmod.event.PreVelocityEvent; import keystrokesmod.module.ModuleManager; import keystrokesmod.module.impl.combat.Criticals; import keystrokesmod.module.impl.combat.KillAura; @@ -97,7 +98,7 @@ public void onPreMove(PreMoveEvent event) { } @SubscribeEvent - public void onPostVelocity(PostVelocityEvent event) { + public void onPreVelocity(PreVelocityEvent event) { disableTicks += (int) pauseOnVelocity.getInput(); } } diff --git a/src/main/java/keystrokesmod/module/impl/combat/ragebot/IRageBotFeature.java b/src/main/java/keystrokesmod/module/impl/combat/ragebot/IRageBotFeature.java index 9bc36626..541a3803 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/ragebot/IRageBotFeature.java +++ b/src/main/java/keystrokesmod/module/impl/combat/ragebot/IRageBotFeature.java @@ -9,5 +9,6 @@ public IRageBotFeature(String name, @NotNull RageBot parent) { super(name, parent); } - public void onFire() {} + public void onFire() { + } } diff --git a/src/main/java/keystrokesmod/module/impl/combat/ragebot/rapidfire/StoreRapidFire.java b/src/main/java/keystrokesmod/module/impl/combat/ragebot/rapidfire/StoreRapidFire.java index 1880640d..e1dc883c 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/ragebot/rapidfire/StoreRapidFire.java +++ b/src/main/java/keystrokesmod/module/impl/combat/ragebot/rapidfire/StoreRapidFire.java @@ -27,20 +27,18 @@ import java.util.concurrent.ConcurrentLinkedQueue; public class StoreRapidFire extends LegitRapidFire { + private static final ButtonSetting disableAntiAim = new ButtonSetting("Disable antiAim", true); + private static boolean storing = false; private final SliderSetting ticks; private final SliderSetting maxStoreTime; private final ButtonSetting visual; - private static final ButtonSetting disableAntiAim = new ButtonSetting("Disable antiAim", true); - - private static boolean storing = false; - private int storeTicks = 0; private final Queue packetQueue = new ConcurrentLinkedQueue<>(); private final List> skipPackets = new ArrayList<>(); - private boolean fire; - private long lastEndStoreTime = 0; - private final Animation animation = new Animation(Easing.EASE_OUT_CIRC, 200); private final Progress progress = new Progress("Rapid fire"); + private int storeTicks = 0; + private boolean fire; + private long lastEndStoreTime = 0; public StoreRapidFire(String name, @NotNull RageBot parent) { super(name, parent); diff --git a/src/main/java/keystrokesmod/module/impl/combat/velocity/ZipVelocity.java b/src/main/java/keystrokesmod/module/impl/combat/velocity/ZipVelocity.java index 865dccf6..8b147f22 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/velocity/ZipVelocity.java +++ b/src/main/java/keystrokesmod/module/impl/combat/velocity/ZipVelocity.java @@ -22,10 +22,9 @@ public class ZipVelocity extends SubMode { private final SliderSetting delay; private final ButtonSetting stopOnAttack; private final ButtonSetting debug; - + private final Queue> delayedPackets = new ConcurrentLinkedQueue<>(); private long lastVelocityTime = -1; private boolean delayed = false; - private final Queue> delayedPackets = new ConcurrentLinkedQueue<>(); public ZipVelocity(String name, @NotNull Velocity parent) { super(name, parent); @@ -60,7 +59,7 @@ public void onReceivePacket(@NotNull ReceivePacketEvent event) { if (((S12PacketEntityVelocity) event.getPacket()).getEntityID() != mc.thePlayer.getEntityId()) return; event.setCanceled(true); - delayedPackets.add(((S12PacketEntityVelocity) event.getPacket())); + delayedPackets.add(event.getPacket()); if (lastVelocityTime == -1) { lastVelocityTime = System.currentTimeMillis(); delayed = true; @@ -71,7 +70,7 @@ public void onReceivePacket(@NotNull ReceivePacketEvent event) { release(); } event.setCanceled(true); - delayedPackets.add(((S32PacketConfirmTransaction) event.getPacket())); + delayedPackets.add(event.getPacket()); } } } diff --git a/src/main/java/keystrokesmod/module/impl/combat/velocity/grimac/GrimACAdvancedVelocity.java b/src/main/java/keystrokesmod/module/impl/combat/velocity/grimac/GrimACAdvancedVelocity.java index 72bb219a..c7db838a 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/velocity/grimac/GrimACAdvancedVelocity.java +++ b/src/main/java/keystrokesmod/module/impl/combat/velocity/grimac/GrimACAdvancedVelocity.java @@ -27,9 +27,9 @@ public class GrimACAdvancedVelocity extends SubMode { private final ButtonSetting test; public boolean velocityInput; + public float velocityYaw; private boolean attacked; private double reduceXZ; - public float velocityYaw; private int skipTicks = 0; public GrimACAdvancedVelocity(String name, @NotNull GrimACVelocity parent) { @@ -65,10 +65,11 @@ public void onLivingUpdate(LivingEvent.@NotNull LivingUpdateEvent event) { } } } - + @SubscribeEvent public void onPreVelocity(PreVelocityEvent event) { - if(notWhileEating.isToggled() && mc.thePlayer.getHeldItem() != null && mc.thePlayer.getHeldItem().getItem() instanceof ItemFood && mc.thePlayer.isUsingItem())return; + if (notWhileEating.isToggled() && mc.thePlayer.getHeldItem() != null && mc.thePlayer.getHeldItem().getItem() instanceof ItemFood && mc.thePlayer.isUsingItem()) + return; double x = event.getMotionX() / 8000D; double z = event.getMotionZ() / 8000D; diff --git a/src/main/java/keystrokesmod/module/impl/combat/velocity/grimac/GrimACSimpleVelocity.java b/src/main/java/keystrokesmod/module/impl/combat/velocity/grimac/GrimACSimpleVelocity.java index cc99e6d3..b6fb4baa 100644 --- a/src/main/java/keystrokesmod/module/impl/combat/velocity/grimac/GrimACSimpleVelocity.java +++ b/src/main/java/keystrokesmod/module/impl/combat/velocity/grimac/GrimACSimpleVelocity.java @@ -5,7 +5,6 @@ import keystrokesmod.mixins.impl.entity.EntityPlayerSPAccessor; import keystrokesmod.module.ModuleManager; import keystrokesmod.module.impl.combat.velocity.GrimACVelocity; -import keystrokesmod.module.impl.exploit.viaversionfix.ViaVersionFixHelper; import keystrokesmod.module.impl.other.SlotHandler; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; @@ -15,8 +14,6 @@ import keystrokesmod.utility.Utils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemFood; -import net.minecraft.network.play.client.C02PacketUseEntity; -import net.minecraft.network.play.client.C0APacketAnimation; import net.minecraft.network.play.client.C0BPacketEntityAction; import net.minecraft.util.MovingObjectPosition; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -56,7 +53,7 @@ public void onPreUpdate(PreUpdateEvent event) { doReduce(); if (debug.isToggled()) - Utils.sendMessage(String.format("%d Reduced %.3f %.3f", (int) reduceTimes.getInput() - unReduceTimes, mc.thePlayer.motionX, mc.thePlayer.motionZ)); + Utils.sendMessage(String.format("%d Reduced %.3f %.3f", (int) reduceTimes.getInput() - unReduceTimes, mc.thePlayer.motionX, mc.thePlayer.motionZ)); unReduceTimes--; } else { unReduceTimes = 0; diff --git a/src/main/java/keystrokesmod/module/impl/exploit/AntiFalseFlag.java b/src/main/java/keystrokesmod/module/impl/exploit/AntiFalseFlag.java index de2cad29..90a313f2 100644 --- a/src/main/java/keystrokesmod/module/impl/exploit/AntiFalseFlag.java +++ b/src/main/java/keystrokesmod/module/impl/exploit/AntiFalseFlag.java @@ -63,13 +63,6 @@ public void flag(String checkName, String helpMessage) { } } - @Data - private static class FlagData { - private final SubMode> mode; - private final String checkName; - private final String helpMessage; - } - @Override public void onEnable() throws Exception { mode.enable(); @@ -85,4 +78,11 @@ public void onDisable() throws Exception { public String getInfo() { return mode.getSelected().getPrettyName(); } + + @Data + private static class FlagData { + private final SubMode> mode; + private final String checkName; + private final String helpMessage; + } } diff --git a/src/main/java/keystrokesmod/module/impl/exploit/ClientSpoofer.java b/src/main/java/keystrokesmod/module/impl/exploit/ClientSpoofer.java index 7c854bb8..47396114 100644 --- a/src/main/java/keystrokesmod/module/impl/exploit/ClientSpoofer.java +++ b/src/main/java/keystrokesmod/module/impl/exploit/ClientSpoofer.java @@ -12,21 +12,28 @@ public class ClientSpoofer extends Module { - private final ModeSetting mode = new ModeSetting("Mode", SpoofMode.getNames(), 0); - public final ButtonSetting cancelForgePacket = new ButtonSetting("Cancel Forge packet", false); private static SpoofMode currentSpoof = SpoofMode.FORGE; + public final ButtonSetting cancelForgePacket = new ButtonSetting("Cancel Forge packet", false); + private final ModeSetting mode = new ModeSetting("Mode", SpoofMode.getNames(), 0); public ClientSpoofer() { super("ClientSpoofer", category.exploit); this.registerSetting(mode, cancelForgePacket); } + + public static BrandInfo getBrandName() { + return new BrandInfo(currentSpoof.brand); + } + public void onDisable() { currentSpoof = SpoofMode.FORGE; } + @Override public void onUpdate() { currentSpoof = SpoofMode.values()[(int) mode.getInput()]; } + @SubscribeEvent public void onSendPacket(@NotNull SendPacketEvent event) { if (event.getPacket() instanceof FMLProxyPacket && cancelForgePacket.isToggled()) { @@ -34,18 +41,6 @@ public void onSendPacket(@NotNull SendPacketEvent event) { } } - public static BrandInfo getBrandName() { - return new BrandInfo(currentSpoof.brand); - } - - - public static class BrandInfo { - public final String brand; - - public BrandInfo(String brand) { - this.brand = brand; - } - } enum SpoofMode { FORGE("Forge", "FML,Forge"), @@ -53,7 +48,8 @@ enum SpoofMode { LUNAR("Lunar", "lunarclient:v2.16.0-2426"), CHEATBREAKER("Cheatbreaker", "CB"), GEYSER("Geyser", "Geyser"), - LABYMOD("LabyMod", "LMC"),; + LABYMOD("LabyMod", "LMC"), + ; private static final String[] MODES = Arrays.stream(values()).map(spoofMode -> spoofMode.name).toArray(String[]::new); public final String name; @@ -68,4 +64,12 @@ enum SpoofMode { return MODES; } } + + public static class BrandInfo { + public final String brand; + + public BrandInfo(String brand) { + this.brand = brand; + } + } } \ No newline at end of file diff --git a/src/main/java/keystrokesmod/module/impl/exploit/ExploitFixer.java b/src/main/java/keystrokesmod/module/impl/exploit/ExploitFixer.java index eb7a2130..20c20c45 100644 --- a/src/main/java/keystrokesmod/module/impl/exploit/ExploitFixer.java +++ b/src/main/java/keystrokesmod/module/impl/exploit/ExploitFixer.java @@ -17,9 +17,9 @@ import java.util.Arrays; public class ExploitFixer extends Module { - private static ButtonSetting debug; public static ButtonSetting cancelCrash = null; public static ButtonSetting safePacketProcess = null; + private static ButtonSetting debug; private final ButtonSetting destroySelf; private final ButtonSetting explodeBypass; private final ButtonSetting explodePowerful; diff --git a/src/main/java/keystrokesmod/module/impl/exploit/InfiniteAura.java b/src/main/java/keystrokesmod/module/impl/exploit/InfiniteAura.java index aef7f7e0..5bce8316 100644 --- a/src/main/java/keystrokesmod/module/impl/exploit/InfiniteAura.java +++ b/src/main/java/keystrokesmod/module/impl/exploit/InfiniteAura.java @@ -42,7 +42,7 @@ public class InfiniteAura extends Module { private final ButtonSetting ignoreTeammates = new ButtonSetting("Ignore teammates", false); private final ButtonSetting blink = new ButtonSetting("Blink", false); private final SliderSetting grimACBadPacketsE = new SliderSetting("GrimAC BadPacketsE", 20, 1, 20, 1, "ticks"); - + private final Queue> packetQueue = new ConcurrentLinkedQueue<>(); @Nullable private EntityPlayer target = null; @Nullable @@ -55,11 +55,8 @@ public class InfiniteAura extends Module { private Vec2 rot = null; @Nullable private Vec2 lastRot = null; - private int positionUpdateTicks = Integer.MAX_VALUE; - private final Queue> packetQueue = new ConcurrentLinkedQueue<>(); - public InfiniteAura() { super("InfiniteAura", category.exploit); this.registerSetting(new DescriptionSetting("Hit target from over 6 blocks. (test)")); diff --git a/src/main/java/keystrokesmod/module/impl/exploit/ModSpoofer.java b/src/main/java/keystrokesmod/module/impl/exploit/ModSpoofer.java index 66d0700e..95c481d5 100644 --- a/src/main/java/keystrokesmod/module/impl/exploit/ModSpoofer.java +++ b/src/main/java/keystrokesmod/module/impl/exploit/ModSpoofer.java @@ -11,8 +11,8 @@ public class ModSpoofer extends Module { public static final ButtonSetting cancel = new ButtonSetting("Cancel", true); - private final Set mods = new HashSet<>(); public static final Set filteredMod = new HashSet<>(); + private final Set mods = new HashSet<>(); public ModSpoofer() { super("ModSpoofer", category.exploit); diff --git a/src/main/java/keystrokesmod/module/impl/exploit/antifalseflag/HypixelAntiFalseFlag.java b/src/main/java/keystrokesmod/module/impl/exploit/antifalseflag/HypixelAntiFalseFlag.java index ba030020..780b7fb8 100644 --- a/src/main/java/keystrokesmod/module/impl/exploit/antifalseflag/HypixelAntiFalseFlag.java +++ b/src/main/java/keystrokesmod/module/impl/exploit/antifalseflag/HypixelAntiFalseFlag.java @@ -14,7 +14,6 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemSword; import net.minecraft.network.play.client.C02PacketUseEntity; -import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; import net.minecraft.util.BlockPos; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/keystrokesmod/module/impl/exploit/disabler/CustomDisabler.java b/src/main/java/keystrokesmod/module/impl/exploit/disabler/CustomDisabler.java index b427911b..c5dda567 100644 --- a/src/main/java/keystrokesmod/module/impl/exploit/disabler/CustomDisabler.java +++ b/src/main/java/keystrokesmod/module/impl/exploit/disabler/CustomDisabler.java @@ -17,7 +17,7 @@ public class CustomDisabler extends SubMode { private final ButtonSetting cancelOutgoingPacket; -// private final ButtonSetting cancelIncomingPacket; + // private final ButtonSetting cancelIncomingPacket; private final Map, ButtonSetting> sendPackets; // private final Map>, ButtonSetting> receivePackets; diff --git a/src/main/java/keystrokesmod/module/impl/exploit/disabler/GrimSpecDisabler.java b/src/main/java/keystrokesmod/module/impl/exploit/disabler/GrimSpecDisabler.java index 9230ca00..0afb6d28 100644 --- a/src/main/java/keystrokesmod/module/impl/exploit/disabler/GrimSpecDisabler.java +++ b/src/main/java/keystrokesmod/module/impl/exploit/disabler/GrimSpecDisabler.java @@ -21,11 +21,10 @@ public class GrimSpecDisabler extends SubMode { private final Queue> delayedPackets = new ConcurrentLinkedQueue<>(); - private boolean delayed = false; - private final ButtonSetting onlySpec; private final ButtonSetting waitForTeleport; private final ButtonSetting ver117; + private boolean delayed = false; public GrimSpecDisabler(String name, @NotNull Disabler parent) { super(name, parent); diff --git a/src/main/java/keystrokesmod/module/impl/exploit/disabler/HypixelDisabler.java b/src/main/java/keystrokesmod/module/impl/exploit/disabler/HypixelDisabler.java index d1e81aa9..db96351f 100644 --- a/src/main/java/keystrokesmod/module/impl/exploit/disabler/HypixelDisabler.java +++ b/src/main/java/keystrokesmod/module/impl/exploit/disabler/HypixelDisabler.java @@ -1,6 +1,7 @@ package keystrokesmod.module.impl.exploit.disabler; -import keystrokesmod.event.*; +import keystrokesmod.event.PreMotionEvent; +import keystrokesmod.event.ReceivePacketEvent; import keystrokesmod.module.impl.exploit.Disabler; import keystrokesmod.module.impl.exploit.disabler.hypixel.HypixelMotionDisabler; import keystrokesmod.module.setting.impl.ButtonSetting; @@ -8,7 +9,7 @@ import keystrokesmod.module.setting.impl.ModeValue; import keystrokesmod.module.setting.impl.SubMode; import keystrokesmod.utility.PacketUtils; -import net.minecraft.network.play.client.*; +import net.minecraft.network.play.client.C07PacketPlayerDigging; import net.minecraft.network.play.server.S08PacketPlayerPosLook; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; diff --git a/src/main/java/keystrokesmod/module/impl/exploit/disabler/KKCraftDisabler.java b/src/main/java/keystrokesmod/module/impl/exploit/disabler/KKCraftDisabler.java index 1d41a628..c7069480 100644 --- a/src/main/java/keystrokesmod/module/impl/exploit/disabler/KKCraftDisabler.java +++ b/src/main/java/keystrokesmod/module/impl/exploit/disabler/KKCraftDisabler.java @@ -18,9 +18,8 @@ public class KKCraftDisabler extends SubMode { private final ButtonSetting autoBan; - - private State state = State.NONE; private final CoolDown joinWorldCoolDown = new CoolDown(1000); + private State state = State.NONE; public KKCraftDisabler(String name, @NotNull Disabler parent) { super(name, parent); diff --git a/src/main/java/keystrokesmod/module/impl/exploit/disabler/MinelandDisabler.java b/src/main/java/keystrokesmod/module/impl/exploit/disabler/MinelandDisabler.java index f2695928..8b142a0d 100644 --- a/src/main/java/keystrokesmod/module/impl/exploit/disabler/MinelandDisabler.java +++ b/src/main/java/keystrokesmod/module/impl/exploit/disabler/MinelandDisabler.java @@ -15,13 +15,13 @@ public MinelandDisabler(String name, @NotNull Disabler parent) { @SubscribeEvent public void onSendPacket(@NotNull SendPacketEvent event) { - if (event.getPacket() instanceof C0FPacketConfirmTransaction) - event.setCanceled(true); - else if (event.getPacket() instanceof C03PacketPlayer - && !(event.getPacket() instanceof C03PacketPlayer.C04PacketPlayerPosition) - && !(event.getPacket() instanceof C03PacketPlayer.C05PacketPlayerLook) - && !(event.getPacket() instanceof C03PacketPlayer.C06PacketPlayerPosLook) - ) - event.setCanceled(true); + if (event.getPacket() instanceof C0FPacketConfirmTransaction) + event.setCanceled(true); + else if (event.getPacket() instanceof C03PacketPlayer + && !(event.getPacket() instanceof C03PacketPlayer.C04PacketPlayerPosition) + && !(event.getPacket() instanceof C03PacketPlayer.C05PacketPlayerLook) + && !(event.getPacket() instanceof C03PacketPlayer.C06PacketPlayerPosLook) + ) + event.setCanceled(true); } } diff --git a/src/main/java/keystrokesmod/module/impl/exploit/disabler/hypixel/HypixelMotionDisabler.java b/src/main/java/keystrokesmod/module/impl/exploit/disabler/hypixel/HypixelMotionDisabler.java index 17f5f2ac..eda23d4b 100644 --- a/src/main/java/keystrokesmod/module/impl/exploit/disabler/hypixel/HypixelMotionDisabler.java +++ b/src/main/java/keystrokesmod/module/impl/exploit/disabler/hypixel/HypixelMotionDisabler.java @@ -19,13 +19,12 @@ import org.jetbrains.annotations.NotNull; public class HypixelMotionDisabler extends SubMode { - private int flagged; - private int offGroundTicks = 0; private static boolean isFinished = false; private final Animation animation = new Animation(Easing.EASE_OUT_CIRC, 500); private final Progress progress = new Progress("Disabler"); - private final ButtonSetting lobbyCheck; + private int flagged; + private int offGroundTicks = 0; public HypixelMotionDisabler(String name, @NotNull HypixelDisabler parent) { super(name, parent); @@ -35,7 +34,8 @@ public HypixelMotionDisabler(String name, @NotNull HypixelDisabler parent) { public static boolean isDisabled() { if (!ModuleManager.disabler.isEnabled()) return false; if (!(ModuleManager.disabler.mode.getSelected() instanceof HypixelDisabler)) return false; - if (!(((HypixelDisabler) ModuleManager.disabler.mode.getSelected()).motion.getSelected() instanceof HypixelMotionDisabler)) return false; + if (!(((HypixelDisabler) ModuleManager.disabler.mode.getSelected()).motion.getSelected() instanceof HypixelMotionDisabler)) + return false; return isFinished; } @@ -104,7 +104,7 @@ public void onRender(TickEvent.RenderTickEvent event) { if (!isFinished) { animation.run(flagged); - progress.setText("Disabler " + (int)(animation.getValue() / 20.0 * 100) + "%"); + progress.setText("Disabler " + (int) (animation.getValue() / 20.0 * 100) + "%"); progress.setProgress(Math.min(animation.getValue() / 20.0, 1)); } } diff --git a/src/main/java/keystrokesmod/module/impl/exploit/remoteshop/HypixelRemoteShop.java b/src/main/java/keystrokesmod/module/impl/exploit/remoteshop/HypixelRemoteShop.java index 8ca8c46e..f984ef89 100644 --- a/src/main/java/keystrokesmod/module/impl/exploit/remoteshop/HypixelRemoteShop.java +++ b/src/main/java/keystrokesmod/module/impl/exploit/remoteshop/HypixelRemoteShop.java @@ -3,11 +3,9 @@ import keystrokesmod.event.PostMotionEvent; import keystrokesmod.event.PreMotionEvent; import keystrokesmod.event.SendPacketEvent; -import keystrokesmod.module.impl.client.Notifications; import keystrokesmod.module.impl.exploit.RemoteShop; import keystrokesmod.utility.MoveUtil; import keystrokesmod.utility.PacketUtils; -import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.network.play.client.C0DPacketCloseWindow; import net.minecraft.network.play.client.C0EPacketClickWindow; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -17,8 +15,8 @@ import java.util.concurrent.ConcurrentLinkedQueue; public class HypixelRemoteShop extends IRemoteShop { - private boolean lastStop = false; private final Queue delayedPacket = new ConcurrentLinkedQueue<>(); + private boolean lastStop = false; public HypixelRemoteShop(String name, @NotNull RemoteShop parent) { super(name, parent); diff --git a/src/main/java/keystrokesmod/module/impl/fun/AntiAim.java b/src/main/java/keystrokesmod/module/impl/fun/AntiAim.java index d38f6a19..fdcbe4f7 100644 --- a/src/main/java/keystrokesmod/module/impl/fun/AntiAim.java +++ b/src/main/java/keystrokesmod/module/impl/fun/AntiAim.java @@ -3,7 +3,6 @@ import keystrokesmod.event.PreMotionEvent; import keystrokesmod.event.RotationEvent; import keystrokesmod.module.Module; -import keystrokesmod.module.impl.combat.ragebot.rapidfire.StoreRapidFire; import keystrokesmod.module.impl.fun.antiaim.BackwardAntiAim; import keystrokesmod.module.impl.fun.antiaim.SnapAntiAim; import keystrokesmod.module.impl.fun.antiaim.SpinAntiAim; diff --git a/src/main/java/keystrokesmod/module/impl/fun/ExtraBobbing.java b/src/main/java/keystrokesmod/module/impl/fun/ExtraBobbing.java index e37b32e5..16a5a2f7 100644 --- a/src/main/java/keystrokesmod/module/impl/fun/ExtraBobbing.java +++ b/src/main/java/keystrokesmod/module/impl/fun/ExtraBobbing.java @@ -5,34 +5,34 @@ import net.minecraft.client.entity.EntityPlayerSP; public class ExtraBobbing extends Module { - public SliderSetting level; - private boolean b; + public SliderSetting level; + private boolean b; - public ExtraBobbing() { - super("Extra Bobbing", Module.category.fun, 0); - this.registerSetting(level = new SliderSetting("Level", 1.0D, 0.0D, 8.0D, 0.1D)); + public ExtraBobbing() { + super("Extra Bobbing", Module.category.fun, 0); + this.registerSetting(level = new SliderSetting("Level", 1.0D, 0.0D, 8.0D, 0.1D)); + } + + public void onEnable() { + this.b = mc.gameSettings.viewBobbing; + if (!this.b) { + mc.gameSettings.viewBobbing = true; } - public void onEnable() { - this.b = mc.gameSettings.viewBobbing; - if (!this.b) { - mc.gameSettings.viewBobbing = true; - } + } - } + public void onDisable() { + mc.gameSettings.viewBobbing = this.b; + } - public void onDisable() { - mc.gameSettings.viewBobbing = this.b; + public void onUpdate() { + if (!mc.gameSettings.viewBobbing) { + mc.gameSettings.viewBobbing = true; } - public void onUpdate() { - if (!mc.gameSettings.viewBobbing) { - mc.gameSettings.viewBobbing = true; - } - - if (mc.thePlayer.movementInput.moveForward != 0.0F || mc.thePlayer.movementInput.moveStrafe != 0.0F) { - EntityPlayerSP var10000 = mc.thePlayer; - var10000.cameraYaw = (float) ((double) var10000.cameraYaw + level.getInput() / 2.0D); - } + if (mc.thePlayer.movementInput.moveForward != 0.0F || mc.thePlayer.movementInput.moveStrafe != 0.0F) { + EntityPlayerSP var10000 = mc.thePlayer; + var10000.cameraYaw = (float) ((double) var10000.cameraYaw + level.getInput() / 2.0D); } } +} diff --git a/src/main/java/keystrokesmod/module/impl/fun/FlameTrail.java b/src/main/java/keystrokesmod/module/impl/fun/FlameTrail.java index b87f53e5..a746ee19 100644 --- a/src/main/java/keystrokesmod/module/impl/fun/FlameTrail.java +++ b/src/main/java/keystrokesmod/module/impl/fun/FlameTrail.java @@ -6,17 +6,17 @@ import net.minecraft.util.Vec3; public class FlameTrail extends Module { - public SliderSetting a; + public SliderSetting a; - public FlameTrail() { - super("Flame Trail", Module.category.fun, 0); - } + public FlameTrail() { + super("Flame Trail", Module.category.fun, 0); + } - public void onUpdate() { - Vec3 vec = mc.thePlayer.getLookVec(); - double x = mc.thePlayer.posX - vec.xCoord * 2.0D; - double y = mc.thePlayer.posY + ((double) mc.thePlayer.getEyeHeight() - 0.2D); - double z = mc.thePlayer.posZ - vec.zCoord * 2.0D; - mc.thePlayer.worldObj.spawnParticle(EnumParticleTypes.FLAME, x, y, z, 0.0D, 0.0D, 0.0D, new int[]{0}); - } + public void onUpdate() { + Vec3 vec = mc.thePlayer.getLookVec(); + double x = mc.thePlayer.posX - vec.xCoord * 2.0D; + double y = mc.thePlayer.posY + ((double) mc.thePlayer.getEyeHeight() - 0.2D); + double z = mc.thePlayer.posZ - vec.zCoord * 2.0D; + mc.thePlayer.worldObj.spawnParticle(EnumParticleTypes.FLAME, x, y, z, 0.0D, 0.0D, 0.0D, 0); } +} diff --git a/src/main/java/keystrokesmod/module/impl/fun/HitLog.java b/src/main/java/keystrokesmod/module/impl/fun/HitLog.java index d6c02851..24665440 100644 --- a/src/main/java/keystrokesmod/module/impl/fun/HitLog.java +++ b/src/main/java/keystrokesmod/module/impl/fun/HitLog.java @@ -53,7 +53,7 @@ public static void onAttack(int predTicks, EntityLivingBase target, Vec3 predHit switch ((int) language.getInput()) { case 0: - Utils.sendMessage("Miss "+ target.getName() + "'s " + hitPos.getEnglish() + " Cause " + reason.getEnglish() + " | Trying to predict " + predTicks + " ticks"); + Utils.sendMessage("Miss " + target.getName() + "'s " + hitPos.getEnglish() + " Cause " + reason.getEnglish() + " | Trying to predict " + predTicks + " ticks"); break; case 1: Utils.sendMessage("空了 " + target.getName() + "的" + hitPos.getChinese() + " 原因 " + reason.getChinese() + " | 尝试预测 " + predTicks + " ticks"); @@ -62,7 +62,7 @@ public static void onAttack(int predTicks, EntityLivingBase target, Vec3 predHit } else { switch ((int) language.getInput()) { case 0: - Utils.sendMessage("Hit "+ target.getName() + "'s " + hitPos.getEnglish() + " | Trying to predict " + predTicks + " ticks | Health " + target.getHealth()); + Utils.sendMessage("Hit " + target.getName() + "'s " + hitPos.getEnglish() + " | Trying to predict " + predTicks + " ticks | Health " + target.getHealth()); break; case 1: Utils.sendMessage("命中 " + target.getName() + "的" + hitPos.getChinese() + " | 尝试预测 " + predTicks + " ticks | 血量 " + target.getHealth()); @@ -85,7 +85,7 @@ enum Reason { PRED_FAIL("Predicted failed", "预测失败"), WATCHDOG("Watchdog", "Watchdog"), BLOCK("Blocking", "格挡"); - + private final String english; private final String chinese; } diff --git a/src/main/java/keystrokesmod/module/impl/fun/NoteBot.java b/src/main/java/keystrokesmod/module/impl/fun/NoteBot.java index 644e4ffe..38d454c6 100644 --- a/src/main/java/keystrokesmod/module/impl/fun/NoteBot.java +++ b/src/main/java/keystrokesmod/module/impl/fun/NoteBot.java @@ -36,16 +36,16 @@ import java.io.File; import java.nio.file.InvalidPathException; import java.util.*; -import java.util.concurrent.*; +import java.util.concurrent.CancellationException; +import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; public class NoteBot extends Module { + public static String fileName = ""; @Getter @Nullable private static NoteBot instance = null; private static File directory; - public static String fileName = ""; - public final ModeSetting mode; public final ButtonSetting roundOutOfRange; public final SliderSetting checkDelay; @@ -55,22 +55,18 @@ public class NoteBot extends Module { public final SliderSetting concurrentTuneBlocks; public final ButtonSetting polyphonic; private final ButtonSetting debug; - - private CompletableFuture loadingSongFuture = null; - - private Song song; // Loaded song private final Map noteBlockPositions = new HashMap<>(); // Currently used noteblocks by the song private final Multimap scannedNoteblocks = MultimapBuilder.linkedHashKeys().arrayListValues().build(); // Found noteblocks private final List clickedBlocks = new ArrayList<>(); + private final Map tuneHits = new HashMap<>(); // noteblock -> target hits number + private CompletableFuture loadingSongFuture = null; + private Song song; // Loaded song private Stage stage = Stage.None; private PlayingMode playingMode = PlayingMode.None; private boolean isPlaying = false; private int currentTick = 0; private int ticks = 0; - private boolean anyNoteblockTuned = false; - private final Map tuneHits = new HashMap<>(); // noteblock -> target hits number - private int waitTicks = -1; public NoteBot() { @@ -97,6 +93,14 @@ public NoteBot() { } } + private static int calcNumberOfHits(int from, int to) { + if (from > to) { + return (25 - from) + to; + } else { + return to - from; + } + } + @Override public void onEnable() { try { @@ -128,8 +132,7 @@ public void onUpdate() { setupTuneHitsMap(); stage = Stage.Tune; } - } - else if (stage == Stage.SetUp) { + } else if (stage == Stage.SetUp) { scanForNoteblocks(); if (scannedNoteblocks.isEmpty()) { error("Can't find any nearby noteblock!"); @@ -145,11 +148,9 @@ else if (stage == Stage.SetUp) { } setupTuneHitsMap(); stage = Stage.Tune; - } - else if (stage == Stage.Tune) { + } else if (stage == Stage.Tune) { tune(); - } - else if (stage == Stage.Playing) { + } else if (stage == Stage.Playing) { if (!isPlaying) return; if (mc.thePlayer == null || currentTick > song.getLastTick()) { @@ -163,21 +164,20 @@ else if (stage == Stage.Playing) { error("You need to be in survival mode."); stop(); return; - } - else onTickPlay(); + } else onTickPlay(); } currentTick++; } } - /** * 为了兼容meteor代码 */ public void info(String msg1) { Notifications.sendNotification(Notifications.NotificationTypes.INFO, msg1); } + public void info(String msg1, String msg2) { info(String.format(msg1, msg2)); } @@ -189,6 +189,7 @@ public void warning(String msg1, int msg2) { if (!debug.isToggled()) return; warning(String.format(msg1, msg2)); } + public void warning(String msg1) { if (!debug.isToggled()) return; Notifications.sendNotification(Notifications.NotificationTypes.WARN, msg1); @@ -269,18 +270,18 @@ private void tuneBlocks() { var iterator = tuneHits.entrySet().iterator(); // Concurrent tuning :o - while (iterator.hasNext()){ + while (iterator.hasNext()) { var entry = iterator.next(); BlockPos pos = entry.getKey(); int hitsNumber = entry.getValue(); if (rotation.getInput() != 0) RotationHandler.setRotationYaw(PlayerRotation.getYaw(pos)); - RotationHandler.setRotationPitch(PlayerRotation.getPitch(pos)); - if (lookView.isToggled()) { - mc.thePlayer.rotationYaw = PlayerRotation.getYaw(pos); - mc.thePlayer.rotationPitch = PlayerRotation.getPitch(pos); - } + RotationHandler.setRotationPitch(PlayerRotation.getPitch(pos)); + if (lookView.isToggled()) { + mc.thePlayer.rotationYaw = PlayerRotation.getYaw(pos); + mc.thePlayer.rotationPitch = PlayerRotation.getPitch(pos); + } this.tuneNoteblockWithPackets(pos); clickedBlocks.add(pos); @@ -327,7 +328,7 @@ public void play() { /** * Loads and plays song directly * - * @param file Song supported by one of {@link SongDecoder} + * @param file Song supported by one of {@link SongDecoder} * @param callback Callback that is run when song has been loaded * @return Success */ @@ -352,7 +353,7 @@ public boolean loadFileToMap(File file, Runnable callback) { long time2 = System.currentTimeMillis(); long diff = time2 - time1; - info("Song '" + FilenameUtils.getBaseName(file.getName()) + "' has been loaded to the memory! Took "+diff+"ms"); + info("Song '" + FilenameUtils.getBaseName(file.getName()) + "' has been loaded to the memory! Took " + diff + "ms"); callback.run(); } catch (Exception e) { if (e instanceof CancellationException) { @@ -414,14 +415,6 @@ private void setupTuneHitsMap() { } } - private static int calcNumberOfHits(int from, int to) { - if (from > to) { - return (25 - from) + to; - } else { - return to - from; - } - } - /** * Scans noteblocks nearby and adds them to the map */ @@ -571,9 +564,9 @@ private void setupNoteblocksMap() { if (!uniqueNotesToUse.isEmpty()) { for (Note note : uniqueNotesToUse) { - warning("Missing note: "+note.getInstrument()+", "+note.getNoteLevel()); + warning("Missing note: " + note.getInstrument() + ", " + note.getNoteLevel()); } - warning(uniqueNotesToUse.size()+" missing notes!"); + warning(uniqueNotesToUse.size() + " missing notes!"); } } diff --git a/src/main/java/keystrokesmod/module/impl/fun/SlyPort.java b/src/main/java/keystrokesmod/module/impl/fun/SlyPort.java index 289ad7b5..af1d1ddf 100644 --- a/src/main/java/keystrokesmod/module/impl/fun/SlyPort.java +++ b/src/main/java/keystrokesmod/module/impl/fun/SlyPort.java @@ -14,74 +14,74 @@ import java.util.Iterator; public class SlyPort extends Module { - public DescriptionSetting f; - public SliderSetting r; - public ButtonSetting b; - public ButtonSetting playersOnly; - public ButtonSetting e; + public DescriptionSetting f; + public SliderSetting r; + public ButtonSetting b; + public ButtonSetting playersOnly; + public ButtonSetting e; - public SlyPort() { - super("SlyPort", Module.category.fun, 0); - this.registerSetting(f = new DescriptionSetting("Teleport behind enemies.")); - this.registerSetting(r = new SliderSetting("Range", 6.0D, 2.0D, 15.0D, 1.0D)); - this.registerSetting(e = new ButtonSetting("Aim", true)); - this.registerSetting(b = new ButtonSetting("Play sound", true)); - this.registerSetting(playersOnly = new ButtonSetting("Players only", true)); - } - - public void onEnable() { - Entity en = this.ge(); - if (en != null) { - this.tp(en); - } + public SlyPort() { + super("SlyPort", Module.category.fun, 0); + this.registerSetting(f = new DescriptionSetting("Teleport behind enemies.")); + this.registerSetting(r = new SliderSetting("Range", 6.0D, 2.0D, 15.0D, 1.0D)); + this.registerSetting(e = new ButtonSetting("Aim", true)); + this.registerSetting(b = new ButtonSetting("Play sound", true)); + this.registerSetting(playersOnly = new ButtonSetting("Players only", true)); + } - this.disable(); + public void onEnable() { + Entity en = this.ge(); + if (en != null) { + this.tp(en); } - private void tp(Entity en) { - if (b.isToggled()) { - mc.thePlayer.playSound("mob.endermen.portal", 1.0F, 1.0F); - } + this.disable(); + } - Vec3 vec = en.getLookVec(); - double x = en.posX - vec.xCoord * 2.5D; - double z = en.posZ - vec.zCoord * 2.5D; - mc.thePlayer.setPosition(x, mc.thePlayer.posY, z); - if (e.isToggled()) { - Utils.aim(en, 0.0F); - } + private void tp(Entity en) { + if (b.isToggled()) { + mc.thePlayer.playSound("mob.endermen.portal", 1.0F, 1.0F); + } + Vec3 vec = en.getLookVec(); + double x = en.posX - vec.xCoord * 2.5D; + double z = en.posZ - vec.zCoord * 2.5D; + mc.thePlayer.setPosition(x, mc.thePlayer.posY, z); + if (e.isToggled()) { + Utils.aim(en, 0.0F); } - private Entity ge() { - Entity en = null; - double r = Math.pow(this.r.getInput(), 2.0D); - double dist = r + 1.0D; - Iterator var6 = mc.theWorld.loadedEntityList.iterator(); + } + + private Entity ge() { + Entity en = null; + double r = Math.pow(this.r.getInput(), 2.0D); + double dist = r + 1.0D; + Iterator var6 = mc.theWorld.loadedEntityList.iterator(); - while (true) { - Entity ent; + while (true) { + Entity ent; + do { do { do { do { - do { - if (!var6.hasNext()) { - return en; - } + if (!var6.hasNext()) { + return en; + } - ent = var6.next(); - } while (ent == mc.thePlayer); - } while (!(ent instanceof EntityLivingBase)); - } while (((EntityLivingBase) ent).deathTime != 0); - } while (this.playersOnly.isToggled() && !(ent instanceof EntityPlayer)); + ent = var6.next(); + } while (ent == mc.thePlayer); + } while (!(ent instanceof EntityLivingBase)); + } while (((EntityLivingBase) ent).deathTime != 0); + } while (this.playersOnly.isToggled() && !(ent instanceof EntityPlayer)); - if (!AntiBot.isBot(ent)) { - double d = mc.thePlayer.getDistanceSqToEntity(ent); - if (!(d > r) && !(dist < d)) { - dist = d; - en = ent; - } + if (!AntiBot.isBot(ent)) { + double d = mc.thePlayer.getDistanceSqToEntity(ent); + if (!(d > r) && !(dist < d)) { + dist = d; + en = ent; } } } - } \ No newline at end of file + } +} \ No newline at end of file diff --git a/src/main/java/keystrokesmod/module/impl/fun/Yeet.java b/src/main/java/keystrokesmod/module/impl/fun/Yeet.java index 3c432ca2..5b7e8709 100644 --- a/src/main/java/keystrokesmod/module/impl/fun/Yeet.java +++ b/src/main/java/keystrokesmod/module/impl/fun/Yeet.java @@ -13,7 +13,7 @@ public Yeet() { } @Override - public void onEnable(){ + public void onEnable() { enableTicks = 0; Raven.mc.thePlayer.playSound("keystrokesmod:yeet", 1, 1); mc.ingameGUI.displayTitle("还是PVP大佬", "", 10, 10, 10); diff --git a/src/main/java/keystrokesmod/module/impl/fun/antiaim/SpinAntiAim.java b/src/main/java/keystrokesmod/module/impl/fun/antiaim/SpinAntiAim.java index 586fe73a..2023f87d 100644 --- a/src/main/java/keystrokesmod/module/impl/fun/antiaim/SpinAntiAim.java +++ b/src/main/java/keystrokesmod/module/impl/fun/antiaim/SpinAntiAim.java @@ -14,10 +14,9 @@ public class SpinAntiAim extends SubMode { private final SliderSetting speed = new SliderSetting("Speed", 25, -30, 30, 1); private final ButtonSetting constantPitch = new ButtonSetting("Constant pitch", true); private final SliderSetting pitch = new SliderSetting("Pitch", 90, -90, 90, 5, constantPitch::isToggled); - + public boolean pitchReserve = false; private Float lastYaw = null; private Float lastPitch = null; - public boolean pitchReserve = false; public SpinAntiAim(String name, AntiAim parent) { super(name, parent); diff --git a/src/main/java/keystrokesmod/module/impl/minigames/AutoWho.java b/src/main/java/keystrokesmod/module/impl/minigames/AutoWho.java index 066790bc..3f5f8ae2 100644 --- a/src/main/java/keystrokesmod/module/impl/minigames/AutoWho.java +++ b/src/main/java/keystrokesmod/module/impl/minigames/AutoWho.java @@ -10,11 +10,11 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class AutoWho extends Module { - private DescriptionSetting description; - private DescriptionSetting nickDescription; - private ButtonSetting artifical; - private ButtonSetting hideMessage; - private ButtonSetting removeBots; + private final DescriptionSetting description; + private final DescriptionSetting nickDescription; + private final ButtonSetting artifical; + private final ButtonSetting hideMessage; + private final ButtonSetting removeBots; public AutoWho() { super("AutoWho", category.minigames); diff --git a/src/main/java/keystrokesmod/module/impl/minigames/BedWars.java b/src/main/java/keystrokesmod/module/impl/minigames/BedWars.java index 4ec46539..ecc66365 100644 --- a/src/main/java/keystrokesmod/module/impl/minigames/BedWars.java +++ b/src/main/java/keystrokesmod/module/impl/minigames/BedWars.java @@ -2,13 +2,12 @@ import com.mojang.realmsclient.gui.ChatFormatting; import keystrokesmod.module.Module; -import java.util.concurrent.CopyOnWriteArrayList; import keystrokesmod.module.impl.world.AntiBot; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.ModeSetting; import keystrokesmod.utility.BlockUtils; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.render.RenderUtils; import net.minecraft.block.BlockBed; import net.minecraft.block.BlockObsidian; import net.minecraft.entity.player.EntityPlayer; @@ -25,27 +24,28 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.awt.*; -import java.util.*; import java.util.List; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; public class BedWars extends Module { + private static final double MAX_SPAWN_DISTANCE_SQUARED = 800; + public static ButtonSetting whitelistOwnBed; + public static boolean outsideSpawn = true; + private static BlockPos spawnPos; private final String[] SERVERS = new String[]{"Hypixel", "Pika/Jartex"}; private final ModeSetting serverMode; - public static ButtonSetting whitelistOwnBed; private final ButtonSetting diamondArmor; private final ButtonSetting enderPearl; private final ButtonSetting fireball; private final ButtonSetting obsidian; private final ButtonSetting shouldPing; - private static BlockPos spawnPos; - private boolean check; - public static boolean outsideSpawn = true; private final List armoredPlayer = new CopyOnWriteArrayList<>(); private final Map lastHeldMap = new ConcurrentHashMap<>(); private final Set obsidianPos = new HashSet<>(); - private static final double MAX_SPAWN_DISTANCE_SQUARED = 800; private final int obsidianColor = new Color(0, 0, 0).getRGB(); + private boolean check; public BedWars() { super("Bed Wars", category.minigames); @@ -58,6 +58,10 @@ public BedWars() { this.registerSetting(shouldPing = new ButtonSetting("Should ping", true)); } + public static BlockPos getSpawnPos() { + return spawnPos; + } + public void onEnable() { armoredPlayer.clear(); lastHeldMap.clear(); @@ -103,7 +107,8 @@ public void onRenderWorld(RenderWorldLastEvent e) { } RenderUtils.renderBlock(blockPos, obsidianColor, false, true); } - } catch (Exception ignored) {} + } catch (Exception ignored) { + } } } @@ -162,7 +167,8 @@ public void onUpdate() { spawnPos = mc.thePlayer.getPosition(); check = false; } - if (spawnPos != null) outsideSpawn = mc.thePlayer.getDistanceSq(spawnPos) > MAX_SPAWN_DISTANCE_SQUARED; + if (spawnPos != null) + outsideSpawn = mc.thePlayer.getDistanceSq(spawnPos) > MAX_SPAWN_DISTANCE_SQUARED; } else { outsideSpawn = true; } @@ -171,6 +177,7 @@ public void onUpdate() { Utils.sendMessage(e.getLocalizedMessage()); } } + @SubscribeEvent public void onChat(ClientChatReceivedEvent c) { if (!Utils.nullCheck()) { @@ -210,9 +217,6 @@ private void ping() { mc.thePlayer.playSound("note.pling", 1.0f, 1.0f); } } - public static BlockPos getSpawnPos() { - return spawnPos; - } @Override public String getInfo() { diff --git a/src/main/java/keystrokesmod/module/impl/minigames/BridgeInfo.java b/src/main/java/keystrokesmod/module/impl/minigames/BridgeInfo.java index 10beb2f3..6e2051ea 100644 --- a/src/main/java/keystrokesmod/module/impl/minigames/BridgeInfo.java +++ b/src/main/java/keystrokesmod/module/impl/minigames/BridgeInfo.java @@ -3,9 +3,9 @@ import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.DescriptionSetting; +import keystrokesmod.utility.Utils; import keystrokesmod.utility.font.FontManager; import keystrokesmod.utility.render.RenderUtils; -import keystrokesmod.utility.Utils; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; @@ -29,19 +29,19 @@ import java.util.Iterator; public class BridgeInfo extends Module { + private static final int rgb = (new Color(0, 200, 200)).getRGB(); public static DescriptionSetting a; public static ButtonSetting ep; - private static final int rgb = (new Color(0, 200, 200)).getRGB(); - private final String bd = new String("the brid"); - private final String g1t = new String("Defend!"); - private final String g2t = new String("Jump in to score!"); - private final String qt = new String("First player to score 5 goals wins"); - private final String t1 = new String("Enemy: "); - private final String t2 = new String("Distance to goal: "); - private final String t3 = new String("Enemy distance to goal: "); - private final String t4 = new String("Blocks: "); private static int hudX = 5; private static int hudY = 70; + private final String bd = "the brid"; + private final String g1t = "Defend!"; + private final String g2t = "Jump in to score!"; + private final String qt = "First player to score 5 goals wins"; + private final String t1 = "Enemy: "; + private final String t2 = "Distance to goal: "; + private final String t3 = "Enemy distance to goal: "; + private final String t4 = "Blocks: "; private String en = ""; private BlockPos g1p = null; private BlockPos g2p = null; @@ -52,7 +52,7 @@ public class BridgeInfo extends Module { public BridgeInfo() { super("Bridge Info", Module.category.minigames, 0); - this.registerSetting(a = new DescriptionSetting(new String("Only for solos."))); + this.registerSetting(a = new DescriptionSetting("Only for solos.")); this.registerSetting(ep = new ButtonSetting("Edit position", false)); } @@ -89,12 +89,12 @@ public void onUpdate() { } if (this.g1p != null && this.g2p != null) { - this.d1 = Utils.rnd(mc.thePlayer.getDistance((double) this.g2p.getX(), (double) this.g2p.getY(), (double) this.g2p.getZ()) - 1.4D, 1); + this.d1 = Utils.rnd(mc.thePlayer.getDistance(this.g2p.getX(), this.g2p.getY(), this.g2p.getZ()) - 1.4D, 1); if (this.d1 < 0.0D) { this.d1 = 0.0D; } - this.d2 = enem == null ? 0.0D : Utils.rnd(enem.getDistance((double) this.g1p.getX(), (double) this.g1p.getY(), (double) this.g1p.getZ()) - 1.4D, 1); + this.d2 = enem == null ? 0.0D : Utils.rnd(enem.getDistance(this.g1p.getX(), this.g1p.getY(), this.g1p.getZ()) - 1.4D, 1); if (this.d2 < 0.0D) { this.d2 = 0.0D; } @@ -184,7 +184,7 @@ private void rv() { } static class eh extends GuiScreen { - final String a = new String("Enemy: Player123-Distance to goal: 17.2-Enemy distance to goal: 16.3-Blocks: 98"); + final String a = "Enemy: Player123-Distance to goal: 17.2-Enemy distance to goal: 16.3-Blocks: 98"; GuiButtonExt rp; boolean d = false; int miX = 0; @@ -200,7 +200,7 @@ static class eh extends GuiScreen { public void initGui() { super.initGui(); - this.buttonList.add(this.rp = new GuiButtonExt(1, this.width - 90, 5, 85, 20, new String("Reset position"))); + this.buttonList.add(this.rp = new GuiButtonExt(1, this.width - 90, 5, 85, 20, "Reset position")); this.aX = BridgeInfo.hudX; this.aY = BridgeInfo.hudY; } diff --git a/src/main/java/keystrokesmod/module/impl/minigames/DuelsStats.java b/src/main/java/keystrokesmod/module/impl/minigames/DuelsStats.java index 770e03f4..5cc453e2 100644 --- a/src/main/java/keystrokesmod/module/impl/minigames/DuelsStats.java +++ b/src/main/java/keystrokesmod/module/impl/minigames/DuelsStats.java @@ -16,14 +16,19 @@ import java.util.List; public class DuelsStats extends Module { + private static final String[] thr_lvl; public static ModeSetting mode; public static ButtonSetting a; public static ButtonSetting threatLevel; public static String nick = ""; + + static { + thr_lvl = new String[]{"§4VERY HIGH", "§cHIGH", "§6MODERATE", "§aLOW", "§2VERY LOW"}; + } + private String ign = ""; private String en = ""; - private static final String[] thr_lvl; - private List q = new ArrayList<>(); + private final List q = new ArrayList<>(); public DuelsStats() { super("Duels Stats", Module.category.minigames, 0); @@ -32,6 +37,73 @@ public DuelsStats() { this.registerSetting(threatLevel = new ButtonSetting("Threat Level", true)); } + public static String gtl(int w, int l, double wlr, int ws) { + int t = 0; + int m = w + l; + if (m <= 13) { + t += 2; + } + + if (ws >= 30) { + t += 9; + } else if (ws >= 15) { + t += 7; + } else if (ws >= 8) { + t += 5; + } else if (ws >= 4) { + t += 3; + } else if (ws >= 1) { + ++t; + } + + if (wlr >= 20.0D) { + t += 8; + } else if (wlr >= 10.0D) { + t += 5; + } else if (wlr >= 5.0D) { + t += 4; + } else if (wlr >= 3.0D) { + t += 2; + } else if (wlr >= 0.8D) { + ++t; + } + + if (w >= 20000) { + t += 4; + } else if (w >= 10000) { + t += 3; + } else if (w >= 5000) { + t += 2; + } else if (w >= 1000) { + ++t; + } + + if (l == 0) { + if (w == 0) { + t += 3; + } else { + t += 4; + } + } else if (l <= 10 && wlr >= 4.0D) { + t += 2; + } + + String thr; + if (t == 0) { + thr = thr_lvl[4]; + } else if (t <= 3) { + thr = thr_lvl[3]; + } else if (t <= 6) { + thr = thr_lvl[2]; + } else if (t <= 10) { + thr = thr_lvl[1]; + } else { + thr = thr_lvl[0]; + } + + return thr; + } + public void onEnable() { if (mc.thePlayer != null) { this.ign = mc.thePlayer.getName(); @@ -156,75 +228,4 @@ private boolean id() { return false; } } - - public static String gtl(int w, int l, double wlr, int ws) { - int t = 0; - int m = w + l; - if (m <= 13) { - t += 2; - } - - if (ws >= 30) { - t += 9; - } else if (ws >= 15) { - t += 7; - } else if (ws >= 8) { - t += 5; - } else if (ws >= 4) { - t += 3; - } else if (ws >= 1) { - ++t; - } - - if (wlr >= 20.0D) { - t += 8; - } else if (wlr >= 10.0D) { - t += 5; - } else if (wlr >= 5.0D) { - t += 4; - } else if (wlr >= 3.0D) { - t += 2; - } else if (wlr >= 0.8D) { - ++t; - } - - if (w >= 20000) { - t += 4; - } else if (w >= 10000) { - t += 3; - } else if (w >= 5000) { - t += 2; - } else if (w >= 1000) { - ++t; - } - - if (l == 0) { - if (w == 0) { - t += 3; - } else { - t += 4; - } - } else if (l <= 10 && wlr >= 4.0D) { - t += 2; - } - - String thr; - if (t == 0) { - thr = thr_lvl[4]; - } else if (t <= 3) { - thr = thr_lvl[3]; - } else if (t <= 6) { - thr = thr_lvl[2]; - } else if (t <= 10) { - thr = thr_lvl[1]; - } else { - thr = thr_lvl[0]; - } - - return thr; - } - - static { - thr_lvl = new String[]{"§4VERY HIGH", "§cHIGH", "§6MODERATE", "§aLOW", "§2VERY LOW"}; - } } diff --git a/src/main/java/keystrokesmod/module/impl/minigames/MurderMystery.java b/src/main/java/keystrokesmod/module/impl/minigames/MurderMystery.java index 632403fe..0550479b 100644 --- a/src/main/java/keystrokesmod/module/impl/minigames/MurderMystery.java +++ b/src/main/java/keystrokesmod/module/impl/minigames/MurderMystery.java @@ -2,30 +2,20 @@ import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.ButtonSetting; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.render.RenderUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.Item; -import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemBow; -import net.minecraft.item.ItemSword; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import java.awt.*; -import java.util.*; import java.util.List; +import java.util.*; public class MurderMystery extends Module { - private final ButtonSetting alert; - private final ButtonSetting highlightMurderer; - private final ButtonSetting highlightBow; - private final ButtonSetting highlightInnocent; - private final List murderers = new ArrayList<>(); - private final List hasBow = new ArrayList<>(); - private boolean override; - private static final Set MURDER_ITEMS = new HashSet<>(Arrays.asList( Items.wooden_sword, Items.stone_sword, @@ -38,7 +28,7 @@ public class MurderMystery extends Module { Items.iron_axe, Items.diamond_axe, Items.stick, - Items.blaze_rod, + Items.blaze_rod, Items.stone_shovel, Items.diamond_shovel, Items.quartz, @@ -69,6 +59,13 @@ public class MurderMystery extends Module { Item.getItemById(175), Item.getItemById(6) )); + private final ButtonSetting alert; + private final ButtonSetting highlightMurderer; + private final ButtonSetting highlightBow; + private final ButtonSetting highlightInnocent; + private final List murderers = new ArrayList<>(); + private final List hasBow = new ArrayList<>(); + private boolean override; public MurderMystery() { super("Murder Mystery", category.minigames); @@ -113,11 +110,9 @@ public void o(RenderWorldLastEvent e) { int rgb = Color.green.getRGB(); if (murderers.contains(en) && highlightMurderer.isToggled()) { rgb = Color.red.getRGB(); - } - else if (hasBow.contains(en) && highlightBow.isToggled()) { + } else if (hasBow.contains(en) && highlightBow.isToggled()) { rgb = Color.orange.getRGB(); - } - else if (!highlightInnocent.isToggled()) { + } else if (!highlightInnocent.isToggled()) { continue; } RenderUtils.renderEntity(en, 2, 0.0D, 0.0D, rgb, false); diff --git a/src/main/java/keystrokesmod/module/impl/minigames/SumoFences.java b/src/main/java/keystrokesmod/module/impl/minigames/SumoFences.java index 3248d4d0..7331a322 100644 --- a/src/main/java/keystrokesmod/module/impl/minigames/SumoFences.java +++ b/src/main/java/keystrokesmod/module/impl/minigames/SumoFences.java @@ -19,11 +19,6 @@ import java.util.TimerTask; public class SumoFences extends Module { - public static SliderSetting fenceHeight; - public ModeSetting blockType; - private java.util.Timer t; - private final List maps = Arrays.asList("Sumo", "Space Mine", "White Crystal", "Fort"); - private IBlockState f; private static final List f_p = Arrays.asList(new BlockPos(9, 65, -2), new BlockPos(9, 65, -1), new BlockPos(9, 65, 0), new BlockPos(9, 65, 1), new BlockPos(9, 65, 2), new BlockPos(9, 65, 3), new BlockPos(8, 65, 3), new BlockPos(8, 65, 4), new BlockPos(8, 65, 5), new BlockPos(7, 65, 5), @@ -43,7 +38,12 @@ public class SumoFences extends Module { new BlockPos(5, 65, -8), new BlockPos(5, 65, -7), new BlockPos(6, 65, -7), new BlockPos(7, 65, -7), new BlockPos(7, 65, -6), new BlockPos(7, 65, -5), new BlockPos(8, 65, -5), new BlockPos(8, 65, -4), new BlockPos(8, 65, -3), new BlockPos(9, 65, -3)); + public static SliderSetting fenceHeight; + private final List maps = Arrays.asList("Sumo", "Space Mine", "White Crystal", "Fort"); private final String[] mode = new String[]{"Oak fence", "Leaves", "Glass", "Barrier"}; + public ModeSetting blockType; + private java.util.Timer t; + private IBlockState f; public SumoFences() { super("Sumo Fences", category.minigames, 0); diff --git a/src/main/java/keystrokesmod/module/impl/movement/AirStuck.java b/src/main/java/keystrokesmod/module/impl/movement/AirStuck.java index d71a1a72..0fb75013 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/AirStuck.java +++ b/src/main/java/keystrokesmod/module/impl/movement/AirStuck.java @@ -1,7 +1,6 @@ package keystrokesmod.module.impl.movement; import keystrokesmod.event.MoveEvent; -import keystrokesmod.event.MoveInputEvent; import keystrokesmod.event.RotationEvent; import keystrokesmod.event.SendPacketEvent; import keystrokesmod.module.Module; diff --git a/src/main/java/keystrokesmod/module/impl/movement/Fly.java b/src/main/java/keystrokesmod/module/impl/movement/Fly.java index 7f414dd3..9e60638a 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/Fly.java +++ b/src/main/java/keystrokesmod/module/impl/movement/Fly.java @@ -2,7 +2,8 @@ import keystrokesmod.module.Module; import keystrokesmod.module.impl.movement.fly.*; -import keystrokesmod.module.setting.impl.*; +import keystrokesmod.module.setting.impl.ButtonSetting; +import keystrokesmod.module.setting.impl.ModeValue; import keystrokesmod.utility.render.RenderUtils; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; diff --git a/src/main/java/keystrokesmod/module/impl/movement/KeepSprint.java b/src/main/java/keystrokesmod/module/impl/movement/KeepSprint.java index e2b68345..9ad198fc 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/KeepSprint.java +++ b/src/main/java/keystrokesmod/module/impl/movement/KeepSprint.java @@ -10,10 +10,10 @@ import net.minecraft.util.Vec3; public class KeepSprint extends Module { - private static SliderSetting slow; - private static SliderSetting chance; public static ButtonSetting disableWhileJump; public static ButtonSetting reduceReachHits; + private static SliderSetting slow; + private static SliderSetting chance; public KeepSprint() { super("KeepSprint", Module.category.movement, 0); @@ -28,14 +28,12 @@ public static void keepSprint(Entity en) { boolean vanilla = false; if (disableWhileJump.isToggled() && !mc.thePlayer.onGround) { vanilla = true; - } - else if (reduceReachHits.isToggled() && !mc.thePlayer.capabilities.isCreativeMode) { + } else if (reduceReachHits.isToggled() && !mc.thePlayer.capabilities.isCreativeMode) { double n = -1.0; final Vec3 getPositionEyes = mc.thePlayer.getPositionEyes(1.0f); if (ModuleManager.killAura != null && ModuleManager.killAura.isEnabled() && KillAura.target != null) { n = getPositionEyes.distanceTo(KillAura.target.getPositionEyes(1.0f)); - } - else if (ModuleManager.reach != null && ModuleManager.reach.isEnabled()) { + } else if (ModuleManager.reach != null && ModuleManager.reach.isEnabled()) { n = getPositionEyes.distanceTo(mc.objectMouseOver.hitVec); } if (n != -1.0 && n <= 3.0) { diff --git a/src/main/java/keystrokesmod/module/impl/movement/LongJump.java b/src/main/java/keystrokesmod/module/impl/movement/LongJump.java index 3e968563..391993c6 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/LongJump.java +++ b/src/main/java/keystrokesmod/module/impl/movement/LongJump.java @@ -17,6 +17,7 @@ public LongJump() { .add(new VulcanLongJump("Vulcan", this)) .add(new GrimBoatLongJump("GrimBoat", this)) .add(new GrimVelocityLongJump("Test", this)) +// .add(new HypixelLongJump("Hypixel", this)) ); } diff --git a/src/main/java/keystrokesmod/module/impl/movement/NoSlow.java b/src/main/java/keystrokesmod/module/impl/movement/NoSlow.java index 5a6d6897..2c91c6bb 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/NoSlow.java +++ b/src/main/java/keystrokesmod/module/impl/movement/NoSlow.java @@ -37,21 +37,6 @@ public NoSlow() { this.registerSetting(sword, bow, rest); } - @Override - public void onEnable() { - mode.enable(); - } - - @Override - public void onDisable() { - mode.disable(); - } - - @Override - public String getInfo() { - return mode.getSubModeValues().get((int) mode.getInput()).getPrettyName(); - } - public static float getForwardSlowed() { if (!mc.thePlayer.isUsingItem()) return 1; if (!ModuleManager.noSlow.isEnabled()) return 0.2f; @@ -83,4 +68,19 @@ public static float getStrafeSlowed() { } return ((INoSlow) mode.getSubModeValues().get((int) mode.getInput())).getStrafeSlowdown(); } + + @Override + public void onEnable() { + mode.enable(); + } + + @Override + public void onDisable() { + mode.disable(); + } + + @Override + public String getInfo() { + return mode.getSubModeValues().get((int) mode.getInput()).getPrettyName(); + } } diff --git a/src/main/java/keystrokesmod/module/impl/movement/NoWeb.java b/src/main/java/keystrokesmod/module/impl/movement/NoWeb.java index 497312f5..4f20640d 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/NoWeb.java +++ b/src/main/java/keystrokesmod/module/impl/movement/NoWeb.java @@ -1,10 +1,10 @@ package keystrokesmod.module.impl.movement; import keystrokesmod.module.Module; -import keystrokesmod.module.impl.movement.noweb.VulcanNoWeb; import keystrokesmod.module.impl.movement.noweb.IgnoreNoWeb; import keystrokesmod.module.impl.movement.noweb.IntaveNoWeb; import keystrokesmod.module.impl.movement.noweb.PingNoWeb; +import keystrokesmod.module.impl.movement.noweb.VulcanNoWeb; import keystrokesmod.module.setting.impl.ModeValue; public class NoWeb extends Module { diff --git a/src/main/java/keystrokesmod/module/impl/movement/Phase.java b/src/main/java/keystrokesmod/module/impl/movement/Phase.java index 5b8c4abb..72926927 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/Phase.java +++ b/src/main/java/keystrokesmod/module/impl/movement/Phase.java @@ -4,7 +4,9 @@ import keystrokesmod.event.ReceivePacketEvent; import keystrokesmod.module.Module; import keystrokesmod.module.impl.movement.phase.*; -import keystrokesmod.module.setting.impl.*; +import keystrokesmod.module.setting.impl.ButtonSetting; +import keystrokesmod.module.setting.impl.DescriptionSetting; +import keystrokesmod.module.setting.impl.ModeValue; import net.minecraft.network.play.server.S08PacketPlayerPosLook; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/keystrokesmod/module/impl/movement/SaveMoveKeys.java b/src/main/java/keystrokesmod/module/impl/movement/SaveMoveKeys.java index 56da2432..f9f496ce 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/SaveMoveKeys.java +++ b/src/main/java/keystrokesmod/module/impl/movement/SaveMoveKeys.java @@ -4,7 +4,6 @@ import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.DescriptionSetting; import keystrokesmod.module.setting.impl.SliderSetting; -import keystrokesmod.utility.Utils; import net.minecraft.client.settings.KeyBinding; import org.lwjgl.input.Keyboard; @@ -13,6 +12,7 @@ public class SaveMoveKeys extends Module { private final SliderSetting delay; private boolean lastInGUI = false; + public SaveMoveKeys() { super("SaveMoveKeys", category.movement); this.registerSetting(new DescriptionSetting("re-press movement keys when close gui.")); @@ -32,7 +32,7 @@ public void onUpdate() { KeyBinding.setKeyBindState(mc.gameSettings.keyBindRight.getKeyCode(), Keyboard.isKeyDown(mc.gameSettings.keyBindRight.getKeyCode())); KeyBinding.setKeyBindState(mc.gameSettings.keyBindSprint.getKeyCode(), Keyboard.isKeyDown(mc.gameSettings.keyBindSprint.getKeyCode())); KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode())); - KeyBinding.setKeyBindState(mc.gameSettings.keyBindJump.getKeyCode(), Utils.jumpDown()); + KeyBinding.setKeyBindState(mc.gameSettings.keyBindJump.getKeyCode(), Keyboard.isKeyDown(mc.gameSettings.keyBindJump.getKeyCode())); KeyBinding.onTick(mc.gameSettings.keyBindForward.getKeyCode()); KeyBinding.onTick(mc.gameSettings.keyBindBack.getKeyCode()); KeyBinding.onTick(mc.gameSettings.keyBindLeft.getKeyCode()); diff --git a/src/main/java/keystrokesmod/module/impl/movement/Speed.java b/src/main/java/keystrokesmod/module/impl/movement/Speed.java index 0d38e65c..9d06da43 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/Speed.java +++ b/src/main/java/keystrokesmod/module/impl/movement/Speed.java @@ -3,13 +3,13 @@ import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.module.Module; import keystrokesmod.module.impl.movement.speed.*; -import keystrokesmod.module.setting.impl.*; -import keystrokesmod.utility.*; +import keystrokesmod.module.setting.impl.ButtonSetting; +import keystrokesmod.module.setting.impl.ModeValue; +import keystrokesmod.utility.MoveUtil; +import keystrokesmod.utility.Utils; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import static keystrokesmod.module.ModuleManager.scaffold; - public class Speed extends Module { private final ModeValue mode; private final ButtonSetting liquidDisable; diff --git a/src/main/java/keystrokesmod/module/impl/movement/Sprint.java b/src/main/java/keystrokesmod/module/impl/movement/Sprint.java index 5f707fe5..83b40029 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/Sprint.java +++ b/src/main/java/keystrokesmod/module/impl/movement/Sprint.java @@ -4,6 +4,7 @@ import keystrokesmod.event.SprintEvent; import keystrokesmod.module.Module; import keystrokesmod.module.ModuleManager; +import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.ModeSetting; import keystrokesmod.module.setting.utils.ModeOnly; import keystrokesmod.utility.MoveUtil; @@ -16,12 +17,16 @@ public class Sprint extends Module { private final ModeSetting mode = new ModeSetting("Mode", new String[]{"Legit", "Omni"}, 0); private final ModeSetting omniMode = new ModeSetting("Bypass mode", new String[]{"None", "Legit"}, 1, new ModeOnly(mode, 1)); + private final ButtonSetting disableWhileScaffold; + public static boolean omni = false; public static boolean stopSprint = false; public Sprint() { super("Sprint", Module.category.movement, 0); this.registerSetting(mode, omniMode); + // This setting is only applicable in legit mode as omni mode handles sprinting differently + this.registerSetting(disableWhileScaffold = new ButtonSetting("Disable While Scaffold", false, new ModeOnly(mode, 0))); } public static boolean omni() { @@ -42,7 +47,14 @@ public static boolean stopSprint() { @SubscribeEvent public void p(PlayerTickEvent e) { if (Utils.nullCheck() && mc.inGameHasFocus) { - KeyBinding.setKeyBindState(mc.gameSettings.keyBindSprint.getKeyCode(), true); + + if(ModuleManager.scaffold.isEnabled() && disableWhileScaffold.isToggled()) { + KeyBinding.setKeyBindState(mc.gameSettings.keyBindSprint.getKeyCode(), false); + } + else { + KeyBinding.setKeyBindState(mc.gameSettings.keyBindSprint.getKeyCode(), true); + } + } } diff --git a/src/main/java/keystrokesmod/module/impl/movement/TargetStrafe.java b/src/main/java/keystrokesmod/module/impl/movement/TargetStrafe.java index a8817986..2d19037a 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/TargetStrafe.java +++ b/src/main/java/keystrokesmod/module/impl/movement/TargetStrafe.java @@ -17,19 +17,19 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import static keystrokesmod.module.ModuleManager.*; +import static keystrokesmod.module.ModuleManager.killAura; +import static keystrokesmod.module.ModuleManager.scaffold; public class TargetStrafe extends Module { + private static float yaw; + private static EntityLivingBase target = null; + private static boolean active = false; private final SliderSetting range = new SliderSetting("Range", 1, 0.2, 6, 0.1); private final ButtonSetting speed = new ButtonSetting("Allow speed", true); private final ButtonSetting fly = new ButtonSetting("Allow fly", false); private final ButtonSetting manual = new ButtonSetting("Allow manual", false); private final ButtonSetting strafe = new ButtonSetting("Strafe around", true); - - private static float yaw; - private static EntityLivingBase target = null; private boolean left, colliding; - private static boolean active = false; public TargetStrafe() { super("TargetStrafe", category.movement); diff --git a/src/main/java/keystrokesmod/module/impl/movement/WallClimb.java b/src/main/java/keystrokesmod/module/impl/movement/WallClimb.java index 0ff41a29..c33b4af2 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/WallClimb.java +++ b/src/main/java/keystrokesmod/module/impl/movement/WallClimb.java @@ -1,8 +1,8 @@ package keystrokesmod.module.impl.movement; import keystrokesmod.module.Module; -import keystrokesmod.module.impl.movement.wallclimb.TestWallClimb; import keystrokesmod.module.impl.movement.wallclimb.IntaveWallClimb; +import keystrokesmod.module.impl.movement.wallclimb.TestWallClimb; import keystrokesmod.module.impl.movement.wallclimb.VulcanWallClimb; import keystrokesmod.module.setting.impl.ModeValue; diff --git a/src/main/java/keystrokesmod/module/impl/movement/fly/FakeFly.java b/src/main/java/keystrokesmod/module/impl/movement/fly/FakeFly.java index 7aadb2be..c746d429 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/fly/FakeFly.java +++ b/src/main/java/keystrokesmod/module/impl/movement/fly/FakeFly.java @@ -18,9 +18,8 @@ import static keystrokesmod.module.ModuleManager.scaffold; public class FakeFly extends SubMode { - private final ButtonSetting keep; - private static final Set hiddenPos = new HashSet<>(); + private final ButtonSetting keep; public FakeFly(String name, @NotNull Fly parent) { super(name, parent); diff --git a/src/main/java/keystrokesmod/module/impl/movement/fly/MatrixBowFly.java b/src/main/java/keystrokesmod/module/impl/movement/fly/MatrixBowFly.java index cab41e90..48df0e37 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/fly/MatrixBowFly.java +++ b/src/main/java/keystrokesmod/module/impl/movement/fly/MatrixBowFly.java @@ -1,12 +1,13 @@ package keystrokesmod.module.impl.movement.fly; -import keystrokesmod.event.*; +import keystrokesmod.event.MoveEvent; +import keystrokesmod.event.PreVelocityEvent; +import keystrokesmod.event.RotationEvent; import keystrokesmod.module.impl.movement.Fly; import keystrokesmod.module.impl.other.SlotHandler; import keystrokesmod.module.setting.impl.SubMode; import keystrokesmod.utility.ContainerUtils; import keystrokesmod.utility.MoveUtil; -import keystrokesmod.utility.Utils; import net.minecraft.item.ItemBow; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/keystrokesmod/module/impl/movement/fly/MatrixFly.java b/src/main/java/keystrokesmod/module/impl/movement/fly/MatrixFly.java index 1f97f90d..e108be46 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/fly/MatrixFly.java +++ b/src/main/java/keystrokesmod/module/impl/movement/fly/MatrixFly.java @@ -3,6 +3,7 @@ import keystrokesmod.event.BlockAABBEvent; import keystrokesmod.event.MoveInputEvent; import keystrokesmod.event.ReceivePacketEvent; +import keystrokesmod.module.impl.client.Notifications; import keystrokesmod.module.impl.movement.Fly; import keystrokesmod.module.setting.impl.SubMode; import keystrokesmod.utility.BlockUtils; @@ -46,7 +47,7 @@ public void onBlockAABB(@NotNull BlockAABBEvent event) { @SubscribeEvent public void onReceivePacket(@NotNull ReceivePacketEvent event) { if (event.getPacket() instanceof S08PacketPlayerPosLook) { - Utils.sendMessage("Anti-cheat flagged."); + Notifications.sendNotification(Notifications.NotificationTypes.INFO, "Anti-cheat flagged."); parent.disable(); } } diff --git a/src/main/java/keystrokesmod/module/impl/movement/fly/Vanilla1Fly.java b/src/main/java/keystrokesmod/module/impl/movement/fly/Vanilla1Fly.java index ff42306c..fe04a4e3 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/fly/Vanilla1Fly.java +++ b/src/main/java/keystrokesmod/module/impl/movement/fly/Vanilla1Fly.java @@ -6,8 +6,6 @@ import keystrokesmod.utility.Utils; import org.jetbrains.annotations.NotNull; -import javax.rmi.CORBA.Util; - public class Vanilla1Fly extends SubMode { private final SliderSetting horizontalSpeed; @@ -26,7 +24,7 @@ public void onEnable() { @Override public void onUpdate() { - mc.thePlayer.capabilities.setFlySpeed((float)(0.05000000074505806 * horizontalSpeed.getInput())); + mc.thePlayer.capabilities.setFlySpeed((float) (0.05000000074505806 * horizontalSpeed.getInput())); mc.thePlayer.capabilities.isFlying = true; } diff --git a/src/main/java/keystrokesmod/module/impl/movement/fly/Vanilla2Fly.java b/src/main/java/keystrokesmod/module/impl/movement/fly/Vanilla2Fly.java index 05307f7c..a4462692 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/fly/Vanilla2Fly.java +++ b/src/main/java/keystrokesmod/module/impl/movement/fly/Vanilla2Fly.java @@ -32,8 +32,7 @@ public void onUpdate() { } else { mc.thePlayer.motionY = 0.0; } - } - else { + } else { mc.thePlayer.motionY = 0.0; } if (MoveUtil.isMoving()) diff --git a/src/main/java/keystrokesmod/module/impl/movement/jesus/HypixelJesus.java b/src/main/java/keystrokesmod/module/impl/movement/jesus/HypixelJesus.java index e9424bfc..57d609e6 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/jesus/HypixelJesus.java +++ b/src/main/java/keystrokesmod/module/impl/movement/jesus/HypixelJesus.java @@ -18,8 +18,9 @@ * Skidded from Rise (com.alan.clients.module.impl.movement.jesus.WatchdogJesus) * * Counter-confused by xia__mc - * @see hackclient.rise.lk + * * @author Alan34 + * @see hackclient.rise.lk */ public class HypixelJesus extends SubMode { private Boolean tW = false; diff --git a/src/main/java/keystrokesmod/module/impl/movement/jesus/VulcanJesus.java b/src/main/java/keystrokesmod/module/impl/movement/jesus/VulcanJesus.java index acfb1d7a..e18b84fb 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/jesus/VulcanJesus.java +++ b/src/main/java/keystrokesmod/module/impl/movement/jesus/VulcanJesus.java @@ -19,7 +19,7 @@ public VulcanJesus(String name, @NotNull Jesus parent) { @SubscribeEvent public void onPreMotion(PreMotionEvent event) { - if (!mc.gameSettings.keyBindJump.isPressed() && mc.thePlayer.isInWater() && isFirstTimeInWater && !(mc.thePlayer.posY % 1 == 0 || (mc.thePlayer.posY * 2) % 1 == 0) ) { + if (!mc.gameSettings.keyBindJump.isPressed() && mc.thePlayer.isInWater() && isFirstTimeInWater && !(mc.thePlayer.posY % 1 == 0 || (mc.thePlayer.posY * 2) % 1 == 0)) { mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY - .85, mc.thePlayer.posZ); isFirstTimeInWater = false; @@ -29,43 +29,44 @@ public void onPreMotion(PreMotionEvent event) { if (MoveUtil.isMoving()) MoveUtil.strafe(MoveUtil.getAllowedHorizontalDistance() - Math.random() / 1000); mc.thePlayer.motionY = 0; } - if (isFirstTimeInWater){ - posY = mc.thePlayer.posY-.85; + if (isFirstTimeInWater) { + posY = mc.thePlayer.posY - .85; } if (mc.thePlayer.isInWater()) { waterTicks = 0; } - if(waterTicks<20){ + if (waterTicks < 20) { MoveUtil.strafe(); } waterTicks++; boolean jump = mc.gameSettings.keyBindJump.isKeyDown() || mc.gameSettings.keyBindJump.isPressed(); - if (jump && mc.thePlayer.isInWater() && !mc.gameSettings.keyBindJump.isKeyDown() && !mc.gameSettings.keyBindJump.isPressed()){ + if (jump && mc.thePlayer.isInWater() && !mc.gameSettings.keyBindJump.isKeyDown() && !mc.gameSettings.keyBindJump.isPressed()) { mc.thePlayer.setPosition(mc.thePlayer.posX, posY, mc.thePlayer.posZ); } if (mc.thePlayer.isPotionActive(Potion.moveSpeed) && mc.thePlayer.isInWater() && !mc.gameSettings.keyBindJump.isKeyDown()) { - if (MoveUtil.isMoving()) MoveUtil.strafe((.05*(1+(mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier())) +.34 - Math.random() / 1000)); + if (MoveUtil.isMoving()) + MoveUtil.strafe((.05 * (1 + (mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier())) + .34 - Math.random() / 1000)); } - if(!mc.gameSettings.keyBindJump.isKeyDown() && mc.thePlayer.isInWater() && !(mc.thePlayer.posY % 1 == 0 || (mc.thePlayer.posY * 2) % 1 == 0)){ + if (!mc.gameSettings.keyBindJump.isKeyDown() && mc.thePlayer.isInWater() && !(mc.thePlayer.posY % 1 == 0 || (mc.thePlayer.posY * 2) % 1 == 0)) { mc.thePlayer.setPosition(mc.thePlayer.posX, posY, mc.thePlayer.posZ); } - if(mc.gameSettings.keyBindJump.isKeyDown() && mc.thePlayer.isInWater()){ + if (mc.gameSettings.keyBindJump.isKeyDown() && mc.thePlayer.isInWater()) { mc.thePlayer.motionY = .6; MoveUtil.strafe(.1); } - if(mc.thePlayer.isInWater() && !mc.gameSettings.keyBindJump.isKeyDown() && !mc.gameSettings.keyBindJump.isPressed() && !(mc.thePlayer.posY % 1 == 0 || (mc.thePlayer.posY * 2) % 1 == 0)){ - mc.thePlayer.setPosition(mc.thePlayer.posX, posY-.2, mc.thePlayer.posZ); + if (mc.thePlayer.isInWater() && !mc.gameSettings.keyBindJump.isKeyDown() && !mc.gameSettings.keyBindJump.isPressed() && !(mc.thePlayer.posY % 1 == 0 || (mc.thePlayer.posY * 2) % 1 == 0)) { + mc.thePlayer.setPosition(mc.thePlayer.posX, posY - .2, mc.thePlayer.posZ); } - if (!mc.thePlayer.isInWater() && !isFirstTimeInWater && !(mc.thePlayer.posY % 1 == 0 || (mc.thePlayer.posY * 2) % 1 == 0)) { + if (!mc.thePlayer.isInWater() && !isFirstTimeInWater && !(mc.thePlayer.posY % 1 == 0 || (mc.thePlayer.posY * 2) % 1 == 0)) { isFirstTimeInWater = true; } } diff --git a/src/main/java/keystrokesmod/module/impl/movement/longjump/GrimVelocityLongJump.java b/src/main/java/keystrokesmod/module/impl/movement/longjump/GrimVelocityLongJump.java index 2ee21fa8..8b582dea 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/longjump/GrimVelocityLongJump.java +++ b/src/main/java/keystrokesmod/module/impl/movement/longjump/GrimVelocityLongJump.java @@ -2,7 +2,6 @@ import keystrokesmod.event.PreMotionEvent; import keystrokesmod.event.ReceivePacketEvent; -import keystrokesmod.mixins.impl.network.S27PacketExplosionAccessor; import keystrokesmod.module.impl.movement.LongJump; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.ModeSetting; @@ -30,10 +29,9 @@ public class GrimVelocityLongJump extends SubMode { private final ButtonSetting timer; private final SliderSetting timerSpeed; private final ButtonSetting debug; - + private final Queue> delayedPackets = new ConcurrentLinkedQueue<>(); private long lastVelocityTime = -1; private boolean delayed = false; - private final Queue> delayedPackets = new ConcurrentLinkedQueue<>(); public GrimVelocityLongJump(String name, @NotNull LongJump parent) { super(name, parent); @@ -49,7 +47,7 @@ public GrimVelocityLongJump(String name, @NotNull LongJump parent) { public void onReceivePacket(@NotNull ReceivePacketEvent event) { if (event.getPacket() instanceof S27PacketExplosion) { event.setCanceled(true); - delayedPackets.add((S27PacketExplosion) event.getPacket()); + delayedPackets.add(event.getPacket()); } if (event.getPacket() instanceof S12PacketEntityVelocity) { if (((S12PacketEntityVelocity) event.getPacket()).getEntityID() != mc.thePlayer.getEntityId()) return; @@ -59,14 +57,14 @@ public void onReceivePacket(@NotNull ReceivePacketEvent event) { delayed = true; } event.setCanceled(true); - delayedPackets.add((S12PacketEntityVelocity) event.getPacket()); + delayedPackets.add(event.getPacket()); } else if (event.getPacket() instanceof S32PacketConfirmTransaction) { if (delayed) { if (System.currentTimeMillis() - lastVelocityTime >= (int) delayTime.getInput()) { delayed = false; } event.setCanceled(true); - delayedPackets.add((S32PacketConfirmTransaction) event.getPacket()); + delayedPackets.add(event.getPacket()); } } } diff --git a/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelBowLongJump.java b/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelBowLongJump.java index ff8d4f16..cdf86556 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelBowLongJump.java +++ b/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelBowLongJump.java @@ -1,12 +1,11 @@ package keystrokesmod.module.impl.movement.longjump; -import keystrokesmod.event.MoveInputEvent; -import keystrokesmod.event.PrePlayerInputEvent; -import keystrokesmod.event.ReceivePacketEvent; -import keystrokesmod.event.RotationEvent; +import keystrokesmod.Raven; +import keystrokesmod.event.*; import keystrokesmod.module.impl.client.Notifications; import keystrokesmod.module.impl.movement.LongJump; import keystrokesmod.module.impl.other.SlotHandler; +import keystrokesmod.module.impl.player.blink.NormalBlink; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.impl.SubMode; @@ -15,22 +14,22 @@ import keystrokesmod.utility.Utils; import net.minecraft.item.ItemBow; import net.minecraft.item.ItemStack; -import net.minecraft.network.Packet; -import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.network.play.client.C07PacketPlayerDigging; +import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; import net.minecraft.network.play.server.S12PacketEntityVelocity; -import net.minecraft.network.play.server.S32PacketConfirmTransaction; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; -import java.util.Queue; -import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.TimeUnit; public class HypixelBowLongJump extends SubMode { private final SliderSetting speed; private final ButtonSetting autoDisable; private State state = State.SELF_DAMAGE; - private final Queue> delayedPackets = new ConcurrentLinkedQueue<>(); + private final NormalBlink blink = new NormalBlink("Blink", this); public HypixelBowLongJump(String name, @NotNull LongJump parent) { super(name, parent); @@ -44,60 +43,69 @@ public void onEnable() throws Throwable { state = State.SELF_DAMAGE; } + @Override + public void onDisable() throws Throwable { + blink.disable(); + } + @SubscribeEvent public void onMoveInput(MoveInputEvent event) { - if (state == State.SELF_DAMAGE) { + if (state == State.SELF_DAMAGE || state == State.SELF_DAMAGE_POST) { event.setCanceled(true); } } @SubscribeEvent public void onReceivePacket(@NotNull ReceivePacketEvent event) { - if (event.getPacket() instanceof S12PacketEntityVelocity && (state == State.SELF_DAMAGE || state == State.JUMP)) { + if (event.getPacket() instanceof S12PacketEntityVelocity && (state == State.JUMP)) { S12PacketEntityVelocity packet = (S12PacketEntityVelocity) event.getPacket(); if (packet.getEntityID() != mc.thePlayer.getEntityId()) return; - delayedPackets.add(event.getPacket()); - state = State.JUMP; - } else if (event.getPacket() instanceof S32PacketConfirmTransaction && (state == State.SELF_DAMAGE || state == State.JUMP)) { - delayedPackets.add(event.getPacket()); + state = State.APPLY; } } @SubscribeEvent public void onRotation(RotationEvent event) { - if (state == State.SELF_DAMAGE) + if (state == State.SELF_DAMAGE || state == State.SELF_DAMAGE_POST) event.setPitch(-90); } @SubscribeEvent public void onPrePlayerInput(PrePlayerInputEvent event) { + int slot = getBow(); + if (slot == -1) { + Notifications.sendNotification(Notifications.NotificationTypes.INFO, "Could not find Bow"); + parent.disable(); + } switch (state) { case SELF_DAMAGE: - int slot = getBow(); - if (slot == -1) { - Notifications.sendNotification(Notifications.NotificationTypes.INFO, "Could not find Bow"); - parent.disable(); + if (SlotHandler.getCurrentSlot() == slot) { + PacketUtils.sendPacketNoEvent(new C08PacketPlayerBlockPlacement(SlotHandler.getHeldItem())); + Raven.getExecutor().schedule(() -> { + PacketUtils.sendPacketNoEvent(new C07PacketPlayerDigging( + C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, + BlockPos.ORIGIN, EnumFacing.UP + )); + Raven.getExecutor().schedule(() -> state = State.JUMP, 300, TimeUnit.MILLISECONDS); + }, 150, TimeUnit.MILLISECONDS); + state = State.SELF_DAMAGE_POST; } SlotHandler.setCurrentSlot(slot); break; + case SELF_DAMAGE_POST: + SlotHandler.setCurrentSlot(slot); + break; case JUMP: if (!Utils.jumpDown() && mc.thePlayer.onGround) { - MoveUtil.strafe(MoveUtil.getAllowedHorizontalDistance()); + blink.enable(); + MoveUtil.strafe(MoveUtil.getAllowedHorizontalDistance() - Math.random() / 100f); mc.thePlayer.jump(); - state = State.APPLY; } break; case APPLY: - if (parent.offGroundTicks >= 7) { - synchronized (delayedPackets) { - for (Packet p : delayedPackets) { - PacketUtils.receivePacket(p); - } - delayedPackets.clear(); - } - state = State.BOOST; - } + blink.disable(); + state = State.BOOST; break; case BOOST: if (speed.getInput() > 0) @@ -124,6 +132,7 @@ private int getBow() { enum State { SELF_DAMAGE, + SELF_DAMAGE_POST, JUMP, APPLY, BOOST, diff --git a/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelFireballLongJump.java b/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelFireballLongJump.java index 9713b0be..27aae70a 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelFireballLongJump.java +++ b/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelFireballLongJump.java @@ -2,19 +2,20 @@ import keystrokesmod.module.impl.client.Notifications; import keystrokesmod.module.impl.movement.LongJump; -import keystrokesmod.module.impl.movement.longjump.hypixelfireball.MotionHypixelFireballLongJump; import keystrokesmod.module.impl.movement.longjump.hypixelfireball.NormalHypixelFireballLongJump; import keystrokesmod.module.impl.other.SlotHandler; -import keystrokesmod.module.setting.impl.*; +import keystrokesmod.module.setting.impl.ButtonSetting; +import keystrokesmod.module.setting.impl.ModeValue; +import keystrokesmod.module.setting.impl.SliderSetting; +import keystrokesmod.module.setting.impl.SubMode; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import org.jetbrains.annotations.NotNull; public class HypixelFireballLongJump extends SubMode { public final SliderSetting speed; - private final ModeValue mode; public final ButtonSetting autoDisable; - + private final ModeValue mode; private int lastSlot = -1; public HypixelFireballLongJump(String name, @NotNull LongJump parent) { @@ -22,7 +23,6 @@ public HypixelFireballLongJump(String name, @NotNull LongJump parent) { this.registerSetting(speed = new SliderSetting("Speed", 1.5, 0, 2, 0.01)); this.registerSetting(mode = new ModeValue("Sub-Mode", this) .add(new NormalHypixelFireballLongJump("Normal", this)) - .add(new MotionHypixelFireballLongJump("Motion", this)) ); this.registerSetting(autoDisable = new ButtonSetting("Auto disable", true)); } diff --git a/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelLongJump.java b/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelLongJump.java new file mode 100644 index 00000000..92a538ef --- /dev/null +++ b/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelLongJump.java @@ -0,0 +1,86 @@ +package keystrokesmod.module.impl.movement.longjump; + +import keystrokesmod.event.BlockAABBEvent; +import keystrokesmod.event.PrePlayerInputEvent; +import keystrokesmod.event.ReceivePacketEvent; +import keystrokesmod.event.RotationEvent; +import keystrokesmod.module.impl.client.Notifications; +import keystrokesmod.module.impl.movement.LongJump; +import keystrokesmod.module.impl.other.SlotHandler; +import keystrokesmod.module.setting.impl.SubMode; +import keystrokesmod.utility.BlockUtils; +import keystrokesmod.utility.MoveUtil; +import keystrokesmod.utility.PacketUtils; +import keystrokesmod.utility.Utils; +import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; +import net.minecraft.network.play.server.S08PacketPlayerPosLook; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.jetbrains.annotations.NotNull; + +public class HypixelLongJump extends SubMode { + private int startY = -1; + + public HypixelLongJump(String name, @NotNull LongJump parent) { + super(name, parent); + } + + @SubscribeEvent + public void onRotation(@NotNull RotationEvent event) { + event.setYaw(mc.thePlayer.rotationYaw - 110); + event.setPitch(85); + } + + @SubscribeEvent + public void onBlockAABB(@NotNull BlockAABBEvent event) { + if (BlockUtils.replaceable(event.getBlockPos())) { + final double x = event.getBlockPos().getX(), y = event.getBlockPos().getY(), z = event.getBlockPos().getZ(); + + if (y < startY) { + event.setBoundingBox(AxisAlignedBB.fromBounds(-15, -1, -15, 15, 1, 15).offset(x, y, z)); + } + } + } + + @SubscribeEvent + public void onPrePlayerInput(PrePlayerInputEvent event) { + if (startY == -1) { + if (mc.thePlayer.onGround) + startY = (int) mc.thePlayer.posY; + return; + } + + if (!Utils.jumpDown() && Utils.isMoving() && mc.currentScreen == null && mc.thePlayer.onGround) { + MoveUtil.strafe(MoveUtil.getAllowedHorizontalDistance() - Math.random() / 100f); + mc.thePlayer.jump(); + } + + BlockPos ground = new BlockPos(mc.thePlayer.posX, startY - 1, mc.thePlayer.posZ); + if (BlockUtils.replaceable(ground)) { + BlockPos pos = ground.down(); + PacketUtils.sendPacket(new C08PacketPlayerBlockPlacement( + pos, EnumFacing.UP.getIndex(), SlotHandler.getHeldItem(), + (float) (mc.thePlayer.posX - pos.getX()), + (float) (mc.thePlayer.posY - pos.getY()), + (float) (mc.thePlayer.posZ - pos.getZ()))); + mc.thePlayer.swingItem(); + if (mc.thePlayer.onGround) + parent.disable(); + } + } + + @SubscribeEvent + public void onReceivePacket(@NotNull ReceivePacketEvent event) { + if (event.getPacket() instanceof S08PacketPlayerPosLook) { + Notifications.sendNotification(Notifications.NotificationTypes.INFO, "Anti-cheat flagged."); + parent.disable(); + } + } + + @Override + public void onDisable() throws Throwable { + startY = -1; + } +} diff --git a/src/main/java/keystrokesmod/module/impl/movement/longjump/VulcanLongJump.java b/src/main/java/keystrokesmod/module/impl/movement/longjump/VulcanLongJump.java index e2441fae..14e2fcbb 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/longjump/VulcanLongJump.java +++ b/src/main/java/keystrokesmod/module/impl/movement/longjump/VulcanLongJump.java @@ -34,7 +34,7 @@ public void onPreMotion(PreMotionEvent event) { mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 9.9, mc.thePlayer.posZ); } - if (ticks > 0 && !(ticks >3)) { + if (ticks > 0 && !(ticks > 3)) { mc.thePlayer.motionY = 0; mc.thePlayer.onGround = true; diff --git a/src/main/java/keystrokesmod/module/impl/movement/longjump/hypixelfireball/MotionHypixelFireballLongJump.java b/src/main/java/keystrokesmod/module/impl/movement/longjump/hypixelfireball/MotionHypixelFireballLongJump.java deleted file mode 100644 index b089087e..00000000 --- a/src/main/java/keystrokesmod/module/impl/movement/longjump/hypixelfireball/MotionHypixelFireballLongJump.java +++ /dev/null @@ -1,142 +0,0 @@ -package keystrokesmod.module.impl.movement.longjump.hypixelfireball; - -import keystrokesmod.event.PreMotionEvent; -import keystrokesmod.event.ReceivePacketEvent; -import keystrokesmod.event.SendPacketEvent; -import keystrokesmod.module.impl.movement.longjump.HypixelFireballLongJump; -import keystrokesmod.module.impl.other.SlotHandler; -import keystrokesmod.module.setting.impl.ButtonSetting; -import keystrokesmod.module.setting.impl.SliderSetting; -import keystrokesmod.module.setting.impl.SubMode; -import keystrokesmod.utility.MoveUtil; -import keystrokesmod.utility.PacketUtils; -import keystrokesmod.utility.Reflection; -import keystrokesmod.utility.Utils; -import net.minecraft.item.ItemFireball; -import net.minecraft.network.Packet; -import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; -import net.minecraft.network.play.server.S12PacketEntityVelocity; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import org.jetbrains.annotations.NotNull; - -public class MotionHypixelFireballLongJump extends SubMode { - private final SliderSetting motion; - private final SliderSetting time; - private final ButtonSetting strafe; - - private int lastSlot = -1; - private int ticks = -1; - private boolean setSpeed; - private boolean sentPlace; - private int initTicks; - private boolean thrown; - - public MotionHypixelFireballLongJump(String name, @NotNull HypixelFireballLongJump parent) { - super(name, parent); - this.registerSetting(motion = new SliderSetting("Motion", 0.3, 0.01, 0.4, 0.01)); - this.registerSetting(time = new SliderSetting("Time", 31, 10, 60, 1, "ticks")); - this.registerSetting(strafe = new ButtonSetting("Strafe", true)); - } - - @SubscribeEvent - public void onSendPacket(@NotNull SendPacketEvent event) { - Packet> packet = event.getPacket(); - if (packet instanceof C08PacketPlayerBlockPlacement - && ((C08PacketPlayerBlockPlacement) event.getPacket()).getStack() != null - && ((C08PacketPlayerBlockPlacement) event.getPacket()).getStack().getItem() instanceof ItemFireball) { - thrown = true; - } - } - - @SubscribeEvent - public void onReceivePacket(ReceivePacketEvent event) { - if (!Utils.nullCheck()) { - return; - } - - Packet> packet = event.getPacket(); - if (packet instanceof S12PacketEntityVelocity) { - if (((S12PacketEntityVelocity) event.getPacket()).getEntityID() != mc.thePlayer.getEntityId()) { - return; - } - if (thrown) { - ticks = 0; - setSpeed = true; - thrown = false; - } - } - } - - @SubscribeEvent - public void onPreMotion(PreMotionEvent event) { - if (!Utils.nullCheck()) { - return; - } - - switch (initTicks) { - case 0: - int fireballSlot = parent.getFireball(); - if (fireballSlot != -1 && fireballSlot != SlotHandler.getCurrentSlot()) { - lastSlot = SlotHandler.getCurrentSlot(); - SlotHandler.setCurrentSlot(fireballSlot); - } - event.setYaw(mc.thePlayer.rotationYaw - 180); - event.setPitch(89); - break; - case 1: - event.setYaw(mc.thePlayer.rotationYaw - 180); - event.setPitch(89); - if (!sentPlace) { - PacketUtils.sendPacket(new C08PacketPlayerBlockPlacement(SlotHandler.getHeldItem())); - sentPlace = true; - } - break; - case 2: - if (lastSlot != -1) { - SlotHandler.setCurrentSlot(lastSlot); - lastSlot = -1; - } - break; - } - - initTicks++; - - if (ticks > time.getInput()) { - if (parent.autoDisable.isToggled()) - parent.parent.disable(); - } else if (ticks >= 0) { - mc.thePlayer.motionY = motion.getInput(); - if (strafe.isToggled()) - MoveUtil.strafe(); - } - - if (setSpeed) { - this.setSpeed(); - ticks++; - } - - if (setSpeed) { - if (ticks > 1) { - setSpeed = false; - return; - } - ticks++; - setSpeed(); - } - } - - public void onDisable() { - ticks = lastSlot = -1; - setSpeed = sentPlace = false; - initTicks = 0; - } - - public void onEnable() { - initTicks = 0; - } - - private void setSpeed() { - MoveUtil.strafe((float) parent.speed.getInput()); - } - -} diff --git a/src/main/java/keystrokesmod/module/impl/movement/noslow/CustomNoSlow.java b/src/main/java/keystrokesmod/module/impl/movement/noslow/CustomNoSlow.java index fee27535..892bb551 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/noslow/CustomNoSlow.java +++ b/src/main/java/keystrokesmod/module/impl/movement/noslow/CustomNoSlow.java @@ -19,10 +19,10 @@ import org.jetbrains.annotations.Nullable; public class CustomNoSlow extends INoSlow { - private final ButtonSetting onlyWhileMove; - private final ButtonSetting startSlow; public final ModeSetting switchMode; public final ModeSetting slotMode; + private final ButtonSetting onlyWhileMove; + private final ButtonSetting startSlow; private final ModeSetting mode; private final ModeValue sword; private final ModeValue bow; diff --git a/src/main/java/keystrokesmod/module/impl/movement/noslow/GrimACNoSlow.java b/src/main/java/keystrokesmod/module/impl/movement/noslow/GrimACNoSlow.java index 56f7f196..d99e544c 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/noslow/GrimACNoSlow.java +++ b/src/main/java/keystrokesmod/module/impl/movement/noslow/GrimACNoSlow.java @@ -1,7 +1,6 @@ package keystrokesmod.module.impl.movement.noslow; import keystrokesmod.event.SendPacketEvent; -import keystrokesmod.mixins.impl.client.KeyBindingAccessor; import keystrokesmod.module.impl.movement.NoSlow; import keystrokesmod.module.impl.other.SlotHandler; import keystrokesmod.utility.PacketUtils; diff --git a/src/main/java/keystrokesmod/module/impl/movement/noslow/HypixelNoSlow.java b/src/main/java/keystrokesmod/module/impl/movement/noslow/HypixelNoSlow.java index 195122e0..afd971c7 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/noslow/HypixelNoSlow.java +++ b/src/main/java/keystrokesmod/module/impl/movement/noslow/HypixelNoSlow.java @@ -4,11 +4,9 @@ import keystrokesmod.event.SendPacketEvent; import keystrokesmod.module.impl.movement.NoSlow; import keystrokesmod.module.impl.other.SlotHandler; -import keystrokesmod.utility.BlockUtils; import keystrokesmod.utility.ContainerUtils; import keystrokesmod.utility.PacketUtils; import keystrokesmod.utility.Utils; -import net.minecraft.block.BlockStairs; import net.minecraft.item.ItemBow; import net.minecraft.item.ItemPotion; import net.minecraft.item.ItemStack; @@ -76,9 +74,6 @@ public void onSendPacket(@NotNull SendPacketEvent event) { @Override public float getSlowdown() { - if (BlockUtils.blockRelativeToPlayer(0, -1, 0) instanceof BlockStairs) - return 0.2f; - ItemStack item = SlotHandler.getHeldItem(); if (item != null && item.getItem() instanceof ItemSword) return 0.8f; diff --git a/src/main/java/keystrokesmod/module/impl/movement/noslow/IntaveNoSlow.java b/src/main/java/keystrokesmod/module/impl/movement/noslow/IntaveNoSlow.java index 482fa3cc..186a4b3b 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/noslow/IntaveNoSlow.java +++ b/src/main/java/keystrokesmod/module/impl/movement/noslow/IntaveNoSlow.java @@ -1,7 +1,6 @@ package keystrokesmod.module.impl.movement.noslow; import keystrokesmod.event.PreMotionEvent; -import keystrokesmod.module.ModuleManager; import keystrokesmod.module.impl.movement.NoSlow; import keystrokesmod.module.impl.other.SlotHandler; import keystrokesmod.utility.ContainerUtils; diff --git a/src/main/java/keystrokesmod/module/impl/movement/noweb/IgnoreNoWeb.java b/src/main/java/keystrokesmod/module/impl/movement/noweb/IgnoreNoWeb.java index b817881f..469e8dbd 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/noweb/IgnoreNoWeb.java +++ b/src/main/java/keystrokesmod/module/impl/movement/noweb/IgnoreNoWeb.java @@ -3,7 +3,6 @@ import keystrokesmod.event.BlockWebEvent; import keystrokesmod.module.impl.movement.NoWeb; import keystrokesmod.module.setting.impl.SubMode; -import net.minecraft.init.Blocks; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/keystrokesmod/module/impl/movement/phase/GrimACPhase.java b/src/main/java/keystrokesmod/module/impl/movement/phase/GrimACPhase.java index b61baf95..45921b0f 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/phase/GrimACPhase.java +++ b/src/main/java/keystrokesmod/module/impl/movement/phase/GrimACPhase.java @@ -23,6 +23,14 @@ public GrimACPhase(String name, @NotNull Phase parent) { this.registerSetting(onlyMurderMystery = new ButtonSetting("Only murder mystery", false)); } + private static boolean isMurderMystery() { + try { + return Utils.getSidebarLines().get(0).contains("MURDER"); + } catch (IndexOutOfBoundsException e) { + return false; + } + } + @SubscribeEvent public void onWorldChange(WorldChangeEvent event) { if (!onlyMurderMystery.isToggled() || isMurderMystery()) @@ -47,12 +55,4 @@ public void onUpdate() { public void onDisable() { blink.disable(); } - - private static boolean isMurderMystery() { - try { - return Utils.getSidebarLines().get(0).contains("MURDER"); - } catch (IndexOutOfBoundsException e) { - return false; - } - } } diff --git a/src/main/java/keystrokesmod/module/impl/movement/phase/VulcanPhase.java b/src/main/java/keystrokesmod/module/impl/movement/phase/VulcanPhase.java index d1c46975..0d22f07e 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/phase/VulcanPhase.java +++ b/src/main/java/keystrokesmod/module/impl/movement/phase/VulcanPhase.java @@ -32,16 +32,17 @@ public VulcanPhase(String name, Phase parent) { super(name, parent); this.registerSetting(fast, cancelVelocity); } + @Override public void onEnable() { flag = true; timer1 = 0; teleport = false; enable = true; - if( mc.thePlayer.onGround ){ + if (mc.thePlayer.onGround) { mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY - 1, mc.thePlayer.posZ); MoveUtil.stop(); - } else{ + } else { Notifications.sendNotification(Notifications.NotificationTypes.INFO, "You must me on the ground to do this"); parent.toggle(); } @@ -51,21 +52,21 @@ public void onEnable() { @SubscribeEvent public void onPreMotion(PreMotionEvent event) { mc.thePlayer.cameraYaw = 0.1F; - if( timer1 > 25) { + if (timer1 > 25) { - if(insideBlock()) { + if (insideBlock()) { event.setOnGround(false); } } - if(insideBlock()){ + if (insideBlock()) { timer1++; } - if((insideBlock() && !enable && flag)) { + if ((insideBlock() && !enable && flag)) { flag = false; Notifications.sendNotification(Notifications.NotificationTypes.INFO, "Phased"); } @@ -86,7 +87,7 @@ public void onBlockAABB(BlockAABBEvent event) { event.setBoundingBox(AxisAlignedBB.fromBounds(-15, -1, -15, 15, 1, 15).offset(x, y, z)); } } - } else if (!teleport){ + } else if (!teleport) { if (event.getBlock() instanceof BlockAir && !mc.thePlayer.isSneaking()) { @@ -96,7 +97,7 @@ public void onBlockAABB(BlockAABBEvent event) { event.setBoundingBox(AxisAlignedBB.fromBounds(-15, -1, -15, 15, 1, 15).offset(x, y, z)); } } - } else if (!insideBlock()){ + } else if (!insideBlock()) { Notifications.sendNotification(Notifications.NotificationTypes.INFO, "Disabled due to not being in a block"); parent.toggle(); } @@ -104,33 +105,33 @@ public void onBlockAABB(BlockAABBEvent event) { @SubscribeEvent public void onStrafe(PrePlayerInputEvent event) { - if(mc.gameSettings.keyBindJump.isKeyDown() && mc.thePlayer.hurtTime>0){ - mc.thePlayer.motionY=.99; + if (mc.gameSettings.keyBindJump.isKeyDown() && mc.thePlayer.hurtTime > 0) { + mc.thePlayer.motionY = .99; yMoving = true; - } else if (mc.gameSettings.keyBindSneak.isKeyDown()){ - mc.thePlayer.motionY=-.4; + } else if (mc.gameSettings.keyBindSneak.isKeyDown()) { + mc.thePlayer.motionY = -.4; yMoving = true; - } else if (!mc.gameSettings.keyBindJump.isKeyDown() && insideBlock() && timer1 > 25){ + } else if (!mc.gameSettings.keyBindJump.isKeyDown() && insideBlock() && timer1 > 25) { yMoving = false; } - if(fast.isToggled() && insideBlock()) { + if (fast.isToggled() && insideBlock()) { if (mc.thePlayer.isPotionActive(Potion.moveSpeed)) { - event.setSpeed(((.0765*(1+(mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier()))) +.306)); + event.setSpeed(((.0765 * (1 + (mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier()))) + .306)); } else { event.setSpeed(.306); } } - if (mc.thePlayer.onGround && enable && teleport){ + if (mc.thePlayer.onGround && enable && teleport) { mc.thePlayer.jump(); teleport = false; enable = false; } - if (mc.thePlayer.onGround && !teleport &&!enable) { + if (mc.thePlayer.onGround && !teleport && !enable) { - if (mc.thePlayer.ticksExisted % 2 == 1|| !(mc.thePlayer.moveForward ==0 )) { + if (mc.thePlayer.ticksExisted % 2 == 1 || !(mc.thePlayer.moveForward == 0)) { event.setForward(1); } else { diff --git a/src/main/java/keystrokesmod/module/impl/movement/phase/WatchdogAutoPhase.java b/src/main/java/keystrokesmod/module/impl/movement/phase/WatchdogAutoPhase.java index 44e937bc..64a83eed 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/phase/WatchdogAutoPhase.java +++ b/src/main/java/keystrokesmod/module/impl/movement/phase/WatchdogAutoPhase.java @@ -16,9 +16,9 @@ import org.jetbrains.annotations.NotNull; public class WatchdogAutoPhase extends SubMode { - private boolean phase; private final CoolDown stopWatch = new CoolDown(4000); private final NormalBlink blink = new NormalBlink("Blink", this); + private boolean phase; public WatchdogAutoPhase(String name, Phase parent) { super(name, parent); diff --git a/src/main/java/keystrokesmod/module/impl/movement/phase/WatchdogPhase.java b/src/main/java/keystrokesmod/module/impl/movement/phase/WatchdogPhase.java index d861c7af..3b67dd14 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/phase/WatchdogPhase.java +++ b/src/main/java/keystrokesmod/module/impl/movement/phase/WatchdogPhase.java @@ -8,8 +8,6 @@ import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.impl.SubMode; -import net.minecraft.util.BlockPos; -import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/keystrokesmod/module/impl/movement/speed/GrimACSpeed.java b/src/main/java/keystrokesmod/module/impl/movement/speed/GrimACSpeed.java index ec85b44f..b1c59ff3 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/speed/GrimACSpeed.java +++ b/src/main/java/keystrokesmod/module/impl/movement/speed/GrimACSpeed.java @@ -7,7 +7,6 @@ import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.impl.SubMode; import keystrokesmod.utility.MoveUtil; -import keystrokesmod.utility.Utils; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityArmorStand; diff --git a/src/main/java/keystrokesmod/module/impl/movement/speed/HypixelSpeed.java b/src/main/java/keystrokesmod/module/impl/movement/speed/HypixelSpeed.java index 538b403f..acf39023 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/speed/HypixelSpeed.java +++ b/src/main/java/keystrokesmod/module/impl/movement/speed/HypixelSpeed.java @@ -3,20 +3,20 @@ import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.module.impl.movement.Speed; import keystrokesmod.module.impl.movement.TargetStrafe; -import keystrokesmod.module.impl.movement.speed.hypixel.*; +import keystrokesmod.module.impl.movement.speed.hypixel.GroundStrafeSpeed; +import keystrokesmod.module.impl.movement.speed.hypixel.HypixelGroundSpeed; +import keystrokesmod.module.impl.movement.speed.hypixel.HypixelLowHopSpeed; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.ModeValue; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.impl.SubMode; import keystrokesmod.utility.MoveUtil; -import keystrokesmod.utility.PacketUtils; import keystrokesmod.utility.movement.Move; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; public class HypixelSpeed extends SubMode { private final ModeValue mode; - private final ButtonSetting fastTest; private final ButtonSetting strafe; private final SliderSetting minAngle; private final ButtonSetting fullStrafe; @@ -30,7 +30,6 @@ public HypixelSpeed(String name, @NotNull Speed parent) { .add(new HypixelGroundSpeed("Ground", this)) .add(new HypixelLowHopSpeed("LowHop", this)) ); - this.registerSetting(fastTest = new ButtonSetting("Fast test", false)); this.registerSetting(strafe = new ButtonSetting("Strafe", false)); this.registerSetting(minAngle = new SliderSetting("Min angle", 30, 15, 90, 15, strafe::isToggled)); this.registerSetting(fullStrafe = new ButtonSetting("Full strafe", false, strafe::isToggled)); @@ -46,11 +45,6 @@ public void onPreUpdate(PreUpdateEvent event) { MoveUtil.strafe(0.11); } } - - if (fastTest.isToggled() && mc.thePlayer.onGround) { - mc.thePlayer.motionX *= 1.114 - MoveUtil.getSpeedEffect() * .01 - Math.random() * 1E-4; - mc.thePlayer.motionZ *= 1.114 - MoveUtil.getSpeedEffect() * .01 - Math.random() * 1E-4; - } } private boolean canStrafe() { @@ -77,10 +71,5 @@ public void onEnable() { @Override public void onDisable() { mode.disable(); - - if (fastTest.isToggled()) { - mc.thePlayer.motionX *= .8; - mc.thePlayer.motionZ *= .8; - } } } diff --git a/src/main/java/keystrokesmod/module/impl/movement/speed/LegitSpeed.java b/src/main/java/keystrokesmod/module/impl/movement/speed/LegitSpeed.java index 1a47f006..79619ebd 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/speed/LegitSpeed.java +++ b/src/main/java/keystrokesmod/module/impl/movement/speed/LegitSpeed.java @@ -1,6 +1,7 @@ package keystrokesmod.module.impl.movement.speed; -import keystrokesmod.event.*; +import keystrokesmod.event.MoveInputEvent; +import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.module.impl.movement.Speed; import keystrokesmod.module.impl.other.RotationHandler; import keystrokesmod.module.setting.impl.ButtonSetting; diff --git a/src/main/java/keystrokesmod/module/impl/movement/speed/VanillaSpeed.java b/src/main/java/keystrokesmod/module/impl/movement/speed/VanillaSpeed.java index 39d5bff3..c2c67088 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/speed/VanillaSpeed.java +++ b/src/main/java/keystrokesmod/module/impl/movement/speed/VanillaSpeed.java @@ -12,13 +12,12 @@ import org.jetbrains.annotations.NotNull; public class VanillaSpeed extends SubMode { + private static boolean warning = false; private final SliderSetting horizonSpeed; private final ButtonSetting autoJump; private final SliderSetting verticalSpeed; private final ButtonSetting fastStop; - private static boolean warning = false; - public VanillaSpeed(String name, @NotNull Speed parent) { super(name, parent); this.registerSetting(horizonSpeed = new SliderSetting("Horizon speed", 1, 0.1, 5, 0.1)); diff --git a/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/HypixelGroundSpeed.java b/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/HypixelGroundSpeed.java index 4576fb35..1524682f 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/HypixelGroundSpeed.java +++ b/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/HypixelGroundSpeed.java @@ -2,11 +2,9 @@ import keystrokesmod.event.PrePlayerInputEvent; import keystrokesmod.module.impl.movement.speed.HypixelSpeed; -import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SubMode; import keystrokesmod.utility.MoveUtil; import keystrokesmod.utility.Utils; -import keystrokesmod.utility.movement.MoveCorrect; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/HypixelLowHopSpeed.java b/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/HypixelLowHopSpeed.java index 27329ecc..6e0f9206 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/HypixelLowHopSpeed.java +++ b/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/HypixelLowHopSpeed.java @@ -3,7 +3,10 @@ import keystrokesmod.module.impl.exploit.disabler.hypixel.HypixelMotionDisabler; import keystrokesmod.module.impl.movement.speed.HypixelSpeed; import keystrokesmod.module.impl.movement.speed.hypixel.lowhop.HypixelLowHopPredictSpeed; -import keystrokesmod.module.setting.impl.*; +import keystrokesmod.module.setting.impl.ButtonSetting; +import keystrokesmod.module.setting.impl.DescriptionSetting; +import keystrokesmod.module.setting.impl.ModeValue; +import keystrokesmod.module.setting.impl.SubMode; import org.jetbrains.annotations.NotNull; /** diff --git a/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/lowhop/HypixelLowHopPredictSpeed.java b/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/lowhop/HypixelLowHopPredictSpeed.java index 0fb1af1a..a8794d55 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/lowhop/HypixelLowHopPredictSpeed.java +++ b/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/lowhop/HypixelLowHopPredictSpeed.java @@ -2,12 +2,9 @@ import keystrokesmod.event.PrePlayerInputEvent; import keystrokesmod.module.impl.movement.speed.hypixel.HypixelLowHopSpeed; -import keystrokesmod.module.impl.other.RotationHandler; -import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SubMode; import keystrokesmod.utility.MoveUtil; import keystrokesmod.utility.Utils; -import net.minecraft.potion.Potion; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/keystrokesmod/module/impl/movement/step/HypixelStep.java b/src/main/java/keystrokesmod/module/impl/movement/step/HypixelStep.java index 63995875..a361800a 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/step/HypixelStep.java +++ b/src/main/java/keystrokesmod/module/impl/movement/step/HypixelStep.java @@ -1,89 +1,80 @@ package keystrokesmod.module.impl.movement.step; -import keystrokesmod.event.MoveEvent; +import it.unimi.dsi.fastutil.doubles.DoubleList; import keystrokesmod.event.PreMotionEvent; -import keystrokesmod.event.SprintEvent; +import keystrokesmod.event.StepEvent; import keystrokesmod.module.impl.movement.Step; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.impl.SubMode; -import keystrokesmod.utility.BlockUtils; import keystrokesmod.utility.MoveUtil; +import keystrokesmod.utility.PacketUtils; import keystrokesmod.utility.Utils; -import net.minecraft.potion.Potion; +import net.minecraft.network.play.client.C03PacketPlayer; +import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -import static keystrokesmod.module.impl.world.tower.HypixelTower.isGoingDiagonally; -import static keystrokesmod.module.impl.world.tower.HypixelTower.randomAmount; +import org.jetbrains.annotations.NotNull; public class HypixelStep extends SubMode { - private final SliderSetting boost = new SliderSetting("Boost", 0, 0, 0.4, 0.1); - private final SliderSetting delay = new SliderSetting("Delay", 0, 0, 5000, 250, "ms"); + public static final DoubleList MOTION = DoubleList.of(.41999998688698, .7531999805212, 1.001335997911214, 1.16610926093821, 1.24918707874468, 1.093955074228084); + + private final SliderSetting delay; + private final SliderSetting tick; - private int offGroundTicks = -1; - private boolean stepping = false; + private State state = State.NONE; + private double x, y, z; private long lastStep = -1; - public HypixelStep(String name, Step parent) { + public HypixelStep(String name, @NotNull Step parent) { super(name, parent); - this.registerSetting(boost, delay); + this.registerSetting(delay = new SliderSetting("Delay", 1000, 0, 5000, 250, "ms")); + this.registerSetting(tick = new SliderSetting("Tick", MOTION.size(), 1, MOTION.size(), 1)); } @Override - public void onDisable() { - offGroundTicks = -1; - stepping = false; + public void onDisable() throws Throwable { + mc.thePlayer.stepHeight = 0.6f; + state = State.NONE; } @SubscribeEvent - public void onPreMotion(PreMotionEvent event) { - final long time = System.currentTimeMillis(); - if (mc.thePlayer.onGround && mc.thePlayer.isCollidedHorizontally && MoveUtil.isMoving() && time - lastStep >= delay.getInput()) { - stepping = true; - lastStep = time; - } - } + public void onStep(@NotNull StepEvent event) { + if (event.getHeight() == 1) { + state = State.BALANCE; + Utils.getTimer().timerSpeed = (float) (1.0 / tick.getInput()); + mc.thePlayer.stepHeight = 0.6f; - @SubscribeEvent - public void onMove(MoveEvent event) { - if (mc.thePlayer.onGround) { - offGroundTicks = 0; - } else if (offGroundTicks != -1) { - offGroundTicks++; + x = mc.thePlayer.lastTickPosX; + y = mc.thePlayer.posY; + z = mc.thePlayer.lastTickPosZ; + lastStep = System.currentTimeMillis(); } + } - if (stepping) { - if (!MoveUtil.isMoving() || Utils.jumpDown() || (!mc.thePlayer.isCollidedHorizontally && offGroundTicks > 5)) { - stepping = false; - return; - } - - if (mc.thePlayer.isPotionActive(Potion.jump)) return; - final boolean airUnder = !BlockUtils.insideBlock( - mc.thePlayer.getEntityBoundingBox() - .offset(0, -1, 0) - .expand(0.239, 0, 0.239) - );; - final float speed = isGoingDiagonally(0.1) ? 0.22F : 0.29888888F; + @SubscribeEvent(priority = EventPriority.LOW) + public void onPreMotion(PreMotionEvent event) { + if (System.currentTimeMillis() - lastStep > delay.getInput()) + mc.thePlayer.stepHeight = 1; - switch (offGroundTicks) { - case 0: - event.setY(mc.thePlayer.motionY = 0.4198479950428009); - MoveUtil.strafe(speed - randomAmount()); - break; - case 5: - if (mc.thePlayer.isCollidedHorizontally || !BlockUtils.blockRelativeToPlayer(0, -1, 0).isFullCube()) - return; - MoveUtil.moveFlying(boost.getInput()); - mc.thePlayer.motionY = MoveUtil.predictedMotion(mc.thePlayer.motionY, 2); - break; - } + switch (state) { + case BALANCE: + event.setCanceled(true); + MoveUtil.stop(); + state = State.STEP; + break; + case STEP: + for (double motion : MOTION) { + PacketUtils.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(x, y + motion, z, false)); + } + MoveUtil.stop(); + Utils.resetTimer(); + state = State.NONE; + break; } } - @SubscribeEvent - public void onSprint(SprintEvent event) { - if (stepping) { - event.setOmni(true); - } + private enum State { + NONE, + BALANCE, + STEP } } diff --git a/src/main/java/keystrokesmod/module/impl/movement/teleport/HypixelTeleport.java b/src/main/java/keystrokesmod/module/impl/movement/teleport/HypixelTeleport.java index 28da3903..19ac705a 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/teleport/HypixelTeleport.java +++ b/src/main/java/keystrokesmod/module/impl/movement/teleport/HypixelTeleport.java @@ -19,10 +19,10 @@ import java.util.concurrent.ConcurrentLinkedQueue; public class HypixelTeleport extends SubMode { + private final Queue> delayedPackets = new ConcurrentLinkedQueue<>(); private State state = State.NONE; private int hasLag = 0; private int timerTicks = -1; - private final Queue> delayedPackets = new ConcurrentLinkedQueue<>(); private float yaw, pitch; public HypixelTeleport(String name, @NotNull Teleport parent) { diff --git a/src/main/java/keystrokesmod/module/impl/other/Anticheat.java b/src/main/java/keystrokesmod/module/impl/other/Anticheat.java index 56376e62..d1807ebf 100644 --- a/src/main/java/keystrokesmod/module/impl/other/Anticheat.java +++ b/src/main/java/keystrokesmod/module/impl/other/Anticheat.java @@ -50,6 +50,7 @@ public class Anticheat extends Module { private static ButtonSetting simulationCheck; private PlayerManager manager = new PlayerManager(); + public Anticheat() { super("Anticheat", category.other); this.registerSetting(new DescriptionSetting("Tries to detect cheaters.")); diff --git a/src/main/java/keystrokesmod/module/impl/other/AutoPlay.java b/src/main/java/keystrokesmod/module/impl/other/AutoPlay.java index 379323ae..3591af33 100644 --- a/src/main/java/keystrokesmod/module/impl/other/AutoPlay.java +++ b/src/main/java/keystrokesmod/module/impl/other/AutoPlay.java @@ -15,13 +15,13 @@ import java.util.concurrent.TimeUnit; public class AutoPlay extends Module { - private final ModeSetting mode; - private final SliderSetting delay; private static final String SkywarsWinMessage = "You won! Want to play again? Click here!"; private static final String SkywarsLoseMessage = "You died! Want to play again? Click here!"; private static final String BedwarsWinMessage = "This game has been recorded. Click here to watch the Replay!"; private static final String BedwarsLoseMessage = "You have been eliminated!"; private static final String DuelWinMessage = "YOU WON! Want to play again? CLICK HERE!"; + private final ModeSetting mode; + private final SliderSetting delay; public AutoPlay() { super("AutoPlay", category.other); @@ -33,12 +33,12 @@ public AutoPlay() { @SubscribeEvent public void onReceive(@NotNull ReceivePacketEvent event) { if (event.getPacket() instanceof S02PacketChat) { - S02PacketChat packet = (S02PacketChat)event.getPacket(); + S02PacketChat packet = (S02PacketChat) event.getPacket(); String message = packet.getChatComponent().getUnformattedText(); if (message.contains(SkywarsWinMessage) && message.length() < SkywarsWinMessage.length() + 3 || message.contains(SkywarsLoseMessage) && message.length() < SkywarsLoseMessage.length() + 3 - || message.contains(BedwarsWinMessage) && message.length() < BedwarsWinMessage.length() + 3 - || message.contains(BedwarsLoseMessage) && message.length() < BedwarsLoseMessage.length() + 3) { + || message.contains(BedwarsWinMessage) && message.length() < BedwarsWinMessage.length() + 3 + || message.contains(BedwarsLoseMessage) && message.length() < BedwarsLoseMessage.length() + 3) { Utils.sendModuleMessage(this, "Sending you to a new game."); Raven.getExecutor().schedule(() -> { @@ -46,36 +46,36 @@ public void onReceive(@NotNull ReceivePacketEvent event) { String command = ""; switch ((int) this.mode.getInput()) { // list of commands comes from https://hypixel.net/threads/guide-play-commands-useful-tools-mods-more-new-pixel-party-play-command.1025608/ - case 0: + case 0: command = "/play solo_normal"; break; case 1: command = "/play solo_insane"; break; - case 2: - command = "/play teams_normal"; - break; - case 3: - command = "/play teams_insane"; - break; - case 4: - command = "/play bedwars_eight_one"; - break; - case 5: - command = "/play bedwars_eight_two"; - break; - case 6: - command = "/play bedwars_four_three"; - break; - case 7: - command = "/play bedwars_four_four"; - break; - case 8: - command = "/play bedwars_two_four"; - break; - default: + case 2: + command = "/play teams_normal"; + break; + case 3: + command = "/play teams_insane"; + break; + case 4: + command = "/play bedwars_eight_one"; + break; + case 5: + command = "/play bedwars_eight_two"; + break; + case 6: + command = "/play bedwars_four_three"; + break; + case 7: + command = "/play bedwars_four_four"; + break; + case 8: + command = "/play bedwars_two_four"; + break; + default: command = "/play solo_normal"; - break; + break; } mc.thePlayer.sendChatMessage(command); }, (long) (delay.getInput() * 1000), TimeUnit.MILLISECONDS); diff --git a/src/main/java/keystrokesmod/module/impl/other/AutoRegister.java b/src/main/java/keystrokesmod/module/impl/other/AutoRegister.java index 4bd6ce61..f6eaee6c 100644 --- a/src/main/java/keystrokesmod/module/impl/other/AutoRegister.java +++ b/src/main/java/keystrokesmod/module/impl/other/AutoRegister.java @@ -31,6 +31,31 @@ public AutoRegister() { this.registerSetting(maxDelay = new SliderSetting("Max delay", 3000, 0, 5000, 500)); } + public static @NotNull String generatePassword(@NotNull String gameId) { + final MessageDigest digest; + try { + digest = MessageDigest.getInstance("SHA-256"); + } catch (NoSuchAlgorithmException e) { + Utils.sendMessage("Your environment doesn't support this."); + throw new RuntimeException(e); + } + byte[] hashBytes = digest.digest(gameId.getBytes()); + + final StringBuilder passwordBuilder = new StringBuilder(); + + for (byte b : hashBytes) { + int value = b & 0xFF; + char selectedChar = CHARS[value % CHARS.length]; + passwordBuilder.append(selectedChar); + + if (passwordBuilder.length() >= 12) { + break; + } + } + + return passwordBuilder.toString(); + } + @SubscribeEvent public void onReceivePacket(@NotNull ReceivePacketEvent event) { if (event.getPacket() instanceof S02PacketChat) { @@ -62,29 +87,4 @@ private void handle(boolean register) { PacketUtils.sendPacket(new C01PacketChatMessage(text)); }, time, TimeUnit.MILLISECONDS); } - - public static @NotNull String generatePassword(@NotNull String gameId) { - final MessageDigest digest; - try { - digest = MessageDigest.getInstance("SHA-256"); - } catch (NoSuchAlgorithmException e) { - Utils.sendMessage("Your environment doesn't support this."); - throw new RuntimeException(e); - } - byte[] hashBytes = digest.digest(gameId.getBytes()); - - final StringBuilder passwordBuilder = new StringBuilder(); - - for (byte b : hashBytes) { - int value = b & 0xFF; - char selectedChar = CHARS[value % CHARS.length]; - passwordBuilder.append(selectedChar); - - if (passwordBuilder.length() >= 12) { - break; - } - } - - return passwordBuilder.toString(); - } } diff --git a/src/main/java/keystrokesmod/module/impl/other/AutoRespawn.java b/src/main/java/keystrokesmod/module/impl/other/AutoRespawn.java index fcd6250a..6b223df4 100644 --- a/src/main/java/keystrokesmod/module/impl/other/AutoRespawn.java +++ b/src/main/java/keystrokesmod/module/impl/other/AutoRespawn.java @@ -2,30 +2,34 @@ import keystrokesmod.Raven; import keystrokesmod.event.ReceivePacketEvent; -import java.util.concurrent.TimeUnit; import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.DescriptionSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.PacketUtils; import net.minecraft.client.Minecraft; import net.minecraft.network.play.client.C16PacketClientStatus; -import org.jetbrains.annotations.NotNull; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.jetbrains.annotations.NotNull; + +import java.util.concurrent.TimeUnit; -public class AutoRespawn extends Module{ +public class AutoRespawn extends Module { private final SliderSetting delay; + public AutoRespawn() { super("AutoRespawn", category.other); this.registerSetting(new DescriptionSetting("Automatically respawns you after you die.")); this.registerSetting(delay = new SliderSetting("Delay (ms)", 0, 0, 100000, 1000)); } - @SubscribeEvent + + @SubscribeEvent public void onReceive(@NotNull ReceivePacketEvent event) { - if(Minecraft.getMinecraft().thePlayer.isDead){ + if (Minecraft.getMinecraft().thePlayer.isDead) { Raven.getExecutor().schedule(() -> - PacketUtils.sendPacketNoEvent(new C16PacketClientStatus(C16PacketClientStatus.EnumState.PERFORM_RESPAWN)), - (long) delay.getInput(), - TimeUnit.MILLISECONDS); + PacketUtils.sendPacketNoEvent(new C16PacketClientStatus(C16PacketClientStatus.EnumState.PERFORM_RESPAWN)), + (long) delay.getInput(), + TimeUnit.MILLISECONDS); } - }; + } + } diff --git a/src/main/java/keystrokesmod/module/impl/other/BedProximityAlert.java b/src/main/java/keystrokesmod/module/impl/other/BedProximityAlert.java index 52bedf45..3e28d1b4 100644 --- a/src/main/java/keystrokesmod/module/impl/other/BedProximityAlert.java +++ b/src/main/java/keystrokesmod/module/impl/other/BedProximityAlert.java @@ -45,10 +45,10 @@ public void onPlayerTick(PlayerTickEvent event) { continue; } if (ignoreTeammates.isToggled()) { - if (Utils.isTeamMate(otherPlayer)){ + if (Utils.isTeamMate(otherPlayer)) { return; } - } + } double distance = otherPlayer.getDistance(spawnPos.getX(), spawnPos.getY(), spawnPos.getZ()); String playerName = otherPlayer.getDisplayName().getFormattedText(); @@ -71,6 +71,7 @@ private void ping() { mc.thePlayer.playSound("note.pling", 1.0f, 1.0f); } } + public void informTeam(String playerName, int distance) { if (tellTheteam.isToggled()) { mc.thePlayer.sendChatMessage(Utils.getUnformatedString(playerName + " is " + distance + " blocks away from the bed!")); diff --git a/src/main/java/keystrokesmod/module/impl/other/ClickRecorder.java b/src/main/java/keystrokesmod/module/impl/other/ClickRecorder.java index bf536302..7b7eab00 100644 --- a/src/main/java/keystrokesmod/module/impl/other/ClickRecorder.java +++ b/src/main/java/keystrokesmod/module/impl/other/ClickRecorder.java @@ -16,9 +16,8 @@ public class ClickRecorder extends Module { private final ButtonSetting showMessage; - - private long lastClick = -1; private final List delays = new ArrayList<>(); + private long lastClick = -1; public ClickRecorder() { super("ClickRecorder", category.other); diff --git a/src/main/java/keystrokesmod/module/impl/other/FakeChat.java b/src/main/java/keystrokesmod/module/impl/other/FakeChat.java index ac09bd69..8f7ebcb3 100644 --- a/src/main/java/keystrokesmod/module/impl/other/FakeChat.java +++ b/src/main/java/keystrokesmod/module/impl/other/FakeChat.java @@ -6,10 +6,10 @@ import net.minecraft.util.ChatComponentText; public class FakeChat extends Module { - public static DescriptionSetting a; - public static String msg = "&eThis is a fake chat message."; public static final String command = "fakechat"; public static final String c4 = "&cInvalid message."; + public static DescriptionSetting a; + public static String msg = "&eThis is a fake chat message."; public FakeChat() { super("Fake Chat", Module.category.other, 0); diff --git a/src/main/java/keystrokesmod/module/impl/other/LatencyAlerts.java b/src/main/java/keystrokesmod/module/impl/other/LatencyAlerts.java index f892d9c9..a4dc22e8 100644 --- a/src/main/java/keystrokesmod/module/impl/other/LatencyAlerts.java +++ b/src/main/java/keystrokesmod/module/impl/other/LatencyAlerts.java @@ -10,10 +10,10 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class LatencyAlerts extends Module { - private final SliderSetting minLatency; - private long lastPacket; @Getter private static boolean freeze = false; + private final SliderSetting minLatency; + private long lastPacket; public LatencyAlerts() { super("Latency Alerts", category.other); @@ -40,7 +40,7 @@ public void onUpdate() { freeze = true; mc.ingameGUI.setRecordPlaying( "§7Packet loss has exceeded: §c" + (System.currentTimeMillis() - lastPacket) + "§7ms", - false); + false); } } diff --git a/src/main/java/keystrokesmod/module/impl/other/NameHider.java b/src/main/java/keystrokesmod/module/impl/other/NameHider.java index 83dab950..d1b4a806 100644 --- a/src/main/java/keystrokesmod/module/impl/other/NameHider.java +++ b/src/main/java/keystrokesmod/module/impl/other/NameHider.java @@ -28,8 +28,7 @@ public static String getFakeName(String s) { } s = s.replace(networkPlayerInfo.getGameProfile().getName(), n); } - } - else { + } else { s = s.replace(Utils.getServerName(), n); } } diff --git a/src/main/java/keystrokesmod/module/impl/other/Panic.java b/src/main/java/keystrokesmod/module/impl/other/Panic.java index 7529787c..8782bd95 100644 --- a/src/main/java/keystrokesmod/module/impl/other/Panic.java +++ b/src/main/java/keystrokesmod/module/impl/other/Panic.java @@ -3,6 +3,7 @@ import keystrokesmod.Raven; import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.DescriptionSetting; + import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/keystrokesmod/module/impl/other/RecordClick.java b/src/main/java/keystrokesmod/module/impl/other/RecordClick.java index 0ed01627..cf3aa849 100644 --- a/src/main/java/keystrokesmod/module/impl/other/RecordClick.java +++ b/src/main/java/keystrokesmod/module/impl/other/RecordClick.java @@ -12,19 +12,20 @@ import java.io.File; import java.io.FileReader; import java.io.FileWriter; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; public final class RecordClick extends Module { + public static String[] LOADED_PATTERNS_NAMES = new String[]{Pattern.DEFAULT.getName(), Pattern.VAPE.getName()}; private static File directory; private static List LOADED_PATTERNS = new ArrayList<>(Arrays.asList(Pattern.DEFAULT, Pattern.VAPE)); - public static String[] LOADED_PATTERNS_NAMES = new String[]{Pattern.DEFAULT.getName(), Pattern.VAPE.getName()}; - private static ModeSetting currentPattern; - private int lastPattern = 0; - private static Pattern pattern = Pattern.DEFAULT; private static int index = 0; private static long lastClick = -1; + private int lastPattern = 0; public RecordClick() { super("RecordClick", category.other); @@ -44,14 +45,6 @@ public RecordClick() { loadPatterns(); } - @Override - public void onUpdate() { - if (lastPattern != (int) currentPattern.getInput()) { - reset(); - } - lastPattern = (int) currentPattern.getInput(); - } - public static void click() { lastClick = System.currentTimeMillis(); index++; @@ -158,5 +151,13 @@ public static void savePattern(@NotNull Pattern pattern) { } } + @Override + public void onUpdate() { + if (lastPattern != (int) currentPattern.getInput()) { + reset(); + } + lastPattern = (int) currentPattern.getInput(); + } + } diff --git a/src/main/java/keystrokesmod/module/impl/other/RotationHandler.java b/src/main/java/keystrokesmod/module/impl/other/RotationHandler.java index dd75879a..9761af52 100644 --- a/src/main/java/keystrokesmod/module/impl/other/RotationHandler.java +++ b/src/main/java/keystrokesmod/module/impl/other/RotationHandler.java @@ -11,9 +11,9 @@ import keystrokesmod.module.setting.impl.ModeSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.utils.ModeOnly; -import keystrokesmod.utility.aim.AimSimulator; import keystrokesmod.utility.MoveUtil; import keystrokesmod.utility.RotationUtils; +import keystrokesmod.utility.aim.AimSimulator; import lombok.Getter; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.Entity; @@ -28,6 +28,10 @@ import java.util.Arrays; public final class RotationHandler extends Module { + public static final ButtonSetting rotateBody = new ButtonSetting("Rotate body", true); + public static final ButtonSetting fullBody = new ButtonSetting("Full body", false); + public static final SliderSetting randomYawFactor = new SliderSetting("Random yaw factor", 1.0, 0.0, 10.0, 1.0); + private static final ModeSetting defaultMoveFix = new ModeSetting("Default MoveFix", new String[]{"None", "Silent", "Strict"}, 0); private static @Nullable Float movementYaw = null; private static @Nullable Float rotationYaw = null; @Getter @@ -38,13 +42,8 @@ public final class RotationHandler extends Module { @Getter private static boolean isSet = false; private static MoveFix moveFix = MoveFix.None; - - private static final ModeSetting defaultMoveFix = new ModeSetting("Default MoveFix", new String[]{"None", "Silent", "Strict"}, 0); private final ModeSetting smoothBack = new ModeSetting("Smooth back", new String[]{"None", "Default"}, 0); private final SliderSetting aimSpeed = new SliderSetting("Aim speed", 5, 1, 15, 0.1, new ModeOnly(smoothBack, 1)); - public static final ButtonSetting rotateBody = new ButtonSetting("Rotate body", true); - public static final ButtonSetting fullBody = new ButtonSetting("Full body", false); - public static final SliderSetting randomYawFactor = new SliderSetting("Random yaw factor", 1.0, 0.0, 10.0, 1.0); public RotationHandler() { super("RotationHandler", category.other); @@ -65,36 +64,28 @@ public static void setMovementYaw(float movementYaw) { RotationHandler.movementYaw = movementYaw; } - public static void setRotationYaw(float rotationYaw) { - if (AimSimulator.yawEquals(rotationYaw, mc.thePlayer.rotationYaw)) { - RotationHandler.rotationYaw = null; - return; - } - RotationHandler.rotationYaw = rotationYaw; - } - - public static void setRotationPitch(float rotationPitch) { - if (rotationPitch == mc.thePlayer.rotationPitch) { - RotationHandler.rotationPitch = null; - return; - } - RotationHandler.rotationPitch = rotationPitch; - } - - public static void setMoveFix(MoveFix moveFix) { - RotationHandler.moveFix = moveFix; - } - public static MoveFix getMoveFix() { if (moveFix != null) return moveFix; return MoveFix.values()[(int) defaultMoveFix.getInput()]; } + public static void setMoveFix(MoveFix moveFix) { + RotationHandler.moveFix = moveFix; + } + public static float getRotationYaw() { return getRotationYaw(mc.thePlayer.rotationYaw); } + public static void setRotationYaw(float rotationYaw) { + if (AimSimulator.yawEquals(rotationYaw, mc.thePlayer.rotationYaw)) { + RotationHandler.rotationYaw = null; + return; + } + RotationHandler.rotationYaw = rotationYaw; + } + public static float getRotationYaw(float yaw) { if (rotationYaw != null) return rotationYaw; @@ -105,6 +96,14 @@ public static float getRotationPitch() { return getRotationPitch(mc.thePlayer.rotationPitch); } + public static void setRotationPitch(float rotationPitch) { + if (rotationPitch == mc.thePlayer.rotationPitch) { + RotationHandler.rotationPitch = null; + return; + } + RotationHandler.rotationPitch = rotationPitch; + } + public static float getRotationPitch(float pitch) { if (rotationPitch != null) return rotationPitch; @@ -159,6 +158,7 @@ public void onPreUpdate(PreUpdateEvent event) { /** * Fix movement + * * @param event before update living entity (move) */ @SubscribeEvent(priority = EventPriority.HIGHEST) diff --git a/src/main/java/keystrokesmod/module/impl/other/ScreenshotHelper.java b/src/main/java/keystrokesmod/module/impl/other/ScreenshotHelper.java index 7b06a72a..448d7b8f 100644 --- a/src/main/java/keystrokesmod/module/impl/other/ScreenshotHelper.java +++ b/src/main/java/keystrokesmod/module/impl/other/ScreenshotHelper.java @@ -23,7 +23,7 @@ public class ScreenshotHelper extends Module { private static final String DuelWinMessage = "YOU WON! Want to play again? CLICK HERE!"; private final SliderSetting delay; -// private static final ButtonSetting AntiLag = new ButtonSetting("Anti Lag", true); // Unfinished, but you can use the Essential mod to take Anti-Lag screenshots. + // private static final ButtonSetting AntiLag = new ButtonSetting("Anti Lag", true); // Unfinished, but you can use the Essential mod to take Anti-Lag screenshots. private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); public ScreenshotHelper() { diff --git a/src/main/java/keystrokesmod/module/impl/other/SlotHandler.java b/src/main/java/keystrokesmod/module/impl/other/SlotHandler.java index 585cfa1d..45bd414d 100644 --- a/src/main/java/keystrokesmod/module/impl/other/SlotHandler.java +++ b/src/main/java/keystrokesmod/module/impl/other/SlotHandler.java @@ -6,18 +6,20 @@ import keystrokesmod.module.setting.impl.ModeSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.utils.ModeOnly; +import keystrokesmod.utility.CoolDown; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.Nullable; +import java.util.concurrent.atomic.AtomicInteger; + public final class SlotHandler extends Module { + private static final AtomicInteger currentSlot = new AtomicInteger(-1); + private static final CoolDown coolDown = new CoolDown(-1); private final ModeSetting mode = new ModeSetting("Mode", new String[]{"Default", "Silent"}, 0); - private final SliderSetting switchBackDelay = new SliderSetting("Switch back delay", 100, 0, 1000, 10, "ms", new ModeOnly(mode, 1)); - - private static @Nullable Integer currentSlot = null; - private static long lastSetCurrentSlotTime = -1; + private final SliderSetting switchBackDelay = new SliderSetting("Switch back delay", 100, 50, 1000, 10, "ms", new ModeOnly(mode, 1)); public SlotHandler() { super("SlotHandler", category.other); @@ -26,15 +28,22 @@ public SlotHandler() { } public static int getCurrentSlot() { - if (currentSlot != null) - return currentSlot; + if (isSilentSlot()) + return currentSlot.get(); return mc.thePlayer.inventory.currentItem; } + public static void setCurrentSlot(int slot) { + if (slot >= 0 && slot < 9) { + currentSlot.set(slot); + coolDown.start(); + } + } + public static @Nullable ItemStack getHeldItem() { final InventoryPlayer inventory = mc.thePlayer.inventory; - if (currentSlot != null) - return currentSlot < 9 && currentSlot >= 0 ? inventory.mainInventory[currentSlot] : null; + if (isSilentSlot()) + return inventory.mainInventory[currentSlot.get()]; return getRenderHeldItem(); } @@ -43,11 +52,12 @@ public static int getCurrentSlot() { return inventory.currentItem < 9 && inventory.currentItem >= 0 ? inventory.mainInventory[inventory.currentItem] : null; } - public static void setCurrentSlot(int slot) { - if (slot > 0 && slot < 9) { - currentSlot = slot; - lastSetCurrentSlotTime = System.currentTimeMillis(); - } + public static boolean isSilentSlot() { + return currentSlot.get() != -1; + } + + public static void resetSlot() { + currentSlot.set(-1); } @SubscribeEvent(priority = EventPriority.LOWEST) @@ -55,13 +65,14 @@ public void onPreUpdate(PreUpdateEvent event) { switch ((int) mode.getInput()) { case 0: mc.thePlayer.inventory.currentItem = getCurrentSlot(); - currentSlot = null; + resetSlot(); break; case 1: - if (currentSlot != null + coolDown.setCooldown((long) switchBackDelay.getInput()); + if (isSilentSlot() && !((PlayerControllerMPAccessor) mc.playerController).isHittingBlock() - && System.currentTimeMillis() - lastSetCurrentSlotTime > switchBackDelay.getInput()) - currentSlot = null; + && coolDown.hasFinished()) + resetSlot(); break; } } diff --git a/src/main/java/keystrokesmod/module/impl/other/ViewPackets.java b/src/main/java/keystrokesmod/module/impl/other/ViewPackets.java index e786ec6d..dda2cd75 100644 --- a/src/main/java/keystrokesmod/module/impl/other/ViewPackets.java +++ b/src/main/java/keystrokesmod/module/impl/other/ViewPackets.java @@ -14,14 +14,14 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; public class ViewPackets extends Module { - private ButtonSetting includeCancelled; - private ButtonSetting singlePlayer; - private ButtonSetting sent; - private ButtonSetting ignoreC00; - private ButtonSetting ignoreC03; - private ButtonSetting compactC03; - private ButtonSetting ignoreC0F; - private ButtonSetting received; + private final ButtonSetting includeCancelled; + private final ButtonSetting singlePlayer; + private final ButtonSetting sent; + private final ButtonSetting ignoreC00; + private final ButtonSetting ignoreC03; + private final ButtonSetting compactC03; + private final ButtonSetting ignoreC0F; + private final ButtonSetting received; private Packet packet; private long tick; @@ -37,15 +37,19 @@ public ViewPackets() { this.registerSetting(received = new ButtonSetting("Received", false)); } + private static String formatBoolean(final boolean b) { + return b ? "&atrue" : "&cfalse"; + } + + private static double round(final double n) { + return Utils.rnd(n, 3); + } + public void onDisable() { packet = null; tick = 0; } - private static String formatBoolean(final boolean b) { - return b ? "&atrue" : "&cfalse"; - } - private void sendMessage(final Packet packet, final boolean b) { if (!Utils.nullCheck()) { return; @@ -55,7 +59,7 @@ private void sendMessage(final Packet packet, final boolean b) { final ChatComponentText chatComponentText = new ChatComponentText(Utils.formatColor("&7[&dR&7]&r &7" + (b ? "Received" : "Sent") + " packet (t:&b" + tick + "&7): ")); final ChatStyle chatStyle = new ChatStyle(); chatStyle.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(Utils.formatColor(s)))); - ((IChatComponent)chatComponentText).appendSibling(new ChatComponentText(Utils.formatColor(string)).setChatStyle(chatStyle)); + ((IChatComponent) chatComponentText).appendSibling(new ChatComponentText(Utils.formatColor(string)).setChatStyle(chatStyle)); mc.thePlayer.addChatMessage(chatComponentText); } @@ -96,72 +100,54 @@ public void onReceivePacket(ReceivePacketEvent e) { private String applyInfo(final Packet packet) { String s = "&a" + packet.getClass().getSimpleName(); if (packet instanceof C07PacketPlayerDigging) { - final C07PacketPlayerDigging c07PacketPlayerDigging = (C07PacketPlayerDigging)packet; + final C07PacketPlayerDigging c07PacketPlayerDigging = (C07PacketPlayerDigging) packet; final String string = s + "\n&7Status: &b" + c07PacketPlayerDigging.getStatus().name() + "\n&7Facing: &b" + c07PacketPlayerDigging.getFacing().name(); final BlockPos getPosition = c07PacketPlayerDigging.getPosition(); s = string + "\n&7Position: &b" + getPosition.getX() + "&7, &b" + getPosition.getY() + "&7, &b" + getPosition.getZ(); - } - else if (packet instanceof C09PacketHeldItemChange) { - s = s + "\n&7Swap to slot: &b" + ((C09PacketHeldItemChange)packet).getSlotId(); - } - else if (packet instanceof C0BPacketEntityAction) { - s = s + "\n&7Action: &b" + ((C0BPacketEntityAction)packet).getAction().name() + "\n&7Aux data: &b" + ((C0BPacketEntityAction)packet).getAuxData(); - } - else if (packet instanceof C08PacketPlayerBlockPlacement) { - final C08PacketPlayerBlockPlacement c08PacketPlayerBlockPlacement = (C08PacketPlayerBlockPlacement)packet; + } else if (packet instanceof C09PacketHeldItemChange) { + s = s + "\n&7Swap to slot: &b" + ((C09PacketHeldItemChange) packet).getSlotId(); + } else if (packet instanceof C0BPacketEntityAction) { + s = s + "\n&7Action: &b" + ((C0BPacketEntityAction) packet).getAction().name() + "\n&7Aux data: &b" + ((C0BPacketEntityAction) packet).getAuxData(); + } else if (packet instanceof C08PacketPlayerBlockPlacement) { + final C08PacketPlayerBlockPlacement c08PacketPlayerBlockPlacement = (C08PacketPlayerBlockPlacement) packet; final String string2 = s + "\n&7Item: &b" + ((c08PacketPlayerBlockPlacement.getStack() == null) ? "null" : c08PacketPlayerBlockPlacement.getStack().getItem().getRegistryName().replace("minecraft:", "")) + "\n&7Direction: &b" + c08PacketPlayerBlockPlacement.getPlacedBlockDirection(); final BlockPos getPosition = c08PacketPlayerBlockPlacement.getPosition(); - s = string2 + "\n&7Position: &b" + getPosition.getX() + "&7, &b" + getPosition.getY() + "&7, &b" + getPosition.getZ() + "\n&7Offset: &b" + round((double)c08PacketPlayerBlockPlacement.getPlacedBlockOffsetX()) + "&7, &b" + round((double)c08PacketPlayerBlockPlacement.getPlacedBlockOffsetY()) + "&7, &b" + round(c08PacketPlayerBlockPlacement.getPlacedBlockOffsetZ()); - } - else if (packet instanceof C02PacketUseEntity) { - final C02PacketUseEntity c02PacketUseEntity = (C02PacketUseEntity)packet; + s = string2 + "\n&7Position: &b" + getPosition.getX() + "&7, &b" + getPosition.getY() + "&7, &b" + getPosition.getZ() + "\n&7Offset: &b" + round(c08PacketPlayerBlockPlacement.getPlacedBlockOffsetX()) + "&7, &b" + round(c08PacketPlayerBlockPlacement.getPlacedBlockOffsetY()) + "&7, &b" + round(c08PacketPlayerBlockPlacement.getPlacedBlockOffsetZ()); + } else if (packet instanceof C02PacketUseEntity) { + final C02PacketUseEntity c02PacketUseEntity = (C02PacketUseEntity) packet; final String string3 = s + "\n&7Action: &b" + c02PacketUseEntity.getAction().name(); final Entity getEntityFromWorld = c02PacketUseEntity.getEntityFromWorld(mc.theWorld); final String string4 = string3 + "\n&7Target: &b" + ((getEntityFromWorld == null) ? "null" : getEntityFromWorld.getName()); final Vec3 getHitVec = c02PacketUseEntity.getHitVec(); if (getHitVec == null) { s = string4 + "\n&7Hit vec: &bnull"; - } - else { + } else { s = string4 + "\n&7Hit vec: &b" + round(getHitVec.xCoord) + "&7, &b" + round(getHitVec.yCoord) + "&7, &b" + round(getHitVec.zCoord); } - } - else if (packet instanceof C01PacketChatMessage) { - s = s + "\n&7Length: &b" + ((C01PacketChatMessage)packet).getMessage().length(); - } - else if (packet instanceof C17PacketCustomPayload) { - s = s + "\n&7Channel: &b" + ((C17PacketCustomPayload)packet).getChannelName(); - } - else if (packet instanceof C15PacketClientSettings) { - s = s + "\n&7Language: &b" + ((C15PacketClientSettings)packet).getLang() + "\n&7Chat visibility: &b" + ((C15PacketClientSettings)packet).getChatVisibility().name(); - } - else if (packet instanceof C00PacketKeepAlive) { - s = s + "\n&7Key: &b" + ((C00PacketKeepAlive)packet).getKey(); - } - else if (packet instanceof C16PacketClientStatus) { - s = s + "\n&7Status: &b" + ((C16PacketClientStatus)packet).getStatus().name(); - } - else if (packet instanceof C10PacketCreativeInventoryAction) { - s = s + "\n&7Slot: &b" + ((C10PacketCreativeInventoryAction)packet).getSlotId() + "\n&7Item: &b" + ((((C10PacketCreativeInventoryAction)packet).getStack() == null) ? "null" : ((C10PacketCreativeInventoryAction)packet).getStack().getItem().getRegistryName().replace("minecraft:", "")); - } - else if (packet instanceof C0EPacketClickWindow) { - final C0EPacketClickWindow c0EPacketClickWindow = (C0EPacketClickWindow)packet; + } else if (packet instanceof C01PacketChatMessage) { + s = s + "\n&7Length: &b" + ((C01PacketChatMessage) packet).getMessage().length(); + } else if (packet instanceof C17PacketCustomPayload) { + s = s + "\n&7Channel: &b" + ((C17PacketCustomPayload) packet).getChannelName(); + } else if (packet instanceof C15PacketClientSettings) { + s = s + "\n&7Language: &b" + ((C15PacketClientSettings) packet).getLang() + "\n&7Chat visibility: &b" + ((C15PacketClientSettings) packet).getChatVisibility().name(); + } else if (packet instanceof C00PacketKeepAlive) { + s = s + "\n&7Key: &b" + ((C00PacketKeepAlive) packet).getKey(); + } else if (packet instanceof C16PacketClientStatus) { + s = s + "\n&7Status: &b" + ((C16PacketClientStatus) packet).getStatus().name(); + } else if (packet instanceof C10PacketCreativeInventoryAction) { + s = s + "\n&7Slot: &b" + ((C10PacketCreativeInventoryAction) packet).getSlotId() + "\n&7Item: &b" + ((((C10PacketCreativeInventoryAction) packet).getStack() == null) ? "null" : ((C10PacketCreativeInventoryAction) packet).getStack().getItem().getRegistryName().replace("minecraft:", "")); + } else if (packet instanceof C0EPacketClickWindow) { + final C0EPacketClickWindow c0EPacketClickWindow = (C0EPacketClickWindow) packet; s = s + "\n&7Window: &b" + c0EPacketClickWindow.getWindowId() + "\n&7Slot: &b" + c0EPacketClickWindow.getSlotId() + "\n&7Button: &b" + c0EPacketClickWindow.getUsedButton() + "\n&7Action: &b" + c0EPacketClickWindow.getActionNumber() + "\n&7Mode: &b" + c0EPacketClickWindow.getMode() + "\n&7Item: &b" + ((c0EPacketClickWindow.getClickedItem() == null) ? "null" : c0EPacketClickWindow.getClickedItem().getItem().getRegistryName().replace("minecraft:", "")); - } - else if (packet instanceof C0FPacketConfirmTransaction) { - s = s + "\n&7Window: &b" + ((C0FPacketConfirmTransaction)packet).getWindowId() + "\n&7Uid: &b" + ((C0FPacketConfirmTransaction)packet).getUid(); - } - else if (packet instanceof C03PacketPlayer) { - final C03PacketPlayer c03PacketPlayer = (C03PacketPlayer)packet; - s = s + "\n&7Position: &b" + round(c03PacketPlayer.getPositionX()) + "&7, &b" + round(c03PacketPlayer.getPositionY()) + "&7, &b" + round(c03PacketPlayer.getPositionZ()) + "\n&7Rotations: &b" + round((double)c03PacketPlayer.getYaw()) + "&7, &b" + round((double)c03PacketPlayer.getPitch()) + "\n&7Ground: " + formatBoolean(c03PacketPlayer.isOnGround()) + "\n&7Moving: " + formatBoolean(c03PacketPlayer.isMoving()) + "\n&7Rotating: " + formatBoolean(c03PacketPlayer.getRotating()); + } else if (packet instanceof C0FPacketConfirmTransaction) { + s = s + "\n&7Window: &b" + ((C0FPacketConfirmTransaction) packet).getWindowId() + "\n&7Uid: &b" + ((C0FPacketConfirmTransaction) packet).getUid(); + } else if (packet instanceof C03PacketPlayer) { + final C03PacketPlayer c03PacketPlayer = (C03PacketPlayer) packet; + s = s + "\n&7Position: &b" + round(c03PacketPlayer.getPositionX()) + "&7, &b" + round(c03PacketPlayer.getPositionY()) + "&7, &b" + round(c03PacketPlayer.getPositionZ()) + "\n&7Rotations: &b" + round(c03PacketPlayer.getYaw()) + "&7, &b" + round(c03PacketPlayer.getPitch()) + "\n&7Ground: " + formatBoolean(c03PacketPlayer.isOnGround()) + "\n&7Moving: " + formatBoolean(c03PacketPlayer.isMoving()) + "\n&7Rotating: " + formatBoolean(c03PacketPlayer.getRotating()); } return s + "\n&7Client tick: &e" + tick; } - private static double round(final double n) { - return Utils.rnd(n, 3); - } - @SubscribeEvent public void onTick(TickEvent.ClientTickEvent e) { if (e.phase == TickEvent.Phase.START) { diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/Check.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/Check.java index 43249fa9..01fb08d3 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/Check.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/Check.java @@ -6,8 +6,6 @@ import net.minecraftforge.common.MinecraftForge; import org.jetbrains.annotations.NotNull; -import java.lang.ref.WeakReference; - public abstract class Check { protected final @NotNull TRPlayer player; public String checkName; @@ -19,12 +17,17 @@ public Check(String checkName, @NotNull TRPlayer player) { MinecraftForge.EVENT_BUS.register(this); } + protected static void customMsg(String msg) { + LogUtils.custom(msg); + } + @Override protected void finalize() { MinecraftForge.EVENT_BUS.unregister(this); } public abstract int getAlertBuffer(); + public abstract boolean isDisabled(); protected void flag() { @@ -51,13 +54,18 @@ protected void moduleMsg(String msg) { LogUtils.prefix(checkName, msg); } - protected static void customMsg(String msg) { - LogUtils.custom(msg); + public void _onTick() { } - public void _onTick() {} - public void _onTeleport() {} - public void _onJump() {} - public void _onGameTypeChange() {} - public void _onPlaceBlock() {} + public void _onTeleport() { + } + + public void _onJump() { + } + + public void _onGameTypeChange() { + } + + public void _onPlaceBlock() { + } } diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/CheckManager.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/CheckManager.java index 16e89df5..f0da9bfd 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/CheckManager.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/CheckManager.java @@ -1,10 +1,14 @@ package keystrokesmod.module.impl.other.anticheats; -import keystrokesmod.module.impl.other.anticheats.checks.simulation.Simulation; -import keystrokesmod.module.impl.other.anticheats.utils.world.EntityUtils; -import keystrokesmod.module.impl.other.anticheats.checks.combat.*; +import keystrokesmod.module.impl.other.anticheats.checks.combat.AutoBlockA; +import keystrokesmod.module.impl.other.anticheats.checks.combat.AutoClickerA; +import keystrokesmod.module.impl.other.anticheats.checks.combat.NoSlowA; +import keystrokesmod.module.impl.other.anticheats.checks.combat.ReachA; import keystrokesmod.module.impl.other.anticheats.checks.movement.*; -import keystrokesmod.module.impl.other.anticheats.checks.scaffolding.*; +import keystrokesmod.module.impl.other.anticheats.checks.scaffolding.ScaffoldA; +import keystrokesmod.module.impl.other.anticheats.checks.scaffolding.ScaffoldB; +import keystrokesmod.module.impl.other.anticheats.checks.scaffolding.ScaffoldC; +import keystrokesmod.module.impl.other.anticheats.utils.world.EntityUtils; import net.minecraft.world.WorldSettings; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; @@ -19,6 +23,7 @@ public class CheckManager { private final @NotNull Map, Check> normalChecks; private final @NotNull Map, Check> postChecks; public short disableTick; + public CheckManager(@NotNull Map, Check> preChecks, @NotNull Map, Check> normalChecks, @NotNull Map, Check> postChecks, TRPlayer player) { @@ -68,7 +73,8 @@ public void update() { for (Check check : postChecks.values()) check._onGameTypeChange(); } - if (player.currentGameType == WorldSettings.GameType.CREATIVE || player.currentGameType == WorldSettings.GameType.SPECTATOR) return; + if (player.currentGameType == WorldSettings.GameType.CREATIVE || player.currentGameType == WorldSettings.GameType.SPECTATOR) + return; if (player.fabricPlayer.capabilities.isFlying) return; // bro 1.8.9 is soooooooo special if (player.lastOnGround && !player.currentOnGround) onJump(); diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/PlayerManager.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/PlayerManager.java index 0b3b138c..7ae635f6 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/PlayerManager.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/PlayerManager.java @@ -11,7 +11,10 @@ import net.minecraft.client.entity.AbstractClientPlayer; import org.jetbrains.annotations.NotNull; -import java.util.*; +import java.util.Arrays; +import java.util.ConcurrentModificationException; +import java.util.Map; +import java.util.UUID; public class PlayerManager { public Map activeMap; // 实时活动玩家(可被检查)列表 diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/TRPlayer.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/TRPlayer.java index be48b767..17dbb522 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/TRPlayer.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/TRPlayer.java @@ -39,10 +39,14 @@ public class TRPlayer { public boolean lastSwing = false; public Vec2 currentRot = Vec2.ZERO; public Vec2 lastRot = Vec2.ZERO; - @Range(from = 0, to = 19) public List posHistory = new ArrayList<>(20); - @Range(from = 0, to = 19) public List motionHistory = new ArrayList<>(20); - @Range(from = 0, to = 19) public List vehicleMotionHistory = new ArrayList<>(20); - @Range(from = 0, to = 19) public List sprintHistory = new ArrayList<>(20); + @Range(from = 0, to = 19) + public List posHistory = new ArrayList<>(20); + @Range(from = 0, to = 19) + public List motionHistory = new ArrayList<>(20); + @Range(from = 0, to = 19) + public List vehicleMotionHistory = new ArrayList<>(20); + @Range(from = 0, to = 19) + public List sprintHistory = new ArrayList<>(20); public Vec3 lastOnGroundPos = Vec3.ZERO; public Vec3 lastOnGroundPos2 = Vec3.ZERO; public Vec3 lastInLiquidPos = Vec3.ZERO; @@ -64,10 +68,6 @@ public class TRPlayer { public PlayerData compatPlayerData = new PlayerData(); public @NotNull ScheduledExecutorService timeTask = Executors.newScheduledThreadPool(1); - @Contract("_ -> new") - public static @NotNull TRPlayer create(@NotNull AbstractClientPlayer player) { - return new TRPlayer(player, false); - } public TRPlayer(AbstractClientPlayer player, boolean self) { this.fabricPlayer = player; @@ -83,8 +83,8 @@ public TRPlayer(AbstractClientPlayer player, boolean self) { currentRot = new Vec2(fabricPlayer.rotationPitch, fabricPlayer.rotationYaw); currentOnGround = lastOnGround = lastOnGround2 = fabricPlayer.onGround; currentGameType = lastGameType = - fabricPlayer.isSpectator() ? GameType.SPECTATOR : - GameType.SURVIVAL; + fabricPlayer.isSpectator() ? GameType.SPECTATOR : + GameType.SURVIVAL; for (int i = 0; i < 20; i++) { posHistory.add(currentPos); } @@ -99,6 +99,11 @@ public TRPlayer(AbstractClientPlayer player, boolean self) { } } + @Contract("_ -> new") + public static @NotNull TRPlayer create(@NotNull AbstractClientPlayer player) { + return new TRPlayer(player, false); + } + public void update(AbstractClientPlayer player) { fabricPlayer = player; if (fabricPlayer == null) return; diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/TRSelf.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/TRSelf.java index c608c036..18b821a0 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/TRSelf.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/TRSelf.java @@ -8,20 +8,23 @@ import java.util.concurrent.ScheduledExecutorService; public class TRSelf extends TRPlayer { - public static TRSelf getInstance() { - return instance; - } - private static TRSelf instance = null; public EntityPlayerSP fabricPlayer; public @NotNull ScheduledExecutorService timeTask = Executors.newScheduledThreadPool(8); - public TRSelf(@NotNull EntityPlayerSP player) { super(player, true); this.fabricPlayer = player; instance = this; } + public static TRSelf getInstance() { + return instance; + } + + public static void onDisconnect() { + instance = null; + } + @Override public void update(AbstractClientPlayer player) { if (player instanceof EntityPlayerSP) { @@ -30,8 +33,4 @@ public void update(AbstractClientPlayer player) { super.update(player); } - - public static void onDisconnect() { - instance = null; - } } diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/combat/NoSlowA.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/combat/NoSlowA.java index 6de56ab0..527da441 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/combat/NoSlowA.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/combat/NoSlowA.java @@ -14,6 +14,7 @@ public class NoSlowA extends Check { public static final List SLOW_SPEED = new ArrayList<>(); public short itemUseTick = 0; public short disableTick = 0; // 跳跃弱检测 + public NoSlowA(@NotNull TRPlayer player) { super("NoSlowA", player); SLOW_SPEED.add(2.56); diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/combat/ReachA.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/combat/ReachA.java index 56952c9c..a831a4b0 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/combat/ReachA.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/combat/ReachA.java @@ -38,7 +38,8 @@ private void onSwing() { if (distance < 6 && distance > AdvancedConfig.reachADefaultReach) { // 满足标记条件 flag(String.format("target: %s distance: %.2f", possibleTarget.getName(), distance)); } - } catch (NoSuchElementException ignored) {} + } catch (NoSuchElementException ignored) { + } }, AdvancedConfig.reachACheckDelay * 50L, TimeUnit.MILLISECONDS); } diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/BlinkA.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/BlinkA.java index 3e6b1279..0128582e 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/BlinkA.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/BlinkA.java @@ -8,7 +8,7 @@ public class BlinkA extends Check { - + public BlinkA(@NotNull TRPlayer player) { super("BlinkA", player); } diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/FlyA.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/FlyA.java index f1c3ff74..e40dad40 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/FlyA.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/FlyA.java @@ -18,7 +18,7 @@ public void _onTick() { if (PlayerMove.isNoMove(player.currentMotion) || player.currentOnGround) return; if (player.lastMotion.y() == 0 && player.currentMotion.y() == 0) { - flag(String.format("Invalid Y-motion: %.2f onGround=%s", player.currentMotion.y() , player.currentOnGround)); + flag(String.format("Invalid Y-motion: %.2f onGround=%s", player.currentMotion.y(), player.currentOnGround)); } } diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/GroundSpoofA.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/GroundSpoofA.java index d7a9d73a..6cc952ea 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/GroundSpoofA.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/GroundSpoofA.java @@ -17,22 +17,6 @@ public GroundSpoofA(@NotNull TRPlayer player) { super("GroundSpoofA", player); } - @Override - public void _onTick() { - if (player.lastOnGround2 && player.lastOnGround && player.currentOnGround) { // check if it's legit - final BlockPos groundPos = new BlockPos(player.fabricPlayer).down(); - - if (check(LevelUtils.getClientLevel(), groundPos)) { - flag("spoof onGround=true"); - setback(); - } - } - } - - public void setback() { - player.currentOnGround = false; - } - public static boolean check(@NotNull WorldClient level, @NotNull BlockPos groundPos) { if (!level.getBlockState(groundPos).getBlock().isAir(level, groundPos) || !level.getBlockState(groundPos.down()).getBlock().isAir(level, groundPos.down())) return false; @@ -57,6 +41,22 @@ public static boolean check(@NotNull WorldClient level, @NotNull BlockPos ground return count >= 8; } + @Override + public void _onTick() { + if (player.lastOnGround2 && player.lastOnGround && player.currentOnGround) { // check if it's legit + final BlockPos groundPos = new BlockPos(player.fabricPlayer).down(); + + if (check(LevelUtils.getClientLevel(), groundPos)) { + flag("spoof onGround=true"); + setback(); + } + } + } + + public void setback() { + player.currentOnGround = false; + } + @Override public boolean isDisabled() { return !Anticheat.getMovementCheck().isToggled(); diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/GroundSpoofB.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/GroundSpoofB.java index d5a451d7..502e3316 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/GroundSpoofB.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/GroundSpoofB.java @@ -18,23 +18,6 @@ public GroundSpoofB(@NotNull TRPlayer player) { super("GroundSpoofB", player); } - @Override - public void _onTick() { - final WorldClient level = LevelUtils.getClientLevel(); - if (level == null) return; - - if (!player.currentOnGround && Math.floor(player.currentPos.y()) == player.currentPos.y()) { // check if it's *OnGround* - if (check(level, new BlockPos(player.fabricPlayer).down())) { - flag("spoof onGround=false"); - setback(); - } - } - } - - public void setback() { - player.currentOnGround = true; - } - public static boolean check(@NotNull WorldClient level, @NotNull BlockPos groundPos) { if (!BlockUtils.isFullBlock(level.getBlockState(groundPos))) return false; @@ -59,6 +42,23 @@ public static boolean check(@NotNull WorldClient level, @NotNull BlockPos ground return count >= 8; } + @Override + public void _onTick() { + final WorldClient level = LevelUtils.getClientLevel(); + if (level == null) return; + + if (!player.currentOnGround && Math.floor(player.currentPos.y()) == player.currentPos.y()) { // check if it's *OnGround* + if (check(level, new BlockPos(player.fabricPlayer).down())) { + flag("spoof onGround=false"); + setback(); + } + } + } + + public void setback() { + player.currentOnGround = true; + } + @Override public boolean isDisabled() { return !Anticheat.getMovementCheck().isToggled(); diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/MotionA.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/MotionA.java index 6b00211d..9cde9fe4 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/MotionA.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/MotionA.java @@ -1,6 +1,5 @@ package keystrokesmod.module.impl.other.anticheats.checks.movement; -import keystrokesmod.module.impl.other.Anticheat; import keystrokesmod.module.impl.other.anticheats.Check; import keystrokesmod.module.impl.other.anticheats.TRPlayer; import keystrokesmod.module.impl.other.anticheats.config.AdvancedConfig; @@ -13,7 +12,10 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.Objects; public class MotionA extends Check { public static final List IGNORED_BLOCKS = new ArrayList<>(); @@ -72,6 +74,27 @@ public MotionA(@NotNull TRPlayer player) { JUMP_MOTIONS_2.add(-0.06843069924140427); } + public static @Nullable List getPossibleMotions(@NotNull TRPlayer player) { + try { + switch (player.fabricPlayer.getActivePotionEffects().stream() + .filter(effect -> effect.getEffectName().toLowerCase().contains("jump")) + .findAny() + .orElseThrow(NoSuchElementException::new).getAmplifier()) { + case 0: { + return JUMP_MOTIONS_1; + } + case 1: { + return JUMP_MOTIONS_2; + } + default: { + return null; + } + } + } catch (NoSuchElementException e) { + return JUMP_MOTIONS; + } + } + @Override public void _onTick() { if (disableTicks > 0) { @@ -116,21 +139,6 @@ private boolean check() { && IGNORED_BLOCKS.stream().noneMatch(block -> LevelUtils.getClientLevel().getBlockState(new BlockPos(player.fabricPlayer)).getBlock().equals(block)); } - public static @Nullable List getPossibleMotions(@NotNull TRPlayer player) { - try { - switch (player.fabricPlayer.getActivePotionEffects().stream() - .filter(effect -> effect.getEffectName().toLowerCase().contains("jump")) - .findAny() - .orElseThrow(NoSuchElementException::new).getAmplifier()) { - case 0 : { return JUMP_MOTIONS_1;} - case 1 : { return JUMP_MOTIONS_2;} - default : { return null;} - } - } catch (NoSuchElementException e) { - return JUMP_MOTIONS; - } - } - @Override public int getAlertBuffer() { return AdvancedConfig.motionAAlertBuffer; diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/NoFallA.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/NoFallA.java index 17d6b4b2..d9892110 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/NoFallA.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/NoFallA.java @@ -17,7 +17,7 @@ public void _onTick() { if (!player.fabricPlayer.capabilities.isFlying) { double serverPosX = (double) player.fabricPlayer.serverPosX / 32; double serverPosY = (double) player.fabricPlayer.serverPosY / 32; - double serverPosZ= (double) player.fabricPlayer.serverPosZ / 32; + double serverPosZ = (double) player.fabricPlayer.serverPosZ / 32; double deltaX = Math.abs(player.compatPlayerData.serverPosX - serverPosX); double deltaY = player.compatPlayerData.serverPosY - serverPosY; double deltaZ = Math.abs(player.compatPlayerData.serverPosZ - serverPosZ); diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/SpeedA.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/SpeedA.java index a5e19f03..f13cfdbc 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/SpeedA.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/SpeedA.java @@ -10,6 +10,7 @@ public class SpeedA extends Check { public boolean hasJumped = false; public short jumpTick = 0; + public SpeedA(@NotNull TRPlayer player) { super("SpeedA", player); } @@ -25,7 +26,8 @@ public void _onTick() { if (jumpTick > 0) jumpTick--; // check if player is on ground (not in liquid or in water) - if (player.lastPos == null || player.hasSetback || !player.currentOnGround || !player.lastOnGround || player.fabricPlayer.isInWater()) return; + if (player.lastPos == null || player.hasSetback || !player.currentOnGround || !player.lastOnGround || player.fabricPlayer.isInWater()) + return; double maxSecSpeed; if (jumpTick > 0) diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/scaffolding/ScaffoldA.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/scaffolding/ScaffoldA.java index 648bb3ed..1f098bdc 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/scaffolding/ScaffoldA.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/scaffolding/ScaffoldA.java @@ -3,7 +3,6 @@ import keystrokesmod.module.impl.other.Anticheat; import keystrokesmod.module.impl.other.anticheats.Check; import keystrokesmod.module.impl.other.anticheats.TRPlayer; -import keystrokesmod.module.impl.other.anticheats.config.AdvancedConfig; import org.jetbrains.annotations.NotNull; public class ScaffoldA extends Check { diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/scaffolding/ScaffoldB.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/scaffolding/ScaffoldB.java index d98a2733..3fcfa413 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/scaffolding/ScaffoldB.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/scaffolding/ScaffoldB.java @@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull; public class ScaffoldB extends Check { - public ScaffoldB( @NotNull TRPlayer player) { + public ScaffoldB(@NotNull TRPlayer player) { super("ScaffoldB", player); } diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/simulation/Simulation.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/simulation/Simulation.java index 41133018..96c15ebc 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/simulation/Simulation.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/simulation/Simulation.java @@ -24,7 +24,7 @@ public class Simulation extends Check { for (float forward = -1; forward <= 1; forward++) { for (float strafe = -1; strafe <= 1; strafe++) { for (boolean jump : BOOLEANS) { - for (boolean sneak: BOOLEANS) { + for (boolean sneak : BOOLEANS) { MovementInput input = new MovementInput(); input.moveForward = forward; input.moveStrafe = strafe; @@ -32,8 +32,8 @@ public class Simulation extends Check { input.sneak = sneak; if (input.sneak) { - input.moveStrafe = (float)((double) input.moveStrafe * 0.3); - input.moveForward = (float)((double) input.moveForward * 0.3); + input.moveStrafe = (float) ((double) input.moveStrafe * 0.3); + input.moveForward = (float) ((double) input.moveForward * 0.3); } MOVEMENTS.add(input); diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/config/AdvancedConfig.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/config/AdvancedConfig.java index 1cedded3..6faefe12 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/config/AdvancedConfig.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/config/AdvancedConfig.java @@ -1,7 +1,7 @@ package keystrokesmod.module.impl.other.anticheats.config; public class AdvancedConfig { - + public static boolean blinkCheck = true; public static int blinkAlertBuffer = 10; public static double blinkMaxDistance = 8; @@ -11,7 +11,6 @@ public class AdvancedConfig { public static int noSlowAInJumpDisableTick = 4; - public static boolean speedACheck = true; public static int speedAAlertBuffer = 30; public static int speedAAfterJumpJumpTick = 10; @@ -21,18 +20,17 @@ public class AdvancedConfig { public static double speedAWalkSpeed = 4.317; - public static boolean speedBCheck = true; public static int speedBAlertBuffer = 10; public static boolean groundSpoofACheck = true; public static int groundSpoofAAlertBuffer = 15; - + public static boolean groundSpoofBCheck = true; public static int groundSpoofBAlertBuffer = 15; - + public static boolean autoBlockACheck = false; public static int autoBlockAAlertBuffer = 1; @@ -40,7 +38,7 @@ public class AdvancedConfig { public static boolean speedCCheck = true; public static int speedCAlertBuffer = 10; - + public static boolean motionACheck = true; public static int motionAAlertBuffer = 10; @@ -53,14 +51,14 @@ public class AdvancedConfig { public static int hitBoxAAlertBuffer = 4; public static int hitBoxACheckDelay = 2; - + public static boolean flyACheck = true; public static int flyAAlertBuffer = 30; - + public static boolean flyBCheck = true; public static int flyBAlertBuffer = 30; public static int flyBMinRepeatTicks = 10; - + public static boolean strafeACheck = true; public static int strafeAAlertBuffer = 20; public static double strafeAMaxDiffToFlag = 0.005; diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/alert/LogUtils.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/alert/LogUtils.java index 85f7b5a8..7f3bc60a 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/alert/LogUtils.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/alert/LogUtils.java @@ -18,7 +18,7 @@ public static void alert(String player, String module, String extraMsg) { final ChatComponentText chatComponentText = new ChatComponentText(String.format("%s§r §r%s§r %s§r §b%s§r | %s§r", "§b§lTR§r§l>", player, "failed", module, extraMsg)); final ChatStyle chatStyle = new ChatStyle(); chatStyle.setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/wdr " + player)); - ((IChatComponent)chatComponentText).appendSibling(new ChatComponentText(Utils.formatColor(" §7[§cWDR§7]")).setChatStyle(chatStyle)); + ((IChatComponent) chatComponentText).appendSibling(new ChatComponentText(Utils.formatColor(" §7[§cWDR§7]")).setChatStyle(chatStyle)); Raven.mc.thePlayer.addChatMessage(chatComponentText); if (Anticheat.getShouldPing().isToggled()) { switch ((int) Anticheat.getPingSound().getInput()) { diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/phys/PredictEngine.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/phys/PredictEngine.java index 5b634f66..5f2209c1 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/phys/PredictEngine.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/phys/PredictEngine.java @@ -153,7 +153,7 @@ public void onUpdate() { } private boolean isHeadspaceFree(BlockPos p_isHeadspaceFree_1_, int p_isHeadspaceFree_2_) { - for(int y = 0; y < p_isHeadspaceFree_2_; ++y) { + for (int y = 0; y < p_isHeadspaceFree_2_; ++y) { if (!this.isOpenBlockSpace(p_isHeadspaceFree_1_.add(0, y, 0))) { return false; } @@ -167,7 +167,7 @@ protected boolean pushOutOfBlocks(double p_pushOutOfBlocks_1_, double p_pushOutO BlockPos blockpos = new BlockPos(p_pushOutOfBlocks_1_, p_pushOutOfBlocks_3_, p_pushOutOfBlocks_5_); double d0 = p_pushOutOfBlocks_1_ - (double) blockpos.getX(); double d1 = p_pushOutOfBlocks_5_ - (double) blockpos.getZ(); - int entHeight = Math.max((int) Math.ceil((double) this.height), 1); + int entHeight = Math.max((int) Math.ceil(this.height), 1); boolean inTranslucentBlock = !this.isHeadspaceFree(blockpos, entHeight); if (inTranslucentBlock) { int i = -1; @@ -226,10 +226,10 @@ public void onLivingUpdate() { var10000.moveForward *= 0.2F; } - this.pushOutOfBlocks(this.posX - (double)this.width * 0.35, this.getEntityBoundingBox().minY + 0.5, this.posZ + (double)this.width * 0.35); - this.pushOutOfBlocks(this.posX - (double)this.width * 0.35, this.getEntityBoundingBox().minY + 0.5, this.posZ - (double)this.width * 0.35); - this.pushOutOfBlocks(this.posX + (double)this.width * 0.35, this.getEntityBoundingBox().minY + 0.5, this.posZ - (double)this.width * 0.35); - this.pushOutOfBlocks(this.posX + (double)this.width * 0.35, this.getEntityBoundingBox().minY + 0.5, this.posZ + (double)this.width * 0.35); + this.pushOutOfBlocks(this.posX - (double) this.width * 0.35, this.getEntityBoundingBox().minY + 0.5, this.posZ + (double) this.width * 0.35); + this.pushOutOfBlocks(this.posX - (double) this.width * 0.35, this.getEntityBoundingBox().minY + 0.5, this.posZ - (double) this.width * 0.35); + this.pushOutOfBlocks(this.posX + (double) this.width * 0.35, this.getEntityBoundingBox().minY + 0.5, this.posZ - (double) this.width * 0.35); + this.pushOutOfBlocks(this.posX + (double) this.width * 0.35, this.getEntityBoundingBox().minY + 0.5, this.posZ + (double) this.width * 0.35); if (this.capabilities.allowFlying) { if (player.currentGameType == WorldSettings.GameType.SPECTATOR) { diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/BlockUtils.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/BlockUtils.java index 342e032c..34fbbdc8 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/BlockUtils.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/BlockUtils.java @@ -1,7 +1,6 @@ package keystrokesmod.module.impl.other.anticheats.utils.world; import net.minecraft.block.Block; -import net.minecraft.block.BlockGlass; import net.minecraft.block.state.IBlockState; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/EntityUtils.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/EntityUtils.java index 9ed6cb73..454ae5e8 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/EntityUtils.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/EntityUtils.java @@ -9,7 +9,8 @@ public class EntityUtils { public static boolean isOnPlaceBlock(@NotNull TRPlayer player) { - if (player.currentMainHead == ItemStack.EMPTY || player.lastMainHead == ItemStack.EMPTY) return false; // not as same as 1.20.1 + if (player.currentMainHead == ItemStack.EMPTY || player.lastMainHead == ItemStack.EMPTY) + return false; // not as same as 1.20.1 if (!(player.lastMainHead.isBlock)) return false; // BlockHitResult hitResult1 = RayCastUtils.blockRayCast(player.fabricPlayer, LevelUtils.getClientLevel(), 4.5); diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/PlayerMove.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/PlayerMove.java index aaaf9e71..40017fb1 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/PlayerMove.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/PlayerMove.java @@ -12,7 +12,7 @@ public class PlayerMove { public static double getXzTickSpeed(@NotNull Vec3 lastTick, @NotNull Vec3 currentTick) { - return getXZOnlyPos(currentTick).distanceTo(getXZOnlyPos(lastTick)); + return getXZOnlyPos(currentTick).distanceTo(getXZOnlyPos(lastTick)); } public static double getXzSecSpeed(@NotNull Vec3 lastTick, @NotNull Vec3 currentTick) { @@ -32,7 +32,7 @@ public static double getJumpDistance(@NotNull AbstractClientPlayer player) { .orElseThrow(NullPointerException::new) .getAmplifier() + 1; // return -9.331952072919326 * x * x - 3.672263213983712 * x + 0.6261016701268645; // chat gpt - return 0.04837 * x + 0.5356 * x + 1.252; // numpy + return 0.04837 * x + 0.5356 * x + 1.252; // numpy } catch (NullPointerException e) { return 1.252203340253729; } diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/PlayerRotation.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/PlayerRotation.java index e6d2cc33..a16bf5a1 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/PlayerRotation.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/PlayerRotation.java @@ -11,6 +11,7 @@ public class PlayerRotation { public static float getYaw(@NotNull BlockPos pos) { return getYaw(new Vec3(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5)); } + public static float getYaw(@NotNull AbstractClientPlayer from, @NotNull Vec3 pos) { return from.rotationYaw + MathHelper.wrapAngleTo180_float( diff --git a/src/main/java/keystrokesmod/module/impl/other/chatai/ChatGPTChatAI.java b/src/main/java/keystrokesmod/module/impl/other/chatai/ChatGPTChatAI.java index 3b2a9b6e..ed400c3d 100644 --- a/src/main/java/keystrokesmod/module/impl/other/chatai/ChatGPTChatAI.java +++ b/src/main/java/keystrokesmod/module/impl/other/chatai/ChatGPTChatAI.java @@ -11,16 +11,13 @@ import keystrokesmod.utility.ai.chatgpt.GPTModel; import org.jetbrains.annotations.NotNull; -import java.util.Arrays; import java.util.Collections; public class ChatGPTChatAI extends IChatAI { - private @NotNull String apiKey = ""; - private final ModeSetting model; private final ButtonSetting keepContext; private final ButtonSetting clearContextOnDisable; - + private @NotNull String apiKey = ""; private ChatGPTClient client = null; private ConversationContext context = null; private boolean working = false; diff --git a/src/main/java/keystrokesmod/module/impl/player/AntiAFK.java b/src/main/java/keystrokesmod/module/impl/player/AntiAFK.java index f845cbf7..1f0f28d6 100644 --- a/src/main/java/keystrokesmod/module/impl/player/AntiAFK.java +++ b/src/main/java/keystrokesmod/module/impl/player/AntiAFK.java @@ -11,21 +11,22 @@ import net.minecraft.client.settings.KeyBinding; public class AntiAFK extends Module { - private ModeSetting afk; - private ButtonSetting jump; - private ButtonSetting jumpWhenCollided; - private ButtonSetting randomClicks; - private ButtonSetting swapItem; - private ModeSetting spin; - private ButtonSetting randomizeDelta; - private ButtonSetting randomizePitch; - private SliderSetting minDelay; - private SliderSetting maxDelay; - private String[] afkModes = new String[]{"None", "Wander", "Lateral shuffle", "Forward", "Backward"}; - private String[] spinModes = new String[]{"None", "Random", "Right", "Left"}; + public boolean stop = false; + private final ModeSetting afk; + private final ButtonSetting jump; + private final ButtonSetting jumpWhenCollided; + private final ButtonSetting randomClicks; + private final ButtonSetting swapItem; + private final ModeSetting spin; + private final ButtonSetting randomizeDelta; + private final ButtonSetting randomizePitch; + private final SliderSetting minDelay; + private final SliderSetting maxDelay; + private final String[] afkModes = new String[]{"None", "Wander", "Lateral shuffle", "Forward", "Backward"}; + private final String[] spinModes = new String[]{"None", "Random", "Right", "Left"}; private int ticks; private boolean c; - public boolean stop = false; + public AntiAFK() { super("AntiAFK", category.player); this.registerSetting(afk = new ModeSetting("AFK", afkModes, 0)); @@ -154,14 +155,14 @@ private void b(final int n) { private int h() { if (minDelay.getInput() == maxDelay.getInput()) { - return (int)minDelay.getInput(); + return (int) minDelay.getInput(); } - return Utils.randomizeInt((int)minDelay.getInput(), (int) maxDelay.getInput()); + return Utils.randomizeInt((int) minDelay.getInput(), (int) maxDelay.getInput()); } private void d() { if (randomizePitch.isToggled()) { - mc.thePlayer.rotationPitch = RotationUtils.clampTo90((float)(mc.thePlayer.rotationPitch + this.a())); + mc.thePlayer.rotationPitch = RotationUtils.clampTo90((float) (mc.thePlayer.rotationPitch + this.a())); } } diff --git a/src/main/java/keystrokesmod/module/impl/player/AntiFireball.java b/src/main/java/keystrokesmod/module/impl/player/AntiFireball.java index 7321c75c..9931d8e0 100644 --- a/src/main/java/keystrokesmod/module/impl/player/AntiFireball.java +++ b/src/main/java/keystrokesmod/module/impl/player/AntiFireball.java @@ -20,16 +20,16 @@ import java.util.HashSet; public class AntiFireball extends Module { - private SliderSetting fov; - private SliderSetting range; - private ButtonSetting disableWhileFlying; - private ButtonSetting disableWhileScaffold; - private ButtonSetting blocksRotate; - private ButtonSetting projectileRotate; public ButtonSetting silentSwing; public EntityFireball fireball; - private HashSet fireballs = new HashSet<>(); public boolean attack; + private final SliderSetting fov; + private final SliderSetting range; + private final ButtonSetting disableWhileFlying; + private final ButtonSetting disableWhileScaffold; + private final ButtonSetting blocksRotate; + private final ButtonSetting projectileRotate; + private final HashSet fireballs = new HashSet<>(); public AntiFireball() { super("AntiFireball", category.player); diff --git a/src/main/java/keystrokesmod/module/impl/player/AutoHeal.java b/src/main/java/keystrokesmod/module/impl/player/AutoHeal.java index 59701082..53ca3995 100644 --- a/src/main/java/keystrokesmod/module/impl/player/AutoHeal.java +++ b/src/main/java/keystrokesmod/module/impl/player/AutoHeal.java @@ -89,7 +89,8 @@ public void onRender(TickEvent.RenderTickEvent event) { mc.playerController.sendUseItem(mc.thePlayer, mc.theWorld, stack); lastDoneUse = System.currentTimeMillis(); } else { - if (autoDrop.isToggled() && stack.getItem() instanceof ItemSoup) {mc.thePlayer.dropOneItem(true); + if (autoDrop.isToggled() && stack.getItem() instanceof ItemSoup) { + mc.thePlayer.dropOneItem(true); } if (originalSlot != -1) { diff --git a/src/main/java/keystrokesmod/module/impl/player/AutoPot.java b/src/main/java/keystrokesmod/module/impl/player/AutoPot.java index 47f5b6c0..6504e98a 100644 --- a/src/main/java/keystrokesmod/module/impl/player/AutoPot.java +++ b/src/main/java/keystrokesmod/module/impl/player/AutoPot.java @@ -25,12 +25,10 @@ public class AutoPot extends Module { private final SliderSetting health; private final ButtonSetting randomRot; - + private final ArrayList acceptedPotions = new ArrayList<>(Arrays.asList(6, 1, 5, 8, 14, 12, 10, 16)); private int ticksSinceLastSplash, ticksSinceCanSplash, oldSlot; private boolean needSplash, switchBack; - private final ArrayList acceptedPotions = new ArrayList<>(Arrays.asList(6, 1, 5, 8, 14, 12, 10, 16)); - public AutoPot() { super("AutoPot", category.player); this.registerSetting(new DescriptionSetting("Automatically throws potions.")); @@ -47,7 +45,7 @@ public void onDisable() { public void onRotation(RotationEvent event) { ticksSinceLastSplash++; - Block blockBelow = BlockUtils.getBlock(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY-1, mc.thePlayer.posZ )); + Block blockBelow = BlockUtils.getBlock(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1, mc.thePlayer.posZ)); if (mc.thePlayer.isInWater() || mc.thePlayer.isInLava() || (blockBelow instanceof BlockAir || blockBelow instanceof BlockLadder)) ticksSinceCanSplash = 0; @@ -94,7 +92,7 @@ public void onRotation(RotationEvent event) { if (!needSplash) { needSplash = true; } else { - mc.thePlayer.inventory.currentItem = i-36; + mc.thePlayer.inventory.currentItem = i - 36; final MovingObjectPosition hitResult = RotationUtils.rayCast(1, event.getPitch(), event.getYaw()); if (hitResult != null) { mc.playerController.onPlayerRightClick( diff --git a/src/main/java/keystrokesmod/module/impl/player/AutoSwap.java b/src/main/java/keystrokesmod/module/impl/player/AutoSwap.java index 0a38c808..44ea5c46 100644 --- a/src/main/java/keystrokesmod/module/impl/player/AutoSwap.java +++ b/src/main/java/keystrokesmod/module/impl/player/AutoSwap.java @@ -9,8 +9,9 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class AutoSwap extends Module { - private ButtonSetting sameType; - private ButtonSetting swapToGreaterStack; + private final ButtonSetting sameType; + private final ButtonSetting swapToGreaterStack; + public AutoSwap() { super("AutoSwap", category.player); this.registerSetting(new DescriptionSetting("Automatically swaps blocks.")); diff --git a/src/main/java/keystrokesmod/module/impl/player/AutoWeb.java b/src/main/java/keystrokesmod/module/impl/player/AutoWeb.java index aa373963..91cc9073 100644 --- a/src/main/java/keystrokesmod/module/impl/player/AutoWeb.java +++ b/src/main/java/keystrokesmod/module/impl/player/AutoWeb.java @@ -7,10 +7,10 @@ import keystrokesmod.module.impl.other.SlotHandler; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; -import keystrokesmod.utility.aim.AimSimulator; import keystrokesmod.utility.BlockUtils; import keystrokesmod.utility.RotationUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.aim.AimSimulator; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemBlock; diff --git a/src/main/java/keystrokesmod/module/impl/player/Backtrack.java b/src/main/java/keystrokesmod/module/impl/player/Backtrack.java index f3af6ff2..4db1b247 100644 --- a/src/main/java/keystrokesmod/module/impl/player/Backtrack.java +++ b/src/main/java/keystrokesmod/module/impl/player/Backtrack.java @@ -1,10 +1,5 @@ package keystrokesmod.module.impl.player; -import java.awt.*; -import java.util.*; -import java.util.List; -import java.util.concurrent.ConcurrentLinkedQueue; - import keystrokesmod.event.PreTickEvent; import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.event.ReceivePacketEvent; @@ -28,6 +23,12 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; + public class Backtrack extends Module { public static final Color color = new Color(72, 125, 227); diff --git a/src/main/java/keystrokesmod/module/impl/player/Blink.java b/src/main/java/keystrokesmod/module/impl/player/Blink.java index cf708c4a..6567a8f8 100644 --- a/src/main/java/keystrokesmod/module/impl/player/Blink.java +++ b/src/main/java/keystrokesmod/module/impl/player/Blink.java @@ -15,8 +15,8 @@ import java.awt.*; public class Blink extends Module { - private final ModeValue mode; public static final int color = new Color(255, 255, 255, 200).getRGB(); + private final ModeValue mode; public Blink() { super("Blink", category.player); @@ -26,21 +26,6 @@ public Blink() { ); } - @Override - public void onEnable() throws Throwable { - mode.enable(); - } - - @Override - public void onDisable() throws Throwable { - mode.disable(); - } - - @Override - public String getInfo() { - return mode.getSelected().getInfo(); - } - public static boolean isBlinking() { if (ModuleManager.blink == null) return false; if (ModuleManager.blink.isEnabled()) return true; @@ -77,5 +62,20 @@ public static void drawBox(@NotNull Vec3 pos) { GL11.glDisable(3042); GlStateManager.popMatrix(); } + + @Override + public void onEnable() throws Throwable { + mode.enable(); + } + + @Override + public void onDisable() throws Throwable { + mode.disable(); + } + + @Override + public String getInfo() { + return mode.getSelected().getInfo(); + } } diff --git a/src/main/java/keystrokesmod/module/impl/player/ChestAura.java b/src/main/java/keystrokesmod/module/impl/player/ChestAura.java index 1e597264..c96706e5 100644 --- a/src/main/java/keystrokesmod/module/impl/player/ChestAura.java +++ b/src/main/java/keystrokesmod/module/impl/player/ChestAura.java @@ -13,10 +13,10 @@ import keystrokesmod.module.setting.impl.ModeValue; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.script.classes.Vec3; -import keystrokesmod.utility.aim.AimSimulator; import keystrokesmod.utility.BlockUtils; import keystrokesmod.utility.RotationUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.aim.AimSimulator; import net.minecraft.block.BlockChest; import net.minecraft.block.state.IBlockState; import net.minecraft.client.gui.inventory.GuiChest; @@ -42,14 +42,13 @@ public class ChestAura extends IAutoClicker { private final ButtonSetting onlyCloseChest; private final ButtonSetting onlyNotBelowChest; private final ButtonSetting targetNearbyCheck; - + private final Set clicked = new HashSet<>(); + private final Set opened = new HashSet<>(); private boolean click = false; private Pair target = null; private float yaw; private float pitch; private Float lastYaw = null, lastPitch = null; - private final Set clicked = new HashSet<>(); - private final Set opened = new HashSet<>(); private long lastDone = 0; public ChestAura() { diff --git a/src/main/java/keystrokesmod/module/impl/player/ChestStealer.java b/src/main/java/keystrokesmod/module/impl/player/ChestStealer.java index 5ad78ffc..19f262ac 100644 --- a/src/main/java/keystrokesmod/module/impl/player/ChestStealer.java +++ b/src/main/java/keystrokesmod/module/impl/player/ChestStealer.java @@ -20,6 +20,11 @@ import java.util.concurrent.TimeUnit; public class ChestStealer extends Module { + private static final ButtonSetting customChest = new ButtonSetting("Custom chest", false); + private static final ButtonSetting silent = new ButtonSetting("Silent", false); + private static final ButtonSetting notMoving = new ButtonSetting("Not Moving", false); + public static ButtonSetting allowMouseControl = new ButtonSetting("Allow mouse control", false); + private static State state = State.NONE; private final SliderSetting minStartDelay = new SliderSetting("Min start delay", 100, 0, 500, 10, "ms"); private final SliderSetting maxStartDelay = new SliderSetting("Max start delay", 200, 0, 500, 10, "ms"); private final SliderSetting minStealDelay = new SliderSetting("Min steal delay", 100, 0, 500, 10, "ms"); @@ -29,21 +34,10 @@ public class ChestStealer extends Module { private final ButtonSetting autoCloseIfInvFull = new ButtonSetting("Auto close if inv full", true, autoClose::isToggled); private final SliderSetting minCloseDelay = new SliderSetting("Min close delay", 50, 0, 500, 10, "ms", autoClose::isToggled); private final SliderSetting maxCloseDelay = new SliderSetting("Max close delay", 100, 0, 500, 10, "ms", autoClose::isToggled); - private static final ButtonSetting customChest = new ButtonSetting("Custom chest", false); private final ButtonSetting ignoreTrash = new ButtonSetting("Ignore trash", false); - private static final ButtonSetting silent = new ButtonSetting("Silent", false); - private static final ButtonSetting notMoving = new ButtonSetting("Not Moving", false); - public static ButtonSetting allowMouseControl = new ButtonSetting("Allow mouse control", false); - - private static State state = State.NONE; + private final Set stole = new HashSet<>(); private long nextStealTime; private long nextCloseTime; - private final Set stole = new HashSet<>(); - - public static boolean noChestRender() { - return ModuleManager.chestStealer != null && ModuleManager.chestStealer.isEnabled() - && silent.isToggled() && ContainerUtils.isChest(customChest.isToggled()); - } public ChestStealer() { super("ChestStealer", category.player); @@ -52,6 +46,11 @@ public ChestStealer() { customChest, ignoreTrash, silent, notMoving, allowMouseControl); } + public static boolean noChestRender() { + return ModuleManager.chestStealer != null && ModuleManager.chestStealer.isEnabled() + && silent.isToggled() && ContainerUtils.isChest(customChest.isToggled()); + } + @Override public void guiUpdate() { Utils.correctValue(minStartDelay, maxStartDelay); diff --git a/src/main/java/keystrokesmod/module/impl/player/FakeLag.java b/src/main/java/keystrokesmod/module/impl/player/FakeLag.java index 30aa0436..83bcaea0 100644 --- a/src/main/java/keystrokesmod/module/impl/player/FakeLag.java +++ b/src/main/java/keystrokesmod/module/impl/player/FakeLag.java @@ -1,7 +1,8 @@ package keystrokesmod.module.impl.player; import keystrokesmod.module.Module; -import keystrokesmod.module.impl.player.fakelag.*; +import keystrokesmod.module.impl.player.fakelag.DynamicFakeLag; +import keystrokesmod.module.impl.player.fakelag.LatencyFakeLag; import keystrokesmod.module.setting.impl.ModeValue; public class FakeLag extends Module { diff --git a/src/main/java/keystrokesmod/module/impl/player/InvManager.java b/src/main/java/keystrokesmod/module/impl/player/InvManager.java index 0bdd7847..2d7559fc 100644 --- a/src/main/java/keystrokesmod/module/impl/player/InvManager.java +++ b/src/main/java/keystrokesmod/module/impl/player/InvManager.java @@ -22,7 +22,9 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import java.util.concurrent.TimeUnit; public class InvManager extends Module { @@ -217,14 +219,14 @@ private void sort(int from, int to) { return result; } + @Override + public String getInfo() { + return mode.getOptions()[(int) mode.getInput()]; + } + enum State { NONE, BEFORE, TASKING } - - @Override - public String getInfo() { - return mode.getOptions()[(int) mode.getInput()]; - } } diff --git a/src/main/java/keystrokesmod/module/impl/player/NoFall.java b/src/main/java/keystrokesmod/module/impl/player/NoFall.java index 6a18aad4..0a726f8d 100644 --- a/src/main/java/keystrokesmod/module/impl/player/NoFall.java +++ b/src/main/java/keystrokesmod/module/impl/player/NoFall.java @@ -4,7 +4,7 @@ import keystrokesmod.module.impl.player.nofall.*; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.ModeValue; -import keystrokesmod.utility.*; +import keystrokesmod.utility.Utils; public class NoFall extends Module { private final ModeValue mode; diff --git a/src/main/java/keystrokesmod/module/impl/player/NoRotate.java b/src/main/java/keystrokesmod/module/impl/player/NoRotate.java index 8668ac96..21bb9731 100644 --- a/src/main/java/keystrokesmod/module/impl/player/NoRotate.java +++ b/src/main/java/keystrokesmod/module/impl/player/NoRotate.java @@ -5,7 +5,6 @@ import keystrokesmod.module.Module; import keystrokesmod.module.impl.other.RotationHandler; import keystrokesmod.module.setting.impl.ModeSetting; -import keystrokesmod.utility.Reflection; import keystrokesmod.utility.Utils; import net.minecraft.network.play.server.S08PacketPlayerPosLook; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; diff --git a/src/main/java/keystrokesmod/module/impl/player/Timer.java b/src/main/java/keystrokesmod/module/impl/player/Timer.java index 3b37a420..00a652be 100644 --- a/src/main/java/keystrokesmod/module/impl/player/Timer.java +++ b/src/main/java/keystrokesmod/module/impl/player/Timer.java @@ -6,14 +6,8 @@ import keystrokesmod.module.impl.player.timer.HypixelTimer; import keystrokesmod.module.impl.player.timer.NormalTimer; import keystrokesmod.module.setting.impl.ButtonSetting; -import keystrokesmod.module.setting.impl.ModeSetting; import keystrokesmod.module.setting.impl.ModeValue; -import keystrokesmod.module.setting.impl.SliderSetting; -import keystrokesmod.module.setting.utils.ModeOnly; -import keystrokesmod.utility.MoveUtil; import keystrokesmod.utility.Utils; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; public class Timer extends Module { private final ModeValue mode; diff --git a/src/main/java/keystrokesmod/module/impl/player/antivoid/BacktrackAntiVoid.java b/src/main/java/keystrokesmod/module/impl/player/antivoid/BacktrackAntiVoid.java index f0cf05f0..f09405ad 100644 --- a/src/main/java/keystrokesmod/module/impl/player/antivoid/BacktrackAntiVoid.java +++ b/src/main/java/keystrokesmod/module/impl/player/antivoid/BacktrackAntiVoid.java @@ -30,6 +30,10 @@ public BacktrackAntiVoid(String name, @NotNull AntiVoid parent) { this.registerSetting(clearXZMotion = new ButtonSetting("Clear xz motion", true)); } + private static boolean predVoid() { + return Utils.overVoid(mc.thePlayer.posX + mc.thePlayer.motionX, mc.thePlayer.posY + mc.thePlayer.motionY, mc.thePlayer.posZ + mc.thePlayer.motionZ); + } + @Override public void onUpdate() throws Throwable { if (fallbackPosition == null) { @@ -70,10 +74,6 @@ public void onUpdate() throws Throwable { } } - private static boolean predVoid() { - return Utils.overVoid(mc.thePlayer.posX + mc.thePlayer.motionX, mc.thePlayer.posY + mc.thePlayer.motionY, mc.thePlayer.posZ + mc.thePlayer.motionZ); - } - @Override public void onDisable() throws Throwable { blink.disable(); diff --git a/src/main/java/keystrokesmod/module/impl/player/antivoid/HypixelAntiVoid.java b/src/main/java/keystrokesmod/module/impl/player/antivoid/HypixelAntiVoid.java index 3be07f78..c7cff090 100644 --- a/src/main/java/keystrokesmod/module/impl/player/antivoid/HypixelAntiVoid.java +++ b/src/main/java/keystrokesmod/module/impl/player/antivoid/HypixelAntiVoid.java @@ -16,16 +16,13 @@ import org.jetbrains.annotations.Nullable; import static keystrokesmod.module.ModuleManager.*; -import static keystrokesmod.module.ModuleManager.scaffold; public class HypixelAntiVoid extends SubMode { @Getter private static @Nullable HypixelAntiVoid instance = null; - + public final NormalBlink blink = new NormalBlink("Blink", this); private final SliderSetting distance; private final ButtonSetting toggleScaffold; - - public final NormalBlink blink = new NormalBlink("Blink", this); private Vec3 position, motion; private boolean wasVoid, setBack; private int overVoidTicks; diff --git a/src/main/java/keystrokesmod/module/impl/player/blink/FakeLagBlink.java b/src/main/java/keystrokesmod/module/impl/player/blink/FakeLagBlink.java index 43f281b1..bb39ef69 100644 --- a/src/main/java/keystrokesmod/module/impl/player/blink/FakeLagBlink.java +++ b/src/main/java/keystrokesmod/module/impl/player/blink/FakeLagBlink.java @@ -38,15 +38,15 @@ public class FakeLagBlink extends SubMode { private final ButtonSetting drawRealPosition; private final Queue packetQueue = new ConcurrentLinkedQueue<>(); + private final Animation animationX = new Animation(Easing.EASE_OUT_CIRC, 200); + private final Animation animationY = new Animation(Easing.EASE_OUT_CIRC, 200); + private final Animation animationZ = new Animation(Easing.EASE_OUT_CIRC, 200); + private final Progress progress = new Progress("Blink"); public boolean needToDisable = false; private Vec3 vec3 = Vec3.ZERO; private long startTime = 0; private long stopTime = 0; private long blinkedTime = 0; - private final Animation animationX = new Animation(Easing.EASE_OUT_CIRC, 200); - private final Animation animationY = new Animation(Easing.EASE_OUT_CIRC, 200); - private final Animation animationZ = new Animation(Easing.EASE_OUT_CIRC, 200); - private final Progress progress = new Progress("Blink"); public FakeLagBlink(String name, @NotNull Blink parent) { super(name, parent); diff --git a/src/main/java/keystrokesmod/module/impl/player/blink/NormalBlink.java b/src/main/java/keystrokesmod/module/impl/player/blink/NormalBlink.java index 2510a8ab..33d3b826 100644 --- a/src/main/java/keystrokesmod/module/impl/player/blink/NormalBlink.java +++ b/src/main/java/keystrokesmod/module/impl/player/blink/NormalBlink.java @@ -25,12 +25,11 @@ import java.util.List; public class NormalBlink extends SubMode { + public final ButtonSetting overlay; + public final List> blinkedPackets = new ArrayList<>(); private final ButtonSetting pulse; private final SliderSetting pulseDelay; private final ButtonSetting initialPosition; - public final ButtonSetting overlay; - - public final List> blinkedPackets = new ArrayList<>(); private long startTime = -1; private Vec3 pos; diff --git a/src/main/java/keystrokesmod/module/impl/player/fakelag/DynamicFakeLag.java b/src/main/java/keystrokesmod/module/impl/player/fakelag/DynamicFakeLag.java index 09ec0091..3f1e5370 100644 --- a/src/main/java/keystrokesmod/module/impl/player/fakelag/DynamicFakeLag.java +++ b/src/main/java/keystrokesmod/module/impl/player/fakelag/DynamicFakeLag.java @@ -30,12 +30,11 @@ public class DynamicFakeLag extends SubMode { private final SliderSetting stopRange; private final SliderSetting maxTargetRange; private final ButtonSetting debug; - + private final Queue packetQueue = new ConcurrentLinkedQueue<>(); private AbstractClientPlayer target = null; private long lastDisableTime = -1; private boolean lastHurt = false; private long lastStartBlinkTime = -1; - private final Queue packetQueue = new ConcurrentLinkedQueue<>(); public DynamicFakeLag(String name, @NotNull FakeLag parent) { super(name, parent); @@ -94,14 +93,15 @@ public void onRenderTick(TickEvent.RenderTickEvent ev) { blink.disable(); } else if (!blink.isEnabled() && distance > stopRange.getInput() && new Vec3(mc.thePlayer).distanceTo(target) < startRange.getInput()) { - if (debug.isToggled()) Utils.sendModuleMessage(parent, "start lag: in range."); + if (debug.isToggled()) Utils.sendModuleMessage(parent, "start lag: in range."); lastStartBlinkTime = System.currentTimeMillis(); blink.enable(); } else if (blink.isEnabled() && distance > startRange.getInput()) { if (debug.isToggled()) Utils.sendModuleMessage(parent, "stop lag: out of range."); blink.disable(); } else if (distance > maxTargetRange.getInput()) { - if (debug.isToggled()) Utils.sendModuleMessage(parent, String.format("release target: %s", target.getName())); + if (debug.isToggled()) + Utils.sendModuleMessage(parent, String.format("release target: %s", target.getName())); target = null; blink.disable(); } @@ -109,7 +109,7 @@ && new Vec3(mc.thePlayer).distanceTo(target) < startRange.getInput()) { lastHurt = mc.thePlayer.hurtTime > 0; } - + @SubscribeEvent public void onAttack(@NotNull AttackEntityEvent e) { if (e.target instanceof AbstractClientPlayer) { diff --git a/src/main/java/keystrokesmod/module/impl/player/fakelag/LatencyFakeLag.java b/src/main/java/keystrokesmod/module/impl/player/fakelag/LatencyFakeLag.java index 04a27da4..5f38ccd5 100644 --- a/src/main/java/keystrokesmod/module/impl/player/fakelag/LatencyFakeLag.java +++ b/src/main/java/keystrokesmod/module/impl/player/fakelag/LatencyFakeLag.java @@ -21,7 +21,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; @@ -29,9 +28,8 @@ public class LatencyFakeLag extends SubMode { private final SliderSetting delay; private final ButtonSetting drawRealPosition; - - private Vec3 vec3 = null; private final Queue packetQueue = new ConcurrentLinkedQueue<>(); + private Vec3 vec3 = null; public LatencyFakeLag(String name, @NotNull FakeLag parent) { super(name, parent); @@ -53,6 +51,7 @@ public void onRender(RenderWorldLastEvent event) { Blink.drawBox(vec3.toVec3()); } } + @SubscribeEvent(priority = EventPriority.HIGHEST) public void onRenderTick(TickEvent.RenderTickEvent ev) { if (!Utils.nullCheck()) { @@ -61,6 +60,7 @@ public void onRenderTick(TickEvent.RenderTickEvent ev) { } sendPacket(true); } + @SubscribeEvent(priority = EventPriority.HIGHEST) public void onSendPacket(@NotNull SendPacketEvent e) { if (!Utils.nullCheck()) return; diff --git a/src/main/java/keystrokesmod/module/impl/player/nofall/HypixelBlinkNoFall.java b/src/main/java/keystrokesmod/module/impl/player/nofall/HypixelBlinkNoFall.java index 65568012..1c1335e0 100644 --- a/src/main/java/keystrokesmod/module/impl/player/nofall/HypixelBlinkNoFall.java +++ b/src/main/java/keystrokesmod/module/impl/player/nofall/HypixelBlinkNoFall.java @@ -10,16 +10,14 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; -import static keystrokesmod.module.ModuleManager.blink; import static keystrokesmod.module.ModuleManager.scaffold; public class HypixelBlinkNoFall extends SubMode { private final SliderSetting minFallDistance; - + private final NormalBlink blink = new NormalBlink("Blink", this); private boolean blinked = false; private boolean prevOnGround = false; private double fallDistance = 0; - private final NormalBlink blink = new NormalBlink("Blink", this); public HypixelBlinkNoFall(String name, @NotNull NoFall parent) { super(name, parent); diff --git a/src/main/java/keystrokesmod/module/impl/player/nofall/LegitNoFall.java b/src/main/java/keystrokesmod/module/impl/player/nofall/LegitNoFall.java index 25d72047..df517243 100644 --- a/src/main/java/keystrokesmod/module/impl/player/nofall/LegitNoFall.java +++ b/src/main/java/keystrokesmod/module/impl/player/nofall/LegitNoFall.java @@ -8,9 +8,9 @@ import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.impl.SubMode; -import keystrokesmod.utility.aim.AimSimulator; import keystrokesmod.utility.RotationUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.aim.AimSimulator; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; diff --git a/src/main/java/keystrokesmod/module/impl/player/nofall/VulcanNoFall.java b/src/main/java/keystrokesmod/module/impl/player/nofall/VulcanNoFall.java index 14fa4b64..110c2260 100644 --- a/src/main/java/keystrokesmod/module/impl/player/nofall/VulcanNoFall.java +++ b/src/main/java/keystrokesmod/module/impl/player/nofall/VulcanNoFall.java @@ -14,9 +14,8 @@ import java.util.List; public class VulcanNoFall extends SubMode { - private final SliderSetting minFallDistance; - public static final List maxModCount = new ArrayList<>(Arrays.asList(3, 2, 2)); + private final SliderSetting minFallDistance; private int currentModCount = 0; private int hasModCount = 0; diff --git a/src/main/java/keystrokesmod/module/impl/render/Ambience.java b/src/main/java/keystrokesmod/module/impl/render/Ambience.java index 2853cdb8..55cbebb2 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Ambience.java +++ b/src/main/java/keystrokesmod/module/impl/render/Ambience.java @@ -3,7 +3,6 @@ import keystrokesmod.event.PreMotionEvent; import keystrokesmod.event.ReceivePacketEvent; import keystrokesmod.module.Module; -import keystrokesmod.module.ModuleManager; import keystrokesmod.module.setting.impl.ModeSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.Utils; @@ -21,8 +20,8 @@ public class Ambience extends Module { public Ambience() { super("Ambience", category.render); - this.registerSetting(time = new SliderSetting("Time", 0,0, 24000, 10)); - this.registerSetting(speed = new SliderSetting("Speed", 0,0, 20, 1)); + this.registerSetting(time = new SliderSetting("Time", 0, 0, 24000, 10)); + this.registerSetting(speed = new SliderSetting("Speed", 0, 0, 20, 1)); String[] MODES = new String[]{"Unchanged", "Clear", "Rain"}; this.registerSetting(weather = new ModeSetting("Weather", MODES, 0)); @@ -74,9 +73,7 @@ public void onPreMotion(PreMotionEvent event) { public void onReceivePacket(@NotNull ReceivePacketEvent event) { if (event.getPacket() instanceof S03PacketTimeUpdate) { event.setCanceled(true); - } - - else if (event.getPacket() instanceof S2BPacketChangeGameState && this.weather.getInput() != 0) { + } else if (event.getPacket() instanceof S2BPacketChangeGameState && this.weather.getInput() != 0) { S2BPacketChangeGameState s2b = (S2BPacketChangeGameState) event.getPacket(); if (s2b.getGameState() == 1 || s2b.getGameState() == 2) { diff --git a/src/main/java/keystrokesmod/module/impl/render/Animations.java b/src/main/java/keystrokesmod/module/impl/render/Animations.java index 8d9cc235..e2b055fa 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Animations.java +++ b/src/main/java/keystrokesmod/module/impl/render/Animations.java @@ -22,11 +22,11 @@ import org.lwjgl.opengl.GL11; public class Animations extends Module { + public static final ButtonSetting swingWhileDigging = new ButtonSetting("Swing while digging", true); + public static final ButtonSetting clientSide = new ButtonSetting("Client side (visual 1.7)", true, swingWhileDigging::isToggled); private final ModeSetting blockAnimation = new ModeSetting("Block animation", new String[]{"None", "1.7", "Smooth", "Exhibition", "Stab", "Spin", "Sigma", "Wood", "Swong", "Chill", "Komorebi", "Rhys", "Allah"}, 1); private final ModeSetting swingAnimation = new ModeSetting("Swing animation", new String[]{"None", "1.9+", "Smooth", "Punch", "Shove"}, 0); private final ModeSetting otherAnimation = new ModeSetting("Other animation", new String[]{"None", "1.7"}, 1); - public static final ButtonSetting swingWhileDigging = new ButtonSetting("Swing while digging", true); - public static final ButtonSetting clientSide = new ButtonSetting("Client side (visual 1.7)", true, swingWhileDigging::isToggled); private final ButtonSetting fakeSlotReset = new ButtonSetting("Fake slot reset", false); private final SliderSetting x = new SliderSetting("X", 0, -1, 1, 0.05); private final SliderSetting y = new SliderSetting("Y", 0, -1, 1, 0.05); @@ -282,11 +282,11 @@ public void onPreMotion(PreMotionEvent event) { public void onSwingAnimation(@NotNull SwingAnimationEvent event) { event.setAnimationEnd(event.getAnimationEnd() * (int) ((-swingSpeed.getInput() / 100) + 1)); } - + private void translate(double x, double y, double z) { GlStateManager.translate( - x + this.x.getInput(), - y + this.y.getInput(), + x + this.x.getInput(), + y + this.y.getInput(), z + this.z.getInput() ); } @@ -307,15 +307,15 @@ private void func_178105_d(float swingProgress) { private void func_178104_a(ItemStack itemToRender, @NotNull AbstractClientPlayer p_178104_1_, float p_178104_2_) { if (itemToRender == null) return; - float f = (float)p_178104_1_.getItemInUseCount() - p_178104_2_ + 1.0F; - float f1 = f / (float)itemToRender.getMaxItemUseDuration(); + float f = (float) p_178104_1_.getItemInUseCount() - p_178104_2_ + 1.0F; + float f1 = f / (float) itemToRender.getMaxItemUseDuration(); float f2 = MathHelper.abs(MathHelper.cos(f / 4.0F * 3.1415927F) * 0.1F); if (f1 >= 0.8F) { f2 = 0.0F; } this.translate(0.0F, f2, 0.0F); - float f3 = 1.0F - (float)Math.pow(f1, 27.0); + float f3 = 1.0F - (float) Math.pow(f1, 27.0); this.translate(f3 * 0.6F, f3 * -0.5F, f3 * 0.0F); GlStateManager.rotate(f3 * 90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(f3 * 10.0F, 1.0F, 0.0F, 0.0F); @@ -330,7 +330,7 @@ private void func_178098_a(@NotNull ItemStack itemToRender, float p_178098_1_, @ GlStateManager.rotate(-12.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(-8.0F, 1.0F, 0.0F, 0.0F); this.translate(-0.9F, 0.2F, 0.0F); - float f = (float)itemToRender.getMaxItemUseDuration() - ((float)p_178098_2_.getItemInUseCount() - p_178098_1_ + 1.0F); + float f = (float) itemToRender.getMaxItemUseDuration() - ((float) p_178098_2_.getItemInUseCount() - p_178098_1_ + 1.0F); float f1 = f / 20.0F; f1 = (f1 * f1 + f1 * 2.0F) / 3.0F; if (f1 > 1.0F) { diff --git a/src/main/java/keystrokesmod/module/impl/render/AntiShuffle.java b/src/main/java/keystrokesmod/module/impl/render/AntiShuffle.java index 984a3a1c..0e0f9881 100644 --- a/src/main/java/keystrokesmod/module/impl/render/AntiShuffle.java +++ b/src/main/java/keystrokesmod/module/impl/render/AntiShuffle.java @@ -5,7 +5,7 @@ public class AntiShuffle extends Module { public static DescriptionSetting a; - private static String c = "§k"; + private static final String c = "§k"; public AntiShuffle() { super("AntiShuffle", Module.category.render, 0); diff --git a/src/main/java/keystrokesmod/module/impl/render/BedESP.java b/src/main/java/keystrokesmod/module/impl/render/BedESP.java index 4e389b6c..9234d098 100644 --- a/src/main/java/keystrokesmod/module/impl/render/BedESP.java +++ b/src/main/java/keystrokesmod/module/impl/render/BedESP.java @@ -5,9 +5,9 @@ import keystrokesmod.module.setting.impl.ModeSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.BlockUtils; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Theme; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.render.RenderUtils; import net.minecraft.block.BlockBed; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; @@ -26,11 +26,11 @@ public class BedESP extends Module { public ModeSetting theme; - private SliderSetting range; - private SliderSetting rate; - private ButtonSetting firstBed; + private final SliderSetting range; + private final SliderSetting rate; + private final ButtonSetting firstBed; private BlockPos[] bed = null; - private List beds = new ArrayList<>(); + private final List beds = new ArrayList<>(); private long lastCheck = 0; public BedESP() { diff --git a/src/main/java/keystrokesmod/module/impl/render/BedPlates.java b/src/main/java/keystrokesmod/module/impl/render/BedPlates.java index a5dce1b9..309c4c73 100644 --- a/src/main/java/keystrokesmod/module/impl/render/BedPlates.java +++ b/src/main/java/keystrokesmod/module/impl/render/BedPlates.java @@ -7,6 +7,7 @@ import keystrokesmod.utility.CoolDown; import keystrokesmod.utility.ShaderUtils; import keystrokesmod.utility.Utils; +import net.minecraft.block.Block; import net.minecraft.block.BlockBed; import net.minecraft.block.state.IBlockState; import net.minecraft.client.gui.Gui; @@ -14,7 +15,6 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; -import net.minecraft.block.Block; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.entity.EntityJoinWorldEvent; @@ -22,8 +22,8 @@ import org.jetbrains.annotations.NotNull; import java.awt.*; -import java.util.*; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import static org.lwjgl.opengl.GL11.*; @@ -34,11 +34,11 @@ public class BedPlates extends Module { public static SliderSetting updateRate, yShift, layers; private final CoolDown updateCooldown = new CoolDown(0); private final ButtonSetting showDistance; - private BlockPos[] bed = null; private final SliderSetting range; private final List beds = new ArrayList<>(); private final ButtonSetting firstBed; private final List> bedBlocks = new ArrayList<>(); + private BlockPos[] bed = null; public BedPlates() { super("Bed Plates", category.render); @@ -50,6 +50,24 @@ public BedPlates() { this.registerSetting(firstBed = new ButtonSetting("Only render first bed", false)); } + public static void drawRound(double x, double y, double width, double height, double radius, @NotNull Color color) { + GlStateManager.color(1, 1, 1, 1); + roundedShader.init(); + + setupRoundedRectUniforms(x, y, width, height, radius); + roundedShader.setUniformf("color", color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f); + + ShaderUtils.drawQuads(x - 1, y - 1, width + 2, height + 2); + roundedShader.unload(); + } + + private static void setupRoundedRectUniforms(double x, double y, double width, double height, double radius) { + ScaledResolution sr = new ScaledResolution(mc); + BedPlates.roundedShader.setUniformf("location", x * sr.getScaleFactor(), (mc.displayHeight - (height * sr.getScaleFactor())) - (y * sr.getScaleFactor())); + BedPlates.roundedShader.setUniformf("rectSize", width * sr.getScaleFactor(), height * sr.getScaleFactor()); + BedPlates.roundedShader.setUniformf("radius", radius * sr.getScaleFactor()); + } + public void onUpdate() { if (Utils.nullCheck()) { if (updateCooldown.hasFinished()) { @@ -140,12 +158,12 @@ private void drawPlate(BlockPos blockPos, int index) { glScaled(-0.01666666753590107D * Math.sqrt(mc.thePlayer.getDistance(blockPos.getX(), blockPos.getY(), blockPos.getZ())), -0.01666666753590107D * Math.sqrt(mc.thePlayer.getDistance(blockPos.getX(), blockPos.getY(), blockPos.getZ())), 0.01666666753590107D * Math.sqrt(mc.thePlayer.getDistance(blockPos.getX(), blockPos.getY(), blockPos.getZ()))); List blocks = bedBlocks.get(index); drawRound(Math.max(17.5, blocks.size() * 17.5) / -2, -0.5, Math.max(17.5, blocks.size() * 17.5) - 2.5, 26.5, 3, new Color(0, 0, 0, 90)); - if(showDistance.isToggled()) { + if (showDistance.isToggled()) { String dist = Math.round(mc.thePlayer.getDistance(blockPos.getX(), blockPos.getY(), blockPos.getZ())) + "m"; mc.fontRendererObj.drawString(dist, -mc.fontRendererObj.getStringWidth(dist) / 2, 0, new Color(255, 255, 255, 255).getRGB()); } double offset = (blocks.size() * -17.5) / 2; - for (Block block :blocks) { + for (Block block : blocks) { mc.getTextureManager().bindTexture(new ResourceLocation("keystrokesmod:images/" + block.getLocalizedName() + ".png")); Gui.drawModalRectWithCustomSizedTexture((int) offset, 10, 0, 0, 15, 15, 15, 15); offset += 17.5; @@ -204,22 +222,4 @@ private boolean isValidBedBlock(Block block) { block.equals(Blocks.end_stone) || block.equals(Blocks.obsidian) || block.equals(Blocks.water); } - - public static void drawRound(double x, double y, double width, double height, double radius, @NotNull Color color) { - GlStateManager.color(1, 1, 1, 1); - roundedShader.init(); - - setupRoundedRectUniforms(x, y, width, height, radius); - roundedShader.setUniformf("color", color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f); - - ShaderUtils.drawQuads(x - 1, y - 1, width + 2, height + 2); - roundedShader.unload(); - } - - private static void setupRoundedRectUniforms(double x, double y, double width, double height, double radius) { - ScaledResolution sr = new ScaledResolution(mc); - BedPlates.roundedShader.setUniformf("location", x * sr.getScaleFactor(), (mc.displayHeight - (height * sr.getScaleFactor())) - (y * sr.getScaleFactor())); - BedPlates.roundedShader.setUniformf("rectSize", width * sr.getScaleFactor(), height * sr.getScaleFactor()); - BedPlates.roundedShader.setUniformf("radius", radius * sr.getScaleFactor()); - } } \ No newline at end of file diff --git a/src/main/java/keystrokesmod/module/impl/render/BreakProgress.java b/src/main/java/keystrokesmod/module/impl/render/BreakProgress.java index 0b93a7d1..e75e2d71 100644 --- a/src/main/java/keystrokesmod/module/impl/render/BreakProgress.java +++ b/src/main/java/keystrokesmod/module/impl/render/BreakProgress.java @@ -24,11 +24,11 @@ public class BreakProgress extends Module { private final ButtonSetting manual; private final ButtonSetting bedAura; private final ButtonSetting progressBar; + private final Animation progressAnimation = new Animation(Easing.EASE_OUT_CIRC, 200); + private final Progress progressObj = new Progress("BedAura"); private double progress; private BlockPos block; private String progressStr; - private final Animation progressAnimation = new Animation(Easing.EASE_OUT_CIRC, 200); - private final Progress progressObj = new Progress("BedAura"); public BreakProgress() { super("BreakProgress", category.render); @@ -74,11 +74,11 @@ public void onRenderWorld(RenderWorldLastEvent e) { private void setProgress() { switch ((int) mode.getInput()) { case 0: { - this.progressStr = (int) (100.0 * (this.progress / 1.0)) + "%"; + this.progressStr = (int) (100.0 * (this.progress)) + "%"; break; } case 1: { - double timeLeft = Utils.rnd((double) ((1.0f - this.progress) / BlockUtils.getBlockHardness(BlockUtils.getBlock(this.block), mc.thePlayer.getHeldItem(), false, false)) / 20.0, 1); + double timeLeft = Utils.rnd((1.0f - this.progress) / BlockUtils.getBlockHardness(BlockUtils.getBlock(this.block), mc.thePlayer.getHeldItem(), false, false) / 20.0, 1); this.progressStr = timeLeft == 0 ? "0" : timeLeft + "s"; break; } diff --git a/src/main/java/keystrokesmod/module/impl/render/Chams.java b/src/main/java/keystrokesmod/module/impl/render/Chams.java index dbd7368c..fcad02a8 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Chams.java +++ b/src/main/java/keystrokesmod/module/impl/render/Chams.java @@ -12,8 +12,8 @@ import java.util.HashSet; public class Chams extends Module { - private ButtonSetting ignoreBots; - private HashSet bots = new HashSet<>(); + private final ButtonSetting ignoreBots; + private final HashSet bots = new HashSet<>(); public Chams() { super("Chams", Module.category.render, 0); diff --git a/src/main/java/keystrokesmod/module/impl/render/ChestESP.java b/src/main/java/keystrokesmod/module/impl/render/ChestESP.java index cfbadad8..31ebafa5 100644 --- a/src/main/java/keystrokesmod/module/impl/render/ChestESP.java +++ b/src/main/java/keystrokesmod/module/impl/render/ChestESP.java @@ -3,8 +3,8 @@ import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.render.RenderUtils; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.tileentity.TileEntityEnderChest; @@ -14,8 +14,13 @@ import java.awt.*; public class ChestESP extends Module { - private SliderSetting red, green, blue; - private ButtonSetting rainbow, outline, shade, disableIfOpened; + private final SliderSetting red; + private final SliderSetting green; + private final SliderSetting blue; + private final ButtonSetting rainbow; + private final ButtonSetting outline; + private final ButtonSetting shade; + private final ButtonSetting disableIfOpened; public ChestESP() { super("ChestESP", Module.category.render, 0); diff --git a/src/main/java/keystrokesmod/module/impl/render/CustomCape.java b/src/main/java/keystrokesmod/module/impl/render/CustomCape.java index 2e1ee4ab..65bef37a 100644 --- a/src/main/java/keystrokesmod/module/impl/render/CustomCape.java +++ b/src/main/java/keystrokesmod/module/impl/render/CustomCape.java @@ -15,21 +15,21 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; -import java.util.*; import java.util.ArrayList; import java.util.List; +import java.util.Objects; import static com.mojang.realmsclient.gui.ChatFormatting.*; public final class CustomCape extends Module { - private static File directory; + public static final List LOADED_CAPES = new ArrayList<>(); public static String[] CAPES_NAME = new String[]{ "RavenAnime", "RavenAqua", "RavenGreen", "RavenPurple", "RavenRed", "RavenWhite", "RavenYellow", "Cherry", "Die", "Astolfo" }; - public static final List LOADED_CAPES = new ArrayList<>(); public static final ModeSetting cape = new ModeSetting("Cape", CAPES_NAME, 0); + private static File directory; public CustomCape() { super("CustomCape", category.render); @@ -47,8 +47,7 @@ public CustomCape() { this.registerSetting(new ButtonSetting("Open folder", () -> { try { Desktop.getDesktop().open(directory); - } - catch (IOException ex) { + } catch (IOException ex) { Raven.profileManager.directory.mkdirs(); Utils.sendMessage("&cError locating folder, recreated."); } diff --git a/src/main/java/keystrokesmod/module/impl/render/Explosions.java b/src/main/java/keystrokesmod/module/impl/render/Explosions.java index 26fa21c7..f04e75b4 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Explosions.java +++ b/src/main/java/keystrokesmod/module/impl/render/Explosions.java @@ -2,7 +2,6 @@ import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.ButtonSetting; -import keystrokesmod.module.setting.impl.DescriptionSetting; import keystrokesmod.utility.Utils; import keystrokesmod.utility.render.RenderUtils; import net.minecraft.client.renderer.GlStateManager; @@ -39,7 +38,7 @@ public void onRenderWorld(RenderWorldLastEvent e) { if (showBlastRing.isToggled()) { renderBlastRing(); } - if(showDamageRing.isToggled()) { + if (showDamageRing.isToggled()) { renderExplosionSphere(); } GL11.glPopMatrix(); diff --git a/src/main/java/keystrokesmod/module/impl/render/FreeLook.java b/src/main/java/keystrokesmod/module/impl/render/FreeLook.java index 6f040beb..5a2f91ab 100644 --- a/src/main/java/keystrokesmod/module/impl/render/FreeLook.java +++ b/src/main/java/keystrokesmod/module/impl/render/FreeLook.java @@ -1,6 +1,8 @@ package keystrokesmod.module.impl.render; -import keystrokesmod.event.*; +import keystrokesmod.event.JumpEvent; +import keystrokesmod.event.PrePlayerInputEvent; +import keystrokesmod.event.RotationEvent; import keystrokesmod.module.Module; import keystrokesmod.module.ModuleManager; import keystrokesmod.module.setting.impl.ButtonSetting; @@ -13,25 +15,14 @@ import javax.annotation.Nullable; public class FreeLook extends Module { - private final ButtonSetting onlyIfPressed = new ButtonSetting("Only if pressed", true); - public static @Nullable ViewData viewData = null; + private final ButtonSetting onlyIfPressed = new ButtonSetting("Only if pressed", true); public FreeLook() { super("FreeLook", category.render); this.registerSetting(onlyIfPressed); } - @Override - public void onDisable() { - if (viewData != null) { - mc.gameSettings.thirdPersonView = viewData.thirdPersonView; - mc.thePlayer.rotationYaw = viewData.rotationYaw; - mc.thePlayer.rotationPitch = viewData.rotationPitch; - } - viewData = null; - } - public static void call() { if (ModuleManager.freeLook.isEnabled() && FreeLook.viewData != null) { mc.objectMouseOver = RotationUtils.rayCast( @@ -42,6 +33,16 @@ public static void call() { } } + @Override + public void onDisable() { + if (viewData != null) { + mc.gameSettings.thirdPersonView = viewData.thirdPersonView; + mc.thePlayer.rotationYaw = viewData.rotationYaw; + mc.thePlayer.rotationPitch = viewData.rotationPitch; + } + viewData = null; + } + @SubscribeEvent(priority = EventPriority.HIGHEST) public void onPreMotion(RotationEvent event) { try { @@ -52,7 +53,7 @@ public void onPreMotion(RotationEvent event) { } catch (IndexOutOfBoundsException ignored) { } - if (viewData != null){ + if (viewData != null) { call(); if (!event.isSet()) { event.setYaw(viewData.rotationYaw); diff --git a/src/main/java/keystrokesmod/module/impl/render/Freecam.java b/src/main/java/keystrokesmod/module/impl/render/Freecam.java index d1a374bd..21c98900 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Freecam.java +++ b/src/main/java/keystrokesmod/module/impl/render/Freecam.java @@ -4,8 +4,8 @@ import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.render.RenderUtils; import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraft.network.play.client.C02PacketUseEntity; import net.minecraft.network.play.client.C07PacketPlayerDigging; @@ -19,15 +19,15 @@ import java.awt.*; public class Freecam extends Module { - public SliderSetting speed; - private ButtonSetting disableOnDamage; - private ButtonSetting showArm; - private ButtonSetting allowDigging; - private ButtonSetting allowInteracting; - private ButtonSetting allowPlacing; public static EntityOtherPlayerMP freeEntity = null; + public SliderSetting speed; + private final ButtonSetting disableOnDamage; + private final ButtonSetting showArm; + private final ButtonSetting allowDigging; + private final ButtonSetting allowInteracting; + private final ButtonSetting allowPlacing; private int[] lcc = new int[]{Integer.MAX_VALUE, 0}; - private float[] sAng = new float[]{0.0F, 0.0F}; + private final float[] sAng = new float[]{0.0F, 0.0F}; public Freecam() { super("Freecam", category.render, 0); diff --git a/src/main/java/keystrokesmod/module/impl/render/FullBright.java b/src/main/java/keystrokesmod/module/impl/render/FullBright.java index 90548623..69b42697 100644 --- a/src/main/java/keystrokesmod/module/impl/render/FullBright.java +++ b/src/main/java/keystrokesmod/module/impl/render/FullBright.java @@ -10,9 +10,9 @@ import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; public class FullBright extends Module { + private static final float brightness = 15.0f; private final ModeSetting mode; private float originalGamma; - private static final float brightness = 15.0f; private boolean nightVisionEnabled = false; private int lastMode = -1; diff --git a/src/main/java/keystrokesmod/module/impl/render/HUD.java b/src/main/java/keystrokesmod/module/impl/render/HUD.java index c58885fd..a1a09fe3 100644 --- a/src/main/java/keystrokesmod/module/impl/render/HUD.java +++ b/src/main/java/keystrokesmod/module/impl/render/HUD.java @@ -7,12 +7,15 @@ import keystrokesmod.module.setting.impl.DescriptionSetting; import keystrokesmod.module.setting.impl.ModeSetting; import keystrokesmod.module.setting.impl.SubMode; +import keystrokesmod.utility.Theme; +import keystrokesmod.utility.Utils; import keystrokesmod.utility.font.FontManager; import keystrokesmod.utility.font.IFont; import keystrokesmod.utility.render.RenderUtils; -import keystrokesmod.utility.Theme; -import keystrokesmod.utility.Utils; -import net.minecraft.client.gui.*; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiChat; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.config.GuiButtonExt; @@ -24,20 +27,11 @@ import java.awt.*; import java.io.IOException; -import java.util.*; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; public class HUD extends Module { - public static ModeSetting theme; - public static ModeSetting font; - public static ButtonSetting dropShadow; - private final ButtonSetting background; - private final ButtonSetting sidebar; - public static ButtonSetting alphabeticalSort; - private static ButtonSetting alignRight; - public static ButtonSetting lowercase; - public static ButtonSetting showInfo; private static final ButtonSetting combat = new ButtonSetting("Combat", true); private static final ButtonSetting movement = new ButtonSetting("Movement", true); private static final ButtonSetting player = new ButtonSetting("Player", true); @@ -50,8 +44,17 @@ public class HUD extends Module { private static final ButtonSetting scripts = new ButtonSetting("Scripts", true); private static final ButtonSetting exploit = new ButtonSetting("Exploit", true); private static final ButtonSetting experimental = new ButtonSetting("Experimental", true); + public static ModeSetting theme; + public static ModeSetting font; + public static ButtonSetting dropShadow; + public static ButtonSetting alphabeticalSort; + public static ButtonSetting lowercase; + public static ButtonSetting showInfo; public static int hudX = 5; public static int hudY = 70; + private static ButtonSetting alignRight; + private final ButtonSetting background; + private final ButtonSetting sidebar; private boolean isAlphabeticalSort; private boolean canShowInfo; @@ -77,6 +80,65 @@ public HUD() { this.registerSetting(combat, movement, player, world, render, minigames, fun, other, client, scripts, exploit, experimental); } + public static double getLongestModule(IFont fr) { + double length = 0; + + for (Module module : ModuleManager.organizedModules) { + if (module.isEnabled()) { + String moduleName = module.getPrettyName(); + if (showInfo.isToggled() && !module.getInfo().isEmpty()) { + moduleName += " §7" + module.getInfo(); + } + if (lowercase.isToggled()) { + moduleName = moduleName.toLowerCase(); + } + if (fr.width(moduleName) > length) { + length = fr.width(moduleName); + } + } + } + return length; + } + + private static boolean isIgnored(@NotNull Module module) { + if (!module.isEnabled() || module.getName().equals("HUD")) + return true; + if (module instanceof SubMode) + return true; + + if (module.moduleCategory() == category.combat && !combat.isToggled()) return true; + if (module.moduleCategory() == category.movement && !movement.isToggled()) return true; + if (module.moduleCategory() == category.player && !player.isToggled()) return true; + if (module.moduleCategory() == category.world && !world.isToggled()) return true; + if (module.moduleCategory() == category.render && !render.isToggled()) return true; + if (module.moduleCategory() == category.minigames && !minigames.isToggled()) return true; + if (module.moduleCategory() == category.fun && !fun.isToggled()) return true; + if (module.moduleCategory() == category.other && !other.isToggled()) return true; + if (module.moduleCategory() == category.client && !client.isToggled()) return true; + if (module.moduleCategory() == category.scripts && !scripts.isToggled()) return true; + if (module.moduleCategory() == category.exploit && !exploit.isToggled()) return true; + if (module.moduleCategory() == category.experimental && !experimental.isToggled()) return true; + + if (module.isHidden()) { + return true; + } + return module == ModuleManager.commandLine; + } + + public static IFont getFontRenderer() { + switch ((int) font.getInput()) { + default: + case 0: + return FontManager.getMinecraft(); + case 1: + return FontManager.productSans20; + case 2: + return FontManager.regular22; + case 3: + return FontManager.tenacity20; + } + } + public void onEnable() { ModuleManager.sort(); } @@ -129,8 +191,7 @@ public void onRenderTick(@NotNull RenderTickEvent ev) { getFontRenderer().drawString(text, n3, n, e, dropShadow.isToggled()); n += Math.round(getFontRenderer().height() + 2); } - } - catch (Exception exception) { + } catch (Exception exception) { Utils.sendMessage("&cAn error occurred rendering HUD. check your logs"); Utils.sendDebugMessage(Arrays.toString(exception.getStackTrace())); Utils.log.error(exception); @@ -157,26 +218,6 @@ private List getDrawTexts() { return texts; } - public static double getLongestModule(IFont fr) { - double length = 0; - - for (Module module : ModuleManager.organizedModules) { - if (module.isEnabled()) { - String moduleName = module.getPrettyName(); - if (showInfo.isToggled() && !module.getInfo().isEmpty()) { - moduleName += " §7" + module.getInfo(); - } - if (lowercase.isToggled()) { - moduleName = moduleName.toLowerCase(); - } - if (fr.width(moduleName) > length) { - length = fr.width(moduleName); - } - } - } - return length; - } - static class EditScreen extends GuiScreen { final String example = "This is an-Example-HUD"; GuiButtonExt resetPosition; @@ -220,8 +261,7 @@ public void drawScreen(int mX, int mY, float pt) { this.maX = maX; this.maY = maY; this.clickMinX = miX; - } - else { + } else { this.maX = clickPos[0]; this.maY = clickPos[1]; this.clickMinX = clickPos[2]; @@ -260,8 +300,7 @@ public void onRenderTick(RenderTickEvent event) { fr.drawString(s, (float) x, (float) y, Color.white.getRGB(), HUD.dropShadow.isToggled()); y += Math.round(fr.height() + 2); } - } - else { + } else { double longestModule = getLongestModule(getFontRenderer()); double n = this.miY; double n2 = 0.0; @@ -278,8 +317,7 @@ public void onRenderTick(RenderTickEvent event) { int e = Theme.getGradient((int) theme.getInput(), n2); if (theme.getInput() == 0) { n2 -= 120; - } - else { + } else { n2 -= 12; } double n3 = this.miX; @@ -370,43 +408,4 @@ private boolean empty() { return true; } } - - private static boolean isIgnored(@NotNull Module module) { - if (!module.isEnabled() || module.getName().equals("HUD")) - return true; - if (module instanceof SubMode) - return true; - - if (module.moduleCategory() == category.combat && !combat.isToggled()) return true; - if (module.moduleCategory() == category.movement && !movement.isToggled()) return true; - if (module.moduleCategory() == category.player && !player.isToggled()) return true; - if (module.moduleCategory() == category.world && !world.isToggled()) return true; - if (module.moduleCategory() == category.render && !render.isToggled()) return true; - if (module.moduleCategory() == category.minigames && !minigames.isToggled()) return true; - if (module.moduleCategory() == category.fun && !fun.isToggled()) return true; - if (module.moduleCategory() == category.other && !other.isToggled()) return true; - if (module.moduleCategory() == category.client && !client.isToggled()) return true; - if (module.moduleCategory() == category.scripts && !scripts.isToggled()) return true; - if (module.moduleCategory() == category.exploit && !exploit.isToggled()) return true; - if (module.moduleCategory() == category.experimental && !experimental.isToggled()) return true; - - if (module.isHidden()) { - return true; - } - return module == ModuleManager.commandLine; - } - - public static IFont getFontRenderer() { - switch ((int) font.getInput()) { - default: - case 0: - return FontManager.getMinecraft(); - case 1: - return FontManager.productSans20; - case 2: - return FontManager.regular22; - case 3: - return FontManager.tenacity20; - } - } } diff --git a/src/main/java/keystrokesmod/module/impl/render/Indicators.java b/src/main/java/keystrokesmod/module/impl/render/Indicators.java index 1741120b..cc831f53 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Indicators.java +++ b/src/main/java/keystrokesmod/module/impl/render/Indicators.java @@ -4,9 +4,9 @@ import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.Reflection; +import keystrokesmod.utility.Utils; import keystrokesmod.utility.render.ColorUtils; import keystrokesmod.utility.render.RenderUtils; -import keystrokesmod.utility.Utils; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityEnderPearl; @@ -28,18 +28,19 @@ import java.util.concurrent.ConcurrentHashMap; public class Indicators extends Module { - private ButtonSetting renderArrows; - private ButtonSetting renderPearls; - private ButtonSetting renderFireballs; - private ButtonSetting renderPlayers; - private SliderSetting radius; - private ButtonSetting itemColors, arrowColor; - private ButtonSetting renderItem; - private ButtonSetting threatsOnly; - private HashSet threats = new HashSet<>(); - private Map lastHeldItems = new ConcurrentHashMap<>(); - private int pearlColor = new Color(173, 12, 255).getRGB(); - private int fireBallColor = new Color(255, 109, 0).getRGB(); + private final ButtonSetting renderArrows; + private final ButtonSetting renderPearls; + private final ButtonSetting renderFireballs; + private final ButtonSetting renderPlayers; + private final SliderSetting radius; + private final ButtonSetting itemColors; + private final ButtonSetting arrowColor; + private final ButtonSetting renderItem; + private final ButtonSetting threatsOnly; + private final HashSet threats = new HashSet<>(); + private final Map lastHeldItems = new ConcurrentHashMap<>(); + private final int pearlColor = new Color(173, 12, 255).getRGB(); + private final int fireBallColor = new Color(255, 109, 0).getRGB(); public Indicators() { super("Indicators", category.render); @@ -116,7 +117,7 @@ public void onRenderTick(TickEvent.RenderTickEvent event) { GL11.glTranslated(x + position[0], y + position[1], 0.0); String distanceStr = (int) mc.thePlayer.getDistanceToEntity(e) + "m"; float textWidth = mc.fontRendererObj.getStringWidth(distanceStr); - mc.fontRendererObj.drawStringWithShadow(distanceStr, -textWidth / 2, -mc.fontRendererObj.FONT_HEIGHT/2, -1); + mc.fontRendererObj.drawStringWithShadow(distanceStr, -textWidth / 2, -mc.fontRendererObj.FONT_HEIGHT / 2, -1); GL11.glPopMatrix(); GL11.glPushMatrix(); @@ -125,8 +126,7 @@ public void onRenderTick(TickEvent.RenderTickEvent event) { RenderUtils.drawArrow(-5f, (float) -radius.getInput() - 38, itemColors.isToggled() ? color : -1, 3, 5); GL11.glPopMatrix(); } - } - catch (Exception ex) { + } catch (Exception ex) { ex.printStackTrace(); } } @@ -147,18 +147,14 @@ private boolean canRender(Entity entity) { try { if (entity instanceof EntityArrow && !Reflection.inGround.getBoolean(entity) && renderArrows.isToggled()) { return true; - } - else if (entity instanceof EntityFireball && renderFireballs.isToggled()) { + } else if (entity instanceof EntityFireball && renderFireballs.isToggled()) { return true; - } - else if (entity instanceof EntityEnderPearl && renderPearls.isToggled()) { + } else if (entity instanceof EntityEnderPearl && renderPearls.isToggled()) { return true; - } - else if (entity instanceof EntityPlayer && renderPlayers.isToggled()) { + } else if (entity instanceof EntityPlayer && renderPlayers.isToggled()) { return true; } - } - catch (IllegalAccessException e) { + } catch (IllegalAccessException e) { Utils.sendMessage("&cIssue checking entity."); e.printStackTrace(); return false; diff --git a/src/main/java/keystrokesmod/module/impl/render/ItemESP.java b/src/main/java/keystrokesmod/module/impl/render/ItemESP.java index 9f96c370..24f9633e 100644 --- a/src/main/java/keystrokesmod/module/impl/render/ItemESP.java +++ b/src/main/java/keystrokesmod/module/impl/render/ItemESP.java @@ -2,8 +2,8 @@ import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.ButtonSetting; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.render.RenderUtils; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; @@ -20,7 +20,8 @@ import java.util.Map; public class ItemESP extends Module { // entirely skidded from raven b4 source leak - private ButtonSetting renderIron, renderGold; + private final ButtonSetting renderIron; + private final ButtonSetting renderGold; public ItemESP() { super("ItemESP", category.render); @@ -28,6 +29,70 @@ public ItemESP() { this.registerSetting(renderGold = new ButtonSetting("Render gold", true)); } + public static double c(double n, double n2, double n3) { + if (n == 0.0) { + n = 1.0; + } + if (n2 == 0.0) { + n2 = 1.0; + } + if (n3 == 0.0) { + n3 = 1.0; + } + return Math.round((n + 1.0) * Math.floor(n2) * (n3 + 2.0)); + } + + private static double a(Item item, double n, double n2, double n3) { + double c = c(n, n2, n3); + if (item == Items.iron_ingot) { + c += 0.155; + } else if (item == Items.gold_ingot) { + c += 0.255; + } else if (item == Items.diamond) { + c += 0.355; + } else if (item == Items.emerald) { + c += 0.455; + } + return c; + } + + public static void c(int n, int n2, int n3, double n4, double n5, double n6, double n7) { + n4 -= mc.getRenderManager().viewerPosX; + n5 -= mc.getRenderManager().viewerPosY; + n6 -= mc.getRenderManager().viewerPosZ; + GL11.glPushMatrix(); + GL11.glBlendFunc(770, 771); + GL11.glEnable(3042); + GL11.glLineWidth(2.0f); + GL11.glDisable(3553); + GL11.glDisable(2929); + GL11.glDepthMask(false); + float n8 = (n >> 16 & 0xFF) / 255.0f; + float n9 = (n >> 8 & 0xFF) / 255.0f; + float n10 = (n & 0xFF) / 255.0f; + float min = Math.min(Math.max(0.2f, (float) (0.009999999776482582 * n7)), 0.4f); + RenderUtils.drawBoundingBox(new AxisAlignedBB(n4 - min, n5, n6 - min, n4 + min, n5 + min * 2.0f, n6 + min), n8, n9, n10, 0.35f); + GL11.glEnable(3553); + GL11.glEnable(2929); + GL11.glDepthMask(true); + GL11.glDisable(3042); + GL11.glPopMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.translate((float) n4, (float) n5 + 0.3, (float) n6); + GlStateManager.rotate(-mc.getRenderManager().playerViewY, 0.0f, 1.0f, 0.0f); + GlStateManager.rotate(mc.getRenderManager().playerViewX, 1.0f, 0.0f, 0.0f); + float min2 = Math.min(Math.max(0.02266667f, (float) (0.001500000013038516 * n7)), 0.07f); + GlStateManager.scale(-min2, -min2, -min2); + GlStateManager.depthMask(false); + GlStateManager.disableDepth(); + String value = String.valueOf(n3); + mc.fontRendererObj.drawString(value, -(mc.fontRendererObj.getStringWidth(value) / 2) + min2 * 3.5f, -(123.805f * min2 - 2.47494f), n2, true); + GlStateManager.enableDepth(); + GlStateManager.depthMask(true); + GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); + GlStateManager.popMatrix(); + } + @SubscribeEvent public void onRenderWorldLast(RenderWorldLastEvent e) { HashMap> hashMap = new HashMap<>(); @@ -99,68 +164,4 @@ public void onRenderWorldLast(RenderWorldLastEvent e) { } } } - - public static double c(double n, double n2, double n3) { - if (n == 0.0) { - n = 1.0; - } - if (n2 == 0.0) { - n2 = 1.0; - } - if (n3 == 0.0) { - n3 = 1.0; - } - return Math.round((n + 1.0) * Math.floor(n2) * (n3 + 2.0)); - } - - private static double a(Item item, double n, double n2, double n3) { - double c = c(n, n2, n3); - if (item == Items.iron_ingot) { - c += 0.155; - } else if (item == Items.gold_ingot) { - c += 0.255; - } else if (item == Items.diamond) { - c += 0.355; - } else if (item == Items.emerald) { - c += 0.455; - } - return c; - } - - public static void c(int n, int n2, int n3, double n4, double n5, double n6, double n7) { - n4 -= mc.getRenderManager().viewerPosX; - n5 -= mc.getRenderManager().viewerPosY; - n6 -= mc.getRenderManager().viewerPosZ; - GL11.glPushMatrix(); - GL11.glBlendFunc(770, 771); - GL11.glEnable(3042); - GL11.glLineWidth(2.0f); - GL11.glDisable(3553); - GL11.glDisable(2929); - GL11.glDepthMask(false); - float n8 = (n >> 16 & 0xFF) / 255.0f; - float n9 = (n >> 8 & 0xFF) / 255.0f; - float n10 = (n & 0xFF) / 255.0f; - float min = Math.min(Math.max(0.2f, (float) (0.009999999776482582 * n7)), 0.4f); - RenderUtils.drawBoundingBox(new AxisAlignedBB(n4 - min, n5, n6 - min, n4 + min, n5 + min * 2.0f, n6 + min), n8, n9, n10, 0.35f); - GL11.glEnable(3553); - GL11.glEnable(2929); - GL11.glDepthMask(true); - GL11.glDisable(3042); - GL11.glPopMatrix(); - GlStateManager.pushMatrix(); - GlStateManager.translate((float) n4, (float) n5 + 0.3, (float) n6); - GlStateManager.rotate(-mc.getRenderManager().playerViewY, 0.0f, 1.0f, 0.0f); - GlStateManager.rotate(mc.getRenderManager().playerViewX, 1.0f, 0.0f, 0.0f); - float min2 = Math.min(Math.max(0.02266667f, (float) (0.001500000013038516 * n7)), 0.07f); - GlStateManager.scale(-min2, -min2, -min2); - GlStateManager.depthMask(false); - GlStateManager.disableDepth(); - String value = String.valueOf(n3); - mc.fontRendererObj.drawString(value, -(mc.fontRendererObj.getStringWidth(value) / 2) + min2 * 3.5f, -(123.805f * min2 - 2.47494f), n2, true); - GlStateManager.enableDepth(); - GlStateManager.depthMask(true); - GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); - GlStateManager.popMatrix(); - } } diff --git a/src/main/java/keystrokesmod/module/impl/render/MobESP.java b/src/main/java/keystrokesmod/module/impl/render/MobESP.java index 95af7553..a4323067 100644 --- a/src/main/java/keystrokesmod/module/impl/render/MobESP.java +++ b/src/main/java/keystrokesmod/module/impl/render/MobESP.java @@ -2,8 +2,8 @@ import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.ButtonSetting; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.render.RenderUtils; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.*; diff --git a/src/main/java/keystrokesmod/module/impl/render/Nametags.java b/src/main/java/keystrokesmod/module/impl/render/Nametags.java index 07139d0e..d6993904 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Nametags.java +++ b/src/main/java/keystrokesmod/module/impl/render/Nametags.java @@ -5,9 +5,11 @@ import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.DescriptionSetting; import keystrokesmod.module.setting.impl.SliderSetting; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Utils; -import net.minecraft.client.renderer.*; +import keystrokesmod.utility.render.RenderUtils; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; @@ -74,8 +76,7 @@ public void onRenderLiving(RenderLivingEvent.Specials.@NotNull Pre> e) { String name; if (removeTags.isToggled()) { name = entityPlayer.getName(); - } - else { + } else { name = entityPlayer.getDisplayName().getFormattedText(); } if (showHealth.isToggled()) { @@ -89,14 +90,11 @@ public void onRenderLiving(RenderLivingEvent.Specials.@NotNull Pre> e) { String color = "§"; if (distance <= 8) { color += "c"; - } - else if (distance <= 15) { + } else if (distance <= 15) { color += "6"; - } - else if (distance <= 25) { + } else if (distance <= 25) { color += "e"; - } - else { + } else { color = ""; } name = color + distance + "m§r " + name; @@ -107,8 +105,7 @@ else if (distance <= 25) { GlStateManager.rotate(-mc.getRenderManager().playerViewY, 0.0f, 1.0f, 0.0f); if (entityPlayer == mc.thePlayer && mc.gameSettings.thirdPersonView == 2) { GlStateManager.rotate(-mc.getRenderManager().playerViewX, 1.0f, 0.0f, 0.0f); - } - else { + } else { GlStateManager.rotate(mc.getRenderManager().playerViewX, 1.0f, 0.0f, 0.0f); } final float n = 0.02666667f; @@ -143,8 +140,7 @@ else if (distance <= 25) { int y2 = 8; if (Utils.isFriended(entityPlayer)) { RenderUtils.drawOutline(x1, y1, x2, y2, 2, friendColor); - } - else if (Utils.isEnemy(entityPlayer)) { + } else if (Utils.isEnemy(entityPlayer)) { RenderUtils.drawOutline(x1, y1, x2, y2, 2, enemyColor); } if (drawBackground.isToggled()) { @@ -254,8 +250,7 @@ private void renderText(@NotNull ItemStack stack, int xPos) { if (unbreakingLvl > 0) { mc.fontRendererObj.drawString("ub" + unbreakingLvl, (float) (xPos * 2), (float) newYPos, -1, dropShadow.isToggled()); } - } - else if (stack.getItem() instanceof ItemBow) { + } else if (stack.getItem() instanceof ItemBow) { int powerLvl = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack); int punchLvl = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, stack); int flameLvl = EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, stack); @@ -278,8 +273,7 @@ else if (stack.getItem() instanceof ItemBow) { if (unbreakingLvl > 0) { mc.fontRendererObj.drawString("ub" + unbreakingLvl, (float) (xPos * 2), (float) newYPos, -1, dropShadow.isToggled()); } - } - else if (stack.getItem() instanceof ItemSword) { + } else if (stack.getItem() instanceof ItemSword) { int sharpnessLvl = EnchantmentHelper.getEnchantmentLevel(Enchantment.sharpness.effectId, stack); int knockbackLvl = EnchantmentHelper.getEnchantmentLevel(Enchantment.knockback.effectId, stack); int fireAspectLvl = EnchantmentHelper.getEnchantmentLevel(Enchantment.fireAspect.effectId, stack); @@ -302,8 +296,7 @@ else if (stack.getItem() instanceof ItemSword) { if (unbreakingLvl > 0) { mc.fontRendererObj.drawString("ub" + unbreakingLvl, (float) (xPos * 2), (float) newYPos, -1, dropShadow.isToggled()); } - } - else if (stack.getItem() instanceof ItemTool) { + } else if (stack.getItem() instanceof ItemTool) { int unbreakingLvl = EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack); int efficiencyLvl = EnchantmentHelper.getEnchantmentLevel(Enchantment.efficiency.effectId, stack); int fortuneLvl = EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack); diff --git a/src/main/java/keystrokesmod/module/impl/render/NoHurtCam.java b/src/main/java/keystrokesmod/module/impl/render/NoHurtCam.java index ed084968..4955434e 100644 --- a/src/main/java/keystrokesmod/module/impl/render/NoHurtCam.java +++ b/src/main/java/keystrokesmod/module/impl/render/NoHurtCam.java @@ -9,8 +9,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class NoHurtCam extends Module { - public SliderSetting multiplier; private final ButtonSetting noHurtAnime; + public SliderSetting multiplier; public NoHurtCam() { super("NoHurtCam", category.render); diff --git a/src/main/java/keystrokesmod/module/impl/render/PlayerESP.java b/src/main/java/keystrokesmod/module/impl/render/PlayerESP.java index ddc4de18..d3e722e5 100644 --- a/src/main/java/keystrokesmod/module/impl/render/PlayerESP.java +++ b/src/main/java/keystrokesmod/module/impl/render/PlayerESP.java @@ -8,9 +8,9 @@ import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.DescriptionSetting; import keystrokesmod.module.setting.impl.SliderSetting; +import keystrokesmod.utility.Utils; import keystrokesmod.utility.render.ColorUtils; import keystrokesmod.utility.render.RenderUtils; -import keystrokesmod.utility.Utils; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraftforge.client.event.RenderWorldLastEvent; @@ -19,25 +19,24 @@ import java.awt.*; public class PlayerESP extends Module { - public SliderSetting red; - public SliderSetting green; - public SliderSetting blue; - public ButtonSetting colorByName; - public ButtonSetting rainbow; private final ButtonSetting twoD; private final ButtonSetting arrow; private final ButtonSetting box; private final ButtonSetting health; - public ButtonSetting outline; private final ButtonSetting shaded; private final ButtonSetting ring; private final SliderSetting expand; private final SliderSetting xShift; private final ButtonSetting redOnDamage; private final ButtonSetting showInvis; - private int rgb = 0; - private final Object2IntOpenHashMap targets = new Object2IntOpenHashMap<>(5); + public SliderSetting red; + public SliderSetting green; + public SliderSetting blue; + public ButtonSetting colorByName; + public ButtonSetting rainbow; + public ButtonSetting outline; + private int rgb = 0; public PlayerESP() { super("PlayerESP", category.render, 0); @@ -60,6 +59,14 @@ public PlayerESP() { this.registerSetting(showInvis = new ButtonSetting("Show invis", true)); } + public static int getColorFromTags(String displayName) { + displayName = Utils.removeFormatCodes(displayName); + if (displayName.isEmpty() || !displayName.startsWith("§") || displayName.charAt(1) == 'f') { + return new Color(255, 255, 255).getRGB(); + } + return ColorUtils.getColorFromCode(displayName).getRGB(); + } + @Override public void onDisable() { RenderUtils.ring_c = false; @@ -136,12 +143,4 @@ private void render(Entity en, int rgb) { RenderUtils.renderEntity(en, 6, expand.getInput(), xShift.getInput(), rgb, redOnDamage.isToggled()); } } - - public static int getColorFromTags(String displayName) { - displayName = Utils.removeFormatCodes(displayName); - if (displayName.isEmpty() || !displayName.startsWith("§") || displayName.charAt(1) == 'f') { - return new Color(255, 255, 255).getRGB(); - } - return ColorUtils.getColorFromCode(displayName).getRGB(); - } } diff --git a/src/main/java/keystrokesmod/module/impl/render/Radar.java b/src/main/java/keystrokesmod/module/impl/render/Radar.java index d4ddd1e0..df3b5bf5 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Radar.java +++ b/src/main/java/keystrokesmod/module/impl/render/Radar.java @@ -4,8 +4,8 @@ import keystrokesmod.module.Module; import keystrokesmod.module.impl.world.AntiBot; import keystrokesmod.module.setting.impl.ButtonSetting; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.render.RenderUtils; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.entity.player.EntityPlayer; @@ -16,9 +16,10 @@ import java.awt.*; public class Radar extends Module { - private ButtonSetting tracerLines; + private final ButtonSetting tracerLines; private int scale = 2; - private int rectColor = new Color(0, 0, 0, 125).getRGB(); + private final int rectColor = new Color(0, 0, 0, 125).getRGB(); + public Radar() { super("Radar", category.render); this.registerSetting(tracerLines = new ButtonSetting("Show tracer lines", false)); @@ -48,7 +49,7 @@ public void onRenderTick(TickEvent.RenderTickEvent e) { Gui.drawRect(n - 1, n4, n3 + 1, n4 + 1, -1); Gui.drawRect(n - 1, n2, n, n4, -1); Gui.drawRect(n3, n2, n3 + 1, n4, -1); - RenderUtils.drawPolygon((double)(n3 / 2 + 3), (double)(n2 + 52), 5.0, 3, -1); + RenderUtils.drawPolygon(n3 / 2 + 3, n2 + 52, 5.0, 3, -1); GL11.glPushMatrix(); GL11.glEnable(3089); GL11.glScissor(n * this.scale, mc.displayHeight - this.scale * 170, n3 * this.scale - this.scale * 5, this.scale * 100); @@ -76,8 +77,8 @@ public void onRenderTick(TickEvent.RenderTickEvent e) { GL11.glLineWidth(0.5f); GL11.glColor3d(1.0, 1.0, 1.0); GL11.glBegin(2); - GL11.glVertex2d((double)(n3 / 2 + 3), (double)(n2 + 52)); - GL11.glVertex2d((double)(n3 / 2 + 3) - n7, (double)(n2 + 52) - n8); + GL11.glVertex2d(n3 / 2 + 3, n2 + 52); + GL11.glVertex2d((double) (n3 / 2 + 3) - n7, (double) (n2 + 52) - n8); GL11.glEnd(); GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); GL11.glDisable(3042); @@ -87,7 +88,7 @@ public void onRenderTick(TickEvent.RenderTickEvent e) { GL11.glDisable(3042); GL11.glPopMatrix(); } - RenderUtils.drawPolygon((double)(n3 / 2 + 3) - n7, (double)(n2 + 52) - n8, 3.0, 4, Color.red.getRGB()); + RenderUtils.drawPolygon((double) (n3 / 2 + 3) - n7, (double) (n2 + 52) - n8, 3.0, 4, Color.red.getRGB()); } } GL11.glDisable(3089); diff --git a/src/main/java/keystrokesmod/module/impl/render/Shaders.java b/src/main/java/keystrokesmod/module/impl/render/Shaders.java index f0389417..36c2f251 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Shaders.java +++ b/src/main/java/keystrokesmod/module/impl/render/Shaders.java @@ -11,6 +11,7 @@ public class Shaders extends Module { private ModeSetting shader; private String[] shaderNames; private ResourceLocation[] shaderLocations; + public Shaders() { super("Shaders", category.render); try { @@ -19,8 +20,7 @@ public Shaders() { for (int i = 0; i < shaderLocations.length; ++i) { shaderNames[i] = ((String[]) shaderLocations[i].getResourcePath().replaceFirst("shaders/post/", "").split("\\.json"))[0].toUpperCase(); } - } - catch (IllegalAccessException ex) { + } catch (IllegalAccessException ex) { ex.printStackTrace(); return; } @@ -35,12 +35,10 @@ public void onUpdate() { if (Reflection.shaderIndex.getInt(mc.entityRenderer) != (int) shader.getInput()) { Reflection.shaderIndex.setInt(mc.entityRenderer, (int) shader.getInput()); Reflection.loadShader.invoke(mc.entityRenderer, shaderLocations[(int) shader.getInput()]); - } - else if (!Reflection.useShader.getBoolean(mc.entityRenderer)) { + } else if (!Reflection.useShader.getBoolean(mc.entityRenderer)) { Reflection.useShader.setBoolean(mc.entityRenderer, true); } - } - catch (Exception ex) { + } catch (Exception ex) { ex.printStackTrace(); Utils.sendMessage("&cError loading shader."); this.disable(); diff --git a/src/main/java/keystrokesmod/module/impl/render/TargetESP.java b/src/main/java/keystrokesmod/module/impl/render/TargetESP.java index d51cace4..5e0abba1 100644 --- a/src/main/java/keystrokesmod/module/impl/render/TargetESP.java +++ b/src/main/java/keystrokesmod/module/impl/render/TargetESP.java @@ -10,17 +10,15 @@ import keystrokesmod.module.setting.impl.ModeValue; import keystrokesmod.utility.Utils; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.MovingObjectPosition; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.entity.player.AttackEntityEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.Nullable; public class TargetESP extends Module { + private static @Nullable EntityLivingBase target = null; private final ModeValue mode; private final ButtonSetting onlyKillAura; - - private static @Nullable EntityLivingBase target = null; private long lastTargetTime = -1; public TargetESP() { diff --git a/src/main/java/keystrokesmod/module/impl/render/TargetHUD.java b/src/main/java/keystrokesmod/module/impl/render/TargetHUD.java index 8820a90d..5f179f41 100644 --- a/src/main/java/keystrokesmod/module/impl/render/TargetHUD.java +++ b/src/main/java/keystrokesmod/module/impl/render/TargetHUD.java @@ -18,14 +18,13 @@ public class TargetHUD extends Module { public static int posX = 70; public static int posY = 30; - private static ModeValue mode; - private final ButtonSetting onlyKillAura; - public static int current$minX; public static int current$maxX; public static int current$minY; public static int current$maxY; + private static ModeValue mode; private static @Nullable EntityLivingBase target = null; + private final ButtonSetting onlyKillAura; private long lastTargetTime = -1; public TargetHUD() { @@ -41,6 +40,26 @@ public TargetHUD() { this.registerSetting(onlyKillAura = new ButtonSetting("Only killAura", true)); } + private static void render(EntityLivingBase target) { + if (target != null) { + final ScaledResolution scaledResolution = new ScaledResolution(mc); + final int n2 = 8; + final int n3 = mc.fontRendererObj.getStringWidth(target.getDisplayName().getFormattedText()) + n2; + final int n4 = scaledResolution.getScaledWidth() / 2 - n3 / 2 + posX; + final int n5 = scaledResolution.getScaledHeight() / 2 + 15 + posY; + current$minX = n4 - n2; + current$minY = n5 - n2; + current$maxX = n4 + n3; + current$maxY = n5 + (mc.fontRendererObj.FONT_HEIGHT + 5) - 6 + n2; + + ((ITargetVisual) mode.getSubModeValues().get((int) mode.getInput())).render(target); + } + } + + public static void renderExample() { + render(mc.thePlayer); + } + @Override public void onEnable() { mode.enable(); @@ -104,24 +123,4 @@ public void onRender(TickEvent.RenderTickEvent event) { } render(target); } - - private static void render(EntityLivingBase target) { - if (target != null) { - final ScaledResolution scaledResolution = new ScaledResolution(mc); - final int n2 = 8; - final int n3 = mc.fontRendererObj.getStringWidth(target.getDisplayName().getFormattedText()) + n2; - final int n4 = scaledResolution.getScaledWidth() / 2 - n3 / 2 + posX; - final int n5 = scaledResolution.getScaledHeight() / 2 + 15 + posY; - current$minX = n4 - n2; - current$minY = n5 - n2; - current$maxX = n4 + n3; - current$maxY = n5 + (mc.fontRendererObj.FONT_HEIGHT + 5) - 6 + n2; - - ((ITargetVisual) mode.getSubModeValues().get((int) mode.getInput())).render(target); - } - } - - public static void renderExample() { - render(mc.thePlayer); - } } \ No newline at end of file diff --git a/src/main/java/keystrokesmod/module/impl/render/Tracers.java b/src/main/java/keystrokesmod/module/impl/render/Tracers.java index 50cb1f93..4819af2a 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Tracers.java +++ b/src/main/java/keystrokesmod/module/impl/render/Tracers.java @@ -1,14 +1,11 @@ package keystrokesmod.module.impl.render; -import keystrokesmod.Raven; import keystrokesmod.module.Module; import keystrokesmod.module.impl.world.AntiBot; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Utils; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; +import keystrokesmod.utility.render.RenderUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; diff --git a/src/main/java/keystrokesmod/module/impl/render/Trajectories.java b/src/main/java/keystrokesmod/module/impl/render/Trajectories.java index 113cf328..34686e76 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Trajectories.java +++ b/src/main/java/keystrokesmod/module/impl/render/Trajectories.java @@ -3,13 +3,16 @@ import keystrokesmod.module.Module; import keystrokesmod.module.impl.world.AntiBot; import keystrokesmod.module.setting.impl.ButtonSetting; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.render.RenderUtils; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.*; -import net.minecraft.util.*; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.lwjgl.opengl.GL11; @@ -17,10 +20,11 @@ import java.awt.*; public class Trajectories extends Module { + private static final int HIGHLIGHT_COLOR = new Color(234, 38, 38).getRGB(); private final ButtonSetting autoScale; private final ButtonSetting disableUncharged; private final ButtonSetting highlightOnEntity; - private static final int HIGHLIGHT_COLOR = new Color(234, 38, 38).getRGB(); + public Trajectories() { super("Trajectories", category.render); this.registerSetting(autoScale = new ButtonSetting("Auto-scale", true)); @@ -45,20 +49,20 @@ public void onRenderWorldLast(RenderWorldLastEvent e) { float playerYaw = mc.thePlayer.rotationYaw; float playerPitch = mc.thePlayer.rotationPitch; - double posX = mc.getRenderManager().viewerPosX - (double)(MathHelper.cos(playerYaw / 180.0f * (float)Math.PI) * 0.16f); - double posY = mc.getRenderManager().viewerPosY + (double)mc.thePlayer.getEyeHeight() - (double)0.1f; - double posZ = mc.getRenderManager().viewerPosZ - (double)(MathHelper.sin(playerYaw / 180.0f * (float)Math.PI) * 0.16f); + double posX = mc.getRenderManager().viewerPosX - (double) (MathHelper.cos(playerYaw / 180.0f * (float) Math.PI) * 0.16f); + double posY = mc.getRenderManager().viewerPosY + (double) mc.thePlayer.getEyeHeight() - (double) 0.1f; + double posZ = mc.getRenderManager().viewerPosZ - (double) (MathHelper.sin(playerYaw / 180.0f * (float) Math.PI) * 0.16f); - double motionX = (double)(-MathHelper.sin(playerYaw / 180.0f * (float)Math.PI) * MathHelper.cos(playerPitch / 180.0f * (float)Math.PI)) * (bow ? 1.0 : 0.4); - double motionY = (double)(-MathHelper.sin(playerPitch / 180.0f * (float)Math.PI)) * (bow ? 1.0 : 0.4); - double motionZ = (double)(MathHelper.cos(playerYaw / 180.0f * (float)Math.PI) * MathHelper.cos(playerPitch / 180.0f * (float)Math.PI)) * (bow ? 1.0 : 0.4); + double motionX = (double) (-MathHelper.sin(playerYaw / 180.0f * (float) Math.PI) * MathHelper.cos(playerPitch / 180.0f * (float) Math.PI)) * (bow ? 1.0 : 0.4); + double motionY = (double) (-MathHelper.sin(playerPitch / 180.0f * (float) Math.PI)) * (bow ? 1.0 : 0.4); + double motionZ = (double) (MathHelper.cos(playerYaw / 180.0f * (float) Math.PI) * MathHelper.cos(playerPitch / 180.0f * (float) Math.PI)) * (bow ? 1.0 : 0.4); int itemInUse = 40; if (mc.thePlayer.getItemInUseCount() > 0 && bow) { itemInUse = mc.thePlayer.getItemInUseCount(); } int n10 = 72000 - itemInUse; - float f10 = (float)n10 / 20.0f; - if ((double)(f10 = (f10 * f10 + f10 * 2.0f) / 3.0f) < 0.1) { + float f10 = (float) n10 / 20.0f; + if ((double) (f10 = (f10 * f10 + f10 * 2.0f) / 3.0f) < 0.1) { return; } if (f10 > 1.0f) { @@ -84,9 +88,9 @@ public void onRenderWorldLast(RenderWorldLastEvent e) { motionX /= f11; motionY /= f11; motionZ /= f11; - motionX *= (double)(bow ? f10 * 2.0f : 1.0f) * 1.5; - motionY *= (double)(bow ? f10 * 2.0f : 1.0f) * 1.5; - motionZ *= (double)(bow ? f10 * 2.0f : 1.0f) * 1.5; + motionX *= (double) (bow ? f10 * 2.0f : 1.0f) * 1.5; + motionY *= (double) (bow ? f10 * 2.0f : 1.0f) * 1.5; + motionZ *= (double) (bow ? f10 * 2.0f : 1.0f) * 1.5; GL11.glLineWidth(1.5f); GL11.glBegin(3); boolean ground = false; @@ -118,8 +122,7 @@ public void onRenderWorldLast(RenderWorldLastEvent e) { if (rayTraced != null) { ground = true; target = rayTraced; - } - else { + } else { MovingObjectPosition entityHit = getEntityHit(start, predicted); if (entityHit != null) { target = entityHit; diff --git a/src/main/java/keystrokesmod/module/impl/render/Watermark.java b/src/main/java/keystrokesmod/module/impl/render/Watermark.java index 6c2e12ef..c9a29f37 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Watermark.java +++ b/src/main/java/keystrokesmod/module/impl/render/Watermark.java @@ -27,7 +27,7 @@ import java.util.Objects; public class Watermark extends Module { - public static final String VERSION = "2.11"; + public static final String VERSION = "2.12"; public static final HashMap WATERMARK = new HashMap<>(); public static String customName = "CustomClient"; @@ -125,7 +125,7 @@ public void render() { RenderUtils.drawImage(WATERMARK.get("enders"), posX, posY, 150, 45); break; } - break; + break; } } } diff --git a/src/main/java/keystrokesmod/module/impl/render/Xray.java b/src/main/java/keystrokesmod/module/impl/render/Xray.java index 223f7a27..0592929f 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Xray.java +++ b/src/main/java/keystrokesmod/module/impl/render/Xray.java @@ -4,8 +4,8 @@ import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.BlockUtils; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.render.RenderUtils; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; @@ -19,19 +19,19 @@ import java.util.List; public class Xray extends Module { - private SliderSetting range; - private SliderSetting rate; - private ButtonSetting caveOnly; - private ButtonSetting iron; - private ButtonSetting gold; - private ButtonSetting diamond; - private ButtonSetting emerald; - private ButtonSetting lapis; - private ButtonSetting redstone; - private ButtonSetting coal; - private ButtonSetting spawner; - private ButtonSetting obsidian; - private List blocks = new ArrayList<>(); + private final SliderSetting range; + private final SliderSetting rate; + private final ButtonSetting caveOnly; + private final ButtonSetting iron; + private final ButtonSetting gold; + private final ButtonSetting diamond; + private final ButtonSetting emerald; + private final ButtonSetting lapis; + private final ButtonSetting redstone; + private final ButtonSetting coal; + private final ButtonSetting spawner; + private final ButtonSetting obsidian; + private final List blocks = new ArrayList<>(); private long lastCheck = 0; public Xray() { @@ -78,7 +78,7 @@ public void onUpdate() { } private boolean isNextToAir(BlockPos blockPos) { - BlockPos[] neighbors = new BlockPos[] { + BlockPos[] neighbors = new BlockPos[]{ blockPos.up(), blockPos.down(), blockPos.north(), diff --git a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/ExhibitionTargetHUD.java b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/ExhibitionTargetHUD.java index 7b276f90..b8d3bf3a 100644 --- a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/ExhibitionTargetHUD.java +++ b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/ExhibitionTargetHUD.java @@ -19,12 +19,65 @@ public class ExhibitionTargetHUD extends SubMode implements ITargetVisual { private final ModeSetting font; - + public ExhibitionTargetHUD(String name, @NotNull TargetHUD parent) { super(name, parent); this.registerSetting(font = new ModeSetting("Font", new String[]{"Minecraft", "ProductSans", "Regular"}, 0)); } - + + private static Color getColor(@NotNull EntityLivingBase target) { // a VERY retarded way to do health colors :smile: + Color healthColor = new Color(0, 165, 0); //green + if (target.getHealth() < target.getMaxHealth() / 1.5) + healthColor = new Color(200, 200, 0); //yellow + if (target.getHealth() < target.getMaxHealth() / 2.5) + healthColor = new Color(200, 155, 0); //orange + if (target.getHealth() < target.getMaxHealth() / 4) + healthColor = new Color(120, 0, 0); //red + return healthColor; + } + + public static void drawModel(final float yaw, final float pitch, final @NotNull EntityLivingBase entityLivingBase) { //method to draw model (skidded) + GlStateManager.resetColor(); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + GlStateManager.enableColorMaterial(); + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0f, 0.0f, 50.0f); + GlStateManager.scale(-50.0f, 50.0f, 50.0f); + GlStateManager.rotate(180.0f, 0.0f, 0.0f, 1.0f); + final float renderYawOffset = entityLivingBase.renderYawOffset; + final float rotationYaw = entityLivingBase.rotationYaw; + final float rotationPitch = entityLivingBase.rotationPitch; + final float prevRotationYawHead = entityLivingBase.prevRotationYawHead; + final float rotationYawHead = entityLivingBase.rotationYawHead; + GlStateManager.rotate(135.0f, 0.0f, 1.0f, 0.0f); + RenderHelper.enableStandardItemLighting(); + GlStateManager.rotate(-135.0f, 0.0f, 1.0f, 0.0f); + GlStateManager.rotate((float) (-Math.atan(pitch / 40.0f) * 20.0), 1.0f, 0.0f, 0.0f); + entityLivingBase.renderYawOffset = yaw - 0.4f; + entityLivingBase.rotationYaw = yaw - 0.2f; + entityLivingBase.rotationPitch = pitch; + entityLivingBase.rotationYawHead = entityLivingBase.rotationYaw; + entityLivingBase.prevRotationYawHead = entityLivingBase.rotationYaw; + GlStateManager.translate(0.0f, 0.0f, 0.0f); + final RenderManager renderManager = mc.getRenderManager(); + renderManager.setPlayerViewY(180.0f); + renderManager.setRenderShadow(false); + renderManager.renderEntityWithPosYaw(entityLivingBase, 0.0, 0.0, 0.0, 0.0f, 1.0f); + renderManager.setRenderShadow(true); + entityLivingBase.renderYawOffset = renderYawOffset; + entityLivingBase.rotationYaw = rotationYaw; + entityLivingBase.rotationPitch = rotationPitch; + entityLivingBase.prevRotationYawHead = prevRotationYawHead; + entityLivingBase.rotationYawHead = rotationYawHead; + GlStateManager.popMatrix(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableRescaleNormal(); + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.disableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + GlStateManager.resetColor(); + } + private IFont getFont() { switch ((int) font.getInput()) { default: @@ -103,57 +156,4 @@ public void render(@NotNull EntityLivingBase target) { GlStateManager.popMatrix(); //more gay shit } } - - private static Color getColor(@NotNull EntityLivingBase target) { // a VERY retarded way to do health colors :smile: - Color healthColor = new Color(0, 165, 0); //green - if (target.getHealth() < target.getMaxHealth() / 1.5) - healthColor = new Color(200, 200, 0); //yellow - if (target.getHealth() < target.getMaxHealth() / 2.5) - healthColor = new Color(200, 155, 0); //orange - if (target.getHealth() < target.getMaxHealth() / 4) - healthColor = new Color(120, 0, 0); //red - return healthColor; - } - - public static void drawModel(final float yaw, final float pitch, final @NotNull EntityLivingBase entityLivingBase) { //method to draw model (skidded) - GlStateManager.resetColor(); - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - GlStateManager.enableColorMaterial(); - GlStateManager.pushMatrix(); - GlStateManager.translate(0.0f, 0.0f, 50.0f); - GlStateManager.scale(-50.0f, 50.0f, 50.0f); - GlStateManager.rotate(180.0f, 0.0f, 0.0f, 1.0f); - final float renderYawOffset = entityLivingBase.renderYawOffset; - final float rotationYaw = entityLivingBase.rotationYaw; - final float rotationPitch = entityLivingBase.rotationPitch; - final float prevRotationYawHead = entityLivingBase.prevRotationYawHead; - final float rotationYawHead = entityLivingBase.rotationYawHead; - GlStateManager.rotate(135.0f, 0.0f, 1.0f, 0.0f); - RenderHelper.enableStandardItemLighting(); - GlStateManager.rotate(-135.0f, 0.0f, 1.0f, 0.0f); - GlStateManager.rotate((float) (-Math.atan(pitch / 40.0f) * 20.0), 1.0f, 0.0f, 0.0f); - entityLivingBase.renderYawOffset = yaw - 0.4f; - entityLivingBase.rotationYaw = yaw - 0.2f; - entityLivingBase.rotationPitch = pitch; - entityLivingBase.rotationYawHead = entityLivingBase.rotationYaw; - entityLivingBase.prevRotationYawHead = entityLivingBase.rotationYaw; - GlStateManager.translate(0.0f, 0.0f, 0.0f); - final RenderManager renderManager = mc.getRenderManager(); - renderManager.setPlayerViewY(180.0f); - renderManager.setRenderShadow(false); - renderManager.renderEntityWithPosYaw(entityLivingBase, 0.0, 0.0, 0.0, 0.0f, 1.0f); - renderManager.setRenderShadow(true); - entityLivingBase.renderYawOffset = renderYawOffset; - entityLivingBase.rotationYaw = rotationYaw; - entityLivingBase.rotationPitch = rotationPitch; - entityLivingBase.prevRotationYawHead = prevRotationYawHead; - entityLivingBase.rotationYawHead = rotationYawHead; - GlStateManager.popMatrix(); - RenderHelper.disableStandardItemLighting(); - GlStateManager.disableRescaleNormal(); - GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); - GlStateManager.disableTexture2D(); - GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); - GlStateManager.resetColor(); - } } diff --git a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/MyauTargetHUD.java b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/MyauTargetHUD.java index 466774ce..ec64ec21 100644 --- a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/MyauTargetHUD.java +++ b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/MyauTargetHUD.java @@ -17,7 +17,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.EntityLivingBase; import org.jetbrains.annotations.NotNull; + import java.awt.*; + import static keystrokesmod.module.impl.render.TargetHUD.*; public class MyauTargetHUD extends SubMode implements ITargetVisual { @@ -62,7 +64,7 @@ public void render(@NotNull EntityLivingBase target) { String TargetHealth = String.format("%.1f", target.getHealth()) + "§c❤ "; if (showStatus.isToggled() && mc.thePlayer != null) { - String status = (health <= Utils.getCompleteHealth(mc.thePlayer) / mc.thePlayer.getMaxHealth())? " §aW" : " §cL"; + String status = (health <= Utils.getCompleteHealth(mc.thePlayer) / mc.thePlayer.getMaxHealth()) ? " §aW" : " §cL"; TargetName = TargetName + status; } @@ -89,7 +91,7 @@ public void render(@NotNull EntityLivingBase target) { RenderUtils.drawRect(n13, n15, n14, n15 + 4, Utils.merge(Color.black.getRGB(), n11)); - float healthBar = (float) (int) (n14 + (n13 - n14) * (1.0 - ((health < 0.01)? 0 : health))); + float healthBar = (float) (int) (n14 + (n13 - n14) * (1.0 - ((health < 0.01) ? 0 : health))); if (healthBar - n13 < 1) { healthBar = n13; } diff --git a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/RavenNewTargetHUD.java b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/RavenNewTargetHUD.java index eafeeed9..a175c042 100644 --- a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/RavenNewTargetHUD.java +++ b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/RavenNewTargetHUD.java @@ -9,12 +9,16 @@ import keystrokesmod.utility.Utils; import keystrokesmod.utility.font.FontManager; import keystrokesmod.utility.font.IFont; -import keystrokesmod.utility.render.*; +import keystrokesmod.utility.render.Animation; +import keystrokesmod.utility.render.Easing; +import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.render.blur.GaussianBlur; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.entity.EntityLivingBase; import org.jetbrains.annotations.NotNull; + import java.awt.*; + import static keystrokesmod.module.impl.render.TargetHUD.*; public class RavenNewTargetHUD extends SubMode implements ITargetVisual { diff --git a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/RavenTargetHUD.java b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/RavenTargetHUD.java index 0c656f89..179164bb 100644 --- a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/RavenTargetHUD.java +++ b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/RavenTargetHUD.java @@ -16,7 +16,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.EntityLivingBase; import org.jetbrains.annotations.NotNull; + import java.awt.*; + import static keystrokesmod.module.impl.render.TargetHUD.*; public class RavenTargetHUD extends SubMode implements ITargetVisual { @@ -90,7 +92,7 @@ public void render(@NotNull EntityLivingBase target) { float lastHealthBar = (float) healthBarAnimation.getValue(); if (animation.isToggled()) { - healthBarAnimation.run(healthBar); + healthBarAnimation.run(healthBar); } else { lastHealthBar = healthBar; } diff --git a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/TestTargetHUD.java b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/TestTargetHUD.java index 3611eb1d..b9137b0a 100644 --- a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/TestTargetHUD.java +++ b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/TestTargetHUD.java @@ -17,7 +17,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.EntityLivingBase; import org.jetbrains.annotations.NotNull; + import java.awt.*; + import static keystrokesmod.module.impl.render.TargetHUD.*; public class TestTargetHUD extends SubMode implements ITargetVisual { diff --git a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/WurstTargetHUD.java b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/WurstTargetHUD.java index 9a7e6951..15934e4d 100644 --- a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/WurstTargetHUD.java +++ b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/WurstTargetHUD.java @@ -39,7 +39,7 @@ public void render(@NotNull EntityLivingBase target) { double x = TargetHUD.current$minX; double y = TargetHUD.current$minY; - RenderUtils.drawRect(x, y, x + 185, y + 34, new Color(255, 255, 255, 100).getRGB()); + RenderUtils.drawRect(x, y, x + 185, y + 34, new Color(255, 255, 255, 100).getRGB()); getFont().drawString("Name: " + name, x + 4, y + 4, Color.BLACK.getRGB()); double health = Math.min(Math.round(target.getHealth()), target.getMaxHealth()); diff --git a/src/main/java/keystrokesmod/module/impl/world/AntiBot.java b/src/main/java/keystrokesmod/module/impl/world/AntiBot.java index cb7176cf..5df54d00 100644 --- a/src/main/java/keystrokesmod/module/impl/world/AntiBot.java +++ b/src/main/java/keystrokesmod/module/impl/world/AntiBot.java @@ -24,7 +24,9 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; -import java.util.*; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.stream.Collectors; public class AntiBot extends Module { @@ -57,60 +59,6 @@ public AntiBot() { this.registerSetting(whitelistChicken = new ButtonSetting("Whitelist chickens", false)); } - @SubscribeEvent - public void c(final EntityJoinWorldEvent entityJoinWorldEvent) { - if (entitySpawnDelay.isToggled() && entityJoinWorldEvent.entity instanceof EntityPlayer && entityJoinWorldEvent.entity != mc.thePlayer) { - entities.put((EntityPlayer) entityJoinWorldEvent.entity, System.currentTimeMillis()); - } - } - - @SubscribeEvent - public void onSendPacket(SendPacketEvent event) { - if (cancelBotHit.isToggled() && event.getPacket() instanceof C02PacketUseEntity) { - C02PacketUseEntity packet = (C02PacketUseEntity) event.getPacket(); - if (packet.getAction() == C02PacketUseEntity.Action.ATTACK) { - if (isBot(packet.getEntityFromWorld(mc.theWorld))) { - event.setCanceled(true); - } - } - } - } - - public void onUpdate() { - if (entitySpawnDelay.isToggled() && !entities.isEmpty()) { - entities.values().removeIf(n -> n < System.currentTimeMillis() - delay.getInput()); - } - - lastPlayers.clear(); - for (EntityPlayer p : mc.theWorld.playerEntities) { - if (filteredBot.contains(p)) continue; - - String name = p.getName(); - if (lastPlayers.containsKey(name)) { - if (debug.isToggled()) Utils.sendMessage("Filtered bot: " + p.getName() + "."); - - EntityPlayer exists = lastPlayers.get(name); - Vec3 thePlayer = new Vec3(mc.thePlayer); - double existsDistance = thePlayer.distanceTo(exists); - double curDistance = thePlayer.distanceTo(p); - - if (existsDistance > curDistance) { - filteredBot.add(p); - } else { - filteredBot.add(exists); - } - break; - } - lastPlayers.put(name, p); - } - } - - public void onDisable() { - entities.clear(); - filteredBot.clear(); - lastPlayers.clear(); - } - public static boolean isBot(Entity entity) { if (!ModuleManager.antiBot.isEnabled()) { return false; @@ -187,4 +135,58 @@ public static boolean isBot(Entity entity) { .map(GameProfile::getName) .collect(Collectors.toList()); } + + @SubscribeEvent + public void c(final EntityJoinWorldEvent entityJoinWorldEvent) { + if (entitySpawnDelay.isToggled() && entityJoinWorldEvent.entity instanceof EntityPlayer && entityJoinWorldEvent.entity != mc.thePlayer) { + entities.put((EntityPlayer) entityJoinWorldEvent.entity, System.currentTimeMillis()); + } + } + + @SubscribeEvent + public void onSendPacket(SendPacketEvent event) { + if (cancelBotHit.isToggled() && event.getPacket() instanceof C02PacketUseEntity) { + C02PacketUseEntity packet = (C02PacketUseEntity) event.getPacket(); + if (packet.getAction() == C02PacketUseEntity.Action.ATTACK) { + if (isBot(packet.getEntityFromWorld(mc.theWorld))) { + event.setCanceled(true); + } + } + } + } + + public void onUpdate() { + if (entitySpawnDelay.isToggled() && !entities.isEmpty()) { + entities.values().removeIf(n -> n < System.currentTimeMillis() - delay.getInput()); + } + + lastPlayers.clear(); + for (EntityPlayer p : mc.theWorld.playerEntities) { + if (filteredBot.contains(p)) continue; + + String name = p.getName(); + if (lastPlayers.containsKey(name)) { + if (debug.isToggled()) Utils.sendMessage("Filtered bot: " + p.getName() + "."); + + EntityPlayer exists = lastPlayers.get(name); + Vec3 thePlayer = new Vec3(mc.thePlayer); + double existsDistance = thePlayer.distanceTo(exists); + double curDistance = thePlayer.distanceTo(p); + + if (existsDistance > curDistance) { + filteredBot.add(p); + } else { + filteredBot.add(exists); + } + break; + } + lastPlayers.put(name, p); + } + } + + public void onDisable() { + entities.clear(); + filteredBot.clear(); + lastPlayers.clear(); + } } diff --git a/src/main/java/keystrokesmod/module/impl/world/AutoPlace.java b/src/main/java/keystrokesmod/module/impl/world/AutoPlace.java index b5df9246..64133ba0 100644 --- a/src/main/java/keystrokesmod/module/impl/world/AutoPlace.java +++ b/src/main/java/keystrokesmod/module/impl/world/AutoPlace.java @@ -90,8 +90,7 @@ private void action() { if (fastPlaceJump.isToggled() && holdRight.isToggled() && !ModuleManager.fastPlace.isEnabled() && Mouse.isButtonDown(1)) { if (mc.thePlayer.motionY > 0.0) { this.rd(1); - } - else if (!pitchCheck.isToggled()) { + } else if (!pitchCheck.isToggled()) { this.rd(1000); } } diff --git a/src/main/java/keystrokesmod/module/impl/world/AutoTool.java b/src/main/java/keystrokesmod/module/impl/world/AutoTool.java index d95a6b6b..d6f3c324 100644 --- a/src/main/java/keystrokesmod/module/impl/world/AutoTool.java +++ b/src/main/java/keystrokesmod/module/impl/world/AutoTool.java @@ -19,6 +19,7 @@ public class AutoTool extends Module { private int previousSlot = -1; private int ticksHovered; private BlockPos currentBlock; + public AutoTool() { super("AutoTool", category.world); this.registerSetting(hoverDelay = new SliderSetting("Hover delay", 0.0, 0.0, 20.0, 1.0)); @@ -56,8 +57,7 @@ public void onUpdate() { } if (over.getBlockPos().equals(currentBlock)) { ticksHovered++; - } - else { + } else { ticksHovered = 0; } currentBlock = over.getBlockPos(); diff --git a/src/main/java/keystrokesmod/module/impl/world/AutoWeapon.java b/src/main/java/keystrokesmod/module/impl/world/AutoWeapon.java index 611403c9..1c32550f 100644 --- a/src/main/java/keystrokesmod/module/impl/world/AutoWeapon.java +++ b/src/main/java/keystrokesmod/module/impl/world/AutoWeapon.java @@ -1,7 +1,6 @@ package keystrokesmod.module.impl.world; import keystrokesmod.event.PreMotionEvent; -import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.module.Module; import keystrokesmod.module.impl.other.SlotHandler; import keystrokesmod.module.setting.impl.ButtonSetting; @@ -12,7 +11,6 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.input.Mouse; @@ -24,6 +22,7 @@ public class AutoWeapon extends Module { private int previousSlot = -1; private int ticksHovered; private Entity currentEntity; + public AutoWeapon() { super("AutoWeapon", category.world); this.registerSetting(hoverDelay = new SliderSetting("Hover delay", 0.0, 0.0, 20.0, 1.0)); @@ -74,6 +73,7 @@ public void onPreMotion(PreMotionEvent e) { } } } + private void resetVariables() { ticksHovered = 0; resetSlot(); diff --git a/src/main/java/keystrokesmod/module/impl/world/BedAura.java b/src/main/java/keystrokesmod/module/impl/world/BedAura.java index f3ed22e9..b4d004c1 100644 --- a/src/main/java/keystrokesmod/module/impl/world/BedAura.java +++ b/src/main/java/keystrokesmod/module/impl/world/BedAura.java @@ -11,7 +11,10 @@ import keystrokesmod.module.setting.impl.ModeSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.script.classes.Vec3; -import keystrokesmod.utility.*; +import keystrokesmod.utility.BlockUtils; +import keystrokesmod.utility.RotationUtils; +import keystrokesmod.utility.Theme; +import keystrokesmod.utility.Utils; import keystrokesmod.utility.render.RenderUtils; import net.minecraft.block.Block; import net.minecraft.block.BlockBed; @@ -39,40 +42,39 @@ import java.util.Map; public class BedAura extends Module { - public ModeSetting mode; private final SliderSetting breakSpeed; private final SliderSetting fov; private final SliderSetting range; private final SliderSetting rate; private final ButtonSetting lobbyCheck; - public ButtonSetting allowAura; private final ButtonSetting breakNearBlock; private final ButtonSetting cancelKnockback; private final ButtonSetting disableBreakEffects; - public ButtonSetting groundSpoof; - public ButtonSetting ignoreSlow; private final ButtonSetting onlyWhileVisible; private final ButtonSetting renderOutline; private final ButtonSetting sendAnimations; private final ButtonSetting silentSwing; private final ButtonSetting rotation; - private final String[] modes = new String[]{"Legit", "Instant", "Swap"}; - private BlockPos[] bedPos; + private final Map breakProgressMap = new HashMap<>(); + private final int defaultOutlineColor = new Color(226, 65, 65).getRGB(); + public ModeSetting mode; + public ButtonSetting allowAura; + public ButtonSetting groundSpoof; + public ButtonSetting ignoreSlow; public double breakProgress; - private int currentSlot = -1; - private int lastSlot = -1; public boolean rotate; public BlockPos currentBlock; - private long lastCheck = 0; public boolean stopAutoblock; + public double lastProgress; + public float vanillaProgress; + private BlockPos[] bedPos; + private int currentSlot = -1; + private int lastSlot = -1; + private long lastCheck = 0; private int ticksAfterBreak = 0; private boolean delayStart; private BlockPos nearestBlock; - private final Map breakProgressMap = new HashMap<>(); - public double lastProgress; - public float vanillaProgress; - private final int defaultOutlineColor = new Color(226, 65, 65).getRGB(); public BedAura() { super("BedAura", category.world, 0); @@ -140,8 +142,7 @@ public void onPreUpdate(PreUpdateEvent e) { reset(true); return; } - } - else { + } else { if (!(BlockUtils.getBlock(bedPos[0]) instanceof BlockBed) || (currentBlock != null && BlockUtils.replaceable(currentBlock))) { reset(true); return; @@ -155,8 +156,7 @@ public void onPreUpdate(PreUpdateEvent e) { stopAutoblock = true; } return; - } - else { + } else { if (currentSlot != -1 && currentSlot != mc.thePlayer.inventory.currentItem) { stopAutoblock = true; } @@ -164,8 +164,7 @@ public void onPreUpdate(PreUpdateEvent e) { delayStart = false; ticksAfterBreak = 0; } - } - else { + } else { ticksAfterBreak = 0; } @@ -174,8 +173,7 @@ public void onPreUpdate(PreUpdateEvent e) { nearestBlock = getBestBlock(bedPos, true); } breakBlock(nearestBlock); - } - else { + } else { nearestBlock = null; resetSlot(); BlockPos bestBlock = getBestBlock(bedPos, false); @@ -192,8 +190,7 @@ public void onReceivePacket(ReceivePacketEvent e) { if (((S12PacketEntityVelocity) e.getPacket()).getEntityID() == mc.thePlayer.getEntityId()) { e.setCanceled(true); } - } - else if (e.getPacket() instanceof S27PacketExplosion) { + } else if (e.getPacket() instanceof S27PacketExplosion) { e.setCanceled(true); } } @@ -236,11 +233,9 @@ public void onRenderWorld(RenderWorldLastEvent renderWorldLastEvent) { int outlineColor; if (ModuleManager.bedESP != null && ModuleManager.bedESP.isEnabled()) { outlineColor = Theme.getGradient((int) ModuleManager.bedESP.theme.getInput(), 0); - } - else if (ModuleManager.hud != null && ModuleManager.hud.isEnabled()) { + } else if (ModuleManager.hud != null && ModuleManager.hud.isEnabled()) { outlineColor = Theme.getGradient((int) HUD.theme.getInput(), 0); - } - else { + } else { outlineColor = defaultOutlineColor; } RenderUtils.renderBlock(currentBlock, outlineColor, true, false); @@ -251,8 +246,7 @@ private void resetSlot() { stopAutoblock = true; delayStart = true; setPacketSlot(mc.thePlayer.inventory.currentItem); - } - else if (lastSlot != -1) { + } else if (lastSlot != -1) { mc.thePlayer.inventory.currentItem = lastSlot; } } @@ -315,8 +309,7 @@ private BlockPos getBestBlock(BlockPos[] positions, boolean getSurrounding) { closestBlock = offset; } } - } - else { + } else { if (RotationUtils.notInRange(pos, range.getInput())) { continue; } @@ -389,8 +382,7 @@ private void stopBreak(BlockPos blockPos) { private void swing() { if (!silentSwing.isToggled()) { mc.thePlayer.swingItem(); - } - else { + } else { mc.thePlayer.sendQueue.addToSendQueue(new C0APacketAnimation()); } } @@ -425,8 +417,7 @@ private void breakBlock(BlockPos blockPos) { setSlot(Utils.getTool(block)); } startBreak(blockPos); - } - else if (breakProgress >= 1) { + } else if (breakProgress >= 1) { if (mode.getInput() == 2) { ModuleManager.killAura.resetBlinkState(false); setPacketSlot(Utils.getTool(block)); @@ -440,8 +431,7 @@ else if (breakProgress >= 1) { mc.playerController.onPlayerDestroyBlock(blockPos, EnumFacing.UP); } return; - } - else { + } else { if (mode.getInput() == 0) { stopAutoblock = true; rotate = true; @@ -461,8 +451,7 @@ else if (breakProgress >= 1) { while (lastProgress + progress < 1) { lastProgress += progress; } - } - else if (mode.getInput() == 1) { + } else if (mode.getInput() == 1) { stopAutoblock = true; rotate = true; if (!silentSwing.isToggled()) { @@ -487,7 +476,7 @@ private void setSlot(int slot) { private boolean isCovered(BlockPos blockPos) { for (EnumFacing enumFacing : EnumFacing.values()) { BlockPos offset = blockPos.offset(enumFacing); - if (BlockUtils.replaceable(offset) || BlockUtils.notFull(BlockUtils.getBlock(offset)) ) { + if (BlockUtils.replaceable(offset) || BlockUtils.notFull(BlockUtils.getBlock(offset))) { return false; } } diff --git a/src/main/java/keystrokesmod/module/impl/world/BedDefender.java b/src/main/java/keystrokesmod/module/impl/world/BedDefender.java index e0fb2de1..c2d9125f 100644 --- a/src/main/java/keystrokesmod/module/impl/world/BedDefender.java +++ b/src/main/java/keystrokesmod/module/impl/world/BedDefender.java @@ -26,7 +26,10 @@ import org.apache.commons.lang3.tuple.Triple; import org.jetbrains.annotations.NotNull; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; public class BedDefender extends IAutoClicker { private final ModeValue clickMode; diff --git a/src/main/java/keystrokesmod/module/impl/world/BlockIn.java b/src/main/java/keystrokesmod/module/impl/world/BlockIn.java index 738fa37c..10ec1ffd 100644 --- a/src/main/java/keystrokesmod/module/impl/world/BlockIn.java +++ b/src/main/java/keystrokesmod/module/impl/world/BlockIn.java @@ -13,7 +13,9 @@ import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.utils.ModeOnly; import keystrokesmod.script.classes.Vec3; -import keystrokesmod.utility.*; +import keystrokesmod.utility.BlockUtils; +import keystrokesmod.utility.RotationUtils; +import keystrokesmod.utility.Utils; import keystrokesmod.utility.aim.AimSimulator; import net.minecraft.item.ItemBlock; import net.minecraft.network.play.client.C0APacketAnimation; @@ -24,7 +26,9 @@ import org.apache.commons.lang3.tuple.Triple; import org.jetbrains.annotations.NotNull; -import java.util.*; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; public class BlockIn extends Module { private static final String[] rotationModes = new String[]{"None", "Block", "Strict"}; diff --git a/src/main/java/keystrokesmod/module/impl/world/BridgeAssist.java b/src/main/java/keystrokesmod/module/impl/world/BridgeAssist.java index 6d08eb78..6d6e3cf4 100644 --- a/src/main/java/keystrokesmod/module/impl/world/BridgeAssist.java +++ b/src/main/java/keystrokesmod/module/impl/world/BridgeAssist.java @@ -4,34 +4,33 @@ import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.DescriptionSetting; import keystrokesmod.module.setting.impl.ModeSetting; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.Utils; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; public class BridgeAssist extends Module { + private static final String NORMAL = "Normal"; + private static final String GODBRIDGE = "GodBridge"; + private static final String MOONWALK = "Moonwalk"; + private static final String BREEZILY = "Breezily"; + private static final String[] BridgeModes = new String[]{NORMAL, GODBRIDGE, MOONWALK, BREEZILY}; private final ButtonSetting onSneak; private final SliderSetting waitFor; private final SliderSetting glideTime; private final SliderSetting assistRange; private final DescriptionSetting description; private final ModeSetting assistMode; - private boolean waitingForAim; - private boolean gliding; - private long startWaitTime; private final float[] godbridgePos = {75.6f, -315, -225, -135, -45, 0, 45, 135, 225, 315}; private final float[] moonwalkPos = {79.6f, -340, -290, -250, -200, -160, -110, -70, -20, 0, 20, 70, 110, 160, 200, 250, 290, 340}; private final float[] breezilyPos = {79.9f, -360, -270, -180, -90, 0, 90, 180, 270, 360}; private final float[] normalPos = {78f, -315, -225, -135, -45, 0, 45, 135, 225, 315}; + private boolean waitingForAim; + private boolean gliding; + private long startWaitTime; private double speedYaw, speedPitch; private float waitingForYaw, waitingForPitch; - private static final String NORMAL = "Normal"; - private static final String GODBRIDGE = "GodBridge"; - private static final String MOONWALK = "Moonwalk"; - private static final String BREEZILY = "Breezily"; - private static final String[] BridgeModes = new String[]{NORMAL, GODBRIDGE, MOONWALK, BREEZILY}; - public BridgeAssist() { super("BridgeAssist", Module.category.world); this.registerSetting(description = new DescriptionSetting("Aligns you for bridging")); @@ -174,8 +173,8 @@ else if (assistMode.getInput() == 3) { this.waitingForAim = false; } - public void aimAt(float pitch, float yaw, float fuckedYaw, float fuckedPitch){ - mc.thePlayer.rotationPitch = pitch + ((int)fuckedPitch/360) * 360; + public void aimAt(float pitch, float yaw, float fuckedYaw, float fuckedPitch) { + mc.thePlayer.rotationPitch = pitch + ((int) fuckedPitch / 360) * 360; mc.thePlayer.rotationYaw = yaw; } } \ No newline at end of file diff --git a/src/main/java/keystrokesmod/module/impl/world/Clutch.java b/src/main/java/keystrokesmod/module/impl/world/Clutch.java index 3be4b15a..4eaee4bc 100644 --- a/src/main/java/keystrokesmod/module/impl/world/Clutch.java +++ b/src/main/java/keystrokesmod/module/impl/world/Clutch.java @@ -11,7 +11,10 @@ import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.utils.ModeOnly; import keystrokesmod.script.classes.Vec3; -import keystrokesmod.utility.*; +import keystrokesmod.utility.BlockUtils; +import keystrokesmod.utility.ContainerUtils; +import keystrokesmod.utility.RotationUtils; +import keystrokesmod.utility.Utils; import keystrokesmod.utility.aim.AimSimulator; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; @@ -74,7 +77,8 @@ public void onPreUpdate(PreUpdateEvent event) { double minDistance = Double.MAX_VALUE; Triple bestPlace = null; for (BlockPos block : blocks) { - if (!BlockUtils.replaceable(block) || BlockUtils.isSamePos(block, position) || BlockUtils.isSamePos(block, position.up())) continue; + if (!BlockUtils.replaceable(block) || BlockUtils.isSamePos(block, position) || BlockUtils.isSamePos(block, position.up())) + continue; final Optional> optional = RotationUtils.getPlaceSide(block); if (!optional.isPresent()) continue; diff --git a/src/main/java/keystrokesmod/module/impl/world/FastMine.java b/src/main/java/keystrokesmod/module/impl/world/FastMine.java index 6178cad8..4b3f0403 100644 --- a/src/main/java/keystrokesmod/module/impl/world/FastMine.java +++ b/src/main/java/keystrokesmod/module/impl/world/FastMine.java @@ -15,9 +15,9 @@ public class FastMine extends Module { // from b4 src private final SliderSetting delay; - public SliderSetting multiplier; private final ModeSetting mode; private final ButtonSetting creativeDisable; + public SliderSetting multiplier; private float lastCurBlockDamageMP; public FastMine() { diff --git a/src/main/java/keystrokesmod/module/impl/world/LegitScaffold.java b/src/main/java/keystrokesmod/module/impl/world/LegitScaffold.java index e1864e54..b459a4aa 100644 --- a/src/main/java/keystrokesmod/module/impl/world/LegitScaffold.java +++ b/src/main/java/keystrokesmod/module/impl/world/LegitScaffold.java @@ -1,6 +1,5 @@ package keystrokesmod.module.impl.world; -import keystrokesmod.event.BlockPlaceEvent; import keystrokesmod.mixins.impl.client.KeyBindingAccessor; import keystrokesmod.module.Module; import keystrokesmod.module.impl.other.SlotHandler; diff --git a/src/main/java/keystrokesmod/module/impl/world/SafeWalk.java b/src/main/java/keystrokesmod/module/impl/world/SafeWalk.java index 0c2451e2..92ed4060 100644 --- a/src/main/java/keystrokesmod/module/impl/world/SafeWalk.java +++ b/src/main/java/keystrokesmod/module/impl/world/SafeWalk.java @@ -16,9 +16,9 @@ import org.lwjgl.input.Keyboard; public class SafeWalk extends Module { + private static ButtonSetting shift, blocksOnly, pitchCheck, disableOnForward; private final SliderSetting shiftDelay; private final SliderSetting motion; - private static ButtonSetting shift, blocksOnly, pitchCheck, disableOnForward; public ButtonSetting tower; private boolean isSneaking; private long b = 0L; @@ -34,6 +34,22 @@ public SafeWalk() { this.registerSetting(tower = new ButtonSetting("Tower", false)); } + public static boolean canSafeWalk() { + if (ModuleManager.safeWalk != null && ModuleManager.safeWalk.isEnabled()) { + if (disableOnForward.isToggled() && Keyboard.isKeyDown(mc.gameSettings.keyBindForward.getKeyCode())) { + return false; + } + if (pitchCheck.isToggled() && mc.thePlayer.rotationPitch < 70) { + return false; + } + if (blocksOnly.isToggled() && (mc.thePlayer.getHeldItem() == null || !(mc.thePlayer.getHeldItem().getItem() instanceof ItemBlock))) { + return false; + } + return true; + } + return false; + } + public void onDisable() { if (shift.isToggled() && Utils.overAir()) { this.setSneakState(false); @@ -100,8 +116,7 @@ private void setSneakState(boolean down) { if (down) { return; } - } - else if (!down) { + } else if (!down) { return; } if (down) { @@ -112,8 +127,7 @@ else if (!down) { } this.b = System.currentTimeMillis(); } - } - else { + } else { if (Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode())) { return; } @@ -123,20 +137,4 @@ else if (!down) { this.isSneaking = down; KeyBinding.setKeyBindState(getKeyCode, down); } - - public static boolean canSafeWalk() { - if (ModuleManager.safeWalk != null && ModuleManager.safeWalk.isEnabled()) { - if (disableOnForward.isToggled() && Keyboard.isKeyDown(mc.gameSettings.keyBindForward.getKeyCode())) { - return false; - } - if (pitchCheck.isToggled() && mc.thePlayer.rotationPitch < 70) { - return false; - } - if (blocksOnly.isToggled() && (mc.thePlayer.getHeldItem() == null || !(mc.thePlayer.getHeldItem().getItem() instanceof ItemBlock))) { - return false; - } - return true; - } - return false; - } } diff --git a/src/main/java/keystrokesmod/module/impl/world/Scaffold.java b/src/main/java/keystrokesmod/module/impl/world/Scaffold.java index b36284d3..4161e7c2 100644 --- a/src/main/java/keystrokesmod/module/impl/world/Scaffold.java +++ b/src/main/java/keystrokesmod/module/impl/world/Scaffold.java @@ -17,8 +17,8 @@ import keystrokesmod.module.impl.world.scaffold.sprint.*; import keystrokesmod.module.setting.impl.*; import keystrokesmod.module.setting.utils.ModeOnly; -import keystrokesmod.utility.*; import keystrokesmod.utility.Timer; +import keystrokesmod.utility.*; import keystrokesmod.utility.aim.AimSimulator; import keystrokesmod.utility.aim.RotationData; import keystrokesmod.utility.movement.Move; @@ -48,14 +48,20 @@ import java.util.concurrent.TimeUnit; public class Scaffold extends IAutoClicker { + private static final String[] precisionModes = new String[]{"Very low", "Low", "Moderate", "High", "Very high", "Unlimited"}; + public final SliderSetting motion; + public final ButtonSetting safeWalk; + public final ButtonSetting tower; + public final ButtonSetting sameY; + public final ButtonSetting autoJump; private final ModeValue clickMode; private final ButtonSetting alwaysPlaceIfPossible; private final SliderSetting aimSpeed; - public final SliderSetting motion; private final ModeValue rotation; private final ButtonSetting moveFix; private final SliderSetting strafe; private final ButtonSetting notWhileDiagonal; + private final ButtonSetting notWhileTower; private final ModeValue sprint; private final ButtonSetting cancelSprint; private final ButtonSetting legit; @@ -79,43 +85,39 @@ public class Scaffold extends IAutoClicker { private final ButtonSetting fastOnRMB; private final ButtonSetting highlightBlocks; private final ButtonSetting multiPlace; - public final ButtonSetting safeWalk; private final ButtonSetting showBlockCount; private final ButtonSetting delayOnJump; private final ButtonSetting stopAtStart; private final ButtonSetting silentSwing; private final ButtonSetting noSwing; - public final ButtonSetting tower; - public final ButtonSetting sameY; - public final ButtonSetting autoJump; private final ButtonSetting expand; private final SliderSetting expandDistance; private final ButtonSetting polar; private final ButtonSetting postPlace; private final ButtonSetting lookView; + private final ButtonSetting cancelSprintAtStart; + private final Map highlight = new HashMap<>(); public @Nullable MovingObjectPosition rayCasted = null; public MovingObjectPosition placeBlock; - private int lastSlot; - private static final String[] precisionModes = new String[]{"Very low", "Low", "Moderate", "High", "Very high", "Unlimited"}; public float placeYaw; public float placePitch = 85; public int at; public int index; public boolean rmbDown; + public boolean delay; + public boolean place; + public int offGroundTicks = 0; + public int onGroundTicks = 0; + public boolean telly$noBlockPlace = false; + private int lastSlot; private double startPos = -1; - private final Map highlight = new HashMap<>(); private boolean forceStrict; private boolean down; - public boolean delay; - public boolean place; private int add = 0; private int sneak$bridged = 0; private int jump$bridged = 0; private boolean placedUp; - public int offGroundTicks = 0; - public int onGroundTicks = 0; - public boolean telly$noBlockPlace = false; private Float lastYaw = null, lastPitch = null; private boolean polar$waitingForExpand = false; private HoverState hoverState = HoverState.DONE; @@ -146,6 +148,7 @@ public Scaffold() { this.registerSetting(motion = new SliderSetting("Motion", 1.0, 0.5, 1.2, 0.01, () -> !moveFix.isToggled())); this.registerSetting(strafe = new SliderSetting("Strafe", 0, 0, 90, 5)); this.registerSetting(notWhileDiagonal = new ButtonSetting("Not while diagonal", true, () -> strafe.getInput() != 0)); + this.registerSetting(notWhileTower = new ButtonSetting("Not while tower", false, () -> strafe.getInput() != 0)); this.registerSetting(sprint = new ModeValue("Sprint", this) .add(new DisabledSprint("Disabled", this)) .add(new VanillaSprint("Vanilla", this)) @@ -196,6 +199,31 @@ public Scaffold() { this.registerSetting(polar = new ButtonSetting("Polar", false, expand::isToggled)); this.registerSetting(postPlace = new ButtonSetting("Post place", false, "Place on PostUpdate.")); this.registerSetting(lookView = new ButtonSetting("Look view", false)); + this.registerSetting(cancelSprintAtStart = new ButtonSetting("Cancel sprint at start", false)); + } + + public static boolean sprint() { + if (ModuleManager.scaffold.isEnabled() + && ModuleManager.scaffold.sprint.getInput() > 0 + && (!ModuleManager.scaffold.fastOnRMB.isToggled() || Mouse.isButtonDown(1))) { + return ((IScaffoldSprint) ModuleManager.scaffold.sprint.getSelected()).isSprint(); + } + return false; + } + + public static int getSlot() { + int slot = -1; + int highestStack = -1; + for (int i = 0; i < 9; ++i) { + final ItemStack itemStack = mc.thePlayer.inventory.mainInventory[i]; + if (itemStack != null && itemStack.getItem() instanceof ItemBlock && ContainerUtils.canBePlaced((ItemBlock) itemStack.getItem()) && itemStack.stackSize > 0) { + if (mc.thePlayer.inventory.mainInventory[i].stackSize > highestStack) { + highestStack = mc.thePlayer.inventory.mainInventory[i].stackSize; + slot = i; + } + } + } + return slot; } public void onDisable() { @@ -241,8 +269,14 @@ public void onEnable() { hoverState = HoverState.DONE; } - if (stopAtStart.isToggled()) + if (stopAtStart.isToggled()) { stopMoving = true; + } + + if (cancelSprintAtStart.isToggled()) { + mc.thePlayer.setSprinting(false); + } + } @SubscribeEvent @@ -257,7 +291,7 @@ public void onRotation(RotationEvent event) { float yaw = data.getYaw(); float pitch = data.getPitch(); - if (!isDiagonal() || !notWhileDiagonal.isToggled()) { + if ((!isDiagonal() || !notWhileDiagonal.isToggled()) && (!ModuleManager.tower.canTower() || !notWhileTower.isToggled())) { if (isDiagonal()) { yaw += (float) strafe.getInput(); } else { @@ -637,17 +671,14 @@ public void onRenderTick(TickEvent.RenderTickEvent ev) { String color = "§"; if (blocks <= 5) { color += "c"; - } - else if (blocks <= 15) { + } else if (blocks <= 15) { color += "6"; - } - else if (blocks <= 25) { + } else if (blocks <= 25) { color += "e"; - } - else { + } else { color = ""; } - mc.fontRendererObj.drawStringWithShadow(color + blocks + " §rblock" + (blocks == 1 ? "" : "s"), (float) scaledResolution.getScaledWidth() /2 + 8, (float) scaledResolution.getScaledHeight() /2 + 4, -1); + mc.fontRendererObj.drawStringWithShadow(color + blocks + " §rblock" + (blocks == 1 ? "" : "s"), (float) scaledResolution.getScaledWidth() / 2 + 8, (float) scaledResolution.getScaledHeight() / 2 + 4, -1); } } @@ -757,15 +788,6 @@ public void onRenderWorld(RenderWorldLastEvent e) { } } - public static boolean sprint() { - if (ModuleManager.scaffold.isEnabled() - && ModuleManager.scaffold.sprint.getInput() > 0 - && (!ModuleManager.scaffold.fastOnRMB.isToggled() || Mouse.isButtonDown(1))) { - return ((IScaffoldSprint) ModuleManager.scaffold.sprint.getSelected()).isSprint(); - } - return false; - } - private boolean forceStrict(float value) { return (inBetween(-170, -105, value) || inBetween(-80, 80, value) || inBetween(98, 170, value)) && !inBetween(-10, 10, value); } @@ -813,8 +835,7 @@ public float getYaw() { } else { if (moveStrafe > 0.0) { yaw = 90.0f; - } - else if (moveStrafe < 0.0) { + } else if (moveStrafe < 0.0) { yaw = -90.0f; } } @@ -909,21 +930,6 @@ public boolean place(MovingObjectPosition block, boolean extra) { return false; } - public static int getSlot() { - int slot = -1; - int highestStack = -1; - for (int i = 0; i < 9; ++i) { - final ItemStack itemStack = mc.thePlayer.inventory.mainInventory[i]; - if (itemStack != null && itemStack.getItem() instanceof ItemBlock && ContainerUtils.canBePlaced((ItemBlock) itemStack.getItem()) && itemStack.stackSize > 0) { - if (mc.thePlayer.inventory.mainInventory[i].stackSize > highestStack) { - highestStack = mc.thePlayer.inventory.mainInventory[i].stackSize; - slot = i; - } - } - } - return slot; - } - public int totalBlocks() { if (!Utils.nullCheck()) return 0; @@ -941,6 +947,23 @@ public int totalBlocks() { } } + @Override + public String getInfo() { + return sprint.getSelected().getPrettyName(); + } + + @SubscribeEvent + public void onSafeWalk(@NotNull SafeWalkEvent event) { + if (safewalk()) + event.setSafeWalk(true); + } + + enum HoverState { + JUMP, + FALL, + DONE + } + static class EnumFacingOffset { EnumFacing enumFacing; Vec3 offset; @@ -958,21 +981,4 @@ Vec3 getOffset() { return offset; } } - - @Override - public String getInfo() { - return sprint.getSelected().getPrettyName(); - } - - @SubscribeEvent - public void onSafeWalk(@NotNull SafeWalkEvent event) { - if (safewalk()) - event.setSafeWalk(true); - } - - enum HoverState { - JUMP, - FALL, - DONE - } } \ No newline at end of file diff --git a/src/main/java/keystrokesmod/module/impl/world/Tower.java b/src/main/java/keystrokesmod/module/impl/world/Tower.java index 4209d241..132ebaed 100644 --- a/src/main/java/keystrokesmod/module/impl/world/Tower.java +++ b/src/main/java/keystrokesmod/module/impl/world/Tower.java @@ -3,10 +3,11 @@ import keystrokesmod.module.Module; import keystrokesmod.module.ModuleManager; import keystrokesmod.module.impl.world.tower.*; -import keystrokesmod.module.setting.impl.*; +import keystrokesmod.module.setting.impl.ButtonSetting; +import keystrokesmod.module.setting.impl.DescriptionSetting; +import keystrokesmod.module.setting.impl.ModeValue; import keystrokesmod.utility.MoveUtil; import keystrokesmod.utility.Utils; -import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; @@ -42,7 +43,7 @@ public Tower() { this.canBeEnabled = false; mode.enable(); - MinecraftForge.EVENT_BUS.register(new Object(){ + MinecraftForge.EVENT_BUS.register(new Object() { @SubscribeEvent public void onUpdate(TickEvent.ClientTickEvent event) { final boolean curCanTower = canTower(); @@ -58,14 +59,11 @@ public boolean canTower() { if (mc.currentScreen != null) return false; if (!Utils.nullCheck() || !Utils.jumpDown()) { return false; - } - else if (disableWhileHurt.isToggled() && mc.thePlayer.hurtTime >= 9) { + } else if (disableWhileHurt.isToggled() && mc.thePlayer.hurtTime >= 9) { return false; - } - else if (disableWhileCollided.isToggled() && mc.thePlayer.isCollidedHorizontally) { + } else if (disableWhileCollided.isToggled() && mc.thePlayer.isCollidedHorizontally) { return false; - } - else return modulesEnabled(); + } else return modulesEnabled(); } public boolean modulesEnabled() { diff --git a/src/main/java/keystrokesmod/module/impl/world/scaffold/IScaffoldSprint.java b/src/main/java/keystrokesmod/module/impl/world/scaffold/IScaffoldSprint.java index ee7c2df3..b4d9d21f 100644 --- a/src/main/java/keystrokesmod/module/impl/world/scaffold/IScaffoldSprint.java +++ b/src/main/java/keystrokesmod/module/impl/world/scaffold/IScaffoldSprint.java @@ -24,6 +24,7 @@ public boolean onPreSchedulePlace() { /** * The final rotation data before set. + * * @param data rotation data * @return the new rotation data */ diff --git a/src/main/java/keystrokesmod/module/impl/world/scaffold/rotation/TellyRotation.java b/src/main/java/keystrokesmod/module/impl/world/scaffold/rotation/TellyRotation.java index 968a2bcb..0bdfbd9b 100644 --- a/src/main/java/keystrokesmod/module/impl/world/scaffold/rotation/TellyRotation.java +++ b/src/main/java/keystrokesmod/module/impl/world/scaffold/rotation/TellyRotation.java @@ -6,7 +6,6 @@ import keystrokesmod.event.ScaffoldPlaceEvent; import keystrokesmod.module.impl.world.Scaffold; import keystrokesmod.module.impl.world.scaffold.IScaffoldRotation; -import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.BlockUtils; import keystrokesmod.utility.MoveUtil; diff --git a/src/main/java/keystrokesmod/module/impl/world/tower/HypixelTower.java b/src/main/java/keystrokesmod/module/impl/world/tower/HypixelTower.java index 033b65d1..981a85db 100644 --- a/src/main/java/keystrokesmod/module/impl/world/tower/HypixelTower.java +++ b/src/main/java/keystrokesmod/module/impl/world/tower/HypixelTower.java @@ -27,24 +27,34 @@ import java.util.concurrent.TimeUnit; public class HypixelTower extends SubMode { - private final ButtonSetting notWhileMoving; - private final SliderSetting stopOnBlocks; - public static final Set LIMIT_FACING = new HashSet<>(Collections.singleton(EnumFacing.SOUTH)); public static final MoveCorrect moveCorrect = new MoveCorrect(0.3, MoveCorrect.Mode.POSITION); + private final ButtonSetting notWhileMoving; + private final SliderSetting airStrafeAmount; + private final SliderSetting stopOnBlocks; private boolean towering; private int towerTicks; private boolean blockPlaceRequest = false; private int lastOnGroundY; private BlockPos deltaPlace = BlockPos.ORIGIN; private int verticalPlaced = 0; + private float movementYaw; public HypixelTower(String name, @NotNull Tower parent) { super(name, parent); this.registerSetting(notWhileMoving = new ButtonSetting("Not while moving", true)); + this.registerSetting(airStrafeAmount = new SliderSetting("Air strafe amount", 20, 15, 90, 5)); this.registerSetting(stopOnBlocks = new SliderSetting("Stop on blocks", 6, 6, 10, 1)); } + public static boolean isGoingDiagonally(double amount) { + return Math.abs(mc.thePlayer.motionX) > amount && Math.abs(mc.thePlayer.motionZ) > amount; + } + + public static double randomAmount() { + return 8.0E-4 + Math.random() * 0.008; + } + @SubscribeEvent public void onMove(MoveEvent event) throws IllegalAccessException { if (mc.thePlayer.isPotionActive(Potion.jump)) return; @@ -75,8 +85,10 @@ public void onMove(MoveEvent event) throws IllegalAccessException { } else if (this.towerTicks == 3) { if (parent.canTower()) { event.setY(mc.thePlayer.motionY = 0.4198499917984009); - if (MoveUtil.isMoving()) + if (MoveUtil.isMoving()) { MoveUtil.strafe((float) towerSpeed - randomAmount()); + movementYaw = MoveUtil.simulationStrafeAngle(movementYaw, (float) airStrafeAmount.getInput()); + } this.towerTicks = 0; } else { this.towering = false; @@ -90,8 +102,10 @@ public void onMove(MoveEvent event) throws IllegalAccessException { Reflection.jumpTicks.set(mc.thePlayer, 0); if (event.getY() > 0.0) { event.setY(mc.thePlayer.motionY = 0.4198479950428009); - if (MoveUtil.isMoving()) + if (MoveUtil.isMoving()) { MoveUtil.strafe((float) towerSpeed - randomAmount()); + movementYaw = mc.thePlayer.rotationYaw; + } } } } @@ -105,6 +119,7 @@ public void onPreUpdate(PreUpdateEvent event) { if (mc.thePlayer.onGround) { lastOnGroundY = (int) mc.thePlayer.posY; deltaPlace = new BlockPos(0, 1, 1); + movementYaw = mc.thePlayer.rotationYaw; } if (blockPlaceRequest && !Utils.isMoving()) { @@ -142,16 +157,9 @@ public void onPreUpdate(PreUpdateEvent event) { } } - public static boolean isGoingDiagonally(double amount) { - return Math.abs(mc.thePlayer.motionX) > amount && Math.abs(mc.thePlayer.motionZ) > amount; - } - - public static double randomAmount() { - return 8.0E-4 + Math.random() * 0.008; - } - @Override public void onEnable() throws Throwable { verticalPlaced = 0; + movementYaw = mc.thePlayer.rotationYaw; } } diff --git a/src/main/java/keystrokesmod/module/impl/world/tower/JumpSprintTower.java b/src/main/java/keystrokesmod/module/impl/world/tower/JumpSprintTower.java index 35023dd7..ad61d643 100644 --- a/src/main/java/keystrokesmod/module/impl/world/tower/JumpSprintTower.java +++ b/src/main/java/keystrokesmod/module/impl/world/tower/JumpSprintTower.java @@ -65,8 +65,8 @@ public void onPreMotion(PreMotionEvent event) throws IllegalAccessException { if (mc.thePlayer.motionY == -0.3919991420476618) mc.thePlayer.motionY = -0.3968991421057737; } } - } } + } @SubscribeEvent public void onPreUpdate(PreUpdateEvent event) { diff --git a/src/main/java/keystrokesmod/module/impl/world/tower/VanillaTower.java b/src/main/java/keystrokesmod/module/impl/world/tower/VanillaTower.java index 512495bf..5544bf72 100644 --- a/src/main/java/keystrokesmod/module/impl/world/tower/VanillaTower.java +++ b/src/main/java/keystrokesmod/module/impl/world/tower/VanillaTower.java @@ -39,13 +39,11 @@ public void onPreMotion(PreMotionEvent e) throws IllegalAccessException { if (wasTowering && slowedTicks.getInput() > 0) { if (slowTicks++ < slowedTicks.getInput()) { Utils.setSpeed(Math.max(slowedSpeed.getInput() * 0.1 - 0.25, 0)); - } - else { + } else { slowTicks = 0; wasTowering = false; } - } - else { + } else { if (wasTowering) { wasTowering = false; } diff --git a/src/main/java/keystrokesmod/module/setting/Setting.java b/src/main/java/keystrokesmod/module/setting/Setting.java index f7a25d13..a11dfd06 100644 --- a/src/main/java/keystrokesmod/module/setting/Setting.java +++ b/src/main/java/keystrokesmod/module/setting/Setting.java @@ -13,10 +13,10 @@ import java.util.function.Supplier; public abstract class Setting { + private final @Nullable String toolTip; public String n; public Supplier visibleCheck; public boolean viewOnly; - private final @Nullable String toolTip; @Setter protected @Nullable Module parent = null; diff --git a/src/main/java/keystrokesmod/module/setting/impl/ButtonSetting.java b/src/main/java/keystrokesmod/module/setting/impl/ButtonSetting.java index 8ce86af2..66e67177 100644 --- a/src/main/java/keystrokesmod/module/setting/impl/ButtonSetting.java +++ b/src/main/java/keystrokesmod/module/setting/impl/ButtonSetting.java @@ -17,8 +17,8 @@ public class ButtonSetting extends Setting { @Getter private final String name; - private boolean isEnabled; public boolean isMethodButton; + private boolean isEnabled; private Runnable method; private Consumer onToggle; @@ -39,11 +39,13 @@ public ButtonSetting(String name, boolean isEnabled, @NotNull Consumer visibleCheck) { - this(name, isEnabled, visibleCheck, setting -> {}); + this(name, isEnabled, visibleCheck, setting -> { + }); } public ButtonSetting(String name, boolean isEnabled, @NotNull Supplier visibleCheck, @Nullable String toolTip) { - this(name, isEnabled, visibleCheck, setting -> {}, toolTip); + this(name, isEnabled, visibleCheck, setting -> { + }, toolTip); } public ButtonSetting(String name, boolean isEnabled, @NotNull Supplier visibleCheck, @NotNull Consumer onToggle) { diff --git a/src/main/java/keystrokesmod/module/setting/impl/DescriptionSetting.java b/src/main/java/keystrokesmod/module/setting/impl/DescriptionSetting.java index c98a963c..34d55bbd 100644 --- a/src/main/java/keystrokesmod/module/setting/impl/DescriptionSetting.java +++ b/src/main/java/keystrokesmod/module/setting/impl/DescriptionSetting.java @@ -5,7 +5,6 @@ import keystrokesmod.utility.i18n.I18nModule; import keystrokesmod.utility.i18n.settings.I18nDescriptionSetting; import keystrokesmod.utility.i18n.settings.I18nSetting; -import keystrokesmod.utility.i18n.settings.I18nSliderSetting; import lombok.Getter; import lombok.Setter; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/keystrokesmod/module/setting/impl/ModeSetting.java b/src/main/java/keystrokesmod/module/setting/impl/ModeSetting.java index a148a0e8..3ea58677 100644 --- a/src/main/java/keystrokesmod/module/setting/impl/ModeSetting.java +++ b/src/main/java/keystrokesmod/module/setting/impl/ModeSetting.java @@ -7,7 +7,6 @@ import keystrokesmod.utility.i18n.I18nModule; import keystrokesmod.utility.i18n.settings.I18nModeSetting; import keystrokesmod.utility.i18n.settings.I18nSetting; -import keystrokesmod.utility.i18n.settings.I18nSliderSetting; import lombok.Getter; import org.jetbrains.annotations.NotNull; @@ -41,6 +40,12 @@ public ModeSetting(String settingName, String @NotNull [] options, int defaultVa this.max = options.length - 1; } + public static double correctValue(double v, double i, double a) { + v = Math.max(i, v); + v = Math.min(a, v); + return v; + } + public void setOptions(String @NotNull [] options) { this.options = options; this.max = options.length - 1; @@ -120,12 +125,6 @@ public void setValueRaw(int n) { this.value = n; } - public static double correctValue(double v, double i, double a) { - v = Math.max(i, v); - v = Math.min(a, v); - return v; - } - @Override public void loadProfile(@NotNull JsonObject data) { if (data.has(getName()) && data.get(getName()).isJsonPrimitive()) { diff --git a/src/main/java/keystrokesmod/module/setting/impl/ModeValue.java b/src/main/java/keystrokesmod/module/setting/impl/ModeValue.java index 79ef7b89..27337408 100644 --- a/src/main/java/keystrokesmod/module/setting/impl/ModeValue.java +++ b/src/main/java/keystrokesmod/module/setting/impl/ModeValue.java @@ -20,14 +20,12 @@ public class ModeValue extends Setting implements InputSetting { @Getter private final Module parent; private final List> subModes = new ArrayList<>(); + private final Queue subSettings = new ConcurrentLinkedQueue<>(); private int selected = 0; - @Getter @Setter private @Nullable Integer indexInSetting = null; - private final Queue subSettings = new ConcurrentLinkedQueue<>(); - public ModeValue(String settingName, Module parent) { this(settingName, parent, () -> true); } @@ -71,9 +69,11 @@ public ModeValue add(final SubMode> subMode) { } return this; } + public List> getSubModeValues() { return subModes; } + public ModeValue setDefaultValue(String name) { Optional> subMode = subModes.stream().filter(mode -> Objects.equals(mode.getName(), name)).findFirst(); if (!subMode.isPresent()) return this; @@ -81,6 +81,7 @@ public ModeValue setDefaultValue(String name) { setValueRaw(subModes.indexOf(subMode.get())); return this; } + @Override public void loadProfile(@NotNull JsonObject profile) { if (profile.has(getName()) && profile.get(getName()).isJsonPrimitive()) { @@ -108,16 +109,20 @@ public void setValue(double value) { this.subModes.get(selected).enable(); } } + public void setValueRaw(int n) { disable(); this.setValue(n); } + public double getMax() { return subModes.size() - 1; } + public double getMin() { return 0; } + public void nextValue() { if (getInput() >= getMax()) { setValueRaw((int) getMin()); diff --git a/src/main/java/keystrokesmod/module/setting/impl/SliderSetting.java b/src/main/java/keystrokesmod/module/setting/impl/SliderSetting.java index 5582fca1..06950117 100644 --- a/src/main/java/keystrokesmod/module/setting/impl/SliderSetting.java +++ b/src/main/java/keystrokesmod/module/setting/impl/SliderSetting.java @@ -18,14 +18,14 @@ public class SliderSetting extends Setting implements InputSetting { private final String settingName; @Getter + private final double min; + private final double intervals; + public boolean isString; + @Getter private String[] options = null; private double defaultValue; @Getter private double max; - @Getter - private final double min; - private final double intervals; - public boolean isString; private String settingInfo = ""; public SliderSetting(String settingName, double defaultValue, double min, double max, double intervals) { @@ -70,6 +70,22 @@ public SliderSetting(String settingName, String @NotNull [] options, double defa this.isString = true; } + public static double correctValue(double v, double i, double a) { + v = Math.max(i, v); + v = Math.min(a, v); + return v; + } + + public static double roundToInterval(double v, int p) { + if (p < 0) { + return 0.0D; + } else { + BigDecimal bd = new BigDecimal(v); + bd = bd.setScale(p, RoundingMode.HALF_UP); + return bd.doubleValue(); + } + } + public String getPrettyInfo() { if (parent != null) { I18nModule i18nObject = parent.getI18nObject(); @@ -113,22 +129,6 @@ public void setValueRaw(double n) { this.defaultValue = n; } - public static double correctValue(double v, double i, double a) { - v = Math.max(i, v); - v = Math.min(a, v); - return v; - } - - public static double roundToInterval(double v, int p) { - if (p < 0) { - return 0.0D; - } else { - BigDecimal bd = new BigDecimal(v); - bd = bd.setScale(p, RoundingMode.HALF_UP); - return bd.doubleValue(); - } - } - @Override public void loadProfile(JsonObject data) { if (data.has(getName()) && data.get(getName()).isJsonPrimitive()) { diff --git a/src/main/java/keystrokesmod/module/setting/impl/SubMode.java b/src/main/java/keystrokesmod/module/setting/impl/SubMode.java index e589212c..1be928f8 100644 --- a/src/main/java/keystrokesmod/module/setting/impl/SubMode.java +++ b/src/main/java/keystrokesmod/module/setting/impl/SubMode.java @@ -12,8 +12,8 @@ * @param the type of the parent module */ public abstract class SubMode extends Module { - protected final String name; public final T parent; + protected final String name; public SubMode(String name, @NotNull T parent) { super(parent.getName() + "$" + name, parent.moduleCategory()); diff --git a/src/main/java/keystrokesmod/utility/DebugInfoRenderer.java b/src/main/java/keystrokesmod/utility/DebugInfoRenderer.java index 5d7871e0..940f5c2b 100644 --- a/src/main/java/keystrokesmod/utility/DebugInfoRenderer.java +++ b/src/main/java/keystrokesmod/utility/DebugInfoRenderer.java @@ -1,22 +1,71 @@ package keystrokesmod.utility; import keystrokesmod.Raven; +import keystrokesmod.event.PreMotionEvent; +import keystrokesmod.module.impl.other.anticheats.utils.world.PlayerMove; +import keystrokesmod.script.classes.Vec3; +import keystrokesmod.utility.font.CenterMode; +import keystrokesmod.utility.font.FontManager; import keystrokesmod.utility.render.RenderUtils; -import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent; +import java.awt.*; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; + +import static keystrokesmod.utility.Utils.mc; + public class DebugInfoRenderer extends net.minecraft.client.gui.Gui { - private static Minecraft mc = Minecraft.getMinecraft(); + private static final Queue speedFromJump = new ConcurrentLinkedQueue<>(); + private static double avgSpeedFromJump = -1; + + @SubscribeEvent + public void onPreMotion(PreMotionEvent event) { + if (!Raven.debugger || !Utils.nullCheck()) { + speedFromJump.clear(); + avgSpeedFromJump = -1; + return; + } + + if (mc.thePlayer.onGround) { + if (!speedFromJump.isEmpty()) { + avgSpeedFromJump = 0; + for (double speed : speedFromJump) { + avgSpeedFromJump += speed; + } + avgSpeedFromJump /= speedFromJump.size(); + } + speedFromJump.clear(); + } + speedFromJump.add(PlayerMove.getXzSecSpeed( + new Vec3(mc.thePlayer.lastTickPosX, mc.thePlayer.lastTickPosY, mc.thePlayer.lastTickPosZ), + new Vec3(event.getPosX(), event.getPosY(), event.getPosZ())) + ); + } @SubscribeEvent public void onRenderTick(RenderTickEvent ev) { - if (!Raven.debugger || ev.phase != TickEvent.Phase.END || !Utils.nullCheck()) { + if (!Raven.debugger || !Utils.nullCheck()) { return; } + if (mc.currentScreen == null) { RenderUtils.renderBPS(true, true); + if (avgSpeedFromJump != -1) { + ScaledResolution scaledResolution = new ScaledResolution(Raven.mc); + + FontManager.getMinecraft().drawString( + String.format("Speed from jump: %.2f", avgSpeedFromJump), + (float)(scaledResolution.getScaledWidth() / 2), + (float)(scaledResolution.getScaledHeight() / 2 + 30), + CenterMode.X, + false, + new Color(255, 255, 255).getRGB() + ); + } } } }
* Counter-confused by xia__mc - * @see hackclient.rise.lk + * * @author Alan34 + * @see hackclient.rise.lk */ public class HypixelJesus extends SubMode { private Boolean tW = false; diff --git a/src/main/java/keystrokesmod/module/impl/movement/jesus/VulcanJesus.java b/src/main/java/keystrokesmod/module/impl/movement/jesus/VulcanJesus.java index acfb1d7a..e18b84fb 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/jesus/VulcanJesus.java +++ b/src/main/java/keystrokesmod/module/impl/movement/jesus/VulcanJesus.java @@ -19,7 +19,7 @@ public VulcanJesus(String name, @NotNull Jesus parent) { @SubscribeEvent public void onPreMotion(PreMotionEvent event) { - if (!mc.gameSettings.keyBindJump.isPressed() && mc.thePlayer.isInWater() && isFirstTimeInWater && !(mc.thePlayer.posY % 1 == 0 || (mc.thePlayer.posY * 2) % 1 == 0) ) { + if (!mc.gameSettings.keyBindJump.isPressed() && mc.thePlayer.isInWater() && isFirstTimeInWater && !(mc.thePlayer.posY % 1 == 0 || (mc.thePlayer.posY * 2) % 1 == 0)) { mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY - .85, mc.thePlayer.posZ); isFirstTimeInWater = false; @@ -29,43 +29,44 @@ public void onPreMotion(PreMotionEvent event) { if (MoveUtil.isMoving()) MoveUtil.strafe(MoveUtil.getAllowedHorizontalDistance() - Math.random() / 1000); mc.thePlayer.motionY = 0; } - if (isFirstTimeInWater){ - posY = mc.thePlayer.posY-.85; + if (isFirstTimeInWater) { + posY = mc.thePlayer.posY - .85; } if (mc.thePlayer.isInWater()) { waterTicks = 0; } - if(waterTicks<20){ + if (waterTicks < 20) { MoveUtil.strafe(); } waterTicks++; boolean jump = mc.gameSettings.keyBindJump.isKeyDown() || mc.gameSettings.keyBindJump.isPressed(); - if (jump && mc.thePlayer.isInWater() && !mc.gameSettings.keyBindJump.isKeyDown() && !mc.gameSettings.keyBindJump.isPressed()){ + if (jump && mc.thePlayer.isInWater() && !mc.gameSettings.keyBindJump.isKeyDown() && !mc.gameSettings.keyBindJump.isPressed()) { mc.thePlayer.setPosition(mc.thePlayer.posX, posY, mc.thePlayer.posZ); } if (mc.thePlayer.isPotionActive(Potion.moveSpeed) && mc.thePlayer.isInWater() && !mc.gameSettings.keyBindJump.isKeyDown()) { - if (MoveUtil.isMoving()) MoveUtil.strafe((.05*(1+(mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier())) +.34 - Math.random() / 1000)); + if (MoveUtil.isMoving()) + MoveUtil.strafe((.05 * (1 + (mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier())) + .34 - Math.random() / 1000)); } - if(!mc.gameSettings.keyBindJump.isKeyDown() && mc.thePlayer.isInWater() && !(mc.thePlayer.posY % 1 == 0 || (mc.thePlayer.posY * 2) % 1 == 0)){ + if (!mc.gameSettings.keyBindJump.isKeyDown() && mc.thePlayer.isInWater() && !(mc.thePlayer.posY % 1 == 0 || (mc.thePlayer.posY * 2) % 1 == 0)) { mc.thePlayer.setPosition(mc.thePlayer.posX, posY, mc.thePlayer.posZ); } - if(mc.gameSettings.keyBindJump.isKeyDown() && mc.thePlayer.isInWater()){ + if (mc.gameSettings.keyBindJump.isKeyDown() && mc.thePlayer.isInWater()) { mc.thePlayer.motionY = .6; MoveUtil.strafe(.1); } - if(mc.thePlayer.isInWater() && !mc.gameSettings.keyBindJump.isKeyDown() && !mc.gameSettings.keyBindJump.isPressed() && !(mc.thePlayer.posY % 1 == 0 || (mc.thePlayer.posY * 2) % 1 == 0)){ - mc.thePlayer.setPosition(mc.thePlayer.posX, posY-.2, mc.thePlayer.posZ); + if (mc.thePlayer.isInWater() && !mc.gameSettings.keyBindJump.isKeyDown() && !mc.gameSettings.keyBindJump.isPressed() && !(mc.thePlayer.posY % 1 == 0 || (mc.thePlayer.posY * 2) % 1 == 0)) { + mc.thePlayer.setPosition(mc.thePlayer.posX, posY - .2, mc.thePlayer.posZ); } - if (!mc.thePlayer.isInWater() && !isFirstTimeInWater && !(mc.thePlayer.posY % 1 == 0 || (mc.thePlayer.posY * 2) % 1 == 0)) { + if (!mc.thePlayer.isInWater() && !isFirstTimeInWater && !(mc.thePlayer.posY % 1 == 0 || (mc.thePlayer.posY * 2) % 1 == 0)) { isFirstTimeInWater = true; } } diff --git a/src/main/java/keystrokesmod/module/impl/movement/longjump/GrimVelocityLongJump.java b/src/main/java/keystrokesmod/module/impl/movement/longjump/GrimVelocityLongJump.java index 2ee21fa8..8b582dea 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/longjump/GrimVelocityLongJump.java +++ b/src/main/java/keystrokesmod/module/impl/movement/longjump/GrimVelocityLongJump.java @@ -2,7 +2,6 @@ import keystrokesmod.event.PreMotionEvent; import keystrokesmod.event.ReceivePacketEvent; -import keystrokesmod.mixins.impl.network.S27PacketExplosionAccessor; import keystrokesmod.module.impl.movement.LongJump; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.ModeSetting; @@ -30,10 +29,9 @@ public class GrimVelocityLongJump extends SubMode { private final ButtonSetting timer; private final SliderSetting timerSpeed; private final ButtonSetting debug; - + private final Queue> delayedPackets = new ConcurrentLinkedQueue<>(); private long lastVelocityTime = -1; private boolean delayed = false; - private final Queue> delayedPackets = new ConcurrentLinkedQueue<>(); public GrimVelocityLongJump(String name, @NotNull LongJump parent) { super(name, parent); @@ -49,7 +47,7 @@ public GrimVelocityLongJump(String name, @NotNull LongJump parent) { public void onReceivePacket(@NotNull ReceivePacketEvent event) { if (event.getPacket() instanceof S27PacketExplosion) { event.setCanceled(true); - delayedPackets.add((S27PacketExplosion) event.getPacket()); + delayedPackets.add(event.getPacket()); } if (event.getPacket() instanceof S12PacketEntityVelocity) { if (((S12PacketEntityVelocity) event.getPacket()).getEntityID() != mc.thePlayer.getEntityId()) return; @@ -59,14 +57,14 @@ public void onReceivePacket(@NotNull ReceivePacketEvent event) { delayed = true; } event.setCanceled(true); - delayedPackets.add((S12PacketEntityVelocity) event.getPacket()); + delayedPackets.add(event.getPacket()); } else if (event.getPacket() instanceof S32PacketConfirmTransaction) { if (delayed) { if (System.currentTimeMillis() - lastVelocityTime >= (int) delayTime.getInput()) { delayed = false; } event.setCanceled(true); - delayedPackets.add((S32PacketConfirmTransaction) event.getPacket()); + delayedPackets.add(event.getPacket()); } } } diff --git a/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelBowLongJump.java b/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelBowLongJump.java index ff8d4f16..cdf86556 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelBowLongJump.java +++ b/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelBowLongJump.java @@ -1,12 +1,11 @@ package keystrokesmod.module.impl.movement.longjump; -import keystrokesmod.event.MoveInputEvent; -import keystrokesmod.event.PrePlayerInputEvent; -import keystrokesmod.event.ReceivePacketEvent; -import keystrokesmod.event.RotationEvent; +import keystrokesmod.Raven; +import keystrokesmod.event.*; import keystrokesmod.module.impl.client.Notifications; import keystrokesmod.module.impl.movement.LongJump; import keystrokesmod.module.impl.other.SlotHandler; +import keystrokesmod.module.impl.player.blink.NormalBlink; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.impl.SubMode; @@ -15,22 +14,22 @@ import keystrokesmod.utility.Utils; import net.minecraft.item.ItemBow; import net.minecraft.item.ItemStack; -import net.minecraft.network.Packet; -import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.network.play.client.C07PacketPlayerDigging; +import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; import net.minecraft.network.play.server.S12PacketEntityVelocity; -import net.minecraft.network.play.server.S32PacketConfirmTransaction; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; -import java.util.Queue; -import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.TimeUnit; public class HypixelBowLongJump extends SubMode { private final SliderSetting speed; private final ButtonSetting autoDisable; private State state = State.SELF_DAMAGE; - private final Queue> delayedPackets = new ConcurrentLinkedQueue<>(); + private final NormalBlink blink = new NormalBlink("Blink", this); public HypixelBowLongJump(String name, @NotNull LongJump parent) { super(name, parent); @@ -44,60 +43,69 @@ public void onEnable() throws Throwable { state = State.SELF_DAMAGE; } + @Override + public void onDisable() throws Throwable { + blink.disable(); + } + @SubscribeEvent public void onMoveInput(MoveInputEvent event) { - if (state == State.SELF_DAMAGE) { + if (state == State.SELF_DAMAGE || state == State.SELF_DAMAGE_POST) { event.setCanceled(true); } } @SubscribeEvent public void onReceivePacket(@NotNull ReceivePacketEvent event) { - if (event.getPacket() instanceof S12PacketEntityVelocity && (state == State.SELF_DAMAGE || state == State.JUMP)) { + if (event.getPacket() instanceof S12PacketEntityVelocity && (state == State.JUMP)) { S12PacketEntityVelocity packet = (S12PacketEntityVelocity) event.getPacket(); if (packet.getEntityID() != mc.thePlayer.getEntityId()) return; - delayedPackets.add(event.getPacket()); - state = State.JUMP; - } else if (event.getPacket() instanceof S32PacketConfirmTransaction && (state == State.SELF_DAMAGE || state == State.JUMP)) { - delayedPackets.add(event.getPacket()); + state = State.APPLY; } } @SubscribeEvent public void onRotation(RotationEvent event) { - if (state == State.SELF_DAMAGE) + if (state == State.SELF_DAMAGE || state == State.SELF_DAMAGE_POST) event.setPitch(-90); } @SubscribeEvent public void onPrePlayerInput(PrePlayerInputEvent event) { + int slot = getBow(); + if (slot == -1) { + Notifications.sendNotification(Notifications.NotificationTypes.INFO, "Could not find Bow"); + parent.disable(); + } switch (state) { case SELF_DAMAGE: - int slot = getBow(); - if (slot == -1) { - Notifications.sendNotification(Notifications.NotificationTypes.INFO, "Could not find Bow"); - parent.disable(); + if (SlotHandler.getCurrentSlot() == slot) { + PacketUtils.sendPacketNoEvent(new C08PacketPlayerBlockPlacement(SlotHandler.getHeldItem())); + Raven.getExecutor().schedule(() -> { + PacketUtils.sendPacketNoEvent(new C07PacketPlayerDigging( + C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, + BlockPos.ORIGIN, EnumFacing.UP + )); + Raven.getExecutor().schedule(() -> state = State.JUMP, 300, TimeUnit.MILLISECONDS); + }, 150, TimeUnit.MILLISECONDS); + state = State.SELF_DAMAGE_POST; } SlotHandler.setCurrentSlot(slot); break; + case SELF_DAMAGE_POST: + SlotHandler.setCurrentSlot(slot); + break; case JUMP: if (!Utils.jumpDown() && mc.thePlayer.onGround) { - MoveUtil.strafe(MoveUtil.getAllowedHorizontalDistance()); + blink.enable(); + MoveUtil.strafe(MoveUtil.getAllowedHorizontalDistance() - Math.random() / 100f); mc.thePlayer.jump(); - state = State.APPLY; } break; case APPLY: - if (parent.offGroundTicks >= 7) { - synchronized (delayedPackets) { - for (Packet p : delayedPackets) { - PacketUtils.receivePacket(p); - } - delayedPackets.clear(); - } - state = State.BOOST; - } + blink.disable(); + state = State.BOOST; break; case BOOST: if (speed.getInput() > 0) @@ -124,6 +132,7 @@ private int getBow() { enum State { SELF_DAMAGE, + SELF_DAMAGE_POST, JUMP, APPLY, BOOST, diff --git a/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelFireballLongJump.java b/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelFireballLongJump.java index 9713b0be..27aae70a 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelFireballLongJump.java +++ b/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelFireballLongJump.java @@ -2,19 +2,20 @@ import keystrokesmod.module.impl.client.Notifications; import keystrokesmod.module.impl.movement.LongJump; -import keystrokesmod.module.impl.movement.longjump.hypixelfireball.MotionHypixelFireballLongJump; import keystrokesmod.module.impl.movement.longjump.hypixelfireball.NormalHypixelFireballLongJump; import keystrokesmod.module.impl.other.SlotHandler; -import keystrokesmod.module.setting.impl.*; +import keystrokesmod.module.setting.impl.ButtonSetting; +import keystrokesmod.module.setting.impl.ModeValue; +import keystrokesmod.module.setting.impl.SliderSetting; +import keystrokesmod.module.setting.impl.SubMode; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import org.jetbrains.annotations.NotNull; public class HypixelFireballLongJump extends SubMode { public final SliderSetting speed; - private final ModeValue mode; public final ButtonSetting autoDisable; - + private final ModeValue mode; private int lastSlot = -1; public HypixelFireballLongJump(String name, @NotNull LongJump parent) { @@ -22,7 +23,6 @@ public HypixelFireballLongJump(String name, @NotNull LongJump parent) { this.registerSetting(speed = new SliderSetting("Speed", 1.5, 0, 2, 0.01)); this.registerSetting(mode = new ModeValue("Sub-Mode", this) .add(new NormalHypixelFireballLongJump("Normal", this)) - .add(new MotionHypixelFireballLongJump("Motion", this)) ); this.registerSetting(autoDisable = new ButtonSetting("Auto disable", true)); } diff --git a/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelLongJump.java b/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelLongJump.java new file mode 100644 index 00000000..92a538ef --- /dev/null +++ b/src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelLongJump.java @@ -0,0 +1,86 @@ +package keystrokesmod.module.impl.movement.longjump; + +import keystrokesmod.event.BlockAABBEvent; +import keystrokesmod.event.PrePlayerInputEvent; +import keystrokesmod.event.ReceivePacketEvent; +import keystrokesmod.event.RotationEvent; +import keystrokesmod.module.impl.client.Notifications; +import keystrokesmod.module.impl.movement.LongJump; +import keystrokesmod.module.impl.other.SlotHandler; +import keystrokesmod.module.setting.impl.SubMode; +import keystrokesmod.utility.BlockUtils; +import keystrokesmod.utility.MoveUtil; +import keystrokesmod.utility.PacketUtils; +import keystrokesmod.utility.Utils; +import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; +import net.minecraft.network.play.server.S08PacketPlayerPosLook; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.jetbrains.annotations.NotNull; + +public class HypixelLongJump extends SubMode { + private int startY = -1; + + public HypixelLongJump(String name, @NotNull LongJump parent) { + super(name, parent); + } + + @SubscribeEvent + public void onRotation(@NotNull RotationEvent event) { + event.setYaw(mc.thePlayer.rotationYaw - 110); + event.setPitch(85); + } + + @SubscribeEvent + public void onBlockAABB(@NotNull BlockAABBEvent event) { + if (BlockUtils.replaceable(event.getBlockPos())) { + final double x = event.getBlockPos().getX(), y = event.getBlockPos().getY(), z = event.getBlockPos().getZ(); + + if (y < startY) { + event.setBoundingBox(AxisAlignedBB.fromBounds(-15, -1, -15, 15, 1, 15).offset(x, y, z)); + } + } + } + + @SubscribeEvent + public void onPrePlayerInput(PrePlayerInputEvent event) { + if (startY == -1) { + if (mc.thePlayer.onGround) + startY = (int) mc.thePlayer.posY; + return; + } + + if (!Utils.jumpDown() && Utils.isMoving() && mc.currentScreen == null && mc.thePlayer.onGround) { + MoveUtil.strafe(MoveUtil.getAllowedHorizontalDistance() - Math.random() / 100f); + mc.thePlayer.jump(); + } + + BlockPos ground = new BlockPos(mc.thePlayer.posX, startY - 1, mc.thePlayer.posZ); + if (BlockUtils.replaceable(ground)) { + BlockPos pos = ground.down(); + PacketUtils.sendPacket(new C08PacketPlayerBlockPlacement( + pos, EnumFacing.UP.getIndex(), SlotHandler.getHeldItem(), + (float) (mc.thePlayer.posX - pos.getX()), + (float) (mc.thePlayer.posY - pos.getY()), + (float) (mc.thePlayer.posZ - pos.getZ()))); + mc.thePlayer.swingItem(); + if (mc.thePlayer.onGround) + parent.disable(); + } + } + + @SubscribeEvent + public void onReceivePacket(@NotNull ReceivePacketEvent event) { + if (event.getPacket() instanceof S08PacketPlayerPosLook) { + Notifications.sendNotification(Notifications.NotificationTypes.INFO, "Anti-cheat flagged."); + parent.disable(); + } + } + + @Override + public void onDisable() throws Throwable { + startY = -1; + } +} diff --git a/src/main/java/keystrokesmod/module/impl/movement/longjump/VulcanLongJump.java b/src/main/java/keystrokesmod/module/impl/movement/longjump/VulcanLongJump.java index e2441fae..14e2fcbb 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/longjump/VulcanLongJump.java +++ b/src/main/java/keystrokesmod/module/impl/movement/longjump/VulcanLongJump.java @@ -34,7 +34,7 @@ public void onPreMotion(PreMotionEvent event) { mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 9.9, mc.thePlayer.posZ); } - if (ticks > 0 && !(ticks >3)) { + if (ticks > 0 && !(ticks > 3)) { mc.thePlayer.motionY = 0; mc.thePlayer.onGround = true; diff --git a/src/main/java/keystrokesmod/module/impl/movement/longjump/hypixelfireball/MotionHypixelFireballLongJump.java b/src/main/java/keystrokesmod/module/impl/movement/longjump/hypixelfireball/MotionHypixelFireballLongJump.java deleted file mode 100644 index b089087e..00000000 --- a/src/main/java/keystrokesmod/module/impl/movement/longjump/hypixelfireball/MotionHypixelFireballLongJump.java +++ /dev/null @@ -1,142 +0,0 @@ -package keystrokesmod.module.impl.movement.longjump.hypixelfireball; - -import keystrokesmod.event.PreMotionEvent; -import keystrokesmod.event.ReceivePacketEvent; -import keystrokesmod.event.SendPacketEvent; -import keystrokesmod.module.impl.movement.longjump.HypixelFireballLongJump; -import keystrokesmod.module.impl.other.SlotHandler; -import keystrokesmod.module.setting.impl.ButtonSetting; -import keystrokesmod.module.setting.impl.SliderSetting; -import keystrokesmod.module.setting.impl.SubMode; -import keystrokesmod.utility.MoveUtil; -import keystrokesmod.utility.PacketUtils; -import keystrokesmod.utility.Reflection; -import keystrokesmod.utility.Utils; -import net.minecraft.item.ItemFireball; -import net.minecraft.network.Packet; -import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; -import net.minecraft.network.play.server.S12PacketEntityVelocity; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import org.jetbrains.annotations.NotNull; - -public class MotionHypixelFireballLongJump extends SubMode { - private final SliderSetting motion; - private final SliderSetting time; - private final ButtonSetting strafe; - - private int lastSlot = -1; - private int ticks = -1; - private boolean setSpeed; - private boolean sentPlace; - private int initTicks; - private boolean thrown; - - public MotionHypixelFireballLongJump(String name, @NotNull HypixelFireballLongJump parent) { - super(name, parent); - this.registerSetting(motion = new SliderSetting("Motion", 0.3, 0.01, 0.4, 0.01)); - this.registerSetting(time = new SliderSetting("Time", 31, 10, 60, 1, "ticks")); - this.registerSetting(strafe = new ButtonSetting("Strafe", true)); - } - - @SubscribeEvent - public void onSendPacket(@NotNull SendPacketEvent event) { - Packet> packet = event.getPacket(); - if (packet instanceof C08PacketPlayerBlockPlacement - && ((C08PacketPlayerBlockPlacement) event.getPacket()).getStack() != null - && ((C08PacketPlayerBlockPlacement) event.getPacket()).getStack().getItem() instanceof ItemFireball) { - thrown = true; - } - } - - @SubscribeEvent - public void onReceivePacket(ReceivePacketEvent event) { - if (!Utils.nullCheck()) { - return; - } - - Packet> packet = event.getPacket(); - if (packet instanceof S12PacketEntityVelocity) { - if (((S12PacketEntityVelocity) event.getPacket()).getEntityID() != mc.thePlayer.getEntityId()) { - return; - } - if (thrown) { - ticks = 0; - setSpeed = true; - thrown = false; - } - } - } - - @SubscribeEvent - public void onPreMotion(PreMotionEvent event) { - if (!Utils.nullCheck()) { - return; - } - - switch (initTicks) { - case 0: - int fireballSlot = parent.getFireball(); - if (fireballSlot != -1 && fireballSlot != SlotHandler.getCurrentSlot()) { - lastSlot = SlotHandler.getCurrentSlot(); - SlotHandler.setCurrentSlot(fireballSlot); - } - event.setYaw(mc.thePlayer.rotationYaw - 180); - event.setPitch(89); - break; - case 1: - event.setYaw(mc.thePlayer.rotationYaw - 180); - event.setPitch(89); - if (!sentPlace) { - PacketUtils.sendPacket(new C08PacketPlayerBlockPlacement(SlotHandler.getHeldItem())); - sentPlace = true; - } - break; - case 2: - if (lastSlot != -1) { - SlotHandler.setCurrentSlot(lastSlot); - lastSlot = -1; - } - break; - } - - initTicks++; - - if (ticks > time.getInput()) { - if (parent.autoDisable.isToggled()) - parent.parent.disable(); - } else if (ticks >= 0) { - mc.thePlayer.motionY = motion.getInput(); - if (strafe.isToggled()) - MoveUtil.strafe(); - } - - if (setSpeed) { - this.setSpeed(); - ticks++; - } - - if (setSpeed) { - if (ticks > 1) { - setSpeed = false; - return; - } - ticks++; - setSpeed(); - } - } - - public void onDisable() { - ticks = lastSlot = -1; - setSpeed = sentPlace = false; - initTicks = 0; - } - - public void onEnable() { - initTicks = 0; - } - - private void setSpeed() { - MoveUtil.strafe((float) parent.speed.getInput()); - } - -} diff --git a/src/main/java/keystrokesmod/module/impl/movement/noslow/CustomNoSlow.java b/src/main/java/keystrokesmod/module/impl/movement/noslow/CustomNoSlow.java index fee27535..892bb551 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/noslow/CustomNoSlow.java +++ b/src/main/java/keystrokesmod/module/impl/movement/noslow/CustomNoSlow.java @@ -19,10 +19,10 @@ import org.jetbrains.annotations.Nullable; public class CustomNoSlow extends INoSlow { - private final ButtonSetting onlyWhileMove; - private final ButtonSetting startSlow; public final ModeSetting switchMode; public final ModeSetting slotMode; + private final ButtonSetting onlyWhileMove; + private final ButtonSetting startSlow; private final ModeSetting mode; private final ModeValue sword; private final ModeValue bow; diff --git a/src/main/java/keystrokesmod/module/impl/movement/noslow/GrimACNoSlow.java b/src/main/java/keystrokesmod/module/impl/movement/noslow/GrimACNoSlow.java index 56f7f196..d99e544c 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/noslow/GrimACNoSlow.java +++ b/src/main/java/keystrokesmod/module/impl/movement/noslow/GrimACNoSlow.java @@ -1,7 +1,6 @@ package keystrokesmod.module.impl.movement.noslow; import keystrokesmod.event.SendPacketEvent; -import keystrokesmod.mixins.impl.client.KeyBindingAccessor; import keystrokesmod.module.impl.movement.NoSlow; import keystrokesmod.module.impl.other.SlotHandler; import keystrokesmod.utility.PacketUtils; diff --git a/src/main/java/keystrokesmod/module/impl/movement/noslow/HypixelNoSlow.java b/src/main/java/keystrokesmod/module/impl/movement/noslow/HypixelNoSlow.java index 195122e0..afd971c7 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/noslow/HypixelNoSlow.java +++ b/src/main/java/keystrokesmod/module/impl/movement/noslow/HypixelNoSlow.java @@ -4,11 +4,9 @@ import keystrokesmod.event.SendPacketEvent; import keystrokesmod.module.impl.movement.NoSlow; import keystrokesmod.module.impl.other.SlotHandler; -import keystrokesmod.utility.BlockUtils; import keystrokesmod.utility.ContainerUtils; import keystrokesmod.utility.PacketUtils; import keystrokesmod.utility.Utils; -import net.minecraft.block.BlockStairs; import net.minecraft.item.ItemBow; import net.minecraft.item.ItemPotion; import net.minecraft.item.ItemStack; @@ -76,9 +74,6 @@ public void onSendPacket(@NotNull SendPacketEvent event) { @Override public float getSlowdown() { - if (BlockUtils.blockRelativeToPlayer(0, -1, 0) instanceof BlockStairs) - return 0.2f; - ItemStack item = SlotHandler.getHeldItem(); if (item != null && item.getItem() instanceof ItemSword) return 0.8f; diff --git a/src/main/java/keystrokesmod/module/impl/movement/noslow/IntaveNoSlow.java b/src/main/java/keystrokesmod/module/impl/movement/noslow/IntaveNoSlow.java index 482fa3cc..186a4b3b 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/noslow/IntaveNoSlow.java +++ b/src/main/java/keystrokesmod/module/impl/movement/noslow/IntaveNoSlow.java @@ -1,7 +1,6 @@ package keystrokesmod.module.impl.movement.noslow; import keystrokesmod.event.PreMotionEvent; -import keystrokesmod.module.ModuleManager; import keystrokesmod.module.impl.movement.NoSlow; import keystrokesmod.module.impl.other.SlotHandler; import keystrokesmod.utility.ContainerUtils; diff --git a/src/main/java/keystrokesmod/module/impl/movement/noweb/IgnoreNoWeb.java b/src/main/java/keystrokesmod/module/impl/movement/noweb/IgnoreNoWeb.java index b817881f..469e8dbd 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/noweb/IgnoreNoWeb.java +++ b/src/main/java/keystrokesmod/module/impl/movement/noweb/IgnoreNoWeb.java @@ -3,7 +3,6 @@ import keystrokesmod.event.BlockWebEvent; import keystrokesmod.module.impl.movement.NoWeb; import keystrokesmod.module.setting.impl.SubMode; -import net.minecraft.init.Blocks; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/keystrokesmod/module/impl/movement/phase/GrimACPhase.java b/src/main/java/keystrokesmod/module/impl/movement/phase/GrimACPhase.java index b61baf95..45921b0f 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/phase/GrimACPhase.java +++ b/src/main/java/keystrokesmod/module/impl/movement/phase/GrimACPhase.java @@ -23,6 +23,14 @@ public GrimACPhase(String name, @NotNull Phase parent) { this.registerSetting(onlyMurderMystery = new ButtonSetting("Only murder mystery", false)); } + private static boolean isMurderMystery() { + try { + return Utils.getSidebarLines().get(0).contains("MURDER"); + } catch (IndexOutOfBoundsException e) { + return false; + } + } + @SubscribeEvent public void onWorldChange(WorldChangeEvent event) { if (!onlyMurderMystery.isToggled() || isMurderMystery()) @@ -47,12 +55,4 @@ public void onUpdate() { public void onDisable() { blink.disable(); } - - private static boolean isMurderMystery() { - try { - return Utils.getSidebarLines().get(0).contains("MURDER"); - } catch (IndexOutOfBoundsException e) { - return false; - } - } } diff --git a/src/main/java/keystrokesmod/module/impl/movement/phase/VulcanPhase.java b/src/main/java/keystrokesmod/module/impl/movement/phase/VulcanPhase.java index d1c46975..0d22f07e 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/phase/VulcanPhase.java +++ b/src/main/java/keystrokesmod/module/impl/movement/phase/VulcanPhase.java @@ -32,16 +32,17 @@ public VulcanPhase(String name, Phase parent) { super(name, parent); this.registerSetting(fast, cancelVelocity); } + @Override public void onEnable() { flag = true; timer1 = 0; teleport = false; enable = true; - if( mc.thePlayer.onGround ){ + if (mc.thePlayer.onGround) { mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY - 1, mc.thePlayer.posZ); MoveUtil.stop(); - } else{ + } else { Notifications.sendNotification(Notifications.NotificationTypes.INFO, "You must me on the ground to do this"); parent.toggle(); } @@ -51,21 +52,21 @@ public void onEnable() { @SubscribeEvent public void onPreMotion(PreMotionEvent event) { mc.thePlayer.cameraYaw = 0.1F; - if( timer1 > 25) { + if (timer1 > 25) { - if(insideBlock()) { + if (insideBlock()) { event.setOnGround(false); } } - if(insideBlock()){ + if (insideBlock()) { timer1++; } - if((insideBlock() && !enable && flag)) { + if ((insideBlock() && !enable && flag)) { flag = false; Notifications.sendNotification(Notifications.NotificationTypes.INFO, "Phased"); } @@ -86,7 +87,7 @@ public void onBlockAABB(BlockAABBEvent event) { event.setBoundingBox(AxisAlignedBB.fromBounds(-15, -1, -15, 15, 1, 15).offset(x, y, z)); } } - } else if (!teleport){ + } else if (!teleport) { if (event.getBlock() instanceof BlockAir && !mc.thePlayer.isSneaking()) { @@ -96,7 +97,7 @@ public void onBlockAABB(BlockAABBEvent event) { event.setBoundingBox(AxisAlignedBB.fromBounds(-15, -1, -15, 15, 1, 15).offset(x, y, z)); } } - } else if (!insideBlock()){ + } else if (!insideBlock()) { Notifications.sendNotification(Notifications.NotificationTypes.INFO, "Disabled due to not being in a block"); parent.toggle(); } @@ -104,33 +105,33 @@ public void onBlockAABB(BlockAABBEvent event) { @SubscribeEvent public void onStrafe(PrePlayerInputEvent event) { - if(mc.gameSettings.keyBindJump.isKeyDown() && mc.thePlayer.hurtTime>0){ - mc.thePlayer.motionY=.99; + if (mc.gameSettings.keyBindJump.isKeyDown() && mc.thePlayer.hurtTime > 0) { + mc.thePlayer.motionY = .99; yMoving = true; - } else if (mc.gameSettings.keyBindSneak.isKeyDown()){ - mc.thePlayer.motionY=-.4; + } else if (mc.gameSettings.keyBindSneak.isKeyDown()) { + mc.thePlayer.motionY = -.4; yMoving = true; - } else if (!mc.gameSettings.keyBindJump.isKeyDown() && insideBlock() && timer1 > 25){ + } else if (!mc.gameSettings.keyBindJump.isKeyDown() && insideBlock() && timer1 > 25) { yMoving = false; } - if(fast.isToggled() && insideBlock()) { + if (fast.isToggled() && insideBlock()) { if (mc.thePlayer.isPotionActive(Potion.moveSpeed)) { - event.setSpeed(((.0765*(1+(mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier()))) +.306)); + event.setSpeed(((.0765 * (1 + (mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier()))) + .306)); } else { event.setSpeed(.306); } } - if (mc.thePlayer.onGround && enable && teleport){ + if (mc.thePlayer.onGround && enable && teleport) { mc.thePlayer.jump(); teleport = false; enable = false; } - if (mc.thePlayer.onGround && !teleport &&!enable) { + if (mc.thePlayer.onGround && !teleport && !enable) { - if (mc.thePlayer.ticksExisted % 2 == 1|| !(mc.thePlayer.moveForward ==0 )) { + if (mc.thePlayer.ticksExisted % 2 == 1 || !(mc.thePlayer.moveForward == 0)) { event.setForward(1); } else { diff --git a/src/main/java/keystrokesmod/module/impl/movement/phase/WatchdogAutoPhase.java b/src/main/java/keystrokesmod/module/impl/movement/phase/WatchdogAutoPhase.java index 44e937bc..64a83eed 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/phase/WatchdogAutoPhase.java +++ b/src/main/java/keystrokesmod/module/impl/movement/phase/WatchdogAutoPhase.java @@ -16,9 +16,9 @@ import org.jetbrains.annotations.NotNull; public class WatchdogAutoPhase extends SubMode { - private boolean phase; private final CoolDown stopWatch = new CoolDown(4000); private final NormalBlink blink = new NormalBlink("Blink", this); + private boolean phase; public WatchdogAutoPhase(String name, Phase parent) { super(name, parent); diff --git a/src/main/java/keystrokesmod/module/impl/movement/phase/WatchdogPhase.java b/src/main/java/keystrokesmod/module/impl/movement/phase/WatchdogPhase.java index d861c7af..3b67dd14 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/phase/WatchdogPhase.java +++ b/src/main/java/keystrokesmod/module/impl/movement/phase/WatchdogPhase.java @@ -8,8 +8,6 @@ import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.impl.SubMode; -import net.minecraft.util.BlockPos; -import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/keystrokesmod/module/impl/movement/speed/GrimACSpeed.java b/src/main/java/keystrokesmod/module/impl/movement/speed/GrimACSpeed.java index ec85b44f..b1c59ff3 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/speed/GrimACSpeed.java +++ b/src/main/java/keystrokesmod/module/impl/movement/speed/GrimACSpeed.java @@ -7,7 +7,6 @@ import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.impl.SubMode; import keystrokesmod.utility.MoveUtil; -import keystrokesmod.utility.Utils; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityArmorStand; diff --git a/src/main/java/keystrokesmod/module/impl/movement/speed/HypixelSpeed.java b/src/main/java/keystrokesmod/module/impl/movement/speed/HypixelSpeed.java index 538b403f..acf39023 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/speed/HypixelSpeed.java +++ b/src/main/java/keystrokesmod/module/impl/movement/speed/HypixelSpeed.java @@ -3,20 +3,20 @@ import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.module.impl.movement.Speed; import keystrokesmod.module.impl.movement.TargetStrafe; -import keystrokesmod.module.impl.movement.speed.hypixel.*; +import keystrokesmod.module.impl.movement.speed.hypixel.GroundStrafeSpeed; +import keystrokesmod.module.impl.movement.speed.hypixel.HypixelGroundSpeed; +import keystrokesmod.module.impl.movement.speed.hypixel.HypixelLowHopSpeed; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.ModeValue; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.impl.SubMode; import keystrokesmod.utility.MoveUtil; -import keystrokesmod.utility.PacketUtils; import keystrokesmod.utility.movement.Move; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; public class HypixelSpeed extends SubMode { private final ModeValue mode; - private final ButtonSetting fastTest; private final ButtonSetting strafe; private final SliderSetting minAngle; private final ButtonSetting fullStrafe; @@ -30,7 +30,6 @@ public HypixelSpeed(String name, @NotNull Speed parent) { .add(new HypixelGroundSpeed("Ground", this)) .add(new HypixelLowHopSpeed("LowHop", this)) ); - this.registerSetting(fastTest = new ButtonSetting("Fast test", false)); this.registerSetting(strafe = new ButtonSetting("Strafe", false)); this.registerSetting(minAngle = new SliderSetting("Min angle", 30, 15, 90, 15, strafe::isToggled)); this.registerSetting(fullStrafe = new ButtonSetting("Full strafe", false, strafe::isToggled)); @@ -46,11 +45,6 @@ public void onPreUpdate(PreUpdateEvent event) { MoveUtil.strafe(0.11); } } - - if (fastTest.isToggled() && mc.thePlayer.onGround) { - mc.thePlayer.motionX *= 1.114 - MoveUtil.getSpeedEffect() * .01 - Math.random() * 1E-4; - mc.thePlayer.motionZ *= 1.114 - MoveUtil.getSpeedEffect() * .01 - Math.random() * 1E-4; - } } private boolean canStrafe() { @@ -77,10 +71,5 @@ public void onEnable() { @Override public void onDisable() { mode.disable(); - - if (fastTest.isToggled()) { - mc.thePlayer.motionX *= .8; - mc.thePlayer.motionZ *= .8; - } } } diff --git a/src/main/java/keystrokesmod/module/impl/movement/speed/LegitSpeed.java b/src/main/java/keystrokesmod/module/impl/movement/speed/LegitSpeed.java index 1a47f006..79619ebd 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/speed/LegitSpeed.java +++ b/src/main/java/keystrokesmod/module/impl/movement/speed/LegitSpeed.java @@ -1,6 +1,7 @@ package keystrokesmod.module.impl.movement.speed; -import keystrokesmod.event.*; +import keystrokesmod.event.MoveInputEvent; +import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.module.impl.movement.Speed; import keystrokesmod.module.impl.other.RotationHandler; import keystrokesmod.module.setting.impl.ButtonSetting; diff --git a/src/main/java/keystrokesmod/module/impl/movement/speed/VanillaSpeed.java b/src/main/java/keystrokesmod/module/impl/movement/speed/VanillaSpeed.java index 39d5bff3..c2c67088 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/speed/VanillaSpeed.java +++ b/src/main/java/keystrokesmod/module/impl/movement/speed/VanillaSpeed.java @@ -12,13 +12,12 @@ import org.jetbrains.annotations.NotNull; public class VanillaSpeed extends SubMode { + private static boolean warning = false; private final SliderSetting horizonSpeed; private final ButtonSetting autoJump; private final SliderSetting verticalSpeed; private final ButtonSetting fastStop; - private static boolean warning = false; - public VanillaSpeed(String name, @NotNull Speed parent) { super(name, parent); this.registerSetting(horizonSpeed = new SliderSetting("Horizon speed", 1, 0.1, 5, 0.1)); diff --git a/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/HypixelGroundSpeed.java b/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/HypixelGroundSpeed.java index 4576fb35..1524682f 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/HypixelGroundSpeed.java +++ b/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/HypixelGroundSpeed.java @@ -2,11 +2,9 @@ import keystrokesmod.event.PrePlayerInputEvent; import keystrokesmod.module.impl.movement.speed.HypixelSpeed; -import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SubMode; import keystrokesmod.utility.MoveUtil; import keystrokesmod.utility.Utils; -import keystrokesmod.utility.movement.MoveCorrect; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/HypixelLowHopSpeed.java b/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/HypixelLowHopSpeed.java index 27329ecc..6e0f9206 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/HypixelLowHopSpeed.java +++ b/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/HypixelLowHopSpeed.java @@ -3,7 +3,10 @@ import keystrokesmod.module.impl.exploit.disabler.hypixel.HypixelMotionDisabler; import keystrokesmod.module.impl.movement.speed.HypixelSpeed; import keystrokesmod.module.impl.movement.speed.hypixel.lowhop.HypixelLowHopPredictSpeed; -import keystrokesmod.module.setting.impl.*; +import keystrokesmod.module.setting.impl.ButtonSetting; +import keystrokesmod.module.setting.impl.DescriptionSetting; +import keystrokesmod.module.setting.impl.ModeValue; +import keystrokesmod.module.setting.impl.SubMode; import org.jetbrains.annotations.NotNull; /** diff --git a/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/lowhop/HypixelLowHopPredictSpeed.java b/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/lowhop/HypixelLowHopPredictSpeed.java index 0fb1af1a..a8794d55 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/lowhop/HypixelLowHopPredictSpeed.java +++ b/src/main/java/keystrokesmod/module/impl/movement/speed/hypixel/lowhop/HypixelLowHopPredictSpeed.java @@ -2,12 +2,9 @@ import keystrokesmod.event.PrePlayerInputEvent; import keystrokesmod.module.impl.movement.speed.hypixel.HypixelLowHopSpeed; -import keystrokesmod.module.impl.other.RotationHandler; -import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SubMode; import keystrokesmod.utility.MoveUtil; import keystrokesmod.utility.Utils; -import net.minecraft.potion.Potion; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/keystrokesmod/module/impl/movement/step/HypixelStep.java b/src/main/java/keystrokesmod/module/impl/movement/step/HypixelStep.java index 63995875..a361800a 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/step/HypixelStep.java +++ b/src/main/java/keystrokesmod/module/impl/movement/step/HypixelStep.java @@ -1,89 +1,80 @@ package keystrokesmod.module.impl.movement.step; -import keystrokesmod.event.MoveEvent; +import it.unimi.dsi.fastutil.doubles.DoubleList; import keystrokesmod.event.PreMotionEvent; -import keystrokesmod.event.SprintEvent; +import keystrokesmod.event.StepEvent; import keystrokesmod.module.impl.movement.Step; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.impl.SubMode; -import keystrokesmod.utility.BlockUtils; import keystrokesmod.utility.MoveUtil; +import keystrokesmod.utility.PacketUtils; import keystrokesmod.utility.Utils; -import net.minecraft.potion.Potion; +import net.minecraft.network.play.client.C03PacketPlayer; +import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -import static keystrokesmod.module.impl.world.tower.HypixelTower.isGoingDiagonally; -import static keystrokesmod.module.impl.world.tower.HypixelTower.randomAmount; +import org.jetbrains.annotations.NotNull; public class HypixelStep extends SubMode { - private final SliderSetting boost = new SliderSetting("Boost", 0, 0, 0.4, 0.1); - private final SliderSetting delay = new SliderSetting("Delay", 0, 0, 5000, 250, "ms"); + public static final DoubleList MOTION = DoubleList.of(.41999998688698, .7531999805212, 1.001335997911214, 1.16610926093821, 1.24918707874468, 1.093955074228084); + + private final SliderSetting delay; + private final SliderSetting tick; - private int offGroundTicks = -1; - private boolean stepping = false; + private State state = State.NONE; + private double x, y, z; private long lastStep = -1; - public HypixelStep(String name, Step parent) { + public HypixelStep(String name, @NotNull Step parent) { super(name, parent); - this.registerSetting(boost, delay); + this.registerSetting(delay = new SliderSetting("Delay", 1000, 0, 5000, 250, "ms")); + this.registerSetting(tick = new SliderSetting("Tick", MOTION.size(), 1, MOTION.size(), 1)); } @Override - public void onDisable() { - offGroundTicks = -1; - stepping = false; + public void onDisable() throws Throwable { + mc.thePlayer.stepHeight = 0.6f; + state = State.NONE; } @SubscribeEvent - public void onPreMotion(PreMotionEvent event) { - final long time = System.currentTimeMillis(); - if (mc.thePlayer.onGround && mc.thePlayer.isCollidedHorizontally && MoveUtil.isMoving() && time - lastStep >= delay.getInput()) { - stepping = true; - lastStep = time; - } - } + public void onStep(@NotNull StepEvent event) { + if (event.getHeight() == 1) { + state = State.BALANCE; + Utils.getTimer().timerSpeed = (float) (1.0 / tick.getInput()); + mc.thePlayer.stepHeight = 0.6f; - @SubscribeEvent - public void onMove(MoveEvent event) { - if (mc.thePlayer.onGround) { - offGroundTicks = 0; - } else if (offGroundTicks != -1) { - offGroundTicks++; + x = mc.thePlayer.lastTickPosX; + y = mc.thePlayer.posY; + z = mc.thePlayer.lastTickPosZ; + lastStep = System.currentTimeMillis(); } + } - if (stepping) { - if (!MoveUtil.isMoving() || Utils.jumpDown() || (!mc.thePlayer.isCollidedHorizontally && offGroundTicks > 5)) { - stepping = false; - return; - } - - if (mc.thePlayer.isPotionActive(Potion.jump)) return; - final boolean airUnder = !BlockUtils.insideBlock( - mc.thePlayer.getEntityBoundingBox() - .offset(0, -1, 0) - .expand(0.239, 0, 0.239) - );; - final float speed = isGoingDiagonally(0.1) ? 0.22F : 0.29888888F; + @SubscribeEvent(priority = EventPriority.LOW) + public void onPreMotion(PreMotionEvent event) { + if (System.currentTimeMillis() - lastStep > delay.getInput()) + mc.thePlayer.stepHeight = 1; - switch (offGroundTicks) { - case 0: - event.setY(mc.thePlayer.motionY = 0.4198479950428009); - MoveUtil.strafe(speed - randomAmount()); - break; - case 5: - if (mc.thePlayer.isCollidedHorizontally || !BlockUtils.blockRelativeToPlayer(0, -1, 0).isFullCube()) - return; - MoveUtil.moveFlying(boost.getInput()); - mc.thePlayer.motionY = MoveUtil.predictedMotion(mc.thePlayer.motionY, 2); - break; - } + switch (state) { + case BALANCE: + event.setCanceled(true); + MoveUtil.stop(); + state = State.STEP; + break; + case STEP: + for (double motion : MOTION) { + PacketUtils.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(x, y + motion, z, false)); + } + MoveUtil.stop(); + Utils.resetTimer(); + state = State.NONE; + break; } } - @SubscribeEvent - public void onSprint(SprintEvent event) { - if (stepping) { - event.setOmni(true); - } + private enum State { + NONE, + BALANCE, + STEP } } diff --git a/src/main/java/keystrokesmod/module/impl/movement/teleport/HypixelTeleport.java b/src/main/java/keystrokesmod/module/impl/movement/teleport/HypixelTeleport.java index 28da3903..19ac705a 100644 --- a/src/main/java/keystrokesmod/module/impl/movement/teleport/HypixelTeleport.java +++ b/src/main/java/keystrokesmod/module/impl/movement/teleport/HypixelTeleport.java @@ -19,10 +19,10 @@ import java.util.concurrent.ConcurrentLinkedQueue; public class HypixelTeleport extends SubMode { + private final Queue> delayedPackets = new ConcurrentLinkedQueue<>(); private State state = State.NONE; private int hasLag = 0; private int timerTicks = -1; - private final Queue> delayedPackets = new ConcurrentLinkedQueue<>(); private float yaw, pitch; public HypixelTeleport(String name, @NotNull Teleport parent) { diff --git a/src/main/java/keystrokesmod/module/impl/other/Anticheat.java b/src/main/java/keystrokesmod/module/impl/other/Anticheat.java index 56376e62..d1807ebf 100644 --- a/src/main/java/keystrokesmod/module/impl/other/Anticheat.java +++ b/src/main/java/keystrokesmod/module/impl/other/Anticheat.java @@ -50,6 +50,7 @@ public class Anticheat extends Module { private static ButtonSetting simulationCheck; private PlayerManager manager = new PlayerManager(); + public Anticheat() { super("Anticheat", category.other); this.registerSetting(new DescriptionSetting("Tries to detect cheaters.")); diff --git a/src/main/java/keystrokesmod/module/impl/other/AutoPlay.java b/src/main/java/keystrokesmod/module/impl/other/AutoPlay.java index 379323ae..3591af33 100644 --- a/src/main/java/keystrokesmod/module/impl/other/AutoPlay.java +++ b/src/main/java/keystrokesmod/module/impl/other/AutoPlay.java @@ -15,13 +15,13 @@ import java.util.concurrent.TimeUnit; public class AutoPlay extends Module { - private final ModeSetting mode; - private final SliderSetting delay; private static final String SkywarsWinMessage = "You won! Want to play again? Click here!"; private static final String SkywarsLoseMessage = "You died! Want to play again? Click here!"; private static final String BedwarsWinMessage = "This game has been recorded. Click here to watch the Replay!"; private static final String BedwarsLoseMessage = "You have been eliminated!"; private static final String DuelWinMessage = "YOU WON! Want to play again? CLICK HERE!"; + private final ModeSetting mode; + private final SliderSetting delay; public AutoPlay() { super("AutoPlay", category.other); @@ -33,12 +33,12 @@ public AutoPlay() { @SubscribeEvent public void onReceive(@NotNull ReceivePacketEvent event) { if (event.getPacket() instanceof S02PacketChat) { - S02PacketChat packet = (S02PacketChat)event.getPacket(); + S02PacketChat packet = (S02PacketChat) event.getPacket(); String message = packet.getChatComponent().getUnformattedText(); if (message.contains(SkywarsWinMessage) && message.length() < SkywarsWinMessage.length() + 3 || message.contains(SkywarsLoseMessage) && message.length() < SkywarsLoseMessage.length() + 3 - || message.contains(BedwarsWinMessage) && message.length() < BedwarsWinMessage.length() + 3 - || message.contains(BedwarsLoseMessage) && message.length() < BedwarsLoseMessage.length() + 3) { + || message.contains(BedwarsWinMessage) && message.length() < BedwarsWinMessage.length() + 3 + || message.contains(BedwarsLoseMessage) && message.length() < BedwarsLoseMessage.length() + 3) { Utils.sendModuleMessage(this, "Sending you to a new game."); Raven.getExecutor().schedule(() -> { @@ -46,36 +46,36 @@ public void onReceive(@NotNull ReceivePacketEvent event) { String command = ""; switch ((int) this.mode.getInput()) { // list of commands comes from https://hypixel.net/threads/guide-play-commands-useful-tools-mods-more-new-pixel-party-play-command.1025608/ - case 0: + case 0: command = "/play solo_normal"; break; case 1: command = "/play solo_insane"; break; - case 2: - command = "/play teams_normal"; - break; - case 3: - command = "/play teams_insane"; - break; - case 4: - command = "/play bedwars_eight_one"; - break; - case 5: - command = "/play bedwars_eight_two"; - break; - case 6: - command = "/play bedwars_four_three"; - break; - case 7: - command = "/play bedwars_four_four"; - break; - case 8: - command = "/play bedwars_two_four"; - break; - default: + case 2: + command = "/play teams_normal"; + break; + case 3: + command = "/play teams_insane"; + break; + case 4: + command = "/play bedwars_eight_one"; + break; + case 5: + command = "/play bedwars_eight_two"; + break; + case 6: + command = "/play bedwars_four_three"; + break; + case 7: + command = "/play bedwars_four_four"; + break; + case 8: + command = "/play bedwars_two_four"; + break; + default: command = "/play solo_normal"; - break; + break; } mc.thePlayer.sendChatMessage(command); }, (long) (delay.getInput() * 1000), TimeUnit.MILLISECONDS); diff --git a/src/main/java/keystrokesmod/module/impl/other/AutoRegister.java b/src/main/java/keystrokesmod/module/impl/other/AutoRegister.java index 4bd6ce61..f6eaee6c 100644 --- a/src/main/java/keystrokesmod/module/impl/other/AutoRegister.java +++ b/src/main/java/keystrokesmod/module/impl/other/AutoRegister.java @@ -31,6 +31,31 @@ public AutoRegister() { this.registerSetting(maxDelay = new SliderSetting("Max delay", 3000, 0, 5000, 500)); } + public static @NotNull String generatePassword(@NotNull String gameId) { + final MessageDigest digest; + try { + digest = MessageDigest.getInstance("SHA-256"); + } catch (NoSuchAlgorithmException e) { + Utils.sendMessage("Your environment doesn't support this."); + throw new RuntimeException(e); + } + byte[] hashBytes = digest.digest(gameId.getBytes()); + + final StringBuilder passwordBuilder = new StringBuilder(); + + for (byte b : hashBytes) { + int value = b & 0xFF; + char selectedChar = CHARS[value % CHARS.length]; + passwordBuilder.append(selectedChar); + + if (passwordBuilder.length() >= 12) { + break; + } + } + + return passwordBuilder.toString(); + } + @SubscribeEvent public void onReceivePacket(@NotNull ReceivePacketEvent event) { if (event.getPacket() instanceof S02PacketChat) { @@ -62,29 +87,4 @@ private void handle(boolean register) { PacketUtils.sendPacket(new C01PacketChatMessage(text)); }, time, TimeUnit.MILLISECONDS); } - - public static @NotNull String generatePassword(@NotNull String gameId) { - final MessageDigest digest; - try { - digest = MessageDigest.getInstance("SHA-256"); - } catch (NoSuchAlgorithmException e) { - Utils.sendMessage("Your environment doesn't support this."); - throw new RuntimeException(e); - } - byte[] hashBytes = digest.digest(gameId.getBytes()); - - final StringBuilder passwordBuilder = new StringBuilder(); - - for (byte b : hashBytes) { - int value = b & 0xFF; - char selectedChar = CHARS[value % CHARS.length]; - passwordBuilder.append(selectedChar); - - if (passwordBuilder.length() >= 12) { - break; - } - } - - return passwordBuilder.toString(); - } } diff --git a/src/main/java/keystrokesmod/module/impl/other/AutoRespawn.java b/src/main/java/keystrokesmod/module/impl/other/AutoRespawn.java index fcd6250a..6b223df4 100644 --- a/src/main/java/keystrokesmod/module/impl/other/AutoRespawn.java +++ b/src/main/java/keystrokesmod/module/impl/other/AutoRespawn.java @@ -2,30 +2,34 @@ import keystrokesmod.Raven; import keystrokesmod.event.ReceivePacketEvent; -import java.util.concurrent.TimeUnit; import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.DescriptionSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.PacketUtils; import net.minecraft.client.Minecraft; import net.minecraft.network.play.client.C16PacketClientStatus; -import org.jetbrains.annotations.NotNull; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.jetbrains.annotations.NotNull; + +import java.util.concurrent.TimeUnit; -public class AutoRespawn extends Module{ +public class AutoRespawn extends Module { private final SliderSetting delay; + public AutoRespawn() { super("AutoRespawn", category.other); this.registerSetting(new DescriptionSetting("Automatically respawns you after you die.")); this.registerSetting(delay = new SliderSetting("Delay (ms)", 0, 0, 100000, 1000)); } - @SubscribeEvent + + @SubscribeEvent public void onReceive(@NotNull ReceivePacketEvent event) { - if(Minecraft.getMinecraft().thePlayer.isDead){ + if (Minecraft.getMinecraft().thePlayer.isDead) { Raven.getExecutor().schedule(() -> - PacketUtils.sendPacketNoEvent(new C16PacketClientStatus(C16PacketClientStatus.EnumState.PERFORM_RESPAWN)), - (long) delay.getInput(), - TimeUnit.MILLISECONDS); + PacketUtils.sendPacketNoEvent(new C16PacketClientStatus(C16PacketClientStatus.EnumState.PERFORM_RESPAWN)), + (long) delay.getInput(), + TimeUnit.MILLISECONDS); } - }; + } + } diff --git a/src/main/java/keystrokesmod/module/impl/other/BedProximityAlert.java b/src/main/java/keystrokesmod/module/impl/other/BedProximityAlert.java index 52bedf45..3e28d1b4 100644 --- a/src/main/java/keystrokesmod/module/impl/other/BedProximityAlert.java +++ b/src/main/java/keystrokesmod/module/impl/other/BedProximityAlert.java @@ -45,10 +45,10 @@ public void onPlayerTick(PlayerTickEvent event) { continue; } if (ignoreTeammates.isToggled()) { - if (Utils.isTeamMate(otherPlayer)){ + if (Utils.isTeamMate(otherPlayer)) { return; } - } + } double distance = otherPlayer.getDistance(spawnPos.getX(), spawnPos.getY(), spawnPos.getZ()); String playerName = otherPlayer.getDisplayName().getFormattedText(); @@ -71,6 +71,7 @@ private void ping() { mc.thePlayer.playSound("note.pling", 1.0f, 1.0f); } } + public void informTeam(String playerName, int distance) { if (tellTheteam.isToggled()) { mc.thePlayer.sendChatMessage(Utils.getUnformatedString(playerName + " is " + distance + " blocks away from the bed!")); diff --git a/src/main/java/keystrokesmod/module/impl/other/ClickRecorder.java b/src/main/java/keystrokesmod/module/impl/other/ClickRecorder.java index bf536302..7b7eab00 100644 --- a/src/main/java/keystrokesmod/module/impl/other/ClickRecorder.java +++ b/src/main/java/keystrokesmod/module/impl/other/ClickRecorder.java @@ -16,9 +16,8 @@ public class ClickRecorder extends Module { private final ButtonSetting showMessage; - - private long lastClick = -1; private final List delays = new ArrayList<>(); + private long lastClick = -1; public ClickRecorder() { super("ClickRecorder", category.other); diff --git a/src/main/java/keystrokesmod/module/impl/other/FakeChat.java b/src/main/java/keystrokesmod/module/impl/other/FakeChat.java index ac09bd69..8f7ebcb3 100644 --- a/src/main/java/keystrokesmod/module/impl/other/FakeChat.java +++ b/src/main/java/keystrokesmod/module/impl/other/FakeChat.java @@ -6,10 +6,10 @@ import net.minecraft.util.ChatComponentText; public class FakeChat extends Module { - public static DescriptionSetting a; - public static String msg = "&eThis is a fake chat message."; public static final String command = "fakechat"; public static final String c4 = "&cInvalid message."; + public static DescriptionSetting a; + public static String msg = "&eThis is a fake chat message."; public FakeChat() { super("Fake Chat", Module.category.other, 0); diff --git a/src/main/java/keystrokesmod/module/impl/other/LatencyAlerts.java b/src/main/java/keystrokesmod/module/impl/other/LatencyAlerts.java index f892d9c9..a4dc22e8 100644 --- a/src/main/java/keystrokesmod/module/impl/other/LatencyAlerts.java +++ b/src/main/java/keystrokesmod/module/impl/other/LatencyAlerts.java @@ -10,10 +10,10 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class LatencyAlerts extends Module { - private final SliderSetting minLatency; - private long lastPacket; @Getter private static boolean freeze = false; + private final SliderSetting minLatency; + private long lastPacket; public LatencyAlerts() { super("Latency Alerts", category.other); @@ -40,7 +40,7 @@ public void onUpdate() { freeze = true; mc.ingameGUI.setRecordPlaying( "§7Packet loss has exceeded: §c" + (System.currentTimeMillis() - lastPacket) + "§7ms", - false); + false); } } diff --git a/src/main/java/keystrokesmod/module/impl/other/NameHider.java b/src/main/java/keystrokesmod/module/impl/other/NameHider.java index 83dab950..d1b4a806 100644 --- a/src/main/java/keystrokesmod/module/impl/other/NameHider.java +++ b/src/main/java/keystrokesmod/module/impl/other/NameHider.java @@ -28,8 +28,7 @@ public static String getFakeName(String s) { } s = s.replace(networkPlayerInfo.getGameProfile().getName(), n); } - } - else { + } else { s = s.replace(Utils.getServerName(), n); } } diff --git a/src/main/java/keystrokesmod/module/impl/other/Panic.java b/src/main/java/keystrokesmod/module/impl/other/Panic.java index 7529787c..8782bd95 100644 --- a/src/main/java/keystrokesmod/module/impl/other/Panic.java +++ b/src/main/java/keystrokesmod/module/impl/other/Panic.java @@ -3,6 +3,7 @@ import keystrokesmod.Raven; import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.DescriptionSetting; + import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/keystrokesmod/module/impl/other/RecordClick.java b/src/main/java/keystrokesmod/module/impl/other/RecordClick.java index 0ed01627..cf3aa849 100644 --- a/src/main/java/keystrokesmod/module/impl/other/RecordClick.java +++ b/src/main/java/keystrokesmod/module/impl/other/RecordClick.java @@ -12,19 +12,20 @@ import java.io.File; import java.io.FileReader; import java.io.FileWriter; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; public final class RecordClick extends Module { + public static String[] LOADED_PATTERNS_NAMES = new String[]{Pattern.DEFAULT.getName(), Pattern.VAPE.getName()}; private static File directory; private static List LOADED_PATTERNS = new ArrayList<>(Arrays.asList(Pattern.DEFAULT, Pattern.VAPE)); - public static String[] LOADED_PATTERNS_NAMES = new String[]{Pattern.DEFAULT.getName(), Pattern.VAPE.getName()}; - private static ModeSetting currentPattern; - private int lastPattern = 0; - private static Pattern pattern = Pattern.DEFAULT; private static int index = 0; private static long lastClick = -1; + private int lastPattern = 0; public RecordClick() { super("RecordClick", category.other); @@ -44,14 +45,6 @@ public RecordClick() { loadPatterns(); } - @Override - public void onUpdate() { - if (lastPattern != (int) currentPattern.getInput()) { - reset(); - } - lastPattern = (int) currentPattern.getInput(); - } - public static void click() { lastClick = System.currentTimeMillis(); index++; @@ -158,5 +151,13 @@ public static void savePattern(@NotNull Pattern pattern) { } } + @Override + public void onUpdate() { + if (lastPattern != (int) currentPattern.getInput()) { + reset(); + } + lastPattern = (int) currentPattern.getInput(); + } + } diff --git a/src/main/java/keystrokesmod/module/impl/other/RotationHandler.java b/src/main/java/keystrokesmod/module/impl/other/RotationHandler.java index dd75879a..9761af52 100644 --- a/src/main/java/keystrokesmod/module/impl/other/RotationHandler.java +++ b/src/main/java/keystrokesmod/module/impl/other/RotationHandler.java @@ -11,9 +11,9 @@ import keystrokesmod.module.setting.impl.ModeSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.utils.ModeOnly; -import keystrokesmod.utility.aim.AimSimulator; import keystrokesmod.utility.MoveUtil; import keystrokesmod.utility.RotationUtils; +import keystrokesmod.utility.aim.AimSimulator; import lombok.Getter; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.Entity; @@ -28,6 +28,10 @@ import java.util.Arrays; public final class RotationHandler extends Module { + public static final ButtonSetting rotateBody = new ButtonSetting("Rotate body", true); + public static final ButtonSetting fullBody = new ButtonSetting("Full body", false); + public static final SliderSetting randomYawFactor = new SliderSetting("Random yaw factor", 1.0, 0.0, 10.0, 1.0); + private static final ModeSetting defaultMoveFix = new ModeSetting("Default MoveFix", new String[]{"None", "Silent", "Strict"}, 0); private static @Nullable Float movementYaw = null; private static @Nullable Float rotationYaw = null; @Getter @@ -38,13 +42,8 @@ public final class RotationHandler extends Module { @Getter private static boolean isSet = false; private static MoveFix moveFix = MoveFix.None; - - private static final ModeSetting defaultMoveFix = new ModeSetting("Default MoveFix", new String[]{"None", "Silent", "Strict"}, 0); private final ModeSetting smoothBack = new ModeSetting("Smooth back", new String[]{"None", "Default"}, 0); private final SliderSetting aimSpeed = new SliderSetting("Aim speed", 5, 1, 15, 0.1, new ModeOnly(smoothBack, 1)); - public static final ButtonSetting rotateBody = new ButtonSetting("Rotate body", true); - public static final ButtonSetting fullBody = new ButtonSetting("Full body", false); - public static final SliderSetting randomYawFactor = new SliderSetting("Random yaw factor", 1.0, 0.0, 10.0, 1.0); public RotationHandler() { super("RotationHandler", category.other); @@ -65,36 +64,28 @@ public static void setMovementYaw(float movementYaw) { RotationHandler.movementYaw = movementYaw; } - public static void setRotationYaw(float rotationYaw) { - if (AimSimulator.yawEquals(rotationYaw, mc.thePlayer.rotationYaw)) { - RotationHandler.rotationYaw = null; - return; - } - RotationHandler.rotationYaw = rotationYaw; - } - - public static void setRotationPitch(float rotationPitch) { - if (rotationPitch == mc.thePlayer.rotationPitch) { - RotationHandler.rotationPitch = null; - return; - } - RotationHandler.rotationPitch = rotationPitch; - } - - public static void setMoveFix(MoveFix moveFix) { - RotationHandler.moveFix = moveFix; - } - public static MoveFix getMoveFix() { if (moveFix != null) return moveFix; return MoveFix.values()[(int) defaultMoveFix.getInput()]; } + public static void setMoveFix(MoveFix moveFix) { + RotationHandler.moveFix = moveFix; + } + public static float getRotationYaw() { return getRotationYaw(mc.thePlayer.rotationYaw); } + public static void setRotationYaw(float rotationYaw) { + if (AimSimulator.yawEquals(rotationYaw, mc.thePlayer.rotationYaw)) { + RotationHandler.rotationYaw = null; + return; + } + RotationHandler.rotationYaw = rotationYaw; + } + public static float getRotationYaw(float yaw) { if (rotationYaw != null) return rotationYaw; @@ -105,6 +96,14 @@ public static float getRotationPitch() { return getRotationPitch(mc.thePlayer.rotationPitch); } + public static void setRotationPitch(float rotationPitch) { + if (rotationPitch == mc.thePlayer.rotationPitch) { + RotationHandler.rotationPitch = null; + return; + } + RotationHandler.rotationPitch = rotationPitch; + } + public static float getRotationPitch(float pitch) { if (rotationPitch != null) return rotationPitch; @@ -159,6 +158,7 @@ public void onPreUpdate(PreUpdateEvent event) { /** * Fix movement + * * @param event before update living entity (move) */ @SubscribeEvent(priority = EventPriority.HIGHEST) diff --git a/src/main/java/keystrokesmod/module/impl/other/ScreenshotHelper.java b/src/main/java/keystrokesmod/module/impl/other/ScreenshotHelper.java index 7b06a72a..448d7b8f 100644 --- a/src/main/java/keystrokesmod/module/impl/other/ScreenshotHelper.java +++ b/src/main/java/keystrokesmod/module/impl/other/ScreenshotHelper.java @@ -23,7 +23,7 @@ public class ScreenshotHelper extends Module { private static final String DuelWinMessage = "YOU WON! Want to play again? CLICK HERE!"; private final SliderSetting delay; -// private static final ButtonSetting AntiLag = new ButtonSetting("Anti Lag", true); // Unfinished, but you can use the Essential mod to take Anti-Lag screenshots. + // private static final ButtonSetting AntiLag = new ButtonSetting("Anti Lag", true); // Unfinished, but you can use the Essential mod to take Anti-Lag screenshots. private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); public ScreenshotHelper() { diff --git a/src/main/java/keystrokesmod/module/impl/other/SlotHandler.java b/src/main/java/keystrokesmod/module/impl/other/SlotHandler.java index 585cfa1d..45bd414d 100644 --- a/src/main/java/keystrokesmod/module/impl/other/SlotHandler.java +++ b/src/main/java/keystrokesmod/module/impl/other/SlotHandler.java @@ -6,18 +6,20 @@ import keystrokesmod.module.setting.impl.ModeSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.utils.ModeOnly; +import keystrokesmod.utility.CoolDown; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.Nullable; +import java.util.concurrent.atomic.AtomicInteger; + public final class SlotHandler extends Module { + private static final AtomicInteger currentSlot = new AtomicInteger(-1); + private static final CoolDown coolDown = new CoolDown(-1); private final ModeSetting mode = new ModeSetting("Mode", new String[]{"Default", "Silent"}, 0); - private final SliderSetting switchBackDelay = new SliderSetting("Switch back delay", 100, 0, 1000, 10, "ms", new ModeOnly(mode, 1)); - - private static @Nullable Integer currentSlot = null; - private static long lastSetCurrentSlotTime = -1; + private final SliderSetting switchBackDelay = new SliderSetting("Switch back delay", 100, 50, 1000, 10, "ms", new ModeOnly(mode, 1)); public SlotHandler() { super("SlotHandler", category.other); @@ -26,15 +28,22 @@ public SlotHandler() { } public static int getCurrentSlot() { - if (currentSlot != null) - return currentSlot; + if (isSilentSlot()) + return currentSlot.get(); return mc.thePlayer.inventory.currentItem; } + public static void setCurrentSlot(int slot) { + if (slot >= 0 && slot < 9) { + currentSlot.set(slot); + coolDown.start(); + } + } + public static @Nullable ItemStack getHeldItem() { final InventoryPlayer inventory = mc.thePlayer.inventory; - if (currentSlot != null) - return currentSlot < 9 && currentSlot >= 0 ? inventory.mainInventory[currentSlot] : null; + if (isSilentSlot()) + return inventory.mainInventory[currentSlot.get()]; return getRenderHeldItem(); } @@ -43,11 +52,12 @@ public static int getCurrentSlot() { return inventory.currentItem < 9 && inventory.currentItem >= 0 ? inventory.mainInventory[inventory.currentItem] : null; } - public static void setCurrentSlot(int slot) { - if (slot > 0 && slot < 9) { - currentSlot = slot; - lastSetCurrentSlotTime = System.currentTimeMillis(); - } + public static boolean isSilentSlot() { + return currentSlot.get() != -1; + } + + public static void resetSlot() { + currentSlot.set(-1); } @SubscribeEvent(priority = EventPriority.LOWEST) @@ -55,13 +65,14 @@ public void onPreUpdate(PreUpdateEvent event) { switch ((int) mode.getInput()) { case 0: mc.thePlayer.inventory.currentItem = getCurrentSlot(); - currentSlot = null; + resetSlot(); break; case 1: - if (currentSlot != null + coolDown.setCooldown((long) switchBackDelay.getInput()); + if (isSilentSlot() && !((PlayerControllerMPAccessor) mc.playerController).isHittingBlock() - && System.currentTimeMillis() - lastSetCurrentSlotTime > switchBackDelay.getInput()) - currentSlot = null; + && coolDown.hasFinished()) + resetSlot(); break; } } diff --git a/src/main/java/keystrokesmod/module/impl/other/ViewPackets.java b/src/main/java/keystrokesmod/module/impl/other/ViewPackets.java index e786ec6d..dda2cd75 100644 --- a/src/main/java/keystrokesmod/module/impl/other/ViewPackets.java +++ b/src/main/java/keystrokesmod/module/impl/other/ViewPackets.java @@ -14,14 +14,14 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; public class ViewPackets extends Module { - private ButtonSetting includeCancelled; - private ButtonSetting singlePlayer; - private ButtonSetting sent; - private ButtonSetting ignoreC00; - private ButtonSetting ignoreC03; - private ButtonSetting compactC03; - private ButtonSetting ignoreC0F; - private ButtonSetting received; + private final ButtonSetting includeCancelled; + private final ButtonSetting singlePlayer; + private final ButtonSetting sent; + private final ButtonSetting ignoreC00; + private final ButtonSetting ignoreC03; + private final ButtonSetting compactC03; + private final ButtonSetting ignoreC0F; + private final ButtonSetting received; private Packet packet; private long tick; @@ -37,15 +37,19 @@ public ViewPackets() { this.registerSetting(received = new ButtonSetting("Received", false)); } + private static String formatBoolean(final boolean b) { + return b ? "&atrue" : "&cfalse"; + } + + private static double round(final double n) { + return Utils.rnd(n, 3); + } + public void onDisable() { packet = null; tick = 0; } - private static String formatBoolean(final boolean b) { - return b ? "&atrue" : "&cfalse"; - } - private void sendMessage(final Packet packet, final boolean b) { if (!Utils.nullCheck()) { return; @@ -55,7 +59,7 @@ private void sendMessage(final Packet packet, final boolean b) { final ChatComponentText chatComponentText = new ChatComponentText(Utils.formatColor("&7[&dR&7]&r &7" + (b ? "Received" : "Sent") + " packet (t:&b" + tick + "&7): ")); final ChatStyle chatStyle = new ChatStyle(); chatStyle.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(Utils.formatColor(s)))); - ((IChatComponent)chatComponentText).appendSibling(new ChatComponentText(Utils.formatColor(string)).setChatStyle(chatStyle)); + ((IChatComponent) chatComponentText).appendSibling(new ChatComponentText(Utils.formatColor(string)).setChatStyle(chatStyle)); mc.thePlayer.addChatMessage(chatComponentText); } @@ -96,72 +100,54 @@ public void onReceivePacket(ReceivePacketEvent e) { private String applyInfo(final Packet packet) { String s = "&a" + packet.getClass().getSimpleName(); if (packet instanceof C07PacketPlayerDigging) { - final C07PacketPlayerDigging c07PacketPlayerDigging = (C07PacketPlayerDigging)packet; + final C07PacketPlayerDigging c07PacketPlayerDigging = (C07PacketPlayerDigging) packet; final String string = s + "\n&7Status: &b" + c07PacketPlayerDigging.getStatus().name() + "\n&7Facing: &b" + c07PacketPlayerDigging.getFacing().name(); final BlockPos getPosition = c07PacketPlayerDigging.getPosition(); s = string + "\n&7Position: &b" + getPosition.getX() + "&7, &b" + getPosition.getY() + "&7, &b" + getPosition.getZ(); - } - else if (packet instanceof C09PacketHeldItemChange) { - s = s + "\n&7Swap to slot: &b" + ((C09PacketHeldItemChange)packet).getSlotId(); - } - else if (packet instanceof C0BPacketEntityAction) { - s = s + "\n&7Action: &b" + ((C0BPacketEntityAction)packet).getAction().name() + "\n&7Aux data: &b" + ((C0BPacketEntityAction)packet).getAuxData(); - } - else if (packet instanceof C08PacketPlayerBlockPlacement) { - final C08PacketPlayerBlockPlacement c08PacketPlayerBlockPlacement = (C08PacketPlayerBlockPlacement)packet; + } else if (packet instanceof C09PacketHeldItemChange) { + s = s + "\n&7Swap to slot: &b" + ((C09PacketHeldItemChange) packet).getSlotId(); + } else if (packet instanceof C0BPacketEntityAction) { + s = s + "\n&7Action: &b" + ((C0BPacketEntityAction) packet).getAction().name() + "\n&7Aux data: &b" + ((C0BPacketEntityAction) packet).getAuxData(); + } else if (packet instanceof C08PacketPlayerBlockPlacement) { + final C08PacketPlayerBlockPlacement c08PacketPlayerBlockPlacement = (C08PacketPlayerBlockPlacement) packet; final String string2 = s + "\n&7Item: &b" + ((c08PacketPlayerBlockPlacement.getStack() == null) ? "null" : c08PacketPlayerBlockPlacement.getStack().getItem().getRegistryName().replace("minecraft:", "")) + "\n&7Direction: &b" + c08PacketPlayerBlockPlacement.getPlacedBlockDirection(); final BlockPos getPosition = c08PacketPlayerBlockPlacement.getPosition(); - s = string2 + "\n&7Position: &b" + getPosition.getX() + "&7, &b" + getPosition.getY() + "&7, &b" + getPosition.getZ() + "\n&7Offset: &b" + round((double)c08PacketPlayerBlockPlacement.getPlacedBlockOffsetX()) + "&7, &b" + round((double)c08PacketPlayerBlockPlacement.getPlacedBlockOffsetY()) + "&7, &b" + round(c08PacketPlayerBlockPlacement.getPlacedBlockOffsetZ()); - } - else if (packet instanceof C02PacketUseEntity) { - final C02PacketUseEntity c02PacketUseEntity = (C02PacketUseEntity)packet; + s = string2 + "\n&7Position: &b" + getPosition.getX() + "&7, &b" + getPosition.getY() + "&7, &b" + getPosition.getZ() + "\n&7Offset: &b" + round(c08PacketPlayerBlockPlacement.getPlacedBlockOffsetX()) + "&7, &b" + round(c08PacketPlayerBlockPlacement.getPlacedBlockOffsetY()) + "&7, &b" + round(c08PacketPlayerBlockPlacement.getPlacedBlockOffsetZ()); + } else if (packet instanceof C02PacketUseEntity) { + final C02PacketUseEntity c02PacketUseEntity = (C02PacketUseEntity) packet; final String string3 = s + "\n&7Action: &b" + c02PacketUseEntity.getAction().name(); final Entity getEntityFromWorld = c02PacketUseEntity.getEntityFromWorld(mc.theWorld); final String string4 = string3 + "\n&7Target: &b" + ((getEntityFromWorld == null) ? "null" : getEntityFromWorld.getName()); final Vec3 getHitVec = c02PacketUseEntity.getHitVec(); if (getHitVec == null) { s = string4 + "\n&7Hit vec: &bnull"; - } - else { + } else { s = string4 + "\n&7Hit vec: &b" + round(getHitVec.xCoord) + "&7, &b" + round(getHitVec.yCoord) + "&7, &b" + round(getHitVec.zCoord); } - } - else if (packet instanceof C01PacketChatMessage) { - s = s + "\n&7Length: &b" + ((C01PacketChatMessage)packet).getMessage().length(); - } - else if (packet instanceof C17PacketCustomPayload) { - s = s + "\n&7Channel: &b" + ((C17PacketCustomPayload)packet).getChannelName(); - } - else if (packet instanceof C15PacketClientSettings) { - s = s + "\n&7Language: &b" + ((C15PacketClientSettings)packet).getLang() + "\n&7Chat visibility: &b" + ((C15PacketClientSettings)packet).getChatVisibility().name(); - } - else if (packet instanceof C00PacketKeepAlive) { - s = s + "\n&7Key: &b" + ((C00PacketKeepAlive)packet).getKey(); - } - else if (packet instanceof C16PacketClientStatus) { - s = s + "\n&7Status: &b" + ((C16PacketClientStatus)packet).getStatus().name(); - } - else if (packet instanceof C10PacketCreativeInventoryAction) { - s = s + "\n&7Slot: &b" + ((C10PacketCreativeInventoryAction)packet).getSlotId() + "\n&7Item: &b" + ((((C10PacketCreativeInventoryAction)packet).getStack() == null) ? "null" : ((C10PacketCreativeInventoryAction)packet).getStack().getItem().getRegistryName().replace("minecraft:", "")); - } - else if (packet instanceof C0EPacketClickWindow) { - final C0EPacketClickWindow c0EPacketClickWindow = (C0EPacketClickWindow)packet; + } else if (packet instanceof C01PacketChatMessage) { + s = s + "\n&7Length: &b" + ((C01PacketChatMessage) packet).getMessage().length(); + } else if (packet instanceof C17PacketCustomPayload) { + s = s + "\n&7Channel: &b" + ((C17PacketCustomPayload) packet).getChannelName(); + } else if (packet instanceof C15PacketClientSettings) { + s = s + "\n&7Language: &b" + ((C15PacketClientSettings) packet).getLang() + "\n&7Chat visibility: &b" + ((C15PacketClientSettings) packet).getChatVisibility().name(); + } else if (packet instanceof C00PacketKeepAlive) { + s = s + "\n&7Key: &b" + ((C00PacketKeepAlive) packet).getKey(); + } else if (packet instanceof C16PacketClientStatus) { + s = s + "\n&7Status: &b" + ((C16PacketClientStatus) packet).getStatus().name(); + } else if (packet instanceof C10PacketCreativeInventoryAction) { + s = s + "\n&7Slot: &b" + ((C10PacketCreativeInventoryAction) packet).getSlotId() + "\n&7Item: &b" + ((((C10PacketCreativeInventoryAction) packet).getStack() == null) ? "null" : ((C10PacketCreativeInventoryAction) packet).getStack().getItem().getRegistryName().replace("minecraft:", "")); + } else if (packet instanceof C0EPacketClickWindow) { + final C0EPacketClickWindow c0EPacketClickWindow = (C0EPacketClickWindow) packet; s = s + "\n&7Window: &b" + c0EPacketClickWindow.getWindowId() + "\n&7Slot: &b" + c0EPacketClickWindow.getSlotId() + "\n&7Button: &b" + c0EPacketClickWindow.getUsedButton() + "\n&7Action: &b" + c0EPacketClickWindow.getActionNumber() + "\n&7Mode: &b" + c0EPacketClickWindow.getMode() + "\n&7Item: &b" + ((c0EPacketClickWindow.getClickedItem() == null) ? "null" : c0EPacketClickWindow.getClickedItem().getItem().getRegistryName().replace("minecraft:", "")); - } - else if (packet instanceof C0FPacketConfirmTransaction) { - s = s + "\n&7Window: &b" + ((C0FPacketConfirmTransaction)packet).getWindowId() + "\n&7Uid: &b" + ((C0FPacketConfirmTransaction)packet).getUid(); - } - else if (packet instanceof C03PacketPlayer) { - final C03PacketPlayer c03PacketPlayer = (C03PacketPlayer)packet; - s = s + "\n&7Position: &b" + round(c03PacketPlayer.getPositionX()) + "&7, &b" + round(c03PacketPlayer.getPositionY()) + "&7, &b" + round(c03PacketPlayer.getPositionZ()) + "\n&7Rotations: &b" + round((double)c03PacketPlayer.getYaw()) + "&7, &b" + round((double)c03PacketPlayer.getPitch()) + "\n&7Ground: " + formatBoolean(c03PacketPlayer.isOnGround()) + "\n&7Moving: " + formatBoolean(c03PacketPlayer.isMoving()) + "\n&7Rotating: " + formatBoolean(c03PacketPlayer.getRotating()); + } else if (packet instanceof C0FPacketConfirmTransaction) { + s = s + "\n&7Window: &b" + ((C0FPacketConfirmTransaction) packet).getWindowId() + "\n&7Uid: &b" + ((C0FPacketConfirmTransaction) packet).getUid(); + } else if (packet instanceof C03PacketPlayer) { + final C03PacketPlayer c03PacketPlayer = (C03PacketPlayer) packet; + s = s + "\n&7Position: &b" + round(c03PacketPlayer.getPositionX()) + "&7, &b" + round(c03PacketPlayer.getPositionY()) + "&7, &b" + round(c03PacketPlayer.getPositionZ()) + "\n&7Rotations: &b" + round(c03PacketPlayer.getYaw()) + "&7, &b" + round(c03PacketPlayer.getPitch()) + "\n&7Ground: " + formatBoolean(c03PacketPlayer.isOnGround()) + "\n&7Moving: " + formatBoolean(c03PacketPlayer.isMoving()) + "\n&7Rotating: " + formatBoolean(c03PacketPlayer.getRotating()); } return s + "\n&7Client tick: &e" + tick; } - private static double round(final double n) { - return Utils.rnd(n, 3); - } - @SubscribeEvent public void onTick(TickEvent.ClientTickEvent e) { if (e.phase == TickEvent.Phase.START) { diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/Check.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/Check.java index 43249fa9..01fb08d3 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/Check.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/Check.java @@ -6,8 +6,6 @@ import net.minecraftforge.common.MinecraftForge; import org.jetbrains.annotations.NotNull; -import java.lang.ref.WeakReference; - public abstract class Check { protected final @NotNull TRPlayer player; public String checkName; @@ -19,12 +17,17 @@ public Check(String checkName, @NotNull TRPlayer player) { MinecraftForge.EVENT_BUS.register(this); } + protected static void customMsg(String msg) { + LogUtils.custom(msg); + } + @Override protected void finalize() { MinecraftForge.EVENT_BUS.unregister(this); } public abstract int getAlertBuffer(); + public abstract boolean isDisabled(); protected void flag() { @@ -51,13 +54,18 @@ protected void moduleMsg(String msg) { LogUtils.prefix(checkName, msg); } - protected static void customMsg(String msg) { - LogUtils.custom(msg); + public void _onTick() { } - public void _onTick() {} - public void _onTeleport() {} - public void _onJump() {} - public void _onGameTypeChange() {} - public void _onPlaceBlock() {} + public void _onTeleport() { + } + + public void _onJump() { + } + + public void _onGameTypeChange() { + } + + public void _onPlaceBlock() { + } } diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/CheckManager.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/CheckManager.java index 16e89df5..f0da9bfd 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/CheckManager.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/CheckManager.java @@ -1,10 +1,14 @@ package keystrokesmod.module.impl.other.anticheats; -import keystrokesmod.module.impl.other.anticheats.checks.simulation.Simulation; -import keystrokesmod.module.impl.other.anticheats.utils.world.EntityUtils; -import keystrokesmod.module.impl.other.anticheats.checks.combat.*; +import keystrokesmod.module.impl.other.anticheats.checks.combat.AutoBlockA; +import keystrokesmod.module.impl.other.anticheats.checks.combat.AutoClickerA; +import keystrokesmod.module.impl.other.anticheats.checks.combat.NoSlowA; +import keystrokesmod.module.impl.other.anticheats.checks.combat.ReachA; import keystrokesmod.module.impl.other.anticheats.checks.movement.*; -import keystrokesmod.module.impl.other.anticheats.checks.scaffolding.*; +import keystrokesmod.module.impl.other.anticheats.checks.scaffolding.ScaffoldA; +import keystrokesmod.module.impl.other.anticheats.checks.scaffolding.ScaffoldB; +import keystrokesmod.module.impl.other.anticheats.checks.scaffolding.ScaffoldC; +import keystrokesmod.module.impl.other.anticheats.utils.world.EntityUtils; import net.minecraft.world.WorldSettings; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; @@ -19,6 +23,7 @@ public class CheckManager { private final @NotNull Map, Check> normalChecks; private final @NotNull Map, Check> postChecks; public short disableTick; + public CheckManager(@NotNull Map, Check> preChecks, @NotNull Map, Check> normalChecks, @NotNull Map, Check> postChecks, TRPlayer player) { @@ -68,7 +73,8 @@ public void update() { for (Check check : postChecks.values()) check._onGameTypeChange(); } - if (player.currentGameType == WorldSettings.GameType.CREATIVE || player.currentGameType == WorldSettings.GameType.SPECTATOR) return; + if (player.currentGameType == WorldSettings.GameType.CREATIVE || player.currentGameType == WorldSettings.GameType.SPECTATOR) + return; if (player.fabricPlayer.capabilities.isFlying) return; // bro 1.8.9 is soooooooo special if (player.lastOnGround && !player.currentOnGround) onJump(); diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/PlayerManager.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/PlayerManager.java index 0b3b138c..7ae635f6 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/PlayerManager.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/PlayerManager.java @@ -11,7 +11,10 @@ import net.minecraft.client.entity.AbstractClientPlayer; import org.jetbrains.annotations.NotNull; -import java.util.*; +import java.util.Arrays; +import java.util.ConcurrentModificationException; +import java.util.Map; +import java.util.UUID; public class PlayerManager { public Map activeMap; // 实时活动玩家(可被检查)列表 diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/TRPlayer.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/TRPlayer.java index be48b767..17dbb522 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/TRPlayer.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/TRPlayer.java @@ -39,10 +39,14 @@ public class TRPlayer { public boolean lastSwing = false; public Vec2 currentRot = Vec2.ZERO; public Vec2 lastRot = Vec2.ZERO; - @Range(from = 0, to = 19) public List posHistory = new ArrayList<>(20); - @Range(from = 0, to = 19) public List motionHistory = new ArrayList<>(20); - @Range(from = 0, to = 19) public List vehicleMotionHistory = new ArrayList<>(20); - @Range(from = 0, to = 19) public List sprintHistory = new ArrayList<>(20); + @Range(from = 0, to = 19) + public List posHistory = new ArrayList<>(20); + @Range(from = 0, to = 19) + public List motionHistory = new ArrayList<>(20); + @Range(from = 0, to = 19) + public List vehicleMotionHistory = new ArrayList<>(20); + @Range(from = 0, to = 19) + public List sprintHistory = new ArrayList<>(20); public Vec3 lastOnGroundPos = Vec3.ZERO; public Vec3 lastOnGroundPos2 = Vec3.ZERO; public Vec3 lastInLiquidPos = Vec3.ZERO; @@ -64,10 +68,6 @@ public class TRPlayer { public PlayerData compatPlayerData = new PlayerData(); public @NotNull ScheduledExecutorService timeTask = Executors.newScheduledThreadPool(1); - @Contract("_ -> new") - public static @NotNull TRPlayer create(@NotNull AbstractClientPlayer player) { - return new TRPlayer(player, false); - } public TRPlayer(AbstractClientPlayer player, boolean self) { this.fabricPlayer = player; @@ -83,8 +83,8 @@ public TRPlayer(AbstractClientPlayer player, boolean self) { currentRot = new Vec2(fabricPlayer.rotationPitch, fabricPlayer.rotationYaw); currentOnGround = lastOnGround = lastOnGround2 = fabricPlayer.onGround; currentGameType = lastGameType = - fabricPlayer.isSpectator() ? GameType.SPECTATOR : - GameType.SURVIVAL; + fabricPlayer.isSpectator() ? GameType.SPECTATOR : + GameType.SURVIVAL; for (int i = 0; i < 20; i++) { posHistory.add(currentPos); } @@ -99,6 +99,11 @@ public TRPlayer(AbstractClientPlayer player, boolean self) { } } + @Contract("_ -> new") + public static @NotNull TRPlayer create(@NotNull AbstractClientPlayer player) { + return new TRPlayer(player, false); + } + public void update(AbstractClientPlayer player) { fabricPlayer = player; if (fabricPlayer == null) return; diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/TRSelf.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/TRSelf.java index c608c036..18b821a0 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/TRSelf.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/TRSelf.java @@ -8,20 +8,23 @@ import java.util.concurrent.ScheduledExecutorService; public class TRSelf extends TRPlayer { - public static TRSelf getInstance() { - return instance; - } - private static TRSelf instance = null; public EntityPlayerSP fabricPlayer; public @NotNull ScheduledExecutorService timeTask = Executors.newScheduledThreadPool(8); - public TRSelf(@NotNull EntityPlayerSP player) { super(player, true); this.fabricPlayer = player; instance = this; } + public static TRSelf getInstance() { + return instance; + } + + public static void onDisconnect() { + instance = null; + } + @Override public void update(AbstractClientPlayer player) { if (player instanceof EntityPlayerSP) { @@ -30,8 +33,4 @@ public void update(AbstractClientPlayer player) { super.update(player); } - - public static void onDisconnect() { - instance = null; - } } diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/combat/NoSlowA.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/combat/NoSlowA.java index 6de56ab0..527da441 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/combat/NoSlowA.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/combat/NoSlowA.java @@ -14,6 +14,7 @@ public class NoSlowA extends Check { public static final List SLOW_SPEED = new ArrayList<>(); public short itemUseTick = 0; public short disableTick = 0; // 跳跃弱检测 + public NoSlowA(@NotNull TRPlayer player) { super("NoSlowA", player); SLOW_SPEED.add(2.56); diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/combat/ReachA.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/combat/ReachA.java index 56952c9c..a831a4b0 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/combat/ReachA.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/combat/ReachA.java @@ -38,7 +38,8 @@ private void onSwing() { if (distance < 6 && distance > AdvancedConfig.reachADefaultReach) { // 满足标记条件 flag(String.format("target: %s distance: %.2f", possibleTarget.getName(), distance)); } - } catch (NoSuchElementException ignored) {} + } catch (NoSuchElementException ignored) { + } }, AdvancedConfig.reachACheckDelay * 50L, TimeUnit.MILLISECONDS); } diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/BlinkA.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/BlinkA.java index 3e6b1279..0128582e 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/BlinkA.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/BlinkA.java @@ -8,7 +8,7 @@ public class BlinkA extends Check { - + public BlinkA(@NotNull TRPlayer player) { super("BlinkA", player); } diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/FlyA.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/FlyA.java index f1c3ff74..e40dad40 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/FlyA.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/FlyA.java @@ -18,7 +18,7 @@ public void _onTick() { if (PlayerMove.isNoMove(player.currentMotion) || player.currentOnGround) return; if (player.lastMotion.y() == 0 && player.currentMotion.y() == 0) { - flag(String.format("Invalid Y-motion: %.2f onGround=%s", player.currentMotion.y() , player.currentOnGround)); + flag(String.format("Invalid Y-motion: %.2f onGround=%s", player.currentMotion.y(), player.currentOnGround)); } } diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/GroundSpoofA.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/GroundSpoofA.java index d7a9d73a..6cc952ea 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/GroundSpoofA.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/GroundSpoofA.java @@ -17,22 +17,6 @@ public GroundSpoofA(@NotNull TRPlayer player) { super("GroundSpoofA", player); } - @Override - public void _onTick() { - if (player.lastOnGround2 && player.lastOnGround && player.currentOnGround) { // check if it's legit - final BlockPos groundPos = new BlockPos(player.fabricPlayer).down(); - - if (check(LevelUtils.getClientLevel(), groundPos)) { - flag("spoof onGround=true"); - setback(); - } - } - } - - public void setback() { - player.currentOnGround = false; - } - public static boolean check(@NotNull WorldClient level, @NotNull BlockPos groundPos) { if (!level.getBlockState(groundPos).getBlock().isAir(level, groundPos) || !level.getBlockState(groundPos.down()).getBlock().isAir(level, groundPos.down())) return false; @@ -57,6 +41,22 @@ public static boolean check(@NotNull WorldClient level, @NotNull BlockPos ground return count >= 8; } + @Override + public void _onTick() { + if (player.lastOnGround2 && player.lastOnGround && player.currentOnGround) { // check if it's legit + final BlockPos groundPos = new BlockPos(player.fabricPlayer).down(); + + if (check(LevelUtils.getClientLevel(), groundPos)) { + flag("spoof onGround=true"); + setback(); + } + } + } + + public void setback() { + player.currentOnGround = false; + } + @Override public boolean isDisabled() { return !Anticheat.getMovementCheck().isToggled(); diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/GroundSpoofB.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/GroundSpoofB.java index d5a451d7..502e3316 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/GroundSpoofB.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/GroundSpoofB.java @@ -18,23 +18,6 @@ public GroundSpoofB(@NotNull TRPlayer player) { super("GroundSpoofB", player); } - @Override - public void _onTick() { - final WorldClient level = LevelUtils.getClientLevel(); - if (level == null) return; - - if (!player.currentOnGround && Math.floor(player.currentPos.y()) == player.currentPos.y()) { // check if it's *OnGround* - if (check(level, new BlockPos(player.fabricPlayer).down())) { - flag("spoof onGround=false"); - setback(); - } - } - } - - public void setback() { - player.currentOnGround = true; - } - public static boolean check(@NotNull WorldClient level, @NotNull BlockPos groundPos) { if (!BlockUtils.isFullBlock(level.getBlockState(groundPos))) return false; @@ -59,6 +42,23 @@ public static boolean check(@NotNull WorldClient level, @NotNull BlockPos ground return count >= 8; } + @Override + public void _onTick() { + final WorldClient level = LevelUtils.getClientLevel(); + if (level == null) return; + + if (!player.currentOnGround && Math.floor(player.currentPos.y()) == player.currentPos.y()) { // check if it's *OnGround* + if (check(level, new BlockPos(player.fabricPlayer).down())) { + flag("spoof onGround=false"); + setback(); + } + } + } + + public void setback() { + player.currentOnGround = true; + } + @Override public boolean isDisabled() { return !Anticheat.getMovementCheck().isToggled(); diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/MotionA.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/MotionA.java index 6b00211d..9cde9fe4 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/MotionA.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/MotionA.java @@ -1,6 +1,5 @@ package keystrokesmod.module.impl.other.anticheats.checks.movement; -import keystrokesmod.module.impl.other.Anticheat; import keystrokesmod.module.impl.other.anticheats.Check; import keystrokesmod.module.impl.other.anticheats.TRPlayer; import keystrokesmod.module.impl.other.anticheats.config.AdvancedConfig; @@ -13,7 +12,10 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.Objects; public class MotionA extends Check { public static final List IGNORED_BLOCKS = new ArrayList<>(); @@ -72,6 +74,27 @@ public MotionA(@NotNull TRPlayer player) { JUMP_MOTIONS_2.add(-0.06843069924140427); } + public static @Nullable List getPossibleMotions(@NotNull TRPlayer player) { + try { + switch (player.fabricPlayer.getActivePotionEffects().stream() + .filter(effect -> effect.getEffectName().toLowerCase().contains("jump")) + .findAny() + .orElseThrow(NoSuchElementException::new).getAmplifier()) { + case 0: { + return JUMP_MOTIONS_1; + } + case 1: { + return JUMP_MOTIONS_2; + } + default: { + return null; + } + } + } catch (NoSuchElementException e) { + return JUMP_MOTIONS; + } + } + @Override public void _onTick() { if (disableTicks > 0) { @@ -116,21 +139,6 @@ private boolean check() { && IGNORED_BLOCKS.stream().noneMatch(block -> LevelUtils.getClientLevel().getBlockState(new BlockPos(player.fabricPlayer)).getBlock().equals(block)); } - public static @Nullable List getPossibleMotions(@NotNull TRPlayer player) { - try { - switch (player.fabricPlayer.getActivePotionEffects().stream() - .filter(effect -> effect.getEffectName().toLowerCase().contains("jump")) - .findAny() - .orElseThrow(NoSuchElementException::new).getAmplifier()) { - case 0 : { return JUMP_MOTIONS_1;} - case 1 : { return JUMP_MOTIONS_2;} - default : { return null;} - } - } catch (NoSuchElementException e) { - return JUMP_MOTIONS; - } - } - @Override public int getAlertBuffer() { return AdvancedConfig.motionAAlertBuffer; diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/NoFallA.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/NoFallA.java index 17d6b4b2..d9892110 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/NoFallA.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/NoFallA.java @@ -17,7 +17,7 @@ public void _onTick() { if (!player.fabricPlayer.capabilities.isFlying) { double serverPosX = (double) player.fabricPlayer.serverPosX / 32; double serverPosY = (double) player.fabricPlayer.serverPosY / 32; - double serverPosZ= (double) player.fabricPlayer.serverPosZ / 32; + double serverPosZ = (double) player.fabricPlayer.serverPosZ / 32; double deltaX = Math.abs(player.compatPlayerData.serverPosX - serverPosX); double deltaY = player.compatPlayerData.serverPosY - serverPosY; double deltaZ = Math.abs(player.compatPlayerData.serverPosZ - serverPosZ); diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/SpeedA.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/SpeedA.java index a5e19f03..f13cfdbc 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/SpeedA.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/movement/SpeedA.java @@ -10,6 +10,7 @@ public class SpeedA extends Check { public boolean hasJumped = false; public short jumpTick = 0; + public SpeedA(@NotNull TRPlayer player) { super("SpeedA", player); } @@ -25,7 +26,8 @@ public void _onTick() { if (jumpTick > 0) jumpTick--; // check if player is on ground (not in liquid or in water) - if (player.lastPos == null || player.hasSetback || !player.currentOnGround || !player.lastOnGround || player.fabricPlayer.isInWater()) return; + if (player.lastPos == null || player.hasSetback || !player.currentOnGround || !player.lastOnGround || player.fabricPlayer.isInWater()) + return; double maxSecSpeed; if (jumpTick > 0) diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/scaffolding/ScaffoldA.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/scaffolding/ScaffoldA.java index 648bb3ed..1f098bdc 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/scaffolding/ScaffoldA.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/scaffolding/ScaffoldA.java @@ -3,7 +3,6 @@ import keystrokesmod.module.impl.other.Anticheat; import keystrokesmod.module.impl.other.anticheats.Check; import keystrokesmod.module.impl.other.anticheats.TRPlayer; -import keystrokesmod.module.impl.other.anticheats.config.AdvancedConfig; import org.jetbrains.annotations.NotNull; public class ScaffoldA extends Check { diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/scaffolding/ScaffoldB.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/scaffolding/ScaffoldB.java index d98a2733..3fcfa413 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/scaffolding/ScaffoldB.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/scaffolding/ScaffoldB.java @@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull; public class ScaffoldB extends Check { - public ScaffoldB( @NotNull TRPlayer player) { + public ScaffoldB(@NotNull TRPlayer player) { super("ScaffoldB", player); } diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/simulation/Simulation.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/simulation/Simulation.java index 41133018..96c15ebc 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/simulation/Simulation.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/checks/simulation/Simulation.java @@ -24,7 +24,7 @@ public class Simulation extends Check { for (float forward = -1; forward <= 1; forward++) { for (float strafe = -1; strafe <= 1; strafe++) { for (boolean jump : BOOLEANS) { - for (boolean sneak: BOOLEANS) { + for (boolean sneak : BOOLEANS) { MovementInput input = new MovementInput(); input.moveForward = forward; input.moveStrafe = strafe; @@ -32,8 +32,8 @@ public class Simulation extends Check { input.sneak = sneak; if (input.sneak) { - input.moveStrafe = (float)((double) input.moveStrafe * 0.3); - input.moveForward = (float)((double) input.moveForward * 0.3); + input.moveStrafe = (float) ((double) input.moveStrafe * 0.3); + input.moveForward = (float) ((double) input.moveForward * 0.3); } MOVEMENTS.add(input); diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/config/AdvancedConfig.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/config/AdvancedConfig.java index 1cedded3..6faefe12 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/config/AdvancedConfig.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/config/AdvancedConfig.java @@ -1,7 +1,7 @@ package keystrokesmod.module.impl.other.anticheats.config; public class AdvancedConfig { - + public static boolean blinkCheck = true; public static int blinkAlertBuffer = 10; public static double blinkMaxDistance = 8; @@ -11,7 +11,6 @@ public class AdvancedConfig { public static int noSlowAInJumpDisableTick = 4; - public static boolean speedACheck = true; public static int speedAAlertBuffer = 30; public static int speedAAfterJumpJumpTick = 10; @@ -21,18 +20,17 @@ public class AdvancedConfig { public static double speedAWalkSpeed = 4.317; - public static boolean speedBCheck = true; public static int speedBAlertBuffer = 10; public static boolean groundSpoofACheck = true; public static int groundSpoofAAlertBuffer = 15; - + public static boolean groundSpoofBCheck = true; public static int groundSpoofBAlertBuffer = 15; - + public static boolean autoBlockACheck = false; public static int autoBlockAAlertBuffer = 1; @@ -40,7 +38,7 @@ public class AdvancedConfig { public static boolean speedCCheck = true; public static int speedCAlertBuffer = 10; - + public static boolean motionACheck = true; public static int motionAAlertBuffer = 10; @@ -53,14 +51,14 @@ public class AdvancedConfig { public static int hitBoxAAlertBuffer = 4; public static int hitBoxACheckDelay = 2; - + public static boolean flyACheck = true; public static int flyAAlertBuffer = 30; - + public static boolean flyBCheck = true; public static int flyBAlertBuffer = 30; public static int flyBMinRepeatTicks = 10; - + public static boolean strafeACheck = true; public static int strafeAAlertBuffer = 20; public static double strafeAMaxDiffToFlag = 0.005; diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/alert/LogUtils.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/alert/LogUtils.java index 85f7b5a8..7f3bc60a 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/alert/LogUtils.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/alert/LogUtils.java @@ -18,7 +18,7 @@ public static void alert(String player, String module, String extraMsg) { final ChatComponentText chatComponentText = new ChatComponentText(String.format("%s§r §r%s§r %s§r §b%s§r | %s§r", "§b§lTR§r§l>", player, "failed", module, extraMsg)); final ChatStyle chatStyle = new ChatStyle(); chatStyle.setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/wdr " + player)); - ((IChatComponent)chatComponentText).appendSibling(new ChatComponentText(Utils.formatColor(" §7[§cWDR§7]")).setChatStyle(chatStyle)); + ((IChatComponent) chatComponentText).appendSibling(new ChatComponentText(Utils.formatColor(" §7[§cWDR§7]")).setChatStyle(chatStyle)); Raven.mc.thePlayer.addChatMessage(chatComponentText); if (Anticheat.getShouldPing().isToggled()) { switch ((int) Anticheat.getPingSound().getInput()) { diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/phys/PredictEngine.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/phys/PredictEngine.java index 5b634f66..5f2209c1 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/phys/PredictEngine.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/phys/PredictEngine.java @@ -153,7 +153,7 @@ public void onUpdate() { } private boolean isHeadspaceFree(BlockPos p_isHeadspaceFree_1_, int p_isHeadspaceFree_2_) { - for(int y = 0; y < p_isHeadspaceFree_2_; ++y) { + for (int y = 0; y < p_isHeadspaceFree_2_; ++y) { if (!this.isOpenBlockSpace(p_isHeadspaceFree_1_.add(0, y, 0))) { return false; } @@ -167,7 +167,7 @@ protected boolean pushOutOfBlocks(double p_pushOutOfBlocks_1_, double p_pushOutO BlockPos blockpos = new BlockPos(p_pushOutOfBlocks_1_, p_pushOutOfBlocks_3_, p_pushOutOfBlocks_5_); double d0 = p_pushOutOfBlocks_1_ - (double) blockpos.getX(); double d1 = p_pushOutOfBlocks_5_ - (double) blockpos.getZ(); - int entHeight = Math.max((int) Math.ceil((double) this.height), 1); + int entHeight = Math.max((int) Math.ceil(this.height), 1); boolean inTranslucentBlock = !this.isHeadspaceFree(blockpos, entHeight); if (inTranslucentBlock) { int i = -1; @@ -226,10 +226,10 @@ public void onLivingUpdate() { var10000.moveForward *= 0.2F; } - this.pushOutOfBlocks(this.posX - (double)this.width * 0.35, this.getEntityBoundingBox().minY + 0.5, this.posZ + (double)this.width * 0.35); - this.pushOutOfBlocks(this.posX - (double)this.width * 0.35, this.getEntityBoundingBox().minY + 0.5, this.posZ - (double)this.width * 0.35); - this.pushOutOfBlocks(this.posX + (double)this.width * 0.35, this.getEntityBoundingBox().minY + 0.5, this.posZ - (double)this.width * 0.35); - this.pushOutOfBlocks(this.posX + (double)this.width * 0.35, this.getEntityBoundingBox().minY + 0.5, this.posZ + (double)this.width * 0.35); + this.pushOutOfBlocks(this.posX - (double) this.width * 0.35, this.getEntityBoundingBox().minY + 0.5, this.posZ + (double) this.width * 0.35); + this.pushOutOfBlocks(this.posX - (double) this.width * 0.35, this.getEntityBoundingBox().minY + 0.5, this.posZ - (double) this.width * 0.35); + this.pushOutOfBlocks(this.posX + (double) this.width * 0.35, this.getEntityBoundingBox().minY + 0.5, this.posZ - (double) this.width * 0.35); + this.pushOutOfBlocks(this.posX + (double) this.width * 0.35, this.getEntityBoundingBox().minY + 0.5, this.posZ + (double) this.width * 0.35); if (this.capabilities.allowFlying) { if (player.currentGameType == WorldSettings.GameType.SPECTATOR) { diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/BlockUtils.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/BlockUtils.java index 342e032c..34fbbdc8 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/BlockUtils.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/BlockUtils.java @@ -1,7 +1,6 @@ package keystrokesmod.module.impl.other.anticheats.utils.world; import net.minecraft.block.Block; -import net.minecraft.block.BlockGlass; import net.minecraft.block.state.IBlockState; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/EntityUtils.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/EntityUtils.java index 9ed6cb73..454ae5e8 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/EntityUtils.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/EntityUtils.java @@ -9,7 +9,8 @@ public class EntityUtils { public static boolean isOnPlaceBlock(@NotNull TRPlayer player) { - if (player.currentMainHead == ItemStack.EMPTY || player.lastMainHead == ItemStack.EMPTY) return false; // not as same as 1.20.1 + if (player.currentMainHead == ItemStack.EMPTY || player.lastMainHead == ItemStack.EMPTY) + return false; // not as same as 1.20.1 if (!(player.lastMainHead.isBlock)) return false; // BlockHitResult hitResult1 = RayCastUtils.blockRayCast(player.fabricPlayer, LevelUtils.getClientLevel(), 4.5); diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/PlayerMove.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/PlayerMove.java index aaaf9e71..40017fb1 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/PlayerMove.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/PlayerMove.java @@ -12,7 +12,7 @@ public class PlayerMove { public static double getXzTickSpeed(@NotNull Vec3 lastTick, @NotNull Vec3 currentTick) { - return getXZOnlyPos(currentTick).distanceTo(getXZOnlyPos(lastTick)); + return getXZOnlyPos(currentTick).distanceTo(getXZOnlyPos(lastTick)); } public static double getXzSecSpeed(@NotNull Vec3 lastTick, @NotNull Vec3 currentTick) { @@ -32,7 +32,7 @@ public static double getJumpDistance(@NotNull AbstractClientPlayer player) { .orElseThrow(NullPointerException::new) .getAmplifier() + 1; // return -9.331952072919326 * x * x - 3.672263213983712 * x + 0.6261016701268645; // chat gpt - return 0.04837 * x + 0.5356 * x + 1.252; // numpy + return 0.04837 * x + 0.5356 * x + 1.252; // numpy } catch (NullPointerException e) { return 1.252203340253729; } diff --git a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/PlayerRotation.java b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/PlayerRotation.java index e6d2cc33..a16bf5a1 100644 --- a/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/PlayerRotation.java +++ b/src/main/java/keystrokesmod/module/impl/other/anticheats/utils/world/PlayerRotation.java @@ -11,6 +11,7 @@ public class PlayerRotation { public static float getYaw(@NotNull BlockPos pos) { return getYaw(new Vec3(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5)); } + public static float getYaw(@NotNull AbstractClientPlayer from, @NotNull Vec3 pos) { return from.rotationYaw + MathHelper.wrapAngleTo180_float( diff --git a/src/main/java/keystrokesmod/module/impl/other/chatai/ChatGPTChatAI.java b/src/main/java/keystrokesmod/module/impl/other/chatai/ChatGPTChatAI.java index 3b2a9b6e..ed400c3d 100644 --- a/src/main/java/keystrokesmod/module/impl/other/chatai/ChatGPTChatAI.java +++ b/src/main/java/keystrokesmod/module/impl/other/chatai/ChatGPTChatAI.java @@ -11,16 +11,13 @@ import keystrokesmod.utility.ai.chatgpt.GPTModel; import org.jetbrains.annotations.NotNull; -import java.util.Arrays; import java.util.Collections; public class ChatGPTChatAI extends IChatAI { - private @NotNull String apiKey = ""; - private final ModeSetting model; private final ButtonSetting keepContext; private final ButtonSetting clearContextOnDisable; - + private @NotNull String apiKey = ""; private ChatGPTClient client = null; private ConversationContext context = null; private boolean working = false; diff --git a/src/main/java/keystrokesmod/module/impl/player/AntiAFK.java b/src/main/java/keystrokesmod/module/impl/player/AntiAFK.java index f845cbf7..1f0f28d6 100644 --- a/src/main/java/keystrokesmod/module/impl/player/AntiAFK.java +++ b/src/main/java/keystrokesmod/module/impl/player/AntiAFK.java @@ -11,21 +11,22 @@ import net.minecraft.client.settings.KeyBinding; public class AntiAFK extends Module { - private ModeSetting afk; - private ButtonSetting jump; - private ButtonSetting jumpWhenCollided; - private ButtonSetting randomClicks; - private ButtonSetting swapItem; - private ModeSetting spin; - private ButtonSetting randomizeDelta; - private ButtonSetting randomizePitch; - private SliderSetting minDelay; - private SliderSetting maxDelay; - private String[] afkModes = new String[]{"None", "Wander", "Lateral shuffle", "Forward", "Backward"}; - private String[] spinModes = new String[]{"None", "Random", "Right", "Left"}; + public boolean stop = false; + private final ModeSetting afk; + private final ButtonSetting jump; + private final ButtonSetting jumpWhenCollided; + private final ButtonSetting randomClicks; + private final ButtonSetting swapItem; + private final ModeSetting spin; + private final ButtonSetting randomizeDelta; + private final ButtonSetting randomizePitch; + private final SliderSetting minDelay; + private final SliderSetting maxDelay; + private final String[] afkModes = new String[]{"None", "Wander", "Lateral shuffle", "Forward", "Backward"}; + private final String[] spinModes = new String[]{"None", "Random", "Right", "Left"}; private int ticks; private boolean c; - public boolean stop = false; + public AntiAFK() { super("AntiAFK", category.player); this.registerSetting(afk = new ModeSetting("AFK", afkModes, 0)); @@ -154,14 +155,14 @@ private void b(final int n) { private int h() { if (minDelay.getInput() == maxDelay.getInput()) { - return (int)minDelay.getInput(); + return (int) minDelay.getInput(); } - return Utils.randomizeInt((int)minDelay.getInput(), (int) maxDelay.getInput()); + return Utils.randomizeInt((int) minDelay.getInput(), (int) maxDelay.getInput()); } private void d() { if (randomizePitch.isToggled()) { - mc.thePlayer.rotationPitch = RotationUtils.clampTo90((float)(mc.thePlayer.rotationPitch + this.a())); + mc.thePlayer.rotationPitch = RotationUtils.clampTo90((float) (mc.thePlayer.rotationPitch + this.a())); } } diff --git a/src/main/java/keystrokesmod/module/impl/player/AntiFireball.java b/src/main/java/keystrokesmod/module/impl/player/AntiFireball.java index 7321c75c..9931d8e0 100644 --- a/src/main/java/keystrokesmod/module/impl/player/AntiFireball.java +++ b/src/main/java/keystrokesmod/module/impl/player/AntiFireball.java @@ -20,16 +20,16 @@ import java.util.HashSet; public class AntiFireball extends Module { - private SliderSetting fov; - private SliderSetting range; - private ButtonSetting disableWhileFlying; - private ButtonSetting disableWhileScaffold; - private ButtonSetting blocksRotate; - private ButtonSetting projectileRotate; public ButtonSetting silentSwing; public EntityFireball fireball; - private HashSet fireballs = new HashSet<>(); public boolean attack; + private final SliderSetting fov; + private final SliderSetting range; + private final ButtonSetting disableWhileFlying; + private final ButtonSetting disableWhileScaffold; + private final ButtonSetting blocksRotate; + private final ButtonSetting projectileRotate; + private final HashSet fireballs = new HashSet<>(); public AntiFireball() { super("AntiFireball", category.player); diff --git a/src/main/java/keystrokesmod/module/impl/player/AutoHeal.java b/src/main/java/keystrokesmod/module/impl/player/AutoHeal.java index 59701082..53ca3995 100644 --- a/src/main/java/keystrokesmod/module/impl/player/AutoHeal.java +++ b/src/main/java/keystrokesmod/module/impl/player/AutoHeal.java @@ -89,7 +89,8 @@ public void onRender(TickEvent.RenderTickEvent event) { mc.playerController.sendUseItem(mc.thePlayer, mc.theWorld, stack); lastDoneUse = System.currentTimeMillis(); } else { - if (autoDrop.isToggled() && stack.getItem() instanceof ItemSoup) {mc.thePlayer.dropOneItem(true); + if (autoDrop.isToggled() && stack.getItem() instanceof ItemSoup) { + mc.thePlayer.dropOneItem(true); } if (originalSlot != -1) { diff --git a/src/main/java/keystrokesmod/module/impl/player/AutoPot.java b/src/main/java/keystrokesmod/module/impl/player/AutoPot.java index 47f5b6c0..6504e98a 100644 --- a/src/main/java/keystrokesmod/module/impl/player/AutoPot.java +++ b/src/main/java/keystrokesmod/module/impl/player/AutoPot.java @@ -25,12 +25,10 @@ public class AutoPot extends Module { private final SliderSetting health; private final ButtonSetting randomRot; - + private final ArrayList acceptedPotions = new ArrayList<>(Arrays.asList(6, 1, 5, 8, 14, 12, 10, 16)); private int ticksSinceLastSplash, ticksSinceCanSplash, oldSlot; private boolean needSplash, switchBack; - private final ArrayList acceptedPotions = new ArrayList<>(Arrays.asList(6, 1, 5, 8, 14, 12, 10, 16)); - public AutoPot() { super("AutoPot", category.player); this.registerSetting(new DescriptionSetting("Automatically throws potions.")); @@ -47,7 +45,7 @@ public void onDisable() { public void onRotation(RotationEvent event) { ticksSinceLastSplash++; - Block blockBelow = BlockUtils.getBlock(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY-1, mc.thePlayer.posZ )); + Block blockBelow = BlockUtils.getBlock(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1, mc.thePlayer.posZ)); if (mc.thePlayer.isInWater() || mc.thePlayer.isInLava() || (blockBelow instanceof BlockAir || blockBelow instanceof BlockLadder)) ticksSinceCanSplash = 0; @@ -94,7 +92,7 @@ public void onRotation(RotationEvent event) { if (!needSplash) { needSplash = true; } else { - mc.thePlayer.inventory.currentItem = i-36; + mc.thePlayer.inventory.currentItem = i - 36; final MovingObjectPosition hitResult = RotationUtils.rayCast(1, event.getPitch(), event.getYaw()); if (hitResult != null) { mc.playerController.onPlayerRightClick( diff --git a/src/main/java/keystrokesmod/module/impl/player/AutoSwap.java b/src/main/java/keystrokesmod/module/impl/player/AutoSwap.java index 0a38c808..44ea5c46 100644 --- a/src/main/java/keystrokesmod/module/impl/player/AutoSwap.java +++ b/src/main/java/keystrokesmod/module/impl/player/AutoSwap.java @@ -9,8 +9,9 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class AutoSwap extends Module { - private ButtonSetting sameType; - private ButtonSetting swapToGreaterStack; + private final ButtonSetting sameType; + private final ButtonSetting swapToGreaterStack; + public AutoSwap() { super("AutoSwap", category.player); this.registerSetting(new DescriptionSetting("Automatically swaps blocks.")); diff --git a/src/main/java/keystrokesmod/module/impl/player/AutoWeb.java b/src/main/java/keystrokesmod/module/impl/player/AutoWeb.java index aa373963..91cc9073 100644 --- a/src/main/java/keystrokesmod/module/impl/player/AutoWeb.java +++ b/src/main/java/keystrokesmod/module/impl/player/AutoWeb.java @@ -7,10 +7,10 @@ import keystrokesmod.module.impl.other.SlotHandler; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; -import keystrokesmod.utility.aim.AimSimulator; import keystrokesmod.utility.BlockUtils; import keystrokesmod.utility.RotationUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.aim.AimSimulator; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemBlock; diff --git a/src/main/java/keystrokesmod/module/impl/player/Backtrack.java b/src/main/java/keystrokesmod/module/impl/player/Backtrack.java index f3af6ff2..4db1b247 100644 --- a/src/main/java/keystrokesmod/module/impl/player/Backtrack.java +++ b/src/main/java/keystrokesmod/module/impl/player/Backtrack.java @@ -1,10 +1,5 @@ package keystrokesmod.module.impl.player; -import java.awt.*; -import java.util.*; -import java.util.List; -import java.util.concurrent.ConcurrentLinkedQueue; - import keystrokesmod.event.PreTickEvent; import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.event.ReceivePacketEvent; @@ -28,6 +23,12 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; + public class Backtrack extends Module { public static final Color color = new Color(72, 125, 227); diff --git a/src/main/java/keystrokesmod/module/impl/player/Blink.java b/src/main/java/keystrokesmod/module/impl/player/Blink.java index cf708c4a..6567a8f8 100644 --- a/src/main/java/keystrokesmod/module/impl/player/Blink.java +++ b/src/main/java/keystrokesmod/module/impl/player/Blink.java @@ -15,8 +15,8 @@ import java.awt.*; public class Blink extends Module { - private final ModeValue mode; public static final int color = new Color(255, 255, 255, 200).getRGB(); + private final ModeValue mode; public Blink() { super("Blink", category.player); @@ -26,21 +26,6 @@ public Blink() { ); } - @Override - public void onEnable() throws Throwable { - mode.enable(); - } - - @Override - public void onDisable() throws Throwable { - mode.disable(); - } - - @Override - public String getInfo() { - return mode.getSelected().getInfo(); - } - public static boolean isBlinking() { if (ModuleManager.blink == null) return false; if (ModuleManager.blink.isEnabled()) return true; @@ -77,5 +62,20 @@ public static void drawBox(@NotNull Vec3 pos) { GL11.glDisable(3042); GlStateManager.popMatrix(); } + + @Override + public void onEnable() throws Throwable { + mode.enable(); + } + + @Override + public void onDisable() throws Throwable { + mode.disable(); + } + + @Override + public String getInfo() { + return mode.getSelected().getInfo(); + } } diff --git a/src/main/java/keystrokesmod/module/impl/player/ChestAura.java b/src/main/java/keystrokesmod/module/impl/player/ChestAura.java index 1e597264..c96706e5 100644 --- a/src/main/java/keystrokesmod/module/impl/player/ChestAura.java +++ b/src/main/java/keystrokesmod/module/impl/player/ChestAura.java @@ -13,10 +13,10 @@ import keystrokesmod.module.setting.impl.ModeValue; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.script.classes.Vec3; -import keystrokesmod.utility.aim.AimSimulator; import keystrokesmod.utility.BlockUtils; import keystrokesmod.utility.RotationUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.aim.AimSimulator; import net.minecraft.block.BlockChest; import net.minecraft.block.state.IBlockState; import net.minecraft.client.gui.inventory.GuiChest; @@ -42,14 +42,13 @@ public class ChestAura extends IAutoClicker { private final ButtonSetting onlyCloseChest; private final ButtonSetting onlyNotBelowChest; private final ButtonSetting targetNearbyCheck; - + private final Set clicked = new HashSet<>(); + private final Set opened = new HashSet<>(); private boolean click = false; private Pair target = null; private float yaw; private float pitch; private Float lastYaw = null, lastPitch = null; - private final Set clicked = new HashSet<>(); - private final Set opened = new HashSet<>(); private long lastDone = 0; public ChestAura() { diff --git a/src/main/java/keystrokesmod/module/impl/player/ChestStealer.java b/src/main/java/keystrokesmod/module/impl/player/ChestStealer.java index 5ad78ffc..19f262ac 100644 --- a/src/main/java/keystrokesmod/module/impl/player/ChestStealer.java +++ b/src/main/java/keystrokesmod/module/impl/player/ChestStealer.java @@ -20,6 +20,11 @@ import java.util.concurrent.TimeUnit; public class ChestStealer extends Module { + private static final ButtonSetting customChest = new ButtonSetting("Custom chest", false); + private static final ButtonSetting silent = new ButtonSetting("Silent", false); + private static final ButtonSetting notMoving = new ButtonSetting("Not Moving", false); + public static ButtonSetting allowMouseControl = new ButtonSetting("Allow mouse control", false); + private static State state = State.NONE; private final SliderSetting minStartDelay = new SliderSetting("Min start delay", 100, 0, 500, 10, "ms"); private final SliderSetting maxStartDelay = new SliderSetting("Max start delay", 200, 0, 500, 10, "ms"); private final SliderSetting minStealDelay = new SliderSetting("Min steal delay", 100, 0, 500, 10, "ms"); @@ -29,21 +34,10 @@ public class ChestStealer extends Module { private final ButtonSetting autoCloseIfInvFull = new ButtonSetting("Auto close if inv full", true, autoClose::isToggled); private final SliderSetting minCloseDelay = new SliderSetting("Min close delay", 50, 0, 500, 10, "ms", autoClose::isToggled); private final SliderSetting maxCloseDelay = new SliderSetting("Max close delay", 100, 0, 500, 10, "ms", autoClose::isToggled); - private static final ButtonSetting customChest = new ButtonSetting("Custom chest", false); private final ButtonSetting ignoreTrash = new ButtonSetting("Ignore trash", false); - private static final ButtonSetting silent = new ButtonSetting("Silent", false); - private static final ButtonSetting notMoving = new ButtonSetting("Not Moving", false); - public static ButtonSetting allowMouseControl = new ButtonSetting("Allow mouse control", false); - - private static State state = State.NONE; + private final Set stole = new HashSet<>(); private long nextStealTime; private long nextCloseTime; - private final Set stole = new HashSet<>(); - - public static boolean noChestRender() { - return ModuleManager.chestStealer != null && ModuleManager.chestStealer.isEnabled() - && silent.isToggled() && ContainerUtils.isChest(customChest.isToggled()); - } public ChestStealer() { super("ChestStealer", category.player); @@ -52,6 +46,11 @@ public ChestStealer() { customChest, ignoreTrash, silent, notMoving, allowMouseControl); } + public static boolean noChestRender() { + return ModuleManager.chestStealer != null && ModuleManager.chestStealer.isEnabled() + && silent.isToggled() && ContainerUtils.isChest(customChest.isToggled()); + } + @Override public void guiUpdate() { Utils.correctValue(minStartDelay, maxStartDelay); diff --git a/src/main/java/keystrokesmod/module/impl/player/FakeLag.java b/src/main/java/keystrokesmod/module/impl/player/FakeLag.java index 30aa0436..83bcaea0 100644 --- a/src/main/java/keystrokesmod/module/impl/player/FakeLag.java +++ b/src/main/java/keystrokesmod/module/impl/player/FakeLag.java @@ -1,7 +1,8 @@ package keystrokesmod.module.impl.player; import keystrokesmod.module.Module; -import keystrokesmod.module.impl.player.fakelag.*; +import keystrokesmod.module.impl.player.fakelag.DynamicFakeLag; +import keystrokesmod.module.impl.player.fakelag.LatencyFakeLag; import keystrokesmod.module.setting.impl.ModeValue; public class FakeLag extends Module { diff --git a/src/main/java/keystrokesmod/module/impl/player/InvManager.java b/src/main/java/keystrokesmod/module/impl/player/InvManager.java index 0bdd7847..2d7559fc 100644 --- a/src/main/java/keystrokesmod/module/impl/player/InvManager.java +++ b/src/main/java/keystrokesmod/module/impl/player/InvManager.java @@ -22,7 +22,9 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import java.util.concurrent.TimeUnit; public class InvManager extends Module { @@ -217,14 +219,14 @@ private void sort(int from, int to) { return result; } + @Override + public String getInfo() { + return mode.getOptions()[(int) mode.getInput()]; + } + enum State { NONE, BEFORE, TASKING } - - @Override - public String getInfo() { - return mode.getOptions()[(int) mode.getInput()]; - } } diff --git a/src/main/java/keystrokesmod/module/impl/player/NoFall.java b/src/main/java/keystrokesmod/module/impl/player/NoFall.java index 6a18aad4..0a726f8d 100644 --- a/src/main/java/keystrokesmod/module/impl/player/NoFall.java +++ b/src/main/java/keystrokesmod/module/impl/player/NoFall.java @@ -4,7 +4,7 @@ import keystrokesmod.module.impl.player.nofall.*; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.ModeValue; -import keystrokesmod.utility.*; +import keystrokesmod.utility.Utils; public class NoFall extends Module { private final ModeValue mode; diff --git a/src/main/java/keystrokesmod/module/impl/player/NoRotate.java b/src/main/java/keystrokesmod/module/impl/player/NoRotate.java index 8668ac96..21bb9731 100644 --- a/src/main/java/keystrokesmod/module/impl/player/NoRotate.java +++ b/src/main/java/keystrokesmod/module/impl/player/NoRotate.java @@ -5,7 +5,6 @@ import keystrokesmod.module.Module; import keystrokesmod.module.impl.other.RotationHandler; import keystrokesmod.module.setting.impl.ModeSetting; -import keystrokesmod.utility.Reflection; import keystrokesmod.utility.Utils; import net.minecraft.network.play.server.S08PacketPlayerPosLook; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; diff --git a/src/main/java/keystrokesmod/module/impl/player/Timer.java b/src/main/java/keystrokesmod/module/impl/player/Timer.java index 3b37a420..00a652be 100644 --- a/src/main/java/keystrokesmod/module/impl/player/Timer.java +++ b/src/main/java/keystrokesmod/module/impl/player/Timer.java @@ -6,14 +6,8 @@ import keystrokesmod.module.impl.player.timer.HypixelTimer; import keystrokesmod.module.impl.player.timer.NormalTimer; import keystrokesmod.module.setting.impl.ButtonSetting; -import keystrokesmod.module.setting.impl.ModeSetting; import keystrokesmod.module.setting.impl.ModeValue; -import keystrokesmod.module.setting.impl.SliderSetting; -import keystrokesmod.module.setting.utils.ModeOnly; -import keystrokesmod.utility.MoveUtil; import keystrokesmod.utility.Utils; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; public class Timer extends Module { private final ModeValue mode; diff --git a/src/main/java/keystrokesmod/module/impl/player/antivoid/BacktrackAntiVoid.java b/src/main/java/keystrokesmod/module/impl/player/antivoid/BacktrackAntiVoid.java index f0cf05f0..f09405ad 100644 --- a/src/main/java/keystrokesmod/module/impl/player/antivoid/BacktrackAntiVoid.java +++ b/src/main/java/keystrokesmod/module/impl/player/antivoid/BacktrackAntiVoid.java @@ -30,6 +30,10 @@ public BacktrackAntiVoid(String name, @NotNull AntiVoid parent) { this.registerSetting(clearXZMotion = new ButtonSetting("Clear xz motion", true)); } + private static boolean predVoid() { + return Utils.overVoid(mc.thePlayer.posX + mc.thePlayer.motionX, mc.thePlayer.posY + mc.thePlayer.motionY, mc.thePlayer.posZ + mc.thePlayer.motionZ); + } + @Override public void onUpdate() throws Throwable { if (fallbackPosition == null) { @@ -70,10 +74,6 @@ public void onUpdate() throws Throwable { } } - private static boolean predVoid() { - return Utils.overVoid(mc.thePlayer.posX + mc.thePlayer.motionX, mc.thePlayer.posY + mc.thePlayer.motionY, mc.thePlayer.posZ + mc.thePlayer.motionZ); - } - @Override public void onDisable() throws Throwable { blink.disable(); diff --git a/src/main/java/keystrokesmod/module/impl/player/antivoid/HypixelAntiVoid.java b/src/main/java/keystrokesmod/module/impl/player/antivoid/HypixelAntiVoid.java index 3be07f78..c7cff090 100644 --- a/src/main/java/keystrokesmod/module/impl/player/antivoid/HypixelAntiVoid.java +++ b/src/main/java/keystrokesmod/module/impl/player/antivoid/HypixelAntiVoid.java @@ -16,16 +16,13 @@ import org.jetbrains.annotations.Nullable; import static keystrokesmod.module.ModuleManager.*; -import static keystrokesmod.module.ModuleManager.scaffold; public class HypixelAntiVoid extends SubMode { @Getter private static @Nullable HypixelAntiVoid instance = null; - + public final NormalBlink blink = new NormalBlink("Blink", this); private final SliderSetting distance; private final ButtonSetting toggleScaffold; - - public final NormalBlink blink = new NormalBlink("Blink", this); private Vec3 position, motion; private boolean wasVoid, setBack; private int overVoidTicks; diff --git a/src/main/java/keystrokesmod/module/impl/player/blink/FakeLagBlink.java b/src/main/java/keystrokesmod/module/impl/player/blink/FakeLagBlink.java index 43f281b1..bb39ef69 100644 --- a/src/main/java/keystrokesmod/module/impl/player/blink/FakeLagBlink.java +++ b/src/main/java/keystrokesmod/module/impl/player/blink/FakeLagBlink.java @@ -38,15 +38,15 @@ public class FakeLagBlink extends SubMode { private final ButtonSetting drawRealPosition; private final Queue packetQueue = new ConcurrentLinkedQueue<>(); + private final Animation animationX = new Animation(Easing.EASE_OUT_CIRC, 200); + private final Animation animationY = new Animation(Easing.EASE_OUT_CIRC, 200); + private final Animation animationZ = new Animation(Easing.EASE_OUT_CIRC, 200); + private final Progress progress = new Progress("Blink"); public boolean needToDisable = false; private Vec3 vec3 = Vec3.ZERO; private long startTime = 0; private long stopTime = 0; private long blinkedTime = 0; - private final Animation animationX = new Animation(Easing.EASE_OUT_CIRC, 200); - private final Animation animationY = new Animation(Easing.EASE_OUT_CIRC, 200); - private final Animation animationZ = new Animation(Easing.EASE_OUT_CIRC, 200); - private final Progress progress = new Progress("Blink"); public FakeLagBlink(String name, @NotNull Blink parent) { super(name, parent); diff --git a/src/main/java/keystrokesmod/module/impl/player/blink/NormalBlink.java b/src/main/java/keystrokesmod/module/impl/player/blink/NormalBlink.java index 2510a8ab..33d3b826 100644 --- a/src/main/java/keystrokesmod/module/impl/player/blink/NormalBlink.java +++ b/src/main/java/keystrokesmod/module/impl/player/blink/NormalBlink.java @@ -25,12 +25,11 @@ import java.util.List; public class NormalBlink extends SubMode { + public final ButtonSetting overlay; + public final List> blinkedPackets = new ArrayList<>(); private final ButtonSetting pulse; private final SliderSetting pulseDelay; private final ButtonSetting initialPosition; - public final ButtonSetting overlay; - - public final List> blinkedPackets = new ArrayList<>(); private long startTime = -1; private Vec3 pos; diff --git a/src/main/java/keystrokesmod/module/impl/player/fakelag/DynamicFakeLag.java b/src/main/java/keystrokesmod/module/impl/player/fakelag/DynamicFakeLag.java index 09ec0091..3f1e5370 100644 --- a/src/main/java/keystrokesmod/module/impl/player/fakelag/DynamicFakeLag.java +++ b/src/main/java/keystrokesmod/module/impl/player/fakelag/DynamicFakeLag.java @@ -30,12 +30,11 @@ public class DynamicFakeLag extends SubMode { private final SliderSetting stopRange; private final SliderSetting maxTargetRange; private final ButtonSetting debug; - + private final Queue packetQueue = new ConcurrentLinkedQueue<>(); private AbstractClientPlayer target = null; private long lastDisableTime = -1; private boolean lastHurt = false; private long lastStartBlinkTime = -1; - private final Queue packetQueue = new ConcurrentLinkedQueue<>(); public DynamicFakeLag(String name, @NotNull FakeLag parent) { super(name, parent); @@ -94,14 +93,15 @@ public void onRenderTick(TickEvent.RenderTickEvent ev) { blink.disable(); } else if (!blink.isEnabled() && distance > stopRange.getInput() && new Vec3(mc.thePlayer).distanceTo(target) < startRange.getInput()) { - if (debug.isToggled()) Utils.sendModuleMessage(parent, "start lag: in range."); + if (debug.isToggled()) Utils.sendModuleMessage(parent, "start lag: in range."); lastStartBlinkTime = System.currentTimeMillis(); blink.enable(); } else if (blink.isEnabled() && distance > startRange.getInput()) { if (debug.isToggled()) Utils.sendModuleMessage(parent, "stop lag: out of range."); blink.disable(); } else if (distance > maxTargetRange.getInput()) { - if (debug.isToggled()) Utils.sendModuleMessage(parent, String.format("release target: %s", target.getName())); + if (debug.isToggled()) + Utils.sendModuleMessage(parent, String.format("release target: %s", target.getName())); target = null; blink.disable(); } @@ -109,7 +109,7 @@ && new Vec3(mc.thePlayer).distanceTo(target) < startRange.getInput()) { lastHurt = mc.thePlayer.hurtTime > 0; } - + @SubscribeEvent public void onAttack(@NotNull AttackEntityEvent e) { if (e.target instanceof AbstractClientPlayer) { diff --git a/src/main/java/keystrokesmod/module/impl/player/fakelag/LatencyFakeLag.java b/src/main/java/keystrokesmod/module/impl/player/fakelag/LatencyFakeLag.java index 04a27da4..5f38ccd5 100644 --- a/src/main/java/keystrokesmod/module/impl/player/fakelag/LatencyFakeLag.java +++ b/src/main/java/keystrokesmod/module/impl/player/fakelag/LatencyFakeLag.java @@ -21,7 +21,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; @@ -29,9 +28,8 @@ public class LatencyFakeLag extends SubMode { private final SliderSetting delay; private final ButtonSetting drawRealPosition; - - private Vec3 vec3 = null; private final Queue packetQueue = new ConcurrentLinkedQueue<>(); + private Vec3 vec3 = null; public LatencyFakeLag(String name, @NotNull FakeLag parent) { super(name, parent); @@ -53,6 +51,7 @@ public void onRender(RenderWorldLastEvent event) { Blink.drawBox(vec3.toVec3()); } } + @SubscribeEvent(priority = EventPriority.HIGHEST) public void onRenderTick(TickEvent.RenderTickEvent ev) { if (!Utils.nullCheck()) { @@ -61,6 +60,7 @@ public void onRenderTick(TickEvent.RenderTickEvent ev) { } sendPacket(true); } + @SubscribeEvent(priority = EventPriority.HIGHEST) public void onSendPacket(@NotNull SendPacketEvent e) { if (!Utils.nullCheck()) return; diff --git a/src/main/java/keystrokesmod/module/impl/player/nofall/HypixelBlinkNoFall.java b/src/main/java/keystrokesmod/module/impl/player/nofall/HypixelBlinkNoFall.java index 65568012..1c1335e0 100644 --- a/src/main/java/keystrokesmod/module/impl/player/nofall/HypixelBlinkNoFall.java +++ b/src/main/java/keystrokesmod/module/impl/player/nofall/HypixelBlinkNoFall.java @@ -10,16 +10,14 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; -import static keystrokesmod.module.ModuleManager.blink; import static keystrokesmod.module.ModuleManager.scaffold; public class HypixelBlinkNoFall extends SubMode { private final SliderSetting minFallDistance; - + private final NormalBlink blink = new NormalBlink("Blink", this); private boolean blinked = false; private boolean prevOnGround = false; private double fallDistance = 0; - private final NormalBlink blink = new NormalBlink("Blink", this); public HypixelBlinkNoFall(String name, @NotNull NoFall parent) { super(name, parent); diff --git a/src/main/java/keystrokesmod/module/impl/player/nofall/LegitNoFall.java b/src/main/java/keystrokesmod/module/impl/player/nofall/LegitNoFall.java index 25d72047..df517243 100644 --- a/src/main/java/keystrokesmod/module/impl/player/nofall/LegitNoFall.java +++ b/src/main/java/keystrokesmod/module/impl/player/nofall/LegitNoFall.java @@ -8,9 +8,9 @@ import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.impl.SubMode; -import keystrokesmod.utility.aim.AimSimulator; import keystrokesmod.utility.RotationUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.aim.AimSimulator; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; diff --git a/src/main/java/keystrokesmod/module/impl/player/nofall/VulcanNoFall.java b/src/main/java/keystrokesmod/module/impl/player/nofall/VulcanNoFall.java index 14fa4b64..110c2260 100644 --- a/src/main/java/keystrokesmod/module/impl/player/nofall/VulcanNoFall.java +++ b/src/main/java/keystrokesmod/module/impl/player/nofall/VulcanNoFall.java @@ -14,9 +14,8 @@ import java.util.List; public class VulcanNoFall extends SubMode { - private final SliderSetting minFallDistance; - public static final List maxModCount = new ArrayList<>(Arrays.asList(3, 2, 2)); + private final SliderSetting minFallDistance; private int currentModCount = 0; private int hasModCount = 0; diff --git a/src/main/java/keystrokesmod/module/impl/render/Ambience.java b/src/main/java/keystrokesmod/module/impl/render/Ambience.java index 2853cdb8..55cbebb2 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Ambience.java +++ b/src/main/java/keystrokesmod/module/impl/render/Ambience.java @@ -3,7 +3,6 @@ import keystrokesmod.event.PreMotionEvent; import keystrokesmod.event.ReceivePacketEvent; import keystrokesmod.module.Module; -import keystrokesmod.module.ModuleManager; import keystrokesmod.module.setting.impl.ModeSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.Utils; @@ -21,8 +20,8 @@ public class Ambience extends Module { public Ambience() { super("Ambience", category.render); - this.registerSetting(time = new SliderSetting("Time", 0,0, 24000, 10)); - this.registerSetting(speed = new SliderSetting("Speed", 0,0, 20, 1)); + this.registerSetting(time = new SliderSetting("Time", 0, 0, 24000, 10)); + this.registerSetting(speed = new SliderSetting("Speed", 0, 0, 20, 1)); String[] MODES = new String[]{"Unchanged", "Clear", "Rain"}; this.registerSetting(weather = new ModeSetting("Weather", MODES, 0)); @@ -74,9 +73,7 @@ public void onPreMotion(PreMotionEvent event) { public void onReceivePacket(@NotNull ReceivePacketEvent event) { if (event.getPacket() instanceof S03PacketTimeUpdate) { event.setCanceled(true); - } - - else if (event.getPacket() instanceof S2BPacketChangeGameState && this.weather.getInput() != 0) { + } else if (event.getPacket() instanceof S2BPacketChangeGameState && this.weather.getInput() != 0) { S2BPacketChangeGameState s2b = (S2BPacketChangeGameState) event.getPacket(); if (s2b.getGameState() == 1 || s2b.getGameState() == 2) { diff --git a/src/main/java/keystrokesmod/module/impl/render/Animations.java b/src/main/java/keystrokesmod/module/impl/render/Animations.java index 8d9cc235..e2b055fa 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Animations.java +++ b/src/main/java/keystrokesmod/module/impl/render/Animations.java @@ -22,11 +22,11 @@ import org.lwjgl.opengl.GL11; public class Animations extends Module { + public static final ButtonSetting swingWhileDigging = new ButtonSetting("Swing while digging", true); + public static final ButtonSetting clientSide = new ButtonSetting("Client side (visual 1.7)", true, swingWhileDigging::isToggled); private final ModeSetting blockAnimation = new ModeSetting("Block animation", new String[]{"None", "1.7", "Smooth", "Exhibition", "Stab", "Spin", "Sigma", "Wood", "Swong", "Chill", "Komorebi", "Rhys", "Allah"}, 1); private final ModeSetting swingAnimation = new ModeSetting("Swing animation", new String[]{"None", "1.9+", "Smooth", "Punch", "Shove"}, 0); private final ModeSetting otherAnimation = new ModeSetting("Other animation", new String[]{"None", "1.7"}, 1); - public static final ButtonSetting swingWhileDigging = new ButtonSetting("Swing while digging", true); - public static final ButtonSetting clientSide = new ButtonSetting("Client side (visual 1.7)", true, swingWhileDigging::isToggled); private final ButtonSetting fakeSlotReset = new ButtonSetting("Fake slot reset", false); private final SliderSetting x = new SliderSetting("X", 0, -1, 1, 0.05); private final SliderSetting y = new SliderSetting("Y", 0, -1, 1, 0.05); @@ -282,11 +282,11 @@ public void onPreMotion(PreMotionEvent event) { public void onSwingAnimation(@NotNull SwingAnimationEvent event) { event.setAnimationEnd(event.getAnimationEnd() * (int) ((-swingSpeed.getInput() / 100) + 1)); } - + private void translate(double x, double y, double z) { GlStateManager.translate( - x + this.x.getInput(), - y + this.y.getInput(), + x + this.x.getInput(), + y + this.y.getInput(), z + this.z.getInput() ); } @@ -307,15 +307,15 @@ private void func_178105_d(float swingProgress) { private void func_178104_a(ItemStack itemToRender, @NotNull AbstractClientPlayer p_178104_1_, float p_178104_2_) { if (itemToRender == null) return; - float f = (float)p_178104_1_.getItemInUseCount() - p_178104_2_ + 1.0F; - float f1 = f / (float)itemToRender.getMaxItemUseDuration(); + float f = (float) p_178104_1_.getItemInUseCount() - p_178104_2_ + 1.0F; + float f1 = f / (float) itemToRender.getMaxItemUseDuration(); float f2 = MathHelper.abs(MathHelper.cos(f / 4.0F * 3.1415927F) * 0.1F); if (f1 >= 0.8F) { f2 = 0.0F; } this.translate(0.0F, f2, 0.0F); - float f3 = 1.0F - (float)Math.pow(f1, 27.0); + float f3 = 1.0F - (float) Math.pow(f1, 27.0); this.translate(f3 * 0.6F, f3 * -0.5F, f3 * 0.0F); GlStateManager.rotate(f3 * 90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(f3 * 10.0F, 1.0F, 0.0F, 0.0F); @@ -330,7 +330,7 @@ private void func_178098_a(@NotNull ItemStack itemToRender, float p_178098_1_, @ GlStateManager.rotate(-12.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(-8.0F, 1.0F, 0.0F, 0.0F); this.translate(-0.9F, 0.2F, 0.0F); - float f = (float)itemToRender.getMaxItemUseDuration() - ((float)p_178098_2_.getItemInUseCount() - p_178098_1_ + 1.0F); + float f = (float) itemToRender.getMaxItemUseDuration() - ((float) p_178098_2_.getItemInUseCount() - p_178098_1_ + 1.0F); float f1 = f / 20.0F; f1 = (f1 * f1 + f1 * 2.0F) / 3.0F; if (f1 > 1.0F) { diff --git a/src/main/java/keystrokesmod/module/impl/render/AntiShuffle.java b/src/main/java/keystrokesmod/module/impl/render/AntiShuffle.java index 984a3a1c..0e0f9881 100644 --- a/src/main/java/keystrokesmod/module/impl/render/AntiShuffle.java +++ b/src/main/java/keystrokesmod/module/impl/render/AntiShuffle.java @@ -5,7 +5,7 @@ public class AntiShuffle extends Module { public static DescriptionSetting a; - private static String c = "§k"; + private static final String c = "§k"; public AntiShuffle() { super("AntiShuffle", Module.category.render, 0); diff --git a/src/main/java/keystrokesmod/module/impl/render/BedESP.java b/src/main/java/keystrokesmod/module/impl/render/BedESP.java index 4e389b6c..9234d098 100644 --- a/src/main/java/keystrokesmod/module/impl/render/BedESP.java +++ b/src/main/java/keystrokesmod/module/impl/render/BedESP.java @@ -5,9 +5,9 @@ import keystrokesmod.module.setting.impl.ModeSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.BlockUtils; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Theme; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.render.RenderUtils; import net.minecraft.block.BlockBed; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; @@ -26,11 +26,11 @@ public class BedESP extends Module { public ModeSetting theme; - private SliderSetting range; - private SliderSetting rate; - private ButtonSetting firstBed; + private final SliderSetting range; + private final SliderSetting rate; + private final ButtonSetting firstBed; private BlockPos[] bed = null; - private List beds = new ArrayList<>(); + private final List beds = new ArrayList<>(); private long lastCheck = 0; public BedESP() { diff --git a/src/main/java/keystrokesmod/module/impl/render/BedPlates.java b/src/main/java/keystrokesmod/module/impl/render/BedPlates.java index a5dce1b9..309c4c73 100644 --- a/src/main/java/keystrokesmod/module/impl/render/BedPlates.java +++ b/src/main/java/keystrokesmod/module/impl/render/BedPlates.java @@ -7,6 +7,7 @@ import keystrokesmod.utility.CoolDown; import keystrokesmod.utility.ShaderUtils; import keystrokesmod.utility.Utils; +import net.minecraft.block.Block; import net.minecraft.block.BlockBed; import net.minecraft.block.state.IBlockState; import net.minecraft.client.gui.Gui; @@ -14,7 +15,6 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; -import net.minecraft.block.Block; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.entity.EntityJoinWorldEvent; @@ -22,8 +22,8 @@ import org.jetbrains.annotations.NotNull; import java.awt.*; -import java.util.*; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import static org.lwjgl.opengl.GL11.*; @@ -34,11 +34,11 @@ public class BedPlates extends Module { public static SliderSetting updateRate, yShift, layers; private final CoolDown updateCooldown = new CoolDown(0); private final ButtonSetting showDistance; - private BlockPos[] bed = null; private final SliderSetting range; private final List beds = new ArrayList<>(); private final ButtonSetting firstBed; private final List> bedBlocks = new ArrayList<>(); + private BlockPos[] bed = null; public BedPlates() { super("Bed Plates", category.render); @@ -50,6 +50,24 @@ public BedPlates() { this.registerSetting(firstBed = new ButtonSetting("Only render first bed", false)); } + public static void drawRound(double x, double y, double width, double height, double radius, @NotNull Color color) { + GlStateManager.color(1, 1, 1, 1); + roundedShader.init(); + + setupRoundedRectUniforms(x, y, width, height, radius); + roundedShader.setUniformf("color", color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f); + + ShaderUtils.drawQuads(x - 1, y - 1, width + 2, height + 2); + roundedShader.unload(); + } + + private static void setupRoundedRectUniforms(double x, double y, double width, double height, double radius) { + ScaledResolution sr = new ScaledResolution(mc); + BedPlates.roundedShader.setUniformf("location", x * sr.getScaleFactor(), (mc.displayHeight - (height * sr.getScaleFactor())) - (y * sr.getScaleFactor())); + BedPlates.roundedShader.setUniformf("rectSize", width * sr.getScaleFactor(), height * sr.getScaleFactor()); + BedPlates.roundedShader.setUniformf("radius", radius * sr.getScaleFactor()); + } + public void onUpdate() { if (Utils.nullCheck()) { if (updateCooldown.hasFinished()) { @@ -140,12 +158,12 @@ private void drawPlate(BlockPos blockPos, int index) { glScaled(-0.01666666753590107D * Math.sqrt(mc.thePlayer.getDistance(blockPos.getX(), blockPos.getY(), blockPos.getZ())), -0.01666666753590107D * Math.sqrt(mc.thePlayer.getDistance(blockPos.getX(), blockPos.getY(), blockPos.getZ())), 0.01666666753590107D * Math.sqrt(mc.thePlayer.getDistance(blockPos.getX(), blockPos.getY(), blockPos.getZ()))); List blocks = bedBlocks.get(index); drawRound(Math.max(17.5, blocks.size() * 17.5) / -2, -0.5, Math.max(17.5, blocks.size() * 17.5) - 2.5, 26.5, 3, new Color(0, 0, 0, 90)); - if(showDistance.isToggled()) { + if (showDistance.isToggled()) { String dist = Math.round(mc.thePlayer.getDistance(blockPos.getX(), blockPos.getY(), blockPos.getZ())) + "m"; mc.fontRendererObj.drawString(dist, -mc.fontRendererObj.getStringWidth(dist) / 2, 0, new Color(255, 255, 255, 255).getRGB()); } double offset = (blocks.size() * -17.5) / 2; - for (Block block :blocks) { + for (Block block : blocks) { mc.getTextureManager().bindTexture(new ResourceLocation("keystrokesmod:images/" + block.getLocalizedName() + ".png")); Gui.drawModalRectWithCustomSizedTexture((int) offset, 10, 0, 0, 15, 15, 15, 15); offset += 17.5; @@ -204,22 +222,4 @@ private boolean isValidBedBlock(Block block) { block.equals(Blocks.end_stone) || block.equals(Blocks.obsidian) || block.equals(Blocks.water); } - - public static void drawRound(double x, double y, double width, double height, double radius, @NotNull Color color) { - GlStateManager.color(1, 1, 1, 1); - roundedShader.init(); - - setupRoundedRectUniforms(x, y, width, height, radius); - roundedShader.setUniformf("color", color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f); - - ShaderUtils.drawQuads(x - 1, y - 1, width + 2, height + 2); - roundedShader.unload(); - } - - private static void setupRoundedRectUniforms(double x, double y, double width, double height, double radius) { - ScaledResolution sr = new ScaledResolution(mc); - BedPlates.roundedShader.setUniformf("location", x * sr.getScaleFactor(), (mc.displayHeight - (height * sr.getScaleFactor())) - (y * sr.getScaleFactor())); - BedPlates.roundedShader.setUniformf("rectSize", width * sr.getScaleFactor(), height * sr.getScaleFactor()); - BedPlates.roundedShader.setUniformf("radius", radius * sr.getScaleFactor()); - } } \ No newline at end of file diff --git a/src/main/java/keystrokesmod/module/impl/render/BreakProgress.java b/src/main/java/keystrokesmod/module/impl/render/BreakProgress.java index 0b93a7d1..e75e2d71 100644 --- a/src/main/java/keystrokesmod/module/impl/render/BreakProgress.java +++ b/src/main/java/keystrokesmod/module/impl/render/BreakProgress.java @@ -24,11 +24,11 @@ public class BreakProgress extends Module { private final ButtonSetting manual; private final ButtonSetting bedAura; private final ButtonSetting progressBar; + private final Animation progressAnimation = new Animation(Easing.EASE_OUT_CIRC, 200); + private final Progress progressObj = new Progress("BedAura"); private double progress; private BlockPos block; private String progressStr; - private final Animation progressAnimation = new Animation(Easing.EASE_OUT_CIRC, 200); - private final Progress progressObj = new Progress("BedAura"); public BreakProgress() { super("BreakProgress", category.render); @@ -74,11 +74,11 @@ public void onRenderWorld(RenderWorldLastEvent e) { private void setProgress() { switch ((int) mode.getInput()) { case 0: { - this.progressStr = (int) (100.0 * (this.progress / 1.0)) + "%"; + this.progressStr = (int) (100.0 * (this.progress)) + "%"; break; } case 1: { - double timeLeft = Utils.rnd((double) ((1.0f - this.progress) / BlockUtils.getBlockHardness(BlockUtils.getBlock(this.block), mc.thePlayer.getHeldItem(), false, false)) / 20.0, 1); + double timeLeft = Utils.rnd((1.0f - this.progress) / BlockUtils.getBlockHardness(BlockUtils.getBlock(this.block), mc.thePlayer.getHeldItem(), false, false) / 20.0, 1); this.progressStr = timeLeft == 0 ? "0" : timeLeft + "s"; break; } diff --git a/src/main/java/keystrokesmod/module/impl/render/Chams.java b/src/main/java/keystrokesmod/module/impl/render/Chams.java index dbd7368c..fcad02a8 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Chams.java +++ b/src/main/java/keystrokesmod/module/impl/render/Chams.java @@ -12,8 +12,8 @@ import java.util.HashSet; public class Chams extends Module { - private ButtonSetting ignoreBots; - private HashSet bots = new HashSet<>(); + private final ButtonSetting ignoreBots; + private final HashSet bots = new HashSet<>(); public Chams() { super("Chams", Module.category.render, 0); diff --git a/src/main/java/keystrokesmod/module/impl/render/ChestESP.java b/src/main/java/keystrokesmod/module/impl/render/ChestESP.java index cfbadad8..31ebafa5 100644 --- a/src/main/java/keystrokesmod/module/impl/render/ChestESP.java +++ b/src/main/java/keystrokesmod/module/impl/render/ChestESP.java @@ -3,8 +3,8 @@ import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.render.RenderUtils; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.tileentity.TileEntityEnderChest; @@ -14,8 +14,13 @@ import java.awt.*; public class ChestESP extends Module { - private SliderSetting red, green, blue; - private ButtonSetting rainbow, outline, shade, disableIfOpened; + private final SliderSetting red; + private final SliderSetting green; + private final SliderSetting blue; + private final ButtonSetting rainbow; + private final ButtonSetting outline; + private final ButtonSetting shade; + private final ButtonSetting disableIfOpened; public ChestESP() { super("ChestESP", Module.category.render, 0); diff --git a/src/main/java/keystrokesmod/module/impl/render/CustomCape.java b/src/main/java/keystrokesmod/module/impl/render/CustomCape.java index 2e1ee4ab..65bef37a 100644 --- a/src/main/java/keystrokesmod/module/impl/render/CustomCape.java +++ b/src/main/java/keystrokesmod/module/impl/render/CustomCape.java @@ -15,21 +15,21 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; -import java.util.*; import java.util.ArrayList; import java.util.List; +import java.util.Objects; import static com.mojang.realmsclient.gui.ChatFormatting.*; public final class CustomCape extends Module { - private static File directory; + public static final List LOADED_CAPES = new ArrayList<>(); public static String[] CAPES_NAME = new String[]{ "RavenAnime", "RavenAqua", "RavenGreen", "RavenPurple", "RavenRed", "RavenWhite", "RavenYellow", "Cherry", "Die", "Astolfo" }; - public static final List LOADED_CAPES = new ArrayList<>(); public static final ModeSetting cape = new ModeSetting("Cape", CAPES_NAME, 0); + private static File directory; public CustomCape() { super("CustomCape", category.render); @@ -47,8 +47,7 @@ public CustomCape() { this.registerSetting(new ButtonSetting("Open folder", () -> { try { Desktop.getDesktop().open(directory); - } - catch (IOException ex) { + } catch (IOException ex) { Raven.profileManager.directory.mkdirs(); Utils.sendMessage("&cError locating folder, recreated."); } diff --git a/src/main/java/keystrokesmod/module/impl/render/Explosions.java b/src/main/java/keystrokesmod/module/impl/render/Explosions.java index 26fa21c7..f04e75b4 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Explosions.java +++ b/src/main/java/keystrokesmod/module/impl/render/Explosions.java @@ -2,7 +2,6 @@ import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.ButtonSetting; -import keystrokesmod.module.setting.impl.DescriptionSetting; import keystrokesmod.utility.Utils; import keystrokesmod.utility.render.RenderUtils; import net.minecraft.client.renderer.GlStateManager; @@ -39,7 +38,7 @@ public void onRenderWorld(RenderWorldLastEvent e) { if (showBlastRing.isToggled()) { renderBlastRing(); } - if(showDamageRing.isToggled()) { + if (showDamageRing.isToggled()) { renderExplosionSphere(); } GL11.glPopMatrix(); diff --git a/src/main/java/keystrokesmod/module/impl/render/FreeLook.java b/src/main/java/keystrokesmod/module/impl/render/FreeLook.java index 6f040beb..5a2f91ab 100644 --- a/src/main/java/keystrokesmod/module/impl/render/FreeLook.java +++ b/src/main/java/keystrokesmod/module/impl/render/FreeLook.java @@ -1,6 +1,8 @@ package keystrokesmod.module.impl.render; -import keystrokesmod.event.*; +import keystrokesmod.event.JumpEvent; +import keystrokesmod.event.PrePlayerInputEvent; +import keystrokesmod.event.RotationEvent; import keystrokesmod.module.Module; import keystrokesmod.module.ModuleManager; import keystrokesmod.module.setting.impl.ButtonSetting; @@ -13,25 +15,14 @@ import javax.annotation.Nullable; public class FreeLook extends Module { - private final ButtonSetting onlyIfPressed = new ButtonSetting("Only if pressed", true); - public static @Nullable ViewData viewData = null; + private final ButtonSetting onlyIfPressed = new ButtonSetting("Only if pressed", true); public FreeLook() { super("FreeLook", category.render); this.registerSetting(onlyIfPressed); } - @Override - public void onDisable() { - if (viewData != null) { - mc.gameSettings.thirdPersonView = viewData.thirdPersonView; - mc.thePlayer.rotationYaw = viewData.rotationYaw; - mc.thePlayer.rotationPitch = viewData.rotationPitch; - } - viewData = null; - } - public static void call() { if (ModuleManager.freeLook.isEnabled() && FreeLook.viewData != null) { mc.objectMouseOver = RotationUtils.rayCast( @@ -42,6 +33,16 @@ public static void call() { } } + @Override + public void onDisable() { + if (viewData != null) { + mc.gameSettings.thirdPersonView = viewData.thirdPersonView; + mc.thePlayer.rotationYaw = viewData.rotationYaw; + mc.thePlayer.rotationPitch = viewData.rotationPitch; + } + viewData = null; + } + @SubscribeEvent(priority = EventPriority.HIGHEST) public void onPreMotion(RotationEvent event) { try { @@ -52,7 +53,7 @@ public void onPreMotion(RotationEvent event) { } catch (IndexOutOfBoundsException ignored) { } - if (viewData != null){ + if (viewData != null) { call(); if (!event.isSet()) { event.setYaw(viewData.rotationYaw); diff --git a/src/main/java/keystrokesmod/module/impl/render/Freecam.java b/src/main/java/keystrokesmod/module/impl/render/Freecam.java index d1a374bd..21c98900 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Freecam.java +++ b/src/main/java/keystrokesmod/module/impl/render/Freecam.java @@ -4,8 +4,8 @@ import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.render.RenderUtils; import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraft.network.play.client.C02PacketUseEntity; import net.minecraft.network.play.client.C07PacketPlayerDigging; @@ -19,15 +19,15 @@ import java.awt.*; public class Freecam extends Module { - public SliderSetting speed; - private ButtonSetting disableOnDamage; - private ButtonSetting showArm; - private ButtonSetting allowDigging; - private ButtonSetting allowInteracting; - private ButtonSetting allowPlacing; public static EntityOtherPlayerMP freeEntity = null; + public SliderSetting speed; + private final ButtonSetting disableOnDamage; + private final ButtonSetting showArm; + private final ButtonSetting allowDigging; + private final ButtonSetting allowInteracting; + private final ButtonSetting allowPlacing; private int[] lcc = new int[]{Integer.MAX_VALUE, 0}; - private float[] sAng = new float[]{0.0F, 0.0F}; + private final float[] sAng = new float[]{0.0F, 0.0F}; public Freecam() { super("Freecam", category.render, 0); diff --git a/src/main/java/keystrokesmod/module/impl/render/FullBright.java b/src/main/java/keystrokesmod/module/impl/render/FullBright.java index 90548623..69b42697 100644 --- a/src/main/java/keystrokesmod/module/impl/render/FullBright.java +++ b/src/main/java/keystrokesmod/module/impl/render/FullBright.java @@ -10,9 +10,9 @@ import net.minecraftforge.fml.common.gameevent.TickEvent.PlayerTickEvent; public class FullBright extends Module { + private static final float brightness = 15.0f; private final ModeSetting mode; private float originalGamma; - private static final float brightness = 15.0f; private boolean nightVisionEnabled = false; private int lastMode = -1; diff --git a/src/main/java/keystrokesmod/module/impl/render/HUD.java b/src/main/java/keystrokesmod/module/impl/render/HUD.java index c58885fd..a1a09fe3 100644 --- a/src/main/java/keystrokesmod/module/impl/render/HUD.java +++ b/src/main/java/keystrokesmod/module/impl/render/HUD.java @@ -7,12 +7,15 @@ import keystrokesmod.module.setting.impl.DescriptionSetting; import keystrokesmod.module.setting.impl.ModeSetting; import keystrokesmod.module.setting.impl.SubMode; +import keystrokesmod.utility.Theme; +import keystrokesmod.utility.Utils; import keystrokesmod.utility.font.FontManager; import keystrokesmod.utility.font.IFont; import keystrokesmod.utility.render.RenderUtils; -import keystrokesmod.utility.Theme; -import keystrokesmod.utility.Utils; -import net.minecraft.client.gui.*; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiChat; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.config.GuiButtonExt; @@ -24,20 +27,11 @@ import java.awt.*; import java.io.IOException; -import java.util.*; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; public class HUD extends Module { - public static ModeSetting theme; - public static ModeSetting font; - public static ButtonSetting dropShadow; - private final ButtonSetting background; - private final ButtonSetting sidebar; - public static ButtonSetting alphabeticalSort; - private static ButtonSetting alignRight; - public static ButtonSetting lowercase; - public static ButtonSetting showInfo; private static final ButtonSetting combat = new ButtonSetting("Combat", true); private static final ButtonSetting movement = new ButtonSetting("Movement", true); private static final ButtonSetting player = new ButtonSetting("Player", true); @@ -50,8 +44,17 @@ public class HUD extends Module { private static final ButtonSetting scripts = new ButtonSetting("Scripts", true); private static final ButtonSetting exploit = new ButtonSetting("Exploit", true); private static final ButtonSetting experimental = new ButtonSetting("Experimental", true); + public static ModeSetting theme; + public static ModeSetting font; + public static ButtonSetting dropShadow; + public static ButtonSetting alphabeticalSort; + public static ButtonSetting lowercase; + public static ButtonSetting showInfo; public static int hudX = 5; public static int hudY = 70; + private static ButtonSetting alignRight; + private final ButtonSetting background; + private final ButtonSetting sidebar; private boolean isAlphabeticalSort; private boolean canShowInfo; @@ -77,6 +80,65 @@ public HUD() { this.registerSetting(combat, movement, player, world, render, minigames, fun, other, client, scripts, exploit, experimental); } + public static double getLongestModule(IFont fr) { + double length = 0; + + for (Module module : ModuleManager.organizedModules) { + if (module.isEnabled()) { + String moduleName = module.getPrettyName(); + if (showInfo.isToggled() && !module.getInfo().isEmpty()) { + moduleName += " §7" + module.getInfo(); + } + if (lowercase.isToggled()) { + moduleName = moduleName.toLowerCase(); + } + if (fr.width(moduleName) > length) { + length = fr.width(moduleName); + } + } + } + return length; + } + + private static boolean isIgnored(@NotNull Module module) { + if (!module.isEnabled() || module.getName().equals("HUD")) + return true; + if (module instanceof SubMode) + return true; + + if (module.moduleCategory() == category.combat && !combat.isToggled()) return true; + if (module.moduleCategory() == category.movement && !movement.isToggled()) return true; + if (module.moduleCategory() == category.player && !player.isToggled()) return true; + if (module.moduleCategory() == category.world && !world.isToggled()) return true; + if (module.moduleCategory() == category.render && !render.isToggled()) return true; + if (module.moduleCategory() == category.minigames && !minigames.isToggled()) return true; + if (module.moduleCategory() == category.fun && !fun.isToggled()) return true; + if (module.moduleCategory() == category.other && !other.isToggled()) return true; + if (module.moduleCategory() == category.client && !client.isToggled()) return true; + if (module.moduleCategory() == category.scripts && !scripts.isToggled()) return true; + if (module.moduleCategory() == category.exploit && !exploit.isToggled()) return true; + if (module.moduleCategory() == category.experimental && !experimental.isToggled()) return true; + + if (module.isHidden()) { + return true; + } + return module == ModuleManager.commandLine; + } + + public static IFont getFontRenderer() { + switch ((int) font.getInput()) { + default: + case 0: + return FontManager.getMinecraft(); + case 1: + return FontManager.productSans20; + case 2: + return FontManager.regular22; + case 3: + return FontManager.tenacity20; + } + } + public void onEnable() { ModuleManager.sort(); } @@ -129,8 +191,7 @@ public void onRenderTick(@NotNull RenderTickEvent ev) { getFontRenderer().drawString(text, n3, n, e, dropShadow.isToggled()); n += Math.round(getFontRenderer().height() + 2); } - } - catch (Exception exception) { + } catch (Exception exception) { Utils.sendMessage("&cAn error occurred rendering HUD. check your logs"); Utils.sendDebugMessage(Arrays.toString(exception.getStackTrace())); Utils.log.error(exception); @@ -157,26 +218,6 @@ private List getDrawTexts() { return texts; } - public static double getLongestModule(IFont fr) { - double length = 0; - - for (Module module : ModuleManager.organizedModules) { - if (module.isEnabled()) { - String moduleName = module.getPrettyName(); - if (showInfo.isToggled() && !module.getInfo().isEmpty()) { - moduleName += " §7" + module.getInfo(); - } - if (lowercase.isToggled()) { - moduleName = moduleName.toLowerCase(); - } - if (fr.width(moduleName) > length) { - length = fr.width(moduleName); - } - } - } - return length; - } - static class EditScreen extends GuiScreen { final String example = "This is an-Example-HUD"; GuiButtonExt resetPosition; @@ -220,8 +261,7 @@ public void drawScreen(int mX, int mY, float pt) { this.maX = maX; this.maY = maY; this.clickMinX = miX; - } - else { + } else { this.maX = clickPos[0]; this.maY = clickPos[1]; this.clickMinX = clickPos[2]; @@ -260,8 +300,7 @@ public void onRenderTick(RenderTickEvent event) { fr.drawString(s, (float) x, (float) y, Color.white.getRGB(), HUD.dropShadow.isToggled()); y += Math.round(fr.height() + 2); } - } - else { + } else { double longestModule = getLongestModule(getFontRenderer()); double n = this.miY; double n2 = 0.0; @@ -278,8 +317,7 @@ public void onRenderTick(RenderTickEvent event) { int e = Theme.getGradient((int) theme.getInput(), n2); if (theme.getInput() == 0) { n2 -= 120; - } - else { + } else { n2 -= 12; } double n3 = this.miX; @@ -370,43 +408,4 @@ private boolean empty() { return true; } } - - private static boolean isIgnored(@NotNull Module module) { - if (!module.isEnabled() || module.getName().equals("HUD")) - return true; - if (module instanceof SubMode) - return true; - - if (module.moduleCategory() == category.combat && !combat.isToggled()) return true; - if (module.moduleCategory() == category.movement && !movement.isToggled()) return true; - if (module.moduleCategory() == category.player && !player.isToggled()) return true; - if (module.moduleCategory() == category.world && !world.isToggled()) return true; - if (module.moduleCategory() == category.render && !render.isToggled()) return true; - if (module.moduleCategory() == category.minigames && !minigames.isToggled()) return true; - if (module.moduleCategory() == category.fun && !fun.isToggled()) return true; - if (module.moduleCategory() == category.other && !other.isToggled()) return true; - if (module.moduleCategory() == category.client && !client.isToggled()) return true; - if (module.moduleCategory() == category.scripts && !scripts.isToggled()) return true; - if (module.moduleCategory() == category.exploit && !exploit.isToggled()) return true; - if (module.moduleCategory() == category.experimental && !experimental.isToggled()) return true; - - if (module.isHidden()) { - return true; - } - return module == ModuleManager.commandLine; - } - - public static IFont getFontRenderer() { - switch ((int) font.getInput()) { - default: - case 0: - return FontManager.getMinecraft(); - case 1: - return FontManager.productSans20; - case 2: - return FontManager.regular22; - case 3: - return FontManager.tenacity20; - } - } } diff --git a/src/main/java/keystrokesmod/module/impl/render/Indicators.java b/src/main/java/keystrokesmod/module/impl/render/Indicators.java index 1741120b..cc831f53 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Indicators.java +++ b/src/main/java/keystrokesmod/module/impl/render/Indicators.java @@ -4,9 +4,9 @@ import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.Reflection; +import keystrokesmod.utility.Utils; import keystrokesmod.utility.render.ColorUtils; import keystrokesmod.utility.render.RenderUtils; -import keystrokesmod.utility.Utils; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityEnderPearl; @@ -28,18 +28,19 @@ import java.util.concurrent.ConcurrentHashMap; public class Indicators extends Module { - private ButtonSetting renderArrows; - private ButtonSetting renderPearls; - private ButtonSetting renderFireballs; - private ButtonSetting renderPlayers; - private SliderSetting radius; - private ButtonSetting itemColors, arrowColor; - private ButtonSetting renderItem; - private ButtonSetting threatsOnly; - private HashSet threats = new HashSet<>(); - private Map lastHeldItems = new ConcurrentHashMap<>(); - private int pearlColor = new Color(173, 12, 255).getRGB(); - private int fireBallColor = new Color(255, 109, 0).getRGB(); + private final ButtonSetting renderArrows; + private final ButtonSetting renderPearls; + private final ButtonSetting renderFireballs; + private final ButtonSetting renderPlayers; + private final SliderSetting radius; + private final ButtonSetting itemColors; + private final ButtonSetting arrowColor; + private final ButtonSetting renderItem; + private final ButtonSetting threatsOnly; + private final HashSet threats = new HashSet<>(); + private final Map lastHeldItems = new ConcurrentHashMap<>(); + private final int pearlColor = new Color(173, 12, 255).getRGB(); + private final int fireBallColor = new Color(255, 109, 0).getRGB(); public Indicators() { super("Indicators", category.render); @@ -116,7 +117,7 @@ public void onRenderTick(TickEvent.RenderTickEvent event) { GL11.glTranslated(x + position[0], y + position[1], 0.0); String distanceStr = (int) mc.thePlayer.getDistanceToEntity(e) + "m"; float textWidth = mc.fontRendererObj.getStringWidth(distanceStr); - mc.fontRendererObj.drawStringWithShadow(distanceStr, -textWidth / 2, -mc.fontRendererObj.FONT_HEIGHT/2, -1); + mc.fontRendererObj.drawStringWithShadow(distanceStr, -textWidth / 2, -mc.fontRendererObj.FONT_HEIGHT / 2, -1); GL11.glPopMatrix(); GL11.glPushMatrix(); @@ -125,8 +126,7 @@ public void onRenderTick(TickEvent.RenderTickEvent event) { RenderUtils.drawArrow(-5f, (float) -radius.getInput() - 38, itemColors.isToggled() ? color : -1, 3, 5); GL11.glPopMatrix(); } - } - catch (Exception ex) { + } catch (Exception ex) { ex.printStackTrace(); } } @@ -147,18 +147,14 @@ private boolean canRender(Entity entity) { try { if (entity instanceof EntityArrow && !Reflection.inGround.getBoolean(entity) && renderArrows.isToggled()) { return true; - } - else if (entity instanceof EntityFireball && renderFireballs.isToggled()) { + } else if (entity instanceof EntityFireball && renderFireballs.isToggled()) { return true; - } - else if (entity instanceof EntityEnderPearl && renderPearls.isToggled()) { + } else if (entity instanceof EntityEnderPearl && renderPearls.isToggled()) { return true; - } - else if (entity instanceof EntityPlayer && renderPlayers.isToggled()) { + } else if (entity instanceof EntityPlayer && renderPlayers.isToggled()) { return true; } - } - catch (IllegalAccessException e) { + } catch (IllegalAccessException e) { Utils.sendMessage("&cIssue checking entity."); e.printStackTrace(); return false; diff --git a/src/main/java/keystrokesmod/module/impl/render/ItemESP.java b/src/main/java/keystrokesmod/module/impl/render/ItemESP.java index 9f96c370..24f9633e 100644 --- a/src/main/java/keystrokesmod/module/impl/render/ItemESP.java +++ b/src/main/java/keystrokesmod/module/impl/render/ItemESP.java @@ -2,8 +2,8 @@ import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.ButtonSetting; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.render.RenderUtils; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; @@ -20,7 +20,8 @@ import java.util.Map; public class ItemESP extends Module { // entirely skidded from raven b4 source leak - private ButtonSetting renderIron, renderGold; + private final ButtonSetting renderIron; + private final ButtonSetting renderGold; public ItemESP() { super("ItemESP", category.render); @@ -28,6 +29,70 @@ public ItemESP() { this.registerSetting(renderGold = new ButtonSetting("Render gold", true)); } + public static double c(double n, double n2, double n3) { + if (n == 0.0) { + n = 1.0; + } + if (n2 == 0.0) { + n2 = 1.0; + } + if (n3 == 0.0) { + n3 = 1.0; + } + return Math.round((n + 1.0) * Math.floor(n2) * (n3 + 2.0)); + } + + private static double a(Item item, double n, double n2, double n3) { + double c = c(n, n2, n3); + if (item == Items.iron_ingot) { + c += 0.155; + } else if (item == Items.gold_ingot) { + c += 0.255; + } else if (item == Items.diamond) { + c += 0.355; + } else if (item == Items.emerald) { + c += 0.455; + } + return c; + } + + public static void c(int n, int n2, int n3, double n4, double n5, double n6, double n7) { + n4 -= mc.getRenderManager().viewerPosX; + n5 -= mc.getRenderManager().viewerPosY; + n6 -= mc.getRenderManager().viewerPosZ; + GL11.glPushMatrix(); + GL11.glBlendFunc(770, 771); + GL11.glEnable(3042); + GL11.glLineWidth(2.0f); + GL11.glDisable(3553); + GL11.glDisable(2929); + GL11.glDepthMask(false); + float n8 = (n >> 16 & 0xFF) / 255.0f; + float n9 = (n >> 8 & 0xFF) / 255.0f; + float n10 = (n & 0xFF) / 255.0f; + float min = Math.min(Math.max(0.2f, (float) (0.009999999776482582 * n7)), 0.4f); + RenderUtils.drawBoundingBox(new AxisAlignedBB(n4 - min, n5, n6 - min, n4 + min, n5 + min * 2.0f, n6 + min), n8, n9, n10, 0.35f); + GL11.glEnable(3553); + GL11.glEnable(2929); + GL11.glDepthMask(true); + GL11.glDisable(3042); + GL11.glPopMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.translate((float) n4, (float) n5 + 0.3, (float) n6); + GlStateManager.rotate(-mc.getRenderManager().playerViewY, 0.0f, 1.0f, 0.0f); + GlStateManager.rotate(mc.getRenderManager().playerViewX, 1.0f, 0.0f, 0.0f); + float min2 = Math.min(Math.max(0.02266667f, (float) (0.001500000013038516 * n7)), 0.07f); + GlStateManager.scale(-min2, -min2, -min2); + GlStateManager.depthMask(false); + GlStateManager.disableDepth(); + String value = String.valueOf(n3); + mc.fontRendererObj.drawString(value, -(mc.fontRendererObj.getStringWidth(value) / 2) + min2 * 3.5f, -(123.805f * min2 - 2.47494f), n2, true); + GlStateManager.enableDepth(); + GlStateManager.depthMask(true); + GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); + GlStateManager.popMatrix(); + } + @SubscribeEvent public void onRenderWorldLast(RenderWorldLastEvent e) { HashMap> hashMap = new HashMap<>(); @@ -99,68 +164,4 @@ public void onRenderWorldLast(RenderWorldLastEvent e) { } } } - - public static double c(double n, double n2, double n3) { - if (n == 0.0) { - n = 1.0; - } - if (n2 == 0.0) { - n2 = 1.0; - } - if (n3 == 0.0) { - n3 = 1.0; - } - return Math.round((n + 1.0) * Math.floor(n2) * (n3 + 2.0)); - } - - private static double a(Item item, double n, double n2, double n3) { - double c = c(n, n2, n3); - if (item == Items.iron_ingot) { - c += 0.155; - } else if (item == Items.gold_ingot) { - c += 0.255; - } else if (item == Items.diamond) { - c += 0.355; - } else if (item == Items.emerald) { - c += 0.455; - } - return c; - } - - public static void c(int n, int n2, int n3, double n4, double n5, double n6, double n7) { - n4 -= mc.getRenderManager().viewerPosX; - n5 -= mc.getRenderManager().viewerPosY; - n6 -= mc.getRenderManager().viewerPosZ; - GL11.glPushMatrix(); - GL11.glBlendFunc(770, 771); - GL11.glEnable(3042); - GL11.glLineWidth(2.0f); - GL11.glDisable(3553); - GL11.glDisable(2929); - GL11.glDepthMask(false); - float n8 = (n >> 16 & 0xFF) / 255.0f; - float n9 = (n >> 8 & 0xFF) / 255.0f; - float n10 = (n & 0xFF) / 255.0f; - float min = Math.min(Math.max(0.2f, (float) (0.009999999776482582 * n7)), 0.4f); - RenderUtils.drawBoundingBox(new AxisAlignedBB(n4 - min, n5, n6 - min, n4 + min, n5 + min * 2.0f, n6 + min), n8, n9, n10, 0.35f); - GL11.glEnable(3553); - GL11.glEnable(2929); - GL11.glDepthMask(true); - GL11.glDisable(3042); - GL11.glPopMatrix(); - GlStateManager.pushMatrix(); - GlStateManager.translate((float) n4, (float) n5 + 0.3, (float) n6); - GlStateManager.rotate(-mc.getRenderManager().playerViewY, 0.0f, 1.0f, 0.0f); - GlStateManager.rotate(mc.getRenderManager().playerViewX, 1.0f, 0.0f, 0.0f); - float min2 = Math.min(Math.max(0.02266667f, (float) (0.001500000013038516 * n7)), 0.07f); - GlStateManager.scale(-min2, -min2, -min2); - GlStateManager.depthMask(false); - GlStateManager.disableDepth(); - String value = String.valueOf(n3); - mc.fontRendererObj.drawString(value, -(mc.fontRendererObj.getStringWidth(value) / 2) + min2 * 3.5f, -(123.805f * min2 - 2.47494f), n2, true); - GlStateManager.enableDepth(); - GlStateManager.depthMask(true); - GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); - GlStateManager.popMatrix(); - } } diff --git a/src/main/java/keystrokesmod/module/impl/render/MobESP.java b/src/main/java/keystrokesmod/module/impl/render/MobESP.java index 95af7553..a4323067 100644 --- a/src/main/java/keystrokesmod/module/impl/render/MobESP.java +++ b/src/main/java/keystrokesmod/module/impl/render/MobESP.java @@ -2,8 +2,8 @@ import keystrokesmod.module.Module; import keystrokesmod.module.setting.impl.ButtonSetting; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.render.RenderUtils; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.monster.*; diff --git a/src/main/java/keystrokesmod/module/impl/render/Nametags.java b/src/main/java/keystrokesmod/module/impl/render/Nametags.java index 07139d0e..d6993904 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Nametags.java +++ b/src/main/java/keystrokesmod/module/impl/render/Nametags.java @@ -5,9 +5,11 @@ import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.DescriptionSetting; import keystrokesmod.module.setting.impl.SliderSetting; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Utils; -import net.minecraft.client.renderer.*; +import keystrokesmod.utility.render.RenderUtils; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; @@ -74,8 +76,7 @@ public void onRenderLiving(RenderLivingEvent.Specials.@NotNull Pre> e) { String name; if (removeTags.isToggled()) { name = entityPlayer.getName(); - } - else { + } else { name = entityPlayer.getDisplayName().getFormattedText(); } if (showHealth.isToggled()) { @@ -89,14 +90,11 @@ public void onRenderLiving(RenderLivingEvent.Specials.@NotNull Pre> e) { String color = "§"; if (distance <= 8) { color += "c"; - } - else if (distance <= 15) { + } else if (distance <= 15) { color += "6"; - } - else if (distance <= 25) { + } else if (distance <= 25) { color += "e"; - } - else { + } else { color = ""; } name = color + distance + "m§r " + name; @@ -107,8 +105,7 @@ else if (distance <= 25) { GlStateManager.rotate(-mc.getRenderManager().playerViewY, 0.0f, 1.0f, 0.0f); if (entityPlayer == mc.thePlayer && mc.gameSettings.thirdPersonView == 2) { GlStateManager.rotate(-mc.getRenderManager().playerViewX, 1.0f, 0.0f, 0.0f); - } - else { + } else { GlStateManager.rotate(mc.getRenderManager().playerViewX, 1.0f, 0.0f, 0.0f); } final float n = 0.02666667f; @@ -143,8 +140,7 @@ else if (distance <= 25) { int y2 = 8; if (Utils.isFriended(entityPlayer)) { RenderUtils.drawOutline(x1, y1, x2, y2, 2, friendColor); - } - else if (Utils.isEnemy(entityPlayer)) { + } else if (Utils.isEnemy(entityPlayer)) { RenderUtils.drawOutline(x1, y1, x2, y2, 2, enemyColor); } if (drawBackground.isToggled()) { @@ -254,8 +250,7 @@ private void renderText(@NotNull ItemStack stack, int xPos) { if (unbreakingLvl > 0) { mc.fontRendererObj.drawString("ub" + unbreakingLvl, (float) (xPos * 2), (float) newYPos, -1, dropShadow.isToggled()); } - } - else if (stack.getItem() instanceof ItemBow) { + } else if (stack.getItem() instanceof ItemBow) { int powerLvl = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack); int punchLvl = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, stack); int flameLvl = EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, stack); @@ -278,8 +273,7 @@ else if (stack.getItem() instanceof ItemBow) { if (unbreakingLvl > 0) { mc.fontRendererObj.drawString("ub" + unbreakingLvl, (float) (xPos * 2), (float) newYPos, -1, dropShadow.isToggled()); } - } - else if (stack.getItem() instanceof ItemSword) { + } else if (stack.getItem() instanceof ItemSword) { int sharpnessLvl = EnchantmentHelper.getEnchantmentLevel(Enchantment.sharpness.effectId, stack); int knockbackLvl = EnchantmentHelper.getEnchantmentLevel(Enchantment.knockback.effectId, stack); int fireAspectLvl = EnchantmentHelper.getEnchantmentLevel(Enchantment.fireAspect.effectId, stack); @@ -302,8 +296,7 @@ else if (stack.getItem() instanceof ItemSword) { if (unbreakingLvl > 0) { mc.fontRendererObj.drawString("ub" + unbreakingLvl, (float) (xPos * 2), (float) newYPos, -1, dropShadow.isToggled()); } - } - else if (stack.getItem() instanceof ItemTool) { + } else if (stack.getItem() instanceof ItemTool) { int unbreakingLvl = EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack); int efficiencyLvl = EnchantmentHelper.getEnchantmentLevel(Enchantment.efficiency.effectId, stack); int fortuneLvl = EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack); diff --git a/src/main/java/keystrokesmod/module/impl/render/NoHurtCam.java b/src/main/java/keystrokesmod/module/impl/render/NoHurtCam.java index ed084968..4955434e 100644 --- a/src/main/java/keystrokesmod/module/impl/render/NoHurtCam.java +++ b/src/main/java/keystrokesmod/module/impl/render/NoHurtCam.java @@ -9,8 +9,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class NoHurtCam extends Module { - public SliderSetting multiplier; private final ButtonSetting noHurtAnime; + public SliderSetting multiplier; public NoHurtCam() { super("NoHurtCam", category.render); diff --git a/src/main/java/keystrokesmod/module/impl/render/PlayerESP.java b/src/main/java/keystrokesmod/module/impl/render/PlayerESP.java index ddc4de18..d3e722e5 100644 --- a/src/main/java/keystrokesmod/module/impl/render/PlayerESP.java +++ b/src/main/java/keystrokesmod/module/impl/render/PlayerESP.java @@ -8,9 +8,9 @@ import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.DescriptionSetting; import keystrokesmod.module.setting.impl.SliderSetting; +import keystrokesmod.utility.Utils; import keystrokesmod.utility.render.ColorUtils; import keystrokesmod.utility.render.RenderUtils; -import keystrokesmod.utility.Utils; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraftforge.client.event.RenderWorldLastEvent; @@ -19,25 +19,24 @@ import java.awt.*; public class PlayerESP extends Module { - public SliderSetting red; - public SliderSetting green; - public SliderSetting blue; - public ButtonSetting colorByName; - public ButtonSetting rainbow; private final ButtonSetting twoD; private final ButtonSetting arrow; private final ButtonSetting box; private final ButtonSetting health; - public ButtonSetting outline; private final ButtonSetting shaded; private final ButtonSetting ring; private final SliderSetting expand; private final SliderSetting xShift; private final ButtonSetting redOnDamage; private final ButtonSetting showInvis; - private int rgb = 0; - private final Object2IntOpenHashMap targets = new Object2IntOpenHashMap<>(5); + public SliderSetting red; + public SliderSetting green; + public SliderSetting blue; + public ButtonSetting colorByName; + public ButtonSetting rainbow; + public ButtonSetting outline; + private int rgb = 0; public PlayerESP() { super("PlayerESP", category.render, 0); @@ -60,6 +59,14 @@ public PlayerESP() { this.registerSetting(showInvis = new ButtonSetting("Show invis", true)); } + public static int getColorFromTags(String displayName) { + displayName = Utils.removeFormatCodes(displayName); + if (displayName.isEmpty() || !displayName.startsWith("§") || displayName.charAt(1) == 'f') { + return new Color(255, 255, 255).getRGB(); + } + return ColorUtils.getColorFromCode(displayName).getRGB(); + } + @Override public void onDisable() { RenderUtils.ring_c = false; @@ -136,12 +143,4 @@ private void render(Entity en, int rgb) { RenderUtils.renderEntity(en, 6, expand.getInput(), xShift.getInput(), rgb, redOnDamage.isToggled()); } } - - public static int getColorFromTags(String displayName) { - displayName = Utils.removeFormatCodes(displayName); - if (displayName.isEmpty() || !displayName.startsWith("§") || displayName.charAt(1) == 'f') { - return new Color(255, 255, 255).getRGB(); - } - return ColorUtils.getColorFromCode(displayName).getRGB(); - } } diff --git a/src/main/java/keystrokesmod/module/impl/render/Radar.java b/src/main/java/keystrokesmod/module/impl/render/Radar.java index d4ddd1e0..df3b5bf5 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Radar.java +++ b/src/main/java/keystrokesmod/module/impl/render/Radar.java @@ -4,8 +4,8 @@ import keystrokesmod.module.Module; import keystrokesmod.module.impl.world.AntiBot; import keystrokesmod.module.setting.impl.ButtonSetting; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.render.RenderUtils; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.entity.player.EntityPlayer; @@ -16,9 +16,10 @@ import java.awt.*; public class Radar extends Module { - private ButtonSetting tracerLines; + private final ButtonSetting tracerLines; private int scale = 2; - private int rectColor = new Color(0, 0, 0, 125).getRGB(); + private final int rectColor = new Color(0, 0, 0, 125).getRGB(); + public Radar() { super("Radar", category.render); this.registerSetting(tracerLines = new ButtonSetting("Show tracer lines", false)); @@ -48,7 +49,7 @@ public void onRenderTick(TickEvent.RenderTickEvent e) { Gui.drawRect(n - 1, n4, n3 + 1, n4 + 1, -1); Gui.drawRect(n - 1, n2, n, n4, -1); Gui.drawRect(n3, n2, n3 + 1, n4, -1); - RenderUtils.drawPolygon((double)(n3 / 2 + 3), (double)(n2 + 52), 5.0, 3, -1); + RenderUtils.drawPolygon(n3 / 2 + 3, n2 + 52, 5.0, 3, -1); GL11.glPushMatrix(); GL11.glEnable(3089); GL11.glScissor(n * this.scale, mc.displayHeight - this.scale * 170, n3 * this.scale - this.scale * 5, this.scale * 100); @@ -76,8 +77,8 @@ public void onRenderTick(TickEvent.RenderTickEvent e) { GL11.glLineWidth(0.5f); GL11.glColor3d(1.0, 1.0, 1.0); GL11.glBegin(2); - GL11.glVertex2d((double)(n3 / 2 + 3), (double)(n2 + 52)); - GL11.glVertex2d((double)(n3 / 2 + 3) - n7, (double)(n2 + 52) - n8); + GL11.glVertex2d(n3 / 2 + 3, n2 + 52); + GL11.glVertex2d((double) (n3 / 2 + 3) - n7, (double) (n2 + 52) - n8); GL11.glEnd(); GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); GL11.glDisable(3042); @@ -87,7 +88,7 @@ public void onRenderTick(TickEvent.RenderTickEvent e) { GL11.glDisable(3042); GL11.glPopMatrix(); } - RenderUtils.drawPolygon((double)(n3 / 2 + 3) - n7, (double)(n2 + 52) - n8, 3.0, 4, Color.red.getRGB()); + RenderUtils.drawPolygon((double) (n3 / 2 + 3) - n7, (double) (n2 + 52) - n8, 3.0, 4, Color.red.getRGB()); } } GL11.glDisable(3089); diff --git a/src/main/java/keystrokesmod/module/impl/render/Shaders.java b/src/main/java/keystrokesmod/module/impl/render/Shaders.java index f0389417..36c2f251 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Shaders.java +++ b/src/main/java/keystrokesmod/module/impl/render/Shaders.java @@ -11,6 +11,7 @@ public class Shaders extends Module { private ModeSetting shader; private String[] shaderNames; private ResourceLocation[] shaderLocations; + public Shaders() { super("Shaders", category.render); try { @@ -19,8 +20,7 @@ public Shaders() { for (int i = 0; i < shaderLocations.length; ++i) { shaderNames[i] = ((String[]) shaderLocations[i].getResourcePath().replaceFirst("shaders/post/", "").split("\\.json"))[0].toUpperCase(); } - } - catch (IllegalAccessException ex) { + } catch (IllegalAccessException ex) { ex.printStackTrace(); return; } @@ -35,12 +35,10 @@ public void onUpdate() { if (Reflection.shaderIndex.getInt(mc.entityRenderer) != (int) shader.getInput()) { Reflection.shaderIndex.setInt(mc.entityRenderer, (int) shader.getInput()); Reflection.loadShader.invoke(mc.entityRenderer, shaderLocations[(int) shader.getInput()]); - } - else if (!Reflection.useShader.getBoolean(mc.entityRenderer)) { + } else if (!Reflection.useShader.getBoolean(mc.entityRenderer)) { Reflection.useShader.setBoolean(mc.entityRenderer, true); } - } - catch (Exception ex) { + } catch (Exception ex) { ex.printStackTrace(); Utils.sendMessage("&cError loading shader."); this.disable(); diff --git a/src/main/java/keystrokesmod/module/impl/render/TargetESP.java b/src/main/java/keystrokesmod/module/impl/render/TargetESP.java index d51cace4..5e0abba1 100644 --- a/src/main/java/keystrokesmod/module/impl/render/TargetESP.java +++ b/src/main/java/keystrokesmod/module/impl/render/TargetESP.java @@ -10,17 +10,15 @@ import keystrokesmod.module.setting.impl.ModeValue; import keystrokesmod.utility.Utils; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.MovingObjectPosition; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.entity.player.AttackEntityEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.Nullable; public class TargetESP extends Module { + private static @Nullable EntityLivingBase target = null; private final ModeValue mode; private final ButtonSetting onlyKillAura; - - private static @Nullable EntityLivingBase target = null; private long lastTargetTime = -1; public TargetESP() { diff --git a/src/main/java/keystrokesmod/module/impl/render/TargetHUD.java b/src/main/java/keystrokesmod/module/impl/render/TargetHUD.java index 8820a90d..5f179f41 100644 --- a/src/main/java/keystrokesmod/module/impl/render/TargetHUD.java +++ b/src/main/java/keystrokesmod/module/impl/render/TargetHUD.java @@ -18,14 +18,13 @@ public class TargetHUD extends Module { public static int posX = 70; public static int posY = 30; - private static ModeValue mode; - private final ButtonSetting onlyKillAura; - public static int current$minX; public static int current$maxX; public static int current$minY; public static int current$maxY; + private static ModeValue mode; private static @Nullable EntityLivingBase target = null; + private final ButtonSetting onlyKillAura; private long lastTargetTime = -1; public TargetHUD() { @@ -41,6 +40,26 @@ public TargetHUD() { this.registerSetting(onlyKillAura = new ButtonSetting("Only killAura", true)); } + private static void render(EntityLivingBase target) { + if (target != null) { + final ScaledResolution scaledResolution = new ScaledResolution(mc); + final int n2 = 8; + final int n3 = mc.fontRendererObj.getStringWidth(target.getDisplayName().getFormattedText()) + n2; + final int n4 = scaledResolution.getScaledWidth() / 2 - n3 / 2 + posX; + final int n5 = scaledResolution.getScaledHeight() / 2 + 15 + posY; + current$minX = n4 - n2; + current$minY = n5 - n2; + current$maxX = n4 + n3; + current$maxY = n5 + (mc.fontRendererObj.FONT_HEIGHT + 5) - 6 + n2; + + ((ITargetVisual) mode.getSubModeValues().get((int) mode.getInput())).render(target); + } + } + + public static void renderExample() { + render(mc.thePlayer); + } + @Override public void onEnable() { mode.enable(); @@ -104,24 +123,4 @@ public void onRender(TickEvent.RenderTickEvent event) { } render(target); } - - private static void render(EntityLivingBase target) { - if (target != null) { - final ScaledResolution scaledResolution = new ScaledResolution(mc); - final int n2 = 8; - final int n3 = mc.fontRendererObj.getStringWidth(target.getDisplayName().getFormattedText()) + n2; - final int n4 = scaledResolution.getScaledWidth() / 2 - n3 / 2 + posX; - final int n5 = scaledResolution.getScaledHeight() / 2 + 15 + posY; - current$minX = n4 - n2; - current$minY = n5 - n2; - current$maxX = n4 + n3; - current$maxY = n5 + (mc.fontRendererObj.FONT_HEIGHT + 5) - 6 + n2; - - ((ITargetVisual) mode.getSubModeValues().get((int) mode.getInput())).render(target); - } - } - - public static void renderExample() { - render(mc.thePlayer); - } } \ No newline at end of file diff --git a/src/main/java/keystrokesmod/module/impl/render/Tracers.java b/src/main/java/keystrokesmod/module/impl/render/Tracers.java index 50cb1f93..4819af2a 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Tracers.java +++ b/src/main/java/keystrokesmod/module/impl/render/Tracers.java @@ -1,14 +1,11 @@ package keystrokesmod.module.impl.render; -import keystrokesmod.Raven; import keystrokesmod.module.Module; import keystrokesmod.module.impl.world.AntiBot; import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Utils; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; +import keystrokesmod.utility.render.RenderUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; diff --git a/src/main/java/keystrokesmod/module/impl/render/Trajectories.java b/src/main/java/keystrokesmod/module/impl/render/Trajectories.java index 113cf328..34686e76 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Trajectories.java +++ b/src/main/java/keystrokesmod/module/impl/render/Trajectories.java @@ -3,13 +3,16 @@ import keystrokesmod.module.Module; import keystrokesmod.module.impl.world.AntiBot; import keystrokesmod.module.setting.impl.ButtonSetting; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.render.RenderUtils; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.*; -import net.minecraft.util.*; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.lwjgl.opengl.GL11; @@ -17,10 +20,11 @@ import java.awt.*; public class Trajectories extends Module { + private static final int HIGHLIGHT_COLOR = new Color(234, 38, 38).getRGB(); private final ButtonSetting autoScale; private final ButtonSetting disableUncharged; private final ButtonSetting highlightOnEntity; - private static final int HIGHLIGHT_COLOR = new Color(234, 38, 38).getRGB(); + public Trajectories() { super("Trajectories", category.render); this.registerSetting(autoScale = new ButtonSetting("Auto-scale", true)); @@ -45,20 +49,20 @@ public void onRenderWorldLast(RenderWorldLastEvent e) { float playerYaw = mc.thePlayer.rotationYaw; float playerPitch = mc.thePlayer.rotationPitch; - double posX = mc.getRenderManager().viewerPosX - (double)(MathHelper.cos(playerYaw / 180.0f * (float)Math.PI) * 0.16f); - double posY = mc.getRenderManager().viewerPosY + (double)mc.thePlayer.getEyeHeight() - (double)0.1f; - double posZ = mc.getRenderManager().viewerPosZ - (double)(MathHelper.sin(playerYaw / 180.0f * (float)Math.PI) * 0.16f); + double posX = mc.getRenderManager().viewerPosX - (double) (MathHelper.cos(playerYaw / 180.0f * (float) Math.PI) * 0.16f); + double posY = mc.getRenderManager().viewerPosY + (double) mc.thePlayer.getEyeHeight() - (double) 0.1f; + double posZ = mc.getRenderManager().viewerPosZ - (double) (MathHelper.sin(playerYaw / 180.0f * (float) Math.PI) * 0.16f); - double motionX = (double)(-MathHelper.sin(playerYaw / 180.0f * (float)Math.PI) * MathHelper.cos(playerPitch / 180.0f * (float)Math.PI)) * (bow ? 1.0 : 0.4); - double motionY = (double)(-MathHelper.sin(playerPitch / 180.0f * (float)Math.PI)) * (bow ? 1.0 : 0.4); - double motionZ = (double)(MathHelper.cos(playerYaw / 180.0f * (float)Math.PI) * MathHelper.cos(playerPitch / 180.0f * (float)Math.PI)) * (bow ? 1.0 : 0.4); + double motionX = (double) (-MathHelper.sin(playerYaw / 180.0f * (float) Math.PI) * MathHelper.cos(playerPitch / 180.0f * (float) Math.PI)) * (bow ? 1.0 : 0.4); + double motionY = (double) (-MathHelper.sin(playerPitch / 180.0f * (float) Math.PI)) * (bow ? 1.0 : 0.4); + double motionZ = (double) (MathHelper.cos(playerYaw / 180.0f * (float) Math.PI) * MathHelper.cos(playerPitch / 180.0f * (float) Math.PI)) * (bow ? 1.0 : 0.4); int itemInUse = 40; if (mc.thePlayer.getItemInUseCount() > 0 && bow) { itemInUse = mc.thePlayer.getItemInUseCount(); } int n10 = 72000 - itemInUse; - float f10 = (float)n10 / 20.0f; - if ((double)(f10 = (f10 * f10 + f10 * 2.0f) / 3.0f) < 0.1) { + float f10 = (float) n10 / 20.0f; + if ((double) (f10 = (f10 * f10 + f10 * 2.0f) / 3.0f) < 0.1) { return; } if (f10 > 1.0f) { @@ -84,9 +88,9 @@ public void onRenderWorldLast(RenderWorldLastEvent e) { motionX /= f11; motionY /= f11; motionZ /= f11; - motionX *= (double)(bow ? f10 * 2.0f : 1.0f) * 1.5; - motionY *= (double)(bow ? f10 * 2.0f : 1.0f) * 1.5; - motionZ *= (double)(bow ? f10 * 2.0f : 1.0f) * 1.5; + motionX *= (double) (bow ? f10 * 2.0f : 1.0f) * 1.5; + motionY *= (double) (bow ? f10 * 2.0f : 1.0f) * 1.5; + motionZ *= (double) (bow ? f10 * 2.0f : 1.0f) * 1.5; GL11.glLineWidth(1.5f); GL11.glBegin(3); boolean ground = false; @@ -118,8 +122,7 @@ public void onRenderWorldLast(RenderWorldLastEvent e) { if (rayTraced != null) { ground = true; target = rayTraced; - } - else { + } else { MovingObjectPosition entityHit = getEntityHit(start, predicted); if (entityHit != null) { target = entityHit; diff --git a/src/main/java/keystrokesmod/module/impl/render/Watermark.java b/src/main/java/keystrokesmod/module/impl/render/Watermark.java index 6c2e12ef..c9a29f37 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Watermark.java +++ b/src/main/java/keystrokesmod/module/impl/render/Watermark.java @@ -27,7 +27,7 @@ import java.util.Objects; public class Watermark extends Module { - public static final String VERSION = "2.11"; + public static final String VERSION = "2.12"; public static final HashMap WATERMARK = new HashMap<>(); public static String customName = "CustomClient"; @@ -125,7 +125,7 @@ public void render() { RenderUtils.drawImage(WATERMARK.get("enders"), posX, posY, 150, 45); break; } - break; + break; } } } diff --git a/src/main/java/keystrokesmod/module/impl/render/Xray.java b/src/main/java/keystrokesmod/module/impl/render/Xray.java index 223f7a27..0592929f 100644 --- a/src/main/java/keystrokesmod/module/impl/render/Xray.java +++ b/src/main/java/keystrokesmod/module/impl/render/Xray.java @@ -4,8 +4,8 @@ import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.BlockUtils; -import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.Utils; +import keystrokesmod.utility.render.RenderUtils; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; @@ -19,19 +19,19 @@ import java.util.List; public class Xray extends Module { - private SliderSetting range; - private SliderSetting rate; - private ButtonSetting caveOnly; - private ButtonSetting iron; - private ButtonSetting gold; - private ButtonSetting diamond; - private ButtonSetting emerald; - private ButtonSetting lapis; - private ButtonSetting redstone; - private ButtonSetting coal; - private ButtonSetting spawner; - private ButtonSetting obsidian; - private List blocks = new ArrayList<>(); + private final SliderSetting range; + private final SliderSetting rate; + private final ButtonSetting caveOnly; + private final ButtonSetting iron; + private final ButtonSetting gold; + private final ButtonSetting diamond; + private final ButtonSetting emerald; + private final ButtonSetting lapis; + private final ButtonSetting redstone; + private final ButtonSetting coal; + private final ButtonSetting spawner; + private final ButtonSetting obsidian; + private final List blocks = new ArrayList<>(); private long lastCheck = 0; public Xray() { @@ -78,7 +78,7 @@ public void onUpdate() { } private boolean isNextToAir(BlockPos blockPos) { - BlockPos[] neighbors = new BlockPos[] { + BlockPos[] neighbors = new BlockPos[]{ blockPos.up(), blockPos.down(), blockPos.north(), diff --git a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/ExhibitionTargetHUD.java b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/ExhibitionTargetHUD.java index 7b276f90..b8d3bf3a 100644 --- a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/ExhibitionTargetHUD.java +++ b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/ExhibitionTargetHUD.java @@ -19,12 +19,65 @@ public class ExhibitionTargetHUD extends SubMode implements ITargetVisual { private final ModeSetting font; - + public ExhibitionTargetHUD(String name, @NotNull TargetHUD parent) { super(name, parent); this.registerSetting(font = new ModeSetting("Font", new String[]{"Minecraft", "ProductSans", "Regular"}, 0)); } - + + private static Color getColor(@NotNull EntityLivingBase target) { // a VERY retarded way to do health colors :smile: + Color healthColor = new Color(0, 165, 0); //green + if (target.getHealth() < target.getMaxHealth() / 1.5) + healthColor = new Color(200, 200, 0); //yellow + if (target.getHealth() < target.getMaxHealth() / 2.5) + healthColor = new Color(200, 155, 0); //orange + if (target.getHealth() < target.getMaxHealth() / 4) + healthColor = new Color(120, 0, 0); //red + return healthColor; + } + + public static void drawModel(final float yaw, final float pitch, final @NotNull EntityLivingBase entityLivingBase) { //method to draw model (skidded) + GlStateManager.resetColor(); + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + GlStateManager.enableColorMaterial(); + GlStateManager.pushMatrix(); + GlStateManager.translate(0.0f, 0.0f, 50.0f); + GlStateManager.scale(-50.0f, 50.0f, 50.0f); + GlStateManager.rotate(180.0f, 0.0f, 0.0f, 1.0f); + final float renderYawOffset = entityLivingBase.renderYawOffset; + final float rotationYaw = entityLivingBase.rotationYaw; + final float rotationPitch = entityLivingBase.rotationPitch; + final float prevRotationYawHead = entityLivingBase.prevRotationYawHead; + final float rotationYawHead = entityLivingBase.rotationYawHead; + GlStateManager.rotate(135.0f, 0.0f, 1.0f, 0.0f); + RenderHelper.enableStandardItemLighting(); + GlStateManager.rotate(-135.0f, 0.0f, 1.0f, 0.0f); + GlStateManager.rotate((float) (-Math.atan(pitch / 40.0f) * 20.0), 1.0f, 0.0f, 0.0f); + entityLivingBase.renderYawOffset = yaw - 0.4f; + entityLivingBase.rotationYaw = yaw - 0.2f; + entityLivingBase.rotationPitch = pitch; + entityLivingBase.rotationYawHead = entityLivingBase.rotationYaw; + entityLivingBase.prevRotationYawHead = entityLivingBase.rotationYaw; + GlStateManager.translate(0.0f, 0.0f, 0.0f); + final RenderManager renderManager = mc.getRenderManager(); + renderManager.setPlayerViewY(180.0f); + renderManager.setRenderShadow(false); + renderManager.renderEntityWithPosYaw(entityLivingBase, 0.0, 0.0, 0.0, 0.0f, 1.0f); + renderManager.setRenderShadow(true); + entityLivingBase.renderYawOffset = renderYawOffset; + entityLivingBase.rotationYaw = rotationYaw; + entityLivingBase.rotationPitch = rotationPitch; + entityLivingBase.prevRotationYawHead = prevRotationYawHead; + entityLivingBase.rotationYawHead = rotationYawHead; + GlStateManager.popMatrix(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableRescaleNormal(); + GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); + GlStateManager.disableTexture2D(); + GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); + GlStateManager.resetColor(); + } + private IFont getFont() { switch ((int) font.getInput()) { default: @@ -103,57 +156,4 @@ public void render(@NotNull EntityLivingBase target) { GlStateManager.popMatrix(); //more gay shit } } - - private static Color getColor(@NotNull EntityLivingBase target) { // a VERY retarded way to do health colors :smile: - Color healthColor = new Color(0, 165, 0); //green - if (target.getHealth() < target.getMaxHealth() / 1.5) - healthColor = new Color(200, 200, 0); //yellow - if (target.getHealth() < target.getMaxHealth() / 2.5) - healthColor = new Color(200, 155, 0); //orange - if (target.getHealth() < target.getMaxHealth() / 4) - healthColor = new Color(120, 0, 0); //red - return healthColor; - } - - public static void drawModel(final float yaw, final float pitch, final @NotNull EntityLivingBase entityLivingBase) { //method to draw model (skidded) - GlStateManager.resetColor(); - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - GlStateManager.enableColorMaterial(); - GlStateManager.pushMatrix(); - GlStateManager.translate(0.0f, 0.0f, 50.0f); - GlStateManager.scale(-50.0f, 50.0f, 50.0f); - GlStateManager.rotate(180.0f, 0.0f, 0.0f, 1.0f); - final float renderYawOffset = entityLivingBase.renderYawOffset; - final float rotationYaw = entityLivingBase.rotationYaw; - final float rotationPitch = entityLivingBase.rotationPitch; - final float prevRotationYawHead = entityLivingBase.prevRotationYawHead; - final float rotationYawHead = entityLivingBase.rotationYawHead; - GlStateManager.rotate(135.0f, 0.0f, 1.0f, 0.0f); - RenderHelper.enableStandardItemLighting(); - GlStateManager.rotate(-135.0f, 0.0f, 1.0f, 0.0f); - GlStateManager.rotate((float) (-Math.atan(pitch / 40.0f) * 20.0), 1.0f, 0.0f, 0.0f); - entityLivingBase.renderYawOffset = yaw - 0.4f; - entityLivingBase.rotationYaw = yaw - 0.2f; - entityLivingBase.rotationPitch = pitch; - entityLivingBase.rotationYawHead = entityLivingBase.rotationYaw; - entityLivingBase.prevRotationYawHead = entityLivingBase.rotationYaw; - GlStateManager.translate(0.0f, 0.0f, 0.0f); - final RenderManager renderManager = mc.getRenderManager(); - renderManager.setPlayerViewY(180.0f); - renderManager.setRenderShadow(false); - renderManager.renderEntityWithPosYaw(entityLivingBase, 0.0, 0.0, 0.0, 0.0f, 1.0f); - renderManager.setRenderShadow(true); - entityLivingBase.renderYawOffset = renderYawOffset; - entityLivingBase.rotationYaw = rotationYaw; - entityLivingBase.rotationPitch = rotationPitch; - entityLivingBase.prevRotationYawHead = prevRotationYawHead; - entityLivingBase.rotationYawHead = rotationYawHead; - GlStateManager.popMatrix(); - RenderHelper.disableStandardItemLighting(); - GlStateManager.disableRescaleNormal(); - GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); - GlStateManager.disableTexture2D(); - GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); - GlStateManager.resetColor(); - } } diff --git a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/MyauTargetHUD.java b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/MyauTargetHUD.java index 466774ce..ec64ec21 100644 --- a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/MyauTargetHUD.java +++ b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/MyauTargetHUD.java @@ -17,7 +17,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.EntityLivingBase; import org.jetbrains.annotations.NotNull; + import java.awt.*; + import static keystrokesmod.module.impl.render.TargetHUD.*; public class MyauTargetHUD extends SubMode implements ITargetVisual { @@ -62,7 +64,7 @@ public void render(@NotNull EntityLivingBase target) { String TargetHealth = String.format("%.1f", target.getHealth()) + "§c❤ "; if (showStatus.isToggled() && mc.thePlayer != null) { - String status = (health <= Utils.getCompleteHealth(mc.thePlayer) / mc.thePlayer.getMaxHealth())? " §aW" : " §cL"; + String status = (health <= Utils.getCompleteHealth(mc.thePlayer) / mc.thePlayer.getMaxHealth()) ? " §aW" : " §cL"; TargetName = TargetName + status; } @@ -89,7 +91,7 @@ public void render(@NotNull EntityLivingBase target) { RenderUtils.drawRect(n13, n15, n14, n15 + 4, Utils.merge(Color.black.getRGB(), n11)); - float healthBar = (float) (int) (n14 + (n13 - n14) * (1.0 - ((health < 0.01)? 0 : health))); + float healthBar = (float) (int) (n14 + (n13 - n14) * (1.0 - ((health < 0.01) ? 0 : health))); if (healthBar - n13 < 1) { healthBar = n13; } diff --git a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/RavenNewTargetHUD.java b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/RavenNewTargetHUD.java index eafeeed9..a175c042 100644 --- a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/RavenNewTargetHUD.java +++ b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/RavenNewTargetHUD.java @@ -9,12 +9,16 @@ import keystrokesmod.utility.Utils; import keystrokesmod.utility.font.FontManager; import keystrokesmod.utility.font.IFont; -import keystrokesmod.utility.render.*; +import keystrokesmod.utility.render.Animation; +import keystrokesmod.utility.render.Easing; +import keystrokesmod.utility.render.RenderUtils; import keystrokesmod.utility.render.blur.GaussianBlur; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.entity.EntityLivingBase; import org.jetbrains.annotations.NotNull; + import java.awt.*; + import static keystrokesmod.module.impl.render.TargetHUD.*; public class RavenNewTargetHUD extends SubMode implements ITargetVisual { diff --git a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/RavenTargetHUD.java b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/RavenTargetHUD.java index 0c656f89..179164bb 100644 --- a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/RavenTargetHUD.java +++ b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/RavenTargetHUD.java @@ -16,7 +16,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.EntityLivingBase; import org.jetbrains.annotations.NotNull; + import java.awt.*; + import static keystrokesmod.module.impl.render.TargetHUD.*; public class RavenTargetHUD extends SubMode implements ITargetVisual { @@ -90,7 +92,7 @@ public void render(@NotNull EntityLivingBase target) { float lastHealthBar = (float) healthBarAnimation.getValue(); if (animation.isToggled()) { - healthBarAnimation.run(healthBar); + healthBarAnimation.run(healthBar); } else { lastHealthBar = healthBar; } diff --git a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/TestTargetHUD.java b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/TestTargetHUD.java index 3611eb1d..b9137b0a 100644 --- a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/TestTargetHUD.java +++ b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/TestTargetHUD.java @@ -17,7 +17,9 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.EntityLivingBase; import org.jetbrains.annotations.NotNull; + import java.awt.*; + import static keystrokesmod.module.impl.render.TargetHUD.*; public class TestTargetHUD extends SubMode implements ITargetVisual { diff --git a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/WurstTargetHUD.java b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/WurstTargetHUD.java index 9a7e6951..15934e4d 100644 --- a/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/WurstTargetHUD.java +++ b/src/main/java/keystrokesmod/module/impl/render/targetvisual/targethud/WurstTargetHUD.java @@ -39,7 +39,7 @@ public void render(@NotNull EntityLivingBase target) { double x = TargetHUD.current$minX; double y = TargetHUD.current$minY; - RenderUtils.drawRect(x, y, x + 185, y + 34, new Color(255, 255, 255, 100).getRGB()); + RenderUtils.drawRect(x, y, x + 185, y + 34, new Color(255, 255, 255, 100).getRGB()); getFont().drawString("Name: " + name, x + 4, y + 4, Color.BLACK.getRGB()); double health = Math.min(Math.round(target.getHealth()), target.getMaxHealth()); diff --git a/src/main/java/keystrokesmod/module/impl/world/AntiBot.java b/src/main/java/keystrokesmod/module/impl/world/AntiBot.java index cb7176cf..5df54d00 100644 --- a/src/main/java/keystrokesmod/module/impl/world/AntiBot.java +++ b/src/main/java/keystrokesmod/module/impl/world/AntiBot.java @@ -24,7 +24,9 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.jetbrains.annotations.NotNull; -import java.util.*; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.stream.Collectors; public class AntiBot extends Module { @@ -57,60 +59,6 @@ public AntiBot() { this.registerSetting(whitelistChicken = new ButtonSetting("Whitelist chickens", false)); } - @SubscribeEvent - public void c(final EntityJoinWorldEvent entityJoinWorldEvent) { - if (entitySpawnDelay.isToggled() && entityJoinWorldEvent.entity instanceof EntityPlayer && entityJoinWorldEvent.entity != mc.thePlayer) { - entities.put((EntityPlayer) entityJoinWorldEvent.entity, System.currentTimeMillis()); - } - } - - @SubscribeEvent - public void onSendPacket(SendPacketEvent event) { - if (cancelBotHit.isToggled() && event.getPacket() instanceof C02PacketUseEntity) { - C02PacketUseEntity packet = (C02PacketUseEntity) event.getPacket(); - if (packet.getAction() == C02PacketUseEntity.Action.ATTACK) { - if (isBot(packet.getEntityFromWorld(mc.theWorld))) { - event.setCanceled(true); - } - } - } - } - - public void onUpdate() { - if (entitySpawnDelay.isToggled() && !entities.isEmpty()) { - entities.values().removeIf(n -> n < System.currentTimeMillis() - delay.getInput()); - } - - lastPlayers.clear(); - for (EntityPlayer p : mc.theWorld.playerEntities) { - if (filteredBot.contains(p)) continue; - - String name = p.getName(); - if (lastPlayers.containsKey(name)) { - if (debug.isToggled()) Utils.sendMessage("Filtered bot: " + p.getName() + "."); - - EntityPlayer exists = lastPlayers.get(name); - Vec3 thePlayer = new Vec3(mc.thePlayer); - double existsDistance = thePlayer.distanceTo(exists); - double curDistance = thePlayer.distanceTo(p); - - if (existsDistance > curDistance) { - filteredBot.add(p); - } else { - filteredBot.add(exists); - } - break; - } - lastPlayers.put(name, p); - } - } - - public void onDisable() { - entities.clear(); - filteredBot.clear(); - lastPlayers.clear(); - } - public static boolean isBot(Entity entity) { if (!ModuleManager.antiBot.isEnabled()) { return false; @@ -187,4 +135,58 @@ public static boolean isBot(Entity entity) { .map(GameProfile::getName) .collect(Collectors.toList()); } + + @SubscribeEvent + public void c(final EntityJoinWorldEvent entityJoinWorldEvent) { + if (entitySpawnDelay.isToggled() && entityJoinWorldEvent.entity instanceof EntityPlayer && entityJoinWorldEvent.entity != mc.thePlayer) { + entities.put((EntityPlayer) entityJoinWorldEvent.entity, System.currentTimeMillis()); + } + } + + @SubscribeEvent + public void onSendPacket(SendPacketEvent event) { + if (cancelBotHit.isToggled() && event.getPacket() instanceof C02PacketUseEntity) { + C02PacketUseEntity packet = (C02PacketUseEntity) event.getPacket(); + if (packet.getAction() == C02PacketUseEntity.Action.ATTACK) { + if (isBot(packet.getEntityFromWorld(mc.theWorld))) { + event.setCanceled(true); + } + } + } + } + + public void onUpdate() { + if (entitySpawnDelay.isToggled() && !entities.isEmpty()) { + entities.values().removeIf(n -> n < System.currentTimeMillis() - delay.getInput()); + } + + lastPlayers.clear(); + for (EntityPlayer p : mc.theWorld.playerEntities) { + if (filteredBot.contains(p)) continue; + + String name = p.getName(); + if (lastPlayers.containsKey(name)) { + if (debug.isToggled()) Utils.sendMessage("Filtered bot: " + p.getName() + "."); + + EntityPlayer exists = lastPlayers.get(name); + Vec3 thePlayer = new Vec3(mc.thePlayer); + double existsDistance = thePlayer.distanceTo(exists); + double curDistance = thePlayer.distanceTo(p); + + if (existsDistance > curDistance) { + filteredBot.add(p); + } else { + filteredBot.add(exists); + } + break; + } + lastPlayers.put(name, p); + } + } + + public void onDisable() { + entities.clear(); + filteredBot.clear(); + lastPlayers.clear(); + } } diff --git a/src/main/java/keystrokesmod/module/impl/world/AutoPlace.java b/src/main/java/keystrokesmod/module/impl/world/AutoPlace.java index b5df9246..64133ba0 100644 --- a/src/main/java/keystrokesmod/module/impl/world/AutoPlace.java +++ b/src/main/java/keystrokesmod/module/impl/world/AutoPlace.java @@ -90,8 +90,7 @@ private void action() { if (fastPlaceJump.isToggled() && holdRight.isToggled() && !ModuleManager.fastPlace.isEnabled() && Mouse.isButtonDown(1)) { if (mc.thePlayer.motionY > 0.0) { this.rd(1); - } - else if (!pitchCheck.isToggled()) { + } else if (!pitchCheck.isToggled()) { this.rd(1000); } } diff --git a/src/main/java/keystrokesmod/module/impl/world/AutoTool.java b/src/main/java/keystrokesmod/module/impl/world/AutoTool.java index d95a6b6b..d6f3c324 100644 --- a/src/main/java/keystrokesmod/module/impl/world/AutoTool.java +++ b/src/main/java/keystrokesmod/module/impl/world/AutoTool.java @@ -19,6 +19,7 @@ public class AutoTool extends Module { private int previousSlot = -1; private int ticksHovered; private BlockPos currentBlock; + public AutoTool() { super("AutoTool", category.world); this.registerSetting(hoverDelay = new SliderSetting("Hover delay", 0.0, 0.0, 20.0, 1.0)); @@ -56,8 +57,7 @@ public void onUpdate() { } if (over.getBlockPos().equals(currentBlock)) { ticksHovered++; - } - else { + } else { ticksHovered = 0; } currentBlock = over.getBlockPos(); diff --git a/src/main/java/keystrokesmod/module/impl/world/AutoWeapon.java b/src/main/java/keystrokesmod/module/impl/world/AutoWeapon.java index 611403c9..1c32550f 100644 --- a/src/main/java/keystrokesmod/module/impl/world/AutoWeapon.java +++ b/src/main/java/keystrokesmod/module/impl/world/AutoWeapon.java @@ -1,7 +1,6 @@ package keystrokesmod.module.impl.world; import keystrokesmod.event.PreMotionEvent; -import keystrokesmod.event.PreUpdateEvent; import keystrokesmod.module.Module; import keystrokesmod.module.impl.other.SlotHandler; import keystrokesmod.module.setting.impl.ButtonSetting; @@ -12,7 +11,6 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.input.Mouse; @@ -24,6 +22,7 @@ public class AutoWeapon extends Module { private int previousSlot = -1; private int ticksHovered; private Entity currentEntity; + public AutoWeapon() { super("AutoWeapon", category.world); this.registerSetting(hoverDelay = new SliderSetting("Hover delay", 0.0, 0.0, 20.0, 1.0)); @@ -74,6 +73,7 @@ public void onPreMotion(PreMotionEvent e) { } } } + private void resetVariables() { ticksHovered = 0; resetSlot(); diff --git a/src/main/java/keystrokesmod/module/impl/world/BedAura.java b/src/main/java/keystrokesmod/module/impl/world/BedAura.java index f3ed22e9..b4d004c1 100644 --- a/src/main/java/keystrokesmod/module/impl/world/BedAura.java +++ b/src/main/java/keystrokesmod/module/impl/world/BedAura.java @@ -11,7 +11,10 @@ import keystrokesmod.module.setting.impl.ModeSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.script.classes.Vec3; -import keystrokesmod.utility.*; +import keystrokesmod.utility.BlockUtils; +import keystrokesmod.utility.RotationUtils; +import keystrokesmod.utility.Theme; +import keystrokesmod.utility.Utils; import keystrokesmod.utility.render.RenderUtils; import net.minecraft.block.Block; import net.minecraft.block.BlockBed; @@ -39,40 +42,39 @@ import java.util.Map; public class BedAura extends Module { - public ModeSetting mode; private final SliderSetting breakSpeed; private final SliderSetting fov; private final SliderSetting range; private final SliderSetting rate; private final ButtonSetting lobbyCheck; - public ButtonSetting allowAura; private final ButtonSetting breakNearBlock; private final ButtonSetting cancelKnockback; private final ButtonSetting disableBreakEffects; - public ButtonSetting groundSpoof; - public ButtonSetting ignoreSlow; private final ButtonSetting onlyWhileVisible; private final ButtonSetting renderOutline; private final ButtonSetting sendAnimations; private final ButtonSetting silentSwing; private final ButtonSetting rotation; - private final String[] modes = new String[]{"Legit", "Instant", "Swap"}; - private BlockPos[] bedPos; + private final Map breakProgressMap = new HashMap<>(); + private final int defaultOutlineColor = new Color(226, 65, 65).getRGB(); + public ModeSetting mode; + public ButtonSetting allowAura; + public ButtonSetting groundSpoof; + public ButtonSetting ignoreSlow; public double breakProgress; - private int currentSlot = -1; - private int lastSlot = -1; public boolean rotate; public BlockPos currentBlock; - private long lastCheck = 0; public boolean stopAutoblock; + public double lastProgress; + public float vanillaProgress; + private BlockPos[] bedPos; + private int currentSlot = -1; + private int lastSlot = -1; + private long lastCheck = 0; private int ticksAfterBreak = 0; private boolean delayStart; private BlockPos nearestBlock; - private final Map breakProgressMap = new HashMap<>(); - public double lastProgress; - public float vanillaProgress; - private final int defaultOutlineColor = new Color(226, 65, 65).getRGB(); public BedAura() { super("BedAura", category.world, 0); @@ -140,8 +142,7 @@ public void onPreUpdate(PreUpdateEvent e) { reset(true); return; } - } - else { + } else { if (!(BlockUtils.getBlock(bedPos[0]) instanceof BlockBed) || (currentBlock != null && BlockUtils.replaceable(currentBlock))) { reset(true); return; @@ -155,8 +156,7 @@ public void onPreUpdate(PreUpdateEvent e) { stopAutoblock = true; } return; - } - else { + } else { if (currentSlot != -1 && currentSlot != mc.thePlayer.inventory.currentItem) { stopAutoblock = true; } @@ -164,8 +164,7 @@ public void onPreUpdate(PreUpdateEvent e) { delayStart = false; ticksAfterBreak = 0; } - } - else { + } else { ticksAfterBreak = 0; } @@ -174,8 +173,7 @@ public void onPreUpdate(PreUpdateEvent e) { nearestBlock = getBestBlock(bedPos, true); } breakBlock(nearestBlock); - } - else { + } else { nearestBlock = null; resetSlot(); BlockPos bestBlock = getBestBlock(bedPos, false); @@ -192,8 +190,7 @@ public void onReceivePacket(ReceivePacketEvent e) { if (((S12PacketEntityVelocity) e.getPacket()).getEntityID() == mc.thePlayer.getEntityId()) { e.setCanceled(true); } - } - else if (e.getPacket() instanceof S27PacketExplosion) { + } else if (e.getPacket() instanceof S27PacketExplosion) { e.setCanceled(true); } } @@ -236,11 +233,9 @@ public void onRenderWorld(RenderWorldLastEvent renderWorldLastEvent) { int outlineColor; if (ModuleManager.bedESP != null && ModuleManager.bedESP.isEnabled()) { outlineColor = Theme.getGradient((int) ModuleManager.bedESP.theme.getInput(), 0); - } - else if (ModuleManager.hud != null && ModuleManager.hud.isEnabled()) { + } else if (ModuleManager.hud != null && ModuleManager.hud.isEnabled()) { outlineColor = Theme.getGradient((int) HUD.theme.getInput(), 0); - } - else { + } else { outlineColor = defaultOutlineColor; } RenderUtils.renderBlock(currentBlock, outlineColor, true, false); @@ -251,8 +246,7 @@ private void resetSlot() { stopAutoblock = true; delayStart = true; setPacketSlot(mc.thePlayer.inventory.currentItem); - } - else if (lastSlot != -1) { + } else if (lastSlot != -1) { mc.thePlayer.inventory.currentItem = lastSlot; } } @@ -315,8 +309,7 @@ private BlockPos getBestBlock(BlockPos[] positions, boolean getSurrounding) { closestBlock = offset; } } - } - else { + } else { if (RotationUtils.notInRange(pos, range.getInput())) { continue; } @@ -389,8 +382,7 @@ private void stopBreak(BlockPos blockPos) { private void swing() { if (!silentSwing.isToggled()) { mc.thePlayer.swingItem(); - } - else { + } else { mc.thePlayer.sendQueue.addToSendQueue(new C0APacketAnimation()); } } @@ -425,8 +417,7 @@ private void breakBlock(BlockPos blockPos) { setSlot(Utils.getTool(block)); } startBreak(blockPos); - } - else if (breakProgress >= 1) { + } else if (breakProgress >= 1) { if (mode.getInput() == 2) { ModuleManager.killAura.resetBlinkState(false); setPacketSlot(Utils.getTool(block)); @@ -440,8 +431,7 @@ else if (breakProgress >= 1) { mc.playerController.onPlayerDestroyBlock(blockPos, EnumFacing.UP); } return; - } - else { + } else { if (mode.getInput() == 0) { stopAutoblock = true; rotate = true; @@ -461,8 +451,7 @@ else if (breakProgress >= 1) { while (lastProgress + progress < 1) { lastProgress += progress; } - } - else if (mode.getInput() == 1) { + } else if (mode.getInput() == 1) { stopAutoblock = true; rotate = true; if (!silentSwing.isToggled()) { @@ -487,7 +476,7 @@ private void setSlot(int slot) { private boolean isCovered(BlockPos blockPos) { for (EnumFacing enumFacing : EnumFacing.values()) { BlockPos offset = blockPos.offset(enumFacing); - if (BlockUtils.replaceable(offset) || BlockUtils.notFull(BlockUtils.getBlock(offset)) ) { + if (BlockUtils.replaceable(offset) || BlockUtils.notFull(BlockUtils.getBlock(offset))) { return false; } } diff --git a/src/main/java/keystrokesmod/module/impl/world/BedDefender.java b/src/main/java/keystrokesmod/module/impl/world/BedDefender.java index e0fb2de1..c2d9125f 100644 --- a/src/main/java/keystrokesmod/module/impl/world/BedDefender.java +++ b/src/main/java/keystrokesmod/module/impl/world/BedDefender.java @@ -26,7 +26,10 @@ import org.apache.commons.lang3.tuple.Triple; import org.jetbrains.annotations.NotNull; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; public class BedDefender extends IAutoClicker { private final ModeValue clickMode; diff --git a/src/main/java/keystrokesmod/module/impl/world/BlockIn.java b/src/main/java/keystrokesmod/module/impl/world/BlockIn.java index 738fa37c..10ec1ffd 100644 --- a/src/main/java/keystrokesmod/module/impl/world/BlockIn.java +++ b/src/main/java/keystrokesmod/module/impl/world/BlockIn.java @@ -13,7 +13,9 @@ import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.utils.ModeOnly; import keystrokesmod.script.classes.Vec3; -import keystrokesmod.utility.*; +import keystrokesmod.utility.BlockUtils; +import keystrokesmod.utility.RotationUtils; +import keystrokesmod.utility.Utils; import keystrokesmod.utility.aim.AimSimulator; import net.minecraft.item.ItemBlock; import net.minecraft.network.play.client.C0APacketAnimation; @@ -24,7 +26,9 @@ import org.apache.commons.lang3.tuple.Triple; import org.jetbrains.annotations.NotNull; -import java.util.*; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; public class BlockIn extends Module { private static final String[] rotationModes = new String[]{"None", "Block", "Strict"}; diff --git a/src/main/java/keystrokesmod/module/impl/world/BridgeAssist.java b/src/main/java/keystrokesmod/module/impl/world/BridgeAssist.java index 6d08eb78..6d6e3cf4 100644 --- a/src/main/java/keystrokesmod/module/impl/world/BridgeAssist.java +++ b/src/main/java/keystrokesmod/module/impl/world/BridgeAssist.java @@ -4,34 +4,33 @@ import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.DescriptionSetting; import keystrokesmod.module.setting.impl.ModeSetting; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.Utils; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; public class BridgeAssist extends Module { + private static final String NORMAL = "Normal"; + private static final String GODBRIDGE = "GodBridge"; + private static final String MOONWALK = "Moonwalk"; + private static final String BREEZILY = "Breezily"; + private static final String[] BridgeModes = new String[]{NORMAL, GODBRIDGE, MOONWALK, BREEZILY}; private final ButtonSetting onSneak; private final SliderSetting waitFor; private final SliderSetting glideTime; private final SliderSetting assistRange; private final DescriptionSetting description; private final ModeSetting assistMode; - private boolean waitingForAim; - private boolean gliding; - private long startWaitTime; private final float[] godbridgePos = {75.6f, -315, -225, -135, -45, 0, 45, 135, 225, 315}; private final float[] moonwalkPos = {79.6f, -340, -290, -250, -200, -160, -110, -70, -20, 0, 20, 70, 110, 160, 200, 250, 290, 340}; private final float[] breezilyPos = {79.9f, -360, -270, -180, -90, 0, 90, 180, 270, 360}; private final float[] normalPos = {78f, -315, -225, -135, -45, 0, 45, 135, 225, 315}; + private boolean waitingForAim; + private boolean gliding; + private long startWaitTime; private double speedYaw, speedPitch; private float waitingForYaw, waitingForPitch; - private static final String NORMAL = "Normal"; - private static final String GODBRIDGE = "GodBridge"; - private static final String MOONWALK = "Moonwalk"; - private static final String BREEZILY = "Breezily"; - private static final String[] BridgeModes = new String[]{NORMAL, GODBRIDGE, MOONWALK, BREEZILY}; - public BridgeAssist() { super("BridgeAssist", Module.category.world); this.registerSetting(description = new DescriptionSetting("Aligns you for bridging")); @@ -174,8 +173,8 @@ else if (assistMode.getInput() == 3) { this.waitingForAim = false; } - public void aimAt(float pitch, float yaw, float fuckedYaw, float fuckedPitch){ - mc.thePlayer.rotationPitch = pitch + ((int)fuckedPitch/360) * 360; + public void aimAt(float pitch, float yaw, float fuckedYaw, float fuckedPitch) { + mc.thePlayer.rotationPitch = pitch + ((int) fuckedPitch / 360) * 360; mc.thePlayer.rotationYaw = yaw; } } \ No newline at end of file diff --git a/src/main/java/keystrokesmod/module/impl/world/Clutch.java b/src/main/java/keystrokesmod/module/impl/world/Clutch.java index 3be4b15a..4eaee4bc 100644 --- a/src/main/java/keystrokesmod/module/impl/world/Clutch.java +++ b/src/main/java/keystrokesmod/module/impl/world/Clutch.java @@ -11,7 +11,10 @@ import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.module.setting.utils.ModeOnly; import keystrokesmod.script.classes.Vec3; -import keystrokesmod.utility.*; +import keystrokesmod.utility.BlockUtils; +import keystrokesmod.utility.ContainerUtils; +import keystrokesmod.utility.RotationUtils; +import keystrokesmod.utility.Utils; import keystrokesmod.utility.aim.AimSimulator; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; @@ -74,7 +77,8 @@ public void onPreUpdate(PreUpdateEvent event) { double minDistance = Double.MAX_VALUE; Triple bestPlace = null; for (BlockPos block : blocks) { - if (!BlockUtils.replaceable(block) || BlockUtils.isSamePos(block, position) || BlockUtils.isSamePos(block, position.up())) continue; + if (!BlockUtils.replaceable(block) || BlockUtils.isSamePos(block, position) || BlockUtils.isSamePos(block, position.up())) + continue; final Optional> optional = RotationUtils.getPlaceSide(block); if (!optional.isPresent()) continue; diff --git a/src/main/java/keystrokesmod/module/impl/world/FastMine.java b/src/main/java/keystrokesmod/module/impl/world/FastMine.java index 6178cad8..4b3f0403 100644 --- a/src/main/java/keystrokesmod/module/impl/world/FastMine.java +++ b/src/main/java/keystrokesmod/module/impl/world/FastMine.java @@ -15,9 +15,9 @@ public class FastMine extends Module { // from b4 src private final SliderSetting delay; - public SliderSetting multiplier; private final ModeSetting mode; private final ButtonSetting creativeDisable; + public SliderSetting multiplier; private float lastCurBlockDamageMP; public FastMine() { diff --git a/src/main/java/keystrokesmod/module/impl/world/LegitScaffold.java b/src/main/java/keystrokesmod/module/impl/world/LegitScaffold.java index e1864e54..b459a4aa 100644 --- a/src/main/java/keystrokesmod/module/impl/world/LegitScaffold.java +++ b/src/main/java/keystrokesmod/module/impl/world/LegitScaffold.java @@ -1,6 +1,5 @@ package keystrokesmod.module.impl.world; -import keystrokesmod.event.BlockPlaceEvent; import keystrokesmod.mixins.impl.client.KeyBindingAccessor; import keystrokesmod.module.Module; import keystrokesmod.module.impl.other.SlotHandler; diff --git a/src/main/java/keystrokesmod/module/impl/world/SafeWalk.java b/src/main/java/keystrokesmod/module/impl/world/SafeWalk.java index 0c2451e2..92ed4060 100644 --- a/src/main/java/keystrokesmod/module/impl/world/SafeWalk.java +++ b/src/main/java/keystrokesmod/module/impl/world/SafeWalk.java @@ -16,9 +16,9 @@ import org.lwjgl.input.Keyboard; public class SafeWalk extends Module { + private static ButtonSetting shift, blocksOnly, pitchCheck, disableOnForward; private final SliderSetting shiftDelay; private final SliderSetting motion; - private static ButtonSetting shift, blocksOnly, pitchCheck, disableOnForward; public ButtonSetting tower; private boolean isSneaking; private long b = 0L; @@ -34,6 +34,22 @@ public SafeWalk() { this.registerSetting(tower = new ButtonSetting("Tower", false)); } + public static boolean canSafeWalk() { + if (ModuleManager.safeWalk != null && ModuleManager.safeWalk.isEnabled()) { + if (disableOnForward.isToggled() && Keyboard.isKeyDown(mc.gameSettings.keyBindForward.getKeyCode())) { + return false; + } + if (pitchCheck.isToggled() && mc.thePlayer.rotationPitch < 70) { + return false; + } + if (blocksOnly.isToggled() && (mc.thePlayer.getHeldItem() == null || !(mc.thePlayer.getHeldItem().getItem() instanceof ItemBlock))) { + return false; + } + return true; + } + return false; + } + public void onDisable() { if (shift.isToggled() && Utils.overAir()) { this.setSneakState(false); @@ -100,8 +116,7 @@ private void setSneakState(boolean down) { if (down) { return; } - } - else if (!down) { + } else if (!down) { return; } if (down) { @@ -112,8 +127,7 @@ else if (!down) { } this.b = System.currentTimeMillis(); } - } - else { + } else { if (Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode())) { return; } @@ -123,20 +137,4 @@ else if (!down) { this.isSneaking = down; KeyBinding.setKeyBindState(getKeyCode, down); } - - public static boolean canSafeWalk() { - if (ModuleManager.safeWalk != null && ModuleManager.safeWalk.isEnabled()) { - if (disableOnForward.isToggled() && Keyboard.isKeyDown(mc.gameSettings.keyBindForward.getKeyCode())) { - return false; - } - if (pitchCheck.isToggled() && mc.thePlayer.rotationPitch < 70) { - return false; - } - if (blocksOnly.isToggled() && (mc.thePlayer.getHeldItem() == null || !(mc.thePlayer.getHeldItem().getItem() instanceof ItemBlock))) { - return false; - } - return true; - } - return false; - } } diff --git a/src/main/java/keystrokesmod/module/impl/world/Scaffold.java b/src/main/java/keystrokesmod/module/impl/world/Scaffold.java index b36284d3..4161e7c2 100644 --- a/src/main/java/keystrokesmod/module/impl/world/Scaffold.java +++ b/src/main/java/keystrokesmod/module/impl/world/Scaffold.java @@ -17,8 +17,8 @@ import keystrokesmod.module.impl.world.scaffold.sprint.*; import keystrokesmod.module.setting.impl.*; import keystrokesmod.module.setting.utils.ModeOnly; -import keystrokesmod.utility.*; import keystrokesmod.utility.Timer; +import keystrokesmod.utility.*; import keystrokesmod.utility.aim.AimSimulator; import keystrokesmod.utility.aim.RotationData; import keystrokesmod.utility.movement.Move; @@ -48,14 +48,20 @@ import java.util.concurrent.TimeUnit; public class Scaffold extends IAutoClicker { + private static final String[] precisionModes = new String[]{"Very low", "Low", "Moderate", "High", "Very high", "Unlimited"}; + public final SliderSetting motion; + public final ButtonSetting safeWalk; + public final ButtonSetting tower; + public final ButtonSetting sameY; + public final ButtonSetting autoJump; private final ModeValue clickMode; private final ButtonSetting alwaysPlaceIfPossible; private final SliderSetting aimSpeed; - public final SliderSetting motion; private final ModeValue rotation; private final ButtonSetting moveFix; private final SliderSetting strafe; private final ButtonSetting notWhileDiagonal; + private final ButtonSetting notWhileTower; private final ModeValue sprint; private final ButtonSetting cancelSprint; private final ButtonSetting legit; @@ -79,43 +85,39 @@ public class Scaffold extends IAutoClicker { private final ButtonSetting fastOnRMB; private final ButtonSetting highlightBlocks; private final ButtonSetting multiPlace; - public final ButtonSetting safeWalk; private final ButtonSetting showBlockCount; private final ButtonSetting delayOnJump; private final ButtonSetting stopAtStart; private final ButtonSetting silentSwing; private final ButtonSetting noSwing; - public final ButtonSetting tower; - public final ButtonSetting sameY; - public final ButtonSetting autoJump; private final ButtonSetting expand; private final SliderSetting expandDistance; private final ButtonSetting polar; private final ButtonSetting postPlace; private final ButtonSetting lookView; + private final ButtonSetting cancelSprintAtStart; + private final Map highlight = new HashMap<>(); public @Nullable MovingObjectPosition rayCasted = null; public MovingObjectPosition placeBlock; - private int lastSlot; - private static final String[] precisionModes = new String[]{"Very low", "Low", "Moderate", "High", "Very high", "Unlimited"}; public float placeYaw; public float placePitch = 85; public int at; public int index; public boolean rmbDown; + public boolean delay; + public boolean place; + public int offGroundTicks = 0; + public int onGroundTicks = 0; + public boolean telly$noBlockPlace = false; + private int lastSlot; private double startPos = -1; - private final Map highlight = new HashMap<>(); private boolean forceStrict; private boolean down; - public boolean delay; - public boolean place; private int add = 0; private int sneak$bridged = 0; private int jump$bridged = 0; private boolean placedUp; - public int offGroundTicks = 0; - public int onGroundTicks = 0; - public boolean telly$noBlockPlace = false; private Float lastYaw = null, lastPitch = null; private boolean polar$waitingForExpand = false; private HoverState hoverState = HoverState.DONE; @@ -146,6 +148,7 @@ public Scaffold() { this.registerSetting(motion = new SliderSetting("Motion", 1.0, 0.5, 1.2, 0.01, () -> !moveFix.isToggled())); this.registerSetting(strafe = new SliderSetting("Strafe", 0, 0, 90, 5)); this.registerSetting(notWhileDiagonal = new ButtonSetting("Not while diagonal", true, () -> strafe.getInput() != 0)); + this.registerSetting(notWhileTower = new ButtonSetting("Not while tower", false, () -> strafe.getInput() != 0)); this.registerSetting(sprint = new ModeValue("Sprint", this) .add(new DisabledSprint("Disabled", this)) .add(new VanillaSprint("Vanilla", this)) @@ -196,6 +199,31 @@ public Scaffold() { this.registerSetting(polar = new ButtonSetting("Polar", false, expand::isToggled)); this.registerSetting(postPlace = new ButtonSetting("Post place", false, "Place on PostUpdate.")); this.registerSetting(lookView = new ButtonSetting("Look view", false)); + this.registerSetting(cancelSprintAtStart = new ButtonSetting("Cancel sprint at start", false)); + } + + public static boolean sprint() { + if (ModuleManager.scaffold.isEnabled() + && ModuleManager.scaffold.sprint.getInput() > 0 + && (!ModuleManager.scaffold.fastOnRMB.isToggled() || Mouse.isButtonDown(1))) { + return ((IScaffoldSprint) ModuleManager.scaffold.sprint.getSelected()).isSprint(); + } + return false; + } + + public static int getSlot() { + int slot = -1; + int highestStack = -1; + for (int i = 0; i < 9; ++i) { + final ItemStack itemStack = mc.thePlayer.inventory.mainInventory[i]; + if (itemStack != null && itemStack.getItem() instanceof ItemBlock && ContainerUtils.canBePlaced((ItemBlock) itemStack.getItem()) && itemStack.stackSize > 0) { + if (mc.thePlayer.inventory.mainInventory[i].stackSize > highestStack) { + highestStack = mc.thePlayer.inventory.mainInventory[i].stackSize; + slot = i; + } + } + } + return slot; } public void onDisable() { @@ -241,8 +269,14 @@ public void onEnable() { hoverState = HoverState.DONE; } - if (stopAtStart.isToggled()) + if (stopAtStart.isToggled()) { stopMoving = true; + } + + if (cancelSprintAtStart.isToggled()) { + mc.thePlayer.setSprinting(false); + } + } @SubscribeEvent @@ -257,7 +291,7 @@ public void onRotation(RotationEvent event) { float yaw = data.getYaw(); float pitch = data.getPitch(); - if (!isDiagonal() || !notWhileDiagonal.isToggled()) { + if ((!isDiagonal() || !notWhileDiagonal.isToggled()) && (!ModuleManager.tower.canTower() || !notWhileTower.isToggled())) { if (isDiagonal()) { yaw += (float) strafe.getInput(); } else { @@ -637,17 +671,14 @@ public void onRenderTick(TickEvent.RenderTickEvent ev) { String color = "§"; if (blocks <= 5) { color += "c"; - } - else if (blocks <= 15) { + } else if (blocks <= 15) { color += "6"; - } - else if (blocks <= 25) { + } else if (blocks <= 25) { color += "e"; - } - else { + } else { color = ""; } - mc.fontRendererObj.drawStringWithShadow(color + blocks + " §rblock" + (blocks == 1 ? "" : "s"), (float) scaledResolution.getScaledWidth() /2 + 8, (float) scaledResolution.getScaledHeight() /2 + 4, -1); + mc.fontRendererObj.drawStringWithShadow(color + blocks + " §rblock" + (blocks == 1 ? "" : "s"), (float) scaledResolution.getScaledWidth() / 2 + 8, (float) scaledResolution.getScaledHeight() / 2 + 4, -1); } } @@ -757,15 +788,6 @@ public void onRenderWorld(RenderWorldLastEvent e) { } } - public static boolean sprint() { - if (ModuleManager.scaffold.isEnabled() - && ModuleManager.scaffold.sprint.getInput() > 0 - && (!ModuleManager.scaffold.fastOnRMB.isToggled() || Mouse.isButtonDown(1))) { - return ((IScaffoldSprint) ModuleManager.scaffold.sprint.getSelected()).isSprint(); - } - return false; - } - private boolean forceStrict(float value) { return (inBetween(-170, -105, value) || inBetween(-80, 80, value) || inBetween(98, 170, value)) && !inBetween(-10, 10, value); } @@ -813,8 +835,7 @@ public float getYaw() { } else { if (moveStrafe > 0.0) { yaw = 90.0f; - } - else if (moveStrafe < 0.0) { + } else if (moveStrafe < 0.0) { yaw = -90.0f; } } @@ -909,21 +930,6 @@ public boolean place(MovingObjectPosition block, boolean extra) { return false; } - public static int getSlot() { - int slot = -1; - int highestStack = -1; - for (int i = 0; i < 9; ++i) { - final ItemStack itemStack = mc.thePlayer.inventory.mainInventory[i]; - if (itemStack != null && itemStack.getItem() instanceof ItemBlock && ContainerUtils.canBePlaced((ItemBlock) itemStack.getItem()) && itemStack.stackSize > 0) { - if (mc.thePlayer.inventory.mainInventory[i].stackSize > highestStack) { - highestStack = mc.thePlayer.inventory.mainInventory[i].stackSize; - slot = i; - } - } - } - return slot; - } - public int totalBlocks() { if (!Utils.nullCheck()) return 0; @@ -941,6 +947,23 @@ public int totalBlocks() { } } + @Override + public String getInfo() { + return sprint.getSelected().getPrettyName(); + } + + @SubscribeEvent + public void onSafeWalk(@NotNull SafeWalkEvent event) { + if (safewalk()) + event.setSafeWalk(true); + } + + enum HoverState { + JUMP, + FALL, + DONE + } + static class EnumFacingOffset { EnumFacing enumFacing; Vec3 offset; @@ -958,21 +981,4 @@ Vec3 getOffset() { return offset; } } - - @Override - public String getInfo() { - return sprint.getSelected().getPrettyName(); - } - - @SubscribeEvent - public void onSafeWalk(@NotNull SafeWalkEvent event) { - if (safewalk()) - event.setSafeWalk(true); - } - - enum HoverState { - JUMP, - FALL, - DONE - } } \ No newline at end of file diff --git a/src/main/java/keystrokesmod/module/impl/world/Tower.java b/src/main/java/keystrokesmod/module/impl/world/Tower.java index 4209d241..132ebaed 100644 --- a/src/main/java/keystrokesmod/module/impl/world/Tower.java +++ b/src/main/java/keystrokesmod/module/impl/world/Tower.java @@ -3,10 +3,11 @@ import keystrokesmod.module.Module; import keystrokesmod.module.ModuleManager; import keystrokesmod.module.impl.world.tower.*; -import keystrokesmod.module.setting.impl.*; +import keystrokesmod.module.setting.impl.ButtonSetting; +import keystrokesmod.module.setting.impl.DescriptionSetting; +import keystrokesmod.module.setting.impl.ModeValue; import keystrokesmod.utility.MoveUtil; import keystrokesmod.utility.Utils; -import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; @@ -42,7 +43,7 @@ public Tower() { this.canBeEnabled = false; mode.enable(); - MinecraftForge.EVENT_BUS.register(new Object(){ + MinecraftForge.EVENT_BUS.register(new Object() { @SubscribeEvent public void onUpdate(TickEvent.ClientTickEvent event) { final boolean curCanTower = canTower(); @@ -58,14 +59,11 @@ public boolean canTower() { if (mc.currentScreen != null) return false; if (!Utils.nullCheck() || !Utils.jumpDown()) { return false; - } - else if (disableWhileHurt.isToggled() && mc.thePlayer.hurtTime >= 9) { + } else if (disableWhileHurt.isToggled() && mc.thePlayer.hurtTime >= 9) { return false; - } - else if (disableWhileCollided.isToggled() && mc.thePlayer.isCollidedHorizontally) { + } else if (disableWhileCollided.isToggled() && mc.thePlayer.isCollidedHorizontally) { return false; - } - else return modulesEnabled(); + } else return modulesEnabled(); } public boolean modulesEnabled() { diff --git a/src/main/java/keystrokesmod/module/impl/world/scaffold/IScaffoldSprint.java b/src/main/java/keystrokesmod/module/impl/world/scaffold/IScaffoldSprint.java index ee7c2df3..b4d9d21f 100644 --- a/src/main/java/keystrokesmod/module/impl/world/scaffold/IScaffoldSprint.java +++ b/src/main/java/keystrokesmod/module/impl/world/scaffold/IScaffoldSprint.java @@ -24,6 +24,7 @@ public boolean onPreSchedulePlace() { /** * The final rotation data before set. + * * @param data rotation data * @return the new rotation data */ diff --git a/src/main/java/keystrokesmod/module/impl/world/scaffold/rotation/TellyRotation.java b/src/main/java/keystrokesmod/module/impl/world/scaffold/rotation/TellyRotation.java index 968a2bcb..0bdfbd9b 100644 --- a/src/main/java/keystrokesmod/module/impl/world/scaffold/rotation/TellyRotation.java +++ b/src/main/java/keystrokesmod/module/impl/world/scaffold/rotation/TellyRotation.java @@ -6,7 +6,6 @@ import keystrokesmod.event.ScaffoldPlaceEvent; import keystrokesmod.module.impl.world.Scaffold; import keystrokesmod.module.impl.world.scaffold.IScaffoldRotation; -import keystrokesmod.module.setting.impl.ButtonSetting; import keystrokesmod.module.setting.impl.SliderSetting; import keystrokesmod.utility.BlockUtils; import keystrokesmod.utility.MoveUtil; diff --git a/src/main/java/keystrokesmod/module/impl/world/tower/HypixelTower.java b/src/main/java/keystrokesmod/module/impl/world/tower/HypixelTower.java index 033b65d1..981a85db 100644 --- a/src/main/java/keystrokesmod/module/impl/world/tower/HypixelTower.java +++ b/src/main/java/keystrokesmod/module/impl/world/tower/HypixelTower.java @@ -27,24 +27,34 @@ import java.util.concurrent.TimeUnit; public class HypixelTower extends SubMode { - private final ButtonSetting notWhileMoving; - private final SliderSetting stopOnBlocks; - public static final Set LIMIT_FACING = new HashSet<>(Collections.singleton(EnumFacing.SOUTH)); public static final MoveCorrect moveCorrect = new MoveCorrect(0.3, MoveCorrect.Mode.POSITION); + private final ButtonSetting notWhileMoving; + private final SliderSetting airStrafeAmount; + private final SliderSetting stopOnBlocks; private boolean towering; private int towerTicks; private boolean blockPlaceRequest = false; private int lastOnGroundY; private BlockPos deltaPlace = BlockPos.ORIGIN; private int verticalPlaced = 0; + private float movementYaw; public HypixelTower(String name, @NotNull Tower parent) { super(name, parent); this.registerSetting(notWhileMoving = new ButtonSetting("Not while moving", true)); + this.registerSetting(airStrafeAmount = new SliderSetting("Air strafe amount", 20, 15, 90, 5)); this.registerSetting(stopOnBlocks = new SliderSetting("Stop on blocks", 6, 6, 10, 1)); } + public static boolean isGoingDiagonally(double amount) { + return Math.abs(mc.thePlayer.motionX) > amount && Math.abs(mc.thePlayer.motionZ) > amount; + } + + public static double randomAmount() { + return 8.0E-4 + Math.random() * 0.008; + } + @SubscribeEvent public void onMove(MoveEvent event) throws IllegalAccessException { if (mc.thePlayer.isPotionActive(Potion.jump)) return; @@ -75,8 +85,10 @@ public void onMove(MoveEvent event) throws IllegalAccessException { } else if (this.towerTicks == 3) { if (parent.canTower()) { event.setY(mc.thePlayer.motionY = 0.4198499917984009); - if (MoveUtil.isMoving()) + if (MoveUtil.isMoving()) { MoveUtil.strafe((float) towerSpeed - randomAmount()); + movementYaw = MoveUtil.simulationStrafeAngle(movementYaw, (float) airStrafeAmount.getInput()); + } this.towerTicks = 0; } else { this.towering = false; @@ -90,8 +102,10 @@ public void onMove(MoveEvent event) throws IllegalAccessException { Reflection.jumpTicks.set(mc.thePlayer, 0); if (event.getY() > 0.0) { event.setY(mc.thePlayer.motionY = 0.4198479950428009); - if (MoveUtil.isMoving()) + if (MoveUtil.isMoving()) { MoveUtil.strafe((float) towerSpeed - randomAmount()); + movementYaw = mc.thePlayer.rotationYaw; + } } } } @@ -105,6 +119,7 @@ public void onPreUpdate(PreUpdateEvent event) { if (mc.thePlayer.onGround) { lastOnGroundY = (int) mc.thePlayer.posY; deltaPlace = new BlockPos(0, 1, 1); + movementYaw = mc.thePlayer.rotationYaw; } if (blockPlaceRequest && !Utils.isMoving()) { @@ -142,16 +157,9 @@ public void onPreUpdate(PreUpdateEvent event) { } } - public static boolean isGoingDiagonally(double amount) { - return Math.abs(mc.thePlayer.motionX) > amount && Math.abs(mc.thePlayer.motionZ) > amount; - } - - public static double randomAmount() { - return 8.0E-4 + Math.random() * 0.008; - } - @Override public void onEnable() throws Throwable { verticalPlaced = 0; + movementYaw = mc.thePlayer.rotationYaw; } } diff --git a/src/main/java/keystrokesmod/module/impl/world/tower/JumpSprintTower.java b/src/main/java/keystrokesmod/module/impl/world/tower/JumpSprintTower.java index 35023dd7..ad61d643 100644 --- a/src/main/java/keystrokesmod/module/impl/world/tower/JumpSprintTower.java +++ b/src/main/java/keystrokesmod/module/impl/world/tower/JumpSprintTower.java @@ -65,8 +65,8 @@ public void onPreMotion(PreMotionEvent event) throws IllegalAccessException { if (mc.thePlayer.motionY == -0.3919991420476618) mc.thePlayer.motionY = -0.3968991421057737; } } - } } + } @SubscribeEvent public void onPreUpdate(PreUpdateEvent event) { diff --git a/src/main/java/keystrokesmod/module/impl/world/tower/VanillaTower.java b/src/main/java/keystrokesmod/module/impl/world/tower/VanillaTower.java index 512495bf..5544bf72 100644 --- a/src/main/java/keystrokesmod/module/impl/world/tower/VanillaTower.java +++ b/src/main/java/keystrokesmod/module/impl/world/tower/VanillaTower.java @@ -39,13 +39,11 @@ public void onPreMotion(PreMotionEvent e) throws IllegalAccessException { if (wasTowering && slowedTicks.getInput() > 0) { if (slowTicks++ < slowedTicks.getInput()) { Utils.setSpeed(Math.max(slowedSpeed.getInput() * 0.1 - 0.25, 0)); - } - else { + } else { slowTicks = 0; wasTowering = false; } - } - else { + } else { if (wasTowering) { wasTowering = false; } diff --git a/src/main/java/keystrokesmod/module/setting/Setting.java b/src/main/java/keystrokesmod/module/setting/Setting.java index f7a25d13..a11dfd06 100644 --- a/src/main/java/keystrokesmod/module/setting/Setting.java +++ b/src/main/java/keystrokesmod/module/setting/Setting.java @@ -13,10 +13,10 @@ import java.util.function.Supplier; public abstract class Setting { + private final @Nullable String toolTip; public String n; public Supplier visibleCheck; public boolean viewOnly; - private final @Nullable String toolTip; @Setter protected @Nullable Module parent = null; diff --git a/src/main/java/keystrokesmod/module/setting/impl/ButtonSetting.java b/src/main/java/keystrokesmod/module/setting/impl/ButtonSetting.java index 8ce86af2..66e67177 100644 --- a/src/main/java/keystrokesmod/module/setting/impl/ButtonSetting.java +++ b/src/main/java/keystrokesmod/module/setting/impl/ButtonSetting.java @@ -17,8 +17,8 @@ public class ButtonSetting extends Setting { @Getter private final String name; - private boolean isEnabled; public boolean isMethodButton; + private boolean isEnabled; private Runnable method; private Consumer onToggle; @@ -39,11 +39,13 @@ public ButtonSetting(String name, boolean isEnabled, @NotNull Consumer visibleCheck) { - this(name, isEnabled, visibleCheck, setting -> {}); + this(name, isEnabled, visibleCheck, setting -> { + }); } public ButtonSetting(String name, boolean isEnabled, @NotNull Supplier visibleCheck, @Nullable String toolTip) { - this(name, isEnabled, visibleCheck, setting -> {}, toolTip); + this(name, isEnabled, visibleCheck, setting -> { + }, toolTip); } public ButtonSetting(String name, boolean isEnabled, @NotNull Supplier visibleCheck, @NotNull Consumer onToggle) { diff --git a/src/main/java/keystrokesmod/module/setting/impl/DescriptionSetting.java b/src/main/java/keystrokesmod/module/setting/impl/DescriptionSetting.java index c98a963c..34d55bbd 100644 --- a/src/main/java/keystrokesmod/module/setting/impl/DescriptionSetting.java +++ b/src/main/java/keystrokesmod/module/setting/impl/DescriptionSetting.java @@ -5,7 +5,6 @@ import keystrokesmod.utility.i18n.I18nModule; import keystrokesmod.utility.i18n.settings.I18nDescriptionSetting; import keystrokesmod.utility.i18n.settings.I18nSetting; -import keystrokesmod.utility.i18n.settings.I18nSliderSetting; import lombok.Getter; import lombok.Setter; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/keystrokesmod/module/setting/impl/ModeSetting.java b/src/main/java/keystrokesmod/module/setting/impl/ModeSetting.java index a148a0e8..3ea58677 100644 --- a/src/main/java/keystrokesmod/module/setting/impl/ModeSetting.java +++ b/src/main/java/keystrokesmod/module/setting/impl/ModeSetting.java @@ -7,7 +7,6 @@ import keystrokesmod.utility.i18n.I18nModule; import keystrokesmod.utility.i18n.settings.I18nModeSetting; import keystrokesmod.utility.i18n.settings.I18nSetting; -import keystrokesmod.utility.i18n.settings.I18nSliderSetting; import lombok.Getter; import org.jetbrains.annotations.NotNull; @@ -41,6 +40,12 @@ public ModeSetting(String settingName, String @NotNull [] options, int defaultVa this.max = options.length - 1; } + public static double correctValue(double v, double i, double a) { + v = Math.max(i, v); + v = Math.min(a, v); + return v; + } + public void setOptions(String @NotNull [] options) { this.options = options; this.max = options.length - 1; @@ -120,12 +125,6 @@ public void setValueRaw(int n) { this.value = n; } - public static double correctValue(double v, double i, double a) { - v = Math.max(i, v); - v = Math.min(a, v); - return v; - } - @Override public void loadProfile(@NotNull JsonObject data) { if (data.has(getName()) && data.get(getName()).isJsonPrimitive()) { diff --git a/src/main/java/keystrokesmod/module/setting/impl/ModeValue.java b/src/main/java/keystrokesmod/module/setting/impl/ModeValue.java index 79ef7b89..27337408 100644 --- a/src/main/java/keystrokesmod/module/setting/impl/ModeValue.java +++ b/src/main/java/keystrokesmod/module/setting/impl/ModeValue.java @@ -20,14 +20,12 @@ public class ModeValue extends Setting implements InputSetting { @Getter private final Module parent; private final List> subModes = new ArrayList<>(); + private final Queue subSettings = new ConcurrentLinkedQueue<>(); private int selected = 0; - @Getter @Setter private @Nullable Integer indexInSetting = null; - private final Queue subSettings = new ConcurrentLinkedQueue<>(); - public ModeValue(String settingName, Module parent) { this(settingName, parent, () -> true); } @@ -71,9 +69,11 @@ public ModeValue add(final SubMode> subMode) { } return this; } + public List> getSubModeValues() { return subModes; } + public ModeValue setDefaultValue(String name) { Optional> subMode = subModes.stream().filter(mode -> Objects.equals(mode.getName(), name)).findFirst(); if (!subMode.isPresent()) return this; @@ -81,6 +81,7 @@ public ModeValue setDefaultValue(String name) { setValueRaw(subModes.indexOf(subMode.get())); return this; } + @Override public void loadProfile(@NotNull JsonObject profile) { if (profile.has(getName()) && profile.get(getName()).isJsonPrimitive()) { @@ -108,16 +109,20 @@ public void setValue(double value) { this.subModes.get(selected).enable(); } } + public void setValueRaw(int n) { disable(); this.setValue(n); } + public double getMax() { return subModes.size() - 1; } + public double getMin() { return 0; } + public void nextValue() { if (getInput() >= getMax()) { setValueRaw((int) getMin()); diff --git a/src/main/java/keystrokesmod/module/setting/impl/SliderSetting.java b/src/main/java/keystrokesmod/module/setting/impl/SliderSetting.java index 5582fca1..06950117 100644 --- a/src/main/java/keystrokesmod/module/setting/impl/SliderSetting.java +++ b/src/main/java/keystrokesmod/module/setting/impl/SliderSetting.java @@ -18,14 +18,14 @@ public class SliderSetting extends Setting implements InputSetting { private final String settingName; @Getter + private final double min; + private final double intervals; + public boolean isString; + @Getter private String[] options = null; private double defaultValue; @Getter private double max; - @Getter - private final double min; - private final double intervals; - public boolean isString; private String settingInfo = ""; public SliderSetting(String settingName, double defaultValue, double min, double max, double intervals) { @@ -70,6 +70,22 @@ public SliderSetting(String settingName, String @NotNull [] options, double defa this.isString = true; } + public static double correctValue(double v, double i, double a) { + v = Math.max(i, v); + v = Math.min(a, v); + return v; + } + + public static double roundToInterval(double v, int p) { + if (p < 0) { + return 0.0D; + } else { + BigDecimal bd = new BigDecimal(v); + bd = bd.setScale(p, RoundingMode.HALF_UP); + return bd.doubleValue(); + } + } + public String getPrettyInfo() { if (parent != null) { I18nModule i18nObject = parent.getI18nObject(); @@ -113,22 +129,6 @@ public void setValueRaw(double n) { this.defaultValue = n; } - public static double correctValue(double v, double i, double a) { - v = Math.max(i, v); - v = Math.min(a, v); - return v; - } - - public static double roundToInterval(double v, int p) { - if (p < 0) { - return 0.0D; - } else { - BigDecimal bd = new BigDecimal(v); - bd = bd.setScale(p, RoundingMode.HALF_UP); - return bd.doubleValue(); - } - } - @Override public void loadProfile(JsonObject data) { if (data.has(getName()) && data.get(getName()).isJsonPrimitive()) { diff --git a/src/main/java/keystrokesmod/module/setting/impl/SubMode.java b/src/main/java/keystrokesmod/module/setting/impl/SubMode.java index e589212c..1be928f8 100644 --- a/src/main/java/keystrokesmod/module/setting/impl/SubMode.java +++ b/src/main/java/keystrokesmod/module/setting/impl/SubMode.java @@ -12,8 +12,8 @@ * @param the type of the parent module */ public abstract class SubMode extends Module { - protected final String name; public final T parent; + protected final String name; public SubMode(String name, @NotNull T parent) { super(parent.getName() + "$" + name, parent.moduleCategory()); diff --git a/src/main/java/keystrokesmod/utility/DebugInfoRenderer.java b/src/main/java/keystrokesmod/utility/DebugInfoRenderer.java index 5d7871e0..940f5c2b 100644 --- a/src/main/java/keystrokesmod/utility/DebugInfoRenderer.java +++ b/src/main/java/keystrokesmod/utility/DebugInfoRenderer.java @@ -1,22 +1,71 @@ package keystrokesmod.utility; import keystrokesmod.Raven; +import keystrokesmod.event.PreMotionEvent; +import keystrokesmod.module.impl.other.anticheats.utils.world.PlayerMove; +import keystrokesmod.script.classes.Vec3; +import keystrokesmod.utility.font.CenterMode; +import keystrokesmod.utility.font.FontManager; import keystrokesmod.utility.render.RenderUtils; -import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent; +import java.awt.*; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; + +import static keystrokesmod.utility.Utils.mc; + public class DebugInfoRenderer extends net.minecraft.client.gui.Gui { - private static Minecraft mc = Minecraft.getMinecraft(); + private static final Queue speedFromJump = new ConcurrentLinkedQueue<>(); + private static double avgSpeedFromJump = -1; + + @SubscribeEvent + public void onPreMotion(PreMotionEvent event) { + if (!Raven.debugger || !Utils.nullCheck()) { + speedFromJump.clear(); + avgSpeedFromJump = -1; + return; + } + + if (mc.thePlayer.onGround) { + if (!speedFromJump.isEmpty()) { + avgSpeedFromJump = 0; + for (double speed : speedFromJump) { + avgSpeedFromJump += speed; + } + avgSpeedFromJump /= speedFromJump.size(); + } + speedFromJump.clear(); + } + speedFromJump.add(PlayerMove.getXzSecSpeed( + new Vec3(mc.thePlayer.lastTickPosX, mc.thePlayer.lastTickPosY, mc.thePlayer.lastTickPosZ), + new Vec3(event.getPosX(), event.getPosY(), event.getPosZ())) + ); + } @SubscribeEvent public void onRenderTick(RenderTickEvent ev) { - if (!Raven.debugger || ev.phase != TickEvent.Phase.END || !Utils.nullCheck()) { + if (!Raven.debugger || !Utils.nullCheck()) { return; } + if (mc.currentScreen == null) { RenderUtils.renderBPS(true, true); + if (avgSpeedFromJump != -1) { + ScaledResolution scaledResolution = new ScaledResolution(Raven.mc); + + FontManager.getMinecraft().drawString( + String.format("Speed from jump: %.2f", avgSpeedFromJump), + (float)(scaledResolution.getScaledWidth() / 2), + (float)(scaledResolution.getScaledHeight() / 2 + 30), + CenterMode.X, + false, + new Color(255, 255, 255).getRGB() + ); + } } } }