Пример #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);
   }
 }
Пример #2
0
  @Override
  public List<IOreDictEntry> getOres() {
    List<IOreDictEntry> result = new ArrayList<>();

    for (String key : OreDictionary.getOreNames()) {
      for (ItemStack is : OreDictionary.getOres(key)) {
        if (is.getItem() == stack.getItem()
            && (is.getItemDamage() == OreDictionary.WILDCARD_VALUE
                || is.getItemDamage() == stack.getItemDamage())) {
          result.add(MineTweakerAPI.oreDict.get(key));
          break;
        }
      }
    }

    return result;
  }
Пример #3
0
 int addVillager(String name, ResourceLocation skin) {
   int id = config.getVillager(name);
   VSBinding b = new VSBinding();
   b.id = id;
   b.object = skin;
   registeredVillagers.add(b);
   return id;
 }
Пример #4
0
 @Override
 public boolean contains(IIngredient ingredient) {
   List<IItemStack> iitems = ingredient.getItems();
   return !(iitems == null || iitems.size() != 1) && matches(iitems.get(0));
 }