aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/kotlin/dulkirmod/DulkirMod.kt3
-rw-r--r--src/main/kotlin/dulkirmod/config/Config.kt34
-rw-r--r--src/main/kotlin/dulkirmod/utils/ConfigData.kt19
-rw-r--r--src/main/kotlin/dulkirmod/utils/Utils.kt50
4 files changed, 104 insertions, 2 deletions
diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt
index 2647d9f..d0ea1e5 100644
--- a/src/main/kotlin/dulkirmod/DulkirMod.kt
+++ b/src/main/kotlin/dulkirmod/DulkirMod.kt
@@ -68,6 +68,9 @@ class DulkirMod {
@SubscribeEvent
fun onTick(event: ClientTickEvent) {
+ if (Config.noReverse3rdPerson && mc.gameSettings.thirdPersonView == 2)
+ mc.gameSettings.thirdPersonView = 0
+
if (event.phase != TickEvent.Phase.START || display == null) return
mc.displayGuiScreen(display)
display = null
diff --git a/src/main/kotlin/dulkirmod/config/Config.kt b/src/main/kotlin/dulkirmod/config/Config.kt
index f472ee1..1a50b88 100644
--- a/src/main/kotlin/dulkirmod/config/Config.kt
+++ b/src/main/kotlin/dulkirmod/config/Config.kt
@@ -1,11 +1,13 @@
package dulkirmod.config
+import dulkirmod.DulkirMod
import gg.essential.vigilance.Vigilant
import gg.essential.vigilance.data.Category
import gg.essential.vigilance.data.Property
import gg.essential.vigilance.data.PropertyType
import gg.essential.vigilance.data.SortingBehavior
import dulkirmod.DulkirMod.Companion.display
+import dulkirmod.utils.Utils
import java.awt.Color
import java.io.File
import java.util.function.Consumer
@@ -187,7 +189,7 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so
@Property(
type = PropertyType.BUTTON,
name = "Reset Item Values",
- description = "Will not visually update gui, but reopening settings menu will show default values",
+ description = "Vanilla Look! Closes Settings GUI.",
category = "Animations"
)
fun demoButton() {
@@ -201,9 +203,29 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so
doesScaleSwing = true
ignoreHaste = true
customSpeed = 0f
+ DulkirMod.mc.displayGuiScreen(null)
+ }
+
+ @Property(
+ type = PropertyType.BUTTON,
+ name = "Export Preset as String",
+ description = "Base64 representation of your current config - will copy to clipboard when pressed.",
+ category = "Animations"
+ )
+ fun presetString() {
+ Utils.animationConfigToString()
+ }
+
+ @Property(
+ type = PropertyType.BUTTON,
+ name = "Import Preset from Clipboard",
+ description = "Base64 representation of your config accepted from clipboard. Closes gui.",
+ category = "Animations"
+ )
+ fun stringToConfig() {
+ Utils.animationStringtoConfig()
}
- // CUSTOM ANIMATIONS
@Property(
type = PropertyType.SWITCH,
name = "JoinDungeon Command Confirmation",
@@ -212,6 +234,14 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so
)
var dungeonCommandConfirm = false
+ @Property(
+ type = PropertyType.SWITCH,
+ name = "Remove Selfie Camera",
+ description = "Get rid of pesky reverse third person!",
+ category = "General"
+ )
+ var noReverse3rdPerson = false
+
fun init() {
initialize()
diff --git a/src/main/kotlin/dulkirmod/utils/ConfigData.kt b/src/main/kotlin/dulkirmod/utils/ConfigData.kt
new file mode 100644
index 0000000..213528b
--- /dev/null
+++ b/src/main/kotlin/dulkirmod/utils/ConfigData.kt
@@ -0,0 +1,19 @@
+package dulkirmod.utils
+
+import com.sun.org.apache.xpath.internal.operations.Bool
+import com.typesafe.config.ConfigOrigin
+import dulkirmod.config.Config
+
+data class ConfigData (
+ val size: Float = Config.customSize,
+ val scaleSwing: Boolean = Config.doesScaleSwing,
+ val x: Float = Config.customX,
+ val y: Float = Config.customY,
+ val z: Float = Config.customZ,
+ val yaw: Float = Config.customYaw,
+ val pitch: Float = Config.customPitch,
+ val roll: Float = Config.customRoll,
+ val speed: Float = Config.customSpeed,
+ val ignoreHaste: Boolean = Config.ignoreHaste,
+ val drinkingFix: Int = Config.drinkingSelector
+)
diff --git a/src/main/kotlin/dulkirmod/utils/Utils.kt b/src/main/kotlin/dulkirmod/utils/Utils.kt
index 766a78b..c3caa26 100644
--- a/src/main/kotlin/dulkirmod/utils/Utils.kt
+++ b/src/main/kotlin/dulkirmod/utils/Utils.kt
@@ -1,7 +1,57 @@
package dulkirmod.utils
+import com.google.gson.Gson
+import dulkirmod.DulkirMod.Companion.mc
+import dulkirmod.config.Config
+import net.minecraft.util.ChatComponentText
+import net.minecraft.util.EnumChatFormatting
+import java.awt.Toolkit
+import java.awt.datatransfer.Clipboard
+import java.awt.datatransfer.DataFlavor
+import java.awt.datatransfer.StringSelection
+import java.lang.IllegalArgumentException
+import java.util.*
+
object Utils {
fun stripColorCodes(string: String): String {
return string.replace("ยง.".toRegex(), "")
}
+
+ fun animationConfigToString() {
+ var s = ""
+ var gson = Gson()
+ var jsonString = gson.toJson(ConfigData())
+ s = Base64.getEncoder().encodeToString(jsonString.toByteArray())
+ // set clipboard
+ val selection = StringSelection(s)
+ val clipboard: Clipboard = Toolkit.getDefaultToolkit().systemClipboard
+ clipboard.setContents(selection, selection)
+ }
+
+ fun animationStringtoConfig() {
+ val gson = Gson()
+ val clipboard: Clipboard = Toolkit.getDefaultToolkit().systemClipboard
+ val base64 = clipboard.getData(DataFlavor.stringFlavor) as String
+ try {
+ val jsonString = String(Base64.getDecoder().decode(base64))
+ val import = gson.fromJson(jsonString, ConfigData::class.java)
+ Config.customSize = import.size
+ Config.customSpeed = import.speed
+ Config.doesScaleSwing = import.scaleSwing
+ Config.customX = import.x
+ Config.customY = import.y
+ Config.customZ = import.z
+ Config.customYaw = import.yaw
+ Config.customPitch = import.pitch
+ Config.customRoll = import.roll
+ Config.drinkingSelector = import.drinkingFix
+ Config.ignoreHaste = import.ignoreHaste } catch (e : Exception) {
+ mc.thePlayer.addChatMessage(
+ ChatComponentText(
+ EnumChatFormatting.GOLD.toString() + "" + EnumChatFormatting.BOLD + "Current clipboard is not a recognizable Custom Animation Preset."
+ )
+ )
+ }
+ mc.displayGuiScreen(null)
+ }
} \ No newline at end of file