aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/features/fixes
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/features/fixes')
-rw-r--r--src/main/kotlin/features/fixes/CompatibliltyFeatures.kt41
-rw-r--r--src/main/kotlin/features/fixes/Fixes.kt77
2 files changed, 48 insertions, 70 deletions
diff --git a/src/main/kotlin/features/fixes/CompatibliltyFeatures.kt b/src/main/kotlin/features/fixes/CompatibliltyFeatures.kt
deleted file mode 100644
index 76f6ed4..0000000
--- a/src/main/kotlin/features/fixes/CompatibliltyFeatures.kt
+++ /dev/null
@@ -1,41 +0,0 @@
-package moe.nea.firmament.features.fixes
-
-import net.minecraft.particle.ParticleTypes
-import net.minecraft.util.math.Vec3d
-import moe.nea.firmament.annotations.Subscribe
-import moe.nea.firmament.events.ParticleSpawnEvent
-import moe.nea.firmament.features.FirmamentFeature
-import moe.nea.firmament.gui.config.ManagedConfig
-import moe.nea.firmament.util.compatloader.CompatLoader
-
-object CompatibliltyFeatures : FirmamentFeature {
- override val identifier: String
- get() = "compatibility"
-
- object TConfig : ManagedConfig(identifier, Category.INTEGRATIONS) {
- val enhancedExplosions by toggle("explosion-enabled") { false }
- val explosionSize by integer("explosion-power", 10, 50) { 1 }
- }
-
- override val config: ManagedConfig?
- get() = TConfig
-
- interface ExplosiveApiWrapper {
- fun spawnParticle(vec3d: Vec3d, power: Float)
-
- companion object : CompatLoader<ExplosiveApiWrapper>(ExplosiveApiWrapper::class.java)
- }
-
- private val explosiveApiWrapper = ExplosiveApiWrapper.singleInstance
-
- @Subscribe
- fun onExplosion(it: ParticleSpawnEvent) {
- if (TConfig.enhancedExplosions &&
- it.particleEffect.type == ParticleTypes.EXPLOSION_EMITTER &&
- explosiveApiWrapper != null
- ) {
- it.cancel()
- explosiveApiWrapper.spawnParticle(it.position, 2F)
- }
- }
-}
diff --git a/src/main/kotlin/features/fixes/Fixes.kt b/src/main/kotlin/features/fixes/Fixes.kt
index 7030319..ae4abd7 100644
--- a/src/main/kotlin/features/fixes/Fixes.kt
+++ b/src/main/kotlin/features/fixes/Fixes.kt
@@ -1,57 +1,72 @@
package moe.nea.firmament.features.fixes
-import moe.nea.jarvis.api.Point
+import org.joml.Vector2i
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable
-import net.minecraft.client.MinecraftClient
-import net.minecraft.client.option.KeyBinding
-import net.minecraft.text.Text
+import net.minecraft.client.Minecraft
+import net.minecraft.client.KeyMapping
+import net.minecraft.network.chat.Component
import moe.nea.firmament.annotations.Subscribe
import moe.nea.firmament.events.HudRenderEvent
import moe.nea.firmament.events.WorldKeyboardEvent
-import moe.nea.firmament.features.FirmamentFeature
-import moe.nea.firmament.gui.config.ManagedConfig
import moe.nea.firmament.util.MC
+import moe.nea.firmament.util.data.Config
+import moe.nea.firmament.util.data.ManagedConfig
+import moe.nea.firmament.util.tr
-object Fixes : FirmamentFeature {
- override val identifier: String
+object Fixes {
+ val identifier: String
get() = "fixes"
+ @Config
object TConfig : ManagedConfig(identifier, Category.MISC) { // TODO: split this config
val fixUnsignedPlayerSkins by toggle("player-skins") { true }
var autoSprint by toggle("auto-sprint") { false }
val autoSprintKeyBinding by keyBindingWithDefaultUnbound("auto-sprint-keybinding")
- val autoSprintHud by position("auto-sprint-hud", 80, 10) { Point(0.0, 1.0) }
+ val autoSprintUnderWater by toggle("auto-sprint-underwater") { true }
+ var autoSprintHudToggle by toggle("auto-sprint-hud-toggle") { true }
+ val autoSprintHud by position("auto-sprint-hud", 80, 10) { Vector2i() }
val peekChat by keyBindingWithDefaultUnbound("peek-chat")
+ val peekChatScroll by toggle("peek-chat-scroll") { false }
val hidePotionEffects by toggle("hide-mob-effects") { false }
+ val hidePotionEffectsHud by toggle("hide-potion-effects-hud") { false }
+ val noHurtCam by toggle("disable-hurt-cam") { false }
+ val hideSlotHighlights by toggle("hide-slot-highlights") { false }
+ val hideRecipeBook by toggle("hide-recipe-book") { false }
+ val hideOffHand by toggle("hide-off-hand") { false }
}
- override val config: ManagedConfig
- get() = TConfig
-
fun handleIsPressed(
- keyBinding: KeyBinding,
- cir: CallbackInfoReturnable<Boolean>
+ keyBinding: KeyMapping,
+ cir: CallbackInfoReturnable<Boolean>
) {
- if (keyBinding === MinecraftClient.getInstance().options.sprintKey && TConfig.autoSprint && MC.player?.isSprinting != true)
- cir.returnValue = true
+ if (keyBinding !== Minecraft.getInstance().options.keySprint) return
+ if (!TConfig.autoSprint) return
+ val player = MC.player ?: return
+ if (player.isSprinting) return
+ if (!TConfig.autoSprintUnderWater && player.isInWater) return
+ cir.returnValue = true
}
@Subscribe
fun onRenderHud(it: HudRenderEvent) {
- if (!TConfig.autoSprintKeyBinding.isBound) return
- it.context.matrices.push()
- TConfig.autoSprintHud.applyTransformations(it.context.matrices)
- it.context.drawText(
- MC.font, Text.translatable(
- if (TConfig.autoSprint)
- "firmament.fixes.auto-sprint.on"
- else if (MC.player?.isSprinting == true)
- "firmament.fixes.auto-sprint.sprinting"
- else
- "firmament.fixes.auto-sprint.not-sprinting"
- ), 0, 0, -1, false
+ if (!TConfig.autoSprintKeyBinding.isBound || !TConfig.autoSprintHudToggle) return
+ it.context.pose().pushMatrix()
+ TConfig.autoSprintHud.applyTransformations(it.context.pose())
+ it.context.drawString(
+ MC.font, (
+ if (MC.player?.isSprinting == true) {
+ Component.translatable("firmament.fixes.auto-sprint.sprinting")
+ } else if (TConfig.autoSprint) {
+ if (!TConfig.autoSprintUnderWater && MC.player?.isInWater == true)
+ tr("firmament.fixes.auto-sprint.under-water", "In Water")
+ else
+ Component.translatable("firmament.fixes.auto-sprint.on")
+ } else {
+ Component.translatable("firmament.fixes.auto-sprint.not-sprinting")
+ }
+ ), 0, 0, -1, true
)
- it.context.matrices.pop()
+ it.context.pose().popMatrix()
}
@Subscribe
@@ -64,4 +79,8 @@ object Fixes : FirmamentFeature {
fun shouldPeekChat(): Boolean {
return TConfig.peekChat.isPressed(atLeast = true)
}
+
+ fun shouldScrollPeekedChat(): Boolean {
+ return TConfig.peekChatScroll
+ }
}