From d68cf25ccbff5e52d6490c507a61e7616a757e14 Mon Sep 17 00:00:00 2001 From: noil Date: Tue, 27 Apr 2021 15:08:13 -0400 Subject: [PATCH] Code cleanup --- .../hud/component/DraggableHudComponent.java | 8 +++++-- .../api/gui/menu/GuiPasswordField.java | 24 +++++++++---------- .../rigamortis/seppuku/api/util/AuthUtil.java | 2 +- .../seppuku/impl/config/SearchConfig.java | 2 -- .../gui/hud/component/CoordsComponent.java | 2 -- .../hud/component/EnabledModsComponent.java | 3 ++- .../component/module/ModuleListComponent.java | 14 +++++------ .../impl/module/misc/FriendTabModule.java | 3 --- .../impl/module/movement/GuiMoveModule.java | 1 - .../impl/module/player/FreeCamModule.java | 1 + .../impl/module/world/AmbianceModule.java | 2 +- .../impl/module/world/NoteBotModule.java | 1 - .../seppuku/impl/patch/BlockLiquidPatch.java | 1 - .../impl/patch/GuiPlayerTabOverlayPatch.java | 5 +--- .../impl/patch/ParticleManagerPatch.java | 3 --- 15 files changed, 31 insertions(+), 41 deletions(-) diff --git a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/DraggableHudComponent.java b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/DraggableHudComponent.java index 5f4862c..2907a59 100644 --- a/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/DraggableHudComponent.java +++ b/src/main/java/me/rigamortis/seppuku/api/gui/hud/component/DraggableHudComponent.java @@ -288,9 +288,13 @@ public class DraggableHudComponent extends HudComponent { } } - public boolean isRclicked() { return rclicked; } + public boolean isRclicked() { + return rclicked; + } - public void setRclicked(boolean rclicked) { this.rclicked = rclicked; } + public void setRclicked(boolean rclicked) { + this.rclicked = rclicked; + } public boolean isSnappable() { return snappable; diff --git a/src/main/java/me/rigamortis/seppuku/api/gui/menu/GuiPasswordField.java b/src/main/java/me/rigamortis/seppuku/api/gui/menu/GuiPasswordField.java index 80c5735..3a1a2f3 100644 --- a/src/main/java/me/rigamortis/seppuku/api/gui/menu/GuiPasswordField.java +++ b/src/main/java/me/rigamortis/seppuku/api/gui/menu/GuiPasswordField.java @@ -183,23 +183,23 @@ public class GuiPasswordField extends Gui { boolean flag = n < 0; int j = Math.abs(n); - for(int k = 0; k < j; ++k) { + for (int k = 0; k < j; ++k) { if (!flag) { int l = this.text.length(); i = this.text.indexOf(32, i); if (i == -1) { i = l; } else { - while(skipWs && i < l && this.text.charAt(i) == ' ') { + while (skipWs && i < l && this.text.charAt(i) == ' ') { ++i; } } } else { - while(skipWs && i > 0 && this.text.charAt(i - 1) == ' ') { + while (skipWs && i > 0 && this.text.charAt(i - 1) == ' ') { --i; } - while(i > 0 && this.text.charAt(i - 1) != ' ') { + while (i > 0 && this.text.charAt(i - 1) != ' ') { --i; } } @@ -251,7 +251,7 @@ public class GuiPasswordField extends Gui { return true; } else { - switch(keyCode) { + switch (keyCode) { case 14: if (GuiScreen.isCtrlKeyDown()) { if (this.isEnabled) { @@ -372,7 +372,7 @@ public class GuiPasswordField extends Gui { if (!s.isEmpty()) { String s1 = flag ? s.substring(0, j) : s; - j1 = this.fontRenderer.drawStringWithShadow(s1.replaceAll("(?s).", "*"), (float)l, (float)i1, i); + j1 = this.fontRenderer.drawStringWithShadow(s1.replaceAll("(?s).", "*"), (float) l, (float) i1, i); } boolean flag2 = this.cursorPosition < this.text.length() || this.text.length() >= this.getMaxStringLength(); @@ -385,14 +385,14 @@ public class GuiPasswordField extends Gui { } if (!s.isEmpty() && flag && j < s.length()) { - j1 = this.fontRenderer.drawStringWithShadow(s.substring(j), (float)j1, (float)i1, i); + j1 = this.fontRenderer.drawStringWithShadow(s.substring(j), (float) j1, (float) i1, i); } if (flag1) { if (flag2) { Gui.drawRect(k1, i1 - 1, k1 + 1, i1 + 1 + this.fontRenderer.FONT_HEIGHT, -3092272); } else { - this.fontRenderer.drawStringWithShadow("_", (float)k1, (float)i1, i); + this.fontRenderer.drawStringWithShadow("_", (float) k1, (float) i1, i); } } @@ -433,10 +433,10 @@ public class GuiPasswordField extends Gui { GlStateManager.enableColorLogic(); GlStateManager.colorLogicOp(LogicOp.OR_REVERSE); bufferbuilder.begin(7, DefaultVertexFormats.POSITION); - bufferbuilder.pos((double)startX, (double)endY, 0.0D).endVertex(); - bufferbuilder.pos((double)endX, (double)endY, 0.0D).endVertex(); - bufferbuilder.pos((double)endX, (double)startY, 0.0D).endVertex(); - bufferbuilder.pos((double)startX, (double)startY, 0.0D).endVertex(); + bufferbuilder.pos((double) startX, (double) endY, 0.0D).endVertex(); + bufferbuilder.pos((double) endX, (double) endY, 0.0D).endVertex(); + bufferbuilder.pos((double) endX, (double) startY, 0.0D).endVertex(); + bufferbuilder.pos((double) startX, (double) startY, 0.0D).endVertex(); tessellator.draw(); GlStateManager.disableColorLogic(); GlStateManager.enableTexture2D(); diff --git a/src/main/java/me/rigamortis/seppuku/api/util/AuthUtil.java b/src/main/java/me/rigamortis/seppuku/api/util/AuthUtil.java index 6631977..f2472a9 100644 --- a/src/main/java/me/rigamortis/seppuku/api/util/AuthUtil.java +++ b/src/main/java/me/rigamortis/seppuku/api/util/AuthUtil.java @@ -38,7 +38,7 @@ public final class AuthUtil { if (username == null || username.length() <= 0 || password == null || password.length() <= 0) return "Error"; YggdrasilAuthenticationService a = new YggdrasilAuthenticationService(Proxy.NO_PROXY, ""); - YggdrasilUserAuthentication b = (YggdrasilUserAuthentication)a.createUserAuthentication(Agent.MINECRAFT); + YggdrasilUserAuthentication b = (YggdrasilUserAuthentication) a.createUserAuthentication(Agent.MINECRAFT); b.setUsername(username); b.setPassword(password); try { diff --git a/src/main/java/me/rigamortis/seppuku/impl/config/SearchConfig.java b/src/main/java/me/rigamortis/seppuku/impl/config/SearchConfig.java index aa782f4..e661234 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/config/SearchConfig.java +++ b/src/main/java/me/rigamortis/seppuku/impl/config/SearchConfig.java @@ -7,11 +7,9 @@ import me.rigamortis.seppuku.Seppuku; import me.rigamortis.seppuku.api.config.Configurable; import me.rigamortis.seppuku.api.util.FileUtil; import me.rigamortis.seppuku.impl.module.render.SearchModule; -import me.rigamortis.seppuku.impl.module.render.XrayModule; import net.minecraft.block.Block; import java.io.File; -import java.util.Objects; /** * @author noil diff --git a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/CoordsComponent.java b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/CoordsComponent.java index 10e9a4b..2ae3b45 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/CoordsComponent.java +++ b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/CoordsComponent.java @@ -1,9 +1,7 @@ package me.rigamortis.seppuku.impl.gui.hud.component; import com.mojang.realmsclient.gui.ChatFormatting; -import me.rigamortis.seppuku.Seppuku; import me.rigamortis.seppuku.api.gui.hud.component.DraggableHudComponent; -import me.rigamortis.seppuku.impl.gui.hud.GuiHudEditor; import net.minecraft.client.Minecraft; import java.text.DecimalFormat; 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 a0b5b65..11bbb2d 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 @@ -19,7 +19,8 @@ import java.util.ArrayList; import java.util.Comparator; import java.util.List; -import static me.rigamortis.seppuku.impl.module.hidden.ArrayListModule.Mode.*; +import static me.rigamortis.seppuku.impl.module.hidden.ArrayListModule.Mode.ALPHABET; +import static me.rigamortis.seppuku.impl.module.hidden.ArrayListModule.Mode.LENGTH; /** * @author seth * 7/25/2019 @ 7:24 AM diff --git a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/module/ModuleListComponent.java b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/module/ModuleListComponent.java index c055ac7..01c9335 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/module/ModuleListComponent.java +++ b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/module/ModuleListComponent.java @@ -649,14 +649,14 @@ public final class ModuleListComponent extends ResizableHudComponent { if (otherComponent == component || otherComponent.getName().equals(component.getName())) continue; - boolean isChildComponent = component.getName().toLowerCase().startsWith(otherComponent.getName().toLowerCase()); - if (isChildComponent) { - if (!otherComponent.rightClickEnabled) { - skipRendering = true; - } - - offsetX += 4; + boolean isChildComponent = component.getName().toLowerCase().startsWith(otherComponent.getName().toLowerCase()); + if (isChildComponent) { + if (!otherComponent.rightClickEnabled) { + skipRendering = true; } + + offsetX += 4; + } } if (skipRendering) diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/misc/FriendTabModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/misc/FriendTabModule.java index 474e3d4..6bd18cd 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/misc/FriendTabModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/misc/FriendTabModule.java @@ -1,12 +1,9 @@ package me.rigamortis.seppuku.impl.module.misc; import me.rigamortis.seppuku.Seppuku; -import me.rigamortis.seppuku.api.event.EventStageable; import me.rigamortis.seppuku.api.event.gui.EventGetGuiTabName; -import me.rigamortis.seppuku.api.event.network.EventReceivePacket; import me.rigamortis.seppuku.api.friend.Friend; import me.rigamortis.seppuku.api.module.Module; -import net.minecraft.network.play.server.SPacketPlayerListHeaderFooter; import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; /** diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/movement/GuiMoveModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/movement/GuiMoveModule.java index 754da32..5178413 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/movement/GuiMoveModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/movement/GuiMoveModule.java @@ -1,7 +1,6 @@ package me.rigamortis.seppuku.impl.module.movement; import me.rigamortis.seppuku.api.event.EventStageable; -import me.rigamortis.seppuku.api.event.player.EventPlayerUpdate; import me.rigamortis.seppuku.api.event.player.EventUpdateWalkingPlayer; import me.rigamortis.seppuku.api.module.Module; import me.rigamortis.seppuku.api.value.Value; diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/player/FreeCamModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/player/FreeCamModule.java index dd69fe6..9abd693 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/player/FreeCamModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/player/FreeCamModule.java @@ -190,6 +190,7 @@ public final class FreeCamModule extends Module { /** * Deprecated + * * @param event */ @Listener diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/world/AmbianceModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/world/AmbianceModule.java index 6e13192..188543d 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/world/AmbianceModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/world/AmbianceModule.java @@ -25,7 +25,7 @@ public class AmbianceModule extends Module { } public final Value skyMode = new Value("SkyMode", new String[]{"Sky", "Sm", "SkieMode", "Skie", "Skies"}, "Edit the skybox.", SkyMode.SEPPUKU); - public final Value skyColor = new Value("SkyColor", new String[]{"SkyCol", "Sc", "SkieColor", "SkieCol", "Color", "C"}, "Edit the skybox color (COLOR mode only).", new Color(0, 127, 255)); + public final Value skyColor = new Value("SkyColor", new String[]{"SkyCol", "Sc", "SkieColor", "SkieCol", "Color", "C"}, "Edit the skybox color (COLOR mode only).", new Color(0, 127, 255)); public final Value skyGamma = new Value("SkyGamma", new String[]{"SkyGam", "SkyG", "Sg", "Gamma", "G"}, "Edit the skybox gamma.", 128, 1, 255, 1); public final Value skyGammaEnd = new Value("SkyGammaEnd", new String[]{"SkyGamEnd", "SkyGe", "Sge", "GammaEnd", "GamEnd", "Ge"}, "Edit the skybox gamma (END mode only).", 40, 1, 255, 1); diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/world/NoteBotModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/world/NoteBotModule.java index 7c54519..484f7ac 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/module/world/NoteBotModule.java +++ b/src/main/java/me/rigamortis/seppuku/impl/module/world/NoteBotModule.java @@ -4,7 +4,6 @@ import me.rigamortis.seppuku.Seppuku; import me.rigamortis.seppuku.api.event.EventStageable; import me.rigamortis.seppuku.api.event.network.EventReceivePacket; import me.rigamortis.seppuku.api.event.player.EventPlayerUpdate; -import me.rigamortis.seppuku.api.event.player.EventUpdateWalkingPlayer; import me.rigamortis.seppuku.api.event.render.EventRender3D; import me.rigamortis.seppuku.api.event.world.EventLoadWorld; import me.rigamortis.seppuku.api.module.Module; diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/BlockLiquidPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/BlockLiquidPatch.java index 5ee4297..8327be7 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/BlockLiquidPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/BlockLiquidPatch.java @@ -1,7 +1,6 @@ package me.rigamortis.seppuku.impl.patch; import me.rigamortis.seppuku.Seppuku; -import me.rigamortis.seppuku.api.event.render.EventRenderBlockSide; import me.rigamortis.seppuku.api.event.world.EventCanCollide; import me.rigamortis.seppuku.api.event.world.EventLiquidCollisionBB; import me.rigamortis.seppuku.api.patch.ClassPatch; diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/GuiPlayerTabOverlayPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/GuiPlayerTabOverlayPatch.java index bd0adb4..468ef50 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/GuiPlayerTabOverlayPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/GuiPlayerTabOverlayPatch.java @@ -5,9 +5,7 @@ import me.rigamortis.seppuku.api.event.gui.EventGetGuiTabName; import me.rigamortis.seppuku.api.patch.ClassPatch; import me.rigamortis.seppuku.api.patch.MethodPatch; import me.rigamortis.seppuku.impl.management.PatchManager; -import net.minecraft.client.gui.GuiPlayerTabOverlay; import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.scoreboard.ScorePlayerTeam; import org.objectweb.asm.Type; import org.objectweb.asm.tree.*; @@ -31,7 +29,7 @@ public final class GuiPlayerTabOverlayPatch extends ClassPatch { public void getPlayerName(MethodNode methodNode, PatchManager.Environment env) { final InsnList insnList = new InsnList(); insnList.add(new VarInsnNode(ALOAD, 1)); - insnList.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "getPlayerNameHook", env == PatchManager.Environment.IDE ? "(Lnet/minecraft/client/network/NetworkPlayerInfo;)Ljava/lang/String;" : "(Lbsc;)Ljava/lang/String;", false)); + insnList.add(new MethodInsnNode(INVOKESTATIC, Type.getInternalName(this.getClass()), "getPlayerNameHook", env == PatchManager.Environment.IDE ? "(Lnet/minecraft/client/network/NetworkPlayerInfo;)Ljava/lang/String;" : "(Lbsc;)Ljava/lang/String;", false)); insnList.add(new InsnNode(ARETURN)); methodNode.instructions.insert(insnList); } @@ -44,5 +42,4 @@ public final class GuiPlayerTabOverlayPatch extends ClassPatch { } - } diff --git a/src/main/java/me/rigamortis/seppuku/impl/patch/ParticleManagerPatch.java b/src/main/java/me/rigamortis/seppuku/impl/patch/ParticleManagerPatch.java index dc64487..acd27d7 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/patch/ParticleManagerPatch.java +++ b/src/main/java/me/rigamortis/seppuku/impl/patch/ParticleManagerPatch.java @@ -2,13 +2,10 @@ package me.rigamortis.seppuku.impl.patch; import me.rigamortis.seppuku.Seppuku; import me.rigamortis.seppuku.api.event.render.EventAddEffect; -import me.rigamortis.seppuku.api.event.render.EventRenderBossHealth; -import me.rigamortis.seppuku.api.event.render.EventSpawnEffect; import me.rigamortis.seppuku.api.patch.ClassPatch; import me.rigamortis.seppuku.api.patch.MethodPatch; import me.rigamortis.seppuku.impl.management.PatchManager; import net.minecraft.client.particle.Particle; -import net.minecraft.util.EnumParticleTypes; import org.objectweb.asm.Type; import org.objectweb.asm.tree.*;