emilyploszaj / emi

A featureful and accessible item and recipe viewer
MIT License
220 stars 46 forks source link

Avoid constructing ItemStack just to check tag membership #536

Closed embeddedt closed 1 month ago

embeddedt commented 1 month ago

Since getItemStack is now rather complex (allocates an ItemStack), we may as well skip using it in spots where the stack is actually unnecessary.

emilyploszaj commented 1 month ago

You say "spots" here, do you intend to update this PR with more than 1 change?

embeddedt commented 1 month ago

I will make another PR if I do, because the other areas ended up requiring more effort to make the code clean (EmiStack needs to gain a new method returning the Item that getItemStack would return).

emilyploszaj commented 1 month ago

It already exists, EmiStack.getKey. I'm not further exposing first class treatment of EmiStacks as glorified ItemStacks