import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
/**
* Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
*/
protected void actionPerformed(GuiButton button) throws IOException
{
if (button.enabled)
{
if (button.id == 2)
{
File file1 = this.mc.getResourcePackRepository().getDirResourcepacks();
OpenGlHelper.openFile(file1);
}
else if (button.id == 1)
{
if (this.changed)
{
List list = Lists.newArrayList();
for (ResourcePackListEntry resourcepacklistentry : this.selectedResourcePacks)
{
if (resourcepacklistentry instanceof ResourcePackListEntryFound)
{
list.add(((ResourcePackListEntryFound)resourcepacklistentry).getResourcePackEntry());
}
}
Collections.reverse(list);
this.mc.getResourcePackRepository().setRepositories(list);
this.mc.gameSettings.resourcePacks.clear();
this.mc.gameSettings.incompatibleResourcePacks.clear();
for (ResourcePackRepository.Entry resourcepackrepository$entry : list)
{
this.mc.gameSettings.resourcePacks.add(resourcepackrepository$entry.getResourcePackName());
if (resourcepackrepository$entry.getPackFormat() != 3)
{
this.mc.gameSettings.incompatibleResourcePacks.add(resourcepackrepository$entry.getResourcePackName());
}
}
this.mc.gameSettings.saveOptions();
this.mc.refreshResources();
}
this.mc.displayGuiScreen(this.parentScreen);
}
}
}