JohnnyJayJay / spigot-maps

A library to simplify the use of customised maps in Spigot.
GNU Lesser General Public License v3.0
48 stars 4 forks source link

Add support for animated gifs #1

Closed JohnnyJayJay closed 5 years ago

JohnnyJayJay commented 5 years ago

Is your feature request related to a problem? Please describe. It's currently not possible to represent animated gifs conveniently as this library does not provide methods for that matter.

Describe the solution you'd like A possibility to turn a RenderedMap into a gif by periodically reloading the map with the next frame. Though this could be hard to accomplish because spigot does not expose an API to manipulate maps in that way.

Describe alternatives you've considered A simpler, doable, yet probably much more inefficient way would be to provide a way to get a RenderedMap for each frame of a gif. I considered combining this with reactor-core. There could be a method, which, based on previously set attributes like the gif source, the fps and so on, returns a Flux that emits a RenderedMap for each frame of the gif in a period matching the FPS. This could be consumed in a way that it continously replaces a map in an item frame ingame, for example.

This would not make it possible to render a gif on a single map and it would perhaps be too much overhead for its purpose.

Additional context The most important task to find a proper solution to this is to look for a way to re-initialize existing maps.

JohnnyJayJay commented 5 years ago

I just found out that maps do not need to be reloaded to change the content as each map calls its renderers once per tick. Using this it is very easy to simply make a new renderer implementation.

JohnnyJayJay commented 5 years ago

Pull request resolving this issue was merged into master.