public String getArmorTexture(Item item, String name) {
   String unlocalizedName = name.toLowerCase().replaceAll(" ", "_").replaceAll("'", "");
   item.setUnlocalizedName(unlocalizedName);
   item.setTextureName(Reference.MODID + ":" + unlocalizedName);
   item.setCreativeTab(MAIN_FNAF.tabFnaf);
   return unlocalizedName;
 }
  public static void registerItemNoTab(Item item, String name) {
    String unlocalizedName = name.toLowerCase().replace(" ", "_").replace("'", "").replace("-", "");

    item.setUnlocalizedName(unlocalizedName);
    item.setTextureName(Flash.modid + ":" + unlocalizedName);

    GameRegistry.registerItem(item, unlocalizedName);
  }
  @Override
  public void registerItem(ModManager manager, String name, String modPrefix, Item item) {
    super.registerItem(manager, name, modPrefix, item);
    if (modPrefix != null) {
      if (item.unlocalizedName == null || item.unlocalizedName.isEmpty()) {
        item.setUnlocalizedName(modPrefix + name);
      }

      if (item.iconString == null || item.iconString.isEmpty()) {
        item.setTextureName(modPrefix + name);
      }
    }

    if (manager.defaultTab != null && item.getCreativeTab() == null) {
      item.setCreativeTab(manager.defaultTab);
    }
  }
Beispiel #4
0
 public static void initBlocks() {
   blockMultiblock = new BlockMultiblock();
   GameRegistry.registerBlock(blockMultiblock, "multiblock");
   GameRegistry.registerTileEntity(TileMultiblock.class, "RPMulti");
   blockAppliance = new BlockAppliance();
   GameRegistry.registerBlock(blockAppliance, ItemExtended.class, "appliance");
   GameRegistry.registerTileEntity(TileAlloyFurnace.class, "RPAFurnace");
   blockAppliance.addTileEntityMapping(0, TileAlloyFurnace.class);
   blockAppliance.setBlockName(0, "rpafurnace");
   GameRegistry.addRecipe(
       new ItemStack(blockAppliance, 1, 0),
       new Object[] {"BBB", "B B", "BBB", Character.valueOf('B'), Blocks.brick_block});
   GameRegistry.registerTileEntity(TileAdvBench.class, "RPAdvBench");
   blockAppliance.addTileEntityMapping(3, TileAdvBench.class);
   blockAppliance.setBlockName(3, "rpabench");
   CraftLib.addOreRecipe(
       new ItemStack(blockAppliance, 1, 3),
       new Object[] {
         "SSS",
         "WTW",
         "WCW",
         Character.valueOf('S'),
         Blocks.stone,
         Character.valueOf('W'),
         "plankWood",
         Character.valueOf('T'),
         Blocks.crafting_table,
         Character.valueOf('C'),
         Blocks.chest
       });
   itemHandsawIron = new ItemHandsaw(0);
   itemHandsawIron.setUnlocalizedName("handsawIron");
   itemHandsawIron.setTextureName("rpworld:itemHandsawIron");
   itemHandsawIron.setMaxDamage(320);
   itemHandsawDiamond = new ItemHandsaw(2);
   itemHandsawDiamond.setUnlocalizedName("handsawDiamond");
   itemHandsawDiamond.setTextureName("rpworld:itemHandsawDiamond");
   itemHandsawDiamond.setMaxDamage(1280);
   GameRegistry.addRecipe(
       new ItemStack(itemHandsawIron, 1),
       new Object[] {
         "WWW",
         " II",
         " II",
         Character.valueOf('I'),
         Items.iron_ingot,
         Character.valueOf('W'),
         Items.stick
       });
   GameRegistry.addRecipe(
       new ItemStack(itemHandsawDiamond, 1),
       new Object[] {
         "WWW",
         " II",
         " DD",
         Character.valueOf('I'),
         Items.iron_ingot,
         Character.valueOf('D'),
         Items.diamond,
         Character.valueOf('W'),
         Items.stick
       });
   GameRegistry.addShapelessRecipe(
       CoreLib.copyStack(itemWaferSilicon, 16),
       new Object[] {itemBouleSilicon, new ItemStack(itemHandsawDiamond, 1, -1)});
   itemScrewdriver = new ItemScrewdriver();
   GameRegistry.addRecipe(
       new ItemStack(itemScrewdriver, 1),
       new Object[] {
         "I ", " W", Character.valueOf('I'), Items.iron_ingot, Character.valueOf('W'), Items.stick
       });
   GameRegistry.registerItem(itemScrewdriver, "screwdriver");
   GameRegistry.addRecipe(
       new ItemStack(itemDrawplateDiamond, 1),
       new Object[] {
         " I ",
         "IDI",
         " I ",
         Character.valueOf('I'),
         new ItemStack(blockMicro, 1, 5649),
         Character.valueOf('D'),
         new ItemStack(blockMicro, 1, 4115)
       });
   GameRegistry.addShapelessRecipe(
       itemFineIron, new Object[] {Items.iron_ingot, new ItemStack(itemDrawplateDiamond, 1, -1)});
   CraftLib.addShapelessOreRecipe(
       itemFineCopper, new Object[] {"ingotCopper", new ItemStack(itemDrawplateDiamond, 1, -1)});
   GameRegistry.addRecipe(
       CoreLib.copyStack(itemNuggetIron, 9),
       new Object[] {"I", Character.valueOf('I'), Items.iron_ingot});
   CraftLib.addOreRecipe(
       CoreLib.copyStack(itemNuggetCopper, 9),
       new Object[] {"I", Character.valueOf('I'), "ingotCopper"});
   CraftLib.addOreRecipe(
       CoreLib.copyStack(itemNuggetTin, 9),
       new Object[] {"I", Character.valueOf('I'), "ingotTin"});
   CraftLib.addOreRecipe(
       CoreLib.copyStack(itemNuggetSilver, 9),
       new Object[] {"I", Character.valueOf('I'), "ingotSilver"});
   GameRegistry.addRecipe(
       new ItemStack(Items.iron_ingot, 1, 0),
       new Object[] {"III", "III", "III", Character.valueOf('I'), itemNuggetIron});
   GameRegistry.addRecipe(
       itemIngotSilver,
       new Object[] {"III", "III", "III", Character.valueOf('I'), itemNuggetSilver});
   GameRegistry.addRecipe(
       itemIngotTin, new Object[] {"III", "III", "III", Character.valueOf('I'), itemNuggetTin});
   GameRegistry.addRecipe(
       itemIngotCopper,
       new Object[] {"III", "III", "III", Character.valueOf('I'), itemNuggetCopper});
   GameRegistry.addRecipe(
       itemCanvas,
       new Object[] {
         "SSS",
         "SWS",
         "SSS",
         Character.valueOf('S'),
         Items.string,
         Character.valueOf('W'),
         Items.stick
       });
   GameRegistry.addRecipe(
       new ItemStack(Items.diamond, 2),
       new Object[] {"D", Character.valueOf('D'), new ItemStack(blockMicro, 1, 4115)});
   GameRegistry.addRecipe(
       new ItemStack(Items.diamond, 1),
       new Object[] {"D", Character.valueOf('D'), new ItemStack(blockMicro, 1, 19)});
   GameRegistry.addRecipe(
       new ItemStack(Items.iron_ingot, 2),
       new Object[] {"I", Character.valueOf('I'), new ItemStack(blockMicro, 1, 4113)});
   GameRegistry.addRecipe(
       new ItemStack(Items.iron_ingot, 1),
       new Object[] {"I", Character.valueOf('I'), new ItemStack(blockMicro, 1, 17)});
 }