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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@sovdeeth sovdeeth removed this from 2.14 Releases Mar 6, 2026
@sovdeeth sovdeeth moved this to In Review in 2.15 Releases Mar 6, 2026
Copy link
Copy Markdown
Member

@APickledWalrus APickledWalrus left a comment

Choose a reason for hiding this comment

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

So, there are certainly some breaking changes to note with the changes to plain. I'm not too worried about those, as they are more intuitive. My main concern is that with these changes, there is seemingly no way to obtain the base representation of any item (e.g. just the item created from a material). This system was always kind of bandaged together waiting for a proper comparison system to be implemented. Whenever that may be, I agree some changes now could provide further relief. If plain isn't a true base item (which I can understand the reason for), I think type of should be. It is a useful comparison option/tool to have, so I don't think we should remove it outright.

Requesting changes to enforce further discussion.

@skriptlang-automation skriptlang-automation bot removed the needs reviews A PR that needs additional reviews label Mar 27, 2026
@sovdeeth
Copy link
Copy Markdown
Member Author

So, there are certainly some breaking changes to note with the changes to plain. I'm not too worried about those, as they are more intuitive. My main concern is that with these changes, there is seemingly no way to obtain the base representation of any item (e.g. just the item created from a material). This system was always kind of bandaged together waiting for a proper comparison system to be implemented. Whenever that may be, I agree some changes now could provide further relief. If plain isn't a true base item (which I can understand the reason for), I think type of should be. It is a useful comparison option/tool to have, so I don't think we should remove it outright.

Requesting changes to enforce further discussion.

I agree that there isn't a material-only method for everything, but i'm not sure that's a big deal. This only affects potions and goat horns, as far as I know. In both cases, the base item isn't actually something accessible in game, normally, and with both, goat horn and potion should both return the base item anyway. For every other item, type of and plain would return the same itemstack.

I'm not opposed to type of being the base item, but I do think it might cause more breaking changes than are specifically needed, while not really adding all that much benefit. Let me know what you think

Copy link
Copy Markdown
Member

@APickledWalrus APickledWalrus left a comment

Choose a reason for hiding this comment

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

Fair enough. This should be fine for now

@github-project-automation github-project-automation bot moved this from In Review to Awaiting Merge in 2.15 Releases Mar 27, 2026
@skriptlang-automation skriptlang-automation bot added the patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version. label Mar 27, 2026
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 testing Needs testing to determine current status or issue validity, or for WIP feature pulls. patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version.

Projects

Status: Awaiting Merge

Development

Successfully merging this pull request may close these issues.

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

3 participants