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

A Custom Iron trapdoor beside its vanilla counterpart.

Trapdoors are the second type of entry-barring block added to Minecraft after the door. While normal doors prevent horizontal barriers from being crossed, Trapdoors instead bar a single block of verticle travel. They require an adjacent solid block to be placed upon, and will be hinged to that block when opened.

There is only a single trapdoor in the vanilla game, aptly titled "Trap Door".

Because trapdoors used their metadata for facing and opened/closed status, it is not possible to make variants using damage values.

Example Trap Door (CS2 0.9.10 and above)[]

CobaltTrapdoorExample

Trap doors now come in blue.

mod.js

config.addBlockIdProperty("cobaltTrapdoorID", 2523);
mod.addBlock("cobaltTrapDoor.js", "trapDoor");

blocks/cobaltTrapDoor.js

id = config.getBlockId("cobaltTrapdoorID");
name = "cobaltTrapdoor";
material = "iron";
stepSound = "metal";
creativeTab = "buildingBlocks";
redstoneOnly = false;

displayName[0] = "Cobalt Trapdoor";
hardness[0] = 5;
resistance[0] = 30;
toolClass[0] = "pickaxe";
harvestLevel[0] = 2;
textureFileXP[0] = "cobaltTrapDoor.png";
textureFileXN[0] = "cobaltTrapDoor.png";
textureFileYP[0] = "cobaltTrapDoor.png";
textureFileYN[0] = "cobaltTrapDoor.png";
textureFileZP[0] = "cobaltTrapDoor.png";
textureFileZN[0] = "cobaltTrapDoor.png";
addToCreative[0] = true;

Trap Door 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.

redstoneOnly
This determines if the trap door can be opened by hand or only by a redstone signal. If set to false, the trap door can be opened by hand or by redstone signal. If set to true, it can only be opened using a redstone signal.


CS1
Older Examples and Information for Custom Stuff 1.

Example Trap Door Block (CS2)[]

This is an example of a custom trapdoor. In particular, this will give you the iron trapdoor shown on the image above. Like all blocks, it should be saved with the extension .block under '/config/customBlocks'

name="Iron Trap Door";
id=225;
texturefile="terrain.png";
textureindex=22;
type="trapdoor";
material="iron";
stepsound="metal";
hardness=5;
resistance=25;
iddropped=225;
opacity=0;
redstoneonly="true";
toolclass="pickaxe";
harvestlevel=0;

Trap Door Attributes (CS1)[]

Below is a table of attributes available to the door type block, including information on notable attributes.

Required Attributes

Optional Attributes

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

redstoneonly
This attribute is used only on doors, fence gates and trapdoors. When set to true, this attribute prevents the door from being opened normally, requiring a redstone current to toggle the position of the door. In vanilla Minecraft, iron doors have this attribute set as true while wooden doors have it set as false.

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[]

TrapdoorShadowGlitch

An example of a trap door with low opacity (left), and default opacity (right).

When making trapdoordoor 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 is cast on the faces adjacent to the trapdoor 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