Minecraftmodcustomstuff Wiki
Register
Advertisement
This Article is up to date with Custom Stuff 2 "Denotes content compatible with Custom Stuff 2"
Cstairs

A lineup of stairs made of common materials, but not found in the vanilla game.

Stairs are a common block in Minecraft that allow for easy movement over raised terrain. Custom Stuff has the capability of adding new stairs as a Block. Stairs can have most of the same attributes as normal blocks, and for the most part can be coded in the same way.

Stairs cannot utilize metadata values to create variants because the metadata of stair blocks is instead used to track their orientation. Custom Stuff will give an error when you use metadata values, so you cannot, for example, make the stairs texture chang depending on its facing.

Example Stairs Block (CS2 0.9.10 and higher)[]

In this example, we're adding obsidian stairs using the textures found in the vanilla game. As with all examples, the mod.js file will be in the root of your project's directory, and the block file (obsidianStairs.js) will be in the /blocks/ folder within that directory.

mod.js

config.addBlockIdProperty("obsidianStairsID", 217);
mod.addBlock("obsidianStairs.js", "stairs");

concreteBricks.js

name = "obsidianStairs";
id = config.getBlockId("obsidianStairsID");
material = "rock";
stepSound = "stone";
creativeTab = "buildingBlocks";

displayName[0] = "ObsidianStairs";
hardness[0] = 50;
resistance[0] = 6000;
toolClass[0] = "pickaxe";
harvestLevel[0] = 3;
textureFileXP[0] = "/obsidian.png";
textureFileXN[0] = "/obsidian.png";
textureFileYP[0] = "/obsidian.png";
textureFileYN[0] = "/enchantment_bottom.png";
textureFileZP[0] = "/obsidian.png";
textureFileZN[0] = "/obsidian.png";
addToCreative[0] = true;

Stairs Block Attributes[]

Required Attributes

Optional 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.


CS1
Older Examples and Information for Custom Stuff 1.


Stairs cannot use Damage Values to create variants because the metadata of stair blocks are instead used to track the direction they're facing.

Example Stairs Block[]

name="Snow Stairs";
id=226;
texturefile="terrain.png";
textureindex=66;
type="stairs";
material="ground";
stepsound="grass";
hardness=0.1;
resistance=1;
iddropped=226;
opacity=0;
toolclass="shovel";
harvestlevel=0;

Stairs Block Attributes[]

Below is a table of attributes available to stairs-type blocks, including information on notable attributes.



Required Attributes

Optional Attributes

type
This must be set to 'stairs' in order for the block to function as stairs.

opacity
Setting this attribute to a low value prevents a rather pronounced visual bug. See Importance of the Opacity Attribute below.

Importance of the Opacity Attribute[]

StairsShadow

An example of stairs with default opacity (left) rendering incorrectly, and the fixed version (right).

When making stair blocks the opacity attribute should always be set to a value of ten or less even if the the material being used not being intrinsically translucent. This is done to prevent a visual 'bug', demonstrated by the picture at right, which causes a shadow on the inner angle of the block regardless of light level. This 'glitch' occurs because Minecraft calculates the light level of the area 'inside' the block based on what's immediately below it. Because a block normally blocks all light, the boundary of the stairs block (the box you see when you place your reticule on it) forces the game to calculate the light level as being 0 on the ground beneath the block. Setting the opacity to a low value fixes this issue.

This is also why stairs, slabs, and doors in the vanilla game don't block light entirely even when they logically should.

Advertisement