Ejemplo n.º 1
0
 @Override
 public String describe() {
   return "Mirroring "
       + OreDictionary.getOreName(idSource)
       + " to "
       + OreDictionary.getOreName(idTarget);
 }
Ejemplo n.º 2
0
 @Override
 public String describeUndo() {
   return "Removing contents of ore dictionary entry "
       + OreDictionary.getOreName(idSource)
       + " from "
       + OreDictionary.getOreName(idTarget);
 }
Ejemplo n.º 3
0
 @Override
 public String describe() {
   return "Copying contents of ore dictionary entry "
       + OreDictionary.getOreName(idSource)
       + " to "
       + OreDictionary.getOreName(idTarget);
 }
Ejemplo n.º 4
0
 @Override
 public String describeUndo() {
   return "Undoing mirror of "
       + OreDictionary.getOreName(idSource)
       + " to "
       + OreDictionary.getOreName(idTarget);
 }
Ejemplo n.º 5
0
 private static void addToolsetCrafting(
     Item ingot, Item sword, Item shovel, Item axe, Item hoe, Item pickaxe) {
   String ingotName = OreDictionary.getOreName(OreDictionary.getOreIDs(new ItemStack(ingot))[0]);
   String stickName =
       OreDictionary.getOreName(OreDictionary.getOreIDs(new ItemStack(Items.stick))[0]);
   // Sword recipe
   GameRegistry.addRecipe(
       new ShapedOreRecipe(sword, "i", "i", "s", 'i', ingotName, 's', stickName));
   // Shovel recipe
   GameRegistry.addRecipe(
       new ShapedOreRecipe(shovel, "i", "s", "s", 'i', ingotName, 's', stickName));
   // Axe recipes
   GameRegistry.addRecipe(
       new ShapedOreRecipe(axe, "ii", "is", " s", 'i', ingotName, 's', stickName));
   GameRegistry.addRecipe(
       new ShapedOreRecipe(axe, "ii", "si", "s ", 'i', ingotName, 's', stickName));
   // Hoe
   GameRegistry.addRecipe(
       new ShapedOreRecipe(hoe, "ii", " s", " s", 'i', ingotName, 's', stickName));
   GameRegistry.addRecipe(
       new ShapedOreRecipe(hoe, "ii", "s ", "s ", 'i', ingotName, 's', stickName));
   // Pickaxe
   GameRegistry.addRecipe(
       new ShapedOreRecipe(pickaxe, "iii", " s ", " s ", 'i', ingotName, 's', stickName));
 }
Ejemplo n.º 6
0
  public static boolean contains(ArrayList list, ItemStack stack) {
    if (stack == null || stack.getItem() == null) return false;

    Object object = stack.getItem();

    Material material = null;

    if (object instanceof ItemBlock) {
      object = Block.getBlockFromItem((Item) object);
      material = ((Block) object).getMaterial();
    }

    int[] ores = OreDictionary.getOreIDs(stack);

    for (int i = 0; i < list.size(); i++) {
      if (list.get(i) instanceof ItemStack
          && ItemStack.areItemStacksEqual(stack, (ItemStack) list.get(i))) return true;

      if (list.get(i) == object) return true;

      if (list.get(i) == material) return true;

      if (list.get(i) instanceof String)
        for (int j = 0; j < ores.length; j++) {
          if (OreDictionary.getOreName(ores[j]).contains((CharSequence) list.get(i))) return true;
        }
    }
    return false;
  }
Ejemplo n.º 7
0
  protected final String getMostCommonName(ArrayList<ItemStack> stacks) {
    HashMap<String, Integer> map = new HashMap();
    for (ItemStack stack : stacks) {
      int[] ids = OreDictionary.getOreIDs(stack);
      for (int i : ids) {
        String name = OreDictionary.getOreName(i);
        if (map.containsKey(name)) {
          int value = map.get(name) + 1;
          map.put(name, value);
        } else map.put(name, 1);
      }
    }

    String highest = "";
    int highest_value = 0;
    for (String string : map.keySet()) {
      int value = map.get(string);
      if (value > highest_value) {
        highest_value = value;
        highest = string;
      }
    }

    return highest;
  }
  public static ItemStack identifyQuality(ItemStack stack) {
    if (stack == null) return null;

    Item item = stack.getItem();
    if (item instanceof ItemGemstone) {
      if (((ItemGemstone) item).getQuality(stack) != null) return stack;
    }

    @SuppressWarnings("unchecked")
    List<Pair<ItemStack, String>> gems =
        Lists.newArrayList(
            Pair.of(ElementsOfPower.gemRuby, "gemRuby"),
            Pair.of(ElementsOfPower.gemSapphire, "gemSapphire"),
            Pair.of(ElementsOfPower.gemCitrine, "gemCitrine"),
            Pair.of(ElementsOfPower.gemAgate, "gemAgate"),
            Pair.of(ElementsOfPower.gemQuartz, "gemQuartz"),
            Pair.of(ElementsOfPower.gemSerendibite, "gemSerendibite"),
            Pair.of(ElementsOfPower.gemEmerald, "gemEmerald"),
            Pair.of(ElementsOfPower.gemAmethyst, "gemAmethyst"),
            Pair.of(ElementsOfPower.gemDiamond, "gemDiamond"));

    int[] ids = OreDictionary.getOreIDs(stack);
    Set<String> names = Sets.newHashSet();
    for (int i : ids) {
      names.add(OreDictionary.getOreName(i));
    }

    for (Pair<ItemStack, String> target : gems) {
      if (names.contains(target.getRight())) {
        return setRandomQualityVariant(target.getLeft().copy());
      }
    }

    return stack;
  }
Ejemplo n.º 9
0
  public static ItemStack getDustForOre(ItemStack item) {
    String oreName = OreDictionary.getOreName(OreDictionary.getOreID(item));

    if (oreName.contains("ore")) {
      String lowercaseOre = oreName.toLowerCase();
      boolean isAllowed = false;

      for (String str : AlchemicalWizardry.allowedCrushedOresArray) {
        String testStr = str.toLowerCase();

        if (lowercaseOre.contains(testStr)) {
          isAllowed = true;
          break;
        }
      }

      if (!isAllowed) {
        return null;
      }

      String dustName = oreName.replace("ore", "dust");

      ArrayList<ItemStack> items = OreDictionary.getOres(dustName);

      if (items != null && items.size() >= 1) {
        return (items.get(0).copy());
      }
    }

    return null;
  }
Ejemplo n.º 10
0
 @Override
 public String describe() {
   return "Removing "
       + item.getDisplayName()
       + " from ore dictionary entry "
       + OreDictionary.getOreName(id);
 }
Ejemplo n.º 11
0
 @Override
 public String describeUndo() {
   return "Restoring "
       + item.getDisplayName()
       + " to ore dictionary entry "
       + OreDictionary.getOreName(id);
 }
Ejemplo n.º 12
0
 @Override
 public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack) {
   int[] idsStack = OreDictionary.getOreIDs(stack);
   for (int id : idsStack) {
     if (OreDictionary.getOreName(id).equals(repairItem)) return true;
   }
   return false;
 }
Ejemplo n.º 13
0
  int getStackColor(ItemStack stack) {
    int[] ids = OreDictionary.getOreIDs(stack);
    for (int i : ids) {
      int index = DYES.indexOf(OreDictionary.getOreName(i));
      if (index >= 0) return index;
    }

    return -1;
  }
Ejemplo n.º 14
0
 public boolean matches(ItemStack stack) {
   int[] ids = OreDictionary.getOreIDs(stack);
   for (int id : ids) {
     String name = OreDictionary.getOreName(id);
     if (matches(name)) {
       return true;
     }
   }
   return stack != null && OreDictionary.itemMatches(stack, input, false);
 }
Ejemplo n.º 15
0
 private static void addNuggetCrafting(Item nugget, Item ingot) {
   String nuggetName = OreDictionary.getOreName(OreDictionary.getOreIDs(new ItemStack(nugget))[0]);
   String ingotName = OreDictionary.getOreName(OreDictionary.getOreIDs(new ItemStack(ingot))[0]);
   GameRegistry.addRecipe(
       new ShapelessOreRecipe(new ItemStack(nugget, 9), new Object[] {ingotName}));
   GameRegistry.addRecipe(
       new ShapelessOreRecipe(
           new ItemStack(ingot, 1),
           new Object[] {
             nuggetName,
             nuggetName,
             nuggetName,
             nuggetName,
             nuggetName,
             nuggetName,
             nuggetName,
             nuggetName,
             nuggetName
           }));
 }
Ejemplo n.º 16
0
 public BookPageDip(String string, CrucibleLiquid ifluid, int am, ItemStack ip, ItemStack res) {
   super(string);
   input = ifluid;
   ArrayList<ItemStack> ores =
       OreDictionary.getOres(
           OreDictionary.getOreName(OreDictionary.getOreIDs(this.input.nugget)[0]));
   item1 = ores.toArray(new ItemStack[ores.size()]);
   inputItem = ip;
   resultItem = res;
   amount = am;
 }
Ejemplo n.º 17
0
  public int dyeColor(ItemStack stack) {
    int[] ids = OreDictionary.getOreIDs(stack);
    for (int id : ids) {
      for (int i = 0; i < dyes.length; i++) {
        if (OreDictionary.getOreName(id).equals(dyes[i])) {
          return i;
        }
      }
    }

    return -1;
  }
Ejemplo n.º 18
0
 /**
  * Returns the bonus item produced from a smelting operation in the infernal furnace
  *
  * @param in The input of the smelting operation. e.g. new ItemStack(oreGold)
  * @return the The bonus item that can be produced
  */
 public static ItemStack getSmeltingBonus(ItemStack in) {
   ItemStack out =
       smeltingBonus.get(Arrays.asList(Item.getIdFromItem(in.getItem()), in.getItemDamage()));
   if (out == null) {
     out =
         smeltingBonus.get(
             Arrays.asList(Item.getIdFromItem(in.getItem()), OreDictionary.WILDCARD_VALUE));
   }
   if (out == null) {
     String od = OreDictionary.getOreName(OreDictionary.getOreID(in));
     out = smeltingBonus.get(od);
   }
   return out;
 }
Ejemplo n.º 19
0
  @Override
  public boolean isItemValidForSlot(int i, ItemStack itemstack) {
    if (i == 0)
      return CompatibilityMgr.gregtechLoaded
          ? OreDictionary.getOreName(OreDictionary.getOreID(itemstack)).equals("lenseRuby")
          : Item.getItemFromBlock(Blocks.glass_pane) == itemstack.getItem() ? true : false;

    ForgeDirection front = RotatableBlock.getFront(this.getBlockMetadata());

    for (ForgeDirection f : VALID_INVENTORY_DIRECTIONS) {
      if (f == front) continue;

      TileEntity e =
          this.worldObj.getTileEntity(
              this.xCoord + f.offsetX, this.yCoord + f.offsetY, this.zCoord + f.offsetZ);

      // TODO: may cause inf loop
      if (e != null && e instanceof IInventory)
        if (i < ((IInventory) e).getSizeInventory())
          return ((IInventory) e).isItemValidForSlot(i, itemstack);
        else i -= ((IInventory) e).getSizeInventory();
    }
    return false;
  }
Ejemplo n.º 20
0
  @SubscribeEvent
  public void tTipEvent(ItemTooltipEvent event) {
    ItemStack current = event.itemStack;
    Item currentItem = current.getItem();
    Block currentBlock = Block.getBlockFromItem(currentItem);

    if (current == null) {
      return;
    }

    if (currentBlock == ObjHandler.dmPedestal) {
      event.toolTip.add(StatCollector.translateToLocal("pe.pedestal.tooltip1"));
      event.toolTip.add(StatCollector.translateToLocal("pe.pedestal.tooltip2"));
    }

    if (currentItem == ObjHandler.manual) {
      event.toolTip.add(StatCollector.translateToLocal("pe.manual.tooltip1"));
    }

    if (ProjectEConfig.showPedestalTooltip && currentItem instanceof IPedestalItem) {
      if (ProjectEConfig.showPedestalTooltipInGUI) {
        if (Minecraft.getMinecraft().currentScreen instanceof GUIPedestal) {
          event.toolTip.add(
              EnumChatFormatting.DARK_PURPLE
                  + StatCollector.translateToLocal("pe.pedestal.on_pedestal")
                  + " ");
          List<String> description = ((IPedestalItem) currentItem).getPedestalDescription();
          if (description.isEmpty()) {
            event.toolTip.add(IPedestalItem.TOOLTIPDISABLED);
          } else {
            event.toolTip.addAll(((IPedestalItem) currentItem).getPedestalDescription());
          }
        }
      } else {
        event.toolTip.add(
            EnumChatFormatting.DARK_PURPLE
                + StatCollector.translateToLocal("pe.pedestal.on_pedestal")
                + " ");
        List<String> description = ((IPedestalItem) currentItem).getPedestalDescription();
        if (description.isEmpty()) {
          event.toolTip.add(IPedestalItem.TOOLTIPDISABLED);
        } else {
          event.toolTip.addAll(((IPedestalItem) currentItem).getPedestalDescription());
        }
      }
    }

    if (ProjectEConfig.showUnlocalizedNames) {
      event.toolTip.add("UN: " + Item.itemRegistry.getNameForObject(current.getItem()));
    }

    if (ProjectEConfig.showODNames) {
      for (int id : OreDictionary.getOreIDs(current)) {
        event.toolTip.add("OD: " + OreDictionary.getOreName(id));
      }
    }

    if (ProjectEConfig.showEMCTooltip) {
      if (EMCHelper.doesItemHaveEmc(current)) {
        int value = EMCHelper.getEmcValue(current);

        event.toolTip.add(
            EnumChatFormatting.YELLOW
                + StatCollector.translateToLocal("pe.emc.emc_tooltip_prefix")
                + " "
                + EnumChatFormatting.WHITE
                + String.format("%,d", value));

        if (current.stackSize > 1) {
          long total = value * current.stackSize;

          if (total < 0 || total <= value || total > Integer.MAX_VALUE) {
            event.toolTip.add(
                EnumChatFormatting.YELLOW
                    + StatCollector.translateToLocal("pe.emc.stackemc_tooltip_prefix")
                    + " "
                    + EnumChatFormatting.OBFUSCATED
                    + StatCollector.translateToLocal("pe.emc.too_much"));
          } else {
            event.toolTip.add(
                EnumChatFormatting.YELLOW
                    + StatCollector.translateToLocal("pe.emc.stackemc_tooltip_prefix")
                    + " "
                    + EnumChatFormatting.WHITE
                    + String.format("%,d", value * current.stackSize));
          }
        }
      }
    }

    if (ProjectEConfig.showStatTooltip) {
      /** Collector ToolTips */
      String unit = StatCollector.translateToLocal("pe.emc.name");
      String rate = StatCollector.translateToLocal("pe.emc.rate");

      if (currentBlock == ObjHandler.energyCollector) {
        event.toolTip.add(
            EnumChatFormatting.DARK_PURPLE
                + String.format(
                    StatCollector.translateToLocal("pe.emc.maxgenrate_tooltip")
                        + EnumChatFormatting.BLUE
                        + " %d "
                        + rate,
                    Constants.COLLECTOR_MK1_GEN));
        event.toolTip.add(
            EnumChatFormatting.DARK_PURPLE
                + String.format(
                    StatCollector.translateToLocal("pe.emc.maxstorage_tooltip")
                        + EnumChatFormatting.BLUE
                        + " %d "
                        + unit,
                    Constants.COLLECTOR_MK1_MAX));
      }

      if (currentBlock == ObjHandler.collectorMK2) {
        event.toolTip.add(
            EnumChatFormatting.DARK_PURPLE
                + String.format(
                    StatCollector.translateToLocal("pe.emc.maxgenrate_tooltip")
                        + EnumChatFormatting.BLUE
                        + " %d "
                        + rate,
                    Constants.COLLECTOR_MK2_GEN));
        event.toolTip.add(
            EnumChatFormatting.DARK_PURPLE
                + String.format(
                    StatCollector.translateToLocal("pe.emc.maxstorage_tooltip")
                        + EnumChatFormatting.BLUE
                        + " %d "
                        + unit,
                    Constants.COLLECTOR_MK2_MAX));
      }

      if (currentBlock == ObjHandler.collectorMK3) {
        event.toolTip.add(
            EnumChatFormatting.DARK_PURPLE
                + String.format(
                    StatCollector.translateToLocal("pe.emc.maxgenrate_tooltip")
                        + EnumChatFormatting.BLUE
                        + " %d "
                        + rate,
                    Constants.COLLECTOR_MK3_GEN));
        event.toolTip.add(
            EnumChatFormatting.DARK_PURPLE
                + String.format(
                    StatCollector.translateToLocal("pe.emc.maxstorage_tooltip")
                        + EnumChatFormatting.BLUE
                        + " %d "
                        + unit,
                    Constants.COLLECTOR_MK3_MAX));
      }

      /** Relay ToolTips */
      if (currentBlock == ObjHandler.relay) {
        event.toolTip.add(
            EnumChatFormatting.DARK_PURPLE
                + String.format(
                    StatCollector.translateToLocal("pe.emc.maxoutrate_tooltip")
                        + EnumChatFormatting.BLUE
                        + " %d "
                        + rate,
                    Constants.RELAY_MK1_OUTPUT));
        event.toolTip.add(
            EnumChatFormatting.DARK_PURPLE
                + String.format(
                    StatCollector.translateToLocal("pe.emc.maxstorage_tooltip")
                        + EnumChatFormatting.BLUE
                        + " %d "
                        + unit,
                    Constants.RELAY_MK1_MAX));
      }

      if (currentBlock == ObjHandler.relayMK2) {
        event.toolTip.add(
            EnumChatFormatting.DARK_PURPLE
                + String.format(
                    StatCollector.translateToLocal("pe.emc.maxoutrate_tooltip")
                        + EnumChatFormatting.BLUE
                        + " %d "
                        + rate,
                    Constants.RELAY_MK2_OUTPUT));
        event.toolTip.add(
            EnumChatFormatting.DARK_PURPLE
                + String.format(
                    StatCollector.translateToLocal("pe.emc.maxstorage_tooltip")
                        + EnumChatFormatting.BLUE
                        + " %d "
                        + unit,
                    Constants.RELAY_MK2_MAX));
      }

      if (currentBlock == ObjHandler.relayMK3) {
        event.toolTip.add(
            EnumChatFormatting.DARK_PURPLE
                + String.format(
                    StatCollector.translateToLocal("pe.emc.maxoutrate_tooltip")
                        + EnumChatFormatting.BLUE
                        + " %d "
                        + rate,
                    Constants.RELAY_MK3_OUTPUT));
        event.toolTip.add(
            EnumChatFormatting.DARK_PURPLE
                + String.format(
                    StatCollector.translateToLocal("pe.emc.maxstorage_tooltip")
                        + EnumChatFormatting.BLUE
                        + " %d "
                        + unit,
                    Constants.RELAY_MK3_MAX));
      }
    }

    if (current.hasTagCompound()) {
      if (current.stackTagCompound.getBoolean("ProjectEBlock")) {
        event.toolTip.add(
            EnumChatFormatting.GREEN + StatCollector.translateToLocal("pe.misc.wrenched_block"));

        if (current.stackTagCompound.getDouble("EMC") > 0) {
          event.toolTip.add(
              EnumChatFormatting.YELLOW
                  + String.format(
                      StatCollector.translateToLocal("pe.emc.storedemc_tooltip")
                          + " "
                          + EnumChatFormatting.RESET
                          + "%,d",
                      (int) current.stackTagCompound.getDouble("EMC")));
        }
      }

      if (current.stackTagCompound.hasKey("StoredEMC")) {
        event.toolTip.add(
            EnumChatFormatting.YELLOW
                + String.format(
                    StatCollector.translateToLocal("pe.emc.storedemc_tooltip")
                        + " "
                        + EnumChatFormatting.RESET
                        + "%,d",
                    (int) current.stackTagCompound.getDouble("StoredEMC")));
      } else if (current.stackTagCompound.hasKey("StoredXP")) {
        event.toolTip.add(
            String.format(
                EnumChatFormatting.DARK_GREEN
                    + StatCollector.translateToLocal("pe.misc.storedxp_tooltip")
                    + " "
                    + EnumChatFormatting.GREEN
                    + "%,d",
                current.stackTagCompound.getInteger("StoredXP")));
      }
    }
  }
Ejemplo n.º 21
0
 @Override
 public String toString() {
   return "<ore:" + OreDictionary.getOreName(id) + ">";
 }
Ejemplo n.º 22
0
 public static boolean compareToOreName(ItemStack stack, String oreName) {
   for (int oid : OreDictionary.getOreIDs(stack))
     if (OreDictionary.getOreName(oid).equals(oreName)) return true;
   return false;
 }
Ejemplo n.º 23
0
  public OreStack(int oreID) {

    this(OreDictionary.getOreName(oreID));
  }
Ejemplo n.º 24
0
  public OreStack(int oreID, int stackSize) {

    this(OreDictionary.getOreName(oreID), stackSize);
  }
Ejemplo n.º 25
0
 @Override
 public String getName() {
   return OreDictionary.getOreName(id);
 }
Ejemplo n.º 26
0
 @Override
 public Object getInternal() {
   return OreDictionary.getOreName(id);
 }