Skip to content

Commit

Permalink
Implements Vault Charm sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
BONNe committed Nov 15, 2023
1 parent f6ef7bb commit 3854d6b
Show file tree
Hide file tree
Showing 10 changed files with 470 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,38 @@ else if (leftWhat.getId() == ModItems.TRINKET.getRegistryName())
ascending);
};
}
else if (SortingHelper.VAULT_CHARMS.contains(leftWhat.getId()))
{
AttributeGearData leftData = CustomVaultGearData.read(leftWhat.toTag().getCompound("tag"));
AttributeGearData rightData = CustomVaultGearData.read(rightWhat.toTag().getCompound("tag"));

return switch (sortOrder) {
case NAME -> SortingHelper.compareCharms(leftName,
leftData,
leftWhat.toTag().getCompound("tag"),
rightName,
rightData,
rightWhat.toTag().getCompound("tag"),
VaultJewelSorting.CONFIGURATION.getCharmSortingByName(),
ascending);
case AMOUNT -> SortingHelper.compareCharms(leftName,
leftData,
leftWhat.toTag().getCompound("tag"),
rightName,
rightData,
rightWhat.toTag().getCompound("tag"),
VaultJewelSorting.CONFIGURATION.getCharmSortingByAmount(),
ascending);
case MOD -> SortingHelper.compareCharms(leftName,
leftData,
leftWhat.toTag().getCompound("tag"),
rightName,
rightData,
rightWhat.toTag().getCompound("tag"),
VaultJewelSorting.CONFIGURATION.getCharmSortingByMod(),
ascending);
};
}
else if (leftWhat.getId() == ModItems.VAULT_DOLL.getRegistryName())
{
return switch (sortOrder) {
Expand Down Expand Up @@ -304,23 +336,11 @@ else if (leftWhat.getId() == ModItems.VAULT_DOLL.getRegistryName())
private static boolean isSortable(ResourceLocation id)
{
return id.equals(ModItems.JEWEL.getRegistryName()) ||
id.equals(ModItems.HELMET.getRegistryName()) ||
id.equals(ModItems.CHESTPLATE.getRegistryName()) ||
id.equals(ModItems.LEGGINGS.getRegistryName()) ||
id.equals(ModItems.BOOTS.getRegistryName()) ||
id.equals(ModItems.SWORD.getRegistryName()) ||
id.equals(ModItems.AXE.getRegistryName()) ||
id.equals(ModItems.SHIELD.getRegistryName()) ||
id.equals(ModItems.FOCUS.getRegistryName()) ||
id.equals(ModItems.IDOL_BENEVOLENT.getRegistryName()) ||
id.equals(ModItems.IDOL_OMNISCIENT.getRegistryName()) ||
id.equals(ModItems.IDOL_TIMEKEEPER.getRegistryName()) ||
id.equals(ModItems.IDOL_MALEVOLENCE.getRegistryName()) ||
id.equals(ModItems.WAND.getRegistryName()) ||
id.equals(ModItems.MAGNET.getRegistryName()) ||
id.equals(ModItems.INSCRIPTION.getRegistryName()) ||
id.equals(ModItems.VAULT_CRYSTAL.getRegistryName()) ||
id.equals(ModItems.TRINKET.getRegistryName()) ||
SortingHelper.VAULT_CHARMS.contains(id) ||
SortingHelper.VAULT_GEAR_SET.contains(id) ||
id.equals(ModItems.VAULT_DOLL.getRegistryName());
}
}
Loading

0 comments on commit 3854d6b

Please sign in to comment.