co3moz / minecraft-render

Minecraft block rendering with node.js
MIT License
42 stars 21 forks source link

Quick fix for animated texture blocks #6

Closed tehbeard closed 3 years ago

tehbeard commented 3 years ago

NOTE: This patch does not create animated textures.

This patch fixes the stretching/texture glitch on blocks that have animated textures.

Animations are handled by a filmstrip image (frames stacked beneath each other) and a .mcmeta file for metadata on timing and whether interpolation of the frames between each "real" frame should occur.

So, we check for this file and if it's found, force width and height to be the same for the texture material (afaik in vanilla, all animated textures are square so this lets us just map to the first frame of the filmstrip).

It doesn't give us animated textures, but it's a start, allows us to use the output for non animated needs, and caches the meta data file contents in similar manner to the texture cache.