MathHelper & unused imports (#266)
This commit is contained in:
@@ -11,7 +11,7 @@ import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
|||||||
import meteordevelopment.meteorclient.gui.utils.AlignmentX;
|
import meteordevelopment.meteorclient.gui.utils.AlignmentX;
|
||||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WPressable;
|
import meteordevelopment.meteorclient.gui.widgets.pressable.WPressable;
|
||||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
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 meteordevelopment.meteorclient.MeteorClient.mc;
|
||||||
import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_LEFT;
|
import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_LEFT;
|
||||||
@@ -66,10 +66,10 @@ public class WMeteorModule extends WPressable implements MeteorWidget {
|
|||||||
double pad = pad();
|
double pad = pad();
|
||||||
|
|
||||||
animationProgress1 += delta * 4 * ((module.isActive() || mouseOver) ? 1 : -1);
|
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 += delta * 6 * (module.isActive() ? 1 : -1);
|
||||||
animationProgress2 = Math.max(0, Math.min(1, animationProgress2));
|
animationProgress2 = MathHelper.clamp(animationProgress2, 0, 1);
|
||||||
|
|
||||||
if (animationProgress1 > 0) {
|
if (animationProgress1 > 0) {
|
||||||
renderer.quad(x, y, width * animationProgress1, height, theme.moduleBackground.get());
|
renderer.quad(x, y, width * animationProgress1, height, theme.moduleBackground.get());
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import meteordevelopment.meteorclient.gui.widgets.input.WTextBox;
|
|||||||
import meteordevelopment.meteorclient.gui.widgets.WWidget;
|
import meteordevelopment.meteorclient.gui.widgets.WWidget;
|
||||||
import meteordevelopment.meteorclient.gui.widgets.containers.WContainer;
|
import meteordevelopment.meteorclient.gui.widgets.containers.WContainer;
|
||||||
import meteordevelopment.meteorclient.gui.widgets.containers.WVerticalList;
|
import meteordevelopment.meteorclient.gui.widgets.containers.WVerticalList;
|
||||||
import meteordevelopment.meteorclient.utils.Utils;
|
|
||||||
import meteordevelopment.meteorclient.utils.render.color.Color;
|
import meteordevelopment.meteorclient.utils.render.color.Color;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
public class WMeteorTextBox extends WTextBox implements MeteorWidget {
|
public class WMeteorTextBox extends WTextBox implements MeteorWidget {
|
||||||
private boolean cursorVisible;
|
private boolean cursorVisible;
|
||||||
@@ -68,7 +68,7 @@ public class WMeteorTextBox extends WTextBox implements MeteorWidget {
|
|||||||
|
|
||||||
// Cursor
|
// Cursor
|
||||||
animProgress += delta * 10 * (focused && cursorVisible ? 1 : -1);
|
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) {
|
if ((focused && cursorVisible) || animProgress > 0) {
|
||||||
renderer.setAlpha(animProgress);
|
renderer.setAlpha(animProgress);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import anticope.rejects.gui.themes.rounded.MeteorRoundedGuiTheme;
|
|||||||
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
|
||||||
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
import anticope.rejects.gui.themes.rounded.MeteorWidget;
|
||||||
import meteordevelopment.meteorclient.gui.widgets.pressable.WCheckbox;
|
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 {
|
public class WMeteorCheckbox extends WCheckbox implements MeteorWidget {
|
||||||
private double animProgress;
|
private double animProgress;
|
||||||
@@ -25,7 +25,7 @@ public class WMeteorCheckbox extends WCheckbox implements MeteorWidget {
|
|||||||
MeteorRoundedGuiTheme theme = theme();
|
MeteorRoundedGuiTheme theme = theme();
|
||||||
|
|
||||||
animProgress += (checked ? 1 : -1) * delta * 14;
|
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);
|
renderBackground(renderer, this, pressed, mouseOver);
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import meteordevelopment.meteorclient.events.render.Render3DEvent;
|
|||||||
import meteordevelopment.meteorclient.events.world.TickEvent;
|
import meteordevelopment.meteorclient.events.world.TickEvent;
|
||||||
import meteordevelopment.meteorclient.settings.*;
|
import meteordevelopment.meteorclient.settings.*;
|
||||||
import meteordevelopment.meteorclient.systems.modules.Module;
|
import meteordevelopment.meteorclient.systems.modules.Module;
|
||||||
import meteordevelopment.meteorclient.utils.Utils;
|
|
||||||
import meteordevelopment.meteorclient.utils.entity.SortPriority;
|
import meteordevelopment.meteorclient.utils.entity.SortPriority;
|
||||||
import meteordevelopment.meteorclient.utils.entity.TargetUtils;
|
import meteordevelopment.meteorclient.utils.entity.TargetUtils;
|
||||||
import meteordevelopment.meteorclient.utils.render.color.Color;
|
import meteordevelopment.meteorclient.utils.render.color.Color;
|
||||||
@@ -15,6 +14,7 @@ import net.minecraft.block.Blocks;
|
|||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.util.hit.BlockHitResult;
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.RaycastContext;
|
import net.minecraft.world.RaycastContext;
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ public class Confuse extends Module {
|
|||||||
|
|
||||||
case Switch:
|
case Switch:
|
||||||
Vec3d diff = entityPos.subtract(playerPos);
|
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);
|
Vec3d goal2 = entityPos.add(diff1);
|
||||||
hit = mc.world.raycast(new RaycastContext(mc.player.getPos(), goal2, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.ANY, mc.player));
|
hit = mc.world.raycast(new RaycastContext(mc.player.getPos(), goal2, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.ANY, mc.player));
|
||||||
if (!moveThroughBlocks.get() && hit.isInsideBlock()) {
|
if (!moveThroughBlocks.get() && hit.isInsideBlock()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user