Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[versions]
# Fabric (https://fabricmc.net/develop)
jdk = "25"
minecraft = "26.2"
fabric-loader = "0.19.3"
fabric-api = "0.154.2+26.2"
minecraft = "26.3"
fabric-loader = "0.19.5"
fabric-api = "0.162.0+26.3"

# Plugins
# Loom (https://github.com/FabricMC/fabric-loom)
Expand All @@ -13,15 +13,15 @@ errorprone-plugin = "5.1.1"

# Mods
# Baritone (https://github.com/MeteorDevelopment/baritone)
baritone = "26.1-SNAPSHOT"
baritone = "26.3-SNAPSHOT"
# Sodium (https://github.com/CaffeineMC/sodium-fabric)
sodium = "mc26.2-0.9.1-fabric"
sodium = "mc26.3-0.9.2-fabric"
# Lithium (https://github.com/CaffeineMC/lithium-fabric)
lithium = "mc26.2-0.25.2-fabric"
lithium = "mc26.3-0.26.2-fabric"
# Iris (https://github.com/IrisShaders/Iris)
iris = "1.11.2+26.2-fabric"
iris = "1.11.7+26.3-fabric"
# ModMenu (https://github.com/TerraformersMC/ModMenu)
modmenu = "20.0.1"
modmenu = "21.0.0"
# Orbit (https://github.com/MeteorDevelopment/orbit)
orbit = "0.2.4"
# Starscript (https://github.com/MeteorDevelopment/starscript)
Expand All @@ -33,7 +33,7 @@ reflections = "0.10.2"
# Netty (https://github.com/netty/netty)
netty = "4.2.15.Final"
# ViaFabricPlus (https://github.com/ViaVersion/ViaFabricPlus)
viafabricplus = "4.6.1"
viafabricplus = "5.1.1"
# WaybackAuthLib (https://github.com/florianreuth/WaybackAuthLib)
waybackauthlib = "1.1.0"
# MinecraftAuth (https://github.com/RaphiMC/MinecraftAuth)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import java.util.List;

public abstract class Command {
protected static CommandBuildContext REGISTRY_ACCESS = Commands.createValidationContext(VanillaRegistries.createLookup());
protected static CommandBuildContext REGISTRY_ACCESS = Commands.createValidationContext(VanillaRegistries.createWorldLookup());
protected static final int SINGLE_SUCCESS = com.mojang.brigadier.Command.SINGLE_SUCCESS;
protected static final Minecraft mc = MeteorClient.mc;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public DropCommand() {
@Override
public void build(LiteralArgumentBuilder<ClientSuggestionProvider> builder) {
// Main Hand
builder.then(literal("hand").executes(_ -> drop(player -> player.drop(true))));
builder.then(literal("hand").executes(_ -> drop(player -> mc.gameMode.dropItem(player, true))));

// Offhand
builder.then(literal("offhand").executes(_ -> drop(_ -> InvUtils.drop().slotOffhand())));
Expand Down Expand Up @@ -70,9 +70,7 @@ public void build(LiteralArgumentBuilder<ClientSuggestionProvider> builder) {

// Specific item
builder.then(argument("item", ItemArgument.item(REGISTRY_ACCESS))
.executes(context -> drop(player -> {
dropItem(player, context, Integer.MAX_VALUE);
}))
.executes(context -> drop(player -> dropItem(player, context, Integer.MAX_VALUE)))
.then(argument("amount", IntegerArgumentType.integer(1))
.executes(context -> drop(player -> {
int amount = IntegerArgumentType.getInteger(context, "amount");
Expand All @@ -83,7 +81,7 @@ public void build(LiteralArgumentBuilder<ClientSuggestionProvider> builder) {

private void dropItem(LocalPlayer player, CommandContext<ClientSuggestionProvider> context, int amount) throws CommandSyntaxException {
ItemStack stack = ItemArgument.getItem(context, "item").createItemStack(1);
if (stack == null || stack.getItem() == Items.AIR) throw NO_SUCH_ITEM.create();
if (stack.getItem() == Items.AIR) throw NO_SUCH_ITEM.create();

for (int i = 0; i < player.getInventory().getContainerSize() && amount > 0; i++) {
ItemStack invStack = player.getInventory().getItem(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
import meteordevelopment.meteorclient.events.world.TickEvent;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.modules.misc.Notebot;
import meteordevelopment.meteorclient.utils.Utils;
import meteordevelopment.meteorclient.utils.notebot.song.Note;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.client.multiplayer.ClientSuggestionProvider;
import net.minecraft.network.chat.Component;
import net.minecraft.network.protocol.game.ClientboundSoundPacket;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.util.Util;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;

import java.io.FileWriter;
Expand All @@ -48,7 +48,7 @@ public NotebotCommand() {
@Override
public void build(LiteralArgumentBuilder<ClientSuggestionProvider> builder) {
builder.then(literal("help").executes(_ -> {
Util.getPlatform().openUri("https://github.com/MeteorDevelopment/meteor-client/wiki/Notebot-Guide");
Utils.openUri("https://github.com/MeteorDevelopment/meteor-client/wiki/Notebot-Guide");
return SINGLE_SUCCESS;
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,28 @@
import net.minecraft.world.item.MapItem;
import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
import org.jspecify.annotations.Nullable;
import org.lwjgl.BufferUtils;
import org.lwjgl.PointerBuffer;
import org.lwjgl.sdl.SDLDialog;
import org.lwjgl.sdl.SDL_DialogFileFilter;
import org.lwjgl.system.MemoryStack;
import org.lwjgl.system.MemoryUtil;
import org.lwjgl.util.tinyfd.TinyFileDialogs;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;

public class SaveMapCommand extends Command {
private static final SimpleCommandExceptionType MAP_NOT_FOUND = new SimpleCommandExceptionType(Component.literal("You must be holding a filled map."));
private static final SimpleCommandExceptionType OOPS = new SimpleCommandExceptionType(Component.literal("Something went wrong."));

private final PointerBuffer filters;
private final SDL_DialogFileFilter.Buffer filters;

public SaveMapCommand() {
super("save-map", "Saves a map to an image.", "sm");

filters = BufferUtils.createPointerBuffer(1);

ByteBuffer pngFilter = MemoryUtil.memASCII("*.png");

filters.put(pngFilter);
filters.rewind();
MemoryStack stack = MemoryStack.stackPush();
filters = SDL_DialogFileFilter.malloc(1, stack);
filters.name(stack.UTF8("NBT Files")).pattern(stack.UTF8("nbt"));
}

@Override
Expand All @@ -68,29 +64,40 @@ private void saveMap(int scale) throws CommandSyntaxException {
MapItemSavedData state = getMapState();
if (map == null || state == null) throw MAP_NOT_FOUND.create();

File path = getPath();
if (path == null) throw OOPS.create();
SDLDialog.SDL_ShowSaveFileDialog((_, file, _) -> {
if (file == 0) return;

long filePointer = MemoryUtil.memGetAddress(file);
if (filePointer == 0) return;

String str = MemoryUtil.memUTF8(filePointer);
System.out.println(str);

MapTextureManagerAccessor textureManager = (MapTextureManagerAccessor) mc.getMapTextureManager();
MapTextureManager.MapInstance texture = textureManager.meteor$invokeGetOrCreateMapInstance(map.get(DataComponents.MAP_ID), state);
if (texture.texture.getPixels() == null) throw OOPS.create();
if (str.isBlank()) return;
if (!str.endsWith(".png")) str += ".png";
File path = new File(str);

try {
if (scale == 128) texture.texture.getPixels().writeToFile(path);
else {
int[] data = texture.texture.getPixels().makePixelArray();
BufferedImage image = new BufferedImage(128, 128, BufferedImage.TYPE_INT_ARGB);
image.setRGB(0, 0, image.getWidth(), image.getHeight(), data, 0, 128);
MapTextureManagerAccessor textureManager = (MapTextureManagerAccessor) mc.getMapTextureManager();
MapTextureManager.MapInstance texture = textureManager.meteor$invokeGetOrCreateMapInstance(map.get(DataComponents.MAP_ID), state);
if (texture.texture.getPixels() == null) return;

BufferedImage scaledImage = new BufferedImage(scale, scale, 2);
scaledImage.createGraphics().drawImage(image, 0, 0, scale, scale, null);
try {
if (scale == 128) texture.texture.getPixels().writeToFile(path);
else {
int[] data = texture.texture.getPixels().makePixelArray();
BufferedImage image = new BufferedImage(128, 128, BufferedImage.TYPE_INT_ARGB);
image.setRGB(0, 0, image.getWidth(), image.getHeight(), data, 0, 128);

ImageIO.write(scaledImage, "png", path);
BufferedImage scaledImage = new BufferedImage(scale, scale, 2);
scaledImage.createGraphics().drawImage(image, 0, 0, scale, scale, null);

ImageIO.write(scaledImage, "png", path);
}
} catch (IOException e) {
error("Error writing map texture");
MeteorClient.LOG.error(e.toString());
}
} catch (IOException e) {
error("Error writing map texture");
MeteorClient.LOG.error(e.toString());
}
}, 0, 0, filters, "");
}

private @Nullable MapItemSavedData getMapState() {
Expand All @@ -100,14 +107,6 @@ private void saveMap(int scale) throws CommandSyntaxException {
return MapItem.getSavedData(map.get(DataComponents.MAP_ID), mc.level);
}

private @Nullable File getPath() {
String path = TinyFileDialogs.tinyfd_saveFileDialog("Save image", null, filters, null);
if (path == null) return null;
if (!path.endsWith(".png")) path += ".png";

return new File(path);
}

private @Nullable ItemStack getMap() {
ItemStack itemStack = mc.player.getMainHandItem();
if (itemStack.getItem() == Items.FILLED_MAP) return itemStack;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.meteordev.starscript.Script;

import java.time.Instant;
import java.util.Optional;

public class SayCommand extends Command {
public SayCommand() {
Expand All @@ -41,7 +42,7 @@ public void build(LiteralArgumentBuilder<ClientSuggestionProvider> builder) {
ClientPacketListener handler = mc.getConnection();
LastSeenMessagesTracker.Update lastSeenMessages = ((ClientPacketListenerAccessor) handler).meteor$getLastSeenMessages().generateAndApplyUpdate();
MessageSignature messageSignatureData = ((ClientPacketListenerAccessor) handler).meteor$getSignedMessageEncoder().pack(new SignedMessageBody(message, instant, l, lastSeenMessages.lastSeen()));
handler.send(new ServerboundChatPacket(message, instant, l, messageSignatureData, lastSeenMessages.update()));
handler.send(new ServerboundChatPacket(message, instant, l, Optional.ofNullable(messageSignatureData), lastSeenMessages.update()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
import meteordevelopment.meteorclient.utils.render.color.SettingColor;
import net.minecraft.client.resources.language.I18n;
import org.apache.commons.lang3.Strings;
import org.lwjgl.util.tinyfd.TinyFileDialogs;
import org.lwjgl.sdl.SDLDialog;
import org.lwjgl.system.MemoryUtil;

import java.io.File;
import java.util.ArrayList;
Expand Down Expand Up @@ -497,22 +498,23 @@ private void fileW(WTable table, FileSetting setting) {

WLabel fileName = list.add(theme.label((setting.get() != null && setting.get().exists()) ? setting.get().getName() : "No file selected.")).widget();

selectFile.action = () -> {
String path = TinyFileDialogs.tinyfd_openFileDialog(
"Select File",
null,
setting.filters,
null,
false
);
selectFile.action = () -> SDLDialog.SDL_ShowOpenFileDialog((_, file, _) -> {
if (file == 0) return;

if (path != null) {
long filePointer = MemoryUtil.memGetAddress(file);
if (filePointer == 0) return;

String path = MemoryUtil.memUTF8(filePointer);
System.out.println(path);

if (!path.isEmpty()) {
setting.set(new File(path));
fileName.set(setting.get().getName());
}
};

reset(table, setting, () -> fileName.set((setting.get() != null && setting.get().exists()) ? setting.get().getName() : "No file selected."));
reset(table, setting, () -> fileName.set((setting.get() != null && setting.get().exists()) ? setting.get().getName() : "No file selected."));
}, 0L, 0, setting.filters, "", false);

}

// Other
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package meteordevelopment.meteorclient.gui;

import com.mojang.blaze3d.platform.MacosUtil;
import com.mojang.blaze3d.platform.cursor.CursorTypes;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.gui.renderer.GuiDebugRenderer;
import meteordevelopment.meteorclient.gui.renderer.GuiRenderer;
Expand All @@ -16,7 +17,6 @@
import meteordevelopment.meteorclient.gui.widgets.containers.WContainer;
import meteordevelopment.meteorclient.gui.widgets.input.WTextBox;
import meteordevelopment.meteorclient.utils.Utils;
import meteordevelopment.meteorclient.utils.misc.CursorStyle;
import meteordevelopment.meteorclient.utils.misc.input.Input;
import net.minecraft.client.gui.GuiGraphicsExtractor;
import net.minecraft.client.gui.screens.Screen;
Expand All @@ -26,17 +26,18 @@
import net.minecraft.network.chat.Component;
import net.minecraft.util.Mth;
import org.jspecify.annotations.NonNull;
import org.lwjgl.sdl.SDLMouse;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;

import static com.mojang.blaze3d.platform.InputConstants.*;
import static meteordevelopment.meteorclient.MeteorClient.mc;
import static meteordevelopment.meteorclient.utils.Utils.getWindowHeight;
import static meteordevelopment.meteorclient.utils.Utils.getWindowWidth;
import static com.mojang.blaze3d.platform.InputConstants.*;

public abstract class WidgetScreen extends Screen {
private static final GuiRenderer RENDERER = new GuiRenderer();
Expand Down Expand Up @@ -184,7 +185,7 @@ public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmou
public boolean keyReleased(@NonNull KeyEvent input) {
if (locked) return false;

if ((input.modifiers() == MOD_CONTROL || input.modifiers() == MOD_SUPER) && input.key() == KEY_9) {
if ((Input.modifiersMatch(input.modifiers(), MOD_CONTROL) || Input.modifiersMatch(input.modifiers(), MOD_SUPER)) && input.key() == KEY_9) {
debug = !debug;
return true;
}
Expand Down Expand Up @@ -236,7 +237,7 @@ public boolean keyPressed(@NonNull KeyEvent input) {
return true;
}

boolean control = MacosUtil.IS_MACOS ? input.modifiers() == MOD_SUPER : input.modifiers() == MOD_CONTROL;
boolean control = MacosUtil.IS_MACOS ? Input.modifiersMatch(input.modifiers(), MOD_SUPER) : Input.modifiersMatch(input.modifiers(), MOD_CONTROL);

return (control && input.key() == KEY_C && toClipboard())
|| (control && input.key() == KEY_V && fromClipboard());
Expand Down Expand Up @@ -331,7 +332,7 @@ public void removed() {
closed = true;
onClosed();

Input.setCursorStyle(CursorStyle.Default);
Input.setCursorStyle(CursorTypes.ARROW);

loopWidgets(root, widget -> {
if (widget instanceof WTextBox textBox && textBox.isFocused()) textBox.setFocused(false);
Expand All @@ -354,7 +355,7 @@ public void removed() {

// Restore mouse position to where it was when the screen was closed
if (parent != null) {
grabOrReleaseMouse(mc.getWindow(), CURSOR_NORMAL, restoreX, restoreY);
SDLMouse.SDL_WarpMouseInWindow(mc.getWindow().handle(), (float) restoreX, (float) restoreY);
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

package meteordevelopment.meteorclient.gui.renderer.packer;

import com.mojang.blaze3d.GpuFormat;
import com.mojang.blaze3d.platform.TextureUtil;
import com.mojang.blaze3d.textures.FilterMode;
import com.mojang.renderpearl.api.GpuFormat;
import com.mojang.renderpearl.api.textures.FilterMode;
import meteordevelopment.meteorclient.renderer.Texture;
import net.minecraft.resources.Identifier;
import org.lwjgl.BufferUtils;
Expand Down
Loading
Loading