示例#1
0
  private static void registerWarehouseRecipes() {
    for (int i = 0; i < 16; i++) {
      ItemStack warehouse = new ItemStack(BlockList.Warehouse, 1, i);
      ItemStack lumber = new ItemStack(TFCItems.singlePlank, 1, i);

      GameRegistry.addRecipe(
          warehouse,
          new Object[] {
            "ppp",
            "pfp",
            "ppp",
            Character.valueOf('p'),
            lumber,
            Character.valueOf('f'),
            Items.feather
          });
    }

    for (int i = 16; i < Global.WOOD_ALL.length; i++) {
      ItemStack warehouse = new ItemStack(BlockList.Warehouse2, 1, i - 16);
      ItemStack lumber = new ItemStack(TFCItems.singlePlank, 1, i);

      GameRegistry.addRecipe(
          warehouse,
          new Object[] {
            "ppp",
            "pfp",
            "ppp",
            Character.valueOf('p'),
            lumber,
            Character.valueOf('f'),
            Items.feather
          });
    }
  }
 @Test
 public void test() throws IOException, ClassNotFoundException {
   this.test((Serializable) null, true);
   this.test("test", true);
   this.test(Boolean.TRUE, true);
   this.test(Byte.valueOf(Byte.MAX_VALUE), true);
   this.test(Character.valueOf(Character.MAX_VALUE), true);
   this.test(Double.valueOf(Double.MAX_VALUE), true);
   this.test(Float.valueOf(Float.MAX_VALUE), true);
   this.test(Integer.valueOf(Integer.MAX_VALUE), true);
   this.test(Long.valueOf(Long.MAX_VALUE), true);
   this.test(Short.valueOf(Short.MAX_VALUE), true);
   this.test(new String[] {"test"}, true);
   this.test(new boolean[] {Boolean.TRUE}, true);
   this.test(new byte[] {Byte.MAX_VALUE}, true);
   this.test(new char[] {Character.MAX_VALUE}, true);
   this.test(new double[] {Double.MAX_VALUE}, true);
   this.test(new float[] {Float.MAX_VALUE}, true);
   this.test(new int[] {Integer.MAX_VALUE}, true);
   this.test(new long[] {Long.MAX_VALUE}, true);
   this.test(new short[] {Short.MAX_VALUE}, true);
   this.test(new Boolean[] {Boolean.TRUE}, true);
   this.test(new Byte[] {Byte.valueOf(Byte.MAX_VALUE)}, true);
   this.test(new Character[] {Character.valueOf(Character.MAX_VALUE)}, true);
   this.test(new Double[] {Double.valueOf(Double.MAX_VALUE)}, true);
   this.test(new Float[] {Float.valueOf(Float.MAX_VALUE)}, true);
   this.test(new Integer[] {Integer.valueOf(Integer.MAX_VALUE)}, true);
   this.test(new Long[] {Long.valueOf(Long.MAX_VALUE)}, true);
   this.test(new Short[] {Short.valueOf(Short.MAX_VALUE)}, true);
   this.test(this.getClass(), false);
   this.test(new Date(System.currentTimeMillis()), false);
   this.test(new Object(), false);
 }
示例#3
0
  /**
   * @param key the research key required for this recipe to work. Leave blank if it will work
   *     without research
   * @param cost the vis cost
   * @param tags ObjectTags list of required aspects and their amounts. No more than 5 aspects
   *     should be used in a recipe.
   * @param par1ItemStack the recipe output
   * @param par2ArrayOfObj the recipe. Format is exactly the same as vanilla recipes
   */
  public static void addInfusionCraftingRecipe(
      String key, int cost, ObjectTags tags, ItemStack par1ItemStack, Object... par2ArrayOfObj) {
    String var3 = "";
    int var4 = 0;
    int var5 = 0;
    int var6 = 0;
    int var9;

    if (par2ArrayOfObj[var4] instanceof String[]) {
      String[] var7 = (String[]) ((String[]) par2ArrayOfObj[var4++]);
      String[] var8 = var7;
      var9 = var7.length;

      for (int var10 = 0; var10 < var9; ++var10) {
        String var11 = var8[var10];
        ++var6;
        var5 = var11.length();
        var3 = var3 + var11;
      }
    } else {
      while (par2ArrayOfObj[var4] instanceof String) {
        String var13 = (String) par2ArrayOfObj[var4++];
        ++var6;
        var5 = var13.length();
        var3 = var3 + var13;
      }
    }

    HashMap var14;

    for (var14 = new HashMap(); var4 < par2ArrayOfObj.length; var4 += 2) {
      Character var16 = (Character) par2ArrayOfObj[var4];
      ItemStack var17 = null;

      if (par2ArrayOfObj[var4 + 1] instanceof Item) {
        var17 = new ItemStack((Item) par2ArrayOfObj[var4 + 1]);
      } else if (par2ArrayOfObj[var4 + 1] instanceof Block) {
        var17 = new ItemStack((Block) par2ArrayOfObj[var4 + 1], 1, -1);
      } else if (par2ArrayOfObj[var4 + 1] instanceof ItemStack) {
        var17 = (ItemStack) par2ArrayOfObj[var4 + 1];
      }

      var14.put(var16, var17);
    }

    ItemStack[] var15 = new ItemStack[var5 * var6];

    for (var9 = 0; var9 < var5 * var6; ++var9) {
      char var18 = var3.charAt(var9);

      if (var14.containsKey(Character.valueOf(var18))) {
        var15[var9] = ((ItemStack) var14.get(Character.valueOf(var18))).copy();
      } else {
        var15[var9] = null;
      }
    }

    craftingRecipes.add(
        new ShapedInfusionCraftingRecipes(key, var5, var6, var15, par1ItemStack, cost, tags));
  }
示例#4
0
  ShapedRecipes registerShapedRecipe(ItemStack itemstack, Object... aobject) {
    String s = "";
    int i = 0;
    int j = 0;
    int k = 0;

    if (aobject[i] instanceof String[]) {
      String[] astring = (String[]) ((String[]) aobject[i++]);

      for (int l = 0; l < astring.length; ++l) {
        String s1 = astring[l];

        ++k;
        j = s1.length();
        s = s + s1;
      }
    } else {
      while (aobject[i] instanceof String) {
        String s2 = (String) aobject[i++];

        ++k;
        j = s2.length();
        s = s + s2;
      }
    }

    HashMap hashmap;

    for (hashmap = new HashMap(); i < aobject.length; i += 2) {
      Character character = (Character) aobject[i];
      ItemStack itemstack1 = null;

      if (aobject[i + 1] instanceof Item) {
        itemstack1 = new ItemStack((Item) aobject[i + 1]);
      } else if (aobject[i + 1] instanceof Block) {
        itemstack1 = new ItemStack((Block) aobject[i + 1], 1, 32767);
      } else if (aobject[i + 1] instanceof ItemStack) {
        itemstack1 = (ItemStack) aobject[i + 1];
      }

      hashmap.put(character, itemstack1);
    }

    ItemStack[] aitemstack = new ItemStack[j * k];

    for (int i1 = 0; i1 < j * k; ++i1) {
      char c0 = s.charAt(i1);

      if (hashmap.containsKey(Character.valueOf(c0))) {
        aitemstack[i1] = ((ItemStack) hashmap.get(Character.valueOf(c0))).cloneItemStack();
      } else {
        aitemstack[i1] = null;
      }
    }

    ShapedRecipes shapedrecipes = new ShapedRecipes(j, k, aitemstack, itemstack);

    this.recipes.add(shapedrecipes);
    return shapedrecipes;
  }
  private boolean add(char[] chars, V newValue, int offset, int length) {
    if (offset == length) {
      this.value = newValue;
      boolean wasAlreadyAKey = this.key != null;
      this.key = new String(chars);
      return !wasAlreadyAKey;
    }

    char nextChar = chars[offset];
    AbbreviationMap<V> child = (AbbreviationMap<V>) this.children.get(Character.valueOf(nextChar));
    if (child == null) {
      child = new AbbreviationMap<V>();
      this.children.put(Character.valueOf(nextChar), child);
    }

    boolean newKeyAdded = child.add(chars, newValue, offset + 1, length);

    if (newKeyAdded) {
      this.keysBeyond += 1;
    }
    if (this.key == null) {
      this.value = (this.keysBeyond > 1 ? null : newValue);
    }
    return newKeyAdded;
  }
  @Test
  public void testCreateOutputFactory() throws JAXBException {
    JsonXMLOutputFactory factory =
        new JsonXMLBinder()
            .createOutputFactory(
                SampleRootElement.class, JsonXMLDefault.class.getAnnotation(JsonXML.class));
    Assert.assertEquals(Boolean.TRUE, factory.getProperty(JsonXMLOutputFactory.PROP_MULTIPLE_PI));
    Assert.assertEquals(
        Character.valueOf(':'), factory.getProperty(JsonXMLOutputFactory.PROP_NAMESPACE_SEPARATOR));
    Assert.assertNull(factory.getProperty(JsonXMLOutputFactory.PROP_VIRTUAL_ROOT));
    Assert.assertEquals(
        Boolean.TRUE, factory.getProperty(JsonXMLOutputFactory.PROP_NAMESPACE_DECLARATIONS));
    Assert.assertEquals(Boolean.FALSE, factory.getProperty(JsonXMLOutputFactory.PROP_PRETTY_PRINT));
    Assert.assertEquals(Boolean.FALSE, factory.getProperty(JsonXMLOutputFactory.PROP_AUTO_ARRAY));

    factory =
        new JsonXMLBinder()
            .createOutputFactory(
                SampleRootElement.class, JsonXMLCustom.class.getAnnotation(JsonXML.class));
    Assert.assertEquals(Boolean.TRUE, factory.getProperty(JsonXMLOutputFactory.PROP_MULTIPLE_PI));
    Assert.assertEquals(
        Character.valueOf('_'), factory.getProperty(JsonXMLOutputFactory.PROP_NAMESPACE_SEPARATOR));
    Assert.assertEquals(
        new QName("sampleRootElement"),
        factory.getProperty(JsonXMLOutputFactory.PROP_VIRTUAL_ROOT));
    Assert.assertEquals(
        Boolean.FALSE, factory.getProperty(JsonXMLOutputFactory.PROP_NAMESPACE_DECLARATIONS));
    Assert.assertEquals(Boolean.TRUE, factory.getProperty(JsonXMLOutputFactory.PROP_PRETTY_PRINT));
    Assert.assertEquals(Boolean.TRUE, factory.getProperty(JsonXMLOutputFactory.PROP_AUTO_ARRAY));
  }
示例#7
0
  public void load() {

    ModLoader.registerBlock(AntarticaSnow);
    ModLoader.registerBlock(AntarticaIce);

    ModLoader.registerBlock(ForbiddenPortal);

    ModLoader.registerBlock(MysticalStone);
    ModLoader.addName(MysticalStone, "MysticalStone");

    ModLoader.addRecipe(
        new ItemStack(MysticalStone, 64), new Object[] {"ddd", Character.valueOf('d'), Block.dirt});
    ModLoader.addRecipe(
        new ItemStack(ForbiddenPortal, 64),
        new Object[] {
          "XXX",
          "ddd",
          "ZZZ",
          Character.valueOf('d'),
          Block.dirt,
          Character.valueOf('X'),
          Block.sand,
          Character.valueOf('Z'),
          Block.planks
        });
  }
示例#8
0
  private static void registerStorageRackRecipes() {
    ItemStack stick = new ItemStack(TFCItems.stick);

    for (int i = 0; i < 16; i++) {
      ItemStack storageRack = new ItemStack(BlockList.StorageRack, 1, i);
      ItemStack lumber = new ItemStack(TFCItems.singlePlank, 1, i);

      GameRegistry.addRecipe(
          storageRack,
          new Object[] {
            "sss", "l l", "lll", Character.valueOf('s'), stick, Character.valueOf('l'), lumber
          });
    }

    for (int i = 16; i < Global.WOOD_ALL.length; i++) {
      ItemStack storageRack = new ItemStack(BlockList.StorageRack2, 1, i - 16);
      ItemStack lumber = new ItemStack(TFCItems.singlePlank, 1, i);

      GameRegistry.addRecipe(
          storageRack,
          new Object[] {
            "sss", "l l", "lll", Character.valueOf('s'), stick, Character.valueOf('l'), lumber
          });
    }
  }
 @Override
 public String apply(final String input) {
   String res = "";
   int i = 0;
   while ((i < input.length())) {
     {
       final char testChar = input.charAt(i);
       final Character _valueOf = Character.valueOf('^');
       final char _charValue = _valueOf.charValue();
       final boolean _tripleNotEquals = (testChar != _charValue);
       if (_tripleNotEquals) {
         final String _res = res;
         res = (_res + Character.valueOf(testChar));
       } else {
         i++;
         final String _res_1 = res;
         final char _charAt = input.charAt(i);
         final char _upperCase = Character.toUpperCase(_charAt);
         res = (_res_1 + Character.valueOf(_upperCase));
       }
       i++;
     }
   }
   return res;
 }
  public static Object coerce(String s, Class<?> target) {

    boolean isNullOrEmpty = (s == null || s.length() == 0);

    if (target == Boolean.class) {
      if (isNullOrEmpty) {
        s = "false";
      }
      return Boolean.valueOf(s);
    } else if (target == Byte.class) {
      if (isNullOrEmpty) return Byte.valueOf((byte) 0);
      else return Byte.valueOf(s);
    } else if (target == Character.class) {
      if (isNullOrEmpty) return Character.valueOf((char) 0);
      else return Character.valueOf(s.charAt(0));
    } else if (target == Double.class) {
      if (isNullOrEmpty) return Double.valueOf(0);
      else return Double.valueOf(s);
    } else if (target == Float.class) {
      if (isNullOrEmpty) return Float.valueOf(0);
      else return Float.valueOf(s);
    } else if (target == Integer.class) {
      if (isNullOrEmpty) return Integer.valueOf(0);
      else return Integer.valueOf(s);
    } else if (target == Short.class) {
      if (isNullOrEmpty) return Short.valueOf((short) 0);
      else return Short.valueOf(s);
    } else if (target == Long.class) {
      if (isNullOrEmpty) return Long.valueOf(0);
      else return Long.valueOf(s);
    } else {
      return null;
    }
  }
  public ShapedRecipes func_92051_a(ItemStack par1ItemStack, Object... par2ArrayOfObj) {
    String var3 = "";
    int var4 = 0;
    int var5 = 0;
    int var6 = 0;

    if (par2ArrayOfObj[var4] instanceof String[]) {
      String[] var7 = (String[]) ((String[]) par2ArrayOfObj[var4++]);

      for (int var8 = 0; var8 < var7.length; ++var8) {
        String var9 = var7[var8];
        ++var6;
        var5 = var9.length();
        var3 = var3 + var9;
      }
    } else {
      while (par2ArrayOfObj[var4] instanceof String) {
        String var11 = (String) par2ArrayOfObj[var4++];
        ++var6;
        var5 = var11.length();
        var3 = var3 + var11;
      }
    }

    HashMap var12;

    for (var12 = new HashMap(); var4 < par2ArrayOfObj.length; var4 += 2) {
      Character var13 = (Character) par2ArrayOfObj[var4];
      ItemStack var14 = null;

      if (par2ArrayOfObj[var4 + 1] instanceof Item) {
        var14 = new ItemStack((Item) par2ArrayOfObj[var4 + 1]);
      } else if (par2ArrayOfObj[var4 + 1] instanceof Block) {
        var14 = new ItemStack((Block) par2ArrayOfObj[var4 + 1], 1, -1);
      } else if (par2ArrayOfObj[var4 + 1] instanceof ItemStack) {
        var14 = (ItemStack) par2ArrayOfObj[var4 + 1];
      }

      var12.put(var13, var14);
    }

    ItemStack[] var15 = new ItemStack[var5 * var6];

    for (int var16 = 0; var16 < var5 * var6; ++var16) {
      char var10 = var3.charAt(var16);

      if (var12.containsKey(Character.valueOf(var10))) {
        var15[var16] = ((ItemStack) var12.get(Character.valueOf(var10))).copy();
      } else {
        var15[var16] = null;
      }
    }

    ShapedRecipes var17 = new ShapedRecipes(var5, var6, var15, par1ItemStack);
    this.recipes.add(var17);
    return var17;
  }
  /**
   * This method transforms a value of the source type into a value of the target type.
   *
   * @param value Incoming value of source type
   * @return Outgoing value of target type
   * @throws Exception if value is an incorrect input type or the transformation fails
   */
  public Object transformDirect(Object value) throws Exception {
    String s = (String) value;

    if (s.length() == 0) {
      return Character.valueOf(' ');
    }

    return Character.valueOf(s.charAt(0));
  }
示例#13
0
  private static void registerVanillaImprovements() {
    FurnaceRecipes.smelting()
        .addSmelting(
            MineFactoryReloadedCore.rawRubberItem.itemID,
            0,
            new ItemStack(MineFactoryReloadedCore.rubberBarItem),
            0.1F);
    FurnaceRecipes.smelting()
        .addSmelting(
            MineFactoryReloadedCore.rubberWoodBlock.blockID,
            0,
            new ItemStack(Item.coal, 1, 1),
            0.1F);

    GameRegistry.addShapelessRecipe(
        new ItemStack(Block.planks, 3, 3), new ItemStack(MineFactoryReloadedCore.rubberWoodBlock));

    GameRegistry.addRecipe(
        new ItemStack(Block.torchWood, 4),
        new Object[] {
          "R",
          "S",
          Character.valueOf('R'),
          MineFactoryReloadedCore.rawRubberItem,
          Character.valueOf('S'),
          Item.stick
        });

    GameRegistry.addRecipe(
        new ItemStack(Block.pistonStickyBase),
        new Object[] {
          "R",
          "P",
          Character.valueOf('R'),
          MineFactoryReloadedCore.rawRubberItem,
          Character.valueOf('P'),
          Block.pistonBase
        });

    if (MineFactoryReloadedCore.vanillaOverrideIce.getBoolean(true)) {
      GameRegistry.addShapelessRecipe(
          new ItemStack(Block.ice, 1, 1),
          new ItemStack(Block.ice, 1, 0),
          new ItemStack(MineFactoryReloadedCore.rawPlasticItem, 1));
    }

    if (MineFactoryReloadedCore.enableMossyCobbleRecipe.getBoolean(true)) {
      GameRegistry.addShapelessRecipe(
          new ItemStack(Block.cobblestoneMossy),
          new Object[] {Block.cobblestone, Item.bucketWater, Item.wheat});
    }

    GameRegistry.addShapelessRecipe(
        new ItemStack(MineFactoryReloadedCore.milkBottleItem),
        new Object[] {Item.bucketMilk, Item.glassBottle});
  }
 @Test
 public void testReverseList_valid_input_with_two_characters() {
   List<Character> characters = Lists.newArrayList();
   characters.add('a');
   characters.add('b');
   List<Character> resultList = ListManipulator.reverseListAndCreatePalindrome(characters);
   assertEquals(3, resultList.size());
   assertEquals(Character.valueOf('a'), resultList.get(0));
   assertEquals(Character.valueOf('b'), resultList.get(1));
   assertEquals(Character.valueOf('a'), resultList.get(2));
 }
示例#15
0
  public ShapedRecipes func_92103_a(ItemStack p_92103_1_, Object... p_92103_2_) {
    String var3 = "";
    int var4 = 0;
    int var5 = 0;
    int var6 = 0;
    if (p_92103_2_[var4] instanceof String[]) {
      String[] var7 = (String[]) ((String[]) p_92103_2_[var4++]);

      for (int var8 = 0; var8 < var7.length; ++var8) {
        String var9 = var7[var8];
        ++var6;
        var5 = var9.length();
        var3 = var3 + var9;
      }
    } else {
      while (p_92103_2_[var4] instanceof String) {
        String var11 = (String) p_92103_2_[var4++];
        ++var6;
        var5 = var11.length();
        var3 = var3 + var11;
      }
    }

    HashMap var12;
    for (var12 = new HashMap(); var4 < p_92103_2_.length; var4 += 2) {
      Character var13 = (Character) p_92103_2_[var4];
      ItemStack var14 = null;
      if (p_92103_2_[var4 + 1] instanceof Item) {
        var14 = new ItemStack((Item) p_92103_2_[var4 + 1]);
      } else if (p_92103_2_[var4 + 1] instanceof Block) {
        var14 = new ItemStack((Block) p_92103_2_[var4 + 1], 1, 32767);
      } else if (p_92103_2_[var4 + 1] instanceof ItemStack) {
        var14 = (ItemStack) p_92103_2_[var4 + 1];
      }

      var12.put(var13, var14);
    }

    ItemStack[] var15 = new ItemStack[var5 * var6];

    for (int var16 = 0; var16 < var5 * var6; ++var16) {
      char var10 = var3.charAt(var16);
      if (var12.containsKey(Character.valueOf(var10))) {
        var15[var16] = ((ItemStack) var12.get(Character.valueOf(var10))).func_77946_l();
      } else {
        var15[var16] = null;
      }
    }

    ShapedRecipes var17 = new ShapedRecipes(var5, var6, var15, p_92103_1_);
    this.field_77597_b.add(var17);
    return var17;
  }
示例#16
0
 @Mod.Init
 public void init(FMLInitializationEvent event) {
   initBlazeIngot();
   initBlazeBlock();
   initBlazeTools();
   initFoods();
   initBlazeArmor();
   GameRegistry.addRecipe(
       new ItemStack(Block.torchWood, 4),
       new Object[] {
         "X", "S", Character.valueOf('X'), Item.blazePowder, Character.valueOf('S'), Item.stick
       });
 }
示例#17
0
  private void initBlazeArmor() {
    /**
     * CLOTH(5, new int[]{1, 3, 2, 1}, 15), CHAIN(15, new int[]{2, 5, 4, 1}, 12), IRON(15, new
     * int[]{2, 6, 5, 2}, 9), GOLD(7, new int[]{2, 5, 3, 1}, 25), DIAMOND(33, new int[]{3, 8, 6, 3},
     * 10);
     */
    BlazeArmorMaterial = EnumHelper.addArmorMaterial("blazeIngot", 33, new int[] {2, 6, 5, 2}, 9);

    BlazeHelmet =
        (new BlazeItemArmor(DefaultProps.BLAZE_HELMET_ID, BlazeArmorMaterial, 1, 0))
            .setIconCoord(7, 0)
            .setItemName("blazeHelmet");
    LanguageRegistry.addName(BlazeHelmet, DefaultNames.EN.BLAZE_HELMET);
    LanguageRegistry.instance()
        .addNameForObject(BlazeHelmet, "ja_JP", DefaultNames.JP.BLAZE_HELMET);
    GameRegistry.addRecipe(
        new ItemStack(BlazeHelmet, 1),
        new Object[] {"XXX", "X X", Character.valueOf('X'), BlazeIngot});

    BlazeChestPlate =
        (new BlazeItemArmor(DefaultProps.BLAZE_CHESTPLATE_ID, BlazeArmorMaterial, 1, 1))
            .setIconCoord(8, 0)
            .setItemName("blazeChestPlate");
    LanguageRegistry.addName(BlazeChestPlate, DefaultNames.EN.BLAZE_CHESTPLATE);
    LanguageRegistry.instance()
        .addNameForObject(BlazeChestPlate, "ja_JP", DefaultNames.JP.BLAZE_CHESTPLATE);
    GameRegistry.addRecipe(
        new ItemStack(BlazeChestPlate, 1),
        new Object[] {"X X", "XXX", "XXX", Character.valueOf('X'), BlazeIngot});

    BlazeLeggings =
        (new BlazeItemArmor(DefaultProps.BLAZE_LEGGINGS_ID, BlazeArmorMaterial, 1, 2))
            .setIconCoord(9, 0)
            .setItemName("blazeLeggings");
    LanguageRegistry.addName(BlazeLeggings, DefaultNames.EN.BLAZE_LEGGINGS);
    LanguageRegistry.instance()
        .addNameForObject(BlazeLeggings, "ja_JP", DefaultNames.JP.BLAZE_LEGGINGS);
    GameRegistry.addRecipe(
        new ItemStack(BlazeLeggings, 1),
        new Object[] {"XXX", "X X", "X X", Character.valueOf('X'), BlazeIngot});

    BlazeBoots =
        (new BlazeItemArmor(DefaultProps.BLAZE_BOOTS_ID, BlazeArmorMaterial, 1, 3))
            .setIconCoord(10, 0)
            .setItemName("blazeBoots");
    LanguageRegistry.addName(BlazeBoots, DefaultNames.EN.BLAZE_BOOTS);
    LanguageRegistry.instance().addNameForObject(BlazeBoots, "ja_JP", DefaultNames.JP.BLAZE_BOOTS);
    GameRegistry.addRecipe(
        new ItemStack(BlazeBoots, 1),
        new Object[] {"X X", "X X", Character.valueOf('X'), BlazeIngot});
  }
示例#18
0
 public void load() {
   ModLoader.addRecipe(
       new ItemStack(block, 1),
       new Object[] {
         "X1X",
         "X4X",
         "X4X",
         Character.valueOf('1'),
         new ItemStack(mod_obsidiams.block, 1),
         Character.valueOf('4'),
         new ItemStack(Item.blazeRod, 1),
       });
   ModLoader.addName(block, "Pelle en Obsidiams");
 }
示例#19
0
 public void test_valueOfC() {
   // The JLS requires caching for chars between "\u0000 to \u007f":
   // http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7
   // Harmony caches 0-512 and tests for this behavior, so we suppress that test and use this.
   for (char c = '\u0000'; c <= '\u007f'; ++c) {
     Character e = new Character(c);
     Character a = Character.valueOf(c);
     assertEquals(e, a);
     assertSame(Character.valueOf(c), Character.valueOf(c));
   }
   for (int c = '\u0080'; c <= Character.MAX_VALUE; ++c) {
     assertEquals(new Character((char) c), Character.valueOf((char) c));
   }
 }
示例#20
0
 public void solveSudoku(char[][] board) {
   n = 9;
   vis1 = new boolean[10][10];
   vis2 = new boolean[10][10];
   vis3 = new boolean[10][10];
   for (int i = 0; i < 9; i++)
     for (int j = 0; j < 9; j++)
       if (board[i][j] != '.') {
         int u = Character.valueOf(board[i][j]) - Character.valueOf('0');
         int grid = i / 3 * 3 + j / 3;
         vis1[i][u] = vis2[j][u] = vis3[grid][u] = true;
       }
   dfs(0, 0, board);
 }
示例#21
0
  private static void registerRedNet() {

    GameRegistry.addRecipe(
        new ItemStack(MineFactoryReloadedCore.rednetCableBlock, 8),
        new Object[] {
          "PPP",
          "RRR",
          "PPP",
          Character.valueOf('R'),
          Item.redstone,
          Character.valueOf('P'),
          MineFactoryReloadedCore.plasticSheetItem,
        });
  }
示例#22
0
public class JavaFields {
  public static String stringStaticField = "foo";
  public static byte byteStaticField = (byte) 1;
  public static short shortStaticField = (short) 2;
  public static char charStaticField = (char) 2;
  public static int intStaticField = 4;
  public static long longStaticField = 8;
  public static float floatStaticField = 4.5f;
  public static double doubleStaticField = 8.5;
  public static boolean trueStaticField = true;
  public static boolean falseStaticField = false;
  public static Object nullStaticField = null;
  public static BigInteger bigIntegerStaticField =
      new BigInteger("1234567890123456789012345678901234567890");

  public static Byte byteObjStaticField = Byte.valueOf(byteStaticField);
  public static Short shortObjStaticField = Short.valueOf(shortStaticField);
  public static Character charObjStaticField = Character.valueOf(charStaticField);
  public static Integer intObjStaticField = Integer.valueOf(intStaticField);
  public static Long longObjStaticField = Long.valueOf(longStaticField);
  public static Float floatObjStaticField = Float.valueOf(floatStaticField);
  public static Double doubleObjStaticField = Double.valueOf(doubleStaticField);
  public static Boolean trueObjStaticField = Boolean.TRUE;
  public static Boolean falseObjStaticField = Boolean.FALSE;

  public String stringField = "foo";
  public byte byteField = (byte) 1;
  public short shortField = (short) 2;
  public char charField = (char) 2;
  public int intField = 4;
  public long longField = 8;
  public float floatField = 4.5f;
  public double doubleField = 8.5;
  public boolean trueField = true;
  public boolean falseField = false;
  public Object nullField = null;
  public BigInteger bigIntegerField = new BigInteger("1234567890123456789012345678901234567890");

  public Byte byteObjField = Byte.valueOf(byteField);
  public Short shortObjField = Short.valueOf(shortField);
  public Character charObjField = Character.valueOf(charField);
  public Integer intObjField = Integer.valueOf(intField);
  public Long longObjField = Long.valueOf(longField);
  public Float floatObjField = Float.valueOf(floatField);
  public Double doubleObjField = Double.valueOf(doubleField);
  public Boolean trueObjField = Boolean.TRUE;
  public Boolean falseObjField = Boolean.FALSE;
}
示例#23
0
  void addRecipe(ItemStack itemstack, Object aobj[]) {
    String s = "";
    int i = 0;
    int j = 0;
    int k = 0;
    if (aobj[i] instanceof String[]) {
      String as[] = (String[]) aobj[i++];
      for (int l = 0; l < as.length; l++) {
        String s2 = as[l];
        k++;
        j = s2.length();
        s = (new StringBuilder()).append(s).append(s2).toString();
      }

    } else {
      while (aobj[i] instanceof String) {
        String s1 = (String) aobj[i++];
        k++;
        j = s1.length();
        s = (new StringBuilder()).append(s).append(s1).toString();
      }
    }
    HashMap hashmap = new HashMap();
    for (; i < aobj.length; i += 2) {
      Character character = (Character) aobj[i];
      ItemStack itemstack1 = null;
      if (aobj[i + 1] instanceof Item) {
        itemstack1 = new ItemStack((Item) aobj[i + 1]);
      } else if (aobj[i + 1] instanceof Block) {
        itemstack1 = new ItemStack((Block) aobj[i + 1], 1, -1);
      } else if (aobj[i + 1] instanceof ItemStack) {
        itemstack1 = (ItemStack) aobj[i + 1];
      }
      hashmap.put(character, itemstack1);
    }

    ItemStack aitemstack[] = new ItemStack[j * k];
    for (int i1 = 0; i1 < j * k; i1++) {
      char c = s.charAt(i1);
      if (hashmap.containsKey(Character.valueOf(c))) {
        aitemstack[i1] = ((ItemStack) hashmap.get(Character.valueOf(c))).copy();
      } else {
        aitemstack[i1] = null;
      }
    }

    recipes.add(new ShapedRecipes(j, k, aitemstack, itemstack));
  }
 private boolean remove(char[] aKey, int offset, int length) {
   if (offset == length) {
     return removeAtEndOfKey();
   }
   char nextChar = aKey[offset];
   AbbreviationMap<?> child = (AbbreviationMap<?>) this.children.get(Character.valueOf(nextChar));
   if ((child == null) || (!child.remove(aKey, offset + 1, length))) {
     return false;
   }
   this.keysBeyond -= 1;
   if (child.keysBeyond == 0) this.children.remove(Character.valueOf(nextChar));
   if ((this.keysBeyond == 1) && (this.key == null)) {
     setValueToThatOfOnlyChild();
   }
   return true;
 }
/*      */   public Character put(Float ok, Character ov) {
/*  262 */     char v = ov.charValue();
/*  263 */     float k = ok.floatValue();
/*      */ 
/*  265 */     int pos = HashCommon.murmurHash3(HashCommon.float2int(k)) & this.mask;
/*      */ 
/*  267 */     while (this.used[pos] != 0) {
/*  268 */       if (this.key[pos] == k) {
/*  269 */         Character oldValue = Character.valueOf(this.value[pos]);
/*  270 */         this.value[pos] = v;
/*  271 */         return oldValue;
/*      */       }
/*  273 */       pos = pos + 1 & this.mask;
/*      */     }
/*  275 */     this.used[pos] = true;
/*  276 */     this.key[pos] = k;
/*  277 */     this.value[pos] = v;
/*  278 */     if (this.size == 0) {
/*  279 */       this.first = (this.last = pos);
/*      */ 
/*  281 */       this.link[pos] = -1L;
/*      */     }
/*      */     else {
/*  284 */       this.link[this.last] ^= (this.link[this.last] ^ pos & 0xFFFFFFFF) & 0xFFFFFFFF;
/*  285 */       this.link[pos] = ((this.last & 0xFFFFFFFF) << 32 | 0xFFFFFFFF);
/*  286 */       this.last = pos;
/*      */     }
/*  288 */     if (++this.size >= this.maxFill) rehash(HashCommon.arraySize(this.size + 1, this.f));
/*      */ 
/*  290 */     return null;
/*      */   }
  private Object constructEnvEntry(String type, String value) {
    try {
      Class<?> clazz = Class.forName(type);
      Constructor<?> c = null;
      try {
        c = clazz.getConstructor(String.class);
        return c.newInstance(value);
      } catch (NoSuchMethodException e) {
        // Ignore
      }

      if (value.length() != 1) {
        return null;
      }

      try {
        c = clazz.getConstructor(char.class);
        return c.newInstance(Character.valueOf(value.charAt(0)));
      } catch (NoSuchMethodException e) {
        // Ignore
      }
    } catch (Exception e) {
      // Ignore
    }
    return null;
  }
示例#27
0
  /** Converts XML attribute values to object of the given type. */
  protected Object convertValueFromXml(Class<?> type, Object value) {
    if (value instanceof String) {
      String tmp = (String) value;

      if (type.equals(boolean.class) || type == Boolean.class) {
        if (tmp.equals("1") || tmp.equals("0")) {
          tmp = (tmp.equals("1")) ? "true" : "false";
        }

        value = Boolean.valueOf(tmp);
      } else if (type.equals(char.class) || type == Character.class) {
        value = Character.valueOf(tmp.charAt(0));
      } else if (type.equals(byte.class) || type == Byte.class) {
        value = Byte.valueOf(tmp);
      } else if (type.equals(short.class) || type == Short.class) {
        value = Short.valueOf(tmp);
      } else if (type.equals(int.class) || type == Integer.class) {
        value = Integer.valueOf(tmp);
      } else if (type.equals(long.class) || type == Long.class) {
        value = Long.valueOf(tmp);
      } else if (type.equals(float.class) || type == Float.class) {
        value = Float.valueOf(tmp);
      } else if (type.equals(double.class) || type == Double.class) {
        value = Double.valueOf(tmp);
      }
    }

    return value;
  }
示例#28
0
  public CharData(String charData) {
    _charList = new Character[charData.length()];

    for (int i = 0; i < charData.length(); i++) {
      _charList[i] = Character.valueOf(charData.charAt(i));
    }
  }
示例#29
0
 /**
  * Encode a UTF-16 character into an ANSEL byte
  *
  * @param c the ANSEL byte (as a char)
  * @return the character (in UTF-16) represented by the byte
  */
 public static char encode(char c) {
   Character b = charToByte.get(Character.valueOf(c));
   if (b != null) {
     return b.charValue();
   }
   return c;
 }
示例#30
0
 /**
  * Reads the properties of this action from a resource bundle of given base name.
  *
  * @throws MissingResourceException if no resource bundle could be found from <code>
  *     resourceBaseName</code>.
  */
 private void readActionPropertyValues(
     String resourceBaseName, String actionPrefix, ClassLoader pluginClassLoader) {
   ResourceBundle resource;
   if (pluginClassLoader != null) {
     resource = ResourceBundle.getBundle(resourceBaseName, Locale.getDefault(), pluginClassLoader);
   } else {
     resource = ResourceBundle.getBundle(resourceBaseName, Locale.getDefault());
   }
   String propertyPrefix = actionPrefix + ".";
   putPropertyValue(Property.NAME, getOptionalString(resource, propertyPrefix + Property.NAME));
   putPropertyValue(
       Property.SHORT_DESCRIPTION,
       getOptionalString(resource, propertyPrefix + Property.SHORT_DESCRIPTION));
   String smallIcon = getOptionalString(resource, propertyPrefix + Property.SMALL_ICON);
   if (smallIcon != null) {
     if (smallIcon.startsWith("/")) {
       smallIcon = smallIcon.substring(1);
     }
     putPropertyValue(Property.SMALL_ICON, new ResourceURLContent(pluginClassLoader, smallIcon));
   }
   String mnemonicKey = getOptionalString(resource, propertyPrefix + Property.MNEMONIC);
   if (mnemonicKey != null) {
     putPropertyValue(Property.MNEMONIC, Character.valueOf(mnemonicKey.charAt(0)));
   }
   String toolBar = getOptionalString(resource, propertyPrefix + Property.TOOL_BAR);
   if (toolBar != null) {
     putPropertyValue(Property.TOOL_BAR, Boolean.valueOf(toolBar));
   }
   putPropertyValue(Property.MENU, getOptionalString(resource, propertyPrefix + Property.MENU));
 }