diff --git a/gradle.properties b/gradle.properties index b169894..149308e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -51,6 +51,6 @@ sophisticated_backpacks_version=4637292 # The version of Sophisticated Backpacks Mod storage_network_version=3868680 # The mod version. See https://semver.org/ -mod_version=2.5.0 +mod_version=2.5.1 # The change Log changelog=Check changelog in CurseForge page. \ No newline at end of file diff --git a/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/ae2/mixin/MixinRepo.java b/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/ae2/mixin/MixinRepo.java index 5081867..49653bb 100644 --- a/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/ae2/mixin/MixinRepo.java +++ b/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/ae2/mixin/MixinRepo.java @@ -116,20 +116,26 @@ else if (leftId == ModItems.JEWEL.getRegistryName()) return switch (sortOrder) { case NAME -> SortingHelper.compareJewels(leftName, leftData, + leftTag.getInt("freeCuts"), rightName, rightData, + rightTag.getInt("freeCuts"), VaultJewelSorting.CONFIGURATION.getJewelSortingByName(), ascending); case AMOUNT -> SortingHelper.compareJewels(leftName, leftData, + leftTag.getInt("freeCuts"), rightName, rightData, + rightTag.getInt("freeCuts"), VaultJewelSorting.CONFIGURATION.getJewelSortingByAmount(), ascending); case MOD -> SortingHelper.compareJewels(leftName, leftData, + leftTag.getInt("freeCuts"), rightName, rightData, + rightTag.getInt("freeCuts"), VaultJewelSorting.CONFIGURATION.getJewelSortingByMod(), ascending); }; @@ -139,20 +145,26 @@ else if (leftId == ModItems.JEWEL.getRegistryName()) return switch (sortOrder) { case NAME -> SortingHelper.compareJewels(leftName, leftTag.getCompound("clientCache"), + leftTag.getInt("freeCuts"), rightName, rightTag.getCompound("clientCache"), + rightTag.getInt("freeCuts"), VaultJewelSorting.CONFIGURATION.getJewelSortingByName(), ascending); case AMOUNT -> SortingHelper.compareJewels(leftName, leftTag.getCompound("clientCache"), + leftTag.getInt("freeCuts"), rightName, rightTag.getCompound("clientCache"), + rightTag.getInt("freeCuts"), VaultJewelSorting.CONFIGURATION.getJewelSortingByAmount(), ascending); case MOD -> SortingHelper.compareJewels(leftName, leftTag.getCompound("clientCache"), + leftTag.getInt("freeCuts"), rightName, rightTag.getCompound("clientCache"), + rightTag.getInt("freeCuts"), VaultJewelSorting.CONFIGURATION.getJewelSortingByMod(), ascending); }; diff --git a/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/config/Configuration.java b/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/config/Configuration.java index e793b18..a5de12c 100644 --- a/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/config/Configuration.java +++ b/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/config/Configuration.java @@ -33,19 +33,20 @@ public Configuration() this.jewelSortingByName = builder. comment("The order of Jewels if they are sorted by the name."). - comment("Supported Values: NAME, ATTRIBUTE, ATTRIBUTE_VALUE, SIZE, LEVEL, ATTRIBUTE_WEIGHT"). + comment("Supported Values: NAME, ATTRIBUTE, ATTRIBUTE_VALUE, SIZE, LEVEL, ATTRIBUTE_WEIGHT, CUTS"). defineList("jewel_sorting_by_name", Arrays.asList(SortingHelper.JewelOptions.NAME.name(), SortingHelper.JewelOptions.ATTRIBUTE.name(), SortingHelper.JewelOptions.ATTRIBUTE_VALUE.name(), SortingHelper.JewelOptions.SIZE.name(), - SortingHelper.JewelOptions.LEVEL.name()), + SortingHelper.JewelOptions.LEVEL.name(), + SortingHelper.JewelOptions.CUTS.name()), entry -> entry instanceof String value && Enums.getIfPresent(SortingHelper.JewelOptions.class, value.toUpperCase()).isPresent()); this.jewelSortingByAmount = builder. comment("The order of Jewels if they are sorted by the amount/size."). - comment("Supported Values: NAME, ATTRIBUTE, ATTRIBUTE_VALUE, SIZE, LEVEL, ATTRIBUTE_WEIGHT"). + comment("Supported Values: NAME, ATTRIBUTE, ATTRIBUTE_VALUE, SIZE, LEVEL, ATTRIBUTE_WEIGHT, CUTS"). defineList("jewel_sorting_by_amount", Collections.emptyList(), entry -> entry instanceof String value && @@ -53,7 +54,7 @@ public Configuration() this.jewelSortingByMod = builder. comment("The order of Jewels if they are sorted by the mod."). - comment("Supported Values: NAME, ATTRIBUTE, ATTRIBUTE_VALUE, SIZE, LEVEL, ATTRIBUTE_WEIGHT"). + comment("Supported Values: NAME, ATTRIBUTE, ATTRIBUTE_VALUE, SIZE, LEVEL, ATTRIBUTE_WEIGHT, CUTS"). defineList("jewel_sorting_by_mod", Collections.emptyList(), entry -> entry instanceof String value && diff --git a/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/qio/mixin/MixinQIOItemViewerContainerListSortType.java b/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/qio/mixin/MixinQIOItemViewerContainerListSortType.java index b2d41b0..7c97719 100644 --- a/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/qio/mixin/MixinQIOItemViewerContainerListSortType.java +++ b/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/qio/mixin/MixinQIOItemViewerContainerListSortType.java @@ -180,20 +180,26 @@ private static int compareItems(ItemStack firstItem, return switch (instance) { case NAME -> SortingHelper.compareJewels(leftName, leftData, + firstItem.getOrCreateTag().getInt("freeCuts"), rightName, rightData, + secondItem.getOrCreateTag().getInt("freeCuts"), VaultJewelSorting.CONFIGURATION.getJewelSortingByName(), ascending); case SIZE -> SortingHelper.compareJewels(leftName, leftData, + firstItem.getOrCreateTag().getInt("freeCuts"), rightName, rightData, + secondItem.getOrCreateTag().getInt("freeCuts"), VaultJewelSorting.CONFIGURATION.getJewelSortingByAmount(), ascending); case MOD -> SortingHelper.compareJewels(leftName, leftData, + firstItem.getOrCreateTag().getInt("freeCuts"), rightName, rightData, + secondItem.getOrCreateTag().getInt("freeCuts"), VaultJewelSorting.CONFIGURATION.getJewelSortingByMod(), ascending); }; diff --git a/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/quark/mixin/MixinSortingHandler.java b/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/quark/mixin/MixinSortingHandler.java index 0bdbc4c..7858920 100644 --- a/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/quark/mixin/MixinSortingHandler.java +++ b/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/quark/mixin/MixinSortingHandler.java @@ -57,8 +57,10 @@ private static void stackCompare(ItemStack stack1, ItemStack stack2, CallbackInf callbackInfoReturnable.setReturnValue( SortingHelper.compareJewels(stack1.getDisplayName().getString(), VaultGearData.read(stack1), + stack1.getOrCreateTag().getInt("freeCuts"), stack2.getDisplayName().getString(), VaultGearData.read(stack2), + stack2.getOrCreateTag().getInt("freeCuts"), VaultJewelSorting.CONFIGURATION.getJewelSortingByName(), true)); diff --git a/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/refinedstorage/mixin/MixinIdGridSorter.java b/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/refinedstorage/mixin/MixinIdGridSorter.java index e273901..3f7e95c 100644 --- a/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/refinedstorage/mixin/MixinIdGridSorter.java +++ b/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/refinedstorage/mixin/MixinIdGridSorter.java @@ -92,8 +92,10 @@ else if (leftStack.getItem() == ModItems.JEWEL) callbackInfoReturnable.setReturnValue(SortingHelper.compareJewels(left.getName(), GearDataCache.of(leftStack), + leftStack.getOrCreateTag().getInt("freeCuts"), right.getName(), GearDataCache.of(rightStack), + rightStack.getOrCreateTag().getInt("freeCuts"), VaultJewelSorting.CONFIGURATION.getJewelSortingByMod(), sortingDirection == SortingDirection.ASCENDING)); callbackInfoReturnable.cancel(); diff --git a/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/refinedstorage/mixin/MixinNameGridSorter.java b/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/refinedstorage/mixin/MixinNameGridSorter.java index 72d747e..e70a358 100644 --- a/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/refinedstorage/mixin/MixinNameGridSorter.java +++ b/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/refinedstorage/mixin/MixinNameGridSorter.java @@ -92,8 +92,10 @@ else if (leftStack.getItem() == ModItems.JEWEL) callbackInfoReturnable.setReturnValue(SortingHelper.compareJewels(left.getName(), GearDataCache.of(leftStack), + leftStack.getOrCreateTag().getInt("freeCuts"), right.getName(), GearDataCache.of(rightStack), + rightStack.getOrCreateTag().getInt("freeCuts"), VaultJewelSorting.CONFIGURATION.getJewelSortingByName(), sortingDirection == SortingDirection.ASCENDING)); callbackInfoReturnable.cancel(); diff --git a/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/refinedstorage/mixin/MixinQuantityGridSorter.java b/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/refinedstorage/mixin/MixinQuantityGridSorter.java index 64a18c4..5fbb2e5 100644 --- a/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/refinedstorage/mixin/MixinQuantityGridSorter.java +++ b/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/refinedstorage/mixin/MixinQuantityGridSorter.java @@ -103,8 +103,10 @@ else if (leftStack.getItem() == ModItems.JEWEL) callbackInfoReturnable.setReturnValue(SortingHelper.compareJewels( left.getName(), GearDataCache.of(leftStack), + leftStack.getOrCreateTag().getInt("freeCuts"), right.getName(), GearDataCache.of(rightStack), + rightStack.getOrCreateTag().getInt("freeCuts"), VaultJewelSorting.CONFIGURATION.getJewelSortingByAmount(), sortingDirection == SortingDirection.ASCENDING)); } diff --git a/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/sophisticatedcore/mixin/MixinInventorySorter.java b/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/sophisticatedcore/mixin/MixinInventorySorter.java index 41fd2fd..ae1a998 100644 --- a/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/sophisticatedcore/mixin/MixinInventorySorter.java +++ b/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/sophisticatedcore/mixin/MixinInventorySorter.java @@ -46,8 +46,10 @@ else if (firstStack.getItem() == ModItems.JEWEL) return SortingHelper.compareJewels( firstStack.getDisplayName().getString(), VaultGearData.read(firstStack), + firstStack.getOrCreateTag().getInt("freeCuts"), secondStack.getDisplayName().getString(), VaultGearData.read(secondStack), + secondStack.getOrCreateTag().getInt("freeCuts"), VaultJewelSorting.CONFIGURATION.getJewelSortingByAmount(), true); } @@ -200,8 +202,10 @@ else if (firstStack.getItem() == ModItems.JEWEL) return SortingHelper.compareJewels( firstStack.getDisplayName().getString(), VaultGearData.read(firstStack), + firstStack.getOrCreateTag().getInt("freeCuts"), secondStack.getDisplayName().getString(), VaultGearData.read(secondStack), + secondStack.getOrCreateTag().getInt("freeCuts"), VaultJewelSorting.CONFIGURATION.getJewelSortingByName(), true); } diff --git a/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/storagenetwork/mixin/MixinNetworkWidget.java b/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/storagenetwork/mixin/MixinNetworkWidget.java index 5fe9c0d..ace2267 100644 --- a/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/storagenetwork/mixin/MixinNetworkWidget.java +++ b/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/storagenetwork/mixin/MixinNetworkWidget.java @@ -72,20 +72,26 @@ else if (first.getItem() == ModItems.JEWEL) return switch (this.gui.getSort()) { case NAME -> SortingHelper.compareJewels(leftName, leftData, + first.getOrCreateTag().getInt("freeCuts"), rightName, rightData, + second.getOrCreateTag().getInt("freeCuts"), VaultJewelSorting.CONFIGURATION.getJewelSortingByName(), this.gui.getDownwards()); case AMOUNT -> SortingHelper.compareJewels(leftName, leftData, + first.getOrCreateTag().getInt("freeCuts"), rightName, rightData, + second.getOrCreateTag().getInt("freeCuts"), VaultJewelSorting.CONFIGURATION.getJewelSortingByAmount(), this.gui.getDownwards()); case MOD -> SortingHelper.compareJewels(leftName, leftData, + first.getOrCreateTag().getInt("freeCuts"), rightName, rightData, + second.getOrCreateTag().getInt("freeCuts"), VaultJewelSorting.CONFIGURATION.getJewelSortingByMod(), this.gui.getDownwards()); }; diff --git a/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/utils/SortingHelper.java b/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/utils/SortingHelper.java index 50876ac..4b97ee0 100644 --- a/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/utils/SortingHelper.java +++ b/src/main/java/lv/id/bonne/vaulthunters/jewelsorting/utils/SortingHelper.java @@ -86,8 +86,10 @@ public static int compareRegistryNames(ResourceLocation leftReg, public static int compareJewels( String leftName, VaultGearData leftData, + int leftCuts, String rightName, VaultGearData rightData, + int rightCuts, List sortingOrder, boolean ascending) { @@ -118,6 +120,7 @@ public static int compareJewels( case SIZE -> SortingHelper.compareSizeAttribute(leftData, rightData); case ATTRIBUTE_WEIGHT -> SortingHelper.compareAttributeValueWeight(leftData, leftAttribute, rightData, rightAttribute); case LEVEL -> SortingHelper.compareLevel(leftData, rightData); + case CUTS -> SortingHelper.compareIntegerValue(rightCuts, leftCuts); }; } @@ -139,8 +142,10 @@ public static int compareJewels( public static int compareJewels( String leftName, GearDataCache leftData, + int leftCuts, String rightName, GearDataCache rightData, + int rightCuts, List sortingOrder, boolean ascending) { @@ -164,6 +169,7 @@ public static int compareJewels( case ATTRIBUTE_WEIGHT -> SortingHelper.compareAttributeValueWeight(leftExtraCache, rightExtraCache); case LEVEL -> SortingHelper.compareIntegerValue(leftExtraCache.getExtraGearLevel(), rightExtraCache.getExtraGearLevel()); + case CUTS -> SortingHelper.compareIntegerValue(rightCuts, leftCuts); }; } @@ -185,8 +191,10 @@ public static int compareJewels( public static int compareJewels( String leftName, CompoundTag leftData, + int leftCuts, String rightName, CompoundTag rightData, + int rightCuts, List sortingOrder, boolean ascending) { @@ -212,6 +220,7 @@ public static int compareJewels( } case LEVEL -> SortingHelper.compareIntegerValue(leftData.getInt(EXTRA_GEAR_LEVEL), rightData.getInt(EXTRA_GEAR_LEVEL)); + case CUTS -> SortingHelper.compareIntegerValue(rightCuts, leftCuts); }; } @@ -1304,7 +1313,11 @@ public enum JewelOptions /** * The level of the item */ - LEVEL + LEVEL, + /** + * Number of free cuts applied to gear + */ + CUTS }