Skip to content

Commit 1893101

Browse files
committed
trying to fix that blur bug.
1 parent 58f633d commit 1893101

File tree

12 files changed

+46
-25
lines changed

12 files changed

+46
-25
lines changed

buildSrc/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
`kotlin-dsl`
3-
kotlin("jvm") version "2.2.21"
3+
kotlin("jvm") version "2.3.0"
44
}
55

66
repositories {

forge/build.gradle.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ configurations {
5555
// get("developmentForge").extendsFrom(commonBundle)
5656
}
5757

58-
mixin {
59-
config("unitytranslate.mixins.json")
60-
add(sourceSets.main.get(), "mixins.unitytranslate.refmap.json")
61-
}
58+
//mixin {
59+
// config("unitytranslate.mixins.json")
60+
// add(sourceSets.main.get(), "mixins.unitytranslate.refmap.json")
61+
//}
6262

6363
repositories {
6464
maven("https://maven.minecraftforge.net/")

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ deps.jnr = 2.2.17
5858
deps.talk_balloons = 1.4.1
5959

6060
# https://modrinth.com/mod/modernnetworking
61-
deps.modernnetworking = 1.2.6
61+
deps.modernnetworking = 1.2.8
6262
deps.modernnetworking_mc = [VERSIONED]
6363

6464
# https://modrinth.com/mod/cloth-config

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
# blame ForgeGradle for using an RC
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-rc-1-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
55
networkTimeout=10000
66
validateDistributionUrl=true
77
zipStoreBase=GRADLE_USER_HOME

src/main/kotlin/xyz/bluspring/unitytranslate/client/UnityTranslateClient.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import xyz.bluspring.unitytranslate.network.UTClientNetworking
2121
import xyz.bluspring.unitytranslate.network.payloads.SendTranscriptToServerPayload
2222
import xyz.bluspring.unitytranslate.transcript.TranscriptHolder
2323
import xyz.bluspring.unitytranslate.translator.TranslatorManager
24+
import xyz.bluspring.unitytranslate.util.openScreen
2425
import java.util.concurrent.ConcurrentLinkedQueue
2526
import java.util.function.BiConsumer
2627
import java.util.function.Consumer
@@ -51,7 +52,7 @@ class UnityTranslateClient {
5152

5253
fun clientTick(mc: Minecraft) {
5354
if (CONFIGURE_BOXES.consumeClick()) {
54-
mc.setScreen(EditTranscriptBoxesScreen(languageBoxes))
55+
mc.openScreen(EditTranscriptBoxesScreen(languageBoxes))
5556
}
5657

5758
if (TOGGLE_TRANSCRIPTION.consumeClick()) {
@@ -74,7 +75,7 @@ class UnityTranslateClient {
7475
}
7576

7677
if (SET_SPOKEN_LANGUAGE.consumeClick() && mc.screen == null) {
77-
mc.setScreen(LanguageSelectScreen(null, LanguageSelectType.SPOKEN))
78+
mc.openScreen(LanguageSelectScreen(null, LanguageSelectType.SPOKEN))
7879
}
7980

8081
if (CLEAR_TRANSCRIPTS.consumeClick()) {
@@ -84,7 +85,7 @@ class UnityTranslateClient {
8485
}
8586

8687
if (OPEN_CONFIG_GUI.consumeClick()) {
87-
mc.setScreen(UTConfigScreen(null))
88+
mc.openScreen(UTConfigScreen(null))
8889
}
8990

9091
/*if (TRANSLATE_SIGN.consumeClick()) {

src/main/kotlin/xyz/bluspring/unitytranslate/client/gui/EditTranscriptBoxesScreen.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import xyz.bluspring.unitytranslate.UnityTranslate
2121
import xyz.bluspring.unitytranslate.client.UnityTranslateClient
2222
import xyz.bluspring.unitytranslate.util.multiversion.*
2323
import xyz.bluspring.unitytranslate.network.UTClientNetworking
24+
import xyz.bluspring.unitytranslate.util.openScreen
2425
import java.util.*
2526

2627
class EditTranscriptBoxesScreen(val boxes: MutableList<TranscriptBox>, val parent: Screen? = null) : Screen(Component.empty()) {
@@ -47,7 +48,7 @@ class EditTranscriptBoxesScreen(val boxes: MutableList<TranscriptBox>, val paren
4748

4849
this.addRenderableWidget(
4950
Button.builder(Component.literal("+")) {
50-
Minecraft.getInstance().setScreen(LanguageSelectScreen(this, LanguageSelectType.TRANSCRIPT_BOX))
51+
Minecraft.getInstance().openScreen(LanguageSelectScreen(this, LanguageSelectType.TRANSCRIPT_BOX))
5152
}
5253
.pos(this.width / 2 - (Button.DEFAULT_WIDTH / 2) - Button.DEFAULT_HEIGHT, this.height - 50)
5354
.width(Button.DEFAULT_HEIGHT)
@@ -56,7 +57,7 @@ class EditTranscriptBoxesScreen(val boxes: MutableList<TranscriptBox>, val paren
5657
}
5758

5859
override fun onClose() {
59-
Minecraft.getInstance().setScreen(parent)
60+
Minecraft.getInstance().openScreen(parent)
6061

6162
if (shouldDisableHudAfter)
6263
UnityTranslateClient.shouldRenderBoxes = false

src/main/kotlin/xyz/bluspring/unitytranslate/client/gui/LanguageSelectScreen.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import xyz.bluspring.unitytranslate.UnityTranslate
2121
import xyz.bluspring.unitytranslate.client.UnityTranslateClient
2222
import xyz.bluspring.unitytranslate.network.UTClientNetworking
2323
import xyz.bluspring.unitytranslate.util.multiversion.*
24+
import xyz.bluspring.unitytranslate.util.openScreen
2425

2526
class LanguageSelectScreen(val parent: Screen?, val type: LanguageSelectType) : Screen(Component.translatable("options.language")) {
2627
private lateinit var list: LanguageSelectionList
@@ -40,7 +41,7 @@ class LanguageSelectScreen(val parent: Screen?, val type: LanguageSelectType) :
4041
}
4142

4243
override fun onClose() {
43-
Minecraft.getInstance().setScreen(parent)
44+
Minecraft.getInstance().openScreen(parent)
4445
}
4546

4647
override fun render(guiGraphics: GuiGraphics, mouseX: Int, mouseY: Int, partialTick: Float) {

src/main/kotlin/xyz/bluspring/unitytranslate/client/gui/UTConfigScreen.kt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import xyz.bluspring.unitytranslate.config.*
2222
import xyz.bluspring.unitytranslate.config.IntRange
2323
import xyz.bluspring.unitytranslate.duck.ScrollableWidget
2424
import xyz.bluspring.unitytranslate.mixin.AbstractWidgetAccessor
25+
import xyz.bluspring.unitytranslate.util.openScreen
2526
import kotlin.math.absoluteValue
2627
import kotlin.reflect.KClass
2728
import kotlin.reflect.KMutableProperty
@@ -51,7 +52,7 @@ class UTConfigScreen(private val parent: Screen?) : Screen(Component.literal("Un
5152

5253
addRenderableWidget(
5354
Button.builder(Component.translatable("gui.unitytranslate.config.client")) {
54-
Minecraft.getInstance().setScreen(UTConfigSubScreen(UnityTranslate.config.client::class, UnityTranslate.config.client, "client"))
55+
Minecraft.getInstance().openScreen(UTConfigSubScreen(UnityTranslate.config.client::class, UnityTranslate.config.client, "client"))
5556
}
5657
.pos(this.width / 2 - (width / 2), 75)
5758
.size(width, Button.DEFAULT_HEIGHT)
@@ -60,7 +61,7 @@ class UTConfigScreen(private val parent: Screen?) : Screen(Component.literal("Un
6061

6162
addRenderableWidget(
6263
Button.builder(Component.translatable("gui.unitytranslate.config.common")) {
63-
Minecraft.getInstance().setScreen(UTConfigSubScreen(UnityTranslate.config.server::class, UnityTranslate.config.server, "common"))
64+
Minecraft.getInstance().openScreen(UTConfigSubScreen(UnityTranslate.config.server::class, UnityTranslate.config.server, "common"))
6465
}
6566
.pos(this.width / 2 - (width / 2), 75 + Button.DEFAULT_HEIGHT + 5)
6667
.size(width, Button.DEFAULT_HEIGHT)
@@ -90,7 +91,7 @@ class UTConfigScreen(private val parent: Screen?) : Screen(Component.literal("Un
9091
}
9192

9293
override fun onClose() {
93-
Minecraft.getInstance().setScreen(parent)
94+
Minecraft.getInstance().openScreen(parent)
9495
}
9596

9697
inner class UTConfigSubScreen<T : Any>(val configClass: KClass<out T>, val instance: T, val type: String) : Screen(Component.translatable("gui.unitytranslate.config.$type")) {
@@ -438,7 +439,7 @@ class UTConfigScreen(private val parent: Screen?) : Screen(Component.literal("Un
438439

439440
if (type == "client") { // Special case
440441
addRenderableWidget(Button.builder(Component.translatable("unitytranslate.configure_boxes")) {
441-
Minecraft.getInstance().setScreen(EditTranscriptBoxesScreen(UnityTranslateClient.languageBoxes, this@UTConfigSubScreen))
442+
Minecraft.getInstance().openScreen(EditTranscriptBoxesScreen(UnityTranslateClient.languageBoxes, this@UTConfigSubScreen))
442443
}
443444
.pos(this.width / 2 - (Button.DEFAULT_WIDTH / 2), y)
444445
.build()
@@ -450,7 +451,7 @@ class UTConfigScreen(private val parent: Screen?) : Screen(Component.literal("Un
450451
y += 30
451452

452453
addRenderableWidget(Button.builder(Component.translatable("unitytranslate.set_spoken_language")) {
453-
Minecraft.getInstance().setScreen(LanguageSelectScreen(this@UTConfigSubScreen, LanguageSelectType.SPOKEN))
454+
Minecraft.getInstance().openScreen(LanguageSelectScreen(this@UTConfigSubScreen, LanguageSelectType.SPOKEN))
454455
}
455456
.pos(this.width / 2 - (Button.DEFAULT_WIDTH / 2), y)
456457
.build()
@@ -463,7 +464,7 @@ class UTConfigScreen(private val parent: Screen?) : Screen(Component.literal("Un
463464

464465
if (UnityTranslate.instance.proxy.isModLoaded("talk_balloons")) {
465466
addRenderableWidget(Button.builder(Component.translatable("unitytranslate.set_balloon_language")) {
466-
Minecraft.getInstance().setScreen(LanguageSelectScreen(this@UTConfigSubScreen, LanguageSelectType.BALLOON))
467+
Minecraft.getInstance().openScreen(LanguageSelectScreen(this@UTConfigSubScreen, LanguageSelectType.BALLOON))
467468
}
468469
.pos(this.width / 2 - (Button.DEFAULT_WIDTH / 2), y)
469470
.build()
@@ -688,7 +689,7 @@ class UTConfigScreen(private val parent: Screen?) : Screen(Component.literal("Un
688689
}
689690

690691
override fun onClose() {
691-
Minecraft.getInstance().setScreen(this@UTConfigScreen)
692+
Minecraft.getInstance().openScreen(this@UTConfigScreen)
692693
UnityTranslate.saveConfig()
693694
}
694695
}

src/main/kotlin/xyz/bluspring/unitytranslate/client/transcribers/browser/BrowserSpeechTranscriber.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import xyz.bluspring.unitytranslate.client.gui.OpenBrowserScreen
2222
import xyz.bluspring.unitytranslate.client.transcribers.SpeechTranscriber
2323
import xyz.bluspring.unitytranslate.client.transcribers.TranscriberType
2424
import xyz.bluspring.unitytranslate.config.UnityTranslateConfig
25+
import xyz.bluspring.unitytranslate.util.openScreen
2526
import java.net.InetSocketAddress
2627
import java.net.URI
2728

@@ -53,7 +54,7 @@ class BrowserSpeechTranscriber(language: Language) : SpeechTranscriber(language)
5354
Util.getPlatform().openUri("http://127.0.0.1:$serverPort")
5455
} else if (UnityTranslate.config.client.openBrowserWithoutPromptV2 == UnityTranslateConfig.TriState.DEFAULT) {
5556
Minecraft.getInstance().execute {
56-
mc.setScreen(OpenBrowserScreen("http://127.0.0.1:$serverPort"))
57+
mc.openScreen(OpenBrowserScreen("http://127.0.0.1:$serverPort"))
5758
}
5859
}
5960
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package xyz.bluspring.unitytranslate.util
2+
3+
import net.minecraft.client.Minecraft
4+
import net.minecraft.client.gui.screens.Screen
5+
6+
// need to make sure we actually delay screen opening a little or do things in a different way, otherwise it blurs twice
7+
fun Minecraft.openScreen(screen: Screen?) {
8+
//? if >= 1.21.10 {
9+
/*if (screen == null)
10+
this.setScreen(null)
11+
else
12+
this.setScreenAndShow(screen)
13+
*///?} else {
14+
this.execute { this.setScreen(screen) }
15+
//?}
16+
}

0 commit comments

Comments
 (0)