aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/kotlin/dulkirmod/DulkirMod.kt4
-rw-r--r--src/main/kotlin/dulkirmod/config/Config.kt8
-rw-r--r--src/main/kotlin/dulkirmod/features/AlarmClock.kt5
-rw-r--r--src/main/kotlin/dulkirmod/features/BrokenHypeNotif.kt68
-rw-r--r--src/main/kotlin/dulkirmod/features/NametagCleaner.kt2
-rw-r--r--src/main/kotlin/dulkirmod/utils/TitleUtils.kt1
-rw-r--r--src/main/kotlin/dulkirmod/utils/Utils.kt4
7 files changed, 86 insertions, 6 deletions
diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt
index 2f8c16e..c6aa4ab 100644
--- a/src/main/kotlin/dulkirmod/DulkirMod.kt
+++ b/src/main/kotlin/dulkirmod/DulkirMod.kt
@@ -5,6 +5,7 @@ import dulkirmod.config.Config
import dulkirmod.events.ChatEvent
import dulkirmod.features.NametagCleaner
import dulkirmod.features.alarmClock
+import dulkirmod.features.brokenHypeNotif
import dulkirmod.utils.TitleUtils
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@@ -87,6 +88,7 @@ class DulkirMod {
if (longupdate) {
// EXECUTE STUFF HERE THAT DOESN'T REALLY NEED TO BE RUN EVERY TICK
alarmClock()
+ brokenHypeNotif()
longupdate = false
}
}
@@ -99,7 +101,7 @@ class DulkirMod {
companion object {
const val MOD_ID = "dulkirmod"
const val MOD_NAME = "Dulkir Mod"
- const val MOD_VERSION = "1.0.4"
+ const val MOD_VERSION = "1.0.5"
const val CHAT_PREFIX = "<DulkirMod>"
val mc: Minecraft = Minecraft.getMinecraft()
diff --git a/src/main/kotlin/dulkirmod/config/Config.kt b/src/main/kotlin/dulkirmod/config/Config.kt
index 2bb1de7..b554bbb 100644
--- a/src/main/kotlin/dulkirmod/config/Config.kt
+++ b/src/main/kotlin/dulkirmod/config/Config.kt
@@ -300,6 +300,14 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so
var notifyZombieVillager = false
@Property(
+ type = PropertyType.SWITCH,
+ name = "Broken Hype Notification",
+ description = "Tells you if you are no longer getting bestiary! Requires champion and book of stats on your item. LEAVE OFF IF FISHING.",
+ category = "Bestiary"
+ )
+ var notifyHype = false
+
+ @Property(
type = PropertyType.SELECTOR,
name = "Bestiary Notification Color",
description = "Changes color of title notification",
diff --git a/src/main/kotlin/dulkirmod/features/AlarmClock.kt b/src/main/kotlin/dulkirmod/features/AlarmClock.kt
index 9c46a08..8dd0a32 100644
--- a/src/main/kotlin/dulkirmod/features/AlarmClock.kt
+++ b/src/main/kotlin/dulkirmod/features/AlarmClock.kt
@@ -6,7 +6,6 @@ import dulkirmod.config.Config
import dulkirmod.utils.Utils
import net.minecraft.scoreboard.Score
import net.minecraft.scoreboard.ScorePlayerTeam
-import net.minecraft.util.EnumChatFormatting
var lastUpdate : Long = 0
@@ -29,7 +28,7 @@ fun alarmClock() {
// ZOMBIE VILLAGER
if (Config.notifyZombieVillager && l.contains("8:00pm") && (currTime - lastUpdate) > 15000) {
lastUpdate = currTime
- val color = if (Config.bestiaryNotifColor == 16) "§z" else EnumChatFormatting.values()[Config.bestiaryNotifColor]
+ val color = Utils.getColorString(Config.bestiaryNotifColor)
DulkirMod.titleUtils.drawStringForTime("${color}Zombie Villager", 5000)
if (Config.bestiaryAlertSounds)
mc.thePlayer.playSound("mob.villager.yes", 1f * Config.bestiaryNotifVol, 0f)
@@ -37,7 +36,7 @@ fun alarmClock() {
// GHASTS
else if (Config.notifyGhast && l.contains("9:00pm") && (currTime - lastUpdate) > 15000) {
lastUpdate = currTime
- val color = if (Config.bestiaryNotifColor == 16) "§z" else EnumChatFormatting.values()[Config.bestiaryNotifColor]
+ val color = Utils.getColorString(Config.bestiaryNotifColor)
DulkirMod.titleUtils.drawStringForTime("${color}Ghast", 5000)
if (Config.bestiaryAlertSounds)
mc.thePlayer.playSound("mob.ghast.scream", 1f * Config.bestiaryNotifVol, 1f)
diff --git a/src/main/kotlin/dulkirmod/features/BrokenHypeNotif.kt b/src/main/kotlin/dulkirmod/features/BrokenHypeNotif.kt
new file mode 100644
index 0000000..b748f8b
--- /dev/null
+++ b/src/main/kotlin/dulkirmod/features/BrokenHypeNotif.kt
@@ -0,0 +1,68 @@
+package dulkirmod.features
+
+import dulkirmod.DulkirMod
+import dulkirmod.DulkirMod.Companion.mc
+import dulkirmod.config.Config
+import dulkirmod.utils.Utils
+import net.minecraft.item.ItemStack
+import net.minecraft.nbt.NBTTagCompound
+
+var oldKill = -1
+var oldChampionXp = -1
+var oldID = ""
+
+fun brokenHypeNotif() {
+ if (!Config.notifyHype) return;
+
+ var kill = -1
+ var championXp = -1
+ var id = ""
+
+ if (mc.thePlayer == null) return
+
+ val stack: ItemStack = mc.thePlayer.heldItem?: return
+
+ // get info about held item
+ if (stack.hasTagCompound()) {
+ val tag: NBTTagCompound = stack.tagCompound
+ if (tag.hasKey("ExtraAttributes", 10)) {
+ val ea: NBTTagCompound = tag.getCompoundTag("ExtraAttributes")
+ if (ea.hasKey("id", 8)) {
+ id = ea.getString("id")
+ }
+ if (ea.hasKey("stats_book", 99)) {
+ kill = ea.getInteger("stats_book")
+ }
+ if (ea.hasKey("champion_combat_xp", 99)) {
+ championXp = ea.getDouble("champion_combat_xp").toInt()
+ }
+ }
+ }
+
+ // check if same item as previous run
+ if (id == "") {
+ return;
+ } else if (id != oldID) {
+ // Check if this is a valid item for testing whether bestiary is broken.
+ // That is, to be specific, check that it has champion and book of stats.
+ // If it doesn't, don't reset because it can't be used anyway.
+ if (kill == -1 || championXp == -1) {
+ return;
+ }
+ // If we get here this is a new item that is legitimate for testing bugged xp, in theory.
+ oldID = id
+ oldKill = kill
+ oldChampionXp = championXp
+ return;
+ }
+
+ // If this section of the code is reached, then we have the same item, and we can check for updated stats
+ if (oldKill != kill && oldChampionXp == championXp) {
+ mc.thePlayer.playSound("random.anvil_land",1f * Config.bestiaryNotifVol,0f)
+ val color = Utils.getColorString(Config.bestiaryNotifColor)
+ DulkirMod.titleUtils.drawStringForTime("${color}Hype Broken", 5000)
+ }
+ // update item regardless of whether it is bugged or not
+ oldKill = kill
+ oldChampionXp = championXp
+}
diff --git a/src/main/kotlin/dulkirmod/features/NametagCleaner.kt b/src/main/kotlin/dulkirmod/features/NametagCleaner.kt
index 234aa6d..6d588c2 100644
--- a/src/main/kotlin/dulkirmod/features/NametagCleaner.kt
+++ b/src/main/kotlin/dulkirmod/features/NametagCleaner.kt
@@ -20,7 +20,7 @@ object NametagCleaner {
|| name.contains("Superboom TNT") || name.contains ("Blessing")) {
mc.theWorld.removeEntity(event.entity)
}
- }
+ }
}
}
}
diff --git a/src/main/kotlin/dulkirmod/utils/TitleUtils.kt b/src/main/kotlin/dulkirmod/utils/TitleUtils.kt
index 52fe793..f289a8c 100644
--- a/src/main/kotlin/dulkirmod/utils/TitleUtils.kt
+++ b/src/main/kotlin/dulkirmod/utils/TitleUtils.kt
@@ -32,5 +32,4 @@ class TitleUtils {
this.endTime = time.toLong() + System.currentTimeMillis()
}
-
} \ No newline at end of file
diff --git a/src/main/kotlin/dulkirmod/utils/Utils.kt b/src/main/kotlin/dulkirmod/utils/Utils.kt
index 95f714b..3aff645 100644
--- a/src/main/kotlin/dulkirmod/utils/Utils.kt
+++ b/src/main/kotlin/dulkirmod/utils/Utils.kt
@@ -66,4 +66,8 @@ object Utils {
}
return false
}
+
+ fun getColorString(int : Int) : String {
+ return if (int == 16) "§z" else EnumChatFormatting.values()[int].toString()
+ }
} \ No newline at end of file