This repository was archived by the owner on Jan 5, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
feat(AwesomeMap): add player head color border and class color mapping #31
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
289e8a0
feat(AwesomeMap): add player head color border and class color mapping
Xmarmalade 27cdcdd
fix(AwesomeMapConfig): correct typo in player heads color border desc…
Xmarmalade 36d9acd
refactor(AwesomeMapConfig): remove colorBorderSize from config override
Xmarmalade f3dfe8a
feat(AwesomeMap): implement DungeonClass enum and refactor class colo…
Xmarmalade 5f2ac60
fix(AwesomeMapConfig): rename colorBorderSize to colorBorderWidth and…
Xmarmalade a2f7f6c
refactor(AwesomeMap): introduce `DungeonClass` enum
Xmarmalade File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/kotlin/net/skymoe/enchaddons/impl/feature/awesomemap/core/DungeonClass.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| package net.skymoe.enchaddons.impl.feature.awesomemap.core | ||
|
|
||
| enum class DungeonClass( | ||
| val code: Char, | ||
| ) { | ||
| TANK('T'), | ||
| ARCHER('A'), | ||
| BERSERK('B'), | ||
| MAGE('M'), | ||
| HEALER('H'), | ||
| UNKNOWN('?'); | ||
|
|
||
| companion object { | ||
| fun fromCode(code: Char): DungeonClass = entries.find { it.code == code } ?: UNKNOWN | ||
| fun fromDisplayName(name: String): DungeonClass = | ||
| when (name) { | ||
| "Tank" -> TANK | ||
| "Archer" -> ARCHER | ||
| "Berserk" -> BERSERK | ||
| "Mage" -> MAGE | ||
| "Healer" -> HEALER | ||
| else -> UNKNOWN | ||
| } | ||
| } | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ import net.minecraft.client.network.NetworkPlayerInfo | |
| import net.minecraft.init.Blocks | ||
| import net.minecraft.util.BlockPos | ||
| import net.minecraft.util.StringUtils | ||
| import net.skymoe.enchaddons.impl.feature.awesomemap.core.DungeonClass | ||
| import net.skymoe.enchaddons.impl.feature.awesomemap.core.DungeonPlayer | ||
| import net.skymoe.enchaddons.impl.feature.awesomemap.core.map.* | ||
| import net.skymoe.enchaddons.impl.feature.awesomemap.utils.MapUtils | ||
|
|
@@ -33,18 +34,45 @@ object MapUpdate { | |
| var iconNum = 0 | ||
| for (i in listOf(5, 9, 13, 17, 1)) { | ||
| with(tabEntries[i]) { | ||
| val strippedEntry = StringUtils.stripControlCodes(second) | ||
|
|
||
| val name = | ||
| StringUtils | ||
| .stripControlCodes(second) | ||
| .trim() | ||
| .substringAfterLast("] ") | ||
| .split(" ")[0] | ||
|
|
||
| if (name != "") { | ||
| var dungeonClass = DungeonClass.UNKNOWN | ||
|
|
||
| // Look for class info in parentheses | ||
| if (strippedEntry.contains("(") && strippedEntry.contains(")")) { | ||
| val parenContent = strippedEntry.substringAfterLast("(").substringBefore(")") | ||
|
|
||
| // Check if it's not EMPTY or DEAD | ||
| if (parenContent != "EMPTY" && parenContent != "DEAD") { | ||
| // Parse class from format like "Mage XL" or "Tank L" | ||
| val classInfo = parenContent.split(" ")[0] | ||
|
|
||
| dungeonClass = | ||
| when (classInfo) { | ||
| "Tank" -> DungeonClass.TANK | ||
| "Archer" -> DungeonClass.ARCHER | ||
| "Berserk" -> DungeonClass.BERSERK | ||
| "Mage" -> DungeonClass.MAGE | ||
| "Healer" -> DungeonClass.HEALER | ||
| else -> DungeonClass.UNKNOWN | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Dungeon.dungeonTeammates[name] = | ||
| DungeonPlayer(first.locationSkin, TabList.getPlayerUUIDByName(name)).apply { | ||
| MC.theWorld.getPlayerEntityByName(name)?.let { setData(it) } | ||
| colorPrefix = second.substringBefore(name, "f").last() | ||
| this.name = name | ||
| this.dungeonClass = dungeonClass | ||
| icon = "icon-$iconNum" | ||
| } | ||
| iconNum++ | ||
|
|
@@ -64,6 +92,24 @@ object MapUpdate { | |
| if (name == "") continue | ||
| Dungeon.dungeonTeammates[name]?.run { | ||
| dead = tabText.contains("(DEAD)") | ||
|
|
||
| // Update class info if it was previously unknown | ||
| if (dungeonClass == DungeonClass.UNKNOWN && tabText.contains("(") && tabText.contains(")")) { | ||
| val parenContent = tabText.substringAfterLast("(").substringBefore(")") | ||
| if (parenContent != "EMPTY" && parenContent != "DEAD") { | ||
| val classInfo = parenContent.split(" ")[0] | ||
| dungeonClass = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 和刚才一样 |
||
| when (classInfo) { | ||
| "Tank" -> DungeonClass.TANK | ||
| "Archer" -> DungeonClass.ARCHER | ||
| "Berserk" -> DungeonClass.BERSERK | ||
| "Mage" -> DungeonClass.MAGE | ||
| "Healer" -> DungeonClass.HEALER | ||
| else -> DungeonClass.UNKNOWN | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (dead) { | ||
| icon = "" | ||
| } else { | ||
|
|
@@ -208,7 +254,9 @@ object MapUpdate { | |
| if (unique == null || unique.name.startsWith("Unknown")) { | ||
| unique = connected | ||
| .firstOrNull { | ||
| (Dungeon.Info.dungeonList[it.second * 11 + it.first] as? Room)?.uniqueRoom?.name?.startsWith("Unknown") == false | ||
| (Dungeon.Info.dungeonList[it.second * 11 + it.first] as? Room)?.uniqueRoom?.name?.startsWith( | ||
| "Unknown", | ||
| ) == false | ||
| }?.let { | ||
| (Dungeon.Info.dungeonList[it.second * 11 + it.first] as? Room)?.uniqueRoom | ||
| } ?: unique | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里怎么还是返回字符串,用 enum 走全程