|This Article is up to date with Custom Stuff 2|
Flat Block Example (CS2)
config.addBlockIdProperty("cobaltPanelID", 2304); mod.addBlock("cobaltPanel.js", "flat");
id = config.getBlockId("cobaltPanelID"); name = "cobaltPanel"; material = "iron"; stepSound = "metal"; creativeTab = "buildingBlocks"; canFaceTop = true; canFaceBottom = true; displayName = "Cobalt Panel"; hardness = 5; resistance = 30; toolClass = "pickaxe"; harvestLevel = 2; textureFileBack = "cobaltBlock.png"; textureFileFront = "cobaltBlock.png"; textureFileSides = "cobaltBlock.png"; addToCreative = true;
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.
canFaceBottom and canFaceTop These do exactly as they say, they allow the block to face up or down if they are set to true. Unfortunately, the flat block type has both of these set to false by default. Just remember to set these to true if you want these to place your flat block on the top or bottom of a different block.
canFaceSides This is set to true by default. If you want to make sure blocks can only be placed on the floor (like carpet) or on the ceiling, you will need to set canFaceSides to false. Don't forget to set either canFaceBottom or canFaceTop to true so the block can be placed.