MathHelper & unused imports (#266)

This commit is contained in:
bluepanee
2023-07-11 11:34:31 +05:00
committed by GitHub
parent 02da1f5df5
commit 699d510003
4 changed files with 9 additions and 9 deletions

View File

@@ -11,7 +11,7 @@ import anticope.rejects.gui.themes.rounded.MeteorWidget;
import meteordevelopment.meteorclient.gui.utils.AlignmentX;
import meteordevelopment.meteorclient.gui.widgets.pressable.WPressable;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.utils.Utils;
import net.minecraft.util.math.MathHelper;
import static meteordevelopment.meteorclient.MeteorClient.mc;
import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_LEFT;
@@ -66,10 +66,10 @@ public class WMeteorModule extends WPressable implements MeteorWidget {
double pad = pad();
animationProgress1 += delta * 4 * ((module.isActive() || mouseOver) ? 1 : -1);
animationProgress1 = Math.max(0, Math.min(1, animationProgress1));
animationProgress1 = MathHelper.clamp(animationProgress1, 0, 1);
animationProgress2 += delta * 6 * (module.isActive() ? 1 : -1);
animationProgress2 = Math.max(0, Math.min(1, animationProgress2));
animationProgress2 = MathHelper.clamp(animationProgress2, 0, 1);
if (animationProgress1 > 0) {
renderer.quad(x, y, width * animationProgress1, height, theme.moduleBackground.get());

View File

@@ -14,8 +14,8 @@ import meteordevelopment.meteorclient.gui.widgets.input.WTextBox;
import meteordevelopment.meteorclient.gui.widgets.WWidget;
import meteordevelopment.meteorclient.gui.widgets.containers.WContainer;
import meteordevelopment.meteorclient.gui.widgets.containers.WVerticalList;
import meteordevelopment.meteorclient.utils.Utils;
import meteordevelopment.meteorclient.utils.render.color.Color;
import net.minecraft.util.math.MathHelper;
public class WMeteorTextBox extends WTextBox implements MeteorWidget {
private boolean cursorVisible;
@@ -68,7 +68,7 @@ public class WMeteorTextBox extends WTextBox implements MeteorWidget {
// Cursor
animProgress += delta * 10 * (focused && cursorVisible ? 1 : -1);
animProgress = Math.max(0, Math.min(1, animProgress));
animProgress = MathHelper.clamp(animProgress, 0, 1);
if ((focused && cursorVisible) || animProgress > 0) {
renderer.setAlpha(animProgress);

View File

@@ -10,7 +10,7 @@ import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
import anticope.rejects.gui.themes.rounded.MeteorWidget;
import meteordevelopment.meteorclient.gui.widgets.pressable.WCheckbox;
import meteordevelopment.meteorclient.utils.Utils;
import net.minecraft.util.math.MathHelper;
public class WMeteorCheckbox extends WCheckbox implements MeteorWidget {
private double animProgress;
@@ -25,7 +25,7 @@ public class WMeteorCheckbox extends WCheckbox implements MeteorWidget {
MeteorRoundedGuiTheme theme = theme();
animProgress += (checked ? 1 : -1) * delta * 14;
animProgress = Math.max(0, Math.min(1, animProgress));
animProgress = MathHelper.clamp(animProgress, 0, 1);
renderBackground(renderer, this, pressed, mouseOver);

View File

@@ -5,7 +5,6 @@ import meteordevelopment.meteorclient.events.render.Render3DEvent;
import meteordevelopment.meteorclient.events.world.TickEvent;
import meteordevelopment.meteorclient.settings.*;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.utils.Utils;
import meteordevelopment.meteorclient.utils.entity.SortPriority;
import meteordevelopment.meteorclient.utils.entity.TargetUtils;
import meteordevelopment.meteorclient.utils.render.color.Color;
@@ -15,6 +14,7 @@ import net.minecraft.block.Blocks;
import net.minecraft.entity.Entity;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.RaycastContext;
@@ -155,7 +155,7 @@ public class Confuse extends Module {
case Switch:
Vec3d diff = entityPos.subtract(playerPos);
Vec3d diff1 = new Vec3d(Math.max(-halfRange, Math.min(halfRange, diff.x)), Math.max(-halfRange, Math.min(halfRange, diff.y)), Math.max(-halfRange, Math.min(halfRange, diff.z)));
Vec3d diff1 = new Vec3d(MathHelper.clamp(diff.x, -halfRange, halfRange), MathHelper.clamp(diff.y, -halfRange, halfRange), MathHelper.clamp(diff.z, -halfRange, halfRange));
Vec3d goal2 = entityPos.add(diff1);
hit = mc.world.raycast(new RaycastContext(mc.player.getPos(), goal2, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.ANY, mc.player));
if (!moveThroughBlocks.get() && hit.isInsideBlock()) {