|This Article is up to date with Custom Stuff 2|
Furnace (CS2 0.10.0 and above)
config.addBlockIdProperty("yourFurnaceID", 2102); mod.addTileEntity("furnaceTile.js", "furnace"); mod.addGui("furnaceGUI.js", "furnace"); mod.addBlock("NF.js", "furnace");
id = config.getBlockId("yourFurnaceId"); name = "newFurnace"; material = "iron"; creativeTab = "decorations"; //inactive furnace displayName = "Your Furnace"; hardness = 3.0; drop = 2102; addToCreative = true; hasTileEntity = true; tileEntity = "furnaceTile"; textureFileBack = "yourFurnaceBack.png"; textureFileFront = "yourFurnaceFront.png"; textureFileSides = "yourFurnaceSides.png"; onActivated = "player.openGui('furnaceGUI', position); result = true;"; //active furnace light = 10; displayName = "Your Furnace"; hardness = 3.0; drop = 2102; addToCreative = true; hasTileEntity = true; tileEntity = "furnaceTile"; textureFileBack = "yourFurnaceBack.png"; textureFileFront = "yourFurnaceFront(on).png"; textureFileSides = "yourFurnaceSides.png"; onActivated = "player.openGui('furnaceGUI', position); result = true;";
name = "furnaceTile"; ticksToSmelt = 200;
name = "furnaceGUI"; guiFile = "/gui/furnace.png";
The code until now only created a furnace with a different appearance. You can do so much more with it when you use your own RecipeLists.
First, you need to change the tileEntity to include usedRecipeLists and usedFuelLists with the list names you want to use.
name = "furnaceTile"; ticksToSmelt = 200; usedRecipeLists = "EnhancerList"; usedFuelLists = "EnhancerList";
After that you just need some to add fuels and recipes for your machine.
config\CustomStuff\mods\yourMod\mod.js (to add:)
mod.addFuelFor("EnhancerList", "295:0", 50); mod.addFuelFor("EnhancerList", "348:0", 1200); mod.addAliasWithMetadata(2175, 0, "sicklysapling"); mod.addAliasWithMetadata(2175, 4, "robustsapling"); mod.addSmeltingRecipeFor("EnhancerList", "robustsapling", "sicklysapling");
This example uses seeds or glowstone dust to smelt a tree sapling from the Twilight Forest mod into a different sapling of the same mod.
Furnace Block Attributes
textureFile and textureIndex
In CS2 versions for 1.4.7 and below, CS2 0.9.9 or below, textureFile was used to specify the texture sheet and textureIndex was used for identifying the specific icon within the texture sheet. If using CS2 0.9.9 or lower, make sure to use both of these attributes.
In this example, we'll be setting up a netherrack furnace (shown at right). Each of the three main components will be shown, explained, and where needed broken down into sub-sections to make it easier to understand.
Furnace Block (CS1)
Here's the basic setup of the block.
name="Netherrack Furnace"; id=251; texturefile="NetherSurvive.png"; textureindex=3; textureindexnorth=2; textureindexsouth=2; textureindexeast=2; textureindexwest=0; hardness=2; resistance=12; material="rock"; stepsound="stone"; harvestlevel=0; toolclass="pickaxe"; iddropped=251; damagedropped=0; movebypiston="false"; addtocreative="true";
There are a few things to note about this setup. First, the texture indexes are set up in a particular way to accommodate the 'shape' of the furnace. The 'textureindex' variable is the top and bottom of the furnace. The north, south, east, and west texture indexes are the sides and back, and 'textureindexwest' is the front (index 2 in this case). West has to be the front of the furnace (index 0 in this case) to make it match how a normal furnace shows up in the player's inventory, with the front facing to the left.
The 'movebypison' MUST be set to false for a furnace. If it is not, and a player moves it with a piston, the game will crash. For this reason, it is very important that this attribute be set correctly.
Preparing for the Container and GUI
The last two things that need to be taken care of are the container attribute, and the GUI function call. Add the following two lines to your .block file:
rightclicked="customstuff.openGui(origin, 'netherfurnace');"; container="NetherrackFurnace";
The top line will open the default furnace GUI when the block is right-clicked.
The second line lets the GUI know what container is going to be used for the furnace. A furnace MUST have a container set up for it to function, as explained in the next step.
The furnace container is a pretty easy thing to set up in Custom Stuff 2.3.0 since it contains a maximum of four lines. This file has to be saved with the extension ".container" in the folder /.minecraft/config/customContainers/ in order for it to be found.
Here's our furnace container:
name="NetherrackFurnace"; type="furnace"; speed=200; usedrecipes="vanilla";
The name must match the value of the 'container' attribute on our .block file exactly for it to work.
A speed of 200 is the default for a furnace. To make the furnace go faster, decrease this value. To make it slower, increase the value.
Finally, usedrecipes is set to "vanilla" in this example because I want it to be able to smelt everything that a normal furnace can. If you want to have smelting recipes exclusive to your custom furnace, you can change this value to anything you want. Just know that you'll also have to give your smelting recipes the same value. You can also have multiple values, separated with a comma.
For the most part, you'll want to use "defaultfurnace" as your GUI since it's the same furnace GUI used by the vanilla furnaces (for the most part). For information on creating your own furnace GUI, or altering the existing one, see GUI.
For this example, we're going to be changing things just a little bit to let players know that our furnace is different.
We're going to start by copying the defaultfurnace gui file in /.minecraft/config/customGuis/, and renaming the copy to netherfurnace.gui
Most of it we're going to leave the same because there's really no reason to change the layout much. What we are going to change are the following lines:
name = "netherfurnace"; id = 66; stringtext1 = "Netherrack Furnace"; stringcolor1 = 0x660000; stringcolor2 = 0x660000;
Remember that the above are the ones that are changed. The rest of the GUI file must still be in place.
The name of the furnace needs to be changed to match the name we called with the rightclicked trigger in the block example above.
Because this is now a different GUI, the id of the gui needs to be changed. Keep in mind that GUI IDs don't draw from the same pool as block and item IDs, so you can pick virtually any arbitrary (or symbolic) number and it'll work just fine.
The last three are purely aesthetic changes. The stringtext1 line changes the text at the top of the furnace GUI to "Netherrack Furnace" to provide a visual cue that this furnace is different from the normal one. The two 'stringcolor' attributes have been changed to give the text a reddish color, further cementing that this is a nether furnace in the player's mind.
- There is presently no good way to set the facing of a furnace block.