Feed The Beast Wiki:Tilesheet update guide

This is that manual.

Introduction
You may have noticed around the wiki we have Crafting Grid, Infobox, and Navbox Templates that show icons of blocks and items from mods. These images need to come from somewhere. The number of items covered would make individual image files incredibly impractical. And as such, the Tilesheet Extension was developed. The Extension has two components that are commonly interacted with: the sheet list and the item list. A Tilesheet is a single image file built out of images of all of the blocks and items that exist in a mod; the sheet list is a list of all tilesheets that have been created. The Item List is a list of every single block and item that exists on all tilesheets on the wiki, what mod's tilesheet the item comes from, and where exactly on the tilesheet that item is. Whenever Gc or NI references a mod name and item name, those values are fed into the tilesheet extension, and it returns the relevant item icon.

Preparation
has written a program that does most of the actual work for us. However, there are still certain prerequisites to updating a tilesheet.


 * 1) The program is written in Rust. In particular, it is written in Rust and requires Rust nightly; it will fail to compile against stable builds of Rust. As such, the first thing necessary to use it is an installation of Rust Nightly. On Linux you must use the command lines from the download page for the installation. It is recommended that you install Rust using Rustup.
 * 2) The program itself. Put the folder of it in some obvious place.
 * 3) The program uses OptiPNG to compress the resulting tilesheet images and make them more suitably sized for upload. Place optipng.exe in the ftb-rs folder. Note: A PNG compression program other than OptiPNG can be used, however if you intend to do so you will need to modify the ftb-rs source code to tell it to use your other program, and you may need to write additional scripting to process inputs and outputs.
 * 4) Because every single change to an entry in the item list causes a change to appear in Special:RecentChanges, to reduce spam all full tilesheet updates must be done on a bot account with editor user rights. To acquire an editor bot account, contact a wiki administrator.

Preparing the Tilesheet Program
Go to the folder where you placed the program you downloaded (ftb-rs), and open a command prompt in it. Enter this line into it: cargo build This command will cause Rust to download all dependencies for the tilesheet builder program and compile it to run. If anything goes wrong, hope it doesn't, then contact on IRC or Discord.

After you have done this, create a new folder in ftb-rs named "work". In that folder, create a folder named "tilesheets".

A "ftb.json" file is also required in the ftb-rs folder, containing the bot's credentials. When the program is first ran and there is no such file, a sample will be autogenerated that must be tweaked in order for the program to function. The ftb.json file has the following parameters:
 * useragent: The actual username of the bot, such as "PonyButt" and "ESAEBSAD." This defaults to "ftb-rs."
 * username: The login username of the bot, which is generated by Special:BotPasswords. This username is the one that is structured as the regular username, plus the "@" character, plus a suffix of some sort, such as "Xbony2@MyRobot." This defaults to "insert username here."
 * password: The login password of the bot, which is generated by Special:BotPasswords. This password is the one that is 32 characters long and are made up of a random combination of lowercase letters and numbers. This defaults to "insert password here."
 * baseapi: A link to the base API web address. This defaults to "https://ftb.gamepedia.com/api.php," and it should not be changed.

Preparing to Update or Create a Tilesheet
The first portion of this is done in Minecraft itself, and unfortunately at present can only be done easily on Minecraft 1.7.10 or higher.

BlockRenderer (Minecraft 1.8+)
You will need a Minecraft instance containing the mod you want to build a tilesheet of, and BlockRenderer. Open a world, and open the Bulk Render GUI by using the render key (defaults to `) and the CTRL key. Enter the mod id for the mod you want to render, and set the render size to 64x64.

The mod id can be found in the game menu under "mods" or "mod options" and in the tab of the respective mod. For example for Blood Magic stands Mod ID: 'BloodMagic' in the third row, and you have to write in lowercase in the Bulk Render GUI bloodmagic.

Press render, wait for it to finish creating all the images, and get all of the icons from the "renders/Current Date/Mod ID" (where Current Date is the current date, and Mod ID is the mod ID for the mod you are creating a tilesheet for).

NEI (Minecraft 1.7)
You will need a Minecraft instance containing the mod you want to build a tilesheet of, and NEI. Open a world, and in NEI, search for @Mod.Mod Name (where Mod Name is the name of the mod you want a tilesheet for). This will make NEI display only the items from that mod. Next, open the NEI Options menu (bottom left corner of the inventory screen). Go to Tools -> Data Dumps, then in Item Panel toggle the type (initially CSV) to PNG, increase the size to 64x64, and press Dump. This will create a new "dumps" subfolder in the folder where the current Minecraft instance is stored. That dumps folder will contain the folder itempanel_icons, which will contain a 64x64 .png image file of every single block and item in the mod.

Renames
The hard part (hard because judgement-intensive) is searching through this folder to find images with duplicate names, or names that contain underscores (_). There are two reasons a file name can contain an underscore:
 * 1) Duplicate item names. (Fixing duplicate item names requires judgement on the part of you.)
 * The resulting duplicate item names will be called Itemname.png, Itemname_2.png, Itemname_3.png, etc. Each of them must be renamed to reflect what the image actually represents. This does not mean renaming them to Itemname (1).png, Itemname (2).png, Itemname (3).png, etc. This means actually figuring out what they represent and naming them appropriately. If, and only if, the items with the same names are exactly the same image, then the duplicate images can be deleted. Otherwise, do not delete images.


 * 1) Inappropriate characters (:, /, etc.) in the actual item name that can't be used in a filename.
 * Fixing inappropriate characters is somewhat easier. To account for them, create a text file called "renames.txt". In that text file, enter all incorrect file names and their correct names, using the format.

For example, since  has a fraction in it, this cannot be saved to a file and is replaced with an underscore (_). The filename in the image dump would be, and can be renamed when uploading by adding a line in "renames.txt" with the text. Type one item per line and nothing else in the file. Save the file into the folder with all the icons using the encoding UTF-8 Without BOM. If you want to skip uploading a tile to the tilesheet, use the format  and leave the rename field blank.

Open the ftb-rs/work/tilesheets folder, copy the itempanel_icons folder into the tilesheets folder, and rename it with the mod's abbreviation. A list of mod names and abbreviations can be found here. If the mod's abbreviation does not exist, consult with other editors and administrators on IRC.

Creating or updating a tilesheet
Once the dependencies are lined up, you can get around to actually running the tilesheet builder. This is done through this command: cargo run --release It will ask you for the abbreviation of the mod that you will be creating a tilesheet for, and will do all the work of importing the existing tilesheet from the wiki if it already exists. If the tilesheet does not exist it will ask you for the dimensions you want; almost always this will be "16,32".

After a few seconds it will create "additions.txt" and "missing.txt", the former with any tiles that you are adding that were not on the tilesheet before, and the latter with tiles that were on the tilesheet before that you did not provide an updated version of. If a tile was intentionally removed or renamed in an update to the mod you may choose to copy over those entries from "missing.txt" to "todelete.txt" so the program may automatically delete those tiles.

Once you are done reviewing the changes in "additions.txt" and "missing.txt" you may enter "continue" at which time the program will finally update the tilesheet and use the API to add any new tiles to the wiki, as well as removing any tiles that you requested to be deleted. The program will also produce "Tilesheet ABBRV 16 0.png" and "Tilesheet ABBRV 32 0.png" which you must manually upload to the wiki yourself. If a tilesheet is larger than 64x64 tiles, it will automatically create two more files, "Tilesheet ABBRV 16 1.png" and "Tilesheet ABBRV 32 1.png". Any addition tilesheet files generated must all be uploaded. Do not change their names. Make sure to put them in the.

Compile error on Windows
running: "gcc.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-m64" "-o " "D:\\Daten\\Rust\\ftb-rs-master\\target\\debug\\build\\miniz-sys-6a96c81df5f92 18f\\out\\miniz.o" "-c" "miniz.c" ExitStatus(ExitStatus(1))

command did not execute successfully, got: exit code: 1

--- stderr gcc.exe: error: CreateProcess: No such file or directory thread ' ' panicked at 'explicit panic', C:\Users\LuminousLizard\.cargo\reg istry\src\github.com-88ac128001ac3a9a\gcc-0.3.19\src\lib.rs:771

Solution: For Win 64bit install "MinGw-w64" from this page and set in the system variables the path to the "bin" folder in the installation (standard for 64bit: C:/Program Files/mingw-w64/x86_64-5.2.0-win32-seh-rt_v4-rev1/mingw64/bin)

Error when creating a tilesheet (1)
Update command accepted but program returns following error message and nothing is created: $ sudo cargo run --release -- update MSC Running `/home/luminouslizard/Rust/ftb-rs-master/target/release/ftb update MSC`

Loading tilesheet No tilesheet found. Creating new tilesheet. Updating tilesheet

thread ' ' panicked at 'called `Result::unwrap` on an `Err` value: Error { repr: Os { code: 2, message: "No such file or directory" } }', ../src/libcore/result.rs:688 Process didn't exit successfully: `/home/luminouslizard/Rust/ftb-rs-master/target/release/ftb update MSC` (exit code: 101)

Solution: The command prompt is opened in the wrong folder. Open the command prompt in the folder where you placed the program you downloaded (standard: ftb-rs or ftb-rs-master where the "target" and "src" folder is located).