Closed paulzzh closed 5 years ago
This is due to a MC bug, the protocol has remained but something about the data has changed. The relevant issue on the MC tracker has been reopened: https://bugs.mojang.com/browse/MC-121282 After inspection with wireshark I found that if you copy-paste the data the vanilla client sends, it works correctly, but that data is not a plain 1:1 base64 encoding of the PNG anymore.
Another note about the relevant code: It's not really efficient to reload the file every launch, so I'm locally patching the code to do this now, which also allows me to paste in a working string and get an icon for the time being:
# in file 'quarry/net/server.py' at line 255:
if self.factory.favicon is not None:
d["favicon"] = self.factory.favicon # todo: Patch! Also, stop using 'base64.encodestring', it's deprecated and adds \n's for no reason.
#with open(self.factory.favicon, "rb") as fd:
# d["favicon"] = "data:image/png;base64," + base64.encodestring(
# fd.read()).decode('ascii')
Edit: I should have waited a bit longer before posting this, for a quicker fix, see the PR linked below.
Fixed in #49, thanks @dries007!
My code: (It's a copy of 'example/server_downtime.py')
from twisted.internet import reactor from quarry.net.server import ServerFactory, ServerProtocol class DowntimeProtocol(ServerProtocol): def packet_login_start(self, buff): buff.discard()
self.close(self.factory.motd)
class DowntimeFactory(ServerFactory): protocol = DowntimeProtocol
def waitmain():
Create factory
waitmain()
In fact, it doesn't work very well: I have delete the 'server.dat' ,but it‘s useless.. I 'm sure I have put a 'icon.png' with the script. This 'icon.png' works well in a 1.13 vanilla server.