private static Item getTabItem() {
    IStorageDrawersApi api = StorageDrawersApi.instance();
    if (api == null) return Item.getItemFromBlock(Blocks.chest);

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

    if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.BasicFull2)))
      return Item.getItemFromBlock(ModBlocks.fullDrawers2);
    if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.BasicFull4)))
      return Item.getItemFromBlock(ModBlocks.fullDrawers4);
    if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.BasicFull1)))
      return Item.getItemFromBlock(ModBlocks.fullDrawers1);
    if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.BasicHalf2)))
      return Item.getItemFromBlock(ModBlocks.halfDrawers2);
    if (blockConfig.isBlockEnabled(blockConfig.getBlockConfigName(BlockConfiguration.BasicHalf4)))
      return Item.getItemFromBlock(ModBlocks.halfDrawers4);

    return Item.getItemFromBlock(Blocks.chest);
  }
  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;
  }
示例#3
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));
    }
  }
示例#4
0
  public void init() {
    IStorageDrawersApi api = StorageDrawersApi.instance();
    if (api == null) return;

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

    String nameFull1 = blockConfig.getBlockConfigName(BlockConfiguration.BasicFull1);
    String nameFull2 = blockConfig.getBlockConfigName(BlockConfiguration.BasicFull2);
    String nameFull4 = blockConfig.getBlockConfigName(BlockConfiguration.BasicFull4);
    String nameHalf2 = blockConfig.getBlockConfigName(BlockConfiguration.BasicHalf2);
    String nameHalf4 = blockConfig.getBlockConfigName(BlockConfiguration.BasicHalf4);
    String nameTrim = blockConfig.getBlockConfigName(BlockConfiguration.Trim);

    Block planks = GameRegistry.findBlock("erebus", "planks");

    IPackDataResolver resolver = StorageDrawersPack.instance.resolver;

    for (int i = 0; i < 16; i++) {
      if (!resolver.isValidMetaValue(i)) continue;

      int src = i;
      if (resolver.getUnlocalizedName(i).equals("scorched")) {
        planks = GameRegistry.findBlock("erebus", "planks_scorched");
        src = 0;
      } else if (resolver.getUnlocalizedName(i).equals("varnished")) {
        planks = GameRegistry.findBlock("erebus", "planks_varnished");
        src = 0;
      }

      if (planks != null) {
        if (blockConfig.isBlockEnabled(nameFull1))
          GameRegistry.addRecipe(
              new ShapedOreRecipe(
                  new ItemStack(
                      ModBlocks.fullDrawers1, blockConfig.getBlockRecipeOutput(nameFull1), i),
                  "xxx",
                  " y ",
                  "xxx",
                  'x',
                  new ItemStack(planks, 1, src),
                  'y',
                  "chestWood"));
        if (blockConfig.isBlockEnabled(nameFull2))
          GameRegistry.addRecipe(
              new ShapedOreRecipe(
                  new ItemStack(
                      ModBlocks.fullDrawers2, blockConfig.getBlockRecipeOutput(nameFull2), i),
                  "xyx",
                  "xxx",
                  "xyx",
                  'x',
                  new ItemStack(planks, 1, src),
                  'y',
                  "chestWood"));
        if (blockConfig.isBlockEnabled(nameFull4))
          GameRegistry.addRecipe(
              new ShapedOreRecipe(
                  new ItemStack(
                      ModBlocks.fullDrawers4, blockConfig.getBlockRecipeOutput(nameFull4), i),
                  "yxy",
                  "xxx",
                  "yxy",
                  'x',
                  new ItemStack(planks, 1, src),
                  'y',
                  "chestWood"));
        if (blockConfig.isBlockEnabled(nameTrim)) {
          GameRegistry.addRecipe(
              new ShapedOreRecipe(
                  new ItemStack(ModBlocks.trim, blockConfig.getBlockRecipeOutput(nameTrim), i),
                  "xyx",
                  "yyy",
                  "xyx",
                  'x',
                  "stickWood",
                  'y',
                  new ItemStack(planks, 1, src)));
        }
      }

      Block slab = GameRegistry.findBlock("erebus", "slabPlanks" + resolver.getUnlocalizedName(i));

      if (slab != null) {
        if (blockConfig.isBlockEnabled(nameHalf2))
          GameRegistry.addRecipe(
              new ShapedOreRecipe(
                  new ItemStack(
                      ModBlocks.halfDrawers2, blockConfig.getBlockRecipeOutput(nameHalf2), i),
                  "xyx",
                  "xxx",
                  "xyx",
                  'x',
                  new ItemStack(slab, 1, i),
                  'y',
                  "chestWood"));
        if (blockConfig.isBlockEnabled(nameHalf4))
          GameRegistry.addRecipe(
              new ShapedOreRecipe(
                  new ItemStack(
                      ModBlocks.halfDrawers4, blockConfig.getBlockRecipeOutput(nameHalf4), i),
                  "yxy",
                  "xxx",
                  "yxy",
                  'x',
                  new ItemStack(slab, 1, i),
                  'y',
                  "chestWood"));
      }
    }
  }
示例#5
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]));
      }
    }
  }