| 1242 | } |
| 1243 | |
| 1244 | @Override |
| 1245 | public InputStream getMinecraftIcon() throws Exception { |
| 1246 | Class<?> minecraft = Thread.currentThread().getContextClassLoader().loadClass(Names.minecraft.getName()); |
| 1247 | InputStream is; |
| 1248 | if (Transformer.FORGE) { |
| 1249 | Object minecraftInstance = minecraft.getMethod("func_71410_x").invoke(null); |
| 1250 | Field resourcePackField = minecraft.getDeclaredField("field_110450_ap"); |
| 1251 | resourcePackField.setAccessible(true); |
| 1252 | Object resourceManager = resourcePackField.get(minecraftInstance); |
| 1253 | is = (InputStream) resourceManager.getClass().getMethod("func_152780_c", Thread.currentThread().getContextClassLoader().loadClass(Names.resourceLocation.getName())).invoke( |
| 1254 | resourceManager, MinecraftFactory.getVars().createResourceLocation("icons/icon_16x16.png")); |
| 1255 | } else { |
| 1256 | Object minecraftInstance = minecraft.getMethod("z").invoke(null); |
| 1257 | Field aB = minecraft.getDeclaredField("aC"); |
| 1258 | aB.setAccessible(true); |
| 1259 | Object resourceManager = aB.get(minecraftInstance); |
| 1260 | is = (InputStream) resourceManager.getClass().getMethod("c", Class.forName(Names.resourceLocation.getName())).invoke(resourceManager, |
| 1261 | MinecraftFactory.getVars().createResourceLocation("icons/icon_32x32.png")); |
| 1262 | if (is == null) { |
| 1263 | is = (InputStream) resourceManager.getClass().getMethod("c", Class.forName(Names.resourceLocation.getName())).invoke(resourceManager, |
| 1264 | MinecraftFactory.getVars().createResourceLocation("icons/icon_16x16.png")); |
| 1265 | } |
| 1266 | } |
| 1267 | return is; |
| 1268 | } |
| 1269 | |
| 1270 | @Override |
| 1271 | public boolean isMainThread() { |