FTBTeam / FTB-Mods-Issues

Any mod issues, be it FTB Teams, Quests or any other of our mods can be reported here!
22 stars 1 forks source link

[Feature Request]: FTB Ranks name_format dimension token #994

Open tadeuszb opened 11 months ago

tadeuszb commented 11 months ago

Mod

FTB Ranks

Description

Add the {dimension} token for ftbranks.name_format It would be nice to have the possibility to show the dimension that the player is on on chat for specific ranks on the server.

Describe the solution you'd like

Allow adding the dimension token in the name format in ranks.

Example:

ftbranks.name_format: "[{dimension}] {name}"

would show for example: [Overworld] Ted

Describe alternatives you've considered

Possibility to write a part of a code to inject in config that would have to return variable that can be casted to string (to be shown in the specific token). Example:

custom: { name: "Custom" power: 2 ftbranks.name_format: "&4{custom}&r {name}" customtoken: ClientWorld world = Minecraft.getInstance().world; assert world != null; worldTime = world.getDayTime(); return worldTime }

tadeuszb commented 11 months ago

It would be great to be able to get the ID of the dimension and add logic to it like:

ftbranks.name_format: "&{(dimension_id%4)+1}{dimension}&r {name}"
desht commented 11 months ago

Substituting the dimension ID wouldn't be hard and is a good idea, although only the vanilla dimensions could have friendly names - "Overworld", "The Nether", "The End". Modded dimensions don't have any standard way of converting to a friendly name, so you will have something like "twilight_forest:twilight_forest", or even "ftbteamdimensions:team/edcdf76f-cd46-4b3e-8851-5209d785d771".

But I don't know what you mean by a construct like &{(dimension_id%4)+1} . Dimension ID's aren't numeric quantities, they're resource locations. And adding arithmetic logic to a text substitution like this is not something I plan to do, sorry.

(Same for the idea of allowing Java code to be used in config file - that will never ever happen)

tadeuszb commented 11 months ago

Oh, sorry I thought they are enums for some reason. For the first issue - what about a solution like this: make a token that will take a dimension ID and also add configuration mapping. That will allow to add custom mappings. Like the token will be for example {dimension} {name and for normal ones it will work normally, but the user will notice that for dimension X he has x_13241 Ted for example. So he can edit the configuration file and add mapping that will be taken into account while using token. Like:

{
  "x_13241": "Old Mines Dimension"
}

So the code should check if there is mapping for the given EXACT (to prevent changing the substrings) ID and if it is available in the mapping file - use it instead the ID 🤔

Oh! The same could be for the ID {dimension_number}

{
  "x_13241": 4
}

Both could be then used to make the prefixes with specific configurable color (without require to add any calculations) 😄