Skip to content

Unify plain and type of for items#8402

Open
sovdeeth wants to merge 6 commits intoSkriptLang:dev/patchfrom
sovdeeth:patch/type-of-change
Open

Unify plain and type of for items#8402
sovdeeth wants to merge 6 commits intoSkriptLang:dev/patchfrom
sovdeeth:patch/type-of-change

Conversation

@sovdeeth
Copy link
Member

Problem

type of has been misleading for users when used with items, as it only clears names and durability, rather than just returning a completely base item representative of the type. plain can return weird items when used with things that require ItemMeta to differentiate, like potions (returns uncraftable potion) and goat horns (always returns ponder).

Solution

Changes both expressions to use a new getBaseType method on ItemType that replaces aliasCopy. This copies over only the minimum necessary info (potion meta info and goat horn info) to differentiate items. This means plain strength potion now actually returns a strength potion, and type of diamond sword of mending returns a diamond sword without enchants.

I don't expect this to break anything for the user, but I'm not entirely sure it is 100% safe. Testers are welcome! I've done testing around potions and goat horns and enchantments, and it seems fine to me, but I'm not sure if there's some edge case I'm missing.

Testing Completed

regression test, manual testing

Supporting Information

There's a second option here, where type of always returns the item with no other identifying data. This may be more desirable for the type of could be interpreted as the material alone. However, this means type of strength potion is uncraftable potion, and type of strength potion is type of speed potion returns true. I don't think these changes are intuitive and could be breaking for users. I am open to counter-arguments, though.


Completes: #8144
Related: none
AI assistance: none

@sovdeeth sovdeeth added the bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. label Jan 25, 2026
@sovdeeth sovdeeth requested a review from a team as a code owner January 25, 2026 02:12
@sovdeeth sovdeeth requested review from Absolutionism and erenkarakal and removed request for a team January 25, 2026 02:12
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Jan 25, 2026
@sovdeeth sovdeeth linked an issue Jan 25, 2026 that may be closed by this pull request
1 task
@sovdeeth sovdeeth added the needs testing Needs testing to determine current status or issue validity, or for WIP feature pulls. label Jan 25, 2026
@sovdeeth sovdeeth moved this to In Review in 2.14 Releases Jan 25, 2026
Copy link
Member

@Efnilite Efnilite left a comment

Choose a reason for hiding this comment

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

looks good, could use a plain item test

@sovdeeth
Copy link
Member Author

looks good, could use a plain item test

plain is already tested in quite a few places throughout the tests, but if you think a standalone is worthwhile i can do that too

@sovdeeth sovdeeth requested a review from Efnilite January 25, 2026 21:03
@sovdeeth sovdeeth force-pushed the patch/type-of-change branch from b099319 to 4c40868 Compare January 26, 2026 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. needs reviews A PR that needs additional reviews needs testing Needs testing to determine current status or issue validity, or for WIP feature pulls.

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

Comparing type of two items, of the same type, with differing enchants fails

2 participants