Skip to content

Commit

Permalink
Fix AutoGrind.java (#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
crazymoose77756 authored Jun 1, 2024
1 parent 7bdd135 commit d4ad1c1
Showing 1 changed file with 6 additions and 5 deletions.
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

0 comments on commit d4ad1c1

Please sign in to comment.