Ayfri
12/12/2021, 3:53 PMSrSouza
12/12/2021, 3:54 PMAdam Powell
12/12/2021, 3:54 PMAyfri
12/12/2021, 3:57 PMAdam Powell
12/12/2021, 4:05 PMval first: String get() = second.name
?hfhbd
12/12/2021, 4:15 PMderivedState
. But a regular extension method sounds simpler.Adam Powell
12/12/2021, 4:24 PMderivedStateOf
is a good choice if the calculation is expensive and the result should be cached; if not, just make it a function that calculates the result based on the input statesAyfri
12/12/2021, 4:33 PMRecipe
type and Texture
type, and for recipes there is CraftingShapedRecipeTemplate
and CraftingShapelessRecipeTemplate()
and SmeltingRecipeTemplate()
etc, same for Texture
, there are multiple types
But I have 1 box that contains the fields the user have to complete for the template, like name
, id
etc, there are a lot of different fields through the templates
So to know what template I have, I have multiple Enums, like RecipeType
and TextureType
, and for each enum I have a function toTemplate()
which transform itself into the template
So for now when my second value changes, I set the first one to the Enum name and in the box I get back the template by searching through all the Enum if in any I can find a Enum value matching, using MyEnum.values().find { it.name == firstValue } ?: MyOtherEnum.Values().find { it.name == firstValue } etc
and then I execute .toTemplate()
or I return if null
I don't know if it is a good architecture but I thought of thisAdam Powell
12/12/2021, 4:42 PMAny
and a when (value) { is EnumTypeOne -> ...
would be better than going through stringsAyfri
12/12/2021, 4:49 PMwhen (...) { is ...
so