From f8f8af3c5acf5a966926f5e16750a44a738bc58b Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Sat, 28 Sep 2024 18:51:08 +0800 Subject: [PATCH 1/2] Fixed Master Stars Display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit they changed how stars displays from: §6✪§6✪§6✪§6✪§6✪§c➋ to §6✪✪✪✪✪§c➋ Signed-off-by: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> --- .../skytilsmod/mixins/hooks/item/ItemStackHook.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/gg/skytils/skytilsmod/mixins/hooks/item/ItemStackHook.kt b/src/main/kotlin/gg/skytils/skytilsmod/mixins/hooks/item/ItemStackHook.kt index 8ef80cea4..3a8f8ebe4 100644 --- a/src/main/kotlin/gg/skytils/skytilsmod/mixins/hooks/item/ItemStackHook.kt +++ b/src/main/kotlin/gg/skytils/skytilsmod/mixins/hooks/item/ItemStackHook.kt @@ -27,7 +27,8 @@ import gg.skytils.skytilsmod.utils.ifNull import net.minecraft.item.ItemStack import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable -const val starPattern = "§6✪" +const val starPattern = "§6✪✪✪✪✪" +const val starPatternSingle = "✪" val masterStars = ('➊'..'➎').toList() val masterStarPattern = Regex("§c[${masterStars.joinToString("")}]") @@ -68,18 +69,18 @@ fun modifyDisplayName(s: String): String { .replace(masterStarPattern, "") }§c${count}✪" }.ifNull { - displayName = "${displayName.replace(starPattern, "")}§6${displayName.countMatches(starPattern)}✪" + displayName = "${displayName.replace(starPattern, "")}§6${displayName.countMatches(starPatternSingle)}✪" } } else if (Skytils.config.starDisplayType == 1) { masterStarPattern.find(displayName)?.let { val star = it.value.last() val count = masterStars.indexOf(star) + 1 displayName = displayName.replace(masterStarPattern, "") - .replaceFirst(starPattern.repeat(count), "§c✪".repeat(count)) + .replaceFirst("§6${starPatternSingle.repeat(count)}", "§c✪§6".repeat(count)) } } } } catch (ignored: Exception) { } return displayName -} \ No newline at end of file +} From 2b0fa5df15a69de8ff61e086fb9577e31495887c Mon Sep 17 00:00:00 2001 From: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> Date: Sat, 28 Sep 2024 18:53:40 +0800 Subject: [PATCH 2/2] Fixed Master Stars Display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit they changed the display of stars from §6✪§6✪§6✪§6✪§6✪§c➋ to §6✪✪✪✪✪§c➋ in a recent patch Signed-off-by: EmeraldMerchant <96396730+EmeraldMerchant@users.noreply.github.com> --- .../skytilsmod/mixins/hooks/item/ItemStackHook.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/gg/skytils/skytilsmod/mixins/hooks/item/ItemStackHook.kt b/src/main/kotlin/gg/skytils/skytilsmod/mixins/hooks/item/ItemStackHook.kt index 8ef80cea4..3a8f8ebe4 100644 --- a/src/main/kotlin/gg/skytils/skytilsmod/mixins/hooks/item/ItemStackHook.kt +++ b/src/main/kotlin/gg/skytils/skytilsmod/mixins/hooks/item/ItemStackHook.kt @@ -27,7 +27,8 @@ import gg.skytils.skytilsmod.utils.ifNull import net.minecraft.item.ItemStack import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable -const val starPattern = "§6✪" +const val starPattern = "§6✪✪✪✪✪" +const val starPatternSingle = "✪" val masterStars = ('➊'..'➎').toList() val masterStarPattern = Regex("§c[${masterStars.joinToString("")}]") @@ -68,18 +69,18 @@ fun modifyDisplayName(s: String): String { .replace(masterStarPattern, "") }§c${count}✪" }.ifNull { - displayName = "${displayName.replace(starPattern, "")}§6${displayName.countMatches(starPattern)}✪" + displayName = "${displayName.replace(starPattern, "")}§6${displayName.countMatches(starPatternSingle)}✪" } } else if (Skytils.config.starDisplayType == 1) { masterStarPattern.find(displayName)?.let { val star = it.value.last() val count = masterStars.indexOf(star) + 1 displayName = displayName.replace(masterStarPattern, "") - .replaceFirst(starPattern.repeat(count), "§c✪".repeat(count)) + .replaceFirst("§6${starPatternSingle.repeat(count)}", "§c✪§6".repeat(count)) } } } } catch (ignored: Exception) { } return displayName -} \ No newline at end of file +}