WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 243eb0b

Browse files
committed
make item checker the same on every version
1 parent 9489022 commit 243eb0b

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
package derp.immersivehotbar.util;
22

3-
import net.minecraft.item.*;
4-
import org.spongepowered.asm.mixin.Unique;
3+
import net.minecraft.item.ItemStack;
4+
import net.minecraft.item.Items;
5+
import net.minecraft.item.ShearsItem;
6+
import net.minecraft.registry.tag.ItemTags;
57

68
public class ItemChecker {
7-
@Unique
9+
810
public static boolean isTool(ItemStack stack) {
9-
return stack.getItem() instanceof ShovelItem || stack.getItem() instanceof AxeItem || stack.getItem() instanceof PickaxeItem || stack.getItem() instanceof HoeItem || stack.getItem() instanceof ShearsItem;
11+
return stack.isIn(ItemTags.PICKAXES) || stack.isIn(ItemTags.SHOVELS) || stack.isIn(ItemTags.AXES) || stack.isIn(ItemTags.HOES) || stack.getItem() instanceof ShearsItem;
1012
}
11-
@Unique
13+
1214
public static boolean isWeapon(ItemStack stack) {
13-
return stack.getItem() instanceof CrossbowItem || stack.getItem() instanceof SwordItem || stack.getItem() instanceof BowItem || stack.getItem() instanceof TridentItem || stack.getItem() instanceof MaceItem;
15+
return stack.isIn(ItemTags.SWORDS) || stack.isOf(Items.BOW) || stack.isOf(Items.CROSSBOW) || stack.isOf(Items.TRIDENT) || stack.isOf(Items.MACE);
1416
}
1517
}
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
package derp.immersivehotbar.util;
22

3-
import net.minecraft.item.*;
4-
import org.spongepowered.asm.mixin.Unique;
3+
import net.minecraft.item.ItemStack;
4+
import net.minecraft.item.Items;
5+
import net.minecraft.item.ShearsItem;
6+
import net.minecraft.registry.tag.ItemTags;
57

68
public class ItemChecker {
7-
@Unique
9+
810
public static boolean isTool(ItemStack stack) {
9-
return stack.getItem() instanceof ShovelItem || stack.getItem() instanceof AxeItem || stack.getItem() instanceof PickaxeItem || stack.getItem() instanceof HoeItem || stack.getItem() instanceof ShearsItem;
11+
return stack.isIn(ItemTags.PICKAXES) || stack.isIn(ItemTags.SHOVELS) || stack.isIn(ItemTags.AXES) || stack.isIn(ItemTags.HOES) || stack.isOf(Items.SHEARS);
1012
}
11-
@Unique
13+
1214
public static boolean isWeapon(ItemStack stack) {
13-
return stack.getItem() instanceof CrossbowItem || stack.getItem() instanceof SwordItem || stack.getItem() instanceof BowItem || stack.getItem() instanceof TridentItem || stack.getItem() instanceof MaceItem;
15+
return stack.isIn(ItemTags.SWORDS) || stack.isOf(Items.BOW) || stack.isOf(Items.CROSSBOW) || stack.isOf(Items.TRIDENT) || stack.isOf(Items.MACE);
1416
}
1517
}

0 commit comments

Comments
 (0)