aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/kotlin/dulkirmod/DulkirMod.kt32
-rw-r--r--src/main/kotlin/dulkirmod/config/Config.kt96
-rw-r--r--src/main/kotlin/dulkirmod/features/AlarmClock.kt47
-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.kt35
-rw-r--r--src/main/kotlin/dulkirmod/utils/Utils.kt18
-rw-r--r--src/main/resources/Minecraftsounds.txt246
8 files changed, 534 insertions, 10 deletions
diff --git a/src/main/kotlin/dulkirmod/DulkirMod.kt b/src/main/kotlin/dulkirmod/DulkirMod.kt
index 265d121..c6aa4ab 100644
--- a/src/main/kotlin/dulkirmod/DulkirMod.kt
+++ b/src/main/kotlin/dulkirmod/DulkirMod.kt
@@ -4,6 +4,9 @@ import dulkirmod.command.*
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
import kotlinx.coroutines.launch
@@ -33,6 +36,7 @@ import kotlin.coroutines.EmptyCoroutineContext
)
class DulkirMod {
+ var lastLongUpdate : Long = 0
@Mod.EventHandler
fun preInit(event: FMLPreInitializationEvent) {
val directory = File(event.modConfigurationDirectory, "dulkirmod")
@@ -55,6 +59,7 @@ class DulkirMod {
MinecraftForge.EVENT_BUS.register(this)
MinecraftForge.EVENT_BUS.register(ChatEvent())
MinecraftForge.EVENT_BUS.register(NametagCleaner)
+ MinecraftForge.EVENT_BUS.register(DulkirMod.titleUtils)
keyBinds.forEach(ClientRegistry::registerKeyBinding)
}
@@ -69,9 +74,23 @@ class DulkirMod {
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
+ if (event.phase == TickEvent.Phase.START && display != null) {
+ mc.displayGuiScreen(display)
+ display = null
+ }
+
+ var longupdate = false
+ val currTime : Long = System.currentTimeMillis()
+ if (currTime - lastLongUpdate > 1000) {
+ longupdate = true
+ lastLongUpdate = currTime
+ }
+ if (longupdate) {
+ // EXECUTE STUFF HERE THAT DOESN'T REALLY NEED TO BE RUN EVERY TICK
+ alarmClock()
+ brokenHypeNotif()
+ longupdate = false
+ }
}
@SubscribeEvent
@@ -82,21 +101,18 @@ 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()
var config = Config
var display: GuiScreen? = null
val scope = CoroutineScope(EmptyCoroutineContext)
+ val titleUtils = TitleUtils()
val keyBinds = arrayOf(
KeyBinding("Open Settings", Keyboard.KEY_RSHIFT, "Dulkir Mod"),
)
}
-
- // terminal throttle code
-
-
}
diff --git a/src/main/kotlin/dulkirmod/config/Config.kt b/src/main/kotlin/dulkirmod/config/Config.kt
index da017c0..b554bbb 100644
--- a/src/main/kotlin/dulkirmod/config/Config.kt
+++ b/src/main/kotlin/dulkirmod/config/Config.kt
@@ -283,7 +283,103 @@ object Config : Vigilant(File("./config/dulkirmod/config.toml"), "DulkirMod", so
)
var bridgeColor = 6
+ @Property(
+ type = PropertyType.SWITCH,
+ name = "Ghast Notification",
+ description = "Shows a title at 9:00pm for bestiary",
+ category = "Bestiary"
+ )
+ var notifyGhast = false
+
+ @Property(
+ type = PropertyType.SWITCH,
+ name = "Zombie Villager Notification",
+ description = "Shows a title at 8:00pm for bestiary",
+ category = "Bestiary"
+ )
+ 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",
+ category = "Bestiary",
+ options = ["§0Black",
+ "§1Dark Blue",
+ "§2Dark Green",
+ "§3Dark Aqua",
+ "§4Dark Red",
+ "§5Dark Purple",
+ "§6Gold",
+ "§7Gray",
+ "§8Dark Gray",
+ "§9Blue",
+ "§aGreen",
+ "§bAqua",
+ "§cRed",
+ "§dLight Purple",
+ "§eYellow",
+ "§fWhite",
+ "§zSBA Chroma"
+ ]
+ )
+ var bestiaryNotifColor = 15
+
+ @Property(
+ type = PropertyType.SWITCH,
+ name = "Text Shadow",
+ description = "Shows text shadow for notification",
+ category = "Bestiary"
+ )
+ var bestiaryTextShadow = false
+
+ @Property(
+ type = PropertyType.DECIMAL_SLIDER,
+ name = "Scale",
+ description = "Size of notification!",
+ category = "Bestiary",
+ minF = 0f,
+ maxF = 1f,
+ decimalPlaces = 1
+ )
+ var bestiaryNotifSize = .7f
+
+ @Property(
+ type = PropertyType.SWITCH,
+ name = "Alert Noises",
+ description = "Uses relevant mob sounds, doesn't override audio/patcher settings",
+ category = "Bestiary"
+ )
+ var bestiaryAlertSounds = false
+
+ @Property(
+ type = PropertyType.DECIMAL_SLIDER,
+ name = "Alert Volume",
+ description = "Volume of notification!",
+ category = "Bestiary",
+ minF = 0f,
+ maxF = 1f,
+ decimalPlaces = 1
+ )
+ var bestiaryNotifVol = .7f
+
+ @Property(
+ type = PropertyType.BUTTON,
+ name = "Demo Volume Selection",
+ description = "Plays the Ghast Noise as Reference, Might add individual sliders later but this seems like enough",
+ category = "Bestiary"
+ )
+ fun demoVolume() {
+ DulkirMod.mc.thePlayer.playSound("mob.ghast.scream", 1f * Config.bestiaryNotifVol, 1f)
+ }
fun init() {
initialize()
addDependency("customMessage", "throttleNotifier")
diff --git a/src/main/kotlin/dulkirmod/features/AlarmClock.kt b/src/main/kotlin/dulkirmod/features/AlarmClock.kt
new file mode 100644
index 0000000..8dd0a32
--- /dev/null
+++ b/src/main/kotlin/dulkirmod/features/AlarmClock.kt
@@ -0,0 +1,47 @@
+package dulkirmod.features
+
+import dulkirmod.DulkirMod
+import dulkirmod.DulkirMod.Companion.mc
+import dulkirmod.config.Config
+import dulkirmod.utils.Utils
+import net.minecraft.scoreboard.Score
+import net.minecraft.scoreboard.ScorePlayerTeam
+
+var lastUpdate : Long = 0
+
+fun alarmClock() {
+ // CHECK IF IN SKYBLOCK
+ if (!Utils.isInSkyblock()) return
+ // CHECK TIME
+ val currTime : Long = System.currentTimeMillis()
+ val scoreboard = mc.thePlayer.worldScoreboard
+ val sidebarObjective = scoreboard.getObjectiveInDisplaySlot(1)
+ val scores: List<Score> = ArrayList(scoreboard.getSortedScores(sidebarObjective))
+ val lines: MutableList<String> = ArrayList()
+ for (i in scores.indices.reversed()) {
+ val score = scores[i]
+ val scoreplayerteam1 = scoreboard.getPlayersTeam(score.playerName)
+ val line = ScorePlayerTeam.formatPlayerName(scoreplayerteam1, score.playerName)
+ lines.add(line)
+ }
+ for (l in lines) {
+ // ZOMBIE VILLAGER
+ if (Config.notifyZombieVillager && l.contains("8:00pm") && (currTime - lastUpdate) > 15000) {
+ lastUpdate = currTime
+ 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)
+ }
+ // GHASTS
+ else if (Config.notifyGhast && l.contains("9:00pm") && (currTime - lastUpdate) > 15000) {
+ lastUpdate = currTime
+ 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)
+ }
+
+ }
+
+} \ No newline at end of file
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
new file mode 100644
index 0000000..f289a8c
--- /dev/null
+++ b/src/main/kotlin/dulkirmod/utils/TitleUtils.kt
@@ -0,0 +1,35 @@
+package dulkirmod.utils
+
+import dulkirmod.DulkirMod.Companion.mc
+import dulkirmod.config.Config
+import net.minecraft.client.gui.ScaledResolution
+import net.minecraft.client.renderer.GlStateManager
+import net.minecraftforge.client.event.RenderGameOverlayEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import kotlin.math.min
+
+class TitleUtils {
+ var curString = ""
+ var endTime : Long = 0
+
+ @SubscribeEvent
+ fun onRender(event: RenderGameOverlayEvent.Text) {
+ if (System.currentTimeMillis() > endTime) return
+ val width = mc.fontRendererObj.getStringWidth(curString)
+ val screenWidth = ScaledResolution(mc).scaledWidth_double
+ val screenHeight = ScaledResolution(mc).scaledHeight_double
+ var scale = ((screenWidth - 100) * Config.bestiaryNotifSize) / width
+ scale = min(scale, 10.0)
+ GlStateManager.pushMatrix()
+ GlStateManager.translate((screenWidth / 2 - width * scale / 2), screenHeight/2 - (4.5 * scale), 0.0)
+ GlStateManager.scale(scale, scale, scale)
+ mc.fontRendererObj.drawString(curString, 0f, 0f, 0, Config.bestiaryTextShadow)
+ GlStateManager.popMatrix()
+ }
+
+ fun drawStringForTime(string : String, time : Int) {
+ this.curString = string
+ 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 c3caa26..3aff645 100644
--- a/src/main/kotlin/dulkirmod/utils/Utils.kt
+++ b/src/main/kotlin/dulkirmod/utils/Utils.kt
@@ -9,7 +9,6 @@ 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 {
@@ -54,4 +53,21 @@ object Utils {
}
mc.displayGuiScreen(null)
}
+
+ fun isInSkyblock() : Boolean{
+ if ((mc.theWorld != null) && (mc.thePlayer != null)) {
+ if (mc.isSingleplayer || mc.thePlayer.clientBrand == null ||
+ !mc.thePlayer.clientBrand.lowercase(Locale.getDefault()).contains("hypixel")) {
+ return false
+ }
+ if (mc.thePlayer.worldScoreboard.getObjectiveInDisplaySlot(1) == null)
+ return false;
+ return stripColorCodes(mc.thePlayer.worldScoreboard.getObjectiveInDisplaySlot(1).displayName).contains("SKYBLOCK")
+ }
+ return false
+ }
+
+ fun getColorString(int : Int) : String {
+ return if (int == 16) "§z" else EnumChatFormatting.values()[int].toString()
+ }
} \ No newline at end of file
diff --git a/src/main/resources/Minecraftsounds.txt b/src/main/resources/Minecraftsounds.txt
new file mode 100644
index 0000000..64b010f
--- /dev/null
+++ b/src/main/resources/Minecraftsounds.txt
@@ -0,0 +1,246 @@
+ambient.cave.cave
+ambient.weather.rain
+ambient.weather.thunder
+game.player.hurt.fall.big
+game.neutral.hurt.fall.big
+game.hostile.hurt.fall.big
+game.player.hurt.fall.small
+game.neutral.hurt.fall.small
+game.hostile.hurt.fall.small
+game.player.hurt
+game.neutral.hurt
+game.hostile.hurt
+game.player.die
+game.neutral.die
+game.hostile.die
+dig.cloth
+dig.glass
+game.potion.smash
+dig.grass
+dig.gravel
+dig.sand
+dig.snow
+dig.stone
+dig.wood
+fire.fire
+fire.ignite
+item.fireCharge.use
+fireworks.blast
+fireworks.blast_far
+fireworks.largeBlast
+fireworks.largeBlast_far
+fireworks.launch
+fireworks.twinkle
+fireworks.twinkle_far
+game.player.swim.splash
+game.neutral.swim.splash
+game.hostile.swim.splash
+game.player.swim
+game.neutral.swim
+game.hostile.swim
+liquid.lava
+liquid.lavapop
+liquid.water
+minecart.base
+minecart.inside
+note.bass
+note.bassattack
+note.bd
+note.harp
+note.hat
+note.pling
+note.snare
+portal.portal
+portal.travel
+portal.trigger
+random.anvil_break
+random.anvil_land
+random.anvil_use
+random.bow
+random.bowhit
+random.break
+random.burp
+random.chestclosed
+random.chestopen
+gui.button.press
+random.click
+random.door_open
+random.door_close
+random.drink
+random.eat
+random.explode
+random.fizz
+game.tnt.primed
+creeper.primed
+random.levelup
+random.orb
+random.pop
+random.splash
+random.successful_hit
+random.wood_click
+step.cloth
+step.grass
+step.gravel
+step.ladder
+step.sand
+step.snow
+step.stone
+step.wood
+tile.piston.in
+tile.piston.out
+mob.bat.death
+mob.bat.hurt
+mob.bat.idle
+mob.bat.loop
+mob.bat.takeoff
+mob.blaze.breathe
+mob.blaze.death
+mob.blaze.hit
+mob.cat.hiss
+mob.cat.hitt
+mob.cat.meow
+mob.cat.purr
+mob.cat.purreow
+mob.chicken.hurt
+mob.chicken.plop
+mob.chicken.say
+mob.chicken.step
+mob.cow.hurt
+mob.cow.say
+mob.cow.step
+mob.creeper.death
+mob.creeper.say
+mob.enderdragon.end
+mob.enderdragon.growl
+mob.enderdragon.hit
+mob.enderdragon.wings
+mob.endermen.death
+mob.endermen.hit
+mob.endermen.idle
+mob.endermen.portal
+mob.endermen.scream
+mob.endermen.stare
+mob.ghast.affectionate_scream
+mob.ghast.charge
+mob.ghast.death
+mob.ghast.fireball
+mob.ghast.moan
+mob.ghast.scream
+mob.guardian.hit
+mob.guardian.idle
+mob.guardian.death
+mob.guardian.elder.hit
+mob.guardian.elder.idle
+mob.guardian.elder.death
+mob.guardian.land.hit
+mob.guardian.land.idle
+mob.guardian.land.death
+mob.guardian.curse
+mob.guardian.attack
+mob.guardian.flop
+mob.horse.angry
+mob.horse.armor
+mob.horse.breathe
+mob.horse.death
+mob.horse.donkey.angry
+mob.horse.donkey.death
+mob.horse.donkey.hit
+mob.horse.donkey.idle
+mob.horse.gallop
+mob.horse.hit
+mob.horse.idle
+mob.horse.jump
+mob.horse.land
+mob.horse.leather
+mob.horse.skeleton.death
+mob.horse.skeleton.hit
+mob.horse.skeleton.idle
+mob.horse.soft
+mob.horse.wood
+mob.horse.zombie.death
+mob.horse.zombie.hit
+mob.horse.zombie.idle
+mob.irongolem.death
+mob.irongolem.hit
+mob.irongolem.throw
+mob.irongolem.walk
+mob.magmacube.big
+mob.magmacube.jump
+mob.magmacube.small
+mob.pig.death
+mob.pig.say
+mob.pig.step
+mob.rabbit.hurt
+mob.rabbit.idle
+mob.rabbit.hop
+mob.rabbit.death
+mob.sheep.say
+mob.sheep.shear
+mob.sheep.step
+mob.silverfish.hit
+mob.silverfish.kill
+mob.silverfish.say
+mob.silverfish.step
+mob.skeleton.death
+mob.skeleton.hurt
+mob.skeleton.say
+mob.skeleton.step
+mob.slime.attack
+mob.slime.big
+mob.slime.small
+mob.spider.death
+mob.spider.say
+mob.spider.step
+mob.villager.death
+mob.villager.haggle
+mob.villager.hit
+mob.villager.idle
+mob.villager.no
+mob.villager.yes
+mob.wither.death
+mob.wither.hurt
+mob.wither.idle
+mob.wither.shoot
+mob.wither.spawn
+mob.wolf.bark
+mob.wolf.death
+mob.wolf.growl
+mob.wolf.howl
+mob.wolf.hurt
+mob.wolf.panting
+mob.wolf.shake
+mob.wolf.step
+mob.wolf.whine
+mob.zombie.death
+mob.zombie.hurt
+mob.zombie.infect
+mob.zombie.metal
+mob.zombie.remedy
+mob.zombie.say
+mob.zombie.step
+mob.zombie.unfect
+mob.zombie.wood
+mob.zombie.woodbreak
+mob.zombiepig.zpig
+mob.zombiepig.zpigangry
+mob.zombiepig.zpigdeath
+mob.zombiepig.zpighurt
+records.11
+records.13
+records.blocks
+records.cat
+records.chirp
+records.far
+records.mall
+records.mellohi
+records.stal
+records.strad
+records.wait
+records.ward
+music.menu
+music.game
+music.game.creative
+music.game.end
+music.game.end.dragon
+music.game.end.credits
+music.game.nether \ No newline at end of file