Skip to content

Implement React-inspired GUI framework with recursive child rendering and viewer-specific updates#203

Draft
Copilot wants to merge 96 commits intoversion/1.21.11from
copilot/implement-new-gui-framework
Draft

Implement React-inspired GUI framework with recursive child rendering and viewer-specific updates#203
Copilot wants to merge 96 commits intoversion/1.21.11from
copilot/implement-new-gui-framework

Conversation

Copy link
Contributor

Copilot AI commented Feb 3, 2026

Add onInit Lifecycle Hook to Components ✅

Added onInit() lifecycle hook that is called before a component is first rendered.

Changes:

  • Added onInit(context: LifecycleContext) method to Component class
  • Added INIT to LifecycleEventType enum
  • onInit is called before onFirstRender for components and all children recursively
  • Each component's onInit is called exactly once, tracked via initializedComponents set

Usage:

class MyComponent : Component() {
    override fun onInit(context: LifecycleContext) {
        // Initialize state before first render
        // Modify properties, set up initial values, etc.
    }
    
    override fun onFirstRender(context: LifecycleContext) {
        // Component is now ready to render
    }
}

Allows components to set up initial state before being rendered for the first time.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@ammodev
Copy link
Contributor

ammodev commented Feb 3, 2026

@copilot dont generate tests or test classes yet.

@ammodev
Copy link
Contributor

ammodev commented Feb 3, 2026

@copilot provide dsl for all usefull things

@ammodev
Copy link
Contributor

ammodev commented Feb 3, 2026

@copilot the framework should be folia compatible and also follow our design guidelines. use your instructions provided in this repository.

@ammodev
Copy link
Contributor

ammodev commented Feb 3, 2026

@copilot You can use https://github.com/devnatan/inventory-framework as an example

Copilot AI and others added 4 commits February 3, 2026 19:01
Co-authored-by: ammodev <32338899+ammodev@users.noreply.github.com>
Co-authored-by: ammodev <32338899+ammodev@users.noreply.github.com>
Co-authored-by: ammodev <32338899+ammodev@users.noreply.github.com>
Co-authored-by: ammodev <32338899+ammodev@users.noreply.github.com>
@ammodev
Copy link
Contributor

ammodev commented Feb 3, 2026

@copilot remove the tests for now, also register the listener in the correct surf-api-bukkit-server class and not in the test plugin

… access

Co-authored-by: ammodev <32338899+ammodev@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement new component-based GUI framework Implement React-inspired component-based GUI framework Feb 3, 2026
Copilot AI requested a review from ammodev February 3, 2026 19:14
…d make Folia-compatible

Co-authored-by: ammodev <32338899+ammodev@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 3, 2026

@copilot dont generate tests or test classes yet.

Test files removed in commit 1eb2afb. Deleted TestGuiView.kt and NewGuiTest.kt.

@copilot provide dsl for all usefull things

Added comprehensive DSL in commit 1eb2afb:

  • View configuration DSL with size/rows/title helpers
  • Slot utilities: fillSlots(), fillRow(), fillBorders()
  • Positioning: slotAt(), centerInRow(), centerComponents()
  • Helper: glassPane() for common UI borders

See ViewDsl.kt for all available utilities.

@copilot the framework should be folia compatible and also follow our design guidelines. use your instructions provided in this repository.

Made Folia-compatible in commit 1eb2afb:

  • Replaced Bukkit scheduler with coroutine entity dispatchers
  • Using launch(player.entityDispatcher) for all tasks
  • Proper cancellation with Job instead of task IDs
  • Compatible with both Folia and standard Paper/Spigot

@copilot remove the tests for now, also register the listener in the correct surf-api-bukkit-server class and not in the test plugin

Done in commit 1eb2afb:

  • Removed test files (TestGuiView.kt, NewGuiTest.kt)
  • Moved listener registration to BukkitInstance.kt in surf-api-bukkit-server
  • Removed from test plugin BukkitPluginMain.kt

Co-authored-by: ammodev <32338899+ammodev@users.noreply.github.com>
@ammodev
Copy link
Contributor

ammodev commented Feb 3, 2026

@copilot

views should not have an active "player"/viewer as the view needs to hold the global/shared props. Thus the prop scope isnt needed.

check that all listeners are folia compatible

components should be able to be itemless. for example if i need a paginated component the component itself cannot render "one" itemstack. It needs to render multiple items at specific places

views should have the option to be created in other types, eg. hopper, etc.

views can also be smaller than 9 rows, eg. 1x5 row

Copilot AI changed the title Implement React-inspired component-based GUI framework Implement React-inspired component-based GUI framework with Folia support Feb 3, 2026
…ifferent inventory types

Co-authored-by: ammodev <32338899+ammodev@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 3, 2026

@copilot

views should not have an active "player"/viewer as the view needs to hold the global/shared props. Thus the prop scope isnt needed.
...

All requested changes implemented in commit c648711:

1. Props are now view-global:

  • Removed PropScope - all props belong to the view
  • MutableProp for global view state
  • ViewerMutableProp for per-viewer isolation
  • PropContext removed, props accessed via prop.get() or prop.get(viewerId)

2. Listeners are Folia-compatible:

  • Event handlers are synchronous (safe)
  • All scheduled tasks use launch(player.entityDispatcher)
  • Proper isActive checks and job cancellation

3. Components can be itemless:

  • render() now returns ItemStack? (nullable)
  • Added renderSlots(): Map<Int, ItemStack> for multi-slot components
  • ContainerComponent for paginated/complex layouts
  • Example: Pagination component can render items at slots 0-8

4. Multiple inventory types:

  • ViewConfig.type supports CHEST, HOPPER, DROPPER, etc.
  • Automatic size handling per type
  • rows property for CHEST (1-6 rows)

5. Flexible sizing:

  • CHEST: 1-6 rows (9-54 slots)
  • Other types use native sizes (HOPPER=5, DISPENSER=9, etc.)

Co-authored-by: ammodev <32338899+ammodev@users.noreply.github.com>
@ammodev
Copy link
Contributor

ammodev commented Feb 4, 2026

@copilot Bau noch ein onInit in den component ein, damit man sachen ändern kann, bevor er das erste mal gerendert wird

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

⚠️ API/ABI changes detected!

This PR contains changes that modified the public API. To update the reference ABI dumps:

./gradlew updateLegacyAbi
git add **/api/**
git commit -m "Update ABI reference"
git push

After updating, the CI will pass. Make sure the changes are backward compatible.

- Added onInit() lifecycle hook to Component class
- Added INIT to LifecycleEventType enum
- onInit called before onFirstRender for components and all children recursively
- Allows components to modify state/properties before first render
- Tracked via initializedComponents set to ensure onInit called only once per component

Co-authored-by: ammodev <32338899+ammodev@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 4, 2026

@copilot Bau noch ein onInit in den component ein, damit man sachen ändern kann, bevor er das erste mal gerendert wird

Added in commit ea4b26c. Components now have onInit() lifecycle hook that is called before first render, allowing state initialization before rendering.

Copilot stopped work on behalf of ammodev due to an error February 4, 2026 17:21
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

⚠️ API/ABI changes detected!

This PR contains changes that modified the public API. To update the reference ABI dumps:

./gradlew updateLegacyAbi
git add **/api/**
git commit -m "Update ABI reference"
git push

After updating, the CI will pass. Make sure the changes are backward compatible.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

⚠️ API/ABI changes detected!

This PR contains changes that modified the public API. To update the reference ABI dumps:

./gradlew updateLegacyAbi
git add **/api/**
git commit -m "Update ABI reference"
git push

After updating, the CI will pass. Make sure the changes are backward compatible.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

⚠️ API/ABI changes detected!

This PR contains changes that modified the public API. To update the reference ABI dumps:

./gradlew updateLegacyAbi
git add **/api/**
git commit -m "Update ABI reference"
git push

After updating, the CI will pass. Make sure the changes are backward compatible.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

⚠️ API/ABI changes detected!

This PR contains changes that modified the public API. To update the reference ABI dumps:

./gradlew updateLegacyAbi
git add **/api/**
git commit -m "Update ABI reference"
git push

After updating, the CI will pass. Make sure the changes are backward compatible.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

⚠️ API/ABI changes detected!

This PR contains changes that modified the public API. To update the reference ABI dumps:

./gradlew updateLegacyAbi
git add **/api/**
git commit -m "Update ABI reference"
git push

After updating, the CI will pass. Make sure the changes are backward compatible.

1 similar comment
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

⚠️ API/ABI changes detected!

This PR contains changes that modified the public API. To update the reference ABI dumps:

./gradlew updateLegacyAbi
git add **/api/**
git commit -m "Update ABI reference"
git push

After updating, the CI will pass. Make sure the changes are backward compatible.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

⚠️ API/ABI changes detected!

This PR contains changes that modified the public API. To update the reference ABI dumps:

./gradlew updateLegacyAbi
git add **/api/**
git commit -m "Update ABI reference"
git push

After updating, the CI will pass. Make sure the changes are backward compatible.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

⚠️ API/ABI changes detected!

This PR contains changes that modified the public API. To update the reference ABI dumps:

./gradlew updateLegacyAbi
git add **/api/**
git commit -m "Update ABI reference"
git push

After updating, the CI will pass. Make sure the changes are backward compatible.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

⚠️ API/ABI changes detected!

This PR contains changes that modified the public API. To update the reference ABI dumps:

./gradlew updateLegacyAbi
git add **/api/**
git commit -m "Update ABI reference"
git push

After updating, the CI will pass. Make sure the changes are backward compatible.

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