Skip to content

Add initial rail generator implementation#86

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

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

Conversation

@Jasupa
Copy link
Copy Markdown
Contributor

@Jasupa Jasupa commented Apr 30, 2026

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
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 30, 2026

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

Copy link
Copy Markdown
Member

@MineFact MineFact left a comment

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
Copy link
Copy Markdown
Collaborator

@Zoriot Zoriot left a comment

Choose a reason for hiding this comment

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

Generally it works. Sometimes it generates nothing for part's also it's in the air where it shouldn't be. The User feedback is bad, you put in the cmd, it waits for some seconds and then pastes everything at once, no feedback at all at start.

It currently doesn't check if you are in the right mode. (In that case at least for cyl the error message Rail Generator needs at least two points is outputted twice).

I don't see where more rail types or other gen features can be easily added. It would be nice to have at least one settings so that's also considered.

There is also no menu. Please also link the requirements milanote in the pr.

Please also take the comments from Nudelsuppe into consideration.

Image

Jasupa added 20 commits June 6, 2026 09:10
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants