Skip to content

Commit

Permalink
Fix some stuff in SlimefunItem
Browse files Browse the repository at this point in the history
  • Loading branch information
Intybyte committed Nov 4, 2024
1 parent 330fd31 commit 2a89562
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -774,8 +774,9 @@ public boolean isItem(@Nullable ItemStack item) {
}

// If the given item is a SlimefunitemStack, simply compare the id
if (item instanceof SlimefunItemStack stack) {
return getId().equals(stack.getItemId());
SlimefunItem sfItem = getByItem(item);
if (sfItem != null) {
return getId().equals(sfItem.getId());
}

if (item.hasItemMeta()) {
Expand Down Expand Up @@ -912,8 +913,10 @@ public final void addOfficialWikipage(@Nonnull String page) {
* @return This item's name in {@link ItemStack} form
*/
public final @Nonnull String getItemName() {
if (itemStackTemplate instanceof SlimefunItemStack) {
Optional<String> name = ((SlimefunItemStack) itemStackTemplate).getItemMetaSnapshot().getDisplayName();
SlimefunItem sfItem = getByItem(itemStackTemplate);
if (sfItem != null) {
SlimefunItemStack sfStack = new SlimefunItemStack(sfItem.getId(), itemStackTemplate);
Optional<String> name = sfStack.getItemMetaSnapshot().getDisplayName();

if (name.isPresent()) {
return name.get();
Expand Down

0 comments on commit 2a89562

Please sign in to comment.