Skip to content

Commit a4ea279

Browse files
committed
feat: optimize temporary gene display logic in ListGenesCommand
1 parent a7bc977 commit a4ea279

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/main/kotlin/dev/aaronhowser/mods/geneticsresequenced/command/gene/ListGenesCommand.kt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import dev.aaronhowser.mods.geneticsresequenced.util.OtherUtil
1111
import net.minecraft.commands.CommandSourceStack
1212
import net.minecraft.commands.Commands
1313
import net.minecraft.commands.arguments.EntityArgument
14+
import net.minecraft.network.chat.Component
1415
import net.minecraft.world.entity.Entity
1516
import net.minecraft.world.entity.LivingEntity
1617

@@ -97,15 +98,19 @@ object ListGenesCommand {
9798
target.displayName
9899
)
99100

100-
messageComponent.append(
101-
OtherUtil.componentList(
102-
tempGenes.map {
103-
ModLanguageProvider.Commands.TEMPORARY_GENE_WITH_DURATION.toComponent(
104-
it.geneHolder.getName(),
105-
it.ticksRemaining
106-
)
107-
}
101+
val componentList = mutableListOf<Component>()
102+
103+
for (tempGene in tempGenes) {
104+
val tempComponent = ModLanguageProvider.Commands.TEMPORARY_GENE_WITH_DURATION.toComponent(
105+
tempGene.geneHolder.getName(),
106+
tempGene.ticksRemaining
108107
)
108+
109+
componentList.add(tempComponent)
110+
}
111+
112+
messageComponent.append(
113+
OtherUtil.componentList(componentList)
109114
)
110115
},
111116
false

0 commit comments

Comments
 (0)