From 4249a40b2db56085d5b681963887b43e47e53e79 Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Sun, 15 Feb 2026 19:17:33 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Add=20docstrings=20to=20`feat/ad?= =?UTF-8?q?d-items`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Docstrings generation was requested by @The-Code-Monkey. * https://github.com/CodeMonkeysMods/MineTale/pull/46#issuecomment-3904263976 The following files were modified: * `src/main/java/com/tcm/MineTale/registry/ModBlocks.java` --- .../com/tcm/MineTale/registry/ModBlocks.java | 35 ++++++++++++++++--- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/tcm/MineTale/registry/ModBlocks.java b/src/main/java/com/tcm/MineTale/registry/ModBlocks.java index d9b8ba8..22ac439 100644 --- a/src/main/java/com/tcm/MineTale/registry/ModBlocks.java +++ b/src/main/java/com/tcm/MineTale/registry/ModBlocks.java @@ -220,11 +220,11 @@ public class ModBlocks { // public static final Block THORIUM_ORE_SANDSTONE = registerOreBlock("thorium_ore_sandstone", Block::new, BlockBehaviour.Properties.of().strength(2).requiresCorrectToolForDrops(), Blocks.SANDSTONE, Items.COPPER_ORE, 1); /** - * Adds the mod's workbench and furnace blocks to the Functional Blocks creative tab. + * Adds all mod-registered blocks to the MineTale creative tab and logs the action. * - * Registers CAMPFIRE_WORKBENCH_BLOCK, WORKBENCH_WORKBENCH_BLOCK, FURNACE_WORKBENCH_BLOCK_T1, - * and FURNACE_WORKBENCH_BLOCK_T2 to CreativeModeTabs.FUNCTIONAL_BLOCKS and prints a registration - * message containing the mod ID. + * Subscribes an entries-modification handler for ModCreativeTab.MINETALE_CREATIVE_TAB_KEY that + * inserts every block collected in REGISTERED_BLOCKS into the creative tab, then prints a + * registration message that includes the mod ID. */ public static void initialize() { ItemGroupEvents.modifyEntriesEvent(ModCreativeTab.MINETALE_CREATIVE_TAB_KEY).register(entries -> { @@ -235,7 +235,17 @@ public static void initialize() { System.out.println("Registered Mod Blocks for " + MineTale.MOD_ID); } - private static Block register(String name, Function blockFactory, BlockBehaviour.Properties settings, boolean shouldRegisterItem) { + /** + * Register a block under the mod's namespace, optionally create and register its corresponding BlockItem, + * and add the block to the internal list of registered blocks. + * + * @param name the registry name (path) to use for the block and item + * @param blockFactory factory that creates the Block from provided BlockBehaviour.Properties + * @param settings the BlockBehaviour.Properties to apply to the block; this method will set the block's registry ID on it + * @param shouldRegisterItem if `true`, a BlockItem for the block will be created and registered with the same name + * @return the registered Block instance + */ + private static Block register(String name, Function blockFactory, BlockBehaviour.Properties settings, boolean shouldRegisterItem) { // Create a registry key for the block ResourceKey blockKey = keyOfBlock(name); // Create the block instance @@ -257,6 +267,21 @@ private static Block register(String name, Function blockFactory, BlockBehaviour.Properties settings, Block baseBlock, Item itemToDrop, int count) { ResourceKey blockKey = keyOfBlock(name);