Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix AutoGrind.java #355

Merged
merged 1 commit into from
Jun 1, 2024
Merged
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
11 changes: 6 additions & 5 deletions src/main/java/anticope/rejects/modules/AutoGrind.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
import meteordevelopment.meteorclient.utils.player.InvUtils;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.ItemEnchantmentsComponent;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.screen.GrindstoneScreenHandler;

import java.util.List;
import java.util.Map;

public class AutoGrind extends Module {
private final SettingGroup sgGeneral = settings.getDefaultGroup();
Expand Down Expand Up @@ -74,14 +75,14 @@ private void onOpenScreen(OpenScreenEvent event) {
private boolean canGrind(ItemStack stack) {
if (itemBlacklist.get().contains(stack.getItem())) return false;

Map<Enchantment, Integer> enchantments = (Map<Enchantment, Integer>) EnchantmentHelper.getEnchantments(stack);
ItemEnchantmentsComponent enchantments = EnchantmentHelper.getEnchantments(stack);
int availEnchs = 0;

for (Enchantment enchantment : enchantments.keySet()) {
for (RegistryEntry<Enchantment> enchantment : enchantments.getEnchantments()) {
availEnchs++;
if (enchantment.isCursed())
if (enchantment.value().isCursed())
availEnchs--;
if (enchantmentBlacklist.get().contains(enchantment))
if (enchantmentBlacklist.get().contains(enchantment.value()))
return false;
}

Expand Down
Loading