gmitch215 / SocketMC

🖥️ Communicate directly with Minecraft Clients from the Server
http://socketmc.gmitch215.xyz/
GNU General Public License v3.0
11 stars 0 forks source link

Instruction Suggestions #47

Open ShaneBeee opened 4 days ago

ShaneBeee commented 4 days ago

Feature Type

API Addition

Description of Feature

After fiddling around with this API for a bit, I had a few suggestions:

1) Option to send something indefinitely. Ex: drawText with a duration of -1 would make it stay until the player logged out.

2) An ID/NamespacedKey based system for instructions, which can be used for different operations:

3) I haven't seen anything relating to this so I may have missed something, but more options for Text/drawText would be nice, such as font, text size, angle.

gmitch215 commented 4 days ago

Feature Type

API Addition

Description of Feature

After fiddling around with this API for a bit, I had a few suggestions:

  1. Option to send something indefinitely. Ex: drawText with a duration of -1 would make it stay until the player logged out.

This is possible, however I'm not sure about long-term memory implications. Drawing is currently implemented to repeat once a frame until the timer ends. I'll do some testing to see if anything is significantly impacted.

  1. An ID/NamespacedKey based system for instructions, which can be used for different operations:
  • Remove an instruction from a player (ie: send a drawText instruction with an infinite duration, and later remove it from the player after a specific condition has been met)
  • Update an instruction for a player (ie: rather than waiting for it to self remove, and having to send a drawText again, just update that based on the ID for said instruction)

I think it might be easier to have a Retriever for all active Instructions drawing things on the screen, containing their parameters along with a UUID, along with an Instruction to remove specific/all Instructions on a screen. Bukkit NamespacedKeys cannot exist in Instruction code since the class doesn't exist on the client, which is why I made my own. If I do end up using the Identifier system instead of the UUID system, I might make input optional. What do you think?

  1. I haven't seen anything relating to this so I may have missed something, but more options for Text/drawText would be nice, such as font, text size, angle.

Fonts are usually dependent on the resource pack the client has. I can see if any internal code takes in bitmap fonts that could be sent with the Instruction, but to my knowledge this is how it is handled. If not, they might take in system fonts pre-installed on the computer, which could be a good feature. I plan to make an Instruction that allows sending a full resource pack to the client, but I still need to plan everything out (with my primary concerns being security and reliability).

Angled texts (and maybe even objects) are an interesting concept I've never thought of before. I'll have to do more research on it. I'll see what I can do.

ShaneBeee commented 4 days ago

Thank you! I appreciate anything you can do. This is a really cool mod/API. Great idea!