Fandom

Minecraft Mod Custom Stuff Wiki

Slab

175pages on
this wiki
Add New Page
Comments4 Share
This Article is up to date with Custom Stuff 2 CS2
Slabs, also called half-blocks, are a block type in Minecraft often used for decoration or for easy vertical movement in the place of Stairs. With Custom Stuff, you can make slabs out of any material. This includes materials that don't exist normally in the game, of course. You're also not restricted to the idea that the material used for your slab be a material that exists elsewhere; your slabs can be just slabs and never anything more.

Slabs are also unique in that they can be stacked one on top of another, forming blocks. With Custom Stuff you'll still need to set up a normal block to accomplish this however. Of course, the ability to double stack isn't required; though it is a nifty feature.

Slab Example (CS2 0.9.10 and above)

CobaltSlabsExample

Custom Slabs have both upper and lower versions.

mod.js

config.addBlockIdProperty("cobaltSlabID", 2518);
config.addBlockIdProperty("cobaltDoubleSlabID", 2519);
mod.addBlock("cobaltSlab.js", "slab");
mod.addBlock("cobaltDoubleSlab.js", "normal");

blocks/cobaltSlab.js

id = config.getBlockId("cobaltSlabID");
name = "cobaltSlab";
material = "iron";
stepSound = "metal";
creativeTab = "buildingBlocks";

displayName[0] = "Cobalt Slab";
doubleSlabId[0] = config.getBlockId("cobaltDoubleSlabID");
doubleSlabMeta[0] = 0;
hardness[0] = 5;
resistance[0] = 30;
toolClass[0] = "pickaxe";
harvestLevel[0] = 2;
textureFileXP[0] = "cobaltSlab.png";
textureFileXN[0] = "cobaltSlab.png";
textureFileYP[0] = "cobaltBlock.png";
textureFileYN[0] = "cobaltBlock.png";
textureFileZP[0] = "cobaltSlab.png";
textureFileZN[0] = "cobaltSlab.png";
addToCreative[0] = true;

toolClass[8] = "pickaxe";
harvestLevel[8] = 2;

blocks/cobaltDoubleSlab.js

id = config.getBlockId("cobaltDoubleSlabID");
name = "cobaltDoubleSlab";
material = "iron";
stepSound = "metal";
creativeTab = "buildingBlocks";

displayName[0] = "Cobalt Double Slab";
drop[0] = config.getBlockId("cobaltSlabID") + ":0 2";
hardness[0] = 5;
resistance[0] = 30;
toolClass[0] = "pickaxe";
harvestLevel[0] = 2;
textureFileXP[0] = "cobaltSlab.png";
textureFileXN[0] = "cobaltSlab.png";
textureFileYP[0] = "cobaltBlock.png";
textureFileYN[0] = "cobaltBlock.png";
textureFileZP[0] = "cobaltSlab.png";
textureFileZN[0] = "cobaltSlab.png";
addToCreative[0] = true;

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

doubleSlabId and doubleSlabMeta These two values are used when you place two slabs on top of each other to make a single block.

drop If you do not set this value in your double slab block, then when you break the double slab, you will get the double slab block instead of two slab blocks.


CS1
Older Examples and Information for Custom Stuff 1.

Example Slab (CS1)

ObsidianSlabs

Obsidian slabs using the bottom of the enchanting table for the top and bottom textures.

name="Obsidian Slab";
id=230;
texturefile="terrain.png";
textureindex=183;
textureindexnorth=37;
textureindexsouth=37;
textureindexeast=37;
textureindexwest=37;
type="slab";
material="rock";
stepsound="stone";
hardness=25;
resistance=6000;
iddropped=230;
damagedropped=0;
doubleslabid="231";
opacity=0;
toolclass="pickaxe";
harvestlevel=3;
//
textureindex8=183;
textureindexnorth8=37;
textureindexsouth8=37;
textureindexeast8=37;
textureindexwest8=37;
damagedropped8=0;

Slab Block Attributes

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


Required Attributes

Optional Attributes

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

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

Setting up Ceiling Slabs

In Minecraft 1.2, a new feature was added to slabs: the ability to place them on the underside of a block, thus causing them to occupy the top half of the space in which they are placed. This feature was then added to Custom Stuff in the 2.3.1 update. Unfortunately, it isn't perfect and requires some user-end effort to make the feature work correctly.

Ceiling slabs are actually a higher damage value of the base slab rather than a separate block. In keeping with vanilla Minecraft, the damage value (DV) of a ceiling slab is that of the normal slab +8. In the example above, you'll notice that the textureindex and damagedropped attributes are set not only for the basic, unnumbered version; but also for DV8. This is the reason for that.

The same correlation will hold true for every damage value. The ceiling slab for DV1 is DV9, and so forth. This unfortunately means that you can only have a total of eight functional damage values (0 - 7) for slab blocks since the upper eight are used for their ceiling-counterparts. Likewise, you'll always want to set the damagevalues attribute to 7 or less even though you're specifying some of the attributes for the higher values. That is unless of course you want to make the ceiling slabs their own unique items.

Fortunately, a lot of the work is coded into Custom Stuff. For example, you need only specify the doubleslabid once per pair, and it will carry over perfectly to its mate. In the example above, you can add another Obsidian Slab (of either damage value) to a placed slab (either normal or ceiling) and it will form the proper double slab. Other attributes like hardness will also carry over, though you may have to specify some as well. If something isn't working for both variations, just specify it for both DVs and it should work correctly.

Importance of the Opacity Attribute

SlabLightGlitch

An example of slabs with the default opacity (right) and the correct opacity (left).

When making slabs, 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 to be cast on adjacent blocks 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 slab, which for this purpose is the same as a normal-type block, 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.

See also

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.