diff --git a/src/main/java/com/cleanroommc/bogosorter/BogoSortAPI.java b/src/main/java/com/cleanroommc/bogosorter/BogoSortAPI.java index 2a7b9fd..096d762 100644 --- a/src/main/java/com/cleanroommc/bogosorter/BogoSortAPI.java +++ b/src/main/java/com/cleanroommc/bogosorter/BogoSortAPI.java @@ -36,6 +36,7 @@ import com.cleanroommc.bogosorter.common.sort.NbtSortRule; import com.cleanroommc.bogosorter.compat.loader.Mods; import com.cleanroommc.modularui.factory.ClientGUI; +import com.cleanroommc.modularui.utils.item.IItemHandler; import com.cleanroommc.modularui.utils.item.PlayerInvWrapper; import com.cleanroommc.modularui.utils.item.PlayerMainInvWrapper; import com.cleanroommc.modularui.utils.item.SlotItemHandler; @@ -290,19 +291,21 @@ public static boolean isPlayerSlot(Slot slot) { public static boolean isPlayerSlot(ISlot slot) { if (slot == null) return false; if (slot.bogo$getInventory() instanceof InventoryPlayer - || (slot instanceof SlotItemHandler - && isPlayerInventory((IInventory) ((SlotItemHandler) slot).getItemHandler())) - || (Mods.Ae2.isLoaded() && slot instanceof AppEngSlot - && isPlayerInventory(((AppEngSlot) slot).inventory))) { + || (slot instanceof SlotItemHandler handler && isPlayerInventory(handler.getItemHandler())) + || (Mods.Ae2.isLoaded() && slot instanceof AppEngSlot AppEng && isPlayerInventory(AppEng.inventory))) { return slot.bogo$getSlotIndex() >= 0 && slot.bogo$getSlotIndex() < 36; } return false; } - public static boolean isPlayerInventory(IInventory itemHandler) { + public static boolean isPlayerInventory(IItemHandler itemHandler) { return itemHandler instanceof PlayerMainInvWrapper || itemHandler instanceof PlayerInvWrapper; } + public static boolean isPlayerInventory(IInventory itemHandler) { + return itemHandler instanceof InventoryPlayer; + } + public static final Hash.Strategy ITEM_META_NBT_HASH_STRATEGY = new Hash.Strategy() { @Override