Create new example block #1

Merged
BobdaFett merged 3 commits from feature/first-crafting-block into main 2025-05-02 00:52:15 +00:00
BobdaFett commented 2025-04-20 19:01:45 +00:00 (Migrated from github.com)

Adds code and a model for a new crafting block. This block does not currently display a UI when a player uses it, but it does summon lightning on their position in order to give an example of how block events should be added, and some of the capabilities of these events.

In the future, this will be the source of our new crafting system - magical crafting tables should be used to create all other magical items, maybe with the exception of a choice few.

Adds code and a model for a new crafting block. This block does not currently display a UI when a player uses it, but it does summon lightning on their position in order to give an example of how block events should be added, and some of the capabilities of these events. In the future, this will be the source of our new crafting system - magical crafting tables should be used to create all other magical items, maybe with the exception of a choice few.
NightStalker1642 (Migrated from github.com) reviewed 2025-04-20 19:01:45 +00:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2025-04-20 19:10:55 +00:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull Request Overview

This PR introduces a new example block – the Magical Crafting Table – along with its corresponding model and in-game behavior. Key changes include:

  • New utility method keyOf in ModItems.java for registry key creation.
  • Addition of a new block (MagicalCrafterBlock) that summons lightning on player interaction.
  • Integration of the new block into the mod via initialization in MagicMod.java and inclusion into the item group in ModItemGroups.java.

Reviewed Changes

Copilot reviewed 7 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/main/java/com/uncreativebunch/magicmod/item/ModItems.java Introduces a helper method to create item registry keys and updates item registration.
src/main/java/com/uncreativebunch/magicmod/item/ModItemGroups.java Updates translation key format and adds the new block’s item to the item group.
src/main/java/com/uncreativebunch/magicmod/block/crafting/MagicalCrafterBlock.java Implements the new block with an onUse behavior that summons lightning on the player.
src/main/java/com/uncreativebunch/magicmod/block/ModBlocks.java Registers the new block and conditionally registers an associated BlockItem.
src/main/java/com/uncreativebunch/magicmod/MagicMod.java Calls the new initialization methods to integrate the new block and items into the mod.
Files not reviewed (7)
  • src/main/resources/assets/magic_mod/blockstates/magical_crafting_table.json: Language not supported
  • src/main/resources/assets/magic_mod/items/magical_crafting_table.json: Language not supported
  • src/main/resources/assets/magic_mod/lang/en_us.json: Language not supported
  • src/main/resources/assets/magic_mod/models/block/magical_crafting_table.json: Language not supported
  • src/main/resources/assets/magic_mod/models/block/magical_crafting_table2.json: Language not supported
  • src/main/resources/data/magic_mod/loot_table/blocks/magical_crafting_table.json: Language not supported
  • src/main/resources/data/magic_mod/recipe/magical_crafting_table.json: Language not supported
Comments suppressed due to low confidence (3)

src/main/java/com/uncreativebunch/magicmod/item/ModItems.java:25

  • [nitpick] Consider renaming 'keyOf' to a more descriptive name such as 'getItemRegistryKey' to clearly indicate that it creates registry keys for items.
public static RegistryKey<Item> keyOf(String id) {

src/main/java/com/uncreativebunch/magicmod/item/ModItemGroups.java:35

  • Ensure that the updated translation key ('magic_mod.magic_group') matches the entries in your resource files to prevent localization issues.
.displayName(Text.translatable("magic_mod.magic_group"))

src/main/java/com/uncreativebunch/magicmod/block/crafting/MagicalCrafterBlock.java:32

  • The onUse method in the parent Block class is typically public, so overriding it as protected may lead to accessibility issues. Consider changing the access modifier to public.
@Override
    protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) {
## Pull Request Overview This PR introduces a new example block – the Magical Crafting Table – along with its corresponding model and in-game behavior. Key changes include: - New utility method keyOf in ModItems.java for registry key creation. - Addition of a new block (MagicalCrafterBlock) that summons lightning on player interaction. - Integration of the new block into the mod via initialization in MagicMod.java and inclusion into the item group in ModItemGroups.java. ### Reviewed Changes Copilot reviewed 7 out of 14 changed files in this pull request and generated no comments. <details> <summary>Show a summary per file</summary> | File | Description | | ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | | src/main/java/com/uncreativebunch/magicmod/item/ModItems.java | Introduces a helper method to create item registry keys and updates item registration. | | src/main/java/com/uncreativebunch/magicmod/item/ModItemGroups.java | Updates translation key format and adds the new block’s item to the item group. | | src/main/java/com/uncreativebunch/magicmod/block/crafting/MagicalCrafterBlock.java | Implements the new block with an onUse behavior that summons lightning on the player. | | src/main/java/com/uncreativebunch/magicmod/block/ModBlocks.java | Registers the new block and conditionally registers an associated BlockItem. | | src/main/java/com/uncreativebunch/magicmod/MagicMod.java | Calls the new initialization methods to integrate the new block and items into the mod. | </details> <details> <summary>Files not reviewed (7)</summary> * **src/main/resources/assets/magic_mod/blockstates/magical_crafting_table.json**: Language not supported * **src/main/resources/assets/magic_mod/items/magical_crafting_table.json**: Language not supported * **src/main/resources/assets/magic_mod/lang/en_us.json**: Language not supported * **src/main/resources/assets/magic_mod/models/block/magical_crafting_table.json**: Language not supported * **src/main/resources/assets/magic_mod/models/block/magical_crafting_table2.json**: Language not supported * **src/main/resources/data/magic_mod/loot_table/blocks/magical_crafting_table.json**: Language not supported * **src/main/resources/data/magic_mod/recipe/magical_crafting_table.json**: Language not supported </details> <details> <summary>Comments suppressed due to low confidence (3)</summary> **src/main/java/com/uncreativebunch/magicmod/item/ModItems.java:25** * [nitpick] Consider renaming 'keyOf' to a more descriptive name such as 'getItemRegistryKey' to clearly indicate that it creates registry keys for items. ``` public static RegistryKey<Item> keyOf(String id) { ``` **src/main/java/com/uncreativebunch/magicmod/item/ModItemGroups.java:35** * Ensure that the updated translation key ('magic_mod.magic_group') matches the entries in your resource files to prevent localization issues. ``` .displayName(Text.translatable("magic_mod.magic_group")) ``` **src/main/java/com/uncreativebunch/magicmod/block/crafting/MagicalCrafterBlock.java:32** * The onUse method in the parent Block class is typically public, so overriding it as protected may lead to accessibility issues. Consider changing the access modifier to public. ``` @Override protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { ``` </details>
Sign in to join this conversation.