diff --git a/src/main/java/myau/Myau.java b/src/main/java/myau/Myau.java index a9301345..af5b11bc 100644 --- a/src/main/java/myau/Myau.java +++ b/src/main/java/myau/Myau.java @@ -78,6 +78,7 @@ public void init() { moduleManager.modules.put(ChestStealer.class, new ChestStealer()); moduleManager.modules.put(Eagle.class, new Eagle()); moduleManager.modules.put(ESP.class, new ESP()); + moduleManager.modules.put(EggESP.class, new EggESP()); moduleManager.modules.put(FastPlace.class, new FastPlace()); moduleManager.modules.put(Freeze.class, new Freeze()); moduleManager.modules.put(Fly.class, new Fly()); diff --git a/src/main/java/myau/module/modules/ESP.java b/src/main/java/myau/module/modules/ESP.java index d945fbe6..000b8843 100644 --- a/src/main/java/myau/module/modules/ESP.java +++ b/src/main/java/myau/module/modules/ESP.java @@ -10,13 +10,14 @@ import myau.mixin.IAccessorEntityRenderer; import myau.mixin.IAccessorRenderManager; import myau.module.Module; +import myau.property.properties.BooleanProperty; +import myau.property.properties.IntProperty; +import myau.property.properties.ModeProperty; import myau.util.ColorUtil; import myau.util.RenderUtil; import myau.util.TeamUtil; import myau.util.shader.GlowShader; import myau.util.shader.OutlineShader; -import myau.property.properties.BooleanProperty; -import myau.property.properties.ModeProperty; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; @@ -35,7 +36,8 @@ public class ESP extends Module { private Framebuffer framebuffer = null; private boolean outline = true; private boolean glow = true; - public final ModeProperty mode = new ModeProperty("mode", 2, new String[]{"NONE", "2D", "3D", "OUTLINE", "FAKECORNER", "FAKE2D"}); + public final ModeProperty mode = new ModeProperty("mode", 2, new String[]{"NONE", "2D", "3D", "OUTLINE", + "FAKECORNER", "FAKE2D"}); public final ModeProperty color = new ModeProperty("color", 0, new String[]{"DEFAULT", "TEAMS", "HUD"}); public final ModeProperty healthBar = new ModeProperty("health-bar", 0, new String[]{"NONE", "2D", "RAVEN"}); public final BooleanProperty players = new BooleanProperty("players", true); @@ -43,23 +45,31 @@ public class ESP extends Module { public final BooleanProperty enemies = new BooleanProperty("enemies", true); public final BooleanProperty self = new BooleanProperty("self", false); public final BooleanProperty bots = new BooleanProperty("bots", false); + public final IntProperty healthPercentage = new IntProperty("Render Health %", 50, 0, 100); private boolean shouldRenderPlayer(EntityPlayer entityPlayer) { if (entityPlayer.deathTime > 0) { return false; - } else if (mc.getRenderViewEntity().getDistanceToEntity(entityPlayer) > 512.0F) { + } + else if (mc.getRenderViewEntity().getDistanceToEntity(entityPlayer) > 512.0F) { return false; - } else if (!entityPlayer.ignoreFrustumCheck && !RenderUtil.isInViewFrustum(entityPlayer.getEntityBoundingBox(), 0.1F)) { + } + else if (!entityPlayer.ignoreFrustumCheck && !RenderUtil.isInViewFrustum(entityPlayer.getEntityBoundingBox(), + 0.1F)) { return false; - } else if (entityPlayer != mc.thePlayer && entityPlayer != mc.getRenderViewEntity()) { + } + else if (entityPlayer != mc.thePlayer && entityPlayer != mc.getRenderViewEntity()) { if (TeamUtil.isBot(entityPlayer)) { return this.bots.getValue(); - } else if (TeamUtil.isFriend(entityPlayer)) { + } + else if (TeamUtil.isFriend(entityPlayer)) { return this.friends.getValue(); - } else { + } + else { return TeamUtil.isTarget(entityPlayer) ? this.enemies.getValue() : this.players.getValue(); } - } else { + } + else { return this.self.getValue() && mc.gameSettings.thirdPersonView != 0; } } @@ -67,17 +77,21 @@ private boolean shouldRenderPlayer(EntityPlayer entityPlayer) { private Color getEntityColor(EntityPlayer entityPlayer) { if (TeamUtil.isFriend(entityPlayer)) { return Myau.friendManager.getColor(); - } else if (TeamUtil.isTarget(entityPlayer)) { + } + else if (TeamUtil.isTarget(entityPlayer)) { return Myau.targetManager.getColor(); - } else { + } + else { switch (this.color.getValue()) { case 0: return TeamUtil.getTeamColor(entityPlayer, 1.0F); case 1: - int teamColor = TeamUtil.isSameTeam(entityPlayer) ? ChatColors.BLUE.toAwtColor() : ChatColors.RED.toAwtColor(); + int teamColor = TeamUtil.isSameTeam(entityPlayer) ? ChatColors.BLUE.toAwtColor() : + ChatColors.RED.toAwtColor(); return new Color(teamColor); case 2: - int hudColor = ((HUD) Myau.moduleManager.modules.get(HUD.class)).getColor(System.currentTimeMillis()).getRGB(); + int hudColor = + ((HUD) Myau.moduleManager.modules.get(HUD.class)).getColor(System.currentTimeMillis()).getRGB(); return new Color(hudColor); default: return new Color(-1); @@ -108,7 +122,8 @@ public void onResize(ResizeEvent event) { @EventTarget(Priority.HIGH) public void onRender(Render2DEvent event) { if (this.isEnabled() && (this.mode.getValue() == 1 || this.mode.getValue() == 3 || this.healthBar.getValue() == 1)) { - List renderedEntities = TeamUtil.getLoadedEntitiesSorted().stream().filter(entity -> entity instanceof EntityPlayer && this.shouldRenderPlayer((EntityPlayer) entity)).map(EntityPlayer.class::cast).collect(Collectors.toList()); + List renderedEntities = + TeamUtil.getLoadedEntitiesSorted().stream().filter(entity -> entity instanceof EntityPlayer && this.shouldRenderPlayer((EntityPlayer) entity)).map(EntityPlayer.class::cast).collect(Collectors.toList()); if (!renderedEntities.isEmpty()) { if (this.mode.getValue() == 3) { GlStateManager.pushMatrix(); @@ -163,16 +178,22 @@ public void onRender(Render2DEvent event) { float w = (float) screenPosition.w; if (this.mode.getValue() == 1) { int color = this.getEntityColor(player).getRGB(); - RenderUtil.drawOutlineRect(x, y, z, w, 3.0F, 0, (color & 16579836) >> 2 | color & 0xFF000000); + RenderUtil.drawOutlineRect(x, y, z, w, 3.0F, 0, + (color & 16579836) >> 2 | color & 0xFF000000); RenderUtil.drawOutlineRect(x, y, z, w, 1.5F, 0, color); } if (this.healthBar.getValue() == 1) { float heal = player.getHealth() + player.getAbsorptionAmount(); float percent = Math.min(Math.max(heal / player.getMaxHealth(), 0.0F), 1.0F); + if (percent * 100 > this.healthPercentage.getValue()) { + continue; + } float box = (z - x) * 0.08F; Color healthColor = ColorUtil.getHealthBlend(percent); - RenderUtil.drawLine(x - box, y, x - box, w, 3.0F, ColorUtil.darker(healthColor, 0.2F).getRGB()); - RenderUtil.drawLine(x - box, w, x - box, w + (y - w) * percent, 1.5F, healthColor.getRGB()); + RenderUtil.drawLine(x - box, y, x - box, w, 3.0F, + ColorUtil.darker(healthColor, 0.2F).getRGB()); + RenderUtil.drawLine(x - box, w, x - box, w + (y - w) * percent, 1.5F, + healthColor.getRGB()); } } } @@ -187,22 +208,31 @@ public void onRender(Render2DEvent event) { public void onRender(Render3DEvent event) { if (this.isEnabled() && (this.mode.getValue() == 2 || this.mode.getValue() == 4 || this.mode.getValue() == 5 || this.healthBar.getValue() == 2)) { RenderUtil.enableRenderState(); - for (EntityPlayer player : TeamUtil.getLoadedEntitiesSorted().stream().filter(entity -> entity instanceof EntityPlayer && this.shouldRenderPlayer((EntityPlayer) entity)).map(EntityPlayer.class::cast).collect(Collectors.toList())) { + for (EntityPlayer player : + TeamUtil.getLoadedEntitiesSorted().stream().filter(entity -> entity instanceof EntityPlayer && this.shouldRenderPlayer((EntityPlayer) entity)).map(EntityPlayer.class::cast).collect(Collectors.toList())) { if (player.ignoreFrustumCheck || RenderUtil.isInViewFrustum(player.getEntityBoundingBox(), 0.1F)) { if (this.mode.getValue() == 2) { Color color = this.getEntityColor(player); - RenderUtil.drawEntityBoundingBox(player, color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha(), 1.5F, 0.1F); + RenderUtil.drawEntityBoundingBox(player, color.getRed(), color.getGreen(), color.getBlue(), + color.getAlpha(), 1.5F, 0.1F); GlStateManager.resetColor(); } if (this.mode.getValue() == 4) { Color color = this.getEntityColor(player); - RenderUtil.drawCornerESP(player, color.getRed() / 255.0F, color.getGreen() / 255.0F, color.getBlue() / 255.0F); + RenderUtil.drawCornerESP(player, color.getRed() / 255.0F, color.getGreen() / 255.0F, + color.getBlue() / 255.0F); } if (this.mode.getValue() == 5) { Color color = this.getEntityColor(player); - RenderUtil.drawFake2DESP(player, color.getRed() / 255.0F, color.getGreen() / 255.0F, color.getBlue() / 255.0F); + RenderUtil.drawFake2DESP(player, color.getRed() / 255.0F, color.getGreen() / 255.0F, + color.getBlue() / 255.0F); } if (this.healthBar.getValue() == 2) { + float heal = player.getHealth() + player.getAbsorptionAmount(); + float percent = Math.min(Math.max(heal / player.getMaxHealth(), 0.0F), 1.0F); + if (percent * 100 > this.healthPercentage.getValue()) { + continue; + } double x = RenderUtil.lerpDouble(player.posX, player.lastTickPosX, event.getPartialTicks()) - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosX(); double y = RenderUtil.lerpDouble(player.posY, player.lastTickPosY, event.getPartialTicks()) @@ -213,11 +243,10 @@ public void onRender(Render3DEvent event) { GlStateManager.pushMatrix(); GlStateManager.translate(x, y, z); GlStateManager.rotate(mc.getRenderManager().playerViewY * -1.0F, 0.0F, 1.0F, 0.0F); - float heal = player.getHealth() + player.getAbsorptionAmount(); - float percent = Math.min(Math.max(heal / player.getMaxHealth(), 0.0F), 1.0F); Color healthColor = ColorUtil.getHealthBlend(percent); float height = player.height + 0.2F; - RenderUtil.drawRect3D(0.57250005F, -0.027500002F, 0.7275F, height + 0.027500002F, Color.black.getRGB()); + RenderUtil.drawRect3D(0.57250005F, -0.027500002F, 0.7275F, height + 0.027500002F, + Color.black.getRGB()); RenderUtil.drawRect3D(0.6F, 0.0F, 0.70000005F, height, Color.darkGray.getRGB()); RenderUtil.drawRect3D(0.6F, 0.0F, 0.70000005F, height * percent, healthColor.getRGB()); GlStateManager.popMatrix(); diff --git a/src/main/java/myau/module/modules/EggESP.java b/src/main/java/myau/module/modules/EggESP.java new file mode 100644 index 00000000..289f710e --- /dev/null +++ b/src/main/java/myau/module/modules/EggESP.java @@ -0,0 +1,103 @@ +package myau.module.modules; + +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.Render3DEvent; +import myau.events.TickEvent; +import myau.module.Module; +import myau.property.properties.BooleanProperty; +import myau.property.properties.ColorProperty; +import myau.property.properties.IntProperty; +import myau.util.RenderUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; + +import java.awt.*; +import java.util.concurrent.CopyOnWriteArraySet; + +public class EggESP extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + + // Cache of found eggs + private final CopyOnWriteArraySet eggs = new CopyOnWriteArraySet<>(); + + // Settings + public final IntProperty range = new IntProperty("range", 48, 8, 128); + public final IntProperty yRange = new IntProperty("y-range", 32, 8, 128); + public final BooleanProperty outline = new BooleanProperty("outline", true); + public final ColorProperty color = new ColorProperty("color", new Color(108, 0, 210).getRGB()); + + public EggESP() { + super("EggESP", false); + } + + @EventTarget + public void onTick(TickEvent event) { + if (!this.isEnabled()) return; + if (event.getType() != EventType.POST) return; + + if (mc.theWorld == null || mc.thePlayer == null) { + eggs.clear(); + return; + } + + // Don’t scan every tick to reduce load + // (every 10 ticks ≈ twice per second) + if (mc.thePlayer.ticksExisted % 10 != 0) return; + + scanForEggs(); + } + + private void scanForEggs() { + eggs.clear(); + + BlockPos base = mc.thePlayer.getPosition(); + int r = range.getValue(); + int yr = yRange.getValue(); + + int minY = Math.max(0, base.getY() - yr); + int maxY = Math.min(255, base.getY() + yr); + + for (int x = base.getX() - r; x <= base.getX() + r; x++) { + for (int z = base.getZ() - r; z <= base.getZ() + r; z++) { + for (int y = minY; y <= maxY; y++) { + BlockPos pos = new BlockPos(x, y, z); + + // Avoid chunk loads / unnecessary lookups + if (!mc.theWorld.isBlockLoaded(pos, false)) continue; + + if (mc.theWorld.getBlockState(pos).getBlock() == Blocks.dragon_egg) { + eggs.add(pos); + } + } + } + } + } + + @EventTarget + public void onRender(Render3DEvent event) { + if (!this.isEnabled()) return; + if (mc.theWorld == null || mc.thePlayer == null) return; + + Color c = new Color(color.getValue()); + + RenderUtil.enableRenderState(); + + for (BlockPos pos : eggs) { + // If egg got broken / moved, drop it from cache + if (!mc.theWorld.isBlockLoaded(pos, false) || + mc.theWorld.getBlockState(pos).getBlock() != Blocks.dragon_egg) { + eggs.remove(pos); + continue; + } + + if (outline.getValue()) { + RenderUtil.drawBlockBoundingBox(pos, 1.0, c.getRed(), c.getGreen(), c.getBlue(), 255, 1.5F); + } + RenderUtil.drawBlockBox(pos, 1.0, c.getRed(), c.getGreen(), c.getBlue()); + } + + RenderUtil.disableRenderState(); + } +} \ No newline at end of file diff --git a/src/main/java/myau/module/modules/ItemESP.java b/src/main/java/myau/module/modules/ItemESP.java index 8bef6fec..39bf51ce 100644 --- a/src/main/java/myau/module/modules/ItemESP.java +++ b/src/main/java/myau/module/modules/ItemESP.java @@ -5,10 +5,10 @@ import myau.events.Render3DEvent; import myau.mixin.IAccessorRenderManager; import myau.module.Module; -import myau.util.RenderUtil; -import myau.util.TeamUtil; import myau.property.properties.BooleanProperty; import myau.property.properties.PercentProperty; +import myau.util.RenderUtil; +import myau.util.TeamUtil; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; @@ -36,12 +36,14 @@ public class ItemESP extends Module { public final BooleanProperty diamonds = new BooleanProperty("diamonds", true); public final BooleanProperty goldd = new BooleanProperty("gold", true); public final BooleanProperty iron = new BooleanProperty("iron", true); + public final BooleanProperty nametag = new BooleanProperty("nametag", true); private boolean shouldHighlightItem(int itemId) { return this.emeralds.getValue() && this.isEmeraldItem(itemId) || this.diamonds.getValue() && this.isDiamondItem(itemId) || this.goldd.getValue() && this.isGoldItem(itemId) - || this.iron.getValue() && this.isIronItem(itemId); + || this.iron.getValue() && this.isIronItem(itemId) + || this.nametag.getValue() && this.isNametagItem(itemId); } private boolean isEmeraldItem(int itemId) { @@ -79,6 +81,12 @@ private boolean isIronItem(int itemId) { return item == Items.iron_ingot || block == Blocks.iron_block || block == Blocks.iron_ore; } + private boolean isNametagItem(int itemId) { + Item item = Item.getItemById(itemId); + Block block = Block.getBlockFromItem(item); + return item == Items.name_tag; + } + private Color getItemColor(int itemId) { if (this.isEmeraldItem(itemId)) { return new Color(ChatColors.GREEN.toAwtColor()); diff --git a/src/main/java/myau/repomix-output.xml b/src/main/java/myau/repomix-output.xml new file mode 100644 index 00000000..9f2656b5 --- /dev/null +++ b/src/main/java/myau/repomix-output.xml @@ -0,0 +1,22450 @@ +This file is a merged representation of the entire codebase, combined into a single document by Repomix. + + +This section contains a summary of this file. + + +This file contains a packed representation of the entire repository's contents. +It is designed to be easily consumable by AI systems for analysis, code review, +or other automated processes. + + + +The content is organized as follows: +1. This summary section +2. Repository information +3. Directory structure +4. Repository files (if enabled) +5. Multiple file entries, each consisting of: + - File path as an attribute + - Full contents of the file + + + +- This file should be treated as read-only. Any changes should be made to the + original repository files, not this packed version. +- When processing this file, use the file path to distinguish + between different files in the repository. +- Be aware that this file may contain sensitive information. Handle it with + the same level of security as you would the original repository. + + + +- Some files may have been excluded based on .gitignore rules and Repomix's configuration +- Binary files are not included in this packed representation. Please refer to the Repository Structure section for a complete list of file paths, including binary files +- Files matching patterns in .gitignore are excluded +- Files matching default ignore patterns are excluded +- Files are sorted by Git change count (files with more changes are at the bottom) + + + + + +command/Command.java +command/CommandManager.java +command/commands/BindCommand.java +command/commands/ConfigCommand.java +command/commands/DenickCommand.java +command/commands/FriendCommand.java +command/commands/HelpCommand.java +command/commands/HideCommand.java +command/commands/IgnCommand.java +command/commands/ItemCommand.java +command/commands/ListCommand.java +command/commands/ModuleCommand.java +command/commands/PlayerCommand.java +command/commands/ShowCommand.java +command/commands/TargetCommand.java +command/commands/ToggleCommand.java +command/commands/VclipCommand.java +config/Config.java +data/Box.java +enums/BlinkModules.java +enums/ChatColors.java +enums/DelayModules.java +enums/FloatModules.java +event/EventAPI.java +event/EventManager.java +event/events/callables/EventCancellable.java +event/events/callables/EventTyped.java +event/events/Cancellable.java +event/events/Event.java +event/events/EventStoppable.java +event/events/Typed.java +event/EventTarget.java +event/types/EventType.java +event/types/Priority.java +events/AttackEvent.java +events/CancelUseEvent.java +events/HitBlockEvent.java +events/KeyEvent.java +events/KnockbackEvent.java +events/LeftClickMouseEvent.java +events/LivingUpdateEvent.java +events/LoadWorldEvent.java +events/MoveInputEvent.java +events/PacketEvent.java +events/PickEvent.java +events/PlayerUpdateEvent.java +events/RaytraceEvent.java +events/Render2DEvent.java +events/Render3DEvent.java +events/RenderLivingEvent.java +events/ResizeEvent.java +events/RightClickMouseEvent.java +events/SafeWalkEvent.java +events/StrafeEvent.java +events/SwapItemEvent.java +events/TickEvent.java +events/UpdateEvent.java +events/WindowClickEvent.java +init/FMLLoadingPlugin.java +init/Initializer.java +management/BlinkManager.java +management/DelayManager.java +management/FloatManager.java +management/FriendManager.java +management/LagManager.java +management/PlayerFileManager.java +management/PlayerStateManager.java +management/RotationManager.java +management/RotationState.java +management/TargetManager.java +mixin/IAccessorC03PacketPlayer.java +mixin/IAccessorC0DPacketCloseWindow.java +mixin/IAccessorEntity.java +mixin/IAccessorEntityLivingBase.java +mixin/IAccessorEntityPlayer.java +mixin/IAccessorEntityRenderer.java +mixin/IAccessorGuiChat.java +mixin/IAccessorGuiScreen.java +mixin/IAccessorItemSword.java +mixin/IAccessorKeyBinding.java +mixin/IAccessorMinecraft.java +mixin/IAccessorPlayerControllerMP.java +mixin/IAccessorRenderManager.java +mixin/MixinAbstractClientPlayer.java +mixin/MixinBlock.java +mixin/MixinBlockBush.java +mixin/MixinBlockGrass.java +mixin/MixinBlockLadder.java +mixin/MixinBlockLeaves.java +mixin/MixinBlockModelRenderer.java +mixin/MixinBlockPane.java +mixin/MixinBlockRendererDispatcher.java +mixin/MixinBlockWeb.java +mixin/MixinEntity.java +mixin/MixinEntityLivingBase.java +mixin/MixinEntityPlayer.java +mixin/MixinEntityPlayerSP.java +mixin/MixinEntityRenderer.java +mixin/MixinFontRenderer.java +mixin/MixinFovHandler.java +mixin/MixinGuiIngame.java +mixin/MixinGuiIngameForge.java +mixin/MixinItemStack.java +mixin/MixinKeyBinding.java +mixin/MixinMinecraft.java +mixin/MixinNetworkManager.java +mixin/MixinPlayerControllerMP.java +mixin/MixinRendererLivingEntity.java +mixin/MixinRenderManager.java +mixin/MixinVisGraph.java +mixin/MixinWorld.java +mixin/MixinWorldRenderer.java +module/Module.java +module/ModuleManager.java +module/modules/AimAssist.java +module/modules/AntiAFK.java +module/modules/AntiDebuff.java +module/modules/AntiFireball.java +module/modules/AntiObbyTrap.java +module/modules/AntiObfuscate.java +module/modules/AntiVoid.java +module/modules/AutoAnduril.java +module/modules/AutoBlockIn.java +module/modules/AutoClicker.java +module/modules/AutoHeal.java +module/modules/AutoTool.java +module/modules/BedESP.java +module/modules/BedNuker.java +module/modules/BedTracker.java +module/modules/Blink.java +module/modules/Chams.java +module/modules/ChestESP.java +module/modules/ChestStealer.java +module/modules/Eagle.java +module/modules/ESP.java +module/modules/FastPlace.java +module/modules/Fly.java +module/modules/Freeze.java +module/modules/FullBright.java +module/modules/GhostHand.java +module/modules/GuiModule.java +module/modules/HitBox.java +module/modules/HitSelect.java +module/modules/HUD.java +module/modules/Indicators.java +module/modules/InventoryClicker.java +module/modules/InvManager.java +module/modules/InvWalk.java +module/modules/ItemESP.java +module/modules/Jesus.java +module/modules/KeepSprint.java +module/modules/KillAura.java +module/modules/LagRange.java +module/modules/LightningTracker.java +module/modules/LongJump.java +module/modules/MCF.java +module/modules/MoreKB.java +module/modules/NameTags.java +module/modules/NickHider.java +module/modules/NoFall.java +module/modules/NoHitDelay.java +module/modules/NoHurtCam.java +module/modules/NoJumpDelay.java +module/modules/NoRotate.java +module/modules/NoSlow.java +module/modules/Radar.java +module/modules/Reach.java +module/modules/Refill.java +module/modules/SafeWalk.java +module/modules/Scaffold.java +module/modules/Spammer.java +module/modules/Speed.java +module/modules/SpeedMine.java +module/modules/Sprint.java +module/modules/TargetHUD.java +module/modules/TargetStrafe.java +module/modules/Tracers.java +module/modules/Trajectories.java +module/modules/Velocity.java +module/modules/ViewClip.java +module/modules/Wtap.java +module/modules/Xray.java +Myau.java +property/properties/BooleanProperty.java +property/properties/ColorProperty.java +property/properties/FloatProperty.java +property/properties/IntProperty.java +property/properties/ModeProperty.java +property/properties/PercentProperty.java +property/properties/TextProperty.java +property/Property.java +property/PropertyManager.java +ui/callback/GuiInput.java +ui/ClickGui.java +ui/Component.java +ui/components/BindComponent.java +ui/components/CategoryComponent.java +ui/components/CheckBoxComponent.java +ui/components/ColorSliderComponent.java +ui/components/ModeComponent.java +ui/components/ModuleComponent.java +ui/components/SliderComponent.java +ui/components/TextComponent.java +ui/dataset/BindStage.java +ui/dataset/impl/FloatSlider.java +ui/dataset/impl/IntSlider.java +ui/dataset/impl/PercentageSlider.java +ui/dataset/Slider.java +util/BlockUtil.java +util/ChatUtil.java +util/ColorUtil.java +util/ItemUtil.java +util/KeyBindUtil.java +util/MoveUtil.java +util/PacketUtil.java +util/PlayerUtil.java +util/RandomUtil.java +util/RenderUtil.java +util/RotationUtil.java +util/ServerUtil.java +util/shader/GlowShader.java +util/shader/OutlineShader.java +util/shader/Shader.java +util/SoundUtil.java +util/TeamUtil.java +util/TimerUtil.java + + + +This section contains the contents of the repository's files. + + +package myau.command; + +import java.util.ArrayList; + +public abstract class Command { + public final ArrayList names; + + public Command(ArrayList arrayList) { + this.names = arrayList; + } + + public abstract void runCommand(ArrayList args); +} + + + +package myau.command; + +import myau.Myau; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.event.types.Priority; +import myau.events.PacketEvent; +import myau.util.ChatUtil; +import net.minecraft.network.play.client.C01PacketChatMessage; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class CommandManager { + public ArrayList commands; + + public CommandManager() { + this.commands = new ArrayList<>(); + } + + public void handleCommand(String string) { + List params = Arrays.asList(string.substring(1).trim().split("\\s+")); + ArrayList arrayList = new ArrayList<>(params); + if (params.get(0).isEmpty()) { + ChatUtil.sendFormatted(String.format("%sUnknown command&r", Myau.clientName).replace("&", "§")); + } else { + for (Command command : Myau.commandManager.commands) { + for (String name : command.names) { + if (params.get(0).equalsIgnoreCase(name)) { + command.runCommand(arrayList); + return; + } + } + } + ChatUtil.sendFormatted(String.format("%sUnknown command (&o%s&r)&r", Myau.clientName, params.get(0)).replace("&", "§")); + } + } + + public boolean isTypingCommand(String string) { + if (string == null || string.length() < 2) { + return false; + } else { + return string.charAt(0) == '.' && Character.isLetterOrDigit(string.charAt(1)); + } + } + + @EventTarget(Priority.HIGHEST) + public void onPacket(PacketEvent event) { + if (event.getType() == EventType.SEND && event.getPacket() instanceof C01PacketChatMessage) { + String msg = ((C01PacketChatMessage) event.getPacket()).getMessage(); + if (this.isTypingCommand(msg)) { + event.setCancelled(true); + this.handleCommand(msg); + } + } + } +} + + + +package myau.command.commands; + +import myau.Myau; +import myau.command.Command; +import myau.module.Module; +import myau.util.ChatUtil; +import myau.util.KeyBindUtil; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Locale; +import java.util.stream.Collectors; + +public class BindCommand extends Command { + public BindCommand() { + super(new ArrayList<>(Arrays.asList("bind", "b"))); + } + + @Override + public void runCommand(ArrayList args) { + if (args.size() < 3) { + if (args.size() == 2 && (args.get(1).equalsIgnoreCase("l") || args.get(1).equalsIgnoreCase("list"))) { + List modules = Myau.moduleManager.modules.values().stream().filter(module -> module.getKey() != 0).collect(Collectors.toList()); + if (modules.isEmpty()) { + ChatUtil.sendFormatted(String.format("%sNo binds&r", Myau.clientName)); + } else { + ChatUtil.sendFormatted(String.format("%sBinds:&r", Myau.clientName)); + for (Module module : modules) { + ChatUtil.sendFormatted(String.format("%s»&r %s&r", module.isHidden() ? "&8" : "&7", module.formatModule())); + } + } + } else { + ChatUtil.sendFormatted( + String.format( + "%sUsage: .%s <&omodule&r> <&okey&r>&r | .%s <&omodule&r> &onone&r | .%s &olist&r", + Myau.clientName, + args.get(0).toLowerCase(Locale.ROOT), + args.get(0).toLowerCase(Locale.ROOT), + args.get(0).toLowerCase(Locale.ROOT) + ) + ); + } + } else { + String keyInput = args.get(2).toUpperCase(); + int keyIndex = 0; + + if (keyInput.equalsIgnoreCase("NONE") || keyInput.equalsIgnoreCase("NULL") || keyInput.equalsIgnoreCase("0")) { + keyIndex = 0; + } else { + keyIndex = Keyboard.getKeyIndex(keyInput); + + if (keyIndex == 0) { + int buttonIndex = getMouseButtonIndex(keyInput); + if (buttonIndex != -1) { + keyIndex = buttonIndex - 100; + } + } + } + + if (!args.get(1).equals("*")) { + Module module = Myau.moduleManager.getModule(args.get(1)); + if (module == null) { + ChatUtil.sendFormatted(String.format("%sModule not found (&o%s&r)&r", Myau.clientName, args.get(1))); + } else { + module.setKey(keyIndex); + if (keyIndex == 0) { + ChatUtil.sendFormatted( + String.format("%sUnbind &o%s&r", Myau.clientName, module.getName()) + ); + } else { + ChatUtil.sendFormatted( + String.format("%sBound &o%s&r to &l[%s]&r", Myau.clientName, module.getName(), KeyBindUtil.getKeyName(keyIndex)) + ); + } + } + } else { + for (Module module : Myau.moduleManager.modules.values()) { + module.setKey(keyIndex); + } + if (keyIndex == 0) { + ChatUtil.sendFormatted( + String.format("%sUnbind all modules&r", Myau.clientName) + ); + } else { + ChatUtil.sendFormatted( + String.format("%sBind all modules to &l[%s]&r", Myau.clientName, KeyBindUtil.getKeyName(keyIndex)) + ); + } + } + } + } + + private int getMouseButtonIndex(String buttonName) { + // Handle numbered format (MOUSE0, MOUSE1, etc.) + if (buttonName.startsWith("MOUSE")) { + try { + String numStr = buttonName.substring(5); + int buttonNum = Integer.parseInt(numStr); + if (buttonNum >= 0 && buttonNum < Mouse.getButtonCount()) { + return buttonNum; + } + } catch (NumberFormatException | StringIndexOutOfBoundsException e) { + } + } + + int buttonIndex = Mouse.getButtonIndex(buttonName); + if (buttonIndex != -1) { + return buttonIndex; + } + + switch (buttonName) { + case "LBUTTON": + case "LMB": + case "LEFTCLICK": + return 0; + case "RBUTTON": + case "RMB": + case "RIGHTCLICK": + return 1; + case "MBUTTON": + case "MMB": + case "MIDDLECLICK": + case "SCROLLCLICK": + return 2; + case "MOUSE3": + case "XBUTTON1": + case "SIDEBUTTON1": + case "BOTTOMSIDE": + return 3; + case "MOUSE4": + case "XBUTTON2": + case "SIDEBUTTON2": + case "TOPSIDE": + return 4; + case "MOUSE5": + return 5; + case "MOUSE6": + return 6; + case "MOUSE7": + return 7; + default: + return -1; + } + } +} + + + +package myau.command.commands; + +import myau.Myau; +import myau.command.Command; +import myau.config.Config; +import myau.enums.ChatColors; +import myau.util.ChatUtil; +import net.minecraft.event.ClickEvent; +import net.minecraft.event.ClickEvent.Action; +import net.minecraft.event.HoverEvent; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatStyle; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.io.IOCase; +import org.apache.commons.io.comparator.LastModifiedFileComparator; +import org.apache.commons.io.filefilter.WildcardFileFilter; + +import java.awt.*; +import java.io.File; +import java.io.FileFilter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Locale; + +public class ConfigCommand extends Command { + private static final FileFilter FILE_FILTER = new WildcardFileFilter("*.json", IOCase.INSENSITIVE); + + public ConfigCommand() { + super(new ArrayList<>(Arrays.asList("config", "cfg", "c"))); + } + + @Override + public void runCommand(ArrayList args) { + if (args.size() < 2) { + String command = args.get(0).toLowerCase(Locale.ROOT); + ChatUtil.sendFormatted( + String.format("%sUsage: .%s &oload&r/&osave&r <&oname&r> | .%s &olist&r | .%s &ofolder&r", Myau.clientName, command, command, command) + ); + } else { + String subCommand = args.get(1); + if (subCommand.equalsIgnoreCase("l")) { + subCommand = args.size() < 3 ? "list" : "load"; + } + String sub = subCommand.toLowerCase(Locale.ROOT); + switch (sub) { + case "load": + case "reload": + if (args.size() < 3) { + ChatUtil.sendFormatted( + String.format("%sMissing config name (use '&odefault&r' or '&o!&r' to load default config)&r", Myau.clientName) + ); + return; + } + new Config(args.get(2), false).load(); + return; + case "s": + case "save": + if (args.size() < 3) { + new Config(Config.lastConfig, true).save(); + return; + } + new Config(args.get(2), true).save(); + return; + case "list": + try { + File[] configs = new File("./config/Myau/").listFiles(FILE_FILTER); + if (configs == null) { + throw new Exception(); + } + if (configs.length == 0) { + ChatUtil.sendFormatted(String.format("%sNo configs found (&o%s&r)&r", Myau.clientName, "./config/Myau/")); + } + Arrays.sort(configs, LastModifiedFileComparator.LASTMODIFIED_REVERSE); + ChatUtil.sendFormatted(String.format("%sConfigs:&r", Myau.clientName)); + for (File file : configs) { + String formatted = ChatColors.formatColor(String.format("&7»&r &o%s&r", file.getName())); + String config = String.format(".config load %s", FilenameUtils.removeExtension(file.getName())); + ChatUtil.send( + new ChatComponentText(formatted) + .setChatStyle( + new ChatStyle() + .setChatClickEvent(new ClickEvent(Action.RUN_COMMAND, config)) + .setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(config))) + ) + ); + } + } catch (Exception e) { + ChatUtil.sendFormatted(String.format("%sFailed to read (&o%s&r)&r", Myau.clientName, "./config/Myau/")); + } + return; + case "f": + case "folder": + case "dir": + case "directory": + try { + Desktop.getDesktop().open(new File("./config/Myau/")); + } catch (Exception e) { + ChatUtil.sendFormatted(String.format("%sFailed to open (&o%s&r)&r", Myau.clientName, "./config/Myau/")); + } + return; + default: + ChatUtil.sendFormatted(String.format("%sInvalid argument (&o%s&r)&r", Myau.clientName, args.get(1))); + } + } + } +} + + + +package myau.command.commands; + +import com.google.common.collect.Iterables; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import myau.Myau; +import myau.command.Command; +import myau.enums.ChatColors; +import myau.util.ChatUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.network.NetworkPlayerInfo; + +import java.awt.*; +import java.awt.datatransfer.StringSelection; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Base64; +import java.util.Collections; +import java.util.Locale; + +public class DenickCommand extends Command { + private static final Minecraft mc = Minecraft.getMinecraft(); + + public DenickCommand() { + super(new ArrayList<>(Collections.singletonList("denick"))); + } + + @Override + public void runCommand(ArrayList args) { + if (args.size() < 2) { + ChatUtil.sendFormatted(String.format("%sUsage: .%s <&oname&r>&r", Myau.clientName, args.get(0).toLowerCase(Locale.ROOT))); + } else { + NetworkPlayerInfo playerInfo = mc.getNetHandler().getPlayerInfo(ChatColors.formatColor(args.get(1))); + if (playerInfo != null) { + GameProfile gameProfile = playerInfo.getGameProfile(); + Property property = Iterables.getFirst(gameProfile.getProperties().get("textures"), null); + if (property != null) { + String code = new String(Base64.getDecoder().decode(property.getValue().getBytes(StandardCharsets.UTF_8))); + String name = code.contains("profileName\" : \"") ? code.split("profileName\" : \"")[1].split("\"")[0] : "?"; + String uuid = code.contains("profileId\" : \"") ? code.split("profileId\" : \"")[1].split("\"")[0] : "?"; + ChatUtil.sendRaw( + String.format( + ChatColors.formatColor("%s%s&r -> %s (&o%s&r)&r"), + ChatColors.formatColor(Myau.clientName), + gameProfile.getName().replace("§", "&"), + name, + uuid + ) + ); + if (!uuid.isEmpty() && !uuid.equals("?")) { + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(uuid), null); + } + } else { + ChatUtil.sendRaw( + String.format( + ChatColors.formatColor("%sNo textures for entity with name &o%s&r"), + ChatColors.formatColor(Myau.clientName), + args.get(1) + ) + ); + } + } else { + ChatUtil.sendRaw( + String.format( + ChatColors.formatColor("%sNo entity with name &o%s&r"), + ChatColors.formatColor(Myau.clientName), + args.get(1) + ) + ); + } + } + } +} + + + +package myau.command.commands; + +import myau.Myau; +import myau.command.Command; +import myau.enums.ChatColors; +import myau.util.ChatUtil; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Locale; + +public class FriendCommand extends Command { + public FriendCommand() { + super(new ArrayList<>(Arrays.asList("friend", "f"))); + } + + @Override + public void runCommand(ArrayList args) { + if (args.size() >= 2) { + String subCommand = args.get(1).toLowerCase(Locale.ROOT); + switch (subCommand) { + case "a": + case "add": + if (args.size() < 3) { + ChatUtil.sendFormatted( + String.format("%sUsage: .%s add <&oname&r> [&oname&r] ...&r", Myau.clientName, args.get(0).toLowerCase(Locale.ROOT)) + ); + return; + } + for (String name: args.subList(2, args.size())) { + String added = Myau.friendManager.add(name); + if (added == null) { + ChatUtil.sendFormatted(String.format("%s&o%s&r is already in your friend list&r", Myau.clientName, name)); + } else { + ChatUtil.sendFormatted(String.format("%sAdded &o%s&r to your friend list&r", Myau.clientName, added)); + } + } + return; + case "r": + case "remove": + if (args.size() < 3) { + ChatUtil.sendFormatted( + String.format("%sUsage: .%s remove <&oname&r> [&oname&r] ...&r", Myau.clientName, args.get(0).toLowerCase(Locale.ROOT)) + ); + return; + } + for (String name: args.subList(2, args.size())){ + String removed = Myau.friendManager.remove(name); + if (removed == null) { + ChatUtil.sendFormatted(String.format("%s&o%s&r is not in your friend list&r", Myau.clientName, name)); + } else { + ChatUtil.sendFormatted(String.format("%sRemoved &o%s&r from your friend list&r", Myau.clientName, removed)); + } + } + return; + case "l": + case "list": + ArrayList list = Myau.friendManager.getPlayers(); + if (list.isEmpty()) { + ChatUtil.sendFormatted(String.format("%sNo friends&r", Myau.clientName)); + return; + } + ChatUtil.sendFormatted(String.format("%sFriends:&r", Myau.clientName)); + for (String friend : list) { + ChatUtil.sendRaw(String.format(ChatColors.formatColor(" &o%s&r"), friend)); + } + return; + case "c": + case "clear": + Myau.friendManager.clear(); + ChatUtil.sendFormatted(String.format("%sCleared your friend list&r", Myau.clientName)); + return; + default: + if (args.size() == 2) { + if (Myau.friendManager.isFriend(args.get(1))) { + runCommand(new ArrayList<>(Arrays.asList(args.get(0), "remove", args.get(1)))); + } else { + runCommand(new ArrayList<>(Arrays.asList(args.get(0), "add", args.get(1)))); + } + return; + } + } + } + ChatUtil.sendFormatted( + String.format("%sUsage: .%s <&oa(dd)&r/&or(emove)&r/&ol(ist)&r/&oc(lear)&r>&r", Myau.clientName, args.get(0).toLowerCase(Locale.ROOT)) + ); + } +} + + + +package myau.command.commands; + +import myau.Myau; +import myau.command.Command; +import myau.util.ChatUtil; + +import java.util.ArrayList; +import java.util.Arrays; + +public class HelpCommand extends Command { + public HelpCommand() { + super(new ArrayList<>(Arrays.asList("help", "commands"))); + } + + @Override + public void runCommand(ArrayList args) { + if (!Myau.moduleManager.modules.isEmpty()) { + ChatUtil.sendFormatted(String.format("%sCommands:&r", Myau.clientName)); + for (Command command : Myau.commandManager.commands) { + if (!(command instanceof ModuleCommand)) { + ChatUtil.sendFormatted(String.format("&7»&r .%s&r", String.join(" &7/&r .", command.names))); + } + } + } + } +} + + + +package myau.command.commands; + +import myau.Myau; +import myau.command.Command; +import myau.module.Module; +import myau.util.ChatUtil; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Locale; + +public class HideCommand extends Command { + public HideCommand() { + super(new ArrayList<>(Arrays.asList("hide", "h"))); + } + + @Override + public void runCommand(ArrayList args) { + if (args.size() < 2) { + ChatUtil.sendFormatted( + String.format("%sUsage: .%s <&omodule&r>&r", Myau.clientName, args.get(0).toLowerCase(Locale.ROOT)) + ); + } else if (!args.get(1).equals("*")) { + Module module = Myau.moduleManager.getModule(args.get(1)); + if (module == null) { + ChatUtil.sendFormatted(String.format("%sModule &o%s&r not found&r", Myau.clientName, args.get(1))); + } else if (module.isHidden()) { + ChatUtil.sendFormatted(String.format("%s&o%s&r is already hidden in HUD&r", Myau.clientName, module.getName())); + } else { + module.setHidden(true); + ChatUtil.sendFormatted(String.format("%s&o%s&r has been hidden in HUD&r", Myau.clientName, module.getName())); + } + } else { + for (Module module : Myau.moduleManager.modules.values()) { + module.setHidden(true); + } + ChatUtil.sendFormatted(String.format("%sAll modules have been hidden in HUD&r", Myau.clientName)); + } + } +} + + + +package myau.command.commands; + +import myau.Myau; +import myau.command.Command; +import myau.util.ChatUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.util.Session; +import net.minecraft.util.StringUtils; + +import java.awt.*; +import java.awt.datatransfer.StringSelection; +import java.util.ArrayList; +import java.util.Arrays; + +public class IgnCommand extends Command { + private static final Minecraft mc = Minecraft.getMinecraft(); + + public IgnCommand() { + super(new ArrayList(Arrays.asList("username", "name", "ign"))); + } + + @Override + public void runCommand(ArrayList args) { + Session session = mc.getSession(); + if (session != null) { + String username = session.getUsername(); + if (!StringUtils.isNullOrEmpty(username)) { + try { + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(username), null); + ChatUtil.sendFormatted(String.format("%sYour username has been copied to the clipboard (&o%s&r)&r", Myau.clientName, username)); + } catch (Exception e) { + ChatUtil.sendFormatted(String.format("%sFailed to copy&r", Myau.clientName)); + } + } + } + } +} + + + +package myau.command.commands; + +import myau.Myau; +import myau.command.Command; +import myau.enums.ChatColors; +import myau.util.ChatUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; + +import java.util.ArrayList; +import java.util.Arrays; + +public class ItemCommand extends Command { + private static final Minecraft mc = Minecraft.getMinecraft(); + + public ItemCommand() { + super(new ArrayList<>(Arrays.asList("itemname", "item"))); + } + + @Override + public void runCommand(ArrayList args) { + ItemStack stack = mc.thePlayer.inventory.getCurrentItem(); + if (stack != null) { + String display = stack.getDisplayName().replace('§', '&'); + String registryName = stack.getItem().getRegistryName(); + String compound = stack.hasTagCompound() ? stack.getTagCompound().toString().replace('§', '&') : ""; + ChatUtil.sendRaw(String.format("%s%s (%s) %s", ChatColors.formatColor(Myau.clientName), display, registryName, compound)); + } + } +} + + + +package myau.command.commands; + +import myau.Myau; +import myau.command.Command; +import myau.module.Module; +import myau.util.ChatUtil; + +import java.util.ArrayList; +import java.util.Arrays; + +public class ListCommand extends Command { + public ListCommand() { + super(new ArrayList<>(Arrays.asList("list", "l", "modules", "myau"))); + } + + @Override + public void runCommand(ArrayList args) { + if (!Myau.moduleManager.modules.isEmpty()) { + ChatUtil.sendFormatted(String.format("%sModules:&r", Myau.clientName)); + for (Module module : Myau.moduleManager.modules.values()) { + ChatUtil.sendFormatted(String.format("%s»&r %s&r", module.isHidden() ? "&8" : "&7", module.formatModule())); + } + } + } +} + + + +package myau.command.commands; + +import myau.Myau; +import myau.command.Command; +import myau.module.Module; +import myau.util.ChatUtil; +import myau.property.Property; +import myau.property.properties.BooleanProperty; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +public class ModuleCommand extends Command { + public ModuleCommand() { + super(new ArrayList<>(Myau.moduleManager.modules.values().stream().map(Module::getName).collect(Collectors.toList()))); + } + + @Override + public void runCommand(ArrayList args) { + Module module = Myau.moduleManager.getModule(args.get(0)); + if (args.size() >= 2) { + Property property = Myau.propertyManager.getProperty(module, args.get(1)); + if (property == null) { + ChatUtil.sendFormatted(String.format("%s%s has no property &o%s&r", Myau.clientName, module.getName(), args.get(1))); + } else if (args.size() < 3 && !(property instanceof BooleanProperty)) { + ChatUtil.sendFormatted( + String.format( + "%s%s: &o%s&r is set to %s&r (%s)&r", + Myau.clientName, + module.getName(), + property.getName(), + property.formatValue(), + property.getValuePrompt() + ) + ); + } else { + String newValue = args.size() < 3 ? null : String.join(" ", args.subList(2, args.size())); + try { + if (property.parseString(newValue)) { + ChatUtil.sendFormatted( + String.format("%s%s: &o%s&r has been set to %s&r", Myau.clientName, module.getName(), property.getName(), property.formatValue()) + ); + return; + } + } catch (Exception e) { + } + ChatUtil.sendFormatted( + String.format("%sInvalid value for property &o%s&r (%s)&r", Myau.clientName, property.getName(), property.getValuePrompt()) + ); + } + } else { + List> properties = Myau.propertyManager.properties.get(module.getClass()); + if (properties != null) { + List> visible = properties.stream().filter(Property::isVisible).collect(Collectors.toList()); + if (!visible.isEmpty()) { + ChatUtil.sendFormatted(String.format("%s%s:&r", Myau.clientName, module.formatModule())); + for (Property property : visible) { + ChatUtil.sendFormatted(String.format("&7»&r %s: %s&r", property.getName(), property.formatValue())); + } + return; + } + } + ChatUtil.sendFormatted(String.format("%s%s has no properties&r", Myau.clientName, module.formatModule())); + } + } +} + + + +package myau.command.commands; + +import myau.Myau; +import myau.command.Command; +import myau.enums.ChatColors; +import myau.util.ChatUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.network.NetworkPlayerInfo; + +import java.util.ArrayList; +import java.util.Arrays; + +public class PlayerCommand extends Command { + private static final Minecraft mc = Minecraft.getMinecraft(); + + public PlayerCommand() { + super(new ArrayList<>(Arrays.asList("playerlist", "players"))); + } + + @Override + public void runCommand(ArrayList args) { + ArrayList players = new ArrayList<>(); + for (NetworkPlayerInfo playerInfo : mc.getNetHandler().getPlayerInfoMap()) { + players.add(playerInfo.getGameProfile().getName().replace("§", "&")); + } + if (players.isEmpty()) { + ChatUtil.sendFormatted(String.format("%sNo players&r", Myau.clientName)); + } else { + ChatUtil.sendRaw( + String.format( + ChatColors.formatColor("%sPlayers:&r %s"), + ChatColors.formatColor(Myau.clientName), + String.join(", ", players) + ) + ); + } + } +} + + + +package myau.command.commands; + +import myau.Myau; +import myau.command.Command; +import myau.module.Module; +import myau.util.ChatUtil; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Locale; + +public class ShowCommand extends Command { + public ShowCommand() { + super(new ArrayList<>(Arrays.asList("show", "s", "unhide"))); + } + + @Override + public void runCommand(ArrayList args) { + if (args.size() < 2) { + ChatUtil.sendFormatted( + String.format("%sUsage: .%s <&omodule&r>&r", Myau.clientName, args.get(0).toLowerCase(Locale.ROOT)) + ); + } else if (!args.get(1).equals("*")) { + Module module = Myau.moduleManager.getModule(args.get(1)); + if (module == null) { + ChatUtil.sendFormatted(String.format("%sModule &o%s&r not found&r", Myau.clientName, args.get(1))); + } else if (!module.isHidden()) { + ChatUtil.sendFormatted(String.format("%s&o%s&r is not hidden in HUD&r", Myau.clientName, module.getName())); + } else { + module.setHidden(false); + ChatUtil.sendFormatted(String.format("%s&o%s&r is no longer hidden in HUD&r", Myau.clientName, module.getName())); + } + } else { + for (Module module : Myau.moduleManager.modules.values()) { + module.setHidden(false); + } + ChatUtil.sendFormatted(String.format("%sAll modules are no longer hidden in HUD&r", Myau.clientName)); + } + } +} + + + +package myau.command.commands; + +import myau.Myau; +import myau.command.Command; +import myau.enums.ChatColors; +import myau.util.ChatUtil; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Locale; + +public class TargetCommand extends Command { + public TargetCommand() { + super(new ArrayList<>(Arrays.asList("enemy", "e", "target"))); + } + + @Override + public void runCommand(ArrayList args) { + if (args.size() >= 2) { + String subCommand = args.get(1).toLowerCase(Locale.ROOT); + switch (subCommand) { + case "add": + if (args.size() < 3) { + ChatUtil.sendFormatted( + String.format("%sUsage: .%s add <&oname&r>&r", Myau.clientName, args.get(0).toLowerCase(Locale.ROOT)) + ); + return; + } + String added = Myau.targetManager.add(args.get(2)); + if (added == null) { + ChatUtil.sendFormatted(String.format("%s&o%s&r is already in your enemy list&r", Myau.clientName, args.get(2))); + return; + } + ChatUtil.sendFormatted(String.format("%sAdded &o%s&r to your enemy list&r", Myau.clientName, added)); + return; + case "remove": + if (args.size() < 3) { + ChatUtil.sendFormatted( + String.format("%sUsage: .%s remove <&oname&r>&r", Myau.clientName, args.get(0).toLowerCase(Locale.ROOT)) + ); + return; + } + String removed = Myau.targetManager.remove(args.get(2)); + if (removed == null) { + ChatUtil.sendFormatted(String.format("%s&o%s&r is not in your enemy list&r", Myau.clientName, args.get(2))); + return; + } + ChatUtil.sendFormatted(String.format("%sRemoved &o%s&r from your enemy list&r", Myau.clientName, removed)); + return; + case "list": + ArrayList list = Myau.targetManager.getPlayers(); + if (list.isEmpty()) { + ChatUtil.sendFormatted(String.format("%sNo enemies&r", Myau.clientName)); + return; + } + ChatUtil.sendFormatted(String.format("%sEnemies:&r", Myau.clientName)); + for (String player : list) { + ChatUtil.sendRaw(String.format(ChatColors.formatColor(" &o%s&r"), player)); + } + return; + case "clear": + Myau.targetManager.clear(); + ChatUtil.sendFormatted(String.format("%sCleared your enemy list&r", Myau.clientName)); + return; + } + } + ChatUtil.sendFormatted( + String.format("%sUsage: .%s <&oadd&r/&oremove&r/&olist&r/&oclear&r>&r", Myau.clientName, args.get(0).toLowerCase(Locale.ROOT)) + ); + } +} + + + +package myau.command.commands; + +import myau.Myau; +import myau.command.Command; +import myau.module.Module; +import myau.util.ChatUtil; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Locale; + +public class ToggleCommand extends Command { + public ToggleCommand() { + super(new ArrayList<>(Arrays.asList("toggle", "t"))); + } + + @Override + public void runCommand(ArrayList args) { + if (args.size() < 2) { + ChatUtil.sendFormatted( + String.format("%sUsage: .%s <&omodule&r>&r", Myau.clientName, args.get(0).toLowerCase(Locale.ROOT)) + ); + } else { + Module module = Myau.moduleManager.getModule(args.get(1)); + if (module == null) { + ChatUtil.sendFormatted(String.format("%sModule not found (&o%s&r)&r", Myau.clientName, args.get(1))); + } else { + boolean changed = true; + if (args.size() >= 3) { + if (args.get(2).equalsIgnoreCase("true") + || args.get(2).equalsIgnoreCase("on") + || args.get(2).equalsIgnoreCase("1")) { + changed = !module.isEnabled(); + } else if (args.get(2).equalsIgnoreCase("false") + || args.get(2).equalsIgnoreCase("off") + || args.get(2).equalsIgnoreCase("0")) { + changed = module.isEnabled(); + } + } + if (changed && module.toggle()) { + ChatUtil.sendFormatted(String.format("%s%s: %s&r", Myau.clientName, module.getName(), module.isEnabled() ? "&a&lON" : "&c&lOFF")); + } + } + } + } +} + + + +package myau.command.commands; + +import myau.Myau; +import myau.command.Command; +import myau.util.ChatUtil; +import net.minecraft.client.Minecraft; + +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Locale; + +public class VclipCommand extends Command { + private static final Minecraft mc = Minecraft.getMinecraft(); + private static final DecimalFormat df = new DecimalFormat("#.##", new DecimalFormatSymbols(Locale.US)); + + public VclipCommand() { + super(new ArrayList<>(Collections.singletonList("vclip"))); + } + + @Override + public void runCommand(ArrayList args) { + if (args.size() >= 2) { + double distance = 0.0; + try { + distance = Double.parseDouble(args.get(1)); + } catch (NumberFormatException e) { + } finally { + mc.thePlayer.setPositionAndUpdate(mc.thePlayer.posX, mc.thePlayer.posY + distance, mc.thePlayer.posZ); + ChatUtil.sendFormatted(String.format("%sClipped (%s blocks)", Myau.clientName, df.format(distance))); + } + return; + } + ChatUtil.sendFormatted( + String.format("%sUsage: .%s <&odistance&r>&r", Myau.clientName, args.get(0).toLowerCase(Locale.ROOT)) + ); + } +} + + + +package myau.config; + +import com.google.gson.*; +import myau.Myau; +import myau.mixin.IAccessorMinecraft; +import myau.module.Module; +import myau.util.ChatUtil; +import myau.property.Property; +import net.minecraft.client.Minecraft; + +import java.io.*; +import java.util.ArrayList; + +public class Config { + public static Minecraft mc = Minecraft.getMinecraft(); + public static Gson gson = new GsonBuilder().setPrettyPrinting().create(); + public String name; + public File file; + + public static String lastConfig; + + public Config(String name, boolean newConfig) { + this.name = name; + lastConfig = name; + if (name.equals("!") || name.equals("default")) { + this.name = "default"; + } + this.file = new File("./config/Myau/", String.format("%s.json", this.name)); + try { + file.getParentFile().mkdirs(); + if (newConfig) { + ((IAccessorMinecraft) mc).getLogger().info(String.format("Created: %s", this.file.getName())); + } + } catch (Exception e) { + ((IAccessorMinecraft) mc).getLogger().error(e.getMessage()); + } + } + + public void load() { + try { + + if (!file.exists()) { + ChatUtil.sendFormatted(String.format("%sConfig file not found (&c&o%s&r). Creating default config...&r", Myau.clientName, file.getName())); + save(); + return; + } + + JsonElement parsed = new JsonParser().parse(new BufferedReader(new FileReader(file))); + if (parsed == null || !parsed.isJsonObject()) { + ChatUtil.sendFormatted(String.format("%sInvalid config format (&c&o%s&r)&r", Myau.clientName, file.getName())); + return; + } + + JsonObject jsonObject = parsed.getAsJsonObject(); + for (Module module : Myau.moduleManager.modules.values()) { + JsonElement moduleObj = jsonObject.get(module.getName()); + if (moduleObj != null && moduleObj.isJsonObject()) { + JsonObject object = moduleObj.getAsJsonObject(); + + ArrayList> list = Myau.propertyManager.properties.get(module.getClass()); + if (list != null) { + for (Property property : list) { + if (object.has(property.getName())) { + try { + property.read(object); + } catch (Exception e) { + ((IAccessorMinecraft) mc).getLogger().warn(String.format("Failed to load property %s for module %s", property.getName(), module.getName())); + } + } + } + } + + if (object.has("toggled")) { + JsonElement toggled = object.get("toggled"); + if (toggled != null && toggled.isJsonPrimitive()) { + module.setEnabled(toggled.getAsBoolean()); + } + } + + if (object.has("key")) { + JsonElement key = object.get("key"); + if (key != null && key.isJsonPrimitive()) { + module.setKey(key.getAsInt()); + } + } + + if (object.has("hidden")) { + JsonElement hidden = object.get("hidden"); + if (hidden != null && hidden.isJsonPrimitive()) { + module.setHidden(hidden.getAsBoolean()); + } + } + } + } + ChatUtil.sendFormatted(String.format("%sConfig has been loaded (&a&o%s&r)&r", Myau.clientName, file.getName())); + } catch (FileNotFoundException e) { + ChatUtil.sendFormatted(String.format("%sConfig file not found (&c&o%s&r)&r", Myau.clientName, file.getName())); + } catch (JsonSyntaxException e) { + ChatUtil.sendFormatted(String.format("%sConfig has invalid JSON syntax (&c&o%s&r)&r", Myau.clientName, file.getName())); + ((IAccessorMinecraft) mc).getLogger().error("JSON Syntax Error: " + e.getMessage()); + } catch (Exception e) { + ((IAccessorMinecraft) mc).getLogger().error("Error loading config: " + e.getMessage()); + ChatUtil.sendFormatted(String.format("%sConfig couldn't be loaded (&c&o%s&r)&r", Myau.clientName, file.getName())); + } + } + + public void save() { + try { + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + + JsonObject object = new JsonObject(); + for (Module module : Myau.moduleManager.modules.values()) { + JsonObject moduleObject = new JsonObject(); + moduleObject.addProperty("toggled", module.isEnabled()); + moduleObject.addProperty("key", module.getKey()); + moduleObject.addProperty("hidden", module.isHidden()); + + ArrayList> list = Myau.propertyManager.properties.get(module.getClass()); + if (list != null) { + for (Property property : list) { + try { + property.write(moduleObject); + } catch (Exception e) { + ((IAccessorMinecraft) mc).getLogger().warn(String.format("Failed to save property %s for module %s", property.getName(), module.getName())); + } + } + } + object.add(module.getName(), moduleObject); + } + + PrintWriter printWriter = new PrintWriter(new FileWriter(file)); + printWriter.println(gson.toJson(object)); + printWriter.close(); + ChatUtil.sendFormatted(String.format("%sConfig has been saved (&a&o%s&r)&r", Myau.clientName, file.getName())); + } catch (IOException e) { + ((IAccessorMinecraft) mc).getLogger().error("Error saving config: " + e.getMessage()); + ChatUtil.sendFormatted(String.format("%sConfig couldn't be saved (&c&o%s&r)&r", Myau.clientName, file.getName())); + } + } +} + + + +package myau.data; + +public class Box { + public T value; + + public Box(T value) { + this.value = value; + } +} + + + +package myau.enums; + +public enum BlinkModules { + NONE, + ANTI_VOID, + AUTO_BLOCK, + BLINK, + NO_FALL, + NO_SLOW +} + + + +package myau.enums; + +public enum ChatColors { + BLACK('0', -16777216), + DARK_BLUE('1', -16777046), + DARK_GREEN('2', -16733696), + DARK_AQUA('3', -16733526), + DARK_RED('4', -5636096), + DARK_PURPLE('5', -5635926), + GOLD('6', -22016), + GRAY('7', -5592406), + DARK_GRAY('8', -11184811), + BLUE('9', -11184641), + GREEN('a', -11141291), + AQUA('b', -11141121), + RED('c', -43691), + LIGHT_PURPLE('d', -43521), + YELLOW('e', -171), + WHITE('f', -1), + MAGIC('k', 0), + BOLD('l', 0), + STRIKETHROUGH('m', 0), + UNDERLINE('n', 0), + ITALIC('o', 0), + RESET('r', 0); + private final String colorCodes; + private final int rgb; + public static final char COLOR_CHAR = '§'; + + ChatColors(char colorChar, int rgb) { + this.rgb = rgb; + this.colorCodes = new String(new char[]{COLOR_CHAR, colorChar}); + } + + @Override + public String toString() { + return this.colorCodes; + } + + public int toAwtColor() { + return this.rgb; + } + + public static String formatColor(String string) { + char[] cArray = string.toCharArray(); + for (int i = 0; i < cArray.length - 1; ++i) { + if (cArray[i] != '&' || "0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(cArray[i + 1]) <= -1) continue; + cArray[i] = COLOR_CHAR; + cArray[i + 1] = Character.toLowerCase(cArray[i + 1]); + } + return new String(cArray); + } +} + + + +package myau.enums; + +public enum DelayModules { + NONE, + VELOCITY, + BED_NUKER +} + + + +package myau.enums; + +public enum FloatModules { + NO_SLOW +} + + + +/** + * This is an API used for handling events across your java based projects. + * It's meant to be simple to use without sacrificing performance and extensibility. + *

+ * Currently the API is in beta phase but it's stable and ready to be used. + *

+ * If you have any suggestion for improvements/fixes for shit, + * feel free to make a pull request on the bitbucket: https://bitbucket.org/DarkMagician6/eventapi/overview. + *

+ * For information on how to use the API take a look at the wiki: + * https://bitbucket.org/DarkMagician6/eventapi/wiki/Home + * + * @Todo Improve/update the wiki. + */ +package myau.event; + +/** + * Main class for the API. + * Contains various information about the API. + * + * @author DarkMagician6 + * @since July 31, 2013 + */ +public final class EventAPI { + /** + * No need to create an Object of this class as all Methods are static. + */ + private EventAPI() { + } + + /** + * The current version of the API. + */ + public static final String VERSION = String.format("%s-%s", "0.7", "beta"); + /** + * Array containing the authors of the API. + */ + public static final String[] AUTHORS = { + "DarkMagician6" + }; +} + + + +package myau.event; + +import myau.event.events.Event; +import myau.event.events.EventStoppable; +import myau.event.types.Priority; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CopyOnWriteArrayList; + +/** + * @author DarkMagician6 + * @since February 2, 2014 + */ +public final class EventManager { + /** + * HashMap containing all the registered MethodData sorted on the event parameters of the methods. + */ + private static final HashMap, List> REGISTRY_MAP = new HashMap<>(); + + /** + * All methods in this class are static so there would be no reason to create an object of the EventManager class. + */ + private EventManager() { + } + + /** + * Registers all the methods marked with the EventTarget annotation in the class of the given Object. + * + * @param object Object that you want to register. + */ + public static void register(Object object) { + for (final Method method : object.getClass().getDeclaredMethods()) { + if (!isMethodBad(method)) { + register(method, object); + } + } + } + + /** + * Registers the methods marked with the EventTarget annotation and that require + * the specified Event as the parameter in the class of the given Object. + * + * @param object Object that contains the Method you want to register. + * @param eventClass class for the marked method we are looking for. + */ + public static void register(Object object, Class eventClass) { + for (final Method method : object.getClass().getDeclaredMethods()) { + if (!isMethodBad(method, eventClass)) { + register(method, object); + } + } + } + + /** + * Unregisters all the methods inside the Object that are marked with the EventTarget annotation. + * + * @param object Object of which you want to unregister all Methods. + */ + public static void unregister(Object object) { + for (final List dataList : REGISTRY_MAP.values()) { + for (final MethodData data : dataList) { + if (data.getSource().equals(object)) { + dataList.remove(data); + } + } + } + cleanMap(true); + } + + /** + * Unregisters all the methods in the given Object that have the specified class as a parameter. + * + * @param object Object that implements the Listener interface. + * @param eventClass class for the method to remove. + */ + public static void unregister(Object object, Class eventClass) { + if (REGISTRY_MAP.containsKey(eventClass)) { + for (final MethodData data : REGISTRY_MAP.get(eventClass)) { + if (data.getSource().equals(object)) { + REGISTRY_MAP.get(eventClass).remove(data); + } + } + cleanMap(true); + } + } + + /** + * Registers a new MethodData to the HashMap. + * If the HashMap already contains the key of the Method's first argument it will add + * a new MethodData to key's matching list and sorts it based on Priority. @see com.darkmagician6.eventapi.types.Priority + * Otherwise it will put a new entry in the HashMap with a the first argument's class + * and a new CopyOnWriteArrayList containing the new MethodData. + * + * @param method Method to register to the HashMap. + * @param object Source object of the method. + */ + private static void register(Method method, Object object) { + Class indexClass = (Class) method.getParameterTypes()[0]; + //New MethodData from the Method we are registering. + final MethodData data = new MethodData(object, method, method.getAnnotation(EventTarget.class).value()); + //Set's the method to accessible so that we can also invoke it if it's protected or private. + if (!data.getTarget().isAccessible()) { + data.getTarget().setAccessible(true); + } + if (REGISTRY_MAP.containsKey(indexClass)) { + if (!REGISTRY_MAP.get(indexClass).contains(data)) { + REGISTRY_MAP.get(indexClass).add(data); + sortListValue(indexClass); + } + } else { + REGISTRY_MAP.put(indexClass, new CopyOnWriteArrayList() { + //Eclipse was bitching about a serialVersionUID. + private static final long serialVersionUID = 666L; + + { + add(data); + } + }); + } + } + + /** + * Removes an entry based on the key value in the map. + * + * @param indexClass They index key in the map of which the entry should be removed. + */ + public static void removeEntry(Class indexClass) { + Iterator, List>> mapIterator = REGISTRY_MAP.entrySet().iterator(); + while (mapIterator.hasNext()) { + if (mapIterator.next().getKey().equals(indexClass)) { + mapIterator.remove(); + break; + } + } + } + + /** + * Cleans up the map entries. + * Uses an iterator to make sure that the entry is completely removed. + * + * @param onlyEmptyEntries If true only remove the entries with an empty list, otherwise remove all the entries. + */ + public static void cleanMap(boolean onlyEmptyEntries) { + Iterator, List>> mapIterator = REGISTRY_MAP.entrySet().iterator(); + while (mapIterator.hasNext()) { + if (!onlyEmptyEntries || mapIterator.next().getValue().isEmpty()) { + mapIterator.remove(); + } + } + } + + /** + * Sorts the List that matches the corresponding Event class based on priority value. + * + * @param indexClass The Event class index in the HashMap of the List to sort. + */ + private static void sortListValue(Class indexClass) { + List sortedList = new CopyOnWriteArrayList<>(); + for (final byte priority : Priority.VALUE_ARRAY) { + for (final MethodData data : REGISTRY_MAP.get(indexClass)) { + if (data.getPriority() == priority) { + sortedList.add(data); + } + } + } + //Overwriting the existing entry. + REGISTRY_MAP.put(indexClass, sortedList); + } + + /** + * Checks if the method does not meet the requirements to be used to receive event calls from the Dispatcher. + * Performed checks: Checks if the parameter length is not 1 and if the EventTarget annotation is not present. + * + * @param method Method to check. + * @return True if the method should not be used for receiving event calls from the Dispatcher. + * @see EventTarget + */ + private static boolean isMethodBad(Method method) { + return method.getParameterTypes().length != 1 || !method.isAnnotationPresent(EventTarget.class); + } + + /** + * Checks if the method does not meet the requirements to be used to receive event calls from the Dispatcher. + * Performed checks: Checks if the parameter class of the method is the same as the event we want to receive. + * + * @param method Method to check. + * @param eventClass of the Event we want to find a method for receiving it. + * @return True if the method should not be used for receiving event calls from the Dispatcher. + * @see EventTarget + */ + private static boolean isMethodBad(Method method, Class eventClass) { + return isMethodBad(method) || !method.getParameterTypes()[0].equals(eventClass); + } + + /** + * Call's an event and invokes the right methods that are listening to the event call. + * First get's the matching list from the registry map based on the class of the event. + * Then it checks if the list is not null. After that it will check if the event is an instance of + * EventStoppable and if so it will add an extra check when looping trough the data. + * If the Event was an instance of EventStoppable it will check every loop if the EventStoppable is stopped, and if + * it is it will break the loop, thus stopping the call. + * For every MethodData in the list it will invoke the Data's method with the Event as the argument. + * After that is all done it will return the Event. + * + * @param event Event to dispatch. + * @return Event in the state after dispatching it. + */ + public static Event call(final Event event) { + List dataList = REGISTRY_MAP.get(event.getClass()); + if (dataList != null) { + if (event instanceof EventStoppable) { + EventStoppable stoppable = (EventStoppable) event; + for (final MethodData data : dataList) { + invoke(data, event); + if (stoppable.isStopped()) { + break; + } + } + } else { + for (final MethodData data : dataList) { + invoke(data, event); + } + } + } + return event; + } + + /** + * Invokes a MethodData when an Event call is made. + * + * @param data The data of which the targeted Method should be invoked. + * @param argument The called Event which should be used as an argument for the targeted Method. + */ + private static void invoke(MethodData data, Event argument) { + try { + data.getTarget().invoke(data.getSource(), argument); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + e.printStackTrace(); + } + } + + /** + * @author DarkMagician6 + * @since January 2, 2014 + */ + private static final class MethodData { + private final Object source; + private final Method target; + private final byte priority; + + /** + * Sets the values of the data. + * + * @param source The source Object of the data. Used by the VM to + * determine to which object it should send the call to. + * @param target The targeted Method to which the Event should be send to. + * @param priority The priority of this Method. Used by the registry to sort + * the data on. + */ + public MethodData(Object source, Method target, byte priority) { + this.source = source; + this.target = target; + this.priority = priority; + } + + /** + * Gets the source Object of the data. + * + * @return Source Object of the targeted Method. + */ + public Object getSource() { + return source; + } + + /** + * Gets the targeted Method. + * + * @return The Method that is listening to certain Event calls. + */ + public Method getTarget() { + return target; + } + + /** + * Gets the priority value of the targeted Method. + * + * @return The priority value of the targeted Method. + */ + public byte getPriority() { + return priority; + } + } +} + + + +package myau.event.events.callables; + +import myau.event.events.Cancellable; +import myau.event.events.Event; + +/** + * Abstract example implementation of the Cancellable interface. + * + * @author DarkMagician6 + * @since August 27, 2013 + */ +public abstract class EventCancellable implements Event, Cancellable { + private boolean cancelled; + + protected EventCancellable() { + } + + /** + * @see Cancellable.isCancelled + */ + @Override + public boolean isCancelled() { + return cancelled; + } + + /** + * @see Cancellable.setCancelled + */ + @Override + public void setCancelled(boolean state) { + cancelled = state; + } +} + + + +package myau.event.events.callables; + +import myau.event.events.Event; +import myau.event.events.Typed; + +/** + * Abstract example implementation of the Typed interface. + * + * @author DarkMagician6 + * @since August 27, 2013 + */ +public abstract class EventTyped implements Event, Typed { + private final byte type; + + /** + * Sets the type of the event when it's called. + * + * @param eventType The type ID of the event. + */ + protected EventTyped(byte eventType) { + type = eventType; + } + + /** + * @see Typed.getType + */ + @Override + public byte getType() { + return type; + } +} + + + +package myau.event.events; + +/** + * Simple interface which should be implemented in events that can be cancelled. + * + * @author DarkMagician6 + * @since August 27, 2013 + */ +public interface Cancellable { + /** + * Gets the current cancelled state of the event. + * + * @return True if the event is cancelled. + */ + boolean isCancelled(); + + /** + * Sets the cancelled state of the event. + * + * @param state Whether the event should be cancelled or not. + */ + void setCancelled(boolean state); +} + + + +package myau.event.events; + +/** + * The most basic form of an event. + * You have to implement this interface in order for the EventAPI to recognize the event. + * + * @author DarkMagician6 + * @since July 30, 2013 + */ +public interface Event { +} + + + +package myau.event.events; + +/** + * The most basic form of an stoppable Event. + * Stoppable events are called seperate from other events and the calling of methods is stopped + * as soon as the EventStoppable is stopped. + * + * @author DarkMagician6 + * @since 26-9-13 + */ +public abstract class EventStoppable implements Event { + private boolean stopped; + + /** + * No need for the constructor to be public. + */ + protected EventStoppable() { + } + + /** + * Sets the stopped state to true. + */ + public void stop() { + stopped = true; + } + + /** + * Checks the stopped boolean. + * + * @return True if the EventStoppable is stopped. + */ + public boolean isStopped() { + return stopped; + } +} + + + +package myau.event.events; + +/** + * Simple interface that should be implemented in typed events. + * A typed event is an event that can be called on multiple places + * with the type defining where it was called. + *

+ * The type should be defined in the constructor when the new instance + * of the event is created. + * + * @author DarkMagician6 + * @since August 27, 2013 + */ +public interface Typed { + /** + * Gets the current type of the event. + * + * @return The type ID of the event. + */ + byte getType(); +} + + + +package myau.event; + +import myau.event.types.Priority; + +import java.lang.annotation.*; + +/** + * Marks a method so that the EventManager knows that it should be registered. + * The priority of the method is also set with this. + * + * @author DarkMagician6 + * @see Priority + * @since July 30, 2013 + */ +@Documented +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface EventTarget { + byte value() default Priority.MEDIUM; +} + + + +package myau.event.types; + +/** + * Types that can be used for typed events. + * + * @author DarkMagician6 + * @since August 27, 2013 + */ +public enum EventType { + PRE, ON, POST, SEND, RECEIVE +} + + + +package myau.event.types; + +/** + * The priority for the dispatcher to determine what method should be invoked first. + * Ram was talking about the memory usage of the way I store the data so I decided + * to just use bytes for the priority because they take up only 8 bits of memory + * per value compared to the 32 bits per value of an enum (Same as an integer). + * + * @author DarkMagician6 + * @since August 3, 2013 + */ +public final class Priority { + public static final byte + /** + * Highest priority, called first. + */ + HIGHEST = 0, + /** + * High priority, called after the highest priority. + */ + HIGH = 1, + /** + * Medium priority, called after the high priority. + */ + MEDIUM = 2, + /** + * Low priority, called after the medium priority. + */ + LOW = 3, + /** + * Lowest priority, called after all the other priorities. + */ + LOWEST = 4; + /** + * Array containing all the prioriy values. + */ + public static final byte[] VALUE_ARRAY; + + /** + * Sets up the VALUE_ARRAY the first time anything in this class is called. + */ + static { + VALUE_ARRAY = new byte[]{ + HIGHEST, + HIGH, + MEDIUM, + LOW, + LOWEST + }; + } +} + + + +package myau.events; + +import myau.event.events.Event; +import net.minecraft.entity.Entity; + +public class AttackEvent implements Event { + private final Entity target; + private boolean cancelled; + + public AttackEvent(Entity target) { + this.target = target; + this.cancelled = false; + } + + public Entity getTarget() { + return this.target; + } + + public boolean isCancelled() { + return this.cancelled; + } + + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } +} + + + +package myau.events; + +import myau.event.events.callables.EventCancellable; + +public class CancelUseEvent extends EventCancellable { +} + + + +package myau.events; + +import myau.event.events.callables.EventCancellable; + +public class HitBlockEvent extends EventCancellable { +} + + + +package myau.events; + +import myau.event.events.Event; + +public class KeyEvent implements Event { + private final int keyCode; + + public KeyEvent(int key) { + this.keyCode = key; + } + + public int getKey() { + return this.keyCode; + } +} + + + +package myau.events; + +import myau.event.events.callables.EventCancellable; + +public class KnockbackEvent extends EventCancellable { + private double x; + private double y; + private double z; + + public KnockbackEvent(double x, double y, double z) { + this.x = x; + this.y = y; + this.z = z; + } + + public double getX() { + return this.x; + } + + public void setX(double x) { + this.x = x; + this.setCancelled(true); + } + + public double getY() { + return this.y; + } + + public void setY(double y) { + this.y = y; + this.setCancelled(true); + } + + public double getZ() { + return this.z; + } + + public void setZ(double z) { + this.z = z; + this.setCancelled(true); + } +} + + + +package myau.events; + +import myau.event.events.callables.EventCancellable; + +public class LeftClickMouseEvent extends EventCancellable { +} + + + +package myau.events; + +import myau.event.events.Event; + +public class LivingUpdateEvent implements Event { +} + + + +package myau.events; + +import myau.event.events.Event; + +public class LoadWorldEvent implements Event { +} + + + +package myau.events; + +import myau.event.events.Event; + +public class MoveInputEvent implements Event { +} + + + +package myau.events; + +import myau.event.events.callables.EventCancellable; +import myau.event.types.EventType; +import net.minecraft.network.Packet; + +public class PacketEvent extends EventCancellable { + private final EventType type; + private final Packet packet; + + public PacketEvent(EventType type, Packet packet) { + this.type = type; + this.packet = packet; + } + + public EventType getType() { + return this.type; + } + + public Packet getPacket() { + return this.packet; + } +} + + + +package myau.events; + +import myau.event.events.Event; + +public class PickEvent implements Event { + private double range; + + public PickEvent(double double1) { + this.range = double1; + } + + public double getRange() { + return this.range; + } + + public void setRange(double double1) { + this.range = double1; + } +} + + + +package myau.events; + +import myau.event.events.Event; + +public class PlayerUpdateEvent implements Event { +} + + + +package myau.events; + +import myau.event.events.Event; + +public class RaytraceEvent implements Event { + private double range; + + public RaytraceEvent(double range) { + this.range = range; + } + + public double getRange() { + return this.range; + } + + public void setRange(double range) { + this.range = range; + } +} + + + +package myau.events; + +import myau.event.events.Event; + +public class Render2DEvent implements Event { + private final float partialTicks; + + public Render2DEvent(float float1) { + this.partialTicks = float1; + } + + public float getPartialTicks() { + return this.partialTicks; + } +} + + + +package myau.events; + +import myau.event.events.Event; + +public class Render3DEvent implements Event { + private final float partialTicks; + + public Render3DEvent(float partialTicks) { + this.partialTicks = partialTicks; + } + + public float getPartialTicks() { + return this.partialTicks; + } +} + + + +package myau.events; + +import myau.event.events.Event; +import myau.event.types.EventType; +import net.minecraft.entity.EntityLivingBase; + +public class RenderLivingEvent implements Event { + private final EventType type; + private final EntityLivingBase entity; + + public RenderLivingEvent(EventType type, EntityLivingBase entityLivingBase) { + this.type = type; + this.entity = entityLivingBase; + } + + public EventType getType() { + return this.type; + } + + public EntityLivingBase getEntity() { + return this.entity; + } +} + + + +package myau.events; + +import myau.event.events.Event; + +public class ResizeEvent implements Event { +} + + + +package myau.events; + +import myau.event.events.callables.EventCancellable; + +public class RightClickMouseEvent extends EventCancellable { +} + + + +package myau.events; + +import myau.event.events.Event; + +public class SafeWalkEvent implements Event { + private boolean safeWalk; + + public SafeWalkEvent(boolean safeWalk) { + this.safeWalk = safeWalk; + } + + public boolean isSafeWalk() { + return this.safeWalk; + } + + public void setSafeWalk(boolean safeWalk) { + this.safeWalk = safeWalk; + } +} + + + +package myau.events; + +import myau.event.events.Event; + +public class StrafeEvent implements Event { + private float strafe; + private float forward; + private float friction; + + public StrafeEvent(float strafe, float forward, float friction) { + this.strafe = strafe; + this.forward = forward; + this.friction = friction; + } + + public float getStrafe() { + return this.strafe; + } + + public float getForward() { + return this.forward; + } + + public float getFriction() { + return this.friction; + } + + public void setStrafe(float float1) { + this.strafe = float1; + } + + public void setForward(float float1) { + this.forward = float1; + } + + public void setFriction(float float1) { + this.friction = float1; + } +} + + + +package myau.events; + +import myau.event.events.callables.EventCancellable; + +public class SwapItemEvent extends EventCancellable { + private final int slot; + private final int offset; + + public SwapItemEvent(int slot, int offset) { + this.slot = slot; + this.offset = Math.min(Math.max(offset, -1), 1); + } + + public int setSlot(int integer) { + return this.slot >= 0 && this.slot <= 8 ? this.slot : Math.floorMod(integer - this.offset, 9); + } +} + + + +package myau.events; + +import myau.event.events.Event; +import myau.event.types.EventType; + +public class TickEvent implements Event { + private final EventType type; + + public TickEvent(EventType type) { + this.type = type; + } + + public EventType getType() { + return this.type; + } +} + + + +package myau.events; + +import myau.event.events.Event; +import myau.event.types.EventType; + +public class UpdateEvent implements Event { + private final EventType type; + private final float yaw; + private final float pitch; + private float newYaw; + private float newPitch; + private float prevYaw; + private int lastPriority = -1; + private int priority = -1; + private boolean rotated = false; + + public UpdateEvent(EventType type, float yaw, float pitch, float newYaw, float newPitch) { + this.type = type; + this.yaw = yaw; + this.pitch = pitch; + this.newYaw = newYaw; + this.newPitch = newPitch; + this.prevYaw = newYaw; + } + + public EventType getType() { + return this.type; + } + + public float getYaw() { + return this.yaw; + } + + public float getPitch() { + return this.pitch; + } + + public float getNewYaw() { + return this.newYaw; + } + + public float getNewPitch() { + return this.newPitch; + } + + public float getPreYaw() { + return this.prevYaw; + } + + public int isRotating() { + return this.priority; + } + + public boolean isRotated() { + return this.rotated; + } + + public void setRotation(float yaw, float pitch, int priority) { + if (this.type == EventType.PRE && this.lastPriority <= priority) { + this.newYaw = yaw; + this.newPitch = pitch; + this.lastPriority = priority; + this.rotated = true; + } + } + + public void setPervRotation(float yaw, int priority) { + if (this.type == EventType.PRE && this.priority < priority) { + this.prevYaw = yaw; + this.priority = priority; + this.rotated = true; + } + } +} + + + +package myau.events; + +import myau.event.events.callables.EventCancellable; + +public class WindowClickEvent extends EventCancellable { + private final int windowsId; + private final int slotId; + private final int mouseButtonClicked; + private final int mode; + + public WindowClickEvent(int windowsId, int slotId, int mouseButtonClicked, int mode) { + this.windowsId = windowsId; + this.slotId = slotId; + this.mouseButtonClicked = mouseButtonClicked; + this.mode = mode; + } +} + + + +package myau.init; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URISyntaxException; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.stream.Stream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +import org.spongepowered.asm.lib.tree.ClassNode; +import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; +import org.spongepowered.asm.mixin.extensibility.IMixinInfo; + +public class FMLLoadingPlugin implements IMixinConfigPlugin { + private static final List mixinPlugins = new ArrayList<>(); + private String mixinPackage; + private List mixins = null; + + public static List getMixinPlugins() { + return mixinPlugins; + } + + public void onLoad(String mixinPackage) { + this.mixinPackage = mixinPackage; + mixinPlugins.add(this); + } + + public URL getBaseUrlForClassUrl(URL classUrl) { + String string = classUrl.toString(); + if (classUrl.getProtocol().equals("jar")) { + try { + return new URL(string.substring(4).split("!")[0]); + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + } else if (string.endsWith(".class")) { + try { + return new URL(string.replace("\\", "/").replace(this.getClass().getCanonicalName().replace(".", "/") + ".class", "")); + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + } else { + return classUrl; + } + } + + public String getMixinPackage() { + return this.mixinPackage; + } + + public String getMixinBaseDir() { + return this.mixinPackage.replace(".", "/"); + } + + public void tryAddMixinClass(String className) { + String norm = (className.endsWith(".class") ? className.substring(0, className.length() - ".class".length()) : className).replace("\\", "/").replace("/", "."); + if (norm.startsWith(this.getMixinPackage() + ".") && !norm.endsWith(".")) { + this.mixins.add(norm.substring(this.getMixinPackage().length() + 1)); + } + } + + public List getMixins() { + if (this.mixins != null) { + return this.mixins; + } else { + this.mixins = new ArrayList<>(); + URL classUrl = this.getClass().getProtectionDomain().getCodeSource().getLocation(); + System.out.println("Found classes at " + classUrl); + Path file; + try { + file = Paths.get(this.getBaseUrlForClassUrl(classUrl).toURI()); + } catch (URISyntaxException e) { + throw new RuntimeException(e); + } + System.out.println("Base directory found at " + file); + if (Files.isDirectory(file)) { + this.walkDir(file); + } else { + this.walkJar(file); + } + System.out.println("Found mixins: " + this.mixins); + return this.mixins; + } + } + + private void walkDir(Path classRoot) { + System.out.println("Trying to find mixins from directory"); + try (Stream classes = Files.walk(classRoot.resolve(this.getMixinBaseDir()))) { + classes.map((it) -> classRoot.relativize(it).toString()).forEach(this::tryAddMixinClass); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private void walkJar(Path file) { + System.out.println("Trying to find mixins from jar file"); + try (ZipInputStream zis = new ZipInputStream(Files.newInputStream(file))) { + ZipEntry next; + while ((next = zis.getNextEntry()) != null) { + this.tryAddMixinClass(next.getName()); + zis.closeEntry(); + } + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { + } + + public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { + } + + public String getRefMapperConfig() { + return null; + } + + public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { + return true; + } + + public void acceptTargets(Set myTargets, Set otherTargets) { + } +} + + + +package myau.init; + +public class Initializer { + public Initializer() { + System.out.println("Meow!"); + } +} + + + +package myau.management; + +import myau.enums.BlinkModules; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.PacketEvent; +import myau.events.TickEvent; +import myau.util.PacketUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.network.Packet; +import net.minecraft.network.handshake.client.C00Handshake; +import net.minecraft.network.login.client.C00PacketLoginStart; +import net.minecraft.network.login.client.C01PacketEncryptionResponse; +import net.minecraft.network.play.client.C00PacketKeepAlive; +import net.minecraft.network.play.client.C01PacketChatMessage; +import net.minecraft.network.play.client.C03PacketPlayer; +import net.minecraft.network.play.client.C0FPacketConfirmTransaction; +import net.minecraft.network.status.client.C00PacketServerQuery; +import net.minecraft.network.status.client.C01PacketPing; + +import java.util.Deque; +import java.util.concurrent.ConcurrentLinkedDeque; + +public class BlinkManager { + public static Minecraft mc = Minecraft.getMinecraft(); + public BlinkModules blinkModule = BlinkModules.NONE; + public boolean blinking = false; + public Deque> blinkedPackets = new ConcurrentLinkedDeque<>(); + + public boolean offerPacket(Packet packet) { + if (this.blinkModule == BlinkModules.NONE || packet instanceof C00PacketKeepAlive || packet instanceof C01PacketChatMessage) { + return false; + } else if (this.blinkedPackets.isEmpty() && packet instanceof C0FPacketConfirmTransaction) { + return false; + } else { + this.blinkedPackets.offer(packet); + return true; + } + } + + public boolean setBlinkState(boolean state, BlinkModules module) { + if (module == BlinkModules.NONE) { + return false; + } + if (state) { + this.blinkModule = module; + this.blinking = true; + } else { + if(blinkModule != module){ + return false; + } + this.blinking = false; + if (Minecraft.getMinecraft().getNetHandler() != null && this.blinkedPackets.isEmpty()) { + return true; + } + for (Packet blinkedPacket : blinkedPackets) { + PacketUtil.sendPacketNoEvent(blinkedPacket); + } + this.blinkedPackets.clear(); + this.blinkModule = BlinkModules.NONE; + } + return true; + } + + public BlinkModules getBlinkingModule() { + return this.blinkModule; + } + + public long countMovement() { + return this.blinkedPackets.stream().filter(packet -> packet instanceof C03PacketPlayer).count(); + } + + public boolean isBlinking() { + return blinking; + } + + @EventTarget + public void onPacket(PacketEvent event) { + if (event.getPacket() instanceof C00Handshake + || event.getPacket() instanceof C00PacketLoginStart + || event.getPacket() instanceof C00PacketServerQuery + || event.getPacket() instanceof C01PacketPing + || event.getPacket() instanceof C01PacketEncryptionResponse) { + this.setBlinkState(false, this.blinkModule); + } + } + + @EventTarget + public void onTick(TickEvent event) { + if (event.getType() == EventType.POST) { + if (mc.thePlayer.isDead) { + this.setBlinkState(false, this.blinkModule); + } + } + } +} + + + +package myau.management; + +import myau.enums.DelayModules; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.PacketEvent; +import myau.events.TickEvent; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.network.Packet; +import net.minecraft.network.handshake.client.C00Handshake; +import net.minecraft.network.login.client.C00PacketLoginStart; +import net.minecraft.network.login.client.C01PacketEncryptionResponse; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.network.play.server.S00PacketKeepAlive; +import net.minecraft.network.play.server.S01PacketJoinGame; +import net.minecraft.network.play.server.S07PacketRespawn; +import net.minecraft.network.play.server.S19PacketEntityStatus; +import net.minecraft.network.status.client.C00PacketServerQuery; +import net.minecraft.network.status.client.C01PacketPing; + +import java.util.Deque; +import java.util.concurrent.ConcurrentLinkedDeque; + +public class DelayManager { + public static Minecraft mc = Minecraft.getMinecraft(); + public DelayModules delayModule = DelayModules.NONE; + public long delay = 0L; + public Deque> delayedPacket = new ConcurrentLinkedDeque<>(); + + public boolean shouldDelay(Packet packet) { + if (this.delayModule == DelayModules.NONE) { + return false; + } else if (packet instanceof S00PacketKeepAlive) { + return false; + } else if (!(packet instanceof S01PacketJoinGame) && !(packet instanceof S07PacketRespawn)) { + if (packet instanceof S19PacketEntityStatus) { + S19PacketEntityStatus s19 = (S19PacketEntityStatus) packet; + Entity entity = s19.getEntity(mc.theWorld); + if (entity != null && (!entity.equals(mc.thePlayer) || s19.getOpCode() != 2)) { + return false; + } + } + this.delayedPacket.offer(packet); + return true; + } else { + this.setDelayState(false, this.delayModule); + return false; + } + } + + public boolean setDelayState(boolean state, DelayModules delayModule) { + if (state) { + this.delay = 0; + this.delayModule = delayModule; + } else { + this.delayModule = DelayModules.NONE; + if (Minecraft.getMinecraft().getNetHandler() != null && this.delayedPacket.isEmpty()) { + return true; + } + while (true) { + Packet packet = this.delayedPacket.poll(); + if (packet == null) { + this.delayedPacket.clear(); + break; + } + packet.processPacket(Minecraft.getMinecraft().getNetHandler()); + } + } + return this.delayModule != DelayModules.NONE; + } + + public DelayModules getDelayModule() { + return this.delayModule; + } + + public void delay(DelayModules modules) { + this.delayModule = modules; + } + + public long getDelay() { + return this.delay; + } + + @EventTarget + public void onPacket(PacketEvent event) { + if (event.getPacket() instanceof C00Handshake + || event.getPacket() instanceof C00PacketLoginStart + || event.getPacket() instanceof C00PacketServerQuery + || event.getPacket() instanceof C01PacketPing + || event.getPacket() instanceof C01PacketEncryptionResponse) { + this.setDelayState(false, this.delayModule); + } + } + + @EventTarget + public void onTick(TickEvent event) { + if (event.getType() == EventType.POST) { + if (mc.thePlayer.isDead) { + this.setDelayState(false, this.delayModule); + } + if (this.delayModule != DelayModules.NONE) { + this.delay++; + } + } + } +} + + + +package myau.management; + +import myau.enums.FloatModules; +import myau.event.EventTarget; +import myau.events.PlayerUpdateEvent; +import net.minecraft.client.Minecraft; + +import java.util.LinkedHashMap; + +public class FloatManager { + private static final Minecraft mc = Minecraft.getMinecraft(); + private final LinkedHashMap activeMap; + private boolean floating; + + public FloatManager() { + this.activeMap = new LinkedHashMap<>(); + this.floating = false; + } + + public boolean isPredicted() { + return this.floating; + } + + public boolean isFalling() { + return mc.thePlayer.onGround && mc.thePlayer.posY - mc.thePlayer.lastTickPosY < 0.0 && mc.thePlayer.motionY < 0.0; + } + + public boolean hasActiveModule() { + return this.activeMap.containsValue(true); + } + + public void setFloatState(boolean state, FloatModules floatModules) { + this.activeMap.put(floatModules, state); + } + + @EventTarget + public void onPlayerUpdate(PlayerUpdateEvent event) { + if ((this.hasActiveModule() || this.isPredicted()) && this.isFalling()) { + mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 0.001, mc.thePlayer.posZ); + this.floating = true; + } else { + this.floating = false; + } + } +} + + + +package myau.management; + +import myau.enums.ChatColors; + +import java.awt.*; +import java.io.File; + +public class FriendManager extends PlayerFileManager { + public FriendManager() { + super(new File("./config/Myau/", "friends.txt"), new Color(ChatColors.DARK_GREEN.toAwtColor())); + } +} + + + +package myau.management; + +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.PacketEvent; +import myau.events.TickEvent; +import myau.util.PacketUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.network.Packet; +import net.minecraft.network.handshake.client.C00Handshake; +import net.minecraft.network.login.client.C00PacketLoginStart; +import net.minecraft.network.login.client.C01PacketEncryptionResponse; +import net.minecraft.network.play.client.C00PacketKeepAlive; +import net.minecraft.network.play.client.C01PacketChatMessage; +import net.minecraft.network.play.client.C03PacketPlayer; +import net.minecraft.network.status.client.C00PacketServerQuery; +import net.minecraft.network.status.client.C01PacketPing; +import net.minecraft.util.Vec3; + +import java.util.Deque; +import java.util.concurrent.ConcurrentLinkedDeque; + +public class LagManager { + private static final Minecraft mc = Minecraft.getMinecraft(); + public final Deque packetQueue; + private int tickDelay; + private boolean flushing; + private Vec3 lastPosition; + + public LagManager() { + this.packetQueue = new ConcurrentLinkedDeque<>(); + this.tickDelay = 0; + this.flushing = false; + this.lastPosition = new Vec3(0.0, 0.0, 0.0); + } + + private void flushQueue() { + if (mc.getNetHandler() == null) { + this.packetQueue.clear(); + } else { + for (this.flushing = true; !this.packetQueue.isEmpty(); this.packetQueue.poll()) { + LagPacket lagPacket = this.packetQueue.peek(); + if (this.tickDelay > 0 && lagPacket.delay <= this.tickDelay) { + break; + } + PacketUtil.sendPacketNoEvent(lagPacket.packet); + if (lagPacket.packet instanceof C03PacketPlayer) { + C03PacketPlayer c03 = (C03PacketPlayer) lagPacket.packet; + if (c03.isMoving()) { + this.lastPosition = new Vec3(c03.getPositionX(), c03.getPositionY(), c03.getPositionZ()); + } + } + } + this.flushing = false; + } + } + + private void incrementDelays() { + this.packetQueue.forEach(z -> z.delay++); + } + + public boolean handlePacket(Packet packet) { + this.flushQueue(); + if (packet instanceof C00PacketKeepAlive || packet instanceof C01PacketChatMessage) { + return false; + } else if ((long) this.tickDelay > 0L) { + this.packetQueue.offer(new LagPacket(packet)); + return true; + } else { + if (packet instanceof C03PacketPlayer) { + C03PacketPlayer c03 = (C03PacketPlayer) packet; + if (c03.isMoving()) { + this.lastPosition = new Vec3(c03.getPositionX(), c03.getPositionY(), c03.getPositionZ()); + } + } + return false; + } + } + + public void setDelay(int delay) { + this.tickDelay = delay; + } + + public Vec3 getLastPosition() { + return this.lastPosition; + } + + public boolean isFlushing() { + return this.flushing; + } + + @EventTarget + public void onTick(TickEvent event) { + if (event.getType() == EventType.POST) { + if (mc.thePlayer.isDead) { + this.setDelay(0); + } + this.incrementDelays(); + this.flushQueue(); + } + } + + @EventTarget + public void onPacket(PacketEvent event) { + if (event.getPacket() instanceof C00Handshake + || event.getPacket() instanceof C00PacketLoginStart + || event.getPacket() instanceof C00PacketServerQuery + || event.getPacket() instanceof C01PacketPing + || event.getPacket() instanceof C01PacketEncryptionResponse) { + this.setDelay(0); + } + } + + public static class LagPacket { + public final Packet packet; + public int delay; + + public LagPacket(Packet packet) { + this.packet = packet; + this.delay = 0; + } + } +} + + + +package myau.management; + +import net.minecraft.client.Minecraft; + +import java.awt.*; +import java.io.*; +import java.util.ArrayList; +import java.util.stream.Collectors; + +public abstract class PlayerFileManager { + public static Minecraft mc = Minecraft.getMinecraft(); + public ArrayList players; + public File file; + public Color color; + + public PlayerFileManager(File file, Color color) { + this.players = new ArrayList<>(); + this.file = file; + this.color = color; + } + + public void load() { + if (!file.exists()) { + try { + if ((file.getParentFile().exists() || file.getParentFile().mkdirs()) && file.createNewFile()) { + System.out.printf("File created: %s%n", file.getName()); + } + } catch (IOException e) { + System.err.println("Error creating file: " + e.getMessage()); + } + } + try (BufferedReader reader = new BufferedReader(new FileReader(file))) { + players.clear(); + players.addAll(reader.lines().map(String::trim).collect(Collectors.toList())); + } catch (IOException e) { + System.err.println("Error reading file: " + e.getMessage()); + } + } + + public void save() { + try (PrintWriter writer = new PrintWriter(new FileWriter(file))) { + writer.print(String.join("\n", players)); + } catch (IOException e) { + System.err.println("Error saving file: " + e.getMessage()); + } + } + + public String add(String name) { + if (isFriend(name)) { + return null; + } + players.add(name); + save(); + return name; + } + + public String remove(String name) { + for (String player : players) { + if (player.equalsIgnoreCase(name)) { + players.remove(player); + save(); + return player; + } + } + return null; + } + + public void clear() { + players.clear(); + save(); + } + + public boolean isFriend(String string) { + return this.players.stream().anyMatch(string2 -> string2.equalsIgnoreCase(string)); + } + + public ArrayList getPlayers() { + return this.players; + } + + public Color getColor() { + return this.color; + } +} + + + +package myau.management; + +import net.minecraft.network.Packet; +import net.minecraft.network.play.client.*; + +public class PlayerStateManager { + public boolean attacking = false; + public boolean digging = false; + public boolean placing = false; + public boolean swapping = false; + public boolean swinging = false; + + public void handlePacket(Packet packet) { + if (packet instanceof C02PacketUseEntity) { + this.attacking = true; + } + if (packet instanceof C07PacketPlayerDigging) { + this.digging = true; + } + if (packet instanceof C08PacketPlayerBlockPlacement) { + this.placing = true; + } + if (packet instanceof C09PacketHeldItemChange) { + this.swapping = true; + } + if (packet instanceof C0APacketAnimation) { + this.swinging = true; + } + if (packet instanceof C03PacketPlayer) { + this.attacking = false; + this.digging = false; + this.placing = false; + this.swapping = false; + this.swinging = false; + } + } +} + + + +package myau.management; + +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.event.types.Priority; +import myau.events.Render3DEvent; +import myau.events.TickEvent; +import net.minecraft.client.Minecraft; +import net.minecraft.util.MathHelper; + +public class RotationManager { + private static final Minecraft mc = Minecraft.getMinecraft(); + private float lastUpdate; + private float yawDelta; + private float pitchDelta; + private int priority; + private boolean rotated; + + public RotationManager() { + this.lastUpdate = Float.NaN; + this.yawDelta = Float.NaN; + this.pitchDelta = Float.NaN; + this.priority = Integer.MIN_VALUE; + this.rotated = false; + } + + private void applyRotation(float partialTicks) { + if (mc.thePlayer != null && !Float.isNaN(this.yawDelta) && !Float.isNaN(this.pitchDelta) && !Float.isNaN(this.lastUpdate)) { + float yaw = this.yawDelta * (partialTicks - this.lastUpdate); + if (yaw != 0.0F) { + mc.thePlayer.prevRotationYaw = mc.thePlayer.rotationYaw; + mc.thePlayer.rotationYaw += yaw; + } + float pitch = this.pitchDelta * (partialTicks - this.lastUpdate); + if (pitch != 0.0F) { + mc.thePlayer.prevRotationPitch = mc.thePlayer.rotationPitch; + mc.thePlayer.rotationPitch += pitch; + mc.thePlayer.rotationPitch = MathHelper.clamp_float(mc.thePlayer.rotationPitch, -90.0F, 90.0F); + } + this.lastUpdate = partialTicks; + } + } + + private void resetRotationState() { + this.lastUpdate = Float.NaN; + this.yawDelta = Float.NaN; + this.pitchDelta = Float.NaN; + this.priority = Integer.MIN_VALUE; + this.rotated = false; + } + + public void setRotation(float yaw, float pitch, int priority, boolean force) { + if (this.priority <= priority) { + this.priority = priority; + this.yawDelta = MathHelper.wrapAngleTo180_float(yaw - mc.thePlayer.rotationYaw); + this.pitchDelta = MathHelper.clamp_float(pitch - mc.thePlayer.rotationPitch, -90.0F, 90.0F); + this.lastUpdate = 0.0F; + this.rotated = force; + this.applyRotation(0.0F); + } + } + + public boolean isRotated() { + return this.rotated; + } + + @EventTarget(Priority.HIGHEST) + public void onTick(TickEvent event) { + if (event.getType() != EventType.PRE) { + return; + } + this.applyRotation(1.0F); + this.resetRotationState(); + } + + @EventTarget(Priority.HIGHEST) + public void onRender3D(Render3DEvent event) { + this.applyRotation(event.getPartialTicks()); + } +} + + + +package myau.management; + +import net.minecraft.client.Minecraft; +import net.minecraft.util.MathHelper; + +public class RotationState { + private static final Minecraft mc = Minecraft.getMinecraft(); + private static int state = -1; + private static float prevRenderYawOffset; + private static float renderYawOffset; + private static float prevRotationYawHead; + private static float rotationYawHead; + private static float prevRotationPitch; + private static float rotationPitch; + private static float smoothYaw; + private static int priority; + + private static float calculateRenderYawOffset(float targetYaw, float currentYawOffset) { + float newYawOffset = currentYawOffset; + double deltaX = RotationState.mc.thePlayer.posX - RotationState.mc.thePlayer.prevPosX; + double deltaZ = RotationState.mc.thePlayer.posZ - RotationState.mc.thePlayer.prevPosZ; + if ((float) (deltaX * deltaX + deltaZ * deltaZ) > 0.0025000002f) { + newYawOffset = (float) MathHelper.atan2(deltaZ, deltaX) * 180.0f / (float) Math.PI - 90.0f; + } + if (RotationState.mc.thePlayer.swingProgress > 0.0f) { + newYawOffset = targetYaw; + } + float f4 = MathHelper.wrapAngleTo180_float(newYawOffset - currentYawOffset); + float f5 = MathHelper.wrapAngleTo180_float(targetYaw - (currentYawOffset += f4 * 0.3f)); + if (f5 < -75.0f) { + f5 = -75.0f; + } + if (f5 >= 75.0f) { + f5 = 75.0f; + } + newYawOffset = targetYaw - f5; + if (f5 * f5 > 2500.0f) { + newYawOffset += f5 * 0.2f; + } + return newYawOffset; + } + + public static void applyState(boolean bl, float f, float f2, float f3, int n) { + state = bl ? 0 : state + 1; + prevRenderYawOffset = renderYawOffset; + renderYawOffset = bl ? RotationState.calculateRenderYawOffset(f, renderYawOffset) : RotationState.mc.thePlayer.renderYawOffset; + prevRotationYawHead = rotationYawHead; + rotationYawHead = bl ? f : RotationState.mc.thePlayer.rotationYawHead; + prevRotationPitch = rotationPitch; + rotationPitch = bl ? f2 : RotationState.mc.thePlayer.rotationPitch; + smoothYaw = f3; + priority = n; + } + + public static boolean isActived() { + return RotationState.isRotated(0); + } + + public static boolean isRotated(int state) { + if (RotationState.state < 0) return false; + return RotationState.state <= state; + } + + public static float getPrevRenderYawOffset() { + return prevRenderYawOffset; + } + + public static float getRenderYawOffset() { + return renderYawOffset; + } + + public static float getPrevRotationYawHead() { + return prevRotationYawHead; + } + + public static float getRotationYawHead() { + return rotationYawHead; + } + + public static float getPrevRotationPitch() { + return prevRotationPitch; + } + + public static float getRotationPitch() { + return rotationPitch; + } + + public static float getSmoothedYaw() { + return smoothYaw; + } + + public static float getPriority() { + return priority; + } +} + + + +package myau.management; + +import myau.enums.ChatColors; + +import java.awt.*; +import java.io.File; + +public class TargetManager extends PlayerFileManager { + public TargetManager() { + super(new File("./config/Myau/", "enemies.txt"), new Color(ChatColors.DARK_RED.toAwtColor())); + } +} + + + +package myau.mixin; + +import net.minecraft.network.play.client.C03PacketPlayer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@SideOnly(Side.CLIENT) +@Mixin({C03PacketPlayer.class}) +public interface IAccessorC03PacketPlayer { + @Accessor("onGround") + void setOnGround(boolean boolean1); +} + + + +package myau.mixin; + +import net.minecraft.network.play.client.C0DPacketCloseWindow; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@SideOnly(Side.CLIENT) +@Mixin({C0DPacketCloseWindow.class}) +public interface IAccessorC0DPacketCloseWindow { + @Accessor + int getWindowId(); +} + + + +package myau.mixin; + +import net.minecraft.entity.Entity; +import net.minecraft.util.Vec3; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; +import org.spongepowered.asm.mixin.gen.Invoker; + +@SideOnly(Side.CLIENT) +@Mixin({Entity.class}) +public interface IAccessorEntity { + @Accessor + boolean getIsInWeb(); + + @Invoker + Vec3 callGetVectorForRotation(float float1, float float2); +} + + + +package myau.mixin; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.potion.PotionEffect; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +import java.util.Map; + +@SideOnly(Side.CLIENT) +@Mixin({EntityLivingBase.class}) +public interface IAccessorEntityLivingBase { + @Accessor + Map getActivePotionsMap(); + + @Accessor + AttributeModifier getSprintingSpeedBoostModifier(); + + @Accessor + int getJumpTicks(); + + @Accessor + void setJumpTicks(int integer); +} + + + +package myau.mixin; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@SideOnly(Side.CLIENT) +@Mixin({EntityPlayer.class}) +public interface IAccessorEntityPlayer { + @Accessor + ItemStack getItemInUse(); + + @Accessor + void setItemInUse(ItemStack itemStack); + + @Accessor + int getItemInUseCount(); + + @Accessor + void setItemInUseCount(int integer); +} + + + +package myau.mixin; + +import net.minecraft.client.renderer.EntityRenderer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Invoker; + +@SideOnly(Side.CLIENT) +@Mixin({EntityRenderer.class}) +public interface IAccessorEntityRenderer { + @Invoker + void callSetupCameraTransform(float float1, int integer); +} + + + +package myau.mixin; + +import net.minecraft.client.gui.GuiChat; +import net.minecraft.client.gui.GuiTextField; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@SideOnly(Side.CLIENT) +@Mixin({GuiChat.class}) +public interface IAccessorGuiChat { + @Accessor + GuiTextField getInputField(); +} + + + +package myau.mixin; + +import net.minecraft.client.gui.GuiScreen; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Invoker; + +@SideOnly(Side.CLIENT) +@Mixin(GuiScreen.class) +public interface IAccessorGuiScreen { + @Invoker("mouseClicked") + void callMouseClicked(int mouseX, int mouseY, int mouseButton); +} + + + +package myau.mixin; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemSword; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@SideOnly(Side.CLIENT) +@Mixin({ItemSword.class}) +public interface IAccessorItemSword { + @Accessor + Item.ToolMaterial getMaterial(); +} + + + +package myau.mixin; + +import net.minecraft.client.settings.KeyBinding; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(KeyBinding.class) +public interface IAccessorKeyBinding { + @Accessor("pressed") + void setPressed(boolean boolean1); +} + + + +package myau.mixin; + +import net.minecraft.client.Minecraft; +import net.minecraft.util.Timer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.apache.logging.log4j.Logger; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@SideOnly(Side.CLIENT) +@Mixin({Minecraft.class}) +public interface IAccessorMinecraft { + @Accessor + Logger getLogger(); + + @Accessor("timer") + Timer getTimer(); + + @Accessor("rightClickDelayTimer") + int getRightClickDelayTimer(); + + @Accessor("rightClickDelayTimer") + void setRightClickDelayTimer(int integer); +} + + + +package myau.mixin; + +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; +import org.spongepowered.asm.mixin.gen.Invoker; + +@SideOnly(Side.CLIENT) +@Mixin({PlayerControllerMP.class}) +public interface IAccessorPlayerControllerMP { + @Accessor + float getCurBlockDamageMP(); + + @Accessor + void setCurBlockDamageMP(float float1); + + @Accessor + int getBlockHitDelay(); + + @Accessor + void setBlockHitDelay(int integer); + + @Accessor + boolean getIsHittingBlock(); + + @Accessor + int getCurrentPlayerItem(); + + @Accessor + void setCurrentPlayerItem(int integer); + + @Invoker + void callSyncCurrentPlayItem(); +} + + + +package myau.mixin; + +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@SideOnly(Side.CLIENT) +@Mixin({RenderManager.class}) +public interface IAccessorRenderManager { + @Accessor + double getRenderPosX(); + + @Accessor + double getRenderPosY(); + + @Accessor + double getRenderPosZ(); +} + + + +package myau.mixin; + +import myau.Myau; +import myau.module.modules.Sprint; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.Entity; +import net.minecraft.entity.ai.attributes.IAttributeInstance; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@SideOnly(Side.CLIENT) +@Mixin(value = {AbstractClientPlayer.class}, priority = 9999) +public abstract class MixinAbstractClientPlayer extends MixinEntityPlayer { + @Redirect( + method = {"getFovModifier"}, + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/entity/ai/attributes/IAttributeInstance;getAttributeValue()D" + ) + ) + private double getFovModifier(IAttributeInstance iAttributeInstance) { + double attributeValue = iAttributeInstance.getAttributeValue(); + if ((((Entity) (Object) this)) instanceof EntityPlayerSP && Myau.moduleManager != null) { + Sprint sprint = (Sprint) Myau.moduleManager.modules.get(Sprint.class); + return sprint.isEnabled() && sprint.shouldApplyFovFix(iAttributeInstance) ? attributeValue * 1.300000011920929 : attributeValue; + } else { + return attributeValue; + } + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.module.modules.Xray; +import net.minecraft.block.Block; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.world.IBlockAccess; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@SideOnly(Side.CLIENT) +@Mixin(value = {Block.class}, priority = 9999) +public abstract class MixinBlock { + @Inject( + method = {"shouldSideBeRendered"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void shouldSideBeRendered( + IBlockAccess iBlockAccess, BlockPos blockPos, EnumFacing enumFacing, CallbackInfoReturnable callbackInfoReturnable + ) { + if (Myau.moduleManager != null) { + Xray xray = (Xray) Myau.moduleManager.modules.get(Xray.class); + if (xray.isEnabled() && xray.mode.getValue() == 1 && xray.shouldRenderSide(Block.getIdFromBlock((Block) ((Object) this)))) { + BlockPos block = new BlockPos( + blockPos.getX() - enumFacing.getDirectionVec().getX(), + blockPos.getY() - enumFacing.getDirectionVec().getY(), + blockPos.getZ() - enumFacing.getDirectionVec().getZ() + ); + if (xray.checkBlock(block)) { + callbackInfoReturnable.setReturnValue(true); + } + } + } + } + + @Inject( + method = {"getBlockLayer"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void getBlockLayer(CallbackInfoReturnable callbackInfoReturnable) { + if (Myau.moduleManager != null) { + Xray xray = (Xray) Myau.moduleManager.modules.get(Xray.class); + if (xray.isEnabled()) { + int id = Block.getIdFromBlock((Block) ((Object) this)); + if (!xray.shouldRenderSide(id) || xray.mode.getValue() == 0 && !xray.isXrayBlock(id)) { + callbackInfoReturnable.setReturnValue(EnumWorldBlockLayer.TRANSLUCENT); + } + } + } + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.module.modules.Xray; +import net.minecraft.block.BlockBush; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@SideOnly(Side.CLIENT) +@Mixin(value = {BlockBush.class}, priority = 9999) +public abstract class MixinBlockBush { + @Inject( + method = {"getBlockLayer"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void getBlockLayer(CallbackInfoReturnable callbackInfoReturnable) { + if (Myau.moduleManager != null) { + if (Myau.moduleManager.modules.get(Xray.class).isEnabled()) { + callbackInfoReturnable.setReturnValue(EnumWorldBlockLayer.TRANSLUCENT); + } + } + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.module.modules.Xray; +import net.minecraft.block.BlockGrass; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@SideOnly(Side.CLIENT) +@Mixin(value = {BlockGrass.class}, priority = 9999) +public abstract class MixinBlockGrass { + @Inject( + method = {"getBlockLayer"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void getBlockLayer(CallbackInfoReturnable callbackInfoReturnable) { + if (Myau.moduleManager != null) { + if (Myau.moduleManager.modules.get(Xray.class).isEnabled()) { + callbackInfoReturnable.setReturnValue(EnumWorldBlockLayer.TRANSLUCENT); + } + } + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.module.modules.Xray; +import net.minecraft.block.BlockLadder; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@SideOnly(Side.CLIENT) +@Mixin(value = {BlockLadder.class}, priority = 9999) +public abstract class MixinBlockLadder { + @Inject( + method = {"getBlockLayer"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void getBlockLayer(CallbackInfoReturnable callbackInfoReturnable) { + if (Myau.moduleManager != null) { + if (Myau.moduleManager.modules.get(Xray.class).isEnabled()) { + callbackInfoReturnable.setReturnValue(EnumWorldBlockLayer.TRANSLUCENT); + } + } + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.module.modules.Xray; +import net.minecraft.block.BlockLeaves; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@SideOnly(Side.CLIENT) +@Mixin(value = {BlockLeaves.class}, priority = 9999) +public abstract class MixinBlockLeaves { + @Inject( + method = {"getBlockLayer"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void getBlockLayer(CallbackInfoReturnable callbackInfoReturnable) { + if (Myau.moduleManager != null) { + if (Myau.moduleManager.modules.get(Xray.class).isEnabled()) { + callbackInfoReturnable.setReturnValue(EnumWorldBlockLayer.TRANSLUCENT); + } + } + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.module.modules.Xray; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.BlockModelRenderer; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.util.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +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.callback.CallbackInfoReturnable; + +@SideOnly(Side.CLIENT) +@Mixin(value = {BlockModelRenderer.class}, priority = 9999) +public abstract class MixinBlockModelRenderer { + @Shadow + public boolean renderModelAmbientOcclusion( + IBlockAccess iBlockAccess, IBakedModel iBakedModel, Block block, BlockPos blockPos, WorldRenderer worldRenderer, boolean boolean6 + ) { + return false; + } + + @Inject( + method = {"renderModel(Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/client/resources/model/IBakedModel;Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/BlockPos;Lnet/minecraft/client/renderer/WorldRenderer;Z)Z"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void renderModel( + IBlockAccess iBlockAccess, + IBakedModel iBakedModel, + IBlockState iBlockState, + BlockPos blockPos, + WorldRenderer worldRenderer, + boolean boolean6, + CallbackInfoReturnable callbackInfoReturnable + ) { + if (Myau.moduleManager != null) { + if (Myau.moduleManager.modules.get(Xray.class).isEnabled()) { + callbackInfoReturnable.setReturnValue( + this.renderModelAmbientOcclusion(iBlockAccess, iBakedModel, iBlockState.getBlock(), blockPos, worldRenderer, boolean6) + ); + } + } + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.module.modules.Xray; +import net.minecraft.block.BlockPane; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@SideOnly(Side.CLIENT) +@Mixin(value = {BlockPane.class}, priority = 9999) +public abstract class MixinBlockPane { + @Inject( + method = {"getBlockLayer"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void getBlockLayer(CallbackInfoReturnable callbackInfoReturnable) { + if (Myau.moduleManager != null) { + if (Myau.moduleManager.modules.get(Xray.class).isEnabled()) { + callbackInfoReturnable.setReturnValue(EnumWorldBlockLayer.TRANSLUCENT); + } + } + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.module.modules.BedESP; +import myau.module.modules.Xray; +import net.minecraft.block.Block; +import net.minecraft.block.BlockBed; +import net.minecraft.block.BlockBed.EnumPartType; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.util.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@SideOnly(Side.CLIENT) +@Mixin(value = {BlockRendererDispatcher.class}, priority = 9999) +public abstract class MixinBlockRendererDispatcher { + @Inject( + method = {"renderBlock"}, + at = {@At("HEAD")} + ) + private void renderBlock( + IBlockState iBlockState, + BlockPos blockPos, + IBlockAccess iBlockAccess, + WorldRenderer worldRenderer, + CallbackInfoReturnable callbackInfoReturnable + ) { + if (Myau.moduleManager != null) { + BedESP bedESP = (BedESP) Myau.moduleManager.modules.get(BedESP.class); + if (bedESP.isEnabled() && iBlockState.getBlock() instanceof BlockBed && iBlockState.getValue(BlockBed.PART) == EnumPartType.HEAD) { + bedESP.beds.add(new BlockPos(blockPos)); + } + Xray Xray = (Xray) Myau.moduleManager.modules.get(Xray.class); + if (Xray.isEnabled() && Xray.isXrayBlock(Block.getIdFromBlock(iBlockState.getBlock()))) { + if (Xray.checkBlock(blockPos)) { + Xray.trackedBlocks.add(new BlockPos(blockPos)); + } else { + Xray.trackedBlocks.remove(blockPos); + } + } + } + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.module.modules.Xray; +import net.minecraft.block.BlockWeb; +import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@SideOnly(Side.CLIENT) +@Mixin(value = {BlockWeb.class}, priority = 9999) +public abstract class MixinBlockWeb { + @Inject( + method = {"getBlockLayer"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void getBlockLayer(CallbackInfoReturnable callbackInfoReturnable) { + if (Myau.moduleManager != null) { + if (Myau.moduleManager.modules.get(Xray.class).isEnabled()) { + callbackInfoReturnable.setReturnValue(EnumWorldBlockLayer.TRANSLUCENT); + } + } + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.event.EventManager; +import myau.events.KnockbackEvent; +import myau.events.SafeWalkEvent; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.Entity; +import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +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.ModifyVariable; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@SideOnly(Side.CLIENT) +@Mixin(value = {Entity.class}, priority = 9999) +public abstract class MixinEntity { + @Shadow + public World worldObj; + @Shadow + public double posX; + @Shadow + public double posY; + @Shadow + public double posZ; + @Shadow + public double motionX; + @Shadow + public double motionY; + @Shadow + public double motionZ; + @Shadow + public float rotationYaw; + @Shadow + public float rotationPitch; + @Shadow + public float prevRotationYaw; + @Shadow + public float prevRotationPitch; + @Shadow + public boolean onGround; + + @Shadow + public boolean isRiding() { + return false; + } + + @Inject( + method = {"setVelocity"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void setVelocity(double double1, double double2, double double3, CallbackInfo callbackInfo) { + if ((Entity) ((Object) this) instanceof EntityPlayerSP) { + KnockbackEvent event = new KnockbackEvent(double1, double2, double3); + EventManager.call(event); + if (event.isCancelled()) { + callbackInfo.cancel(); + this.motionX = event.getX(); + this.motionY = event.getY(); + this.motionZ = event.getZ(); + } + } + } + + @Inject( + method = {"setAngles"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void setAngles(CallbackInfo callbackInfo) { + if ((Entity) ((Object) this) instanceof EntityPlayerSP && Myau.rotationManager != null && Myau.rotationManager.isRotated()) { + callbackInfo.cancel(); + } + } + + @ModifyVariable( + method = {"moveEntity"}, + ordinal = 0, + at = @At("STORE"), + name = {"flag"} + ) + private boolean moveEntity(boolean boolean1) { + if ((Entity) ((Object) this) instanceof EntityPlayerSP) { + SafeWalkEvent event = new SafeWalkEvent(boolean1); + EventManager.call(event); + return event.isSafeWalk(); + } else { + return boolean1; + } + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.event.EventManager; +import myau.events.StrafeEvent; +import myau.management.RotationState; +import myau.module.modules.Jesus; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyVariable; +import org.spongepowered.asm.mixin.injection.Redirect; + +@SideOnly(Side.CLIENT) +@Mixin(value = {EntityLivingBase.class}, priority = 9999) +public abstract class MixinEntityLivingBase extends MixinEntity { + @ModifyVariable( + method = {"jump"}, + at = @At("STORE"), + ordinal = 0 + ) + private float jump(float float1) { + return (Entity) ((Object) this) instanceof EntityPlayerSP && RotationState.isActived() + ? RotationState.getSmoothedYaw() * (float) (Math.PI / 180.0) + : float1; + } + + @Redirect( + method = {"moveEntityWithHeading"}, + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/entity/EntityLivingBase;moveFlying(FFF)V" + ) + ) + private void moveEntityWithHeading(EntityLivingBase entityLivingBase, float float2, float float3, float float4) { + if ((Entity) ((Object) this) instanceof EntityPlayerSP) { + StrafeEvent event = new StrafeEvent(float2, float3, float4); + EventManager.call(event); + float2 = event.getStrafe(); + float3 = event.getForward(); + float4 = event.getFriction(); + boolean actived = RotationState.isActived(); + float yaw = this.rotationYaw; + if (actived) { + this.rotationYaw = RotationState.getSmoothedYaw(); + } + entityLivingBase.moveFlying(float2, float3, float4); + if (actived) { + this.rotationYaw = yaw; + } + } else { + entityLivingBase.moveFlying(float2, float3, float4); + } + } + + @ModifyVariable( + method = {"moveEntityWithHeading"}, + name = {"f3"}, + at = @At("STORE") + ) + private float moveEntityWithHeading(float float1) { + if ((EntityLivingBase) ((Object) this) instanceof EntityPlayerSP && float1 == (float) EnchantmentHelper.getDepthStriderModifier((EntityLivingBase) ((Object) this))) { + if (Myau.moduleManager == null) { + return float1; + } + Jesus jesus = (Jesus) Myau.moduleManager.modules.get(Jesus.class); + if (jesus.isEnabled() && (!jesus.groundOnly.getValue() || this.onGround)) { + return Math.max(float1, jesus.speed.getValue()); + } + } + return float1; + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.module.modules.KeepSprint; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Constant; +import org.spongepowered.asm.mixin.injection.ModifyConstant; +import org.spongepowered.asm.mixin.injection.Redirect; + +@SideOnly(Side.CLIENT) +@Mixin(value = {EntityPlayer.class}, priority = 9999) +public abstract class MixinEntityPlayer extends MixinEntityLivingBase { + @ModifyConstant( + method = {"attackTargetEntityWithCurrentItem"}, + constant = {@Constant( + doubleValue = 0.6 + )} + ) + private double attackTargetEntityWithCurrentItem(double speed) { + if (Myau.moduleManager == null) { + return speed; + } else { + KeepSprint keepSprint = (KeepSprint) Myau.moduleManager.modules.get(KeepSprint.class); + return keepSprint.isEnabled() && keepSprint.shouldKeepSprint() + ? speed + (1.0 - speed) * (1.0 - keepSprint.slowdown.getValue().doubleValue() / 100.0) + : speed; + } + } + + @Redirect( + method = {"attackTargetEntityWithCurrentItem"}, + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/entity/player/EntityPlayer;setSprinting(Z)V" + ) + ) + private void setSprinnt(EntityPlayer entityPlayer, boolean boolean2) { + if (Myau.moduleManager != null) { + KeepSprint keepSprint = (KeepSprint) Myau.moduleManager.modules.get(KeepSprint.class); + if (!keepSprint.isEnabled() || !keepSprint.shouldKeepSprint()) { + entityPlayer.setSprinting(boolean2); + } + } + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.event.EventManager; +import myau.event.types.EventType; +import myau.events.LivingUpdateEvent; +import myau.events.MoveInputEvent; +import myau.events.PlayerUpdateEvent; +import myau.events.UpdateEvent; +import myau.management.RotationState; +import myau.module.modules.AntiDebuff; +import myau.module.modules.NoSlow; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.potion.Potion; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@SideOnly(Side.CLIENT) +@Mixin(value = {EntityPlayerSP.class}, priority = 9999) +public abstract class MixinEntityPlayerSP extends MixinEntityPlayer { + @Unique + private float overrideYaw = Float.NaN; + @Unique + private float overridePitch = Float.NaN; + @Unique + private float pendingYaw; + @Unique + private float pendingPitch; + @Shadow + private float lastReportedYaw; + @Shadow + private float lastReportedPitch; + @Shadow + public float renderArmYaw; + @Shadow + public float prevRenderArmYaw; + + @Inject( + method = {"onUpdate"}, + at = {@At("HEAD")} + ) + private void onUpdate(CallbackInfo callbackInfo) { + if (this.worldObj.isBlockLoaded(new BlockPos(this.posX, 0.0, this.posZ))) { + UpdateEvent event = new UpdateEvent(EventType.PRE, this.lastReportedYaw, this.lastReportedPitch, this.rotationYaw, this.rotationPitch); + EventManager.call(event); + RotationState.applyState(event.isRotated() && !this.isRiding(), event.getNewYaw(), event.getNewPitch(), event.getPreYaw(), event.isRotating()); + if (event.isRotated()) { + this.pendingYaw = this.rotationYaw; + this.pendingPitch = this.rotationPitch; + this.overrideYaw = event.getNewYaw(); + this.overridePitch = event.getNewPitch(); + } else { + this.pendingYaw = Float.NaN; + this.pendingPitch = Float.NaN; + this.overrideYaw = Float.NaN; + this.overridePitch = Float.NaN; + } + } + } + + @Inject( + method = {"onUpdate"}, + at = {@At("RETURN")} + ) + private void postUpdate(CallbackInfo callbackInfo) { + if (this.worldObj.isBlockLoaded(new BlockPos(this.posX, 0.0, this.posZ))) { + if (!Float.isNaN(this.pendingYaw) && !Float.isNaN(this.pendingPitch)) { + this.lastReportedYaw = this.rotationYaw; + this.lastReportedPitch = this.rotationPitch; + this.rotationYaw = this.rotationYaw + MathHelper.wrapAngleTo180_float(this.pendingYaw - this.rotationYaw); + this.rotationPitch = this.pendingPitch; + this.prevRotationYaw = this.rotationYaw; + this.prevRotationPitch = this.rotationPitch; + this.prevRenderArmYaw = this.rotationYaw - (this.renderArmYaw - this.prevRenderArmYaw) * 2.0F; + this.renderArmYaw = this.rotationYaw; + } + EventManager.call(new UpdateEvent(EventType.POST, this.lastReportedYaw, this.lastReportedPitch, this.rotationYaw, this.rotationPitch)); + } + } + + @Redirect( + method = {"onUpdate"}, + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/entity/EntityPlayerSP;isRiding()Z" + ) + ) + private boolean onRidding(EntityPlayerSP entityPlayerSP) { + if (!Float.isNaN(this.overrideYaw) && !Float.isNaN(this.overridePitch)) { + this.rotationYaw = this.overrideYaw; + this.rotationPitch = this.overridePitch; + } + return entityPlayerSP.isRiding(); + } + + @Inject( + method = {"onUpdate"}, + at = {@At( + value = "INVOKE", + target = "Lnet/minecraft/client/entity/EntityPlayerSP;onUpdateWalkingPlayer()V" + )} + ) + private void onMotionUpdate(CallbackInfo callbackInfo) { + EventManager.call(new PlayerUpdateEvent()); + } + + @Inject( + method = {"onLivingUpdate"}, + at = {@At( + value = "INVOKE", + target = "Lnet/minecraft/client/entity/AbstractClientPlayer;onLivingUpdate()V" + )} + ) + private void onLivingUpdate(CallbackInfo callbackInfo) { + EventManager.call(new LivingUpdateEvent()); + } + + @Inject( + method = {"onLivingUpdate"}, + at = {@At( + value = "INVOKE", + target = "Lnet/minecraft/util/MovementInput;updatePlayerMoveState()V", + shift = At.Shift.AFTER + )} + ) + private void updateMove(CallbackInfo callbackInfo) { + EventManager.call(new MoveInputEvent()); + } + + @Redirect( + method = {"onLivingUpdate"}, + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/entity/EntityPlayerSP;isUsingItem()Z" + ) + ) + private boolean isUsing(EntityPlayerSP entityPlayerSP) { + NoSlow noSlow = (NoSlow) Myau.moduleManager.modules.get(NoSlow.class); + return (!noSlow.isEnabled() || !noSlow.isAnyActive()) && entityPlayerSP.isUsingItem(); + } + + @Redirect( + method = {"onLivingUpdate"}, + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/entity/EntityPlayerSP;isPotionActive(Lnet/minecraft/potion/Potion;)Z" + ) + ) + private boolean checkPotion(EntityPlayerSP entityPlayerSP, Potion potion) { + if (potion == Potion.confusion && Myau.moduleManager != null) { + AntiDebuff antiDebuff = (AntiDebuff) Myau.moduleManager.modules.get(AntiDebuff.class); + if (antiDebuff.isEnabled() && antiDebuff.nausea.getValue()) { + return false; + } + } + return ((IAccessorEntityLivingBase) entityPlayerSP).getActivePotionsMap().containsKey(potion.id); + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.data.Box; +import myau.event.EventManager; +import myau.events.PickEvent; +import myau.events.RaytraceEvent; +import myau.events.Render3DEvent; +import myau.module.modules.*; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.util.Vec3; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.*; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; + +import java.util.List; + +@SideOnly(Side.CLIENT) +@Mixin(value = {EntityRenderer.class}, priority = 9999) +public abstract class MixinEntityRenderer { + @Unique + private Box slot = null; + @Unique + private Box using = null; + @Unique + private Box useCount = null; + @Shadow + private Minecraft mc; + @Shadow + private float thirdPersonDistance; + + @Inject( + method = {"updateCameraAndRender"}, + at = {@At("HEAD")} + ) + private void updateCameraAndRender(float float1, long long2, CallbackInfo callbackInfo) { + if (this.mc.thePlayer != null) { + Scaffold scaffold = (Scaffold) Myau.moduleManager.modules.get(Scaffold.class); + if (scaffold.isEnabled() && scaffold.itemSpoof.getValue()) { + int slot = scaffold.getSlot(); + if (slot >= 0) { + this.slot = new Box<>(this.mc.thePlayer.inventory.currentItem); + this.mc.thePlayer.inventory.currentItem = slot; + } + } + KillAura killAura = (KillAura) Myau.moduleManager.modules.get(KillAura.class); + if (killAura.isEnabled() && killAura.isBlocking()) { + this.using = new Box<>(((IAccessorEntityPlayer) this.mc.thePlayer).getItemInUse()); + ((IAccessorEntityPlayer) this.mc.thePlayer).setItemInUse(this.mc.thePlayer.inventory.getCurrentItem()); + this.useCount = new Box<>(((IAccessorEntityPlayer) this.mc.thePlayer).getItemInUseCount()); + ((IAccessorEntityPlayer) this.mc.thePlayer).setItemInUseCount(69000); + } + } + } + + @Inject( + method = {"updateCameraAndRender"}, + at = {@At("RETURN")} + ) + private void postUpdateCameraAndRender(float float1, long long2, CallbackInfo callbackInfo) { + if (this.slot != null) { + this.mc.thePlayer.inventory.currentItem = this.slot.value; + this.slot = null; + } + if (this.using != null) { + ((IAccessorEntityPlayer) this.mc.thePlayer).setItemInUse(this.using.value); + this.using = null; + } + if (this.useCount != null) { + ((IAccessorEntityPlayer) this.mc.thePlayer).setItemInUseCount(this.useCount.value); + this.useCount = null; + } + } + + @Inject( + method = {"updateRenderer"}, + at = {@At("HEAD")} + ) + private void updateRenderer(CallbackInfo callbackInfo) { + Scaffold scaffold = (Scaffold) Myau.moduleManager.modules.get(Scaffold.class); + if (scaffold.isEnabled() && scaffold.itemSpoof.getValue()) { + int slot = scaffold.getSlot(); + if (slot >= 0) { + this.slot = new Box<>(this.mc.thePlayer.inventory.currentItem); + this.mc.thePlayer.inventory.currentItem = slot; + } + } + + AutoBlockIn autoBlockIn = (AutoBlockIn) Myau.moduleManager.modules.get(AutoBlockIn.class); + if (autoBlockIn.isEnabled() && autoBlockIn.itemSpoof.getValue()) { + int slot = autoBlockIn.getSlot(); + if (slot >= 0) { + this.slot = new Box<>(this.mc.thePlayer.inventory.currentItem); + this.mc.thePlayer.inventory.currentItem = slot; + } + } + } + + @Inject( + method = {"updateRenderer"}, + at = {@At("RETURN")} + ) + private void postUpdateRenderer(CallbackInfo callbackInfo) { + if (this.slot != null) { + this.mc.thePlayer.inventory.currentItem = this.slot.value; + this.slot = null; + } + } + + @Inject( + method = {"renderWorldPass"}, + at = {@At( + value = "FIELD", + target = "Lnet/minecraft/client/renderer/EntityRenderer;renderHand:Z", + shift = At.Shift.BEFORE + )} + ) + private void renderWorldPass(int integer, float float2, long long3, CallbackInfo callbackInfo) { + EventManager.call(new Render3DEvent(float2)); + } + + @ModifyConstant( + method = {"hurtCameraEffect"}, + constant = {@Constant( + floatValue = 14.0F, + ordinal = 0 + )} + ) + private float hurtCameraEffect(float float1) { + if (Myau.moduleManager == null) { + return float1; + } else { + NoHurtCam noHurtCam = (NoHurtCam) Myau.moduleManager.modules.get(NoHurtCam.class); + return noHurtCam.isEnabled() ? float1 * (float) noHurtCam.multiplier.getValue().intValue() / 100.0F : float1; + } + } + + @ModifyConstant( + method = {"getMouseOver"}, + constant = {@Constant( + doubleValue = 3.0, + ordinal = 1 + )} + ) + private double getMouseOver(double range) { + PickEvent event = new PickEvent(range); + EventManager.call(event); + return event.getRange(); + } + + @ModifyVariable( + method = {"getMouseOver"}, + at = @At("STORE"), + name = {"d0"} + ) + private double storeMouseOver(double range) { + RaytraceEvent event = new RaytraceEvent(range); + EventManager.call(event); + return event.getRange(); + } + + @Inject( + method = {"getMouseOver"}, + at = {@At( + value = "INVOKE", + target = "Ljava/util/List;size()I", + ordinal = 0 + )}, + locals = LocalCapture.CAPTURE_FAILSOFT + ) + private void a( + float float1, + CallbackInfo callbackInfo, + Entity entity, + double double4, + double double5, + Vec3 vec36, + boolean boolean7, + int integer8, + Vec3 vec39, + Vec3 vec310, + Vec3 vec311, + float float12, + List list, + double double14, + int integer15 + ) { + if (Myau.moduleManager != null) { + GhostHand event = (GhostHand) Myau.moduleManager.modules.get(GhostHand.class); + if (event.isEnabled()) { + list.removeIf(event::shouldSkip); + } + } + } + + @Redirect( + method = {"orientCamera"}, + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/util/Vec3;distanceTo(Lnet/minecraft/util/Vec3;)D" + ) + ) + private double v(Vec3 vec31, Vec3 vec32) { + if (Myau.moduleManager == null) { + return vec31.distanceTo(vec32); + } else { + return Myau.moduleManager.modules.get(ViewClip.class).isEnabled() ? (double) this.thirdPersonDistance : vec31.distanceTo(vec32); + } + } + + @Redirect( + method = {"setupFog"}, + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/block/Block;getMaterial()Lnet/minecraft/block/material/Material;" + ) + ) + private Material x(Block block) { + if (Myau.moduleManager == null) { + return block.getMaterial(); + } else { + return Myau.moduleManager.modules.get(ViewClip.class).isEnabled() ? Material.air : block.getMaterial(); + } + } + + @Redirect( + method = {"updateFogColor"}, + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/entity/EntityLivingBase;isPotionActive(Lnet/minecraft/potion/Potion;)Z" + ) + ) + private boolean y(EntityLivingBase entityLivingBase, Potion potion) { + if (potion == Potion.blindness && Myau.moduleManager != null) { + AntiDebuff antiDebuff = (AntiDebuff) Myau.moduleManager.modules.get(AntiDebuff.class); + if (antiDebuff.isEnabled() && antiDebuff.blindness.getValue()) { + return false; + } + } + return ((IAccessorEntityLivingBase) entityLivingBase).getActivePotionsMap().containsKey(potion.id); + } + + @Redirect( + method = {"setupFog"}, + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/entity/EntityLivingBase;isPotionActive(Lnet/minecraft/potion/Potion;)Z" + ) + ) + private boolean q(EntityLivingBase entityLivingBase, Potion potion) { + if (potion == Potion.blindness && Myau.moduleManager != null) { + AntiDebuff antiDebuff = (AntiDebuff) Myau.moduleManager.modules.get(AntiDebuff.class); + if (antiDebuff.isEnabled() && antiDebuff.blindness.getValue()) { + return false; + } + } + return ((IAccessorEntityLivingBase) entityLivingBase).getActivePotionsMap().containsKey(potion.id); + } + + @Redirect( + method = {"setupCameraTransform"}, + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/entity/EntityPlayerSP;isPotionActive(Lnet/minecraft/potion/Potion;)Z" + ) + ) + private boolean c(EntityPlayerSP entityPlayerSP, Potion potion) { + if (potion == Potion.confusion && Myau.moduleManager != null) { + AntiDebuff antiDebuff = (AntiDebuff) Myau.moduleManager.modules.get(AntiDebuff.class); + if (antiDebuff.isEnabled() && antiDebuff.nausea.getValue()) { + return false; + } + } + return ((IAccessorEntityLivingBase) entityPlayerSP).getActivePotionsMap().containsKey(potion.id); + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.module.modules.AntiObfuscate; +import myau.module.modules.NickHider; +import net.minecraft.client.gui.FontRenderer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyVariable; +import org.spongepowered.asm.mixin.injection.Redirect; + +@SideOnly(Side.CLIENT) +@Mixin(value = {FontRenderer.class}, priority = 9999) +public abstract class MixinFontRenderer { + @ModifyVariable( + method = {"renderString"}, + at = @At("HEAD"), + ordinal = 0, + argsOnly = true + ) + private String renderString(String string) { + if (Myau.moduleManager == null) { + return string; + } else { + AntiObfuscate antiObfuscate = (AntiObfuscate) Myau.moduleManager.modules.get(AntiObfuscate.class); + if (antiObfuscate.isEnabled()) { + string = antiObfuscate.stripObfuscated(string); + } + NickHider nickHider = (NickHider) Myau.moduleManager.modules.get(NickHider.class); + return nickHider.isEnabled() ? nickHider.replaceNick(string) : string; + } + } + + @ModifyVariable( + method = {"getStringWidth"}, + at = @At("HEAD"), + ordinal = 0, + argsOnly = true + ) + private String getStringWidth(String string) { + if (Myau.moduleManager == null) { + return string; + } else { + AntiObfuscate antiObfuscate = (AntiObfuscate) Myau.moduleManager.modules.get(AntiObfuscate.class); + if (antiObfuscate.isEnabled()) { + string = antiObfuscate.stripObfuscated(string); + } + NickHider nickHider = (NickHider) Myau.moduleManager.modules.get(NickHider.class); + return nickHider.isEnabled() ? nickHider.replaceNick(string) : string; + } + } + + @Redirect( + method = {"getStringWidth"}, + at = @At( + value = "INVOKE", + target = "Ljava/lang/String;charAt(I)C", + ordinal = 1 + ) + ) + private char getStringWidth(String string, int index) { + char charAt = string.charAt(index); + return charAt != '0' + && charAt != '1' + && charAt != '2' + && charAt != '3' + && charAt != '4' + && charAt != '5' + && charAt != '6' + && charAt != '7' + && charAt != '8' + && charAt != '9' + && charAt != 'a' + && charAt != 'A' + && charAt != 'b' + && charAt != 'B' + && charAt != 'c' + && charAt != 'C' + && charAt != 'd' + && charAt != 'D' + && charAt != 'e' + && charAt != 'E' + && charAt != 'f' + && charAt != 'F' + ? charAt + : 'r'; + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.module.modules.Sprint; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Dynamic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Pseudo; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@SideOnly(Side.CLIENT) +@Pseudo +@Mixin(targets = {"club.sk1er.patcher.util.fov.FovHandler"}, priority = 9999) +public abstract class MixinFovHandler { + @Redirect( + method = {"fovChange"}, + remap = false, + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/entity/player/EntityPlayer;func_70051_ag()Z", + remap = false + ) + ) + @Dynamic("Patcher") + private boolean fovChange(EntityPlayer entityPlayer) { + boolean sprinting = entityPlayer.isSprinting(); + if (entityPlayer instanceof EntityPlayerSP && Myau.moduleManager != null) { + Sprint sprint = (Sprint) Myau.moduleManager.modules.get(Sprint.class); + return sprint.isEnabled() && sprint.shouldKeepFov(sprinting) || sprinting; + } else { + return sprinting; + } + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.module.modules.AutoBlockIn; +import myau.module.modules.Scaffold; +import net.minecraft.client.gui.GuiIngame; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@SideOnly(Side.CLIENT) +@Mixin(value = {GuiIngame.class}, priority = 9999) +public abstract class MixinGuiIngame { + @Redirect( + method = {"updateTick"}, + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/entity/player/InventoryPlayer;getCurrentItem()Lnet/minecraft/item/ItemStack;" + ) + ) + private ItemStack updateTick(InventoryPlayer inventoryPlayer) { + Scaffold scaffold = (Scaffold) Myau.moduleManager.modules.get(Scaffold.class); + if (scaffold.isEnabled() && scaffold.itemSpoof.getValue()) { + int slot = scaffold.getSlot(); + if (slot >= 0) { + return inventoryPlayer.getStackInSlot(slot); + } + } + AutoBlockIn autoBlockIn = (AutoBlockIn) Myau.moduleManager.modules.get(AutoBlockIn.class); + if(autoBlockIn.itemSpoof.getValue() && autoBlockIn.isEnabled()){ + int slot = autoBlockIn.getSlot(); + if (slot >= 0) { + return inventoryPlayer.getStackInSlot(slot); + } + } + return inventoryPlayer.getCurrentItem(); + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.event.EventManager; +import myau.events.Render2DEvent; +import myau.module.modules.NickHider; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraftforge.client.GuiIngameForge; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@SideOnly(Side.CLIENT) +@Mixin(value = {GuiIngameForge.class}, priority = 9999) +public abstract class MixinGuiIngameForge { + @Inject( + method = {"renderGameOverlay"}, + at = {@At( + value = "INVOKE", + target = "Lnet/minecraftforge/client/GuiIngameForge;renderTitle(IIF)V", + shift = At.Shift.AFTER, + remap = false + )} + ) + private void renderGameOverlay(float float1, CallbackInfo callbackInfo) { + EventManager.call(new Render2DEvent(float1)); + } + + @Redirect( + method = {"renderExperience"}, + at = @At( + value = "FIELD", + target = "Lnet/minecraft/client/entity/EntityPlayerSP;experience:F" + ) + ) + private float renderExperience(EntityPlayerSP entityPlayerSP) { + if (Myau.moduleManager == null) { + return entityPlayerSP.experience; + } else { + NickHider event = (NickHider) Myau.moduleManager.modules.get(NickHider.class); + return event.isEnabled() && event.level.getValue() ? 0.0F : entityPlayerSP.experience; + } + } + + @Redirect( + method = {"renderExperience"}, + at = @At( + value = "FIELD", + target = "Lnet/minecraft/client/entity/EntityPlayerSP;experienceLevel:I" + ) + ) + private int renderExperienceLevel(EntityPlayerSP entityPlayerSP) { + if (Myau.moduleManager == null) { + return entityPlayerSP.experienceLevel; + } else { + NickHider event = (NickHider) Myau.moduleManager.modules.get(NickHider.class); + return event.isEnabled() && event.level.getValue() ? 0 : entityPlayerSP.experienceLevel; + } + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.module.modules.ESP; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@SideOnly(Side.CLIENT) +@Mixin(value = {ItemStack.class}, priority = 9999) +public abstract class MixinItemStack { + @Inject( + method = {"hasEffect"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void hasEffect(CallbackInfoReturnable callbackInfoReturnable) { + if (Myau.moduleManager != null) { + ESP esp = (ESP) Myau.moduleManager.modules.get(ESP.class); + if (esp.isEnabled() && !esp.isGlowEnabled()) { + callbackInfoReturnable.setReturnValue(false); + } + } + } +} + + + +package myau.mixin; + +import myau.event.EventManager; +import myau.events.SwapItemEvent; +import net.minecraft.client.Minecraft; +import net.minecraft.client.settings.KeyBinding; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +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.callback.CallbackInfoReturnable; + +@SideOnly(Side.CLIENT) +@Mixin(value = {KeyBinding.class}, priority = 9999) +public abstract class MixinKeyBinding { + @Shadow + private String keyDescription; + + @Inject( + method = {"isPressed"}, + at = {@At("RETURN")}, + cancellable = true + ) + private void isPressed(CallbackInfoReturnable callbackInfoReturnable) { + if (callbackInfoReturnable.getReturnValue()) { + Minecraft mc = Minecraft.getMinecraft(); + for (int i = 0; i < 9; i++) { + if (mc.gameSettings.keyBindsHotbar[i].getKeyDescription().equals(this.keyDescription)) { + SwapItemEvent event = new SwapItemEvent(i, 0); + EventManager.call(event); + if (event.isCancelled()) { + callbackInfoReturnable.setReturnValue(false); + } + } + } + } + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.init.Initializer; +import myau.event.EventManager; +import myau.event.types.EventType; +import myau.events.*; +import myau.module.modules.NoHitDelay; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +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.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@SideOnly(Side.CLIENT) +@Mixin(value = {Minecraft.class}, priority = 9999) +public abstract class MixinMinecraft { + @Shadow + private int leftClickCounter; + @Shadow + public PlayerControllerMP playerController; + @Shadow + public WorldClient theWorld; + @Shadow + public EntityPlayerSP thePlayer; + @Shadow + public GuiScreen currentScreen; + + @Inject( + method = {"startGame"}, + at = {@At("HEAD")} + ) + private void startGame(CallbackInfo callbackInfo) { + new Initializer(); + } + + @Inject( + method = {"startGame"}, + at = {@At("RETURN")} + ) + private void postStartGame(CallbackInfo callbackInfo) { + new Myau(); + } + + @Inject( + method = {"runTick"}, + at = {@At("HEAD")} + ) + private void runTick(CallbackInfo callbackInfo) { + if (this.theWorld != null && this.thePlayer != null) { + EventManager.call(new TickEvent(EventType.PRE)); + } + } + + @Inject( + method = {"runTick"}, + at = {@At("RETURN")} + ) + private void postRunTick(CallbackInfo callbackInfo) { + if (this.theWorld != null && this.thePlayer != null) { + EventManager.call(new TickEvent(EventType.POST)); + } + } + + @Inject( + method = {"loadWorld(Lnet/minecraft/client/multiplayer/WorldClient;Ljava/lang/String;)V"}, + at = {@At("HEAD")} + ) + private void loadWorld(WorldClient worldClient, String string, CallbackInfo callbackInfo) { + EventManager.call(new LoadWorldEvent()); + } + + @Inject( + method = {"updateFramebufferSize"}, + at = {@At("RETURN")} + ) + private void updateFramebufferSize(CallbackInfo callbackInfo) { + EventManager.call(new ResizeEvent()); + } + + @Inject( + method = {"clickMouse"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void clickMouse(CallbackInfo callbackInfo) { + if (Myau.moduleManager != null && Myau.moduleManager.modules.get(NoHitDelay.class).isEnabled()) { + this.leftClickCounter = 0; + } + LeftClickMouseEvent event = new LeftClickMouseEvent(); + EventManager.call(event); + if (event.isCancelled()) { + callbackInfo.cancel(); + } + } + + @Inject( + method = {"rightClickMouse"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void rightClickMouse(CallbackInfo callbackInfo) { + RightClickMouseEvent event = new RightClickMouseEvent(); + EventManager.call(event); + if (event.isCancelled()) { + callbackInfo.cancel(); + } + } + + @Inject( + method = {"sendClickBlockToController"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void sendClickBlockToController(CallbackInfo callbackInfo) { + HitBlockEvent event = new HitBlockEvent(); + EventManager.call(event); + if (event.isCancelled()) { + callbackInfo.cancel(); + this.playerController.resetBlockRemoving(); + } + } + + @Redirect( + method = {"runTick"}, + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/settings/KeyBinding;setKeyBindState(IZ)V" + ) + ) + private void setKeyBindState(int integer, boolean boolean2) { + KeyBinding.setKeyBindState(integer, boolean2); + if (boolean2 && this.currentScreen == null) { + EventManager.call(new KeyEvent(integer)); + } + } + + @Redirect( + method = {"runTick"}, + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/entity/player/InventoryPlayer;changeCurrentItem(I)V" + ) + ) + private void changeCurrentItem(InventoryPlayer inventoryPlayer, int slot) { + SwapItemEvent event = new SwapItemEvent(-1, slot); + EventManager.call(event); + if (!event.isCancelled()) { + inventoryPlayer.changeCurrentItem(slot); + } + } +} + + + +package myau.mixin; + +import io.netty.channel.ChannelHandlerContext; +import io.netty.util.concurrent.GenericFutureListener; +import myau.Myau; +import myau.event.EventManager; +import myau.event.types.EventType; +import myau.events.PacketEvent; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.concurrent.Future; + +@SideOnly(Side.CLIENT) +@Mixin(value = {NetworkManager.class}, priority = 9999) +public abstract class MixinNetworkManager { + @Inject( + method = {"channelRead0*"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void channelRead0(ChannelHandlerContext channelHandlerContext, Packet packet, CallbackInfo callbackInfo) { + if (!packet.getClass().getName().startsWith("net.minecraft.network.play.client")) { + if (Myau.delayManager != null && Myau.delayManager.shouldDelay((Packet) packet)) { + callbackInfo.cancel(); + } else { + PacketEvent event = new PacketEvent(EventType.RECEIVE, packet); + EventManager.call(event); + if (event.isCancelled()) { + callbackInfo.cancel(); + } + } + } + } + + @Inject( + method = {"sendPacket(Lnet/minecraft/network/Packet;)V"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void sendPacket(Packet packet, CallbackInfo callbackInfo) { + if (!packet.getClass().getName().startsWith("net.minecraft.network.play.server")) { + PacketEvent event = new PacketEvent(EventType.SEND, packet); + EventManager.call(event); + if (event.isCancelled()) { + callbackInfo.cancel(); + } else if (Myau.playerStateManager != null && Myau.blinkManager != null && Myau.lagManager != null) { + if (!Myau.lagManager.isFlushing()) { + Myau.playerStateManager.handlePacket(packet); + if (Myau.blinkManager.isBlinking()) { + if (Myau.blinkManager.offerPacket(packet)) { + callbackInfo.cancel(); + return; + } + } + if (Myau.lagManager.handlePacket(packet)) { + callbackInfo.cancel(); + } + } + } + } + } + + @Inject( + method = {"sendPacket(Lnet/minecraft/network/Packet;Lio/netty/util/concurrent/GenericFutureListener;[Lio/netty/util/concurrent/GenericFutureListener;)V"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void sendPacket2( + Packet packet, + GenericFutureListener> genericFutureListener, + GenericFutureListener>[] arr, + CallbackInfo callbackInfo + ) { + if (!packet.getClass().getName().startsWith("net.minecraft.network.play.server")) { + if (Myau.playerStateManager != null && Myau.blinkManager != null && Myau.lagManager != null) { + if (!Myau.lagManager.isFlushing()) { + Myau.playerStateManager.handlePacket(packet); + if (Myau.blinkManager.isBlinking()) { + if (Myau.blinkManager.offerPacket(packet)) { + callbackInfo.cancel(); + return; + } + } + if (Myau.lagManager.handlePacket(packet)) { + callbackInfo.cancel(); + } + } + } + } + } +} + + + +package myau.mixin; + +import myau.event.EventManager; +import myau.events.AttackEvent; +import myau.events.CancelUseEvent; +import myau.events.WindowClickEvent; +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@SideOnly(Side.CLIENT) +@Mixin(value = {PlayerControllerMP.class}, priority = 9999) +public abstract class MixinPlayerControllerMP { + + @Inject( + method = "attackEntity", + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/PlayerControllerMP;syncCurrentPlayItem()V")) + private void attackEntity( + EntityPlayer entityPlayer, Entity targetEntity, CallbackInfo callbackInfo + ) { + AttackEvent event = new AttackEvent(targetEntity); + EventManager.call(event); + } + @Inject( + method = {"windowClick"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void windowClick( + int windowId, int slotId, int mouseButtonClicked, int mode, EntityPlayer entityPlayer, CallbackInfoReturnable callbackInfoReturnable + ) { + WindowClickEvent event = new WindowClickEvent(windowId, slotId, mouseButtonClicked, mode); + EventManager.call(event); + if (event.isCancelled()) { + callbackInfoReturnable.cancel(); + } + } + + @Inject( + method = {"onStoppedUsingItem"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void onStoppedUsingItem(CallbackInfo callbackInfo) { + CancelUseEvent event = new CancelUseEvent(); + EventManager.call(event); + if (event.isCancelled()) { + callbackInfo.cancel(); + } + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.event.EventManager; +import myau.event.types.EventType; +import myau.events.RenderLivingEvent; +import myau.module.modules.ESP; +import myau.module.modules.NameTags; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.entity.RendererLivingEntity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@SideOnly(Side.CLIENT) +@Mixin( + value = {RendererLivingEntity.class}, + priority = 9991 +) +public abstract class MixinRendererLivingEntity extends Render { + protected MixinRendererLivingEntity(RenderManager renderManager) { + super(renderManager); + } + + @Inject( + method = {"doRender(Lnet/minecraft/entity/EntityLivingBase;DDDFF)V"}, + at = {@At("HEAD")} + ) + private void doRender(T entityLivingBase, double double2, double double3, double double4, float float5, float float6, CallbackInfo callbackInfo) { + EventManager.call(new RenderLivingEvent(EventType.PRE, entityLivingBase)); + } + + @Inject( + method = {"doRender(Lnet/minecraft/entity/EntityLivingBase;DDDFF)V"}, + at = {@At("RETURN")} + ) + private void postRender(T entityLivingBase, double double2, double double3, double double4, float float5, float float6, CallbackInfo callbackInfo) { + EventManager.call(new RenderLivingEvent(EventType.POST, entityLivingBase)); + } + + @Inject( + method = {"canRenderName(Lnet/minecraft/entity/EntityLivingBase;)Z"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void canRenderName(T entityLivingBase, CallbackInfoReturnable callbackInfoReturnable) { + if (Myau.moduleManager != null) { + NameTags nameTags = (NameTags) Myau.moduleManager.modules.get(NameTags.class); + if (nameTags.isEnabled() && nameTags.shouldRenderTags(entityLivingBase)) { + callbackInfoReturnable.setReturnValue(false); + } else { + ESP esp = (ESP) Myau.moduleManager.modules.get(ESP.class); + if (esp.isEnabled() && !esp.isOutlineEnabled()) { + callbackInfoReturnable.setReturnValue(false); + } + } + } + } +} + + + +package myau.mixin; + +import myau.management.RotationState; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.entity.Entity; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@SideOnly(Side.CLIENT) +@Mixin(value = {RenderManager.class}, priority = 9999) +public abstract class MixinRenderManager { + @Unique + private float _prevRenderYawOffset; + @Unique + private float _renderYawOffset; + @Unique + private float _prevRotationYawHead; + @Unique + private float _rotationYawHead; + @Unique + private float _prevRotationPitch; + @Unique + private float _rotationPitch; + + @Inject( + method = {"renderEntityStatic"}, + at = {@At("HEAD")} + ) + private void renderEntityStatic(Entity entity, float float2, boolean boolean3, CallbackInfoReturnable callbackInfoReturnable) { + if (entity instanceof EntityPlayerSP && RotationState.isRotated(1)) { + EntityPlayerSP entityPlayerSP = (EntityPlayerSP) entity; + this._prevRenderYawOffset = entityPlayerSP.prevRenderYawOffset; + this._renderYawOffset = entityPlayerSP.renderYawOffset; + this._prevRotationYawHead = entityPlayerSP.prevRotationYawHead; + this._rotationYawHead = entityPlayerSP.rotationYawHead; + this._prevRotationPitch = entityPlayerSP.prevRotationPitch; + this._rotationPitch = entityPlayerSP.rotationPitch; + entityPlayerSP.prevRenderYawOffset = RotationState.getPrevRenderYawOffset(); + entityPlayerSP.renderYawOffset = RotationState.getRenderYawOffset(); + entityPlayerSP.prevRotationYawHead = RotationState.getPrevRotationYawHead(); + entityPlayerSP.rotationYawHead = RotationState.getRotationYawHead(); + entityPlayerSP.prevRotationPitch = RotationState.getPrevRotationPitch(); + entityPlayerSP.rotationPitch = RotationState.getRotationPitch(); + } + } + + @Inject( + method = {"renderEntityStatic"}, + at = {@At("RETURN")} + ) + private void renderEntityStaticPost(Entity entity, float float2, boolean boolean3, CallbackInfoReturnable callbackInfoReturnable) { + if (entity instanceof EntityPlayerSP && RotationState.isRotated(1)) { + EntityPlayerSP entityPlayerSP = (EntityPlayerSP) entity; + entityPlayerSP.prevRenderYawOffset = this._prevRenderYawOffset; + entityPlayerSP.renderYawOffset = this._renderYawOffset; + entityPlayerSP.prevRotationYawHead = this._prevRotationYawHead; + entityPlayerSP.rotationYawHead = this._rotationYawHead; + entityPlayerSP.prevRotationPitch = this._prevRotationPitch; + entityPlayerSP.rotationPitch = this._rotationPitch; + } + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.module.modules.Chams; +import myau.module.modules.ViewClip; +import myau.module.modules.Xray; +import net.minecraft.client.renderer.chunk.SetVisibility; +import net.minecraft.client.renderer.chunk.VisGraph; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@SideOnly(Side.CLIENT) +@Mixin(value = {VisGraph.class}, priority = 9999) +public abstract class MixinVisGraph { + @Inject( + method = {"func_178606_a"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void func_178606_a(CallbackInfo callbackInfo) { + if (Myau.moduleManager != null) { + if (Myau.moduleManager.modules.get(Chams.class).isEnabled() + || Myau.moduleManager.modules.get(ViewClip.class).isEnabled() + || Myau.moduleManager.modules.get(Xray.class).isEnabled()) { + callbackInfo.cancel(); + } + } + } + + @Inject( + method = {"computeVisibility"}, + at = {@At("HEAD")}, + cancellable = true + ) + private void computeVisibility(CallbackInfoReturnable callbackInfoReturnable) { + if (Myau.moduleManager != null) { + if (Myau.moduleManager.modules.get(Chams.class).isEnabled() + || Myau.moduleManager.modules.get(ViewClip.class).isEnabled() + || Myau.moduleManager.modules.get(Xray.class).isEnabled()) { + SetVisibility setVisibility = new SetVisibility(); + setVisibility.setAllVisible(true); + callbackInfoReturnable.setReturnValue(setVisibility); + } + } + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.module.modules.AntiObbyTrap; +import myau.module.modules.Jesus; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.Entity; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; +import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@SideOnly(Side.CLIENT) +@Mixin(value = {World.class}, priority = 9999) +public abstract class MixinWorld { + @Redirect( + method = {"handleMaterialAcceleration"}, + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/entity/Entity;isPushedByWater()Z" + ) + ) + private boolean handleMaterialAcceleration(Entity entity) { + if (entity instanceof EntityPlayerSP && Myau.moduleManager != null) { + Jesus jesus = (Jesus) Myau.moduleManager.modules.get(Jesus.class); + if (jesus.isEnabled() && jesus.noPush.getValue()) { + return false; + } + } + return entity.isPushedByWater(); + } + + @Redirect( + method = {"rayTraceBlocks(Lnet/minecraft/util/Vec3;Lnet/minecraft/util/Vec3;ZZZ)Lnet/minecraft/util/MovingObjectPosition;"}, + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/world/World;getBlockState(Lnet/minecraft/util/BlockPos;)Lnet/minecraft/block/state/IBlockState;" + ) + ) + private IBlockState rayTraceBlocks(World world, BlockPos blockPos) { + if (Myau.moduleManager == null) { + return world.getBlockState(blockPos); + } else { + AntiObbyTrap antiObbyTrap = (AntiObbyTrap) Myau.moduleManager.modules.get(AntiObbyTrap.class); + if (antiObbyTrap.isEnabled() && antiObbyTrap.isInsideBlock(world, blockPos)) { + if (antiObbyTrap.setAir.getValue()) { + world.setBlockToAir(blockPos); + } + return Blocks.air.getDefaultState(); + } else { + return world.getBlockState(blockPos); + } + } + } +} + + + +package myau.mixin; + +import myau.Myau; +import myau.module.modules.Xray; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +import java.nio.IntBuffer; + +@SideOnly(Side.CLIENT) +@Mixin(value = {WorldRenderer.class}, priority = 9999) +public abstract class MixinWorldRenderer { + @Redirect( + method = {"putColorMultiplier"}, + at = @At( + value = "INVOKE", + target = "java/nio/IntBuffer.put(II)Ljava/nio/IntBuffer;", + remap = false + ) + ) + private IntBuffer putColorMultiplier(IntBuffer intBuffer, int integer2, int integer3) { + if (Myau.moduleManager == null) { + return intBuffer.put(integer2, integer3); + } else { + Xray xray = (Xray) Myau.moduleManager.modules.get(Xray.class); + return xray.isEnabled() + ? intBuffer.put(integer2, integer3 & 16777215 | (int) ((float) xray.opacity.getValue().intValue() * 255.0F / 100.0F) << 24) + : intBuffer.put(integer2, integer3); + } + } +} + + + +package myau.module; + +import myau.Myau; +import myau.module.modules.HUD; +import myau.util.KeyBindUtil; + +public abstract class Module { + protected final String name; + protected final boolean defaultEnabled; + protected final int defaultKey; + protected final boolean defaultHidden; + protected boolean enabled; + protected int key; + protected boolean hidden; + + public Module(String name, boolean enabled) { + this(name, enabled, false); + } + + public Module(String name, boolean enabled, boolean hidden) { + this.name = name; + this.enabled = this.defaultEnabled = enabled; + this.key = this.defaultKey = 0; + this.hidden = this.defaultHidden = hidden; + } + + public String getName() { + return this.name; + } + + public String formatModule() { + return String.format( + "%s%s &r(%s&r)", + this.key == 0 ? "" : String.format("&l[%s] &r", KeyBindUtil.getKeyName(this.key)), + this.name, + this.enabled ? "&a&lON" : "&c&lOFF" + ); + } + + public String[] getSuffix() { + return new String[0]; + } + + public boolean isEnabled() { + return this.enabled; + } + + public void setEnabled(boolean enabled) { + if (this.enabled != enabled) { + this.enabled = enabled; + if (enabled) { + this.onEnabled(); + } else { + this.onDisabled(); + } + } + } + + public boolean toggle() { + boolean enabled = !this.enabled; + this.setEnabled(enabled); + if (this.enabled == enabled) { + if (((HUD) Myau.moduleManager.modules.get(HUD.class)).toggleSound.getValue()) { + Myau.moduleManager.playSound(); + } + return true; + } else { + return false; + } + } + + public int getKey() { + return this.key; + } + + public void setKey(int integer) { + this.key = integer; + } + + public boolean isHidden() { + return this.hidden; + } + + public void setHidden(boolean boolean1) { + this.hidden = boolean1; + } + + public void onEnabled() { + } + + public void onDisabled() { + } + + public void verifyValue(String string) { + } +} + + + +package myau.module; + +import myau.Myau; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.KeyEvent; +import myau.events.TickEvent; +import myau.module.modules.GuiModule; +import myau.module.modules.HUD; +import myau.util.ChatUtil; +import myau.util.SoundUtil; + +import java.util.LinkedHashMap; + +public class ModuleManager { + private boolean sound = false; + public final LinkedHashMap, Module> modules = new LinkedHashMap<>(); + + public Module getModule(String string) { + return this.modules.values().stream().filter(mD -> mD.getName().equalsIgnoreCase(string)).findFirst().orElse(null); + } + + public Module getModule(Class clazz){ + return this.modules.get(clazz); + } + + public void playSound() { + this.sound = true; + } + + @EventTarget + public void onKey(KeyEvent event) { + for (Module module : this.modules.values()) { + if (module.getKey() != event.getKey()) { + continue; + } + boolean shouldNotify = module.toggle(); + HUD hud = (HUD) this.modules.get(HUD.class); + if (hud != null && shouldNotify) { + shouldNotify = hud.toggleAlerts.getValue(); + } + if(module instanceof GuiModule){ + shouldNotify = false; + } + if (shouldNotify) { + String status = module.isEnabled() ? "&a&lON" : "&c&lOFF"; + String message = String.format("%s%s: %s&r", Myau.clientName, module.getName(), status); + ChatUtil.sendFormatted(message); + } + } + } + + @EventTarget + public void onTick(TickEvent event) { + if (event.getType() == EventType.PRE) { + if (this.sound) { + this.sound = false; + SoundUtil.playSound("random.click"); + } + } + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.KeyEvent; +import myau.events.TickEvent; +import myau.module.Module; +import myau.util.*; +import myau.property.properties.BooleanProperty; +import myau.property.properties.FloatProperty; +import myau.property.properties.PercentProperty; +import myau.property.properties.IntProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MovingObjectPosition.MovingObjectType; + +import java.util.Comparator; +import java.util.List; +import java.util.stream.Collectors; + +public class AimAssist extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private final TimerUtil timer = new TimerUtil(); + public final FloatProperty hSpeed = new FloatProperty("horizontal-speed", 3.0F, 0.0F, 10.0F); + public final FloatProperty vSpeed = new FloatProperty("vertical-speed", 0.0F, 0.0F, 10.0F); + public final PercentProperty smoothing = new PercentProperty("smoothing", 50); + public final FloatProperty range = new FloatProperty("range", 4.5F, 3.0F, 8.0F); + public final IntProperty fov = new IntProperty("fov", 90, 30, 360); + public final BooleanProperty weaponOnly = new BooleanProperty("weapons-only", true); + public final BooleanProperty allowTools = new BooleanProperty("allow-tools", false, this.weaponOnly::getValue); + public final BooleanProperty botChecks = new BooleanProperty("bot-check", true); + public final BooleanProperty team = new BooleanProperty("teams", true); + + private boolean isValidTarget(EntityPlayer entityPlayer) { + if (entityPlayer != mc.thePlayer && entityPlayer != mc.thePlayer.ridingEntity) { + if (entityPlayer == mc.getRenderViewEntity() || entityPlayer == mc.getRenderViewEntity().ridingEntity) { + return false; + } else if (entityPlayer.deathTime > 0) { + return false; + } else if (RotationUtil.distanceToEntity(entityPlayer) > (double) this.range.getValue()) { + return false; + } else if (RotationUtil.angleToEntity(entityPlayer) > (float) this.fov.getValue()) { + return false; + } else if (RotationUtil.rayTrace(entityPlayer) != null) { + return false; + } else if (TeamUtil.isFriend(entityPlayer)) { + return false; + } else { + return (!this.team.getValue() || !TeamUtil.isSameTeam(entityPlayer)) && (!this.botChecks.getValue() || !TeamUtil.isBot(entityPlayer)); + } + } else { + return false; + } + } + + private boolean isInReach(EntityPlayer entityPlayer) { + Reach reach = (Reach) Myau.moduleManager.modules.get(Reach.class); + double distance = reach.isEnabled() ? (double) reach.range.getValue() : 3.0; + return RotationUtil.distanceToEntity(entityPlayer) <= distance; + } + + private boolean isLookingAtBlock() { + return mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectType.BLOCK; + } + + public AimAssist() { + super("AimAssist", false); + } + + @EventTarget + public void onTick(TickEvent event) { + if (this.isEnabled() && event.getType() == EventType.POST && mc.currentScreen == null) { + if (!(Boolean) this.weaponOnly.getValue() + || ItemUtil.hasRawUnbreakingEnchant() + || this.allowTools.getValue() && ItemUtil.isHoldingTool()) { + boolean attacking = PlayerUtil.isAttacking(); + if (!attacking || !this.isLookingAtBlock()) { + if (attacking || !this.timer.hasTimeElapsed(350L)) { + List inRange = mc.theWorld + .loadedEntityList + .stream() + .filter(entity -> entity instanceof EntityPlayer) + .map(entity -> (EntityPlayer) entity) + .filter(this::isValidTarget) + .sorted(Comparator.comparingDouble(RotationUtil::distanceToEntity)) + .collect(Collectors.toList()); + if (!inRange.isEmpty()) { + if (inRange.stream().anyMatch(this::isInReach)) { + inRange.removeIf(entityPlayer -> !this.isInReach(entityPlayer)); + } + EntityPlayer player = inRange.get(0); + if (!(RotationUtil.distanceToEntity(player) <= 0.0)) { + AxisAlignedBB axisAlignedBB = player.getEntityBoundingBox(); + double collisionBorderSize = player.getCollisionBorderSize(); + float[] rotation = RotationUtil.getRotationsToBox( + axisAlignedBB.expand(collisionBorderSize, collisionBorderSize, collisionBorderSize), + mc.thePlayer.rotationYaw, + mc.thePlayer.rotationPitch, + 180.0F, + (float) this.smoothing.getValue() / 100.0F + ); + float yaw = Math.min(Math.abs(this.hSpeed.getValue()), 10.0F); + float pitch = Math.min(Math.abs(this.vSpeed.getValue()), 10.0F); + Myau.rotationManager + .setRotation( + mc.thePlayer.rotationYaw + (rotation[0] - mc.thePlayer.rotationYaw) * 0.1F * yaw, + mc.thePlayer.rotationPitch + (rotation[1] - mc.thePlayer.rotationPitch) * 0.1F * pitch, + 0, + false + ); + } + } + } + } + } + } + } + + @EventTarget + public void onPress(KeyEvent event) { + if (event.getKey() == mc.gameSettings.keyBindAttack.getKeyCode() && !Myau.moduleManager.modules.get(AutoClicker.class).isEnabled()) { + this.timer.reset(); + } + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.UpdateEvent; +import myau.mixin.IAccessorKeyBinding; +import myau.module.Module; +import net.minecraft.client.Minecraft; +import net.minecraft.client.settings.GameSettings; + +public class AntiAFK extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private int lastInput; + + public AntiAFK() { + super("AntiAFK", false); + } + + @EventTarget + public void onUpdate(UpdateEvent event){ + if(event.getType() == EventType.PRE && this.isEnabled()){ + GameSettings gameSettings = mc.gameSettings; + if (gameSettings.keyBindJump.isPressed() || gameSettings.keyBindRight.isPressed() || gameSettings.keyBindForward.isPressed() || gameSettings.keyBindLeft.isPressed() || gameSettings.keyBindBack.isPressed()) { + lastInput = 0; + } + lastInput++; + if (lastInput < 20 * 10) return; + if (mc.thePlayer.ticksExisted % 5 == 0) { + ((IAccessorKeyBinding)mc.gameSettings.keyBindRight).setPressed(false); + ((IAccessorKeyBinding)mc.gameSettings.keyBindLeft).setPressed(false); + ((IAccessorKeyBinding)mc.gameSettings.keyBindJump).setPressed(false); + } + if (mc.thePlayer.ticksExisted % 20 == 0) { + if (mc.thePlayer.ticksExisted % 40 == 0) { + ((IAccessorKeyBinding)mc.gameSettings.keyBindRight).setPressed(true); + } else { + ((IAccessorKeyBinding)mc.gameSettings.keyBindLeft).setPressed(true); + } + } + if (mc.thePlayer.ticksExisted % 100 == 0) { + ((IAccessorKeyBinding)mc.gameSettings.keyBindJump).setPressed(true); + } + } + } +} + + + +package myau.module.modules; + +import myau.module.Module; +import myau.property.properties.BooleanProperty; + +public class AntiDebuff extends Module { + public final BooleanProperty blindness = new BooleanProperty("blindness", true); + public final BooleanProperty nausea = new BooleanProperty("nausea", true); + + public AntiDebuff() { + super("AntiDebuff", false); + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.event.types.Priority; +import myau.events.*; +import myau.management.RotationState; +import myau.module.Module; +import myau.util.*; +import myau.property.properties.*; +import myau.property.properties.FloatProperty; +import myau.property.properties.IntProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.projectile.EntityFireball; +import net.minecraft.network.play.client.C02PacketUseEntity; +import net.minecraft.network.play.client.C02PacketUseEntity.Action; +import net.minecraft.network.play.client.C0APacketAnimation; + +import java.awt.*; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.stream.Collectors; + +public class AntiFireball extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private final ArrayList farList = new ArrayList<>(); + private final ArrayList nearList = new ArrayList<>(); + private EntityFireball target = null; + public final FloatProperty range = new FloatProperty("range", 5.0F, 3.0F, 8.0F); + public final IntProperty fov = new IntProperty("fov", 360, 1, 360); + public final BooleanProperty rotations = new BooleanProperty("rotations", true); + public final BooleanProperty swing = new BooleanProperty("swing", true); + public final ModeProperty moveFix = new ModeProperty("move-fix", 1, new String[]{"NONE", "SILENT", "STRICT"}); + public final ModeProperty showTarget = new ModeProperty("show-target", 0, new String[]{"NONE", "DEFAULT", "HUD"}); + + private boolean isValidTarget(EntityFireball entityFireball) { + return !entityFireball.getEntityBoundingBox().hasNaN() && RotationUtil.distanceToEntity(entityFireball) <= (double) this.range.getValue() + 3.0 + && RotationUtil.angleToEntity(entityFireball) <= (float) this.fov.getValue(); + } + + private void doAttackAnimation() { + if (this.swing.getValue()) { + mc.thePlayer.swingItem(); + } else { + PacketUtil.sendPacket(new C0APacketAnimation()); + } + } + + public AntiFireball() { + super("AntiFireball", false); + } + + @EventTarget + public void onTick(TickEvent event) { + if (this.isEnabled() && event.getType() == EventType.PRE) { + List fireballs = mc.theWorld + .loadedEntityList + .stream() + .filter(entity -> entity instanceof EntityFireball) + .map(entity -> (EntityFireball) entity) + .collect(Collectors.toList()); + this.farList.removeIf(entityFireball -> !fireballs.contains(entityFireball)); + this.nearList.removeIf(entityFireball -> !fireballs.contains(entityFireball)); + for (EntityFireball fireball : fireballs) { + if (!this.farList.contains(fireball) && !this.nearList.contains(fireball)) { + if (RotationUtil.distanceToEntity(fireball) > 3.0) { + this.farList.add(fireball); + } else { + this.nearList.add(fireball); + } + } + } + if (mc.thePlayer.capabilities.allowFlying) { + this.target = null; + } else { + this.target = this.farList.stream().filter(this::isValidTarget).min(Comparator.comparingDouble(RotationUtil::distanceToEntity)).orElse(null); + } + } + } + + @EventTarget(Priority.LOWEST) + public void onUpdate(UpdateEvent event) { + if (this.isEnabled() && event.getType() == EventType.PRE) { + EntityFireball fireball = this.target; + if (TeamUtil.isEntityLoaded(fireball)) { + float[] rotations = RotationUtil.getRotationsToBox(this.target.getEntityBoundingBox(), event.getYaw(), event.getPitch(), 180.0F, 0.0F); + if (this.rotations.getValue() + && !ItemUtil.isHoldingNonEmpty() + && !ItemUtil.isUsingBow() + && !ItemUtil.hasHoldItem()) { + event.setRotation(rotations[0], rotations[1], 0); + event.setPervRotation(this.moveFix.getValue() != 0 ? rotations[0] : mc.thePlayer.rotationYaw, 0); + } + if (!Myau.playerStateManager.attacking && !Myau.playerStateManager.digging && !Myau.playerStateManager.placing) { + this.doAttackAnimation(); + if (RotationUtil.distanceToEntity(this.target) <= (double) this.range.getValue().floatValue()) { + PacketUtil.sendPacket(new C02PacketUseEntity(this.target, Action.ATTACK)); + PlayerUtil.attackEntity(this.target); + } + } + } + } + } + + @EventTarget + public void onMove(MoveInputEvent event) { + if (this.isEnabled()) { + if (this.moveFix.getValue() == 1 + && RotationState.isActived() + && RotationState.getPriority() == 0.0F + && MoveUtil.isForwardPressed()) { + MoveUtil.fixStrafe(RotationState.getSmoothedYaw()); + } + } + } + + @EventTarget + public void onRender(Render3DEvent event) { + if (this.isEnabled()) { + if (this.showTarget.getValue() != 0 && TeamUtil.isEntityLoaded(this.target)) { + Color color = new Color(-1); + switch (this.showTarget.getValue()) { + case 1: + double dist = (this.target.posX - this.target.lastTickPosX) * (mc.thePlayer.posX - this.target.posX) + + (this.target.posY - this.target.lastTickPosY) + * (mc.thePlayer.posY + (double) mc.thePlayer.getEyeHeight() - this.target.posY - (double) this.target.height / 2.0) + + (this.target.posZ - this.target.lastTickPosZ) * (mc.thePlayer.posZ - this.target.posZ); + if (dist < 0.0) { + color = new Color(16733525); + } else { + color = new Color(5635925); + } + break; + case 2: + color = ((HUD) Myau.moduleManager.modules.get(HUD.class)).getColor(System.currentTimeMillis()); + } + RenderUtil.enableRenderState(); + RenderUtil.drawEntityBox(this.target, color.getRed(), color.getGreen(), color.getBlue()); + RenderUtil.disableRenderState(); + } + } + } + + @EventTarget + public void onLoadWorld(LoadWorldEvent event) { + this.farList.clear(); + this.nearList.clear(); + } +} + + + +package myau.module.modules; + +import myau.module.Module; +import myau.property.properties.BooleanProperty; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.util.BlockPos; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class AntiObbyTrap extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + public final BooleanProperty setAir = new BooleanProperty("set-air", true); + + public AntiObbyTrap() { + super("AntiObbyTrap", false); + } + + public boolean isInsideBlock(World world, BlockPos blockPos) { + IBlockState blockState = world.getBlockState(blockPos); + Block block = blockState.getBlock(); + if (block.getMaterial().isSolid() && block.isFullBlock()) { + Vec3 hitVec = new Vec3(mc.thePlayer.posX, mc.thePlayer.posY + (double) mc.thePlayer.getEyeHeight(), mc.thePlayer.posZ); + return block.getCollisionBoundingBox(mc.theWorld, blockPos, blockState).isVecInside(hitVec); + } else { + return false; + } + } +} + + + +package myau.module.modules; + +import myau.module.Module; + +public class AntiObfuscate extends Module { + public AntiObfuscate() { + super("AntiObfuscate", false, true); + } + + public String stripObfuscated(String input) { + if (input == null) { + return null; + } + return input.replaceAll("§k", ""); + } +} + + + +package myau.module.modules; + +import com.google.common.base.CaseFormat; +import myau.Myau; +import myau.enums.BlinkModules; +import myau.event.EventTarget; +import myau.event.types.Priority; +import myau.events.KeyEvent; +import myau.events.PlayerUpdateEvent; +import myau.module.Module; +import myau.util.PlayerUtil; +import myau.util.RandomUtil; +import myau.property.properties.FloatProperty; +import myau.property.properties.ModeProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemEnderPearl; +import net.minecraft.item.ItemStack; +import net.minecraft.network.play.client.C03PacketPlayer.C04PacketPlayerPosition; +import net.minecraft.util.AxisAlignedBB; + +public class AntiVoid extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private boolean isInVoid = false; + private boolean wasInVoid = false; + private double[] lastSafePosition = null; + public final ModeProperty mode = new ModeProperty("mode", 0, new String[]{"BLINK"}); + public final FloatProperty distance = new FloatProperty("distance", 5.0F, 0.0F, 16.0F); + + private void resetBlink() { + Myau.blinkManager.setBlinkState(false, BlinkModules.ANTI_VOID); + this.lastSafePosition = null; + } + + private boolean canUseAntiVoid() { + LongJump longJump = (LongJump) Myau.moduleManager.modules.get(LongJump.class); + return !longJump.isJumping(); + } + + public AntiVoid() { + super("AntiVoid", false); + } + + @EventTarget(Priority.LOWEST) + public void onUpdate(PlayerUpdateEvent event) { + if (this.isEnabled()) { + this.isInVoid = !mc.thePlayer.capabilities.allowFlying && PlayerUtil.isInWater(); + if (this.mode.getValue() == 0) { + if (!this.isInVoid) { + this.resetBlink(); + } + if (this.lastSafePosition != null) { + float subWidth = mc.thePlayer.width / 2.0F; + float height = mc.thePlayer.height; + if (PlayerUtil.checkInWater( + new AxisAlignedBB( + this.lastSafePosition[0] - (double) subWidth, + this.lastSafePosition[1], + this.lastSafePosition[2] - (double) subWidth, + this.lastSafePosition[0] + (double) subWidth, + this.lastSafePosition[1] + (double) height, + this.lastSafePosition[2] + (double) subWidth + ) + )) { + this.resetBlink(); + } + } + if (!this.wasInVoid && this.isInVoid && this.canUseAntiVoid()) { + Myau.blinkManager.setBlinkState(false, BlinkModules.AUTO_BLOCK); + if (Myau.blinkManager.setBlinkState(true, BlinkModules.ANTI_VOID)) { + this.lastSafePosition = new double[]{mc.thePlayer.prevPosX, mc.thePlayer.prevPosY, mc.thePlayer.prevPosZ}; + } + } + if (Myau.blinkManager.getBlinkingModule() == BlinkModules.ANTI_VOID + && this.lastSafePosition != null + && this.lastSafePosition[1] - (double) this.distance.getValue().floatValue() > mc.thePlayer.posY) { + Myau.blinkManager + .blinkedPackets + .offerFirst( + new C04PacketPlayerPosition( + this.lastSafePosition[0], this.lastSafePosition[1] - RandomUtil.nextDouble(10.0, 20.0), this.lastSafePosition[2], false + ) + ); + this.resetBlink(); + } + } + this.wasInVoid = this.isInVoid; + } + } + + @EventTarget + public void onKey(KeyEvent event) { + if (event.getKey() == mc.gameSettings.keyBindUseItem.getKeyCode()) { + ItemStack currentItem = mc.thePlayer.inventory.getCurrentItem(); + if (currentItem != null && currentItem.getItem() instanceof ItemEnderPearl) { + this.resetBlink(); + } + } + } + + @Override + public void onEnabled() { + this.isInVoid = false; + this.wasInVoid = false; + this.resetBlink(); + } + + @Override + public void onDisabled() { + Myau.blinkManager.setBlinkState(false, BlinkModules.ANTI_VOID); + } + + @Override + public void verifyValue(String mode) { + if (this.isEnabled()) { + this.onDisabled(); + } + } + + @Override + public String[] getSuffix() { + return new String[]{CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, this.mode.getModeString())}; + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.event.types.Priority; +import myau.events.TickEvent; +import myau.module.Module; +import myau.property.properties.BooleanProperty; +import myau.property.properties.IntProperty; +import myau.util.ItemUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.MovingObjectPosition; + +public class AutoAnduril extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private int previousSlot = -1; + private int currentSlot = -1; + private int intervalTick = -1; + private int holdTick = -1; + public final IntProperty interval = new IntProperty("interval", 40, 0, 100); + public final IntProperty hold = new IntProperty("hold", 1, 0, 20); + public final BooleanProperty speedCheck = new BooleanProperty("speed-check", false); + public final IntProperty debug = new IntProperty("debug", 0, 0, 9); + + public AutoAnduril() { + super("AutoAnduril", false); + } + + public boolean canSwap() { + if (mc.objectMouseOver != null + && mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK + && mc.gameSettings.keyBindAttack.isKeyDown()) return false; + ItemStack currentItem = mc.thePlayer.inventory.getStackInSlot(mc.thePlayer.inventory.currentItem); + if (currentItem != null) { + if (currentItem.getItem() instanceof ItemBlock && mc.gameSettings.keyBindUseItem.isKeyDown()) return false; + if (!(currentItem.getItem() instanceof ItemSword) && mc.thePlayer.isUsingItem()) return false; + } + InvWalk invWalk = (InvWalk) Myau.moduleManager.modules.get(InvWalk.class); + return mc.currentScreen == null || mc.currentScreen instanceof myau.ui.ClickGui + || invWalk.isEnabled() && invWalk.canInvWalk(); + } + + public boolean hasSpeed() { + if (!speedCheck.getValue()) return false; + PotionEffect potionEffect = mc.thePlayer.getActivePotionEffect(Potion.moveSpeed); + if (potionEffect == null) return false; + return (potionEffect.getAmplifier() > 0); + } + + @EventTarget(Priority.LOWEST) + public void onTick(TickEvent event) { + if (this.isEnabled() && event.getType() == EventType.PRE) { + if (this.currentSlot != -1 && this.currentSlot != mc.thePlayer.inventory.currentItem) { + this.currentSlot = -1; + this.previousSlot = -1; + this.intervalTick = interval.getValue(); + this.holdTick = -1; + } + + if (this.intervalTick > 0) { + this.intervalTick--; + } else if (intervalTick == 0) { + if (canSwap() && !hasSpeed()) { + int slot = ItemUtil.findAndurilHotbarSlot(mc.thePlayer.inventory.currentItem); + if (debug.getValue() != 0 && slot == -1) slot = debug.getValue() - 1; + if (slot != -1 && slot != mc.thePlayer.inventory.currentItem) { + this.previousSlot = mc.thePlayer.inventory.currentItem; + this.currentSlot = mc.thePlayer.inventory.currentItem = slot; + this.intervalTick = -1; + this.holdTick = hold.getValue(); + return; + } else { + this.intervalTick = interval.getValue(); + this.holdTick = -1; + } + } + } + if (this.holdTick > 0) { + this.holdTick--; + } else if (holdTick == 0) { + if (this.previousSlot != -1 && canSwap()) { + mc.thePlayer.inventory.currentItem = this.previousSlot; + this.previousSlot = -1; + this.holdTick = -1; + this.intervalTick = interval.getValue(); + } + } + } + } + + @Override + public void onEnabled() { + this.previousSlot = -1; + this.currentSlot = -1; + this.intervalTick = this.interval.getValue(); + this.holdTick = -1; + } + + @Override + public void onDisabled() { + this.previousSlot = -1; + this.currentSlot = -1; + this.intervalTick = -1; + this.holdTick = -1; + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.event.types.Priority; +import myau.events.*; +import myau.management.RotationState; +import myau.module.Module; +import myau.property.properties.BooleanProperty; +import myau.property.properties.FloatProperty; +import myau.property.properties.IntProperty; +import myau.property.properties.ModeProperty; +import myau.util.MoveUtil; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.*; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.*; +import java.util.List; +import java.util.Queue; + +public class AutoBlockIn extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private final Map BLOCK_SCORE = new HashMap<>(); + private long lastPlaceTime = 0; + + public final FloatProperty range = new FloatProperty("range", 4.5f, 3.0f, 6.0f); + public final IntProperty speed = new IntProperty("speed", 20, 5, 100); + public final IntProperty placeDelay = new IntProperty("place-delay", 50, 0, 200); + public final IntProperty rotationTolerance = new IntProperty("rotation-tolerance", 25, 5, 100); + public final BooleanProperty itemSpoof = new BooleanProperty("item-spoof", true); + public final BooleanProperty showProgress = new BooleanProperty("show-progress", true); + public final ModeProperty moveFix = new ModeProperty("move-fix", 1, new String[]{"NONE", "SILENT", "STRICT"}); + + private float serverYaw; + private float serverPitch; + private float progress; + private float aimYaw; + private float aimPitch; + private BlockPos targetBlock; + private EnumFacing targetFacing; + private Vec3 targetHitVec; + private int lastSlot = -1; + + private static final int[][] DIRS = {{1,0,0}, {0,0,1}, {-1,0,0}, {0,0,-1}}; + private static final double INSET = 0.05; + private static final double STEP = 0.2; + private static final double JIT = STEP * 0.1; + + public AutoBlockIn() { + super("AutoBlockIn", false); + + BLOCK_SCORE.put("obsidian", 0); + BLOCK_SCORE.put("end_stone", 1); + BLOCK_SCORE.put("planks", 2); + BLOCK_SCORE.put("log", 2); + BLOCK_SCORE.put("glass", 3); + BLOCK_SCORE.put("stained_glass", 3); + BLOCK_SCORE.put("hardened_clay", 4); + BLOCK_SCORE.put("stained_hardened_clay", 4); + BLOCK_SCORE.put("cloth", 5); + } + + @Override + public void onEnabled() { + if (mc.thePlayer != null) { + serverYaw = mc.thePlayer.rotationYaw; + serverPitch = mc.thePlayer.rotationPitch; + aimYaw = serverYaw; + aimPitch = serverPitch; + progress = 0; + lastSlot = mc.thePlayer.inventory.currentItem; + targetBlock = null; + targetFacing = null; + targetHitVec = null; + lastPlaceTime = 0; + } + } + + @Override + public void onDisabled() { + if (lastSlot != -1 && mc.thePlayer != null && mc.thePlayer.inventory.currentItem != lastSlot) { + mc.thePlayer.inventory.currentItem = lastSlot; + } + progress = 0; + targetBlock = null; + targetFacing = null; + targetHitVec = null; + } + + @EventTarget(Priority.HIGH) + public void onUpdate(UpdateEvent event) { + if (!isEnabled()) return; + if (event.getType() != EventType.PRE) return; + if (mc.thePlayer == null || mc.theWorld == null) return; + + if (mc.currentScreen != null) { + return; + } + + serverYaw = event.getYaw(); + serverPitch = event.getPitch(); + + updateProgress(); + + int blockSlot = findBestBlockSlot(); + + if (blockSlot != -1) { + if (mc.thePlayer.inventory.currentItem != blockSlot) { + mc.thePlayer.inventory.currentItem = blockSlot; + } + } + + ItemStack currentHeld = mc.thePlayer.inventory.getCurrentItem(); + boolean holdingBlock = currentHeld != null && currentHeld.getItem() instanceof ItemBlock; + if (!holdingBlock) { + targetBlock = null; + targetFacing = null; + targetHitVec = null; + return; + } + + findBestPlacement(); + + if (targetBlock != null && targetFacing != null && targetHitVec != null) { + Vec3 eyes = mc.thePlayer.getPositionEyes(1.0f); + double dx = targetHitVec.xCoord - eyes.xCoord; + double dy = targetHitVec.yCoord - eyes.yCoord; + double dz = targetHitVec.zCoord - eyes.zCoord; + double dist = Math.sqrt(dx * dx + dz * dz); + + float targetYaw = (float)Math.toDegrees(Math.atan2(dz, dx)) - 90.0f; + float targetPitch = (float)-Math.toDegrees(Math.atan2(dy, dist)); + + targetYaw = MathHelper.wrapAngleTo180_float(targetYaw); + + float yawDiff = MathHelper.wrapAngleTo180_float(targetYaw - serverYaw); + float pitchDiff = targetPitch - serverPitch; + + float maxTurn = speed.getValue().floatValue(); + float yawStep = MathHelper.clamp_float(yawDiff, -maxTurn, maxTurn); + float pitchStep = MathHelper.clamp_float(pitchDiff, -maxTurn, maxTurn); + + aimYaw = serverYaw + yawStep; + aimPitch = MathHelper.clamp_float(serverPitch + pitchStep, -90.0f, 90.0f); + + event.setRotation(aimYaw, aimPitch, 6); + event.setPervRotation(this.moveFix.getValue() != 0 ? aimYaw : mc.thePlayer.rotationYaw, 6); + } + } + + @EventTarget + public void onMove(MoveInputEvent event) { + if (this.isEnabled()) { + if (this.moveFix.getValue() == 1 + && RotationState.isActived() + && RotationState.getPriority() == 6 + && MoveUtil.isForwardPressed()) { + MoveUtil.fixStrafe(RotationState.getSmoothedYaw()); + } + } + } + + @EventTarget(Priority.HIGH) + public void onTick(TickEvent event) { + if (!isEnabled()) return; + if (event.getType() != EventType.PRE) return; + if (mc.thePlayer == null || mc.theWorld == null) return; + + if (mc.currentScreen != null) { + return; + } + + if (targetBlock != null && targetFacing != null && targetHitVec != null) { + if (!withinRotationTolerance(aimYaw, aimPitch)) { + return; + } + + long currentTime = System.currentTimeMillis(); + if (currentTime - lastPlaceTime >= placeDelay.getValue()) { + lastPlaceTime = currentTime; + + MovingObjectPosition mop = rayTraceBlock(aimYaw, aimPitch, range.getValue()); + + if (mop != null + && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK + && mop.getBlockPos().equals(targetBlock) + && mop.sideHit == targetFacing) { + + ItemStack heldStack = mc.thePlayer.inventory.getCurrentItem(); + if (heldStack != null && heldStack.getItem() instanceof ItemBlock) { + mc.playerController.onPlayerRightClick( + mc.thePlayer, + mc.theWorld, + heldStack, + targetBlock, + targetFacing, + mop.hitVec); + mc.thePlayer.swingItem(); + + targetBlock = null; + targetFacing = null; + targetHitVec = null; + } + } + } + } + } + + @EventTarget + public void onSwap(SwapItemEvent event) { + if (this.isEnabled()) { + lastSlot = event.setSlot(lastSlot); + event.setCancelled(true); + } + } + + @EventTarget + public void onRender2D(Render2DEvent event) { + if (!isEnabled() || mc.currentScreen != null) return; + if (!showProgress.getValue()) return; + if (mc.fontRendererObj == null) return; + + float scale = 1.0f; + String text = String.format("Blocking: %.0f%%", progress * 100.0F); + + GL11.glPushMatrix(); + GL11.glScaled((double)scale, (double)scale, 0.0); + GlStateManager.disableDepth(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + + ScaledResolution sr = new ScaledResolution(mc); + int width = mc.fontRendererObj.getStringWidth(text); + + Color color = getProgressColor(); + + mc.fontRendererObj.drawString( + text, + (float) sr.getScaledWidth() / 2.0F / scale - (float) width / 2.0F, + (float) sr.getScaledHeight() / 5.0F * 2.0F / scale, + color.getRGB() & 16777215 | -1090519040, + true + ); + + GlStateManager.disableBlend(); + GlStateManager.enableDepth(); + GL11.glPopMatrix(); + } + + private int findBestBlockSlot() { + int bestSlot = -1; + int bestScore = Integer.MAX_VALUE; + + for (int slot = 0; slot <= 8; slot++) { + ItemStack stack = mc.thePlayer.inventory.getStackInSlot(slot); + if (stack == null || stack.stackSize == 0) continue; + + if (stack.getItem() instanceof ItemBlock) { + Block block = ((ItemBlock) stack.getItem()).getBlock(); + String blockName = block.getUnlocalizedName().replace("tile.", ""); + + Integer score = BLOCK_SCORE.get(blockName); + if (score != null && score < bestScore) { + bestScore = score; + bestSlot = slot; + if (score == 0) break; + } + } + } + + return bestSlot; + } + + private void findBestPlacement() { + Vec3 playerPos = mc.thePlayer.getPositionVector(); + BlockPos feetPos = new BlockPos(playerPos.xCoord, playerPos.yCoord, playerPos.zCoord); + + Vec3 eye = mc.thePlayer.getPositionEyes(1.0f); + double reach = range.getValue().doubleValue(); + double reachSq = reach * reach; + double rp12 = (reach + 1) * (reach + 1); + + BlockPos roofTarget = feetPos.up(2); + + if (!isAir(roofTarget)) { + sidesAim(eye, reach, feetPos); + return; + } + + List supports = new ArrayList<>(); + + int minX = (int) Math.floor(eye.xCoord - reach); + int maxX = (int) Math.floor(eye.xCoord + reach); + int minY = (int) Math.floor(eye.yCoord - 1); + int maxY = (int) Math.floor(eye.yCoord + reach); + int minZ = (int) Math.floor(eye.zCoord - reach); + int maxZ = (int) Math.floor(eye.zCoord + reach); + + for (int x = minX; x <= maxX; x++) { + for (int y = minY; y <= maxY; y++) { + for (int z = minZ; z <= maxZ; z++) { + BlockPos p = new BlockPos(x, y, z); + if (isAir(p)) continue; + + double dx = (x + 0.5) - eye.xCoord; + double dy = (y + 0.5) - eye.yCoord; + double dz = (z + 0.5) - eye.zCoord; + if (dx*dx + dy*dy + dz*dz > rp12) continue; + + double d2 = dist2PointAABB(eye, x, y, z); + if (d2 > reachSq) continue; + + Vec3 mid = new Vec3(x + 0.5, y + 0.5, z + 0.5); + MovingObjectPosition mop = mc.theWorld.rayTraceBlocks(eye, mid, false, false, false); + if (mop == null) continue; + if (!mop.getBlockPos().equals(p)) continue; + + supports.add(new BlockData(p, d2)); + } + } + } + if (supports.isEmpty()) { + sidesAim(eye, reach, feetPos); + return; + } + supports.sort(Comparator.comparingDouble(a -> a.distance)); + for (BlockData bd : supports) { + if (tryPlaceOnBlock(bd.pos, eye, reach, roofTarget)) { + return; + } + } + Queue q = new LinkedList<>(); + Map parent = new HashMap<>(); + Set visited = new HashSet<>(); + for (BlockData bd : supports) { + BlockPos sup = bd.pos; + for (EnumFacing f : EnumFacing.values()) { + BlockPos node = sup.offset(f); + if (!isAir(node)) continue; + if (visited.contains(node)) continue; + visited.add(node); + parent.put(node, null); + q.add(node); + } + } + BlockPos endNode = null; + int nodesSeen = 0; + while (!q.isEmpty() && nodesSeen < 8964) { + BlockPos cur = q.poll(); + nodesSeen++; + if (cur.distanceSq(roofTarget) <= 1.5) { + endNode = cur; + break; + } + for (EnumFacing f : EnumFacing.values()) { + BlockPos nxt = cur.offset(f); + if (visited.contains(nxt)) continue; + if (!isAir(nxt)) continue; + visited.add(nxt); + parent.put(nxt, cur); + q.add(nxt); + } + } + + if (endNode == null) { + sidesAim(eye, reach, feetPos); + return; + } + + List path = new ArrayList<>(); + for (BlockPos cur = endNode; cur != null; cur = parent.get(cur)) { + path.add(cur); + } + Collections.reverse(path); + + for (BlockPos place : path) { + if (!isAir(place)) continue; + + boolean placedThis = false; + for (BlockData bd : supports) { + BlockPos sup = bd.pos; + if (!isAdjacent(sup, place)) continue; + if (tryPlaceOnBlock(sup, eye, reach, place)) { + return; + } + } + for (EnumFacing f : EnumFacing.values()) { + BlockPos sup = place.offset(f); + if (isAir(sup)) continue; + if (tryPlaceOnBlock(sup, eye, reach, place)) { + return; + } + } + if (placedThis) break; + } + sidesAim(eye, reach, feetPos); + } + + private boolean isAdjacent(BlockPos a, BlockPos b) { + int dx = Math.abs(a.getX() - b.getX()); + int dy = Math.abs(a.getY() - b.getY()); + int dz = Math.abs(a.getZ() - b.getZ()); + return (dx + dy + dz) == 1; + } + + + private boolean tryPlaceOnBlock(BlockPos supportBlock, Vec3 eye, double reach, BlockPos targetPos) { + // Try all 6 faces of support block + for (EnumFacing facing : EnumFacing.values()) { + BlockPos placementPos = supportBlock.offset(facing); + + // Check if placement would be at target + if (!placementPos.equals(targetPos)) continue; + + // Generate candidate hit points on this face + int n = (int) Math.round(1 / STEP); + + for (int r = 0; r <= n; r++) { + double v = r * STEP + (Math.random() * JIT * 2 - JIT); + if (v < 0) v = 0; else if (v > 1) v = 1; + + for (int c = 0; c <= n; c++) { + double u = c * STEP + (Math.random() * JIT * 2 - JIT); + if (u < 0) u = 0; else if (u > 1) u = 1; + + Vec3 hitPos = getHitPosOnFace(supportBlock, facing, u, v); + float[] rot = getRotationsWrapped(eye, hitPos.xCoord, hitPos.yCoord, hitPos.zCoord); + + MovingObjectPosition mop = rayTraceBlock(rot[0], rot[1], reach); + if (mop != null + && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK + && mop.getBlockPos().equals(supportBlock) + && mop.sideHit == facing) { + + targetBlock = supportBlock; + targetFacing = facing; + targetHitVec = mop.hitVec; + aimYaw = rot[0]; + aimPitch = rot[1]; + return true; + } + } + } + } + + return false; + } + + private void sidesAim(Vec3 eye, double reach, BlockPos feetPos) { + List goals = new ArrayList<>(); + + for (int[] d : DIRS) { + BlockPos headPos = feetPos.add(d[0], 1, d[2]); + if (isAir(headPos)) { + goals.add(headPos); + } + } + + for (int[] d : DIRS) { + BlockPos feetGoal = feetPos.add(d[0], 0, d[2]); + if (isAir(feetGoal)) { + goals.add(feetGoal); + } + } + + findBestForGoals(goals, eye, reach); + } + + private void findBestForGoals(List goals, Vec3 eye, double reach) { + for (BlockPos goal : goals) { + for (EnumFacing facing : EnumFacing.values()) { + BlockPos support = goal.offset(facing); + + if (isAir(support)) continue; + + Vec3 center = new Vec3(support.getX() + 0.5, support.getY() + 0.5, support.getZ() + 0.5); + if (eye.distanceTo(center) > reach) continue; + + // Try placement + int n = (int) Math.round(1 / STEP); + for (int r = 0; r <= n; r++) { + double v = r * STEP + (Math.random() * JIT * 2 - JIT); + if (v < 0) v = 0; else if (v > 1) v = 1; + + for (int c = 0; c <= n; c++) { + double u = c * STEP + (Math.random() * JIT * 2 - JIT); + if (u < 0) u = 0; else if (u > 1) u = 1; + + Vec3 hitPos = getHitPosOnFace(support, facing.getOpposite(), u, v); + float[] rot = getRotationsWrapped(eye, hitPos.xCoord, hitPos.yCoord, hitPos.zCoord); + + MovingObjectPosition mop = rayTraceBlock(rot[0], rot[1], reach); + if (mop != null + && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK + && mop.getBlockPos().equals(support) + && mop.sideHit == facing.getOpposite()) { + + targetBlock = support; + targetFacing = facing.getOpposite(); + targetHitVec = mop.hitVec; + aimYaw = rot[0]; + aimPitch = rot[1]; + return; + } + } + } + } + } + } + + private Vec3 getHitPosOnFace(BlockPos block, EnumFacing face, double u, double v) { + double x = block.getX() + 0.5; + double y = block.getY() + 0.5; + double z = block.getZ() + 0.5; + + switch (face) { + case DOWN: + y = block.getY() + INSET; + x = block.getX() + u; + z = block.getZ() + v; + break; + case UP: + y = block.getY() + 1.0 - INSET; + x = block.getX() + u; + z = block.getZ() + v; + break; + case NORTH: + z = block.getZ() + INSET; + x = block.getX() + u; + y = block.getY() + v; + break; + case SOUTH: + z = block.getZ() + 1.0 - INSET; + x = block.getX() + u; + y = block.getY() + v; + break; + case WEST: + x = block.getX() + INSET; + z = block.getZ() + u; + y = block.getY() + v; + break; + case EAST: + x = block.getX() + 1.0 - INSET; + z = block.getZ() + u; + y = block.getY() + v; + break; + } + + return new Vec3(x, y, z); + } + + private boolean isAir(BlockPos pos) { + Block block = mc.theWorld.getBlockState(pos).getBlock(); + return block == Blocks.air + || block == Blocks.water + || block == Blocks.flowing_water + || block == Blocks.lava + || block == Blocks.flowing_lava + || block == Blocks.fire; + } + + private void updateProgress() { + Vec3 playerPos = mc.thePlayer.getPositionVector(); + BlockPos feetPos = new BlockPos(playerPos.xCoord, playerPos.yCoord, playerPos.zCoord); + + int filled = 0; + int total = 9; + + if (!isAir(feetPos.up(2))) { + filled++; + } + + for (int[] d : DIRS) { + if (!isAir(feetPos.add(d[0], 0, d[2]))) { + filled++; + } + if (!isAir(feetPos.add(d[0], 1, d[2]))) { + filled++; + } + } + + progress = (float) filled / (float) total; + } + + private Color getProgressColor() { + if (progress <= 0.33f) { + return new Color(255, 85, 85); + } else if (progress <= 0.66f) { + return new Color(255, 255, 85); + } else { + return new Color(85, 255, 85); + } + } + + private MovingObjectPosition rayTraceBlock(float yaw, float pitch, double range) { + float yawRad = (float) Math.toRadians(yaw); + float pitchRad = (float) Math.toRadians(pitch); + + double x = -Math.sin(yawRad) * Math.cos(pitchRad); + double y = -Math.sin(pitchRad); + double z = Math.cos(yawRad) * Math.cos(pitchRad); + + Vec3 start = mc.thePlayer.getPositionEyes(1.0f); + Vec3 end = start.addVector(x * range, y * range, z * range); + + return mc.theWorld.rayTraceBlocks(start, end); + } + + private boolean withinRotationTolerance(float targetYaw, float targetPitch) { + float dy = Math.abs(MathHelper.wrapAngleTo180_float(targetYaw - serverYaw)); + float dp = Math.abs(MathHelper.wrapAngleTo180_float(targetPitch - serverPitch)); + return dy <= rotationTolerance.getValue() && dp <= rotationTolerance.getValue(); + } + + private double dist2PointAABB(Vec3 p, int x, int y, int z) { + double minX = x, maxX = x + 1; + double minY = y, maxY = y + 1; + double minZ = z, maxZ = z + 1; + + double cx = clamp(p.xCoord, minX, maxX); + double cy = clamp(p.yCoord, minY, maxY); + double cz = clamp(p.zCoord, minZ, maxZ); + + double dx = p.xCoord - cx; + double dy = p.yCoord - cy; + double dz = p.zCoord - cz; + + return dx*dx + dy*dy + dz*dz; + } + + private double clamp(double v, double lo, double hi) { + return v < lo ? lo : (v > hi ? hi : v); + } + + private float[] getRotationsWrapped(Vec3 eye, double tx, double ty, double tz) { + double dx = tx - eye.xCoord; + double dy = ty - eye.yCoord; + double dz = tz - eye.zCoord; + double hd = Math.sqrt(dx*dx + dz*dz); + + float yaw = (float) Math.toDegrees(Math.atan2(dz, dx)) - 90.0f; + yaw = normYaw(yaw); + + float pitch = (float) Math.toDegrees(-Math.atan2(dy, hd)); + + return new float[]{yaw, pitch}; + } + + private float normYaw(float yaw) { + yaw = ((yaw % 360f) + 360f) % 360f; + return (yaw > 180f) ? (yaw - 360f) : yaw; + } + + public int getSlot() { + return lastSlot; + } + + private static class BlockData { + BlockPos pos; + double distance; + + BlockData(BlockPos pos, double distance) { + this.pos = pos; + this.distance = distance; + } + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.event.types.Priority; +import myau.events.LeftClickMouseEvent; +import myau.events.TickEvent; +import myau.module.Module; +import myau.util.*; +import myau.property.properties.BooleanProperty; +import myau.property.properties.FloatProperty; +import myau.property.properties.IntProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.MovingObjectPosition.MovingObjectType; +import net.minecraft.world.WorldSettings.GameType; + +import java.util.Objects; + +public class AutoClicker extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private boolean clickPending = false; + private long clickDelay = 0L; + private boolean blockHitPending = false; + private long blockHitDelay = 0L; + public final IntProperty minCPS = new IntProperty("min-cps", 8, 1, 20); + public final IntProperty maxCPS = new IntProperty("max-cps", 12, 1, 20); + public final BooleanProperty blockHit = new BooleanProperty("block-hit", false); + public final FloatProperty blockHitTicks = new FloatProperty("block-hit-ticks", 1.5F, 1.0F, 20.0F, this.blockHit::getValue); + public final BooleanProperty weaponsOnly = new BooleanProperty("weapons-only", true); + public final BooleanProperty allowTools = new BooleanProperty("allow-tools", false, this.weaponsOnly::getValue); + public final BooleanProperty breakBlocks = new BooleanProperty("break-blocks", true); + public final FloatProperty range = new FloatProperty("range", 3.0F, 3.0F, 8.0F, this.breakBlocks::getValue); + public final FloatProperty hitBoxVertical = new FloatProperty("hit-box-vertical", 0.1F, 0.0F, 1.0F, this.breakBlocks::getValue); + public final FloatProperty hitBoxHorizontal = new FloatProperty("hit-box-horizontal", 0.2F, 0.0F, 1.0F, this.breakBlocks::getValue); + + private long getNextClickDelay() { + return 1000L / RandomUtil.nextLong(this.minCPS.getValue(), this.maxCPS.getValue()); + } + + private long getBlockHitDelay() { + return (long) (50.0F * this.blockHitTicks.getValue()); + } + + private boolean isBreakingBlock() { + return mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectType.BLOCK; + } + + private boolean canClick() { + if (!this.weaponsOnly.getValue() + || ItemUtil.hasRawUnbreakingEnchant() + || this.allowTools.getValue() && ItemUtil.isHoldingTool()) { + if (this.breakBlocks.getValue() && this.isBreakingBlock() && !this.hasValidTarget()) { + GameType gameType12 = mc.playerController.getCurrentGameType(); + return gameType12 != GameType.SURVIVAL && gameType12 != GameType.CREATIVE; + } else { + return true; + } + } else { + return false; + } + } + + private boolean isValidTarget(EntityPlayer entityPlayer) { + if (entityPlayer != mc.thePlayer && entityPlayer != mc.thePlayer.ridingEntity) { + if (entityPlayer == mc.getRenderViewEntity() || entityPlayer == mc.getRenderViewEntity().ridingEntity) { + return false; + } else if (entityPlayer.deathTime > 0) { + return false; + } else { + float borderSize = entityPlayer.getCollisionBorderSize(); + return RotationUtil.rayTrace(entityPlayer.getEntityBoundingBox().expand( + borderSize + this.hitBoxHorizontal.getValue(), + borderSize + this.hitBoxVertical.getValue(), + borderSize + this.hitBoxHorizontal.getValue() + ), mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, this.range.getValue()) != null; + } + } else { + return false; + } + } + + private boolean hasValidTarget() { + return mc.theWorld + .loadedEntityList + .stream() + .filter(e -> e instanceof EntityPlayer) + .map(e -> (EntityPlayer) e) + .anyMatch(this::isValidTarget); + } + + public AutoClicker() { + super("AutoClicker", false); + } + + @EventTarget + public void onTick(TickEvent event) { + if (event.getType() == EventType.PRE) { + if (this.clickDelay > 0L) { + this.clickDelay -= 50L; + } + if (this.blockHitDelay > 0L) { + this.blockHitDelay -= 50L; + } + if (mc.currentScreen != null) { + this.clickPending = false; + this.blockHitPending = false; + } else { + if (this.clickPending) { + this.clickPending = false; + KeyBindUtil.updateKeyState(mc.gameSettings.keyBindAttack.getKeyCode()); + } + if (this.blockHitPending) { + this.blockHitPending = false; + KeyBindUtil.updateKeyState(mc.gameSettings.keyBindUseItem.getKeyCode()); + } + if (this.isEnabled() && this.canClick() && mc.gameSettings.keyBindAttack.isKeyDown()) { + if (!mc.thePlayer.isUsingItem()) { + while (this.clickDelay <= 0L) { + this.clickPending = true; + this.clickDelay = this.clickDelay + this.getNextClickDelay(); + KeyBindUtil.setKeyBindState(mc.gameSettings.keyBindAttack.getKeyCode(), false); + KeyBindUtil.pressKeyOnce(mc.gameSettings.keyBindAttack.getKeyCode()); + } + } + if (this.blockHit.getValue() + && this.blockHitDelay <= 0L + && mc.gameSettings.keyBindUseItem.isKeyDown() + && ItemUtil.isHoldingSword()) { + this.blockHitPending = true; + KeyBindUtil.setKeyBindState(mc.gameSettings.keyBindUseItem.getKeyCode(), false); + if (!mc.thePlayer.isUsingItem()) { + this.blockHitDelay = this.blockHitDelay + this.getBlockHitDelay(); + KeyBindUtil.pressKeyOnce(mc.gameSettings.keyBindUseItem.getKeyCode()); + } + } + } + } + } + } + + @EventTarget(Priority.LOWEST) + public void onCLick(LeftClickMouseEvent event) { + if (this.isEnabled() && !event.isCancelled()) { + if (!this.clickPending) { + this.clickDelay = this.clickDelay + this.getNextClickDelay(); + } + } + } + + @Override + public void onEnabled() { + this.clickDelay = 0L; + this.blockHitDelay = 0L; + } + + @Override + public void verifyValue(String mode) { + if (this.minCPS.getName().equals(mode)) { + if (this.minCPS.getValue() > this.maxCPS.getValue()) { + this.maxCPS.setValue(this.minCPS.getValue()); + } + } else { + if (this.maxCPS.getName().equals(mode) && this.minCPS.getValue() > this.maxCPS.getValue()) { + this.minCPS.setValue(this.maxCPS.getValue()); + } + } + } + + @Override + public String[] getSuffix() { + return Objects.equals(this.minCPS.getValue(), this.maxCPS.getValue()) + ? new String[]{this.minCPS.getValue().toString()} + : new String[]{String.format("%d-%d", this.minCPS.getValue(), this.maxCPS.getValue())}; + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.event.types.Priority; +import myau.events.*; +import myau.mixin.IAccessorPlayerControllerMP; +import myau.module.Module; +import myau.util.PacketUtil; +import myau.util.TimerUtil; +import myau.property.properties.BooleanProperty; +import myau.property.properties.PercentProperty; +import myau.property.properties.IntProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemFood; +import net.minecraft.item.ItemSkull; +import net.minecraft.item.ItemSoup; +import net.minecraft.item.ItemStack; +import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; +import net.minecraft.potion.Potion; + +public class AutoHeal extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private final TimerUtil timer = new TimerUtil(); + private boolean shouldHeal = false; + private int prevSlot = -1; + private int hurtTick = 0; + public final PercentProperty health = new PercentProperty("health", 35); + public final IntProperty delay = new IntProperty("delay", 4000, 0, 5000); + public final BooleanProperty regenCheck = new BooleanProperty("regen-check", false); + public final BooleanProperty hurtCheck = new BooleanProperty("hurt-check", false); + public final IntProperty hurtTime = new IntProperty("hurt-time", 20, 1, 100, hurtCheck::getValue); + + private int findHealingItem() { + for (int i = 0; i < 9; i++) { + ItemStack stack = mc.thePlayer.inventory.getStackInSlot(i); + if (stack != null && stack.hasDisplayName()) { + String name = stack.getDisplayName(); + if (stack.getItem() instanceof ItemSkull && name.contains("§6") && name.contains("Golden Head")) { + return i; + } + } + } + for (int i = 0; i < 9; i++) { + ItemStack stack = mc.thePlayer.inventory.getStackInSlot(i); + if (stack != null && stack.hasDisplayName()) { + String name = stack.getDisplayName(); + if (stack.getItem() instanceof ItemSkull && name.matches("\\S+§c's Head")) { + return i; + } + } + } + for (int i = 0; i < 9; i++) { + ItemStack stack = mc.thePlayer.inventory.getStackInSlot(i); + if (stack != null && stack.hasDisplayName()) { + String name = stack.getDisplayName(); + if (stack.getItem() instanceof ItemFood && name.contains("§6Cornucopia")) { + return i; + } + if (stack.getItem() instanceof ItemSoup + && (name.contains("§a") && name.contains("Tasty Soup") || name.contains("§a") && name.contains("Assist Soup"))) { + return i; + } + } + } + return -1; + } + + private boolean hasRegenEffect() { + return this.regenCheck.getValue() && mc.thePlayer.isPotionActive(Potion.regeneration); + } + + public AutoHeal() { + super("AutoHeal", false); + } + + public boolean isSwitching() { + return this.prevSlot != -1; + } + + @EventTarget(Priority.HIGH) + public void onTick(TickEvent event) { + if (!this.isEnabled()) { + this.prevSlot = -1; + } else { + if (hurtCheck.getValue()){ + if (hurtTick > 0) hurtTick--; + if (mc.thePlayer.hurtTime > 0) { + hurtTick = hurtTime.getValue(); + } + } else { + hurtTick = 1; + } + switch (event.getType()) { + case PRE: + boolean percent = (float) Math.ceil(mc.thePlayer.getHealth() + mc.thePlayer.getAbsorptionAmount()) / mc.thePlayer.getMaxHealth() + <= (float) this.health.getValue() / 100.0F; + if (this.shouldHeal + && percent + && !this.hasRegenEffect() + && this.timer.hasTimeElapsed(this.delay.getValue()) + && hurtTick > 0) { + int slot = this.findHealingItem(); + if (slot != -1) { + this.prevSlot = mc.thePlayer.inventory.currentItem; + mc.thePlayer.inventory.currentItem = slot; + ((IAccessorPlayerControllerMP) mc.playerController).callSyncCurrentPlayItem(); + PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem())); + this.timer.reset(); + } + } + this.shouldHeal = percent; + break; + case POST: + if (this.prevSlot != -1) { + mc.thePlayer.inventory.currentItem = this.prevSlot; + this.prevSlot = -1; + } + } + } + } + + @EventTarget + public void onLeftClick(LeftClickMouseEvent event) { + if (this.isEnabled() && this.isSwitching()) { + event.setCancelled(true); + } + } + + @EventTarget + public void onRightClick(RightClickMouseEvent event) { + if (this.isEnabled() && this.isSwitching()) { + event.setCancelled(true); + } + } + + @EventTarget + public void onHitBlock(HitBlockEvent event) { + if (this.isEnabled() && this.isSwitching()) { + event.setCancelled(true); + } + } + + @EventTarget + public void onSwap(SwapItemEvent event) { + if (this.isEnabled() && this.isSwitching()) { + event.setCancelled(true); + } + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.TickEvent; +import myau.module.Module; +import myau.util.ItemUtil; +import myau.util.KeyBindUtil; +import myau.property.properties.BooleanProperty; +import myau.property.properties.IntProperty; +import myau.util.TeamUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.util.MovingObjectPosition.MovingObjectType; + +public class AutoTool extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private int currentToolSlot = -1; + private int previousSlot = -1; + private int tickDelayCounter = 0; + public final IntProperty switchDelay = new IntProperty("delay", 0, 0, 5); + public final BooleanProperty switchBack = new BooleanProperty("switch-back", true); + public final BooleanProperty sneakOnly = new BooleanProperty("sneak-only", true); + + public AutoTool() { + super("AutoTool", false); + } + + public boolean isKillAura() { + KillAura killAura = (KillAura) Myau.moduleManager.modules.get(KillAura.class); + if (!killAura.isEnabled()) return false; + return TeamUtil.isEntityLoaded(killAura.getTarget()) && killAura.isAttackAllowed(); + } + + @EventTarget + public void onTick(TickEvent event) { + if (this.isEnabled() && event.getType() == EventType.PRE) { + if (this.currentToolSlot != -1 && this.currentToolSlot != mc.thePlayer.inventory.currentItem) { + this.currentToolSlot = -1; + this.previousSlot = -1; + } + if (mc.objectMouseOver != null + && mc.objectMouseOver.typeOfHit == MovingObjectType.BLOCK + && mc.gameSettings.keyBindAttack.isKeyDown() + && !mc.thePlayer.isUsingItem() + && !isKillAura()) { + if (this.tickDelayCounter >= this.switchDelay.getValue() + && (!(Boolean) this.sneakOnly.getValue() || KeyBindUtil.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode()))) { + int slot = ItemUtil.findInventorySlot( + mc.thePlayer.inventory.currentItem, mc.theWorld.getBlockState(mc.objectMouseOver.getBlockPos()).getBlock() + ); + if (mc.thePlayer.inventory.currentItem != slot) { + if (this.previousSlot == -1) { + this.previousSlot = mc.thePlayer.inventory.currentItem; + } + mc.thePlayer.inventory.currentItem = this.currentToolSlot = slot; + } + } + this.tickDelayCounter++; + } else { + if (this.switchBack.getValue() && this.previousSlot != -1) { + mc.thePlayer.inventory.currentItem = this.previousSlot; + } + this.currentToolSlot = -1; + this.previousSlot = -1; + this.tickDelayCounter = 0; + } + } + } + + @Override + public void onDisabled() { + this.currentToolSlot = -1; + this.previousSlot = -1; + this.tickDelayCounter = 0; + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.event.EventTarget; +import myau.events.Render3DEvent; +import myau.mixin.IAccessorRenderManager; +import myau.module.Module; +import myau.util.RenderUtil; +import myau.property.properties.*; +import myau.property.properties.BooleanProperty; +import myau.property.properties.ModeProperty; +import net.minecraft.block.BlockBed; +import net.minecraft.block.BlockBed.EnumPartType; +import net.minecraft.block.BlockObsidian; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; + +import java.awt.*; +import java.util.Arrays; +import java.util.concurrent.CopyOnWriteArraySet; + +public class BedESP extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + public final CopyOnWriteArraySet beds = new CopyOnWriteArraySet<>(); + public final ModeProperty mode = new ModeProperty("mode", 0, new String[]{"DEFAULT", "FULL"}); + public final ModeProperty color = new ModeProperty("color", 0, new String[]{"CUSTOM", "HUD"}); + public final ColorProperty customColor; + public final PercentProperty opacity; + public final BooleanProperty outline; + public final BooleanProperty obsidian; + + private Color getColor() { + switch (this.color.getValue()) { + case 0: + return new Color(this.customColor.getValue()); + case 1: + return ((HUD) Myau.moduleManager.modules.get(HUD.class)).getColor(System.currentTimeMillis()); + default: + return new Color(-1); + } + } + + private void drawObsidianBox(AxisAlignedBB axisAlignedBB) { + if (this.outline.getValue()) { + RenderUtil.drawBoundingBox(axisAlignedBB, 170, 0, 170, 255, 1.5F); + } + RenderUtil.drawFilledBox(axisAlignedBB, 170, 0, 170); + } + + private void drawObsidian(BlockPos blockPos) { + if (this.outline.getValue()) { + RenderUtil.drawBlockBoundingBox(blockPos, 1.0, 170, 0, 170, 255, 1.5F); + } + RenderUtil.drawBlockBox( + blockPos, 1.0, 170, 0, 170 + ); + } + + public BedESP() { + super("BedESP", false); + this.customColor = new ColorProperty("custom-color", (int) 8085714755840333141L, () -> this.color.getValue() == 0); + this.opacity = new PercentProperty("opacity", 25); + this.outline = new BooleanProperty("outline", false); + this.obsidian = new BooleanProperty("obsidian", true); + } + + public double getHeight() { + return this.mode.getValue() == 1 ? 1.0 : 0.5625; + } + + @EventTarget + public void onRender3D(Render3DEvent event) { + if (this.isEnabled()) { + RenderUtil.enableRenderState(); + for (BlockPos blockPos : this.beds) { + IBlockState state = mc.theWorld.getBlockState(blockPos); + if (state.getBlock() instanceof BlockBed && state.getValue(BlockBed.PART) == EnumPartType.HEAD) { + BlockPos opposite = blockPos.offset(state.getValue(BlockBed.FACING).getOpposite()); + IBlockState oppositeState = mc.theWorld.getBlockState(opposite); + if (oppositeState.getBlock() instanceof BlockBed && oppositeState.getValue(BlockBed.PART) == EnumPartType.FOOT) { + if (this.obsidian.getValue()) { + for (EnumFacing facing : Arrays.asList(EnumFacing.UP, EnumFacing.NORTH, EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.WEST)) { + BlockPos offsetX = blockPos.offset(facing); + BlockPos offsetZ = opposite.offset(facing); + boolean xObsidian = mc.theWorld.getBlockState(offsetX).getBlock() instanceof BlockObsidian; + boolean zObsidian = mc.theWorld.getBlockState(offsetZ).getBlock() instanceof BlockObsidian; + if (xObsidian && zObsidian) { + this.drawObsidianBox( + new AxisAlignedBB( + Math.min(offsetX.getX(), offsetZ.getX()), + offsetX.getY(), + Math.min(offsetX.getZ(), offsetZ.getZ()), + Math.max((double) offsetX.getX() + 1.0, (double) offsetZ.getX() + 1.0), + (double) offsetX.getY() + 1.0, + Math.max((double) offsetX.getZ() + 1.0, (double) offsetZ.getZ() + 1.0) + ) + .offset( + -((IAccessorRenderManager) mc.getRenderManager()).getRenderPosX(), + -((IAccessorRenderManager) mc.getRenderManager()).getRenderPosY(), + -((IAccessorRenderManager) mc.getRenderManager()).getRenderPosZ() + ) + ); + } else if (xObsidian) { + this.drawObsidian(offsetX); + } else if (zObsidian) { + this.drawObsidian(offsetZ); + } + } + } + AxisAlignedBB aabb = new AxisAlignedBB( + Math.min(blockPos.getX(), opposite.getX()), + blockPos.getY(), + Math.min(blockPos.getZ(), opposite.getZ()), + Math.max((double) blockPos.getX() + 1.0, (double) opposite.getX() + 1.0), + (double) blockPos.getY() + this.getHeight(), + Math.max((double) blockPos.getZ() + 1.0, (double) opposite.getZ() + 1.0) + ) + .offset( + -((IAccessorRenderManager) mc.getRenderManager()).getRenderPosX(), + -((IAccessorRenderManager) mc.getRenderManager()).getRenderPosY(), + -((IAccessorRenderManager) mc.getRenderManager()).getRenderPosZ() + ); + Color color = this.getColor(); + if (this.outline.getValue()) { + RenderUtil.drawBoundingBox(aabb, color.getRed(), color.getGreen(), color.getBlue(), 255, 1.5F); + } + RenderUtil.drawFilledBox( + aabb, + color.getRed(), + color.getGreen(), + color.getBlue() + ); + } + } else { + this.beds.remove(blockPos); + } + } + RenderUtil.disableRenderState(); + } + } + + @Override + public void onEnabled() { + if (mc.renderGlobal != null) { + mc.renderGlobal.loadRenderers(); + } + } +} + + + +package myau.module.modules; + +import com.google.common.base.CaseFormat; +import myau.Myau; +import myau.enums.ChatColors; +import myau.enums.DelayModules; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.event.types.Priority; +import myau.events.*; +import myau.management.RotationState; +import myau.mixin.IAccessorPlayerControllerMP; +import myau.module.Module; +import myau.property.properties.BooleanProperty; +import myau.property.properties.FloatProperty; +import myau.property.properties.ModeProperty; +import myau.property.properties.PercentProperty; +import myau.util.*; +import net.minecraft.block.Block; +import net.minecraft.block.BlockBed; +import net.minecraft.block.BlockBed.EnumPartType; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.item.Item; +import net.minecraft.item.ItemPickaxe; +import net.minecraft.item.ItemStack; +import net.minecraft.network.play.client.C07PacketPlayerDigging; +import net.minecraft.network.play.client.C07PacketPlayerDigging.Action; +import net.minecraft.network.play.client.C0APacketAnimation; +import net.minecraft.network.play.server.S02PacketChat; +import net.minecraft.network.play.server.S08PacketPlayerPosLook; +import net.minecraft.network.play.server.S12PacketEntityVelocity; +import net.minecraft.network.play.server.S27PacketExplosion; +import net.minecraft.potion.Potion; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.MovingObjectPosition.MovingObjectType; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +public class BedNuker extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); + private final TimerUtil timer = new TimerUtil(); + private final ArrayList bedWhitelist = new ArrayList(); + private final Color colorRed = new Color(ChatColors.RED.toAwtColor()); + private final Color colorYellow = new Color(ChatColors.YELLOW.toAwtColor()); + private final Color colorGreen = new Color(ChatColors.GREEN.toAwtColor()); + private BlockPos targetBed = null; + private int breakStage = 0; + private int tickCounter = 0; + private float breakProgress = 0.0F; + private boolean isBed = false; + private int savedSlot = -1; + private boolean readyToBreak = false; + private boolean breaking = false; + private boolean waitingForStart = false; + public final ModeProperty mode = new ModeProperty("mode", 0, new String[]{"LEGIT", "SWAP"}); + public final FloatProperty range = new FloatProperty("range", 4.5F, 3.0F, 6.0F); + public final PercentProperty speed = new PercentProperty("speed", 0); + public final BooleanProperty groundSpeed = new BooleanProperty("ground-spoof", false); + public final ModeProperty ignoreVelocity = new ModeProperty("ignore-velocity", 0, new String[]{"NONE", "CANCEL", "DELAY"}); + public final BooleanProperty surroundings = new BooleanProperty("surroundings", true); + public final BooleanProperty toolCheck = new BooleanProperty("tool-check", true); + public final BooleanProperty whiteList = new BooleanProperty("whitelist", true); + public final BooleanProperty swing = new BooleanProperty("swing", true); + public final ModeProperty moveFix = new ModeProperty("move-fix", 1, new String[]{"NONE", "SILENT", "STRICT"}); + public final ModeProperty showTarget = new ModeProperty("show-target", 1, new String[]{"NONE", "DEFAULT", "HUD"}); + public final ModeProperty showProgress = new ModeProperty("show-progress", 1, new String[]{"NONE", "DEFAULT", "HUD"}); + + private void resetBreaking() { + if (this.targetBed != null) { + mc.theWorld.sendBlockBreakProgress(mc.thePlayer.getEntityId(), this.targetBed, -1); + } + this.targetBed = null; + this.breakStage = 0; + this.tickCounter = 0; + this.breakProgress = 0.0F; + this.isBed = false; + this.readyToBreak = false; + this.breaking = false; + } + + private float calcProgress() { + if (this.targetBed == null) { + return 0.0F; + } else { + float progress = this.breakProgress; + if (this.groundSpeed.getValue()) { + int slot = ItemUtil.findInventorySlot(mc.thePlayer.inventory.currentItem, mc.theWorld.getBlockState(this.targetBed).getBlock()); + progress = (float) this.tickCounter * this.getBreakDelta(mc.theWorld.getBlockState(this.targetBed), this.targetBed, slot, true); + } + return Math.min(1.0F, progress / (1.0F - 0.3F * ((float) this.speed.getValue().intValue() / 100.0F))); + } + } + + private void restoreSlot() { + if (this.savedSlot != -1) { + mc.thePlayer.inventory.currentItem = this.savedSlot; + this.syncHeldItem(); + this.savedSlot = -1; + } + } + + private void syncHeldItem() { + int currentPlayerItem = ((IAccessorPlayerControllerMP) mc.playerController).getCurrentPlayerItem(); + if (mc.thePlayer.inventory.currentItem != currentPlayerItem) { + mc.thePlayer.stopUsingItem(); + } + ((IAccessorPlayerControllerMP) mc.playerController).callSyncCurrentPlayItem(); + } + + private boolean hasProperTool(Block block) { + Material material = block.getMaterial(); + if (material != Material.iron && material != Material.anvil && material != Material.rock) { + return true; + } else { + for (int i = 0; i < 9; i++) { + ItemStack stack = mc.thePlayer.inventory.getStackInSlot(i); + if (stack != null) { + Item item = stack.getItem(); + if (item instanceof ItemPickaxe) { + return true; + } + } + } + return false; + } + } + + private EnumFacing getHitFacing(BlockPos blockPos) { + double x = (double) blockPos.getX() + 0.5 - mc.thePlayer.posX; + double y = (double) blockPos.getY() + 0.25 - mc.thePlayer.posY - (double) mc.thePlayer.getEyeHeight(); + double z = (double) blockPos.getZ() + 0.5 - mc.thePlayer.posZ; + float[] rotations = RotationUtil.getRotationsTo(x, y, z, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch); + MovingObjectPosition mop = RotationUtil.rayTrace(rotations[0], rotations[1], 8.0, 1.0F); + return mop == null ? EnumFacing.UP : mop.sideHit; + } + + private float getDigSpeed(IBlockState iBlockState, int slot, boolean boolean5) { + ItemStack item = mc.thePlayer.inventory.getStackInSlot(slot); + float digSpeed = item == null ? 1.0F : item.getItem().getDigSpeed(item, iBlockState); + if (digSpeed > 1.0F) { + int enchantmentLevel = EnchantmentHelper.getEnchantmentLevel(Enchantment.efficiency.effectId, item); + if (enchantmentLevel > 0) { + digSpeed += (float) (enchantmentLevel * enchantmentLevel + 1); + } + } + if (mc.thePlayer.isPotionActive(Potion.digSpeed)) { + digSpeed *= 1.0F + (float) (mc.thePlayer.getActivePotionEffect(Potion.digSpeed).getAmplifier() + 1) * 0.2F; + } + if (mc.thePlayer.isPotionActive(Potion.digSlowdown)) { + switch (mc.thePlayer.getActivePotionEffect(Potion.digSlowdown).getAmplifier()) { + case 0: + digSpeed *= 0.3F; + break; + case 1: + digSpeed *= 0.09F; + break; + case 2: + digSpeed *= 0.0027F; + break; + default: + digSpeed *= 8.1E-4F; + } + } + if (mc.thePlayer.isInsideOfMaterial(Material.water) && !EnchantmentHelper.getAquaAffinityModifier(mc.thePlayer)) { + digSpeed /= 5.0F; + } + if (!boolean5) { + digSpeed /= 5.0F; + } + return digSpeed; + } + + boolean canHarvest(Block block, int slot) { + if (block.getMaterial().isToolNotRequired()) { + return true; + } else { + ItemStack stack = mc.thePlayer.inventory.getStackInSlot(slot); + return stack != null && stack.canHarvestBlock(block); + } + } + + private float getBreakDelta(IBlockState iBlockState, BlockPos blockPos, int slot, boolean boolean5) { + Block block = iBlockState.getBlock(); + float hardness = block.getBlockHardness(mc.theWorld, blockPos); + float boost = this.canHarvest(block, slot) ? 30.0F : 100.0F; + return hardness < 0.0F ? 0.0F : this.getDigSpeed(iBlockState, slot, boolean5) / hardness / boost; + } + + private float calcBlockStrength(BlockPos blockPos) { + IBlockState blockState = mc.theWorld.getBlockState(blockPos); + int slot = ItemUtil.findInventorySlot(mc.thePlayer.inventory.currentItem, blockState.getBlock()); + return this.getBreakDelta(blockState, blockPos, slot, mc.thePlayer.onGround); + } + + private BlockPos validateBedPlacement(BlockPos bedPosition) { + IBlockState blockState = mc.theWorld.getBlockState(bedPosition); + if (blockState.getBlock() instanceof BlockBed) { + ArrayList pos = new ArrayList<>(); + EnumPartType partType = blockState.getValue(BlockBed.PART); + EnumFacing facing = blockState.getValue(BlockBed.FACING); + for (BlockPos blockPos : Arrays.asList(bedPosition, bedPosition.offset(partType == EnumPartType.HEAD ? facing.getOpposite() : facing))) { + for (EnumFacing enumFacing : Arrays.asList(EnumFacing.UP, EnumFacing.NORTH, EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.WEST)) { + Block block = mc.theWorld.getBlockState(blockPos.offset(enumFacing)).getBlock(); + if (BlockUtil.isReplaceable(block)) { + return null; + } + if (!(block instanceof BlockBed)) { + pos.add(blockPos.offset(enumFacing)); + } + } + } + if (!pos.isEmpty()) { + pos.sort( + (blockPos, blockPos2) -> { + int o = Float.compare(this.calcBlockStrength(blockPos2), this.calcBlockStrength(blockPos)); + return o != 0 + ? o + : Double.compare( + blockPos.distanceSqToCenter(mc.thePlayer.posX, mc.thePlayer.posY + (double) mc.thePlayer.getEyeHeight(), mc.thePlayer.posZ), + blockPos2.distanceSqToCenter(mc.thePlayer.posX, mc.thePlayer.posY + (double) mc.thePlayer.getEyeHeight(), mc.thePlayer.posZ) + ); + } + ); + return pos.get(0); + } + } + return null; + } + + private BlockPos findNearestBed() { + return this.findTargetBed(mc.thePlayer.posX, mc.thePlayer.posY + (double) mc.thePlayer.getEyeHeight(), mc.thePlayer.posZ); + } + + private BlockPos findTargetBed(double x, double y, double z) { + ArrayList targets = new ArrayList<>(); + int sX = MathHelper.floor_double(x); + int sY = MathHelper.floor_double(y); + int sZ = MathHelper.floor_double(z); + for (int i = sX - 6; i <= sX + 6; i++) { + for (int j = sY - 6; j <= sY + 6; j++) { + for (int k = sZ - 6; k <= sZ + 6; k++) { + BlockPos newPos = new BlockPos(i, j, k); + if (!(Boolean) this.whiteList.getValue() || !this.bedWhitelist.contains(newPos)) { + Block block = mc.theWorld.getBlockState(newPos).getBlock(); + if (block instanceof BlockBed + && PlayerUtil.isBlockWithinReach(newPos, x, y, z, this.range.getValue().doubleValue())) { + targets.add(newPos); + } + } + } + } + } + if (targets.isEmpty()) { + return null; + } else { + targets.sort( + Comparator.comparingDouble( + blockPos -> blockPos.distanceSqToCenter(mc.thePlayer.posX, mc.thePlayer.posY + (double) mc.thePlayer.getEyeHeight(), mc.thePlayer.posZ) + ) + ); + for (BlockPos blockPos : targets) { + if (this.surroundings.getValue()) { + BlockPos pos = this.validateBedPlacement(blockPos); + if (pos != null) { + Block block = mc.theWorld.getBlockState(pos).getBlock(); + if (this.toolCheck.getValue() && !this.hasProperTool(block)) { + continue; + } + return pos; + } + } + return blockPos; + } + return null; + } + } + + private void doSwing() { + if (this.swing.getValue()) { + mc.thePlayer.swingItem(); + } else { + PacketUtil.sendPacket(new C0APacketAnimation()); + } + } + + private Color getProgressColor(int mode) { + switch (mode) { + case 1: + float progress = this.calcProgress(); + if (progress <= 0.5F) { + return ColorUtil.interpolate(progress / 0.5F, this.colorRed, this.colorYellow); + } + return ColorUtil.interpolate((progress - 0.5F) / 0.5F, this.colorYellow, this.colorGreen); + case 2: + return ((HUD) Myau.moduleManager.modules.get(HUD.class)).getColor(System.currentTimeMillis()); + default: + return new Color(-1); + } + } + + public BedNuker() { + super("BedNuker", false); + } + + public boolean isReady() { + return this.targetBed != null && this.readyToBreak; + } + + public boolean isBreaking() { + return this.targetBed != null && this.breaking; + } + + @EventTarget(Priority.HIGH) + public void onTick(TickEvent event) { + if (this.isEnabled() && event.getType() == EventType.PRE) { + AutoBlockIn autoBlockIn = (AutoBlockIn) Myau.moduleManager.modules.get(AutoBlockIn.class); + if(autoBlockIn.isEnabled()) return; + if (this.targetBed != null) { + if (mc.theWorld.isAirBlock(this.targetBed) || !PlayerUtil.canReach(this.targetBed, this.range.getValue().doubleValue())) { + this.restoreSlot(); + this.resetBreaking(); + } else if (!this.isBed) { + BlockPos nearestBed = this.findNearestBed(); + if (nearestBed != null && mc.theWorld.getBlockState(nearestBed).getBlock() instanceof BlockBed) { + this.resetBreaking(); + } + } + } + if (this.targetBed != null) { + int slot = ItemUtil.findInventorySlot(mc.thePlayer.inventory.currentItem, mc.theWorld.getBlockState(this.targetBed).getBlock()); + if (this.mode.getValue() == 0 && this.savedSlot == -1) { + this.savedSlot = mc.thePlayer.inventory.currentItem; + mc.thePlayer.inventory.currentItem = slot; + this.syncHeldItem(); + } + switch (this.breakStage) { + case 0: + if (!mc.thePlayer.isUsingItem()) { + this.doSwing(); + PacketUtil.sendPacket( + new C07PacketPlayerDigging(Action.START_DESTROY_BLOCK, this.targetBed, this.getHitFacing(this.targetBed)) + ); + this.doSwing(); + mc.effectRenderer.addBlockHitEffects(this.targetBed, this.getHitFacing(this.targetBed)); + this.breakStage = 1; + } + break; + case 1: + if (this.mode.getValue() == 1) { + this.readyToBreak = false; + } + this.breaking = true; + this.tickCounter++; + this.breakProgress = this.breakProgress + + this.getBreakDelta(mc.theWorld.getBlockState(this.targetBed), this.targetBed, slot, mc.thePlayer.onGround); + float tick = (float) this.tickCounter; + IBlockState blockState = mc.theWorld.getBlockState(this.targetBed); + boolean canBreak = mc.thePlayer.onGround && this.groundSpeed.getValue(); + BlockPos target = this.targetBed; + float delta = tick * this.getBreakDelta(blockState, target, slot, canBreak); + mc.effectRenderer.addBlockHitEffects(this.targetBed, this.getHitFacing(this.targetBed)); + if (this.breakProgress >= 1.0F - 0.3F * ((float) this.speed.getValue().intValue() / 100.0F) + || delta >= 1.0F - 0.3F * ((float) this.speed.getValue().intValue() / 100.0F)) { + if (this.mode.getValue() == 1) { + this.readyToBreak = true; + this.savedSlot = mc.thePlayer.inventory.currentItem; + mc.thePlayer.inventory.currentItem = slot; + this.syncHeldItem(); + if (mc.thePlayer.isUsingItem()) { + this.savedSlot = mc.thePlayer.inventory.currentItem; + mc.thePlayer.inventory.currentItem = (mc.thePlayer.inventory.currentItem + 1) % 9; + this.syncHeldItem(); + } + } + this.breaking = false; + PacketUtil.sendPacket( + new C07PacketPlayerDigging(Action.STOP_DESTROY_BLOCK, this.targetBed, this.getHitFacing(this.targetBed)) + ); + this.doSwing(); + IBlockState blockState_ = mc.theWorld.getBlockState(this.targetBed); + Block block = blockState_.getBlock(); + if (block.getMaterial() != Material.air) { + mc.theWorld.playAuxSFX(2001, this.targetBed, Block.getStateId(blockState_)); + mc.theWorld.setBlockToAir(this.targetBed); + } + if (block instanceof BlockBed) { + this.timer.reset(); + } + this.breakStage = 2; + } + break; + case 2: + this.restoreSlot(); + this.resetBreaking(); + } + if (this.targetBed != null) { + return; + } + } + if (mc.thePlayer.capabilities.allowEdit && this.timer.hasTimeElapsed(500)) { + this.targetBed = this.findNearestBed(); + this.breakStage = 0; + this.tickCounter = 0; + this.breakProgress = 0.0F; + this.isBed = this.targetBed != null && mc.theWorld.getBlockState(this.targetBed).getBlock() instanceof BlockBed; + this.restoreSlot(); + if (this.targetBed != null) { + this.readyToBreak = true; + } + } + if (this.targetBed == null) { + Myau.delayManager.setDelayState(false, DelayModules.BED_NUKER); + } + } + } + + @EventTarget(Priority.LOWEST) + public void onUpdate(UpdateEvent event) { + if (this.isEnabled() && event.getType() == EventType.PRE) { + AutoBlockIn autoBlockIn = (AutoBlockIn) Myau.moduleManager.modules.get(AutoBlockIn.class); + if(autoBlockIn.isEnabled()) return; + if (this.isReady()) { + double x = (double) this.targetBed.getX() + 0.5 - mc.thePlayer.posX; + double y = (double) this.targetBed.getY() + 0.5 - mc.thePlayer.posY - (double) mc.thePlayer.getEyeHeight(); + double z = (double) this.targetBed.getZ() + 0.5 - mc.thePlayer.posZ; + float[] rotations = RotationUtil.getRotationsTo(x, y, z, event.getYaw(), event.getPitch()); + event.setRotation(rotations[0], rotations[1], 5); + event.setPervRotation(this.moveFix.getValue() != 0 ? rotations[0] : mc.thePlayer.rotationYaw, 5); + } + } + } + + @EventTarget + public void onPlayerUpdate(PlayerUpdateEvent event) { + if (this.isEnabled()) { + if (this.isBreaking() + && !Myau.playerStateManager.attacking + && !Myau.playerStateManager.digging + && !Myau.playerStateManager.placing + && !Myau.playerStateManager.swinging) { + this.doSwing(); + } + } + } + + @EventTarget + public void onMoveInput(MoveInputEvent event) { + if (this.isEnabled()) { + if (this.moveFix.getValue() == 1 + && RotationState.isActived() + && RotationState.getPriority() == 5.0F + && MoveUtil.isForwardPressed()) { + MoveUtil.fixStrafe(RotationState.getSmoothedYaw()); + } + } + } + + @EventTarget(Priority.HIGH) + public void onKnockback(KnockbackEvent event) { + if (this.isEnabled() && !event.isCancelled() && !(event.getY() <= 0.0)) { + if (this.ignoreVelocity.getValue() == 1 && this.targetBed != null) { + event.setCancelled(true); + event.setX(mc.thePlayer.motionX); + event.setY(mc.thePlayer.motionY); + event.setZ(mc.thePlayer.motionZ); + } + } + } + + @EventTarget + public void onRender2D(Render2DEvent event) { + if (this.isEnabled()) { + if (this.targetBed != null && (!this.isBed || !this.surroundings.getValue())) { + if (this.showProgress.getValue() != 0) { + HUD hud = (HUD) Myau.moduleManager.modules.get(HUD.class); + float scale = hud.scale.getValue(); + String text = String.format("%d%%", (int) (this.calcProgress() * 100.0F)); + GlStateManager.pushMatrix(); + GlStateManager.scale(scale, scale, 0.0F); + GlStateManager.disableDepth(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + int width = mc.fontRendererObj.getStringWidth(text); + mc.fontRendererObj + .drawString( + text, + (float) new ScaledResolution(mc).getScaledWidth() / 2.0F / scale - (float) width / 2.0F, + (float) new ScaledResolution(mc).getScaledHeight() / 5.0F * 2.0F / scale, + this.getProgressColor(this.showProgress.getValue()).getRGB() & 16777215 | -1090519040, + hud.shadow.getValue() + ); + GlStateManager.disableBlend(); + GlStateManager.enableDepth(); + GlStateManager.popMatrix(); + } + } + } + } + + @EventTarget(Priority.LOW) + public void onRender3D(Render3DEvent event) { + if (this.isEnabled() && this.targetBed != null && !mc.theWorld.isAirBlock(this.targetBed)) { + mc.theWorld.sendBlockBreakProgress(mc.thePlayer.getEntityId(), this.targetBed, (int) (this.calcProgress() * 10.0F) - 1); + if (this.showTarget.getValue() != 0) { + BedESP bedESP = (BedESP) Myau.moduleManager.modules.get(BedESP.class); + Color color = this.getProgressColor(this.showTarget.getValue()); + RenderUtil.enableRenderState(); + BlockPos target = this.targetBed; + double newHeight = this.isBed ? bedESP.getHeight() : 1.0; + int r = color.getRed(); + int g = color.getBlue(); + int b = color.getGreen(); + RenderUtil.drawBlockBox(target, newHeight, r, b, g); + RenderUtil.disableRenderState(); + } + } + } + + @EventTarget + public void onLoadWorld(LoadWorldEvent event) { + this.waitingForStart = false; + } + + @EventTarget + public void onPacket(PacketEvent event) { + if (!event.isCancelled()) { + if (event.getPacket() instanceof S02PacketChat) { + String text = ((S02PacketChat) event.getPacket()).getChatComponent().getFormattedText(); + if (text.contains("§e§lProtect your bed and destroy the enemy bed") || text.contains("§e§lDestroy the enemy bed and then eliminate them")) { + this.waitingForStart = true; + } + } + if (event.getPacket() instanceof S08PacketPlayerPosLook && this.waitingForStart) { + this.waitingForStart = false; + this.bedWhitelist.clear(); + this.scheduler.schedule(() -> { + int sX = MathHelper.floor_double(mc.thePlayer.posX); + int sY = MathHelper.floor_double(mc.thePlayer.posY + (double) mc.thePlayer.getEyeHeight()); + int sZ = MathHelper.floor_double(mc.thePlayer.posZ); + for (int i = sX - 25; i <= sX + 25; i++) { + for (int j = sY - 25; j <= sY + 25; j++) { + for (int k = sZ - 25; k <= sZ + 25; k++) { + BlockPos blockPos = new BlockPos(i, j, k); + Block block = mc.theWorld.getBlockState(blockPos).getBlock(); + if (block instanceof BlockBed) { + this.bedWhitelist.add(blockPos); + } + } + } + } + }, 1L, TimeUnit.SECONDS); + } + if (this.isEnabled() && this.targetBed != null && this.ignoreVelocity.getValue() == 2 && Myau.delayManager.getDelayModule() != DelayModules.BED_NUKER) { + if (event.getPacket() instanceof S12PacketEntityVelocity) { + S12PacketEntityVelocity packet = (S12PacketEntityVelocity) event.getPacket(); + if (packet.getEntityID() == mc.thePlayer.getEntityId() && packet.getMotionY() > 0) { + Myau.delayManager.delay(DelayModules.BED_NUKER); + Myau.delayManager.delayedPacket.offer(packet); + event.setCancelled(true); + } + } + if (event.getPacket() instanceof S27PacketExplosion) { + S27PacketExplosion explosion = (S27PacketExplosion) event.getPacket(); + if (explosion.func_149149_c() != 0.0F || explosion.func_149144_d() != 0.0F || explosion.func_149147_e() != 0.0F) { + Myau.delayManager.delay(DelayModules.BED_NUKER); + Myau.delayManager.delayedPacket.offer(explosion); + event.setCancelled(true); + } + } + } + } + } + + @EventTarget + public void onLeftClick(LeftClickMouseEvent event) { + if (this.isEnabled()) { + if (this.isReady() || this.targetBed != null && mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectType.BLOCK) { + event.setCancelled(true); + } + } + } + + @EventTarget + public void onRightClick(RightClickMouseEvent event) { + if (this.isEnabled()) { + if (this.isReady()) { + event.setCancelled(true); + } + } + } + + @EventTarget + public void onHitBlock(HitBlockEvent event) { + if (this.isEnabled()) { + if (this.isReady() || this.targetBed != null && mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectType.BLOCK) { + event.setCancelled(true); + } + } + } + + @EventTarget + public void onSwap(SwapItemEvent event) { + if (this.isEnabled()) { + if (this.savedSlot != -1) { + event.setCancelled(true); + } + } + } + + @Override + public void onDisabled() { + this.resetBreaking(); + this.savedSlot = -1; + Myau.delayManager.setDelayState(false, DelayModules.BED_NUKER); + } + + @Override + public String[] getSuffix() { + return new String[]{CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, this.mode.getModeString())}; + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.enums.ChatColors; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.event.types.Priority; +import myau.events.LoadWorldEvent; +import myau.events.PacketEvent; +import myau.events.Render2DEvent; +import myau.events.TickEvent; +import myau.module.Module; +import myau.util.ChatUtil; +import myau.util.ColorUtil; +import myau.util.SoundUtil; +import myau.util.TeamUtil; +import myau.property.properties.*; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiChat; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityEnderPearl; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemEnderPearl; +import net.minecraft.item.ItemStack; +import net.minecraft.network.play.server.S02PacketChat; +import net.minecraft.network.play.server.S08PacketPlayerPosLook; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +public class BedTracker extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private final ScheduledExecutorService executor; + private final LinkedHashMap alertCooldowns; + private final LinkedHashSet trackedPearls; + private final LinkedHashSet whitelistedPlayers; + private final Color wBed; + private final Color rBed; + private final Color yBed; + private final Color gBed; + private BlockPos bedPos; + private long lastMarcoTime; + private boolean waiting; + public final BooleanProperty alerts; + public final IntProperty alertRange; + public final BooleanProperty alertOnPearl; + public final ModeProperty alertSound; + public final IntProperty alertFrequency; + public final BooleanProperty marco; + public final IntProperty marcoRange; + public final BooleanProperty marcoOnPreal; + public final TextProperty marcoText; + public final IntProperty marcoDelay; + public final BooleanProperty hud; + public final ModeProperty hudPosX; + public final ModeProperty hudPosY; + public final IntProperty hudOffX; + public final IntProperty hudOffY; + public final FloatProperty hudScale; + public final BooleanProperty hudShadow; + + private void playAlertSound() { + switch (this.alertSound.getValue()) { + case 1: + SoundUtil.playSound("mob.cat.meow"); + break; + case 2: + SoundUtil.playSound("random.anvil_land"); + } + } + + private Color getHudColor(int distance) { + if (distance < 0) { + return this.wBed; + } else if (distance <= 100) { + return this.gBed; + } else if (distance <= 114) { + return ColorUtil.interpolate((float) (114 - distance) / 14.0F, this.yBed, this.gBed); + } else { + return distance <= 128 ? ColorUtil.interpolate((float) (128 - distance) / 14.0F, this.rBed, this.yBed) : this.rBed; + } + } + + private boolean isBed(BlockPos blockPos) { + return blockPos != null && mc.theWorld.getBlockState(blockPos).getBlock() == Blocks.bed; + } + + public BedTracker() { + super("BedTracker", false, true); + this.executor = Executors.newScheduledThreadPool(1); + this.alertCooldowns = new LinkedHashMap<>(); + this.trackedPearls = new LinkedHashSet<>(); + this.whitelistedPlayers = new LinkedHashSet<>(); + this.wBed = new Color(ChatColors.WHITE.toAwtColor()); + this.rBed = new Color(ChatColors.RED.toAwtColor()); + this.yBed = new Color(ChatColors.YELLOW.toAwtColor()); + this.gBed = new Color(ChatColors.GREEN.toAwtColor()); + this.bedPos = null; + this.lastMarcoTime = -1L; + this.waiting = false; + this.alerts = new BooleanProperty("alerts", true); + this.alertRange = new IntProperty("alerts-range", 48, 8, 128, this.alerts::getValue); + this.alertOnPearl = new BooleanProperty("alerts-on-pearl", true); + this.alertSound = new ModeProperty("alerts-sound", 1, new String[]{"NONE", "MEOW", "ANVIL"}, () -> this.alerts.getValue() || this.alertOnPearl.getValue()); + this.alertFrequency = new IntProperty("alerts-frequency", 5, 1, 30, () -> this.alerts.getValue() || this.alertOnPearl.getValue()); + this.marco = new BooleanProperty("macro", false); + this.marcoRange = new IntProperty("macro-range", 24, 8, 128, this.marco::getValue); + this.marcoOnPreal = new BooleanProperty("macro-on-pearl", false); + this.marcoText = new TextProperty("macro-text", "/lobby", () -> this.marco.getValue() || this.marcoOnPreal.getValue()); + this.marcoDelay = new IntProperty("macro-delay", 1, 1, 10, () -> this.marco.getValue() || this.marcoOnPreal.getValue()); + this.hud = new BooleanProperty("hud", true); + this.hudPosX = new ModeProperty("hud-position-x", 0, new String[]{"LEFT", "MIDDLE", "RIGHT"}, this.hud::getValue); + this.hudPosY = new ModeProperty("hud-position-y", 0, new String[]{"TOP", "MIDDLE", "BOTTOM"}, this.hud::getValue); + this.hudOffX = new IntProperty("hud-offset-x", 2, 0, 255, this.hud::getValue); + this.hudOffY = new IntProperty("hud-offset-y", 2, 0, 255, this.hud::getValue); + this.hudScale = new FloatProperty("hud-scale", 1.0F, 0.5F, 1.5F, this.hud::getValue); + this.hudShadow = new BooleanProperty("hud-shadow", true, this.hud::getValue); + } + + @EventTarget + public void onTick(TickEvent event) { + if (this.isEnabled() && event.getType() == EventType.POST && this.isBed(this.bedPos)) { + long millis = System.currentTimeMillis(); + boolean pearl = false; + boolean marco = false; + for (Entity entity : mc.theWorld.loadedEntityList) { + if (entity instanceof EntityEnderPearl) { + EntityEnderPearl enderPearl = (EntityEnderPearl) entity; + if (!this.trackedPearls.contains(enderPearl)) { + this.trackedPearls.add(enderPearl); + if (this.alertOnPearl.getValue()) { + ChatUtil.sendFormatted(String.format("%s%s: &fDetected &5Ender Pearl&r &e&l⚠&r", Myau.clientName, this.getName())); + pearl = true; + } + if (this.marcoOnPreal.getValue() && this.lastMarcoTime + (long) this.marcoDelay.getValue() * 1000L <= millis) { + this.lastMarcoTime = millis; + marco = true; + } + } + } + } + for (EntityPlayer player : mc.theWorld + .loadedEntityList + .stream() + .filter(entity -> entity instanceof EntityPlayer) + .map(entity -> (EntityPlayer) entity) + .filter(entityPlayer -> !TeamUtil.isBot(entityPlayer) && !this.whitelistedPlayers.contains(entityPlayer.getName())) + .collect(Collectors.toList())) { + if (TeamUtil.isSameTeam(player)) { + this.whitelistedPlayers.add(player.getName()); + } else { + double distance = player.getDistance((double) this.bedPos.getX() + 0.5, (double) this.bedPos.getY() + 0.5, (double) this.bedPos.getZ() + 0.5); + String name = player.getName(); + String text = player.getDisplayName().getFormattedText(); + ItemStack item = player.getHeldItem(); + boolean isPearl = item != null && item.getItem() instanceof ItemEnderPearl; + if (this.alerts.getValue() && distance < (double) this.alertRange.getValue()) { + Long cooldown = this.alertCooldowns.get(name); + if (cooldown == null || cooldown + (long) this.alertFrequency.getValue() * 1000L <= millis) { + this.alertCooldowns.put(name, millis); + ChatUtil.sendFormatted( + String.format("%s%s: %s&r &fis %d blocks away from your bed &e&l⚠&r", Myau.clientName, this.getName(), text, (int) distance + 1) + ); + pearl = true; + } + } + if (this.alertOnPearl.getValue() && isPearl) { + Long cooldown = this.alertCooldowns.get(name); + if (cooldown == null || cooldown + (long) this.alertFrequency.getValue() * 1000L <= millis) { + this.alertCooldowns.put(name, millis); + ChatUtil.sendFormatted( + String.format("%s%s: %s&r &fhas &5Ender Pearl&r &e&l⚠&r", Myau.clientName, this.getName(), text) + ); + pearl = true; + } + } + if (( + this.marco.getValue() && distance < (double) this.marcoRange.getValue() + || this.marcoOnPreal.getValue() && isPearl + ) + && this.lastMarcoTime + (long) this.marcoDelay.getValue() * 1000L <= millis) { + this.lastMarcoTime = millis; + marco = true; + } + } + } + if (pearl) { + this.playAlertSound(); + } + if (marco) { + ChatUtil.sendRaw( + String.format( + ChatColors.formatColor("%s%s: &fRunning &6%s&r"), + ChatColors.formatColor(Myau.clientName), + this.getName(), + this.marcoText.getValue() + ) + ); + ChatUtil.sendMessage(this.marcoText.getValue()); + } + } + } + + @EventTarget(Priority.LOW) + public void onRender(Render2DEvent event) { + if (this.isEnabled() && this.hud.getValue()) { + if (mc.theWorld != null && mc.thePlayer != null && !mc.gameSettings.showDebugInfo) { + GuiScreen currentScreen = mc.currentScreen; + if (currentScreen == null || currentScreen instanceof GuiChat) { + int distanceSq = 0; + boolean hasBed = this.isBed(this.bedPos); + if (hasBed) { + double xDiff = mc.thePlayer.posX - (double) this.bedPos.getX(); + double zDiff = mc.thePlayer.posZ - (double) this.bedPos.getZ(); + distanceSq = (int) Math.sqrt(xDiff * xDiff + zDiff * zDiff) + 1; + } + String text = ChatColors.formatColor( + String.format( + "&fBed: %s%s", + !hasBed ? "&cfalse&r" : "&atrue&r", + !hasBed ? "" : String.format(" &7| &fDistance: &r%d%s", distanceSq, distanceSq >= 128 ? " &c&l⚠&r" : "") + ) + ); + ScaledResolution scaledResolution = new ScaledResolution(mc); + float width = (float) mc.fontRendererObj.getStringWidth(text); + float height = (float) mc.fontRendererObj.FONT_HEIGHT - 1.0F; + float scale = (float) this.hudOffX.getValue() / this.hudScale.getValue(); + switch (this.hudPosX.getValue()) { + case 0: + scale++; + break; + case 1: + scale += (float) scaledResolution.getScaledWidth() / this.hudScale.getValue() / 2.0F - width / 2.0F; + break; + case 2: + scale = (scale + 1.0F) * -1.0F; + scale += (float) scaledResolution.getScaledWidth() / this.hudScale.getValue() - width; + } + float offset = (float) this.hudOffY.getValue() / this.hudScale.getValue(); + switch (this.hudPosY.getValue()) { + case 0: + offset++; + break; + case 1: + offset += (float) scaledResolution.getScaledHeight() / this.hudScale.getValue() / 2.0F - height / 2.0F; + break; + case 2: + offset = (offset + 1.0F) * -1.0F; + offset += (float) scaledResolution.getScaledHeight() / this.hudScale.getValue() - height; + } + GlStateManager.pushMatrix(); + GlStateManager.scale(this.hudScale.getValue(), this.hudScale.getValue(), 1.0F); + GlStateManager.translate(scale, offset, 0.0F); + GlStateManager.disableDepth(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + mc.fontRendererObj.drawString(text, 0.0F, 0.0F, this.getHudColor(distanceSq).getRGB(), this.hudShadow.getValue()); + GlStateManager.disableBlend(); + GlStateManager.enableDepth(); + GlStateManager.popMatrix(); + } + } + } + } + + @EventTarget + public void onLoadWorld(LoadWorldEvent event) { + this.waiting = false; + } + + @EventTarget + public void onPacket(PacketEvent event) { + if (this.isEnabled()) { + if (event.getPacket() instanceof S02PacketChat) { + String msg = ((S02PacketChat) event.getPacket()).getChatComponent().getFormattedText(); + if (msg.contains("§e§lProtect your bed and destroy the enemy bed") || msg.contains("§e§lDestroy the enemy bed and then eliminate them")) { + this.alertCooldowns.clear(); + this.trackedPearls.clear(); + this.whitelistedPlayers.clear(); + this.bedPos = null; + this.waiting = true; + } + } + if (event.getPacket() instanceof S08PacketPlayerPosLook && this.waiting) { + this.waiting = false; + this.executor + .schedule( + () -> { + int x = MathHelper.floor_double(mc.thePlayer.posX); + int y = MathHelper.floor_double(mc.thePlayer.posY + (double) mc.thePlayer.getEyeHeight()); + int z = MathHelper.floor_double(mc.thePlayer.posZ); + for (int i = x - 25; i <= x + 25; i++) { + for (int j = y - 25; j <= y + 25; j++) { + for (int k = z - 25; k <= z + 25; k++) { + BlockPos blockPos = new BlockPos(i, j, k); + if (this.isBed(blockPos)) { + this.bedPos = blockPos; + ChatUtil.sendFormatted( + String.format( + "%s%s: &fWhitelisted your bed at (%d, %d, %d) &a&l✔&r", + Myau.clientName, + this.getName(), + this.bedPos.getX(), + this.bedPos.getY(), + this.bedPos.getZ() + ) + ); + SoundUtil.playSound("note.pling"); + return; + } + } + } + } + }, + 3000L, + TimeUnit.MILLISECONDS + ); + } + } + } + + @Override + public void onDisabled() { + this.alertCooldowns.clear(); + this.trackedPearls.clear(); + this.whitelistedPlayers.clear(); + this.bedPos = null; + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.enums.BlinkModules; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.event.types.Priority; +import myau.events.LoadWorldEvent; +import myau.events.TickEvent; +import myau.module.Module; +import myau.property.properties.IntProperty; +import myau.property.properties.ModeProperty; + +public class Blink extends Module { + public final ModeProperty mode = new ModeProperty("mode", 0, new String[]{"DEFAULT", "PULSE"}); + public final IntProperty ticks = new IntProperty("ticks", 20, 0, 1200); + + public Blink() { + super("Blink", false); + } + + @EventTarget(Priority.LOWEST) + public void onTick(TickEvent event) { + if (this.isEnabled() && event.getType() == EventType.POST) { + if (!Myau.blinkManager.getBlinkingModule().equals(BlinkModules.BLINK)) { + this.setEnabled(false); + } else { + if (this.ticks.getValue() > 0 && Myau.blinkManager.countMovement() > (long) this.ticks.getValue()) { + switch (this.mode.getValue()) { + case 0: + this.setEnabled(false); + break; + case 1: + Myau.blinkManager.setBlinkState(false, BlinkModules.BLINK); + Myau.blinkManager.setBlinkState(true, BlinkModules.BLINK); + } + } + } + } + } + + @EventTarget + public void onWorldLoad(LoadWorldEvent event) { + this.setEnabled(false); + } + + @Override + public void onEnabled() { + Myau.blinkManager.setBlinkState(false, Myau.blinkManager.getBlinkingModule()); + Myau.blinkManager.setBlinkState(true, BlinkModules.BLINK); + } + + @Override + public void onDisabled() { + Myau.blinkManager.setBlinkState(false, BlinkModules.BLINK); + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.events.RenderLivingEvent; +import myau.module.Module; +import myau.util.TeamUtil; +import myau.property.properties.BooleanProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.boss.EntityDragon; +import net.minecraft.entity.boss.EntityWither; +import net.minecraft.entity.monster.*; +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.entity.passive.EntitySquid; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.entity.player.EntityPlayer; +import org.lwjgl.opengl.GL11; + +public class Chams extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + public final BooleanProperty players = new BooleanProperty("players", true); + public final BooleanProperty friends = new BooleanProperty("friends", true); + public final BooleanProperty enemiess = new BooleanProperty("enemies", true); + public final BooleanProperty bosses = new BooleanProperty("bosses", false); + public final BooleanProperty mobs = new BooleanProperty("mobs", false); + public final BooleanProperty creepers = new BooleanProperty("creepers", false); + public final BooleanProperty enderman = new BooleanProperty("endermen", false); + public final BooleanProperty blaze = new BooleanProperty("blazes", false); + public final BooleanProperty animals = new BooleanProperty("animals", false); + public final BooleanProperty self = new BooleanProperty("self", false); + public final BooleanProperty bots = new BooleanProperty("bots", false); + + private boolean shouldRenderChams(EntityLivingBase entityLivingBase) { + if (entityLivingBase.deathTime > 0) { + return false; + } else if (mc.getRenderViewEntity().getDistanceToEntity(entityLivingBase) > 512.0F) { + return false; + } else if (entityLivingBase instanceof EntityPlayer) { + if (entityLivingBase != mc.thePlayer && entityLivingBase != mc.getRenderViewEntity()) { + if (TeamUtil.isBot((EntityPlayer) entityLivingBase)) { + return this.bots.getValue(); + } else if (TeamUtil.isFriend((EntityPlayer) entityLivingBase)) { + return this.friends.getValue(); + } else { + return TeamUtil.isTarget((EntityPlayer) entityLivingBase) ? this.enemiess.getValue() : this.players.getValue(); + } + } else { + return this.self.getValue() && mc.gameSettings.thirdPersonView != 0; + } + } else if (entityLivingBase instanceof EntityDragon || entityLivingBase instanceof EntityWither) { + return !entityLivingBase.isInvisible() && this.bosses.getValue(); + } else if (!(entityLivingBase instanceof EntityMob) && !(entityLivingBase instanceof EntitySlime)) { + return (entityLivingBase instanceof EntityAnimal + || entityLivingBase instanceof EntityBat + || entityLivingBase instanceof EntitySquid + || entityLivingBase instanceof EntityVillager) && this.animals.getValue(); + } else if (entityLivingBase instanceof EntityCreeper) { + return this.creepers.getValue(); + } else if (entityLivingBase instanceof EntityEnderman) { + return this.enderman.getValue(); + } else { + return entityLivingBase instanceof EntityBlaze ? this.blaze.getValue() : this.mobs.getValue(); + } + } + + public Chams() { + super("Chams", false); + } + + @EventTarget + public void onRenderLiving(RenderLivingEvent event) { + if (this.isEnabled()) { + if (this.shouldRenderChams(event.getEntity())) { + switch (event.getType()) { + case PRE: + GL11.glEnable(32823); + GL11.glPolygonOffset(1.0F, -2500000.0F); + break; + case POST: + GL11.glPolygonOffset(1.0F, 2500000.0F); + GL11.glDisable(32823); + } + } + } + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.event.EventTarget; +import myau.events.Render3DEvent; +import myau.mixin.IAccessorMinecraft; +import myau.mixin.IAccessorRenderManager; +import myau.module.Module; +import myau.property.properties.BooleanProperty; +import myau.property.properties.ColorProperty; +import myau.util.RenderUtil; +import net.minecraft.block.Block; +import net.minecraft.block.BlockChest; +import net.minecraft.client.Minecraft; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.tileentity.TileEntityEnderChest; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.Vec3; + +import java.awt.*; +import java.util.stream.Collectors; + +public class ChestESP extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + public final ColorProperty chest = new ColorProperty("chest", new Color(255, 170, 0).getRGB()); + public final ColorProperty trappedChest = new ColorProperty("trapped-chest", new Color(255, 43, 0).getRGB()); + public final ColorProperty enderChest = new ColorProperty("ender-chest", new Color(26, 17, 0).getRGB()); + public final BooleanProperty tracers = new BooleanProperty("tracers", false); + + public ChestESP() { + super("ChestESP", false); + } + + @EventTarget + public void onRender(Render3DEvent event) { + if (this.isEnabled()) { + RenderUtil.enableRenderState(); + for (TileEntity chest : mc.theWorld.loadedTileEntityList.stream().filter(tileEntity -> tileEntity instanceof TileEntityChest || tileEntity instanceof TileEntityEnderChest).collect(Collectors.toList())) { + Block block = mc.theWorld.getBlockState(chest.getPos()).getBlock(); + double minX, minZ, maxX, maxZ; + Color color; + minX = minZ = 0.0625; + maxX = maxZ = 0.9375; + if (block instanceof BlockChest) { + if (block.canProvidePower()) { + color = new Color(this.trappedChest.getValue(), true); + } else { + color = new Color(this.chest.getValue(), true); + } + EnumFacing facing = mc.theWorld.getBlockState(chest.getPos()).getValue(BlockChest.FACING); + switch (facing) { + case NORTH: + if (mc.theWorld.getBlockState(chest.getPos().east()).getBlock() == block) { + continue; + } else if (mc.theWorld.getBlockState(chest.getPos().west()).getBlock() == block) { + minX -= 1; + } + break; + case SOUTH: + if (mc.theWorld.getBlockState(chest.getPos().west()).getBlock() == block) { + continue; + } else if (mc.theWorld.getBlockState(chest.getPos().east()).getBlock() == block) { + maxX += 1; + } + break; + case WEST: + if (mc.theWorld.getBlockState(chest.getPos().north()).getBlock() == block) { + continue; + } else if (mc.theWorld.getBlockState(chest.getPos().south()).getBlock() == block) { + maxZ += 1; + } + break; + case EAST: + if (mc.theWorld.getBlockState(chest.getPos().south()).getBlock() == block) { + continue; + } else if (mc.theWorld.getBlockState(chest.getPos().north()).getBlock() == block) { + minZ -= 1; + } + break; + default: + continue; + } + } else { + color = new Color(this.enderChest.getValue(), true); + } + if (color.getAlpha() == 0) continue; + AxisAlignedBB aabb = new AxisAlignedBB( + (double) chest.getPos().getX() + minX, + (double) chest.getPos().getY() + 0.0, + (double) chest.getPos().getZ() + minZ, + (double) chest.getPos().getX() + maxX, + (double) chest.getPos().getY() + 0.875, + (double) chest.getPos().getZ() + maxZ + ) + .offset( + -((IAccessorRenderManager) mc.getRenderManager()).getRenderPosX(), + -((IAccessorRenderManager) mc.getRenderManager()).getRenderPosY(), + -((IAccessorRenderManager) mc.getRenderManager()).getRenderPosZ() + ); + RenderUtil.drawBoundingBox( + aabb, color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha(), 1.5F + ); + if (this.tracers.getValue()) { + Vec3 vec; + if (mc.gameSettings.thirdPersonView == 0) { + vec = new Vec3(0.0, 0.0, 1.0) + .rotatePitch( + (float) ( + -Math.toRadians( + RenderUtil.lerpFloat( + mc.getRenderViewEntity().rotationPitch, + mc.getRenderViewEntity().prevRotationPitch, + ((IAccessorMinecraft) mc).getTimer().renderPartialTicks + ) + ) + ) + ) + .rotateYaw( + (float) ( + -Math.toRadians( + RenderUtil.lerpFloat( + mc.getRenderViewEntity().rotationYaw, + mc.getRenderViewEntity().prevRotationYaw, + ((IAccessorMinecraft) mc).getTimer().renderPartialTicks + ) + ) + ) + ); + } else { + vec = new Vec3(0.0, 0.0, 0.0) + .rotatePitch( + (float) ( + -Math.toRadians( + RenderUtil.lerpFloat( + mc.thePlayer.cameraPitch, mc.thePlayer.prevCameraPitch, ((IAccessorMinecraft) mc).getTimer().renderPartialTicks + ) + ) + ) + ) + .rotateYaw( + (float) ( + -Math.toRadians( + RenderUtil.lerpFloat( + mc.thePlayer.cameraYaw, mc.thePlayer.prevCameraYaw, ((IAccessorMinecraft) mc).getTimer().renderPartialTicks + ) + ) + ) + ); + } + vec = new Vec3(vec.xCoord, vec.yCoord + (double) mc.getRenderViewEntity().getEyeHeight(), vec.zCoord); + float opacity = (float) ((Tracers) Myau.moduleManager.modules.get(Tracers.class)).opacity.getValue() / 100.0F; + RenderUtil.drawLine3D( + vec, + (double) chest.getPos().getX() + 0.5, + (double) chest.getPos().getY() + 0.5, + (double) chest.getPos().getZ() + 0.5, + (float) color.getRed() / 255.0F, + (float) color.getGreen() / 255.0F, + (float) color.getBlue() / 255.0F, + opacity, + 1.5F + ); + } + } + RenderUtil.disableRenderState(); + } + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.UpdateEvent; +import myau.events.WindowClickEvent; +import myau.mixin.IAccessorItemSword; +import myau.module.Module; +import myau.util.ChatUtil; +import myau.util.ItemUtil; +import myau.property.properties.BooleanProperty; +import myau.property.properties.IntProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.client.resources.I18n; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.*; +import net.minecraft.world.WorldSettings.GameType; +import org.apache.commons.lang3.RandomUtils; + +public class ChestStealer extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private int clickDelay = 0; + private int oDelay = 0; + private boolean inChest = false; + private boolean warnedFull = false; + public final IntProperty minDelay = new IntProperty("min-delay", 1, 0, 20); + public final IntProperty maxDelay = new IntProperty("max-delay", 2, 0, 20); + public final IntProperty openDelay = new IntProperty("open-delay", 1, 0, 20); + public final BooleanProperty autoClose = new BooleanProperty("auto-close", false); + public final BooleanProperty nameCheck = new BooleanProperty("name-check", true); + public final BooleanProperty skipTrash = new BooleanProperty("skip-trash", true); + public final BooleanProperty moreArmor = new BooleanProperty("more-armor", false); + public final BooleanProperty moreSword = new BooleanProperty("more-sword", false); + + private boolean isValidGameMode() { + GameType gameType = mc.playerController.getCurrentGameType(); + return gameType == GameType.SURVIVAL || gameType == GameType.ADVENTURE; + } + + private boolean isMoreArmor(ItemStack itemStack) { + if (itemStack == null) return false; + if (!this.moreArmor.getValue()) return false; + if (! (itemStack.getItem() instanceof ItemArmor)) return false; + ItemArmor.ArmorMaterial armorMaterial = ((ItemArmor) itemStack.getItem()).getArmorMaterial(); + if (armorMaterial == ItemArmor.ArmorMaterial.DIAMOND) return true; + return armorMaterial == ItemArmor.ArmorMaterial.IRON && itemStack.isItemEnchanted(); + } + + private boolean isMoreSword(ItemStack itemStack) { + if (itemStack == null) return false; + if (!this.moreSword.getValue()) return false; + if (! (itemStack.getItem() instanceof ItemSword)) return false; + Item.ToolMaterial swordMaterial = ((IAccessorItemSword) itemStack.getItem()).getMaterial(); + if (swordMaterial == Item.ToolMaterial.EMERALD) return true; + if (EnchantmentHelper.getEnchantmentLevel(Enchantment.fireAspect.effectId, itemStack) != 0) return true; + return swordMaterial == Item.ToolMaterial.IRON && itemStack.isItemEnchanted(); + } + + private boolean isInvManagerRequire(ItemStack itemStack) { + if (itemStack == null) return false; + InvManager invManager = (InvManager) Myau.moduleManager.modules.get(InvManager.class); + if (ItemUtil.ItemType.Block.contains(itemStack)) { + return !invManager.isEnabled() || ItemUtil.findInventorySlot(ItemUtil.ItemType.Block) < invManager.blocks.getValue(); + } + if (ItemUtil.ItemType.Projectile.contains(itemStack)) { + return !invManager.isEnabled() || ItemUtil.findInventorySlot(ItemUtil.ItemType.Projectile) < invManager.projectiles.getValue(); + } + if (ItemUtil.ItemType.FishRod.contains(itemStack)) { + return ItemUtil.findInventorySlot(ItemUtil.ItemType.Projectile) == 0; + } + if (ItemUtil.ItemType.Arrow.contains(itemStack)) { + return !invManager.isEnabled() || ItemUtil.findInventorySlot(ItemUtil.ItemType.Arrow) < invManager.arrow.getValue(); + } + return false; + } + + private void shiftClick(int windowId, int slotId) { + mc.playerController.windowClick(windowId, slotId, 0, 1, mc.thePlayer); + } + + public ChestStealer() { + super("ChestStealer", false); + } + + @EventTarget + public void onUpdate(UpdateEvent event) { + if (event.getType() == EventType.PRE) { + if (this.clickDelay > 0) { + this.clickDelay--; + } + if (this.oDelay > 0) { + this.oDelay--; + } + if (!(mc.currentScreen instanceof GuiChest)) { + this.inChest = false; + } else { + Container container = ((GuiChest) mc.currentScreen).inventorySlots; + if (!(container instanceof ContainerChest)) { + this.inChest = false; + } else { + if (!this.inChest) { + this.inChest = true; + this.warnedFull = false; + this.oDelay = this.openDelay.getValue() + 1; + } + if (this.oDelay <= 0 && this.clickDelay <= 0) { + if (this.isEnabled() && this.isValidGameMode()) { + IInventory inventory = ((ContainerChest) container).getLowerChestInventory(); + if (this.nameCheck.getValue()) { + String inventoryName = inventory.getName(); + if (!inventoryName.equals(I18n.format("container.chest")) && !inventoryName.equals(I18n.format("container.chestDouble"))) { + return; + } + } + if (mc.thePlayer.inventory.getFirstEmptyStack() == -1) { + if (!this.warnedFull) { + ChatUtil.sendFormatted(String.format("%s%s: &cYour inventory is full!&r", Myau.clientName, this.getName())); + this.warnedFull = true; + } + if (this.autoClose.getValue()) { + mc.thePlayer.closeScreen(); + } + } else { + if (this.skipTrash.getValue()) { + int bestSword = -1; + double bestDamage = 0.0; + int[] bestArmorSlots = new int[]{-1, -1, -1, -1}; + double[] bestArmorProtection = new double[]{0.0, 0.0, 0.0, 0.0}; + int bestPickaxeSlot = -1; + float bestPickaxeEfficiency = 1.0F; + int bestShovelSlot = -1; + float bestShovelEfficiency = 1.0F; + int bestAxeSlot = -1; + float bestAxeEfficiency = 1.0F; + int bestBow = -1; + double bestBowDamage = 0.0; + for (int i = 0; i < inventory.getSizeInventory(); i++) { + if (container.getSlot(i).getHasStack()) { + ItemStack stack = container.getSlot(i).getStack(); + Item item = stack.getItem(); + if (item instanceof ItemSword) { + double damage = ItemUtil.getAttackBonus(stack); + if (bestSword == -1 || damage > bestDamage) { + bestSword = i; + bestDamage = damage; + } + } else if (item instanceof ItemArmor) { + int armorType = ((ItemArmor) item).armorType; + double protectionLevel = ItemUtil.getArmorProtection(stack); + if (bestArmorSlots[armorType] == -1 || protectionLevel > bestArmorProtection[armorType]) { + bestArmorSlots[armorType] = i; + bestArmorProtection[armorType] = protectionLevel; + } + } else if (item instanceof ItemPickaxe) { + float efficiency = ItemUtil.getToolEfficiency(stack); + if (bestPickaxeSlot == -1 || efficiency > bestPickaxeEfficiency) { + bestPickaxeSlot = i; + bestPickaxeEfficiency = efficiency; + } + } else if (item instanceof ItemSpade) { + float efficiency = ItemUtil.getToolEfficiency(stack); + if (bestShovelSlot == -1 || efficiency > bestShovelEfficiency) { + bestShovelSlot = i; + bestShovelEfficiency = efficiency; + } + } else if (item instanceof ItemAxe) { + float efficiency = ItemUtil.getToolEfficiency(stack); + if (bestAxeSlot == -1 || efficiency > bestAxeEfficiency) { + bestAxeSlot = i; + bestAxeEfficiency = efficiency; + } + } else if (item instanceof ItemBow) { + double damage = ItemUtil.getBowAttackBonus(stack); + if (bestBow == -1 || damage > bestBowDamage) { + bestBow = i; + bestBowDamage = damage; + } + } + } + } + int swordInInventorySlot = ItemUtil.findSwordInInventorySlot(0, true); + double damage = swordInInventorySlot != -1 ? ItemUtil.getAttackBonus(mc.thePlayer.inventory.getStackInSlot(swordInInventorySlot)) : 0.0; + if (bestDamage > damage) { + this.shiftClick(container.windowId, bestSword); + return; + } + for (int i = 0; i < 4; i++) { + int slot = ItemUtil.findArmorInventorySlot(i, true); + double protectionLevel = slot != -1 + ? ItemUtil.getArmorProtection(mc.thePlayer.inventory.getStackInSlot(slot)) + : 0.0; + if (bestArmorProtection[i] > protectionLevel) { + this.shiftClick(container.windowId, bestArmorSlots[i]); + return; + } + } + int pickaxeSlot = ItemUtil.findInventorySlot("pickaxe", 0, true); + float pickaxeEfficiency = pickaxeSlot != -1 ? ItemUtil.getToolEfficiency(mc.thePlayer.inventory.getStackInSlot(pickaxeSlot)) : 1.0F; + if (bestPickaxeEfficiency > pickaxeEfficiency) { + this.shiftClick(container.windowId, bestPickaxeSlot); + return; + } + int shovelSlot = ItemUtil.findInventorySlot("shovel", 0, true); + float shovelEfficiency = shovelSlot != -1 ? ItemUtil.getToolEfficiency(mc.thePlayer.inventory.getStackInSlot(shovelSlot)) : 1.0F; + if (bestShovelEfficiency > shovelEfficiency) { + this.shiftClick(container.windowId, bestShovelSlot); + return; + } + int axeSlot = ItemUtil.findInventorySlot("axe", 0, true); + float efficiency = axeSlot != -1 ? ItemUtil.getToolEfficiency(mc.thePlayer.inventory.getStackInSlot(axeSlot)) : 1.0F; + if (bestAxeEfficiency > efficiency) { + this.shiftClick(container.windowId, bestAxeSlot); + return; + } + int bowSlot = ItemUtil.findBowInventorySlot(0, true); + double bowDamage = bowSlot != -1 ? ItemUtil.getBowAttackBonus(mc.thePlayer.inventory.getStackInSlot(bowSlot)) : 0.0; + if (bestBowDamage > bowDamage) { + this.shiftClick(container.windowId, bestBow); + return; + } + } + for (int i = 0; i < inventory.getSizeInventory(); i++) { + if (container.getSlot(i).getHasStack()) { + ItemStack stack = container.getSlot(i).getStack(); + if (!this.skipTrash.getValue() || !ItemUtil.isNotSpecialItem(stack) || isMoreArmor(stack) || isMoreSword(stack) || isInvManagerRequire(stack)) { + this.shiftClick(container.windowId, i); + return; + } + } + } + if (this.autoClose.getValue()) { + mc.thePlayer.closeScreen(); + } + } + } + } + } + } + } + } + + @EventTarget + public void onWindowClick(WindowClickEvent event) { + this.clickDelay = RandomUtils.nextInt(this.minDelay.getValue() + 1, this.maxDelay.getValue() + 2); + } + + @Override + public void verifyValue(String mode) { + switch (mode) { + case "min-delay": + if (this.minDelay.getValue() > this.maxDelay.getValue()) { + this.maxDelay.setValue(this.minDelay.getValue()); + } + break; + case "max-delay": + if (this.minDelay.getValue() > this.maxDelay.getValue()) { + this.minDelay.setValue(this.maxDelay.getValue()); + } + } + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.event.types.Priority; +import myau.events.MoveInputEvent; +import myau.events.TickEvent; +import myau.module.Module; +import myau.util.ItemUtil; +import myau.util.MoveUtil; +import myau.util.PlayerUtil; +import myau.property.properties.BooleanProperty; +import myau.property.properties.IntProperty; +import net.minecraft.client.Minecraft; +import org.apache.commons.lang3.RandomUtils; +import org.lwjgl.input.Keyboard; + +import java.util.Objects; + +public class Eagle extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private int sneakDelay = 0; + public final IntProperty minDelay = new IntProperty("min-delay", 2, 0, 10); + public final IntProperty maxDelay = new IntProperty("max-delay", 3, 0, 10); + public final BooleanProperty directionCheck = new BooleanProperty("direction-check", true); + public final BooleanProperty pitchCheck = new BooleanProperty("pitch-check", true); + public final BooleanProperty blocksOnly = new BooleanProperty("blocks-only", true); + public final BooleanProperty sneakOnly = new BooleanProperty("sneaking-only", false); + + private boolean canMoveSafely() { + double[] offset = MoveUtil.predictMovement(); + return PlayerUtil.canMove(mc.thePlayer.motionX + offset[0], mc.thePlayer.motionZ + offset[1]); + } + + private boolean shouldSneak() { + if (this.directionCheck.getValue() && mc.gameSettings.keyBindForward.isKeyDown()) { + return false; + } else if (this.pitchCheck.getValue() && mc.thePlayer.rotationPitch < 69.0F) { + return false; + } else if(sneakOnly.getValue() && !Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode())){ + return false; + } else { + return (!this.blocksOnly.getValue() || ItemUtil.isHoldingBlock()) && mc.thePlayer.onGround; + } + } + + public Eagle() { + super("Eagle", false); + } + + @EventTarget(Priority.LOWEST) + public void onTick(TickEvent event) { + if (this.isEnabled() && event.getType() == EventType.PRE) { + if (this.sneakDelay > 0) { + this.sneakDelay--; + } + if (this.sneakDelay == 0 && this.canMoveSafely()) { + this.sneakDelay = RandomUtils.nextInt(this.minDelay.getValue(), this.maxDelay.getValue() + 1); + } + } + } + + @EventTarget(Priority.LOWEST) + public void onMoveInput(MoveInputEvent event) { + if (this.isEnabled() && mc.currentScreen == null) { + + if(sneakOnly.getValue() && Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode()) && shouldSneak()){ + mc.thePlayer.movementInput.sneak = false; + mc.thePlayer.movementInput.moveForward /= 0.3F; + mc.thePlayer.movementInput.moveStrafe /= 0.3F; + } + + if(!mc.thePlayer.movementInput.sneak) { + if (this.shouldSneak() && (this.sneakDelay > 0 || this.canMoveSafely())) { + mc.thePlayer.movementInput.sneak = true; + mc.thePlayer.movementInput.moveStrafe *= 0.3F; + mc.thePlayer.movementInput.moveForward *= 0.3F; + } + } + } + } + + @Override + public void onDisabled() { + this.sneakDelay = 0; + } + + @Override + public void verifyValue(String name) { + switch (name) { + case "min-delay": + if (this.minDelay.getValue() > this.maxDelay.getValue()) { + this.maxDelay.setValue(this.minDelay.getValue()); + } + break; + case "max-delay": + if (this.minDelay.getValue() > this.maxDelay.getValue()) { + this.minDelay.setValue(this.maxDelay.getValue()); + } + } + } + + @Override + public String[] getSuffix() { + return Objects.equals(this.minDelay.getValue(), this.maxDelay.getValue()) + ? new String[]{this.minDelay.getValue().toString()} + : new String[]{String.format("%d-%d", this.minDelay.getValue(), this.maxDelay.getValue())}; + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.Render3DEvent; +import myau.events.TickEvent; +import myau.module.Module; +import myau.property.properties.BooleanProperty; +import myau.property.properties.ColorProperty; +import myau.property.properties.IntProperty; +import myau.util.RenderUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; +import net.minecraft.util.BlockPos; + +import java.awt.*; +import java.util.concurrent.CopyOnWriteArraySet; + +public class EggESP extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + + // Cache of found eggs + private final CopyOnWriteArraySet eggs = new CopyOnWriteArraySet<>(); + + // Settings + public final IntProperty range = new IntProperty("range", 48, 8, 128); + public final IntProperty yRange = new IntProperty("y-range", 32, 8, 128); + public final BooleanProperty outline = new BooleanProperty("outline", true); + public final ColorProperty color = new ColorProperty("color", new Color(108, 0, 210).getRGB()); + + public EggESP() { + super("EggESP", true); + } + + @EventTarget + public void onTick(TickEvent event) { + if (!this.isEnabled()) return; + if (event.getType() != EventType.POST) return; + + if (mc.theWorld == null || mc.thePlayer == null) { + eggs.clear(); + return; + } + + // Don’t scan every tick to reduce load + // (every 10 ticks ≈ twice per second) + if (mc.thePlayer.ticksExisted % 10 != 0) return; + + scanForEggs(); + } + + private void scanForEggs() { + eggs.clear(); + + BlockPos base = mc.thePlayer.getPosition(); + int r = range.getValue(); + int yr = yRange.getValue(); + + int minY = Math.max(0, base.getY() - yr); + int maxY = Math.min(255, base.getY() + yr); + + for (int x = base.getX() - r; x <= base.getX() + r; x++) { + for (int z = base.getZ() - r; z <= base.getZ() + r; z++) { + for (int y = minY; y <= maxY; y++) { + BlockPos pos = new BlockPos(x, y, z); + + // Avoid chunk loads / unnecessary lookups + if (!mc.theWorld.isBlockLoaded(pos, false)) continue; + + if (mc.theWorld.getBlockState(pos).getBlock() == Blocks.dragon_egg) { + eggs.add(pos); + } + } + } + } + } + + @EventTarget + public void onRender(Render3DEvent event) { + if (!this.isEnabled()) return; + if (mc.theWorld == null || mc.thePlayer == null) return; + + Color c = new Color(color.getValue()); + + RenderUtil.enableRenderState(); + + for (BlockPos pos : eggs) { + // If egg got broken / moved, drop it from cache + if (!mc.theWorld.isBlockLoaded(pos, false) || + mc.theWorld.getBlockState(pos).getBlock() != Blocks.dragon_egg) { + eggs.remove(pos); + continue; + } + + if (outline.getValue()) { + RenderUtil.drawBlockBoundingBox(pos, 1.0, c.getRed(), c.getGreen(), c.getBlue(), 255, 1.5F); + } + RenderUtil.drawBlockBox(pos, 1.0, c.getRed(), c.getGreen(), c.getBlue()); + } + + RenderUtil.disableRenderState(); + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.enums.ChatColors; +import myau.event.EventTarget; +import myau.event.types.Priority; +import myau.events.Render2DEvent; +import myau.events.Render3DEvent; +import myau.events.ResizeEvent; +import myau.mixin.IAccessorEntityRenderer; +import myau.mixin.IAccessorRenderManager; +import myau.module.Module; +import myau.util.ColorUtil; +import myau.util.RenderUtil; +import myau.util.TeamUtil; +import myau.util.shader.GlowShader; +import myau.util.shader.OutlineShader; +import myau.property.properties.BooleanProperty; +import myau.property.properties.ModeProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.shader.Framebuffer; +import net.minecraft.entity.player.EntityPlayer; + +import javax.vecmath.Vector4d; +import java.awt.*; +import java.util.List; +import java.util.stream.Collectors; + +public class ESP extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private final OutlineShader outlineRenderer = new OutlineShader(); + private final GlowShader glowShader = new GlowShader(); + private Framebuffer framebuffer = null; + private boolean outline = true; + private boolean glow = true; + public final ModeProperty mode = new ModeProperty("mode", 2, new String[]{"NONE", "2D", "3D", "OUTLINE", "FAKECORNER", "FAKE2D"}); + public final ModeProperty color = new ModeProperty("color", 0, new String[]{"DEFAULT", "TEAMS", "HUD"}); + public final ModeProperty healthBar = new ModeProperty("health-bar", 0, new String[]{"NONE", "2D", "RAVEN"}); + public final BooleanProperty players = new BooleanProperty("players", true); + public final BooleanProperty friends = new BooleanProperty("friends", true); + public final BooleanProperty enemies = new BooleanProperty("enemies", true); + public final BooleanProperty self = new BooleanProperty("self", false); + public final BooleanProperty bots = new BooleanProperty("bots", false); + + private boolean shouldRenderPlayer(EntityPlayer entityPlayer) { + if (entityPlayer.deathTime > 0) { + return false; + } else if (mc.getRenderViewEntity().getDistanceToEntity(entityPlayer) > 512.0F) { + return false; + } else if (!entityPlayer.ignoreFrustumCheck && !RenderUtil.isInViewFrustum(entityPlayer.getEntityBoundingBox(), 0.1F)) { + return false; + } else if (entityPlayer != mc.thePlayer && entityPlayer != mc.getRenderViewEntity()) { + if (TeamUtil.isBot(entityPlayer)) { + return this.bots.getValue(); + } else if (TeamUtil.isFriend(entityPlayer)) { + return this.friends.getValue(); + } else { + return TeamUtil.isTarget(entityPlayer) ? this.enemies.getValue() : this.players.getValue(); + } + } else { + return this.self.getValue() && mc.gameSettings.thirdPersonView != 0; + } + } + + private Color getEntityColor(EntityPlayer entityPlayer) { + if (TeamUtil.isFriend(entityPlayer)) { + return Myau.friendManager.getColor(); + } else if (TeamUtil.isTarget(entityPlayer)) { + return Myau.targetManager.getColor(); + } else { + switch (this.color.getValue()) { + case 0: + return TeamUtil.getTeamColor(entityPlayer, 1.0F); + case 1: + int teamColor = TeamUtil.isSameTeam(entityPlayer) ? ChatColors.BLUE.toAwtColor() : ChatColors.RED.toAwtColor(); + return new Color(teamColor); + case 2: + int hudColor = ((HUD) Myau.moduleManager.modules.get(HUD.class)).getColor(System.currentTimeMillis()).getRGB(); + return new Color(hudColor); + default: + return new Color(-1); + } + } + } + + public ESP() { + super("ESP", false); + } + + public boolean isOutlineEnabled() { + return this.outline; + } + + public boolean isGlowEnabled() { + return this.glow; + } + + @EventTarget + public void onResize(ResizeEvent event) { + if (this.framebuffer != null) { + this.framebuffer.deleteFramebuffer(); + } + this.framebuffer = new Framebuffer(mc.displayWidth, mc.displayHeight, false); + } + + @EventTarget(Priority.HIGH) + public void onRender(Render2DEvent event) { + if (this.isEnabled() && (this.mode.getValue() == 1 || this.mode.getValue() == 3 || this.healthBar.getValue() == 1)) { + List renderedEntities = TeamUtil.getLoadedEntitiesSorted().stream().filter(entity -> entity instanceof EntityPlayer && this.shouldRenderPlayer((EntityPlayer) entity)).map(EntityPlayer.class::cast).collect(Collectors.toList()); + if (!renderedEntities.isEmpty()) { + if (this.mode.getValue() == 3) { + GlStateManager.pushMatrix(); + GlStateManager.pushAttrib(); + if (this.framebuffer == null) { + this.framebuffer = new Framebuffer(mc.displayWidth, mc.displayHeight, false); + } + this.framebuffer.bindFramebuffer(false); + ((IAccessorEntityRenderer) mc.entityRenderer).callSetupCameraTransform(event.getPartialTicks(), 0); + boolean shadow = mc.gameSettings.entityShadows; + mc.gameSettings.entityShadows = false; + this.outline = false; + this.glow = false; + this.glowShader.use(); + for (EntityPlayer player : renderedEntities) { + Color entityColor = this.getEntityColor(player); + this.glowShader.W(entityColor); + boolean invisible = player.isInvisible(); + player.setInvisible(false); + mc.getRenderManager().renderEntityStatic(player, event.getPartialTicks(), true); + player.setInvisible(invisible); + } + this.glowShader.stop(); + this.glow = true; + this.outline = true; + mc.gameSettings.entityShadows = shadow; + mc.entityRenderer.disableLightmap(); + mc.entityRenderer.setupOverlayRendering(); + mc.getFramebuffer().bindFramebuffer(false); + this.outlineRenderer.use(); + RenderUtil.drawFramebuffer(this.framebuffer); + this.outlineRenderer.stop(); + this.framebuffer.framebufferClear(); + mc.getFramebuffer().bindFramebuffer(false); + GlStateManager.popAttrib(); + GlStateManager.popMatrix(); + } + if (this.mode.getValue() == 1 || this.healthBar.getValue() == 1) { + RenderUtil.enableRenderState(); + double scaleFactor = new ScaledResolution(mc).getScaleFactor(); + double scale = scaleFactor / Math.pow(scaleFactor, 2.0); + GlStateManager.pushMatrix(); + GlStateManager.scale(scale, scale, scale); + for (EntityPlayer player : renderedEntities) { + ((IAccessorEntityRenderer) mc.entityRenderer).callSetupCameraTransform(event.getPartialTicks(), 0); + Vector4d screenPosition = RenderUtil.projectToScreen(player, scaleFactor); + mc.entityRenderer.setupOverlayRendering(); + if (screenPosition != null) { + float x = (float) screenPosition.x; + float y = (float) screenPosition.y; + float z = (float) screenPosition.z; + float w = (float) screenPosition.w; + if (this.mode.getValue() == 1) { + int color = this.getEntityColor(player).getRGB(); + RenderUtil.drawOutlineRect(x, y, z, w, 3.0F, 0, (color & 16579836) >> 2 | color & 0xFF000000); + RenderUtil.drawOutlineRect(x, y, z, w, 1.5F, 0, color); + } + if (this.healthBar.getValue() == 1) { + float heal = player.getHealth() + player.getAbsorptionAmount(); + float percent = Math.min(Math.max(heal / player.getMaxHealth(), 0.0F), 1.0F); + float box = (z - x) * 0.08F; + Color healthColor = ColorUtil.getHealthBlend(percent); + RenderUtil.drawLine(x - box, y, x - box, w, 3.0F, ColorUtil.darker(healthColor, 0.2F).getRGB()); + RenderUtil.drawLine(x - box, w, x - box, w + (y - w) * percent, 1.5F, healthColor.getRGB()); + } + } + } + GlStateManager.popMatrix(); + RenderUtil.disableRenderState(); + } + } + } + } + + @EventTarget + public void onRender(Render3DEvent event) { + if (this.isEnabled() && (this.mode.getValue() == 2 || this.mode.getValue() == 4 || this.mode.getValue() == 5 || this.healthBar.getValue() == 2)) { + RenderUtil.enableRenderState(); + for (EntityPlayer player : TeamUtil.getLoadedEntitiesSorted().stream().filter(entity -> entity instanceof EntityPlayer && this.shouldRenderPlayer((EntityPlayer) entity)).map(EntityPlayer.class::cast).collect(Collectors.toList())) { + if (player.ignoreFrustumCheck || RenderUtil.isInViewFrustum(player.getEntityBoundingBox(), 0.1F)) { + if (this.mode.getValue() == 2) { + Color color = this.getEntityColor(player); + RenderUtil.drawEntityBoundingBox(player, color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha(), 1.5F, 0.1F); + GlStateManager.resetColor(); + } + if (this.mode.getValue() == 4) { + Color color = this.getEntityColor(player); + RenderUtil.drawCornerESP(player, color.getRed() / 255.0F, color.getGreen() / 255.0F, color.getBlue() / 255.0F); + } + if (this.mode.getValue() == 5) { + Color color = this.getEntityColor(player); + RenderUtil.drawFake2DESP(player, color.getRed() / 255.0F, color.getGreen() / 255.0F, color.getBlue() / 255.0F); + } + if (this.healthBar.getValue() == 2) { + double x = RenderUtil.lerpDouble(player.posX, player.lastTickPosX, event.getPartialTicks()) + - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosX(); + double y = RenderUtil.lerpDouble(player.posY, player.lastTickPosY, event.getPartialTicks()) + - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosY() + - 0.1F; + double z = RenderUtil.lerpDouble(player.posZ, player.lastTickPosZ, event.getPartialTicks()) + - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosZ(); + GlStateManager.pushMatrix(); + GlStateManager.translate(x, y, z); + GlStateManager.rotate(mc.getRenderManager().playerViewY * -1.0F, 0.0F, 1.0F, 0.0F); + float heal = player.getHealth() + player.getAbsorptionAmount(); + float percent = Math.min(Math.max(heal / player.getMaxHealth(), 0.0F), 1.0F); + Color healthColor = ColorUtil.getHealthBlend(percent); + float height = player.height + 0.2F; + RenderUtil.drawRect3D(0.57250005F, -0.027500002F, 0.7275F, height + 0.027500002F, Color.black.getRGB()); + RenderUtil.drawRect3D(0.6F, 0.0F, 0.70000005F, height, Color.darkGray.getRGB()); + RenderUtil.drawRect3D(0.6F, 0.0F, 0.70000005F, height * percent, healthColor.getRGB()); + GlStateManager.popMatrix(); + } + } + } + RenderUtil.disableRenderState(); + } + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.TickEvent; +import myau.mixin.IAccessorMinecraft; +import myau.module.Module; +import myau.util.BlockUtil; +import myau.util.RotationUtil; +import myau.property.properties.BooleanProperty; +import myau.property.properties.FloatProperty; +import net.minecraft.block.Block; +import net.minecraft.block.BlockObsidian; +import net.minecraft.client.Minecraft; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemFishingRod; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.MovingObjectPosition.MovingObjectType; + +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.Locale; + +public class FastPlace extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private static final DecimalFormat df = new DecimalFormat("0.0#", new DecimalFormatSymbols(Locale.US)); + private long delayMS = 0L; + public final FloatProperty delay = new FloatProperty("delay", 1.0F, 1.0F, 3.0F); + public final BooleanProperty blocksOnly = new BooleanProperty("blocks-only", true); + public final BooleanProperty placeFix = new BooleanProperty("place-fix", true); + public final BooleanProperty skipObsidian = new BooleanProperty("skip-obsidian", true); + public final BooleanProperty skipInteractable = new BooleanProperty("skip-interactable", true); + + private boolean canPlace() { + ItemStack stack = mc.thePlayer.getHeldItem(); + if (stack != null) { + Item item = stack.getItem(); + if (item instanceof ItemFishingRod) { + return false; + } + if (item instanceof ItemBlock) { + Block block = ((ItemBlock) item).getBlock(); + if (skipObsidian.getValue() && block instanceof BlockObsidian) { + return false; + } + if (skipInteractable.getValue() && BlockUtil.isInteractable(block)) { + return false; + } + if (!(Boolean) this.placeFix.getValue()) { + return true; + } + MovingObjectPosition mop = RotationUtil.rayTrace( + mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch, mc.playerController.getBlockReachDistance(), 1.0F + ); + return mop != null + && mop.typeOfHit == MovingObjectType.BLOCK + && ((ItemBlock) item).canPlaceBlockOnSide(mc.theWorld, mop.getBlockPos(), mop.sideHit, mc.thePlayer, stack); + } + } + return !(Boolean) this.blocksOnly.getValue(); + } + + public FastPlace() { + super("FastPlace", false); + } + + @EventTarget + public void onTick(TickEvent event) { + if (this.isEnabled() && event.getType() == EventType.PRE) { + int rightClickDelayTimer = ((IAccessorMinecraft) mc).getRightClickDelayTimer(); + if (rightClickDelayTimer == 4) { + this.delayMS = this.delayMS + (long) (50.0F * this.delay.getValue()); + } + if (this.delayMS > 0L) { + this.delayMS = this.delayMS - 50; + } + if (this.delayMS <= 0L && rightClickDelayTimer > 1 && this.canPlace()) { + ((IAccessorMinecraft) mc).setRightClickDelayTimer(0); + } + } + } + + @Override + public void onDisabled() { + this.delayMS = 0L; + } + + @Override + public String[] getSuffix() { + return new String[]{df.format(this.delay.getValue())}; + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.StrafeEvent; +import myau.events.UpdateEvent; +import myau.module.Module; +import myau.util.KeyBindUtil; +import myau.util.MoveUtil; +import myau.property.properties.FloatProperty; +import net.minecraft.client.Minecraft; + +public class Fly extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private double verticalMotion = 0.0; + public final FloatProperty hSpeed = new FloatProperty("horizontal-speed", 1.0F, 0.0F, 100.0F); + public final FloatProperty vSpeed = new FloatProperty("vertical-speed", 1.0F, 0.0F, 100.0F); + + public Fly() { + super("Fly", false); + } + + @EventTarget + public void onStrafe(StrafeEvent event) { + if (this.isEnabled()) { + if (mc.thePlayer.posY % 1.0 != 0.0) { + mc.thePlayer.motionY = this.verticalMotion; + } + MoveUtil.setSpeed(0.0); + event.setFriction((float) MoveUtil.getBaseMoveSpeed() * this.hSpeed.getValue()); + } + } + + @EventTarget + public void onUpdate(UpdateEvent event) { + if (this.isEnabled() && event.getType() == EventType.PRE) { + this.verticalMotion = 0.0; + if (mc.currentScreen == null) { + if (KeyBindUtil.isKeyDown(mc.gameSettings.keyBindJump.getKeyCode())) { + this.verticalMotion = this.verticalMotion + this.vSpeed.getValue().doubleValue() * 0.42F; + } + if (KeyBindUtil.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode())) { + this.verticalMotion = this.verticalMotion - this.vSpeed.getValue().doubleValue() * 0.42F; + } + KeyBindUtil.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), false); + } + } + } + + @Override + public void onDisabled() { + mc.thePlayer.motionY = 0.0; + MoveUtil.setSpeed(0.0); + KeyBindUtil.updateKeyState(mc.gameSettings.keyBindSneak.getKeyCode()); + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.event.types.Priority; +import myau.events.LoadWorldEvent; +import myau.events.PacketEvent; +import myau.events.Render2DEvent; +import myau.events.TickEvent; +import myau.module.Module; +import myau.property.properties.BooleanProperty; +import myau.property.properties.IntProperty; +import myau.util.ChatUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.network.Packet; +import net.minecraft.network.play.INetHandlerPlayClient; +import net.minecraft.network.play.server.S08PacketPlayerPosLook; +import net.minecraft.network.play.server.S12PacketEntityVelocity; +import net.minecraft.network.play.server.S19PacketEntityStatus; +import net.minecraft.network.play.server.S32PacketConfirmTransaction; + +import java.awt.Color; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class Freeze extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + + private final List> packets = new ArrayList<>(); + private boolean delaying = false; + private int timeout = 0; + private boolean s08 = false; + private final int color = new Color(209, 1, 1, 255).getRGB(); + + public final BooleanProperty renderTimer = new BooleanProperty("render-timer", false); + public final IntProperty maxTimeout = new IntProperty("max-timeout", 300, 50, 600); + + public Freeze() { + super("Freeze", false); + } + + @EventTarget(Priority.HIGHEST) + public void onPacket(PacketEvent event) { + if (!this.isEnabled() || event.getType() != EventType.RECEIVE || event.isCancelled()) { + return; + } + + if (mc.thePlayer == null || mc.theWorld == null) { + return; + } + + Packet packet = event.getPacket(); + + // Check for S08 flag (teleport packet) + if (!this.delaying && packet instanceof S08PacketPlayerPosLook) { + this.s08 = true; + } + + // Check for velocity packet targeting player + if (packet instanceof S12PacketEntityVelocity) { + S12PacketEntityVelocity s12 = (S12PacketEntityVelocity) packet; + if (s12.getEntityID() == mc.thePlayer.getEntityId()) { + // Ignore velocity right after teleport + if (this.s08) { + this.s08 = false; + return; + } + // Start delaying + this.delaying = true; + } + } + + // Check for damage (entity status packet with hurt animation) + if (packet instanceof S19PacketEntityStatus) { + S19PacketEntityStatus s19 = (S19PacketEntityStatus) packet; + if (s19.getEntity(mc.theWorld) != null && + s19.getEntity(mc.theWorld).equals(mc.thePlayer) && + s19.getOpCode() == 2) { // OpCode 2 = hurt animation + this.delaying = true; + } + } + + // Buffer relevant packets when delaying + if (this.delaying && (packet instanceof S12PacketEntityVelocity + || packet instanceof S32PacketConfirmTransaction + || packet instanceof S08PacketPlayerPosLook)) { + + synchronized (this.packets) { + @SuppressWarnings("unchecked") + Packet playPacket = (Packet) packet; + this.packets.add(playPacket); + } + + event.setCancelled(true); + } + } + + @EventTarget(Priority.MEDIUM) + public void onTick(TickEvent event) { + if (!this.isEnabled()) { + return; + } + + if (event.getType() == EventType.POST) { + // Check timeout + if (this.delaying && ++this.timeout >= this.maxTimeout.getValue()) { + this.flush(); + ChatUtil.sendFormatted(Myau.clientName + "&cFreeze timed out."); + } + + // Reset S08 flag + this.s08 = false; + } + } + + @EventTarget + public void onRender2D(Render2DEvent event) { + if (!this.isEnabled() || !this.renderTimer.getValue()) { + return; + } + + if (mc.thePlayer == null || this.timeout == 0) { + return; + } + + if (mc.currentScreen != null) { + return; + } + + this.renderTimer(this.timeout); + } + + @EventTarget + public void onLoadWorld(LoadWorldEvent event) { + this.flush(); + } + + private void renderTimer(int ticks) { + int widthOffset = ticks < 10 ? 4 : + (ticks >= 10 && ticks < 100 ? 7 : + (ticks >= 100 && ticks < 1000 ? 10 : 13)); + + String text = String.valueOf(ticks); + int width = mc.fontRendererObj.getStringWidth(text); + ScaledResolution sr = new ScaledResolution(mc); + + int screenWidth = sr.getScaledWidth(); + int screenHeight = sr.getScaledHeight(); + float yadd = 8.0f; + + mc.fontRendererObj.drawStringWithShadow( + text, + (float)(screenWidth / 2 - width + widthOffset), + (float)(screenHeight / 2 + (int)yadd), + this.color + ); + } + + private void flush() { + if (this.packets.isEmpty()) { + this.delaying = false; + this.timeout = 0; + return; + } + + synchronized (this.packets) { + while (!this.packets.isEmpty()) { + Packet packet = this.packets.remove(0); + + try { + packet.processPacket(mc.getNetHandler()); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + this.delaying = false; + this.timeout = 0; + } + + @Override + public void onDisabled() { + this.flush(); + } + + @Override + public String[] getSuffix() { + if (this.delaying && this.timeout > 0) { + return new String[]{String.valueOf(this.timeout)}; + } + return new String[]{"Ready"}; + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.TickEvent; +import myau.module.Module; +import myau.property.properties.ModeProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; + +public class FullBright extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private float prevGamma = Float.NaN; + private boolean appliedNightVision = false; + public final ModeProperty mode = new ModeProperty("mode", 0, new String[]{"GAMMA", "EFFECT"}); + + public FullBright() { + super("Fullbright", true, true); + } + + @EventTarget + public void onTick(TickEvent event) { + if (this.isEnabled() && event.getType() == EventType.POST) { + switch (this.mode.getValue()) { + case 0: + mc.gameSettings.gammaSetting = 1000.0F; + break; + case 1: + mc.thePlayer.addPotionEffect(new PotionEffect(Potion.nightVision.id, 25940, 0)); + } + } + } + + @Override + public void onEnabled() { + switch (this.mode.getValue()) { + case 0: + this.prevGamma = mc.gameSettings.gammaSetting; + break; + case 1: + this.appliedNightVision = true; + } + } + + @Override + public void onDisabled() { + if (!Float.isNaN(this.prevGamma)) { + mc.gameSettings.gammaSetting = this.prevGamma; + this.prevGamma = Float.NaN; + } + if (this.appliedNightVision) { + if (mc.thePlayer != null) { + mc.thePlayer.removePotionEffectClient(Potion.nightVision.id); + } + this.appliedNightVision = false; + } + } + + @Override + public void verifyValue(String mode) { + if (this.isEnabled()) { + this.onDisabled(); + this.onEnabled(); + } + } +} + + + +package myau.module.modules; + +import myau.module.Module; +import myau.util.ItemUtil; +import myau.util.TeamUtil; +import myau.property.properties.BooleanProperty; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; + +public class GhostHand extends Module { + public final BooleanProperty teamsOnly = new BooleanProperty("team-only", true); + public final BooleanProperty ignoreWeapons = new BooleanProperty("ignore-weapons", false); + + public GhostHand() { + super("GhostHand", false); + } + + public boolean shouldSkip(Entity entity) { + return entity instanceof EntityPlayer + && !TeamUtil.isBot((EntityPlayer) entity) + && (!this.teamsOnly.getValue() || TeamUtil.isSameTeam((EntityPlayer) entity)) + && (!this.ignoreWeapons.getValue() || !ItemUtil.hasRawUnbreakingEnchant()); + } +} + + + +package myau.module.modules; + +import myau.module.Module; +import myau.ui.ClickGui; +import net.minecraft.client.Minecraft; +import org.lwjgl.input.Keyboard; + +public class GuiModule extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private ClickGui clickGui; + + public GuiModule() { + super("ClickGui", false); + setKey(Keyboard.KEY_RSHIFT); + } + + @Override + public void onEnabled() { + setEnabled(false); + if(clickGui == null){ + clickGui = new ClickGui(); + } + mc.displayGuiScreen(clickGui); + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.event.types.Priority; +import myau.events.LeftClickMouseEvent; +import myau.events.Render3DEvent; +import myau.events.TickEvent; +import myau.mixin.IAccessorRenderManager; +import myau.module.Module; +import myau.util.RenderUtil; +import myau.util.TeamUtil; +import myau.property.properties.BooleanProperty; +import myau.property.properties.ColorProperty; +import myau.property.properties.FloatProperty; +import myau.property.properties.ModeProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.boss.EntityDragon; +import net.minecraft.entity.boss.EntityWither; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.entity.monster.EntityMob; +import net.minecraft.entity.monster.EntitySilverfish; +import net.minecraft.entity.monster.EntitySlime; +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.entity.passive.EntitySquid; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; + +import java.awt.*; +import java.util.List; +import java.util.stream.Collectors; + +public class HitBox extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private MovingObjectPosition targetEntity = null; + public final FloatProperty multiplier = new FloatProperty("multiplier", 1.2F, 1.0F, 5.0F); + public final ModeProperty showHitbox = new ModeProperty("show-hitbox", 0, new String[]{"NONE", "PLAYERS", "MOBS", "ANIMALS", "ALL"}); + public final ColorProperty color = new ColorProperty("color", new Color(255, 255, 255).getRGB(), () -> this.showHitbox.getValue() != 0); + public final BooleanProperty teams = new BooleanProperty("teams", true, () -> this.showHitbox.getValue() == 1 || this.showHitbox.getValue() == 4); + public final BooleanProperty botCheck = new BooleanProperty("bot-check", true, () -> this.showHitbox.getValue() == 1 || this.showHitbox.getValue() == 4); + + public HitBox() { + super("HitBox", false); + } + + public static float getExpansion(Entity entity) { + HitBox hitBox = (HitBox) Myau.moduleManager.modules.get(HitBox.class); + if (hitBox != null && hitBox.isEnabled() && entity instanceof EntityLivingBase) { + return hitBox.multiplier.getValue(); + } + return 1.0F; + } + + private void calculateMouseOver(float partialTicks) { + if (mc.getRenderViewEntity() != null && mc.theWorld != null) { + mc.pointedEntity = null; + Entity pointedEntity = null; + double reach = 3.0; + this.targetEntity = mc.getRenderViewEntity().rayTrace(reach, partialTicks); + double distance = reach; + Vec3 eyePos = mc.getRenderViewEntity().getPositionEyes(partialTicks); + if (this.targetEntity != null) { + distance = this.targetEntity.hitVec.distanceTo(eyePos); + } + Vec3 lookVec = mc.getRenderViewEntity().getLook(partialTicks); + Vec3 reachVec = eyePos.addVector(lookVec.xCoord * reach, lookVec.yCoord * reach, lookVec.zCoord * reach); + Vec3 hitVec = null; + float expansion = 1.0F; + List entities = mc.theWorld.getEntitiesWithinAABBExcludingEntity( + mc.getRenderViewEntity(), + mc.getRenderViewEntity() + .getEntityBoundingBox() + .addCoord(lookVec.xCoord * reach, lookVec.yCoord * reach, lookVec.zCoord * reach) + .expand(expansion, expansion, expansion) + ); + double closestDistance = distance; + for (Entity entity : entities) { + if (entity.canBeCollidedWith()) { + float collisionSize = (float) ((double) entity.getCollisionBorderSize() * getExpansion(entity)); + AxisAlignedBB expandedBox = entity.getEntityBoundingBox().expand(collisionSize, collisionSize, collisionSize); + MovingObjectPosition intercept = expandedBox.calculateIntercept(eyePos, reachVec); + if (expandedBox.isVecInside(eyePos)) { + if (0.0 < closestDistance || closestDistance == 0.0) { + pointedEntity = entity; + hitVec = intercept == null ? eyePos : intercept.hitVec; + closestDistance = 0.0; + } + } else if (intercept != null) { + double interceptDistance = eyePos.distanceTo(intercept.hitVec); + if (interceptDistance < closestDistance || closestDistance == 0.0) { + if (entity == mc.getRenderViewEntity().ridingEntity && !entity.canRiderInteract()) { + if (closestDistance == 0.0) { + pointedEntity = entity; + hitVec = intercept.hitVec; + } + } else { + pointedEntity = entity; + hitVec = intercept.hitVec; + closestDistance = interceptDistance; + } + } + } + } + } + if (pointedEntity != null && (closestDistance < distance || this.targetEntity == null)) { + this.targetEntity = new MovingObjectPosition(pointedEntity, hitVec); + if (pointedEntity instanceof EntityLivingBase || pointedEntity instanceof EntityItemFrame) { + mc.pointedEntity = pointedEntity; + } + } + } + } + + private boolean shouldShowEntity(EntityLivingBase entity) { + if (entity == mc.thePlayer) { + return false; + } + if (entity.deathTime > 0 || entity instanceof EntityArmorStand || entity.isInvisible()) { + return false; + } + if (mc.getRenderViewEntity().getDistanceToEntity(entity) > 128.0F) { + return false; + } + if (!entity.ignoreFrustumCheck && !RenderUtil.isInViewFrustum(entity.getEntityBoundingBox(), 0.1F)) { + return false; + } + switch (this.showHitbox.getValue()) { + case 0: + return false; + case 1: + if (entity instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) entity; + if (TeamUtil.isFriend(player)) { + return false; + } + if (this.teams.getValue() && TeamUtil.isSameTeam(player)) { + return false; + } + if (this.botCheck.getValue() && TeamUtil.isBot(player)) { + return false; + } + return true; + } + return false; + case 2: + if (entity instanceof EntityDragon || entity instanceof EntityWither) { + return true; + } + if (entity instanceof EntityMob || entity instanceof EntitySlime) { + return !(entity instanceof EntitySilverfish); + } + return false; + case 3: + return entity instanceof EntityAnimal + || entity instanceof EntityBat + || entity instanceof EntitySquid + || entity instanceof EntityVillager + || entity instanceof EntityIronGolem; + case 4: + if (entity instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) entity; + if (TeamUtil.isFriend(player)) { + return false; + } + if (this.teams.getValue() && TeamUtil.isSameTeam(player)) { + return false; + } + if (this.botCheck.getValue() && TeamUtil.isBot(player)) { + return false; + } + } + return true; + default: + return false; + } + } + + @EventTarget + public void onTick(TickEvent event) { + if (this.isEnabled() && event.getType() == EventType.PRE) { + this.calculateMouseOver(1.0F); + } + } + + @EventTarget(Priority.HIGH) + public void onLeftClick(LeftClickMouseEvent event) { + if (this.isEnabled() && !event.isCancelled() && this.targetEntity != null) { + mc.objectMouseOver = this.targetEntity; + } + } + + @EventTarget + public void onRender(Render3DEvent event) { + if (this.isEnabled() && this.showHitbox.getValue() != 0) { + List entities = mc.theWorld.loadedEntityList + .stream() + .filter(entity -> entity instanceof EntityLivingBase) + .map(entity -> (EntityLivingBase) entity) + .filter(this::shouldShowEntity) + .collect(Collectors.toList()); + if (!entities.isEmpty()) { + RenderUtil.enableRenderState(); + Color renderColor = new Color(this.color.getValue()); + for (EntityLivingBase entity : entities) { + float collisionSize = (float) ((double) entity.getCollisionBorderSize() * this.multiplier.getValue()); + AxisAlignedBB expandedBox = entity.getEntityBoundingBox().expand(collisionSize, collisionSize, collisionSize); + AxisAlignedBB offsetBox = new AxisAlignedBB( + expandedBox.minX - entity.posX + (RenderUtil.lerpDouble(entity.posX, entity.lastTickPosX, event.getPartialTicks()) - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosX()), + expandedBox.minY - entity.posY + (RenderUtil.lerpDouble(entity.posY, entity.lastTickPosY, event.getPartialTicks()) - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosY()), + expandedBox.minZ - entity.posZ + (RenderUtil.lerpDouble(entity.posZ, entity.lastTickPosZ, event.getPartialTicks()) - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosZ()), + expandedBox.maxX - entity.posX + (RenderUtil.lerpDouble(entity.posX, entity.lastTickPosX, event.getPartialTicks()) - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosX()), + expandedBox.maxY - entity.posY + (RenderUtil.lerpDouble(entity.posY, entity.lastTickPosY, event.getPartialTicks()) - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosY()), + expandedBox.maxZ - entity.posZ + (RenderUtil.lerpDouble(entity.posZ, entity.lastTickPosZ, event.getPartialTicks()) - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosZ()) + ); + RenderUtil.drawBoundingBox(offsetBox, renderColor.getRed(), renderColor.getGreen(), renderColor.getBlue(), 150, 1.5F); + } + RenderUtil.disableRenderState(); + } + } + } + + @Override + public String[] getSuffix() { + return new String[]{String.format("%.1fx", this.multiplier.getValue())}; + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.event.types.Priority; +import myau.events.PacketEvent; +import myau.events.UpdateEvent; +import myau.module.Module; +import myau.property.properties.ModeProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.projectile.EntityLargeFireball; +import net.minecraft.network.play.client.C02PacketUseEntity; +import net.minecraft.network.play.client.C0BPacketEntityAction; +import net.minecraft.util.Vec3; + +public class HitSelect extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + + public final ModeProperty mode = new ModeProperty("mode", 0, new String[]{"SECOND", "CRITICALS", "W_TAP"}); + + private boolean sprintState = false; + private boolean set = false; + private double savedSlowdown = 0.0; + + private int blockedHits = 0; + private int allowedHits = 0; + + public HitSelect() { + super("HitSelect", false); + } + + @EventTarget + public void onUpdate(UpdateEvent event) { + if (!this.isEnabled()) { + return; + } + + if (event.getType() == EventType.POST) { + this.resetMotion(); + } + } + + @EventTarget(Priority.HIGHEST) + public void onPacket(PacketEvent event) { + if (!this.isEnabled() || event.getType() != EventType.SEND || event.isCancelled()) { + return; + } + + if (event.getPacket() instanceof C0BPacketEntityAction) { + C0BPacketEntityAction packet = (C0BPacketEntityAction) event.getPacket(); + switch (packet.getAction()) { + case START_SPRINTING: + this.sprintState = true; + break; + case STOP_SPRINTING: + this.sprintState = false; + break; + } + return; + } + + if (event.getPacket() instanceof C02PacketUseEntity) { + C02PacketUseEntity use = (C02PacketUseEntity) event.getPacket(); + + if (use.getAction() != C02PacketUseEntity.Action.ATTACK) { + return; + } + + Entity target = use.getEntityFromWorld(mc.theWorld); + if (target == null || target instanceof EntityLargeFireball) { + return; + } + + if (!(target instanceof EntityLivingBase)) { + return; + } + + EntityLivingBase living = (EntityLivingBase) target; + boolean allow = true; + + switch (this.mode.getValue()) { + case 0: // SECOND + allow = this.prioritizeSecondHit(mc.thePlayer, living); + break; + case 1: // CRITICALS + allow = this.prioritizeCriticalHits(mc.thePlayer); + break; + case 2: // WTAP + allow = this.prioritizeWTapHits(mc.thePlayer, this.sprintState); + break; + } + + if (!allow) { + event.setCancelled(true); + this.blockedHits++; + } else { + this.allowedHits++; + } + } + } + + private boolean prioritizeSecondHit(EntityLivingBase player, EntityLivingBase target) { + // If target is already hurt, allow the hit + if (target.hurtTime != 0) { + return true; + } + + // If player hasn't recovered from hurt time, allow the hit + if (player.hurtTime <= player.maxHurtTime - 1) { + return true; + } + + // If too close, allow the hit + double dist = player.getDistanceToEntity(target); + if (dist < 2.5) { + return true; + } + + // If not moving towards each other, allow the hit + if (!this.isMovingTowards(target, player, 60.0)) { + return true; + } + + if (!this.isMovingTowards(player, target, 60.0)) { + return true; + } + + // Block the hit and fix motion + this.fixMotion(); + return false; + } + + private boolean prioritizeCriticalHits(EntityLivingBase player) { + // If on ground, allow the hit + if (player.onGround) { + return true; + } + + // If hurt, allow the hit + if (player.hurtTime != 0) { + return true; + } + + // If falling, allow the hit (for crits) + if (player.fallDistance > 0.0f) { + return true; + } + + // Block the hit and fix motion + this.fixMotion(); + return false; + } + + private boolean prioritizeWTapHits(EntityLivingBase player, boolean sprinting) { + // If against wall, allow the hit + if (player.isCollidedHorizontally) { + return true; + } + + // If not moving forward, allow the hit + if (!mc.gameSettings.keyBindForward.isKeyDown()) { + return true; + } + + // If already sprinting, allow the hit + if (sprinting) { + return true; + } + + // Block the hit and fix motion + this.fixMotion(); + return false; + } + + private void fixMotion() { + if (this.set) { + return; + } + + KeepSprint keepSprint = (KeepSprint) Myau.moduleManager.modules.get(KeepSprint.class); + if (keepSprint == null) { + return; + } + + try { + // Save the current slowdown value + this.savedSlowdown = keepSprint.slowdown.getValue().doubleValue(); + + // Enable KeepSprint and set slowdown to 0 + if (!keepSprint.isEnabled()) { + keepSprint.toggle(); + } + keepSprint.slowdown.setValue(0); + + this.set = true; + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void resetMotion() { + if (!this.set) { + return; + } + + KeepSprint keepSprint = (KeepSprint) Myau.moduleManager.modules.get(KeepSprint.class); + if (keepSprint == null) { + return; + } + + try { + // Restore the original slowdown value + keepSprint.slowdown.setValue((int) this.savedSlowdown); + + // Disable KeepSprint if we enabled it + if (keepSprint.isEnabled()) { + keepSprint.toggle(); + } + } catch (Exception e) { + e.printStackTrace(); + } + + this.set = false; + this.savedSlowdown = 0.0; + } + + private boolean isMovingTowards(EntityLivingBase source, EntityLivingBase target, double maxAngle) { + Vec3 currentPos = source.getPositionVector(); + Vec3 lastPos = new Vec3(source.lastTickPosX, source.lastTickPosY, source.lastTickPosZ); + Vec3 targetPos = target.getPositionVector(); + + // Calculate movement vector + double mx = currentPos.xCoord - lastPos.xCoord; + double mz = currentPos.zCoord - lastPos.zCoord; + double movementLength = Math.sqrt(mx * mx + mz * mz); + + // If not moving, return false + if (movementLength == 0.0) { + return false; + } + + // Normalize movement vector + mx /= movementLength; + mz /= movementLength; + + // Calculate vector to target + double tx = targetPos.xCoord - currentPos.xCoord; + double tz = targetPos.zCoord - currentPos.zCoord; + double targetLength = Math.sqrt(tx * tx + tz * tz); + + // If target is at same position, return false + if (targetLength == 0.0) { + return false; + } + + // Normalize target vector + tx /= targetLength; + tz /= targetLength; + + // Calculate dot product (cosine of angle between vectors) + double dotProduct = mx * tx + mz * tz; + + // Check if angle is within threshold + return dotProduct >= Math.cos(Math.toRadians(maxAngle)); + } + + @Override + public void onDisabled() { + this.resetMotion(); + this.sprintState = false; + this.set = false; + this.savedSlowdown = 0.0; + this.blockedHits = 0; + this.allowedHits = 0; + } + + @Override + public String[] getSuffix() { + return new String[]{this.mode.getModeString()}; + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.enums.BlinkModules; +import myau.enums.ChatColors; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.Render2DEvent; +import myau.events.TickEvent; +import myau.mixin.IAccessorGuiChat; +import myau.module.Module; +import myau.util.ColorUtil; +import myau.util.RenderUtil; +import myau.property.properties.*; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiChat; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Locale; +import java.util.stream.Collectors; + +public class HUD extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private List activeModules = new ArrayList<>(); + public final ModeProperty colorMode = new ModeProperty( + "color", 3, new String[]{"RAINBOW", "CHROMA", "ASTOLFO", "CUSTOM1", "CUSTOM12", "CUSTOM123"} + ); + public final FloatProperty colorSpeed = new FloatProperty("color-speed", 1.0F, 0.5F, 1.5F); + public final PercentProperty colorSaturation = new PercentProperty("color-saturation", 50); + public final PercentProperty colorBrightness = new PercentProperty("color-brightness", 100); + public final ColorProperty custom1 = new ColorProperty("custom-color-1", Color.WHITE.getRGB(), () -> this.colorMode.getValue() == 3 || this.colorMode.getValue() == 4 || this.colorMode.getValue() == 5); + public final ColorProperty custom2 = new ColorProperty("custom-color-2", Color.WHITE.getRGB(), () -> this.colorMode.getValue() == 4 || this.colorMode.getValue() == 5); + public final ColorProperty custom3 = new ColorProperty("custom-color-3", Color.WHITE.getRGB(), () -> this.colorMode.getValue() == 5); + public final ModeProperty posX = new ModeProperty("position-x", 0, new String[]{"LEFT", "RIGHT"}); + public final ModeProperty posY = new ModeProperty("position-y", 0, new String[]{"TOP", "BOTTOM"}); + public final IntProperty offsetX = new IntProperty("offset-x", 2, 0, 255); + public final IntProperty offsetY = new IntProperty("offset-y", 2, 0, 255); + public final FloatProperty scale = new FloatProperty("scale", 1.0F, 0.5F, 1.5F); + public final PercentProperty background = new PercentProperty("background", 25); + public final BooleanProperty showBar = new BooleanProperty("bar", true); + public final BooleanProperty shadow = new BooleanProperty("shadow", true); + public final BooleanProperty suffixes = new BooleanProperty("suffixes", true); + public final BooleanProperty lowerCase = new BooleanProperty("lower-case", false); + public final BooleanProperty chatOutline = new BooleanProperty("chat-outline", true); + public final BooleanProperty blinkTimer = new BooleanProperty("blink-timer", true); + public final BooleanProperty toggleSound = new BooleanProperty("toggle-sounds", true); + public final BooleanProperty toggleAlerts = new BooleanProperty("toggle-alerts", false); + + private String getModuleName(Module module) { + String moduleName = module.getName(); + if (this.lowerCase.getValue()) { + moduleName = moduleName.toLowerCase(Locale.ROOT); + } + return moduleName; + } + + private String[] getModuleSuffix(Module module) { + String[] moduleSuffix = module.getSuffix(); + if (this.lowerCase.getValue()) { + for (int i = 0; i < moduleSuffix.length; i++) { + moduleSuffix[i] = moduleSuffix[i].toLowerCase(); + } + } + return moduleSuffix; + } + + private int getModuleWidth(Module module) { + return this.calculateStringWidth( + this.getModuleName(module), this.getModuleSuffix(module) + ); + } + + private int calculateStringWidth(String string, String[] arr) { + int width = mc.fontRendererObj.getStringWidth(string); + if (this.suffixes.getValue()) { + for (String str : arr) { + width += 3 + mc.fontRendererObj.getStringWidth(str); + } + } + return width; + } + + private float getColorCycle(long long3, long long4) { + long speed = (long) (3000.0 / Math.pow(Math.min(Math.max(0.5F, this.colorSpeed.getValue()), 1.5F), 3.0)); + return 1.0F - (float) (Math.abs(long3 - long4 * 300L) % speed) / (float) speed; + } + + public HUD() { + super("HUD", true, true); + } + + public Color getColor(long time) { + return this.getColor(time, 0L); + } + + public Color getColor(long time, long offset) { + Color color = Color.white; + switch (this.colorMode.getValue()) { + case 0: + color = ColorUtil.fromHSB(this.getColorCycle(time, offset), 1.0F, 1.0F); + break; + case 1: + color = ColorUtil.fromHSB(this.getColorCycle(time / 3L, 0L), 1.0F, 1.0F); + break; + case 2: + float cycle = this.getColorCycle(time, offset); + if (cycle % 1.0F < 0.5F) { + cycle = 1.0F - cycle % 1.0F; + } + color = ColorUtil.fromHSB(cycle, 1.0F, 1.0F); + break; + case 3: + color = new Color(this.custom1.getValue()); + break; + case 4: + double cycle1 = this.getColorCycle(time, offset); + color = ColorUtil.interpolate( + (float) (2.0 * Math.abs(cycle1 - Math.floor(cycle1 + 0.5))), + new Color(this.custom1.getValue()), + new Color(this.custom2.getValue()) + ); + break; + case 5: + double cycle2 = this.getColorCycle(time, offset); + float floor = (float) (2.0 * Math.abs(cycle2 - Math.floor(cycle2 + 0.5))); + if (floor <= 0.5F) { + color = ColorUtil.interpolate(floor * 2.0F, new Color(this.custom1.getValue()), new Color(this.custom2.getValue())); + } else { + color = ColorUtil.interpolate((floor - 0.5F) * 2.0F, new Color(this.custom2.getValue()), new Color(this.custom3.getValue())); + } + } + float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null); + return Color.getHSBColor( + hsb[0], + hsb[1] * (this.colorSaturation.getValue().floatValue() / 100.0F), + hsb[2] * (this.colorBrightness.getValue().floatValue() / 100.0F) + ); + } + + @EventTarget + public void onTick(TickEvent event) { + if (this.isEnabled() && event.getType() == EventType.POST) { + this.activeModules = Myau.moduleManager.modules.values().stream().filter(module -> module.isEnabled() && !module.isHidden()).sorted(Comparator.comparingInt(this::getModuleWidth).reversed()).collect(Collectors.toList()); + } + } + + @EventTarget + public void onRender2D(Render2DEvent event) { + if (this.chatOutline.getValue() && mc.currentScreen instanceof GuiChat) { + String text = ((IAccessorGuiChat) mc.currentScreen).getInputField().getText().trim(); + if (Myau.commandManager != null && Myau.commandManager.isTypingCommand(text)) { + RenderUtil.enableRenderState(); + RenderUtil.drawOutlineRect( + 2.0F, + (float) (mc.currentScreen.height - 14), + (float) (mc.currentScreen.width - 2), + (float) (mc.currentScreen.height - 2), + 1.5F, + 0, + this.getColor(System.currentTimeMillis()).getRGB() + ); + RenderUtil.disableRenderState(); + } + } + if (this.isEnabled() && !mc.gameSettings.showDebugInfo) { + float height = (float) mc.fontRendererObj.FONT_HEIGHT - 1.0F; + float x = (float) this.offsetX.getValue() + + (1.0F + (this.showBar.getValue() ? (this.shadow.getValue() ? 2.0F : 1.0F) : 0.0F)) * this.scale.getValue(); + float y = (float) this.offsetY.getValue() + 1.0F * this.scale.getValue(); + if (this.posX.getValue() == 1) { + x = (float) new ScaledResolution(mc).getScaledWidth() - x; + } + if (this.posY.getValue() == 1) { + y = (float) new ScaledResolution(mc).getScaledHeight() - y - height * this.scale.getValue(); + } + GlStateManager.pushMatrix(); + GlStateManager.scale(this.scale.getValue(), this.scale.getValue(), 0.0F); + long l = System.currentTimeMillis(); + long offset = 0L; + for (Module module : this.activeModules) { + String moduleName = this.getModuleName(module); + String[] moduleSuffix = this.getModuleSuffix(module); + float totalWidth = (float) (this.calculateStringWidth(moduleName, moduleSuffix) - (this.shadow.getValue() ? 0 : 1)); + int color = this.getColor(l, offset).getRGB(); + RenderUtil.enableRenderState(); + if (this.background.getValue() > 0) { + RenderUtil.drawRect( + x / this.scale.getValue() - 1.0F - (this.posX.getValue() == 0 ? 0.0F : totalWidth), + y / this.scale.getValue() - (this.posY.getValue() == 0 ? (offset == 0L ? 1.0F : 0.0F) : (this.shadow.getValue() ? 1.0F : 0.0F)), + x / this.scale.getValue() + 1.0F + (this.posX.getValue() == 0 ? totalWidth : 0.0F), + y / this.scale.getValue() + height + (this.posY.getValue() == 0 ? (this.shadow.getValue() ? 1.0F : 0.0F) : (offset == 0L ? 1.0F : 0.0F)), + new Color(0.0F, 0.0F, 0.0F, this.background.getValue().floatValue() / 100.0F).getRGB() + ); + } + if (this.showBar.getValue()) { + if (this.shadow.getValue()) { + RenderUtil.drawRect( + x / this.scale.getValue() + (this.posX.getValue() == 0 ? -3.0F : 1.0F), + y / this.scale.getValue() - (this.posY.getValue() == 0 ? (offset == 0L ? 1.0F : 0.0F) : 1.0F), + x / this.scale.getValue() + (this.posX.getValue() == 0 ? -2.0F : 2.0F), + y / this.scale.getValue() + height + (this.posY.getValue() == 0 ? 1.0F : (offset == 0L ? 1.0F : 0.0F)), + color + ); + RenderUtil.drawRect( + x / this.scale.getValue() + (this.posX.getValue() == 0 ? -2.0F : 2.0F), + y / this.scale.getValue() - (this.posY.getValue() == 0 ? (offset == 0L ? 1.0F : 0.0F) : 1.0F), + x / this.scale.getValue() + (this.posX.getValue() == 0 ? -1.0F : 3.0F), + y / this.scale.getValue() + height + (this.posY.getValue() == 0 ? 1.0F : (offset == 0L ? 1.0F : 0.0F)), + (color & 16579836) >> 2 | color & 0xFF000000 + ); + } else { + RenderUtil.drawRect( + x / this.scale.getValue() + (this.posX.getValue() == 0 ? -2.0F : 1.0F), + y / this.scale.getValue() - (this.posY.getValue() == 0 ? (offset == 0L ? 1.0F : 0.0F) : 0.0F), + x / this.scale.getValue() + (this.posX.getValue() == 0 ? -1.0F : 2.0F), + y / this.scale.getValue() + height + (this.posY.getValue() == 0 ? 0.0F : (offset == 0L ? 1.0F : 0.0F)), + color + ); + } + } + RenderUtil.disableRenderState(); + GlStateManager.disableDepth(); + if (this.shadow.getValue()) { + mc.fontRendererObj + .drawStringWithShadow(moduleName, x / this.scale.getValue() - (this.posX.getValue() == 1 ? totalWidth : 0.0F), y / this.scale.getValue(), color); + } else { + mc.fontRendererObj + .drawString( + moduleName, + x / this.scale.getValue() - (this.posX.getValue() == 1 ? totalWidth : 0.0F), + y / this.scale.getValue() + (this.posY.getValue() == 1 ? 1.0F : 0.0F), + color, + false + ); + } + if (this.suffixes.getValue() && moduleSuffix.length > 0) { + float width = (float) mc.fontRendererObj.getStringWidth(moduleName) + 3.0F; + for (String string : moduleSuffix) { + if (this.shadow.getValue()) { + mc.fontRendererObj + .drawStringWithShadow( + string, + x / this.scale.getValue() - (this.posX.getValue() == 1 ? totalWidth : 0.0F) + width, + y / this.scale.getValue(), + ChatColors.GRAY.toAwtColor() + ); + } else { + mc.fontRendererObj + .drawString( + string, + x / this.scale.getValue() - (this.posX.getValue() == 1 ? totalWidth : 0.0F) + width, + y / this.scale.getValue() + (this.posY.getValue() == 1 ? 1.0F : 0.0F), + ChatColors.GRAY.toAwtColor(), + false + ); + } + width += (float) mc.fontRendererObj.getStringWidth(string) + (this.shadow.getValue() ? 3.0F : 2.0F); + } + } + y += (height + (this.shadow.getValue() ? 1.0F : 0.0F)) * this.scale.getValue() * (this.posY.getValue() == 0 ? 1.0F : -1.0F); + offset++; + } + if (this.blinkTimer.getValue()) { + BlinkModules blinkingModule = Myau.blinkManager.getBlinkingModule(); + if (blinkingModule != BlinkModules.NONE && blinkingModule != BlinkModules.AUTO_BLOCK) { + long movementPacketSize = Myau.blinkManager.countMovement(); + if (movementPacketSize > 0L) { + GlStateManager.enableBlend(); + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + mc.fontRendererObj + .drawString( + String.valueOf(movementPacketSize), + (float) new ScaledResolution(mc).getScaledWidth() / 2.0F / this.scale.getValue() + - (float) mc.fontRendererObj.getStringWidth(String.valueOf(movementPacketSize)) / 2.0F, + (float) new ScaledResolution(mc).getScaledHeight() / 5.0F * 3.0F / this.scale.getValue(), + this.getColor(l, offset).getRGB() & 16777215 | -1090519040, + this.shadow.getValue() + ); + GlStateManager.disableBlend(); + } + } + } + GlStateManager.enableDepth(); + GlStateManager.popMatrix(); + } + } +} + + + +package myau.module.modules; + +import myau.enums.ChatColors; +import myau.event.EventTarget; +import myau.events.Render2DEvent; +import myau.module.Module; +import myau.util.RenderUtil; +import myau.util.RotationUtil; +import myau.util.TeamUtil; +import myau.property.properties.BooleanProperty; +import myau.property.properties.FloatProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityEnderPearl; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.entity.projectile.EntityEgg; +import net.minecraft.entity.projectile.EntityFireball; +import net.minecraft.entity.projectile.EntitySnowball; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +import java.awt.*; +import java.util.stream.Collectors; + +public class Indicators extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + public final FloatProperty scale = new FloatProperty("scale", 1.0f, 0.5f, 1.5f); + public final FloatProperty offset = new FloatProperty("offset", 50.0f, 0.0f, 255.0f); + public final BooleanProperty directionCheck = new BooleanProperty("direction-check", true); + public final BooleanProperty fireballs = new BooleanProperty("fireballs", true); + public final BooleanProperty pearls = new BooleanProperty("pearls", true); + public final BooleanProperty arrows = new BooleanProperty("arrows", true); + public final BooleanProperty egg = new BooleanProperty("egg", true); + public final BooleanProperty snowball = new BooleanProperty("snowball", true); + + private boolean shouldRender(Entity entity) { + double d = (entity.posX - entity.lastTickPosX) * (Indicators.mc.thePlayer.posX - entity.posX) + (entity.posY - entity.lastTickPosY) * (Indicators.mc.thePlayer.posY + (double) Indicators.mc.thePlayer.getEyeHeight() - entity.posY - (double) entity.height / 2.0) + (entity.posZ - entity.lastTickPosZ) * (Indicators.mc.thePlayer.posZ - entity.posZ); + if (d == 0.0) { + return false; + } + if (d < 0.0) { + if (this.directionCheck.getValue()) { + return false; + } + } + if (this.fireballs.getValue() && entity instanceof EntityFireball) return true; + if (this.pearls.getValue() && entity instanceof EntityEnderPearl) return true; + if (this.arrows.getValue() && entity instanceof EntityArrow) return true; + if (this.egg.getValue() && entity instanceof EntityEgg) return true; + if (this.snowball.getValue() && entity instanceof EntitySnowball) return true; + return false; + } + + private Item getIndicatorItem(Entity entity) { + if (entity instanceof EntityFireball) { + return Items.fire_charge; + } + if (entity instanceof EntityEnderPearl) { + return Items.ender_pearl; + } + if (entity instanceof EntityArrow) { + return Items.arrow; + } + if (entity instanceof EntityEgg) { + return Items.egg; + } + if (entity instanceof EntitySnowball) { + return Items.snowball; + } + return new Item(); + } + + private Color getIndicatorColor(Entity entity) { + if (entity instanceof EntityFireball) { + return new Color(12676363); + } + if (entity instanceof EntityEnderPearl) { + return new Color(2458740); + } + if (entity instanceof EntityArrow) { + return new Color(0x969696); + } + return new Color(-1); + } + + public Indicators() { + super("Indicators", false, true); + } + + @EventTarget + public void onRender(Render2DEvent render2DEvent) { + if (!this.isEnabled()) { + return; + } + for (Entity entity : TeamUtil.getLoadedEntitiesSorted().stream().filter(this::shouldRender).collect(Collectors.toList())) { + float offset = 10.0f + this.offset.getValue(); + float yawBetween = RotationUtil.getYawBetween(RenderUtil.lerpDouble(Indicators.mc.thePlayer.posX, Indicators.mc.thePlayer.prevPosX, render2DEvent.getPartialTicks()), RenderUtil.lerpDouble(Indicators.mc.thePlayer.posZ, Indicators.mc.thePlayer.prevPosZ, render2DEvent.getPartialTicks()), RenderUtil.lerpDouble(entity.posX, entity.prevPosX, render2DEvent.getPartialTicks()), RenderUtil.lerpDouble(entity.posZ, entity.prevPosZ, render2DEvent.getPartialTicks())); + if (Indicators.mc.gameSettings.thirdPersonView == 2) { + yawBetween += 180.0f; + } + float x = (float) Math.sin(Math.toRadians(yawBetween)); + float z = (float) Math.cos(Math.toRadians(yawBetween)) * -1.0f; + GlStateManager.pushMatrix(); + GlStateManager.disableDepth(); + GlStateManager.scale(this.scale.getValue(), this.scale.getValue(), 0.0f); + GlStateManager.translate((float) new ScaledResolution(mc).getScaledWidth() / 2.0f / this.scale.getValue(), (float) new ScaledResolution(mc).getScaledHeight() / 2.0f / this.scale.getValue(), 0.0f); + GlStateManager.pushMatrix(); + GlStateManager.translate((offset + 0.0f) * x - 8.0f, (offset + 0.0f) * z - 8.0f, -300.0f); + mc.getRenderItem().renderItemAndEffectIntoGUI(new ItemStack(this.getIndicatorItem(entity)), 0, 0); + GlStateManager.popMatrix(); + String string = String.format("%dm", (int) Indicators.mc.thePlayer.getDistanceToEntity(entity)); + GlStateManager.pushMatrix(); + GlStateManager.translate((offset + 0.0f) * x - (float) Indicators.mc.fontRendererObj.getStringWidth(string) / 2.0f + 1.0f, (offset + 0.0f) * z + 1.0f, -100.0f); + Indicators.mc.fontRendererObj.drawStringWithShadow(string, 0.0f, 0.0f, ChatColors.GRAY.toAwtColor() & 0xFFFFFF | 0xBF000000); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.translate((offset + 15.0f) * x + 1.0f, (offset + 15.0f) * z + 1.0f, -100.0f); + RenderUtil.enableRenderState(); + RenderUtil.drawArrow(0.0f, 0.0f, (float) (Math.atan2(z, x) + Math.PI), 7.5f, 1.5f, this.getIndicatorColor(entity).getRGB()); + RenderUtil.disableRenderState(); + GlStateManager.popMatrix(); + GlStateManager.enableDepth(); + GlStateManager.popMatrix(); + } + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.TickEvent; +import myau.mixin.IAccessorGuiScreen; +import myau.module.Module; +import myau.property.properties.IntProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import org.lwjgl.input.Mouse; + +public class InventoryClicker extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + public final IntProperty triggerTicks = new IntProperty("ticks", 2, 0, 20); + public int ticks; + + public InventoryClicker() { + super("InventoryClicker", false); + } + + @Override + public String[] getSuffix() { + return new String[]{triggerTicks.getValue().toString() + " ticks"}; + } + + @EventTarget + public void onTick(TickEvent event) { + if (this.isEnabled() && mc.thePlayer != null && event.getType() == EventType.PRE) { + if (mc.currentScreen instanceof GuiContainer) { + GuiContainer screen = ((GuiContainer) mc.currentScreen); + final int mouseX = Mouse.getEventX() * screen.width / mc.displayWidth; + final int mouseY = screen.height - Mouse.getEventY() * screen.height / mc.displayHeight - 1; + if (Mouse.isButtonDown(0)) { + ticks++; + if(ticks > triggerTicks.getValue()) + { + ((IAccessorGuiScreen)screen).callMouseClicked(mouseX, mouseY, 0); + } + }else { + ticks = 0; + } + } + } + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.UpdateEvent; +import myau.events.WindowClickEvent; +import myau.module.Module; +import myau.property.properties.BooleanProperty; +import myau.property.properties.IntProperty; +import myau.util.ItemUtil; +import myau.util.TimerUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiInventory; +import net.minecraft.inventory.ContainerPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.world.WorldSettings.GameType; +import org.apache.commons.lang3.RandomUtils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; + +public class InvManager extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private int actionDelay = 0; + private int oDelay = 0; + private boolean inventoryOpen = false; + private final TimerUtil autoArmorTime = new TimerUtil(); + public final IntProperty minDelay = new IntProperty("min-delay", 1, 0, 20); + public final IntProperty maxDelay = new IntProperty("max-delay", 2, 0, 20); + public final IntProperty openDelay = new IntProperty("open-delay", 1, 0, 20); + public final BooleanProperty autoArmor = new BooleanProperty("auto-armor", true); + public final IntProperty autoArmorInterval = new IntProperty("auto-armor-interval", 0, 0, 100, this.autoArmor::getValue); + public final BooleanProperty dropTrash = new BooleanProperty("drop-trash", false); + public final BooleanProperty checkDurability = new BooleanProperty("check-durability", true); + public final IntProperty swordSlot = new IntProperty("sword-slot", 1, 0, 9); + public final IntProperty pickaxeSlot = new IntProperty("pickaxe-slot", 3, 0, 9); + public final IntProperty shovelSlot = new IntProperty("shovel-slot", 4, 0, 9); + public final IntProperty axeSlot = new IntProperty("axe-slot", 5, 0, 9); + public final IntProperty blocksSlot = new IntProperty("blocks-slot", 2, 0, 9); + public final IntProperty blocks = new IntProperty("blocks", 128, 64, 2304); + public final IntProperty projectileSlot = new IntProperty("projectile-slot", 7, 0, 9); + public final IntProperty projectiles = new IntProperty("projectiles", 64, 16, 2304); + public final IntProperty goldAppleSlot = new IntProperty("gold-apple-slot", 9, 0, 9); + public final IntProperty arrow = new IntProperty("arrow", 256, 0, 2304); + public final IntProperty bowSlot = new IntProperty("bow-slot", 8, 0, 9); + + private boolean isValidGameMode() { + GameType gameType = mc.playerController.getCurrentGameType(); + return gameType == GameType.SURVIVAL || gameType == GameType.ADVENTURE; + } + + private int convertSlotIndex(int slot) { + if (slot >= 36) { + return 8 - (slot - 36); + } else { + return slot <= 8 ? slot + 36 : slot; + } + } + + private void clickSlot(int windowId, int slotId, int mouseButtonClicked, int mode) { + mc.playerController.windowClick(windowId, slotId, mouseButtonClicked, mode, mc.thePlayer); + } + + private int getStackSize(int slot) { + if (slot == -1) { + return 0; + } else { + ItemStack stack = mc.thePlayer.inventory.getStackInSlot(slot); + return stack != null ? stack.stackSize : 0; + } + } + + public InvManager() { + super("InvManager", false); + } + + @EventTarget + public void onUpdate(UpdateEvent event) { + if (event.getType() == EventType.PRE) { + if (this.actionDelay > 0) { + this.actionDelay--; + } + if (this.oDelay > 0) { + this.oDelay--; + } + if (!(mc.currentScreen instanceof GuiInventory)) { + this.inventoryOpen = false; + } else if (!(((GuiInventory) mc.currentScreen).inventorySlots instanceof ContainerPlayer)) { + this.inventoryOpen = false; + } else { + if (!this.inventoryOpen) { + this.inventoryOpen = true; + this.oDelay = this.openDelay.getValue() + 1; + this.autoArmorTime.reset(); + } + if (this.oDelay <= 0 && this.actionDelay <= 0) { + if (this.isEnabled() && this.isValidGameMode()) { + ArrayList equippedArmorSlots = new ArrayList<>(Arrays.asList(-1, -1, -1, -1)); + ArrayList inventoryArmorSlots = new ArrayList<>(Arrays.asList(-1, -1, -1, -1)); + for (int i = 0; i < 4; i++) { + equippedArmorSlots.set(i, ItemUtil.findArmorInventorySlot(i, true)); + inventoryArmorSlots.set(i, ItemUtil.findArmorInventorySlot(i, false)); + } + int preferredSwordHotbarSlot = this.swordSlot.getValue() - 1; + int inventorySwordSlot = ItemUtil.findSwordInInventorySlot(preferredSwordHotbarSlot, this.checkDurability.getValue()); + if (inventorySwordSlot == -1) inventorySwordSlot = ItemUtil.findSwordInInventorySlot(preferredSwordHotbarSlot, false); + int preferredPickaxeHotbarSlot = this.pickaxeSlot.getValue() - 1; + int inventoryPickaxeSlot = ItemUtil.findInventorySlot("pickaxe", preferredPickaxeHotbarSlot, this.checkDurability.getValue()); + if (inventoryPickaxeSlot == -1) inventoryPickaxeSlot = ItemUtil.findInventorySlot("pickaxe", preferredPickaxeHotbarSlot, false); + int preferredShovelHotbarSlot = this.shovelSlot.getValue() - 1; + int inventoryShovelSlot = ItemUtil.findInventorySlot("shovel", preferredShovelHotbarSlot, this.checkDurability.getValue()); + if (inventoryShovelSlot == -1) inventoryShovelSlot = ItemUtil.findInventorySlot("shovel", preferredShovelHotbarSlot, false); + int preferredAxeHotbarSlot = this.axeSlot.getValue() - 1; + int inventoryAxeSlot = ItemUtil.findInventorySlot("axe", preferredAxeHotbarSlot, this.checkDurability.getValue()); + if (inventoryAxeSlot == -1) inventoryAxeSlot = ItemUtil.findInventorySlot("axe", preferredAxeHotbarSlot, false); + int preferredBlocksHotbarSlot = this.blocksSlot.getValue() - 1; + int inventoryBlocksSlot = ItemUtil.findInventorySlot(preferredBlocksHotbarSlot, ItemUtil.ItemType.Block); + int preferredProjectileHotbarSlot = this.projectileSlot.getValue() - 1; + int inventoryProjectileSlot = ItemUtil.findInventorySlot(preferredProjectileHotbarSlot, ItemUtil.ItemType.Projectile); + if (inventoryProjectileSlot == -1) inventoryProjectileSlot = ItemUtil.findInventorySlot(preferredProjectileHotbarSlot, ItemUtil.ItemType.FishRod); + int preferredGoldAppleHotbarSlot = this.goldAppleSlot.getValue() - 1; + int inventoryGoldAppleSlot = ItemUtil.findInventorySlot(preferredGoldAppleHotbarSlot, ItemUtil.ItemType.GoldApple); + int preferredBowHotbarSlot = this.bowSlot.getValue() - 1; + int inventoryBowSlot = ItemUtil.findBowInventorySlot(preferredBowHotbarSlot, this.checkDurability.getValue()); + if (inventoryBowSlot == -1) inventoryBowSlot = ItemUtil.findBowInventorySlot(preferredBowHotbarSlot, false); + if (this.autoArmor.getValue() && this.autoArmorTime.hasTimeElapsed(this.autoArmorInterval.getValue() * 50L)) { + for (int i = 0; i < 4; i++) { + int equippedSlot = equippedArmorSlots.get(i); + int inventorySlot = inventoryArmorSlots.get(i); + if (equippedSlot != -1 || inventorySlot != -1) { + int playerArmorSlot = 39 - i; + if (equippedSlot != playerArmorSlot && inventorySlot != playerArmorSlot) { + if (mc.thePlayer.inventory.getStackInSlot(playerArmorSlot) != null) { + if (mc.thePlayer.inventory.getFirstEmptyStack() != -1) { + this.clickSlot(mc.thePlayer.inventoryContainer.windowId, this.convertSlotIndex(playerArmorSlot), 0, 1); + } else { + this.clickSlot(mc.thePlayer.inventoryContainer.windowId, this.convertSlotIndex(playerArmorSlot), 1, 4); + } + } else { + int armorToEquipSlot = equippedSlot != -1 ? equippedSlot : inventorySlot; + this.clickSlot(mc.thePlayer.inventoryContainer.windowId, this.convertSlotIndex(armorToEquipSlot), 0, 1); + this.autoArmorTime.reset(); + } + return; + } + } + } + } + LinkedHashSet usedHotbarSlots = new LinkedHashSet<>(); + if (preferredSwordHotbarSlot >= 0 && preferredSwordHotbarSlot <= 8 && inventorySwordSlot != -1) { + usedHotbarSlots.add(preferredSwordHotbarSlot); + if (inventorySwordSlot != preferredSwordHotbarSlot) { + this.clickSlot(mc.thePlayer.inventoryContainer.windowId, this.convertSlotIndex(inventorySwordSlot), preferredSwordHotbarSlot, 2); + return; + } + } + if (preferredPickaxeHotbarSlot >= 0 && preferredPickaxeHotbarSlot <= 8 && !usedHotbarSlots.contains(preferredPickaxeHotbarSlot) && inventoryPickaxeSlot != -1) { + usedHotbarSlots.add(preferredPickaxeHotbarSlot); + if (inventoryPickaxeSlot != preferredPickaxeHotbarSlot) { + this.clickSlot(mc.thePlayer.inventoryContainer.windowId, this.convertSlotIndex(inventoryPickaxeSlot), preferredPickaxeHotbarSlot, 2); + return; + } + } + if (preferredShovelHotbarSlot >= 0 && preferredShovelHotbarSlot <= 8 && !usedHotbarSlots.contains(preferredShovelHotbarSlot) && inventoryShovelSlot != -1) { + usedHotbarSlots.add(preferredShovelHotbarSlot); + if (inventoryShovelSlot != preferredShovelHotbarSlot) { + this.clickSlot(mc.thePlayer.inventoryContainer.windowId, this.convertSlotIndex(inventoryShovelSlot), preferredShovelHotbarSlot, 2); + return; + } + } + if (preferredAxeHotbarSlot >= 0 && preferredAxeHotbarSlot <= 8 && !usedHotbarSlots.contains(preferredAxeHotbarSlot) && inventoryAxeSlot != -1) { + usedHotbarSlots.add(preferredAxeHotbarSlot); + if (inventoryAxeSlot != preferredAxeHotbarSlot) { + this.clickSlot(mc.thePlayer.inventoryContainer.windowId, this.convertSlotIndex(inventoryAxeSlot), preferredAxeHotbarSlot, 2); + return; + } + } + if (preferredBlocksHotbarSlot >= 0 && preferredBlocksHotbarSlot <= 8 && !usedHotbarSlots.contains(preferredBlocksHotbarSlot) && inventoryBlocksSlot != -1) { + usedHotbarSlots.add(preferredBlocksHotbarSlot); + if (inventoryBlocksSlot != preferredBlocksHotbarSlot) { + this.clickSlot(mc.thePlayer.inventoryContainer.windowId, this.convertSlotIndex(inventoryBlocksSlot), preferredBlocksHotbarSlot, 2); + return; + } + } + if (preferredProjectileHotbarSlot >= 0 && preferredProjectileHotbarSlot <= 8 && !usedHotbarSlots.contains(preferredProjectileHotbarSlot) && inventoryProjectileSlot != -1) { + usedHotbarSlots.add(preferredProjectileHotbarSlot); + if (inventoryProjectileSlot != preferredProjectileHotbarSlot) { + this.clickSlot(mc.thePlayer.inventoryContainer.windowId, this.convertSlotIndex(inventoryProjectileSlot), preferredProjectileHotbarSlot, 2); + return; + } + } + if (preferredGoldAppleHotbarSlot >= 0 && preferredGoldAppleHotbarSlot <= 8 && !usedHotbarSlots.contains(preferredGoldAppleHotbarSlot) && inventoryGoldAppleSlot != -1) { + usedHotbarSlots.add(preferredGoldAppleHotbarSlot); + if (inventoryGoldAppleSlot != preferredGoldAppleHotbarSlot) { + this.clickSlot(mc.thePlayer.inventoryContainer.windowId, this.convertSlotIndex(inventoryGoldAppleSlot), preferredGoldAppleHotbarSlot, 2); + return; + } + } + if (preferredBowHotbarSlot >= 0 && preferredBowHotbarSlot <= 8 && !usedHotbarSlots.contains(preferredBowHotbarSlot) && inventoryBowSlot != -1) { + usedHotbarSlots.add(preferredBowHotbarSlot); + if (inventoryBowSlot != preferredBowHotbarSlot) { + this.clickSlot(mc.thePlayer.inventoryContainer.windowId, this.convertSlotIndex(inventoryBowSlot), preferredBowHotbarSlot, 2); + return; + } + } + if (this.dropTrash.getValue()) { + int currentBlockCount = this.getStackSize(inventoryBlocksSlot); + int currentProjectileCount = this.getStackSize(inventoryProjectileSlot); + for (int i = 0; i < 36; i++) { + if (!equippedArmorSlots.contains(i) + && !inventoryArmorSlots.contains(i) + && inventorySwordSlot != i + && inventoryPickaxeSlot != i + && inventoryShovelSlot != i + && inventoryAxeSlot != i + && inventoryBlocksSlot != i + && inventoryProjectileSlot != i + && inventoryGoldAppleSlot != i + && inventoryBowSlot != i) { + ItemStack stack = mc.thePlayer.inventory.getStackInSlot(i); + if (stack != null) { + boolean isBlock = ItemUtil.isBlock(stack); + boolean isProjectile = ItemUtil.isProjectile(stack); + if (isBlock) { + currentBlockCount += stack.stackSize; + } + if (isProjectile) { + currentProjectileCount += stack.stackSize; + } + if (ItemUtil.isNotSpecialItem(stack) &&( isBlock && currentBlockCount >= this.blocks.getValue() || isProjectile && currentProjectileCount >= this.projectiles.getValue())) { + this.clickSlot(mc.thePlayer.inventoryContainer.windowId, this.convertSlotIndex(i), 1, 4); + return; + } + } + } + } + } + } + } + } + } + } + + @EventTarget + public void onClick(WindowClickEvent event) { + this.actionDelay = RandomUtils.nextInt(this.minDelay.getValue() + 1, this.maxDelay.getValue() + 2); + } + + @Override + public void verifyValue(String mode) { + switch (mode) { + case "min-delay": + if (this.minDelay.getValue() > this.maxDelay.getValue()) { + this.maxDelay.setValue(this.minDelay.getValue()); + } + break; + case "max-delay": + if (this.minDelay.getValue() > this.maxDelay.getValue()) { + this.minDelay.setValue(this.maxDelay.getValue()); + } + } + } +} + + + +package myau.module.modules; + +import com.google.common.base.CaseFormat; +import myau.Myau; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.event.types.Priority; +import myau.events.PacketEvent; +import myau.events.TickEvent; +import myau.events.UpdateEvent; +import myau.mixin.IAccessorC0DPacketCloseWindow; +import myau.module.Module; +import myau.property.properties.BooleanProperty; +import myau.property.properties.IntProperty; +import myau.property.properties.ModeProperty; +import myau.util.KeyBindUtil; +import myau.util.PacketUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.gui.inventory.GuiContainerCreative; +import net.minecraft.client.gui.inventory.GuiInventory; +import net.minecraft.client.settings.KeyBinding; +import net.minecraft.inventory.ContainerPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.network.play.client.C0DPacketCloseWindow; +import net.minecraft.network.play.client.C0EPacketClickWindow; +import net.minecraft.network.play.client.C16PacketClientStatus; +import net.minecraft.network.play.client.C16PacketClientStatus.EnumState; + +import java.util.HashMap; +import java.util.Map; +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; + +public class InvWalk extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private final Queue clickQueue = new ConcurrentLinkedQueue<>(); + private boolean keysPressed = false; + private C16PacketClientStatus pendingStatus = null; + private int delayTicks = 0; + private int openDelayTicks = -1; + private int closeDelayTicks = -1; + private final Map movementKeys = new HashMap(8) {{ + put(mc.gameSettings.keyBindForward, false); + put(mc.gameSettings.keyBindBack, false); + put(mc.gameSettings.keyBindLeft, false); + put(mc.gameSettings.keyBindRight, false); + put(mc.gameSettings.keyBindJump, false); + put(mc.gameSettings.keyBindSneak, false); + put(mc.gameSettings.keyBindSprint, false); + }}; + + public final ModeProperty mode = new ModeProperty("mode", 1, new String[]{"VANILLA", "LEGIT", "HYPIXEL", "LEGIT+"}); + public final BooleanProperty guiEnabled = new BooleanProperty("click-gui", true); + public final IntProperty openDelay = new IntProperty("open-delay", 0, 0, 20, () -> mode.getValue() == 3); + public final IntProperty closeDelay = new IntProperty("close-delay", 4, 0, 20, () -> mode.getValue() == 3); + public final BooleanProperty lockMoveKey = new BooleanProperty("lock-move-dey", false); + + public InvWalk() { + super("InvWalk", false); + } + + public void pressMovementKeys(boolean skipSneak) { + this.movementKeys.keySet().stream() + .filter(key -> !skipSneak || key != mc.gameSettings.keyBindSneak) + .forEach(key -> KeyBindUtil.updateKeyState(key.getKeyCode())); + if (Myau.moduleManager.modules.get(Sprint.class).isEnabled()) { + KeyBindUtil.setKeyBindState(mc.gameSettings.keyBindSprint.getKeyCode(), true); + } + this.keysPressed = true; + } + + public void resetMovementKeys() { + this.movementKeys.replaceAll((k, v) -> false); + } + + public boolean isSetMovementKeys() { + return this.movementKeys.values().stream().anyMatch(Boolean::booleanValue); + } + + public void storeMovementKeys() { + this.movementKeys.replaceAll((k, v) -> KeyBindUtil.isKeyDown(k.getKeyCode())); + } + + public void restoreMovementKeys() { + for (Map.Entry keyBinding : movementKeys.entrySet()) { + KeyBindUtil.setKeyBindState(keyBinding.getKey().getKeyCode(), keyBinding.getValue()); + } + if (Myau.moduleManager.modules.get(Sprint.class).isEnabled()) { + KeyBindUtil.setKeyBindState(mc.gameSettings.keyBindSprint.getKeyCode(), true); + } + this.keysPressed = true; + } + + public boolean canInvWalk() { + if (!(mc.currentScreen instanceof GuiContainer)) return false; + if (mc.currentScreen instanceof GuiContainerCreative) return false; + + switch (this.mode.getValue()) { + case 0: // Vanilla + return true; + case 1: // Legit + if (!(mc.currentScreen instanceof GuiInventory)) return false; + return this.pendingStatus != null && this.clickQueue.isEmpty(); + case 2: // Hypixel + return this.delayTicks == 0 && this.clickQueue.isEmpty(); + case 3: // Legit+ + if (!(mc.currentScreen instanceof GuiInventory)) return false; + return this.closeDelayTicks == -1 && this.clickQueue.isEmpty(); + default: + return false; + } + } + + public boolean temporaryStackIsEmpty() { + if (mc.thePlayer.inventory.getItemStack() != null) return false; + if (mc.thePlayer.inventoryContainer instanceof ContainerPlayer) { + ContainerPlayer containerPlayer = (ContainerPlayer)mc.thePlayer.inventoryContainer; + for (int i = 0; i < containerPlayer.craftMatrix.getSizeInventory(); i++) { + ItemStack stack = containerPlayer.craftMatrix.getStackInSlot(i); + if (stack != null) { + return false; + } + } + } + return true; + } + + @EventTarget(Priority.LOWEST) + public void onTick(TickEvent event) { + if (event.getType() == EventType.PRE) { + if (this.openDelayTicks >= 0) { + this.openDelayTicks--; + return; + } + while (!this.clickQueue.isEmpty()) { + PacketUtil.sendPacketNoEvent(this.clickQueue.poll()); + } + if (this.closeDelayTicks > 0) { + if (this.temporaryStackIsEmpty()) { + this.closeDelayTicks--; + } + } else if (this.closeDelayTicks == 0) { + if (mc.currentScreen instanceof GuiInventory) + PacketUtil.sendPacketNoEvent(new C0DPacketCloseWindow(0)); + this.closeDelayTicks = -1; + } + } + } + + @EventTarget(Priority.LOWEST) + public void onUpdate(UpdateEvent event) { + if (!this.isEnabled() || event.getType() != EventType.PRE) return; + + if (mc.currentScreen instanceof myau.ui.ClickGui && this.guiEnabled.getValue()) { + this.pressMovementKeys(true); + return; + } + + if (this.canInvWalk()) { + if (this.isSetMovementKeys() && this.lockMoveKey.getValue()) { + this.restoreMovementKeys(); + } else { + this.pressMovementKeys(true); + } + } else { + if (this.keysPressed) { + if (mc.currentScreen != null) { + KeyBinding.unPressAllKeys(); + } else if (this.isSetMovementKeys()) { + this.resetMovementKeys(); + this.pressMovementKeys(false); + } + this.keysPressed = false; + } + if (this.pendingStatus != null) { + PacketUtil.sendPacketNoEvent(this.pendingStatus); + this.pendingStatus = null; + } + if (this.delayTicks > 0) { + this.delayTicks--; + } + } + } + + @EventTarget + public void onPacket(PacketEvent event) { + if (!this.isEnabled() || event.getType() != EventType.SEND) return; + + if (event.getPacket() instanceof C16PacketClientStatus) { + this.storeMovementKeys(); + if (this.mode.getValue() == 1 || this.mode.getValue() == 3) { + C16PacketClientStatus packet = (C16PacketClientStatus) event.getPacket(); + if (packet.getStatus() == EnumState.OPEN_INVENTORY_ACHIEVEMENT) { + event.setCancelled(true); + if (this.mode.getValue() == 1){ + this.pendingStatus = packet; + } + } + } + } else if (!(event.getPacket() instanceof C0EPacketClickWindow)) { + if (event.getPacket() instanceof C0DPacketCloseWindow) { + C0DPacketCloseWindow packet = (C0DPacketCloseWindow) event.getPacket(); + if (((IAccessorC0DPacketCloseWindow) packet).getWindowId() == 0) { + if (this.mode.getValue() == 3) { + if (!this.clickQueue.isEmpty()) { + this.clickQueue.clear(); + } + if (this.openDelayTicks >= 0) { + this.openDelayTicks = -1; + } + if (this.closeDelayTicks >= 0) { + this.closeDelayTicks = -1; + } else { + event.setCancelled(true); + } + } else if (this.pendingStatus != null) { + this.pendingStatus = null; + event.setCancelled(true); + } + } else { + if (!this.clickQueue.isEmpty()) { + this.clickQueue.clear(); + } + if (this.openDelayTicks >= 0) { + this.openDelayTicks = -1; + } + if (this.closeDelayTicks >= 0) { + this.closeDelayTicks = -1; + } + } + } + } else { + C0EPacketClickWindow packet = (C0EPacketClickWindow) event.getPacket(); + switch (this.mode.getValue()) { + case 1: // Legit + if (packet.getWindowId() == 0) { + if ((packet.getMode() == 3 || packet.getMode() == 4) && packet.getSlotId() == -999) { + event.setCancelled(true); + return; + } + if (this.pendingStatus != null) { + KeyBinding.unPressAllKeys(); + event.setCancelled(true); + this.clickQueue.offer(packet); + } + } + break; + case 2: // Hypixel + if ((packet.getMode() == 3 || packet.getMode() == 4) && packet.getSlotId() == -999) { + event.setCancelled(true); + } else { + KeyBinding.unPressAllKeys(); + event.setCancelled(true); + this.clickQueue.offer(packet); + this.delayTicks = 8; + } + break; + case 3: // Legit+ + if (packet.getWindowId() == 0) { // inventory + if ((packet.getMode() == 3 || packet.getMode() == 4) && packet.getSlotId() == -999) { + event.setCancelled(true); + return; + } + KeyBinding.unPressAllKeys(); + event.setCancelled(true); + this.clickQueue.offer(packet); + if (this.closeDelayTicks < 0 && this.openDelayTicks < 0){ + this.pendingStatus = new C16PacketClientStatus(EnumState.OPEN_INVENTORY_ACHIEVEMENT); + this.openDelayTicks = openDelay.getValue(); + } + this.closeDelayTicks = closeDelay.getValue(); + } + break; + } + if (this.pendingStatus != null) { + PacketUtil.sendPacketNoEvent(this.pendingStatus); + this.pendingStatus = null; + } + } + } + + @Override + public void onDisabled() { + if (this.keysPressed) { + if (mc.currentScreen != null) { + KeyBinding.unPressAllKeys(); + } + this.keysPressed = false; + } + if (this.pendingStatus != null) { + PacketUtil.sendPacketNoEvent(this.pendingStatus); + this.pendingStatus = null; + } + this.delayTicks = 0; + } + + @Override + public String[] getSuffix() { + return new String[]{CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, this.mode.getModeString())}; + } +} + + + +package myau.module.modules; + +import myau.enums.ChatColors; +import myau.event.EventTarget; +import myau.events.Render3DEvent; +import myau.mixin.IAccessorRenderManager; +import myau.module.Module; +import myau.util.RenderUtil; +import myau.util.TeamUtil; +import myau.property.properties.BooleanProperty; +import myau.property.properties.PercentProperty; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; + +import java.awt.*; +import java.util.LinkedHashMap; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.stream.Collectors; + +public class ItemESP extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + public final PercentProperty opacity = new PercentProperty("opacity", 25); + public final BooleanProperty outline = new BooleanProperty("outline", false); + public final BooleanProperty itemCount = new BooleanProperty("item-count", true); + public final BooleanProperty autoScale = new BooleanProperty("auto-scale", true); + public final BooleanProperty emeralds = new BooleanProperty("emeralds", true); + public final BooleanProperty diamonds = new BooleanProperty("diamonds", true); + public final BooleanProperty goldd = new BooleanProperty("gold", true); + public final BooleanProperty iron = new BooleanProperty("iron", true); + + private boolean shouldHighlightItem(int itemId) { + return this.emeralds.getValue() && this.isEmeraldItem(itemId) + || this.diamonds.getValue() && this.isDiamondItem(itemId) + || this.goldd.getValue() && this.isGoldItem(itemId) + || this.iron.getValue() && this.isIronItem(itemId); + } + + private boolean isEmeraldItem(int itemId) { + Item item = Item.getItemById(itemId); + Block block = Block.getBlockFromItem(item); + return item == Items.emerald || block == Blocks.emerald_block || block == Blocks.emerald_ore; + } + + private boolean isDiamondItem(int itemId) { + Item item = Item.getItemById(itemId); + Block block = Block.getBlockFromItem(item); + return item == Items.diamond + || item == Items.diamond_sword + || item == Items.diamond_pickaxe + || item == Items.diamond_shovel + || item == Items.diamond_axe + || item == Items.diamond_hoe + || item == Items.diamond_helmet + || item == Items.diamond_chestplate + || item == Items.diamond_leggings + || item == Items.diamond_boots + || block == Blocks.diamond_block + || block == Blocks.diamond_ore; + } + + private boolean isGoldItem(int itemId) { + Item item = Item.getItemById(itemId); + Block block = Block.getBlockFromItem(item); + return item == Items.gold_ingot || item == Items.gold_nugget || item == Items.golden_apple || block == Blocks.gold_block || block == Blocks.gold_ore; + } + + private boolean isIronItem(int itemId) { + Item item = Item.getItemById(itemId); + Block block = Block.getBlockFromItem(item); + return item == Items.iron_ingot || block == Blocks.iron_block || block == Blocks.iron_ore; + } + + private Color getItemColor(int itemId) { + if (this.isEmeraldItem(itemId)) { + return new Color(ChatColors.GREEN.toAwtColor()); + } else if (this.isDiamondItem(itemId)) { + return new Color(ChatColors.AQUA.toAwtColor()); + } else if (this.isGoldItem(itemId)) { + return new Color(ChatColors.YELLOW.toAwtColor()); + } else { + return this.isIronItem(itemId) ? new Color(ChatColors.WHITE.toAwtColor()) : new Color(ChatColors.GRAY.toAwtColor()); + } + } + + private int getItemPriority(int itemId) { + if (this.isEmeraldItem(itemId)) { + return 4; + } else if (this.isDiamondItem(itemId)) { + return 3; + } else if (this.isGoldItem(itemId)) { + return 2; + } else { + return this.isIronItem(itemId) ? 1 : 0; + } + } + + public ItemESP() { + super("ItemESP", false); + } + + @EventTarget + public void onRender(Render3DEvent event) { + if (this.isEnabled()) { + LinkedHashMap itemMap = new LinkedHashMap<>(); + for (Entity entity : TeamUtil.getLoadedEntitiesSorted()) { + if (entity.ticksExisted >= 3 + && (entity.ignoreFrustumCheck || RenderUtil.isInViewFrustum(entity.getEntityBoundingBox(), 0.125)) + && entity instanceof EntityItem) { + EntityItem entityItem = (EntityItem) entity; + ItemStack stack = entityItem.getEntityItem(); + if (stack.stackSize > 0) { + int itemId = Item.getIdFromItem(stack.getItem()); + if (this.shouldHighlightItem(itemId)) { + double x = RenderUtil.lerpDouble(entityItem.posX, entityItem.lastTickPosX, event.getPartialTicks()); + double y = RenderUtil.lerpDouble(entityItem.posY, entityItem.lastTickPosY, event.getPartialTicks()); + double z = RenderUtil.lerpDouble(entityItem.posZ, entityItem.lastTickPosZ, event.getPartialTicks()); + ItemData data = new ItemData(itemId, x, y, z); + Integer id = itemMap.get(data); + itemMap.put(new ItemData(itemId, x, y, z), stack.stackSize + (id == null ? 0 : id)); + } + } + } + } + for (Entry itemEntry : itemMap.entrySet().stream().sorted((entry1, entry2) -> { + int o = this.getItemPriority(entry1.getKey().itemId); + int o2 = this.getItemPriority(entry2.getKey().itemId); + return Integer.compare(o, o2); + }).collect(Collectors.toList())) { + Color itemColor = this.getItemColor(itemEntry.getKey().itemId); + double x = itemEntry.getKey().x - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosX(); + double y = itemEntry.getKey().y - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosY(); + double z = itemEntry.getKey().z - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosZ(); + double distance = mc.getRenderViewEntity().getDistance(itemEntry.getKey().x, itemEntry.getKey().y, itemEntry.getKey().z); + double scale = 0.5 + 0.375 * ((Math.max(6.0, this.autoScale.getValue() ? distance : 6.0) - 6.0) / 28.0); + AxisAlignedBB axisAlignedBB = new AxisAlignedBB(x - scale * 0.5, y, z - scale * 0.5, x + scale * 0.5, y + scale, z + scale * 0.5); + RenderUtil.enableRenderState(); + if (this.opacity.getValue() > 0) { + RenderUtil.drawFilledBox( + axisAlignedBB, itemColor.getRed(), itemColor.getGreen(), itemColor.getBlue() + ); + GlStateManager.resetColor(); + } + if (this.outline.getValue()) { + RenderUtil.drawBoundingBox(axisAlignedBB, itemColor.getRed(), itemColor.getGreen(), itemColor.getBlue(), 255, 1.5F); + GlStateManager.resetColor(); + } + RenderUtil.disableRenderState(); + if (this.itemCount.getValue()) { + GlStateManager.pushMatrix(); + GlStateManager.translate(x, y + scale * 0.5, z); + GlStateManager.rotate(mc.getRenderManager().playerViewY * -1.0F, 0.0F, 1.0F, 0.0F); + float flip = mc.gameSettings.thirdPersonView == 2 ? -1.0F : 1.0F; + GlStateManager.rotate(mc.getRenderManager().playerViewX, flip, 0.0F, 0.0F); + double fontScale = -0.04375 - 0.0328125 * ((Math.max(6.0, this.autoScale.getValue() ? distance : 6.0) - 6.0) / 28.0); + GlStateManager.scale(fontScale, fontScale, 1.0); + GlStateManager.disableDepth(); + String countText = String.format("%d", itemEntry.getValue()); + RenderUtil.drawOutlinedString( + countText, + ((float) mc.fontRendererObj.getStringWidth(countText) / 2.0F - 0.5F) * -1.0F, + ((float) (mc.fontRendererObj.FONT_HEIGHT / 2) - 0.5F) * -1.0F + ); + GlStateManager.enableDepth(); + GlStateManager.resetColor(); + GlStateManager.popMatrix(); + } + } + } + } + + public static class ItemData { + private final int hashCode; + public final int itemId; + public final double x; + public final double y; + public final double z; + + public ItemData(int id, double x, double y, double z) { + this.itemId = id; + this.x = x; + this.y = y; + this.z = z; + this.hashCode = Objects.hash(id, (int) x, (int) y, (int) z); + } + + @Override + public boolean equals(Object object) { + if (this == object) { + return true; + } else if (object != null && this.getClass() == object.getClass()) { + ItemData itemData = (ItemData) object; + return this.itemId == itemData.itemId && (int) this.x == (int) itemData.x && (int) this.y == (int) itemData.y && (int) this.z == (int) itemData.z; + } else { + return false; + } + } + + @Override + public int hashCode() { + return this.hashCode; + } + } +} + + + +package myau.module.modules; + +import myau.module.Module; +import myau.property.properties.BooleanProperty; +import myau.property.properties.FloatProperty; + +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.Locale; + +public class Jesus extends Module { + private static final DecimalFormat df = new DecimalFormat("#.##", new DecimalFormatSymbols(Locale.US)); + public final FloatProperty speed = new FloatProperty("speed", 2.5F, 0.0F, 3.0F); + public final BooleanProperty noPush = new BooleanProperty("no-push", true); + public final BooleanProperty groundOnly = new BooleanProperty("ground-only", true); + + public Jesus() { + super("Jesus", false); + } + + @Override + public String[] getSuffix() { + return new String[]{df.format(this.speed.getValue())}; + } +} + + + +package myau.module.modules; + +import myau.module.Module; +import myau.property.properties.BooleanProperty; +import myau.property.properties.PercentProperty; +import net.minecraft.client.Minecraft; + +public class KeepSprint extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + public final PercentProperty slowdown = new PercentProperty("slowdown", 0); + public final BooleanProperty groundOnly = new BooleanProperty("ground-only", false); + public final BooleanProperty reachOnly = new BooleanProperty("reach-only", false); + + public KeepSprint() { + super("KeepSprint", false); + } + + public boolean shouldKeepSprint() { + if (this.groundOnly.getValue() && !mc.thePlayer.onGround) { + return false; + } else { + return !this.reachOnly.getValue() || mc.objectMouseOver.hitVec.distanceTo(mc.getRenderViewEntity().getPositionEyes(1.0F)) > 3.0; + } + } +} + + + +package myau.module.modules; + +import com.google.common.base.CaseFormat; +import myau.Myau; +import myau.enums.BlinkModules; +import myau.event.EventManager; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.event.types.Priority; +import myau.events.*; +import myau.management.RotationState; +import myau.mixin.IAccessorPlayerControllerMP; +import myau.module.Module; +import myau.property.properties.*; +import myau.util.*; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityOtherPlayerMP; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.DataWatcher.WatchableObject; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.boss.EntityDragon; +import net.minecraft.entity.boss.EntityWither; +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.entity.monster.EntityMob; +import net.minecraft.entity.monster.EntitySilverfish; +import net.minecraft.entity.monster.EntitySlime; +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.entity.passive.EntitySquid; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; +import net.minecraft.network.play.client.C02PacketUseEntity; +import net.minecraft.network.play.client.C02PacketUseEntity.Action; +import net.minecraft.network.play.client.C07PacketPlayerDigging; +import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; +import net.minecraft.network.play.client.C09PacketHeldItemChange; +import net.minecraft.network.play.server.S06PacketUpdateHealth; +import net.minecraft.network.play.server.S1CPacketEntityMetadata; +import net.minecraft.util.*; +import net.minecraft.util.MovingObjectPosition.MovingObjectType; +import net.minecraft.world.WorldSettings.GameType; + +import java.awt.*; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.ArrayList; +import java.util.Locale; +import java.util.Random; + +public class KillAura extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private static final DecimalFormat df = new DecimalFormat("+0.0;-0.0", new DecimalFormatSymbols(Locale.US)); + private final TimerUtil timer = new TimerUtil(); + private AttackData target = null; + private int switchTick = 0; + private boolean hitRegistered = false; + private boolean blockingState = false; + private boolean isBlocking = false; + private boolean fakeBlockState = false; + private boolean blinkReset = false; + private long attackDelayMS = 0L; + private int blockTick = 0; + private int lastTickProcessed; + public final ModeProperty mode; + public final ModeProperty sort; + public final ModeProperty autoBlock; + public final BooleanProperty autoBlockRequirePress; + public final FloatProperty autoBlockMinCPS; + public final FloatProperty autoBlockMaxCPS; + public final FloatProperty autoBlockRange; + public final FloatProperty swingRange; + public final FloatProperty attackRange; + public final IntProperty fov; + public final IntProperty minCPS; + public final IntProperty maxCPS; + public final IntProperty switchDelay; + public final ModeProperty rotations; + public final ModeProperty moveFix; + public final PercentProperty smoothing; + public final IntProperty angleStep; + public final BooleanProperty throughWalls; + public final BooleanProperty requirePress; + public final BooleanProperty allowMining; + public final BooleanProperty weaponsOnly; + public final BooleanProperty allowTools; + public final BooleanProperty inventoryCheck; + public final BooleanProperty botCheck; + public final BooleanProperty players; + public final BooleanProperty bosses; + public final BooleanProperty mobs; + public final BooleanProperty animals; + public final BooleanProperty golems; + public final BooleanProperty silverfish; + public final BooleanProperty teams; + public final ModeProperty showTarget; + public final ModeProperty debugLog; + + private long getAttackDelay() { + return this.isBlocking ? (long) (1000.0F / RandomUtil.nextLong(this.autoBlockMinCPS.getValue().longValue(), this.autoBlockMaxCPS.getValue().longValue())) : 1000L / RandomUtil.nextLong(this.minCPS.getValue(), this.maxCPS.getValue()); + } + + private boolean performAttack(float yaw, float pitch) { + if (!Myau.playerStateManager.digging && !Myau.playerStateManager.placing) { + if (this.isPlayerBlocking() && this.autoBlock.getValue() != 1) { + return false; + } else if (this.attackDelayMS > 0L) { + return false; + } else { + this.attackDelayMS = this.attackDelayMS + this.getAttackDelay(); + mc.thePlayer.swingItem(); + if ((this.rotations.getValue() != 0 || !this.isBoxInAttackRange(this.target.getBox())) + && RotationUtil.rayTrace(this.target.getBox(), yaw, pitch, this.attackRange.getValue()) == null) { + return false; + } else { + AttackEvent event = new AttackEvent(this.target.getEntity()); + EventManager.call(event); + ((IAccessorPlayerControllerMP) mc.playerController).callSyncCurrentPlayItem(); + PacketUtil.sendPacket(new C02PacketUseEntity(this.target.getEntity(), Action.ATTACK)); + if (mc.playerController.getCurrentGameType() != GameType.SPECTATOR) { + PlayerUtil.attackEntity(this.target.getEntity()); + } + this.hitRegistered = true; + return true; + } + } + } else { + return false; + } + } + + private void sendUseItem() { + ((IAccessorPlayerControllerMP) mc.playerController).callSyncCurrentPlayItem(); + this.startBlock(mc.thePlayer.getHeldItem()); + } + + private void startBlock(ItemStack itemStack) { + PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(itemStack)); + mc.thePlayer.setItemInUse(itemStack, itemStack.getMaxItemUseDuration()); + this.blockingState = true; + } + + private void stopBlock() { + PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN)); + mc.thePlayer.stopUsingItem(); + this.blockingState = false; + } + + private void interactAttack(float yaw, float pitch) { + if (this.target != null) { + MovingObjectPosition mop = RotationUtil.rayTrace(this.target.getBox(), yaw, pitch, 8.0); + if (mop != null) { + ((IAccessorPlayerControllerMP) mc.playerController).callSyncCurrentPlayItem(); + PacketUtil.sendPacket( + new C02PacketUseEntity( + this.target.getEntity(), + new Vec3(mop.hitVec.xCoord - this.target.getX(), mop.hitVec.yCoord - this.target.getY(), mop.hitVec.zCoord - this.target.getZ()) + ) + ); + PacketUtil.sendPacket(new C02PacketUseEntity(this.target.getEntity(), Action.INTERACT)); + PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem())); + mc.thePlayer.setItemInUse(mc.thePlayer.getHeldItem(), mc.thePlayer.getHeldItem().getMaxItemUseDuration()); + this.blockingState = true; + } + } + } + + private boolean canAttack() { + if (this.inventoryCheck.getValue() && mc.currentScreen instanceof GuiContainer) { + return false; + } else if (!(Boolean) this.weaponsOnly.getValue() + || ItemUtil.hasRawUnbreakingEnchant() + || this.allowTools.getValue() && ItemUtil.isHoldingTool()) { + if (((IAccessorPlayerControllerMP) mc.playerController).getIsHittingBlock()) { + return false; + } else if ((ItemUtil.isEating() || ItemUtil.isUsingBow()) && PlayerUtil.isUsingItem()) { + return false; + } else { + AutoHeal autoHeal = (AutoHeal) Myau.moduleManager.modules.get(AutoHeal.class); + if (autoHeal.isEnabled() && autoHeal.isSwitching()) { + return false; + } else { + BedNuker bedNuker = (BedNuker) Myau.moduleManager.modules.get(BedNuker.class); + AutoBlockIn autoBlockIn = (AutoBlockIn) Myau.moduleManager.modules.get(AutoBlockIn.class); + if (bedNuker.isEnabled() && bedNuker.isReady()) { + return false; + } else if (Myau.moduleManager.modules.get(Scaffold.class).isEnabled()) { + return false; + } else if (autoBlockIn.isEnabled()) { + return false; + } else if (this.requirePress.getValue()) { + return PlayerUtil.isAttacking(); + } else { + return !this.allowMining.getValue() || !mc.objectMouseOver.typeOfHit.equals(MovingObjectType.BLOCK) || !PlayerUtil.isAttacking(); + } + } + } + } else { + return false; + } + } + + private boolean canAutoBlock() { + if (!ItemUtil.isHoldingSword()) { + return false; + } else { + return !this.autoBlockRequirePress.getValue() || PlayerUtil.isUsingItem(); + } + } + + private boolean hasValidTarget() { + return mc.theWorld + .loadedEntityList + .stream() + .anyMatch( + entity -> entity instanceof EntityLivingBase + && this.isValidTarget((EntityLivingBase) entity) + && this.isInBlockRange((EntityLivingBase) entity) + ); + } + + private boolean isValidTarget(EntityLivingBase entityLivingBase) { + if (!mc.theWorld.loadedEntityList.contains(entityLivingBase)) { + return false; + } else if (entityLivingBase != mc.thePlayer && entityLivingBase != mc.thePlayer.ridingEntity) { + if (entityLivingBase == mc.getRenderViewEntity() || entityLivingBase == mc.getRenderViewEntity().ridingEntity) { + return false; + } else if (entityLivingBase.deathTime > 0) { + return false; + } else if (RotationUtil.angleToEntity(entityLivingBase) > this.fov.getValue().floatValue()) { + return false; + } else if (!this.throughWalls.getValue() && RotationUtil.rayTrace(entityLivingBase) != null) { + return false; + } else if (entityLivingBase instanceof EntityOtherPlayerMP) { + if (!this.players.getValue()) { + return false; + } else if (TeamUtil.isFriend((EntityPlayer) entityLivingBase)) { + return false; + } else { + return (!this.teams.getValue() || !TeamUtil.isSameTeam((EntityPlayer) entityLivingBase)) && (!this.botCheck.getValue() || !TeamUtil.isBot((EntityPlayer) entityLivingBase)); + } + } else if (entityLivingBase instanceof EntityDragon || entityLivingBase instanceof EntityWither) { + return this.bosses.getValue(); + } else if (!(entityLivingBase instanceof EntityMob) && !(entityLivingBase instanceof EntitySlime)) { + if (entityLivingBase instanceof EntityAnimal + || entityLivingBase instanceof EntityBat + || entityLivingBase instanceof EntitySquid + || entityLivingBase instanceof EntityVillager) { + return this.animals.getValue(); + } else if (!(entityLivingBase instanceof EntityIronGolem)) { + return false; + } else { + return this.golems.getValue() && (!this.teams.getValue() || !TeamUtil.hasTeamColor(entityLivingBase)); + } + } else if (!(entityLivingBase instanceof EntitySilverfish)) { + return this.mobs.getValue(); + } else { + return this.silverfish.getValue() && (!this.teams.getValue() || !TeamUtil.hasTeamColor(entityLivingBase)); + } + } else { + return false; + } + } + + private boolean isInRange(EntityLivingBase entityLivingBase) { + return this.isInBlockRange(entityLivingBase) || this.isInSwingRange(entityLivingBase) || this.isInAttackRange(entityLivingBase); + } + + private boolean isInBlockRange(EntityLivingBase entityLivingBase) { + return RotationUtil.distanceToEntity(entityLivingBase) <= (double) this.autoBlockRange.getValue(); + } + + private boolean isInSwingRange(EntityLivingBase entityLivingBase) { + return RotationUtil.distanceToEntity(entityLivingBase) <= (double) this.swingRange.getValue(); + } + + private boolean isBoxInSwingRange(AxisAlignedBB axisAlignedBB) { + return RotationUtil.distanceToBox(axisAlignedBB) <= (double) this.swingRange.getValue(); + } + + private boolean isInAttackRange(EntityLivingBase entityLivingBase) { + return RotationUtil.distanceToEntity(entityLivingBase) <= (double) this.attackRange.getValue(); + } + + private boolean isBoxInAttackRange(AxisAlignedBB axisAlignedBB) { + return RotationUtil.distanceToBox(axisAlignedBB) <= (double) this.attackRange.getValue(); + } + + private boolean isPlayerTarget(EntityLivingBase entityLivingBase) { + return entityLivingBase instanceof EntityPlayer && TeamUtil.isTarget((EntityPlayer) entityLivingBase); + } + + private int findEmptySlot(int currentSlot) { + for (int i = 0; i < 9; i++) { + if (i != currentSlot && mc.thePlayer.inventory.getStackInSlot(i) == null) { + return i; + } + } + for (int i = 0; i < 9; i++) { + if (i != currentSlot) { + ItemStack stack = mc.thePlayer.inventory.getStackInSlot(i); + if (stack != null && !stack.hasDisplayName()) { + return i; + } + } + } + return Math.floorMod(currentSlot - 1, 9); + } + + private int findSwordSlot(int currentSlot) { + for (int i = 0; i < 9; i++) { + if (i != currentSlot) { + ItemStack item = mc.thePlayer.inventory.getStackInSlot(i); + if (item != null && item.getItem() instanceof ItemSword) { + return i; + } + } + } + return -1; + } + + public KillAura() { + super("KillAura", false); + this.lastTickProcessed = 0; + this.mode = new ModeProperty("mode", 0, new String[]{"SINGLE", "SWITCH"}); + this.sort = new ModeProperty("sort", 0, new String[]{"DISTANCE", "HEALTH", "HURT_TIME", "FOV"}); + this.autoBlock = new ModeProperty( + "auto-block", 2, new String[]{"NONE", "VANILLA", "SPOOF", "HYPIXEL", "BLINK", "INTERACT", "SWAP", "LEGIT", "FAKE"} + ); + this.autoBlockRequirePress = new BooleanProperty("auto-block-require-press", false); + this.autoBlockMinCPS = new FloatProperty("auto-block-min-aps", 8.0F, 1.0F, 20.0F); + this.autoBlockMaxCPS = new FloatProperty("auto-block-max-aps", 10.0F, 1.0F, 20.0F); + this.autoBlockRange = new FloatProperty("auto-block-range", 6.0F, 3.0F, 8.0F); + this.swingRange = new FloatProperty("swing-range", 3.5F, 3.0F, 6.0F); + this.attackRange = new FloatProperty("attack-range", 3.0F, 3.0F, 6.0F); + this.fov = new IntProperty("fov", 360, 30, 360); + this.minCPS = new IntProperty("min-aps", 14, 1, 20); + this.maxCPS = new IntProperty("max-aps", 14, 1, 20); + this.switchDelay = new IntProperty("switch-delay", 150, 0, 1000); + this.rotations = new ModeProperty("rotations", 2, new String[]{"NONE", "LEGIT", "SILENT", "LOCK_VIEW"}); + this.moveFix = new ModeProperty("move-fix", 1, new String[]{"NONE", "SILENT", "STRICT"}); + this.smoothing = new PercentProperty("smoothing", 0); + this.angleStep = new IntProperty("angle-step", 90, 30, 180); + this.throughWalls = new BooleanProperty("through-walls", true); + this.requirePress = new BooleanProperty("require-press", false); + this.allowMining = new BooleanProperty("allow-mining", true); + this.weaponsOnly = new BooleanProperty("weapons-only", true); + this.allowTools = new BooleanProperty("allow-tools", false, this.weaponsOnly::getValue); + this.inventoryCheck = new BooleanProperty("inventory-check", true); + this.botCheck = new BooleanProperty("bot-check", true); + this.players = new BooleanProperty("players", true); + this.bosses = new BooleanProperty("bosses", false); + this.mobs = new BooleanProperty("mobs", false); + this.animals = new BooleanProperty("animals", false); + this.golems = new BooleanProperty("golems", false); + this.silverfish = new BooleanProperty("silverfish", false); + this.teams = new BooleanProperty("teams", true); + this.showTarget = new ModeProperty("show-target", 0, new String[]{"NONE", "DEFAULT", "HUD"}); + this.debugLog = new ModeProperty("debug-log", 0, new String[]{"NONE", "HEALTH"}); + } + + public EntityLivingBase getTarget() { + return this.target != null ? this.target.getEntity() : null; + } + + public boolean isAttackAllowed() { + Scaffold scaffold = (Scaffold) Myau.moduleManager.modules.get(Scaffold.class); + if (scaffold.isEnabled()) { + return false; + } else if (!this.weaponsOnly.getValue() + || ItemUtil.hasRawUnbreakingEnchant() + || this.allowTools.getValue() && ItemUtil.isHoldingTool()) { + return !this.requirePress.getValue() || KeyBindUtil.isKeyDown(mc.gameSettings.keyBindAttack.getKeyCode()); + } else { + return false; + } + } + + public boolean shouldAutoBlock() { + if (this.isPlayerBlocking() && this.isBlocking) { + return !mc.thePlayer.isInWater() && !mc.thePlayer.isInLava() && (this.autoBlock.getValue() == 3 // HYPIXEL + || this.autoBlock.getValue() == 4 // BLINK + || this.autoBlock.getValue() == 5 // INTERACT + || this.autoBlock.getValue() == 6 // SWAP + || this.autoBlock.getValue() == 7); // LEGIT + } else { + return false; + } + } + + public boolean isBlocking() { + return this.fakeBlockState && ItemUtil.isHoldingSword(); + } + + public boolean isPlayerBlocking() { + return (mc.thePlayer.isUsingItem() || this.blockingState) && ItemUtil.isHoldingSword(); + } + + @EventTarget(Priority.LOW) + public void onUpdate(UpdateEvent event) { + if (event.getType() == EventType.POST && this.blinkReset) { + this.blinkReset = false; + Myau.blinkManager.setBlinkState(false, BlinkModules.AUTO_BLOCK); + Myau.blinkManager.setBlinkState(true, BlinkModules.AUTO_BLOCK); + } + if (this.isEnabled() && event.getType() == EventType.PRE) { + if (this.attackDelayMS > 0L) { + this.attackDelayMS -= 50L; + } + boolean attack = this.target != null && this.canAttack(); + boolean block = attack && this.canAutoBlock(); + if (!block) { + Myau.blinkManager.setBlinkState(false, BlinkModules.AUTO_BLOCK); + this.isBlocking = false; + this.fakeBlockState = false; + this.blockTick = 0; + } + if (attack) { + boolean swap = false; + boolean blocked = false; + if (block) { + switch (this.autoBlock.getValue()) { + case 0: // NONE + if (PlayerUtil.isUsingItem()) { + this.isBlocking = true; + if (!this.isPlayerBlocking() && !Myau.playerStateManager.digging && !Myau.playerStateManager.placing) { + swap = true; + } + } else { + this.isBlocking = false; + if (this.isPlayerBlocking() && !Myau.playerStateManager.digging && !Myau.playerStateManager.placing) { + this.stopBlock(); + } + } + Myau.blinkManager.setBlinkState(false, BlinkModules.AUTO_BLOCK); + this.fakeBlockState = false; + break; + case 1: // VANILLA + if (this.hasValidTarget()) { + if (!this.isPlayerBlocking() && !Myau.playerStateManager.digging && !Myau.playerStateManager.placing) { + swap = true; + } + Myau.blinkManager.setBlinkState(false, BlinkModules.AUTO_BLOCK); + this.isBlocking = true; + this.fakeBlockState = false; + } else { + Myau.blinkManager.setBlinkState(false, BlinkModules.AUTO_BLOCK); + this.isBlocking = false; + this.fakeBlockState = false; + } + break; + case 2: // SPOOF + if (this.hasValidTarget()) { + int item = ((IAccessorPlayerControllerMP) mc.playerController).getCurrentPlayerItem(); + if (Myau.playerStateManager.digging + || Myau.playerStateManager.placing + || mc.thePlayer.inventory.currentItem != item + || this.isPlayerBlocking() && this.blockTick != 0 + || this.attackDelayMS > 0L && this.attackDelayMS <= 50L) { + this.blockTick = 0; + } else { + int slot = this.findEmptySlot(item); + PacketUtil.sendPacket(new C09PacketHeldItemChange(slot)); + PacketUtil.sendPacket(new C09PacketHeldItemChange(item)); + swap = true; + this.blockTick = 1; + } + Myau.blinkManager.setBlinkState(false, BlinkModules.AUTO_BLOCK); + this.isBlocking = true; + this.fakeBlockState = false; + } else { + Myau.blinkManager.setBlinkState(false, BlinkModules.AUTO_BLOCK); + this.isBlocking = false; + this.fakeBlockState = false; + } + break; + case 3: // HYPIXEL + if (this.hasValidTarget()) { + if (!Myau.playerStateManager.digging && !Myau.playerStateManager.placing) { + switch (this.blockTick) { + case 0: + if (!this.isPlayerBlocking()) { + swap = true; + } + blocked = true; + this.blockTick = 1; + break; + case 1: + if (this.isPlayerBlocking()) { + if(Myau.moduleManager.modules.get(NoSlow.class).isEnabled()){ + int randomSlot = new Random().nextInt(9); + while (randomSlot == mc.thePlayer.inventory.currentItem) { + randomSlot = new Random().nextInt(9); + } + PacketUtil.sendPacket(new C09PacketHeldItemChange(randomSlot)); + PacketUtil.sendPacket(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem)); + } + this.stopBlock(); + attack = false; + } + if (this.attackDelayMS <= 50L) { + this.blockTick = 0; + } + break; + default: + this.blockTick = 0; + } + } + this.isBlocking = true; + this.fakeBlockState = true; + } else { + Myau.blinkManager.setBlinkState(false, BlinkModules.AUTO_BLOCK); + this.isBlocking = false; + this.fakeBlockState = false; + } + break; + case 4: // BLINK + if (this.hasValidTarget()) { + if (!Myau.playerStateManager.digging && !Myau.playerStateManager.placing) { + switch (this.blockTick) { + case 0: + if (!this.isPlayerBlocking()) { + swap = true; + } + this.blinkReset = true; + this.blockTick = 1; + break; + case 1: + if (this.isPlayerBlocking()) { + this.stopBlock(); + attack = false; + } + if (this.attackDelayMS <= 50L) { + this.blockTick = 0; + } + break; + default: + this.blockTick = 0; + } + } + this.isBlocking = true; + this.fakeBlockState = true; + } else { + Myau.blinkManager.setBlinkState(false, BlinkModules.AUTO_BLOCK); + this.isBlocking = false; + this.fakeBlockState = false; + } + break; + case 5: // INTERACT + if (this.hasValidTarget()) { + int item = ((IAccessorPlayerControllerMP) mc.playerController).getCurrentPlayerItem(); + if (mc.thePlayer.inventory.currentItem == item && !Myau.playerStateManager.digging && !Myau.playerStateManager.placing) { + switch (this.blockTick) { + case 0: + if (!this.isPlayerBlocking()) { + swap = true; + } + this.blinkReset = true; + this.blockTick = 1; + break; + case 1: + if (this.isPlayerBlocking()) { + int slot = this.findEmptySlot(item); + PacketUtil.sendPacket(new C09PacketHeldItemChange(slot)); + ((IAccessorPlayerControllerMP) mc.playerController).setCurrentPlayerItem(slot); + attack = false; + } + if (this.attackDelayMS <= 50L) { + this.blockTick = 0; + } + break; + default: + this.blockTick = 0; + } + } + this.isBlocking = true; + this.fakeBlockState = true; + } else { + Myau.blinkManager.setBlinkState(false, BlinkModules.AUTO_BLOCK); + this.isBlocking = false; + this.fakeBlockState = false; + } + break; + case 6: // SWAP + if (this.hasValidTarget()) { + int item = ((IAccessorPlayerControllerMP) mc.playerController).getCurrentPlayerItem(); + if (mc.thePlayer.inventory.currentItem == item && !Myau.playerStateManager.digging && !Myau.playerStateManager.placing) { + switch (this.blockTick) { + case 0: + int slot = this.findSwordSlot(item); + if (slot != -1) { + if (!this.isPlayerBlocking()) { + swap = true; + } + this.blockTick = 1; + } + break; + case 1: + int swordsSlot = this.findSwordSlot(item); + if (swordsSlot == -1) { + this.blockTick = 0; + } else if (!this.isPlayerBlocking()) { + swap = true; + } else if (this.attackDelayMS <= 50L) { + PacketUtil.sendPacket(new C09PacketHeldItemChange(swordsSlot)); + ((IAccessorPlayerControllerMP) mc.playerController).setCurrentPlayerItem(swordsSlot); + this.startBlock(mc.thePlayer.inventory.getStackInSlot(swordsSlot)); + attack = false; + this.blockTick = 0; + } + break; + default: + this.blockTick = 0; + } + Myau.blinkManager.setBlinkState(false, BlinkModules.AUTO_BLOCK); + this.isBlocking = true; + this.fakeBlockState = true; + break; + } + } + Myau.blinkManager.setBlinkState(false, BlinkModules.AUTO_BLOCK); + this.isBlocking = false; + this.fakeBlockState = false; + break; + case 7: // LEGIT + if (this.hasValidTarget()) { + if (!Myau.playerStateManager.digging && !Myau.playerStateManager.placing) { + switch (this.blockTick) { + case 0: + if (!this.isPlayerBlocking()) { + swap = true; + } + this.blockTick = 1; + break; + case 1: + if (this.isPlayerBlocking()) { + this.stopBlock(); + attack = false; + } + if (this.attackDelayMS <= 50L) { + this.blockTick = 0; + } + break; + default: + this.blockTick = 0; + } + } + Myau.blinkManager.setBlinkState(false, BlinkModules.AUTO_BLOCK); + this.isBlocking = true; + this.fakeBlockState = false; + } else { + Myau.blinkManager.setBlinkState(false, BlinkModules.AUTO_BLOCK); + this.isBlocking = false; + this.fakeBlockState = false; + } + break; + case 8: // FAKE + Myau.blinkManager.setBlinkState(false, BlinkModules.AUTO_BLOCK); + this.isBlocking = false; + this.fakeBlockState = this.hasValidTarget(); + if (PlayerUtil.isUsingItem() + && !this.isPlayerBlocking() + && !Myau.playerStateManager.digging + && !Myau.playerStateManager.placing) { + swap = true; + } + } + } + boolean attacked = false; + if (this.isBoxInSwingRange(this.target.getBox())) { + if (this.rotations.getValue() == 2 || this.rotations.getValue() == 3) { + float[] rotations = RotationUtil.getRotationsToBox( + this.target.getBox(), + event.getYaw(), + event.getPitch(), + (float) this.angleStep.getValue() + RandomUtil.nextFloat(-5.0F, 5.0F), + (float) this.smoothing.getValue() / 100.0F + ); + event.setRotation(rotations[0], rotations[1], 1); + if (this.rotations.getValue() == 3) { + Myau.rotationManager.setRotation(rotations[0], rotations[1], 1, true); + } + if (this.moveFix.getValue() != 0 || this.rotations.getValue() == 3) { + event.setPervRotation(rotations[0], 1); + } + } + if (attack) { + attacked = this.performAttack(event.getNewYaw(), event.getNewPitch()); + } + } + if (swap) { + if (attacked) { + this.interactAttack(event.getNewYaw(), event.getNewPitch()); + } else { + this.sendUseItem(); + } + } + if (blocked) { + Myau.blinkManager.setBlinkState(false, BlinkModules.AUTO_BLOCK); + Myau.blinkManager.setBlinkState(true, BlinkModules.AUTO_BLOCK); + } + } + } + } + + @EventTarget + public void onTick(TickEvent event) { + if (this.isEnabled()) { + switch (event.getType()) { + case PRE: + if (this.target == null + || !this.isValidTarget(this.target.getEntity()) + || !this.isBoxInAttackRange(this.target.getBox()) + || !this.isBoxInSwingRange(this.target.getBox()) + || this.timer.hasTimeElapsed(this.switchDelay.getValue().longValue())) { + this.timer.reset(); + ArrayList targets = new ArrayList<>(); + for (Entity entity : mc.theWorld.loadedEntityList) { + if (entity instanceof EntityLivingBase + && this.isValidTarget((EntityLivingBase) entity) + && this.isInRange((EntityLivingBase) entity)) { + targets.add((EntityLivingBase) entity); + } + } + if (targets.isEmpty()) { + this.target = null; + } else { + if (targets.stream().anyMatch(this::isInSwingRange)) { + targets.removeIf(entityLivingBase -> !this.isInSwingRange(entityLivingBase)); + } + if (targets.stream().anyMatch(this::isInAttackRange)) { + targets.removeIf(entityLivingBase -> !this.isInAttackRange(entityLivingBase)); + } + if (targets.stream().anyMatch(this::isPlayerTarget)) { + targets.removeIf(entityLivingBase -> !this.isPlayerTarget(entityLivingBase)); + } + targets.sort( + (entityLivingBase1, entityLivingBase2) -> { + int sortBase = 0; + switch (this.sort.getValue()) { + case 1: + sortBase = Float.compare(TeamUtil.getHealthScore(entityLivingBase1), TeamUtil.getHealthScore(entityLivingBase2)); + break; + case 2: + sortBase = Integer.compare(entityLivingBase1.hurtResistantTime, entityLivingBase2.hurtResistantTime); + break; + case 3: + sortBase = Float.compare( + RotationUtil.angleToEntity(entityLivingBase1), + RotationUtil.angleToEntity(entityLivingBase2) + ); + } + return sortBase != 0 + ? sortBase + : Double.compare(RotationUtil.distanceToEntity(entityLivingBase1), RotationUtil.distanceToEntity(entityLivingBase2)); + } + ); + if (this.mode.getValue() == 1 && this.hitRegistered) { + this.hitRegistered = false; + this.switchTick++; + } + if (this.mode.getValue() == 0 || this.switchTick >= targets.size()) { + this.switchTick = 0; + } + this.target = new AttackData(targets.get(this.switchTick)); + } + } + if (this.target != null) { + this.target = new AttackData(this.target.getEntity()); + } + break; + case POST: + if (this.isPlayerBlocking() && !mc.thePlayer.isBlocking()) { + mc.thePlayer.setItemInUse(mc.thePlayer.getHeldItem(), mc.thePlayer.getHeldItem().getMaxItemUseDuration()); + } + } + } + } + + @EventTarget(Priority.LOWEST) + public void onPacket(PacketEvent event) { + if (this.isEnabled() && !event.isCancelled() && mc.thePlayer != null && mc.theWorld != null) { + if (event.getPacket() instanceof C07PacketPlayerDigging) { + C07PacketPlayerDigging packet = (C07PacketPlayerDigging) event.getPacket(); + if (packet.getStatus() == C07PacketPlayerDigging.Action.RELEASE_USE_ITEM) { + this.blockingState = false; + } + } + if (event.getPacket() instanceof C09PacketHeldItemChange) { + this.blockingState = false; + if (this.isBlocking) { + mc.thePlayer.stopUsingItem(); + } + } + if (this.debugLog.getValue() == 1 && this.isAttackAllowed()) { + if (event.getPacket() instanceof S06PacketUpdateHealth) { + float packet = ((S06PacketUpdateHealth) event.getPacket()).getHealth() - mc.thePlayer.getHealth(); + if (packet != 0.0F && this.lastTickProcessed != mc.thePlayer.ticksExisted) { + this.lastTickProcessed = mc.thePlayer.ticksExisted; + ChatUtil.sendFormatted( + String.format( + "%sHealth: %s&l%s&r (&otick: %d&r)&r", + Myau.clientName, + packet > 0.0F ? "&a" : "&c", + df.format(packet), + mc.thePlayer.ticksExisted + ) + ); + } + } + if (event.getPacket() instanceof S1CPacketEntityMetadata) { + S1CPacketEntityMetadata packet = (S1CPacketEntityMetadata) event.getPacket(); + if (packet.getEntityId() == mc.thePlayer.getEntityId()) { + for (WatchableObject watchableObject : packet.func_149376_c()) { + if (watchableObject.getDataValueId() == 6) { + float diff = (Float) watchableObject.getObject() - mc.thePlayer.getHealth(); + if (diff != 0.0F && this.lastTickProcessed != mc.thePlayer.ticksExisted) { + this.lastTickProcessed = mc.thePlayer.ticksExisted; + ChatUtil.sendFormatted( + String.format( + "%sHealth: %s&l%s&r (&otick: %d&r)&r", + Myau.clientName, + diff > 0.0F ? "&a" : "&c", + df.format(diff), + mc.thePlayer.ticksExisted + ) + ); + } + } + } + } + } + } + } + } + + @EventTarget + public void onMove(MoveInputEvent event) { + if (this.isEnabled()) { + if (this.moveFix.getValue() == 1 + && this.rotations.getValue() != 3 + && RotationState.isActived() + && RotationState.getPriority() == 1.0F + && MoveUtil.isForwardPressed()) { + MoveUtil.fixStrafe(RotationState.getSmoothedYaw()); + } + if (this.shouldAutoBlock()) { + mc.thePlayer.movementInput.jump = false; + } + } + } + + @EventTarget + public void onRender(Render3DEvent event) { + if (this.isEnabled() && target != null) { + if (this.showTarget.getValue() != 0 + && TeamUtil.isEntityLoaded(this.target.getEntity()) + && this.isAttackAllowed()) { + Color color = new Color(-1); + switch (this.showTarget.getValue()) { + case 1: + if (this.target.getEntity().hurtTime > 0) { + color = new Color(16733525); + } else { + color = new Color(5635925); + } + break; + case 2: + color = ((HUD) Myau.moduleManager.modules.get(HUD.class)).getColor(System.currentTimeMillis()); + } + RenderUtil.enableRenderState(); + RenderUtil.drawEntityBox(this.target.getEntity(), color.getRed(), color.getGreen(), color.getBlue()); + RenderUtil.disableRenderState(); + } + } + } + + @EventTarget + public void onLeftClick(LeftClickMouseEvent event) { + if (this.isBlocking) { + event.setCancelled(true); + } else { + if (this.isEnabled() && this.target != null && this.canAttack()) { + event.setCancelled(true); + } + } + } + + @EventTarget + public void onRightClick(RightClickMouseEvent event) { + if (this.isBlocking) { + event.setCancelled(true); + } else { + if (this.isEnabled() && this.target != null && this.canAttack()) { + event.setCancelled(true); + } + } + } + + @EventTarget + public void onHitBlock(HitBlockEvent event) { + if (this.isBlocking) { + event.setCancelled(true); + } else { + if (this.isEnabled() && this.target != null && this.canAttack()) { + event.setCancelled(true); + } + } + } + + @EventTarget + public void onCancelUse(CancelUseEvent event) { + if (this.isBlocking) { + event.setCancelled(true); + } + } + + @Override + public void onEnabled() { + this.target = null; + this.switchTick = 0; + this.hitRegistered = false; + this.attackDelayMS = 0L; + this.blockTick = 0; + } + + @Override + public void onDisabled() { + Myau.blinkManager.setBlinkState(false, BlinkModules.AUTO_BLOCK); + this.blockingState = false; + this.isBlocking = false; + this.fakeBlockState = false; + } + + @Override + public void verifyValue(String value) { + boolean badCps = this.autoBlock.getValue() == 2 + || this.autoBlock.getValue() == 3 + || this.autoBlock.getValue() == 4 + || this.autoBlock.getValue() == 5 + || this.autoBlock.getValue() == 6 + || this.autoBlock.getValue() == 7; + if (!this.autoBlock.getName().equals(value)) { + if (this.swingRange.getName().equals(value)) { + if (this.swingRange.getValue() < this.attackRange.getValue()) { + this.attackRange.setValue(this.swingRange.getValue()); + } + } else if (this.attackRange.getName().equals(value)) { + if (this.swingRange.getValue() < this.attackRange.getValue()) { + this.swingRange.setValue(this.attackRange.getValue()); + } + } else if (this.minCPS.getName().equals(value)) { + if (this.minCPS.getValue() > this.maxCPS.getValue()) { + this.maxCPS.setValue(this.minCPS.getValue()); + } + } else if (this.autoBlockMinCPS.getName().equals(value)) { + if (this.autoBlockMinCPS.getValue() > this.autoBlockMaxCPS.getValue()) { + this.autoBlockMaxCPS.setValue(this.autoBlockMinCPS.getValue()); + } + if(autoBlockMinCPS.getValue() > 10.0F && badCps){ + autoBlockMinCPS.setValue(10.0F); + } + } else if (this.autoBlockMaxCPS.getName().equals(value)) { + if (this.autoBlockMinCPS.getValue() > this.autoBlockMaxCPS.getValue()) { + this.autoBlockMinCPS.setValue(this.autoBlockMaxCPS.getValue()); + } + if(autoBlockMaxCPS.getValue() > 10.0F && badCps){ + autoBlockMaxCPS.setValue(10.0F); + } + } else { + if (this.maxCPS.getName().equals(value) && this.minCPS.getValue() > this.maxCPS.getValue()) { + this.minCPS.setValue(this.maxCPS.getValue()); + } + } + } else { + if (badCps && (this.autoBlockMinCPS.getValue() > 10.0F || this.autoBlockMaxCPS.getValue() > 10.0F)) { + this.autoBlockMinCPS.setValue(8.0F); + this.autoBlockMaxCPS.setValue(10.0F); + } + } + } + + @Override + public String[] getSuffix() { + return new String[]{CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, this.mode.getModeString())}; + } + + public static class AttackData { + private final EntityLivingBase entity; + private final AxisAlignedBB box; + private final double x; + private final double y; + private final double z; + + public AttackData(EntityLivingBase entityLivingBase) { + this.entity = entityLivingBase; + double collisionBorderSize = entityLivingBase.getCollisionBorderSize(); + this.box = entityLivingBase.getEntityBoundingBox().expand(collisionBorderSize, collisionBorderSize, collisionBorderSize); + this.x = entityLivingBase.posX; + this.y = entityLivingBase.posY; + this.z = entityLivingBase.posZ; + } + + public EntityLivingBase getEntity() { + return this.entity; + } + + public AxisAlignedBB getBox() { + return this.box; + } + + public double getX() { + return this.x; + } + + public double getY() { + return this.y; + } + + public double getZ() { + return this.z; + } + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.event.EventTarget; +import myau.event.types.Priority; +import myau.events.PacketEvent; +import myau.events.Render3DEvent; +import myau.events.TickEvent; +import myau.mixin.IAccessorPlayerControllerMP; +import myau.mixin.IAccessorRenderManager; +import myau.module.Module; +import myau.util.ItemUtil; +import myau.util.RenderUtil; +import myau.util.RotationUtil; +import myau.util.TeamUtil; +import myau.property.properties.*; +import myau.property.properties.BooleanProperty; +import myau.property.properties.ModeProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemSword; +import net.minecraft.network.Packet; +import net.minecraft.network.play.client.C02PacketUseEntity; +import net.minecraft.network.play.client.C07PacketPlayerDigging; +import net.minecraft.network.play.client.C07PacketPlayerDigging.Action; +import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.Vec3; + +import java.awt.*; +import java.util.List; +import java.util.stream.Collectors; + +public class LagRange extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private int tickIndex = -1; + private long delayCounter = 0L; + private boolean hasTarget = false; + private Vec3 lastPosition = null; + private Vec3 currentPosition = null; + public final IntProperty delay = new IntProperty("delay", 150, 0, 1000); + public final FloatProperty range = new FloatProperty("range", 10.0F, 3.0F, 100.0F); + public final BooleanProperty weaponsOnly = new BooleanProperty("weapons-only", true); + public final BooleanProperty allowTools = new BooleanProperty("allow-tools", false, this.weaponsOnly::getValue); + public final BooleanProperty botCheck = new BooleanProperty("bot-check", true); + public final BooleanProperty teams = new BooleanProperty("teams", true); + public final ModeProperty showPosition = new ModeProperty("show-position", 0, new String[]{"NONE", "DEFAULT", "HUD"}); + + private boolean isValidTarget(EntityPlayer entityPlayer) { + if (entityPlayer != mc.thePlayer && entityPlayer != mc.thePlayer.ridingEntity) { + if (entityPlayer == mc.getRenderViewEntity() || entityPlayer == mc.getRenderViewEntity().ridingEntity) { + return false; + } else if (entityPlayer.deathTime > 0) { + return false; + } else if (TeamUtil.isFriend(entityPlayer)) { + return false; + } else { + return (!this.teams.getValue() || !TeamUtil.isSameTeam(entityPlayer)) && (!this.botCheck.getValue() || !TeamUtil.isBot(entityPlayer)); + } + } else { + return false; + } + } + + private boolean shouldResetOnPacket(Packet packet) { + if (packet instanceof C02PacketUseEntity) { + return true; + } else if (packet instanceof C07PacketPlayerDigging) { + return ((C07PacketPlayerDigging) packet).getStatus() != Action.RELEASE_USE_ITEM; + } else if (packet instanceof C08PacketPlayerBlockPlacement) { + ItemStack item = ((C08PacketPlayerBlockPlacement) packet).getStack(); + return item == null || !(item.getItem() instanceof ItemSword); + } else { + return false; + } + } + + public LagRange() { + super("LagRange", false); + } + + @EventTarget(Priority.LOW) + public void onTick(TickEvent event) { + if (this.isEnabled()) { + switch (event.getType()) { + case PRE: + Myau.lagManager.setDelay(0); + this.hasTarget = false; + BedNuker bedNuker = (BedNuker) Myau.moduleManager.modules.get(BedNuker.class); + if ((!bedNuker.isEnabled() || !bedNuker.isReady()) + && !((IAccessorPlayerControllerMP) mc.playerController).getIsHittingBlock() + && (!mc.thePlayer.isUsingItem() || mc.thePlayer.isBlocking()) + && ( + !(Boolean) this.weaponsOnly.getValue() + || ItemUtil.hasRawUnbreakingEnchant() + || this.allowTools.getValue() && ItemUtil.isHoldingTool() + )) { + List players = mc.theWorld + .loadedEntityList + .stream() + .filter(entity -> entity instanceof EntityPlayer) + .map(entity -> (EntityPlayer) entity) + .filter(this::isValidTarget) + .collect(Collectors.toList()); + if (players.isEmpty()) { + this.tickIndex = -1; + } else { + double height = mc.thePlayer.getEyeHeight(); + Vec3 eyePosition = Myau.lagManager.getLastPosition().addVector(0.0, height, 0.0); + Vec3 targetEyePosition = new Vec3(mc.thePlayer.lastTickPosX, mc.thePlayer.lastTickPosY + height, mc.thePlayer.lastTickPosZ); + Vec3 playerEyePosition = new Vec3(mc.thePlayer.posX, mc.thePlayer.posY + height, mc.thePlayer.posZ); + for (EntityPlayer player : players) { + double distance = RotationUtil.distanceToBox(player, playerEyePosition); + if (!(distance > (double) this.range.getValue())) { + double targetDist = RotationUtil.distanceToBox(player, targetEyePosition); + double eyeDist = RotationUtil.distanceToBox(player, eyePosition); + if (distance < targetDist || distance < eyeDist) { + if (this.tickIndex < 0) { + this.tickIndex = 0; + for (this.delayCounter = this.delayCounter + (long) this.delay.getValue(); + this.delayCounter > 0L; + this.delayCounter = this.delayCounter - 50 + ) { + this.tickIndex++; + } + } + Myau.lagManager.setDelay(this.tickIndex); + this.hasTarget = true; + return; + } + } + } + } + } else { + this.tickIndex = -1; + } + break; + case POST: + Vec3 savedPosition = Myau.lagManager.getLastPosition(); + if (this.currentPosition == null) { + this.lastPosition = savedPosition; + } else { + this.lastPosition = this.currentPosition; + } + this.currentPosition = savedPosition; + } + } + } + + @EventTarget + public void onPacket(PacketEvent event) { + if (this.isEnabled()) { + if (this.shouldResetOnPacket(event.getPacket())) { + Myau.lagManager.setDelay(0); + this.tickIndex = -1; + } + } + } + + @EventTarget(Priority.HIGH) + public void onRender3D(Render3DEvent event) { + if (this.isEnabled()) { + if (this.showPosition.getValue() != 0 + && mc.gameSettings.thirdPersonView != 0 + && this.hasTarget + && this.lastPosition != null + && this.currentPosition != null) { + Color color = new Color(-1); + switch (this.showPosition.getValue()) { + case 1: + color = TeamUtil.getTeamColor(mc.thePlayer, 1.0F); + break; + case 2: + color = ((HUD) Myau.moduleManager.modules.get(HUD.class)).getColor(System.currentTimeMillis()); + } + double x = RenderUtil.lerpDouble(this.currentPosition.xCoord, this.lastPosition.xCoord, event.getPartialTicks()); + double y = RenderUtil.lerpDouble(this.currentPosition.yCoord, this.lastPosition.yCoord, event.getPartialTicks()); + double z = RenderUtil.lerpDouble(this.currentPosition.zCoord, this.lastPosition.zCoord, event.getPartialTicks()); + float size = mc.thePlayer.getCollisionBorderSize(); + AxisAlignedBB aabb = new AxisAlignedBB( + x - (double) mc.thePlayer.width / 2.0, + y, + z - (double) mc.thePlayer.width / 2.0, + x + (double) mc.thePlayer.width / 2.0, + y + (double) mc.thePlayer.height, + z + (double) mc.thePlayer.width / 2.0 + ) + .expand(size, size, size) + .offset( + -((IAccessorRenderManager) mc.getRenderManager()).getRenderPosX(), + -((IAccessorRenderManager) mc.getRenderManager()).getRenderPosY(), + -((IAccessorRenderManager) mc.getRenderManager()).getRenderPosZ() + ); + RenderUtil.enableRenderState(); + RenderUtil.drawFilledBox(aabb, color.getRed(), color.getGreen(), color.getBlue()); + RenderUtil.disableRenderState(); + } + } + } + + @Override + public void onDisabled() { + Myau.lagManager.setDelay(0); + this.tickIndex = -1; + this.delayCounter = 0L; + this.hasTarget = false; + this.lastPosition = null; + this.currentPosition = null; + } + + @Override + public String[] getSuffix() { + return new String[]{String.format("%dms", this.delay.getValue())}; + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.PacketEvent; +import myau.module.Module; +import myau.util.ChatUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.network.play.server.S2CPacketSpawnGlobalEntity; + +public class LightningTracker extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + + private String getDirection(double playerX, double playerZ, double lightningX, double lightningZ) { + double threshold = Math.sqrt(2.0) - 1.0; + double xDiff = lightningX - playerX; + double yDiff = lightningZ - playerZ; + if (Math.abs(xDiff) > Math.abs(yDiff)) { + if (Math.abs(yDiff / xDiff) <= threshold) { + return xDiff > 0.0 ? "E" : "W"; + } else if (xDiff > 0.0) { + return yDiff > 0.0 ? "SE" : "NE"; + } else { + return yDiff > 0.0 ? "SW" : "NW"; + } + } else if (Math.abs(yDiff) > 0.0) { + if (Math.abs(xDiff / yDiff) <= threshold) { + return yDiff > 0.0 ? "S" : "N"; + } else if (yDiff > 0.0) { + return xDiff > 0.0 ? "SE" : "SW"; + } else { + return xDiff > 0.0 ? "NE" : "NW"; + } + } else { + return "?"; + } + } + + public LightningTracker() { + super("LightningTracker", false, true); + } + + @EventTarget + public void onPacket(PacketEvent event) { + if (this.isEnabled() && event.getType() == EventType.RECEIVE && event.getPacket() instanceof S2CPacketSpawnGlobalEntity) { + S2CPacketSpawnGlobalEntity packet = (S2CPacketSpawnGlobalEntity) event.getPacket(); + if (packet.func_149053_g() == 1) { + double x = (double) packet.func_149051_d() / 32.0; + double y = (double) packet.func_149050_e() / 32.0; + double z = (double) packet.func_149049_f() / 32.0; + double distance = mc.thePlayer.getDistance(x, y, z); + String direction = this.getDirection(mc.thePlayer.posX, mc.thePlayer.posZ, x, z); + ChatUtil.sendFormatted( + String.format( + "&8[&e%s&8] &7X: &f&l%d&r &7Y: &f&l%d&r &7Z: &f&l%d&r &7D: &6&l%d&r &6%s&r", + this.getName(), + (int) x, + (int) y, + (int) z, + (int) distance, + direction + ) + ); + } + } + } +} + + + +package myau.module.modules; + +import com.google.common.base.CaseFormat; +import myau.Myau; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.event.types.Priority; +import myau.events.*; +import myau.management.RotationState; +import myau.mixin.IAccessorPlayerControllerMP; +import myau.module.Module; +import myau.util.*; +import myau.property.properties.FloatProperty; +import myau.property.properties.PercentProperty; +import myau.property.properties.ModeProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemFireball; +import net.minecraft.item.ItemStack; +import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement; +import net.minecraft.network.play.server.S08PacketPlayerPosLook; + +public class LongJump extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private final TimerUtil fireballTimer = new TimerUtil(); + private final TimerUtil jumpTimer = new TimerUtil(); + private boolean isJumping = false; + private int tickCounter = 0; + private int jumpModeStage = 0; + private boolean readyToUseFireball = false; + private boolean fireballLaunched = false; + private int savedHotbarSlot = -1; + public final ModeProperty mode = new ModeProperty("mode", 0, new String[]{"FIREBALL", "FIREBALL_MANUAL", "FIREBALL_HIGH", "FIREBALL_FLAT"}); + public final FloatProperty motion = new FloatProperty("motion", 1.0F, 1.0F, 20.0F); + public final FloatProperty speedMotion = new FloatProperty("speed-motion", 1.0F, 1.0F, 20.0F); + public final PercentProperty strafe = new PercentProperty("strafe", 0); + + private int findFireballInHotbar() { + if (mc.thePlayer == null) { + return -1; + } else { + for (int i = 0; i < 9; i++) { + ItemStack stack = mc.thePlayer.inventory.getStackInSlot(i); + if (stack != null && stack.getItem() instanceof ItemFireball) { + return i; + } + } + return -1; + } + } + + private double getMotionFactor() { + return MoveUtil.getSpeedLevel() > 0 + ? (double) this.speedMotion.getValue() + : (double) this.motion.getValue(); + } + + public LongJump() { + super("LongJump", false); + } + + public boolean isAutoMode() { + return this.mode.getValue() == 0 || this.mode.getValue() == 2 || this.mode.getValue() == 3; + } + + public boolean isManualMode() { + return this.mode.getValue() == 1; + } + + public boolean isLongJumpMode() { + return this.isAutoMode() || this.isManualMode(); + } + + public boolean canStartJump() { + return !this.fireballTimer.hasTimeElapsed(1000L) && !this.isJumping; + } + + public boolean isJumping() { + return this.isJumping; + } + + @EventTarget(Priority.HIGHEST) + public void onKnockback(KnockbackEvent event) { + if (this.isEnabled() && !event.isCancelled()) { + if ((this.isManualMode() || this.isAutoMode()) && this.canStartJump()) { + event.setCancelled(true); + this.isJumping = true; + this.tickCounter = 0; + } + } + } + + @EventTarget(Priority.HIGHEST) + public void onTick(TickEvent event) { + if (this.isEnabled()) { + switch (event.getType()) { + case PRE: + if (this.isAutoMode() && !this.fireballLaunched && this.readyToUseFireball) { + int slot = this.findFireballInHotbar(); + if (slot != -1) { + this.savedHotbarSlot = mc.thePlayer.inventory.currentItem; + mc.thePlayer.inventory.currentItem = slot; + ((IAccessorPlayerControllerMP) mc.playerController).callSyncCurrentPlayItem(); + PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem())); + this.fireballTimer.reset(); + this.fireballLaunched = true; + } + } + break; + case POST: + if (this.savedHotbarSlot != -1) { + mc.thePlayer.inventory.currentItem = this.savedHotbarSlot; + this.savedHotbarSlot = -1; + } + } + } + } + + @EventTarget + public void onUpdate(UpdateEvent event) { + if (this.isEnabled() && event.getType() == EventType.PRE) { + if (this.isLongJumpMode() && this.isJumping) { + this.tickCounter++; + if (this.tickCounter == 1) { + switch (this.mode.getValue()) { + case 0: + case 1: + this.jumpModeStage = 0; + break; + case 2: + this.jumpModeStage = 1; + break; + case 3: + this.jumpModeStage = MoveUtil.isForwardPressed() ? 2 : 1; + } + } + if (this.tickCounter == 2 && MoveUtil.isForwardPressed()) { + MoveUtil.setSpeed(MoveUtil.getSpeed() * this.getMotionFactor()); + } + if (this.tickCounter >= 1 && this.tickCounter <= 30) { + switch (this.jumpModeStage) { + case 1: + if (this.tickCounter == 1) { + mc.thePlayer.motionY *= 0.75; + } else { + double motion = mc.thePlayer.motionY / 0.98F + 0.055; + if (motion > 0.0) { + mc.thePlayer.motionY = motion; + } + } + break; + case 2: + if (this.tickCounter == 1) { + mc.thePlayer.motionY *= 0.75; + } else { + mc.thePlayer.motionY = 0.01 + (double) this.tickCounter * 0.003; + } + } + } + if (this.tickCounter >= 30) { + this.isJumping = false; + this.tickCounter = 0; + this.jumpModeStage = 0; + if (this.isAutoMode()) { + this.setEnabled(false); + } + return; + } + } + if (this.isAutoMode() && !this.isJumping) { + if (this.jumpTimer.hasTimeElapsed(1500L)) { + this.setEnabled(false); + return; + } + this.readyToUseFireball = true; + float yaw = RotationUtil.quantizeAngle(mc.thePlayer.rotationYaw - 180.0F - RandomUtil.nextFloat(0.0F, 1.0F)); + float pitch = RotationUtil.quantizeAngle(89.0F + RandomUtil.nextFloat(-0.25F, 0.25F)); + event.setRotation(yaw, pitch, 4); + event.setPervRotation(yaw, 4); + } + } + } + + @EventTarget + public void onMoveInput(MoveInputEvent event) { + if (this.isEnabled()) { + if (RotationState.isActived() + && RotationState.getPriority() == 4.0F + && MoveUtil.isForwardPressed()) { + MoveUtil.fixStrafe(RotationState.getSmoothedYaw()); + } + } + } + + @EventTarget + public void onStrafe(StrafeEvent event) { + if (this.isEnabled()) { + if (this.isLongJumpMode() + && this.isJumping + && this.tickCounter >= 5 + && this.tickCounter <= 30 + && this.strafe.getValue() > 0) { + double speed = MoveUtil.getSpeed(); + MoveUtil.setSpeed(speed * (double) ((float) (100 - this.strafe.getValue()) / 100.0F), MoveUtil.getDirectionYaw()); + MoveUtil.addSpeed( + speed * (double) ((float) this.strafe.getValue() / 100.0F), MoveUtil.getMoveYaw() + ); + MoveUtil.setSpeed(speed); + } + } + } + + @EventTarget + public void onKey(KeyEvent event) { + if (event.getKey() == mc.gameSettings.keyBindUseItem.getKeyCode()) { + ItemStack stack = mc.thePlayer.inventory.getCurrentItem(); + if (stack != null && stack.getItem() instanceof ItemFireball) { + this.fireballTimer.reset(); + } + } + } + + @EventTarget(Priority.HIGH) + public void onPacket(PacketEvent event) { + if (event.getType() == EventType.RECEIVE && !event.isCancelled()) { + if (event.getPacket() instanceof S08PacketPlayerPosLook) { + this.isJumping = false; + this.tickCounter = 0; + this.jumpModeStage = 0; + if (this.isAutoMode()) { + this.setEnabled(false); + } + } + } + } + + @Override + public void onEnabled() { + this.jumpTimer.reset(); + if (this.isAutoMode() && this.findFireballInHotbar() == -1) { + this.setEnabled(false); + ChatUtil.sendFormatted(String.format("%s%s: &cNo fireball found in your hotbar!&r", Myau.clientName, this.getName())); + } + } + + @Override + public void onDisabled() { + this.isJumping = false; + this.tickCounter = 0; + this.jumpModeStage = 0; + this.readyToUseFireball = false; + this.fireballLaunched = false; + } + + @Override + public String[] getSuffix() { + String mode = this.mode.getModeString(); + return mode.contains("FIREBALL") ? new String[]{"Fireball"} : new String[]{CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, mode)}; + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.event.EventTarget; +import myau.events.KeyEvent; +import myau.module.Module; +import myau.util.ChatUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.MovingObjectPosition.MovingObjectType; + +public class MCF extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + + public MCF() { + super("MCF", false, true); + } + + @EventTarget + public void onKey(KeyEvent event) { + if (this.isEnabled() && event.getKey() == -98) { + if (mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectType.ENTITY && mc.objectMouseOver.entityHit instanceof EntityPlayer) { + String hitName = mc.objectMouseOver.entityHit.getName(); + if (!Myau.friendManager.isFriend(hitName)) { + Myau.friendManager.add(hitName); + ChatUtil.sendFormatted(String.format("%sAdded &o%s&r to your friend list&r", Myau.clientName, hitName)); + } else { + Myau.friendManager.remove(hitName); + ChatUtil.sendFormatted(String.format("%sRemoved &o%s&r from your friend list&r", Myau.clientName, hitName)); + } + } + } + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.events.AttackEvent; +import myau.events.TickEvent; +import myau.module.Module; +import myau.property.properties.BooleanProperty; +import myau.property.properties.ModeProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.network.play.client.C0BPacketEntityAction; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; + +public class MoreKB extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + public final ModeProperty mode = new ModeProperty("mode", 0, new String[]{"LEGIT", "LEGIT_FAST", "LESS_PACKET", "PACKET", "DOUBLE_PACKET"}); + public final BooleanProperty intelligent = new BooleanProperty("intelligent", false); + public final BooleanProperty onlyGround = new BooleanProperty("only-ground", true); + private boolean shouldSprintReset; + private EntityLivingBase target; + + public MoreKB() { + super("MoreKB", false); + this.shouldSprintReset = false; + this.target = null; + } + + @EventTarget + public void onAttack(AttackEvent event) { + if (!this.isEnabled()) { + return; + } + Entity targetEntity = event.getTarget(); + if (targetEntity != null && targetEntity instanceof EntityLivingBase) { + this.target = (EntityLivingBase) targetEntity; + } + } + + @EventTarget + public void onTick(TickEvent event) { + if (!this.isEnabled()) { + return; + } + if (this.mode.getValue() == 1) { + if (this.target != null && this.isMoving()) { + if ((this.onlyGround.getValue() && mc.thePlayer.onGround) || !this.onlyGround.getValue()) { + mc.thePlayer.sprintingTicksLeft = 0; + } + this.target = null; + } + return; + } + EntityLivingBase entity = null; + if (mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mc.objectMouseOver.entityHit instanceof EntityLivingBase) { + entity = (EntityLivingBase) mc.objectMouseOver.entityHit; + } + if (entity == null) { + return; + } + double x = mc.thePlayer.posX - entity.posX; + double z = mc.thePlayer.posZ - entity.posZ; + float calcYaw = (float) (Math.atan2(z, x) * 180.0 / Math.PI - 90.0); + float diffY = Math.abs(MathHelper.wrapAngleTo180_float(calcYaw - entity.rotationYawHead)); + if (this.intelligent.getValue() && diffY > 120.0F) { + return; + } + if (entity.hurtTime == 10) { + switch (this.mode.getValue()) { + case 0: + this.shouldSprintReset = true; + if (mc.thePlayer.isSprinting()) { + mc.thePlayer.setSprinting(false); + mc.thePlayer.setSprinting(true); + } + this.shouldSprintReset = false; + break; + case 2: + if (mc.thePlayer.isSprinting()) { + mc.thePlayer.setSprinting(false); + } + mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SPRINTING)); + mc.thePlayer.setSprinting(true); + break; + case 3: + mc.thePlayer.sendQueue.addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING)); + mc.thePlayer.sendQueue.addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SPRINTING)); + mc.thePlayer.setSprinting(true); + break; + case 4: + mc.thePlayer.sendQueue.addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING)); + mc.thePlayer.sendQueue.addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SPRINTING)); + mc.thePlayer.sendQueue.addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING)); + mc.thePlayer.sendQueue.addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SPRINTING)); + mc.thePlayer.setSprinting(true); + break; + } + } + } + + private boolean isMoving() { + return mc.thePlayer.moveForward != 0.0F || mc.thePlayer.moveStrafing != 0.0F; + } + + @Override + public String[] getSuffix() { + return new String[]{this.mode.getValue().toString()}; + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.enums.ChatColors; +import myau.event.EventTarget; +import myau.events.Render3DEvent; +import myau.mixin.IAccessorRenderManager; +import myau.module.Module; +import myau.util.ColorUtil; +import myau.util.RenderUtil; +import myau.util.TeamUtil; +import myau.property.properties.*; +import myau.property.properties.BooleanProperty; +import myau.property.properties.ModeProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.boss.EntityDragon; +import net.minecraft.entity.boss.EntityWither; +import net.minecraft.entity.monster.*; +import net.minecraft.entity.passive.EntityAnimal; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.entity.passive.EntitySquid; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.Scoreboard; +import net.minecraft.util.EnumChatFormatting; +import org.apache.commons.lang3.StringUtils; + +import java.awt.*; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.stream.Collectors; + +public class NameTags extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private static final DecimalFormat healthFormatter = new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.US)); + public final FloatProperty scale = new FloatProperty("scale", 1.0F, 0.5F, 2.0F); + public final BooleanProperty autoScale = new BooleanProperty("auto-scale", true); + public final PercentProperty backgroundOpacity = new PercentProperty("background", 25); + public final BooleanProperty shadow = new BooleanProperty("shadow", true); + public final ModeProperty distanceMode = new ModeProperty("distance", 0, new String[]{"NONE", "DEFAULT", "VAPE"}); + public final ModeProperty healthMode = new ModeProperty("health", 2, new String[]{"NONE", "HP", "HEARTS", "TAB"}); + public final BooleanProperty armor = new BooleanProperty("armor", true); + public final BooleanProperty effects = new BooleanProperty("effects", true); + public final BooleanProperty players = new BooleanProperty("players", true); + public final BooleanProperty friends = new BooleanProperty("friends", true); + public final BooleanProperty enemies = new BooleanProperty("enemies", true); + public final BooleanProperty bossees = new BooleanProperty("bosses", false); + public final BooleanProperty mobs = new BooleanProperty("mobs", false); + public final BooleanProperty creepers = new BooleanProperty("creepers", false); + public final BooleanProperty endermans = new BooleanProperty("endermen", false); + public final BooleanProperty blazes = new BooleanProperty("blazes", false); + public final BooleanProperty animals = new BooleanProperty("animals", false); + public final BooleanProperty self = new BooleanProperty("self", false); + public final BooleanProperty bots = new BooleanProperty("bots", false); + + public NameTags() { + super("NameTags", false); + } + + public boolean shouldRenderTags(EntityLivingBase entityLivingBase) { + if (entityLivingBase.deathTime > 0) { + return false; + } else if (mc.getRenderViewEntity().getDistanceToEntity(entityLivingBase) > 512.0F) { + return false; + } else if (entityLivingBase instanceof EntityPlayer) { + if (entityLivingBase != mc.thePlayer && entityLivingBase != mc.getRenderViewEntity()) { + if (TeamUtil.isBot((EntityPlayer) entityLivingBase)) { + return this.bots.getValue(); + } else if (TeamUtil.isFriend((EntityPlayer) entityLivingBase)) { + return this.friends.getValue(); + } else { + return TeamUtil.isTarget((EntityPlayer) entityLivingBase) ? this.enemies.getValue() : this.players.getValue(); + } + } else { + return this.self.getValue() && mc.gameSettings.thirdPersonView != 0; + } + } else if (entityLivingBase instanceof EntityDragon || entityLivingBase instanceof EntityWither) { + return !entityLivingBase.isInvisible() && this.bossees.getValue(); + } else if (!(entityLivingBase instanceof EntityMob) && !(entityLivingBase instanceof EntitySlime)) { + return (entityLivingBase instanceof EntityAnimal + || entityLivingBase instanceof EntityBat + || entityLivingBase instanceof EntitySquid + || entityLivingBase instanceof EntityVillager) && this.animals.getValue(); + } else if (entityLivingBase instanceof EntityCreeper) { + return this.creepers.getValue(); + } else if (entityLivingBase instanceof EntityEnderman) { + return this.endermans.getValue(); + } else { + return entityLivingBase instanceof EntityBlaze ? this.blazes.getValue() : this.mobs.getValue(); + } + } + + @EventTarget + public void onRender(Render3DEvent event) { + if (this.isEnabled()) { + for (Entity entity : TeamUtil.getLoadedEntitiesSorted()) { + if (entity instanceof EntityLivingBase + && this.shouldRenderTags((EntityLivingBase) entity) + && (entity.ignoreFrustumCheck || RenderUtil.isInViewFrustum(entity.getEntityBoundingBox(), 10.0))) { + String teamName = TeamUtil.stripName(entity); + if (!StringUtils.isBlank(EnumChatFormatting.getTextWithoutFormattingCodes(teamName))) { + double x = RenderUtil.lerpDouble(entity.posX, entity.lastTickPosX, event.getPartialTicks()) + - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosX(); + double y = RenderUtil.lerpDouble(entity.posY, entity.lastTickPosY, event.getPartialTicks()) + - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosY() + + (double) entity.getEyeHeight(); + double z = RenderUtil.lerpDouble(entity.posZ, entity.lastTickPosZ, event.getPartialTicks()) + - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosZ(); + double distance = mc.getRenderViewEntity().getDistanceToEntity(entity); + GlStateManager.pushMatrix(); + GlStateManager.translate(x, y + (entity.isSneaking() ? 0.225 : 0.4), z); + GlStateManager.rotate(mc.getRenderManager().playerViewY * -1.0F, 0.0F, 1.0F, 0.0F); + float view = mc.gameSettings.thirdPersonView == 2 ? -1.0F : 1.0F; + GlStateManager.rotate(mc.getRenderManager().playerViewX, view, 0.0F, 0.0F); + double scale = Math.pow(Math.min(Math.max(this.autoScale.getValue() ? distance : 0.0, 6.0), 128.0), 0.75) * 0.0075; + GlStateManager.scale(-scale * (double) this.scale.getValue(), -scale * (double) this.scale.getValue(), 1.0); + String distanceText = ""; + switch (this.distanceMode.getValue()) { + case 1: + distanceText = String.format("&7%dm&r ", (int) distance); + break; + case 2: + distanceText = String.format("&a[&f%d&a]&r ", (int) distance); + } + float health = ((EntityLivingBase) entity).getHealth(); + float absorption = ((EntityLivingBase) entity).getAbsorptionAmount(); + float max = ((EntityLivingBase) entity).getMaxHealth(); + float percent = Math.min(Math.max((health + absorption) / max, 0.0F), 1.0F); + String healText = ""; + switch (this.healthMode.getValue()) { + case 1: + healText = String.format(" %d%s", (int) health, absorption > 0.0F ? String.format(" &6%d&r", (int) absorption) : "&r"); + break; + case 2: + healText = String.format( + " %s%s", + healthFormatter.format((double) health / 2.0), + absorption > 0.0F ? String.format(" &6%s&r", healthFormatter.format((double) absorption / 2.0)) : "&r" + ); + break; + case 3: + if (entity instanceof EntityPlayer) { + Scoreboard scoreboard = mc.theWorld.getScoreboard(); + if (scoreboard != null) { + ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(2); + if (objective != null) { + Score score = scoreboard.getValueFromObjective(entity.getName(), objective); + if (score != null) { + healText = String.format(" &e%d&r", score.getScorePoints()); + } + } + } + } + } + String color = ChatColors.formatColor(String.format("%s&f%s&r%s", distanceText, teamName, healText)); + int width = mc.fontRendererObj.getStringWidth(color); + if (this.backgroundOpacity.getValue() > 0) { + Color textColor = !entity.isSneaking() && !entity.isInvisible() + ? new Color(0.0F, 0.0F, 0.0F, (float) this.backgroundOpacity.getValue() / 100.0F) + : new Color(0.33F, 0.0F, 0.33F, (float) this.backgroundOpacity.getValue() / 100.0F); + RenderUtil.enableRenderState(); + RenderUtil.drawRect( + (float) (-width) / 2.0F - 1.0F, + (float) (-mc.fontRendererObj.FONT_HEIGHT) - 1.0F, + (float) width / 2.0F + (this.shadow.getValue() ? 1.0F : 0.0F), + this.shadow.getValue() ? 0.0F : -1.0F, + textColor.getRGB() + ); + RenderUtil.disableRenderState(); + } + GlStateManager.disableDepth(); + mc.fontRendererObj + .drawString( + color, + (float) (-width) / 2.0F, + (float) (-mc.fontRendererObj.FONT_HEIGHT), + ColorUtil.getHealthBlend(percent).getRGB(), + this.shadow.getValue() + ); + GlStateManager.enableDepth(); + if (entity instanceof EntityPlayer) { + int height = mc.fontRendererObj.FONT_HEIGHT + 2; + if (this.armor.getValue()) { + ArrayList renderingItems = new ArrayList<>(); + for (int i = 4; i >= 0; i--) { + ItemStack itemStack; + if (i == 0) { + itemStack = ((EntityPlayer) entity).getHeldItem(); + } else { + itemStack = ((EntityPlayer) entity).inventory.armorInventory[i - 1]; + } + if (itemStack != null) { + renderingItems.add(itemStack); + } + } + if (!renderingItems.isEmpty()) { + int offset = renderingItems.size() * -8; + for (int i = 0; i < renderingItems.size(); i++) { + RenderUtil.renderItemInGUI(renderingItems.get(i), offset + i * 16, -height - 16); + } + height += 16; + } + } + if (this.effects.getValue()) { + List effects = ((EntityPlayer) entity) + .getActivePotionEffects() + .stream() + .filter(potionEffect -> Potion.potionTypes[potionEffect.getPotionID()].hasStatusIcon()) + .collect(Collectors.toList()); + if (!effects.isEmpty()) { + GlStateManager.pushMatrix(); + GlStateManager.scale(0.5F, 0.5F, 1.0F); + int offset = effects.size() * -9; + for (int i = 0; i < effects.size(); i++) { + RenderUtil.renderPotionEffect(effects.get(i), offset + i * 18, -(height * 2) - 18); + } + GlStateManager.popMatrix(); + } + } + if (TeamUtil.isFriend((EntityPlayer) entity)) { + RenderUtil.enableRenderState(); + float x1 = (float) (-width) / 2.0F - 1.0F; + view = (float) (-mc.fontRendererObj.FONT_HEIGHT) - 1.0F; + float y1 = (float) width / 2.0F + 1.0F; + float offset = this.shadow.getValue() ? 0.0F : -1.0F; + int friendColor = Myau.friendManager.getColor().getRGB(); + RenderUtil.drawOutlineRect(x1, view, y1, offset, 1.5F, 0, friendColor); + RenderUtil.disableRenderState(); + } else if (TeamUtil.isTarget((EntityPlayer) entity)) { + RenderUtil.enableRenderState(); + float x1 = (float) (-width) / 2.0F - 1.0F; + view = (float) (-mc.fontRendererObj.FONT_HEIGHT) - 1.0F; + float y1 = (float) width / 2.0F + 1.0F; + float offset = this.shadow.getValue() ? 0.0F : -1.0F; + int targetColor = Myau.targetManager.getColor().getRGB(); + RenderUtil.drawOutlineRect(x1, view, y1, offset, 1.5F, 0, targetColor); + RenderUtil.disableRenderState(); + } + } + GlStateManager.popMatrix(); + } + } + } + } + } +} + + + +package myau.module.modules; + +import myau.enums.ChatColors; +import myau.module.Module; +import myau.property.properties.BooleanProperty; +import myau.property.properties.TextProperty; +import net.minecraft.client.Minecraft; + +import java.util.regex.Matcher; + +public class NickHider extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + public final TextProperty protectName = new TextProperty("name", "You"); + public final BooleanProperty scoreboard = new BooleanProperty("scoreboard", true); + public final BooleanProperty level = new BooleanProperty("level", true); + + public NickHider() { + super("NickHider", false, true); + } + + public String replaceNick(String input) { + if (input != null && mc.thePlayer != null) { + if (this.scoreboard.getValue() && input.matches("§7\\d{2}/\\d{2}/\\d{2}(?:\\d{2})? ?§8.*")) { + input = input.replaceAll("§8", "§8§k").replaceAll("[^\\x00-\\x7F§]", "?"); + } + return input.replaceAll( + mc.thePlayer.getName(), Matcher.quoteReplacement(ChatColors.formatColor(this.protectName.getValue())) + ); + } else { + return input; + } + } +} + + + +package myau.module.modules; + +import com.google.common.base.CaseFormat; +import myau.Myau; +import myau.enums.BlinkModules; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.event.types.Priority; +import myau.events.PacketEvent; +import myau.events.TickEvent; +import myau.mixin.IAccessorC03PacketPlayer; +import myau.mixin.IAccessorMinecraft; +import myau.module.Module; +import myau.util.*; +import myau.property.properties.FloatProperty; +import myau.property.properties.ModeProperty; +import myau.property.properties.IntProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.network.Packet; +import net.minecraft.network.play.client.C03PacketPlayer; +import net.minecraft.network.play.server.S08PacketPlayerPosLook; +import net.minecraft.util.AxisAlignedBB; + +public class NoFall extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private final TimerUtil packetDelayTimer = new TimerUtil(); + private final TimerUtil scoreboardResetTimer = new TimerUtil(); + private boolean slowFalling = false; + private boolean lastOnGround = false; + public final ModeProperty mode = new ModeProperty("mode", 0, new String[]{"PACKET", "BLINK", "NO_GROUND", "SPOOF"}); + public final FloatProperty distance = new FloatProperty("distance", 3.0F, 0.0F, 20.0F); + public final IntProperty delay = new IntProperty("delay", 0, 0, 10000); + + private boolean canTrigger() { + return this.scoreboardResetTimer.hasTimeElapsed(3000) && this.packetDelayTimer.hasTimeElapsed(this.delay.getValue().longValue()); + } + + public NoFall() { + super("NoFall", false); + } + + @EventTarget(Priority.HIGH) + public void onPacket(PacketEvent event) { + if (event.getType() == EventType.RECEIVE && event.getPacket() instanceof S08PacketPlayerPosLook) { + this.onDisabled(); + } else if (this.isEnabled() && event.getType() == EventType.SEND && !event.isCancelled()) { + if (event.getPacket() instanceof C03PacketPlayer) { + C03PacketPlayer packet = (C03PacketPlayer) event.getPacket(); + switch (this.mode.getValue()) { + case 0: + if (this.slowFalling) { + this.slowFalling = false; + ((IAccessorMinecraft) mc).getTimer().timerSpeed = 1.0F; + } else if (!packet.isOnGround()) { + AxisAlignedBB aabb = mc.thePlayer.getEntityBoundingBox().expand(2.0, 0.0, 2.0); + if (PlayerUtil.canFly(this.distance.getValue()) + && !PlayerUtil.checkInWater(aabb) + && this.canTrigger()) { + this.packetDelayTimer.reset(); + this.slowFalling = true; + ((IAccessorMinecraft) mc).getTimer().timerSpeed = 0.5F; + } + } + break; + case 1: + boolean allowed = !mc.thePlayer.isOnLadder() && !mc.thePlayer.capabilities.allowFlying && mc.thePlayer.hurtTime == 0; + if (Myau.blinkManager.getBlinkingModule() != BlinkModules.NO_FALL) { + if (this.lastOnGround + && !packet.isOnGround() + && allowed + && PlayerUtil.canFly(this.distance.getValue().intValue()) + && mc.thePlayer.motionY < 0.0) { + Myau.blinkManager.setBlinkState(false, Myau.blinkManager.getBlinkingModule()); + Myau.blinkManager.setBlinkState(true, BlinkModules.NO_FALL); + } + } else if (!allowed) { + Myau.blinkManager.setBlinkState(false, BlinkModules.NO_FALL); + ChatUtil.sendFormatted(String.format("%s%s: &cFailed player check!&r", Myau.clientName, this.getName())); + } else if (PlayerUtil.checkInWater(mc.thePlayer.getEntityBoundingBox().expand(2.0, 0.0, 2.0))) { + Myau.blinkManager.setBlinkState(false, BlinkModules.NO_FALL); + ChatUtil.sendFormatted(String.format("%s%s: &cFailed void check!&r", Myau.clientName, this.getName())); + } else if (packet.isOnGround()) { + for (Packet blinkedPacket : Myau.blinkManager.blinkedPackets) { + if (blinkedPacket instanceof C03PacketPlayer) { + ((IAccessorC03PacketPlayer) blinkedPacket).setOnGround(true); + } + } + Myau.blinkManager.setBlinkState(false, BlinkModules.NO_FALL); + this.packetDelayTimer.reset(); + } + this.lastOnGround = packet.isOnGround() && allowed && this.canTrigger(); + break; + case 2: + ((IAccessorC03PacketPlayer) packet).setOnGround(false); + break; + case 3: + if (!packet.isOnGround()) { + AxisAlignedBB aabb = mc.thePlayer.getEntityBoundingBox().expand(2.0, 0.0, 2.0); + if (PlayerUtil.canFly(this.distance.getValue()) + && !PlayerUtil.checkInWater(aabb) + && this.canTrigger()) { + this.packetDelayTimer.reset(); + ((IAccessorC03PacketPlayer) packet).setOnGround(true); + mc.thePlayer.fallDistance = 0.0F; + } + } + } + } + } + } + + @EventTarget(Priority.HIGHEST) + public void onTick(TickEvent event) { + if (this.isEnabled() && event.getType() == EventType.PRE) { + if (ServerUtil.hasPlayerCountInfo()) { + this.scoreboardResetTimer.reset(); + } + if (this.mode.getValue() == 0 && this.slowFalling) { + PacketUtil.sendPacketNoEvent(new C03PacketPlayer(true)); + mc.thePlayer.fallDistance = 0.0F; + } + } + } + + @Override + public void onDisabled() { + this.lastOnGround = false; + Myau.blinkManager.setBlinkState(false, BlinkModules.NO_FALL); + if (this.slowFalling) { + this.slowFalling = false; + ((IAccessorMinecraft) mc).getTimer().timerSpeed = 1.0F; + } + } + + @Override + public void verifyValue(String mode) { + if (this.isEnabled()) { + this.onDisabled(); + } + } + + @Override + public String[] getSuffix() { + return new String[]{CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, this.mode.getModeString())}; + } +} + + + +package myau.module.modules; + +import myau.module.Module; + +public class NoHitDelay extends Module { + public NoHitDelay() { + super("NoHitDelay", true, true); + } +} + + + +package myau.module.modules; + +import myau.module.Module; +import myau.property.properties.PercentProperty; + +public class NoHurtCam extends Module { + public final PercentProperty multiplier = new PercentProperty("multiplier", 0); + + public NoHurtCam() { + super("NoHurtCam", false, true); + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.event.types.Priority; +import myau.events.TickEvent; +import myau.mixin.IAccessorEntityLivingBase; +import myau.module.Module; +import myau.property.properties.IntProperty; +import net.minecraft.client.Minecraft; + +public class NoJumpDelay extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + public final IntProperty delay = new IntProperty("delay", 3, 0, 8); + + public NoJumpDelay() { + super("NoJumpDelay", false); + } + + @EventTarget(Priority.HIGHEST) + public void onTick(TickEvent event) { + if (this.isEnabled() && event.getType() == EventType.PRE) { + ((IAccessorEntityLivingBase) mc.thePlayer) + .setJumpTicks(Math.min(((IAccessorEntityLivingBase) mc.thePlayer).getJumpTicks(), this.delay.getValue() + 1)); + } + } + + @Override + public String[] getSuffix() { + return new String[]{this.delay.getValue().toString()}; + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.LoadWorldEvent; +import myau.events.PacketEvent; +import myau.module.Module; +import myau.util.PacketUtil; +import myau.util.RandomUtil; +import myau.util.RotationUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.network.play.client.C03PacketPlayer.C06PacketPlayerPosLook; +import net.minecraft.network.play.server.S02PacketChat; +import net.minecraft.network.play.server.S08PacketPlayerPosLook; +import net.minecraft.network.play.server.S08PacketPlayerPosLook.EnumFlags; + +public class NoRotate extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private boolean reset = false; + + public NoRotate() { + super("NoRotate", false); + } + + @EventTarget + public void onPacket(PacketEvent event) { + if (this.isEnabled() && event.getType() == EventType.RECEIVE && !event.isCancelled() && mc.thePlayer != null && mc.theWorld != null) { + if (mc.thePlayer.rotationYaw != -180.0F || mc.thePlayer.rotationPitch != 0.0F) { + if (event.getPacket() instanceof S02PacketChat) { + String msg = ((S02PacketChat) event.getPacket()).getChatComponent().getFormattedText(); + if (msg.contains("§e§lProtect your bed and destroy the enemy beds.") || msg.contains("§eYou will respawn in §r§c1 §r§esecond!")) { + this.reset = true; + } + } + if (event.getPacket() instanceof S08PacketPlayerPosLook) { + if (this.reset) { + this.reset = false; + return; + } + S08PacketPlayerPosLook packet = (S08PacketPlayerPosLook) event.getPacket(); + event.setCancelled(true); + double x = packet.getX(); + double y = packet.getY(); + double z = packet.getZ(); + float yaw = packet.getYaw(); + float pitch = packet.getPitch(); + if (packet.func_179834_f().contains(EnumFlags.X)) { + x += mc.thePlayer.posX; + } else { + mc.thePlayer.motionX = 0.0; + } + if (packet.func_179834_f().contains(EnumFlags.Y)) { + y += mc.thePlayer.posY; + } else { + mc.thePlayer.motionY = 0.0; + } + if (packet.func_179834_f().contains(EnumFlags.Z)) { + z += mc.thePlayer.posZ; + } else { + mc.thePlayer.motionZ = 0.0; + } + if (packet.func_179834_f().contains(EnumFlags.X_ROT)) { + pitch += mc.thePlayer.rotationPitch; + } + if (packet.func_179834_f().contains(EnumFlags.Y_ROT)) { + yaw += mc.thePlayer.rotationYaw; + } + mc.thePlayer + .setPositionAndRotation( + x, + y, + z, + RotationUtil.quantizeAngle(mc.thePlayer.rotationYaw + RandomUtil.nextFloat(-0.01F, 0.01F)), + RotationUtil.quantizeAngle(mc.thePlayer.rotationPitch + RandomUtil.nextFloat(-0.01F, 0.01F)) + ); + PacketUtil.sendPacketNoEvent( + new C06PacketPlayerPosLook( + mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY, mc.thePlayer.posZ, yaw % 360.0F, pitch % 360.0F, false + ) + ); + } + } + } + } + + @EventTarget + public void onLoadWorld(LoadWorldEvent event) { + this.reset = false; + } + + @Override + public void onDisabled() { + this.reset = false; + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.enums.FloatModules; +import myau.event.EventTarget; +import myau.event.types.Priority; +import myau.events.LivingUpdateEvent; +import myau.events.PlayerUpdateEvent; +import myau.events.RightClickMouseEvent; +import myau.module.Module; +import myau.util.BlockUtil; +import myau.util.ItemUtil; +import myau.util.PlayerUtil; +import myau.util.TeamUtil; +import myau.property.properties.BooleanProperty; +import myau.property.properties.PercentProperty; +import myau.property.properties.ModeProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.util.BlockPos; + +public class NoSlow extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private int lastSlot = -1; + public final ModeProperty swordMode = new ModeProperty("sword-mode", 1, new String[]{"NONE", "VANILLA"}); + public final PercentProperty swordMotion = new PercentProperty("sword-motion", 100, () -> this.swordMode.getValue() != 0); + public final BooleanProperty swordSprint = new BooleanProperty("sword-sprint", true, () -> this.swordMode.getValue() != 0); + public final ModeProperty foodMode = new ModeProperty("food-mode", 0, new String[]{"NONE", "VANILLA", "FLOAT"}); + public final PercentProperty foodMotion = new PercentProperty("food-motion", 100, () -> this.foodMode.getValue() != 0); + public final BooleanProperty foodSprint = new BooleanProperty("food-sprint", true, () -> this.foodMode.getValue() != 0); + public final ModeProperty bowMode = new ModeProperty("bow-mode", 0, new String[]{"NONE", "VANILLA", "FLOAT"}); + public final PercentProperty bowMotion = new PercentProperty("bow-motion", 100, () -> this.bowMode.getValue() != 0); + public final BooleanProperty bowSprint = new BooleanProperty("bow-sprint", true, () -> this.bowMode.getValue() != 0); + + public NoSlow() { + super("NoSlow", false); + } + + public boolean isSwordActive() { + return this.swordMode.getValue() != 0 && ItemUtil.isHoldingSword(); + } + + public boolean isFoodActive() { + return this.foodMode.getValue() != 0 && ItemUtil.isEating(); + } + + public boolean isBowActive() { + return this.bowMode.getValue() != 0 && ItemUtil.isUsingBow(); + } + + public boolean isFloatMode() { + return this.foodMode.getValue() == 2 && ItemUtil.isEating() + || this.bowMode.getValue() == 2 && ItemUtil.isUsingBow(); + } + + public boolean isAnyActive() { + return mc.thePlayer.isUsingItem() && (this.isSwordActive() || this.isFoodActive() || this.isBowActive()); + } + + public boolean canSprint() { + return this.isSwordActive() && this.swordSprint.getValue() + || this.isFoodActive() && this.foodSprint.getValue() + || this.isBowActive() && this.bowSprint.getValue(); + } + + public int getMotionMultiplier() { + if (ItemUtil.isHoldingSword()) { + return this.swordMotion.getValue(); + } else if (ItemUtil.isEating()) { + return this.foodMotion.getValue(); + } else { + return ItemUtil.isUsingBow() ? this.bowMotion.getValue() : 100; + } + } + + @EventTarget + public void onLivingUpdate(LivingUpdateEvent event) { + if (this.isEnabled() && this.isAnyActive()) { + float multiplier = (float) this.getMotionMultiplier() / 100.0F; + mc.thePlayer.movementInput.moveForward *= multiplier; + mc.thePlayer.movementInput.moveStrafe *= multiplier; + if (!this.canSprint()) { + mc.thePlayer.setSprinting(false); + } + } + } + + @EventTarget(Priority.LOW) + public void onPlayerUpdate(PlayerUpdateEvent event) { + if (this.isEnabled() && this.isFloatMode()) { + int item = mc.thePlayer.inventory.currentItem; + if (this.lastSlot != item && PlayerUtil.isUsingItem()) { + this.lastSlot = item; + Myau.floatManager.setFloatState(true, FloatModules.NO_SLOW); + } + } else { + this.lastSlot = -1; + Myau.floatManager.setFloatState(false, FloatModules.NO_SLOW); + } + } + + @EventTarget + public void onRightClick(RightClickMouseEvent event) { + if (this.isEnabled()) { + if (mc.objectMouseOver != null) { + switch (mc.objectMouseOver.typeOfHit) { + case BLOCK: + BlockPos blockPos = mc.objectMouseOver.getBlockPos(); + if (BlockUtil.isInteractable(blockPos) && !PlayerUtil.isSneaking()) { + return; + } + break; + case ENTITY: + Entity entityHit = mc.objectMouseOver.entityHit; + if (entityHit instanceof EntityVillager) { + return; + } + if (entityHit instanceof EntityLivingBase && TeamUtil.isShop((EntityLivingBase) entityHit)) { + return; + } + } + } + if (this.isFloatMode() && !Myau.floatManager.isPredicted() && mc.thePlayer.onGround) { + event.setCancelled(true); + mc.thePlayer.motionY = 0.42F; + } + } + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.enums.ChatColors; +import myau.event.EventTarget; +import myau.event.types.Priority; +import myau.events.Render2DEvent; +import myau.module.Module; +import myau.property.properties.*; +import myau.util.RenderUtil; +import myau.util.TeamUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.player.EntityPlayer; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.stream.Collectors; + +public class Radar extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + public final ModeProperty colorMode = new ModeProperty("color", 0, new String[]{"DEFAULT", "TEAMS", "HUD"}); + public final IntProperty position = new IntProperty("position", 0, 0, 4); + public final IntProperty offsetX = new IntProperty("offset-x", 60, 0, 1000, () -> position.getValue() != 4); + public final IntProperty offsetY = new IntProperty("offset-y", 60, 0, 1000, () -> position.getValue() != 4); + public final IntProperty radarRadius = new IntProperty("radar-radius", 55, 10, 200); + public final FloatProperty dotRadius = new FloatProperty("dot-radius", 1.5F, 0.1F, 5.0F); + public final BooleanProperty showPlayers = new BooleanProperty("players", true); + public final BooleanProperty showFriends = new BooleanProperty("friends", true); + public final BooleanProperty showEnemies = new BooleanProperty("enemies", true); + public final BooleanProperty showBots = new BooleanProperty("bots", false); + public final BooleanProperty showPVP = new BooleanProperty("show-pvp", false); + public final ColorProperty fillColor = new ColorProperty("fill-color", Color.GRAY.getRGB()); + public final ColorProperty outlineColor = new ColorProperty("outline-color", Color.DARK_GRAY.getRGB()); + public final ColorProperty crossColor = new ColorProperty("cross-color", Color.LIGHT_GRAY.getRGB()); + public Radar() { + super("Radar", false); + } + + private boolean shouldRender(EntityPlayer entityPlayer) { + if (entityPlayer.deathTime > 0) { + return false; + } else if (mc.getRenderViewEntity().getDistanceToEntity(entityPlayer) > 512.0F) { + return false; + } else if (entityPlayer != mc.thePlayer && entityPlayer != mc.getRenderViewEntity()) { + if (TeamUtil.isBot(entityPlayer)) { + return this.showBots.getValue(); + } else if (TeamUtil.isFriend(entityPlayer)) { + return this.showFriends.getValue(); + } else { + return TeamUtil.isTarget(entityPlayer) ? this.showEnemies.getValue() : this.showPlayers.getValue(); + } + } else { + return false; + } + } + + private Color getEntityColor(EntityPlayer entityPlayer) { + if (TeamUtil.isFriend(entityPlayer)) { + Color color = Myau.friendManager.getColor(); + return new Color(color.getRed(), color.getGreen(), color.getBlue(), 255); + } else if (TeamUtil.isTarget(entityPlayer)) { + Color color = Myau.targetManager.getColor(); + return new Color(color.getRed(), color.getGreen(), color.getBlue(), 255); + } else { + switch (this.colorMode.getValue()) { + case 0: + return TeamUtil.getTeamColor(entityPlayer, 1.0F); + case 1: + int teamColor = TeamUtil.isSameTeam(entityPlayer) ? ChatColors.BLUE.toAwtColor() : ChatColors.RED.toAwtColor(); + return new Color(teamColor | 255 << 24, true); + case 2: + int color = ((HUD) Myau.moduleManager.modules.get(HUD.class)).getColor(System.currentTimeMillis()).getRGB(); + return new Color(color | 255 << 24, true); + default: + return Color.WHITE; + } + } + } + + @EventTarget(Priority.LOWEST) + public void onRender(Render2DEvent event) { + if (!this.isEnabled()) return; + + ScaledResolution sr = new ScaledResolution(mc); + HUD hud = (HUD) Myau.moduleManager.modules.get(HUD.class); + + double centerX, centerY; + if (position.getValue() == 4) { + centerX = sr.getScaledWidth() / 2.0F; + centerY = sr.getScaledHeight() / 2.0F; + } else { + centerX = (position.getValue() & 0x1) == 0x1 ? Math.max(sr.getScaledWidth() - offsetX.getValue(), 0) : Math.min(offsetX.getValue(), sr.getScaledWidth()); + centerY = (position.getValue() & 0x2) == 0x2 ? Math.max(sr.getScaledHeight() - offsetY.getValue(), 0) : Math.min(offsetY.getValue(), sr.getScaledHeight()); + } + + GlStateManager.pushMatrix(); + GlStateManager.scale(hud.scale.getValue(), hud.scale.getValue(), 1.0f); + GlStateManager.translate(centerX, centerY, 0.0f); + + RenderUtil.enableRenderState(); + + float yaw = (float)Math.toRadians(mc.thePlayer.rotationYaw); + if (mc.gameSettings.thirdPersonView != 2) { + yaw += (float)Math.toRadians(180.0F); + } + double cos = Math.cos(yaw); + double sin = Math.sin(yaw); + + Color fill = new Color(fillColor.getValue()); + this.drawRadarCircle(0.0, 0, yaw, radarRadius.getValue(), 64, new Color(fill.getRed(),fill.getGreen(),fill.getBlue(),100).getRGB(), outlineColor.getValue(), crossColor.getValue()); + for (EntityPlayer player : TeamUtil.getLoadedEntitiesSorted().stream().filter(entity -> entity instanceof EntityPlayer && this.shouldRender((EntityPlayer) entity)).map(EntityPlayer.class::cast).collect(Collectors.toList())) { + double dx = (player.lastTickPosX + (player.posX - player.lastTickPosX) * event.getPartialTicks()) - mc.thePlayer.posX; + double dz = (player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * event.getPartialTicks()) - mc.thePlayer.posZ; + + double relX = dx * cos + dz * sin; + double relY = dz * cos - dx * sin; + + double dist = Math.sqrt(relX * relX + relY * relY); + double scale = dist < radarRadius.getValue() ? 1.0F : radarRadius.getValue() / dist; + double px = relX * scale; + double py = relY * scale; + + RenderUtil.fillCircle(px, py, dotRadius.getValue(), 12, getEntityColor(player).getRGB()); + + } + if (this.showPVP.getValue()) { + double dx = - mc.thePlayer.posX; + double dz = - mc.thePlayer.posZ; + + double relX = dx * cos + dz * sin; + double relY = dz * cos - dx * sin; + + double dist = Math.sqrt(relX * relX + relY * relY); + double scale = dist < radarRadius.getValue() * 2 ? 1.0F : radarRadius.getValue() * 2 / dist; + double px = relX * scale; + double py = relY * scale; + GlStateManager.pushMatrix(); + GlStateManager.disableDepth(); + GlStateManager.enableBlend(); + GlStateManager.enableTexture2D(); + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.scale(hud.scale.getValue() / 2, hud.scale.getValue() / 2, 1.0f); + mc.fontRendererObj.drawString("PVP", + (float) (px - mc.fontRendererObj.getStringWidth("PVP") / 2.0F), + (float) (py - mc.fontRendererObj.FONT_HEIGHT / 2.0F), + Color.WHITE.getRGB(), hud.shadow.getValue()); + GlStateManager.popMatrix(); + } + RenderUtil.disableRenderState(); + GlStateManager.popMatrix(); + } + + public void drawRadarCircle(double x, double y, double angle, double radius, + int segments, + int fillColor, + int outlineColor, + int crossColor) { + + GlStateManager.enableBlend(); + GlStateManager.disableTexture2D(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + if ((fillColor >>> 24) != 0) { + RenderUtil.setColor(fillColor); + GL11.glBegin(GL11.GL_TRIANGLE_FAN); + GL11.glVertex2d(x, y); + for (int i = 0; i <= segments; i++) { + double angle1 = i * (Math.PI * 2 / segments); + GL11.glVertex2d( + x + Math.cos(angle1) * radius, + y + Math.sin(angle1) * radius + ); + } + GL11.glEnd(); + } + + if ((outlineColor >>> 24) != 0) { + RenderUtil.setColor(outlineColor); + GL11.glLineWidth(2f); + + GL11.glBegin(GL11.GL_LINE_LOOP); + for (int i = 0; i <= segments; i++) { + double angle1 = i * (Math.PI * 2 / segments); + GL11.glVertex2d( + x + Math.cos(angle1) * radius, + y + Math.sin(angle1) * radius + ); + } + GL11.glEnd(); + } + + if ((crossColor >>> 24) != 0) { + RenderUtil.setColor(crossColor); + GL11.glLineWidth(1.5f); + GL11.glBegin(GL11.GL_LINES); + + double dx1 = Math.sin(angle); + double dy1 = Math.cos(angle); + + double dx2 = Math.sin(angle + Math.PI / 2); + double dy2 = Math.cos(angle + Math.PI / 2); + + GL11.glVertex2d(x - dx1 * radius, y - dy1 * radius); + GL11.glVertex2d(x + dx1 * radius, y + dy1 * radius); + + GL11.glVertex2d(x - dx2 * radius, y - dy2 * radius); + GL11.glVertex2d(x + dx2 * radius, y + dy2 * radius); + + GL11.glEnd(); + + GlStateManager.disableDepth(); + GlStateManager.enableBlend(); + GlStateManager.enableTexture2D(); + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + HUD hud = (HUD) Myau.moduleManager.modules.get(HUD.class); + int color = hud.getColor(System.currentTimeMillis()).getRGB(); + mc.fontRendererObj.drawString("N", + (float) (x - dx1 * (radius + 5)) - mc.fontRendererObj.getStringWidth("N") / 2.0F, + (float) (y - dy1 * (radius + 5)) - mc.fontRendererObj.FONT_HEIGHT / 2.0F, + color, hud.shadow.getValue()); + mc.fontRendererObj.drawString("E", + (float) (x + dx2 * (radius + 5)) - mc.fontRendererObj.getStringWidth("E") / 2.0F, + (float) (y + dy2 * (radius + 5)) - mc.fontRendererObj.FONT_HEIGHT / 2.0F, + color, hud.shadow.getValue()); + mc.fontRendererObj.drawString("S", + (float) (x + dx1 * (radius + 5)) - mc.fontRendererObj.getStringWidth("S") / 2.0F, + (float) (y + dy1 * (radius + 5)) - mc.fontRendererObj.FONT_HEIGHT / 2.0F, + color, hud.shadow.getValue()); + mc.fontRendererObj.drawString("W", + (float) (x - dx2 * (radius + 5)) - mc.fontRendererObj.getStringWidth("W") / 2.0F, + (float) (y - dy2 * (radius + 5)) - mc.fontRendererObj.FONT_HEIGHT / 2.0F, + color, hud.shadow.getValue()); + GlStateManager.disableTexture2D(); + GlStateManager.disableBlend(); + GlStateManager.enableDepth(); + } + + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); + GlStateManager.resetColor(); + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.PickEvent; +import myau.events.RaytraceEvent; +import myau.events.TickEvent; +import myau.module.Module; +import myau.property.properties.FloatProperty; +import myau.property.properties.PercentProperty; + +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.Locale; +import java.util.Random; + +public class Reach extends Module { + private static final DecimalFormat df = new DecimalFormat("0.0#", new DecimalFormatSymbols(Locale.US)); + private final Random theRandom = new Random(); + private boolean expanding = true; + public final FloatProperty range = new FloatProperty("range", 3.1F, 3.0F, 6.0F); + public final PercentProperty chance = new PercentProperty("chance", 100); + + public Reach() { + super("Reach", false); + } + + @EventTarget + public void onPick(PickEvent event) { + if (this.isEnabled() && this.expanding) { + event.setRange(this.range.getValue().doubleValue()); + } + } + + @EventTarget + public void onRaytrace(RaytraceEvent event) { + if (this.isEnabled() && this.expanding) { + event.setRange(Math.max(event.getRange(), this.range.getValue().doubleValue() + 0.5)); + } + } + + @EventTarget + public void onTick(TickEvent event) { + if (this.isEnabled() && event.getType() == EventType.PRE) { + this.expanding = this.theRandom.nextDouble() <= (double) this.chance.getValue() / 100.0; + } + } + + @Override + public String[] getSuffix() { + return new String[]{df.format(this.range.getValue())}; + } +} + + + +package myau.module.modules; + +import com.google.common.base.CaseFormat; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.TickEvent; +import myau.module.Module; +import myau.property.properties.IntProperty; +import myau.property.properties.ModeProperty; +import myau.util.TimerUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiInventory; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemPotion; +import net.minecraft.item.ItemStack; + +public class Refill extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + public final IntProperty delay = new IntProperty("delay", 1, 0, 20); + public final ModeProperty mode = new ModeProperty("mode", 1, new String[]{"SOUP","POT"}); + private final TimerUtil time = new TimerUtil(); + + public Refill() { + super("Refill", false); + } + + @EventTarget + public void onUpdate(TickEvent event) { + if (this.isEnabled() && mc.thePlayer != null && event.getType() == EventType.PRE) { + if (mode.getValue() == 0) { + this.refill(Items.mushroom_stew); + } else if (mode.getValue() == 1) { + this.refill(ItemPotion.getItemById(373)); + } + } + } + + private void refill(Item targetItem) { + if (mc.currentScreen instanceof GuiInventory) { + if (!isHotbarFull() && this.time.hasTimeElapsed(delay.getValue() * 50)) { + for (int i = 9; i < 36; ++i) { + ItemStack itemstack = mc.thePlayer.inventoryContainer.getSlot(i).getStack(); + if (itemstack != null && itemstack.getItem() == targetItem) { + mc.playerController.windowClick(0, i, 0, 1, mc.thePlayer); + break; + } + } + this.time.reset(); + } + } + } + + public static boolean isHotbarFull() { + for (int i = 0; i <= 36; ++i) { + ItemStack itemstack = mc.thePlayer.inventory.getStackInSlot(i); + if (itemstack == null) { + return false; + } + } + return true; + } + + @Override + public String[] getSuffix() { + return new String[]{CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, this.mode.getModeString())}; + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.SafeWalkEvent; +import myau.events.UpdateEvent; +import myau.module.Module; +import myau.util.ItemUtil; +import myau.util.MoveUtil; +import myau.util.PlayerUtil; +import myau.property.properties.BooleanProperty; +import myau.property.properties.FloatProperty; +import net.minecraft.client.Minecraft; + +public class SafeWalk extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + public final FloatProperty motion = new FloatProperty("motion", 1.0F, 0.5F, 1.0F); + public final FloatProperty speedMotion = new FloatProperty("speed-motion", 1.0F, 0.5F, 1.5F); + public final BooleanProperty air = new BooleanProperty("air", false); + public final BooleanProperty directionCheck = new BooleanProperty("direction-check", true); + public final BooleanProperty pitCheck = new BooleanProperty("pitch-check", true); + public final BooleanProperty requirePress = new BooleanProperty("require-press", false); + public final BooleanProperty blocksOnly = new BooleanProperty("blocks-only", true); + + private boolean canSafeWalk() { + Scaffold scaffold = (Scaffold) Myau.moduleManager.modules.get(Scaffold.class); + if (scaffold.isEnabled()) { + return false; + } else if (this.directionCheck.getValue() && mc.gameSettings.keyBindForward.isKeyDown()) { + return false; + } else if (this.pitCheck.getValue() && mc.thePlayer.rotationPitch < 69.0F) { + return false; + } else if (this.blocksOnly.getValue() && !ItemUtil.isHoldingBlock()) { + return false; + } else { + return (!this.requirePress.getValue() || mc.gameSettings.keyBindUseItem.isKeyDown()) && (mc.thePlayer.onGround && PlayerUtil.canMove(mc.thePlayer.motionX, mc.thePlayer.motionZ, -1.0) + || this.air.getValue() && PlayerUtil.canMove(mc.thePlayer.motionX, mc.thePlayer.motionZ, -2.0)); + } + } + + public SafeWalk() { + super("SafeWalk", false); + } + + @EventTarget + public void onMove(SafeWalkEvent event) { + if (this.isEnabled()) { + if (this.canSafeWalk()) { + event.setSafeWalk(true); + } + } + } + + @EventTarget + public void onUpdate(UpdateEvent event) { + if (this.isEnabled() && event.getType() == EventType.PRE) { + if (mc.thePlayer.onGround && MoveUtil.isForwardPressed() && this.canSafeWalk()) { + if (MoveUtil.getSpeedLevel() <= 0) { + if (this.motion.getValue() != 1.0F) { + MoveUtil.setSpeed(MoveUtil.getSpeed() * (double) this.motion.getValue()); + } + } else if (this.speedMotion.getValue() != 1.0F) { + MoveUtil.setSpeed(MoveUtil.getSpeed() * (double) this.speedMotion.getValue()); + } + } + } + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.event.types.Priority; +import myau.events.*; +import myau.management.RotationState; +import myau.module.Module; +import myau.property.properties.BooleanProperty; +import myau.property.properties.ModeProperty; +import myau.property.properties.PercentProperty; +import myau.util.*; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.network.play.client.C0APacketAnimation; +import net.minecraft.potion.Potion; +import net.minecraft.util.*; +import net.minecraft.util.MovingObjectPosition.MovingObjectType; +import net.minecraft.world.WorldSettings.GameType; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.ArrayList; +import java.util.Comparator; + +public class Scaffold extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private static final double[] placeOffsets = new double[]{ + 0.03125, + 0.09375, + 0.15625, + 0.21875, + 0.28125, + 0.34375, + 0.40625, + 0.46875, + 0.53125, + 0.59375, + 0.65625, + 0.71875, + 0.78125, + 0.84375, + 0.90625, + 0.96875 + }; + private int rotationTick = 0; + private int lastSlot = -1; + private int blockCount = -1; + private float yaw = -180.0F; + private float pitch = 0.0F; + private boolean canRotate = false; + private int towerTick = 0; + private int towerDelay = 0; + private int stage = 0; + private int startY = 256; + private boolean shouldKeepY = false; + private boolean towering = false; + private EnumFacing targetFacing = null; + public final ModeProperty rotationMode = new ModeProperty("rotations", 2, new String[]{"NONE", "DEFAULT", "BACKWARDS", "SIDEWAYS"}); + public final ModeProperty moveFix = new ModeProperty("move-fix", 1, new String[]{"NONE", "SILENT"}); + public final ModeProperty sprintMode = new ModeProperty("sprint", 0, new String[]{"NONE", "VANILLA"}); + public final PercentProperty groundMotion = new PercentProperty("ground-motion", 100); + public final PercentProperty airMotion = new PercentProperty("air-motion", 100); + public final PercentProperty speedMotion = new PercentProperty("speed-motion", 100); + public final ModeProperty tower = new ModeProperty("tower", 0, new String[]{"NONE", "VANILLA", "EXTRA", "TELLY"}); + public final ModeProperty keepY = new ModeProperty("keep-y", 0, new String[]{"NONE", "VANILLA", "EXTRA", "TELLY"}); + public final BooleanProperty keepYonPress = new BooleanProperty("keep-y-on-press", false, () -> this.keepY.getValue() != 0); + public final BooleanProperty disableWhileJumpActive = new BooleanProperty("no-keep-y-on-jump-potion", false, () -> this.keepY.getValue() != 0); + public final BooleanProperty multiplace = new BooleanProperty("multi-place", true); + public final BooleanProperty safeWalk = new BooleanProperty("safe-walk", true); + public final BooleanProperty swing = new BooleanProperty("swing", true); + public final BooleanProperty itemSpoof = new BooleanProperty("item-spoof", false); + public final BooleanProperty blockCounter = new BooleanProperty("block-counter", true); + + private boolean shouldStopSprint() { + if (this.isTowering()) { + return false; + } else { + boolean stage = this.keepY.getValue() == 1 || this.keepY.getValue() == 2; + return (!stage || this.stage <= 0) && this.sprintMode.getValue() == 0; + } + } + + private boolean canPlace() { + BedNuker bedNuker = (BedNuker) Myau.moduleManager.modules.get(BedNuker.class); + if (bedNuker.isEnabled() && bedNuker.isReady()) { + return false; + } else { + LongJump longJump = (LongJump) Myau.moduleManager.modules.get(LongJump.class); + return !longJump.isEnabled() || !longJump.isAutoMode() || longJump.isJumping(); + } + } + + private EnumFacing getBestFacing(BlockPos blockPos1, BlockPos blockPos3) { + double offset = 0.0; + EnumFacing enumFacing = null; + for (EnumFacing facing : EnumFacing.VALUES) { + if (facing != EnumFacing.DOWN) { + BlockPos pos = blockPos1.offset(facing); + if (pos.getY() <= blockPos3.getY()) { + double distance = pos.distanceSqToCenter((double) blockPos3.getX() + 0.5, (double) blockPos3.getY() + 0.5, (double) blockPos3.getZ() + 0.5); + if (enumFacing == null || distance < offset || distance == offset && facing == EnumFacing.UP) { + offset = distance; + enumFacing = facing; + } + } + } + } + return enumFacing; + } + + private BlockData getBlockData() { + int startY = MathHelper.floor_double(mc.thePlayer.posY); + BlockPos targetPos = new BlockPos( + MathHelper.floor_double(mc.thePlayer.posX), + (this.stage != 0 && !this.shouldKeepY ? Math.min(startY, this.startY) : startY) - 1, + MathHelper.floor_double(mc.thePlayer.posZ) + ); + if (!BlockUtil.isReplaceable(targetPos)) { + return null; + } else { + ArrayList positions = new ArrayList<>(); + for (int x = -4; x <= 4; x++) { + for (int y = -4; y <= 0; y++) { + for (int z = -4; z <= 4; z++) { + BlockPos pos = targetPos.add(x, y, z); + if (!BlockUtil.isReplaceable(pos) + && !BlockUtil.isInteractable(pos) + && !( + mc.thePlayer.getDistance((double) pos.getX() + 0.5, (double) pos.getY() + 0.5, (double) pos.getZ() + 0.5) + > (double) mc.playerController.getBlockReachDistance() + ) + && (this.stage == 0 || this.shouldKeepY || pos.getY() < this.startY)) { + for (EnumFacing facing : EnumFacing.VALUES) { + if (facing != EnumFacing.DOWN) { + BlockPos blockPos = pos.offset(facing); + if (BlockUtil.isReplaceable(blockPos)) { + positions.add(pos); + } + } + } + } + } + } + } + if (positions.isEmpty()) { + return null; + } else { + positions.sort( + Comparator.comparingDouble( + o -> o.distanceSqToCenter((double) targetPos.getX() + 0.5, (double) targetPos.getY() + 0.5, (double) targetPos.getZ() + 0.5) + ) + ); + BlockPos blockPos = positions.get(0); + EnumFacing facing = this.getBestFacing(blockPos, targetPos); + return facing == null ? null : new BlockData(blockPos, facing); + } + } + } + + private void place(BlockPos blockPos, EnumFacing enumFacing, Vec3 vec3) { + if (ItemUtil.isHoldingBlock() && this.blockCount > 0) { + if (mc.playerController.onPlayerRightClick(mc.thePlayer, mc.theWorld, mc.thePlayer.inventory.getCurrentItem(), blockPos, enumFacing, vec3)) { + if (mc.playerController.getCurrentGameType() != GameType.CREATIVE) { + this.blockCount--; + } + if (this.swing.getValue()) { + mc.thePlayer.swingItem(); + } else { + PacketUtil.sendPacket(new C0APacketAnimation()); + } + } + } + } + + private EnumFacing yawToFacing(float yaw) { + if (yaw < -135.0F || yaw > 135.0F) { + return EnumFacing.NORTH; + } else if (yaw < -45.0F) { + return EnumFacing.EAST; + } else { + return yaw < 45.0F ? EnumFacing.SOUTH : EnumFacing.WEST; + } + } + + private double distanceToEdge(EnumFacing enumFacing) { + switch (enumFacing) { + case NORTH: + return mc.thePlayer.posZ - Math.floor(mc.thePlayer.posZ); + case EAST: + return Math.ceil(mc.thePlayer.posX) - mc.thePlayer.posX; + case SOUTH: + return Math.ceil(mc.thePlayer.posZ) - mc.thePlayer.posZ; + case WEST: + default: + return mc.thePlayer.posX - Math.floor(mc.thePlayer.posX); + } + } + + private float getSpeed() { + if (!mc.thePlayer.onGround) { + return (float) this.airMotion.getValue() / 100.0F; + } else { + return MoveUtil.getSpeedLevel() > 0 + ? (float) this.speedMotion.getValue() / 100.0F + : (float) this.groundMotion.getValue() / 100.0F; + } + } + + private double getRandomOffset() { + return 0.2155 - RandomUtil.nextDouble(1.0E-4, 9.0E-4); + } + + private float getCurrentYaw() { + return MoveUtil.adjustYaw( + mc.thePlayer.rotationYaw, (float) MoveUtil.getForwardValue(), (float) MoveUtil.getLeftValue() + ); + } + + private boolean isDiagonal(float yaw) { + float absYaw = Math.abs(yaw % 90.0F); + return absYaw > 20.0F && absYaw < 70.0F; + } + + private boolean isTowering() { + if (mc.thePlayer.onGround && MoveUtil.isForwardPressed() && !PlayerUtil.isAirAbove()) { + boolean keepY = this.keepY.getValue() == 3; + boolean tower = this.tower.getValue() == 3; + return keepY && this.stage > 0 || tower && mc.gameSettings.keyBindJump.isKeyDown(); + } else { + return false; + } + } + + public Scaffold() { + super("Scaffold", false); + } + + public int getSlot() { + return this.lastSlot; + } + + @EventTarget(Priority.HIGH) + public void onUpdate(UpdateEvent event) { + if (this.isEnabled() && event.getType() == EventType.PRE) { + if (this.rotationTick > 0) { + this.rotationTick--; + } + if (mc.thePlayer.onGround) { + if (this.stage > 0) { + this.stage--; + } + if (this.stage < 0) { + this.stage++; + } + if (this.stage == 0 + && this.keepY.getValue() != 0 + && (!(Boolean) this.keepYonPress.getValue() || PlayerUtil.isUsingItem()) + && (!this.disableWhileJumpActive.getValue() || !mc.thePlayer.isPotionActive(Potion.jump)) + && !mc.gameSettings.keyBindJump.isKeyDown()) { + this.stage = 1; + } + this.startY = this.shouldKeepY ? this.startY : MathHelper.floor_double(mc.thePlayer.posY); + this.shouldKeepY = false; + this.towering = false; + } + if (this.canPlace()) { + ItemStack stack = mc.thePlayer.getHeldItem(); + int count = ItemUtil.isBlock(stack) ? stack.stackSize : 0; + this.blockCount = Math.min(this.blockCount, count); + if (this.blockCount <= 0) { + int slot = mc.thePlayer.inventory.currentItem; + if (this.blockCount == 0) { + slot--; + } + for (int i = slot; i > slot - 9; i--) { + int hotbarSlot = (i % 9 + 9) % 9; + ItemStack candidate = mc.thePlayer.inventory.getStackInSlot(hotbarSlot); + if (ItemUtil.isBlock(candidate)) { + mc.thePlayer.inventory.currentItem = hotbarSlot; + this.blockCount = candidate.stackSize; + break; + } + } + } + float currentYaw = this.getCurrentYaw(); + float yawDiffTo180 = RotationUtil.wrapAngleDiff(currentYaw - 180.0F, event.getYaw()); + float diagonalYaw = this.isDiagonal(currentYaw) + ? yawDiffTo180 + : RotationUtil.wrapAngleDiff(currentYaw - 135.0F * ((currentYaw + 180.0F) % 90.0F < 45.0F ? 1.0F : -1.0F), event.getYaw()); + if (!this.canRotate) { + switch (this.rotationMode.getValue()) { + case 1: + if (this.yaw == -180.0F && this.pitch == 0.0F) { + this.yaw = RotationUtil.quantizeAngle(diagonalYaw); + this.pitch = RotationUtil.quantizeAngle(85.0F); + } else { + this.yaw = RotationUtil.quantizeAngle(diagonalYaw); + } + break; + case 2: + if (this.yaw == -180.0F && this.pitch == 0.0F) { + this.yaw = RotationUtil.quantizeAngle(yawDiffTo180); + this.pitch = RotationUtil.quantizeAngle(85.0F); + } else { + this.yaw = RotationUtil.quantizeAngle(yawDiffTo180); + } + break; + case 3: + if (this.yaw == -180.0F && this.pitch == 0.0F) { + this.yaw = RotationUtil.quantizeAngle(diagonalYaw); + this.pitch = RotationUtil.quantizeAngle(85.0F); + } else { + this.yaw = RotationUtil.quantizeAngle(diagonalYaw); + } + } + } + BlockData blockData = this.getBlockData(); + Vec3 hitVec = null; + if (blockData != null) { + double[] x = placeOffsets; + double[] y = placeOffsets; + double[] z = placeOffsets; + switch (blockData.facing()) { + case NORTH: + z = new double[]{0.0}; + break; + case EAST: + x = new double[]{1.0}; + break; + case SOUTH: + z = new double[]{1.0}; + break; + case WEST: + x = new double[]{0.0}; + break; + case DOWN: + y = new double[]{0.0}; + break; + case UP: + y = new double[]{1.0}; + } + float bestYaw = -180.0F; + float bestPitch = 0.0F; + float bestDiff = 0.0F; + for (double dx : x) { + for (double dy : y) { + for (double dz : z) { + double relX = (double) blockData.blockPos().getX() + dx - mc.thePlayer.posX; + double relY = (double) blockData.blockPos().getY() + dy - mc.thePlayer.posY - (double) mc.thePlayer.getEyeHeight(); + double relZ = (double) blockData.blockPos().getZ() + dz - mc.thePlayer.posZ; + float baseYaw = RotationUtil.wrapAngleDiff(this.yaw, event.getYaw()); + float[] rotations = RotationUtil.getRotationsTo(relX, relY, relZ, baseYaw, this.pitch); + MovingObjectPosition mop = RotationUtil.rayTrace(rotations[0], rotations[1], mc.playerController.getBlockReachDistance(), 1.0F); + if (mop != null + && mop.typeOfHit == MovingObjectType.BLOCK + && mop.getBlockPos().equals(blockData.blockPos()) + && mop.sideHit == blockData.facing()) { + float totalDiff = Math.abs(rotations[0] - baseYaw) + Math.abs(rotations[1] - this.pitch); + if (bestYaw == -180.0F && bestPitch == 0.0F || totalDiff < bestDiff) { + bestYaw = rotations[0]; + bestPitch = rotations[1]; + bestDiff = totalDiff; + hitVec = mop.hitVec; + } + } + } + } + } + if (bestYaw != -180.0F || bestPitch != 0.0F) { + this.yaw = bestYaw; + this.pitch = bestPitch; + this.canRotate = true; + } + } + if (this.canRotate && MoveUtil.isForwardPressed() && Math.abs(MathHelper.wrapAngleTo180_float(yawDiffTo180 - this.yaw)) < 90.0F) { + switch (this.rotationMode.getValue()) { + case 2: + this.yaw = RotationUtil.quantizeAngle(yawDiffTo180); + break; + case 3: + this.yaw = RotationUtil.quantizeAngle(diagonalYaw); + } + } + if (this.rotationMode.getValue() != 0) { + float targetYaw = this.yaw; + float targetPitch = this.pitch; + if (this.towering && (mc.thePlayer.motionY > 0.0 || mc.thePlayer.posY > (double) (this.startY + 1))) { + float yawDiff = MathHelper.wrapAngleTo180_float(this.yaw - event.getYaw()); + float tolerance = this.rotationTick >= 2 ? RandomUtil.nextFloat(90.0F, 95.0F) : RandomUtil.nextFloat(30.0F, 35.0F); + if (Math.abs(yawDiff) > tolerance) { + float clampedYaw = RotationUtil.clampAngle(yawDiff, tolerance); + targetYaw = RotationUtil.quantizeAngle(event.getYaw() + clampedYaw); + this.rotationTick = Math.max(this.rotationTick, 1); + } + } + if (this.isTowering()) { + float yawDelta = MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw - event.getYaw()); + targetYaw = RotationUtil.quantizeAngle(event.getYaw() + yawDelta * RandomUtil.nextFloat(0.98F, 0.99F)); + targetPitch = RotationUtil.quantizeAngle(RandomUtil.nextFloat(30.0F, 80.0F)); + this.rotationTick = 3; + this.towering = true; + } + event.setRotation(targetYaw, targetPitch, 3); + if (this.moveFix.getValue() == 1) { + event.setPervRotation(targetYaw, 3); + } + } + if (blockData != null && hitVec != null && this.rotationTick <= 0) { + this.place(blockData.blockPos(), blockData.facing(), hitVec); + if (this.multiplace.getValue()) { + for (int i = 0; i < 3; i++) { + blockData = this.getBlockData(); + if (blockData == null) { + break; + } + MovingObjectPosition mop = RotationUtil.rayTrace(this.yaw, this.pitch, mc.playerController.getBlockReachDistance(), 1.0F); + if (mop != null + && mop.typeOfHit == MovingObjectType.BLOCK + && mop.getBlockPos().equals(blockData.blockPos()) + && mop.sideHit == blockData.facing()) { + this.place(blockData.blockPos(), blockData.facing(), mop.hitVec); + } else { + hitVec = BlockUtil.getClickVec(blockData.blockPos(), blockData.facing()); + double dx = hitVec.xCoord - mc.thePlayer.posX; + double dy = hitVec.yCoord - mc.thePlayer.posY - (double) mc.thePlayer.getEyeHeight(); + double dz = hitVec.zCoord - mc.thePlayer.posZ; + float[] rotations = RotationUtil.getRotationsTo(dx, dy, dz, event.getYaw(), event.getPitch()); + if (!(Math.abs(rotations[0] - this.yaw) < 120.0F) || !(Math.abs(rotations[1] - this.pitch) < 60.0F)) { + break; + } + mop = RotationUtil.rayTrace(rotations[0], rotations[1], mc.playerController.getBlockReachDistance(), 1.0F); + if (mop == null + || mop.typeOfHit != MovingObjectType.BLOCK + || !mop.getBlockPos().equals(blockData.blockPos()) + || mop.sideHit != blockData.facing()) { + break; + } + this.place(blockData.blockPos(), blockData.facing(), mop.hitVec); + } + } + } + } + if (this.targetFacing != null) { + if (this.rotationTick <= 0) { + int playerBlockX = MathHelper.floor_double(mc.thePlayer.posX); + int playerBlockY = MathHelper.floor_double(mc.thePlayer.posY); + int playerBlockZ = MathHelper.floor_double(mc.thePlayer.posZ); + BlockPos belowPlayer = new BlockPos(playerBlockX, playerBlockY - 1, playerBlockZ); + hitVec = BlockUtil.getHitVec(belowPlayer, this.targetFacing, this.yaw, this.pitch); + this.place(belowPlayer, this.targetFacing, hitVec); + } + this.targetFacing = null; + } else if (this.keepY.getValue() == 2 && this.stage > 0 && !mc.thePlayer.onGround) { + int nextBlockY = MathHelper.floor_double(mc.thePlayer.posY + mc.thePlayer.motionY); + if (nextBlockY <= this.startY && mc.thePlayer.posY > (double) (this.startY + 1)) { + this.shouldKeepY = true; + blockData = this.getBlockData(); + if (blockData != null && this.rotationTick <= 0) { + hitVec = BlockUtil.getHitVec(blockData.blockPos(), blockData.facing(), this.yaw, this.pitch); + this.place(blockData.blockPos(), blockData.facing(), hitVec); + } + } + } + } + } + } + + @EventTarget + public void onStrafe(StrafeEvent event) { + if (this.isEnabled()) { + if (!mc.thePlayer.isCollidedHorizontally + && mc.thePlayer.hurtTime <= 5 + && !mc.thePlayer.isPotionActive(Potion.jump) + && mc.gameSettings.keyBindJump.isKeyDown() + && ItemUtil.isHoldingBlock()) { + int yState = (int) (mc.thePlayer.posY % 1.0 * 100.0); + switch (this.tower.getValue()) { + case 1: + switch (this.towerTick) { + case 0: + if (mc.thePlayer.onGround) { + this.towerTick = 1; + mc.thePlayer.motionY = -0.0784000015258789; + } + return; + case 1: + if (yState == 0 && PlayerUtil.isAirBelow()) { + this.startY = MathHelper.floor_double(mc.thePlayer.posY); + this.towerTick = 2; + mc.thePlayer.motionY = 0.42F; + if (MoveUtil.isForwardPressed()) { + MoveUtil.setSpeed(MoveUtil.getSpeed(), MoveUtil.getMoveYaw()); + } else { + MoveUtil.setSpeed(0.0); + event.setForward(0.0F); + event.setStrafe(0.0F); + } + return; + } else { + this.towerTick = 0; + return; + } + case 2: + this.towerTick = 3; + mc.thePlayer.motionY = 0.75 - mc.thePlayer.posY % 1.0; + return; + case 3: + this.towerTick = 1; + mc.thePlayer.motionY = 1.0 - mc.thePlayer.posY % 1.0; + return; + default: + this.towerTick = 0; + return; + } + case 2: + switch (this.towerTick) { + case 0: + if (mc.thePlayer.onGround) { + this.towerTick = 1; + mc.thePlayer.motionY = -0.0784000015258789; + } + return; + case 1: + if (yState == 0 && PlayerUtil.isAirBelow()) { + this.startY = MathHelper.floor_double(mc.thePlayer.posY); + if (!MoveUtil.isForwardPressed()) { + this.towerDelay = 2; + MoveUtil.setSpeed(0.0); + event.setForward(0.0F); + event.setStrafe(0.0F); + EnumFacing facing = this.yawToFacing(MathHelper.wrapAngleTo180_float(this.yaw - 180.0F)); + double distance = this.distanceToEdge(facing); + if (distance > 0.1) { + if (mc.thePlayer.onGround) { + Vec3i directionVec = facing.getDirectionVec(); + double offset = Math.min(this.getRandomOffset(), distance - 0.05); + double jitter = RandomUtil.nextDouble(0.02, 0.03); + AxisAlignedBB nextBox = mc.thePlayer + .getEntityBoundingBox() + .offset((double) directionVec.getX() * (offset - jitter), 0.0, (double) directionVec.getZ() * (offset - jitter)); + if (mc.theWorld.getCollidingBoundingBoxes(mc.thePlayer, nextBox).isEmpty()) { + mc.thePlayer.motionY = -0.0784000015258789; + mc.thePlayer + .setPosition(nextBox.minX + (nextBox.maxX - nextBox.minX) / 2.0, nextBox.minY, nextBox.minZ + (nextBox.maxZ - nextBox.minZ) / 2.0); + } + return; + } + } else { + this.towerTick = 2; + this.targetFacing = facing; + mc.thePlayer.motionY = 0.42F; + } + return; + } else { + this.towerTick = 2; + this.towerDelay++; + mc.thePlayer.motionY = 0.42F; + MoveUtil.setSpeed(MoveUtil.getSpeed(), MoveUtil.getMoveYaw()); + return; + } + } else { + this.towerTick = 0; + this.towerDelay = 0; + return; + } + case 2: + this.towerTick = 3; + mc.thePlayer.motionY = mc.thePlayer.motionY - RandomUtil.nextDouble(0.00101, 0.00109); + return; + case 3: + if (this.towerDelay >= 4) { + this.towerTick = 4; + this.towerDelay = 0; + } else { + this.towerTick = 1; + mc.thePlayer.motionY = 1.0 - mc.thePlayer.posY % 1.0; + } + return; + case 4: + this.towerTick = 5; + return; + case 5: + if (!PlayerUtil.isAirBelow()) { + this.towerTick = 0; + } else { + this.towerTick = 1; + mc.thePlayer.motionY -= 0.08; + mc.thePlayer.motionY *= 0.98F; + mc.thePlayer.motionY -= 0.08; + mc.thePlayer.motionY *= 0.98F; + } + return; + default: + this.towerTick = 0; + this.towerDelay = 0; + return; + } + default: + this.towerTick = 0; + this.towerDelay = 0; + } + } else { + this.towerTick = 0; + this.towerDelay = 0; + } + } + } + + @EventTarget + public void onMoveInput(MoveInputEvent event) { + if (this.isEnabled()) { + if (this.moveFix.getValue() == 1 + && RotationState.isActived() + && RotationState.getPriority() == 3.0F + && MoveUtil.isForwardPressed()) { + MoveUtil.fixStrafe(RotationState.getSmoothedYaw()); + } + if (mc.thePlayer.onGround && this.stage > 0 && MoveUtil.isForwardPressed()) { + mc.thePlayer.movementInput.jump = true; + } + } + } + + @EventTarget + public void onLivingUpdate(LivingUpdateEvent event) { + if (this.isEnabled()) { + float speed = this.getSpeed(); + if (speed != 1.0F) { + if (mc.thePlayer.movementInput.moveForward != 0.0F && mc.thePlayer.movementInput.moveStrafe != 0.0F) { + mc.thePlayer.movementInput.moveForward = mc.thePlayer.movementInput.moveForward * (1.0F / (float) Math.sqrt(2.0)); + mc.thePlayer.movementInput.moveStrafe = mc.thePlayer.movementInput.moveStrafe * (1.0F / (float) Math.sqrt(2.0)); + } + mc.thePlayer.movementInput.moveForward *= speed; + mc.thePlayer.movementInput.moveStrafe *= speed; + } + if (this.shouldStopSprint()) { + mc.thePlayer.setSprinting(false); + } + } + } + + @EventTarget + public void onSafeWalk(SafeWalkEvent event) { + if (this.isEnabled() && this.safeWalk.getValue()) { + if (mc.thePlayer.onGround && mc.thePlayer.motionY <= 0.0 && PlayerUtil.canMove(mc.thePlayer.motionX, mc.thePlayer.motionZ, -1.0)) { + event.setSafeWalk(true); + } + } + } + + @EventTarget + public void onRender(Render2DEvent event) { + if (this.isEnabled()) { + if (this.blockCounter.getValue()) { + int count = 0; + for (int i = 0; i < 9; i++) { + ItemStack stack = mc.thePlayer.inventory.getStackInSlot(i); + if (stack != null && stack.stackSize > 0) { + Item item = stack.getItem(); + if (item instanceof ItemBlock) { + Block block = ((ItemBlock) item).getBlock(); + if (!BlockUtil.isInteractable(block) && BlockUtil.isSolid(block)) { + count += stack.stackSize; + } + } + } + } + HUD hud = (HUD) Myau.moduleManager.modules.get(HUD.class); + float scale = hud.scale.getValue(); + GlStateManager.pushMatrix(); + GlStateManager.scale(scale, scale, 0.0F); + GlStateManager.disableDepth(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + mc.fontRendererObj + .drawString( + String.format("%d block%s left", count, count != 1 ? "s" : ""), + ((float) new ScaledResolution(mc).getScaledWidth() / 2.0F + (float) mc.fontRendererObj.FONT_HEIGHT * 1.5F) / scale, + (float) new ScaledResolution(mc).getScaledHeight() / 2.0F / scale - (float) mc.fontRendererObj.FONT_HEIGHT / 2.0F + 1.0F, + (count > 0 ? Color.WHITE.getRGB() : new Color(255, 85, 85).getRGB()) | -1090519040, + hud.shadow.getValue() + ); + GlStateManager.disableBlend(); + GlStateManager.enableDepth(); + GlStateManager.popMatrix(); + } + } + } + + @EventTarget + public void onLeftClick(LeftClickMouseEvent event) { + if (this.isEnabled()) { + event.setCancelled(true); + } + } + + @EventTarget + public void onRightClick(RightClickMouseEvent event) { + if (this.isEnabled()) { + event.setCancelled(true); + } + } + + @EventTarget + public void onHitBlock(HitBlockEvent event) { + if (this.isEnabled()) { + event.setCancelled(true); + } + } + + @EventTarget + public void onSwap(SwapItemEvent event) { + if (this.isEnabled()) { + this.lastSlot = event.setSlot(this.lastSlot); + event.setCancelled(true); + } + } + + @Override + public void onEnabled() { + if (mc.thePlayer != null) { + this.lastSlot = mc.thePlayer.inventory.currentItem; + } else { + this.lastSlot = -1; + } + this.blockCount = -1; + this.rotationTick = 3; + this.yaw = -180.0F; + this.pitch = 0.0F; + this.canRotate = false; + this.towerTick = 0; + this.towerDelay = 0; + this.towering = false; + } + + @Override + public void onDisabled() { + if (mc.thePlayer != null && this.lastSlot != -1) { + mc.thePlayer.inventory.currentItem = this.lastSlot; + } + } + + public static class BlockData { + private final BlockPos blockPos; + private final EnumFacing facing; + + public BlockData(BlockPos blockPos, EnumFacing enumFacing) { + this.blockPos = blockPos; + this.facing = enumFacing; + } + + public BlockPos blockPos() { + return this.blockPos; + } + + public EnumFacing facing() { + return this.facing; + } + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.events.Render2DEvent; +import myau.module.Module; +import myau.util.TimerUtil; +import myau.property.properties.FloatProperty; +import myau.property.properties.IntProperty; +import myau.property.properties.TextProperty; +import net.minecraft.client.Minecraft; + +public class Spammer extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private final TimerUtil timer = new TimerUtil(); + private int charOffset = 19968; + public final TextProperty text = new TextProperty("text", "meow"); + public final FloatProperty delay = new FloatProperty("delay", 3.5F, 0.0F, 3600.0F); + public final IntProperty random = new IntProperty("random", 0, 0, 10); + + public Spammer() { + super("Spammer", false); + } + + @EventTarget + public void onRender(Render2DEvent event) { + if (this.isEnabled()) { + if (this.timer.hasTimeElapsed((long) (this.delay.getValue() * 1000.0F))) { + this.timer.reset(); + String text = this.text.getValue(); + if (this.random.getValue() > 0) { + text = String.format("%s ", text); + for (int i = 0; i < this.random.getValue(); i++) { + text = String.format("%s%s", text, (char) this.charOffset); + this.charOffset++; + if (this.charOffset > 40959) { + this.charOffset = 19968; + } + } + } + mc.thePlayer.sendChatMessage(text); + } + } + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.event.EventTarget; +import myau.event.types.Priority; +import myau.events.LivingUpdateEvent; +import myau.events.StrafeEvent; +import myau.mixin.IAccessorEntity; +import myau.module.Module; +import myau.util.MoveUtil; +import myau.property.properties.FloatProperty; +import myau.property.properties.PercentProperty; +import net.minecraft.client.Minecraft; + +public class Speed extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + public final FloatProperty multiplier = new FloatProperty("multiplier", 1.0F, 0.0F, 10.0F); + public final FloatProperty friction = new FloatProperty("friction", 1.0F, 0.0F, 10.0F); + public final PercentProperty strafe = new PercentProperty("strafe", 0); + + private boolean canBoost() { + Scaffold scaffold = (Scaffold) Myau.moduleManager.modules.get(Scaffold.class); + return !scaffold.isEnabled() && MoveUtil.isForwardPressed() + && mc.thePlayer.getFoodStats().getFoodLevel() > 6 + && !mc.thePlayer.isSneaking() + && !mc.thePlayer.isInWater() + && !mc.thePlayer.isInLava() + && !((IAccessorEntity) mc.thePlayer).getIsInWeb(); + } + + public Speed() { + super("Speed", false); + } + + @EventTarget(Priority.LOW) + public void onStrafe(StrafeEvent event) { + if (this.isEnabled() && this.canBoost()) { + if (mc.thePlayer.onGround) { + mc.thePlayer.motionY = 0.42F; + MoveUtil.setSpeed( + MoveUtil.getJumpMotion() * (double) this.multiplier.getValue().floatValue(), + MoveUtil.getMoveYaw() + ); + } else { + if (this.friction.getValue() != 1.0F) { + event.setFriction(event.getFriction() * this.friction.getValue()); + } + if (this.strafe.getValue() > 0) { + double speed = MoveUtil.getSpeed(); + MoveUtil.setSpeed(speed * (double) ((float) (100 - this.strafe.getValue()) / 100.0F), MoveUtil.getDirectionYaw()); + MoveUtil.addSpeed( + speed * (double) ((float) this.strafe.getValue().intValue() / 100.0F), MoveUtil.getMoveYaw() + ); + MoveUtil.setSpeed(speed); + } + } + } + } + + @EventTarget(Priority.LOW) + public void onLivingUpdate(LivingUpdateEvent event) { + if (this.isEnabled() && this.canBoost()) { + mc.thePlayer.movementInput.jump = false; + } + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.TickEvent; +import myau.mixin.IAccessorPlayerControllerMP; +import myau.module.Module; +import myau.property.properties.IntProperty; +import myau.property.properties.PercentProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.util.MovingObjectPosition.MovingObjectType; + +public class SpeedMine extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + public final PercentProperty speed = new PercentProperty("speed", 15); + public final IntProperty delay = new IntProperty("delay", 0, 0, 4); + + public SpeedMine() { + super("SpeedMine", false); + } + + @EventTarget + public void onTick(TickEvent event) { + if (this.isEnabled() && event.getType() == EventType.PRE) { + if (!mc.playerController.isInCreativeMode()) { + if (mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == MovingObjectType.BLOCK) { + ((IAccessorPlayerControllerMP) mc.playerController) + .setBlockHitDelay(Math.min(((IAccessorPlayerControllerMP) mc.playerController).getBlockHitDelay(), this.delay.getValue() + 1)); + if (((IAccessorPlayerControllerMP) mc.playerController).getIsHittingBlock()) { + float curBlockDamageMP = ((IAccessorPlayerControllerMP) mc.playerController).getCurBlockDamageMP(); + float damage = 0.3F * (this.speed.getValue().floatValue() / 100.0F); + if (curBlockDamageMP < damage) { + ((IAccessorPlayerControllerMP) mc.playerController).setCurBlockDamageMP(damage); + } + } + } + } + } + } + + @Override + public String[] getSuffix() { + return new String[]{String.format("%d%%", this.speed.getValue())}; + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.events.TickEvent; +import myau.mixin.IAccessorEntityLivingBase; +import myau.module.Module; +import myau.util.KeyBindUtil; +import myau.property.properties.BooleanProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.entity.ai.attributes.IAttributeInstance; + +public class Sprint extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private boolean wasSprinting = false; + public final BooleanProperty foxFix = new BooleanProperty("fov-fix", true); + + public Sprint() { + super("Sprint", true, true); + } + + public boolean shouldApplyFovFix(IAttributeInstance attribute) { + if (!this.foxFix.getValue()) { + return false; + } else { + AttributeModifier attributeModifier = ((IAccessorEntityLivingBase) mc.thePlayer).getSprintingSpeedBoostModifier(); + return attribute.getModifier(attributeModifier.getID()) == null && this.wasSprinting; + } + } + + public boolean shouldKeepFov(boolean boolean2) { + return this.foxFix.getValue() && !boolean2 && this.wasSprinting; + } + + @EventTarget + public void onTick(TickEvent event) { + if (this.isEnabled()) { + switch (event.getType()) { + case PRE: + KeyBindUtil.setKeyBindState(mc.gameSettings.keyBindSprint.getKeyCode(), true); + break; + case POST: + this.wasSprinting = mc.thePlayer.isSprinting(); + } + } + } + + @Override + public void onDisabled() { + this.wasSprinting = false; + KeyBindUtil.updateKeyState(mc.gameSettings.keyBindSprint.getKeyCode()); + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.enums.ChatColors; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.PacketEvent; +import myau.events.Render2DEvent; +import myau.module.Module; +import myau.util.ColorUtil; +import myau.util.RenderUtil; +import myau.util.TeamUtil; +import myau.util.TimerUtil; +import myau.property.properties.*; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiChat; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.network.play.client.C02PacketUseEntity; +import net.minecraft.network.play.client.C02PacketUseEntity.Action; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.Locale; + +public class TargetHUD extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private static final DecimalFormat healthFormat = new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.US)); + private static final DecimalFormat diffFormat = new DecimalFormat("+0.0;-0.0", new DecimalFormatSymbols(Locale.US)); + private final TimerUtil lastAttackTimer = new TimerUtil(); + private final TimerUtil animTimer = new TimerUtil(); + private EntityLivingBase lastTarget = null; + private EntityLivingBase target = null; + private ResourceLocation headTexture = null; + private float oldHealth = 0.0F; + private float newHealth = 0.0F; + private float maxHealth = 0.0F; + public final ModeProperty color = new ModeProperty("color", 0, new String[]{"DEFAULT", "HUD"}); + public final ModeProperty posX = new ModeProperty("position-x", 1, new String[]{"LEFT", "MIDDLE", "RIGHT"}); + public final ModeProperty posY = new ModeProperty("position-y", 1, new String[]{"TOP", "MIDDLE", "BOTTOM"}); + public final FloatProperty scale = new FloatProperty("scale", 1.0F, 0.5F, 1.5F); + public final IntProperty offX = new IntProperty("offset-x", 0, -255, 255); + public final IntProperty offY = new IntProperty("offset-y", 40, -255, 255); + public final PercentProperty background = new PercentProperty("background", 25); + public final BooleanProperty head = new BooleanProperty("head", true); + public final BooleanProperty indicator = new BooleanProperty("indicator", true); + public final BooleanProperty outline = new BooleanProperty("outline", false); + public final BooleanProperty animations = new BooleanProperty("animations", true); + public final BooleanProperty shadow = new BooleanProperty("shadow", true); + public final BooleanProperty kaOnly = new BooleanProperty("ka-only", true); + public final BooleanProperty chatPreview = new BooleanProperty("chat-preview", false); + + private EntityLivingBase resolveTarget() { + KillAura killAura = (KillAura) Myau.moduleManager.modules.get(KillAura.class); + if (killAura.isEnabled() && killAura.isAttackAllowed() && TeamUtil.isEntityLoaded(killAura.getTarget())) { + return killAura.getTarget(); + } else if (!(Boolean) this.kaOnly.getValue() + && !this.lastAttackTimer.hasTimeElapsed(1500L) + && TeamUtil.isEntityLoaded(this.lastTarget)) { + return this.lastTarget; + } else { + return this.chatPreview.getValue() && mc.currentScreen instanceof GuiChat ? mc.thePlayer : null; + } + } + + private ResourceLocation getSkin(EntityLivingBase entityLivingBase) { + if (entityLivingBase instanceof EntityPlayer) { + NetworkPlayerInfo playerInfo = mc.getNetHandler().getPlayerInfo(entityLivingBase.getName()); + if (playerInfo != null) { + return playerInfo.getLocationSkin(); + } + } + return null; + } + + private Color getTargetColor(EntityLivingBase entityLivingBase) { + if (entityLivingBase instanceof EntityPlayer) { + if (TeamUtil.isFriend((EntityPlayer) entityLivingBase)) { + return Myau.friendManager.getColor(); + } + if (TeamUtil.isTarget((EntityPlayer) entityLivingBase)) { + return Myau.targetManager.getColor(); + } + } + switch (this.color.getValue()) { + case 0: + if (!(entityLivingBase instanceof EntityPlayer)) { + return new Color(-1); + } + return TeamUtil.getTeamColor((EntityPlayer) entityLivingBase, 1.0F); + case 1: + int rgb = ((HUD) Myau.moduleManager.modules.get(HUD.class)).getColor(System.currentTimeMillis()).getRGB(); + return new Color(rgb); + default: + return new Color(-1); + } + } + + public TargetHUD() { + super("TargetHUD", false, true); + } + + @EventTarget + public void onRender(Render2DEvent event) { + if (this.isEnabled() && mc.thePlayer != null) { + EntityLivingBase entityLivingBase = this.target; + this.target = this.resolveTarget(); + if (this.target != null) { + float health = (mc.thePlayer.getHealth() + mc.thePlayer.getAbsorptionAmount()) / 2.0F; + float abs = this.target.getAbsorptionAmount() / 2.0F; + float heal = this.target.getHealth() / 2.0F + abs; + if (this.target != entityLivingBase) { + this.headTexture = null; + this.animTimer.setTime(); + this.oldHealth = heal; + this.newHealth = heal; + } + if (!this.animations.getValue() || this.animTimer.hasTimeElapsed(150L)) { + this.oldHealth = this.newHealth; + this.newHealth = heal; + this.maxHealth = this.target.getMaxHealth() / 2.0F; + if (this.oldHealth != this.newHealth) { + this.animTimer.reset(); + } + } + ResourceLocation resourceLocation = this.getSkin(this.target); + if (resourceLocation != null) { + this.headTexture = resourceLocation; + } + float elapsedTime = (float) Math.min(Math.max(this.animTimer.getElapsedTime(), 0L), 150L); + float healthRatio = Math.min(Math.max(RenderUtil.lerpFloat(this.newHealth, this.oldHealth, elapsedTime / 150.0F) / this.maxHealth, 0.0F), 1.0F); + Color targetColor = this.getTargetColor(this.target); + Color healthBarColor = this.color.getValue() == 0 ? ColorUtil.getHealthBlend(healthRatio) : targetColor; + float healthDeltaRatio = Math.min(Math.max((health - heal + 1.0F) / 2.0F, 0.0F), 1.0F); + Color healthDeltaColor = ColorUtil.getHealthBlend(healthDeltaRatio); + ScaledResolution scaledResolution = new ScaledResolution(mc); + String targetNameText = ChatColors.formatColor(String.format("&r%s&r", TeamUtil.stripName(this.target))); + int targetNameWidth = mc.fontRendererObj.getStringWidth(targetNameText); + String healthText = ChatColors.formatColor( + String.format("&r&f%s%s❤&r", healthFormat.format(heal), abs > 0.0F ? "&6" : "&c") + ); + int healthTextWidth = mc.fontRendererObj.getStringWidth(healthText); + String statusText = ChatColors.formatColor(String.format("&r&l%s&r", heal == health ? "D" : (heal < health ? "W" : "L"))); + int statusTextWidth = mc.fontRendererObj.getStringWidth(statusText); + String healthDiffText = ChatColors.formatColor( + String.format("&r%s&r", heal == health ? "0.0" : diffFormat.format(health - heal)) + ); + int healthDiffWidth = mc.fontRendererObj.getStringWidth(healthDiffText); + float barContentWidth = Math.max( + (float) targetNameWidth + (this.indicator.getValue() ? 2.0F + (float) statusTextWidth + 2.0F : 0.0F), + (float) healthTextWidth + (this.indicator.getValue() ? 2.0F + (float) healthDiffWidth + 2.0F : 0.0F) + ); + float headIconOffset = this.head.getValue() && this.headTexture != null ? 25.0F : 0.0F; + float barTotalWidth = Math.max(headIconOffset + 70.0F, headIconOffset + 2.0F + barContentWidth + 2.0F); + float posX = this.offX.getValue().floatValue() / this.scale.getValue(); + switch (this.posX.getValue()) { + case 1: + posX += (float) scaledResolution.getScaledWidth() / this.scale.getValue() / 2.0F - barTotalWidth / 2.0F; + break; + case 2: + posX *= -1.0F; + posX += (float) scaledResolution.getScaledWidth() / this.scale.getValue() - barTotalWidth; + } + float posY = this.offY.getValue().floatValue() / this.scale.getValue(); + switch (this.posY.getValue()) { + case 1: + posY += (float) scaledResolution.getScaledHeight() / this.scale.getValue() / 2.0F - 13.5F; + break; + case 2: + posY *= -1.0F; + posY += (float) scaledResolution.getScaledHeight() / this.scale.getValue() - 27.0F; + } + GlStateManager.pushMatrix(); + GlStateManager.scale(this.scale.getValue(), this.scale.getValue(), 0.0F); + GlStateManager.translate(posX, posY, -450.0F); + RenderUtil.enableRenderState(); + int backgroundColor = new Color(0.0F, 0.0F, 0.0F, (float) this.background.getValue() / 100.0F).getRGB(); + int outlineColor = this.outline.getValue() ? targetColor.getRGB() : new Color(0, 0, 0, 0).getRGB(); + RenderUtil.drawOutlineRect(0.0F, 0.0F, barTotalWidth, 27.0F, 1.5F, backgroundColor, outlineColor); + RenderUtil.drawRect(headIconOffset + 2.0F, 22.0F, barTotalWidth - 2.0F, 25.0F, ColorUtil.darker(healthBarColor, 0.2F).getRGB()); + RenderUtil.drawRect(headIconOffset + 2.0F, 22.0F, headIconOffset + 2.0F + healthRatio * (barTotalWidth - 2.0F - headIconOffset - 2.0F), 25.0F, healthBarColor.getRGB()); + RenderUtil.disableRenderState(); + GlStateManager.disableDepth(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + mc.fontRendererObj.drawString(targetNameText, headIconOffset + 2.0F, 2.0F, -1, this.shadow.getValue()); + mc.fontRendererObj.drawString(healthText, headIconOffset + 2.0F, 12.0F, -1, this.shadow.getValue()); + if (this.indicator.getValue()) { + mc.fontRendererObj.drawString(statusText, barTotalWidth - 2.0F - (float) statusTextWidth, 2.0F, healthDeltaColor.getRGB(), this.shadow.getValue()); + mc.fontRendererObj.drawString(healthDiffText, barTotalWidth - 2.0F - (float) healthDiffWidth, 12.0F, ColorUtil.darker(healthDeltaColor, 0.8F).getRGB(), this.shadow.getValue()); + } + if (this.head.getValue() && this.headTexture != null) { + GlStateManager.color(1.0F, 1.0F, 1.0F); + mc.getTextureManager().bindTexture(this.headTexture); + Gui.drawScaledCustomSizeModalRect(2, 2, 8.0F, 8.0F, 8, 8, 23, 23, 64.0F, 64.0F); + Gui.drawScaledCustomSizeModalRect(2, 2, 40.0F, 8.0F, 8, 8, 23, 23, 64.0F, 64.0F); + GlStateManager.color(1.0F, 1.0F, 1.0F); + } + GlStateManager.disableBlend(); + GlStateManager.enableDepth(); + GlStateManager.popMatrix(); + } + } + } + + @EventTarget + public void onPacket(PacketEvent event) { + if (event.getType() == EventType.SEND && event.getPacket() instanceof C02PacketUseEntity) { + C02PacketUseEntity packet = (C02PacketUseEntity) event.getPacket(); + if (packet.getAction() != Action.ATTACK) { + return; + } + Entity entity = packet.getEntityFromWorld(mc.theWorld); + if (entity instanceof EntityLivingBase) { + if (entity instanceof EntityArmorStand) { + return; + } + this.lastAttackTimer.reset(); + this.lastTarget = (EntityLivingBase) entity; + } + } + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.event.types.Priority; +import myau.events.Render3DEvent; +import myau.events.StrafeEvent; +import myau.events.UpdateEvent; +import myau.module.Module; +import myau.util.*; +import myau.property.properties.*; +import myau.property.properties.BooleanProperty; +import myau.property.properties.ModeProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.AxisAlignedBB; + +import java.awt.*; +import java.util.ArrayList; + +public class TargetStrafe extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private EntityLivingBase target = null; + private float targetYaw = Float.NaN; + private int direction = 1; + public final FloatProperty radius = new FloatProperty("radius", 1.0F, 0.0F, 6.0F); + public final IntProperty points = new IntProperty("points", 6, 3, 24); + public final BooleanProperty requirePress = new BooleanProperty("require-press", true); + public final BooleanProperty speedOnly = new BooleanProperty("speed-only", true); + public final ModeProperty showTarget = new ModeProperty("show-target", 1, new String[]{"NONE", "DEFAULT", "HUD"}); + + private boolean canStrafe() { + if (this.speedOnly.getValue()) { + Speed speed = (Speed) Myau.moduleManager.modules.get(Speed.class); + Fly fly = (Fly) Myau.moduleManager.modules.get(Fly.class); + LongJump longJump = (LongJump) Myau.moduleManager.modules.get(LongJump.class); + if (!speed.isEnabled() && !fly.isEnabled() && (!longJump.isEnabled() || !longJump.isJumping())) { + return false; + } + } + return !this.requirePress.getValue() || PlayerUtil.isJumping(); + } + + private EntityLivingBase getKillAuraTarget() { + KillAura killAura = (KillAura) Myau.moduleManager.modules.get(KillAura.class); + if (killAura.isEnabled() && killAura.isAttackAllowed()) { + EntityLivingBase entityLivingBase = killAura.getTarget(); + return !TeamUtil.isEntityLoaded(entityLivingBase) ? null : entityLivingBase; + } else { + return null; + } + } + + private Color getTargetColor(EntityLivingBase entityLivingBase) { + if (entityLivingBase instanceof EntityPlayer) { + if (TeamUtil.isFriend((EntityPlayer) entityLivingBase)) { + return Myau.friendManager.getColor(); + } + if (TeamUtil.isTarget((EntityPlayer) entityLivingBase)) { + return Myau.targetManager.getColor(); + } + } + switch (this.showTarget.getValue()) { + case 1: + if (!(entityLivingBase instanceof EntityPlayer)) { + return Color.WHITE; + } + return TeamUtil.getTeamColor((EntityPlayer) entityLivingBase, 1.0F); + case 2: + int color = ((HUD) Myau.moduleManager.modules.get(HUD.class)).getColor(System.currentTimeMillis()).getRGB(); + return new Color(color); + default: + return new Color(-1); + } + } + + private boolean isInWater(double x, double z) { + return PlayerUtil.checkInWater( + new AxisAlignedBB(x - 0.015, mc.thePlayer.posY, z - 0.015, x + 0.015, mc.thePlayer.posY + (double) mc.thePlayer.height, z + 0.015) + ); + } + + private int wrapIndex(int index, int size) { + if (index < 0) { + return size - 1; + } else { + return index >= size ? 0 : index; + } + } + + public TargetStrafe() { + super("TargetStrafe", false); + } + + public float getTargetYaw() { + return this.targetYaw; + } + + @EventTarget(Priority.HIGHEST) + public void onUpdate(UpdateEvent event) { + if (this.isEnabled() && event.getType() == EventType.PRE) { + boolean left = PlayerUtil.isMovingLeft(); + boolean right = PlayerUtil.isMovingRight(); + if (left ^ right) { + this.direction = left ? 1 : -1; + } + if (!this.canStrafe()) { + this.target = null; + this.targetYaw = Float.NaN; + } else { + this.target = this.getKillAuraTarget(); + if (this.target == null) { + this.targetYaw = Float.NaN; + } else { + ArrayList vpositions = new ArrayList<>(); + for (int i = 0; i < this.points.getValue(); i++) { + vpositions.add( + new Vec2d( + (double) this.radius.getValue() + * Math.cos((double) i * ((Math.PI * 2) / (double) this.points.getValue())), + (double) this.radius.getValue() + * Math.sin((double) i * ((Math.PI * 2) / (double) this.points.getValue())) + ) + ); + } + if (vpositions.isEmpty()) { + this.target = null; + this.targetYaw = Float.NaN; + } else { + double closestDistance = 0.0; + int closestIndex = -1; + for (int i = 0; i < vpositions.size(); i++) { + double distance = mc.thePlayer + .getDistance( + this.target.posX + (vpositions.get(i)).getX(), mc.thePlayer.posY, this.target.posZ + (vpositions.get(i)).getY() + ); + if (closestIndex == -1 || distance < closestDistance) { + closestDistance = distance; + closestIndex = i; + } + } + if (mc.thePlayer.isCollidedHorizontally) { + this.direction *= -1; + } + int nextIndex = closestIndex + this.direction; + nextIndex = this.wrapIndex(nextIndex, vpositions.size()); + double nextX = this.target.posX + (vpositions.get(nextIndex)).getX(); + double nextZ = this.target.posZ + (vpositions.get(nextIndex)).getY(); + if (this.isInWater(nextX, nextZ)) { + this.direction *= -1; + nextIndex = closestIndex + this.direction; + nextIndex = this.wrapIndex(nextIndex, vpositions.size()); + nextX = this.target.posX + (vpositions.get(nextIndex)).getX(); + nextZ = this.target.posZ + (vpositions.get(nextIndex)).getY(); + } + double deltaX = nextX - mc.thePlayer.posX; + double deltaZ = nextZ - mc.thePlayer.posZ; + float currentPitch = event.getPitch(); + float currentYaw = event.getYaw(); + double deltaY = 0.0; + this.targetYaw = RotationUtil.getRotationsTo(deltaX, deltaY, deltaZ, currentYaw, currentPitch)[0]; + event.setPervRotation(this.targetYaw, 10); + } + } + } + } + } + + @EventTarget + public void onStrafe(StrafeEvent event) { + if (this.isEnabled()) { + if (!Float.isNaN(this.targetYaw) && MoveUtil.isForwardPressed()) { + event.setStrafe(0.0F); + event.setForward(1.0F); + } + } + } + + @EventTarget + public void onRender(Render3DEvent event) { + if (this.isEnabled() && TeamUtil.isEntityLoaded(this.target)) { + if (this.showTarget.getValue() != 0) { + Color color = this.getTargetColor(this.target); + RenderUtil.enableRenderState(); + RenderUtil.drawEntityCircle( + this.target, this.radius.getValue(), this.points.getValue(), ColorUtil.darker(color, 0.2F).getRGB() + ); + RenderUtil.drawEntityCircle(this.target, this.radius.getValue(), this.points.getValue(), color.getRGB()); + RenderUtil.disableRenderState(); + } + } + } + + @Override + public void onDisabled() { + this.target = null; + this.targetYaw = Float.NaN; + } + + public static class Vec2d { + private final double x; + private final double y; + + public Vec2d(double x, double y) { + this.x = x; + this.y = y; + } + + public double getX() { + return this.x; + } + + public double getY() { + return this.y; + } + } +} + + + +package myau.module.modules; + +import myau.Myau; +import myau.enums.ChatColors; +import myau.event.EventTarget; +import myau.events.Render2DEvent; +import myau.events.Render3DEvent; +import myau.mixin.IAccessorMinecraft; +import myau.module.Module; +import myau.util.RenderUtil; +import myau.util.RotationUtil; +import myau.util.TeamUtil; +import myau.property.properties.BooleanProperty; +import myau.property.properties.PercentProperty; +import myau.property.properties.ModeProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.MathHelper; +import net.minecraft.util.Vec3; + +import java.awt.*; +import java.util.stream.Collectors; + +public class Tracers extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + public final ModeProperty colorMode = new ModeProperty("color", 0, new String[]{"DEFAULT", "TEAMS", "HUD"}); + public final BooleanProperty drawLines = new BooleanProperty("lines", true); + public final BooleanProperty drawArrows = new BooleanProperty("arrows", false); + public final PercentProperty opacity = new PercentProperty("opacity", 100); + public final BooleanProperty showPlayers = new BooleanProperty("players", true); + public final BooleanProperty showFriends = new BooleanProperty("friends", true); + public final BooleanProperty showEnemies = new BooleanProperty("enemies", true); + public final BooleanProperty showBots = new BooleanProperty("bots", false); + + private boolean shouldRender(EntityPlayer entityPlayer) { + if (entityPlayer.deathTime > 0) { + return false; + } else if (mc.getRenderViewEntity().getDistanceToEntity(entityPlayer) > 512.0F) { + return false; + } else if (entityPlayer != mc.thePlayer && entityPlayer != mc.getRenderViewEntity()) { + if (TeamUtil.isBot(entityPlayer)) { + return this.showBots.getValue(); + } else if (TeamUtil.isFriend(entityPlayer)) { + return this.showFriends.getValue(); + } else { + return TeamUtil.isTarget(entityPlayer) ? this.showEnemies.getValue() : this.showPlayers.getValue(); + } + } else { + return false; + } + } + + private Color getEntityColor(EntityPlayer entityPlayer, float alpha) { + if (TeamUtil.isFriend(entityPlayer)) { + Color color = Myau.friendManager.getColor(); + return new Color((float) color.getRed() / 255.0F, (float) color.getGreen() / 255.0F, (float) color.getBlue() / 255.0F, alpha); + } else if (TeamUtil.isTarget(entityPlayer)) { + Color color = Myau.targetManager.getColor(); + return new Color((float) color.getRed() / 255.0F, (float) color.getGreen() / 255.0F, (float) color.getBlue() / 255.0F, alpha); + } else { + switch (this.colorMode.getValue()) { + case 0: + return TeamUtil.getTeamColor(entityPlayer, alpha); + case 1: + int teamColor = TeamUtil.isSameTeam(entityPlayer) ? ChatColors.BLUE.toAwtColor() : ChatColors.RED.toAwtColor(); + return new Color(teamColor & Color.WHITE.getRGB() | (int) (alpha * 255.0F) << 24, true); + case 2: + int color = ((HUD) Myau.moduleManager.modules.get(HUD.class)).getColor(System.currentTimeMillis()).getRGB(); + return new Color(color & Color.WHITE.getRGB() | (int) (alpha * 255.0F) << 24, true); + default: + return new Color(1.0F, 1.0F, 1.0F, alpha); + } + } + } + + public Tracers() { + super("Tracers", false); + } + + @EventTarget + public void onRender3D(Render3DEvent event) { + if (this.isEnabled() && this.drawLines.getValue()) { + RenderUtil.enableRenderState(); + Vec3 position; + if (mc.gameSettings.thirdPersonView == 0) { + position = new Vec3(0.0, 0.0, 1.0) + .rotatePitch( + (float) ( + -Math.toRadians( + RenderUtil.lerpFloat( + mc.getRenderViewEntity().rotationPitch, + mc.getRenderViewEntity().prevRotationPitch, + ((IAccessorMinecraft) mc).getTimer().renderPartialTicks + ) + ) + ) + ) + .rotateYaw( + (float) ( + -Math.toRadians( + RenderUtil.lerpFloat( + mc.getRenderViewEntity().rotationYaw, + mc.getRenderViewEntity().prevRotationYaw, + ((IAccessorMinecraft) mc).getTimer().renderPartialTicks + ) + ) + ) + ); + } else { + position = new Vec3(0.0, 0.0, 0.0) + .rotatePitch( + (float) ( + -Math.toRadians( + RenderUtil.lerpFloat( + mc.thePlayer.cameraPitch, mc.thePlayer.prevCameraPitch, ((IAccessorMinecraft) mc).getTimer().renderPartialTicks + ) + ) + ) + ) + .rotateYaw( + (float) ( + -Math.toRadians( + RenderUtil.lerpFloat(mc.thePlayer.cameraYaw, mc.thePlayer.prevCameraYaw, ((IAccessorMinecraft) mc).getTimer().renderPartialTicks) + ) + ) + ); + } + position = new Vec3(position.xCoord, position.yCoord + (double) mc.getRenderViewEntity().getEyeHeight(), position.zCoord); + for (EntityPlayer player : TeamUtil.getLoadedEntitiesSorted().stream().filter(entity -> entity instanceof EntityPlayer && this.shouldRender((EntityPlayer) entity)).map(EntityPlayer.class::cast).collect(Collectors.toList())) { + Color color = this.getEntityColor(player, (float) this.opacity.getValue() / 100.0F); + double x = RenderUtil.lerpDouble(player.posX, player.lastTickPosX, event.getPartialTicks()); + double y = RenderUtil.lerpDouble(player.posY, player.lastTickPosY, event.getPartialTicks()) - (player.isSneaking() ? 0.125 : 0.0); + double z = RenderUtil.lerpDouble(player.posZ, player.lastTickPosZ, event.getPartialTicks()); + RenderUtil.drawLine3D( + position, + x, + y + (double) player.getEyeHeight(), + z, + (float) color.getRed() / 255.0F, + (float) color.getGreen() / 255.0F, + (float) color.getBlue() / 255.0F, + (float) color.getAlpha() / 255.0F, + 1.5F + ); + } + RenderUtil.disableRenderState(); + } + } + + @EventTarget + public void onRender(Render2DEvent event) { + if (this.isEnabled() && this.drawArrows.getValue()) { + for (EntityPlayer player : TeamUtil.getLoadedEntitiesSorted().stream().filter(entity -> entity instanceof EntityPlayer && this.shouldRender((EntityPlayer) entity)).map(EntityPlayer.class::cast).collect(Collectors.toList())) { + float yawBetween = RotationUtil.getYawBetween( + RenderUtil.lerpDouble(mc.thePlayer.posX, mc.thePlayer.prevPosX, event.getPartialTicks()), + RenderUtil.lerpDouble(mc.thePlayer.posZ, mc.thePlayer.prevPosZ, event.getPartialTicks()), + RenderUtil.lerpDouble(player.posX, player.prevPosX, event.getPartialTicks()), + RenderUtil.lerpDouble(player.posZ, player.prevPosZ, event.getPartialTicks()) + ); + if (mc.gameSettings.thirdPersonView == 2) { + yawBetween += 180.0F; + } + float arrowDirX = (float) Math.sin(Math.toRadians(yawBetween)); + float arrowDirY = (float) Math.cos(Math.toRadians(yawBetween)) * -1.0F; + float opacity = this.opacity.getValue().floatValue() / 100.0F; + yawBetween = Math.abs(MathHelper.wrapAngleTo180_float(yawBetween)); + if (yawBetween < 30.0F) { + opacity = 0.0F; + } else if (yawBetween < 60.0F) { + opacity *= (yawBetween - 30.0F) / 30.0F; + } + HUD hud = (HUD) Myau.moduleManager.modules.get(HUD.class); + GlStateManager.pushMatrix(); + GlStateManager.scale(hud.scale.getValue(), hud.scale.getValue(), 0.0F); + GlStateManager.translate( + (float) new ScaledResolution(mc).getScaledWidth() / 2.0F / hud.scale.getValue(), + (float) new ScaledResolution(mc).getScaledHeight() / 2.0F / hud.scale.getValue(), + 0.0F + ); + GlStateManager.pushMatrix(); + GlStateManager.translate(55.0F * arrowDirX + 1.0F, 55.0F * arrowDirY + 1.0F, -100.0F); + RenderUtil.enableRenderState(); + RenderUtil.drawTriangle( + 0.0F, + 0.0F, + (float) (Math.atan2(arrowDirY, arrowDirX) + Math.PI), + 10.0F, + this.getEntityColor(player, opacity).getRGB() + ); + RenderUtil.disableRenderState(); + GlStateManager.popMatrix(); + GlStateManager.popMatrix(); + } + } + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.events.Render3DEvent; +import myau.mixin.IAccessorRenderManager; +import myau.module.Module; +import myau.util.RenderUtil; +import myau.property.properties.BooleanProperty; +import myau.property.properties.PercentProperty; +import net.minecraft.block.material.Material; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.Entity; +import net.minecraft.item.*; +import net.minecraft.util.*; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.ArrayList; + +public class Trajectories extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + public final PercentProperty opacity = new PercentProperty("opacity", 100); + public final BooleanProperty bow = new BooleanProperty("bow", true); + public final BooleanProperty projectiles = new BooleanProperty("projectiles", false); + public final BooleanProperty pearls = new BooleanProperty("pearls", true); + + public Trajectories() { + super("Trajectories", false, true); + } + + @EventTarget + public void onRender3D(Render3DEvent event) { + if (this.isEnabled() && mc.thePlayer.getHeldItem() != null && mc.gameSettings.thirdPersonView == 0) { + Item item = mc.thePlayer.getHeldItem().getItem(); + RenderManager renderManager = mc.getRenderManager(); + boolean isBow = false; + float velocityMultiplier = 1.5F; + float drag = 0.99F; + float gravity; + float hitboxExpand; + if (item instanceof ItemBow && this.bow.getValue()) { + if (!mc.thePlayer.isUsingItem()) { + return; + } + isBow = true; + gravity = 0.05F; + hitboxExpand = 0.3F; + float charge = (float) mc.thePlayer.getItemInUseDuration() / 20.0F; + charge = (charge * charge + charge * 2.0F) / 3.0F; + if (charge < 0.1F) { + return; + } + if (charge > 1.0F) { + charge = 1.0F; + } + velocityMultiplier = charge * 3.0F; + } else if (item instanceof ItemFishingRod && this.projectiles.getValue()) { + gravity = 0.04F; + hitboxExpand = 0.25F; + drag = 0.92F; + } else if ((item instanceof ItemSnowball || item instanceof ItemEgg) && this.projectiles.getValue()) { + gravity = 0.03F; + hitboxExpand = 0.25F; + } else { + if (!(item instanceof ItemEnderPearl) || !this.pearls.getValue()) { + return; + } + gravity = 0.03F; + hitboxExpand = 0.25F; + } + float yaw = mc.thePlayer.rotationYaw; + float pitch = mc.thePlayer.rotationPitch; + double x = ((IAccessorRenderManager) renderManager).getRenderPosX() - (double) MathHelper.cos(yaw / 180.0F * (float) Math.PI) * 0.16; + double y = ((IAccessorRenderManager) renderManager).getRenderPosY() + (double) mc.thePlayer.getEyeHeight() - 0.1F; + double z = ((IAccessorRenderManager) renderManager).getRenderPosZ() - (double) MathHelper.sin(yaw / 180.0F * (float) Math.PI) * 0.16; + double mx = (double) (MathHelper.sin(yaw / 180.0F * (float) Math.PI) * MathHelper.cos(pitch / 180.0F * (float) Math.PI)) + * (isBow ? 1.0 : 0.4) + * -1.0; + double my = (double) MathHelper.sin(pitch / 180.0F * (float) Math.PI) * (isBow ? 1.0 : 0.4) * -1.0; + double mz = (double) (MathHelper.cos(yaw / 180.0F * (float) Math.PI) * MathHelper.cos(pitch / 180.0F * (float) Math.PI)) * (isBow ? 1.0 : 0.4); + float mag = MathHelper.sqrt_double(mx * mx + my * my + mz * mz); + mx /= mag; + my /= mag; + mz /= mag; + mx *= velocityMultiplier; + my *= velocityMultiplier; + mz *= velocityMultiplier; + MovingObjectPosition mop = null; + boolean hasHitBlock = false; + boolean hasHitEntity = false; + WorldRenderer worldRenderer = Tessellator.getInstance().getWorldRenderer(); + ArrayList trajectoryPoints = new ArrayList<>(); + while (!hasHitBlock && y > 0.0) { + Vec3 start = new Vec3(x, y, z); + Vec3 end = new Vec3(x + mx, y + my, z + mz); + mop = mc.theWorld.rayTraceBlocks(start, end, false, true, false); + start = new Vec3(x, y, z); + end = new Vec3(x + mx, y + my, z + mz); + if (mop != null) { + hasHitBlock = true; + end = new Vec3(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord); + } + AxisAlignedBB aabb = new AxisAlignedBB( + x - (double) hitboxExpand, + y - (double) hitboxExpand, + z - (double) hitboxExpand, + x + (double) hitboxExpand, + y + (double) hitboxExpand, + z + (double) hitboxExpand + ) + .addCoord(mx, my, mz) + .expand(1.0, 1.0, 1.0); + int minChunkX = MathHelper.floor_double((aabb.minX - 2.0) / 16.0); + int maxChunkX = MathHelper.floor_double((aabb.maxX + 2.0) / 16.0); + int minChunkZ = MathHelper.floor_double((aabb.minZ - 2.0) / 16.0); + int maxChunkZ = MathHelper.floor_double((aabb.maxZ + 2.0) / 16.0); + ArrayList possibleEntities = new ArrayList<>(); + for (int x1 = minChunkX; x1 <= maxChunkX; ++x1) { + for (int z1 = minChunkZ; z1 <= maxChunkZ; ++z1) { + mc.theWorld.getChunkFromChunkCoords(x1, z1).getEntitiesWithinAABBForEntity(mc.thePlayer, aabb, possibleEntities, null); + } + } + for (Entity entity : possibleEntities) { + if (entity.canBeCollidedWith() && entity != mc.thePlayer) { + AxisAlignedBB entityBox = entity.getEntityBoundingBox().expand(hitboxExpand, hitboxExpand, hitboxExpand); + MovingObjectPosition intercept = entityBox.calculateIntercept(start, end); + if (intercept != null) { + hasHitEntity = true; + hasHitBlock = true; + mop = intercept; + } + } + } + x += mx; + y += my; + z += mz; + if (mc.theWorld.getBlockState(new BlockPos(x, y, z)).getBlock().getMaterial() == Material.water) { + mx *= 0.6; + my *= 0.6; + mz *= 0.6; + } else { + mx *= drag; + my *= drag; + mz *= drag; + } + my -= gravity; + trajectoryPoints.add( + new Vec3( + x - ((IAccessorRenderManager) renderManager).getRenderPosX(), + y - ((IAccessorRenderManager) renderManager).getRenderPosY(), + z - ((IAccessorRenderManager) renderManager).getRenderPosZ() + ) + ); + } + if (trajectoryPoints.size() > 1) { + RenderUtil.enableRenderState(); + RenderUtil.setColor(new Color(hasHitEntity ? 85 : 255, 255, hasHitEntity ? 85 : 255, (int) (this.opacity.getValue().floatValue() / 100.0F * 255.0F)).getRGB()); + GL11.glLineWidth(1.5F); + GL11.glEnable(GL11.GL_LINE_SMOOTH); + GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); + worldRenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION); + trajectoryPoints.forEach(vec3 -> worldRenderer.pos(vec3.xCoord, vec3.yCoord, vec3.zCoord).endVertex()); + Tessellator.getInstance().draw(); + GlStateManager.pushMatrix(); + GlStateManager.translate( + x - ((IAccessorRenderManager) renderManager).getRenderPosX(), + y - ((IAccessorRenderManager) renderManager).getRenderPosY(), + z - ((IAccessorRenderManager) renderManager).getRenderPosZ() + ); + if (mop != null) { + switch (mop.sideHit.getAxis().ordinal()) { + case 0: + GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); + break; + case 1: + GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); + } + RenderUtil.drawLine( + -0.25F, + -0.25F, + 0.25F, + 0.25F, + 1.5F, + new Color(hasHitEntity ? 85 : 255, 255, hasHitEntity ? 85 : 255, (int) (this.opacity.getValue().floatValue() / 100.0F * 255.0F)).getRGB() + ); + RenderUtil.drawLine( + -0.25F, + 0.25F, + 0.25F, + -0.25F, + 1.5F, + new Color(hasHitEntity ? 85 : 255, 255, hasHitEntity ? 85 : 255, (int) (this.opacity.getValue().floatValue() / 100.0F * 255.0F)).getRGB() + ); + } + GlStateManager.popMatrix(); + GL11.glDisable(GL11.GL_LINE_SMOOTH); + GL11.glLineWidth(2.0F); + GlStateManager.resetColor(); + RenderUtil.disableRenderState(); + } + } + } +} + + + +package myau.module.modules; + +import com.google.common.base.CaseFormat; +import myau.Myau; +import myau.enums.DelayModules; +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.*; +import myau.mixin.IAccessorEntity; +import myau.module.Module; +import myau.property.properties.BooleanProperty; +import myau.property.properties.IntProperty; +import myau.property.properties.ModeProperty; +import myau.property.properties.PercentProperty; +import myau.util.ChatUtil; +import myau.util.MoveUtil; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.network.play.server.S12PacketEntityVelocity; +import net.minecraft.network.play.server.S19PacketEntityStatus; +import net.minecraft.network.play.server.S27PacketExplosion; +import net.minecraft.potion.Potion; + +public class Velocity extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + + private int chanceCounter = 0; + private int delayChanceCounter = 0; + private boolean pendingExplosion = false; + private boolean allowNext = true; + private boolean jumpFlag = false; + private boolean reverseFlag = false; + private boolean delayActive = false; + + private boolean shouldJump = false; + private int jumpCooldown = 0; + + public final ModeProperty mode = new ModeProperty("mode", 0, new String[]{"VANILLA", "JUMP", "DELAY", "REVERSE", "LEGIT_TEST"}); + public final IntProperty delayTicks = new IntProperty("delay-ticks", 3, 1, 20, () -> this.mode.getValue() == 2); + public final PercentProperty delayChance = new PercentProperty("delay-chance", 100, () -> this.mode.getValue() == 2); + public final PercentProperty chance = new PercentProperty("chance", 100); + public final PercentProperty horizontal = new PercentProperty("horizontal", 0); + public final PercentProperty vertical = new PercentProperty("vertical", 100); + public final PercentProperty explosionHorizontal = new PercentProperty("explosions-horizontal", 100); + public final PercentProperty explosionVertical = new PercentProperty("explosions-vertical", 100); + public final BooleanProperty fakeCheck = new BooleanProperty("fake-check", true); + public final BooleanProperty debugLog = new BooleanProperty("debug-log", false); + + private boolean isInLiquidOrWeb() { + return mc.thePlayer.isInWater() || mc.thePlayer.isInLava() || ((IAccessorEntity) mc.thePlayer).getIsInWeb(); + } + + private boolean canDelay() { + KillAura killAura = (KillAura) Myau.moduleManager.modules.get(KillAura.class); + return mc.thePlayer.onGround && (!killAura.isEnabled() || !killAura.shouldAutoBlock()); + } + + public Velocity() { + super("Velocity", false); + } + + @EventTarget + public void onKnockback(KnockbackEvent event) { + if (!this.isEnabled() || event.isCancelled()) { + this.pendingExplosion = false; + this.allowNext = true; + } else if (!this.allowNext || !(Boolean) this.fakeCheck.getValue()) { + this.allowNext = true; + if (this.pendingExplosion) { + this.pendingExplosion = false; + if (this.explosionHorizontal.getValue() > 0) { + event.setX(event.getX() * (double) this.explosionHorizontal.getValue() / 100.0); + event.setZ(event.getZ() * (double) this.explosionHorizontal.getValue() / 100.0); + } else { + event.setX(mc.thePlayer.motionX); + event.setZ(mc.thePlayer.motionZ); + } + if (this.explosionVertical.getValue() > 0) { + event.setY(event.getY() * (double) this.explosionVertical.getValue() / 100.0); + } else { + event.setY(mc.thePlayer.motionY); + } + } else { + this.chanceCounter = this.chanceCounter % 100 + this.chance.getValue(); + if (this.chanceCounter >= 100) { + this.jumpFlag = (this.mode.getValue() == 1 || this.mode.getValue() == 2) && event.getY() > 0.0; + this.delayActive = this.mode.getValue() == 3; + if (this.horizontal.getValue() > 0) { + event.setX(event.getX() * (double) this.horizontal.getValue() / 100.0); + event.setZ(event.getZ() * (double) this.horizontal.getValue() / 100.0); + } else { + event.setX(mc.thePlayer.motionX); + event.setZ(mc.thePlayer.motionZ); + } + if (this.vertical.getValue() > 0) { + event.setY(event.getY() * (double) this.vertical.getValue() / 100.0); + } else { + event.setY(mc.thePlayer.motionY); + } + } + } + } + } + + @EventTarget + public void onUpdate(UpdateEvent event) { + if (event.getType() == EventType.POST) { + if (this.reverseFlag + && ( + this.canDelay() + || this.isInLiquidOrWeb() + || Myau.delayManager.getDelay() >= (long) this.delayTicks.getValue() + )) { + Myau.delayManager.setDelayState(false, DelayModules.VELOCITY); + this.reverseFlag = false; + } + if (this.delayActive) { + MoveUtil.setSpeed(MoveUtil.getSpeed(), MoveUtil.getMoveYaw()); + this.delayActive = false; + } + + if (this.mode.getValue() == 4) { + int hurtTime = mc.thePlayer.hurtTime; + + if (hurtTime >= 8) { + if (jumpCooldown <= 0) { + shouldJump = true; + jumpCooldown = 2; + } + } else if (hurtTime <= 1) { + shouldJump = false; + jumpCooldown = 0; + } + + if (shouldJump && mc.thePlayer.onGround && jumpCooldown <= 0) { + mc.thePlayer.jump(); + shouldJump = false; + } + + if (jumpCooldown > 0) { + jumpCooldown--; + } + } + } + } + + @EventTarget + public void onLivingUpdate(LivingUpdateEvent event) { + if (this.jumpFlag) { + this.jumpFlag = false; + if (mc.thePlayer.onGround && mc.thePlayer.isSprinting() && !mc.thePlayer.isPotionActive(Potion.jump) && !this.isInLiquidOrWeb()) { + mc.thePlayer.movementInput.jump = true; + } + } + } + + @EventTarget + public void onPacket(PacketEvent event) { + if (this.isEnabled() && event.getType() == EventType.RECEIVE && !event.isCancelled()) { + if (event.getPacket() instanceof S12PacketEntityVelocity) { + S12PacketEntityVelocity packet = (S12PacketEntityVelocity) event.getPacket(); + if (packet.getEntityID() == mc.thePlayer.getEntityId()) { + LongJump longJump = (LongJump) Myau.moduleManager.modules.get(LongJump.class); + if (this.mode.getValue() == 2 + && !this.reverseFlag + && !this.canDelay() + && !this.isInLiquidOrWeb() + && !this.pendingExplosion + && (!this.allowNext || !(Boolean) this.fakeCheck.getValue()) + && (!longJump.isEnabled() || !longJump.canStartJump())) { + this.delayChanceCounter = this.delayChanceCounter % 100 + this.delayChance.getValue(); + if (this.delayChanceCounter >= 100) { + Myau.delayManager.setDelayState(true, DelayModules.VELOCITY); + Myau.delayManager.delayedPacket.offer(packet); + event.setCancelled(true); + this.reverseFlag = true; + return; + } + } + if (this.debugLog.getValue()) { + ChatUtil.sendFormatted( + String.format( + "%sVelocity (&otick: %d, x: %.2f, y: %.2f, z: %.2f&r)&r", + Myau.clientName, + mc.thePlayer.ticksExisted, + (double) packet.getMotionX() / 8000.0, + (double) packet.getMotionY() / 8000.0, + (double) packet.getMotionZ() / 8000.0 + ) + ); + } + } + } else if (!(event.getPacket() instanceof S27PacketExplosion)) { + if (event.getPacket() instanceof S19PacketEntityStatus) { + S19PacketEntityStatus packet = (S19PacketEntityStatus) event.getPacket(); + Entity entity = packet.getEntity(mc.theWorld); + if (entity != null && entity.equals(mc.thePlayer) && packet.getOpCode() == 2) { + this.allowNext = false; + } + } + } else { + S27PacketExplosion packet = (S27PacketExplosion) event.getPacket(); + if (packet.func_149149_c() != 0.0F || packet.func_149144_d() != 0.0F || packet.func_149147_e() != 0.0F) { + this.pendingExplosion = true; + if (this.explosionHorizontal.getValue() == 0 || this.explosionVertical.getValue() == 0) { + event.setCancelled(true); + } + if (this.debugLog.getValue()) { + ChatUtil.sendFormatted( + String.format( + "%sExplosion (&otick: %d, x: %.2f, y: %.2f, z: %.2f&r)&r", + Myau.clientName, + mc.thePlayer.ticksExisted, + mc.thePlayer.motionX + (double) packet.func_149149_c(), + mc.thePlayer.motionY + (double) packet.func_149144_d(), + mc.thePlayer.motionZ + (double) packet.func_149147_e() + ) + ); + } + } + } + } + } + + @EventTarget + public void onLoadWorld(LoadWorldEvent event) { + this.onDisabled(); + } + + @Override + public void onDisabled() { + this.pendingExplosion = false; + this.allowNext = true; + this.shouldJump = false; + this.jumpCooldown = 0; + } + + @Override + public String[] getSuffix() { + return new String[]{CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, this.mode.getModeString())}; + } +} + + + +package myau.module.modules; + +import myau.module.Module; +import net.minecraft.client.Minecraft; + +public class ViewClip extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + + public ViewClip() { + super("ViewClip", false); + } + + @Override + public void onEnabled() { + if (mc.theWorld != null) { + mc.renderGlobal.loadRenderers(); + } + } + + @Override + public void onDisabled() { + if (mc.theWorld != null) { + mc.renderGlobal.loadRenderers(); + } + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.event.types.Priority; +import myau.events.MoveInputEvent; +import myau.events.PacketEvent; +import myau.module.Module; +import myau.util.TimerUtil; +import myau.property.properties.FloatProperty; +import net.minecraft.client.Minecraft; +import net.minecraft.network.play.client.C02PacketUseEntity; +import net.minecraft.network.play.client.C02PacketUseEntity.Action; +import net.minecraft.potion.Potion; + +public class Wtap extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private final TimerUtil timer = new TimerUtil(); + private boolean active = false; + private boolean stopForward = false; + private long delayTicks = 0L; + private long durationTicks = 0L; + public final FloatProperty delay = new FloatProperty("delay", 5.5F, 0.0F, 10.0F); + public final FloatProperty duration = new FloatProperty("duration", 1.5F, 1.0F, 5.0F); + + private boolean canTrigger() { + return !(mc.thePlayer.movementInput.moveForward < 0.8F) + && !mc.thePlayer.isCollidedHorizontally + && (!((float) mc.thePlayer.getFoodStats().getFoodLevel() <= 6.0F) || mc.thePlayer.capabilities.allowFlying) && (mc.thePlayer.isSprinting() + || !mc.thePlayer.isUsingItem() && !mc.thePlayer.isPotionActive(Potion.blindness) && mc.gameSettings.keyBindSprint.isKeyDown()); + } + + public Wtap() { + super("WTap", false); + } + + @EventTarget(Priority.LOWEST) + public void onMoveInput(MoveInputEvent event) { + if (this.active) { + if (!this.stopForward && !this.canTrigger()) { + this.active = false; + while (this.delayTicks > 0L) { + this.delayTicks -= 50L; + } + while (this.durationTicks > 0L) { + this.durationTicks -= 50L; + } + } else if (this.delayTicks > 0L) { + this.delayTicks -= 50L; + } else { + if (this.durationTicks > 0L) { + this.durationTicks -= 50L; + this.stopForward = true; + mc.thePlayer.movementInput.moveForward = 0.0F; + } + if (this.durationTicks <= 0L) { + this.active = false; + } + } + } + } + + @EventTarget + public void onPacket(PacketEvent event) { + if (this.isEnabled() && !event.isCancelled() && event.getType() == EventType.SEND) { + if (event.getPacket() instanceof C02PacketUseEntity + && ((C02PacketUseEntity) event.getPacket()).getAction() == Action.ATTACK + && !this.active + && this.timer.hasTimeElapsed(500L) + && mc.thePlayer.isSprinting()) { + this.timer.reset(); + this.active = true; + this.stopForward = false; + this.delayTicks = this.delayTicks + (long) (50.0F * this.delay.getValue()); + this.durationTicks = this.durationTicks + (long) (50.0F * this.duration.getValue()); + } + } + } +} + + + +package myau.module.modules; + +import myau.event.EventTarget; +import myau.event.types.EventType; +import myau.events.LoadWorldEvent; +import myau.events.PacketEvent; +import myau.events.Render3DEvent; +import myau.mixin.IAccessorMinecraft; +import myau.module.Module; +import myau.util.RenderUtil; +import myau.property.properties.*; +import myau.property.properties.BooleanProperty; +import myau.property.properties.ModeProperty; +import net.minecraft.block.Block; +import net.minecraft.block.BlockMobSpawner; +import net.minecraft.client.Minecraft; +import net.minecraft.network.play.server.S22PacketMultiBlockChange; +import net.minecraft.network.play.server.S22PacketMultiBlockChange.BlockUpdateData; +import net.minecraft.network.play.server.S23PacketBlockChange; +import net.minecraft.util.BlockPos; +import net.minecraft.util.Vec3; +import net.minecraft.util.Vec3i; +import net.minecraftforge.common.ForgeModContainer; + +import java.awt.*; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.concurrent.CopyOnWriteArraySet; + +public class Xray extends Module { + private static final Minecraft mc = Minecraft.getMinecraft(); + private static final LinkedHashSet xrayBlocks; + private static final LinkedHashSet caveOffsetsSmall; + private static final LinkedHashSet caveOffsetsLarge; + public final CopyOnWriteArraySet trackedBlocks = new CopyOnWriteArraySet<>(); + public final CopyOnWriteArraySet pendingBlocks = new CopyOnWriteArraySet<>(); + public final ModeProperty mode = new ModeProperty("mode", 0, new String[]{"SOFT", "FULL"}); + public final PercentProperty opacity = new PercentProperty("opacity", 50); + public final IntProperty range = new IntProperty("range", 64, 16, 512); + public final BooleanProperty cavesOnly = new BooleanProperty("caves-only", true); + public final IntProperty caveRadius = new IntProperty("caves-radius", 2, 1, 2); + public final BooleanProperty diamonds = new BooleanProperty("diamonds", true); + public final BooleanProperty diamondTracers = new BooleanProperty("diamonds-tracers", true); + public final BooleanProperty gold = new BooleanProperty("gold", true); + public final BooleanProperty goldTracers = new BooleanProperty("gold-tracers", true); + public final BooleanProperty iron = new BooleanProperty("iron", false); + public final BooleanProperty ironTracers = new BooleanProperty("iron-tracers", false); + public final BooleanProperty coal = new BooleanProperty("coal", false); + public final BooleanProperty coalTracers = new BooleanProperty("coal-tracers", false); + public final BooleanProperty redstone = new BooleanProperty("redstone", false); + public final BooleanProperty redStoneTracers = new BooleanProperty("redstone-tracers", false); + public final BooleanProperty lapis = new BooleanProperty("lapis", false); + public final BooleanProperty lapisTracers = new BooleanProperty("lapis-tracers", false); + public final BooleanProperty emeralds = new BooleanProperty("emeralds", false); + public final BooleanProperty emeraldsTracers = new BooleanProperty("emeralds-tracers", false); + public final BooleanProperty spawners = new BooleanProperty("spawners", false); + public final BooleanProperty spawnerTracers = new BooleanProperty("spawners-tracers", false); + public final BooleanProperty canes = new BooleanProperty("canes", false); + public final BooleanProperty canesTracers = new BooleanProperty("canes-tracers", false); + public final BooleanProperty warts = new BooleanProperty("warts", false); + public final BooleanProperty wartsTracers = new BooleanProperty("warts-tracers", false); + + private void renderOreHighlight(BlockPos blockPos, int blockId, Vec3 viewVector) { + if (mc.thePlayer.getDistance(blockPos.getX(), blockPos.getY(), blockPos.getZ()) <= this.range.getValue().doubleValue()) { + Color color = this.getOreColor(blockId); + RenderUtil.drawBlockBoundingBox(blockPos, 1.0, color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha(), 1.5F); + if (this.shouldDrawTracer(blockId)) { + RenderUtil.drawLine3D( + viewVector, + (double) blockPos.getX() + 0.5, + (double) blockPos.getY() + 0.5, + (double) blockPos.getZ() + 0.5, + (float) color.getRed() / 255.0F, + (float) color.getGreen() / 255.0F, + (float) color.getBlue() / 255.0F, + 1.0F, + 1.5F + ); + } + } + } + + private Color getOreColor(int blockId) { + switch (blockId) { + case 14: + return new Color(16777045); + case 15: + return new Color(16777215); + case 16: + return new Color(0); + case 21: + return new Color(5592575); + case 52: + return new Color(16733695); + case 56: + return new Color(5636095); + case 73: + case 74: + return new Color(16733525); + case 83: + return new Color(11206570); + case 115: + return new Color(11141120); + case 129: + return new Color(5635925); + default: + return new Color(-1); + } + } + + private boolean shouldDrawTracer(int blockId) { + switch (blockId) { + case 14: + return this.goldTracers.getValue(); + case 15: + return this.ironTracers.getValue(); + case 16: + return this.coalTracers.getValue(); + case 21: + return this.lapisTracers.getValue(); + case 52: + return this.spawnerTracers.getValue(); + case 56: + return this.diamondTracers.getValue(); + case 73: + case 74: + return this.redStoneTracers.getValue(); + case 83: + return this.canesTracers.getValue(); + case 115: + return this.wartsTracers.getValue(); + case 129: + return this.emeraldsTracers.getValue(); + default: + return false; + } + } + + private boolean isValidCaveBlock(BlockPos pos) { + if (mc.theWorld.isBlockLoaded(pos, false)) { + Block block = mc.theWorld.getBlockState(pos).getBlock(); + return block instanceof BlockMobSpawner || !block.isFullBlock() || !block.getMaterial().isOpaque() || block.canProvidePower(); + } else { + return false; + } + } + + public Xray() { + super("Xray", false); + } + + public boolean shouldRenderSide(int blockId) { + return xrayBlocks.contains(blockId); + } + + public boolean isXrayBlock(int blockId) { + switch (blockId) { + case 14: + return this.gold.getValue(); + case 15: + return this.iron.getValue(); + case 16: + return this.coal.getValue(); + case 21: + return this.lapis.getValue(); + case 52: + return this.spawners.getValue(); + case 56: + return this.diamonds.getValue(); + case 73: + case 74: + return this.redstone.getValue(); + case 83: + return this.canes.getValue(); + case 115: + return this.warts.getValue(); + case 129: + return this.emeralds.getValue(); + default: + return false; + } + } + + public boolean checkBlock(BlockPos blockPos) { + if (!this.cavesOnly.getValue()) { + return true; + } else { + if (this.caveRadius.getValue() >= 2) { + for (Vec3i vec3i : caveOffsetsLarge) { + if (this.isValidCaveBlock(blockPos.add(vec3i))) { + return true; + } + } + } else { + for (Vec3i vec3i : caveOffsetsSmall) { + if (this.isValidCaveBlock(blockPos.add(vec3i))) { + return true; + } + } + } + return false; + } + } + + @EventTarget + public void onRender3D(Render3DEvent event) { + if (this.isEnabled()) { + Vec3 vec3; + if (mc.gameSettings.thirdPersonView == 0) { + vec3 = new Vec3(0.0, 0.0, 1.0) + .rotatePitch( + (float) ( + -Math.toRadians( + RenderUtil.lerpFloat( + mc.getRenderViewEntity().rotationPitch, + mc.getRenderViewEntity().prevRotationPitch, + ((IAccessorMinecraft) mc).getTimer().renderPartialTicks + ) + ) + ) + ) + .rotateYaw( + (float) ( + -Math.toRadians( + RenderUtil.lerpFloat( + mc.getRenderViewEntity().rotationYaw, + mc.getRenderViewEntity().prevRotationYaw, + ((IAccessorMinecraft) mc).getTimer().renderPartialTicks + ) + ) + ) + ); + } else { + vec3 = new Vec3(0.0, 0.0, 0.0) + .rotatePitch( + (float) ( + -Math.toRadians( + RenderUtil.lerpFloat( + mc.thePlayer.cameraPitch, mc.thePlayer.prevCameraPitch, ((IAccessorMinecraft) mc).getTimer().renderPartialTicks + ) + ) + ) + ) + .rotateYaw( + (float) ( + -Math.toRadians( + RenderUtil.lerpFloat(mc.thePlayer.cameraYaw, mc.thePlayer.prevCameraYaw, ((IAccessorMinecraft) mc).getTimer().renderPartialTicks) + ) + ) + ); + } + vec3 = new Vec3(vec3.xCoord, vec3.yCoord + (double) mc.getRenderViewEntity().getEyeHeight(), vec3.zCoord); + RenderUtil.enableRenderState(); + for (BlockPos blockPos : this.trackedBlocks) { + if (this.pendingBlocks.contains(blockPos)) { + this.trackedBlocks.remove(blockPos); + } else { + int id = Block.getIdFromBlock(mc.theWorld.getBlockState(blockPos).getBlock()); + if (this.isXrayBlock(id)) { + this.renderOreHighlight(blockPos, id, vec3); + } else { + this.trackedBlocks.remove(blockPos); + } + } + } + for (BlockPos blockPos : this.pendingBlocks) { + int id = Block.getIdFromBlock(mc.theWorld.getBlockState(blockPos).getBlock()); + if (this.isXrayBlock(id)) { + this.renderOreHighlight(blockPos, id, vec3); + } else { + this.pendingBlocks.remove(blockPos); + } + } + RenderUtil.disableRenderState(); + } + } + + @EventTarget + public void onPacket(PacketEvent event) { + if (event.getType() == EventType.RECEIVE) { + if (event.getPacket() instanceof S22PacketMultiBlockChange) { + for (BlockUpdateData blockUpdateData : ((S22PacketMultiBlockChange) event.getPacket()).getChangedBlocks()) { + if (this.isXrayBlock(Block.getIdFromBlock(blockUpdateData.getBlockState().getBlock()))) { + this.pendingBlocks.add(new BlockPos(blockUpdateData.getPos())); + } + } + } else if (event.getPacket() instanceof S23PacketBlockChange) { + S23PacketBlockChange packet = (S23PacketBlockChange) event.getPacket(); + if (this.isXrayBlock(Block.getIdFromBlock(packet.getBlockState().getBlock()))) { + this.pendingBlocks.add(new BlockPos(packet.getBlockPosition())); + } + } + } + } + + @EventTarget + public void onLoadWorld(LoadWorldEvent event) { + this.trackedBlocks.clear(); + this.pendingBlocks.clear(); + } + + @Override + public void onEnabled() { + ForgeModContainer.forgeLightPipelineEnabled = false; + if (mc.renderGlobal != null) { + mc.renderGlobal.loadRenderers(); + } + } + + @Override + public void onDisabled() { + ForgeModContainer.forgeLightPipelineEnabled = true; + if (mc.renderGlobal != null) { + mc.renderGlobal.loadRenderers(); + } + } + + @Override + public void verifyValue(String mode) { + this.trackedBlocks.clear(); + this.pendingBlocks.clear(); + if (this.isEnabled() && mc.renderGlobal != null) { + mc.renderGlobal.loadRenderers(); + } + } + + static { + xrayBlocks = new LinkedHashSet<>(Arrays.asList(56, 14, 15, 16, 73, 74, 21, 129, 52, 83, 115)); + caveOffsetsSmall = new LinkedHashSet<>( + Arrays.asList(new Vec3i(0, -1, 0), new Vec3i(1, 0, 0), new Vec3i(0, 0, -1), new Vec3i(0, 0, 1), new Vec3i(-1, 0, 0), new Vec3i(0, 1, 0)) + ); + caveOffsetsLarge = new LinkedHashSet<>( + Arrays.asList( + new Vec3i(0, -2, 0), + new Vec3i(1, -1, 0), + new Vec3i(0, -1, -1), + new Vec3i(0, -1, 0), + new Vec3i(0, -1, 1), + new Vec3i(-1, -1, 0), + new Vec3i(2, 0, 0), + new Vec3i(0, 0, 2), + new Vec3i(0, 0, -2), + new Vec3i(-2, 0, 0), + new Vec3i(1, 0, -1), + new Vec3i(1, 0, 0), + new Vec3i(1, 0, 1), + new Vec3i(0, 0, -1), + new Vec3i(0, 0, 1), + new Vec3i(-1, 0, -1), + new Vec3i(-1, 0, 0), + new Vec3i(-1, 0, 1), + new Vec3i(1, 1, 0), + new Vec3i(0, 1, -1), + new Vec3i(0, 1, 0), + new Vec3i(0, 1, 1), + new Vec3i(-1, 1, 0), + new Vec3i(0, 2, 0) + ) + ); + } +} + + + +package myau; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import me.ksyz.accountmanager.AccountManager; +import myau.command.CommandManager; +import myau.command.commands.*; +import myau.config.Config; +import myau.event.EventManager; +import myau.management.*; +import myau.module.Module; +import myau.module.ModuleManager; +import myau.module.modules.*; +import myau.property.Property; +import myau.property.PropertyManager; + +import java.io.InputStreamReader; +import java.lang.reflect.Field; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Objects; + +public class Myau { + public static String clientName = "&7[&cM&6y&ea&au&7]&r "; + public static String version; + public static RotationManager rotationManager; + public static FloatManager floatManager; + public static BlinkManager blinkManager; + public static DelayManager delayManager; + public static LagManager lagManager; + public static PlayerStateManager playerStateManager; + public static FriendManager friendManager; + public static TargetManager targetManager; + public static PropertyManager propertyManager; + public static ModuleManager moduleManager; + public static CommandManager commandManager; + + public Myau() { + this.init(); + } + + public void init() { + rotationManager = new RotationManager(); + floatManager = new FloatManager(); + blinkManager = new BlinkManager(); + delayManager = new DelayManager(); + lagManager = new LagManager(); + playerStateManager = new PlayerStateManager(); + friendManager = new FriendManager(); + targetManager = new TargetManager(); + propertyManager = new PropertyManager(); + moduleManager = new ModuleManager(); + commandManager = new CommandManager(); + EventManager.register(rotationManager); + EventManager.register(floatManager); + EventManager.register(blinkManager); + EventManager.register(delayManager); + EventManager.register(lagManager); + EventManager.register(moduleManager); + EventManager.register(commandManager); + moduleManager.modules.put(AimAssist.class, new AimAssist()); + moduleManager.modules.put(AntiAFK.class, new AntiAFK()); + moduleManager.modules.put(AntiDebuff.class, new AntiDebuff()); + moduleManager.modules.put(AntiFireball.class, new AntiFireball()); + moduleManager.modules.put(AntiObbyTrap.class, new AntiObbyTrap()); + moduleManager.modules.put(AntiObfuscate.class, new AntiObfuscate()); + moduleManager.modules.put(AntiVoid.class, new AntiVoid()); + moduleManager.modules.put(AutoClicker.class, new AutoClicker()); + moduleManager.modules.put(AutoAnduril.class, new AutoAnduril()); + moduleManager.modules.put(AutoHeal.class, new AutoHeal()); + moduleManager.modules.put(AutoTool.class, new AutoTool()); + moduleManager.modules.put(BedNuker.class, new BedNuker()); + moduleManager.modules.put(BedESP.class, new BedESP()); + moduleManager.modules.put(BedTracker.class, new BedTracker()); + moduleManager.modules.put(Blink.class, new Blink()); + moduleManager.modules.put(Chams.class, new Chams()); + moduleManager.modules.put(ChestESP.class, new ChestESP()); + moduleManager.modules.put(ChestStealer.class, new ChestStealer()); + moduleManager.modules.put(Eagle.class, new Eagle()); + moduleManager.modules.put(ESP.class, new ESP()); + moduleManager.modules.put(FastPlace.class, new FastPlace()); + moduleManager.modules.put(Freeze.class, new Freeze()); + moduleManager.modules.put(Fly.class, new Fly()); + moduleManager.modules.put(FullBright.class, new FullBright()); + moduleManager.modules.put(GhostHand.class, new GhostHand()); + moduleManager.modules.put(GuiModule.class, new GuiModule()); + moduleManager.modules.put(HitSelect.class, new HitSelect()); + moduleManager.modules.put(HUD.class, new HUD()); + moduleManager.modules.put(MoreKB.class, new MoreKB()); + moduleManager.modules.put(Indicators.class, new Indicators()); + moduleManager.modules.put(InventoryClicker.class, new InventoryClicker()); + moduleManager.modules.put(InvManager.class, new InvManager()); + moduleManager.modules.put(InvWalk.class, new InvWalk()); + moduleManager.modules.put(ItemESP.class, new ItemESP()); + moduleManager.modules.put(Jesus.class, new Jesus()); + moduleManager.modules.put(KeepSprint.class, new KeepSprint()); + moduleManager.modules.put(HitBox.class, new HitBox()); + moduleManager.modules.put(KillAura.class, new KillAura()); + moduleManager.modules.put(LagRange.class, new LagRange()); + moduleManager.modules.put(LightningTracker.class, new LightningTracker()); + moduleManager.modules.put(LongJump.class, new LongJump()); + moduleManager.modules.put(MCF.class, new MCF()); + moduleManager.modules.put(NameTags.class, new NameTags()); + moduleManager.modules.put(NickHider.class, new NickHider()); + moduleManager.modules.put(NoFall.class, new NoFall()); + moduleManager.modules.put(NoHitDelay.class, new NoHitDelay()); + moduleManager.modules.put(NoHurtCam.class, new NoHurtCam()); + moduleManager.modules.put(NoJumpDelay.class, new NoJumpDelay()); + moduleManager.modules.put(NoRotate.class, new NoRotate()); + moduleManager.modules.put(NoSlow.class, new NoSlow()); + moduleManager.modules.put(Radar.class, new Radar()); + moduleManager.modules.put(Reach.class, new Reach()); + moduleManager.modules.put(Refill.class, new Refill()); + moduleManager.modules.put(SafeWalk.class, new SafeWalk()); + moduleManager.modules.put(Scaffold.class, new Scaffold()); + moduleManager.modules.put(AutoBlockIn.class, new AutoBlockIn()); + moduleManager.modules.put(Spammer.class, new Spammer()); + moduleManager.modules.put(Speed.class, new Speed()); + moduleManager.modules.put(SpeedMine.class, new SpeedMine()); + moduleManager.modules.put(Sprint.class, new Sprint()); + moduleManager.modules.put(TargetHUD.class, new TargetHUD()); + moduleManager.modules.put(TargetStrafe.class, new TargetStrafe()); + moduleManager.modules.put(Tracers.class, new Tracers()); + moduleManager.modules.put(Trajectories.class, new Trajectories()); + moduleManager.modules.put(Velocity.class, new Velocity()); + moduleManager.modules.put(ViewClip.class, new ViewClip()); + moduleManager.modules.put(Wtap.class, new Wtap()); + moduleManager.modules.put(Xray.class, new Xray()); + commandManager.commands.add(new BindCommand()); + commandManager.commands.add(new ConfigCommand()); + commandManager.commands.add(new DenickCommand()); + commandManager.commands.add(new FriendCommand()); + commandManager.commands.add(new HelpCommand()); + commandManager.commands.add(new HideCommand()); + commandManager.commands.add(new IgnCommand()); + commandManager.commands.add(new ItemCommand()); + commandManager.commands.add(new ListCommand()); + commandManager.commands.add(new ModuleCommand()); + commandManager.commands.add(new PlayerCommand()); + commandManager.commands.add(new ShowCommand()); + commandManager.commands.add(new TargetCommand()); + commandManager.commands.add(new ToggleCommand()); + commandManager.commands.add(new VclipCommand()); + for (Module module : moduleManager.modules.values()) { + ArrayList> properties = new ArrayList<>(); + for (final Field field : module.getClass().getDeclaredFields()) { + field.setAccessible(true); + final Object obj; + try { + obj = field.get(module); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + if (obj instanceof Property) { + ((Property) obj).setOwner(module); + properties.add((Property) obj); + } + } + propertyManager.properties.put(module.getClass(), properties); + EventManager.register(module); + } + Config config = new Config("default", true); + if (config.file.exists()) { + config.load(); + } + if (friendManager.file.exists()) { + friendManager.load(); + } + if (targetManager.file.exists()) { + targetManager.load(); + } + Runtime.getRuntime().addShutdownHook(new Thread(config::save)); + + try (InputStreamReader reader = new InputStreamReader(Objects.requireNonNull(Myau.class.getResourceAsStream("/version.json")), StandardCharsets.UTF_8)) { + JsonObject modInfo = new JsonParser().parse(reader).getAsJsonObject(); + version = modInfo.get("version").getAsString(); + } catch (Exception e) { + version = "dev"; + } + + AccountManager.init(); + } +} + + + +package myau.property.properties; + +import com.google.gson.JsonObject; +import myau.property.Property; + +import java.util.function.BooleanSupplier; + +public class BooleanProperty extends Property { + public BooleanProperty(String name, Boolean value) { + this(name, value, null); + } + + public BooleanProperty(String name, Boolean value, BooleanSupplier booleanSupplier) { + super(name, value, booleanSupplier); + } + + @Override + public String getValuePrompt() { + return "true/false"; + } + + @Override + public String formatValue() { + return this.getValue() ? "&atrue" : "&cfalse"; + } + + @Override + public boolean parseString(String string) { + if (string == null) { + return this.setValue(!(Boolean) this.getValue()); + } else if (string.equalsIgnoreCase("true") || string.equalsIgnoreCase("on") || string.equalsIgnoreCase("1")) { + return this.setValue(true); + } else { + return (string.equalsIgnoreCase("false") || string.equalsIgnoreCase("off") || string.equalsIgnoreCase("0")) && this.setValue(false); + } + } + + @Override + public boolean read(JsonObject jsonObject) { + return this.setValue(jsonObject.get(this.getName()).getAsBoolean()); + } + + @Override + public void write(JsonObject jsonObject) { + jsonObject.addProperty(this.getName(), this.getValue()); + } +} + + + +package myau.property.properties; + +import com.google.gson.JsonObject; +import myau.property.Property; + +import java.util.function.BooleanSupplier; + +public class ColorProperty extends Property { + public ColorProperty(String name, Integer color) { + this(name, color, null); + } + + public ColorProperty(String string, Integer color, BooleanSupplier check) { + super(string, color, rgb -> rgb <= 16777215, check); + } + + @Override + public String getValuePrompt() { + return "RGB"; + } + + @Override + public String formatValue() { + String hex = String.format("%06X", this.getValue()).substring(0,6); + return String.format("&c%s&a%s&9%s", hex.substring(0, 2), hex.substring(2, 4), hex.substring(4, 6)); + } + + @Override + public boolean parseString(String string) { + return this.setValue(Integer.parseInt(string.replace("#", ""), 16)); + } + + @Override + public boolean read(JsonObject jsonObject) { + return this.parseString(jsonObject.get(this.getName()).getAsString().substring(0,6)); + } + + @Override + public void write(JsonObject jsonObject) { + jsonObject.addProperty(this.getName(), String.format("%06X", this.getValue())); + } +} + + + +package myau.property.properties; + +import com.google.gson.JsonObject; +import myau.property.Property; + +import java.util.function.BooleanSupplier; + +public class FloatProperty extends Property { + private final Float minimum; + private final Float maximum; + + public FloatProperty(String name, Float value, Float minimum, Float maximum) { + this(name, value, minimum, maximum, null); + } + + public FloatProperty(String string, Float value, Float minimum, Float maximum, BooleanSupplier check) { + super(string, value, floatV -> floatV >= 0 && floatV <= Float.MAX_VALUE, check); + this.minimum = minimum; + this.maximum = maximum; + } + + @Override + public String getValuePrompt() { + return String.format("%s-%s", this.minimum, this.maximum); + } + + @Override + public String formatValue() { + return String.format("&6%s", this.getValue()); + } + + @Override + public boolean parseString(String string) { + return this.setValue(Float.parseFloat(string)); + } + + @Override + public boolean read(JsonObject jsonObject) { + return this.setValue(jsonObject.get(this.getName()).getAsNumber().floatValue()); + } + + @Override + public void write(JsonObject jsonObject) { + jsonObject.addProperty(this.getName(), this.getValue()); + } + + public Float getMinimum() { + return minimum; + } + + public Float getMaximum() { + return maximum; + } +} + + + +package myau.property.properties; + +import com.google.gson.JsonObject; +import myau.property.Property; + +import java.util.function.BooleanSupplier; + +public class IntProperty extends Property { + private final Integer minimum; + private final Integer maximum; + + public IntProperty(String name, Integer value, Integer minimum, Integer maximum) { + this(name, value, minimum, maximum, null); + } + + public IntProperty( + String name, Integer value, Integer minimum, Integer maximum, BooleanSupplier check + ) { + super(name, value, v -> v >= minimum && v <= maximum, check); + this.minimum = minimum; + this.maximum = maximum; + } + + @Override + public String getValuePrompt() { + return String.format("%d-%d", this.minimum, this.maximum); + } + + @Override + public String formatValue() { + return String.format("&e%s", this.getValue()); + } + + @Override + public boolean parseString(String string) { + return this.setValue(Integer.parseInt(string)); + } + + @Override + public boolean read(JsonObject jsonObject) { + return this.setValue(jsonObject.get(this.getName()).getAsNumber().intValue()); + } + + @Override + public void write(JsonObject jsonObject) { + jsonObject.addProperty(this.getName(), this.getValue()); + } + + public Integer getMinimum() { + return minimum; + } + + public Integer getMaximum() { + return maximum; + } +} + + + +package myau.property.properties; + +import com.google.gson.JsonObject; +import myau.property.Property; + +import java.util.function.BooleanSupplier; + +public class ModeProperty extends Property { + private final String[] modes; + + public ModeProperty(String name, Integer value, String[] modes) { + this(name, value, modes, null); + } + + public ModeProperty(String name, Integer value, String[] modes, BooleanSupplier check) { + super(name, value, check); + this.modes = modes; + } + + @Override + public String getValuePrompt() { + return String.join(", ", this.modes); + } + + public String getModeString() { + int index = this.getValue(); + return index >= 0 && index < this.modes.length ? this.modes[index] : ""; + } + + @Override + public String formatValue() { + String index = this.getModeString(); + return index.isEmpty() ? "&4?" : String.format("&9%s", index); + } + + @Override + public boolean parseString(String string) { + String valueStr = string.replace("_", ""); + for (int i = 0; i < this.modes.length; i++) { + if (valueStr.equalsIgnoreCase(this.modes[i].replace("_", ""))) { + return this.setValue(i); + } + } + return false; + } + + @Override + public boolean read(JsonObject jsonObject) { + return this.parseString(jsonObject.get(this.getName()).getAsString()); + } + + @Override + public void write(JsonObject jsonObject) { + jsonObject.addProperty(this.getName(), this.getModeString()); + } + + public void nextMode() { + int current = this.getValue(); + int next = current + 1; + if (next >= this.modes.length) { + next = 0; + } + this.setValue(next); + } + + public void previousMode() { + int current = this.getValue(); + int prev = current - 1; + if (prev < 0) { + prev = this.modes.length - 1; + } + this.setValue(prev); + } +} + + + +package myau.property.properties; + +import com.google.gson.JsonObject; +import myau.property.Property; + +import java.util.function.BooleanSupplier; + +public class PercentProperty extends Property { + private final Integer minimum; + private final Integer maximum; + + public PercentProperty(String name, Integer value) { + this(name, value, null); + } + + public PercentProperty(String name, Integer value, BooleanSupplier check) { + this(name, value, 0, 100, check); + } + + public PercentProperty(String name, Integer value, Integer minimum, Integer maximum, BooleanSupplier booleanSupplier) { + super(name, value, value1 -> value1 >= minimum && value1 <= maximum, booleanSupplier); + this.minimum = minimum; + this.maximum = maximum; + } + + @Override + public String getValuePrompt() { + return String.format("%d-%d%%", this.minimum, this.maximum); + } + + @Override + public String formatValue() { + return String.format("&b%d%%", this.getValue()); + } + + @Override + public boolean parseString(String string) { + return this.setValue(Integer.parseInt(string.replace("%", ""))); + } + + @Override + public boolean read(JsonObject jsonObject) { + return this.setValue(jsonObject.get(this.getName()).getAsNumber().intValue()); + } + + @Override + public void write(JsonObject jsonObject) { + jsonObject.addProperty(this.getName(), this.getValue()); + } + + public Integer getMaximum() { + return maximum; + } + + public Integer getMinimum() { + return minimum; + } +} + + + +package myau.property.properties; + +import com.google.gson.JsonObject; +import myau.property.Property; + +import java.util.function.BooleanSupplier; + +public class TextProperty extends Property { + public TextProperty(String name, String value) { + this(name, value, null); + } + + public TextProperty(String name, String value, BooleanSupplier booleanSupplier) { + super(name, value, booleanSupplier); + } + + @Override + public String getValuePrompt() { + return "text"; + } + + @Override + public String formatValue() { + return String.format("&f%s", this.getValue()); + } + + @Override + public boolean parseString(String string) { + return this.setValue(string); + } + + @Override + public boolean read(JsonObject jsonObject) { + return this.parseString(jsonObject.get(this.getName()).getAsString()); + } + + @Override + public void write(JsonObject jsonObject) { + jsonObject.addProperty(this.getName(), this.getValue()); + } +} + + + +package myau.property; + +import com.google.gson.JsonObject; +import myau.module.Module; + +import java.util.function.BooleanSupplier; +import java.util.function.Predicate; + +public abstract class Property { + private final String name; + private final T type; + private final Predicate validator; + private final BooleanSupplier visibleChecker; + private T value; + private Module owner; + + protected Property(String name, Object value, BooleanSupplier visibleChecker) { + this(name, value, null, visibleChecker); + } + + protected Property(String name, Object value, Predicate predicate, BooleanSupplier visibleChecker) { + this.name = name; + this.type = (T) value; + this.validator = predicate; + this.visibleChecker = visibleChecker; + this.value = (T) value; + this.owner = null; + } + + public String getName() { + return this.name; + } + + public abstract String getValuePrompt(); + + public boolean isVisible() { + return this.visibleChecker == null || this.visibleChecker.getAsBoolean(); + } + + public T getValue() { + return this.value; + } + + public abstract String formatValue(); + + public boolean setValue(Object object) { + if (this.validator != null && !this.validator.test((T) object)) { + return false; + } else { + this.value = (T) object; + if (this.owner != null) { + this.owner.verifyValue(this.name); + } + return true; + } + } + + public void parseString() { + } + + public void setOwner(Module module) { + this.owner = module; + } + + public abstract boolean parseString(String string); + + public abstract boolean read(JsonObject jsonObject); + + public abstract void write(JsonObject jsonObject); +} + + + +package myau.property; + +import myau.module.Module; + +import java.util.ArrayList; +import java.util.LinkedHashMap; + +public class PropertyManager { + public LinkedHashMap, ArrayList>> properties = new LinkedHashMap<>(); + + public Property getProperty(Module module, String string) { + for (Property property : properties.get(module.getClass())) { + if (property.getName().replace("-", "").equalsIgnoreCase(string.replace("-", ""))) { + return property; + } + } + return null; + } +} + + + +package myau.ui.callback; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.GuiTextField; +import org.lwjgl.input.Keyboard; + +import java.io.IOException; +import java.util.function.Consumer; + +public class GuiInput extends GuiScreen { + private final String title; + private final String defaultValue; + private final Consumer callback; + private GuiTextField textField; + private GuiButton buttonOk; + private GuiScreen caller; + + public GuiInput(String title, String defaultValue, Consumer callback, GuiScreen caller) { + this.title = title; + this.defaultValue = defaultValue; + this.callback = callback; + this.caller = caller; + } + + public static void prompt(String title, String defaultValue, Consumer callback, GuiScreen caller) { + Minecraft.getMinecraft().displayGuiScreen(new GuiInput(title,defaultValue, callback, caller)); + } + + @Override + public void initGui() { + int centerX = this.width / 2; + int centerY = this.height / 2; + + textField = new GuiTextField(0, this.fontRendererObj, centerX - 100, centerY - 10, 200, 20); + textField.setText(defaultValue); + textField.setFocused(true); + + this.buttonList.add(buttonOk = new GuiButton(0, centerX - 100, centerY + 20, 95, 20, "Confirm")); + this.buttonList.add(new GuiButton(1, centerX + 5, centerY + 20, 95, 20, "Cancel")); + } + + @Override + protected void actionPerformed(GuiButton button) { + if (button == buttonOk) { + if (callback != null) callback.accept(textField.getText()); + } + this.mc.displayGuiScreen(caller); + } + + @Override + protected void keyTyped(char typedChar, int keyCode) { + textField.textboxKeyTyped(typedChar, keyCode); + if (keyCode == Keyboard.KEY_RETURN || keyCode == Keyboard.KEY_NUMPADENTER) { + actionPerformed(buttonOk); + } else if (keyCode == Keyboard.KEY_ESCAPE) { + actionPerformed(null); + } + } + + @Override + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) { + try { + super.mouseClicked(mouseX,mouseY,mouseButton); + } catch (IOException e) { + throw new RuntimeException(e); + } + textField.mouseClicked(mouseX, mouseY, mouseButton); + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + drawDefaultBackground(); + drawCenteredString(fontRendererObj, title, width / 2, height / 2 - 35, 0xFFFFFF); + textField.drawTextBox(); + super.drawScreen(mouseX, mouseY, partialTicks); + } + + @Override + public void updateScreen() { + textField.updateCursorCounter(); + } +} + + + +package myau.ui; + +import com.google.gson.GsonBuilder; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import myau.Myau; +import myau.module.Module; +import myau.module.modules.*; +import myau.ui.components.CategoryComponent; +import net.minecraft.client.gui.GuiScreen; +import org.lwjgl.input.Mouse; + +import java.awt.*; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.util.*; +import java.util.List; + +public class ClickGui extends GuiScreen { + private static ClickGui instance; + private final File configFile = new File("./config/Myau/", "clickgui.txt"); + private final ArrayList categoryList; + + public ClickGui() { + instance = this; + + List combatModules = new ArrayList<>(); + combatModules.add(Myau.moduleManager.getModule(AimAssist.class)); + combatModules.add(Myau.moduleManager.getModule(AutoClicker.class)); + combatModules.add(Myau.moduleManager.getModule(KillAura.class)); + combatModules.add(Myau.moduleManager.getModule(Wtap.class)); + combatModules.add(Myau.moduleManager.getModule(Velocity.class)); + combatModules.add(Myau.moduleManager.getModule(Freeze.class)); + combatModules.add(Myau.moduleManager.getModule(Reach.class)); + combatModules.add(Myau.moduleManager.getModule(TargetStrafe.class)); + combatModules.add(Myau.moduleManager.getModule(NoHitDelay.class)); + combatModules.add(Myau.moduleManager.getModule(AntiFireball.class)); + combatModules.add(Myau.moduleManager.getModule(LagRange.class)); + combatModules.add(Myau.moduleManager.getModule(HitBox.class)); + combatModules.add(Myau.moduleManager.getModule(MoreKB.class)); + combatModules.add(Myau.moduleManager.getModule(Refill.class)); + combatModules.add(Myau.moduleManager.getModule(HitSelect.class)); + + List movementModules = new ArrayList<>(); + movementModules.add(Myau.moduleManager.getModule(AntiAFK.class)); + movementModules.add(Myau.moduleManager.getModule(Fly.class)); + movementModules.add(Myau.moduleManager.getModule(Speed.class)); + movementModules.add(Myau.moduleManager.getModule(LongJump.class)); + movementModules.add(Myau.moduleManager.getModule(Sprint.class)); + movementModules.add(Myau.moduleManager.getModule(SafeWalk.class)); + movementModules.add(Myau.moduleManager.getModule(Jesus.class)); + movementModules.add(Myau.moduleManager.getModule(Blink.class)); + movementModules.add(Myau.moduleManager.getModule(NoFall.class)); + movementModules.add(Myau.moduleManager.getModule(NoSlow.class)); + movementModules.add(Myau.moduleManager.getModule(KeepSprint.class)); + movementModules.add(Myau.moduleManager.getModule(Eagle.class)); + movementModules.add(Myau.moduleManager.getModule(NoJumpDelay.class)); + movementModules.add(Myau.moduleManager.getModule(AntiVoid.class)); + + List renderModules = new ArrayList<>(); + renderModules.add(Myau.moduleManager.getModule(ESP.class)); + renderModules.add(Myau.moduleManager.getModule(Chams.class)); + renderModules.add(Myau.moduleManager.getModule(FullBright.class)); + renderModules.add(Myau.moduleManager.getModule(Tracers.class)); + renderModules.add(Myau.moduleManager.getModule(NameTags.class)); + renderModules.add(Myau.moduleManager.getModule(Xray.class)); + renderModules.add(Myau.moduleManager.getModule(TargetHUD.class)); + renderModules.add(Myau.moduleManager.getModule(Indicators.class)); + renderModules.add(Myau.moduleManager.getModule(BedESP.class)); + renderModules.add(Myau.moduleManager.getModule(EggESP.class)); + renderModules.add(Myau.moduleManager.getModule(ItemESP.class)); + renderModules.add(Myau.moduleManager.getModule(ViewClip.class)); + renderModules.add(Myau.moduleManager.getModule(NoHurtCam.class)); + renderModules.add(Myau.moduleManager.getModule(HUD.class)); + renderModules.add(Myau.moduleManager.getModule(GuiModule.class)); + renderModules.add(Myau.moduleManager.getModule(ChestESP.class)); + renderModules.add(Myau.moduleManager.getModule(Trajectories.class)); + renderModules.add(Myau.moduleManager.getModule(Radar.class)); + + List playerModules = new ArrayList<>(); + playerModules.add(Myau.moduleManager.getModule(AutoHeal.class)); + playerModules.add(Myau.moduleManager.getModule(AutoTool.class)); + playerModules.add(Myau.moduleManager.getModule(ChestStealer.class)); + playerModules.add(Myau.moduleManager.getModule(InvManager.class)); + playerModules.add(Myau.moduleManager.getModule(InvWalk.class)); + playerModules.add(Myau.moduleManager.getModule(Scaffold.class)); + playerModules.add(Myau.moduleManager.getModule(AutoBlockIn.class)); + playerModules.add(Myau.moduleManager.getModule(SpeedMine.class)); + playerModules.add(Myau.moduleManager.getModule(FastPlace.class)); + playerModules.add(Myau.moduleManager.getModule(GhostHand.class)); + playerModules.add(Myau.moduleManager.getModule(MCF.class)); + playerModules.add(Myau.moduleManager.getModule(AntiDebuff.class)); + + List miscModules = new ArrayList<>(); + miscModules.add(Myau.moduleManager.getModule(Spammer.class)); + miscModules.add(Myau.moduleManager.getModule(BedNuker.class)); + miscModules.add(Myau.moduleManager.getModule(BedTracker.class)); + miscModules.add(Myau.moduleManager.getModule(LightningTracker.class)); + miscModules.add(Myau.moduleManager.getModule(NoRotate.class)); + miscModules.add(Myau.moduleManager.getModule(NickHider.class)); + miscModules.add(Myau.moduleManager.getModule(AntiObbyTrap.class)); + miscModules.add(Myau.moduleManager.getModule(AntiObfuscate.class)); + miscModules.add(Myau.moduleManager.getModule(AutoAnduril.class)); + miscModules.add(Myau.moduleManager.getModule(InventoryClicker.class)); + + Comparator comparator = Comparator.comparing(m -> m.getName().toLowerCase()); + combatModules.sort(comparator); + movementModules.sort(comparator); + renderModules.sort(comparator); + playerModules.sort(comparator); + miscModules.sort(comparator); + + Set registered = new HashSet<>(); + registered.addAll(combatModules); + registered.addAll(movementModules); + registered.addAll(renderModules); + registered.addAll(playerModules); + registered.addAll(miscModules); + + for (Module module : Myau.moduleManager.modules.values()) { + if (!registered.contains(module)) { + throw new RuntimeException(module.getClass().getName() + " is unregistered to click gui."); + } + } + + this.categoryList = new ArrayList<>(); + int topOffset = 5; + + + CategoryComponent combat = new CategoryComponent("Combat", combatModules); + combat.setY(topOffset); + categoryList.add(combat); + topOffset += 20; + + CategoryComponent movement = new CategoryComponent("Movement", movementModules); + movement.setY(topOffset); + categoryList.add(movement); + topOffset += 20; + + CategoryComponent render = new CategoryComponent("Render", renderModules); + render.setY(topOffset); + categoryList.add(render); + topOffset += 20; + + CategoryComponent player = new CategoryComponent("Player", playerModules); + player.setY(topOffset); + categoryList.add(player); + topOffset += 20; + + CategoryComponent misc = new CategoryComponent("Misc", miscModules); + misc.setY(topOffset); + categoryList.add(misc); + + loadPositions(); + } + + public static ClickGui getInstance() { + return instance; + } + + public void initGui() { + super.initGui(); + } + + public void drawScreen(int x, int y, float p) { + drawRect(0, 0, this.width, this.height, new Color(0, 0, 0, 100).getRGB()); + + mc.fontRendererObj.drawStringWithShadow("Myau " + Myau.version, 4, this.height - 3 - mc.fontRendererObj.FONT_HEIGHT * 2, new Color(60, 162, 253).getRGB()); + mc.fontRendererObj.drawStringWithShadow("dev, ksyz", 4, this.height - 3 - mc.fontRendererObj.FONT_HEIGHT, new Color(60, 162, 253).getRGB()); + + for (CategoryComponent category : categoryList) { + category.render(this.fontRendererObj); + category.handleDrag(x, y); + + for (Component module : category.getModules()) { + module.update(x, y); + } + } + + int wheel = Mouse.getDWheel(); + if (wheel != 0) { + int scrollDir = wheel > 0 ? 1 : -1; + for (CategoryComponent category : categoryList) { + category.onScroll(x, y, scrollDir); + } + } + } + + public void mouseClicked(int x, int y, int mouseButton) { + Iterator btnCat = categoryList.iterator(); + while (true) { + CategoryComponent category; + do { + do { + if (!btnCat.hasNext()) { + return; + } + + category = btnCat.next(); + if (category.insideArea(x, y) && !category.isHovered(x, y) && !category.mousePressed(x, y) && mouseButton == 0) { + category.mousePressed(true); + category.xx = x - category.getX(); + category.yy = y - category.getY(); + } + + if (category.mousePressed(x, y) && mouseButton == 0) { + category.setOpened(!category.isOpened()); + } + + if (category.isHovered(x, y) && mouseButton == 0) { + category.setPin(!category.isPin()); + } + } while (!category.isOpened()); + } while (category.getModules().isEmpty()); + + for (Component c : category.getModules()) { + c.mouseDown(x, y, mouseButton); + } + } + + } + + public void mouseReleased(int x, int y, int mouseButton) { + Iterator iterator = categoryList.iterator(); + + CategoryComponent categoryComponent; + while (iterator.hasNext()) { + categoryComponent = iterator.next(); + if (mouseButton == 0) { + categoryComponent.mousePressed(false); + } + } + + iterator = categoryList.iterator(); + + while (true) { + do { + do { + if (!iterator.hasNext()) { + return; + } + + categoryComponent = iterator.next(); + } while (!categoryComponent.isOpened()); + } while (categoryComponent.getModules().isEmpty()); + + for (Component component : categoryComponent.getModules()) { + component.mouseReleased(x, y, mouseButton); + } + } + } + + public void keyTyped(char typedChar, int key) { + if (key == 1) { + this.mc.displayGuiScreen(null); + } else { + Iterator btnCat = categoryList.iterator(); + + while (true) { + CategoryComponent cat; + do { + do { + if (!btnCat.hasNext()) { + return; + } + + cat = btnCat.next(); + } while (!cat.isOpened()); + } while (cat.getModules().isEmpty()); + + for (Component component : cat.getModules()) { + component.keyTyped(typedChar, key); + } + } + } + } + + public void onGuiClosed() { + savePositions(); + } + + public boolean doesGuiPauseGame() { + return false; + } + + private void savePositions() { + JsonObject json = new JsonObject(); + for (CategoryComponent cat : categoryList) { + JsonObject pos = new JsonObject(); + pos.addProperty("x", cat.getX()); + pos.addProperty("y", cat.getY()); + pos.addProperty("open", cat.isOpened()); + json.add(cat.getName(), pos); + } + try (FileWriter writer = new FileWriter(configFile)) { + new GsonBuilder().setPrettyPrinting().create().toJson(json, writer); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private void loadPositions() { + if (!configFile.exists()) return; + try (FileReader reader = new FileReader(configFile)) { + JsonObject json = new JsonParser().parse(reader).getAsJsonObject(); + for (CategoryComponent cat : categoryList) { + if (json.has(cat.getName())) { + JsonObject pos = json.getAsJsonObject(cat.getName()); + cat.setX(pos.get("x").getAsInt()); + cat.setY(pos.get("y").getAsInt()); + cat.setOpened(pos.get("open").getAsBoolean()); + } + } + } catch (IOException e) { + e.printStackTrace(); + } + } +} + + + +package myau.ui; + +import java.util.concurrent.atomic.AtomicInteger; + +public interface Component { + void draw(AtomicInteger offset); + void update(int mousePosX, int mousePosY); + void mouseDown(int x, int y, int button); + void mouseReleased(int x, int y, int button); + void keyTyped(char chatTyped, int keyCode); + void setComponentStartAt(int newOffsetY); + int getHeight(); + boolean isVisible(); +} + + + +package myau.ui.components; + +import myau.Myau; +import myau.module.modules.GuiModule; +import myau.module.modules.HUD; +import myau.ui.Component; +import myau.ui.dataset.BindStage; +import myau.util.KeyBindUtil; +import net.minecraft.client.Minecraft; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +import java.util.concurrent.atomic.AtomicInteger; + +public class BindComponent implements Component { + private boolean isBinding; + private final ModuleComponent parentModule; + private int offsetY; + private int x; + private int y; + + public BindComponent(ModuleComponent b, int offsetY) { + this.parentModule = b; + this.x = b.category.getX() + b.category.getWidth(); + this.y = b.category.getY() + b.offsetY; + this.offsetY = offsetY; + } + + public void draw(AtomicInteger offset) { + GL11.glPushMatrix(); + GL11.glScaled(0.5D, 0.5D, 0.5D); + String displayText = this.isBinding ? BindStage.binding : BindStage.bind + ": " + KeyBindUtil.getKeyName(this.parentModule.mod.getKey()); + this.renderText(displayText, ((HUD) Myau.moduleManager.modules.get(HUD.class)).getColor(System.currentTimeMillis(), offset.get()).getRGB()); + GL11.glPopMatrix(); + } + + @Override + public void update(int mousePosX, int mousePosY) { + boolean h = this.isHovered(mousePosX, mousePosY); + this.y = this.parentModule.category.getY() + this.offsetY; + this.x = this.parentModule.category.getX(); + } + + public void mouseDown(int x, int y, int button) { + if (this.isHovered(x, y) && button == 0 && this.parentModule.panelExpand) { + this.isBinding = !this.isBinding; + } else if (this.isBinding && this.parentModule.panelExpand) { + int keyIndex = button - 100; + + if (button == 0) { + this.isBinding = false; + return; + } + + this.parentModule.mod.setKey(keyIndex); + this.isBinding = false; + } + } + + @Override + public void mouseReleased(int x, int y, int button) { + + } + + @Override + public void keyTyped(char chatTyped, int keyCode) { + if (this.isBinding) { + if (keyCode == 1) { + this.isBinding = false; + return; + } + + if (keyCode == 11) { + if (this.parentModule.mod instanceof GuiModule) { + this.parentModule.mod.setKey(54); + } else { + this.parentModule.mod.setKey(0); + } + } else { + this.parentModule.mod.setKey(keyCode); + } + + this.isBinding = false; + } + } + + @Override + public void setComponentStartAt(int newOffsetY) { + this.offsetY = newOffsetY; + } + + public boolean isHovered(int x, int y) { + return x > this.x && x < this.x + this.parentModule.category.getWidth() && y > this.y - 1 && y < this.y + 12; + } + + public int getHeight() { + return 12; + } + + @Override + public boolean isVisible() { + return true; + } + + private void renderText(String s, int color) { + Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(s, (float) ((this.parentModule.category.getX() + 4) * 2), (float) ((this.parentModule.category.getY() + this.offsetY + 3) * 2), color); + } +} + + + +package myau.ui.components; + +import myau.module.Module; +import myau.ui.Component; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.ScaledResolution; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; + +public class CategoryComponent { + private final int MAX_HEIGHT = 300; + + public ArrayList modulesInCategory = new ArrayList<>(); + public String categoryName; + private boolean categoryOpened; + private int width; + private int y; + private int x; + private final int bh; + public boolean dragging; + public int xx; + public int yy; + public boolean pin = false; + private double marginY, marginX; + private int scroll = 0; + private double animScroll = 0; + private int height = 0; + + public CategoryComponent(String category, List modules) { + this.categoryName = category; + this.width = 92; + this.x = 5; + this.y = 5; + this.bh = 13; + this.xx = 0; + this.categoryOpened = false; + this.dragging = false; + int tY = this.bh + 3; + this.marginX = 80; + this.marginY = 4.5; + for (Module mod : modules) { + ModuleComponent b = new ModuleComponent(mod, this, tY); + this.modulesInCategory.add(b); + tY += 16; + } + } + + public ArrayList getModules() { + return this.modulesInCategory; + } + + public void setX(int n) { + this.x = n; + } + + public void setY(int y) { + this.y = y; + } + + public void mousePressed(boolean d) { + this.dragging = d; + } + + public boolean isPin() { + return this.pin; + } + + public void setPin(boolean on) { + this.pin = on; + } + + public boolean isOpened() { + return this.categoryOpened; + } + + public void setOpened(boolean on) { + this.categoryOpened = on; + } + + public void render(FontRenderer renderer) { + this.width = 92; + update(); + height = 0; + for (Component moduleRenderManager : this.modulesInCategory) { + height += moduleRenderManager.getHeight(); + } + int maxScroll = Math.max(0, height - MAX_HEIGHT); + if (scroll > maxScroll) scroll = maxScroll; + if (animScroll > maxScroll) animScroll = maxScroll; + animScroll += (scroll - animScroll) * 0.2; + if (!this.modulesInCategory.isEmpty() && this.categoryOpened) { + int displayHeight = Math.min(height, MAX_HEIGHT); + Gui.drawRect(this.x - 1, this.y, this.x + this.width + 1, this.y + this.bh + displayHeight + 4, new Color(0, 0, 0, 100).getRGB()); + } + Gui.drawRect((this.x - 2), this.y, (this.x + this.width + 2), (this.y + this.bh + 3), new Color(0, 0, 0, 200).getRGB()); + renderer.drawString(this.categoryName, (float) (this.x + 2), (float) (this.y + 4), -1, false); + renderer.drawString(this.categoryOpened ? "-" : "+", (float) (this.x + marginX), (float) ((double) this.y + marginY), Color.white.getRGB(), false); + if (this.categoryOpened && !this.modulesInCategory.isEmpty()) { + int renderHeight = 0; + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + double scale = sr.getScaleFactor(); + int bottom = this.y + this.bh + MAX_HEIGHT + 3; + GL11.glEnable(GL11.GL_SCISSOR_TEST); + GL11.glScissor((int) (this.x * scale), (int) ((sr.getScaledHeight() - bottom) * scale), (int) (this.width * scale), (int) (MAX_HEIGHT * scale)); + for (Component c2 : this.modulesInCategory) { + int compHeight = c2.getHeight(); + if (renderHeight + compHeight > animScroll && + renderHeight < animScroll + MAX_HEIGHT) { + int drawY = (int) (renderHeight - animScroll); + c2.setComponentStartAt(this.bh + 3 + drawY); + c2.draw(new AtomicInteger(0)); + } + renderHeight += compHeight; + } + GL11.glDisable(GL11.GL_SCISSOR_TEST); + if (height > MAX_HEIGHT) { + float scrollY = (float) this.y + this.bh + 3 + (float) (animScroll * MAX_HEIGHT / height); + Gui.drawRect(this.x + this.width - 2, (int) scrollY, this.x + this.width, (int) (scrollY + ((float) MAX_HEIGHT * MAX_HEIGHT / height)), new Color(255, 255, 255, 60).getRGB()); + } + } + } + + public void update() { + int offset = this.bh + 3; + for (Component component : this.modulesInCategory) { + component.setComponentStartAt(offset); + offset += component.getHeight(); + } + } + + public int getX() { + return this.x; + } + + public int getY() { + return this.y; + } + + public int getWidth() { + return this.width; + } + + public void handleDrag(int x, int y) { + if (this.dragging) { + this.setX(x - this.xx); + this.setY(y - this.yy); + } + } + + public boolean isHovered(int x, int y) { + return x >= this.x + 92 - 13 && x <= this.x + this.width && (float) y >= (float) this.y + 2.0F && y <= this.y + this.bh + 1; + } + + public boolean mousePressed(int x, int y) { + return x >= this.x + 77 && x <= this.x + this.width - 6 && (float) y >= (float) this.y + 2.0F && y <= this.y + this.bh + 1; + } + + public boolean insideArea(int x, int y) { + return x >= this.x && x <= this.x + this.width && y >= this.y && y <= this.y + this.bh; + } + + public String getName() { + return categoryName; + } + + public void setLocation(int parseInt, int parseInt1) { + this.x = parseInt; + this.y = parseInt1; + } + + public void onScroll(int mouseX, int mouseY, int scrollAmount) { + if (!categoryOpened || height <= MAX_HEIGHT) return; + + int areaTop = this.y + this.bh; + int areaBottom = this.y + this.bh + MAX_HEIGHT; + + if (mouseX >= this.x && mouseX <= this.x + width && mouseY >= areaTop && mouseY <= areaBottom) { + scroll -= scrollAmount * 12; + scroll = Math.max(0, Math.min(scroll, height - MAX_HEIGHT)); + } + } +} + + + +package myau.ui.components; + +import myau.enums.ChatColors; +import myau.property.properties.BooleanProperty; +import myau.ui.Component; +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; + +import java.util.concurrent.atomic.AtomicInteger; + +public class CheckBoxComponent implements Component { + private final BooleanProperty property; + private final ModuleComponent module; + private int offsetY; + private int x; + private int y; + + public CheckBoxComponent(BooleanProperty property, ModuleComponent parentModule, int offsetY) { + this.property = property; + this.module = parentModule; + this.x = parentModule.category.getX() + parentModule.category.getWidth(); + this.y = parentModule.category.getY() + parentModule.offsetY; + this.offsetY = offsetY; + } + + + public void draw(AtomicInteger offset) { + GL11.glPushMatrix(); + GL11.glScaled(0.5D, 0.5D, 0.5D); + Minecraft.getMinecraft().fontRendererObj.drawString(this.property.getName().replace("-", " ") + ": " + ChatColors.formatColor(this.property.formatValue()), (float) ((this.module.category.getX() + 4) * 2), (float) ((this.module.category.getY() + this.offsetY + 5) * 2), -1, false); + GL11.glPopMatrix(); + } + + public void setComponentStartAt(int newOffsetY) { + this.offsetY = newOffsetY; + } + + @Override + public int getHeight() { + return 12; + } + + public void update(int mousePosX, int mousePosY) { + this.y = this.module.category.getY() + this.offsetY; + this.x = this.module.category.getX(); + } + + public void mouseDown(int x, int y, int button) { + if (this.isHovered(x, y) && button == 0 && this.module.panelExpand) { + this.property.setValue(!this.property.getValue()); + } + + } + + @Override + public void mouseReleased(int x, int y, int button) { + + } + + @Override + public void keyTyped(char chatTyped, int keyCode) { + + } + + public boolean isHovered(int x, int y) { + return x > this.x && x < this.x + this.module.category.getWidth() && y > this.y && y < this.y + 11; + } + + + @Override + public boolean isVisible() { + return property.isVisible(); + } +} + + + +package myau.ui.components; + +import myau.enums.ChatColors; +import myau.property.properties.ColorProperty; +import myau.ui.Component; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.math.BigDecimal; +import java.math.RoundingMode; + +public class ColorSliderComponent implements Component { + + private final ModuleComponent parentModule; + private final ColorProperty property; + private int offsetY; + private boolean draggingHue, draggingSat, draggingBri; + private float hue, saturation, brightness; + + public ColorSliderComponent(ColorProperty property, ModuleComponent parentModule, int offsetY) { + this.parentModule = parentModule; + this.offsetY = offsetY; + this.property = property; + + Color c = new Color(property.getValue()); + float[] hsb = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null); + hue = hsb[0]; + saturation = hsb[1]; + brightness = hsb[2]; + } + + @Override + public void draw(java.util.concurrent.atomic.AtomicInteger offset) { + int x = parentModule.category.getX() + 4; + int y = parentModule.category.getY() + offsetY; + int width = parentModule.category.getWidth() - 8; + GL11.glPushMatrix(); + GL11.glScaled(0.5, 0.5, 0.5); + Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(property.getName().replace("-", " ") + ": " + ChatColors.formatColor(property.formatValue()), (float) (x * 2), (float) ((int) ((float) (this.parentModule.category.getY() + this.offsetY + 3) * 2.0F)), -1); + GL11.glPopMatrix(); + if (!draggingHue && !draggingSat && !draggingBri) { + Color color = new Color(property.getValue()); + float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null); + hue = hsb[0]; + saturation = hsb[1]; + brightness = hsb[2]; + } + int colorPreviewSize = 6; + int colorPreviewX = x + width - colorPreviewSize; + int colorPreviewY = y + 2; + int previewColor = Color.HSBtoRGB(hue, saturation, brightness); + Gui.drawRect(colorPreviewX - 6, colorPreviewY, colorPreviewX + colorPreviewSize, colorPreviewY + colorPreviewSize, previewColor); + int baseY = y + 10; + int satY = baseY + 4 + 2; + int briY = satY + 4 + 2; + drawHueBar(x, baseY, width); + drawPointer(x, baseY, width, hue); + drawGradientRect(x, satY, x + width, satY + 4, Color.WHITE.getRGB(), Color.getHSBColor(hue, 1f, 1f).getRGB()); + drawPointer(x, satY, width, saturation); + drawGradientRect(x, briY, x + width, briY + 4, Color.BLACK.getRGB(), Color.getHSBColor(hue, saturation, 1f).getRGB()); + drawPointer(x, briY, width, brightness); + } + + private void drawHueBar(int x, int y, int width) { + for (int i = 0; i < width; i++) { + float hue = (float) i / (float) width; + int color = Color.HSBtoRGB(hue, 1f, 1f); + Gui.drawRect(x + i, y, x + i + 1, y + 4, color); + } + } + + private void drawPointer(int x, int y, int width, float value) { + int posX = x + (int) (width * value); + Gui.drawRect(posX - 1, y, posX, y + 4, new Color(0, 0, 0, 200).getRGB()); + } + + @Override + public void update(int mouseX, int mouseY) { + int baseX = parentModule.category.getX() + 4; + int width = parentModule.category.getWidth() - 8; + boolean changed = false; + + if (draggingHue) { + hue = getSliderValue(mouseX, baseX, width); + changed = true; + } + if (draggingSat) { + saturation = getSliderValue(mouseX, baseX, width); + changed = true; + } + if (draggingBri) { + brightness = getSliderValue(mouseX, baseX, width); + changed = true; + } + + if (changed) { + int signed = Color.HSBtoRGB(hue, saturation, brightness); + property.setValue(new Color(signed).getRGB()); + } + } + + private float getSliderValue(int mouseX, int startX, int width) { + double d = Math.min(width, Math.max(0, mouseX - startX)); + return (float) roundToPrecision(d / width, 3); + } + + private static double roundToPrecision(double v, int precision) { + BigDecimal bd = new BigDecimal(v); + bd = bd.setScale(precision, RoundingMode.HALF_UP); + return bd.doubleValue(); + } + + @Override + public void mouseDown(int mouseX, int mouseY, int button) { + if (button != 0 || !parentModule.panelExpand) return; + int baseY = parentModule.category.getY() + offsetY + 10; + if (isHovered(mouseX, mouseY, baseY)) draggingHue = true; + else if (isHovered(mouseX, mouseY, baseY + 4 + 2)) draggingSat = true; + else if (isHovered(mouseX, mouseY, baseY + (4 + 2) * 2)) draggingBri = true; + } + + @Override + public void mouseReleased(int x, int y, int button) { + draggingHue = draggingSat = draggingBri = false; + } + + private boolean isHovered(int mx, int my, int sliderY) { + int startX = parentModule.category.getX() + 4; + int endX = startX + parentModule.category.getWidth() - 8; + return mx >= startX && mx <= endX && my >= sliderY && my <= sliderY + 4; + } + + @Override + public boolean isVisible() { + return property.isVisible(); + } + + @Override + public void keyTyped(char chatTyped, int keyCode) { + } + + @Override + public void setComponentStartAt(int newOffsetY) { + offsetY = newOffsetY; + } + + @Override + public int getHeight() { + return 10 + 17; + } + + private void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor) { + float sa = (float) (startColor >> 24 & 255) / 255.0F; + float sr = (float) (startColor >> 16 & 255) / 255.0F; + float sg = (float) (startColor >> 8 & 255) / 255.0F; + float sb = (float) (startColor & 255) / 255.0F; + float ea = (float) (endColor >> 24 & 255) / 255.0F; + float er = (float) (endColor >> 16 & 255) / 255.0F; + float eg = (float) (endColor >> 8 & 255) / 255.0F; + float eb = (float) (endColor & 255) / 255.0F; + net.minecraft.client.renderer.Tessellator tessellator = net.minecraft.client.renderer.Tessellator.getInstance(); + net.minecraft.client.renderer.WorldRenderer world = tessellator.getWorldRenderer(); + org.lwjgl.opengl.GL11.glDisable(org.lwjgl.opengl.GL11.GL_TEXTURE_2D); + org.lwjgl.opengl.GL11.glEnable(org.lwjgl.opengl.GL11.GL_BLEND); + org.lwjgl.opengl.GL11.glDisable(org.lwjgl.opengl.GL11.GL_ALPHA_TEST); + org.lwjgl.opengl.GL11.glBlendFunc(org.lwjgl.opengl.GL11.GL_SRC_ALPHA, org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA); + org.lwjgl.opengl.GL11.glShadeModel(org.lwjgl.opengl.GL11.GL_SMOOTH); + world.begin(7, net.minecraft.client.renderer.vertex.DefaultVertexFormats.POSITION_COLOR); + world.pos(right, top, 0).color(er, eg, eb, ea).endVertex(); + world.pos(left, top, 0).color(sr, sg, sb, sa).endVertex(); + world.pos(left, bottom, 0).color(sr, sg, sb, sa).endVertex(); + world.pos(right, bottom, 0).color(er, eg, eb, ea).endVertex(); + tessellator.draw(); + org.lwjgl.opengl.GL11.glShadeModel(org.lwjgl.opengl.GL11.GL_FLAT); + org.lwjgl.opengl.GL11.glDisable(org.lwjgl.opengl.GL11.GL_BLEND); + org.lwjgl.opengl.GL11.glEnable(org.lwjgl.opengl.GL11.GL_ALPHA_TEST); + org.lwjgl.opengl.GL11.glEnable(org.lwjgl.opengl.GL11.GL_TEXTURE_2D); + } + +} + + + +package myau.ui.components; + +import myau.enums.ChatColors; +import myau.property.properties.ModeProperty; +import myau.ui.Component; +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; + +import java.util.concurrent.atomic.AtomicInteger; + +public class ModeComponent implements Component { + private final ModeProperty property; + private final ModuleComponent parentModule; + private int x; + private int y; + private int offsetY; + + public ModeComponent(ModeProperty desc, ModuleComponent parentModule, int offsetY) { + this.property = desc; + this.parentModule = parentModule; + this.x = parentModule.category.getX() + parentModule.category.getWidth(); + this.y = parentModule.category.getY() + parentModule.offsetY; + this.offsetY = offsetY; + } + + public void draw(AtomicInteger offset) { + GL11.glPushMatrix(); + GL11.glScaled(0.5D, 0.5D, 0.5D); + String mode = this.property.getModeString(); + mode = mode.replace("_", " "); + int bruhWidth = (int) (Minecraft.getMinecraft().fontRendererObj.getStringWidth(this.property.getName() + ": ") * 0.5); + Minecraft.getMinecraft().fontRendererObj.drawString(this.property.getName() + ": ", (float) ((this.parentModule.category.getX() + 4) * 2), (float) ((this.parentModule.category.getY() + this.offsetY + 4) * 2), 0xffffffff, true); + Minecraft.getMinecraft().fontRendererObj.drawString(ChatColors.formatColor("&9" + mode.substring(0, 1).toUpperCase() + mode.substring(1).toLowerCase()), (float) ((this.parentModule.category.getX() + 4 + bruhWidth) * 2), (float) ((this.parentModule.category.getY() + this.offsetY + 4) * 2), -1, true); + GL11.glPopMatrix(); + } + + public void update(int mousePosX, int mousePosY) { + this.y = this.parentModule.category.getY() + this.offsetY; + this.x = this.parentModule.category.getX(); + } + + public void setComponentStartAt(int newOffsetY) { + this.offsetY = newOffsetY; + } + + @Override + public int getHeight() { + return 12; + } + + + public void mouseDown(int x, int y, int button) { + if (isHovered(x, y)) { + if (button == 0) { + this.property.nextMode(); + } else if (button == 1) { + this.property.previousMode(); + } + } + } + + @Override + public void mouseReleased(int x, int y, int button) { + + } + + @Override + public void keyTyped(char chatTyped, int keyCode) { + + } + + private boolean isHovered(int x, int y) { + return x > this.x && x < this.x + this.parentModule.category.getWidth() && y > this.y && y < this.y + 11; + } + + @Override + public boolean isVisible() { + return property.isVisible(); + } +} + + + +package myau.ui.components; + +import myau.Myau; +import myau.module.Module; +import myau.module.modules.HUD; +import myau.property.Property; +import myau.property.properties.*; +import myau.ui.Component; +import myau.ui.dataset.impl.FloatSlider; +import myau.ui.dataset.impl.IntSlider; +import myau.ui.dataset.impl.PercentageSlider; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.util.ArrayList; +import java.util.concurrent.atomic.AtomicInteger; + +public class ModuleComponent implements Component { + public Module mod; + public CategoryComponent category; + public int offsetY; + private final ArrayList settings; + public boolean panelExpand; + + public ModuleComponent(Module mod, CategoryComponent category, int offsetY) { + this.mod = mod; + this.category = category; + this.offsetY = offsetY; + this.settings = new ArrayList<>(); + this.panelExpand = false; + int y = offsetY + 12; + if (!Myau.propertyManager.properties.get(mod.getClass()).isEmpty()) { + for (Property baseProperty : Myau.propertyManager.properties.get(mod.getClass())) { + if (baseProperty instanceof BooleanProperty) { + BooleanProperty property = (BooleanProperty) baseProperty; + CheckBoxComponent c = new CheckBoxComponent(property, this, y); + this.settings.add(c); + y += c.getHeight(); + } else if (baseProperty instanceof FloatProperty) { + FloatProperty property = (FloatProperty) baseProperty; + SliderComponent c = new SliderComponent(new FloatSlider(property), this, y); + this.settings.add(c); + y += c.getHeight(); + } else if (baseProperty instanceof IntProperty) { + IntProperty property = (IntProperty) baseProperty; + SliderComponent c = new SliderComponent(new IntSlider(property), this, y); + this.settings.add(c); + y += c.getHeight(); + } else if (baseProperty instanceof PercentProperty) { + PercentProperty property = (PercentProperty) baseProperty; + SliderComponent c = new SliderComponent(new PercentageSlider(property), this, y); + this.settings.add(c); + y += c.getHeight(); + } else if (baseProperty instanceof ModeProperty) { + ModeProperty property = (ModeProperty) baseProperty; + ModeComponent c = new ModeComponent(property, this, y); + this.settings.add(c); + y += c.getHeight(); + } else if (baseProperty instanceof ColorProperty) { + ColorProperty property = (ColorProperty) baseProperty; + ColorSliderComponent c = new ColorSliderComponent(property, this, y); + this.settings.add(c); + y += c.getHeight(); + } else if (baseProperty instanceof TextProperty) { + TextProperty property = (TextProperty) baseProperty; + TextComponent c = new TextComponent(property, this, y); + this.settings.add(c); + y += c.getHeight(); + } + } + } + + this.settings.add(new BindComponent(this, y)); + } + + public void setComponentStartAt(int newOffsetY) { + this.offsetY = newOffsetY; + int y = this.offsetY + 16; + + for (Component c : this.settings) { + c.setComponentStartAt(y); + if (c.isVisible()) { + y += c.getHeight(); + } + } + } + + public void draw(AtomicInteger offset) { + int textColor; + if (this.mod.isEnabled()) { + textColor = ((HUD) Myau.moduleManager.modules.get(HUD.class)).getColor(System.currentTimeMillis(), offset.get()).getRGB(); + } else { + textColor = new Color(102, 102, 102).getRGB(); + } + Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(this.mod.getName(), (float) (this.category.getX() + this.category.getWidth() / 2 - Minecraft.getMinecraft().fontRendererObj.getStringWidth(this.mod.getName()) / 2), (float) (this.category.getY() + this.offsetY + 4), textColor); + if (this.panelExpand && !this.settings.isEmpty()) { + for (Component c : this.settings) { + if (c.isVisible()) { + c.draw(offset); + offset.incrementAndGet(); + } + } + } + + + } + + public int getHeight() { + if (!this.panelExpand) { + return 16; + } else { + int h = 16; + for (Component c : this.settings) { + if (c.isVisible()) { + h += c.getHeight(); + } + } + return h; + } + } + + public void update(int mousePosX, int mousePosY) { + if(!panelExpand) return; + if (!this.settings.isEmpty()) { + for (Component c : this.settings) { + if (c.isVisible()) { + c.update(mousePosX, mousePosY); + } + } + } + + } + + public void mouseDown(int x, int y, int button) { + if (this.isHovered(x, y) && button == 0) { + this.mod.toggle(); + } + + if (this.isHovered(x, y) && button == 1) { + this.panelExpand = !this.panelExpand; + } + + if(!panelExpand) return; + for (Component c : this.settings) { + if (c.isVisible()) { + c.mouseDown(x, y, button); + } + } + + } + + public void mouseReleased(int x, int y, int button) { + if(!panelExpand) return; + for (Component c : this.settings) { + if (c.isVisible()) { + c.mouseReleased(x, y, button); + } + } + + } + + public void keyTyped(char chatTyped, int keyCode) { + if(!panelExpand) return; + for (Component c : this.settings) { + if (c.isVisible()) { + c.keyTyped(chatTyped, keyCode); + } + } + + } + + public boolean isHovered(int x, int y) { + return x > this.category.getX() && x < this.category.getX() + this.category.getWidth() && y > this.category.getY() + this.offsetY && y < this.category.getY() + 16 + this.offsetY; + } + + + @Override + public boolean isVisible() { + return true; + } +} + + + +package myau.ui.components; + +import myau.Myau; +import myau.module.modules.HUD; +import myau.ui.ClickGui; +import myau.ui.Component; +import myau.ui.callback.GuiInput; +import myau.ui.dataset.Slider; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import org.lwjgl.opengl.GL11; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.concurrent.atomic.AtomicInteger; + +public class SliderComponent implements Component { + private final Slider slider; + private final ModuleComponent parentModule; + private int offsetY; + private int x; + private int y; + private boolean dragging = false; + private double sliderWidth; + private long increment = 0; + private long decrement = 0; + + public SliderComponent(Slider slider, ModuleComponent parentModule, int offsetY) { + this.slider = slider; + this.parentModule = parentModule; + this.x = parentModule.category.getX() + parentModule.category.getWidth(); + this.y = parentModule.category.getY() + parentModule.offsetY; + this.offsetY = offsetY; + } + + public void draw(AtomicInteger offset) { + Gui.drawRect(this.parentModule.category.getX() + 4, this.parentModule.category.getY() + this.offsetY + 11, this.parentModule.category.getX() + 4 + this.parentModule.category.getWidth() - 8, this.parentModule.category.getY() + this.offsetY + 15, -12302777); + int sliderStart = this.parentModule.category.getX() + 4; + int sliderEnd = this.parentModule.category.getX() + 4 + (int) this.sliderWidth; + if (sliderEnd - sliderStart > 84) { + sliderEnd = sliderStart + 84; + } + Gui.drawRect(sliderStart, this.parentModule.category.getY() + this.offsetY + 11, sliderEnd, this.parentModule.category.getY() + this.offsetY + 15, ((HUD) Myau.moduleManager.modules.get(HUD.class)).getColor(System.currentTimeMillis(), offset.get()).getRGB()); + GL11.glPushMatrix(); + GL11.glScaled(0.5D, 0.5D, 0.5D); + Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(this.slider.getName() + ": " + this.slider.getValueColorString(), (float) ((int) ((float) (this.parentModule.category.getX() + 4) * 2.0F)), (float) ((int) ((float) (this.parentModule.category.getY() + this.offsetY + 3) * 2.0F)), -1); + GL11.glPopMatrix(); + } + + public void setComponentStartAt(int newOffsetY) { + this.offsetY = newOffsetY; + } + + @Override + public int getHeight() { + return 16; + } + + public void update(int mousePosX, int mousePosY) { + this.y = this.parentModule.category.getY() + this.offsetY; + this.x = this.parentModule.category.getX(); + + double d = Math.min(this.parentModule.category.getWidth() - 8, Math.max(0, mousePosX - this.x)); + this.sliderWidth = (double) (this.parentModule.category.getWidth() - 8) * + (this.slider.getInput() - this.slider.getMin()) / + (this.slider.getMax() - this.slider.getMin()); + + if (this.dragging) { + if (d == 0.0D) { + this.slider.setValue(this.slider.getMin()); + } else { + double rawValue = d / (double) (this.parentModule.category.getWidth() - 8) + * (this.slider.getMax() - this.slider.getMin()) + + this.slider.getMin(); + + double increment = this.slider.getIncrement(); + if (increment > 0) { + rawValue = Math.round(rawValue / increment) * increment; + } + double n = roundToPrecision(rawValue, 2); + n = Math.max(this.slider.getMin(), Math.min(this.slider.getMax(), n)); + this.slider.setValue(n); + } + } + if (this.increment != 0 && this.increment < System.currentTimeMillis()) { + this.increment = System.currentTimeMillis() + 50; + this.slider.stepping(true); + } + if (this.decrement != 0 && this.decrement < System.currentTimeMillis()) { + this.decrement = System.currentTimeMillis() + 50; + this.slider.stepping(false); + } + } + + + private static double roundToPrecision(double v, int precision) { + if (precision < 0) { + return 0.0D; + } else { + BigDecimal bd = new BigDecimal(v); + bd = bd.setScale(precision, RoundingMode.HALF_UP); + return bd.doubleValue(); + } + } + + public void mouseDown(int x, int y, int button) { + if (this.isTextHovered(x, y) && button == 0 && this.parentModule.panelExpand) { + GuiInput.prompt(slider.getName().replace("-", " "), slider.getValueString(), slider::setValueString, ClickGui.getInstance()); + return; + } + + if (this.isLeftHalfHovered(x, y) && this.parentModule.panelExpand) { + if (button == 0) { + this.dragging = true; + } else if(button == 1 && this.decrement == 0) { + this.decrement = System.currentTimeMillis() + 500; + this.slider.stepping(false); + } + } + + if (this.isRightHalfHovered(x, y) && this.parentModule.panelExpand) { + if (button == 0) { + this.dragging = true; + } else if(button == 1 && this.increment == 0) { + this.increment = System.currentTimeMillis() + 500; + this.slider.stepping(true); + } + } + + } + + public void mouseReleased(int x, int y, int button) { + this.dragging = false; + this.increment = 0; + this.decrement = 0; + } + + @Override + public void keyTyped(char chatTyped, int keyCode) { + + } + + public boolean isTextHovered(int x, int y) { + return x > this.x && x < this.x + this.parentModule.category.getWidth() && y > this.y && y < this.y + 8; + } + + public boolean isLeftHalfHovered(int x, int y) { + return x > this.x && x < this.x + this.parentModule.category.getWidth() / 2 + 1 && y > this.y + 8 && y < this.y + 16; + } + + public boolean isRightHalfHovered(int x, int y) { + return x > this.x + this.parentModule.category.getWidth() / 2 && x < this.x + this.parentModule.category.getWidth() && y > this.y + 8 && y < this.y + 16; + } + + + @Override + public boolean isVisible() { + return slider.isVisible(); + } +} + + + +package myau.ui.components; + +import myau.enums.ChatColors; +import myau.property.properties.BooleanProperty; +import myau.property.properties.TextProperty; +import myau.ui.ClickGui; +import myau.ui.Component; +import myau.ui.callback.GuiInput; +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL11; + +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Consumer; + +public class TextComponent implements Component { + private final TextProperty property; + private final ModuleComponent module; + private int offsetY; + private int x; + private int y; + + public TextComponent(TextProperty property, ModuleComponent parentModule, int offsetY) { + this.property = property; + this.module = parentModule; + this.x = parentModule.category.getX() + parentModule.category.getWidth(); + this.y = parentModule.category.getY() + parentModule.offsetY; + this.offsetY = offsetY; + } + + + public void draw(AtomicInteger offset) { + GL11.glPushMatrix(); + GL11.glScaled(0.5D, 0.5D, 0.5D); + Minecraft.getMinecraft().fontRendererObj.drawString(this.property.getName().replace("-", " ") + ": " + ChatColors.formatColor(this.property.formatValue()), (float) ((this.module.category.getX() + 4) * 2), (float) ((this.module.category.getY() + this.offsetY + 5) * 2), -1, false); + GL11.glPopMatrix(); + } + + public void setComponentStartAt(int newOffsetY) { + this.offsetY = newOffsetY; + } + + @Override + public int getHeight() { + return 12; + } + + public void update(int mousePosX, int mousePosY) { + this.y = this.module.category.getY() + this.offsetY; + this.x = this.module.category.getX(); + } + + public void mouseDown(int x, int y, int button) { + if (this.isHovered(x, y) && button == 0 && this.module.panelExpand) { + GuiInput.prompt(property.getName().replace("-", " "), property.getValue(), property::setValue, ClickGui.getInstance()); + } + } + + @Override + public void mouseReleased(int x, int y, int button) { + + } + + @Override + public void keyTyped(char chatTyped, int keyCode) { + + } + + public boolean isHovered(int x, int y) { + return x > this.x && x < this.x + this.module.category.getWidth() && y > this.y && y < this.y + 11; + } + + + @Override + public boolean isVisible() { + return property.isVisible(); + } +} + + + +package myau.ui.dataset; + +public class BindStage { + public static String bind = "Bind"; + public static String binding = "Press a key..."; +} + + + +package myau.ui.dataset.impl; + +import myau.enums.ChatColors; +import myau.property.properties.FloatProperty; +import myau.ui.dataset.Slider; + +public class FloatSlider extends Slider { + private final FloatProperty property; + + public FloatSlider(FloatProperty property) { + this.property = property; + } + + @Override + public double getInput() { + return property.getValue(); + } + + @Override + public double getMin() { + return property.getMinimum(); + } + + @Override + public double getMax() { + return property.getMaximum(); + } + + @Override + public void setValue(double value) { + property.setValue(new Double(value).floatValue()); + } + + @Override + public void setValueString(String value) { + try { + property.setValue(Float.parseFloat(value)); + } catch (Exception ignore) { + } + } + + @Override + public String getName() { + return property.getName().replace("-", " "); + } + + @Override + public String getValueString() { + return property.getValue().toString(); + } + + @Override + public String getValueColorString() { + return ChatColors.formatColor(property.formatValue()); + } + + @Override + public double getIncrement() { + return 0.1; + } + + @Override + public boolean isVisible() { + return property.isVisible(); + } + + @Override + public void stepping(boolean increment) { + if (increment) { + if (property.getValue() >= property.getMaximum()) return; + property.setValue(Math.round(property.getValue() * 10 + 1) / 10.0F); + } else { + if (property.getValue() <= property.getMinimum()) return; + property.setValue(Math.round(property.getValue() * 10 - 1) / 10.0F); + } + } +} + + + +package myau.ui.dataset.impl; + +import myau.enums.ChatColors; +import myau.property.properties.FloatProperty; +import myau.property.properties.IntProperty; +import myau.ui.dataset.Slider; + +public class IntSlider extends Slider { + private final IntProperty property; + + public IntSlider(IntProperty property) { + this.property = property; + } + + @Override + public double getInput() { + return property.getValue(); + } + + @Override + public double getMin() { + return property.getMinimum(); + } + + @Override + public double getMax() { + return property.getMaximum(); + } + + @Override + public void setValue(double value) { + property.setValue(new Double(value).intValue()); + } + + @Override + public void setValueString(String value) { + try { + property.setValue(Integer.parseInt(value)); + } catch (Exception ignore) { + } + } + + @Override + public String getName() { + return property.getName().replace("-", " "); + } + + @Override + public String getValueString() { + return property.getValue().toString(); + } + + @Override + public String getValueColorString() { + return ChatColors.formatColor(property.formatValue()); + } + + @Override + public double getIncrement() { + return 1; + } + + @Override + public boolean isVisible() { + return property.isVisible(); + } + + @Override + public void stepping(boolean increment) { + if (increment) { + if (property.getValue() >= property.getMaximum()) return; + property.setValue(property.getValue() + 1); + } else { + if (property.getValue() <= property.getMinimum()) return; + property.setValue(property.getValue() - 1); + } + } +} + + + +package myau.ui.dataset.impl; + +import myau.enums.ChatColors; +import myau.property.properties.IntProperty; +import myau.property.properties.PercentProperty; +import myau.ui.dataset.Slider; + +public class PercentageSlider extends Slider { + private final PercentProperty property; + + public PercentageSlider(PercentProperty property) { + this.property = property; + } + + @Override + public double getInput() { + return property.getValue(); + } + + @Override + public double getMin() { + return property.getMinimum(); + } + + @Override + public double getMax() { + return property.getMaximum(); + } + + @Override + public void setValue(double value) { + property.setValue(new Double(value).intValue()); + } + + @Override + public void setValueString(String value) { + try { + property.setValue(Integer.parseInt(value)); + } catch (Exception ignore) { + } + } + + @Override + public String getName() { + return property.getName().replace("-", " "); + } + + @Override + public String getValueString() { + return property.getValue().toString(); + } + + @Override + public String getValueColorString() { + return ChatColors.formatColor(property.formatValue()); + } + + @Override + public double getIncrement() { + return 1; + } + + @Override + public boolean isVisible() { + return property.isVisible(); + } + + @Override + public void stepping(boolean increment) { + if (increment) { + if (property.getValue() >= property.getMaximum()) return; + property.setValue(property.getValue() + 1); + } else { + if (property.getValue() <= property.getMinimum()) return; + property.setValue(property.getValue() - 1); + } + } +} + + + +package myau.ui.dataset; + +public abstract class Slider { + public abstract double getInput(); + + public abstract double getMin(); + + public abstract double getMax(); + + public abstract void setValue(double value); + + public abstract void setValueString(String value); + + public abstract String getName(); + + public abstract String getValueString(); + + public abstract String getValueColorString(); + + public abstract double getIncrement(); + + public abstract boolean isVisible(); + + public abstract void stepping(boolean increment); +} + + + +package myau.util; + +import net.minecraft.block.*; +import net.minecraft.block.material.Material; +import net.minecraft.client.Minecraft; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; + +public class BlockUtil { + private static final Minecraft mc = Minecraft.getMinecraft(); + + public static boolean isReplaceable(BlockPos blockPos) { + return BlockUtil.isReplaceable(BlockUtil.mc.theWorld.getBlockState(blockPos).getBlock()); + } + + public static boolean isReplaceable(Block block) { + if (!block.getMaterial().isReplaceable()) return false; + if (!(block instanceof BlockSnow)) return true; + return !(block.getBlockBoundsMaxY() > 0.125); + } + + public static boolean isInteractable(BlockPos blockPos) { + return BlockUtil.isInteractable(BlockUtil.mc.theWorld.getBlockState(blockPos).getBlock()); + } + + public static boolean isInteractable(Block block) { + if (block instanceof BlockContainer) return true; + if (block instanceof BlockWorkbench) return true; + if (block instanceof BlockAnvil) return true; + if (block instanceof BlockBed) return true; + if (block instanceof BlockDoor) { + if (block.getMaterial() != Material.iron) return true; + } + if (block instanceof BlockTrapDoor) return true; + if (block instanceof BlockFenceGate) return true; + if (block instanceof BlockFence) return true; + if (block instanceof BlockButton) return true; + if (block instanceof BlockLever) return true; + return block instanceof BlockJukebox; + } + + public static boolean isSolid(Block block) { + if (block instanceof BlockStairs) return false; + if (block instanceof BlockSlab) return false; + if (block instanceof BlockEndPortalFrame) return false; + if (block instanceof BlockEndPortal) return false; + if (block instanceof BlockVine) return false; + if (block instanceof BlockPumpkin) return false; + if (block instanceof BlockCactus) return false; + if (block instanceof BlockBush) return false; + if (block instanceof BlockFalling) return false; + if (block instanceof BlockWeb) return false; + if (block instanceof BlockPane) return false; + if (block instanceof BlockCarpet) return false; + if (block instanceof BlockSnow) return false; + if (block instanceof BlockFence) return false; + if (block instanceof BlockFenceGate) return false; + if (block instanceof BlockWall) return false; + if (block instanceof BlockLadder) return false; + if (block instanceof BlockTorch) return false; + if (block instanceof BlockRedstoneWire) return false; + if (block instanceof BlockRedstoneDiode) return false; + if (block instanceof BlockBasePressurePlate) return false; + if (block instanceof BlockTripWire) return false; + if (block instanceof BlockTripWireHook) return false; + if (block instanceof BlockRailBase) return false; + if (block instanceof BlockSlime) return false; + return !(block instanceof BlockTNT); + } + + public static Vec3 getHitVec(BlockPos blockPos, EnumFacing enumFacing, float yaw, float pitch) { + MovingObjectPosition movingObjectPosition = RotationUtil.rayTrace(yaw, pitch, BlockUtil.mc.playerController.getBlockReachDistance(), 1.0f); + if (movingObjectPosition != null) { + if (movingObjectPosition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + if (movingObjectPosition.getBlockPos().equals(blockPos)) { + if (movingObjectPosition.sideHit == enumFacing) { + return movingObjectPosition.hitVec; + } + } + } + } + return BlockUtil.getClickVec(blockPos, enumFacing); + } + + public static Vec3 getClickVec(BlockPos blockPos, EnumFacing enumFacing) { + Block block = BlockUtil.mc.theWorld.getBlockState(blockPos).getBlock(); + Vec3 vec3 = new Vec3((double) blockPos.getX() + Math.min(Math.max(RandomUtil.nextDouble(0.0, 1.0), block.getBlockBoundsMinX()), block.getBlockBoundsMaxX()), (double) blockPos.getY() + Math.min(Math.max(RandomUtil.nextDouble(0.0, 1.0), block.getBlockBoundsMinY()), block.getBlockBoundsMaxY()), (double) blockPos.getZ() + Math.min(Math.max(RandomUtil.nextDouble(0.0, 1.0), block.getBlockBoundsMinZ()), block.getBlockBoundsMaxZ())); + switch (enumFacing) { + default: { + return new Vec3(vec3.xCoord, (double) blockPos.getY() + block.getBlockBoundsMinY(), vec3.zCoord); + } + case UP: { + return new Vec3(vec3.xCoord, (double) blockPos.getY() + block.getBlockBoundsMaxY(), vec3.zCoord); + } + case NORTH: { + return new Vec3(vec3.xCoord, vec3.yCoord, (double) blockPos.getZ() + block.getBlockBoundsMinZ()); + } + case EAST: { + return new Vec3((double) blockPos.getX() + block.getBlockBoundsMaxX(), vec3.yCoord, vec3.zCoord); + } + case SOUTH: { + return new Vec3(vec3.xCoord, vec3.yCoord, (double) blockPos.getZ() + block.getBlockBoundsMaxZ()); + } + case WEST: + } + return new Vec3((double) blockPos.getX() + block.getBlockBoundsMinX(), vec3.yCoord, vec3.zCoord); + } +} + + + +package myau.util; + +import myau.enums.ChatColors; +import net.minecraft.client.Minecraft; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IChatComponent; + +public class ChatUtil { + private static final Minecraft mc = Minecraft.getMinecraft(); + + public static void send(IChatComponent iChatComponent) { + if (ChatUtil.mc.thePlayer != null) { + ChatUtil.mc.thePlayer.addChatMessage(iChatComponent); + } + } + + public static void sendFormatted(String string) { + ChatUtil.send(new ChatComponentText(ChatColors.formatColor(string))); + } + + public static void sendRaw(String string) { + ChatUtil.send(new ChatComponentText(string)); + } + + public static void sendMessage(String string) { + if (ChatUtil.mc.thePlayer != null) { + ChatUtil.mc.thePlayer.sendChatMessage(string); + } + } +} + + + +package myau.util; + +import java.awt.*; + +public class ColorUtil { + public static final Color RED = new Color(255, 0, 0); + public static final Color GOLD = new Color(255, 165, 0); + public static final Color YELLOW = new Color(255, 255, 0); + public static final Color GREEN = new Color(0, 255, 0); + + public static Color fromHSB(float hue, float saturation, float brightness) { + return new Color(Color.HSBtoRGB(hue, saturation, brightness)); + } + + public static Color interpolate(float progress, Color startColor, Color endColor) { + progress = Math.min(Math.max(progress, 0.0f), 1.0f); + return new Color((int) ((float) startColor.getRed() + progress * (float) (endColor.getRed() - startColor.getRed())), (int) ((float) startColor.getGreen() + progress * (float) (endColor.getGreen() - startColor.getGreen())), (int) ((float) startColor.getBlue() + progress * (float) (endColor.getBlue() - startColor.getBlue()))); + } + + public static Color getHealthBlend(float percent) { + if (percent >= 0.9f) { + return GREEN; + } + if (percent >= 0.55f) { + return ColorUtil.interpolate((percent - 0.55f) / 0.35f, YELLOW, GREEN); + } + if (percent >= 0.45f) { + return YELLOW; + } + if (percent >= 0.1f) { + return ColorUtil.interpolate((percent - 0.1f) / 0.35f, RED, YELLOW); + } + return RED; + } + + public static Color darker(Color color, float factor) { + return ColorUtil.scale(color, factor, color.getAlpha()); + } + + public static Color scale(Color color, float scaleFactor, int alpha) { + return new Color(Math.min(Math.max((int) ((float) color.getRed() * scaleFactor), 0), 255), Math.min(Math.max((int) ((float) color.getGreen() * scaleFactor), 0), 255), Math.min(Math.max((int) ((float) color.getBlue() * scaleFactor), 0), 255), alpha); + } +} + + + +package myau.util; + +import com.google.common.collect.Multimap; +import myau.mixin.IAccessorItemSword; +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.init.Items; +import net.minecraft.item.*; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.potion.PotionEffect; + +import java.util.ArrayList; +import java.util.Iterator; + +public class ItemUtil { + private static final Minecraft mc = Minecraft.getMinecraft(); + private static final ArrayList specialItems = new SpecialItems(); + + public static boolean isNotSpecialItem(ItemStack itemStack) { + if (itemStack == null) { + return false; + } + Item item = itemStack.getItem(); + if (item instanceof ItemPotion) { + return ((ItemPotion) item).getEffects(itemStack).stream().map(PotionEffect::getPotionID).noneMatch(specialItems::contains); + } + if (item instanceof ItemEnderPearl) return false; + if (item instanceof ItemFood) { + if (item != Items.spider_eye) return false; + } + if (item instanceof ItemMonsterPlacer) return false; + return item != Items.nether_star; + } + + public static boolean isBlock(ItemStack itemStack) { + if (itemStack == null || itemStack.stackSize < 1) { + return false; + } + Item item = itemStack.getItem(); + if (item instanceof ItemBlock) { + return ItemUtil.isContainerBlock((ItemBlock) item); + } + return false; + } + + public static boolean isProjectile(ItemStack itemStack) { + if (itemStack == null || itemStack.stackSize < 1) { + return false; + } + Item item = itemStack.getItem(); + if (item instanceof ItemEgg) return true; + if (item instanceof ItemSnowball) return true; + return false; + } + + public static boolean isContainerBlock(ItemBlock itemBlock) { + Block block = itemBlock.getBlock(); + if (BlockUtil.isInteractable(block)) return false; + return BlockUtil.isSolid(block); + } + + public static double getAttackBonus(ItemStack itemStack) { + double attackBonus = 0.0; + if (itemStack == null) { + return 0.0; + } + Multimap multimap = itemStack.getAttributeModifiers(); + for (String attributeName : multimap.keySet()) { + if (!attributeName.equals("generic.attackDamage")) continue; + Iterator iterator = multimap.get(attributeName).iterator(); + if (!iterator.hasNext()) break; + attackBonus += (iterator.next()).getAmount(); + break; + } + if (itemStack.isItemEnchanted()) { + attackBonus = attackBonus + (double) EnchantmentHelper.getEnchantmentLevel(Enchantment.fireAspect.effectId, itemStack) + (double) EnchantmentHelper.getEnchantmentLevel(Enchantment.sharpness.effectId, itemStack) * 1.25; + } + return attackBonus; + } + + public static float getToolEfficiency(ItemStack itemStack) { + float efficiency = 1.0f; + if (itemStack != null) { + if (itemStack.getItem() instanceof ItemTool) { + int enchantLevel; + efficiency = ((ItemTool) itemStack.getItem()).getToolMaterial().getEfficiencyOnProperMaterial(); + if (efficiency > 1.0f && (enchantLevel = EnchantmentHelper.getEnchantmentLevel(Enchantment.efficiency.effectId, itemStack)) > 0) { + efficiency += (float) (enchantLevel * enchantLevel + 1); + } + } + } + return efficiency; + } + + public static float getToolEfficiency(ItemStack itemStack, Block block) { + float efficiency = 1.0f; + if (itemStack != null) { + efficiency = itemStack.canHarvestBlock(block) || !(itemStack.getItem() instanceof ItemPickaxe) + ? itemStack.getStrVsBlock(block) : 1.0f; + if (itemStack.getItem() instanceof ItemTool) { + int enchantLevel; + if (efficiency > 1.0f && (enchantLevel = EnchantmentHelper.getEnchantmentLevel(Enchantment.efficiency.effectId, itemStack)) > 0) { + efficiency += (float) (enchantLevel * enchantLevel + 1); + } + } + } + return efficiency; + } + + public static double getArmorProtection(ItemStack itemStack) { + double protection = 0.0; + if (itemStack != null) { + if (itemStack.getItem() instanceof ItemArmor) { + protection = 0.0 + (double) ((ItemArmor) itemStack.getItem()).damageReduceAmount; + if (itemStack.isItemEnchanted()) { + protection += (double) EnchantmentHelper.getEnchantmentLevel(Enchantment.protection.effectId, itemStack) * 0.8; + protection += (double) EnchantmentHelper.getEnchantmentLevel(Enchantment.featherFalling.effectId, itemStack) * 0.05; + protection += (double) EnchantmentHelper.getEnchantmentLevel(Enchantment.projectileProtection.effectId, itemStack) * 0.01; + } + } + } + return protection; + } + + public static double getBowAttackBonus(ItemStack itemStack) { + double attackBonus = 0.0; + if (itemStack != null) { + if (itemStack.getItem() instanceof ItemBow) { + attackBonus = 2; + if (itemStack.isItemEnchanted()) { + int power = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, itemStack); + if (power > 0) { + attackBonus += (double) (power + 1) * 0.25; + } + attackBonus += (double) EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, itemStack) * 0.25; + attackBonus += (double) EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, itemStack) * 0.05; + } + } + } + return attackBonus; + } + + public static int findSwordInInventorySlot(int startSlot, boolean checkDurability) { + int bestSlot = -1; + double bestAttackBonus = 0.0; + if (startSlot < 0) return bestSlot; + for (int i = 0; i < 36; ++i) { + int currentSlot = (startSlot + i) % 36; + ItemStack itemStack = ItemUtil.mc.thePlayer.inventory.getStackInSlot(currentSlot); + if (itemStack == null) continue; + if (!(itemStack.getItem() instanceof ItemSword)) continue; + if (checkDurability) { + if (itemStack.isItemDamaged()) { + if (itemStack.getMaxDamage() - itemStack.getItemDamage() < 30) { + continue; + } + } + } + double attackBonus = ItemUtil.getAttackBonus(itemStack); + if (!(attackBonus > bestAttackBonus)) continue; + bestSlot = currentSlot; + bestAttackBonus = attackBonus; + } + return bestSlot; + } + + public static int findBowInventorySlot(int startSlot, boolean checkDurability) { + int bestSlot = -1; + double bestAttackBonus = 0.0; + if (startSlot < 0) return bestSlot; + for (int i = 0; i < 36; ++i) { + int currentSlot = (startSlot + i) % 36; + ItemStack itemStack = ItemUtil.mc.thePlayer.inventory.getStackInSlot(currentSlot); + if (itemStack == null) continue; + if (!(itemStack.getItem() instanceof ItemBow)) continue; + if (checkDurability) { + if (itemStack.isItemDamaged()) { + if (itemStack.getMaxDamage() - itemStack.getItemDamage() < 30) { + continue; + } + } + } + double attackBonus = ItemUtil.getBowAttackBonus(itemStack); + if (!(attackBonus > bestAttackBonus)) continue; + bestSlot = currentSlot; + bestAttackBonus = attackBonus; + } + return bestSlot; + } + + public static int findInventorySlot(String toolClass, int startSlot, boolean checkDurability) { + int bestSlot = -1; + float bestEfficiency = 1.0f; + if (startSlot < 0) return bestSlot; + for (int i = 0; i < 36; ++i) { + int currentSlot = (startSlot + i) % 36; + ItemStack itemStack = ItemUtil.mc.thePlayer.inventory.getStackInSlot(currentSlot); + if (itemStack == null) continue; + if (!(itemStack.getItem() instanceof ItemTool)) continue; + if (!itemStack.getItem().getToolClasses(itemStack).contains(toolClass)) continue; + if (checkDurability) { + if (itemStack.isItemDamaged()) { + if (itemStack.getMaxDamage() - itemStack.getItemDamage() < 30) { + continue; + } + } + } + float efficiency = ItemUtil.getToolEfficiency(itemStack); + if (!(efficiency > bestEfficiency)) continue; + bestSlot = currentSlot; + bestEfficiency = efficiency; + } + return bestSlot; + } + + public static int findInventorySlot(int currentSlot, Block block) { + ItemStack currentItem = ItemUtil.mc.thePlayer.inventory.getStackInSlot(currentSlot); + int bestSlot = currentSlot; + float bestStrength = getToolEfficiency(currentItem, block); + for (int i = 0; i < 9; ++i) { + ItemStack itemStack = ItemUtil.mc.thePlayer.inventory.getStackInSlot(i); + if (itemStack == null) continue; + float strength = getToolEfficiency(itemStack, block); + if (!(strength > bestStrength)) continue; + bestSlot = i; + bestStrength = strength; + } + return bestSlot; + } + + public static int findAndurilHotbarSlot(int currentSlot) { + for (int i = currentSlot; i < currentSlot + 9; ++i) { + ItemStack itemStack = ItemUtil.mc.thePlayer.inventory.getStackInSlot(i % 9); + if (itemStack == null) continue; + + if (itemStack.getItem() instanceof ItemSword && itemStack.hasTagCompound()) { + IAccessorItemSword itemSword = (IAccessorItemSword) itemStack.getItem(); + if (itemSword.getMaterial() == Item.ToolMaterial.IRON && itemStack.getTagCompound().hasKey("display", 10)) { + NBTTagList nbttaglist = itemStack.getTagCompound().getCompoundTag("display").getTagList("Lore", 8); + for (int j = 0; j < nbttaglist.tagCount(); ++j) { + if (nbttaglist.getStringTagAt(j).contains("§9Justice")) { + return i % 9; + } + } + } + } + } + return -1; + } + + public static int findArmorInventorySlot(int armorType, boolean checkDurability) { + int bestSlot = -1; + double bestProtection = 0.0; + for (int i = 0; i < 40; ++i) { + ItemStack itemStack = ItemUtil.mc.thePlayer.inventory.getStackInSlot(i); + if (itemStack == null) continue; + if (!(itemStack.getItem() instanceof ItemArmor)) continue; + if (((ItemArmor) itemStack.getItem()).armorType != armorType) { + continue; + } + if (checkDurability) { + if (itemStack.isItemDamaged()) { + if (itemStack.getMaxDamage() - itemStack.getItemDamage() < 30) { + continue; + } + } + } + double protection = ItemUtil.getArmorProtection(itemStack); + if (!(protection >= bestProtection)) continue; + bestSlot = i; + bestProtection = protection; + } + return bestSlot; + } + + public static int findInventorySlot(int startSlot, ItemType itemType) { + int bestSlot = -1; + int maxStackSize = 0; + if (startSlot < 0) startSlot = 0; + for (int i = 0; i < 36; ++i) { + int currentSlot = (startSlot + i) % 36; + ItemStack itemStack = ItemUtil.mc.thePlayer.inventory.getStackInSlot(currentSlot); + if (itemStack == null) continue; + if (!itemType.contains(itemStack)) continue; + if (maxStackSize >= itemStack.stackSize) continue; + bestSlot = currentSlot; + maxStackSize = itemStack.stackSize; + } + return bestSlot; + } + + public static int findInventorySlot(ItemType itemType) { + int stackSize = 0; + for (int i = 0; i < 36; ++i) { + ItemStack itemStack = ItemUtil.mc.thePlayer.inventory.getStackInSlot(i); + if (itemStack == null) continue; + if (!itemType.contains(itemStack)) continue; + stackSize += itemStack.stackSize; + } + return stackSize; + } + + public static boolean hasRawUnbreakingEnchant() { + ItemStack itemStack = ItemUtil.mc.thePlayer.getHeldItem(); + if (itemStack == null) { + return false; + } + if (itemStack.hasTagCompound()) { + NBTTagCompound tag = itemStack.getTagCompound(); + if (tag.hasKey("ExtraAttributes")) { + NBTTagCompound extra = tag.getCompoundTag("ExtraAttributes"); + if (extra.hasKey("UHCid")) { + long id = extra.getLong("UHCid"); + if (id == 50006L || id == 50009L) { + return true; + } + } + } + if (tag.hasKey("HideFlags") + && itemStack.getItem() instanceof ItemSpade + && ((ItemSpade) itemStack.getItem()).getToolMaterial() == Item.ToolMaterial.EMERALD) { + return true; + } + } + if (itemStack.getItem() instanceof ItemEnchantedBook) { + return false; + } + if (EnchantmentHelper.getEnchantments(itemStack).containsKey(19)) { + return true; + } + return itemStack.getItem() instanceof ItemSword; + } + + public static boolean isHoldingSword() { + ItemStack itemStack = ItemUtil.mc.thePlayer.getHeldItem(); + if (itemStack == null) { + return false; + } + return itemStack.getItem() instanceof ItemSword; + } + + public static boolean isHoldingTool() { + ItemStack itemStack = ItemUtil.mc.thePlayer.getHeldItem(); + if (itemStack == null) { + return false; + } + return itemStack.getItem() instanceof ItemTool; + } + + public static boolean isEating() { + ItemStack itemStack = ItemUtil.mc.thePlayer.getHeldItem(); + if (itemStack == null) { + return false; + } + if (ItemPotion.isSplash(itemStack.getItem().getMetadata(itemStack))) { + return false; + } + return itemStack.getItemUseAction() == EnumAction.EAT || itemStack.getItemUseAction() == EnumAction.DRINK; + } + + public static boolean isUsingBow() { + ItemStack itemStack = ItemUtil.mc.thePlayer.getHeldItem(); + if (itemStack == null) { + return false; + } + return itemStack.getItem() instanceof ItemBow; + } + + public static boolean isHoldingNonEmpty() { + ItemStack itemStack = ItemUtil.mc.thePlayer.getHeldItem(); + if (itemStack == null || itemStack.stackSize < 1) { + return false; + } + return itemStack.getItem() instanceof ItemBlock; + } + + public static boolean isHoldingBlock() { + return ItemUtil.isBlock(ItemUtil.mc.thePlayer.getHeldItem()); + } + + public static boolean hasHoldItem() { + ItemStack itemStack = ItemUtil.mc.thePlayer.getHeldItem(); + if (itemStack == null || itemStack.stackSize < 1) { + return false; + } + return itemStack.getItem() instanceof ItemFireball; + } + + static final class SpecialItems extends ArrayList { + SpecialItems() { + this.add(1); + this.add(3); + this.add(5); + this.add(6); + this.add(8); + this.add(10); + this.add(11); + this.add(12); + this.add(14); + this.add(21); + this.add(22); + } + } + + public enum ItemType { + Block { + public boolean contains(ItemStack itemStack) { + return isBlock(itemStack); + } + }, + Projectile { + public boolean contains(ItemStack itemStack) { + return isProjectile(itemStack); + } + }, + FishRod { + public boolean contains(ItemStack itemStack) { + return itemStack.getItem() instanceof ItemFishingRod; + } + }, + GoldApple { + public boolean contains(ItemStack itemStack) { + return itemStack.getItem() instanceof ItemAppleGold; + } + }, + Arrow { + public boolean contains(ItemStack itemStack) { + return itemStack.getItem() == Items.arrow; + } + }; + abstract public boolean contains(ItemStack itemStack); + } +} + + + +package myau.util; + +import net.minecraft.client.settings.KeyBinding; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; + +public class KeyBindUtil { + public static String getKeyName(int keyCode) { + if (keyCode < 0) { + int mouseButton = keyCode + 100; + switch (mouseButton) { + case 0: + return "LMB"; + case 1: + return "RMB"; + case 2: + return "MMB"; + case 3: + return "MOUSE3"; + case 4: + return "MOUSE4"; + case 5: + return "MOUSE5"; + case 6: + return "MOUSE6"; + case 7: + return "MOUSE7"; + default: + String buttonName = Mouse.getButtonName(mouseButton); + return buttonName != null ? buttonName : "MOUSE" + mouseButton; + } + } + return Keyboard.getKeyName(keyCode); + } + + public static boolean isKeyDown(int keyCode) { + return keyCode < 0 ? Mouse.isButtonDown(keyCode + 100) : Keyboard.isKeyDown(keyCode); + } + + public static void updateKeyState(int keyCode) { + KeyBindUtil.setKeyBindState(keyCode, keyCode < 0 ? Mouse.isButtonDown(keyCode + 100) : Keyboard.isKeyDown(keyCode)); + } + + public static void setKeyBindState(int keyCode, boolean pressed) { + KeyBinding.setKeyBindState(keyCode, pressed); + } + + public static void pressKeyOnce(int keyCode) { + KeyBinding.onTick(keyCode); + } +} + + + +package myau.util; + +import myau.Myau; +import myau.management.RotationState; +import myau.module.modules.TargetStrafe; +import net.minecraft.client.Minecraft; +import net.minecraft.potion.Potion; +import net.minecraft.util.BlockPos; +import net.minecraft.util.MathHelper; + +public class MoveUtil { + private static final Minecraft mc = Minecraft.getMinecraft(); + + public static boolean isForwardPressed() { + if (MoveUtil.mc.gameSettings.keyBindForward.isKeyDown() != MoveUtil.mc.gameSettings.keyBindBack.isKeyDown()) + return true; + return MoveUtil.mc.gameSettings.keyBindLeft.isKeyDown() != MoveUtil.mc.gameSettings.keyBindRight.isKeyDown(); + } + + public static int getForwardValue() { + int forwardValue = 0; + if (MoveUtil.mc.gameSettings.keyBindForward.isKeyDown()) { + ++forwardValue; + } + if (MoveUtil.mc.gameSettings.keyBindBack.isKeyDown()) { + --forwardValue; + } + return forwardValue; + } + + public static int getLeftValue() { + int leftValue = 0; + if (MoveUtil.mc.gameSettings.keyBindLeft.isKeyDown()) { + ++leftValue; + } + if (MoveUtil.mc.gameSettings.keyBindRight.isKeyDown()) { + --leftValue; + } + return leftValue; + } + + public static float getMoveYaw() { + return MoveUtil.adjustYaw(RotationState.isActived() ? RotationState.getSmoothedYaw() : MoveUtil.mc.thePlayer.rotationYaw, MoveUtil.mc.thePlayer.movementInput.moveForward, MoveUtil.mc.thePlayer.movementInput.moveStrafe); + } + + public static float adjustYaw(float yaw, float forward, float strafe) { + TargetStrafe targetStrafe = (TargetStrafe) Myau.moduleManager.modules.get(TargetStrafe.class); + if (targetStrafe.isEnabled()) { + if (!Float.isNaN(targetStrafe.getTargetYaw())) { + return targetStrafe.getTargetYaw(); + } + } + if (forward < 0.0f) { + yaw += 180.0f; + } + if (strafe != 0.0f) { + float multiplier = forward == 0.0f ? 1.0f : 0.5f * Math.signum(forward); + yaw += -90.0f * multiplier * Math.signum(strafe); + } + return MathHelper.wrapAngleTo180_float(yaw); + } + + public static float getDirectionYaw() { + if (MoveUtil.getSpeed() == 0.0) { + return MathHelper.wrapAngleTo180_float(MoveUtil.mc.thePlayer.rotationYaw); + } + return MathHelper.wrapAngleTo180_float((float) Math.toDegrees(Math.atan2(MoveUtil.mc.thePlayer.motionZ, MoveUtil.mc.thePlayer.motionX)) - 90.0f); + } + + public static double getBaseMoveSpeed() { + double baseSpeed = 0.28015; + if (MoveUtil.getSpeedTime() > 0) { + baseSpeed = 0.28015 * (1.0 + 0.15 * (double) MoveUtil.getSpeedLevel()); + } + return baseSpeed; + } + + public static double getBaseJumpHigh(int speedLevel) { + double jumpHeight = 0.452; + if (speedLevel == 1) { + jumpHeight = 0.49720000000000003; + } else if (speedLevel >= 2) { + jumpHeight *= 1.2; + } + return jumpHeight; + } + + public static double getJumpMotion() { + int speedLevel = 0; + if (MoveUtil.getSpeedTime() > 0) { + speedLevel = MoveUtil.getSpeedLevel(); + } + return MoveUtil.getBaseJumpHigh(speedLevel); + } + + public static double getSpeed() { + return MoveUtil.getSpeed(MoveUtil.mc.thePlayer.motionX, MoveUtil.mc.thePlayer.motionZ); + } + + public static double getSpeed(double motionX, double motionZ) { + return Math.hypot(motionX, motionZ); + } + + public static void setSpeed(double speed) { + MoveUtil.setSpeed(speed, MoveUtil.getDirectionYaw()); + } + + public static void setSpeed(double speed, float yaw) { + MoveUtil.mc.thePlayer.motionX = -Math.sin(Math.toRadians(yaw)) * speed; + MoveUtil.mc.thePlayer.motionZ = Math.cos(Math.toRadians(yaw)) * speed; + } + + public static void addSpeed(double speed, float yaw) { + MoveUtil.mc.thePlayer.motionX += -Math.sin(Math.toRadians(yaw)) * speed; + MoveUtil.mc.thePlayer.motionZ += Math.cos(Math.toRadians(yaw)) * speed; + } + + public static int getSpeedLevel() { + int speedLevel = 0; + if (MoveUtil.mc.thePlayer.isPotionActive(Potion.moveSpeed)) { + speedLevel = (MoveUtil.mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier() + 1); + } + return speedLevel; + } + + public static int getSpeedTime() { + if (MoveUtil.mc.thePlayer.isPotionActive(Potion.moveSpeed)) { + return MoveUtil.mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getDuration(); + } + return 0; + } + + public static float getAllowedHorizontalDistance() { + float slipperiness = MoveUtil.mc.thePlayer.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(MoveUtil.mc.thePlayer.posX), MathHelper.floor_double(MoveUtil.mc.thePlayer.getEntityBoundingBox().minY) - 1, MathHelper.floor_double(MoveUtil.mc.thePlayer.posZ))).getBlock().slipperiness * 0.91f; + return MoveUtil.mc.thePlayer.getAIMoveSpeed() * (0.16277136f / (slipperiness * slipperiness * slipperiness)); + } + + public static double[] predictMovement() { + float strafeInput = (float) MoveUtil.getLeftValue() * 0.98f; + float forwardInput = (float) MoveUtil.getForwardValue() * 0.98f; + float inputMagnitude = strafeInput * strafeInput + forwardInput * forwardInput; + if (inputMagnitude >= 1.0E-4f) { + inputMagnitude = MathHelper.sqrt_float(inputMagnitude); + if (inputMagnitude < 1.0f) { + inputMagnitude = 1.0f; + } + inputMagnitude = MoveUtil.getAllowedHorizontalDistance() / inputMagnitude; + float sinYaw = MathHelper.sin(MoveUtil.mc.thePlayer.rotationYaw * (float) Math.PI / 180.0f); + float cosYaw = MathHelper.cos(MoveUtil.mc.thePlayer.rotationYaw * (float) Math.PI / 180.0f); + strafeInput *= inputMagnitude; + forwardInput *= inputMagnitude; + return new double[]{strafeInput * cosYaw - forwardInput * sinYaw, forwardInput * cosYaw + strafeInput * sinYaw}; + } + return new double[]{0.0, 0.0}; + } + + public static void fixStrafe(float targetYaw) { + float angle = MathHelper.wrapAngleTo180_float(MoveUtil.adjustYaw(MoveUtil.mc.thePlayer.rotationYaw, MoveUtil.getForwardValue(), MoveUtil.getLeftValue()) - targetYaw + 22.5f); + switch ((int) (angle + 180.0f) / 45 % 8) { + case 0: { + MoveUtil.mc.thePlayer.movementInput.moveForward = -1.0f; + MoveUtil.mc.thePlayer.movementInput.moveStrafe = 0.0f; + break; + } + case 1: { + MoveUtil.mc.thePlayer.movementInput.moveForward = -1.0f; + MoveUtil.mc.thePlayer.movementInput.moveStrafe = 1.0f; + break; + } + case 2: { + MoveUtil.mc.thePlayer.movementInput.moveForward = 0.0f; + MoveUtil.mc.thePlayer.movementInput.moveStrafe = 1.0f; + break; + } + case 3: { + MoveUtil.mc.thePlayer.movementInput.moveForward = 1.0f; + MoveUtil.mc.thePlayer.movementInput.moveStrafe = 1.0f; + break; + } + case 4: { + MoveUtil.mc.thePlayer.movementInput.moveForward = 1.0f; + MoveUtil.mc.thePlayer.movementInput.moveStrafe = 0.0f; + break; + } + case 5: { + MoveUtil.mc.thePlayer.movementInput.moveForward = 1.0f; + MoveUtil.mc.thePlayer.movementInput.moveStrafe = -1.0f; + break; + } + case 6: { + MoveUtil.mc.thePlayer.movementInput.moveForward = 0.0f; + MoveUtil.mc.thePlayer.movementInput.moveStrafe = -1.0f; + break; + } + case 7: { + MoveUtil.mc.thePlayer.movementInput.moveForward = -1.0f; + MoveUtil.mc.thePlayer.movementInput.moveStrafe = -1.0f; + break; + } + } + if (MoveUtil.mc.thePlayer.movementInput.sneak) { + MoveUtil.mc.thePlayer.movementInput.moveForward *= 0.3f; + MoveUtil.mc.thePlayer.movementInput.moveStrafe *= 0.3f; + } + } +} + + + +package myau.util; + +import net.minecraft.client.Minecraft; +import net.minecraft.network.Packet; + +public class PacketUtil { + private static final Minecraft mc = Minecraft.getMinecraft(); + + public static void sendPacket(Packet packet) { + mc.getNetHandler().getNetworkManager().sendPacket(packet); + } + + public static void sendPacketNoEvent(Packet packet) { + mc.getNetHandler().getNetworkManager().sendPacket(packet, null); + } +} + + + +package myau.util; + +import myau.Myau; +import myau.module.modules.KeepSprint; +import net.minecraft.block.Block; +import net.minecraft.block.BlockAir; +import net.minecraft.client.Minecraft; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureAttribute; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.network.play.server.S12PacketEntityVelocity; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.stats.AchievementList; +import net.minecraft.stats.StatList; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.DamageSource; +import net.minecraft.util.MathHelper; +import net.minecraftforge.common.ForgeHooks; + +public class PlayerUtil { + private static final Minecraft mc = Minecraft.getMinecraft(); + + public static boolean isJumping() { + return mc.currentScreen == null && KeyBindUtil.isKeyDown(mc.gameSettings.keyBindJump.getKeyCode()); + } + + public static boolean isSneaking() { + return mc.currentScreen == null && KeyBindUtil.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode()); + } + + public static boolean isMovingLeft() { + return mc.currentScreen == null && KeyBindUtil.isKeyDown(mc.gameSettings.keyBindLeft.getKeyCode()); + } + + public static boolean isMovingRight() { + return mc.currentScreen == null && KeyBindUtil.isKeyDown(mc.gameSettings.keyBindRight.getKeyCode()); + } + + public static boolean isAttacking() { + return mc.currentScreen == null && KeyBindUtil.isKeyDown(mc.gameSettings.keyBindAttack.getKeyCode()); + } + + public static boolean isUsingItem() { + return mc.currentScreen == null && KeyBindUtil.isKeyDown(mc.gameSettings.keyBindUseItem.getKeyCode()); + } + + public static boolean canFly(float fallThreshold) { + if (!mc.thePlayer.capabilities.allowFlying && !mc.thePlayer.capabilities.disableDamage) { + PotionEffect jumpEffect = mc.thePlayer.getActivePotionEffect(Potion.jump); + float jumpBoost = jumpEffect != null ? (float) (jumpEffect.getAmplifier() + 1) : 0.0F; + float fallDistance = mc.thePlayer.fallDistance; + if (mc.thePlayer.motionY < -0.67 || !isAirBelow()) { + fallDistance -= (float) mc.thePlayer.motionY; + } + return MathHelper.ceiling_float_int(fallDistance - fallThreshold - jumpBoost) > 0; + } else { + return false; + } + } + + public static boolean canFly(int checkHeight) { + if (!mc.thePlayer.capabilities.allowFlying && !mc.thePlayer.capabilities.disableDamage) { + int playerY = MathHelper.floor_double(mc.thePlayer.posY); + for (int offset = 0; offset <= checkHeight; ++offset) { + int currentY = playerY - offset; + if (currentY < 0) { + break; + } + Block block = mc.theWorld.getBlockState(new BlockPos(mc.thePlayer.posX, currentY, mc.thePlayer.posZ)).getBlock(); + if (!(block instanceof BlockAir)) { + return false; + } + } + return true; + } else { + return false; + } + } + + public static boolean isInWater() { + return checkInWater(mc.thePlayer.getEntityBoundingBox().expand(-1.0E-6, 0.0, -1.0E-6)); + } + + public static boolean checkInWater(AxisAlignedBB boundingBox) { + if (!mc.thePlayer.isInWater() && !mc.thePlayer.isInLava()) { + int minY = MathHelper.floor_double(boundingBox.minY); + if (minY < 0) { + return true; + } else { + int minX = MathHelper.floor_double(boundingBox.minX); + int maxX = MathHelper.floor_double(boundingBox.maxX + 1.0); + int minZ = MathHelper.floor_double(boundingBox.minZ); + int maxZ = MathHelper.floor_double(boundingBox.maxZ + 1.0); + for (int x = minX; x < maxX; ++x) { + for (int z = minZ; z < maxZ; ++z) { + for (int y = minY; y >= 0; --y) { + if (!BlockUtil.isReplaceable(new BlockPos(x, y, z))) { + return false; + } + } + } + } + return true; + } + } else { + return false; + } + } + + public static boolean canMove(double x, double z) { + return PlayerUtil.canMove(x, z, -1.0); + } + + public static boolean canMove(double x, double z, double y) { + AxisAlignedBB boundingBox = PlayerUtil.mc.thePlayer.getEntityBoundingBox().offset(x, y, z); + return PlayerUtil.mc.theWorld.getCollidingBoundingBoxes(PlayerUtil.mc.thePlayer, boundingBox).isEmpty(); + } + + public static boolean isAirBelow() { + AxisAlignedBB axisAlignedBB = PlayerUtil.mc.thePlayer.getEntityBoundingBox().offset(0.0, -1.0, 0.0); + return !PlayerUtil.mc.theWorld.getCollidingBoundingBoxes(PlayerUtil.mc.thePlayer, axisAlignedBB).isEmpty(); + } + + public static boolean isAirAbove() { + AxisAlignedBB axisAlignedBB = PlayerUtil.mc.thePlayer.getEntityBoundingBox().offset(0.0, 1.0, 0.0); + return !PlayerUtil.mc.theWorld.getCollidingBoundingBoxes(PlayerUtil.mc.thePlayer, axisAlignedBB).isEmpty(); + } + + public static boolean canReach(BlockPos blockPos, double reach) { + return PlayerUtil.isBlockWithinReach(blockPos, PlayerUtil.mc.thePlayer.posX, PlayerUtil.mc.thePlayer.posY + (double) PlayerUtil.mc.thePlayer.getEyeHeight(), PlayerUtil.mc.thePlayer.posZ, reach); + } + + public static boolean isBlockWithinReach(BlockPos blockPos, double x, double y, double z, double reach) { + return blockPos.distanceSqToCenter(x, y, z) < Math.pow(reach, 2.0); + } + + public static void attackEntity(Entity target) { + if (ForgeHooks.onPlayerAttackTarget(mc.thePlayer, target)) { + if (target.canAttackWithItem() && !target.hitByEntity(mc.thePlayer)) { + float baseDamage = (float) mc.thePlayer.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue(); + float enchantmentBonus = EnchantmentHelper.getModifierForCreature( + mc.thePlayer.getHeldItem(), + target instanceof EntityLivingBase ? ((EntityLivingBase) target).getCreatureAttribute() : EnumCreatureAttribute.UNDEFINED + ); + int knockbackLevel = EnchantmentHelper.getKnockbackModifier(mc.thePlayer); + if (mc.thePlayer.isSprinting()) { + ++knockbackLevel; + } + if (baseDamage > 0.0F || enchantmentBonus > 0.0F) { + boolean isCritical = mc.thePlayer.fallDistance > 0.0F + && !mc.thePlayer.onGround + && !mc.thePlayer.isOnLadder() + && !mc.thePlayer.isInWater() + && !mc.thePlayer.isPotionActive(Potion.blindness) + && mc.thePlayer.ridingEntity == null; + if (isCritical && baseDamage > 0.0F) { + baseDamage *= 1.5F; + } + baseDamage += enchantmentBonus; + boolean isFireAspectApplied = false; + int fireAspectLevel = EnchantmentHelper.getFireAspectModifier(mc.thePlayer); + if (target instanceof EntityLivingBase && fireAspectLevel > 0 && !target.isBurning()) { + isFireAspectApplied = true; + target.setFire(1); + } + double originalMotionX = target.motionX; + double originalMotionY = target.motionY; + double originalMotionZ = target.motionZ; + if (target.attackEntityFrom(DamageSource.causePlayerDamage(mc.thePlayer), baseDamage)) { + if (knockbackLevel > 0) { + target.addVelocity( + -MathHelper.sin(mc.thePlayer.rotationYaw * (float) Math.PI / 180.0F) * (float) knockbackLevel * 0.5F, + 0.1, + MathHelper.cos(mc.thePlayer.rotationYaw * (float) Math.PI / 180.0F) * (float) knockbackLevel * 0.5F + ); + KeepSprint keepSprint = (KeepSprint) Myau.moduleManager.modules.get(KeepSprint.class); + if (keepSprint.isEnabled() + && (!keepSprint.groundOnly.getValue() || mc.thePlayer.onGround) + && (!keepSprint.reachOnly.getValue() || !(RotationUtil.distanceToEntity(target) <= 3.0))) { + mc.thePlayer.motionX *= 0.6 + 0.4 * (1.0 - keepSprint.slowdown.getValue().doubleValue() / 100.0); + mc.thePlayer.motionZ *= 0.6 + 0.4 * (1.0 - keepSprint.slowdown.getValue().doubleValue() / 100.0); + } else { + mc.thePlayer.motionX *= 0.6; + mc.thePlayer.motionZ *= 0.6; + mc.thePlayer.setSprinting(false); + } + } + if (target instanceof EntityPlayerMP && target.velocityChanged) { + ((EntityPlayerMP) target).playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(target)); + target.velocityChanged = false; + target.motionX = originalMotionX; + target.motionY = originalMotionY; + target.motionZ = originalMotionZ; + } + if (isCritical) { + mc.thePlayer.onCriticalHit(target); + } + if (enchantmentBonus > 0.0F) { + mc.thePlayer.onEnchantmentCritical(target); + } + if (baseDamage >= 18.0F) { + mc.thePlayer.triggerAchievement(AchievementList.overkill); + } + mc.thePlayer.setLastAttacker(target); + if (target instanceof EntityLivingBase) { + EnchantmentHelper.applyThornEnchantments((EntityLivingBase) target, mc.thePlayer); + } + EnchantmentHelper.applyArthropodEnchantments(mc.thePlayer, target); + if (target instanceof EntityLivingBase) { + mc.thePlayer.addStat(StatList.damageDealtStat, Math.round(baseDamage * 10.0F)); + if (fireAspectLevel > 0) { + target.setFire(fireAspectLevel * 4); + } + } + mc.thePlayer.addExhaustion(0.3F); + } else if (isFireAspectApplied) { + target.extinguish(); + } + } + } + } + } +} + + + +package myau.util; + +import java.util.Random; + +public class RandomUtil { + private static final Random theRandom = new Random(); + + public static long nextLong(long min, long max) { + return (long) nextDouble((double) min, (double) (max + 1L)); + } + + public static float nextFloat(float min, float max) { + return theRandom.nextFloat() * (max - min) + min; + } + + public static double nextDouble(double min, double max) { + return theRandom.nextDouble() * (max - min) + min; + } +} + + + +package myau.util; + +import myau.enums.ChatColors; +import myau.mixin.IAccessorEntityRenderer; +import myau.mixin.IAccessorMinecraft; +import myau.mixin.IAccessorRenderManager; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.*; +import net.minecraft.client.renderer.culling.Frustum; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.shader.Framebuffer; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; +import org.lwjgl.opengl.Display; +import org.lwjgl.opengl.GL11; +import org.lwjgl.util.glu.GLU; + +import javax.vecmath.Vector3d; +import javax.vecmath.Vector4d; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; +import java.util.HashMap; +import java.util.Map; + +public class RenderUtil { + private static Minecraft mc; + private static Frustum cameraFrustum; + private static IntBuffer viewportBuffer; + private static FloatBuffer modelViewBuffer; + private static FloatBuffer projectionBuffer; + private static FloatBuffer vectorBuffer; + private static Map enchantmentMap; + + static { + RenderUtil.mc = Minecraft.getMinecraft(); + RenderUtil.cameraFrustum = new Frustum(); + RenderUtil.viewportBuffer = GLAllocation.createDirectIntBuffer(16); + RenderUtil.modelViewBuffer = GLAllocation.createDirectFloatBuffer(16); + RenderUtil.projectionBuffer = GLAllocation.createDirectFloatBuffer(16); + RenderUtil.vectorBuffer = GLAllocation.createDirectFloatBuffer(4); + RenderUtil.enchantmentMap = new EnchantmentMap(); + } + + private static ChatColors getColorForLevel(int currentLevel, int maxLevel) { + if (currentLevel > maxLevel) { + return ChatColors.LIGHT_PURPLE; + } + if (currentLevel == maxLevel) { + return ChatColors.RED; + } + switch (currentLevel) { + case 1: { + return ChatColors.AQUA; + } + case 2: { + return ChatColors.GREEN; + } + case 3: { + return ChatColors.YELLOW; + } + case 4: { + return ChatColors.GOLD; + } + } + return ChatColors.GRAY; + } + + public static void drawOutlinedString(String text, float x, float y) { + String string2 = text.replaceAll("(?i)§[\\da-f]", ""); + RenderUtil.mc.fontRendererObj.drawString(string2, x + 1.0f, y, 0, false); + RenderUtil.mc.fontRendererObj.drawString(string2, x - 1.0f, y, 0, false); + RenderUtil.mc.fontRendererObj.drawString(string2, x, y + 1.0f, 0, false); + RenderUtil.mc.fontRendererObj.drawString(string2, x, y - 1.0f, 0, false); + RenderUtil.mc.fontRendererObj.drawString(text, x, y, -1, false); + } + + public static void renderEnchantmentText(ItemStack itemStack, float x, float y, float scale) { + NBTTagList nBTTagList; + nBTTagList = itemStack.getItem() == Items.enchanted_book ? Items.enchanted_book.getEnchantments(itemStack) : itemStack.getEnchantmentTagList(); + if (nBTTagList != null) { + for (int i = 0; i < nBTTagList.tagCount(); ++i) { + EnchantmentData enchantmentData = enchantmentMap.get(nBTTagList.getCompoundTagAt(i).getInteger("id")); + if (enchantmentData == null) { + continue; + } + short s = nBTTagList.getCompoundTagAt(i).getShort("lvl"); + ChatColors chatColors = RenderUtil.getColorForLevel(s, enchantmentData.maxLevel); + RenderUtil.drawOutlinedString(ChatColors.formatColor(String.format("&r%s%s%d&r", enchantmentData.shortName, chatColors, (int) s)), x * (1.0f / scale), (y + (float) i * 4.0f) * (1.0f / scale)); + } + } + } + + public static void renderItemInGUI(ItemStack itemStack, int x, int y) { + GlStateManager.pushMatrix(); + GlStateManager.depthMask(true); + GlStateManager.clear(256); + RenderHelper.enableGUIStandardItemLighting(); + GL11.glDisable(GL11.GL_LIGHTING); + GlStateManager.pushMatrix(); + GlStateManager.scale(1.0f, 1.0f, -0.01f); + RenderUtil.mc.getRenderItem().zLevel = -150.0f; + mc.getRenderItem().renderItemAndEffectIntoGUI(itemStack, x, y); + mc.getRenderItem().renderItemOverlays(RenderUtil.mc.fontRendererObj, itemStack, x, y); + RenderUtil.mc.getRenderItem().zLevel = 0.0f; + GlStateManager.popMatrix(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.enableAlpha(); + GlStateManager.disableBlend(); + GlStateManager.enableTexture2D(); + GlStateManager.popMatrix(); + GlStateManager.pushMatrix(); + GlStateManager.scale(0.5f, 0.5f, 0.5f); + GlStateManager.disableDepth(); + RenderUtil.renderEnchantmentText(itemStack, x, y, 0.5f); + GlStateManager.enableDepth(); + GlStateManager.scale(2.0f, 2.0f, 2.0f); + GlStateManager.popMatrix(); + } + + public static void renderPotionEffect(PotionEffect potionEffect, int x, int y) { + int n3 = Potion.potionTypes[potionEffect.getPotionID()].getStatusIconIndex(); + GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); + GlStateManager.pushMatrix(); + GlStateManager.depthMask(true); + GlStateManager.clear(256); + GlStateManager.pushMatrix(); + GlStateManager.scale(1.0f, 1.0f, -0.01f); + mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/inventory.png")); + Gui.drawModalRectWithCustomSizedTexture(x, y, n3 % 8 * 18, 198 + n3 / 8 * 18, 18, 18, 256.0f, 256.0f); + GlStateManager.popMatrix(); + GlStateManager.enableAlpha(); + GlStateManager.disableBlend(); + GlStateManager.enableTexture2D(); + GlStateManager.popMatrix(); + } + + public static void drawRect(float x1, float y1, float x2, float y2, int color) { + if (color == 0) { + return; + } + RenderUtil.setColor(color); + GL11.glBegin(GL11.GL_POLYGON); + GL11.glVertex2f(x1, y1); + GL11.glVertex2f(x1, y2); + GL11.glVertex2f(x2, y2); + GL11.glVertex2f(x2, y1); + GL11.glEnd(); + GlStateManager.resetColor(); + } + + public static void drawRect3D(float x1, float y1, float x2, float y2, int color) { + if (color == 0) { + return; + } + RenderUtil.setColor(color); + GL11.glEnable(GL11.GL_POLYGON_SMOOTH); + GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST); + GL11.glBegin(GL11.GL_POLYGON); + for (int i = 0; i < 2; ++i) { + GL11.glVertex2f(x1, y1); + GL11.glVertex2f(x1, y2); + GL11.glVertex2f(x2, y2); + GL11.glVertex2f(x2, y1); + } + GL11.glEnd(); + GL11.glDisable(GL11.GL_POLYGON_SMOOTH); + GlStateManager.resetColor(); + } + + public static void drawOutlineRect(float x1, float y1, float x2, float y2, float lineWidth, int backgroundColor, int lineColor) { + RenderUtil.drawRect(0.0f, 0.0f, x2, 27.0f, backgroundColor); + if (lineColor == 0) { + return; + } + RenderUtil.setColor(lineColor); + GL11.glLineWidth(lineWidth); + GL11.glEnable(GL11.GL_LINE_SMOOTH); + GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); + GL11.glBegin(GL11.GL_LINES); + GL11.glVertex2f(x1, y1); + GL11.glVertex2f(x1, y2); + GL11.glVertex2f(x2, y2); + GL11.glVertex2f(x2, y1); + GL11.glVertex2f(x1, y1); + GL11.glVertex2f(x2, y1); + GL11.glVertex2f(x1, y2); + GL11.glVertex2f(x2, y2); + GL11.glEnd(); + GL11.glDisable(GL11.GL_LINE_SMOOTH); + GL11.glLineWidth(2.0f); + GlStateManager.resetColor(); + } + + public static void drawLine(float x1, float y1, float x2, float y2, float lineWidth, int color) { + RenderUtil.setColor(color); + GL11.glLineWidth(lineWidth); + GL11.glEnable(GL11.GL_LINE_SMOOTH); + GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); + GL11.glBegin(GL11.GL_LINES); + GL11.glVertex2f(x1, y1); + GL11.glVertex2f(x2, y2); + GL11.glEnd(); + GL11.glDisable(GL11.GL_LINE_SMOOTH); + GL11.glLineWidth(2.0f); + GlStateManager.resetColor(); + } + + public static void drawLine3D(Vec3 start, double endX, double endY, double endZ, float red, float green, float blue, float alpha, float lineWidth) { + GlStateManager.pushMatrix(); + GlStateManager.color(red, green, blue, alpha); + boolean bl = RenderUtil.mc.gameSettings.viewBobbing; + RenderUtil.mc.gameSettings.viewBobbing = false; + ((IAccessorEntityRenderer) RenderUtil.mc.entityRenderer).callSetupCameraTransform(((IAccessorMinecraft) RenderUtil.mc).getTimer().renderPartialTicks, 2); + RenderUtil.mc.gameSettings.viewBobbing = bl; + GL11.glLineWidth(lineWidth); + GL11.glEnable(GL11.GL_LINE_SMOOTH); + GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); + GL11.glBegin(GL11.GL_LINES); + GL11.glVertex3d(start.xCoord, start.yCoord, start.zCoord); + GL11.glVertex3d(endX - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosX(), endY - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosY(), endZ - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosZ()); + GL11.glEnd(); + GL11.glDisable(GL11.GL_LINE_SMOOTH); + GL11.glLineWidth(2.0f); + GlStateManager.resetColor(); + GlStateManager.popMatrix(); + } + + public static void drawArrow(float centerX, float centerY, float angle, float length, float lineWidth, int color) { + float f6 = angle + (float) Math.toRadians(45.0); + float f7 = angle - (float) Math.toRadians(45.0); + RenderUtil.setColor(color); + GL11.glLineWidth(lineWidth); + GL11.glEnable(GL11.GL_LINE_SMOOTH); + GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); + GL11.glBegin(GL11.GL_LINES); + GL11.glVertex2f(centerX, centerY); + GL11.glVertex2f(centerX + length * (float) Math.cos(f6), centerY + length * (float) Math.sin(f6)); + GL11.glVertex2f(centerX, centerY); + GL11.glVertex2f(centerX + length * (float) Math.cos(f7), centerY + length * (float) Math.sin(f7)); + GL11.glEnd(); + GL11.glDisable(GL11.GL_LINE_SMOOTH); + GL11.glLineWidth(2.0f); + GlStateManager.resetColor(); + } + + public static void drawTriangle(float centerX, float centerY, float angle, float length, int color) { + float f5 = angle + (float) Math.toRadians(26.25); + float f6 = angle - (float) Math.toRadians(26.25); + RenderUtil.setColor(color); + GL11.glEnable(GL11.GL_POLYGON_SMOOTH); + GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST); + GL11.glBegin(9); + GL11.glVertex2f(centerX, centerY); + GL11.glVertex2f(centerX + length * (float) Math.cos(f5), centerY + length * (float) Math.sin(f5)); + GL11.glVertex2f(centerX + length * (float) Math.cos(f6), centerY + length * (float) Math.sin(f6)); + GL11.glEnd(); + GL11.glDisable(GL11.GL_POLYGON_SMOOTH); + GlStateManager.resetColor(); + } + + public static void drawFramebuffer(Framebuffer framebuffer) { + ScaledResolution scaledResolution = new ScaledResolution(mc); + GlStateManager.bindTexture(framebuffer.framebufferTexture); + GL11.glBegin(GL11.GL_QUADS); + GL11.glTexCoord2d(0.0, 1.0); + GL11.glVertex2d(0.0, 0.0); + GL11.glTexCoord2d(0.0, 0.0); + GL11.glVertex2d(0.0, scaledResolution.getScaledHeight()); + GL11.glTexCoord2d(1.0, 0.0); + GL11.glVertex2d(scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight()); + GL11.glTexCoord2d(1.0, 1.0); + GL11.glVertex2d(scaledResolution.getScaledWidth(), 0.0); + GL11.glEnd(); + } + + public static void fillCircle(double x, double y, double radius, int segments, int color) { + GlStateManager.enableBlend(); + GlStateManager.disableTexture2D(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + + RenderUtil.setColor(color); + + GL11.glBegin(GL11.GL_TRIANGLE_FAN); + + GL11.glVertex2d(x, y); + + for (int i = 0; i <= segments; i++) { + double angle = i * (Math.PI * 2.0 / segments); + double px = x + Math.cos(angle) * radius; + double py = y + Math.sin(angle) * radius; + GL11.glVertex2d(px, py); + } + + GL11.glEnd(); + + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); + GlStateManager.resetColor(); + } + + public static void drawCircle(double centerX, double centerY, double centerZ, double radius, int segments, int color) { + RenderUtil.setColor(color); + GL11.glLineWidth(3.0f); + GL11.glEnable(GL11.GL_LINE_SMOOTH); + GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); + GL11.glBegin(GL11.GL_LINE_LOOP); + for (int i = 0; i <= segments; ++i) { + double d5 = (double) i * (Math.PI * 2 / (double) segments); + GL11.glVertex3d(centerX + Math.cos(d5) * radius, centerY, centerZ + Math.sin(d5) * radius); + } + GL11.glEnd(); + GL11.glDisable(GL11.GL_LINE_SMOOTH); + GL11.glLineWidth(2.0f); + GlStateManager.resetColor(); + } + + public static void drawEntityCircle(Entity entity, double radius, int segments, int color) { + double d2 = RenderUtil.lerpDouble(entity.posX, entity.lastTickPosX, ((IAccessorMinecraft) RenderUtil.mc).getTimer().renderPartialTicks) - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosX(); + double d3 = RenderUtil.lerpDouble(entity.posY, entity.lastTickPosY, ((IAccessorMinecraft) RenderUtil.mc).getTimer().renderPartialTicks) - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosY(); + double d4 = RenderUtil.lerpDouble(entity.posZ, entity.lastTickPosZ, ((IAccessorMinecraft) RenderUtil.mc).getTimer().renderPartialTicks) - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosZ(); + RenderUtil.drawCircle(d2, d3, d4, radius, segments, color); + } + + public static void drawFilledBox(AxisAlignedBB axisAlignedBB, int red, int green, int blue) { + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldRenderer = tessellator.getWorldRenderer(); + worldRenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ).color(red, green, blue, 63).endVertex(); + worldRenderer.pos(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ).color(red, green, blue, 63).endVertex(); + tessellator.draw(); + } + + public static void drawBoundingBox(AxisAlignedBB axisAlignedBB, int red, int green, int blue, int alpha, float lineWidth) { + GL11.glLineWidth(lineWidth); + GL11.glEnable(GL11.GL_LINE_SMOOTH); + GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); + RenderGlobal.drawOutlinedBoundingBox(axisAlignedBB, red, green, blue, alpha); + GL11.glDisable(GL11.GL_LINE_SMOOTH); + GL11.glLineWidth(2.0f); + } + + public static void drawEntityBox(Entity entity, int red, int green, int blue) { + double d2 = RenderUtil.lerpDouble(entity.posX, entity.lastTickPosX, ((IAccessorMinecraft) RenderUtil.mc).getTimer().renderPartialTicks); + double d3 = RenderUtil.lerpDouble(entity.posY, entity.lastTickPosY, ((IAccessorMinecraft) RenderUtil.mc).getTimer().renderPartialTicks); + double d4 = RenderUtil.lerpDouble(entity.posZ, entity.lastTickPosZ, ((IAccessorMinecraft) RenderUtil.mc).getTimer().renderPartialTicks); + RenderUtil.drawFilledBox(entity.getEntityBoundingBox().expand(0.1f, 0.1f, 0.1f).offset(d2 - entity.posX, d3 - entity.posY, d4 - entity.posZ).offset(-((IAccessorRenderManager) mc.getRenderManager()).getRenderPosX(), -((IAccessorRenderManager) mc.getRenderManager()).getRenderPosY(), -((IAccessorRenderManager) mc.getRenderManager()).getRenderPosZ()), red, green, blue); + } + + public static void drawEntityBoundingBox(Entity entity, int red, int green, int blue, int alpha, float lineWidth, double expand) { + double d2 = RenderUtil.lerpDouble(entity.posX, entity.lastTickPosX, ((IAccessorMinecraft) RenderUtil.mc).getTimer().renderPartialTicks); + double d3 = RenderUtil.lerpDouble(entity.posY, entity.lastTickPosY, ((IAccessorMinecraft) RenderUtil.mc).getTimer().renderPartialTicks); + double d4 = RenderUtil.lerpDouble(entity.posZ, entity.lastTickPosZ, ((IAccessorMinecraft) RenderUtil.mc).getTimer().renderPartialTicks); + RenderUtil.drawBoundingBox(entity.getEntityBoundingBox().expand(expand, expand, expand).offset(d2 - entity.posX, d3 - entity.posY, d4 - entity.posZ).offset(-((IAccessorRenderManager) mc.getRenderManager()).getRenderPosX(), -((IAccessorRenderManager) mc.getRenderManager()).getRenderPosY(), -((IAccessorRenderManager) mc.getRenderManager()).getRenderPosZ()), red, green, blue, alpha, lineWidth); + } + + public static void drawBlockBox(BlockPos blockPos, double height, int red, int green, int blue) { + RenderUtil.drawFilledBox(new AxisAlignedBB(blockPos.getX(), blockPos.getY(), blockPos.getZ(), (double) blockPos.getX() + 1.0, (double) blockPos.getY() + height, (double) blockPos.getZ() + 1.0).offset(-((IAccessorRenderManager) mc.getRenderManager()).getRenderPosX(), -((IAccessorRenderManager) mc.getRenderManager()).getRenderPosY(), -((IAccessorRenderManager) mc.getRenderManager()).getRenderPosZ()), red, green, blue); + } + + public static void drawBlockBoundingBox(BlockPos blockPos, double height, int red, int green, int blue, int alpha, float lineWidth) { + RenderUtil.drawBoundingBox(new AxisAlignedBB(blockPos.getX(), blockPos.getY(), blockPos.getZ(), (double) blockPos.getX() + 1.0, (double) blockPos.getY() + height, (double) blockPos.getZ() + 1.0).offset(-((IAccessorRenderManager) mc.getRenderManager()).getRenderPosX(), -((IAccessorRenderManager) mc.getRenderManager()).getRenderPosY(), -((IAccessorRenderManager) mc.getRenderManager()).getRenderPosZ()), red, green, blue, alpha, lineWidth); + } + + public static void drawCornerESP(EntityPlayer entity, float red, float green, float blue) { + float x = (float) (RenderUtil.lerpDouble(entity.posX, entity.lastTickPosX, ((IAccessorMinecraft) mc).getTimer().renderPartialTicks) - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosX()); + float y = (float) (RenderUtil.lerpDouble(entity.posY, entity.lastTickPosY, ((IAccessorMinecraft) mc).getTimer().renderPartialTicks) - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosY()); + float z = (float) (RenderUtil.lerpDouble(entity.posZ, entity.lastTickPosZ, ((IAccessorMinecraft) mc).getTimer().renderPartialTicks) - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosZ()); + GlStateManager.pushMatrix(); + GlStateManager.translate(x, y + entity.height / 2.0F, z); + GlStateManager.rotate(-mc.getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.scale(-0.098F, -0.098F, 0.098F); + float width = (float) (26.6 * entity.width / 2.0); + float height = 12.0F; + GlStateManager.color(red, green, blue); + draw3DRect(width, height - 1.0F, width - 4.0F, height); + draw3DRect(-width, height - 1.0F, -width + 4.0F, height); + draw3DRect(-width, height, -width + 1.0F, height - 4.0F); + draw3DRect(width, height, width - 1.0F, height - 4.0F); + draw3DRect(width, -height, width - 4.0F, -height + 1.0F); + draw3DRect(-width, -height, -width + 4.0F, -height + 1.0F); + draw3DRect(-width, -height + 1.0F, -width + 1.0F, -height + 4.0F); + draw3DRect(width, -height + 1.0F, width - 1.0F, -height + 4.0F); + GlStateManager.color(0.0F, 0.0F, 0.0F); + draw3DRect(width, height, width - 4.0F, height + 0.2F); + draw3DRect(-width, height, -width + 4.0F, height + 0.2F); + draw3DRect(-width - 0.2F, height + 0.2F, -width, height - 4.0F); + draw3DRect(width + 0.2F, height + 0.2F, width, height - 4.0F); + draw3DRect(width + 0.2F, -height, width - 4.0F, -height - 0.2F); + draw3DRect(-width - 0.2F, -height, -width + 4.0F, -height - 0.2F); + draw3DRect(-width - 0.2F, -height, -width, -height + 4.0F); + draw3DRect(width + 0.2F, -height, width, -height + 4.0F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.popMatrix(); + } + + public static void drawFake2DESP(EntityPlayer entity, float red, float green, float blue) { + float x = (float) (RenderUtil.lerpDouble(entity.posX, entity.lastTickPosX, ((IAccessorMinecraft) mc).getTimer().renderPartialTicks) - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosX()); + float y = (float) (RenderUtil.lerpDouble(entity.posY, entity.lastTickPosY, ((IAccessorMinecraft) mc).getTimer().renderPartialTicks) - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosY()); + float z = (float) (RenderUtil.lerpDouble(entity.posZ, entity.lastTickPosZ, ((IAccessorMinecraft) mc).getTimer().renderPartialTicks) - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosZ()); + GlStateManager.pushMatrix(); + GlStateManager.translate(x, y + entity.height / 2.0F, z); + GlStateManager.rotate(-mc.getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.scale(-0.1F, -0.1F, 0.1F); + GlStateManager.color(red, green, blue); + float width = (float) (23.3 * entity.width / 2.0); + float height = 12.0F; + draw3DRect(width, height, -width, height + 0.4F); + draw3DRect(width, -height, -width, -height + 0.4F); + draw3DRect(width, -height + 0.4F, width - 0.4F, height + 0.4F); + draw3DRect(-width, -height + 0.4F, -width + 0.4F, height + 0.4F); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.popMatrix(); + } + + public static void draw3DRect(float x1, float y1, float x2, float y2) { + GL11.glBegin(GL11.GL_POLYGON); + GL11.glVertex2f(x2, y1); + GL11.glVertex2f(x1, y1); + GL11.glVertex2f(x1, y2); + GL11.glVertex2f(x2, y2); + GL11.glEnd(); + } + + public static Vector4d projectToScreen(Entity entity, double screenScale) { + Vector4d vector4d; + { + double d3 = RenderUtil.lerpDouble(entity.posX, entity.lastTickPosX, ((IAccessorMinecraft) RenderUtil.mc).getTimer().renderPartialTicks); + double d4 = RenderUtil.lerpDouble(entity.posY, entity.lastTickPosY, ((IAccessorMinecraft) RenderUtil.mc).getTimer().renderPartialTicks); + double d5 = RenderUtil.lerpDouble(entity.posZ, entity.lastTickPosZ, ((IAccessorMinecraft) RenderUtil.mc).getTimer().renderPartialTicks); + AxisAlignedBB axisAlignedBB = entity.getEntityBoundingBox().expand(0.1f, 0.1f, 0.1f).offset(d3 - entity.posX, d4 - entity.posY, d5 - entity.posZ); + vector4d = null; + for (Vector3d vector3d : new Vector3d[]{new Vector3d(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ), new Vector3d(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.minZ), new Vector3d(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.minZ), new Vector3d(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.minZ), new Vector3d(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.maxZ), new Vector3d(axisAlignedBB.minX, axisAlignedBB.maxY, axisAlignedBB.maxZ), new Vector3d(axisAlignedBB.maxX, axisAlignedBB.minY, axisAlignedBB.maxZ), new Vector3d(axisAlignedBB.maxX, axisAlignedBB.maxY, axisAlignedBB.maxZ)}) { + GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, modelViewBuffer); + GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, projectionBuffer); + GL11.glGetInteger(GL11.GL_VIEWPORT, viewportBuffer); + if (!GLU.gluProject((float) (vector3d.x - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosX()), (float) (vector3d.y - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosY()), (float) (vector3d.z - ((IAccessorRenderManager) mc.getRenderManager()).getRenderPosZ()), modelViewBuffer, projectionBuffer, viewportBuffer, vectorBuffer)) + continue; + vector3d = new Vector3d((double) vectorBuffer.get(0) / screenScale, (double) ((float) Display.getHeight() - vectorBuffer.get(1)) / screenScale, vectorBuffer.get(2)); + if (!(vector3d.z >= 0.0) || !(vector3d.z < 1.0)) continue; + if (vector4d == null) { + vector4d = new Vector4d(vector3d.x, vector3d.y, vector3d.z, 0.0); + } + vector4d.x = Math.min(vector3d.x, vector4d.x); + vector4d.y = Math.min(vector3d.y, vector4d.y); + vector4d.z = Math.max(vector3d.x, vector4d.z); + vector4d.w = Math.max(vector3d.y, vector4d.w); + } + } + return vector4d; + } + + public static boolean isInViewFrustum(AxisAlignedBB axisAlignedBB, double expand) { + cameraFrustum.setPosition(RenderUtil.mc.getRenderViewEntity().posX, RenderUtil.mc.getRenderViewEntity().posY, RenderUtil.mc.getRenderViewEntity().posZ); + return cameraFrustum.isBoundingBoxInFrustum(axisAlignedBB.expand(expand, expand, expand)); + } + + public static void enableRenderState() { + GlStateManager.enableBlend(); + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.disableTexture2D(); + GlStateManager.disableCull(); + GlStateManager.disableAlpha(); + GlStateManager.disableDepth(); + } + + public static void disableRenderState() { + GlStateManager.enableDepth(); + GlStateManager.enableAlpha(); + GlStateManager.enableCull(); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); + } + + public static void setColor(int argb) { + float f = (float) (argb >> 24 & 0xFF) / 255.0f; + float f2 = (float) (argb >> 16 & 0xFF) / 255.0f; + float f3 = (float) (argb >> 8 & 0xFF) / 255.0f; + float f4 = (float) (argb & 0xFF) / 255.0f; + GlStateManager.color(f2, f3, f4, f); + } + + public static float lerpFloat(float current, float previous, float t) { + return previous + (current - previous) * t; + } + + public static double lerpDouble(double current, double previous, double t) { + return previous + (current - previous) * t; + } + + public static final class EnchantmentData { + public final String shortName; + public final int maxLevel; + + public EnchantmentData(String shortName, int maxLevel) { + this.shortName = shortName; + this.maxLevel = maxLevel; + } + } + + static final class EnchantmentMap extends HashMap { + EnchantmentMap() { + this.put(0, new EnchantmentData("Pr", 4)); + this.put(1, new EnchantmentData("Fp", 4)); + this.put(2, new EnchantmentData("Ff", 4)); + this.put(3, new EnchantmentData("Bp", 4)); + this.put(4, new EnchantmentData("Pp", 4)); + this.put(5, new EnchantmentData("Re", 3)); + this.put(6, new EnchantmentData("Aq", 1)); + this.put(7, new EnchantmentData("Th", 3)); + this.put(8, new EnchantmentData("Ds", 3)); + this.put(16, new EnchantmentData("Sh", 5)); + this.put(17, new EnchantmentData("Sm", 5)); + this.put(18, new EnchantmentData("BoA", 5)); + this.put(19, new EnchantmentData("Kb", 2)); + this.put(20, new EnchantmentData("Fa", 2)); + this.put(21, new EnchantmentData("Lo", 3)); + this.put(32, new EnchantmentData("Ef", 5)); + this.put(33, new EnchantmentData("St", 1)); + this.put(34, new EnchantmentData("Ub", 3)); + this.put(35, new EnchantmentData("Fo", 3)); + this.put(48, new EnchantmentData("Po", 5)); + this.put(49, new EnchantmentData("Pu", 2)); + this.put(50, new EnchantmentData("Fl", 1)); + this.put(51, new EnchantmentData("Inf", 1)); + this.put(61, new EnchantmentData("LoS", 3)); + this.put(62, new EnchantmentData("Lu", 3)); + } + } +} + + + +package myau.util; + +import myau.mixin.IAccessorEntity; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; + +public class RotationUtil { + private static final Minecraft mc = Minecraft.getMinecraft(); + + public static float wrapAngleDiff(float angle, float target) { + return target + MathHelper.wrapAngleTo180_float(angle - target); + } + + public static float clampAngle(float angle, float maxAngle) { + maxAngle = Math.max(0.0f, Math.min(180.0f, maxAngle)); + if (angle > maxAngle) { + angle = maxAngle; + } else if (angle < -maxAngle) { + angle = -maxAngle; + } + return angle; + } + + public static float smoothAngle(float angle, float smoothFactor) { + return angle * (0.5f + 0.5f * (1.0f - Math.max(0.0f, Math.min(1.0f, smoothFactor + RandomUtil.nextFloat(-0.1f, 0.1f))))); + } + + public static float quantizeAngle(float angle) { + return (float) ((double) angle - (double) angle % (double) 0.0096f); + } + + public static float[] getRotationsToBox(AxisAlignedBB boundingBox, float yaw, float pitch, float maxAngle, float smoothFactor) { + Vec3 eyePos = RotationUtil.mc.thePlayer.getPositionEyes(1.0f); + double minTargetY = boundingBox.minY + 0.05 * (boundingBox.maxY - boundingBox.minY); + double maxTargetY = boundingBox.minY + 0.75 * (boundingBox.maxY - boundingBox.minY); + double deltaX = (boundingBox.minX + boundingBox.maxX) / 2.0 - eyePos.xCoord; + double deltaY = eyePos.yCoord >= maxTargetY ? maxTargetY - eyePos.yCoord : (eyePos.yCoord <= minTargetY ? minTargetY - eyePos.yCoord : 0.0); + double deltaZ = (boundingBox.minZ + boundingBox.maxZ) / 2.0 - eyePos.zCoord; + return RotationUtil.getRotations(deltaX, deltaY, deltaZ, yaw, pitch, maxAngle, smoothFactor); + } + + public static float[] getRotationsTo(double targetX, double targetY, double targetZ, float currentYaw, float currentPitch) { + return RotationUtil.getRotations(targetX, targetY, targetZ, currentYaw, currentPitch, 180.0f, 0.0f); + } + + public static float[] getRotations(double targetX, double targetY, double targetZ, float currentYaw, float currentPitch, float maxAngle, float smoothFactor) { + double horizontalDistance = Math.sqrt(targetX * targetX + targetZ * targetZ); + float yawDelta = MathHelper.wrapAngleTo180_float((float) (Math.atan2(targetZ, targetX) * 180.0 / Math.PI) - 90.0f - currentYaw); + float pitchDelta = MathHelper.wrapAngleTo180_float((float) (-Math.atan2(targetY, horizontalDistance) * 180.0 / Math.PI) - currentPitch); + yawDelta = Math.abs(yawDelta) <= 1.0f ? 0.0f : RotationUtil.smoothAngle(RotationUtil.clampAngle(yawDelta, maxAngle), smoothFactor); + pitchDelta = Math.abs(pitchDelta) <= 1.0f ? 0.0f : RotationUtil.smoothAngle(RotationUtil.clampAngle(pitchDelta, maxAngle), smoothFactor); + return new float[]{RotationUtil.quantizeAngle(currentYaw + yawDelta), RotationUtil.quantizeAngle(currentPitch + pitchDelta)}; + } + + public static Vec3 clampVecToBox(Vec3 vector, AxisAlignedBB boundingBox) { + double[] coords = new double[]{vector.xCoord, vector.yCoord, vector.zCoord}; + double[] minCoords = new double[]{boundingBox.minX, boundingBox.minY, boundingBox.minZ}; + double[] maxCoords = new double[]{boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ}; + for (int i = 0; i < 3; ++i) { + if (coords[i] > maxCoords[i]) { + coords[i] = maxCoords[i]; + continue; + } + if (!(coords[i] < minCoords[i])) continue; + coords[i] = minCoords[i]; + } + return new Vec3(coords[0], coords[1], coords[2]); + } + + public static double distanceToEntity(Entity entity) { + float borderSize = entity.getCollisionBorderSize(); + AxisAlignedBB boundingBox = entity.getEntityBoundingBox().expand(borderSize, borderSize, borderSize); + return RotationUtil.distanceToBox(boundingBox); + } + + public static double distanceToBox(Entity entity, Vec3 point) { + float borderSize = entity.getCollisionBorderSize(); + return RotationUtil.clampVecToBox(entity.getEntityBoundingBox().expand(borderSize, borderSize, borderSize), point); + } + + public static double distanceToBox(AxisAlignedBB boundingBox) { + return RotationUtil.clampVecToBox(boundingBox, RotationUtil.mc.thePlayer.getPositionEyes(1.0f)); + } + + public static double clampVecToBox(AxisAlignedBB boundingBox, Vec3 point) { + if (boundingBox.isVecInside(point)) { + return 0.0; + } + Vec3 clampedPoint = RotationUtil.clampVecToBox(point, boundingBox); + double deltaX = clampedPoint.xCoord - point.xCoord; + double deltaY = clampedPoint.yCoord - point.yCoord; + double deltaZ = clampedPoint.zCoord - point.zCoord; + return Math.sqrt(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ); + } + + public static float angleToEntity(Entity entity) { + Vec3 eyePos = RotationUtil.mc.thePlayer.getPositionEyes(1.0f); + float borderSize = entity.getCollisionBorderSize(); + AxisAlignedBB boundingBox = entity.getEntityBoundingBox().expand(borderSize, borderSize, borderSize); + if (boundingBox.isVecInside(eyePos)) { + return 0.0f; + } + double deltaX = entity.posX - eyePos.xCoord; + double deltaZ = entity.posZ - eyePos.zCoord; + return Math.abs(MathHelper.wrapAngleTo180_float((float) (Math.atan2(deltaZ, deltaX) * 180.0 / Math.PI) - 90.0f - RotationUtil.mc.thePlayer.rotationYaw)) * 2.0f; + } + + public static float getYawBetween(double x1, double z1, double x2, double z2) { + return MathHelper.wrapAngleTo180_float((float) (Math.atan2(z2 - z1, x2 - x1) * 180.0 / Math.PI) - 90.0f - RotationUtil.mc.thePlayer.rotationYaw); + } + + public static MovingObjectPosition rayTrace(float yaw, float pitch, double distance, float partialTicks) { + Vec3 eyePos = RotationUtil.mc.thePlayer.getPositionEyes(partialTicks); + Vec3 lookVec = ((IAccessorEntity) RotationUtil.mc.thePlayer).callGetVectorForRotation(pitch, yaw); + Vec3 targetPos = eyePos.addVector(lookVec.xCoord * distance, lookVec.yCoord * distance, lookVec.zCoord * distance); + return RotationUtil.mc.theWorld.rayTraceBlocks(eyePos, targetPos); + } + + public static MovingObjectPosition rayTrace(Entity entity) { + Vec3 eyePos = RotationUtil.mc.thePlayer.getPositionEyes(1.0f); + float borderSize = entity.getCollisionBorderSize(); + Vec3 targetPos = RotationUtil.clampVecToBox(eyePos, entity.getEntityBoundingBox().expand(borderSize, borderSize, borderSize)); + return RotationUtil.mc.theWorld.rayTraceBlocks(eyePos, targetPos); + } + + public static MovingObjectPosition rayTrace(AxisAlignedBB boundingBox, float yaw, float pitch, double distance) { + Vec3 eyePos = RotationUtil.mc.thePlayer.getPositionEyes(1.0f); + Vec3 lookVec = ((IAccessorEntity) RotationUtil.mc.thePlayer).callGetVectorForRotation(pitch, yaw); + Vec3 targetPos = eyePos.addVector(lookVec.xCoord * distance, lookVec.yCoord * distance, lookVec.zCoord * distance); + return boundingBox.calculateIntercept(eyePos, targetPos); + } +} + + + +package myau.util; + +import net.minecraft.client.Minecraft; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.ScorePlayerTeam; +import net.minecraft.scoreboard.Scoreboard; + +import java.util.ArrayList; +import java.util.stream.Collectors; + +public class ServerUtil { + private static final Minecraft mc = Minecraft.getMinecraft(); + + public static ArrayList getScoreboardLines() { + if (ServerUtil.mc.theWorld == null) { + return new ArrayList<>(); + } + Scoreboard scoreboard = ServerUtil.mc.theWorld.getScoreboard(); + if (scoreboard == null) { + return new ArrayList<>(); + } + ScoreObjective scoreObjective = scoreboard.getObjectiveInDisplaySlot(1); + if (scoreObjective == null) { + return new ArrayList<>(); + } + return (ArrayList) scoreboard.getSortedScores(scoreObjective).stream().map(score -> ScorePlayerTeam.formatPlayerName(scoreboard.getPlayersTeam(score.getPlayerName()), score.getPlayerName())).collect(Collectors.toList()); + } + + public static boolean isHypixel() { + ArrayList arrayList = ServerUtil.getScoreboardLines(); + if (arrayList.isEmpty()) return false; + if (arrayList.get(0).equals("§ewww.hypixel.ne🎂§et")) return true; + return arrayList.get(0).equals("§ewww.hypixel.ne§g§et"); + } + + public static boolean hasPlayerCountInfo() { + for (String s : ServerUtil.getScoreboardLines()) { + if (!s.matches(".*Players: §a\\d+/\\d+.*")) continue; + return true; + } + return false; + } +} + + + +package myau.util.shader; + +import org.lwjgl.opengl.GL20; + +import java.awt.*; + +public class GlowShader extends Shader { + private static final String shader = String.join( + "\n", + "#version 120", + "uniform sampler2D texture;", + "uniform vec4 color;", + "void main() {", + "vec4 st = texture2D(texture, gl_TexCoord[0].st);", + "gl_FragColor = vec4(color.rgb, st.a > 0.0 ? color.a : 0.0);", + "}" + ); + + public GlowShader() { + super(shader); + } + + @Override + public void onLink() { + this.setUniform("texture"); + this.setUniform("color"); + } + + @Override + public void onUse() { + GL20.glUseProgram(this.programId); + int texLoc = this.getUniformLocationCached("texture"); + GL20.glUniform1i(texLoc, 0); + GL20.glUniform4f(texLoc, 1.0f, 1.0f, 1.0f, 1.0f); + } + + public void W(Color color) { + GL20.glUniform4f( + this.getUniformLocationCached("color"), + (float) color.getRed() / 255.0F, + (float) color.getGreen() / 255.0F, + (float) color.getBlue() / 255.0F, + (float) color.getAlpha() / 255.0F + ); + } +} + + + +package myau.util.shader; + +import net.minecraft.client.Minecraft; +import org.lwjgl.opengl.GL20; + +public class OutlineShader extends Shader { + private static final String shader = String.join( + "\n", + "uniform sampler2D texture;", + "uniform vec2 size;", + "uniform float radius;", + "void main(void) {", + "vec4 xy = texture2D(texture, gl_TexCoord[0].xy);", + "if(xy.a != 0) {", + "gl_FragColor = vec4(0, 0, 0, 0);", + "} else {", + "for (float x = -radius; x <= radius; x++) {", + "for (float y = -radius; y <= radius; y++) {", + "vec4 color = texture2D(texture, gl_TexCoord[0].xy + vec2(size.x * x, size.y * y));", + "if (color.a != 0) {", + "gl_FragColor = color;", + "}", + "}", + "}", + "}", + "}" + ); + + public OutlineShader() { + super(shader); + } + + @Override + public void onLink() { + this.setUniform("texture"); + this.setUniform("size"); + this.setUniform("radius"); + } + + @Override + public void onUse() { + GL20.glUseProgram(this.programId); + int texLoc = this.getUniformLocationCached("texture"); + GL20.glUniform1i(texLoc, 0); + int sizeLoc = this.getUniformLocationCached("size"); + float invW = 1.0f / Minecraft.getMinecraft().displayWidth; + float invH = 1.0f / Minecraft.getMinecraft().displayHeight; + GL20.glUniform2f(sizeLoc, invW, invH); + int radiusLoc = this.getUniformLocationCached("radius"); + GL20.glUniform1f(radiusLoc, 2.0f); + } +} + + + +package myau.util.shader; + +import org.lwjgl.opengl.GL20; + +import java.util.HashMap; +import java.util.Map; + +public abstract class Shader { + private static final String vertex = "#version 120\n" + + "void main(void) {\n" + + "gl_TexCoord[0] = gl_MultiTexCoord0;\n" + + "gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" + + "}"; + private final Map uniformLocations; + protected int programId; + + private int compileShader(String source, int type) { + int shader = GL20.glCreateShader(type); + GL20.glShaderSource(shader, source); + GL20.glCompileShader(shader); + int compile = GL20.glGetShaderi(shader, GL20.GL_COMPILE_STATUS); + return compile == 0 ? -1 : shader; + } + + private void createProgram(String fragment) { + this.programId = GL20.glCreateProgram(); + GL20.glAttachShader(this.programId, this.compileShader(vertex, GL20.GL_VERTEX_SHADER)); + GL20.glAttachShader(this.programId, this.compileShader(fragment, GL20.GL_FRAGMENT_SHADER)); + GL20.glLinkProgram(this.programId); + int programId = GL20.glGetProgrami(this.programId, GL20.GL_LINK_STATUS); + if (programId == 0) { + this.programId = -1; + } else { + this.onLink(); + } + } + + public Shader(String string) { + this.uniformLocations = new HashMap<>(); + this.createProgram(string); + } + + public int getUniformLocationCached(String name) { + return this.uniformLocations.get(name); + } + + public void setUniform(String name) { + this.uniformLocations.put(name, GL20.glGetUniformLocation(this.programId, name)); + } + + public abstract void onLink(); + + public abstract void onUse(); + + public void use() { + onUse(); + } + + public void stop() { + GL20.glUseProgram(0); + } +} + + + +package myau.util; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.audio.SoundHandler; +import net.minecraft.util.ResourceLocation; + +public class SoundUtil { + private static final Minecraft mc = Minecraft.getMinecraft(); + + public static void playSound(String soundName) { + SoundHandler soundHandler = mc.getSoundHandler(); + if (soundHandler != null) { + PositionedSoundRecord positionedSoundRecord = PositionedSoundRecord.create(new ResourceLocation(soundName)); + soundHandler.playSound(positionedSoundRecord); + } + } +} + + + +package myau.util; + +import myau.Myau; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.scoreboard.ScorePlayerTeam; + +import java.awt.*; +import java.util.List; +import java.util.stream.Collectors; + +public class TeamUtil { + private static final Minecraft mc = Minecraft.getMinecraft(); + + public static boolean isEntityLoaded(Entity entity) { + if (entity == null) return false; + return TeamUtil.mc.theWorld.loadedEntityList.contains(entity); + } + + public static List getLoadedEntitiesSorted() { + return TeamUtil.mc.theWorld.loadedEntityList.stream().sorted((entity1, entity2) -> { + double dist1 = mc.getRenderManager().getDistanceToCamera(entity1.posX, entity1.posY, entity1.posZ); + double dist2 = mc.getRenderManager().getDistanceToCamera(entity2.posX, entity2.posY, entity2.posZ); + if (dist1 < dist2) { + return 1; + } + if (dist1 > dist2) { + return -1; + } + return entity1.getUniqueID().toString().compareTo(entity2.getUniqueID().toString()); + }).collect(Collectors.toList()); + } + + public static float getHealthScore(EntityLivingBase entityLivingBase) { + return entityLivingBase.getHealth() * (20.0f / (float) entityLivingBase.getTotalArmorValue()); + } + + public static String stripName(Entity entity) { + return entity.getDisplayName().getFormattedText().replaceAll("§\\S$", "").replaceAll("(?i)§r", "§f").trim(); + } + + public static Color getTeamColor(EntityPlayer player, float alpha) { + int colorCode = 0xFFFFFF; + ScorePlayerTeam playerTeam = (ScorePlayerTeam) player.getTeam(); + if (playerTeam != null) { + String colorPrefix = FontRenderer.getFormatFromString(playerTeam.getColorPrefix()); + if (colorPrefix.length() >= 2) { + colorCode = TeamUtil.mc.fontRendererObj.getColorCode(colorPrefix.charAt(1)); + } + } + return new Color(colorCode & 0xFFFFFF | (int)(alpha * 255) << 24, true); + } + + public static boolean isBot(EntityPlayer player) { + if (player == TeamUtil.mc.thePlayer) { + return false; + } + NetworkPlayerInfo playerInfo = mc.getNetHandler().getPlayerInfo(player.getName()); + if (playerInfo == null) { + return true; + } + if (!ServerUtil.isHypixel()) return false; + if (player.getName().startsWith("§k")) { + return player.isInvisible(); + } + if (playerInfo.getResponseTime() < 1) { + return true; + } + ScorePlayerTeam playerTeam = playerInfo.getPlayerTeam(); + if (playerTeam == null) return false; + if (!playerTeam.getTeamName().isEmpty()) return false; + return playerTeam.getColorPrefix().equals("§c"); + } + + public static boolean isSameTeam(EntityPlayer player) { + if (player == TeamUtil.mc.thePlayer) { + return true; + } + NetworkPlayerInfo selfInfo = mc.getNetHandler().getPlayerInfo(TeamUtil.mc.thePlayer.getUniqueID()); + if (selfInfo == null) { + return false; + } + ScorePlayerTeam selfTeam = selfInfo.getPlayerTeam(); + if (selfTeam == null) { + return false; + } + NetworkPlayerInfo targetInfo = mc.getNetHandler().getPlayerInfo(player.getUniqueID()); + if (targetInfo == null) { + return false; + } + ScorePlayerTeam targetTeam = targetInfo.getPlayerTeam(); + if (targetTeam == null) { + return false; + } + return selfTeam.getColorPrefix().equals(targetTeam.getColorPrefix()); + } + + public static boolean hasTeamColor(EntityLivingBase entity) { + if (entity == TeamUtil.mc.thePlayer) { + return true; + } + NetworkPlayerInfo selfInfo = mc.getNetHandler().getPlayerInfo(TeamUtil.mc.thePlayer.getUniqueID()); + if (selfInfo == null) { + return false; + } + ScorePlayerTeam selfTeam = selfInfo.getPlayerTeam(); + if (selfTeam == null) { + return false; + } + if (selfTeam.getColorPrefix().length() < 2) { + return false; + } + EntityLivingBase nearestArmorStand = TeamUtil.mc.theWorld.findNearestEntityWithinAABB(EntityArmorStand.class, entity.getEntityBoundingBox(), entity); + if (nearestArmorStand != null) { + return nearestArmorStand.getName().contains(selfTeam.getColorPrefix().substring(0, 2)); + } + return false; + } + + public static boolean isShop(EntityLivingBase entity) { + if (entity == TeamUtil.mc.thePlayer) { + return false; + } + EntityLivingBase armorStand = TeamUtil.mc.theWorld.findNearestEntityWithinAABB(EntityArmorStand.class, entity.getEntityBoundingBox(), entity); + if (armorStand == null) return false; + String displayName = armorStand.getName(); + if (displayName.contains("RIGHT CLICK")) return true; + if (displayName.contains("ITEM SHOP")) return true; + if (displayName.contains("UPGRADES")) return true; + if (displayName.contains("BANKER")) return true; + return displayName.contains("STREAK POWERS"); + } + + public static boolean isFriend(EntityPlayer player) { + return Myau.friendManager.isFriend(player.getName()); + } + + public static boolean isTarget(EntityPlayer player) { + return Myau.targetManager.isFriend(player.getName()); + } +} + + + +package myau.util; + +public class TimerUtil { + private long lastMS = 0L; + + public void reset() { + this.lastMS = System.currentTimeMillis(); + } + + public long getElapsedTime() { + return System.currentTimeMillis() - this.lastMS; + } + + public boolean hasTimeElapsed(long ms) { + return this.getElapsedTime() >= ms; + } + + public void setTime() { + this.lastMS = 0L; + } +} + + + diff --git a/src/main/java/myau/ui/ClickGui.java b/src/main/java/myau/ui/ClickGui.java index 071632fd..4fde5aa6 100644 --- a/src/main/java/myau/ui/ClickGui.java +++ b/src/main/java/myau/ui/ClickGui.java @@ -70,6 +70,7 @@ public ClickGui() { renderModules.add(Myau.moduleManager.getModule(TargetHUD.class)); renderModules.add(Myau.moduleManager.getModule(Indicators.class)); renderModules.add(Myau.moduleManager.getModule(BedESP.class)); + renderModules.add(Myau.moduleManager.getModule(EggESP.class)); renderModules.add(Myau.moduleManager.getModule(ItemESP.class)); renderModules.add(Myau.moduleManager.getModule(ViewClip.class)); renderModules.add(Myau.moduleManager.getModule(NoHurtCam.class));