コード例 #1
0
 @Override
 public int compare(CreativeTabs o1, CreativeTabs o2) {
   if (isVanillaTab(o1) && isVanillaTab(o2)) {
     // ReikaJavaLibrary.pConsole(o1.getTabLabel()+"@"+o1.tabIndex+" :
     // "+o2.getTabLabel()+"@"+o2.tabIndex+" > "+(o1.tabIndex-o2.tabIndex));
     return o1.tabIndex - o2.tabIndex;
   } else if (isVanillaTab(o1)) {
     return Integer.MIN_VALUE;
   } else if (isVanillaTab(o2)) {
     return Integer.MAX_VALUE;
   } else {
     return DragonOptions.SORTCREATIVE.getState()
         ? String.CASE_INSENSITIVE_ORDER.compare(o1.getTabLabel(), o2.getTabLabel())
         : o1.tabIndex - o2.tabIndex;
   }
 }
コード例 #2
0
  @Override
  public void init(FMLInitializationEvent event) {
    super.init(event);

    ClientCommandHandler.instance.registerCommand(new ClientCommandsVC());

    MinecraftForge.EVENT_BUS.register(this);
    FMLCommonHandler.instance().bus().register(this);
    MinecraftForge.EVENT_BUS.register(new RenderFog());

    if (VintageCraftConfig.rearrangeCreativeTabs) {
      int i = 0;

      CreativeTabs[] tabs = new CreativeTabs[CreativeTabs.creativeTabArray.length];

      for (CreativeTabs tab : CreativeTabs.creativeTabArray) {
        if (tab instanceof CreativeTabsVC) {
          if (i == 5 || i == 11) i++; // don't touch search tab or inventory tab
          tab.tabIndex = i;
          tabs[i++] = tab;
        }
      }

      tabs[5] = CreativeTabs.tabAllSearch;
      tabs[11] = CreativeTabs.tabInventory;
      i = 7;

      for (CreativeTabs tab : CreativeTabs.creativeTabArray) {
        if (!(tab instanceof CreativeTabsVC)
            && !tab.getTabLabel().equals("search")
            && !tab.getTabLabel().equals("inventory")) {
          if (i == 11) i++;
          tab.tabIndex = i;
          tabs[i++] = tab;
        }
      }

      CreativeTabs.creativeTabArray = tabs;

      /*for (CreativeTabs tab : CreativeTabs.creativeTabArray) {
      	System.out.println(tab.getTabLabel() + ": " + tab.tabIndex);
      }*/
    }
  }