| 1230 | } |
| 1231 | |
| 1232 | @Override |
| 1233 | public InputStream getMinecraftIcon() throws Exception { |
| 1234 | Class<?> minecraft = Thread.currentThread().getContextClassLoader().loadClass(Names.minecraft.getName()); |
| 1235 | InputStream is; |
| 1236 | if (Transformer.FORGE) { |
| 1237 | Object minecraftInstance = minecraft.getMethod("func_71410_x").invoke(null); |
| 1238 | Field resourcePackField = minecraft.getDeclaredField("field_110450_ap"); |
| 1239 | resourcePackField.setAccessible(true); |
| 1240 | Object resourceManager = resourcePackField.get(minecraftInstance); |
| 1241 | is = (InputStream) resourceManager.getClass().getMethod("func_152780_c", Thread.currentThread().getContextClassLoader().loadClass(Names.resourceLocation.getName())).invoke( |
| 1242 | resourceManager, MinecraftFactory.getVars().createResourceLocation("icons/icon_16x16.png")); |
| 1243 | } else { |
| 1244 | Object minecraftInstance = minecraft.getMethod("A").invoke(null); |
| 1245 | Field aB = minecraft.getDeclaredField("aB"); |
| 1246 | aB.setAccessible(true); |
| 1247 | Object resourceManager = aB.get(minecraftInstance); |
| 1248 | is = (InputStream) resourceManager.getClass().getMethod("c", Class.forName(Names.resourceLocation.getName())).invoke(resourceManager, |
| 1249 | MinecraftFactory.getVars().createResourceLocation("icons/icon_32x32.png")); |
| 1250 | if (is == null) { |
| 1251 | is = (InputStream) resourceManager.getClass().getMethod("c", Class.forName(Names.resourceLocation.getName())).invoke(resourceManager, |
| 1252 | MinecraftFactory.getVars().createResourceLocation("icons/icon_16x16.png")); |
| 1253 | } |
| 1254 | } |
| 1255 | return is; |
| 1256 | } |
| 1257 | |
| 1258 | @Override |
| 1259 | public boolean isMainThread() { |