Skip to content

Commit 8dffa69

Browse files
authored
Merge pull request #24 from CodeMonkeysMods/coderabbitai/docstrings/8bd20de
📝 Add docstrings to `Logs`
2 parents 1d18945 + 34d9633 commit 8dffa69

5 files changed

Lines changed: 58 additions & 9 deletions

File tree

src/client/java/com/tcm/MineTale/MineTaleDataGen.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,19 @@
77

88
public class MineTaleDataGen implements DataGeneratorEntrypoint {
99

10+
/**
11+
* Initialize a data pack and register the mod's data providers.
12+
*
13+
* Creates a data pack from the given Fabric data generator and adds the language
14+
* and model providers so they will run during data generation.
15+
*
16+
* @param fabricDataGenerator the Fabric data generator used to create the data pack
17+
*/
1018
@Override
1119
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
1220
FabricDataGenerator.Pack pack = fabricDataGenerator.createPack();
1321

1422
pack.addProvider(ModLangProvider::new);
1523
pack.addProvider(ModModelProvider::new);
1624
}
17-
}
25+
}

src/client/java/com/tcm/MineTale/datagen/ModLangProvider.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,21 @@
77
import java.util.concurrent.CompletableFuture;
88

99
public class ModLangProvider extends FabricLanguageProvider {
10+
/**
11+
* Creates a ModLangProvider configured to generate the mod's language translations.
12+
*
13+
* @param dataOutput the FabricDataOutput used to write generated language files
14+
* @param registryLookup a CompletableFuture supplying a HolderLookup.Provider for registry lookups during data generation
15+
*/
1016
public ModLangProvider(FabricDataOutput dataOutput, CompletableFuture<HolderLookup.Provider> registryLookup) {
1117
super(dataOutput, registryLookup);
1218
}
1319

20+
/**
21+
* Populates the translation builder with English language entries for MineTale (creative tab title and block names).
22+
*
23+
* @param translationBuilder the builder used to register translation keys and their English values
24+
*/
1425
@Override
1526
public void generateTranslations(HolderLookup.Provider wrapperLookup, TranslationBuilder translationBuilder) {
1627
translationBuilder.add("minetale.creative_tab.title", "MineTale Stuffs");
@@ -51,4 +62,4 @@ public void generateTranslations(HolderLookup.Provider wrapperLookup, Translatio
5162
translationBuilder.add("block.minetale.wild_wisteria_log", "Wild Wisteria Log");
5263
translationBuilder.add("block.minetale.wild_wisteria_wood", "Wild Wisteria Wood");
5364
}
54-
}
65+
}

src/client/java/com/tcm/MineTale/datagen/ModModelProvider.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,21 @@
77
import net.minecraft.client.data.models.ItemModelGenerators;
88

99
public class ModModelProvider extends FabricModelProvider {
10-
public ModModelProvider(FabricDataOutput output) { super(output); }
10+
/**
11+
* Creates a ModModelProvider using the given Fabric data output.
12+
*
13+
* @param output the FabricDataOutput used to write generated model and blockstate data
14+
*/
15+
public ModModelProvider(FabricDataOutput output) { super(output); }
1116

17+
/**
18+
* Registers block state and model definitions for the mod's log blocks.
19+
*
20+
* This configures horizontal and vertical log models for each custom log block and, for
21+
* WILD_WISTERIA_LOG, also registers the corresponding wood model (WILD_WISTERIA_WOOD).
22+
*
23+
* @param blockStateModelGenerator the generator used to create block state and model entries
24+
*/
1225
@Override
1326
public void generateBlockStateModels(BlockModelGenerators blockStateModelGenerator) {
1427
blockStateModelGenerator.woodProvider(ModBlocks.AMBER_LOG).logWithHorizontal(ModBlocks.AMBER_LOG);
@@ -43,8 +56,13 @@ public void generateBlockStateModels(BlockModelGenerators blockStateModelGenerat
4356
blockStateModelGenerator.woodProvider(ModBlocks.WILD_WISTERIA_LOG).logWithHorizontal(ModBlocks.WILD_WISTERIA_LOG).wood(ModBlocks.WILD_WISTERIA_WOOD);
4457
}
4558

59+
/**
60+
* Registers item models for the mod; currently left empty (no item models are generated).
61+
*
62+
* @param itemModelGenerators generator used to register item models
63+
*/
4664
@Override
4765
public void generateItemModels(ItemModelGenerators itemModelGenerators) {
4866

4967
}
50-
}
68+
}

src/main/java/com/tcm/MineTale/datagen/ModBlockTagProvider.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,23 @@
99
import java.util.concurrent.CompletableFuture;
1010

1111
public class ModBlockTagProvider extends FabricTagProvider.BlockTagProvider {
12+
/**
13+
* Creates a ModBlockTagProvider used to generate block tag data for the mod (e.g., assigning mod log blocks to BlockTags.LOGS).
14+
*
15+
* @param output the Fabric data output target used to write generated data
16+
* @param registriesFuture a future that supplies registry lookups required during data generation
17+
*/
1218
public ModBlockTagProvider(FabricDataOutput output, CompletableFuture<HolderLookup.Provider> registriesFuture) {
1319
super(output, registriesFuture);
1420
}
1521

22+
/**
23+
* Populates the BlockTags.LOGS tag with this mod's log blocks.
24+
*
25+
* Registers each mod-defined log block so they are included in the game's LOGS tag mapping.
26+
*
27+
* @param provider a registry lookup provider used to resolve holders during tag population
28+
*/
1629
@Override
1730
protected void addTags(HolderLookup.Provider provider) {
1831
valueLookupBuilder(BlockTags.LOGS)
@@ -47,4 +60,4 @@ protected void addTags(HolderLookup.Provider provider) {
4760
.add(ModBlocks.WINDWILLOW_LOG)
4861
.add(ModBlocks.WILD_WISTERIA_LOG);
4962
}
50-
}
63+
}

src/main/java/com/tcm/MineTale/datagen/ModDataGenerator.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
public class ModDataGenerator implements DataGeneratorEntrypoint {
77

88
/**
9-
* Initializes data generation by creating a new data pack and registering recipe providers.
9+
* Sets up data generation by creating a data pack and registering providers for recipes and block tags.
1010
*
11-
* Creates a FabricDataGenerator.Pack from the provided generator and registers
12-
* ModRecipeProvider as a provider for that pack.
11+
* Registers ModRecipeProvider and ModBlockTagProvider with the created pack.
1312
*
14-
* @param fabricDataGenerator the FabricDataGenerator used to create packs and register providers
13+
* @param fabricDataGenerator the FabricDataGenerator used to create data packs and register providers
1514
*/
1615
@Override
1716
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {

0 commit comments

Comments
 (0)