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

Doors are a block type in Minecraft that can be toggled to allow or deny access to an area by players or mobs. With the use of Custom Stuff, new doors can be added in much the same way any other block can. Unlike most blocks, however, doors usually exist as a paired block and item combination, adding a level of complexity to their creation. Additionally, doors cannot use Damage Values to create variants because the metadata of door blocks are instead used to track the direction they're facing, their open/closed and top/down status.

Example Door (CS2 0.9.10 and above)[]

An example of a door as a custom block. This should be saved with the extension ".js" under '/config/CustomStuff/YourMod/blocks'.

id = config.getBlockId("yourDoorBlockID"); //Grabs door block ID from config
name = "yourdoorblock"; //Internal name of block
iconFile = "yourDoorIcon.png"; //texture for door item in inventory
creativeTab = "buildingBlocks"; //determines which tab the item will be in

displayName[0]= "Your Door"; //Name of block as shown in inventory
textureFileYP[0] = 1; //Top half of door texture
textureFileYN[0] = 17; //Bottom half of door texture
drop[0] = config.getBlockId("yourDoorBlockID") + ":0 1"; //Point to your door block ID and create an item from it
addToCreative[0]= true; //Allows item in creative inventory

The item for placing the door will automatically be made and use the same id as your block file. In your mod.js file, add the following line to finish adding your door to minecraft:

config.addBlockIdProperty("yourDoorBlockID", 2706);
         //adds property to config with a value of 2706.
mod.addBlock("yourDoorFile.js", "door");

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.

iconFile
This determines what the item for the door looks like in your inventory. In CS 0.9.9, you would use create an item for the door instead of using iconFile in the block file.

redstoneOnly
This determines if the door can be opened by hand or only by a redstone signal. If set to false, the 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.

An example of a glass door as a custom block. This should be saved with the extension ".block" under '/config/customBlocks'.

name="Glass Door";
id=244;
texturefile="terrain.png";
textureindex=49;        //The texture index of the TOP half of the door.
texturebottomindex=49;  //The texture index of the BOTTOM half of the door
type="door";
material="glass";
stepsound="glass";
hardness=0.1;
resistance=1;
iddropped=660;         //The ID of the accompanying item (below).
opacity=0;             //See below for why this attribute must be set.
transparency=true;     //Set if using textures with transparency. ("windows")
toolclass="pickaxe, shovel, axe, hoe";
harvestclass=0;

An example of the accompanying item. This should be saved with the extension ".item" under '/config/customItems'.

name="Glass Door";
id=660;
iconfile="custom.png";  //There's no 'default' texture, so one must be added.
iconindex=0;            //The placement of the item icon on the texture sheet.
type="door";            //This MUST be present for the door item to function.
iddoor=244;             //The block ID of the door block (above).
maxstack=1;             //A 1-stack is default; but any value 1-64 will work.

Door Block Attributes[]

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 'door' in order for the block to function as a door.

texturebottomindex
This attribute is unique to doors in that it gives texture to the bottom half of the door. It is selected in exactly the same way that 'textureindex' is.

redstoneonly
This attribute is used only on doors 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.

iddropped
Like most other blocks, doors will drop themselves by default. Since doors are set via an accompanying item, you'll need to have the door block drop that item instead.

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

Door Item Attributes[]

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


Required Attributes

Optional Attributes

iconfile
This attribute is not technically required, however it is unlikely that anyone will create a door with an icon already in Minecraft. If not set, it defaults to 'gui/icons.png'.

type
The type attribute must be set to door in order to place the door block correctly. Because the door block is actually two blocks in height, an item is required in order to place it correctly.

maxstack
The two doors available in Vanilla Minecraft both have items with a maxstack of one. It is entirely possible to set the maxstack of doors to any value from 1 up to 64 without problem, however, so this remains a design choice rather than a hard limit of the game.

iddoor
This attribute must be set to the block ID of the door block that the item places. Failing to set this attribute correctly makes the item worthless.

Importance of the Opacity Attribute[]

DoorShadowError

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

When making door 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 'inside' of the door 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.

Bugs[]

  • Doors don't always open or close correctly in SMP, and sometimes it is impossible to walk through a seemingly open door. CubeX2 is looking into it.
Advertisement