generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add neofetch in Minecraft #108
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
415582a
feat: neofetch!
zly2006 ba38dcb
fix: neofetch
zly2006 1c171c0
fix: neofetch is not debug command
zly2006 d0775d7
fix typo
zly2006 fa52217
more info
zly2006 aa41f74
fix: memory info
zly2006 3db8906
build: fix test
zly2006 116f35e
build: fix test
zly2006 9a46d2e
Merge branch 'refs/heads/1.20.4' into neofetch
zly2006 cd673c5
fix
zly2006 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 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,52 @@ | ||
# generated by https://asciiart.club | ||
import json | ||
|
||
html = """ | ||
|
||
<span style="color:#808080"> </span><span style="color:#6e8160">a</span><span style="color:#6e825f">w</span><br><span style="color:#808080"> </span><span style="color:#6a8457">s</span><span style="color:#5e853f">#</span><span style="color:#58892d">#</span><span style="color:#528b25">S</span><span style="color:#4d8720">#$</span><span style="color:#49861e">#</span><span style="color:#578c2b">#</span><span style="color:#5d863d">#</span><span style="color:#678353">w</span><br><span style="color:#718464">a</span><span style="color:#65874d">#</span><span style="color:#60893a">#</span><span style="color:#548926">$</span><span style="color:#4b8820">###S#</span><span style="color:#4b8820">#</span><span style="color:#5d8d2d">G</span><span style="color:#518924">#</span><span style="color:#4e8921">###</span><span style="color:#4b851f">#8</span><span style="color:#5f8938">#</span><span style="color:#67854c">N</span><span style="color:#718062">-</span><br><span style="color:#4f8e24">#</span><span style="color:#528c25">#</span><span style="color:#4a861f">#</span><span style="color:#4d8821">#</span><span style="color:#528924">#</span><span style="color:#558826">S</span><span style="color:#568c28">#</span><span style="color:#588e2a">G</span><span style="color:#518a24">#Q</span><span style="color:#518a25">##</span><span style="color:#4b8720">#GS</span><span style="color:#568e28">#$</span><span style="color:#3e6f1a">#</span><span style="color:#335c15">#</span><span style="color:#2c5212">#</span><br><span style="color:#4f5f22">#</span><span style="color:#597e2b">G</span><span style="color:#558926">Q</span><span style="color:#485c1c">#</span><span style="color:#48881e">N</span><span style="color:#548a26">##</span><span style="color:#578b29">G##</span><span style="color:#47861d">#</span><span style="color:#47841c">#</span><span style="color:#578c29">S</span><span style="color:#4b8122">Q</span><span style="color:#436f1f">#</span><span style="color:#365c18">#</span><span style="color:#305515">#</span><span style="color:#2e4b13">##</span><span style="color:#2e2d0f">#</span><br><span style="color:#5c3c20">#</span><span style="color:#4f361d">#</span><span style="color:#4a5c1c">#</span><span style="color:#443618">##</span><span style="color:#4d8921">#</span><span style="color:#578c29">###</span><span style="color:#548a26">#</span><span style="color:#487b20">#</span><span style="color:#3b691a">#</span><span style="color:#2e5513">#</span><span style="color:#2d3810">#</span><span style="color:#2b4510">#</span><span style="color:#305315">#</span><span style="color:#325316">#</span><span style="color:#332910">#</span><span style="color:#32210f">##</span><br><span style="color:#684122">3</span><span style="color:#613e20">##</span><span style="color:#5c3d1f">#</span><span style="color:#4f3119">#</span><span style="color:#466a1b">#</span><span style="color:#588129">S</span><span style="color:#506422">#</span><span style="color:#497d1d">#</span><span style="color:#47851d">#</span><span style="color:#325417">#</span><span style="color:#315216">#</span><span style="color:#2e5213">#</span><span style="color:#2c1e0d">#</span><span style="color:#2d220e">#</span><span style="color:#2a310e">##</span><span style="color:#3b2412">#</span><span style="color:#3e2713">#</span><span style="color:#452d16">#</span><br><span style="color:#764a26">#</span><span style="color:#6c4423">#S</span><span style="color:#5f4020">#</span><span style="color:#4f331a">#</span><span style="color:#472d17">####</span><span style="color:#493f18">#</span><span style="color:#313512">#</span><span style="color:#342510">##</span><span style="color:#3d2713">###</span><span style="color:#4a2d16">####</span><br><span style="color:#6d4424">#</span><span style="color:#57361c">###</span><span style="color:#623d1f">#</span><span style="color:#744926">#</span><span style="color:#6f4624">#</span><span style="color:#5c3a1e">#</span><span style="color:#5e3b1e">##</span><span style="color:#3d2613">#</span><span style="color:#402815">#</span><span style="color:#3f2a18">########</span><br><span style="color:#6d4424">#</span><span style="color:#5a381d">#3</span><span style="color:#4f351b">#</span><span style="color:#4e3119">#</span><span style="color:#5e3b1e">#</span><span style="color:#6a4323">###</span><span style="color:#6b4222">#</span><span style="color:#482c16">#</span><span style="color:#432914">###</span><span style="color:#352010">####</span><span style="color:#462f18">#</span><span style="color:#342315">#</span><br><span style="color:#57361c">#</span><span style="color:#5f3c1f">#</span><span style="color:#6c4423">#</span><span style="color:#6f4d25">##</span><span style="color:#56361c">#</span><span style="color:#664021">#</span><span style="color:#643f20">##</span><span style="color:#5d3b1e">#</span><span style="color:#4b2e18">#</span><span style="color:#3c2412">#</span><span style="color:#3f2613">#</span><span style="color:#331f0f">###</span><span style="color:#4d3119">##</span><span style="color:#3f2a14">##</span><br><span style="color:#684122">#</span><span style="color:#56361c">#</span><span style="color:#593a1d">#</span><span style="color:#644121">#</span><span style="color:#6e4523">#</span><span style="color:#4c3724">#</span><span style="color:#764a27">#</span><span style="color:#5f3b1e">##</span><span style="color:#664221">#</span><span style="color:#452c17">#</span><span style="color:#3a2312">#</span><span style="color:#51331a">#</span><span style="color:#4c3017">#</span><span style="color:#432a15">#</span><span style="color:#3f2613">##</span><span style="color:#372010">#</span><span style="color:#4a2f17">#</span><span style="color:#432a16">#</span><br><span style="color:#756354">7</span><span style="color:#745336">%</span><span style="color:#6f4825">#</span><span style="color:#4c3419">#</span><span style="color:#603c1f">##</span><span style="color:#654021">#</span><span style="color:#55351b">##</span><span style="color:#59391d">#</span><span style="color:#422915">#</span><span style="color:#3e2613">####</span><span style="color:#3b2311">###</span><span style="color:#4b3926">M</span><span style="color:#595047">7</span><br><span style="color:#808080"> </span><span style="color:#71675a">j</span><span style="color:#785a3f">%</span><span style="color:#664022">#</span><span style="color:#603b1e">#</span><span style="color:#4f3119">#</span><span style="color:#6e4925">#</span><span style="color:#7b4e28">N</span><span style="color:#3c2412">#</span><span style="color:#3a2312">##</span><span style="color:#321f10">#</span><span style="color:#392717">#</span><span style="color:#524030">M</span><span style="color:#655c53">7</span><br><span style="color:#808080"> </span><span style="color:#756a61">j</span><span style="color:#6d5641">7</span><span style="color:#654424">#</span><span style="color:#654021">#</span><span style="color:#422915">#</span><span style="color:#482d18">#</span><span style="color:#584838">C</span><span style="color:#69635c">h</span><br><span style="color:#808080"> </span><span style="color:#746e67">^</span><span style="color:#706b65">\</span> | ||
|
||
|
||
|
||
""".replace('\n', '').replace("</span>", "").replace("<span", "").replace(" ", "") | ||
lines = html.split("<br>") | ||
|
||
|
||
def proc_line(s: str) -> list[dict]: | ||
index = 0 | ||
result = [] | ||
length = 0 | ||
while index < len(s): | ||
color_index = s.find("style=\"color:", index) | ||
if color_index == -1: | ||
result.append({ | ||
'text': s[index:], | ||
}) | ||
break | ||
else: | ||
color = s[color_index + 13: color_index + 20] | ||
str_start = s.find("\">", color_index) + 2 | ||
str_end = s.find("style=", str_start) | ||
if str_end == -1: | ||
str_end = len(s) | ||
# in MC, the width of space is 4, but for chars, it's 6 | ||
text = s[str_start:str_end].replace(" ", " ").replace(" ", " ") | ||
for ch in text: | ||
if ch == ' ': | ||
length += 4 | ||
else: | ||
length += 6 | ||
result.append({ | ||
'text': text, | ||
'color': color | ||
}) | ||
index = str_end | ||
result.append({ | ||
'text': " " * ((120 - length) // 4), | ||
'color': "#000000" | ||
}) | ||
return result | ||
|
||
|
||
lines = [proc_line(line) for line in lines] | ||
with open("../../src/main/resources/assets/reden/minefetch/.json", "w") as f: | ||
f.write(json.dumps(lines)) |
This file contains 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 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
Oops, something went wrong.
Oops, something went wrong.
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.
What is this command used for?
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.
get chars that have the same width to generate ascii art