From 5aa2c7e823b77eec6aaf2d8b17e1cde7b5f3aa4c Mon Sep 17 00:00:00 2001
From: Zachary Davis <test106437@gmail.com>
Date: Thu, 16 Jan 2025 02:04:04 +0200
Subject: [PATCH] format issues

---
 .../net/wurstclient/hacks/ElytraLockHack.java | 256 ++++++++----------
 .../filterlists/ElytraLockFilterList.java     |  99 ++++---
 2 files changed, 168 insertions(+), 187 deletions(-)

diff --git a/src/main/java/net/wurstclient/hacks/ElytraLockHack.java b/src/main/java/net/wurstclient/hacks/ElytraLockHack.java
index 5495f5e94b..e4d0f47bbc 100644
--- a/src/main/java/net/wurstclient/hacks/ElytraLockHack.java
+++ b/src/main/java/net/wurstclient/hacks/ElytraLockHack.java
@@ -49,279 +49,263 @@
 import net.wurstclient.util.RenderUtils;
 import net.wurstclient.util.RotationUtils;
 
-@SearchTags({"elytra, lock"})
+@SearchTags({ "elytra, lock" })
 public final class ElytraLockHack extends Hack
-	implements UpdateListener, RenderListener, GUIRenderListener
-{
+		implements UpdateListener, RenderListener, GUIRenderListener {
 	private final EnumSetting<Priority> priority = new EnumSetting<>("Priority",
-		"Determines which entity will be attacked first.\n"
-			+ "\u00a7lDistance\u00a7r - Attacks the closest entity.\n"
-			+ "\u00a7lAngle\u00a7r - Attacks the entity that requires the least head movement.\n"
-			+ "\u00a7lAngle+Dist\u00a7r - A hybrid of Angle and Distance. This is usually the best at figuring out what you want to aim at.\n"
-			+ "\u00a7lHealth\u00a7r - Attacks the weakest entity.",
-		Priority.values(), Priority.ANGLE_DIST);
-	
+			"Determines which entity will be aimed at first.\n"
+					+ "\u00a7lDistance\u00a7r - Aims at the closest entity.\n"
+					+ "\u00a7lAngle\u00a7r - Aimes at the entity that requires the least head movement.\n"
+					+ "\u00a7lAngle+Dist\u00a7r - A hybrid of Angle and Distance. This is usually the best at figuring out what you want to aim at.\n"
+					+ "\u00a7lHealth\u00a7r - Aims at the weakest entity.",
+			Priority.values(), Priority.ANGLE_DIST);
+
 	private final SliderSetting cooldownSlider = new SliderSetting(
-		"Cooldown",
-		"The amount of time from beginning an elytra flight to locking on an entity. This will allow proper time to launch and gain speed.",
-		3, 0, 10, 1, ValueDisplay.DECIMAL);
-	
-	private final EntityFilterList entityFilters =
-		ElytraLockFilterList.create();
-	
+			"Cooldown",
+			"The amount of time from beginning an elytra flight to locking on an entity. This will allow proper time to launch and gain speed.",
+			3, 0, 10, 1, ValueDisplay.DECIMAL);
+
+	private final EntityFilterList entityFilters = ElytraLockFilterList.create();
+
 	private final ColorSetting color = new ColorSetting("ESP color",
-		"Color of the box that ElytraLock draws around the target.", Color.RED);
-	
-	private static final Box TARGET_BOX =
-		new Box(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5);
-	
+			"Color of the box that ElytraLock draws around the target.", Color.RED);
+
+	private static final Box TARGET_BOX = new Box(-0.5, -0.5, -0.5, 0.5, 0.5, 0.5);
+
 	private Entity target;
 	private float velocity;
 
-    private double cooldown;
-	
-	public ElytraLockHack()
-	{
+	private double cooldown;
+
+	public ElytraLockHack() {
 		super("ElytraLock");
-		
+
 		setCategory(Category.COMBAT);
 		addSetting(priority);
 		addSetting(cooldownSlider);
-		
+
 		entityFilters.forEach(this::addSetting);
-		
+
 		addSetting(color);
 	}
-	
 
-    
 	@Override
-	protected void onEnable()
-	{
+	protected void onEnable() {
 		// disable conflicting hacks
 		WURST.getHax().excavatorHack.setEnabled(false);
 		WURST.getHax().templateToolHack.setEnabled(false);
-		
+
 		// register event listeners
 		EVENTS.add(GUIRenderListener.class, this);
 		EVENTS.add(RenderListener.class, this);
 		EVENTS.add(UpdateListener.class, this);
 	}
-	
+
 	@Override
-	protected void onDisable()
-	{
+	protected void onDisable() {
 		EVENTS.remove(GUIRenderListener.class, this);
 		EVENTS.remove(RenderListener.class, this);
 		EVENTS.remove(UpdateListener.class, this);
 	}
-	
-
-    @Override
-	public void onUpdate()
-	{
-        if(!MC.player.isGliding()) {
-            target = null;
-            cooldown = cooldownSlider.getValue();
-            return;
-        }
-
-        if (cooldown >= 0) {
-            cooldown -= 0.1;
-            return;
-        }
-
-		if(!MC.options.jumpKey.isPressed()) {
+
+	@Override
+	public void onUpdate() {
+		if (!MC.player.isGliding()) {
 			target = null;
-            return;
-        }
+			cooldown = cooldownSlider.getValue();
+			return;
+		}
+
+		if (cooldown >= 0) {
+			cooldown -= 0.1;
+			return;
+		}
+
+		if (!MC.options.jumpKey.isPressed()) {
+			target = null;
+			return;
+		}
 
 		ClientPlayerEntity player = MC.player;
-		
+
 		// set target
-		if(filterEntities(Stream.of(target)) == null)
+		if (filterEntities(Stream.of(target)) == null)
 			target = filterEntities(StreamSupport
-				.stream(MC.world.getEntities().spliterator(), true));
-		
-		if(target == null)
+					.stream(MC.world.getEntities().spliterator(), true));
+
+		if (target == null)
 			return;
-		
+
 		// set velocity
 		velocity = (72000 - player.getItemUseTimeLeft()) / 20F;
 		velocity = (velocity * velocity + velocity * 2) / 3;
-		if(velocity > 1)
+		if (velocity > 1)
 			velocity = 1;
-		
+
 		// set position to aim at
 		double d = RotationUtils.getEyesPos().distanceTo(
-			target.getBoundingBox().getCenter());
+				target.getBoundingBox().getCenter());
 		double posX = target.getX() + (target.getX() - target.lastRenderX) * d
-			- player.getX();
+				- player.getX();
 		double posY = target.getY() + (target.getY() - target.lastRenderY) * d
-			+ target.getHeight() * 0.5 - player.getY()
-			- player.getEyeHeight(player.getPose());
+				+ target.getHeight() * 0.5 - player.getY()
+				- player.getEyeHeight(player.getPose());
 		double posZ = target.getZ() + (target.getZ() - target.lastRenderZ) * d
-			- player.getZ();
-		
+				- player.getZ();
+
 		// set yaw
-		float neededYaw = (float)Math.toDegrees(Math.atan2(posZ, posX)) - 90;
+		float neededYaw = (float) Math.toDegrees(Math.atan2(posZ, posX)) - 90;
 		MC.player.setYaw(
-			RotationUtils.limitAngleChange(MC.player.getYaw(), neededYaw));
-		
+				RotationUtils.limitAngleChange(MC.player.getYaw(), neededYaw));
+
 		// calculate needed pitch
 		double hDistance = Math.sqrt(posX * posX + posZ * posZ);
 		double hDistanceSq = hDistance * hDistance;
 		float g = 0.006F;
 
-		float neededPitch = (float)-Math.toDegrees(Math.atan((1 - Math
-			.sqrt(1 - g * (g * hDistanceSq + 2 * posY * 1)))
-			/ (g * hDistance)));
-		
+		float neededPitch = (float) -Math.toDegrees(Math.atan((1 - Math
+				.sqrt(1 - g * (g * hDistanceSq + 2 * posY * 1)))
+				/ (g * hDistance)));
+
 		// set pitch
-		if(Float.isNaN(neededPitch))
+		if (Float.isNaN(neededPitch))
 			WURST.getRotationFaker()
-				.faceVectorClient(target.getBoundingBox().getCenter());
+					.faceVectorClient(target.getBoundingBox().getCenter());
 		else
 			MC.player.setPitch(neededPitch);
 	}
-	
-	private Entity filterEntities(Stream<Entity> s)
-	{
+
+	private Entity filterEntities(Stream<Entity> s) {
 		Stream<Entity> stream = s.filter(EntityUtils.IS_ATTACKABLE);
 		stream = entityFilters.applyTo(stream);
-		
+
 		return stream.min(priority.getSelected().comparator).orElse(null);
 	}
-	
+
 	@Override
-	public void onRender(MatrixStack matrixStack, float partialTicks)
-	{
-		if(target == null)
+	public void onRender(MatrixStack matrixStack, float partialTicks) {
+		if (target == null)
 			return;
-		
+
 		// GL settings
 		GL11.glEnable(GL11.GL_BLEND);
 		GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
 		GL11.glDisable(GL11.GL_DEPTH_TEST);
-		
+
 		matrixStack.push();
-		
+
 		RegionPos region = RenderUtils.getCameraRegion();
 		RenderUtils.applyRegionalRenderOffset(matrixStack, region);
-		
+
 		// set position
 		matrixStack.translate(target.getX() - region.x(), target.getY(),
-			target.getZ() - region.z());
-		
+				target.getZ() - region.z());
+
 		// set size
 		float boxWidth = target.getWidth() + 0.1F;
 		float boxHeight = target.getHeight() + 0.1F;
 		matrixStack.scale(boxWidth, boxHeight, boxWidth);
-		
+
 		// move to center
 		matrixStack.translate(0, 0.5, 0);
-		
+
 		float v = 1 / velocity;
 		matrixStack.scale(v, v, v);
-		
+
 		RenderSystem.setShader(ShaderProgramKeys.POSITION);
-		
+
 		// draw outline
 		color.setAsShaderColor(0.5F * velocity);
 		RenderUtils.drawOutlinedBox(TARGET_BOX, matrixStack);
-		
+
 		// draw box
 		color.setAsShaderColor(0.25F * velocity);
 		RenderUtils.drawSolidBox(TARGET_BOX, matrixStack);
-		
+
 		matrixStack.pop();
-		
+
 		// GL resets
 		GL11.glEnable(GL11.GL_DEPTH_TEST);
 		GL11.glDisable(GL11.GL_BLEND);
 		RenderSystem.setShaderColor(1, 1, 1, 1);
 	}
-	
+
 	@Override
-	public void onRenderGUI(DrawContext context, float partialTicks)
-	{
+	public void onRenderGUI(DrawContext context, float partialTicks) {
 		MatrixStack matrixStack = context.getMatrices();
-		if(target == null)
+		if (target == null)
 			return;
-		
+
 		// GL settings
 		GL11.glEnable(GL11.GL_BLEND);
 		GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
 		GL11.glDisable(GL11.GL_CULL_FACE);
-		
+
 		matrixStack.push();
-		
+
 		Matrix4f matrix = matrixStack.peek().getPositionMatrix();
 		Tessellator tessellator = RenderSystem.renderThreadTesselator();
-		
 
 		String message = "Locked on!";
-		
+
 		TextRenderer tr = MC.textRenderer;
-		
+
 		// translate to center
 		Window sr = MC.getWindow();
 		int msgWidth = tr.getWidth(message);
 		matrixStack.translate(sr.getScaledWidth() / 2 - msgWidth / 2,
-			sr.getScaledHeight() / 2 + 1, 0);
-		
+				sr.getScaledHeight() / 2 + 1, 0);
+
 		// background
 		RenderSystem.setShader(ShaderProgramKeys.POSITION);
 		RenderSystem.setShaderColor(0, 0, 0, 0.5F);
 		BufferBuilder bufferBuilder = tessellator
-			.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
+				.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION);
 		bufferBuilder.vertex(matrix, 0, 0, 0);
 		bufferBuilder.vertex(matrix, msgWidth + 3, 0, 0);
 		bufferBuilder.vertex(matrix, msgWidth + 3, 10, 0);
 		bufferBuilder.vertex(matrix, 0, 10, 0);
 		BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
-		
+
 		// text
 		RenderSystem.setShaderColor(1, 1, 1, 1);
 		context.drawText(MC.textRenderer, message, 2, 1, 0xffffffff, false);
-		
+
 		matrixStack.pop();
-		
+
 		// GL resets
 		GL11.glEnable(GL11.GL_CULL_FACE);
 		GL11.glDisable(GL11.GL_BLEND);
 		RenderSystem.setShaderColor(1, 1, 1, 1);
 	}
-	
-	private enum Priority
-	{
+
+	private enum Priority {
 		DISTANCE("Distance", e -> MC.player.squaredDistanceTo(e)),
-		
+
 		ANGLE("Angle",
-			e -> RotationUtils
-				.getAngleToLookVec(e.getBoundingBox().getCenter())),
-		
+				e -> RotationUtils
+						.getAngleToLookVec(e.getBoundingBox().getCenter())),
+
 		ANGLE_DIST("Angle+Dist",
-			e -> Math
-				.pow(RotationUtils
-					.getAngleToLookVec(e.getBoundingBox().getCenter()), 2)
-				+ MC.player.squaredDistanceTo(e)),
-		
+				e -> Math
+						.pow(RotationUtils
+								.getAngleToLookVec(e.getBoundingBox().getCenter()), 2)
+						+ MC.player.squaredDistanceTo(e)),
+
 		HEALTH("Health", e -> e instanceof LivingEntity
-			? ((LivingEntity)e).getHealth() : Integer.MAX_VALUE);
-		
+				? ((LivingEntity) e).getHealth()
+				: Integer.MAX_VALUE);
+
 		private final String name;
 		private final Comparator<Entity> comparator;
-		
-		private Priority(String name, ToDoubleFunction<Entity> keyExtractor)
-		{
+
+		private Priority(String name, ToDoubleFunction<Entity> keyExtractor) {
 			this.name = name;
 			comparator = Comparator.comparingDouble(keyExtractor);
 		}
-		
+
 		@Override
-		public String toString()
-		{
+		public String toString() {
 			return name;
 		}
 	}
diff --git a/src/main/java/net/wurstclient/settings/filterlists/ElytraLockFilterList.java b/src/main/java/net/wurstclient/settings/filterlists/ElytraLockFilterList.java
index 682c6699f6..b23b404ddf 100644
--- a/src/main/java/net/wurstclient/settings/filterlists/ElytraLockFilterList.java
+++ b/src/main/java/net/wurstclient/settings/filterlists/ElytraLockFilterList.java
@@ -12,74 +12,71 @@
 
 import net.wurstclient.settings.filters.*;
 
-public final class ElytraLockFilterList extends EntityFilterList
-{
-private ElytraLockFilterList(List<EntityFilter> filters)
-{
-super(filters);
-}
+public final class ElytraLockFilterList extends EntityFilterList {
+    private ElytraLockFilterList(List<EntityFilter> filters) {
+        super(filters);
+    }
 
-public static ElytraLockFilterList create()
-{
-ArrayList<EntityFilter> builder = new ArrayList<>();
+    public static ElytraLockFilterList create() {
+        ArrayList<EntityFilter> builder = new ArrayList<>();
 
-builder.add(new FilterPlayersSetting(
-"Won't target other players when locking in.", false));
+        builder.add(new FilterPlayersSetting(
+                "Won't target other players when locking in.", false));
 
-builder.add(new FilterHostileSetting("Won't target hostile mobs like"
-+ " zombies and creepers when locking in.", true));
+        builder.add(new FilterHostileSetting("Won't target hostile mobs like"
+                + " zombies and creepers when locking in.", true));
 
-builder.add(new FilterNeutralSetting("Won't target neutral mobs like"
-+ " endermen and wolves when locking in.", AttackDetectingEntityFilter.Mode.ON));
+        builder.add(new FilterNeutralSetting("Won't target neutral mobs like"
+                + " endermen and wolves when locking in.", AttackDetectingEntityFilter.Mode.ON));
 
-builder.add(new FilterPassiveSetting("Won't target animals like pigs"
-+ " and cows, ambient mobs like bats, and water mobs like fish,"
-+ " squid and dolphins when locking in.",
-true));
+        builder.add(new FilterPassiveSetting("Won't target animals like pigs"
+                + " and cows, ambient mobs like bats, and water mobs like fish,"
+                + " squid and dolphins when locking in.",
+                true));
 
-builder.add(new FilterPassiveWaterSetting("Won't target passive water"
-+ " mobs like fish, squid, dolphins and axolotls when auto-placing", true));
+        builder.add(new FilterPassiveWaterSetting("Won't target passive water"
+                + " mobs like fish, squid, dolphins and axolotls when auto-placing", true));
 
-builder.add(new FilterBatsSetting("Won't target bats and any other"
-+ " \"ambient\" mobs when locking in.", true));
+        builder.add(new FilterBatsSetting("Won't target bats and any other"
+                + " \"ambient\" mobs when locking in.", true));
 
-builder.add(new FilterSlimesSetting("Won't target slimes when"
-+ " locking in.", true));
+        builder.add(new FilterSlimesSetting("Won't target slimes when"
+                + " locking in.", true));
 
-builder.add(new FilterVillagersSetting("Won't target villagers and"
-+ " wandering traders when locking in.",
-true));
+        builder.add(new FilterVillagersSetting("Won't target villagers and"
+                + " wandering traders when locking in.",
+                true));
 
-builder.add(new FilterZombieVillagersSetting("Won't target zombified"
-+ " villagers when locking in.", true));
+        builder.add(new FilterZombieVillagersSetting("Won't target zombified"
+                + " villagers when locking in.", true));
 
-builder.add(new FilterGolemsSetting("Won't target iron golems and snow"
-+ " golems when locking in.", true));
+        builder.add(new FilterGolemsSetting("Won't target iron golems and snow"
+                + " golems when locking in.", true));
 
-builder.add(new FilterPiglinsSetting("Won't target piglins when"
-+ " locking in.",
-AttackDetectingEntityFilter.Mode.ON));
+        builder.add(new FilterPiglinsSetting("Won't target piglins when"
+                + " locking in.",
+                AttackDetectingEntityFilter.Mode.ON));
 
-builder.add(new FilterZombiePiglinsSetting("Won't target"
-+ " zombified piglins when locking in.",
-AttackDetectingEntityFilter.Mode.ON));
+        builder.add(new FilterZombiePiglinsSetting("Won't target"
+                + " zombified piglins when locking in.",
+                AttackDetectingEntityFilter.Mode.ON));
 
-builder.add(new FilterShulkersSetting("Won't target shulkers when"
-+ " locking in.", true));
+        builder.add(new FilterShulkersSetting("Won't target shulkers when"
+                + " locking in.", true));
 
-builder.add(new FilterAllaysSetting(
-"Won't target allays when locking in.",
-true));
+        builder.add(new FilterAllaysSetting(
+                "Won't target allays when locking in.",
+                true));
 
-builder.add(new FilterInvisibleSetting(
-"Won't target invisible entities when locking in.", false));
+        builder.add(new FilterInvisibleSetting(
+                "Won't target invisible entities when locking in.", false));
 
-builder.add(new FilterNamedSetting(
-"Won't target name-tagged entities when locking in.", false));
+        builder.add(new FilterNamedSetting(
+                "Won't target name-tagged entities when locking in.", false));
 
-builder.add(new FilterArmorStandsSetting(
-"Won't target armor stands when locking in.", true));
+        builder.add(new FilterArmorStandsSetting(
+                "Won't target armor stands when locking in.", true));
 
-return new ElytraLockFilterList(builder);
-}
+        return new ElytraLockFilterList(builder);
+    }
 }
\ No newline at end of file