-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Treetap #775
Added Treetap #775
Conversation
…1.19.2/master # Conflicts: # build.gradle.kts # src/main/java/net/id/paradiselost/blocks/ParadiseLostBlocks.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other suggestions are good and I think especially block tags and predicates (like fishing recipes do) are things we should add.
I definitely think there should be a time gap between placing and filling, so that you can't just get infinite fluid super quickly, just a specifier in the recipe for the delay for how long it takes to 'recharge' the block, or how long it takes to fill an item
src/main/java/net/id/paradiselost/recipe/ParadiseLostRecipeTypes.java
Outdated
Show resolved
Hide resolved
Currently it's based on random tick to add some natural randomness to the tap. But I could also move it so scheduled ticks, always taking a fixed, predetermined amount of time. |
I just realized that I loaded a world that I think had random tick speed set to 3000, so nevermind. blocktags and predicates still sound like they'd be cool tho |
WalkthroughThe recent updates to the Paradise Lost mod focus on introducing a new mechanical element with the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files ignored due to path filters (7)
src/main/resources/assets/paradise_lost/blockstates/tree_tap.json
is excluded by:!**/*.json
src/main/resources/assets/paradise_lost/lang/en_us.json
is excluded by:!**/*.json
src/main/resources/assets/paradise_lost/models/block/tree_tap.json
is excluded by:!**/*.json
src/main/resources/assets/paradise_lost/models/item/tree_tap.json
is excluded by:!**/*.json
src/main/resources/data/paradise_lost/loot_tables/blocks/tree_tap.json
is excluded by:!**/*.json
src/main/resources/data/paradise_lost/recipes/tree_tap.json
is excluded by:!**/*.json
src/main/resources/data/paradise_lost/recipes/tree_tap/water.json
is excluded by:!**/*.json
Files selected for processing (13)
- build.gradle.kts (1 hunks)
- gradle.properties (1 hunks)
- src/main/java/net/id/paradiselost/ParadiseLost.java (2 hunks)
- src/main/java/net/id/paradiselost/blocks/ParadiseLostBlocks.java (4 hunks)
- src/main/java/net/id/paradiselost/blocks/blockentity/ParadiseLostBlockEntityTypes.java (1 hunks)
- src/main/java/net/id/paradiselost/blocks/blockentity/TreeTapBlockEntity.java (1 hunks)
- src/main/java/net/id/paradiselost/blocks/mechanical/TreeTapBlock.java (1 hunks)
- src/main/java/net/id/paradiselost/client/rendering/block/ParadiseLostBlockEntityRenderers.java (1 hunks)
- src/main/java/net/id/paradiselost/client/rendering/block/TreeTapBlockEntityRenderer.java (1 hunks)
- src/main/java/net/id/paradiselost/items/ParadiseLostItems.java (1 hunks)
- src/main/java/net/id/paradiselost/recipe/ParadiseLostRecipeTypes.java (1 hunks)
- src/main/java/net/id/paradiselost/recipe/TreeTapRecipe.java (1 hunks)
- src/main/java/net/id/paradiselost/recipe/TreeTapRecipeSerializer.java (1 hunks)
Additional comments: 20
gradle.properties (1)
- 8-13: The updates to
loaderVersion
,fabricApiVersion
, andcustomportalapiVersion
reflect newer versions of dependencies. Ensure compatibility with the Minecraft version and other dependencies.src/main/java/net/id/paradiselost/client/rendering/block/ParadiseLostBlockEntityRenderers.java (1)
- 14-16: Switching to
BlockEntityRendererFactories.register
for block entity types registration is in line with API updates. Ensure thorough testing to confirm renderers function as expected.src/main/java/net/id/paradiselost/recipe/ParadiseLostRecipeTypes.java (1)
- 28-30: The registration of the
TREE_TAP_RECIPE_SERIALIZER
andTREE_TAP_RECIPE_TYPE
is implemented correctly. Ensure that theTREE_TAP_RECIPE_ID
is unique and does not conflict with existing recipe IDs.src/main/java/net/id/paradiselost/blocks/blockentity/ParadiseLostBlockEntityTypes.java (1)
- 15-22: The addition and registration of the
TREE_TAP
block entity type are implemented correctly. Ensure that theParadiseLostBlocks.TREE_TAP
block is correctly defined and behaves as expected.src/main/java/net/id/paradiselost/recipe/TreeTapRecipe.java (2)
- 30-37: The implementation of the
matches
method inTreeTapRecipe
correctly checks both the ingredient and the tapped block. This ensures that the recipe only matches under the correct conditions.- 39-42: The
craft
method inTreeTapRecipe
properly returns a copy of the output item stack, ensuring that the original recipe output is not modified.src/main/java/net/id/paradiselost/recipe/TreeTapRecipeSerializer.java (1)
- 20-28: The serialization logic in
TreeTapRecipeSerializer
correctly handles the recipe's group, ingredient, tapped block, and output. Ensure that serialization and deserialization are thoroughly tested, especially the handling of NBT data in the output item stack.src/main/java/net/id/paradiselost/blocks/blockentity/TreeTapBlockEntity.java (3)
- 47-52: The
handleUse
method correctly implements the logic for swapping items between the player's hand and the block entity's inventory. This interaction is essential for the block's functionality.- 81-100: The
tryCraft
method implements the crafting logic for the TreeTap block entity, checking for a matching recipe and handling the crafting result. Ensure that this logic is tested thoroughly, especially the handling of item scattering when the inventory is not empty.- 64-75: NBT read and write methods are correctly implemented for serializing and deserializing the block entity's inventory. This is crucial for preserving the block entity's state across game sessions.
src/main/java/net/id/paradiselost/blocks/mechanical/TreeTapBlock.java (3)
- 47-54: The interaction handling in
TreeTapBlock
correctly allows for item swapping with the block entity when the player is not sneaking. This interaction is key to the block's functionality.- 61-71: The block placement logic in
TreeTapBlock
ensures that the block can only be placed with a horizontal facing and on a solid support. This is important for maintaining the block's intended behavior and appearance.- 103-110: The random tick behavior in
TreeTapBlock
triggers the crafting logic, adding a dynamic element to the block's functionality. Ensure that this behavior is tested to confirm it works as intended and does not introduce any unintended effects.build.gradle.kts (1)
- 49-52: The addition of the "Ladysnake" Maven repository is correctly configured. Ensure that the repository is trusted and that its dependencies are necessary for the project.
src/main/java/net/id/paradiselost/ParadiseLost.java (2)
- 29-29: The import statement for
ParadiseLostRecipeTypes
is correctly added to support the new feature's initialization. Good practice to keep imports organized and relevant to the changes.- 93-93: The addition of
ParadiseLostRecipeTypes.init();
correctly initializes the new recipe types for the Treetap block. Ensure that all dependencies, especially those related to the Treetap block, are initialized in the correct order to avoid any runtime issues.src/main/java/net/id/paradiselost/blocks/ParadiseLostBlocks.java (3)
- 8-25: The addition of import statements for various blocks, including
TreeTapBlock
,ParadiseLostGrassBlock
,ParadiseLostSaplingBlock
, and others, indicates the introduction of new block types to the game. This aligns with the PR's objective to enhance the game's mechanics and interactive features.- 58-58: The method signature change from
protected static
topublic static
for theunbreakable
method increases its accessibility. This change could be intended to allow more extensive use across the codebase, potentially by other classes or packages that deal with unbreakable blocks. However, it's essential to ensure that this increased accessibility does not inadvertently expose or allow modification of game mechanics that should remain internal or controlled.Consider reviewing the usage of the
unbreakable
method across the project to ensure that its newpublic
access level is appropriately utilized and does not introduce any unintended side effects.
- 392-392: The addition of the
TreeTapBlock
with properties such as.strength(2.5f)
and.sounds(BlockSoundGroup.WOOD)
is consistent with the PR's objective to introduce a new block type that enhances the game's interactive features. The use of.nonOpaque()
and.ticksRandomly()
suggests that the block has specific behavior regarding visibility and random tick updates, which could be related to the fluid collection mechanism discussed in the PR comments.Ensure that the
TreeTapBlock
's behavior, especially regarding the time delay mechanism for fluid collection, is thoroughly tested under various game settings to address the concerns raised in the PR comments.src/main/java/net/id/paradiselost/items/ParadiseLostItems.java (1)
- 178-178: The addition of the
TREE_TAP
block item is consistent with the PR objectives and follows the established pattern for adding new items in this class. The use of themisc
settings group and thefuel(300)
action suggests that this item is categorized correctly and has a fuel value, which could be relevant for gameplay mechanics involving combustion or crafting.One thing to consider is whether the
TREE_TAP
item has any specific interactions or properties that are not covered by the standardBlockItem
class. If so, it might be beneficial to create a custom item class forTREE_TAP
to encapsulate these behaviors. This would enhance maintainability and clarity, especially if future enhancements to the Treetap functionality are planned.
src/main/java/net/id/paradiselost/client/rendering/block/TreeTapBlockEntityRenderer.java
Show resolved
Hide resolved
Dafuq
coderabbitai[bot] ***@***.***> schrieb am Mo., 11. März 2024,
18:55:
… ***@***.***[bot]* requested changes on this pull request.
Review Status
*Actionable comments generated: 1*
*Configuration used: CodeRabbit UI*
Commits Files that changed from the base of the PR and between f6ad972
<f6ad972>
and b3bbc1d
<b3bbc1d>.
Files ignored due to path filters (7)
- src/main/resources/assets/paradise_lost/blockstates/tree_tap.json is
excluded by: !**/*.json
- src/main/resources/assets/paradise_lost/lang/en_us.json is excluded
by: !**/*.json
- src/main/resources/assets/paradise_lost/models/block/tree_tap.json
is excluded by: !**/*.json
- src/main/resources/assets/paradise_lost/models/item/tree_tap.json is
excluded by: !**/*.json
-
src/main/resources/data/paradise_lost/loot_tables/blocks/tree_tap.json
is excluded by: !**/*.json
- src/main/resources/data/paradise_lost/recipes/tree_tap.json is
excluded by: !**/*.json
- src/main/resources/data/paradise_lost/recipes/tree_tap/water.json is
excluded by: !**/*.json
Files selected for processing (13)
- build.gradle.kts (1 hunks)
- gradle.properties (1 hunks)
- src/main/java/net/id/paradiselost/ParadiseLost.java (2 hunks)
- src/main/java/net/id/paradiselost/blocks/ParadiseLostBlocks.java (4
hunks)
- src/main/java/net/id/paradiselost/blocks/blockentity/ParadiseLostBlockEntityTypes.java
(1 hunks)
- src/main/java/net/id/paradiselost/blocks/blockentity/TreeTapBlockEntity.java
(1 hunks)
- src/main/java/net/id/paradiselost/blocks/mechanical/TreeTapBlock.java
(1 hunks)
- src/main/java/net/id/paradiselost/client/rendering/block/ParadiseLostBlockEntityRenderers.java
(1 hunks)
- src/main/java/net/id/paradiselost/client/rendering/block/TreeTapBlockEntityRenderer.java
(1 hunks)
- src/main/java/net/id/paradiselost/items/ParadiseLostItems.java (1
hunks)
- src/main/java/net/id/paradiselost/recipe/ParadiseLostRecipeTypes.java
(1 hunks)
- src/main/java/net/id/paradiselost/recipe/TreeTapRecipe.java (1 hunks)
- src/main/java/net/id/paradiselost/recipe/TreeTapRecipeSerializer.java
(1 hunks)
Additional comments: 20
gradle.properties (1)
- 8-13: The updates to loaderVersion, fabricApiVersion, and
customportalapiVersion reflect newer versions of dependencies. Ensure
compatibility with the Minecraft version and other dependencies.
src/main/java/net/id/paradiselost/client/rendering/block/ParadiseLostBlockEntityRenderers.java
(1)
- 14-16: Switching to BlockEntityRendererFactories.register for block
entity types registration is in line with API updates. Ensure thorough
testing to confirm renderers function as expected.
src/main/java/net/id/paradiselost/recipe/ParadiseLostRecipeTypes.java (1)
- 28-30: The registration of the TREE_TAP_RECIPE_SERIALIZER and
TREE_TAP_RECIPE_TYPE is implemented correctly. Ensure that the
TREE_TAP_RECIPE_ID is unique and does not conflict with existing
recipe IDs.
src/main/java/net/id/paradiselost/blocks/blockentity/ParadiseLostBlockEntityTypes.java
(1)
- 15-22: The addition and registration of the TREE_TAP block entity
type are implemented correctly. Ensure that the
ParadiseLostBlocks.TREE_TAP block is correctly defined and behaves as
expected.
src/main/java/net/id/paradiselost/recipe/TreeTapRecipe.java (2)
- 30-37: The implementation of the matches method in TreeTapRecipe
correctly checks both the ingredient and the tapped block. This ensures
that the recipe only matches under the correct conditions.
- 39-42: The craft method in TreeTapRecipe properly returns a copy of
the output item stack, ensuring that the original recipe output is not
modified.
src/main/java/net/id/paradiselost/recipe/TreeTapRecipeSerializer.java (1)
- 20-28: The serialization logic in TreeTapRecipeSerializer correctly
handles the recipe's group, ingredient, tapped block, and output. Ensure
that serialization and deserialization are thoroughly tested, especially
the handling of NBT data in the output item stack.
src/main/java/net/id/paradiselost/blocks/blockentity/TreeTapBlockEntity.java
(3)
- 47-52: The handleUse method correctly implements the logic for
swapping items between the player's hand and the block entity's inventory.
This interaction is essential for the block's functionality.
- 81-100: The tryCraft method implements the crafting logic for the
TreeTap block entity, checking for a matching recipe and handling the
crafting result. Ensure that this logic is tested thoroughly, especially
the handling of item scattering when the inventory is not empty.
- 64-75: NBT read and write methods are correctly implemented for
serializing and deserializing the block entity's inventory. This is crucial
for preserving the block entity's state across game sessions.
src/main/java/net/id/paradiselost/blocks/mechanical/TreeTapBlock.java (3)
- 47-54: The interaction handling in TreeTapBlock correctly allows for
item swapping with the block entity when the player is not sneaking. This
interaction is key to the block's functionality.
- 61-71: The block placement logic in TreeTapBlock ensures that the
block can only be placed with a horizontal facing and on a solid support.
This is important for maintaining the block's intended behavior and
appearance.
- 103-110: The random tick behavior in TreeTapBlock triggers the
crafting logic, adding a dynamic element to the block's functionality.
Ensure that this behavior is tested to confirm it works as intended and
does not introduce any unintended effects.
build.gradle.kts (1)
- 49-52: The addition of the "Ladysnake" Maven repository is correctly
configured. Ensure that the repository is trusted and that its dependencies
are necessary for the project.
src/main/java/net/id/paradiselost/ParadiseLost.java (2)
- 29-29: The import statement for ParadiseLostRecipeTypes is correctly
added to support the new feature's initialization. Good practice to keep
imports organized and relevant to the changes.
- 93-93: The addition of ParadiseLostRecipeTypes.init(); correctly
initializes the new recipe types for the Treetap block. Ensure that all
dependencies, especially those related to the Treetap block, are
initialized in the correct order to avoid any runtime issues.
src/main/java/net/id/paradiselost/blocks/ParadiseLostBlocks.java (3)
- 8-25: The addition of import statements for various blocks,
including TreeTapBlock, ParadiseLostGrassBlock,
ParadiseLostSaplingBlock, and others, indicates the introduction of
new block types to the game. This aligns with the PR's objective to enhance
the game's mechanics and interactive features.
- 58-58: The method signature change from protected static to public
static for the unbreakable method increases its accessibility. This
change could be intended to allow more extensive use across the codebase,
potentially by other classes or packages that deal with unbreakable blocks.
However, it's essential to ensure that this increased accessibility does
not inadvertently expose or allow modification of game mechanics that
should remain internal or controlled.
Consider reviewing the usage of the unbreakable method across the project
to ensure that its new public access level is appropriately utilized and
does not introduce any unintended side effects.
- 392-392: The addition of the TreeTapBlock with properties such as
.strength(2.5f) and .sounds(BlockSoundGroup.WOOD) is consistent with
the PR's objective to introduce a new block type that enhances the game's
interactive features. The use of .nonOpaque() and .ticksRandomly()
suggests that the block has specific behavior regarding visibility and
random tick updates, which could be related to the fluid collection
mechanism discussed in the PR comments.
Ensure that the TreeTapBlock's behavior, especially regarding the time
delay mechanism for fluid collection, is thoroughly tested under various
game settings to address the concerns raised in the PR comments.
src/main/java/net/id/paradiselost/items/ParadiseLostItems.java (1)
- 178-178: The addition of the TREE_TAP block item is consistent with
the PR objectives and follows the established pattern for adding new items
in this class. The use of the misc settings group and the fuel(300)
action suggests that this item is categorized correctly and has a fuel
value, which could be relevant for gameplay mechanics involving combustion
or crafting.
One thing to consider is whether the TREE_TAP item has any specific
interactions or properties that are not covered by the standard BlockItem
class. If so, it might be beneficial to create a custom item class for
TREE_TAP to encapsulate these behaviors. This would enhance
maintainability and clarity, especially if future enhancements to the
Treetap functionality are planned.
------------------------------
In
src/main/java/net/id/paradiselost/client/rendering/block/TreeTapBlockEntityRenderer.java
<#775 (comment)>
:
> + @OverRide
+ public void render(TreeTapBlockEntity entity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
+ if (!entity.isEmpty()) {
+ matrices.push();
+ // todo: rotate along facing axis
+ matrices.translate(0.5, 0.4, 0.5);
+ matrices.scale(0.75F, 0.75F, 0.75F);
+ MinecraftClient.getInstance().getItemRenderer().renderItem(entity.getStack(0), ModelTransformation.Mode.FIXED, light, overlay, matrices, vertexConsumers, 0);
+ matrices.pop();
+ }
+ }
The rendering logic for the TreeTap block entity is implemented correctly.
However, there's a TODO comment about rotating along the facing axis, which
should be addressed to ensure the rendered item aligns properly with the
block's orientation.
Would you like assistance in implementing the rotation logic?
—
Reply to this email directly, view it on GitHub
<#775 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGJUQSQYKGDQRKSNUWGTMMTYXXVZTAVCNFSM6AAAAAA4WVD6D6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTSMRYGY2DKNJTG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files ignored due to path filters (1)
config/checkstyle/checkstyle.xml
is excluded by:!**/*.xml
Files selected for processing (4)
- src/main/java/net/id/paradiselost/blocks/blockentity/TreeTapBlockEntity.java (1 hunks)
- src/main/java/net/id/paradiselost/blocks/mechanical/TreeTapBlock.java (1 hunks)
- src/main/java/net/id/paradiselost/client/rendering/block/ParadiseLostBlockEntityRenderers.java (1 hunks)
- src/main/java/net/id/paradiselost/recipe/TreeTapRecipe.java (1 hunks)
Files skipped from review as they are similar to previous changes (4)
- src/main/java/net/id/paradiselost/blocks/blockentity/TreeTapBlockEntity.java
- src/main/java/net/id/paradiselost/blocks/mechanical/TreeTapBlock.java
- src/main/java/net/id/paradiselost/client/rendering/block/ParadiseLostBlockEntityRenderers.java
- src/main/java/net/id/paradiselost/recipe/TreeTapRecipe.java
This PR adds a fully functional Treetap block, with block, item, recipe, block entity, renderer & recipe type.
Further Ideas:
Summary by CodeRabbit
New Features
Refactor