Skip to content

Commit f4101a7

Browse files
committed
fixed carpets being in armor category
1 parent 219e639 commit f4101a7

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/main/java/meteordevelopment/meteorclient/gui/screens/settings/ItemListSettingScreen.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,8 @@ private enum ItemCategory {
332332
}
333333

334334
private static ItemCategory getCategory(Item item) {
335-
// The order of these is semi important, ex: placing block check first results in things like carrots being put in blocks instead of food
335+
// The ordering of these checks is important! If you change the order double check that items are in expected categories.
336+
336337
if (item instanceof BowItem
337338
|| item instanceof CrossbowItem
338339
|| item instanceof TridentItem
@@ -348,16 +349,22 @@ private static ItemCategory getCategory(Item item) {
348349
) return ItemCategory.PROJECTILES;
349350
if (item instanceof SpawnEggItem) return ItemCategory.SPAWN_EGGS;
350351

352+
// Food check must be before block check so carrots and other food items which can also be planted don't get placed with blocks
353+
try {
354+
if (Utils.isFood(item)) return ItemCategory.FOOD;
355+
} catch (Exception ignored) {}
356+
357+
// Block check should come before Armor check or carpets will end up Armor category
358+
if (item instanceof BlockItem) return ItemCategory.BLOCKS;
359+
351360
try {
352361
if (item.getDefaultInstance().is(ItemTags.SWORDS) || item.getDefaultInstance().is(ItemTags.SPEARS)) return ItemCategory.WEAPONS;
353362
if (item.components().has(DataComponents.EQUIPPABLE)) return ItemCategory.ARMOR;
354363
if (item.components().has(DataComponents.TOOL)) return ItemCategory.TOOLS;
355-
if (Utils.isFood(item)) return ItemCategory.FOOD;
356364
if (item.components().has(DataComponents.POTION_CONTENTS)) return ItemCategory.POTIONS;
357365
if (item.components().has(DataComponents.ENTITY_DATA)) return ItemCategory.SPAWN_EGGS;
358366
} catch (Exception ignored) {}
359367

360-
if (item instanceof BlockItem) return ItemCategory.BLOCKS;
361368

362369
return ItemCategory.OTHER;
363370
}

0 commit comments

Comments
 (0)