-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Make server icon modifiable by users #30
Comments
Yep it is a good idea! I already thought this as a possibility but the conversion from png to base 64 is not very straight forward because minecraft uses a different encoder I think. |
we have to try to send a raw image base64 encoded with: base64.b64encode() even thought the same image results in a different set of bytes if sent via original server or with b64encode() method (I think that the minecraft server sends an image with the transparent pixels compressed in some way, that are not removed when encoded through the b64encode() method) still it's a nice experiment to see if the clients can just accept a different set of bytes and result in the same image... |
I think it’s related, so what about adding configuration for custom hibernation and startup messages? I modified the Python version for that until now but since it’s deprecated… Sorry if it was already present or proposed. |
Yes, we deprecated the Python Version simply because of too much overhead for maintenance. As for the go version; we plan to add instructions on how to build it by yourself, but basically it is a simple matter of installing go and running the command |
I'm working on adding this cool feature... but I'm having problems in finding the right encoding process to obtain the correct base64 encoded image. Now i managed to reverse engineer the server.jar file and i found this function (the only one containing "server-icon.png" ;) )
I'm not much of an expert in java but i think this might be the key to solve the puzzle... if someone is able to explain/translate to golang what is happening it would be really appreciated... |
While I don't have much experience with java, I do think that the actual conversion is happening in these lines:
The de-compilation of the server.jar might have caused some weirdness, especially with the last line. From what I can see though, first the image file is loaded, then written to a new output stream with the ImageIO.write function, after which the output stream gets encoded into base64, before finally a string is created for transmission with a UTF8 decoder. Of course, the specifics of each en-/decoding have to be looked up individually. |
Ok I sort of understood it in this way... Right now I wanted to do an example script in Java, to study and understand it better. |
This is the working java script to get the image base64 encoded:
I just downloaded and imported |
ok... apparently the base 64 encoding is not the issue but the so called "constant" (== 11264) which is not really constant since it increases with by 128 every step, depending on the length of the info message. I found the function to calculate this constant but I really cannot explain why at mojang they would implement something so strange (I guess they are doing something at the bit level) I still need to try some edge cases: there are some info lenghts that cannot be correctly interpreted no matter the constant... |
At the end i manged to completely remove the constant that was everything but constant ;)... I even found a much nicer way to calculate the header! I added this functionality in commit 9c680be I also updated the wiki regarding the header calculation to communicate with the server You can find the script in the dev branch: after checking if everything works as it should, i'll open a pull request to master Please let me know if you find some bugs |
Since one can usually set their own MC server icon by naming a 64x64 pixel png to "server-icon.png" and putting it in the main server folder, how about having the current static image as a kind of default image and trying to detect, once on script startup, whether there is a user image and then using that?
The text was updated successfully, but these errors were encountered: