Examples of ItemWrapper


Examples of cofh.lib.util.ItemWrapper

  public static boolean registerBucket(Block block, int bMeta, ItemStack bucket) {

    if (block == null || bMeta < 0 || bucket == null || buckets.containsKey(new BlockWrapper(block, bMeta))) {
      return false;
    }
    buckets.put(new BlockWrapper(block, bMeta), new ItemWrapper(bucket));
    return true;
  }
View Full Code Here

Examples of cofh.lib.util.ItemWrapper

      return null;
    }
    if (!world.setBlockToAir(x, y, z)) {
      return null;
    }
    ItemWrapper result = buckets.get(new BlockWrapper(block, bMeta));
    return new ItemStack(result.item, 1, result.metadata);
  }
View Full Code Here

Examples of cofh.lib.util.ItemWrapper

  }

  public static boolean emptyBucket(World world, int x, int y, int z, ItemStack bucket) {

    boolean r = false;
    if (!buckets.inverse().containsKey(new ItemWrapper(bucket))) {
      if (bucket.getItem() instanceof ItemBucket) {
        r = ((ItemBucket) bucket.getItem()).tryPlaceContainedLiquid(world, x, y, z);
        world.markBlockForUpdate(x, y, z);
      }
      return r;
    }
    BlockWrapper result = buckets.inverse().get(new ItemWrapper(bucket));

    Material material = world.getBlock(x, y, z).getMaterial();
    boolean solid = !material.isSolid();
    if (world.isAirBlock(x, y, z) || solid) {
      if (!world.isRemote && solid && !material.isLiquid()) {
View Full Code Here

Examples of cofh.lib.util.ItemWrapper

    BiMap<BlockWrapper, ItemWrapper> tempMap = HashBiMap.create(buckets.size());

    for (Entry<BlockWrapper, ItemWrapper> entry : buckets.entrySet()) {
      BlockWrapper tempBlock = new BlockWrapper(entry.getKey().block, entry.getKey().metadata);
      ItemWrapper tempItem = new ItemWrapper(entry.getValue().item, entry.getValue().metadata);
      tempMap.put(tempBlock, tempItem);
    }
    buckets.clear();
    buckets = tempMap;
  }
View Full Code Here

Examples of cofh.lib.util.ItemWrapper

        registerOreDictionaryEntry(ores.get(j), oreNames[i]);
      }
    }
    for (ItemWrapper wrapper : stackIDs.keySet()) {
      if (wrapper.metadata != WILDCARD_VALUE) {
        ItemWrapper wildItem = new ItemWrapper(wrapper.item, WILDCARD_VALUE);
        if (stackIDs.containsKey(wildItem)) {
          stackIDs.get(wrapper).addAll(stackIDs.get(wildItem));
          stackNames.get(wrapper).addAll(stackNames.get(wildItem));
        }
      }
View Full Code Here

Examples of cofh.lib.util.ItemWrapper

    if (!oreStacks.containsKey(id)) {
      oreStacks.put(id, new ArrayList<ItemStack>());
    }
    oreStacks.get(id).add(stack);

    ItemWrapper item = ItemWrapper.fromItemStack(stack);

    if (!stackIDs.containsKey(item)) {
      stackIDs.put(item, new ArrayList<Integer>());
      stackNames.put(item, new ArrayList<String>());
    }
View Full Code Here

Examples of cofh.lib.util.ItemWrapper

  public static int getOreID(ItemStack stack) {

    if (stack == null) {
      return UNKNOWN_ID;
    }
    ArrayList<Integer> ids = stackIDs.get(new ItemWrapper(stack));

    if (ids == null) {
      ids = stackIDs.get(new ItemWrapper(stack.getItem(), WILDCARD_VALUE));
    }
    return ids == null ? UNKNOWN_ID : ids.get(0);
  }
View Full Code Here

Examples of cofh.lib.util.ItemWrapper

   *
   * Input is not validated - don't be dumb!
   */
  public static ArrayList<Integer> getAllOreIDs(ItemStack stack) {

    ArrayList<Integer> ids = stackIDs.get(new ItemWrapper(stack));

    return ids == null ? stackIDs.get(new ItemWrapper(stack.getItem(), WILDCARD_VALUE)) : ids;
  }
View Full Code Here

Examples of cofh.lib.util.ItemWrapper

   *
   * Input is not validated - don't be dumb!
   */
  public static ArrayList<String> getAllOreNames(ItemStack stack) {

    ArrayList<String> names = stackNames.get(new ItemWrapper(stack));

    return names == null ? stackNames.get(new ItemWrapper(stack.getItem(), WILDCARD_VALUE)) : names;
  }
View Full Code Here

Examples of cofh.lib.util.ItemWrapper

  public static void refreshMap() {

    Map<ItemWrapper, IItemRenderer> tempMap = new THashMap(itemRenders.size());

    for (Entry<ItemWrapper, IItemRenderer> entry : itemRenders.entrySet()) {
      ItemWrapper tempItem = new ItemWrapper(entry.getKey().item, entry.getKey().metadata);
      tempMap.put(tempItem, entry.getValue());
    }
    itemRenders.clear();
    itemRenders = tempMap;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.