From 343d5d9cea12beaf7a8dfabda2f61ad940be592a Mon Sep 17 00:00:00 2001 From: Walker Selby Date: Fri, 29 Sep 2023 11:30:27 -0700 Subject: Random Code Cleanup (#516) Sonar Lint for the win #516 --- .../config/core/config/gui/GuiPositionEditor.kt | 43 ++-- .../java/at/hannibal2/skyhanni/data/EntityData.kt | 6 +- .../at/hannibal2/skyhanni/data/GuiEditManager.kt | 4 +- .../java/at/hannibal2/skyhanni/data/HypixelData.kt | 32 ++- .../at/hannibal2/skyhanni/data/RenderGuiData.kt | 2 - .../at/hannibal2/skyhanni/data/repo/RepoManager.kt | 12 +- .../skyhanni/features/anvil/AnvilCombineHelper.kt | 18 -- .../skyhanni/features/bingo/BingoNextStepHelper.kt | 5 +- .../skyhanni/features/bingo/CompactBingoChat.kt | 6 +- .../skyhanni/features/bingo/MinionCraftHelper.kt | 7 +- .../skyhanni/features/chat/PlayerDeathMessages.kt | 18 +- .../hannibal2/skyhanni/features/chat/Translator.kt | 2 +- .../features/chat/playerchat/PlayerChatModifier.kt | 30 +-- .../features/cosmetics/CosmeticFollowingLine.kt | 18 +- .../damageindicator/DamageIndicatorManager.kt | 62 ++--- .../skyhanni/features/damageindicator/MobFinder.kt | 280 ++++++++------------- .../skyhanni/features/dungeon/DungeonAPI.kt | 5 +- .../skyhanni/features/dungeon/DungeonCleanEnd.kt | 33 +-- .../skyhanni/features/dungeon/DungeonHideItems.kt | 74 ++---- .../dungeon/DungeonHighlightClickedBlocks.kt | 6 - .../features/dungeon/DungeonMilestonesDisplay.kt | 7 +- .../features/dungeon/HighlightDungeonDeathmite.kt | 10 +- .../features/event/diana/GriffinBurrowHelper.kt | 12 +- .../event/diana/GriffinBurrowParticleFinder.kt | 65 ----- .../features/event/diana/GriffinPetWarning.kt | 10 +- .../event/diana/InquisitorWaypointShare.kt | 8 +- .../features/fishing/SeaCreatureFeatures.kt | 2 +- .../skyhanni/features/garden/GardenAPI.kt | 5 +- .../features/garden/GardenCropMilestoneFix.kt | 6 +- .../skyhanni/features/garden/GardenLevelDisplay.kt | 16 +- .../features/garden/composter/ComposterDisplay.kt | 12 +- .../features/garden/composter/ComposterOverlay.kt | 11 +- .../garden/contest/JacobContestStatsSummary.kt | 6 +- .../contest/JacobFarmingContestsInventory.kt | 12 +- .../garden/farming/FarmingWeightDisplay.kt | 6 +- .../garden/farming/GardenCropMilestoneDisplay.kt | 6 +- .../features/garden/farming/GardenCropSpeed.kt | 2 +- .../garden/farming/WrongFungiCutterWarning.kt | 12 +- .../garden/fortuneguide/CaptureFarmingGear.kt | 34 +-- .../features/garden/fortuneguide/FFGuideGUI.kt | 16 +- .../garden/visitor/GardenVisitorFeatures.kt | 59 ++--- .../features/inventory/HideNotClickableItems.kt | 9 +- .../inventory/ItemDisplayOverlayFeatures.kt | 150 +++++------ .../features/inventory/RngMeterInventory.kt | 34 ++- .../skyhanni/features/inventory/StatsTuning.kt | 118 ++++----- .../itemabilities/abilitycooldown/ItemAbility.kt | 1 - .../abilitycooldown/ItemAbilityCooldown.kt | 142 ++++------- .../skyhanni/features/minion/MinionFeatures.kt | 40 ++- .../skyhanni/features/misc/ChumBucketHider.kt | 16 +- .../skyhanni/features/misc/CollectionTracker.kt | 15 +- .../skyhanni/features/misc/JoinCrystalHollows.kt | 10 +- .../skyhanni/features/misc/ParticleHider.kt | 32 +-- .../skyhanni/features/misc/QuickModMenuSwitch.kt | 2 - .../skyhanni/features/misc/ServerRestartTitle.kt | 4 +- .../features/misc/ghostcounter/GhostCounter.kt | 20 +- .../features/misc/items/EstimatedItemValue.kt | 4 +- .../features/misc/tabcomplete/PlayerTabComplete.kt | 37 ++- .../features/misc/tiarelay/TiaRelayHelper.kt | 18 +- .../features/misc/trevor/TrevorFeatures.kt | 54 ++-- .../skyhanni/features/misc/trevor/TrevorSolver.kt | 44 ++-- .../misc/update/GuiOptionEditorUpdateCheck.kt | 16 +- .../skyhanni/features/mobs/MobHighlight.kt | 46 ++-- .../CrimsonIsleReputationHelper.kt | 6 +- .../dailyquest/DailyQuestHelper.kt | 6 +- .../reputationhelper/dailyquest/QuestLoader.kt | 42 ++-- .../miniboss/DailyMiniBossHelper.kt | 8 +- .../area/dreadfarm/RiftWiltedBerberisHelper.kt | 8 +- .../area/livingcave/LivingCaveDefenseBlocks.kt | 6 +- .../rift/area/mirrorverse/DanceRoomHelper.kt | 6 +- .../area/stillgorechateau/RiftBloodEffigies.kt | 12 +- .../features/rift/area/westvillage/KloonHacking.kt | 6 +- .../rift/everywhere/EnigmaSoulWaypoints.kt | 6 +- .../features/rift/everywhere/HighlightRiftGuide.kt | 6 +- .../rift/everywhere/RiftHorsezookaHider.kt | 4 +- .../features/slayer/SlayerItemProfitTracker.kt | 32 +-- .../skyhanni/features/slayer/SlayerQuestWarning.kt | 12 +- .../features/slayer/SlayerRngMeterDisplay.kt | 26 +- .../features/slayer/VampireSlayerFeatures.kt | 24 +- .../slayer/blaze/BlazeSlayerFirePitsWarning.kt | 17 +- .../slayer/enderman/EndermanSlayerFeatures.kt | 20 +- .../features/summonings/SummoningMobManager.kt | 6 +- .../features/summonings/SummoningSoulsName.kt | 9 +- .../skyhanni/mixins/hooks/GuiIngameHook.kt | 6 +- .../skyhanni/mixins/hooks/NetworkManagerHook.kt | 4 +- .../skyhanni/test/ParkourWaypointSaver.kt | 4 +- .../test/SkyHanniConfigSearchResetCommand.kt | 8 +- .../skyhanni/test/SkyHanniDebugsAndTests.kt | 18 +- .../skyhanni/test/TestCopyBestiaryValues.kt | 4 - .../skyhanni/test/command/CopyErrorCommand.kt | 16 +- .../test/command/CopyNearbyEntitiesCommand.kt | 22 -- .../at/hannibal2/skyhanni/utils/EntityUtils.kt | 8 - .../at/hannibal2/skyhanni/utils/GuiRenderUtils.kt | 10 +- .../java/at/hannibal2/skyhanni/utils/ItemUtils.kt | 17 +- .../at/hannibal2/skyhanni/utils/LorenzLogger.kt | 6 +- .../at/hannibal2/skyhanni/utils/LorenzUtils.kt | 9 +- .../skyhanni/utils/MinecraftConsoleFilter.kt | 116 ++++----- .../java/at/hannibal2/skyhanni/utils/NEUItems.kt | 26 +- .../at/hannibal2/skyhanni/utils/ParkourHelper.kt | 18 +- .../at/hannibal2/skyhanni/utils/RenderUtils.kt | 3 - .../at/hannibal2/skyhanni/utils/StringUtils.kt | 8 +- .../java/at/hannibal2/skyhanni/utils/TimeUtils.kt | 4 +- .../skyhanni/utils/renderables/Renderable.kt | 6 +- 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, 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, 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() -// 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, 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() 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 && o