Jump to content

[1.7.10] Transfer files to client


MultiMote

Recommended Posts

Hello everyone. I have a question. I need to transfer binary files from server to client.

 

After studying the Minecraft code, I came to the conclusion that Minecraft downloads custom resourcepack from server via http, there is method ResourcePackRepository#func_148528_a:

 

width=800 height=433http://up42.ru/u/p/2015-01-10_10.55.43.png[/img]

 

So, what can I do? How to send request to server? How to share required files on server?

Thanks and sorry for my language mistakes.

Link to comment
Share on other sites

Question - what kind of files and what sizes/quantity you want to send?

 

I for one am using ingame downloader, player events get cancelled for short time after you log in on server (0 interaction) and in VERY short time everything is downloaded/sychronized using packets.

Obviously I am using CheckSums (hashes).

 

Steps:

Since PlayerLoggedInEvent is launched ONLY on Server i had to 1st send packet from server to client that is literally "start synchronization" msg.

1. Cancel player events.

2. Server -> Client - open GUI on client that shows progress.

3. Client -> Server - get all cached files and generate hashes, put all into NBTTagList and send.

4. Server comapres hashes (note server-side hashes are pre-generated on startup)

5. Server sends series of packets: Lacking files and clear-cache packet containing hashes that are not on server (client removes them from cache).

 

Note: This will work for literally everything you try to upload to client (server too lel), BUT you will need to use some packet-structure for bigger files.  Player event cancellation makes sure he won't die/anything during synchro.

 

P.S - this system is only good for smallr files, more like game data (sending skills, classes, races maybe, some special data like quests (lore, NPC talks)  that you don't want to send everytime player is doing it). For bigger ones I'd suggest custom connection thread - in this caste it's just java stuff (ask google).

 

Edit: Yes you can put binary file into packet (rather packetS) you will just need to read more about it (it's java, i suggest StackOverflow site)

 

Oh and i got confused by "Transfer files to client" and "transfer binary files from client to server." (Described 1st one)

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.