diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-11-01 13:42:42 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-11-01 13:42:42 +0100 |
commit | 4b765d176b23df052ebdad4b45c480ffe904e4de (patch) | |
tree | f72cea5d2374a34423aad32fb12dc082147125e3 /src/main/kotlin/dulkirmod/features | |
parent | 5ded107137a04fdbdfa718436a016af98cadd28e (diff) | |
download | DulkirMod-4b765d176b23df052ebdad4b45c480ffe904e4de.tar.gz DulkirMod-4b765d176b23df052ebdad4b45c480ffe904e4de.tar.bz2 DulkirMod-4b765d176b23df052ebdad4b45c480ffe904e4de.zip |
kotlin reformat
Diffstat (limited to 'src/main/kotlin/dulkirmod/features')
10 files changed, 44 insertions, 36 deletions
diff --git a/src/main/kotlin/dulkirmod/features/AlarmClock.kt b/src/main/kotlin/dulkirmod/features/AlarmClock.kt index 075f106..0d3f51c 100644 --- a/src/main/kotlin/dulkirmod/features/AlarmClock.kt +++ b/src/main/kotlin/dulkirmod/features/AlarmClock.kt @@ -6,13 +6,13 @@ import dulkirmod.config.Config import dulkirmod.utils.ScoreBoardUtils import dulkirmod.utils.Utils -var lastUpdate : Long = 0 +var lastUpdate: Long = 0 fun alarmClock() { // CHECK IF IN SKYBLOCK if (!Utils.isInSkyblock()) return // CHECK TIME - val currTime : Long = System.currentTimeMillis() + val currTime: Long = System.currentTimeMillis() val lines = ScoreBoardUtils.getLines() for (l in lines) { // ZOMBIE VILLAGER diff --git a/src/main/kotlin/dulkirmod/features/ArachneTimer.kt b/src/main/kotlin/dulkirmod/features/ArachneTimer.kt index d5334ba..4e4ae66 100644 --- a/src/main/kotlin/dulkirmod/features/ArachneTimer.kt +++ b/src/main/kotlin/dulkirmod/features/ArachneTimer.kt @@ -13,15 +13,15 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ArachneTimer { - private var startmillis : Long = -1 - private var endmillis : Long = -1 - private var spawnmillis : Long = -1 + private var startmillis: Long = -1 + private var endmillis: Long = -1 + private var spawnmillis: Long = -1 @SubscribeEvent(receiveCanceled = true, priority = EventPriority.LOW) fun onChat(event: ClientChatReceivedEvent) { if (!Config.arachneKillTimer) return - var killtime : Float = -1f; + var killtime: Float = -1f; if (event.type == 2.toByte()) { return @@ -30,8 +30,7 @@ class ArachneTimer { val unformatted = Utils.stripColorCodes(event.message.unformattedText) if (unformatted == "[BOSS] Arachne: You dare to call me, the queen of the dark, to you. I'll accept no excuses, you shall die!") { startmillis = System.currentTimeMillis() - } - else if (unformatted.startsWith('☄') && unformatted.contains("Something is awakening!")) { + } else if (unformatted.startsWith('☄') && unformatted.contains("Something is awakening!")) { spawnmillis = System.currentTimeMillis() } @@ -46,13 +45,14 @@ class ArachneTimer { } } } + @SubscribeEvent fun onWorldRenderLast(event: RenderWorldLastEvent) { if (!Config.arachneSpawnTimer) return if (spawnmillis > startmillis) { val color = Utils.getColorString(Config.bestiaryNotifColor) - var time = 18 - (System.currentTimeMillis() - spawnmillis)/1000 + var time = 18 - (System.currentTimeMillis() - spawnmillis) / 1000 if (time < 0) time = 0 WorldRenderUtils.render(Vec3(-282.5, 50.8, -178.5), "${color}${time}") } diff --git a/src/main/kotlin/dulkirmod/features/BrokenHypeNotif.kt b/src/main/kotlin/dulkirmod/features/BrokenHypeNotif.kt index d516fcf..adb8edc 100644 --- a/src/main/kotlin/dulkirmod/features/BrokenHypeNotif.kt +++ b/src/main/kotlin/dulkirmod/features/BrokenHypeNotif.kt @@ -20,7 +20,7 @@ fun brokenHypeNotif() { if (mc.thePlayer == null) return - val stack: ItemStack = mc.thePlayer.heldItem?: return + val stack: ItemStack = mc.thePlayer.heldItem ?: return // get info about held item if (stack.hasTagCompound()) { @@ -58,7 +58,7 @@ fun brokenHypeNotif() { // 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) + mc.thePlayer.playSound("random.anvil_land", 1f * Config.bestiaryNotifVol, 0f) val color = Utils.getColorString(Config.bestiaryNotifColor) DulkirMod.titleUtils.drawStringForTime("${color}Hype Broken", 5000) } diff --git a/src/main/kotlin/dulkirmod/features/Croesus.kt b/src/main/kotlin/dulkirmod/features/Croesus.kt index 8302167..e38616c 100644 --- a/src/main/kotlin/dulkirmod/features/Croesus.kt +++ b/src/main/kotlin/dulkirmod/features/Croesus.kt @@ -11,7 +11,8 @@ import net.minecraftforge.fml.common.gameevent.TickEvent class Croesus { - var lastGuiOpenEvent : Long = 0 + var lastGuiOpenEvent: Long = 0 + @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { val lastInCroesus = inCroesusBool @@ -29,7 +30,7 @@ class Croesus { if (inCroesusBool && System.currentTimeMillis() - lastGuiOpenEvent < 300) { for (i in 9..44) { - boolArray[i-9] = false + boolArray[i - 9] = false val slotIn = mc.thePlayer.openContainer.getSlot(i) if (slotIn.stack == null) continue @@ -38,14 +39,15 @@ class Croesus { val tagList: NBTTagList = stack.getSubCompound("display", true).getTagList("Lore", 8) for (j in 0 until tagList.tagCount()) { - if (tagList.getStringTagAt(j) == "§aChests have been opened!") boolArray[i-9] = true + if (tagList.getStringTagAt(j) == "§aChests have been opened!") boolArray[i - 9] = true } } } } + companion object { - var inCroesusBool : Boolean = false - var boolArray = BooleanArray(36) {false} + var inCroesusBool: Boolean = false + var boolArray = BooleanArray(36) { false } fun inCroesus(): Boolean { return inCroesusBool @@ -53,7 +55,7 @@ class Croesus { fun isChestOpened(slotIn: Slot): Boolean { if (!inCroesusBool) return false - if(slotIn.inventory == mc.thePlayer.inventory) return false + if (slotIn.inventory == mc.thePlayer.inventory) return false val slotindex = slotIn.slotIndex if (slotindex !in 9..44) return false return boolArray[slotindex - 9] diff --git a/src/main/kotlin/dulkirmod/features/DungeonLeap.kt b/src/main/kotlin/dulkirmod/features/DungeonLeap.kt index b8ce75e..91e85f7 100644 --- a/src/main/kotlin/dulkirmod/features/DungeonLeap.kt +++ b/src/main/kotlin/dulkirmod/features/DungeonLeap.kt @@ -13,7 +13,8 @@ import net.minecraftforge.fml.common.gameevent.TickEvent class DungeonLeap { - private var lastGuiOpenEvent : Long = 0 + private var lastGuiOpenEvent: Long = 0 + @SubscribeEvent fun onTick(event: TickEvent.ClientTickEvent) { val lastInLeap = inLeapMenuBool @@ -31,18 +32,19 @@ class DungeonLeap { if (inLeapMenuBool && System.currentTimeMillis() - lastGuiOpenEvent < 300) { for (i in 11..15) { - boolArray[i-11] = false + boolArray[i - 11] = false val slotIn = DulkirMod.mc.thePlayer.openContainer.getSlot(i) if (slotIn.stack == null) continue val stack = slotIn.stack - if (Utils.stripColorCodes(stack.displayName) == Config.highlightLeapName) boolArray[i-11] = true + if (Utils.stripColorCodes(stack.displayName) == Config.highlightLeapName) boolArray[i - 11] = true } } } + companion object { - var inLeapMenuBool : Boolean = false - var boolArray = BooleanArray(5) {false} + var inLeapMenuBool: Boolean = false + var boolArray = BooleanArray(5) { false } fun inLeapMenu(): Boolean { return inLeapMenuBool @@ -50,7 +52,7 @@ class DungeonLeap { fun isHighlightedLeapPlayer(slotIn: Slot): Boolean { if (!inLeapMenuBool) return false - if(slotIn.inventory == mc.thePlayer.inventory) return false + if (slotIn.inventory == mc.thePlayer.inventory) return false val slotIndex = slotIn.slotIndex if (slotIndex !in 11..15) return false return boolArray[slotIndex - 11] diff --git a/src/main/kotlin/dulkirmod/features/ItemAnimations.kt b/src/main/kotlin/dulkirmod/features/ItemAnimations.kt index a86e947..7e9b85d 100644 --- a/src/main/kotlin/dulkirmod/features/ItemAnimations.kt +++ b/src/main/kotlin/dulkirmod/features/ItemAnimations.kt @@ -66,7 +66,7 @@ object ItemAnimations { * Directly referenced by the ItemRendereMixin. If enabled will scale the potion drink animation. * Returns whether custom animation was performed. */ - fun rotationlessDrink(clientPlayer : AbstractClientPlayer, partialTicks : Float): Boolean { + fun rotationlessDrink(clientPlayer: AbstractClientPlayer, partialTicks: Float): Boolean { if (!config.customAnimations || config.drinkingSelector != 1) return false val f: Float = clientPlayer.itemInUseCount.toFloat() - partialTicks + 1.0f val f1: Float = f / mc.thePlayer.heldItem.maxItemUseDuration.toFloat() diff --git a/src/main/kotlin/dulkirmod/features/NametagCleaner.kt b/src/main/kotlin/dulkirmod/features/NametagCleaner.kt index f198251..b847bf1 100644 --- a/src/main/kotlin/dulkirmod/features/NametagCleaner.kt +++ b/src/main/kotlin/dulkirmod/features/NametagCleaner.kt @@ -14,17 +14,18 @@ object NametagCleaner { @SubscribeEvent fun onRenderLivingPre(event: RenderLivingEvent.Pre<*>) { if (event.entity is EntityArmorStand && event.entity.hasCustomName()) { - if (config.hideTags) { + if (config.hideTags) { val name = stripColorCodes(event.entity.customNameTag) if (name.contains("ABILITY DAMAGE") || name.contains("DEFENSE") || name.contains("DAMAGE") - || name.contains("Superboom TNT") || name.contains ("Blessing")) { - mc.theWorld.removeEntity(event.entity) + || name.contains("Superboom TNT") || name.contains("Blessing") + ) { + mc.theWorld.removeEntity(event.entity) } - } + } if (config.hideArachneTags) { val name = stripColorCodes(event.entity.customNameTag) - if (name.contains("Luxurious Spool") || name.contains("String") || name.contains("Arachne Fragment")){ + if (name.contains("Luxurious Spool") || name.contains("String") || name.contains("Arachne Fragment")) { mc.theWorld.removeEntity(event.entity) } } diff --git a/src/main/kotlin/dulkirmod/features/chat/AbiphoneDND.kt b/src/main/kotlin/dulkirmod/features/chat/AbiphoneDND.kt index 1f922f2..d2e0a69 100644 --- a/src/main/kotlin/dulkirmod/features/chat/AbiphoneDND.kt +++ b/src/main/kotlin/dulkirmod/features/chat/AbiphoneDND.kt @@ -42,7 +42,8 @@ class AbiphoneDND { } } if (unformatted.startsWith("✆ Ring...") && unformatted.endsWith("[PICK UP]") - && System.currentTimeMillis() - lastRing < 5000) { + && System.currentTimeMillis() - lastRing < 5000 + ) { event.isCanceled = true; } } diff --git a/src/main/kotlin/dulkirmod/features/chat/Bridge.kt b/src/main/kotlin/dulkirmod/features/chat/Bridge.kt index f413be8..88430af 100644 --- a/src/main/kotlin/dulkirmod/features/chat/Bridge.kt +++ b/src/main/kotlin/dulkirmod/features/chat/Bridge.kt @@ -7,8 +7,10 @@ import net.minecraft.util.EnumChatFormatting import net.minecraftforge.client.event.ClientChatReceivedEvent object Bridge { - private val guildFormat = "^(§2Guild|§3Officer) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: (\\w+) > .+".toRegex() - private val alternateFormat = "^(§2Guild|§3Officer) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: (\\w+): .+".toRegex() + private val guildFormat = + "^(§2Guild|§3Officer) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: (\\w+) > .+".toRegex() + private val alternateFormat = + "^(§2Guild|§3Officer) > (?:\\S+ )?([\\w§]{3,18})(?: §[a-z0-9]\\[[A-Z]+])?§f: (\\w+): .+".toRegex() fun handle(event: ClientChatReceivedEvent) { val message = event.message.unformattedText diff --git a/src/main/kotlin/dulkirmod/features/chat/ThrottleNotif.kt b/src/main/kotlin/dulkirmod/features/chat/ThrottleNotif.kt index ff747eb..c572db0 100644 --- a/src/main/kotlin/dulkirmod/features/chat/ThrottleNotif.kt +++ b/src/main/kotlin/dulkirmod/features/chat/ThrottleNotif.kt @@ -6,15 +6,15 @@ import dulkirmod.utils.Utils import net.minecraftforge.client.event.ClientChatReceivedEvent object ThrottleNotif { - private var lastThrottle : Long = 0 + private var lastThrottle: Long = 0 fun handle(event: ClientChatReceivedEvent, unformatted: String) { if (unformatted == "This menu has been throttled! Please slow down..." && DulkirMod.config.throttleNotifier - && Utils.isInDungeons()) { + && Utils.isInDungeons() + ) { event.isCanceled = true; if (!Config.throttleNotifierSpam && System.currentTimeMillis() - lastThrottle > 8000) { DulkirMod.mc.thePlayer.sendChatMessage("/pc " + DulkirMod.config.customMessage) - } - else { + } else { DulkirMod.mc.thePlayer.sendChatMessage("/pc " + DulkirMod.config.customMessage) } lastThrottle = System.currentTimeMillis() |