Skip to content

Add initial rail generator implementation#86

Open
Jasupa wants to merge 39 commits into
mainfrom
rail-generator
Open

Add initial rail generator implementation#86
Jasupa wants to merge 39 commits into
mainfrom
rail-generator

Conversation

@Jasupa

@Jasupa Jasupa commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an initial implementation of the rail generator and re-enables /gen rail.

Changes

  • Enables the rail generator command again.
  • Builds a rail path from WorldEdit selection points.
  • Places center and side blocks for generated rail tracks.
  • Adds rail generator help handling.
  • Adds support for direct block placement operations.
  • Extends generator history so rail generation can be undone/redone.

Milanote

https://app.milanote.com/1WgUAs1mA492a6?p=9H9SRXRJA3f

@Jasupa Jasupa requested review from MineFact, Zoriot and kyanvde April 30, 2026 19:53

@MineFact MineFact left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your current RailScript does not use the already existing Generator Library at all. AI basically tried to reinvent everything from scratch adding boilerplate code for every action that its currently trying to achieve. For this simple rail track this might work ok but as soon as it will get more complex this will create lots of issues and duplicated code. Please implement the rail generator the same way the road or house generator is implemented. If you can't do this yourself tell AI to first explore the repository and understand how the other generators are working. I can't accept this PR in this current state.

@Jasupa Jasupa changed the title Rail generator v1 Add initial rail generator implementation May 27, 2026
Zoriot

This comment was marked as outdated.

@Zoriot Zoriot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User feedback is still horrible. The Message you now get is nice to have.
Maybe it's useful to move some part's of the preparing stage into actual execution phase.
Currently it's very easy to crash the server, i think we should have additional safeguards for that (can be reproduced on dev server).
Also another issue you can currently start it multiple times and/or you get a faulty error message that you have no valid selection.
Seems to be relative resource heavy

Comment thread gradle/libs.versions.toml Outdated
Comment thread settings.gradle.kts Outdated
Jasupa added 20 commits June 14, 2026 13:38
feature: added a first version for the convex rail generator
- Added a railway generator entry to the generator menu
- Made railway documentation links clickable in chat
- Added RailSelectionPointReader for cuboid, polygonal, and convex selections
- Validated supported rail selections before generation
- Added RailPath and RailPathBuilder for center path generation
- Moved center path generation out of RailScripts
- Kept RailScripts focused on generation flow and placement
- Improved path handling for curves, diagonals, gaps, and direction changes
- Added side block builder for railway side/anvil placement
- Added orientation resolver for side block facing
- Added RailBlockPlacement and RailBlockRole placement model
- Added RailType interface and SampleRailType implementation
- Moved block data creation into the rail type system
- Added WorldEdit/Bukkit placement handler for rail generation
- Refactored RailScripts into an orchestration flow
- Normalised vectors before comparing block positions
- Used Vector#getBlockX/Y/Z instead of manual rounding
- Moved rail validation logic into hasValidRailSelection
- Kept checkForPlayer aligned with the generator component contract
- Improved readability of rail path and selection validation code
- Fixed the Qodana issues
- made sure only /gen rail is valid as a command and not /gen railway
- Added path, side block and placement builders
- Added validation for unsupported, too small and too large selections
- Used Bukkit scheduler for safer async generation flow
- Fixed rail help command so it does not start generation
- Fixed copied rail command to use /gen rail
- Removed lane support from v1 scope
- Fixed rail undo history for repeated generation on the same selection
- Skipped unchanged blocks to avoid unnecessary undo entries
- Made sure the existing Generator Library is used directly for the rail generator instead of making my own one.

feature:
- The rail generator now generators slower 'async' to make sure it doesn't overload servers.
- Made sure the existing Generator Library from alplibs is used directly for the rail generator where possible

feature:
- The rail generator now uses real worldedit commands and is thus much smoother and faster.
- The path curves are way smoother instead of blocky.
- Rail generator side block placement
Count position block changes by placement count, use persistent data for
internal generator commands, remove unused rail flag handling and the unused
help overload, restore the field menu flow, and simplify rail path point
handling.
Apply documentation click events to the full message, use shared command
argument handling for rail, rename the rail generator enum, use generator error
messages on failures, and extract history entry and block change models.
Replace player metadata with an internal command queue, use the non-deprecated
WorldEdit setBlock overload, combine duplicate catch handling, run rail
generation through the Bukkit scheduler, and keep history models extracted.
Use a clearer WorldEdit selection check, send rail errors with Adventure
components, document missing control point heights, and note that the old
RailPathBuilder block comparison code no longer exists.
- validate rail selections before generation
- add rail type settings and menu flow
- place rail blocks on terrain surface per column
- fix missing side anvils and anvil facing in rail corners
- use Alps-Lib block placement helper
- replace generator operation array casts with typed accessors
- avoid Arrays.asList for operation arrays
- add fallback material for rail type icons
- log rail script failures through ChatHelper
- removed mavenLocal()
- updated the alpslib to latest version
Jasupa added 5 commits June 14, 2026 13:38
- prevent starting multiple rail generations for the same player
- validate rail path and preparation size before heavy terrain analysis
- add clearer rail generation status and limit messages
- stop failed generator commands instead of retrying them
- restore production dependency settings
- replace deprecated FAWE clipboard loading
- close generator collection clipboards with try-with-resources
- replace generator action bar strings with Adventure components
- simplify rail preparation center path validation
- add clearer rail generation status and limit messages
- stop failed generator commands instead of retrying them
- restore production dependency settings
- replace deprecated FAWE clipboard loading
- read rail generation safeguards from config

- split rail block placement into batches for smoother progress

- queue rail finish handling back on the main thread

- avoid redundant scheduler hops for rail player messages
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

Qodana for JVM

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

@BuildTheEarth BuildTheEarth deleted a comment from github-actions Bot Jun 18, 2026
@BuildTheEarth BuildTheEarth deleted a comment from github-actions Bot Jun 18, 2026
@Zoriot Zoriot added ⏰ medium priority This currently has medium priority. 🐘 large size This is a large issue. labels Jun 18, 2026

@Zoriot Zoriot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are coming near the finish line. Most things are fine, some things should be cleaned up.
Please also update your branch

Comment thread src/main/resources/config.yml Outdated
Comment thread src/main/java/net/buildtheearth/buildteamtools/utils/io/ConfigPaths.java Outdated
Jasupa and others added 10 commits June 19, 2026 07:08
- move rail generator limits into a generator module config
- read rail safeguards from the generator config
- keep the disabled field generator from opening its flow
- restore generator menu full-pattern mask constants
- simplify generator collection clipboard validation
- raise default rail limits for 4 GB servers
- remove unused rail script constructor
- prefix rail preparation messages with ChatHelper
- avoid unnecessary scheduler hops for player messages
- place rails on the nearest valid floor with open placement space
- prevent underground rails from snapping to the surface
- split rail limits, progress tracking, and placement value objects out of RailScripts
- reduce RailScripts size and address useful local warnings
- cache resolved rail heights and indexed prepared blocks
- report finish failures and run preparation callbacks safely
- clamp rail config values to safe upper bounds
- stop progress work when players disconnect or plugin disables
- handle mixed missing-height control points
- key side block placement by full position for height-separated rails
- send generator errors as prefixed Adventure components
- remove unused generator info message helper
- prefix rail validation and busy messages
- use XMaterial for rail type icons
- align railway menu item formatting
- use consistent generator menu item creation
- prefix generator documentation messages
- build generator success messages with Adventure components
- prefix history undo and redo errors
- apply command model cleanup suggestions
- remove scheduled undo and redo feedback messages
- delete unused history entry constructors
- format operation values with a switch
- clean up script formatting and stale comments
- mark config path containers as utility classes
- add generator command tab completion
- send generator help URLs as clickable Adventure components
- keep the standard chat prefix on help messages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐘 large size This is a large issue. ⏰ medium priority This currently has medium priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants