aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin')
-rw-r--r--src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt1
-rw-r--r--src/main/kotlin/features/items/EtherwarpOverlay.kt3
-rw-r--r--src/main/kotlin/features/macros/RadialMenu.kt6
-rw-r--r--src/main/kotlin/repo/RepoManager.kt32
4 files changed, 30 insertions, 12 deletions
diff --git a/src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt b/src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt
index 5fa57cc..ecf3d2c 100644
--- a/src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt
+++ b/src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt
@@ -41,6 +41,7 @@ import moe.nea.firmament.util.unformattedString
class LegacyItemExporter private constructor(var itemStack: ItemStack) {
init {
require(!itemStack.isEmpty)
+ itemStack.count = 1
}
var lore = itemStack.loreAccordingToNbt
diff --git a/src/main/kotlin/features/items/EtherwarpOverlay.kt b/src/main/kotlin/features/items/EtherwarpOverlay.kt
index b1f695a..f6ab1a2 100644
--- a/src/main/kotlin/features/items/EtherwarpOverlay.kt
+++ b/src/main/kotlin/features/items/EtherwarpOverlay.kt
@@ -19,6 +19,7 @@ object EtherwarpOverlay : FirmamentFeature {
object TConfig : ManagedConfig(identifier, Category.ITEMS) {
var etherwarpOverlay by toggle("etherwarp-overlay") { false }
+ var onlyShowWhileSneaking by toggle("only-show-while-sneaking") { true }
var cube by toggle("cube") { true }
val cubeColour by colour("cube-colour") { ChromaColour.fromStaticRGB(172, 0, 255, 60) }
var wireframe by toggle("wireframe") { false }
@@ -32,7 +33,7 @@ object EtherwarpOverlay : FirmamentFeature {
fun renderEtherwarpOverlay(event: WorldRenderLastEvent) {
if (!TConfig.etherwarpOverlay) return
val player = MC.player ?: return
- if (!player.isSneaking) return
+ if (TConfig.onlyShowWhileSneaking && !player.isSneaking) return
val world = player.world
val camera = MC.camera ?: return
val heldItem = MC.stackInHand
diff --git a/src/main/kotlin/features/macros/RadialMenu.kt b/src/main/kotlin/features/macros/RadialMenu.kt
index 2e09c44..9e5222f 100644
--- a/src/main/kotlin/features/macros/RadialMenu.kt
+++ b/src/main/kotlin/features/macros/RadialMenu.kt
@@ -36,7 +36,11 @@ object RadialMenuViewer {
var activeMenu: RadialMenu? = null
set(value) {
- field = value
+ if (value?.options.isNullOrEmpty()) {
+ field = null
+ } else {
+ field = value
+ }
delta = Vector2f(0F, 0F)
}
var delta = Vector2f(0F, 0F)
diff --git a/src/main/kotlin/repo/RepoManager.kt b/src/main/kotlin/repo/RepoManager.kt
index df89092..c3d1c52 100644
--- a/src/main/kotlin/repo/RepoManager.kt
+++ b/src/main/kotlin/repo/RepoManager.kt
@@ -7,7 +7,9 @@ import io.github.moulberry.repo.data.NEURecipe
import io.github.moulberry.repo.data.Rarity
import java.nio.file.Path
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
+import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
+import kotlinx.coroutines.withContext
import net.minecraft.client.MinecraftClient
import net.minecraft.network.packet.s2c.play.SynchronizeRecipesS2CPacket
import net.minecraft.recipe.display.CuttingRecipeDisplay
@@ -35,11 +37,13 @@ object RepoManager {
branch = "master"
save()
}
-
+ val enableREI by toggle("enable-rei") { true }
val disableItemGroups by toggle("disable-item-groups") { true }
val reload by button("reload") {
save()
- RepoManager.reload()
+ Firmament.coroutineScope.launch {
+ RepoManager.reload()
+ }
}
val redownload by button("redownload") {
save()
@@ -56,6 +60,9 @@ object RepoManager {
RENDER_AND_TEXT("text"),
;
+ fun rendersPerfectText() = this == RENDER_AND_TEXT
+ fun rendersPerfectVisuals() = this == RENDER || this == RENDER_AND_TEXT
+
override fun asString(): String? = label
}
@@ -131,16 +138,17 @@ object RepoManager {
fun reloadForTest(from: Path) {
neuRepo = makeNEURepository(from)
- reload()
+ reloadSync()
}
- fun reload() {
- if (!TestUtil.isInTest && !MC.instance.isOnThread) {
- MC.instance.send {
- reload()
- }
- return
+
+ suspend fun reload() {
+ withContext(Dispatchers.IO) {
+ reloadSync()
}
+ }
+
+ fun reloadSync() {
try {
logger.info("Repo reload started.")
neuRepo.reload()
@@ -168,7 +176,9 @@ object RepoManager {
if (Config.autoUpdate) {
launchAsyncUpdate()
} else {
- reload()
+ Firmament.coroutineScope.launch {
+ reload()
+ }
}
}
@@ -196,4 +206,6 @@ object RepoManager {
fun getRepoRef(): String {
return "${Config.username}/${Config.reponame}#${Config.branch}"
}
+
+ fun shouldLoadREI(): Boolean = Config.enableREI
}