Farming Station #568
No reviewers
Labels
No labels
Area-Assets
Area-Backend
Area-Conduits
Area-Datapacks
Area-Lang
Area-Mod Compat
Area-Parity
Area-Rendering
Good first issue
MC-1.19.2
MC-1.20.1
MC-1.20.4
MC-1.20.6
MC-1.21
MC-1.21.1
Modtoberfest
P-0-High
P-1-Medium
P-2-Low
Status-Awaiting Response
Status-Behind-Flag
Status-Blocked
Status-Cannot Reproduce
Status-Duplicate
Status-Help Wanted
Status-Incomplete Report
Status-Invalid
Status-Needs LTS Backport
Status-Needs Updating
Status-Stale
Status-To Implement
Status-Triage
Status-Wontfix
Status-Wontmerge
Type-Backport
Type-Bug
Type-Documentation
Type-Enhancement
Type-Question
Type-RFC
Type-Suggestion
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Team-EnderIO/EnderIO#568
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "farm"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Adding the farming station
Closes #142
Todo
Checklist:
Summary by CodeRabbit
Does this supersede/build on #463 ?
Before I review, is this PR functionality-wise complete?
I think so yes
Not possible to merge this into 1.21 as-is, but I will help you with the migration to 1.21 after the project reorganisation :)
@Rover656 how do I get the CI to work? If I run spotless locally, it changes a bunch of things unrelated to this PR
Hey everyone! 👋
Just wondering if there's any progress on this (as a new viewer of the project) as I'm looking to backport this implementation into the 1.20.1 version, for my personal server.
If anyone could give me any heads up/OK to go ahead with that, I'd be much appreciative.
Cheers! 👍
Walkthrough
This pull request introduces a comprehensive Farming Station feature to the mod. It adds new APIs (enum, interfaces, and a task manager) for farming interactions and tasks, alongside the implementation of a block entity, GUI, and menu for the Farming Station. The changes also integrate energy configuration parameters, network packet handling for farm soul data, additional recipes, soul data management, and utility functions for tree detection, as well as a JSON model for the block. Overall, the modifications establish the core functionality and interaction flow for the Farming Station.
Changes
enderio-base/.../FarmInteraction.java,FarmTask.java,FarmTaskManager.java,FarmingStation.javaenderio-base/.../Integration.javaregisterFarmTasksin the Integration interface for task registration.enderio-base/.../EIOTags.java,.../lang/af_za.jsonFERTILIZERStag constant and an Afrikaans localisation entry for the Farming Station block.enderio-machines/.../FarmingStationScreen.java,FarmingStationBlockEntity.java,FarmingStationMenu.java,package-info.java,MachineBlockEntities.java,MachineBlocks.java,MachineMenus.javaenderio-machines/.../MachineFarmingTasks.javaFarmTaskfor various planting and harvesting operations.enderio-machines/.../EnergyConfig.javaFARM_CAPACITYandFARM_USAGEfor farming energy management.enderio-machines/.../MachineNetwork.java,FarmStationSoulPacket.java,MachinePayloadHandler.java,FarmSoul.javaFarmStationSoulPacket) and handling logic for managing farm soul data.enderio-machines/.../SoulBindingRecipeProvider.java,SoulDataProvider.javaenderio-machines/.../TreeHelper.java,.../models/block/farming_station.jsonSequence Diagram(s)
Assessment against linked issues
Poem
✨ Finishing Touches
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
I pushed a fix in commit <commit_id>, please review it.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.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 using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.Other keywords and placeholders
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed.@coderabbitai summaryto generate the high-level summary at a specific location in the PR description.@coderabbitaianywhere in the PR title to generate the title automatically.CodeRabbit Configuration File (
.coderabbit.yaml).coderabbit.yamlfile to the root of your repository.# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.jsonDocumentation and Community
How close is this from being mergeable? Even if we still have some polish to do, it'd be good at this point to get this really old PR merged. We can refine later.
Actionable comments posted: 9
🧹 Nitpick comments (21)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between
9ea99e81e1and06698810f2.⛔ Files ignored due to path filters (17)
enderio-base/src/generated/resources/assets/enderio/blockstates/farming_station.jsonis excluded by!**/generated/**enderio-base/src/generated/resources/assets/enderio/models/block/farming_station_active_combined.jsonis excluded by!**/generated/**enderio-base/src/generated/resources/assets/enderio/models/block/farming_station_combined.jsonis excluded by!**/generated/**enderio-base/src/generated/resources/assets/enderio/models/item/farming_station.jsonis excluded by!**/generated/**enderio-base/src/generated/resources/data/enderio/loot_table/blocks/farming_station.jsonis excluded by!**/generated/**enderio-base/src/generated/resources/data/minecraft/tags/block/mineable/pickaxe.jsonis excluded by!**/generated/**enderio-machines/src/generated/resources/assets/enderio/blockstates/farming_station.jsonis excluded by!**/generated/**enderio-machines/src/generated/resources/assets/enderio/lang/en_us.jsonis excluded by!**/generated/**enderio-machines/src/generated/resources/assets/enderio/models/item/farming_station.jsonis excluded by!**/generated/**enderio-machines/src/generated/resources/data/enderio/eio_soul/farm/minecraft_bee.jsonis excluded by!**/generated/**enderio-machines/src/generated/resources/data/enderio/eio_soul/farm/minecraft_sniffer.jsonis excluded by!**/generated/**enderio-machines/src/generated/resources/data/enderio/eio_soul/farm/minecraft_villager.jsonis excluded by!**/generated/**enderio-machines/src/generated/resources/data/enderio/loot_table/blocks/farming_station.jsonis excluded by!**/generated/**enderio-machines/src/generated/resources/data/enderio/recipe/soulbinding/farming_station.jsonis excluded by!**/generated/**enderio-machines/src/generated/resources/data/minecraft/tags/block/mineable/pickaxe.jsonis excluded by!**/generated/**enderio-machines/src/generated/resources/data/minecraft/tags/block/needs_iron_tool.jsonis excluded by!**/generated/**enderio-machines/src/main/resources/assets/enderio/textures/block/farming_station_side.pngis excluded by!**/*.png📒 Files selected for processing (25)
enderio-base/src/main/java/com/enderio/base/api/farm/FarmInteraction.java(1 hunks)enderio-base/src/main/java/com/enderio/base/api/farm/FarmTask.java(1 hunks)enderio-base/src/main/java/com/enderio/base/api/farm/FarmTaskManager.java(1 hunks)enderio-base/src/main/java/com/enderio/base/api/farm/FarmingStation.java(1 hunks)enderio-base/src/main/java/com/enderio/base/api/integration/Integration.java(2 hunks)enderio-base/src/main/java/com/enderio/base/common/tag/EIOTags.java(1 hunks)enderio-base/src/main/resources/assets/enderio/lang/af_za.json(1 hunks)enderio-machines/src/main/java/com/enderio/machines/client/gui/screen/FarmingStationScreen.java(1 hunks)enderio-machines/src/main/java/com/enderio/machines/common/blocks/base/task/MachineFarmingTasks.java(1 hunks)enderio-machines/src/main/java/com/enderio/machines/common/blocks/farming_station/FarmingStationBlockEntity.java(1 hunks)enderio-machines/src/main/java/com/enderio/machines/common/blocks/farming_station/FarmingStationMenu.java(1 hunks)enderio-machines/src/main/java/com/enderio/machines/common/blocks/farming_station/package-info.java(1 hunks)enderio-machines/src/main/java/com/enderio/machines/common/config/common/EnergyConfig.java(2 hunks)enderio-machines/src/main/java/com/enderio/machines/common/init/MachineBlockEntities.java(2 hunks)enderio-machines/src/main/java/com/enderio/machines/common/init/MachineBlocks.java(1 hunks)enderio-machines/src/main/java/com/enderio/machines/common/init/MachineMenus.java(3 hunks)enderio-machines/src/main/java/com/enderio/machines/common/init/MachineNetwork.java(4 hunks)enderio-machines/src/main/java/com/enderio/machines/common/integrations/EnderIOMachinesSelfIntegration.java(2 hunks)enderio-machines/src/main/java/com/enderio/machines/common/network/FarmStationSoulPacket.java(1 hunks)enderio-machines/src/main/java/com/enderio/machines/common/network/MachinePayloadHandler.java(2 hunks)enderio-machines/src/main/java/com/enderio/machines/common/souldata/FarmSoul.java(1 hunks)enderio-machines/src/main/java/com/enderio/machines/common/utility/TreeHelper.java(1 hunks)enderio-machines/src/main/java/com/enderio/machines/data/recipes/SoulBindingRecipeProvider.java(2 hunks)enderio-machines/src/main/java/com/enderio/machines/data/souldata/SoulDataProvider.java(3 hunks)enderio-machines/src/main/resources/assets/enderio/models/block/farming_station.json(1 hunks)🧰 Additional context used
🪛 GitHub Actions: Verify Build
enderio-base/src/main/java/com/enderio/base/api/farm/FarmInteraction.java
[error] 1-5: The following files had format violations: Spotless formatting check failed. Run './gradlew :enderio-base:spotlessApply' to fix these violations.
enderio-base/src/main/java/com/enderio/base/api/integration/Integration.java
[error] 1-1: Spotless Java check failed: Format violations detected. Please run './gradlew :enderio-base:spotlessApply' to fix.
enderio-base/src/main/java/com/enderio/base/api/farm/FarmTaskManager.java
[error] 2-10: The following files had format violations: Spotless formatting check failed. Run './gradlew :enderio-base:spotlessApply' to fix these violations.
enderio-base/src/main/java/com/enderio/base/api/farm/FarmingStation.java
[error] 1-6: The following files had format violations: Spotless formatting check failed. Run './gradlew :enderio-base:spotlessApply' to fix these violations.
🔇 Additional comments (32)
@ -0,0 +5,4 @@POWERED,BLOCKED,IGNORED;}⚠️ Potential issue
Good enum design with clear status values.
The enum provides a clean way to represent different farming operation outcomes. The status values are self-explanatory and well-chosen.
Fix formatting to pass CI pipeline.
The pipeline failure indicates formatting issues. Run the suggested command to fix:
🧰 Tools
🪛 GitHub Actions: Verify Build
[error] 1-5: The following files had format violations: Spotless formatting check failed. Run './gradlew :enderio-base:spotlessApply' to fix these violations.
@ -0,0 +4,4 @@public interface FarmTask {FarmInteraction farm(BlockPos soil, FarmingStation farmBlockEntity);⚠️ Potential issue
Import for FarmingStation is missing.
The interface references
FarmingStationbut doesn't import it. Add the appropriate import statement.📝 Committable suggestion
@ -0,0 +40,4 @@return priority - o.priority;}}}⚠️ Potential issue
Fix formatting issues flagged by Spotless
The pipeline failure indicates that this file has formatting violations. Please run
./gradlew :enderio-base:spotlessApplyto fix these issues before merging.🧰 Tools
🪛 GitHub Actions: Verify Build
[error] 2-10: The following files had format violations: Spotless formatting check failed. Run './gradlew :enderio-base:spotlessApply' to fix these violations.
⚠️ Potential issue
New method properly follows interface design patterns.
The default empty implementation allows integrations to optionally override this method only when needed, maintaining backward compatibility.
Please run Spotless to fix formatting issues as indicated by the pipeline failure:
@ -0,0 +48,4 @@return FarmInteraction.FINISHED;}farmBlockEntity.addConsumedPower(farmBlockEntity.consumeEnergy(40 - farmBlockEntity.getConsumedPower(), false));return FarmInteraction.POWERED;🛠️ Refactor suggestion
Magic number "40" repeated throughout.
Hardcoding the cost of 40 energy in multiple places risks bugs when future changes adjust the cost. Consider extracting this into a constant (e.g.,
HARVEST_COST) or reading from a config value for easier balancing.Also applies to: 62-67, 88-93, 107-112, 126-131, 157-174, 188-204, 215-233, 242-260, 271-292, 303-329, 340-349
@ -0,0 +75,4 @@return FarmInteraction.FINISHED;}return FarmInteraction.IGNORED;};🛠️ Refactor suggestion
Consider extracting repeated plant-then-hoe logic into a helper.
Each planting task attempts to plant, then tries a hoe, then tries to plant again. This repeated approach is good but could benefit from a small helper method (or a shared routine) to keep code DRY.
@ -0,0 +323,4 @@}updateMachineState(MachineState.FULL_OUTPUT, !empty);return empty;}🛠️ Refactor suggestion
Manage full inventory and handle unusual cases
There is a TODO about handling a full inventory (line 274). If all output slots and seed slots are full, items might be lost, or the station might continue to harvest in an unintended manner.
Consider either blocking the harvesting logic when outputs are full or offering partial usage to avoid dropping or losing items. This prevents potential duplication or item loss and ensures consistent behaviour.
@ -0,0 +30,4 @@addCapacitorSlot(12, 63);var inventory = getMachineInventory();// Tool inputs TODO: Shadow slots to show compatible tools?💡 Verification agent
❓ Verification inconclusive
Address TODO or remove the comment
There's a TODO comment about implementing shadow slots to show compatible tools. Either implement this feature, create a separate issue to track it, or remove the comment if it's out of scope for the current PR.
🏁 Script executed:
Length of output: 73
Action Required: Resolve TODO for Shadow Slots Implementation
The TODO comment at line 33 in
enderio-machines/src/main/java/com/enderio/machines/common/blocks/farming_station/FarmingStationMenu.javastill indicates that shadow slots for tool inputs should display compatible tools. Please address this by taking one of the following actions:Note: The GH issue search for "tool compatibility display" did not return any results. If you intend to track this feature on GitHub, please manually verify and create a new issue.
@ -0,0 +37,4 @@}}return tree;}🛠️ Refactor suggestion
Optimize the tree detection algorithm for performance
The current implementation has several potential performance issues:
This optimization:
📝 Committable suggestion
Going to go ahead and merge this into the 7.2 working branch, this PR is massive and is likely at risk of getting conflicted again soon.
I'll put it behind a feature flag (and give it a feature pack) so it can be tested, but it'll remain out of the "main mod" for now.