Skip to content
This repository was archived by the owner on Dec 30, 2022. It is now read-only.

Commit b544bf7

Browse files
committed
Merged 1.18 into 1.16
Signed-off-by: DeathsGun <deathsgun@protonmail.com>
1 parent 8a44070 commit b544bf7

File tree

4 files changed

+9
-13
lines changed

4 files changed

+9
-13
lines changed

src/main/kotlin/xyz/deathsgun/modmanager/gui/ModsOverviewScreen.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class ModsOverviewScreen(private val previousScreen: Screen) : Screen(LiteralTex
8585
updateAll = addButton(
8686
ButtonWidget(width - 100 - 10, 10, 100, 20, TranslatableText("modmanager.button.updateAll")) {
8787
ModManager.modManager.icons.destroyAll()
88-
client?.setScreen(UpdateAllScreen(this))
88+
client?.openScreen(UpdateAllScreen(this))
8989
}
9090
)
9191
updateAll.visible = false

src/main/kotlin/xyz/deathsgun/modmanager/gui/UpdateAllScreen.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class UpdateAllScreen(private val parentScreen: Screen) : Screen(TranslatableTex
3131
this
3232
)
3333
updateList.setLeftPos(25)
34-
doneButton = addDrawableChild(ButtonWidget(width / 2 - 100, height - 30, 200, 20, ScreenTexts.DONE) {
34+
doneButton = addButton(ButtonWidget(width / 2 - 100, height - 30, 200, 20, ScreenTexts.DONE) {
3535
onClose()
3636
})
3737
doneButton.active = false
@@ -72,7 +72,7 @@ class UpdateAllScreen(private val parentScreen: Screen) : Screen(TranslatableTex
7272
}
7373

7474
override fun onClose() {
75-
client?.setScreen(parentScreen)
75+
client?.openScreen(parentScreen)
7676
}
7777

7878
override fun <E> updateSelectedEntry(widget: Any, entry: E?) {

src/main/kotlin/xyz/deathsgun/modmanager/gui/widget/UpdateProgressListEntry.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import net.minecraft.client.MinecraftClient
88
import net.minecraft.client.gui.DrawableHelper
99
import net.minecraft.client.gui.screen.ScreenTexts
1010
import net.minecraft.client.util.math.MatrixStack
11-
import net.minecraft.text.LiteralText
12-
import net.minecraft.text.Text
1311
import xyz.deathsgun.modmanager.ModManager
1412
import xyz.deathsgun.modmanager.api.gui.list.ListWidget
1513
import xyz.deathsgun.modmanager.update.ProgressListener
@@ -76,8 +74,4 @@ class UpdateProgressListEntry(list: ListWidget<UpdateProgressListEntry>, val upd
7674
DrawableHelper.fill(matrices, minX, minY, minX + 1, maxY, color)
7775
DrawableHelper.fill(matrices, maxX, minY, maxX - 1, maxY, color)
7876
}
79-
80-
override fun getNarration(): Text {
81-
return LiteralText.EMPTY
82-
}
8377
}

src/main/kotlin/xyz/deathsgun/modmanager/icon/IconCache.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,12 @@ import net.minecraft.client.texture.NativeImageBackedTexture
2626
import net.minecraft.util.Identifier
2727
import org.apache.commons.io.FileUtils
2828
import org.apache.http.client.methods.HttpGet
29-
import org.apache.http.impl.client.CloseableHttpClient
30-
import org.apache.http.impl.client.HttpClients
3129
import org.apache.logging.log4j.LogManager
3230
import xyz.deathsgun.modmanager.ModManager
3331
import xyz.deathsgun.modmanager.api.http.HttpClient
3432
import xyz.deathsgun.modmanager.api.mod.Mod
35-
import java.net.URI
3633
import java.nio.file.Files
34+
import java.nio.file.StandardCopyOption
3735
import java.util.stream.Collectors
3836

3937
class IconCache {
@@ -96,7 +94,11 @@ class IconCache {
9694
try {
9795
val request = HttpGet(mod.iconUrl)
9896
request.setHeader("User-Agent", "ModManager ${ModManager.getVersion()}")
99-
Files.copy(HttpClient.getInputStream(mod.iconUrl), iconsDir.resolve(mod.id))
97+
Files.copy(
98+
HttpClient.getInputStream(mod.iconUrl),
99+
iconsDir.resolve(mod.id),
100+
StandardCopyOption.REPLACE_EXISTING
101+
)
100102
state[mod.id] = IconState.DOWNLOADED
101103
} catch (e: Exception) {
102104
if (e is HttpClient.InvalidStatusCodeException) {

0 commit comments

Comments
 (0)