BlockCategories
How to add a block to a category in the G-menu.
How to create your own category in the G-menu.
How to add a block to a scroll group (marked with the +).
How XML works.
Completed setting up a modding environment for SBC modding.
This tutorial teaches you how to add a block to one of the categories of blocks displayed in the G-menu on the left hand side and also explains how to add your own such category to the game. The relevant reference page for this tutorial is BlockCategories.
Adding to an existing BlockCategory
Data-subfolder. There you will find the file named BlockCategories.sbc. Copy it into your mod’s Data-folder.Open the file with your preferred XML editor. Within the element CategoryClasses you’ll see individual Category-entries defined. Search for the category you want to add your block(s) to either by looking at their Name or the individual block entries. Once you’ve found the Category you want, delete all other categories from the file.
LargeBlocks or SmallBlocks category, depending on the block’s grid size.Next, you remove all existing blocks under ItemIds from the category and replace them with entries for your own blocks. An entry consists of a block’s TypeId and SubtypeId, separated by a / slash.
Large Blocks and the Conveyor-categories. If my blocks were also available for small grid, I would be adding them to that category here too.<?xml version="1.0" encoding="utf-8"?>
<Definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<CategoryClasses>
<Category xsi:type="MyObjectBuilder_GuiBlockCategoryDefinition">
<Id>
<TypeId>GuiBlockCategoryDefinition</TypeId>
<SubtypeId/>
</Id>
<DisplayName>DisplayName_Category_LargeBlocks</DisplayName>
<Name>LargeBlocks</Name>
<ItemIds>
<string>Conveyor/AQD_LG_ConveyorJunctionTubes</string>
<string>Conveyor/AQD_LG_ConveyorX</string>
<string>ConveyorConnector/AQD_LG_ConveyorStraight5x1</string>
<string>ConveyorConnector/AQD_LG_ConveyorStraightArmored</string>
<string>ConveyorConnector/AQD_LG_ConveyorCornerArmored</string>
<string>Conveyor/AQD_LG_ConveyorTArmored</string>
<string>Conveyor/AQD_LG_ConveyorXArmored</string>
<string>CargoContainer/AQD_LG_ConveyorAccess</string>
<string>CargoContainer/AQD_LG_ConveyorVent</string>
</ItemIds>
</Category>
<Category xsi:type="MyObjectBuilder_GuiBlockCategoryDefinition">
<Id>
<TypeId>GuiBlockCategoryDefinition</TypeId>
<SubtypeId/>
</Id>
<DisplayName>DisplayName_Category_ConveyorBlocks</DisplayName>
<Name>Conveyors</Name>
<ItemIds>
<string>Conveyor/AQD_LG_ConveyorJunctionTubes</string>
<string>Conveyor/AQD_LG_ConveyorX</string>
<string>ConveyorConnector/AQD_LG_ConveyorStraight5x1</string>
<string>ConveyorConnector/AQD_LG_ConveyorStraightArmored</string>
<string>ConveyorConnector/AQD_LG_ConveyorCornerArmored</string>
<string>Conveyor/AQD_LG_ConveyorTArmored</string>
<string>Conveyor/AQD_LG_ConveyorXArmored</string>
<string>CargoContainer/AQD_LG_ConveyorAccess</string>
</ItemIds>
</Category>
</CategoryClasses>
</Definitions>
Creating a new BlockCategory
Data-subfolder. There you will find the file named BlockCategories.sbc. Copy it into your mod’s Data-folder.Category-entries from the file except one. It doesn’t really matter which one - it’s kept purely so that we don’t have to write it from scratch.Change the DisplayName property like so: <DisplayName>{LOC:DisplayName_Category_[YourIdentifier]}</DisplayName and replace [YourIdentifier] with a name that identifies your category.
Use the same identifier in the Name-element of your Category-entry.
Replace the block entries under ItemIds with your own block entries as normal.
<?xml version="1.0" encoding="utf-8"?>
<Definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<CategoryClasses>
<Category xsi:type="MyObjectBuilder_GuiBlockCategoryDefinition">
<Id>
<TypeId>GuiBlockCategoryDefinition</TypeId>
<SubtypeId/>
</Id>
<DisplayName>{LOC:DisplayName_AQD_Cat_Concrete}</DisplayName>
<Name>Concrete</Name>
<ItemIds>
<string>CubeBlock/AQD_LG_Concrete_Block</string>
<string>CubeBlock/AQD_LG_Concrete_Slope</string>
<string>CubeBlock/AQD_LG_Concrete_Corner</string>
<string>CubeBlock/AQD_LG_Concrete_Corner_Inv</string>
<string>CubeBlock/AQD_LG_Concrete_Half_Block</string>
<string>CubeBlock/AQD_LG_Concrete_Half_Block_Slope</string>
<string>CubeBlock/AQD_LG_ReinforcedConcrete_Block</string>
<string>CubeBlock/AQD_LG_ReinforcedConcrete_Slope</string>
<string>CubeBlock/AQD_LG_ReinforcedConcrete_Corner</string>
<string>CubeBlock/AQD_LG_ReinforcedConcrete_Corner_Inv</string>
<string>CubeBlock/AQD_LG_ReinforcedConcrete_Half_Block</string>
<string>CubeBlock/AQD_LG_ReinforcedConcrete_Half_Block_Slope</string>
</ItemIds>
</Category>
</CategoryClasses>
</Definitions>
RESX-entry for your `DisplayName_Category_[YourIdentifier]` name of the category.Sub-categories explained
All the entries on the left of the Toolbar Config (g-menu) are just categories, the ones that look like "sub-categories" have 3 spaces before their name, that's all.
Their order is determined by the <Name>, see below for details.
Placing a category after an existing one
Simplest way is to find the category that you want to follow and copy its <Name>, then append something after said name and use that as your category's <Name>.
For example: to add a category after Armor Blocks, its name is Section1_Position2_Armorblocks therefore your category's name can be Section1_Position2_Armorblocks_Fancy which will position it right after that.
This also means if another mod adds a Section1_Position2_Armorblocks_Athing category, then their category will be in between yours and theirs, because A is before F.
If you wish it to look like a "sub-category" then add the 3 spaces before the visual name in the <DisplayName> element.
<Category xsi:type="MyObjectBuilder_GuiBlockCategoryDefinition">
<Id>
<TypeId>GuiBlockCategoryDefinition</TypeId>
<SubtypeId/>
</Id>
<DisplayName> Fancy Armor</DisplayName>
<Name>Section1_Position2_Armorblocks_Fancy</Name>
<ItemIds>
<string>CubeBlock/YourFancyArmorBlock</string>
<!-- etc... -->
</ItemIds>
</Category>
Here's how this would look like:

Troubleshooting
My block does not show up in the category I added it to
- Did you pair your block with another block in the same category using BlockPairName? If you pair a small grid and a large grid block using
BlockPairNamein theCubeBlocks-definition, and both are added to the sameBlockCategory, only the large grid block will be displayed. The only way to show the small grid version separately is to add it to a category that its large grid counterpart is not part of.
My weapon / tool cannot be placed as such onto the hotbar
- Is it part of a category marked with
IsToolCategory = true? In order for your weapon or tool to show up as such in the Hotbar Config menu, it must be part of a category marked as a tool category usingIsToolCategory = truein its category definition.