| 1258 | } |
| 1259 | |
| 1260 | @Override |
| 1261 | public InputStream getMinecraftIcon() throws Exception { |
| 1262 | Class<?> minecraft = Thread.currentThread().getContextClassLoader().loadClass(Names.minecraft.getName()); |
| 1263 | InputStream is; |
| 1264 | if (Transformer.FORGE) { |
| 1265 | Object minecraftInstance = minecraft.getMethod("func_71410_x").invoke(null); |
| 1266 | Field resourcePackField = minecraft.getDeclaredField("field_110450_ap"); |
| 1267 | resourcePackField.setAccessible(true); |
| 1268 | Object resourceManager = resourcePackField.get(minecraftInstance); |
| 1269 | is = (InputStream) resourceManager.getClass().getMethod("func_152780_c", Thread.currentThread().getContextClassLoader().loadClass(Names.resourceLocation.getName())).invoke( |
| 1270 | resourceManager, MinecraftFactory.getVars().createResourceLocation("icons/icon_16x16.png")); |
| 1271 | } else { |
| 1272 | Object minecraftInstance = minecraft.getMethod("z").invoke(null); |
| 1273 | Field aB = minecraft.getDeclaredField("aE"); |
| 1274 | aB.setAccessible(true); |
| 1275 | Object resourceManager = aB.get(minecraftInstance); |
| 1276 | is = (InputStream) resourceManager.getClass().getMethod("c", Class.forName(Names.resourceLocation.getName())).invoke(resourceManager, |
| 1277 | MinecraftFactory.getVars().createResourceLocation("icons/icon_32x32.png")); |
| 1278 | if (is == null) { |
| 1279 | is = (InputStream) resourceManager.getClass().getMethod("c", Class.forName(Names.resourceLocation.getName())).invoke(resourceManager, |
| 1280 | MinecraftFactory.getVars().createResourceLocation("icons/icon_16x16.png")); |
| 1281 | } |
| 1282 | } |
| 1283 | return is; |
| 1284 | } |
| 1285 | |
| 1286 | @Override |
| 1287 | public boolean isMainThread() { |