Skip to content

Commit

Permalink
fixed default sort order for 1.19.4+
Browse files Browse the repository at this point in the history
  • Loading branch information
blackd committed Jun 9, 2023
1 parent c1db497 commit 3569ab0
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 11 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### 1.10.3

- Support for 1.20 Fabric. The pre1/2 version does work but has some GUI glitches.
- Fixed default sort rule for 1.19.4 and 1.20 to really use the Creative search tab index.
- Fixed a problem where the bookmark buttons didn't work last 1 or 2 trades.

### WARNING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ import net.minecraft.block.ShulkerBoxBlock
import net.minecraft.entity.effect.StatusEffectCategory
import net.minecraft.item.BlockItem
import net.minecraft.text.TranslatableTextContent
import org.anti_ad.mc.common.extensions.ifIt
import org.anti_ad.mc.ipnext.Log
import org.anti_ad.mc.common.extensions.ifTrue
import org.anti_ad.mc.common.extensions.orDefault
import org.anti_ad.mc.common.vanilla.Vanilla
import org.anti_ad.mc.common.vanilla.alias.Enchantment
import org.anti_ad.mc.common.vanilla.alias.EnchantmentHelper
Expand Down Expand Up @@ -236,9 +238,13 @@ private fun initGroupIndex(): Boolean {
val ItemType.searchTabIndex: Int
get() {
initGroupIndex()
return ItemGroups.getSearchGroup().searchTabStacks.indexOfFirst { it ->
it != null && it.`(itemType)` == this
val index = ItemGroups.getSearchGroup().searchTabStacks.indexOfFirst { it ->
it != null && it.`(itemType)`.item == this.item
}
if (index == -1) {
Log.warn("Item ${this.itemId} not present in the Creative Inventory Search Tab!")
}
return index
}

val ItemType.groupIndex: Int
Expand Down
2 changes: 1 addition & 1 deletion platforms/fabric-1.20/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import org.anti_ad.mc.ipnext.buildsrc.loom_version
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import proguard.gradle.ProGuardTask

val supported_minecraft_versions = listOf("1.20", "1.20")
val supported_minecraft_versions = listOf("1.20")
val mod_loader = "fabric"
val mod_version = project.version.toString()
val minecraft_version = "1.20"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,13 @@ private fun initGroupIndex(): Boolean {
val ItemType.searchTabIndex: Int
get() {
initGroupIndex()
return ItemGroups.getSearchGroup().searchTabStacks.indexOfFirst { it ->
it != null && it.`(itemType)` == this
val index = ItemGroups.getSearchGroup().searchTabStacks.indexOfFirst { it ->
it != null && it.`(itemType)`.item == this.item
}
if (index == -1) {
Log.warn("Item ${this.itemId} not present in the Creative Inventory Search Tab!")
}
return index
}

val ItemType.groupIndex: Int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,14 @@ private fun initGroupIndex(): Boolean {
val ItemType.searchTabIndex: Int
get() {
initGroupIndex()
return ItemGroups.searchTab().searchTabDisplayItems.indexOfFirst { it ->
it != null && it.`(itemType)` == this

val index = ItemGroups.searchTab().searchTabDisplayItems.indexOfFirst { it ->
it != null && it.`(itemType)`.item == this.item
}
if (index == -1) {
Log.warn("Item ${this.itemId} not present in the Creative Inventory Search Tab!")
}
return index
}

val ItemType.groupIndex: Int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,14 @@ private fun initGroupIndex(): Boolean {
val ItemType.searchTabIndex: Int
get() {
initGroupIndex()
return ItemGroups.searchTab().searchTabDisplayItems.indexOfFirst { it ->
it != null && it.`(itemType)` == this

val index = ItemGroups.searchTab().searchTabDisplayItems.indexOfFirst { it ->
it != null && it.`(itemType)`.item == this.item
}
if (index == -1) {
Log.warn("Item ${this.itemId} not present in the Creative Inventory Search Tab!")
}
return index
}

val ItemType.groupIndex: Int
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ include("platforms:fabric-1.19.4")
include("platforms:fabric-1.19")
include("platforms:fabric-1.18.2")
include("platforms:fabric-1.16")

/*include("platforms:forge-1.20")*/
include("platforms:forge-1.19.4")
include("platforms:forge-1.19")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ class NumberBasedRule : TypeBasedRule<Number>() {
arguments.defineParameter(number_order,
NumberOrder.ASCENDING)
comparator = { a, b ->
compareNumber(valueOf(a),
valueOf(b))
val valueA = valueOf(a)
val valueB = valueOf(b)
compareNumber(valueA,
valueB)
}
}

Expand Down

0 comments on commit 3569ab0

Please sign in to comment.