コード例 #1
0
  public static CreativeTabs getTabStorageDrawers() {
    if (tabStorageDrawers != null) return tabStorageDrawers;

    IStorageDrawersApi api = StorageDrawersApi.instance();
    if (api == null) return null;

    IUserConfig config = api.userConfig();
    if (config.addonConfig().addonItemsUseSeparateTab()
        && config.addonConfig().showAddonItemsVanilla()) {
      tabStorageDrawers =
          new CreativeTabs("storageDrawersErebus") {
            @Override
            @SideOnly(Side.CLIENT)
            public Item getTabIconItem() {
              return getTabItem();
            }
          };
    }

    return tabStorageDrawers;
  }
コード例 #2
0
  public void init() {
    IStorageDrawersApi api = StorageDrawersApi.instance();
    if (api == null) return;

    IPackBlockFactory factory = api.packFactory();
    IPackDataResolver resolver = StorageDrawersPack.instance.resolver;

    fullDrawers1 = factory.createBlock(BlockConfiguration.BasicFull1, resolver);
    fullDrawers2 = factory.createBlock(BlockConfiguration.BasicFull2, resolver);
    fullDrawers4 = factory.createBlock(BlockConfiguration.BasicFull4, resolver);
    halfDrawers2 = factory.createBlock(BlockConfiguration.BasicHalf2, resolver);
    halfDrawers4 = factory.createBlock(BlockConfiguration.BasicHalf4, resolver);
    trim = factory.createBlock(BlockConfiguration.Trim, resolver);

    IUserConfig config = api.userConfig();
    IBlockConfig blockConfig = config.blockConfig();

    if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.BasicFull1)))
      factory.registerBlock(fullDrawers1, "fullDrawers1");
    if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.BasicFull2)))
      factory.registerBlock(fullDrawers2, "fullDrawers2");
    if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.BasicFull4)))
      factory.registerBlock(fullDrawers4, "fullDrawers4");
    if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.BasicHalf2)))
      factory.registerBlock(halfDrawers2, "halfDrawers2");
    if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.BasicHalf4)))
      factory.registerBlock(halfDrawers4, "halfDrawers4");
    if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.Trim)))
      factory.registerBlock(trim, "trim");

    if (!config.addonConfig().showAddonItemsNEI()) {
      factory.hideBlock(getQualifiedName(fullDrawers1));
      factory.hideBlock(getQualifiedName(fullDrawers2));
      factory.hideBlock(getQualifiedName(fullDrawers4));
      factory.hideBlock(getQualifiedName(halfDrawers2));
      factory.hideBlock(getQualifiedName(halfDrawers4));
      factory.hideBlock(getQualifiedName(trim));
    }
  }
コード例 #3
0
  public void init() {
    IStorageDrawersApi api = StorageDrawersApi.instance();
    if (api == null) return;

    IPackBlockFactory factory = api.packFactory();
    IPackDataResolver[] resolvers = StorageDrawersPack.instance.resolvers;

    fullDrawers1 = new Block[resolvers.length];
    fullDrawers2 = new Block[resolvers.length];
    fullDrawers4 = new Block[resolvers.length];
    halfDrawers2 = new Block[resolvers.length];
    halfDrawers4 = new Block[resolvers.length];
    trim = new Block[resolvers.length];

    for (int i = 0; i < resolvers.length; i++) {
      IPackDataResolver resolver = resolvers[i];

      fullDrawers1[i] = factory.createBlock(BlockConfiguration.BasicFull1, resolver);
      fullDrawers2[i] = factory.createBlock(BlockConfiguration.BasicFull2, resolver);
      fullDrawers4[i] = factory.createBlock(BlockConfiguration.BasicFull4, resolver);
      halfDrawers2[i] = factory.createBlock(BlockConfiguration.BasicHalf2, resolver);
      halfDrawers4[i] = factory.createBlock(BlockConfiguration.BasicHalf4, resolver);
      trim[i] = factory.createBlock(BlockConfiguration.Trim, resolver);
    }

    IUserConfig config = api.userConfig();
    IBlockConfig blockConfig = config.blockConfig();

    if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.BasicFull1))) {
      for (int i = 0; i < resolvers.length; i++)
        factory.registerBlock(fullDrawers1[i], "fullDrawers1_" + i);
    }
    if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.BasicFull2))) {
      for (int i = 0; i < resolvers.length; i++)
        factory.registerBlock(fullDrawers2[i], "fullDrawers2_" + i);
    }
    if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.BasicFull4))) {
      for (int i = 0; i < resolvers.length; i++)
        factory.registerBlock(fullDrawers4[i], "fullDrawers4_" + i);
    }
    if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.BasicHalf2))) {
      for (int i = 0; i < resolvers.length; i++)
        factory.registerBlock(halfDrawers2[i], "halfDrawers2_" + i);
    }
    if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.BasicHalf4))) {
      for (int i = 0; i < resolvers.length; i++)
        factory.registerBlock(halfDrawers4[i], "halfDrawers4_" + i);
    }
    if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.Trim))) {
      for (int i = 0; i < resolvers.length; i++) factory.registerBlock(trim[i], "trim_" + i);
    }

    if (!config.addonConfig().showAddonItemsNEI()) {
      for (int i = 0; i < resolvers.length; i++) {
        factory.hideBlock(getQualifiedName(fullDrawers1[i]));
        factory.hideBlock(getQualifiedName(fullDrawers2[i]));
        factory.hideBlock(getQualifiedName(fullDrawers4[i]));
        factory.hideBlock(getQualifiedName(halfDrawers2[i]));
        factory.hideBlock(getQualifiedName(halfDrawers4[i]));
        factory.hideBlock(getQualifiedName(trim[i]));
      }
    }
  }