This Article is up to date with Custom Stuff 2 |
---|
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)[]
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.
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 |
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.