aboutsummaryrefslogtreecommitdiff
path: root/gtpp/src/main/java/gtPlusPlus/api/objects/minecraft/SafeTexture.java
diff options
context:
space:
mode:
authorRaven Szewczyk <git@eigenraven.me>2024-05-24 19:50:35 +0100
committerRaven Szewczyk <git@eigenraven.me>2024-05-24 19:50:35 +0100
commit6d1b2216464d4dad449ac6fcfec476832224a55e (patch)
tree526a0c15f7056313c80e6c0386e025e9b3f61781 /gtpp/src/main/java/gtPlusPlus/api/objects/minecraft/SafeTexture.java
parentb5d35f40afa606ed1b07061dad82e0521a59c186 (diff)
downloadGT5-Unofficial-6d1b2216464d4dad449ac6fcfec476832224a55e.tar.gz
GT5-Unofficial-6d1b2216464d4dad449ac6fcfec476832224a55e.tar.bz2
GT5-Unofficial-6d1b2216464d4dad449ac6fcfec476832224a55e.zip
Merge addon sources
Diffstat (limited to 'gtpp/src/main/java/gtPlusPlus/api/objects/minecraft/SafeTexture.java')
-rw-r--r--gtpp/src/main/java/gtPlusPlus/api/objects/minecraft/SafeTexture.java65
1 files changed, 0 insertions, 65 deletions
diff --git a/gtpp/src/main/java/gtPlusPlus/api/objects/minecraft/SafeTexture.java b/gtpp/src/main/java/gtPlusPlus/api/objects/minecraft/SafeTexture.java
deleted file mode 100644
index 58a7affa90..0000000000
--- a/gtpp/src/main/java/gtPlusPlus/api/objects/minecraft/SafeTexture.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package gtPlusPlus.api.objects.minecraft;
-
-import java.util.HashMap;
-
-import net.minecraft.util.IIcon;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import gregtech.api.GregTech_API;
-import gtPlusPlus.core.util.Utils;
-
-/**
- * A Server Side safe object that can hold {@link IIcon}s.
- *
- * @author Alkalus
- *
- */
-public class SafeTexture implements Runnable {
-
- @SideOnly(Side.CLIENT)
- private static final HashMap<Integer, IIcon> mHashToIconCache = new HashMap<>();
-
- @SideOnly(Side.CLIENT)
- private static final HashMap<String, Integer> mPathToHashCash = new HashMap<>();
-
- private static final HashMap<String, SafeTexture> mTextureObjectCache = new HashMap<>();
-
- private final int mHash;
-
- private final String mTextureName;
-
- private static String getKey(String aTexPath) {
- String aNameKey = Utils.sanitizeString(aTexPath);
- aNameKey = aNameKey.replace('/', ' ');
- aNameKey = aNameKey.toLowerCase();
- return aNameKey;
- }
-
- public static SafeTexture register(String aTexturePath) {
- String aNameKey = getKey(aTexturePath);
- SafeTexture g = mTextureObjectCache.get(aNameKey);
- if (g == null) {
- g = new SafeTexture(aTexturePath);
- mTextureObjectCache.put(aNameKey, g);
- mPathToHashCash.put(aTexturePath, aTexturePath.hashCode());
- }
- return g;
- }
-
- private SafeTexture(String aTexturePath) {
- mTextureName = aTexturePath;
- mHash = getKey(aTexturePath).hashCode();
- GregTech_API.sGTBlockIconload.add(this);
- }
-
- @SideOnly(Side.CLIENT)
- public IIcon getIcon() {
- return mHashToIconCache.get(mHash);
- }
-
- @Override
- public void run() {
- mHashToIconCache.put(getKey(mTextureName).hashCode(), GregTech_API.sBlockIcons.registerIcon(mTextureName));
- }
-}