Skip to content

Commit

Permalink
1.21.4 v2.3.0 (#63)
Browse files Browse the repository at this point in the history
* Remove soundtrack key from musics.json

* Fix album name not showing

* Draw scrollable text for title & author

* Update test packs

* Bump version 2.3.0
  • Loading branch information
KosmoMoustache authored Dec 15, 2024
1 parent a994acd commit 88dec9f
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 18 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Security

## [2.3.0] - 2025-12-15

- Key 'soundtrack' in musics.json is no longer supported

### Fixed

- Long title, author and album name where cut in the toast
- Wrong version pack format

## [2.2.2] - 2024-12-01

- Support for 1.21.4
Expand Down
4 changes: 0 additions & 4 deletions common/src/main/java/net/kosmo/music/impl/MusicManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,6 @@ public static Music parseJsonObject(Map.Entry<String, JsonElement> json) throws
String title = GsonHelper.getAsString(jsonObject, "title");
String author = GsonHelper.getAsString(jsonObject, "author");
String album = GsonHelper.getAsString(jsonObject, "album", null);
if (album == null) {
album = GsonHelper.getAsString(jsonObject, "soundtrack");
ClientMusic.LOGGER.error("Key 'soundtrack' of '{}' is deprecated, use 'album' instead", title);
}
AlbumCover cover = AlbumCover.parseAlbumCover(GsonHelper.getAsString(jsonObject, "cover", null));
boolean isRandom = GsonHelper.getAsBoolean(jsonObject, "isRandom", false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static void drawScrollableText(GuiGraphics context, Font textRenderer, Co
double g = Mth.lerp(f, 0.0, (double) l);

context.enableScissor(clipAreaX1, clipAreaY1, clipAreaX2, clipAreaY2);
// context.fill(clipAreaX1,clipAreaY1,clipAreaX2,clipAreaY2, Colors.RED);
// context.fill(clipAreaX1,clipAreaY1,clipAreaX2,clipAreaY2, CommonColors.RED);
context.drawString(textRenderer, text.getVisualOrderText(), startX - (int) g, j, color, shadow);
context.disableScissor();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,13 @@ public void render(GuiGraphics guiGraphics, Font font, long startTime) {
this.albumCover.drawAlbumCover(guiGraphics, 6, 6);
guiGraphics.pose().popPose();

guiGraphics.drawString(font, this.title, 30, 7, ClientMusic.isDarkModeEnabled ? 0xff75ff : -11534256, false);
RenderHelper.drawScrollableText(guiGraphics, font, this.title, 30, 30, 7, this.width() - 4, 7 + font.lineHeight, ClientMusic.isDarkModeEnabled ? 0xff75ff : -11534256, false, 30, 0, this.width() + 4, this.height());

if (ClientMusic.config.SHOW_AUTHOR) {
guiGraphics.drawString(font, this.author, 30, 18, ClientMusic.isDarkModeEnabled ? -3355444 : CommonColors.BLACK, false);
RenderHelper.drawScrollableText(guiGraphics, font, this.author, 30, 30, 18, this.width() - 4, 18 + font.lineHeight, ClientMusic.isDarkModeEnabled ? -3355444 : CommonColors.BLACK, false, 30, 0, this.width() + 4, this.height());
}
if (ClientMusic.config.SHOW_ALBUM_NAME) {
// TODO: Make the mask follow the X of the toast
RenderHelper.drawScrollableText(guiGraphics, font, this.albumName, 30, 30, 29, this.width() - 4, 29 + font.lineHeight, ClientMusic.isDarkModeEnabled ? -3355444 : CommonColors.BLACK, false, guiGraphics.guiWidth() - 160 + 30, 0, guiGraphics.guiWidth() - 4, 44);
RenderHelper.drawScrollableText(guiGraphics, font, this.albumName, 30, 30, 29, this.width() - 4, 29 + font.lineHeight, ClientMusic.isDarkModeEnabled ? -3355444 : CommonColors.BLACK, false, 30, 0, this.width() + 4, this.height());
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"pack_format": 34,
"pack_format": 46,
"description": [{"translate": "text.musicnotification.resourcepack.dark_mode.description", "fallback": "Turn Music Notification UI to dark mode."}]
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx4G

version=2.2.2
version=2.3.0
group=net.kosmo

enabledPlatforms=fabric,neoforge
Expand Down
4 changes: 2 additions & 2 deletions test/custom_musics.json/assets/musicnotification/musics.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"morediscs:music_disc_omen_sound": {
"title": "Omen",
"author": "Naps the Block",
"soundtrack": "More discs"
"album": "More discs"
},
"morediscs:records/music_disc_omen_sound": {
"title": "Omen Record",
"author": "Naps the Block",
"soundtrack": "More discs"
"album": "More discs"
},
"morediscs:music_disc_silence_sound": {
"title": "Silence",
Expand Down
3 changes: 2 additions & 1 deletion test/custom_musics.json/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"pack": {
"pack_format": 4,
"description": "Custom musics.json"
"description": "Custom musics.json",
"supported_formats": [4, 2147483647]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ tellraw @a ["",{"text":"\n\n####","bold":true},{"text":" List Of Musics ","bold"


# Aria Math
tellraw @a ["",{"text":"Disc 1 → ","bold":true},{"text":"Aria Math","bold":false,"italic":true,"color":"light_purple","clickEvent":{"action":"run_command","value":"/give @s minecraft:music_disc_11[minecraft:jukebox_playable={song:\"custom_disc:aria_math\"},minecraft:custom_model_data=1]"}}]
tellraw @a ["",{"text":"Disc 1 → ","bold":true},{"text":"Aria Math","bold":false,"italic":true,"color":"light_purple","clickEvent":{"action":"run_command","value":"/give @s minecraft:music_disc_11[custom_name='{\"text\":\"Aria Math\"}',minecraft:jukebox_playable={song:\"custom_disc:aria_math\"},minecraft:custom_model_data={strings:[\"aria_math\"]}]"}}]

# Seismic Stratigraphy
tellraw @a ["",{"text":"Disc 2 → ","bold":true},{"text":"Sweden","bold":false,"italic":true,"color":"aqua","clickEvent":{"action":"run_command","value":"/give @s minecraft:music_disc_11[minecraft:jukebox_playable={song:\"custom_disc:seismic_stratigraphy\"},minecraft:custom_model_data=2]"}}]
tellraw @a ["",{"text":"Disc 2 → ","bold":true},{"text":"Sweden","bold":false,"italic":true,"color":"aqua","clickEvent":{"action":"run_command","value":"/give @s minecraft:music_disc_11[custom_name='{\"text\":\"Seismic stratigraphy\"}',minecraft:jukebox_playable={song:\"custom_disc:seismic_stratigraphy\"},minecraft:custom_model_data={strings:[\"seismic_stratigraphy\"]}]"}}]

# Droopy Remembers
tellraw @a ["",{"text":"Disc 3 → ","bold":true},{"text":"Droopy Remembers","bold":false,"italic":true,"color":"aqua","clickEvent":{"action":"run_command","value":"/give @s minecraft:music_disc_11[minecraft:jukebox_playable={song:\"custom_disc:droopy_remembers\"},minecraft:custom_model_data=3]"}}]
tellraw @a ["",{"text":"Disc 3 → ","bold":true},{"text":"Droopy Remembers","bold":false,"italic":true,"color":"aqua","clickEvent":{"action":"run_command","value":"/give @s minecraft:music_disc_11[custom_name='{\"text\":\"Droopy Remembers\"}',minecraft:jukebox_playable={song:\"custom_disc:droopy_remembers\"},minecraft:custom_model_data={strings:[\"droopy_remembers\"]}]"}}]
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"model": {
"type": "select",
"property": "custom_model_data",
"cases": [
{
"when": "aria_math",
"model": {
"type": "model",
"model": "item/music_disc_aria_math"
}
},
{
"when": "seismic_stratigraphy",
"model": {
"type": "model",
"model": "item/music_disc_seismic_stratigraphy"
}
},
{
"when": "droopy_remembers",
"model": {
"type": "model",
"model": "item/music_disc_droopy_remembers"
}
}
]
}
}
2 changes: 1 addition & 1 deletion test/resource_pack_custom_disc/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"pack_format": 34,
"pack_format": 46,
"description": "Custom disc test"
}
}

0 comments on commit 88dec9f

Please # to comment.