terrarium-earth / Ad-Astra

Ad Astra is a Minecraft space tech and exploration mod!
https://modrinth.com/mod/ad-astra
Other
155 stars 84 forks source link

[Bug]: Custom radio station list is ignored #591

Open x13x54 opened 4 months ago

x13x54 commented 4 months ago

Bug Description

I am an admin on a small private server running the ATM9 modpack (latest version of adastra). I was looking to add/modify the list of radio stations to be more in line with personal preferences.

After not being able to find any options in server, client, or common config files for ad astra, i went to the discord to ask about a possible feature request. Here i found out that there is in fact a feature that was not documented in purpose, for the stated reason of "what if someone configures a station with the wrong audio format?". After receiving the bare minimum of information, which included the most recent message on the JVM arguments missing the quite important D in the option, i managed to set it up correctly.

I used the stations.json from this repo as a template and only changed every parameter for the first entry. However when i join the server, the radio list remains unchanged! The audiostream played is the default one, and not the one i supplied the URL of.

My client-side game log has a line mentioning the loading of the stations.json by it's full absolute path. I searched my game log for the keywords "json", "station", "radio", and "astra" to hopefully find some clues to what is wrong but found no warnings, errors, exceptions, or other clues.

How to Reproduce?

  1. Download stations.json from this github repo and place in game instance root folder.
  2. Edit a string for a station in the stations.json file, either url, title, name, or all. Save the file.
  3. Shift+right-click on the stations.json file and select "copy as path" which copies the absolute path to that file.
  4. Add -Dadastra.stations=C:/full/path/to/stations.json to your JVM arguments.
  5. Start game and load onto server. On server, open the GUI of a radio and see/hear that it's just the default, unchanged stations list

Expected Behavior

Firstly, correctly following available instructions on using custom stations.json should result in my changes being visible/audible in-game. Secondly, i expect this feature to be documented properly so that users get it right the first time and don't have to spend lots of time figuring out this exists, the exact syntax, and why it doesn't work.

Not documenting this feature on purpose (admitted to on the discord and closed feature requests made by people who also didn't know this feature existed) is not only unprofessional but also gets in the way of responsible server-admins testing out a radio station before putting it in the server-wide stations.json and expecting everything to go well.

Version

1.15.18

Mod Loader Version

1.20.1 - 47.2.20

Mod Loader

Forge

Logs or additional context

JVM arguments: -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:+AlwaysPreTouch -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=32 -XX:G1HeapRegionSize=32M -Djava.net.preferIPv4Stack=true -Dadastra.stations=C:\Users\Administrator\AppData\Roaming\.minecraft\modpacks\2a667e76-e631-3913-a722-3238bc7d63cf\stations.json

Relevant game log lines: [com.teamresourceful.resourcefullib.common.lib.Constants/]: Loading stations from C:\Users\Administrator\AppData\Roaming\.minecraft\modpacks\2a667e76-e631-3913-a722-3238bc7d63cf\stations.json (due to size of game log, request something specific if you need it and i'll post it if it is in the log)

Full stations.json used: (only first entry was changed)

{
    "stations": [
        {
            "url": "https://stream.slam.nl/web12_mp3",
            "title": "SLAM 96.9",
            "name": "SLAM 96.9 FM The Drive"
        },
        {
            "url": "https://live.leanstream.co/CFOXFM-MP3",
            "title": "99.3 CFOX",
            "name": "99.3 CFOX"
        },
        {
            "url": "https://live.leanstream.co/CKIXFM-MP3",
            "title": "HOT 99.1",
            "name": "HOT 99.1"
        },
        {
            "url": "https://live.leanstream.co/CKXDFM-MP3",
            "title": "97.5 K-Rock",
            "name": "97.5 K-Rock"
        },
        {
            "url": "https://icecast-qmusicnl-cdp.triple-it.nl/Qmusic_nl_live_96.mp3",
            "title": "Qmusic NL",
            "name": "Qmusic NL"
        },
        {
            "url": "https://ice2.somafm.com/missioncontrol-128-mp3",
            "title": "Mission Control",
            "name": "SomaFM Mission Control"
        },
        {
            "url": "https://playerservices.streamtheworld.com/api/livestream-redirect/ARN_KIIS1011.mp3",
            "title": "KIIS 101.1",
            "name": "KIIS 101.1"
        },
        {
            "url": "https://0n-games.radionetz.de/0n-games.mp3",
            "title": "0N Games",
            "name": "0N Radio - Games"
        },
        {
            "url": "https://0n-latin.radionetz.de/0n-latin.mp3",
            "title": "0N Latin",
            "name": "0N Radio - Latin"
        },
        {
            "url": "https://0n-radio.radionetz.de/0n-radio.mp3",
            "title": "0N Radio",
            "name": "0N Radio"
        },
        {
            "url": "https://stream.antenne1.de/a1stg/livestream2.mp3",
            "title": "antenne1",
            "name": "antenne1"
        },
        {
            "url": "https://play.sas-media.ru/play_256",
            "title": "Noise FM",
            "name": "Noise FM"
        }
    ]
}

Code of Conduct

PantsWP commented 4 months ago

I wanted to configure custom radio stations as well and after seeing discussions on the Discord from OP trying to get them working (but failed), I decided I would try to see if I could reproduce the issue. I also agree that proper documentation should be provided for this process. For example, it's not mentioned anywhere that the directory path needs "" if the folder names have spaces. I had to look this up myself. I'm happy to write up a guide and share it in the Discord server once this issue has been resolved.

I had placed the stations.json file in the server root directory that was using the same version of the mod (1.15.18) that OP used but through a different modpack - FTB Presents Direwolf20 1.20 version 1.16. I used the template provided through GitHub and removed all stations but one and replaced it with this:

{
    "stations": [
        {
            "url": "https://n06.rcs.revma.com/hyyz8327ptzuv",
            "title": "Star Cambridge",
            "name": "Star Cambridge"
        }
    ]
}

I then booted up the server with the JVM argument and Resourceful Lib (2.1.25) successfully acknowledged the custom file in the server logs. However, when I opened the radio, I encountered the issue reported by OP where instead of grabbing the stations from the .json file, it was still listing and playing the default stations. 2024-07-24_16 38 18 I decided to investigate further by applying the JVM args to the client, linking it to the same .json file as the server in the same location. I joined the server and the issue persisted.

The final thing I tried was loading into a singleplayer world. Lo and behold, the radio actually loaded the custom station! 2024-07-24_16 43 21 So with that, we can say that the feature works on internal singleplayer servers, just not dedicated ones.

It could potentially be a Resourceful Lib issue, however no issues related to this problem has been reported on their bug tracker.

MonkaKokosowa commented 4 months ago

From my experience it's only possible to change in the source code, recompiling it with replaced .json file fixed the issue. Also, the recompiled .jar is only needed on the server side, since all the clients take the radio list from the server

x13x54 commented 4 months ago

since all the clients take the radio list from the server

Does this only happen when custom stations are used or always? I'm starting to have a suspicion as to why we're having these issues ...assuming there's not some other thing that we're doing incorrectly that we simply don't know about.

It surely would be nice to be able to read the exact workings of this feature in the documentation so we don't have to make assumptions that may turn out to be incorrect when more information becomes available

maxim7w1 commented 2 weeks ago

Hey, sorry for reviving this dead issue, however I want to add two points for other people who, like me, found this on Google:

1) The command /adastra radio refresh allows to change and reload the stations.json pointed at by your -Dadastra.stations flag without restarting the server.

2) The exact same problem OP had was solved for me by removing any non-ASCII characters from the radio names/titles. In my case, the German 'Ü' caused this issue.

I assume that 'malformed' JSON causes the mod to fall back on the default stations, so it might be worth looking at if you have the same problem.

Edit: also check if you have mp3 streams, HLS and DASH don't really work