diff options
Diffstat (limited to 'src/main/kotlin/dulkirmod/features')
-rw-r--r-- | src/main/kotlin/dulkirmod/features/AlarmClock.kt | 5 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/features/BrokenHypeNotif.kt | 68 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/features/NametagCleaner.kt | 2 |
3 files changed, 71 insertions, 4 deletions
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) } - } + } } } } |