コード例 #1
0
 public static void generateRecipesForType(
     BlockIronChest blockResult, Object previousTier, IronChestType type) {
   for (String recipe : type.recipes) {
     String[] recipeSplit =
         new String[] {recipe.substring(0, 3), recipe.substring(3, 6), recipe.substring(6, 9)};
     Object mainMaterial = null;
     for (String mat : type.matList) {
       mainMaterial = translateOreName(mat);
       addRecipe(
           new ItemStack(blockResult, 1, type.ordinal()),
           recipeSplit,
           'm',
           mainMaterial,
           'P',
           previousTier, /* previous tier of chest */
           'G',
           Block.glass,
           'C',
           Block.chest,
           '0',
           new ItemStack(blockResult, 1, 0), /* Iron Chest*/
           '1',
           new ItemStack(blockResult, 1, 1), /* Gold Chest*/
           '2',
           new ItemStack(blockResult, 1, 1), /* Diamond Chest*/
           '3',
           new ItemStack(blockResult, 1, 3), /* Copper Chest */
           '4',
           new ItemStack(blockResult, 1, 4) /* Silver Chest */);
     }
   }
 }
コード例 #2
0
 public static void generateTieredRecipes(BlockIronChest blockResult) {
   ItemStack previous = new ItemStack(Block.chest);
   for (IronChestType typ : values()) {
     generateRecipesForType(blockResult, previous, typ);
     if (typ.tieredChest) previous = new ItemStack(blockResult, 1, typ.ordinal());
   }
 }