Skip to content
This repository was archived by the owner on Jun 17, 2025. It is now read-only.

Commit 7c4b000

Browse files
committed
Added support for sorting by accumulated item count.
1 parent 5422359 commit 7c4b000

34 files changed

Lines changed: 202 additions & 63 deletions

File tree

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ allprojects {
8888
group = "org.anti-ad.mc"
8989
ext.set("mod_artefact_version", versionObj.toCleanString())
9090
ext.set("mod_artefact_is_release", versionObj.isRelease())
91-
ext.set("libIPN_version", "2.0.5-SNAPSHOT")
91+
ext.set("libIPN_version", "2.0.4")
9292

9393
tasks.withType<JavaCompile>().configureEach {
9494
options.isFork = true

changelog.md

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
<!-- latest begin -->
22

3+
### 1.9.5
4+
5+
- Added support for sorting based on the accumulated count of item type.
6+
It can be selected in `Mod Settings -> Sort Order` there are two variants `Item Count Ascending` and `Item Count Descending`.
7+
8+
It also can be used in custom rules like this `::accumulated_count(number_order = ascending)`, by default the rule is in descending order.
9+
- Added full support for [Carpet's](https://www.curseforge.com/minecraft/mc-mods/carpet) stacable empty shulker boxes. Works only in 1.18-1.19.
10+
Doesn't support the forge port of Carpet. *You need to have carpet installed on the client.*
11+
1.16 is not supported due to limitations in Carpet for that version of minecraft.
12+
- Other oversized stacks are now always left in their original positions when sorting.
13+
14+
15+
### WARNING
16+
17+
Due to multiple Quilt specific crashes and one item duplication Quilt support is now defined as fallows:
18+
19+
```
20+
This mod will work on Quilt using the offered Fabric compatibility.
21+
Any problems that are not reproducible on Fabric will be addressed with very low priority.
22+
```
23+
24+
#### Supported Minecraft versions
25+
- **1.16.x**
26+
- **1.18.2**
27+
- **1.19[.1-2]**
28+
- **1.19.3**
29+
- **1.19.4**
30+
31+
<!-- latest end -->
32+
<!-- rest begin -->
33+
334
### 1.9.4
435

536
- Added support for 1.19.4 Forge.
@@ -33,8 +64,6 @@ Any problems that are not reproducible on Fabric will be addressed with very low
3364

3465
### Become a [Patreon](https://www.patreon.com/mirinimi/membership) to gain early access
3566

36-
<!-- latest end -->
37-
3867

3968
### 1.9.2
4069

@@ -52,10 +81,6 @@ Any problems that are not reproducible on Fabric will be addressed with very low
5281
- **1.19.3**
5382

5483

55-
<!-- latest end -->
56-
57-
<!-- rest begin -->
58-
5984
### 1.9.1
6085

6186
- Added translation for Chinese Traditional thanks to 午夜的大叔

platforms/fabric-1.16/src/main/java/org/anti_ad/mc/ipnext/compat/integrations/Integrations.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
package org.anti_ad.mc.ipnext.compat.integrations
2121

2222
import org.anti_ad.mc.common.extensions.trySwallow
23+
import org.anti_ad.mc.common.vanilla.alias.Slot
2324

2425
object Integrations {
2526

@@ -31,9 +32,14 @@ object Integrations {
3132
}
3233

3334

35+
var ___getSophisticatedMaxCount: (Slot) -> Int = { -1 }
36+
37+
3438
fun init() {
3539
trySwallow {
3640
CarpetIntegration().init()
3741
}
3842
}
43+
44+
fun sophisticatedMaxCount(sourceSlot: Slot): Int = ___getSophisticatedMaxCount(sourceSlot)
3945
}

platforms/fabric-1.16/src/main/java/org/anti_ad/mc/ipnext/ingame/VanillaAccessors.kt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,18 @@ import org.anti_ad.mc.common.vanilla.alias.ItemStack as VanillaItemStack
6464

6565
// use `()` to avoid potential mapping name collision
6666

67-
inline val VanillaItemStack.`(itemType)`: ItemType
67+
val VanillaItemStack.`(itemType)`: ItemType
6868
get() = ItemType(item,
6969
tag,
70-
{ isDamageable })
70+
{ isDamageable },
71+
stackSource = { v: ItemType ->
72+
ItemStack(v, count)
73+
})
74+
7175
inline val VanillaItemStack.`(itemStack)`: ItemStack
7276
get() = if (isEmpty) ItemStack.EMPTY else ItemStack(`(itemType)`,
7377
count)
78+
7479
inline val VanillaItemStack.`(mutableItemStack)`: MutableItemStack
7580
get() = if (isEmpty) MutableItemStack.empty() else MutableItemStack(`(itemType)`,
7681
count)
@@ -86,11 +91,11 @@ inline val Slot.`(id)`
8691
inline val Slot.`(invSlot)`
8792
get() = (this as IMixinSlot).invSlot
8893
inline val Slot.`(itemStack)`: ItemStack
89-
get() = stack.`(itemStack)`
94+
get() = stack.`(itemStack)`.also { it.sourceSlot = this }
9095
inline val Slot.`(vanillaStack)`: VanillaItemStack
9196
get() = this.stack
9297
inline val Slot.`(mutableItemStack)`: MutableItemStack
93-
get() = stack.`(mutableItemStack)`
98+
get() = stack.`(mutableItemStack)`.also { it.sourceSlot = this }
9499
inline val Slot.`(inventory)`: Inventory
95100
get() = inventory
96101
inline val Slot.`(inventoryOrNull)`: Inventory?

platforms/fabric-1.16/src/main/java/org/anti_ad/mc/ipnext/item/ItemTypeExtensions.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ package org.anti_ad.mc.ipnext.item
2222

2323
import net.minecraft.block.ShulkerBoxBlock
2424
import net.minecraft.entity.effect.StatusEffectType
25+
import net.minecraft.item.BlockItem
2526
import org.anti_ad.mc.ipnext.Log
2627
import org.anti_ad.mc.common.extensions.ifTrue
27-
import org.anti_ad.mc.common.vanilla.alias.BlockItem
2828
import org.anti_ad.mc.common.vanilla.alias.Enchantment
2929
import org.anti_ad.mc.common.vanilla.alias.EnchantmentHelper
3030
import org.anti_ad.mc.common.vanilla.alias.FoodComponent
@@ -87,8 +87,12 @@ inline val ItemType.isEmptyShulker: Boolean
8787
inline val ItemType.maxCount: Int
8888
get() {
8989
val carpetEmptyShulkersStackSize = Integrations.carpetEmptyShulkersStackSize
90+
val slot = sourceStack?.sourceSlot
91+
9092
return if (carpetEmptyShulkersStackSize > 1 && isEmptyShulker) {
9193
carpetEmptyShulkersStackSize
94+
} else if (slot != null && Integrations.sophisticatedMaxCount(slot) != -1) {
95+
return Integrations.sophisticatedMaxCount(slot)
9296
} else {
9397
vanillaStack.maxCount
9498
}

platforms/fabric-1.16/src/main/resources/assets/inventoryprofilesnext/config/rules.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@
3030

3131
@auto_refill_best
3232
@default_nbt_rule
33+
34+
@accumulated_count_descending
35+
::accumulated_count(number_order = descending)
36+
37+
@accumulated_count_ascending
38+
::accumulated_count(number_order = ascending)

platforms/fabric-1.18.2/src/main/java/org/anti_ad/mc/ipnext/item/ItemTypeExtensions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ package org.anti_ad.mc.ipnext.item
2424

2525
import net.minecraft.block.ShulkerBoxBlock
2626
import net.minecraft.entity.effect.StatusEffectCategory
27+
import net.minecraft.item.BlockItem
2728
import org.anti_ad.mc.ipnext.Log
2829
import org.anti_ad.mc.common.extensions.ifTrue
29-
import org.anti_ad.mc.common.vanilla.alias.BlockItem
3030
import org.anti_ad.mc.common.vanilla.alias.Enchantment
3131
import org.anti_ad.mc.common.vanilla.alias.EnchantmentHelper
3232
import org.anti_ad.mc.common.vanilla.alias.FoodComponent

platforms/fabric-1.18.2/src/main/resources/assets/inventoryprofilesnext/config/rules.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@
3030

3131
@auto_refill_best
3232
@default_nbt_rule
33+
34+
@accumulated_count_descending
35+
::accumulated_count(number_order = descending)
36+
37+
@accumulated_count_ascending
38+
::accumulated_count(number_order = ascending)

platforms/fabric-1.19.3/src/main/java/org/anti_ad/mc/ipnext/item/ItemTypeExtensions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ package org.anti_ad.mc.ipnext.item
2424

2525
import net.minecraft.block.ShulkerBoxBlock
2626
import net.minecraft.entity.effect.StatusEffectCategory
27+
import net.minecraft.item.BlockItem
2728
import net.minecraft.text.TranslatableTextContent
2829
import org.anti_ad.mc.ipnext.Log
2930
import org.anti_ad.mc.common.extensions.ifTrue
3031
import org.anti_ad.mc.common.vanilla.Vanilla
31-
import org.anti_ad.mc.common.vanilla.alias.BlockItem
3232
import org.anti_ad.mc.common.vanilla.alias.Enchantment
3333
import org.anti_ad.mc.common.vanilla.alias.EnchantmentHelper
3434
import org.anti_ad.mc.common.vanilla.alias.FoodComponent

platforms/fabric-1.19.3/src/main/resources/assets/inventoryprofilesnext/config/rules.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,9 @@
2929

3030
@auto_refill_best
3131
@default_nbt_rule
32+
33+
@accumulated_count_descending
34+
::accumulated_count(number_order = descending)
35+
36+
@accumulated_count_ascending
37+
::accumulated_count(number_order = ascending)

0 commit comments

Comments
 (0)