Skip to content

Avoid using checkHeldItem() to improve android compatibility - #4

Merged
jacob-keller merged 1 commit into
mainfrom
jk-android-compatibility
Jul 27, 2026
Merged

Avoid using checkHeldItem() to improve android compatibility#4
jacob-keller merged 1 commit into
mainfrom
jk-android-compatibility

Conversation

@jacob-keller

Copy link
Copy Markdown
Owner

The Android version of the game apparently does not have the
checkHeldItem() function in its InventoryPage. This function checks if
CursorSlotItem is null, but optionally takes a function to test the
currently held item with.

We never use the function, and just use it to check whether there is any
held item. Instead of using the function, replace the code to simply
directly check of Game1.player.CustorSlotItem is not null. This removes
one incompatibility with the Android version of the game.

While at it, convert the hoverText checks to use IsNullOrEmpty as
pointed out by YourJeiJi.

Signed-off-by: Jacob Keller jacob.keller@gmail.com

The Android version of the game apparently does not have the
checkHeldItem() function in its InventoryPage. This function checks if
CursorSlotItem is null, but optionally takes a function to test the
currently held item with.

We never use the function, and just use it to check whether there is any
held item. Instead of using the function, replace the code to simply
directly check of Game1.player.CustorSlotItem is not null. This removes
one incompatibility with the Android version of the game.

While at it, convert the hoverText checks to use IsNullOrEmpty as
pointed out by YourJeiJi.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes usage of InventoryPage.checkHeldItem() (which is missing on Android) in FullInventoryPage by directly checking whether the player is holding a cursor item, improving cross-platform runtime compatibility. It also simplifies hover text emptiness checks using string.IsNullOrEmpty.

Changes:

  • Replaced checkHeldItem(null) calls with Game1.player.CursorSlotItem != null.
  • Updated hover text condition from hoverText != null && !hoverText.Equals("") to !string.IsNullOrEmpty(hoverText).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jacob-keller
jacob-keller merged commit e887800 into main Jul 27, 2026
1 check passed
@jacob-keller
jacob-keller deleted the jk-android-compatibility branch July 27, 2026 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants