diff --git a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/EnabledModsComponent.java b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/EnabledModsComponent.java index 0548e82..88fca37 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/EnabledModsComponent.java +++ b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/EnabledModsComponent.java @@ -27,6 +27,10 @@ import static me.rigamortis.seppuku.impl.module.hidden.ArrayListModule.Mode.*; */ public final class EnabledModsComponent extends DraggableHudComponent { + private ArrayListModule.Mode SORTING_MODE = LENGTH; + private boolean SHOW_METADATA = true; + private boolean LOWERCASE = false; + private boolean RAINBOW = false; private float RAINBOW_HUE_DIFFERENCE = 2.5f; private float RAINBOW_HUE_SPEED = 50.f; @@ -56,23 +60,30 @@ public final class EnabledModsComponent extends DraggableHudComponent { } } - Object sorting_mode = Seppuku.INSTANCE.getModuleManager().find(ArrayListModule.class).find("Sorting").getValue(); - if (sorting_mode.equals(LENGTH)) { + if (SORTING_MODE.equals(LENGTH)) { final Comparator lengthComparator = (first, second) -> { - final String firstName = first.getDisplayName() + (first.getMetaData() != null ? " " + ChatFormatting.GRAY + "[" + ChatFormatting.WHITE + first.getMetaData().toLowerCase() + ChatFormatting.GRAY + "]" : ""); - final String secondName = second.getDisplayName() + (second.getMetaData() != null ? " " + ChatFormatting.GRAY + "[" + ChatFormatting.WHITE + second.getMetaData().toLowerCase() + ChatFormatting.GRAY + "]" : ""); + String firstName = first.getDisplayName() + (SHOW_METADATA ? (first.getMetaData() != null ? " " + ChatFormatting.GRAY + "[" + ChatFormatting.WHITE + first.getMetaData().toLowerCase() + ChatFormatting.GRAY + "]" : "") : ""); + String secondName = second.getDisplayName() + (SHOW_METADATA ? (second.getMetaData() != null ? " " + ChatFormatting.GRAY + "[" + ChatFormatting.WHITE + second.getMetaData().toLowerCase() + ChatFormatting.GRAY + "]" : "") : ""); + if (LOWERCASE) { + firstName = firstName.toLowerCase(); + secondName = secondName.toLowerCase(); + } final float dif = mc.fontRenderer.getStringWidth(secondName) - mc.fontRenderer.getStringWidth(firstName); return dif != 0 ? (int) dif : secondName.compareTo(firstName); }; mods.sort(lengthComparator); - } else if (sorting_mode.equals(ALPHABET)) { + } else if (SORTING_MODE.equals(ALPHABET)) { final Comparator alphabeticalComparator = (first, second) -> { - final String firstName = first.getDisplayName() + (first.getMetaData() != null ? " " + ChatFormatting.GRAY + "[" + ChatFormatting.WHITE + first.getMetaData().toLowerCase() + ChatFormatting.GRAY + "]" : ""); - final String secondName = second.getDisplayName() + (second.getMetaData() != null ? " " + ChatFormatting.GRAY + "[" + ChatFormatting.WHITE + second.getMetaData().toLowerCase() + ChatFormatting.GRAY + "]" : ""); + String firstName = first.getDisplayName() + (SHOW_METADATA ? (first.getMetaData() != null ? " " + ChatFormatting.GRAY + "[" + ChatFormatting.WHITE + first.getMetaData().toLowerCase() + ChatFormatting.GRAY + "]" : "") : ""); + String secondName = second.getDisplayName() + (SHOW_METADATA ? (second.getMetaData() != null ? " " + ChatFormatting.GRAY + "[" + ChatFormatting.WHITE + second.getMetaData().toLowerCase() + ChatFormatting.GRAY + "]" : "") : ""); + if (LOWERCASE) { + firstName = firstName.toLowerCase(); + secondName = secondName.toLowerCase(); + } return firstName.compareToIgnoreCase(secondName); }; mods.sort(alphabeticalComparator); - } else if (sorting_mode.equals(UNSORTED)) { + } else if (SORTING_MODE.equals(UNSORTED)) { } @@ -84,7 +95,9 @@ public final class EnabledModsComponent extends DraggableHudComponent { for (Module mod : mods) { if (mod != null && mod.getType() != Module.ModuleType.HIDDEN && mod.isEnabled() && !mod.isHidden()) { - final String name = mod.getDisplayName() + (mod.getMetaData() != null ? " " + ChatFormatting.GRAY + "[" + ChatFormatting.WHITE + mod.getMetaData().toLowerCase() + ChatFormatting.GRAY + "]" : ""); + String name = mod.getDisplayName() + (SHOW_METADATA ? (mod.getMetaData() != null ? " " + ChatFormatting.GRAY + "[" + ChatFormatting.WHITE + mod.getMetaData().toLowerCase() + ChatFormatting.GRAY + "]" : "") : ""); + if (LOWERCASE) + name = name.toLowerCase(); final float width = mc.fontRenderer.getStringWidth(name); @@ -178,5 +191,12 @@ public final class EnabledModsComponent extends DraggableHudComponent { this.RAINBOW_SATURATION = hudModule.rainbowSaturation.getValue(); this.RAINBOW_BRIGHTNESS = hudModule.rainbowBrightness.getValue(); } + + final ArrayListModule arrayListModule = (ArrayListModule) Seppuku.INSTANCE.getModuleManager().find(ArrayListModule.class); + if (arrayListModule != null) { + this.SORTING_MODE = arrayListModule.mode.getValue(); + this.LOWERCASE = arrayListModule.lowercase.getValue(); + this.SHOW_METADATA = arrayListModule.showMetadata.getValue(); + } } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/hidden/ArrayListModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/hidden/ArrayListModule.java index 54abe04..6e97cc6 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/hidden/ArrayListModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/hidden/ArrayListModule.java @@ -10,6 +10,8 @@ import me.rigamortis.seppuku.api.value.Value; public class ArrayListModule extends Module { public final Value mode = new Value("Sorting", new String[]{"Sorting", "sort"}, "Changes arraylist sorting method.", ArrayListModule.Mode.LENGTH); + public final Value lowercase = new Value("Lowercase", new String[]{"Lower", "case", "undercase", "nocap"}, "NO CAP.", false); + public final Value showMetadata = new Value("Metadata", new String[]{"ShowMetadata", "suffix", "showsuffix"}, "Shows the metadata of the module if it exists.", true); public ArrayListModule() { super("ArrayList", new String[]{"ArrayList", "arraylist", "modulelist", "modlist", "array-list", "alist"}, "Optional values for the ArrayList hud component.", "NONE", -1, ModuleType.HIDDEN); diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/misc/ChatMutatorModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/misc/ChatMutatorModule.java index 4dfef80..ed0a4af 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/misc/ChatMutatorModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/misc/ChatMutatorModule.java @@ -43,16 +43,19 @@ public final class ChatMutatorModule extends Module { switch (this.mode.getValue()) { case LEET: - packet.message = leetSpeak(packet.message); + packet.message = this.leetSpeak(packet.message); break; case FANCY: - packet.message = fancy(packet.message); + packet.message = this.fancy(packet.message); break; case RETARD: - packet.message = retard(packet.message); + packet.message = this.retard(packet.message); + break; + case PIGLATIN: + packet.message = this.pigLatin(packet.message); break; case CONSOLE: - packet.message = console(packet.message); + packet.message = this.console(packet.message); break; } } @@ -60,6 +63,11 @@ public final class ChatMutatorModule extends Module { } } + public boolean isVowel(char c) { + return (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U' || + c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'); + } + public String leetSpeak(String input) { input = input.toLowerCase().replace("a", "4"); input = input.toLowerCase().replace("e", "3"); @@ -96,6 +104,31 @@ public final class ChatMutatorModule extends Module { return sb.toString(); } + // This code is contributed by Anant Agarwal. + public String pigLatin(String s) { + // the index of the first vowel is stored. + int len = s.length(); + int index = -1; + for (int i = 0; i < len; i++) + { + if (isVowel(s.charAt(i))) { + index = i; + break; + } + } + + // Pig Latin is possible only if vowels + // is present + if (index == -1) + return "-1"; + + // Take all characters after index (including + // index). Append all characters which are before + // index. Finally append "ay" + return s.substring(index) + + s.substring(0, index) + "ay"; + } + public String console(String input) { String ret = ""; @@ -134,7 +167,7 @@ public final class ChatMutatorModule extends Module { } private enum Mode { - LEET, FANCY, RETARD, CONSOLE + LEET, FANCY, RETARD, PIGLATIN, CONSOLE } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/misc/NoDesyncModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/misc/NoDesyncModule.java index a4f23b4..36a55f0 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/misc/NoDesyncModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/misc/NoDesyncModule.java @@ -2,13 +2,17 @@ package me.rigamortis.seppuku.impl.module.misc; import me.rigamortis.seppuku.api.event.EventStageable; import me.rigamortis.seppuku.api.event.network.EventReceivePacket; +import me.rigamortis.seppuku.api.event.player.EventDestroyBlock; import me.rigamortis.seppuku.api.module.Module; +import me.rigamortis.seppuku.api.value.Value; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityEnderCrystal; import net.minecraft.init.SoundEvents; +import net.minecraft.network.play.server.SPacketBlockChange; import net.minecraft.network.play.server.SPacketSoundEffect; import net.minecraft.util.SoundCategory; +import net.minecraft.util.math.BlockPos; import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; /** @@ -17,37 +21,65 @@ import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; */ public final class NoDesyncModule extends Module { + public final Value crystals = new Value("Crystals", new String[]{"Crystal", "c"}, "Attempts to fix crystal de-sync.", true); + public final Value destroyedBlocks = new Value("Blocks", new String[]{"DestroyedBlocks", "b"}, "Attempts to fix server->client block de-sync.", false); + + private boolean destroy; + private BlockPos pos; + public NoDesyncModule() { - super("NoDesync", new String[]{"NoDes", "AntiDesync"}, "Prevents the client from desyncing in some situations", "NONE", -1, ModuleType.MISC); + super("NoDesync", new String[]{"NoDes", "AntiDesync", "NoDe-sync"}, "Prevents the client from de-syncing in some situations", "NONE", -1, ModuleType.MISC); } @Override public void onToggle() { super.onToggle(); + this.destroy = false; + this.pos = null; } @Listener public void receivePacket(EventReceivePacket event) { if (event.getStage() == EventStageable.EventStage.PRE) { if (event.getPacket() instanceof SPacketSoundEffect) { - final SPacketSoundEffect packet = (SPacketSoundEffect) event.getPacket(); - if (packet.getCategory() == SoundCategory.BLOCKS && packet.getSound() == SoundEvents.ENTITY_GENERIC_EXPLODE) { - final Minecraft mc = Minecraft.getMinecraft(); - if (mc.world != null) { - for (int i = mc.world.loadedEntityList.size() - 1; i > 0; i--) { - Entity entity = mc.world.loadedEntityList.get(i); - if (entity != null) { - if (entity.isEntityAlive() && entity instanceof EntityEnderCrystal) { - if (entity.getDistance(packet.getX(), packet.getY(), packet.getZ()) <= 6.0f) { - entity.setDead(); + if (this.crystals.getValue()) { + final SPacketSoundEffect packet = (SPacketSoundEffect) event.getPacket(); + if (packet.getCategory() == SoundCategory.BLOCKS && packet.getSound() == SoundEvents.ENTITY_GENERIC_EXPLODE) { + final Minecraft mc = Minecraft.getMinecraft(); + if (mc.world != null) { + for (int i = mc.world.loadedEntityList.size() - 1; i > 0; i--) { + Entity entity = mc.world.loadedEntityList.get(i); + if (entity != null) { + if (entity.isEntityAlive() && entity instanceof EntityEnderCrystal) { + if (entity.getDistance(packet.getX(), packet.getY(), packet.getZ()) <= 6.0f) { + entity.setDead(); + } } } } } } } + } else if (event.getPacket() instanceof SPacketBlockChange) { + if (this.destroyedBlocks.getValue()) { + SPacketBlockChange packet = (SPacketBlockChange) event.getPacket(); + if (packet.getBlockPosition() == this.pos) { + this.destroy = true; + } + } } } } + @Listener + public void onDestroyBlock(EventDestroyBlock event) { + this.pos = event.getPos(); + if (this.destroy) { + event.setCanceled(false); + this.destroy = false; + this.pos = null; + } else { + event.setCanceled(true); + } + } } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/movement/ElytraFlyModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/movement/ElytraFlyModule.java index 36adfd0..2c473d6 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/movement/ElytraFlyModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/movement/ElytraFlyModule.java @@ -33,6 +33,7 @@ public final class ElytraFlyModule extends Module { public final Value speed = new Value("Speed", new String[]{"Spd"}, "Speed multiplier for elytra flight, higher values equals more speed.", 1.0f, 0.0f, 5.0f, 0.01f); public final Value autoStart = new Value("AutoStart", new String[]{"AutoStart", "start", "autojump"}, "Hold down the jump key to have an easy automated lift off.", true); + public final Value autoStartDelay = new Value("StartDelay", new String[]{"AutoStartDelay", "Delay", "startdelay", "autojumpdelay", "asd"}, "Delay(ms) between auto-start attempts.", 50.0f, 0.0f, 1000.0f, 10.0f); public final Value disableInLiquid = new Value("DisableInLiquid", new String[]{"DisableInWater", "DisableInLava", "disableliquid", "liquidoff", "noliquid"}, "Disables all elytra flight when the player is in contact with liquid.", true); public final Value infiniteDurability = new Value("InfiniteDurability", new String[]{"InfiniteDura", "dura", "inf", "infdura"}, "Enables an old exploit that sends the start elytra-flying packet each tick.", false); public final Value noKick = new Value("NoKick", new String[]{"AntiKick", "Kick"}, "Bypass the server kicking you for flying while in elytra flight (Only works for Packet mode!).", true); @@ -83,7 +84,7 @@ public final class ElytraFlyModule extends Module { if (this.autoStart.getValue()) { if (mc.gameSettings.keyBindJump.isKeyDown() && !mc.player.isElytraFlying()) { // jump is held, player is not elytra flying if (mc.player.motionY < 0) { // player motion is falling - if (this.timer.passed(250)) { // 250 ms + if (this.timer.passed(this.autoStartDelay.getValue())) { mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_FALL_FLYING)); this.timer.reset(); } @@ -135,7 +136,7 @@ public final class ElytraFlyModule extends Module { mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_FALL_FLYING)); mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_FALL_FLYING)); break; - case BYPASS: // Bypass / 9b9t + case BYPASS: // Bypass / 9b9t (possibly broken currently?) if (mc.gameSettings.keyBindJump.isKeyDown()) { mc.player.motionY = 0.02f; } diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/movement/SpeedModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/movement/SpeedModule.java index 8ce5c37..df57a51 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/movement/SpeedModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/movement/SpeedModule.java @@ -101,10 +101,8 @@ public final class SpeedModule extends Module { this.movementSpeed = Math.max(this.movementSpeed, this.getDefaultSpeed()); final double[] direction = MathUtil.directionSpeed(this.movementSpeed); - if (direction != null) { - mc.player.motionX = direction[0]; - mc.player.motionZ = direction[1]; - } + mc.player.motionX = direction[0]; + mc.player.motionZ = direction[1]; this.tick += 1; }