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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ bin/
# fabric

run/

/DEVNODE
Empty file modified gradlew
100644 → 100755
Empty file.
15 changes: 11 additions & 4 deletions src/main/java/com/nnpg/glazed/GlazedAddon.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import com.nnpg.glazed.modules.esp.*;
import com.nnpg.glazed.modules.main.*;
import com.nnpg.glazed.modules.pvp.*;
import com.nnpg.glazed.commands.*;
import meteordevelopment.meteorclient.addons.MeteorAddon;
import meteordevelopment.meteorclient.commands.Commands;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.modules.Category;
import meteordevelopment.orbit.EventHandler;
Expand Down Expand Up @@ -31,7 +33,6 @@ public void onInitialize() {
Modules.get().add(new ShulkerDropper());
Modules.get().add(new AutoSell());
Modules.get().add(new SpawnerDropper());
Modules.get().add(new AutoShulkerOrder());
Modules.get().add(new AutoOrder());
Modules.get().add(new HideScoreboard());
Modules.get().add(new CrystalMacro());
Expand All @@ -53,7 +54,6 @@ public void onInitialize() {
Modules.get().add(new HoleTunnelStairsESP());
Modules.get().add(new CoveredHole());
Modules.get().add(new ClusterFinder());
Modules.get().add(new AutoShulkerShellOrder());
Modules.get().add(new EmergencySeller());
Modules.get().add(new RTPEndBaseFinder());
Modules.get().add(new ShopBuyer());
Expand Down Expand Up @@ -86,7 +86,6 @@ public void onInitialize() {
Modules.get().add(new SkeletonESP());
Modules.get().add(new RainNoti());
Modules.get().add(new AutoPearlChain());
Modules.get().add(new AutoBlazeRodOrder());
Modules.get().add(new BlazeRodDropper());
Modules.get().add(new BreachSwap());
Modules.get().add(new FakeScoreboard());
Expand All @@ -96,11 +95,19 @@ public void onInitialize() {
Modules.get().add(new UIHelper());
Modules.get().add(new ShieldBreaker());
Modules.get().add(new InvisESP());
Modules.get().add(new AutoTotemOrder());
Modules.get().add(new LightESP());
Modules.get().add(new PremiumTunnelBaseFinder());
Modules.get().add(new AdminList());
Modules.get().add(new AutoTreeFarmer());
Modules.get().add(new PearlLandingPredictor());
Modules.get().add(new AutoShopOrder());


// Commands
Commands.add(new SellHotbarCommand());
Commands.add(new AHItemCommand());


}

@EventHandler
Expand Down
100 changes: 100 additions & 0 deletions src/main/java/com/nnpg/glazed/commands/AHItemCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package com.nnpg.glazed.commands;

import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import meteordevelopment.meteorclient.commands.Command;
import net.minecraft.component.type.ItemEnchantmentsComponent;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.command.CommandSource;

import java.util.ArrayList;
import java.util.List;

public class AHItemCommand extends Command {

public AHItemCommand() {
super("ahitem", "Searches /ah for the item in your main hand with its enchantments.");
}

@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.executes(context -> {
if (mc.player == null) return SINGLE_SUCCESS;

ItemStack mainHandItem = mc.player.getMainHandStack();

if (mainHandItem.isEmpty()) {
error("You are not holding any item in your main hand.");
return SINGLE_SUCCESS;
}


String itemName = getItemName(mainHandItem);


List<String> enchantmentStrings = getEnchantments(mainHandItem);


StringBuilder searchCommand = new StringBuilder("ah ");
searchCommand.append(itemName);


if (mainHandItem.getCount() == 64) {
searchCommand.append(" stack");
}

if (!enchantmentStrings.isEmpty()) {
searchCommand.append(" ");
searchCommand.append(String.join(" ", enchantmentStrings));
}


String command = searchCommand.toString();
info("Searching: /" + command);
mc.getNetworkHandler().sendChatCommand(command);

return SINGLE_SUCCESS;
});
}

private String getItemName(ItemStack stack) {

String itemId = stack.getItem().toString();


if (itemId.contains(":")) {
itemId = itemId.split(":")[1];
}

return itemId.toLowerCase().replace(" ", "_");
}

private List<String> getEnchantments(ItemStack stack) {
List<String> result = new ArrayList<>();


ItemEnchantmentsComponent enchantments = EnchantmentHelper.getEnchantments(stack);

for (RegistryEntry<Enchantment> entry : enchantments.getEnchantments()) {
int level = enchantments.getLevel(entry);
String enchantmentName = getEnchantmentName(entry);
result.add(enchantmentName + " " + level);
}

return result;
}

private String getEnchantmentName(RegistryEntry<Enchantment> enchantmentEntry) {

String enchantmentId = enchantmentEntry.getIdAsString();


if (enchantmentId.contains(":")) {
enchantmentId = enchantmentId.split(":")[1];
}

return enchantmentId.toLowerCase().replace(" ", "_");
}
}
96 changes: 96 additions & 0 deletions src/main/java/com/nnpg/glazed/commands/SellHotbarCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package com.nnpg.glazed.commands;

import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.arguments.StringArgumentType;
import com.nnpg.glazed.managers.SellHotbarManager;
import meteordevelopment.meteorclient.commands.Command;
import net.minecraft.item.ItemStack;
import net.minecraft.command.CommandSource;

public class SellHotbarCommand extends Command {

public SellHotbarCommand() {
super("sell_hotbar", "Sells all items in your hotbar for a specified price. Supports K/M/B suffixes.");
}

@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.then(argument("price", StringArgumentType.word())
.executes(context -> {
String price = StringArgumentType.getString(context, "price");

if (!isValidPrice(price)) {
error("Invalid price format: " + price + ". Use numbers with K/M/B suffixes (e.g., 30k, 1.5m, 2b).");
return SINGLE_SUCCESS;
}

if (SellHotbarManager.get().isRunning()) {
error("Already selling items. Please wait.");
return SINGLE_SUCCESS;
}

if (!hasSellableItemsInHotbar()) {
error("No sellable items found in hotbar.");
return SINGLE_SUCCESS;
}

info("Starting to sell hotbar items for " + formatPrice(parsePrice(price)) + " each.");
SellHotbarManager.get().start(price, true);

return SINGLE_SUCCESS;
})
);
}

private boolean hasSellableItemsInHotbar() {
if (mc.player == null) return false;

for (int slot = 0; slot <= 8; slot++) {
ItemStack stack = mc.player.getInventory().getStack(slot);
if (!stack.isEmpty()) {
return true;
}
}
return false;
}

private boolean isValidPrice(String priceStr) {
return parsePrice(priceStr) > 0;
}

private double parsePrice(String priceStr) {
if (priceStr == null || priceStr.isEmpty()) return -1.0;

String cleaned = priceStr.trim().toUpperCase();
double multiplier = 1.0;

if (cleaned.endsWith("B")) {
multiplier = 1_000_000_000.0;
cleaned = cleaned.substring(0, cleaned.length() - 1);
} else if (cleaned.endsWith("M")) {
multiplier = 1_000_000.0;
cleaned = cleaned.substring(0, cleaned.length() - 1);
} else if (cleaned.endsWith("K")) {
multiplier = 1_000.0;
cleaned = cleaned.substring(0, cleaned.length() - 1);
}

try {
return Double.parseDouble(cleaned) * multiplier;
} catch (NumberFormatException e) {
return -1.0;
}
}

private String formatPrice(double price) {
if (price >= 1_000_000_000) {
return String.format("%.2fB", price / 1_000_000_000);
} else if (price >= 1_000_000) {
return String.format("%.2fM", price / 1_000_000);
} else if (price >= 1_000) {
return String.format("%.2fK", price / 1_000);
} else {
return String.format("%.2f", price);
}
}
}
Loading