aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/themes/TextureManager.java
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-02-13 15:47:42 +0100
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-02-13 15:47:42 +0100
commit0542327df8cf1deb62d7446d350059c9e5ae1152 (patch)
tree84edc7796fe7bb4465494aefcd82dd34078ab224 /src/main/java/io/polyfrost/oneconfig/themes/TextureManager.java
parent3857800292a7cc078ee05c5487b11a256682bef1 (diff)
downloadOneConfig-0542327df8cf1deb62d7446d350059c9e5ae1152.tar.gz
OneConfig-0542327df8cf1deb62d7446d350059c9e5ae1152.tar.bz2
OneConfig-0542327df8cf1deb62d7446d350059c9e5ae1152.zip
work
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/themes/TextureManager.java')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/themes/TextureManager.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/themes/TextureManager.java b/src/main/java/io/polyfrost/oneconfig/themes/TextureManager.java
index 749dea6..fd636f2 100644
--- a/src/main/java/io/polyfrost/oneconfig/themes/TextureManager.java
+++ b/src/main/java/io/polyfrost/oneconfig/themes/TextureManager.java
@@ -1,6 +1,5 @@
package io.polyfrost.oneconfig.themes;
-import javafx.util.Pair;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
@@ -10,6 +9,7 @@ import net.minecraft.util.ResourceLocation;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import static io.polyfrost.oneconfig.themes.Themes.themeLog;
@@ -18,7 +18,7 @@ public class TextureManager {
private static final Minecraft mc = Minecraft.getMinecraft();
private final List<ResourceLocation> resources = new ArrayList<>();
private final List<ThemeElement> tickableTextureLocations = new ArrayList<>();
- private final List<Pair<Integer, Integer>> tickableTextures = new ArrayList<>();
+ private final HashMap<Integer, Integer> tickableTextures = new HashMap<>();
private int tick = 0;
/**
@@ -42,7 +42,7 @@ public class TextureManager {
if(img.getWidth() != img.getHeight()) {
themeLog.info("found tickable animated texture (" + element.name() + "). Loading texture");
tickableTextureLocations.add(element);
- tickableTextures.add(new Pair<>(img.getWidth(), img.getHeight()));
+ tickableTextures.put(img.getWidth(), img.getHeight());
}
}
}
@@ -62,8 +62,8 @@ public class TextureManager {
mc.getTextureManager().bindTexture(location);
try {
if(tickableTextureLocations.contains(element)) {
- int texWidth = tickableTextures.get(0).getKey(); // TODO unsure if this works safe
- int texHeight = tickableTextures.get(0).getValue();
+ int texWidth = tickableTextures.keySet().stream().findFirst().get(); // TODO unsure if this works safe
+ int texHeight = tickableTextures.values().stream().findFirst().get();
int frames = texHeight / texWidth;
while(tick < frames) {
Gui.drawModalRectWithCustomSizedTexture(x, y, 0, (tick * texWidth), texWidth, texWidth, texWidth, texWidth);