package im.expensive.utils.render;
import com.mojang.blaze3d.systems.RenderSystem;
import im.expensive.utils.client.ClientUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import java.util.ArrayList;
import java.util.List;
public class GifUtils {
private static final List<ResourceLocation> gifFrames = new ArrayList<>();
private static int currentFrame = 0;
private static long lastFrameTime = 0;
private static long frameDelay = 15;
public static void GifRender(String resourceLocation,int x,int y,int width,int height,int numImages) {
for (int i = 0; i < numImages; i++) {
gifFrames.add(new ResourceLocation("impresive/duck-gif/" + resourceLocation + i + ".png"));
}
if (System.currentTimeMillis() - lastFrameTime > frameDelay) {
lastFrameTime = System.currentTimeMillis();
currentFrame = (currentFrame + 1) % gifFrames.size();
}
ResourceLocation currentImage = gifFrames.get(currentFrame);
DisplayUtils.drawImage(currentImage, x, y, width, height, -1);
}
}