Skip to content

Commit

Permalink
Getting started on SlimefunUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
Intybyte committed Nov 4, 2024
1 parent 1a88959 commit ae9b8ef
Showing 1 changed file with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,20 +340,24 @@ public static boolean isItemSimilar(@Nullable ItemStack item, @Nullable ItemStac
return false;
} else if (checkAmount && item.getAmount() < sfitem.getAmount()) {
return false;
} else if (sfitem instanceof SlimefunItemStack stackOne && item instanceof SlimefunItemStack stackTwo) {
if (stackOne.getItemId().equals(stackTwo.getItemId())) {
/*
* PR #3417
*
* Some items can't rely on just IDs matching and will implement {@link DistinctiveItem}
* in which case we want to use the method provided to compare
*/
if (checkDistinction && stackOne instanceof DistinctiveItem distinctive && stackTwo instanceof DistinctiveItem) {
return distinctive.canStack(stackOne.getItemMeta(), stackTwo.getItemMeta());
}
return true;
}
SlimefunItem sfItemSI = SlimefunItem.getByItem(sfitem);
SlimefunItem itemSI = SlimefunItem.getByItem(item);

if (sfItemSI != null && itemSI != null) {
if (!sfItemSI.getId().equals(itemSI.getId())) {
return false;
}
return false;
/*
* PR #3417
*
* Some items can't rely on just IDs matching and will implement {@link DistinctiveItem}
* in which case we want to use the method provided to compare
*/
if (checkDistinction && sfItemSI instanceof DistinctiveItem distinctive && itemSI instanceof DistinctiveItem) {
return distinctive.canStack(item.getItemMeta(), sfitem.getItemMeta());
}
return true;
} else if (item.hasItemMeta()) {
Debug.log(TestCase.CARGO_INPUT_TESTING, "SlimefunUtils#isItemSimilar - item.hasItemMeta()");
ItemMeta itemMeta = item.getItemMeta();
Expand Down

0 comments on commit ae9b8ef

Please sign in to comment.