private Item createPipeSpecial(Class<? extends Pipe<?>> clas) { ItemPipe item = new ItemPipeAP(); item.setUnlocalizedName(clas.getSimpleName()); proxy.registerPipeRendering(item); BlockGenericPipe.pipes.put(item, clas); GameRegistry.registerItem(item, item.getUnlocalizedName()); proxy.createPipeSpecial(item, clas); return item; }
public static ItemPipe registerPipe(int key, Class<? extends Pipe> clas) { ItemPipe item = new ItemPipe(key); item.setUnlocalizedName("buildcraftPipe." + clas.getSimpleName().toLowerCase(Locale.ENGLISH)); GameRegistry.registerItem(item, item.getUnlocalizedName()); pipes.put(item.itemID, clas); Pipe dummyPipe = createPipe(item.itemID); if (dummyPipe != null) { item.setPipeIconIndex(dummyPipe.getIconIndexForItem()); TransportProxy.proxy.setIconProviderFromPipe(item, dummyPipe); } return item; }
@SuppressWarnings({"unchecked", "rawtypes"}) @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) { super.addInformation(stack, player, list, advanced); String key = "tip." + stack.getItem().getClass().getSimpleName(); list.add(StatCollector.translateToLocal(key)); }
public static Item createPipe( int defaultID, Class<? extends Pipe> clas, String descr, Object ingredient1, Object ingredient2, Object ingredient3) { String name = Character.toLowerCase(clas.getSimpleName().charAt(0)) + clas.getSimpleName().substring(1); Property prop = BuildCraftCore.mainConfiguration.getItem(name + ".id", defaultID); int id = prop.getInt(defaultID); ItemPipe res = BlockGenericPipe.registerPipe(id, clas); res.setItemName(clas.getSimpleName()); LanguageRegistry.addName(res, descr); // Add appropriate recipe to temporary list PipeRecipe recipe = new PipeRecipe(); if (ingredient1 != null && ingredient2 != null && ingredient3 != null) { recipe.result = new ItemStack(res, 8); recipe.input = new Object[] { "ABC", Character.valueOf('A'), ingredient1, Character.valueOf('B'), ingredient2, Character.valueOf('C'), ingredient3 }; pipeRecipes.add(recipe); } else if (ingredient1 != null && ingredient2 != null) { recipe.isShapeless = true; recipe.result = new ItemStack(res, 1); recipe.input = new Object[] {ingredient1, ingredient2}; pipeRecipes.add(recipe); } return res; }
private static ItemPipe createPipe(int defaultID, Class<? extends Pipe> clazz, String descr) { String name = Character.toLowerCase(clazz.getSimpleName().charAt(0)) + clazz.getSimpleName().substring(1); Property prop = aboConfiguration.getItem(name + ".id", defaultID); int id = prop.getInt(defaultID); try { // search for free id while (BlockGenericPipe.isPipeRegistered(id)) ++id; prop.set(id); } catch (NoSuchMethodError e) { // e.printStackTrace(); } ItemPipe pipe = BlockGenericPipe.registerPipe(id, clazz); pipe.setUnlocalizedName(clazz.getSimpleName()); LanguageRegistry.addName(pipe, descr); GameRegistry.registerItem(pipe, pipe.getUnlocalizedName().replace("item.", "")); return pipe; }
@Override public void setIconProviderFromPipe(ItemPipe item, Pipe<?> dummyPipe) { item.setPipesIcons(dummyPipe.getIconProvider()); }