|This Article is up to date with Custom Stuff 2|
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)
config.addBlockIdProperty("cobaltTrapdoorID", 2523); mod.addBlock("cobaltTrapDoor.js", "trapDoor");
id = config.getBlockId("cobaltTrapdoorID"); name = "cobaltTrapdoor"; material = "iron"; stepSound = "metal"; creativeTab = "buildingBlocks"; redstoneOnly = false; displayName = "Cobalt Trapdoor"; hardness = 5; resistance = 30; toolClass = "pickaxe"; harvestLevel = 2; textureFileXP = "cobaltTrapDoor.png"; textureFileXN = "cobaltTrapDoor.png"; textureFileYP = "cobaltTrapDoor.png"; textureFileYN = "cobaltTrapDoor.png"; textureFileZP = "cobaltTrapDoor.png"; textureFileZN = "cobaltTrapDoor.png"; addToCreative = true;
Trap Door 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.
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.
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.
This must be set to 'trapdoor' in order for the block to function as a trap door.
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.
Setting this attribute to a low value prevents a rather pronounced visual bug. See Importance of the Opacity Attribute below.