|This Article is up to date with Custom Stuff 2|
Example Chest (CS2)
config.addBlockIdProperty("cobaltChestID", 2501); mod.addGui("cobaltChestGUI.js", "chest"); mod.addTileEntity("cobaltChestTE.js", "chest"); mod.addBlock("cobaltChest.js", "chest");
id = config.getBlockId("cobaltChestID"); name = "cobaltChest"; material = "iron"; stepSound = "metal"; creativeTab = "buildingBlocks"; modelTexture = "cobaltChest.png"; displayName = "Cobalt Chest"; hasTileEntity = true; tileEntity = "cobaltChestTE"; hardness = 2; resistance = 30; addToCreative = true; onActivated = "player.openGui('cobaltChestGUI', position); result = true;";
name = "cobaltChestGUI"; guiFile = "cobaltChestGUI.png"; chestX = 8; chestY = 18; inventoryX = 8; inventoryY = 122; height = 176; width = 204;
name = "cobaltChestTE"; colLength = 5; rowLength = 9;
Chest Block Attributes
This is the file that determines what your chest looks like in the players inventory, after being placed, and when it opens. The layout for this file is the same as the vanilla chest's texture file.
Unlike crafting benches, where you have to script a GUI onto an ordinary block, the ability of a chest to store items is linked to the block type, so there's no scripting required. On the other hand, this same behavior also prevents rightclicked triggers from being used.
Because chests use their damage value information to track the direction they're facing, you cannot use that attribute to make variations.
Example Chest Block - Iron Chest
name="Iron Chest"; id=125; texturefile="customstuff.png"; textureindex=15; type="chest"; material="iron"; stepsound="metal"; hardness=10; resistance=30; iddropped=125; chesttextureindex1=15; chesttextureindex2=31; chesttextureindex3=14; chesttextureindex4=12; chesttextureindex5=13; chesttextureindex6=28; chesttextureindex7=29; toolclass="pickaxe"; harvestlevel=0;
Chest Block Attributes
Below is a table of attributes available to chest-type blocks, including information on notable attributes.
This must be set to 'chest' in order for the block to function as a container.
These are seven attributes (chesttextureindex1, chesttextureindex2, etc) that govern which texture will appear on each side of the chest both in its single and double form. This attribute is used because unlike most blocks, chests do have distinct fronts and backs.
If you use all seven of the chesttextureindex attributes, this attribute is effectively worthless since those attributes will texture 'over' this attribute on every side. This is why, unlike for almost every other block type, it's an optional attribute.
iddropped / quantitydropped / damagedropped
In addition to what the chest dropps when it is broken, it will also always drop its contents.