Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into master-ame
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/meteordevelopment/meteorclient/MixinPlugin.java
#	src/main/java/meteordevelopment/meteorclient/mixin/TitleScreenMixin.java
#	src/main/java/meteordevelopment/meteorclient/systems/hud/Hud.java
#	src/main/resources/meteor-client.mixins.json
  • Loading branch information
JFronny committed Aug 12, 2023
2 parents bfe79e3 + 17f634c commit c40f2b0
Show file tree
Hide file tree
Showing 93 changed files with 1,186 additions and 552 deletions.
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
org.gradle.jvmargs=-Xmx2G

# Fabric (https://fabricmc.net/develop)
minecraft_version=1.20
yarn_mappings=1.20+build.1
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.1
loader_version=0.14.21
fapi_version=0.83.0+1.20
fapi_version=0.84.0+1.20.1

# Mod Properties
mod_version=0.5.4
Expand All @@ -14,13 +14,13 @@ archives_base_name=meteor-client
# Dependency Versions

# Sodium (https://github.com/CaffeineMC/sodium-fabric)
sodium_version=mc1.20-0.4.10
sodium_version=mc1.20.1-0.5.0

# Lithium (https://github.com/CaffeineMC/lithium-fabric)
lithium_version=mc1.20-0.11.2

# Iris (https://github.com/IrisShaders/Iris)
iris_version=1.6.4+1.20
iris_version=1.6.5+1.20.1

# Orbit (https://github.com/MeteorDevelopment/orbit)
orbit_version=0.2.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public class MeteorClient implements ClientModInitializer {
String versionString = MOD_META.getVersion().getFriendlyString();
if (versionString.contains("-")) versionString = versionString.split("-")[0];

// When building and running through IntelliJ and not Gradle it doesn't replace the version so just use a dummy
if (versionString.equals("${version}")) versionString = "0.0.0";

VERSION = new Version(versionString);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class MixinPlugin implements IMixinConfigPlugin {
private static boolean loaded;

private static boolean isOriginsPresent;
private static boolean isSodiumPresent;
public static boolean isSodiumPresent;
private static boolean isCanvasPresent;
private static boolean isLithiumPresent;
public static boolean isIrisPresent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> cont
try {
setting = SettingArgumentType.get(context);
} catch (CommandSyntaxException ignored) {
return null;
return Suggestions.empty();
}

Iterable<Identifier> identifiers = setting.getIdentifierSuggestions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ private void lastPosition(double x, double y, double z) {
}

private void findStronghold() {
BaritoneAPI.getProvider().getPrimaryBaritone().getCommandManager().execute("stop");
if (this.firstStart == null || this.firstEnd == null || this.secondStart == null || this.secondEnd == null) {
error("Missing position data");
cancel();
Expand All @@ -284,7 +285,6 @@ private void findStronghold() {
cancel();
return;
}
BaritoneAPI.getProvider().getPrimaryBaritone().getCommandManager().execute("stop");
MeteorClient.EVENT_BUS.unsubscribe(this);
Vec3d coords = new Vec3d(intersection[0], 0, intersection[1]);
MutableText text = Text.literal("Stronghold roughly located at ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {
saveMap(map, state, path, 128);

return SINGLE_SUCCESS;
}).then(argument("scale", IntegerArgumentType.integer()).executes(context -> {
}).then(argument("scale", IntegerArgumentType.integer(1)).executes(context -> {
int scale = IntegerArgumentType.getInteger(context, "scale");

MapState state = getMapState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {
// Paper allows you to teleport 10 blocks for each move packet you send in that tick
// Video explanation by LiveOverflow: https://www.youtube.com/watch?v=3HSnDsfkJT8
int packetsRequired = (int) Math.ceil(Math.abs(blocks / 10));

if (packetsRequired > 20) {
// Wouldn't work on paper anyway.
// Some servers don't have a vertical limit, so if it is more than 200 blocks, just use a "normal" tp
// This makes it, so you don't get kicked for sending too many packets
packetsRequired = 1;
}

if (mc.player.hasVehicle()) {
// Vehicle version
// For each 10 blocks, send a vehicle move packet with no delta
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
* Copyright (c) Meteor Development.
*/

package meteordevelopment.meteorclient.events.render;

import meteordevelopment.meteorclient.events.Cancellable;
import net.minecraft.client.render.model.json.Transformation;
import net.minecraft.client.util.math.MatrixStack;

public class ApplyTransformationEvent extends Cancellable {
private static final ApplyTransformationEvent INSTANCE = new ApplyTransformationEvent();

public Transformation transformation;
public boolean leftHanded;
public MatrixStack matrices;

public static ApplyTransformationEvent get(Transformation transformation, boolean leftHanded, MatrixStack matrices) {
INSTANCE.setCancelled(false);

INSTANCE.transformation = transformation;
INSTANCE.leftHanded = leftHanded;
INSTANCE.matrices = matrices;

return INSTANCE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package meteordevelopment.meteorclient.events.world;

import com.mojang.blaze3d.systems.RenderSystem;
import meteordevelopment.meteorclient.events.Cancellable;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
Expand All @@ -18,10 +19,17 @@ public class CollisionShapeEvent extends Cancellable {
public VoxelShape shape;

public static CollisionShapeEvent get(BlockState state, BlockPos pos, VoxelShape shape) {
INSTANCE.setCancelled(false);
INSTANCE.state = state;
INSTANCE.pos = pos;
INSTANCE.shape = shape;
return INSTANCE;
CollisionShapeEvent event = INSTANCE;

if (!RenderSystem.isOnRenderThread()) {
event = new CollisionShapeEvent();
}

event.setCancelled(false);
event.state = state;
event.pos = pos;
event.shape = shape;

return event;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
* Copyright (c) Meteor Development.
*/

package meteordevelopment.meteorclient.events.world;

import net.minecraft.client.network.ServerAddress;
import net.minecraft.client.network.ServerInfo;

public class ServerConnectBeginEvent {
private static final ServerConnectBeginEvent INSTANCE = new ServerConnectBeginEvent();
public ServerAddress address;
public ServerInfo info;

public static ServerConnectBeginEvent get(ServerAddress address, ServerInfo info) {
INSTANCE.address = address;
INSTANCE.info = info;
return INSTANCE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

import java.net.InetSocketAddress;

public class ConnectToServerEvent {
private static final ConnectToServerEvent INSTANCE = new ConnectToServerEvent();
public class ServerConnectEndEvent {
private static final ServerConnectEndEvent INSTANCE = new ServerConnectEndEvent();
public InetSocketAddress address;

public static ConnectToServerEvent get(InetSocketAddress address) {
public static ServerConnectEndEvent get(InetSocketAddress address) {
INSTANCE.address = address;
return INSTANCE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import net.minecraft.util.math.MathHelper;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -253,7 +254,7 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) {
mouseY *= s;

animProgress += delta / 20 * 14;
animProgress = Utils.clamp(animProgress, 0, 1);
animProgress = MathHelper.clamp(animProgress, 0, 1);

GuiKeyEvents.canUseKeys = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import meteordevelopment.meteorclient.renderer.Renderer2D;
import meteordevelopment.meteorclient.renderer.Texture;
import meteordevelopment.meteorclient.utils.PostInit;
import meteordevelopment.meteorclient.utils.Utils;
import meteordevelopment.meteorclient.utils.misc.MeteorIdentifier;
import meteordevelopment.meteorclient.utils.misc.Pool;
import meteordevelopment.meteorclient.utils.render.ByteTexture;
Expand All @@ -23,6 +22,7 @@
import net.minecraft.client.gui.DrawContext;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -157,7 +157,7 @@ public void scissorEnd() {

public boolean renderTooltip(DrawContext drawContext, double mouseX, double mouseY, double delta) {
tooltipAnimProgress += (tooltip != null ? 1 : -1) * delta * 14;
tooltipAnimProgress = Utils.clamp(tooltipAnimProgress, 0, 1);
tooltipAnimProgress = MathHelper.clamp(tooltipAnimProgress, 0, 1);

boolean toReturn = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import meteordevelopment.meteorclient.gui.widgets.pressable.WButton;
import meteordevelopment.meteorclient.gui.widgets.pressable.WCheckbox;
import meteordevelopment.meteorclient.settings.Setting;
import meteordevelopment.meteorclient.utils.Utils;
import meteordevelopment.meteorclient.utils.render.color.Color;
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
import net.minecraft.util.math.MathHelper;

import static meteordevelopment.meteorclient.MeteorClient.mc;

Expand Down Expand Up @@ -565,7 +565,7 @@ public void onMouseMoved(double mouseX, double mouseY, double lastMouseX, double
if (dragging) {
if (mouseX >= this.x && mouseX <= this.x + width) {
handleX += mouseX - lastMouseX;
handleX = Utils.clamp(handleX, 0, width);
handleX = MathHelper.clamp(handleX, 0, width);
} else {
if (handleX > 0 && mouseX < this.x) handleX = 0;
else if (handleX < width && mouseX > this.x + width) handleX = width;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
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;
Expand Down Expand Up @@ -66,10 +66,10 @@ protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, doub
double pad = pad();

animationProgress1 += delta * 4 * ((module.isActive() || mouseOver) ? 1 : -1);
animationProgress1 = Utils.clamp(animationProgress1, 0, 1);
animationProgress1 = MathHelper.clamp(animationProgress1, 0, 1);

animationProgress2 += delta * 6 * (module.isActive() ? 1 : -1);
animationProgress2 = Utils.clamp(animationProgress2, 0, 1);
animationProgress2 = MathHelper.clamp(animationProgress2, 0, 1);

if (animationProgress1 > 0) {
renderer.quad(x, y, width * animationProgress1, height, theme.moduleBackground.get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import meteordevelopment.meteorclient.gui.widgets.containers.WContainer;
import meteordevelopment.meteorclient.gui.widgets.containers.WVerticalList;
import meteordevelopment.meteorclient.gui.widgets.input.WTextBox;
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;
Expand Down Expand Up @@ -131,7 +131,7 @@ else if (placeholder != null) {

// Cursor
animProgress += delta * 10 * (focused && cursorVisible ? 1 : -1);
animProgress = Utils.clamp(animProgress, 0, 1);
animProgress = MathHelper.clamp(animProgress, 0, 1);

if ((focused && cursorVisible) || animProgress > 0) {
renderer.setAlpha(animProgress);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import meteordevelopment.meteorclient.gui.themes.meteor.MeteorGuiTheme;
import meteordevelopment.meteorclient.gui.themes.meteor.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;
Expand All @@ -24,7 +24,7 @@ protected void onRender(GuiRenderer renderer, double mouseX, double mouseY, doub
MeteorGuiTheme theme = theme();

animProgress += (checked ? 1 : -1) * delta * 14;
animProgress = Utils.clamp(animProgress, 0, 1);
animProgress = MathHelper.clamp(animProgress, 0, 1);

renderBackground(renderer, this, pressed, mouseOver);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
import meteordevelopment.meteorclient.gui.utils.Cell;
import meteordevelopment.meteorclient.gui.widgets.WWidget;
import meteordevelopment.meteorclient.utils.Utils;
import net.minecraft.util.math.MathHelper;

import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_LEFT;

Expand Down Expand Up @@ -88,7 +88,7 @@ public boolean render(GuiRenderer renderer, double mouseX, double mouseY, double
double preProgress = animProgress;

animProgress += (expanded ? 1 : -1) * delta * 14;
animProgress = Utils.clamp(animProgress, 0, 1);
animProgress = MathHelper.clamp(animProgress, 0, 1);

if (animProgress != preProgress) {
forcedHeight = (actualHeight - header.height) * animProgress + header.height;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
import meteordevelopment.meteorclient.gui.widgets.WWidget;
import meteordevelopment.meteorclient.utils.Utils;
import net.minecraft.util.math.MathHelper;

import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_LEFT;

Expand Down Expand Up @@ -63,7 +64,7 @@ protected void onCalculateWidgetPositions() {
super.onCalculateWidgetPositions();

if (moveAfterPositionWidgets) {
scroll = Utils.clamp(scroll, 0, actualHeight - height);
scroll = MathHelper.clamp(scroll, 0, actualHeight - height);
targetScroll = scroll;

moveCells(0, -scroll);
Expand Down Expand Up @@ -109,7 +110,7 @@ public void onMouseMoved(double mouseX, double mouseY, double lastMouseX, double
//scroll += Math.round(theme.scale(mouseDelta + mouseDelta * ((height / actualHeight) * 0.7627725)));
//scroll += Math.round(theme.scale(mouseDelta * (1 / (height / actualHeight))));
scroll += Math.round(mouseDelta * ((actualHeight - handleHeight() / 2) / height)); // TODO: Someone improve this
scroll = Utils.clamp(scroll, 0, actualHeight - height);
scroll = MathHelper.clamp(scroll, 0, actualHeight - height);

targetScroll = scroll;

Expand All @@ -122,7 +123,7 @@ public void onMouseMoved(double mouseX, double mouseY, double lastMouseX, double
public boolean onMouseScrolled(double amount) {
if (!scrollOnlyWhenMouseOver || mouseOver) {
targetScroll -= Math.round(theme.scale(amount * 40));
targetScroll = Utils.clamp(targetScroll, 0, actualHeight - height);
targetScroll = MathHelper.clamp(targetScroll, 0, actualHeight - height);
return true;
}

Expand Down Expand Up @@ -154,7 +155,7 @@ else if (targetScroll < scroll) {
if (scroll < targetScroll) scroll = targetScroll;
}

scroll = Utils.clamp(scroll, 0, max);
scroll = MathHelper.clamp(scroll, 0, max);

double change = scroll - preScroll;
if (change != 0) moveCells(0, -change);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import meteordevelopment.meteorclient.gui.utils.WindowConfig;
import meteordevelopment.meteorclient.gui.widgets.WWidget;
import meteordevelopment.meteorclient.gui.widgets.pressable.WTriangle;
import meteordevelopment.meteorclient.utils.Utils;
import net.minecraft.util.math.MathHelper;

import java.util.function.Consumer;

Expand Down Expand Up @@ -236,7 +236,7 @@ public void onMouseMoved(double mouseX, double mouseY, double lastMouseX, double
@Override
public boolean render(GuiRenderer renderer, double mouseX, double mouseY, double delta) {
animProgress += (expanded ? 1 : -1) * delta * 14;
animProgress = Utils.clamp(animProgress, 0, 1);
animProgress = MathHelper.clamp(animProgress, 0, 1);

triangle.rotation = (1 - animProgress) * -90;

Expand Down
Loading

0 comments on commit c40f2b0

Please sign in to comment.