PaperMC / PaperMC/adventure

Provide a simple way to replace components deeply when using a ComponentRenderer

Open
#97 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: api type: enhancement
Dominant language
Java
Stars
887
Forks
160
PR merge metrics
No merged PRs in 30d

Description

Currently I am using the following code to render out styling and text replacements based on translation keys: https://gist.github.com/octylFractal/cdd92710b05b50613d96d2fee35427f2

However, my main issue is that I have to manually do deep replacement, and this leaves me open to bugs like forgetting that a translatable component can have args and children. It would be nice if adventure allowed me to write a ComponentRenderer that made the call I make at the top of render in the above code: component = replaceSubcomponents(component, context);

In this way, it would automatically deeply render all relevant parts, and as replaceSubcomponents would become part of adventure code, it would be well tested + supported by the library, as well as more likely to include any future sub-component cases.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ComponentRenderer and the replaceSubcomponents call shown in the linked gist; trace how components expose args and children. Done means a renderer can perform the deep replacement without manual traversal, with coverage for those nested parts and future relevant sub-component cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.