Esempio n. 1
0
 public <BLOCK extends Block> BLOCK newBlock(
     String name, Class<BLOCK> cls, Class itemClass, String title) {
   try {
     int id = config.getBlock(name, 4095).getInt();
     Constructor<BLOCK> ctor = cls.getConstructor(int.class);
     BLOCK block = ctor.newInstance(id);
     String qualName = assetKey + ":" + name;
     block.setUnlocalizedName(qualName);
     // block.func_111022_d(qualName.toLowerCase()); // Set default icon name
     // block.func_111022_d(qualName); // Set default icon name
     block.setTextureName(qualName); // Set default icon name
     GameRegistry.registerBlock(block, itemClass);
     if (title != null) {
       LanguageRegistry.addName(block, title);
       if (clientSide) {
         // System.out.printf("%s: BaseMod.newBlock: %s: creative tab = %s\n",
         //	this, block.getUnlocalizedName(), block.getCreativeTabToDisplayOn());
         if (block.getCreativeTabToDisplayOn() == null && !title.startsWith("["))
           block.setCreativeTab(CreativeTabs.tabMisc);
       }
     }
     if (block instanceof IBlock) registeredBlocks.add((IBlock) block);
     return block;
   } catch (Exception e) {
     throw new RuntimeException(e);
   }
 }
 public static Block addBlock(String name, Block block) {
   // System.out.printf("%s: Adding block %s id %s\n", modName, name,
   // block.blockID);
   block.setUnlocalizedName("gcewing." + idToName.get(block.blockID));
   GameRegistry.registerBlock(block);
   LanguageRegistry.addName(block, name);
   return block;
 }
 public static void addSmeltingRecipe(Item product, int qty, Block input) {
   GameRegistry.addSmelting(input.blockID, new ItemStack(product, qty), 0);
 }
 public static void addShapelessRecipe(Item product, int qty, Object... params) {
   GameRegistry.addShapelessRecipe(new ItemStack(product, qty), params);
 }
 public static void addRecipe(Block product, int qty, Object... params) {
   GameRegistry.addRecipe(new ItemStack(product, qty), params);
 }
 void registerTileEntities() {
   GameRegistry.registerTileEntity(TEFloodlightBeam.class, "gcewing.FloodlightBeam");
 }
Esempio n. 7
0
 public void newSmeltingRecipe(Item product, int qty, Item input) {
   GameRegistry.addSmelting(input.itemID, new ItemStack(product, qty), 0);
 }
Esempio n. 8
0
 public void newShapelessRecipe(ItemStack product, Object... params) {
   GameRegistry.addRecipe(new ShapelessOreRecipe(product, params));
 }