diff options
Diffstat (limited to 'src/main/java/at/hannibal2')
102 files changed, 845 insertions, 1522 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt index 7f874f824..b2458bc61 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt @@ -58,10 +58,8 @@ class GuiPositionEditor(private val positions: List<Position>, private val borde GuiRenderUtils.drawStringCentered("§cSkyHanni Position Editor", getScaledWidth() / 2, 8) var displayPos = -1 - if (clickedPos != -1) { - if (positions[clickedPos].clicked) { - displayPos = clickedPos - } + if (clickedPos != -1 && positions[clickedPos].clicked) { + displayPos = clickedPos } if (displayPos == -1) { displayPos = hoveredPos @@ -149,25 +147,24 @@ class GuiPositionEditor(private val positions: List<Position>, private val borde val elementHeight = position.getDummySize().y val x = position.getAbsX() val y = position.getAbsY() - if (!position.clicked) { - if (GuiRenderUtils.isPointInRect( - - mouseX, - mouseY, - x - border, - y - border, - elementWidth + border * 2, - elementHeight + border * 2 - - ) - - ) { - clickedPos = i - position.clicked = true - grabbedX = mouseX - grabbedY = mouseY - break - } + if (!position.clicked && + GuiRenderUtils.isPointInRect( + + mouseX, + mouseY, + x - border, + y - border, + elementWidth + border * 2, + elementHeight + border * 2 + + ) + + ) { + clickedPos = i + position.clicked = true + grabbedX = mouseX + grabbedY = mouseY + break } } } diff --git a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt index c76bcadab..b26312b51 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/EntityData.kt @@ -68,10 +68,8 @@ class EntityData { val health = (any as Float).toInt() - if (entity is EntityWither) { - if (health == 300) { - if (entityId < 0) return - } + if (entity is EntityWither && health == 300 && entityId < 0) { + return } if (entity is EntityLivingBase) { diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt index 82b94189c..ad32abc15 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt @@ -35,8 +35,8 @@ class GuiEditManager { if (NEUItems.neuHasFocus()) return val screen = Minecraft.getMinecraft().currentScreen - if (screen is GuiEditSign) { - if (!screen.isRancherSign()) return + if (screen is GuiEditSign && !screen.isRancherSign()) { + return } if (isInGui()) return diff --git a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt index 9bb35c602..012a76f1c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/HypixelData.kt @@ -78,24 +78,22 @@ class HypixelData { @SubscribeEvent fun onTick(event: LorenzTickEvent) { - if (event.isMod(2)) { - if (LorenzUtils.inSkyBlock) { - val originalLocation = ScoreboardData.sidebarLinesFormatted - .firstOrNull { it.startsWith(" §7⏣ ") || it.startsWith(" §5ф ") } - ?.substring(5)?.removeColor() - ?: "?" - - skyBlockArea = when { - skyBlockIsland == IslandType.THE_RIFT && westVillageFarmArea.isPlayerInside() -> "Dreadfarm" - skyBlockIsland == IslandType.THE_PARK && howlingCaveArea.isPlayerInside() -> "Howling Cave" - skyBlockIsland == IslandType.THE_END && fakeZealotBruiserHideoutArea.isPlayerInside() -> "The End" - skyBlockIsland == IslandType.THE_END && realZealotBruiserHideoutArea.isPlayerInside() -> "Zealot Bruiser Hideout" - - else -> originalLocation - } - - checkProfileName() + if (event.isMod(2) && LorenzUtils.inSkyBlock) { + val originalLocation = ScoreboardData.sidebarLinesFormatted + .firstOrNull { it.startsWith(" §7⏣ ") || it.startsWith(" §5ф ") } + ?.substring(5)?.removeColor() + ?: "?" + + skyBlockArea = when { + skyBlockIsland == IslandType.THE_RIFT && westVillageFarmArea.isPlayerInside() -> "Dreadfarm" + skyBlockIsland == IslandType.THE_PARK && howlingCaveArea.isPlayerInside() -> "Howling Cave" + skyBlockIsland == IslandType.THE_END && fakeZealotBruiserHideoutArea.isPlayerInside() -> "The End" + skyBlockIsland == IslandType.THE_END && realZealotBruiserHideoutArea.isPlayerInside() -> "Zealot Bruiser Hideout" + + else -> originalLocation } + + checkProfileName() } if (!event.isMod(5)) return diff --git a/src/main/java/at/hannibal2/skyhanni/data/RenderGuiData.kt b/src/main/java/at/hannibal2/skyhanni/data/RenderGuiData.kt index 53815366e..1b6acd634 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/RenderGuiData.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/RenderGuiData.kt @@ -14,7 +14,6 @@ class RenderGuiData { @SubscribeEvent fun onRenderOverlay(event: RenderGameOverlayEvent.Pre) { -// if (!ProfileStorage.loaded) return if (event.type != RenderGameOverlayEvent.ElementType.HOTBAR) return if (GuiEditManager.isInGui() || FFGuideGUI.isInGui()) return @@ -23,7 +22,6 @@ class RenderGuiData { @SubscribeEvent fun onBackgroundDraw(event: GuiScreenEvent.BackgroundDrawnEvent) { -// if (!ProfileStorage.loaded) return if (GuiEditManager.isInGui() || FFGuideGUI.isInGui()) return val currentScreen = Minecraft.getMinecraft().currentScreen ?: return if (currentScreen !is GuiInventory && currentScreen !is GuiChest) return diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt index d6302fa6e..21102c934 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoManager.kt @@ -62,14 +62,12 @@ class RepoManager(private val configLocation: File) { e.printStackTrace() } if (latestRepoCommit == null || latestRepoCommit!!.isEmpty()) return@supplyAsync false - if (File(configLocation, "repo").exists()) { - if (currentCommitJSON != null && currentCommitJSON["sha"].asString == latestRepoCommit) { - if (command) { - LorenzUtils.chat("§e[SkyHanni] §7The repo is already up to date!") - atomicShouldManuallyReload.set(false) - } - return@supplyAsync false + if (File(configLocation, "repo").exists() && currentCommitJSON != null && currentCommitJSON["sha"].asString == latestRepoCommit) { + if (command) { + LorenzUtils.chat("§e[SkyHanni] §7The repo is already up to date!") + atomicShouldManuallyReload.set(false) } + return@supplyAsync false } RepoUtils.recursiveDelete(repoLocation) repoLocation.mkdirs() diff --git a/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt index e03126fde..eddd232bd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/anvil/AnvilCombineHelper.kt @@ -25,7 +25,6 @@ class AnvilCombineHelper { if (chestName != "Anvil") return val matchLore = mutableListOf<String>() -// var compareItem: ItemStack? = null for (slot in chest.inventorySlots) { if (slot == null) continue @@ -34,13 +33,9 @@ class AnvilCombineHelper { if (slot.stack == null) continue if (slot.slotNumber == 29) { -// slot highlight LorenzColor.GREEN val lore = slot.stack.getLore() -// compareItem = slot.stack matchLore.addAll(lore) break -// } else if (slot.slotIndex == 29) { -// slot highlight LorenzColor.YELLOW } } @@ -56,19 +51,6 @@ class AnvilCombineHelper { if (matchLore == slot.stack.getLore()) { slot highlight LorenzColor.GREEN } - -// if (compareItem == slot.stack) { -// slot highlight LorenzColor.GREEN -// } else if (compareItem.metadata == slot.stack.metadata) { -// slot highlight LorenzColor.YELLOW -// } - -// if (slot.slotNumber == 3) { -//// slot highlight LorenzColor.GREEN -//// } else if (slot.slotIndex == 4) { -//// slot highlight LorenzColor.YELLOW -//// } -// } } } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt index 7f4b5cf46..e7ebc2d9e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt @@ -84,10 +84,8 @@ class BingoNextStepHelper { } } - if (!step.done && !parentDone && requirementsToDo == 0) { - if (!currentSteps.contains(step)) { + if (!step.done && !parentDone && requirementsToDo == 0 && !currentSteps.contains(step)) { currentSteps = currentSteps.editCopy { add(step) } - } } } @@ -345,7 +343,6 @@ class BingoNextStepHelper { "Combat", 12 ).also { it requires IslandType.DEEP_CAVERNS.getStep() } - // enchantedCharcoal(7) // compactor(7) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt index 7beff8920..3e40f0b85 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt @@ -48,10 +48,8 @@ class CompactBingoChat { return false } - if (inSkillLevelUp) { - if (!message.contains("Access to") && !message.endsWith(" Enchantment")) { - return true - } + if (inSkillLevelUp && !message.contains("Access to") && !message.endsWith(" Enchantment")) { + return true } return false diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt index 92602860f..7f080ae39 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt @@ -59,7 +59,6 @@ class MinionCraftHelper { } if (!event.isMod(3)) return -// if (!event.isMod(60)) return val mainInventory = Minecraft.getMinecraft()?.thePlayer?.inventory?.mainInventory ?: return @@ -161,10 +160,8 @@ class MinionCraftHelper { for (ingredient in recipe.ingredients) { val id = ingredient.internalItemId - if (!id.contains("_GENERATOR_")) { - if (!allIngredients.contains(id)) { - allIngredients.add(id) - } + if (!id.contains("_GENERATOR_") && !allIngredients.contains(id)) { + allIngredients.add(id) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt index ac83feb51..3296ab782 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt @@ -36,20 +36,16 @@ class PlayerDeathMessages { val message = event.message deathMessagePattern.matchMatcher(message) { val name = group("name") - if (SkyHanniMod.feature.markedPlayers.highlightInChat && !LorenzUtils.inDungeons && !LorenzUtils.inKuudraFight) { - if (MarkedPlayerManager.isMarkedPlayer(name)) { - val reason = group("reason").removeColor() - LorenzUtils.chat(" §c☠ §e$name §7$reason") - event.blockedReason = "marked_player_death" - return - } + if (SkyHanniMod.feature.markedPlayers.highlightInChat && !LorenzUtils.inDungeons && !LorenzUtils.inKuudraFight && MarkedPlayerManager.isMarkedPlayer(name)) { + val reason = group("reason").removeColor() + LorenzUtils.chat(" §c☠ §e$name §7$reason") + event.blockedReason = "marked_player_death" + return } - if (isHideFarDeathsEnabled()) { - if (System.currentTimeMillis() > lastTimePlayerSeen.getOrDefault(name, 0) + 30_000) { - event.blockedReason = "far_away_player_death" - } + if (isHideFarDeathsEnabled() && System.currentTimeMillis() > lastTimePlayerSeen.getOrDefault(name, 0) + 30_000) { + event.blockedReason = "far_away_player_death" } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/Translator.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/Translator.kt index ffa7d53ec..6d238b8b3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/Translator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/Translator.kt @@ -32,7 +32,7 @@ class Translator { val message = event.message if (message.getPlayerName() == "-") return - val editedComponent = event.chatComponent.transformIf({ siblings.size > 0 }) { siblings.last() } + val editedComponent = event.chatComponent.transformIf({ siblings.isNotEmpty() }) { siblings.last() } val clickStyle = createClickStyle(message.removeColor(), editedComponent.chatStyle) editedComponent.setChatStyle(clickStyle) diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt index c9311d11e..e63c925df 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/playerchat/PlayerChatModifier.kt @@ -48,10 +48,8 @@ class PlayerChatModifier { private fun addComponent(foundCommands: MutableList<IChatComponent>, message: IChatComponent) { val clickEvent = message.chatStyle.chatClickEvent if (clickEvent != null) { - if (foundCommands.size == 1) { - if (foundCommands[0].chatStyle.chatClickEvent.value == clickEvent.value) { - return - } + if (foundCommands.size == 1 && foundCommands[0].chatStyle.chatClickEvent.value == clickEvent.value) { + return } foundCommands.add(message) } @@ -74,12 +72,8 @@ class PlayerChatModifier { } } - if (SkyHanniMod.feature.chat.chatFilter) { - if (string.contains("§r§f: ")) { - if (PlayerChatFilter.shouldChatFilter(string)) { - string = string.replace("§r§f: ", "§r§7: ") - } - } + if (SkyHanniMod.feature.chat.chatFilter && string.contains("§r§f: ") && PlayerChatFilter.shouldChatFilter(string)) { + string = string.replace("§r§f: ", "§r§7: ") } if (SkyHanniMod.feature.markedPlayers.highlightInChat) { @@ -90,20 +84,4 @@ class PlayerChatModifier { return string } - -// private fun shouldChatFilter(input: String): Boolean { -// val text = input.lowercase() -// -// //Low baller -// if (text.contains("lowballing")) return true -// if (text.contains("lowballer")) return true -// -// //Trade -// if (text.contains("buy")) return true -// if (text.contains("sell")) return true -// if (text.contains("on my ah")) return true -// -// -// return false -// } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt index 1f84e9e7b..e73a88fb5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/cosmetics/CosmeticFollowingLine.kt @@ -55,19 +55,13 @@ class CosmeticFollowingLine { for ((a, b) in locations.keys.zipWithNext()) { val locationSpot = locations[b]!! - if (firstPerson) { - if (!locationSpot.onGround) { - if (b in last7) { - // Do not render the line in the face, keep more distance while the line is in the air - continue - } - } + if (firstPerson && !locationSpot.onGround && b in last7) { + // Do not render the line in the face, keep more distance while the line is in the air + continue } - if (b in last2) { - if (locationSpot.time.passedSince() < 400.milliseconds) { - // Do not render the line directly next to the player, prevent laggy design - continue - } + if (b in last2 && locationSpot.time.passedSince() < 400.milliseconds) { + // Do not render the line directly next to the player, prevent laggy design + continue } event.draw3DLine(a, b, color, locationSpot.getWidth(), !config.behindBlocks) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt index d1b8425e0..d3c2b0cda 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt @@ -154,32 +154,22 @@ class DamageIndicatorManager { // data.ignoreBlocks = // data.bossType == BossType.END_ENDSTONE_PROTECTOR && Minecraft.getMinecraft().thePlayer.isSneaking - if (!data.ignoreBlocks) { - if (!player.canEntityBeSeen(data.entity)) continue - } + if (!data.ignoreBlocks && !player.canEntityBeSeen(data.entity)) continue if (data.bossType.bossTypeToggle !in config.bossesToShow) continue val entity = data.entity var healthText = data.healthText val delayedStart = data.delayedStart - if (delayedStart != -1L) { - if (delayedStart > System.currentTimeMillis()) { + if (delayedStart != -1L && delayedStart > System.currentTimeMillis()) { val delay = delayedStart - System.currentTimeMillis() healthText = formatDelay(delay) - } } -// val partialTicks = event.partialTicks val location = if (data.dead && data.deathLocation != null) { data.deathLocation!! } else { val loc = entity.getLorenzVec() -// val loc = LorenzVec( -// RenderUtils.interpolate(entity.posX, entity.lastTickPosX, partialTicks), -// RenderUtils.interpolate(entity.posY, entity.lastTickPosY, partialTicks) + 0.5f, -// RenderUtils.interpolate(entity.posZ, entity.lastTickPosZ, partialTicks) -// ) if (data.dead) data.deathLocation = loc loc }.add(-0.5, 0.0, -0.5) @@ -650,18 +640,16 @@ class DamageIndicatorManager { } //Laser phase - if (config.enderSlayer.laserPhaseTimer) { - if (entity.ridingEntity != null) { - val ticksAlive = entity.ridingEntity.ticksExisted.toLong() - //TODO more tests, more exact values, better logic? idk make this working perfectly pls - //val remainingTicks = 8 * 20 - ticksAlive - val remainingTicks = (7.4 * 20).toLong() - ticksAlive - - if (config.enderSlayer.showHealthDuringLaser) { - entityData.nameSuffix = " §f" + formatDelay(remainingTicks * 50) - } else { - return formatDelay(remainingTicks * 50) - } + if (config.enderSlayer.laserPhaseTimer && entity.ridingEntity != null) { + val ticksAlive = entity.ridingEntity.ticksExisted.toLong() + //TODO more tests, more exact values, better logic? idk make this working perfectly pls + //val remainingTicks = 8 * 20 - ticksAlive + val remainingTicks = (7.4 * 20).toLong() - ticksAlive + + if (config.enderSlayer.showHealthDuringLaser) { + entityData.nameSuffix = " §f" + formatDelay(remainingTicks * 50) + } else { + return formatDelay(remainingTicks * 50) } } @@ -778,11 +766,9 @@ class DamageIndicatorManager { private fun checkDamage(entityData: EntityData, health: Long, lastHealth: Long) { val damage = lastHealth - health val healing = health - lastHealth - if (damage > 0) { - if (entityData.bossType != BossType.DUMMY) { - val damageCounter = entityData.damageCounter - damageCounter.currentDamage += damage - } + if (damage > 0 && entityData.bossType != BossType.DUMMY) { + val damageCounter = entityData.damageCounter + damageCounter.currentDamage += damage } if (healing > 0) { //Hide auto heal every 10 ticks (with rounding errors) @@ -857,17 +843,13 @@ class DamageIndicatorManager { } } } else { - if (entityData != null) { - if (isEnabled()) { - if (config.hideVanillaNametag) { - val name = entity.name - if (name.contains("Plaesmaflux")) return - if (name.contains("Overflux")) return - if (name.contains("Mana Flux")) return - if (name.contains("Radiant")) return - event.isCanceled = true - } - } + if (entityData != null && isEnabled() && config.hideVanillaNametag) { + val name = entity.name + if (name.contains("Plaesmaflux")) return + if (name.contains("Overflux")) return + if (name.contains("Mana Flux")) return + if (name.contains("Radiant")) return + event.isCanceled = true } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt index 9f0bf542e..bd2c7dfe7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/MobFinder.kt @@ -78,134 +78,98 @@ class MobFinder { internal fun tryAdd(entity: EntityLivingBase): EntityResult? { if (LorenzUtils.inDungeons) { if (DungeonAPI.isOneOf("F1", "M1")) { - if (floor1bonzo1) { - if (entity is EntityOtherPlayerMP) { - if (entity.name == "Bonzo ") { - return EntityResult(floor1bonzo1SpawnTime) - } - } + if (floor1bonzo1 && entity is EntityOtherPlayerMP && entity.name == "Bonzo ") { + return EntityResult(floor1bonzo1SpawnTime) } - if (floor1bonzo2) { - if (entity is EntityOtherPlayerMP) { - if (entity.name == "Bonzo ") { - return EntityResult(floor1bonzo2SpawnTime, finalDungeonBoss = true) - } - } + if (floor1bonzo2 && entity is EntityOtherPlayerMP && entity.name == "Bonzo ") { + return EntityResult(floor1bonzo2SpawnTime, finalDungeonBoss = true) } } if (DungeonAPI.isOneOf("F2", "M2")) { - if (entity.name == "Summon ") { - if (entity is EntityOtherPlayerMP) { - if (floor2summons1) { - if (!floor2summonsDiedOnce.contains(entity)) { - if (entity.health.toInt() != 0) { - return EntityResult(floor2summons1SpawnTime) - } else { - floor2summonsDiedOnce.add(entity) - } - } - } - if (floor2secondPhase) { - return EntityResult(floor2secondPhaseSpawnTime) + if (entity.name == "Summon " && entity is EntityOtherPlayerMP) { + if (floor2summons1 && !floor2summonsDiedOnce.contains(entity)) { + if (entity.health.toInt() != 0) { + return EntityResult(floor2summons1SpawnTime) + } else { + floor2summonsDiedOnce.add(entity) } } + if (floor2secondPhase) { + return EntityResult(floor2secondPhaseSpawnTime) + } } - if (floor2secondPhase) { - if (entity is EntityOtherPlayerMP) { - //TODO only show scarf after (all/at least x) summons are dead? - val result = entity.name == "Scarf " - if (result) { - return EntityResult(floor2secondPhaseSpawnTime, finalDungeonBoss = true) - } + if (floor2secondPhase && entity is EntityOtherPlayerMP) { + //TODO only show scarf after (all/at least x) summons are dead? + val result = entity.name == "Scarf " + if (result) { + return EntityResult(floor2secondPhaseSpawnTime, finalDungeonBoss = true) } } } if (DungeonAPI.isOneOf("F3", "M3")) { - if (entity is EntityGuardian) { - if (floor3GuardianShield) { - if (guardians.size == 4) { - var totalHealth = 0 - for (guardian in guardians) { - totalHealth += guardian.health.toInt() - } - if (totalHealth == 0) { - floor3GuardianShield = false - guardians.clear() - } - } else { - findGuardians() + if (entity is EntityGuardian && floor3GuardianShield) { + if (guardians.size == 4) { + var totalHealth = 0 + for (guardian in guardians) { + totalHealth += guardian.health.toInt() } - if (guardians.contains(entity)) { - return EntityResult(floor3GuardianShieldSpawnTime, true) + if (totalHealth == 0) { + floor3GuardianShield = false + guardians.clear() } + } else { + findGuardians() + } + if (guardians.contains(entity)) { + return EntityResult(floor3GuardianShieldSpawnTime, true) } } - if (floor3Professor) { - if (entity is EntityOtherPlayerMP) { - if (entity.name == "The Professor") { - return EntityResult( - floor3ProfessorSpawnTime, - floor3ProfessorSpawnTime + 1_000 > System.currentTimeMillis() - ) - } - } + if (floor3Professor && entity is EntityOtherPlayerMP && entity.name == "The Professor") { + return EntityResult( + floor3ProfessorSpawnTime, + floor3ProfessorSpawnTime + 1_000 > System.currentTimeMillis() + ) } - if (floor3ProfessorGuardianPrepare) { - if (entity is EntityOtherPlayerMP) { - if (entity.name == "The Professor") { - return EntityResult(floor3ProfessorGuardianPrepareSpawnTime, true) - } - } + if (floor3ProfessorGuardianPrepare && entity is EntityOtherPlayerMP && entity.name == "The Professor") { + return EntityResult(floor3ProfessorGuardianPrepareSpawnTime, true) } - if (entity is EntityGuardian) { - if (floor3ProfessorGuardian) { - if (entity == floor3ProfessorGuardianEntity) { - return EntityResult(finalDungeonBoss = true) - } - } + if (entity is EntityGuardian && floor3ProfessorGuardian && entity == floor3ProfessorGuardianEntity) { + return EntityResult(finalDungeonBoss = true) } } - if (DungeonAPI.isOneOf("F4", "M4")) { - if (entity is EntityGhast) { - return EntityResult( - bossType = BossType.DUNGEON_F4_THORN, - ignoreBlocks = true, - finalDungeonBoss = true - ) - } + if (DungeonAPI.isOneOf("F4", "M4") && entity is EntityGhast) { + return EntityResult( + bossType = BossType.DUNGEON_F4_THORN, + ignoreBlocks = true, + finalDungeonBoss = true + ) } - if (DungeonAPI.isOneOf("F5", "M5")) { - if (entity is EntityOtherPlayerMP) { - if (entity == DungeonLividFinder.livid) { - return EntityResult( - bossType = BossType.DUNGEON_F5, - ignoreBlocks = true, - finalDungeonBoss = true - ) - } - } + if (DungeonAPI.isOneOf("F5", "M5") && entity is EntityOtherPlayerMP && entity == DungeonLividFinder.livid) { + return EntityResult( + bossType = BossType.DUNGEON_F5, + ignoreBlocks = true, + finalDungeonBoss = true + ) } - if (DungeonAPI.isOneOf("F6", "M6")) { - if (entity is EntityGiantZombie && !entity.isInvisible) { - if (floor6Giants && entity.posY > 68) { - val extraDelay = checkExtraF6GiantsDelay(entity) - return EntityResult( - floor6GiantsSpawnTime + extraDelay, - floor6GiantsSpawnTime + extraDelay + 1_000 > System.currentTimeMillis() - ) - } + if (DungeonAPI.isOneOf("F6", "M6") && entity is EntityGiantZombie && !entity.isInvisible) { + if (floor6Giants && entity.posY > 68) { + val extraDelay = checkExtraF6GiantsDelay(entity) + return EntityResult( + floor6GiantsSpawnTime + extraDelay, + floor6GiantsSpawnTime + extraDelay + 1_000 > System.currentTimeMillis() + ) + } - if (floor6Sadan) { - return EntityResult(floor6SadanSpawnTime, finalDungeonBoss = true) - } + if (floor6Sadan) { + return EntityResult(floor6SadanSpawnTime, finalDungeonBoss = true) } } } else if (RiftAPI.inRift()) { @@ -224,25 +188,19 @@ class MobFinder { } } } - if (entity is EntitySlime) { - if (entity.baseMaxHealth == 1_000) { - return EntityResult(bossType = BossType.BACTE) - } + if (entity is EntitySlime && entity.baseMaxHealth == 1_000) { + return EntityResult(bossType = BossType.BACTE) } } else { - if (entity is EntityBlaze) { - if (entity.name != "Dinnerbone") { - if (entity.hasNameTagWith(2, "§e﴾ §8[§7Lv200§8] §l§8§lAshfang§r ")) { - if (entity.hasMaxHealth(50_000_000, true)) { - return EntityResult(bossType = BossType.NETHER_ASHFANG) - } - } - } + if (entity is EntityBlaze && entity.name != "Dinnerbone" && entity.hasNameTagWith( + 2, + "§e﴾ §8[§7Lv200§8] §l§8§lAshfang§r " + ) && entity.hasMaxHealth(50_000_000, true) + ) { + return EntityResult(bossType = BossType.NETHER_ASHFANG) } - if (entity is EntitySkeleton) { - if (entity.hasNameTagWith(5, "§e﴾ §8[§7Lv200§8] §l§8§lBladesoul§r ")) { - return EntityResult(bossType = BossType.NETHER_BLADESOUL) - } + if (entity is EntitySkeleton && entity.hasNameTagWith(5, "§e﴾ §8[§7Lv200§8] §l§8§lBladesoul§r ")) { + return EntityResult(bossType = BossType.NETHER_BLADESOUL) } if (entity is EntityOtherPlayerMP) { if (entity.name == "Mage Outlaw") { @@ -254,19 +212,15 @@ class MobFinder { } } } - if (entity is EntityWither) { - if (entity.hasNameTagWith(4, "§8[§7Lv100§8] §c§5Vanquisher§r ")) { - return EntityResult(bossType = BossType.NETHER_VANQUISHER) - } + if (entity is EntityWither && entity.hasNameTagWith(4, "§8[§7Lv100§8] §c§5Vanquisher§r ")) { + return EntityResult(bossType = BossType.NETHER_VANQUISHER) } - if (entity is EntityEnderman) { - if (entity.hasNameTagWith(3, "§c☠ §bVoidgloom Seraph ")) { - when { - entity.hasMaxHealth(300_000, true) -> return EntityResult(bossType = BossType.SLAYER_ENDERMAN_1) - entity.hasMaxHealth(12_000_000, true) -> return EntityResult(bossType = BossType.SLAYER_ENDERMAN_2) - entity.hasMaxHealth(50_000_000, true) -> return EntityResult(bossType = BossType.SLAYER_ENDERMAN_3) - entity.hasMaxHealth(210_000_000, true) -> return EntityResult(bossType = BossType.SLAYER_ENDERMAN_4) - } + if (entity is EntityEnderman && entity.hasNameTagWith(3, "§c☠ §bVoidgloom Seraph ")) { + when { + entity.hasMaxHealth(300_000, true) -> return EntityResult(bossType = BossType.SLAYER_ENDERMAN_1) + entity.hasMaxHealth(12_000_000, true) -> return EntityResult(bossType = BossType.SLAYER_ENDERMAN_2) + entity.hasMaxHealth(50_000_000, true) -> return EntityResult(bossType = BossType.SLAYER_ENDERMAN_3) + entity.hasMaxHealth(210_000_000, true) -> return EntityResult(bossType = BossType.SLAYER_ENDERMAN_4) } } if (entity is EntityDragon) { @@ -277,10 +231,8 @@ class MobFinder { return EntityResult(bossType = BossType.WINTER_REINDRAKE) } } - if (entity is EntityIronGolem) { - if (entity.hasNameTagWith(3, "§e﴾ §8[§7Lv100§8] §lEndstone Protector§r ")) { - return EntityResult(bossType = BossType.END_ENDSTONE_PROTECTOR) - } + if (entity is EntityIronGolem && entity.hasNameTagWith(3, "§e﴾ §8[§7Lv100§8] §lEndstone Protector§r ")) { + return EntityResult(bossType = BossType.END_ENDSTONE_PROTECTOR) } if (entity is EntityZombie) { if (entity.hasNameTagWith(2, "§c☠ §bRevenant Horror")) { @@ -291,30 +243,26 @@ class MobFinder { entity.hasMaxHealth(1_500_000, true) -> return EntityResult(bossType = BossType.SLAYER_ZOMBIE_4) } } - if (entity.hasNameTagWith(2, "§c☠ §fAtoned Horror ")) { - if (entity.hasMaxHealth(10_000_000, true)) { - return EntityResult(bossType = BossType.SLAYER_ZOMBIE_5) - } + if (entity.hasNameTagWith(2, "§c☠ §fAtoned Horror ") && entity.hasMaxHealth(10_000_000, true)) { + return EntityResult(bossType = BossType.SLAYER_ZOMBIE_5) } } - if (entity is EntityLiving) { - if (entity.hasNameTagWith(2, "Dummy §a10M§c❤")) { - return EntityResult(bossType = BossType.DUMMY) - } + if (entity is EntityLiving && entity.hasNameTagWith(2, "Dummy §a10M§c❤")) { + return EntityResult(bossType = BossType.DUMMY) } - if (entity is EntityMagmaCube) { - if (entity.hasNameTagWith(15, "§e﴾ §8[§7Lv500§8] §l§4§lMagma Boss§r ")) { - if (entity.hasMaxHealth(200_000_000, true)) { - return EntityResult(bossType = BossType.NETHER_MAGMA_BOSS, ignoreBlocks = true) - } - } + if (entity is EntityMagmaCube && entity.hasNameTagWith( + 15, + "§e﴾ §8[§7Lv500§8] §l§4§lMagma Boss§r " + ) && entity.hasMaxHealth(200_000_000, true) + ) { + return EntityResult(bossType = BossType.NETHER_MAGMA_BOSS, ignoreBlocks = true) } - if (entity is EntityHorse) { - if (entity.hasNameTagWith(15, "§8[§7Lv100§8] §c§6Headless Horseman§r ")) { - if (entity.hasMaxHealth(3_000_000, true)) { - return EntityResult(bossType = BossType.HUB_HEADLESS_HORSEMAN) - } - } + if (entity is EntityHorse && entity.hasNameTagWith( + 15, + "§8[§7Lv100§8] §c§6Headless Horseman§r " + ) && entity.hasMaxHealth(3_000_000, true) + ) { + return EntityResult(bossType = BossType.HUB_HEADLESS_HORSEMAN) } if (entity is EntityBlaze && entity.hasNameTagWith(2, "§c☠ §bInferno Demonlord ")) { when { @@ -367,21 +315,15 @@ class MobFinder { if (entity.name == "Minos Champion") return EntityResult(bossType = BossType.MINOS_CHAMPION) if (entity.name == "Minotaur ") return EntityResult(bossType = BossType.MINOTAUR) } - if (entity is EntityIronGolem) { - if (entity.hasMaxHealth(1_500_000)) { - return EntityResult(bossType = BossType.GAIA_CONSTURUCT) - } + if (entity is EntityIronGolem && entity.hasMaxHealth(1_500_000)) { + return EntityResult(bossType = BossType.GAIA_CONSTURUCT) } - if (entity is EntityGuardian) { - if (entity.hasMaxHealth(35_000_000)) { - return EntityResult(bossType = BossType.THUNDER) - } + if (entity is EntityGuardian && entity.hasMaxHealth(35_000_000)) { + return EntityResult(bossType = BossType.THUNDER) } - if (entity is EntityIronGolem) { - if (entity.hasMaxHealth(100_000_000)) { - return EntityResult(bossType = BossType.LORD_JAWBUS) - } + if (entity is EntityIronGolem && entity.hasMaxHealth(100_000_000)) { + return EntityResult(bossType = BossType.LORD_JAWBUS) } } @@ -549,15 +491,11 @@ class MobFinder { } fun handleNewEntity(entity: Entity) { - if (LorenzUtils.inDungeons) { - if (floor3ProfessorGuardian) { - if (entity is EntityGuardian) { - if (floor3ProfessorGuardianEntity == null) { - floor3ProfessorGuardianEntity = entity - floor3ProfessorGuardianPrepare = false - } - } - } + if (LorenzUtils.inDungeons && floor3ProfessorGuardian && entity is EntityGuardian && floor3ProfessorGuardianEntity == null) { + + floor3ProfessorGuardianEntity = entity + floor3ProfessorGuardianPrepare = false + } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt index 739dbe17b..36ab4e3d8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonAPI.kt @@ -55,11 +55,10 @@ class DungeonAPI { if (!inDungeon()) return val message = rawMessage.removeColor() val bossName = message.substringAfter("[BOSS] ").substringBefore(":").trim() - if (bossName != "The Watcher" && dungeonFloor != null && checkBossName(dungeonFloor!!, bossName)) { - if (!inBossRoom) { + if (bossName != "The Watcher" && dungeonFloor != null && checkBossName(dungeonFloor!!, bossName) && + !inBossRoom) { DungeonBossRoomEnterEvent().postAndCatch() inBossRoom = true - } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt index ff29e4774..6d0afd651 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt @@ -83,27 +83,16 @@ class DungeonCleanEnd { if (entity == Minecraft.getMinecraft().thePlayer) return - if (SkyHanniMod.feature.dungeon.cleanEndF3IgnoreGuardians) { - if (DungeonAPI.isOneOf("F3", "M3")) { - if (entity is EntityGuardian) { - if (entity.entityId != lastBossId) { - if (Minecraft.getMinecraft().thePlayer.isSneaking) { - return - } - } - } - } + if (SkyHanniMod.feature.dungeon.cleanEndF3IgnoreGuardians + && DungeonAPI.isOneOf("F3", "M3") + && entity is EntityGuardian + && entity.entityId != lastBossId + && Minecraft.getMinecraft().thePlayer.isSneaking) { + return } - if (chestsSpawned) { - if (entity is EntityArmorStand) { - if (!entity.hasCustomName()) { - return - } - } - if (entity is EntityOtherPlayerMP) { - return - } + if (chestsSpawned && ((entity is EntityArmorStand && !entity.hasCustomName()) || entity is EntityOtherPlayerMP)) { + return } event.isCanceled = true @@ -118,10 +107,8 @@ class DungeonCleanEnd { @SubscribeEvent fun onPlaySound(event: PlaySoundEvent) { - if (shouldBlock() && !chestsSpawned) { - if (event.soundName.startsWith("note.")) { - event.isCanceled = true - } + if (shouldBlock() && !chestsSpawned && event.soundName.startsWith("note.")) { + event.isCanceled = true } } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt index e91c40ef8..1428a120a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHideItems.kt @@ -46,10 +46,8 @@ class DungeonHideItems { private fun isSkeletonSkull(entity: EntityArmorStand): Boolean { val itemStack = entity.inventory[4] - if (itemStack != null) { - if (itemStack.cleanName() == "Skeleton Skull") { - return true - } + if (itemStack != null && itemStack.cleanName() == "Skeleton Skull") { + return true } return false @@ -63,16 +61,12 @@ class DungeonHideItems { if (entity is EntityItem) { val stack = entity.entityItem - if (SkyHanniMod.feature.dungeon.hideReviveStone) { - if (stack.cleanName() == "Revive Stone") { - event.isCanceled = true - } + if (SkyHanniMod.feature.dungeon.hideReviveStone && stack.cleanName() == "Revive Stone") { + event.isCanceled = true } - if (SkyHanniMod.feature.dungeon.hideJournalEntry) { - if (stack.cleanName() == "Journal Entry") { - event.isCanceled = true - } + if (SkyHanniMod.feature.dungeon.hideJournalEntry && stack.cleanName() == "Journal Entry") { + event.isCanceled = true } } @@ -84,11 +78,9 @@ class DungeonHideItems { } val itemStack = entity.inventory[4] - if (itemStack != null) { - if (itemStack.cleanName() == "Superboom TNT") { - event.isCanceled = true - hideParticles[entity] = System.currentTimeMillis() - } + if (itemStack != null && itemStack.cleanName() == "Superboom TNT") { + event.isCanceled = true + hideParticles[entity] = System.currentTimeMillis() } } @@ -98,10 +90,8 @@ class DungeonHideItems { } val itemStack = entity.inventory[4] - if (itemStack != null) { - if (itemStack.getSkullTexture() == blessingTexture) { - event.isCanceled = true - } + if (itemStack != null && itemStack.getSkullTexture() == blessingTexture) { + event.isCanceled = true } } @@ -111,11 +101,9 @@ class DungeonHideItems { } val itemStack = entity.inventory[4] - if (itemStack != null) { - if (itemStack.getSkullTexture() == reviveStoneTexture) { - event.isCanceled = true - hideParticles[entity] = System.currentTimeMillis() - } + if (itemStack != null && itemStack.getSkullTexture() == reviveStoneTexture) { + event.isCanceled = true + hideParticles[entity] = System.currentTimeMillis() } } @@ -126,10 +114,8 @@ class DungeonHideItems { } val itemStack = entity.inventory[4] - if (itemStack != null) { - if (itemStack.getSkullTexture() == premiumFleshTexture) { - event.isCanceled = true - } + if (itemStack != null && itemStack.getSkullTexture() == premiumFleshTexture) { + event.isCanceled = true } } @@ -168,11 +154,9 @@ class DungeonHideItems { if (SkyHanniMod.feature.dungeon.hideHealerFairy) { val itemStack = entity.inventory[0] - if (itemStack != null) { - if (itemStack.getSkullTexture() == healerFairyTexture) { - event.isCanceled = true - return - } + if (itemStack != null && itemStack.getSkullTexture() == healerFairyTexture) { + event.isCanceled = true + return } } } @@ -213,12 +197,10 @@ class DungeonHideItems { if (!LorenzUtils.inDungeons) return if (!SkyHanniMod.feature.dungeon.highlightSkeletonSkull) return val entity = event.entity - if (entity is EntityArmorStand) { - if (isSkeletonSkull(entity)) { - val lastMove = movingSkeletonSkulls.getOrDefault(entity, 0) - if (lastMove + 200 > System.currentTimeMillis()) { - event.color = LorenzColor.GOLD.toColor().withAlpha(60) - } + if (entity is EntityArmorStand && isSkeletonSkull(entity)) { + val lastMove = movingSkeletonSkulls.getOrDefault(entity, 0) + if (lastMove + 200 > System.currentTimeMillis()) { + event.color = LorenzColor.GOLD.toColor().withAlpha(60) } } } @@ -228,12 +210,10 @@ class DungeonHideItems { if (!LorenzUtils.inDungeons) return if (!SkyHanniMod.feature.dungeon.highlightSkeletonSkull) return val entity = event.entity - if (entity is EntityArmorStand) { - if (isSkeletonSkull(entity)) { - val lastMove = movingSkeletonSkulls.getOrDefault(entity, 0) - if (lastMove + 200 > System.currentTimeMillis()) { - event.shouldReset = true - } + if (entity is EntityArmorStand && isSkeletonSkull(entity)) { + val lastMove = movingSkeletonSkulls.getOrDefault(entity, 0) + if (lastMove + 200 > System.currentTimeMillis()) { + event.shouldReset = true } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt index 02f9dd2fb..11b36e454 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonHighlightClickedBlocks.kt @@ -92,10 +92,4 @@ class DungeonHighlightClickedBlocks { CHEST("Chest"), WITHER_ESSENCE("Wither Essence"), } - -// private fun nearWaterRoom(): Boolean { -// val playerLoc = -// LocationUtils.getPlayerLocation().add(LocationUtils.getPlayerLookingAtDirection().multiply(2)).add(0, 2, 0) -// return WaterBoardSolver.waterRoomDisplays.any { it.distance(playerLoc) < 3 } -// } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt index 5797c0935..53d701b0d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonMilestonesDisplay.kt @@ -37,11 +37,8 @@ class DungeonMilestonesDisplay { } private fun checkVisibility() { - if (currentMilestone >= 3) { - if (System.currentTimeMillis() > timeReached + 3_000) - if (display != "") { - display = display.substring(1) - } + if (currentMilestone >= 3 && System.currentTimeMillis() > timeReached + 3_000 && display != "") { + display = display.substring(1) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/HighlightDungeonDeathmite.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/HighlightDungeonDeathmite.kt index 27493abc4..c7d8293af 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/HighlightDungeonDeathmite.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/HighlightDungeonDeathmite.kt @@ -19,12 +19,10 @@ class HighlightDungeonDeathmite { val entity = event.entity val maxHealth = event.maxHealth - if (entity is EntitySilverfish) { - if (maxHealth == 1_000_000_000) { - RenderLivingEntityHelper.setEntityColor(entity, LorenzColor.DARK_RED.toColor().withAlpha(20)) - { SkyHanniMod.feature.dungeon.highlightDeathmites } - RenderLivingEntityHelper.setNoHurtTime(entity) { SkyHanniMod.feature.dungeon.highlightDeathmites } - } + if (entity is EntitySilverfish && maxHealth == 1_000_000_000) { + RenderLivingEntityHelper.setEntityColor(entity, LorenzColor.DARK_RED.toColor().withAlpha(20)) + { SkyHanniMod.feature.dungeon.highlightDeathmites } + RenderLivingEntityHelper.setNoHurtTime(entity) { SkyHanniMod.feature.dungeon.highlightDeathmites } } } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt index 4e18251b5..f7004074b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowHelper.kt @@ -96,10 +96,8 @@ object GriffinBurrowHelper { @SubscribeEvent fun onPlayerMove(event: EntityMoveEvent) { - if (event.distance > 10) { - if (event.entity == Minecraft.getMinecraft().thePlayer) { - teleportedLocation = event.newLocation - } + if (event.distance > 10 && event.entity == Minecraft.getMinecraft().thePlayer) { + teleportedLocation = event.newLocation } } @@ -172,10 +170,8 @@ object GriffinBurrowHelper { } } - if (InquisitorWaypointShare.waypoints.isNotEmpty()) { - if (config.inquisitorSharing.focusInquisitor) { - return - } + if (InquisitorWaypointShare.waypoints.isNotEmpty() && config.inquisitorSharing.focusInquisitor) { + return } if (config.burrowsNearbyDetection) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt index a4ca74ff4..9d6a90135 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinBurrowParticleFinder.kt @@ -26,61 +26,6 @@ class GriffinBurrowParticleFinder { private val burrows = mutableMapOf<LorenzVec, Burrow>() var lastDugParticleBurrow: LorenzVec? = null - // private enum class ParticleType(val check: ReceiveParticleEvent.() -> Boolean) { -// EMPTY({ -// type == net.minecraft.util.EnumParticleTypes.CRIT_MAGIC && count == 4 && speed == 0.01f && offset.x == 0.5 && offset.y == 0.1 && offset.z == 0.5 -// }), -// MOB({ -// type == net.minecraft.util.EnumParticleTypes.CRIT && count == 3 && speed == 0.01f && offset.x == 0.5 && offset.y == 0.1 && offset.z == 0.5 -// -// }), -// TREASURE({ -// type == net.minecraft.util.EnumParticleTypes.DRIP_LAVA && count == 2 && speed == 0.01f && offset.x == 0.35 && offset.y == 0.1 && offset.z == 0.35 -// }), -// FOOTSTEP({ -// type == net.minecraft.util.EnumParticleTypes.FOOTSTEP && count == 1 && speed == 0.0f && offset.x == 0.05 && offset.y == 0.0 && offset.z == 0.05 -// }), -// ENCHANT({ -// type == net.minecraft.util.EnumParticleTypes.ENCHANTMENT_TABLE && count == 5 && speed == 0.05f && offset.x == 0.5 && offset.y == 0.4 && offset.z == 0.5 -// }); -// -// companion object { -// fun getParticleType(packet: ReceiveParticleEvent): ParticleType? { -// if (!packet.longDistance) return null -// for (type in values()) { -// if (type.check(packet)) { -// return type -// } -// } -// return null -// } -// } -// } -// -// @SubscribeEvent -// fun onChatPacket(event: ReceiveParticleEvent) { -// if (!LorenzUtils.inSkyBlock) return -// if (!SkyHanniMod.feature.dev.debugEnabled) return -// -// val particleType = getParticleType(event) -// if (particleType != null) { -// -// val location = event.location.toBlocPos().down().toLorenzVec() -// if (recentlyDugParticleBurrows.contains(location)) return -// val burrow = particleBurrows.getOrPut(location) { ParticleBurrow(location) } -// -// when (particleType) { -// ParticleType.FOOTSTEP -> burrow.hasFootstep = true -// ParticleType.ENCHANT -> burrow.hasEnchant = true -// ParticleType.EMPTY -> burrow.type = 0 -// ParticleType.MOB -> burrow.type = 1 -// ParticleType.TREASURE -> burrow.type = 2 -// } -// -// } -// -// } - @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) fun onChatPacket(event: PacketEvent.ReceiveEvent) { if (!LorenzUtils.inSkyBlock) return @@ -207,15 +152,5 @@ class GriffinBurrowParticleFinder { else -> BurrowType.UNKNOWN } } - -// private fun getWaypointText(): String { -// var type = "Burrow" -// when (this.type) { -// 0 -> type = "§aStart" -// 1 -> type = "§cMob" -// 2 -> type = "§6Treasure" -// } -// return "$type §a(Particle)" -// } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt index 679c493ca..e5838aec8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/GriffinPetWarning.kt @@ -21,12 +21,10 @@ class GriffinPetWarning { if (!DianaAPI.isRitualActive()) return if (!DianaAPI.hasSpadeInHand()) return - if (!DianaAPI.hasGriffinPet()) { - if (lastWarnTime.passedSince() > 30.seconds) { - lastWarnTime = SimpleTimeMark.now() - TitleUtils.sendTitle("§cGriffin Pet!", 3.seconds) - LorenzUtils.chat("§e[SkyHanni] Reminder to use a Griffin pet for Mythological Ritual!") - } + if (!DianaAPI.hasGriffinPet() && lastWarnTime.passedSince() > 30.seconds) { + lastWarnTime = SimpleTimeMark.now() + TitleUtils.sendTitle("§cGriffin Pet!", 3.seconds) + LorenzUtils.chat("§e[SkyHanni] Reminder to use a Griffin pet for Mythological Ritual!") } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt index 18f8c6f7d..5f0437ebe 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt @@ -97,11 +97,9 @@ object InquisitorWaypointShare { } // TODO: Change the check to only one line once we have a confirmed inquis message line - if (message.contains("§r§eYou dug out ")) { - if (message.contains("Inquis")) { - time = System.currentTimeMillis() - logger.log("found Inquisitor") - } + if (message.contains("§r§eYou dug out ") && message.contains("Inquis")) { + time = System.currentTimeMillis() + logger.log("found Inquisitor") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt index 4f478f63c..be4df98e4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureFeatures.kt @@ -59,7 +59,7 @@ class SeaCreatureFeatures { private fun isEnabled() = LorenzUtils.inSkyBlock && !LorenzUtils.inDungeons && !LorenzUtils.inKuudraFight private val getEntityOutlineColor: (entity: Entity) -> Int? = { entity -> - if (EntityLivingBase::class.java.isInstance(entity) && entity in rareSeaCreatures && entity.distanceToPlayer() < 30) { + if (entity is EntityLivingBase && entity in rareSeaCreatures && entity.distanceToPlayer() < 30) { LorenzColor.GREEN.toColor().rgb } else null } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt index 76c5666c9..da588c2be 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt @@ -185,9 +185,8 @@ object GardenAPI { val blockState = event.getBlockState val cropBroken = blockState.getCropType() ?: return - if (cropBroken.multiplier == 1) { - if (blockState.isBabyCrop()) return - } + if (cropBroken.multiplier == 1 && blockState.isBabyCrop()) return + val position = event.position if (lastLocation == position) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt index 39ca5e7af..c60fd5086 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneFix.kt @@ -66,10 +66,8 @@ class GardenCropMilestoneFix { val tabListValue = baseCrops + progress - smallestPercentage val newValue = tabListValue.toLong() - if (tabListCropProgress[crop] != newValue) { - if (tabListCropProgress.containsKey(crop)) { - changedValue(crop, newValue, "tab list", smallestPercentage.toInt()) - } + if (tabListCropProgress[crop] != newValue && tabListCropProgress.containsKey(crop)) { + changedValue(crop, newValue, "tab list", smallestPercentage.toInt()) } tabListCropProgress[crop] = newValue } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt index 09b86deba..e479bc2ac 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt @@ -43,15 +43,13 @@ class GardenLevelDisplay { val oldLevel = GardenAPI.getGardenLevel() GardenAPI.gardenExp = gardenExp + moreExp val newLevel = GardenAPI.getGardenLevel() - if (newLevel == oldLevel + 1) { - if (newLevel > 15) { - LorenzUtils.runDelayed(50.milliseconds) { - LorenzUtils.clickableChat( - " \n§b§lGARDEN LEVEL UP §8$oldLevel ➜ §b$newLevel\n" + - " §8+§aRespect from Elite Farmers and SkyHanni members :)\n ", - "/gardenlevels" - ) - } + if (newLevel == oldLevel + 1 && newLevel > 15) { + LorenzUtils.runDelayed(50.milliseconds) { + LorenzUtils.clickableChat( + " \n§b§lGARDEN LEVEL UP §8$oldLevel ➜ §b$newLevel\n" + + " §8+§aRespect from Elite Farmers and SkyHanni members :)\n ", + "/gardenlevels" + ) } } update() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt index 6cd1b5658..a69a812d7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt @@ -141,14 +141,12 @@ class ComposterDisplay { if (!config.composterNotifyLowEnabled) return val hidden = hidden ?: return - if (ComposterAPI.getOrganicMatter() <= config.composterNotifyLowOrganicMatter) { - if (System.currentTimeMillis() >= hidden.informedAboutLowMatter) { - if (config.composterNotifyLowTitle) { - TitleUtils.sendTitle("§cYour Organic Matter is low", 4.seconds) - } - LorenzUtils.chat("§e[SkyHanni] §cYour Organic Matter is low!") - hidden.informedAboutLowMatter = System.currentTimeMillis() + 60_000 * 5 + if (ComposterAPI.getOrganicMatter() <= config.composterNotifyLowOrganicMatter && System.currentTimeMillis() >= hidden.informedAboutLowMatter) { + if (config.composterNotifyLowTitle) { + TitleUtils.sendTitle("§cYour Organic Matter is low", 4.seconds) } + LorenzUtils.chat("§e[SkyHanni] §cYour Organic Matter is low!") + hidden.informedAboutLowMatter = System.currentTimeMillis() + 60_000 * 5 } if (ComposterAPI.getFuel() <= config.composterNotifyLowFuel && diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt index 0e30451f0..3fb00194a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt @@ -101,14 +101,9 @@ class ComposterOverlay { @SubscribeEvent fun onTick(event: LorenzTickEvent) { if (!GardenAPI.inGarden()) return - if (inComposterUpgrades) { - if (extraComposterUpgrade != null) { -// if (System.currentTimeMillis() > lastHovered + 30) { - if (System.currentTimeMillis() > lastHovered + 200) { - extraComposterUpgrade = null - update() - } - } + if (inComposterUpgrades && extraComposterUpgrade != null && System.currentTimeMillis() > lastHovered + 200) { + extraComposterUpgrade = null + update() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestStatsSummary.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestStatsSummary.kt index 1a7cbcbda..43953feee 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestStatsSummary.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestStatsSummary.kt @@ -21,10 +21,8 @@ class JacobContestStatsSummary { if (!isEnabled()) return if (event.clickType != ClickType.LEFT_CLICK) return - if (FarmingContestAPI.inContest) { - if (event.crop == FarmingContestAPI.contestCrop) { - blocksBroken++ - } + if (FarmingContestAPI.inContest && event.crop == FarmingContestAPI.contestCrop) { + blocksBroken++ } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt index 0334cf114..3137fac42 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt @@ -126,13 +126,11 @@ class JacobFarmingContestsInventory { if (!InventoryUtils.openInventoryName().contains("Your Contests")) return val slot = event.slot.slotNumber - if (config.jacobFarmingContestHideDuplicates) { - if (duplicateSlots.contains(slot)) { - event.toolTip.clear() - event.toolTip.add("§7Duplicate contest") - event.toolTip.add("§7hidden by SkyHanni!") - return - } + if (config.jacobFarmingContestHideDuplicates && duplicateSlots.contains(slot)) { + event.toolTip.clear() + event.toolTip.add("§7Duplicate contest") + event.toolTip.add("§7hidden by SkyHanni!") + return } if (config.jacobFarmingContestRealTime) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt index 985480003..f43042bca 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt @@ -29,10 +29,8 @@ class FarmingWeightDisplay { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { - if (isEnabled()) { - if (config.eliteFarmingWeightIgnoreLow || weight >= 200) { - config.eliteFarmingWeightPos.renderStrings(display, posLabel = "Farming Weight Display") - } + if (isEnabled() && config.eliteFarmingWeightIgnoreLow || weight >= 200) { + config.eliteFarmingWeightPos.renderStrings(display, posLabel = "Farming Weight Display") } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt index 4943722fe..5f82e690b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropMilestoneDisplay.kt @@ -122,10 +122,8 @@ object GardenCropMilestoneDisplay { progressDisplay = drawProgressDisplay(it) } - if (config.cropMilestoneBestDisplay) { - if (config.cropMilestoneBestAlwaysOn || currentCrop != null) { - bestCropTime.display = bestCropTime.drawBestDisplay(currentCrop) - } + if (config.cropMilestoneBestDisplay && config.cropMilestoneBestAlwaysOn || currentCrop != null) { + bestCropTime.display = bestCropTime.drawBestDisplay(currentCrop) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt index c7817066e..d557d89d9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt @@ -114,7 +114,7 @@ object GardenCropSpeed { toolName.endsWith("DICER_3") -> 2 else -> -1 } - if (tier != -1 && melonDicer.size > 0 && pumpkinDicer.size > 0) { + if (tier != -1 && melonDicer.isNotEmpty() && pumpkinDicer.isNotEmpty()) { if (it == CropType.MELON) { latestMelonDicer = melonDicer[tier] } else if (it == CropType.PUMPKIN) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WrongFungiCutterWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WrongFungiCutterWarning.kt index 916c31524..3ee90913e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WrongFungiCutterWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/WrongFungiCutterWarning.kt @@ -34,15 +34,11 @@ class WrongFungiCutterWarning { if (event.crop != CropType.MUSHROOM) return val toString = event.blockState.toString() - if (toString == "minecraft:red_mushroom") { - if (mode == FungiMode.BROWN) { - notifyWrong() - } + if (toString == "minecraft:red_mushroom" && mode == FungiMode.BROWN) { + notifyWrong() } - if (toString == "minecraft:brown_mushroom") { - if (mode == FungiMode.RED) { - notifyWrong() - } + if (toString == "minecraft:brown_mushroom" && mode == FungiMode.RED) { + notifyWrong() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt index b89677aa0..b1e531329 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt @@ -136,33 +136,25 @@ class CaptureFarmingGear { for ((_, item) in event.inventoryItems) { val split = item.getInternalName_old().split(";") - if (split.first() == "ELEPHANT") { - if (split.last().toInt() > highestElephantRarity) { - farmingItems[FarmingItems.ELEPHANT] = item - outdatedItems[FarmingItems.ELEPHANT] = false - highestElephantRarity = split.last().toInt() - } + if (split.first() == "ELEPHANT" && split.last().toInt() > highestElephantRarity) { + farmingItems[FarmingItems.ELEPHANT] = item + outdatedItems[FarmingItems.ELEPHANT] = false + highestElephantRarity = split.last().toInt() } - if (split.first() == "MOOSHROOM_COW") { - if (split.last().toInt() > highestMooshroomRarity) { - farmingItems[FarmingItems.MOOSHROOM_COW] = item - outdatedItems[FarmingItems.MOOSHROOM_COW] = false - highestMooshroomRarity = split.last().toInt() - } + if (split.first() == "MOOSHROOM_COW" && split.last().toInt() > highestMooshroomRarity) { + farmingItems[FarmingItems.MOOSHROOM_COW] = item + outdatedItems[FarmingItems.MOOSHROOM_COW] = false + highestMooshroomRarity = split.last().toInt() } - if (split.first() == "RABBIT") { - if (split.last().toInt() > highestRabbitRarity) { - farmingItems[FarmingItems.RABBIT] = item - outdatedItems[FarmingItems.RABBIT] = false - highestRabbitRarity = split.last().toInt() - } + if (split.first() == "RABBIT" && split.last().toInt() > highestRabbitRarity) { + farmingItems[FarmingItems.RABBIT] = item + outdatedItems[FarmingItems.RABBIT] = false + highestRabbitRarity = split.last().toInt() } - if (split.first() == "BEE") { - if (split.last().toInt() > highestBeeRarity) { + if (split.first() == "BEE" && split.last().toInt() > highestBeeRarity) { farmingItems[FarmingItems.BEE] = item outdatedItems[FarmingItems.BEE] = false highestBeeRarity = split.last().toInt() - } } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt index 53585603b..b1d1a0f38 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt @@ -207,11 +207,9 @@ open class FFGuideGUI : GuiScreen() { if (Mouse.getEventButtonState()) { mouseClickEvent() } - if (!Mouse.getEventButtonState()) { - if (Mouse.getEventDWheel() != 0) { - lastMouseScroll = Mouse.getEventDWheel() - noMouseScrollFrames = 0 - } + if (!Mouse.getEventButtonState() && Mouse.getEventDWheel() != 0) { + lastMouseScroll = Mouse.getEventDWheel() + noMouseScrollFrames = 0 } } @@ -271,22 +269,18 @@ open class FFGuideGUI : GuiScreen() { x = guiLeft - 28 y = guiTop + 15 - if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x, y, 28, 25)) { - if (selectedPage != FortuneGuidePage.CROP && selectedPage != FortuneGuidePage.OVERVIEW) { + if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x, y, 28, 25) && selectedPage != FortuneGuidePage.CROP && selectedPage != FortuneGuidePage.OVERVIEW) { SoundUtils.playClickSound() selectedPage = if (currentCrop == null) { FortuneGuidePage.OVERVIEW } else { FortuneGuidePage.CROP } - } } y += 30 - if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x, y, 28, 25)) { - if (selectedPage != FortuneGuidePage.UPGRADES) { + if (GuiRenderUtils.isPointInRect(mouseX, mouseY, x, y, 28, 25) && selectedPage != FortuneGuidePage.UPGRADES) { selectedPage = FortuneGuidePage.UPGRADES SoundUtils.playClickSound() - } } if (selectedPage != FortuneGuidePage.UPGRADES) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index ea23494c7..b618c1937 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -338,14 +338,12 @@ class GardenVisitorFeatures { GardenVisitorDropStatistics.saveAndUpdate() return } - if (event.slotId == 29) { - if (event.slot.stack?.getLore()?.any { it == "§eClick to give!" } == true) { - changeStatus(visitor, VisitorStatus.ACCEPTED, "accepted") - update() - GardenVisitorDropStatistics.coinsSpent += round(lastFullPrice).toLong() - GardenVisitorDropStatistics.lastAccept = System.currentTimeMillis() - return - } + if (event.slotId == 29 && event.slot.stack?.getLore()?.any { it == "§eClick to give!" } == true) { + changeStatus(visitor, VisitorStatus.ACCEPTED, "accepted") + update() + GardenVisitorDropStatistics.coinsSpent += round(lastFullPrice).toLong() + GardenVisitorDropStatistics.lastAccept = System.currentTimeMillis() + return } } @@ -358,10 +356,8 @@ class GardenVisitorFeatures { if (config.visitorHighlightStatus != 1 && config.visitorHighlightStatus != 2) return val entity = event.entity - if (entity is EntityArmorStand) { - if (entity.name == "§e§lCLICK") { - event.isCanceled = true - } + if (entity is EntityArmorStand && entity.name == "§e§lCLICK") { + event.isCanceled = true } } @@ -502,7 +498,6 @@ class GardenVisitorFeatures { if (!GardenAPI.inGarden()) return if (!config.visitorNeedsDisplay && config.visitorHighlightStatus == 3) return if (!event.isMod(10)) return -// if (!event.isMod(300)) return if (GardenAPI.onBarnPlot && config.visitorHighlightStatus != 3) { checkVisitorsReady() @@ -624,18 +619,12 @@ class GardenVisitorFeatures { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { - if (config.visitorHypixelArrivedMessage) { - if (newVisitorArrivedMessage.matcher(event.message).matches()) { - event.blockedReason = "new_visitor_arrived" - } + if (config.visitorHypixelArrivedMessage && newVisitorArrivedMessage.matcher(event.message).matches()) { + event.blockedReason = "new_visitor_arrived" } - if (GardenAPI.inGarden()) { - if (config.visitorHideChat) { - if (hideVisitorMessage(event.message)) { + if (GardenAPI.inGarden() && config.visitorHideChat && hideVisitorMessage(event.message)) { event.blockedReason = "garden_visitor_message" - } - } } } @@ -669,18 +658,16 @@ class GardenVisitorFeatures { } } - if (config.visitorHighlightStatus == 0 || config.visitorHighlightStatus == 2) { - if (entity is EntityLivingBase) { - val color = visitor.status.color - if (color != -1) { - RenderLivingEntityHelper.setEntityColor( - entity, - color - ) { config.visitorHighlightStatus == 0 || config.visitorHighlightStatus == 2 } - } - // Haven't gotten either of the known effected visitors (Vex and Leo) so can't test for sure - if (color == -1 || !GardenAPI.inGarden()) RenderLivingEntityHelper.removeEntityColor(entity) + if ((config.visitorHighlightStatus == 0 || config.visitorHighlightStatus == 2) && entity is EntityLivingBase) { + val color = visitor.status.color + if (color != -1) { + RenderLivingEntityHelper.setEntityColor( + entity, + color + ) { config.visitorHighlightStatus == 0 || config.visitorHighlightStatus == 2 } } + // Haven't gotten either of the known effected visitors (Vex and Leo) so can't test for sure + if (color == -1 || !GardenAPI.inGarden()) RenderLivingEntityHelper.removeEntityColor(entity) } } } @@ -777,10 +764,8 @@ class GardenVisitorFeatures { } private fun showGui(): Boolean { - if (config.visitorNeedsInBazaarAlley) { - if (LorenzUtils.skyBlockIsland == IslandType.HUB && LorenzUtils.skyBlockArea == "Bazaar Alley") { - return true - } + if (config.visitorNeedsInBazaarAlley && LorenzUtils.skyBlockIsland == IslandType.HUB && LorenzUtils.skyBlockArea == "Bazaar Alley") { + return true } if (GardenAPI.hideExtraGuis()) return false diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt index 49f1d4bfa..90274b4d6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt @@ -335,7 +335,6 @@ class HideNotClickableItems { if (!chestName.startsWith("Sack of Sacks")) return false if (ItemUtils.isSkyBlockMenuItem(stack)) return false - val name = stack.cleanName() reverseColor = true if (ItemUtils.isSack(stack)) return false @@ -398,11 +397,9 @@ class HideNotClickableItems { return true } - if (!ItemUtils.isRecombobulated(stack)) { - if (LorenzUtils.noTradeMode) { - if (BazaarApi.isBazaarItem(stack)) { - return false - } + if (!ItemUtils.isRecombobulated(stack) && LorenzUtils.noTradeMode) { + if (BazaarApi.isBazaarItem(stack)) { + return false } if (hideNpcSellFilter.match(name)) return false diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt index 44e5cf46f..06e7601c1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -39,92 +39,71 @@ class ItemDisplayOverlayFeatures { } } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(1)) { - if (itemName.matchRegex("(.*)Master Skull - Tier .")) { - return itemName.substring(itemName.length - 1) - } + if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(1) && itemName.matchRegex("(.*)Master Skull - Tier .")) { + return itemName.substring(itemName.length - 1) } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(2)) { - if (itemName.contains("Golden ") || itemName.contains("Diamond ")) { - when { - itemName.contains("Bonzo") -> return "1" - itemName.contains("Scarf") -> return "2" - itemName.contains("Professor") -> return "3" - itemName.contains("Thorn") -> return "4" - itemName.contains("Livid") -> return "5" - itemName.contains("Sadan") -> return "6" - itemName.contains("Necron") -> return "7" - } + if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(2) && itemName.contains("Golden ") || itemName.contains("Diamond ")) { + when { + itemName.contains("Bonzo") -> return "1" + itemName.contains("Scarf") -> return "2" + itemName.contains("Professor") -> return "3" + itemName.contains("Thorn") -> return "4" + itemName.contains("Livid") -> return "5" + itemName.contains("Sadan") -> return "6" + itemName.contains("Necron") -> return "7" } } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(3)) { - if (itemName.startsWith("New Year Cake (")) { - return "§b" + itemName.between("(Year ", ")") - } + if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(3) && itemName.startsWith("New Year Cake (")) { + return "§b" + itemName.between("(Year ", ")") } if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(4)) { val chestName = InventoryUtils.openInventoryName() - if (!chestName.endsWith("Sea Creature Guide")) { - if (ItemUtils.isPet(itemName)) { - petLevelPattern.matchMatcher(itemName) { - val level = group("level").toInt() - if (level != ItemUtils.maxPetLevel(itemName)) { - return "$level" - } + if (!chestName.endsWith("Sea Creature Guide") && ItemUtils.isPet(itemName)) { + petLevelPattern.matchMatcher(itemName) { + val level = group("level").toInt() + if (level != ItemUtils.maxPetLevel(itemName)) { + return "$level" } } } } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(5)) { - if (itemName.contains(" Minion ")) { - if (item.getLore().any { it.contains("Place this minion") }) { - val array = itemName.split(" ") - val last = array[array.size - 1] - return last.romanToDecimal().toString() - } - } + if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(5) && itemName.contains(" Minion ") && item.getLore().any { it.contains("Place this minion") }) { + val array = itemName.split(" ") + val last = array[array.size - 1] + return last.romanToDecimal().toString() } - if (SkyHanniMod.feature.inventory.displaySackName) { - if (ItemUtils.isSack(item)) { - val sackName = grabSackName(itemName) - return (if (itemName.contains("Enchanted")) "§5" else "") + sackName.substring(0, 2) - } + if (SkyHanniMod.feature.inventory.displaySackName && ItemUtils.isSack(item)) { + val sackName = grabSackName(itemName) + return (if (itemName.contains("Enchanted")) "§5" else "") + sackName.substring(0, 2) } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(8)) { - if (itemName.contains("Kuudra Key")) { - return when (itemName) { - "Kuudra Key" -> "§a1" - "Hot Kuudra Key" -> "§22" - "Burning Kuudra Key" -> "§e3" - "Fiery Kuudra Key" -> "§64" - "Infernal Kuudra Key" -> "§c5" - else -> "§4?" - } + if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(8) && itemName.contains("Kuudra Key")) { + return when (itemName) { + "Kuudra Key" -> "§a1" + "Hot Kuudra Key" -> "§22" + "Burning Kuudra Key" -> "§e3" + "Fiery Kuudra Key" -> "§64" + "Infernal Kuudra Key" -> "§c5" + else -> "§4?" } } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(9)) { - if (InventoryUtils.openInventoryName() == "Your Skills") { - if (item.getLore().any { it.contains("Click to view!") }) { - if (CollectionAPI.isCollectionTier0(item.getLore())) return "0" - val split = itemName.split(" ") - if (split.size < 2) return "0" - if (!itemName.contains("Dungeon")) { - val text = split.last() - return "" + text.romanToDecimalIfNeeded() - } - } + if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(9) && InventoryUtils.openInventoryName() == "Your Skills" && item.getLore().any { it.contains("Click to view!") }) { + if (CollectionAPI.isCollectionTier0(item.getLore())) return "0" + val split = itemName.split(" ") + if (split.size < 2) return "0" + if (!itemName.contains("Dungeon")) { + val text = split.last() + return "" + text.romanToDecimalIfNeeded() } } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(10)) { - if (InventoryUtils.openInventoryName().endsWith(" Collections")) { + if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(10) && InventoryUtils.openInventoryName().endsWith(" Collections")) { val lore = item.getLore() if (lore.any { it.contains("Click to view!") }) { if (CollectionAPI.isCollectionTier0(lore)) return "0" @@ -135,44 +114,37 @@ class ItemDisplayOverlayFeatures { } } } - } } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(11)) { - if (itemName.contains("Rancher's Boots")) { - for (line in item.getLore()) { - rancherBootsSpeedCapPattern.matchMatcher(line) { - return group("cap") - } + if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(11) && itemName.contains("Rancher's Boots")) { + for (line in item.getLore()) { + rancherBootsSpeedCapPattern.matchMatcher(line) { + return group("cap") } } } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(12)) { - if (itemName.contains("Larva Hook")) { - for (line in item.getLore()) { - "§7§7You may harvest §6(?<amount>.).*".toPattern().matchMatcher(line) { - val amount = group("amount").toInt() - return when { - amount > 4 -> "§a$amount" - amount > 2 -> "§e$amount" - else -> "§c$amount" - } + if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(12) && itemName.contains("Larva Hook")) { + for (line in item.getLore()) { + "§7§7You may harvest §6(?<amount>.).*".toPattern().matchMatcher(line) { + val amount = group("amount").toInt() + return when { + amount > 4 -> "§a$amount" + amount > 2 -> "§e$amount" + else -> "§c$amount" } } } } - if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(13)) { - if (itemName.startsWith("Dungeon ") && itemName.contains(" Potion")) { - item.name?.let { - "Dungeon (?<level>.*) Potion".toPattern().matchMatcher(it.removeColor()) { - return when (val level = group("level").romanToDecimal()) { - in 1..2 -> "§f$level" - in 3..4 -> "§a$level" - in 5..6 -> "§9$level" - else -> "§5$level" - } + if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(13) && itemName.startsWith("Dungeon ") && itemName.contains(" Potion")) { + item.name?.let { + "Dungeon (?<level>.*) Potion".toPattern().matchMatcher(it.removeColor()) { + return when (val level = group("level").romanToDecimal()) { + in 1..2 -> "§f$level" + in 3..4 -> "§a$level" + in 5..6 -> "§9$level" + else -> "§5$level" } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt index eb2ead1fb..697ca0ba9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/RngMeterInventory.kt @@ -21,12 +21,10 @@ class RngMeterInventory { val chestName = InventoryUtils.openInventoryName() val stack = event.stack - if (SkyHanniMod.feature.inventory.rngMeterFloorName) { - if (chestName == "Catacombs RNG Meter") { - val name = stack.name ?: return - if (name.removeColor() == "RNG Meter") { - event.stackTip = stack.getLore()[0].between("(", ")") - } + if (SkyHanniMod.feature.inventory.rngMeterFloorName && chestName == "Catacombs RNG Meter") { + val name = stack.name ?: return + if (name.removeColor() == "RNG Meter") { + event.stackTip = stack.getLore()[0].between("(", ")") } } } @@ -36,24 +34,20 @@ class RngMeterInventory { if (!LorenzUtils.inSkyBlock) return val chestName = InventoryUtils.openInventoryName() - if (SkyHanniMod.feature.inventory.rngMeterNoDrop) { - if (chestName == "Catacombs RNG Meter") { - for (slot in InventoryUtils.getItemsInOpenChest()) { - val stack = slot.stack - if (stack.getLore().any { it.contains("You don't have an RNG drop") }) { - slot highlight LorenzColor.RED - } + if (SkyHanniMod.feature.inventory.rngMeterNoDrop && chestName == "Catacombs RNG Meter") { + for (slot in InventoryUtils.getItemsInOpenChest()) { + val stack = slot.stack + if (stack.getLore().any { it.contains("You don't have an RNG drop") }) { + slot highlight LorenzColor.RED } } } - if (SkyHanniMod.feature.inventory.rngMeterSelectedDrop) { - if (chestName.endsWith(" RNG Meter")) { - for (slot in InventoryUtils.getItemsInOpenChest()) { - val stack = slot.stack - if (stack.getLore().any { it.contains("§aSELECTED") }) { - slot highlight LorenzColor.YELLOW - } + if (SkyHanniMod.feature.inventory.rngMeterSelectedDrop && chestName.endsWith(" RNG Meter")) { + for (slot in InventoryUtils.getItemsInOpenChest()) { + val stack = slot.stack + if (stack.getLore().any { it.contains("§aSELECTED") }) { + slot highlight LorenzColor.YELLOW } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt index 02f7d0ee0..afff3b114 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/StatsTuning.kt @@ -22,73 +22,67 @@ class StatsTuning { val stack = event.stack - if (SkyHanniMod.feature.inventory.statsTuningTemplateStats) { - if (inventoryName == "Stats Tuning") { - val name = stack.name ?: return - if (name == "§aLoad") { - var grab = false - val list = mutableListOf<String>() - for (line in stack.getLore()) { - if (line == "§7You are loading:") { - grab = true + if (SkyHanniMod.feature.inventory.statsTuningTemplateStats && inventoryName == "Stats Tuning") { + val name = stack.name ?: return + if (name == "§aLoad") { + var grab = false + val list = mutableListOf<String>() + for (line in stack.getLore()) { + if (line == "§7You are loading:") { + grab = true + continue + } + if (grab) { + if (line == "") { + grab = false continue } - if (grab) { - if (line == "") { - grab = false - continue - } - val text = line.split(":")[0] - list.add(text) - } - } - if (list.isNotEmpty()) { - event.stackTip = list.joinToString(" + ") - event.offsetX = 20 - event.offsetY = -5 - event.alignLeft = false - return + val text = line.split(":")[0] + list.add(text) } } + if (list.isNotEmpty()) { + event.stackTip = list.joinToString(" + ") + event.offsetX = 20 + event.offsetY = -5 + event.alignLeft = false + return + } } } - if (SkyHanniMod.feature.inventory.statsTuningSelectedStats) { - if (inventoryName == "Accessory Bag Thaumaturgy") { - val name = stack.name ?: return - if (name == "§aStats Tuning") { - var grab = false - val list = mutableListOf<String>() - for (line in stack.getLore()) { - if (line == "§7Your tuning:") { - grab = true + if (SkyHanniMod.feature.inventory.statsTuningSelectedStats && inventoryName == "Accessory Bag Thaumaturgy") { + val name = stack.name ?: return + if (name == "§aStats Tuning") { + var grab = false + val list = mutableListOf<String>() + for (line in stack.getLore()) { + if (line == "§7Your tuning:") { + grab = true + continue + } + if (grab) { + if (line == "") { + grab = false continue } - if (grab) { - if (line == "") { - grab = false - continue - } - val text = line.split(":")[0].split(" ")[0] + "§7" - list.add(text) - } - } - if (list.isNotEmpty()) { - event.stackTip = list.joinToString(" + ") - event.offsetX = 3 - event.offsetY = -5 - event.alignLeft = false - return + val text = line.split(":")[0].split(" ")[0] + "§7" + list.add(text) } } + if (list.isNotEmpty()) { + event.stackTip = list.joinToString(" + ") + event.offsetX = 3 + event.offsetY = -5 + event.alignLeft = false + return + } } } - if (SkyHanniMod.feature.inventory.statsTuningPoints) { - if (inventoryName == "Stats Tuning") { - for (line in stack.getLore()) { - patternStatPoints.matchMatcher(line) { - val points = group("amount") - event.stackTip = points - } + if (SkyHanniMod.feature.inventory.statsTuningPoints && inventoryName == "Stats Tuning") { + for (line in stack.getLore()) { + patternStatPoints.matchMatcher(line) { + val points = group("amount") + event.stackTip = points } } } @@ -100,15 +94,13 @@ class StatsTuning { if (!LorenzUtils.inSkyBlock) return val chestName = InventoryUtils.openInventoryName() - if (SkyHanniMod.feature.inventory.statsTuningSelectedTemplate) { - if (chestName == "Stats Tuning") { - for (slot in InventoryUtils.getItemsInOpenChest()) { - val stack = slot.stack - val lore = stack.getLore() + if (SkyHanniMod.feature.inventory.statsTuningSelectedTemplate && chestName == "Stats Tuning") { + for (slot in InventoryUtils.getItemsInOpenChest()) { + val stack = slot.stack + val lore = stack.getLore() - if (lore.any { it == "§aCurrently selected!" }) { - slot highlight LorenzColor.GREEN - } + if (lore.any { it == "§aCurrently selected!" }) { + slot highlight LorenzColor.GREEN } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt index 64288cbcf..c1e534a94 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt @@ -109,7 +109,6 @@ enum class ItemAbility( } fun setItemClick() { -// println("newClick $this") lastItemClick = System.currentTimeMillis() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt index b56661cd0..d4ebeaea6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt @@ -41,23 +41,18 @@ class ItemAbilityCooldown { @SubscribeEvent fun onSoundEvent(event: PlaySoundEvent) { - if (event.soundName == "mob.zombie.remedy") { - if (event.pitch == 0.6984127f && event.volume == 1f) { - val abilityScrolls = InventoryUtils.getItemInHand()?.getAbilityScrolls() ?: return - if (abilityScrolls.size != 3) return + //TODO: add comment labels for these + if (event.soundName == "mob.zombie.remedy" && event.pitch == 0.6984127f && event.volume == 1f) { + val abilityScrolls = InventoryUtils.getItemInHand()?.getAbilityScrolls() ?: return + if (abilityScrolls.size != 3) return - ItemAbility.HYPERION.sound() - } + ItemAbility.HYPERION.sound() } - if (event.soundName == "liquid.lavapop") { - if (event.pitch == 1.0f && event.volume == 1f) { - ItemAbility.FIRE_FURY_STAFF.sound() - } + if (event.soundName == "liquid.lavapop" && event.pitch == 1.0f && event.volume == 1f) { + ItemAbility.FIRE_FURY_STAFF.sound() } - if (event.soundName == "mob.enderdragon.growl") { - if (event.pitch == 1f && event.volume == 1f) { - ItemAbility.ICE_SPRAY_WAND.sound() - } + if (event.soundName == "mob.enderdragon.growl" && event.pitch == 1f && event.volume == 1f) { + ItemAbility.ICE_SPRAY_WAND.sound() } if (event.soundName == "mob.endermen.portal") { if (event.pitch == 0.61904764f && event.volume == 1f) { @@ -74,104 +69,65 @@ class ItemAbilityCooldown { ItemAbility.SHADOW_FURY.sound() } } - if (event.soundName == "random.anvil_land") { - if (event.pitch == 0.4920635f && event.volume == 1f) { - ItemAbility.GIANTS_SWORD.sound() - } + if (event.soundName == "random.anvil_land" && event.pitch == 0.4920635f && event.volume == 1f) { + ItemAbility.GIANTS_SWORD.sound() } - if (event.soundName == "mob.ghast.affectionate_scream") { - if (event.pitch == 0.4920635f && event.volume == 0.15f) { - ItemAbility.ATOMSPLIT_KATANA.sound() - } + if (event.soundName == "mob.ghast.affectionate_scream" && event.pitch == 0.4920635f && event.volume == 0.15f) { + ItemAbility.ATOMSPLIT_KATANA.sound() } -// if (event.soundName == "random.click") { -// if (event.pitch == 2.0f && event.volume == 0.55f) { -// ItemAbility.RAGNAROCK_AXE.sound() -// } -// } - if (event.soundName == "liquid.lavapop") { - if (event.pitch == 0.7619048f && event.volume == 0.15f) { - ItemAbility.WAND_OF_ATONEMENT.sound() - } + if (event.soundName == "liquid.lavapop" && event.pitch == 0.7619048f && event.volume == 0.15f) { + ItemAbility.WAND_OF_ATONEMENT.sound() } - if (event.soundName == "mob.bat.hurt") { - if (event.volume == 0.1f) { - ItemAbility.STARLIGHT_WAND.sound() - } + if (event.soundName == "mob.bat.hurt" && event.volume == 0.1f) { + ItemAbility.STARLIGHT_WAND.sound() } - if (event.soundName == "mob.guardian.curse") { - if (event.volume == 0.2f) { - ItemAbility.VOODOO_DOLL.sound() - } + if (event.soundName == "mob.guardian.curse" && event.volume == 0.2f) { + ItemAbility.VOODOO_DOLL.sound() } - if (event.soundName == "random.successful_hit") { // Jinxed Voodoo Doll Hit - if (event.volume == 1.0f && event.pitch == 0.7936508f) { + if (event.soundName == "random.successful_hit" && event.volume == 1.0f && event.pitch == 0.7936508f) { // Jinxed Voodoo Doll Hit + ItemAbility.VOODOO_DOLL_WILTED.sound() + } + if (event.soundName == "mob.ghast.scream" && event.volume == 1.0f && event.pitch >= 1.6 && event.pitch <= 1.7) { // Jinxed Voodoo Doll Miss + val recentItems = InventoryUtils.recentItemsInHand.values + if (VOODOO_DOLL_WILTED in recentItems) { ItemAbility.VOODOO_DOLL_WILTED.sound() } } - if (event.soundName == "mob.ghast.scream") { // Jinxed Voodoo Doll Miss - if (event.volume == 1.0f && event.pitch >= 1.6 && event.pitch <= 1.7) { - val recentItems = InventoryUtils.recentItemsInHand.values - if (VOODOO_DOLL_WILTED in recentItems) { - ItemAbility.VOODOO_DOLL_WILTED.sound() - } - } + if (event.soundName == "random.explode" && event.pitch == 4.047619f && event.volume == 0.2f) { + ItemAbility.GOLEM_SWORD.sound() } - if (event.soundName == "random.explode") { - if (event.pitch == 4.047619f && event.volume == 0.2f) { - ItemAbility.GOLEM_SWORD.sound() + if (event.soundName == "mob.wolf.howl" && event.volume == 0.5f) { + val recentItems = InventoryUtils.recentItemsInHand.values + if (WEIRD_TUBA in recentItems) { + ItemAbility.WEIRD_TUBA.sound() } - } - if (event.soundName == "mob.wolf.howl") { - if (event.volume == 0.5f) { - val recentItems = InventoryUtils.recentItemsInHand.values - if (WEIRD_TUBA in recentItems) { - ItemAbility.WEIRD_TUBA.sound() - } - if (WEIRDER_TUBA in recentItems) { - ItemAbility.WEIRDER_TUBA.sound() - } + if (WEIRDER_TUBA in recentItems) { + ItemAbility.WEIRDER_TUBA.sound() } } - if (event.soundName == "mob.zombie.unfect") { - if (event.pitch == 2.0f && event.volume == 0.3f) { - ItemAbility.END_STONE_SWORD.sound() - } + if (event.soundName == "mob.zombie.unfect" && event.pitch == 2.0f && event.volume == 0.3f) { + ItemAbility.END_STONE_SWORD.sound() } - if (event.soundName == "mob.wolf.panting") { - if (event.pitch == 1.3968254f && event.volume == 0.4f) { - ItemAbility.SOUL_ESOWARD.sound() - } + if (event.soundName == "mob.wolf.panting" && event.pitch == 1.3968254f && event.volume == 0.4f) { + ItemAbility.SOUL_ESOWARD.sound() } - if (event.soundName == "mob.zombiepig.zpigangry") { - if (event.pitch == 2.0f && event.volume == 0.3f) { - ItemAbility.PIGMAN_SWORD.sound() - } + if (event.soundName == "mob.zombiepig.zpigangry" && event.pitch == 2.0f && event.volume == 0.3f) { + ItemAbility.PIGMAN_SWORD.sound() } - if (event.soundName == "mob.ghast.fireball") { - if (event.pitch == 1.0f && event.volume == 0.3f) { - ItemAbility.EMBER_ROD.sound() - } + if (event.soundName == "mob.ghast.fireball" && event.pitch == 1.0f && event.volume == 0.3f) { + ItemAbility.EMBER_ROD.sound() } - if (event.soundName == "mob.guardian.elder.idle") { - if (event.pitch == 2.0f && event.volume == 0.2f) { - ItemAbility.FIRE_FREEZE_STAFF.sound() - } + if (event.soundName == "mob.guardian.elder.idle" && event.pitch == 2.0f && event.volume == 0.2f) { + ItemAbility.FIRE_FREEZE_STAFF.sound() } - if (event.soundName == "random.explode") { - if (event.pitch == 0.4920635f && event.volume == 0.5f) { - ItemAbility.STAFF_OF_THE_VOLCANO.sound() - } + if (event.soundName == "random.explode" && event.pitch == 0.4920635f && event.volume == 0.5f) { + ItemAbility.STAFF_OF_THE_VOLCANO.sound() } - if (event.soundName == "random.eat") { - if (event.pitch == 1.0f && event.volume == 1.0f) { - ItemAbility.STAFF_OF_THE_VOLCANO.sound() - } + if (event.soundName == "random.eat" && event.pitch == 1.0f && event.volume == 1.0f) { + ItemAbility.STAFF_OF_THE_VOLCANO.sound() } - if (event.soundName == "random.drink") { - if (event.pitch.round(1) == 1.8f && event.volume == 1.0f) { - ItemAbility.HOLY_ICE.sound() - } + if (event.soundName == "random.drink" && event.pitch.round(1) == 1.8f && event.volume == 1.0f) { + ItemAbility.HOLY_ICE.sound() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt index 852c17bae..2f4c3a59b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt @@ -177,10 +177,8 @@ class MinionFeatures { if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return if (coinsPerDay != "") return - if (Minecraft.getMinecraft().currentScreen is GuiChest) { - if (config.hopperProfitDisplay) { - coinsPerDay = if (minionInventoryOpen) updateCoinsPerDay() else "" - } + if (Minecraft.getMinecraft().currentScreen is GuiChest && config.hopperProfitDisplay) { + coinsPerDay = if (minionInventoryOpen) updateCoinsPerDay() else "" } } @@ -232,24 +230,19 @@ class MinionFeatures { if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return val message = event.message - if (message.matchRegex("§aYou received §r§6(.*) coins§r§a!")) { - if (System.currentTimeMillis() - lastInventoryClosed < 2_000) { + if (message.matchRegex("§aYou received §r§6(.*) coins§r§a!") && System.currentTimeMillis() - lastInventoryClosed < 2_000) { minions?.get(lastMinion)?.let { - it.lastClicked = System.currentTimeMillis() - } + it.lastClicked = System.currentTimeMillis() } } - if (message.startsWith("§aYou picked up a minion!")) { - if (lastMinion != null) { - minions = minions?.editCopy { remove(lastMinion) } - lastClickedEntity = null - lastMinion = null - lastMinionOpened = 0L - } + if (message.startsWith("§aYou picked up a minion!") && lastMinion != null) { + minions = minions?.editCopy { remove(lastMinion) } + lastClickedEntity = null + lastMinion = null + lastMinionOpened = 0L } - if (message.startsWith("§bYou placed a minion!")) { - if (newMinion != null) { + if (message.startsWith("§bYou placed a minion!") && newMinion != null) { minions = minions?.editCopy { this[newMinion!!] = Storage.ProfileSpecific.MinionConfig().apply { displayName = newMinionName @@ -258,7 +251,6 @@ class MinionFeatures { } newMinion = null newMinionName = null - } } minionUpgradePattern.matchMatcher(message) { @@ -293,13 +285,11 @@ class MinionFeatures { event.drawString(location.add(0.0, 0.65, 0.0), name, true) } - if (config.emptiedTimeDisplay) { - if (lastEmptied != 0L) { - val duration = System.currentTimeMillis() - lastEmptied - val format = TimeUtils.formatDuration(duration, longName = true) + " ago" - val text = "§eHopper Emptied: $format" - event.drawString(location.add(0.0, 1.15, 0.0), text, true) - } + if (config.emptiedTimeDisplay && lastEmptied != 0L) { + val duration = System.currentTimeMillis() - lastEmptied + val format = TimeUtils.formatDuration(duration, longName = true) + " ago" + val text = "§eHopper Emptied: $format" + event.drawString(location.add(0.0, 1.15, 0.0), text, true) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ChumBucketHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ChumBucketHider.kt index c4c071a19..4c320c751 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ChumBucketHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ChumBucketHider.kt @@ -60,15 +60,13 @@ class ChumBucketHider { } // Chum Bucket - if (config.hideBucket.get()) { - if (entity.inventory.any { it != null && (it.name == "§fEmpty Chum Bucket" || it.name == "§aEmpty Chumcap Bucket")}) { - val entityLocation = entity.getLorenzVec() - for (title in titleEntity) { - if (entityLocation.equalsIgnoreY(title.getLorenzVec())) { - hiddenEntities.add(entity) - event.isCanceled = true - return - } + if (config.hideBucket.get() && entity.inventory.any { it != null && (it.name == "§fEmpty Chum Bucket" || it.name == "§aEmpty Chumcap Bucket") }) { + val entityLocation = entity.getLorenzVec() + for (title in titleEntity) { + if (entityLocation.equalsIgnoreY(title.getLorenzVec())) { + hiddenEntities.add(entity) + event.isCanceled = true + return } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt index 671097085..fb74409ab 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CollectionTracker.kt @@ -50,15 +50,12 @@ class CollectionTracker { val rawName = fixTypo(args.joinToString(" ").lowercase().replace("_", " ")) if (rawName == "gemstone") { LorenzUtils.chat("§c[SkyHanni] Gemstone collection is not supported!") -// setNewCollection("GEMSTONE_COLLECTION", "Gemstone") return } else if (rawName == "mushroom") { LorenzUtils.chat("§c[SkyHanni] Mushroom collection is not supported!") -// setNewCollection("MUSHROOM_COLLECTION", "Mushroom") return } -// val foundInternalName = NEUItems.getInternalNameOrNullIgnoreCase(rawName) ?: rawName.replace(" ", "_") val foundInternalName = NEUItems.getInternalNameOrNullIgnoreCase(rawName) if (foundInternalName == null) { LorenzUtils.chat("§c[SkyHanni] Item '$rawName' does not exist!") @@ -172,21 +169,17 @@ class CollectionTracker { val currentlyInInventory = countCurrentlyInInventory() val diff = currentlyInInventory - lastAmountInInventory - if (diff != 0) { - if (diff > 0) { + if (diff != 0 && diff > 0) { gainItems(diff) - } } lastAmountInInventory = currentlyInInventory } private fun updateGain() { - if (recentGain != 0) { - if (System.currentTimeMillis() > lastGainTime + RECENT_GAIN_TIME) { - recentGain = 0 - updateDisplay() - } + if (recentGain != 0 && System.currentTimeMillis() > lastGainTime + RECENT_GAIN_TIME) { + recentGain = 0 + updateDisplay() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt index 7f7a0cc91..3a9a47830 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/JoinCrystalHollows.kt @@ -29,10 +29,8 @@ class JoinCrystalHollows { LorenzUtils.chat("§e[SkyHanni] Buy a §2Crystal Hollows Pass §efrom §5Gwendolyn") } } - if (message == "§e[NPC] §5Gwendolyn§f: §rGreat! Now hop on into the Minecart and I'll get you on your way!") { - if (inTime()) { - LorenzUtils.clickableChat("§e[SkyHanni] Click here to warp to Crystal Hollows!", "warp ch") - } + if (message == "§e[NPC] §5Gwendolyn§f: §rGreat! Now hop on into the Minecart and I'll get you on your way!" && inTime()) { + LorenzUtils.clickableChat("§e[SkyHanni] Click here to warp to Crystal Hollows!", "warp ch") } } @@ -40,10 +38,8 @@ class JoinCrystalHollows { fun onIslandChange(event: IslandChangeEvent) { if (!isEnabled()) return - if (event.newIsland == IslandType.DWARVEN_MINES) { - if (inTime()) { + if (event.newIsland == IslandType.DWARVEN_MINES && inTime()) { LorenzUtils.chat("§e[SkyHanni] Buy a §2Crystal Hollows Pass §efrom §5Gwendolyn§e!") - } } if (event.newIsland == IslandType.CRYSTAL_HOLLOWS) { lastWrongPassTime = 0 diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt index 4b177722d..0e88420c6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ParticleHider.kt @@ -17,31 +17,23 @@ class ParticleHider { @SubscribeEvent fun onHypExplosions(event: ReceiveParticleEvent) { val distanceToPlayer = event.distanceToPlayer - if (SkyHanniMod.feature.misc.hideFarParticles) { - if (distanceToPlayer > 40 && !inM7Boss()) { - event.isCanceled = true - return - } + if (SkyHanniMod.feature.misc.hideFarParticles && distanceToPlayer > 40 && !inM7Boss()) { + event.isCanceled = true + return } val type = event.type - if (SkyHanniMod.feature.misc.hideCloseRedstoneparticles) { - if (type == EnumParticleTypes.REDSTONE) { - if (distanceToPlayer < 2) { - event.isCanceled = true - return - } - } + if (SkyHanniMod.feature.misc.hideCloseRedstoneparticles && type == EnumParticleTypes.REDSTONE && distanceToPlayer < 2) { + event.isCanceled = true + return } - if (SkyHanniMod.feature.misc.hideFireballParticles) { - if (type == EnumParticleTypes.SMOKE_NORMAL || type == EnumParticleTypes.SMOKE_LARGE) { - for (entity in EntityUtils.getEntities<EntitySmallFireball>()) { - val distance = entity.getLorenzVec().distance(event.location) - if (distance < 5) { - event.isCanceled = true - return - } + if (SkyHanniMod.feature.misc.hideFireballParticles && (type == EnumParticleTypes.SMOKE_NORMAL || type == EnumParticleTypes.SMOKE_LARGE)) { + for (entity in EntityUtils.getEntities<EntitySmallFireball>()) { + val distance = entity.getLorenzVec().distance(event.location) + if (distance < 5) { + event.isCanceled = true + return } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt index b4a0ec53f..e59ccab3b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/QuickModMenuSwitch.kt @@ -140,7 +140,6 @@ object QuickModMenuSwitch { when (mod.command) { "patcher" -> { println("try opening patcher") - // GuiUtil.open(Objects.requireNonNull(Patcher.instance.getPatcherConfig().gui())) val patcher = Class.forName("club.sk1er.patcher.Patcher") val instance = patcher.getDeclaredField("instance").get(null) val config = instance.javaClass.getDeclaredMethod("getPatcherConfig").invoke(instance) @@ -159,7 +158,6 @@ object QuickModMenuSwitch { "hytil" -> { println("try opening hytil") - // HytilsReborn.INSTANCE.getConfig().openGui() val hytilsReborn = Class.forName("cc.woverflow.hytils.HytilsReborn") val instance = hytilsReborn.getDeclaredField("INSTANCE").get(null) val config = instance.javaClass.getDeclaredMethod("getConfig").invoke(instance) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt index 610acc9a2..f87e249a4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt @@ -26,9 +26,7 @@ class ServerRestartTitle { val minutes = group("minutes").toInt() val seconds = group("seconds").toInt() val totalSeconds = minutes * 60 + seconds - if (totalSeconds > 120) { - if (totalSeconds % 30 != 0) return - } + if (totalSeconds > 120 && totalSeconds % 30 != 0) return val time = TimeUtils.formatDuration(totalSeconds.toLong() * 1000) TitleUtils.sendTitle("§cServer Restart in §b$time", 2.seconds) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt index 611a40853..5999b3c62 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt @@ -276,18 +276,14 @@ object GhostCounter { val res = current.formatNumber().toString() gain = (res.toLong() - lastXp.toLong()).toDouble().roundToInt() num = (gain.toDouble() / gained) - if (gained in 150.0..450.0) { - if (lastXp != "0") { - if (num >= 0) { - KILLS.add(num) - KILLS.add(num, true) - Option.GHOSTSINCESORROW.add(num) - Option.KILLCOMBO.add(num) - Option.SKILLXPGAINED.add(gained * num.roundToLong()) - Option.SKILLXPGAINED.add(gained * num.roundToLong(), true) - hidden?.bestiaryCurrentKill = hidden?.bestiaryCurrentKill?.plus(num) ?: num - } - } + if (gained in 150.0..450.0 && lastXp != "0" && num >= 0) { + KILLS.add(num) + KILLS.add(num, true) + Option.GHOSTSINCESORROW.add(num) + Option.KILLCOMBO.add(num) + Option.SKILLXPGAINED.add(gained * num.roundToLong()) + Option.SKILLXPGAINED.add(gained * num.roundToLong(), true) + hidden?.bestiaryCurrentKill = hidden?.bestiaryCurrentKill?.plus(num) ?: num } lastXp = res } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt index bc5380f81..94d5b4eeb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt @@ -642,8 +642,8 @@ object EstimatedItemValue { // efficiency 1-5 is cheap, 6-10 is handled by silex if (rawName == "efficiency") continue - if (rawName == "scavenger" && rawLevel == 5) { - if (internalName in hasAlwaysScavenger) continue + if (rawName == "scavenger" && rawLevel == 5 && internalName in hasAlwaysScavenger) { + continue } var level = rawLevel diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/PlayerTabComplete.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/PlayerTabComplete.kt index 27430c5de..28c9733a4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/PlayerTabComplete.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/tabcomplete/PlayerTabComplete.kt @@ -55,38 +55,29 @@ object PlayerTabComplete { return buildList { - if (config.friends) { - if (PlayerCategory.FRIENDS !in ignored) { - FriendAPI.getAllFriends().filter { it.bestFriend || !config.onlyBestFriends } - .forEach { add(it.name) } - } + if (config.friends && PlayerCategory.FRIENDS !in ignored) { + FriendAPI.getAllFriends().filter { it.bestFriend || !config.onlyBestFriends } + .forEach { add(it.name) } } - if (config.islandPlayers) { - if (PlayerCategory.ISLAND_PLAYERS !in ignored) { - for (entity in Minecraft.getMinecraft().theWorld.playerEntities) { - if (!entity.isNPC() && entity is EntityOtherPlayerMP) { - add(entity.name) - } + if (config.islandPlayers && PlayerCategory.ISLAND_PLAYERS !in ignored) { + for (entity in Minecraft.getMinecraft().theWorld.playerEntities) { + if (!entity.isNPC() && entity is EntityOtherPlayerMP) { + add(entity.name) } } } - if (config.party) { - if (PlayerCategory.PARTY !in ignored) { - for (member in PartyAPI.partyMembers) { - add(member) - } + if (config.party && PlayerCategory.PARTY !in ignored) { + for (member in PartyAPI.partyMembers) { + add(member) } - } - if (config.vipVisits) { - if (command == "visit") { - vipVisitsJson?.let { - for (visit in it.vipVisits) { - add(visit) - } + if (config.vipVisits && command == "visit") { + vipVisitsJson?.let { + for (visit in it.vipVisits) { + add(visit) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt index be912f393..8d7c52c7b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt @@ -27,10 +27,8 @@ class TiaRelayHelper { if (!LorenzUtils.inSkyBlock) return val soundName = event.soundName - if (config.tiaRelayMute) { - if (soundName == "mob.wolf.whine") { - event.isCanceled = true - } + if (config.tiaRelayMute && soundName == "mob.wolf.whine") { + event.isCanceled = true } if (!config.soundHelper) return @@ -114,13 +112,11 @@ class TiaRelayHelper { return } - if (!sounds.contains(slotNumber)) { - if (stack.getLore().any { it.contains("Hear!") }) { - event.stackTip = "Hear!" - event.offsetX = 5 - event.offsetY = -5 - return - } + if (!sounds.contains(slotNumber) && stack.getLore().any { it.contains("Hear!") }) { + event.stackTip = "Hear!" + event.offsetX = 5 + event.offsetY = -5 + return } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt index 336a987fc..fab56b5af 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt @@ -69,13 +69,11 @@ object TrevorFeatures { fixedRateTimer(name = "skyhanni-update-trapper", period = 1000L) { Minecraft.getMinecraft().addScheduledTask { try { - if (config.trapperSolver) { - if (onFarmingIsland()) { - updateTrapper() - TrevorTracker.saveAndUpdate() - TrevorTracker.calculatePeltsPerHour() - if (questActive) TrevorSolver.findMob() - } + if (config.trapperSolver && onFarmingIsland()) { + updateTrapper() + TrevorTracker.saveAndUpdate() + TrevorTracker.calculatePeltsPerHour() + if (questActive) TrevorSolver.findMob() } } catch (error: Throwable) { CopyErrorCommand.logError(error, "Encountered an error when updating the trapper solver") @@ -137,11 +135,9 @@ object TrevorFeatures { val siblings = event.chatComponent.siblings for (sibling in siblings) { - if (sibling.chatStyle.chatClickEvent != null) { - if (sibling.chatStyle.chatClickEvent.value.contains("YES")) { - lastChatPromptTime = System.currentTimeMillis() - lastChatPrompt = sibling.chatStyle.chatClickEvent.value.drop(1) - } + if (sibling.chatStyle.chatClickEvent != null && sibling.chatStyle.chatClickEvent.value.contains("YES")) { + lastChatPromptTime = System.currentTimeMillis() + lastChatPrompt = sibling.chatStyle.chatClickEvent.value.drop(1) } } } @@ -220,14 +216,12 @@ object TrevorFeatures { var entityTrapper = Minecraft.getMinecraft().theWorld.getEntityByID(trapperID) if (entityTrapper !is EntityLivingBase) entityTrapper = Minecraft.getMinecraft().theWorld.getEntityByID(backupTrapperID) - if (entityTrapper is EntityLivingBase) { - if (config.trapperTalkCooldown) { - RenderLivingEntityHelper.setEntityColor(entityTrapper, currentStatus.color) - { config.trapperTalkCooldown } - entityTrapper.getLorenzVec().let { - if (it.distanceToPlayer() < 15) { - event.drawString(it.add(0.0, 2.23, 0.0), currentLabel) - } + if (entityTrapper is EntityLivingBase && config.trapperTalkCooldown) { + RenderLivingEntityHelper.setEntityColor(entityTrapper, currentStatus.color) + { config.trapperTalkCooldown } + entityTrapper.getLorenzVec().let { + if (it.distanceToPlayer() < 15) { + event.drawString(it.add(0.0, 2.23, 0.0), currentLabel) } } } @@ -261,14 +255,12 @@ object TrevorFeatures { if (NEUItems.neuHasFocus()) return val key = if (Keyboard.getEventKey() == 0) Keyboard.getEventCharacter().code + 256 else Keyboard.getEventKey() if (config.keyBindWarpTrapper == key) { - if (lastChatPromptTime != -1L && config.acceptQuest && !questActive) { - if (System.currentTimeMillis() - 200 > lastChatPromptTime && System.currentTimeMillis() < lastChatPromptTime + 5000) { - lastChatPromptTime = -1L - LorenzUtils.sendCommandToServer(lastChatPrompt) - lastChatPrompt = "" - timeLastWarped = System.currentTimeMillis() - return - } + if (lastChatPromptTime != -1L && config.acceptQuest && !questActive && System.currentTimeMillis() - 200 > lastChatPromptTime && System.currentTimeMillis() < lastChatPromptTime + 5000) { + lastChatPromptTime = -1L + LorenzUtils.sendCommandToServer(lastChatPrompt) + lastChatPrompt = "" + timeLastWarped = System.currentTimeMillis() + return } if (System.currentTimeMillis() - timeLastWarped > 3000 && config.warpToTrapper) { if (System.currentTimeMillis() < teleportBlock + 5000) return @@ -283,10 +275,8 @@ object TrevorFeatures { if (!inTrapperDen()) return if (!config.trapperTalkCooldown) return val entity = event.entity - if (entity is EntityArmorStand) { - if (entity.name == "§e§lCLICK") { - event.isCanceled = true - } + if (entity is EntityArmorStand && entity.name == "§e§lCLICK") { + event.isCanceled = true } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt index f5d87d5e6..f86ea9087 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorSolver.kt @@ -53,33 +53,31 @@ object TrevorSolver { val name = entity.name val entityHealth = if (entity is EntityLivingBase) entity.baseMaxHealth.derpy() else 0 currentMob = TrevorMobs.entries.firstOrNull { it.mobName.contains(name) } - if (animalHealths.any { it == entityHealth }) { - if (currentMob != null) { - if (foundID == entity.entityId) { - val dist = entity.position.toLorenzVec().distanceToPlayer() - if ((currentMob == TrevorMobs.RABBIT || currentMob == TrevorMobs.SHEEP) && mobLocation == CurrentMobArea.OASIS) { - println("This is unfortunate") - } else canSee = LocationUtils.canSee( - LocationUtils.playerEyeLocation(), - entity.position.toLorenzVec().add(0.0, 0.5, 0.0) - ) && dist < currentMob!!.renderDistance + if (animalHealths.any { it == entityHealth } && currentMob != null) { + if (foundID == entity.entityId) { + val dist = entity.position.toLorenzVec().distanceToPlayer() + if ((currentMob == TrevorMobs.RABBIT || currentMob == TrevorMobs.SHEEP) && mobLocation == CurrentMobArea.OASIS) { + println("This is unfortunate") + } else canSee = LocationUtils.canSee( + LocationUtils.playerEyeLocation(), + entity.position.toLorenzVec().add(0.0, 0.5, 0.0) + ) && dist < currentMob!!.renderDistance - if (!canSee) { - val nameTagEntity = Minecraft.getMinecraft().theWorld.getEntityByID(foundID + 1) - if (nameTagEntity is EntityArmorStand) canSee = true - } - if (canSee) { - if (mobLocation != CurrentMobArea.FOUND) { - TitleUtils.sendTitle("§2Saw ${currentMob!!.mobName}!", 3.seconds) - } - mobLocation = CurrentMobArea.FOUND - mobCoordinates = entity.position.toLorenzVec() + if (!canSee) { + val nameTagEntity = Minecraft.getMinecraft().theWorld.getEntityByID(foundID + 1) + if (nameTagEntity is EntityArmorStand) canSee = true + } + if (canSee) { + if (mobLocation != CurrentMobArea.FOUND) { + TitleUtils.sendTitle("§2Saw ${currentMob!!.mobName}!", 3.seconds) } - } else { - foundID = entity.entityId + mobLocation = CurrentMobArea.FOUND + mobCoordinates = entity.position.toLorenzVec() } - return + } else { + foundID = entity.entityId } + return } } if (foundID != -1) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt index 18620137b..9d68aebde 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt @@ -66,16 +66,14 @@ class GuiOptionEditorUpdateCheck(option: ProcessedOption) : GuiOptionEditor(opti override fun mouseInput(x: Int, y: Int, width: Int, mouseX: Int, mouseY: Int): Boolean { val width = width - 20 - if (Mouse.getEventButtonState()) { - if ((mouseX - getButtonPosition(width) - x) in (0..button.width) && (mouseY - 10 - y) in (0..button.height)) { - when (UpdateManager.updateState) { - UpdateManager.UpdateState.AVAILABLE -> UpdateManager.queueUpdate() - UpdateManager.UpdateState.QUEUED -> {} - UpdateManager.UpdateState.DOWNLOADED -> {} - UpdateManager.UpdateState.NONE -> UpdateManager.checkUpdate() - } - return true + if (Mouse.getEventButtonState() && (mouseX - getButtonPosition(width) - x) in (0..button.width) && (mouseY - 10 - y) in (0..button.height)) { + when (UpdateManager.updateState) { + UpdateManager.UpdateState.AVAILABLE -> UpdateManager.queueUpdate() + UpdateManager.UpdateState.QUEUED -> {} + UpdateManager.UpdateState.DOWNLOADED -> {} + UpdateManager.UpdateState.NONE -> UpdateManager.checkUpdate() } + return true } return false } diff --git a/src/main/java/at/hannibal2/skyhanni/features/mobs/MobHighlight.kt b/src/main/java/at/hannibal2/skyhanni/features/mobs/MobHighlight.kt index cbe1bae37..d245facf0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mobs/MobHighlight.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mobs/MobHighlight.kt @@ -25,12 +25,10 @@ class MobHighlight { val entity = event.entity val baseMaxHealth = entity.baseMaxHealth - if (config.corruptedMobHighlight) { - if (event.health == baseMaxHealth * 3) { - RenderLivingEntityHelper.setEntityColor(entity, LorenzColor.DARK_PURPLE.toColor().withAlpha(127)) - { config.corruptedMobHighlight } - RenderLivingEntityHelper.setNoHurtTime(entity) { config.corruptedMobHighlight } - } + if (config.corruptedMobHighlight && event.health == baseMaxHealth * 3) { + RenderLivingEntityHelper.setEntityColor(entity, LorenzColor.DARK_PURPLE.toColor().withAlpha(127)) + { config.corruptedMobHighlight } + RenderLivingEntityHelper.setNoHurtTime(entity) { config.corruptedMobHighlight } } } @@ -40,20 +38,16 @@ class MobHighlight { val entity = event.entity val maxHealth = event.maxHealth - if (config.arachneKeeperHighlight) { - if ((maxHealth == 3_000 || maxHealth == 12_000) && entity is EntityCaveSpider) { - RenderLivingEntityHelper.setEntityColor(entity, LorenzColor.DARK_BLUE.toColor().withAlpha(127)) - { config.arachneKeeperHighlight } - RenderLivingEntityHelper.setNoHurtTime(entity) { config.arachneKeeperHighlight } - } + if (config.arachneKeeperHighlight && (maxHealth == 3_000 || maxHealth == 12_000) && entity is EntityCaveSpider) { + RenderLivingEntityHelper.setEntityColor(entity, LorenzColor.DARK_BLUE.toColor().withAlpha(127)) + { config.arachneKeeperHighlight } + RenderLivingEntityHelper.setNoHurtTime(entity) { config.arachneKeeperHighlight } } - if (config.corleoneHighlighter) { - if (maxHealth == 1_000_000 && entity is EntityOtherPlayerMP && entity.name == "Team Treasurite") { - RenderLivingEntityHelper.setEntityColor(entity, LorenzColor.DARK_PURPLE.toColor().withAlpha(127)) - { config.corleoneHighlighter } - RenderLivingEntityHelper.setNoHurtTime(entity) { config.corleoneHighlighter } - } + if (config.corleoneHighlighter && maxHealth == 1_000_000 && entity is EntityOtherPlayerMP && entity.name == "Team Treasurite") { + RenderLivingEntityHelper.setEntityColor(entity, LorenzColor.DARK_PURPLE.toColor().withAlpha(127)) + { config.corleoneHighlighter } + RenderLivingEntityHelper.setNoHurtTime(entity) { config.corleoneHighlighter } } if (config.zealotBruiserHighlighter) { @@ -66,18 +60,14 @@ class MobHighlight { } } - if (config.specialZealotHighlighter) { - if (maxHealth == 2_000 && entity is EntityEnderman) { - RenderLivingEntityHelper.setEntityColor(entity, LorenzColor.DARK_RED.toColor().withAlpha(50)) - { config.specialZealotHighlighter } - RenderLivingEntityHelper.setNoHurtTime(entity) { config.specialZealotHighlighter } - } + if (config.specialZealotHighlighter && maxHealth == 2_000 && entity is EntityEnderman) { + RenderLivingEntityHelper.setEntityColor(entity, LorenzColor.DARK_RED.toColor().withAlpha(50)) + { config.specialZealotHighlighter } + RenderLivingEntityHelper.setNoHurtTime(entity) { config.specialZealotHighlighter } } - if (config.arachneBossHighlighter) { - if (entity is EntitySpider) { - checkArachne(entity) - } + if (config.arachneBossHighlighter && entity is EntitySpider) { + checkArachne(entity) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt index be61e4c1c..c18274b05 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/CrimsonIsleReputationHelper.kt @@ -112,10 +112,8 @@ class CrimsonIsleReputationHelper(skyHanniMod: SkyHanniMod) { if (!LorenzUtils.inSkyBlock) return if (LorenzUtils.skyBlockIsland != IslandType.CRIMSON_ISLE) return - if (config.useHotkey) { - if (!OSUtils.isKeyHeld(config.hotkey)) { - return - } + if (config.useHotkey && !OSUtils.isKeyHeld(config.hotkey)) { + return } config.position.renderStringsAndItems( diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt index 2962f7561..f4809c10b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt @@ -293,10 +293,8 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { fun finishMiniBoss(miniBoss: CrimsonMiniBoss) { val miniBossQuest = getQuest<MiniBossQuest>() ?: return - if (miniBossQuest.miniBoss == miniBoss) { - if (miniBossQuest.state == QuestState.ACCEPTED) { - updateProcessQuest(miniBossQuest, miniBossQuest.haveAmount + 1) - } + if (miniBossQuest.miniBoss == miniBoss && miniBossQuest.state == QuestState.ACCEPTED) { + updateProcessQuest(miniBossQuest, miniBossQuest.haveAmount + 1) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt index 6077d0336..9de600370 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt @@ -58,12 +58,10 @@ class QuestLoader(private val dailyQuestHelper: DailyQuestHelper) { private fun checkQuest(name: String, green: Boolean, needAmount: Int) { val oldQuest = getQuestByName(name) if (oldQuest != null) { - if (green) { - if (oldQuest.state != QuestState.READY_TO_COLLECT && oldQuest.state != QuestState.COLLECTED) { - oldQuest.state = QuestState.READY_TO_COLLECT - dailyQuestHelper.update() - LorenzUtils.debug("Reputation Helper: Tab-List updated ${oldQuest.internalName} (This should not happen)") - } + if (green && oldQuest.state != QuestState.READY_TO_COLLECT && oldQuest.state != QuestState.COLLECTED) { + oldQuest.state = QuestState.READY_TO_COLLECT + dailyQuestHelper.update() + LorenzUtils.debug("Reputation Helper: Tab-List updated ${oldQuest.internalName} (This should not happen)") } return } @@ -131,19 +129,15 @@ class QuestLoader(private val dailyQuestHelper: DailyQuestHelper) { val stack = event.inventoryItems[22] ?: continue val completed = stack.getLore().any { it.contains("Completed!") } - if (completed) { - if (quest.state != QuestState.COLLECTED) { - quest.state = QuestState.COLLECTED - dailyQuestHelper.update() - } + if (completed && quest.state != QuestState.COLLECTED) { + quest.state = QuestState.COLLECTED + dailyQuestHelper.update() } val accepted = !stack.getLore().any { it.contains("Click to start!") } - if (accepted) { - if (quest.state == QuestState.NOT_ACCEPTED) { - quest.state = QuestState.ACCEPTED - dailyQuestHelper.update() - } + if (accepted && quest.state == QuestState.NOT_ACCEPTED) { + quest.state = QuestState.ACCEPTED + dailyQuestHelper.update() } } } @@ -155,15 +149,13 @@ class QuestLoader(private val dailyQuestHelper: DailyQuestHelper) { val state = QuestState.valueOf(split[1]) val needAmount = split[2].toInt() val quest = addQuest(name, state, needAmount) - if (quest is ProgressQuest) { - if (split.size == 4) { - try { - val haveAmount = split[3].toInt() - quest.haveAmount = haveAmount - } catch (e: IndexOutOfBoundsException) { - println("text: '$text'") - e.printStackTrace() - } + if (quest is ProgressQuest && split.size == 4) { + try { + val haveAmount = split[3].toInt() + quest.haveAmount = haveAmount + } catch (e: IndexOutOfBoundsException) { + println("text: '$text'") + e.printStackTrace() } } addQuest(quest) diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt index 3263dc744..ad10e1879 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/miniboss/DailyMiniBossHelper.kt @@ -56,12 +56,8 @@ class DailyMiniBossHelper(private val reputationHelper: CrimsonIsleReputationHel private fun needMiniBossQuest(miniBoss: CrimsonMiniBoss): Boolean { val bossQuest = reputationHelper.questHelper.getQuest<MiniBossQuest>() - if (bossQuest != null) { - if (bossQuest.miniBoss == miniBoss) { - if (bossQuest.state == QuestState.ACCEPTED) { - return true - } - } + if (bossQuest != null && bossQuest.miniBoss == miniBoss && bossQuest.state == QuestState.ACCEPTED) { + return true } return false diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt index 3dcf22b6b..1ea1e6f5e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/dreadfarm/RiftWiltedBerberisHelper.kt @@ -61,16 +61,12 @@ class RiftWiltedBerberisHelper { if (!isEnabled()) return if (!hasFarmingToolInHand) return -// if (event.distanceToPlayer > 10) return - val location = event.location val berberis = nearestBerberis(location) if (event.type != EnumParticleTypes.FIREWORKS_SPARK) { - if (config.hideparticles) { - if (berberis != null) { - event.isCanceled = true - } + if (config.hideparticles && berberis != null) { + event.isCanceled = true } return } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt index 8d09c1e3e..019dab619 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/livingcave/LivingCaveDefenseBlocks.kt @@ -55,10 +55,8 @@ class LivingCaveDefenseBlocks { } return } - if (config.hideParticles) { - if (movingBlocks.keys.any { it.location.distance(location) < 3 }) { - event.isCanceled = true - } + if (config.hideParticles && movingBlocks.keys.any { it.location.distance(location) < 3 }) { + event.isCanceled = true } if (event.type == EnumParticleTypes.CRIT_MAGIC) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt index 12f9b35ae..0aefac172 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/mirrorverse/DanceRoomHelper.kt @@ -151,10 +151,8 @@ object DanceRoomHelper { fun onCheckRender(event: CheckRenderEntityEvent<*>) { if (RiftAPI.inRift() && config.hidePlayers) { val entity = event.entity - if (entity is EntityOtherPlayerMP) { - if (inRoom) { - event.isCanceled = true - } + if (entity is EntityOtherPlayerMP && inRoom) { + event.isCanceled = true } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt index ad3231e29..723b97a3b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt @@ -127,13 +127,11 @@ class RiftBloodEffigies { continue } - if (config.respawningSoon) { - if (diff < 60_000 * config.respwningSoonTime) { - val time = TimeUtils.formatDuration(diff - 999) - event.drawWaypointFilled(location, LorenzColor.YELLOW.toColor(), seeThroughBlocks = true) - event.drawDynamicText(location, "§e$name is respawning §b$time", 1.5) - continue - } + if (config.respawningSoon && diff < 60_000 * config.respwningSoonTime) { + val time = TimeUtils.formatDuration(diff - 999) + event.drawWaypointFilled(location, LorenzColor.YELLOW.toColor(), seeThroughBlocks = true) + event.drawDynamicText(location, "§e$name is respawning §b$time", 1.5) + continue } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/KloonHacking.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/KloonHacking.kt index 360d2b289..2d04fa7ee 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/KloonHacking.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/KloonHacking.kt @@ -81,10 +81,8 @@ class KloonHacking { slot highlight if (correctButton) LorenzColor.GREEN else LorenzColor.RED continue } - if (slot.slotIndex > i * 9 + 8 && slot.slotIndex < i * 9 + 18) { - if (slot.stack!!.displayName.removeColor() == correctButtons[i]) { - slot highlight LorenzColor.YELLOW - } + if (slot.slotIndex > i * 9 + 8 && slot.slotIndex < i * 9 + 18 && slot.stack!!.displayName.removeColor() == correctButtons[i]) { + slot highlight LorenzColor.YELLOW } if (slot.slotIndex == i * 9 + 17) { i += 1 diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt index 3e495ea14..a00f52c63 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/EnigmaSoulWaypoints.kt @@ -64,10 +64,8 @@ object EnigmaSoulWaypoints { for (stack in event.inventoryItems.values) { val split = stack.displayName.split("Enigma: ") - if (split.size == 2) { - if (stack.getLore().last() == "§8✖ Not completed yet!") { - inventoryUnfound.add(split.last()) - } + if (split.size == 2 && stack.getLore().last() == "§8✖ Not completed yet!") { + inventoryUnfound.add(split.last()) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/HighlightRiftGuide.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/HighlightRiftGuide.kt index 81def7af1..84cd9b8db 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/HighlightRiftGuide.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/HighlightRiftGuide.kt @@ -31,10 +31,8 @@ class HighlightRiftGuide { val highlightedItems = mutableListOf<Int>() for ((slot, stack) in event.inventoryItems) { val lore = stack.getLore() - if (lore.isNotEmpty()) { - if (lore.last() == "§8✖ Not completed yet!") { - highlightedItems.add(slot) - } + if (lore.isNotEmpty() && lore.last() == "§8✖ Not completed yet!") { + highlightedItems.add(slot) } } inInventory = true diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftHorsezookaHider.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftHorsezookaHider.kt index 8e084f6c8..04c4ba332 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftHorsezookaHider.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/RiftHorsezookaHider.kt @@ -14,10 +14,8 @@ class RiftHorsezookaHider { if (!RiftAPI.inRift()) return if (!SkyHanniMod.feature.rift.horsezookaHider) return - if (event.entity is EntityHorse) { - if (InventoryUtils.itemInHandId.equals("HORSEZOOKA")) { + if (event.entity is EntityHorse && InventoryUtils.itemInHandId.equals("HORSEZOOKA")) { event.isCanceled = true - } } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt index 8f996fef0..4f1f92ca0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt @@ -76,11 +76,9 @@ object SlayerItemProfitTracker { fun onPurseChange(event: PurseChangeEvent) { if (!isEnabled()) return val coins = event.coins - if (event.reason == PurseChangeCause.GAIN_MOB_KILL) { - if (SlayerAPI.isInSlayerArea) { - logger.log("Coins gained for killing mobs: ${coins.addSeparators()}") - addMobKillCoins(coins.toInt()) - } + if (event.reason == PurseChangeCause.GAIN_MOB_KILL && SlayerAPI.isInSlayerArea) { + logger.log("Coins gained for killing mobs: ${coins.addSeparators()}") + addMobKillCoins(coins.toInt()) } if (event.reason == PurseChangeCause.LOSE_SLAYER_QUEST_STARTED) { logger.log("Coins paid for starting slayer quest: ${coins.addSeparators()}") @@ -187,15 +185,11 @@ object SlayerItemProfitTracker { val (itemName, price) = SlayerAPI.getItemNameAndPrice(internalName, amount) addItemPickup(internalName, amount) logger.log("Coins gained for picking up an item ($itemName) ${price.addSeparators()}") - if (config.priceInChat) { - if (price > config.minimumPrice) { - LorenzUtils.chat("§e[SkyHanni] §a+Slayer Drop§7: §r$itemName") - } + if (config.priceInChat && price > config.minimumPrice) { + LorenzUtils.chat("§e[SkyHanni] §a+Slayer Drop§7: §r$itemName") } - if (config.titleWarning) { - if (price > config.minimumPriceWarning) { - TitleUtils.sendTitle("§a+ $itemName", 5.seconds) - } + if (config.titleWarning && price > config.minimumPriceWarning) { + TitleUtils.sendTitle("§a+ $itemName", 5.seconds) } } @@ -408,13 +402,11 @@ object SlayerItemProfitTracker { return } - if (args.size == 1) { - if (args[0].lowercase() == "confirm") { - resetData(DisplayMode.TOTAL) - update() - LorenzUtils.chat("§e[SkyHanni] You reset your $itemLogCategory slayer data!") - return - } + if (args.size == 1 && args[0].lowercase() == "confirm") { + resetData(DisplayMode.TOTAL) + update() + LorenzUtils.chat("§e[SkyHanni] You reset your $itemLogCategory slayer data!") + return } LorenzUtils.clickableChat( diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt index 6c3648bcc..122897f86 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt @@ -66,10 +66,8 @@ class SlayerQuestWarning { fun onTick(event: LorenzTickEvent) { if (!(LorenzUtils.inSkyBlock)) return - if (dirtySidebar) { - if (event.repeatSeconds(3)) { - checkSidebar() - } + if (dirtySidebar && event.repeatSeconds(3)) { + checkSidebar() } } @@ -144,10 +142,8 @@ class SlayerQuestWarning { if (!(LorenzUtils.inSkyBlock)) return val entity = event.entity - if (entity.getLorenzVec().distanceToPlayer() < 6) { - if (isSlayerMob(entity)) { - tryWarn() - } + if (entity.getLorenzVec().distanceToPlayer() < 6 && isSlayerMob(entity)) { + tryWarn() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt index 1b9d1983d..9118184ec 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerRngMeterDisplay.kt @@ -37,13 +37,9 @@ class SlayerRngMeterDisplay { fun onTick(event: LorenzTickEvent) { if (!isEnabled()) return - if (event.repeatSeconds(1)) { - if (lastItemDroppedTime != 0L) { - if (System.currentTimeMillis() > lastItemDroppedTime + 4_000) { - lastItemDroppedTime = 0L - update() - } - } + if (event.repeatSeconds(1) && lastItemDroppedTime != 0L && System.currentTimeMillis() > lastItemDroppedTime + 4_000) { + lastItemDroppedTime = 0L + update() } } @@ -57,11 +53,9 @@ class SlayerRngMeterDisplay { if (!isEnabled()) return - if (config.hideChat) { - if (SlayerAPI.isInSlayerArea) { - changedItemPattern.matchMatcher(event.message) { - event.blockedReason = "slayer_rng_meter" - } + if (config.hideChat && SlayerAPI.isInSlayerArea) { + changedItemPattern.matchMatcher(event.message) { + event.blockedReason = "slayer_rng_meter" } } @@ -76,11 +70,9 @@ class SlayerRngMeterDisplay { if (old != -1L) { val item = storage.itemGoal val hasItemSelected = item != "" && item != "?" - if (!hasItemSelected) { - if (config.warnEmpty) { - LorenzUtils.warning("§c[Skyhanni] No Slayer RNG Meter Item selected!") - TitleUtils.sendTitle("§cNo RNG Meter Item!", 3.seconds) - } + if (!hasItemSelected && config.warnEmpty) { + LorenzUtils.warning("§c[Skyhanni] No Slayer RNG Meter Item selected!") + TitleUtils.sendTitle("§cNo RNG Meter Item!", 3.seconds) } var blockChat = config.hideChat && hasItemSelected val diff = currentMeter - old diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt index 55027c3e9..d9d5d59bf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/VampireSlayerFeatures.kt @@ -350,14 +350,12 @@ object VampireSlayerFeatures { ) } } - if (configBloodIcor.renderBeam && isIchor) { - if (stand.isEntityAlive) { - event.drawWaypointFilled( - event.exactLocation(stand).add(0, -2, 0), - configBloodIcor.color.toChromaColor(), - beacon = true - ) - } + if (configBloodIcor.renderBeam && isIchor && stand.isEntityAlive) { + event.drawWaypointFilled( + event.exactLocation(stand).add(0, -2, 0), + configBloodIcor.color.toChromaColor(), + beacon = true + ) } } } @@ -378,12 +376,10 @@ object VampireSlayerFeatures { if (!isEnabled()) return val loc = event.location EntityUtils.getEntitiesNearby<EntityOtherPlayerMP>(loc, 3.0).forEach { - if (it.isHighlighted()) { - if (event.type == EnumParticleTypes.ENCHANTMENT_TABLE) { - EntityUtils.getEntitiesNearby<EntityArmorStand>(event.location, 3.0).forEach { stand -> - if (stand.hasSkullTexture(killerSpringTexture) || stand.hasSkullTexture(bloodIchorTexture)) { - standList = standList.editCopy { this[stand] = it } - } + if (it.isHighlighted() && event.type == EnumParticleTypes.ENCHANTMENT_TABLE) { + EntityUtils.getEntitiesNearby<EntityArmorStand>(event.location, 3.0).forEach { stand -> + if (stand.hasSkullTexture(killerSpringTexture) || stand.hasSkullTexture(bloodIchorTexture)) { + standList = standList.editCopy { this[stand] = it } } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt index 723432b9a..69e800600 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerFirePitsWarning.kt @@ -44,17 +44,14 @@ class BlazeSlayerFirePitsWarning { val lastHealth = event.lastHealth val percentHealth = maxHealth * 0.33 - if (health < percentHealth) { - if (lastHealth > percentHealth) { - when (entityData.bossType) { - BossType.SLAYER_BLAZE_3, - BossType.SLAYER_BLAZE_4, - -> { - fireFirePits() - } - - else -> {} + if (health < percentHealth && lastHealth > percentHealth) { + when (entityData.bossType) { + BossType.SLAYER_BLAZE_3, + BossType.SLAYER_BLAZE_4, + -> { + fireFirePits() } + else -> {} } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt index eb1a44b29..6e0bdd7d3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/enderman/EndermanSlayerFeatures.kt @@ -53,13 +53,9 @@ class EndermanSlayerFeatures { val entity = event.entity if (entity in endermenWithBeacons || entity in flyingBeacons) return - if (entity is EntityEnderman) { - if (showBeacon()) { - if (hasBeaconInHand(entity) && canSee(LocationUtils.playerEyeLocation(), entity.getLorenzVec())) { - endermenWithBeacons.add(entity) - logger.log("Added enderman with beacon at ${entity.getLorenzVec()}") - } - } + if (entity is EntityEnderman && showBeacon() && hasBeaconInHand(entity) && canSee(LocationUtils.playerEyeLocation(), entity.getLorenzVec())) { + endermenWithBeacons.add(entity) + logger.log("Added enderman with beacon at ${entity.getLorenzVec()}") } if (entity is EntityArmorStand) { @@ -75,13 +71,9 @@ class EndermanSlayerFeatures { } } - if (config.endermanHighlightNukekebi) { - if (entity.inventory.any { it?.getSkullTexture() == nukekubiSkulTexture }) { - if (entity !in nukekubiSkulls) { - nukekubiSkulls.add(entity) - logger.log("Added Nukekubi skulls at ${entity.getLorenzVec()}") - } - } + if (config.endermanHighlightNukekebi && entity.inventory.any { it?.getSkullTexture() == nukekubiSkulTexture } && entity !in nukekubiSkulls) { + nukekubiSkulls.add(entity) + logger.log("Added Nukekubi skulls at ${entity.getLorenzVec()}") } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt index 2f2c48ec8..cbf30000d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt @@ -77,10 +77,8 @@ class SummoningMobManager { fun onTick(event: LorenzTickEvent) { if (!isEnabled()) return - if (config.summoningMobDisplay) { - if (event.repeatSeconds(1)) { - updateData() - } + if (config.summoningMobDisplay && event.repeatSeconds(1)) { + updateData() } if (searchArmorStands) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt index 709d5e662..7dcbe484a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningSoulsName.kt @@ -39,7 +39,6 @@ class SummoningSoulsName { } private fun check() { - val minecraft = Minecraft.getMinecraft() for (entity in EntityUtils.getEntities<EntityArmorStand>()) { if (souls.contains(entity)) continue @@ -61,11 +60,9 @@ class SummoningSoulsName { for (entity in EntityUtils.getEntities<EntityLiving>()) { val consumer = entity.getNameTagWith(2, "§c❤") - if (consumer != null) { - if (!consumer.name.contains("§e0")) { - mobsLastLocation[entity] = entity.getLorenzVec() - mobsName[entity] = consumer.name - } + if (consumer != null && !consumer.name.contains("§e0")) { + mobsLastLocation[entity] = entity.getLorenzVec() + mobsName[entity] = consumer.name } } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt index 5eb964f62..b7e2d86f3 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiIngameHook.kt @@ -13,10 +13,8 @@ fun drawString( y: Int, color: Int, ): Int { - if (SkyHanniMod.feature.misc.hideScoreboardNumbers) { - if (text.startsWith("§c") && text.length <= 4) { - return 0 - } + if (SkyHanniMod.feature.misc.hideScoreboardNumbers && text.startsWith("§c") && text.length <= 4) { + return 0 } if (SkyHanniMod.feature.misc.hidePiggyScoreboard) { piggyPattern.matchMatcher(text) { diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/NetworkManagerHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/NetworkManagerHook.kt index 1466ed44d..ca4c2e42b 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/NetworkManagerHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/NetworkManagerHook.kt @@ -5,7 +5,5 @@ import net.minecraft.network.Packet import org.spongepowered.asm.mixin.injection.callback.CallbackInfo fun onReceivePacket(packet: Packet<*>, ci: CallbackInfo) { - if (packet != null) { - if (PacketEvent.ReceiveEvent(packet).postAndCatch()) ci.cancel() - } + if (packet != null && PacketEvent.ReceiveEvent(packet).postAndCatch()) ci.cancel() }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt b/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt index f21d4cac0..59df2bf37 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/ParkourWaypointSaver.kt @@ -42,9 +42,7 @@ class ParkourWaypointSaver { } if (config.saveKey == key) { val newLocation = LorenzVec.getBlockBelowPlayer() - if (locations.isNotEmpty()) { - if (newLocation == locations.last()) return - } + if (locations.isNotEmpty() && newLocation == locations.last()) return locations.add(newLocation) update() } diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt index c1aa5a313..f80b96f8f 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniConfigSearchResetCommand.kt @@ -220,12 +220,8 @@ object SkyHanniConfigSearchResetCommand { val fieldName = "$parentName.$name" val newObj = field.makeAccessible().get(obj) map[fieldName] = newObj - if (newObj != null) { - if (newObj !is Boolean && newObj !is String && newObj !is Long && newObj !is Int && newObj !is Double) { - if (newObj !is Position && !newObj.javaClass.isEnum) { - map.putAll(loadAllFields(fieldName, newObj, depth + 1)) - } - } + if (newObj != null && newObj !is Boolean && newObj !is String && newObj !is Long && newObj !is Int && newObj !is Double && newObj !is Position && !newObj.javaClass.isEnum) { + map.putAll(loadAllFields(fieldName, newObj, depth + 1)) } } diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt index 66b29a3d7..a50d684de 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt @@ -182,11 +182,9 @@ class SkyHanniDebugsAndTests { val x = LorenzUtils.formatDouble(location.x + 0.001).replace(",", ".") val y = LorenzUtils.formatDouble(location.y + 0.001).replace(",", ".") val z = LorenzUtils.formatDouble(location.z + 0.001).replace(",", ".") - if (args.size == 1) { - if (args[0].equals("json", false)) { - OSUtils.copyToClipboard("\"$x:$y:$z\"") - return - } + if (args.size == 1 && args[0].equals("json", false)) { + OSUtils.copyToClipboard("\"$x:$y:$z\"") + return } OSUtils.copyToClipboard("LorenzVec($x, $y, $z)") @@ -197,12 +195,10 @@ class SkyHanniDebugsAndTests { } fun debugData(args: Array<String>) { - if (args.size == 2) { - if (args[0] == "profileName") { - HypixelData.profileName = args[1].lowercase() - LorenzUtils.chat("§eManually set profileName to '${HypixelData.profileName}'") - return - } + if (args.size == 2 && args[0] == "profileName") { + HypixelData.profileName = args[1].lowercase() + LorenzUtils.chat("§eManually set profileName to '${HypixelData.profileName}'") + return } val builder = StringBuilder() builder.append("```\n") diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt b/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt index fdb4a58c3..993778afc 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt @@ -48,21 +48,17 @@ object TestCopyBestiaryValues { val backItem = event.inventoryItems[3 + 9 * 5 + 3] if (backItem == null) { -// println("first is null!") return } if (backItem.getLore().none { it.contains("Bestiary Milestone") }) { -// println("wrong first: ${backItem.getLore()}") return } val rankingItem = event.inventoryItems[3 + 9 * 5 + 2] if (rankingItem == null) { -// println("second is null!") return } if (rankingItem.getLore().none { it.contains("Ranking") }) { -// println("wrong second: ${rankingItem.getLore()}") return } diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt index 5852c9922..cc909469e 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyErrorCommand.kt @@ -86,11 +86,9 @@ private fun Throwable.getExactStackTrace(full: Boolean, parent: List<String> = e for (traceElement in stackTrace) { var text = "\tat $traceElement" - if (!full) { - if (text in parent) { - println("broke at: $text") - break - } + if (!full && text in parent) { + println("broke at: $text") + break } if (!full) { for ((from, to) in replace) { @@ -98,11 +96,9 @@ private fun Throwable.getExactStackTrace(full: Boolean, parent: List<String> = e } } add(text) - if (!full) { - if (breakAfter.any { text.contains(it) }) { - println("breakAfter: $text") - break - } + if (!full && breakAfter.any { text.contains(it) }) { + println("breakAfter: $text") + break } } diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt index 51c5a28fb..b7c4ae4a1 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt @@ -135,28 +135,6 @@ object CopyNearbyEntitiesCommand { val skinTexture = entity.getSkinTexture() resultList.add("- skin texture: $skinTexture") - -// val gameProfile = entity.gameProfile -// if (gameProfile == null) { -// resultList.add("- gameProfile is null!") -// } else { -// val id = gameProfile.id -// val name = gameProfile.name -// -// resultList.add("- gameProfile id: $id") -// resultList.add("- gameProfile name: $name") -// val properties = gameProfile.properties -// resultList.add("- gameProfile properties: (${properties.size()})") -// for (entry in properties.entries()) { -// val key = entry.key -// val property = entry.value -// resultList.add("- key: '$key'") -// val name1 = property.name -// val value = property.value -// resultList.add("- property name: '$name1'") -// resultList.add("- property value: '$value'") -// } -// } } } resultList.add("") diff --git a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt index 5cf493fd5..f9e8ddb86 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/EntityUtils.kt @@ -133,14 +133,6 @@ object EntityUtils { fun EntityLivingBase.isAtFullHealth() = baseMaxHealth == health.toInt() -// fun WorldClient.getEntitiesNearby( -// clazz: Class<EntityBlaze>, -// location: LorenzVec, -// radius: Double -// ): MutableList<EntityBlaze> = getEntities(clazz) { entity -> -// entity?.getLorenzVec()?.let { it.distance(location) < radius } ?: false -// } - fun EntityArmorStand.hasSkullTexture(skin: String): Boolean { if (inventory == null) return false return inventory.any { it != null && it.getSkullTexture() == skin } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt index a8d493018..e250511a5 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/GuiRenderUtils.kt @@ -254,12 +254,10 @@ object GuiRenderUtils { if (filledWidth < 2) xPos + 1 else xPos + filledWidth - 1, yPos + 19, barColor ) - if (tooltip != "") { - if (isPointInRect(mouseX, mouseY, xPos - 2, yPos - 2, width + 4, 20 + 4)) { - val split = tooltip.split("\n") - for (line in split) { - output.add(line) - } + if (tooltip != "" && isPointInRect(mouseX, mouseY, xPos - 2, yPos - 2, width + 4, 20 + 4)) { + val split = tooltip.split("\n") + for (line in split) { + output.add(line) } } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt index 176266d1d..a2c1f1aa3 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt @@ -69,12 +69,8 @@ object ItemUtils { } } - if (withCursorItem) { - if (player.inventory != null) { - if (player.inventory.itemStack != null) { - list.add(player.inventory.itemStack) - } - } + if (withCursorItem && player.inventory != null && player.inventory.itemStack != null) { + list.add(player.inventory.itemStack) } return list } @@ -92,14 +88,9 @@ object ItemUtils { } } - if (withCursorItem) { - if (player.inventory != null) { - if (player.inventory.itemStack != null) { - map[player.inventory.itemStack] = -1 - } - } + if (withCursorItem && player.inventory != null && player.inventory.itemStack != null) { + map[player.inventory.itemStack] = -1 } - return map } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzLogger.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzLogger.kt index 0da4c5d80..a382a5149 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzLogger.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzLogger.kt @@ -58,10 +58,8 @@ class LorenzLogger(filePath: String) { private fun createParent(file: File) { val parent = file.parentFile - if (parent != null) { - if (!parent.isDirectory) { - parent.mkdirs() - } + if (parent != null && !parent.isDirectory) { + parent.mkdirs() } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 3ad8e3fe9..4a60f18a4 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -70,10 +70,8 @@ object LorenzUtils { var lastButtonClicked = 0L fun debug(message: String) { - if (SkyHanniMod.feature.dev.debugEnabled) { - if (internalChat(DEBUG_PREFIX + message)) { - consoleLog("[Debug] $message") - } + if (SkyHanniMod.feature.dev.debugEnabled && internalChat(DEBUG_PREFIX + message)) { + consoleLog("[Debug] $message") } } @@ -151,7 +149,6 @@ object LorenzUtils { fun formatPercentage(percentage: Double): String = formatPercentage(percentage, "0.00") fun formatPercentage(percentage: Double, format: String?): String = -// NumberFormat.getPercentInstance().format(percentage) DecimalFormat(format).format(percentage * 100).replace(',', '.') + "%" fun formatInteger(i: Int): String = formatInteger(i.toLong()) @@ -297,7 +294,7 @@ object LorenzUtils { fun isControlKeyDown() = OSUtils.isKeyHeld(Keyboard.KEY_LCONTROL) || OSUtils.isKeyHeld(Keyboard.KEY_RCONTROL) // A mac-only key, represents Windows key on windows (but different key code) - fun isCommandKeyDown() = OSUtils.isKeyHeld(Keyboard.KEY_LMETA) || OSUtils.isKeyHeld(Keyboard.KEY_LMETA) + fun isCommandKeyDown() = OSUtils.isKeyHeld(Keyboard.KEY_LMETA) || OSUtils.isKeyHeld(Keyboard.KEY_RMETA) // MoulConfig is in Java, I don't want to downgrade this logic fun <T> onChange(vararg properties: Property<out T>, observer: Observer<T>) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt b/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt index f929e7e06..948b8bfdd 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/MinecraftConsoleFilter.kt @@ -39,30 +39,22 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter { val formattedMessage = message.formattedMessage val thrown = event.thrown - if (SkyHanniMod.feature.dev.filterChat) { - if (formattedMessage.startsWith("[CHAT] ")) { - filterConsole("chat") - return Filter.Result.DENY - } + if (SkyHanniMod.feature.dev.filterChat && formattedMessage.startsWith("[CHAT] ")) { + filterConsole("chat") + return Filter.Result.DENY } - if (SkyHanniMod.feature.dev.filterGrowBuffer) { - if (formattedMessage.startsWith("Needed to grow BufferBuilder buffer: Old size ")) { - filterConsole("Grow BufferBuilder buffer") - return Filter.Result.DENY - } + if (SkyHanniMod.feature.dev.filterGrowBuffer && formattedMessage.startsWith("Needed to grow BufferBuilder buffer: Old size ")) { + filterConsole("Grow BufferBuilder buffer") + return Filter.Result.DENY } - if (SkyHanniMod.feature.dev.filterUnknownSound) { - if (formattedMessage.startsWith("Unable to play unknown soundEvent: minecraft:")) { - filterConsole("Unknown soundEvent (minecraft:)") - return Filter.Result.DENY - } + if (SkyHanniMod.feature.dev.filterUnknownSound && formattedMessage.startsWith("Unable to play unknown soundEvent: minecraft:")) { + filterConsole("Unknown soundEvent (minecraft:)") + return Filter.Result.DENY } //TODO testing - if (SkyHanniMod.feature.dev.filterParticleVillagerHappy) { - if (formattedMessage == "Could not spawn particle effect VILLAGER_HAPPY") { - filterConsole("particle VILLAGER_HAPPY") - return Filter.Result.DENY - } + if (SkyHanniMod.feature.dev.filterParticleVillagerHappy && formattedMessage == "Could not spawn particle effect VILLAGER_HAPPY") { + filterConsole("particle VILLAGER_HAPPY") + return Filter.Result.DENY } if (SkyHanniMod.feature.dev.filterOptiFine) { @@ -75,18 +67,14 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter { return Filter.Result.DENY } } - if (loggerName == "AsmHelper") { - if (SkyHanniMod.feature.dev.filterAmsHelperTransformer) { + if (loggerName == "AsmHelper" && SkyHanniMod.feature.dev.filterAmsHelperTransformer) { if (formattedMessage.startsWith("Transforming class ")) { filterConsole("AsmHelper Transforming") return Filter.Result.DENY - } } - if (SkyHanniMod.feature.dev.filterAsmHelperApplying) { - if (formattedMessage.startsWith("Applying AsmWriter ModifyWriter")) { - filterConsole("AsmHelper Applying AsmWriter") - return Filter.Result.DENY - } + if (SkyHanniMod.feature.dev.filterAsmHelperApplying && formattedMessage.startsWith("Applying AsmWriter ModifyWriter")) { + filterConsole("AsmHelper Applying AsmWriter") + return Filter.Result.DENY } } @@ -125,38 +113,32 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter { } } - if (thrown != null) { + if (thrown != null && SkyHanniMod.feature.dev.filterScoreboardErrors) { val cause = thrown.cause - if (cause != null) { - if (cause.stackTrace.isNotEmpty()) { - val first = cause.stackTrace[0] - if (SkyHanniMod.feature.dev.filterScoreboardErrors) { - val firstName = first.toString() - if (firstName == "net.minecraft.scoreboard.Scoreboard.removeTeam(Scoreboard.java:229)" || - firstName == "net.minecraft.scoreboard.Scoreboard.removeTeam(Scoreboard.java:262)" - ) { - filterConsole("NullPointerException at Scoreboard.removeTeam") - return Filter.Result.DENY - } - if (firstName == "net.minecraft.scoreboard.Scoreboard.createTeam(Scoreboard.java:218)") { - filterConsole("IllegalArgumentException at Scoreboard.createTeam") - return Filter.Result.DENY - } - if (firstName == "net.minecraft.scoreboard.Scoreboard.removeObjective(Scoreboard.java:179)" || - firstName == "net.minecraft.scoreboard.Scoreboard.removeObjective(Scoreboard.java:198)" - ) { - filterConsole("IllegalArgumentException at Scoreboard.removeObjective") - return Filter.Result.DENY - } - } + if (cause != null && cause.stackTrace.isNotEmpty()) { + val first = cause.stackTrace[0] + val firstName = first.toString() + if (firstName == "net.minecraft.scoreboard.Scoreboard.removeTeam(Scoreboard.java:229)" || + firstName == "net.minecraft.scoreboard.Scoreboard.removeTeam(Scoreboard.java:262)" + ) { + filterConsole("NullPointerException at Scoreboard.removeTeam") + return Filter.Result.DENY } - } - if (SkyHanniMod.feature.dev.filterScoreboardErrors) { - if (thrown.toString().contains(" java.lang.IllegalArgumentException: A team with the name '")) { - filterConsole("IllegalArgumentException because scoreboard team already exists") + if (firstName == "net.minecraft.scoreboard.Scoreboard.createTeam(Scoreboard.java:218)") { + filterConsole("IllegalArgumentException at Scoreboard.createTeam") + return Filter.Result.DENY + } + if (firstName == "net.minecraft.scoreboard.Scoreboard.removeObjective(Scoreboard.java:179)" || + firstName == "net.minecraft.scoreboard.Scoreboard.removeObjective(Scoreboard.java:198)" + ) { + filterConsole("IllegalArgumentException at Scoreboard.removeObjective") return Filter.Result.DENY } } + if (thrown.toString().contains(" java.lang.IllegalArgumentException: A team with the name '")) { + filterConsole("IllegalArgumentException because scoreboard team already exists") + return Filter.Result.DENY + } } if (!SkyHanniMod.feature.dev.printUnfilteredDebugs) return Filter.Result.ACCEPT @@ -178,19 +160,17 @@ class MinecraftConsoleFilter(private val loggerConfigName: String) : Filter { debug("marker is null") } debug("thrown: '$thrown'") - if (thrown != null) { - if (thrown.stackTrace.isNotEmpty()) { - var element = thrown.stackTrace[0] - debug("thrown first element: '$element'") - val cause = thrown.cause - if (cause != null) { - debug("throw cause: '$cause'") - if (cause.stackTrace.isNotEmpty()) { - element = cause.stackTrace[0] - debug("thrown cause first element: '$element'") - } else { - debug("thrown cause has no elements") - } + if (thrown != null && thrown.stackTrace.isNotEmpty()) { + var element = thrown.stackTrace[0] + debug("thrown first element: '$element'") + val cause = thrown.cause + if (cause != null) { + debug("throw cause: '$cause'") + if (cause.stackTrace.isNotEmpty()) { + element = cause.stackTrace[0] + debug("thrown cause first element: '$element'") + } else { + debug("thrown cause has no elements") } } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index fac794a53..6e943b059 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -246,37 +246,25 @@ object NEUItems { val count = ingredient.count.toInt() var internalItemId = ingredient.internalItemId // ignore cactus green - if (internalName == "ENCHANTED_CACTUS_GREEN") { - if (internalItemId == "INK_SACK-2") { - internalItemId = "CACTUS" - } + if (internalName == "ENCHANTED_CACTUS_GREEN" && internalItemId == "INK_SACK-2") { + internalItemId = "CACTUS" } // ignore wheat in enchanted cookie - if (internalName == "ENCHANTED_COOKIE") { - if (internalItemId == "WHEAT") { + if (internalName == "ENCHANTED_COOKIE" && internalItemId == "WHEAT") { continue - } } // ignore golden carrot in enchanted golden carrot - if (internalName == "ENCHANTED_GOLDEN_CARROT") { - if (internalItemId == "GOLDEN_CARROT") { + if (internalName == "ENCHANTED_GOLDEN_CARROT" && internalItemId == "GOLDEN_CARROT") { continue - } } // ignore rabbit hide in leather - if (internalName == "LEATHER") { - if (internalItemId == "RABBIT_HIDE") { + if (internalName == "LEATHER" && internalItemId == "RABBIT_HIDE") { continue - } } -// println("") -// println("rawId: $rawId") -// println("internalItemId: $internalItemId") - val old = map.getOrDefault(internalItemId, 0) map[internalItemId] = old + count } @@ -332,9 +320,7 @@ object NEUItems { if (!jsonObject.has("internalname")) { jsonObject.add("internalname", JsonPrimitive("_")) } - if (removeLore) { - if (jsonObject.has("lore")) jsonObject.remove("lore") - } + if (removeLore && jsonObject.has("lore")) jsonObject.remove("lore") val jsonString = jsonObject.toString() return StringUtils.encodeBase64(jsonString) } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt index 3fe7f6973..7a780c3b5 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt @@ -53,10 +53,8 @@ class ParkourHelper( if (visible) { for ((index, location) in locations.withIndex()) { - if (location.offsetCenter().distanceToPlayer() < detectionRange) { - if (Minecraft.getMinecraft().thePlayer.onGround) { - current = index - } + if (location.offsetCenter().distanceToPlayer() < detectionRange && Minecraft.getMinecraft().thePlayer.onGround) { + current = index } } } @@ -64,10 +62,8 @@ class ParkourHelper( val distanceToPlayer = locations.first().offsetCenter().distanceToPlayer() if (distanceToPlayer < detectionRange) { visible = true - } else if (distanceToPlayer > 15) { - if (current < 1) { - visible = false - } + } else if (distanceToPlayer > 15 && current < 1) { + visible = false } if (!visible) return @@ -117,10 +113,8 @@ class ParkourHelper( event.drawFilledBoundingBox_nea(aabb, colorForIndex(index), 1f) if (outline) event.outlineTopFace(aabb, 2, Color.BLACK, true) } - if (SkyHanniMod.feature.dev.waypoint.showPlatformNumber) { - if (!isMovingPlatform) { - event.drawString(location.offsetCenter().add(0, 1, 0), "§a§l$index", seeThroughBlocks = true) - } + if (SkyHanniMod.feature.dev.waypoint.showPlatformNumber && !isMovingPlatform) { + event.drawString(location.offsetCenter().add(0, 1, 0), "§a§l$index", seeThroughBlocks = true) } } } catch (e: Throwable) { diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index 405dc1bb5..ce676656e 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -230,7 +230,6 @@ object RenderUtils { GlStateManager.translate(0f, -0.25f, 0f) GlStateManager.rotate(-renderManager.playerViewX, 1.0f, 0.0f, 0.0f) GlStateManager.rotate(renderManager.playerViewY, 0.0f, 1.0f, 0.0f) -// RenderUtil.drawNametag(EnumChatFormatting.YELLOW.toString() + dist.roundToInt() + "m") GlStateManager.popMatrix() GlStateManager.disableLighting() @@ -333,9 +332,7 @@ object RenderUtils { GlStateManager.rotate(-renderManager.playerViewY, 0f, 1f, 0f) GlStateManager.rotate(renderManager.playerViewX, 1f, 0f, 0f) GlStateManager.scale(-f1, -f1, -f1) -// GlStateManager.scale(scale, scale, scale) GlStateManager.scale(finalScale, finalScale, finalScale) -// GlStateManager.scale(finalScale, finalScale, finalScale) GlStateManager.enableBlend() GlStateManager.disableLighting() GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt index 1ac5ad3f1..49c9c520c 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/StringUtils.kt @@ -150,11 +150,9 @@ object StringUtils { for (i in 0..steps) { val toDouble = i.toDouble() val stepPercentage = toDouble / steps - if (stepPercentage >= percentage) { - if (!inMissingArea) { - builder.append(missing) - inMissingArea = true - } + if (stepPercentage >= percentage && !inMissingArea) { + builder.append(missing) + inMissingArea = true } builder.append(step) } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt index bcc4bff5f..3f78c7a3b 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt @@ -66,9 +66,7 @@ object TimeUtils { } count++ - if (maxUnits != -1) { - if (count == maxUnits) break - } + if (maxUnits != -1 && count == maxUnits) break } } return builder.toString().trim() diff --git a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt index b3ba7f906..a4a3f1460 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt @@ -105,10 +105,8 @@ interface Renderable { override fun render(posX: Int, posY: Int) { val isDown = Mouse.isButtonDown(button) - if (isDown > wasDown && isHovered(posX, posY)) { - if (condition() && shouldAllowLink(true, bypassChecks)) { - onClick() - } + if (isDown > wasDown && isHovered(posX, posY) && condition() && shouldAllowLink(true, bypassChecks)) { + onClick() } wasDown = isDown render.render(posX, posY) |